summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2019-07-07 00:44:21 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2019-07-07 00:44:21 -0400
commitf99a715fae311d2611ec4a714b002e103c4642ca (patch)
tree55c3b2f36f037ab192777755fe7e4b8f5a22131d /engine
parent725b86ebbec23bd1f53fd60bf0201c904fee951d (diff)
Replace some hard-coded values with constants
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/battle_transitions.asm2
-rwxr-xr-xengine/battle/core.asm2
-rwxr-xr-xengine/battle/read_trainer_party.asm2
-rw-r--r--engine/overworld/movement.asm16
-rwxr-xr-xengine/palettes.asm2
-rwxr-xr-xengine/pokedex_rating.asm2
6 files changed, 14 insertions, 12 deletions
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index 1967d33b..436e38b5 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -82,7 +82,7 @@ BattleTransitions:
GetBattleTransitionID_WildOrTrainer:
ld a, [wCurOpponent]
- cp 200
+ cp OPP_ID_OFFSET
jr nc, .trainer
res 0, c
ret
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 056a9588..04336810 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6867,7 +6867,7 @@ InitBattleCommon:
res 1, [hl]
callab InitBattleVariables
ld a, [wEnemyMonSpecies2]
- sub 200
+ sub OPP_ID_OFFSET
jp c, InitWildBattle
ld [wTrainerClass], a
call GetTrainerInformation
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index ba00083b..ba4f6f8e 100755
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -101,7 +101,7 @@ ReadTrainer:
; get trainer class number
ld a, [wCurOpponent]
- sub 200
+ sub OPP_ID_OFFSET
ld b, a
ld hl, TeamMoves
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index bbfbbc39..b561df7d 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -1,3 +1,5 @@
+MAP_TILESET_SIZE EQU $60
+
UpdatePlayerSprite:
ld a, [wSpriteStateData2]
and a
@@ -13,7 +15,7 @@ UpdatePlayerSprite:
.checkIfTextBoxInFrontOfSprite
aCoord 8, 9
ld [hTilePlayerStandingOn], a
- cp $60
+ cp MAP_TILESET_SIZE
jr c, .lowerLeftTileIsMapTile
.disableSprite
ld a, $ff
@@ -127,7 +129,7 @@ UpdateNPCSprite:
and a
jp z, InitializeSpriteStatus
call CheckSpriteAvailability
- ret c ; if sprite is invisible, on tile >=$60, in grass or player is currently walking
+ ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking
ld h, $c1
ld a, [H_CURRENTSPRITEOFFSET]
ld l, a
@@ -508,21 +510,21 @@ CheckSpriteAvailability:
; make the sprite invisible if a text box is in front of it
; $5F is the maximum number for map tiles
call GetTileSpriteStandsOn
- ld d, $60
+ ld d, MAP_TILESET_SIZE
ld a, [hli]
cp d
- jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom left tile)
+ jr nc, .spriteInvisible ; standing on tile with ID >=MAP_TILESET_SIZE (bottom left tile)
ld a, [hld]
cp d
- jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom right tile)
+ jr nc, .spriteInvisible ; standing on tile with ID >=MAP_TILESET_SIZE (bottom right tile)
ld bc, -20
add hl, bc ; go back one row of tiles
ld a, [hli]
cp d
- jr nc, .spriteInvisible ; standing on tile with ID >=$60 (top left tile)
+ jr nc, .spriteInvisible ; standing on tile with ID >=MAP_TILESET_SIZE (top left tile)
ld a, [hl]
cp d
- jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile)
+ jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile)
.spriteInvisible
ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
diff --git a/engine/palettes.asm b/engine/palettes.asm
index 4ab83f36..39991d48 100755
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -70,7 +70,7 @@ SetPal_StatusScreen:
ld bc, $10
call CopyData
ld a, [wcf91]
- cp VICTREEBEL + 1
+ cp NUM_POKEMON_INDEXES + 1
jr c, .pokemon
ld a, $1 ; not pokemon
.pokemon
diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm
index aff9769e..f1aaf618 100755
--- a/engine/pokedex_rating.asm
+++ b/engine/pokedex_rating.asm
@@ -86,7 +86,7 @@ DexRatingsTable:
dw PokedexRatingText_44242
db 150
dw PokedexRatingText_44247
- db 152
+ db NUM_POKEMON + 1
dw PokedexRatingText_4424c
PokedexRatingText_44201: