This commit is contained in:
Daveo 2000-12-01 21:08:54 +00:00
parent 80cb6d30d8
commit 8aa783b27b
10 changed files with 63 additions and 73 deletions

View File

@ -658,4 +658,6 @@ CExportPSX Exp(ExportName);
Layer[FindActionLayer()]->Export(this,Exp); Layer[FindActionLayer()]->Export(this,Exp);
Exp.ExportTiles(this); Exp.ExportTiles(this);
Exp.ExportTexList(this);
} }

View File

@ -7,8 +7,10 @@
#include "stdafx.h" #include "stdafx.h"
#include <Vector> #include <Vector>
#include "mapedit.h"
#include "Quantize.h" #include "Quantize.h"
#include "list.h"
/*****************************************************************************/ /*****************************************************************************/
@ -16,6 +18,7 @@
/*****************************************************************************/ /*****************************************************************************/
class CCore; class CCore;
class CMap; class CMap;
class CTile; class CTile;
class CExport class CExport
@ -32,7 +35,9 @@ protected:
char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT]; char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT];
FILE *File; FILE *File;
int Count; int Count;
std::vector<sMapElem> UsedTileList;
CList<sMapElem> UsedTileList;
}; };

View File

@ -188,11 +188,11 @@ int Height=ThisMap.GetHeight();
if (Alpha<1) if (Alpha<1)
{ {
glColor4f(0.5,0.5,0.5,Alpha); glColor4f(1,1,1,Alpha);
} }
else else
{ {
glColor3f(0.5,0.5,0.5); glColor3f(1,1,1);
} }
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
@ -229,9 +229,9 @@ float OverVal=0.5;
glBegin(GL_LINES); glBegin(GL_LINES);
if (Active) if (Active)
glColor3ub(255,255,255); glColor3f(1,1,1);
else else
glColor3ub(127,127,127); glColor3f(0.5,0.5,0.5);
for (int YLoop=0; YLoop<Height+1; YLoop++) for (int YLoop=0; YLoop<Height+1; YLoop++)
{ {

View File

@ -12,6 +12,12 @@ struct sMapElem
int Set; int Set;
int Tile; int Tile;
int Flags; int Flags;
BOOL operator==(sMapElem const &v1) // Doesnt Check flags
{
return(Set==v1.Set && Tile==v1.Tile);
}
}; };
enum enum

View File

@ -2,13 +2,13 @@
[General Info] [General Info]
Version=1 Version=1
LastClass=CNewMapGUI LastClass=CProgressDlg
LastTemplate=CDialog LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h" NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h" NewFileInclude2=#include "mapedit.h"
LastPage=0 LastPage=0
ClassCount=13 ClassCount=14
Class1=CChildFrame Class1=CChildFrame
Class2=CGLEnabledView Class2=CGLEnabledView
Class3=CMainFrame Class3=CMainFrame
@ -18,22 +18,23 @@ Class6=CMapEditDoc
Class7=CMapEditView Class7=CMapEditView
ResourceCount=11 ResourceCount=11
Resource1=IDD_LAYER_LIST_DIALOG Resource1=IDR_MAINFRAME (English (U.S.))
Resource2=IDD_MULTIBAR (English (U.S.)) Resource2=IDR_TOOLBAR (English (U.S.))
Resource3=IDD_MAPSIZE Resource3=IDD_MULTIBAR (English (U.S.))
Resource4=IDD_DIALOGBAR (English (U.S.)) Resource4=IDD_DIALOGBAR (English (U.S.))
Resource5=IDR_TOOLBAR (English (U.S.)) Resource5=IDD_LAYERTILE_GUI
Class8=CMultiBar Class8=CMultiBar
Resource6=IDD_ABOUTBOX (English (U.S.)) Resource6=IDD_NEW_LAYER
Resource7=IDR_MAPEDITYPE (English (U.S.)) Resource7=IDR_MAPEDITYPE (English (U.S.))
Class9=CLayerList Class9=CLayerList
Class10=CMapSizeDlg Class10=CMapSizeDlg
Resource8=IDD_NEW_LAYER Resource8=IDD_LAYER_LIST_DIALOG
Class11=CGfxToolBar Class11=CGfxToolBar
Class12=CLayerTileGUI Class12=CLayerTileGUI
Resource9=IDD_LAYERTILE_GUI Resource9=IDD_ABOUTBOX (English (U.S.))
Resource10=IDR_MAINFRAME (English (U.S.)) Resource10=IDD_MAPSIZE
Class13=CNewMapGUI Class13=CNewMapGUI
Class14=CProgressDlg
Resource11=IDD_NEWMAP Resource11=IDD_NEWMAP
[CLS:CChildFrame] [CLS:CChildFrame]
@ -305,6 +306,15 @@ HeaderFile=NewMapGUI.h
ImplementationFile=NewMapGUI.cpp ImplementationFile=NewMapGUI.cpp
BaseClass=CDialog BaseClass=CDialog
Filter=D Filter=D
LastObject=IDC_MAPSIZE_WIDTH LastObject=CNewMapGUI
VirtualFilter=dWC
[CLS:CProgressDlg]
Type=0
HeaderFile=ProgressDlg.h
ImplementationFile=ProgressDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=IDC_EDIT1
VirtualFilter=dWC VirtualFilter=dWC

View File

@ -221,7 +221,7 @@ CFileDialog Dlg(FALSE,"*.pme",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,Filter
char Filename[256]; char Filename[256];
sprintf(Filename,"%s",Dlg.GetPathName()); sprintf(Filename,"%s",Dlg.GetPathName());
Core.ExportAGB(Filename); Core.ExportPSX(Filename);
} }
/*********************************************************************************/ /*********************************************************************************/

View File

@ -42,7 +42,7 @@ sRGBData ThisRGB;
{ {
int Idx=GetTexIdx(NewTex); // Is already loaded? int Idx=GetTexIdx(NewTex); // Is already loaded?
if (Idx!=-1) return(Idx); if (Idx!=-1) return(Idx);
// sprintf(NewTex.Filename,"%s%s",Path,TexName);
TRACE1("Loading Texture %s\n",NewTex.Filename); TRACE1("Loading Texture %s\n",NewTex.Filename);
LoadBMP(NewTex.Filename,ThisRGB); LoadBMP(NewTex.Filename,ThisRGB);
RGBData=&ThisRGB; RGBData=&ThisRGB;
@ -100,25 +100,6 @@ void CTexCache::FreeBMP(sRGBData &RGBData)
} }
/**************************************************************************************/ /**************************************************************************************/
/*
for (int i=0;i<Size;i++)
{
u8 R=*RgbPtr++;
u8 G=*RgbPtr++;
u8 B=*RgbPtr++;
u8 A=255;
if ((R==BlankRGB.rgbRed && G==BlankRGB.rgbGreen && B==BlankRGB.rgbBlue)) // Create alpha for transparent pixels (flagged with PINK!!)
{
A=0;
}
Buffer[(i*4)+0]=R;
Buffer[(i*4)+1]=G;
Buffer[(i*4)+2]=B;
Buffer[(i*4)+3]=A;
}
*/
void CTexCache::LoadTex(sTex &ThisTex,sRGBData *TexData) void CTexCache::LoadTex(sTex &ThisTex,sRGBData *TexData)
{ {
std::vector<u8> Buffer; std::vector<u8> Buffer;
@ -127,53 +108,41 @@ int TexHeight=TexData->Height;
int GLWidth=AlignSize(TexWidth); int GLWidth=AlignSize(TexWidth);
int GLHeight=AlignSize(TexHeight); int GLHeight=AlignSize(TexHeight);
u8 *Src,*Dst; u8 *Src,*Dst;
u8 R,G,B,A;
// create RGB & alpha texture & ensuse texture is correct size for GL // create RGB & alpha texture & ensuse texture is correct size for GL
Buffer.resize(GLWidth*GLHeight*4); Buffer.resize(GLWidth*GLHeight*4);
Src=TexData->RGB;
Dst=&Buffer[0]; Dst=&Buffer[0];
for (int Y=0; Y<GLHeight; Y++) for (int Y=0; Y<TexHeight; Y++)
{ {
for (int X=0; X<GLWidth; X++) for (int X=0; X<TexWidth; X++)
{ {
u8 R,G,B,A;
if (X<=TexWidth && Y<=TexHeight) R=*Src++;
{ G=*Src++;
Src=(u8*)&TexData->RGB[((Y*TexWidth)+X)*3]; B=*Src++;
R=*Src++; A=255;
G=*Src++; if ((R==BlankRGB.rgbRed && G==BlankRGB.rgbGreen && B==BlankRGB.rgbBlue)) // Create alpha for transparent pixels (flagged with PINK!!)
B=*Src++;
A=255;
if ((R==BlankRGB.rgbRed && G==BlankRGB.rgbGreen && B==BlankRGB.rgbBlue)) // Create alpha for transparent pixels (flagged with PINK!!)
{ {
A=0; A=0;
} }
}
else
{
R=255;
G=0;
B=255;
A=255;
}
*Dst++=R; *Dst++=R;
*Dst++=G; *Dst++=G;
*Dst++=B; *Dst++=B;
*Dst++=A; *Dst++=A;
} }
Dst+=(GLWidth-TexWidth)*4;
} }
ThisTex.TexWidth=TexWidth; ThisTex.TexWidth=TexWidth;
ThisTex.TexHeight=TexHeight; ThisTex.TexHeight=TexHeight;
ThisTex.GLWidth=GLWidth;
ThisTex.GLHeight=GLHeight; ThisTex.dW=(1.0f)/(float)(GLWidth/16.0f);
ThisTex.dW=1.0f/(GLWidth/16); ThisTex.dH=(1.0f)/(float)(GLHeight/16.0f);
ThisTex.dW=((float)TexWidth/(float)GLWidth)/(GLWidth/16);
ThisTex.dH=((float)TexHeight/(float)GLHeight)/(GLHeight/16);
glGenTextures(1, &ThisTex.TexID); glGenTextures(1, &ThisTex.TexID);
glBindTexture(GL_TEXTURE_2D, ThisTex.TexID); glBindTexture(GL_TEXTURE_2D, ThisTex.TexID);
glTexImage2D(GL_TEXTURE_2D, 0, 4, GLWidth, GLHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &Buffer[0]); glTexImage2D(GL_TEXTURE_2D, 0, 4, GLWidth, GLHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, &Buffer[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);

View File

@ -24,11 +24,9 @@ struct sRGBData
struct sTex struct sTex
{ {
char Filename[_MAX_PATH]; char Filename[_MAX_PATH];
// char Name[_MAX_FNAME];
GLuint TexID; GLuint TexID;
int Flags; int Flags;
int TexWidth,TexHeight; int TexWidth,TexHeight;
int GLWidth,GLHeight;
float dW,dH; float dW,dH;
BOOL Loaded; BOOL Loaded;

View File

@ -486,7 +486,7 @@ BOOL ValidTile=TRUE;
ValidTile=IsTileValid(TileID); ValidTile=IsTileValid(TileID);
if (TileID && ValidTile) if (TileID && ValidTile)
{ {
glColor3f(0.5,0.5,0.5); glColor3f(1,1,1);
Tile[TileID].Render(0,Render3d); Tile[TileID].Render(0,Render3d);
} }
@ -524,7 +524,7 @@ BOOL ValidTile=TRUE;
if (!ValidTile) if (!ValidTile)
{ {
glBegin(GL_LINES); glBegin(GL_LINES);
glColor3ub(255,255,255); glColor3f(1,1,1);
glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX0,TileBrowserY0,0);
glVertex3f( TileBrowserX1,TileBrowserY1,0); glVertex3f( TileBrowserX1,TileBrowserY1,0);
@ -540,7 +540,7 @@ BOOL ValidTile=TRUE;
CPoint Pos=GetTilePos(TileID); CPoint Pos=GetTilePos(TileID);
glBegin(GL_LINES); glBegin(GL_LINES);
glColor3ub(255,255,255); glColor3f(1,1,1);
glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX0,TileBrowserY0,0);
glVertex3f( TileBrowserX1,TileBrowserY0,0); glVertex3f( TileBrowserX1,TileBrowserY0,0);
@ -621,7 +621,7 @@ int TileID=1; // Dont bother with blank, its sorted
glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z); glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z);
glBegin(GL_LINES); glBegin(GL_LINES);
glColor3ub(255,255,255); glColor3f(1,1,1);
glVertex3f( TileBrowserX0,TileBrowserY0,0); glVertex3f( TileBrowserX0,TileBrowserY0,0);
glVertex3f( TileBrowserX1,TileBrowserY0,0); glVertex3f( TileBrowserX1,TileBrowserY0,0);

View File

@ -64,9 +64,9 @@
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1 #define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 169 #define _APS_NEXT_RESOURCE_VALUE 172
#define _APS_NEXT_COMMAND_VALUE 32797 #define _APS_NEXT_COMMAND_VALUE 32797
#define _APS_NEXT_CONTROL_VALUE 1048 #define _APS_NEXT_CONTROL_VALUE 1053
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif