mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-27 10:32:55 +00:00
Bug fixes and more game setup options.
- Added "Screenshot Mode" and "Fog of War" game attributes. (Screenshot Mode causes units to be initialized to Hold stance instead of Aggress and also forces LOS to be All Visible. Atlas turn on Screenshot Mode by default so units don't try to kill each other in there.) - Modified LOSManager to allow disabling fog of war. - Removed some debug message spam. - Enabled line antialiasing for aura rendering and fixed some bugs that caused strange effects (color was not set properly for the center point, and when a unit was both mouseover'ed and selected, the aura was drawn twice). - Modified Stand stance to allow retaliation on attacks (normally Stand will attack any enemy in LOS, but this is useful if a neutral unit is in LOS). - Modified pathfinder to not take into account terrain slope, which is an expensive calculation - we'll eventually take into account terrain type instead. This was SVN commit r4527.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include "lib/timer.h"
|
||||
|
||||
|
||||
CLOSManager::CLOSManager() : m_LOSSetting(0)
|
||||
CLOSManager::CLOSManager() : m_LOSSetting(0), m_FogOfWar(true)
|
||||
{
|
||||
#ifdef _2_los
|
||||
m_Explored = 0;
|
||||
@@ -38,10 +38,11 @@ CLOSManager::~CLOSManager()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CLOSManager::Initialize(uint losSetting)
|
||||
void CLOSManager::Initialize(uint losSetting, bool fogOfWar)
|
||||
{
|
||||
// Set special LOS setting
|
||||
m_LOSSetting = losSetting;
|
||||
m_FogOfWar = fogOfWar;
|
||||
|
||||
CTerrain* terrain = g_Game->GetWorld()->GetTerrain();
|
||||
m_TilesPerSide = terrain->GetVerticesPerSide() - 1;
|
||||
@@ -68,7 +69,7 @@ void CLOSManager::Initialize(uint losSetting)
|
||||
u16 vis_value = 0;
|
||||
if(m_LOSSetting == EXPLORED || m_LOSSetting == ALL_VISIBLE)
|
||||
for(int i = 0; i < 8; i++) vis_value |= LOS_EXPLORED << (i*2);
|
||||
if(m_LOSSetting == ALL_VISIBLE)
|
||||
if(m_LOSSetting == ALL_VISIBLE || (m_LOSSetting == EXPLORED && !m_FogOfWar) )
|
||||
for(int i = 0; i < 8; i++) vis_value |= LOS_VISIBLE << (i*2);
|
||||
#endif
|
||||
for(uint x=0; x<m_TilesPerSide; x++)
|
||||
@@ -96,17 +97,23 @@ void CLOSManager::Update()
|
||||
|
||||
// Clear the visible array
|
||||
#ifdef _2_los
|
||||
for(int x=0; x<m_TilesPerSide; x++)
|
||||
if( m_FogOfWar )
|
||||
{
|
||||
memset(m_Visible[x], 0, m_TilesPerSide*sizeof(int));
|
||||
for(int x=0; x<m_TilesPerSide; x++)
|
||||
{
|
||||
memset(m_Visible[x], 0, m_TilesPerSide*sizeof(int));
|
||||
}
|
||||
}
|
||||
#else
|
||||
u16 not_all_vis = 0xFFFF;
|
||||
for(int i = 0; i < 8; i++)
|
||||
not_all_vis &= ~(LOS_VISIBLE << (i*2));
|
||||
for(uint y=0; y<m_TilesPerSide; y++)
|
||||
for(uint x=0; x<m_TilesPerSide; x++)
|
||||
m_VisibilityMatrix[y][x] &= not_all_vis;
|
||||
if( m_FogOfWar )
|
||||
{
|
||||
u16 not_all_vis = 0xFFFF;
|
||||
for(int i = 0; i < 8; i++)
|
||||
not_all_vis &= ~(LOS_VISIBLE << (i*2));
|
||||
for(uint y=0; y<m_TilesPerSide; y++)
|
||||
for(uint x=0; x<m_TilesPerSide; x++)
|
||||
m_VisibilityMatrix[y][x] &= not_all_vis;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set visibility for each entity
|
||||
|
||||
Reference in New Issue
Block a user