diff options
Diffstat (limited to 'home')
-rw-r--r-- | home/overworld.asm | 37 | ||||
-rw-r--r-- | home/vblank.asm | 4 | ||||
-rw-r--r-- | home/vcopy.asm | 20 |
3 files changed, 34 insertions, 27 deletions
diff --git a/home/overworld.asm b/home/overworld.asm index 9b60d7e9..bd9f4a0a 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -132,8 +132,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 +174,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 +182,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 @@ -493,7 +498,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 +2012,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 +2310,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/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 |