diff options
author | Remy Oukaour <remy.oukaour@gmail.com> | 2017-12-26 18:45:04 -0500 |
---|---|---|
committer | Remy Oukaour <remy.oukaour@gmail.com> | 2017-12-26 18:45:04 -0500 |
commit | 35a3a19fda87d95e829aa99bf1b6cf18a839c1a6 (patch) | |
tree | 7dd8a2dc82721b02b336740219fd3fb5f72274a8 /engine/battle | |
parent | b5417fafec7dd37cb4be391f3bd3d4541a2a381e (diff) |
Use "battle_anims" and "sprite_anims" for clarity, not just "anims"
Diffstat (limited to 'engine/battle')
-rw-r--r-- | engine/battle/battlestart_copytilemapatonce.asm | 3 | ||||
-rw-r--r-- | engine/battle/checkbattlescene.asm | 47 | ||||
-rw-r--r-- | engine/battle/consumehelditem.asm | 80 | ||||
-rw-r--r-- | engine/battle/returntobattle_useball.asm | 19 | ||||
-rw-r--r-- | engine/battle/updatebattlehuds.asm | 9 |
5 files changed, 158 insertions, 0 deletions
diff --git a/engine/battle/battlestart_copytilemapatonce.asm b/engine/battle/battlestart_copytilemapatonce.asm new file mode 100644 index 000000000..2952e833b --- /dev/null +++ b/engine/battle/battlestart_copytilemapatonce.asm @@ -0,0 +1,3 @@ +BattleStart_CopyTilemapAtOnce: ; 8cf4f + call CGBOnly_CopyTilemapAtOnce + ret diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm new file mode 100644 index 000000000..b63f00907 --- /dev/null +++ b/engine/battle/checkbattlescene.asm @@ -0,0 +1,47 @@ +CheckBattleScene: ; 4ea44 +; Return carry if battle scene is turned off. + + ld a, 0 + ld hl, wLinkMode + call GetFarWRAMByte + cp LINK_MOBILE + jr z, .mobile + + ld a, [Options] + bit BATTLE_SCENE, a + jr nz, .off + + and a + ret + +.mobile + ld a, [wcd2f] + and a + jr nz, .from_wram + + ld a, $4 + call GetSRAMBank + ld a, [$a60c] + ld c, a + call CloseSRAM + + ld a, c + bit 0, c + jr z, .off + + and a + ret + +.from_wram + ld a, $5 + ld hl, w5_dc00 + call GetFarWRAMByte + bit 0, a + jr z, .off + + and a + ret + +.off + scf + ret diff --git a/engine/battle/consumehelditem.asm b/engine/battle/consumehelditem.asm new file mode 100644 index 000000000..a6f7766fb --- /dev/null +++ b/engine/battle/consumehelditem.asm @@ -0,0 +1,80 @@ +ConsumeHeldItem: ; 27192 + push hl + push de + push bc + ld a, [hBattleTurn] + and a + ld hl, OTPartyMon1Item + ld de, EnemyMonItem + ld a, [CurOTMon] + jr z, .theirturn + ld hl, PartyMon1Item + ld de, BattleMonItem + ld a, [CurBattleMon] + +.theirturn + push hl + push af + ld a, [de] + ld b, a + farcall GetItemHeldEffect + ld hl, .ConsumableEffects +.loop + ld a, [hli] + cp b + jr z, .ok + inc a + jr nz, .loop + pop af + pop hl + pop bc + pop de + pop hl + ret + +.ok + xor a + ld [de], a + pop af + pop hl + call GetPartyLocation + ld a, [hBattleTurn] + and a + jr nz, .ourturn + ld a, [wBattleMode] + dec a + jr z, .done + +.ourturn + ld [hl], $0 + +.done + pop bc + pop de + pop hl + ret + +.ConsumableEffects: ; 271de +; Consumable items? + db HELD_BERRY + db HELD_2 + db HELD_5 + db HELD_HEAL_POISON + db HELD_HEAL_FREEZE + db HELD_HEAL_BURN + db HELD_HEAL_SLEEP + db HELD_HEAL_PARALYZE + db HELD_HEAL_STATUS + db HELD_30 + db HELD_ATTACK_UP + db HELD_DEFENSE_UP + db HELD_SPEED_UP + db HELD_SP_ATTACK_UP + db HELD_SP_DEFENSE_UP + db HELD_ACCURACY_UP + db HELD_EVASION_UP + db HELD_38 + db HELD_71 + db HELD_ESCAPE + db HELD_CRITICAL_UP + db -1 diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm new file mode 100644 index 000000000..e6e33f900 --- /dev/null +++ b/engine/battle/returntobattle_useball.asm @@ -0,0 +1,19 @@ +_ReturnToBattle_UseBall: ; 2715c + call ClearBGPalettes + call ClearTileMap + ld a, [BattleType] + cp BATTLETYPE_TUTORIAL + jr z, .gettutorialbackpic + farcall GetBattleMonBackpic + jr .continue + +.gettutorialbackpic + farcall GetTrainerBackpic +.continue + farcall GetEnemyMonFrontpic + farcall _LoadBattleFontsHPBar + call GetMemSGBLayout + call CloseWindow + call LoadStandardMenuDataHeader + call WaitBGMap + jp SetPalettes diff --git a/engine/battle/updatebattlehuds.asm b/engine/battle/updatebattlehuds.asm new file mode 100644 index 000000000..ec7f662e8 --- /dev/null +++ b/engine/battle/updatebattlehuds.asm @@ -0,0 +1,9 @@ +_UpdateBattleHUDs: + farcall DrawPlayerHUD + ld hl, PlayerHPPal + call SetHPPal + farcall DrawEnemyHUD + ld hl, EnemyHPPal + call SetHPPal + farcall FinishBattleAnim + ret |