Special script annotation, trainer constant enumeration, person-event structure update

This commit is contained in:
PikalaxALT 2015-07-16 18:10:10 -04:00
parent 7054bfe717
commit 894955f9d9
382 changed files with 4179 additions and 4035 deletions

File diff suppressed because it is too large Load Diff

View File

@ -739,3 +739,14 @@ OBJECT_STRUCT_3_DATA_HEIGHT EQU 37
const EMOTE_ROD_UP ; 9
const EMOTE_ROD_LEFT ; a
const EMOTE_ROD_RIGHT ; b
const_def
const SIGNPOST_READ
const SIGNPOST_UP
const SIGNPOST_DOWN
const SIGNPOST_RIGHT
const SIGNPOST_LEFT
const SIGNPOST_IFSET
const SIGNPOST_IFNOTSET
const SIGNPOST_ITEMIFSET
const SIGNPOST_COPY

View File

@ -12,6 +12,7 @@ PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
MOVE_NAME_LENGTH EQU 13
ITEM_NAME_LENGTH EQU 13
TRAINER_CLASS_NAME_LENGTH EQU 13
NAME_LENGTH EQU 11
LV_CHAR EQU $6e

View File

@ -1,4 +1,5 @@
; pokemon
const_value set 1
const BULBASAUR
const IVYSAUR
@ -257,3 +258,58 @@ const_value SET const_value + -1
NUM_POKEMON EQU const_value
EGG EQU 253
; pokemon structure in RAM
const_def
const MON_SPECIES
const MON_ITEM
const MON_MOVE1
const MON_MOVE2
const MON_MOVE3
const MON_MOVE4
const MON_ID
const MON_07
const MON_EXP
const MON_09
const MON_0A
const MON_HP_EXP
const MON_0C
const MON_ATK_EXP
const MON_0E
const MON_DEF_EXP
const MON_10
const MON_SPD_EXP
const MON_12
const MON_SPC_EXP
const MON_14
const MON_DVS
const MON_16
const MON_PP1
const MON_PP2
const MON_PP3
const MON_PP4
const MON_HAPPINESS
const MON_PKRUS
const MON_CAUGHTTIME
const MON_CAUGHTGENDER
const MON_LEVEL
BOXMON_STRUCT_LENGTH EQU const_value
const MON_STATUS
const MON_21
const MON_HP
const MON_23
const MON_MAXHP
const MON_25
const MON_ATK
const MON_27
const MON_DEF
const MON_29
const MON_SPD
const MON_2B
const MON_SAT
const MON_2D
const MON_SDF
const MON_2F
PARTYMON_STRUCT_LENGTH EQU const_value

File diff suppressed because it is too large Load Diff

View File

@ -71,5 +71,3 @@ PLAYER_SURF_PIKA EQU 8
OBJECT_STRUCT_LENGTH EQU 40
NUM_OBJECT_STRUCTS EQU 13
PARTYMON_STRUCT_LENGTH EQU 48

View File

@ -358,7 +358,7 @@ CheckTileEvent: ; 96874
call CheckBit2_ScriptFlags3
jr z, .bit2
callba Function104820
callba CheckMovingOffEdgeOfMap
jr c, .return4
call Function2238
@ -368,7 +368,7 @@ CheckTileEvent: ; 96874
call CheckBit1_ScriptFlags3
jr z, .bit1
call Function2ad4
call CheckCurrentMapXYTriggers
jr c, .movement
.bit1
@ -398,12 +398,12 @@ CheckTileEvent: ; 96874
.return6
ld a, [StandingTile]
call CheckPitTile
jr nz, .asm_968b6
jr nz, .pittile
ld a, 6
scf
ret
.asm_968b6
.pittile
ld a, 5
scf
ret
@ -528,8 +528,8 @@ Function9693a: ; 9693a
ret
.elevator
ld a, BANK(UnknownScript_0x135f8)
ld hl, UnknownScript_0x135f8
ld a, BANK(BugCatchingContestOverScript)
ld hl, BugCatchingContestOverScript
call CallScript
scf
ret
@ -764,8 +764,8 @@ TryReadSign: ; 96a38
ld de, EngineBuffer1
ld bc, 3
call FarCopyBytes
ld a, BANK(UnknownScript_0x13625)
ld hl, UnknownScript_0x13625
ld a, BANK(SignpostItemScript)
ld hl, SignpostItemScript
call CallScript
scf
ret
@ -817,7 +817,7 @@ CheckSignFlag: ; 96ad8
call GetFarHalfword
ld e, l
ld d, h
ld b, $2
ld b, $2 ; check
call EventFlagAction
ld a, c
and a
@ -1024,8 +1024,8 @@ Function96bd7: ; 96bd7
dec a
ld [wdca1], a
ret nz
ld a, BANK(UnknownScript_0x13619)
ld hl, UnknownScript_0x13619
ld a, BANK(RepelWoreOffScript)
ld hl, RepelWoreOffScript
call CallScript
scf
ret

View File

@ -1,7 +1,7 @@
; More overworld event handling.
Function97c28:: ; 97c28
WarpToLastSpawn:: ; 97c28
ld hl, StatusFlags2
res 1, [hl]
res 2, [hl]
@ -48,46 +48,46 @@ Function97c5f:: ; 97c5f
call GetFacingTileCoord
ld [EngineBuffer1], a
ld c, a
callba Function1365b
jr c, .asm_97cb9
callba CheckFacingTileForStd
jr c, .done
call CheckCutTreeTile
jr nz, .whirlpool
callba TryCutOW
jr .asm_97cb9
jr .done
.whirlpool
ld a, [EngineBuffer1]
call CheckWhirlpoolTile
jr nz, .waterfall
callba TryWhirlpoolOW
jr .asm_97cb9
jr .done
.waterfall
ld a, [EngineBuffer1]
call CheckWaterfallTile
jr nz, .headbutt
callba TryWaterfallOW
jr .asm_97cb9
jr .done
.headbutt
ld a, [EngineBuffer1]
call CheckHeadbuttTreeTile
jr nz, .surf
callba TryHeadbuttOW
jr c, .asm_97cb9
jr .asm_97cb7
jr c, .done
jr .noevent
.surf
callba TrySurfOW
jr nc, .asm_97cb7
jr .asm_97cb9
jr nc, .noevent
jr .done
.asm_97cb7
.noevent
xor a
ret
.asm_97cb9
.done
call PlayClickSFX
ld a, $ff
scf

View File

@ -2,9 +2,7 @@
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
add hl, de
add hl, de
add hl, de
add_n_times hl, de, 3
ld b, [hl]
inc hl
ld a, [hli]
@ -16,32 +14,36 @@ Special:: ; c01b
; c029
SpecialsPointers:: ; c029
add_special Function97c28
add_special Function29ce8
add_special Function29d11
add_special Function29d92
add_special Function29e66
add_special Function29e82
add_special Function29efa
add_special Function29eee
add_special Function29c92
add_special Function29cf1
add_special Function29cfa
add_special Function29bfb
add_special Function29c7b
add_special Function29ec4
add_special Function29ed9
add_special Function29eaf
add_special Function29f47
add_special Functionc2f6
add_special Functionc309
add_special Function1050b9
add_special WarpToLastSpawn
; Communications
add_special Special_SetBitsForLinkTradeRequest
add_special Special_WaitForLinkedFriend
add_special Special_CheckLinkTimeout
add_special Special_TryQuickSave
add_special Special_CheckBothSelectedSameRoom
add_special Special_FailedLinkToPast
add_special Special_CloseLink
add_special Special_AbortLink
add_special Special_SetBitsForBattleRequest
add_special Special_SetBitsForTimeCapsuleRequest
add_special Special_CheckTimeCapsuleCompatibility
add_special Special_EnterTimeCapsule
add_special Special_TradeCenter
add_special Special_Colosseum
add_special Special_TimeCapsule
add_special Special_CableClubCheckWhichChris
add_special Special_CheckMysteryGift
add_special Special_GetMysteryGiftItem
add_special Special_UnlockMysteryGift
; Bug Catching Contest
add_special BugContestJudging
add_special CheckPartyFullAfterContest
add_special Function13a12
add_special CheckFirstMonFainted
add_special ContestReturnMons
add_special Function135db
add_special Functionfbb32
add_special Special_GiveParkBalls
add_special Special_CheckMagikarpLength
add_special Functionfbcd2
add_special HealParty
add_special Function1559a
@ -87,7 +89,7 @@ SpecialsPointers:: ; c029
add_special Functionc3ef
add_special Function17421
add_special Function17440
add_special Function139a8
add_special Special_SelectRandomBugContestContestants
add_special Functionc3fc
add_special Function26feb
add_special Function27043
@ -170,7 +172,7 @@ SpecialsPointers:: ; c029
add_special SpecialMonCheck
add_special Functionc225
add_special Function170bd2
add_special Function10366e
add_special Mobile_SelectThreeMons
add_special Function1037eb
add_special Function10383c
add_special Mobile_HealParty
@ -309,21 +311,21 @@ Functionc2e7: ; c2e7
ret
; c2f6
Functionc2f6: ; c2f6
Special_CheckMysteryGift: ; c2f6
ld a, $0
call GetSRAMBank
ld a, [$abe2]
and a
jr z, .asm_c302
jr z, .no
inc a
.asm_c302
.no
ld [ScriptVar], a
call CloseSRAM
ret
; c309
Functionc309: ; c309
Special_GetMysteryGiftItem: ; c309
ld a, $0
call GetSRAMBank
ld a, [$abe2]

View File

@ -357,33 +357,33 @@ BugContestResults_CleanUp
loadmovesprites
dotrigger $0
domaptrigger GROUP_ROUTE_35_NATIONAL_PARK_GATE, MAP_ROUTE_35_NATIONAL_PARK_GATE, $0
setevent EVENT_716
setevent EVENT_717
setevent EVENT_718
setevent EVENT_719
setevent EVENT_71A
setevent EVENT_71B
setevent EVENT_71C
setevent EVENT_71D
setevent EVENT_71E
setevent EVENT_71F
setevent EVENT_720
setevent EVENT_721
setevent EVENT_722
setevent EVENT_723
setevent EVENT_724
setevent EVENT_725
setevent EVENT_726
setevent EVENT_727
setevent EVENT_728
setevent EVENT_729
setevent EVENT_BUG_CATCHING_CONTESTANT_1A
setevent EVENT_BUG_CATCHING_CONTESTANT_2A
setevent EVENT_BUG_CATCHING_CONTESTANT_3A
setevent EVENT_BUG_CATCHING_CONTESTANT_4A
setevent EVENT_BUG_CATCHING_CONTESTANT_5A
setevent EVENT_BUG_CATCHING_CONTESTANT_6A
setevent EVENT_BUG_CATCHING_CONTESTANT_7A
setevent EVENT_BUG_CATCHING_CONTESTANT_8A
setevent EVENT_BUG_CATCHING_CONTESTANT_9A
setevent EVENT_BUG_CATCHING_CONTESTANT_10A
setevent EVENT_BUG_CATCHING_CONTESTANT_1B
setevent EVENT_BUG_CATCHING_CONTESTANT_2B
setevent EVENT_BUG_CATCHING_CONTESTANT_3B
setevent EVENT_BUG_CATCHING_CONTESTANT_4B
setevent EVENT_BUG_CATCHING_CONTESTANT_5B
setevent EVENT_BUG_CATCHING_CONTESTANT_6B
setevent EVENT_BUG_CATCHING_CONTESTANT_7B
setevent EVENT_BUG_CATCHING_CONTESTANT_8B
setevent EVENT_BUG_CATCHING_CONTESTANT_9B
setevent EVENT_BUG_CATCHING_CONTESTANT_10B
setflag ENGINE_DAILY_BUG_CONTEST
special PlayMapMusic
end
; 0xbc31e
BugContestResults_FirstPlace ; 0xbc31e
setevent EVENT_000
setevent EVENT_CHRIS1_IN_CABLE_CLUB
itemtotext SUN_STONE, $1
farwritetext ContestResults_PlayerWonAPrizeText
closetext
@ -439,45 +439,45 @@ BugContestResults_NoRoomForBerry ; 0xbc375
; 0xbc380
BugContestResults_EnsureNoDuplicateSprites ; 0xbc380
checkevent EVENT_716
checkevent EVENT_BUG_CATCHING_CONTESTANT_1A
iftrue .skip1
clearevent EVENT_720
clearevent EVENT_BUG_CATCHING_CONTESTANT_1B
.skip1
checkevent EVENT_717
checkevent EVENT_BUG_CATCHING_CONTESTANT_2A
iftrue .skip2
clearevent EVENT_721
clearevent EVENT_BUG_CATCHING_CONTESTANT_2B
.skip2
checkevent EVENT_718
checkevent EVENT_BUG_CATCHING_CONTESTANT_3A
iftrue .skip3
clearevent EVENT_722
clearevent EVENT_BUG_CATCHING_CONTESTANT_3B
.skip3
checkevent EVENT_719
checkevent EVENT_BUG_CATCHING_CONTESTANT_4A
iftrue .skip4
clearevent EVENT_723
clearevent EVENT_BUG_CATCHING_CONTESTANT_4B
.skip4
checkevent EVENT_71A
checkevent EVENT_BUG_CATCHING_CONTESTANT_5A
iftrue .skip5
clearevent EVENT_724
clearevent EVENT_BUG_CATCHING_CONTESTANT_5B
.skip5
checkevent EVENT_71B
checkevent EVENT_BUG_CATCHING_CONTESTANT_6A
iftrue .skip6
clearevent EVENT_725
clearevent EVENT_BUG_CATCHING_CONTESTANT_6B
.skip6
checkevent EVENT_71C
checkevent EVENT_BUG_CATCHING_CONTESTANT_7A
iftrue .skip7
clearevent EVENT_726
clearevent EVENT_BUG_CATCHING_CONTESTANT_7B
.skip7
checkevent EVENT_71D
checkevent EVENT_BUG_CATCHING_CONTESTANT_8A
iftrue .skip8
clearevent EVENT_727
clearevent EVENT_BUG_CATCHING_CONTESTANT_8B
.skip8
checkevent EVENT_71E
checkevent EVENT_BUG_CATCHING_CONTESTANT_9A
iftrue .skip9
clearevent EVENT_728
clearevent EVENT_BUG_CATCHING_CONTESTANT_9B
.skip9
checkevent EVENT_71F
checkevent EVENT_BUG_CATCHING_CONTESTANT_10A
iftrue .skip10
clearevent EVENT_729
clearevent EVENT_BUG_CATCHING_CONTESTANT_10B
.skip10
end
@ -503,7 +503,7 @@ InitializeEventsScript:
setevent EVENT_6FD
setevent EVENT_GUIDE_GENT_VISIBLE_IN_CHERRYGROVE
setevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER
setevent EVENT_702
setevent EVENT_COP_IN_ELMS_LAB
setevent EVENT_703
setevent EVENT_704
setevent EVENT_BOULDER_IN_ICE_PATH_1
@ -511,26 +511,26 @@ InitializeEventsScript:
setevent EVENT_BOULDER_IN_ICE_PATH_3
setevent EVENT_BOULDER_IN_ICE_PATH_4
setevent EVENT_715
setevent EVENT_716
setevent EVENT_717
setevent EVENT_718
setevent EVENT_719
setevent EVENT_71A
setevent EVENT_71B
setevent EVENT_71C
setevent EVENT_71D
setevent EVENT_71E
setevent EVENT_71F
setevent EVENT_720
setevent EVENT_721
setevent EVENT_722
setevent EVENT_723
setevent EVENT_724
setevent EVENT_725
setevent EVENT_726
setevent EVENT_727
setevent EVENT_728
setevent EVENT_729
setevent EVENT_BUG_CATCHING_CONTESTANT_1A
setevent EVENT_BUG_CATCHING_CONTESTANT_2A
setevent EVENT_BUG_CATCHING_CONTESTANT_3A
setevent EVENT_BUG_CATCHING_CONTESTANT_4A
setevent EVENT_BUG_CATCHING_CONTESTANT_5A
setevent EVENT_BUG_CATCHING_CONTESTANT_6A
setevent EVENT_BUG_CATCHING_CONTESTANT_7A
setevent EVENT_BUG_CATCHING_CONTESTANT_8A
setevent EVENT_BUG_CATCHING_CONTESTANT_9A
setevent EVENT_BUG_CATCHING_CONTESTANT_10A
setevent EVENT_BUG_CATCHING_CONTESTANT_1B
setevent EVENT_BUG_CATCHING_CONTESTANT_2B
setevent EVENT_BUG_CATCHING_CONTESTANT_3B
setevent EVENT_BUG_CATCHING_CONTESTANT_4B
setevent EVENT_BUG_CATCHING_CONTESTANT_5B
setevent EVENT_BUG_CATCHING_CONTESTANT_6B
setevent EVENT_BUG_CATCHING_CONTESTANT_7B
setevent EVENT_BUG_CATCHING_CONTESTANT_8B
setevent EVENT_BUG_CATCHING_CONTESTANT_9B
setevent EVENT_BUG_CATCHING_CONTESTANT_10B
setevent EVENT_72C
setevent EVENT_72F
setevent EVENT_72D
@ -549,7 +549,7 @@ InitializeEventsScript:
setevent EVENT_74D
setevent EVENT_MET_BILL
setevent EVENT_713
setevent EVENT_711
setevent EVENT_MYSTERY_GIFT_DELIVERY_GUY
setevent EVENT_6D4
setevent EVENT_WAREHOUSE_LAYOUT_1
setevent EVENT_WAREHOUSE_BLOCKED_OFF

View File

@ -499,13 +499,14 @@ Function31cf:: ; 31cf
StringCmp:: ; 31db
; Compare c bytes at de and hl.
; Return z if they all match.
.loop
ld a, [de]
cp [hl]
ret nz
inc de
inc hl
dec c
jr nz, StringCmp
jr nz, .loop
ret
; 0x31e4
@ -866,9 +867,7 @@ GetName:: ; 33c3
ld e, a
ld d, 0
ld hl, NamesPointers
add hl, de
add hl, de
add hl, de
add_n_times hl, de, 3
ld a, [hli]
rst Bankswitch
ld a, [hli]
@ -880,7 +879,7 @@ GetName:: ; 33c3
call GetNthString
ld de, StringBuffer1
ld bc, $000d
ld bc, ITEM_NAME_LENGTH
call CopyBytes
.done
@ -1209,7 +1208,7 @@ Function3567:: ; 3567
ld a, [hROMBank]
push af
call Function2c52
call SwitchToMapScriptHeaderBank
call Function3574
pop bc
@ -1355,7 +1354,7 @@ CheckTrainerBattle2:: ; 3600
ld a, [hROMBank]
push af
call Function2c52
call SwitchToMapScriptHeaderBank
call CheckTrainerBattle
pop bc

View File

@ -9,40 +9,48 @@ Function210f:: ; 210f
; 211b
CheckTriggers:: ; 211b
; Checks wCurrentMapTriggerPointer. If it's empty, returns -1 in a. Otherwise, returns the active trigger ID in a.
push hl
ld hl, BikeFlags + 2
ld hl, wCurrentMapTriggerPointer
ld a, [hli]
ld h, [hl]
ld l, a
or h
ld a, [hl]
jr nz, .asm_2128
jr nz, .triggerexists
ld a, -1
.asm_2128
.triggerexists
pop hl
ret
; 212a
GetCurrentMapTrigger:: ; 212a
; Grabs the wram map trigger pointer for the current map and loads it into wCurrentMapTriggerPointer.
; If there are no triggers, both bytes of wCurrentMapTriggerPointer are wiped clean.
; Copy the current map group and number into bc. This is needed for GetMapTrigger.
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
; Blank out wCurrentMapTriggerPointer; this is the default scenario.
xor a
ld [BikeFlags + 2], a
ld [BikeFlags + 3], a
ld [wCurrentMapTriggerPointer], a
ld [wCurrentMapTriggerPointer + 1], a
call GetMapTrigger
ret c
ret c ; The map is not in the trigger table
; Load the trigger table pointer from de into wCurrentMapTriggerPointer
ld a, e
ld [BikeFlags + 2], a
ld [wCurrentMapTriggerPointer], a
ld a, d
ld [BikeFlags + 3], a
ld [wCurrentMapTriggerPointer + 1], a
xor a
ret
; 2147
GetMapTrigger:: ; 2147
; Searches the trigger table for the map group and number loaded in bc, and returns the wram pointer in de.
; If the map is not in the trigger table, returns carry.
push bc
ld a, [hROMBank]
push af
@ -50,34 +58,34 @@ GetMapTrigger:: ; 2147
rst Bankswitch
ld hl, MapTriggers
.asm_2151
.loop
push hl
ld a, [hli]
cp $ff
jr z, .asm_2167
ld a, [hli] ; map group, or terminator
cp -1
jr z, .end ; the current map is not in the trigger table
cp b
jr nz, .asm_2160
ld a, [hli]
jr nz, .next ; map group did not match
ld a, [hli] ; map number
cp c
jr nz, .asm_2160
jr .asm_216a
jr nz, .next ; map number did not match
jr .found ; we found our map
.asm_2160
.next
pop hl
ld de, $0004
ld de, 4 ; size of an entry in the trigger table
add hl, de
jr .asm_2151
jr .loop
.asm_2167
.end
scf
jr .asm_216d
jr .done
.asm_216a
.found
ld e, [hl]
inc hl
ld d, [hl]
.asm_216d
.done
pop hl
pop bc
ld a, b
@ -234,7 +242,7 @@ Function2252:: ; 2252
ld a, [hROMBank]
push af
call Function2c52
call SwitchToMapScriptHeaderBank
call Function2266
pop de
@ -305,7 +313,7 @@ Function22a7:: ; 22a7
ld a, [hROMBank]
push af
call Function2c52
call SwitchToMapScriptHeaderBank
call Function22b4
pop af
@ -381,7 +389,7 @@ Function2300:: ; 2300
Function2309:: ; 2309
call Function2326
call Function2c52
call SwitchToMapScriptHeaderBank
call Function234f
xor a
call Function2336
@ -390,7 +398,7 @@ Function2309:: ; 2309
Function2317:: ; 2317
call Function2326
call Function2c52
call SwitchToMapScriptHeaderBank
call Function234f
ld a, $1
call Function2336
@ -548,7 +556,7 @@ Function23da:: ; 23da
Function23f1:: ; 23f1
ld a, [hli]
ld c, a
ld [wdbfe], a
ld [wCurrentMapXYTriggerCount], a
ld a, l
ld [wdbff], a
ld a, h
@ -564,7 +572,7 @@ Function23f1:: ; 23f1
Function2408:: ; 2408
ld a, [hli]
ld c, a
ld [wdc01], a
ld [wCurrentMapSignpostCount], a
ld a, l
ld [wdc02], a
ld a, h
@ -972,7 +980,7 @@ Function263b:: ; 263b
ld b, a
ld a, [hROMBank]
push af
call Function2c52
call SwitchToMapScriptHeaderBank
call Function2653
jr nc, .done
@ -1607,13 +1615,13 @@ Function298b:: ; 298b
ld a, [TileDown]
and $7
cp $2
jr z, .asm_299f
jr z, .ok
cp $6
jr z, .asm_299f
jr z, .ok
cp $7
ret nz
.asm_299f
.ok
ld a, [TilePermissions]
or $8
ld [TilePermissions], a
@ -1626,13 +1634,13 @@ Function29a8:: ; 29a8
ld a, [TileUp]
and $7
cp $3
jr z, .asm_29bc
jr z, .ok
cp $4
jr z, .asm_29bc
jr z, .ok
cp $5
ret nz
.asm_29bc
.ok
ld a, [TilePermissions]
or $4
ld [TilePermissions], a
@ -1645,13 +1653,13 @@ Function29c5:: ; 29c5
ld a, [TileRight]
and $7
cp $1
jr z, .asm_29d9
jr z, .ok
cp $5
jr z, .asm_29d9
jr z, .ok
cp $7
ret nz
.asm_29d9
.ok
ld a, [TilePermissions]
or $1
ld [TilePermissions], a
@ -1664,13 +1672,13 @@ Function29e2:: ; 29e2
ld a, [TileLeft]
and $7
cp $0
jr z, .asm_29f6
jr z, .ok
cp $4
jr z, .asm_29f6
jr z, .ok
cp $6
ret nz
.asm_29f6
.ok
ld a, [TilePermissions]
or $2
ld [TilePermissions], a
@ -1696,8 +1704,7 @@ GetFacingTileCoord:: ; 2a07
srl a
ld l, a
ld h, 0
add hl, hl
add hl, hl
add_n_times hl, hl, 2
ld de, .Directions
add hl, de
@ -1736,33 +1743,32 @@ Function2a3c:: ; 2a3c
call GetBlockLocation
ld a, [hl]
and a
jr z, .asm_2a63
jr z, .nope
ld l, a
ld h, $0
add hl, hl
add hl, hl
add_n_times hl, hl, 2
ld a, [TilesetCollisionAddress]
ld c, a
ld a, [TilesetCollisionAddress + 1]
ld b, a
add hl, bc
rr d
jr nc, .asm_2a56
jr nc, .nocarry
inc hl
.asm_2a56
.nocarry
rr e
jr nc, .asm_2a5c
jr nc, .nocarry2
inc hl
inc hl
.asm_2a5c
.nocarry2
ld a, [TilesetCollisionBank]
call GetFarByte
ret
.asm_2a63
ld a, $ff
.nope
ld a, -1
ret
; 2a66
@ -1775,20 +1781,20 @@ GetBlockLocation:: ; 2a66
add hl, bc
ld a, e
srl a
jr z, .asm_2a84
jr z, .nope
and a
.asm_2a78
.loop
srl a
jr nc, .asm_2a7d
jr nc, .ok
add hl, bc
.asm_2a7d
.ok
sla c
rl b
and a
jr nz, .asm_2a78
jr nz, .loop
.asm_2a84
.nope
ld c, d
srl c
ld b, $0
@ -1799,128 +1805,138 @@ GetBlockLocation:: ; 2a66
CheckFacingSign:: ; 2a8b
call GetFacingTileCoord
; Load facing into b.
ld b, a
; Convert the coordinates at de to within-boundaries coordinates.
ld a, d
sub 4
ld d, a
ld a, e
sub 4
ld e, a
ld a, [wdc01]
; If there are no signposts, we don't need to be here.
ld a, [wCurrentMapSignpostCount]
and a
ret z
ld c, a
ld a, [hROMBank]
push af
call Function2c52
call Function2aaa
call SwitchToMapScriptHeaderBank
call CheckIfFacingTileCoordIsSign
pop hl
ld a, h
rst Bankswitch
ret
; 2aaa
Function2aaa:: ; 2aaa
CheckIfFacingTileCoordIsSign:: ; 2aaa
; Checks to see if you are facing a signpost. If so, copies it into EngineBuffer1 and sets carry.
ld hl, wdc02
ld a, [hli]
ld h, [hl]
ld l, a
.asm_2ab0
.loop
push hl
ld a, [hli]
cp e
jr nz, .asm_2abb
jr nz, .next
ld a, [hli]
cp d
jr nz, .asm_2abb
jr .asm_2ac8
jr nz, .next
jr .copysign
.asm_2abb
.next
pop hl
ld a, 5
ld a, 5 ; signpost event length
add l
ld l, a
jr nc, .asm_2ac3
jr nc, .nocarry
inc h
.asm_2ac3
.nocarry
dec c
jr nz, .asm_2ab0
jr nz, .loop
xor a
ret
.asm_2ac8
.copysign
pop hl
ld de, EngineBuffer1
ld bc, 5
ld bc, 5 ; signpost event length
call CopyBytes
scf
ret
; 2ad4
Function2ad4:: ; 2ad4
ld a, [wdbfe]
CheckCurrentMapXYTriggers:: ; 2ad4
; If there are no xy triggers, we don't need to be here.
ld a, [wCurrentMapXYTriggerCount]
and a
ret z
; Copy the trigger count into c.
ld c, a
ld a, [hROMBank]
push af
call Function2c52
call Function2ae7
call SwitchToMapScriptHeaderBank
call CheckStandingOnXYTrigger
pop hl
ld a, h
rst Bankswitch
ret
; 2ae7
Function2ae7:: ; 2ae7
CheckStandingOnXYTrigger:: ; 2ae7
; Checks to see if you are standing on an xy-trigger. If yes, copies the trigger to EngineBuffer1 and sets carry.
ld hl, wdbff
ld a, [hli]
ld h, [hl]
ld l, a
; Load the active trigger ID into b
call CheckTriggers
ld b, a
; Load your current coordinates into de. This will be used to check if your position is in the xy-trigger table for the current map.
ld a, [MapX]
sub $4
sub 4
ld d, a
ld a, [MapY]
sub $4
sub 4
ld e, a
.asm_2afd
.loop
push hl
ld a, [hli]
cp b
jr z, .asm_2b06
cp $ff
jr nz, .asm_2b10
jr z, .got_id
cp -1
jr nz, .next
.asm_2b06
.got_id
ld a, [hli]
cp e
jr nz, .asm_2b10
jr nz, .next
ld a, [hli]
cp d
jr nz, .asm_2b10
jr .asm_2b1d
jr nz, .next
jr .copytrigger
.asm_2b10
.next
pop hl
ld a, $8
ld a, $8 ; xy-trigger size
add l
ld l, a
jr nc, .asm_2b18
jr nc, .nocarry
inc h
.asm_2b18
.nocarry
dec c
jr nz, .asm_2afd
jr nz, .loop
xor a
ret
.asm_2b1d
.copytrigger
pop hl
ld de, EngineBuffer1
ld bc, $0008
ld bc, $0008 ; xy-trigger size
call CopyBytes
scf
ret
@ -2139,7 +2155,7 @@ Function2c3d:: ; 2c3d
ret
; 2c52
Function2c52:: ; 2c52
SwitchToMapScriptHeaderBank:: ; 2c52
ld a, [MapScriptHeaderBank]
rst Bankswitch
ret

View File

@ -13,6 +13,7 @@ INCLUDE "macros/pic.asm"
INCLUDE "macros/predef.asm"
INCLUDE "macros/rst.asm"
INCLUDE "macros/mobile.asm"
INCLUDE "macros/trainer.asm"

View File

@ -281,5 +281,6 @@
charmap "<TARGET>", $59
charmap "<USER>", $5a
charmap "<ENEMY>", $3f
charmap "<PKMN>", $4a
charmap "<PLAY_G>", $14 ; <PLAYER> + gender

438
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -446,15 +446,15 @@ AzaleaGym_MapEventHeader:
; signposts
db 2
signpost 13, 3, $0, AzaleaGymStatue
signpost 13, 6, $0, AzaleaGymStatue
signpost 13, 3, SIGNPOST_READ, AzaleaGymStatue
signpost 13, 6, SIGNPOST_READ, AzaleaGymStatue
; people-events
db 7
person_event SPRITE_BUGSY, 11, 9, $3, $0, 255, 255, $a0, 0, BugsyScript_0x18ec1e, -1
person_event SPRITE_BUG_CATCHER, 7, 9, $a, $0, 255, 255, $b2, 2, TrainerBug_catcherBug_catcher_benny, -1
person_event SPRITE_BUG_CATCHER, 12, 12, $6, $0, 255, 255, $b2, 3, TrainerBug_catcherAl, -1
person_event SPRITE_BUG_CATCHER, 6, 4, $6, $0, 255, 255, $b2, 3, TrainerBug_catcherJosh, -1
person_event SPRITE_TWIN, 14, 8, $6, $0, 255, 255, $82, 1, TrainerTwinsAmyandmay1, -1
person_event SPRITE_TWIN, 14, 9, $6, $0, 255, 255, $82, 1, TrainerTwinsAmyandmay2, -1
person_event SPRITE_GYM_GUY, 17, 11, $6, $0, 255, 255, $80, 0, AzaleaGymGuyScript, -1
person_event SPRITE_BUGSY, 11, 9, DOWN << 2 | $3, $0, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, BugsyScript_0x18ec1e, -1
person_event SPRITE_BUG_CATCHER, 7, 9, LEFT << 2 | $2, $0, -1, -1, (PAL_OW_BROWN << 4) | $82, 2, TrainerBug_catcherBug_catcher_benny, -1
person_event SPRITE_BUG_CATCHER, 12, 12, UP << 2 | $2, $0, -1, -1, (PAL_OW_BROWN << 4) | $82, 3, TrainerBug_catcherAl, -1
person_event SPRITE_BUG_CATCHER, 6, 4, UP << 2 | $2, $0, -1, -1, (PAL_OW_BROWN << 4) | $82, 3, TrainerBug_catcherJosh, -1
person_event SPRITE_TWIN, 14, 8, UP << 2 | $2, $0, -1, -1, (PAL_OW_RED << 4) | $82, 1, TrainerTwinsAmyandmay1, -1
person_event SPRITE_TWIN, 14, 9, UP << 2 | $2, $0, -1, -1, (PAL_OW_RED << 4) | $82, 1, TrainerTwinsAmyandmay2, -1
person_event SPRITE_GYM_GUY, 17, 11, UP << 2 | $2, $0, -1, -1, (PAL_OW_RED << 4) | $80, 0, AzaleaGymGuyScript, -1

View File

@ -57,6 +57,6 @@ AzaleaMart_MapEventHeader:
; people-events
db 3
person_event SPRITE_CLERK, 7, 5, $9, $0, 255, 255, $0, 0, ClerkScript_0x18e040, -1
person_event SPRITE_COOLTRAINER_M, 9, 6, $7, $0, 255, 255, $0, 0, CooltrainerMScript_0x18e047, -1
person_event SPRITE_BUG_CATCHER, 6, 11, $5, $2, 255, 255, $80, 0, BugCatcherScript_0x18e04a, -1
person_event SPRITE_CLERK, 7, 5, LEFT << 2 | $1, $0, -1, -1, $0, 0, ClerkScript_0x18e040, -1
person_event SPRITE_COOLTRAINER_M, 9, 6, UP << 2 | $3, $0, -1, -1, $0, 0, CooltrainerMScript_0x18e047, -1
person_event SPRITE_BUG_CATCHER, 6, 11, UP << 2 | $1, $2, -1, -1, (PAL_OW_RED << 4) | $80, 0, BugCatcherScript_0x18e04a, -1

View File

@ -90,7 +90,7 @@ AzaleaPokeCenter1F_MapEventHeader:
; people-events
db 4
person_event SPRITE_NURSE, 5, 7, $6, $0, 255, 255, $0, 0, NurseScript_0x18db28, -1
person_event SPRITE_GENTLEMAN, 10, 13, $4, $10, 255, 255, $0, 0, GentlemanScript_0x18db2b, -1
person_event SPRITE_FISHING_GURU, 5, 10, $6, $0, 255, 255, $0, 0, FishingGuruScript_0x18db2e, -1
person_event SPRITE_POKEFAN_F, 8, 5, $2, $21, 255, 255, $0, 0, PokefanFScript_0x18db31, -1
person_event SPRITE_NURSE, 5, 7, UP << 2 | $2, $0, -1, -1, $0, 0, NurseScript_0x18db28, -1
person_event SPRITE_GENTLEMAN, 10, 13, UP << 2 | $0, $10, -1, -1, $0, 0, GentlemanScript_0x18db2b, -1
person_event SPRITE_FISHING_GURU, 5, 10, UP << 2 | $2, $0, -1, -1, $0, 0, FishingGuruScript_0x18db2e, -1
person_event SPRITE_POKEFAN_F, 8, 5, DOWN << 2 | $2, $21, -1, -1, $0, 0, PokefanFScript_0x18db31, -1

View File

@ -470,27 +470,27 @@ AzaleaTown_MapEventHeader:
; signposts
db 9
signpost 9, 19, $0, AzaleaTownSign
signpost 9, 10, $0, KurtsHouseSign
signpost 15, 14, $0, AzaleaGymSign
signpost 7, 29, $0, SlowpokeWellSign
signpost 13, 19, $0, CharcoalKilnSign
signpost 9, 16, $0, AzaleaTownPokeCenterSign
signpost 5, 22, $0, AzaleaTownMartSign
signpost 9, 3, $0, AzaleaTownIlextForestSign
signpost 6, 31, $7, MapAzaleaTownSignpostItem8
signpost 9, 19, SIGNPOST_READ, AzaleaTownSign
signpost 9, 10, SIGNPOST_READ, KurtsHouseSign
signpost 15, 14, SIGNPOST_READ, AzaleaGymSign
signpost 7, 29, SIGNPOST_READ, SlowpokeWellSign
signpost 13, 19, SIGNPOST_READ, CharcoalKilnSign
signpost 9, 16, SIGNPOST_READ, AzaleaTownPokeCenterSign
signpost 5, 22, SIGNPOST_READ, AzaleaTownMartSign
signpost 9, 3, SIGNPOST_READ, AzaleaTownIlextForestSign
signpost 6, 31, SIGNPOST_ITEMIFSET, MapAzaleaTownSignpostItem8
; people-events
db 12
person_event SPRITE_AZALEA_ROCKET, 13, 35, $6, $0, 255, 255, $0, 0, AzaleaRocketScript_0x1980ab, EVENT_6FA
person_event SPRITE_GRAMPS, 13, 25, $2, $21, 255, 255, $0, 0, GrampsScript_0x1980b1, -1
person_event SPRITE_TEACHER, 17, 19, $4, $20, 255, 255, $90, 0, TeacherScript_0x1980c5, -1
person_event SPRITE_YOUNGSTER, 13, 11, $5, $1, 255, 255, $a0, 0, YoungsterScript_0x1980c8, -1
person_event SPRITE_SLOWPOKE, 21, 12, $1, $0, 255, 255, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 13, 22, $1, $0, 255, 255, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 13, 33, $1, $0, 255, 255, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 19, 19, $1, $0, 255, 255, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_FRUIT_TREE, 6, 12, $1, $0, 255, 255, $0, 0, WhiteApricornTree, -1
person_event SPRITE_AZALEA_ROCKET, 14, 15, $8, $0, 255, 255, $0, 0, ObjectEvent, EVENT_6BF
person_event SPRITE_AZALEA_ROCKET, 20, 14, $6, $0, 255, 255, $0, 0, AzaleaRocketScript_0x1980ae, EVENT_6FC
person_event SPRITE_KURT_OUTSIDE, 9, 10, $8, $0, 255, 255, $0, 0, KurtOutsideScript_0x19810c, EVENT_7A4
person_event SPRITE_AZALEA_ROCKET, 13, 35, UP << 2 | $2, $0, -1, -1, $0, 0, AzaleaRocketScript_0x1980ab, EVENT_6FA
person_event SPRITE_GRAMPS, 13, 25, DOWN << 2 | $2, $21, -1, -1, $0, 0, GrampsScript_0x1980b1, -1
person_event SPRITE_TEACHER, 17, 19, UP << 2 | $0, $20, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, TeacherScript_0x1980c5, -1
person_event SPRITE_YOUNGSTER, 13, 11, UP << 2 | $1, $1, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, YoungsterScript_0x1980c8, -1
person_event SPRITE_SLOWPOKE, 21, 12, DOWN << 2 | $1, $0, -1, -1, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 13, 22, DOWN << 2 | $1, $0, -1, -1, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 13, 33, DOWN << 2 | $1, $0, -1, -1, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_SLOWPOKE, 19, 19, DOWN << 2 | $1, $0, -1, -1, $0, 0, SlowpokeScript_0x1980cb, EVENT_6F9
person_event SPRITE_FRUIT_TREE, 6, 12, DOWN << 2 | $1, $0, -1, -1, $0, 0, WhiteApricornTree, -1
person_event SPRITE_AZALEA_ROCKET, 14, 15, LEFT << 2 | $0, $0, -1, -1, $0, 0, ObjectEvent, EVENT_6BF
person_event SPRITE_AZALEA_ROCKET, 20, 14, UP << 2 | $2, $0, -1, -1, $0, 0, AzaleaRocketScript_0x1980ae, EVENT_6FC
person_event SPRITE_KURT_OUTSIDE, 9, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, KurtOutsideScript_0x19810c, EVENT_7A4

View File

@ -79,7 +79,7 @@ UnknownScript_0x9e40f:
yesorno
iffalse UnknownScript_0x9e3fc
dotrigger $0
special Function29e66
special Special_TryQuickSave
iffalse UnknownScript_0x9e3fc
dotrigger $1
writebyte $1
@ -168,7 +168,7 @@ UnknownScript_0x9e4be:
writetext UnknownText_0x9ef1f
yesorno
iffalse UnknownScript_0x9e3fc
special Function29e66
special Special_TryQuickSave
iffalse UnknownScript_0x9e3fc
writebyte $1
special Function170687
@ -207,7 +207,7 @@ UnknownScript_0x9e515:
yesorno
iffalse UnknownScript_0x9e3fc
dotrigger $0
special Function29e66
special Special_TryQuickSave
iffalse UnknownScript_0x9e3fc
dotrigger $1
writebyte $6
@ -806,12 +806,12 @@ BattleTower1F_MapEventHeader:
; signposts
db 1
signpost 6, 6, $0, MapBattleTower1FSignpost0Script
signpost 6, 6, SIGNPOST_READ, MapBattleTower1FSignpost0Script
; people-events
db 5
person_event SPRITE_RECEPTIONIST, 10, 11, $6, $0, 255, 255, $0, 0, ReceptionistScript_0x9e3e2, -1
person_event SPRITE_YOUNGSTER, 13, 18, $9, $0, 255, 255, $b0, 0, YoungsterScript_0x9e55d, -1
person_event SPRITE_COOLTRAINER_F, 13, 8, $5, $1, 255, 255, $80, 0, CooltrainerFScript_0x9e568, -1
person_event SPRITE_BUG_CATCHER, 7, 5, $2, $11, 255, 255, $90, 0, BugCatcherScript_0x9e56b, -1
person_event SPRITE_GRANNY, 7, 18, $4, $10, 255, 255, $0, 0, GrannyScript_0x9e56e, -1
person_event SPRITE_RECEPTIONIST, 10, 11, UP << 2 | $2, $0, -1, -1, $0, 0, ReceptionistScript_0x9e3e2, -1
person_event SPRITE_YOUNGSTER, 13, 18, LEFT << 2 | $1, $0, -1, -1, (PAL_OW_BROWN << 4) | $80, 0, YoungsterScript_0x9e55d, -1
person_event SPRITE_COOLTRAINER_F, 13, 8, UP << 2 | $1, $1, -1, -1, (PAL_OW_RED << 4) | $80, 0, CooltrainerFScript_0x9e568, -1
person_event SPRITE_BUG_CATCHER, 7, 5, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, BugCatcherScript_0x9e56b, -1
person_event SPRITE_GRANNY, 7, 18, UP << 2 | $0, $10, -1, -1, $0, 0, GrannyScript_0x9e56e, -1

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