mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
git subrepo clone https://github.com/HarbourMasters/soh.git
subrepo: subdir: "soh" merged: "ba904bbd0" upstream: origin: "https://github.com/HarbourMasters/soh.git" branch: "master" commit: "ba904bbd0" git-subrepo: version: "0.4.1" origin: "???" commit: "???"
This commit is contained in:
parent
0bb0e7b53b
commit
39cc86c260
2466 changed files with 451557 additions and 0 deletions
97
soh/src/code/shrink_window.c
Normal file
97
soh/src/code/shrink_window.c
Normal file
|
@ -0,0 +1,97 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 D_8012CED0 = 0;
|
||||
|
||||
s32 sShrinkWindowVal = 0;
|
||||
s32 sShrinkWindowCurrentVal = 0;
|
||||
|
||||
void ShrinkWindow_SetVal(s32 value) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_setval(%d)\n", value);
|
||||
}
|
||||
sShrinkWindowVal = value;
|
||||
}
|
||||
|
||||
u32 ShrinkWindow_GetVal(void) {
|
||||
return sShrinkWindowVal;
|
||||
}
|
||||
|
||||
void ShrinkWindow_SetCurrentVal(s32 currentVal) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_setnowval(%d)\n", currentVal);
|
||||
}
|
||||
sShrinkWindowCurrentVal = currentVal;
|
||||
}
|
||||
|
||||
u32 ShrinkWindow_GetCurrentVal(void) {
|
||||
return sShrinkWindowCurrentVal;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Init(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_init()\n");
|
||||
}
|
||||
D_8012CED0 = 0;
|
||||
sShrinkWindowVal = 0;
|
||||
sShrinkWindowCurrentVal = 0;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Destroy(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_cleanup()\n");
|
||||
}
|
||||
sShrinkWindowCurrentVal = 0;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Update(s32 updateRate) {
|
||||
s32 off;
|
||||
|
||||
if (updateRate == 3) {
|
||||
off = 10;
|
||||
} else {
|
||||
off = 30 / updateRate;
|
||||
}
|
||||
|
||||
if (sShrinkWindowCurrentVal < sShrinkWindowVal) {
|
||||
if (D_8012CED0 != 1) {
|
||||
D_8012CED0 = 1;
|
||||
}
|
||||
|
||||
if (sShrinkWindowCurrentVal + off < sShrinkWindowVal) {
|
||||
sShrinkWindowCurrentVal += off;
|
||||
} else {
|
||||
sShrinkWindowCurrentVal = sShrinkWindowVal;
|
||||
}
|
||||
} else if (sShrinkWindowVal < sShrinkWindowCurrentVal) {
|
||||
if (D_8012CED0 != 2) {
|
||||
D_8012CED0 = 2;
|
||||
}
|
||||
|
||||
if (sShrinkWindowVal < sShrinkWindowCurrentVal - off) {
|
||||
sShrinkWindowCurrentVal -= off;
|
||||
} else {
|
||||
sShrinkWindowCurrentVal = sShrinkWindowVal;
|
||||
}
|
||||
} else {
|
||||
D_8012CED0 = 0;
|
||||
}
|
||||
|
||||
if (HREG(80) == 0x13) {
|
||||
if (HREG(94) != 0x13) {
|
||||
HREG(94) = 0x13;
|
||||
HREG(81) = 0;
|
||||
HREG(82) = 0;
|
||||
HREG(83) = 0;
|
||||
HREG(84) = 0;
|
||||
HREG(85) = 0;
|
||||
HREG(86) = 0;
|
||||
HREG(87) = 0;
|
||||
HREG(88) = 0;
|
||||
HREG(89) = 0;
|
||||
}
|
||||
HREG(83) = D_8012CED0;
|
||||
HREG(84) = sShrinkWindowCurrentVal;
|
||||
HREG(85) = sShrinkWindowVal;
|
||||
HREG(86) = off;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue