Consolidate NUM_MOVES usage and monster struct labels.

There turned out to be a lot of instances of NUM_MOVES.
This commit is contained in:
yenatch
2014-06-10 23:08:07 -07:00
parent 0d682e076a
commit 86c1e0feea
6 changed files with 655 additions and 687 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,18 @@
; strings ; strings
PLAYER_NAME_LENGTH EQU 8 PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11 PKMN_NAME_LENGTH EQU 11
MOVE_NAME_LENGTH EQU 13
NAME_LENGTH EQU 11 NAME_LENGTH EQU 11
LV_CHAR EQU $6e LV_CHAR EQU $6e
; GetName types
PKMN_NAME EQU 1
MOVE_NAME EQU 2
ITEM_NAME EQU 4
PARTY_OT_NAME EQU 5
ENEMY_OT_NAME EQU 6
TRAINER_NAME EQU 7
; boxes ; boxes
NUM_BOXES EQU 14 NUM_BOXES EQU 14
@@ -22,6 +31,7 @@ PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_START_BATTLE EQU $16 PREDEF_START_BATTLE EQU $16
PREDEF_FILL_IN_EXP_BAR EQU $17 PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B PREDEF_FILLMOVES EQU $1B
PREDEF_LIST_MOVES EQU $20
PREDEF_GET_GENDER EQU $24 PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25 PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26 PREDEF_DRAW_PLAYER_HP EQU $26

View File

@@ -366,7 +366,7 @@ ParkBall: ; e8a2
.asm_e98e .asm_e98e
ld b, a ld b, a
ld [MagikarpLength], a ld [Buffer1], a
call Random call Random
cp b cp b
@@ -478,13 +478,13 @@ ParkBall: ; e8a2
bit 3, [hl] bit 3, [hl]
jr nz, .asm_ea67 jr nz, .asm_ea67
ld hl, $c735 ld hl, $c735
ld de, EnemyMonMove1 ld de, EnemyMonMoves
ld bc, $0004 ld bc, NUM_MOVES
call CopyBytes call CopyBytes
ld hl, $c739 ld hl, $c739
ld de, EnemyMonPPMove1 ld de, EnemyMonPP
ld bc, $0004 ld bc, NUM_MOVES
call CopyBytes call CopyBytes
.asm_ea67 .asm_ea67
@@ -2633,11 +2633,11 @@ Functionf652: ; f652
.asm_f677 .asm_f677
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMon1Move1 ld hl, PartyMon1Moves
ld bc, $0030 ld bc, PartyMon2 - PartyMon1
call AddNTimes call AddNTimes
ld de, BattleMonMove1 ld de, BattleMonMoves
ld b, $4 ld b, NUM_MOVES
.asm_f688 .asm_f688
ld a, [de] ld a, [de]
and a and a
@@ -2647,13 +2647,10 @@ Functionf652: ; f652
push hl push hl
push de push de
push bc push bc
rept NUM_MOVES + 2 ; BattleMonPP - BattleMonMoves
inc de inc de
inc de endr
inc de ld bc, PartyMon1PP - PartyMon1Moves
inc de
inc de
inc de
ld bc, $0015
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [de], a ld [de], a
@@ -2682,15 +2679,16 @@ Functionf6af: ; f6af
ld hl, $cfa9 ld hl, $cfa9
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld b, $4 ld b, NUM_MOVES
.asm_f6b7 .asm_f6b7
push bc push bc
ld hl, PartyMon1Move1 ld hl, PartyMon1Moves
ld bc, $0030 ld bc, PartyMon2 - PartyMon1
call Functionf963 call Functionf963
ld a, [hl] ld a, [hl]
and a and a
jr z, .asm_f6ce jr z, .asm_f6ce
call Functionf6e8 call Functionf6e8
jr z, .asm_f6ce jr z, .asm_f6ce
ld hl, $cfaa ld hl, $cfaa
@@ -2721,7 +2719,7 @@ Functionf6e8: ; f6e8
ld [MonType], a ld [MonType], a
call Functionf8ec call Functionf8ec
ld hl, PartyMon1PP ld hl, PartyMon1PP
ld bc, $0030 ld bc, PartyMon2 - PartyMon1
call Functionf963 call Functionf963
ld a, [$d265] ld a, [$d265]
ld b, a ld b, a
@@ -2739,6 +2737,7 @@ Functionf6e8: ; f6e8
ld c, 5 ld c, 5
cp MYSTERYBERRY cp MYSTERYBERRY
jr z, .asm_f715 jr z, .asm_f715
ld c, 10 ld c, 10
.asm_f715 .asm_f715
@@ -2985,7 +2984,7 @@ WontHaveAnyEffect_NotUsedMessage: ; f7ca
ld hl, WontHaveAnyEffectText ld hl, WontHaveAnyEffectText
call PrintText call PrintText
; Item wasn't used. ; Item wasn't used.
ld a, $2 ld a, $2
ld [$d0ec], a ld [$d0ec], a
ret ret
@@ -3000,7 +2999,7 @@ Ball_BoxIsFullMessage: ; f7dc
ld hl, Ball_BoxIsFullText ld hl, Ball_BoxIsFullText
call PrintText call PrintText
; Item wasn't used. ; Item wasn't used.
ld a, $2 ld a, $2
ld [$d0ec], a ld [$d0ec], a
ret ret
@@ -3116,21 +3115,21 @@ GotOffTheItemText: ; 0xf847
Functionf84c: ; f84c Functionf84c: ; f84c
ld a, $2 ld a, PartyMon1Moves - PartyMon1
call GetPartyParamLocation call GetPartyParamLocation
push hl push hl
ld de, MagikarpLength ld de, Buffer1
ld a, $5 ld a, PREDEF_FILLPP
call Predef call Predef
pop hl pop hl
ld bc, $0015 ld bc, PartyMon1PP - PartyMon1Moves
add hl, bc add hl, bc
ld de, MagikarpLength ld de, Buffer1
ld b, $0 ld b, 0
.asm_f864 .asm_f864
inc b inc b
ld a, b ld a, b
cp $5 cp NUM_MOVES + 1
ret z ret z
ld a, [$d265] ld a, [$d265]
dec a dec a
@@ -3157,14 +3156,14 @@ Functionf84c: ; f84c
Functionf881: ; f881 Functionf881: ; f881
push bc push bc
ld a, [de] ld a, [de]
ld [$ffb6], a ld [hDividend + 3], a
xor a xor a
ld [hProduct], a ld [hDividend], a
ld [hMultiplicand], a ld [hDividend + 1], a
ld [$ffb5], a ld [hDividend + 2], a
ld a, $5 ld a, 5
ld [hMultiplier], a ld [hDivisor], a
ld b, $4 ld b, 4
call Divide call Divide
ld a, [hl] ld a, [hl]
ld b, a ld b, a
@@ -3197,16 +3196,16 @@ Functionf881: ; f881
; f8b9 ; f8b9
Functionf8b9: ; f8b9 Functionf8b9: ; f8b9
ld a, $17 ld a, PartyMon1PP - PartyMon1
call GetPartyParamLocation call GetPartyParamLocation
push hl push hl
ld a, $2 ld a, PartyMon1Moves - PartyMon1
call GetPartyParamLocation call GetPartyParamLocation
pop de pop de
xor a xor a
ld [$cfa9], a ld [$cfa9], a
ld [MonType], a ld [MonType], a
ld c, $4 ld c, NUM_MOVES
.asm_f8ce .asm_f8ce
ld a, [hli] ld a, [hli]
and a and a
@@ -3265,21 +3264,21 @@ Functionf8ec: ; f8ec
ld a, [hl] ld a, [hl]
dec a dec a
push hl push hl
ld hl, $5b00 ld hl, Moves + MOVE_PP
ld bc, $0007 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, $10 ld a, BANK(Moves)
call GetFarByte call GetFarByte
ld b, a ld b, a
ld de, StringBuffer1 ld de, StringBuffer1
ld [de], a ld [de], a
pop hl pop hl
push bc push bc
ld bc, $0015 ld bc, PartyMon1PP - PartyMon1Moves
ld a, [MonType] ld a, [MonType]
cp WILDMON cp WILDMON
jr nz, .asm_f942 jr nz, .asm_f942
ld bc, $0006 ld bc, EnemyMonPP - EnemyMonMoves
.asm_f942 .asm_f942
add hl, bc add hl, bc
@@ -3310,7 +3309,7 @@ Functionf963: ; f963
Functionf969: ; f969 Functionf969: ; f969
ld a, [$cfa9] ld a, [$cfa9]
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ret ret
; f971 ; f971

402
main.asm

File diff suppressed because it is too large Load Diff

143
wram.asm
View File

@@ -6,11 +6,7 @@ party_struct: MACRO
\1Species:: db \1Species:: db
\1Item:: db \1Item:: db
\1Moves:: \1Moves:: ds NUM_MOVES
\1Move1:: db
\1Move2:: db
\1Move3:: db
\1Move4:: db
\1ID:: dw \1ID:: dw
\1Exp:: ds 3 ; Big endian \1Exp:: ds 3 ; Big endian
@@ -25,11 +21,7 @@ party_struct: MACRO
\1AtkDefDV:: db \1AtkDefDV:: db
\1SpdSpcDV:: db \1SpdSpcDV:: db
\1PP:: \1PP:: ds NUM_MOVES
\1PPMove1:: db
\1PPMove2:: db
\1PPMove3:: db
\1PPMove4:: db
\1Happiness:: db \1Happiness:: db
\1PokerusStatus:: db \1PokerusStatus:: db
@@ -483,15 +475,8 @@ BattleMonSpecies:: ; c62c
BattleMonItem:: ; c62d BattleMonItem:: ; c62d
ds 1 ds 1
BattleMonMoves:: BattleMonMoves:: ; c62e
BattleMonMove1:: ; c62e ds NUM_MOVES
ds 1
BattleMonMove2:: ; c62f
ds 1
BattleMonMove3:: ; c630
ds 1
BattleMonMove4:: ; c631
ds 1
BattleMonDVs:: BattleMonDVs::
BattleMonAtkDefDV:: ; c632 BattleMonAtkDefDV:: ; c632
@@ -499,15 +484,8 @@ BattleMonAtkDefDV:: ; c632
BattleMonSpdSpclDV:: ; c633 BattleMonSpdSpclDV:: ; c633
ds 1 ds 1
BattleMonPP:: BattleMonPP:: ; c634
BattleMonPPMove1:: ; c634 ds NUM_MOVES
ds 1
BattleMonPPMove2:: ; c635
ds 1
BattleMonPPMove3:: ; c636
ds 1
BattleMonPPMove4:: ; c637
ds 1
BattleMonHappiness:: ; c638 BattleMonHappiness:: ; c638
ds 1 ds 1
@@ -736,7 +714,14 @@ EnemyTurnsTaken:: ; c6dc
PlayerTurnsTaken:: ; c6dd PlayerTurnsTaken:: ; c6dd
ds 1 ds 1
ds 5 ds 1
PlayerSubstituteHP:: ; c6df
ds 1
EnemySubstituteHP:: ; c6e0
ds 1
ds 2
CurPlayerMove:: ; c6e3 CurPlayerMove:: ; c6e3
ds 1 ds 1
@@ -788,15 +773,17 @@ EnemyScreens:: ; c700
; see PlayerScreens ; see PlayerScreens
ds 1 ds 1
PlayerSafeguardCount:: ; c701
ds 1 ds 1
PlayerLightScreenCount:: ; c702 PlayerLightScreenCount:: ; c702
ds 1 ds 1
PlayerReflectCount:: ; c703 PlayerReflectCount:: ; c703
ds 1 ds 1
ds 2 ds 1
EnemySafeguardCount:: ; c705
ds 1
EnemyLightScreenCount:: ; c706 EnemyLightScreenCount:: ; c706
ds 1 ds 1
EnemyReflectCount:: ; c707 EnemyReflectCount:: ; c707
@@ -1083,70 +1070,7 @@ CurPartyMon:: ; d109
ds 4 ds 4
TempMon:: TempMon::
TempMonSpecies:: ; d10e party_struct TempMon
ds 1
TempMonItem:: ; d10f
ds 1
TempMonMoves:: ; d110
TempMonMove1:: ; d110
ds 1
TempMonMove2:: ; d111
ds 1
TempMonMove3:: ; d112
ds 1
TempMonMove4:: ; d113
ds 1
TempMonID:: ; d114
ds 2
TempMonExp:: ; d116
ds 3
TempMonHPExp:: ; d119
ds 2
TempMonAtkExp:: ; d11b
ds 2
TempMonDefExp:: ; d11d
ds 2
TempMonSpdExp:: ; d11f
ds 2
TempMonSpclExp:: ; d121
ds 2
TempMonDVs:: ; d123
; hp = %1000 for each dv
ds 1 ; atk/def
ds 1 ; spd/spc
TempMonPP:: ; d125
ds 4
TempMonHappiness:: ; d129
ds 1
TempMonPokerusStatus:: ; d12a
ds 1
TempMonCaughtData:: ; d12b
TempMonCaughtTime:: ; d12b
TempMonCaughtLevel:: ; d12b
ds 1
TempMonCaughtGender:: ; d12c
TempMonCaughtLocation:: ; d12c
ds 1
TempMonLevel:: ; d12d
ds 1
TempMonStatus:: ; d12e
ds 1
; d12f
ds 1
TempMonHP:: ; d130
ds 2
TempMonMaxHP:: ; d132
ds 2
TempMonAtk:: ; d134
ds 2
TempMonDef:: ; d136
ds 2
TempMonSpd:: ; d138
ds 2
TempMonSpclAtk:: ; d13a
ds 2
TempMonSpclDef:: ; d13c
ds 2
TempMonEnd:: ; d13e TempMonEnd:: ; d13e
ds 3 ds 3
@@ -1316,15 +1240,8 @@ EnemyMonSpecies:: ; d206
EnemyMonItem:: ; d207 EnemyMonItem:: ; d207
ds 1 ds 1
EnemyMonMoves:: EnemyMonMoves:: ; d208
EnemyMonMove1:: ; d208 ds NUM_MOVES
ds 1
EnemyMonMove2:: ; d209
ds 1
EnemyMonMove3:: ; d20a
ds 1
EnemyMonMove4:: ; d20b
ds 1
EnemyMonMovesEnd:: EnemyMonMovesEnd::
EnemyMonDVs:: EnemyMonDVs::
@@ -1333,15 +1250,8 @@ EnemyMonAtkDefDV:: ; d20c
EnemyMonSpdSpclDV:: ; d20d EnemyMonSpdSpclDV:: ; d20d
ds 1 ds 1
EnemyMonPP:: EnemyMonPP:: ; d20e
EnemyMonPPMove1:: ; d20e ds NUM_MOVES
ds 1
EnemyMonPPMove2:: ; d20f
ds 1
EnemyMonPPMove3:: ; d210
ds 1
EnemyMonPPMove4:: ; d211
ds 1
EnemyMonHappiness:: ; d212 EnemyMonHappiness:: ; d212
ds 1 ds 1
@@ -1729,7 +1639,10 @@ StatusFlags2:: ; d84d
Money:: ; d84e Money:: ; d84e
ds 3 ds 3
ds 4 wMomsMoney:: ; d851
ds 3
wMomSavingMoney:: ; d854
ds 1
Coins:: ; d855 Coins:: ; d855
ds 2 ds 2
@@ -2087,7 +2000,7 @@ EggNick:: ; df65
ds 11 ds 11
EggOT:: ; df70 EggOT:: ; df70
ds 11 ds 11
EggStats:: EggMon::
EggSpecies:: ; df7b EggSpecies:: ; df7b
ds 1 ds 1
ds 31 ds 31