This commit is contained in:
parent
c33e2a4acd
commit
25ffde600e
9 changed files with 92 additions and 38 deletions
|
@ -113,7 +113,7 @@ void CTexGrab::Process()
|
||||||
Purpose: Add bitmaps to file list
|
Purpose: Add bitmaps to file list
|
||||||
Params: Name = Filename
|
Params: Name = Filename
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CTexGrab::AddFile(char *Name)
|
void CTexGrab::AddFile(const char *Name)
|
||||||
{
|
{
|
||||||
GString UpperName(Name);
|
GString UpperName(Name);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ GString UpperName(Name);
|
||||||
Purpose:
|
Purpose:
|
||||||
Params:
|
Params:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CTexGrab::AddMemFrame(char *Name,Frame &Frame)
|
void CTexGrab::AddMemFrame(const char *Name,Frame &Frame)
|
||||||
{
|
{
|
||||||
GString UpperName(Name);
|
GString UpperName(Name);
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ public:
|
||||||
CTexGrab();
|
CTexGrab();
|
||||||
~CTexGrab();
|
~CTexGrab();
|
||||||
|
|
||||||
void AddFile(char *Name);
|
void AddFile(const char *Name);
|
||||||
void AddMemFrame(char *Name,Frame &Frame);
|
void AddMemFrame(const char *Name,Frame &Frame);
|
||||||
|
|
||||||
void Process();
|
void Process();
|
||||||
|
|
||||||
|
@ -78,12 +78,12 @@ public:
|
||||||
void MoveUVs(bool f) {MyFiles.SetMoveUVs(f);}
|
void MoveUVs(bool f) {MyFiles.SetMoveUVs(f);}
|
||||||
void ShrinkToFit(bool f) {MyFiles.SetShrinkToFit(f);}
|
void ShrinkToFit(bool f) {MyFiles.SetShrinkToFit(f);}
|
||||||
|
|
||||||
void SetOutFile(char *Name) {m_OutFile=Name;}
|
void SetOutFile(const char *Name) {m_OutFile=Name;}
|
||||||
void SetSprFile(char *Name) {m_SprFile=Name;}
|
void SetSprFile(const char *Name) {m_SprFile=Name;}
|
||||||
void SetDebugOut(char *Name) {m_OutLbm=Name;}
|
void SetDebugOut(const char *Name) {m_OutLbm=Name;}
|
||||||
void SetRepFile(char *Name) {m_ReportFile=Name;}
|
void SetRepFile(const char *Name) {m_ReportFile=Name;}
|
||||||
void SetIncFile(char *Name) {m_IncOutFile=Name;}
|
void SetIncFile(const char *Name) {m_IncOutFile=Name;}
|
||||||
void SetRawTPageFile(char *Name) {m_rawTpageFile=Name;}
|
void SetRawTPageFile(const char *Name) {m_rawTpageFile=Name;}
|
||||||
|
|
||||||
void MaxSize(int Size) {MyFiles.SetMaxSize(Size);}
|
void MaxSize(int Size) {MyFiles.SetMaxSize(Size);}
|
||||||
void SetTPage(int Base,int W,int H) {m_PageBase=Base; m_WidthPages=W; m_HeightPages=H; m_PagePlacements=true;}
|
void SetTPage(int Base,int W,int H) {m_PageBase=Base; m_WidthPages=W; m_HeightPages=H; m_PagePlacements=true;}
|
||||||
|
|
|
@ -63,6 +63,7 @@ class FileInfo
|
||||||
{
|
{
|
||||||
CrossHair=false;
|
CrossHair=false;
|
||||||
ForceOffsets=false;
|
ForceOffsets=false;
|
||||||
|
MemFrame=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileInfo(FileInfo const & Fi)
|
FileInfo(FileInfo const & Fi)
|
||||||
|
@ -120,7 +121,7 @@ class FileInfo
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetInfo(const char * NewFileName,bool NewCrossHair,bool NewZeroColZero, bool NewMoveUVs,bool NewAllowRotate,bool NewShrinkToFit,bool allocateAs16Bit,Frame *NewMemFrame=0)
|
void SetInfo(const char * NewFileName,bool NewCrossHair,bool NewZeroColZero, bool NewMoveUVs,bool NewAllowRotate,bool NewShrinkToFit,bool allocateAs16Bit,Frame *NewMemFrame=NULL)
|
||||||
{
|
{
|
||||||
CrossHair=NewCrossHair;
|
CrossHair=NewCrossHair;
|
||||||
ZeroColZero=NewZeroColZero;
|
ZeroColZero=NewZeroColZero;
|
||||||
|
@ -132,7 +133,8 @@ class FileInfo
|
||||||
m_allocateAs16Bit=allocateAs16Bit;
|
m_allocateAs16Bit=allocateAs16Bit;
|
||||||
if (NewMemFrame)
|
if (NewMemFrame)
|
||||||
{
|
{
|
||||||
MemFrame=*NewMemFrame;
|
MemFrame=new Frame;
|
||||||
|
*MemFrame=*NewMemFrame;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if we're allocating on a 16 bit pixel boundary then
|
if we're allocating on a 16 bit pixel boundary then
|
||||||
|
@ -189,10 +191,11 @@ class FileInfo
|
||||||
{return(m_allocateAs16Bit);}
|
{return(m_allocateAs16Bit);}
|
||||||
|
|
||||||
bool getHasMemFrame(void) const
|
bool getHasMemFrame(void) const
|
||||||
{return(MemFrame.SeeData()!=NULL);}
|
{return(MemFrame!=NULL);}
|
||||||
|
// {return(MemFrame.SeeData()!=NULL);}
|
||||||
|
|
||||||
Frame const &getMemFrame() const
|
Frame const &getMemFrame() const
|
||||||
{return(MemFrame);}
|
{return(*MemFrame);}
|
||||||
|
|
||||||
char const * GetActualName(void) const
|
char const * GetActualName(void) const
|
||||||
{return(ActualFileName);}
|
{return(ActualFileName);}
|
||||||
|
@ -215,7 +218,7 @@ class FileInfo
|
||||||
|
|
||||||
int XOff,YOff;
|
int XOff,YOff;
|
||||||
|
|
||||||
Frame MemFrame;
|
Frame *MemFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<FileInfo> FIVec;
|
typedef std::vector<FileInfo> FIVec;
|
||||||
|
|
|
@ -335,10 +335,15 @@ Vector3 &ThisCam=GetCam();
|
||||||
{
|
{
|
||||||
float XS,YS;
|
float XS,YS;
|
||||||
RECT ThisRect;
|
RECT ThisRect;
|
||||||
|
float MoveSpd=GetZoomW();
|
||||||
|
|
||||||
|
if (nFlags & MK_CONTROL)
|
||||||
|
{
|
||||||
|
MoveSpd*=4;
|
||||||
|
}
|
||||||
View->GetWindowRect(&ThisRect);
|
View->GetWindowRect(&ThisRect);
|
||||||
XS=ThisCam.z*16;
|
XS=ThisCam.z*MoveSpd;
|
||||||
YS=ThisCam.z*16;
|
YS=ThisCam.z*MoveSpd;
|
||||||
XS/=((ThisRect.right-ThisRect.left));
|
XS/=((ThisRect.right-ThisRect.left));
|
||||||
YS/=((ThisRect.bottom-ThisRect.top));
|
YS/=((ThisRect.bottom-ThisRect.top));
|
||||||
|
|
||||||
|
|
|
@ -157,27 +157,33 @@ CTileBank &TileBank=Core->GetTileBank();
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
CPoint &CursPos=Core->GetCursorPos();
|
CPoint &CursPos=Core->GetCursorPos();
|
||||||
CMap &Brush=TileBank.GetActiveBrush();
|
CMap &Brush=TileBank.GetActiveBrush();
|
||||||
|
Vector3 Ofs;
|
||||||
|
|
||||||
if (!Brush.IsValid()) return;
|
if (!Brush.IsValid()) return;
|
||||||
|
|
||||||
if (CursPos.x<0 || CursPos.y<0) return;
|
if (CursPos.x<0 || CursPos.y<0) return;
|
||||||
ThisCam.x-=CursPos.x;
|
|
||||||
ThisCam.y-=CursPos.y;
|
Ofs.x=-(CursPos.x-(int)ThisCam.x);
|
||||||
|
Ofs.y=-(CursPos.y-(int)ThisCam.y);
|
||||||
|
ThisCam.x-=(int)ThisCam.x;
|
||||||
|
ThisCam.y-=(int)ThisCam.y;
|
||||||
|
TRACE2("-> %f %f\n",Ofs.x,Ofs.y);
|
||||||
|
|
||||||
|
|
||||||
if (Is3d && Render3dFlag)
|
if (Is3d && Render3dFlag)
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
Render(Core,ThisCam,Brush,TRUE,0.5);
|
Render(Core,ThisCam,Brush,TRUE,0.5,&Ofs);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Render(Core,ThisCam,Brush,FALSE,0.5);
|
Render(Core,ThisCam,Brush,FALSE,0.5,&Ofs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Render(CCore *Core,Vector3 &ThisCam,CMap &ThisMap,BOOL Render3d,float Alpha)
|
void CLayerTile::Render(CCore *Core,Vector3 &ThisCam,CMap &ThisMap,BOOL Render3d,float Alpha,Vector3 *Ofs)
|
||||||
{
|
{
|
||||||
int MapWidth=ThisMap.GetWidth();
|
int MapWidth=ThisMap.GetWidth();
|
||||||
int MapHeight=ThisMap.GetHeight();
|
int MapHeight=ThisMap.GetHeight();
|
||||||
|
@ -187,19 +193,39 @@ float ScrOfsX=(ZoomW/2);
|
||||||
float ScrOfsY=(ZoomH/2);
|
float ScrOfsY=(ZoomH/2);
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
Vector3 &Scale=Core->GetScaleVector();
|
||||||
|
|
||||||
|
int StartX=(int)ThisCam.x;
|
||||||
|
int StartY=(int)ThisCam.y;
|
||||||
|
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
||||||
|
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
||||||
|
|
||||||
|
if (StartX<0) StartX=0;
|
||||||
|
if (StartY<0) StartY=0;
|
||||||
|
|
||||||
|
int DrawW=ZoomW+8;
|
||||||
|
int DrawH=ZoomH+8;
|
||||||
|
|
||||||
|
if (StartX+DrawW>MapWidth) DrawW=MapWidth-StartX;
|
||||||
|
if (StartY+DrawH>MapHeight) DrawH=MapHeight-StartY;
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
glScalef(Scale.x,Scale.y,Scale.z);
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0);
|
glTranslatef(-ShiftX,ShiftY,0); // Set scroll offset
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||||
|
|
||||||
|
|
||||||
|
if (Ofs)
|
||||||
|
{
|
||||||
|
glTranslatef(-Ofs->x,Ofs->y,0); // Set scroll offset
|
||||||
|
}
|
||||||
|
|
||||||
glColor4f(1,1,1,Alpha);
|
glColor4f(1,1,1,Alpha);
|
||||||
for (int YLoop=0; YLoop<MapHeight; YLoop++)
|
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
||||||
{
|
{
|
||||||
for (int XLoop=0; XLoop<MapWidth; XLoop++)
|
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
||||||
{
|
{
|
||||||
sMapElem &ThisElem=ThisMap.Get(XLoop,YLoop);
|
sMapElem &ThisElem=ThisMap.Get(StartX+XLoop,StartY+YLoop);
|
||||||
if (ThisElem.Tile && Core->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
if (ThisElem.Tile && Core->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
||||||
{ // Render Non Zero Tiles
|
{ // Render Non Zero Tiles
|
||||||
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
|
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
|
||||||
|
@ -208,7 +234,7 @@ Vector3 &Scale=Core->GetScaleVector();
|
||||||
}
|
}
|
||||||
glTranslatef(1.0f,0,0); // Next X
|
glTranslatef(1.0f,0,0); // Next X
|
||||||
}
|
}
|
||||||
glTranslatef(-MapWidth,-1,0); // Next y, rewind to start X
|
glTranslatef(-DrawW,-1,0); // Next y, rewind to start X
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
@ -307,6 +333,20 @@ GLuint SelectBuffer[SELECT_BUFFER_SIZE];
|
||||||
int TileID=0;
|
int TileID=0;
|
||||||
CPoint &CursorPos=Core->GetCursorPos();
|
CPoint &CursorPos=Core->GetCursorPos();
|
||||||
|
|
||||||
|
int StartX=(int)ThisCam.x;
|
||||||
|
int StartY=(int)ThisCam.y;
|
||||||
|
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
||||||
|
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
||||||
|
|
||||||
|
if (StartX<0) StartX=0;
|
||||||
|
if (StartY<0) StartY=0;
|
||||||
|
|
||||||
|
int DrawW=ZoomW+8;
|
||||||
|
int DrawH=ZoomH+8;
|
||||||
|
|
||||||
|
if (StartX+DrawW>MapWidth) DrawW=MapWidth-StartX;
|
||||||
|
if (StartY+DrawH>MapHeight) DrawH=MapHeight-StartY;
|
||||||
|
|
||||||
glGetIntegerv(GL_VIEWPORT, Viewport);
|
glGetIntegerv(GL_VIEWPORT, Viewport);
|
||||||
glSelectBuffer (SELECT_BUFFER_SIZE, SelectBuffer );
|
glSelectBuffer (SELECT_BUFFER_SIZE, SelectBuffer );
|
||||||
glRenderMode (GL_SELECT);
|
glRenderMode (GL_SELECT);
|
||||||
|
@ -324,13 +364,15 @@ CPoint &CursorPos=Core->GetCursorPos();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
glScalef(Scale.x,Scale.y,Scale.z);
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0);
|
// glTranslatef(-ThisCam.x,ThisCam.y,0);
|
||||||
|
glTranslatef(-ShiftX,ShiftY,0);
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||||
|
|
||||||
for (int YLoop=0; YLoop<MapHeight; YLoop++)
|
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
||||||
{
|
{
|
||||||
for (int XLoop=0; XLoop<MapWidth; XLoop++)
|
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
||||||
{
|
{
|
||||||
|
TileID=(XLoop+StartX)+(((YLoop+StartY)*MapWidth));
|
||||||
glLoadName (TileID);
|
glLoadName (TileID);
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
BuildGLQuad(XLoop,XLoop+1,-YLoop,-YLoop+1,0);
|
BuildGLQuad(XLoop,XLoop+1,-YLoop,-YLoop+1,0);
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f);
|
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
||||||
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
||||||
|
|
||||||
BOOL Paint(CMap &Blk,CPoint &CursorPos);
|
BOOL Paint(CMap &Blk,CPoint &CursorPos);
|
||||||
|
|
|
@ -25,7 +25,7 @@ Resource4=IDD_DIALOGBAR (English (U.S.))
|
||||||
Resource5=IDR_MAINFRAME (English (U.S.))
|
Resource5=IDR_MAINFRAME (English (U.S.))
|
||||||
Class8=CMultiBar
|
Class8=CMultiBar
|
||||||
Resource6=IDD_MAPSIZE
|
Resource6=IDD_MAPSIZE
|
||||||
Resource7=IDR_TOOLBAR (English (U.S.))
|
Resource7=IDD_NEWMAP
|
||||||
Class9=CLayerList
|
Class9=CLayerList
|
||||||
Class10=CMapSizeDlg
|
Class10=CMapSizeDlg
|
||||||
Resource8=IDD_ABOUTBOX (English (U.S.))
|
Resource8=IDD_ABOUTBOX (English (U.S.))
|
||||||
|
@ -35,7 +35,7 @@ Resource9=IDD_LAYERTILE_GUI
|
||||||
Resource10=IDD_MULTIBAR (English (U.S.))
|
Resource10=IDD_MULTIBAR (English (U.S.))
|
||||||
Class13=CNewMapGUI
|
Class13=CNewMapGUI
|
||||||
Class14=CProgressDlg
|
Class14=CProgressDlg
|
||||||
Resource11=IDD_NEWMAP
|
Resource11=IDR_TOOLBAR (English (U.S.))
|
||||||
|
|
||||||
[CLS:CChildFrame]
|
[CLS:CChildFrame]
|
||||||
Type=0
|
Type=0
|
||||||
|
@ -86,7 +86,7 @@ Type=0
|
||||||
BaseClass=CGLEnabledView
|
BaseClass=CGLEnabledView
|
||||||
HeaderFile=MapEditView.h
|
HeaderFile=MapEditView.h
|
||||||
ImplementationFile=MapEditView.cpp
|
ImplementationFile=MapEditView.cpp
|
||||||
LastObject=ID_ZOOM_IN
|
LastObject=CMapEditView
|
||||||
Filter=C
|
Filter=C
|
||||||
VirtualFilter=VWC
|
VirtualFilter=VWC
|
||||||
|
|
||||||
|
|
|
@ -443,6 +443,7 @@ int ChildCount=ThisNode.GetPruneChildCount();
|
||||||
Tile.push_back(CTile(Core,this,Scene,ThisNode.PruneChildList[Child]));
|
Tile.push_back(CTile(Core,this,Scene,ThisNode.PruneChildList[Child]));
|
||||||
}
|
}
|
||||||
TileBrowserWidth=DefTileBrowserWidth;
|
TileBrowserWidth=DefTileBrowserWidth;
|
||||||
|
TRACE1("%i\n",Tile.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,14 +473,17 @@ CPoint CTileSet::GetTilePos(int ID)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileSet::IsTileValid(int No)
|
BOOL CTileSet::IsTileValid(int No)
|
||||||
{
|
{
|
||||||
ASSERT(No<Tile.size());
|
// ASSERT(No<Tile.size());
|
||||||
|
if (No>Tile.size()) return(FALSE);
|
||||||
{return(Tile[No].IsValid());}
|
{return(Tile[No].IsValid());}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileSet::IsTileValidGB(int No)
|
BOOL CTileSet::IsTileValidGB(int No)
|
||||||
{
|
{
|
||||||
ASSERT(No<Tile.size());
|
// ASSERT(No<Tile.size());
|
||||||
|
if (No>Tile.size()) return(FALSE);
|
||||||
|
|
||||||
return(Tile[No].IsValidGB());
|
return(Tile[No].IsValidGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ GString OutName=OutFile+".A3d";
|
||||||
|
|
||||||
// Write Tris
|
// Write Tris
|
||||||
FileHdr.TriCount=FaceList.GetTriFaceCount();
|
FileHdr.TriCount=FaceList.GetTriFaceCount();
|
||||||
FileHdr.TriList=(sTri*)FaceList.WriteTriList(File);
|
FileHdr.TriList=(sTri*)FaceList.WriteSkinList(File);
|
||||||
printf("%i Tris\n",FileHdr.TriCount);
|
printf("%i Tris\n",FileHdr.TriCount);
|
||||||
// Write Quads
|
// Write Quads
|
||||||
FileHdr.QuadCount=FaceList.GetQuadFaceCount();
|
FileHdr.QuadCount=FaceList.GetQuadFaceCount();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue