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();
#ifdef WORLD_EDITOR
FEffectUpdator f(CTimer::Instance().GetElapsedSecond());
#else
FEffectUpdator f(CTimer::Instance().GetCurrentSecond()-m_fLastTime);
#endif
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_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())
return;
m_dcColor = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor);
m_Color = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor);
}
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)
{
#ifdef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
#else
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_dcColor);
#endif
/////
D3DXVECTOR3 v3Up;
D3DXVECTOR3 v3Cross;
@@ -336,13 +330,7 @@ void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal)
void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation)
{
#ifdef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
#else
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, (DWORD)m_dcColor);
#endif
/////
D3DXVECTOR3 v3Up;
D3DXVECTOR3 v3Cross;
@@ -500,11 +488,7 @@ void CParticleInstance::__Initialize()
m_v3Velocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
m_v2Scale = D3DXVECTOR2(1.0f, 1.0f);
#ifdef WORLD_EDITOR
m_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
#else
m_dcColor.m_dwColor = 0xffffffff;
#endif
m_byFrameIndex = 0;
m_rotationType = CParticleProperty::ROTATION_TYPE_NONE;

View File

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

View File

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

View File

@@ -75,16 +75,7 @@ class CParticleProperty
TTimeEventTableFloat m_TimeEventScaleX;
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;
#endif
TTimeEventTableFloat m_TimeEventRotation;
std::vector<CGraphicImage*> m_ImageVector;

View File

@@ -210,17 +210,6 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscaley", &m_ParticleProperty.m_TimeEventScaleY))
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 TimeEventB;
TTimeEventTableFloat TimeEventG;
@@ -257,16 +246,13 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
fA = GetTimeEventBlendValue(fTime, TimeEventA);
TTimeEventTypeColor t;
t.m_fTime = fTime;
D3DXCOLOR c;
c.r = fR;
c.g = fG;
c.b = fB;
c.a = fA;
t.m_Value.m_dwColor = /*(DWORD)*/ (DWORD)c;
t.m_Value.r = fR;
t.m_Value.g = fG;
t.m_Value.b = fB;
t.m_Value.a = fA;
m_ParticleProperty.m_TimeEventColor.push_back(t);
}
}
#endif
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation))
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.y= m_pParticleProperty->m_TimeEventScaleY.front().m_Value;
//pInstance->m_v2Scale = m_pParticleProperty->m_TimeEventScaleXY.front().m_Value;
#ifdef WORLD_EDITOR
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
pInstance->m_Color = m_pParticleProperty->m_TimeEventColor.front().m_Value;
}
m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance);

View File

@@ -123,74 +123,12 @@ typedef struct SEffectPosition : public CTimeEvent<D3DXVECTOR3>
D3DXVECTOR3 m_vecControlPoint;
} 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<short> TTimeEventTypeShort;
typedef CTimeEvent<float> TTimeEventTypeFloat;
typedef CTimeEvent<WORD> TTimeEventTypeWord;
typedef CTimeEvent<DWORD> TTimeEventTypeDoubleWord;
typedef CTimeEvent<DWORDCOLOR> TTimeEventTypeColor;
typedef CTimeEvent<D3DXCOLOR> TTimeEventTypeColor;
typedef CTimeEvent<D3DXVECTOR2> TTimeEventTypeVector2;
typedef CTimeEvent<D3DXVECTOR3> TTimeEventTypeVector3;
@@ -238,14 +176,6 @@ inline D3DXVECTOR3 BlendSingleValue(float time, const TEffectPosition& low, cons
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>
auto GetTimeEventBlendValue(float time,
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].texCoord = TTextureCoordinate(eu, ev);
#ifdef WORLD_EDITOR
STATEMANAGER.SetTransform(D3DTS_WORLD, ms_lpd3dMatStack->GetTop());
#endif
STATEMANAGER.SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1);
// 2004.11.18.myevan.DrawIndexPrimitiveUP -> DynamicVertexBuffer

View File

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

View File

@@ -335,47 +335,12 @@ void CArea::RenderDungeon()
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
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();
for (; itor != m_DungeonBlockCloneInstanceVector.end(); ++itor)
{
(*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_ALPHAOP, D3DTOP_DISABLE);
}

View File

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

View File

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

View File

@@ -7,69 +7,6 @@ void CMapOutdoor::SetIndexBuffer()
long x, y;
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];
BYTE uci;
for (uci = 0; uci < TERRAINPATCH_LODMAX; ++uci)
@@ -199,7 +136,6 @@ void CMapOutdoor::SetIndexBuffer()
delete [] m_pwaIndices[uci];
m_pwaIndices[uci] = NULL;
}
#endif
}
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()))
TraceError("CMapOutdoor::Load : LoadSetting(%s) Failed", strFileName.c_str());
#ifdef WORLD_EDITOR
if (!LoadMonsterAreaInfo())
TraceError("CMapOutdoor::Load - LoadMonsterAreaInfo ERROR");
#endif
CreateTerrainPatchProxyList();
BuildQuadTree();
LoadWaterTexture();
@@ -367,10 +362,6 @@ bool CMapOutdoor::LoadSetting(const char * c_szFileName)
m_lViewRadius = atol(c_rstrViewRadius.c_str());
#ifdef WORLD_EDITOR
m_lViewRadius <<= 1;
#endif
if (0L >= m_lViewRadius)
{
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))
{
#ifdef WORLD_EDITOR
// TextureSet 이 적용되어 있지 않아도 진행
LogBox("TextureSet 이 적용되어있지 않은 맵 입니다.\n지형 텍스춰 작업에 주의하시기 바랍니다.");
#else
TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - LOAD TEXTURE SET(%s) ERROR", c_szFileName, stTextureSetFileName.c_str());
return false;
#endif
}
CTerrain::SetTextureSet(&m_TextureSet);

View File

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

View File

@@ -51,32 +51,9 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSU, 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;
STATEMANAGER.SetBestFiltering(0);
STATEMANAGER.SetBestFiltering(1);
#endif
m_matWorldForCommonUse._41 = 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);
// NOTE: Word Editor 툴에서는 fog far보다 멀리있는 물체를 텍스쳐 없이 그리는 작업을 하지 않음
#ifdef WORLD_EDITOR
near_it = m_PatchVector.begin();
far_it = m_PatchVector.end();
#endif
WORD wPrimitiveCount;
D3DPRIMITIVETYPE ePrimitiveType;
@@ -121,7 +93,6 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
std::vector<std::pair<float, long> >::iterator it = m_PatchVector.begin();
// NOTE: 맵툴에서는 view ~ fog near 사이의 지형을 fog disabled 상태로 그리는 작업을 하지 않음.
#ifndef WORLD_EDITOR
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
for( ; it != near_it; ++it)
@@ -144,7 +115,6 @@ void CMapOutdoor::__RenderTerrain_RenderHardwareTransformPatch()
if (m_bDrawWireFrame)
DrawWireFrame(it->second, wPrimitiveCount, ePrimitiveType);
}
#endif
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, dwFogEnable);
@@ -307,242 +277,6 @@ void CMapOutdoor::__HardwareTransformPatch_RenderPatchSplat(long patchnum, WORD
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE);
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;
for (DWORD j = 1; j < pTerrain->GetNumTextures(); ++j)
{
@@ -601,7 +335,6 @@ void CMapOutdoor::__HardwareTransformPatch_RenderPatchSplat(long patchnum, WORD
}
}
*/
#endif
// 그림자
if (m_bDrawShadow)

View File

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

View File

@@ -470,87 +470,7 @@ bool CRaceMotionData::LoadMotionData(const char * c_szFileName)
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)
{
NSound::TSoundDataVector SoundDataVector;

View File

@@ -256,9 +256,6 @@ class CRaceMotionData
const NSound::TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
// File
#ifdef WORLD_EDITOR
bool SaveMotionData(const char * c_szFileName);
#endif
bool LoadMotionData(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 RAW_LoadTileMap(const char * c_szFileName);
bool LoadAttrMap(const char *c_pszFileName);
#ifdef WORLD_EDITOR
public:
#endif
__forceinline WORD GetHeightMapValue(short sx, short sy);
inline WORD GetHeightMapValue(short sx, short sy) {
return m_awRawHeightMap[(sy + 1) * HEIGHTMAP_RAW_XSIZE + sx + 1];
}
protected:
LPDIRECT3DTEXTURE9 m_lpAlphaTexture[MAXTERRAINTEXTURES];
@@ -147,10 +146,4 @@ class CTerrainImpl
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_)