diff --git a/include/constants/direction.h b/include/constants/direction.h index bfa80d9c3..c2a1d19f6 100644 --- a/include/constants/direction.h +++ b/include/constants/direction.h @@ -14,6 +14,7 @@ enum Direction DIRECTION_NORTHWEST, DIRECTION_WEST, DIRECTION_SOUTHWEST, + NUM_DIRECTIONS }; @@ -33,4 +34,4 @@ enum DirectionTransformation DIR_TRANS_11, }; -#endif +#endif // GUARD_CONSTANTS_DIRECTION_H diff --git a/include/data_script.h b/include/data_script.h index 11fc1ee9d..76652d1ca 100644 --- a/include/data_script.h +++ b/include/data_script.h @@ -338,6 +338,11 @@ #define CMD_UNK_8A(a,b,t) { CMD_BYTE_8A, a, b, t, 0, NULL } +// Sets the parent object's direction then waits the specified number of frames. +// d: Direction to set. Can be -1 also, which doesn't set the object's direction, but is still stored in the action script data. +// f: Amount of frames to wait afterwards. +#define SET_DIR_WAIT(d, f) { CMD_BYTE_8B, f, d, 0, 0, NULL } + #define CMD_UNK_8C(a,t,c) { CMD_BYTE_8C, a, t, c, 0, NULL } #define CMD_UNK_8D(a,t) { CMD_BYTE_8D, a, t, 0, 0, NULL } diff --git a/include/structs/str_ground_script.h b/include/structs/str_ground_script.h index f6a26a754..359d11bee 100644 --- a/include/structs/str_ground_script.h +++ b/include/structs/str_ground_script.h @@ -51,10 +51,10 @@ typedef struct ScriptData /* 0x20 */ u8 curScriptOp; // See enum "ScriptOpID" /* 0x22 */ s16 unk22; /* 0x24 */ u16 unk24; - /* 0x26 */ s8 unk26; + /* 0x26 */ s8 storedDir; // Can be -1. /* 0x28 */ s16 branchDiscriminant; - /* 0x2A */ s16 unk2A; - /* 0x2C */ s16 unk2C; + /* 0x2A */ s16 unk2A; // Seems to be a frame counter for async script commands + /* 0x2C */ s16 unk2C; // Another counter for async script commands /* 0x30 */ s32 unk30; /* 0x34 */ PixelPos pos1; /* 0x3C */ PixelPos pos2; diff --git a/src/data/ground/ground_data_b01p01a_station.h b/src/data/ground/ground_data_b01p01a_station.h index 1e8fd53f8..698e63230 100644 --- a/src/data/ground/ground_data_b01p01a_station.h +++ b/src/data/ground/ground_data_b01p01a_station.h @@ -7020,7 +7020,7 @@ static const struct ScriptCommand s_gs9_g48_s0_lives1_dlg0[] = { /* 0x81bddd8 */ { 0x56, 0x00, 0x0000, 0x00000058, 0x00000000, NULL }, ALERT_CUE(5), AWAIT_CUE(6), - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), { 0x62, 0x00, 0x004c, -0x00000008, -0x00000010, NULL }, AWAIT_CUE(6), { 0x56, 0x00, 0x0000, 0x0000005b, 0x00000000, NULL }, @@ -10332,7 +10332,7 @@ static const struct ScriptCommand s_gs9_g75_s0_lives0_dlg0[] = { /* 0x81cb8b4 */ BGM_SWITCH(MUS_THERES_TROUBLE), { 0xdf, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, WAIT(30), - { 0x8b, 0x01, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 1), ALERT_CUE(6), ALERT_CUE(11), ALERT_CUE(9), @@ -10358,7 +10358,7 @@ static const struct ScriptCommand s_gs9_g75_s0_lives0_dlg0[] = { /* 0x81cb8b4 */ ALERT_CUE(11), ALERT_CUE(6), { 0x4f, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x01, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 1), WAIT(30), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, BGM_FADEIN(30, 1), @@ -10389,7 +10389,7 @@ static const struct ScriptCommand s_gs9_g75_s0_lives0_dlg0[] = { /* 0x81cb8b4 */ LABEL(15), /* = 0x0f */ TEXTBOX_CLEAR, UPDATE_VARINT(CALC_SET, EVENT_LOCAL, 1), - { 0x8b, 0x01, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 1), SELECT_ENTITIES(-1, 2), WAIT(2), PORTRAIT(PLACEMENT_LEFT_, 0x0000, 0x00000000), @@ -10839,7 +10839,7 @@ static const struct ScriptCommand s_gs9_g75_s1_lives0_dlg0[] = { /* 0x81cf72c */ { 0x57, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, SELECT_ANIMATION(2), { 0x2d, 0x07, 0x0001, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x01, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 1), AWAIT_CUE(6), ROTATE_TO(8, DIR_TRANS_10, DIRECTION_SOUTH), WAIT(1), @@ -10848,7 +10848,7 @@ static const struct ScriptCommand s_gs9_g75_s1_lives0_dlg0[] = { /* 0x81cf72c */ WAIT(1), AWAIT_CUE(6), { 0x58, 0x01, 0x0000, 0x00000148, 0x00000168, NULL }, - { 0x8b, 0x01, 0x0007, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHWEST, 1), SELECT_ANIMATION(5), AWAIT_CUE(6), WAIT(10), @@ -10863,7 +10863,7 @@ static const struct ScriptCommand s_gs9_g75_s1_lives0_dlg0[] = { /* 0x81cf72c */ WAIT(1), AWAIT_CUE(6), { 0x4f, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x01, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 1), AWAIT_CUE(6), CMD_UNK_93(8, DIR_TRANS_10, 0), WAIT(10), @@ -10911,7 +10911,7 @@ static const struct ScriptCommand s_gs9_g75_s1_lives2_dlg0[] = { /* 0x81cfacc */ WALK_GRID(256, 91), AWAIT_CUE(10), WARP_WAYPOINT(1, 90), - { 0x8b, 0x01, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 1), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, AWAIT_CUE(10), SELECT_ANIMATION(2), @@ -10931,7 +10931,7 @@ static const struct ScriptCommand s_gs9_g75_s1_lives3_dlg0[] = { /* 0x81cfbec */ AWAIT_CUE(11), WALK_GRID(256, 93), AWAIT_CUE(11), - { 0x8b, 0x01, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 1), { 0x58, 0x01, 0x0000, 0x00000130, 0x00000180, NULL }, AWAIT_CUE(11), SELECT_ANIMATION(5), diff --git a/src/data/ground/ground_data_b01p02a_station.h b/src/data/ground/ground_data_b01p02a_station.h index cca4b5e28..feec82c66 100644 --- a/src/data/ground/ground_data_b01p02a_station.h +++ b/src/data/ground/ground_data_b01p02a_station.h @@ -838,7 +838,7 @@ static const struct ScriptCommand s_gs12_g9_s1_lives0_dlg0[] = { /* 0x81e4e40 */ DEBUGINFO_O(838), SELECT_ANIMATION(2), { 0x2d, 0x07, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x01, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 1), { 0x58, 0x01, 0x0000, 0x000000f0, 0x00000120, NULL }, { 0x9b, 0x00, 0x0100, 0x00000000, 0x00000000, NULL }, { 0xdf, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, diff --git a/src/data/ground/ground_data_d01p01_station.h b/src/data/ground/ground_data_d01p01_station.h index 3301bfb84..ebdb71269 100644 --- a/src/data/ground/ground_data_d01p01_station.h +++ b/src/data/ground/ground_data_d01p01_station.h @@ -348,10 +348,10 @@ static const struct ScriptCommand s_gs178_g1_s1_lives0_dlg0[] = { /* 0x822dc90 - ALERT_CUE(5), AWAIT_CUE(7), LABEL(0), /* = 0x00 */ - { 0x8b, 0x1e, 0x0006, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0002, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 30), + SET_DIR_WAIT(DIRECTION_SOUTH, 30), + SET_DIR_WAIT(DIRECTION_EAST, 30), + SET_DIR_WAIT(DIRECTION_SOUTH, 30), JUMP_LABEL(0), }; @@ -507,10 +507,10 @@ static const struct ScriptCommand s_gs178_g2_s0_lives2_dlg0[] = { /* 0x822e89c - CALL_SCRIPT(SHOCK_FUNC), AWAIT_CUE(7), LABEL(0), /* = 0x00 */ - { 0x8b, 0x1e, 0x0006, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0002, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x1e, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 30), + SET_DIR_WAIT(DIRECTION_SOUTH, 30), + SET_DIR_WAIT(DIRECTION_EAST, 30), + SET_DIR_WAIT(DIRECTION_SOUTH, 30), JUMP_LABEL(0), }; diff --git a/src/data/ground/ground_data_d07p02_station.h b/src/data/ground/ground_data_d07p02_station.h index 140ec4cf2..450e54de8 100644 --- a/src/data/ground/ground_data_d07p02_station.h +++ b/src/data/ground/ground_data_d07p02_station.h @@ -434,7 +434,7 @@ static const struct ScriptCommand s_gs192_g2_s0_lives0_dlg0[] = { /* 0x823ef68 * ALERT_CUE(6), ALERT_CUE(9), CALL_SCRIPT(JUMP_SURPRISE_FUNC), - { 0x8b, 0x0a, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 10), PORTRAIT(PLACEMENT_RIGHT, 0x0001, 0x0000000c), MSG_NPC(1, _(" Yikes!")), TEXTBOX_CLEAR, @@ -726,7 +726,7 @@ static const struct ScriptCommand s_gs192_g2_s0_lives1_dlg0[] = { /* 0x8241890 * ALERT_CUE(5), AWAIT_CUE(6), WALK_DIRECT(40, 5), - { 0x8b, 0x0a, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 10), ALERT_CUE(5), WAIT(100), SELECT_ANIMATION(41), @@ -736,7 +736,7 @@ static const struct ScriptCommand s_gs192_g2_s0_lives1_dlg0[] = { /* 0x8241890 * AWAIT_CUE(6), CALL_SCRIPT(JUMP_SURPRISE_FUNC), WALK_RELATIVE(256, 24, 2), - { 0x8b, 0x0a, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 10), LABEL(1), /* = 0x01 */ AWAIT_CUE(6), CALL_SCRIPT(SWEAT_FUNC), diff --git a/src/data/ground/ground_data_d11p03_station.h b/src/data/ground/ground_data_d11p03_station.h index b90d5f009..479052c67 100644 --- a/src/data/ground/ground_data_d11p03_station.h +++ b/src/data/ground/ground_data_d11p03_station.h @@ -413,7 +413,7 @@ static const struct ScriptCommand s_gs203_g2_s0_lives0_dlg0[] = { /* 0x8257ee8 * ALERT_CUE(9), WARP_WAYPOINT(0, 2), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), AWAIT_CUE(5), ALERT_CUE(6), ALERT_CUE(7), @@ -434,7 +434,7 @@ static const struct ScriptCommand s_gs203_g2_s0_lives0_dlg0[] = { /* 0x8257ee8 * CMD_UNK_E5(7, 0), WARP_WAYPOINT(0, 3), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), CMD_UNK_E5(7, 0), AWAIT_CUE(5), { 0x27, 0x00, 0x0005, 0x00000003, 0x00ffffff, NULL }, @@ -490,7 +490,7 @@ static const struct ScriptCommand s_gs203_g2_s0_lives1_dlg0[] = { /* 0x8258a00 * WALK_RELATIVE(512, 0, 16), AWAIT_CUE(6), WARP_WAYPOINT(0, 5), - { 0x8b, 0x00, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 0), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, { 0x62, 0x00, 0x0400, 0x00000010, 0x00000040, NULL }, { 0x62, 0x00, 0x0100, 0x00000004, 0x00000010, NULL }, @@ -524,7 +524,7 @@ static const struct ScriptCommand s_gs203_g2_s0_lives2_dlg0[] = { /* 0x8258c30 * AWAIT_CUE(6), WARP_WAYPOINT(0, 11), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 0), AWAIT_CUE(6), { 0x62, 0x00, 0x0400, 0x00000000, 0x00000050, NULL }, { 0x62, 0x00, 0x0100, 0x00000000, 0x00000018, NULL }, @@ -551,7 +551,7 @@ static const struct ScriptCommand s_gs203_g2_s1_lives0_dlg0[] = { /* 0x8258e20 * AWAIT_CUE(7), WARP_WAYPOINT(0, 2), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), ALERT_CUE(5), AWAIT_CUE(7), { 0x62, 0x00, 0x0400, -0x00000040, 0x00000000, NULL }, @@ -563,7 +563,7 @@ static const struct ScriptCommand s_gs203_g2_s1_lives0_dlg0[] = { /* 0x8258e20 * AWAIT_CUE(7), WARP_WAYPOINT(0, 3), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), AWAIT_CUE(7), ALERT_CUE(5), { 0x7e, 0x00, 0x0400, 0x00000020, -0x00000040, NULL }, @@ -596,7 +596,7 @@ static const struct ScriptCommand s_gs203_g2_s1_lives1_dlg0[] = { /* 0x8259080 * AWAIT_CUE(8), WARP_WAYPOINT(0, 7), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), AWAIT_CUE(8), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, { 0x62, 0x00, 0x0400, -0x00000020, -0x00000040, NULL }, @@ -622,7 +622,7 @@ static const struct ScriptCommand s_gs203_g2_s1_lives2_dlg0[] = { /* 0x8259250 * AWAIT_CUE(8), WARP_WAYPOINT(0, 9), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), AWAIT_CUE(8), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, { 0x62, 0x00, 0x0400, 0x00000020, -0x00000040, NULL }, @@ -1076,41 +1076,41 @@ static const struct ScriptCommand s_gs203_g3_s0_lives1_dlg0[] = { /* 0x825bcb4 * WAIT(4), FANFARE_PLAY2(469), { 0x62, 0x00, 0x0100, 0x00000000, -0x00000008, NULL }, - { 0x8b, 0x00, 0x0007, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHWEST, 0), { 0x62, 0x00, 0x0100, -0x00000008, -0x00000008, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x62, 0x00, 0x0100, -0x00000010, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), { 0x62, 0x00, 0x0100, -0x00000008, 0x00000008, NULL }, FANFARE_PLAY2(469), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), { 0x62, 0x00, 0x0100, 0x00000000, 0x00000010, NULL }, - { 0x8b, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 0), { 0x62, 0x00, 0x0100, 0x00000008, 0x00000008, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), { 0x62, 0x00, 0x0100, 0x00000010, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 0), { 0x62, 0x00, 0x0100, 0x00000008, -0x00000008, NULL }, FANFARE_PLAY2(469), - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), { 0x62, 0x00, 0x0100, 0x00000000, -0x00000008, NULL }, { 0x62, 0x00, 0x0100, 0x00000000, -0x00000008, NULL }, - { 0x8b, 0x00, 0x0007, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHWEST, 0), { 0x62, 0x00, 0x0100, -0x00000008, -0x00000008, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x62, 0x00, 0x0100, -0x00000010, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), { 0x62, 0x00, 0x0100, -0x00000008, 0x00000008, NULL }, FANFARE_PLAY2(469), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), { 0x62, 0x00, 0x0100, 0x00000000, 0x00000010, NULL }, - { 0x8b, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 0), { 0x62, 0x00, 0x0100, 0x00000008, 0x00000008, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), { 0x62, 0x00, 0x0100, 0x00000010, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 0), { 0x62, 0x00, 0x0100, 0x00000008, -0x00000008, NULL }, - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), { 0x62, 0x00, 0x0100, 0x00000000, -0x00000008, NULL }, CALL_SCRIPT(JUMP_ANGRY_FUNC), SELECT_ANIMATION(2), diff --git a/src/data/ground/ground_data_d20p01_station.h b/src/data/ground/ground_data_d20p01_station.h index 9263652cf..8ff3cfbfc 100644 --- a/src/data/ground/ground_data_d20p01_station.h +++ b/src/data/ground/ground_data_d20p01_station.h @@ -322,7 +322,7 @@ static const struct ScriptCommand s_gs216_g1_s0_eff1_script[] = { /* 0x82691d0 * { 0x53, 0x00, 0x0000, 0x0000001f, 0x00000000, NULL }, AWAIT_CUE(7), { 0x59, 0x00, 0x0004, -0x00000018, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), { 0x56, 0x00, 0x0000, 0x00000150, 0x00000000, NULL }, WALK_RELATIVE(512, 0, -120), { 0x56, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, @@ -331,7 +331,7 @@ static const struct ScriptCommand s_gs216_g1_s0_eff1_script[] = { /* 0x82691d0 * AWAIT_CUE(7), { 0x59, 0x00, 0x000c, 0x00000000, 0x00000000, NULL }, { 0x56, 0x00, 0x0000, 0x00000150, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), WALK_RELATIVE(512, 120, 120), { 0x56, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, WARP_WAYPOINT(0, 2), @@ -339,7 +339,7 @@ static const struct ScriptCommand s_gs216_g1_s0_eff1_script[] = { /* 0x82691d0 * AWAIT_CUE(7), { 0x59, 0x00, -0x000c, 0x00000000, 0x00000000, NULL }, { 0x56, 0x00, 0x0000, 0x00000150, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0007, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHWEST, 0), WALK_RELATIVE(512, -120, 120), { 0x56, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, WARP_WAYPOINT(0, 2), diff --git a/src/data/ground/ground_data_h29p01_station.h b/src/data/ground/ground_data_h29p01_station.h index f588ee353..9b9dc0276 100644 --- a/src/data/ground/ground_data_h29p01_station.h +++ b/src/data/ground/ground_data_h29p01_station.h @@ -228,21 +228,21 @@ static const struct ScriptCommand s_gs158_g2_s0_lives0_dlg0[] = { /* 0x820d22c * // Fade in (slow), vortex stone appears with flashing white circle // Our character walks north { 0x23, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade out black? - { 0x8b, 0x00, DIRECTION_NORTHWEST, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 0), ALERT_CUE(4), AWAIT_CUE(5), { 0x22, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade in black? ALERT_CUE(8), // Moltres float AWAIT_CUE(5), { 0x23, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade out black? - { 0x8b, 0x00, DIRECTION_NORTHEAST, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 0), ALERT_CUE(4), AWAIT_CUE(5), { 0x22, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade in black? ALERT_CUE(7), // Zapdos float AWAIT_CUE(5), { 0x23, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade out black? - { 0x8b, 0x00, DIRECTION_NORTH, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), ALERT_CUE(4), AWAIT_CUE(5), { 0x22, 0x01, 30, 0x00000000, 0x00000000, NULL }, // Fade in black? @@ -342,7 +342,7 @@ static const struct ScriptCommand s_gs158_g2_s0_lives1_dlg0[] = { /* 0x820db5c * ALERT_CUE(5), AWAIT_CUE(6), SELECT_ANIMATION(2), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), AWAIT_CUE(6), { 0x70, 0x00, 0x0080, 0x0000000a, 0x00000000, NULL }, { 0x53, 0x00, 0x0000, 0x01000000, 0x00000000, NULL }, @@ -369,7 +369,7 @@ static const struct ScriptCommand s_gs158_g2_s0_lives2_dlg0[] = { /* 0x820dccc * AWAIT_CUE(7), { 0x54, 0x00, 0x0300, 0x00000000, 0x00000000, NULL }, WARP_WAYPOINT(0, 7), - { 0x8b, 0x04, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 4), { 0x70, 0x00, 0x0100, 0x00000014, 0x00000000, NULL }, { 0x54, 0x00, 0x0300, 0x00000000, 0x00000000, NULL }, { 0x52, 0x00, 0x0000, 0x01000000, 0x00000000, NULL }, @@ -408,7 +408,7 @@ static const struct ScriptCommand s_gs158_g2_s0_lives3_dlg0[] = { /* 0x820df0c * AWAIT_CUE(8), { 0x54, 0x00, 0x0300, 0x00000000, 0x00000000, NULL }, WARP_WAYPOINT(0, 8), - { 0x8b, 0x04, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 4), { 0x70, 0x00, 0x0100, 0x00000014, 0x00000000, NULL }, { 0x52, 0x00, 0x0000, 0x01000000, 0x00000000, NULL }, { 0x70, 0x00, 0x0080, 0x00000000, 0x00000000, NULL }, diff --git a/src/data/ground/ground_data_s02_station.h b/src/data/ground/ground_data_s02_station.h index 8c0e80f78..1425487f9 100644 --- a/src/data/ground/ground_data_s02_station.h +++ b/src/data/ground/ground_data_s02_station.h @@ -98,7 +98,7 @@ static const struct ScriptCommand s_gs224_g3_s1_lives0_dlg0[] = { /* 0x826e60c * { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, AWAIT_CUE(5), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), { 0x80, 0x00, 0x0200, 0x00000004, 0x00000000, NULL }, ALERT_CUE(6), END_DELETE, diff --git a/src/data/ground/ground_data_t01p01_station.h b/src/data/ground/ground_data_t01p01_station.h index 680474ff2..420628642 100644 --- a/src/data/ground/ground_data_t01p01_station.h +++ b/src/data/ground/ground_data_t01p01_station.h @@ -875,7 +875,7 @@ static const struct ScriptCommand s_gs1_g4_s1_lives2_dlg0[] = { /* 0x813acdc */ FANFARE_PLAY2(465), { 0x56, 0x00, -0x0001, 0x00000058, 0x00000000, NULL }, { 0xde, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x3c, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 60), ALERT_CUE(5), HALT, }; @@ -1066,7 +1066,7 @@ static const struct ScriptCommand s_gs1_g4_s3_lives0_dlg3[] = { /* 0x813b7d8 */ RET, LABEL(0), /* = 0x00 */ AWAIT_CUE(6), - { 0x8b, 0x0a, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 10), { 0x54, 0x00, 0x001f, 0x00000000, 0x00000000, NULL }, ALERT_CUE(5), AWAIT_CUE(6), @@ -1501,7 +1501,7 @@ static const struct ScriptCommand s_gs1_g5_s4_lives2_dlg0[] = { /* 0x813cdf0 */ HALT, LABEL(1), /* = 0x01 */ AWAIT_CUE(7), - { 0x8b, 0x0a, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 10), SELECT_ANIMATION(32), AWAIT_CUE(7), { 0x54, 0x00, 0x0100, 0x00000000, 0x00000000, NULL }, @@ -3192,7 +3192,7 @@ static const struct ScriptCommand s_gs1_g11_s0_lives6_dlg2[] = { /* 0x8144320 */ static const struct ScriptCommand s_gs1_g11_s0_lives7_dlg1[] = { /* 0x8144578 */ DEBUGINFO_O(3193), SELECT_ANIMATION(1), - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), RET, }; @@ -3991,7 +3991,7 @@ static const struct ScriptCommand s_gs1_g17_s0_lives2_dlg0[] = { /* 0x8147330 */ static const struct ScriptCommand s_gs1_g17_s0_lives3_dlg0[] = { /* 0x81474c0 */ DEBUGINFO_O(3992), SELECT_ANIMATION(2), - { 0x8b, 0x01, 0x0007, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHWEST, 1), { 0x2d, 0x07, 0x0003, 0x00000000, 0x00000000, NULL }, AWAIT_CUE(8), CALL_SCRIPT(NOTICE_FUNC), @@ -4634,7 +4634,7 @@ static const struct ScriptCommand s_gs1_g21_s0_lives0_dlg0[] = { /* 0x81484d4 */ WAIT(20), ALERT_CUE(8), ALERT_CUE(6), - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), FANFARE_PLAY2(497), { 0x54, 0x00, 0x000b, 0x00000000, 0x00000000, NULL }, { 0x62, 0x00, 0x0100, -0x00000008, -0x00000008, NULL }, @@ -4852,7 +4852,7 @@ static const struct ScriptCommand s_gs1_g21_s0_lives2_dlg0[] = { /* 0x814aee0 */ CMD_UNK_E5(5, 0), AWAIT_CUE(7), CALL_SCRIPT(SMILE_END_FUNC), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x62, 0x00, 0x004c, 0x00000000, -0x00000010, NULL }, CMD_UNK_93(5, DIR_TRANS_10, 0), CMD_UNK_E5(5, 0), @@ -4929,7 +4929,7 @@ static const struct ScriptCommand s_gs1_g21_s0_lives3_dlg0[] = { /* 0x814b1e0 */ ROTATE_TO(8, DIR_TRANS_SPINRIGHT1, DIRECTION_NORTHEAST), ROTATE_TO(8, DIR_TRANS_SPINLEFT1, DIRECTION_NORTH), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHEAST, 0), { 0x62, 0x00, 0x0080, -0x00000010, 0x00000010, NULL }, WAIT(30), CMD_UNK_93(5, DIR_TRANS_10, 0), @@ -5082,7 +5082,7 @@ static const struct ScriptCommand s_gs1_g21_s0_lives5_dlg0[] = { /* 0x814bad0 */ AWAIT_CUE(10), CMD_UNK_93(5, DIR_TRANS_10, 0), AWAIT_CUE(10), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x62, 0x00, 0x004c, -0x00000008, 0x00000000, NULL }, AWAIT_CUE(10), { 0x62, 0x00, 0x004c, 0x00000000, 0x00000008, NULL }, @@ -5167,7 +5167,7 @@ static const struct ScriptCommand s_gs1_g21_s0_lives6_dlg0[] = { /* 0x814bfb0 */ CMD_UNK_93(5, DIR_TRANS_10, 0), AWAIT_CUE(11), WALK_RELATIVE(76, -24, 0), - { 0x8b, 0x00, 0x0005, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTHWEST, 0), SELECT_ANIMATION(7), AWAIT_CUE(11), { 0x62, 0x00, 0x004c, -0x00000008, 0x00000000, NULL }, @@ -6696,10 +6696,10 @@ static const struct ScriptCommand s_gs1_g23_s1_lives0_dlg0[] = { /* 0x8152988 */ FANFARE_PLAY2(451), SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, - { 0x8b, 0x00, 0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTHEAST, 0), SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, FANFARE_STOP2(451), @@ -7551,7 +7551,7 @@ static const struct ScriptCommand s_gs1_g26_s0_lives1_dlg0[] = { /* 0x8156884 */ CMD_UNK_93(4, DIR_TRANS_10, 0), CMD_UNK_E5(5, 0), AWAIT_CUE(6), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x62, 0x00, 0x0100, 0x00000000, -0x00000010, NULL }, CMD_UNK_E5(5, 0), AWAIT_CUE(6), @@ -15302,7 +15302,7 @@ static const struct ScriptCommand s_gs1_g50_s0_lives3_dlg0[] = { /* 0x8177fcc */ { 0x52, 0x00, 0x0000, 0x00000200, 0x00000000, NULL }, SELECT_ANIMATION(2), SELECT_ANIMATION(1), - { 0x8b, 0x01, -0x0001, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(-1, 1), RET, }; diff --git a/src/data/ground/ground_data_t01p02a_station.h b/src/data/ground/ground_data_t01p02a_station.h index da9b035a3..ef5614954 100644 --- a/src/data/ground/ground_data_t01p02a_station.h +++ b/src/data/ground/ground_data_t01p02a_station.h @@ -1393,7 +1393,7 @@ static const struct ScriptCommand s_gs2_g16_s1_lives0_dlg0[] = { /* 0x8182f18 */ ALERT_CUE(4), WAIT(1), WALK_GRID(256, 12), - { 0x8b, 0x1e, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 30), BGM_SWITCH(MUS_LEGEND_OF_NINETALES), MSG_NPC(1, _(" There once lived a Pokémon\nby the name of {NAME_2}.")), TEXTBOX_CLEAR, @@ -1482,7 +1482,7 @@ static const struct ScriptCommand s_gs2_g16_s1_lives1_dlg0[] = { /* 0x8183b64 */ SELECT_ANIMATION(2), { 0x2d, 0x07, 0x0003, 0x00000000, 0x00000000, NULL }, WALK_GRID(256, 13), - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), ALERT_CUE(3), AWAIT_CUE(8), FANFARE_PLAY2(466), @@ -1503,7 +1503,7 @@ static const struct ScriptCommand s_gs2_g16_s1_lives2_dlg0[] = { /* 0x8183c84 */ { 0x53, 0x00, 0x0000, 0x01000000, 0x00000000, NULL }, SELECT_ANIMATION(2), { 0x2d, 0x07, 0x0001, 0x00000000, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), AWAIT_CUE(6), CALL_SCRIPT(SMILE_START_FUNC), WAIT(30), diff --git a/src/data/ground/ground_data_t01p03_station.h b/src/data/ground/ground_data_t01p03_station.h index b22c3c22b..b70848145 100644 --- a/src/data/ground/ground_data_t01p03_station.h +++ b/src/data/ground/ground_data_t01p03_station.h @@ -602,7 +602,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives2_dlg0[] = { /* 0x818c05c */ { 0x2d, 0x07, 0x0002, 0x00000000, 0x00000000, NULL }, AWAIT_CUE(7), WARP_WAYPOINT(0, 5), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, FANFARE_PLAY2(454), SELECT_ANIMATION(22), @@ -614,7 +614,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives2_dlg0[] = { /* 0x818c05c */ SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, WARP_WAYPOINT(0, 6), - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), FANFARE_PLAY2(454), SELECT_ANIMATION(22), STOP_ANIMATION_ON_CURRENT_FRAME, @@ -625,7 +625,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives2_dlg0[] = { /* 0x818c05c */ SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, WARP_WAYPOINT(0, 7), - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), FANFARE_PLAY2(454), SELECT_ANIMATION(22), STOP_ANIMATION_ON_CURRENT_FRAME, @@ -636,7 +636,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives2_dlg0[] = { /* 0x818c05c */ SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, WARP_WAYPOINT(0, 8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), FANFARE_PLAY2(454), SELECT_ANIMATION(22), STOP_ANIMATION_ON_CURRENT_FRAME, @@ -647,7 +647,7 @@ static const struct ScriptCommand s_gs4_g1_s1_lives2_dlg0[] = { /* 0x818c05c */ SELECT_ANIMATION(23), STOP_ANIMATION_ON_CURRENT_FRAME, WARP_WAYPOINT(0, 9), - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), FANFARE_PLAY2(454), SELECT_ANIMATION(22), STOP_ANIMATION_ON_CURRENT_FRAME, @@ -1559,7 +1559,7 @@ static const struct ScriptCommand s_gs4_g12_s0_lives0_dlg0[] = { /* 0x818fcdc */ VARIANT_DEFAULT(_(" See?\nHave a look at this Bulletin Board.")), TEXTBOX_CLEAR, WAIT(10), - { 0x8b, 0x14, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 20), MSG_NPC(1, _(" It lists rescue jobs.\nCheck it out?")), TEXTBOX_CLEAR, SPECIAL_TEXT(SPECIAL_TEXT_BULLETIN_BOARD_JOBS, 0, 0), @@ -1617,7 +1617,7 @@ static const struct ScriptCommand s_gs4_g12_s0_lives1_dlg0[] = { /* 0x81909bc */ ALERT_CUE(5), AWAIT_CUE(6), WAIT(20), - { 0x8b, 0x14, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 20), ALERT_CUE(5), AWAIT_CUE(6), CMD_UNK_93(4, DIR_TRANS_10, 0), @@ -1779,7 +1779,7 @@ static const struct ScriptCommand s_gs4_g16_s1_lives1_dlg0[] = { /* 0x8191244 */ ROTATE_TO(4, DIR_TRANS_SPINRIGHT1, DIRECTION_SOUTH), ALERT_CUE(5), AWAIT_CUE(7), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), ALERT_CUE(5), HALT, @@ -1799,7 +1799,7 @@ static const struct ScriptCommand s_gs4_g16_s1_lives2_dlg0[] = { /* 0x8191324 */ ROTATE_TO(4, DIR_TRANS_SPINLEFT1, DIRECTION_NORTH), ALERT_CUE(5), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), HALT, }; @@ -1892,7 +1892,7 @@ static const struct ScriptCommand s_gs4_g17_s1_lives1_dlg0[] = { /* 0x819171c */ ROTATE_TO(4, DIR_TRANS_SPINRIGHT1, DIRECTION_SOUTH), ALERT_CUE(5), AWAIT_CUE(7), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), ALERT_CUE(5), HALT, @@ -1912,7 +1912,7 @@ static const struct ScriptCommand s_gs4_g17_s1_lives2_dlg0[] = { /* 0x81917fc */ ROTATE_TO(4, DIR_TRANS_SPINLEFT1, DIRECTION_NORTH), ALERT_CUE(5), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), HALT, }; @@ -2084,7 +2084,7 @@ static const struct ScriptCommand s_gs4_g19_s1_lives1_dlg0[] = { /* 0x8192548 */ ROTATE_TO(4, DIR_TRANS_SPINRIGHT1, DIRECTION_SOUTH), ALERT_CUE(5), AWAIT_CUE(7), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), ALERT_CUE(5), RET, @@ -2104,7 +2104,7 @@ static const struct ScriptCommand s_gs4_g19_s1_lives2_dlg0[] = { /* 0x8192628 */ ROTATE_TO(4, DIR_TRANS_SPINLEFT1, DIRECTION_NORTH), ALERT_CUE(5), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), RET, }; @@ -2145,7 +2145,7 @@ static const struct ScriptCommand s_gs4_g20_s0_lives1_dlg0[] = { /* 0x81927b4 */ ROTATE_TO(4, DIR_TRANS_SPINLEFT1, DIRECTION_NORTH), ALERT_CUE(5), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), SELECT_ANIMATION(4), HALT, }; @@ -2296,7 +2296,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives3_dlg0[] = { /* 0x8193098 */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, -0x0050, 0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2309,7 +2309,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives3_dlg0[] = { /* 0x8193098 */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, 0x0050, -0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2322,7 +2322,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives3_dlg0[] = { /* 0x8193098 */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, -0x0030, 0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2335,7 +2335,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives3_dlg0[] = { /* 0x8193098 */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, 0x0030, -0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2348,7 +2348,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives3_dlg0[] = { /* 0x8193098 */ ROTATE_TO(8, DIR_TRANS_10, DIRECTION_SOUTH), ALERT_CUE(5), AWAIT_CUE(7), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), { 0x57, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, RET, }; @@ -2376,7 +2376,7 @@ static const struct ScriptCommand s_gs4_g20_s1_lives4_dlg0[] = { /* 0x8193528 */ AWAIT_CUE(8), CMD_UNK_93(4, DIR_TRANS_10, 66), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), ALERT_CUE(5), RET, HALT, @@ -2554,7 +2554,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives2_dlg0[] = { /* 0x8193fcc */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, -0x0050, 0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0004, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_NORTH, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2567,7 +2567,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives2_dlg0[] = { /* 0x8193fcc */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, 0x0050, -0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0006, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_WEST, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2580,7 +2580,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives2_dlg0[] = { /* 0x8193fcc */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, -0x0030, 0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2593,7 +2593,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives2_dlg0[] = { /* 0x8193fcc */ STOP_ANIMATION_ON_CURRENT_FRAME, { 0x52, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, { 0x59, 0x01, 0x0030, -0x00000030, 0x00000000, NULL }, - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), FANFARE_PLAY2(454), { 0x53, 0x00, 0x0000, 0x00400000, 0x00000000, NULL }, SELECT_ANIMATION(22), @@ -2606,7 +2606,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives2_dlg0[] = { /* 0x8193fcc */ ROTATE_TO(8, DIR_TRANS_10, DIRECTION_SOUTH), ALERT_CUE(5), AWAIT_CUE(7), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), { 0x57, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, RET, }; @@ -2634,7 +2634,7 @@ static const struct ScriptCommand s_gs4_g21_s1_lives3_dlg0[] = { /* 0x819445c */ AWAIT_CUE(8), CMD_UNK_93(4, DIR_TRANS_10, 66), AWAIT_CUE(8), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), ALERT_CUE(5), RET, }; @@ -3067,7 +3067,7 @@ static const struct ScriptRef s_gs4_g28_s0_station_sref = { STATION_CONTROL , 8, static const struct ScriptCommand s_gs4_g28_s0_lives0_dlg1[] = { /* 0x8195e04 */ DEBUGINFO_O(3069), - { 0x8b, 0x00, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 0), { 0x53, 0x00, 0x0000, 0x00000200, 0x00000000, NULL }, SELECT_ANIMATION(1), RET, diff --git a/src/data/ground/ground_event_data.h b/src/data/ground/ground_event_data.h index 7ccfddd2b..4a57420d4 100644 --- a/src/data/ground/ground_event_data.h +++ b/src/data/ground/ground_event_data.h @@ -328,13 +328,13 @@ static const struct ScriptCommand s_script_WAKEUP_FUNC[] = { /* 0x811ff00 */ DEBUGINFO_O(328), JUMPIF_UNK_BE(/* to label */ 0), /* something sleep related?*/ SELECT_ANIMATION(6), - { 0x8b, 0x3c, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 60), SELECT_ANIMATION(2), WAIT(60), RET_DIRECT, LABEL(0), /* = 0x00 */ SELECT_ANIMATION(38), - { 0x8b, 0x3c, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 60), SELECT_ANIMATION(39), STOP_ANIMATION_ON_CURRENT_FRAME, WAIT(10), @@ -517,11 +517,11 @@ static const struct ScriptCommand s_script_INIT_SLEEP_FUNC[] = { /* 0x81206e0 */ DEBUGINFO_O(517), JUMPIF_UNK_BE(/* to label */ 0), /* something sleep related?*/ SELECT_ANIMATION(6), - { 0x8b, 0x00, 0x0000, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_SOUTH, 0), RET_DIRECT, LABEL(0), /* = 0x00 */ SELECT_ANIMATION(38), - { 0x8b, 0x3c, 0x0002, 0x00000000, 0x00000000, NULL }, + SET_DIR_WAIT(DIRECTION_EAST, 60), RET_DIRECT, }; diff --git a/src/ground_lives.c b/src/ground_lives.c index ef0c97c27..2643e0e57 100644 --- a/src/ground_lives.c +++ b/src/ground_lives.c @@ -276,9 +276,7 @@ void GroundLives_Select(s32 mapID, s32 group, s32 sector) size = sectorPtr->nLives; for (i = 0; i < size; i++, livesData++) - { - GroundLives_Add(-1,livesData,group_s32,sector_s32); - } + GroundLives_Add(-1, livesData, group_s32, sector_s32); } void GroundLives_Cancel(s32 scriptID, s32 sector) @@ -837,33 +835,35 @@ static s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 if (!var24) { if (sub_809D684(&livesPtr->action, &gGroundLivesMeta->unk32C)) { - s32 r10; - s32 r9; + s32 bakUnk24; + s32 bakStoredDir; // Note: these ptr variables are unfortunately a fakematch, but I was not able to match the function without them... - u16 *ptr1; - s8 *ptr2; + u16 *ptrToUnk24; + s8 *ptrToStoredDir; if (livesPtr->action.scriptData2.savedState != 0) { - r10 = livesPtr->action.scriptData2.unk24; - r9 = livesPtr->action.scriptData2.unk26; + bakUnk24 = livesPtr->action.scriptData2.unk24; + bakStoredDir = livesPtr->action.scriptData2.storedDir; - ptr1 = &livesPtr->action.scriptData.unk24; - ptr2 = &livesPtr->action.scriptData.unk26; + ptrToUnk24 = &livesPtr->action.scriptData.unk24; + ptrToStoredDir = &livesPtr->action.scriptData.storedDir; } else { - r10 = livesPtr->action.scriptData.unk24; - r9 = livesPtr->action.scriptData.unk26; + bakUnk24 = livesPtr->action.scriptData.unk24; + bakStoredDir = livesPtr->action.scriptData.storedDir; - ptr1 = &livesPtr->action.scriptData.unk24; - ptr2 = &livesPtr->action.scriptData.unk26; + ptrToUnk24 = &livesPtr->action.scriptData.unk24; + ptrToStoredDir = &livesPtr->action.scriptData.storedDir; } InitAction2(&livesPtr->action); InitActionWithParams(&livesPtr->action, &gGroundLivesCallbacks, livesPtr, group, sector); GroundScript_ExecutePP(&livesPtr->action, NULL, &gGroundLivesMeta->unk32C, DEBUG_LOC_PTR("../ground/ground_lives.c", 1417, "GroundLives_Add")); - ASM_MATCH_TRICK(ptr2); - *ptr1 = r10; - *ptr2 = r9; + + ASM_MATCH_TRICK(ptrToStoredDir); + + *ptrToUnk24 = bakUnk24; + *ptrToStoredDir = bakStoredDir; r8 = TRUE; } else { @@ -898,13 +898,13 @@ static s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 if (!var24 && !r8 && !(livesPtr->flags & 0x1800)) { GroundScript_ExecutePP(&livesPtr->action, NULL, &gGroundLivesMeta->unk32C, DEBUG_LOC_PTR("../ground/ground_lives.c", 1460, "GroundLives_Add")); livesPtr->action.scriptData.unk24 = livesPtr->unk160 | livesPtr->unk15E; - livesPtr->action.scriptData.unk26 = livesPtr->direction1; + livesPtr->action.scriptData.storedDir = livesPtr->direction1; } ExecutePredefinedScript(&livesPtr->action, NULL, 0, DEBUG_LOC_PTR("../ground/ground_lives.c", 1466, "GroundLives_Add")); } else if (r8) { livesPtr->directionRelated = TRUE; - livesPtr->direction1 = livesPtr->action.scriptData.unk26; + livesPtr->direction1 = livesPtr->action.scriptData.storedDir; sub_80A9750(livesPtr, livesPtr->action.scriptData.unk24); } diff --git a/src/ground_script.c b/src/ground_script.c index 772e4d22b..ca9478e13 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -186,11 +186,12 @@ static void InitScriptData(ScriptData *a0) a0->curPtr = 0; a0->unk22 = -1; a0->unk24 = 0; - a0->unk26 = 0xFF; + a0->storedDir = -1; a0->branchDiscriminant = 0; a0->unk2A = 0; a0->unk2C = 0; a0->unk30 = 0; + for (i = 0; i < 4; i++) { a0->localVars.val[i] = 0; } @@ -387,7 +388,7 @@ bool8 GroundScript_ExecutePP(Action *action, ActionUnkIds *param_2, ScriptInfoSm action->scriptData.savedScript.ptr2 = NULL; if (action->callbacks->getDirection != 0) { - action->callbacks->getDirection(action->parentObject, &action->scriptData.unk26); + action->callbacks->getDirection(action->parentObject, &action->scriptData.storedDir); } return TRUE; } @@ -515,7 +516,7 @@ s16 HandleAction(Action *action, const DebugLocation *debug) case CMD_BYTE_5D: case CMD_BYTE_5E: case CMD_BYTE_60: - case CMD_BYTE_8B: + case CMD_BYTE_8B: // SET_DIR_WAIT case CMD_BYTE_8C: case CMD_BYTE_8D: case CMD_BYTE_8E: @@ -568,7 +569,7 @@ s16 HandleAction(Action *action, const DebugLocation *debug) case CMD_BYTE_E0: { cmd = *action->scriptData.curPtr; if (IsEqualtoBGTrack(cmd.argShort)) { - if (action->scriptData.unk2C++ < 10800) + if (action->scriptData.unk2C++ < 180 * 60) loopContinue = FALSE; else action->scriptData.savedState = 3; @@ -582,7 +583,7 @@ s16 HandleAction(Action *action, const DebugLocation *debug) case CMD_BYTE_E2: { // WAIT_FANFARE2 cmd = *action->scriptData.curPtr; if (IsSoundPlaying(cmd.argShort)) { - if (action->scriptData.unk2C++ < 3600) + if (action->scriptData.unk2C++ < 60 * 60) loopContinue = FALSE; else action->scriptData.savedState = 3; @@ -653,9 +654,9 @@ s16 HandleAction(Action *action, const DebugLocation *debug) } res = action->callbacks->moveRelative(action->parentObject, &pos2); dir = (s8) VecDirection8Radial(&pos2); - dirBefore = action->scriptData.unk26; + dirBefore = action->scriptData.storedDir; dirS8 = dir; - action->scriptData.unk26 = dirS8; + action->scriptData.storedDir = dirS8; action->callbacks->setDirection(action->parentObject, dir); if (res & 9) { action->scriptData.savedState = 3; @@ -726,9 +727,9 @@ s16 HandleAction(Action *action, const DebugLocation *debug) pos3.x = pos2.x - pos1.x; pos3.y = pos2.y - pos1.y; dir = (s8) VecDirection8Radial(&pos3); - dirBefore = action->scriptData.unk26; + dirBefore = action->scriptData.storedDir; dirS8 = dir; - action->scriptData.unk26 = dirS8; + action->scriptData.storedDir = dirS8; action->callbacks->setDirection(action->parentObject, dir); action->callbacks->moveReal(action->parentObject, &pos2); action->callbacks->setEventIndex(action->parentObject, 0x1000); @@ -849,8 +850,8 @@ s16 HandleAction(Action *action, const DebugLocation *debug) } ASM_MATCH_TRICK(dir); - action->scriptData.unk26 = TransformDirection2(dir, tmp2, (u8)cmd.argShort); - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->scriptData.storedDir = TransformDirection2(dir, tmp2, (u8)cmd.argShort); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); action->scriptData.unk2A = cmd.argByte; } break; @@ -1446,11 +1447,11 @@ s16 HandleAction(Action *action, const DebugLocation *debug) case 0: { if (action->scriptData2.savedState) { action->scriptData = action->scriptData2; - if (action->callbacks->setDirection && action->scriptData.unk26 != -1) { + if (action->callbacks->setDirection && action->scriptData.storedDir != -1) { u32 tmp; action->callbacks->getFlags(action->parentObject, &tmp); if (tmp & 0x400) { - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); } } if (action->callbacks->setEventIndex) { @@ -2248,7 +2249,7 @@ static s32 ExecuteScriptCommand(Action *action) ptr->callbacks->getHitboxCenter(action->parentObject, &pos); ptr->callbacks->getDirection(action->parentObject, &c); action->callbacks->moveReal(action->parentObject, &pos); - action->scriptData.unk26 = c; + action->scriptData.storedDir = c; action->callbacks->setDirection(action->parentObject, c); } break; @@ -2275,7 +2276,7 @@ static s32 ExecuteScriptCommand(Action *action) break; } case CMD_BYTE_54: { - action->callbacks->getDirection(action->parentObject, &action->scriptData.unk26); + action->callbacks->getDirection(action->parentObject, &action->scriptData.storedDir); if (curCmd.argShort != 0) action->scriptData.unk24 = curCmd.argShort; @@ -2357,7 +2358,7 @@ static s32 ExecuteScriptCommand(Action *action) dir = (s8)GetScriptVarArrayValue(NULL, POSITION_DIRECTION, (u16)curCmd.arg1); action->callbacks->moveReal(action->parentObject, &pos); action->callbacks->setPosHeight(action->parentObject, height); - action->scriptData.unk26 = dir; + action->scriptData.storedDir = dir; action->callbacks->setDirection(action->parentObject, dir); scriptData->unk2A = (u8)curCmd.argByte; return 2; @@ -2561,7 +2562,7 @@ static s32 ExecuteScriptCommand(Action *action) return 2; } case CMD_BYTE_89: { - action->scriptData.unk26 = curCmd.arg1; + action->scriptData.storedDir = curCmd.arg1; action->callbacks->setDirection(action->parentObject, (s8) curCmd.arg1); scriptData->unk30 = curCmd.argShort; scriptData->unk2A = (u8)curCmd.argByte; @@ -2570,15 +2571,15 @@ static s32 ExecuteScriptCommand(Action *action) case CMD_BYTE_8A: { // CMD_UNK_8A s8 dir; action->callbacks->getDirection(action->parentObject, &dir); - action->scriptData.unk26 = TransformDirection1(dir, (u8)curCmd.arg1); - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->scriptData.storedDir = TransformDirection1(dir, (u8)curCmd.arg1); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); scriptData->unk30 = curCmd.argShort; scriptData->unk2A = (u8)curCmd.argByte; return 2; } - case CMD_BYTE_8B: { - action->scriptData.unk26 = curCmd.argShort; - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + case CMD_BYTE_8B: { // SET_DIR_WAIT + action->scriptData.storedDir = curCmd.argShort; + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); scriptData->unk2A = (u8)curCmd.argByte; return 2; } @@ -2587,8 +2588,8 @@ static s32 ExecuteScriptCommand(Action *action) s8 dir; if (ret >= 0) { sub_80A9050(ret, &dir); - action->scriptData.unk26 = TransformDirection1(dir, (u8)curCmd.argShort); - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->scriptData.storedDir = TransformDirection1(dir, (u8)curCmd.argShort); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); } scriptData->unk2A = (u8)curCmd.argByte; return 2; @@ -2596,8 +2597,8 @@ static s32 ExecuteScriptCommand(Action *action) case CMD_BYTE_8D: { // CMD_UNK_8D s8 dir; action->callbacks->getDirection(action->parentObject, &dir); - action->scriptData.unk26 = TransformDirection1(dir, (u8)curCmd.argShort); - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->scriptData.storedDir = TransformDirection1(dir, (u8)curCmd.argShort); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); scriptData->unk2A = (u8)curCmd.argByte; return 2; } @@ -2649,8 +2650,8 @@ static s32 ExecuteScriptCommand(Action *action) if (dir == tmp) { action->callbacks->getDirection(action->parentObject, &dir); } - action->scriptData.unk26 = TransformDirection1(dir, (u8)curCmd.argShort); - action->callbacks->setDirection(action->parentObject, action->scriptData.unk26); + action->scriptData.storedDir = TransformDirection1(dir, (u8)curCmd.argShort); + action->callbacks->setDirection(action->parentObject, action->scriptData.storedDir); } scriptData->unk2A = (u8)curCmd.argByte; return 2;