diff options
Diffstat (limited to 'engine/overworld/trainers.asm')
-rwxr-xr-x | engine/overworld/trainers.asm | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 66ae20ce..9dee81bd 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -1,23 +1,23 @@ -_GetSpritePosition1: ; 567f9 (15:67f9) +_GetSpritePosition1: ; 56745 (15:6745) ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer - ld a, [hli] + ld a, [hli] ; c1x4 (screen Y pos) ld [$ffeb], a inc hl - ld a, [hl] + ld a, [hl] ; c1x6 (screen X pos) ld [$ffec], a - ld de, $fe + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de - ld a, [hli] + ld a, [hli] ; c2x4 (map Y pos) ld [$ffed], a - ld a, [hl] + ld a, [hl] ; c2x5 (map X pos) ld [$ffee], a ret -_GetSpritePosition2: ; 56819 (15:6819) +_GetSpritePosition2: ; 56765 (15:6765) ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] @@ -28,7 +28,7 @@ _GetSpritePosition2: ; 56819 (15:6819) inc hl ld a, [hl] ; c1x6 (screen X pos) ld [wSavedSpriteScreenX], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [hli] ; c2x4 (map Y pos) ld [wSavedSpriteMapY], a @@ -36,7 +36,7 @@ _GetSpritePosition2: ; 56819 (15:6819) ld [wSavedSpriteMapX], a ret -_SetSpritePosition1: ; 5683d (15:683d) +_SetSpritePosition1: ; 56789 (15:6789) ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] @@ -47,7 +47,7 @@ _SetSpritePosition1: ; 5683d (15:683d) inc hl ld a, [$ffec] ; c1x6 (screen X pos) ld [hl], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [$ffed] ; c2x4 (map Y pos) ld [hli], a @@ -55,36 +55,36 @@ _SetSpritePosition1: ; 5683d (15:683d) ld [hl], a ret -_SetSpritePosition2: ; 5685d (15:685d) +_SetSpritePosition2: ; 567a9 (15:67a9) ld hl, wSpriteStateData1 - ld de, $0004 + ld de, $4 ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer ld a, [wSavedSpriteScreenY] - ld [hli], a + ld [hli], a ; c1x4 (screen Y pos) inc hl ld a, [wSavedSpriteScreenX] - ld [hl], a - ld de, $00fe + ld [hl], a ; c1x6 (screen X pos) + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [wSavedSpriteMapY] - ld [hli], a + ld [hli], a ; c2x4 (map Y pos) ld a, [wSavedSpriteMapX] - ld [hl], a + ld [hl], a ; c2x5 (map X pos) ret -TrainerWalkUpToPlayer: ; 56881 (15:6881) +TrainerWalkUpToPlayer: ; 567cd (15:67cd) ld a, [wSpriteIndex] swap a ld [wTrainerSpriteOffset], a call ReadTrainerScreenPosition ld a, [wTrainerFacingDirection] - and a + and a ; SPRITE_FACING_DOWN jr z, .facingDown - cp $4 + cp SPRITE_FACING_UP jr z, .facingUp - cp $8 + cp SPRITE_FACING_LEFT jr z, .facingLeft jr .facingRight .facingDown @@ -148,8 +148,8 @@ TrainerWalkUpToPlayer: ; 56881 (15:6881) jp MoveSprite_ ; input: de = offset within sprite entry -; output: de = pointer to sprite data -GetSpriteDataPointer: ; 56903 (15:6903) +; output: hl = pointer to sprite data +GetSpriteDataPointer: ; 5684f (15:684f) push de add hl, de ld a, [H_SPRITEINDEX] @@ -161,7 +161,7 @@ GetSpriteDataPointer: ; 56903 (15:6903) ret ; tests if this trainer is in the right position to engage the player and do so if she is. -TrainerEngage: ; 5690f (15:690f) +TrainerEngage: ; 5685b (15:685b) push hl push de ld a, [wTrainerSpriteOffset] @@ -225,21 +225,21 @@ TrainerEngage: ; 5690f (15:690f) set 0, [hl] call EngageMapTrainer ld a, $ff -.noEngage: ; 56988 (15:6988) +.noEngage ld [wTrainerSpriteOffset], a pop de pop hl ret ; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX -ReadTrainerScreenPosition: ; 5698e (15:698e) +ReadTrainerScreenPosition: ; 568da (15:68da) ld a, [wTrainerSpriteOffset] add $4 ld d, $0 ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x4 (sprite Y pos) ld [wTrainerScreenY], a ld a, [wTrainerSpriteOffset] add $6 @@ -247,7 +247,7 @@ ReadTrainerScreenPosition: ; 5698e (15:698e) ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x6 (sprite X pos) ld [wTrainerScreenX], a ret @@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) jr .notInLine ; player too far away .checkIfLinedUp ld a, [wTrainerFacingDirection] ; sprite facing direction - cp $0 ; down + cp SPRITE_FACING_DOWN ; down jr z, .checkXCoord - cp $4 ; up + cp SPRITE_FACING_UP ; up jr z, .checkXCoord - cp $8 ; left + cp SPRITE_FACING_LEFT ; left jr z, .checkYCoord - cp $c ; right + cp SPRITE_FACING_RIGHT ; right jr z, .checkYCoord jr .notInLine .checkXCoord @@ -290,7 +290,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af) ret ; tests if the player is in front of the sprite (rather than behind it) -CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) +CheckPlayerIsInFrontOfSprite: ; 5692f (15:692f) ld a, [wCurMap] cp POWER_PLANT jp z, .engage ; bypass this for power plant to get voltorb fake items to work @@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) ld a, [hl] ; c1x6 (sprite screen X pos) ld [wTrainerScreenX], a ld a, [wTrainerFacingDirection] ; facing direction - cp $0 + cp SPRITE_FACING_DOWN jr nz, .notFacingDown ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr c, .engage ; sprite above player jr .noEngage ; sprite below player .notFacingDown - cp $4 + cp SPRITE_FACING_UP jr nz, .notFacingUp ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr nc, .engage ; sprite below player jr .noEngage ; sprite above player .notFacingUp - cp $8 + cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ld a, [wTrainerScreenX] ; sprite screen X pos cp $40 |