From 7a7a6d689c1fc2cd42ae925e4c7e19434a4e0267 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:23:22 -0500 Subject: [PATCH 01/16] Identify the unnamed HRAM variables and one WRAM label (#438) --- engine/events/hidden_objects/bookshelves.asm | 4 +-- engine/gfx/sprite_oam.asm | 4 +-- engine/overworld/sprite_collisions.asm | 38 ++++++++++---------- home/hidden_objects.asm | 2 +- ram/hram.asm | 13 +++---- ram/wram.asm | 2 +- 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index b58444af8..813cfc49a 100644 --- a/engine/events/hidden_objects/bookshelves.asm +++ b/engine/events/hidden_objects/bookshelves.asm @@ -24,7 +24,7 @@ PrintBookshelfText:: pop af call PrintPredefTextID xor a - ldh [hFFDB], a + ldh [hInteractedWithBookshelf], a ret .nextBookshelfEntry1 inc hl @@ -33,7 +33,7 @@ PrintBookshelfText:: jr .loop .noMatch ld a, $ff - ldh [hFFDB], a + ldh [hInteractedWithBookshelf], a farjp PrintCardKeyText INCLUDE "data/tilesets/bookshelf_tile_ids.asm" diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 69956a317..4a31ab5e4 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -28,7 +28,7 @@ PrepareOAMData:: inc e inc e ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] - ld [wd5cd], a + ld [wSpriteImageIndexBackup], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -98,7 +98,7 @@ PrepareOAMData:: push bc ld b, a - ld a, [wd5cd] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] + ld a, [wSpriteImageIndexBackup] swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index dc57d5b9c..46c29e3e0 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hFF90], a ; store Y coordinate adjusted for direction of movement + ldh [hCollidingSpriteTempYValue], a ; y adjusted for direction of movement ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1) call SetSpriteCollisionValues @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hFF91], a ; store X coordinate adjusted for direction of movement + ldh [hCollidingSpriteTempXValue], a ; x adjusted for direction of movement ld a, l add 7 @@ -103,15 +103,15 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for? ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA] - ldh a, [hFF91] + ldh a, [hCollidingSpriteTempXValue] ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED] - ldh a, [hFF90] + ldh a, [hCollidingSpriteTempYValue] ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED] xor a ; zero the loop counter .loop - ldh [hFF8F], a ; store loop counter + ldh [hCollidingSpriteOffset], a swap a ld e, a ldh a, [hCurrentSpriteOffset] @@ -155,7 +155,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ldh [hFF90], a ; store the distance between the two sprites' adjusted Y values + ldh [hCollidingSpriteTempYValue], a ; store the distance between the two sprites' adjusted Y values ; Use the carry flag set by the above subtraction to determine which sprite's ; Y coordinate is larger. This information is used later to set @@ -177,11 +177,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ldh a, [hFF90] ; a = distance between adjusted Y coordinates + ldh a, [hCollidingSpriteTempYValue] ; a = distance between adjusted Y coordinates sub b - ldh [hFF92], a ; store distance adjusted using sprite i's direction + ldh [hCollidingSpriteAdjustedDistance], a ld a, b - ldh [hFF90], a ; store 7 or 9 depending on sprite i's delta Y + ldh [hCollidingSpriteTempYValue], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -194,7 +194,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ldh a, [hFF92] ; a = distance adjusted using sprite i's direction + ldh a, [hCollidingSpriteAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .checkXDistance jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -226,7 +226,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ldh [hFF91], a ; store the distance between the two sprites' adjusted X values + ldh [hCollidingSpriteTempXValue], a ; store the distance between the two sprites' adjusted X values ; Use the carry flag set by the above subtraction to determine which sprite's ; X coordinate is larger. This information is used later to set @@ -248,11 +248,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ldh a, [hFF91] ; a = distance between adjusted X coordinates + ldh a, [hCollidingSpriteTempXValue] ; a = distance between adjusted X coordinates sub b - ldh [hFF92], a ; store distance adjusted using sprite i's direction + ldh [hCollidingSpriteAdjustedDistance], a ld a, b - ldh [hFF91], a ; store 7 or 9 depending on sprite i's delta X + ldh [hCollidingSpriteTempXValue], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -265,15 +265,15 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ldh a, [hFF92] ; a = distance adjusted using sprite i's direction + ldh a, [hCollidingSpriteAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .collision jr nc, .next ; go to next sprite if distance is still positive after both adjustments .collision - ldh a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X + ldh a, [hCollidingSpriteTempXValue] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ldh a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y + ldh a, [hCollidingSpriteTempYValue] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. @@ -296,7 +296,7 @@ DetectCollisionBetweenSprites: ; to indicate which sprite the collision occurred with inc l inc l - ldh a, [hFF8F] ; a = loop counter + ldh a, [hCollidingSpriteOffset] ld de, SpriteCollisionBitTable add a add e @@ -313,7 +313,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ldh a, [hFF8F] ; a = loop counter + ldh a, [hCollidingSpriteOffset] inc a cp $10 jp nz, .loop diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm index 6e7d980a7..2e3510b04 100644 --- a/home/hidden_objects.asm +++ b/home/hidden_objects.asm @@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: jr .done .hiddenObjectNotFound farcall PrintBookshelfText - ldh a, [hFFDB] + ldh a, [hInteractedWithBookshelf] and a jr z, .done .nothingFound diff --git a/ram/hram.asm b/ram/hram.asm index 0607a4843..72e9e13a2 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -85,10 +85,10 @@ hSpriteScreenX:: db hSpriteScreenY:: db NEXTU -hFF8F:: db -hFF90:: db -hFF91:: db -hFF92:: db +hCollidingSpriteOffset:: db +hCollidingSpriteTempYValue:: db +hCollidingSpriteTempXValue:: db +hCollidingSpriteAdjustedDistance:: db ENDU hTilePlayerStandingOn:: db @@ -327,11 +327,8 @@ hItemCounter:: hSavedCoordIndex:: hMissableObjectIndex:: hGymTrashCanRandNumMask:: +hInteractedWithBookshelf:: db - -NEXTU -hFFDB:: db -hFFDC:: db ENDU ds 1 diff --git a/ram/wram.asm b/ram/wram.asm index 753a96782..8c246b8a6 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1914,7 +1914,7 @@ wMissableObjectFlagsEnd:: ds 7 ; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) -wd5cd:: db +wSpriteImageIndexBackup:: db ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) From b066d3c9bc02cf4213173538d148cfabcc7212a8 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 17:53:19 -0500 Subject: [PATCH 02/16] Add `bigdw` and `dc` data macros --- engine/battle/animations.asm | 54 +++++++++++++------------- engine/battle/battle_transitions.asm | 24 ++++++------ engine/battle/scale_sprites.asm | 21 ++-------- engine/movie/credits.asm | 8 ++-- engine/movie/oak_speech/oak_speech.asm | 12 +++--- engine/overworld/sprite_collisions.asm | 19 ++------- home/fade.asm | 18 ++++----- macros/data.asm | 11 ++++++ 8 files changed, 76 insertions(+), 91 deletions(-) diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index fcfec14d3..712958bcb 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -976,7 +976,7 @@ AnimationFlashScreenLong: push hl .innerLoop ld a, [hli] - cp $01 ; is it the end of the palettes? + cp 1 jr z, .endOfPalettes ldh [rBGP], a call FlashScreenLongDelay @@ -992,35 +992,35 @@ AnimationFlashScreenLong: ; BG palettes FlashScreenLongMonochrome: - db %11111001 ; 3, 3, 2, 1 - db %11111110 ; 3, 3, 3, 2 - db %11111111 ; 3, 3, 3, 3 - db %11111110 ; 3, 3, 3, 2 - db %11111001 ; 3, 3, 2, 1 - db %11100100 ; 3, 2, 1, 0 - db %10010000 ; 2, 1, 0, 0 - db %01000000 ; 1, 0, 0, 0 - db %00000000 ; 0, 0, 0, 0 - db %01000000 ; 1, 0, 0, 0 - db %10010000 ; 2, 1, 0, 0 - db %11100100 ; 3, 2, 1, 0 - db $01 ; terminator + dc 3, 3, 2, 1 + dc 3, 3, 3, 2 + dc 3, 3, 3, 3 + dc 3, 3, 3, 2 + dc 3, 3, 2, 1 + dc 3, 2, 1, 0 + dc 2, 1, 0, 0 + dc 1, 0, 0, 0 + dc 0, 0, 0, 0 + dc 1, 0, 0, 0 + dc 2, 1, 0, 0 + dc 3, 2, 1, 0 + db 1 ; end ; BG palettes FlashScreenLongSGB: - db %11111000 ; 3, 3, 2, 0 - db %11111100 ; 3, 3, 3, 0 - db %11111111 ; 3, 3, 3, 3 - db %11111100 ; 3, 3, 3, 0 - db %11111000 ; 3, 3, 2, 0 - db %11100100 ; 3, 2, 1, 0 - db %10010000 ; 2, 1, 0, 0 - db %01000000 ; 1, 0, 0, 0 - db %00000000 ; 0, 0, 0, 0 - db %01000000 ; 1, 0, 0, 0 - db %10010000 ; 2, 1, 0, 0 - db %11100100 ; 3, 2, 1, 0 - db $01 ; terminator + dc 3, 3, 2, 0 + dc 3, 3, 3, 0 + dc 3, 3, 3, 3 + dc 3, 3, 3, 0 + dc 3, 3, 2, 0 + dc 3, 2, 1, 0 + dc 2, 1, 0, 0 + dc 1, 0, 0, 0 + dc 0, 0, 0, 0 + dc 1, 0, 0, 0 + dc 2, 1, 0, 0 + dc 3, 2, 1, 0 + db 1 ; end ; causes a delay of 2 frames for the first cycle ; causes a delay of 1 frame for the second and third cycles diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index a16fd2504..363533cec 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -335,18 +335,18 @@ BattleTransition_FlashScreen_: ret BattleTransition_FlashScreenPalettes: - db %11111001 - db %11111110 - db %11111111 - db %11111110 - db %11111001 - db %11100100 - db %10010000 - db %01000000 - db %00000000 - db %01000000 - db %10010000 - db %11100100 + dc 3, 3, 2, 1 + dc 3, 3, 3, 2 + dc 3, 3, 3, 3 + dc 3, 3, 3, 2 + dc 3, 3, 2, 1 + dc 3, 2, 1, 0 + dc 2, 1, 0, 0 + dc 1, 0, 0, 0 + dc 0, 0, 0, 0 + dc 1, 0, 0, 0 + dc 2, 1, 0, 0 + dc 3, 2, 1, 0 db 1 ; end ; used for low level trainer dungeon battles diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 8b8942e68..9e24c89d2 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -77,21 +77,8 @@ ScalePixelsByTwo: add hl, bc ; add offset ret -; repeats each input bit twice +; repeats each input bit twice, e.g. DuplicateBitsTable[%0101] = %00110011 DuplicateBitsTable: - db %00000000 - db %00000011 - db %00001100 - db %00001111 - db %00110000 - db %00110011 - db %00111100 - db %00111111 - db %11000000 - db %11000011 - db %11001100 - db %11001111 - db %11110000 - db %11110011 - db %11111100 - db %11111111 +FOR n, 16 + db (n & 1) * 3 + (n & 2) * 6 + (n & 4) * 12 + (n & 8) * 24 +ENDR diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 0410de213..5f258503b 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -131,10 +131,10 @@ ScrollCreditsMonLeft_SetSCX: ret HoFGBPalettes: - db %11000000 - db %11010000 - db %11100000 - db %11110000 + dc 3, 0, 0, 0 + dc 3, 1, 0, 0 + dc 3, 2, 0, 0 + dc 3, 3, 0, 0 CreditsCopyTileMapToVRAM: ld a, l diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 4ed4735e5..3e339619b 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -192,12 +192,12 @@ FadeInIntroPic: ret IntroFadePalettes: - db %01010100 - db %10101000 - db %11111100 - db %11111000 - db %11110100 - db %11100100 + dc 1, 1, 1, 0 + dc 2, 2, 2, 0 + dc 3, 3, 3, 0 + dc 3, 3, 2, 0 + dc 3, 3, 1, 0 + dc 3, 2, 1, 0 MovePicLeft: ld a, 119 diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 46c29e3e0..ffed37083 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -340,19 +340,6 @@ SetSpriteCollisionValues: ret SpriteCollisionBitTable: - db %00000000,%00000001 - db %00000000,%00000010 - db %00000000,%00000100 - db %00000000,%00001000 - db %00000000,%00010000 - db %00000000,%00100000 - db %00000000,%01000000 - db %00000000,%10000000 - db %00000001,%00000000 - db %00000010,%00000000 - db %00000100,%00000000 - db %00001000,%00000000 - db %00010000,%00000000 - db %00100000,%00000000 - db %01000000,%00000000 - db %10000000,%00000000 +FOR n, $10 + bigdw 1 << n +ENDR diff --git a/home/fade.asm b/home/fade.asm index f5ddf9643..b67f4b1c1 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -62,12 +62,12 @@ GBFadeDecCommon: jr nz, GBFadeDecCommon ret -FadePal1:: db %11111111, %11111111, %11111111 -FadePal2:: db %11111110, %11111110, %11111000 -FadePal3:: db %11111001, %11100100, %11100100 -FadePal4:: db %11100100, %11010000, %11100000 -; rBGP rOBP0 rOBP1 -FadePal5:: db %11100100, %11010000, %11100000 -FadePal6:: db %10010000, %10000000, %10010000 -FadePal7:: db %01000000, %01000000, %01000000 -FadePal8:: db %00000000, %00000000, %00000000 +FadePal1:: dc 3,3,3,3, 3,3,3,3, 3,3,3,3 +FadePal2:: dc 3,3,3,2, 3,3,3,2, 3,3,2,0 +FadePal3:: dc 3,3,2,1, 3,2,1,0, 3,2,1,0 +FadePal4:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0 +; rBGP rOBP0 rOBP1 +FadePal5:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0 +FadePal6:: dc 2,1,0,0, 2,0,0,0, 2,1,0,0 +FadePal7:: dc 1,0,0,0, 1,0,0,0, 1,0,0,0 +FadePal8:: dc 0,0,0,0, 0,0,0,0, 0,0,0,0 diff --git a/macros/data.asm b/macros/data.asm index 5092b74ee..2e4a7ce2a 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -56,6 +56,17 @@ MACRO dn ; nybbles ENDR ENDM +MACRO dc ; "crumbs" + REPT _NARG / 4 + db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4) + SHIFT 4 + ENDR +ENDM + +MACRO bigdw ; big-endian word + db HIGH(\1), LOW(\1) +ENDM + MACRO dba ; dbw bank, address REPT _NARG dbw BANK(\1), \1 From 77887be2512b4b8af688dc4552bdb4490d35e65b Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 18:53:23 -0500 Subject: [PATCH 03/16] Identify `wSavedCoordIndex` and its other usages --- engine/gfx/sprite_oam.asm | 4 ++-- engine/items/item_effects.asm | 2 +- engine/menus/pokedex.asm | 2 +- engine/overworld/auto_movement.asm | 4 ++-- engine/overworld/movement.asm | 2 +- home/overworld.asm | 2 +- home/pathfinding.asm | 2 +- ram/wram.asm | 13 ++++++++----- scripts/FightingDojo.asm | 10 +++++----- scripts/PalletTown.asm | 8 ++++---- scripts/Route22.asm | 24 ++++++++++++------------ scripts/SafariZoneGate.asm | 18 +++++++++--------- scripts/SilphCo11F.asm | 10 +++++----- scripts/SilphCo7F.asm | 8 ++++---- scripts/VermilionCity.asm | 2 +- 15 files changed, 57 insertions(+), 54 deletions(-) diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 4a31ab5e4..8704814ff 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -28,7 +28,7 @@ PrepareOAMData:: inc e inc e ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] - ld [wSpriteImageIndexBackup], a + ld [wSavedSpriteImageIndex], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -98,7 +98,7 @@ PrepareOAMData:: push bc ld b, a - ld a, [wSpriteImageIndexBackup] + ld a, [wSavedSpriteImageIndex] swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 927f54cb0..12c7dade6 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -740,7 +740,7 @@ ItemUseSurfboard: ld a, b ld [wSimulatedJoypadStatesEnd], a xor a - ld [wWastedByteCD39], a + ld [wUnusedCD39], a inc a ld [wSimulatedJoypadStatesIndex], a ret diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 3411f7291..96bae343e 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -36,7 +36,7 @@ ShowPokedexMenu: ld [wCurrentMenuItem], a ld [wLastMenuItem], a ldh [hJoy7], a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ld [wOverrideSimulatedJoypadStatesMask], a pop af ld [wListScrollOffset], a diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index 75816886e..53b70c19a 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -17,7 +17,7 @@ PlayerStepOutFromDoor:: ret .notStandingOnDoor xor a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ld hl, wd736 @@ -39,7 +39,7 @@ _EndNPCMovementScript:: ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptFunctionNum], a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ret diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index e08da61a0..eb186f1eb 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -179,7 +179,7 @@ UpdateNPCSprite: res 0, [hl] xor a ld [wSimulatedJoypadStatesIndex], a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ret .next cp WALK diff --git a/home/overworld.asm b/home/overworld.asm index 8085f484a..885a53274 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1869,7 +1869,7 @@ JoypadOverworld:: ; if done simulating button presses .doneSimulating xor a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesEnd], a ld [wJoyIgnore], a diff --git a/home/pathfinding.asm b/home/pathfinding.asm index 53f988479..77cb5c4b3 100644 --- a/home/pathfinding.asm +++ b/home/pathfinding.asm @@ -40,7 +40,7 @@ MoveSprite_:: ld [wSimulatedJoypadStatesEnd], a dec a ld [wJoyIgnore], a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ret ; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2] diff --git a/ram/wram.asm b/ram/wram.asm index 8c246b8a6..32749db37 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -576,10 +576,10 @@ wFilteredBagItemsCount:: db wSimulatedJoypadStatesIndex:: db ; written to but nothing ever reads it -wWastedByteCD39:: db +wUnusedCD39:: db ; written to but nothing ever reads it -wWastedByteCD3A:: db +wUnusedCD3A:: db ; mask indicating which real button presses can override simulated ones ; XXX is it ever not 0? @@ -979,7 +979,10 @@ wBattleResult:: db ; bit 0: if set, DisplayTextID automatically draws a text box wAutoTextBoxDrawingControl:: db -wcf0d:: db ; used with some overworld scripts (not exactly sure what it's used for) +; used in some overworld scripts to vary scripted movement +wSavedCoordIndex:: +wOakWalkedToPlayer:: +wNextSafariZoneGateScript:: db ; used in CheckForTilePairCollisions2 to store the tile the player is on wTilePlayerStandingOn:: db @@ -1913,8 +1916,8 @@ wMissableObjectFlagsEnd:: ds 7 -; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) -wSpriteImageIndexBackup:: db +; saved copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) +wSavedSpriteImageIndex:: db ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index 298c2fcb6..d434f6816 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -32,15 +32,15 @@ FightingDojoDefaultScript: ret nz xor a ldh [hJoyHeld], a - ld [wcf0d], a + ld [wSavedCoordIndex], a ld a, [wYCoord] cp 3 ret nz ld a, [wXCoord] cp 4 ret nz - ld a, $1 - ld [wcf0d], a + ld a, 1 + ld [wSavedCoordIndex], a ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a ld a, FIGHTINGDOJO_KARATE_MASTER @@ -57,8 +57,8 @@ FightingDojoKarateMasterPostBattleScript: ld a, [wIsInBattle] cp $ff jp z, FightingDojoResetScripts - ld a, [wcf0d] - and a + ld a, [wSavedCoordIndex] + and a ; nz if the player was at (4, 3), left of the Karate Master jr z, .already_facing ld a, PLAYER_DIR_RIGHT ld [wPlayerMovingDirection], a diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index dd898ac61..4d5bebf0d 100644 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -45,7 +45,7 @@ PalletTownDefaultScript: PalletTownOakHeyWaitScript: xor a - ld [wcf0d], a + ld [wOakWalkedToPlayer], a ld a, TEXT_PALLETTOWN_OAK ldh [hSpriteIndexOrTextID], a call DisplayTextID @@ -96,8 +96,8 @@ PalletTownOakNotSafeComeWithMeScript: ret nz xor a ; ld a, SPRITE_FACING_DOWN ld [wSpritePlayerStateData1FacingDirection], a - ld a, 1 - ld [wcf0d], a + ld a, TRUE + ld [wOakWalkedToPlayer], a ld a, SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a ld a, TEXT_PALLETTOWN_OAK @@ -161,7 +161,7 @@ PalletTown_TextPointers: PalletTownOakText: text_asm - ld a, [wcf0d] + ld a, [wOakWalkedToPlayer] and a jr nz, .next ld a, 1 diff --git a/scripts/Route22.asm b/scripts/Route22.asm index abf6c8e4d..1e575e43f 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -38,7 +38,7 @@ Route22GetRivalTrainerNoByStarterScript: Route22MoveRivalRightScript: ld de, Route22RivalMovementData - ld a, [wcf0d] + ld a, [wSavedCoordIndex] cp $1 jr z, .skip_first_right inc de @@ -62,7 +62,7 @@ Route22DefaultScript: call ArePlayerCoordsInArray ret nc ld a, [wCoordIndex] - ld [wcf0d], a + ld [wSavedCoordIndex], a xor a ldh [hJoyHeld], a ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -107,8 +107,8 @@ Route22Rival1StartBattleScript: ld a, [wd730] bit 0, a ret nz - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords jr nz, .set_rival_facing_right ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a @@ -172,8 +172,8 @@ Route22Rival1AfterBattleScript: ld [wNewSoundID], a call PlaySound farcall Music_RivalAlternateStart - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords jr nz, .exit_movement_2 call .RivalExit1Script jr .next_script @@ -263,8 +263,8 @@ Route22Rival2StartBattleScript: ret nz ld a, ROUTE22_RIVAL2 ldh [hSpriteIndex], a - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords jr nz, .set_player_direction_left ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a @@ -307,8 +307,8 @@ Route22Rival2AfterBattleScript: jp z, Route22SetDefaultScript ld a, ROUTE22_RIVAL2 ldh [hSpriteIndex], a - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords jr nz, .set_player_direction_left ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a @@ -331,8 +331,8 @@ Route22Rival2AfterBattleScript: ld [wNewSoundID], a call PlaySound farcall Music_RivalAlternateStartAndTempo - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in Route22DefaultScript.Route22RivalBattleCoords jr nz, .exit_movement_2 call .RivalExit1Script jr .next_script diff --git a/scripts/SafariZoneGate.asm b/scripts/SafariZoneGate.asm index a0f9c1f41..14a8a79b7 100644 --- a/scripts/SafariZoneGate.asm +++ b/scripts/SafariZoneGate.asm @@ -29,14 +29,14 @@ SafariZoneGateDefaultScript: ld a, SPRITE_FACING_RIGHT ld [wSpritePlayerStateData1FacingDirection], a ld a, [wCoordIndex] - cp $1 + cp 1 ; index of second, lower entry in .PlayerNextToSafariZoneWorker1CoordsArray jr z, .player_not_next_to_worker ld a, SCRIPT_SAFARIZONEGATE_WOULD_YOU_LIKE_TO_JOIN ld [wSafariZoneGateCurScript], a ret .player_not_next_to_worker ld a, D_RIGHT - ld c, $1 + ld c, 1 call SafariZoneEntranceAutoWalk ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN ld [wJoyIgnore], a @@ -88,7 +88,7 @@ SafariZoneGateLeavingSafariScript: xor a ld [wNumSafariBalls], a ld a, D_DOWN - ld c, $3 + ld c, 3 call SafariZoneEntranceAutoWalk ld a, SCRIPT_SAFARIZONEGATE_PLAYER_MOVING_DOWN ld [wSafariZoneGateCurScript], a @@ -113,7 +113,7 @@ SafariZoneGateSetScriptAfterMoveScript: call SafariZoneGateReturnSimulatedJoypadStateScript ret nz call Delay3 - ld a, [wcf0d] + ld a, [wNextSafariZoneGateScript] ld [wSafariZoneGateCurScript], a ret @@ -236,11 +236,11 @@ SafariZoneGateSafariZoneWorker1LeavingEarlyText: xor a ld [wSpritePlayerStateData1FacingDirection], a ld a, D_DOWN - ld c, $3 + ld c, 3 call SafariZoneEntranceAutoWalk ResetEvents EVENT_SAFARI_GAME_OVER, EVENT_IN_SAFARI_ZONE - ld a, $0 - ld [wcf0d], a + ld a, SCRIPT_SAFARIZONEGATE_DEFAULT + ld [wNextSafariZoneGateScript], a jr .set_current_script .not_ready_to_leave ld hl, .GoodLuckText @@ -248,10 +248,10 @@ SafariZoneGateSafariZoneWorker1LeavingEarlyText: ld a, SPRITE_FACING_UP ld [wSpritePlayerStateData1FacingDirection], a ld a, D_UP - ld c, $1 + ld c, 1 call SafariZoneEntranceAutoWalk ld a, SCRIPT_SAFARIZONEGATE_LEAVING_SAFARI - ld [wcf0d], a + ld [wNextSafariZoneGateScript], a .set_current_script ld a, SCRIPT_SAFARIZONEGATE_SET_SCRIPT_AFTER_MOVE ld [wSafariZoneGateCurScript], a diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 1a2978a8a..778283c53 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -170,7 +170,7 @@ SilphCo11FDefaultScript: call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers ld a, [wCoordIndex] - ld [wcf0d], a + ld [wSavedCoordIndex], a xor a ldh [hJoyHeld], a ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN @@ -209,8 +209,8 @@ SilphCo11FGiovanniAfterBattleScript: ld a, [wIsInBattle] cp $ff jp z, SilphCo11FResetCurScript - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, upper-right entry in SilphCo11FDefaultScript.PlayerCoordsArray jr z, .face_player_up ld a, PLAYER_DIR_LEFT ld b, SPRITE_FACING_RIGHT @@ -242,8 +242,8 @@ SilphCo11FGiovanniBattleFacingScript: ld a, SILPHCO11F_GIOVANNI ldh [hSpriteIndex], a call SetSpriteMovementBytesToFF - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, upper-right entry in SilphCo11FDefaultScript.PlayerCoordsArray jr z, .face_player_up ld a, PLAYER_DIR_LEFT ld b, SPRITE_FACING_RIGHT diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index c6afd27a4..bfa788473 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -145,8 +145,8 @@ SilphCo7FDefaultScript: call SetSpriteMovementBytesToFF ld de, .RivalMovementUp ld a, [wCoordIndex] - ld [wcf0d], a - cp $1 + ld [wSavedCoordIndex], a + cp 1 ; index of second, lower entry in .RivalEncounterCoordinates jr z, .full_rival_movement inc de .full_rival_movement @@ -225,8 +225,8 @@ SilphCo7FRivalAfterBattleScript: call PlaySound farcall Music_RivalAlternateStart ld de, .RivalWalkAroundPlayerMovement - ld a, [wcf0d] - cp $1 + ld a, [wSavedCoordIndex] + cp 1 ; index of second, lower entry in SilphCo7FDefaultScript.RivalEncounterCoordinates jr nz, .walk_around_player ld de, .RivalExitRightMovement .walk_around_player diff --git a/scripts/VermilionCity.asm b/scripts/VermilionCity.asm index 4c8a0b18a..9d8002334 100644 --- a/scripts/VermilionCity.asm +++ b/scripts/VermilionCity.asm @@ -47,7 +47,7 @@ VermilionCityDefaultScript: ret nc xor a ldh [hJoyHeld], a - ld [wcf0d], a + ld [wSavedCoordIndex], a ; unnecessary ld a, TEXT_VERMILIONCITY_SAILOR1 ldh [hSpriteIndexOrTextID], a call DisplayTextID From e8868d53e929e451c699a2ee491569d49fd9050a Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 19:05:09 -0500 Subject: [PATCH 04/16] Have palfix.py always output grayscale Fixes #431 --- tools/palfix.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/palfix.py b/tools/palfix.py index e78419586..3a997d544 100755 --- a/tools/palfix.py +++ b/tools/palfix.py @@ -4,10 +4,9 @@ """ Usage: python palfix.py image.png -Fix the palette format of the input image. Colored images (Gen 2 Pokémon or -trainer sprites) will become indexed, with a palette sorted {white, light -color, dark color, black}. Grayscale images (all Gen 1 images) will become -two-bit grayscale. +Fix the palette format of the input image to two-bit grayscale. +Colored images will have their palette sorted {white, light +color, dark color, black}. """ import sys @@ -18,10 +17,6 @@ def rgb8_to_rgb5(c): r, g, b = c return (r // 8, g // 8, b // 8) -def rgb5_to_rgb8(c): - r, g, b = c - return (r * 8 + r // 4, g * 8 + g // 4, b * 8 + b // 4) - def invert(c): r, g, b = c return (31 - r, 31 - g, 31 - b) @@ -33,10 +28,6 @@ def luminance(c): def rgb5_pixels(row): yield from (rgb8_to_rgb5(row[x:x+3]) for x in range(0, len(row), 4)) -def is_grayscale(palette): - return (palette == ((31, 31, 31), (21, 21, 21), (10, 10, 10), (0, 0, 0)) or - palette == ((31, 31, 31), (20, 20, 20), (10, 10, 10), (0, 0, 0))) - def fix_pal(filename): with open(filename, 'rb') as file: width, height, rows = png.Reader(file).asRGBA8()[:3] @@ -52,13 +43,8 @@ def fix_pal(filename): return False palette = tuple(sorted(colors | b_and_w, key=luminance, reverse=True)) assert len(palette) == 4 - rows = [list(map(palette.index, rgb5_pixels(row))) for row in rows] - if is_grayscale(palette): - rows = [[3 - c for c in row] for row in rows] - writer = png.Writer(width, height, greyscale=True, bitdepth=2, compression=9) - else: - palette = tuple(map(rgb5_to_rgb8, palette)) - writer = png.Writer(width, height, palette=palette, bitdepth=8, compression=9) + rows = [[3 - palette.index(c) for c in rgb5_pixels(row)] for row in rows] + writer = png.Writer(width, height, greyscale=True, bitdepth=2, compression=9) with open(filename, 'wb') as file: writer.write(file, rows) return True From 100e0a76fb338d994f4a6f99c4967f22e425299e Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 19:25:49 -0500 Subject: [PATCH 05/16] List unidentified labels in Discord webhook --- .github/webhook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/webhook.sh b/.github/webhook.sh index ce454a499..2ba63dbbf 100755 --- a/.github/webhook.sh +++ b/.github/webhook.sh @@ -2,7 +2,7 @@ set -e # Report unnamed symbols -content="$(tools/unnamed.py -r . pokered.sym | head)" +content="$(tools/unnamed.py -r . -l 30 pokered.sym | head)" curl -H 'Content-Type: application/json' -X POST "$DISCORD_WEBHOOK_URL" -d@- << EOF { From d3e713f6c6d8cea16dfbae0f10801903eed3ec27 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Mon, 20 Nov 2023 21:03:38 -0600 Subject: [PATCH 06/16] Fix event check --- scripts/OaksLab.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 30ee93ed6..9173dd946 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -771,7 +771,7 @@ OaksLabRivalText: call PrintText jr .done .beforeChooseMon - bit 2, a + CheckEventReuseA EVENT_GOT_STARTER jr nz, .afterChooseMon ld hl, .GoAheadAndChooseText call PrintText From 66b6c5197140dfc966bad951c70796b33ae9edae Mon Sep 17 00:00:00 2001 From: Rotekoppen Date: Tue, 21 Nov 2023 23:52:04 +0100 Subject: [PATCH 07/16] Update install instructions for Arch Linux RGBDS is now available in the official repos as community/rgbds --- INSTALL.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index e0204866a..a5c7efb5a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -101,11 +101,9 @@ Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building To install the software required for **pokered**: ```bash -sudo pacman -S make gcc git +sudo pacman -S make gcc git rgbds ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Arch Linux to install **rgbds 0.6.1**. - If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.1** from source. ### Termux From 9827190aea7ce6a6f30d6a0c04eda34934cbd35e Mon Sep 17 00:00:00 2001 From: BlueZangoose <113498143+BlueZangoose@users.noreply.github.com> Date: Wed, 22 Nov 2023 00:52:53 +0000 Subject: [PATCH 08/16] Use MEGA_PUNCH constant in explosion animation routine (#434) * Use MEGA_PUNCH constant in explosion animation routine * Add AnimationType constants and assert --------- Co-authored-by: vulcandth --- constants/battle_anim_constants.asm | 8 ++++++++ engine/battle/core.asm | 14 ++++++++------ engine/battle/effects.asm | 4 ++-- includes.asm | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 constants/battle_anim_constants.asm diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm new file mode 100644 index 000000000..db57d6c4f --- /dev/null +++ b/constants/battle_anim_constants.asm @@ -0,0 +1,8 @@ +; AnimationTypePointerTable indexes (see engine/battle/animations.asm) + const_def 1 + const ANIMATIONTYPE_SHAKE_SCREEN_VERTICALLY ; 1 + const ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_HEAVY ; 2 + const ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_SLOW ; 3 + const ANIMATIONTYPE_BLINK_ENEMY_MON_SPRITE ; 4 + const ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT ; 5 + const ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_SLOW_2 ; 6 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index f976674a4..19ebdfcfa 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3154,9 +3154,9 @@ handleIfPlayerMoveMissed: getPlayerAnimationType: ld a, [wPlayerMoveEffect] and a - ld a, 4 ; move has no effect other than dealing damage + ld a, ANIMATIONTYPE_BLINK_ENEMY_MON_SPRITE ; move has no effect other than dealing damage jr z, playPlayerMoveAnimation - ld a, 5 ; move has effect + ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT ; move has effect playPlayerMoveAnimation: push af ld a, [wPlayerBattleStatus2] @@ -5681,9 +5681,9 @@ handleIfEnemyMoveMissed: GetEnemyAnimationType: ld a, [wEnemyMoveEffect] and a - ld a, $1 + ld a, ANIMATIONTYPE_SHAKE_SCREEN_VERTICALLY jr z, playEnemyMoveAnimation - ld a, $2 + ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_HEAVY jr playEnemyMoveAnimation handleExplosionMiss: call SwapPlayerAndEnemyLevels @@ -6752,9 +6752,11 @@ HandleExplodingAnimation: ld a, [wMoveMissed] and a ret nz - ld a, 5 + ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT ld [wAnimationType], a - + assert ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT == MEGA_PUNCH + ; ld a, MEGA_PUNCH +; fallthrough PlayMoveAnimation: ld [wAnimationID], a vc_hook_red Reduce_move_anim_flashing_Confusion diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index e89d19f3e..b94b12d22 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1460,9 +1460,9 @@ PlayBattleAnimation2: ld [wAnimationID], a ldh a, [hWhoseTurn] and a - ld a, $6 + ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_SLOW_2 jr z, .storeAnimationType - ld a, $3 + ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_SLOW .storeAnimationType ld [wAnimationType], a jp PlayBattleAnimationGotID diff --git a/includes.asm b/includes.asm index 271828b95..6253859b6 100644 --- a/includes.asm +++ b/includes.asm @@ -23,6 +23,7 @@ INCLUDE "constants/serial_constants.asm" INCLUDE "constants/script_constants.asm" INCLUDE "constants/type_constants.asm" INCLUDE "constants/battle_constants.asm" +INCLUDE "constants/battle_anim_constants.asm" INCLUDE "constants/move_constants.asm" INCLUDE "constants/move_animation_constants.asm" INCLUDE "constants/move_effect_constants.asm" From a681f718ac0fa6077c45ad793968a8f0cbfb93c7 Mon Sep 17 00:00:00 2001 From: SatoMew Date: Wed, 22 Nov 2023 00:54:39 +0000 Subject: [PATCH 09/16] Rename `EV_*` constants to `EVOLVE_*` like pokecrystal (#407) --- constants/pokemon_data_constants.asm | 6 +- data/pokemon/evos_moves.asm | 144 +++++++++++++-------------- engine/menus/party_menu.asm | 2 +- engine/pokemon/evos_moves.asm | 6 +- 4 files changed, 79 insertions(+), 79 deletions(-) diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 028d67113..3c594ae1b 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -79,9 +79,9 @@ DEF HOF_TEAM_CAPACITY EQU 50 ; Evolution types const_def 1 - const EV_LEVEL ; 1 - const EV_ITEM ; 2 - const EV_TRADE ; 3 + const EVOLVE_LEVEL ; 1 + const EVOLVE_ITEM ; 2 + const EVOLVE_TRADE ; 3 DEF MAX_EVOLUTIONS EQU 3 DEF EVOLUTION_SIZE EQU 4 diff --git a/data/pokemon/evos_moves.asm b/data/pokemon/evos_moves.asm index c5fcc2927..a555579e1 100644 --- a/data/pokemon/evos_moves.asm +++ b/data/pokemon/evos_moves.asm @@ -220,7 +220,7 @@ KangaskhanEvosMoves: NidoranMEvosMoves: ; Evolutions - db EV_LEVEL, 16, NIDORINO + db EVOLVE_LEVEL, 16, NIDORINO db 0 ; Learnset db 8, HORN_ATTACK @@ -233,7 +233,7 @@ NidoranMEvosMoves: ClefairyEvosMoves: ; Evolutions - db EV_ITEM, MOON_STONE, 1, CLEFABLE + db EVOLVE_ITEM, MOON_STONE, 1, CLEFABLE db 0 ; Learnset db 13, SING @@ -246,7 +246,7 @@ ClefairyEvosMoves: SpearowEvosMoves: ; Evolutions - db EV_LEVEL, 20, FEAROW + db EVOLVE_LEVEL, 20, FEAROW db 0 ; Learnset db 9, LEER @@ -258,7 +258,7 @@ SpearowEvosMoves: VoltorbEvosMoves: ; Evolutions - db EV_LEVEL, 30, ELECTRODE + db EVOLVE_LEVEL, 30, ELECTRODE db 0 ; Learnset db 17, SONICBOOM @@ -292,7 +292,7 @@ SlowbroEvosMoves: IvysaurEvosMoves: ; Evolutions - db EV_LEVEL, 32, VENUSAUR + db EVOLVE_LEVEL, 32, VENUSAUR db 0 ; Learnset db 7, LEECH_SEED @@ -324,7 +324,7 @@ LickitungEvosMoves: ExeggcuteEvosMoves: ; Evolutions - db EV_ITEM, LEAF_STONE, 1, EXEGGUTOR + db EVOLVE_ITEM, LEAF_STONE, 1, EXEGGUTOR db 0 ; Learnset db 25, REFLECT @@ -337,7 +337,7 @@ ExeggcuteEvosMoves: GrimerEvosMoves: ; Evolutions - db EV_LEVEL, 38, MUK + db EVOLVE_LEVEL, 38, MUK db 0 ; Learnset db 30, POISON_GAS @@ -358,7 +358,7 @@ GengarEvosMoves: NidoranFEvosMoves: ; Evolutions - db EV_LEVEL, 16, NIDORINA + db EVOLVE_LEVEL, 16, NIDORINA db 0 ; Learnset db 8, SCRATCH @@ -380,7 +380,7 @@ NidoqueenEvosMoves: CuboneEvosMoves: ; Evolutions - db EV_LEVEL, 28, MAROWAK + db EVOLVE_LEVEL, 28, MAROWAK db 0 ; Learnset db 25, LEER @@ -392,7 +392,7 @@ CuboneEvosMoves: RhyhornEvosMoves: ; Evolutions - db EV_LEVEL, 42, RHYDON + db EVOLVE_LEVEL, 42, RHYDON db 0 ; Learnset db 30, STOMP @@ -444,7 +444,7 @@ GyaradosEvosMoves: ShellderEvosMoves: ; Evolutions - db EV_ITEM, WATER_STONE, 1, CLOYSTER + db EVOLVE_ITEM, WATER_STONE, 1, CLOYSTER db 0 ; Learnset db 18, SUPERSONIC @@ -456,7 +456,7 @@ ShellderEvosMoves: TentacoolEvosMoves: ; Evolutions - db EV_LEVEL, 30, TENTACRUEL + db EVOLVE_LEVEL, 30, TENTACRUEL db 0 ; Learnset db 7, SUPERSONIC @@ -471,7 +471,7 @@ TentacoolEvosMoves: GastlyEvosMoves: ; Evolutions - db EV_LEVEL, 25, HAUNTER + db EVOLVE_LEVEL, 25, HAUNTER db 0 ; Learnset db 27, HYPNOSIS @@ -492,7 +492,7 @@ ScytherEvosMoves: StaryuEvosMoves: ; Evolutions - db EV_ITEM, WATER_STONE, 1, STARMIE + db EVOLVE_ITEM, WATER_STONE, 1, STARMIE db 0 ; Learnset db 17, WATER_GUN @@ -554,7 +554,7 @@ MissingNo20EvosMoves: GrowlitheEvosMoves: ; Evolutions - db EV_ITEM, FIRE_STONE, 1, ARCANINE + db EVOLVE_ITEM, FIRE_STONE, 1, ARCANINE db 0 ; Learnset db 18, EMBER @@ -588,7 +588,7 @@ FearowEvosMoves: PidgeyEvosMoves: ; Evolutions - db EV_LEVEL, 18, PIDGEOTTO + db EVOLVE_LEVEL, 18, PIDGEOTTO db 0 ; Learnset db 5, SAND_ATTACK @@ -601,7 +601,7 @@ PidgeyEvosMoves: SlowpokeEvosMoves: ; Evolutions - db EV_LEVEL, 37, SLOWBRO + db EVOLVE_LEVEL, 37, SLOWBRO db 0 ; Learnset db 18, DISABLE @@ -614,7 +614,7 @@ SlowpokeEvosMoves: KadabraEvosMoves: ; Evolutions - db EV_TRADE, 1, ALAKAZAM + db EVOLVE_TRADE, 1, ALAKAZAM db 0 ; Learnset db 16, CONFUSION @@ -627,7 +627,7 @@ KadabraEvosMoves: GravelerEvosMoves: ; Evolutions - db EV_TRADE, 1, GOLEM + db EVOLVE_TRADE, 1, GOLEM db 0 ; Learnset db 11, DEFENSE_CURL @@ -652,7 +652,7 @@ ChanseyEvosMoves: MachokeEvosMoves: ; Evolutions - db EV_TRADE, 1, MACHAMP + db EVOLVE_TRADE, 1, MACHAMP db 0 ; Learnset db 20, LOW_KICK @@ -719,7 +719,7 @@ ParasectEvosMoves: PsyduckEvosMoves: ; Evolutions - db EV_LEVEL, 33, GOLDUCK + db EVOLVE_LEVEL, 33, GOLDUCK db 0 ; Learnset db 28, TAIL_WHIP @@ -731,7 +731,7 @@ PsyduckEvosMoves: DrowzeeEvosMoves: ; Evolutions - db EV_LEVEL, 26, HYPNO + db EVOLVE_LEVEL, 26, HYPNO db 0 ; Learnset db 12, DISABLE @@ -803,7 +803,7 @@ MagnetonEvosMoves: KoffingEvosMoves: ; Evolutions - db EV_LEVEL, 35, WEEZING + db EVOLVE_LEVEL, 35, WEEZING db 0 ; Learnset db 32, SLUDGE @@ -821,7 +821,7 @@ MissingNo38EvosMoves: MankeyEvosMoves: ; Evolutions - db EV_LEVEL, 28, PRIMEAPE + db EVOLVE_LEVEL, 28, PRIMEAPE db 0 ; Learnset db 15, KARATE_CHOP @@ -833,7 +833,7 @@ MankeyEvosMoves: SeelEvosMoves: ; Evolutions - db EV_LEVEL, 34, DEWGONG + db EVOLVE_LEVEL, 34, DEWGONG db 0 ; Learnset db 30, GROWL @@ -845,7 +845,7 @@ SeelEvosMoves: DiglettEvosMoves: ; Evolutions - db EV_LEVEL, 26, DUGTRIO + db EVOLVE_LEVEL, 26, DUGTRIO db 0 ; Learnset db 15, GROWL @@ -897,7 +897,7 @@ FarfetchdEvosMoves: VenonatEvosMoves: ; Evolutions - db EV_LEVEL, 31, VENOMOTH + db EVOLVE_LEVEL, 31, VENOMOTH db 0 ; Learnset db 24, POISONPOWDER @@ -939,7 +939,7 @@ MissingNo45EvosMoves: DoduoEvosMoves: ; Evolutions - db EV_LEVEL, 31, DODRIO + db EVOLVE_LEVEL, 31, DODRIO db 0 ; Learnset db 20, GROWL @@ -952,7 +952,7 @@ DoduoEvosMoves: PoliwagEvosMoves: ; Evolutions - db EV_LEVEL, 25, POLIWHIRL + db EVOLVE_LEVEL, 25, POLIWHIRL db 0 ; Learnset db 16, HYPNOSIS @@ -1010,7 +1010,7 @@ DittoEvosMoves: MeowthEvosMoves: ; Evolutions - db EV_LEVEL, 28, PERSIAN + db EVOLVE_LEVEL, 28, PERSIAN db 0 ; Learnset db 12, BITE @@ -1022,7 +1022,7 @@ MeowthEvosMoves: KrabbyEvosMoves: ; Evolutions - db EV_LEVEL, 28, KINGLER + db EVOLVE_LEVEL, 28, KINGLER db 0 ; Learnset db 20, VICEGRIP @@ -1052,7 +1052,7 @@ MissingNo51EvosMoves: VulpixEvosMoves: ; Evolutions - db EV_ITEM, FIRE_STONE, 1, NINETALES + db EVOLVE_ITEM, FIRE_STONE, 1, NINETALES db 0 ; Learnset db 16, QUICK_ATTACK @@ -1070,7 +1070,7 @@ NinetalesEvosMoves: PikachuEvosMoves: ; Evolutions - db EV_ITEM, THUNDER_STONE, 1, RAICHU + db EVOLVE_ITEM, THUNDER_STONE, 1, RAICHU db 0 ; Learnset db 9, THUNDER_WAVE @@ -1100,7 +1100,7 @@ MissingNo57EvosMoves: DratiniEvosMoves: ; Evolutions - db EV_LEVEL, 30, DRAGONAIR + db EVOLVE_LEVEL, 30, DRAGONAIR db 0 ; Learnset db 10, THUNDER_WAVE @@ -1112,7 +1112,7 @@ DratiniEvosMoves: DragonairEvosMoves: ; Evolutions - db EV_LEVEL, 55, DRAGONITE + db EVOLVE_LEVEL, 55, DRAGONITE db 0 ; Learnset db 10, THUNDER_WAVE @@ -1124,7 +1124,7 @@ DragonairEvosMoves: KabutoEvosMoves: ; Evolutions - db EV_LEVEL, 40, KABUTOPS + db EVOLVE_LEVEL, 40, KABUTOPS db 0 ; Learnset db 34, ABSORB @@ -1145,7 +1145,7 @@ KabutopsEvosMoves: HorseaEvosMoves: ; Evolutions - db EV_LEVEL, 32, SEADRA + db EVOLVE_LEVEL, 32, SEADRA db 0 ; Learnset db 19, SMOKESCREEN @@ -1180,7 +1180,7 @@ MissingNo5FEvosMoves: SandshrewEvosMoves: ; Evolutions - db EV_LEVEL, 22, SANDSLASH + db EVOLVE_LEVEL, 22, SANDSLASH db 0 ; Learnset db 10, SAND_ATTACK @@ -1203,7 +1203,7 @@ SandslashEvosMoves: OmanyteEvosMoves: ; Evolutions - db EV_LEVEL, 40, OMASTAR + db EVOLVE_LEVEL, 40, OMASTAR db 0 ; Learnset db 34, HORN_ATTACK @@ -1224,7 +1224,7 @@ OmastarEvosMoves: JigglypuffEvosMoves: ; Evolutions - db EV_ITEM, MOON_STONE, 1, WIGGLYTUFF + db EVOLVE_ITEM, MOON_STONE, 1, WIGGLYTUFF db 0 ; Learnset db 9, POUND @@ -1244,9 +1244,9 @@ WigglytuffEvosMoves: EeveeEvosMoves: ; Evolutions - db EV_ITEM, FIRE_STONE, 1, FLAREON - db EV_ITEM, THUNDER_STONE, 1, JOLTEON - db EV_ITEM, WATER_STONE, 1, VAPOREON + db EVOLVE_ITEM, FIRE_STONE, 1, FLAREON + db EVOLVE_ITEM, THUNDER_STONE, 1, JOLTEON + db EVOLVE_ITEM, WATER_STONE, 1, VAPOREON db 0 ; Learnset db 27, QUICK_ATTACK @@ -1299,7 +1299,7 @@ VaporeonEvosMoves: MachopEvosMoves: ; Evolutions - db EV_LEVEL, 28, MACHOKE + db EVOLVE_LEVEL, 28, MACHOKE db 0 ; Learnset db 20, LOW_KICK @@ -1311,7 +1311,7 @@ MachopEvosMoves: ZubatEvosMoves: ; Evolutions - db EV_LEVEL, 22, GOLBAT + db EVOLVE_LEVEL, 22, GOLBAT db 0 ; Learnset db 10, SUPERSONIC @@ -1323,7 +1323,7 @@ ZubatEvosMoves: EkansEvosMoves: ; Evolutions - db EV_LEVEL, 22, ARBOK + db EVOLVE_LEVEL, 22, ARBOK db 0 ; Learnset db 10, POISON_STING @@ -1335,7 +1335,7 @@ EkansEvosMoves: ParasEvosMoves: ; Evolutions - db EV_LEVEL, 24, PARASECT + db EVOLVE_LEVEL, 24, PARASECT db 0 ; Learnset db 13, STUN_SPORE @@ -1347,7 +1347,7 @@ ParasEvosMoves: PoliwhirlEvosMoves: ; Evolutions - db EV_ITEM, WATER_STONE, 1, POLIWRATH + db EVOLVE_ITEM, WATER_STONE, 1, POLIWRATH db 0 ; Learnset db 16, HYPNOSIS @@ -1368,14 +1368,14 @@ PoliwrathEvosMoves: WeedleEvosMoves: ; Evolutions - db EV_LEVEL, 7, KAKUNA + db EVOLVE_LEVEL, 7, KAKUNA db 0 ; Learnset db 0 KakunaEvosMoves: ; Evolutions - db EV_LEVEL, 10, BEEDRILL + db EVOLVE_LEVEL, 10, BEEDRILL db 0 ; Learnset db 0 @@ -1469,14 +1469,14 @@ MissingNo7AEvosMoves: CaterpieEvosMoves: ; Evolutions - db EV_LEVEL, 7, METAPOD + db EVOLVE_LEVEL, 7, METAPOD db 0 ; Learnset db 0 MetapodEvosMoves: ; Evolutions - db EV_LEVEL, 10, BUTTERFREE + db EVOLVE_LEVEL, 10, BUTTERFREE db 0 ; Learnset db 0 @@ -1568,7 +1568,7 @@ SnorlaxEvosMoves: MagikarpEvosMoves: ; Evolutions - db EV_LEVEL, 20, GYARADOS + db EVOLVE_LEVEL, 20, GYARADOS db 0 ; Learnset db 15, TACKLE @@ -1686,7 +1686,7 @@ MissingNo92EvosMoves: HaunterEvosMoves: ; Evolutions - db EV_TRADE, 1, GENGAR + db EVOLVE_TRADE, 1, GENGAR db 0 ; Learnset db 29, HYPNOSIS @@ -1695,7 +1695,7 @@ HaunterEvosMoves: AbraEvosMoves: ; Evolutions - db EV_LEVEL, 16, KADABRA + db EVOLVE_LEVEL, 16, KADABRA db 0 ; Learnset db 0 @@ -1714,7 +1714,7 @@ AlakazamEvosMoves: PidgeottoEvosMoves: ; Evolutions - db EV_LEVEL, 36, PIDGEOT + db EVOLVE_LEVEL, 36, PIDGEOT db 0 ; Learnset db 5, SAND_ATTACK @@ -1745,7 +1745,7 @@ StarmieEvosMoves: BulbasaurEvosMoves: ; Evolutions - db EV_LEVEL, 16, IVYSAUR + db EVOLVE_LEVEL, 16, IVYSAUR db 0 ; Learnset db 7, LEECH_SEED @@ -1792,7 +1792,7 @@ MissingNo9CEvosMoves: GoldeenEvosMoves: ; Evolutions - db EV_LEVEL, 33, SEAKING + db EVOLVE_LEVEL, 33, SEAKING db 0 ; Learnset db 19, SUPERSONIC @@ -1841,7 +1841,7 @@ MissingNoA2EvosMoves: PonytaEvosMoves: ; Evolutions - db EV_LEVEL, 40, RAPIDASH + db EVOLVE_LEVEL, 40, RAPIDASH db 0 ; Learnset db 30, TAIL_WHIP @@ -1866,7 +1866,7 @@ RapidashEvosMoves: RattataEvosMoves: ; Evolutions - db EV_LEVEL, 20, RATICATE + db EVOLVE_LEVEL, 20, RATICATE db 0 ; Learnset db 7, QUICK_ATTACK @@ -1887,7 +1887,7 @@ RaticateEvosMoves: NidorinoEvosMoves: ; Evolutions - db EV_ITEM, MOON_STONE, 1, NIDOKING + db EVOLVE_ITEM, MOON_STONE, 1, NIDOKING db 0 ; Learnset db 8, HORN_ATTACK @@ -1900,7 +1900,7 @@ NidorinoEvosMoves: NidorinaEvosMoves: ; Evolutions - db EV_ITEM, MOON_STONE, 1, NIDOQUEEN + db EVOLVE_ITEM, MOON_STONE, 1, NIDOQUEEN db 0 ; Learnset db 8, SCRATCH @@ -1913,7 +1913,7 @@ NidorinaEvosMoves: GeodudeEvosMoves: ; Evolutions - db EV_LEVEL, 25, GRAVELER + db EVOLVE_LEVEL, 25, GRAVELER db 0 ; Learnset db 11, DEFENSE_CURL @@ -1952,7 +1952,7 @@ MissingNoACEvosMoves: MagnemiteEvosMoves: ; Evolutions - db EV_LEVEL, 30, MAGNETON + db EVOLVE_LEVEL, 30, MAGNETON db 0 ; Learnset db 21, SONICBOOM @@ -1977,7 +1977,7 @@ MissingNoAFEvosMoves: CharmanderEvosMoves: ; Evolutions - db EV_LEVEL, 16, CHARMELEON + db EVOLVE_LEVEL, 16, CHARMELEON db 0 ; Learnset db 9, EMBER @@ -1990,7 +1990,7 @@ CharmanderEvosMoves: SquirtleEvosMoves: ; Evolutions - db EV_LEVEL, 16, WARTORTLE + db EVOLVE_LEVEL, 16, WARTORTLE db 0 ; Learnset db 8, BUBBLE @@ -2003,7 +2003,7 @@ SquirtleEvosMoves: CharmeleonEvosMoves: ; Evolutions - db EV_LEVEL, 36, CHARIZARD + db EVOLVE_LEVEL, 36, CHARIZARD db 0 ; Learnset db 9, EMBER @@ -2016,7 +2016,7 @@ CharmeleonEvosMoves: WartortleEvosMoves: ; Evolutions - db EV_LEVEL, 36, BLASTOISE + db EVOLVE_LEVEL, 36, BLASTOISE db 0 ; Learnset db 8, BUBBLE @@ -2065,7 +2065,7 @@ MonGhostEvosMoves: OddishEvosMoves: ; Evolutions - db EV_LEVEL, 21, GLOOM + db EVOLVE_LEVEL, 21, GLOOM db 0 ; Learnset db 15, POISONPOWDER @@ -2078,7 +2078,7 @@ OddishEvosMoves: GloomEvosMoves: ; Evolutions - db EV_ITEM, LEAF_STONE, 1, VILEPLUME + db EVOLVE_ITEM, LEAF_STONE, 1, VILEPLUME db 0 ; Learnset db 15, POISONPOWDER @@ -2100,7 +2100,7 @@ VileplumeEvosMoves: BellsproutEvosMoves: ; Evolutions - db EV_LEVEL, 21, WEEPINBELL + db EVOLVE_LEVEL, 21, WEEPINBELL db 0 ; Learnset db 13, WRAP @@ -2114,7 +2114,7 @@ BellsproutEvosMoves: WeepinbellEvosMoves: ; Evolutions - db EV_ITEM, LEAF_STONE, 1, VICTREEBEL + db EVOLVE_ITEM, LEAF_STONE, 1, VICTREEBEL db 0 ; Learnset db 13, WRAP diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index f77beb263..5a473ccf4 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -142,7 +142,7 @@ RedrawPartyMenu_:: jr z, .placeEvolutionStoneString ; if so, place the "NOT ABLE" string inc hl inc hl - cp EV_ITEM + cp EVOLVE_ITEM jr nz, .checkEvolutionsLoop ; if it's a stone evolution entry dec hl diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 7e41d58d2..d6b51ee50 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -67,20 +67,20 @@ Evolution_PartyMonLoop: ; loop over party mons and a ; have we reached the end of the evolution data? jr z, Evolution_PartyMonLoop ld b, a ; evolution type - cp EV_TRADE + cp EVOLVE_TRADE jr z, .checkTradeEvo ; not trade evolution ld a, [wLinkState] cp LINK_STATE_TRADING jr z, Evolution_PartyMonLoop ; if trading, go the next mon ld a, b - cp EV_ITEM + cp EVOLVE_ITEM jr z, .checkItemEvo ld a, [wForceEvolution] and a jr nz, Evolution_PartyMonLoop ld a, b - cp EV_LEVEL + cp EVOLVE_LEVEL jr z, .checkLevel .checkTradeEvo ld a, [wLinkState] From 465b859c4c75ae7a36d532cc5d8186e96cc16311 Mon Sep 17 00:00:00 2001 From: RainbowMetalPigeon <118711812+RainbowMetalPigeon@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:01:20 -0800 Subject: [PATCH 10/16] Replace some `$a` with `EFFECTIVE` (#399) --- engine/battle/core.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 19ebdfcfa..ed2c4b7a0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3076,7 +3076,7 @@ ExecutePlayerMove: ld [wMoveMissed], a ld [wMonIsDisobedient], a ld [wMoveDidntMiss], a - ld a, $a + ld a, EFFECTIVE ld [wDamageMultipliers], a ld a, [wActionResultOrTookBattleTurn] and a ; has the player already used the turn (e.g. by using an item, trying to run or switching pokemon) @@ -5602,7 +5602,7 @@ ExecuteEnemyMove: xor a ld [wMoveMissed], a ld [wMoveDidntMiss], a - ld a, $a + ld a, EFFECTIVE ld [wDamageMultipliers], a call CheckEnemyStatusConditions jr nz, .enemyHasNoSpecialConditions From d4e7a39dd89a32c7af13fed31b3178cc769fb797 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:15:30 -0500 Subject: [PATCH 11/16] Use some more constants in place of raw numbers --- constants/battle_constants.asm | 9 +++++++-- engine/battle/core.asm | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 2ae1cdeff..44a85e8dc 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -1,15 +1,20 @@ DEF MAX_LEVEL EQU 100 +; maximum moves known per mon DEF NUM_MOVES EQU 4 +; significant stat values +DEF BASE_STAT_LEVEL EQU 7 +DEF MAX_STAT_LEVEL EQU 13 + ; VitaminStats indexes (see data/battle/stat_names.asm) - const_def + const_def 1 const STAT_HEALTH const STAT_ATTACK const STAT_DEFENSE const STAT_SPEED const STAT_SPECIAL -DEF NUM_STATS EQU const_value +DEF NUM_STATS EQU const_value - 1 ; StatModTextStrings indexes (see data/battle/stat_mod_names.asm) const_def diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ed2c4b7a0..b93b6fa77 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -18,7 +18,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: call LoadFontTilePatterns call LoadHudAndHpBarAndStatusTilePatterns ld hl, vBGMap0 - ld bc, $400 + ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT .clearBackgroundLoop ld a, " " ld [hli], a @@ -29,9 +29,9 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; copy the work RAM tile map to VRAM hlcoord 0, 0 ld de, vBGMap0 - ld b, 18 ; number of rows + ld b, SCREEN_HEIGHT .copyRowLoop - ld c, 20 ; number of columns + ld c, SCREEN_WIDTH .copyColumnLoop ld a, [hli] ld [de], a @@ -825,7 +825,7 @@ FaintEnemyPokemon: ; the enemy mon base stats are added to stat exp, so they are halved ; the base exp (which determines normal exp) is also halved ld hl, wEnemyMonBaseStats - ld b, $7 + ld b, NUM_STATS + 2 .halveExpDataLoop srl [hl] inc hl @@ -1259,7 +1259,7 @@ SlideTrainerPicOffScreen: dec c jr nz, .columnLoop pop hl - ld de, 20 + ld de, SCREEN_WIDTH add hl, de dec b jr nz, .rowLoop @@ -4183,7 +4183,7 @@ GetDamageVarsForPlayerAttack: and a ; check for critical hit jr z, .scaleStats ; in the case of a critical hit, reset the player's attack and the enemy's defense to their base values - ld c, 3 ; defense stat + ld c, STAT_DEFENSE call GetEnemyMonStat ldh a, [hProduct + 2] ld b, a @@ -4215,7 +4215,7 @@ GetDamageVarsForPlayerAttack: and a ; check for critical hit jr z, .scaleStats ; in the case of a critical hit, reset the player's and enemy's specials to their base values - ld c, 5 ; special stat + ld c, STAT_SPECIAL call GetEnemyMonStat ldh a, [hProduct + 2] ld b, a @@ -4304,7 +4304,7 @@ GetDamageVarsForEnemyAttack: ld b, a ld c, [hl] push bc - ld c, 2 ; attack stat + ld c, STAT_ATTACK call GetEnemyMonStat ld hl, hProduct + 2 pop bc @@ -4336,7 +4336,7 @@ GetDamageVarsForEnemyAttack: ld b, a ld c, [hl] push bc - ld c, 5 ; special stat + ld c, STAT_SPECIAL call GetEnemyMonStat ld hl, hProduct + 2 pop bc @@ -4380,7 +4380,7 @@ GetDamageVarsForEnemyAttack: ret ; get stat c of enemy mon -; c: stat to get (HP=1,Attack=2,Defense=3,Speed=4,Special=5) +; c: stat to get (STAT_* constant) GetEnemyMonStat: push de push bc @@ -5287,7 +5287,7 @@ AdjustDamageForMoveType: call Multiply ld a, 10 ldh [hDivisor], a - ld b, $04 + ld b, 4 call Divide ldh a, [hQuotient + 2] ld [hli], a @@ -5315,7 +5315,6 @@ AdjustDamageForMoveType: ; this doesn't take into account the effects that dual types can have ; (e.g. 4x weakness / resistance, weaknesses and resistances canceling) ; the result is stored in [wTypeEffectiveness] -; ($05 is not very effective, $10 is neutral, $14 is super effective) ; as far is can tell, this is only used once in some AI code to help decide which move to use AIGetTypeEffectiveness: ld a, [wEnemyMoveType] @@ -5324,8 +5323,10 @@ AIGetTypeEffectiveness: ld b, [hl] ; b = type 1 of player's pokemon inc hl ld c, [hl] ; c = type 2 of player's pokemon - ld a, $10 - ld [wTypeEffectiveness], a ; initialize to neutral effectiveness + ; initialize to neutral effectiveness + ; bug: this is $10 (MORE_EFFECTIVE + 1) but should be 10 (EFFECTIVE) + ld a, MORE_EFFECTIVE + 1 + ld [wTypeEffectiveness], a ld hl, TypeEffects .loop ld a, [hli] @@ -6909,7 +6910,6 @@ _InitBattleCommon: db "@" _LoadTrainerPic: -; wd033-wd034 contain pointer to pic ld a, [wTrainerPicPointer] ld e, a ld a, [wTrainerPicPointer + 1] @@ -7043,7 +7043,7 @@ LoadMonBackPic: call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite ld hl, vSprites ld de, vBackPic - ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied + ld c, (2 * SPRITEBUFFERSIZE) / 16 ; count of 16-byte chunks to be copied ldh a, [hLoadedROMBank] ld b, a jp CopyVideoData From 13079730acb01df16724d9cc11d9592bc4a10958 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:21:14 -0500 Subject: [PATCH 12/16] Rename two unused items as `ITEM_XX` like pokecrystal --- constants/item_constants.asm | 8 ++++---- data/items/key_items.asm | 4 ++-- data/items/names.asm | 6 +++--- data/items/prices.asm | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/constants/item_constants.asm b/constants/item_constants.asm index e25aadba4..a7132670c 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -28,9 +28,9 @@ const SUPER_POTION ; $13 const POTION ; $14 const BOULDERBADGE ; $15 +DEF SAFARI_BAIT EQU BOULDERBADGE ; overload const CASCADEBADGE ; $16 -DEF SAFARI_BAIT EQU $15 ; overload -DEF SAFARI_ROCK EQU $16 ; overload +DEF SAFARI_ROCK EQU CASCADEBADGE ; overload const THUNDERBADGE ; $17 const RAINBOWBADGE ; $18 const SOULBADGE ; $19 @@ -52,13 +52,13 @@ DEF SAFARI_ROCK EQU $16 ; overload const DOME_FOSSIL ; $29 const HELIX_FOSSIL ; $2A const SECRET_KEY ; $2B - const UNUSED_ITEM ; $2C "?????" + const ITEM_2C ; $2C const BIKE_VOUCHER ; $2D const X_ACCURACY ; $2E const LEAF_STONE ; $2F const CARD_KEY ; $30 const NUGGET ; $31 - const PP_UP_2 ; $32 + const ITEM_32 ; $32 const POKE_DOLL ; $33 const FULL_HEAL ; $34 const REVIVE ; $35 diff --git a/data/items/key_items.asm b/data/items/key_items.asm index b0c4b1ad3..97f5f093c 100644 --- a/data/items/key_items.asm +++ b/data/items/key_items.asm @@ -43,13 +43,13 @@ KeyItemFlags: dbit TRUE ; DOME_FOSSIL dbit TRUE ; HELIX_FOSSIL dbit TRUE ; SECRET_KEY - dbit TRUE ; UNUSED_ITEM + dbit TRUE ; ITEM_2C dbit TRUE ; BIKE_VOUCHER dbit FALSE ; X_ACCURACY dbit FALSE ; LEAF_STONE dbit TRUE ; CARD_KEY dbit FALSE ; NUGGET - dbit FALSE ; PP_UP_2 + dbit FALSE ; ITEM_32 dbit FALSE ; POKE_DOLL dbit FALSE ; FULL_HEAL dbit FALSE ; REVIVE diff --git a/data/items/names.asm b/data/items/names.asm index af51446b5..44a21c38a 100644 --- a/data/items/names.asm +++ b/data/items/names.asm @@ -6,7 +6,7 @@ ItemNames:: li "POKé BALL" li "TOWN MAP" li "BICYCLE" - li "?????" + li "?????" ; SURFBOARD li "SAFARI BALL" li "POKéDEX" li "MOON STONE" @@ -43,13 +43,13 @@ ItemNames:: li "DOME FOSSIL" li "HELIX FOSSIL" li "SECRET KEY" - li "?????" + li "?????" ; ITEM_2C li "BIKE VOUCHER" li "X ACCURACY" li "LEAF STONE" li "CARD KEY" li "NUGGET" - li "PP UP" + li "PP UP" ; ITEM_32 li "POKé DOLL" li "FULL HEAL" li "REVIVE" diff --git a/data/items/prices.asm b/data/items/prices.asm index 6c1c2891c..d01c0b7e3 100644 --- a/data/items/prices.asm +++ b/data/items/prices.asm @@ -43,13 +43,13 @@ ItemPrices:: bcd3 0 ; DOME_FOSSIL bcd3 0 ; HELIX_FOSSIL bcd3 0 ; SECRET_KEY - bcd3 0 ; XXX + bcd3 0 ; ITEM_2C bcd3 0 ; BIKE_VOUCHER bcd3 950 ; X_ACCURACY bcd3 2100 ; LEAF_STONE bcd3 0 ; CARD_KEY bcd3 10000 ; NUGGET - bcd3 9800 ; XXX PP_UP + bcd3 9800 ; ITEM_32 bcd3 1000 ; POKE_DOLL bcd3 600 ; FULL_HEAL bcd3 1500 ; REVIVE From 0a616ae5606031ce27b4c987ae0e1d9da511cec9 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:33:03 -0500 Subject: [PATCH 13/16] Get rid of wEvosMoves, MAX_EVOLUTIONS, and EVOLUTION_SIZE Fixes #430 --- constants/pokemon_data_constants.asm | 3 --- data/pokemon/evos_moves.asm | 11 +++++++++-- engine/menus/party_menu.asm | 10 +++++----- ram/wram.asm | 4 ---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 3c594ae1b..5cc2d3449 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -83,9 +83,6 @@ DEF HOF_TEAM_CAPACITY EQU 50 const EVOLVE_ITEM ; 2 const EVOLVE_TRADE ; 3 -DEF MAX_EVOLUTIONS EQU 3 -DEF EVOLUTION_SIZE EQU 4 - ; wMonHGrowthRate values ; GrowthRateTable indexes (see data/growth_rates.asm) diff --git a/data/pokemon/evos_moves.asm b/data/pokemon/evos_moves.asm index a555579e1..d900dde69 100644 --- a/data/pokemon/evos_moves.asm +++ b/data/pokemon/evos_moves.asm @@ -1,5 +1,12 @@ -; See constants/pokemon_data_constants.asm -; The max number of evolutions per monster is MAX_EVOLUTIONS +; Evos+moves data structure: +; - Evolution methods: +; * db EVOLVE_LEVEL, level, species +; * db EVOLVE_ITEM, used item, min level (1), species +; * db EVOLVE_TRADE, min level (1), species +; - db 0 ; no more evolutions +; - Learnset (in increasing level order): +; * db level, move +; - db 0 ; no more level-up moves EvosMovesPointerTable: table_width 2, EvosMovesPointerTable diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 5a473ccf4..46b828eb4 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -121,19 +121,19 @@ RedrawPartyMenu_:: rl b ld c, a add hl, bc - ld de, wEvosMoves + ld de, wcd6d ld a, BANK(EvosMovesPointerTable) ld bc, 2 call FarCopyData - ld hl, wEvosMoves + ld hl, wcd6d ld a, [hli] ld h, [hl] ld l, a - ld de, wEvosMoves + ld de, wcd6d ld a, BANK(EvosMovesPointerTable) - ld bc, wEvosMovesEnd - wEvosMoves + ld bc, 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator call FarCopyData - ld hl, wEvosMoves + ld hl, wcd6d ld de, .notAbleToEvolveText ; loop through the pokemon's evolution entries .checkEvolutionsLoop diff --git a/ram/wram.asm b/ram/wram.asm index 32749db37..82a5f14cd 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -886,10 +886,6 @@ wNumMovesMinusOne:: db UNION wcd6d:: ds NAME_BUFFER_LENGTH ; buffer for various data -NEXTU -wEvosMoves:: ds MAX_EVOLUTIONS * EVOLUTION_SIZE + 1 -wEvosMovesEnd:: - NEXTU ds 4 ; temp variable used to print a move's current PP on the status screen From 41ec74e1f0481ec995a5ad9e9dd73e7ad91c181f Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:36:00 -0500 Subject: [PATCH 14/16] Fix inaccurate comment in UpdateNPCSprite Fixes #404 --- engine/overworld/movement.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index eb186f1eb..fd26f9cbb 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -129,7 +129,7 @@ UpdateNPCSprite: and a jp z, InitializeSpriteStatus call CheckSpriteAvailability - ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking + ret c ; don't do anything if sprite is invisible ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] ld l, a @@ -148,7 +148,7 @@ UpdateNPCSprite: jp z, UpdateSpriteInWalkingAnimation ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] == 3 ld a, [wWalkCounter] and a - ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) + ret nz ; don't do anything yet if player is currently moving call InitializeSpriteScreenPosition ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] From a247120ac115c7c7f48d487dbaf9aaaf26e18757 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 21 Nov 2023 20:18:04 -0600 Subject: [PATCH 15/16] Fix a few usages of EFFECTIVE --- engine/battle/core.asm | 3 +-- engine/battle/display_effectiveness.asm | 2 +- engine/overworld/sprite_collisions.asm | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b93b6fa77..ca3294b81 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -5324,8 +5324,7 @@ AIGetTypeEffectiveness: inc hl ld c, [hl] ; c = type 2 of player's pokemon ; initialize to neutral effectiveness - ; bug: this is $10 (MORE_EFFECTIVE + 1) but should be 10 (EFFECTIVE) - ld a, MORE_EFFECTIVE + 1 + ld a, $10 ; bug: should be EFFECTIVE (10) ld [wTypeEffectiveness], a ld hl, TypeEffects .loop diff --git a/engine/battle/display_effectiveness.asm b/engine/battle/display_effectiveness.asm index b23695cf8..2879f8473 100644 --- a/engine/battle/display_effectiveness.asm +++ b/engine/battle/display_effectiveness.asm @@ -1,7 +1,7 @@ DisplayEffectiveness: ld a, [wDamageMultipliers] and $7F - cp $0A + cp EFFECTIVE ret z ld hl, SuperEffectiveText jr nc, .done diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index ffed37083..e6d894802 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -1,5 +1,5 @@ _UpdateSprites:: - ld h, $c1 + ld h, HIGH(wSpriteStateData1) inc h ld a, SPRITESTATEDATA2_IMAGEBASEOFFSET .spriteLoop From 3c768716001b6ee92e33458b4af5c2689dd35472 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 21 Nov 2023 20:25:12 -0600 Subject: [PATCH 16/16] Fix some map text constants --- data/maps/objects/FightingDojo.asm | 10 +++++----- data/maps/objects/PewterNidoranHouse.asm | 6 +++--- data/maps/objects/Route18.asm | 10 +++++----- data/maps/objects/SSAnneB1FRooms.asm | 6 +++--- scripts/Route18.asm | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/data/maps/objects/FightingDojo.asm b/data/maps/objects/FightingDojo.asm index 9d364a46d..daf1112c1 100644 --- a/data/maps/objects/FightingDojo.asm +++ b/data/maps/objects/FightingDojo.asm @@ -17,11 +17,11 @@ FightingDojo_Object: def_bg_events def_object_events - object_event 5, 3, SPRITE_HIKER, STAY, DOWN, 1, OPP_BLACKBELT, TEXT_FIGHTINGDOJO_KARATE_MASTER - object_event 3, 4, SPRITE_HIKER, STAY, RIGHT, 2, OPP_BLACKBELT, TEXT_FIGHTINGDOJO_BLACKBELT1 - object_event 3, 6, SPRITE_HIKER, STAY, RIGHT, 3, OPP_BLACKBELT, TEXT_FIGHTINGDOJO_BLACKBELT2 - object_event 5, 5, SPRITE_HIKER, STAY, LEFT, 4, OPP_BLACKBELT, TEXT_FIGHTINGDOJO_BLACKBELT3 - object_event 5, 7, SPRITE_HIKER, STAY, LEFT, 5, OPP_BLACKBELT, TEXT_FIGHTINGDOJO_BLACKBELT4 + object_event 5, 3, SPRITE_HIKER, STAY, DOWN, TEXT_FIGHTINGDOJO_KARATE_MASTER, OPP_BLACKBELT, 1 + object_event 3, 4, SPRITE_HIKER, STAY, RIGHT, TEXT_FIGHTINGDOJO_BLACKBELT1, OPP_BLACKBELT, 2 + object_event 3, 6, SPRITE_HIKER, STAY, RIGHT, TEXT_FIGHTINGDOJO_BLACKBELT2, OPP_BLACKBELT, 3 + object_event 5, 5, SPRITE_HIKER, STAY, LEFT, TEXT_FIGHTINGDOJO_BLACKBELT3, OPP_BLACKBELT, 4 + object_event 5, 7, SPRITE_HIKER, STAY, LEFT, TEXT_FIGHTINGDOJO_BLACKBELT4, OPP_BLACKBELT, 5 object_event 4, 1, SPRITE_POKE_BALL, STAY, NONE, TEXT_FIGHTINGDOJO_HITMONLEE_POKE_BALL object_event 5, 1, SPRITE_POKE_BALL, STAY, NONE, TEXT_FIGHTINGDOJO_HITMONCHAN_POKE_BALL diff --git a/data/maps/objects/PewterNidoranHouse.asm b/data/maps/objects/PewterNidoranHouse.asm index 15419cba7..8065c1485 100644 --- a/data/maps/objects/PewterNidoranHouse.asm +++ b/data/maps/objects/PewterNidoranHouse.asm @@ -13,8 +13,8 @@ PewterNidoranHouse_Object: def_bg_events def_object_events - object_event 4, 5, SPRITE_MONSTER, STAY, LEFT, PEWTERNIDORANHOUSE_NIDORAN - object_event 3, 5, SPRITE_LITTLE_BOY, STAY, RIGHT, PEWTERNIDORANHOUSE_LITTLE_BOY - object_event 1, 2, SPRITE_MIDDLE_AGED_MAN, STAY, NONE, PEWTERNIDORANHOUSE_MIDDLE_AGED_MAN + object_event 4, 5, SPRITE_MONSTER, STAY, LEFT, TEXT_PEWTERNIDORANHOUSE_NIDORAN + object_event 3, 5, SPRITE_LITTLE_BOY, STAY, RIGHT, TEXT_PEWTERNIDORANHOUSE_LITTLE_BOY + object_event 1, 2, SPRITE_MIDDLE_AGED_MAN, STAY, NONE, TEXT_PEWTERNIDORANHOUSE_MIDDLE_AGED_MAN def_warps_to PEWTER_NIDORAN_HOUSE diff --git a/data/maps/objects/Route18.asm b/data/maps/objects/Route18.asm index bf585e3d2..9226c9991 100644 --- a/data/maps/objects/Route18.asm +++ b/data/maps/objects/Route18.asm @@ -13,12 +13,12 @@ Route18_Object: warp_event 40, 9, ROUTE_18_GATE_1F, 4 def_bg_events - bg_event 43, 7, SCRIPT_ROUTE18_SIGN - bg_event 33, 5, SCRIPT_ROUTE18_CYCLING_ROAD_SIGN + bg_event 43, 7, TEXT_ROUTE18_SIGN + bg_event 33, 5, TEXT_ROUTE18_CYCLING_ROAD_SIGN def_object_events - object_event 36, 11, SPRITE_COOLTRAINER_M, STAY, RIGHT, SCRIPT_ROUTE18_COOLTRAINER_M1, OPP_BIRD_KEEPER, 8 - object_event 40, 15, SPRITE_COOLTRAINER_M, STAY, LEFT, SCRIPT_ROUTE18_COOLTRAINER_M2, OPP_BIRD_KEEPER, 9 - object_event 42, 13, SPRITE_COOLTRAINER_M, STAY, LEFT, SCRIPT_ROUTE18_COOLTRAINER_M3, OPP_BIRD_KEEPER, 10 + object_event 36, 11, SPRITE_COOLTRAINER_M, STAY, RIGHT, TEXT_ROUTE18_COOLTRAINER_M1, OPP_BIRD_KEEPER, 8 + object_event 40, 15, SPRITE_COOLTRAINER_M, STAY, LEFT, TEXT_ROUTE18_COOLTRAINER_M2, OPP_BIRD_KEEPER, 9 + object_event 42, 13, SPRITE_COOLTRAINER_M, STAY, LEFT, TEXT_ROUTE18_COOLTRAINER_M3, OPP_BIRD_KEEPER, 10 def_warps_to ROUTE_18 diff --git a/data/maps/objects/SSAnneB1FRooms.asm b/data/maps/objects/SSAnneB1FRooms.asm index 7846186e5..10b56e622 100644 --- a/data/maps/objects/SSAnneB1FRooms.asm +++ b/data/maps/objects/SSAnneB1FRooms.asm @@ -37,8 +37,8 @@ SSAnneB1FRooms_Object: object_event 0, 4, SPRITE_FISHER, STAY, RIGHT, TEXT_SSANNEB1FROOMS_FISHER, OPP_FISHER, 2 object_event 10, 13, SPRITE_SUPER_NERD, STAY, RIGHT, TEXT_SSANNEB1FROOMS_SUPER_NERD object_event 11, 12, SPRITE_MONSTER, STAY, NONE, TEXT_SSANNEB1FROOMS_MACHOKE - object_event 20, 2, SPRITE_POKE_BALL, STAY, NONE, 9, ETHER - object_event 10, 2, SPRITE_POKE_BALL, STAY, NONE, 10, TM_REST - object_event 12, 11, SPRITE_POKE_BALL, STAY, NONE, 11, MAX_POTION + object_event 20, 2, SPRITE_POKE_BALL, STAY, NONE, TEXT_SSANNEB1FROOMS_ETHER, ETHER + object_event 10, 2, SPRITE_POKE_BALL, STAY, NONE, TEXT_SSANNEB1FROOMS_TM_REST, TM_REST + object_event 12, 11, SPRITE_POKE_BALL, STAY, NONE, TEXT_SSANNEB1FROOMS_MAX_POTION, MAX_POTION def_warps_to SS_ANNE_B1F_ROOMS diff --git a/scripts/Route18.asm b/scripts/Route18.asm index 26d660c80..43ae93184 100644 --- a/scripts/Route18.asm +++ b/scripts/Route18.asm @@ -15,11 +15,11 @@ Route18_ScriptPointers: Route18_TextPointers: def_text_pointers - dw_const Route18CooltrainerM1Text, SCRIPT_ROUTE18_COOLTRAINER_M1 - dw_const Route18CooltrainerM2Text, SCRIPT_ROUTE18_COOLTRAINER_M2 - dw_const Route18CooltrainerM3Text, SCRIPT_ROUTE18_COOLTRAINER_M3 - dw_const Route18SignText, SCRIPT_ROUTE18_SIGN - dw_const Route18CyclingRoadSignText, SCRIPT_ROUTE18_CYCLING_ROAD_SIGN + dw_const Route18CooltrainerM1Text, TEXT_ROUTE18_COOLTRAINER_M1 + dw_const Route18CooltrainerM2Text, TEXT_ROUTE18_COOLTRAINER_M2 + dw_const Route18CooltrainerM3Text, TEXT_ROUTE18_COOLTRAINER_M3 + dw_const Route18SignText, TEXT_ROUTE18_SIGN + dw_const Route18CyclingRoadSignText, TEXT_ROUTE18_CYCLING_ROAD_SIGN Route18TrainerHeaders: def_trainers