summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/clock.c2
-rw-r--r--src/event_data.c7
-rw-r--r--src/palette.c33
-rw-r--r--src/scrcmd.c2
4 files changed, 26 insertions, 18 deletions
diff --git a/src/clock.c b/src/clock.c
index d52fde22e..1e7c5f83e 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -41,7 +41,7 @@ static void UpdatePerDay(struct Time *localTime)
if (*days != localTime->days && *days <= localTime->days)
{
daysSince = localTime->days - *days;
- ClearUpperFlags();
+ ClearDailyFlags();
UpdateDewfordTrendPerDay(daysSince);
UpdateTVShowsPerDay(daysSince);
UpdateWeatherPerDay(daysSince);
diff --git a/src/event_data.c b/src/event_data.c
index df289c538..a9da142e5 100644
--- a/src/event_data.c
+++ b/src/event_data.c
@@ -3,7 +3,7 @@
#include "pokedex.h"
#define TEMP_FLAGS_SIZE 0x4
-#define TEMP_UPPER_FLAGS_SIZE 0x8
+#define DAILY_FLAGS_SIZE 0x8
#define TEMP_VARS_SIZE 0x20
EWRAM_DATA u16 gSpecialVar_0x8000 = 0;
@@ -48,10 +48,9 @@ void ClearTempFieldEventData(void)
FlagClear(FLAG_NURSE_UNION_ROOM_REMINDER);
}
-// Probably had different flag splits at one point.
-void ClearUpperFlags(void)
+void ClearDailyFlags(void)
{
- memset(gSaveBlock1Ptr->flags + 0x124, 0, TEMP_UPPER_FLAGS_SIZE);
+ memset(gSaveBlock1Ptr->flags + 0x124, 0, DAILY_FLAGS_SIZE);
}
void DisableNationalPokedex(void)
diff --git a/src/palette.c b/src/palette.c
index be5143876..5d1d6635c 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -115,7 +115,7 @@ u8 UpdatePaletteFade(void)
u8 dummy = 0;
if (sPlttBufferTransferPending)
- return -1;
+ return PALETTE_FADE_STATUS_LOADING;
if (gPaletteFade.mode == NORMAL_FADE)
result = UpdateNormalPaletteFade();
@@ -409,11 +409,11 @@ static u8 UpdateNormalPaletteFade(void)
u16 selectedPalettes;
if (!gPaletteFade.active)
- return 0;
+ return PALETTE_FADE_STATUS_DONE;
if (IsSoftwarePaletteFadeFinishing())
{
- return gPaletteFade.active;
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
}
else
{
@@ -483,7 +483,9 @@ static u8 UpdateNormalPaletteFade(void)
}
}
- return gPaletteFade.active;
+ // gPaletteFade.active cannot change since the last time it was checked. So this
+ // is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
}
}
@@ -578,10 +580,11 @@ static u8 UpdateFastPaletteFade(void)
s8 b;
if (!gPaletteFade.active)
- return 0;
+ return PALETTE_FADE_STATUS_DONE;
if (IsSoftwarePaletteFadeFinishing())
- return gPaletteFade.active;
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
+
if (gPaletteFade.objPaletteToggle)
{
@@ -688,7 +691,9 @@ static u8 UpdateFastPaletteFade(void)
gPaletteFade.objPaletteToggle ^= 1;
if (gPaletteFade.objPaletteToggle)
- return gPaletteFade.active;
+ // gPaletteFade.active cannot change since the last time it was checked. So this
+ // is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
if (gPaletteFade.y - gPaletteFade.deltaY < 0)
gPaletteFade.y = 0;
@@ -714,8 +719,10 @@ static u8 UpdateFastPaletteFade(void)
gPaletteFade.mode = NORMAL_FADE;
gPaletteFade.softwareFadeFinishing = 1;
}
-
- return gPaletteFade.active;
+
+ // gPaletteFade.active cannot change since the last time it was checked. So this
+ // is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
}
void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 shouldResetBlendRegisters)
@@ -739,12 +746,12 @@ void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 should
static u8 UpdateHardwarePaletteFade(void)
{
if (!gPaletteFade.active)
- return 0;
+ return PALETTE_FADE_STATUS_DONE;
if (gPaletteFade.delayCounter < gPaletteFade_delay)
{
gPaletteFade.delayCounter++;
- return 2;
+ return PALETTE_FADE_STATUS_DELAY;
}
gPaletteFade.delayCounter = 0;
@@ -778,7 +785,9 @@ static u8 UpdateHardwarePaletteFade(void)
gPaletteFade.shouldResetBlendRegisters = 0;
}
- return gPaletteFade.active;
+ // gPaletteFade.active cannot change since the last time it was checked. So this
+ // is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
+ return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
}
static void UpdateBlendRegisters(void)
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 837259a7f..51d96ff2e 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -690,7 +690,7 @@ bool8 ScrCmd_initclock(struct ScriptContext *ctx)
return FALSE;
}
-bool8 ScrCmd_dodailyevents(struct ScriptContext *ctx)
+bool8 ScrCmd_dotimebasedevents(struct ScriptContext *ctx)
{
DoTimeBasedEvents();
return FALSE;