Skip to content

Commit

Permalink
No more S_
Browse files Browse the repository at this point in the history
  • Loading branch information
dannye committed Aug 31, 2015
1 parent 5facf83 commit 8026d47
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6457,7 +6457,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
xor a
ld [$4000], a
ld hl, vSprites
ld de, S_SPRITEBUFFER1
ld de, sSpriteBuffer1
ld a, [H_LOADEDROMBANK]
ld b, a
ld c, 7 * 7
Expand Down
8 changes: 4 additions & 4 deletions engine/battle/scale_sprites.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored
; resulting in a 7*7 tile output sprite chunk
ScaleSpriteByTwo: ; 2fe40 (b:7e40)
ld de, S_SPRITEBUFFER1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
call ScaleLastSpriteColumnByTwo ; last tile column is special case
call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
ld de, S_SPRITEBUFFER2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
call ScaleLastSpriteColumnByTwo ; last tile column is special case

ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
Expand Down
4 changes: 2 additions & 2 deletions engine/hall_of_fame.asm
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ HoFLoadPlayerPics: ; 7033e (1c:433e)
ld de, RedPicFront
ld a, BANK(RedPicFront)
call UncompressSpriteFromDE
ld hl, S_SPRITEBUFFER1
ld de, S_SPRITEBUFFER0
ld hl, sSpriteBuffer1
ld de, sSpriteBuffer0
ld bc, $310
call CopyData
ld de, vFrontPic
Expand Down
4 changes: 2 additions & 2 deletions engine/oak_speech.asm
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4)
push bc
ld a,b
call UncompressSpriteFromDE
ld hl,S_SPRITEBUFFER1
ld de,S_SPRITEBUFFER0
ld hl,sSpriteBuffer1
ld de,sSpriteBuffer0
ld bc,$310
call CopyData
ld de,vFrontPic
Expand Down
22 changes: 11 additions & 11 deletions home.asm
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,15 @@ LoadUncompressedSpriteData:: ; 1672 (0:1672)
ld [H_SPRITEOFFSET], a
xor a
ld [$4000], a
ld hl, S_SPRITEBUFFER0
ld hl, sSpriteBuffer0
call ZeroSpriteBuffer ; zero buffer 0
ld de, S_SPRITEBUFFER1
ld hl, S_SPRITEBUFFER0
ld de, sSpriteBuffer1
ld hl, sSpriteBuffer0
call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite)
ld hl, S_SPRITEBUFFER1
ld hl, sSpriteBuffer1
call ZeroSpriteBuffer ; zero buffer 1
ld de, S_SPRITEBUFFER2
ld hl, S_SPRITEBUFFER1
ld de, sSpriteBuffer2
ld hl, sSpriteBuffer1
call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite)
pop de
jp InterlaceMergeSpriteBuffers
Expand Down Expand Up @@ -869,9 +869,9 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
xor a
ld [$4000], a
push de
ld hl, S_SPRITEBUFFER2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
ld de, S_SPRITEBUFFER1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
ld bc, S_SPRITEBUFFER0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
ld a, SPRITEBUFFERSIZE/2 ; $c4
ld [H_SPRITEINTERLACECOUNTER], a
.interlaceLoop
Expand All @@ -895,7 +895,7 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
and a
jr z, .notFlipped
ld bc, 2*SPRITEBUFFERSIZE
ld hl, S_SPRITEBUFFER1
ld hl, sSpriteBuffer1
.swapLoop
swap [hl] ; if flipped swap nybbles in all bytes
inc hl
Expand All @@ -905,7 +905,7 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
jr nz, .swapLoop
.notFlipped
pop hl
ld de, S_SPRITEBUFFER1
ld de, sSpriteBuffer1
ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied
ld a, [H_LOADEDROMBANK]
ld b, a
Expand Down
22 changes: 11 additions & 11 deletions home/pic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ UncompressSpriteData:: ; 24fd (0:24fd)

; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
_UncompressSpriteData:: ; 251a (0:251a)
ld hl, S_SPRITEBUFFER1
ld hl, sSpriteBuffer1
ld c, (2*SPRITEBUFFERSIZE) % $100
ld b, (2*SPRITEBUFFERSIZE) / $100
xor a
Expand Down Expand Up @@ -48,19 +48,19 @@ _UncompressSpriteData:: ; 251a (0:251a)
ld [wSpriteWidth], a
call ReadNextInputBit
ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit
; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2
; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2
; bit 0 decides in which one the first chunk is placed
; fall through

; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into S_SPRITEBUFFER1 or S_SPRITEBUFFER2
; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2
; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
UncompressSpriteDataLoop:: ; 2556 (0:2556)
ld hl, S_SPRITEBUFFER1
ld hl, sSpriteBuffer1
ld a, [wSpriteLoadFlags]
bit 0, a
jr z, .useSpriteBuffer1 ; check which buffer to use
ld hl, S_SPRITEBUFFER2
ld hl, sSpriteBuffer2
.useSpriteBuffer1
call StoreSpriteOutputPointer
ld a, [wSpriteLoadFlags]
Expand Down Expand Up @@ -290,9 +290,9 @@ UnpackSprite:: ; 26bf (0:26bf)
jp z, UnpackSpriteMode2
and a
jp nz, XorSpriteChunks
ld hl, S_SPRITEBUFFER1
ld hl, sSpriteBuffer1
call SpriteDifferentialDecode
ld hl, S_SPRITEBUFFER2
ld hl, sSpriteBuffer2
; fall through

; decodes differential encoded sprite data
Expand Down Expand Up @@ -542,12 +542,12 @@ ResetSpriteBufferPointers:: ; 2841 (0:2841)
ld a, [wSpriteLoadFlags]
bit 0, a
jr nz, .buffer2Selected
ld de, S_SPRITEBUFFER1
ld hl, S_SPRITEBUFFER2
ld de, sSpriteBuffer1
ld hl, sSpriteBuffer2
jr .storeBufferPointers
.buffer2Selected
ld de, S_SPRITEBUFFER2
ld hl, S_SPRITEBUFFER1
ld de, sSpriteBuffer2
ld hl, sSpriteBuffer1
.storeBufferPointers
ld a, l
ld [wSpriteOutputPtr], a
Expand Down
6 changes: 3 additions & 3 deletions sram.asm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SECTION "Sprite Buffers", SRAM, BANK[0]

S_SPRITEBUFFER0:: ds SPRITEBUFFERSIZE ; a000
S_SPRITEBUFFER1:: ds SPRITEBUFFERSIZE ; a188
S_SPRITEBUFFER2:: ds SPRITEBUFFERSIZE ; a310
sSpriteBuffer0:: ds SPRITEBUFFERSIZE ; a000
sSpriteBuffer1:: ds SPRITEBUFFERSIZE ; a188
sSpriteBuffer2:: ds SPRITEBUFFERSIZE ; a310

ds $100

Expand Down

0 comments on commit 8026d47

Please sign in to comment.