You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Implement talker events [commit 2] (#30)
This commit is contained in:
@@ -20,12 +20,22 @@ BoardMenuScript::
|
||||
; save after opentext to reanchor map first
|
||||
; save before processing variables like wCurTurn due to BoardMenuScript reentry after game reset
|
||||
farcall AutoSaveGameInOverworld
|
||||
; reset turn-scoped variables (wDieRoll, wSpacesLeft) and update wCurTurn
|
||||
ld hl, wTurnData
|
||||
ld bc, wTurnDataEnd - wTurnData
|
||||
xor a
|
||||
call ByteFill
|
||||
ld hl, wCurTurn
|
||||
inc [hl]
|
||||
; reset turn-scoped event flags
|
||||
ld hl, wEventFlags + EVENT_LEVEL_SCOPED_FLAGS_START / 8
|
||||
ld c, (EVENT_LEVEL_SCOPED_FLAGS_END / 8) - (EVENT_LEVEL_SCOPED_FLAGS_START / 8)
|
||||
xor a
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec c
|
||||
jr nz, .loop
|
||||
; load the data for the current space to wCurSpaceStruct
|
||||
jp LoadCurSpaceData
|
||||
|
||||
.Die:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
TalkToTrainerScript::
|
||||
faceplayer
|
||||
trainerflagaction CHECK_FLAG
|
||||
trainerortalkerflagaction CHECK_FLAG
|
||||
iftrue AlreadyBeatenTrainerScript
|
||||
loadtemptrainer
|
||||
encountermusic
|
||||
@@ -25,7 +25,7 @@ StartBattleWithMapTrainerScript:
|
||||
loadtemptrainer
|
||||
startbattle
|
||||
reloadmapafterbattle
|
||||
trainerflagaction SET_FLAG
|
||||
trainerortalkerflagaction SET_FLAG
|
||||
loadmem wRunningTrainerBattleScript, -1
|
||||
|
||||
AlreadyBeatenTrainerScript:
|
||||
@@ -34,8 +34,30 @@ AlreadyBeatenTrainerScript:
|
||||
SeenByTalkerScript::
|
||||
waitsfx ; wait for any pending space-related sfx
|
||||
showemote EMOTE_TALK, LAST_TALKED, 20
|
||||
callasm .TalkOrSkipTalker
|
||||
iffalse .skipped
|
||||
callasm TrainerOrTalkerWalkToPlayer
|
||||
applymovementlasttalked wMovementBuffer
|
||||
writeobjectxy LAST_TALKED
|
||||
faceobject PLAYER, LAST_TALKED
|
||||
.skipped
|
||||
end
|
||||
|
||||
.TalkOrSkipTalker:
|
||||
ld a, [wTempTalkerType]
|
||||
and %1
|
||||
cp TALKEREVENTTYPE_MANDATORY
|
||||
jr z, .skip
|
||||
call WaitButton
|
||||
call PlayClickSFX
|
||||
call WaitSFX
|
||||
ldh a, [hJoyPressed]
|
||||
bit A_BUTTON_F, a
|
||||
jr z, .skip ; jump if b was pressed
|
||||
ld a, TRUE
|
||||
jr .done
|
||||
.skip
|
||||
xor a ; FALSE
|
||||
.done
|
||||
ld [hScriptVar], a
|
||||
ret
|
||||
|
||||
@@ -459,7 +459,7 @@ CheckTrainerOrTalkerEvent:
|
||||
call CheckTrainerBattleOrTalkerPrompt
|
||||
jr nc, .nope
|
||||
|
||||
ld a, [wTrainerOrTalkerIsTalker]
|
||||
ld a, [wSeenTrainerOrTalkerIsTalker]
|
||||
and a ; cp FALSE
|
||||
ld a, PLAYEREVENT_SEENBYTRAINER
|
||||
jr z, .done
|
||||
|
||||
@@ -163,7 +163,7 @@ ScriptCommandTable:
|
||||
dw Script_reloadmapafterbattle ; 60
|
||||
dw Script_catchtutorial ; 61
|
||||
dw Script_trainertext ; 62
|
||||
dw Script_trainerflagaction ; 63
|
||||
dw Script_trainerortalkerflagaction ; 63
|
||||
dw Script_winlosstext ; 64
|
||||
dw Script_scripttalkafter ; 65
|
||||
dw Script_endifjustbattled ; 66
|
||||
@@ -685,10 +685,10 @@ Script_scripttalkafter:
|
||||
ld b, a
|
||||
jp ScriptJump
|
||||
|
||||
Script_trainerflagaction:
|
||||
Script_trainerortalkerflagaction:
|
||||
xor a
|
||||
ldh [hScriptVar], a
|
||||
ld hl, wTempTrainerEventFlag
|
||||
ld hl, wTempTrainerEventFlag ; wTempTalkerEventFlag
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
|
||||
Reference in New Issue
Block a user