summaryrefslogtreecommitdiff
path: root/engine/overworld
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld')
-rwxr-xr-xengine/overworld/cut.asm2
-rwxr-xr-xengine/overworld/elevator.asm4
-rwxr-xr-xengine/overworld/emotion_bubbles.asm8
-rwxr-xr-xengine/overworld/hidden_items.asm20
-rw-r--r--engine/overworld/movement.asm23
-rw-r--r--engine/overworld/oam.asm2
-rwxr-xr-xengine/overworld/player_animations.asm2
-rwxr-xr-xengine/overworld/pokemart.asm2
-rwxr-xr-xengine/overworld/trainers.asm54
9 files changed, 58 insertions, 59 deletions
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index 2f13dfba..f6ae6468 100755
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -74,7 +74,7 @@ UsedCutText:
InitCutAnimOAM:
xor a
ld [wWhichAnimationOffsets], a
- ld a, $e4
+ ld a, %11100100
ld [rOBP1], a
ld a, [wCutTile]
cp $52
diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm
index 4ec34922..929e4f22 100755
--- a/engine/overworld/elevator.asm
+++ b/engine/overworld/elevator.asm
@@ -34,7 +34,7 @@ ShakeElevator:
call PlayMusic
.musicLoop
ld a, [wChannelSoundIDs + CH4]
- cp $b9
+ cp SFX_SAFARI_ZONE_PA
jr z, .musicLoop
call UpdateSprites
jp PlayDefaultMusic
@@ -56,7 +56,7 @@ ShakeElevatorRedrawRow:
add hl, de
ld a, h
and $3
- or $98
+ or vBGMap0 / $100
ld d, a
ld a, l
pop hl
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index 4df8b6f6..ac4276bd 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -17,11 +17,11 @@ EmotionBubble:
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
- ld hl, wOAMBuffer + $8f
- ld de, wOAMBuffer + $9f
+ ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
+ ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next
- ld hl, wOAMBuffer + $7f
- ld de, wOAMBuffer + $8f
+ ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
+ ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.
diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm
index 9ad760bb..32783f83 100755
--- a/engine/overworld/hidden_items.asm
+++ b/engine/overworld/hidden_items.asm
@@ -27,7 +27,7 @@ FoundHiddenItemText:
ld b, a
ld c, 1
call GiveItem
- jr nc, .BagFull
+ jr nc, .bagFull
ld hl, wObtainedHiddenItemsFlags
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
@@ -37,7 +37,7 @@ FoundHiddenItemText:
call PlaySoundWaitForCurrent
call WaitForSoundToFinish
jp TextScriptEnd
-.BagFull
+.bagFull
call WaitForTextScrollButtonPress ; wait for button press
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
@@ -77,24 +77,24 @@ HiddenCoins:
cp 20
jr z, .bcd20
cp 40
- jr z, .bcd20
+ jr z, .bcd20 ; should be bcd40
jr .bcd100
.bcd10
ld a, $10
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd20
ld a, $20
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd40 ; due to a typo, this is never used
ld a, $40
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd100
ld a, $1
ld [hCoins], a
-.bcddone
+.bcdDone
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -107,13 +107,13 @@ HiddenCoins:
call EnableAutoTextBoxDrawing
ld a, [wPlayerCoins]
cp $99
- jr nz, .RoomInCoinCase
+ jr nz, .roomInCoinCase
ld a, [wPlayerCoins + 1]
cp $99
- jr nz, .RoomInCoinCase
+ jr nz, .roomInCoinCase
tx_pre_id DroppedHiddenCoinsText
jr .done
-.RoomInCoinCase
+.roomInCoinCase
tx_pre_id FoundHiddenCoinsText
.done
jp PrintPredefTextID
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index e60f820a..6d05859e 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -393,7 +393,7 @@ UpdateSpriteMovementDelay:
ld l, a
ld [hl], $1 ; c1x1 = 1 (mark as ready to move)
notYetMoving:
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $8
ld l, a
@@ -408,7 +408,6 @@ MakeNPCFacePlayer:
ld a, [wd72d]
bit 5, a
jr nz, notYetMoving
-
res 7, [hl]
ld a, [wPlayerDirection]
bit PLAYER_DIR_BIT_UP, a
@@ -449,7 +448,7 @@ InitializeSpriteStatus:
; calculates the spprite's scrren position form its map position and the player position
InitializeSpriteScreenPosition:
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
@@ -477,7 +476,7 @@ CheckSpriteAvailability:
ld a, [$ffe5]
and a
jp nz, .spriteInvisible
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $6
ld l, a
@@ -525,7 +524,7 @@ CheckSpriteAvailability:
cp d
jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile)
.spriteInvisible
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $2
ld l, a
@@ -579,7 +578,7 @@ UpdateSpriteImage:
; e: X movement delta (-1, 0 or 1)
; set carry on failure, clears carry on success
CanWalkOntoTile:
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $6
ld l, a
@@ -590,9 +589,9 @@ CanWalkOntoTile:
and a
ret
.notScripted
- ld a, [wTileSetCollisionPtr]
+ ld a, [wTilesetCollisionPtr]
ld l, a
- ld a, [wTileSetCollisionPtr+1]
+ ld a, [wTilesetCollisionPtr+1]
ld h, a
.tilePassableLoop
ld a, [hli]
@@ -607,7 +606,7 @@ CanWalkOntoTile:
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 h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
@@ -626,14 +625,14 @@ CanWalkOntoTile:
call DetectCollisionBetweenSprites
pop bc
pop de
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $c
ld l, a
ld a, [hl] ; c1xc (directions in which sprite collision would occur)
and b ; check against chosen direction (1,2,4 or 8)
jr nz, .impassable ; collision between sprites, don't go there
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $2
ld l, a
@@ -690,7 +689,7 @@ CanWalkOntoTile:
; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to
; hl: output pointer
GetTileSpriteStandsOn:
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm
index 94082beb..2c2a3dff 100644
--- a/engine/overworld/oam.asm
+++ b/engine/overworld/oam.asm
@@ -6,7 +6,7 @@ PrepareOAMData:
dec a
jr z, .updateEnabled
- cp 0 - 1
+ cp -1
ret nz
ld [wUpdateSpritesEnabled], a
jp HideSprites
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index f7b63aaa..a17e67bd 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -388,7 +388,7 @@ FishingAnim:
set 6, [hl] ; reserve the last 4 OAM entries
ld de, RedSprite
ld hl, vNPCSprites
- lb bc, BANK(RedSprite), $0c
+ lb bc, BANK(RedSprite), $c
call CopyVideoData
ld a, $4
ld hl, RedFishingTiles
diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm
index e50c508e..823939b1 100755
--- a/engine/overworld/pokemart.asm
+++ b/engine/overworld/pokemart.asm
@@ -85,7 +85,7 @@ DisplayPokemartDialogue_:
lb bc, 14, 1 ; location that PrintText always prints to, this is useless
call PrintText
coord hl, 14, 7
- lb bc, 08, 15
+ lb bc, 8, 15
ld a,TWO_OPTION_MENU
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm
index 1d0340c9..655c6b2a 100755
--- a/engine/overworld/trainers.asm
+++ b/engine/overworld/trainers.asm
@@ -4,16 +4,16 @@ _GetSpritePosition1:
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
@@ -28,7 +28,7 @@ _GetSpritePosition2:
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
@@ -47,7 +47,7 @@ _SetSpritePosition1:
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
@@ -57,21 +57,21 @@ _SetSpritePosition1:
_SetSpritePosition2:
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:
@@ -80,11 +80,11 @@ TrainerWalkUpToPlayer:
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,7 +148,7 @@ TrainerWalkUpToPlayer:
jp MoveSprite_
; input: de = offset within sprite entry
-; output: de = pointer to sprite data
+; output: hl = pointer to sprite data
GetSpriteDataPointer:
push de
add hl, de
@@ -225,7 +225,7 @@ TrainerEngage:
set 0, [hl]
call EngageMapTrainer
ld a, $ff
-.noEngage:
+.noEngage
ld [wTrainerSpriteOffset], a
pop de
pop hl
@@ -239,7 +239,7 @@ ReadTrainerScreenPosition:
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:
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:
jr .notInLine ; player too far away
.checkIfLinedUp
ld a, [wTrainerFacingDirection] ; sprite facing direction
- cp $0 ; down
+ cp SPRITE_FACING_DOWN
jr z, .checkXCoord
- cp $4 ; up
+ cp SPRITE_FACING_UP
jr z, .checkXCoord
- cp $8 ; left
+ cp SPRITE_FACING_LEFT
jr z, .checkYCoord
- cp $c ; right
+ cp SPRITE_FACING_RIGHT
jr z, .checkYCoord
jr .notInLine
.checkXCoord
@@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite:
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