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
This commit is contained in:
Anghelo Carvajal
2023-10-22 02:52:40 -03:00
committed by GitHub
parent 425238fd5d
commit ec86f10b0f
9 changed files with 124 additions and 40 deletions
+5 -2
View File
@@ -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