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 MAPSETUP_00
const_value SET $f1
const MAPSETUP_WARP
const MAPSETUP_02
const MAPSETUP_RELOADMAP
@ -11,6 +10,7 @@ const_value SET $f0
const MAPSETUP_09
const MAPSETUP_10
const MAPSETUP_BADWARP
const MAPSETUP_12
; Command descriptions from Condensation water's scripting compendium. const_def
const_def

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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