summaryrefslogtreecommitdiff
path: root/src/manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/manager')
-rw-r--r--src/manager/enterRoomTextboxManager.c4
-rw-r--r--src/manager/entitySpawnManager.c2
-rw-r--r--src/manager/ezloHintManager.c2
-rw-r--r--src/manager/lightManager.c67
-rw-r--r--src/manager/vaati3StartManager.c4
5 files changed, 34 insertions, 45 deletions
diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c
index a720a788..61276437 100644
--- a/src/manager/enterRoomTextboxManager.c
+++ b/src/manager/enterRoomTextboxManager.c
@@ -34,7 +34,7 @@ void sub_0805E1F8(u32, bool32);
void EnterRoomTextboxManager_Main(EnterRoomTextboxManager* this) {
EnterRoomTextboxManager_Actions[super->action](this);
- if ((gRoomControls.room != this->unk_20) || (gMessage.doTextBox & 0x7F)) {
+ if ((gRoomControls.room != this->unk_20) || (gMessage.state & MESSAGE_ACTIVE)) {
sub_0805E1D8(this);
}
}
@@ -56,7 +56,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) {
if (--super->subtimer == 0) {
super->type2 = 0;
gPlayerState.controlMode = CONTROL_1;
- ResetSystemPriority();
+ ClearEventPriority();
}
}
if (--super->timer == 0) {
diff --git a/src/manager/entitySpawnManager.c b/src/manager/entitySpawnManager.c
index 900b6480..6303d998 100644
--- a/src/manager/entitySpawnManager.c
+++ b/src/manager/entitySpawnManager.c
@@ -26,7 +26,7 @@ void EntitySpawnManager_Main(EntitySpawnManager* this) {
if (super->type2 != 0) {
super->type2 = 0;
SetPlayerControl(0xff);
- sub_08078B48();
+ PausePlayer();
}
if (this->spawnTimer == 0) {
if (this->sound != 0) {
diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c
index f98b97f3..4f6a2723 100644
--- a/src/manager/ezloHintManager.c
+++ b/src/manager/ezloHintManager.c
@@ -69,7 +69,7 @@ static void EzloHintManager_Action2(EzloHintManager* this) {
if (!PlayerStateValid(this))
return;
SetPlayerControl(3);
- sub_08078B48();
+ PausePlayer();
SetPlayerEventPriority();
super->action = 3;
super->subAction = 0;
diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c
index c8d8241d..c34c4755 100644
--- a/src/manager/lightManager.c
+++ b/src/manager/lightManager.c
@@ -20,8 +20,8 @@ extern void sub_0801E120(void);
extern void sub_0801E154(u32);
extern void sub_0801E160(u32, u32, u32);
-bool32 sub_0805BA78();
-void sub_0805BAD4();
+bool32 LerpLightLevel();
+void UpdateLightAlpha();
void LightManager_Main(LightManager* this) {
s32 sVar1;
@@ -43,8 +43,8 @@ void LightManager_Main(LightManager* this) {
}
if (gMain.substate == GAMEMAIN_UPDATE) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
- sub_0805BA78();
- sub_0805BAD4();
+ LerpLightLevel();
+ UpdateLightAlpha();
}
if (gArea.lightType == 2) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
@@ -87,44 +87,33 @@ void LightManager_Main(LightManager* this) {
#define ABS(x) ((unsigned)(x < 0 ? -(x) : x))
-bool32 sub_0805BA78() {
- u32 uVar1;
- s32 iVar1;
- s32 iVar2;
-
- iVar2 = (short)gArea.lightLevel;
- iVar1 = gRoomVars.lightLevel;
+bool32 LerpLightLevel() {
+ s32 tgt;
+ s32 cur;
- if (iVar1 < 0) {
- iVar1 = 0;
- }
+ cur = (short)gArea.lightLevel;
+ tgt = gRoomVars.lightLevel;
- if (0x100 < iVar1) {
- iVar1 = 0x100;
- }
+ tgt = max(tgt, 0);
+ tgt = min(tgt, 0x100);
- if (iVar2 != iVar1) {
- if (ABS(iVar1 - iVar2) <= 4) {
- iVar2 = iVar1;
- } else {
- if (iVar1 < iVar2) {
- iVar2 = iVar2 - 4;
- } else {
- if (iVar1 > iVar2) {
- iVar2 = iVar2 + 4;
- }
- }
+ if (cur != tgt) {
+ if (ABS(tgt - cur) <= 4) {
+ cur = tgt;
+ } else if (tgt < cur) {
+ cur -= 4;
+ } else if (tgt > cur) {
+ cur += 4;
}
- gArea.lightLevel = iVar2;
- } else {
- return FALSE;
+ gArea.lightLevel = cur;
+ return TRUE;
}
- return TRUE;
+ return FALSE;
}
extern u16 gUnk_08108CA8[];
-void sub_0805BAD4() {
+void UpdateLightAlpha() {
static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808,
0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 };
if (gArea.lightType != 0) {
@@ -164,8 +153,8 @@ void sub_0805BB74(s32 lightLevel) {
if (manager) {
LightManager_Main(manager);
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
- sub_0805BA78();
- sub_0805BAD4();
+ LerpLightLevel();
+ UpdateLightAlpha();
}
}
@@ -175,9 +164,9 @@ bool32 UpdateLightLevel() {
iVar1 = FALSE;
if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
- iVar1 = sub_0805BA78();
+ iVar1 = LerpLightLevel();
if (iVar1) {
- sub_0805BAD4();
+ UpdateLightAlpha();
}
}
return iVar1;
@@ -189,9 +178,9 @@ s32 sub_0805BC04(void) {
iVar1 = 0;
if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
- iVar1 = sub_0805BA78();
+ iVar1 = LerpLightLevel();
if (iVar1) {
- sub_0805BAD4();
+ UpdateLightAlpha();
}
}
return iVar1;
diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c
index 6d1c666d..c30c1e4b 100644
--- a/src/manager/vaati3StartManager.c
+++ b/src/manager/vaati3StartManager.c
@@ -70,7 +70,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
super->subAction = 0;
super->timer = 120;
SetPlayerControl(2);
- sub_08078B48();
+ PausePlayer();
object = CreateObject(THUNDERBOLT, 0, 0);
if (object != NULL) {
object->x.HALF.HI = gRoomControls.origin_x + 0x88;
@@ -100,7 +100,7 @@ void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) {
}
void Vaati3StartManager_Type0_Action3(Vaati3StartManager* this) {
- if ((gMessage.doTextBox & 0x7f) == 0) {
+ if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
if (super->timer != 0) {
super->timer--;
} else {