summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/overworld.asm50
-rw-r--r--home/text.asm8
-rw-r--r--home/vblank.asm4
-rw-r--r--home/vcopy.asm20
4 files changed, 45 insertions, 37 deletions
diff --git a/home/overworld.asm b/home/overworld.asm
index 9b60d7e9..3675eca8 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -106,13 +106,14 @@ OverworldLoopLessDelay::
aCoord 8, 9
ld [wTilePlayerStandingOn],a ; unused?
call DisplayTextID ; display either the start menu or the NPC/sign text
- ld a,[wcc47]
+ ld a,[wEnteringCableClub]
and a
jr z,.checkForOpponent
dec a
- ld a,$00
- ld [wcc47],a
+ ld a,0
+ ld [wEnteringCableClub],a
jr z,.changeMap
+; XXX can this code be reached?
predef LoadSAV
ld a,[W_CURMAP]
ld [wDestinationMap],a
@@ -132,8 +133,8 @@ OverworldLoopLessDelay::
ld hl,wFlags_0xcd60
res 2,[hl]
call UpdateSprites
- ld a,$01
- ld [wcc4b],a
+ ld a,1
+ ld [wCheckFor180DegreeTurn],a
ld a,[wPlayerMovingDirection] ; the direction that was pressed last time
and a
jp z,OverworldLoop
@@ -174,7 +175,7 @@ OverworldLoopLessDelay::
ld a,[wd730]
bit 7,a ; are we simulating button presses?
jr nz,.noDirectionChange ; ignore direction changes if we are
- ld a,[wcc4b]
+ ld a,[wCheckFor180DegreeTurn]
and a
jr z,.noDirectionChange
ld a,[wPlayerDirection] ; new direction
@@ -182,39 +183,44 @@ OverworldLoopLessDelay::
ld a,[wPlayerLastStopDirection] ; old direction
cp b
jr z,.noDirectionChange
-; the code below is strange
-; it computes whether or not the player did a 180 degree turn, but then overwrites the result
-; also, it does a seemingly pointless loop afterwards
+; Check whether the player did a 180-degree turn.
+; It appears that this code was supposed to show the player rotate by having
+; the player's sprite face an intermediate direction before facing the opposite
+; direction (instead of doing an instantaneous about-face), but the intermediate
+; direction is only set for a short period of time. It is unlikely for it to
+; ever be visible because DelayFrame is called at the start of OverworldLoop and
+; normally not enough cycles would be executed between then and the time the
+; direction is set for V-blank to occur while the direction is still set.
swap a ; put old direction in upper half
or b ; put new direction in lower half
cp a,(PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up
jr nz,.notDownToUp
ld a,PLAYER_DIR_LEFT
ld [wPlayerMovingDirection],a
- jr .oddLoop
+ jr .holdIntermediateDirectionLoop
.notDownToUp
cp a,(PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down
jr nz,.notUpToDown
ld a,PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection],a
- jr .oddLoop
+ jr .holdIntermediateDirectionLoop
.notUpToDown
cp a,(PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left
jr nz,.notRightToLeft
ld a,PLAYER_DIR_DOWN
ld [wPlayerMovingDirection],a
- jr .oddLoop
+ jr .holdIntermediateDirectionLoop
.notRightToLeft
cp a,(PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right
- jr nz,.oddLoop
+ jr nz,.holdIntermediateDirectionLoop
ld a,PLAYER_DIR_UP
ld [wPlayerMovingDirection],a
-.oddLoop
+.holdIntermediateDirectionLoop
ld hl,wFlags_0xcd60
set 2,[hl]
- ld hl,wcc4b
+ ld hl,wCheckFor180DegreeTurn
dec [hl]
- jr nz,.oddLoop
+ jr nz,.holdIntermediateDirectionLoop
ld a,[wPlayerDirection]
ld [wPlayerMovingDirection],a
call NewBattle
@@ -465,16 +471,16 @@ WarpFound1:: ; 0735 (0:0735)
WarpFound2:: ; 073c (0:073c)
ld a,[wNumberOfWarps]
sub c
- ld [wd73b],a ; save ID of used warp
+ ld [wWarpedFromWhichWarp],a ; save ID of used warp
ld a,[W_CURMAP]
- ld [wd73c],a
+ ld [wWarpedFromWhichMap],a
call CheckIfInOutsideMap
jr nz,.indoorMaps
; this is for handling "outside" maps that can't have the 0xFF destination map
ld a,[W_CURMAP]
ld [wLastMap],a
ld a,[W_CURMAPWIDTH]
- ld [wd366],a
+ ld [wUnusedD366],a ; not read
ld a,[hWarpDestinationMap]
ld [W_CURMAP],a
cp a,ROCK_TUNNEL_1
@@ -493,7 +499,7 @@ WarpFound2:: ; 073c (0:073c)
; if not going back to the previous map
ld [W_CURMAP],a
callba IsPlayerStandingOnWarpPadOrHole
- ld a,[wcd5b]
+ ld a,[wStandingOnWarpPadOrHole]
dec a ; is the player on a warp pad?
jr nz,.notWarpPad
; if the player is on a warp pad
@@ -2007,7 +2013,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063)
LoadMapHeader:: ; 107c (0:107c)
callba MarkTownVisitedAndLoadMissableObjects
ld a,[W_CURMAPTILESET]
- ld [wd119],a
+ ld [wUnusedD119],a
ld a,[W_CURMAP]
call SwitchToMapRomBank
ld a,[W_CURMAPTILESET]
@@ -2305,7 +2311,7 @@ LoadMapData:: ; 1241 (0:1241)
ld [hSCY],a
ld [hSCX],a
ld [wWalkCounter],a
- ld [wd119],a
+ ld [wUnusedD119],a
ld [wWalkBikeSurfStateCopy],a
ld [W_SPRITESETID],a
call LoadTextBoxTilePatterns
diff --git a/home/text.asm b/home/text.asm
index d57fc03f..366dfd73 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -376,9 +376,9 @@ TextCommandProcessor:: ; 1b40 (0:1b40)
xor e
ld [wLetterPrintingDelayFlags],a
ld a,c
- ld [wcc3a],a
+ ld [wUnusedCC3A],a
ld a,b
- ld [wcc3b],a
+ ld [wUnusedCC3B],a
NextTextCommand:: ; 1b55 (0:1b55)
ld a,[hli]
@@ -487,10 +487,10 @@ TextCommand02:: ; 1ba5 (0:1ba5)
TextCommand03:: ; 1bb7 (0:1bb7)
pop hl
ld a,[hli]
- ld [wcc3a],a
+ ld [wUnusedCC3A],a
ld c,a
ld a,[hli]
- ld [wcc3b],a
+ ld [wUnusedCC3B],a
ld b,a
jp NextTextCommand
diff --git a/home/vblank.asm b/home/vblank.asm
index 05b01a3d..6abc3756 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -6,7 +6,7 @@ VBlank::
push hl
ld a, [H_LOADEDROMBANK]
- ld [wd122], a
+ ld [wVBlankSavedROMBank], a
ld a, [hSCX]
ld [rSCX], a
@@ -78,7 +78,7 @@ VBlank::
and a
call z, ReadJoypad
- ld a, [wd122]
+ ld a, [wVBlankSavedROMBank]
ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a
diff --git a/home/vcopy.asm b/home/vcopy.asm
index 8de00e38..02caef29 100644
--- a/home/vcopy.asm
+++ b/home/vcopy.asm
@@ -380,21 +380,23 @@ UpdateMovingBgTiles::
and a
ret z ; no animations if indoors (or if a menu set this to 0)
- ld a, [$ffd8]
+ ld a, [hMovingBGTilesCounter1]
inc a
- ld [$ffd8], a
- cp $14
+ ld [hMovingBGTilesCounter1], a
+ cp 20
ret c
- cp $15
+ cp 21
jr z, .flower
+; water
+
ld hl, vTileset + $14 * $10
ld c, $10
- ld a, [wd085]
+ ld a, [wMovingBGTilesCounter2]
inc a
and 7
- ld [wd085], a
+ ld [wMovingBGTilesCounter2], a
and 4
jr nz, .left
@@ -417,14 +419,14 @@ UpdateMovingBgTiles::
ret nc
; if in a cave, no flower animations
xor a
- ld [$ffd8], a
+ ld [hMovingBGTilesCounter1], a
ret
.flower
xor a
- ld [$ffd8], a
+ ld [hMovingBGTilesCounter1], a
- ld a, [wd085]
+ ld a, [wMovingBGTilesCounter2]
and 3
cp 2
ld hl, FlowerTile1