PLAYEREVENT_

This commit is contained in:
PikalaxALT 2015-11-05 15:08:00 -05:00
parent adf2fe712d
commit 1205fe5100
13 changed files with 61 additions and 45 deletions

View File

@ -1,5 +1,4 @@
const_value SET $f0 const_value SET $f1
const MAPSETUP_00
const MAPSETUP_WARP const MAPSETUP_WARP
const MAPSETUP_02 const MAPSETUP_02
const MAPSETUP_RELOADMAP const MAPSETUP_RELOADMAP
@ -11,6 +10,7 @@ const_value SET $f0
const MAPSETUP_09 const MAPSETUP_09
const MAPSETUP_10 const MAPSETUP_10
const MAPSETUP_BADWARP const MAPSETUP_BADWARP
const MAPSETUP_12
; Command descriptions from Condensation water's scripting compendium. const_def ; Command descriptions from Condensation water's scripting compendium. const_def
const_def const_def

View File

@ -35,3 +35,17 @@ NUM_VARS EQU const_value
RETVAR_STRBUF2 EQU (0 << 6) RETVAR_STRBUF2 EQU (0 << 6)
RETVAR_ADDR_DE EQU (1 << 6) RETVAR_ADDR_DE EQU (1 << 6)
RETVAR_EXECUTE EQU (2 << 6) RETVAR_EXECUTE EQU (2 << 6)
const_value SET -1
const PLAYEREVENT_MAPSCRIPT
const PLAYEREVENT_NONE
const PLAYEREVENT_SEENBYTRAINER
const PLAYEREVENT_TALKTOTRAINER
const PLAYEREVENT_ITEMBALL
const PLAYEREVENT_4
const PLAYEREVENT_WARP
const PLAYEREVENT_FALL
const PLAYEREVENT_7
const PLAYEREVENT_HATCH
const PLAYEREVENT_9
NUM_PLAYER_EVENTS EQU const_value

View File

@ -322,9 +322,9 @@ PlayerEvents: ; 9681f
ld [ScriptRunning], a ld [ScriptRunning], a
call DoPlayerEvent call DoPlayerEvent
ld a, [ScriptRunning] ld a, [ScriptRunning]
cp 4 cp PLAYEREVENT_4
jr z, .ok2 jr z, .ok2
cp 9 cp PLAYEREVENT_9
jr z, .ok2 jr z, .ok2
xor a xor a
@ -1050,14 +1050,14 @@ DoPlayerEvent: ; 96beb
ld a, [ScriptRunning] ld a, [ScriptRunning]
and a and a
ret z ret z
cp -1 ; run script cp PLAYEREVENT_MAPSCRIPT ; run script
ret z ret z
cp 10 cp NUM_PLAYER_EVENTS
ret nc ret nc
ld c, a ld c, a
ld b, 0 ld b, 0
ld hl, ScriptPointers96c0c ld hl, PlayerEventScriptPointers
rept 3 rept 3
add hl,bc add hl,bc
endr endr
@ -1070,18 +1070,18 @@ endr
ret ret
; 96c0c ; 96c0c
ScriptPointers96c0c: ; 96c0c PlayerEventScriptPointers: ; 96c0c
dba Invalid_0x96c2d dba Invalid_0x96c2d ; 0
dba SeenByTrainerScript dba SeenByTrainerScript ; 1
dba TalkToTrainerScript dba TalkToTrainerScript ; 2
dba FindItemInBallScript dba FindItemInBallScript ; 3
dba UnknownScript_0x96c4d dba UnknownScript_0x96c4d ; 4
dba WarpToNewMapScript dba WarpToNewMapScript ; 5
dba FallIntoMapScript dba FallIntoMapScript ; 6
dba UnknownScript_0x124c8 dba UnknownScript_0x124c8 ; 7
dba HatchEggScript dba HatchEggScript ; 8
dba UnknownScript_0x96c4f dba UnknownScript_0x96c4f ; 9
dba Invalid_0x96c2d dba Invalid_0x96c2d ; 10
; 96c2d ; 96c2d
Invalid_0x96c2d: ; 96c2d Invalid_0x96c2d: ; 96c2d
@ -1122,11 +1122,11 @@ LandAfterPitfallScript: ; 96c4a
end end
; 96c4d ; 96c4d
UnknownScript_0x96c4d: ; 96c4d UnknownScript_0x96c4d: ; 4
reloadandreturn $f7 reloadandreturn MAPSETUP_07
; 96c4f ; 96c4f
UnknownScript_0x96c4f: ; 96c4f UnknownScript_0x96c4f: ; 9
deactivatefacing $3 deactivatefacing $3
callasm SetBit4_ScriptFlags3 callasm SetBit4_ScriptFlags3
end end

View File

@ -1664,7 +1664,7 @@ endr
ret ret
; 0x974f3 ; 0x974f3
Function974f3:: ; 0x974f3 CallCallback:: ; 0x974f3
ld a, [ScriptBank] ld a, [ScriptBank]
or $80 or $80
ld [ScriptBank], a ld [ScriptBank], a

View File

@ -1242,7 +1242,7 @@ Function3574:: ; 3574
ld e, l ld e, l
call Function35de call Function35de
jr nc, .asm_3597 jr nc, .asm_3597
call Function2631 call CallMapScript
callba EnableScriptMode callba EnableScriptMode
scf scf
ret ret

View File

@ -208,7 +208,7 @@ endr
; 222a ; 222a
Function222a:: ; 222a Function222a:: ; 222a
ld a, $fa ld a, MAPSETUP_10
ld [hMapEntryMethod], a ld [hMapEntryMethod], a
callba RunMapSetupScript callba RunMapSetupScript
xor a xor a
@ -967,14 +967,15 @@ CallScript:: ; 261f
ld a, h ld a, h
ld [ScriptPos + 1], a ld [ScriptPos + 1], a
ld a, $ff ld a, PLAYEREVENT_MAPSCRIPT
ld [ScriptRunning], a ld [ScriptRunning], a
scf scf
ret ret
; 2631 ; 2631
Function2631:: ; 2631 CallMapScript:: ; 2631
; Call a script at hl in the current bank if there isn't already a script running
ld a, [ScriptRunning] ld a, [ScriptRunning]
and a and a
ret nz ret nz
@ -988,7 +989,7 @@ RunMapCallback:: ; 263b
ld a, [hROMBank] ld a, [hROMBank]
push af push af
call SwitchToMapScriptHeaderBank call SwitchToMapScriptHeaderBank
call Function2653 call .FindCallback
jr nc, .done jr nc, .done
call GetMapScriptHeaderBank call GetMapScriptHeaderBank
@ -1003,7 +1004,7 @@ RunMapCallback:: ; 263b
ret ret
; 2653 ; 2653
Function2653:: ; 2653 .FindCallback: ; 2653
ld a, [wCurrMapCallbackCount] ld a, [wCurrMapCallbackCount]
ld c, a ld c, a
and a and a
@ -1018,14 +1019,14 @@ Function2653:: ; 2653
.loop .loop
ld a, [hl] ld a, [hl]
cp b cp b
jr z, .done jr z, .found
add hl, de add hl, de
dec c dec c
jr nz, .loop jr nz, .loop
xor a xor a
ret ret
.done .found
inc hl inc hl
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
@ -1035,7 +1036,8 @@ Function2653:: ; 2653
; 2674 ; 2674
ExecuteCallbackScript:: ; 2674 ExecuteCallbackScript:: ; 2674
callba Function974f3 ; Do map callback de and return to script bank b.
callba CallCallback
ld a, [ScriptMode] ld a, [ScriptMode]
push af push af
ld hl, ScriptFlags ld hl, ScriptFlags

View File

@ -141,7 +141,7 @@ NewGame: ; 5b6b
ld a, SPAWN_HOME ld a, SPAWN_HOME
ld [wd001], a ld [wd001], a
ld a, $f1 ld a, MAPSETUP_WARP
ld [hMapEntryMethod], a ld [hMapEntryMethod], a
jp FinishContinueFunction jp FinishContinueFunction
; 5b8f ; 5b8f
@ -451,7 +451,7 @@ Continue: ; 5d65
ld a, [wSpawnAfterChampion] ld a, [wSpawnAfterChampion]
cp SPAWN_LANCE cp SPAWN_LANCE
jr z, .SpawnAfterE4 jr z, .SpawnAfterE4
ld a, $f2 ld a, MAPSETUP_02
ld [hMapEntryMethod], a ld [hMapEntryMethod], a
jp FinishContinueFunction jp FinishContinueFunction
@ -473,7 +473,7 @@ SpawnAfterRed: ; 5de2
PostCreditsSpawn: ; 5de7 PostCreditsSpawn: ; 5de7
xor a xor a
ld [wSpawnAfterChampion], a ld [wSpawnAfterChampion], a
ld a, $f1 ld a, MAPSETUP_WARP
ld [hMapEntryMethod], a ld [hMapEntryMethod], a
ret ret
; 5df0 ; 5df0
@ -5248,7 +5248,7 @@ FlyFunction: ; ca3b
special WarpToSpawnPoint special WarpToSpawnPoint
callasm DelayLoadingNewSprites callasm DelayLoadingNewSprites
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, $0
newloadmap -4 newloadmap MAPSETUP_12
callasm Function8cb33 callasm Function8cb33
special WaitSFX special WaitSFX
callasm Functioncacb callasm Functioncacb
@ -5516,7 +5516,7 @@ UsedDigOrEscapeRopeScript: ; 0xcc3c
farscall UnknownScript_0x122c1 farscall UnknownScript_0x122c1
special WarpToSpawnPoint special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, $0
newloadmap -11 newloadmap MAPSETUP_05
playsound SFX_WARP_FROM playsound SFX_WARP_FROM
applymovement PLAYER, MovementData_0xcc5d applymovement PLAYER, MovementData_0xcc5d
end end
@ -5614,7 +5614,7 @@ Script_UsedTeleport: ; 0xccbb
farscall UnknownScript_0x122c1 farscall UnknownScript_0x122c1
special WarpToSpawnPoint special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, $0
newloadmap -12 newloadmap MAPSETUP_04
playsound SFX_WARP_FROM playsound SFX_WARP_FROM
applymovement PLAYER, MovementData_0xcce3 applymovement PLAYER, MovementData_0xcce3
end end
@ -12257,7 +12257,7 @@ UnknownScript_0x124ce: ; 0x124ce
callasm Function12527 callasm Function12527
farscall UnknownScript_0x122c1 farscall UnknownScript_0x122c1
special WarpToSpawnPoint special WarpToSpawnPoint
newloadmap $f1 newloadmap MAPSETUP_WARP
resetfuncs resetfuncs
.script_64f2 .script_64f2

View File

@ -49,7 +49,7 @@ ColosseumScript_Initialize:
MapColosseumSignpost1Script: MapColosseumSignpost1Script:
special Special_Colosseum special Special_Colosseum
newloadmap $f8 newloadmap MAPSETUP_08
end end
ChrisScript_0x193499: ChrisScript_0x193499:

View File

@ -35,7 +35,7 @@ OfficerScript_0x550ec:
writebyte $0 writebyte $0
special Special_MagnetTrain special Special_MagnetTrain
warpcheck warpcheck
newloadmap $f9 newloadmap MAPSETUP_09
applymovement PLAYER, .MovementBoardTheTrain applymovement PLAYER, .MovementBoardTheTrain
wait $14 wait $14
end end

View File

@ -35,7 +35,7 @@ OfficerScript_0x18a81e:
writebyte $1 writebyte $1
special Special_MagnetTrain special Special_MagnetTrain
warpcheck warpcheck
newloadmap $f9 newloadmap MAPSETUP_09
applymovement PLAYER, .MovementBoardTheTrain applymovement PLAYER, .MovementBoardTheTrain
wait $14 wait $14
end end

View File

@ -39,7 +39,7 @@ TimeCapsule_Initialize:
MapTimeCapsuleSignpost1Script: MapTimeCapsuleSignpost1Script:
special Special_TimeCapsule special Special_TimeCapsule
newloadmap $f8 newloadmap MAPSETUP_08
end end
ChrisScript_0x19351a: ChrisScript_0x19351a:

View File

@ -39,7 +39,7 @@ TradeCenter_Initialize:
MapTradeCenterSignpost1Script: MapTradeCenterSignpost1Script:
special Special_TradeCenter special Special_TradeCenter
newloadmap $f8 newloadmap MAPSETUP_08
end end
ChrisScript_0x19340b: ChrisScript_0x19340b:

View File

@ -406,7 +406,7 @@ Function1002c9: ; 1002c9
; 1002dc ; 1002dc
Function1002dc: ; 1002dc Function1002dc: ; 1002dc
ld a, $f8 ld a, MAPSETUP_08
ld [hMapEntryMethod], a ld [hMapEntryMethod], a
callba RunMapSetupScript callba RunMapSetupScript
xor a xor a