mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Create level scoped event flags for trainers and talkers, and integrate trainer battles in the board engine (#30)
This commit is contained in:
parent
2596e3c93e
commit
34d9877a1f
@ -1,7 +1,8 @@
|
|||||||
; wEventFlags bit flags
|
; wEventFlags bit flags
|
||||||
|
|
||||||
const_def
|
const_def
|
||||||
; The first eight flags are reset upon reloading the map
|
|
||||||
|
;; The first eight flags are reset upon reloading the map
|
||||||
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1
|
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1
|
||||||
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_2
|
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_2
|
||||||
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_3
|
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_3
|
||||||
@ -11,6 +12,43 @@
|
|||||||
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_7
|
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_7
|
||||||
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_8
|
const EVENT_TEMPORARY_UNTIL_MAP_RELOAD_8
|
||||||
|
|
||||||
|
if (const_value % 8) != 0
|
||||||
|
const_value = const_value + 8 - (const_value % 8)
|
||||||
|
endc
|
||||||
|
EVENT_TEMPORARY_UNTIL_MAP_RELOAD_FLAGS_END EQU const_value
|
||||||
|
|
||||||
|
;; The next flags are reset upon entering a new level (for e.g. trainers)
|
||||||
|
EVENT_LEVEL_SCOPED_FLAGS_START EQU EVENT_TEMPORARY_UNTIL_MAP_RELOAD_FLAGS_END
|
||||||
|
|
||||||
|
const EVENT_LEVEL_SCOPED_1
|
||||||
|
const EVENT_LEVEL_SCOPED_2
|
||||||
|
const EVENT_LEVEL_SCOPED_3
|
||||||
|
const EVENT_LEVEL_SCOPED_4
|
||||||
|
const EVENT_LEVEL_SCOPED_5
|
||||||
|
const EVENT_LEVEL_SCOPED_6
|
||||||
|
const EVENT_LEVEL_SCOPED_7
|
||||||
|
const EVENT_LEVEL_SCOPED_8
|
||||||
|
const EVENT_LEVEL_SCOPED_9
|
||||||
|
const EVENT_LEVEL_SCOPED_10
|
||||||
|
const EVENT_LEVEL_SCOPED_11
|
||||||
|
const EVENT_LEVEL_SCOPED_12
|
||||||
|
const EVENT_LEVEL_SCOPED_13
|
||||||
|
const EVENT_LEVEL_SCOPED_14
|
||||||
|
const EVENT_LEVEL_SCOPED_15
|
||||||
|
const EVENT_LEVEL_SCOPED_16
|
||||||
|
const EVENT_LEVEL_SCOPED_17
|
||||||
|
const EVENT_LEVEL_SCOPED_18
|
||||||
|
const EVENT_LEVEL_SCOPED_19
|
||||||
|
const EVENT_LEVEL_SCOPED_20
|
||||||
|
|
||||||
|
if (const_value % 8) != 0
|
||||||
|
const_value = const_value + 8 - (const_value % 8)
|
||||||
|
endc
|
||||||
|
EVENT_LEVEL_SCOPED_FLAGS_END EQU const_value
|
||||||
|
|
||||||
|
;; The remaining flags are only reset explicitly
|
||||||
|
EVENT_REGULAR_FLAGS_START EQU EVENT_LEVEL_SCOPED_FLAGS_END
|
||||||
|
|
||||||
const EVENT_INITIALIZED_EVENTS
|
const EVENT_INITIALIZED_EVENTS
|
||||||
|
|
||||||
; Decorations
|
; Decorations
|
||||||
|
@ -52,3 +52,4 @@ MapSetupCommands:
|
|||||||
add_mapsetup ConstructAndEnableOverworldHUD ; 2d
|
add_mapsetup ConstructAndEnableOverworldHUD ; 2d
|
||||||
add_mapsetup EnableOverworldHUD ; 2e
|
add_mapsetup EnableOverworldHUD ; 2e
|
||||||
add_mapsetup SpawnInCustomFacing ; 2f
|
add_mapsetup SpawnInCustomFacing ; 2f
|
||||||
|
add_mapsetup ResetLevelScopedEventFlags ; 30
|
||||||
|
@ -23,12 +23,13 @@ MACRO mapsetup
|
|||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
MapSetupScript_EnterLevel:
|
MapSetupScript_EnterLevel:
|
||||||
; same as MapSetupScript_Warp, but includes ConstructAndEnableOverworldHUD
|
; same as MapSetupScript_Warp, but includes ResetLevelScopedEventFlags and ConstructAndEnableOverworldHUD
|
||||||
mapsetup DisableLCD
|
mapsetup DisableLCD
|
||||||
mapsetup InitSound
|
mapsetup InitSound
|
||||||
mapsetup EnterMapSpawnPoint
|
mapsetup EnterMapSpawnPoint
|
||||||
mapsetup LoadMapAttributes
|
mapsetup LoadMapAttributes
|
||||||
mapsetup HandleNewMap
|
mapsetup HandleNewMap
|
||||||
|
mapsetup ResetLevelScopedEventFlags
|
||||||
mapsetup SpawnPlayer
|
mapsetup SpawnPlayer
|
||||||
mapsetup RefreshPlayerCoords
|
mapsetup RefreshPlayerCoords
|
||||||
mapsetup GetMapScreenCoords
|
mapsetup GetMapScreenCoords
|
||||||
|
@ -8,6 +8,7 @@ TalkToTrainerScript::
|
|||||||
|
|
||||||
SeenByTrainerScript::
|
SeenByTrainerScript::
|
||||||
loadtemptrainer
|
loadtemptrainer
|
||||||
|
waitsfx ; wait for any pending space-related sfx
|
||||||
encountermusic
|
encountermusic
|
||||||
showemote EMOTE_SHOCK, LAST_TALKED, 30
|
showemote EMOTE_SHOCK, LAST_TALKED, 30
|
||||||
callasm TrainerWalkToPlayer
|
callasm TrainerWalkToPlayer
|
||||||
|
@ -82,9 +82,6 @@ LoadMapObjects:
|
|||||||
farcall InitializeVisibleSprites
|
farcall InitializeVisibleSprites
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MapSetup_DummyFunction: ; unreferenced
|
|
||||||
ret
|
|
||||||
|
|
||||||
ResetPlayerObjectAction:
|
ResetPlayerObjectAction:
|
||||||
ld hl, wPlayerSpriteSetupFlags
|
ld hl, wPlayerSpriteSetupFlags
|
||||||
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
|
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
|
||||||
@ -194,3 +191,14 @@ ForceMapMusic:
|
|||||||
.notbiking
|
.notbiking
|
||||||
call TryRestartMapMusic
|
call TryRestartMapMusic
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
ResetLevelScopedEventFlags:
|
||||||
|
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
|
||||||
|
ret
|
||||||
|
|
||||||
|
@ -1160,6 +1160,8 @@ Script_startbattle:
|
|||||||
call DisableOverworldHUD
|
call DisableOverworldHUD
|
||||||
ld a, FALSE
|
ld a, FALSE
|
||||||
ld [wText2bpp], a
|
ld [wText2bpp], a
|
||||||
|
ld hl, wDisplaySecondarySprites
|
||||||
|
res SECONDARYSPRITES_SPACES_LEFT_F, [hl]
|
||||||
call BufferScreen
|
call BufferScreen
|
||||||
predef StartBattle
|
predef StartBattle
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
@ -1192,15 +1194,23 @@ Script_reloadmapafterbattle:
|
|||||||
bit 0, d
|
bit 0, d
|
||||||
jr z, .was_wild
|
jr z, .was_wild
|
||||||
farcall MomTriesToBuySomething
|
farcall MomTriesToBuySomething
|
||||||
jr .done
|
jr .next
|
||||||
|
|
||||||
.was_wild
|
.was_wild
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
bit BATTLERESULT_BOX_FULL, a
|
bit BATTLERESULT_BOX_FULL, a
|
||||||
jr z, .done
|
jr z, .next
|
||||||
ld b, BANK(Script_SpecialBillCall)
|
ld b, BANK(Script_SpecialBillCall)
|
||||||
ld de, Script_SpecialBillCall
|
ld de, Script_SpecialBillCall
|
||||||
farcall LoadMemScript
|
farcall LoadMemScript
|
||||||
|
|
||||||
|
.next
|
||||||
|
ld a, [wSpacesLeft]
|
||||||
|
and a
|
||||||
|
jr z, .done
|
||||||
|
farcall LoadBoardMenuDieNumbersGFX
|
||||||
|
ld hl, wDisplaySecondarySprites
|
||||||
|
set SECONDARYSPRITES_SPACES_LEFT_F, [hl]
|
||||||
.done
|
.done
|
||||||
jp Script_reloadmap
|
jp Script_reloadmap
|
||||||
|
|
||||||
|
@ -19,6 +19,45 @@ DebugLevel5_Map1_MapEvents:
|
|||||||
def_bg_events
|
def_bg_events
|
||||||
|
|
||||||
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 9, 2, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 2, .DebugLevel5_Map1TrainerYoungsterMikey2, -1
|
||||||
|
|
||||||
|
.DebugLevel5_Map1TrainerYoungsterMikey1:
|
||||||
|
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_1, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
||||||
|
|
||||||
|
.DebugLevel5_Map1TrainerYoungsterMikey2:
|
||||||
|
trainer YOUNGSTER, MIKEY, EVENT_LEVEL_SCOPED_2, .YoungsterMikeySeenText, .YoungsterMikeyBeatenText, 0, .Script
|
||||||
|
|
||||||
|
.Script:
|
||||||
|
endifjustbattled
|
||||||
|
opentext
|
||||||
|
writetext .YoungsterMikeyAfterText
|
||||||
|
waitbutton
|
||||||
|
closetext
|
||||||
|
end
|
||||||
|
|
||||||
|
.YoungsterMikeySeenText:
|
||||||
|
text "You're a #MON"
|
||||||
|
line "trainer, right?"
|
||||||
|
|
||||||
|
para "Then you have to"
|
||||||
|
line "battle!"
|
||||||
|
done
|
||||||
|
|
||||||
|
.YoungsterMikeyBeatenText:
|
||||||
|
text "That's strange."
|
||||||
|
line "I won before."
|
||||||
|
done
|
||||||
|
|
||||||
|
.YoungsterMikeyAfterText:
|
||||||
|
text "Becoming a good"
|
||||||
|
line "trainer is really"
|
||||||
|
cont "tough."
|
||||||
|
|
||||||
|
para "I'm going to bat-"
|
||||||
|
line "tle other people"
|
||||||
|
cont "to get better."
|
||||||
|
done
|
||||||
|
|
||||||
DebugLevel5_Map1_MapSpaces:
|
DebugLevel5_Map1_MapSpaces:
|
||||||
space 2, 4, $0, 1 ; 0
|
space 2, 4, $0, 1 ; 0
|
||||||
@ -70,6 +109,6 @@ DebugLevel5_Map1_MapSpaces:
|
|||||||
space 16, 4, $0, 8 ; 43
|
space 16, 4, $0, 8 ; 43
|
||||||
|
|
||||||
.BS2:
|
.BS2:
|
||||||
branchdir RIGHT, 3, TECHNIQUE_SURF
|
branchdir RIGHT, 3, 0
|
||||||
branchdir UP, 35, 0
|
branchdir UP, 35, 0
|
||||||
endbranch
|
endbranch
|
||||||
|
Loading…
Reference in New Issue
Block a user