Create level scoped event flags for trainers and talkers, and integrate trainer battles in the board engine (#30)

This commit is contained in:
xCrystal
2023-11-28 09:44:10 +01:00
parent 2596e3c93e
commit 34d9877a1f
7 changed files with 106 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ TalkToTrainerScript::
SeenByTrainerScript::
loadtemptrainer
waitsfx ; wait for any pending space-related sfx
encountermusic
showemote EMOTE_SHOCK, LAST_TALKED, 30
callasm TrainerWalkToPlayer

View File

@@ -82,9 +82,6 @@ LoadMapObjects:
farcall InitializeVisibleSprites
ret
MapSetup_DummyFunction: ; unreferenced
ret
ResetPlayerObjectAction:
ld hl, wPlayerSpriteSetupFlags
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
@@ -194,3 +191,14 @@ ForceMapMusic:
.notbiking
call TryRestartMapMusic
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

View File

@@ -1160,6 +1160,8 @@ Script_startbattle:
call DisableOverworldHUD
ld a, FALSE
ld [wText2bpp], a
ld hl, wDisplaySecondarySprites
res SECONDARYSPRITES_SPACES_LEFT_F, [hl]
call BufferScreen
predef StartBattle
ld a, [wBattleResult]
@@ -1192,15 +1194,23 @@ Script_reloadmapafterbattle:
bit 0, d
jr z, .was_wild
farcall MomTriesToBuySomething
jr .done
jr .next
.was_wild
ld a, [wBattleResult]
bit BATTLERESULT_BOX_FULL, a
jr z, .done
jr z, .next
ld b, BANK(Script_SpecialBillCall)
ld de, Script_SpecialBillCall
farcall LoadMemScript
.next
ld a, [wSpacesLeft]
and a
jr z, .done
farcall LoadBoardMenuDieNumbersGFX
ld hl, wDisplaySecondarySprites
set SECONDARYSPRITES_SPACES_LEFT_F, [hl]
.done
jp Script_reloadmap