mirror of
https://github.com/pret/pokegold.git
synced 2026-09-14 03:25:33 -05:00
engine/variables.asm
This commit is contained in:
@@ -257,40 +257,40 @@ const_value SET const_value + -1
|
||||
|
||||
NUM_POKEMON EQU const_value
|
||||
|
||||
EGG EQU 253
|
||||
EGG EQU 253 ; $FD
|
||||
|
||||
; pokemon structure in RAM
|
||||
MON_SPECIES EQUS "(PartyMon1Species - PartyMon1)"
|
||||
MON_ITEM EQUS "(PartyMon1Item - PartyMon1)"
|
||||
MON_MOVES EQUS "(PartyMon1Moves - PartyMon1)"
|
||||
MON_ID EQUS "(PartyMon1ID - PartyMon1)"
|
||||
MON_EXP EQUS "(PartyMon1Exp - PartyMon1)"
|
||||
MON_STAT_EXP EQUS "(PartyMon1StatExp - PartyMon1)"
|
||||
MON_HP_EXP EQUS "(PartyMon1HPExp - PartyMon1)"
|
||||
MON_ATK_EXP EQUS "(PartyMon1AtkExp - PartyMon1)"
|
||||
MON_DEF_EXP EQUS "(PartyMon1DefExp - PartyMon1)"
|
||||
MON_SPD_EXP EQUS "(PartyMon1SpdExp - PartyMon1)"
|
||||
MON_SPC_EXP EQUS "(PartyMon1SpcExp - PartyMon1)"
|
||||
MON_DVS EQUS "(PartyMon1DVs - PartyMon1)"
|
||||
MON_PP EQUS "(PartyMon1PP - PartyMon1)"
|
||||
MON_HAPPINESS EQUS "(PartyMon1Happiness - PartyMon1)"
|
||||
MON_PKRUS EQUS "(PartyMon1PokerusStatus - PartyMon1)"
|
||||
MON_CAUGHTDATA EQUS "(PartyMon1CaughtData - PartyMon1)"
|
||||
MON_CAUGHTLEVEL EQUS "(PartyMon1CaughtLevel - PartyMon1)"
|
||||
MON_CAUGHTTIME EQUS "(PartyMon1CaughtTime - PartyMon1)"
|
||||
MON_CAUGHTGENDER EQUS "(PartyMon1CaughtGender - PartyMon1)"
|
||||
MON_CAUGHTLOCATION EQUS "(PartyMon1CaughtLocation - PartyMon1)"
|
||||
MON_LEVEL EQUS "(PartyMon1Level - PartyMon1)"
|
||||
MON_STATUS EQUS "(PartyMon1Status - PartyMon1)"
|
||||
MON_HP EQUS "(PartyMon1HP - PartyMon1)"
|
||||
MON_MAXHP EQUS "(PartyMon1MaxHP - PartyMon1)"
|
||||
MON_ATK EQUS "(PartyMon1Attack - PartyMon1)"
|
||||
MON_DEF EQUS "(PartyMon1Defense - PartyMon1)"
|
||||
MON_SPD EQUS "(PartyMon1Speed - PartyMon1)"
|
||||
MON_SAT EQUS "(PartyMon1SpclAtk - PartyMon1)"
|
||||
MON_SDF EQUS "(PartyMon1SpclDef - PartyMon1)"
|
||||
BOXMON_STRUCT_LENGTH EQUS "(PartyMon1End - PartyMon1)"
|
||||
PARTYMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1)"
|
||||
MON_SPECIES EQUS "(wPartyMon1Species - wPartyMon1)"
|
||||
MON_ITEM EQUS "(wPartyMon1Item - wPartyMon1)"
|
||||
MON_MOVES EQUS "(wPartyMon1Moves - wPartyMon1)"
|
||||
MON_ID EQUS "(wPartyMon1ID - wPartyMon1)"
|
||||
MON_EXP EQUS "(wPartyMon1Exp - wPartyMon1)"
|
||||
MON_STAT_EXP EQUS "(wPartyMon1StatExp - wPartyMon1)"
|
||||
MON_HP_EXP EQUS "(wPartyMon1HPExp - wPartyMon1)"
|
||||
MON_ATK_EXP EQUS "(wPartyMon1AtkExp - wPartyMon1)"
|
||||
MON_DEF_EXP EQUS "(wPartyMon1DefExp - wPartyMon1)"
|
||||
MON_SPD_EXP EQUS "(wPartyMon1SpdExp - wPartyMon1)"
|
||||
MON_SPC_EXP EQUS "(wPartyMon1SpcExp - wPartyMon1)"
|
||||
MON_DVS EQUS "(wPartyMon1DVs - wPartyMon1)"
|
||||
MON_PP EQUS "(wPartyMon1PP - wPartyMon1)"
|
||||
MON_HAPPINESS EQUS "(wPartyMon1Happiness - wPartyMon1)"
|
||||
MON_PKRUS EQUS "(wPartyMon1PokerusStatus - wPartyMon1)"
|
||||
MON_CAUGHTDATA EQUS "(wPartyMon1CaughtData - wPartyMon1)"
|
||||
MON_CAUGHTLEVEL EQUS "(wPartyMon1CaughtLevel - wPartyMon1)"
|
||||
MON_CAUGHTTIME EQUS "(wPartyMon1CaughtTime - wPartyMon1)"
|
||||
MON_CAUGHTGENDER EQUS "(wPartyMon1CaughtGender - wPartyMon1)"
|
||||
MON_CAUGHTLOCATION EQUS "(wPartyMon1CaughtLocation - wPartyMon1)"
|
||||
MON_LEVEL EQUS "(wPartyMon1Level - wPartyMon1)"
|
||||
MON_STATUS EQUS "(wPartyMon1Status - wPartyMon1)"
|
||||
MON_HP EQUS "(wPartyMon1HP - wPartyMon1)"
|
||||
MON_MAXHP EQUS "(wPartyMon1MaxHP - wPartyMon1)"
|
||||
MON_ATK EQUS "(wPartyMon1Attack - wPartyMon1)"
|
||||
MON_DEF EQUS "(wPartyMon1Defense - wPartyMon1)"
|
||||
MON_SPD EQUS "(wPartyMon1Speed - wPartyMon1)"
|
||||
MON_SAT EQUS "(wPartyMon1SpclAtk - wPartyMon1)"
|
||||
MON_SDF EQUS "(wPartyMon1SpclDef - wPartyMon1)"
|
||||
BOXMON_STRUCT_LENGTH EQUS "(wPartyMon1End - wPartyMon1)"
|
||||
PARTYMON_STRUCT_LENGTH EQUS "(wPartyMon1StatsEnd - wPartyMon1)"
|
||||
REDMON_STRUCT_LENGTH EQU 44
|
||||
|
||||
const_value SET 1
|
||||
|
||||
@@ -24,13 +24,7 @@ LAST_TALKED EQU -2
|
||||
const VAR_XCOORD ; 12
|
||||
const VAR_YCOORD ; 13
|
||||
const VAR_SPECIALPHONECALL ; 14
|
||||
const VAR_BT_WIN_STREAK ; 15
|
||||
const VAR_KURT_APRICORNS ; 16
|
||||
const VAR_CALLERID ; 17
|
||||
const VAR_BLUECARDBALANCE ; 18
|
||||
const VAR_BUENASPASSWORD ; 19
|
||||
const VAR_KENJI_BREAK ; 1a
|
||||
NUM_VARS EQU const_value ; 1b
|
||||
NUM_VARS EQU const_value ; 15
|
||||
|
||||
RETVAR_STRBUF2 EQU (0 << 6)
|
||||
RETVAR_ADDR_DE EQU (1 << 6)
|
||||
|
||||
@@ -297,9 +297,9 @@ Function5c41: ; 5c41 (1:5c41)
|
||||
|
||||
call Function5d1a
|
||||
|
||||
ld a, BANK(s1_ad6c)
|
||||
ld a, BANK(sBoxCount)
|
||||
call OpenSRAM
|
||||
ld hl, s1_ad6c
|
||||
ld hl, sBoxCount
|
||||
call Function5d15
|
||||
call CloseSRAM
|
||||
|
||||
|
||||
119
engine/variables.asm
Executable file
119
engine/variables.asm
Executable file
@@ -0,0 +1,119 @@
|
||||
GetVarAction_::
|
||||
ld a, c
|
||||
cp NUM_VARS
|
||||
jr c, .valid
|
||||
xor a
|
||||
.valid
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, .VarActionTable
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
ld b, [hl]
|
||||
ld a, b
|
||||
and RETVAR_EXECUTE
|
||||
jr nz, .call
|
||||
ld a, b
|
||||
and RETVAR_ADDR_DE
|
||||
ret nz
|
||||
ld a, [de]
|
||||
jr .loadstringbuffer2
|
||||
|
||||
.call
|
||||
call jp_de
|
||||
ret
|
||||
|
||||
.loadstringbuffer2
|
||||
ld de, wStringBuffer2
|
||||
ld [de], a
|
||||
ret
|
||||
|
||||
.VarActionTable:
|
||||
dwb wStringBuffer2, RETVAR_STRBUF2
|
||||
dwb $da22, RETVAR_STRBUF2
|
||||
dwb .BattleResult, RETVAR_EXECUTE
|
||||
dwb $d119, RETVAR_ADDR_DE
|
||||
dwb $d157, RETVAR_STRBUF2
|
||||
dwb .CountCaughtMons, RETVAR_EXECUTE
|
||||
dwb .CountSeenMons, RETVAR_EXECUTE
|
||||
dwb .CountBadges, RETVAR_EXECUTE
|
||||
dwb $d682, RETVAR_ADDR_DE
|
||||
dwb .PlayerFacing, RETVAR_EXECUTE
|
||||
dwb $ff96, RETVAR_STRBUF2
|
||||
dwb .DayOfWeek, RETVAR_EXECUTE
|
||||
dwb $da00, RETVAR_STRBUF2
|
||||
dwb $da01, RETVAR_STRBUF2
|
||||
dwb .UnownCaught, RETVAR_EXECUTE
|
||||
dwb $d083, RETVAR_STRBUF2
|
||||
dwb .BoxFreeSpace, RETVAR_EXECUTE
|
||||
dwb $d193, RETVAR_STRBUF2
|
||||
dwb $da03, RETVAR_STRBUF2
|
||||
dwb $da02, RETVAR_STRBUF2
|
||||
dwb $d97b, RETVAR_STRBUF2
|
||||
dwb 0, 0
|
||||
|
||||
.CountCaughtMons: ; 41cf
|
||||
; Caught mons.
|
||||
ld hl, wPokedexCaught
|
||||
ld b, $20
|
||||
call CountSetBits
|
||||
ld a, [wd151]
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.CountSeenMons: ; 41dd
|
||||
; Seen mons.
|
||||
ld hl, wPokedexSeen
|
||||
ld b, $20
|
||||
call CountSetBits
|
||||
ld a, [wd151]
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.CountBadges: ; 41eb
|
||||
; Number of owned badges.
|
||||
ld hl, wBadges
|
||||
ld b, 2
|
||||
call CountSetBits
|
||||
ld a, [wd151]
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.PlayerFacing: ; 41f9
|
||||
; The direction the player is facing.
|
||||
ld a, [wPlayerDirection]
|
||||
and $c
|
||||
rrca
|
||||
rrca
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.DayOfWeek: ; 4203
|
||||
; The day of the week.
|
||||
call GetWeekday
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.UnownCaught: ; 4209
|
||||
; Number of unique Unown caught.
|
||||
call CountUnown ; gold: c5ac | silver: c5aa
|
||||
ld a, b
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.BoxFreeSpace: ; 4210
|
||||
; Remaining slots in the current box.
|
||||
ld a, BANK(sBoxCount)
|
||||
call OpenSRAM
|
||||
ld hl, sBoxCount
|
||||
ld a, MONS_PER_BOX
|
||||
sub [hl]
|
||||
ld b, a
|
||||
call CloseSRAM
|
||||
ld a, b
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.BattleResult: ; 4223
|
||||
ld a, [wBattleResult]
|
||||
and $7f
|
||||
jp .loadstringbuffer2
|
||||
; 422b
|
||||
2
home.asm
2
home.asm
@@ -1533,7 +1533,7 @@ PrintWinText::
|
||||
jr continue_battle_end_text
|
||||
|
||||
which_battle_end_text
|
||||
ld a, [wcfe9]
|
||||
ld a, [wBattleResult]
|
||||
ld hl, wWinTextPointer
|
||||
and a
|
||||
jr z, continue_battle_end_text
|
||||
|
||||
39
main.asm
39
main.asm
@@ -233,13 +233,40 @@ InitCGBPals:: ; 9cfd
|
||||
dr $9cfd, $bc3a
|
||||
|
||||
SECTION "bank3", ROMX, BANK[$3]
|
||||
dr $c000, $c01b
|
||||
CheckTime::
|
||||
ld a, [wTimeOfDay]
|
||||
ld hl, TimeOfDayTable
|
||||
ld de, $2
|
||||
call IsInArray
|
||||
inc hl
|
||||
ld c, [hl]
|
||||
ret c
|
||||
xor a
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
TimeOfDayTable: ; c012
|
||||
db MORN, 1 << MORN
|
||||
db DAY, 1 << DAY
|
||||
db NITE, 1 << NITE
|
||||
db NITE, 1 << NITE
|
||||
db -1
|
||||
|
||||
EngineFlagAction:: ; c01b
|
||||
dr $c01b, $c164
|
||||
|
||||
INCLUDE "engine/variables.asm"
|
||||
|
||||
IF DEF(GOLD)
|
||||
dr $c01b, $c69d
|
||||
dr $c22b, $c5ac
|
||||
CountUnown:
|
||||
dr $c5ac, $c661
|
||||
FlagPredef:
|
||||
dr $c661, $c69d
|
||||
HealParty:
|
||||
dr $c69d, $d1e2
|
||||
dr $c69d, $c6de
|
||||
ComputeHPBarPixels:
|
||||
dr $c6de, $d1e2
|
||||
ReceiveItem_::
|
||||
dr $d1e2, $d21a
|
||||
TossItem_::
|
||||
@@ -259,7 +286,11 @@ DoItemEffect_::
|
||||
ENDC
|
||||
|
||||
IF DEF(SILVER)
|
||||
dr $c01b, $c69b
|
||||
dr $c22b, $c5aa
|
||||
CountUnown:
|
||||
dr $c5aa, $c65f
|
||||
FlagPredef:
|
||||
dr $c65f, $c69b
|
||||
HealParty:
|
||||
dr $c69b, $d1e0
|
||||
ReceiveItem_::
|
||||
|
||||
4
wram.asm
4
wram.asm
@@ -2355,7 +2355,7 @@ wVramState:: ds 1
|
||||
wcfe6:: ds 1 ; cfe6
|
||||
wcfe7:: ds 1 ; cfe7
|
||||
wcfe8:: ds 1 ; cfe8
|
||||
wcfe9:: ds 1 ; cfe9
|
||||
wBattleResult:: ds 1 ; cfe9
|
||||
wcfea:: ds 1 ; cfea
|
||||
wcfeb:: ds 1 ; cfeb
|
||||
wcfec:: ds 1 ; cfec
|
||||
@@ -2902,6 +2902,8 @@ wd578:: ds 1 ; d578
|
||||
wd579:: ds 1 ; d579
|
||||
|
||||
wCoins:: dw ; d57a
|
||||
|
||||
wBadges::
|
||||
wJohtoBadges:: ds 1 ; d57c
|
||||
wKantoBadges:: ds 1 ; d57d
|
||||
|
||||
|
||||
Reference in New Issue
Block a user