mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Implement talker events [commit 3] (#30)
This commit is contained in:
parent
933fca3b4b
commit
6f4fcf580a
@ -36,11 +36,12 @@ DEF STRING_BUFFER_LENGTH EQU 19
|
|||||||
const PHONE_CONTACTS_FULL ; 1
|
const PHONE_CONTACTS_FULL ; 1
|
||||||
const PHONE_CONTACT_REFUSED ; 2
|
const PHONE_CONTACT_REFUSED ; 2
|
||||||
|
|
||||||
; trainertext arguments
|
; trainerortalkertext arguments
|
||||||
const_def
|
const_def
|
||||||
const TRAINERTEXT_SEEN
|
const TRAINERORTALKERTEXT_TRAINER_SEEN
|
||||||
const TRAINERTEXT_WIN
|
const TRAINERORTALKERTEXT_TRAINER_WIN
|
||||||
const TRAINERTEXT_LOSS
|
const TRAINERORTALKERTEXT_TRAINER_LOSS
|
||||||
|
DEF TRAINERORTALKERTEXT_TALKER EQU -1
|
||||||
|
|
||||||
; readvar/writevar/loadvar arguments
|
; readvar/writevar/loadvar arguments
|
||||||
; _GetVarAction.VarActionTable indexes (see engine/overworld/variables.asm)
|
; _GetVarAction.VarActionTable indexes (see engine/overworld/variables.asm)
|
||||||
|
@ -48,12 +48,11 @@ DEF CONTEXT_USE EQU 1 << CONTEXT_USE_F
|
|||||||
|
|
||||||
; talker events (from talker macro and high bit of wTempTalkerType)
|
; talker events (from talker macro and high bit of wTempTalkerType)
|
||||||
DEF TALKEREVENTTYPE_MASK EQU %10000000
|
DEF TALKEREVENTTYPE_MASK EQU %10000000
|
||||||
DEF TALKEREVENTTYPE_OPTIONAL EQU %0
|
DEF TALKEREVENTTYPE_OPTIONAL EQU %00000000 ; masked
|
||||||
DEF TALKEREVENTTYPE_MANDATORY EQU %1
|
DEF TALKEREVENTTYPE_MANDATORY EQU %10000000 ; masked
|
||||||
|
|
||||||
; talker types (from talker macro and low seven bits of wTempTalkerType)
|
; talker types (from talker macro and low seven bits of wTempTalkerType)
|
||||||
DEF TALKERTYPE_MASK EQU %01111111
|
DEF TALKERTYPE_MASK EQU %01111111
|
||||||
const_def
|
const_def
|
||||||
const TALKERTYPE_TEXT
|
const TALKERTYPE_TEXT
|
||||||
const TALKERTYPE_MODAL_TEXT
|
|
||||||
const TALKERTYPE_SCRIPT
|
const TALKERTYPE_SCRIPT
|
||||||
|
@ -339,7 +339,7 @@ If <code><i>item_id</i></code> = `USE_SCRIPT_VAR`, then it uses `[hScriptVar]` i
|
|||||||
## `$61`: <code>catchtutorial <i>byte</i></code>
|
## `$61`: <code>catchtutorial <i>byte</i></code>
|
||||||
|
|
||||||
|
|
||||||
## `$62`: <code>trainertext <i>text_id</i></code>
|
## `$62`: <code>trainerortalkertext <i>text_id</i></code>
|
||||||
|
|
||||||
|
|
||||||
## `$63`: <code>trainerortalkerflagaction <i>action</i></code>
|
## `$63`: <code>trainerortalkerflagaction <i>action</i></code>
|
||||||
|
@ -28,8 +28,8 @@ BoardMenuScript::
|
|||||||
ld hl, wCurTurn
|
ld hl, wCurTurn
|
||||||
inc [hl]
|
inc [hl]
|
||||||
; reset turn-scoped event flags
|
; reset turn-scoped event flags
|
||||||
ld hl, wEventFlags + EVENT_LEVEL_SCOPED_FLAGS_START / 8
|
ld hl, wEventFlags + EVENT_TURN_SCOPED_FLAGS_START / 8
|
||||||
ld c, (EVENT_LEVEL_SCOPED_FLAGS_END / 8) - (EVENT_LEVEL_SCOPED_FLAGS_START / 8)
|
ld c, (EVENT_TURN_SCOPED_FLAGS_END / 8) - (EVENT_TURN_SCOPED_FLAGS_START / 8)
|
||||||
xor a
|
xor a
|
||||||
.loop
|
.loop
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
@ -19,7 +19,7 @@ SeenByTrainerScript::
|
|||||||
|
|
||||||
StartBattleWithMapTrainerScript:
|
StartBattleWithMapTrainerScript:
|
||||||
opentext
|
opentext
|
||||||
trainertext TRAINERTEXT_SEEN
|
trainerortalkertext TRAINERORTALKERTEXT_TRAINER_SEEN
|
||||||
waitbutton
|
waitbutton
|
||||||
closetext
|
closetext
|
||||||
loadtemptrainer
|
loadtemptrainer
|
||||||
@ -33,6 +33,7 @@ AlreadyBeatenTrainerScript:
|
|||||||
|
|
||||||
SeenByTalkerScript::
|
SeenByTalkerScript::
|
||||||
waitsfx ; wait for any pending space-related sfx
|
waitsfx ; wait for any pending space-related sfx
|
||||||
|
; playsound SFX_
|
||||||
showemote EMOTE_TALK, LAST_TALKED, 20
|
showemote EMOTE_TALK, LAST_TALKED, 20
|
||||||
callasm .TalkOrSkipTalker
|
callasm .TalkOrSkipTalker
|
||||||
iffalse .skipped
|
iffalse .skipped
|
||||||
@ -40,15 +41,31 @@ SeenByTalkerScript::
|
|||||||
applymovementlasttalked wMovementBuffer
|
applymovementlasttalked wMovementBuffer
|
||||||
writeobjectxy LAST_TALKED
|
writeobjectxy LAST_TALKED
|
||||||
faceobject PLAYER, LAST_TALKED
|
faceobject PLAYER, LAST_TALKED
|
||||||
|
callasm .GetTalkerType
|
||||||
|
ifequal TALKERTYPE_TEXT, .Text
|
||||||
|
ifequal TALKERTYPE_SCRIPT, .Script
|
||||||
.skipped
|
.skipped
|
||||||
|
trainerortalkerflagaction SET_FLAG
|
||||||
|
end
|
||||||
|
|
||||||
|
.Text
|
||||||
|
opentext
|
||||||
|
trainerortalkertext TRAINERORTALKERTEXT_TALKER
|
||||||
|
waitbutton
|
||||||
|
closetext
|
||||||
|
trainerortalkerflagaction SET_FLAG
|
||||||
|
end
|
||||||
|
|
||||||
|
.Script
|
||||||
|
trainerortalkerflagaction SET_FLAG
|
||||||
end
|
end
|
||||||
|
|
||||||
.TalkOrSkipTalker:
|
.TalkOrSkipTalker:
|
||||||
ld a, [wTempTalkerType]
|
ld a, [wTempTalkerType]
|
||||||
and %1
|
and TALKEREVENTTYPE_MASK
|
||||||
cp TALKEREVENTTYPE_MANDATORY
|
cp TALKEREVENTTYPE_MANDATORY
|
||||||
jr z, .skip
|
jr z, .skip
|
||||||
call WaitButton
|
call JoyWaitAorB
|
||||||
call PlayClickSFX
|
call PlayClickSFX
|
||||||
call WaitSFX
|
call WaitSFX
|
||||||
ldh a, [hJoyPressed]
|
ldh a, [hJoyPressed]
|
||||||
@ -61,3 +78,9 @@ SeenByTalkerScript::
|
|||||||
.done
|
.done
|
||||||
ld [hScriptVar], a
|
ld [hScriptVar], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.GetTalkerType:
|
||||||
|
ld a, [wTempTalkerType]
|
||||||
|
and TALKERTYPE_MASK
|
||||||
|
ld [hScriptVar], a
|
||||||
|
ret
|
@ -162,7 +162,7 @@ ScriptCommandTable:
|
|||||||
dw Script_startbattle ; 5f
|
dw Script_startbattle ; 5f
|
||||||
dw Script_reloadmapafterbattle ; 60
|
dw Script_reloadmapafterbattle ; 60
|
||||||
dw Script_catchtutorial ; 61
|
dw Script_catchtutorial ; 61
|
||||||
dw Script_trainertext ; 62
|
dw Script_trainerortalkertext ; 62
|
||||||
dw Script_trainerortalkerflagaction ; 63
|
dw Script_trainerortalkerflagaction ; 63
|
||||||
dw Script_winlosstext ; 64
|
dw Script_winlosstext ; 64
|
||||||
dw Script_scripttalkafter ; 65
|
dw Script_scripttalkafter ; 65
|
||||||
@ -661,13 +661,17 @@ Script_swarm:
|
|||||||
farcall StoreSwarmMapIndices
|
farcall StoreSwarmMapIndices
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Script_trainertext:
|
Script_trainerortalkertext:
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
|
cp TRAINERORTALKERTEXT_TALKER
|
||||||
|
ld hl, wTempTalkerTextOrScriptPointer
|
||||||
|
jr z, .next
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wSeenTextPointer
|
ld hl, wSeenTextPointer
|
||||||
add hl, bc
|
add hl, bc
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
.next
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
ld l, a
|
ld l, a
|
||||||
|
@ -626,9 +626,9 @@ MACRO catchtutorial
|
|||||||
db \1 ; byte
|
db \1 ; byte
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
const trainertext_command ; $62
|
const trainerortalkertext_command ; $62
|
||||||
MACRO trainertext
|
MACRO trainerortalkertext
|
||||||
db trainertext_command
|
db trainerortalkertext_command
|
||||||
db \1 ; text_id
|
db \1 ; text_id
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -245,10 +245,10 @@ ENDM
|
|||||||
MACRO talker
|
MACRO talker
|
||||||
;\1: flag: an EVENT_* constant
|
;\1: flag: an EVENT_* constant
|
||||||
;\2: OPTIONAL or MANDATORY
|
;\2: OPTIONAL or MANDATORY
|
||||||
;\3: talker type: TEXT, MODAL_TEXT, SCRIPT
|
;\3: talker type: TEXT, SCRIPT
|
||||||
;\4: pointer to talker data
|
;\4: pointer to talker text or script
|
||||||
dw \1
|
dw \1
|
||||||
db \2 | \3
|
db TALKEREVENTTYPE_\2 | TALKERTYPE_\3
|
||||||
dw \4
|
dw \4
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ DebugLevel5_Map1_MapEvents:
|
|||||||
|
|
||||||
def_object_events
|
def_object_events
|
||||||
object_event 10, 2, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 2, .DebugLevel5_Map1TrainerYoungsterMikey1, -1
|
object_event 10, 2, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 2, .DebugLevel5_Map1TrainerYoungsterMikey1, -1
|
||||||
object_event 9, 2, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 2, .DebugLevel5_Map1TrainerYoungsterMikey2, -1
|
object_event 9, 2, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TALKER, 2, .DebugLevel5_Map1Talker1, -1
|
||||||
|
|
||||||
.DebugLevel5_Map1TrainerYoungsterMikey1:
|
.DebugLevel5_Map1TrainerYoungsterMikey1:
|
||||||
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_1, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_1, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
||||||
@ -28,15 +28,12 @@ DebugLevel5_Map1_MapEvents:
|
|||||||
.DebugLevel5_Map1TrainerYoungsterMikey2:
|
.DebugLevel5_Map1TrainerYoungsterMikey2:
|
||||||
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_2, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_2, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
||||||
|
|
||||||
; talker EVENT_TURN_SCOPED_*, OPTIONAL/MANDATORY | TEXT/MODAL_TEXT/SCRIPT, .Data
|
.DebugLevel5_Map1Talker1:
|
||||||
; .Data: ; Text
|
talker EVENT_TURN_SCOPED_1, OPTIONAL, TEXT, .Text
|
||||||
; db .Text
|
|
||||||
; .Data: ; Modal text
|
.Text:
|
||||||
; dw EVENT_*, .Text1
|
text "I'm a talker!"
|
||||||
; dw EVENT_*, .Text2
|
done
|
||||||
; dw DEFAULT_TEXT, .DefaultText
|
|
||||||
; .Data: ; Script
|
|
||||||
; end
|
|
||||||
|
|
||||||
.Script:
|
.Script:
|
||||||
endifjustbattled
|
endifjustbattled
|
||||||
|
@ -1576,7 +1576,7 @@ NEXTU
|
|||||||
wTempTalker::
|
wTempTalker::
|
||||||
wTempTalkerEventFlag:: dw
|
wTempTalkerEventFlag:: dw
|
||||||
wTempTalkerType:: db
|
wTempTalkerType:: db
|
||||||
wTempTalkerDataPointer:: dw
|
wTempTalkerTextOrScriptPointer:: dw
|
||||||
wTempTalkerEnd::
|
wTempTalkerEnd::
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
|
Loading…
Reference in New Issue
Block a user