diff options
| author | dannye <33dannye@gmail.com> | 2023-11-21 20:56:28 -0600 |
|---|---|---|
| committer | dannye <33dannye@gmail.com> | 2023-11-21 20:56:28 -0600 |
| commit | 04f7f7f506a1dbb877e4678601261e8157fd0e57 (patch) | |
| tree | bfe62d3872c5f031ee40df9488910bd58b0e1b15 /engine | |
| parent | Extend tools/pcm.c to allow decoding .pcm to .wav (diff) | |
| parent | Fix some map text constants (diff) | |
| download | pokeyellow-04f7f7f506a1dbb877e4678601261e8157fd0e57.tar.gz pokeyellow-04f7f7f506a1dbb877e4678601261e8157fd0e57.tar.xz pokeyellow-04f7f7f506a1dbb877e4678601261e8157fd0e57.zip | |
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/battle/animations.asm | 54 | ||||
| -rw-r--r-- | engine/battle/battle_transitions.asm | 24 | ||||
| -rw-r--r-- | engine/battle/core.asm | 46 | ||||
| -rw-r--r-- | engine/battle/display_effectiveness.asm | 2 | ||||
| -rw-r--r-- | engine/battle/effects.asm | 4 | ||||
| -rw-r--r-- | engine/battle/init_battle.asm | 3 | ||||
| -rw-r--r-- | engine/battle/scale_sprites.asm | 21 | ||||
| -rw-r--r-- | engine/events/hidden_objects/bookshelves.asm | 4 | ||||
| -rw-r--r-- | engine/gfx/sprite_oam.asm | 8 | ||||
| -rw-r--r-- | engine/items/item_effects.asm | 4 | ||||
| -rw-r--r-- | engine/menus/party_menu.asm | 12 | ||||
| -rw-r--r-- | engine/menus/pokedex.asm | 2 | ||||
| -rw-r--r-- | engine/movie/credits.asm | 8 | ||||
| -rw-r--r-- | engine/movie/oak_speech/oak_speech.asm | 12 | ||||
| -rw-r--r-- | engine/overworld/auto_movement.asm | 4 | ||||
| -rw-r--r-- | engine/overworld/movement.asm | 6 | ||||
| -rw-r--r-- | engine/overworld/sprite_collisions.asm | 63 | ||||
| -rw-r--r-- | engine/pokemon/evos_moves.asm | 6 |
18 files changed, 129 insertions, 154 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index ffa7e5a8..da758332 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1016,7 +1016,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 UpdateGBCPal_BGP @@ -1032,35 +1032,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 b0289d7e..77f2ba89 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -339,18 +339,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/core.asm b/engine/battle/core.asm index 3bc59a4f..b7b10d06 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 @@ -834,7 +834,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 @@ -1298,7 +1298,7 @@ SlideTrainerPicOffScreen: dec c jr nz, .columnLoop pop hl - ld de, 20 + ld de, SCREEN_WIDTH add hl, de dec b jr nz, .rowLoop @@ -3245,7 +3245,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) @@ -3323,9 +3323,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] @@ -4352,7 +4352,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 @@ -4384,7 +4384,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 @@ -4473,7 +4473,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 @@ -4505,7 +4505,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 @@ -4549,7 +4549,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 @@ -5456,7 +5456,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 @@ -5484,7 +5484,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] @@ -5493,8 +5492,9 @@ 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 + ld a, $10 ; bug: should be EFFECTIVE (10) + ld [wTypeEffectiveness], a ld hl, TypeEffects .loop ld a, [hli] @@ -5782,7 +5782,7 @@ ExecuteEnemyMove: xor a ld [wMoveMissed], a ld [wMoveDidntMiss], a - ld a, $a + ld a, EFFECTIVE ld [wDamageMultipliers], a call CheckEnemyStatusConditions jr nz, .enemyHasNoSpecialConditions @@ -5861,9 +5861,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 @@ -6935,9 +6935,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 call Delay3 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/battle/effects.asm b/engine/battle/effects.asm index c6ec7628..51dc1d37 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -1516,9 +1516,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/engine/battle/init_battle.asm b/engine/battle/init_battle.asm index e4c56d6d..d23df283 100644 --- a/engine/battle/init_battle.asm +++ b/engine/battle/init_battle.asm @@ -151,7 +151,6 @@ _InitBattleCommon: db "@" _LoadTrainerPic: -; wd033-wd034 contain pointer to pic ld a, [wTrainerPicPointer] ld e, a ld a, [wTrainerPicPointer + 1] @@ -183,7 +182,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 diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 38ebff21..2e33f536 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -84,21 +84,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/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 406d44fd..4660eaf6 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -30,7 +30,7 @@ PrepareOAMData:: inc e inc e ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] - ld [wd5cd], a + ld [wSavedSpriteImageIndex], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -79,7 +79,7 @@ PrepareOAMData:: jr nc, .asm_4a41 .hidden call Func_4a7b - ld [wd5cd], a + ld [wSavedSpriteImageIndex], a ldh a, [hOAMBufferOffset] ld e, a @@ -101,7 +101,7 @@ PrepareOAMData:: ld [de], a inc hl inc e - ld a, [wd5cd] + ld a, [wSavedSpriteImageIndex] add [hl] cp $80 jr c, .asm_4a1c @@ -188,7 +188,7 @@ GetSpriteScreenXY: Func_4a7b: push bc - ld a, [wd5cd] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] + 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 4430c6fb..2ce6587e 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -771,7 +771,7 @@ ItemUseSurfboard: ld a, b ld [wSimulatedJoypadStatesEnd], a xor a - ld [wWastedByteCD39], a + ld [wUnusedCD39], a inc a ld [wSimulatedJoypadStatesIndex], a ret @@ -873,7 +873,7 @@ Func_d85d: jr z, .cannotEvolveWithUsedStone inc hl inc hl - cp EV_ITEM + cp EVOLVE_ITEM jr nz, .loop dec hl dec hl diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index c64ce70a..022ae206 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -129,19 +129,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 @@ -150,7 +150,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/menus/pokedex.asm b/engine/menus/pokedex.asm index 36b2bb04..899b70ed 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -37,7 +37,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/movie/credits.asm b/engine/movie/credits.asm index 938579f3..489569d1 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -54,10 +54,10 @@ FadeInCreditsText: 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 DisplayCreditsMon: ld hl, vBGMap1 diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 3e874560..6e09cfad 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -198,12 +198,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/auto_movement.asm b/engine/overworld/auto_movement.asm index 65888294..39c1f380 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 [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptPointerTableNum], 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 e6ca8748..48a6f3aa 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -114,7 +114,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 @@ -135,7 +135,7 @@ UpdateNPCSprite: jp z, Func_5357 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] @@ -166,7 +166,7 @@ UpdateNPCSprite: res 0, [hl] xor a ld [wSimulatedJoypadStatesIndex], a - ld [wWastedByteCD3A], a + ld [wUnusedCD3A], a ret .next cp WALK diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index b29dc108..186ff504 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -82,7 +82,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 @@ -95,7 +95,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 @@ -105,15 +105,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] @@ -157,7 +157,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 @@ -179,11 +179,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. @@ -196,7 +196,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 @@ -228,7 +228,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 @@ -250,11 +250,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. @@ -267,7 +267,7 @@ 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 @@ -278,15 +278,15 @@ DetectCollisionBetweenSprites: jr nz, .asm_4cd9 xor a ld [wd434], a - ldh a, [hFF8F] + ldh a, [hCollidingSpriteOffset] cp $f jr nz, .asm_4cd9 call Func_4d0a jr .asm_4cef .asm_4cd9 - 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. @@ -310,7 +310,7 @@ DetectCollisionBetweenSprites: inc l inc l .asm_4cef - ldh a, [hFF8F] ; a = loop counter + ldh a, [hCollidingSpriteOffset] ld de, SpriteCollisionBitTable add a add e @@ -327,7 +327,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ldh a, [hFF8F] ; a = loop counter + ldh a, [hCollidingSpriteOffset] inc a cp $10 jp nz, .loop @@ -339,9 +339,9 @@ DetectCollisionBetweenSprites: ; c = 7 if delta X/Y is 1 ; c = 9 if delta X/Y is -1 Func_4d0a: - ldh a, [hFF91] + ldh a, [hCollidingSpriteTempXValue] ld b, a - ldh a, [hFF90] + ldh a, [hCollidingSpriteTempYValue] inc l cp b jr c, .asm_4d17 @@ -374,19 +374,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/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 6ff91597..4536453e 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] |
