diff --git a/binaries/data/mods/official/art/actors/units/celt_isw_b.xml b/binaries/data/mods/official/art/actors/units/celt_isw_b.xml index c1a11d54df..d237b799b4 100644 --- a/binaries/data/mods/official/art/actors/units/celt_isw_b.xml +++ b/binaries/data/mods/official/art/actors/units/celt_isw_b.xml @@ -7,6 +7,7 @@ Celtic Basic Swordsman Infantry art/meshes/skeletal/m_pants_b.pmd art/textures/skins/skeletal/celt_isw_b.dds + art/materials/player_trans.xml Propped Dude art/meshes/skeletal/m_dress_a.pmd art/textures/skins/skeletal/plac_rome_e.dds + art/materials/player_trans.xml + + \ No newline at end of file diff --git a/binaries/data/mods/official/gui/test/2_mainmenu.xml b/binaries/data/mods/official/gui/test/2_mainmenu.xml index 749a2fb6a5..22948efc02 100755 --- a/binaries/data/mods/official/gui/test/2_mainmenu.xml +++ b/binaries/data/mods/official/gui/test/2_mainmenu.xml @@ -194,7 +194,7 @@ - ph.pmp + nm_playercolors.pmp diff --git a/binaries/data/mods/official/maps/scenarios/ph.pmp b/binaries/data/mods/official/maps/scenarios/ph.pmp index eea6a0bdb4..f5eee1219a 100644 --- a/binaries/data/mods/official/maps/scenarios/ph.pmp +++ b/binaries/data/mods/official/maps/scenarios/ph.pmp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd5ac58474b18d6303f7d3341e1d1c3d8c00b89b9c815c12c66edf04d7b8a2ae -size 455781 +oid sha256:36e295c55e0a26db747127fdd0dcf9436953e2a956b30d600699c460f06a583e +size 443203 diff --git a/binaries/data/mods/official/maps/scenarios/ph2.pmp b/binaries/data/mods/official/maps/scenarios/ph2.pmp index 98fc3bfedb..3383abe369 100644 --- a/binaries/data/mods/official/maps/scenarios/ph2.pmp +++ b/binaries/data/mods/official/maps/scenarios/ph2.pmp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e46227e6f014b9da29b0e85ad61393044e6b88adfc9050e5f6594eaaa2fc5e3 -size 445382 +oid sha256:b27aeb13ab1e90bf3a32cf68fe88d7fd531997074398cc78af81b1a032daf15b +size 445280 diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 87c9dba0c4..c17df4d7b7 100755 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -301,5 +301,4 @@ void CMapReader::ReadXML(const char* filename) debug_warn("Invalid XML data - DTD shouldn't allow this"); } } - } diff --git a/source/graphics/Material.cpp b/source/graphics/Material.cpp index 941a9b9de5..d33eaac652 100755 --- a/source/graphics/Material.cpp +++ b/source/graphics/Material.cpp @@ -32,7 +32,8 @@ CMaterial::CMaterial() m_Specular(IdentitySpecular), m_Emissive(IdentityEmissive), m_SpecularPower(0.0f), - m_Alpha(false) + m_Alpha(false), + m_bPlayer(false) { ComputeHash(); } @@ -55,6 +56,7 @@ void CMaterial::operator =(const CMaterial &material) m_SpecularPower = material.m_SpecularPower; m_Alpha = material.m_Alpha; + m_bPlayer = material.m_bPlayer; ComputeHash(); } @@ -67,7 +69,8 @@ bool CMaterial::operator ==(const CMaterial &material) m_Specular == material.m_Specular && m_Emissive == material.m_Emissive && m_SpecularPower == material.m_SpecularPower && - m_Alpha == material.m_Alpha + m_Alpha == material.m_Alpha && + m_bPlayer == material.m_bPlayer ); } @@ -160,6 +163,12 @@ void CMaterial::SetUsesAlpha(bool flag) ComputeHash(); } +void CMaterial::SetIsPlayer(bool flag) +{ + m_bPlayer = flag; + ComputeHash(); +} + void CMaterial::ComputeHash() { m_Hash = diff --git a/source/graphics/Material.h b/source/graphics/Material.h index 4afbdcb063..ef3850a6e9 100755 --- a/source/graphics/Material.h +++ b/source/graphics/Material.h @@ -61,7 +61,10 @@ public: SMaterialColor GetSpecular(); SMaterialColor GetEmissive(); float GetSpecularPower() { return m_SpecularPower; } + bool UsesAlpha() { return m_Alpha; } + // Determines whether or not the model goes into the PlayerRenderer + bool IsPlayer() { return m_bPlayer; } // John M. Mena void SetTexture(const CStr &texture); void SetVertexProgram(const CStr &prog); @@ -72,6 +75,9 @@ public: void SetEmissive(const SMaterialColor &color); void SetSpecularPower(float power); void SetUsesAlpha(bool flag); + // Sets the player flag which is used to + // place the model in the player renderer + void SetIsPlayer(bool flag); void operator =(const CMaterial &material); bool operator ==(const CMaterial &material); @@ -96,6 +102,9 @@ protected: // Alpha required flag bool m_Alpha; + + // Player required flag for PlayerRenderer : John M. Mena + bool m_bPlayer; }; extern CMaterial NullMaterial; diff --git a/source/graphics/MaterialManager.cpp b/source/graphics/MaterialManager.cpp index 464974daa7..dc87460075 100755 --- a/source/graphics/MaterialManager.cpp +++ b/source/graphics/MaterialManager.cpp @@ -252,7 +252,12 @@ CMaterial &CMaterialManager::LoadMaterial(const char *file) else if(token == el_alpha) { temp = (CStr)attrs.getNamedItem(at_usage); - material->SetUsesAlpha(ParseUsage(temp)); + + // Determine whether the alpha is used for basic transparency or player color + if (temp == CStr("playercolor")) + material->SetIsPlayer(true); + else + material->SetUsesAlpha(ParseUsage(temp)); } } diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp index 8e783647e6..52d6eea6fa 100755 --- a/source/graphics/Model.cpp +++ b/source/graphics/Model.cpp @@ -21,7 +21,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // Constructor CModel::CModel() - : m_Flags(0), m_PlayerID(-1), m_Anim(0), m_AnimTime(0), + : m_Flags(0), m_PlayerID(3), m_Anim(0), m_AnimTime(0), m_BoneMatrices(0), m_InvBoneMatrices(0), m_BoneMatricesValid(false) { } diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index c87e7e20dd..0abd688cd6 100755 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -2,12 +2,21 @@ #include "gui/MiniMap.h" #include "ps/Game.h" +#include "CConsole.h" #include "ogl.h" #include "renderer/Renderer.h" #include "graphics/TextureEntry.h" #include "graphics/TextureManager.h" #include "graphics/Unit.h" +#include "graphics/Camera.h" + + +#include "Bound.h" +#include "Model.h" + +extern CConsole* g_Console; +extern int g_mouse_x, g_mouse_y; static unsigned int ScaleColor(unsigned int color,float x) { @@ -81,7 +90,7 @@ void CMiniMap::Draw() glDisable(GL_DEPTH_TEST); glEnable(GL_POINT_SMOOTH); glDisable(GL_TEXTURE_2D); - glPointSize(2.5f); + glPointSize(3.0f); // REMOVED: glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_POINTS); for(; iter != units.end(); iter++) @@ -101,8 +110,34 @@ void CMiniMap::Draw() glVertex3f(x + pos.y, y + pos.x, GetBufferedZ()); } } + glEnd(); + + + // render view rect : John M. Mena + CCamera &g_Camera=*g_Game->GetView()->GetCamera(); + CVector3D pos3D = g_Camera.GetWorldCoordinates(); + pos = GetMapSpaceCoords(pos3D); + + // Restrict the drawing to the map + glScissor((int)m_CachedActualSize.left, 0, (int)m_CachedActualSize.right, (int)m_CachedActualSize.GetHeight()); + glEnable(GL_SCISSOR_TEST); + + glLineWidth(2); + glColor3f(1.0f,0.3f,0.3f); + + // Draw the viewing rectangle + glBegin(GL_LINE_LOOP); + glVertex2f(x + pos.y - 10, y + pos.x - 10); + glVertex2f(x + pos.y + 10, y + pos.x - 10); + glVertex2f(x + pos.y + 10, y + pos.x + 10); + glVertex2f(x + pos.y - 10, y + pos.x + 10); + glEnd(); + + glDisable(GL_SCISSOR_TEST); + glPointSize(1.0f); + glLineWidth(1.0f); glEnable(GL_TEXTURE_2D); glDisable(GL_POINT_SMOOTH); glEnable(GL_DEPTH_TEST); diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index 58de7f2a7f..76dbd2e6e0 100755 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -87,33 +87,36 @@ CGameAttributes::CGameAttributes(): AddProperty(L"players", (GetFn)&CGameAttributes::JSGetPlayers); - m_Players.resize(8); - for (int i=0;i<8;i++) + m_Players.resize(9); + for (int i=0;i<9;i++) m_Players[i]=new CPlayer(i); m_Players[0]->SetName(L"Gaia"); - m_Players[0]->SetColour(SPlayerColour(1.0f, 0.0f, 0.0f)); + m_Players[0]->SetColour(SPlayerColour(1.0f, 1.0f, 1.0f)); - m_Players[1]->SetName(L"Acumen"); - m_Players[1]->SetColour(SPlayerColour(0.0f, 1.0f, 0.0f)); + m_Players[1]->SetName(L"Sally Jessie Rapheal"); + m_Players[1]->SetColour(SPlayerColour(1.0f, 0.0f, 0.0f)); - m_Players[2]->SetName(L"Boco the Insignificant"); - m_Players[2]->SetColour(SPlayerColour(0.0f, 0.0f, 1.0f)); + m_Players[2]->SetName(L"Acumen"); + m_Players[2]->SetColour(SPlayerColour(0.0f, 1.0f, 0.0f)); - m_Players[3]->SetName(L"NoMonkey the Magnificent"); - m_Players[3]->SetColour(SPlayerColour(1.0f, 1.0f, 0.0f)); + m_Players[3]->SetName(L"Boco the Insignificant"); + m_Players[3]->SetColour(SPlayerColour(0.0f, 0.0f, 1.0f)); - m_Players[4]->SetName(L"Wijit"); - m_Players[4]->SetColour(SPlayerColour(1.0f, 0.0f, 1.0f)); + m_Players[4]->SetName(L"NoMonkey the Magnificent"); + m_Players[4]->SetColour(SPlayerColour(1.0f, 1.0f, 0.0f)); - m_Players[5]->SetName(L"Ykkrosh"); - m_Players[5]->SetColour(SPlayerColour(0.0f, 1.0f, 1.0f)); + m_Players[5]->SetName(L"Wijit"); + m_Players[5]->SetColour(SPlayerColour(1.0f, 0.0f, 1.0f)); - m_Players[6]->SetName(L"Code Monkey"); - m_Players[6]->SetColour(SPlayerColour(1.0f, 0.5f, 1.0f)); + m_Players[6]->SetName(L"Ykkrosh"); + m_Players[6]->SetColour(SPlayerColour(0.0f, 1.0f, 1.0f)); - m_Players[7]->SetName(L"Ykkrosh"); - m_Players[7]->SetColour(SPlayerColour(1.0f, 0.8f, 0.5f)); + m_Players[7]->SetName(L"Code Monkey"); + m_Players[7]->SetColour(SPlayerColour(1.0f, 0.5f, 1.0f)); + + m_Players[8]->SetName(L"Ykkrosh"); + m_Players[8]->SetColour(SPlayerColour(1.0f, 0.8f, 0.5f)); } CGameAttributes::~CGameAttributes() diff --git a/source/renderer/ModelRData.cpp b/source/renderer/ModelRData.cpp index a5653661c0..bb73c4bb10 100755 --- a/source/renderer/ModelRData.cpp +++ b/source/renderer/ModelRData.cpp @@ -50,10 +50,14 @@ void CModelRData::Build() /*if (g_Renderer.IsTextureTransparent(m_Model->GetTexture())) { m_Flags|=MODELRDATA_FLAG_TRANSPARENT; }*/ - if(m_Model->GetPlayerID() + 1) // Add one because the default value is -1 + if(m_Model->GetMaterial().IsPlayer()) + { m_Flags |= MODELRDATA_FLAG_PLAYERCOLOR; + } else if(m_Model->GetMaterial().UsesAlpha()) + { m_Flags |= MODELRDATA_FLAG_TRANSPARENT; + } } void CModelRData::BuildIndices()