About time I got to these functions

This commit is contained in:
PikalaxALT
2015-10-24 10:34:19 -04:00
parent 97cc513f54
commit 119d6b4119
409 changed files with 5218 additions and 4233 deletions

View File

@@ -123,18 +123,18 @@ Function3c000: ; 3c000
WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
call Function30b4
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
add $2
ld [wd0ee], a
ld [wBattleResult], a
ld a, [wLinkMode]
and a
ld hl, BattleText_WildFled
jr z, .asm_3c115
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
ld [wd0ee], a
ld [wBattleResult], a
ld hl, BattleText_EnemyFled
call Function3d2e0
jr nc, .asm_3c115
@@ -584,10 +584,10 @@ Function3c3f5: ; 3c3f5
ld a, [wdc79]
and a
jr nz, .asm_3c40e
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
add $2
ld [wd0ee], a
ld [wBattleResult], a
scf
ret
@@ -2245,9 +2245,9 @@ Function3ce01: ; 3ce01
call z, Function3d0ea
call EmptyBattleTextBox
call Function309d
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
ld [wd0ee], a
ld [wBattleResult], a
call Function3ceaa
jr z, .asm_3ce72
ld hl, EnemyMonBaseStats
@@ -2633,7 +2633,7 @@ Function3d0be: ; 3d0be
push bc
ld b, h
ld c, l
callba Function106008
callba MobileFn_106008
pop bc
pop hl
.asm_3d0ce
@@ -2831,10 +2831,10 @@ Function3d1aa: ; 3d1aa
ld a, [CurBattleMon]
ld [CurPartyMon], a
callab ChangeHappiness
ld a, [wd0ee]
ld a, [wBattleResult]
and %11000000
add $1
ld [wd0ee], a
ld [wBattleResult], a
ld a, [wc6f7]
and a
ret z
@@ -3136,10 +3136,10 @@ LostBattle: ; 3d38e
call CheckEnemyTrainerDefeated
jr nz, .asm_3d40a
ld hl, TiedAgainstText
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
add 2
ld [wd0ee], a
ld [wBattleResult], a
jr .text
.asm_3d40a
@@ -4009,10 +4009,10 @@ Function3d8b3: ; 3d8b3
dec a
.asm_3d9cf
ld b, a
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
add b
ld [wd0ee], a
ld [wBattleResult], a
call StopDangerSound
push de
ld de, SFX_RUN
@@ -5251,7 +5251,7 @@ Function3e234: ; 3e234
and a
jr nz, .asm_3e279
callab CheckItemPocket
ld a, [wd142]
ld a, [wItemAttributeParamBuffer]
cp $3
jr z, .asm_3e24a
call WhiteBGMap
@@ -5282,9 +5282,9 @@ Function3e234: ; 3e234
.asm_3e279
xor a
ld [wc64e], a
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
ld [wd0ee], a
ld [wBattleResult], a
call ResetTextRelatedRAM
call Function32f9
scf
@@ -8403,9 +8403,13 @@ Function3f4b4: ; 3f4b4
StartBattle: ; 3f4c1
; This check prevents you from entering a battle without any Pokemon.
; Those using walk-through-walls to bypass getting a Pokemon experience
; the effects of this check.
ld a, [PartyCount]
and a
ret z
ld a, [TimeOfDayPal]
push af
call Function3f4dd
@@ -8425,17 +8429,17 @@ Function3f4d9: ; 3f4d9
Function3f4dd: ; 3f4dd
callba Function106050
call Function3f54e
callba MobileFn_106050 ; mobile
call LoadTrainerOrWildMonPic
xor a
ld [TempBattleMonSpecies], a
ld [wd0d2], a
xor a
ld [$ffde], a
callba PlayBattleMusic
callba Function2ee18
callba Function2ee2f
call Function2ed3
callba ShowLinkBattleParticipants
callba FindFirstAliveMon
call DisableSpriteUpdates
callba ClearBattleRAM
call Function3f55e
call Function3f568
@@ -8465,14 +8469,14 @@ Function3f4dd: ; 3f4dd
ret
; 3f54e
Function3f54e: ; 3f54e
LoadTrainerOrWildMonPic: ; 3f54e
ld a, [OtherTrainerClass]
and a
jr nz, .asm_3f55a
jr nz, .Trainer
ld a, [TempWildMonSpecies]
ld [CurPartySpecies], a
.asm_3f55a
.Trainer
ld [TempEnemyMonSpecies], a
ret
; 3f55e
@@ -8480,8 +8484,8 @@ Function3f54e: ; 3f54e
Function3f55e: ; 3f55e
ld a, [OtherTrainerClass]
and a
jp nz, Function3f594
jp Function3f607
jp nz, Function3f594 ; trainer
jp Function3f607 ; wild
; 3f568
Function3f568: ; 3f568
@@ -8510,7 +8514,7 @@ Function3f568: ; 3f568
Function3f594: ; 3f594
ld [TrainerClass], a
callba Function10606a
callba MobileFn_10606a
xor a
ld [TempEnemyMonSpecies], a
callab Function3957b
@@ -8566,7 +8570,7 @@ Function3f594: ; 3f594
Function3f607: ; 3f607
ld a, $1
ld [wBattleMode], a
callba Function10605d
callba MobileFn_10605d
call LoadEnemyMon
ld hl, EnemyMonMoves
ld de, wc735
@@ -8660,15 +8664,15 @@ Function3f69e: ; 3f69e
Function3f6a5: ; 3f6a5
ld a, [wLinkMode]
and a
jr z, .asm_3f6b7
jr z, .not_linked
call Function3f759
ld c, 150
call DelayFrames
call Function3f77c
ret
.asm_3f6b7
ld a, [wd0ee]
.not_linked
ld a, [wBattleResult]
and $f
ret nz
call Function3f71d
@@ -8692,11 +8696,11 @@ Function3f6d0: ; 3f6d0
ld [wd267], a
ld [wd232], a
ld [wd0d8], a
ld [wd0da], a
ld [wd0d9], a
ld [wKeyItemsPocketPointerLocation], a
ld [wItemsPocketPointerLocation], a
ld [wd0d2], a
ld [CurMoveNum], a
ld [wd0db], a
ld [wBallsPocketPointerLocation], a
ld [wd0d6], a
ld [wd0e4], a
ld [wd0e0], a
@@ -8750,7 +8754,7 @@ endr
; 3f759
Function3f759: ; 3f759
callba Function1060df
callba MobileFn_1060df
callba Function106187
ld a, [CurOTMon]
ld hl, OTPartyMon1Status
@@ -8758,7 +8762,7 @@ Function3f759: ; 3f759
ld a, [EnemyMonStatus]
ld [hl], a
call ClearTileMap
callba Function2c1b2
callba _ShowLinkBattleParticipants
ret
; 3f77c
@@ -8773,22 +8777,22 @@ Function3f77c: ; 3f77c
callba Function2b930
.asm_3f797
ld a, [wd0ee]
ld a, [wBattleResult]
and $f
cp $1
jr c, .asm_3f7ad
jr z, .asm_3f7b8
callba Function106107
callba MobileFn_106107
ld de, .Draw
jr .asm_3f7c3
.asm_3f7ad
callba Function1060fb
callba MobileFn_1060fb
ld de, .Win
jr .asm_3f7c3
.asm_3f7b8
callba Function106101
callba MobileFn_106101
ld de, .Lose
jr .asm_3f7c3
@@ -9006,7 +9010,7 @@ Function3f998: ; 3f998
ld a, [BattleType]
cp BATTLETYPE_ROAMING
jr nz, .asm_3f9c4
ld a, [wd0ee]
ld a, [wBattleResult]
and $f
jr z, .asm_3f9af
call GetRoamMonHP
@@ -9170,7 +9174,7 @@ endr
; 3faa0
Function3faa0: ; 3faa0
ld a, [wd0ee]
ld a, [wBattleResult]
and $f
cp $1
ld bc, $000d
@@ -9405,7 +9409,7 @@ GetBattleBackpic: ; 3fbff
jr z, .Decompress
; What gender are we?
ld a, [wd45b]
ld a, [wPlayerSpriteSetupFlags]
bit 2, a
jr nz, .Chris
ld a, [PlayerGender]
@@ -9542,7 +9546,7 @@ BattleStartMessage: ; 3fc8b
cp BATTLETYPE_FISH
jr nz, .asm_3fcfd
callba Function106086
callba MobileFn_106086
ld hl, HookedPokemonAttackedText
jr .asm_3fd0e

View File

@@ -7188,10 +7188,10 @@ BattleCommanda0: ; 36778
Function36804: ; 36804
ld a, [wd0ee]
ld a, [wBattleResult]
and $c0
or $2
ld [wd0ee], a
ld [wBattleResult], a
ret
; 3680f
@@ -8519,7 +8519,7 @@ BattleCommand35: ; 36f9d
BattleCommand36: ; 36fe1
call AnimateCurrentMove
callba Function1060e5
callba MobileFn_1060e5
jp PrintNothingHappened
; 36fed
@@ -9152,7 +9152,7 @@ CheckSubstituteOpp: ; 37378
BattleCommand1a: ; 37380
callba Function10610d
callba MobileFn_10610d
ld a, $4
ld [wcfca], a
ld c, $3

215
battle/magikarp_length.asm Normal file
View File

@@ -0,0 +1,215 @@
CalcMagikarpLength: ; fbbfc
; Return Magikarp's length (in mm) at MagikarpLength (big endian).
;
; input:
; de: EnemyMonDVs
; bc: PlayerID
; This function is poorly commented.
; In short, it generates a value between 190 and 1786 using
; a Magikarp's DVs and its trainer ID. This value is further
; filtered in LoadEnemyMon to make longer Magikarp even rarer.
; The value is generated from a lookup table.
; The index is determined by the dv xored with the player's trainer id.
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)
; if bc < 10: [MagikarpLength] = c + 190
; if bc >= $ff00: [MagikarpLength] = c + 1370
; else: [MagikarpLength] = z * 100 + (bc - x) / y
; X, Y, and Z depend on the value of b as follows:
; if b = 0: x = 310, y = 2, z = 3
; if b = 1: x = 710, y = 4, z = 4
; if b = 2-9: x = 2710, y = 20, z = 5
; if b = 10-29: x = 7710, y = 50, z = 6
; if b = 30-68: x = 17710, y = 100, z = 7
; if b = 69-126: x = 32710, y = 150, z = 8
; if b = 127-185: x = 47710, y = 150, z = 9
; if b = 186-224: x = 57710, y = 100, z = 10
; if b = 225-243: x = 62710, y = 50, z = 11
; if b = 244-251: x = 64710, y = 20, z = 12
; if b = 252-253: x = 65210, y = 5, z = 13
; if b = 254: x = 65410, y = 2, z = 14
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)
; id
ld h, b
ld l, c
ld a, [hli]
ld b, a
ld c, [hl]
rrc b
rrc c
; dv
ld a, [de]
inc de
rrca
rrca
xor b
ld b, a
ld a, [de]
rrca
rrca
xor c
ld c, a
; if bc < 10:
; de = bc + 190
; break
ld a, b
and a
jr nz, .no
ld a, c
cp 10
jr nc, .no
ld hl, 190
add hl, bc
ld d, h
ld e, l
jr .done
.no
ld hl, .Lengths
ld a, 2
ld [wd265], a
.read
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
call .BCLessThanDE
jr nc, .next
; c = (bc - de) / [hl]
call .BCMinusDE
ld a, b
ld [hDividend + 0], a
ld a, c
ld [hDividend + 1], a
ld a, [hl]
ld [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 2]
ld c, a
; de = c + 100 * (2 + i)
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
ld a, 100
ld [hMultiplicand + 2], a
ld a, [wd265]
ld [hMultiplier], a
call Multiply
ld b, 0
ld a, [hProduct + 3]
add c
ld e, a
ld a, [hProduct + 2]
adc b
ld d, a
jr .done
.next
inc hl ; align to next triplet
ld a, [wd265]
inc a
ld [wd265], a
cp 16
jr c, .read
call .BCMinusDE
ld hl, 1600
add hl, bc
ld d, h
ld e, l
.done
; hl = de * 10
ld h, d
ld l, e
rept 2
add hl, hl
endr
add hl, de
add hl, hl
; hl = hl / 254
ld de, -254
ld a, -1
.div_254
inc a
add hl, de
jr c, .div_254
; d, e = hl / 12, hl % 12
ld d, 0
.mod_12
cp 12
jr c, .ok
sub 12
inc d
jr .mod_12
.ok
ld e, a
ld hl, MagikarpLength
ld [hl], d
inc hl
ld [hl], e
ret
; fbc9a
.BCLessThanDE: ; fbc9a
; Intention: Return bc < de.
; Reality: Return b < d.
ld a, b
cp d
ret c
ret nc ; whoops
ld a, c
cp e
ret
; fbca1
.BCMinusDE: ; fbca1
; bc -= de
ld a, c
sub e
ld c, a
ld a, b
sbc d
ld b, a
ret
; fbca8
.Lengths: ; fbca8
; ????, divisor
dwb 110, 1
dwb 310, 2
dwb 710, 4
dwb 2710, 20
dwb 7710, 50
dwb 17710, 100
dwb 32710, 150
dwb 47710, 150
dwb 57710, 100
dwb 62710, 50
dwb 64710, 20
dwb 65210, 5
dwb 65410, 2
dwb 65510, 1 ; not used
; fbcd2

View File

@@ -10,6 +10,7 @@ INCLUDE "constants/type_constants.asm"
INCLUDE "constants/move_constants.asm"
INCLUDE "constants/battle_constants.asm"
INCLUDE "constants/map_constants.asm"
INCLUDE "constants/map_setup_constants.asm"
INCLUDE "constants/landmark_constants.asm"
INCLUDE "constants/item_constants.asm"
INCLUDE "constants/trainer_constants.asm"

View File

@@ -352,7 +352,7 @@ const_value SET 70
const HELD_TRADE_EVOLVE
const HELD_AMULET_COIN
const HELD_BRIGHTPOWDER
const HELD_4E
const HELD_78
const HELD_FOCUS_BAND
const_def
@@ -364,3 +364,12 @@ const_value SET 70
const ITEMATTR_POCKET
const ITEMATTR_HELP
NUM_ITEMATTRS EQU const_value
ITEMMENU_NOUSE EQU 0
ITEMMENU_CURRENT EQU 4
ITEMMENU_PARTY EQU 5
ITEMMENU_FIELD EQU 6
ITEMCONTEXT_NOTINBATTLE EQU 0
ITEMCONTEXT_BATTLEANDFIELD EQU 5
ITEMCONTEXT_BATTLEONLY EQU 6

View File

@@ -0,0 +1,13 @@
const_def
const MAPSETUP_00
const MAPSETUP_01
const MAPSETUP_02
const MAPSETUP_03
const MAPSETUP_04
const MAPSETUP_05
const MAPSETUP_06
const MAPSETUP_07
const MAPSETUP_08
const MAPSETUP_09
const MAPSETUP_10
const MAPSETUP_11

View File

@@ -156,3 +156,6 @@ const_value = 1
const LINK_TRADECENTER
const LINK_COLOSSEUM
const LINK_MOBILE
HMENURETURN_SCRIPT EQU %10000000
HMENURETURN_ASM EQU %11111111

View File

@@ -40,13 +40,28 @@
const PHONE_BUENA
const_def
const ELMCALL_NONE
const ELMCALL_POKERUS
const ELMCALL_ROBBED
const ELMCALL_ASSISTANT
const ELMCALL_WEIRDBROADCAST
const ELMCALL_SSTICKET
const ELMCALL_UNKNOWN
const MOMCALL_WORRIED
const ELMCALL_MASTERBALL
const SPECIALCALL_NONE
const SPECIALCALL_POKERUS
const SPECIALCALL_ROBBED
const SPECIALCALL_ASSISTANT
const SPECIALCALL_WEIRDBROADCAST
const SPECIALCALL_SSTICKET
const SPECIALCALL_BIKESHOP
const SPECIALCALL_WORRIED
const SPECIALCALL_MASTERBALL
const_def
const PHONE_CONTACT_TRAINER_CLASS
const PHONE_CONTACT_TRAINER_NUMBER
const PHONE_CONTACT_MAP_GROUP
const PHONE_CONTACT_MAP_NUMBER
const PHONE_CONTACT_SCRIPT1_TIME
const PHONE_CONTACT_SCRIPT1_BANK
const PHONE_CONTACT_SCRIPT1_ADDR_LO
const PHONE_CONTACT_SCRIPT1_ADDR_HI
const PHONE_CONTACT_SCRIPT2_TIME
const PHONE_CONTACT_SCRIPT2_BANK
const PHONE_CONTACT_SCRIPT2_ADDR_LO
const PHONE_CONTACT_SCRIPT2_ADDR_HI
PHONE_TABLE_WIDTH EQU const_value
CONTACT_LIST_SIZE EQU 10

View File

@@ -5,7 +5,7 @@ LAST_TALKED EQU -2
const_def
const VAR_STRINGBUFFER2
const VAR_PARTYCOUNT
const VAR_02
const VAR_BATTLERESULT
const VAR_BATTLETYPE
const VAR_TIMEOFDAY
const VAR_DEXCAUGHT
@@ -23,11 +23,15 @@ LAST_TALKED EQU -2
const VAR_CONTESTMINUTES
const VAR_XCOORD
const VAR_YCOORD
const VAR_POKERUS
const VAR_SPECIALPHONECALL
const VAR_15
const VAR_16
const VAR_KURT_APRICORNS
const VAR_CALLERID
const VAR_BLUECARDBALANCE
const VAR_19
const VAR_BUENASPASSWORD
const VAR_KENJI_BREAK
NUM_VARS EQU const_value
RETVAR_STRBUF2 EQU (0 << 6)
RETVAR_ADDR_DE EQU (1 << 6)
RETVAR_EXECUTE EQU (2 << 6)

View File

@@ -614,3 +614,33 @@
const EUSINE
NUM_TRAINER_CLASSES EQU __enum__
const_def
const NO_AI
const_value = 0
shift_const AI_BASIC
shift_const AI_SETUP
shift_const AI_TYPES
shift_const AI_OFFENSIVE
shift_const AI_SMART
shift_const AI_OPPORTUNIST
shift_const AI_AGGRESSIVE
shift_const AI_CAUTIOUS
shift_const AI_STATUS
shift_const AI_RISKY
shift_const AI_10
shift_const AI_11
shift_const AI_12
shift_const AI_13
shift_const AI_14
shift_const AI_15
const_def
const TRNATTR_ITEM1
const TRNATTR_ITEM2
const TRNATTR_BASEMONEY
const TRNATTR_AI1
const TRNATTR_AI2
const TRNATTR_AI3
const TRNATTR_AI4
NUM_TRAINER_ATTRIBUTES EQU const_value

View File

@@ -785,16 +785,16 @@ Function973a: ; 973a
Function974b: ; 974b
and a
jp nz, Function97f9
ld a, [wd45b]
ld a, [wPlayerSpriteSetupFlags]
bit 2, a
jr nz, .asm_9760
jr nz, .male
ld a, [PlayerGender]
and a
jr z, .asm_9760
jr z, .male
ld hl, KrisPalette
ret
.asm_9760
.male
ld hl, PlayerPalette
ret
; 9764

View File

@@ -1,198 +1,200 @@
; All locations are in WRAM bank 1.
engine_flag: MACRO
dwb \1, 1 << \2
ENDM
; location, bit
; pokegear
dwb wPokegearFlags, %00000010 ; radio card ; $0
dwb wPokegearFlags, %00000001 ; map card
dwb wPokegearFlags, %00000100 ; phone card
dwb wPokegearFlags, %00001000 ; expn card
dwb wPokegearFlags, %10000000 ; on/off
engine_flag wPokegearFlags, 1 ; radio card ; $0
engine_flag wPokegearFlags, 0 ; map card
engine_flag wPokegearFlags, 2 ; phone card
engine_flag wPokegearFlags, 3 ; expn card
engine_flag wPokegearFlags, 7 ; on/off
; wDaycareMan, %10000000 ; daycare 1 on
dwb wDaycareMan, %01000000 ; monster 1 and 2 are compatible
; wDaycareMan, %00100000 ; egg is ready
dwb wDaycareMan, %00000001 ; monster 1 in daycare
; wDaycareMan, 7 ; daycare 1 on
engine_flag wDaycareMan, 6 ; monster 1 and 2 are compatible
; wDaycareMan, 5 ; egg is ready
engine_flag wDaycareMan, 0 ; monster 1 in daycare
; wDaycareLady, %10000000 = daycare 2 on
dwb wDaycareLady, %00000001 ; monster 2 in daycare
; wDaycareLady, 7 = daycare 2 on
engine_flag wDaycareLady, 0 ; monster 2 in daycare
dwb wMomSavingMoney, %00000001 ; mom saving money ; $8
dwb wMomSavingMoney, %10000000 ; dst
engine_flag wMomSavingMoney, 0 ; mom saving money ; $8
engine_flag wMomSavingMoney, 7 ; dst
dwb wdc39, %00000001
engine_flag wdc39, 0
dwb StatusFlags, %00000001 ; pokedex
dwb StatusFlags, %00000010 ; unown dex
dwb StatusFlags, %00001000 ; pokerus
dwb StatusFlags, %00010000 ; rocket signal on ch20
dwb StatusFlags, %01000000 ; credits skip
dwb StatusFlags, %10000000 ; bug contest on ; $10
dwb StatusFlags2, %00000100 ; bug contest timer
dwb StatusFlags2, %00000010
dwb StatusFlags2, %00000001 ; rockets in radio tower
dwb StatusFlags2, %00010000 ; bike shop call enabled (1024 bike steps reqd)
dwb StatusFlags2, %00100000 ; give pokerus; berry -> berry juice when trading?
dwb StatusFlags2, %01000000
dwb StatusFlags2, %10000000 ; rockets in mahogany
engine_flag StatusFlags, 0 ; pokedex
engine_flag StatusFlags, 1 ; unown dex
engine_flag StatusFlags, 3 ; pokerus
engine_flag StatusFlags, 4 ; rocket signal on ch20
engine_flag StatusFlags, 6 ; credits skip
engine_flag StatusFlags, 7 ; bug contest on ; $10
engine_flag StatusFlags2, 2 ; bug contest timer
engine_flag StatusFlags2, 1
engine_flag StatusFlags2, 0 ; rockets in radio tower
engine_flag StatusFlags2, 4 ; bike shop call enabled (1024 bike steps reqd)
engine_flag StatusFlags2, 5 ; give pokerus
engine_flag StatusFlags2, 6 ; berry -> berry juice when trading?
engine_flag StatusFlags2, 7 ; rockets in mahogany
dwb BikeFlags, %00000001 ; strength active ; $18
dwb BikeFlags, %00000010 ; always on bike (cant surf)
dwb BikeFlags, %00000100 ; downhill (cycling road)
engine_flag BikeFlags, 0 ; strength active ; $18
engine_flag BikeFlags, 1 ; always on bike (cant surf)
engine_flag BikeFlags, 2 ; downhill (cycling road)
dwb JohtoBadges, %00000001 ; zephyrbadge
dwb JohtoBadges, %00000010 ; hivebadge
dwb JohtoBadges, %00000100 ; plainbadge
dwb JohtoBadges, %00001000 ; fogbadge
dwb JohtoBadges, %00010000 ; mineralbadge
dwb JohtoBadges, %00100000 ; stormbadge ; $20
dwb JohtoBadges, %01000000 ; glacierbadge
dwb JohtoBadges, %10000000 ; risingbadge
engine_flag JohtoBadges, 0 ; zephyrbadge
engine_flag JohtoBadges, 1 ; hivebadge
engine_flag JohtoBadges, 2 ; plainbadge
engine_flag JohtoBadges, 3 ; fogbadge
engine_flag JohtoBadges, 4 ; mineralbadge
engine_flag JohtoBadges, 5 ; stormbadge ; $20
engine_flag JohtoBadges, 6 ; glacierbadge
engine_flag JohtoBadges, 7 ; risingbadge
dwb KantoBadges, %00000001 ; boulderbadge
dwb KantoBadges, %00000010 ; cascadebadge
dwb KantoBadges, %00000100 ; thunderbadge
dwb KantoBadges, %00001000 ; rainbowbadge
dwb KantoBadges, %00010000 ; soulbadge
dwb KantoBadges, %00100000 ; marshbadge ; $28
dwb KantoBadges, %01000000 ; volcanobadge
dwb KantoBadges, %10000000 ; earthbadge
engine_flag KantoBadges, 0 ; boulderbadge
engine_flag KantoBadges, 1 ; cascadebadge
engine_flag KantoBadges, 2 ; thunderbadge
engine_flag KantoBadges, 3 ; rainbowbadge
engine_flag KantoBadges, 4 ; soulbadge
engine_flag KantoBadges, 5 ; marshbadge ; $28
engine_flag KantoBadges, 6 ; volcanobadge
engine_flag KantoBadges, 7 ; earthbadge
; unown sets
dwb UnlockedUnowns, %00000001 ; 1
dwb UnlockedUnowns, %00000010 ; 2
dwb UnlockedUnowns, %00000100 ; 3
dwb UnlockedUnowns, %00001000 ; 4
dwb UnlockedUnowns, %00010000 ; 5
dwb UnlockedUnowns, %00100000 ; 6 ; $30
dwb UnlockedUnowns, %01000000 ; 7
dwb UnlockedUnowns, %10000000 ; 8
engine_flag UnlockedUnowns, 0 ; 1
engine_flag UnlockedUnowns, 1 ; 2
engine_flag UnlockedUnowns, 2 ; 3
engine_flag UnlockedUnowns, 3 ; 4
engine_flag UnlockedUnowns, 4 ; 5
engine_flag UnlockedUnowns, 5 ; 6 ; $30
engine_flag UnlockedUnowns, 6 ; 7
engine_flag UnlockedUnowns, 7 ; 8
; fly
dwb VisitedSpawns, %00000001 ; your house
dwb VisitedSpawns, %00000010 ; viridian pokecenter
dwb VisitedSpawns, %00000100 ; pallet
dwb VisitedSpawns, %00001000 ; viridian
dwb VisitedSpawns, %00010000 ; pewter
dwb VisitedSpawns, %00100000 ; cerulean ; $38
dwb VisitedSpawns, %01000000 ; rock tunnel
dwb VisitedSpawns, %10000000 ; vermilion
dwb VisitedSpawns + 1, %00000001 ; lavender
dwb VisitedSpawns + 1, %00000010 ; saffron
dwb VisitedSpawns + 1, %00000100 ; celadon
dwb VisitedSpawns + 1, %00001000 ; fuchsia
dwb VisitedSpawns + 1, %00010000 ; cinnabar
dwb VisitedSpawns + 1, %00100000 ; indigo plateau ; $40
dwb VisitedSpawns + 1, %01000000 ; new bark
dwb VisitedSpawns + 1, %10000000 ; cherrygrove
dwb VisitedSpawns + 2, %00000001 ; violet
dwb VisitedSpawns + 2, %00000100 ; azalea
dwb VisitedSpawns + 2, %00001000 ; cianwood
dwb VisitedSpawns + 2, %00010000 ; goldenrod
dwb VisitedSpawns + 2, %00100000 ; olivine
dwb VisitedSpawns + 2, %01000000 ; ecruteak ; $48
dwb VisitedSpawns + 2, %10000000 ; mahogany
dwb VisitedSpawns + 3, %00000001 ; lake of rage
dwb VisitedSpawns + 3, %00000010 ; blackthorn
dwb VisitedSpawns + 3, %00000100 ; silver cave
dwb VisitedSpawns + 3, %00010000 ; unused
engine_flag VisitedSpawns, 0 ; your house
engine_flag VisitedSpawns, 1 ; viridian pokecenter
engine_flag VisitedSpawns, 2 ; pallet
engine_flag VisitedSpawns, 3 ; viridian
engine_flag VisitedSpawns, 4 ; pewter
engine_flag VisitedSpawns, 5 ; cerulean ; $38
engine_flag VisitedSpawns, 6 ; rock tunnel
engine_flag VisitedSpawns, 7 ; vermilion
engine_flag VisitedSpawns + 1, 0 ; lavender
engine_flag VisitedSpawns + 1, 1 ; saffron
engine_flag VisitedSpawns + 1, 2 ; celadon
engine_flag VisitedSpawns + 1, 3 ; fuchsia
engine_flag VisitedSpawns + 1, 4 ; cinnabar
engine_flag VisitedSpawns + 1, 5 ; indigo plateau ; $40
engine_flag VisitedSpawns + 1, 6 ; new bark
engine_flag VisitedSpawns + 1, 7 ; cherrygrove
engine_flag VisitedSpawns + 2, 0 ; violet
engine_flag VisitedSpawns + 2, 2 ; azalea
engine_flag VisitedSpawns + 2, 3 ; cianwood
engine_flag VisitedSpawns + 2, 4 ; goldenrod
engine_flag VisitedSpawns + 2, 5 ; olivine
engine_flag VisitedSpawns + 2, 6 ; ecruteak ; $48
engine_flag VisitedSpawns + 2, 7 ; mahogany
engine_flag VisitedSpawns + 3, 0 ; lake of rage
engine_flag VisitedSpawns + 3, 1 ; blackthorn
engine_flag VisitedSpawns + 3, 2 ; silver cave
engine_flag VisitedSpawns + 3, 4 ; unused
dwb wLuckyNumberShowFlag, %00000001 ; lucky number show
dwb StatusFlags2, %00001000
engine_flag wLuckyNumberShowFlag, 0 ; lucky number show
engine_flag StatusFlags2, 3 ; ????
dwb DailyFlags, %00000001 ; kurt making balls ; $50
dwb DailyFlags, %00000010
dwb DailyFlags, %00000100 ; special wilddata?
dwb DailyFlags, %00001000 ; time capsule (24h wait)
dwb DailyFlags, %00010000 ; all fruit trees
dwb DailyFlags, %00100000 ; shuckle given
dwb DailyFlags, %01000000 ; goldenrod underground merchant closed
dwb DailyFlags, %10000000 ; fought in trainer hall today
engine_flag DailyFlags, 0 ; kurt making balls ; $50
engine_flag DailyFlags, 1 ; ????
engine_flag DailyFlags, 2 ; special wilddata?
engine_flag DailyFlags, 3 ; time capsule (24h wait)
engine_flag DailyFlags, 4 ; all fruit trees
engine_flag DailyFlags, 5 ; shuckle given
engine_flag DailyFlags, 6 ; goldenrod underground merchant closed
engine_flag DailyFlags, 7 ; fought in trainer hall today
dwb WeeklyFlags, %00000001 ; mt moon square clefairy ; $58
dwb WeeklyFlags, %00000010 ; union cave lapras
dwb WeeklyFlags, %00000100 ; goldenrod underground haircut used
dwb WeeklyFlags, %00001000 ; goldenrod mall happiness event floor05 person07
dwb WeeklyFlags, %00010000 ; tea in blues house
dwb WeeklyFlags, %00100000 ; indigo plateau rival fight
dwb WeeklyFlags, %01000000 ; move tutor
dwb WeeklyFlags, %10000000 ; buenas password
engine_flag WeeklyFlags, 0 ; mt moon square clefairy ; $58
engine_flag WeeklyFlags, 1 ; union cave lapras
engine_flag WeeklyFlags, 2 ; goldenrod underground haircut used
engine_flag WeeklyFlags, 3 ; goldenrod mall happiness event floor05 person07
engine_flag WeeklyFlags, 4 ; tea in blues house
engine_flag WeeklyFlags, 5 ; indigo plateau rival fight
engine_flag WeeklyFlags, 6 ; move tutor
engine_flag WeeklyFlags, 7 ; buenas password
dwb SwarmFlags, %00000001 ; $60
dwb SwarmFlags, %00000010 ; goldenrod dept store sale is on
engine_flag SwarmFlags, 0 ; $60
engine_flag SwarmFlags, 1 ; goldenrod dept store sale is on
dwb GameTimerPause, %10000000 ; $62
engine_flag GameTimerPause, 7 ; $62
dwb PlayerGender, %00000001 ; player is female
engine_flag PlayerGender, 0 ; player is female
dwb wdbf3, %00000100 ; have gs ball after kurt examined it
engine_flag wCelebiEvent, 2 ; have gs ball after kurt examined it
; rematches
dwb wDailyRematchFlags, %00000001 ; jack
dwb wDailyRematchFlags, %00000010 ; huey
dwb wDailyRematchFlags, %00000100 ; gaven
dwb wDailyRematchFlags, %00001000 ; beth ; $68
dwb wDailyRematchFlags, %00010000 ; jose
dwb wDailyRematchFlags, %00100000 ; reena
dwb wDailyRematchFlags, %01000000 ; joey
dwb wDailyRematchFlags, %10000000 ; wade
dwb wDailyRematchFlags + 1, %00000001 ; ralph
dwb wDailyRematchFlags + 1, %00000010 ; liz
dwb wDailyRematchFlags + 1, %00000100 ; anthony
dwb wDailyRematchFlags + 1, %00001000 ; todd ; $70
dwb wDailyRematchFlags + 1, %00010000 ; gina
dwb wDailyRematchFlags + 1, %00100000 ; arnie
dwb wDailyRematchFlags + 1, %01000000 ; alan
dwb wDailyRematchFlags + 1, %10000000 ; dana
dwb wDailyRematchFlags + 2, %00000001 ; chad
dwb wDailyRematchFlags + 2, %00000010 ; tully
dwb wDailyRematchFlags + 2, %00000100 ; brent
dwb wDailyRematchFlags + 2, %00001000 ; tiffany ; $78
dwb wDailyRematchFlags + 2, %00010000 ; vance
dwb wDailyRematchFlags + 2, %00100000 ; wilton
dwb wDailyRematchFlags + 2, %01000000 ; parry
dwb wDailyRematchFlags + 2, %10000000 ; erin
engine_flag wDailyRematchFlags, 0 ; jack
engine_flag wDailyRematchFlags, 1 ; huey
engine_flag wDailyRematchFlags, 2 ; gaven
engine_flag wDailyRematchFlags, 3 ; beth ; $68
engine_flag wDailyRematchFlags, 4 ; jose
engine_flag wDailyRematchFlags, 5 ; reena
engine_flag wDailyRematchFlags, 6 ; joey
engine_flag wDailyRematchFlags, 7 ; wade
engine_flag wDailyRematchFlags + 1, 0 ; ralph
engine_flag wDailyRematchFlags + 1, 1 ; liz
engine_flag wDailyRematchFlags + 1, 2 ; anthony
engine_flag wDailyRematchFlags + 1, 3 ; todd ; $70
engine_flag wDailyRematchFlags + 1, 4 ; gina
engine_flag wDailyRematchFlags + 1, 5 ; arnie
engine_flag wDailyRematchFlags + 1, 6 ; alan
engine_flag wDailyRematchFlags + 1, 7 ; dana
engine_flag wDailyRematchFlags + 2, 0 ; chad
engine_flag wDailyRematchFlags + 2, 1 ; tully
engine_flag wDailyRematchFlags + 2, 2 ; brent
engine_flag wDailyRematchFlags + 2, 3 ; tiffany ; $78
engine_flag wDailyRematchFlags + 2, 4 ; vance
engine_flag wDailyRematchFlags + 2, 5 ; wilton
engine_flag wDailyRematchFlags + 2, 6 ; parry
engine_flag wDailyRematchFlags + 2, 7 ; erin
dwb wDailyPhoneItemFlags, %00000001 ; beverly has nugget
dwb wDailyPhoneItemFlags, %00000010 ; jose has star piece
dwb wDailyPhoneItemFlags, %00000100 ; wade has item (see bittable1 $032b-e)
dwb wDailyPhoneItemFlags, %00001000 ; gina has leaf stone ; $80
dwb wDailyPhoneItemFlags, %00010000 ; alan has fire stone
dwb wDailyPhoneItemFlags, %00100000 ; liz has thunderstone
dwb wDailyPhoneItemFlags, %01000000 ; derek has nugget
dwb wDailyPhoneItemFlags, %10000000 ; tully has water stone
engine_flag wDailyPhoneItemFlags, 0 ; beverly has nugget
engine_flag wDailyPhoneItemFlags, 1 ; jose has star piece
engine_flag wDailyPhoneItemFlags, 2 ; wade has item (see bittable1 $032b-e)
engine_flag wDailyPhoneItemFlags, 3 ; gina has leaf stone ; $80
engine_flag wDailyPhoneItemFlags, 4 ; alan has fire stone
engine_flag wDailyPhoneItemFlags, 5 ; liz has thunderstone
engine_flag wDailyPhoneItemFlags, 6 ; derek has nugget
engine_flag wDailyPhoneItemFlags, 7 ; tully has water stone
dwb wDailyPhoneItemFlags + 1, %00000001 ; tiffany has pink bow
dwb wDailyPhoneItemFlags + 1, %00000010 ; wilton has item (see bittable1 $032f-31)
engine_flag wDailyPhoneItemFlags + 1, 0 ; tiffany has pink bow
engine_flag wDailyPhoneItemFlags + 1, 1 ; wilton has item (see bittable1 $032f-31)
dwb wDailyPhoneTimeOfDayFlags, %00000001
dwb wDailyPhoneTimeOfDayFlags, %00000010 ; $88
dwb wDailyPhoneTimeOfDayFlags, %00000100
dwb wDailyPhoneTimeOfDayFlags, %00001000
dwb wDailyPhoneTimeOfDayFlags, %00010000
dwb wDailyPhoneTimeOfDayFlags, %00100000
dwb wDailyPhoneTimeOfDayFlags, %01000000
dwb wDailyPhoneTimeOfDayFlags, %10000000
engine_flag wDailyPhoneTimeOfDayFlags, 0
engine_flag wDailyPhoneTimeOfDayFlags, 1 ; $88
engine_flag wDailyPhoneTimeOfDayFlags, 2
engine_flag wDailyPhoneTimeOfDayFlags, 3
engine_flag wDailyPhoneTimeOfDayFlags, 4
engine_flag wDailyPhoneTimeOfDayFlags, 5
engine_flag wDailyPhoneTimeOfDayFlags, 6
engine_flag wDailyPhoneTimeOfDayFlags, 7
dwb wDailyPhoneTimeOfDayFlags + 1, %00000001
dwb wDailyPhoneTimeOfDayFlags + 1, %00000010 ; $90
dwb wDailyPhoneTimeOfDayFlags + 1, %00000100
dwb wDailyPhoneTimeOfDayFlags + 1, %00001000
dwb wDailyPhoneTimeOfDayFlags + 1, %00010000
dwb wDailyPhoneTimeOfDayFlags + 1, %00100000
dwb wDailyPhoneTimeOfDayFlags + 1, %01000000
dwb wDailyPhoneTimeOfDayFlags + 1, %10000000
engine_flag wDailyPhoneTimeOfDayFlags + 1, 0
engine_flag wDailyPhoneTimeOfDayFlags + 1, 1 ; $90
engine_flag wDailyPhoneTimeOfDayFlags + 1, 2
engine_flag wDailyPhoneTimeOfDayFlags + 1, 3
engine_flag wDailyPhoneTimeOfDayFlags + 1, 4
engine_flag wDailyPhoneTimeOfDayFlags + 1, 5
engine_flag wDailyPhoneTimeOfDayFlags + 1, 6
engine_flag wDailyPhoneTimeOfDayFlags + 1, 7
dwb wDailyPhoneTimeOfDayFlags + 2, %00000001
dwb wDailyPhoneTimeOfDayFlags + 2, %00000010 ; $98
dwb wDailyPhoneTimeOfDayFlags + 2, %00000100
dwb wDailyPhoneTimeOfDayFlags + 2, %00001000
dwb wDailyPhoneTimeOfDayFlags + 2, %00010000
dwb wDailyPhoneTimeOfDayFlags + 2, %00100000
dwb wDailyPhoneTimeOfDayFlags + 2, %01000000
dwb wDailyPhoneTimeOfDayFlags + 2, %10000000
engine_flag wDailyPhoneTimeOfDayFlags + 2, 0
engine_flag wDailyPhoneTimeOfDayFlags + 2, 1 ; $98
engine_flag wDailyPhoneTimeOfDayFlags + 2, 2
engine_flag wDailyPhoneTimeOfDayFlags + 2, 3
engine_flag wDailyPhoneTimeOfDayFlags + 2, 4
engine_flag wDailyPhoneTimeOfDayFlags + 2, 5
engine_flag wDailyPhoneTimeOfDayFlags + 2, 6
engine_flag wDailyPhoneTimeOfDayFlags + 2, 7
dwb wd45b, %00000100 ; female player has been transformed into male
engine_flag wPlayerSpriteSetupFlags, 2 ; female player has been transformed into male
dwb SwarmFlags, %00000100 ; dunsparce swarm ; $a0
dwb SwarmFlags, %00001000 ; yanma swarm
engine_flag SwarmFlags, 2 ; dunsparce swarm ; $a0
engine_flag SwarmFlags, 3 ; yanma swarm

View File

@@ -123,7 +123,7 @@ StartMap: ; 96724
ld hl, MapStatus
ld bc, $3e ; 62
call ByteFill
callba Function113e5
callba InitCallReceiveDelay
call ClearJoypad
; fallthrough
; 9673e
@@ -138,19 +138,19 @@ EnterMap: ; 9673e
call ClearAllScriptFlags3
ld a, [hMapEntryMethod]
cp $f7
cp ($f << 4) + MAPSETUP_07
jr nz, .dontset
call SetAll_ScriptFlags3
.dontset
ld a, [hMapEntryMethod]
cp $f3
cp ($f << 4) + MAPSETUP_03
jr nz, .dontresetpoison
xor a
ld [PoisonStepCount], a
.dontresetpoison
xor a
xor a ; ($0 << 4) + MAPSETUP_00
ld [hMapEntryMethod], a
ld a, 2 ; HandleMap
ld [MapStatus], a
@@ -285,12 +285,12 @@ Function96812: ; 96812
PlayerEvents: ; 9681f
xor a
; If there's already a player event, don't interrupt it.
ld a, [ScriptRunning]
and a
ret nz
call Function968e4
call Dummy_CheckScriptFlags3Bit5 ; This is a waste of time
call CheckTrainerBattle3
jr c, .ok
@@ -298,13 +298,13 @@ PlayerEvents: ; 9681f
call CheckTileEvent
jr c, .ok
call Function97c30
call RunMemScript
jr c, .ok
call Function968ec
call DoMapTrigger
jr c, .ok
call Function9693a
call CheckTimeEvents
jr c, .ok
call OWPlayerInput
@@ -436,11 +436,7 @@ SetUpFiveStepWildEncounterCooldown: ; 968d1
ret
; 968d7
Function968d7: ; 968d7
ret
; 968d8
Function968d8: ; 968d8
SetMinTwoStepWildEncounterCooldown: mobile ; 968d7
ld a, [wWildEncounterCooldown]
cp 2
ret nc
@@ -449,14 +445,14 @@ Function968d8: ; 968d8
ret
; 968e4
Function968e4: ; 968e4
Dummy_CheckScriptFlags3Bit5: ; 968e4
call CheckBit5_ScriptFlags3
ret z
call Function2f3e
call ret_2f3e
ret
; 968ec
Function968ec: ; 968ec
DoMapTrigger: ; 968ec
ld a, [wdc07]
and a
jr z, .nope
@@ -468,7 +464,7 @@ Function968ec: ; 968ec
ld e, a
ld d, 0
ld hl, wdc07 + 1
ld hl, wdc08
ld a, [hli]
ld h, [hl]
ld l, a
@@ -505,23 +501,23 @@ endr
ret
; 9693a
Function9693a: ; 9693a
CheckTimeEvents: ; 9693a
ld a, [wLinkMode]
and a
jr nz, .nothing
ld hl, StatusFlags2
bit 2, [hl]
jr z, .asm_96951
jr z, .do_daily
callba Function114a4
jr c, .elevator
callba CheckBugContestTimer
jr c, .end_bug_contest
xor a
ret
.asm_96951
callba Function11452
callba Function114e7
.do_daily
callba CheckDailyResetTimer
callba CheckPokerusTrick
callba CheckPhoneCall
ret c
@@ -529,7 +525,7 @@ Function9693a: ; 9693a
xor a
ret
.elevator
.end_bug_contest
ld a, BANK(BugCatchingContestOverScript)
ld hl, BugCatchingContestOverScript
call CallScript
@@ -537,7 +533,7 @@ Function9693a: ; 9693a
ret
; 96970
Function96970: ; 96970
.unused ; 96970
ld a, 8
scf
ret
@@ -856,7 +852,7 @@ PlayerMovement: ; 96af0
; 96b10
.seven ; 96b10
call Function968d7 ; empty
call SetMinTwoStepWildEncounterCooldown ; mobile
xor a
ld c, a
ret
@@ -898,7 +894,7 @@ PlayerMovement: ; 96af0
CheckMenuOW: ; 96b30
xor a
ld [$ffa0], a
ld [hMenuReturn], a
ld [$ffa1], a
ld a, [hJoyPressed]
@@ -940,9 +936,9 @@ SelectMenuScript: ; 96b5f
StartMenuCallback:
SelectMenuCallback: ; 96b66
copybytetovar $ffa0
if_equal %10000000, .Script
if_equal -1, .Asm
copybytetovar hMenuReturn
if_equal HMENURETURN_SCRIPT, .Script
if_equal HMENURETURN_ASM, .Asm
end
; 96b72
@@ -957,75 +953,85 @@ SelectMenuCallback: ; 96b66
CountStep: ; 96b79
; Don't count steps in link communication rooms.
ld a, [wLinkMode]
and a
jr nz, .done
callba Function90136
jr c, .setminus1
; If there is a special phone call, don't count the step.
callba CheckSpecialPhoneCall
jr c, .doscript
call Function96bd7
jr c, .setminus1
; If Repel wore off, don't count the step.
call DoRepelStep
jr c, .doscript
; Count the step for poison and total steps
ld hl, PoisonStepCount
inc [hl]
ld hl, StepCount
inc [hl]
jr nz, .asm_96b9c
; Every 256 steps, increase the happiness of all your Pokemon.
jr nz, .skip_happiness
callba StepHappiness
.asm_96b9c
.skip_happiness
; Every 256 steps, offset from the happiness incrementor by 128 steps,
; decrease the hatch counter of all your eggs until you reach the first
; one that is ready to hatch.
ld a, [StepCount]
cp $80
jr nz, .asm_96bab
jr nz, .skip_egg
callba Function16f3e
jr nz, .set8
callba DoEggStep
jr nz, .hatch
.asm_96bab
.skip_egg
; Increase the EXP of (both) DayCare Pokemon by 1.
callba DaycareStep
; Every four steps, deal damage to all Poisoned Pokemon
ld hl, PoisonStepCount
ld a, [hl]
cp 4
jr c, .poisoned
jr c, .skip_poison
ld [hl], 0
callba Function505da
jr c, .setminus1
callba DoPoisonStep
jr c, .doscript
.poisoned
callba Function97db3
.skip_poison
callba DoBikeStep
.done
xor a
ret
.setminus1
.doscript
ld a, -1
scf
ret
.set8
.hatch
ld a, 8
scf
ret
; 96bd3
Function96bd3: ; 96bd3
.unreferenced: ; 96bd3
ld a, 7
scf
ret
; 96bd7
Function96bd7: ; 96bd7
ld a, [wdca1]
DoRepelStep: ; 96bd7
ld a, [wRepelEffect]
and a
ret z
dec a
ld [wdca1], a
ld [wRepelEffect], a
ret nz
ld a, BANK(RepelWoreOffScript)
ld hl, RepelWoreOffScript
@@ -1038,7 +1044,7 @@ Function96beb: ; 96beb
ld a, [ScriptRunning]
and a
ret z
cp -1
cp -1 ; run script
ret z
cp 10
ret nc
@@ -1059,17 +1065,17 @@ endr
; 96c0c
ScriptPointers96c0c: ; 96c0c
dbw BANK(Invalid_0x96c2d), Invalid_0x96c2d
dbw BANK(SeenByTrainerScript), SeenByTrainerScript
dbw BANK(TalkToTrainerScript), TalkToTrainerScript
dbw BANK(FindItemInBallScript), FindItemInBallScript
dbw BANK(UnknownScript_0x96c4d), UnknownScript_0x96c4d
dbw BANK(WarpToNewMapScript), WarpToNewMapScript
dbw BANK(FallIntoMapScript), FallIntoMapScript
dbw BANK(UnknownScript_0x124c8), UnknownScript_0x124c8
dbw BANK(HatchEggScript), HatchEggScript
dbw BANK(UnknownScript_0x96c4f), UnknownScript_0x96c4f
dbw BANK(Invalid_0x96c2d), Invalid_0x96c2d
dba Invalid_0x96c2d
dba SeenByTrainerScript
dba TalkToTrainerScript
dba FindItemInBallScript
dba UnknownScript_0x96c4d
dba WarpToNewMapScript
dba FallIntoMapScript
dba UnknownScript_0x124c8
dba HatchEggScript
dba UnknownScript_0x96c4f
dba Invalid_0x96c2d
; 96c2d
Invalid_0x96c2d: ; 96c2d
@@ -1087,12 +1093,12 @@ HatchEggScript: ; 96c2f
WarpToNewMapScript: ; 96c34
warpsound
newloadmap $f5
newloadmap ($f << 4) + MAPSETUP_05
end
; 96c38
FallIntoMapScript: ; 96c38
newloadmap $f6
newloadmap ($f << 4) + MAPSETUP_06
playsound SFX_KINESIS
applymovement PLAYER, MovementData_0x96c48
playsound SFX_STRENGTH

View File

@@ -8,33 +8,39 @@ WarpToSpawnPoint:: ; 97c28
ret
; 97c30
Function97c30:: ; 97c30
ld a, [wd45c]
RunMemScript:: ; 97c30
; If there is no script here, we don't need to be here.
ld a, [wMapReentryScriptQueueFlag]
and a
ret z
ld hl, wd45c + 2
; Execute the script at (wMapReentryScriptBank):(wMapReentryScriptAddress).
ld hl, wMapReentryScriptAddress
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wd45c + 1]
ld a, [wMapReentryScriptBank]
call CallScript
scf
; Clear the buffer for the next script.
push af
xor a
ld hl, wd45c
ld hl, wMapReentryScriptQueueFlag
ld bc, 8
call ByteFill
pop af
ret
; 97c4f
Function97c4f:: ; 97c4f
ld hl, wd45c
LoadScriptBDE:: ; 97c4f
; If there's already a script here, don't overwrite.
ld hl, wMapReentryScriptQueueFlag
ld a, [hl]
and a
ret nz
; Set the flag
ld [hl], 1
inc hl
; Load the script pointer b:de into (wMapReentryScriptBank):(wMapReentryScriptAddress)
ld [hl], b
inc hl
ld [hl], e
@@ -262,46 +268,60 @@ ContestMons: ; 97d87
db -1, VENOMOTH, 30, 40
; 97db3
Function97db3:: ; 97db3
DoBikeStep:: ; 97db3
nop
nop
; fallthrough
; 97db5
Function97db5: ; 97db5
; If the bike shop owner doesn't have our number, or
; if we've already gotten the call, we don't have to
; be here.
ld hl, StatusFlags2
bit 4, [hl]
jr z, .NoCall
; If we're not on the bike, we don't have to be here.
ld a, [PlayerState]
cp 1
cp PLAYER_BIKE
jr nz, .NoCall
; If we're not in an area of phone service, we don't
; have to be here.
call GetMapHeaderPhoneServiceNybble
and a
jr nz, .NoCall
ld hl, wdca1 + 1
; Check the bike step count and check whether we've
; taken 65536 of them yet.
ld hl, wBikeStep
ld a, [hli]
ld d, a
ld e, [hl]
cp -1
jr nz, .asm_97dd8
cp 255
jr nz, .increment
ld a, e
cp -1
jr z, .asm_97ddc
cp 255
jr z, .dont_increment
.asm_97dd8
.increment
inc de
ld [hl], e
dec hl
ld [hl], d
.asm_97ddc
.dont_increment
; If we've taken at least 1024 steps, have the bike
; shop owner try to call us.
ld a, d
cp $4
cp 1024 >> 8
jr c, .NoCall
; If a call has already been queued, don't overwrite
; that call.
ld a, [wSpecialPhoneCallID]
and a
jr nz, .NoCall
ld a, 6
; Queue the call.
ld a, SPECIALCALL_BIKESHOP
ld [wSpecialPhoneCallID], a
xor a
ld [wSpecialPhoneCallID + 1], a
@@ -488,7 +508,7 @@ Function97eb7: ; 97eb7
; 97eb8
Function97eb8: ; 97eb8
call Function2f3e
call ret_2f3e
ret
; 97ebc

View File

@@ -58,7 +58,7 @@ CheckFruitTree: ; 44055
; 4405f
PickedFruitTree: ; 4405f
callba Function10609b ; empty function
callba MobileFn_10609b ; empty function
ld b, 1
jp GetFruitTreeFlag
; 4406a

View File

@@ -2196,7 +2196,7 @@ Function4ecd: ; 4ecd
add hl, bc
ld a, [hl]
ld b, a
callba Function807e
callba CopyDECoordsToMapObject
pop bc
ld hl, OBJECT_FLAGS
add hl, bc
@@ -3064,7 +3064,7 @@ Function579d: ; 579d
; 57bc
Function57bc: ; 57bc
ld hl, wd45b
ld hl, wPlayerSpriteSetupFlags
bit 7, [hl]
jr nz, .ok
ret
@@ -3076,10 +3076,10 @@ Function57bc: ; 57bc
; 57ca
Function57ca: ; 57ca
ld hl, wd45b
ld hl, wPlayerSpriteSetupFlags
bit 5, [hl]
ret z
ld a, [wd45b]
ld a, [wPlayerSpriteSetupFlags]
and 3
rept 2
add a

View File

@@ -31,222 +31,171 @@ MapSetupScripts: ; 15377
dw MapSetupScript12
; 1538f
; Command descriptions from Condensation water's scripting compendium.
const_def
const map_lcd_on ; 00 = Turn LCD on
const map_lcd_off ; 01 = Turn LCD off
const map_sound_off ; 02 = Turn speakers off
const map_music ; 03 = Music check for current map/ special check for bug catcher contest
const map_start_music ; 04 = Start map music anew
const map_fade_music ; 05 = Music check for current map / special check for Bug Contest/ music with FadeOut (old) and FadeIn
const map_fade ; 06 = Fade out music + screen
const map_bike_music ; 07 = If HIRO is on bike = bike music, else play map music
const map_music_force ; 08 = Play map music
const map_max_volume ; 09 = Turn music to highest volume
const map_load_blocks ; 0A = Write map data to MapRAM
const map_connection_blocks ; 0B = Compute map’s connection pars and write into MapRAM
const map_save_screen ; 0C = Write current part of map into temporary memory
const map_buffer_screen ; 0D = Write current part of map into read-from memory
const map_load_graphics ; 0E = Write tileset header to ram/ load tileset/ load sprite tiles/ load special tiles
const map_load_tileset_header ; 0F = Write tileset header to ram
const map_time_of_day ; 10 = Compute time of day/ Update screen
const map_palettes ; 11 = Load map palettes
const map_wildmons ; 12 = Load probabilities for wild Pokémon battles
const map_sprites ; 13 = Delete sprite data and draw new sprites
const map_change_callback ; 14 = Check 2nd script header for 05 and 03 callbacks
const map_start_callback ; 15 = Check 2nd script header for 03 callbacks
const map_load_objects ; 16 = Analyze people data anew and check 2nd script header for 02 callbacks
const map_load_spawn ; 17 = Writes arrival data for arrival by flying/Blackout from table 05:5319 to ram
const map_load_connection ; 18 = Writes arrival data for entering a map by connection to ram
const map_load_warp ; 19 = Write warp data to ram when entering warp
const map_attributes ; 1A = Load complete map data (primary, secondary, event, script headers)
const map_attributes_2 ; 1B = Same as 1A, but some settings aren’t loaded new from the rom, such as hide function of the people events
const map_clear_bg_palettes ; 1C = Fill palette data with FFFF (=white)
const map_fade_out_palettes ; 1D = All BG pallet color are converted to 0|0 (Pal0, Col0), all sprite colors to x|0 (FadeOut)
const map_fade_in_palettes ; 1E = Palette FadeIn
const map_anchor_screen ; 1F = Compute position of upper left-most block visible on screen
const map_warp_face ; 20 = Position computation when HIRO leaves a warp
const map_face_down ; 21 = Set HIRO’s facing to “down”
const map_spawn_coord ; 22 = Prepare HIRO data for arrival by flight
const map_player_coord ; 23 = Compute HIRO x/y data anew
const map_prolong_sprites ; 24 = Prolong old sprites before removing them
const map_delay_sprites ; 25 = Delay rendering new sprites
const map_update_roam ; 26 = Compute chances to meet Raikou, Entei or Suicune
const map_keep_roam ; 27 = Recover chances to meet Raikou, Entei or Suicune
const map_fade_out_music ; 28 = Temporarily stop music playing
const map_animations_on ; 29 = Activate animations
const map_animations_off ; 2A = Deactivate animations
const map_keep_palettes ; 2B = Recover all palettes
const map_text_scroll_off ; 2C = Turn off text scroll (for town name overlays)
const map_stop_script ; 2D = Deactivate code prolonging
MapSetupScript4: ; 1538f
db map_prolong_sprites
map_prolong_sprites
MapSetupScript12: ; 15390
db map_fade_out_palettes
db map_keep_roam
map_fade_out_palettes
map_keep_roam
MapSetupScript1: ; 15392
db map_lcd_off
db map_sound_off
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_load_objects
db map_lcd_on
db map_palettes
db map_face_down
db map_sprites
db map_bike_music
db map_max_volume
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
map_lcd_off
map_sound_off
map_load_spawn
map_attributes
map_change_callback
map_spawn_coord
map_player_coord
map_anchor_screen
map_load_blocks
map_buffer_screen
map_load_graphics
map_time_of_day
map_load_objects
map_lcd_on
map_palettes
map_face_down
map_sprites
map_bike_music
map_max_volume
map_fade_in_palettes
map_animations_on
map_wildmons
map_end_setup_script
MapSetupScript11: ; 153a9
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_face_down
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
map_load_spawn
map_attributes
map_change_callback
map_spawn_coord
map_player_coord
map_anchor_screen
map_load_blocks
map_buffer_screen
map_lcd_off
map_load_graphics
map_time_of_day
map_fade_out_music
map_lcd_on
map_load_objects
map_palettes
map_face_down
map_sprites
map_fade_music
map_fade_in_palettes
map_animations_on
map_wildmons
map_end_setup_script
MapSetupScript7: ; 153bf
db map_animations_off
db map_load_connection
db map_attributes
db map_change_callback
db map_player_coord
db map_load_blocks
db map_load_tileset_header
db map_save_screen
db map_load_objects
db map_fade_music
db map_palettes
db map_stop_script
db map_keep_palettes
db map_wildmons
db map_update_roam
db map_animations_on
db -1
map_animations_off
map_load_connection
map_attributes
map_change_callback
map_player_coord
map_load_blocks
map_load_tileset_header
map_save_screen
map_load_objects
map_fade_music
map_palettes
map_stop_script
map_keep_palettes
map_wildmons
map_update_roam
map_animations_on
map_end_setup_script
MapSetupScript6: ; 153d0
db map_prolong_sprites
map_prolong_sprites
MapSetupScript5: ; 153d1
db map_fade_out_palettes
map_fade_out_palettes
MapSetupScript9: ; 153d2
db map_load_warp
db map_attributes
db map_warp_face
db map_change_callback
db map_player_coord
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_update_roam
db -1
map_load_warp
map_attributes
map_warp_face
map_change_callback
map_player_coord
map_load_blocks
map_buffer_screen
map_lcd_off
map_load_graphics
map_time_of_day
map_fade_out_music
map_lcd_on
map_load_objects
map_palettes
map_sprites
map_fade_music
map_fade_in_palettes
map_animations_on
map_wildmons
map_update_roam
map_end_setup_script
MapSetupScript3: ; 153e7
db map_fade
db map_clear_bg_palettes
db map_lcd_off
db map_sound_off
db map_load_blocks
db map_connection_blocks
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_music_force
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
map_fade
map_clear_bg_palettes
map_lcd_off
map_sound_off
map_load_blocks
map_connection_blocks
map_load_graphics
map_time_of_day
map_lcd_on
map_palettes
map_sprites
map_music_force
map_fade_in_palettes
map_animations_on
map_wildmons
map_end_setup_script
MapSetupScript8: ; 153f7
db map_fade
db map_lcd_off
db map_sound_off
db map_change_callback
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_text_scroll_off
db -1
map_fade
map_lcd_off
map_sound_off
map_change_callback
map_load_blocks
map_buffer_screen
map_load_graphics
map_time_of_day
map_lcd_on
map_palettes
map_sprites
map_bike_music
map_fade_in_palettes
map_animations_on
map_wildmons
map_text_scroll_off
map_end_setup_script
MapSetupScript2: ; 15408
db map_lcd_off
db map_sound_off
db map_attributes_2
db map_anchor_screen
db map_start_callback
db map_load_blocks
db map_connection_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
map_lcd_off
map_sound_off
map_attributes_2
map_anchor_screen
map_start_callback
map_load_blocks
map_connection_blocks
map_buffer_screen
map_load_graphics
map_time_of_day
map_lcd_on
map_palettes
map_sprites
map_bike_music
map_fade_in_palettes
map_animations_on
map_wildmons
map_end_setup_script
MapSetupScript10: ; 1541a
db map_load_blocks
db map_connection_blocks
db -1
map_load_blocks
map_connection_blocks
map_end_setup_script
ReadMapSetupScript: ; 1541d
@@ -374,13 +323,13 @@ Function154ea: ; 154ea
; 154eb
DelayClearingOldSprites: ; 154eb
ld hl, wd45b
ld hl, wPlayerSpriteSetupFlags
set 7, [hl]
ret
; 154f1
DelayLoadingNewSprites: ; 154f1
ld hl, wd45b
ld hl, wPlayerSpriteSetupFlags
set 6, [hl]
ret

View File

@@ -1656,5 +1656,5 @@ UnknownScript_0xa0b04:
BikeShopPhoneScript:
farwritetext UnknownText_0x174000
clearflag ENGINE_BIKE_SHOP_CALL_ENABLED
specialphonecall ELMCALL_NONE
specialphonecall SPECIALCALL_NONE
end

File diff suppressed because it is too large Load Diff

884
engine/phone.asm Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More