WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit c814ec6

Browse files
committed
Use OBJ_SIZE and TILE_SIZE constants
1 parent 628797b commit c814ec6

34 files changed

+118
-101
lines changed

engine/battle/animations.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ BallMoveDistances2:
928928
DoGrowlSpecialEffects:
929929
ld hl, wShadowOAM
930930
ld de, wShadowOAMSprite04
931-
ld bc, $10
931+
ld bc, OBJ_SIZE * 4
932932
call CopyData ; copy the musical note graphic
933933
ld a, [wSubAnimCounter]
934934
dec a
@@ -1308,7 +1308,7 @@ AdjustOAMBlockXPos:
13081308
ld h, d
13091309

13101310
AdjustOAMBlockXPos2:
1311-
ld de, 4
1311+
ld de, OBJ_SIZE
13121312
.loop
13131313
ld a, [wCoordAdjustmentAmount]
13141314
ld b, a
@@ -1332,7 +1332,7 @@ AdjustOAMBlockYPos:
13321332
ld h, d
13331333

13341334
AdjustOAMBlockYPos2:
1335-
ld de, 4
1335+
ld de, OBJ_SIZE
13361336
.loop
13371337
ld a, [wCoordAdjustmentAmount]
13381338
ld b, a
@@ -1670,7 +1670,7 @@ _AnimationShootBallsUpward:
16701670
dec a
16711671
ld [wNumShootingBalls], a
16721672
.next
1673-
ld de, 4
1673+
ld de, OBJ_SIZE
16741674
add hl, de ; next OAM entry
16751675
dec b
16761676
jr nz, .innerLoop
@@ -1723,10 +1723,10 @@ AnimationMinimizeMon:
17231723
ld hl, wTempPic
17241724
push hl
17251725
xor a
1726-
ld bc, 7 * 7 * $10
1726+
ld bc, 7 * 7 tiles
17271727
call FillMemory
17281728
pop hl
1729-
ld de, 7 * 3 * $10 + 4 * $10 + 4
1729+
ld de, 7 * 3 tiles + 4 tiles + 4
17301730
add hl, de
17311731
ld de, MinimizedMonSprite
17321732
ld c, MinimizedMonSpriteEnd - MinimizedMonSprite

engine/battle/battle_transitions.asm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BattleTransition:
1414
ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle)
1515
ld c, a
1616
ld b, 0
17-
ld de, $10
17+
ld de, SPRITESTATEDATA1_LENGTH
1818
.loop1
1919
ld a, [hl]
2020
cp $ff
@@ -35,13 +35,13 @@ BattleTransition:
3535
jr z, .skip2 ; skip clearing the block if the enemy trainer is using it
3636
push hl
3737
push bc
38-
ld bc, $10
38+
ld bc, OBJ_SIZE * 4
3939
xor a
4040
call FillMemory
4141
pop bc
4242
pop hl
4343
.skip2
44-
ld de, $10
44+
ld de, OBJ_SIZE * 4
4545
add hl, de
4646
dec c
4747
jr nz, .loop2

engine/battle/core.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ SlidePlayerHeadLeft:
107107
push bc
108108
ld hl, wShadowOAMSprite00XCoord
109109
ld c, $15 ; number of OAM entries
110-
ld de, $4 ; size of OAM entry
110+
ld de, OBJ_SIZE
111111
.loop
112112
dec [hl] ; decrement X
113113
dec [hl] ; decrement X
@@ -6655,11 +6655,11 @@ LoadHudTilePatterns:
66556655
.lcdEnabled
66566656
ld de, BattleHudTiles1
66576657
ld hl, vChars2 tile $6d
6658-
lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / $8
6658+
lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / TILE_1BPP_SIZE
66596659
call CopyVideoDataDouble
66606660
ld de, BattleHudTiles2
66616661
ld hl, vChars2 tile $73
6662-
lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8
6662+
lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / TILE_1BPP_SIZE
66636663
jp CopyVideoDataDouble
66646664

66656665
PrintEmptyString:
@@ -7040,14 +7040,14 @@ LoadMonBackPic:
70407040
ld b, 7
70417041
ld c, 8
70427042
call ClearScreenArea
7043-
ld hl, wMonHBackSprite - wMonHeader
7043+
ld hl, wMonHBackSprite - wMonHeader
70447044
call UncompressMonSprite
70457045
predef ScaleSpriteByTwo
70467046
ld de, vBackPic
70477047
call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite
70487048
ld hl, vSprites
70497049
ld de, vBackPic
7050-
ld c, (2 * SPRITEBUFFERSIZE) / 16 ; count of 16-byte chunks to be copied
7050+
ld c, (2 * SPRITEBUFFERSIZE) / TILE_SIZE ; count of 16-byte chunks to be copied
70517051
ldh a, [hLoadedROMBank]
70527052
ld b, a
70537053
jp CopyVideoData

engine/battle/draw_hud_pokeball_gfx.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ DrawEnemyPokeballs:
1313
LoadPartyPokeballGfx:
1414
ld de, PokeballTileGraphics
1515
ld hl, vSprites tile $31
16-
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
16+
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / TILE_SIZE
1717
jp CopyVideoData
1818

1919
SetupOwnPartyPokeballs:

engine/battle/effects.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ UpdateLoweredStatDone:
686686
.ApplyBadgeBoostsAndStatusPenalties
687687
ldh a, [hWhoseTurn]
688688
and a
689-
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
689+
call nz, ApplyBadgeStatBoosts ; whenever the opponent uses a stat-down move, badge boosts get reapplied again to every stat,
690690
; even to those not affected by the stat-down move (will be boosted further)
691691
ld hl, MonsStatsFellText
692692
call PrintText

engine/events/diploma.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DisplayDiploma::
1111
call DisableLCD
1212
ld hl, CircleTile
1313
ld de, vChars2 tile CIRCLE_TILE_ID
14-
ld bc, $10
14+
ld bc, 1 tiles
1515
ld a, BANK(CircleTile)
1616
call FarCopyData2
1717
hlcoord 0, 0

engine/gfx/load_pokedex_tiles.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ LoadPokedexTilePatterns:
33
call LoadHpBarAndStatusTilePatterns
44
ld de, PokedexTileGraphics
55
ld hl, vChars2 tile $60
6-
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
6+
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / TILE_SIZE
77
call CopyVideoData
88
ld de, PokeballTileGraphics
99
ld hl, vChars2 tile $72

engine/gfx/mon_icons.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ GetAnimationSpeed:
4444
push bc
4545
ld hl, wMonPartySpritesSavedOAM
4646
ld de, wShadowOAM
47-
ld bc, $60
47+
ld bc, OBJ_SIZE * 4 * PARTY_LENGTH
4848
call CopyData
4949
pop bc
5050
xor a
5151
jr .incTimer
5252
.animateSprite
5353
push bc
5454
ld hl, wShadowOAMSprite00TileID
55-
ld bc, $10
55+
ld bc, OBJ_SIZE * 4
5656
ld a, [wCurrentMenuItem]
5757
call AddNTimes
5858
ld c, ICONOFFSET
@@ -68,8 +68,8 @@ GetAnimationSpeed:
6868
ld c, $1 ; amount to increase the y coord by
6969
; otherwise, load a second sprite frame
7070
.editTileIDS
71-
ld b, $4
72-
ld de, $4
71+
ld b, 4
72+
ld de, OBJ_SIZE
7373
.loop
7474
ld a, [hl]
7575
add c
@@ -254,7 +254,7 @@ WriteMonPartySpriteOAM:
254254
.makeCopy
255255
ld hl, wShadowOAM
256256
ld de, wMonPartySpritesSavedOAM
257-
ld bc, $60
257+
ld bc, OBJ_SIZE * 4 * PARTY_LENGTH
258258
jp CopyData
259259

260260
GetPartyMonSpriteID:

engine/gfx/palettes.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ CopySGBBorderTiles:
611611
ld b, 128
612612
.tileLoop
613613
; Copy bit planes 1 and 2 of the tile data.
614-
ld c, 16
614+
ld c, TILE_SIZE
615615
.copyLoop
616616
ld a, [hli]
617617
ld [de], a

engine/gfx/sprite_oam.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ PrepareOAMData::
148148
ldh a, [hOAMBufferOffset]
149149
ld l, a
150150
ld h, HIGH(wShadowOAM)
151-
ld de, $4
151+
ld de, OBJ_SIZE
152152
ld b, $a0
153153
ld a, [wMovementFlags]
154154
bit BIT_LEDGE_OR_FISHING, a

0 commit comments

Comments
 (0)