mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Merge pull request #939 from GriffinRichards/fix-compare
Use constants in compare macro
This commit is contained in:
commit
d42ea06dc5
@ -233,14 +233,12 @@
|
|||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Generic compare macro which attempts to deduce argument types based on their values
|
@ Generic compare macro which attempts to deduce argument types based on their values
|
||||||
@ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
|
@ Any values between 0x4000 to 0x40FF and 0x8000 to 0x8015 are considered event variable identifiers
|
||||||
.macro compare arg1:req, arg2:req
|
.macro compare var:req, arg:req
|
||||||
.if ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8)
|
.if ((\arg >= VARS_START && \arg <= VARS_END) || (\arg >= SPECIAL_VARS_START && \arg <= SPECIAL_VARS_END))
|
||||||
compare_var_to_var \arg1, \arg2
|
compare_var_to_var \var, \arg
|
||||||
.elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF)
|
|
||||||
compare_var_to_value \arg1, \arg2
|
|
||||||
.else
|
.else
|
||||||
.error "Invalid arguments for 'compare'"
|
compare_var_to_value \var, \arg
|
||||||
.endif
|
.endif
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
MysteryEventScript_AlteringCave:: @ 86756E3
|
MysteryEventScript_AlteringCave:: @ 86756E3
|
||||||
setvaddress MysteryEventScript_AlteringCave
|
setvaddress MysteryEventScript_AlteringCave
|
||||||
addvar VAR_ALTERING_CAVE_WILD_SET, 1
|
addvar VAR_ALTERING_CAVE_WILD_SET, 1
|
||||||
compare_var_to_value VAR_ALTERING_CAVE_WILD_SET, 10
|
compare VAR_ALTERING_CAVE_WILD_SET, 10
|
||||||
vgoto_if_ne MysteryEventScript_AlteringCave_
|
vgoto_if_ne MysteryEventScript_AlteringCave_
|
||||||
setvar VAR_ALTERING_CAVE_WILD_SET, 0
|
setvar VAR_ALTERING_CAVE_WILD_SET, 0
|
||||||
MysteryEventScript_AlteringCave_: @ 86756FD
|
MysteryEventScript_AlteringCave_: @ 86756FD
|
||||||
|
@ -7,13 +7,13 @@ MysteryEventScript_AuroraTicket:: @ 867533C
|
|||||||
checkflag FLAG_BATTLED_DEOXYS
|
checkflag FLAG_BATTLED_DEOXYS
|
||||||
vgoto_if_eq AuroraTicket_Obtained
|
vgoto_if_eq AuroraTicket_Obtained
|
||||||
checkitem ITEM_AURORA_TICKET, 1
|
checkitem ITEM_AURORA_TICKET, 1
|
||||||
compare_var_to_value VAR_RESULT, TRUE
|
compare VAR_RESULT, TRUE
|
||||||
vgoto_if_eq AuroraTicket_Obtained
|
vgoto_if_eq AuroraTicket_Obtained
|
||||||
vmessage sText_AuroraTicketForYou
|
vmessage sText_AuroraTicketForYou
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
checkitemspace ITEM_AURORA_TICKET, 1
|
checkitemspace ITEM_AURORA_TICKET, 1
|
||||||
compare_var_to_value VAR_RESULT, FALSE
|
compare VAR_RESULT, FALSE
|
||||||
vgoto_if_eq AuroraTicket_NoBagSpace
|
vgoto_if_eq AuroraTicket_NoBagSpace
|
||||||
giveitem_std ITEM_AURORA_TICKET
|
giveitem_std ITEM_AURORA_TICKET
|
||||||
setflag FLAG_ENABLE_SHIP_BIRTH_ISLAND
|
setflag FLAG_ENABLE_SHIP_BIRTH_ISLAND
|
||||||
|
@ -4,7 +4,7 @@ MysteryEventScript_BattleCard:: @ 867513C
|
|||||||
vgoto_if_eq MysteryEventScript_BattleCardInfo
|
vgoto_if_eq MysteryEventScript_BattleCardInfo
|
||||||
setorcopyvar VAR_RESULT, GET_CARD_BATTLES_WON
|
setorcopyvar VAR_RESULT, GET_CARD_BATTLES_WON
|
||||||
specialvar VAR_0x8008, GetMysteryEventCardVal
|
specialvar VAR_0x8008, GetMysteryEventCardVal
|
||||||
compare_var_to_value VAR_0x8008, REQUIRED_CARD_BATTLES
|
compare VAR_0x8008, REQUIRED_CARD_BATTLES
|
||||||
vgoto_if_ne MysteryEventScript_BattleCardInfo
|
vgoto_if_ne MysteryEventScript_BattleCardInfo
|
||||||
lock
|
lock
|
||||||
faceplayer
|
faceplayer
|
||||||
|
@ -9,13 +9,13 @@ MysteryEventScript_MysticTicket:: @ 867550B
|
|||||||
checkflag FLAG_CAUGHT_HO_OH
|
checkflag FLAG_CAUGHT_HO_OH
|
||||||
vgoto_if_eq MysticTicket_Obtained
|
vgoto_if_eq MysticTicket_Obtained
|
||||||
checkitem ITEM_MYSTIC_TICKET, 1
|
checkitem ITEM_MYSTIC_TICKET, 1
|
||||||
compare_var_to_value VAR_RESULT, TRUE
|
compare VAR_RESULT, TRUE
|
||||||
vgoto_if_eq MysticTicket_Obtained
|
vgoto_if_eq MysticTicket_Obtained
|
||||||
vmessage sText_MysticTicketForYou
|
vmessage sText_MysticTicketForYou
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
checkitemspace ITEM_MYSTIC_TICKET, 1
|
checkitemspace ITEM_MYSTIC_TICKET, 1
|
||||||
compare_var_to_value VAR_RESULT, FALSE
|
compare VAR_RESULT, FALSE
|
||||||
vgoto_if_eq MysticTicket_NoBagSpace
|
vgoto_if_eq MysticTicket_NoBagSpace
|
||||||
giveitem_std ITEM_MYSTIC_TICKET
|
giveitem_std ITEM_MYSTIC_TICKET
|
||||||
setflag FLAG_ENABLE_SHIP_NAVEL_ROCK
|
setflag FLAG_ENABLE_SHIP_NAVEL_ROCK
|
||||||
|
@ -7,13 +7,13 @@ MysteryEventScript_OldSeaMap:: @ 86757F4
|
|||||||
checkflag FLAG_CAUGHT_MEW
|
checkflag FLAG_CAUGHT_MEW
|
||||||
vgoto_if_eq OldSeaMap_Obtained
|
vgoto_if_eq OldSeaMap_Obtained
|
||||||
checkitem ITEM_OLD_SEA_MAP, 1
|
checkitem ITEM_OLD_SEA_MAP, 1
|
||||||
compare_var_to_value VAR_RESULT, TRUE
|
compare VAR_RESULT, TRUE
|
||||||
vgoto_if_eq OldSeaMap_Obtained
|
vgoto_if_eq OldSeaMap_Obtained
|
||||||
vmessage sText_MysteryGiftOldSeaMapForYou
|
vmessage sText_MysteryGiftOldSeaMapForYou
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
checkitemspace ITEM_OLD_SEA_MAP, 1
|
checkitemspace ITEM_OLD_SEA_MAP, 1
|
||||||
compare_var_to_value VAR_RESULT, FALSE
|
compare VAR_RESULT, FALSE
|
||||||
vgoto_if_eq OldSeaMap_NoBagSpace
|
vgoto_if_eq OldSeaMap_NoBagSpace
|
||||||
giveitem_std ITEM_OLD_SEA_MAP
|
giveitem_std ITEM_OLD_SEA_MAP
|
||||||
setflag FLAG_ENABLE_SHIP_FARAWAY_ISLAND
|
setflag FLAG_ENABLE_SHIP_FARAWAY_ISLAND
|
||||||
|
@ -6,7 +6,7 @@ MysteryEventScript_SurfPichu:: @ 8674D3D
|
|||||||
|
|
||||||
SurfPichu_GiveIfPossible: @ 8674D4C
|
SurfPichu_GiveIfPossible: @ 8674D4C
|
||||||
specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount
|
specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, PARTY_SIZE
|
compare VAR_EVENT_PICHU_SLOT, PARTY_SIZE
|
||||||
vgoto_if_eq SurfPichu_FullParty
|
vgoto_if_eq SurfPichu_FullParty
|
||||||
setflag FLAG_MYSTERY_EVENT_DONE
|
setflag FLAG_MYSTERY_EVENT_DONE
|
||||||
vcall SurfPichu_GiveEgg
|
vcall SurfPichu_GiveEgg
|
||||||
@ -33,15 +33,15 @@ SurfPichu_GiveEgg: @ 8674D7E
|
|||||||
giveegg SPECIES_PICHU
|
giveegg SPECIES_PICHU
|
||||||
setmonobedient VAR_EVENT_PICHU_SLOT
|
setmonobedient VAR_EVENT_PICHU_SLOT
|
||||||
setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER
|
setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 1
|
compare VAR_EVENT_PICHU_SLOT, 1
|
||||||
vgoto_if_eq SurfPichu_Slot1
|
vgoto_if_eq SurfPichu_Slot1
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 2
|
compare VAR_EVENT_PICHU_SLOT, 2
|
||||||
vgoto_if_eq SurfPichu_Slot2
|
vgoto_if_eq SurfPichu_Slot2
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 3
|
compare VAR_EVENT_PICHU_SLOT, 3
|
||||||
vgoto_if_eq SurfPichu_Slot3
|
vgoto_if_eq SurfPichu_Slot3
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 4
|
compare VAR_EVENT_PICHU_SLOT, 4
|
||||||
vgoto_if_eq SurfPichu_Slot4
|
vgoto_if_eq SurfPichu_Slot4
|
||||||
compare_var_to_value VAR_EVENT_PICHU_SLOT, 5
|
compare VAR_EVENT_PICHU_SLOT, 5
|
||||||
vgoto_if_eq SurfPichu_Slot5
|
vgoto_if_eq SurfPichu_Slot5
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
MysteryEventScript_VisitingTrainer:: @ 8674EC1
|
MysteryEventScript_VisitingTrainer:: @ 8674EC1
|
||||||
setvaddress MysteryEventScript_VisitingTrainer
|
setvaddress MysteryEventScript_VisitingTrainer
|
||||||
special ValidateEReaderTrainer
|
special ValidateEReaderTrainer
|
||||||
compare_var_to_value VAR_RESULT, 0
|
compare VAR_RESULT, 0
|
||||||
vgoto_if_eq MysteryEventScript_VisitingTrainerArrived
|
vgoto_if_eq MysteryEventScript_VisitingTrainerArrived
|
||||||
lock
|
lock
|
||||||
faceplayer
|
faceplayer
|
||||||
|
@ -273,7 +273,9 @@
|
|||||||
#define VAR_UNUSED_0x40FE 0x40FE // Unused Var
|
#define VAR_UNUSED_0x40FE 0x40FE // Unused Var
|
||||||
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
|
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
|
||||||
|
|
||||||
#define SPECIAL_VARS_START 0x8000
|
#define VARS_END 0x40FF
|
||||||
|
|
||||||
|
#define SPECIAL_VARS_START 0x8000
|
||||||
// special vars
|
// special vars
|
||||||
// They are commonly used as parameters to commands, or return values from commands.
|
// They are commonly used as parameters to commands, or return values from commands.
|
||||||
#define VAR_0x8000 0x8000
|
#define VAR_0x8000 0x8000
|
||||||
@ -299,4 +301,6 @@
|
|||||||
#define VAR_UNUSED_0x8014 0x8014
|
#define VAR_UNUSED_0x8014 0x8014
|
||||||
#define VAR_TRAINER_BATTLE_OPPONENT_A 0x8015 // Alias of gTrainerBattleOpponent_A
|
#define VAR_TRAINER_BATTLE_OPPONENT_A 0x8015 // Alias of gTrainerBattleOpponent_A
|
||||||
|
|
||||||
|
#define SPECIAL_VARS_END 0x8015
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_VARS_H
|
#endif // GUARD_CONSTANTS_VARS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user