From 8f8281fe6ed02d8235ab9f92fa6ae93f50a3bf8e Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 23 May 2014 15:34:35 -0700 Subject: Comment some more bank 0 functions. --- engine/overworld/cut.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 6c888e7f..5712c904 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -35,7 +35,7 @@ asm_ef82: ; ef82 (3:6f82) ld hl, $d730 set 6, [hl] call GBPalWhiteOutWithDelay3 - call CleanLCD_OAM + call ClearSprites call Func_3dbe ld a, $90 ld [$ffb0], a -- cgit v1.2.3 From 031e33957dfaf9a5e29fb67aaf600ec809b8e35f Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 10:51:53 -0700 Subject: Rename joypad registers. --- engine/overworld/ledges.asm | 4 ++-- engine/overworld/npc_movement.asm | 4 ++-- engine/overworld/player_animations.asm | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index d2f248cd..12a78507 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -38,11 +38,11 @@ HandleLedges: ; 1a672 (6:6672) inc hl jr .asm_1a691 .asm_1a6a9 - ld a, [H_CURRENTPRESSEDBUTTONS] + ld a, [hJoyHeld] and e ret z ld a, $ff - ld [wJoypadForbiddenButtonsMask], a + ld [wJoyIgnore], a ld hl, $d736 set 6, [hl] call Func_3486 diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 54d7321b..92200353 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -4,7 +4,7 @@ Func_1a3e0: ; 1a3e0 (6:63e0) call HandleDoors jr nc, .asm_1a406 ld a, $fc - ld [wJoypadForbiddenButtonsMask], a + ld [wJoyIgnore], a ld hl, $d736 set 1, [hl] ld a, $1 @@ -76,7 +76,7 @@ Func_1a44c: ; 1a44c (6:644c) ld hl, W_FLAGS_D733 set 1, [hl] ld a, $fc - ld [wJoypadForbiddenButtonsMask], a + ld [wJoyIgnore], a ret Func_1a485: ; 1a485 (6:6485) diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 1af178c7..8e50259c 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -503,16 +503,16 @@ _HandleMidJump: ; 7087e (1c:487e) call UpdateSprites call Delay3 xor a - ld [H_CURRENTPRESSEDBUTTONS], a - ld [H_NEWLYPRESSEDBUTTONS], a - ld [H_NEWLYRELEASEDBUTTONS], a + ld [hJoyHeld], a + ld [hJoyPressed], a + ld [hJoyReleased], a ld [$d714], a ld hl, $d736 res 6, [hl] ld hl, $d730 res 7, [hl] xor a - ld [wJoypadForbiddenButtonsMask], a + ld [wJoyIgnore], a ret PlayerJumpingYScreenCoords: ; 708ba (1c:48ba) -- cgit v1.2.3 From 4be11293e5c7d6bf4a2fc374974545a21a5e3572 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 17:27:02 -0700 Subject: Label BCD math predefs. --- engine/overworld/hidden_items.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld') diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index db6bf1cd..ea032cbe 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -104,7 +104,7 @@ HiddenCoins: ; 76799 (1d:6799) ld de, $d5a5 ld hl, $ffa1 ld c, $2 - ld a, $b + ld a, $b ; AddBCDPredef call Predef ld hl, $d6fe ld a, [$cd41] -- cgit v1.2.3 From f6038a3d52a2d26271fdcba9639284301305d751 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 19:23:12 -0700 Subject: Try to clean up PrepareOAMData. --- engine/overworld/oam.asm | 178 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 engine/overworld/oam.asm (limited to 'engine/overworld') diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm new file mode 100644 index 00000000..040513b1 --- /dev/null +++ b/engine/overworld/oam.asm @@ -0,0 +1,178 @@ +PrepareOAMData: +; Determine OAM data for currently visible +; sprites and write it to wOAMBuffer. + + ld a, [$cfcb] + dec a + jr z, .asm_4b1e + + cp 0 - 1 + ret nz + ld [$cfcb], a + jp HideSprites + +.asm_4b1e + xor a + ld [$ff90], a +.asm_4b21 + ld [$ff8f], a + + ld d, wSpriteStateData1 / $100 + ld a, [$ff8f] + ld e, a + ld a, [de] ; c1x0 + and a + jp z, .asm_4bad + + inc e + inc e + ld a, [de] ; c1x2 (facing/anim) + ld [$d5cd], a + cp $ff ; off-screen (don't draw) + jr nz, .visible + + call Func_4bd1 + jr .asm_4bad + +.visible + cp $a0 + jr c, .usefacing + and $f + add $10 + jr .asm_4b48 + +.usefacing + and $f +.asm_4b48 + ld l, a + + push de + inc d + ld a, e + add $5 + ld e, a + ld a, [de] ; c2x7 + and $80 + ld [$ff94], a ; temp store sprite priority + pop de + + ld h, 0 + ld bc, SpriteFacingAndAnimationTable + add hl, hl + add hl, hl + add hl, bc + + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld a, [hli] + ld h, [hl] + ld l, a + + call Func_4bd1 + + ld a, [$ff90] + ld e, a + ld d, wOAMBuffer / $100 +.tile + ld a, [$ff92] ; temp for sprite Y position + add $10 ; Y=16 is top of screen (Y=0 is invisible) + add [hl] ; add Y offset from table + ld [de], a ; write new sprite OAM Y position + inc hl + ld a, [$ff91] ; temp for sprite X position + add $8 ; X=8 is left of screen (X=0 is invisible) + add [hl] ; add X offset from table + inc e + ld [de], a ; write new sprite OAM X position + inc e + ld a, [bc] ; read pattern number offset (accomodates orientation (offset 0,4 or 8) and animation (offset 0 or $80)) + inc bc + push bc + ld b, a + + ld a, [$d5cd] ; temp copy of c1x2 + swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) + and $f + + ; Sprites $a and $b have one face (and therefore 4 tiles instead of 12). + ; As a result, sprite $b's tile offset is less than normal. + cp $b + jr nz, .offset + ld a, $a * 12 + 4 + jr .gotoffset + +.offset + ; a *= 12 + sla a + sla a + ld c, a + sla a + add c +.gotoffset + add b ; which frame + pop bc + ld [de], a ; tile id + inc hl + inc e + ld a, [hl] + bit 1, a ; sprite priority + jr z, .fg + ld a, [$ff94] ; facing priority + or [hl] +.fg + inc hl + ld [de], a + inc e + bit 0, a ; OAMFLAG_ENDOFDATA + jr z, .tile + + ld a, e + ld [$ff90], a + +.asm_4bad + ld a, [$ff8f] + add $10 + cp $100 % $100 + jp nz, .asm_4b21 + + ; Clear unused OAM. + ld a, [$ff90] + ld l, a + ld h, wOAMBuffer / $100 + ld de, $4 + ld b, $a0 + ld a, [$d736] + bit 6, a + ld a, $a0 + jr z, .clear + ld a, $90 +.clear + cp l + ret z + ld [hl], b + add hl, de + jr .clear + +Func_4bd1: ; 4bd1 (1:4bd1) + inc e + inc e + ld a, [de] ; c1x4 + ld [$ff92], a + inc e + inc e + ld a, [de] ; c1x6 + ld [$ff91], a + ld a, $4 + add e + ld e, a + ld a, [$ff92] + add $4 + and $f0 + ld [de], a ; c1xa (y) + inc e + ld a, [$ff91] + and $f0 + ld [de], a ; c1xb (x) + ret -- cgit v1.2.3 From db569956efab02d4199a584b2916a188bce6b566 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 19:45:59 -0700 Subject: Split out overworld object movement. --- engine/overworld/movement.asm | 858 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 858 insertions(+) create mode 100644 engine/overworld/movement.asm (limited to 'engine/overworld') diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm new file mode 100644 index 00000000..842544a7 --- /dev/null +++ b/engine/overworld/movement.asm @@ -0,0 +1,858 @@ +UpdatePlayerSprite: ; 4e31 (1:4e31) + ld a, [wSpriteStateData2] + and a + jr z, .asm_4e41 + cp $ff + jr z, .asm_4e4a + dec a + ld [wSpriteStateData2], a + jr .asm_4e4a +.asm_4e41 + FuncCoord 8, 9 ; $c45c + ld a, [Coord] + ld [$ff93], a + cp $60 + jr c, .asm_4e50 +.asm_4e4a + ld a, $ff + ld [$c102], a + ret +.asm_4e50 + call Func_4c70 + ld h, $c1 + ld a, [wWalkCounter] ; $cfc5 + and a + jr nz, .asm_4e90 + ld a, [$d528] + bit 2, a + jr z, .asm_4e65 + xor a + jr .asm_4e86 +.asm_4e65 + bit 3, a + jr z, .asm_4e6d + ld a, $4 + jr .asm_4e86 +.asm_4e6d + bit 1, a + jr z, .asm_4e75 + ld a, $8 + jr .asm_4e86 +.asm_4e75 + bit 0, a + jr z, .asm_4e7d + ld a, $c + jr .asm_4e86 +.asm_4e7d + xor a + ld [$c107], a + ld [$c108], a + jr .asm_4eab +.asm_4e86 + ld [$c109], a + ld a, [$cfc4] + bit 0, a + jr nz, .asm_4e7d +.asm_4e90 + ld a, [$d736] + bit 7, a + jr nz, .asm_4eb6 + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld a, [hl] + inc a + ld [hl], a + cp $4 + jr nz, .asm_4eab + xor a + ld [hl], a + inc hl + ld a, [hl] + inc a + and $3 + ld [hl], a +.asm_4eab + ld a, [$c108] + ld b, a + ld a, [$c109] + add b + ld [$c102], a +.asm_4eb6 + ld a, [$ff93] + ld c, a + ld a, [W_GRASSTILE] + cp c + ld a, $0 + jr nz, .asm_4ec3 + ld a, $80 +.asm_4ec3 + ld [$c207], a + ret + +Func_4ec7: ; 4ec7 (1:4ec7) + push bc + push af + ld a, [$ffda] + ld c, a + pop af + add c + ld l, a + pop bc + ret + +Func_4ed1: ; 4ed1 (1:4ed1) + ld a, [H_CURRENTSPRITEOFFSET] + swap a + dec a + add a + ld hl, W_MAPSPRITEDATA ; $d4e4 + add l + ld l, a + ld a, [hl] ; read movement byte 2 + ld [wCurSpriteMovement2], a + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + inc l + ld a, [hl] ; c1x1 + and a + jp z, InitializeSpriteStatus + call CheckSpriteAvailability + ret c ; if sprite is invisible, on tile >=$60, in grass or player is currently walking + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + inc l + ld a, [hl] ; c1x1 + bit 7, a + jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 + ld b, a + ld a, [$cfc4] + bit 0, a + jp nz, notYetMoving + ld a, b + cp $2 + jp z, UpdateSpriteMovementDelay ; c1x1 == 2 + cp $3 + jp z, UpdateSpriteInWalkingAnimation ; c1x1 == 3 + ld a, [wWalkCounter] ; $cfc5 + and a + ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) + call InitializeSpriteScreenPosition + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $6 + ld l, a + ld a, [hl] ; c2x6: movement byte 1 + inc a + jr z, .asm_4f59 ; value $FF + inc a + jr z, .asm_4f59 ; value $FE + dec a + ld [hl], a ; (temporarily) increment movement byte 1 + dec a + push hl + ld hl, $cf0f + dec [hl] ; decrement $cf0f + pop hl + ld de, $cc5b + call LoadDEPlusA ; a = [$cc5b + movement byte 1] + cp $e0 + jp z, ChangeFacingDirection + cp $ff + jr nz, .asm_4f4b + ld [hl], a ; reset movement byte 1 to initial value + ld hl, $d730 + res 0, [hl] + xor a + ld [$cd38], a + ld [$cd3a], a + ret +.asm_4f4b + cp $fe + jr nz, .asm_4f5f + ld [hl], $1 ; set movement byte 1 to $1 + ld de, $cc5b + call LoadDEPlusA ; a = [$cc5b + $fe] (?) + jr .asm_4f5f +.asm_4f59 + call getTileSpriteStandsOn + call Random +.asm_4f5f + ld b, a + ld a, [wCurSpriteMovement2] + cp $d0 + jr z, .moveDown ; movement byte 2 = $d0 forces down + cp $d1 + jr z, .moveUp ; movement byte 2 = $d1 forces up + cp $d2 + jr z, .moveLeft ; movement byte 2 = $d2 forces left + cp $d3 + jr z, .moveRight ; movement byte 2 = $d3 forces right + ld a, b + cp $40 ; a < $40: down (or left) + jr nc, .notDown + ld a, [wCurSpriteMovement2] + cp $2 + jr z, .moveLeft ; movement byte 2 = $2 only allows left or right +.moveDown + ld de, 2*20 + add hl, de ; move tile pointer two rows down + ld de, $100 + + ld bc, $400 + jr TryWalking +.notDown + cp $80 ; $40 <= a < $80: up (or right) + jr nc, .notUp + ld a, [wCurSpriteMovement2] + cp $2 + jr z, .moveRight ; movement byte 2 = $2 only allows left or right +.moveUp + ld de, -2*20 ; $ffd8 + add hl, de ; move tile pointer two rows up + ld de, $ff00 + ld bc, $804 + jr TryWalking +.notUp + cp $c0 ; $80 <= a < $c0: left (or up) + jr nc, .notLeft + ld a, [wCurSpriteMovement2] + cp $1 + jr z, .moveUp ; movement byte 2 = $1 only allows up or down +.moveLeft + dec hl + dec hl ; move tile pointer two columns left + ld de, $ff + ld bc, $208 + jr TryWalking +.notLeft ; $c0 <= a: right (or down) + ld a, [wCurSpriteMovement2] + cp $1 + jr z, .moveDown ; movement byte 2 = $1 only allows up or down +.moveRight + inc hl + inc hl ; move tile pointer two columns right + ld de, $1 + ld bc, $10c + jr TryWalking + +; changes facing direction by zeroing the movement delta and calling TryWalking +ChangeFacingDirection: ; 4fc8 (1:4fc8) + ld de, $0 + ; fall through + +; b: direction (1,2,4 or 8) +; c: new facing direction (0,4,8 or $c) +; d: Y movement delta (-1, 0 or 1) +; e: X movement delta (-1, 0 or 1) +; hl: pointer to tile the sprite would wlak onto +; set carry on failure, clears carry on success +TryWalking: ; 4fcb (1:4fcb) + push hl + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld [hl], c ; c1x9 (update facing direction) + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld [hl], d ; c1x3 (update Y movement delta) + inc l + inc l + ld [hl], e ; c1x5 (update X movement delta) + pop hl + push de + ld c, [hl] ; read tile to walk onto + call CanWalkOntoTile + pop de + ret c ; cannot walk there (reinitialization of delay values already done) + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [hl] ; c2x4: Y position + add d + ld [hli], a ; update Y position + ld a, [hl] ; c2x5: X position + add e + ld [hl], a ; update X position + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + ld [hl], $10 ; c2x0=16: walk animation counter + dec h + inc l + ld [hl], $3 ; c1x1: set movement status to walking + jp UpdateSpriteImage + +; update the walking animation parameters for a sprite that is currently walking +UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe) + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld a, [hl] ; c1x7 (counter until next walk animation frame) + inc a + ld [hl], a ; c1x7 += 1 + cp $4 + jr nz, .noNextAnimationFrame + xor a + ld [hl], a ; c1x7 = 0 + inc l + ld a, [hl] ; c1x8 (walk animation frame) + inc a + and $3 + ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) +.noNextAnimationFrame + ld a, [H_CURRENTSPRITEOFFSET] + add $3 + ld l, a + ld a, [hli] ; c1x3 (movement Y delta) + ld b, a + ld a, [hl] ; c1x4 (screen Y position) + add b + ld [hli], a ; update screen Y position + ld a, [hli] ; c1x5 (movement X delta) + ld b, a + ld a, [hl] ; c1x6 (screen X position) + add b + ld [hl], a ; update screen X position + ld a, [H_CURRENTSPRITEOFFSET] + ld l, a + inc h + ld a, [hl] ; c2x0 (walk animantion counter) + dec a + ld [hl], a ; update walk animantion counter + ret nz + ld a, $6 ; walking finished, update state + add l + ld l, a + ld a, [hl] ; c2x6 (movement byte 1) + cp $fe + jr nc, .initNextMovementCounter ; values $fe and $ff + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + dec h + ld [hl], $1 ; c1x1 = 1 (movement status ready) + ret +.initNextMovementCounter + call Random + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + ld a, [hRandomAdd] + and $7f + ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] + dec h ; note that value 0 actually makes the delay $100 (bug?) + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld [hl], $2 ; c1x1 = 2 (movement status) + inc l + inc l + xor a + ld b, [hl] ; c1x3 (movement Y delta) + ld [hli], a ; reset movement Y delta + inc l + ld c, [hl] ; c1x5 (movement X delta) + ld [hl], a ; reset movement X delta + ret + +; update delay value (c2x8) for sprites in the delayed state (c1x1) +UpdateSpriteMovementDelay: ; 5057 (1:5057) + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $6 + ld l, a + ld a, [hl] ; c2x6: movement byte 1 + inc l + inc l + cp $fe + jr nc, .tickMoveCounter ; values $fe or $ff + ld [hl], $0 + jr .moving +.tickMoveCounter + dec [hl] ; c2x8: frame counter until next movement + jr nz, notYetMoving +.moving + dec h + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld [hl], $1 ; c1x1 = 1 (mark as ready to move) +notYetMoving: ; 5073 (1:5073) + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + ld [hl], $0 ; c1x8 = 0 (walk animation frame) + jp UpdateSpriteImage + +InitializeSpriteFacingDirection: ; 507f (1:507f) + ld a, [$d72d] + bit 5, a + jr nz, notYetMoving + res 7, [hl] + ld a, [$d52a] + bit 3, a + jr z, .notFacingDown + ld c, $0 ; make sprite face down + jr .facingDirectionDetermined +.notFacingDown + bit 2, a + jr z, .notFacingUp + ld c, $4 ; make sprite face up + jr .facingDirectionDetermined +.notFacingUp + bit 1, a + jr z, .notFacingRight + ld c, $c ; make sprite face right + jr .facingDirectionDetermined +.notFacingRight + ld c, $8 ; make sprite face left +.facingDirectionDetermined + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld [hl], c ; c1x9: set facing direction + jr notYetMoving + +InitializeSpriteStatus: ; 50ad (1:50ad) + ld [hl], $1 ; $c1x1: set movement status to ready + inc l + ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen) + inc h + ld a, [H_CURRENTSPRITEOFFSET] + add $2 + ld l, a + ld a, $8 + ld [hli], a ; $c2x2: set Y displacement to 8 + ld [hl], a ; $c2x3: set X displacement to 8 + ret + +; calculates the spprite's scrren position form its map position and the player position +InitializeSpriteScreenPosition: ; 50bd (1:50bd) + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [W_YCOORD] ; $d361 + ld b, a + ld a, [hl] ; c2x4 (Y position + 4) + sub b ; relative to player position + swap a ; * 16 + sub $4 ; - 4 + dec h + ld [hli], a ; c1x4 (screen Y position) + inc h + ld a, [W_XCOORD] ; $d362 + ld b, a + ld a, [hli] ; c2x6 (X position + 4) + sub b ; relative to player position + swap a ; * 16 + dec h + ld [hl], a ; c1x6 (screen X position) + ret + +; tests if sprite is off screen or otherwise unable to do anything +CheckSpriteAvailability: ; 50dc (1:50dc) + ld a, $12 + call Predef ; indirect jump to IsMissableObjectHidden (f1a6 (3:71a6)) + ld a, [$ffe5] + and a + jp nz, .spriteInvisible + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $6 + ld l, a + ld a, [hl] ; c2x6: movement byte 1 + cp $fe + jr c, .skipXVisibilityTest ; movement byte 1 < $fe + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld b, [hl] ; c2x4: Y pos (+4) + ld a, [W_YCOORD] ; $d361 + cp b + jr z, .skipYVisibilityTest + jr nc, .spriteInvisible ; above screen region + add $8 ; screen is 9 tiles high + cp b + jr c, .spriteInvisible ; below screen region +.skipYVisibilityTest + inc l + ld b, [hl] ; c2x5: X pos (+4) + ld a, [W_XCOORD] ; $d362 + cp b + jr z, .skipXVisibilityTest + jr nc, .spriteInvisible ; left of screen region + add $9 ; screen is 10 tiles wide + cp b + jr c, .spriteInvisible ; right of screen region +.skipXVisibilityTest + call getTileSpriteStandsOn + ld d, $60 + ld a, [hli] + cp d + jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom left tile) + ld a, [hld] + cp d + jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom right tile) + ld bc, -20 ; $ffec + add hl, bc ; go back one row of tiles + ld a, [hli] + cp d + jr nc, .spriteInvisible ; standing on tile with ID >=$60 (top left tile) + ld a, [hl] + cp d + jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile) +.spriteInvisible + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $2 + ld l, a + ld [hl], $ff ; c1x2 + scf + jr .done +.spriteVisible + ld c, a + ld a, [wWalkCounter] ; $cfc5 + and a + jr nz, .done ; if player is currently walking, we're done + call UpdateSpriteImage + inc h + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld a, [W_GRASSTILE] + cp c + ld a, $0 + jr nz, .notInGrass + ld a, $80 +.notInGrass + ld [hl], a ; c2x7 + and a +.done + ret + +UpdateSpriteImage: ; 5157 (1:5157) + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + ld a, [hli] ; c1x8: walk animation frame + ld b, a + ld a, [hl] ; c1x9: facing direction + add b + ld b, a + ld a, [$ff93] ; current sprite offset + add b + ld b, a + ld a, [H_CURRENTSPRITEOFFSET] + add $2 + ld l, a + ld [hl], b ; c1x2: sprite to display + ret + +; tests if sprite can walk the specified direction +; b: direction (1,2,4 or 8) +; c: ID of tile the sprite would walk onto +; d: Y movement delta (-1, 0 or 1) +; e: X movement delta (-1, 0 or 1) +; set carry on failure, clears carry on success +CanWalkOntoTile: ; 516e (1:516e) + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $6 + ld l, a + ld a, [hl] ; c2x6 (movement byte 1) + cp $fe + jr nc, .canMove ; values $fe and $ff + and a + ret +.canMove + ld a, [W_TILESETCOLLISIONPTR] + ld l, a + ld a, [W_TILESETCOLLISIONPTR+1] + ld h, a +.tilePassableLoop + ld a, [hli] + cp $ff + jr z, .impassable + cp c + jr nz, .tilePassableLoop + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $6 + ld l, a + ld a, [hl] ; $c2x6 (movement byte 1) + inc a + jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [hli] ; c1x4 (screen Y pos) + add $4 ; align to blocks (Y pos is always 4 pixels off) + add d ; add Y delta + cp $80 ; if value is >$80, the destination is off screen (either $81 or $FF underflow) + jr nc, .impassable ; don't walk off screen + inc l + ld a, [hl] ; c1x6 (screen X pos) + add e ; add X delta + cp $90 ; if value is >$90, the destination is off screen (either $91 or $FF underflow) + jr nc, .impassable ; don't walk off screen + push de + push bc + call Func_4c70 + pop bc + pop de + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $c + ld l, a + ld a, [hl] ; c1xc (forbidden directions flags(?)) + and b ; check against chosen direction (1,2,4 or 8) + jr nz, .impassable ; direction forbidden, don't go there + ld h, $c2 + ld a, [H_CURRENTSPRITEOFFSET] + add $2 + ld l, a + ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go) + bit 7, d ; check if going upwards (d=$ff) + jr nz, .upwards + add d + cp $5 + jr c, .impassable ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites + jr .checkHorizontal ; from walking out too far, but this line makes sprites get stuck +.upwards ; whenever they walked upwards 5 steps + sub $1 ; on the other hand, the amount a sprite can walk out to the + jr c, .impassable ; if d2x2 == 0, don't go ; right of bottom is not limited (until the counter overflows) +.checkHorizontal + ld d, a + ld a, [hl] ; c2x3 (sprite X displacement, initialized at $8, keep track of where a sprite did go) + bit 7, e ; check if going left (e=$ff) + jr nz, .left + add e + cp $5 ; compare, but no conditional jump like in the vertical check above (bug?) + jr .passable +.left + sub $1 + jr c, .impassable ; if d2x3 == 0, don't go +.passable + ld [hld], a ; update c2x3 + ld [hl], d ; update c2x2 + and a ; clear carry (marking success) + ret +.impassable + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + inc a + ld l, a + ld [hl], $2 ; c1x1 = 2 (set movement status to delayed) + inc l + inc l + xor a + ld [hli], a ; c1x3 = 0 (clear Y movement delta) + inc l + ld [hl], a ; c1x5 = 0 (clear X movement delta) + inc h + ld a, [H_CURRENTSPRITEOFFSET] + add $8 + ld l, a + call Random + ld a, [hRandomAdd] + and $7f + ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] (again with delay $100 if value is 0) + scf ; set carry (marking failure to walk) + ret + +; calculates the tile pointer pointing to the tile the current sprite stancs on +; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to +; hl: output pointer +getTileSpriteStandsOn: ; 5207 (1:5207) + ld h, $c1 + ld a, [H_CURRENTSPRITEOFFSET] + add $4 + ld l, a + ld a, [hli] ; c1x4: screen Y position + add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top) + and $f0 ; in case object is currently moving + srl a ; screen Y tile * 4 + ld c, a + ld b, $0 + inc l + ld a, [hl] ; c1x6: screen Y position + srl a + srl a + srl a ; screen X tile + add $14 ; screen X tile + 20 + ld d, $0 + ld e, a + ld hl, wTileMap + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, de ; wTileMap + 20*(screen Y tile + 1) + screen X tile + ret + +; loads [de+a] into a +LoadDEPlusA: ; 522f (1:522f) + add e + ld e, a + jr nc, .noCarry + inc d +.noCarry + ld a, [de] + ret + +Func_5236: ; 5236 (1:5236) + ld a, [$d730] + bit 7, a + ret z + ld hl, $d72e + bit 7, [hl] + set 7, [hl] + jp z, Func_52a6 + ld hl, $cc97 + ld a, [$cd37] + add l + ld l, a + jr nc, .asm_5251 + inc h +.asm_5251 + ld a, [hl] + cp $40 + jr nz, .asm_525f + call Func_52b2 + ld c, $4 + ld a, $fe + jr .asm_5289 +.asm_525f + cp $0 + jr nz, .asm_526c + call Func_52b2 + ld c, $0 + ld a, $2 + jr .asm_5289 +.asm_526c + cp $80 + jr nz, .asm_5279 + call Func_52b7 + ld c, $8 + ld a, $fe + jr .asm_5289 +.asm_5279 + cp $c0 + jr nz, .asm_5286 + call Func_52b7 + ld c, $c + ld a, $2 + jr .asm_5289 +.asm_5286 + cp $ff + ret +.asm_5289 + ld b, a + ld a, [hl] + add b + ld [hl], a + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld a, c + ld [hl], a + call Func_52c3 + ld hl, $cf18 + dec [hl] + ret nz + ld a, $8 + ld [$cf18], a + ld hl, $cd37 + inc [hl] + ret + +Func_52a6: ; 52a6 (1:52a6) + xor a + ld [$cd37], a + ld a, $8 + ld [$cf18], a + jp Func_52c3 + +Func_52b2: ; 52b2 (1:52b2) + ld a, $4 + ld b, a + jr asm_52ba + +Func_52b7: ; 52b7 (1:52b7) + ld a, $6 + ld b, a +asm_52ba: ; 52ba (1:52ba) + ld hl, wSpriteStateData1 + ld a, [H_CURRENTSPRITEOFFSET] + add l + add b + ld l, a + ret + +Func_52c3: ; 52c3 (1:52c3) + ld hl, wSpriteStateData2 + ld a, [H_CURRENTSPRITEOFFSET] + add $e + ld l, a + ld a, [hl] + dec a + swap a + ld b, a + ld hl, wSpriteStateData1 + ld a, [H_CURRENTSPRITEOFFSET] + add $9 + ld l, a + ld a, [hl] + cp $0 + jr z, .asm_52ea + cp $4 + jr z, .asm_52ea + cp $8 + jr z, .asm_52ea + cp $c + jr z, .asm_52ea + ret +.asm_52ea + add b + ld b, a + ld [$ffe9], a + call Func_5301 + ld hl, wSpriteStateData1 + ld a, [H_CURRENTSPRITEOFFSET] + add $2 + ld l, a + ld a, [$ffe9] + ld b, a + ld a, [$ffea] + add b + ld [hl], a + ret + +Func_5301: ; 5301 (1:5301) + ld a, [H_CURRENTSPRITEOFFSET] + add $7 + ld l, a + ld a, [hl] + inc a + ld [hl], a + cp $4 + ret nz + xor a + ld [hl], a + inc l + ld a, [hl] + inc a + and $3 + ld [hl], a + ld [$ffea], a + ret -- cgit v1.2.3 From 41906725d0736f954ac3a0b596d2b94ed97332bd Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 19:48:35 -0700 Subject: Split out item fragment code. --- engine/overworld/item.asm | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 engine/overworld/item.asm (limited to 'engine/overworld') diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm new file mode 100644 index 00000000..afc146f1 --- /dev/null +++ b/engine/overworld/item.asm @@ -0,0 +1,55 @@ +PickupItem: + call EnableAutoTextBoxDrawing + + ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c + ld b, a + ld hl, W_MISSABLEOBJECTLIST +.missableObjectsListLoop + ld a, [hli] + cp $ff + ret z + cp b + jr z, .isMissable + inc hl + jr .missableObjectsListLoop + +.isMissable + ld a, [hl] + ld [$ffdb], a + + ld hl, W_MAPSPRITEEXTRADATA + ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c + dec a + add a + ld d, 0 + ld e, a + add hl, de + ld a, [hl] + ld b, a ; item + ld c, 1 ; quantity + call GiveItem + jr nc, .BagFull + + ld a, [$ffdb] + ld [$cc4d], a + ld a, $11 ; RemoveMissableObject + call Predef + ld a, 1 + ld [$cc3c], a + ld hl, FoundItemText + jr .print + +.BagFull + ld hl, NoMoreRoomForItemText +.print + call PrintText + ret + +FoundItemText: + TX_FAR _FoundItemText + db $0B + db "@" + +NoMoreRoomForItemText: + TX_FAR _NoMoreRoomForItemText + db "@" -- cgit v1.2.3 From 40c17c906b2b3f65b3b04b1933b90238a7ac5566 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 26 May 2014 14:04:56 -0700 Subject: Remove most static wram addresses. Use labels instead. For unknown addresses, use "w
". Label overleads are still an issue. --- engine/overworld/cable_club_npc.asm | 28 +++--- engine/overworld/card_key.asm | 18 ++-- engine/overworld/cinnabar_lab.asm | 38 ++++---- engine/overworld/cut.asm | 48 +++++----- engine/overworld/cut2.asm | 42 ++++----- engine/overworld/doors.asm | 4 +- engine/overworld/elevator.asm | 4 +- engine/overworld/emotion_bubbles.asm | 22 ++--- engine/overworld/healing_machine.asm | 20 ++--- engine/overworld/hidden_items.asm | 38 ++++---- engine/overworld/hidden_objects.asm | 40 ++++----- engine/overworld/item.asm | 4 +- engine/overworld/ledges.asm | 18 ++-- engine/overworld/map_sprites.asm | 26 +++--- engine/overworld/movement.asm | 82 ++++++++--------- engine/overworld/npc_movement.asm | 148 +++++++++++++++--------------- engine/overworld/oaks_aide.asm | 4 +- engine/overworld/oam.asm | 10 +-- engine/overworld/pewter_guys.asm | 12 +-- engine/overworld/player_animations.asm | 158 ++++++++++++++++----------------- engine/overworld/pokecenter.asm | 16 ++-- engine/overworld/pokemart.asm | 82 ++++++++--------- engine/overworld/ssanne.asm | 14 +-- engine/overworld/trainers.asm | 92 +++++++++---------- 24 files changed, 484 insertions(+), 484 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm index 88bf177f..9ae5b508 100755 --- a/engine/overworld/cable_club_npc.asm +++ b/engine/overworld/cable_club_npc.asm @@ -1,7 +1,7 @@ CableClubNPC: ; 71c5 (1:71c5) ld hl, CableClubNPCText1 call PrintText - ld a, [$d74b] + ld a, [wd74b] bit 5, a jp nz, Func_71e1 ld c, $3c @@ -12,9 +12,9 @@ CableClubNPC: ; 71c5 (1:71c5) Func_71e1: ; 71e1 (1:71e1) ld a, $1 - ld [$cc34], a + ld [wMenuJoypadPollCount], a ld a, $5a - ld [$cc47], a + ld [wcc47], a .asm_71eb ld a, [$ffaa] cp $2 @@ -29,9 +29,9 @@ Func_71e1: ; 71e1 (1:71e1) ld [$ffad], a ld a, $80 ld [$ff02], a - ld a, [$cc47] + ld a, [wcc47] dec a - ld [$cc47], a + ld [wcc47], a jr z, .asm_7287 ; 0x720b $7a ld a, $1 ld [$ff01], a @@ -48,11 +48,11 @@ Func_71e1: ; 71e1 (1:71e1) ld hl, CableClubNPCText2 call PrintText xor a - ld [$cc34], a + ld [wMenuJoypadPollCount], a call YesNoChoice ld a, $1 - ld [$cc34], a - ld a, [$cc26] + ld [wMenuJoypadPollCount], a + ld a, [wCurrentMenuItem] and a jr nz, .asm_728f ; 0x723e $4f callab SaveSAVtoSRAM @@ -61,15 +61,15 @@ Func_71e1: ; 71e1 (1:71e1) call PlaySoundWaitForCurrent ld hl, CableClubNPCText3 call PrintText - ld hl, $cc47 + ld hl, wcc47 ld a, $3 ld [hli], a xor a ld [hl], a ld [$ffa9], a - ld [$cc42], a + ld [wcc42], a call Func_227f - ld hl, $cc47 + ld hl, wcc47 ld a, [hli] inc a jr nz, Func_72a8 ; 0x726b $3b @@ -98,13 +98,13 @@ Func_71e1: ; 71e1 (1:71e1) Func_7298: ; 7298 (1:7298) xor a - ld hl, $cc47 + ld hl, wcc47 ld [hli], a ld [hl], a - ld hl, $d72e + ld hl, wd72e res 6, [hl] xor a - ld [$cc34], a + ld [wMenuJoypadPollCount], a ret Func_72a8: ; 72a8 (1:72a8) diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 658f4712..0dbbb665 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -10,7 +10,7 @@ PrintCardKeyText: ; 52673 (14:6673) jr nz, .asm_5267a ld a, $35 call Predef ; indirect jump to Func_c586 (c586 (3:4586)) - ld a, [$cfc6] + ld a, [wcfc6] cp $18 jr z, .asm_5269c cp $24 @@ -35,12 +35,12 @@ PrintCardKeyText: ; 52673 (14:6673) srl d ld a, d ld b, a - ld [$d73f], a + ld [wd73f], a srl e ld a, e ld c, a - ld [$d740], a - ld a, [W_CURMAP] ; $d35e + ld [wd740], a + ld a, [W_CURMAP] ; W_CURMAP cp SILPH_CO_11F jr nz, .asm_526c8 ld a, $3 @@ -48,10 +48,10 @@ PrintCardKeyText: ; 52673 (14:6673) .asm_526c8 ld a, $e .asm_526ca - ld [$d09f], a + ld [wd09f], a ld a, $17 call Predef ; indirect jump to Func_ee9e - ld hl, $d126 + ld hl, wd126 set 5, [hl] ld a, (SFX_1f_57 - SFX_Headers_1f) / 3 jp PlaySound @@ -84,11 +84,11 @@ CardKeyFailText: ; 526f8 (14:66f8) db "@" Func_526fd: ; 526fd (14:66fd) - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 ld d, a - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 ld e, a - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] and a jr nz, .asm_5270d inc d diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index 4087b334..bb202333 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -1,18 +1,18 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) - ld hl, $d730 + ld hl, wd730 set 6, [hl] xor a - ld [wCurrentMenuItem], a ; $cc26 + ld [wCurrentMenuItem], a ; wCurrentMenuItem ld a, $3 - ld [wMenuWatchedKeys], a ; $cc29 - ld a, [$cd37] + ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld a, [wcd37] dec a - ld [wMaxMenuItem], a ; $cc28 + ld [wMaxMenuItem], a ; wMaxMenuItem ld a, $2 - ld [wTopMenuItemY], a ; $cc24 + ld [wTopMenuItemY], a ; wTopMenuItemY ld a, $1 - ld [wTopMenuItemX], a ; $cc25 - ld a, [$cd37] + ld [wTopMenuItemX], a ; wTopMenuItemX + ld a, [wcd37] dec a ld bc, $2 ld hl, $3 @@ -24,13 +24,13 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) call TextBoxBorder call UpdateSprites call Func_610c2 - ld hl, $d730 + ld hl, wd730 res 6, [hl] call HandleMenuInput bit 1, a jr nz, .asm_610a7 - ld hl, $cc5b - ld a, [wCurrentMenuItem] ; $cc26 + ld hl, wcc5b + ld a, [wCurrentMenuItem] ; wCurrentMenuItem ld d, $0 ld e, a add hl, de @@ -55,7 +55,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) ld hl, LabFossil_610ae call PrintText call YesNoChoice - ld a, [wCurrentMenuItem] ; $cc26 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem and a jr nz, .asm_610a7 ld hl, LabFossil_610b3 @@ -65,7 +65,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006) callba RemoveItemByID ld hl, LabFossil_610b8 call PrintText - ld hl, $d7a3 + ld hl, wd7a3 set 0, [hl] set 1, [hl] ret @@ -91,7 +91,7 @@ LabFossil_610bd: ; 610bd (18:50bd) db "@" Func_610c2: ; 610c2 (18:50c2) - ld hl, $cc5b + ld hl, wcc5b xor a ld [$ffdb], a .asm_610c8 @@ -99,14 +99,14 @@ Func_610c2: ; 610c2 (18:50c2) cp $ff ret z push hl - ld [$d11e], a + ld [wd11e], a call GetItemName - FuncCoord 2, 2 ; $c3ca + FuncCoord 2, 2 ld hl, Coord ld a, [$ffdb] ld bc, $28 call AddNTimes - ld de, $cd6d + ld de, wcd6d call PlaceString ld hl, $ffdb inc [hl] @@ -116,10 +116,10 @@ Func_610c2: ; 610c2 (18:50c2) ; loads the names of the fossil item and the resulting mon LoadFossilItemAndMonName: ; 610eb (18:50eb) ld a, [W_FOSSILMON] - ld [$d11e], a + ld [wd11e], a call GetMonName call CopyStringToCF4B ld a, [W_FOSSILITEM] - ld [$d11e], a + ld [wd11e], a call GetItemName ret diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 5712c904..78945c59 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -1,18 +1,18 @@ UsedCut: ; ef54 (3:6f54) xor a - ld [$cd6a], a - ld a, [W_CURMAPTILESET] ; $d367 + ld [wcd6a], a + ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET and a ; OVERWORLD jr z, .asm_ef6b cp GYM jr nz, .asm_ef77 - ld a, [$cfc6] + ld a, [wcfc6] cp $50 ; gym cut tree jr nz, .asm_ef77 jr asm_ef82 .asm_ef6b dec a - ld a, [$cfc6] + ld a, [wcfc6] cp $3d ; cut tree jr z, asm_ef82 cp $52 ; grass @@ -26,13 +26,13 @@ NothingToCutText: ; ef7d (3:6f7d) db "@" asm_ef82: ; ef82 (3:6f82) - ld [$cd4d], a + ld [wcd4d], a ld a, $1 - ld [$cd6a], a - ld a, [wWhichPokemon] ; $cf92 - ld hl, W_PARTYMON1NAME ; $d2b5 + ld [wcd6a], a + ld a, [wWhichPokemon] ; wWhichPokemon + ld hl, W_PARTYMON1NAME ; W_PARTYMON1NAME call GetPartyMonName - ld hl, $d730 + ld hl, wd730 set 6, [hl] call GBPalWhiteOutWithDelay3 call ClearSprites @@ -49,17 +49,17 @@ asm_ef82: ; ef82 (3:6f82) ld hl, UsedCutText call PrintText call LoadScreenTilesFromBuffer2 - ld hl, $d730 + ld hl, wd730 res 6, [hl] ld a, $ff - ld [$cfcb], a + ld [wcfcb], a call AnimateCutTree ld de, CutTreeBlockSwaps ; $7100 call Func_f09f call Func_eedc callba Func_79e96 ld a, $1 - ld [$cfcb], a + ld [wcfcb], a ld a, (SFX_02_56 - SFX_Headers_02) / 3 call PlaySound ld a, $90 @@ -73,10 +73,10 @@ UsedCutText: ; eff2 (3:6ff2) AnimateCutTree: ; eff7 (3:6ff7) xor a - ld [$cd50], a + ld [wcd50], a ld a, $e4 ld [rOBP1], a ; $ff49 - ld a, [$cd4d] + ld a, [wcd4d] cp $52 jr z, .asm_f020 ld de, Overworld_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row @@ -98,7 +98,7 @@ AnimateCutTree: ; eff7 (3:6ff7) ld hl, $8ff0 call LoadCutTreeOAM call asm_f055 - ld hl, $c393 + ld hl, wOAMBuffer + $93 ld de, $4 ld a, $30 ld c, e @@ -125,7 +125,7 @@ CutTreeOAM: ; f060 (3:7060) db $FE,$10,$FF,$10 Func_f068: ; f068 (3:7068) - ld hl, $c104 + ld hl, wSpriteStateData1 + 4 ld a, [hli] ld b, a inc hl @@ -137,7 +137,7 @@ Func_f068: ; f068 (3:7068) srl a ld e, a ld d, $0 ; de holds direction (00: down, 02: up, 04: left, 06: right) - ld a, [$cd50] + ld a, [wcd50] and a ld hl, CutTreeAnimationOffsets ; $708f jr z, .asm_f084 @@ -173,39 +173,39 @@ CutTreeAnimationOffsets2: ; f097 (3:7097) Func_f09f: ; f09f (3:709f) push de - ld a, [W_CURMAPWIDTH] ; $d369 + ld a, [W_CURMAPWIDTH] ; wd369 add $6 ld c, a ld b, $0 ld d, $0 - ld hl, $d35f + ld hl, wd35f ld a, [hli] ld h, [hl] ld l, a add hl, bc - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] and a jr z, .asm_f0c7 cp $4 jr z, .asm_f0cf cp $8 jr z, .asm_f0d7 - ld a, [W_XBLOCKCOORD] ; $d364 + ld a, [W_XBLOCKCOORD] ; wd364 and a jr z, .asm_f0e0 jr .asm_f0ec .asm_f0c7 - ld a, [W_YBLOCKCOORD] ; $d363 + ld a, [W_YBLOCKCOORD] ; wd363 and a jr z, .asm_f0e0 jr .asm_f0df .asm_f0cf - ld a, [W_YBLOCKCOORD] ; $d363 + ld a, [W_YBLOCKCOORD] ; wd363 and a jr z, .asm_f0e1 jr .asm_f0e0 .asm_f0d7 - ld a, [W_XBLOCKCOORD] ; $d364 + ld a, [W_XBLOCKCOORD] ; wd364 and a jr z, .asm_f0e6 jr .asm_f0e0 diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index c83e571b..08f6d651 100755 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -1,18 +1,18 @@ Func_79e96: ; 79e96 (1e:5e96) - ld a, [$cd4d] + ld a, [wcd4d] cp $52 jr z, .asm_79ec8 ld c, $8 .asm_79e9f push bc - ld hl, $c391 + ld hl, wOAMBuffer + $91 ld a, $1 - ld [$d08a], a + ld [wd08a], a ld c, $2 call Func_79339 - ld hl, $c399 + ld hl, wOAMBuffer + $99 ld a, $ff - ld [$d08a], a + ld [wd08a], a ld c, $2 call Func_79339 ld a, [rOBP1] ; $ff49 @@ -33,9 +33,9 @@ Func_79e96: ; 79e96 (1e:5e96) ld c, $8 call Func_79eed call Func_79f30 - ld hl, $c390 + ld hl, wOAMBuffer + $90 ld a, $2 - ld [$d08a], a + ld [wd08a], a ld c, $4 call Func_79352 pop bc @@ -45,24 +45,24 @@ Func_79e96: ; 79e96 (1e:5e96) Func_79eed: ; 79eed (1e:5eed) push bc - ld hl, $c391 + ld hl, wOAMBuffer + $91 ld a, $1 - ld [$d08a], a + ld [wd08a], a ld c, $1 call Func_79339 - ld hl, $c395 + ld hl, wOAMBuffer + $95 ld a, $2 - ld [$d08a], a + ld [wd08a], a ld c, $1 call Func_79339 - ld hl, $c399 + ld hl, wOAMBuffer + $99 ld a, $fe - ld [$d08a], a + ld [wd08a], a ld c, $1 call Func_79339 - ld hl, $c39d + ld hl, wOAMBuffer + $9d ld a, $ff - ld [$d08a], a + ld [wd08a], a ld c, $1 call Func_79339 ld a, [rOBP1] ; $ff49 @@ -75,15 +75,15 @@ Func_79eed: ; 79eed (1e:5eed) ret Func_79f30: ; 79f30 (1e:5f30) - ld hl, $c390 - ld de, $cee9 + ld hl, wOAMBuffer + $90 + ld de, wHPBarMaxHP ld bc, $8 call CopyData - ld hl, $c398 - ld de, $c390 + ld hl, wOAMBuffer + $98 + ld de, wOAMBuffer + $90 ld bc, $8 call CopyData - ld hl, $cee9 - ld de, $c398 + ld hl, wHPBarMaxHP + ld de, wOAMBuffer + $98 ld bc, $8 jp CopyData diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm index ff58b752..6337f511 100755 --- a/engine/overworld/doors.asm +++ b/engine/overworld/doors.asm @@ -1,7 +1,7 @@ HandleDoors: ; 1a609 (6:6609) push de ld hl, DoorTileIDPointers ; $662c - ld a, [W_CURMAPTILESET] ; $d367 + ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET ld de, $3 call IsInArray pop de @@ -10,7 +10,7 @@ HandleDoors: ; 1a609 (6:6609) ld a, [hli] ld h, [hl] ld l, a - FuncCoord 8, 9 ; $c45c + FuncCoord 8, 9 ld a, [Coord] ld b, a .asm_1a621 diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index e483e0c3..10b3b003 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -34,14 +34,14 @@ ShakeElevator: ; 7bf15 (1e:7f15) ld a, (SFX_02_5f - SFX_Headers_02) / 3 call PlayMusic .asm_7bf57 - ld a, [$c02a] + ld a, [wc02a] cp $b9 jr z, .asm_7bf57 call UpdateSprites jp Func_2307 Func_7bf64: ; 7bf64 (1e:7f64) - ld hl, $d527 + ld hl, wd527 ld a, [hld] push af ld a, [hl] diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index b480c06d..12cae862 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -1,5 +1,5 @@ PrintEmotionBubble: ; 17c47 (5:7c47) - ld a, [$cd50] + ld a, [wcd50] ld c, a ld b, $0 ld hl, EmotionBubblesPointerTable ; $7caf @@ -11,17 +11,17 @@ PrintEmotionBubble: ; 17c47 (5:7c47) ld hl, $8f80 ld bc, (BANK(EmotionBubblesPointerTable) << 8) + $04 call CopyVideoData - ld a, [$cfcb] + ld a, [wcfcb] push af ld a, $ff - ld [$cfcb], a - ld a, [$d736] + ld [wcfcb], a + ld a, [wd736] bit 6, a - ld hl, $c38f - ld de, $c39f + ld hl, wOAMBuffer + $8f + ld de, wOAMBuffer + $9f jr z, .asm_17c7a - ld hl, $c37f - ld de, $c38f + ld hl, wOAMBuffer + $7f + ld de, wOAMBuffer + $8f .asm_17c7a ld bc, $90 .asm_17c7d @@ -33,8 +33,8 @@ PrintEmotionBubble: ; 17c47 (5:7c47) ld a, c or b jr nz, .asm_17c7d - ld hl, $c104 - ld a, [$cd4f] + ld hl, wSpriteStateData1 + 4 + ld a, [wcd4f] swap a ld c, a ld b, $0 @@ -51,7 +51,7 @@ PrintEmotionBubble: ; 17c47 (5:7c47) ld c, $3c call DelayFrames pop af - ld [$cfcb], a + ld [wcfcb], a call DelayFrame jp UpdateSprites diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 77ff4ccc..1dcb5054 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -3,7 +3,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld hl, $87c0 ld bc, (BANK(PokeCenterFlashingMonitorAndHealBall) << 8) + $03 call CopyVideoData - ld hl, $cfcb + ld hl, wcfcb ld a, [hl] push af ld [hl], $ff @@ -12,19 +12,19 @@ AnimateHealingMachine: ; 70433 (1c:4433) push af ld a, $e0 ld [rOBP1], a ; $ff49 - ld hl, $c384 + ld hl, wOAMBuffer + $84 ld de, PokeCenterOAMData ; $44d7 call Func_70503 ld a, $4 ld [wMusicHeaderPointer], a ld a, $ff - ld [$c0ee], a + ld [wc0ee], a call PlaySound .asm_70464 ld a, [wMusicHeaderPointer] and a jr nz, .asm_70464 - ld a, [W_NUMINPARTY] ; $d163 + ld a, [W_NUMINPARTY] ; W_NUMINPARTY ld b, a .asm_7046e call Func_70503 @@ -34,23 +34,23 @@ AnimateHealingMachine: ; 70433 (1c:4433) call DelayFrames dec b jr nz, .asm_7046e - ld a, [$c0ef] + ld a, [wc0ef] cp $1f - ld [$c0f0], a + ld [wc0f0], a jr nz, .asm_70495 ld a, $ff - ld [$c0ee], a + ld [wc0ee], a call PlaySound ld a, Bank(Func_9876) - ld [$c0ef], a + ld [wc0ef], a .asm_70495 ld a, MUSIC_PKMN_HEALED - ld [$c0ee], a + ld [wc0ee], a call PlaySound ld d, $28 call Func_704f3 .asm_704a2 - ld a, [$c026] + ld a, [wc026] cp MUSIC_PKMN_HEALED jr z, .asm_704a2 ld c, $20 diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index ea032cbe..21ccdaad 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -1,9 +1,9 @@ HiddenItems: ; 76688 (1d:6688) ld hl, HiddenItemCoords call Func_76857 - ld [$cd41], a - ld hl, $d6f0 - ld a, [$cd41] + ld [wTrainerScreenX], a + ld hl, wd6f0 + ld a, [wTrainerScreenX] ld c, a ld b, $2 ld a, $10 @@ -13,9 +13,9 @@ HiddenItems: ; 76688 (1d:6688) ret nz call EnableAutoTextBoxDrawing ld a, $1 - ld [$cc3c], a - ld a, [$cd3d] ; item ID - ld [$d11e], a + ld [wcc3c], a + ld a, [wWhichTrade] ; item ID + ld [wd11e], a call GetItemName ld a, $24 jp PrintPredefTextID @@ -26,13 +26,13 @@ FoundHiddenItemText: ; 7675b (1d:675b) ; XXX where is the pointer to this? TX_FAR _FoundHiddenItemText db $8 - ld a, [$cd3d] ; item ID + ld a, [wWhichTrade] ; item ID ld b, a ld c, 1 call GiveItem jr nc, .BagFull - ld hl, $d6f0 - ld a, [$cd41] + ld hl, wd6f0 + ld a, [wTrainerScreenX] ld c, a ld b, $1 ld a, $10 @@ -44,7 +44,7 @@ FoundHiddenItemText: ; 7675b (1d:675b) .BagFull call WaitForTextScrollButtonPress ; wait for button press xor a - ld [$cc3c], a + ld [wcc3c], a ld hl, HiddenItemBagFullText call PrintText jp TextScriptEnd @@ -62,9 +62,9 @@ HiddenCoins: ; 76799 (1d:6799) ret z ld hl, HiddenCoinCoords call Func_76857 - ld [$cd41], a - ld hl, $d6fe - ld a, [$cd41] + ld [wTrainerScreenX], a + ld hl, wd6fe + ld a, [wTrainerScreenX] ld c, a ld b, $2 ld a, $10 @@ -76,7 +76,7 @@ HiddenCoins: ; 76799 (1d:6799) ld [$ff9f], a ld [$ffa0], a ld [$ffa1], a - ld a, [$cd3d] + ld a, [wWhichTrade] sub COIN cp 10 jr z, .bcd10 @@ -101,13 +101,13 @@ HiddenCoins: ; 76799 (1d:6799) ld a, $1 ld [$ffa0], a .bcddone - ld de, $d5a5 + ld de, wPlayerCoins + 1 ld hl, $ffa1 ld c, $2 ld a, $b ; AddBCDPredef call Predef - ld hl, $d6fe - ld a, [$cd41] + ld hl, wd6fe + ld a, [wTrainerScreenX] ld c, a ld b, $1 ld a, $10 @@ -139,9 +139,9 @@ DroppedHiddenCoinsText: ; 7684d (1d:684d) db "@" Func_76857: ; 76857 (1d:6857) - ld a, [$cd40] + ld a, [wTrainerScreenY] ld d, a - ld a, [$cd41] + ld a, [wTrainerScreenX] ld e, a ld a, [W_CURMAP] ld b, a diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index e4777a84..d2114293 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -1,16 +1,16 @@ Func_46981: ; 46981 (11:6981) xor a - ld [$d71e], a - ld a, [$d72d] + ld [wd71e], a + ld a, [wd72d] bit 4, a ret nz call ArePlayerCoordsInArray ret nc - ld a, [wWhichTrade] ; $cd3d - ld [$d71e], a - ld hl, $d72d + ld a, [wWhichTrade] ; wWhichTrade + ld [wd71e], a + ld hl, wd72d set 4, [hl] - ld hl, $d732 + ld hl, wd732 set 4, [hl] ret @@ -28,7 +28,7 @@ Func_469a0: ; 469a0 (11:69a0) ld b, a cp $ff jr z, .asm_469fc - ld a, [W_CURMAP] ; $d35e + ld a, [W_CURMAP] ; W_CURMAP cp b jr z, .asm_469be inc de @@ -41,7 +41,7 @@ Func_469a0: ; 469a0 (11:69a0) ld h, [hl] ld l, a push hl - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade xor a ld [hli], a ld [hli], a @@ -51,10 +51,10 @@ Func_469a0: ; 469a0 (11:69a0) ld a, [hli] cp $ff jr z, .asm_469fc - ld [$cd40], a + ld [wTrainerScreenY], a ld b, a ld a, [hli] - ld [$cd41], a + ld [wTrainerScreenX], a ld c, a call Func_46a01 ld a, [$ffea] @@ -65,15 +65,15 @@ Func_469a0: ; 469a0 (11:69a0) inc hl inc hl push hl - ld hl, $cd3f + ld hl, wTrainerFacingDirection inc [hl] pop hl jr .asm_469ce .asm_469f0 ld a, [hli] - ld [wWhichTrade], a ; $cd3d + ld [wWhichTrade], a ; wWhichTrade ld a, [hli] - ld [$cd3e], a + ld [wTrainerEngageDistance], a ld a, [hli] ld h, [hl] ld l, a @@ -84,37 +84,37 @@ Func_469a0: ; 469a0 (11:69a0) ret Func_46a01: ; 46a01 (11:6a01) - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] cp $4 jr z, .asm_46a16 cp $8 jr z, .asm_46a25 cp $c jr z, .asm_46a2b - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 inc a jr .asm_46a1a .asm_46a16 - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 dec a .asm_46a1a cp b jr nz, .asm_46a3b - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 cp c jr nz, .asm_46a3b jr .asm_46a38 .asm_46a25 - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 dec a jr .asm_46a2f .asm_46a2b - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 inc a .asm_46a2f cp c jr nz, .asm_46a3b - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 cp b jr nz, .asm_46a3b .asm_46a38 diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index afc146f1..c66fc143 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -31,11 +31,11 @@ PickupItem: jr nc, .BagFull ld a, [$ffdb] - ld [$cc4d], a + ld [wcc4d], a ld a, $11 ; RemoveMissableObject call Predef ld a, 1 - ld [$cc3c], a + ld [wcc3c], a ld hl, FoundItemText jr .print diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 12a78507..a94f79f6 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -1,18 +1,18 @@ HandleLedges: ; 1a672 (6:6672) - ld a, [$d736] + ld a, [wd736] bit 6, a ret nz - ld a, [W_CURMAPTILESET] ; $d367 + ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET and a ; OVERWORLD ret nz ld a, $35 call Predef ; indirect jump to Func_c586 (c586 (3:4586)) - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] ld b, a - FuncCoord 8, 9 ; $c45c + FuncCoord 8, 9 ld a, [Coord] ld c, a - ld a, [$cfc6] + ld a, [wcfc6] ld d, a ld hl, LedgeTiles ; $66cf .asm_1a691 @@ -43,14 +43,14 @@ HandleLedges: ; 1a672 (6:6672) ret z ld a, $ff ld [wJoyIgnore], a - ld hl, $d736 + ld hl, wd736 set 6, [hl] call Func_3486 ld a, e - ld [$ccd3], a - ld [$ccd4], a + ld [wccd3], a + ld [wccd4], a ld a, $2 - ld [$cd38], a + ld [wcd38], a call LoadHoppingShadowOAM ld a, (SFX_02_4e - SFX_Headers_02) / 3 call PlaySound diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index a734319d..297c45b8 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -4,7 +4,7 @@ ; This is also called after displaying text because loading ; text tile patterns overwrites half of the sprite tile pattern data. ; Note on notation: -; $C1X* and $C2X* are used to denote $C100-$C1FF and $C200-$C2FF sprite slot +; $C1X* and $C2X* are used to denote wSpriteStateData1-wSpriteStateData1 + $ff and wSpriteStateData2 + $00-wSpriteStateData2 + $ff sprite slot ; fields, respectively, within loops. The X is the loop index. ; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y* ; denote fields of the sprite slots interated over in the inner loop. @@ -13,7 +13,7 @@ InitMapSprites: ; 1785b (5:785b) ret c ; return if the map is an outside map (already handled by above call) ; if the map is an inside map (i.e. mapID >= $25) ld hl,wSpriteStateData1 - ld de,$c20d + ld de,wSpriteStateData2 + $0d ; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns. .copyPictureIDLoop ld a,[hl] ; $C1X0 (picture ID) @@ -37,7 +37,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) .spritesExist ld c,a ; c = [W_NUMSPRITES] ld b,$10 ; number of sprite slots - ld hl,$c20d + ld hl,wSpriteStateData2 + $0d xor a ld [$ff8e],a ; 4-tile sprite counter .copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE @@ -48,9 +48,9 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,a dec b jr nz,.copyPictureIDLoop - ld hl,$c21e + ld hl,wSpriteStateData2 + $1e .loadTilePatternLoop - ld de,$c21d + ld de,wSpriteStateData2 + $1d ; Check if the current picture ID has already had its tile patterns loaded. ; This done by looping through the previous sprite slots and seeing if any of ; their picture ID's match that of the current sprite slot. @@ -70,7 +70,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld e,a jr .checkIfAlreadyLoadedLoop .notAlreadyLoaded - ld de,$c20e + ld de,wSpriteStateData2 + $0e ld b,$01 ; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot ; this is done in order to find the first free VRAM slot available @@ -159,7 +159,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,e pop de ld b,a - ld a,[$cfc4] + ld a,[wcfc4] 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,[$cfc4] + ld a,[wcfc4] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadWhileLCDOn pop af @@ -216,7 +216,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,a dec c jp nz,.loadTilePatternLoop - ld hl,$c20d + ld hl,wSpriteStateData2 + $0d ld b,$10 ; the pictures ID's stored at $C2XD are no longer needed, so zero them .zeroStoredPictureIDLoop @@ -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,[$cfc4] + ld a,[wcfc4] 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] @@ -288,7 +288,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) jr nc,.noCarry2 inc d .noCarry2 - ld hl,$c20d + ld hl,wSpriteStateData2 + $0d ld a,SPRITE_RED ld [hl],a ld bc,W_SPRITESET @@ -324,7 +324,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) call LoadMapSpriteTilePatterns pop af ld [W_NUMSPRITES],a ; restore number of sprites - ld hl,$c21e + ld hl,wSpriteStateData2 + $1e ld b,$0f ; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the ; order of the map's sprite set, not the order of the actual sprites loaded @@ -338,7 +338,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) dec b jr nz,.zeroVRAMSlotsLoop .skipLoadingSpriteSet - ld hl,$c110 + ld hl,wSpriteStateData1 + $10 ; This loop stores the correct VRAM tile pattern slots according the sprite ; data from the map's header. Since the VRAM tile pattern slots are filled in ; the order of the sprite set, in order to find the VRAM tile pattern slot diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 842544a7..a01a5d0a 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -8,22 +8,22 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) ld [wSpriteStateData2], a jr .asm_4e4a .asm_4e41 - FuncCoord 8, 9 ; $c45c + FuncCoord 8, 9 ld a, [Coord] ld [$ff93], a cp $60 jr c, .asm_4e50 .asm_4e4a ld a, $ff - ld [$c102], a + ld [wSpriteStateData1 + 2], a ret .asm_4e50 call Func_4c70 ld h, $c1 - ld a, [wWalkCounter] ; $cfc5 + ld a, [wWalkCounter] ; wcfc5 and a jr nz, .asm_4e90 - ld a, [$d528] + ld a, [wd528] bit 2, a jr z, .asm_4e65 xor a @@ -45,16 +45,16 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr .asm_4e86 .asm_4e7d xor a - ld [$c107], a - ld [$c108], a + ld [wSpriteStateData1 + 7], a + ld [wSpriteStateData1 + 8], a jr .asm_4eab .asm_4e86 - ld [$c109], a - ld a, [$cfc4] + ld [wSpriteStateData1 + 9], a + ld a, [wcfc4] bit 0, a jr nz, .asm_4e7d .asm_4e90 - ld a, [$d736] + ld a, [wd736] bit 7, a jr nz, .asm_4eb6 ld a, [H_CURRENTSPRITEOFFSET] @@ -73,11 +73,11 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) and $3 ld [hl], a .asm_4eab - ld a, [$c108] + ld a, [wSpriteStateData1 + 8] ld b, a - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] add b - ld [$c102], a + ld [wSpriteStateData1 + 2], a .asm_4eb6 ld a, [$ff93] ld c, a @@ -87,7 +87,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr nz, .asm_4ec3 ld a, $80 .asm_4ec3 - ld [$c207], a + ld [wSpriteStateData2 + $07], a ret Func_4ec7: ; 4ec7 (1:4ec7) @@ -106,7 +106,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) swap a dec a add a - ld hl, W_MAPSPRITEDATA ; $d4e4 + ld hl, W_MAPSPRITEDATA ; wd4e4 add l ld l, a ld a, [hl] ; read movement byte 2 @@ -128,7 +128,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) bit 7, a jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 ld b, a - ld a, [$cfc4] + ld a, [wcfc4] bit 0, a jp nz, notYetMoving ld a, b @@ -136,7 +136,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) jp z, UpdateSpriteMovementDelay ; c1x1 == 2 cp $3 jp z, UpdateSpriteInWalkingAnimation ; c1x1 == 3 - ld a, [wWalkCounter] ; $cfc5 + ld a, [wWalkCounter] ; wcfc5 and a ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition @@ -153,28 +153,28 @@ Func_4ed1: ; 4ed1 (1:4ed1) ld [hl], a ; (temporarily) increment movement byte 1 dec a push hl - ld hl, $cf0f - dec [hl] ; decrement $cf0f + ld hl, wcf0f + dec [hl] ; decrement wcf0f pop hl - ld de, $cc5b - call LoadDEPlusA ; a = [$cc5b + movement byte 1] + ld de, wcc5b + call LoadDEPlusA ; a = [wcc5b + movement byte 1] cp $e0 jp z, ChangeFacingDirection cp $ff jr nz, .asm_4f4b ld [hl], a ; reset movement byte 1 to initial value - ld hl, $d730 + ld hl, wd730 res 0, [hl] xor a - ld [$cd38], a - ld [$cd3a], a + ld [wcd38], a + ld [wcd3a], a ret .asm_4f4b cp $fe jr nz, .asm_4f5f ld [hl], $1 ; set movement byte 1 to $1 - ld de, $cc5b - call LoadDEPlusA ; a = [$cc5b + $fe] (?) + ld de, wcc5b + call LoadDEPlusA ; a = [wcc5b + $fe] (?) jr .asm_4f5f .asm_4f59 call getTileSpriteStandsOn @@ -391,11 +391,11 @@ notYetMoving: ; 5073 (1:5073) jp UpdateSpriteImage InitializeSpriteFacingDirection: ; 507f (1:507f) - ld a, [$d72d] + ld a, [wd72d] bit 5, a jr nz, notYetMoving res 7, [hl] - ld a, [$d52a] + ld a, [wd52a] bit 3, a jr z, .notFacingDown ld c, $0 ; make sprite face down @@ -438,7 +438,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 ld b, a ld a, [hl] ; c2x4 (Y position + 4) sub b ; relative to player position @@ -447,7 +447,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) dec h ld [hli], a ; c1x4 (screen Y position) inc h - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 ld b, a ld a, [hli] ; c2x6 (X position + 4) sub b ; relative to player position @@ -474,7 +474,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) add $4 ld l, a ld b, [hl] ; c2x4: Y pos (+4) - ld a, [W_YCOORD] ; $d361 + ld a, [W_YCOORD] ; wd361 cp b jr z, .skipYVisibilityTest jr nc, .spriteInvisible ; above screen region @@ -484,7 +484,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) .skipYVisibilityTest inc l ld b, [hl] ; c2x5: X pos (+4) - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 cp b jr z, .skipXVisibilityTest jr nc, .spriteInvisible ; left of screen region @@ -518,7 +518,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc) jr .done .spriteVisible ld c, a - ld a, [wWalkCounter] ; $cfc5 + ld a, [wWalkCounter] ; wcfc5 and a jr nz, .done ; if player is currently walking, we're done call UpdateSpriteImage @@ -711,15 +711,15 @@ LoadDEPlusA: ; 522f (1:522f) ret Func_5236: ; 5236 (1:5236) - ld a, [$d730] + ld a, [wd730] bit 7, a ret z - ld hl, $d72e + ld hl, wd72e bit 7, [hl] set 7, [hl] jp z, Func_52a6 - ld hl, $cc97 - ld a, [$cd37] + ld hl, wcc97 + ld a, [wcd37] add l ld l, a jr nc, .asm_5251 @@ -767,20 +767,20 @@ Func_5236: ; 5236 (1:5236) ld a, c ld [hl], a call Func_52c3 - ld hl, $cf18 + ld hl, wcf18 dec [hl] ret nz ld a, $8 - ld [$cf18], a - ld hl, $cd37 + ld [wcf18], a + ld hl, wcd37 inc [hl] ret Func_52a6: ; 52a6 (1:52a6) xor a - ld [$cd37], a + ld [wcd37], a ld a, $8 - ld [$cf18], a + ld [wcf18], a jp Func_52c3 Func_52b2: ; 52b2 (1:52b2) diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 92200353..234b7645 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -1,47 +1,47 @@ Func_1a3e0: ; 1a3e0 (6:63e0) - ld hl, $d730 + ld hl, wd730 res 1, [hl] call HandleDoors jr nc, .asm_1a406 ld a, $fc ld [wJoyIgnore], a - ld hl, $d736 + ld hl, wd736 set 1, [hl] ld a, $1 - ld [$cd38], a + ld [wcd38], a ld a, $80 - ld [$ccd3], a + ld [wccd3], a xor a - ld [$c102], a + ld [wSpriteStateData1 + 2], a call Func_3486 ret .asm_1a406 xor a - ld [$cd3a], a - ld [$cd38], a - ld [$ccd3], a - ld hl, $d736 + ld [wcd3a], a + ld [wcd38], a + ld [wccd3], a + ld hl, wd736 res 0, [hl] res 1, [hl] - ld hl, $d730 + ld hl, wd730 res 7, [hl] ret Func_1a41d: ; 1a41d (6:641d) - ld hl, $d730 + ld hl, wd730 res 7, [hl] - ld hl, $d72e + ld hl, wd72e res 7, [hl] - ld hl, $d736 + ld hl, wd736 res 0, [hl] res 1, [hl] xor a - ld [$cf17], a - ld [$cc57], a - ld [$cf10], a - ld [$cd3a], a - ld [$cd38], a - ld [$ccd3], a + ld [wcf17], a + ld [wcc57], a + ld [wcf10], a + ld [wcd3a], a + ld [wcd38], a + ld [wccd3], a ret PointerTable_1a442: ; 1a442 (6:6442) @@ -52,26 +52,26 @@ PointerTable_1a442: ; 1a442 (6:6442) dw Func_1a4f4 Func_1a44c: ; 1a44c (6:644c) - ld a, [W_XCOORD] ; $d362 + ld a, [W_XCOORD] ; wd362 sub $a - ld [$cca1], a + ld [wcca1], a jr z, .asm_1a475 ld b, $0 ld c, a - ld hl, $cc97 + ld hl, wcc97 ld a, $80 call FillMemory ld [hl], $ff - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c - ld de, $cc97 + ld de, wcc97 call MoveSprite ld a, $1 - ld [$cf10], a + ld [wcf10], a jr .asm_1a47a .asm_1a475 ld a, $3 - ld [$cf10], a + ld [wcf10], a .asm_1a47a ld hl, W_FLAGS_D733 set 1, [hl] @@ -80,46 +80,46 @@ Func_1a44c: ; 1a44c (6:644c) ret Func_1a485: ; 1a485 (6:6485) - ld a, [$d730] + ld a, [wd730] bit 0, a ret nz - ld a, [$cca1] - ld [$cd38], a + ld a, [wcca1] + ld [wcd38], a ld [$ff95], a ld a, $23 call Predef call Func_3486 ld a, $2 - ld [$cf10], a + ld [wcf10], a ret Func_1a4a1: ; 1a4a1 (6:64a1) - ld a, [$cd38] + ld a, [wcd38] and a ret nz Func_1a4a6: ; 1a4a6 (6:64a6) xor a - ld [$cd3b], a - ld a, [$cf13] + ld [wcd3b], a + ld a, [wcf13] swap a - ld [$cf17], a + ld [wcf17], a xor a - ld [$c206], a - ld hl, $ccd3 + ld [wSpriteStateData2 + $06], a + ld hl, wccd3 ld de, RLEList_1a4e9 call DecodeRLEList dec a - ld [$cd38], a - ld hl, $cc97 + ld [wcd38], a + ld hl, wcc97 ld de, RLEList_1a4dc call DecodeRLEList - ld hl, $d72e + ld hl, wd72e res 7, [hl] - ld hl, $d730 + ld hl, wd730 set 7, [hl] ld a, $4 - ld [$cf10], a + ld [wcf10], a ret RLEList_1a4dc: ; 1a4dc (6:64dc) @@ -140,16 +140,16 @@ RLEList_1a4e9: ; 1a4e9 (6:64e9) db $FF Func_1a4f4: ; 1a4f4 (6:64f4) - ld a, [$cd38] + ld a, [wcd38] and a ret nz ld a, $0 - ld [$cc4d], a + ld [wcc4d], a ld a, $11 call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7)) - ld hl, $d730 + ld hl, wd730 res 7, [hl] - ld hl, $d72e + ld hl, wd72e res 7, [hl] jp Func_314e @@ -159,31 +159,31 @@ PointerTable_1a510: ; 1a510 (6:6510) Func_1a514: ; 1a514 (6:6514) ld a, Bank(Func_9876) - ld [$c0ef], a - ld [$c0f0], a + ld [wc0ef], a + ld [wc0f0], a ld a, MUSIC_MUSEUM_GUY - ld [$c0ee], a + ld [wc0ee], a call PlaySound - ld a, [$cf13] + ld a, [wcf13] swap a - ld [$cf17], a + ld [wcf17], a call Func_3486 - ld hl, $ccd3 + ld hl, wccd3 ld de, RLEList_PewterMuseumPlayer call DecodeRLEList dec a - ld [$cd38], a + ld [wcd38], a xor a - ld [$d12f], a + ld [wd12f], a ld a, $4f call Predef - ld hl, $cc97 + ld hl, wcc97 ld de, RLEList_PewterMuseumGuy call DecodeRLEList - ld hl, $d72e + ld hl, wd72e res 7, [hl] ld a, $1 - ld [$cf10], a + ld [wcf10], a ret RLEList_PewterMuseumPlayer: ; 1a559 (6:6559) @@ -201,12 +201,12 @@ RLEList_PewterMuseumGuy: ; 1a562 (6:6562) db $FF Func_1a56b: ; 1a56b (6:656b) - ld a, [$cd38] + ld a, [wcd38] and a ret nz - ld hl, $d730 + ld hl, wd730 res 7, [hl] - ld hl, $d72e + ld hl, wd72e res 7, [hl] jp Func_314e @@ -216,34 +216,34 @@ PointerTable_1a57d: ; 1a57d (6:657d) Func_1a581: ; 1a581 (6:6581) ld a, Bank(Func_9876) - ld [$c0ef], a - ld [$c0f0], a + ld [wc0ef], a + ld [wc0f0], a ld a, MUSIC_MUSEUM_GUY - ld [$c0ee], a + ld [wc0ee], a call PlaySound - ld a, [$cf13] + ld a, [wcf13] swap a - ld [$cf17], a + ld [wcf17], a xor a - ld [$c206], a - ld hl, $ccd3 + ld [wSpriteStateData2 + $06], a + ld hl, wccd3 ld de, RLEList_PewterGymPlayer call DecodeRLEList dec a - ld [$cd38], a + ld [wcd38], a ld a, $1 - ld [$d12f], a + ld [wd12f], a ld a, $4f call Predef - ld hl, $cc97 + ld hl, wcc97 ld de, RLEList_PewterGymGuy call DecodeRLEList - ld hl, $d72e + ld hl, wd72e res 7, [hl] - ld hl, $d730 + ld hl, wd730 set 7, [hl] ld a, $1 - ld [$cf10], a + ld [wcf10], a ret RLEList_PewterGymPlayer: ; 1a5cd (6:65cd) @@ -266,7 +266,7 @@ RLEList_PewterGymGuy: ; 1a5da (6:65da) ; XXX why would this function want to return on POKEMONTOWER_7? Func_1a5e7: ; 1a5e7 (6:65e7) - ld a, [W_CURMAP] ; $d35e + ld a, [W_CURMAP] ; W_CURMAP cp POKEMONTOWER_7 ret z ld hl, RivalIDs ; $6605 @@ -280,7 +280,7 @@ Func_1a5e7: ; 1a5e7 (6:65e7) ret z jr .loop .notRival - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c jp SetSpriteMovementBytesToFF diff --git a/engine/overworld/oaks_aide.asm b/engine/overworld/oaks_aide.asm index ca2c6726..68135287 100755 --- a/engine/overworld/oaks_aide.asm +++ b/engine/overworld/oaks_aide.asm @@ -2,13 +2,13 @@ OaksAideScript ; 0x59035 ld hl, OaksAideHiText call PrintText call YesNoChoice - ld a, [$cc26] + ld a, [wCurrentMenuItem] and a jr nz, .asm_59086 ; 0x59042 $42 ld hl, wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned call CountSetBits - ld a, [$d11e] + ld a, [wd11e] ld [$ffdd], a ld b, a ld a, [$ffdb] diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm index 040513b1..63495d22 100644 --- a/engine/overworld/oam.asm +++ b/engine/overworld/oam.asm @@ -2,13 +2,13 @@ PrepareOAMData: ; Determine OAM data for currently visible ; sprites and write it to wOAMBuffer. - ld a, [$cfcb] + ld a, [wcfcb] dec a jr z, .asm_4b1e cp 0 - 1 ret nz - ld [$cfcb], a + ld [wcfcb], a jp HideSprites .asm_4b1e @@ -27,7 +27,7 @@ PrepareOAMData: inc e inc e ld a, [de] ; c1x2 (facing/anim) - ld [$d5cd], a + ld [wd5cd], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -92,7 +92,7 @@ PrepareOAMData: push bc ld b, a - ld a, [$d5cd] ; temp copy of c1x2 + ld a, [wd5cd] ; temp copy of c1x2 swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f @@ -143,7 +143,7 @@ PrepareOAMData: ld h, wOAMBuffer / $100 ld de, $4 ld b, $a0 - ld a, [$d736] + ld a, [wd736] bit 6, a ld a, $a0 jr z, .clear diff --git a/engine/overworld/pewter_guys.asm b/engine/overworld/pewter_guys.asm index 7c5779a2..2f3001fb 100755 --- a/engine/overworld/pewter_guys.asm +++ b/engine/overworld/pewter_guys.asm @@ -1,15 +1,15 @@ PewterGuys: ; 37ca1 (d:7ca1) - ld hl, $ccd3 - ld a, [$cd38] + ld hl, wccd3 + ld a, [wcd38] dec a - ld [$cd38], a + ld [wcd38], a ld d, 0 ld e, a add hl, de ld d, h ld e, l ld hl, PointerTable_37ce6 - ld a, [$d12f] + ld a, [wd12f] add a ld b, 0 ld c, a @@ -37,9 +37,9 @@ PewterGuys: ; 37ca1 (d:7ca1) ret z ld [de], a inc de - ld a, [$cd38] + ld a, [wcd38] inc a - ld [$cd38], a + ld [wcd38], a jr .asm_37cd2 .asm_37ce1 inc hl diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 8e50259c..0b654369 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -1,7 +1,7 @@ Func_70510: ; 70510 (1c:4510) call Func_706ef ld a, $ec - ld [$c104], a + ld [wSpriteStateData1 + 4], a call Delay3 push hl call GBFadeIn2 @@ -11,7 +11,7 @@ Func_70510: ; 70510 (1c:4510) jr nz, .asm_70568 ld a, (SFX_02_4c - SFX_Headers_02) / 3 call PlaySound - ld hl, $d732 + ld hl, wd732 bit 4, [hl] res 4, [hl] pop hl @@ -23,7 +23,7 @@ Func_70510: ; 70510 (1c:4510) ld a, b and a jr nz, .asm_7055b - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade xor a ld [hli], a inc a @@ -31,7 +31,7 @@ Func_70510: ; 70510 (1c:4510) ld a, $8 ld [hli], a ld [hl], $ff - ld hl, $cd48 + ld hl, wcd48 call Func_70730 .asm_70558 call Func_2307 @@ -51,7 +51,7 @@ Func_70510: ; 70510 (1c:4510) call Func_706d7 ld a, (SFX_02_50 - SFX_Headers_02) / 3 call PlaySound - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade xor a ld [hli], a ld a, $c @@ -80,7 +80,7 @@ FlyAnimationEnterScreenCoords: ; 70592 (1c:4592) db $3C, $40 Func_705aa: ; 705aa (1c:45aa) - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade ld a, $10 ld [hli], a ld a, $3c @@ -100,7 +100,7 @@ _DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) .asm_705c8 ld a, (SFX_02_4b - SFX_Headers_02) / 3 call PlaySound - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade ld a, $f0 ld [hli], a ld a, $ec @@ -120,10 +120,10 @@ _DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) .asm_705ef ld a, $4 call StopMusic - ld a, [$d732] + ld a, [wd732] bit 6, a jr z, .asm_70610 - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade ld a, $10 ld [hli], a ld a, $ff @@ -131,12 +131,12 @@ _DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) xor a ld [hli], a ld [hl], $a1 - ld hl, $cd48 + ld hl, wcd48 call Func_70730 jr .asm_705c8 .asm_70610 call Func_706d7 - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade ld a, $ff ld [hli], a ld a, $8 @@ -145,7 +145,7 @@ _DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) call Func_706ae ld a, (SFX_02_50 - SFX_Headers_02) / 3 call PlaySound - ld hl, wWhichTrade ; $cd3d + ld hl, wWhichTrade ; wWhichTrade xor a ld [hli], a ld a, $c @@ -155,7 +155,7 @@ _DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) call Func_706ae ld c, $28 call DelayFrames - ld hl, $cd3e + ld hl, wTrainerEngageDistance ld a, $b ld [hli], a ld [hl], $8 @@ -200,34 +200,34 @@ FlyAnimationScreenCoords2: ; 70667 (1c:4667) Func_7067d: ; 7067d (1c:467d) ld a, $ff - ld [$cfcb], a - ld a, [$c302] - ld [$c30a], a - ld a, [$c306] - ld [$c30e], a + ld [wcfcb], a + ld a, [wOAMBuffer + $02] + ld [wOAMBuffer + $0a], a + ld a, [wOAMBuffer + $06] + ld [wOAMBuffer + $0e], a ld a, $a0 ld [wOAMBuffer], a - ld [$c304], a + ld [wOAMBuffer + $04], a ld c, $2 call DelayFrames ld a, $a0 - ld [$c308], a - ld [$c30c], a + ld [wOAMBuffer + $08], a + ld [wOAMBuffer + $0c], a call GBFadeOut2 ld a, $1 - ld [$cfcb], a + ld [wcfcb], a jp Func_70772 Func_706ae: ; 706ae (1c:46ae) - ld a, [$cd3f] + ld a, [wTrainerFacingDirection] xor $1 - ld [$cd3f], a - ld [$c102], a + ld [wTrainerFacingDirection], a + ld [wSpriteStateData1 + 2], a call Delay3 - ld a, [wWhichTrade] ; $cd3d + ld a, [wWhichTrade] ; wWhichTrade cp $ff jr z, .asm_706cd - ld hl, $c104 + ld hl, wSpriteStateData1 + 4 ld a, [de] inc de ld [hli], a @@ -236,9 +236,9 @@ Func_706ae: ; 706ae (1c:46ae) inc de ld [hl], a .asm_706cd - ld a, [$cd3e] + ld a, [wTrainerEngageDistance] dec a - ld [$cd3e], a + ld [wTrainerEngageDistance], a jr nz, Func_706ae ret @@ -253,16 +253,16 @@ Func_706d7: ; 706d7 (1c:46d7) jp CopyVideoData Func_706ef: ; 706ef (1c:46ef) - ld a, [$c102] - ld [$cd50], a - ld a, [$c104] - ld [$cd4f], a + ld a, [wSpriteStateData1 + 2] + ld [wcd50], a + ld a, [wSpriteStateData1 + 4] + ld [wcd4f], a ld hl, PlayerSpinningFacingOrder ; $4713 - ld de, $cd48 + ld de, wcd48 ld bc, $4 call CopyData - ld a, [$c102] - ld hl, $cd48 + ld a, [wSpriteStateData1 + 2] + ld hl, wcd48 .asm_7070d cp [hl] inc hl @@ -277,32 +277,32 @@ PlayerSpinningFacingOrder: ; 70713 (1c:4713) Func_70717: ; 70717 (1c:4717) ld a, [hl] - ld [$c102], a + ld [wSpriteStateData1 + 2], a push hl - ld hl, $cd48 - ld de, $cd47 + ld hl, wcd48 + ld de, wcd47 ld bc, $4 call CopyData - ld a, [$cd47] - ld [$cd4b], a + ld a, [wcd47] + ld [wcd4b], a pop hl ret Func_70730: ; 70730 (1c:4730) call Func_70717 - ld a, [wWhichTrade] ; $cd3d + ld a, [wWhichTrade] ; wWhichTrade ld c, a and $3 jr nz, .asm_70743 - ld a, [$cd40] + ld a, [wTrainerScreenY] cp $ff call nz, PlaySound .asm_70743 - ld a, [$cd3e] + ld a, [wTrainerEngageDistance] add c - ld [wWhichTrade], a ; $cd3d + ld [wWhichTrade], a ; wWhichTrade ld c, a - ld a, [$cd3f] + ld a, [wTrainerFacingDirection] cp c ret z call DelayFrames @@ -310,29 +310,29 @@ Func_70730: ; 70730 (1c:4730) Func_70755: ; 70755 (1c:4755) call Func_70717 - ld a, [wWhichTrade] ; $cd3d + ld a, [wWhichTrade] ; wWhichTrade ld c, a - ld a, [$c104] + ld a, [wSpriteStateData1 + 4] add c - ld [$c104], a + ld [wSpriteStateData1 + 4], a ld c, a - ld a, [$cd3e] + ld a, [wTrainerEngageDistance] cp c ret z - ld a, [$cd3f] + ld a, [wTrainerFacingDirection] ld c, a call DelayFrames jr Func_70755 Func_70772: ; 70772 (1c:4772) - ld a, [$cd4f] - ld [$c104], a - ld a, [$cd50] - ld [$c102], a + ld a, [wcd4f] + ld [wSpriteStateData1 + 4], a + ld a, [wcd50] + ld [wSpriteStateData1 + 2], a ret Func_7077f: ; 7077f (1c:477f) - ld a, [$cf1b] + ld a, [wcf1b] xor $1 inc a inc a @@ -341,7 +341,7 @@ Func_7077f: ; 7077f (1c:477f) Func_70787: ; 70787 (1c:4787) ld b, 0 ld hl, DataTable_707a9 ; $47a9 - ld a, [W_CURMAPTILESET] ; $d367 + ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET ld c, a .asm_70790 ld a, [hli] @@ -349,7 +349,7 @@ Func_70787: ; 70787 (1c:4787) jr z, .asm_707a4 cp c jr nz, .asm_7079e - FuncCoord 8, 9 ; $c45c + FuncCoord 8, 9 ld a, [Coord] cp [hl] jr z, .asm_707a2 @@ -362,10 +362,10 @@ Func_70787: ; 70787 (1c:4787) ld b, [hl] .asm_707a4 ld a, b - ld [$cd5b], a + ld [wcd5b], a ret -; format: db tileset id, tile id, value to be put in $cd5b +; format: db tileset id, tile id, value to be put in wcd5b DataTable_707a9: ; 707a9 (1c:47a9) db FACILITY, $20, 1 ; warp pad db FACILITY, $11, 2 ; hole @@ -376,7 +376,7 @@ DataTable_707a9: ; 707a9 (1c:47a9) Func_707b6: ; 707b6 (1c:47b6) ld c, $a call DelayFrames - ld hl, $d736 + ld hl, wd736 set 6, [hl] ld de, RedSprite ; $4180 ld hl, $8000 @@ -385,17 +385,17 @@ Func_707b6: ; 707b6 (1c:47b6) ld a, $4 ld hl, RedFishingTiles ; $4866 call Func_71771 - ld a, [$c102] + ld a, [wSpriteStateData1 + 2] ld c, a ld b, $0 ld hl, FishingRodGfxProperties ; $4856 add hl, bc - ld de, $c39c + ld de, wOAMBuffer + $9c ld bc, $4 call CopyData ld c, $64 call DelayFrames - ld a, [wWhichTrade] ; $cd3d + ld a, [wWhichTrade] ; wWhichTrade and a ld hl, NoNibbleText jr z, .asm_70836 @@ -404,35 +404,35 @@ Func_707b6: ; 707b6 (1c:47b6) jr z, .asm_70836 ld b, $a .asm_707fe - ld hl, $c104 + ld hl, wSpriteStateData1 + 4 call Func_70842 - ld hl, $c39c + ld hl, wOAMBuffer + $9c call Func_70842 call Delay3 dec b jr nz, .asm_707fe - ld a, [$c102] + ld a, [wSpriteStateData1 + 2] cp $4 jr nz, .asm_7081c ld a, $a0 - ld [$c39c], a + ld [wOAMBuffer + $9c], a .asm_7081c - ld hl, $cd4f + ld hl, wcd4f xor a ld [hli], a ld [hl], a ld a, $4c call Predef ; indirect jump to PrintEmotionBubble (17c47 (5:7c47)) - ld a, [$c102] + ld a, [wSpriteStateData1 + 2] cp $4 jr nz, .asm_70833 ld a, $44 - ld [$c39c], a + ld [wOAMBuffer + $9c], a .asm_70833 ld hl, ItsABiteText .asm_70836 call PrintText - ld hl, $d736 + ld hl, wd736 res 6, [hl] call LoadFontTilePatterns ret @@ -484,20 +484,20 @@ RedFishingTiles: ; 70866 (1c:4866) dw $8FD0 _HandleMidJump: ; 7087e (1c:487e) - ld a, [$d714] + ld a, [wd714] ld c, a inc a cp $10 jr nc, .asm_70895 - ld [$d714], a + ld [wd714], a ld b, $0 ld hl, PlayerJumpingYScreenCoords ; $48ba add hl, bc ld a, [hl] - ld [$c104], a ; player's sprite y coordinate + ld [wSpriteStateData1 + 4], a ; player's sprite y coordinate ret .asm_70895 - ld a, [wWalkCounter] ; $cfc5 + ld a, [wWalkCounter] ; wcfc5 cp $0 ret nz call UpdateSprites @@ -506,10 +506,10 @@ _HandleMidJump: ; 7087e (1c:487e) ld [hJoyHeld], a ld [hJoyPressed], a ld [hJoyReleased], a - ld [$d714], a - ld hl, $d736 + ld [wd714], a + ld hl, wd736 res 6, [hl] - ld hl, $d730 + ld hl, wd730 res 7, [hl] xor a ld [wJoyIgnore], a diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index 45599498..2dedc437 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -2,7 +2,7 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6) call SaveScreenTilesToBuffer1 ; save screen ld hl, PokemonCenterWelcomeText call PrintText - ld hl, $d72e + ld hl, wd72e bit 2, [hl] set 1, [hl] set 2, [hl] @@ -19,22 +19,22 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6) ld hl, NeedYourPokemonText call PrintText ld a, $18 - ld [$c112], a ; make the nurse turn to face the machine + ld [wSpriteStateData1 + $12], a ; make the nurse turn to face the machine call Delay3 PREDEF HealPartyPredef callba AnimateHealingMachine ; do the healing machine animation xor a ld [wMusicHeaderPointer], a - ld a, [$c0f0] - ld [$c0ef], a - ld a, [$d35b] - ld [$cfca], a - ld [$c0ee], a + ld a, [wc0f0] + ld [wc0ef], a + ld a, [wd35b] + ld [wcfca], a + ld [wc0ee], a call PlaySound ld hl, PokemonFightingFitText call PrintText ld a, $14 - ld [$c112], a ; make the nurse bow + ld [wSpriteStateData1 + $12], a ; make the nurse bow ld c, a call DelayFrames jr .done diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index 6e6f5ee2..adae76de 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -1,30 +1,30 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld a,[wListScrollOffset] - ld [$d07e],a + ld [wd07e],a call UpdateSprites ; move sprites xor a - ld [$cf0a],a ; flag that is set if something is sold or bought + ld [wcf0a],a ; flag that is set if something is sold or bought .loop xor a ld [wListScrollOffset],a ld [wCurrentMenuItem],a - ld [$cc2f],a + ld [wPlayerMonNumber],a inc a - ld [$cf93],a + ld [wcf93],a ld a,$13 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; draw money text box ld a,$15 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; do buy/sell/quit menu - ld hl,$d128 ; pointer to this pokemart's inventory + ld hl,wd128 ; pointer to this pokemart's inventory ld a,[hli] ld l,[hl] ld h,a ; hl = address of inventory - ld a,[$d12e] + ld a,[wd12e] cp a,$02 jp z,.done - ld a,[$d12d] ; ID of the chosen menu item + ld a,[wd12d] ; ID of the chosen menu item and a ; buying? jp z,.buyMenu dec a ; selling? @@ -33,9 +33,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) jp z,.done .sellMenu xor a - ld [$cf93],a + ld [wcf93],a ld a,$02 - ld [$d11b],a + ld [wd11b],a callab Func_39bd5 ld a,[wNumBagItems] and a @@ -46,15 +46,15 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) .sellMenuLoop call LoadScreenTilesFromBuffer1 ; restore saved screen ld a,$13 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; draw money text box ld hl,wNumBagItems ld a,l - ld [$cf8b],a + ld [wcf8b],a ld a,h - ld [$cf8c],a + ld [wcf8c],a xor a - ld [$cf93],a + ld [wcf93],a ld [wCurrentMenuItem],a ld a,ITEMLISTMENU ld [wListMenuID],a @@ -62,10 +62,10 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) jp c,.returnToMainPokemartMenu ; if the player closed the menu .confirmItemSale ; if the player is trying to sell a specific item call IsKeyItem ; check if item is unsellable - ld a,[$d124] + ld a,[wd124] and a jr nz,.unsellableItem - ld a,[$cf91] + ld a,[wcf91] call IsItemHM jr c,.unsellableItem ld a,PRICEDITEMLISTMENU @@ -81,20 +81,20 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld hl,Coord ld bc,$080f ld a,$14 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; yes/no menu - ld a,[$d12e] + ld a,[wd12e] cp a,$02 jr z,.sellMenuLoop ; if the player pressed the B button - ld a,[$d12d] ; ID of the chosen menu item + ld a,[wd12d] ; ID of the chosen menu item dec a jr z,.sellMenuLoop ; if the player chose No .sellItem - ld a,[$cf0a] ; flag that is set if something is sold or bought + ld a,[wcf0a] ; flag that is set if something is sold or bought and a jr nz,.skipSettingFlag1 inc a - ld [$cf0a],a + ld [wcf0a],a .skipSettingFlag1 call AddAmountSoldToMoney ld hl,wNumBagItems @@ -111,9 +111,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) jp .returnToMainPokemartMenu .buyMenu ld a,$01 - ld [$cf93],a + ld [wcf93],a ld a,$03 - ld [$d11b],a + ld [wd11b],a callab Func_39bd5 ld hl,PokemartBuyingGreetingText call PrintText @@ -121,44 +121,44 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) .buyMenuLoop call LoadScreenTilesFromBuffer1 ; restore saved screen ld a,$13 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; draw money text box - ld hl,$cf7b + ld hl,wStringBuffer2 + 11 ld a,l - ld [$cf8b],a + ld [wcf8b],a ld a,h - ld [$cf8c],a + ld [wcf8c],a xor a ld [wCurrentMenuItem],a inc a - ld [$cf93],a + ld [wcf93],a inc a ; a = 2 (PRICEDITEMLISTMENU) ld [wListMenuID],a call DisplayListMenuID jr c,.returnToMainPokemartMenu ; if the player closed the menu ld a,$63 - ld [$cf97],a + ld [wcf97],a xor a ld [$ff8e],a call DisplayChooseQuantityMenu inc a jr z,.buyMenuLoop ; if the player closed the choose quantity menu with the B button - ld a,[$cf91] ; item ID - ld [$d11e],a ; store item ID for GetItemName + ld a,[wcf91] ; item ID + ld [wd11e],a ; store item ID for GetItemName call GetItemName - call CopyStringToCF4B ; copy name to $cf4b + call CopyStringToCF4B ; copy name to wcf4b ld hl,PokemartTellBuyPriceText call PrintText FuncCoord 14,7 ld hl,Coord ld bc,$080f ld a,$14 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; yes/no menu - ld a,[$d12e] + ld a,[wd12e] cp a,$02 jp z,.buyMenuLoop ; if the player pressed the B button - ld a,[$d12d] ; ID of the chosen menu item + ld a,[wd12d] ; ID of the chosen menu item dec a jr z,.buyMenuLoop ; if the player chose No .buyItem @@ -168,11 +168,11 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call AddItemToInventory jr nc,.bagFull call SubtractAmountPaidFromMoney - ld a,[$cf0a] ; flag that is set if something is sold or bought + ld a,[wcf0a] ; flag that is set if something is sold or bought and a jr nz,.skipSettingFlag2 ld a,$01 - ld [$cf0a],a + ld [wcf0a],a .skipSettingFlag2 ld a,(SFX_02_5a - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent ; play sound @@ -183,7 +183,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) .returnToMainPokemartMenu call LoadScreenTilesFromBuffer1 ; restore save screen ld a,$13 - ld [$d125],a + ld [wd125],a call DisplayTextBoxID ; draw money text box ld hl,PokemartAnythingElseText call PrintText @@ -205,9 +205,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld hl,PokemartThankYouText call PrintText ld a,$01 - ld [$cfcb],a + ld [wcfcb],a call UpdateSprites ; move sprites - ld a,[$d07e] + ld a,[wd07e] ld [wListScrollOffset],a ret diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index e8060810..03114bca 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -1,10 +1,10 @@ Func_79f54: ; 79f54 (1e:5f54) ld a, $1 - ld [$cd50], a - ld a, [$cfcb] + ld [wcd50], a + ld a, [wcfcb] push af ld a, $ff - ld [$cfcb], a + ld [wcfcb], a ld a, $e4 ld [rOBP1], a ; $ff49 call LoadSmokeTileFourTimes @@ -26,24 +26,24 @@ Func_79f54: ; 79f54 (1e:5f54) dec c jr nz, .asm_79f73 pop af - ld [$cfcb], a + ld [wcfcb], a jp LoadPlayerSpriteGraphics Func_79f92: ; 79f92 (1e:5f92) - ld a, [$c109] + ld a, [wSpriteStateData1 + 9] ld hl, PointerTable_79fb0 ; $5fb0 ld c, a ld b, $0 add hl, bc ld a, [hli] - ld [$d08a], a + ld [wd08a], a ld a, [hli] ld e, a ld a, [hli] ld h, [hl] ld l, a push hl - ld hl, $c390 + ld hl, wOAMBuffer + $90 ld d, $0 add hl, de ld e, l diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 8968332a..583decb9 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -1,7 +1,7 @@ Func_567f9: ; 567f9 (15:67f9) ld hl, wSpriteStateData1 ld de, $4 - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c call Func_56903 ld a, [hli] @@ -20,26 +20,26 @@ Func_567f9: ; 567f9 (15:67f9) Func_56819: ; 56819 (15:6819) ld hl, wSpriteStateData1 ld de, $0004 - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c call Func_56903 ld a, [hli] - ld [$d130], a + ld [wd130], a inc hl ld a, [hl] - ld [$d131], a + ld [wd131], a ld de, $00fe add hl, de ld a, [hli] - ld [$d132], a + ld [wd132], a ld a, [hl] - ld [$d133], a + ld [wd133], a ret Func_5683d: ; 5683d (15:683d) ld hl, wSpriteStateData1 ld de, $4 - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c call Func_56903 ld a, [$ffeb] @@ -58,26 +58,26 @@ Func_5683d: ; 5683d (15:683d) Func_5685d: ; 5685d (15:685d) ld hl, wSpriteStateData1 ld de, $0004 - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c call Func_56903 - ld a, [$d130] + ld a, [wd130] ld [hli], a inc hl - ld a, [$d131] + ld a, [wd131] ld [hl], a ld de, $00fe add hl, de - ld a, [$d132] + ld a, [wd132] ld [hli], a - ld a, [$d133] + ld a, [wd133] ld [hl], a ret TrainerWalkUpToPlayer: ; 56881 (15:6881) - ld a, [$cf13] + ld a, [wcf13] swap a - ld [wTrainerSpriteOffset], a ; $cd3d + ld [wTrainerSpriteOffset], a ; wWhichTrade call ReadTrainerScreenPosition ld a, [wTrainerFacingDirection] and a @@ -127,7 +127,7 @@ TrainerWalkUpToPlayer: ; 56881 (15:6881) ld a, $c0 ; a = direction to go to jr .writeWalkScript .facingLeft - ld a, [$cd41] + ld a, [wTrainerScreenX] ld b, a ld a, $40 ; (fixed) player screen X pos call CalcDifference @@ -139,11 +139,11 @@ TrainerWalkUpToPlayer: ; 56881 (15:6881) ld b, $0 ld a, $80 ; a = direction to go to .writeWalkScript - ld hl, $cc97 - ld de, $cc97 + ld hl, wcc97 + ld de, wcc97 call FillMemory ; write the necessary steps to reach player ld [hl], $ff ; write end of list sentinel - ld a, [$cf13] + ld a, [wcf13] ld [H_DOWNARROWBLINKCNT2], a ; $ff8c jp MoveSprite_ @@ -162,7 +162,7 @@ Func_56903: ; 56903 (15:6903) CheckEngagePlayer: ; 5690f (15:690f) push hl push de - ld a, [wTrainerSpriteOffset] ; $cd3d + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $2 ld d, $0 ld e, a @@ -173,21 +173,21 @@ CheckEngagePlayer: ; 5690f (15:690f) jr nz, .spriteOnScreen ; test if sprite is on screen jp .noEngage .spriteOnScreen - ld a, [wTrainerSpriteOffset] ; $cd3d + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $9 ld d, $0 ld e, a ld hl, wSpriteStateData1 add hl, de ld a, [hl] ; c1x9: facing direction - ld [$cd3f], a + ld [wTrainerFacingDirection], a call ReadTrainerScreenPosition - ld a, [$cd40] ; sprite screen Y pos + ld a, [wTrainerScreenY] ; sprite screen Y pos ld b, a ld a, $3c cp b jr z, .linedUpY - ld a, [$cd41] ; sprite screen X pos + ld a, [wTrainerScreenX] ; sprite screen X pos ld b, a ld a, $40 cp b @@ -195,7 +195,7 @@ CheckEngagePlayer: ; 5690f (15:690f) xor a jp .noEngage .linedUpY - ld a, [$cd41] ; sprite screen X pos + ld a, [wTrainerScreenX] ; sprite screen X pos ld b, a ld a, $40 ; (fixed) player X position call CalcDifference ; calc distance @@ -205,7 +205,7 @@ CheckEngagePlayer: ; 5690f (15:690f) xor a jr .noEngage .linedUpX - ld a, [$cd40] ; sprite screen Y pos + ld a, [wTrainerScreenY] ; sprite screen Y pos ld b, a ld a, $3c ; (fixed) player Y position call CalcDifference ; calc distance @@ -216,7 +216,7 @@ CheckEngagePlayer: ; 5690f (15:690f) jp .noEngage .engage call CheckPlayerIsInFrontOfSprite - ld a, [wTrainerSpriteOffset] ; $cd3d + ld a, [wTrainerSpriteOffset] ; wWhichTrade and a jr z, .noEngage ld hl, wFlags_0xcd60 @@ -224,29 +224,29 @@ CheckEngagePlayer: ; 5690f (15:690f) call EngageMapTrainer ld a, $ff .noEngage: ; 56988 (15:6988) - ld [wTrainerSpriteOffset], a ; $cd3d + ld [wTrainerSpriteOffset], a ; wWhichTrade pop de pop hl ret -; reads trainer's Y position to $cd40 and X position to $cd41 +; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX ReadTrainerScreenPosition: ; 5698e (15:698e) - ld a, [wTrainerSpriteOffset] ; $cd3d + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $4 ld d, $0 ld e, a ld hl, wSpriteStateData1 add hl, de ld a, [hl] - ld [$cd40], a - ld a, [wTrainerSpriteOffset] ; $cd3d + ld [wTrainerScreenY], a + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $6 ld d, $0 ld e, a ld hl, wSpriteStateData1 add hl, de ld a, [hl] - ld [$cd41], a + ld [wTrainerScreenX], a ret ; checks if the sprite is properly lined up with the player with respect to the direction it's looking. Also checks the distance between player and sprite @@ -259,7 +259,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) jr nc, .checkIfLinedUp jr .notInLine ; player too far away .checkIfLinedUp - ld a, [$cd3f] ; sprite facing direction + ld a, [wTrainerFacingDirection] ; sprite facing direction cp $0 ; down jr z, .checkXCoord cp $4 ; up @@ -270,13 +270,13 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) jr z, .checkYCoord jr .notInLine .checkXCoord - ld a, [$cd41] ; sprite screen X position + ld a, [wTrainerScreenX] ; sprite screen X position ld b, a cp $40 jr z, .inLine jr .notInLine .checkYCoord - ld a, [$cd40] ; sprite screen Y position + ld a, [wTrainerScreenY] ; sprite screen Y position ld b, a cp $3c jr nz, .notInLine @@ -289,10 +289,10 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) ; tests if the player is in front of the sprite (rather than behind it) CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) - ld a, [W_CURMAP] ; $d35e + ld a, [W_CURMAP] ; W_CURMAP cp POWER_PLANT jp z, .engage ; XXX not sure why bypass this for power plant (maybe to get voltorb fake items to work?) - ld a, [wTrainerSpriteOffset] ; $cd3d + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $4 ld d, $0 ld e, a @@ -303,38 +303,38 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) jr nz, .notOnTopmostTile ; special case if sprite is on topmost tile (Y = $fc (-4)), make it come down a block ld a, $c .notOnTopmostTile - ld [$cd40], a - ld a, [wTrainerSpriteOffset] ; $cd3d + ld [wTrainerScreenY], a + ld a, [wTrainerSpriteOffset] ; wWhichTrade add $6 ld d, $0 ld e, a ld hl, wSpriteStateData1 add hl, de ld a, [hl] ; c1x6 (sprite screen X pos) - ld [$cd41], a - ld a, [$cd3f] ; facing direction + ld [wTrainerScreenX], a + ld a, [wTrainerFacingDirection] ; facing direction cp $0 jr nz, .notFacingDown - ld a, [$cd40] ; sprite screen Y pos + ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr c, .engage ; sprite above player jr .noEngage ; sprite below player .notFacingDown cp $4 jr nz, .notFacingUp - ld a, [$cd40] ; sprite screen Y pos + ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr nc, .engage ; sprite below player jr .noEngage ; sprite above player .notFacingUp cp $8 jr nz, .notFacingLeft - ld a, [$cd41] ; sprite screen X pos + ld a, [wTrainerScreenX] ; sprite screen X pos cp $40 jr nc, .engage ; sprite right of player jr .noEngage ; sprite left of player .notFacingLeft - ld a, [$cd41] ; sprite screen X pos + ld a, [wTrainerScreenX] ; sprite screen X pos cp $40 jr nc, .noEngage ; sprite right of player .engage @@ -343,5 +343,5 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) .noEngage xor a .done - ld [wTrainerSpriteOffset], a ; $cd3d + ld [wTrainerSpriteOffset], a ; wWhichTrade ret -- cgit v1.2.3 From da0a72cdbf45fa624b2d1151afe94a98d7da2ae0 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 29 May 2014 01:31:46 -0700 Subject: Use VRAM constants where applicable. --- engine/overworld/cut.asm | 12 ++++++------ engine/overworld/emotion_bubbles.asm | 2 +- engine/overworld/healing_machine.asm | 2 +- engine/overworld/ledges.asm | 2 +- engine/overworld/map_sprites.asm | 6 +++--- engine/overworld/player_animations.asm | 24 ++++++++++++------------ engine/overworld/ssanne.asm | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 78945c59..922d01e7 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -80,22 +80,22 @@ AnimateCutTree: ; eff7 (3:6ff7) cp $52 jr z, .asm_f020 ld de, Overworld_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row - ld hl, $8fc0 + ld hl, vChars1 + $7c0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData ld de, Overworld_GFX + $3d0 ; $43d0 ; cuttable tree sprite bottom row - ld hl, $8fe0 + ld hl, vChars1 + $7e0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData jr asm_f055 .asm_f020 - ld hl, $8fc0 + ld hl, vChars1 + $7c0 call LoadCutTreeOAM - ld hl, $8fd0 + ld hl, vChars1 + $7d0 call LoadCutTreeOAM - ld hl, $8fe0 + ld hl, vChars1 + $7e0 call LoadCutTreeOAM - ld hl, $8ff0 + ld hl, vChars1 + $7f0 call LoadCutTreeOAM call asm_f055 ld hl, wOAMBuffer + $93 diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 12cae862..27214240 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -8,7 +8,7 @@ PrintEmotionBubble: ; 17c47 (5:7c47) ld e, [hl] inc hl ld d, [hl] - ld hl, $8f80 + ld hl, vChars1 + $780 ld bc, (BANK(EmotionBubblesPointerTable) << 8) + $04 call CopyVideoData ld a, [wcfcb] diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 1dcb5054..f9636fcb 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -1,6 +1,6 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7 - ld hl, $87c0 + ld hl, vChars0 + $7c0 ld bc, (BANK(PokeCenterFlashingMonitorAndHealBall) << 8) + $03 call CopyVideoData ld hl, wcfcb diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index a94f79f6..1da91880 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -69,7 +69,7 @@ LedgeTiles: ; 1a6cf (6:66cf) db $FF LoadHoppingShadowOAM: ; 1a6f0 (6:66f0) - ld hl, $8ff0 + ld hl, vChars1 + $7f0 ld de, LedgeHoppingShadow ; $6708 ld bc, (BANK(LedgeHoppingShadow) << 8) + $01 call CopyVideoDataDouble diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 297c45b8..81443c9f 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -126,7 +126,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) push af push de push bc - ld hl,$8000 ; VRAM base address + ld hl,vNPCSprites ; VRAM base address ld bc,$c0 ; number of bytes per VRAM slot ld a,[$ff8d] cp a,11 ; is it a 4-tile sprite? @@ -141,12 +141,12 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) jr nz,.calculateVRAMAddrLoop jr .loadStillTilePattern .fourTileSpriteVRAMAddr - ld hl,$87c0 ; address for second 4-tile sprite + ld hl,vSprites + $7c0 ; address for second 4-tile sprite ld a,[$ff8e] ; 4-tile sprite counter and a ; is it the first 4-tile sprite? jr nz,.loadStillTilePattern ; if it's the first 4-tile sprite - ld hl,$8780 ; address for first 4-tile sprite + ld hl,vSprites + $780 ; address for first 4-tile sprite inc a ld [$ff8e],a ; 4-tile sprite counter .loadStillTilePattern diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 0b654369..45051531 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -45,7 +45,7 @@ Func_70510: ; 70510 (1c:4510) .asm_70568 pop hl ld de, BirdSprite ; $4d80 - ld hl, $8000 + ld hl, vNPCSprites ld bc, (BANK(BirdSprite) << 8) + $0c call CopyVideoData call Func_706d7 @@ -244,11 +244,11 @@ Func_706ae: ; 706ae (1c:46ae) Func_706d7: ; 706d7 (1c:46d7) ld de, BirdSprite ; $4d80 - ld hl, $8000 + ld hl, vNPCSprites ld bc, (BANK(BirdSprite) << 8) + $0c call CopyVideoData ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite - ld hl, $8800 + ld hl, vNPCSprites2 ld bc, (BANK(BirdSprite) << 8) + $0c jp CopyVideoData @@ -379,7 +379,7 @@ Func_707b6: ; 707b6 (1c:47b6) ld hl, wd736 set 6, [hl] ld de, RedSprite ; $4180 - ld hl, $8000 + ld hl, vNPCSprites ld bc, (BANK(RedSprite) << 8) + $0c call CopyVideoData ld a, $4 @@ -468,20 +468,20 @@ FishingRodGfxProperties: ; 70856 (1c:4856) RedFishingTiles: ; 70866 (1c:4866) dw RedFishingTilesFront - db $02, $1E - dw $8020 + db 2, BANK(RedFishingTilesFront) + dw vNPCSprites + $20 dw RedFishingTilesBack - db $02, $1E - dw $8060 + db 2, BANK(RedFishingTilesBack) + dw vNPCSprites + $60 dw RedFishingTilesSide - db $02, $1E - dw $80A0 + db 2, BANK(RedFishingTilesSide) + dw vNPCSprites + $a0 dw RedFishingRodTiles - db $03, $1E - dw $8FD0 + db 3, BANK(RedFishingRodTiles) + dw vNPCSprites2 + $7d0 _HandleMidJump: ; 7087e (1c:487e) ld a, [wd714] diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index 03114bca..8fd8f99a 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -65,7 +65,7 @@ PointerTable_79fb0: ; 79fb0 (1e:5fb0) dw Func_79337 LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0) - ld hl, $8fc0 + ld hl, vChars1 + $7c0 ld c, $4 .loop push bc -- cgit v1.2.3 From 188ac8a9b4816dd98df0108314e58885c3b07452 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 May 2014 01:30:10 -0700 Subject: Remove redundant dimensions in image filenames. --- engine/overworld/emotion_bubbles.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld') diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 27214240..a8d863df 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -65,4 +65,4 @@ EmotionBubblesOAM: ; 17cb5 (5:7cb5) db $FA,$00,$FB,$00 EmotionBubbles: ; 17cbd (5:7cbd) - INCBIN "gfx/emotion_bubbles.w16.2bpp" + INCBIN "gfx/emotion_bubbles.2bpp" -- cgit v1.2.3 From fadac928bccb9be1010e73df3253021312f5a2fb Mon Sep 17 00:00:00 2001 From: "U-Fish-PC\\Daniel" Date: Mon, 9 Jun 2014 16:18:29 -0400 Subject: Clean up music bank references --- engine/overworld/healing_machine.asm | 2 +- engine/overworld/npc_movement.asm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index f9636fcb..a30a5dff 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -41,7 +41,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, $ff ld [wc0ee], a call PlaySound - ld a, Bank(Func_9876) + ld a, BANK(Music_PkmnHealed) ld [wc0ef], a .asm_70495 ld a, MUSIC_PKMN_HEALED diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 234b7645..260dafd9 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -158,7 +158,7 @@ PointerTable_1a510: ; 1a510 (6:6510) dw Func_1a56b Func_1a514: ; 1a514 (6:6514) - ld a, Bank(Func_9876) + ld a, BANK(Music_MuseumGuy) ld [wc0ef], a ld [wc0f0], a ld a, MUSIC_MUSEUM_GUY @@ -215,7 +215,7 @@ PointerTable_1a57d: ; 1a57d (6:657d) dw Func_1a56b Func_1a581: ; 1a581 (6:6581) - ld a, Bank(Func_9876) + ld a, BANK(Music_MuseumGuy) ld [wc0ef], a ld [wc0f0], a ld a, MUSIC_MUSEUM_GUY -- cgit v1.2.3 From 53ae0e93fad9f4c3eaef92f102b1eeb531e59d68 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 14 Jun 2014 04:12:40 -0700 Subject: Use monster struct macros in wram. Rename related labels for consistency. --- engine/overworld/cut.asm | 2 +- engine/overworld/healing_machine.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 922d01e7..29b52eb9 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -30,7 +30,7 @@ asm_ef82: ; ef82 (3:6f82) ld a, $1 ld [wcd6a], a ld a, [wWhichPokemon] ; wWhichPokemon - ld hl, W_PARTYMON1NAME ; W_PARTYMON1NAME + ld hl, wPartyMonNicks ; wPartyMonNicks call GetPartyMonName ld hl, wd730 set 6, [hl] diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index a30a5dff..9c93583d 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -24,7 +24,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld a, [wMusicHeaderPointer] and a jr nz, .asm_70464 - ld a, [W_NUMINPARTY] ; W_NUMINPARTY + ld a, [wPartyCount] ; wPartyCount ld b, a .asm_7046e call Func_70503 -- cgit v1.2.3 From 38ac74f22285974bda6a0ed537958def8415076e Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 11:37:36 -0700 Subject: Remove generated "indirect jump" comments. The destination is obvious when using the predef macro. --- engine/overworld/card_key.asm | 4 ++-- engine/overworld/ledges.asm | 2 +- engine/overworld/movement.asm | 2 +- engine/overworld/npc_movement.asm | 2 +- engine/overworld/player_animations.asm | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 0dbbb665..991512bb 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -9,7 +9,7 @@ PrintCardKeyText: ; 52673 (14:6673) cp b jr nz, .asm_5267a ld a, $35 - call Predef ; indirect jump to Func_c586 (c586 (3:4586)) + call Predef ld a, [wcfc6] cp $18 jr z, .asm_5269c @@ -50,7 +50,7 @@ PrintCardKeyText: ; 52673 (14:6673) .asm_526ca ld [wd09f], a ld a, $17 - call Predef ; indirect jump to Func_ee9e + call Predef ld hl, wd126 set 5, [hl] ld a, (SFX_1f_57 - SFX_Headers_1f) / 3 diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index 1da91880..c1db3d43 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -6,7 +6,7 @@ HandleLedges: ; 1a672 (6:6672) and a ; OVERWORLD ret nz ld a, $35 - call Predef ; indirect jump to Func_c586 (c586 (3:4586)) + call Predef ld a, [wSpriteStateData1 + 9] ld b, a FuncCoord 8, 9 diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index a01a5d0a..374b8ea6 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -459,7 +459,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: ; 50dc (1:50dc) ld a, $12 - call Predef ; indirect jump to IsMissableObjectHidden (f1a6 (3:71a6)) + call Predef ld a, [$ffe5] and a jp nz, .spriteInvisible diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index 260dafd9..d228df76 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -146,7 +146,7 @@ Func_1a4f4: ; 1a4f4 (6:64f4) ld a, $0 ld [wcc4d], a ld a, $11 - call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7)) + call Predef ld hl, wd730 res 7, [hl] ld hl, wd72e diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 45051531..68a6b170 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -422,7 +422,7 @@ Func_707b6: ; 707b6 (1c:47b6) ld [hli], a ld [hl], a ld a, $4c - call Predef ; indirect jump to PrintEmotionBubble (17c47 (5:7c47)) + call Predef ld a, [wSpriteStateData1 + 2] cp $4 jr nz, .asm_70833 -- cgit v1.2.3 From 35f2bb90d4a8f8e4dcac3fbab7d89cbc590285e8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:03:05 -0700 Subject: Rename predef functions so they aren't excessive in length. This is mostly because of an rgbasm bug that prevents macro arguments from exceeding 16 characters, but the names were bad anyway. --- engine/overworld/emotion_bubbles.asm | 2 +- engine/overworld/item.asm | 2 +- engine/overworld/player_animations.asm | 2 +- engine/overworld/trainers.asm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index a8d863df..ae7702b4 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -1,4 +1,4 @@ -PrintEmotionBubble: ; 17c47 (5:7c47) +EmotionBubble: ; 17c47 (5:7c47) ld a, [wcd50] ld c, a ld b, $0 diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index c66fc143..a75c393c 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -32,7 +32,7 @@ PickupItem: ld a, [$ffdb] ld [wcc4d], a - ld a, $11 ; RemoveMissableObject + ld a, $11 ; HideObject call Predef ld a, 1 ld [wcc3c], a diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 68a6b170..184d38f4 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -89,7 +89,7 @@ Func_705aa: ; 705aa (1c:45aa) ld [hl], a jp Func_70755 -_DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba) +_LeaveMapAnim: ; 705ba (1c:45ba) call Func_706ef call Func_70787 ld a, b diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 583decb9..b05ddbf1 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -159,7 +159,7 @@ Func_56903: ; 56903 (15:6903) ret ; tests if this trainer is in the right position to engage the player and do so if she is. -CheckEngagePlayer: ; 5690f (15:690f) +TrainerEngage: ; 5690f (15:690f) push hl push de ld a, [wTrainerSpriteOffset] ; wWhichTrade -- cgit v1.2.3 From d10108a066c102bf2d167ac656d79308e41f304e Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:25:46 -0700 Subject: Use macros to define predefs. --- engine/overworld/pokecenter.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld') diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index 2dedc437..3c640d8e 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -21,7 +21,7 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6) ld a, $18 ld [wSpriteStateData1 + $12], a ; make the nurse turn to face the machine call Delay3 - PREDEF HealPartyPredef + predef HealParty callba AnimateHealingMachine ; do the healing machine animation xor a ld [wMusicHeaderPointer], a -- cgit v1.2.3 From b36f793667924f868282ce979fabab3e95d642a5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:57:26 -0700 Subject: Use macros for predef calls/jumps instead of static ids. --- engine/overworld/card_key.asm | 6 ++---- engine/overworld/hidden_items.asm | 18 ++++++------------ engine/overworld/item.asm | 3 +-- engine/overworld/ledges.asm | 3 +-- engine/overworld/movement.asm | 3 +-- engine/overworld/npc_movement.asm | 12 ++++-------- engine/overworld/player_animations.asm | 3 +-- 7 files changed, 16 insertions(+), 32 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 991512bb..f48c26f4 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -8,8 +8,7 @@ PrintCardKeyText: ; 52673 (14:6673) ret z cp b jr nz, .asm_5267a - ld a, $35 - call Predef + predef Func_c586 ld a, [wcfc6] cp $18 jr z, .asm_5269c @@ -49,8 +48,7 @@ PrintCardKeyText: ; 52673 (14:6673) ld a, $e .asm_526ca ld [wd09f], a - ld a, $17 - call Predef + predef Func_ee9e ld hl, wd126 set 5, [hl] ld a, (SFX_1f_57 - SFX_Headers_1f) / 3 diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 21ccdaad..77bd8fe6 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -6,8 +6,7 @@ HiddenItems: ; 76688 (1d:6688) ld a, [wTrainerScreenX] ld c, a ld b, $2 - ld a, $10 - call Predef + predef FlagActionPredef ld a, c and a ret nz @@ -35,8 +34,7 @@ FoundHiddenItemText: ; 7675b (1d:675b) ld a, [wTrainerScreenX] ld c, a ld b, $1 - ld a, $10 - call Predef + predef FlagActionPredef ld a, (SFX_02_3b - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent ; play sound call WaitForSoundToFinish ; wait for sound to finish playing @@ -55,8 +53,7 @@ HiddenItemBagFullText: ; 76794 (1d:6794) HiddenCoins: ; 76799 (1d:6799) ld b, COIN_CASE - ld a, $1c - call Predef + predef IsItemInBag_ ld a, b and a ret z @@ -67,8 +64,7 @@ HiddenCoins: ; 76799 (1d:6799) ld a, [wTrainerScreenX] ld c, a ld b, $2 - ld a, $10 - call Predef + predef FlagActionPredef ld a, c and a ret nz @@ -104,14 +100,12 @@ HiddenCoins: ; 76799 (1d:6799) ld de, wPlayerCoins + 1 ld hl, $ffa1 ld c, $2 - ld a, $b ; AddBCDPredef - call Predef + predef AddBCDPredef ld hl, wd6fe ld a, [wTrainerScreenX] ld c, a ld b, $1 - ld a, $10 - call Predef + predef FlagActionPredef call EnableAutoTextBoxDrawing ld a, [wPlayerCoins] cp $99 diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index a75c393c..a69ec106 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -32,8 +32,7 @@ PickupItem: ld a, [$ffdb] ld [wcc4d], a - ld a, $11 ; HideObject - call Predef + predef HideObject ld a, 1 ld [wcc3c], a ld hl, FoundItemText diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index c1db3d43..b64a1174 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -5,8 +5,7 @@ HandleLedges: ; 1a672 (6:6672) ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET and a ; OVERWORLD ret nz - ld a, $35 - call Predef + predef Func_c586 ld a, [wSpriteStateData1 + 9] ld b, a FuncCoord 8, 9 diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 374b8ea6..f8dd5fc4 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -458,8 +458,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: ; 50dc (1:50dc) - ld a, $12 - call Predef + predef IsObjectHidden ld a, [$ffe5] and a jp nz, .spriteInvisible diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm index d228df76..2cf6fea9 100755 --- a/engine/overworld/npc_movement.asm +++ b/engine/overworld/npc_movement.asm @@ -86,8 +86,7 @@ Func_1a485: ; 1a485 (6:6485) ld a, [wcca1] ld [wcd38], a ld [$ff95], a - ld a, $23 - call Predef + predef Func_f9a0 call Func_3486 ld a, $2 ld [wcf10], a @@ -145,8 +144,7 @@ Func_1a4f4: ; 1a4f4 (6:64f4) ret nz ld a, $0 ld [wcc4d], a - ld a, $11 - call Predef + predef HideObject ld hl, wd730 res 7, [hl] ld hl, wd72e @@ -175,8 +173,7 @@ Func_1a514: ; 1a514 (6:6514) ld [wcd38], a xor a ld [wd12f], a - ld a, $4f - call Predef + predef PewterGuys ld hl, wcc97 ld de, RLEList_PewterMuseumGuy call DecodeRLEList @@ -233,8 +230,7 @@ Func_1a581: ; 1a581 (6:6581) ld [wcd38], a ld a, $1 ld [wd12f], a - ld a, $4f - call Predef + predef PewterGuys ld hl, wcc97 ld de, RLEList_PewterGymGuy call DecodeRLEList diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 184d38f4..ee4c999d 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -421,8 +421,7 @@ Func_707b6: ; 707b6 (1c:47b6) xor a ld [hli], a ld [hl], a - ld a, $4c - call Predef + predef EmotionBubble ld a, [wSpriteStateData1 + 2] cp $4 jr nz, .asm_70833 -- cgit v1.2.3 From bd533aa79bbe1998fd2b699bd7205da2de4fe55c Mon Sep 17 00:00:00 2001 From: "U-Fish-PC\\Daniel" Date: Wed, 25 Jun 2014 16:58:27 -0400 Subject: Use *Coord instead of FuncCoord Using 'Coord =' doesn't like using wTileMap So use hlCoord, deCoord, bcCoord, aCoord, Coorda, or dwCoord to avoid static addresses --- engine/overworld/cinnabar_lab.asm | 3 +-- engine/overworld/doors.asm | 3 +-- engine/overworld/ledges.asm | 3 +-- engine/overworld/movement.asm | 3 +-- engine/overworld/player_animations.asm | 3 +-- engine/overworld/pokemart.asm | 6 ++---- 6 files changed, 7 insertions(+), 14 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm index bb202333..eefa2176 100755 --- a/engine/overworld/cinnabar_lab.asm +++ b/engine/overworld/cinnabar_lab.asm @@ -101,8 +101,7 @@ Func_610c2: ; 610c2 (18:50c2) push hl ld [wd11e], a call GetItemName - FuncCoord 2, 2 - ld hl, Coord + hlCoord 2, 2 ld a, [$ffdb] ld bc, $28 call AddNTimes diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm index 6337f511..42ebb174 100755 --- a/engine/overworld/doors.asm +++ b/engine/overworld/doors.asm @@ -10,8 +10,7 @@ HandleDoors: ; 1a609 (6:6609) ld a, [hli] ld h, [hl] ld l, a - FuncCoord 8, 9 - ld a, [Coord] + aCoord 8, 9 ld b, a .asm_1a621 ld a, [hli] diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index b64a1174..43df82e2 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -8,8 +8,7 @@ HandleLedges: ; 1a672 (6:6672) predef Func_c586 ld a, [wSpriteStateData1 + 9] ld b, a - FuncCoord 8, 9 - ld a, [Coord] + aCoord 8, 9 ld c, a ld a, [wcfc6] ld d, a diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index f8dd5fc4..f08a20cb 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -8,8 +8,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) ld [wSpriteStateData2], a jr .asm_4e4a .asm_4e41 - FuncCoord 8, 9 - ld a, [Coord] + aCoord 8, 9 ld [$ff93], a cp $60 jr c, .asm_4e50 diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index ee4c999d..a0d8175f 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -349,8 +349,7 @@ Func_70787: ; 70787 (1c:4787) jr z, .asm_707a4 cp c jr nz, .asm_7079e - FuncCoord 8, 9 - ld a, [Coord] + aCoord 8, 9 cp [hl] jr z, .asm_707a2 .asm_7079e diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index adae76de..3b06bd2c 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -77,8 +77,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld hl,PokemartTellSellPriceText ld bc,$0e01 call PrintText - FuncCoord 14,7 - ld hl,Coord + hlCoord 14, 7 ld bc,$080f ld a,$14 ld [wd125],a @@ -149,8 +148,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call CopyStringToCF4B ; copy name to wcf4b ld hl,PokemartTellBuyPriceText call PrintText - FuncCoord 14,7 - ld hl,Coord + hlCoord 14, 7 ld bc,$080f ld a,$14 ld [wd125],a -- cgit v1.2.3