Show fog of war in observermode, fixes #3168.
This was SVN commit r17735.
This commit is contained in:
parent
875a774da9
commit
a2f7d4d82a
@ -200,6 +200,8 @@ function init(initData, hotloadData)
|
||||
return;
|
||||
}
|
||||
|
||||
Engine.SetViewedPlayer(g_ViewedPlayer);
|
||||
|
||||
if (initData)
|
||||
{
|
||||
g_IsNetworked = initData.isNetworked;
|
||||
@ -300,6 +302,7 @@ function selectViewPlayer(playerID)
|
||||
return;
|
||||
|
||||
g_ViewedPlayer = playerID;
|
||||
Engine.SetViewedPlayer(playerID);
|
||||
Engine.SetPlayerID(g_DevSettings.changePerspective ? playerID : -1);
|
||||
|
||||
updateTopPanel();
|
||||
|
@ -342,7 +342,7 @@ void CLOSTexture::RecomputeTexture(int unit)
|
||||
if (!cmpRangeManager)
|
||||
return;
|
||||
|
||||
ICmpRangeManager::CLosQuerier los(cmpRangeManager->GetLosQuerier(g_Game->GetPlayerID()));
|
||||
ICmpRangeManager::CLosQuerier los(cmpRangeManager->GetLosQuerier(g_Game->GetSimulation2()->GetSimContext().GetCurrentDisplayedPlayer()));
|
||||
|
||||
GenerateBitmap(los, &losData[0], m_MapSize, m_MapSize, pitch);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -530,7 +530,7 @@ void CMiniMap::Draw()
|
||||
ICmpMinimap* cmpMinimap = static_cast<ICmpMinimap*>(it->second);
|
||||
if (cmpMinimap->GetRenderData(v.r, v.g, v.b, posX, posZ))
|
||||
{
|
||||
ICmpRangeManager::ELosVisibility vis = cmpRangeManager->GetLosVisibility(it->first, g_Game->GetPlayerID());
|
||||
ICmpRangeManager::ELosVisibility vis = cmpRangeManager->GetLosVisibility(it->first, g_Game->GetSimulation2()->GetSimContext().GetCurrentDisplayedPlayer());
|
||||
if (vis != ICmpRangeManager::VIS_HIDDEN)
|
||||
{
|
||||
v.a = 255;
|
||||
|
@ -220,6 +220,14 @@ void SetPlayerID(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int id)
|
||||
g_Game->SetPlayerID(id);
|
||||
}
|
||||
|
||||
void SetViewedPlayer(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int id)
|
||||
{
|
||||
if (!g_Game)
|
||||
return;
|
||||
|
||||
g_Game->GetSimulation2()->GetSimContext().SetCurrentDisplayedPlayer(id);
|
||||
}
|
||||
|
||||
JS::Value GetEngineInfo(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
{
|
||||
return SavedGames::GetEngineInfo(*(pCxPrivate->pScriptInterface));
|
||||
@ -1034,6 +1042,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<bool, &IsVisualReplay>("IsVisualReplay");
|
||||
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
|
||||
scriptInterface.RegisterFunction<void, int, &SetPlayerID>("SetPlayerID");
|
||||
scriptInterface.RegisterFunction<void, int, &SetViewedPlayer>("SetViewedPlayer");
|
||||
scriptInterface.RegisterFunction<void, std::string, &OpenURL>("OpenURL");
|
||||
scriptInterface.RegisterFunction<std::wstring, &GetMatchID>("GetMatchID");
|
||||
scriptInterface.RegisterFunction<void, &RestartInAtlas>("RestartInAtlas");
|
||||
|
@ -646,7 +646,7 @@ const CSimulation2::InterfaceListUnordered& CSimulation2::GetEntitiesWithInterfa
|
||||
return m->m_ComponentManager.GetEntitiesWithInterfaceUnordered(iid);
|
||||
}
|
||||
|
||||
const CSimContext& CSimulation2::GetSimContext() const
|
||||
CSimContext& CSimulation2::GetSimContext() const
|
||||
{
|
||||
return m->m_SimContext;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
*/
|
||||
const InterfaceListUnordered& GetEntitiesWithInterfaceUnordered(int iid);
|
||||
|
||||
const CSimContext& GetSimContext() const;
|
||||
CSimContext& GetSimContext() const;
|
||||
ScriptInterface& GetScriptInterface() const;
|
||||
|
||||
bool ComputeStateHash(std::string& outHash, bool quick);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -67,7 +67,10 @@ ScriptInterface& CSimContext::GetScriptInterface() const
|
||||
|
||||
int CSimContext::GetCurrentDisplayedPlayer() const
|
||||
{
|
||||
if (!g_Game)
|
||||
return -1;
|
||||
return g_Game->GetPlayerID();
|
||||
return g_Game ? currentDisplayedPlayer : -1;
|
||||
}
|
||||
|
||||
void CSimContext::SetCurrentDisplayedPlayer(int player)
|
||||
{
|
||||
currentDisplayedPlayer = player;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011 Wildfire Games.
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -53,6 +53,7 @@ public:
|
||||
* Currently relies on g_Game being initialised (evil globals...)
|
||||
*/
|
||||
int GetCurrentDisplayedPlayer() const;
|
||||
void SetCurrentDisplayedPlayer(int player);
|
||||
|
||||
private:
|
||||
CComponentManager* m_ComponentManager;
|
||||
@ -61,6 +62,8 @@ private:
|
||||
|
||||
CEntityHandle m_SystemEntity;
|
||||
|
||||
int currentDisplayedPlayer = 0;
|
||||
|
||||
friend class CSimulation2Impl;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user