Fix comment/style issues caused from w-izing.

This commit is contained in:
luckytyphlosion 2018-01-30 14:05:25 -05:00
parent a1951cefc0
commit 3203ad7d50
13 changed files with 138 additions and 124 deletions

View File

@ -21,7 +21,7 @@ AI_SwitchOrTryItem: ; 38000
jr nz, DontSwitch
ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
ld a, [wInBattleTowerBattle] ; Load always the first wTrainerClass for BattleTower-Trainers
ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers
and a
jr nz, .ok

View File

@ -66,7 +66,7 @@ AIChooseMove: ; 440ce
.ApplyLayers:
ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS
; If we have a battle in BattleTower just load the Attributes of the first wTrainerClass (Falkner)
; If we have a battle in BattleTower just load the Attributes of the first trainer class in wTrainerClass (Falkner)
; so we have always the same AI, regardless of the loaded class of trainer
ld a, [wInBattleTowerBattle]
bit 0, a

View File

@ -6133,7 +6133,7 @@ LoadEnemyMon: ; 3e8eb
; Notes:
; BattleRandom is used to ensure sync between Game Boys
; Clear the whole wEnemyMon struct
; Clear the whole enemy mon struct (wEnemyMon)
xor a
ld hl, wEnemyMonSpecies
ld bc, wEnemyMonEnd - wEnemyMon
@ -6989,7 +6989,8 @@ ApplyStatLevelMultiplier: ; 3ecb7
; 3ed45
BadgeStatBoosts: ; 3ed45
; Raise wBattleMon stats depending on which badges have been obtained.
; Raise the stats of the battle mon in wBattleMon
; depending on which badges have been obtained.
; Every other badge boosts a stat, starting from the first.

View File

@ -602,7 +602,7 @@ ApplyPals:
ld hl, wBGPals1
ld de, wBGPals2
ld bc, 16 palettes
ld a, BANK(wPals)
ld a, BANK(wGBCPalettes)
call FarCopyWRAM
ret

View File

@ -13,7 +13,7 @@ Credits:: ; 109847
ld a, [rSVBK]
push af
ld a, BANK(wPals)
ld a, BANK(wGBCPalettes)
ld [rSVBK], a
call ClearBGPalettes

View File

@ -352,7 +352,7 @@ INCBIN "gfx/splash/logo2.1bpp"
CrystalIntro: ; e48ac
ld a, [rSVBK]
push af
ld a, BANK(wPals)
ld a, BANK(wGBCPalettes)
ld [rSVBK], a
ld a, [hInMenu]
push af

View File

@ -326,7 +326,7 @@ PokeAnim_InitPicAttributes: ; d01d6
ld [wPokeAnimPointer], a
ld a, b
ld [wPokeAnimPointer + 1], a
; hl contains wTileMap coords
; hl contains tilemap coords
ld a, l
ld [wPokeAnimCoord], a
ld a, h

View File

@ -247,7 +247,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8)
xor a
ld [hBGMapMode], a
hlcoord 0, 0
ld bc, wTileMapEnd - wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $4f
call ByteFill
ld a, [wPokegearCard]

View File

@ -39,26 +39,26 @@ _GetVarAction:: ; 80648 (20:4648)
; RETVAR_STRBUF2: copy [de] to wStringBuffer2
; RETVAR_ADDR_DE: return address in de
; RETVAR_EXECUTE: call function
dwb wStringBuffer2, RETVAR_STRBUF2
dwb wPartyCount, RETVAR_STRBUF2
dwb wStringBuffer2, RETVAR_STRBUF2
dwb wPartyCount, RETVAR_STRBUF2
dwb .BattleResult, RETVAR_EXECUTE
dwb wBattleType, RETVAR_ADDR_DE
dwb wTimeOfDay, RETVAR_STRBUF2
dwb wBattleType, RETVAR_ADDR_DE
dwb wTimeOfDay, RETVAR_STRBUF2
dwb .CountCaughtMons, RETVAR_EXECUTE
dwb .CountSeenMons, RETVAR_EXECUTE
dwb .CountBadges, RETVAR_EXECUTE
dwb wPlayerState, RETVAR_ADDR_DE
dwb .wPlayerFacing, RETVAR_EXECUTE
dwb wPlayerState, RETVAR_ADDR_DE
dwb .PlayerFacing, RETVAR_EXECUTE
dwb hHours, RETVAR_STRBUF2
dwb .DayOfWeek, RETVAR_EXECUTE
dwb wMapGroup, RETVAR_STRBUF2
dwb wMapNumber, RETVAR_STRBUF2
dwb wMapGroup, RETVAR_STRBUF2
dwb wMapNumber, RETVAR_STRBUF2
dwb .UnownCaught, RETVAR_EXECUTE
dwb wEnvironment, RETVAR_STRBUF2
dwb wEnvironment, RETVAR_STRBUF2
dwb .BoxFreeSpace, RETVAR_EXECUTE
dwb wBugContestMinsRemaining, RETVAR_STRBUF2
dwb wXCoord, RETVAR_STRBUF2
dwb wYCoord, RETVAR_STRBUF2
dwb wXCoord, RETVAR_STRBUF2
dwb wYCoord, RETVAR_STRBUF2
dwb wSpecialPhoneCallID, RETVAR_STRBUF2
dwb wNrOfBeatenBattleTowerTrainers, RETVAR_STRBUF2
dwb wKurtApricornQuantity, RETVAR_STRBUF2
@ -96,7 +96,7 @@ _GetVarAction:: ; 80648 (20:4648)
jp .loadstringbuffer2
; 806ef
.wPlayerFacing: ; 806ef
.PlayerFacing: ; 806ef
; The direction the player is facing.
ld a, [wPlayerDirection]
and $c

View File

@ -25,7 +25,7 @@ OpponentPartyAttr:: ; 3951
BattlePartyAttr:: ; 395d
; Get attribute a from the active wBattleMon's party struct.
; Get attribute a from the party struct of the active battle mon.
push bc
ld c, a
ld b, 0
@ -39,7 +39,7 @@ BattlePartyAttr:: ; 395d
OTPartyAttr:: ; 396d
; Get attribute a from the active wEnemyMon's party struct.
; Get attribute a from the party struct of the active enemy mon.
push bc
ld c, a
ld b, 0
@ -136,100 +136,7 @@ UpdateBattleHuds:: ; 39d4
; 39e1
GetBattleVar:: ; 39e1
; Preserves hl.
push hl
call GetBattleVarAddr
pop hl
ret
; 39e7
GetBattleVarAddr:: ; 39e7
; Get variable from pair a, depending on whose turn it is.
; There are 21 variable pairs.
push bc
ld hl, .battlevarpairs
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
; Enemy turn uses the second byte instead.
; This lets battle variable calls be side-neutral.
ld a, [hBattleTurn]
and a
jr z, .getvar
inc hl
.getvar
; var id
ld a, [hl]
ld c, a
ld b, 0
ld hl, .vars
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
pop bc
ret
.battlevarpairs
dw .substatus1, .substatus2, .substatus3, .substatus4, .substatus5
dw .substatus1opp, .substatus2opp, .substatus3opp, .substatus4opp, .substatus5opp
dw .status, .statusopp, .animation, .effect, .power, .type
dw .curmove, .lastcounter, .lastcounteropp, .lastmove, .lastmoveopp
; player enemy
.substatus1 db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
.substatus1opp db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
.substatus2 db PLAYER_SUBSTATUS_2, ENEMY_SUBSTATUS_2
.substatus2opp db ENEMY_SUBSTATUS_2, PLAYER_SUBSTATUS_2
.substatus3 db PLAYER_SUBSTATUS_3, ENEMY_SUBSTATUS_3
.substatus3opp db ENEMY_SUBSTATUS_3, PLAYER_SUBSTATUS_3
.substatus4 db PLAYER_SUBSTATUS_4, ENEMY_SUBSTATUS_4
.substatus4opp db ENEMY_SUBSTATUS_4, PLAYER_SUBSTATUS_4
.substatus5 db PLAYER_SUBSTATUS_5, ENEMY_SUBSTATUS_5
.substatus5opp db ENEMY_SUBSTATUS_5, PLAYER_SUBSTATUS_5
.status db PLAYER_STATUS, ENEMY_STATUS
.statusopp db ENEMY_STATUS, PLAYER_STATUS
.animation db PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION
.effect db PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT
.power db PLAYER_MOVE_POWER, ENEMY_MOVE_POWER
.type db PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE
.curmove db PLAYER_CUR_MOVE, ENEMY_CUR_MOVE
.lastcounter db PLAYER_COUNTER_MOVE, ENEMY_COUNTER_MOVE
.lastcounteropp db ENEMY_COUNTER_MOVE, PLAYER_COUNTER_MOVE
.lastmove db PLAYER_LAST_MOVE, ENEMY_LAST_MOVE
.lastmoveopp db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE
.vars
dw wPlayerSubStatus1, wEnemySubStatus1
dw wPlayerSubStatus2, wEnemySubStatus2
dw wPlayerSubStatus3, wEnemySubStatus3
dw wPlayerSubStatus4, wEnemySubStatus4
dw wPlayerSubStatus5, wEnemySubStatus5
dw wBattleMonStatus, wEnemyMonStatus
dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation
dw wPlayerMoveStructEffect, wEnemyMoveStructEffect
dw wPlayerMoveStructPower, wEnemyMoveStructPower
dw wPlayerMoveStructType, wEnemyMoveStructType
dw wCurPlayerMove, wCurEnemyMove
dw wLastPlayerCounterMove, wLastEnemyCounterMove
dw wLastPlayerMove, wLastEnemyMove
; 3a90
INCLUDE "home/battle_vars.asm"
FarCopyRadioText:: ; 3a90
@ -293,8 +200,6 @@ BattleTextBox:: ; 3ac3
StdBattleTextBox:: ; 3ad5
; Open a textbox and print battle text at 20:hl.
GLOBAL BattleText
ld a, [hROMBank]
push af
@ -310,9 +215,6 @@ GLOBAL BattleText
GetBattleAnimPointer:: ; 3ae1
GLOBAL BattleAnimations
GLOBAL BattleAnimCommands
ld a, BANK(BattleAnimations)
rst Bankswitch

111
home/battle_vars.asm Normal file
View File

@ -0,0 +1,111 @@
GetBattleVar:: ; 39e1
; Preserves hl.
push hl
call GetBattleVarAddr
pop hl
ret
; 39e7
GetBattleVarAddr:: ; 39e7
; Get variable from pair a, depending on whose turn it is.
; There are 21 variable pairs.
push bc
ld hl, .BattleVarPairs
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
; Enemy turn uses the second byte instead.
; This lets battle variable calls be side-neutral.
ld a, [hBattleTurn]
and a
jr z, .get_var
inc hl
.get_var
; var id
ld a, [hl]
ld c, a
ld b, 0
ld hl, .BattleVarPointers
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
pop bc
ret
.BattleVarPairs:
dw .Substatus1
dw .Substatus2
dw .Substatus3
dw .Substatus4
dw .Substatus5
dw .Substatus1Opp
dw .Substatus2Opp
dw .Substatus3Opp
dw .Substatus4Opp
dw .Substatus5Opp
dw .Status
dw .StatusOpp
dw .MoveAnim
dw .MoveEffect
dw .MovePower
dw .MoveType
dw .CurMove
dw .LastCounter
dw .LastCounterOpp
dw .LastMove
dw .LastMoveOpp
; player enemy
.Substatus1: db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
.Substatus1Opp: db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
.Substatus2: db PLAYER_SUBSTATUS_2, ENEMY_SUBSTATUS_2
.Substatus2Opp: db ENEMY_SUBSTATUS_2, PLAYER_SUBSTATUS_2
.Substatus3: db PLAYER_SUBSTATUS_3, ENEMY_SUBSTATUS_3
.Substatus3Opp: db ENEMY_SUBSTATUS_3, PLAYER_SUBSTATUS_3
.Substatus4: db PLAYER_SUBSTATUS_4, ENEMY_SUBSTATUS_4
.Substatus4Opp: db ENEMY_SUBSTATUS_4, PLAYER_SUBSTATUS_4
.Substatus5: db PLAYER_SUBSTATUS_5, ENEMY_SUBSTATUS_5
.Substatus5Opp: db ENEMY_SUBSTATUS_5, PLAYER_SUBSTATUS_5
.Status: db PLAYER_STATUS, ENEMY_STATUS
.StatusOpp: db ENEMY_STATUS, PLAYER_STATUS
.MoveAnim: db PLAYER_MOVE_ANIMATION, ENEMY_MOVE_ANIMATION
.MoveEffect: db PLAYER_MOVE_EFFECT, ENEMY_MOVE_EFFECT
.MovePower: db PLAYER_MOVE_POWER, ENEMY_MOVE_POWER
.MoveType: db PLAYER_MOVE_TYPE, ENEMY_MOVE_TYPE
.CurMove: db PLAYER_CUR_MOVE, ENEMY_CUR_MOVE
.LastCounter: db PLAYER_COUNTER_MOVE, ENEMY_COUNTER_MOVE
.LastCounterOpp: db ENEMY_COUNTER_MOVE, PLAYER_COUNTER_MOVE
.LastMove: db PLAYER_LAST_MOVE, ENEMY_LAST_MOVE
.LastMoveOpp: db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE
.BattleVarPointers:
dw wPlayerSubStatus1, wEnemySubStatus1
dw wPlayerSubStatus2, wEnemySubStatus2
dw wPlayerSubStatus3, wEnemySubStatus3
dw wPlayerSubStatus4, wEnemySubStatus4
dw wPlayerSubStatus5, wEnemySubStatus5
dw wBattleMonStatus, wEnemyMonStatus
dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation
dw wPlayerMoveStructEffect, wEnemyMoveStructEffect
dw wPlayerMoveStructPower, wEnemyMoveStructPower
dw wPlayerMoveStructType, wEnemyMoveStructType
dw wCurPlayerMove, wCurEnemyMove
dw wLastPlayerCounterMove, wLastEnemyCounterMove
dw wLastPlayerMove, wLastEnemyMove
; 3a90

View File

@ -117,7 +117,7 @@ PlaceVerticalMenuItems:: ; 1c89
inc hl
ld d, [hl]
call GetMenuTextStartCoord
call Coord2Tile ; hl now contains the wTileMap address where we will start printing text.
call Coord2Tile ; hl now contains the tilemap address where we will start printing text.
inc de
ld a, [de] ; Number of items
inc de

View File

@ -2943,7 +2943,7 @@ w3_dffc:: ds 4
SECTION "GBC Video", WRAMX
; eight 4-color palettes each
wPals::
wGBCPalettes::
wBGPals1:: ds 8 palettes ; d000
wOBPals1:: ds 8 palettes ; d040
wBGPals2:: ds 8 palettes ; d080