aboutsummaryrefslogtreecommitdiffstats
path: root/home
diff options
context:
space:
mode:
authordannye <corrnondacqb@yahoo.com>2016-07-16 11:11:50 -0500
committerdannye <corrnondacqb@yahoo.com>2016-07-16 11:11:50 -0500
commit707ba908f780d42e1f26af85bef0bf0eb478b877 (patch)
tree88fba78e2d9c590c4860a2e63eed00a2e29d4005 /home
parentMerge branch 'master' of https://github.com/pret/pokeyellow into merge-pokered (diff)
parentMerge pull request #15 from pret/remove-pip (diff)
downloadpokeyellow-707ba908f780d42e1f26af85bef0bf0eb478b877.tar.gz
pokeyellow-707ba908f780d42e1f26af85bef0bf0eb478b877.tar.xz
pokeyellow-707ba908f780d42e1f26af85bef0bf0eb478b877.zip
Merge branch 'master' of https://github.com/pret/pokeyellow
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm16
-rw-r--r--home/init.asm2
-rw-r--r--home/overworld.asm82
-rw-r--r--home/pic.asm4
-rw-r--r--home/serial.asm40
-rw-r--r--home/vblank.asm2
6 files changed, 63 insertions, 83 deletions
diff --git a/home/audio.asm b/home/audio.asm
index e360aab2..3cd2ffd0 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -17,6 +17,7 @@ PlayDefaultMusicFadeOutCurrent::
ld [wLastMusicSoundID], a
ld c, 8
ld d, c
+
PlayDefaultMusicCommon::
ld a, [wWalkBikeSurfState]
and a
@@ -35,7 +36,7 @@ PlayDefaultMusicCommon::
ld b, a
ld a, d
and a ; should current music be faded out first?
- ld a, $1f ; BANK(Music_BikeRiding)
+ ld a, BANK(Music_BikeRiding)
jr nz, .next2
; Only change the audio ROM bank if the current music isn't going to be faded
@@ -87,7 +88,7 @@ CheckForNoBikingMusicMap::
ret
UpdateMusic6Times::
- ld c, $6
+ ld c, 6
UpdateMusicCTimes::
.loop
push bc
@@ -165,16 +166,17 @@ PlaySound::
ld [wChannelSoundIDs + CH7], a
.next
ld a, [wAudioFadeOutControl]
- and a
+ and a ; has a fade-out length been specified?
jr z, .noFadeOut
ld a, [wNewSoundID]
- and a
- jr z, .done
+ and a ; is the new sound ID 0?
+ jr z, .done ; if so, do nothing
xor a
ld [wNewSoundID], a
ld a, [wLastMusicSoundID]
- cp $ff
- jr nz, .fadeOut
+ cp $ff ; has the music been stopped?
+ jr nz, .fadeOut ; if not, fade out the current music
+; If it has been stopped, start playing the new music immediately.
xor a
ld [wAudioFadeOutControl], a
.noFadeOut
diff --git a/home/init.asm b/home/init.asm
index cd073279..da354aa6 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -3,6 +3,8 @@ SoftReset::
call GBPalWhiteOut
ld c, 32
call DelayFrames
+ ; fallthrough
+
Init::
; Program init.
diff --git a/home/overworld.asm b/home/overworld.asm
index 9989891b..382f90f9 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -70,7 +70,6 @@ OverworldLoopLessDelay::
jr z, .notSimulating
ld a, [hJoyHeld]
jr .checkIfStartIsPressed
-
.notSimulating
ld a, [hJoyPressed]
.checkIfStartIsPressed
@@ -80,7 +79,6 @@ OverworldLoopLessDelay::
xor a
ld [hSpriteIndexOrTextID], a ; start menu text ID
jp .displayDialogue
-
.startButtonNotPressed
bit 0, a ; A button
jp z, .checkIfDownButtonIsPressed
@@ -118,15 +116,6 @@ OverworldLoopLessDelay::
xor a
ld [wLinkTimeoutCounter], a
jp EnterMap
-
-; predef LoadSAV
-; ld a, [wCurMap]
-; ld [wDestinationMap], a
-; call SpecialWarpIn
-; ld a, [wCurMap]
-; call SwitchToMapRomBank ; switch to the ROM bank of the current map
-; ld hl, wCurMapTileset
-; set 7, [hl]
.checkForOpponent
ld a, [wCurOpponent]
and a
@@ -139,7 +128,7 @@ OverworldLoopLessDelay::
res 2, [hl]
xor a
ld [wd435], a
- ld a, $1
+ ld a, 1
ld [wCheckFor180DegreeTurn], a
ld a, [wPlayerMovingDirection] ; the direction that was pressed last time
and a
@@ -179,9 +168,10 @@ OverworldLoopLessDelay::
.checkIfRightButtonIsPressed
bit 4, a ; right button
jr z, .noDirectionButtonsPressed
- ld a, $1
- ld [wSpriteStateData1 + 5], a
- ld a, $1
+ ld a, 1
+ ld [wSpriteStateData1 + 5], a ; delta X
+ ld a, 1
+
.handleDirectionButtonPress
ld [wPlayerDirection], a ; new direction
ld a, [wd730]
@@ -234,6 +224,7 @@ OverworldLoopLessDelay::
.surfing
call CollisionCheckOnWater
jp c, OverworldLoop
+
.noCollision
ld a, $08
ld [wWalkCounter], a
@@ -242,7 +233,8 @@ OverworldLoopLessDelay::
.moveAhead
call IsSpinning
- call UpdateSprites ; move sprites
+ call UpdateSprites
+
.moveAhead2
ld hl, wFlags_0xcd60
res 2, [hl]
@@ -343,6 +335,7 @@ NewBattle::
and a
ret
+; function to make bikes twice as fast as walking
DoBikeSpeedup::
ld a, [wWalkBikeSurfState]
dec a ; riding a bike?
@@ -354,7 +347,7 @@ DoBikeSpeedup::
and a
ret nz
ld a, [wCurMap]
- cp ROUTE_17 ; cycling road
+ cp ROUTE_17 ; Cycling Road
jr nz, .goFaster
ld a, [hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
@@ -444,7 +437,6 @@ CheckWarpsCollision::
ld a, [hl]
ld [hWarpDestinationMap], a
jr WarpFound2
-
.retry1
inc hl
.retry2
@@ -502,7 +494,6 @@ WarpFound2::
ld hl, wd732
set 3, [hl]
jr .skipMapChangeSound
-
.notWarpPad
call PlayMapChangeSound
.skipMapChangeSound
@@ -653,14 +644,13 @@ CheckMapConnections::
ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section
ld a, h
ld [wCurrentTileBlockMapViewPointer + 1], a
-.loadNewMap
-; load the connected map that was entered
+.loadNewMap ; load the connected map that was entered
ld hl, wPikachuOverworldStateFlags
set 4, [hl]
ld a, $2
ld [wPikachuSpawnState], a
call LoadMapHeader
- call PlayDefaultMusicFadeOutCurrent ; music
+ call PlayDefaultMusicFadeOutCurrent
ld b, SET_PAL_OVERWORLD
call RunPaletteCommand
; Since the sprite set shouldn't change, this will just update VRAM slots at
@@ -680,13 +670,12 @@ PlayMapChangeSound::
cp CEMETERY
jr z, .didNotGoThroughDoor
aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on
- cp UNDERGROUND ; door tile in tileset 0
+ cp $0b ; door tile in tileset 0
jr nz, .didNotGoThroughDoor
- ld a, $ad ; SFX_GO_INSIDE
+ ld a, SFX_GO_INSIDE
jr .playSound
-
.didNotGoThroughDoor
- ld a, $b5 ; SFX_GO_OUTSIDE
+ ld a, SFX_GO_OUTSIDE
.playSound
call PlaySound
ld a, [wMapPalOffset]
@@ -732,7 +721,6 @@ ExtraWarpCheck::
.useFunction1
ld hl, IsPlayerFacingEdgeOfMap
jr .doBankswitch
-
.useFunction2
ld hl, IsWarpTileInFrontOfPlayer
.doBankswitch
@@ -869,9 +857,9 @@ INCLUDE "data/bike_riding_tilesets.asm"
; load the tile pattern data of the current tileset into VRAM
LoadTilesetTilePatternData::
- ld a, [wTilesetGFXPtr]
+ ld a, [wTilesetGfxPtr]
ld l, a
- ld a, [wTilesetGFXPtr + 1]
+ ld a, [wTilesetGfxPtr + 1]
ld h, a
ld de, vTileset
ld bc, $600
@@ -1078,7 +1066,7 @@ IsSpriteOrSignInFrontOfPlayer::
.extendRangeOverCounter
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
- ld hl, wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
+ ld hl, wTilesetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
ld b, 3
ld d, $20 ; talking range in pixels (long range)
.counterTilesLoop
@@ -1267,14 +1255,13 @@ CollisionCheckOnLand::
jr nc, .noCollision
.collision
ld a, [wChannelSoundIDs + CH4]
- cp $b4 ; SFX_COLLISION ; check if collision sound is already playing
+ cp SFX_COLLISION ; check if collision sound is already playing
jr z, .setCarry
- ld a, $b4 ; SFX_COLLISION
+ ld a, SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing)
.setCarry
scf
ret
-
.noCollision
and a
ret
@@ -1297,8 +1284,7 @@ CheckForJumpingAndTilePairCollisions::
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player
push de
push bc
- callba HandleLedges
- ; check if the player is trying to jump a ledge
+ callba HandleLedges ; check if the player is trying to jump a ledge
pop bc
pop de
pop hl
@@ -1327,7 +1313,6 @@ CheckForTilePairCollisions::
.retry
inc hl
jr .tilePairCollisionLoop
-
.tilesetMatches
ld a, [wTilePlayerStandingOn] ; tile the player is on
ld b, a
@@ -1339,14 +1324,12 @@ CheckForTilePairCollisions::
cp b
jr z, .currentTileMatchesSecondInPair
jr .retry
-
.currentTileMatchesFirstInPair
inc hl
ld a, [hl]
cp c
jr z, .foundMatch
jr .tilePairCollisionLoop
-
.currentTileMatchesSecondInPair
dec hl
ld a, [hli]
@@ -1356,7 +1339,6 @@ CheckForTilePairCollisions::
.foundMatch
scf
ret
-
.noMatch
and a
ret
@@ -1584,9 +1566,9 @@ ScheduleWestColumnRedraw::
; Input: c = tile block ID, hl = destination address
DrawTileBlock::
push hl
- ld a, [wTileSetBlocksPtr] ; pointer to tiles
+ ld a, [wTilesetBlocksPtr] ; pointer to tiles
ld l, a
- ld a, [wTileSetBlocksPtr + 1]
+ ld a, [wTilesetBlocksPtr + 1]
ld h, a
ld a, c
swap a
@@ -1705,13 +1687,7 @@ GetSimulatedInput::
; function to check the tile ahead to determine if the character should get on land or keep surfing
; sets carry if there is a collision and clears carry otherwise
-; It seems that this function has a bug in it, but due to luck, it doesn't
-; show up. After detecting a sprite collision, it jumps to the code that
-; checks if the next tile is passable instead of just directly jumping to the
-; "collision detected" code. However, it doesn't store the next tile in c,
-; so the old value of c is used. 2429 is always called before this function,
-; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it
-; is considered impassable and it is detected as a collision.
+; This function had a bug in Red/Blue, but it was fixed in Yellow.
CollisionCheckOnWater::
ld a, [wd730]
bit 7, a
@@ -1720,7 +1696,7 @@ CollisionCheckOnWater::
ld d, a
ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
and d ; check if a sprite is in the direction the player is trying to go
- jr nz, .collision ; bug?
+ jr nz, .collision
ld hl, TilePairCollisionsWater
call CheckForJumpingAndTilePairCollisions
jr c, .collision
@@ -1733,9 +1709,9 @@ CollisionCheckOnWater::
jr nc, .stopSurfing
.collision
ld a, [wChannelSoundIDs + CH4]
- cp $b4 ; SFX_COLLISION
+ cp SFX_COLLISION ; check if collision sound is already playing
jr z, .setCarry
- ld a, $b4 ; SFX_COLLISION
+ ld a, SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing)
.setCarry
scf
@@ -1815,7 +1791,7 @@ LoadSurfingPlayerSpriteGraphics2::
jr LoadPlayerSpriteGraphicsCommon
LoadSurfingPlayerSpriteGraphics::
- ld b, BANK(RedSprite) ; not sure, but probably same bank (5)
+ ld b, BANK(SeelSprite)
ld de, SeelSprite
jr LoadPlayerSpriteGraphicsCommon
@@ -2150,7 +2126,7 @@ IgnoreInputForHalfSecond:
ld [wIgnoreInputCounter], a
ld hl, wd730
ld a, [hl]
- or %00100110 ; $26
+ or %00100110
ld [hl], a ; set ignore input bit
ret
diff --git a/home/pic.asm b/home/pic.asm
index 61a8001c..353d0f58 100644
--- a/home/pic.asm
+++ b/home/pic.asm
@@ -528,9 +528,9 @@ ReverseNybble::
ld de, NybbleReverseTable
add e
ld e, a
- jr nc, .asm_2735
+ jr nc, .noCarry
inc d
-.asm_2735
+.noCarry
ld a, [de]
ret
diff --git a/home/serial.asm b/home/serial.asm
index 6f3c72ff..5fe7fb81 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -94,79 +94,79 @@ Serial_ExchangeByte::
ld [hSerialReceivedNewData], a
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
- jr nz, .asm_2003
+ jr nz, .loop
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
-.asm_2003
+.loop
ld a, [hSerialReceivedNewData]
and a
- jr nz, .asm_204d
+ jr nz, .ok
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
- jr nz, .asm_2028
+ jr nz, .doNotIncrementUnknownCounter
call IsUnknownCounterZero
- jr z, .asm_2028
+ jr z, .doNotIncrementUnknownCounter
call WaitLoop_15Iterations
push hl
ld hl, wUnknownSerialCounter + 1
inc [hl]
- jr nz, .asm_201f
+ jr nz, .noCarry
dec hl
inc [hl]
-.asm_201f
+.noCarry
pop hl
call IsUnknownCounterZero
- jr nz, .asm_2003
+ jr nz, .loop
jp SetUnknownCounterToFFFF
-.asm_2028
+.doNotIncrementUnknownCounter
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
- jr nz, .asm_2003
+ jr nz, .loop
ld a, [wUnknownSerialCounter2]
dec a
ld [wUnknownSerialCounter2], a
- jr nz, .asm_2003
+ jr nz, .loop
ld a, [wUnknownSerialCounter2 + 1]
dec a
ld [wUnknownSerialCounter2 + 1], a
- jr nz, .asm_2003
+ jr nz, .loop
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
- jr z, .asm_204d
+ jr z, .ok
ld a, 255
.waitLoop
dec a
jr nz, .waitLoop
-.asm_204d
+.ok
xor a
ld [hSerialReceivedNewData], a
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
sub (1 << SERIAL)
- jr nz, .asm_2060
+ jr nz, .skipReloadingUnknownCounter2
ld [wUnknownSerialCounter2], a
ld a, $50
ld [wUnknownSerialCounter2 + 1], a
-.asm_2060
+.skipReloadingUnknownCounter2
ld a, [hSerialReceiveData]
cp SERIAL_NO_DATA_BYTE
ret nz
call IsUnknownCounterZero
- jr z, .asm_207b
+ jr z, .done
push hl
ld hl, wUnknownSerialCounter + 1
ld a, [hl]
dec a
ld [hld], a
inc a
- jr nz, .asm_2075
+ jr nz, .noBorrow
dec [hl]
-.asm_2075
+.noBorrow
pop hl
call IsUnknownCounterZero
jr z, SetUnknownCounterToFFFF
-.asm_207b
+.done
ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
diff --git a/home/vblank.asm b/home/vblank.asm
index 9cc8d42f..764e5277 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -55,8 +55,8 @@ VBlank::
jr z, .skipDec
dec a
ld [H_FRAMECOUNTER], a
-.skipDec
+.skipDec
call FadeOutAudio
callbs Music_DoLowHealthAlarm