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