world editor defines removed

This commit is contained in:
d1str4ught
2025-08-28 21:03:15 +02:00
parent b66e045d80
commit f791ab6d8c
21 changed files with 12 additions and 688 deletions

View File

@@ -80,11 +80,7 @@ void CEffectInstance::OnUpdate()
{ {
Transform(); Transform();
#ifdef WORLD_EDITOR
FEffectUpdator f(CTimer::Instance().GetElapsedSecond());
#else
FEffectUpdator f(CTimer::Instance().GetCurrentSecond()-m_fLastTime); FEffectUpdator f(CTimer::Instance().GetCurrentSecond()-m_fLastTime);
#endif
f = std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(),f); f = std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(),f);
f = std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(),f); f = std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(),f);
f = std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(),f); f = std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(),f);

View File

@@ -155,7 +155,7 @@ void CParticleInstance::UpdateColor(float time, float elapsedTime)
if (m_pParticleProperty->m_TimeEventColor.empty()) if (m_pParticleProperty->m_TimeEventColor.empty())
return; return;
m_dcColor = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor); m_Color = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor);
} }
void CParticleInstance::UpdateGravity(float time, float elapsedTime) void CParticleInstance::UpdateGravity(float time, float elapsedTime)
@@ -179,13 +179,7 @@ void CParticleInstance::UpdateAirResistance(float time, float elapsedTime)
void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal) void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal)
{ {
#ifdef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color); STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
#else
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_dcColor);
#endif
/////
D3DXVECTOR3 v3Up; D3DXVECTOR3 v3Up;
D3DXVECTOR3 v3Cross; D3DXVECTOR3 v3Cross;
@@ -336,13 +330,7 @@ void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal)
void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation) void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation)
{ {
#ifdef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color); STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
#else
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, (DWORD)m_dcColor);
#endif
/////
D3DXVECTOR3 v3Up; D3DXVECTOR3 v3Up;
D3DXVECTOR3 v3Cross; D3DXVECTOR3 v3Cross;
@@ -500,11 +488,7 @@ void CParticleInstance::__Initialize()
m_v3Velocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f); m_v3Velocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_v2Scale = D3DXVECTOR2(1.0f, 1.0f); m_v2Scale = D3DXVECTOR2(1.0f, 1.0f);
#ifdef WORLD_EDITOR
m_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); m_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
#else
m_dcColor.m_dwColor = 0xffffffff;
#endif
m_byFrameIndex = 0; m_byFrameIndex = 0;
m_rotationType = CParticleProperty::ROTATION_TYPE_NONE; m_rotationType = CParticleProperty::ROTATION_TYPE_NONE;

View File

@@ -38,11 +38,7 @@ class CParticleInstance
D3DXVECTOR2 m_v2Scale; D3DXVECTOR2 m_v2Scale;
float m_fRotation; float m_fRotation;
#ifdef WORLD_EDITOR
D3DXCOLOR m_Color; D3DXCOLOR m_Color;
#else
DWORDCOLOR m_dcColor;
#endif
BYTE m_byTextureAnimationType; BYTE m_byTextureAnimationType;
float m_fLastFrameTime; float m_fLastFrameTime;

View File

@@ -5,11 +5,7 @@
void CParticleProperty::InsertTexture(const char * c_szFileName) void CParticleProperty::InsertTexture(const char * c_szFileName)
{ {
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(c_szFileName); CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(c_szFileName);
m_ImageVector.push_back(pImage); m_ImageVector.push_back(pImage);
#ifdef WORLD_EDITOR
m_TextureNameVector.push_back(c_szFileName);
#endif
} }
bool CParticleProperty::SetTexture(const char * c_szFileName) bool CParticleProperty::SetTexture(const char * c_szFileName)
@@ -20,9 +16,6 @@ bool CParticleProperty::SetTexture(const char * c_szFileName)
return false; return false;
} }
m_ImageVector.clear(); m_ImageVector.clear();
#ifdef WORLD_EDITOR
m_TextureNameVector.clear();
#endif
InsertTexture(c_szFileName); InsertTexture(c_szFileName);
return true; return true;
} }
@@ -56,15 +49,7 @@ void CParticleProperty::Clear()
m_TimeEventScaleX.clear(); m_TimeEventScaleX.clear();
m_TimeEventScaleY.clear(); m_TimeEventScaleY.clear();
//m_TimeEventScaleXY.clear(); //m_TimeEventScaleXY.clear();
#ifdef WORLD_EDITOR
m_TimeEventColorRed.clear();
m_TimeEventColorGreen.clear();
m_TimeEventColorBlue.clear();
m_TimeEventAlpha.clear();
m_TextureNameVector.clear();
#else
m_TimeEventColor.clear(); m_TimeEventColor.clear();
#endif
m_TimeEventRotation.clear(); m_TimeEventRotation.clear();
m_ImageVector.clear(); m_ImageVector.clear();
@@ -103,16 +88,7 @@ CParticleProperty & CParticleProperty::operator = ( const CParticleProperty& c_P
m_TimeEventScaleX = c_ParticleProperty.m_TimeEventScaleX; m_TimeEventScaleX = c_ParticleProperty.m_TimeEventScaleX;
m_TimeEventScaleY = c_ParticleProperty.m_TimeEventScaleY; m_TimeEventScaleY = c_ParticleProperty.m_TimeEventScaleY;
#ifdef WORLD_EDITOR
m_TimeEventColorRed = c_ParticleProperty.m_TimeEventColorRed;
m_TimeEventColorGreen = c_ParticleProperty.m_TimeEventColorGreen;
m_TimeEventColorBlue = c_ParticleProperty.m_TimeEventColorBlue;
m_TimeEventAlpha = c_ParticleProperty.m_TimeEventAlpha;
m_TextureNameVector = c_ParticleProperty.m_TextureNameVector;
#else
m_TimeEventColor = c_ParticleProperty.m_TimeEventColor; m_TimeEventColor = c_ParticleProperty.m_TimeEventColor;
#endif
m_TimeEventRotation = c_ParticleProperty.m_TimeEventRotation; m_TimeEventRotation = c_ParticleProperty.m_TimeEventRotation;
m_ImageVector = c_ParticleProperty.m_ImageVector; m_ImageVector = c_ParticleProperty.m_ImageVector;

View File

@@ -75,16 +75,7 @@ class CParticleProperty
TTimeEventTableFloat m_TimeEventScaleX; TTimeEventTableFloat m_TimeEventScaleX;
TTimeEventTableFloat m_TimeEventScaleY; TTimeEventTableFloat m_TimeEventScaleY;
#ifdef WORLD_EDITOR
TTimeEventTableFloat m_TimeEventColorRed;
TTimeEventTableFloat m_TimeEventColorGreen;
TTimeEventTableFloat m_TimeEventColorBlue;
TTimeEventTableFloat m_TimeEventAlpha;
std::vector<std::string> m_TextureNameVector;
#else
TTimeEventTableColor m_TimeEventColor; TTimeEventTableColor m_TimeEventColor;
#endif
TTimeEventTableFloat m_TimeEventRotation; TTimeEventTableFloat m_TimeEventRotation;
std::vector<CGraphicImage*> m_ImageVector; std::vector<CGraphicImage*> m_ImageVector;

View File

@@ -210,17 +210,6 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscaley", &m_ParticleProperty.m_TimeEventScaleY)) if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscaley", &m_ParticleProperty.m_TimeEventScaleY))
return FALSE; return FALSE;
#ifdef WORLD_EDITOR
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorred", &m_ParticleProperty.m_TimeEventColorRed))
return FALSE;
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorgreen", &m_ParticleProperty.m_TimeEventColorGreen))
return FALSE;
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorblue", &m_ParticleProperty.m_TimeEventColorBlue))
return FALSE;
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &m_ParticleProperty.m_TimeEventAlpha))
return FALSE;
#else
TTimeEventTableFloat TimeEventR; TTimeEventTableFloat TimeEventR;
TTimeEventTableFloat TimeEventB; TTimeEventTableFloat TimeEventB;
TTimeEventTableFloat TimeEventG; TTimeEventTableFloat TimeEventG;
@@ -257,16 +246,13 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
fA = GetTimeEventBlendValue(fTime, TimeEventA); fA = GetTimeEventBlendValue(fTime, TimeEventA);
TTimeEventTypeColor t; TTimeEventTypeColor t;
t.m_fTime = fTime; t.m_fTime = fTime;
D3DXCOLOR c; t.m_Value.r = fR;
c.r = fR; t.m_Value.g = fG;
c.g = fG; t.m_Value.b = fB;
c.b = fB; t.m_Value.a = fA;
c.a = fA;
t.m_Value.m_dwColor = /*(DWORD)*/ (DWORD)c;
m_ParticleProperty.m_TimeEventColor.push_back(t); m_ParticleProperty.m_TimeEventColor.push_back(t);
} }
} }
#endif
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation)) if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation))
return FALSE; return FALSE;

View File

@@ -248,14 +248,7 @@ void CParticleSystemInstance::CreateParticles(float fElapsedTime)
pInstance->m_v2Scale.x = m_pParticleProperty->m_TimeEventScaleX.front().m_Value; pInstance->m_v2Scale.x = m_pParticleProperty->m_TimeEventScaleX.front().m_Value;
pInstance->m_v2Scale.y= m_pParticleProperty->m_TimeEventScaleY.front().m_Value; pInstance->m_v2Scale.y= m_pParticleProperty->m_TimeEventScaleY.front().m_Value;
//pInstance->m_v2Scale = m_pParticleProperty->m_TimeEventScaleXY.front().m_Value; //pInstance->m_v2Scale = m_pParticleProperty->m_TimeEventScaleXY.front().m_Value;
#ifdef WORLD_EDITOR pInstance->m_Color = m_pParticleProperty->m_TimeEventColor.front().m_Value;
pInstance->m_Color.r = m_pParticleProperty->m_TimeEventColorRed.front().m_Value;
pInstance->m_Color.g = m_pParticleProperty->m_TimeEventColorGreen.front().m_Value;
pInstance->m_Color.b = m_pParticleProperty->m_TimeEventColorBlue.front().m_Value;
pInstance->m_Color.a = m_pParticleProperty->m_TimeEventAlpha.front().m_Value;
#else
pInstance->m_dcColor = m_pParticleProperty->m_TimeEventColor.front().m_Value;
#endif
} }
m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance); m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance);

View File

@@ -123,74 +123,12 @@ typedef struct SEffectPosition : public CTimeEvent<D3DXVECTOR3>
D3DXVECTOR3 m_vecControlPoint; D3DXVECTOR3 m_vecControlPoint;
} TEffectPosition; } TEffectPosition;
#define AG_MASK 0xff00ff00
#define RB_MASK 0x00ff00ff
struct DWORDCOLOR
{
DWORD m_dwColor;
DWORDCOLOR()
{
}
DWORDCOLOR(const DWORDCOLOR& r)
: m_dwColor(r.m_dwColor)
{
}
DWORDCOLOR(DWORD dwColor)
: m_dwColor(dwColor)
{
}
DWORDCOLOR& operator = (const DWORDCOLOR& r)
{
m_dwColor = r.m_dwColor;
return *this;
}
DWORDCOLOR& operator *= (float f)
{
DWORD idx = DWORD(f * 256);
m_dwColor =
(((DWORD)(((m_dwColor & AG_MASK) >> 8) * idx)) & AG_MASK)
+ ((DWORD)(((m_dwColor & RB_MASK) * idx) >> 8) & RB_MASK);
return *this;
}
DWORDCOLOR& operator += (const DWORDCOLOR& r)
{
m_dwColor += r.m_dwColor;
return *this;
}
operator DWORD()
{
return m_dwColor;
}
};
#undef AG_MASK
#undef RB_MASK
inline DWORDCOLOR operator * (DWORDCOLOR dc, float f)
{
DWORDCOLOR tmp(dc);
tmp *= f;
return tmp;
}
inline DWORDCOLOR operator * (float f, DWORDCOLOR dc)
{
DWORDCOLOR tmp(dc);
tmp *= f;
return tmp;
}
typedef CTimeEvent<char> TTimeEventTypeCharacter; typedef CTimeEvent<char> TTimeEventTypeCharacter;
typedef CTimeEvent<short> TTimeEventTypeShort; typedef CTimeEvent<short> TTimeEventTypeShort;
typedef CTimeEvent<float> TTimeEventTypeFloat; typedef CTimeEvent<float> TTimeEventTypeFloat;
typedef CTimeEvent<WORD> TTimeEventTypeWord; typedef CTimeEvent<WORD> TTimeEventTypeWord;
typedef CTimeEvent<DWORD> TTimeEventTypeDoubleWord; typedef CTimeEvent<DWORD> TTimeEventTypeDoubleWord;
typedef CTimeEvent<DWORDCOLOR> TTimeEventTypeColor; typedef CTimeEvent<D3DXCOLOR> TTimeEventTypeColor;
typedef CTimeEvent<D3DXVECTOR2> TTimeEventTypeVector2; typedef CTimeEvent<D3DXVECTOR2> TTimeEventTypeVector2;
typedef CTimeEvent<D3DXVECTOR3> TTimeEventTypeVector3; typedef CTimeEvent<D3DXVECTOR3> TTimeEventTypeVector3;
@@ -238,14 +176,6 @@ inline D3DXVECTOR3 BlendSingleValue(float time, const TEffectPosition& low, cons
return D3DXVECTOR3(); return D3DXVECTOR3();
} }
inline DWORDCOLOR BlendSingleValue(float time, const TTimeEventTypeColor& low, const TTimeEventTypeColor& high)
{
const float timeDiff = high.m_fTime - low.m_fTime;
const float perc = (time - low.m_fTime) / timeDiff;
return low.m_Value * (1.0f - perc) + high.m_Value * perc;
}
template <typename T> template <typename T>
auto GetTimeEventBlendValue(float time, auto GetTimeEventBlendValue(float time,
const std::vector<T>& vec) -> typename T::value_type const std::vector<T>& vec) -> typename T::value_type

View File

@@ -400,9 +400,6 @@ void CScreen::RenderTextureBox(float sx, float sy, float ex, float ey, float z,
vertices[3].diffuse = ms_diffuseColor; vertices[3].diffuse = ms_diffuseColor;
vertices[3].texCoord = TTextureCoordinate(eu, ev); vertices[3].texCoord = TTextureCoordinate(eu, ev);
#ifdef WORLD_EDITOR
STATEMANAGER.SetTransform(D3DTS_WORLD, ms_lpd3dMatStack->GetTop());
#endif
STATEMANAGER.SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1); STATEMANAGER.SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
// 2004.11.18.myevan.DrawIndexPrimitiveUP -> DynamicVertexBuffer // 2004.11.18.myevan.DrawIndexPrimitiveUP -> DynamicVertexBuffer

View File

@@ -74,9 +74,7 @@ void CActorInstance::MotionEventProcess(DWORD dwcurFrame, int iIndex, const CRac
break; break;
case CRaceMotionData::MOTION_EVENT_TYPE_WARP: case CRaceMotionData::MOTION_EVENT_TYPE_WARP:
#ifndef WORLD_EDITOR
ProcessMotionEventWarp(c_pData); ProcessMotionEventWarp(c_pData);
#endif
break; break;
} }
} }

View File

@@ -335,47 +335,12 @@ void CArea::RenderDungeon()
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_CURRENT); STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_MODULATE); STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
#ifdef WORLD_EDITOR
bool bRenderTransparent = false;
DWORD oldAlphaBlendState = 0;
DWORD oldZWriteenableState = 0;
if (GetAsyncKeyState(VK_LSHIFT) & 0x8001)
{
bRenderTransparent = true;
oldAlphaBlendState = STATEMANAGER.GetRenderState(D3DRS_ALPHABLENDENABLE);
oldZWriteenableState = STATEMANAGER.GetRenderState(D3DRS_ZWRITEENABLE);
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
STATEMANAGER.SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_TFACTOR);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( 128, 255, 0, 0) );
}
#endif
TDungeonBlockInstanceVector::iterator itor = m_DungeonBlockCloneInstanceVector.begin(); TDungeonBlockInstanceVector::iterator itor = m_DungeonBlockCloneInstanceVector.begin();
for (; itor != m_DungeonBlockCloneInstanceVector.end(); ++itor) for (; itor != m_DungeonBlockCloneInstanceVector.end(); ++itor)
{ {
(*itor)->Render(); (*itor)->Render();
} }
#ifdef WORLD_EDITOR
if (bRenderTransparent)
{
STATEMANAGER.SetRenderState(D3DRS_ZWRITEENABLE, oldZWriteenableState);
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, oldAlphaBlendState);
}
#endif
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE); STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE); STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
} }

View File

@@ -116,13 +116,9 @@ bool CMapOutdoor::Initialize()
m_lCenterX = m_lCenterY = 0; m_lCenterX = m_lCenterY = 0;
m_lOldReadX = m_lOldReadY = -1; m_lOldReadX = m_lOldReadY = -1;
#ifdef WORLD_EDITOR
m_pwIndices = NULL;
#else
memset(m_pwaIndices, 0, sizeof(m_pwaIndices)); memset(m_pwaIndices, 0, sizeof(m_pwaIndices));
for (i = 0; i < TERRAINPATCH_LODMAX; ++i) for (i = 0; i < TERRAINPATCH_LODMAX; ++i)
m_IndexBuffer[i].Destroy(); m_IndexBuffer[i].Destroy();
#endif
m_bSettingTerrainVisible = false; m_bSettingTerrainVisible = false;
m_bDrawWireFrame = false; m_bDrawWireFrame = false;
@@ -374,12 +370,8 @@ void CMapOutdoor::DestroyTerrainPatchProxyList()
m_pTerrainPatchProxyList = NULL; m_pTerrainPatchProxyList = NULL;
} }
#ifdef WORLD_EDITOR
m_IndexBuffer.Destroy();
#else
for (int i = 0; i < TERRAINPATCH_LODMAX; ++i) for (int i = 0; i < TERRAINPATCH_LODMAX; ++i)
m_IndexBuffer[i].Destroy(); m_IndexBuffer[i].Destroy();
#endif
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@@ -201,17 +201,11 @@ class CMapOutdoor : public CMapBase
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Index Buffer // Index Buffer
#ifdef WORLD_EDITOR
WORD * m_pwIndices; /* temp Index buffer */
CGraphicIndexBuffer m_IndexBuffer;
WORD m_wNumIndices;
#else
WORD * m_pwaIndices[TERRAINPATCH_LODMAX]; WORD * m_pwaIndices[TERRAINPATCH_LODMAX];
CGraphicIndexBuffer m_IndexBuffer[TERRAINPATCH_LODMAX]; CGraphicIndexBuffer m_IndexBuffer[TERRAINPATCH_LODMAX];
WORD m_wNumIndices[TERRAINPATCH_LODMAX]; WORD m_wNumIndices[TERRAINPATCH_LODMAX];
#endif
virtual void DestroyTerrain(); virtual void DestroyTerrain();
void CreateTerrainPatchProxyList(); void CreateTerrainPatchProxyList();
@@ -269,9 +263,6 @@ class CMapOutdoor : public CMapBase
virtual void DestroyArea(); virtual void DestroyArea();
void __UpdateArea(D3DXVECTOR3& v3Player); void __UpdateArea(D3DXVECTOR3& v3Player);
#ifdef WORLD_EDITOR
void __NEW_WorldEditor_UpdateArea();
#endif
void __Game_UpdateArea(D3DXVECTOR3& v3Player); void __Game_UpdateArea(D3DXVECTOR3& v3Player);
void __BuildDynamicSphereInstanceVector(); void __BuildDynamicSphereInstanceVector();

View File

@@ -7,69 +7,6 @@ void CMapOutdoor::SetIndexBuffer()
long x, y; long x, y;
DWORD dwIndexNum = TERRAIN_PATCHSIZE * TERRAIN_PATCHSIZE * 4; DWORD dwIndexNum = TERRAIN_PATCHSIZE * TERRAIN_PATCHSIZE * 4;
#ifdef WORLD_EDITOR
m_pwIndices = new WORD[dwIndexNum];
if (!m_pwIndices)
TraceError("CMapOutdoor::SetIndexBuffer() IndexBuffer is NULL");
memset(m_pwIndices, 0, sizeof(WORD) * dwIndexNum);
if (!m_IndexBuffer.Create(dwIndexNum, D3DFMT_INDEX16))
TraceError("CMapOutdoor::SetIndexBuffer() IndexBuffer Create Error");
WORD count = 0;
WORD count2 = 0;
long ry = 0;
BYTE ucNumLineWarp = TERRAIN_PATCHSIZE + 1;
for (y = 0; y < TERRAIN_PATCHSIZE; y++)
{
if (ry % 2 == 0)
{
m_pwIndices[count++] = count2;
m_pwIndices[count++] = count2+ucNumLineWarp;
}
else
{
m_pwIndices[count++] = count2+ucNumLineWarp;
m_pwIndices[count++] = count2;
}
for (x = 0; x < TERRAIN_PATCHSIZE; x++)
{
if (ry % 2 == 1)
{
m_pwIndices[count++] = (WORD) (count2+ucNumLineWarp-1);
m_pwIndices[count++] = (WORD) (count2-1);
count2 -= (short) 1;
}
else
{
m_pwIndices[count++] = (WORD) (count2+1);
m_pwIndices[count++] = (WORD) (count2+ucNumLineWarp+1);
count2 += (short) 1;
}
}
if (y < TERRAIN_PATCHSIZE-1)
{
m_pwIndices[count++] = (WORD) (count2+ucNumLineWarp);
m_pwIndices[count++] = (WORD) (count2+ucNumLineWarp);
count2 += ucNumLineWarp;
}
ry++;
}
m_wNumIndices = count;
if (!m_IndexBuffer.Lock((void **) &pIndices))
TraceError("CMapOutdoor::SetIndexBuffer() IndexBuffer Unlock Error");
memcpy(pIndices, m_pwIndices, count * sizeof(WORD));
m_IndexBuffer.Unlock();
delete [] m_pwIndices;
m_pwIndices = NULL;
#else
WORD count[TERRAINPATCH_LODMAX], count2[TERRAINPATCH_LODMAX]; WORD count[TERRAINPATCH_LODMAX], count2[TERRAINPATCH_LODMAX];
BYTE uci; BYTE uci;
for (uci = 0; uci < TERRAINPATCH_LODMAX; ++uci) for (uci = 0; uci < TERRAINPATCH_LODMAX; ++uci)
@@ -199,7 +136,6 @@ void CMapOutdoor::SetIndexBuffer()
delete [] m_pwaIndices[uci]; delete [] m_pwaIndices[uci];
m_pwaIndices[uci] = NULL; m_pwaIndices[uci] = NULL;
} }
#endif
} }
void CMapOutdoor::ADDLvl1TL(WORD * pIndices, WORD & rwCount, const WORD & c_rwCurCount, const BYTE & c_rucNumLineWarp) void CMapOutdoor::ADDLvl1TL(WORD * pIndices, WORD & rwCount, const WORD & c_rwCurCount, const BYTE & c_rucNumLineWarp)

View File

@@ -26,11 +26,6 @@ bool CMapOutdoor::Load(float x, float y, float z)
if (!LoadSetting(strFileName.c_str())) if (!LoadSetting(strFileName.c_str()))
TraceError("CMapOutdoor::Load : LoadSetting(%s) Failed", strFileName.c_str()); TraceError("CMapOutdoor::Load : LoadSetting(%s) Failed", strFileName.c_str());
#ifdef WORLD_EDITOR
if (!LoadMonsterAreaInfo())
TraceError("CMapOutdoor::Load - LoadMonsterAreaInfo ERROR");
#endif
CreateTerrainPatchProxyList(); CreateTerrainPatchProxyList();
BuildQuadTree(); BuildQuadTree();
LoadWaterTexture(); LoadWaterTexture();
@@ -367,10 +362,6 @@ bool CMapOutdoor::LoadSetting(const char * c_szFileName)
m_lViewRadius = atol(c_rstrViewRadius.c_str()); m_lViewRadius = atol(c_rstrViewRadius.c_str());
#ifdef WORLD_EDITOR
m_lViewRadius <<= 1;
#endif
if (0L >= m_lViewRadius) if (0L >= m_lViewRadius)
{ {
TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - VIEWRADIUS IS NOT GREATER THAN 0", c_szFileName); TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - VIEWRADIUS IS NOT GREATER THAN 0", c_szFileName);
@@ -398,13 +389,8 @@ bool CMapOutdoor::LoadSetting(const char * c_szFileName)
if (!m_TextureSet.Load(stTextureSetFileName.c_str(), m_fTerrainTexCoordBase)) if (!m_TextureSet.Load(stTextureSetFileName.c_str(), m_fTerrainTexCoordBase))
{ {
#ifdef WORLD_EDITOR
// TextureSet 이 적용되어 있지 않아도 진행
LogBox("TextureSet 이 적용되어있지 않은 맵 입니다.\n지형 텍스춰 작업에 주의하시기 바랍니다.");
#else
TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - LOAD TEXTURE SET(%s) ERROR", c_szFileName, stTextureSetFileName.c_str()); TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - LOAD TEXTURE SET(%s) ERROR", c_szFileName, stTextureSetFileName.c_str());
return false; return false;
#endif
} }
CTerrain::SetTextureSet(&m_TextureSet); CTerrain::SetTextureSet(&m_TextureSet);

View File

@@ -401,7 +401,6 @@ void CMapOutdoor::RenderArea(bool bRenderAmbience)
} }
} }
#ifndef WORLD_EDITOR
// PCBlocker // PCBlocker
std::for_each(m_PCBlockerVector.begin(), m_PCBlockerVector.end(), FPCBlockerHide()); std::for_each(m_PCBlockerVector.begin(), m_PCBlockerVector.end(), FPCBlockerHide());
@@ -443,7 +442,6 @@ void CMapOutdoor::RenderArea(bool bRenderAmbience)
if (mc_pEnvironmentData != NULL) if (mc_pEnvironmentData != NULL)
STATEMANAGER.SetRenderState(D3DRS_FOGCOLOR, mc_pEnvironmentData->FogColor); STATEMANAGER.SetRenderState(D3DRS_FOGCOLOR, mc_pEnvironmentData->FogColor);
} }
#endif
STATEMANAGER.SaveRenderState(D3DRS_ZWRITEENABLE, TRUE); STATEMANAGER.SaveRenderState(D3DRS_ZWRITEENABLE, TRUE);
@@ -484,10 +482,6 @@ void CMapOutdoor::RenderArea(bool bRenderAmbience)
rCRCWithNumber.dwNumber += 1; rCRCWithNumber.dwNumber += 1;
} }
} }
#ifdef WORLD_EDITOR
if (bRenderAmbience)
pArea->RenderAmbience();
#endif
} }
} }
@@ -504,10 +498,6 @@ void CMapOutdoor::RenderArea(bool bRenderAmbience)
if (GetAreaPointer(i, &pArea)) if (GetAreaPointer(i, &pArea))
{ {
pArea->CollectRenderingObject(s_kVct_pkOpaqueThingInstSort); pArea->CollectRenderingObject(s_kVct_pkOpaqueThingInstSort);
#ifdef WORLD_EDITOR
if (bRenderAmbience)
pArea->RenderAmbience();
#endif
} }
} }
@@ -518,13 +508,11 @@ void CMapOutdoor::RenderArea(bool bRenderAmbience)
STATEMANAGER.RestoreRenderState(D3DRS_ZWRITEENABLE); STATEMANAGER.RestoreRenderState(D3DRS_ZWRITEENABLE);
#ifndef WORLD_EDITOR
// Shadow Receiver // Shadow Receiver
if (m_bDrawShadow && m_bDrawChrShadow) if (m_bDrawShadow && m_bDrawChrShadow)
{ {
std::for_each(m_ShadowReceiverVector.begin(), m_ShadowReceiverVector.end(), std::mem_fn(&CGraphicObjectInstance::Show)); std::for_each(m_ShadowReceiverVector.begin(), m_ShadowReceiverVector.end(), std::mem_fn(&CGraphicObjectInstance::Show));
} }
#endif
} }
void CMapOutdoor::RenderBlendArea() void CMapOutdoor::RenderBlendArea()
@@ -614,7 +602,6 @@ void CMapOutdoor::RenderDungeon()
void CMapOutdoor::RenderPCBlocker() void CMapOutdoor::RenderPCBlocker()
{ {
#ifndef WORLD_EDITOR
// PCBlocker // PCBlocker
if (m_PCBlockerVector.size() != 0) if (m_PCBlockerVector.size() != 0)
{ {
@@ -655,16 +642,10 @@ void CMapOutdoor::RenderPCBlocker()
STATEMANAGER.RestoreSamplerState(1, D3DSAMP_ADDRESSV); STATEMANAGER.RestoreSamplerState(1, D3DSAMP_ADDRESSV);
STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE); STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE);
} }
#endif
} }
void CMapOutdoor::SelectIndexBuffer(BYTE byLODLevel, WORD * pwPrimitiveCount, D3DPRIMITIVETYPE * pePrimitiveType) void CMapOutdoor::SelectIndexBuffer(BYTE byLODLevel, WORD * pwPrimitiveCount, D3DPRIMITIVETYPE * pePrimitiveType)
{ {
#ifdef WORLD_EDITOR
*pwPrimitiveCount = m_wNumIndices - 2;
*pePrimitiveType = D3DPT_TRIANGLESTRIP;
STATEMANAGER.SetIndices(m_IndexBuffer.GetD3DIndexBuffer(), 0);
#else
if (0 == byLODLevel) if (0 == byLODLevel)
{ {
*pwPrimitiveCount = m_wNumIndices[byLODLevel] - 2; *pwPrimitiveCount = m_wNumIndices[byLODLevel] - 2;
@@ -676,7 +657,6 @@ void CMapOutdoor::SelectIndexBuffer(BYTE byLODLevel, WORD * pwPrimitiveCount, D3
*pePrimitiveType = D3DPT_TRIANGLELIST; *pePrimitiveType = D3DPT_TRIANGLELIST;
} }
STATEMANAGER.SetIndices(m_IndexBuffer[byLODLevel].GetD3DIndexBuffer(), 0); STATEMANAGER.SetIndices(m_IndexBuffer[byLODLevel].GetD3DIndexBuffer(), 0);
#endif
} }
void CMapOutdoor::SetPatchDrawVector() void CMapOutdoor::SetPatchDrawVector()
@@ -956,9 +936,5 @@ void CMapOutdoor::DrawPatchAttr(long patchnum)
STATEMANAGER.SetFVF(D3DFVF_XYZ | D3DFVF_NORMAL); STATEMANAGER.SetFVF(D3DFVF_XYZ | D3DFVF_NORMAL);
STATEMANAGER.SetStreamSource(0, pTerrainPatchProxy->HardwareTransformPatch_GetVertexBufferPtr()->GetD3DVertexBuffer(), m_iPatchTerrainVertexSize); STATEMANAGER.SetStreamSource(0, pTerrainPatchProxy->HardwareTransformPatch_GetVertexBufferPtr()->GetD3DVertexBuffer(), m_iPatchTerrainVertexSize);
#ifdef WORLD_EDITOR
STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, m_iPatchTerrainVertexCount, 0, m_wNumIndices - 2);
#else
STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, m_iPatchTerrainVertexCount, 0, m_wNumIndices[0] - 2); STATEMANAGER.DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, m_iPatchTerrainVertexCount, 0, m_wNumIndices[0] - 2);
#endif
} }

View File

@@ -51,32 +51,9 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
#ifdef WORLD_EDITOR
if (GetAsyncKeyState(VK_CAPITAL))
{
CSpeedTreeWrapper::ms_bSelfShadowOn = false;
STATEMANAGER.SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_GAUSSIANCUBIC);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_GAUSSIANCUBIC);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_GAUSSIANCUBIC);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MINFILTER, D3DTEXF_GAUSSIANCUBIC);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MAGFILTER, D3DTEXF_GAUSSIANCUBIC);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MIPFILTER, D3DTEXF_GAUSSIANCUBIC);
}
else
{
CSpeedTreeWrapper::ms_bSelfShadowOn = true;
STATEMANAGER.SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
STATEMANAGER.SetTextureStageState(1, D3DTSS_MIPFILTER, D3DTEXF_LINEAR);
}
#else
CSpeedTreeWrapper::ms_bSelfShadowOn = true; CSpeedTreeWrapper::ms_bSelfShadowOn = true;
STATEMANAGER.SetBestFiltering(0); STATEMANAGER.SetBestFiltering(0);
STATEMANAGER.SetBestFiltering(1); STATEMANAGER.SetBestFiltering(1);
#endif
m_matWorldForCommonUse._41 = 0.0f; m_matWorldForCommonUse._41 = 0.0f;
m_matWorldForCommonUse._42 = 0.0f; m_matWorldForCommonUse._42 = 0.0f;
@@ -102,11 +79,6 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
std::vector<std::pair<float ,long> >::iterator near_it = std::upper_bound(m_PatchVector.begin(),m_PatchVector.end(),fog_near); std::vector<std::pair<float ,long> >::iterator near_it = std::upper_bound(m_PatchVector.begin(),m_PatchVector.end(),fog_near);
// NOTE: Word Editor 툴에서는 fog far보다 멀리있는 물체를 텍스쳐 없이 그리는 작업을 하지 않음 // NOTE: Word Editor 툴에서는 fog far보다 멀리있는 물체를 텍스쳐 없이 그리는 작업을 하지 않음
#ifdef WORLD_EDITOR
near_it = m_PatchVector.begin();
far_it = m_PatchVector.end();
#endif
WORD wPrimitiveCount; WORD wPrimitiveCount;
D3DPRIMITIVETYPE ePrimitiveType; D3DPRIMITIVETYPE ePrimitiveType;
@@ -121,7 +93,6 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
std::vector<std::pair<float, long> >::iterator it = m_PatchVector.begin(); std::vector<std::pair<float, long> >::iterator it = m_PatchVector.begin();
// NOTE: 맵툴에서는 view ~ fog near 사이의 지형을 fog disabled 상태로 그리는 작업을 하지 않음. // NOTE: 맵툴에서는 view ~ fog near 사이의 지형을 fog disabled 상태로 그리는 작업을 하지 않음.
#ifndef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE); STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
for( ; it != near_it; ++it) for( ; it != near_it; ++it)
@@ -144,7 +115,6 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
if (m_bDrawWireFrame) if (m_bDrawWireFrame)
DrawWireFrame(it->second, wPrimitiveCount, ePrimitiveType); DrawWireFrame(it->second, wPrimitiveCount, ePrimitiveType);
} }
#endif
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable); STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
@@ -307,242 +277,6 @@ void CMapOutdoor::__HardwareTransformPatch_RenderPatchSplat(long patchnum, WORD
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE); STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE);
int iPrevRenderedSplatNum=m_iRenderedSplatNum; int iPrevRenderedSplatNum=m_iRenderedSplatNum;
#ifdef WORLD_EDITOR
int nRenderTextureCount = 0;
// if (!m_bShowEntirePatchTextureCount && !(GetAsyncKeyState(VK_LCONTROL) & 0x8000) )
if (1)
{
for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j)
{
TTerainSplat & rSplat = rTerrainSplatPatch.Splats[j];
if (!rSplat.Active)
continue;
if (rTerrainSplatPatch.PatchTileCount[sPatchNum][j] == 0)
continue;
++nRenderTextureCount;
}
DWORD dwTextureFactor = STATEMANAGER.GetRenderState(D3DRS_TEXTUREFACTOR);
int TextureCountThreshold = 8;
DWORD dwTFactor = 0xFFFFFFFF;
if (GetAsyncKeyState(VK_LSHIFT) & 0x8000)
{
if (GetAsyncKeyState(VK_1) & 0x8000)
{
TextureCountThreshold = 2;
dwTFactor = 0xFF0000FF;
}
else if (GetAsyncKeyState(VK_2) & 0x8000)
{
TextureCountThreshold = 3;
dwTFactor = 0xFF00FF00;
}
else if (GetAsyncKeyState(VK_3) & 0x8000)
{
TextureCountThreshold = 4;
dwTFactor = 0xFF00FFFF;
}
else if (GetAsyncKeyState(VK_4) & 0x8000)
{
TextureCountThreshold = 5;
dwTFactor = 0xFFFF0000;
}
else if (GetAsyncKeyState(VK_5) & 0x8000)
{
TextureCountThreshold = 6;
dwTFactor = 0xFFFFFF00;
}
else if (GetAsyncKeyState(VK_6) & 0x8000)
{
TextureCountThreshold = 7;
dwTFactor = 0xFFFF00ff;
}
}
if (nRenderTextureCount>=TextureCountThreshold)
{
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTFactor);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.DrawIndexedPrimitive(ePrimitiveType, 0, m_iPatchTerrainVertexCount, 0, wPrimitiveCount);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTextureFactor);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLORARG1);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLOROP);
}
else
{
// 0번 텍스처
if ( 0 < rTerrainSplatPatch.PatchTileCount[sPatchNum][0] )
{
DWORD dwTextureFactorFor0Texture = STATEMANAGER.GetRenderState(D3DRS_TEXTUREFACTOR);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, 0xFF88FF88);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.DrawIndexedPrimitive(ePrimitiveType, 0, m_iPatchTerrainVertexCount, 0, wPrimitiveCount);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTextureFactorFor0Texture);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLORARG1);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLOROP);
}
for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j)
{
TTerainSplat & rSplat = rTerrainSplatPatch.Splats[j];
if (!rSplat.Active)
continue;
DWORD dwTextureCount = rTerrainSplatPatch.PatchTileCount[sPatchNum][j];
if (dwTextureCount == 0)
continue;
DWORD dwTextureFactorForTextureBalance = 0xFFFFFFFF;
if (!(GetAsyncKeyState(VK_LSHIFT) & 0x8000))
{
const TTerrainTexture & rTexture = m_TextureSet.GetTexture(j);
D3DXMatrixMultiply(&matSplatColorTexTransform, &m_matViewInverse, &rTexture.m_matTransform);
STATEMANAGER.SetTransform(D3DTS_TEXTURE0, &matSplatColorTexTransform);
STATEMANAGER.SetTexture(0, rTexture.pd3dTexture);
STATEMANAGER.SetTexture(1, rSplat.pd3dTexture);
STATEMANAGER.DrawIndexedPrimitive(ePrimitiveType, 0, m_iPatchTerrainVertexCount, 0, wPrimitiveCount);
}
else
{
if (dwTextureCount < 71)
{
dwTextureFactorForTextureBalance = STATEMANAGER.GetRenderState(D3DRS_TEXTUREFACTOR);
if (dwTextureCount < 51)
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, 0xFFFF0000);
else
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, 0xFF0000FF);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.SetTexture(0, NULL);
}
else
{
const TTerrainTexture & rTexture = m_TextureSet.GetTexture(j);
D3DXMatrixMultiply(&matSplatColorTexTransform, &m_matViewInverse, &rTexture.m_matTransform);
STATEMANAGER.SetTransform(D3DTS_TEXTURE0, &matSplatColorTexTransform);
STATEMANAGER.SetTexture(0, rTexture.pd3dTexture);
}
STATEMANAGER.SetTexture(1, rSplat.pd3dTexture);
STATEMANAGER.DrawIndexedPrimitive(ePrimitiveType, 0, m_iPatchTerrainVertexCount, 0, wPrimitiveCount);
if (dwTextureCount < 71)
{
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTextureFactorForTextureBalance);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLORARG1);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLOROP);
}
}
std::vector<int>::iterator aIterator = std::find(m_RenderedTextureNumVector.begin(), m_RenderedTextureNumVector.end(), (int)j);
if (aIterator == m_RenderedTextureNumVector.end())
m_RenderedTextureNumVector.push_back(j);
++m_iRenderedSplatNum;
if (m_iRenderedSplatNum >= m_iSplatLimit)
break;
}
}
}
else
{
int TextureCountThreshold = 6;
DWORD dwTFactor = 0xFFFF00FF;
if (GetAsyncKeyState(VK_LSHIFT) & 0x8000)
{
if (GetAsyncKeyState(VK_1) & 0x8000)
{
TextureCountThreshold = 1;
dwTFactor = 0xFF0000FF;
}
else if (GetAsyncKeyState(VK_2) & 0x8000)
{
TextureCountThreshold = 2;
dwTFactor = 0xFF00FF00;
}
else if (GetAsyncKeyState(VK_3) & 0x8000)
{
TextureCountThreshold = 3;
dwTFactor = 0xFF00FFFF;
}
else if (GetAsyncKeyState(VK_4) & 0x8000)
{
TextureCountThreshold = 4;
dwTFactor = 0xFFFF0000;
}
else if (GetAsyncKeyState(VK_5) & 0x8000)
{
TextureCountThreshold = 5;
dwTFactor = 0xFFFFFF00;
}
}
for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j)
{
TTerainSplat & rSplat = rTerrainSplatPatch.Splats[j];
if (!rSplat.Active)
continue;
if (rTerrainSplatPatch.PatchTileCount[sPatchNum][j] == 0)
continue;
DWORD dwTextureFactor;
if (nRenderTextureCount>=TextureCountThreshold)
{
dwTextureFactor = STATEMANAGER.GetRenderState(D3DRS_TEXTUREFACTOR);
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTFactor);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.SetTexture(0, NULL);
}
else
{
const TTerrainTexture & rTexture = m_TextureSet.GetTexture(j);
D3DXMatrixMultiply(&matSplatColorTexTransform, &m_matViewInverse, &rTexture.m_matTransform);
STATEMANAGER.SetTransform(D3DTS_TEXTURE0, &matSplatColorTexTransform);
STATEMANAGER.SetTexture(0, rTexture.pd3dTexture);
}
STATEMANAGER.SetTexture(1, rSplat.pd3dTexture);
STATEMANAGER.DrawIndexedPrimitive(ePrimitiveType, 0, m_iPatchTerrainVertexCount, 0, wPrimitiveCount);
if (nRenderTextureCount>=TextureCountThreshold)
{
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, dwTextureFactor);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLORARG1);
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_COLOROP);
}
++nRenderTextureCount;
std::vector<int>::iterator aIterator = std::find(m_RenderedTextureNumVector.begin(), m_RenderedTextureNumVector.end(), (int)j);
if (aIterator == m_RenderedTextureNumVector.end())
m_RenderedTextureNumVector.push_back(j);
++m_iRenderedSplatNum;
if (m_iRenderedSplatNum >= m_iSplatLimit)
break;
}
}
#else
bool isFirst=true; bool isFirst=true;
for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j) for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j)
{ {
@@ -601,7 +335,6 @@ void CMapOutdoor::__HardwareTransformPatch_RenderPatchSplat(long patchnum, WORD
} }
} }
*/ */
#endif
// 그림자 // 그림자
if (m_bDrawShadow) if (m_bDrawShadow)

View File

@@ -213,11 +213,7 @@ void CMapOutdoor::UpdateAroundAmbience(float fX, float fY, float fZ)
void CMapOutdoor::__UpdateArea(D3DXVECTOR3& v3Player) void CMapOutdoor::__UpdateArea(D3DXVECTOR3& v3Player)
{ {
#ifdef WORLD_EDITOR
__NEW_WorldEditor_UpdateArea();
#else
__Game_UpdateArea(v3Player); __Game_UpdateArea(v3Player);
#endif
} }
void CMapOutdoor::__Game_UpdateArea(D3DXVECTOR3& v3Player) void CMapOutdoor::__Game_UpdateArea(D3DXVECTOR3& v3Player)
@@ -290,15 +286,7 @@ void CMapOutdoor::__Game_UpdateArea(D3DXVECTOR3& v3Player)
} }
#endif #endif
} }
#ifdef WORLD_EDITOR
void CMapOutdoor::__NEW_WorldEditor_UpdateArea()
{
m_PCBlockerVector.clear();
m_ShadowReceiverVector.clear();
__UpdateAroundAreaList();
}
#endif
void CMapOutdoor::__UpdateAroundAreaList() void CMapOutdoor::__UpdateAroundAreaList()
{ {
#ifdef __PERFORMANCE_CHECKER__ #ifdef __PERFORMANCE_CHECKER__

View File

@@ -470,87 +470,7 @@ bool CRaceMotionData::LoadMotionData(const char * c_szFileName)
return true; return true;
} }
#ifdef WORLD_EDITOR
bool CRaceMotionData::SaveMotionData(const char * c_szFileName)
{
FILE * File;
SetFileAttributes(c_szFileName, FILE_ATTRIBUTE_NORMAL);
File = fopen(c_szFileName, "w");
if (!File)
{
TraceError("CRaceMotionData::SaveMotionData : cannot open file for writing (filename: %s)", c_szFileName);
return false;
}
fprintf(File, "ScriptType MotionData\n");
fprintf(File, "\n");
fprintf(File, "MotionFileName \"%s\"\n", m_strMotionFileName.c_str());
fprintf(File, "MotionDuration %f\n", m_fMotionDuration);
if (m_isAccumulationMotion)
fprintf(File, "Accumulation %.2f\t%.2f\t%.2f\n", m_accumulationPosition.x, m_accumulationPosition.y, m_accumulationPosition.z);
fprintf(File, "\n");
if (m_isComboMotion)
{
fprintf(File, "Group ComboInputData\n");
fprintf(File, "{\n");
fprintf(File, " PreInputTime %f\n", m_ComboInputData.fInputStartTime);
fprintf(File, " DirectInputTime %f\n", m_ComboInputData.fNextComboTime);
fprintf(File, " InputLimitTime %f\n", m_ComboInputData.fInputEndTime);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (m_isAttackingMotion)
{
fprintf(File, "Group AttackingData\n");
fprintf(File, "{\n");
NRaceData::SaveMotionAttackData(File, 1, m_MotionAttackData);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (m_isLoopMotion)
{
fprintf(File, "Group LoopData\n");
fprintf(File, "{\n");
fprintf(File, " MotionLoopCount %d\n", m_iLoopCount);
fprintf(File, " LoopCancelEnable %d\n", m_bCancelEnableSkill);
fprintf(File, " LoopStartTime %f\n", m_fLoopStartTime);
fprintf(File, " LoopEndTime %f\n", m_fLoopEndTime);
fprintf(File, "}\n");
fprintf(File, "\n");
}
if (!m_MotionEventDataVector.empty())
{
fprintf(File, "Group MotionEventData\n");
fprintf(File, "{\n");
fprintf(File, " MotionEventDataCount %d\n", m_MotionEventDataVector.size());
for (DWORD j = 0; j < m_MotionEventDataVector.size(); ++j)
{
TMotionEventData * c_pData = m_MotionEventDataVector[j];
fprintf(File, " Group Event%02d\n", j);
fprintf(File, " {\n");
fprintf(File, " MotionEventType %d\n", c_pData->iType);
fprintf(File, " StartingTime %f\n", c_pData->fStartingTime);
c_pData->Save(File, 2);
fprintf(File, " }\n");
}
fprintf(File, "}\n");
}
fclose(File);
return true;
}
#endif
bool CRaceMotionData::LoadSoundScriptData(const char * c_szFileName) bool CRaceMotionData::LoadSoundScriptData(const char * c_szFileName)
{ {
NSound::TSoundDataVector SoundDataVector; NSound::TSoundDataVector SoundDataVector;

View File

@@ -256,9 +256,6 @@ class CRaceMotionData
const NSound::TSoundInstanceVector * GetSoundInstanceVectorPointer() const; const NSound::TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
// File // File
#ifdef WORLD_EDITOR
bool SaveMotionData(const char * c_szFileName);
#endif
bool LoadMotionData(const char * c_szFileName); bool LoadMotionData(const char * c_szFileName);
bool LoadSoundScriptData(const char * c_szFileName); bool LoadSoundScriptData(const char * c_szFileName);

View File

@@ -103,10 +103,9 @@ class CTerrainImpl
bool LoadHeightMap(const char *c_szFileName); bool LoadHeightMap(const char *c_szFileName);
bool RAW_LoadTileMap(const char * c_szFileName); bool RAW_LoadTileMap(const char * c_szFileName);
bool LoadAttrMap(const char *c_pszFileName); bool LoadAttrMap(const char *c_pszFileName);
#ifdef WORLD_EDITOR inline WORD GetHeightMapValue(short sx, short sy) {
public: return m_awRawHeightMap[(sy + 1) * HEIGHTMAP_RAW_XSIZE + sx + 1];
#endif }
__forceinline WORD GetHeightMapValue(short sx, short sy);
protected: protected:
LPDIRECT3DTEXTURE9 m_lpAlphaTexture[MAXTERRAINTEXTURES]; LPDIRECT3DTEXTURE9 m_lpAlphaTexture[MAXTERRAINTEXTURES];
@@ -147,10 +146,4 @@ class CTerrainImpl
long m_lSplatTilesY; long m_lSplatTilesY;
}; };
__forceinline WORD CTerrainImpl::GetHeightMapValue(short sx, short sy)
{
return m_awRawHeightMap[(sy+1) * HEIGHTMAP_RAW_XSIZE + sx+1];
}
#endif // !defined(AFX_TERRAIN_H__1C9108E1_69A7_4392_9B68_0E6CD4E1BFBA__INCLUDED_) #endif // !defined(AFX_TERRAIN_H__1C9108E1_69A7_4392_9B68_0E6CD4E1BFBA__INCLUDED_)