mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-14 21:40:03 +00:00
f9d96d9f73
* Less warnings in boot & code segments * few more warnings gone * Ran formatter * z_view warning gone * -> 1 * f31 -> 31 * Remove function casts * Few more small improvements * Separate declaration and assignment in func_80091738 and Item_Give Co-authored-by: Thar0 <maximilianc64@gmail.com>
97 lines
2.3 KiB
C
97 lines
2.3 KiB
C
#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;
|
|
}
|
|
}
|