working on campaign

This commit is contained in:
Vladislav Khorev committed 2026-10-23 22:47:55 +06:00
1 parent 9fa120d4ad
commit d38a75ea72
24 files changed
+929 -410

No files matched your search

+25 -10
View File
@@ -24,7 +24,11 @@
#include "GameState.h"
namespace FRG {
struct LocationConfig;
struct CampaignConfig;
struct SaveSlotInfo {
std::string campaignId;
std::string locationName;
std::string savedAt;
bool empty = true;
@@ -123,29 +127,40 @@ namespace FRG {
void saveGame(int slot);
void loadGame(int slot);
SaveSlotInfo readSlotInfo(int slot) const;
void createLocationsStep1();
void createLocationsStep2();
void createLocationsStep3();
void createLocationsStep4();
void createLocationsStep5();
// Every campaign's locations, all built at startup (campaign id -> locations).
// gameState.locations is a copy of the active campaign's entry.
std::unordered_map<std::string, LocationMap> campaignLocations;
// 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);
// Queues one loading step per location of `campaign`, plus its wiring step.
void queueCampaignBuildSteps(const CampaignConfig& campaign);
// Makes `campaignId` the played campaign: its locations and its quest definitions.
void activateCampaign(const std::string& campaignId);
const CampaignConfig& activeCampaign() const;
void createShadowMapAndProparateToLocations();
void destroyShadowMapAndProparateToLocations();
// Reset entry point used by "Start New Game": loads resources/config/start_state.json
// into the existing Location objects if present, else falls back to performFullReset().
// 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().
// 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.
void performFullReset();
// Applies MenuManager::tutorialEnabledSetting to the freshly reset state (new games only).
// 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
// createLocations() wires up but that get consumed (set to nullptr) once used
// 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 rearmDormOneShotCallbacks();
void rearmOneShotCallbacks(LocationMap& locations);
int64_t getSyncTimeMs();
void processTickCount();