ref: f7ee74c3b8fdd57c92844f3f9d7a89c0f9770d6d
parent: 6d1b7f28c8987be16b05e8c68f7f50eb357b7cc5
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Jan 9 14:34:14 EST 2016
Finish labels in engine/namingscreen.asm
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -2799,7 +2799,7 @@
call ResetDamage
- ld hl, wPlayerMoveStruct + MOVE_POWER
+ ld hl, wPlayerMoveStructPower
ld a, [hli]
and a
ld d, a
@@ -2946,7 +2946,7 @@
ld a, [hBattleTurn]
and a
jr nz, .enemy
- ld a, [wPlayerMoveStruct + MOVE_TYPE]
+ ld a, [wPlayerMoveStructType]
cp SPECIAL
; special
ld a, [PlayerSAtkLevel]
@@ -2960,7 +2960,7 @@
jr .end
.enemy
- ld a, [wEnemyMoveStruct + MOVE_TYPE]
+ ld a, [wEnemyMoveStructType]
cp SPECIAL
; special
ld a, [EnemySAtkLevel]
@@ -3063,8 +3063,8 @@
call ResetDamage
; No damage dealt with 0 power.
- ld hl, wEnemyMoveStruct + MOVE_POWER
- ld a, [hli] ; hl = wEnemyMoveStruct + MOVE_TYPE
+ ld hl, wEnemyMoveStructPower
+ ld a, [hli] ; hl = wEnemyMoveStructType
ld d, a
and a
ret z
@@ -3211,7 +3211,7 @@
ld a, [hl]
ld e, a
pop bc
- ld a, [wPlayerMoveStruct + MOVE_POWER]
+ ld a, [wPlayerMoveStructPower]
ld d, a
ret
@@ -3317,7 +3317,7 @@
ld a, [hl]
ld e, a
pop bc
- ld a, [wEnemyMoveStruct + MOVE_POWER]
+ ld a, [wEnemyMoveStructPower]
ld d, a
ret
@@ -3401,7 +3401,7 @@
ld l, [hl]
ld h, a
call TruncateHL_BC
- ld d, $28
+ ld d, 40
pop af
ld e, a
ret
@@ -3806,7 +3806,7 @@
ld a, [hl]
jr nz, .notPlayersTurn
- ld hl, wPlayerMoveStruct + MOVE_POWER
+ ld hl, wPlayerMoveStructPower
ld [hl], a
push hl
call PlayerAttackDamage
@@ -3813,7 +3813,7 @@
jr .notEnemysTurn
.notPlayersTurn
- ld hl, wEnemyMoveStruct + MOVE_POWER
+ ld hl, wEnemyMoveStructPower
ld [hl], a
push hl
call EnemyAttackDamage
@@ -6521,8 +6521,8 @@
ld [de], a
inc de
ld [de], a
- ld [wPlayerMoveStruct + MOVE_EFFECT], a
- ld [wEnemyMoveStruct + MOVE_EFFECT], a
+ ld [wPlayerMoveStructEffect], a
+ ld [wEnemyMoveStructEffect], a
call BattleRandom
and 1
inc a
@@ -6752,7 +6752,7 @@
inc a
ld [wForcedSwitch], a
call SetBattleDraw
- ld a, [wPlayerMoveStruct + MOVE_ANIM]
+ ld a, [wPlayerMoveStructAnimation]
jp .succeed
.trainer
@@ -6845,7 +6845,7 @@
inc a
ld [wForcedSwitch], a
call SetBattleDraw
- ld a, [wEnemyMoveStruct + MOVE_ANIM]
+ ld a, [wEnemyMoveStructAnimation]
jr .succeed
.vs_trainer
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -1173,7 +1173,7 @@
ret
.a
- call Function12185
+ call NamingScreen_PressedA_GetCursorCommand
cp $1
jr z, .select
cp $2
@@ -1181,7 +1181,7 @@
cp $3
jr z, .finished
call NamingScreen_GetLastCharacter
- call Function121ac
+ call MailComposition_TryAddLastCharacter
jr c, .start
ld hl, wNamingScreenCurrNameLength
ld a, [hl]
@@ -1242,8 +1242,8 @@
ret
; called from engine/sprite_anims.asm
-Function120c1: ; 120c1 (4:60c1)
- call Function1210c
+ComposeMail_AnimateCursor: ; 120c1 (4:60c1)
+ call .GetDPad
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
@@ -1253,12 +1253,12 @@
add hl, bc
ld [hl], e
cp $5
- ld de, Unknown_120f8
+ ld de, .LetterEntries
ld a, 0
- jr nz, .asm_120df
- ld de, Unknown_12102
+ jr nz, .got_pointer
+ ld de, .CaseDelEnd
ld a, 1
-.asm_120df
+.got_pointer
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
add [hl]
@@ -1278,14 +1278,14 @@
; 120f8 (4:60f8)
-Unknown_120f8: ; 120f8
+.LetterEntries: ; 120f8
db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90
-Unknown_12102: ; 12102
+.CaseDelEnd: ; 12102
db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
; 1210c
-Function1210c: ; 1210c (4:610c)
+.GetDPad: ; 1210c (4:610c)
ld hl, hJoyLast
ld a, [hl]
and D_UP
@@ -1302,26 +1302,26 @@
ret
.right
- call Function1218b
+ call ComposeMail_GetCursorPosition
and a
- jr nz, .asm_12138
+ jr nz, .case_del_done_right
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
cp $9
- jr nc, .asm_12135
+ jr nc, .wrap_around_letter_right
inc [hl]
ret
-.asm_12135
+.wrap_around_letter_right
ld [hl], $0
ret
-.asm_12138
+.case_del_done_right
cp $3
- jr nz, .asm_1213d
+ jr nz, .wrap_around_command_right
xor a
-.asm_1213d
+.wrap_around_command_right
ld e, a
add a
add e
@@ -1331,26 +1331,26 @@
ret
.left
- call Function1218b
+ call ComposeMail_GetCursorPosition
and a
- jr nz, .asm_12159
+ jr nz, .caps_del_done_left
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
and a
- jr z, .asm_12156
+ jr z, .wrap_around_letter_left
dec [hl]
ret
-.asm_12156
+.wrap_around_letter_left
ld [hl], $9
ret
-.asm_12159
+.caps_del_done_left
cp $1
- jr nz, .asm_1215f
+ jr nz, .wrap_around_command_left
ld a, $4
-.asm_1215f
+.wrap_around_command_left
rept 2
dec a
endr
@@ -1367,11 +1367,11 @@
add hl, bc
ld a, [hl]
cp $5
- jr nc, .asm_12175
+ jr nc, .wrap_around_down
inc [hl]
ret
-.asm_12175
+.wrap_around_down
ld [hl], $0
ret
@@ -1380,54 +1380,54 @@
add hl, bc
ld a, [hl]
and a
- jr z, .asm_12182
+ jr z, .wrap_around_up
dec [hl]
ret
-.asm_12182
+.wrap_around_up
ld [hl], $5
ret
-Function12185: ; 12185 (4:6185)
+NamingScreen_PressedA_GetCursorCommand: ; 12185 (4:6185)
ld hl, wNamingScreenCursorObjectPointer
ld c, [hl]
inc hl
ld b, [hl]
-Function1218b: ; 1218b (4:618b)
+ComposeMail_GetCursorPosition: ; 1218b (4:618b)
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
cp $5
- jr nz, .asm_121aa
+ jr nz, .letter
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
cp $3
- jr c, .asm_121a4
+ jr c, .case
cp $6
- jr c, .asm_121a7
+ jr c, .del
ld a, $3
ret
-.asm_121a4
+.case
ld a, $1
ret
-.asm_121a7
+.del
ld a, $2
ret
-.asm_121aa
+.letter
xor a
ret
-Function121ac: ; 121ac (4:61ac)
+MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
ld a, [wNamingScreenLastCharacter]
jp MailComposition_TryAddCharacter
; 121b2 (4:61b2)
-Function121b2: ; unreferenced
+; XXX
ld a, [wNamingScreenCurrNameLength]
and a
ret z
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -222,7 +222,7 @@
ret
.twelve: ; 8d373 (23:5373)
- callab Function120c1
+ callab ComposeMail_AnimateCursor
ret
.GameFreakLogo: ; 8d37a (23:537a)
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -218,19 +218,19 @@
.lastmoveopp db ENEMY_LAST_MOVE, PLAYER_LAST_MOVE
.vars
- dw PlayerSubStatus1, EnemySubStatus1
- dw PlayerSubStatus2, EnemySubStatus2
- dw PlayerSubStatus3, EnemySubStatus3
- dw PlayerSubStatus4, EnemySubStatus4
- dw PlayerSubStatus5, EnemySubStatus5
- dw BattleMonStatus, EnemyMonStatus
- dw wPlayerMoveStruct + MOVE_ANIM, wEnemyMoveStruct + MOVE_ANIM
- dw wPlayerMoveStruct + MOVE_EFFECT, wEnemyMoveStruct + MOVE_EFFECT
- dw wPlayerMoveStruct + MOVE_POWER, wEnemyMoveStruct + MOVE_POWER
- dw wPlayerMoveStruct + MOVE_TYPE, wEnemyMoveStruct + MOVE_TYPE
- dw CurPlayerMove, CurEnemyMove
- dw LastEnemyCounterMove, LastPlayerCounterMove
- dw LastPlayerMove, LastEnemyMove
+ dw PlayerSubStatus1, EnemySubStatus1
+ dw PlayerSubStatus2, EnemySubStatus2
+ dw PlayerSubStatus3, EnemySubStatus3
+ dw PlayerSubStatus4, EnemySubStatus4
+ dw PlayerSubStatus5, EnemySubStatus5
+ dw BattleMonStatus, EnemyMonStatus
+ dw wPlayerMoveStructAnimation, wEnemyMoveStructAnimation
+ dw wPlayerMoveStructEffect, wEnemyMoveStructEffect
+ dw wPlayerMoveStructPower, wEnemyMoveStructPower
+ dw wPlayerMoveStructType, wEnemyMoveStructType
+ dw CurPlayerMove, CurEnemyMove
+ dw LastEnemyCounterMove, LastPlayerCounterMove
+ dw LastPlayerMove, LastEnemyMove
; 3a90
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -222,3 +222,13 @@
\1CaughtData:: ds 1 ; wc701 | wc733
\1End::
ENDM
+
+move_struct: MACRO
+\1Animation:: ds 1
+\1Effect:: ds 1
+\1Power:: ds 1
+\1Type:: ds 1
+\1Accuracy:: ds 1
+\1PP:: ds 1
+\1EffectChance:: ds 1
+endm
--- a/wram.asm
+++ b/wram.asm
@@ -374,9 +374,9 @@
wBattle::
wc608::
-wEnemyMoveStruct:: ds MOVE_LENGTH ; c608
+wEnemyMoveStruct:: move_struct wEnemyMoveStruct
wc60f::
-wPlayerMoveStruct:: ds MOVE_LENGTH ; c60f
+wPlayerMoveStruct:: move_struct wPlayerMoveStruct
wc616::
ds -4
wc612:: ds 4