Commit 9361158c authored by D-AIRY's avatar D-AIRY

Editable game

parent adcdd3f1
......@@ -189,6 +189,7 @@
<ClCompile Include="..\..\..\source\game\CharacterInventory.cpp" />
<ClCompile Include="..\..\..\source\game\crosshair.cpp" />
<ClCompile Include="..\..\..\source\game\CrosshairManager.cpp" />
<ClCompile Include="..\..\..\source\game\Editable.cpp" />
<ClCompile Include="..\..\..\source\game\EntityFactory.cpp" />
<ClCompile Include="..\..\..\source\game\EntityManager.cpp" />
<ClCompile Include="..\..\..\source\game\FuncTrain.cpp" />
......@@ -245,6 +246,7 @@
<ClInclude Include="..\..\..\source\game\BaseWeaponAddon.h" />
<ClInclude Include="..\..\..\source\game\BaseTrigger.h" />
<ClInclude Include="..\..\..\source\game\BaseCharacter.h" />
<ClInclude Include="..\..\..\source\game\Editable.h" />
<ClInclude Include="..\..\..\source\game\GameStateManager.h" />
<ClInclude Include="..\..\..\source\game\CharacterInventory.h" />
<ClInclude Include="..\..\..\source\game\GameStates.h" />
......
......@@ -237,6 +237,9 @@
<ClCompile Include="..\..\..\source\game\PropStatic.cpp">
<Filter>Source Files\ents\props</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\game\Editable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\game\sxgame.h">
......@@ -410,5 +413,8 @@
<ClInclude Include="..\..\..\source\game\PropStatic.h">
<Filter>Header Files\ents\props</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\game\Editable.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
#include "Editable.h"
#if defined(_DEBUG)
#pragma comment(lib, "sxmtrl_d.lib")
#else
#pragma comment(lib, "sxmtrl.lib")
#endif
CEditable::CEditable(IXCore *pCore)
{
m_pCore = pCore;
}
void CEditable::startup(IGXContext *pDevice)
{
m_pDevice = pDevice;
GXBLEND_DESC blendDesc;
blendDesc.renderTarget[0].bBlendEnable = true;
blendDesc.renderTarget[0].srcBlend = blendDesc.renderTarget[0].srcBlendAlpha = GXBLEND_BLEND_FACTOR;
blendDesc.renderTarget[0].destBlend = blendDesc.renderTarget[0].destBlendAlpha = GXBLEND_INV_BLEND_FACTOR;
m_pBlendColorFactor = m_pDevice->createBlendState(&blendDesc);
GXRASTERIZER_DESC rsDesc;
rsDesc.cullMode = GXCULL_NONE;
rsDesc.fillMode = GXFILL_WIREFRAME;
m_pRSWireframe = m_pDevice->createRasterizerState(&rsDesc);
IPluginManager *pPluginManager = m_pCore->getPluginManager();
IXMaterialSystem *pMaterialSystem = (IXMaterialSystem*)pPluginManager->getInterface(IXMATERIALSYSTEM_GUID);
m_pMaterialSystem = pMaterialSystem;
pMaterialSystem->getTexture("dev_white", &m_pWhiteTexture);
m_pszClassList = new const char*[getClassCount()];
CEntityFactoryMap::GetInstance()->getListing(m_pszClassList, getClassCount());
}
void CEditable::shutdown()
{
mem_delete_a(m_pszClassList);
mem_release(m_pWhiteTexture);
mem_release(m_pBlendColorFactor);
mem_release(m_pRSWireframe);
}
CEditable::~CEditable()
{
shutdown();
}
UINT CEditable::getObjectCount()
{
//GameData::m_pMgr->getCount();
return(0);
}
IXEditorObject *CEditable::getObject(UINT id)
{
//return(new CEditorObject(this, id));
return(NULL);
}
IXEditorObject *CEditable::newObject(const char *szClassName)
{
//return(new CEditorObject(this));
return(NULL);
}
#ifndef __EDITABLE_H
#define __EDITABLE_H
#include <xcommon/editor/IXEditable.h>
#include <mtrl/IXMaterialSystem.h>
#include <xcommon/IXCore.h>
#include "GameData.h"
class CEditable: public IXEditable
{
friend class CEditorObject;
public:
CEditable(IXCore *pCore);
~CEditable();
UINT getObjectCount();
IXEditorObject *getObject(UINT id);
IXEditorObject *newObject(const char *szClassName);
const char *getName()
{
return("Entity");
}
UINT getClassCount()
{
return(CEntityFactoryMap::GetInstance()->getListCount());
}
const char *getClass(UINT id)
{
assert(id < getClassCount());
return(m_pszClassList[id]);
}
void startup(IGXContext *pDevice);
void shutdown();
protected:
IGXContext *m_pDevice = NULL;
IXCore *m_pCore = NULL;
IXMaterialSystem *m_pMaterialSystem = NULL;
IGXBlendState *m_pBlendColorFactor = NULL;
IGXRasterizerState *m_pRSWireframe = NULL;
IXTexture *m_pWhiteTexture = NULL;
const char **m_pszClassList = NULL;
};
#endif
......@@ -27,6 +27,8 @@ See the license in LICENSE
#include <xcommon/XEvents.h>
#include "Editable.h"
CPlayer * GameData::m_pPlayer;
CPointCamera * GameData::m_pActiveCamera;
gui::IGUI * GameData::m_pGUI = NULL;
......@@ -35,6 +37,7 @@ CHUDcontroller * GameData::m_pHUDcontroller;
CGameStateManager * GameData::m_pGameStateManager;
gui::dom::IDOMnode *GameData::m_pCell;
IXLightSystem *GameData::m_pLightSystem;
CEditable *g_pEditable = NULL;
//gui::IDesktop *GameData::m_pStatsUI;
//CRagdoll * g_pRagdoll;
......@@ -323,6 +326,9 @@ GameData::GameData(HWND hWnd, bool isGame):
m_pMgr = new CEntityManager();
g_pEditable = new CEditable(Core_GetIXCore());
Core_GetIXCore()->getPluginManager()->registerInterface(IXEDITABLE_GUID, g_pEditable);
g_pLevelChannel = Core_GetIXCore()->getEventChannel<XEventLevel>(EVENT_LEVEL_GUID);
Core_GetIXCore()->getEventChannel<XEventLevelProgress>(EVENT_LEVEL_PROGRESS_GUID)->addListener(&g_levelProgressListener);
......@@ -1049,6 +1055,7 @@ GameData::GameData(HWND hWnd, bool isGame):
GameData::~GameData()
{
//mem_delete(g_pRagdoll);
mem_delete(g_pEditable);
mem_delete(m_pGameStateManager);
mem_delete(m_pHUDcontroller);
......
......@@ -696,7 +696,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case ID_FILE_SAVEAS:
if(g_pUndoManager->isDirty())
//if(g_pUndoManager->isDirty())
{
XSaveLevel(NULL, true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment