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: 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 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'engine') diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index b58444af..813cfc49 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 69956a31..4a31ab5e 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 dc57d5b9..46c29e3e 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 -- cgit v1.3.1-sl0p From b066d3c9bc02cf4213173538d148cfabcc7212a8 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 17:53:19 -0500 Subject: 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(-) (limited to 'engine') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index fcfec14d..712958bc 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 a16fd250..363533ce 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 8b8942e6..9e24c89d 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 0410de21..5f258503 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 4ed4735e..3e339619 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 46c29e3e..ffed3708 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 f5ddf964..b67f4b1c 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 5092b74e..2e4a7ce2 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 -- cgit v1.3.1-sl0p From 77887be2512b4b8af688dc4552bdb4490d35e65b Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 20 Nov 2023 18:53:23 -0500 Subject: 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(-) (limited to 'engine') diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 4a31ab5e..8704814f 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 927f54cb..12c7dade 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 3411f729..96bae343 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 75816886..53b70c19 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 e08da61a..eb186f1e 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 8085f484..885a5327 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 53f98847..77cb5c4b 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 8c246b8a..32749db3 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 298c2fcb..d434f681 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 dd898ac6..4d5bebf0 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 abf6c8e4..1e575e43 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 a0f9c1f4..14a8a79b 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 1a2978a8..778283c5 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 c6afd27a..bfa78847 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 4c8a0b18..9d800233 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 -- cgit v1.3.1-sl0p 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: 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 (limited to 'engine') diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm new file mode 100644 index 00000000..db57d6c4 --- /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 f976674a..19ebdfcf 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 e89d19f3..b94b12d2 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 271828b9..6253859b 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" -- cgit v1.3.1-sl0p From a681f718ac0fa6077c45ad793968a8f0cbfb93c7 Mon Sep 17 00:00:00 2001 From: SatoMew Date: Wed, 22 Nov 2023 00:54:39 +0000 Subject: 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(-) (limited to 'engine') diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 028d6711..3c594ae1 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 c5fcc292..a555579e 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 f77beb26..5a473ccf 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 7e41d58d..d6b51ee5 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] -- cgit v1.3.1-sl0p 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: Replace some `$a` with `EFFECTIVE` (#399) --- engine/battle/core.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 19ebdfcf..ed2c4b7a 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 -- cgit v1.3.1-sl0p From d4e7a39dd89a32c7af13fed31b3178cc769fb797 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:15:30 -0500 Subject: 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(-) (limited to 'engine') diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 2ae1cdef..44a85e8d 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 ed2c4b7a..b93b6fa7 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 -- cgit v1.3.1-sl0p From 0a616ae5606031ce27b4c987ae0e1d9da511cec9 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:33:03 -0500 Subject: 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(-) (limited to 'engine') diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 3c594ae1..5cc2d344 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 a555579e..d900dde6 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 5a473ccf..46b828eb 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 32749db3..82a5f14c 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 -- cgit v1.3.1-sl0p From 41ec74e1f0481ec995a5ad9e9dd73e7ad91c181f Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 21 Nov 2023 20:36:00 -0500 Subject: Fix inaccurate comment in UpdateNPCSprite Fixes #404 --- engine/overworld/movement.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index eb186f1e..fd26f9cb 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] -- cgit v1.3.1-sl0p From a247120ac115c7c7f48d487dbaf9aaaf26e18757 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 21 Nov 2023 20:18:04 -0600 Subject: 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(-) (limited to 'engine') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b93b6fa7..ca3294b8 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 b23695cf..2879f847 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 ffed3708..e6d89480 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 -- cgit v1.3.1-sl0p