From 4fd7a42b235b68ffc11d4f02305b695c2ed05549 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 7 Feb 2015 16:24:16 -0800 Subject: commented battle stuff --- engine/battle/1c.asm | 73 ++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 34 deletions(-) (limited to 'engine/battle/1c.asm') diff --git a/engine/battle/1c.asm b/engine/battle/1c.asm index b905777b..2e360e65 100755 --- a/engine/battle/1c.asm +++ b/engine/battle/1c.asm @@ -1,85 +1,90 @@ -Func_708ca: ; 708ca (1c:48ca) +DoGhostMarowakRevelationAnimation: ; 708ca (1c:48ca) ld a, $e4 - ld [rOBP1], a ; $ff49 - call Func_7092a + ld [rOBP1], a + call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same +; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap hlCoord 12, 0 ld bc, $707 call ClearScreenArea call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba - ld a, $91 + ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon +; replace ghost pic with Marowak in BG + ld a, MAROWAK ld [wHPBarMaxHP], a ld a, $1 - ld [H_WHOSETURN], a ; $fff3 + ld [H_WHOSETURN], a callab Func_79793 + ; alternate between black and light grey 8 times. + ; this makes the ghost's body appear to flash ld d, $80 - call Func_704f3 -.asm_708f6 - ld c, $a + call FlashSprite8Times +.fadeOutGhostLoop + ld c, 10 call DelayFrames - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] sla a sla a - ld [rOBP1], a ; $ff49 - jr nz, .asm_708f6 + ld [rOBP1], a + jr nz, .fadeOutGhostLoop call ClearSprites - call Func_7092a + call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM ld b, $e4 -.asm_7090d - ld c, $a +.fadeInMarowakLoop + ld c, 10 call DelayFrames - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] srl b rra srl b rra - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld a, b and a - jr nz, .asm_7090d + jr nz, .fadeInMarowakLoop ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared call Delay3 jp ClearSprites -Func_7092a: ; 7092a (1c:492a) +; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM +CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) ld de, vFrontPic ld hl, vSprites ld bc, 7 * 7 call CopyVideoData ld a, $10 - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld a, $70 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld hl, wOAMBuffer ld bc, $606 ld d, $8 -.asm_70948 +.oamLoop push bc - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld e, a -.asm_7094d +.oamInnerLoop ld a, e add $8 ld e, a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld [hli], a ld a, d ld [hli], a - ld a, $10 + ld a, $10 ; use OBP1 ld [hli], a inc d dec c - jr nz, .asm_7094d + jr nz, .oamInnerLoop inc d - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] add $8 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a pop bc dec b - jr nz, .asm_70948 + jr nz, .oamLoop ret BattleTransition: ; 7096d (1c:496d) @@ -270,9 +275,9 @@ BattleTransitionTile: ; 70a59 (1c:4a59) BattleTransition_BlackScreen: ; 70a69 (1c:4a69) ld a, $ff - ld [rBGP], a ; $ff47 - ld [rOBP0], a ; $ff48 - ld [rOBP1], a ; $ff49 + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a ret ; for non-dungeon trainer battles -- cgit v1.3.1-sl0p From 7b7c563c93155e121e05149779cfb78b0bf9d259 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 8 Feb 2015 18:40:08 -0800 Subject: Rename some labels --- engine/battle/16.asm | 2 +- engine/battle/1c.asm | 3 ++- engine/cable_club.asm | 2 +- engine/overworld/map_sprites.asm | 6 +++--- engine/overworld/movement.asm | 4 ++-- home.asm | 4 ++-- main.asm | 2 +- wram.asm | 9 +++++---- 8 files changed, 17 insertions(+), 15 deletions(-) (limited to 'engine/battle/1c.asm') diff --git a/engine/battle/16.asm b/engine/battle/16.asm index 4a215a37..9a00bd98 100755 --- a/engine/battle/16.asm +++ b/engine/battle/16.asm @@ -55,7 +55,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) ld hl, UnveiledGhostText call PrintText callab LoadEnemyMonData - callab DoGhostMarowakRevelationAnimation + callab MarowakAnim ld hl, WildMonAppearedText call PrintText diff --git a/engine/battle/1c.asm b/engine/battle/1c.asm index 2e360e65..ce0296f7 100755 --- a/engine/battle/1c.asm +++ b/engine/battle/1c.asm @@ -1,4 +1,5 @@ -DoGhostMarowakRevelationAnimation: ; 708ca (1c:48ca) +MarowakAnim: ; 708ca (1c:48ca) +; animate the ghost being unveiled as a Marowak ld a, $e4 ld [rOBP1], a call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same diff --git a/engine/cable_club.asm b/engine/cable_club.asm index ff25fd5e..4fbb13d9 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -578,7 +578,7 @@ TradeCenter_SelectMon: ReturnToCableClubRoom: ; 577d (1:577d) call GBPalWhiteOutWithDelay3 - ld hl, wCharRAMInUseForText + ld hl, wFontLoaded ld a, [hl] push af push hl diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 16403759..df39d112 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -159,7 +159,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,e pop de ld b,a - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.skipFirstLoad ; if so, skip loading data into the lower half ld a,b @@ -180,7 +180,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) jr nc,.noCarry3 inc d .noCarry3 - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadWhileLCDOn pop af @@ -264,7 +264,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) cp a,$f0 ; does the map have 2 sprite sets? call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b,a ; b = spriteSetID - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set ld a,[W_SPRITESETID] diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 1658b0e9..c4482700 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -52,7 +52,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr .asm_4eab .asm_4e86 ld [wSpriteStateData1 + 9], a - ld a, [wCharRAMInUseForText] + ld a, [wFontLoaded] bit 0, a jr nz, .asm_4e7d .asm_4e90 @@ -130,7 +130,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) bit 7, a jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 ld b, a - ld a, [wCharRAMInUseForText] + ld a, [wFontLoaded] bit 0, a jp nz, notYetMoving ld a, b diff --git a/home.asm b/home.asm index 7a908f78..37e128f0 100644 --- a/home.asm +++ b/home.asm @@ -1183,7 +1183,7 @@ CloseTextDisplay:: ; 29e8 (0:29e8) ld [H_LOADEDROMBANK],a ld [$2000],a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl,wCharRAMInUseForText + ld hl,wFontLoaded res 0,[hl] ld a,[wd732] bit 3,a ; used fly warp @@ -4540,7 +4540,7 @@ GetHealthBarColor:: ; Copy the current map's sprites' tile patterns to VRAM again after they have ; been overwritten by other tile patterns. ReloadMapSpriteTilePatterns:: ; 3e08 (0:3e08) - ld hl, wCharRAMInUseForText + ld hl, wFontLoaded ld a, [hl] push af res 0, [hl] diff --git a/main.asm b/main.asm index 1b59a5d0..cb77e5a3 100755 --- a/main.asm +++ b/main.asm @@ -1022,7 +1022,7 @@ DisplayTextIDInit: ; 7096 (1:7096) .drawTextBoxBorder call TextBoxBorder .skipDrawingTextBoxBorder - ld hl,wCharRAMInUseForText + ld hl,wFontLoaded set 0,[hl] ld hl,wFlags_0xcd60 bit 4,[hl] diff --git a/wram.asm b/wram.asm index 6aabd27a..7091bd4c 100755 --- a/wram.asm +++ b/wram.asm @@ -820,10 +820,11 @@ wcf97:: ds 1 ; LoadMonData copies mon data here wLoadedMon:: party_struct wLoadedMon ; cf98 -wCharRAMInUseForText:: ; cfc4 -; bit 0: the space in VRAM that is used to store walking tile patterns for -; the player and NPCs is in use for text tile patterns. this means -; that movement must be disabled. +wFontLoaded:: ; cfc4 +; bit 0: The space in VRAM that is used to store walk animation tile patterns +; for the player and NPCs is in use for font tile patterns. +; This means that NPC movement must be disabled. +; The other bits are unused. ds 1 wWalkCounter:: ; cfc5 -- cgit v1.3.1-sl0p