From 77d0e5ff84cc61ae625da19f184094241eddd4dc Mon Sep 17 00:00:00 2001 From: xCrystal Date: Wed, 1 Apr 2015 16:16:43 +0200 Subject: [PATCH] Rename battle files and split move effects Part 3 b.asm, b_2.asm, c.asm, and d.asm --- .../{b.asm => display_effectiveness.asm} | 0 .../{d.asm => link_battle_versus_text.asm} | 0 engine/battle/moveEffects/mist_effect.asm | 21 +++++++++ .../one_hit_ko_effect.asm} | 22 ---------- engine/battle/moveEffects/pay_day_effect.asm | 43 ++++++++++++++++++ engine/battle/{b_2.asm => scale_sprites.asm} | 44 ------------------- main.asm | 10 +++-- 7 files changed, 70 insertions(+), 70 deletions(-) rename engine/battle/{b.asm => display_effectiveness.asm} (100%) mode change 100755 => 100644 rename engine/battle/{d.asm => link_battle_versus_text.asm} (100%) mode change 100755 => 100644 create mode 100644 engine/battle/moveEffects/mist_effect.asm rename engine/battle/{c.asm => moveEffects/one_hit_ko_effect.asm} (53%) mode change 100755 => 100644 create mode 100644 engine/battle/moveEffects/pay_day_effect.asm rename engine/battle/{b_2.asm => scale_sprites.asm} (78%) mode change 100755 => 100644 diff --git a/engine/battle/b.asm b/engine/battle/display_effectiveness.asm old mode 100755 new mode 100644 similarity index 100% rename from engine/battle/b.asm rename to engine/battle/display_effectiveness.asm diff --git a/engine/battle/d.asm b/engine/battle/link_battle_versus_text.asm old mode 100755 new mode 100644 similarity index 100% rename from engine/battle/d.asm rename to engine/battle/link_battle_versus_text.asm diff --git a/engine/battle/moveEffects/mist_effect.asm b/engine/battle/moveEffects/mist_effect.asm new file mode 100644 index 00000000..adee1dfd --- /dev/null +++ b/engine/battle/moveEffects/mist_effect.asm @@ -0,0 +1,21 @@ +MistEffect_: ; 33f2b (c:7f2b) + ld hl, W_PLAYERBATTSTATUS2 + ld a, [$fff3] + and a + jr z, .asm_33f36 + ld hl, W_ENEMYBATTSTATUS2 +.asm_33f36 + bit ProtectedByMist, [hl] ; is mon protected by mist? + jr nz, .asm_33f4a + set ProtectedByMist, [hl] ; mon is now protected by mist + callab PlayCurrentMoveAnimation + ld hl, ShroudedInMistText + jp PrintText +.asm_33f4a + ld hl, PrintButItFailedText_ + ld b, BANK(PrintButItFailedText_) + jp Bankswitch + +ShroudedInMistText: ; 33f52 (c:7f52) + TX_FAR _ShroudedInMistText + db "@" diff --git a/engine/battle/c.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm old mode 100755 new mode 100644 similarity index 53% rename from engine/battle/c.asm rename to engine/battle/moveEffects/one_hit_ko_effect.asm index b7c20ef6..84418e33 --- a/engine/battle/c.asm +++ b/engine/battle/moveEffects/one_hit_ko_effect.asm @@ -1,25 +1,3 @@ -MistEffect_: ; 33f2b (c:7f2b) - ld hl, W_PLAYERBATTSTATUS2 - ld a, [$fff3] - and a - jr z, .asm_33f36 - ld hl, W_ENEMYBATTSTATUS2 -.asm_33f36 - bit ProtectedByMist, [hl] ; is mon protected by mist? - jr nz, .asm_33f4a - set ProtectedByMist, [hl] ; mon is now protected by mist - callab PlayCurrentMoveAnimation - ld hl, ShroudedInMistText - jp PrintText -.asm_33f4a - ld hl, PrintButItFailedText_ - ld b, BANK(PrintButItFailedText_) - jp Bankswitch - -ShroudedInMistText: ; 33f52 (c:7f52) - TX_FAR _ShroudedInMistText - db "@" - OneHitKOEffect_: ; 33f57 (c:7f57) ld hl, W_DAMAGE xor a diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm new file mode 100644 index 00000000..75a005ed --- /dev/null +++ b/engine/battle/moveEffects/pay_day_effect.asm @@ -0,0 +1,43 @@ +PayDayEffect_ ; 2feb8 (b:7eb8) + xor a + ld hl, wcd6d + ld [hli], a + ld a, [H_WHOSETURN] + and a + ld a, [wBattleMonLevel] + jr z, .asm_2fec8 + ld a, [wEnemyMonLevel] +.asm_2fec8 + add a + ld [H_DIVIDEND + 3], a + xor a + ld [H_DIVIDEND], a + ld [H_DIVIDEND + 1], a + ld [H_DIVIDEND + 2], a + ld a, $64 + ld [H_DIVISOR], a + ld b, $4 + call Divide + ld a, [H_QUOTIENT + 3] + ld [hli], a + ld a, [H_REMAINDER] + ld [H_DIVIDEND + 3], a + ld a, $a + ld [H_DIVISOR], a + ld b, $4 + call Divide + ld a, [H_QUOTIENT + 3] + swap a + ld b, a + ld a, [H_REMAINDER] + add b + ld [hl], a + ld de, wTotalPayDayMoney + 2 + ld c, $3 + predef AddBCDPredef + ld hl, CoinsScatteredText + jp PrintText + +CoinsScatteredText: ; 2ff04 (b:7f04) + TX_FAR _CoinsScatteredText + db "@" diff --git a/engine/battle/b_2.asm b/engine/battle/scale_sprites.asm old mode 100755 new mode 100644 similarity index 78% rename from engine/battle/b_2.asm rename to engine/battle/scale_sprites.asm index 4a49bb10..dae4ad42 --- a/engine/battle/b_2.asm +++ b/engine/battle/scale_sprites.asm @@ -83,47 +83,3 @@ DuplicateBitsTable: ; 2fea8 (b:7ea8) db $30, $33, $3c, $3f db $c0, $c3, $cc, $cf db $f0, $f3, $fc, $ff - -PayDayEffect_ ; 2feb8 (b:7eb8) - xor a - ld hl, wcd6d - ld [hli], a - ld a, [H_WHOSETURN] - and a - ld a, [wBattleMonLevel] - jr z, .asm_2fec8 - ld a, [wEnemyMonLevel] -.asm_2fec8 - add a - ld [H_DIVIDEND + 3], a - xor a - ld [H_DIVIDEND], a - ld [H_DIVIDEND + 1], a - ld [H_DIVIDEND + 2], a - ld a, $64 - ld [H_DIVISOR], a - ld b, $4 - call Divide - ld a, [H_QUOTIENT + 3] - ld [hli], a - ld a, [H_REMAINDER] - ld [H_DIVIDEND + 3], a - ld a, $a - ld [H_DIVISOR], a - ld b, $4 - call Divide - ld a, [H_QUOTIENT + 3] - swap a - ld b, a - ld a, [H_REMAINDER] - add b - ld [hl], a - ld de, wTotalPayDayMoney + 2 - ld c, $3 - predef AddBCDPredef - ld hl, CoinsScatteredText - jp PrintText - -CoinsScatteredText: ; 2ff04 (b:7f04) - TX_FAR _CoinsScatteredText - db "@" diff --git a/main.asm b/main.asm index 1c7f15f9..838c4c39 100755 --- a/main.asm +++ b/main.asm @@ -5307,7 +5307,7 @@ FossilKabutopsPic:: INCBIN "pic/bmon/fossilkabutops.pic" SECTION "Battle (bank B)", ROMX, BANK[$B] -INCLUDE "engine/battle/b.asm" +INCLUDE "engine/battle/display_effectiveness.asm" TrainerInfoTextBoxTileGraphics: INCBIN "gfx/trainer_info.2bpp" BlankLeaderNames: INCBIN "gfx/blank_leader_names.2bpp" @@ -5315,7 +5315,8 @@ CircleTile: INCBIN "gfx/circle_tile.2bpp" BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp" INCLUDE "engine/items/tmhm.asm" -INCLUDE "engine/battle/b_2.asm" +INCLUDE "engine/battle/scale_sprites.asm" +INCLUDE "engine/battle/moveEffects/pay_day_effect.asm" INCLUDE "engine/game_corner_slots2.asm" @@ -5385,7 +5386,8 @@ OldManPic:: INCBIN "pic/trainer/oldman.pic" SECTION "Battle (bank C)", ROMX, BANK[$C] -INCLUDE "engine/battle/c.asm" +INCLUDE "engine/battle/moveEffects/mist_effect.asm" +INCLUDE "engine/battle/moveEffects/one_hit_ko_effect.asm" SECTION "Pics 5", ROMX, BANK[PICS_5] @@ -5449,7 +5451,7 @@ VictreebelPicBack:: INCBIN "pic/monback/victreebelb.pic" SECTION "Battle (bank D)", ROMX, BANK[$D] INCLUDE "engine/titlescreen2.asm" -INCLUDE "engine/battle/d.asm" +INCLUDE "engine/battle/link_battle_versus_text.asm" INCLUDE "engine/slot_machine.asm" INCLUDE "engine/overworld/pewter_guys.asm" INCLUDE "engine/multiply_divide.asm"