Merge branch 'dev' into dev-right-click-camera

dev-time-step
krzys-h 2016-03-02 20:00:57 +01:00
commit 4e50f36214
11 changed files with 54 additions and 145 deletions

View File

@ -67,7 +67,6 @@ You will need:
* libogg >= 1.3.0
* OpenAL (OpenAL-Soft) >= 1.13
* PhysFS
* po4a >= 0.45 (to generate translated data files)
* oggenc (to generate music files)
On Ubuntu (and probably any other Debian-based system), you can use the following command to install all required packages:

View File

@ -31,6 +31,7 @@
#include "CBot/CBotVar/CBotVar.h"
#include <cassert>
#include <algorithm>
namespace CBot
{

View File

@ -312,7 +312,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -mod path load datadir mod from given path\n");
GetLogger()->Message(" -resolution WxH set resolution\n");
GetLogger()->Message(" -headless headless mode - disables graphics, sound and user interaction\n");
GetLogger()->Message(" -graphics changes graphics device (defaults to opengl)\n");
GetLogger()->Message(" -graphics changes graphics device (one of: default, auto, opengl, gl14, gl21, gl33\n");
GetLogger()->Message(" -glversion sets OpenGL context version to use (either default or version in format #.#)\n");
GetLogger()->Message(" -glprofile sets OpenGL context profile to use (one of: default, core, compatibility, opengles)\n");
return PARSE_ARGS_HELP;
@ -772,19 +772,22 @@ bool CApplication::CreateVideoSurface()
}
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile);
switch (profile)
if (profile != 0)
{
case SDL_GL_CONTEXT_PROFILE_CORE:
GetLogger()->Info("Requesting OpenGL core profile\n");
break;
case SDL_GL_CONTEXT_PROFILE_COMPATIBILITY:
GetLogger()->Info("Requesting OpenGL compatibility profile\n");
break;
case SDL_GL_CONTEXT_PROFILE_ES:
GetLogger()->Info("Requesting OpenGL ES profile\n");
break;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile);
switch (profile)
{
case SDL_GL_CONTEXT_PROFILE_CORE:
GetLogger()->Info("Requesting OpenGL core profile\n");
break;
case SDL_GL_CONTEXT_PROFILE_COMPATIBILITY:
GetLogger()->Info("Requesting OpenGL compatibility profile\n");
break;
case SDL_GL_CONTEXT_PROFILE_ES:
GetLogger()->Info("Requesting OpenGL ES profile\n");
break;
}
}
/* If hardware acceleration specifically requested, this will force the hw accel

View File

@ -59,7 +59,7 @@
#include "ui/controls/interface.h"
#include <iomanip>
#include <boost/algorithm/string/predicate.hpp>
#include <SDL_thread.h>
template<> Gfx::CEngine* CSingleton<Gfx::CEngine>::m_instance = nullptr;
@ -2326,12 +2326,7 @@ bool CEngine::LoadAllTextures()
if (! p2.tex2Name.empty())
{
if (terrain)
{
if (! boost::starts_with(p2.tex2Name, "shadow")) // shadow ground textures are created dynamically
{
p2.tex2 = LoadTexture("textures/"+p2.tex2Name, m_terrainTexParams);
}
}
p2.tex2 = LoadTexture("textures/"+p2.tex2Name, m_terrainTexParams);
else
p2.tex2 = LoadTexture("textures/"+p2.tex2Name);
@ -4175,6 +4170,9 @@ void CEngine::UpdateGroundSpotTextures()
m_groundMark.drawIntensity = m_groundMark.intensity;
m_firstGroundSpot = false;
// Reload the model textures from cache now
LoadAllTextures();
}
void CEngine::DrawShadowSpots()

View File

@ -484,7 +484,6 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type)
if (rank != -1)
{
Light light = m_dynLights[rank].light;
light.ambient = Gfx::Color(0.2f, 0.2f, 0.2f);
m_device->SetLight(i, light);
m_device->SetLightEnabled(i, true);
}

View File

@ -320,7 +320,7 @@ void CWater::DrawSurf()
if (m_type[0] == WATER_NULL) return;
if (m_lines.empty()) return;
std::vector<VertexTex2> vertices((m_brickCount+2)*2, VertexTex2());
std::vector<Vertex> vertices((m_brickCount+2)*2, Vertex());
Math::Vector eye = m_engine->GetEyePt();
@ -363,6 +363,8 @@ void CWater::DrawSurf()
// Draws all the lines
float deep = m_engine->GetDeepView(0)*1.5f;
device->SetTextureEnabled(1, false);
for (int i = 0; i < static_cast<int>( m_lines.size() ); i++)
{
Math::Vector pos;
@ -390,14 +392,14 @@ void CWater::DrawSurf()
p.y = pos.y;
AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y;
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
vertices[vertexIndex++] = Vertex(p, n, uv1);
p.x = pos.x-size;
p.z = pos.z+sizez;
p.y = pos.y;
AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y;
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
vertices[vertexIndex++] = Vertex(p, n, uv1);
for (int j = 0; j < m_lines[i].len; j++)
{
@ -406,14 +408,14 @@ void CWater::DrawSurf()
p.y = pos.y;
AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y;
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
vertices[vertexIndex++] = Vertex(p, n, uv1);
p.x = pos.x+size;
p.z = pos.z+sizez;
p.y = pos.y;
AdjustLevel(p, n, uv1, uv2);
if (under) n.y = -n.y;
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
vertices[vertexIndex++] = Vertex(p, n, uv1);
pos.x += size*2.0f;
}
@ -421,6 +423,9 @@ void CWater::DrawSurf()
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, &vertices[0], vertexIndex);
m_engine->AddStatisticTriangle(vertexIndex - 2);
}
if (m_engine->GetDirty())
device->SetTextureEnabled(1, true);
}
bool CWater::GetWater(int x, int y)

View File

@ -913,12 +913,6 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
type != OBJECT_MOBILEdr &&
type != OBJECT_APOLLO2)
{
color.r = 1.0f;
color.g = 1.0f;
color.b = 0.0f; // yellow
color.a = 0.0f;
m_object->CreateEffectLight(20.0f, color);
CObject* powerCell = nullptr;
Math::Vector powerCellPos = m_object->GetPowerPosition();
float powerCellAngle = 0.0f;

View File

@ -113,8 +113,6 @@ COldObject::COldObject(int id)
m_name = "";
m_shadowLight = -1;
m_shadowHeight = 0.0f;
m_effectLight = -1;
m_effectHeight = 0.0f;
m_linVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_cirVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_tilt = Math::Vector(0.0f, 0.0f, 0.0f);
@ -125,7 +123,6 @@ COldObject::COldObject(int id)
m_transporterLink = 0;
m_shield = 1.0f;
m_range = 30.0f;
m_transparency = 0.0f;
m_lastEnergy = 999.9f;
m_bSelect = false;
m_bSelectable = true;
@ -139,7 +136,6 @@ COldObject::COldObject(int id)
m_bVirusMode = false;
m_virusTime = 0.0f;
m_lastVirusParticle = 0.0f;
m_bCargo = false;
m_dying = DeathType::Alive;
m_bFlat = false;
m_gunGoalV = 0.0f;
@ -245,12 +241,6 @@ void COldObject::DeleteObject(bool bAll)
m_shadowLight = -1;
}
if ( m_effectLight != -1 )
{
m_lightMan->DeleteLight(m_effectLight);
m_effectLight = -1;
}
if ( m_physics != nullptr )
{
m_physics->DeleteObject(bAll);
@ -1349,13 +1339,6 @@ void COldObject::SetPartPosition(int part, const Math::Vector &pos)
lightPos.y += m_shadowHeight;
m_lightMan->SetLightPos(m_shadowLight, lightPos);
}
if ( m_effectLight != -1 )
{
Math::Vector lightPos = pos;
lightPos.y += m_effectHeight;
m_lightMan->SetLightPos(m_effectLight, lightPos);
}
}
}
@ -1675,41 +1658,6 @@ int COldObject::GetShadowLight()
return m_shadowLight;
}
// Creates light for the effects of a vehicle.
bool COldObject::CreateEffectLight(float height, Gfx::Color color)
{
if ( !m_engine->GetLightMode() ) return true;
m_effectHeight = height;
Gfx::Light light;
light.type = Gfx::LIGHT_SPOT;
light.diffuse = color;
light.position = Math::Vector(0.0f, height, 0.0f);
light.direction = Math::Vector(0.0f, -1.0f, 0.0f); // against the bottom
light.spotIntensity = 0.0f;
light.attenuation0 = 1.0f;
light.attenuation1 = 0.0f;
light.attenuation2 = 0.0f;
light.spotAngle = 90.0f*Math::PI/180.0f;
m_effectLight = m_lightMan->CreateLight();
if ( m_effectLight == -1 ) return false;
m_lightMan->SetLight(m_effectLight, light);
m_lightMan->SetLightIntensity(m_effectLight, 0.0f);
return true;
}
// Returns the number of light effects.
int COldObject::GetEffectLight()
{
return m_effectLight;
}
// Creates the circular shadow underneath a vehicle.
bool COldObject::CreateShadowCircle(float radius, float intensity,
@ -2472,8 +2420,6 @@ void COldObject::SetTransparency(float value)
{
int i;
m_transparency = value;
for ( i=0 ; i<m_totalPart ; i++ )
{
if ( m_objectPart[i].bUsed )

View File

@ -130,7 +130,6 @@ public:
void SetDrawFront(bool bDraw) override;
int GetShadowLight();
int GetEffectLight();
void SetFloorHeight(float height);
void FloorAdjust() override;
@ -262,7 +261,6 @@ public:
bool CreateShadowCircle(float radius, float intensity, Gfx::EngineShadowType type = Gfx::ENG_SHADOW_NORM);
bool CreateShadowLight(float height, Gfx::Color color);
bool CreateEffectLight(float height, Gfx::Color color);
void FlatParent() override;
@ -325,8 +323,6 @@ protected:
int m_option; // option
int m_shadowLight; // number of light from the shadows
float m_shadowHeight; // height of light from the shadows
int m_effectLight; // number of light effects
float m_effectHeight; // height of light effects
Math::Vector m_linVibration; // linear vibration
Math::Vector m_cirVibration; // circular vibration
Math::Vector m_tilt; // tilt
@ -338,7 +334,6 @@ protected:
float m_lastEnergy;
float m_shield; // shield
float m_range; // flight range
float m_transparency; // transparency (0..1)
float m_aTime;
float m_shotTime; // time since last shot
bool m_bVirusMode; // virus activated/triggered
@ -348,7 +343,6 @@ protected:
bool m_bSelectable; // selectable object
bool m_bCheckToken; // object with audited tokens
bool m_underground; // object active but undetectable
bool m_bCargo;
DeathType m_dying;
bool m_bFlat;
bool m_bTrainer; // drive vehicle (without remote)

View File

@ -2870,17 +2870,10 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
void CPhysics::FrameParticle(float aTime, float rTime)
{
Math::Vector pos;
/*float intensity;*/
int effectLight;
//bool bFlash;
m_restBreakParticle -= rTime;
if ( aTime-m_lastPowerParticle < m_engine->ParticleAdapt(0.05f) ) return;
m_lastPowerParticle = aTime;
//bFlash = false;
float energy = GetObjectEnergyLevel(m_object);
if ( energy != m_lastEnergy ) // change the energy level?
@ -2888,7 +2881,6 @@ void CPhysics::FrameParticle(float aTime, float rTime)
if ( energy > m_lastEnergy ) // recharge?
{
PowerParticle(1.0f, false);
//bFlash = true;
}
if ( energy == 0.0f || m_lastEnergy == 0.0f )
@ -2902,28 +2894,6 @@ void CPhysics::FrameParticle(float aTime, float rTime)
if ( m_restBreakParticle > 0.0f )
{
PowerParticle(m_restBreakParticle/2.5f, (energy == 0));
//bFlash = true;
}
effectLight = m_object->GetEffectLight();
if ( effectLight != -1 )
{
/*
* TODO: this is supposed to flash lights of robot without power,
* but doesn't work correctly (e.g. beginning of scene201).
* Commenting out for the time being.
*/
/*if ( bFlash )
{
intensity = 0.0f;
if ( Math::Rand() < 0.5f ) intensity = 1.0f;
m_lightMan->SetLightIntensity(effectLight, intensity);
m_lightMan->SetLightIntensitySpeed(effectLight, 10000.0f);
}
else
{*/
m_lightMan->SetLightIntensity(effectLight, 0.0f);
/*}*/
}
}

View File

@ -33,7 +33,7 @@
**/
enum SoundType
{
SOUND_NONE = -1, /*!< Mute. */
SOUND_NONE = -1, /*!< Silence. */
SOUND_CLICK = 0, /*!< Keybinding change. */
SOUND_BOUM = 1, /*!< Landing on ground bump. */
SOUND_EXPLO = 2, /*!< Building explosion. */
@ -45,27 +45,27 @@ enum SoundType
SOUND_MOTORr = 8, /*!< SpecialBot engine. */
SOUND_ERROR = 9, /*!< DisplayError message. */
SOUND_CONVERT = 10, /*!< Converter processing. */
SOUND_ENERGY = 11, /*!< PowerStation recharging #1/Sparkle in menu #1. */
SOUND_ENERGY = 11, /*!< PowerStation recharging #1/Menu particle #1. */
SOUND_PLOUF = 12, /*!< Water splash. */
SOUND_BLUP = 13, /*!< Swimming #1. */
SOUND_WARNING = 14, /*!< DisplayWarning message. */
SOUND_DERRICK = 15, /*!< Derrick digging. */
SOUND_LABO = 16, /*!< AutoLab processing sample. */
SOUND_STATION = 17, /*!< PowerStation recharging #2/Sparkle in menu #2. */
SOUND_REPAIR = 18, /*!< RepairCenter/Sniffer working. */
SOUND_STATION = 17, /*!< PowerStation recharging #2/Menu particle #2. */
SOUND_REPAIR = 18, /*!< RepairCenter/Sniffer sniffing. */
SOUND_RESEARCH = 19, /*!< ResearchCenter processing. */
SOUND_INSECTs = 20, /*!< AlienSpider roar. */
SOUND_BURN = 21, /*!< Burning. */
SOUND_TZOING = 22, /*!< EPSITEC's Brand "TZOING!". */
SOUND_GGG = 23, /*!< Electricity/Menu particle sound #2. */
SOUND_MANIP = 24, /*!< Bot's mechanic arm manipulating. */
SOUND_FIRE = 25, /*!< ShooterBots shooting. */
SOUND_GGG = 23, /*!< Electricity/Menu particle #3. */
SOUND_MANIP = 24, /*!< Bot mechanic arm manipulating. */
SOUND_FIRE = 25, /*!< ShooterBot shooting. */
SOUND_HUMAN1 = 26, /*!< Astronaut breathing. */
SOUND_STEPw = 27, /*!< Step under the water. */
SOUND_SWIM = 28, /*!< Swimming #2. */
SOUND_RADAR = 29, /*!< RadarStation "DING!"/Sparkle in menu #5. */
SOUND_BUILD = 30, /*!< Building processing */
SOUND_ALARM = 31, /*!< Bot energy alarm/Sparkle in menu #3. */
SOUND_RADAR = 29, /*!< RadarStation "DING!"/Menu particle #4. */
SOUND_BUILD = 30, /*!< Building processing. */
SOUND_ALARM = 31, /*!< Bot energy alarm/Menu particle #5. */
SOUND_SLIDE = 32, /*!< WingedBot engine. */
SOUND_EXPLOi = 33, /*!< AlienInsect exploding scream. */
SOUND_INSECTa = 34, /*!< AlienAnt roar. */
@ -73,20 +73,20 @@ enum SoundType
SOUND_INSECTw = 36, /*!< AlienWorm roar. */
SOUND_INSECTm = 37, /*!< AlienQueen roar. */
SOUND_TREMBLE = 38, /*!< Building ambient. */
SOUND_PSHHH = 39, /*!< SpecialBot engine "PSHHH!"/Menu particle sound #1. */
SOUND_PSHHH = 39, /*!< SpecialBot engine "PSHHH!"/Menu particle #6. */
SOUND_NUCLEAR = 40, /*!< NuclearPlant processing. */
SOUND_INFO = 41, /*!< DisplayInfo message/Sparkle in menu #4. */
SOUND_INFO = 41, /*!< DisplayInfo message/Menu particle #7. */
SOUND_OPEN = 42, /*!< Converter open/close. */
SOUND_CLOSE = 43, /*!< Converter slam. */
SOUND_FACTORY = 44, /*!< BotFactory processing. */
SOUND_EGG = 45, /*!< AlienEgg breaking eggshell. */
SOUND_MOTORs = 46, /*!< Subber engine. */
SOUND_MOTORi = 47, /*!< LeggedBot engine. */
SOUND_SHIELD = 48, /*!< Shielder working. */
SOUND_FIREi = 49, /*!< OrgaShooterBots shooting. */
SOUND_SHIELD = 48, /*!< Shielder shielding. */
SOUND_FIREi = 49, /*!< OrgaShooterBot shooting. */
SOUND_GUNDEL = 50, /*!< Neutralized AlienInsect's fire under the shield. */
SOUND_PSHHH2 = 51, /*!< Shielder mechanic tower manipulating. */
SOUND_MESSAGE = 52, /*!< DisplayMessage message */
SOUND_MESSAGE = 52, /*!< DisplayMessage message. */
SOUND_BOUMm = 53, /*!< Metal bang. */
SOUND_BOUMv = 54, /*!< Plant bang. */
SOUND_BOUMs = 55, /*!< Smooth bang. */
@ -98,23 +98,23 @@ enum SoundType
SOUND_POWERON = 61, /*!< Power on. */
SOUND_POWEROFF = 62, /*!< Power off. */
SOUND_AIE = 63, /*!< Astronaut pain "AIE!". */
SOUND_WAYPOINT = 64, /*!< WayPoint/Target2 activate, placing a flag. */
SOUND_WAYPOINT = 64, /*!< WayPoint/Target2 activate/Flag placing. */
SOUND_RECOVER = 65, /*!< Recycler sound. */ /* DUPLICATE OF SOUND_GUNDEL=50 */
SOUND_DEADi = 66, /*!< AlienInsect dying scream. */
SOUND_JOSTLE = 67, /*!< Leaf shaking. */
SOUND_GFLAT = 68, /*!< FlatGround probing/Sparkle in menu #6. */
SOUND_GFLAT = 68, /*!< FlatGround probing/Menu particle #8. */
SOUND_DEADg = 69, /*!< Astronaut death "AU!". */
SOUND_DEADw = 70, /*!< Astronaut drown "AHU!AHU!". */
SOUND_FLYf = 71, /*!< Jet engine Overheating. */
SOUND_ALARMt = 72, /*!< Bot temperature alarm/Sparkle in menu #7. */
SOUND_FINDING = 73, /*!< ProxyActivating an object, opening Vault. */ /* DUPLICATE OF SOUND_WAYPOINT=64 */
SOUND_FLYf = 71, /*!< Jet engine overheating. */
SOUND_ALARMt = 72, /*!< Bot temperature alarm/Menu particle #9. */
SOUND_FINDING = 73, /*!< Vault opening/ProxyActivating an object. */ /* DUPLICATE OF SOUND_WAYPOINT=64 */
SOUND_THUMP = 74, /*!< Thumper thumping. */
SOUND_TOUCH = 75, /*!< Bot getting damage. */
SOUND_BLITZ = 76, /*!< Thunder. */
SOUND_MUSHROOM = 77, /*!< Mushroom poisoning. */
SOUND_FIREp = 78, /*!< PhazerShooter shooting. */
SOUND_EXPLOg1 = 79, /*!< ShooterBots damaging things. */
SOUND_EXPLOg2 = 80, /*!< OrgaShooterBots damaging things. */
SOUND_EXPLOg1 = 79, /*!< ShooterBots damaging objects. */
SOUND_EXPLOg2 = 80, /*!< OrgaShooterBots damaging objects. */
SOUND_MOTORd = 81, /*!< Scribbler/ToyBot engine. */
SOUND_MAX /** number of items in enum */
};