Use constants for move struct positioning.

This eliminates the need for arbitrary move labels like Move2 and Move1 that don't have anything to do with their respective moves.
This commit is contained in:
yenatch
2014-06-10 23:23:55 -07:00
parent 86c1e0feea
commit 23f9b5d21e
7 changed files with 29 additions and 34 deletions

View File

@@ -1658,8 +1658,8 @@ AIScoring_Conversion2: ; 38d98
push hl push hl
dec a dec a
ld hl, Moves + PlayerMoveType - PlayerMoveStruct ld hl, Moves + MOVE_TYPE
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
@@ -3314,7 +3314,7 @@ AIGetEnemyMove: ; 39508
push bc push bc
dec a dec a
ld hl, Moves ld hl, Moves
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld de, EnemyMoveStruct ld de, EnemyMoveStruct

View File

@@ -915,7 +915,7 @@ GetMoveEffect: ; 3c5ec
ld a, b ld a, b
dec a dec a
ld hl, Moves + MOVE_EFFECT ld hl, Moves + MOVE_EFFECT
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte
@@ -3436,7 +3436,7 @@ Function3d5d7: ; 3d5d7
push bc push bc
dec a dec a
ld hl, Moves + MOVE_ANIM ld hl, Moves + MOVE_ANIM
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld de, EnemyMoveAnimation ld de, EnemyMoveAnimation
ld a, BANK(Moves) ld a, BANK(Moves)
@@ -8580,7 +8580,7 @@ Function3f662: ; 3f662
push hl push hl
dec a dec a
ld hl, Moves + MOVE_PP ld hl, Moves + MOVE_PP
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte

View File

@@ -1675,7 +1675,7 @@ Function3484e: ; 3484e
jr z, .asm_3489f ; 0x34863 $3a jr z, .asm_3489f ; 0x34863 $3a
push hl push hl
dec a dec a
ld hl, Moves + PlayerMovePower - PlayerMoveStruct ld hl, Moves + MOVE_POWER
call GetMoveAttr call GetMoveAttr
and a and a
jr z, .asm_3489b ; 0x3486e $2b jr z, .asm_3489b ; 0x3486e $2b
@@ -1761,7 +1761,7 @@ Function348de: ; 348de
inc de inc de
dec a dec a
ld hl, Moves + PlayerMovePower - PlayerMoveStruct ld hl, Moves + MOVE_POWER
call GetMoveAttr call GetMoveAttr
and a and a
jr z, .loop jr z, .loop
@@ -2024,7 +2024,7 @@ Function34a2a: ; 34a2a
call GetBaseData call GetBaseData
ld a, [LastEnemyCounterMove] ld a, [LastEnemyCounterMove]
dec a dec a
ld hl, Moves + PlayerMovePower - PlayerMoveStruct ld hl, Moves + MOVE_POWER
call GetMoveAttr call GetMoveAttr
and a and a
jr z, .asm_34a77 jr z, .asm_34a77
@@ -2114,7 +2114,7 @@ Function34aa7: ; 34aa7
jr z, .asm_34aef jr z, .asm_34aef
dec a dec a
ld hl, Moves + PlayerMovePower - PlayerMoveStruct ld hl, Moves + MOVE_POWER
call GetMoveAttr call GetMoveAttr
and a and a
jr z, .asm_34ae9 jr z, .asm_34ae9
@@ -2207,7 +2207,7 @@ Function34b20: ; 34b20
jr z, .asm_34b4a jr z, .asm_34b4a
dec a dec a
ld hl, Moves + PlayerMovePower - PlayerMoveStruct ld hl, Moves + MOVE_POWER
call GetMoveAttr call GetMoveAttr
and a and a
jr z, .asm_34b4a jr z, .asm_34b4a
@@ -4779,7 +4779,7 @@ BattleCommand44: ; 359e6
jr z, .asm_35a50 ; 359fd $51 jr z, .asm_35a50 ; 359fd $51
push hl push hl
dec a dec a
ld hl, Moves + PlayerMoveType - PlayerMoveStruct ld hl, Moves + MOVE_TYPE
call GetMoveAttr call GetMoveAttr
ld d, a ld d, a
pop hl pop hl
@@ -4904,10 +4904,10 @@ BattleCommand46: ; 35a74
push bc push bc
push hl push hl
dec a dec a
ld hl, Moves + PlayerMovePP - PlayerMoveStruct ld hl, Moves + MOVE_PP
call GetMoveAttr call GetMoveAttr
pop hl pop hl
ld bc, $0006 ld bc, BattleMonPP - BattleMonMoves
add hl, bc add hl, bc
ld [hl], a ld [hl], a
pop bc pop bc
@@ -8653,7 +8653,7 @@ BattleCommand1f: ; 3707f
push hl push hl
push bc push bc
dec a dec a
ld hl, Moves + PlayerMoveType - PlayerMoveStruct ld hl, Moves + MOVE_TYPE
call GetMoveAttr call GetMoveAttr
ld [de], a ld [de], a
inc de inc de
@@ -10656,7 +10656,7 @@ SkipToBattleCommand: ; 37e8c
GetMoveAttr: ; 37ea1 GetMoveAttr: ; 37ea1
; Assuming hl = Moves + x, return attribute x of move a. ; Assuming hl = Moves + x, return attribute x of move a.
push bc push bc
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
call GetMoveByte call GetMoveByte
pop bc pop bc
@@ -10667,7 +10667,7 @@ GetMoveAttr: ; 37ea1
GetMoveData: ; 37ead GetMoveData: ; 37ead
; Copy move struct a to de. ; Copy move struct a to de.
ld hl, Moves ld hl, Moves
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, Bank(Moves) ld a, Bank(Moves)
jp FarCopyBytes jp FarCopyBytes

View File

@@ -1,22 +1,17 @@
Moves: ; 41afb Moves: ; 41afb
; Characteristics of each move.
; Characteristics of each move
; animation, effect, power, type, accuracy, PP, effect chance
move: MACRO move: MACRO
db \1 ; animation db \1 ; animation
db \2 ; effect db \2 ; effect
db \3 ; power db \3 ; power
db \4 ; type db \4 ; type
db \5 * $ff / 100 ; accuracy (percent) db \5 percent ; accuracy
db \6 ; pp db \6 ; pp
db \7 * $ff / 100 ; effect chance (percent) db \7 percent ; effect chance
ENDM ENDM
Move1:
move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0 move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0
Move2:
move KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, 100, 25, 0 move KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, 100, 25, 0
move DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, 85, 10, 0 move DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, 85, 10, 0
move COMET_PUNCH, EFFECT_MULTI_HIT, 18, NORMAL, 85, 15, 0 move COMET_PUNCH, EFFECT_MULTI_HIT, 18, NORMAL, 85, 15, 0

View File

@@ -51,8 +51,8 @@ SpecialDratini: ; 0x8b170
; get the PP of the new move ; get the PP of the new move
dec a dec a
ld hl, Moves + PlayerMovePP - PlayerMoveStruct ld hl, Moves + MOVE_PP
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte

View File

@@ -5316,7 +5316,7 @@ Function6520: ; 6520
push de push de
dec a dec a
ld hl, Moves + MOVE_PP ld hl, Moves + MOVE_PP
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte
@@ -12637,7 +12637,7 @@ FillPP: ; da6d
push de push de
push bc push bc
ld hl, Moves ld hl, Moves
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld de, StringBuffer1 ld de, StringBuffer1
ld a, BANK(Moves) ld a, BANK(Moves)
@@ -20861,7 +20861,7 @@ Function13256: ; 13256
ld a, [CurSpecies] ld a, [CurSpecies]
dec a dec a
ld hl, Moves + MOVE_POWER ld hl, Moves + MOVE_POWER
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte
@@ -44611,7 +44611,7 @@ Function39806: ; 39806
push bc push bc
dec a dec a
ld hl, Moves + MOVE_PP ld hl, Moves + MOVE_PP
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte
@@ -48143,7 +48143,7 @@ FillMoves: ; 424e1
push hl push hl
dec a dec a
ld hl, Moves + MOVE_PP ld hl, Moves + MOVE_PP
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
call AddNTimes call AddNTimes
ld a, BANK(Moves) ld a, BANK(Moves)
call GetFarByte call GetFarByte

View File

@@ -42,13 +42,13 @@ PrintMoveType: ; 5093a
push hl push hl
ld a, b ld a, b
dec a dec a
ld bc, Move2 - Move1 ld bc, MOVE_LENGTH
ld hl, Moves ld hl, Moves
call AddNTimes call AddNTimes
ld de, StringBuffer1 ld de, StringBuffer1
ld a, BANK(Moves) ld a, BANK(Moves)
call FarCopyBytes call FarCopyBytes
ld a, [StringBuffer1 + PlayerMoveType - PlayerMoveStruct] ld a, [StringBuffer1 + MOVE_TYPE]
pop hl pop hl
ld b, a ld b, a