Team object recoloring (#514)
parent
0c54e1e8de
commit
083f216529
|
@ -746,7 +746,6 @@ bool CApplication::ChangeVideoConfig(const Gfx::DeviceConfig &newConfig)
|
|||
m_device->ConfigChanged(m_deviceConfig);
|
||||
|
||||
m_engine->ResetAfterDeviceChanged();
|
||||
m_controller->GetRobotMain()->ResetAfterDeviceChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -380,6 +380,8 @@ void CEngine::ResetAfterDeviceChanged()
|
|||
|
||||
FlushTextureCache();
|
||||
|
||||
CRobotMain::GetInstancePointer()->ResetAfterDeviceChanged();
|
||||
|
||||
LoadAllTextures();
|
||||
}
|
||||
|
||||
|
@ -2321,6 +2323,7 @@ bool IsExcludeColor(Math::Point *exclude, int x, int y)
|
|||
|
||||
|
||||
bool CEngine::ChangeTextureColor(const std::string& texName,
|
||||
const std::string& srcName,
|
||||
Color colorRef1, Color colorNew1,
|
||||
Color colorRef2, Color colorNew2,
|
||||
float tolerance1, float tolerance2,
|
||||
|
@ -2330,11 +2333,11 @@ bool CEngine::ChangeTextureColor(const std::string& texName,
|
|||
DeleteTexture(texName);
|
||||
|
||||
CImage img;
|
||||
if (!img.Load(texName))
|
||||
if (!img.Load(srcName))
|
||||
{
|
||||
std::string error = img.GetError();
|
||||
GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());
|
||||
m_texBlacklist.insert(texName);
|
||||
GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", srcName.c_str(), error.c_str());
|
||||
m_texBlacklist.insert(srcName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2447,12 +2450,19 @@ bool CEngine::ChangeTextureColor(const std::string& texName,
|
|||
m_texNameMap[texName] = tex;
|
||||
m_revTexNameMap[tex] = texName;
|
||||
|
||||
// This updates the texture to updated Texture struct on the objects
|
||||
LoadAllTextures();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngine::ChangeTextureColor(const std::string& texName,
|
||||
Color colorRef1, Color colorNew1,
|
||||
Color colorRef2, Color colorNew2,
|
||||
float tolerance1, float tolerance2,
|
||||
Math::Point ts, Math::Point ti,
|
||||
Math::Point *exclude, float shift, bool hsv)
|
||||
{
|
||||
return ChangeTextureColor(texName, texName, colorRef1, colorNew1, colorRef2, colorNew2, tolerance1, tolerance2, ts, ti, exclude, shift, hsv);
|
||||
}
|
||||
|
||||
void CEngine::DeleteTexture(const std::string& texName)
|
||||
{
|
||||
auto it = m_texNameMap.find(texName);
|
||||
|
@ -2832,7 +2842,6 @@ void CEngine::SetTextureFilterMode(TexFilter value)
|
|||
m_defaultTexParams.filter = m_terrainTexParams.filter = value;
|
||||
m_defaultTexParams.mipmap = m_terrainTexParams.mipmap = (value == TEX_FILTER_TRILINEAR);
|
||||
ResetAfterDeviceChanged();
|
||||
CRobotMain::GetInstancePointer()->ResetAfterDeviceChanged();
|
||||
}
|
||||
|
||||
TexFilter CEngine::GetTextureFilterMode()
|
||||
|
@ -2848,7 +2857,6 @@ void CEngine::SetTextureMipmapLevel(int value)
|
|||
|
||||
m_textureMipmapLevel = value;
|
||||
ResetAfterDeviceChanged();
|
||||
CRobotMain::GetInstancePointer()->ResetAfterDeviceChanged();
|
||||
}
|
||||
|
||||
int CEngine::GetTextureMipmapLevel()
|
||||
|
@ -2865,7 +2873,6 @@ void CEngine::SetTextureAnisotropyLevel(int value)
|
|||
|
||||
m_textureAnisotropy = value;
|
||||
ResetAfterDeviceChanged();
|
||||
CRobotMain::GetInstancePointer()->ResetAfterDeviceChanged();
|
||||
}
|
||||
|
||||
int CEngine::GetTextureAnisotropyLevel()
|
||||
|
|
|
@ -959,6 +959,15 @@ public:
|
|||
bool LoadAllTextures();
|
||||
|
||||
//! Changes colors in a texture
|
||||
//@{
|
||||
bool ChangeTextureColor(const std::string& texName,
|
||||
const std::string& srcName,
|
||||
Color colorRef1, Color colorNew1,
|
||||
Color colorRef2, Color colorNew2,
|
||||
float tolerance1, float tolerance2,
|
||||
Math::Point ts, Math::Point ti,
|
||||
Math::Point *exclude = nullptr,
|
||||
float shift = 0.0f, bool hsv = false);
|
||||
bool ChangeTextureColor(const std::string& texName,
|
||||
Color colorRef1, Color colorNew1,
|
||||
Color colorRef2, Color colorNew2,
|
||||
|
@ -966,6 +975,7 @@ public:
|
|||
Math::Point ts, Math::Point ti,
|
||||
Math::Point *exclude = nullptr,
|
||||
float shift = 0.0f, bool hsv = false);
|
||||
//@}
|
||||
|
||||
//! Sets texture for given stage; if not present in cache, the texture is loaded
|
||||
/** If loading fails, returns false. */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "common/logger.h"
|
||||
#include "common/resources/inputstream.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "graphics/engine/engine.h"
|
||||
|
||||
|
@ -42,7 +43,7 @@ COldModelManager::~COldModelManager()
|
|||
{
|
||||
}
|
||||
|
||||
bool COldModelManager::LoadModel(const std::string& fileName, bool mirrored)
|
||||
bool COldModelManager::LoadModel(const std::string& fileName, bool mirrored, int variant)
|
||||
{
|
||||
GetLogger()->Debug("Loading model '%s'\n", fileName.c_str());
|
||||
|
||||
|
@ -72,7 +73,10 @@ bool COldModelManager::LoadModel(const std::string& fileName, bool mirrored)
|
|||
if (mirrored)
|
||||
Mirror(modelInfo.triangles);
|
||||
|
||||
FileInfo fileInfo(fileName, mirrored);
|
||||
if (variant != 0)
|
||||
ChangeVariant(modelInfo.triangles, variant);
|
||||
|
||||
FileInfo fileInfo(fileName, mirrored, variant);
|
||||
m_models[fileInfo] = modelInfo;
|
||||
|
||||
m_engine->AddBaseObjTriangles(modelInfo.baseObjRank, modelInfo.triangles);
|
||||
|
@ -80,15 +84,15 @@ bool COldModelManager::LoadModel(const std::string& fileName, bool mirrored)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool COldModelManager::AddModelReference(const std::string& fileName, bool mirrored, int objRank)
|
||||
bool COldModelManager::AddModelReference(const std::string& fileName, bool mirrored, int objRank, int variant)
|
||||
{
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored));
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
if (it == m_models.end())
|
||||
{
|
||||
if (!LoadModel(fileName, mirrored))
|
||||
if (!LoadModel(fileName, mirrored, variant))
|
||||
return false;
|
||||
|
||||
it = m_models.find(FileInfo(fileName, mirrored));
|
||||
it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
}
|
||||
|
||||
m_engine->SetObjectBaseRank(objRank, (*it).second.baseObjRank);
|
||||
|
@ -96,15 +100,15 @@ bool COldModelManager::AddModelReference(const std::string& fileName, bool mirro
|
|||
return true;
|
||||
}
|
||||
|
||||
bool COldModelManager::AddModelCopy(const std::string& fileName, bool mirrored, int objRank)
|
||||
bool COldModelManager::AddModelCopy(const std::string& fileName, bool mirrored, int objRank, int variant)
|
||||
{
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored));
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
if (it == m_models.end())
|
||||
{
|
||||
if (!LoadModel(fileName, mirrored))
|
||||
if (!LoadModel(fileName, mirrored, variant))
|
||||
return false;
|
||||
|
||||
it = m_models.find(FileInfo(fileName, mirrored));
|
||||
it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
}
|
||||
|
||||
int copyBaseObjRank = m_engine->CreateBaseObject();
|
||||
|
@ -116,14 +120,14 @@ bool COldModelManager::AddModelCopy(const std::string& fileName, bool mirrored,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool COldModelManager::IsModelLoaded(const std::string& fileName, bool mirrored)
|
||||
bool COldModelManager::IsModelLoaded(const std::string& fileName, bool mirrored, int variant)
|
||||
{
|
||||
return m_models.count(FileInfo(fileName, mirrored)) > 0;
|
||||
return m_models.count(FileInfo(fileName, mirrored, variant)) > 0;
|
||||
}
|
||||
|
||||
int COldModelManager::GetModelBaseObjRank(const std::string& fileName, bool mirrored)
|
||||
int COldModelManager::GetModelBaseObjRank(const std::string& fileName, bool mirrored, int variant)
|
||||
{
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored));
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
if (it == m_models.end())
|
||||
return -1;
|
||||
|
||||
|
@ -140,9 +144,9 @@ void COldModelManager::DeleteAllModelCopies()
|
|||
m_copiesBaseRanks.clear();
|
||||
}
|
||||
|
||||
void COldModelManager::UnloadModel(const std::string& fileName, bool mirrored)
|
||||
void COldModelManager::UnloadModel(const std::string& fileName, bool mirrored, int variant)
|
||||
{
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored));
|
||||
auto it = m_models.find(FileInfo(fileName, mirrored, variant));
|
||||
if (it == m_models.end())
|
||||
return;
|
||||
|
||||
|
@ -177,5 +181,23 @@ void COldModelManager::Mirror(std::vector<ModelTriangle>& triangles)
|
|||
}
|
||||
}
|
||||
|
||||
void COldModelManager::ChangeVariant(std::vector<ModelTriangle>& triangles, int variant)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>( triangles.size() ); i++)
|
||||
{
|
||||
if (triangles[i].tex1Name == "base1.png" ||
|
||||
triangles[i].tex1Name == "convert.png" ||
|
||||
triangles[i].tex1Name == "derrick.png" ||
|
||||
triangles[i].tex1Name == "factory.png" ||
|
||||
triangles[i].tex1Name == "lemt.png" ||
|
||||
triangles[i].tex1Name == "roller.png" ||
|
||||
triangles[i].tex1Name == "search.png" ||
|
||||
triangles[i].tex1Name == "drawer.png" ||
|
||||
triangles[i].tex1Name == "subm.png" )
|
||||
{
|
||||
triangles[i].tex1Name += StrUtils::ToString<int>(variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,31 +58,33 @@ public:
|
|||
~COldModelManager();
|
||||
|
||||
//! Loads a model from given file
|
||||
bool LoadModel(const std::string& fileName, bool mirrored);
|
||||
bool LoadModel(const std::string& fileName, bool mirrored, int variant = 0);
|
||||
|
||||
//! Adds an instance of model to the given object rank as a reference to base object
|
||||
bool AddModelReference(const std::string& fileName, bool mirrored, int objRank);
|
||||
bool AddModelReference(const std::string& fileName, bool mirrored, int objRank, int variant = 0);
|
||||
|
||||
//! Adds an instance of model to the given object rank as a copy (copied base object)
|
||||
bool AddModelCopy(const std::string& fileName, bool mirrored, int objRank);
|
||||
bool AddModelCopy(const std::string& fileName, bool mirrored, int objRank, int variant = 0);
|
||||
|
||||
//! Returns true if given model is loaded
|
||||
bool IsModelLoaded(const std::string& fileName, bool mirrored);
|
||||
bool IsModelLoaded(const std::string& fileName, bool mirrored, int variant = 0);
|
||||
|
||||
//! Returns the rank of base engine object of given loaded model
|
||||
int GetModelBaseObjRank(const std::string& fileName, bool mirrored);
|
||||
int GetModelBaseObjRank(const std::string& fileName, bool mirrored, int variant = 0);
|
||||
|
||||
//! Deletes all copied objects
|
||||
void DeleteAllModelCopies();
|
||||
|
||||
//! Unloads the given model
|
||||
void UnloadModel(const std::string& fileName, bool mirrored);
|
||||
void UnloadModel(const std::string& fileName, bool mirrored, int variant = 0);
|
||||
//! Unloads all models
|
||||
void UnloadAllModels();
|
||||
|
||||
protected:
|
||||
//! Mirrors the model along the Z axis
|
||||
void Mirror(std::vector<ModelTriangle>& triangles);
|
||||
//! Changes variant
|
||||
void ChangeVariant(std::vector<ModelTriangle>& triangles, int variant);
|
||||
|
||||
private:
|
||||
struct ModelInfo
|
||||
|
@ -94,10 +96,12 @@ private:
|
|||
{
|
||||
std::string fileName;
|
||||
bool mirrored;
|
||||
int variant;
|
||||
|
||||
inline FileInfo(const std::string& _fileName, bool _mirrored)
|
||||
inline FileInfo(const std::string& _fileName, bool _mirrored, int _variant = 0)
|
||||
: fileName(_fileName)
|
||||
, mirrored(_mirrored)
|
||||
, variant(_variant)
|
||||
{}
|
||||
|
||||
inline bool operator<(const FileInfo& other) const
|
||||
|
@ -108,6 +112,9 @@ private:
|
|||
if (compare > 0)
|
||||
return false;
|
||||
|
||||
if (variant < other.variant)
|
||||
return true;
|
||||
|
||||
return !mirrored && mirrored != other.mirrored;
|
||||
}
|
||||
};
|
||||
|
@ -117,4 +124,3 @@ private:
|
|||
};
|
||||
|
||||
} // namespace Gfx
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "object/brain.h"
|
||||
#include "object/old_object.h"
|
||||
#include "object/object_create_params.h"
|
||||
#include "object/object_manager.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "object/level/parserline.h"
|
||||
|
@ -643,11 +644,15 @@ bool CAutoFactory::CreateVehicle()
|
|||
Math::Matrix* mat = m_object->GetWorldMatrix(0);
|
||||
pos = Transform(*mat, pos);
|
||||
|
||||
CObject* vehicle = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type);
|
||||
ObjectCreateParams params;
|
||||
params.pos = pos;
|
||||
params.angle = angle;
|
||||
params.type = m_type;
|
||||
params.team = m_object->GetTeam();
|
||||
CObject* vehicle = CObjectManager::GetInstancePointer()->CreateObject(params);
|
||||
|
||||
vehicle->SetLock(true); // not usable
|
||||
vehicle->SetRange(30.0f);
|
||||
vehicle->SetTeam(m_object->GetTeam());
|
||||
|
||||
CPhysics* physics = vehicle->GetPhysics();
|
||||
if ( physics != nullptr )
|
||||
|
|
|
@ -112,14 +112,14 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
type == OBJECT_MOBILEfi ||
|
||||
type == OBJECT_MOBILEfs)
|
||||
{
|
||||
modelManager->AddModelReference("lem1f.mod", false, rank);
|
||||
modelManager->AddModelReference("lem1f.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEta ||
|
||||
type == OBJECT_MOBILEtc ||
|
||||
type == OBJECT_MOBILEti ||
|
||||
type == OBJECT_MOBILEts)
|
||||
{
|
||||
modelManager->AddModelReference("lem1t.mod", false, rank);
|
||||
modelManager->AddModelReference("lem1t.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEwa ||
|
||||
type == OBJECT_MOBILEwc ||
|
||||
|
@ -128,11 +128,11 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
{
|
||||
if (m_object->GetTrainer())
|
||||
{
|
||||
modelManager->AddModelReference("lem1wt.mod", false, rank);
|
||||
modelManager->AddModelReference("lem1wt.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else
|
||||
{
|
||||
modelManager->AddModelReference("lem1w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem1w.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
}
|
||||
else if (type == OBJECT_MOBILEia ||
|
||||
|
@ -140,46 +140,46 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
type == OBJECT_MOBILEii ||
|
||||
type == OBJECT_MOBILEis)
|
||||
{
|
||||
modelManager->AddModelReference("lem1i.mod", false, rank);
|
||||
modelManager->AddModelReference("lem1i.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILErt ||
|
||||
type == OBJECT_MOBILErc ||
|
||||
type == OBJECT_MOBILErr ||
|
||||
type == OBJECT_MOBILErs)
|
||||
{
|
||||
modelManager->AddModelReference("roller1.mod", false, rank);
|
||||
modelManager->AddModelReference("roller1.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEsa)
|
||||
{
|
||||
modelManager->AddModelReference("subm1.mod", false, rank);
|
||||
modelManager->AddModelReference("subm1.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEtg)
|
||||
{
|
||||
modelManager->AddModelReference("target.mod", false, rank);
|
||||
modelManager->AddModelReference("target.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEwt)
|
||||
{
|
||||
modelManager->AddModelReference("trainerw.mod", false, rank);
|
||||
modelManager->AddModelReference("trainerw.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEft)
|
||||
{
|
||||
modelManager->AddModelReference("trainerf.mod", false, rank);
|
||||
modelManager->AddModelReference("trainerf.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEtt)
|
||||
{
|
||||
modelManager->AddModelReference("trainert.mod", false, rank);
|
||||
modelManager->AddModelReference("trainert.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEit)
|
||||
{
|
||||
modelManager->AddModelReference("traineri.mod", false, rank);
|
||||
modelManager->AddModelReference("traineri.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_MOBILEdr)
|
||||
{
|
||||
modelManager->AddModelReference("drawer1.mod", false, rank);
|
||||
modelManager->AddModelReference("drawer1.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
else if (type == OBJECT_APOLLO2)
|
||||
{
|
||||
modelManager->AddModelReference("apolloj1.mod", false, rank);
|
||||
modelManager->AddModelReference("apolloj1.mod", false, rank, m_object->GetTeam());
|
||||
}
|
||||
|
||||
m_object->SetPosition(pos);
|
||||
|
@ -225,7 +225,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("lem2.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 5.3f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, ARM_NEUTRAL_ANGLE1);
|
||||
|
||||
|
@ -234,7 +234,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("lem3.mod", false, rank);
|
||||
modelManager->AddModelReference("lem3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(5.0f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, ARM_NEUTRAL_ANGLE2);
|
||||
|
||||
|
@ -243,7 +243,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(3, rank);
|
||||
m_object->SetObjectParent(3, 2);
|
||||
modelManager->AddModelReference("lem4.mod", false, rank);
|
||||
modelManager->AddModelReference("lem4.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(3, Math::Vector(3.5f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(3, ARM_NEUTRAL_ANGLE3);
|
||||
m_object->SetPartRotationX(3, Math::PI/2.0f);
|
||||
|
@ -253,7 +253,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(4, rank);
|
||||
m_object->SetObjectParent(4, 3);
|
||||
modelManager->AddModelReference("lem5.mod", false, rank);
|
||||
modelManager->AddModelReference("lem5.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(4, Math::Vector(1.5f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(4, -Math::PI*0.10f);
|
||||
|
||||
|
@ -262,7 +262,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(5, rank);
|
||||
m_object->SetObjectParent(5, 3);
|
||||
modelManager->AddModelReference("lem6.mod", false, rank);
|
||||
modelManager->AddModelReference("lem6.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(5, Math::Vector(1.5f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(5, Math::PI*0.10f);
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("lem2.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 5.3f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, 110.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -286,7 +286,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("lem3.mod", false, rank);
|
||||
modelManager->AddModelReference("lem3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(5.0f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, -110.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -295,7 +295,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(3, rank);
|
||||
m_object->SetObjectParent(3, 2);
|
||||
modelManager->AddModelReference("lem4s.mod", false, rank);
|
||||
modelManager->AddModelReference("lem4s.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(3, Math::Vector(3.5f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(3, -65.0f*Math::PI/180.0f);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("canon.mod", false, rank);
|
||||
modelManager->AddModelReference("canon.mod", false, rank, m_object->GetTeam());
|
||||
//? m_object->SetPartPosition(1, Math::Vector(0.0f, 5.3f, 0.0f));
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 5.3f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, 0.0f);
|
||||
|
@ -326,7 +326,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("canoni1.mod", false, rank);
|
||||
modelManager->AddModelReference("canoni1.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 5.3f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, 0.0f);
|
||||
|
||||
|
@ -334,7 +334,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("canoni2.mod", false, rank);
|
||||
modelManager->AddModelReference("canoni2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(0.0f, 2.5f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, 0.0f);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(-3.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left-back wheel.
|
||||
|
@ -358,7 +358,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(-3.0f, 1.0f, 3.0f));
|
||||
m_object->SetPartRotationY(7, Math::PI);
|
||||
|
||||
|
@ -367,7 +367,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(8, rank);
|
||||
m_object->SetObjectParent(8, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(8, Math::Vector(2.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left-front wheel.
|
||||
|
@ -375,7 +375,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(9, rank);
|
||||
m_object->SetObjectParent(9, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(9, Math::Vector(2.0f, 1.0f, 3.0f));
|
||||
m_object->SetPartRotationY(9, Math::PI);
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(-2.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left-back wheel.
|
||||
|
@ -395,7 +395,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(-2.0f, 1.0f, 3.0f));
|
||||
m_object->SetPartRotationY(7, Math::PI);
|
||||
|
||||
|
@ -404,7 +404,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(8, rank);
|
||||
m_object->SetObjectParent(8, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(8, Math::Vector(3.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left-front wheel.
|
||||
|
@ -412,7 +412,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(9, rank);
|
||||
m_object->SetObjectParent(9, 0);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2w.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(9, Math::Vector(3.0f, 1.0f, 3.0f));
|
||||
m_object->SetPartRotationY(9, Math::PI);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelCopy("lem2t.mod", false, rank);
|
||||
modelManager->AddModelCopy("lem2t.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(0.0f, 2.0f, -3.0f));
|
||||
|
||||
// Creates the left caterpillar.
|
||||
|
@ -435,7 +435,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelCopy("lem3t.mod", false, rank);
|
||||
modelManager->AddModelCopy("lem3t.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(0.0f, 2.0f, 3.0f));
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelCopy("roller2.mod", false, rank);
|
||||
modelManager->AddModelCopy("roller2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(0.0f, 2.0f, -3.0f));
|
||||
|
||||
// Creates the left caterpillar.
|
||||
|
@ -457,7 +457,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelCopy("roller3.mod", false, rank);
|
||||
modelManager->AddModelCopy("roller3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(0.0f, 2.0f, 3.0f));
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelCopy("subm4.mod", false, rank);
|
||||
modelManager->AddModelCopy("subm4.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(0.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left caterpillar.
|
||||
|
@ -476,7 +476,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelCopy("subm5.mod", false, rank);
|
||||
modelManager->AddModelCopy("subm5.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(0.0f, 1.0f, 3.0f));
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelCopy("drawer2.mod", false, rank);
|
||||
modelManager->AddModelCopy("drawer2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(0.0f, 1.0f, -3.0f));
|
||||
|
||||
// Creates the left caterpillar.
|
||||
|
@ -495,7 +495,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelCopy("drawer3.mod", false, rank);
|
||||
modelManager->AddModelCopy("drawer3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(0.0f, 1.0f, 3.0f));
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(6, Math::Vector(1.7f, 3.0f, 0.0f));
|
||||
|
||||
// Creates the right-back foot.
|
||||
|
@ -518,7 +518,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(7, Math::Vector(-1.8f, 3.0f, -1.5f));
|
||||
m_object->SetPartRotationY(7, 120.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -527,7 +527,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(8, rank);
|
||||
m_object->SetObjectParent(8, 0);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank);
|
||||
modelManager->AddModelReference("lem2f.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(8, Math::Vector(-1.8f, 3.0f, 1.5f));
|
||||
m_object->SetPartRotationY(8, -120.0f*Math::PI/180.0f);
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
if ( j == 0 ) parent = 0;
|
||||
else parent = 6+i*3+j-1;
|
||||
m_object->SetObjectParent(6+i*3+j, parent);
|
||||
modelManager->AddModelReference(name, false, rank);
|
||||
modelManager->AddModelReference(name, false, rank, m_object->GetTeam());
|
||||
pos.x = table[i*9+j*3+0];
|
||||
pos.y = table[i*9+j*3+1];
|
||||
pos.z = table[i*9+j*3+2];
|
||||
|
@ -579,7 +579,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
if ( j == 0 ) parent = 0;
|
||||
else parent = 15+i*3+j-1;
|
||||
m_object->SetObjectParent(15+i*3+j, parent);
|
||||
modelManager->AddModelReference(name, true, rank);
|
||||
modelManager->AddModelReference(name, true, rank, m_object->GetTeam());
|
||||
pos.x = table[i*9+j*3+0];
|
||||
pos.y = table[i*9+j*3+1];
|
||||
pos.z = -table[i*9+j*3+2];
|
||||
|
@ -595,7 +595,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("roller2t.mod", false, rank);
|
||||
modelManager->AddModelReference("roller2t.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, 0.0f);
|
||||
|
||||
|
@ -604,7 +604,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 0);
|
||||
modelManager->AddModelReference("roller3t.mod", false, rank);
|
||||
modelManager->AddModelReference("roller3t.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(9.0f, 4.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, 0.0f);
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("roller2c.mod", false, rank);
|
||||
modelManager->AddModelReference("roller2c.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(3.0f, 4.6f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, Math::PI/8.0f);
|
||||
|
||||
|
@ -625,7 +625,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 0);
|
||||
modelManager->AddModelReference("roller3p.mod", false, rank);
|
||||
modelManager->AddModelReference("roller3p.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(7.0f, 6.5f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, 0.0f);
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("recover1.mod", false, rank);
|
||||
modelManager->AddModelReference("recover1.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(2.0f, 5.0f, 0.0f));
|
||||
|
||||
// Creates the right arm.
|
||||
|
@ -645,7 +645,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("recover2.mod", false, rank);
|
||||
modelManager->AddModelReference("recover2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(0.1f, 0.0f, -5.0f));
|
||||
m_object->SetPartRotationZ(2, 126.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -654,7 +654,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(3, rank);
|
||||
m_object->SetObjectParent(3, 2);
|
||||
modelManager->AddModelReference("recover3.mod", false, rank);
|
||||
modelManager->AddModelReference("recover3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(3, Math::Vector(5.0f, 0.0f, -0.5f));
|
||||
m_object->SetPartRotationZ(3, -144.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -663,7 +663,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(4, rank);
|
||||
m_object->SetObjectParent(4, 1);
|
||||
modelManager->AddModelReference("recover2.mod", true, rank);
|
||||
modelManager->AddModelReference("recover2.mod", true, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(4, Math::Vector(0.1f, 0.0f, 5.0f));
|
||||
m_object->SetPartRotationZ(4, 126.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -672,7 +672,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(5, rank);
|
||||
m_object->SetObjectParent(5, 4);
|
||||
modelManager->AddModelReference("recover3.mod", true, rank);
|
||||
modelManager->AddModelReference("recover3.mod", true, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(5, Math::Vector(5.0f, 0.0f, 0.5f));
|
||||
m_object->SetPartRotationZ(5, -144.0f*Math::PI/180.0f);
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("roller2s.mod", false, rank);
|
||||
modelManager->AddModelReference("roller2s.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(1, 0.0f);
|
||||
|
||||
|
@ -693,7 +693,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("roller3s.mod", false, rank);
|
||||
modelManager->AddModelReference("roller3s.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(7.0f, 4.5f, 0.0f));
|
||||
m_object->SetPartRotationZ(2, 0.0f);
|
||||
|
||||
|
@ -702,7 +702,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(3, rank);
|
||||
m_object->SetObjectParent(3, 2);
|
||||
modelManager->AddModelReference("roller4s.mod", false, rank);
|
||||
modelManager->AddModelReference("roller4s.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(3, Math::Vector(0.0f, 1.0f, 0.0f));
|
||||
m_object->SetPartRotationZ(3, 0.0f);
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("subm2.mod", false, rank);
|
||||
modelManager->AddModelReference("subm2.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(4.2f, 3.0f, 0.0f));
|
||||
|
||||
// Creates the right tong.
|
||||
|
@ -722,7 +722,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 1);
|
||||
modelManager->AddModelReference("subm3.mod", false, rank);
|
||||
modelManager->AddModelReference("subm3.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(2, Math::Vector(0.5f, 0.0f, -1.5f));
|
||||
|
||||
// Creates the left tong.
|
||||
|
@ -730,7 +730,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(3, rank);
|
||||
m_object->SetObjectParent(3, 1);
|
||||
modelManager->AddModelReference("subm3.mod", true, rank);
|
||||
modelManager->AddModelReference("subm3.mod", true, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(3, Math::Vector(0.5f, 0.0f, 1.5f));
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("drawer4.mod", false, rank);
|
||||
modelManager->AddModelReference("drawer4.mod", false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(1, Math::Vector(-3.0f, 3.0f, 0.0f));
|
||||
|
||||
// Creates the key.
|
||||
|
@ -751,7 +751,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 0);
|
||||
modelManager->AddModelReference("drawer5.mod", false, rank);
|
||||
modelManager->AddModelReference("drawer5.mod", false, rank, m_object->GetTeam());
|
||||
m_posKey = Math::Vector(3.0f, 5.7f, 0.0f);
|
||||
m_object->SetPartPosition(2, m_posKey);
|
||||
m_object->SetPartRotationY(2, 90.0f*Math::PI/180.0f);
|
||||
|
@ -765,7 +765,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_object->SetObjectRank(10+i, rank);
|
||||
m_object->SetObjectParent(10+i, 1);
|
||||
sprintf(name, "drawer%d.mod", 10+i);
|
||||
modelManager->AddModelReference(name, false, rank);
|
||||
modelManager->AddModelReference(name, false, rank, m_object->GetTeam());
|
||||
m_object->SetPartPosition(10+i, Math::Vector(0.0f, 0.0f, 0.0f));
|
||||
m_object->SetPartRotationY(10+i, 45.0f*Math::PI/180.0f*i);
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 0);
|
||||
modelManager->AddModelReference("drawer5.mod", false, rank);
|
||||
modelManager->AddModelReference("drawer5.mod", false, rank, m_object->GetTeam());
|
||||
m_posKey = Math::Vector(0.2f, 4.1f, 0.0f);
|
||||
m_object->SetPartPosition(2, m_posKey);
|
||||
m_object->SetPartRotationY(2, 90.0f*Math::PI/180.0f);
|
||||
|
@ -794,7 +794,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(1, rank);
|
||||
m_object->SetObjectParent(1, 0);
|
||||
modelManager->AddModelReference("apolloj2.mod", false, rank); // antenna
|
||||
modelManager->AddModelReference("apolloj2.mod", false, rank, m_object->GetTeam()); // antenna
|
||||
m_object->SetPartPosition(1, Math::Vector(5.5f, 8.8f, 2.0f));
|
||||
m_object->SetPartRotationY(1, -120.0f*Math::PI/180.0f);
|
||||
m_object->SetPartRotationZ(1, 45.0f*Math::PI/180.0f);
|
||||
|
@ -803,7 +803,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(2, rank);
|
||||
m_object->SetObjectParent(2, 0);
|
||||
modelManager->AddModelReference("apolloj3.mod", false, rank); // camera
|
||||
modelManager->AddModelReference("apolloj3.mod", false, rank, m_object->GetTeam()); // camera
|
||||
m_object->SetPartPosition(2, Math::Vector(5.5f, 2.8f, -2.0f));
|
||||
m_object->SetPartRotationY(2, 30.0f*Math::PI/180.0f);
|
||||
|
||||
|
@ -812,28 +812,28 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(6, rank);
|
||||
m_object->SetObjectParent(6, 0);
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(6, Math::Vector(-5.75f, 1.65f, -5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(7, rank);
|
||||
m_object->SetObjectParent(7, 0);
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(7, Math::Vector(-5.75f, 1.65f, 5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(8, rank);
|
||||
m_object->SetObjectParent(8, 0);
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(8, Math::Vector(5.75f, 1.65f, -5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(9, rank);
|
||||
m_object->SetObjectParent(9, 0);
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj4.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(9, Math::Vector(5.75f, 1.65f, 5.00f));
|
||||
|
||||
// Creates mud guards.
|
||||
|
@ -841,28 +841,28 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
|||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(10, rank);
|
||||
m_object->SetObjectParent(10, 0);
|
||||
modelManager->AddModelReference("apolloj6.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj6.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(10, Math::Vector(-5.75f, 1.65f, -5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(11, rank);
|
||||
m_object->SetObjectParent(11, 0);
|
||||
modelManager->AddModelReference("apolloj6.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj6.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(11, Math::Vector(-5.75f, 1.65f, 5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(12, rank);
|
||||
m_object->SetObjectParent(12, 0);
|
||||
modelManager->AddModelReference("apolloj5.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj5.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(12, Math::Vector(5.75f, 1.65f, -5.0f));
|
||||
|
||||
rank = m_engine->CreateObject();
|
||||
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
|
||||
m_object->SetObjectRank(13, rank);
|
||||
m_object->SetObjectParent(13, 0);
|
||||
modelManager->AddModelReference("apolloj5.mod", false, rank); // wheel
|
||||
modelManager->AddModelReference("apolloj5.mod", false, rank, m_object->GetTeam()); // wheel
|
||||
m_object->SetPartPosition(13, Math::Vector(5.75f, 1.65f, 5.00f));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,5 +34,21 @@ struct ObjectCreateParams
|
|||
bool trainer;
|
||||
bool toy;
|
||||
int option;
|
||||
int team;
|
||||
int id;
|
||||
|
||||
ObjectCreateParams()
|
||||
{
|
||||
pos = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
angle = 0.0f;
|
||||
type = OBJECT_NULL;
|
||||
power = -1.0f;
|
||||
zoom = 1.0f;
|
||||
height = 0.0f;
|
||||
trainer = false;
|
||||
toy = false;
|
||||
option = 0;
|
||||
team = 0;
|
||||
id = -1;
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -116,6 +116,28 @@ CObject* CObjectManager::GetObjectByRank(unsigned int id)
|
|||
return it->second.get();
|
||||
}
|
||||
|
||||
CObject* CObjectManager::CreateObject(ObjectCreateParams params)
|
||||
{
|
||||
if (params.id < 0)
|
||||
{
|
||||
params.id = m_nextId;
|
||||
m_nextId++;
|
||||
}
|
||||
|
||||
assert(m_objects.find(params.id) == m_objects.end());
|
||||
|
||||
auto objectUPtr = m_objectFactory->CreateObject(params);
|
||||
|
||||
if (objectUPtr == nullptr)
|
||||
throw CObjectCreateException("Something went wrong in CObjectFactory", params.type);
|
||||
|
||||
CObject* objectPtr = objectUPtr.get();
|
||||
|
||||
m_objects[params.id] = std::move(objectUPtr);
|
||||
|
||||
return objectPtr;
|
||||
}
|
||||
|
||||
CObject* CObjectManager::CreateObject(Math::Vector pos,
|
||||
float angle,
|
||||
ObjectType type,
|
||||
|
@ -125,16 +147,9 @@ CObject* CObjectManager::CreateObject(Math::Vector pos,
|
|||
bool trainer,
|
||||
bool toy,
|
||||
int option,
|
||||
int team,
|
||||
int id)
|
||||
{
|
||||
if (id < 0)
|
||||
{
|
||||
id = m_nextId;
|
||||
m_nextId++;
|
||||
}
|
||||
|
||||
assert(m_objects.find(id) == m_objects.end());
|
||||
|
||||
ObjectCreateParams params;
|
||||
params.pos = pos;
|
||||
params.angle = angle;
|
||||
|
@ -145,18 +160,10 @@ CObject* CObjectManager::CreateObject(Math::Vector pos,
|
|||
params.trainer = trainer;
|
||||
params.toy = toy;
|
||||
params.option = option;
|
||||
params.team = team;
|
||||
params.id = id;
|
||||
|
||||
auto objectUPtr = m_objectFactory->CreateObject(params);
|
||||
|
||||
if (objectUPtr == nullptr)
|
||||
throw CObjectCreateException("Something went wrong in CObjectFactory", type);
|
||||
|
||||
CObject* objectPtr = objectUPtr.get();
|
||||
|
||||
m_objects[id] = std::move(objectUPtr);
|
||||
|
||||
return objectPtr;
|
||||
return CreateObject(params);
|
||||
}
|
||||
|
||||
std::vector<CObject*> CObjectManager::GetObjectsOfTeam(int team)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "math/const.h"
|
||||
#include "math/vector.h"
|
||||
|
||||
#include "object/object_create_params.h"
|
||||
#include "object/object_type.h"
|
||||
|
||||
#include <map>
|
||||
|
@ -133,6 +134,8 @@ public:
|
|||
virtual ~CObjectManager();
|
||||
|
||||
//! Creates an object
|
||||
//@{
|
||||
CObject* CreateObject(ObjectCreateParams params);
|
||||
CObject* CreateObject(Math::Vector pos,
|
||||
float angle,
|
||||
ObjectType type,
|
||||
|
@ -142,7 +145,9 @@ public:
|
|||
bool trainer = false,
|
||||
bool toy = false,
|
||||
int option = 0,
|
||||
int team = 0,
|
||||
int id = -1);
|
||||
//@}
|
||||
|
||||
//! Deletes the object
|
||||
bool DeleteObject(CObject* instance);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "common/global.h"
|
||||
#include "common/make_unique.h"
|
||||
#include "common/restext.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "graphics/engine/lightman.h"
|
||||
#include "graphics/engine/lightning.h"
|
||||
|
@ -710,7 +711,7 @@ bool COldObject::ExplodeObject(ExplosionType type, float force, float decay)
|
|||
}
|
||||
m_main->RemoveFromSelectionHistory(this);
|
||||
|
||||
SetTeam(0); // Back to neutral on destruction
|
||||
m_team = 0; // Back to neutral on destruction
|
||||
|
||||
if ( m_botVar != 0 )
|
||||
{
|
||||
|
@ -2435,6 +2436,7 @@ bool COldObject::GetClip()
|
|||
|
||||
void COldObject::SetTeam(int team)
|
||||
{
|
||||
// NOTE: This shouldn't be called after the object is already created
|
||||
m_team = team;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "common/misc.h"
|
||||
#include "common/config_file.h"
|
||||
#include "common/restext.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include "common/resources/resourcemanager.h"
|
||||
#include "common/resources/inputstream.h"
|
||||
|
@ -2898,7 +2899,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_colorRefBot.g = 166.0f/256.0f;
|
||||
m_colorRefBot.b = 254.0f/256.0f; // blue
|
||||
m_colorRefBot.a = 0.0f;
|
||||
m_colorNewBot = m_colorRefBot;
|
||||
m_colorNewBot.clear();
|
||||
m_colorNewBot[0] = m_colorRefBot;
|
||||
|
||||
m_colorRefAlien.r = 135.0f/256.0f;
|
||||
m_colorRefAlien.g = 170.0f/256.0f;
|
||||
|
@ -3148,7 +3150,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetCommand() == "VehicleColor" && !resetObject)
|
||||
{
|
||||
m_colorNewBot = line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f));
|
||||
m_colorNewBot[line->GetParam("team")->AsInt(0)] = line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3436,6 +3438,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
InitEye();
|
||||
SetMovieLock(false);
|
||||
|
||||
if(!resetObject)
|
||||
ChangeColor(); // changes the colors of texture
|
||||
|
||||
if (read[0] != 0) // loading file ?
|
||||
sel = IOReadScene(read, stack);
|
||||
|
||||
|
@ -3493,7 +3498,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
CObject* obj = nullptr;
|
||||
try
|
||||
{
|
||||
obj = m_objMan->CreateObject(
|
||||
obj = m_objMan->CreateObject(
|
||||
pos, dirAngle,
|
||||
type,
|
||||
line->GetParam("power")->AsFloat(1.0f),
|
||||
|
@ -3501,7 +3506,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
line->GetParam("h")->AsFloat(0.0f),
|
||||
trainer = line->GetParam("trainer")->AsBool(false),
|
||||
line->GetParam("toy")->AsBool(false),
|
||||
line->GetParam("option")->AsInt(0)
|
||||
line->GetParam("option")->AsInt(0),
|
||||
line->GetParam("team")->AsInt(0)
|
||||
);
|
||||
}
|
||||
catch (const CObjectCreateException& e)
|
||||
|
@ -3578,7 +3584,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
oldObj->SetRange(line->GetParam("range")->AsFloat(30.0f));
|
||||
oldObj->SetShield(line->GetParam("shield")->AsFloat(1.0f));
|
||||
oldObj->SetMagnifyDamage(line->GetParam("magnifyDamage")->AsFloat(1.0f));
|
||||
oldObj->SetTeam(line->GetParam("team")->AsInt(0));
|
||||
oldObj->SetClip(line->GetParam("clip")->AsBool(true));
|
||||
oldObj->SetCheckToken(!line->GetParam("checkToken")->IsDefined() ? trainer || !selectable : line->GetParam("checkToken")->AsBool(true));
|
||||
// SetManual will affect bot speed
|
||||
|
@ -3908,7 +3913,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (!resetObject)
|
||||
{
|
||||
ChangeColor(); // changes the colors of texture
|
||||
m_short->SetMode(false); // vehicles?
|
||||
}
|
||||
|
||||
|
@ -4028,6 +4032,8 @@ void CRobotMain::ChangeColor()
|
|||
m_phase != PHASE_LOST &&
|
||||
m_phase != PHASE_APPERANCE ) return;
|
||||
|
||||
// Player texture
|
||||
|
||||
Math::Point ts = Math::Point(0.0f, 0.0f);
|
||||
Math::Point ti = Math::Point(1.0f, 1.0f); // the entire image
|
||||
|
||||
|
@ -4108,27 +4114,39 @@ void CRobotMain::ChangeColor()
|
|||
colorNew2.g = 0.0f;
|
||||
colorNew2.b = 0.0f;
|
||||
|
||||
m_engine->ChangeTextureColor("textures/objects/base1.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/convert.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/derrick.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/factory.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/lemt.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/roller.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/search.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
// VehicleColor
|
||||
|
||||
exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f);
|
||||
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils
|
||||
exclu[2] = Math::Point(0.0f, 0.0f);
|
||||
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
|
||||
m_engine->ChangeTextureColor("textures/objects/drawer.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
|
||||
for(auto it : m_colorNewBot)
|
||||
{
|
||||
int team = it.first;
|
||||
Gfx::Color newColor = it.second;
|
||||
std::string teamStr = StrUtils::ToString<int>(team);
|
||||
if(team == 0) teamStr = "";
|
||||
|
||||
exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f);
|
||||
exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister
|
||||
exclu[2] = Math::Point(106.0f/256.0f, 150.0f/256.0f);
|
||||
exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location
|
||||
exclu[4] = Math::Point(0.0f, 0.0f);
|
||||
exclu[5] = Math::Point(0.0f, 0.0f); // terminator
|
||||
m_engine->ChangeTextureColor("textures/objects/subm.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/base1.png"+teamStr, "textures/objects/base1.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/convert.png"+teamStr, "textures/objects/convert.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/derrick.png"+teamStr, "textures/objects/derrick.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/factory.png"+teamStr, "textures/objects/factory.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/lemt.png"+teamStr, "textures/objects/lemt.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/roller.png"+teamStr, "textures/objects/roller.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
m_engine->ChangeTextureColor("textures/objects/search.png"+teamStr, "textures/objects/search.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
|
||||
|
||||
exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f);
|
||||
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils
|
||||
exclu[2] = Math::Point(0.0f, 0.0f);
|
||||
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
|
||||
m_engine->ChangeTextureColor("textures/objects/drawer.png"+teamStr, "textures/objects/drawer.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
|
||||
|
||||
exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f);
|
||||
exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister
|
||||
exclu[2] = Math::Point(106.0f/256.0f, 150.0f/256.0f);
|
||||
exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location
|
||||
exclu[4] = Math::Point(0.0f, 0.0f);
|
||||
exclu[5] = Math::Point(0.0f, 0.0f); // terminator
|
||||
m_engine->ChangeTextureColor("textures/objects/subm.png"+teamStr, "textures/objects/subm.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
|
||||
}
|
||||
|
||||
// AlienColor
|
||||
|
||||
exclu[0] = Math::Point(128.0f/256.0f, 160.0f/256.0f);
|
||||
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom
|
||||
|
@ -4137,8 +4155,11 @@ void CRobotMain::ChangeColor()
|
|||
m_engine->ChangeTextureColor("textures/objects/ant.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu);
|
||||
m_engine->ChangeTextureColor("textures/objects/mother.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
|
||||
|
||||
// GreeneryColor
|
||||
m_engine->ChangeTextureColor("textures/objects/plant.png", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
|
||||
|
||||
// water color
|
||||
|
||||
// PARTIPLOUF0 and PARTIDROP :
|
||||
ts = Math::Point(0.500f, 0.500f);
|
||||
ti = Math::Point(0.875f, 0.750f);
|
||||
|
@ -4148,6 +4169,9 @@ void CRobotMain::ChangeColor()
|
|||
ts = Math::Point(0.00f, 0.75f);
|
||||
ti = Math::Point(0.25f, 1.00f);
|
||||
m_engine->ChangeTextureColor("textures/effect02.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true);
|
||||
|
||||
// This loads the newly recolored textures to objects
|
||||
m_engine->LoadAllTextures();
|
||||
}
|
||||
|
||||
//! Updates the number of unnecessary objects
|
||||
|
@ -6073,6 +6097,13 @@ const std::string& CRobotMain::GetTeamName(int id)
|
|||
return m_teamNames[id];
|
||||
}
|
||||
|
||||
bool CRobotMain::IsTeamColorDefined(int id)
|
||||
{
|
||||
if(id == 0) return false; // Always use default for team 0
|
||||
|
||||
return m_colorNewBot.find(id) != m_colorNewBot.end();
|
||||
}
|
||||
|
||||
|
||||
int CRobotMain::GetEnableBuild()
|
||||
{
|
||||
|
|
|
@ -328,6 +328,9 @@ public:
|
|||
//! Returns team name for the given team id
|
||||
const std::string& GetTeamName(int id);
|
||||
|
||||
//! Returns true if team-specific colored texture is available
|
||||
bool IsTeamColorDefined(int id);
|
||||
|
||||
//! Get/set enabled buildings
|
||||
//@{
|
||||
int GetEnableBuild();
|
||||
|
@ -568,7 +571,7 @@ protected:
|
|||
ShowLimit m_showLimit[MAXSHOWLIMIT];
|
||||
|
||||
Gfx::Color m_colorRefBot;
|
||||
Gfx::Color m_colorNewBot;
|
||||
std::map<int, Gfx::Color> m_colorNewBot;
|
||||
Gfx::Color m_colorRefAlien;
|
||||
Gfx::Color m_colorNewAlien;
|
||||
Gfx::Color m_colorRefGreen;
|
||||
|
|
|
@ -51,6 +51,8 @@ std::unique_ptr<CExchangePost> CExchangePost::Create(
|
|||
{
|
||||
auto obj = MakeUnique<CExchangePost>(params.id);
|
||||
|
||||
obj->SetTeam(params.team);
|
||||
|
||||
int rank = engine->CreateObject();
|
||||
engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
|
||||
obj->SetObjectRank(0, rank);
|
||||
|
|
|
@ -81,10 +81,14 @@ CTaskBuild::~CTaskBuild()
|
|||
|
||||
bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
|
||||
{
|
||||
float power = 0.0f;
|
||||
m_building = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type, power);
|
||||
ObjectCreateParams params;
|
||||
params.pos = pos;
|
||||
params.angle = angle;
|
||||
params.type = m_type;
|
||||
params.power = 0.0f;
|
||||
params.team = m_object->GetTeam();
|
||||
m_building = CObjectManager::GetInstancePointer()->CreateObject(params);
|
||||
m_building->SetLock(true); // not yet usable
|
||||
m_building->SetTeam(m_object->GetTeam());
|
||||
|
||||
if ( m_type == OBJECT_DERRICK ) m_buildingHeight = 35.0f;
|
||||
if ( m_type == OBJECT_FACTORY ) m_buildingHeight = 28.0f;
|
||||
|
@ -810,4 +814,3 @@ void CTaskBuild::DeleteMark(Math::Vector pos, float radius)
|
|||
CObjectManager::GetInstancePointer()->DeleteObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue