replaced JumpSwitch macros with variadic versions

This commit is contained in:
Henny022p 2021-03-07 23:46:40 +01:00
parent 5304b4759f
commit 5d2173f931
10 changed files with 50 additions and 51 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -70,6 +70,7 @@ script_0801019E:
script_080101A6:
_0807E878
Jump script_0801015A
script_080101AC:
BeginBlock
_0807EF80 0x0008
Call sub_080A1648

View File

@ -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

View File

@ -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

View File

@ -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: