diff --git a/asm/macros/scripts.inc b/asm/macros/scripts.inc index e05e2271..dea57c36 100644 --- a/asm/macros/scripts.inc +++ b/asm/macros/scripts.inc @@ -36,49 +36,29 @@ 1: .short \s - 1b .endm -.macro JumpSwitch a,b - .short 0x0c06 -1: .short \a - 1b - .short \b - 1b - 2 +.macro JumpSwitchOpN n label labels:vararg + .ifnb \labels + JumpSwitchOpN \n + 1 \labels + .else + .short 0x400 * (\n) + 0x6 + .endif .endm -.macro JumpSwitch_3 a,b,c - .short 0x1006 -1: .short \a - 1b - .short \b - 1b - 2 - .short \c - 1b - 4 +.macro JumpSwitchOp labels:vararg + JumpSwitchOpN 2 \labels .endm -.macro JumpSwitch_4 a,b,c,d - .short 0x1406 -1: .short \a - 1b - .short \b - 1b - 2 - .short \c - 1b - 4 - .short \d - 1b - 6 +.macro JumpSwitchLabel temp label labels:vararg + .short \label - \temp + .ifnb \labels + JumpSwitchLabel \temp - 2 \labels + .endif .endm -.macro JumpSwitch_7 a,b,c,d,e,f,g - .short 0x2006 -1: .short \a - 1b - .short \b - 1b - 2 - .short \c - 1b - 4 - .short \d - 1b - 6 - .short \e - 1b - 8 - .short \f - 1b - 10 - .short \g - 1b - 12 -.endm - -.macro JumpSwitch_9 a,b,c,d,e,f,g,h,i - .short 0x2806 -1: .short \a - 1b - .short \b - 1b - 2 - .short \c - 1b - 4 - .short \d - 1b - 6 - .short \e - 1b - 8 - .short \f - 1b - 10 - .short \g - 1b - 12 - .short \h - 1b - 14 - .short \i - 1b - 16 +.macro JumpSwitch labels:vararg + JumpSwitchOp \labels +1: + JumpSwitchLabel 1b \labels .endm .macro JumpAbsolute w @@ -96,10 +76,28 @@ .word \w .endm -.macro JumpAbsoluteSwitch a, b - .short 0x140a - .word \a - .word \b +.macro JumpAbsoluteSwitchOpN n label labels:vararg + .ifnb \labels + JumpAbsoluteSwitchOpN \n + 2 \labels + .else + .short 0x400 * (\n) + 0xa + .endif +.endm + +.macro JumpAbsoluteSwitchOp labels:vararg + JumpAbsoluteSwitchOpN 3 \labels +.endm + +.macro JumpAbsoluteSwitchLabel label labels:vararg + .word \label + .ifnb \labels + JumpAbsoluteSwitchLabel \labels + .endif +.endm + +.macro JumpAbsoluteSwitch labels:vararg + JumpAbsoluteSwitchOp \labels + JumpAbsoluteSwitchLabel \labels .endm .macro Call w diff --git a/data/scripts/script_0800B0D0.inc b/data/scripts/script_0800B0D0.inc index b5fccb39..91851cb0 100644 --- a/data/scripts/script_0800B0D0.inc +++ b/data/scripts/script_0800B0D0.inc @@ -6,7 +6,7 @@ SCRIPT_START script_0800B0D0 EndBlock script_0800B0E8: Call sub_0807F434 - JumpSwitch_3 script_0800B0E8, script_0800B0F6, script_0800B134 + JumpSwitch script_0800B0E8, script_0800B0F6, script_0800B134 script_0800B0F6: _0807E864 Call sub_0807DF28 diff --git a/data/scripts/script_0800B9B4.inc b/data/scripts/script_0800B9B4.inc index 133ef817..156d0dff 100644 --- a/data/scripts/script_0800B9B4.inc +++ b/data/scripts/script_0800B9B4.inc @@ -7,7 +7,7 @@ SCRIPT_START script_0800B9B4 EndBlock script_0800B9CA: Call sub_0807F434 - JumpSwitch_3 script_0800B9CA, script_0800B9D8, script_0800B9F4 + JumpSwitch script_0800B9CA, script_0800B9D8, script_0800B9F4 script_0800B9D8: _0807E864 _0807EB74 diff --git a/data/scripts/script_0800D414.inc b/data/scripts/script_0800D414.inc index 90dabc5d..2ace1fe6 100644 --- a/data/scripts/script_0800D414.inc +++ b/data/scripts/script_0800D414.inc @@ -49,7 +49,7 @@ script_0800D4E4: Call sub_08062698 Call sub_080626AC CallWithArg sub_0807F0EC, 0x00000009 - JumpSwitch_9 script_0800D510, script_0800D51A, script_0800D524, script_0800D52E, script_0800D538, script_0800D542, script_0800D54C, script_0800D556, script_0800D560 + JumpSwitch script_0800D510, script_0800D51A, script_0800D524, script_0800D52E, script_0800D538, script_0800D542, script_0800D54C, script_0800D556, script_0800D560 script_0800D510: _0807EE04 0x0038, 0x0068 Jump script_0800D566 @@ -104,7 +104,7 @@ script_0800D5AC: Call sub_08062698 Call sub_080626AC CallWithArg sub_0807F0EC, 0x00000004 - JumpSwitch_4 script_0800D5CE, script_0800D5D8, script_0800D5E2, script_0800D5EC + JumpSwitch script_0800D5CE, script_0800D5D8, script_0800D5E2, script_0800D5EC script_0800D5CE: _0807EE04 0x0038, 0x0098 Jump script_0800D5F2 diff --git a/data/scripts/script_0800E6B0.inc b/data/scripts/script_0800E6B0.inc index b540d51a..f735c036 100644 --- a/data/scripts/script_0800E6B0.inc +++ b/data/scripts/script_0800E6B0.inc @@ -139,7 +139,7 @@ script_0800E832: EndBlock _0807EA94 _0807EB38 - JumpSwitch_4 script_0800E910, script_0800E8D6, script_0800E8A4, script_0800E872 + JumpSwitch script_0800E910, script_0800E8D6, script_0800E8A4, script_0800E872 script_0800E872: BeginBlock TextboxNoOverlapFollow 0x4505 diff --git a/data/scripts/script_0800FAE4.inc b/data/scripts/script_0800FAE4.inc index ebab7689..05d97d17 100644 --- a/data/scripts/script_0800FAE4.inc +++ b/data/scripts/script_0800FAE4.inc @@ -3,7 +3,7 @@ SCRIPT_START script_0800FAE4 SetEntityNonPlanarMovement 0x0100 EndBlock Call sub_0807F584 - JumpSwitch_4 script_0800FB06, script_0800FB10, script_0800FB06, script_0800FAFC + JumpSwitch script_0800FB06, script_0800FB10, script_0800FB06, script_0800FAFC script_0800FAFC: CallWithArg sub_0807F4F8, 0x0000027c script_0800FB06: diff --git a/data/scripts/script_080100C8.inc b/data/scripts/script_080100C8.inc index f226288c..7c6f200e 100644 --- a/data/scripts/script_080100C8.inc +++ b/data/scripts/script_080100C8.inc @@ -70,6 +70,7 @@ script_0801019E: script_080101A6: _0807E878 Jump script_0801015A +script_080101AC: BeginBlock _0807EF80 0x0008 Call sub_080A1648 diff --git a/data/scripts/script_08010264.inc b/data/scripts/script_08010264.inc index 4f8f03de..7d47f95d 100644 --- a/data/scripts/script_08010264.inc +++ b/data/scripts/script_08010264.inc @@ -64,7 +64,7 @@ script_08010314: Call sub_08062698 Call sub_080626AC CallWithArg sub_0807F0EC, 0x00000009 - JumpSwitch_9 script_08010340, script_0801034A, script_08010354, script_0801035E, script_08010368, script_08010372, script_0801037C, script_08010386, script_08010390 + JumpSwitch script_08010340, script_0801034A, script_08010354, script_0801035E, script_08010368, script_08010372, script_0801037C, script_08010386, script_08010390 script_08010340: _0807EE04 0x0358, 0x0078 Jump script_08010396 @@ -205,7 +205,7 @@ script_08010502: _0807EA94 script_0801052E: Call sub_080634E4 - JumpSwitch_7 script_08010544, script_08010558, script_08010570, script_08010570, script_0801054C, script_08010564, script_08010570 + JumpSwitch script_08010544, script_08010558, script_08010570, script_08010570, script_0801054C, script_08010564, script_08010570 script_08010544: TextboxNoOverlap 0x2b0d Jump script_080105E0 diff --git a/data/scripts/script_080112C4.inc b/data/scripts/script_080112C4.inc index 2e729ab4..e6b671c9 100644 --- a/data/scripts/script_080112C4.inc +++ b/data/scripts/script_080112C4.inc @@ -15,7 +15,7 @@ SCRIPT_START script_080112C4 _0807ECC4 0x0010 _0807E930 0x0002 Call sub_08064050 - JumpSwitch_4 script_08011312, script_080113AA, script_08011442, script_08011508 + JumpSwitch script_08011312, script_080113AA, script_08011442, script_08011508 script_08011312: _0807E610 0x00000800 _0807E5F8 0x00001000 diff --git a/data/scripts/script_080136D8.inc b/data/scripts/script_080136D8.inc index 33bbb792..2a7c0058 100644 --- a/data/scripts/script_080136D8.inc +++ b/data/scripts/script_080136D8.inc @@ -3,7 +3,7 @@ SCRIPT_START script_080136D8 SetEntityNonPlanarMovement 0x0100 EndBlock Call sub_0807F584 - JumpSwitch_4 script_080136F0, script_080136FA, script_08013704, script_080136FA + JumpSwitch script_080136F0, script_080136FA, script_08013704, script_080136FA script_080136F0: CallWithArg sub_0807F464, 0x000000d0 script_080136FA: