summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-10-22 02:52:40 -0300
committerGitHub <noreply@github.com>2023-10-22 16:52:40 +1100
commitec86f10b0f933fd848036e149d1ef34f28571c37 (patch)
treede4bcf58005c8f0d349de61c403e97d5aeaa72f6 /include
parent425238fd5d0d6962e2c1c334c28a944593e91511 (diff)
`SCHEDULE_TIME` (#1438)
* SCHEDULE_CALC_TIME_ALT * add s32 cast to avoid f32 -> u16 direct cast * SCHEDULE_TIME * remove the alts * Update explanation about the script
Diffstat (limited to 'include')
-rw-r--r--include/z64schedule.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/z64schedule.h b/include/z64schedule.h
index 07a942e90..aafa8520e 100644
--- a/include/z64schedule.h
+++ b/include/z64schedule.h
@@ -28,10 +28,13 @@
*/
// Macro to convert the time format used in the save struct into the format used in Schedule
-#define SCHEDULE_CONVERT_TIME(time) ((u16)((time) - 0x10000 / 360 * 90))
+#define SCHEDULE_CONVERT_TIME(time) ((s32)((time) - 0x10000 / 360 * 90))
+
+#define SCHEDULE_TIME(hour, minute) SCHEDULE_CONVERT_TIME((((hour)*60.0f) + (minute)) * (0x10000 / 60 / 24.0f))
+
#define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time)
-typedef enum {
+typedef enum ScheduleCommandId {
/* 0x00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch
/* 0x01 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch
/* 0x02 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch