shithub: pokered

Download patch

ref: 8026d4758565c1ae427a9995c840d8b8dbc8352b
parent: 5facf8377aeda68cb3fca389cb1784cf9c2d406b
author: dannye <corrnondacqb@yahoo.com>
date: Sun Aug 30 18:15:32 EDT 2015

No more S_

--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6457,7 +6457,7 @@
 	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
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -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)
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -186,8 +186,8 @@
 	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
--- a/engine/oak_speech.asm
+++ b/engine/oak_speech.asm
@@ -215,8 +215,8 @@
 	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
--- a/home.asm
+++ b/home.asm
@@ -810,15 +810,15 @@
 	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
@@ -869,9 +869,9 @@
 	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
@@ -895,7 +895,7 @@
 	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
@@ -905,7 +905,7 @@
 	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
--- a/home/pic.asm
+++ b/home/pic.asm
@@ -19,7 +19,7 @@
 
 ; 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
@@ -48,19 +48,19 @@
 	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]
@@ -290,9 +290,9 @@
 	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
@@ -542,12 +542,12 @@
 	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
--- a/sram.asm
+++ b/sram.asm
@@ -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