Changeset View
Changeset View
Standalone View
Standalone View
source/ps/Game.cpp
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||||||||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||||||||||
* | * | ||||||||||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||||||||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||||||||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||||||||||
* (at your option) any later version. | * (at your option) any later version. | ||||||||||||
* | * | ||||||||||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||||||||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | CGame::CGame(bool replayLog): | ||||||||||||
m_GameView(CRenderer::IsInitialised() ? new CGameView(this) : nullptr), | m_GameView(CRenderer::IsInitialised() ? new CGameView(this) : nullptr), | ||||||||||||
m_GameStarted(false), | m_GameStarted(false), | ||||||||||||
m_Paused(false), | m_Paused(false), | ||||||||||||
m_SimRate(1.0f), | m_SimRate(1.0f), | ||||||||||||
m_PlayerID(-1), | m_PlayerID(-1), | ||||||||||||
m_ViewedPlayerID(-1), | m_ViewedPlayerID(-1), | ||||||||||||
m_IsSavedGame(false), | m_IsSavedGame(false), | ||||||||||||
m_IsVisualReplay(false), | m_IsVisualReplay(false), | ||||||||||||
m_IsEditorGame(false), | |||||||||||||
m_ReplayStream(NULL) | m_ReplayStream(NULL) | ||||||||||||
{ | { | ||||||||||||
// TODO: should use CDummyReplayLogger unless activated by cmd-line arg, perhaps? | // TODO: should use CDummyReplayLogger unless activated by cmd-line arg, perhaps? | ||||||||||||
if (replayLog) | if (replayLog) | ||||||||||||
m_ReplayLogger = new CReplayLogger(m_Simulation2->GetScriptInterface()); | m_ReplayLogger = new CReplayLogger(m_Simulation2->GetScriptInterface()); | ||||||||||||
else | else | ||||||||||||
m_ReplayLogger = new CDummyReplayLogger(); | m_ReplayLogger = new CDummyReplayLogger(); | ||||||||||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& savedState) | ||||||||||||
if (Script::HasProperty(rq, attribs, "gameSpeed")) | if (Script::HasProperty(rq, attribs, "gameSpeed")) | ||||||||||||
{ | { | ||||||||||||
if (Script::GetProperty(rq, attribs, "gameSpeed", speed)) | if (Script::GetProperty(rq, attribs, "gameSpeed", speed)) | ||||||||||||
SetSimRate(speed); | SetSimRate(speed); | ||||||||||||
else | else | ||||||||||||
LOGERROR("GameSpeed could not be parsed."); | LOGERROR("GameSpeed could not be parsed."); | ||||||||||||
} | } | ||||||||||||
if (Script::HasProperty(rq, attribs, "editorType")) | |||||||||||||
m_IsEditorGame = true; | |||||||||||||
StanUnsubmitted Not Done Inline Actions
Stan: | |||||||||||||
LDR_BeginRegistering(); | LDR_BeginRegistering(); | ||||||||||||
RegMemFun(m_Simulation2, &CSimulation2::ProgressiveLoad, L"Simulation init", 1000); | RegMemFun(m_Simulation2, &CSimulation2::ProgressiveLoad, L"Simulation init", 1000); | ||||||||||||
// RC, 040804 - GameView needs to be initialized before World, otherwise GameView initialization | // RC, 040804 - GameView needs to be initialized before World, otherwise GameView initialization | ||||||||||||
// overwrites anything stored in the map file that gets loaded by CWorld::Initialize with default | // overwrites anything stored in the map file that gets loaded by CWorld::Initialize with default | ||||||||||||
// values. At the minute, it's just lighting settings, but could be extended to store camera position. | // values. At the minute, it's just lighting settings, but could be extended to store camera position. | ||||||||||||
// Storing lighting settings in the game view seems a little odd, but it's no big deal; maybe move it at | // Storing lighting settings in the game view seems a little odd, but it's no big deal; maybe move it at | ||||||||||||
▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator