diff --git a/source/sced/AlterElevationCommand.cpp b/source/sced/AlterElevationCommand.cpp index 7b9006964b..bda3b4a634 100755 --- a/source/sced/AlterElevationCommand.cpp +++ b/source/sced/AlterElevationCommand.cpp @@ -81,10 +81,10 @@ void CAlterElevationCommand::ApplyDataToSelection(const CArray2D& data) // flag vertex data as dirty for affected patches, and rebuild bounds of these patches u32 patchesPerSide=g_Terrain.GetPatchesPerSide(); - int px0=clamp(-1+(x0/16),0,patchesPerSide); - int px1=clamp(1+(x1/16),0,patchesPerSide); - int pz0=clamp(-1+(z0/16),0,patchesPerSide); - int pz1=clamp(1+(z1/16),0,patchesPerSide); + int px0=clamp(-1+(x0/PATCH_SIZE),0,patchesPerSide); + int px1=clamp(1+(x1/PATCH_SIZE),0,patchesPerSide); + int pz0=clamp(-1+(z0/PATCH_SIZE),0,patchesPerSide); + int pz1=clamp(1+(z1/PATCH_SIZE),0,patchesPerSide); for (j=pz0;j #include -#include "ogl.h" +#include "ogl.h" +#include "Renderer.h" +#include "BrushShapeEditorTool.h" + // default tool instance CBrushShapeEditorTool CBrushShapeEditorTool::m_BrushShapeEditorTool; @@ -16,8 +17,7 @@ CBrushShapeEditorTool::CBrushShapeEditorTool() : m_BrushSize(5), m_BrushData(0) void CBrushShapeEditorTool::OnDraw() { - glActiveTexture(GL_TEXTURE0); - glDisable(GL_TEXTURE_2D); + g_Renderer.SetTexture(0,0); glDepthMask(0); diff --git a/source/sced/BrushTool.cpp b/source/sced/BrushTool.cpp index 8615a7c565..44a9eadc77 100755 --- a/source/sced/BrushTool.cpp +++ b/source/sced/BrushTool.cpp @@ -53,8 +53,7 @@ static void RenderTileOutline(int gx,int gz) void CBrushTool::OnDraw() { - glActiveTexture (GL_TEXTURE0); - glDisable (GL_TEXTURE_2D); + g_Renderer.SetTexture(0,0); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/sced/EditorData.cpp b/source/sced/EditorData.cpp index fa6edae200..322489b67d 100755 --- a/source/sced/EditorData.cpp +++ b/source/sced/EditorData.cpp @@ -1,658 +1,664 @@ - - -#include "EditorData.h" -#include "UIGlobals.h" -#include "ToolManager.h" -#include "ObjectManager.h" -#include "UnitManager.h" -#include "TextureManager.h" -#include "Model.h" -#include "SkeletonAnimManager.h" - -#include "ogl.h" -#include "res/tex.h" -#include "time.h" - -#include "BaseEntityCollection.h" -#include "Entity.h" -#include "EntityHandles.h" -#include "EntityManager.h" - -const int NUM_ALPHA_MAPS = 14; -Handle AlphaMaps[NUM_ALPHA_MAPS]; - -CTerrain g_Terrain; -CLightEnv g_LightEnv; -CMiniMap g_MiniMap; -CEditorData g_EditorData; - -CEditorData::CEditorData() -{ - m_ModelMatrix.SetIdentity(); - m_ScenarioName="Scenario01"; -} - -void CEditorData::SetMode(EditMode mode) -{ - if (m_Mode==TEST_MODE && mode!=TEST_MODE) StopTestMode(); - m_Mode=mode; - if (m_Mode==TEST_MODE) StartTestMode(); -} - -bool CEditorData::InitScene() -{ - // setup default lighting environment - g_LightEnv.m_SunColor=RGBColor(1,1,1); - g_LightEnv.m_Rotation=DEGTORAD(270); - g_LightEnv.m_Elevation=DEGTORAD(45); - g_LightEnv.m_TerrainAmbientColor=RGBColor(0,0,0); - g_LightEnv.m_UnitsAmbientColor=RGBColor(0.4f,0.4f,0.4f); - g_Renderer.SetLightEnv(&g_LightEnv); - - // load the default - if (!LoadTerrain("terrain.raw")) return false; - - // get default texture to apply to terrain - CTextureEntry* texture=0; - for (uint i=0;im_MiniPatches[j][i].Tex1=texture ? texture->m_Handle : 0; - } - } - } - } - - // setup camera - InitCamera(); - - // build the terrain plane - float h=128*HEIGHT_SCALE; - u32 mapSize=g_Terrain.GetVerticesPerSide(); - CVector3D pt0(0,h,0),pt1(float(CELL_SIZE*mapSize),h,0),pt2(0,h,float(CELL_SIZE*mapSize)); - m_TerrainPlane.Set(pt0,pt1,pt2); - m_TerrainPlane.Normalize(); - - return true; -} - - -struct TGAHeader { - // header stuff - unsigned char iif_size; - unsigned char cmap_type; - unsigned char image_type; - unsigned char pad[5]; - - // origin : unused - unsigned short d_x_origin; - unsigned short d_y_origin; - - // dimensions - unsigned short width; - unsigned short height; - - // bits per pixel : 16, 24 or 32 - unsigned char bpp; - - // image descriptor : Bits 3-0: size of alpha channel - // Bit 4: must be 0 (reserved) - // Bit 5: should be 0 (origin) - // Bits 6-7: should be 0 (interleaving) - unsigned char image_descriptor; -}; - -static bool saveTGA(const char* filename,int width,int height,unsigned char* data) -{ - FILE* fp=fopen(filename,"wb"); - if (!fp) return false; - - // fill file header - TGAHeader header; - header.iif_size=0; - header.cmap_type=0; - header.image_type=2; - memset(header.pad,0,sizeof(header.pad)); - header.d_x_origin=0; - header.d_y_origin=0; - header.width=width; - header.height=height; - header.bpp=24; - header.image_descriptor=0; - - if (fwrite(&header,sizeof(TGAHeader),1,fp)!=1) { - fclose(fp); - return false; - } - - // write data - if (fwrite(data,width*height*3,1,fp)!=1) { - fclose(fp); - return false; - } - - // return success .. - fclose(fp); - return true; -} - -void CEditorData::LoadAlphaMaps() -{ - const char* fns[CRenderer::NumAlphaMaps] = { - "art/textures/terrain/alphamaps/special/blendcircle.png", - "art/textures/terrain/alphamaps/special/blendlshape.png", - "art/textures/terrain/alphamaps/special/blendedge.png", - "art/textures/terrain/alphamaps/special/blendedgecorner.png", - "art/textures/terrain/alphamaps/special/blendedgetwocorners.png", - "art/textures/terrain/alphamaps/special/blendfourcorners.png", - "art/textures/terrain/alphamaps/special/blendtwooppositecorners.png", - "art/textures/terrain/alphamaps/special/blendlshapecorner.png", - "art/textures/terrain/alphamaps/special/blendtwocorners.png", - "art/textures/terrain/alphamaps/special/blendcorner.png", - "art/textures/terrain/alphamaps/special/blendtwoedges.png", - "art/textures/terrain/alphamaps/special/blendthreecorners.png", - "art/textures/terrain/alphamaps/special/blendushape.png", - "art/textures/terrain/alphamaps/special/blendbad.png" - }; - - g_Renderer.LoadAlphaMaps(fns); -} - -void CEditorData::InitResources() -{ - g_TexMan.LoadTerrainTextures(); - LoadAlphaMaps(); - g_ObjMan.LoadObjects(); -} - -///////////////////////////////////////////////////////////////////////////////////////////////// -// InitSingletons: create and initialise required singletons -void CEditorData::InitSingletons() -{ - // create terrain related stuff - new CTextureManager; - - // create actor related stuff - new CSkeletonAnimManager; - new CObjectManager; - new CUnitManager; - - // create entity related stuff - new CBaseEntityCollection; - new CEntityManager; - g_EntityTemplateCollection.loadTemplates(); -} - -///////////////////////////////////////////////////////////////////////////////////////////////// -// Init: perform one time initialisation of the editor -bool CEditorData::Init() -{ - // create and initialise singletons - InitSingletons(); - - // load default textures - InitResources(); - - // create the scene - terrain, camera, light environment etc - if (!InitScene()) return false; - - // set up an empty minimap - g_MiniMap.Initialise(); - - // set up the info box - m_InfoBox.Initialise(); - - return true; -} - -///////////////////////////////////////////////////////////////////////////////////////////////// -// Terminate: close down the editor (destroy singletons in reverse order to construction) -void CEditorData::Terminate() -{ - // destroy entity related stuff - delete CEntityManager::GetSingletonPtr(); - delete CBaseEntityCollection::GetSingletonPtr(); - - // destroy actor related stuff - delete CUnitManager::GetSingletonPtr(); - delete CObjectManager::GetSingletonPtr(); - delete CSkeletonAnimManager::GetSingletonPtr(); - - // destroy terrain related stuff - delete CTextureManager::GetSingletonPtr(); -} - -void CEditorData::InitCamera() -{ - g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(90)); - g_NaviCam.GetCamera().m_Orientation.SetIdentity(); -#ifdef TOPDOWNVIEW - g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(90)); - g_NaviCam.GetCamera().m_Orientation.Translate(CELL_SIZE*250*0.5, 80, CELL_SIZE*250*0.5); -#else - g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(40)); - g_NaviCam.GetCamera().m_Orientation.RotateY(DEGTORAD(-45)); - g_NaviCam.GetCamera().m_Orientation.Translate(600, 200, 125); -#endif - - OnCameraChanged(); -} - -void CEditorData::OnCameraChanged() -{ - int width=g_Renderer.GetWidth(); - int height=g_Renderer.GetHeight(); - - // resize viewport - SViewPort viewport; - viewport.m_X=0; - viewport.m_Y=0; - viewport.m_Width=width; - viewport.m_Height=height; - g_NaviCam.GetCamera().SetViewPort(&viewport); - - // rebuild object camera - m_ObjectCamera.SetViewPort(&viewport); - m_ObjectCamera.SetProjection(1.0f,10000.0f,DEGTORAD(90)); - - - // recalculate projection matrix - g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(20)); - - // update viewing frustum - g_NaviCam.GetCamera().UpdateFrustum(); - - // calculate intersection of camera stabbing lines with terrain plane - - // get points of back plane of frustum in camera space - float aspect=height>0 ? float(width)/float(height) : 1.0f; - float zfar=g_NaviCam.GetCamera().GetFarPlane(); - CVector3D cPts[4]; - float x=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*aspect*0.5)); - float y=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*0.5)); - cPts[0].X=-x; - cPts[0].Y=-y; - cPts[0].Z=zfar; - cPts[1].X=x; - cPts[1].Y=-y; - cPts[1].Z=zfar; - cPts[2].X=x; - cPts[2].Y=y; - cPts[2].Z=zfar; - cPts[3].X=-x; - cPts[3].Y=y; - cPts[3].Z=zfar; - - // transform to world space - CVector3D wPts[4]; - for (int i=0;i<4;i++) { - wPts[i]=g_NaviCam.GetCamera().m_Orientation.Transform(cPts[i]); - } - - // now intersect a ray from the camera through each point - CVector3D rayOrigin=g_NaviCam.GetCamera().m_Orientation.GetTranslation(); - CVector3D rayDir=g_NaviCam.GetCamera().m_Orientation.GetIn(); - - CVector3D hitPt[4]; - for (i=0;i<4;i++) { - CVector3D rayDir=wPts[i]-rayOrigin; - rayDir.Normalize(); - - // get intersection point - m_TerrainPlane.FindRayIntersection(rayOrigin,rayDir,&hitPt[i]); - } - - for (i=0;i<4;i++) { - // convert to minimap space - float px=hitPt[i].X; - float pz=hitPt[i].Z; - g_MiniMap.m_ViewRect[i][0]=(197*px/float(CELL_SIZE*g_Terrain.GetVerticesPerSide())); - g_MiniMap.m_ViewRect[i][1]=197*pz/float(CELL_SIZE*g_Terrain.GetVerticesPerSide()); - } -} - -void CEditorData::RenderTerrain() -{ - CFrustum frustum=g_NaviCam.GetCamera().GetFustum(); - u32 patchesPerSide=g_Terrain.GetPatchesPerSide(); - for (uint j=0; jGetBounds())) { - g_Renderer.Submit(patch); - } - } - } -} - -void CEditorData::OnScreenShot(const char* filename) -{ - g_Renderer.SetClearColor(0); - g_Renderer.BeginFrame(); - g_Renderer.SetCamera(g_NaviCam.GetCamera()); - - RenderWorld(); - - g_Renderer.EndFrame(); - - int width=g_Renderer.GetWidth(); - int height=g_Renderer.GetHeight(); - unsigned char* data=new unsigned char[width*height*3]; - - glReadBuffer(GL_BACK); - glReadPixels(0,0,width,height,GL_BGR_EXT,GL_UNSIGNED_BYTE,data); - - saveTGA(filename,width,height,data); - - delete[] data; -} - -////////////////////////////////////////////////////////////////////////////////////////////////// -// SubmitModelRecursive: recurse down given model, submitting it and all it's descendents to the -// renderer -void SubmitModelRecursive(CModel* model) -{ - g_Renderer.Submit(model); - - const std::vector& props=model->GetProps(); - for (uint i=0;i& units=g_UnitMan.GetUnits(); - for (i=0;iGetModel()); - } - - u32 patchesPerSide=g_Terrain.GetPatchesPerSide(); - for (j=0; j& units=g_UnitMan.GetUnits(); - uint i; - for (i=0;iGetModel()->GetBounds())) { - SubmitModelRecursive(units[i]->GetModel()); - } - } -} - -void CEditorData::RenderWorld() -{ - // render terrain - RenderTerrain(); - - // render all the units - RenderModels(); - - // flush prior to rendering overlays etc - g_Renderer.FlushFrame(); -} - -void CEditorData::RenderObEdGrid() -{ - int i; - const int numSteps=32; - const CVector3D start(-numSteps*CELL_SIZE/2,0,-numSteps*CELL_SIZE/2); - const CVector3D end(numSteps*CELL_SIZE/2,0,numSteps*CELL_SIZE/2); - - glDisable(GL_TEXTURE_2D); - - glDepthMask(0); - glColor4f(0.5f,0.5f,0.5f,0.35f); - glLineWidth(1.0f); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - - glBegin(GL_LINES); - for (i=0;i<=numSteps;i++) { - if (i%8==0) continue; - CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z); - glVertex3fv(&v0.X); - - CVector3D v1(v0.X,end.Y,end.Z); - glVertex3fv(&v1.X); - } - - for (i=0;i<=numSteps;i++) { - if (i%8==0) continue; - CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps)); - glVertex3fv(&v0.X); - - CVector3D v1(end.X,end.Y,v0.Z); - glVertex3fv(&v1.X); - } - glEnd(); - - glDisable(GL_BLEND); - - glColor3f(0,0,0.5); - glLineWidth(2.0f); - - glBegin(GL_LINES); - for (i=0;i<=numSteps;i+=8) { - CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z); - glVertex3fv(&v0.X); - - CVector3D v1(v0.X,end.Y,end.Z); - glVertex3fv(&v1.X); - } - - for (i=0;i<=numSteps;i+=8) { - CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps)); - glVertex3fv(&v0.X); - - CVector3D v1(end.X,end.Y,v0.Z); - glVertex3fv(&v1.X); - } - glEnd(); - glDepthMask(1); -} - -void CEditorData::OnDraw() -{ - if (m_Mode==SCENARIO_EDIT || m_Mode==TEST_MODE) { - g_Renderer.SetClearColor(0); - g_Renderer.BeginFrame(); - - // setup camera - g_Renderer.SetCamera(g_NaviCam.GetCamera()); - - // render base terrain plus models - RenderWorld(); - - if (m_Mode!=TEST_MODE) { - // render the active tool - g_ToolMan.OnDraw(); - } - - // flush prior to rendering overlays .. - g_Renderer.FlushFrame(); - - // .. and here's the overlays - g_MiniMap.Render(); - m_InfoBox.Render(); - } else { - g_Renderer.SetClearColor(0x00453015); - g_Renderer.BeginFrame(); - - CObjectEntry* selobject=g_ObjMan.GetSelectedObject(); - if (selobject && selobject->m_Model) { - // setup camera such that object is in the centre of the viewport - m_ModelMatrix.SetIdentity(); - selobject->m_Model->SetTransform(m_ModelMatrix); - - const CBound& bound=selobject->m_Model->GetBounds(); - CVector3D pt((bound[0].X+bound[1].X)*0.5f,(bound[0].Y+bound[1].Y)*0.5f,bound[0].Z); - - float hfov=tan(DEGTORAD(45)); - float vfov=hfov/g_Renderer.GetAspect(); - float zx=(bound[1].X-bound[0].X)*0.5f/hfov; - float zy=(bound[1].Y-bound[0].Y)*0.5f/vfov; - float z=zx>zy ? zx : zy; - z=(z+1)*2; - - m_ObjectCamera.m_Orientation.SetIdentity(); - m_ObjectCamera.m_Orientation.Translate(pt.X,pt.Y,-z); - - g_Renderer.SetCamera(m_ObjectCamera); - - RenderObEdGrid(); - - g_Renderer.Submit(selobject->m_Model); - } - - // flush prior to rendering overlays .. - g_Renderer.FlushFrame(); - - // .. and here's the overlays - m_InfoBox.Render(); - } - - g_Renderer.EndFrame(); - - // notify info box frame is complete; gives it chance to accumulate stats, check - // fps, etc - m_InfoBox.OnFrameComplete(); -} - - -bool CEditorData::LoadTerrain(const char* filename) -{ - Handle h = tex_load(filename); - if(h<=0) { - char buf[1024]; - sprintf(buf,"Failed to load \"%s\"",filename); - ErrorBox(buf); - return false; - } else { - - int width=0; - int height=0; - int bpp=0; - void *ptr=0; - - int i=tex_info(h, &width, &height, NULL, &bpp, &ptr); - if (i) - { - printf("tex_info error: %d\n",i); - fflush(stdout); - } - - // rescale the texture to fit to the nearest of the 4 possible map sizes - u32 mapsize=9; // assume smallest map - if (width>11*16+1) mapsize=11; - if (width>13*16+1) mapsize=13; - if (width>17*16+1) mapsize=17; - - u32 targetsize=mapsize*16+1; - unsigned char* data=new unsigned char[targetsize*targetsize*bpp/8]; - u32 fmt=(bpp==8) ? GL_RED : ((bpp==24) ? GL_RGB : GL_RGBA); - gluScaleImage(fmt,width,height,GL_UNSIGNED_BYTE,ptr, - targetsize,targetsize,GL_UNSIGNED_BYTE,data); - - // build 16 bit heightmap from red channel of texture - u16* heightmap=new u16[targetsize*targetsize]; - int stride=bpp/8; - u16* hmptr=heightmap; - - // get src of copy - const u8* dataptr = (bpp==8) ? data : ((bpp==24) ? data+2 : data+3); - - // build heightmap - for (uint j=0;j& units=g_UnitMan.GetUnits(); - for (uint i=0;iGetModel()->Update(time); - } - if (m_Mode==TEST_MODE) { - g_EntityManager.updateAll( time ); - } - } else { - CObjectEntry* selobject=g_ObjMan.GetSelectedObject(); - if (selobject && selobject->m_Model) { - selobject->m_Model->Update(time); - } - } -} - -void CEditorData::StartTestMode() -{ - // initialise entities - g_EntityManager.dispatchAll( &CMessage( CMessage::EMSG_INIT ) ); -} - -void CEditorData::StopTestMode() -{ - // make all units idle again - const std::vector& units=g_UnitMan.GetUnits(); - for (uint i=0;iGetObject()->m_IdleAnim) { - units[i]->GetModel()->SetAnimation(units[i]->GetObject()->m_IdleAnim); - } - } +#include "EditorData.h" +#include "UIGlobals.h" +#include "ToolManager.h" +#include "ObjectManager.h" +#include "UnitManager.h" +#include "TextureManager.h" +#include "Model.h" +#include "SkeletonAnimManager.h" + +#include "ogl.h" +#include "res/tex.h" +#include "time.h" + +#include "BaseEntityCollection.h" +#include "Entity.h" +#include "EntityHandles.h" +#include "EntityManager.h" + +#include "XML.h" + +const int NUM_ALPHA_MAPS = 14; +Handle AlphaMaps[NUM_ALPHA_MAPS]; + +CTerrain g_Terrain; +CLightEnv g_LightEnv; +CMiniMap g_MiniMap; +CEditorData g_EditorData; + +CEditorData::CEditorData() +{ + m_ModelMatrix.SetIdentity(); + m_ScenarioName="Scenario01"; +} + +void CEditorData::SetMode(EditMode mode) +{ + if (m_Mode==TEST_MODE && mode!=TEST_MODE) StopTestMode(); + m_Mode=mode; + if (m_Mode==TEST_MODE) StartTestMode(); +} + +bool CEditorData::InitScene() +{ + // setup default lighting environment + g_LightEnv.m_SunColor=RGBColor(1,1,1); + g_LightEnv.m_Rotation=DEGTORAD(270); + g_LightEnv.m_Elevation=DEGTORAD(45); + g_LightEnv.m_TerrainAmbientColor=RGBColor(0,0,0); + g_LightEnv.m_UnitsAmbientColor=RGBColor(0.4f,0.4f,0.4f); + g_Renderer.SetLightEnv(&g_LightEnv); + + // load the default + if (!LoadTerrain("terrain.raw")) return false; + + // get default texture to apply to terrain + CTextureEntry* texture=0; + for (uint i=0;im_MiniPatches[j][i].Tex1=texture ? texture->GetHandle() : 0; + } + } + } + } + + // setup camera + InitCamera(); + + // build the terrain plane + float h=128*HEIGHT_SCALE; + u32 mapSize=g_Terrain.GetVerticesPerSide(); + CVector3D pt0(0,h,0),pt1(float(CELL_SIZE*mapSize),h,0),pt2(0,h,float(CELL_SIZE*mapSize)); + m_TerrainPlane.Set(pt0,pt1,pt2); + m_TerrainPlane.Normalize(); + + return true; +} + + +struct TGAHeader { + // header stuff + unsigned char iif_size; + unsigned char cmap_type; + unsigned char image_type; + unsigned char pad[5]; + + // origin : unused + unsigned short d_x_origin; + unsigned short d_y_origin; + + // dimensions + unsigned short width; + unsigned short height; + + // bits per pixel : 16, 24 or 32 + unsigned char bpp; + + // image descriptor : Bits 3-0: size of alpha channel + // Bit 4: must be 0 (reserved) + // Bit 5: should be 0 (origin) + // Bits 6-7: should be 0 (interleaving) + unsigned char image_descriptor; +}; + +static bool saveTGA(const char* filename,int width,int height,unsigned char* data) +{ + FILE* fp=fopen(filename,"wb"); + if (!fp) return false; + + // fill file header + TGAHeader header; + header.iif_size=0; + header.cmap_type=0; + header.image_type=2; + memset(header.pad,0,sizeof(header.pad)); + header.d_x_origin=0; + header.d_y_origin=0; + header.width=width; + header.height=height; + header.bpp=24; + header.image_descriptor=0; + + if (fwrite(&header,sizeof(TGAHeader),1,fp)!=1) { + fclose(fp); + return false; + } + + // write data + if (fwrite(data,width*height*3,1,fp)!=1) { + fclose(fp); + return false; + } + + // return success .. + fclose(fp); + return true; +} + +void CEditorData::LoadAlphaMaps() +{ + const char* fns[CRenderer::NumAlphaMaps] = { + "art/textures/terrain/alphamaps/special/blendcircle.png", + "art/textures/terrain/alphamaps/special/blendlshape.png", + "art/textures/terrain/alphamaps/special/blendedge.png", + "art/textures/terrain/alphamaps/special/blendedgecorner.png", + "art/textures/terrain/alphamaps/special/blendedgetwocorners.png", + "art/textures/terrain/alphamaps/special/blendfourcorners.png", + "art/textures/terrain/alphamaps/special/blendtwooppositecorners.png", + "art/textures/terrain/alphamaps/special/blendlshapecorner.png", + "art/textures/terrain/alphamaps/special/blendtwocorners.png", + "art/textures/terrain/alphamaps/special/blendcorner.png", + "art/textures/terrain/alphamaps/special/blendtwoedges.png", + "art/textures/terrain/alphamaps/special/blendthreecorners.png", + "art/textures/terrain/alphamaps/special/blendushape.png", + "art/textures/terrain/alphamaps/special/blendbad.png" + }; + + g_Renderer.LoadAlphaMaps(fns); +} + +void CEditorData::InitResources() +{ + g_TexMan.LoadTerrainTextures(); + LoadAlphaMaps(); + g_ObjMan.LoadObjects(); +} + +///////////////////////////////////////////////////////////////////////////////////////////////// +// InitSingletons: create and initialise required singletons +void CEditorData::InitSingletons() +{ + // create terrain related stuff + new CTextureManager; + + // create actor related stuff + new CSkeletonAnimManager; + new CObjectManager; + new CUnitManager; + + // create entity related stuff + new CBaseEntityCollection; + new CEntityManager; + g_EntityTemplateCollection.loadTemplates(); +} + +///////////////////////////////////////////////////////////////////////////////////////////////// +// Init: perform one time initialisation of the editor +bool CEditorData::Init() +{ + // start up Xerces + XMLPlatformUtils::Initialize(); + + // create and initialise singletons + InitSingletons(); + + // load default textures + InitResources(); + + // create the scene - terrain, camera, light environment etc + if (!InitScene()) return false; + + // set up an empty minimap + g_MiniMap.Initialise(); + + // set up the info box + m_InfoBox.Initialise(); + + return true; +} + +///////////////////////////////////////////////////////////////////////////////////////////////// +// Terminate: close down the editor (destroy singletons in reverse order to construction) +void CEditorData::Terminate() +{ + // destroy entity related stuff + delete CEntityManager::GetSingletonPtr(); + delete CBaseEntityCollection::GetSingletonPtr(); + + // destroy actor related stuff + delete CUnitManager::GetSingletonPtr(); + delete CObjectManager::GetSingletonPtr(); + delete CSkeletonAnimManager::GetSingletonPtr(); + + // destroy terrain related stuff + delete CTextureManager::GetSingletonPtr(); + + // close down Xerces + XMLPlatformUtils::Terminate(); +} + +void CEditorData::InitCamera() +{ + g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(90)); + g_NaviCam.GetCamera().m_Orientation.SetIdentity(); +#ifdef TOPDOWNVIEW + g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(90)); + g_NaviCam.GetCamera().m_Orientation.Translate(CELL_SIZE*250*0.5, 80, CELL_SIZE*250*0.5); +#else + g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(40)); + g_NaviCam.GetCamera().m_Orientation.RotateY(DEGTORAD(-45)); + g_NaviCam.GetCamera().m_Orientation.Translate(600, 200, 125); +#endif + + OnCameraChanged(); +} + +void CEditorData::OnCameraChanged() +{ + int width=g_Renderer.GetWidth(); + int height=g_Renderer.GetHeight(); + + // resize viewport + SViewPort viewport; + viewport.m_X=0; + viewport.m_Y=0; + viewport.m_Width=width; + viewport.m_Height=height; + g_NaviCam.GetCamera().SetViewPort(&viewport); + + // rebuild object camera + m_ObjectCamera.SetViewPort(&viewport); + m_ObjectCamera.SetProjection(1.0f,10000.0f,DEGTORAD(90)); + + + // recalculate projection matrix + g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(20)); + + // update viewing frustum + g_NaviCam.GetCamera().UpdateFrustum(); + + // calculate intersection of camera stabbing lines with terrain plane + + // get points of back plane of frustum in camera space + float aspect=height>0 ? float(width)/float(height) : 1.0f; + float zfar=g_NaviCam.GetCamera().GetFarPlane(); + CVector3D cPts[4]; + float x=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*aspect*0.5)); + float y=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*0.5)); + cPts[0].X=-x; + cPts[0].Y=-y; + cPts[0].Z=zfar; + cPts[1].X=x; + cPts[1].Y=-y; + cPts[1].Z=zfar; + cPts[2].X=x; + cPts[2].Y=y; + cPts[2].Z=zfar; + cPts[3].X=-x; + cPts[3].Y=y; + cPts[3].Z=zfar; + + // transform to world space + CVector3D wPts[4]; + for (int i=0;i<4;i++) { + wPts[i]=g_NaviCam.GetCamera().m_Orientation.Transform(cPts[i]); + } + + // now intersect a ray from the camera through each point + CVector3D rayOrigin=g_NaviCam.GetCamera().m_Orientation.GetTranslation(); + CVector3D rayDir=g_NaviCam.GetCamera().m_Orientation.GetIn(); + + CVector3D hitPt[4]; + for (i=0;i<4;i++) { + CVector3D rayDir=wPts[i]-rayOrigin; + rayDir.Normalize(); + + // get intersection point + m_TerrainPlane.FindRayIntersection(rayOrigin,rayDir,&hitPt[i]); + } + + for (i=0;i<4;i++) { + // convert to minimap space + float px=hitPt[i].X; + float pz=hitPt[i].Z; + g_MiniMap.m_ViewRect[i][0]=(197*px/float(CELL_SIZE*g_Terrain.GetVerticesPerSide())); + g_MiniMap.m_ViewRect[i][1]=197*pz/float(CELL_SIZE*g_Terrain.GetVerticesPerSide()); + } +} + +void CEditorData::RenderTerrain() +{ + CFrustum frustum=g_NaviCam.GetCamera().GetFustum(); + u32 patchesPerSide=g_Terrain.GetPatchesPerSide(); + for (uint j=0; jGetBounds())) { + g_Renderer.Submit(patch); + } + } + } +} + +void CEditorData::OnScreenShot(const char* filename) +{ + g_Renderer.SetClearColor(0); + g_Renderer.BeginFrame(); + g_Renderer.SetCamera(g_NaviCam.GetCamera()); + + RenderWorld(); + + g_Renderer.EndFrame(); + + int width=g_Renderer.GetWidth(); + int height=g_Renderer.GetHeight(); + unsigned char* data=new unsigned char[width*height*3]; + + glReadBuffer(GL_BACK); + glReadPixels(0,0,width,height,GL_BGR_EXT,GL_UNSIGNED_BYTE,data); + + saveTGA(filename,width,height,data); + + delete[] data; +} + +////////////////////////////////////////////////////////////////////////////////////////////////// +// SubmitModelRecursive: recurse down given model, submitting it and all it's descendents to the +// renderer +void SubmitModelRecursive(CModel* model) +{ + g_Renderer.Submit(model); + + const std::vector& props=model->GetProps(); + for (uint i=0;i& units=g_UnitMan.GetUnits(); + for (i=0;iGetModel()); + } + + u32 patchesPerSide=g_Terrain.GetPatchesPerSide(); + for (j=0; j& units=g_UnitMan.GetUnits(); + uint i; + for (i=0;iGetModel()->GetBounds())) { + SubmitModelRecursive(units[i]->GetModel()); + } + } +} + +void CEditorData::RenderWorld() +{ + // render terrain + RenderTerrain(); + + // render all the units + RenderModels(); + + // flush prior to rendering overlays etc + g_Renderer.FlushFrame(); +} + +void CEditorData::RenderObEdGrid() +{ + int i; + const int numSteps=32; + const CVector3D start(-numSteps*CELL_SIZE/2,0,-numSteps*CELL_SIZE/2); + const CVector3D end(numSteps*CELL_SIZE/2,0,numSteps*CELL_SIZE/2); + + glDisable(GL_TEXTURE_2D); + + glDepthMask(0); + glColor4f(0.5f,0.5f,0.5f,0.35f); + glLineWidth(1.0f); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + + glBegin(GL_LINES); + for (i=0;i<=numSteps;i++) { + if (i%8==0) continue; + CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z); + glVertex3fv(&v0.X); + + CVector3D v1(v0.X,end.Y,end.Z); + glVertex3fv(&v1.X); + } + + for (i=0;i<=numSteps;i++) { + if (i%8==0) continue; + CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps)); + glVertex3fv(&v0.X); + + CVector3D v1(end.X,end.Y,v0.Z); + glVertex3fv(&v1.X); + } + glEnd(); + + glDisable(GL_BLEND); + + glColor3f(0,0,0.5); + glLineWidth(2.0f); + + glBegin(GL_LINES); + for (i=0;i<=numSteps;i+=8) { + CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z); + glVertex3fv(&v0.X); + + CVector3D v1(v0.X,end.Y,end.Z); + glVertex3fv(&v1.X); + } + + for (i=0;i<=numSteps;i+=8) { + CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps)); + glVertex3fv(&v0.X); + + CVector3D v1(end.X,end.Y,v0.Z); + glVertex3fv(&v1.X); + } + glEnd(); + glDepthMask(1); +} + +void CEditorData::OnDraw() +{ + if (m_Mode==SCENARIO_EDIT || m_Mode==TEST_MODE) { + g_Renderer.SetClearColor(0); + g_Renderer.BeginFrame(); + + // setup camera + g_Renderer.SetCamera(g_NaviCam.GetCamera()); + + // render base terrain plus models + RenderWorld(); + + if (m_Mode!=TEST_MODE) { + // render the active tool + g_ToolMan.OnDraw(); + } + + // flush prior to rendering overlays .. + g_Renderer.FlushFrame(); + + // .. and here's the overlays + g_MiniMap.Render(); + m_InfoBox.Render(); + } else { + g_Renderer.SetClearColor(0x00453015); + g_Renderer.BeginFrame(); + + CObjectEntry* selobject=g_ObjMan.GetSelectedObject(); + if (selobject && selobject->m_Model) { + // setup camera such that object is in the centre of the viewport + m_ModelMatrix.SetIdentity(); + selobject->m_Model->SetTransform(m_ModelMatrix); + + const CBound& bound=selobject->m_Model->GetBounds(); + CVector3D pt((bound[0].X+bound[1].X)*0.5f,(bound[0].Y+bound[1].Y)*0.5f,bound[0].Z); + + float hfov=tan(DEGTORAD(45)); + float vfov=hfov/g_Renderer.GetAspect(); + float zx=(bound[1].X-bound[0].X)*0.5f/hfov; + float zy=(bound[1].Y-bound[0].Y)*0.5f/vfov; + float z=zx>zy ? zx : zy; + z=(z+1)*2; + + m_ObjectCamera.m_Orientation.SetIdentity(); + m_ObjectCamera.m_Orientation.Translate(pt.X,pt.Y,-z); + + g_Renderer.SetCamera(m_ObjectCamera); + + RenderObEdGrid(); + + g_Renderer.Submit(selobject->m_Model); + } + + // flush prior to rendering overlays .. + g_Renderer.FlushFrame(); + + // .. and here's the overlays + m_InfoBox.Render(); + } + + g_Renderer.EndFrame(); + + // notify info box frame is complete; gives it chance to accumulate stats, check + // fps, etc + m_InfoBox.OnFrameComplete(); +} + + +bool CEditorData::LoadTerrain(const char* filename) +{ + Handle h = tex_load(filename); + if(h<=0) { + char buf[1024]; + sprintf(buf,"Failed to load \"%s\"",filename); + ErrorBox(buf); + return false; + } else { + + int width=0; + int height=0; + int bpp=0; + void *ptr=0; + + int i=tex_info(h, &width, &height, NULL, &bpp, &ptr); + if (i) + { + printf("tex_info error: %d\n",i); + fflush(stdout); + } + + // rescale the texture to fit to the nearest of the 4 possible map sizes + u32 mapsize=9; // assume smallest map + if (width>11*PATCH_SIZE+1) mapsize=11; + if (width>13*PATCH_SIZE+1) mapsize=13; + if (width>17*PATCH_SIZE+1) mapsize=17; + + u32 targetsize=mapsize*PATCH_SIZE+1; + unsigned char* data=new unsigned char[targetsize*targetsize*bpp/8]; + u32 fmt=(bpp==8) ? GL_RED : ((bpp==24) ? GL_RGB : GL_RGBA); + gluScaleImage(fmt,width,height,GL_UNSIGNED_BYTE,ptr, + targetsize,targetsize,GL_UNSIGNED_BYTE,data); + + // build 16 bit heightmap from red channel of texture + u16* heightmap=new u16[targetsize*targetsize]; + int stride=bpp/8; + u16* hmptr=heightmap; + + // get src of copy + const u8* dataptr = (bpp==8) ? data : ((bpp==24) ? data+2 : data+3); + + // build heightmap + for (uint j=0;j& units=g_UnitMan.GetUnits(); + for (uint i=0;iGetModel()->Update(time); + } + if (m_Mode==TEST_MODE) { + g_EntityManager.updateAll( time ); + } + } else { + CObjectEntry* selobject=g_ObjMan.GetSelectedObject(); + if (selobject && selobject->m_Model) { + selobject->m_Model->Update(time); + } + } +} + +void CEditorData::StartTestMode() +{ + // initialise entities + g_EntityManager.dispatchAll( &CMessage( CMessage::EMSG_INIT ) ); +} + +void CEditorData::StopTestMode() +{ + // make all units idle again + const std::vector& units=g_UnitMan.GetUnits(); + for (uint i=0;iGetObject()->m_IdleAnim) { + units[i]->GetModel()->SetAnimation(units[i]->GetObject()->m_IdleAnim); + } + } } \ No newline at end of file diff --git a/source/sced/InfoBox.cpp b/source/sced/InfoBox.cpp index e75dc61966..5e5c23ad68 100755 --- a/source/sced/InfoBox.cpp +++ b/source/sced/InfoBox.cpp @@ -188,7 +188,7 @@ void CInfoBox::RenderInfo() render(&fttext); y-=dy; - u32 totalTris=m_LastStats.m_TerrainTris+m_LastStats.m_ModelTris+m_LastStats.m_TransparentTris; + u32 totalTris=m_LastStats.m_TerrainTris+m_LastStats.m_ModelTris; sprintf(buf,"TPF: %d",int(totalTris/m_LastStats.m_Counter)); COverlayText tpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1)); render(&tpftext); @@ -204,11 +204,6 @@ void CInfoBox::RenderInfo() render(&mtpftext); y-=dy; - sprintf(buf,"TrTPF: %d",int(m_LastStats.m_TransparentTris/m_LastStats.m_Counter)); - COverlayText trtpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1)); - render(&trtpftext); - y-=dy; - sprintf(buf,"DCPF: %d",int(m_LastStats.m_DrawCalls/m_LastStats.m_Counter)); COverlayText dcpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1)); render(&dcpftext); diff --git a/source/sced/MiniMap.cpp b/source/sced/MiniMap.cpp index fc331fb677..c3ea7838cf 100755 --- a/source/sced/MiniMap.cpp +++ b/source/sced/MiniMap.cpp @@ -6,6 +6,67 @@ #include "ogl.h" extern CTerrain g_Terrain; + +struct TGAHeader { + // header stuff + unsigned char iif_size; + unsigned char cmap_type; + unsigned char image_type; + unsigned char pad[5]; + + // origin : unused + unsigned short d_x_origin; + unsigned short d_y_origin; + + // dimensions + unsigned short width; + unsigned short height; + + // bits per pixel : 16, 24 or 32 + unsigned char bpp; + + // image descriptor : Bits 3-0: size of alpha channel + // Bit 4: must be 0 (reserved) + // Bit 5: should be 0 (origin) + // Bits 6-7: should be 0 (interleaving) + unsigned char image_descriptor; +}; + +static bool saveTGA(const char* filename,int width,int height,int bpp,unsigned char* data) +{ + FILE* fp=fopen(filename,"wb"); + if (!fp) return false; + + // fill file header + TGAHeader header; + header.iif_size=0; + header.cmap_type=0; + header.image_type=2; + memset(header.pad,0,sizeof(header.pad)); + header.d_x_origin=0; + header.d_y_origin=0; + header.width=width; + header.height=height; + header.bpp=bpp; + header.image_descriptor=(bpp==32) ? 8 : 0; + + if (fwrite(&header,sizeof(TGAHeader),1,fp)!=1) { + fclose(fp); + return false; + } + + // write data + if (fwrite(data,width*height*bpp/8,1,fp)!=1) { + fclose(fp); + return false; + } + + // return success .. + fclose(fp); + return true; +} + + static unsigned int ScaleColor(unsigned int color,float x) { @@ -25,7 +86,7 @@ static int RoundUpToPowerOf2(int x) return d<<1; } -CMiniMap::CMiniMap() : m_Handle(0) +CMiniMap::CMiniMap() : m_Handle(0), m_Data(0), m_Size(0) { } @@ -33,16 +94,21 @@ void CMiniMap::Initialise() { // get rid of existing texture, if we've got one if (m_Handle) { - glDeleteTextures(1,&m_Handle); + glDeleteTextures(1,(GLuint*) &m_Handle); + delete[] m_Data; } // allocate a handle, bind to it - glGenTextures(1,&m_Handle); + glGenTextures(1,(GLuint*) &m_Handle); g_Renderer.BindTexture(0,m_Handle); // allocate an image big enough to fit the entire map into - m_Size=RoundUpToPowerOf2(g_Terrain.GetVerticesPerSide()); + m_Size=RoundUpToPowerOf2(g_Terrain.GetVerticesPerSide()); + u32 mapSize=g_Terrain.GetVerticesPerSide(); glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,m_Size,m_Size,0,GL_BGRA_EXT,GL_UNSIGNED_BYTE,0); + + // allocate local copy + m_Data=new u32[(mapSize-1)*(mapSize-1)]; // set texture parameters glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); @@ -73,7 +139,7 @@ void CMiniMap::Render() int h=g_Renderer.GetHeight(); glOrtho(0,w,0,h,-1,1); - // bind to the minimap + // bind to the minimap g_Renderer.BindTexture(0,m_Handle); glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); @@ -135,31 +201,24 @@ void CMiniMap::Render() void CMiniMap::Update(int x,int y,unsigned int color) { - // bind to the minimap - g_Renderer.BindTexture(0,m_Handle); - // get height at this pixel int hmap=(int) g_Terrain.GetHeightMap()[y*g_Terrain.GetVerticesPerSide() + x]>>8; // shift from 0-255 to 170-255 int val=(hmap/3)+170; // get modulated color - unsigned int mcolor=ScaleColor(color,float(val)/255.0f); - - // subimage to update pixel (ugh) - glTexSubImage2D(GL_TEXTURE_2D,0,x,y,1,1,GL_BGRA_EXT,GL_UNSIGNED_BYTE,&mcolor); + u32 mapSize=g_Terrain.GetVerticesPerSide(); + *(m_Data+(y*(mapSize-1)+x))=ScaleColor(color,float(val)/255.0f); + + UpdateTexture(); } void CMiniMap::Update(int x,int y,int w,int h,unsigned int color) { - // bind to the minimap - g_Renderer.BindTexture(0,m_Handle); - - u32 mapSize=g_Terrain.GetVerticesPerSide(); - unsigned int* data=new unsigned int[w*h]; - unsigned int* dataptr=data; + u32 mapSize=g_Terrain.GetVerticesPerSide(); for (int j=0;j>8; @@ -169,68 +228,33 @@ void CMiniMap::Update(int x,int y,int w,int h,unsigned int color) *dataptr++=ScaleColor(color,float(val)/255.0f); } } - - // subimage to update pixels - glTexSubImage2D(GL_TEXTURE_2D,0,x,y,w,h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data); - delete[] data; + + UpdateTexture(); } void CMiniMap::Rebuild() -{ - // bind to the minimap - g_Renderer.BindTexture(0,m_Handle); - - u32 mapSize=g_Terrain.GetVerticesPerSide(); - unsigned int* data=new unsigned int[(mapSize-1)*(mapSize-1)]; - unsigned int* dataptr=data; - - for (uint pj=0; pjTex1 ? g_TexMan.FindTexture(mp->Tex1) : 0; - color=tex ? tex->m_BaseColor : 0xffffffff; - } else { - color=0xffffffff; - } - - // get height at this pixel - int hmap=int(g_Terrain.GetHeightMap()[j*mapSize + i])>>8; - // shift from 0-255 to 170-255 - int val=(hmap/3)+170; - // load scaled color into data pointer - *dataptr++=ScaleColor(color,float(val)/255.0f); - } - } - } - } - - // subimage to update pixels - glTexSubImage2D(GL_TEXTURE_2D,0,0,0,(mapSize-1),(mapSize-1),GL_BGRA_EXT,GL_UNSIGNED_BYTE,data); - delete[] data; +{ + u32 mapSize=g_Terrain.GetVerticesPerSide(); + Rebuild(0,0,mapSize-1,mapSize-1); } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// UpdateTexture: send data to GL; update stored texture data +void CMiniMap::UpdateTexture() +{ + // bind to the minimap + g_Renderer.BindTexture(0,m_Handle); + // subimage to update pixels + u32 mapSize=g_Terrain.GetVerticesPerSide(); + glTexSubImage2D(GL_TEXTURE_2D,0,0,0,mapSize-1,mapSize-1,GL_BGRA_EXT,GL_UNSIGNED_BYTE,m_Data); +} void CMiniMap::Rebuild(int x,int y,int w,int h) { - // bind to the minimap - g_Renderer.BindTexture(0,m_Handle); - u32 mapSize=g_Terrain.GetVerticesPerSide(); - unsigned int* data=new unsigned int[w*h]; - unsigned int* dataptr=data; for (int j=0;j>8; @@ -243,7 +267,7 @@ void CMiniMap::Rebuild(int x,int y,int w,int h) if (mp) { // get texture on this time CTextureEntry* tex=mp->Tex1 ? g_TexMan.FindTexture(mp->Tex1) : 0; - color=tex ? tex->m_BaseColor : 0xffffffff; + color=tex ? tex->GetBaseColor() : 0xffffffff; } else { color=0xffffffff; } @@ -252,8 +276,6 @@ void CMiniMap::Rebuild(int x,int y,int w,int h) *dataptr++=ScaleColor(color,float(val)/255.0f); } } - - // subimage to update pixels - glTexSubImage2D(GL_TEXTURE_2D,0,x,y,w,h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data); - delete[] data; + + UpdateTexture(); } diff --git a/source/sced/MiniMap.h b/source/sced/MiniMap.h index b1b5accad2..740f4f05f7 100755 --- a/source/sced/MiniMap.h +++ b/source/sced/MiniMap.h @@ -1,5 +1,7 @@ #ifndef _MINIMAP_H #define _MINIMAP_H + +#include "lib.h" class CMiniMap { @@ -16,11 +18,15 @@ public: // current viewing frustum, in minimap coordinate space float m_ViewRect[4][2]; -private: +private: + // send data to GL; update stored texture data + void UpdateTexture(); // texture handle - unsigned int m_Handle; + u32 m_Handle; // size of the map texture - unsigned int m_Size; + u32 m_Size; + // raw BGRA_EXT data for the minimap + u32* m_Data; }; extern CMiniMap g_MiniMap; diff --git a/source/sced/PaintTextureCommand.cpp b/source/sced/PaintTextureCommand.cpp index 5d36f28705..1d3a71d49f 100755 --- a/source/sced/PaintTextureCommand.cpp +++ b/source/sced/PaintTextureCommand.cpp @@ -48,17 +48,17 @@ void CPaintTextureCommand::Execute() CMiniPatch* nmp=g_Terrain.GetTile(i,j); if (nmp) { - nmp->Tex1=m_Texture ? m_Texture->m_Handle : 0; - nmp->Tex1Priority=m_Texture ? ((int) m_Texture->m_Type) : 0; + nmp->Tex1=m_Texture ? m_Texture->GetHandle() : 0; + nmp->Tex1Priority=m_Texture ? ((int) m_Texture->GetType()) : 0; } } } // invalidate affected patches - int px0=clamp(-1+(x0/16),0,patchesPerSide); - int px1=clamp(1+(x1/16),0,patchesPerSide); - int pz0=clamp(-1+(z0/16),0,patchesPerSide); - int pz1=clamp(1+(z1/16),0,patchesPerSide); + int px0=clamp(-1+(x0/PATCH_SIZE),0,patchesPerSide); + int px1=clamp(1+(x1/PATCH_SIZE),0,patchesPerSide); + int pz0=clamp(-1+(z0/PATCH_SIZE),0,patchesPerSide); + int pz1=clamp(1+(z1/PATCH_SIZE),0,patchesPerSide); for (j=pz0;j +#include +#include "lib.h" #include "res/res.h" #include "BrushTool.h" @@ -41,11 +42,11 @@ public: private: // raise/lower the currently selected terrain tiles by given amount - void AlterSelectionHeight(int32 amount); + void AlterSelectionHeight(i32 amount); // calculate distance terrain has moved since last trigger; adjust last trigger // time appropriately to avoid rounding errors - int32 CalcDistSinceLastTrigger(); + i32 CalcDistSinceLastTrigger(); // number of units to raise/lower selected terrain tiles per second int m_Speed; diff --git a/source/sced/ScEd.dsp b/source/sced/ScEd.dsp index 9ed71a6944..c32a851cfd 100755 --- a/source/sced/ScEd.dsp +++ b/source/sced/ScEd.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /G5 /MT /W3 /GX /O2 /Ob0 /I "..\\" /I "..\lib" /I "..\ps" /I "..\simulation" /I "..\maths" /I "..\graphics" /I "..\renderer" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_NO_WINMAIN_" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GR- /GX /Zi /O2 /Ob2 /I "..\\" /I "..\lib" /I "..\ps" /I "..\simulation" /I "..\maths" /I "..\graphics" /I "..\renderer" /I ".\\" /I ".\ui" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_NO_WINMAIN_" /D "_WGL_H_INCLUDED" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -54,8 +54,8 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 nafxcw.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2.lib /nologo /entry:"entry" /subsystem:windows /map /machine:I386 /out:"D:\0ad\binaries\system\ScEd.exe" /libpath:"..\libs" /fixed:no -# SUBTRACT LINK32 /pdb:none /debug +# ADD LINK32 nafxcw.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2.lib /nologo /entry:"entry" /subsystem:windows /map /debug /machine:I386 /out:"D:\0ad\binaries\system\ScEd.exe" /libpath:"..\libs" /fixed:no +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "ScEd - Win32 Debug" @@ -71,7 +71,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /G5 /MTd /W3 /Gm /Gi /GX /Zi /Od /I "..\\" /I "..\lib" /I "..\ps" /I "..\simulation" /I "..\maths" /I "..\graphics" /I "..\renderer" /D "_DEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_NO_WINMAIN_" /FD /GZ /c +# ADD CPP /nologo /G5 /MTd /W3 /Gm /Gi /GX /Zi /Od /I "..\\" /I "..\lib" /I "..\ps" /I "..\simulation" /I "..\maths" /I "..\graphics" /I "..\renderer" /I ".\\" /I ".\ui" /D "_DEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_NO_WINMAIN_" /D "_WGL_H_INCLUDED" /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -82,7 +82,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 nafxcwd.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2D.lib /nologo /entry:"entry" /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"D:\0ad\binaries\system\ScEd_d.exe" /libpath:"..\libs" +# ADD LINK32 nafxcwd.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2D.lib /nologo /entry:"entry" /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"D:\0ad\binaries\system\ScEd_d.exe" /libpath:"..\libs" /fixed:no # SUBTRACT LINK32 /pdb:none !ENDIF @@ -170,14 +170,6 @@ SOURCE=..\lib\res\zip.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\lib\sysdep\win\hrt.cpp -# End Source File -# Begin Source File - -SOURCE=..\lib\sysdep\win\hrt.h -# End Source File -# Begin Source File - SOURCE=..\lib\sysdep\win\waio.cpp # End Source File # Begin Source File @@ -198,6 +190,10 @@ SOURCE=..\lib\sysdep\win\wfam.h # End Source File # Begin Source File +SOURCE=..\lib\sysdep\win\wgl.h +# End Source File +# Begin Source File + SOURCE=..\lib\sysdep\win\win.cpp # End Source File # Begin Source File @@ -232,6 +228,14 @@ SOURCE=..\lib\sysdep\win\wsock.cpp SOURCE=..\lib\sysdep\win\wsock.h # End Source File +# Begin Source File + +SOURCE=..\lib\sysdep\win\wtime.cpp +# End Source File +# Begin Source File + +SOURCE=..\lib\sysdep\win\wtime.h +# End Source File # End Group # Begin Source File @@ -276,14 +280,6 @@ SOURCE=..\lib\detect.h # End Source File # Begin Source File -SOURCE=..\lib\endian.cpp -# End Source File -# Begin Source File - -SOURCE=..\lib\endian.h -# End Source File -# Begin Source File - SOURCE=..\lib\glext_funcs.h # End Source File # Begin Source File @@ -300,14 +296,6 @@ SOURCE=..\lib\memcpy.cpp # End Source File # Begin Source File -SOURCE=..\lib\misc.cpp -# End Source File -# Begin Source File - -SOURCE=..\lib\misc.h -# End Source File -# Begin Source File - SOURCE=..\lib\ogl.cpp # End Source File # Begin Source File @@ -612,6 +600,10 @@ SOURCE=..\graphics\Texture.h # End Source File # Begin Source File +SOURCE=..\graphics\TextureEntry.cpp +# End Source File +# Begin Source File + SOURCE=..\graphics\TextureEntry.h # End Source File # Begin Source File @@ -724,14 +716,6 @@ SOURCE=..\renderer\PatchRData.h # End Source File # Begin Source File -SOURCE=..\renderer\PBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\renderer\PBuffer.h -# End Source File -# Begin Source File - SOURCE=..\renderer\Renderer.cpp # End Source File # Begin Source File @@ -754,6 +738,22 @@ SOURCE=..\renderer\TransparencyRenderer.cpp SOURCE=..\renderer\TransparencyRenderer.h # End Source File +# Begin Source File + +SOURCE=..\renderer\VertexBuffer.cpp +# End Source File +# Begin Source File + +SOURCE=..\renderer\VertexBuffer.h +# End Source File +# Begin Source File + +SOURCE=..\renderer\VertexBufferManager.cpp +# End Source File +# Begin Source File + +SOURCE=..\renderer\VertexBufferManager.h +# End Source File # End Group # Begin Group "sced" @@ -815,6 +815,10 @@ SOURCE=.\res\ScEd.ico # End Source File # Begin Source File +SOURCE=.\ui\res\ScEd.ico +# End Source File +# Begin Source File + SOURCE=.\res\ScEd.rc2 # End Source File # Begin Source File @@ -823,6 +827,10 @@ SOURCE=.\res\ScEdDoc.ico # End Source File # Begin Source File +SOURCE=.\ui\res\ScEdDoc.ico +# End Source File +# Begin Source File + SOURCE=.\res\select.bmp # End Source File # Begin Source File @@ -843,228 +851,219 @@ SOURCE=.\res\Toolbar.bmp # PROP Default_Filter "" # Begin Source File -SOURCE=.\BrushShapeEditorDlgBar.cpp +SOURCE=.\ui\BrushShapeEditorDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\BrushShapeEditorDlgBar.h +SOURCE=.\ui\BrushShapeEditorDlgBar.h # End Source File # Begin Source File -SOURCE=.\ColorButton.cpp +SOURCE=.\ui\ColorButton.cpp # End Source File # Begin Source File -SOURCE=.\ColorButton.h +SOURCE=.\ui\ColorButton.h # End Source File # Begin Source File -SOURCE=.\DirectionButton.cpp +SOURCE=.\ui\DirectionButton.cpp # End Source File # Begin Source File -SOURCE=.\DirectionButton.h +SOURCE=.\ui\DirectionButton.h # End Source File # Begin Source File -SOURCE=.\ElevationButton.cpp +SOURCE=.\ui\ElevationButton.cpp # End Source File # Begin Source File -SOURCE=.\ElevationButton.h +SOURCE=.\ui\ElevationButton.h # End Source File # Begin Source File -SOURCE=.\ElevToolsDlgBar.cpp +SOURCE=.\ui\ElevToolsDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\ElevToolsDlgBar.h +SOURCE=.\ui\ElevToolsDlgBar.h # End Source File # Begin Source File -SOURCE=.\ImageListCtrl.cpp +SOURCE=.\ui\ImageListCtrl.cpp # End Source File # Begin Source File -SOURCE=.\ImageListCtrl.h +SOURCE=.\ui\ImageListCtrl.h # End Source File # Begin Source File -SOURCE=.\LightSettingsDlg.cpp +SOURCE=.\ui\LightSettingsDlg.cpp # End Source File # Begin Source File -SOURCE=.\LightSettingsDlg.h +SOURCE=.\ui\LightSettingsDlg.h # End Source File # Begin Source File -SOURCE=.\MainFrameDlgBar.cpp +SOURCE=.\ui\MainFrameDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\MainFrameDlgBar.h +SOURCE=.\ui\MainFrameDlgBar.h # End Source File # Begin Source File -SOURCE=.\MainFrm.cpp +SOURCE=.\ui\MainFrm.cpp # End Source File # Begin Source File -SOURCE=.\MainFrm.h +SOURCE=.\ui\MainFrm.h # End Source File # Begin Source File -SOURCE=.\MapSizeDlg.cpp +SOURCE=.\ui\MapSizeDlg.cpp # End Source File # Begin Source File -SOURCE=.\MapSizeDlg.h +SOURCE=.\ui\MapSizeDlg.h # End Source File # Begin Source File -SOURCE=.\NavigatePropPage.cpp +SOURCE=.\ui\NavigatePropPage.cpp # End Source File # Begin Source File -SOURCE=.\NavigatePropPage.h +SOURCE=.\ui\NavigatePropPage.h # End Source File # Begin Source File -SOURCE=.\OptionsDlg.cpp +SOURCE=.\ui\OptionsDlg.cpp # End Source File # Begin Source File -SOURCE=.\OptionsDlg.h +SOURCE=.\ui\OptionsDlg.h # End Source File # Begin Source File -SOURCE=.\OptionsPropSheet.cpp +SOURCE=.\ui\OptionsPropSheet.cpp # End Source File # Begin Source File -SOURCE=.\OptionsPropSheet.h +SOURCE=.\ui\OptionsPropSheet.h # End Source File # Begin Source File -SOURCE=.\Resource.h +SOURCE=.\ui\resource.h # End Source File # Begin Source File -SOURCE=.\ScEd.cpp +SOURCE=.\ui\ScEd.cpp # End Source File # Begin Source File -SOURCE=.\ScEd.h +SOURCE=.\ui\ScEd.h # End Source File # Begin Source File -SOURCE=.\ScEd.rc +SOURCE=.\ui\ScEd.rc # End Source File # Begin Source File -SOURCE=.\ScEdDoc.cpp +SOURCE=.\ui\ScEdDoc.cpp # End Source File # Begin Source File -SOURCE=.\ScEdDoc.h +SOURCE=.\ui\ScEdDoc.h # End Source File # Begin Source File -SOURCE=.\ScEdView.cpp +SOURCE=.\ui\ScEdView.cpp # End Source File # Begin Source File -SOURCE=.\ScEdView.h +SOURCE=.\ui\ScEdView.h # End Source File # Begin Source File -SOURCE=.\ShadowsPropPage.cpp +SOURCE=.\ui\ShadowsPropPage.cpp # End Source File # Begin Source File -SOURCE=.\ShadowsPropPage.h +SOURCE=.\ui\ShadowsPropPage.h # End Source File # Begin Source File -SOURCE=.\SimpleEdit.cpp +SOURCE=.\ui\SimpleEdit.cpp # End Source File # Begin Source File -SOURCE=.\SimpleEdit.h +SOURCE=.\ui\SimpleEdit.h # End Source File # Begin Source File -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" +SOURCE=.\ui\TexToolsDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\StdAfx.h +SOURCE=.\ui\TexToolsDlgBar.h # End Source File # Begin Source File -SOURCE=.\TexToolsDlgBar.cpp +SOURCE=.\ui\UIGlobals.cpp # End Source File # Begin Source File -SOURCE=.\TexToolsDlgBar.h +SOURCE=.\ui\UIGlobals.h # End Source File # Begin Source File -SOURCE=.\UIGlobals.cpp +SOURCE=.\ui\UnitPropertiesAnimationsTab.cpp # End Source File # Begin Source File -SOURCE=.\UIGlobals.h +SOURCE=.\ui\UnitPropertiesAnimationsTab.h # End Source File # Begin Source File -SOURCE=.\UnitPropertiesAnimationsTab.cpp +SOURCE=.\ui\UnitPropertiesDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\UnitPropertiesAnimationsTab.h +SOURCE=.\ui\UnitPropertiesDlgBar.h # End Source File # Begin Source File -SOURCE=.\UnitPropertiesDlgBar.cpp +SOURCE=.\ui\UnitPropertiesTabCtrl.cpp # End Source File # Begin Source File -SOURCE=.\UnitPropertiesDlgBar.h +SOURCE=.\ui\UnitPropertiesTabCtrl.h # End Source File # Begin Source File -SOURCE=.\UnitPropertiesTabCtrl.cpp +SOURCE=.\ui\UnitPropertiesTexturesTab.cpp # End Source File # Begin Source File -SOURCE=.\UnitPropertiesTabCtrl.h +SOURCE=.\ui\UnitPropertiesTexturesTab.h # End Source File # Begin Source File -SOURCE=.\UnitPropertiesTexturesTab.cpp +SOURCE=.\ui\UnitToolsDlgBar.cpp # End Source File # Begin Source File -SOURCE=.\UnitPropertiesTexturesTab.h +SOURCE=.\ui\UnitToolsDlgBar.h # End Source File # Begin Source File -SOURCE=.\UnitToolsDlgBar.cpp +SOURCE=.\ui\WebLinkButton.cpp # End Source File # Begin Source File -SOURCE=.\UnitToolsDlgBar.h -# End Source File -# Begin Source File - -SOURCE=.\WebLinkButton.cpp -# End Source File -# Begin Source File - -SOURCE=.\WebLinkButton.h +SOURCE=.\ui\WebLinkButton.h # End Source File # End Group # Begin Group "Commands" @@ -1228,6 +1227,14 @@ SOURCE=.\MiniMap.h # End Source File # Begin Source File +SOURCE=.\MouseHandler.cpp +# End Source File +# Begin Source File + +SOURCE=.\MouseHandler.h +# End Source File +# Begin Source File + SOURCE=.\NaviCam.cpp # End Source File # Begin Source File @@ -1377,6 +1384,14 @@ SOURCE=..\ps\Prometheus.h # End Source File # Begin Source File +SOURCE=..\ps\rc_array.h +# End Source File +# Begin Source File + +SOURCE=..\ps\rc_vector.h +# End Source File +# Begin Source File + SOURCE=..\ps\Singleton.h # End Source File # Begin Source File @@ -1399,6 +1414,14 @@ SOURCE=..\ps\XercesErrorHandler.cpp SOURCE=..\ps\XercesErrorHandler.h # End Source File +# Begin Source File + +SOURCE=..\ps\XML.h +# End Source File +# Begin Source File + +SOURCE=..\ps\XMLUtils.cpp +# End Source File # End Group # End Target # End Project diff --git a/source/sced/res/0ad_logo.bmp b/source/sced/res/0ad_logo.bmp deleted file mode 100755 index a5a5feb141..0000000000 Binary files a/source/sced/res/0ad_logo.bmp and /dev/null differ diff --git a/source/sced/res/0ad_logo.bmp.ico b/source/sced/res/0ad_logo.bmp.ico deleted file mode 100755 index 71b3b3dcc3..0000000000 Binary files a/source/sced/res/0ad_logo.bmp.ico and /dev/null differ diff --git a/source/sced/res/0ad_logo.ico b/source/sced/res/0ad_logo.ico deleted file mode 100755 index 71b3b3dcc3..0000000000 Binary files a/source/sced/res/0ad_logo.ico and /dev/null differ diff --git a/source/sced/res/ScEd.ico b/source/sced/res/ScEd.ico deleted file mode 100755 index 0e44744ca4..0000000000 Binary files a/source/sced/res/ScEd.ico and /dev/null differ diff --git a/source/sced/res/ScEd.rc2 b/source/sced/res/ScEd.rc2 deleted file mode 100755 index d414e2f0bc..0000000000 --- a/source/sced/res/ScEd.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// SCED.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/source/sced/res/ScEdDoc.ico b/source/sced/res/ScEdDoc.ico deleted file mode 100755 index 2a1f1ae6ef..0000000000 Binary files a/source/sced/res/ScEdDoc.ico and /dev/null differ diff --git a/source/sced/res/Toolbar.bmp b/source/sced/res/Toolbar.bmp deleted file mode 100755 index 754c6aabb4..0000000000 Binary files a/source/sced/res/Toolbar.bmp and /dev/null differ diff --git a/source/sced/res/addunit.bmp b/source/sced/res/addunit.bmp deleted file mode 100755 index 40f8ecae44..0000000000 Binary files a/source/sced/res/addunit.bmp and /dev/null differ diff --git a/source/sced/res/elevationtools.bmp b/source/sced/res/elevationtools.bmp deleted file mode 100755 index ee3430e642..0000000000 Binary files a/source/sced/res/elevationtools.bmp and /dev/null differ diff --git a/source/sced/res/ico00001.ico b/source/sced/res/ico00001.ico deleted file mode 100755 index db756833a2..0000000000 Binary files a/source/sced/res/ico00001.ico and /dev/null differ diff --git a/source/sced/res/ico00002.ico b/source/sced/res/ico00002.ico deleted file mode 100755 index b31f0d9fc7..0000000000 Binary files a/source/sced/res/ico00002.ico and /dev/null differ diff --git a/source/sced/res/icon1.ico b/source/sced/res/icon1.ico deleted file mode 100755 index 2aa0131e12..0000000000 Binary files a/source/sced/res/icon1.ico and /dev/null differ diff --git a/source/sced/res/modeltools.bmp b/source/sced/res/modeltools.bmp deleted file mode 100755 index 6e0529610e..0000000000 Binary files a/source/sced/res/modeltools.bmp and /dev/null differ diff --git a/source/sced/res/select.bmp b/source/sced/res/select.bmp deleted file mode 100755 index 92de544595..0000000000 Binary files a/source/sced/res/select.bmp and /dev/null differ diff --git a/source/sced/res/selectunit.bmp b/source/sced/res/selectunit.bmp deleted file mode 100755 index ee28b50169..0000000000 Binary files a/source/sced/res/selectunit.bmp and /dev/null differ diff --git a/source/sced/res/terraintools.bmp b/source/sced/res/terraintools.bmp deleted file mode 100755 index 19750de603..0000000000 Binary files a/source/sced/res/terraintools.bmp and /dev/null differ diff --git a/source/sced/res/texturetools.bmp b/source/sced/res/texturetools.bmp deleted file mode 100755 index 75560efdb1..0000000000 Binary files a/source/sced/res/texturetools.bmp and /dev/null differ diff --git a/source/sced/ui/BrushShapeEditorDlgBar.cpp b/source/sced/ui/BrushShapeEditorDlgBar.cpp index 4363fd7201..f4a6755422 100755 --- a/source/sced/ui/BrushShapeEditorDlgBar.cpp +++ b/source/sced/ui/BrushShapeEditorDlgBar.cpp @@ -1,9 +1,10 @@ #include "stdafx.h" +#define _IGNORE_WGL_H_ #include "MainFrm.h" #include "EditorData.h" #include "BrushShapeEditorTool.h" #include "BrushShapeEditorDlgBar.h" - +#undef _IGNORE_WGL_H_ BEGIN_MESSAGE_MAP(CBrushShapeEditorDlgBar, CDialogBar) //{{AFX_MSG_MAP(CBrushShapeEditorDlgBar) diff --git a/source/sced/ui/ColorButton.h b/source/sced/ui/ColorButton.h index 5f307b7c84..027212fe4f 100755 --- a/source/sced/ui/ColorButton.h +++ b/source/sced/ui/ColorButton.h @@ -15,6 +15,14 @@ inline void ColorRefToRGBColor(COLORREF c,RGBColor& result) result.Y=((c>>8) & 0xff)/255.0f; result.Z=((c>>16) & 0xff)/255.0f; } + +inline void ColorRefToRGBAColor(COLORREF c,BYTE alpha,RGBAColor& result) +{ + result[0]=(c & 0xff)/255.0f; + result[1]=((c>>8) & 0xff)/255.0f; + result[2]=((c>>16) & 0xff)/255.0f; + result[3]=alpha/255.0f; +} inline void RGBColorToColorRef(const RGBColor& c,COLORREF& result) { @@ -32,6 +40,27 @@ inline void RGBColorToColorRef(const RGBColor& c,COLORREF& result) result=r | (g<<8) | (b<<16); } + +inline void RGBAColorToColorRef(const RGBAColor& c,COLORREF& result) +{ + int r=int(c[0]*255); + if (r<0) r=0; + if (r>255) r=255; + + int g=int(c[1]*255); + if (g<0) g=0; + if (g>255) g=255; + + int b=int(c[2]*255); + if (b<0) b=0; + if (b>255) b=255; + + int a=int(c[3]*255); + if (a<0) a=0; + if (a>255) a=255; + + result=r | (g<<8) | (b<<16) | (a<<24); +} ///////////////////////////////////////////////////////////////////////////// // CColorButton window diff --git a/source/sced/ui/ElevToolsDlgBar.cpp b/source/sced/ui/ElevToolsDlgBar.cpp index 485bf78730..4d3d53843a 100755 --- a/source/sced/ui/ElevToolsDlgBar.cpp +++ b/source/sced/ui/ElevToolsDlgBar.cpp @@ -1,3 +1,4 @@ +#include #include "stdafx.h" #include "ToolManager.h" #include "ElevToolsDlgBar.h" diff --git a/source/sced/ui/MainFrm.cpp b/source/sced/ui/MainFrm.cpp index f492a3f640..755297b6dc 100755 --- a/source/sced/ui/MainFrm.cpp +++ b/source/sced/ui/MainFrm.cpp @@ -2,11 +2,13 @@ // #include "stdafx.h" - -#include "ogl.h" + +#define _IGNORE_WGL_H_ +#include "ogl.h" #include "res/tex.h" #include "res/mem.h" #include "res/vfs.h" +#undef _IGNORE_WGL_H_ #include "ScEd.h" #include "ScEdView.h" @@ -18,6 +20,8 @@ #include "Unit.h" #include "UnitManager.h" +#include "ObjectManager.h" +#include "TextureManager.h" #include "UIGlobals.h" #include "MainFrm.h" #include "OptionsPropSheet.h" @@ -53,14 +57,14 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND(ID_LIGHTING_SETTINGS, OnLightingSettings) ON_COMMAND(ID_VIEW_SCREENSHOT, OnViewScreenshot) ON_COMMAND(IDR_TEXTURE_TOOLS, OnTextureTools) - ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions) + ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions) ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo) ON_COMMAND(ID_EDIT_REDO, OnEditRedo) ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateEditRedo) ON_COMMAND(IDR_ELEVATION_TOOLS, OnElevationTools) ON_COMMAND(IDR_RESIZE_MAP, OnResizeMap) - ON_COMMAND(ID_VIEW_TERRAIN_GRID, OnViewTerrainGrid) + ON_COMMAND(ID_VIEW_TERRAIN_GRID, OnViewTerrainGrid) ON_UPDATE_COMMAND_UI(ID_VIEW_TERRAIN_GRID, OnUpdateViewTerrainGrid) ON_COMMAND(ID_VIEW_TERRAIN_SOLID, OnViewTerrainSolid) ON_UPDATE_COMMAND_UI(ID_VIEW_TERRAIN_SOLID, OnUpdateViewTerrainSolid) @@ -77,12 +81,13 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND(ID_VIEW_RENDERSTATS, OnViewRenderStats) ON_UPDATE_COMMAND_UI(ID_VIEW_RENDERSTATS, OnUpdateViewRenderStats) ON_MESSAGE(WM_MOUSEWHEEL,OnMouseWheel) - ON_COMMAND(IDR_UNIT_TOOLS, OnUnitTools) ON_COMMAND(ID_TEST_GO, OnTestGo) ON_UPDATE_COMMAND_UI(ID_TEST_GO, OnUpdateTestGo) ON_COMMAND(ID_TEST_STOP, OnTestStop) ON_UPDATE_COMMAND_UI(ID_TEST_STOP, OnUpdateTestStop) - //}}AFX_MSG_MAP + ON_COMMAND(IDR_UNIT_TOOLS, OnUnitTools) + ON_COMMAND(ID_RANDOM_MAP, OnRandomMap) + //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT indicators[] = @@ -405,15 +410,15 @@ void CMainFrame::OnToolsOptions() dlg.m_ShadowsPage.m_EnableShadows=g_Renderer.GetOptionBool(CRenderer::OPT_SHADOWS) ? TRUE : FALSE; COLORREF c; - RGBColorToColorRef(g_Renderer.GetOptionColor(CRenderer::OPT_SHADOWCOLOR),c); + RGBAColorToColorRef(g_Renderer.GetOptionColor(CRenderer::OPT_SHADOWCOLOR),c); dlg.m_ShadowsPage.m_ShadowColor.m_Color=c; if (dlg.DoModal()==IDOK) { g_UserCfg.SetOptionInt(CFG_SCROLLSPEED,dlg.m_NavigatePage.m_ScrollSpeed); g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWS,dlg.m_ShadowsPage.m_EnableShadows ? true : false); - RGBColor c; - ColorRefToRGBColor(dlg.m_ShadowsPage.m_ShadowColor.m_Color,c); + RGBAColor c; + ColorRefToRGBAColor(dlg.m_ShadowsPage.m_ShadowColor.m_Color,0xff,c); g_Renderer.SetOptionColor(CRenderer::OPT_SHADOWCOLOR,c); } } @@ -717,3 +722,127 @@ void CMainFrame::OnUpdateTestStop(CCmdUI* pCmdUI) else pCmdUI->Enable(FALSE); } + +static float getExactGroundLevel( float x, float y ) +{ + // TODO MT: If OK with Rich, move to terrain core. Once this works, that is. + + x /= 4.0f; + y /= 4.0f; + + int xi = (int)floor( x ); + int yi = (int)floor( y ); + float xf = x - (float)xi; + float yf = y - (float)yi; + + u16* heightmap = g_Terrain.GetHeightMap(); + unsigned long mapsize = g_Terrain.GetVerticesPerSide(); + + float h00 = heightmap[yi*mapsize + xi]; + float h01 = heightmap[yi*mapsize + xi + mapsize]; + float h10 = heightmap[yi*mapsize + xi + 1]; + float h11 = heightmap[yi*mapsize + xi + mapsize + 1]; + + /* + if( xf < ( 1.0f - yf ) ) + { + return( HEIGHT_SCALE * ( ( 1 - xf - yf ) * h00 + xf * h10 + yf * h01 ) ); + } + else + return( HEIGHT_SCALE * ( ( xf + yf - 1 ) * h11 + ( 1 - xf ) * h01 + ( 1 - yf ) * h10 ) ); + */ + + /* + if( xf > yf ) + { + return( HEIGHT_SCALE * ( ( 1 - xf ) * h00 + ( xf - yf ) * h10 + yf * h11 ) ); + } + else + return( HEIGHT_SCALE * ( ( 1 - yf ) * h00 + ( yf - xf ) * h01 + xf * h11 ) ); + */ + + return( HEIGHT_SCALE * ( ( 1 - yf ) * ( ( 1 - xf ) * h00 + xf * h10 ) + yf * ( ( 1 - xf ) * h01 + xf * h11 ) ) ); + +} + +static CObjectEntry* GetRandomActorTemplate() +{ + if (g_ObjMan.m_ObjectTypes.size()==0) return 0; + + CObjectEntry* found=0; + int checkloop=250; + do { + u32 type=rand()%g_ObjMan.m_ObjectTypes.size(); + u32 actorsoftype=g_ObjMan.m_ObjectTypes[type].m_Objects.size(); + if (actorsoftype>0) { + found=g_ObjMan.m_ObjectTypes[type].m_Objects[rand()%actorsoftype]; + if (found && found->m_Model && found->m_Model->GetModelDef()->GetNumBones()>0) { + } else { + found=0; + } + } + } while (--checkloop && !found); + + return found; +} + +static CTextureEntry* GetRandomTexture() +{ + if (g_TexMan.m_TerrainTextures.size()==0) return 0; + + CTextureEntry* found=0; + do { + u32 type=rand()%g_TexMan.m_TerrainTextures.size(); + u32 texturesoftype=g_TexMan.m_TerrainTextures[type].m_Textures.size(); + if (texturesoftype>0) { + found=g_TexMan.m_TerrainTextures[type].m_Textures[rand()%texturesoftype]; + } + } while (!found); + + return found; +} + +void CMainFrame::OnRandomMap() +{ + const u32 count=5000; + const u32 unitsPerDir=u32(sqrt(float(count))); + + u32 i,j; + u32 vsize=g_Terrain.GetVerticesPerSide()-1; + + for (i=0;im_Model) { + CUnit* unit=new CUnit(actortemplate,actortemplate->m_Model->Clone()); + g_UnitMan.AddUnit(unit); + + CMatrix3D trans; + trans.SetIdentity(); + trans.RotateY(2*PI*float(rand())/float(RAND_MAX)); + trans.Translate(x,y,z); + unit->GetModel()->SetTransform(trans); + } + } + } + +/* + for (i=0;iTex1=tex->GetHandle(); + mp->Tex1Priority=tex->GetType(); + mp->m_Parent->SetDirty(RENDERDATA_UPDATE_VERTICES | RENDERDATA_UPDATE_INDICES); + } + } + g_MiniMap.Rebuild(); +*/ +} diff --git a/source/sced/ui/MainFrm.h b/source/sced/ui/MainFrm.h index 47314c416c..6dfa67049a 100755 --- a/source/sced/ui/MainFrm.h +++ b/source/sced/ui/MainFrm.h @@ -71,41 +71,42 @@ protected: void DisableToolbarButtons(); //{{AFX_MSG(CMainFrame) - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnTerrainLoad(); - afx_msg void OnLightingSettings(); - afx_msg void OnViewScreenshot(); - afx_msg void OnTextureTools(); - afx_msg void OnToolsOptions(); - afx_msg void OnToolsBrushShapeEditor(); - afx_msg void OnEditUndo(); - afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI); - afx_msg void OnEditRedo(); - afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI); - afx_msg void OnElevationTools(); - afx_msg void OnResizeMap(); - afx_msg void OnViewTerrainGrid(); - afx_msg void OnUpdateViewTerrainGrid(CCmdUI* pCmdUI); - afx_msg void OnViewTerrainSolid(); - afx_msg void OnUpdateViewTerrainSolid(CCmdUI* pCmdUI); - afx_msg void OnViewTerrainWireframe(); - afx_msg void OnUpdateViewTerrainWireframe(CCmdUI* pCmdUI); - afx_msg void OnViewModelGrid(); - afx_msg void OnUpdateViewModelGrid(CCmdUI* pCmdUI); - afx_msg void OnViewModelSolid(); - afx_msg void OnUpdateViewModelSolid(CCmdUI* pCmdUI); - afx_msg void OnViewModelWireframe(); - afx_msg void OnUpdateViewModelWireframe(CCmdUI* pCmdUI); - afx_msg void OnFileSaveMap(); - afx_msg void OnFileLoadMap(); - afx_msg void OnViewRenderStats(); - afx_msg void OnUpdateViewRenderStats(CCmdUI* pCmdUI); - afx_msg LRESULT OnMouseWheel(WPARAM wParam,LPARAM lParam); - afx_msg void OnTestGo(); - afx_msg void OnUpdateTestGo(CCmdUI* pCmdUI); - afx_msg void OnTestStop(); - afx_msg void OnUpdateTestStop(CCmdUI* pCmdUI); - //}}AFX_MSG + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnTerrainLoad(); + afx_msg void OnLightingSettings(); + afx_msg void OnViewScreenshot(); + afx_msg void OnTextureTools(); + afx_msg void OnToolsOptions(); + afx_msg void OnToolsBrushShapeEditor(); + afx_msg void OnEditUndo(); + afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI); + afx_msg void OnEditRedo(); + afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI); + afx_msg void OnElevationTools(); + afx_msg void OnResizeMap(); + afx_msg void OnViewTerrainGrid(); + afx_msg void OnUpdateViewTerrainGrid(CCmdUI* pCmdUI); + afx_msg void OnViewTerrainSolid(); + afx_msg void OnUpdateViewTerrainSolid(CCmdUI* pCmdUI); + afx_msg void OnViewTerrainWireframe(); + afx_msg void OnUpdateViewTerrainWireframe(CCmdUI* pCmdUI); + afx_msg void OnViewModelGrid(); + afx_msg void OnUpdateViewModelGrid(CCmdUI* pCmdUI); + afx_msg void OnViewModelSolid(); + afx_msg void OnUpdateViewModelSolid(CCmdUI* pCmdUI); + afx_msg void OnViewModelWireframe(); + afx_msg void OnUpdateViewModelWireframe(CCmdUI* pCmdUI); + afx_msg void OnFileSaveMap(); + afx_msg void OnFileLoadMap(); + afx_msg void OnViewRenderStats(); + afx_msg void OnUpdateViewRenderStats(CCmdUI* pCmdUI); + afx_msg LRESULT OnMouseWheel(WPARAM wParam,LPARAM lParam); + afx_msg void OnTestGo(); + afx_msg void OnUpdateTestGo(CCmdUI* pCmdUI); + afx_msg void OnTestStop(); + afx_msg void OnUpdateTestStop(CCmdUI* pCmdUI); + afx_msg void OnRandomMap(); + //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/source/sced/ui/ScEd.cpp b/source/sced/ui/ScEd.cpp index 051a8cbe00..49e80f1b9f 100755 --- a/source/sced/ui/ScEd.cpp +++ b/source/sced/ui/ScEd.cpp @@ -46,7 +46,10 @@ CScEdApp theApp; // CScEdApp initialization BOOL CScEdApp::InitInstance() -{ +{ + extern void pre_main_init(); + pre_main_init(); + AfxEnableControlContainer(); // Standard initialization @@ -214,4 +217,4 @@ int main(int argc, char *argv[]) AfxInitialize(); return AfxWinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0); } -#endif \ No newline at end of file +#endif diff --git a/source/sced/ui/ScEd.rc b/source/sced/ui/ScEd.rc index bdacdca6ca..9c1de9c807 100755 --- a/source/sced/ui/ScEd.rc +++ b/source/sced/ui/ScEd.rc @@ -162,6 +162,8 @@ BEGIN MENUITEM SEPARATOR MENUITEM "L&oad Terrain", ID_TERRAIN_LOAD MENUITEM "&Resize Terrain", IDR_RESIZE_MAP + MENUITEM SEPARATOR + MENUITEM "Ra&ndom Map", ID_RANDOM_MAP END POPUP "&Tools" BEGIN @@ -443,8 +445,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,7,2 - PRODUCTVERSION 0,0,7,2 + FILEVERSION 0,0,7,3 + PRODUCTVERSION 0,0,7,3 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -462,14 +464,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Wildfire Games\0" VALUE "FileDescription", "0AD Scenario Editor\0" - VALUE "FileVersion", "0, 0, 7, 2\0" + VALUE "FileVersion", "0, 0, 7, 3\0" VALUE "InternalName", "ScEd\0" VALUE "LegalCopyright", "Copyright (C) 2003-2004\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ScEd.EXE\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "ScEd\0" - VALUE "ProductVersion", "0, 0, 7, 2\0" + VALUE "ProductVersion", "0, 0, 7, 3\0" VALUE "SpecialBuild", "\0" END END diff --git a/source/sced/ui/ScEdView.cpp b/source/sced/ui/ScEdView.cpp index b1680a7518..8da95fc285 100755 --- a/source/sced/ui/ScEdView.cpp +++ b/source/sced/ui/ScEdView.cpp @@ -2,6 +2,7 @@ // #include "stdafx.h" +#define _IGNORE_WGL_H_ #include "ScEd.h" #include "ScEdDoc.h" @@ -13,6 +14,8 @@ #include "timer.h" #include "ogl.h" +#undef _IGNORE_WGL_H_ + #include "res/vfs.h" int g_ClickMode=0; diff --git a/source/sced/ui/TexToolsDlgBar.cpp b/source/sced/ui/TexToolsDlgBar.cpp index 242d94ed43..930549d124 100755 --- a/source/sced/ui/TexToolsDlgBar.cpp +++ b/source/sced/ui/TexToolsDlgBar.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#define _IGNORE_WGL_H_ #include "TexToolsDlgBar.h" #include "TextureManager.h" #include "PaintTextureTool.h" @@ -7,6 +8,7 @@ #include "ogl.h" #include "res/tex.h" #include "res/vfs.h" +#undef _IGNORE_WGL_H_ BEGIN_MESSAGE_MAP(CTexToolsDlgBar, CDialogBar) //{{AFX_MSG_MAP(CTexToolsDlgBar) @@ -51,7 +53,7 @@ BOOL CTexToolsDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UI void CTexToolsDlgBar::Select(CTextureEntry* entry) { CStatic* curbmp=(CStatic*) GetDlgItem(IDC_STATIC_CURRENTTEXTURE); - CBitmap* bmp=(CBitmap*) (entry ? entry->m_Bitmap : 0); + CBitmap* bmp=(CBitmap*) (entry ? entry->GetBitmap() : 0); curbmp->SetBitmap((HBITMAP) (*bmp)); CPaintTextureTool::GetTool()->SetSelectedTexture(entry); } @@ -101,7 +103,7 @@ int CTexToolsDlgBar::GetCurrentTerrainType() BOOL CTexToolsDlgBar::BuildImageListIcon(CTextureEntry* texentry) { // bind to texture - g_Renderer.BindTexture(0,tex_id(texentry->m_Handle)); + g_Renderer.BindTexture(0,tex_id(texentry->GetHandle())); // get image data in BGRA format int w,h; @@ -120,7 +122,7 @@ BOOL CTexToolsDlgBar::BuildImageListIcon(CTextureEntry* texentry) BOOL success=TRUE; CDC* dc=GetDC(); CBitmap* bmp=new CBitmap; - texentry->m_Bitmap=bmp; + texentry->SetBitmap(bmp); if (bmp->CreateCompatibleBitmap(dc,32,32)) { @@ -167,13 +169,13 @@ BOOL CTexToolsDlgBar::BuildImageListIcon(CTextureEntry* texentry) BOOL CTexToolsDlgBar::AddImageListIcon(CTextureEntry* texentry) { // get a bitmap for imagelist yet? - if (!texentry->m_Bitmap) { + if (!texentry->GetBitmap()) { // nope; create one now BuildImageListIcon(texentry); } // add bitmap to imagelist - m_ImageList.Add((CBitmap*) texentry->m_Bitmap,RGB(255,255,255)); + m_ImageList.Add((CBitmap*) texentry->GetBitmap(),RGB(255,255,255)); return TRUE; } @@ -215,7 +217,7 @@ BOOL CTexToolsDlgBar::OnInitDialog() // add to list ctrl int index=listctrl->GetItemCount(); - listctrl->InsertItem(index,(const char*) textures[i]->m_Name,index); + listctrl->InsertItem(index,(const char*) textures[i]->GetName(),index); } // select first entry if we've got any entries @@ -285,7 +287,7 @@ void CTexToolsDlgBar::OnSelChangeTerrainTypes() AddImageListIcon(textures[j]); // add to list ctrl - listctrl->InsertItem(j,(const char*) textures[j]->m_Name,j); + listctrl->InsertItem(j,(const char*) textures[j]->GetName(),j); } } } \ No newline at end of file diff --git a/source/sced/ui/UnitPropertiesDlgBar.cpp b/source/sced/ui/UnitPropertiesDlgBar.cpp index 3113b2088a..aa31c24935 100755 --- a/source/sced/ui/UnitPropertiesDlgBar.cpp +++ b/source/sced/ui/UnitPropertiesDlgBar.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#define _IGNORE_WGL_H_ #include "UserConfig.h" #include "MainFrm.h" #include "Model.h" @@ -9,6 +10,7 @@ #include "EditorData.h" #include "UIGlobals.h" +#undef _IGNORE_WGL_H_ BEGIN_MESSAGE_MAP(CUnitPropertiesDlgBar, CDialogBar) //{{AFX_MSG_MAP(CUnitPropertiesDlgBar) diff --git a/source/sced/ui/resource.h b/source/sced/ui/resource.h index 7a863f54ec..4a3a65317a 100755 --- a/source/sced/ui/resource.h +++ b/source/sced/ui/resource.h @@ -1,113 +1,114 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ScEd.rc -// -#define IDD_ABOUTBOX 100 -#define IDD_PROPPAGE_NAVIGATION 102 -#define IDD_DIALOGBAR_TEXTURETOOLS 103 -#define IDR_MAINFRAME 128 -#define IDR_SCEDTYPE 129 -#define IDD_DIALOG_LIGHTSETTINGS 133 -#define IDD_DIALOGBAR_MODELTOOLS 134 -#define IDD_DIALOGBAR_UNITTOOLS 134 -#define IDB_LOGO 135 -#define IDD_DIALOG_OPTIONS 137 -#define IDD_DIALOGBAR_ELEVATIONTOOLS 138 -#define IDD_DIALOGBAR_UNITPROPERTIES 139 -#define IDD_DIALOG_SIMPLEEDIT 140 -#define IDI_ICON_UNITMODE 141 -#define IDI_ICON_NEWUNIT 142 -#define IDI_ICON_SELECT 143 -#define IDD_DIALOG_MAPSIZE 144 -#define IDB_BITMAP_SELECT 146 -#define IDB_BITMAP_TEXTURETOOLS 148 -#define IDB_BITMAP_ELEVATIONTOOLS 149 -#define IDB_BITMAP_MODELTOOLS 150 -#define IDD_DIALOGBAR_BRUSHSHAPEEDITOR 151 -#define IDD_PROPPAGE_SHADOWS 152 -#define IDB_BITMAP_SELECTUNIT 153 -#define IDD_UNITPROPERTIES_TEXTURES 153 -#define IDB_BITMAP_ADDUNIT 154 -#define IDD_UNITPROPERTIES_ANIMATIONS 154 -#define IDC_BUTTON_SUNCOLOR 1001 -#define IDC_EDIT_MODEL 1001 -#define IDC_BUTTON_TERRAINAMBIENTCOLOR 1002 -#define IDC_EDIT_TEXTURE 1002 -#define IDC_BUTTON_APPLY 1003 -#define IDC_BUTTON_MODELBROWSE 1004 -#define IDC_BUTTON_DIRECTION 1005 -#define IDC_BUTTON_TEXTUREBROWSE 1005 -#define IDC_BUTTON_ELEVATION 1006 -#define IDC_BUTTON_REFRESH 1006 -#define IDC_EDIT_DIRECTION 1007 -#define IDC_EDIT_NAME 1007 -#define IDC_BUTTON_UNITSAMBIENTCOLOR 1008 -#define IDC_BUTTON_BACK 1008 -#define IDC_EDIT_ELEVATION 1009 -#define IDC_SPIN_DIRECTION 1010 -#define IDC_SPIN_ELEVATION 1011 -#define IDC_STATIC_VERSION 1011 -#define IDC_EDIT_ANIMATION 1011 -#define IDC_BUTTON_LAUNCHWFG 1012 -#define IDC_BUTTON_ANIMATIONBROWSE 1012 -#define IDC_SLIDER_BRUSHSIZE 1013 -#define IDC_SLIDER_BRUSHEFFECT 1014 -#define IDC_LIST_TEXTUREBROWSER 1015 -#define IDC_BUTTON_ADD 1016 -#define IDC_BUTTON_EDIT 1017 -#define IDC_STATIC_CURRENTTEXTURE 1018 -#define IDC_STATIC_CURRENTMODEL 1020 -#define IDC_LIST_MODELBROWSER 1021 -#define IDC_LIST_OBJECTBROWSER 1021 -#define IDC_SLIDER_RTSSCROLLSPEED 1023 -#define IDC_RADIO_RAISE 1027 -#define IDC_RADIO_SMOOTH 1028 -#define IDC_EDIT1 1028 -#define IDC_COMBO_TERRAINTYPES 1030 -#define IDC_COMBO1 1030 -#define IDC_RADIO_SMALL 1031 -#define IDC_RADIO_MEDIUM 1032 -#define IDC_COMBO_OBJECTTYPES 1032 -#define IDC_RADIO_LARGE 1033 -#define IDC_BUTTON_SELECT 1033 -#define IDC_RADIO_HUGE 1034 -#define IDC_BUTTON_ELEVATIONTOOLS 1034 -#define IDC_BUTTON_TEXTURETOOLS 1035 -#define IDC_BUTTON_MODELTOOLS 1036 -#define IDC_BUTTON_ADDUNIT 1038 -#define IDC_CHECK_SHADOWS 1039 -#define IDC_BUTTON_SHADOWCOLOR 1040 -#define IDC_SLIDER_SHADOWQUALITY 1041 -#define ID_TERRAIN_LOAD 32772 -#define ID_TERRAIN_RANDOMMAP 32773 -#define ID_LIGHTING_SETTINGS 32774 -#define ID_VIEW_GRID 32778 -#define ID_VIEW_TERRAIN_GRID 32778 -#define ID_VIEW_SCREENSHOT 32779 -#define IDR_TEXTURE_TOOLS 32781 -#define ID_TOOLS_OPTIONS 32782 -#define IDR_ELEVATION_TOOLS 32783 -#define IDR_UNIT_TOOLS 32785 -#define IDR_RESIZE_MAP 32786 -#define ID_VIEW_TERRAIN_WIREFRAME 32787 -#define ID_VIEW_TERRAIN_SOLID 32788 -#define ID_FILE_LOADMAP 32789 -#define ID_FILE_SAVEMAP 32790 -#define ID_VIEW_MODEL_SOLID 32791 -#define ID_VIEW_MODEL_GRID 32792 -#define ID_VIEW_MODEL_WIREFRAME 32793 -#define ID_VIEW_RENDERSTATS 32794 -#define ID_TEST_STOP 32797 -#define ID_TEST_GO 32798 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 156 -#define _APS_NEXT_COMMAND_VALUE 32799 -#define _APS_NEXT_CONTROL_VALUE 1044 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ScEd.rc +// +#define IDD_ABOUTBOX 100 +#define IDD_PROPPAGE_NAVIGATION 102 +#define IDD_DIALOGBAR_TEXTURETOOLS 103 +#define IDR_MAINFRAME 128 +#define IDR_SCEDTYPE 129 +#define IDD_DIALOG_LIGHTSETTINGS 133 +#define IDD_DIALOGBAR_MODELTOOLS 134 +#define IDD_DIALOGBAR_UNITTOOLS 134 +#define IDB_LOGO 135 +#define IDD_DIALOG_OPTIONS 137 +#define IDD_DIALOGBAR_ELEVATIONTOOLS 138 +#define IDD_DIALOGBAR_UNITPROPERTIES 139 +#define IDD_DIALOG_SIMPLEEDIT 140 +#define IDI_ICON_UNITMODE 141 +#define IDI_ICON_NEWUNIT 142 +#define IDI_ICON_SELECT 143 +#define IDD_DIALOG_MAPSIZE 144 +#define IDB_BITMAP_SELECT 146 +#define IDB_BITMAP_TEXTURETOOLS 148 +#define IDB_BITMAP_ELEVATIONTOOLS 149 +#define IDB_BITMAP_MODELTOOLS 150 +#define IDD_DIALOGBAR_BRUSHSHAPEEDITOR 151 +#define IDD_PROPPAGE_SHADOWS 152 +#define IDB_BITMAP_SELECTUNIT 153 +#define IDD_UNITPROPERTIES_TEXTURES 153 +#define IDB_BITMAP_ADDUNIT 154 +#define IDD_UNITPROPERTIES_ANIMATIONS 154 +#define IDC_BUTTON_SUNCOLOR 1001 +#define IDC_EDIT_MODEL 1001 +#define IDC_BUTTON_TERRAINAMBIENTCOLOR 1002 +#define IDC_EDIT_TEXTURE 1002 +#define IDC_BUTTON_APPLY 1003 +#define IDC_BUTTON_MODELBROWSE 1004 +#define IDC_BUTTON_DIRECTION 1005 +#define IDC_BUTTON_TEXTUREBROWSE 1005 +#define IDC_BUTTON_ELEVATION 1006 +#define IDC_BUTTON_REFRESH 1006 +#define IDC_EDIT_DIRECTION 1007 +#define IDC_EDIT_NAME 1007 +#define IDC_BUTTON_UNITSAMBIENTCOLOR 1008 +#define IDC_BUTTON_BACK 1008 +#define IDC_EDIT_ELEVATION 1009 +#define IDC_SPIN_DIRECTION 1010 +#define IDC_SPIN_ELEVATION 1011 +#define IDC_STATIC_VERSION 1011 +#define IDC_EDIT_ANIMATION 1011 +#define IDC_BUTTON_LAUNCHWFG 1012 +#define IDC_BUTTON_ANIMATIONBROWSE 1012 +#define IDC_SLIDER_BRUSHSIZE 1013 +#define IDC_SLIDER_BRUSHEFFECT 1014 +#define IDC_LIST_TEXTUREBROWSER 1015 +#define IDC_BUTTON_ADD 1016 +#define IDC_BUTTON_EDIT 1017 +#define IDC_STATIC_CURRENTTEXTURE 1018 +#define IDC_STATIC_CURRENTMODEL 1020 +#define IDC_LIST_MODELBROWSER 1021 +#define IDC_LIST_OBJECTBROWSER 1021 +#define IDC_SLIDER_RTSSCROLLSPEED 1023 +#define IDC_RADIO_RAISE 1027 +#define IDC_RADIO_SMOOTH 1028 +#define IDC_EDIT1 1028 +#define IDC_COMBO_TERRAINTYPES 1030 +#define IDC_COMBO1 1030 +#define IDC_RADIO_SMALL 1031 +#define IDC_RADIO_MEDIUM 1032 +#define IDC_COMBO_OBJECTTYPES 1032 +#define IDC_RADIO_LARGE 1033 +#define IDC_BUTTON_SELECT 1033 +#define IDC_RADIO_HUGE 1034 +#define IDC_BUTTON_ELEVATIONTOOLS 1034 +#define IDC_BUTTON_TEXTURETOOLS 1035 +#define IDC_BUTTON_MODELTOOLS 1036 +#define IDC_BUTTON_ADDUNIT 1038 +#define IDC_CHECK_SHADOWS 1039 +#define IDC_BUTTON_SHADOWCOLOR 1040 +#define IDC_SLIDER_SHADOWQUALITY 1041 +#define ID_TERRAIN_LOAD 32772 +#define ID_TERRAIN_RANDOMMAP 32773 +#define ID_LIGHTING_SETTINGS 32774 +#define ID_VIEW_GRID 32778 +#define ID_VIEW_TERRAIN_GRID 32778 +#define ID_VIEW_SCREENSHOT 32779 +#define IDR_TEXTURE_TOOLS 32781 +#define ID_TOOLS_OPTIONS 32782 +#define IDR_ELEVATION_TOOLS 32783 +#define IDR_UNIT_TOOLS 32785 +#define IDR_RESIZE_MAP 32786 +#define ID_VIEW_TERRAIN_WIREFRAME 32787 +#define ID_VIEW_TERRAIN_SOLID 32788 +#define ID_FILE_LOADMAP 32789 +#define ID_FILE_SAVEMAP 32790 +#define ID_VIEW_MODEL_SOLID 32791 +#define ID_VIEW_MODEL_GRID 32792 +#define ID_VIEW_MODEL_WIREFRAME 32793 +#define ID_VIEW_RENDERSTATS 32794 +#define ID_TEST_STOP 32797 +#define ID_TEST_GO 32798 +#define ID_RANDOM_MAP 32799 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 156 +#define _APS_NEXT_COMMAND_VALUE 32800 +#define _APS_NEXT_CONTROL_VALUE 1044 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif