Rename/organize part 1 of 4

rename functions, clean up address/wram comments, other misc
only broken up so that all changes are viewable on github
This commit is contained in:
U-Daniel-PC\Daniel 2015-07-03 14:37:53 -05:00
parent ae420a4d8f
commit cd649184f5
90 changed files with 1070 additions and 1066 deletions

View file

@ -4,19 +4,19 @@ PlayDefaultMusic:: ; 2307 (0:2307)
ld c, a
ld d, a
ld [wcfca], a
jr asm_2324
jr Func_2324
Func_2312:: ; 2312 (0:2312)
ld c, $a
ld d, $0
ld a, [wd72e]
bit 5, a
jr z, asm_2324
jr z, Func_2324
xor a
ld [wcfca], a
ld c, $8
ld d, c
asm_2324:: ; 2324 (0:2324)
Func_2324:: ; 2324 (0:2324)
ld a, [wWalkBikeSurfState]
and a
jr z, .asm_2343
@ -146,27 +146,27 @@ PlaySound:: ; 23b1 (0:23b1)
ld [$ffb9], a
ld a, [wc0ef]
ld [H_LOADEDROMBANK], a
ld [$2000], a
cp BANK(Func_9876)
ld [MBC1RomBank], a
cp BANK(Music2_9876)
jr nz, .checkForBank08
.bank02
ld a, b
call Func_9876
call Music2_9876
jr .asm_240b
.checkForBank08
cp BANK(Func_22035)
cp BANK(Music8_22035)
jr nz, .bank1F
.bank08
ld a, b
call Func_22035
call Music8_22035
jr .asm_240b
.bank1F
ld a, b
call Func_7d8ea
call Music1f_7d8ea
.asm_240b
ld a, [$ffb9]
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
jr .asm_2425
.asm_2414
ld a, b

View file

@ -1,7 +1,7 @@
SoftReset::
call StopAllSounds
call GBPalWhiteOut
ld c, $20
ld c, 32
call DelayFrames
; fallthrough

View file

@ -257,7 +257,7 @@ OverworldLoopLessDelay::
jr z,.noSpinning
callba LoadSpinnerArrowTiles ; spin while moving
.noSpinning
call UpdateSprites ; move sprites
call UpdateSprites
.moveAhead2
ld hl,wFlags_0xcd60
res 2,[hl]
@ -335,7 +335,7 @@ OverworldLoopLessDelay::
and a
jr z,.allPokemonFainted
.noFaintCheck
ld c,$0a
ld c,10
call DelayFrames
jp EnterMap
.allPokemonFainted
@ -778,7 +778,7 @@ HandleFlyWarpOrDungeonWarp::
call LeaveMapAnim
ld a, Bank(SpecialWarpIn)
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
call SpecialWarpIn
jp SpecialEnterMap
@ -1358,7 +1358,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
push af
ld a,[W_TILESETBANK] ; tile data ROM bank
ld [H_LOADEDROMBANK],a
ld [$2000],a ; switch to ROM bank that contains tile data
ld [MBC1RomBank],a ; switch to ROM bank that contains tile data
ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
ld e,a
ld a,[wCurrentTileBlockMapViewPointer + 1]
@ -1440,7 +1440,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
jr nz,.rowLoop2
pop af
ld [H_LOADEDROMBANK],a
ld [$2000],a ; restore previous ROM bank
ld [MBC1RomBank],a ; restore previous ROM bank
ret
AdvancePlayerSprite:: ; 0d27 (0:0d27)
@ -1981,7 +1981,7 @@ RunMapScript:: ; 101b (0:101b)
ret
LoadWalkingPlayerSpriteGraphics:: ; 104d (0:104d)
ld de,RedSprite ; $4180
ld de,RedSprite
ld hl,vNPCSprites
jr LoadPlayerSpriteGraphicsCommon
@ -2276,7 +2276,7 @@ LoadMapHeader:: ; 107c (0:107c)
push af
ld a, BANK(MapSongBanks)
ld [H_LOADEDROMBANK],a
ld [$2000],a
ld [MBC1RomBank],a
ld hl, MapSongBanks
add hl,bc
add hl,bc
@ -2286,7 +2286,7 @@ LoadMapHeader:: ; 107c (0:107c)
ld [wd35c],a ; music 2
pop af
ld [H_LOADEDROMBANK],a
ld [$2000],a
ld [MBC1RomBank],a
ret
; function to copy map connection data from ROM to WRAM
@ -2359,7 +2359,7 @@ LoadMapData:: ; 1241 (0:1241)
.restoreRomBank
pop af
ld [H_LOADEDROMBANK],a
ld [$2000],a
ld [MBC1RomBank],a
ret
; function to switch to the ROM bank that a map is stored in
@ -2378,7 +2378,7 @@ SwitchToMapRomBank:: ; 12bc (0:12bc)
call BankswitchBack
ld a,[$ffe8]
ld [H_LOADEDROMBANK],a
ld [$2000],a ; switch to map ROM bank
ld [MBC1RomBank],a ; switch to map ROM bank
pop bc
pop hl
ret

View file

@ -6,7 +6,7 @@ UncompressSpriteData:: ; 24fd (0:24fd)
push af
ld a, b
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
ld a, $a
ld [$0], a
xor a
@ -14,7 +14,7 @@ UncompressSpriteData:: ; 24fd (0:24fd)
call _UncompressSpriteData
pop af
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
ret
; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
@ -31,7 +31,7 @@ _UncompressSpriteData:: ; 251a (0:251a)
xor a
ld [W_SPRITECURPOSX], a
ld [W_SPRITECURPOSY], a
ld [W_SPRITELOADFLAGS], a ; wd0a8
ld [W_SPRITELOADFLAGS], a
call ReadNextInputByte ; first byte of input determines sprite width (high nybble) and height (low nybble) in tiles (8x8 pixels)
ld b, a
and $f
@ -57,13 +57,13 @@ _UncompressSpriteData:: ; 251a (0:251a)
; 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 a, [W_SPRITELOADFLAGS] ; wd0a8
ld a, [W_SPRITELOADFLAGS]
bit 0, a
jr z, .useSpriteBuffer1 ; check which buffer to use
ld hl, S_SPRITEBUFFER2
.useSpriteBuffer1
call StoreSpriteOutputPointer
ld a, [W_SPRITELOADFLAGS] ; wd0a8
ld a, [W_SPRITELOADFLAGS]
bit 1, a
jr z, .startDecompression ; check if last iteration
call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode
@ -195,12 +195,12 @@ MoveToNextBufferPosition:: ; 25d8 (0:25d8)
pop hl
xor a
ld [W_SPRITECURPOSX], a
ld a, [W_SPRITELOADFLAGS] ; wd0a8
ld a, [W_SPRITELOADFLAGS]
bit 1, a
jr nz, .done ; test if there is one more sprite to go
xor $1
set 1, a
ld [W_SPRITELOADFLAGS], a ; wd0a8
ld [W_SPRITELOADFLAGS], a
jp UncompressSpriteDataLoop
.done
jp UnpackSprite
@ -539,7 +539,7 @@ ReverseNybble:: ; 2837 (0:2837)
; resets sprite buffer pointers to buffer 1 and 2, depending on W_SPRITELOADFLAGS
ResetSpriteBufferPointers:: ; 2841 (0:2841)
ld a, [W_SPRITELOADFLAGS] ; wd0a8
ld a, [W_SPRITELOADFLAGS]
bit 0, a
jr nz, .buffer2Selected
ld de, S_SPRITEBUFFER1

View file

@ -14,13 +14,13 @@ Predef::
push af
ld a, BANK(GetPredefPointer)
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
call GetPredefPointer
ld a, [wPredefBank]
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
ld de, .done
push de
@ -29,7 +29,7 @@ Predef::
pop af
ld [H_LOADEDROMBANK], a
ld [$2000], a
ld [MBC1RomBank], a
ret
GetPredefRegisters::

View file

@ -293,7 +293,7 @@ Char51:: ; 1ab4 (0:1ab4)
hlCoord 1, 13
ld bc,$0412
call ClearScreenArea
ld c,$14
ld c,20
call DelayFrames
pop de
hlCoord 1, 14
@ -308,7 +308,7 @@ Char49:: ; 1ad5 (0:1ad5)
hlCoord 1, 10
ld bc,$0712
call ClearScreenArea
ld c,$14
ld c,20
call DelayFrames
pop de
pop hl
@ -690,7 +690,7 @@ TextCommand17:: ; 1ca3 (0:1ca3)
ld d,a
ld a,[hli]
ld [H_LOADEDROMBANK],a
ld [$2000],a
ld [MBC1RomBank],a
push hl
ld l,e
ld h,d
@ -698,7 +698,7 @@ TextCommand17:: ; 1ca3 (0:1ca3)
pop hl
pop af
ld [H_LOADEDROMBANK],a
ld [$2000],a
ld [MBC1RomBank],a
jp NextTextCommand
TextCommandJumpTable:: ; 1cc1 (0:1cc1)