Moved "res" directory; updated ScEd source to accomodate engine changes.

This was SVN commit r419.
This commit is contained in:
notpete 2004-06-07 20:07:11 +00:00
parent 5b3be293ca
commit a93418e353
39 changed files with 1263 additions and 1050 deletions

View File

@ -81,10 +81,10 @@ void CAlterElevationCommand::ApplyDataToSelection(const CArray2D<u16>& 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<pz1;j++) {
for (int i=px0;i<px1;i++) {
CPatch* patch=g_Terrain.GetPatch(i,j);

View File

@ -1,8 +1,9 @@
#include "BrushShapeEditorTool.h"
#include <stdlib.h>
#include <string.h>
#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);

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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<h;j++) {
u32* dataptr=m_Data+((y+j)*(mapSize-1))+x;
for (int i=0;i<w;i++) {
// get height at this pixel
int hmap=int(g_Terrain.GetHeightMap()[(y+j)*mapSize + x+i])>>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; pj<g_Terrain.GetPatchesPerSide(); pj++)
{
for (int tj=0; tj<16; tj++)
{
for (uint pi=0; pi<g_Terrain.GetPatchesPerSide(); pi++)
{
for (int ti=0; ti<16; ti++)
{
int i=pi*16+ti;
int j=pj*16+tj;
// get base color from textures on tile
unsigned int color;
CMiniPatch* mp=g_Terrain.GetTile(i,j);
if (mp) {
CTextureEntry* tex=mp->Tex1 ? 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<h;j++) {
u32* dataptr=m_Data+((y+j)*(mapSize-1))+x;
for (int i=0;i<w;i++) {
// get height at this pixel
int hmap=int(g_Terrain.GetHeightMap()[(y+j)*mapSize + x+i])>>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();
}

View File

@ -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;

View File

@ -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<pz1;j++) {
for (int i=px0;i<px1;i++) {
CPatch* patch=g_Terrain.GetPatch(i,j);
@ -68,13 +68,13 @@ void CPaintTextureCommand::Execute()
// rebuild this bit of the minimap
int w=1+2*m_BrushSize;
int x=m_SelectionCentre[1]-m_BrushSize;
int x=m_SelectionCentre[0]-m_BrushSize;
if (x<0) {
w+=x;
x=0;
}
int h=1+2*m_BrushSize;
int y=m_SelectionCentre[0]-m_BrushSize;
int y=m_SelectionCentre[1]-m_BrushSize;
if (y<0) {
h+=y;
y=0;

View File

@ -48,17 +48,17 @@ void CRaiseElevationTool::OnRButtonUp(u32 flags,int px,int py)
CBrushTool::OnRButtonUp(flags,px,py);
}
void CRaiseElevationTool::AlterSelectionHeight(int32 amount)
void CRaiseElevationTool::AlterSelectionHeight(i32 amount)
{
CRaiseElevationCommand* alterCmd=new CRaiseElevationCommand(amount,m_BrushSize,m_SelectionCentre);
g_CmdMan.Execute(alterCmd);
}
int32 CRaiseElevationTool::CalcDistSinceLastTrigger()
i32 CRaiseElevationTool::CalcDistSinceLastTrigger()
{
double curtime=get_time();
double elapsed=curtime-m_LastTriggerTime;
int32 dist=int32(elapsed*m_Speed);
i32 dist=i32(elapsed*m_Speed);
m_LastTriggerTime+=dist/m_Speed;

View File

@ -1,7 +1,8 @@
#ifndef _RAISEELEVATIONTOOL_H
#define _RAISEELEVATIONTOOL_H
#include <set>
#include <set>
#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;

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -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...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -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)

View File

@ -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

View File

@ -1,3 +1,4 @@
#include <assert.h>
#include "stdafx.h"
#include "ToolManager.h"
#include "ElevToolsDlgBar.h"

View File

@ -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;i<unitsPerDir;i++) {
for (j=0;j<unitsPerDir;j++) {
// float x=CELL_SIZE*vsize*float(i+1)/float(unitsPerDir+1);
// float z=CELL_SIZE*vsize*float(j+1)/float(unitsPerDir+1);
float dx=float(rand())/float(RAND_MAX);
float x=CELL_SIZE*vsize*dx;
float dz=float(rand())/float(RAND_MAX);
float z=CELL_SIZE*vsize*dz;
float y=getExactGroundLevel(x,z);
CObjectEntry* actortemplate=GetRandomActorTemplate();
if (actortemplate && actortemplate->m_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;i<vsize;i++) {
for (j=0;j<vsize;j++) {
CTextureEntry* tex=GetRandomTexture();
CMiniPatch* mp=g_Terrain.GetTile(i,j);
mp->Tex1=tex->GetHandle();
mp->Tex1Priority=tex->GetType();
mp->m_Parent->SetDirty(RENDERDATA_UPDATE_VERTICES | RENDERDATA_UPDATE_INDICES);
}
}
g_MiniMap.Rebuild();
*/
}

View File

@ -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()
};

View File

@ -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
#endif

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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)

View File

@ -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