summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/battle.asm104
-rw-r--r--home/battle_vars.asm111
-rw-r--r--home/tilemap.asm2
3 files changed, 115 insertions, 102 deletions
diff --git a/home/battle.asm b/home/battle.asm
index b4b7cf844..e59b1e3b4 100644
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -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
diff --git a/home/battle_vars.asm b/home/battle_vars.asm
new file mode 100644
index 000000000..44fc21d6d
--- /dev/null
+++ b/home/battle_vars.asm
@@ -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
diff --git a/home/tilemap.asm b/home/tilemap.asm
index 00317e53b..4bbd16102 100644
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -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