You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Eliminate enum: use const instead, with case-by-case parallel const implementations
This commit is contained in:
@@ -162,59 +162,60 @@ SLP EQU %111 ; 0-7 turns
|
||||
ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
|
||||
|
||||
; wPlayerSubStatus1 or wEnemySubStatus1 bit flags
|
||||
enum_start 7, -1
|
||||
enum SUBSTATUS_IN_LOVE
|
||||
enum SUBSTATUS_ROLLOUT
|
||||
enum SUBSTATUS_ENDURE
|
||||
enum SUBSTATUS_PERISH
|
||||
enum SUBSTATUS_IDENTIFIED
|
||||
enum SUBSTATUS_PROTECT
|
||||
enum SUBSTATUS_CURSE
|
||||
enum SUBSTATUS_NIGHTMARE
|
||||
const_def
|
||||
const SUBSTATUS_NIGHTMARE
|
||||
const SUBSTATUS_CURSE
|
||||
const SUBSTATUS_PROTECT
|
||||
const SUBSTATUS_IDENTIFIED
|
||||
const SUBSTATUS_PERISH
|
||||
const SUBSTATUS_ENDURE
|
||||
const SUBSTATUS_ROLLOUT
|
||||
const SUBSTATUS_IN_LOVE
|
||||
|
||||
; wPlayerSubStatus2 or wEnemySubStatus2 bit flags
|
||||
SUBSTATUS_CURLED EQU 0
|
||||
const_def
|
||||
const SUBSTATUS_CURLED
|
||||
|
||||
; wPlayerSubStatus3 or wEnemySubStatus3 bit flags
|
||||
enum_start 7, -1
|
||||
enum SUBSTATUS_CONFUSED
|
||||
enum SUBSTATUS_FLYING
|
||||
enum SUBSTATUS_UNDERGROUND
|
||||
enum SUBSTATUS_CHARGED
|
||||
enum SUBSTATUS_FLINCHED
|
||||
enum SUBSTATUS_IN_LOOP
|
||||
enum SUBSTATUS_RAMPAGE
|
||||
enum SUBSTATUS_BIDE
|
||||
const_def
|
||||
const SUBSTATUS_BIDE
|
||||
const SUBSTATUS_RAMPAGE
|
||||
const SUBSTATUS_IN_LOOP
|
||||
const SUBSTATUS_FLINCHED
|
||||
const SUBSTATUS_CHARGED
|
||||
const SUBSTATUS_UNDERGROUND
|
||||
const SUBSTATUS_FLYING
|
||||
const SUBSTATUS_CONFUSED
|
||||
|
||||
; wPlayerSubStatus4 or wEnemySubStatus4 bit flags
|
||||
enum_start 7, -1
|
||||
enum SUBSTATUS_LEECH_SEED
|
||||
enum SUBSTATUS_RAGE
|
||||
enum SUBSTATUS_RECHARGE
|
||||
enum SUBSTATUS_SUBSTITUTE
|
||||
enum SUBSTATUS_UNKNOWN_1
|
||||
enum SUBSTATUS_FOCUS_ENERGY
|
||||
enum SUBSTATUS_MIST
|
||||
enum SUBSTATUS_X_ACCURACY
|
||||
const_def
|
||||
const SUBSTATUS_X_ACCURACY
|
||||
const SUBSTATUS_MIST
|
||||
const SUBSTATUS_FOCUS_ENERGY
|
||||
const SUBSTATUS_UNKNOWN_1
|
||||
const SUBSTATUS_SUBSTITUTE
|
||||
const SUBSTATUS_RECHARGE
|
||||
const SUBSTATUS_RAGE
|
||||
const SUBSTATUS_LEECH_SEED
|
||||
|
||||
; wPlayerSubStatus5 or wEnemySubStatus5 bit flags
|
||||
enum_start 7, -1
|
||||
enum SUBSTATUS_CANT_RUN
|
||||
enum SUBSTATUS_DESTINY_BOND
|
||||
enum SUBSTATUS_LOCK_ON
|
||||
enum SUBSTATUS_ENCORED
|
||||
enum SUBSTATUS_TRANSFORMED
|
||||
enum SUBSTATUS_UNKNOWN_2
|
||||
enum SUBSTATUS_UNKNOWN_3
|
||||
enum SUBSTATUS_TOXIC
|
||||
const_def
|
||||
const SUBSTATUS_TOXIC
|
||||
const SUBSTATUS_UNKNOWN_2
|
||||
const SUBSTATUS_UNKNOWN_3
|
||||
const SUBSTATUS_TRANSFORMED
|
||||
const SUBSTATUS_ENCORED
|
||||
const SUBSTATUS_LOCK_ON
|
||||
const SUBSTATUS_DESTINY_BOND
|
||||
const SUBSTATUS_CANT_RUN
|
||||
|
||||
; wPlayerScreens or wEnemyScreens bit flags
|
||||
enum_start 4, -1
|
||||
enum SCREENS_REFLECT
|
||||
enum SCREENS_LIGHT_SCREEN
|
||||
enum SCREENS_SAFEGUARD
|
||||
enum SCREENS_UNUSED
|
||||
enum SCREENS_SPIKES
|
||||
const_def
|
||||
const SCREENS_SPIKES
|
||||
const SCREENS_UNUSED
|
||||
const SCREENS_SAFEGUARD
|
||||
const SCREENS_LIGHT_SCREEN
|
||||
const SCREENS_REFLECT
|
||||
|
||||
; values in wBattleWeather
|
||||
const_def
|
||||
|
@@ -54,16 +54,18 @@ const_value = 1
|
||||
const SET_UP_ORNAMENT
|
||||
const PUT_AWAY_ORNAMENT
|
||||
|
||||
__deco_value__ = 0
|
||||
|
||||
deco: MACRO
|
||||
const DECO_\1
|
||||
enum DECOFLAG_\1
|
||||
DECOFLAG_\1 EQU __deco_value__
|
||||
__deco_value__ = __deco_value__ + 1
|
||||
ENDM
|
||||
|
||||
; decorations:
|
||||
; - DecorationAttributes (see data/decorations/attributes.asm)
|
||||
; - DecorationIDs (see data/decorations/decorations.asm)
|
||||
const_def 1
|
||||
enum_start
|
||||
; FindOwnedBeds.beds values (see engine/overworld/decorations.asm)
|
||||
const BEDS
|
||||
deco FEATHERY_BED
|
||||
@@ -121,7 +123,7 @@ ENDM
|
||||
deco GEODUDE_DOLL
|
||||
deco MACHOP_DOLL
|
||||
deco TENTACOOL_DOLL
|
||||
NUM_NON_TROPHY_DECOS EQU __enum__
|
||||
NUM_NON_TROPHY_DECOS EQU __deco_value__
|
||||
deco GOLD_TROPHY_DOLL
|
||||
deco SILVER_TROPHY_DOLL
|
||||
NUM_DECOS EQU __enum__
|
||||
NUM_DECOS EQU __deco_value__
|
||||
|
@@ -197,6 +197,8 @@
|
||||
const MIRAGE_MAIL ; bd
|
||||
const ITEM_BE ; be
|
||||
|
||||
__tmhm_value__ = 1
|
||||
|
||||
add_tm: MACRO
|
||||
; Defines three constants:
|
||||
; - TM_\1: the item id, starting at $bf
|
||||
@@ -205,17 +207,17 @@ add_tm: MACRO
|
||||
; The first usage also defines TM01 as the first TM item id.
|
||||
if !DEF(TM01)
|
||||
TM01 EQU const_value
|
||||
enum_start 1
|
||||
endc
|
||||
if __enum__ < 10
|
||||
MOVE_FOR_TM EQUS "TM0{d:__enum__}_MOVE"
|
||||
if __tmhm_value__ < 10
|
||||
MOVE_FOR_TM EQUS "TM0{d:__tmhm_value__}_MOVE"
|
||||
else
|
||||
MOVE_FOR_TM EQUS "TM{d:__enum__}_MOVE"
|
||||
MOVE_FOR_TM EQUS "TM{d:__tmhm_value__}_MOVE"
|
||||
endc
|
||||
MOVE_FOR_TM = \1
|
||||
PURGE MOVE_FOR_TM
|
||||
const TM_\1
|
||||
enum \1_TMNUM
|
||||
\1_TMNUM EQU __tmhm_value__
|
||||
__tmhm_value__ = __tmhm_value__ + 1
|
||||
ENDM
|
||||
|
||||
; see data/moves/tmhm_moves.asm for moves
|
||||
@@ -271,7 +273,7 @@ ENDM
|
||||
add_tm FIRE_PUNCH ; f0
|
||||
add_tm FURY_CUTTER ; f1
|
||||
add_tm NIGHTMARE ; f2
|
||||
NUM_TMS EQU __enum__ - 1
|
||||
NUM_TMS EQU __tmhm_value__ - 1
|
||||
|
||||
add_hm: MACRO
|
||||
; Defines three constants:
|
||||
@@ -282,7 +284,7 @@ add_hm: MACRO
|
||||
if !DEF(HM01)
|
||||
HM01 EQU const_value
|
||||
endc
|
||||
HM_VALUE EQU __enum__ - NUM_TMS
|
||||
HM_VALUE EQU __tmhm_value__ - NUM_TMS
|
||||
if HM_VALUE < 10
|
||||
MOVE_FOR_HM EQUS "HM0{d:HM_VALUE}_MOVE"
|
||||
else
|
||||
@@ -292,7 +294,8 @@ MOVE_FOR_HM = \1
|
||||
PURGE MOVE_FOR_HM
|
||||
PURGE HM_VALUE
|
||||
const HM_\1
|
||||
enum \1_TMNUM
|
||||
\1_TMNUM EQU __tmhm_value__
|
||||
__tmhm_value__ = __tmhm_value__ + 1
|
||||
ENDM
|
||||
|
||||
add_hm CUT ; f3
|
||||
@@ -302,13 +305,13 @@ ENDM
|
||||
add_hm FLASH ; f7
|
||||
add_hm WHIRLPOOL ; f8
|
||||
add_hm WATERFALL ; f9
|
||||
NUM_HMS EQU __enum__ - NUM_TMS - 1
|
||||
NUM_HMS EQU __tmhm_value__ - NUM_TMS - 1
|
||||
|
||||
add_mt: MACRO
|
||||
; Defines two constants:
|
||||
; - \1_TMNUM: the learnable TM/HM flag, starting at 58
|
||||
; - MT##_MOVE: alias for the move id, equal to the value of \1
|
||||
MT_VALUE EQU __enum__ - NUM_TMS - NUM_HMS
|
||||
MT_VALUE EQU __tmhm_value__ - NUM_TMS - NUM_HMS
|
||||
if MT_VALUE < 10
|
||||
MOVE_FOR_MT EQUS "MT0{d:MT_VALUE}_MOVE"
|
||||
else
|
||||
@@ -317,15 +320,16 @@ endc
|
||||
MOVE_FOR_MT = \1
|
||||
PURGE MOVE_FOR_MT
|
||||
PURGE MT_VALUE
|
||||
enum \1_TMNUM
|
||||
\1_TMNUM EQU __tmhm_value__
|
||||
__tmhm_value__ = __tmhm_value__ + 1
|
||||
ENDM
|
||||
|
||||
add_mt FLAMETHROWER
|
||||
add_mt THUNDERBOLT
|
||||
add_mt ICE_BEAM
|
||||
NUM_TUTORS = __enum__ - NUM_TMS - NUM_HMS - 1
|
||||
NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1
|
||||
|
||||
NUM_TM_HM_TUTOR EQU __enum__ - 1
|
||||
NUM_TM_HM_TUTOR EQU __tmhm_value__ - 1
|
||||
|
||||
const ITEM_FA ; fa
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
newgroup: MACRO
|
||||
const_value = const_value + 1
|
||||
enum_start 1
|
||||
__map_value__ = 1
|
||||
ENDM
|
||||
|
||||
map_const: MACRO
|
||||
@@ -8,7 +8,8 @@ map_const: MACRO
|
||||
;\2: width: in blocks
|
||||
;\3: height: in blocks
|
||||
GROUP_\1 EQU const_value
|
||||
enum MAP_\1
|
||||
MAP_\1 EQU __map_value__
|
||||
__map_value__ = __map_value__ + 1
|
||||
\1_WIDTH EQU \2
|
||||
\1_HEIGHT EQU \3
|
||||
ENDM
|
||||
|
@@ -1,5 +1,8 @@
|
||||
__trainer_class__ = 0
|
||||
|
||||
trainerclass: MACRO
|
||||
enum \1
|
||||
\1 EQU __trainer_class__
|
||||
__trainer_class__ = __trainer_class__ + 1
|
||||
const_value = 1
|
||||
ENDM
|
||||
|
||||
@@ -15,8 +18,7 @@ ENDM
|
||||
; - BTTrainerClassSprites (see data/trainers/sprites.asm)
|
||||
; - BTTrainerClassGenders (see data/trainers/genders.asm)
|
||||
; trainer constants are Trainers indexes, for the sub-tables of TrainerGroups (see data/trainers/parties.asm)
|
||||
enum_start
|
||||
CHRIS EQU __enum__
|
||||
CHRIS EQU __trainer_class__
|
||||
trainerclass TRAINER_NONE ; 0
|
||||
const PHONECONTACT_MOM
|
||||
const PHONECONTACT_BIKESHOP
|
||||
@@ -24,7 +26,7 @@ CHRIS EQU __enum__
|
||||
const PHONECONTACT_ELM
|
||||
const PHONECONTACT_BUENA
|
||||
|
||||
KRIS EQU __enum__
|
||||
KRIS EQU __trainer_class__
|
||||
trainerclass FALKNER ; 1
|
||||
const FALKNER1
|
||||
|
||||
@@ -700,4 +702,4 @@ KRIS EQU __enum__
|
||||
trainerclass MYSTICALMAN ; 43
|
||||
const EUSINE
|
||||
|
||||
NUM_TRAINER_CLASSES EQU __enum__
|
||||
NUM_TRAINER_CLASSES EQU __trainer_class__
|
||||
|
Reference in New Issue
Block a user