Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ BallMoveDistances2:
DoGrowlSpecialEffects:
ld hl, wShadowOAM
ld de, wShadowOAMSprite04
ld bc, $10
ld bc, OBJ_SIZE * 4
call CopyData ; copy the musical note graphic
ld a, [wSubAnimCounter]
dec a
Expand Down Expand Up @@ -1308,7 +1308,7 @@ AdjustOAMBlockXPos:
ld h, d

AdjustOAMBlockXPos2:
ld de, 4
ld de, OBJ_SIZE
.loop
ld a, [wCoordAdjustmentAmount]
ld b, a
Expand All @@ -1332,7 +1332,7 @@ AdjustOAMBlockYPos:
ld h, d

AdjustOAMBlockYPos2:
ld de, 4
ld de, OBJ_SIZE
.loop
ld a, [wCoordAdjustmentAmount]
ld b, a
Expand Down Expand Up @@ -1670,7 +1670,7 @@ _AnimationShootBallsUpward:
dec a
ld [wNumShootingBalls], a
.next
ld de, 4
ld de, OBJ_SIZE
add hl, de ; next OAM entry
dec b
jr nz, .innerLoop
Expand Down Expand Up @@ -1723,10 +1723,10 @@ AnimationMinimizeMon:
ld hl, wTempPic
push hl
xor a
ld bc, 7 * 7 * $10
ld bc, 7 * 7 tiles
call FillMemory
pop hl
ld de, 7 * 3 * $10 + 4 * $10 + 4
ld de, 7 * 3 tiles + 4 tiles + 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ld de, 7 * 3 tiles + 4 tiles + 4
ld de, (7 * 3 + 4) tiles + (1 tiles) / 4

add hl, de
ld de, MinimizedMonSprite
ld c, MinimizedMonSpriteEnd - MinimizedMonSprite
Expand Down
6 changes: 3 additions & 3 deletions engine/battle/battle_transitions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BattleTransition:
ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle)
ld c, a
ld b, 0
ld de, $10
ld de, SPRITESTATEDATA1_LENGTH
.loop1
ld a, [hl]
cp $ff
Expand All @@ -35,13 +35,13 @@ BattleTransition:
jr z, .skip2 ; skip clearing the block if the enemy trainer is using it
push hl
push bc
ld bc, $10
ld bc, OBJ_SIZE * 4
xor a
call FillMemory
pop bc
pop hl
.skip2
ld de, $10
ld de, OBJ_SIZE * 4
add hl, de
dec c
jr nz, .loop2
Expand Down
10 changes: 5 additions & 5 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ SlidePlayerHeadLeft:
push bc
ld hl, wShadowOAMSprite00XCoord
ld c, $15 ; number of OAM entries
ld de, $4 ; size of OAM entry
ld de, OBJ_SIZE
.loop
dec [hl] ; decrement X
dec [hl] ; decrement X
Expand Down Expand Up @@ -6655,11 +6655,11 @@ LoadHudTilePatterns:
.lcdEnabled
ld de, BattleHudTiles1
ld hl, vChars2 tile $6d
lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / $8
lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / TILE_1BPP_SIZE
call CopyVideoDataDouble
ld de, BattleHudTiles2
ld hl, vChars2 tile $73
lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8
lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / TILE_1BPP_SIZE
jp CopyVideoDataDouble

PrintEmptyString:
Expand Down Expand Up @@ -7040,14 +7040,14 @@ LoadMonBackPic:
ld b, 7
ld c, 8
call ClearScreenArea
ld hl, wMonHBackSprite - wMonHeader
ld hl, wMonHBackSprite - wMonHeader
call UncompressMonSprite
predef ScaleSpriteByTwo
ld de, vBackPic
call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite
ld hl, vSprites
ld de, vBackPic
ld c, (2 * SPRITEBUFFERSIZE) / 16 ; count of 16-byte chunks to be copied
ld c, (2 * SPRITEBUFFERSIZE) / TILE_SIZE ; count of 16-byte chunks to be copied
ldh a, [hLoadedROMBank]
ld b, a
jp CopyVideoData
2 changes: 1 addition & 1 deletion engine/battle/draw_hud_pokeball_gfx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DrawEnemyPokeballs:
LoadPartyPokeballGfx:
ld de, PokeballTileGraphics
ld hl, vSprites tile $31
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / TILE_SIZE
jp CopyVideoData

SetupOwnPartyPokeballs:
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ UpdateLoweredStatDone:
.ApplyBadgeBoostsAndStatusPenalties
ldh a, [hWhoseTurn]
and a
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
call nz, ApplyBadgeStatBoosts ; whenever the opponent uses a stat-down move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-down move (will be boosted further)
ld hl, MonsStatsFellText
call PrintText
Expand Down
2 changes: 1 addition & 1 deletion engine/events/diploma.asm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DisplayDiploma::
call DisableLCD
ld hl, CircleTile
ld de, vChars2 tile CIRCLE_TILE_ID
ld bc, $10
ld bc, 1 tiles
ld a, BANK(CircleTile)
call FarCopyData2
hlcoord 0, 0
Expand Down
2 changes: 1 addition & 1 deletion engine/gfx/load_pokedex_tiles.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LoadPokedexTilePatterns:
call LoadHpBarAndStatusTilePatterns
ld de, PokedexTileGraphics
ld hl, vChars2 tile $60
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / TILE_SIZE
call CopyVideoData
ld de, PokeballTileGraphics
ld hl, vChars2 tile $72
Expand Down
10 changes: 5 additions & 5 deletions engine/gfx/mon_icons.asm
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ GetAnimationSpeed:
push bc
ld hl, wMonPartySpritesSavedOAM
ld de, wShadowOAM
ld bc, $60
ld bc, OBJ_SIZE * 4 * PARTY_LENGTH
call CopyData
pop bc
xor a
jr .incTimer
.animateSprite
push bc
ld hl, wShadowOAMSprite00TileID
ld bc, $10
ld bc, OBJ_SIZE * 4
ld a, [wCurrentMenuItem]
call AddNTimes
ld c, ICONOFFSET
Expand All @@ -68,8 +68,8 @@ GetAnimationSpeed:
ld c, $1 ; amount to increase the y coord by
; otherwise, load a second sprite frame
.editTileIDS
ld b, $4
ld de, $4
ld b, 4
ld de, OBJ_SIZE
.loop
ld a, [hl]
add c
Expand Down Expand Up @@ -254,7 +254,7 @@ WriteMonPartySpriteOAM:
.makeCopy
ld hl, wShadowOAM
ld de, wMonPartySpritesSavedOAM
ld bc, $60
ld bc, OBJ_SIZE * 4 * PARTY_LENGTH
jp CopyData

GetPartyMonSpriteID:
Expand Down
2 changes: 1 addition & 1 deletion engine/gfx/palettes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ CopySGBBorderTiles:
ld b, 128
.tileLoop
; Copy bit planes 1 and 2 of the tile data.
ld c, 16
ld c, TILE_SIZE
.copyLoop
ld a, [hli]
ld [de], a
Expand Down
2 changes: 1 addition & 1 deletion engine/gfx/sprite_oam.asm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ PrepareOAMData::
ldh a, [hOAMBufferOffset]
ld l, a
ld h, HIGH(wShadowOAM)
ld de, $4
ld de, OBJ_SIZE
ld b, $a0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the $a0s here and below should be OAM_SIZE, and $90 should be OBJ_SIZE * (OAM_COUNT - 4).

Copy link
Contributor Author

@Narishma-gb Narishma-gb Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used SCREEN_HEIGHT_PX + OAM_Y_OFS due to ld [hl], b below, and replaced $90 and $a0 with your suggestions.
Edit: what about LOW(wShadowOAMEnd), since the loop uses an address comparison to stop ?

ld a, [wMovementFlags]
bit BIT_LEDGE_OR_FISHING, a
Expand Down
6 changes: 3 additions & 3 deletions engine/items/town_map.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DisplayTownMap:
call CopyData
ld hl, vSprites tile BIRD_BASE_TILE
ld de, TownMapCursor
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / TILE_1BPP_SIZE
call CopyVideoDataDouble
xor a
ld [wWhichTownMapLocation], a
Expand Down Expand Up @@ -149,7 +149,7 @@ LoadTownMap_Fly::
call CopyVideoData
ld de, TownMapUpArrow
ld hl, vChars1 tile $6d
lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8
lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / TILE_1BPP_SIZE
call CopyVideoDataDouble
call BuildFlyLocationsList
ld hl, wUpdateSpritesEnabled
Expand Down Expand Up @@ -611,7 +611,7 @@ TownMapSpriteBlinkingAnimation::
.hideSprites
ld hl, wShadowOAM
ld b, OAM_COUNT - 4
ld de, $4
ld de, OBJ_SIZE
.hideSpritesLoop
ld [hl], $a0
add hl, de
Expand Down
2 changes: 1 addition & 1 deletion engine/link/cable_club.asm
Original file line number Diff line number Diff line change
Expand Up @@ -977,5 +977,5 @@ CableClub_DrawHorizontalLine:
LoadTrainerInfoTextBoxTiles:
ld de, TrainerInfoTextBoxTileGraphics
ld hl, vChars2 tile $76
lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10
lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / TILE_SIZE
jp CopyVideoData
7 changes: 4 additions & 3 deletions engine/menus/display_text_id_init.asm
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ DisplayTextIDInit::
; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over
ld hl, wSprite01StateData1FacingDirection
ld c, $0f
ld de, $10
ld c, NUM_SPRITESTATEDATA_STRUCTS - 1
ld de, SPRITESTATEDATA1_LENGTH
.spriteFacingDirectionCopyLoop
ld a, [hl] ; x#SPRITESTATEDATA1_FACINGDIRECTION
inc h
Expand All @@ -56,7 +56,8 @@ DisplayTextIDInit::
; loop to force all the sprites in the middle of animation to stand still
; (so that they don't like they're frozen mid-step during the dialogue)
ld hl, wSpritePlayerStateData1ImageIndex
ld de, $10
ld de, SPRITESTATEDATA1_LENGTH
ASSERT NUM_SPRITESTATEDATA_STRUCTS == SPRITESTATEDATA1_LENGTH
ld c, e
.spriteStandStillLoop
ld a, [hl]
Expand Down
2 changes: 1 addition & 1 deletion engine/menus/naming_screen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ LoadEDTile:
ld de, ED_Tile
ld hl, vFont tile $70
; BUG: BANK("Home") should be BANK(ED_Tile), although it coincidentally works as-is
lb bc, BANK("Home"), (ED_TileEnd - ED_Tile) / $8
lb bc, BANK("Home"), (ED_TileEnd - ED_Tile) / TILE_1BPP_SIZE
jp CopyVideoDataDouble

ED_Tile:
Expand Down
4 changes: 2 additions & 2 deletions engine/menus/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ SaveMainData:
ld de, sSpriteData
ld bc, wSpriteDataEnd - wSpriteDataStart
call CopyData
ld hl, wBoxDataStart

; this part is redundant, SaveCurrentBoxData is always called next
ld hl, wBoxDataStart
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData

ldh a, [hTileAnimations]
ld [sTileAnimations], a

ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call CalcCheckSum
Expand Down
4 changes: 2 additions & 2 deletions engine/menus/start_sub_menus.asm
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,9 @@ SwitchPartyMon_ClearGfx:
jr nz, .clearMonBGLoop
pop af
ld hl, wShadowOAM
ld bc, $10
ld bc, OBJ_SIZE * 4
call AddNTimes
ld de, $4
ld de, OBJ_SIZE
ld c, e
.clearMonOAMLoop
ld [hl], $a0
Expand Down
2 changes: 1 addition & 1 deletion engine/movie/credits.asm
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Credits:
pop de
ld de, TheEndGfx
ld hl, vChars2 tile $60
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / $10
lb bc, BANK(TheEndGfx), (TheEndGfxEnd - TheEndGfx) / TILE_SIZE
call CopyVideoData
hlcoord 4, 8
ld de, TheEndTextString
Expand Down
4 changes: 2 additions & 2 deletions engine/movie/intro.asm
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,12 @@ IntroNidorinoAnimation7:
GameFreakIntro:
INCBIN "gfx/splash/gamefreak_presents.2bpp"
INCBIN "gfx/splash/gamefreak_logo.2bpp"
ds 16, $00 ; blank tile
ds TILE_SIZE, $00 ; blank tile
GameFreakIntroEnd:

FightIntroBackMon:
INCBIN "gfx/intro/gengar.2bpp"
ds 16, $00 ; blank tile
ds TILE_SIZE, $00 ; blank tile
FightIntroBackMonEnd:

IF DEF(_RED)
Expand Down
11 changes: 10 additions & 1 deletion engine/movie/oak_speech/oak_speech.asm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ OakSpeech:
ld a, SFX_SHRINK
call PlaySound
pop af
; bug: switching ROM Bank should not happen outside of Home Bank
; This code does nothing, as PlaySound does all necessary Bank switch
; It looks like a leftover from an early development stage
ldh [hLoadedROMBank], a
ld [rROMB], a
ld c, 4
Expand Down Expand Up @@ -145,6 +148,7 @@ OakSpeech:
ld [wNewSoundID], a
call PlaySound
pop af
; bug: switching ROM Bank should not happen outside of Home Bank
ldh [hLoadedROMBank], a
ld [rROMB], a
ld c, 20
Expand All @@ -160,21 +164,26 @@ OakSpeech:
call DelayFrames
call GBFadeOutToWhite
jp ClearScreen

OakSpeechText1:
text_far _OakSpeechText1
text_end

OakSpeechText2:
text_far _OakSpeechText2A
; BUG: The cry played does not match the sprite displayed.
sound_cry_nidorina
text_far _OakSpeechText2B
text_end

IntroducePlayerText:
text_far _IntroducePlayerText
text_end

IntroduceRivalText:
text_far _IntroduceRivalText
text_end

OakSpeechText3:
text_far _OakSpeechText3
text_end
Expand Down Expand Up @@ -226,7 +235,7 @@ IntroDisplayPicCenteredOrUpperRight:
call UncompressSpriteFromDE
ld hl, sSpriteBuffer1
ld de, sSpriteBuffer0
ld bc, $310
ld bc, 2 * SPRITEBUFFERSIZE
call CopyData
ld de, vFrontPic
call InterlaceMergeSpriteBuffers
Expand Down
6 changes: 3 additions & 3 deletions engine/movie/splash.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LoadShootingStarGraphics:
call CopyVideoData
ld de, FallingStar
ld hl, vChars1 tile $22
lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10
lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / TILE_SIZE
call CopyVideoData
ld hl, GameFreakLogoOAMData
ld de, wShadowOAMSprite24
Expand Down Expand Up @@ -60,9 +60,9 @@ AnimateShootingStar:
jr nz, .bigStarLoop

; Clear big star OAM.
ld hl, wShadowOAM
ld hl, wShadowOAMSprite00YCoord
ld c, 4
ld de, 4
ld de, OBJ_SIZE
.clearOAMLoop
ld [hl], 160
add hl, de
Expand Down
Loading