Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SceneMove TalkOver::look(const ScreenEvents& look, WallClock now){
// ended Mom's scene as it went down (lab-B 2026-11-09 14:33).
const bool calm = !box && m_fade_showing == WarpFade::NONE &&
look.has(ScreenEvent::PLAYER_CAN_MOVE) && warped();
const bool quiet = calm && look.has(ScreenEvent::SCREEN_STILL);
const bool quiet = calm && look.has(m_rule.door ? ScreenEvent::PLAYER_STILL : ScreenEvent::SCREEN_STILL);
if (!calm){
m_calm_since = WallClock::max();
}else if (m_calm_since == WallClock::max()){
Expand All @@ -61,9 +61,11 @@ SceneMove TalkOver::look(const ScreenEvents& look, WallClock now){
}else if (m_quiet_since == WallClock::max()){
m_quiet_since = now;
}
const Milliseconds quiet_for = m_rule.door ? TalkOverRule::DOOR_QUIET : TALK_OVER_QUIET;
const Milliseconds calm_for = m_rule.door ? TalkOverRule::DOOR_CALM : TALK_OVER_CALM;
const bool over =
(quiet && now - m_quiet_since >= TALK_OVER_QUIET) ||
(calm && now - m_calm_since >= TALK_OVER_CALM);
(quiet && now - m_quiet_since >= quiet_for) ||
(calm && now - m_calm_since >= calm_for);
if (over && m_rule.end_on_quiet){
return SceneMove::DONE;
}
Expand Down
16 changes: 15 additions & 1 deletion SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ struct TalkOverRule{
// False when a battle is to follow (a trainer's lines pause for more
// than 4 s before it, r210d): no quiet ends the talk then.
bool end_on_quiet = true;
// The settle after a door or a warp, with no text to come: only the
// fade back up and a short still spell around the player count, so
// people walking about (a Center's visitors) neither hold it up nor
// end it early. DOOR_QUIET and DOOR_CALM, not the talk's 5 s and 15 s.
bool door = false;

// The box around the player still this long after the fade is back
// up ends a door's settle; a walk any earlier could still go nowhere
// in the fade-in (lab-B 2026-11-10, 00.04b's nurse).
static constexpr Milliseconds DOOR_QUIET = Milliseconds(1000);
// The overworld back up this long ends it, still or not (someone
// walking past the player the whole time).
static constexpr Milliseconds DOOR_CALM = Milliseconds(2500);
};

// The overworld with no box and a still screen this long ends it: a scene
Expand All @@ -69,7 +82,8 @@ constexpr Milliseconds TALK_OVER_QUIET = Milliseconds(5000);
constexpr Milliseconds TALK_OVER_CALM = Milliseconds(15000);

// When a talk or a scene is over, from looks alone. A look is a frame's
// events: DIALOG_BOX, PLAYER_CAN_MOVE, SCREEN_STILL, a fade,
// events: DIALOG_BOX, PLAYER_CAN_MOVE, SCREEN_STILL (PLAYER_STILL for a
// door's settle), a fade,
// LOCATION_BANNER (the expected map's) and BATTLE_STARTED are read.
// It is over only once every fade has come back up, no box shows, and
// the overworld has been quiet (or calm) since: a look that shows a fade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ enum class ScreenEvent : uint8_t{
PLAYER_CAN_MOVE, // The overworld with the player in control.
SCREEN_STILL, // The screen barely changed since the frame before.
SWITCH_HOME_MENU, // The Switch's HOME menu: the game is not on the screen.
PLAYER_STILL, // A box around the player barely changed since the
// frame before: people walking elsewhere do not count.
};
// How many ScreenEvent values there are.
constexpr size_t SCREEN_EVENT_COUNT = 11;
constexpr size_t SCREEN_EVENT_COUNT = 12;
// "dialog box", for the log.
std::string screen_event_name(ScreenEvent event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ std::string screen_event_name(ScreenEvent event){
case ScreenEvent::PLAYER_CAN_MOVE: return "player can move";
case ScreenEvent::SCREEN_STILL: return "screen still";
case ScreenEvent::SWITCH_HOME_MENU: return "Switch HOME menu";
case ScreenEvent::PLAYER_STILL: return "player still";
}
return "?";
}
Expand Down