ref: 9739c26ed7fa89492cbc8609445d292ced48ee65
parent: 9c93ef3bff67f0f3ded2856b612ec632f22b2d46
author: xCrystal <rgr.crystal@gmail.com>
date: Thu Apr 9 09:05:57 EDT 2015
money won and trainer pic constants
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1023,10 +1023,11 @@
ld c, $28
call DelayFrames
call PrintEndBattleText
+; win money
ld hl, MoneyForWinningText
call PrintText
ld de, wPlayerMoney + 2
- ld hl, wd07b
+ ld hl, wAmountMoneyWon + 2
ld c, $3
predef_jump AddBCDPredef
@@ -6959,9 +6960,9 @@
_LoadTrainerPic: ; 3f04b (f:704b)
; wd033-wd034 contain pointer to pic
- ld a, [wd033]
+ ld a, [wTrainerPicPointer] ; wd033
ld e, a
- ld a, [wd034]
+ ld a, [wTrainerPicPointer + 1] ; wd034
ld d, a ; de contains pointer to trainer pic
ld a, [wLinkState]
and a
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -141,9 +141,10 @@
.GiveStarterMove
ld a,b
ld [wEnemyMon6Moves + 2],a
-.FinishUp ; XXX this needs documenting
- xor a ; clear D079-D07B
- ld de,wd079
+.FinishUp
+; clear wAmountMoneyWon addresses
+ xor a
+ ld de,wAmountMoneyWon
ld [de],a
inc de
ld [de],a
@@ -152,8 +153,9 @@
ld a,[W_CURENEMYLVL]
ld b,a
.LastLoop
+; update wAmountMoneyWon addresses (money to win) based on enemy's level
ld hl,wd047
- ld c,2
+ ld c,2 ; wAmountMoneyWon is a 3-byte number
push bc
predef AddBCDPredef
pop bc
@@ -160,5 +162,5 @@
inc de
inc de
dec b
- jr nz,.LastLoop
+ jr nz,.LastLoop ; repeat W_CURENEMYLVL times
ret
\ No newline at end of file
--- a/home.asm
+++ b/home.asm
@@ -2908,7 +2908,7 @@
ld hl, TrainerPicAndMoneyPointers
ld bc, $5
call AddNTimes
- ld de, wd033
+ ld de, wTrainerPicPointer
ld a, [hli]
ld [de], a
inc de
@@ -2922,7 +2922,7 @@
ld [de], a
jp BankswitchBack
.linkBattle
- ld hl, wd033
+ ld hl, wTrainerPicPointer
ld de, RedPicFront
ld [hl], e
inc hl
--- a/text.asm
+++ b/text.asm
@@ -1114,7 +1114,7 @@
_MoneyForWinningText:: ; 896dd (22:56dd)
text $52, " got ¥@"
- TX_BCD wd079, $c3
+ TX_BCD wAmountMoneyWon, $c3
db $0
line "for winning!"
prompt
--- a/wram.asm
+++ b/wram.asm
@@ -949,8 +949,9 @@
ds 1
-wd033:: ds 1
-wd034:: ds 2
+wTrainerPicPointer:: ; wd033
+ ds 2
+ ds 1
wd036:: ds 16
wd046:: ds 1
wd047:: ds 1
@@ -1103,15 +1104,16 @@
wUnknownSerialCounter2:: ; d075
; 2 bytes
-ds 4
+ ds 4
wEscapedFromBattle::
; non-zero when an item or move that allows escape from battle was used
ds 1
-wd079:: ds 1
+wd079::
+wAmountMoneyWon:: ds 1 ; wd079 - wd07b
wd07a:: ds 1
-wd07b:: ds 1
+ ds 1
W_ANIMATIONID:: ; d07c
; ID number of the current battle animation