Major refactoring - internal server state machine implemented
This commit is contained in:
1 parent
71c654e5b6
commit
66e93d46f4
48 files changed
+3948
-3696
No files matched your search
+15
-8
@@ -22,6 +22,7 @@
|
||||
#include "Location.h"
|
||||
#include "AudioPlayerAsync.h"
|
||||
#include "GameState.h"
|
||||
#include "game_server/InternalGameServer.h"
|
||||
namespace FRG {
|
||||
|
||||
struct LocationConfig;
|
||||
@@ -73,9 +74,7 @@ namespace FRG {
|
||||
// content reload, don't have a meaningful denominator, so the bar is hidden.
|
||||
bool showLoadingProgressBar = true;
|
||||
|
||||
GameState gameState;
|
||||
|
||||
EditorMode editorMode = EditorMode::None;
|
||||
//EditorMode editorMode = EditorMode::None;
|
||||
|
||||
// Returns false if a transition is already in progress.
|
||||
bool startDarklandsTransition();
|
||||
@@ -83,6 +82,16 @@ namespace FRG {
|
||||
|
||||
std::unique_ptr<AudioPlayerAsync> audioPlayer;
|
||||
|
||||
private:
|
||||
InternalGameServer internalGameServer;
|
||||
// Host-only alias while location/script orchestration is moved behind typed
|
||||
// commands. The referenced object is owned by internalGameServer.
|
||||
GameState& gameState;
|
||||
|
||||
public:
|
||||
IGameServer& server() { return internalGameServer; }
|
||||
const IGameServer& server() const { return internalGameServer; }
|
||||
|
||||
MenuManager menuManager;
|
||||
|
||||
void activateSlowMoEffect();
|
||||
@@ -128,10 +137,8 @@ namespace FRG {
|
||||
void loadGame(int slot);
|
||||
void playMusicForLoadedGame();
|
||||
SaveSlotInfo readSlotInfo(int slot) const;
|
||||
// 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.
|
||||
// Loading model: one campaign at a time. InternalGameServer privately owns the
|
||||
// one live Location while GameState retains pure value state for every location.
|
||||
std::string loadedCampaignId;
|
||||
std::shared_ptr<Character> player;
|
||||
|
||||
@@ -146,7 +153,7 @@ namespace FRG {
|
||||
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.
|
||||
// Releases the loaded runtime location, retaining its value state when requested.
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user