This commit is contained in:
dannye 2023-04-19 20:04:38 -05:00
commit 772520c2c2
63 changed files with 4114 additions and 1216 deletions

View file

@ -249,7 +249,7 @@ PlayAnimation:
push af
ld a, [wAnimPalette]
ldh [rOBP0], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
vc_hook Reduce_move_anim_flashing_Mega_Punch_Self_Destruct_Explosion
call LoadSubanimation
call PlaySubanimation
@ -352,11 +352,11 @@ GetSubanimationTransform2:
ret
; loads tile patterns for battle animations
LoadAnimationTileset:
LoadMoveAnimationTiles:
ld a, [wWhichBattleAnimTileset]
add a
add a
ld hl, AnimationTilesetPointers
ld hl, MoveAnimationTilesPointers
ld e, a
ld d, 0
add hl, de
@ -367,7 +367,7 @@ LoadAnimationTileset:
ld a, [hl]
ld d, a ; de = address of tileset
ld hl, vSprites tile $31
ld b, BANK(AnimationTileset1) ; ROM bank
ld b, BANK(MoveAnimationTiles0) ; ROM bank
ld a, [wTempTilesetNumTiles]
ld c, a ; number of tiles
jp CopyVideoData ; load tileset
@ -378,17 +378,18 @@ MACRO anim_tileset
db -1 ; padding
ENDM
AnimationTilesetPointers:
MoveAnimationTilesPointers:
; number of tiles, gfx pointer
anim_tileset 79, AnimationTileset1
anim_tileset 79, AnimationTileset2
anim_tileset 64, AnimationTileset1
anim_tileset 79, MoveAnimationTiles0
anim_tileset 79, MoveAnimationTiles1
anim_tileset 64, MoveAnimationTiles2
AnimationTileset1:
INCBIN "gfx/battle/attack_anim_1.2bpp"
MoveAnimationTiles0:
MoveAnimationTiles2:
INCBIN "gfx/battle/move_anim_0.2bpp"
AnimationTileset2:
INCBIN "gfx/battle/attack_anim_2.2bpp"
MoveAnimationTiles1:
INCBIN "gfx/battle/move_anim_1.2bpp"
SlotMachineTiles2:
INCBIN "gfx/slots/slots_2.2bpp"
@ -1109,7 +1110,7 @@ AnimationWaterDropletsEverywhere:
; in Surf/Mist/Toxic.
xor a
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
ld d, 32
ld a, -16
ld [wBaseCoordX], a
@ -1628,7 +1629,7 @@ _AnimationShootBallsUpward:
push bc
xor a
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
pop bc
ld d, $7a ; ball tile
ld hl, wShadowOAM
@ -2071,7 +2072,7 @@ InitMultipleObjectsOAM:
push bc
push de
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
pop de
pop bc
xor a

View file

@ -3353,7 +3353,7 @@ CheckPlayerStatusConditions:
; fast asleep
xor a
ld [wAnimationType], a
ld a, SLP_ANIM - 1
ld a, SLP_PLAYER_ANIM
call PlayMoveAnimation
ld hl, FastAsleepText
call PrintText
@ -3437,7 +3437,7 @@ CheckPlayerStatusConditions:
call PrintText
xor a
ld [wAnimationType], a
ld a, CONF_ANIM - 1
ld a, CONF_PLAYER_ANIM
call PlayMoveAnimation
call BattleRandom
cp 50 percent + 1 ; chance to hurt itself

View file

@ -123,12 +123,12 @@ PoisonEffect:
dec de
ldh a, [hWhoseTurn]
and a
ld b, ANIM_C7
ld b, SHAKE_SCREEN_ANIM
ld hl, wPlayerBattleStatus3
ld a, [de]
ld de, wPlayerToxicCounter
jr nz, .ok
ld b, ANIM_A9
ld b, ENEMY_HUD_SHAKE_ANIM
ld hl, wEnemyBattleStatus3
ld de, wEnemyToxicCounter
.ok
@ -232,14 +232,14 @@ FreezeBurnParalyzeEffect:
ld a, 1 << PAR
ld [wEnemyMonStatus], a
call QuarterSpeedDueToParalysis ; quarter speed of affected mon
ld a, ANIM_A9
ld a, ENEMY_HUD_SHAKE_ANIM
call PlayBattleAnimation
jp PrintMayNotAttackText ; print paralysis text
.burn1
ld a, 1 << BRN
ld [wEnemyMonStatus], a
call HalveAttackDueToBurn ; halve attack of affected mon
ld a, ANIM_A9
ld a, ENEMY_HUD_SHAKE_ANIM
call PlayBattleAnimation
ld hl, BurnedText
jp PrintText
@ -247,7 +247,7 @@ FreezeBurnParalyzeEffect:
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
ld a, 1 << FRZ
ld [wEnemyMonStatus], a
ld a, ANIM_A9
ld a, ENEMY_HUD_SHAKE_ANIM
call PlayBattleAnimation
ld hl, FrozenText
jp PrintText
@ -802,7 +802,7 @@ ThrashPetalDanceEffect:
inc a
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
ldh a, [hWhoseTurn]
add ANIM_B0
add SHRINKING_SQUARE_ANIM
jp PlayBattleAnimation2
SwitchAndTeleportEffect:
@ -1002,7 +1002,7 @@ ChargeEffect:
jr z, .chargeEffect
ld hl, wEnemyBattleStatus1
ld de, wEnemyMoveEffect
ld b, ANIM_AF
ld b, XSTATITEM_DUPLICATE_ANIM
.chargeEffect
set CHARGING_UP, [hl]
ld a, [de]
@ -1016,7 +1016,7 @@ ChargeEffect:
cp DIG
jr nz, .notDigOrFly
set INVULNERABLE, [hl] ; mon is now invulnerable to typical attacks (fly/dig)
ld b, ANIM_C0
ld b, SLIDE_DOWN_ANIM
.notDigOrFly
xor a
ld [wAnimationType], a

View file

@ -750,7 +750,7 @@ AIIncreaseStat:
ld a, [hl]
push af
push hl
ld a, ANIM_AF
ld a, XSTATITEM_DUPLICATE_ANIM
ld [hli], a
ld [hl], b
callfar StatModifierUpEffect

View file

@ -2,12 +2,14 @@ DebugMenu:
IF DEF(_DEBUG)
call ClearScreen
ld hl, DebugPlayerName
; These debug names are used for TestBattle.
; StartNewGameDebug uses the debug names from PrepareOakSpeech.
ld hl, DebugBattlePlayerName
ld de, wPlayerName
ld bc, NAME_LENGTH
call CopyData
ld hl, DebugRivalName
ld hl, DebugBattleRivalName
ld de, wRivalName
ld bc, NAME_LENGTH
call CopyData
@ -57,10 +59,10 @@ IF DEF(_DEBUG)
set 1, [hl]
jp StartNewGameDebug
DebugPlayerName:
DebugBattlePlayerName:
db "Tom@"
DebugRivalName:
DebugBattleRivalName:
db "Juerry@"
DebugMenuOptions:

View file

@ -309,6 +309,7 @@ LinkCanceledText:
StartNewGame:
ld hl, wd732
res 1, [hl]
; fallthrough
StartNewGameDebug:
call OakSpeech
ld c, 20

View file

@ -1,4 +1,4 @@
SetDefaultNames:
PrepareOakSpeech:
ld a, [wLetterPrintingDelayFlags]
push af
ld a, [wOptions]
@ -22,11 +22,13 @@ SetDefaultNames:
ld a, [wOptionsInitialized]
and a
call z, InitOptions
ld hl, NintenText
; These debug names are used for StartNewGameDebug.
; TestBattle uses the debug names from DebugMenu.
ld hl, DebugNewGamePlayerName
ld de, wPlayerName
ld bc, NAME_LENGTH
call CopyData
ld hl, SonyText
ld hl, DebugNewGameRivalName
ld de, wRivalName
ld bc, NAME_LENGTH
jp CopyData
@ -40,7 +42,7 @@ OakSpeech:
call PlayMusic
call ClearScreen
call LoadTextBoxTilePatterns
call SetDefaultNames
call PrepareOakSpeech
predef InitPlayerData2
ld hl, wNumBoxItems
ld a, POTION

View file

@ -3,13 +3,13 @@ LoadShootingStarGraphics:
ldh [rOBP0], a
ld a, $a4
ldh [rOBP1], a
ld de, AnimationTileset2 tile 3 ; star tile (top left quadrant)
ld de, MoveAnimationTiles1 tile 3 ; star tile (top left quadrant)
ld hl, vChars1 tile $20
lb bc, BANK(AnimationTileset2), 1
lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
ld de, AnimationTileset2 tile 19 ; star tile (bottom left quadrant)
ld de, MoveAnimationTiles1 tile 19 ; star tile (bottom left quadrant)
ld hl, vChars1 tile $21
lb bc, BANK(AnimationTileset2), 1
lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
ld de, FallingStar
ld hl, vChars1 tile $22

View file

@ -1,15 +1,17 @@
; copy text of fixed length NAME_LENGTH (like player name, rival name, mon names, ...)
CopyFixedLengthText:
CopyDebugName:
ld bc, NAME_LENGTH
jp CopyData
SetDefaultNamesBeforeTitlescreen::
ld hl, NintenText
PrepareTitleScreen::
; These debug names are already copied later in PrepareOakSpeech.
; Removing the unused copies below has no apparent impact.
; CopyDebugName can also be safely deleted afterwards.
ld hl, DebugNewGamePlayerName
ld de, wPlayerName
call CopyFixedLengthText
ld hl, SonyText
call CopyDebugName
ld hl, DebugNewGameRivalName
ld de, wRivalName
call CopyFixedLengthText
call CopyDebugName
xor a
ldh [hWY], a
ld [wLetterPrintingDelayFlags], a
@ -395,5 +397,8 @@ PrintGameVersionOnTitleScreen:
VersionOnTitleScreenText:
db $61,$62,$63,$64,$65,$66,$67,$68,"@" ; "Blue Version"
NintenText: db "NINTEN@"
SonyText: db "SONY@"
DebugNewGamePlayerName:
db "NINTEN@"
DebugNewGameRivalName:
db "SONY@"

View file

@ -116,8 +116,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

@ -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"