This commit is contained in:
dannye 2022-12-28 17:38:38 -06:00
commit 3f691fcb21
970 changed files with 15106 additions and 11361 deletions

View file

@ -99,7 +99,7 @@ InitCutAnimOAM:
ld hl, vChars1 tile $7f
call LoadCutGrassAnimationTilePattern
call WriteCutOrBoulderDustAnimationOAMBlock
ld hl, wOAMBuffer + $93
ld hl, wShadowOAMSprite36Attributes
ld de, 4
ld a, $30
ld c, e
@ -112,8 +112,8 @@ InitCutAnimOAM:
ret
LoadCutGrassAnimationTilePattern:
ld de, AnimationTileset2 tile 6 ; tile depicting a leaf
lb bc, BANK(AnimationTileset2), 1
ld de, MoveAnimationTiles1 tile 6 ; tile depicting a leaf
lb bc, BANK(MoveAnimationTiles1), 1
jp CopyVideoData
WriteCutOrBoulderDustAnimationOAMBlock:

View file

@ -5,12 +5,12 @@ AnimCut:
ld c, $8
.cutTreeLoop
push bc
ld hl, wOAMBuffer + $91
ld hl, wShadowOAMSprite36XCoord
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 2
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld hl, wShadowOAMSprite38XCoord
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 2
@ -33,7 +33,7 @@ AnimCut:
ld c, $8
call AnimCutGrass_UpdateOAMEntries
call AnimCutGrass_SwapOAMEntries
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36YCoord
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 4
@ -45,22 +45,22 @@ AnimCut:
AnimCutGrass_UpdateOAMEntries:
push bc
ld hl, wOAMBuffer + $91
ld hl, wShadowOAMSprite36XCoord
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $95
ld hl, wShadowOAMSprite37XCoord
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld hl, wShadowOAMSprite38XCoord
ld a, -2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $9d
ld hl, wShadowOAMSprite39XCoord
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 1
@ -75,15 +75,15 @@ AnimCutGrass_UpdateOAMEntries:
ret
AnimCutGrass_SwapOAMEntries:
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld de, wBuffer
ld bc, $8
call CopyData
ld hl, wOAMBuffer + $98
ld de, wOAMBuffer + $90
ld hl, wShadowOAMSprite38
ld de, wShadowOAMSprite36
ld bc, $8
call CopyData
ld hl, wBuffer
ld de, wOAMBuffer + $98
ld de, wShadowOAMSprite38
ld bc, $8
jp CopyData

View file

@ -43,7 +43,7 @@ GetMoveBoulderDustFunctionPointer:
ld h, [hl]
ld l, a
push hl
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld d, $0
add hl, de
ld e, l
@ -51,22 +51,16 @@ GetMoveBoulderDustFunctionPointer:
pop hl
ret
MACRO boulder_dust_adjust
db \1, \2 ; coords
dw \3 ; function
ENDM
MoveBoulderDustFunctionPointerTable:
; facing down
db $FF,$00
dw AdjustOAMBlockYPos
; facing up
db $01,$00
dw AdjustOAMBlockYPos
; facing left
db $01,$01
dw AdjustOAMBlockXPos
; facing right
db $FF,$01
dw AdjustOAMBlockXPos
boulder_dust_adjust -1, 0, AdjustOAMBlockYPos ; down
boulder_dust_adjust 1, 0, AdjustOAMBlockYPos ; up
boulder_dust_adjust 1, 1, AdjustOAMBlockXPos ; left
boulder_dust_adjust -1, 1, AdjustOAMBlockXPos ; right
LoadSmokeTileFourTimes::
ld hl, vChars1 tile $7c

View file

@ -33,7 +33,7 @@ ShakeElevator::
ld a, SFX_SAFARI_ZONE_PA
call PlaySound
;.musicLoop
; ld a, [wChannelSoundIDs + Ch5]
; ld a, [wChannelSoundIDs + CHAN5]
; cp SFX_SAFARI_ZONE_PA
; jr z, .musicLoop
call UpdateSprites

View file

@ -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 + 4 * 35 + $3 ; $8f
ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
ld hl, wShadowOAMSprite35Attributes
ld de, wShadowOAMSprite39Attributes
jr z, .next
ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
ld hl, wShadowOAMSprite31Attributes
ld de, wShadowOAMSprite35Attributes
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.

View file

@ -32,7 +32,7 @@ IsSurfingAllowed:
ret nz
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
ret z
ld hl, CoordsData_cdf7
ld hl, SeafoamIslandsB4FStairsCoords
call ArePlayerCoordsInArray
ret nc
ld hl, wd728
@ -45,7 +45,7 @@ IsSurfingAllowed:
ld hl, CyclingIsFunText
jp PrintText
CoordsData_cdf7:
SeafoamIslandsB4FStairsCoords:
dbmapcoord 7, 11
db -1 ; end

View file

@ -12,7 +12,7 @@ AnimateHealingMachine:
push af
ld a, $e0
ldh [rOBP1], a
ld hl, wOAMBuffer + $84
ld hl, wShadowOAMSprite33
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
@ -96,9 +96,9 @@ FlashSprite8Times:
CopyHealingMachineOAM:
; copy one OAM entry and advance the pointers
REPT 4
REPT 4
ld a, [de]
inc de
ld [hli], a
ENDR
ENDR
ret

View file

@ -11,7 +11,7 @@
InitMapSprites::
call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25)
; if the map is an inside map (i.e. mapID >= FIRST_INDOOR_MAP)
ld hl, wSpritePlayerStateData1PictureID
ld de, wSpritePlayerStateData2PictureID
; Loop to copy picture IDs from [x#SPRITESTATEDATA1_PICTUREID]
@ -19,10 +19,10 @@ InitMapSprites::
.copyPictureIDLoop
ld a, [hl] ; a = [x#SPRITESTATEDATA1_PICTUREID]
ld [de], a ; [x#SPRITESTATEDATA2_PICTUREID] = a
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add e
ld e, a
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add l
ld l, a
jr nz, .copyPictureIDLoop
@ -37,7 +37,7 @@ LoadMapSpriteTilePatterns:
ret
.spritesExist
ld c, a ; c = [wNumSprites]
ld b, $10 ; number of sprite slots
ld b, NUM_SPRITESTATEDATA_STRUCTS
ld hl, wSpritePlayerStateData2PictureID
xor a
ldh [hFourTileSpriteCount], a
@ -47,7 +47,7 @@ LoadMapSpriteTilePatterns:
ld a, [hli] ; a = [x#SPRITESTATEDATA2_PICTUREID]
ld [hld], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET] = a
ld a, l
add $10
add SPRITESTATEDATA1_LENGTH
ld l, a
dec b
jr nz, .copyPictureIDLoop
@ -69,17 +69,17 @@ LoadMapSpriteTilePatterns:
cp [hl] ; do the picture ID's match?
jp z, .alreadyLoaded
ld a, e
add $10
add SPRITESTATEDATA1_LENGTH
ld e, a
jr .checkIfAlreadyLoadedLoop
.notAlreadyLoaded
ld de, wSpritePlayerStateData2ImageBaseOffset
ld b, $01
ld b, 1
; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
; this is done in order to find the first free VRAM slot available
.findNextVRAMSlotLoop
ld a, e
add $10
add SPRITESTATEDATA1_LENGTH
ld e, a
ld a, l
cp e ; reached current slot?
@ -187,7 +187,7 @@ LoadMapSpriteTilePatterns:
jr nz, .loadWhileLCDOn
pop af
pop hl
set 3, h ; add $800 to hl
set 3, h ; add $80 tiles to hl
push hl
ld h, d
ld l, e
@ -200,7 +200,7 @@ LoadMapSpriteTilePatterns:
.loadWhileLCDOn
pop af
pop hl
set 3, h ; add $800 to hl
set 3, h ; add $80 tiles to hl
ld b, a
swap c
call CopyVideoData ; load tile pattern data for sprite when walking
@ -214,18 +214,18 @@ LoadMapSpriteTilePatterns:
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET] = a
.nextSpriteSlot
ld a, l
add $10
add SPRITESTATEDATA2_LENGTH
ld l, a
dec c
jp nz, .loadTilePatternLoop
ld hl, wSpritePlayerStateData2PictureID
ld b, $10
ld b, NUM_SPRITESTATEDATA_STRUCTS
; the pictures IDs stored at [x#SPRITESTATEDATA2_PICTUREID] are no longer needed,
; so zero them
.zeroStoredPictureIDLoop
xor a
ld [hl], a ; [x#SPRITESTATEDATA2_PICTUREID]
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
dec b
@ -264,7 +264,7 @@ InitOutsideMapSprites:
inc h
.noCarry
ld a, [hl] ; a = spriteSetID
cp $f0 ; does the map have 2 sprite sets?
cp FIRST_SPLIT_SET - 1 ; does the map have 2 sprite sets?
call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one
ld b, a ; b = spriteSetID
ld a, [wFontLoaded]
@ -283,7 +283,7 @@ InitOutsideMapSprites:
sla a
sla a
add c
add b ; a = (spriteSetID - 1) * 11
add b ; a = (spriteSetID - 1) * SPRITE_SET_LENGTH
ld de, SpriteSets
; add a to de to get offset of sprite set
add e
@ -300,7 +300,7 @@ InitOutsideMapSprites:
; with picture IDs. This is done so that LoadMapSpriteTilePatterns will
; load tile patterns for all sprite pictures in the sprite set.
.loadSpriteSetLoop
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
ld a, [de] ; sprite picture ID from sprite set
@ -309,11 +309,11 @@ InitOutsideMapSprites:
inc de
inc bc
ld a, l
cp $bd ; reached 11th sprite slot?
cp 11 * SPRITESTATEDATA2_LENGTH + SPRITESTATEDATA2_PICTUREID ; reached 11th sprite slot?
jr nz, .loadSpriteSetLoop
ld b, 4 ; 4 remaining sprite slots
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
xor a
@ -322,20 +322,20 @@ InitOutsideMapSprites:
jr nz, .zeroRemainingSlotsLoop
ld a, [wNumSprites]
push af ; save number of sprites
ld a, 11 ; 11 sprites in sprite set
ld a, SPRITE_SET_LENGTH ; 11 sprites in sprite set
ld [wNumSprites], a
call LoadMapSpriteTilePatterns
pop af
ld [wNumSprites], a ; restore number of sprites
ld hl, wSprite01StateData2ImageBaseOffset
ld b, $0f
ld b, NUM_SPRITESTATEDATA_STRUCTS - 1
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
; order of the map's sprite set, not the order of the actual sprites loaded
; for the current map. So, they are not needed and are zeroed by this loop.
.zeroVRAMSlotsLoop
xor a
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
dec b
@ -366,14 +366,14 @@ InitOutsideMapSprites:
inc c
.skipGettingPictureIndex
push hl
inc h
ld a, $0e
inc h ; HIGH(wSpriteStateData2)
ld a, SPRITESTATEDATA2_IMAGEBASEOFFSET - SPRITESTATEDATA1_PICTUREID
add l
ld l, a
ld a, c ; a = VRAM slot (zero if sprite slot is not used)
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
pop hl
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add l
ld l, a
and a
@ -384,7 +384,7 @@ InitOutsideMapSprites:
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
GetSplitMapSpriteSetID:
cp $f8
cp SPLITSET_ROUTE_20
jr z, .route20
ld hl, SplitMapSpriteSets
and $0f
@ -396,8 +396,8 @@ GetSplitMapSpriteSetID:
jr nc, .noCarry
inc h
.noCarry
ld a, [hli] ; determines whether the map is split East/West or North/South
cp $01
ld a, [hli] ; whether the map is split EAST_WEST or NORTH_SOUTH
cp EAST_WEST
ld a, [hli] ; position of dividing line
ld b, a
jr z, .eastWestDivide
@ -409,35 +409,39 @@ GetSplitMapSpriteSetID:
.compareCoord
cp b
jr c, .loadSpriteSetID
; if in the East side or South side
; if in the east side or south side
inc hl
.loadSpriteSetID
ld a, [hl]
ret
; Uses sprite set $01 for West side and $0A for East side.
; Uses sprite set SPRITESET_PALLET_VIRIDIAN for west side and SPRITESET_FUCHSIA for east side.
; Route 20 is a special case because the two map sections have a more complex
; shape instead of the map simply being split horizontally or vertically.
.route20
ld hl, wXCoord
; Use SPRITESET_PALLET_VIRIDIAN if X < 43
ld a, [hl]
cp $2b
ld a, $01
cp 43
ld a, SPRITESET_PALLET_VIRIDIAN
ret c
; Use SPRITESET_FUCHSIA if X >= 62.
ld a, [hl]
cp $3e
ld a, $0a
cp 62
ld a, SPRITESET_FUCHSIA
ret nc
; If 55 <= X < 62, split Y at 8; else 43 <= X < 55, so split Y at 13
ld a, [hl]
cp $37
ld b, $08
cp 55
ld b, 8
jr nc, .next
ld b, $0d
ld b, 13
.next
; Use SPRITESET_FUCHSIA if Y < split; else use SPRITESET_PALLET_VIRIDIAN
ld a, [wYCoord]
cp b
ld a, $0a
ld a, SPRITESET_FUCHSIA
ret c
ld a, $01
ld a, SPRITESET_PALLET_VIRIDIAN
ret
INCLUDE "data/maps/sprite_sets.asm"

View file

@ -23,9 +23,9 @@ LoadMissableObjects:
ld de, MissableObjects ; calculate difference between out pointer and the base pointer
ld a, l
sub e
jr nc, .asm_f13c
jr nc, .noCarry
dec h
.asm_f13c
.noCarry
ld l, a
ld a, h
sub d

View file

@ -1,4 +1,4 @@
MAP_TILESET_SIZE EQU $60
DEF MAP_TILESET_SIZE EQU $60
UpdatePlayerSprite:
ld a, [wSpritePlayerStateData2WalkAnimationCounter]

View file

@ -14,22 +14,22 @@ FindPathToPlayer:
call CalcDifference
ld d, a
and a
jr nz, .asm_f8da
jr nz, .stillHasYProgress
ldh a, [hFindPathFlags]
set 0, a ; current end of path matches the player's Y coordinate
ldh [hFindPathFlags], a
.asm_f8da
.stillHasYProgress
ldh a, [hFindPathXProgress]
ld b, a
ldh a, [hNPCPlayerXDistance] ; X distance in steps
call CalcDifference
ld e, a
and a
jr nz, .asm_f8ec
jr nz, .stillHasXProgress
ldh a, [hFindPathFlags]
set 1, a ; current end of path matches the player's X coordinate
ldh [hFindPathFlags], a
.asm_f8ec
.stillHasXProgress
ldh a, [hFindPathFlags]
cp $3 ; has the end of the path reached the player's position?
jr z, .done

View file

@ -205,19 +205,19 @@ LeaveMapThroughHoleAnim:
ld a, $ff
ld [wUpdateSpritesEnabled], a ; disable UpdateSprites
; shift upper half of player's sprite down 8 pixels and hide lower half
ld a, [wOAMBuffer + 0 * 4 + 2]
ld [wOAMBuffer + 2 * 4 + 2], a
ld a, [wOAMBuffer + 1 * 4 + 2]
ld [wOAMBuffer + 3 * 4 + 2], a
ld a, [wShadowOAMSprite00TileID]
ld [wShadowOAMSprite02TileID], a
ld a, [wShadowOAMSprite01TileID]
ld [wShadowOAMSprite03TileID], a
ld a, $a0
ld [wOAMBuffer + 0 * 4], a
ld [wOAMBuffer + 1 * 4], a
ld [wShadowOAMSprite00YCoord], a
ld [wShadowOAMSprite01YCoord], a
ld c, 2
call DelayFrames
; hide upper half of player's sprite
ld a, $a0
ld [wOAMBuffer + 2 * 4], a
ld [wOAMBuffer + 3 * 4], a
ld [wShadowOAMSprite02YCoord], a
ld [wShadowOAMSprite03YCoord], a
call GBFadeOutToWhite
ld a, $1
ld [wUpdateSpritesEnabled], a ; enable UpdateSprites
@ -392,7 +392,7 @@ FishingAnim:
ld b, $0
ld hl, FishingRodOAM
add hl, bc
ld de, wOAMBuffer + $9c
ld de, wShadowOAMSprite39
ld bc, $4
call CopyData
ld c, 100
@ -412,7 +412,7 @@ FishingAnim:
.loop
ld hl, wSpritePlayerStateData1YPixels
call .ShakePlayerSprite
ld hl, wOAMBuffer + $9c
ld hl, wShadowOAMSprite39
call .ShakePlayerSprite
call Delay3
dec b
@ -424,7 +424,7 @@ FishingAnim:
cp SPRITE_FACING_UP
jr nz, .skipHidingFishingRod
ld a, $a0
ld [wOAMBuffer + $9c], a
ld [wShadowOAMSprite39YCoord], a
.skipHidingFishingRod
ld hl, wEmotionBubbleSpriteIndex
@ -438,7 +438,7 @@ FishingAnim:
cp SPRITE_FACING_UP
jr nz, .skipUnhidingFishingRod
ld a, $44
ld [wOAMBuffer + $9c], a
ld [wShadowOAMSprite39YCoord], a
.skipUnhidingFishingRod
ld hl, ItsABiteText
@ -475,7 +475,7 @@ FishingRodOAM:
dbsprite 8, 10, 0, 0, $fe, 0 ; left
dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right
fishing_gfx: MACRO
MACRO fishing_gfx
dw \1
db \2
db BANK(\1)

View file

@ -101,10 +101,10 @@ IsPlayerFacingEdgeOfMap::
ld b, a
ld a, [wXCoord]
ld c, a
ld de, .asm_c41e
ld de, .return
push de
jp hl
.asm_c41e
.return
pop bc
pop de
pop hl
@ -239,11 +239,11 @@ PrintSafariZoneSteps::
call PlaceString
ld a, [wNumSafariBalls]
cp 10
jr nc, .asm_c56d
jr nc, .tenOrMore
hlcoord 5, 3
ld a, " "
ld [hl], a
.asm_c56d
.tenOrMore
hlcoord 6, 3
ld de, wNumSafariBalls
lb bc, 1, 2

View file

@ -11,18 +11,18 @@ LoadSpinnerArrowTiles::
ld a, [wCurMapTileset]
cp FACILITY
ld hl, FacilitySpinnerArrows
jr z, .asm_44ff6
jr z, .gotSpinnerArrows
ld hl, GymSpinnerArrows
.asm_44ff6
.gotSpinnerArrows
ld a, [wSimulatedJoypadStatesIndex]
bit 0, a
jr nz, .asm_45001
ld de, $18
jr nz, .alternateGraphics
ld de, 6 * 4
add hl, de
.asm_45001
.alternateGraphics
ld a, $4
ld bc, $0
.asm_45006
.loop
push af
push hl
push bc
@ -46,7 +46,7 @@ LoadSpinnerArrowTiles::
pop hl
pop af
dec a
jr nz, .asm_45006
jr nz, .loop
ret
INCLUDE "data/tilesets/spinner_tiles.asm"

View file

@ -35,13 +35,13 @@ LoadTilesetHeader:
call IsInArray
pop de
pop hl
jr c, .asm_c797
jr c, .dungeon
ld a, [wCurMapTileset]
ld b, a
ldh a, [hPreviousTileset]
cp b
jr z, .done
.asm_c797
.dungeon
ld a, [wDestinationWarpID]
cp $ff
jr z, .done