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
+10
-9
@@ -3,8 +3,9 @@
|
||||
#include "Environment.h"
|
||||
#include "render/TextureManager.h"
|
||||
#include "UiManager.h"
|
||||
#include "Localization.h"
|
||||
#include "items/Item.h"
|
||||
#include "GameState.h"
|
||||
#include "game_server/IGameServer.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
@@ -39,9 +40,9 @@ namespace FRG {
|
||||
std::unordered_map<std::string,
|
||||
std::unordered_map<Language, std::string>> localizedLocationName;
|
||||
|
||||
MenuManager(Renderer& iRenderer, GameState& gameState, AudioPlayerAsync& audioPlayer);
|
||||
MenuManager(Renderer& iRenderer, IGameServer& server, AudioPlayerAsync& audioPlayer);
|
||||
|
||||
void setup(Inventory& inv, const std::string& zipFile);
|
||||
void setup(const std::string& zipFile);
|
||||
|
||||
void openInventory();
|
||||
void selectInventoryItem(int index);
|
||||
@@ -80,7 +81,7 @@ namespace FRG {
|
||||
void setChatUnread(int chatIndex, bool unread, const std::string& previewMsg = "");
|
||||
|
||||
void spendMoney(int amount);
|
||||
int getMoney() const { return gameState_.money; }
|
||||
int getMoney() const { return server_.snapshot()->money; }
|
||||
|
||||
// Starts a new game of the given campaign (see CampaignRegistry).
|
||||
std::function<void(const std::string& campaignId)> startGameFunc;
|
||||
@@ -89,7 +90,6 @@ namespace FRG {
|
||||
std::function<void()> startNightTransitionFunc;
|
||||
std::function<void(int)> chatOpenCallback;
|
||||
std::function<void()> skipCutsceneFunc;
|
||||
std::function<void()> callTaxiFunc;
|
||||
std::function<void(int)> onSaveGame;
|
||||
std::function<void(int)> onLoadGame;
|
||||
std::function<SaveSlotInfo(int)> getSlotInfoFunc;
|
||||
@@ -172,14 +172,14 @@ namespace FRG {
|
||||
Renderer& renderer;
|
||||
|
||||
private:
|
||||
GameState& gameState_;
|
||||
IGameServer& server_;
|
||||
AudioPlayerAsync& audioPlayer_;
|
||||
|
||||
void startNewGame(const std::string& campaignId);
|
||||
// HUD layout for the current location and darklands mode.
|
||||
std::shared_ptr<UiNode> gameplayHudRoot() const;
|
||||
// Single place that decides which HUD buttons and tutorial hints are visible:
|
||||
// buttons follow the inventory, hints follow gameState_.tutorialStep and the
|
||||
// buttons follow the inventory snapshot, hints follow the server tutorial state and
|
||||
// tutorial flags. Runs every frame; names absent from the shown screen are skipped.
|
||||
void refreshHudVisibility();
|
||||
void refreshQuestJournalUi();
|
||||
@@ -249,7 +249,8 @@ namespace FRG {
|
||||
static constexpr float TOAST_VISIBLE_MS = 2000.0f;
|
||||
|
||||
GameUiState uiState_ = GameUiState::Gameplay;
|
||||
Inventory* inventory = nullptr;
|
||||
std::vector<Item> inventoryItems() const;
|
||||
bool hasInventoryItem(const std::string& id) const;
|
||||
bool isPlayerInCreditsMenu = false;
|
||||
int inventorySelectedIndex_ = -1;
|
||||
|
||||
@@ -336,7 +337,7 @@ namespace FRG {
|
||||
enum class PhoneSubScreen { None, Main, Bank, Video, MapDorm, MapUni, ChatList, Chat };
|
||||
PhoneSubScreen currentPhoneSubScreen_ = PhoneSubScreen::None;
|
||||
|
||||
// Phone chat UI state (transient — rebuilt from gameState_.chatHistory on open)
|
||||
// Phone chat UI state (transient — rebuilt from the immutable server snapshot)
|
||||
struct PhoneChatBubbleInfo {
|
||||
std::string nodeName;
|
||||
float height;
|
||||
|
||||
Reference in new issue
Block a user