working on refactoring
This commit is contained in:
1 parent
9b71ee447a
commit
d5ef126264
12 files changed
+309
-219
No files matched your search
+26
-22
@@ -128,46 +128,50 @@ namespace FRG {
|
||||
void loadGame(int slot);
|
||||
void playMusicForLoadedGame();
|
||||
SaveSlotInfo readSlotInfo(int slot) const;
|
||||
// Locations of the loaded campaign (campaign id -> locations); at most one entry,
|
||||
// empty until the player starts or loads a game. gameState.locations is a copy
|
||||
// of the active campaign's entry.
|
||||
std::unordered_map<std::string, LocationMap> campaignLocations;
|
||||
// Loading model: one campaign at a time, and within it only the location the player
|
||||
// is in (gameState.locations). Leaving a location stores its state in
|
||||
// gameState.storedLocationStates and releases it; the player is created once per
|
||||
// campaign and shared by its locations.
|
||||
std::string loadedCampaignId;
|
||||
std::shared_ptr<Character> player;
|
||||
|
||||
bool isLocationLoaded(const std::string& campaignId, const std::string& locationId) const;
|
||||
// Runs `then` once `locationId` of `campaignId` is the loaded location. If it isn't,
|
||||
// it is loaded first behind its loading screen, releasing the previous location
|
||||
// (or, for another campaign, the whole previous campaign).
|
||||
void enterLocationThen(const std::string& campaignId, const std::string& locationId,
|
||||
std::function<void()> then);
|
||||
// Starts the campaign: its quests and the player. No location is loaded yet.
|
||||
void loadCampaign(const std::string& campaignId);
|
||||
void unloadCampaign();
|
||||
// Builds the campaign's location and restores its stored state, if any.
|
||||
void loadLocation(const std::string& locationId);
|
||||
// Releases the loaded location, keeping its state in storedLocationStates if asked.
|
||||
void unloadLocation(bool storeState);
|
||||
// Teleport zones: moves the player to another location of the campaign.
|
||||
void teleportPlayer(const std::string& destName, const Eigen::Vector3f& destPos, float destRotY);
|
||||
|
||||
// Builds one location from its config and wires the callbacks every location gets.
|
||||
std::shared_ptr<Location> createLocation(const LocationConfig& config);
|
||||
// Wires the callbacks that span a campaign's locations (teleports, dialogue, HUD...).
|
||||
void wireCampaignLocations(LocationMap& locations);
|
||||
// Runs `then` with the campaign active. If its locations aren't loaded, they are
|
||||
// built first behind the campaign's loading screen (one loading step per
|
||||
// location) and any other loaded campaign is released.
|
||||
void loadCampaignThen(const std::string& campaignId, std::function<void()> then);
|
||||
// Releases every loaded campaign's locations and the textures only they used.
|
||||
void unloadCampaigns();
|
||||
// Makes a loaded campaign the played one: its locations and its quest definitions.
|
||||
void activateCampaign(const std::string& campaignId);
|
||||
// Wires the location's callbacks into the game (teleports, dialogue, HUD...).
|
||||
void wireLocation(Location* loc);
|
||||
const CampaignConfig& activeCampaign() const;
|
||||
|
||||
void createShadowMapAndProparateToLocations();
|
||||
void destroyShadowMapAndProparateToLocations();
|
||||
|
||||
// Reset entry point used by "Start New Game": loads the active campaign's start-state
|
||||
// JSON into its existing Location objects, else falls back to performFullReset().
|
||||
// JSON (into the loaded location, storing the rest), else falls back to performFullReset().
|
||||
// Must only ever run from a deferred task (see mainThreadHandler.EnqueueMainThreadTask),
|
||||
// never synchronously from a Lua/cutscene call stack.
|
||||
void performResetToInitialState();
|
||||
// Rebuilds the active campaign's locations from scratch.
|
||||
// Rebuilds the loaded location from scratch and forgets the other locations' states.
|
||||
void performFullReset();
|
||||
// Applies the campaign's tutorial flag and MenuManager::tutorialEnabledSetting to
|
||||
// the freshly reset state (new games only).
|
||||
void applyTutorialSetting();
|
||||
void saveInitialState();
|
||||
|
||||
// (Re-)arms one-shot gameplay callbacks (taxi request) that
|
||||
// wireCampaignLocations() sets up but that get consumed (set to nullptr) once used
|
||||
// during play. Must be called after gameState.load() on the fast reset path,
|
||||
// since that path keeps the existing Location objects instead of recreating them.
|
||||
void rearmOneShotCallbacks(LocationMap& locations);
|
||||
|
||||
int64_t getSyncTimeMs();
|
||||
void processTickCount();
|
||||
void drawScene();
|
||||
|
||||
Reference in new issue
Block a user