OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Game Class Reference

#include <C4Game.h>

Collaboration diagram for C4Game:
[legend]

Public Types

enum  InitMode { IM_Normal = 0, IM_Section = 1, IM_ReInit = 2 }
 

Public Member Functions

 C4Game ()
 
 ~C4Game ()
 
void Clear ()
 
void Abort (bool fApproved=false)
 
void Evaluate ()
 
void ShowGameOverDlg ()
 
bool DoKeyboardInput (C4KeyCode vk_code, C4KeyEventType eEventType, bool fAlt, bool fCtrl, bool fShift, bool fRepeated, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
 
bool DoKeyboardInput (C4KeyCodeEx Key, C4KeyEventType eEventType, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
 
void DrawCrewOverheadText (C4TargetFacet &cgo, int32_t iPlayer)
 
void FixRandom (uint64_t iSeed)
 
bool Init ()
 
bool PreInit ()
 
void SetScenarioFilename (const char *)
 
bool HasScenario ()
 
bool Execute ()
 
C4PlayerJoinPlayer (const char *szFilename, int32_t iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo)
 
void OnPlayerJoinFinished ()
 
bool DoGameOver ()
 
bool CanQuickSave ()
 
bool QuickSave (const char *strFilename, const char *strTitle, bool fForceSave=false)
 
void SetInitProgress (float fToProgress)
 
void OnResolutionChanged (unsigned int iXRes, unsigned int iYRes)
 
void OnKeyboardLayoutChanged ()
 
void InitFullscreenComponents (bool fRunning)
 
bool ToggleChat ()
 
bool TogglePause ()
 
bool Pause ()
 
bool Unpause ()
 
bool IsPaused ()
 
void Synchronize (bool fSavePlayerFiles)
 
void SyncClearance ()
 
bool DropFile (const char *szFilename, float iX, float iY)
 
bool DropDef (C4ID id, float iX, float iY)
 
bool ReloadFile (const char *szPath)
 
bool ReloadDef (C4ID id)
 
bool ReloadParticle (const char *szName)
 
void ClearPointers (C4Object *cobj)
 
C4ObjectCreateObject (C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
 
C4ObjectCreateObject (C4ID type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
 
C4ObjectCreateObjectConstruction (C4PropList *type, C4Object *pCreator, int32_t owner, int32_t ctx=0, int32_t bty=0, int32_t con=1, bool terrain=false)
 
C4ObjectCreateInfoObject (C4ObjectInfo *cinf, int32_t owner, int32_t tx=50, int32_t ty=50)
 
C4ObjectFindConstuctionSiteBlock (int32_t tx, int32_t ty, int32_t wdt, int32_t hgt)
 
C4ObjectFindObject (C4Def *pDef, int32_t iX=0, int32_t iY=0, int32_t iWdt=0, int32_t iHgt=0, DWORD ocf=OCF_All, C4Object *pFindNext=nullptr)
 
C4ObjectFindVisObject (float tx, float ty, int32_t iPlr, const C4Facet &fctViewportGame, const C4Facet &fctViewportGUI, float iX, float iY, DWORD category, float gui_x, float gui_y)
 
int32_t ObjectCount (C4ID id)
 
void CastObjects (C4ID id, C4Object *pCreator, int32_t num, int32_t level, int32_t tx, int32_t ty, int32_t iOwner=NO_OWNER, int32_t iController=NO_OWNER, C4ValueArray *out_objects=nullptr)
 
C4ObjectPlaceVegetation (C4PropList *def, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iGrowth, C4PropList *shape_proplist, C4PropList *out_pos_proplist)
 
C4ObjectPlaceAnimal (C4PropList *def)
 
C4Value GRBroadcast (const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false, bool fRejectTest=false)
 
bool LoadScenarioSection (const char *szSection, DWORD dwFlags)
 
bool CreateSectionFromTempFile (const char *section_name, const char *temp_filename)
 
bool DrawTextSpecImage (C4Facet &fctTarget, const char *szSpec, class C4DrawTransform *pTransform, uint32_t dwClr=0xff)
 
float GetTextSpecImageAspect (const char *szSpec)
 
bool DrawPropListSpecImage (C4Facet &fctTarget, C4PropList *pSpec)
 
bool SpeedUp ()
 
bool SlowDown ()
 
bool InitKeyboard ()
 
void UpdateLanguage ()
 
bool InitPlayerControlSettings ()
 
bool InitPlayerControlUserSettings ()
 
void SetDefaultGamma ()
 
bool LoadAdditionalSystemGroup (class C4Group &parent_group)
 
bool SaveGameTitle (C4Group &hGroup)
 
void CompileFunc (StdCompiler *pComp, CompileSettings comp, C4ValueNumbers *)
 
bool SaveData (C4Group &hGroup, bool fSaveSection, bool fSaveExact, bool fSaveSync, C4ValueNumbers *)
 
bool ToggleChart ()
 
void SetGlobalSoundModifier (C4PropList *modifier_props)
 
C4StringGetTranslatedString (const class C4Value &input_string, C4Value *selected_language, bool fail_silently) const
 
C4PropListAllocateTranslatedString ()
 

Public Attributes

C4GameParametersParameters
 
class C4ScenarioParametersStartupScenarioParameters
 
C4ClientListClients
 
C4TeamListTeams
 
C4PlayerInfoListPlayerInfos
 
C4PlayerInfoListRestorePlayerInfos
 
C4RoundResultsRoundResults
 
C4Scenario C4S
 
class C4ScenarioParameterDefsScenarioParameterDefs
 
C4ComponentHost Info
 
C4ComponentHost Title
 
C4ComponentHost Names
 
C4ComponentHost GameText
 
C4LangStringTable MainSysLangStringTable
 
C4LangStringTable ScenarioLangStringTable
 
StdStrBuf PlayerNames
 
C4ControlInput
 
C4PathFinder PathFinder
 
C4TransferZones TransferZones
 
C4Group ScenarioFile
 
C4GroupSet GroupSet
 
C4GrouppParentGroup
 
C4Extra Extra
 
class C4ScenarioObjectsScriptHostpScenarioObjectsScript
 
C4ScenarioSectionpScenarioSections
 
C4ScenarioSectionpCurrentScenarioSection
 
C4PlayerControlDefs PlayerControlDefs
 
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
 
C4PlayerControlAssignmentSets PlayerControlDefaultAssignmentSets
 
C4Scoreboard Scoreboard
 
std::unique_ptr< C4Network2StatspNetworkStatistics
 
C4KeyboardInputKeyboardInput
 
std::unique_ptr< C4FileMonitorpFileMonitor
 
std::unique_ptr< C4GameSec1TimerpSec1Timer
 
C4ValueGlobalSoundModifier
 
char CurrentScenarioSection [C4MaxName+1]
 
char ScenarioFilename [_MAX_PATH+1]
 
StdCopyStrBuf ScenarioTitle
 
char PlayerFilenames [20 *_MAX_PATH+1]
 
char DefinitionFilenames [20 *_MAX_PATH+1]
 
char DirectJoinAddress [_MAX_PATH+1]
 
char DirectJoinTempFilename [_MAX_PATH+1]
 
std::unique_ptr
< C4Network2Reference
pJoinReference
 
int32_t StartupPlayerCount
 
int32_t StartupTeamCount
 
int32_t FPS
 
int32_t cFPS
 
int32_t HaltCount
 
bool InitialPlayersJoined
 
bool GameOver
 
bool Evaluated
 
bool GameOverDlgShown
 
bool fScriptCreatedObjects
 
bool fLobby
 
int32_t iLobbyTimeout
 
bool fObserve
 
bool fReferenceDefinitionOverride
 
bool NetworkActive
 
bool Record
 
StdStrBuf RecordDumpFile
 
StdStrBuf RecordStream
 
StdStrBuf TempScenarioFile
 
bool fPreinited {false}
 
int32_t FrameCounter
 
int32_t iTick2
 
int32_t iTick3
 
int32_t iTick5
 
int32_t iTick10
 
int32_t iTick35
 
int32_t iTick255
 
int32_t iTick1000
 
bool TimeGo
 
int32_t Time
 
int32_t StartTime
 
int32_t InitProgress
 
int32_t LastInitProgress
 
int32_t LastInitProgressShowTime
 
int32_t RandomSeed
 
bool GameGo
 
bool FullSpeed
 
int32_t FrameSkip
 
bool DoSkipFrame
 
bool fResortAnyObject
 
bool IsRunning
 
bool PointersDenumerated
 
size_t StartupLogPos {0}
 
size_t QuitLogPos {0}
 
bool fQuitWithError {false}
 
bool DebugMode
 
StdCopyStrBuf NextMission
 
StdCopyStrBuf NextMissionText
 
StdCopyStrBuf NextMissionDesc
 
uint16_t DebugPort
 
StdStrBuf DebugPassword
 
StdStrBuf DebugHost
 
int DebugWait
 
std::unique_ptr
< C4ScriptGuiWindow
ScriptGuiRoot
 

Static Public Attributes

static constexpr const char * DirectJoinFilePrefix = "file:"
 

Protected Member Functions

void Default ()
 
void InitInEarth ()
 
void InitVegetation ()
 
void InitAnimals ()
 
void InitGoals ()
 
void InitRules ()
 
void InitValueOverloads ()
 
void InitEnvironment ()
 
void CloseScenario ()
 
void DeleteObjects (bool fDeleteInactive)
 
void ExecObjects ()
 
void Ticks ()
 
bool CheckObjectEnumeration ()
 
bool LoadScenarioComponents ()
 
bool InitGame (C4Group &hGroup, InitMode init_mode, bool fLoadSky, C4ValueNumbers *)
 
bool InitGameFinal (InitMode init_mode)
 
bool InitNetworkFromAddress (const char *szAddress)
 
bool InitNetworkFromReferenceFile (const char *temp_filename)
 
bool InitNetworkFromReference (const C4Network2Reference &Reference)
 
bool InitNetworkHost ()
 
bool InitControl ()
 
bool InitScriptEngine ()
 
bool LinkScriptEngine ()
 
bool ReLinkScriptEngine ()
 
bool InitPlayers (C4ValueNumbers *)
 
bool OpenScenario ()
 
bool InitDefs ()
 
bool InitMaterialTexture ()
 
bool GameOverCheck ()
 
bool PlaceInEarth (C4ID id)
 
bool CompileRuntimeData (C4Group &hGroup, InitMode init_mode, bool exact, bool sync, C4ValueNumbers *)
 
C4ObjectNewObject (C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
 
void ClearObjectPtrs (C4Object *tptr)
 
void ObjectRemovalCheck ()
 
bool ToggleDebugMode ()
 
bool ActivateMenu (const char *szCommand)
 

Detailed Description

Definition at line 32 of file C4Game.h.

Member Enumeration Documentation

Enumerator
IM_Normal 
IM_Section 
IM_ReInit 

Definition at line 36 of file C4Game.h.

37  {
38  IM_Normal = 0,
39  IM_Section = 1,
40  IM_ReInit = 2
41  };

Constructor & Destructor Documentation

C4Game::C4Game ( )

Definition at line 97 of file C4Game.cpp.

References Default().

97  :
98  ScenarioParameterDefs(GameScenarioParameterDefs),
99  Parameters(GameParameters),
100  StartupScenarioParameters(GameStartupScenarioParameters),
105  RoundResults(GameRoundResults),
109  GlobalSoundModifier(GameGlobalSoundModifier)
110 {
111  Default();
112 }
C4PlayerInfoList & RestorePlayerInfos
Definition: C4Game.h:72
C4Value & GlobalSoundModifier
Definition: C4Game.h:99
C4ClientList Clients
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:75
C4GameParameters & Parameters
Definition: C4Game.h:67
C4TeamList & Teams
Definition: C4Game.h:70
C4GameControl Control
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:96
C4Control Input
Definition: C4GameControl.h:66
void Default()
Definition: C4Game.cpp:1444
C4RoundResults & RoundResults
Definition: C4Game.h:73
C4PlayerInfoList RestorePlayerInfos
C4KeyboardInput & C4KeyboardInput_Init()
C4Control & Input
Definition: C4Game.h:82
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:71
class C4ScenarioParameters & StartupScenarioParameters
Definition: C4Game.h:68
C4PlayerInfoList PlayerInfos
C4ClientList & Clients
Definition: C4Game.h:69
std::unique_ptr< C4GameSec1Timer > pSec1Timer
Definition: C4Game.h:98

Here is the call graph for this function:

C4Game::~C4Game ( )

Definition at line 114 of file C4Game.cpp.

References C4Startup::Unload().

115 {
116  // make sure no startup gfx remain loaded
118 }
static void Unload()
Definition: C4Startup.cpp:301

Here is the call graph for this function:

Member Function Documentation

void C4Game::Abort ( bool  fApproved = false)

Definition at line 3666 of file C4Game.cpp.

References Application, C4GameControl::ClientID(), Control, Game, GameOver, C4PlayerList::GetLocalByIndex(), C4GameControl::isCtrlHost(), C4Network2::isEnabled(), C4GameParameters::isLeague(), Network, Parameters, Players, C4Application::QuitGame(), C4PlayerList::RemoveAtRemoteClient(), C4PlayerList::RemoveLocal(), C4Network2::Vote(), VT_Cancel, and VT_Kick.

Referenced by C4AbortGameDialog::OnClosed().

3667 {
3668  // league needs approval
3669  if (Network.isEnabled() && Parameters.isLeague() && !fApproved)
3670  {
3671  if (Control.isCtrlHost() && !Game.GameOver)
3672  {
3674  return;
3675  }
3677  {
3678  Network.Vote(VT_Kick, true, Control.ClientID());
3679  return;
3680  }
3681  }
3682  // hard-abort: eval league and quit
3683  // manually evaluate league
3684  Players.RemoveLocal(true, true);
3685  Players.RemoveAtRemoteClient(true, true);
3686  // normal quit
3688 }
bool isCtrlHost() const
Definition: C4GameControl.h:99
C4Game Game
Definition: C4Globals.cpp:52
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
void Vote(C4ControlVoteType eType, bool fApprove=true, int32_t iData=0)
bool RemoveLocal(bool fDisonnected, bool fNoCalls)
C4GameParameters & Parameters
Definition: C4Game.h:67
C4Network2 Network
Definition: C4Globals.cpp:53
bool GameOver
Definition: C4Game.h:114
C4GameControl Control
C4PlayerList Players
C4Player * GetLocalByIndex(int iIndex) const
bool isEnabled() const
Definition: C4Network2.h:203
int32_t ClientID() const
bool isLeague() const
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::ActivateMenu ( const char *  szCommand)
protected

Definition at line 3649 of file C4Game.cpp.

References C4MainMenu::ActivateCommand(), C4PlayerList::GetLocalByIndex(), C4GameOverDlg::IsShown(), C4Player::Menu, C4Player::Number, and Players.

3650 {
3651  // no new menu during round evaluation
3652  if (C4GameOverDlg::IsShown()) return false;
3653  // forward to primary player
3655  if (!pPlr) return false;
3656  pPlr->Menu.ActivateCommand(pPlr->Number, szCommand);
3657  return true;
3658 }
C4MainMenu Menu
Definition: C4Player.h:103
int32_t Number
Definition: C4Player.h:86
bool ActivateCommand(int32_t iPlayer, const char *szCommand)
Definition: C4MainMenu.cpp:865
static bool IsShown()
Definition: C4GameOverDlg.h:92
C4PlayerList Players
C4Player * GetLocalByIndex(int iIndex) const

Here is the call graph for this function:

C4PropList * C4Game::AllocateTranslatedString ( )

Definition at line 3963 of file C4Game.cpp.

References C4VString(), C4StringTable::P, P_Function, P_Translate, C4PropList::SetProperty(), and Strings.

3964 {
3965  C4PropListScript *value_proplist = new C4PropListScript();
3966  value_proplist->SetProperty(P_Function, C4VString(&::Strings.P[P_Translate]));
3967  return value_proplist;
3968 }
C4String P[P_LAST]
void SetProperty(C4PropertyName k, const C4Value &to)
Definition: C4PropList.h:120
C4StringTable Strings
Definition: C4Globals.cpp:42
C4Value C4VString(C4String *pStr)
Definition: C4Value.h:246

Here is the call graph for this function:

bool C4Game::CanQuickSave ( )

Definition at line 1930 of file C4Game.cpp.

References C4Network2::isEnabled(), C4Network2::isHost(), LoadResStr(), Log(), and Network.

Referenced by C4MainMenu::ActivateSavegame(), and QuickSave().

1931 {
1932  // Network hosts only
1933  if (Network.isEnabled() && !Network.isHost())
1934  { Log(LoadResStr("IDS_GAME_NOCLIENTSAVE")); return false; }
1935 
1936  return true;
1937 }
bool isHost() const
Definition: C4Network2.h:209
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Network2 Network
Definition: C4Globals.cpp:53
bool isEnabled() const
Definition: C4Network2.h:203
bool Log(const char *szMessage)
Definition: C4Log.cpp:192

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CastObjects ( C4ID  id,
C4Object pCreator,
int32_t  num,
int32_t  level,
int32_t  tx,
int32_t  ty,
int32_t  iOwner = NO_OWNER,
int32_t  iController = NO_OWNER,
C4ValueArray out_objects = nullptr 
)

Definition at line 1411 of file C4Game.cpp.

References C4REAL10(), C4VObj(), CreateObject(), C4ValueArray::GetSize(), itofix(), Random(), C4ValueArray::SetSize(), and C4PropList::Status.

Referenced by C4Landscape::P::BlastMaterial2Objects().

1412 {
1413  int32_t cnt, out_obj_size=0;
1414  if (out_objects)
1415  {
1416  out_obj_size = out_objects->GetSize();
1417  out_objects->SetSize(out_obj_size + num);
1418  }
1419  for (cnt=0; cnt<num; cnt++)
1420  {
1421  // Must do these calculation steps separately, because the order of
1422  // invokations of Random() is not defined if they're used as parameters
1423  int32_t angle = Random(360);
1424  C4Real xdir = C4REAL10(Random(2*level+1)-level);
1425  C4Real ydir = C4REAL10(Random(2*level+1)-level);
1426  C4Real rdir = itofix(Random(3)+1);
1427  C4Object *obj = CreateObject(id,pCreator,iOwner,
1428  tx,ty,angle,
1429  false,
1430  xdir,
1431  ydir,
1432  rdir, iController);
1433  if (obj && obj->Status && out_objects) (*out_objects)[out_obj_size+cnt] = C4VObj(obj);
1434  }
1435 }
uint32_t Random()
Definition: C4Random.cpp:43
C4Value C4VObj(C4Object *pObj)
Definition: C4Value.cpp:88
Definition: C4Real.h:58
C4Real C4REAL10(int x)
Definition: C4Real.h:269
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
void SetSize(int32_t inSize)
int32_t Status
Definition: C4PropList.h:168
int32_t GetSize() const
Definition: C4ValueArray.h:36
C4Object * CreateObject(C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
Definition: C4Game.cpp:1072

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::CheckObjectEnumeration ( )
protected

Definition at line 3297 of file C4Game.cpp.

References FormatString(), C4PropList::GetName(), C4Object::GetX(), C4Object::id, LogFatal(), C4PropListNumbered::Number, Objects, C4PropListNumbered::SetEnumerationIndex(), and C4ID::ToString().

Referenced by InitGame().

3298 {
3299 
3300  struct Check
3301  {
3302  int32_t maxNumber{0};
3303  Check() = default;
3304  // Check valid & maximum number & duplicate numbers
3305  bool that(C4Object* cObj)
3306  {
3307  // Invalid number
3308  if (cObj->Number<1)
3309  {
3310  LogFatal(FormatString("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, cObj->id.ToString(), cObj->GetX()).getData()); return false;
3311  }
3312  // Max
3313  if (cObj->Number>maxNumber) maxNumber=cObj->Number;
3314  // Duplicate
3315  for (C4Object *cObj2 : Objects)
3316  if (cObj2!=cObj)
3317  if (cObj->Number==cObj2->Number)
3318  { LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s)",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return false; }
3319  for (C4Object *cObj2 : Objects.InactiveObjects)
3320  if (cObj2!=cObj)
3321  if (cObj->Number==cObj2->Number)
3322  { LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s(i))",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return false; }
3323  return true;
3324  }
3325  };
3326 
3327  Check check;
3328  for (C4Object *cObj : Objects)
3329  {
3330  if (!check.that(cObj))
3331  return false;
3332  }
3333 
3334  for (C4Object *cObj : Objects.InactiveObjects)
3335  {
3336  if (!check.that(cObj))
3337  return false;
3338  }
3339 
3340  // Adjust enumeration index
3341  C4PropListNumbered::SetEnumerationIndex(check.maxNumber);
3342  // Done
3343  return true;
3344 }
C4ID id
Definition: C4Object.h:108
static void SetEnumerationIndex(int32_t iMaxObjectNumber)
Definition: C4PropList.cpp:93
virtual const char * GetName() const
Definition: C4PropList.cpp:649
int32_t GetX() const
Definition: C4Object.h:286
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:227
const char * ToString() const
Definition: C4Id.h:59
C4GameObjects Objects
Definition: C4Globals.cpp:48
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::Clear ( )

Definition at line 537 of file C4Game.cpp.

References C4AulProfiler::Abort(), Application, C4S, C4ST_SHOWSTAT, C4ComponentHost::Clear(), C4PlayerList::Clear(), C4Weather::Clear(), C4PathFinder::Clear(), C4DefList::Clear(), C4SoundSystem::Clear(), C4GraphicsSystem::Clear(), C4TransferZones::Clear(), C4PXSSystem::Clear(), C4Landscape::Clear(), C4FontLoader::Clear(), C4Scoreboard::Clear(), C4EditCursor::Clear(), C4ScenarioParameterDefs::Clear(), C4GroupSet::Clear(), C4TextureMap::Clear(), C4GameMessageList::Clear(), C4ScenarioParameters::Clear(), C4MessageInput::Clear(), C4PlayerControlDefs::Clear(), C4GameControl::Clear(), C4SoundModifierList::Clear(), C4MouseControl::Clear(), C4AulScriptEngine::Clear(), C4GameParameters::Clear(), C4RoundResults::Clear(), C4GameScriptHost::Clear(), C4MaterialMap::Clear(), C4Scenario::Clear(), C4Network2::Clear(), C4PlayerControlAssignmentSets::Clear(), C4MapScriptHost::Clear(), StdStrBuf::Clear(), C4ParticleSystem::Clear(), C4KeyboardInput::Clear(), StdMeshMatManager::Clear(), C4GUI::Screen::Clear(), C4MusicSystem::ClearGame(), C4PropListNumbered::ClearNumberedPropLists(), C4PropListScript::ClearScriptPropLists(), C4PropListNumbered::ClearShelve(), C4Console::CloseGame(), C4FullScreen::CloseMenu(), CloseScenario(), Console, Control, Default(), DefinitionFilenames, Definitions, DeleteObjects(), DirectJoinAddress, C4Console::EditCursor, Evaluate(), Evaluated, C4MusicSystem::FadeOut(), FontLoader, fPreinited, FullScreen, GameOver, GameScript, GameText, GetLogPos(), GraphicsSystem, GroupSet, C4Language::HasStringTable(), Info, IsRunning, KeyboardInput, Landscape, Languages, LoadResStr(), Log(), MainSysLangStringTable, MapScript, MaterialMap, MeshMaterialManager, MessageInput, Messages, C4SoundSystem::Modifiers, MouseControl, C4Application::MusicSystem, Names, Network, NextMission, NextMissionDesc, NextMissionText, Parameters, Particles, PathFinder, pFileMonitor, pGUI, pJoinReference, PlayerControlDefaultAssignmentSets, PlayerControlDefs, PlayerControlUserAssignmentSets, PlayerFilenames, Players, pNetworkStatistics, PointersDenumerated, pScenarioObjectsScript, PXS, QuitLogPos, RecordDumpFile, RecordStream, C4PropListNumbered::ResetEnumerationIndex(), RoundResults, ScenarioFilename, ScenarioLangStringTable, ScenarioParameterDefs, Scoreboard, ScriptEngine, ScriptGuiRoot, SetGlobalSoundModifier(), C4Application::SoundSystem, StartupScenarioParameters, TextureMap, Title, TransferZones, and Weather.

Referenced by C4Application::Clear(), and C4Application::GameTick().

538 {
539  pFileMonitor.reset();
540  // fade out music
542  // game no longer running
543  IsRunning = false;
544  PointersDenumerated = false;
545 
547  // C4ST_RESET
548 
549  // Evaluation
550  if (GameOver)
551  {
552  if (!Evaluated) Evaluate();
553  }
554 
555  // stop statistics
556  pNetworkStatistics.reset();
558 
559  // next mission (shoud have been transferred to C4Application now if next mission was desired)
561 
562  // Clear control
563  Network.Clear();
564  Control.Clear();
570 
571  // Clear game info
572  Scoreboard.Clear();
573  Players.Clear();
574  Parameters.Clear();
576  C4S.Clear();
579  Info.Clear();
580  Title.Clear();
581  Names.Clear();
582  GameText.Clear();
585 
586 #ifdef WITH_QT_EDITOR
587  // clear console pointers held into script engine
589  ::Console.ClearGamePointers();
590 #endif
591  // notify editor
592  Console.CloseGame();
593 
594  // Clear the particles before cleaning up the objects.
595  Particles.Clear();
596  DeleteObjects(true);
597 
598  // exit gui
599  pGUI->Clear();
600  ScriptGuiRoot.reset();
601 
602  // Clear landscape
603  Weather.Clear();
604  Landscape.Clear();
605  PXS.Clear();
607  TextureMap.Clear(); // texture map *MUST* be cleared after the materials, because of the patterns!
608  PathFinder.Clear();
610 
611  ::Messages.Clear();
613  SetGlobalSoundModifier(nullptr); // must be called before script engine clear
614  Application.SoundSystem.Modifiers.Clear(); // free some prop list pointers
615 
616  // Clear script engine
617  ::MapScript.Clear();
620  C4PropListNumbered::ClearShelve(); // may be nonempty if there was a fatal error during section load
622  pScenarioObjectsScript = nullptr;
623  // delete any remaining prop lists from circular chains
626 
627  // Clear translation tables
630 
631  // Cleanup remaining open scenario files
632  CloseScenario();
633  GroupSet.Clear();
635  Application.SoundSystem.Clear(); // will be re-inited by application pre-init if running from startup system
636 
637  // Clear remaining graphics
638 #ifndef USE_CONSOLE
640 #endif
643 
644  // global fullscreen class is not cleared, because it holds the carrier window
645  // but the menu must be cleared (maybe move Fullscreen.Menu somewhere else?)
647 
648  // Message
649  // avoid double message by not printing it if no restbl is loaded
650  // this would log an "[Undefined]" only, anyway
651  // (could abort the whole clear-procedure here, btw?)
652  if (::Languages.HasStringTable()) Log(LoadResStr("IDS_CNS_GAMECLOSED"));
653 
654  // clear game starting parameters
656 
657  // join reference
658  pJoinReference.reset();
659 
660  // okay, game cleared now. Remember log section
661  QuitLogPos = GetLogPos();
662 
663  fPreinited = false;
665 
666  // FIXME: remove this
667  Default();
668 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4EditCursor EditCursor
Definition: C4Console.h:90
bool IsRunning
Definition: C4Game.h:139
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:102
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:108
StdStrBuf RecordDumpFile
Definition: C4Game.h:124
StdCopyStrBuf NextMission
Definition: C4Game.h:146
C4Console Console
Definition: C4Globals.cpp:45
C4GameScriptHost GameScript
C4LangStringTable MainSysLangStringTable
Definition: C4Game.h:80
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4Scenario C4S
Definition: C4Game.h:74
C4GroupSet GroupSet
Definition: C4Game.h:87
void Clear()
Definition: StdBuf.h:466
C4ParticleSystem Particles
static void ResetEnumerationIndex()
Definition: C4PropList.cpp:99
void Clear()
Definition: C4Scenario.cpp:408
void Clear()
Definition: C4Texture.cpp:168
C4ComponentHost GameText
Definition: C4Game.h:79
bool HasStringTable() const
Definition: C4Language.h:70
static void ClearNumberedPropLists()
Definition: C4PropList.cpp:137
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
C4MessageInput MessageInput
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:90
C4Scoreboard Scoreboard
Definition: C4Game.h:94
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:75
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
C4ComponentHost Names
Definition: C4Game.h:78
C4GameParameters & Parameters
Definition: C4Game.h:67
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
StdCopyStrBuf NextMissionDesc
Definition: C4Game.h:146
C4LangStringTable ScenarioLangStringTable
Definition: C4Game.h:80
C4MapScriptHost MapScript
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
std::unique_ptr< C4FileMonitor > pFileMonitor
Definition: C4Game.h:97
C4SoundModifierList Modifiers
Definition: C4SoundSystem.h:54
void Clear()
Definition: C4Gui.cpp:588
C4Network2 Network
Definition: C4Globals.cpp:53
void Clear()
Definition: C4PXS.cpp:169
bool fPreinited
Definition: C4Game.h:127
bool GameOver
Definition: C4Game.h:114
void Clear()
Definition: C4Weather.cpp:89
C4Language Languages
Definition: C4Language.cpp:42
static void ClearScriptPropLists()
Definition: C4PropList.cpp:207
C4GameControl Control
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:96
C4Landscape Landscape
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
static void ClearShelve()
Definition: C4PropList.cpp:131
C4PlayerList Players
void Default()
Definition: C4Game.cpp:1444
C4TransferZones TransferZones
Definition: C4Game.h:85
StdCopyStrBuf NextMissionText
Definition: C4Game.h:146
void Clear()
Definition: C4Network2.cpp:711
void SetGlobalSoundModifier(C4PropList *modifier_props)
Definition: C4Game.cpp:3873
C4Weather Weather
Definition: C4Weather.cpp:206
C4PXSSystem PXS
Definition: C4PXS.cpp:525
void Clear()
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:92
size_t GetLogPos()
Definition: C4Log.cpp:286
C4RoundResults & RoundResults
Definition: C4Game.h:73
void FadeOut(int fadeout_ms)
void Clear()
Definition: C4GroupSet.cpp:50
size_t QuitLogPos
Definition: C4Game.h:141
bool PointersDenumerated
Definition: C4Game.h:140
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:104
bool Evaluated
Definition: C4Game.h:115
C4FontLoader FontLoader
class C4ScenarioParameters & StartupScenarioParameters
Definition: C4Game.h:68
C4PathFinder PathFinder
Definition: C4Game.h:84
#define C4ST_SHOWSTAT
Definition: C4Stat.h:154
void DeleteObjects(bool fDeleteInactive)
Definition: C4Game.cpp:1049
C4MaterialMap MaterialMap
Definition: C4Material.cpp:970
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
void Clear(bool fClearMapCreator=true, bool fClearSky=true, bool fClearRenderer=true)
StdStrBuf RecordStream
Definition: C4Game.h:125
char DefinitionFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:105
void CloseGame()
Definition: C4Console.cpp:609
C4ComponentHost Info
Definition: C4Game.h:76
C4DefList Definitions
Definition: C4Globals.cpp:49
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:233
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:106
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:95
static void Abort()
Definition: C4AulExec.h:257
C4PlayerControlAssignmentSets PlayerControlDefaultAssignmentSets
Definition: C4Game.h:93
void CloseScenario()
Definition: C4Game.cpp:263
StdMeshMatManager MeshMaterialManager
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
Definition: C4Game.h:93
C4Application Application
Definition: C4Globals.cpp:44
void Evaluate()
Definition: C4Game.cpp:1503
C4ComponentHost Title
Definition: C4Game.h:77
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ClearObjectPtrs ( C4Object tptr)
protected

Definition at line 905 of file C4Game.cpp.

References C4Object::ClearPointers(), and Objects.

Referenced by ClearPointers().

906 {
907  // May not call Objects.ClearPointers() because that would
908  // remove pObj from primary list and pObj is to be kept
909  // until CheckObjectRemoval().
910  for (C4Object *cObj : Objects)
911  {
912  cObj->ClearPointers(pObj);
913  }
914  // check in inactive objects as well
915  for (C4Object *cObj : Objects.InactiveObjects)
916  {
917  cObj->ClearPointers(pObj);
918  }
919 }
void ClearPointers(C4Object *ptr)
Definition: C4Object.cpp:1735
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ClearPointers ( C4Object cobj)

Definition at line 921 of file C4Game.cpp.

References Application, AulExec, ClearObjectPtrs(), C4PlayerList::ClearPointers(), C4SoundSystem::ClearPointers(), C4Console::ClearPointers(), C4TransferZones::ClearPointers(), C4AulExec::ClearPointers(), C4GameMessageList::ClearPointers(), C4Effect::ClearPointers(), C4MouseControl::ClearPointers(), C4ObjectList::ClearPointers(), C4MessageInput::ClearPointers(), C4ViewportList::ClearPointers(), C4Landscape::ClearPointers(), Console, C4GameObjects::ForeObjects, GameScript, Landscape, MessageInput, Messages, MouseControl, Objects, C4AulScriptEngine::pGlobalEffects, Players, C4GameScriptHost::pScenarioEffects, ScriptEngine, ScriptGuiRoot, C4Application::SoundSystem, TransferZones, and Viewports.

Referenced by C4Object::AssignRemoval(), C4ObjectList::DeleteObjects(), LoadScenarioSection(), C4GameObjects::ResortUnsorted(), and C4Object::StatusDeactivate().

922 {
923  ::AulExec.ClearPointers(pObj);
926  ClearObjectPtrs(pObj);
928  ::Players.ClearPointers(pObj);
931  ::Console.ClearPointers(pObj);
933  ScriptGuiRoot->ClearPointers(pObj);
940 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *pObj)
C4Console Console
Definition: C4Globals.cpp:45
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
void ClearPointers(C4Object *pObj)
C4MessageInput MessageInput
C4AulExec AulExec
Definition: C4AulExec.cpp:29
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
C4Landscape Landscape
C4PlayerList Players
C4TransferZones TransferZones
Definition: C4Game.h:85
void ClearPointers(C4Object *pObj)
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
C4ObjectList ForeObjects
Definition: C4GameObjects.h:44
void ClearPointers(C4Object *pObj)
Definition: C4Console.cpp:405
C4Effect * pScenarioEffects
Definition: C4ScriptHost.h:165
void ClearPointers(C4Object *pObj)
Definition: C4Viewport.cpp:956
int ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *pObj)
void ClearPointers(C4Object *)
Definition: C4AulExec.cpp:136
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:233
void ClearObjectPtrs(C4Object *tptr)
Definition: C4Game.cpp:905
void ClearPointers(C4Object *pObj)
void ClearPointers(C4PropList *pObj)
Definition: C4Effect.cpp:191
void ClearPointers(C4Object *pObj)
C4Application Application
Definition: C4Globals.cpp:44
C4Effect * pGlobalEffects
Definition: C4Aul.h:144
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CloseScenario ( )
protected

Definition at line 263 of file C4Game.cpp.

References StdStrBuf::Clear(), C4Group::Close(), C4GroupSet::CloseFolders(), EraseItem(), StdStrBuf::getData(), GroupSet, pCurrentScenarioSection, pParentGroup, pScenarioSections, ScenarioFile, and TempScenarioFile.

Referenced by Clear().

264 {
265  // close scenario
268  pParentGroup = nullptr;
269  // remove if temporary
270  if (TempScenarioFile)
271  {
274  }
275  // clear scenario section
276  // this removes any temp files, which may yet need to be used by any future features
277  // so better don't do this too early (like, in C4Game::Clear)
279 }
const char * getData() const
Definition: StdBuf.h:442
C4Group * pParentGroup
Definition: C4Game.h:88
StdStrBuf TempScenarioFile
Definition: C4Game.h:126
void Clear()
Definition: StdBuf.h:466
C4GroupSet GroupSet
Definition: C4Game.h:87
C4Group ScenarioFile
Definition: C4Game.h:86
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:91
bool Close()
Definition: C4Group.cpp:755
bool EraseItem(const char *szItemName)
Definition: StdFile.cpp:809
bool CloseFolders()
Definition: C4GroupSet.cpp:235
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:91

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::CompileFunc ( StdCompiler pComp,
CompileSettings  comp,
C4ValueNumbers numbers 
)

Definition at line 1660 of file C4Game.cpp.

References C4Value::_getInt(), Application, C4SyncCheckRate, C4V_Enum, C4VNull, Control, C4GameControl::ControlTick, CurrentScenarioSection, C4PropListNumbered::EnumerationIndex, C4PlayerList::First, FormatString(), FrameCounter, fResortAnyObject, StdStrBuf::getData(), C4Landscape::GetSky(), C4Value::GetType(), GlobalSoundModifier, IM_Normal, IM_Section, InitialPlayersJoined, StdCompiler::isDeserializer(), StdCompiler::isSerializer(), iTick10, iTick1000, iTick2, iTick255, iTick3, iTick35, iTick5, Landscape, mkNamingAdapt(), mkParAdapt(), mkStringAdaptMA, C4Application::MusicSystem, StdCompiler::Name(), StdCompiler::NameEnd(), C4Player::Next, NextMission, NextMissionDesc, NextMissionText, Objects, Players, Scoreboard, ScriptEngine, ScriptGuiRoot, C4PropListNumbered::ShelveNumberedPropLists(), StartupPlayerCount, StartupTeamCount, C4GameControl::SyncRate, Time, StdCompiler::Value(), and Weather.

1661 {
1662  if (comp.init_mode == IM_Normal && comp.fExact)
1663  {
1664  pComp->Name("Game");
1665  pComp->Value(mkNamingAdapt(Time, "Time", 0));
1666  pComp->Value(mkNamingAdapt(FrameCounter, "Frame", 0));
1667  if (comp.fSync)
1668  {
1669  pComp->Value(mkNamingAdapt(Control.ControlTick, "ControlTick", 0));
1670  pComp->Value(mkNamingAdapt(Control.SyncRate, "SyncRate", C4SyncCheckRate));
1671  }
1672  pComp->Value(mkNamingAdapt(iTick2, "Tick2", 0));
1673  pComp->Value(mkNamingAdapt(iTick3, "Tick3", 0));
1674  pComp->Value(mkNamingAdapt(iTick5, "Tick5", 0));
1675  pComp->Value(mkNamingAdapt(iTick10, "Tick10", 0));
1676  pComp->Value(mkNamingAdapt(iTick35, "Tick35", 0));
1677  pComp->Value(mkNamingAdapt(iTick255, "Tick255", 0));
1678  pComp->Value(mkNamingAdapt(iTick1000, "Tick1000", 0));
1679  pComp->Value(mkNamingAdapt(InitialPlayersJoined, "InitialPlayersJoined", false));
1680  pComp->Value(mkNamingAdapt(StartupPlayerCount, "StartupPlayerCount", 0));
1681  pComp->Value(mkNamingAdapt(StartupTeamCount, "StartupTeamCount", 0));
1682  pComp->Value(mkNamingAdapt(C4PropListNumbered::EnumerationIndex,"ObjectEnumerationIndex",0));
1683  pComp->Value(mkNamingAdapt(mkStringAdaptMA(CurrentScenarioSection), "CurrentScenarioSection", ""));
1684  pComp->Value(mkNamingAdapt(fResortAnyObject, "ResortAnyObj", false));
1685  pComp->Value(mkNamingAdapt(mkParAdapt(GlobalSoundModifier, numbers), "GlobalSoundModifier", C4Value()));
1686  pComp->Value(mkNamingAdapt(NextMission, "NextMission", StdCopyStrBuf()));
1687  pComp->Value(mkNamingAdapt(NextMissionText, "NextMissionText", StdCopyStrBuf()));
1688  pComp->Value(mkNamingAdapt(NextMissionDesc, "NextMissionDesc", StdCopyStrBuf()));
1689  pComp->NameEnd();
1690 
1691  // Music settings
1692  pComp->Value(mkNamingAdapt(::Application.MusicSystem, "Music"));
1693 
1694  // scoreboard compiles into main level [Scoreboard]
1695  pComp->Value(mkNamingAdapt(Scoreboard, "Scoreboard"));
1696  // Keyboard status of global keys synchronized for exact (runtime join) only; not for savegames,
1697  // as keys might be released between a savegame save and its resume
1698  }
1699 
1700  if (comp.fExact)
1701  {
1702  pComp->Value(mkNamingAdapt(Weather, "Weather"));
1703  pComp->Value(mkNamingAdapt(Landscape, "Landscape"));
1704  pComp->Value(mkNamingAdapt(Landscape.GetSky(), "Sky"));
1705 
1706  // save custom GUIs only if a real savegame and not for editor-scenario-saves or section changes
1707  if (comp.init_mode == IM_Normal)
1708  {
1709  pComp->Name("GUI");
1710  if (pComp->isDeserializer())
1711  {
1712  C4Value val;
1713  pComp->Value(mkNamingAdapt(mkParAdapt(val, numbers), "ScriptGUIs", C4VNull));
1714  // if loading, assume
1715  assert(ScriptGuiRoot->GetID() == 0); // ID of 0 means "had no subwindows ever" aka "is fresh" for root
1716  // we will need to denumerate and create the actual GUI post-loading
1717  // for now, just remember our enumerated ID
1718  if (val.GetType() == C4V_Enum)
1719  {
1720  int enumID = val._getInt();
1721  ScriptGuiRoot->SetEnumeratedID(enumID);
1722  }
1723  }
1724  else
1725  {
1726  C4Value *val = new C4Value(ScriptGuiRoot->ToC4Value());
1727  pComp->Value(mkNamingAdapt(mkParAdapt(*val, numbers), "ScriptGUIs", C4VNull));
1728  }
1729  pComp->NameEnd();
1730  }
1731  }
1732 
1733  if (comp.fPlayers)
1734  {
1735  assert(pComp->isSerializer());
1736  // player parsing: Parse all players
1737  // This doesn't create any players, but just parses existing by their ID
1738  // Primary player ininitialization (also setting ID) is done by player info list
1739  // Won't work this way for binary mode!
1740  for (C4Player *pPlr=Players.First; pPlr; pPlr=pPlr->Next)
1741  pComp->Value(mkNamingAdapt(mkParAdapt(*pPlr, numbers), FormatString("Player%d", pPlr->ID).getData()));
1742  }
1743 
1744  // Section load: Clear existing prop list numbering to make room for the new objects
1745  // Numbers will be re-acquired in C4GameObjects::PostLoad
1747 
1748  pComp->Value(mkParAdapt(Objects, !comp.fExact, numbers));
1749 
1750  pComp->Value(mkNamingAdapt(mkParAdapt(ScriptEngine, comp.init_mode == IM_Section, numbers), "Script"));
1751 }
const char * getData() const
Definition: StdBuf.h:442
int32_t iTick255
Definition: C4Game.h:129
int32_t ControlTick
Definition: C4GameControl.h:89
C4Value & GlobalSoundModifier
Definition: C4Game.h:99
StdCopyStrBuf NextMission
Definition: C4Game.h:146
int32_t iTick5
Definition: C4Game.h:129
int32_t iTick35
Definition: C4Game.h:129
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
const int32_t C4SyncCheckRate
Definition: C4GameControl.h:53
C4Player * First
Definition: C4PlayerList.h:31
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77
C4Scoreboard Scoreboard
Definition: C4Game.h:94
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
StdCopyStrBuf NextMissionDesc
Definition: C4Game.h:146
bool isSerializer()
Definition: StdCompiler.h:54
int32_t FrameCounter
Definition: C4Game.h:128
int32_t iTick1000
Definition: C4Game.h:129
C4V_Type GetType() const
Definition: C4Value.h:161
C4GameControl Control
C4Landscape Landscape
C4PlayerList Players
bool InitialPlayersJoined
Definition: C4Game.h:113
int32_t Time
Definition: C4Game.h:131
class C4Sky & GetSky()
int32_t _getInt() const
Definition: C4Value.h:122
StdCopyStrBuf NextMissionText
Definition: C4Game.h:146
C4Weather Weather
Definition: C4Weather.cpp:206
int32_t iTick3
Definition: C4Game.h:129
void Value(const T &rStruct)
Definition: StdCompiler.h:161
static void ShelveNumberedPropLists()
Definition: C4PropList.cpp:105
int32_t iTick10
Definition: C4Game.h:129
virtual bool isDeserializer()
Definition: StdCompiler.h:53
bool fResortAnyObject
Definition: C4Game.h:138
const C4Value C4VNull
Definition: C4Value.cpp:30
int32_t StartupPlayerCount
Definition: C4Game.h:109
C4Player * Next
Definition: C4Player.h:142
#define mkStringAdaptMA(szString)
Definition: StdAdaptors.h:190
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
int32_t SyncRate
Definition: C4GameControl.h:90
int32_t StartupTeamCount
Definition: C4Game.h:110
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:233
static int32_t EnumerationIndex
Definition: C4PropList.h:238
char CurrentScenarioSection[C4MaxName+1]
Definition: C4Game.h:101
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78
C4Application Application
Definition: C4Globals.cpp:44
C4GameObjects Objects
Definition: C4Globals.cpp:48
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
int32_t iTick2
Definition: C4Game.h:129
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

bool C4Game::CompileRuntimeData ( C4Group hGroup,
InitMode  init_mode,
bool  exact,
bool  sync,
C4ValueNumbers numbers 
)
protected

Definition at line 1753 of file C4Game.cpp.

References C4CFN_Game, C4GameObjects::Clear(), GameText, C4ComponentHost::GetData(), C4ComponentHost::GetDataBuf(), IM_Section, C4ComponentHost::Load(), LoadResStr(), LogF(), mkParAdapt(), C4ObjectList::ObjectCount(), and Objects.

Referenced by InitGame().

1754 {
1755  ::Objects.Clear(init_mode != IM_Section);
1756  GameText.Load(hGroup,C4CFN_Game);
1757  CompileSettings Settings(init_mode, false, exact, sync);
1758  // C4Game is not defaulted on compilation.
1759  // Loading of runtime data overrides only certain values.
1760  // Doesn't compile players; those will be done later
1761  if (GameText.GetData())
1762  {
1763  if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
1764  mkParAdapt(*this, Settings, numbers),
1766  return false;
1767  // Objects
1768  int32_t iObjects = Objects.ObjectCount();
1769  if (iObjects) { LogF(LoadResStr("IDS_PRC_OBJECTSLOADED"),iObjects); }
1770  }
1771  // Success
1772  return true;
1773 }
bool Load(C4Group &hGroup, const char *szFilename, const char *szLanguage=nullptr)
const char * GetData() const
C4ComponentHost GameText
Definition: C4Game.h:79
const StdStrBuf & GetDataBuf() const
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
#define C4CFN_Game
Definition: C4Components.h:73
int ObjectCount(C4ID id=C4ID::None) const
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
void Clear(bool fClearInactive)
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:250
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateInfoObject ( C4ObjectInfo cinf,
int32_t  owner,
int32_t  tx = 50,
int32_t  ty = 50 
)

Definition at line 1086 of file C4Game.cpp.

References C4Id2Def(), Fix0, FullCon, C4ObjectInfoCore::id, NewObject(), and NO_OWNER.

Referenced by C4Player::PlaceReadyCrew().

1088 {
1089  C4Def *def;
1090  // Valid check
1091  if (!cinf) return nullptr;
1092  // Get def
1093  if (!(def=C4Id2Def(cinf->id))) return nullptr;
1094  // Create object
1095  return NewObject( def,nullptr,
1096  iOwner,cinf,
1097  tx,ty,0,
1098  Fix0,Fix0,Fix0,
1099  FullCon, NO_OWNER, false);
1100 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1011
const int32_t FullCon
Definition: C4Constants.h:181
Definition: C4Def.h:98
const int NO_OWNER
Definition: C4Constants.h:137
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
const C4Real Fix0
Definition: C4Real.h:312

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateObject ( C4PropList type,
C4Object pCreator,
int32_t  owner = NO_OWNER,
int32_t  x = 50,
int32_t  y = 50,
int32_t  r = 0,
bool  grow_from_center = false,
C4Real  xdir = Fix0,
C4Real  ydir = Fix0,
C4Real  rdir = Fix0,
int32_t  iController = NO_OWNER 
)

Definition at line 1072 of file C4Game.cpp.

References FullCon, C4PropList::GetDef(), and NewObject().

Referenced by CastObjects(), C4Object::CreateContents(), C4Landscape::P::DigMaterial2Objects(), InitEnvironment(), InitGoals(), InitRules(), C4EditCursor::PerformDuplicationLegacy(), PlaceAnimal(), PlaceInEarth(), C4Player::PlaceReadyMaterial(), and C4Player::PlaceReadyVehic().

1075 {
1076  // check Definition
1077  if (!PropList || !PropList->GetDef()) return nullptr;
1078  // Create object
1079  return NewObject(PropList,pCreator,
1080  iOwner,nullptr,
1081  x,y,r,
1082  xdir,ydir,rdir,
1083  FullCon, iController, grow_from_center);
1084 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1011
const int32_t FullCon
Definition: C4Constants.h:181

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::CreateObject ( C4ID  type,
C4Object pCreator,
int32_t  owner = NO_OWNER,
int32_t  x = 50,
int32_t  y = 50,
int32_t  r = 0,
bool  grow_from_center = false,
C4Real  xdir = Fix0,
C4Real  ydir = Fix0,
C4Real  rdir = Fix0,
int32_t  iController = NO_OWNER 
)

Definition at line 1057 of file C4Game.cpp.

References C4Id2Def(), FullCon, and NewObject().

1060 {
1061  C4Def *pDef;
1062  // Get pDef
1063  if (!(pDef=C4Id2Def(id))) return nullptr;
1064  // Create object
1065  return NewObject(pDef,pCreator,
1066  iOwner,nullptr,
1067  x,y,r,
1068  xdir,ydir,rdir,
1069  FullCon, iController, grow_from_center);
1070 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1011
const int32_t FullCon
Definition: C4Constants.h:181
Definition: C4Def.h:98
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84

Here is the call graph for this function:

C4Object * C4Game::CreateObjectConstruction ( C4PropList type,
C4Object pCreator,
int32_t  owner,
int32_t  ctx = 0,
int32_t  bty = 0,
int32_t  con = 1,
bool  terrain = false 
)

Definition at line 1102 of file C4Game.cpp.

References C4Object::Controller, C4Landscape::DigFreeRect(), Fix0, C4PropList::GetDef(), C4Rect::Hgt, Landscape, NewObject(), NO_OWNER, C4Landscape::RaiseTerrain(), C4Def::Shape, and C4Rect::Wdt.

Referenced by C4Player::PlaceReadyBase(), and PlaceVegetation().

1108 {
1109  C4Def *pDef;
1110  C4Object *pObj;
1111 
1112  // Get def
1113  if (!PropList) return nullptr;
1114  if (!(pDef=PropList->GetDef())) return nullptr;
1115 
1116  int32_t dx,dy,dwdt,dhgt;
1117  dwdt=pDef->Shape.Wdt; dhgt=pDef->Shape.Hgt;
1118  dx=iX-dwdt/2; dy=iBY-dhgt;
1119 
1120  // Terrain
1121  if (fTerrain)
1122  {
1123  // Clear site background (ignored for ultra-large structures)
1124  if (dwdt*dhgt<12000)
1125  Landscape.DigFreeRect(dx,dy,dwdt,dhgt);
1126  // Raise Terrain
1127  Landscape.RaiseTerrain(dx,dy+dhgt,dwdt);
1128  }
1129 
1130  // Create object
1131  if (!(pObj=NewObject(PropList,
1132  pCreator,
1133  iOwner,nullptr,
1134  iX,iBY,0,
1135  Fix0,Fix0,Fix0,
1136  iCon, pCreator ? pCreator->Controller : NO_OWNER, false))) return nullptr;
1137 
1138  return pObj;
1139 }
C4Object * NewObject(C4PropList *ndef, C4Object *pCreator, int32_t owner, C4ObjectInfo *info, int32_t tx, int32_t ty, int32_t tr, C4Real xdir, C4Real ydir, C4Real rdir, int32_t con, int32_t iController, bool grow_from_center)
Definition: C4Game.cpp:1011
void RaiseTerrain(int32_t tx, int32_t ty, int32_t wdt)
int32_t DigFreeRect(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, C4Object *by_object=nullptr, bool no_dig2objects=false, bool no_instability_check=false)
C4Def const * GetDef() const override
Definition: C4Def.h:214
int32_t Wdt
Definition: C4Rect.h:30
C4Shape Shape
Definition: C4Def.h:104
C4Landscape Landscape
Definition: C4Def.h:98
const int NO_OWNER
Definition: C4Constants.h:137
int32_t Hgt
Definition: C4Rect.h:30
int32_t Controller
Definition: C4Object.h:111
const C4Real Fix0
Definition: C4Real.h:312

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::CreateSectionFromTempFile ( const char *  section_name,
const char *  temp_filename 
)

Definition at line 3425 of file C4Game.cpp.

References StdStrBuf::getData(), C4ScenarioSection::name, pCurrentScenarioSection, C4ScenarioSection::pNext, C4ScenarioSection::pObjectScripts, pScenarioObjectsScript, pScenarioSections, ReLinkScriptEngine(), C4ScenarioSection::ScenarioLoad(), and SEqualNoCase().

3426 {
3427  // Remove existing (temp) section of same name
3428  C4ScenarioSection *existing_section = pScenarioSections, *prev = nullptr;
3429  while (existing_section) if (SEqualNoCase(existing_section->name.getData(), section_name)) break; else existing_section = (prev = existing_section)->pNext;
3430  bool deleted_current_section = false;
3431  if (existing_section)
3432  {
3433  deleted_current_section = (existing_section == pCurrentScenarioSection);
3434  if (deleted_current_section)
3435  {
3436  pCurrentScenarioSection = nullptr;
3437  pScenarioObjectsScript = nullptr;
3438  }
3439  if (existing_section->pObjectScripts)
3440  {
3441  delete existing_section->pObjectScripts;
3442  }
3443  if (prev) prev->pNext = existing_section->pNext; else pScenarioSections = existing_section->pNext;
3444  existing_section->pNext = nullptr;
3445  delete existing_section;
3446  }
3447  // Create new (temp) section
3448  C4ScenarioSection *new_section = new C4ScenarioSection(section_name);
3449  if (!new_section->ScenarioLoad(temp_filename, true))
3450  {
3451  pScenarioSections = new_section->pNext;
3452  new_section->pNext = nullptr;
3453  delete new_section;
3454  return false;
3455  }
3456  // Re-Link current section into newly created section
3457  if (deleted_current_section)
3458  {
3459  pCurrentScenarioSection = new_section;
3460  pScenarioObjectsScript = new_section->pObjectScripts;
3461  }
3462  // Link new Objects.c (or re-link because old Objects.c was removed)
3464  return !!new_section;
3465 }
const char * getData() const
Definition: StdBuf.h:442
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:207
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:90
bool ReLinkScriptEngine()
Definition: C4Game.cpp:2435
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:91
bool ScenarioLoad(const char *szFilename, bool is_temp_file)
StdCopyStrBuf name
Definition: C4Scenario.h:258
class C4ScenarioObjectsScriptHost * pObjectScripts
Definition: C4Scenario.h:262
C4ScenarioSection * pNext
Definition: C4Scenario.h:264
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:91

Here is the call graph for this function:

void C4Game::Default ( )
protected

Definition at line 1444 of file C4Game.cpp.

References Application, C4S, cFPS, StdStrBuf::Clear(), C4MusicSystem::ClearGame(), CurrentScenarioSection, DebugHost, DebugPassword, DebugPort, DebugWait, C4GameObjects::Default(), C4PlayerList::Default(), C4Weather::Default(), C4PathFinder::Default(), C4DefList::Default(), C4RankSystem::Default(), C4GraphicsSystem::Default(), C4TransferZones::Default(), C4MassMoverSet::Default(), C4PXSSystem::Default(), C4Landscape::Default(), C4GroupSet::Default(), C4GameMessageList::Default(), C4MessageInput::Default(), C4MouseControl::Default(), C4MaterialMap::Default(), C4Scenario::Default(), DefaultRanks, DefinitionFilenames, Definitions, DirectJoinAddress, DoSkipFrame, Evaluated, fLobby, fObserve, FPS, FrameCounter, FrameSkip, fReferenceDefinitionOverride, fResortAnyObject, fScriptCreatedObjects, FullSpeed, GameOver, GameOverDlgShown, GraphicsSystem, GroupSet, HaltCount, iLobbyTimeout, InitialPlayersJoined, InitProgress, IsRunning, iTick10, iTick1000, iTick2, iTick255, iTick3, iTick35, iTick5, Landscape, LastInitProgress, MassMover, MaterialMap, MessageInput, Messages, MouseControl, C4Application::MusicSystem, Objects, PathFinder, pCurrentScenarioSection, pJoinReference, PlayerFilenames, Players, pNetworkStatistics, PointersDenumerated, pParentGroup, pScenarioSections, PXS, StdStrBuf::Ref(), ScenarioFilename, ScenarioTitle, ScriptGuiRoot, StartTime, StartupPlayerCount, StartupTeamCount, Time, TimeGo, TransferZones, and Weather.

Referenced by C4Game(), and Clear().

1445 {
1446  PointersDenumerated = false;
1447  IsRunning = false;
1448  FrameCounter=0;
1450  ScenarioFilename[0]=0;
1451  PlayerFilenames[0]=0;
1452  DefinitionFilenames[0]=0;
1453  DirectJoinAddress[0]=0;
1454  pJoinReference=nullptr;
1456  StartupTeamCount = 0;
1457  ScenarioTitle.Ref("");
1458  HaltCount=0;
1460  Evaluated=false;
1461  TimeGo=false;
1462  Time=0;
1463  StartTime=0;
1465  FPS=cFPS=0;
1466  fScriptCreatedObjects=false;
1467  fLobby=fObserve=false;
1468  iLobbyTimeout=0;
1470  FullSpeed=false;
1471  FrameSkip=1; DoSkipFrame=false;
1474  Objects.Default();
1475  Players.Default();
1476  Weather.Default();
1477  Landscape.Default();
1479  MassMover.Default();
1480  PXS.Default();
1482  C4S.Default();
1483  ::Messages.Default();
1486  PathFinder.Default();
1488  GroupSet.Default();
1489  pParentGroup=nullptr;
1492  fResortAnyObject=false;
1493  pNetworkStatistics.reset();
1495  DebugPort = 0;
1496  DebugPassword.Clear();
1497  DebugHost.Clear();
1498  DebugWait = false;
1499  assert(!ScriptGuiRoot);
1500  ScriptGuiRoot.reset();
1501 }
C4Group * pParentGroup
Definition: C4Game.h:88
bool IsRunning
Definition: C4Game.h:139
int32_t iLobbyTimeout
Definition: C4Game.h:119
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:102
void Default()
Definition: C4GroupSet.cpp:57
int32_t iTick255
Definition: C4Game.h:129
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:108
int32_t iTick5
Definition: C4Game.h:129
int32_t iTick35
Definition: C4Game.h:129
C4Scenario C4S
Definition: C4Game.h:74
void Clear()
Definition: StdBuf.h:466
C4GroupSet GroupSet
Definition: C4Game.h:87
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:103
bool GameOverDlgShown
Definition: C4Game.h:116
void Default()
Definition: C4PXS.cpp:159
StdStrBuf DebugHost
Definition: C4Game.h:148
C4RankSystem DefaultRanks
void Default() override
C4MessageInput MessageInput
int32_t LastInitProgress
Definition: C4Game.h:133
bool DoSkipFrame
Definition: C4Game.h:137
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
void Default()
Definition: C4Scenario.cpp:78
StdStrBuf DebugPassword
Definition: C4Game.h:148
int32_t InitProgress
Definition: C4Game.h:133
uint16_t DebugPort
Definition: C4Game.h:148
int32_t FrameCounter
Definition: C4Game.h:128
int32_t StartTime
Definition: C4Game.h:132
int32_t FrameSkip
Definition: C4Game.h:137
int32_t iTick1000
Definition: C4Game.h:129
bool GameOver
Definition: C4Game.h:114
int32_t FPS
Definition: C4Game.h:111
C4Landscape Landscape
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4PlayerList Players
bool InitialPlayersJoined
Definition: C4Game.h:113
int32_t Time
Definition: C4Game.h:131
C4ScenarioSection * pScenarioSections
Definition: C4Game.h:91
C4TransferZones TransferZones
Definition: C4Game.h:85
C4Weather Weather
Definition: C4Weather.cpp:206
C4PXSSystem PXS
Definition: C4PXS.cpp:525
int32_t iTick3
Definition: C4Game.h:129
int32_t iTick10
Definition: C4Game.h:129
bool fObserve
Definition: C4Game.h:120
void Default()
Definition: C4DefList.cpp:413
bool fResortAnyObject
Definition: C4Game.h:138
void Ref(const char *pnData)
Definition: StdBuf.h:455
C4MassMoverSet MassMover
int32_t StartupPlayerCount
Definition: C4Game.h:109
bool FullSpeed
Definition: C4Game.h:136
bool PointersDenumerated
Definition: C4Game.h:140
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:104
bool Evaluated
Definition: C4Game.h:115
C4PathFinder PathFinder
Definition: C4Game.h:84
C4MaterialMap MaterialMap
Definition: C4Material.cpp:970
char DefinitionFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:105
int32_t StartupTeamCount
Definition: C4Game.h:110
C4DefList Definitions
Definition: C4Globals.cpp:49
bool fReferenceDefinitionOverride
Definition: C4Game.h:121
int32_t HaltCount
Definition: C4Game.h:112
C4GameMessageList Messages
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:233
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:106
int32_t cFPS
Definition: C4Game.h:111
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:95
bool fScriptCreatedObjects
Definition: C4Game.h:117
bool fLobby
Definition: C4Game.h:118
char CurrentScenarioSection[C4MaxName+1]
Definition: C4Game.h:101
C4Application Application
Definition: C4Globals.cpp:44
C4ScenarioSection * pCurrentScenarioSection
Definition: C4Game.h:91
bool TimeGo
Definition: C4Game.h:130
C4GameObjects Objects
Definition: C4Globals.cpp:48
void Default()
Definition: C4Weather.cpp:105
int DebugWait
Definition: C4Game.h:148
int32_t iTick2
Definition: C4Game.h:129
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::DeleteObjects ( bool  fDeleteInactive)
protected

Definition at line 1049 of file C4Game.cpp.

References C4GameObjects::DeleteObjects(), fResortAnyObject, and Objects.

Referenced by Clear(), and LoadScenarioSection().

1050 {
1051  // del any objects
1052  ::Objects.DeleteObjects(fDeleteInactive);
1053  // reset resort flag
1054  fResortAnyObject = false;
1055 }
void DeleteObjects(bool fDeleteInactive)
bool fResortAnyObject
Definition: C4Game.h:138
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DoGameOver ( )

Definition at line 3095 of file C4Game.cpp.

References Config, C4PlayerList::First, GameOver, GRBroadcast(), LoadResStr(), Log(), C4Player::Next, Players, PSF_OnGameOver, and C4Config::Save().

Referenced by GameOverCheck().

3096 {
3097  // Duplication safety
3098  if (GameOver) return false;
3099  // Flag, log, call
3100  GameOver=true;
3101  Log(LoadResStr("IDS_PRC_GAMEOVER"));
3103  // Flag all surviving players as winners
3104  for (C4Player *pPlayer = Players.First; pPlayer; pPlayer = pPlayer->Next)
3105  if (!pPlayer->Eliminated)
3106  pPlayer->EvaluateLeague(false, true);
3107  // Immediately save config so mission access gained by this round is stored if the game crashes during shutdown
3108  // or in a following round
3109  Config.Save();
3110  return true;
3111 }
C4Config Config
Definition: C4Config.cpp:833
C4Player * First
Definition: C4PlayerList.h:31
#define PSF_OnGameOver
Definition: C4GameScript.h:138
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
bool GameOver
Definition: C4Game.h:114
C4PlayerList Players
C4Value GRBroadcast(const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false, bool fRejectTest=false)
Definition: C4Game.cpp:3846
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
C4Player * Next
Definition: C4Player.h:142
bool Save()
Definition: C4Config.cpp:400

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DoKeyboardInput ( C4KeyCode  vk_code,
C4KeyEventType  eEventType,
bool  fAlt,
bool  fCtrl,
bool  fShift,
bool  fRepeated,
class C4GUI::Dialog pForDialog = nullptr,
bool  fPlrCtrlOnly = false,
int32_t  iStrength = -1 
)

Definition at line 1865 of file C4Game.cpp.

References KEYS_Alt, KEYS_Control, and KEYS_Shift.

Referenced by ConsoleHandleWin32KeyboardMessage(), DialogWinProc(), FullScreenWinProc(), C4StartupMainDlg::KeyEnterDown(), C4StartupMainDlg::KeyEnterUp(), C4AppDelegate::simulateKeyPressed:, and ViewportWinProc().

1866 {
1867  // compose key
1868  C4KeyCodeEx Key(vk_code, C4KeyShiftState(fAlt*KEYS_Alt + fCtrl*KEYS_Control + fShift*KEYS_Shift), fRepeated);
1869  return DoKeyboardInput(Key, eEventType, pForDialog, fPlrCtrlOnly, iStrength);
1870 }
C4KeyShiftState
bool DoKeyboardInput(C4KeyCode vk_code, C4KeyEventType eEventType, bool fAlt, bool fCtrl, bool fShift, bool fRepeated, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
Definition: C4Game.cpp:1865

Here is the caller graph for this function:

bool C4Game::DoKeyboardInput ( C4KeyCodeEx  Key,
C4KeyEventType  eEventType,
class C4GUI::Dialog pForDialog = nullptr,
bool  fPlrCtrlOnly = false,
int32_t  iStrength = -1 
)

Definition at line 1873 of file C4Game.cpp.

References C4GUI::Screen::ActivateDialog(), C4Window::Active, Application, C4S, Console, C4KeyboardInput::DoInput(), C4SHead::Film, C4KeyCodeEx::FixShiftKeys(), FullScreen, Game, C4ViewportList::GetViewport(), C4GUI::Screen::HasKeyboardFocus(), C4Scenario::Head, C4Menu::IsActive(), C4Application::isEditor, IsRunning, C4GameOverDlg::IsShown(), C4GUI::Screen::KeyAny(), KeyboardInput, KEYSCOPE_Console, KEYSCOPE_Control, KEYSCOPE_FilmView, KEYSCOPE_FreeView, KEYSCOPE_Fullscreen, KEYSCOPE_FullSMenu, KEYSCOPE_FullSView, KEYSCOPE_Generic, KEYSCOPE_Gui, NO_OWNER, pGUI, C4FullScreen::pMenu, C4SHead::Replay, and Viewports.

1874 {
1875  Key.FixShiftKeys();
1876  // compose keyboard scope
1877  DWORD InScope = 0;
1878  if (fPlrCtrlOnly)
1879  InScope = KEYSCOPE_Control;
1880  else
1881  {
1882  if (IsRunning) InScope = KEYSCOPE_Generic;
1883  // if GUI has keyfocus, this overrides regular controls
1884  if (pGUI->HasKeyboardFocus() || pForDialog)
1885  {
1886  InScope |= KEYSCOPE_Gui;
1887  // control to console mode dialog: Make current keyboard target the active dlg,
1888  // so it can process input
1889  if (pForDialog) pGUI->ActivateDialog(pForDialog);
1890  // any keystroke in GUI resets tooltip times
1891  pGUI->KeyAny();
1892  }
1893  else
1894  {
1895  if (!Application.isEditor)
1896  {
1897  if (FullScreen.pMenu && FullScreen.pMenu->IsActive()) // fullscreen menu
1898  InScope |= KEYSCOPE_FullSMenu;
1899  else if (Game.C4S.Head.Replay && C4S.Head.Film) // film view only
1900  InScope |= KEYSCOPE_FilmView;
1901  else if (::Viewports.GetViewport(NO_OWNER)) // NO_OWNER-viewport-controls
1902  InScope |= KEYSCOPE_FreeView;
1903  else
1904  {
1905  // regular player viewport controls
1906  InScope |= KEYSCOPE_FullSView;
1907  // player controls disabled during round over dlg
1908  if (!C4GameOverDlg::IsShown()) InScope |= KEYSCOPE_Control;
1909  }
1910  }
1911  else
1912  // regular player viewport controls
1913  InScope |= KEYSCOPE_Control;
1914  }
1915  // fullscreen/console (in running game)
1916  if (IsRunning)
1917  {
1918  if (FullScreen.Active) InScope |= KEYSCOPE_Fullscreen;
1919  if (Console.Active) InScope |= KEYSCOPE_Console;
1920  }
1921  }
1922  // okay; do input
1923  if (KeyboardInput.DoInput(Key, eEventType, InScope, iStrength))
1924  return true;
1925 
1926  // unprocessed key
1927  return false;
1928 }
bool HasKeyboardFocus()
Definition: C4Gui.h:2668
bool IsRunning
Definition: C4Game.h:139
C4Console Console
Definition: C4Globals.cpp:45
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
C4Viewport * GetViewport(int32_t iPlayer, C4Viewport *pPrev=nullptr)
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:96
static bool IsShown()
Definition: C4GameOverDlg.h:92
const int NO_OWNER
Definition: C4Constants.h:137
bool IsActive()
Definition: C4Menu.cpp:480
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
bool DoInput(const C4KeyCodeEx &InKey, C4KeyEventType InEvent, DWORD InScope, int32_t iStrength)
bool Active
Definition: C4Window.h:273
C4SHead Head
Definition: C4Scenario.h:230
uint32_t DWORD
C4Application Application
Definition: C4Globals.cpp:44
int32_t Film
Definition: C4Scenario.h:73
void ActivateDialog(Dialog *pDlg)
Definition: C4Gui.cpp:647
bool KeyAny()
Definition: C4Gui.cpp:771

Here is the call graph for this function:

void C4Game::DrawCrewOverheadText ( C4TargetFacet cgo,
int32_t  iPlayer 
)

Definition at line 1532 of file C4Game.cpp.

References ACenter, C4GM_MaxText, Config, C4Object::Contained, C4Object::Def, C4GraphicsResource::fctMouseCursor, C4PlayerList::First, fixtof(), C4GraphicsResource::FontRegular, StdStrBuf::Format(), StdStrBuf::getData(), CStdFont::GetLineHeight(), C4PropList::GetName(), CStdFont::GetTextExtent(), C4Draw::GetZoom(), C4Config::Graphics, GraphicsResource, Hostile(), C4Object::Info, C4Object::IsVisible(), C4Player::Next, NO_OWNER, C4Object::OCF, OCF_CrewMember, pDraw, Players, C4ObjectInfoCore::Rank, SCopy(), C4Draw::SetZoom(), C4ConfigGraphics::ShowCrewCNames, C4ConfigGraphics::ShowCrewNames, sprintf, C4ObjectInfoCore::sRankName, C4PropList::Status, C4Facet::Surface, SWordWrap(), C4Draw::TextOut(), C4Facet::Wdt, C4Facet::X, C4Facet::Y, ZoomData::Zoom, and C4TargetFacet::Zoom.

Referenced by C4Viewport::Draw().

1533 {
1534 
1535  // All drawing in this function must not be affected by zoom; but remember zoom and reset later.
1536  ZoomData r;
1537  pDraw->GetZoom(&r);
1538  const float zoom = r.Zoom;
1539  r.Zoom = 1.0;
1540  pDraw->SetZoom(r);
1541  // Offset for all text/objects
1542  const float fixedOffsetX = -cgo.X * cgo.Zoom + cgo.X;
1543  const float fixedOffsetY = (-cgo.Y - 10.0f) * cgo.Zoom + cgo.Y;
1544  // Draw cursor mark arrow & cursor object name
1546  for (C4Player *pPlr = Players.First; pPlr; pPlr = pPlr->Next)
1547  {
1548  // Draw a small selector & name above the cursor? F.e. after switching crew.
1549  const bool drawCursorInfo = (pPlr->Number == iPlayer || iPlayer == NO_OWNER) // only for the viewport's player..
1550  && (pPlr->CursorFlash && pPlr->Cursor); // ..and if the player wants to show their cursor.
1551  // Otherwise, for allied players we might want to draw player & crew names.
1552  // Note that these two conditions are generally mutually-exclusive.
1553  const bool drawPlayerAndCursorNames = (pPlr->Number != iPlayer) // Never for own player..
1554  && (Config.Graphics.ShowCrewNames || Config.Graphics.ShowCrewCNames) // ..and if the settings allow it..
1555  && !Hostile(iPlayer, pPlr->Number) && !pPlr->IsInvisible(); // ..and of course only if applicable.
1556 
1557  if (!drawPlayerAndCursorNames && !drawCursorInfo) continue;
1558 
1559  // Lambda to calculate correct drawing position of object, (re-)adjusted by zoom.
1560  float drawX, drawY, drawZoom;
1561  auto calculateObjectTextPosition = [&](C4Object *obj)
1562  {
1563  obj->GetDrawPosition(cgo, fixtof(obj->fix_x), fixtof(obj->fix_y), 1.0, drawX, drawY, drawZoom);
1564  drawX = drawX * cgo.Zoom + fixedOffsetX;
1565  drawY = drawY * cgo.Zoom - static_cast<float>(obj->Def->Shape.Hgt) / 2.0 + fixedOffsetY;
1566  };
1567 
1568  // Actual text output!
1569  if (drawPlayerAndCursorNames)
1570  {
1571  // We need to show crew names for that player, we do so for every crew-member.
1572  for (C4Object * const & crew : pPlr->Crew)
1573  {
1574  if (!crew->Status || !crew->Def) continue;
1575  if (crew->Contained) continue;
1576  if ((crew->OCF & OCF_CrewMember) == 0) continue;
1577  if (!crew->IsVisible(iPlayer, false)) continue;
1578 
1579  calculateObjectTextPosition(crew);
1580  drawY -= 5.0f; // aesthetical offset
1581 
1582  // compose string
1583  char szText[C4GM_MaxText + 1];
1586  sprintf(szText, "%s (%s)", crew->GetName(), pPlr->GetName());
1587  else
1588  SCopy(pPlr->GetName(), szText);
1589  else
1590  SCopy(crew->GetName(), szText);
1591  // Word wrap to cgo width
1592  int32_t iCharWdt, dummy;
1593  ::GraphicsResource.FontRegular.GetTextExtent("m", iCharWdt, dummy, false);
1594  int32_t iMaxLine = std::max<int32_t>(cgo.Wdt / std::max<int32_t>(1, iCharWdt), 20);
1595  SWordWrap(szText, ' ', '|', iMaxLine);
1596  // Center text vertically, too
1597  int textWidth, textHeight;
1598  ::GraphicsResource.FontRegular.GetTextExtent(szText, textWidth, textHeight, true);
1599  // Draw
1600  pDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, drawX, drawY - static_cast<float>(textHeight) / 2.0,
1601  pPlr->ColorDw | 0x7f000000, ACenter);
1602  }
1603  }
1604  else if (drawCursorInfo)
1605  {
1606  C4Object * const cursor = pPlr->Cursor;
1607  calculateObjectTextPosition(cursor);
1608  // Draw a down-arrow above the Clonk's head
1609  drawY += -fctCursor.Hgt;
1610  fctCursor.Draw(cgo.Surface, drawX - static_cast<float>(fctCursor.Wdt) / 2.0, drawY, 4);
1611  // And possibly draw some info text, too
1612  if (cursor->Info)
1613  {
1614  int32_t texthgt = ::GraphicsResource.FontRegular.GetLineHeight();
1615  StdStrBuf str;
1616  if (cursor->Info->Rank > 0)
1617  {
1618  str.Format("%s|%s", cursor->Info->sRankName.getData(), cursor->GetName());
1619  texthgt += texthgt;
1620  }
1621  else str = cursor->GetName();
1622 
1624  drawX,
1625  drawY - static_cast<float>(texthgt) / 2.0,
1626  0xffff0000, ACenter);
1627 
1628  }
1629  }
1630  }
1631  // Reset zoom
1632  r.Zoom = zoom;
1633  pDraw->SetZoom(r);
1634 }
const char * getData() const
Definition: StdBuf.h:442
C4Config Config
Definition: C4Config.cpp:833
int GetLineHeight() const
Definition: C4FontLoader.h:125
float Y
Definition: C4Facet.h:118
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
float Zoom
Definition: C4Facet.h:165
#define sprintf
Definition: Standard.h:164
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:567
StdStrBuf sRankName
Definition: C4InfoCore.h:40
const uint32_t OCF_CrewMember
Definition: C4Constants.h:97
int32_t ShowCrewNames
Definition: C4Config.h:107
C4Player * First
Definition: C4PlayerList.h:31
bool GetTextExtent(const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true)
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174
C4GraphicsResource GraphicsResource
C4ObjectInfo * Info
Definition: C4Object.h:145
C4ConfigGraphics Graphics
Definition: C4Config.h:253
void SWordWrap(char *szText, char cSpace, char cSepa, int iMaxLine)
Definition: Standard.cpp:393
C4Def * Def
Definition: C4Object.h:143
int32_t ShowCrewCNames
Definition: C4Config.h:108
const int ACenter
Definition: C4Surface.h:41
virtual const char * GetName() const
Definition: C4PropList.cpp:649
C4PlayerList Players
const int NO_OWNER
Definition: C4Constants.h:137
int32_t Hostile(int32_t plr1, int32_t plr2)
C4Draw * pDraw
Definition: C4Draw.cpp:42
int32_t Status
Definition: C4PropList.h:168
void GetZoom(ZoomData *r)
Definition: C4Draw.h:197
const int32_t C4GM_MaxText
Definition: C4GameMessage.h:26
C4Player * Next
Definition: C4Player.h:142
float fixtof(const C4Fixed &x)
Definition: C4Real.h:257
C4ObjectPtr Contained
Definition: C4Object.h:144
C4Surface * Surface
Definition: C4Facet.h:117
uint32_t OCF
Definition: C4Object.h:134
float Wdt
Definition: C4Facet.h:118
void SetZoom(float X, float Y, float Zoom)
Definition: C4Draw.cpp:779
float X
Definition: C4Facet.h:118
float Zoom
Definition: C4Draw.h:70
bool IsVisible(int32_t iForPlr, bool fAsOverlay) const
Definition: C4Object.cpp:4047

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DrawPropListSpecImage ( C4Facet fctTarget,
C4PropList pSpec 
)

Definition at line 3791 of file C4Game.cpp.

References C4DefGraphics::Draw(), C4Def::Draw(), C4DefGraphics::Get(), C4String::GetCStr(), C4PropList::GetDef(), C4PropList::GetPropertyInt(), C4PropList::GetPropertyPropList(), C4PropList::GetPropertyStr(), C4Def::Graphics, P_Color, P_Name, and P_Source.

Referenced by C4GameMessage::Draw().

3792 {
3793  // safety
3794  assert(pSpec);
3795  if (!pSpec) return false;
3796 
3797  // get source definition
3798  C4PropList *source_def_proplist = pSpec->GetPropertyPropList(P_Source);
3799  if (!source_def_proplist) return false;
3800  C4Def *source_def = source_def_proplist->GetDef();
3801  if (!source_def) return false;
3802 
3803  // get custom color
3804  uint32_t color = (uint32_t)pSpec->GetPropertyInt(P_Color);
3805 
3806  C4String *source_name = pSpec->GetPropertyStr(P_Name);
3807  if (!source_name)
3808  {
3809  // Base graphics
3810  source_def->Draw(fctTarget, false, color);
3811  }
3812  else
3813  {
3814  // Alternative named graphics
3815  C4DefGraphics *source_graphics = source_def->Graphics.Get(source_name->GetCStr());
3816  if (!source_graphics) return false;
3817  source_graphics->Draw(fctTarget, color, nullptr, 0,0, nullptr);
3818  }
3819  return true;
3820 }
const char * GetCStr() const
Definition: C4StringTable.h:49
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:685
C4DefGraphics * Get(const char *szGrpName)
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
Definition: C4Def.cpp:597
Definition: C4Def.h:98
void Draw(C4Facet &cgo, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *trans)
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:886
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:775
C4DefGraphics Graphics
Definition: C4Def.h:191
C4PropList * GetPropertyPropList(C4PropertyName k) const
Definition: C4PropList.cpp:900

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DrawTextSpecImage ( C4Facet fctTarget,
const char *  szSpec,
class C4DrawTransform pTransform,
uint32_t  dwClr = 0xff 
)

Definition at line 3737 of file C4Game.cpp.

References C4Id2Def(), C4Def::Draw(), C4Facet::DrawXT(), GetTextSpecFacet(), C4Facet::Hgt, C4Facet::Surface, C4Facet::Wdt, C4Facet::X, and C4Facet::Y.

Referenced by C4MainMenu::DoRefillInternal().

3738 {
3739  // safety
3740  assert(szSpec && *szSpec);
3741  if (!szSpec) return false;
3742 
3743  C4Facet fctSource;
3744  if(GetTextSpecFacet(szSpec, fctSource))
3745  {
3746  fctSource.DrawXT(fctTarget.Surface, fctTarget.X, fctTarget.Y, fctTarget.Wdt, fctTarget.Hgt, 0, 0, pTransform);
3747  return true;
3748  }
3749  else
3750  {
3751  C4Def *pDef = C4Id2Def(C4ID(szSpec));
3752  if (!pDef) return false;
3753 
3754  pDef->Draw(fctTarget, false, dwClr, nullptr, 0, 0, pTransform);
3755  return true;
3756  }
3757 }
float Y
Definition: C4Facet.h:118
bool GetTextSpecFacet(const char *szSpec, C4Facet &fct)
Definition: C4Game.cpp:3717
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
Definition: C4Def.cpp:597
Definition: C4Def.h:98
Definition: C4Id.h:25
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
float Hgt
Definition: C4Facet.h:118
void DrawXT(C4Surface *sfcTarget, float iX, float iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
Definition: C4Facet.cpp:392
C4Surface * Surface
Definition: C4Facet.h:117
float Wdt
Definition: C4Facet.h:118
float X
Definition: C4Facet.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DropDef ( C4ID  id,
float  iX,
float  iY 
)

Definition at line 1394 of file C4Game.cpp.

References C4Id2Def(), CDT_Decide, CID_EMMoveObj, Console, Control, C4ControlEMMoveObject::CreateObject(), C4GameControl::DoInput(), FormatString(), ftofix(), LoadResStr(), and C4ConsoleGUI::Out().

Referenced by DropFile(), and ViewportWinProc().

1395 {
1396  // Get def
1397  C4Def *pDef;
1398  if ((pDef=C4Id2Def(id)))
1399  {
1401  return true;
1402  }
1403  else
1404  {
1405  // Failure
1406  Console.Out(FormatString(LoadResStr("IDS_CNS_DROPNODEF"),id.ToString()).getData());
1407  }
1408  return false;
1409 }
C4Console Console
Definition: C4Globals.cpp:45
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4GameControl Control
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
Definition: C4Def.h:98
void Out(const char *message)
Definition: C4Console.cpp:684
C4Fixed ftofix(float x)
Definition: C4Real.h:258
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
static C4ControlEMMoveObject * CreateObject(const C4ID &id, C4Real x, C4Real y, C4Object *container)
Definition: C4Control.cpp:1214
#define X(sdl, oc)
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::DropFile ( const char *  szFilename,
float  iX,
float  iY 
)

Definition at line 1373 of file C4Game.cpp.

References Application, C4D_Load_RX, C4Id2Def(), Config, Console, DefFileGetID(), Definitions, DropDef(), FormatString(), C4Config::General, GetExtension(), GetFilename(), C4ConfigGeneral::LanguageEx, C4DefList::Load(), LoadResStr(), C4ConsoleGUI::Out(), SEqualNoCase(), and C4Application::SoundSystem.

Referenced by C4Viewport::DropFile().

1374 {
1375  C4ID c_id; C4Def *cdef;
1376  // Drop def to create object
1377  if (SEqualNoCase(GetExtension(szFilename),"ocd"))
1378  {
1379  // Get id from file
1380  if ((c_id=DefFileGetID(szFilename)))
1381  // Get loaded def or try to load def from file
1382  if ( (cdef=C4Id2Def(c_id))
1383  || (::Definitions.Load(szFilename,C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem) && (cdef=C4Id2Def(c_id))) )
1384  {
1385  return DropDef(c_id, iX, iY);
1386  }
1387  // Failure
1388  Console.Out(FormatString(LoadResStr("IDS_CNS_DROPNODEF"),GetFilename(szFilename)).getData());
1389  return false;
1390  }
1391  return false;
1392 }
char * GetFilename(char *szPath)
Definition: StdFile.cpp:45
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Config Config
Definition: C4Config.cpp:833
C4Console Console
Definition: C4Globals.cpp:45
C4ConfigGeneral General
Definition: C4Config.h:251
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:207
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const DWORD C4D_Load_RX
Definition: C4Def.h:91
Definition: C4Def.h:98
void Out(const char *message)
Definition: C4Console.cpp:684
bool DropDef(C4ID id, float iX, float iY)
Definition: C4Game.cpp:1394
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:121
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:37
Definition: C4Id.h:25
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
Definition: C4DefList.cpp:71
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4DefList Definitions
Definition: C4Globals.cpp:49
C4Application Application
Definition: C4Globals.cpp:44
C4ID DefFileGetID(const char *szFilename)
Definition: C4Game.cpp:1363
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::Evaluate ( )

Definition at line 1503 of file C4Game.cpp.

References Control, C4PlayerList::Evaluate(), Evaluated, C4RoundResults::EvaluateGame(), StdStrBuf::getData(), C4Network2::isEnabled(), C4Network2::isHost(), C4GameParameters::isLeague(), C4GameControl::isRecord(), C4Network2::LeagueGameEvaluate(), LoadResStr(), Log(), Network, Parameters, Players, RoundResults, C4PlayerList::Save(), SHA_DIGEST_LENGTH, and C4GameControl::StopRecord().

Referenced by Clear(), and Execute().

1504 {
1505 
1506  // League game?
1507  bool fLeague = Network.isEnabled() && Network.isHost() && Parameters.isLeague();
1508 
1509  // Stop record
1510  StdStrBuf RecordName; BYTE RecordSHA[SHA_DIGEST_LENGTH];
1511  if (Control.isRecord())
1512  Control.StopRecord(&RecordName, fLeague ? RecordSHA : nullptr);
1513 
1514  // Send league result
1515  if (fLeague)
1516  Network.LeagueGameEvaluate(RecordName.getData(), RecordSHA);
1517 
1518  // Players
1519  // saving local players only, because remote players will probably not rejoin after evaluation anyway)
1520  Players.Evaluate();
1521  Players.Save(true);
1522 
1523  // Round results
1525 
1526  // Set game flag
1527  Log(LoadResStr("IDS_PRC_EVALUATED"));
1528  Evaluated=true;
1529 
1530 }
const char * getData() const
Definition: StdBuf.h:442
#define SHA_DIGEST_LENGTH
void StopRecord(StdStrBuf *pRecordName=nullptr, BYTE *pRecordSHA1=nullptr)
bool isHost() const
Definition: C4Network2.h:209
bool isRecord() const
uint8_t BYTE
C4GameParameters & Parameters
Definition: C4Game.h:67
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Network2 Network
Definition: C4Globals.cpp:53
C4GameControl Control
C4PlayerList Players
bool isEnabled() const
Definition: C4Network2.h:203
C4RoundResults & RoundResults
Definition: C4Game.h:73
bool Evaluated
Definition: C4Game.h:115
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
bool isLeague() const
void LeagueGameEvaluate(const char *szRecordName=nullptr, const BYTE *pRecordSHA=nullptr)
bool Save(bool fSaveLocalOnly)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::ExecObjects ( )
protected

Definition at line 1321 of file C4Game.cpp.

References AddDbgRec(), Config, C4GameObjects::CrossCheck(), C4ConfigGeneral::DebugRec, fResortAnyObject, Game, C4Config::General, iTick255, ObjectRemovalCheck(), Objects, RCT_Block, C4GameObjects::ResortUnsorted(), and C4ObjectList::reverse().

Referenced by Execute().

1322 {
1323  if (Config.General.DebugRec)
1324  AddDbgRec(RCT_Block, "ObjEx", 6);
1325 
1326  // Execute objects - reverse order to ensure
1327  for (C4Object *cObj : Objects.reverse())
1328  {
1329  if (cObj)
1330  {
1331  if (cObj->Status)
1332  // Execute object
1333  cObj->Execute();
1334  else
1335  // Status reset: process removal delay
1336  if (cObj->RemovalDelay>0) cObj->RemovalDelay--;
1337  }
1338  }
1339 
1340  if (Config.General.DebugRec)
1341  AddDbgRec(RCT_Block, "ObjCC", 6);
1342 
1343  // Cross check objects
1344  Objects.CrossCheck();
1345 
1346  if (Config.General.DebugRec)
1347  AddDbgRec(RCT_Block, "ObjRs", 6);
1348 
1349  // Resort
1350  if (fResortAnyObject)
1351  {
1352  fResortAnyObject = false;
1354  }
1355 
1356  if (Config.General.DebugRec)
1357  AddDbgRec(RCT_Block, "ObjRm", 6);
1358 
1359  // Removal
1360  if (!::Game.iTick255) ObjectRemovalCheck();
1361 }
C4Config Config
Definition: C4Config.cpp:833
int32_t iTick255
Definition: C4Game.h:129
C4Game Game
Definition: C4Globals.cpp:52
C4ConfigGeneral General
Definition: C4Config.h:251
void ObjectRemovalCheck()
Definition: C4Game.cpp:1309
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:32
const ReverseView reverse() const
Definition: C4ObjectList.h:104
bool fResortAnyObject
Definition: C4Game.h:138
int32_t DebugRec
Definition: C4Config.h:60
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::Execute ( )

Definition at line 709 of file C4Game.cpp.

References AddDbgRec(), C4ST_RESETPART, C4ST_SHOWPARTSTAT, C4ParticleSystem::CalculateNextStep(), Config, Control, C4ConfigGeneral::DebugRec, C4Landscape::DoRelights(), C4GameControl::DoSyncCheck(), Evaluate(), Evaluated, EXEC_DR, EXEC_S, EXEC_S_DR, ExecObjects(), C4PlayerList::Execute(), C4Weather::Execute(), C4MassMoverSet::Execute(), C4PXSSystem::Execute(), C4Landscape::Execute(), C4GameMessageList::Execute(), C4Effect::Execute(), C4MouseControl::Execute(), C4GameControl::Execute(), C4Network2::Execute(), FrameCounter, GameGo, GameOver, GameOverCheck(), GameOverDlgShown, GameScript, C4Config::General, HaltCount, IsRunning, Landscape, MassMover, Messages, MouseControl, Network, Particles, C4AulScriptEngine::pGlobalEffects, Players, C4GameControl::Prepare(), C4GameScriptHost::pScenarioEffects, PXS, RCT_Block, RCT_DbgFrame, ScriptEngine, ShowGameOverDlg(), Ticks(), and Weather.

Referenced by C4Application::GameTick().

710 {
711 
712  // Let's go
713  GameGo = true;
714 
715  // Network
716  Network.Execute();
717 
718  // Prepare control
719  bool fControl;
720  EXEC_S( fControl = Control.Prepare(); , ControlStat )
721  if (!fControl) return false; // not ready yet: wait
722 
723  // Halt
724  if (HaltCount) return false;
725 
726  if (Config.General.DebugRec)
727  Landscape.DoRelights();
728 
729  // Execute the control
730  Control.Execute();
731  if (!IsRunning) return false;
732 
733  // Ticks
734  EXEC_DR( Ticks(); , "Ticks")
735 
736  if (Config.General.DebugRec)
737  // debugrec
738  AddDbgRec(RCT_DbgFrame, &FrameCounter, sizeof(int32_t));
739 
740  // allow the particle system to execute the next frame BEFORE the other game stuff is calculated since it will run in parallel to the main thread
741  Particles.CalculateNextStep();
742 
743  // Game
744 
745  EXEC_S( ExecObjects(); , ExecObjectsStat )
746  EXEC_S_DR( C4Effect::Execute(&ScriptEngine.pGlobalEffects);
747  C4Effect::Execute(&GameScript.pScenarioEffects);
748  , GEStats , "GEEx\0");
749  EXEC_S_DR( PXS.Execute(); , PXSStat , "PXSEx")
750  EXEC_S_DR( MassMover.Execute(); , MassMoverStat , "MMvEx")
751  EXEC_S_DR( Weather.Execute(); , WeatherStat , "WtrEx")
752  EXEC_S_DR( Landscape.Execute(); , LandscapeStat , "LdsEx")
753  EXEC_S_DR( Players.Execute(); , PlayersStat , "PlrEx")
754  EXEC_S_DR( ::Messages.Execute(); , MessagesStat , "MsgEx")
755 
756  EXEC_DR( MouseControl.Execute(); , "Input")
757 
758  EXEC_DR( GameOverCheck(); , "Misc\0")
759 
760  Control.DoSyncCheck();
761 
762  // Evaluation; Game over dlg
763  if (GameOver)
764  {
765  if (!Evaluated) Evaluate();
767  }
768 
769  // show stat each 1000 ticks
770  if (!(FrameCounter % 1000))
771  {
772  C4ST_SHOWPARTSTAT(FrameCounter)
774  }
775 
776  if (Config.General.DebugRec)
777  {
778  AddDbgRec(RCT_Block, "eGame", 6);
780  }
781 
782  return true;
783 }
bool IsRunning
Definition: C4Game.h:139
C4Config Config
Definition: C4Config.cpp:833
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4ParticleSystem Particles
#define C4ST_RESETPART
Definition: C4Stat.h:157
bool GameOverDlgShown
Definition: C4Game.h:116
bool Execute()
Definition: C4Game.cpp:709
void Execute()
Definition: C4Network2.cpp:648
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
void ShowGameOverDlg()
Definition: C4Game.cpp:3113
int32_t FrameCounter
Definition: C4Game.h:128
#define EXEC_S_DR(Expressions, Stat, DebugRecName)
Definition: C4Game.cpp:706
void Ticks()
Definition: C4Game.cpp:1636
C4Network2 Network
Definition: C4Globals.cpp:53
bool GameOverCheck()
Definition: C4Game.cpp:670
bool GameOver
Definition: C4Game.h:114
C4GameControl Control
C4Landscape Landscape
C4PlayerList Players
#define EXEC_S(Expressions, Stat)
Definition: C4Game.cpp:703
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:32
#define EXEC_DR(Expressions, DebugRecName)
Definition: C4Game.cpp:707
C4Weather Weather
Definition: C4Weather.cpp:206
C4PXSSystem PXS
Definition: C4PXS.cpp:525
C4Control & Input
Definition: C4Game.h:82
C4MassMoverSet MassMover
#define C4ST_SHOWPARTSTAT(FrameCounter)
Definition: C4Stat.h:155
bool Evaluated
Definition: C4Game.h:115
void ExecObjects()
Definition: C4Game.cpp:1321
bool GameGo
Definition: C4Game.h:135
bool DoRelights()
int32_t HaltCount
Definition: C4Game.h:112
C4GameMessageList Messages
void Evaluate()
Definition: C4Game.cpp:1503

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindConstuctionSiteBlock ( int32_t  tx,
int32_t  ty,
int32_t  wdt,
int32_t  hgt 
)

Definition at line 1142 of file C4Game.cpp.

References C4LArea::FirstObjectShapes(), C4Rect::Hgt, C4LArea::NextObjectShapes(), Objects, OCF_Exclusive, C4Rect::Overlap(), C4GameObjects::Sectors, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

Referenced by ConstructionCheck(), and FindConSiteSpot().

1143 {
1144  C4Rect rect1,rect2;
1145  rect1.x=tx; rect1.y=ty; rect1.Wdt=wdt; rect1.Hgt=hgt;
1146  C4LArea Area(&::Objects.Sectors, tx, ty, wdt, hgt); C4LSector *pSector;
1147  for (C4ObjectList *pObjs = Area.FirstObjectShapes(&pSector); pSector; pObjs = Area.NextObjectShapes(pObjs, &pSector))
1148  for (C4Object *cObj : *pObjs)
1149  if (cObj->Status && !cObj->Contained)
1150  if (cObj->OCF & OCF_Exclusive)
1151  {
1152  rect2=cObj->Shape; rect2.x+=cObj->GetX(); rect2.y+=cObj->GetY();
1153  if (rect1.Overlap(rect2)) return cObj;
1154  }
1155  return nullptr;
1156 }
Definition: C4Rect.h:27
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
const uint32_t OCF_Exclusive
Definition: C4Constants.h:89
C4LSectors Sectors
Definition: C4GameObjects.h:42
int32_t x
Definition: C4Rect.h:30
bool Overlap(C4Rect &rTarget)
Definition: C4Rect.cpp:91
int32_t Hgt
Definition: C4Rect.h:30
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindObject ( C4Def pDef,
int32_t  iX = 0,
int32_t  iY = 0,
int32_t  iWdt = 0,
int32_t  iHgt = 0,
DWORD  ocf = OCF_All,
C4Object pFindNext = nullptr 
)

Definition at line 1158 of file C4Game.cpp.

References C4Def::Count, C4Object::GetX(), C4Object::GetY(), and Objects.

Referenced by C4Command::Acquire(), and C4EditCursor::Move().

1162 {
1163 
1164  C4Object *pClosest=nullptr;
1165  int32_t iClosest = 0,iDistance,iFartherThan=-1;
1166  C4Object *pFindNextCpy=pFindNext;
1167 
1168  // check the easy case first: no instances at all?
1169  if (pDef && !pDef->Count) return nullptr;
1170 
1171  // Finding next closest: find closest but further away than last closest
1172  if (pFindNext && (iWdt==-1) && (iHgt==-1))
1173  {
1174  iFartherThan = (pFindNext->GetX()-iX)*(pFindNext->GetX()-iX)+(pFindNext->GetY()-iY)*(pFindNext->GetY()-iY);
1175  pFindNext = nullptr;
1176  }
1177 
1178  // Scan all objects
1179  for (C4Object *cObj : Objects)
1180  {
1181  // Not skipping to find next
1182  if (!pFindNext)
1183  // Status
1184  if (cObj->Status)
1185  // ID
1186  if (!pDef || (cObj->Def == pDef))
1187  // OCF (match any specified)
1188  if (cObj->OCF & ocf)
1189  // Area
1190  {
1191  // Point
1192  if ((iWdt==0) && (iHgt==0))
1193  {
1194  if (Inside<int32_t>(iX-(cObj->GetX()+cObj->Shape.x),0,cObj->Shape.Wdt-1))
1195  if (Inside<int32_t>(iY-(cObj->GetY()+cObj->Shape.y),0,cObj->Shape.Hgt-1))
1196  return cObj;
1197  continue;
1198  }
1199  // Closest
1200  if ((iWdt==-1) && (iHgt==-1))
1201  {
1202  iDistance = (cObj->GetX()-iX)*(cObj->GetX()-iX)+(cObj->GetY()-iY)*(cObj->GetY()-iY);
1203  // same distance?
1204  if ((iDistance == iFartherThan) && !pFindNextCpy)
1205  return cObj;
1206  // nearer than/first closest?
1207  if (!pClosest || (iDistance < iClosest))
1208  if (iDistance > iFartherThan)
1209  { pClosest=cObj; iClosest=iDistance; }
1210  }
1211  // Range
1212  else if (Inside<int32_t>(cObj->GetX()-iX,0,iWdt-1) && Inside<int32_t>(cObj->GetY()-iY,0,iHgt-1))
1213  return cObj;
1214  }
1215 
1216  // Find next mark reached
1217  if (cObj == pFindNextCpy) pFindNext = pFindNextCpy = nullptr;
1218 
1219  }
1220 
1221  return pClosest;
1222 
1223 }
int32_t GetY() const
Definition: C4Object.h:287
int32_t Count
Definition: C4Def.h:179
int32_t GetX() const
Definition: C4Object.h:286
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4Game::FindVisObject ( float  tx,
float  ty,
int32_t  iPlr,
const C4Facet fctViewportGame,
const C4Facet fctViewportGUI,
float  iX,
float  iY,
DWORD  category,
float  gui_x,
float  gui_y 
)

Definition at line 1225 of file C4Game.cpp.

References C4D_Foreground, C4D_MouseIgnore, C4OS_NORMAL, C4Player::Cursor, C4GameObjects::ForeObjects, C4PlayerList::Get(), C4Object::Layer, Objects, Players, C4Facet::X, and C4Facet::Y.

Referenced by C4MouseControl::GetTargetObject().

1227 {
1228  // FIXME: Use C4FindObject here for optimization
1229  // -- can't really do that, since sectors ignore parallaxity, etc.
1230  // determine layer to search in
1231  C4Object *layer_object = nullptr;
1232  C4Player *plr = ::Players.Get(iPlr);
1233  if (plr && plr->Cursor) layer_object = plr->Cursor->Layer;
1234  // scan all object lists separately
1236  while (pLst)
1237  {
1238  // Scan all objects in list
1239  for (C4Object *cObj : *pLst)
1240  {
1241  // Status
1242  if (cObj->Status == C4OS_NORMAL)
1243  // exclude fore-objects from main list
1244  if ((pLst != &Objects) || (~cObj->Category & C4D_Foreground))
1245  // exclude MouseIgnore-objects
1246  if (~cObj->Category & C4D_MouseIgnore)
1247  // Category (match any specified)
1248  if (cObj->Category & category)
1249  // Container
1250  if (!cObj->Contained)
1251  // Visibility
1252  if (cObj->IsVisible(iPlr, false))
1253  // Layer check: Layered objects are invisible to players whose cursor is in another layer
1254  // except for GUI: GUI always visible
1255  {
1256  if (cObj->Layer != layer_object)
1257  if (pLst != &::Objects.ForeObjects)
1258  continue;
1259  // Area
1260  // get object position
1261  float iObjX, iObjY, check_x, check_y;
1262  if (pLst == &::Objects.ForeObjects)
1263  {
1264  // object position for HUD object
1265  check_x = gui_x; check_y = gui_y;
1266  cObj->GetViewPos(iObjX, iObjY, -fctViewportGUI.X, -fctViewportGUI.Y, fctViewportGUI);
1267  }
1268  else
1269  {
1270  // object position for game object
1271  check_x = game_x; check_y = game_y;
1272  cObj->GetViewPos(iObjX, iObjY, tx, ty, fctViewportGame);
1273  }
1274  // Point search
1275  if (Inside<float>(check_x-(iObjX+cObj->Shape.x),0,float(cObj->Shape.Wdt)-1))
1276  if (Inside<float>(check_y-(iObjY+cObj->Shape.y-cObj->addtop()),0,float(cObj->Shape.Hgt+cObj->addtop()-1)))
1277  return cObj;
1278  }
1279  }
1280  // next list
1281  if (pLst == &::Objects.ForeObjects) pLst = &Objects;
1282  else pLst = nullptr;
1283  }
1284 
1285  // none found
1286  return nullptr;
1287 }
float Y
Definition: C4Facet.h:118
C4ObjectPtr Cursor
Definition: C4Player.h:130
#define C4OS_NORMAL
Definition: C4Object.h:35
C4ObjectPtr Layer
Definition: C4Object.h:136
C4Player * Get(int iPlayer) const
C4PlayerList Players
const int32_t C4D_MouseIgnore
Definition: C4Def.h:54
C4ObjectList ForeObjects
Definition: C4GameObjects.h:44
float X
Definition: C4Facet.h:118
const int32_t C4D_Foreground
Definition: C4Def.h:53
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::FixRandom ( uint64_t  iSeed)

Definition at line 3090 of file C4Game.cpp.

References FixedRandom().

Referenced by C4Landscape::Init(), InitControl(), LoadScenarioSection(), PreInit(), and Synchronize().

3091 {
3092  FixedRandom(iSeed);
3093 }
void FixedRandom(uint64_t seed)
Definition: C4Random.cpp:37

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::GameOverCheck ( )
protected

Definition at line 670 of file C4Game.cpp.

References Control, DoGameOver(), Game, GameOver, C4PlayerList::GetCountNotEliminated(), C4GameControl::isReplay(), iTick35, and Players.

Referenced by Execute().

671 {
672  bool fDoGameOver = false;
673 
674  // Only every 35 ticks
675  if (::Game.iTick35) return false;
676 
677  // do not GameOver in replay
678  if (Control.isReplay()) return false;
679 
680  // All players eliminated: game over
682  fDoGameOver=true;
683 
684  // Message
685  if (fDoGameOver) DoGameOver();
686 
687  return GameOver;
688 }
bool DoGameOver()
Definition: C4Game.cpp:3095
C4Game Game
Definition: C4Globals.cpp:52
int32_t iTick35
Definition: C4Game.h:129
int GetCountNotEliminated() const
bool GameOver
Definition: C4Game.h:114
C4GameControl Control
C4PlayerList Players
bool isReplay() const
Definition: C4GameControl.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

float C4Game::GetTextSpecImageAspect ( const char *  szSpec)

Definition at line 3759 of file C4Game.cpp.

References C4Id2Def(), StdMesh::GetBoundingBox(), GetTextSpecFacet(), C4Def::Graphics, C4Rect::Hgt, C4Facet::Hgt, C4Def::PictureRect, C4DefGraphics::Type, C4DefGraphics::TYPE_Bitmap, C4DefGraphics::TYPE_Mesh, C4Rect::Wdt, C4Facet::Wdt, StdMeshBox::x1, StdMeshBox::x2, StdMeshBox::y1, and StdMeshBox::y2.

3760 {
3761  // safety
3762  assert(szSpec && *szSpec);
3763  if (!szSpec) return -1.0f;
3764 
3765  C4Facet fctSource;
3766  if(GetTextSpecFacet(szSpec, fctSource))
3767  {
3768  return static_cast<float>(fctSource.Wdt) / static_cast<float>(fctSource.Hgt);
3769  }
3770  else
3771  {
3772  C4Def *pDef = C4Id2Def(C4ID(szSpec));
3773  if (!pDef) return -1.0f;
3774 
3775  C4DefGraphics* pGfx = &pDef->Graphics;
3776  if(pGfx->Type == C4DefGraphics::TYPE_Bitmap)
3777  {
3778  return static_cast<float>(pDef->PictureRect.Wdt) / static_cast<float>(pDef->PictureRect.Hgt);
3779  }
3780  else if (pGfx->Type == C4DefGraphics::TYPE_Mesh)
3781  {
3782  const StdMesh& mesh = *pGfx->Mesh;
3783  const StdMeshBox& box = mesh.GetBoundingBox();
3784  return (box.x2 - box.x1) / (box.y2 - box.y1);
3785  }
3786 
3787  return -1.0f;
3788  }
3789 }
float y2
Definition: StdMesh.h:147
C4Rect PictureRect
Definition: C4Def.h:107
float x2
Definition: StdMesh.h:147
bool GetTextSpecFacet(const char *szSpec, C4Facet &fct)
Definition: C4Game.cpp:3717
int32_t Wdt
Definition: C4Rect.h:30
float y1
Definition: StdMesh.h:146
Definition: C4Def.h:98
Definition: C4Id.h:25
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
float Hgt
Definition: C4Facet.h:118
GraphicsType Type
Definition: C4DefGraphics.h:48
float x1
Definition: StdMesh.h:146
int32_t Hgt
Definition: C4Rect.h:30
float Wdt
Definition: C4Facet.h:118
const StdMeshBox & GetBoundingBox() const
Definition: StdMesh.h:206
C4DefGraphics Graphics
Definition: C4Def.h:191

Here is the call graph for this function:

C4String * C4Game::GetTranslatedString ( const class C4Value input_string,
C4Value selected_language,
bool  fail_silently 
) const

Definition at line 3890 of file C4Game.cpp.

References C4Value::_getPropList(), C4Value::_getStr(), C4V_Nil, C4V_String, Config, C4StringTable::FindString(), FormatString(), C4Config::General, StdStrBuf::getData(), C4Value::GetDataString(), C4PropList::GetPropertyByS(), C4PropList::GetPropertyStr(), C4PropList::GetSortedLocalProperties(), C4Value::getStr(), C4Value::GetType(), C4ConfigGeneral::LanguageEx, C4StringTable::P, P_Function, P_Translate, SCopySegment(), C4Value::SetString(), and Strings.

3891 {
3892  // Resolve a localized string
3893  // If a string is passed, just return it
3894  // If a proplist like { DE="Hallo, Welt!", US="Hello, world!" } is passed, return the string matching the selected language
3895  // Nothing?
3896  if (input_string.GetType() == C4V_Nil)
3897  {
3898  return nullptr;
3899  }
3900  // Non-localized string?
3901  if (input_string.GetType() == C4V_String)
3902  {
3903  return input_string._getStr();
3904  }
3905  // Invalid type for this function?
3906  C4PropList *p = input_string._getPropList();
3907  if (!p || p->GetPropertyStr(P_Function) != &::Strings.P[P_Translate])
3908  {
3909  if (fail_silently)
3910  {
3911  return nullptr;
3912  }
3913  else
3914  {
3915  throw C4AulExecError(FormatString("Invalid value for translation: %s", input_string.GetDataString().getData()).getData());
3916  }
3917  }
3918  // This is a proplist. Resolve the language as the key.
3919  char lang_code[3] = "";
3920  for (int32_t lang_index = 0; SCopySegment(Config.General.LanguageEx, lang_index, lang_code, ',', 2); ++lang_index)
3921  {
3922  C4String *lang_string = ::Strings.FindString(lang_code);
3923  if (lang_string) // If the string is not found, it cannot be the key in a prop list
3924  {
3925  C4Value localized_string_val;
3926  if (p->GetPropertyByS(lang_string, &localized_string_val))
3927  {
3928  C4String *localized_string = localized_string_val.getStr();
3929  if (localized_string)
3930  {
3931  // Found it!
3932  if (selected_language)
3933  {
3934  selected_language->SetString(lang_string);
3935  }
3936  return localized_string;
3937  }
3938  }
3939  }
3940  }
3941  // No language matched. Just use any property and assume it's a language key.
3942  for (C4String *lang_string : p->GetSortedLocalProperties(false))
3943  {
3944  C4Value localized_string_val;
3945  if (p->GetPropertyByS(lang_string, &localized_string_val))
3946  {
3947  C4String *localized_string = localized_string_val.getStr();
3948  if (localized_string)
3949  {
3950  // Found it!
3951  if (selected_language)
3952  {
3953  selected_language->SetString(lang_string);
3954  }
3955  return localized_string;
3956  }
3957  }
3958  }
3959  // No string properties. There's no localized information to be found.
3960  return nullptr;
3961 }
C4String P[P_LAST]
C4Config Config
Definition: C4Config.cpp:833
C4String * getStr() const
Definition: C4Value.h:117
C4ConfigGeneral General
Definition: C4Config.h:251
C4String * FindString(const char *strString) const
bool SCopySegment(const char *szString, int iSegment, char *sTarget, char cSeparator, int iMaxL, bool fSkipWhitespace)
Definition: Standard.cpp:273
void SetString(C4String *Str)
Definition: C4Value.h:138
std::vector< C4String * > GetSortedLocalProperties(bool add_prototype=true) const
Definition: C4PropList.cpp:576
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:757
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:37
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:775
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

C4Value C4Game::GRBroadcast ( const char *  szFunction,
C4AulParSet pPars = nullptr,
bool  fPassError = false,
bool  fRejectTest = false 
)

Definition at line 3846 of file C4Game.cpp.

References C4GameScriptHost::Call(), GameScript, C4GameObjects::GRBroadcast(), and Objects.

Referenced by C4Object::AssignDeath(), DoGameOver(), C4Player::Init(), LoadScenarioSection(), OnPlayerJoinFinished(), C4PlayerList::Remove(), C4Player::ScenarioInit(), and C4Player::SetWealth().

3847 {
3848  std::string func{ szFunction };
3849  if (func[0] != '~')
3850  func.insert(0, 1, '~');
3851 
3852  // call objects first - scenario script might overwrite hostility, etc...
3853  C4Value vResult = ::Objects.GRBroadcast(func.c_str(), pPars, fPassError, fRejectTest);
3854  // rejection tests abort on first nonzero result
3855  if (fRejectTest) if (!!vResult) return vResult;
3856  // scenario script call
3857  return ::GameScript.Call(func.c_str(), pPars, fPassError);
3858 }
C4GameScriptHost GameScript
C4Value GRBroadcast(const char *szFunction, C4AulParSet *pPars, bool fPassError, bool fRejectTest)
C4Value Call(const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false)
C4GameObjects Objects
Definition: C4Globals.cpp:48

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::HasScenario ( )
inline

Definition at line 162 of file C4Game.h.

References StdStrBuf::getSize().

Referenced by C4Application::ParseCommandLine(), and C4Application::PreInit().

char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:102
size_t getSize() const
Definition: StdBuf.h:444
StdStrBuf RecordStream
Definition: C4Game.h:125
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:106

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::Init ( )

Definition at line 328 of file C4Game.cpp.

References C4Value::_getPropList(), _MAX_PATH, C4GameParameters::AllowDebug, C4ConfigGeneral::AlwaysDebug, Application, C4S, C4FullScreen::CloseMenu(), Config, Console, StdStrBuf::Copy(), DebugMode, DirectJoinAddress, DirectJoinFilePrefix, C4Scoreboard::DoDlgShow(), C4Network2::DoLobby(), Extra, C4Network2::FinalInit(), fQuitWithError, FullScreen, C4GameParameters::GameRes, C4Config::General, GetLogPos(), GlobalSoundModifier, GraphicsSystem, C4Scenario::Head, IM_Normal, C4Extra::Init(), InitFullscreenComponents(), C4Console::InitGame(), InitGame(), InitGameFinal(), InitKeyboard(), C4GraphicsSystem::InitLoaderScreen(), InitNetworkFromAddress(), InitNetworkFromReference(), InitNetworkFromReferenceFile(), InitNetworkHost(), InitPlayers(), InitProgress, C4GraphicsSystem::InvalidateBg(), C4Application::isEditor, C4Network2::isEnabled(), C4Network2::isLobbyActive(), IsRunning, LastInitProgress, C4SHead::Loader, LoadResStr(), Log(), LogFatal(), Network, C4SHead::NetworkGame, OpenScenario(), Parameters, C4ConfigGeneral::Participants, pGUI, pJoinReference, PlayerFilenames, C4GraphicsSystem::pLoaderScreen, pNetworkStatistics, C4GameResList::RetrieveFiles(), C4Network2::RetrieveScenario(), C4SHead::SaveGame, ScenarioFile, ScenarioFilename, SCopy(), Scoreboard, SEqual2(), C4GUI::Screen::SetExclusive(), SetGlobalSoundModifier(), SetInitProgress(), StartTime, StartupLogPos, SyncClearance(), Synchronize(), TempScenarioFile, C4Startup::Unload(), and C4GameLobby::UserAbort.

Referenced by C4Application::GameTick().

329 {
330  C4ValueNumbers numbers;
331  IsRunning = false;
332 
334  SetInitProgress(0);
335 
336  // reinit keyboard to reflect any config changes that might have been done
337  // this is a good time to do it, because no GUI dialogs are opened
338  if (!InitKeyboard()) LogFatal(LoadResStr("IDS_ERR_NOKEYBOARD"));
339 
340  // start log pos (used by startup)
342  fQuitWithError = false;
343  C4GameLobby::UserAbort = false;
344 
345  // Store a start time that identifies this game on this host
346  StartTime = time(nullptr);
347 
348  // Get PlayerFilenames from Config, if ParseCommandLine did not fill some in
349  // Must be done here, because InitGame calls PlayerInfos.InitLocal
350  if (!*PlayerFilenames)
351  {
353  }
354 
355  // Join a game?
357  {
358 
360  {
361  // init extra; needed for loader screen
362  Log(LoadResStr("IDS_PRC_INITEXTRA"));
363  if (!Extra.Init())
364  { LogFatal(LoadResStr("IDS_PRC_ERREXTRA")); return false; }
365 
366  // init loader
368  { LogFatal(LoadResStr("IDS_PRC_ERRLOADER")); return false; }
369  }
370 
371  SetInitProgress(5);
372 
373  // Initialize network
374  if (pJoinReference)
375  {
376  // By reference
377  bool fSuccess = InitNetworkFromReference(*pJoinReference);
378  pJoinReference.reset();
379  if (!fSuccess)
380  return false;
381  }
383  {
384  // By reference serialized to temp file
386  return false;
387  }
388  else
389  {
390  // By address
392  return false;
393  }
394 
395  // check wether console mode is allowed
397  { LogFatal(LoadResStr("IDS_TEXT_JOININCONSOLEMODENOTALLOW")); return false; }
398 
399  // do lobby (if desired)
400  if (Network.isLobbyActive())
401  if (!Network.DoLobby())
402  return false;
403 
404  // get scenario
405  char szScenario[_MAX_PATH+1];
406  SetInitProgress(6);
407  if (!Network.RetrieveScenario(szScenario)) return false;
408 
409  // open new scenario
410  SCopy(szScenario, ScenarioFilename, _MAX_PATH);
411  if (!OpenScenario()) return false;
413 
414  // get everything else
415  if (!Parameters.GameRes.RetrieveFiles()) return false;
416 
417  // Check network game data scenario type (safety)
418  if (!C4S.Head.NetworkGame)
419  { LogFatal(LoadResStr("IDS_NET_NONETGAME")); return false; }
420 
421  SetInitProgress(7);
422 
423  }
424 
425  // Local game or host?
426  else
427  {
428 
429  // Open scenario
430  if (!OpenScenario())
431  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
432 
433  // init extra; needed for loader screen
434  Log(LoadResStr("IDS_PRC_INITEXTRA"));
435  if (!Extra.Init())
436  { LogFatal(LoadResStr("IDS_PRC_ERREXTRA")); return false; }
437 
438  // init loader
440  { LogFatal(LoadResStr("IDS_PRC_ERRLOADER")); return false; }
441 
442  // Init network
443  if (!InitNetworkHost()) return false;
444  SetInitProgress(7);
445 
446  }
447 
448  // now free all startup gfx to make room for game gfx
450 
451  // Init debugmode
454  DebugMode = true;
455  if (!Parameters.AllowDebug)
456  DebugMode = false;
457 
458  // Init game
459  if (!InitGame(ScenarioFile, IM_Normal, true, &numbers)) return false;
460 
461  // Network final init
462  if (Network.isEnabled())
463  {
464  if (!Network.FinalInit()) return false;
465  }
466  // non-net may have to synchronize now to keep in sync with replays
467  // also needs to synchronize to update transfer zones
468  else
469  {
470  // - would kill DebugRec-sync for runtime debugrec starts
471  C4DebugRecOff DBGRECOFF(!!C4S.Head.SaveGame);
472  SyncClearance();
473  Synchronize(false);
474  }
475 
476  // Init players
477  if (!InitPlayers(&numbers)) return false;
478  SetInitProgress(98);
479 
480  // Final init
481  if (!InitGameFinal(IM_Normal)) return false;
482  SetInitProgress(99);
483 
484  // Sound modifier from savegames
486 
487  // Message board and upper board
488  if (!Application.isEditor)
489  {
491  }
492 
493  // Default fullscreen menu, in case any old surfaces are left (extra safety)
495 
496  // start statistics (always for now. Make this a config?)
497  pNetworkStatistics = std::make_unique<C4Network2Stats>();
498 
499  // clear loader screen
501  {
504  }
505 
506  // game running now!
507  IsRunning = true;
508 
509  // Start message
510  Log(LoadResStr(C4S.Head.NetworkGame ? "IDS_PRC_JOIN" : C4S.Head.SaveGame ? "IDS_PRC_RESUME" : "IDS_PRC_START"));
511 
512  // set non-exclusive GUI
513  pGUI->SetExclusive(false);
514 
515  // after GUI is made non-exclusive, recheck the scoreboard
516  Scoreboard.DoDlgShow(0, false);
517  SetInitProgress(100);
518 
519  // and redraw background
521 
522  // Notify editor
523  Console.InitGame();
524 
525  return true;
526 }
void SetInitProgress(float fToProgress)
Definition: C4Game.cpp:3385
bool IsRunning
Definition: C4Game.h:139
bool InitGame(C4Group &hGroup, InitMode init_mode, bool fLoadSky, C4ValueNumbers *)
Definition: C4Game.cpp:2100
char ScenarioFilename[_MAX_PATH+1]
Definition: C4Game.h:102
StdStrBuf TempScenarioFile
Definition: C4Game.h:126
C4Config Config
Definition: C4Config.cpp:833
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
std::unique_ptr< C4Network2Reference > pJoinReference
Definition: C4Game.h:108
C4Value & GlobalSoundModifier
Definition: C4Game.h:99
C4Console Console
Definition: C4Globals.cpp:45
void SyncClearance()
Definition: C4Game.cpp:3129
std::string Loader
Definition: C4Scenario.h:65
C4Scenario C4S
Definition: C4Game.h:74
bool FinalInit()
Definition: C4Network2.cpp:537
C4ConfigGeneral General
Definition: C4Config.h:251
bool isLobbyActive() const
Definition: C4Network2.h:204
static constexpr const char * DirectJoinFilePrefix
Definition: C4Game.h:295
void DoDlgShow(int32_t iChange, bool fUserToggle)
static void Unload()
Definition: C4Startup.cpp:301
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
int32_t LastInitProgress
Definition: C4Game.h:133
C4Scoreboard Scoreboard
Definition: C4Game.h:94
#define _MAX_PATH
bool InitPlayers(C4ValueNumbers *)
Definition: C4Game.cpp:2448
C4GameParameters & Parameters
Definition: C4Game.h:67
bool InitNetworkFromReferenceFile(const char *temp_filename)
Definition: C4Game.cpp:3213
bool OpenScenario()
Definition: C4Game.cpp:165
bool InitNetworkHost()
Definition: C4Game.cpp:3256
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
size_t StartupLogPos
Definition: C4Game.h:141
int32_t InitProgress
Definition: C4Game.h:133
bool SaveGame
Definition: C4Scenario.h:71
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
C4Network2 Network
Definition: C4Globals.cpp:53
int32_t StartTime
Definition: C4Game.h:132
bool InitLoaderScreen(const char *szLoaderSpec)
char Participants[CFG_MaxString+1]
Definition: C4Config.h:38
bool Init()
Definition: C4Extra.cpp:41
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4GameResList GameRes
C4Group ScenarioFile
Definition: C4Game.h:86
bool NetworkGame
Definition: C4Scenario.h:78
void SetExclusive(bool fToState)
Definition: C4Gui.h:2666
bool fQuitWithError
Definition: C4Game.h:142
void SetGlobalSoundModifier(C4PropList *modifier_props)
Definition: C4Game.cpp:3873
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:227
bool InitNetworkFromReference(const C4Network2Reference &Reference)
Definition: C4Game.cpp:3231
C4LoaderScreen * pLoaderScreen
size_t GetLogPos()
Definition: C4Log.cpp:286
bool isEnabled() const
Definition: C4Network2.h:203
bool InitNetworkFromAddress(const char *szAddress)
Definition: C4Game.cpp:3160
void InitFullscreenComponents(bool fRunning)
Definition: C4Game.cpp:785
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:104
void InitGame()
Definition: C4Console.cpp:590
bool InitKeyboard()
Definition: C4Game.cpp:2930
int32_t AlwaysDebug
Definition: C4Config.h:39
bool RetrieveScenario(char *szScenario)
Definition: C4Network2.cpp:589
void Synchronize(bool fSavePlayerFiles)
Definition: C4Game.cpp:3135
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
bool DoLobby()
Definition: C4Network2.cpp:432
bool SEqual2(const char *szStr1, const char *szStr2)
Definition: Standard.cpp:198
C4SHead Head
Definition: C4Scenario.h:230
bool InitGameFinal(InitMode init_mode)
Definition: C4Game.cpp:2327
char DirectJoinAddress[_MAX_PATH+1]
Definition: C4Game.h:106
C4PropList * _getPropList() const
Definition: C4Value.h:129
C4Extra Extra
Definition: C4Game.h:89
std::unique_ptr< C4Network2Stats > pNetworkStatistics
Definition: C4Game.h:95
void Copy()
Definition: StdBuf.h:467
C4Application Application
Definition: C4Globals.cpp:44
bool DebugMode
Definition: C4Game.h:144

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitAnimals ( )
protected

Definition at line 2838 of file C4Game.cpp.

References C4Scenario::Animals, C4Id2Def(), C4S, C4SAnimals::EarthNest, C4SAnimals::FreeLife, C4IDList::GetID(), PlaceAnimal(), and PlaceInEarth().

Referenced by InitGame().

2839 {
2840  int32_t cnt,cnt2;
2841  C4ID idAnimal; int32_t iCount;
2842  // Place animals
2843  for (cnt=0; (idAnimal=C4S.Animals.FreeLife.GetID(cnt,&iCount)); cnt++)
2844  for (cnt2=0; cnt2<iCount; cnt2++)
2845  PlaceAnimal(C4Id2Def(idAnimal));
2846  // Place nests
2847  for (cnt=0; (idAnimal=C4S.Animals.EarthNest.GetID(cnt,&iCount)); cnt++)
2848  for (cnt2=0; cnt2<iCount; cnt2++)
2849  PlaceInEarth(idAnimal);
2850 }
C4Scenario C4S
Definition: C4Game.h:74
bool PlaceInEarth(C4ID id)
Definition: C4Game.cpp:2602
C4Object * PlaceAnimal(C4PropList *def)
Definition: C4Game.cpp:2772
Definition: C4Id.h:25
C4SAnimals Animals
Definition: C4Scenario.h:235
C4IDList EarthNest
Definition: C4Scenario.h:210
C4Def * C4Id2Def(C4ID id)
Definition: C4DefList.h:84
C4IDList FreeLife
Definition: C4Scenario.h:209
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitControl ( )
protected

Definition at line 2533 of file C4Game.cpp.

References C4S, Clients, Control, C4GameParameters::doStreaming(), FixRandom(), C4ClientList::getLocal(), C4Scenario::Head, C4GameControl::InitLocal(), C4GameControl::InitNetwork(), C4GameControl::InitReplay(), C4Network2::isEnabled(), C4Network2::isHost(), C4GameParameters::isLeague(), LoadResStr(), Log(), LogFatal(), Network, C4SHead::NetworkGame, Parameters, PlayerFilenames, C4SHead::RandomSeed, RandomSeed, Record, C4SHead::Replay, ScenarioFile, and C4GameControl::StartRecord().

Referenced by InitGame().

2534 {
2535  // update random seed
2536  if (C4S.Head.NetworkGame || C4S.Head.Replay)
2537  {
2539  }
2540  // Randomize
2542 
2543  // Replay?
2544  if (C4S.Head.Replay)
2545  {
2546  // no joins
2547  PlayerFilenames[0]=0;
2548  // start playback
2550  return false;
2551  // no record!
2552  Record = false;
2553  }
2554  else if (Network.isEnabled())
2555  {
2556  // initialize
2558  return false;
2559  // league? always record
2560  if (Parameters.isLeague())
2561  Record = true;
2562  }
2563  // Otherwise: local game
2564  else
2565  {
2566  // init
2568  return false;
2569  }
2570 
2571  // record?
2572  if (Record)
2573  if (!Control.StartRecord(true, Parameters.doStreaming()))
2574  {
2575  // Special: If this happens for a league host, the game must not start.
2577  {
2578  LogFatal(LoadResStr("IDS_ERR_NORECORD"));
2579  return false;
2580  }
2581  else
2582  {
2583  Log(LoadResStr("IDS_ERR_NORECORD"));
2584  }
2585  }
2586 
2587  return true;
2588 }
C4Client * getLocal() const
Definition: C4Client.h:161
int32_t RandomSeed
Definition: C4Game.h:134
bool isHost() const
Definition: C4Network2.h:209
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
bool InitNetwork(C4Client *pLocal)
bool InitLocal(C4Client *pLocal)
bool InitReplay(C4Group &rGroup)
C4GameParameters & Parameters
Definition: C4Game.h:67
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
void FixRandom(uint64_t iSeed)
Definition: C4Game.cpp:3090
C4Network2 Network
Definition: C4Globals.cpp:53
C4GameControl Control
C4Group ScenarioFile
Definition: C4Game.h:86
bool NetworkGame
Definition: C4Scenario.h:78
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:227
bool isEnabled() const
Definition: C4Network2.h:203
bool doStreaming() const
char PlayerFilenames[20 *_MAX_PATH+1]
Definition: C4Game.h:104
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
C4ClientList & Clients
Definition: C4Game.h:69
bool Record
Definition: C4Game.h:123
bool isLeague() const
bool StartRecord(bool fInitial, bool fStreaming)
C4SHead Head
Definition: C4Scenario.h:230
int32_t RandomSeed
Definition: C4Scenario.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitDefs ( )
protected

Definition at line 120 of file C4Game.cpp.

References C4DefList::AppendAndIncludeSkeletons(), Application, C4DefList::BuildTable(), C4D_Load_RX, C4DefList::CheckEngineVersion(), C4DefList::CheckRequireDef(), Config, Definitions, C4GameParameters::GameRes, C4Config::General, C4GameRes::getFile(), C4GameResList::iterRes(), C4ConfigGeneral::LanguageEx, C4DefList::Load(), C4DefList::LoadFailure, LoadResStr(), Log(), LogF(), LogFatal(), NRT_Definitions, Parameters, ScenarioFile, and C4Application::SoundSystem.

Referenced by InitGame().

121 {
122  int32_t iDefs=0;
123  Log(LoadResStr("IDS_PRC_INITDEFS"));
124  int iDefResCount = 0;
125  C4GameRes *pDef;
126  for (pDef = Parameters.GameRes.iterRes(nullptr, NRT_Definitions); pDef; pDef = Parameters.GameRes.iterRes(pDef, NRT_Definitions))
127  ++iDefResCount;
128  int i = 0;
129  // Load specified defs
130  for (pDef = Parameters.GameRes.iterRes(nullptr, NRT_Definitions); pDef; pDef = Parameters.GameRes.iterRes(pDef, NRT_Definitions))
131  {
132  int iMinProgress = 25 + (25 * i) / iDefResCount;
133  int iMaxProgress = 25 + (25 * (i + 1)) / iDefResCount;
134  ++i;
135  iDefs+=::Definitions.Load(pDef->getFile(),C4D_Load_RX,Config.General.LanguageEx,&Application.SoundSystem,true,iMinProgress,iMaxProgress);
136 
137  // Def load failure
138  if (::Definitions.LoadFailure) return false;
139  }
140 
141  // Load for scenario file - ignore sys group here, because it has been loaded already
143 
144  // Absolutely no defs: we don't like that
145  if (!iDefs) { LogFatal(LoadResStr("IDS_PRC_NODEFS")); return false; }
146 
147  // Check def engine version (should be done immediately on def load)
148  iDefs=::Definitions.CheckEngineVersion(C4XVER1,C4XVER2);
149  if (iDefs>0) { LogF(LoadResStr("IDS_PRC_DEFSINVC4X"),iDefs); }
150 
151  // Check for unmet requirements
153 
154  // build quick access table
156 
157  // handle skeleton appends and includes
159 
160  // Done
161  return true;
162 }
C4SoundSystem SoundSystem
Definition: C4Application.h:42
C4Config Config
Definition: C4Config.cpp:833
C4GameRes * iterRes(C4GameRes *pLast, C4Network2ResType eType=NRT_Null)
C4ConfigGeneral General
Definition: C4Config.h:251
void BuildTable()
Definition: C4DefList.cpp:514
C4GameParameters & Parameters
Definition: C4Game.h:67
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const DWORD C4D_Load_RX
Definition: C4Def.h:91
void AppendAndIncludeSkeletons()
Definition: C4DefList.cpp:521
int32_t CheckRequireDef()
Definition: C4DefList.cpp:384
C4GameResList GameRes
C4Group ScenarioFile
Definition: C4Game.h:86
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:227
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:37
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
Definition: C4DefList.cpp:71
bool LoadFailure
Definition: C4DefList.h:31
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2)
Definition: C4DefList.cpp:365
const char * getFile() const
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
C4DefList Definitions
Definition: C4Globals.cpp:49
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:250
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitEnvironment ( )
protected

Definition at line 3355 of file C4Game.cpp.

References C4S, CreateObject(), C4Scenario::Environment, C4IDList::GetID(), and C4SEnvironment::Objects.

Referenced by InitGame().

3356 {
3357  // Place environment objects
3358  int32_t cnt,cnt2;
3359  C4ID idType; int32_t iCount;
3360  for (cnt=0; (idType=C4S.Environment.Objects.GetID(cnt,&iCount)); cnt++)
3361  for (cnt2=0; cnt2<iCount; cnt2++)
3362  CreateObject(idType,nullptr);
3363 }
C4IDList Objects
Definition: C4Scenario.h:219
C4SEnvironment Environment
Definition: C4Scenario.h:237
C4Scenario C4S
Definition: C4Game.h:74
Definition: C4Id.h:25
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
Definition: C4IDList.cpp:99
C4Object * CreateObject(C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
Definition: C4Game.cpp:1072

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Game::InitFullscreenComponents ( bool  fRunning)

Definition at line 785 of file C4Game.cpp.

References C4UpperBoardHeight, FullScreen, C4GUI::GetScreenHgt(), C4GUI::GetScreenWdt(), GraphicsResource, GraphicsSystem, C4UpperBoard::Init(), C4GraphicsResource::IsInitialized(), C4GraphicsSystem::MessageBoard, C4Window::pSurface, C4ViewportList::RecalculateViewports(), C4Facet::Set(), C4GraphicsSystem::UpperBoard, and Viewports.

Referenced by Init(), and OnResolutionChanged().

786 {
787  // It can happen that this is called before graphics are loaded due to
788  // an early OnResolutionChanged() call. Ignore it, the message board,
789  // upper board and viewports will be initialized within the regular
790  // startup sequence then.
791  if(!GraphicsResource.IsInitialized()) return;
792 
793  // fullscreen message board
794  C4Facet cgo;
796  GraphicsSystem.MessageBoard->Init(cgo, !fRunning);
797  if (fRunning)
798  {
799  // running game: Message board upper board and viewports
800  C4Facet cgo2;
804  }
805 }
void RecalculateViewports()
Definition: C4Viewport.cpp:989
C4Surface * pSurface
Definition: C4Window.h:274
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
int32_t GetScreenWdt()
Definition: C4Gui.h:2821
const int C4UpperBoardHeight
Definition: C4Constants.h:59
void Set(C4Surface &rSfc)
Definition: C4Facet.cpp:459
C4GraphicsResource GraphicsResource
C4UpperBoard UpperBoard
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
int32_t GetScreenHgt()
Definition: C4Gui.h:2822
void Init(C4Facet &cgo)
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
std::unique_ptr< C4MessageBoard > MessageBoard

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Game::InitGame ( C4Group hGroup,
InitMode  init_mode,
bool  fLoadSky,
C4ValueNumbers numbers 
)
protected

Definition at line 2100 of file C4Game.cpp.

References Application, C4ConfigDeveloper::AutoFileReload, C4CFN_MapScript, C4CFN_MassMover, C4CFN_PXS, C4CFN_RoundResults, C4CFN_ScenarioObjectsScript, C4CFN_Script, C4S, C4PropList::Call(), CheckObjectEnumeration(), C4MassMoverSet::Clear(), C4PXSSystem::Clear(), C4GraphicsResource::CloseFiles(), CompileRuntimeData(), Config, DebugHost, DebugPassword, DebugPort, C4AulScriptEngine::Denumerate(), C4Value::Denumerate(), C4ValueNumbers::Denumerate(), C4Config::Developer, C4MusicSystem::FadeOut(), C4PlayerControlDefs::FinalInit(), C4Group::FindEntry(), FrameCounter, GameScript, GameText, C4Config::General, C4ComponentHost::GetData(), StdStrBuf::getData(), C4Landscape::GetHeight(), C4ExtraScriptHost::GetPropList(), C4PlayerInfoList::GetStartupCount(), C4TeamList::GetStartupTeamCount(), C4Landscape::GetWidth(), GlobalSoundModifier, GraphicsResource, C4Scenario::Head, IM_Normal, IM_Section, C4GameObjects::Init(), C4PathFinder::Init(), C4Weather::Init(), C4Landscape::Init(), C4GraphicsResource::Init(), C4RoundResults::Init(), InitAnimals(), InitControl(), C4AulDebug::InitDebug(), InitDefs(), InitEnvironment(), C4MusicSystem::InitForScenario(), InitGoals(), InitInEarth(), C4PlayerInfoList::InitLocal(), InitMaterialTexture(), InitPlayerControlUserSettings(), InitRules(), InitScriptEngine(), InitValueOverloads(), InitVegetation(), C4Application::isEditor, C4Network2::isEnabled(), C4GameParameters::isLeague(), Landscape, LandscapeFree(), C4ConfigGeneral::LanguageEx, LinkScriptEngine(), C4ScriptHost::Load(), C4MassMoverSet::Load(), C4PXSSystem::Load(), C4GameScriptHost::Load(), C4RoundResults::Load(), C4MapScriptHost::Load(), LoadAdditionalSystemGroup(), C4SoundSystem::LoadEffects(), LoadResStr(), LoadScenarioComponents(), Log(), LogFatal(), MapScript, MassMover, C4Application::MusicSystem, Network, C4SHead::NetworkGame, C4SHead::NoInitialize, Objects, Parameters, PathFinder, pFileMonitor, C4MusicSystem::Play(), PlayerControlDefs, PlayerControlUserAssignmentSets, PlayerInfos, PointersDenumerated, C4Landscape::PostInitMap(), C4GameObjects::PostLoad(), pScenarioObjectsScript, PSF_InitializeObjects, PXS, C4PlayerInfoList::RecheckAutoGeneratedTeams(), C4TeamList::RecheckPlayers(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4SHead::Replay, RoundResults, C4ConfigSound::RXMusic, C4SHead::SaveGame, ScenarioFile, C4Landscape::ScenarioInit(), ScenarioLangStringTable, ScenarioParameterDefs, C4GameParameters::ScenarioParameters, ScriptEngine, ScriptGuiRoot, SetInitProgress(), C4PlayerControlAssignmentSets::SortAssignments(), C4Config::Sound, C4Application::SoundSystem, StartupPlayerCount, StartupTeamCount, C4MusicSystem::Stop(), Teams, TransferZones, C4MusicSystem::UpdateVolume(), and Weather.

Referenced by Init(), and LoadScenarioSection().

2101 {
2102  // Activate debugger if requested
2103  // needs to happen before any scripts are compiled to bytecode so AB_DEBUG chunks will be inserted
2104  if (DebugPort)
2105  {
2106  if (Parameters.isLeague())
2107  Log("Debugger disabled. Not allowed in league.");
2108  else
2110  return false;
2111  }
2112 
2113  if (init_mode == IM_Normal)
2114  {
2115 
2116  // file monitor
2118  pFileMonitor = std::make_unique<C4FileMonitor>(FileMonitorCallback);
2119 
2120  // system scripts
2121  if (!InitScriptEngine())
2122  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2123  SetInitProgress(8);
2124 
2125  // Scenario components
2126  if (!LoadScenarioComponents())
2127  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2128  SetInitProgress(9);
2129 
2130  // join local players for regular games
2131  // should be done before record/replay is initialized, so the players are stored in PlayerInfos.txt
2132  // for local savegame resumes, players are joined into PlayerInfos and later associated in InitPlayers
2133  if (!::Network.isEnabled())
2134  if (!PlayerInfos.InitLocal())
2135  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2136 
2137  // for replays, make sure teams are assigned correctly
2138  if (C4S.Head.Replay)
2139  {
2140  PlayerInfos.RecheckAutoGeneratedTeams(); // checks that all teams used in playerinfos exist
2141  Teams.RecheckPlayers(); // syncs player list of teams with teams set in PlayerInfos
2142  }
2143 
2144  // set up control (inits Record/Replay)
2145  if (!InitControl()) return false;
2146 
2147  // Graphics and fonts (may reinit main font, too)
2148  // redundant call in NETWORK2; but it may do scenario local overloads
2149  Log(LoadResStr("IDS_PRC_GFXRES"));
2150  if (!GraphicsResource.Init())
2151  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2152  SetInitProgress(25);
2153 
2154  // Definitions
2155  if (!InitDefs()) return false;
2156  SetInitProgress(55);
2157 
2158  // Scenario scripts (and local system.ocg)
2160  // Map scripts
2162  // Scenario objects
2164  // After defs to get overloading priority
2166  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2167  SetInitProgress(57);
2168 
2169  // Final init for loaded player commands. Before linking scripts, so CON_* constants are registered
2171 
2172  // Register constants for scenario options
2174 
2175  // Now that all controls and assignments are known, resolve user overloads on control assignments
2176  if (!InitPlayerControlUserSettings()) return false;
2177  // Sort assignments by priority. Should be done last, because the user should not see this order in the control config dialog
2179  // (Theoretically, PlayerControlDefaultAssignmentSets could be cleared now. However, the amount of memory used is negligible)
2180 
2181  // Link scripts
2182  if (!LinkScriptEngine()) return false;
2183  SetInitProgress(58);
2184 
2185  // Materials
2186  if (!InitMaterialTexture())
2187  { LogFatal(LoadResStr("IDS_PRC_MATERROR")); return false; }
2188  SetInitProgress(60);
2189 
2190  // prepare script menus
2191  assert(!ScriptGuiRoot);
2192  ScriptGuiRoot = std::make_unique<C4ScriptGuiWindow>();
2193  }
2194  else if (fLoadSky)
2195  {
2196  // Sky needs graphics loaded, for shaders
2197  if (!GraphicsResource.Init())
2198  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2199  }
2200 
2201  // Load section sounds
2202  Application.SoundSystem.LoadEffects(hGroup, nullptr, true);
2203 
2204  // determine startup player and team count, which may be used for initial map generation
2205  if (!FrameCounter)
2206  {
2209  }
2210 
2211  // The Landscape is the last long chunk of loading time, so it's a good place to start the music fadeout
2212  if (init_mode == IM_Normal) Application.MusicSystem.FadeOut(2000);
2213  // Landscape
2214  Log(LoadResStr("IDS_PRC_LANDSCAPE"));
2215  bool fLandscapeLoaded = false;
2216  if (!Landscape.Init(hGroup, init_mode != IM_Normal, fLoadSky, fLandscapeLoaded, !!C4S.Head.SaveGame))
2217  { LogFatal(LoadResStr("IDS_ERR_GBACK")); return false; }
2218  SetInitProgress(88);
2219  // the savegame flag is set if runtime data is present, in which case this is to be used
2220  // except for scenario sections
2221  if (fLandscapeLoaded && (!C4S.Head.SaveGame || init_mode == IM_Section))
2223  // clear old landscape data
2224  if (init_mode != IM_Normal && fLandscapeLoaded) { PXS.Clear(); MassMover.Clear(); }
2225  SetInitProgress(89);
2226  // Init main object list
2228 
2229  // Pathfinder
2230  if (init_mode == IM_Normal) PathFinder.Init( &LandscapeFree, &TransferZones );
2231  SetInitProgress(90);
2232 
2233  // PXS
2234  if (hGroup.FindEntry(C4CFN_PXS))
2235  if (!PXS.Load(hGroup))
2236  { LogFatal(LoadResStr("IDS_ERR_PXS")); return false; }
2237  SetInitProgress(91);
2238 
2239  // MassMover
2240  if (hGroup.FindEntry(C4CFN_MassMover))
2241  if (!MassMover.Load(hGroup))
2242  { LogFatal(LoadResStr("IDS_ERR_MOVER")); return false; }
2243  SetInitProgress(92);
2244 
2245  // definition value overloads
2246  // TODO: Remove this function? We could move value to script and allow it through regular overloads
2247  if (init_mode == IM_Normal) InitValueOverloads();
2248 
2249  // runtime data
2250  if (!CompileRuntimeData(hGroup, init_mode, C4S.Head.SaveGame, C4S.Head.NetworkGame, numbers))
2251  { LogFatal(LoadResStr("IDS_PRC_FAIL")); return false; }
2252 
2253  SetInitProgress(93);
2254 
2255  // Load round results
2256  if (init_mode == IM_Normal)
2257  {
2258  if (hGroup.FindEntry(C4CFN_RoundResults))
2259  {
2260  if (!RoundResults.Load(hGroup, C4CFN_RoundResults))
2261  { LogFatal(LoadResStr("IDS_ERR_ERRORLOADINGROUNDRESULTS")); return false; }
2262  }
2263  else
2264  {
2265  RoundResults.Init();
2266  }
2267  }
2268 
2269  // Denumerate game data pointers
2270  if (init_mode == IM_Normal) ScriptEngine.Denumerate(numbers);
2271  if (init_mode == IM_Normal) GlobalSoundModifier.Denumerate(numbers);
2272  numbers->Denumerate();
2273  if (init_mode == IM_Normal) ScriptGuiRoot->Denumerate(numbers);
2274  // Object.PostLoad must happen after number->Denumerate(), becuase UpdateFace() will access Action proplist,
2275  // which might have a non-denumerated prototype otherwise
2276  Objects.PostLoad(init_mode == IM_Section, numbers);
2277 
2278  // Check object enumeration
2279  if (!CheckObjectEnumeration()) return false;
2280 
2281  // Okay; everything in denumerated state from now on
2282  PointersDenumerated = true;
2283 
2284  // scenario objects script
2287 
2288  // Environment
2289  if (!C4S.Head.NoInitialize && fLandscapeLoaded)
2290  {
2291  Log(LoadResStr("IDS_PRC_ENVIRONMENT"));
2292  InitVegetation();
2293  InitInEarth();
2294  InitAnimals();
2295  InitEnvironment();
2296  InitRules();
2297  InitGoals();
2299  }
2300  SetInitProgress(94);
2301 
2302  // Weather
2303  if (fLandscapeLoaded) Weather.Init(!C4S.Head.SaveGame);
2304  SetInitProgress(96);
2305 
2306  // close any gfx groups, because they are no longer needed (after sky is initialized)
2308 
2309  if (init_mode == IM_Normal) // reload doesn't affect the music (takes too long)
2310  {
2311  // Music
2314  if (::Config.Sound.RXMusic)
2315  {
2316  // Play something that is not Frontend.mid
2318  }
2319  else
2321  SetInitProgress(97);
2322  }
2323 
2324  return true;
2325 }
#define C4CFN_MassMover
Definition: C4Components.h:76
const char * getData() const
Definition: StdBuf.h:442
C4SoundSystem SoundSystem
Definition: C4Application.h:42
void SetInitProgress(float fToProgress)
Definition: C4Game.cpp:3385
void InitValueOverloads()
Definition: C4Game.cpp:3346
bool FindEntry(const char *szWildCard, StdStrBuf *sFileName=nullptr, size_t *iSize=nullptr)
Definition: C4Group.cpp:1774
void RecheckPlayers()
Definition: C4Teams.cpp:663
void Denumerate()
Definition: C4Value.cpp:281
bool InitMaterialTexture()
Definition: C4Game.cpp:807
C4Config Config
Definition: C4Config.cpp:833
bool Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bool &rfLoaded, bool fSavegame)
void InitEnvironment()
Definition: C4Game.cpp:3355
C4Value & GlobalSoundModifier
Definition: C4Game.h:99
C4GameScriptHost GameScript
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4Scenario C4S
Definition: C4Game.h:74
C4ConfigGeneral General
Definition: C4Config.h:251
const char * GetData() const
#define C4CFN_Script
Definition: C4Components.h:66
void InitGoals()
Definition: C4Game.cpp:3375
bool Replay
Definition: C4Scenario.h:72
C4ComponentHost GameText
Definition: C4Game.h:79
int32_t LoadEffects(C4Group &hGroup, const char *namespace_prefix, bool group_is_root)
#define C4CFN_RoundResults
Definition: C4Components.h:129
bool PostInitMap()
void RecheckAutoGeneratedTeams()
StdStrBuf DebugHost
Definition: C4Game.h:148
void Init(PointFreeFn fnPointFree, C4TransferZones *pTransferZones=nullptr)
class C4ScenarioObjectsScriptHost * pScenarioObjectsScript
Definition: C4Game.h:90
bool Load(C4Group &hGroup, const char *szFilename=C4CFN_RoundResults)
bool LandscapeFree(int32_t x, int32_t y)
Definition: C4Game.cpp:1987
class C4ScenarioParameterDefs & ScenarioParameterDefs
Definition: C4Game.h:75
void ScenarioInit()
C4GraphicsResource GraphicsResource
StdStrBuf DebugPassword
Definition: C4Game.h:148
C4GameParameters & Parameters
Definition: C4Game.h:67
C4TeamList & Teams
Definition: C4Game.h:70
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4LangStringTable ScenarioLangStringTable
Definition: C4Game.h:80
bool InitControl()
Definition: C4Game.cpp:2533
bool Load(C4Group &, const char *, const char *, C4LangStringTable *) override
C4MapScriptHost MapScript
uint16_t DebugPort
Definition: C4Game.h:148
bool SaveGame
Definition: C4Scenario.h:71
int32_t FrameCounter
Definition: C4Game.h:128
bool LoadScenarioComponents()
Definition: C4Game.cpp:2853
void Denumerate(C4ValueNumbers *)
Definition: C4Value.cpp:251
std::unique_ptr< C4FileMonitor > pFileMonitor
Definition: C4Game.h:97
C4Network2 Network
Definition: C4Globals.cpp:53
#define C4CFN_ScenarioObjectsScript
Definition: C4Components.h:74
void Clear()
Definition: C4PXS.cpp:169
bool CheckObjectEnumeration()
Definition: C4Game.cpp:3297
bool Load(C4Group &, const char *, const char *, C4LangStringTable *) override
C4ScenarioParameters ScenarioParameters
void Denumerate(C4ValueNumbers *) override
bool Load(C4Group &hGroup)
Definition: C4PXS.cpp:414
bool CompileRuntimeData(C4Group &hGroup, InitMode init_mode, bool exact, bool sync, C4ValueNumbers *)
Definition: C4Game.cpp:1753
C4Landscape Landscape
int32_t AutoFileReload
Definition: C4Config.h:83
C4Group ScenarioFile
Definition: C4Game.h:86
bool NetworkGame
Definition: C4Scenario.h:78
C4ConfigDeveloper Developer
Definition: C4Config.h:252
C4TransferZones TransferZones
Definition: C4Game.h:85
bool InitDefs()
Definition: C4Game.cpp:120
void Init(bool fScenario)
Definition: C4Weather.cpp:39
C4Weather Weather
Definition: C4Weather.cpp:206
bool LogFatal(const char *szMessage)
Definition: C4Log.cpp:227
C4PXSSystem PXS
Definition: C4PXS.cpp:525
void InitInEarth()
Definition: C4Game.cpp:2807
static bool InitDebug(const char *szPassword, const char *szHost)
Definition: C4AulDebug.cpp:43
C4PlayerControlDefs PlayerControlDefs
Definition: C4Game.h:92
bool isEnabled() const
Definition: C4Network2.h:203
char LanguageEx[CFG_MaxString+1]
Definition: C4Config.h:37
C4RoundResults & RoundResults
Definition: C4Game.h:73
bool InitForScenario(C4Group &hGroup)
#define C4CFN_MapScript
Definition: C4Components.h:67
void FadeOut(int fadeout_ms)
int32_t GetStartupCount()
int32_t GetHeight() const
C4MassMoverSet MassMover
int32_t StartupPlayerCount
Definition: C4Game.h:109
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:71
bool PointersDenumerated
Definition: C4Game.h:140
bool LinkScriptEngine()
Definition: C4Game.cpp:2414
void InitRules()
Definition: C4Game.cpp:3365
C4PathFinder PathFinder
Definition: C4Game.h:84
bool InitPlayerControlUserSettings()
Definition: C4Game.cpp:3046
C4PropListStatic * GetPropList() override
bool Log(const char *szMessage)
Definition: C4Log.cpp:192
bool isLeague() const
void InitAnimals()
Definition: C4Game.cpp:2838
void InitVegetation()
Definition: C4Game.cpp:2823
#define C4CFN_PXS
Definition: C4Components.h:75
int32_t StartupTeamCount
Definition: C4Game.h:110
bool LoadAdditionalSystemGroup(class C4Group &parent_group)
Definition: C4Game.cpp:2884
bool InitScriptEngine()
Definition: C4Game.cpp:2373
C4SHead Head
Definition: C4Scenario.h:230
void Init(int32_t iWidth, int32_t iHeight)
std::unique_ptr< C4ScriptGuiWindow > ScriptGuiRoot
Definition: C4Game.h:233
void RegisterScriptConstants(const class C4ScenarioParameters &values)
int PostLoad(bool fKeepInactive, C4ValueNumbers *)
bool Load(C4Group &hGroup)
C4ConfigSound Sound
Definition: C4Config.h:254
virtual bool Load(C4Group &hGroup, const char *szFilename, const char *szLanguage, C4LangStringTable *pLocalTable)
bool NoInitialize
Definition: C4Scenario.h:69
int32_t GetStartupTeamCount(int32_t startup_player_count)
Definition: C4Teams.cpp:900
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
Definition: C4Game.h:93
C4Application Application
Definition: C4Globals.cpp:44
int32_t GetWidth() const
C4GameObjects Objects
Definition: C4Globals.cpp:48
#define PSF_InitializeObjects
Definition: C4GameScript.h:45
int32_t RXMusic
Definition: C4Config.h:127
bool Play(const char *szSongname=nullptr, bool fLoop=false, int fadetime_ms=0, double max_resume_time=0.0, bool allow_break=false)
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110
C4MusicSystem MusicSystem
Definition: C4Application.h:41

Here is the call graph for this function:

Here is the caller graph for this function: