diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/core.asm | 14 | ||||
-rw-r--r-- | engine/battle/effect_commands.asm | 4 | ||||
-rw-r--r-- | engine/battle/move_effects/metronome.asm | 2 | ||||
-rw-r--r-- | engine/battle/start_battle.asm | 2 | ||||
-rw-r--r-- | engine/events/battle_tower/load_trainer.asm | 2 | ||||
-rw-r--r-- | engine/events/celebi.asm | 2 | ||||
-rw-r--r-- | engine/events/field_moves.asm | 40 | ||||
-rw-r--r-- | engine/events/fishing_gfx.asm | 2 | ||||
-rw-r--r-- | engine/events/odd_egg.asm | 2 | ||||
-rw-r--r-- | engine/games/unown_puzzle.asm | 4 | ||||
-rw-r--r-- | engine/link/link.asm | 2 | ||||
-rw-r--r-- | engine/menus/options_menu.asm | 4 | ||||
-rw-r--r-- | engine/menus/save.asm | 8 | ||||
-rw-r--r-- | engine/movie/crystal_intro.asm | 2 | ||||
-rw-r--r-- | engine/movie/title.asm | 4 | ||||
-rw-r--r-- | engine/overworld/decorations.asm | 18 | ||||
-rw-r--r-- | engine/overworld/player_movement.asm | 37 | ||||
-rw-r--r-- | engine/pokemon/move_mon.asm | 8 | ||||
-rw-r--r-- | engine/tilesets/tileset_anims.asm | 16 |
19 files changed, 88 insertions, 85 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c3c7e9867..57c0d7990 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3619,10 +3619,10 @@ CheckPlayerPartyForFitMon: ld e, a xor a ld hl, wPartyMon1HP - ld bc, wPartyMon2 - (wPartyMon1 + 1) + ld bc, PARTYMON_STRUCT_LENGTH - 1 .loop or [hl] - inc hl + inc hl ; + 1 or [hl] add hl, bc dec e @@ -6992,7 +6992,7 @@ GiveExperiencePoints: ld a, [wCurPartyMon] ld c, a ld b, CHECK_FLAG - ld d, $0 + ld d, FALSE predef SmallFarFlagAction ld a, c and a @@ -7006,7 +7006,7 @@ GiveExperiencePoints: ld e, l ld hl, wEnemyMonBaseStats - 1 push bc - ld c, $5 + ld c, NUM_EXP_STATS .loop1 inc hl ld a, [de] @@ -7286,13 +7286,13 @@ GiveExperiencePoints: ld [wMonType], a predef CopyMonToTempMon hlcoord 9, 0 - ld b, $a - ld c, $9 + ld b, 10 + ld c, 9 call TextBox hlcoord 11, 1 ld bc, 4 predef PrintTempMonStats - ld c, $1e + ld c, 30 call DelayFrames call WaitPressAorB_BlinkCursor call Call_LoadTempTileMapToTileMap diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 3e6d928d2..eb30af88b 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -1210,7 +1210,9 @@ BattleCommand_Critical: ld [wCriticalHit], a ret -INCLUDE "data/battle/critical_hits.asm" +INCLUDE "data/moves/critical_hit_moves.asm" + +INCLUDE "data/battle/critical_hit_chances.asm" INCLUDE "engine/battle/move_effects/triple_kick.asm" diff --git a/engine/battle/move_effects/metronome.asm b/engine/battle/move_effects/metronome.asm index b8a6b586f..25197d7cd 100644 --- a/engine/battle/move_effects/metronome.asm +++ b/engine/battle/move_effects/metronome.asm @@ -40,4 +40,4 @@ BattleCommand_Metronome: call UpdateMoveData jp ResetTurn -INCLUDE "data/battle/metronome_exception_moves.asm" +INCLUDE "data/moves/metronome_exception_moves.asm" diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 5c2a633a8..f5fc4a6b0 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -16,7 +16,7 @@ FindFirstAliveMonAndStartBattle: xor a ld [hMapAnims], a call DelayFrame - ld b, 6 + ld b, PARTY_LENGTH ld hl, wPartyMon1HP ld de, PARTYMON_STRUCT_LENGTH - 1 diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 2f34950b6..f9be02b28 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -104,7 +104,7 @@ Function_LoadRandomBattleTowerMon: ld a, [wBTChoiceOfLvlGroup] dec a ld hl, BattleTowerMons - ld bc, BattleTowerMons2 - BattleTowerMons1 + ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group call AddNTimes ld a, [hRandomAdd] diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 76bdbaa76..a34f3935a 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -31,7 +31,7 @@ CelebiShrineEvent: call GetCelebiSpriteTile inc d push de - ld a, $90 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call CelebiEvent_CountDown diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index f5ad049f2..6adb80ba6 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,3 +1,7 @@ +FIELDMOVE_GRASS EQU $80 +FIELDMOVE_TREE EQU $84 +FIELDMOVE_FLY EQU $84 + PlayWhirlpoolSound: call WaitSFX ld de, SFX_SURF @@ -20,11 +24,11 @@ BlindingFlash: ShakeHeadbuttTree: farcall ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, HeadbuttTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing @@ -32,8 +36,8 @@ ShakeHeadbuttTree: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 - ld a, 36 * 4 + ld [hl], FIELDMOVE_TREE + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree @@ -48,7 +52,7 @@ ShakeHeadbuttTree: and a jr z, .done dec [hl] - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call DelayFrame @@ -111,7 +115,7 @@ OWCutAnimation: ; 0: Split tree in half ; 1: Mow the lawn ld a, e - and $1 + and 1 ld [wJumptableIndex], a call .LoadCutGFX call WaitSFX @@ -121,7 +125,7 @@ OWCutAnimation: ld a, [wJumptableIndex] bit 7, a jr nz, .finish - ld a, 36 * 4 + ld a, 36 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call OWCutJumptable @@ -134,11 +138,11 @@ OWCutAnimation: .LoadCutGFX: callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, CutTreeGFX - ld hl, vTiles1 tile $04 + ld hl, vTiles0 tile FIELDMOVE_TREE lb bc, BANK(CutTreeGFX), 4 call Request2bpp ret @@ -173,7 +177,7 @@ Cut_SpawnAnimateTree: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_TREE ld a, 32 ld [wFrameCounter], a ; Cut_StartWaiting @@ -226,7 +230,7 @@ Cut_SpawnLeaf: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ld hl, SPRITEANIMSTRUCT_0E add hl, bc ld [hl], $4 @@ -313,7 +317,7 @@ FlyFromAnim: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM @@ -323,7 +327,7 @@ FlyFromAnim: ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -347,7 +351,7 @@ FlyToAnim: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $84 + ld [hl], FIELDMOVE_FLY ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_TO @@ -360,7 +364,7 @@ FlyToAnim: ld a, [wJumptableIndex] bit 7, a jr nz, .exit - ld a, 0 * 4 + ld a, 0 * SPRITEOAMSTRUCT_LENGTH ld [wCurrSpriteOAMAddr], a callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer @@ -394,7 +398,7 @@ endr FlyFunction_InitGFX: callfar ClearSpriteAnims ld de, CutGrassGFX - ld hl, vTiles1 tile $00 + ld hl, vTiles0 tile FIELDMOVE_GRASS lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld a, [wCurPartyMon] @@ -404,7 +408,7 @@ FlyFunction_InitGFX: add hl, de ld a, [hl] ld [wd265], a - ld e, $84 + ld e, FIELDMOVE_FLY farcall FlyFunction_GetMonIcon xor a ld [wJumptableIndex], a @@ -446,5 +450,5 @@ FlyFunction_FrameTimer: call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc - ld [hl], $80 + ld [hl], FIELDMOVE_GRASS ret diff --git a/engine/events/fishing_gfx.asm b/engine/events/fishing_gfx.asm index 25d1ee77a..159f0022d 100644 --- a/engine/events/fishing_gfx.asm +++ b/engine/events/fishing_gfx.asm @@ -17,7 +17,7 @@ LoadFishingGFX: call .LoadGFX ld hl, vTiles0 tile $0a call .LoadGFX - ld hl, vTiles1 tile $7c + ld hl, vTiles0 tile $fc call .LoadGFX pop af diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 10d7cf9aa..a6b244b1d 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -39,7 +39,7 @@ _GiveOddEgg: .done ld hl, OddEggs - ld a, OddEgg2 - OddEgg1 + ld a, OddEgg1End - OddEgg1 call AddNTimes ld de, wOddEggSpecies diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index fb88d93b6..40c6527d9 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -19,11 +19,11 @@ _UnownPuzzle: xor a call ByteFill ld hl, UnownPuzzleCursorGFX - ld de, vTiles1 tile $60 + ld de, vTiles0 tile $e0 ld bc, 4 tiles call CopyBytes ld hl, UnownPuzzleStartCancelLZ - ld de, vTiles1 tile $6d + ld de, vTiles0 tile $ed call Decompress call LoadUnownPuzzlePiecesGFX hlcoord 0, 0 diff --git a/engine/link/link.asm b/engine/link/link.asm index d72abb0a5..e5f354f57 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -2039,7 +2039,7 @@ CheckTimeCapsuleCompatibility: jr nc, .move_too_new dec c jr nz, .move_next - ld de, wPartyMon2 - (wPartyMon1 + NUM_MOVES) + ld de, PARTYMON_STRUCT_LENGTH - NUM_MOVES add hl, de dec b jr nz, .move_loop diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 46fa33621..370eba3f6 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -165,7 +165,7 @@ GetTextSpeed: ; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, ; with previous/next TEXT_DELAY_* values in d/e ld a, [wOptions] - and $7 + and TEXT_DELAY_MASK cp TEXT_DELAY_SLOW jr z, .slow cp TEXT_DELAY_FAST @@ -467,7 +467,7 @@ Options_Frame: dec a .Save: - and $7 + maskbits NUM_FRAMES ld [hl], a UpdateFrame: ld a, [wTextBoxFrame] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 469c55abd..190f5f887 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -89,7 +89,7 @@ MoveMonWOMail_InsertMon_SaveGame: pop de ld a, e ld [wCurBox], a - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -253,7 +253,7 @@ SavedTheGame: ret SaveGameData_: - ld a, 1 + ld a, TRUE ld [wSaveFileExists], a farcall StageRTCTimeForSave farcall BackupMysteryGift @@ -627,7 +627,7 @@ TryLoadSaveFile: ret TryLoadSaveData: - xor a + xor a ; FALSE ld [wSaveFileExists], a call CheckPrimarySaveFile ld a, [wSaveFileExists] @@ -690,7 +690,7 @@ CheckPrimarySaveFile: ld bc, wOptionsEnd - wOptions call CopyBytes call CloseSRAM - ld a, $1 + ld a, TRUE ld [wSaveFileExists], a .nope diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm index 26fb31bb8..467c1671a 100644 --- a/engine/movie/crystal_intro.asm +++ b/engine/movie/crystal_intro.asm @@ -1481,7 +1481,7 @@ IntroScene28: cp $8 ret nz - ld de, SFX_UNKNOWN_CB + ld de, SFX_INTRO_WHOOSH call PlaySFX ret diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 3717b4e73..eb639489f 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -246,8 +246,8 @@ SuicuneFrameIterator: ret .Frames: - db $80 ; vTiles4 tile $00 - db $88 ; vTiles4 tile $08 + db $80 ; vTiles3 tile $80 + db $88 ; vTiles3 tile $88 db $00 ; vTiles5 tile $00 db $08 ; vTiles5 tile $08 diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 7ba177420..bea2e0cdb 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -1085,17 +1085,18 @@ DecorationDesc_GiantOrnament: db "@" ToggleMaptileDecorations: - lb de, 0, 4 + ; tile coordinates work the same way as for changeblock + lb de, 0, 4 ; bed coordinates ld a, [wDecoBed] call SetDecorationTile - lb de, 7, 4 + lb de, 7, 4 ; plant coordinates ld a, [wDecoPlant] call SetDecorationTile - lb de, 6, 0 + lb de, 6, 0 ; poster coordinates ld a, [wDecoPoster] call SetDecorationTile call SetPosterVisibility - lb de, 0, 0 + lb de, 0, 0 ; carpet top-left coordinates call PadCoords_de ld a, [wDecoCarpet] and a @@ -1103,15 +1104,15 @@ ToggleMaptileDecorations: call _GetDecorationSprite ld [hl], a push af - lb de, 0, 2 + lb de, 0, 2 ; carpet bottom-left coordinates call PadCoords_de pop af inc a - ld [hli], a + ld [hli], a ; carpet bottom-left block inc a - ld [hli], a + ld [hli], a ; carpet bottom-middle block dec a - ld [hl], a + ld [hl], a ; carpet bottom-right block ret SetPosterVisibility: @@ -1177,6 +1178,7 @@ _GetDecorationSprite: ret PadCoords_de: +; adjusts coordinates, the same way as Script_changeblock ld a, d add 4 ld d, a diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index c70357f13..a4926e7e5 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -562,8 +562,8 @@ DoPlayerMovement:: .GetAction: ; Poll player input and update movement info. - ld hl, .table - ld de, .table2 - .table1 + ld hl, .action_table + ld de, .action_table_1_end - .action_table_1 ld a, [wCurInput] bit D_DOWN_F, a jr nz, .d_down @@ -597,25 +597,20 @@ DoPlayerMovement:: ld [wWalkingTile], a ret -.table -; struct: -; walk direction -; facing -; x movement -; y movement -; tile collision pointer -.table1 - db STANDING, FACE_CURRENT, 0, 0 - dw wPlayerStandingTile -.table2 - db RIGHT, FACE_RIGHT, 1, 0 - dw wTileRight - db LEFT, FACE_LEFT, -1, 0 - dw wTileLeft - db UP, FACE_UP, 0, -1 - dw wTileUp - db DOWN, FACE_DOWN, 0, 1 - dw wTileDown +player_action: MACRO +; walk direction, facing, x movement, y movement, tile collision pointer + db \1, \2, \3, \4 + dw \5 +ENDM + +.action_table: +.action_table_1 + player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile +.action_table_1_end + player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight + player_action LEFT, FACE_LEFT, -1, 0, wTileLeft + player_action UP, FACE_UP, 0, -1, wTileUp + player_action DOWN, FACE_DOWN, 0, 1, wTileDown .CheckNPC: ; Returns 0 if there is an NPC in front that you can't move diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 7074dafd8..128bbf200 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -1403,7 +1403,7 @@ CalcMonStats: ; hl is the path to the Stat EXP ; de points to where the final stats will be saved - ld c, $0 + ld c, STAT_HP - 1 ; first stat .loop inc c call CalcMonStatC @@ -1414,7 +1414,7 @@ CalcMonStats: ld [de], a inc de ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .loop ret @@ -1434,14 +1434,14 @@ CalcMonStatC: push hl ld hl, wBaseStats dec hl ; has to be decreased, because 'c' begins with 1 - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] ld e, a pop hl push hl ld a, c - cp STAT_SDEF + cp STAT_SDEF ; last stat jr nz, .not_spdef dec hl dec hl diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index 1e6abb968..2827b3a92 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -40,7 +40,7 @@ TilesetKantoAnim: dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation @@ -53,7 +53,7 @@ TilesetParkAnim: dw NULL, WaitTileAnimation dw vTiles2 tile $5f, AnimateFountain dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation @@ -71,7 +71,7 @@ TilesetForestAnim: dw NULL, ForestTreeRightAnimation2 dw NULL, AnimateFlowerTile dw vTiles2 tile $14, AnimateWaterTile - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, StandingTileFrame8 dw NULL, DoneTileAnimation @@ -79,7 +79,7 @@ TilesetJohtoAnim: dw vTiles2 tile $14, AnimateWaterTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, AnimateFlowerTile dw WhirlpoolFrames1, AnimateWhirlpoolTile @@ -122,7 +122,7 @@ TilesetPortAnim: dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -178,7 +178,7 @@ TilesetDarkCaveAnim: dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $14, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $40, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -199,7 +199,7 @@ TilesetIcePathAnim: dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $35, WriteTileFromBuffer dw NULL, FlickeringCaveEntrancePalette - dw NULL, TileAnimationPalette + dw NULL, AnimateWaterPalette dw NULL, FlickeringCaveEntrancePalette dw vTiles2 tile $31, WriteTileToBuffer dw NULL, FlickeringCaveEntrancePalette @@ -852,7 +852,7 @@ endr ld sp, hl ret -TileAnimationPalette: +AnimateWaterPalette: ; Transition between color values 0-2 for color 0 in palette 3. ; No palette changes on DMG. |