Implement talker events [commit 2] (#30)

This commit is contained in:
xCrystal
2023-11-28 18:02:00 +01:00
parent 88b6810a18
commit 933fca3b4b
12 changed files with 111 additions and 44 deletions

View File

@@ -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