Fixed: tile_edit compilation

This commit is contained in:
kervala 2010-09-25 15:53:28 +02:00
parent 374271a0b4
commit 7778e8c161
16 changed files with 126 additions and 123 deletions

View file

@ -9,11 +9,6 @@
#include "custom.h" #include "custom.h"
#include "getval.h" #include "getval.h"
#include "nel/3d/tile_bank.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/file.h"
using namespace NL3D; using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
@ -178,7 +173,7 @@ LRESULT Browse::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
CDC *pDC = GetDC(); CDC *pDC = GetDC();
m_ctrl.DrawDragRect(pDC,NULL,size,&last_sel,size); //on efface l'ancien carre m_ctrl.DrawDragRect(pDC,NULL,size,&last_sel,size); //on efface l'ancien carre
m_ctrl.UpdateSelection(&current, wParam, m_128x128); //on affiche les modifes m_ctrl.UpdateSelection(&current, (int)wParam, m_128x128); //on affiche les modifes
m_ctrl.DrawDragRect(pDC,&current,size,NULL,size); //on affiche le nouveau carre m_ctrl.DrawDragRect(pDC,&current,size,NULL,size); //on affiche le nouveau carre
::ReleaseDC(*this,*pDC); ::ReleaseDC(*this,*pDC);
@ -239,7 +234,7 @@ LRESULT Browse::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
CDC *pDC = GetDC(); CDC *pDC = GetDC();
m_ctrl.DrawDragRect(pDC,NULL,size,&last_sel,size); //on efface l'ancien carre m_ctrl.DrawDragRect(pDC,NULL,size,&last_sel,size); //on efface l'ancien carre
m_ctrl.UpdateSelection(&current,wParam, m_128x128); //on affiche les modifes m_ctrl.UpdateSelection(&current,(int)wParam, m_128x128); //on affiche les modifes
::ReleaseDC(*this,*pDC); ::ReleaseDC(*this,*pDC);
@ -362,8 +357,8 @@ LRESULT Browse::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
int x = LOWORD(lParam); int x = LOWORD(lParam);
int y = HIWORD(lParam); int y = HIWORD(lParam);
int i = max (1, m_ctrl.GetNbTileLine()); int i = std::max (1, m_ctrl.GetNbTileLine());
int j = max (1, m_ctrl.GetNbTileColumn()); int j = std::max (1, m_ctrl.GetNbTileColumn());
int pos = m_ctrl.GetScrollPos(SB_VERT); int pos = m_ctrl.GetScrollPos(SB_VERT);
int hview = (m_ctrl.InfoList.GetSize(m_128x128)/i + 1)*(m_ctrl.sizeicon_y + m_ctrl.spacing_y) + m_ctrl.spacing_y; int hview = (m_ctrl.InfoList.GetSize(m_128x128)/i + 1)*(m_ctrl.sizeicon_y + m_ctrl.spacing_y) + m_ctrl.spacing_y;
m_ctrl.scrollpos = (pos*hview)/SCROLL_MAX; m_ctrl.scrollpos = (pos*hview)/SCROLL_MAX;
@ -372,7 +367,7 @@ LRESULT Browse::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
m_ctrl.GetWindowRect(&clientrect); m_ctrl.GetWindowRect(&clientrect);
InvalidateRect(NULL,false); InvalidateRect(NULL,false);
GetWindowRect(&rect); GetWindowRect(&rect);
m_ctrl.SetWindowPos(NULL, 0, 0, max (100, x - 120), y - 20, SWP_NOMOVE); m_ctrl.SetWindowPos(NULL, 0, 0, std::max (100, x - 120), y - 20, SWP_NOMOVE);
int iFirst,iLast; int iFirst,iLast;
m_ctrl.GetVisibility(iFirst, iLast, m_128x128); m_ctrl.GetVisibility(iFirst, iLast, m_128x128);
m_ctrl.UpdateBar(iFirst, iLast, m_128x128); m_ctrl.UpdateBar(iFirst, iLast, m_128x128);
@ -800,8 +795,8 @@ void Browse::OnDestroy()
if (RegCreateKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,&regkey)==ERROR_SUCCESS) if (RegCreateKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,&regkey)==ERROR_SUCCESS)
{ {
//int sel = ((CComboBox*)GetDlgItem(IDC_LISTTYPE))->GetCurSel(); //int sel = ((CComboBox*)GetDlgItem(IDC_LISTTYPE))->GetCurSel();
RegSetValueEx(regkey,REGKEY_WNDPL,0,REG_SZ,(const unsigned char*)sWindowpl,strlen(sWindowpl)); RegSetValueEx(regkey,REGKEY_WNDPL,0,REG_SZ,(const unsigned char*)sWindowpl,(DWORD)strlen(sWindowpl));
RegSetValueEx(regkey,REGKEY_LASTPATH,0,REG_SZ,(const unsigned char*)m_ctrl.LastPath.c_str(),strlen(m_ctrl.LastPath.c_str())); RegSetValueEx(regkey,REGKEY_LASTPATH,0,REG_SZ,(const unsigned char*)m_ctrl.LastPath.c_str(),(DWORD)strlen(m_ctrl.LastPath.c_str()));
RegSetValueEx(regkey,REGKEY_BUTTONZOOM,0,REG_DWORD,(const unsigned char*)&m_ctrl.Zoom,4); RegSetValueEx(regkey,REGKEY_BUTTONZOOM,0,REG_DWORD,(const unsigned char*)&m_ctrl.Zoom,4);
RegSetValueEx(regkey,REGKEY_BUTTONVARIETY,0,REG_DWORD,(const unsigned char*)&m_128x128,4); RegSetValueEx(regkey,REGKEY_BUTTONVARIETY,0,REG_DWORD,(const unsigned char*)&m_128x128,4);
RegSetValueEx(regkey,REGKEY_BUTTONTEXTURE,0,REG_DWORD,(const unsigned char*)&m_ctrl.Texture,4); RegSetValueEx(regkey,REGKEY_BUTTONTEXTURE,0,REG_DWORD,(const unsigned char*)&m_ctrl.Texture,4);

View file

@ -1,6 +1,9 @@
FILE(GLOB SRC *.cpp *.h PIC/*.c PIC/*.h) FILE(GLOB SRC *.cpp *.h PIC/*.cpp PIC/*.h)
ENABLE_LANGUAGE(RC) FILE(GLOB SRC2 cpu.cpp DllEntry.cpp Popup.* thread_win32.* TileCtrl.* TileList.* TileView.*)
LIST(REMOVE_ITEM SRC ${SRC2})
#ENABLE_LANGUAGE(RC)
ADD_EXECUTABLE(tile_edit WIN32 ${SRC} tile_edit_exe.rc) ADD_EXECUTABLE(tile_edit WIN32 ${SRC} tile_edit_exe.rc)
@ -8,10 +11,10 @@ TARGET_LINK_LIBRARIES(tile_edit ${PLATFORM_LINKFLAGS} nelmisc nel3d)
NL_DEFAULT_PROPS(tile_edit "NeL, Tools, 3D: Tile Editor") NL_DEFAULT_PROPS(tile_edit "NeL, Tools, 3D: Tile Editor")
NL_ADD_RUNTIME_FLAGS(tile_edit) NL_ADD_RUNTIME_FLAGS(tile_edit)
ADD_DEFINITIONS(-D_AFXDLL) ADD_DEFINITIONS(${MFC_DEFINITIONS})
IF(WIN32) IF(WITH_PCH)
SET_TARGET_PROPERTIES(tile_edit PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1) ADD_NATIVE_PRECOMPILED_HEADER(tile_edit ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.cpp)
ENDIF(WIN32) ENDIF(WITH_PCH)
#INSTALL(TARGETS tile_edit RUNTIME DESTINATION bin COMPONENT tools3d) INSTALL(TARGETS tile_edit RUNTIME DESTINATION bin COMPONENT tools3d)

View file

@ -38,7 +38,7 @@ void *Pic_calloc(unsigned long count, unsigned long size)
void Pic_free(void *memblock) void Pic_free(void *memblock)
{ {
unsigned long size; unsigned long size;
size=_msize(memblock); size=(unsigned long)_msize(memblock);
PIC_Sys_MEM_Allocated-=size; PIC_Sys_MEM_Allocated-=size;
PIC_Sys_MEM_NbAllocs--; PIC_Sys_MEM_NbAllocs--;
free(memblock); free(memblock);
@ -46,7 +46,7 @@ void Pic_free(void *memblock)
// ----- // -----
unsigned long Pic__msize(void *memblock) unsigned long Pic__msize(void *memblock)
{ {
return(_msize(memblock)); return(unsigned long)(_msize(memblock));
} }
// ----- // -----
unsigned long PIC_GetMemNbAllocs(void) unsigned long PIC_GetMemNbAllocs(void)
@ -61,14 +61,14 @@ unsigned long PIC_GetMemAllocated(void)
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
static unsigned char PIC_ErrorFlag; static char PIC_ErrorFlag;
static unsigned char PIC_ErrorString[PIC_ERRSIZE]; static char PIC_ErrorString[PIC_ERRSIZE];
static unsigned char PIC_Sys_FnctActive=0; static unsigned char PIC_Sys_FnctActive=0;
static void (*PIC_Sys_Fnct)(void); static void (*PIC_Sys_Fnct)(void);
void Pic_SetError(unsigned char *msg, ...) void Pic_SetError(const char *msg, ...)
{ {
unsigned char curerr[PIC_ERRSIZE],olderr[PIC_ERRSIZE]; char curerr[PIC_ERRSIZE],olderr[PIC_ERRSIZE];
va_list args; va_list args;
va_start(args,msg); va_start(args,msg);

View file

@ -31,8 +31,8 @@ typedef struct BMP_HEADER
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_BMP_Write( unsigned char *FileName, unsigned long Pic_BMP_Write( const char *FileName,
unsigned char *pPal,unsigned char *pDatas, char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d) unsigned long w, unsigned long h, unsigned long d)
{ {
@ -82,7 +82,7 @@ unsigned long Pic_BMP_Write( unsigned char *FileName,
} }
} }
slsize=w*d/8; slsize=w*d/8;
scanline=Pic_calloc(1,slsize); scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline) if (!scanline)
{ {
Pic_SetError("BMP_Write, not enough memory for scanline"); Pic_SetError("BMP_Write, not enough memory for scanline");
@ -117,15 +117,15 @@ unsigned long Pic_BMP_Write( unsigned char *FileName,
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_BMP_Read( unsigned char *FileName, unsigned long Pic_BMP_Read( const char *FileName,
unsigned char **ppPal, unsigned char **ppDatas, char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight, unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth) unsigned long *pDepth)
{ {
FILE *file; FILE *file;
BMP_HEADER bmph; BMP_HEADER bmph;
unsigned char *pPal; char *pPal;
unsigned char *pDatas; char *pDatas;
unsigned char *scanline; unsigned char *scanline;
long w,h,d; long w,h,d;
long i,x,y,rest; long i,x,y,rest;
@ -151,7 +151,7 @@ unsigned long Pic_BMP_Read( unsigned char *FileName,
} }
if (*pDepth==8) if (*pDepth==8)
{ {
pPal=Pic_calloc(1,256*3); pPal=(char*)Pic_calloc(1,256*3);
if (!pPal) if (!pPal)
{ {
Pic_SetError("BMP_Read, not enough memory for palette"); Pic_SetError("BMP_Read, not enough memory for palette");
@ -165,7 +165,7 @@ unsigned long Pic_BMP_Read( unsigned char *FileName,
fread(&pad[0],1,1,file); fread(&pad[0],1,1,file);
} }
} }
pDatas=Pic_calloc(1,w*h*d/8); pDatas=(char*)Pic_calloc(1,w*h*d/8);
if (!pDatas) if (!pDatas)
{ {
if (pPal) if (pPal)
@ -175,7 +175,7 @@ unsigned long Pic_BMP_Read( unsigned char *FileName,
Pic_SetError("BMP_Read, not enough memory for datas"); Pic_SetError("BMP_Read, not enough memory for datas");
return(0); return(0);
} }
scanline=Pic_calloc(1,w*h*d/8); scanline=(unsigned char*)Pic_calloc(1,w*h*d/8);
if (!scanline) if (!scanline)
{ {
if (pPal) if (pPal)

View file

@ -31,14 +31,14 @@ void my_error_exit(j_common_ptr cinfo)
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_JPG_Read(unsigned char *FileName, unsigned char **ppPal, unsigned char **ppDatas, unsigned long *w, unsigned long *h) unsigned long Pic_JPG_Read(const char *FileName, char **ppPal, char **ppDatas, unsigned long *w, unsigned long *h)
{ {
struct jpeg_decompress_struct cinfo; struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr; struct my_error_mgr jerr;
FILE *file; FILE *file;
JSAMPARRAY buffer; JSAMPARRAY buffer;
int row_stride,i; int row_stride,i;
unsigned char *pDatas,*pPal; char *pDatas,*pPal;
unsigned long ptr; unsigned long ptr;
error=0; error=0;
@ -65,12 +65,12 @@ unsigned long Pic_JPG_Read(unsigned char *FileName, unsigned char **ppPal, unsig
*h=cinfo.image_height; *h=cinfo.image_height;
if (!ppPal) if (!ppPal)
{ {
pDatas=Pic_calloc(1,(*w)*(*h)*3); pDatas=(char*)Pic_calloc(1,(*w)*(*h)*3);
} }
else else
{ {
pDatas=Pic_calloc(1,(*w)*(*h)); pDatas=(char*)Pic_calloc(1,(*w)*(*h));
pPal=Pic_calloc(1,256*3); pPal=(char*)Pic_calloc(1,256*3);
if (!pPal) if (!pPal)
{ {
Pic_SetError("JPG_Read, not enough memory for palette"); Pic_SetError("JPG_Read, not enough memory for palette");
@ -114,7 +114,7 @@ unsigned long Pic_JPG_Read(unsigned char *FileName, unsigned char **ppPal, unsig
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_JPG_Write(unsigned char *FileName, unsigned long Qual, unsigned char *pDatas, unsigned long w, unsigned long h) unsigned long Pic_JPG_Write(const char *FileName, unsigned long Qual, char *pDatas, unsigned long w, unsigned long h)
{ {
struct jpeg_compress_struct cinfo; struct jpeg_compress_struct cinfo;
struct my_error_mgr jerr; struct my_error_mgr jerr;
@ -150,7 +150,7 @@ unsigned long Pic_JPG_Write(unsigned char *FileName, unsigned long Qual, unsigne
row_stride = w * 3; row_stride = w * 3;
while(cinfo.next_scanline<cinfo.image_height) while(cinfo.next_scanline<cinfo.image_height)
{ {
row_pointer[0] = & pDatas[cinfo.next_scanline * row_stride]; row_pointer[0] = (JSAMPROW)& pDatas[cinfo.next_scanline * row_stride];
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1); (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
} }
jpeg_finish_compress(&cinfo); jpeg_finish_compress(&cinfo);

View file

@ -25,12 +25,12 @@ static PIC_PICTURE *GetPic(unsigned long id)
unsigned long PIC_Load(char* FileName, unsigned char Quantize) unsigned long PIC_Load(char* FileName, unsigned char Quantize)
{ {
unsigned char ext[4]; char ext[4];
unsigned long type; unsigned long type;
unsigned long i,taken,id; unsigned long i,taken,id;
PIC_PICTURE *pic; PIC_PICTURE *pic;
unsigned char *pDatas; char *pDatas;
unsigned char *pPal; char *pPal;
unsigned long w,h,Depth; unsigned long w,h,Depth;
unsigned long ret; unsigned long ret;
@ -135,7 +135,7 @@ unsigned long PIC_Load(char* FileName, unsigned char Quantize)
} }
// --- Create and place new pic struct // --- Create and place new pic struct
pic=Pic_calloc(1,sizeof(PIC_PICTURE)); pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE));
if (!pic) if (!pic)
{ {
Pic_SetError("Load, not enough memory for internal structure"); Pic_SetError("Load, not enough memory for internal structure");
@ -155,7 +155,7 @@ unsigned long PIC_Load(char* FileName, unsigned char Quantize)
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned long w, unsigned long h, unsigned long d) unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d)
{ {
unsigned long i,taken,id; unsigned long i,taken,id;
PIC_PICTURE *pic; PIC_PICTURE *pic;
@ -190,7 +190,7 @@ unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned lo
// --- Create pic // --- Create pic
if (!pDatas) if (!pDatas)
{ {
pDatas=Pic_calloc(1,w*h*d/8); pDatas=(char *)Pic_calloc(1,w*h*d/8);
if (!pDatas) if (!pDatas)
{ {
Pic_SetError("Create, not enough memory for datas"); Pic_SetError("Create, not enough memory for datas");
@ -201,7 +201,7 @@ unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned lo
{ {
if (!pPal) if (!pPal)
{ {
pPal=Pic_calloc(1,256*3); pPal=(char *)Pic_calloc(1,256*3);
if (!pPal) if (!pPal)
{ {
Pic_SetError("Create, not enough memory for palette"); Pic_SetError("Create, not enough memory for palette");
@ -214,7 +214,7 @@ unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned lo
pPal=NULL; pPal=NULL;
} }
// --- Create and place new pic struct // --- Create and place new pic struct
pic=Pic_calloc(1,sizeof(PIC_PICTURE)); pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE));
if (!pic) if (!pic)
{ {
Pic_SetError("Create, not enough memory for internal structure"); Pic_SetError("Create, not enough memory for internal structure");
@ -236,7 +236,7 @@ unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned lo
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long PIC_GetInfos( unsigned long id, unsigned long PIC_GetInfos( unsigned long id,
unsigned char* *ppPal, unsigned char* *ppDatas, char **ppPal, char **ppDatas,
unsigned long *pW, unsigned long *pH, unsigned long *pD) unsigned long *pW, unsigned long *pH, unsigned long *pD)
{ {
PIC_PICTURE *pic; PIC_PICTURE *pic;
@ -275,7 +275,7 @@ unsigned long PIC_GetInfos( unsigned long id,
static char* Conv8To24(unsigned long id) static char* Conv8To24(unsigned long id)
{ {
PIC_PICTURE *pic; PIC_PICTURE *pic;
unsigned char *buf; char *buf;
unsigned long i; unsigned long i;
pic=GetPic(id); pic=GetPic(id);
@ -284,7 +284,7 @@ static char* Conv8To24(unsigned long id)
Pic_SetError("Conv8To24, picture internal structure not found"); Pic_SetError("Conv8To24, picture internal structure not found");
return(NULL); return(NULL);
} }
buf=Pic_malloc(pic->Width*pic->Height*3); buf=(char *)Pic_malloc(pic->Width*pic->Height*3);
if (!buf) if (!buf)
{ {
Pic_SetError("Conv8To24, not enough memory for temporary buffer"); Pic_SetError("Conv8To24, not enough memory for temporary buffer");
@ -330,7 +330,7 @@ static char* Conv8To16(unsigned long id)
pix16=(r<<10)+(g<<5)+b; pix16=(r<<10)+(g<<5)+b;
buf[i]=pix16; buf[i]=pix16;
} }
return((unsigned char*)buf); return (char*)buf;
} }
// ---------------------------------------- // ----------------------------------------
@ -349,7 +349,7 @@ static char* Conv16To24(unsigned long id)
Pic_SetError("Conv16To24, picture internal structure not found"); Pic_SetError("Conv16To24, picture internal structure not found");
return(NULL); return(NULL);
} }
buf=Pic_malloc(pic->Width*pic->Height*3); buf=(unsigned char *)Pic_malloc(pic->Width*pic->Height*3);
if (!buf) if (!buf)
{ {
Pic_SetError("Conv16To24, not enough memory for temporary buffer"); Pic_SetError("Conv16To24, not enough memory for temporary buffer");
@ -365,7 +365,7 @@ static char* Conv16To24(unsigned long id)
buf[i*3+1]=(unsigned char)g; buf[i*3+1]=(unsigned char)g;
buf[i*3+2]=(unsigned char)b; buf[i*3+2]=(unsigned char)b;
} }
return(buf); return (char*)buf;
} }
// ---------------------------------------- // ----------------------------------------
@ -404,14 +404,14 @@ static char* Conv24To16(unsigned long id)
pix16=(r<<10)+(g<<5)+b; pix16=(r<<10)+(g<<5)+b;
buf[i]=pix16; buf[i]=pix16;
} }
return((unsigned char*)buf); return (char*)buf;
} }
// ---------------------------------------- // ----------------------------------------
static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr) static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr)
{ {
unsigned char *buf; char *buf;
unsigned long src,dst; unsigned long src,dst;
*pErr=0; *pErr=0;
@ -471,7 +471,7 @@ static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr)
{ {
*pErr=1; *pErr=1;
} }
return(buf); return buf;
} }
// --- // ---
if (src==24 && dst==8) if (src==24 && dst==8)
@ -490,9 +490,9 @@ static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr)
unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual) unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual)
{ {
PIC_PICTURE *pic; PIC_PICTURE *pic;
unsigned char err; char err;
unsigned char *buf; char *buf;
unsigned char *freeit; char *freeit;
unsigned long depth; unsigned long depth;
freeit=NULL; freeit=NULL;

View file

@ -27,8 +27,8 @@ typedef struct TGA_HEADER
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_TGA_Read( unsigned char *FileName, unsigned long Pic_TGA_Read( const char *FileName,
unsigned char **ppPal, unsigned char **ppDatas, char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight, unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth) unsigned long *pDepth)
{ {
@ -36,8 +36,8 @@ unsigned long Pic_TGA_Read( unsigned char *FileName,
TGA_HEADER tgah; TGA_HEADER tgah;
long w,h,d; long w,h,d;
unsigned long size; unsigned long size;
unsigned char *pDatas; char *pDatas;
unsigned char *pPal; char *pPal;
long x,y; long x,y;
long slsize; long slsize;
unsigned char *scanline; unsigned char *scanline;
@ -65,7 +65,7 @@ unsigned long Pic_TGA_Read( unsigned char *FileName,
upSideDown = ((tgah.Desc & (1 << 5))==0); upSideDown = ((tgah.Desc & (1 << 5))==0);
size=tgah.Width*tgah.Height*(tgah.ImageDepth/8); size=tgah.Width*tgah.Height*(tgah.ImageDepth/8);
pDatas=Pic_malloc(size); pDatas=(char*)Pic_malloc(size);
if (!pDatas) if (!pDatas)
{ {
Pic_SetError("TGA_Read, not enough memory"); Pic_SetError("TGA_Read, not enough memory");
@ -79,7 +79,7 @@ unsigned long Pic_TGA_Read( unsigned char *FileName,
Pic_SetError("TGA_Read, need a pointer to palette"); Pic_SetError("TGA_Read, need a pointer to palette");
return(0); return(0);
} }
pPal=Pic_calloc(1,256*3); pPal=(char*)Pic_calloc(1,256*3);
if (!pPal) if (!pPal)
{ {
Pic_SetError("TGA_Read, not enough memory for palette"); Pic_SetError("TGA_Read, not enough memory for palette");
@ -98,7 +98,7 @@ unsigned long Pic_TGA_Read( unsigned char *FileName,
} }
slsize=w*d/8; slsize=w*d/8;
scanline=Pic_calloc(1,slsize); scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline) if (!scanline)
{ {
if (pPal) if (pPal)
@ -140,8 +140,8 @@ unsigned long Pic_TGA_Read( unsigned char *FileName,
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
unsigned long Pic_TGA_Write( unsigned char *FileName, unsigned long Pic_TGA_Write( const char *FileName,
unsigned char *pPal,unsigned char *pDatas, char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d) unsigned long w, unsigned long h, unsigned long d)
{ {
FILE *file; FILE *file;
@ -186,7 +186,7 @@ unsigned long Pic_TGA_Write( unsigned char *FileName,
fwrite(pPal,1,256*3,file); fwrite(pPal,1,256*3,file);
} }
slsize=w*d/8; slsize=w*d/8;
scanline=Pic_calloc(1,slsize); scanline=(unsigned char*)Pic_calloc(1,slsize);
if (!scanline) if (!scanline)
{ {
Pic_SetError("TGA_Write, not enough memory for scanline"); Pic_SetError("TGA_Write, not enough memory for scanline");

View file

@ -1,8 +1,5 @@
#ifndef _PIC_H_ #ifndef _PIC_H_
#define _PIC_H_ #define _PIC_H_
#ifdef __cplusplus
extern "C" {
#endif
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
@ -20,12 +17,12 @@ extern "C" {
// //
extern unsigned long PIC_Load(char* FileName, unsigned char Quantize); extern unsigned long PIC_Load(char* FileName, unsigned char Quantize);
extern unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned long w, unsigned long h, unsigned long d); extern unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d);
extern unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual); extern unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual);
extern unsigned long PIC_GetInfos( unsigned long id, extern unsigned long PIC_GetInfos( unsigned long id,
unsigned char* *ppPal, unsigned char* *ppDatas, char **ppPal, char **ppDatas,
unsigned long *pW, unsigned long *pH, unsigned long *pD); unsigned long *pW, unsigned long *pH, unsigned long *pD);
@ -42,7 +39,4 @@ extern unsigned char PIC_OnErrorCall( void pFnct(void) );
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif #endif

View file

@ -1,8 +1,5 @@
#ifndef _PIC_PRIVATE_H_ #ifndef _PIC_PRIVATE_H_
#define _PIC_PRIVATE_H_ #define _PIC_PRIVATE_H_
#ifdef __cplusplus
extern "C" {
#endif
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
@ -12,8 +9,8 @@ typedef struct PIC_PICTURE
unsigned long Width; unsigned long Width;
unsigned long Height; unsigned long Height;
unsigned long Depth; unsigned long Depth;
unsigned char *pDatas; char *pDatas;
unsigned char *pPal; char *pPal;
struct PIC_PICTURE *Next; struct PIC_PICTURE *Next;
} PIC_PICTURE; } PIC_PICTURE;
@ -25,34 +22,34 @@ typedef struct PIC_PICTURE
// //
extern unsigned long Pic_JPG_Read( unsigned char *FileName, extern unsigned long Pic_JPG_Read( const char *FileName,
unsigned char **ppPal, unsigned char **ppDatas, char **ppPal, char **ppDatas,
unsigned long *w, unsigned long *h); unsigned long *w, unsigned long *h);
extern unsigned long Pic_JPG_Write( unsigned char *FileName, extern unsigned long Pic_JPG_Write( const char *FileName,
unsigned long Qual, unsigned long Qual,
unsigned char *pDatas, char *pDatas,
unsigned long w, unsigned long h); unsigned long w, unsigned long h);
// //
// TGA // TGA
// //
extern unsigned long Pic_TGA_Read( unsigned char *FileName, extern unsigned long Pic_TGA_Read( const char *FileName,
unsigned char **ppPal, unsigned char **ppDatas, char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight, unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth); unsigned long *pDepth);
extern unsigned long Pic_TGA_Write( unsigned char *FileName, extern unsigned long Pic_TGA_Write( const char *FileName,
unsigned char *pPal,unsigned char *pDatas, char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d); unsigned long w, unsigned long h, unsigned long d);
// //
// BMP // BMP
// //
extern unsigned long Pic_BMP_Read( unsigned char *FileName, extern unsigned long Pic_BMP_Read( const char *FileName,
unsigned char **ppPal, unsigned char **ppDatas, char **ppPal, char **ppDatas,
unsigned long *pWidth, unsigned long *pHeight, unsigned long *pWidth, unsigned long *pHeight,
unsigned long *pDepth); unsigned long *pDepth);
extern unsigned long Pic_BMP_Write( unsigned char *FileName, extern unsigned long Pic_BMP_Write( const char *FileName,
unsigned char *pPal,unsigned char *pDatas, char *pPal, char *pDatas,
unsigned long w, unsigned long h, unsigned long d); unsigned long w, unsigned long h, unsigned long d);
// //
// System // System
@ -61,11 +58,8 @@ extern void* Pic_malloc(unsigned long size);
extern void* Pic_calloc(unsigned long count, unsigned long size); extern void* Pic_calloc(unsigned long count, unsigned long size);
extern void Pic_free(void *memblock); extern void Pic_free(void *memblock);
extern unsigned long Pic__msize(void *memblock); extern unsigned long Pic__msize(void *memblock);
extern void Pic_SetError(unsigned char *msg, ...); extern void Pic_SetError(const char *msg, ...);
// ---------------------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif #endif

View file

@ -6,6 +6,7 @@
#include "pic.h" #include "pic.h"
#include <nel/misc/rgba.h> #include <nel/misc/rgba.h>
using namespace std;
//============================================================ //============================================================
// Image API. // Image API.
@ -15,7 +16,7 @@
bool PIC_LoadPic(string path, vector<NLMISC::CBGRA> &tampon, uint &Width, uint &Height) bool PIC_LoadPic(string path, vector<NLMISC::CBGRA> &tampon, uint &Width, uint &Height)
{ {
uint32 id; uint32 id;
unsigned char *pal, *data; char *pal, *data;
unsigned long w,h,depth; unsigned long w,h,depth;
uint i; uint i;

View file

@ -10,7 +10,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
using namespace std;
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/rgba.h> #include <nel/misc/rgba.h>
@ -19,7 +19,7 @@ using namespace std;
//============================================================ //============================================================
bool PIC_LoadPic(string Path, vector<NLMISC::CBGRA> &Tampon, uint &Width, uint &Height); bool PIC_LoadPic(std::string Path, std::vector<NLMISC::CBGRA> &Tampon, uint &Width, uint &Height);

View file

@ -9,9 +9,6 @@
#include "GetVal.h" #include "GetVal.h"
#include "Browse.h" #include "Browse.h"
#include "choose_veget_set.h" #include "choose_veget_set.h"
#include "nel/3d/tile_bank.h"
#include "nel/misc/stream.h"
#include "nel/misc/file.h"
#include <shlobj.h> #include <shlobj.h>
using namespace NL3D; using namespace NL3D;
@ -657,7 +654,7 @@ void SelectionTerritoire::OnPath()
for (uint noise=1; noise<tileBank.getDisplacementMapCount (); noise++) for (uint noise=1; noise<tileBank.getDisplacementMapCount (); noise++)
{ {
// Bitmap string // Bitmap string
string bitmapPath=tileBank.getDisplacementMap (noise); std::string bitmapPath=tileBank.getDisplacementMap (noise);
// not empty ? // not empty ?
if (bitmapPath!="") if (bitmapPath!="")

View file

@ -10,10 +10,10 @@
#include "popup.h" #include "popup.h"
#include <direct.h> #include <direct.h>
//#include "ListGroup.h" //#include "ListGroup.h"
#include "nel/3d/tile_bank.h"
//#include "ViewPopup.h" //#include "ViewPopup.h"
#include "pic\readpic.h" #include "pic/readpic.h"
using namespace std;
using namespace NL3D; using namespace NL3D;
extern CTileBank tileBank2; extern CTileBank tileBank2;
@ -602,7 +602,7 @@ tilelist::iterator TileList::GetLast(int n)
int TileList::GetSize(int n) int TileList::GetSize(int n)
{ {
//UpdateLF(); //UpdateLF();
return theList[n].size(); return (int)theList[n].size();
} }
void TileInfo::Delete () void TileInfo::Delete ()
@ -1257,7 +1257,7 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n)
rect_txt.top = pt.y + sizetile_y + spacing_tile_text; rect_txt.top = pt.y + sizetile_y + spacing_tile_text;
rect_txt.bottom += rect_txt.top + sizetext_y; rect_txt.bottom += rect_txt.top + sizetext_y;
rect_txt.left -= spacing_x; rect_txt.left -= spacing_x;
pDC->DrawText(Name,strlen(Name),&rect_txt,DT_CENTER | DT_SINGLELINE); pDC->DrawText(Name,(int)strlen(Name),&rect_txt,DT_CENTER | DT_SINGLELINE);
// Restore the device context // Restore the device context
pDC->SetBkColor( clrBk ); pDC->SetBkColor( clrBk );

View file

@ -67,9 +67,7 @@ public:
int id; //numero du tile int id; //numero du tile
}; };
using namespace std; typedef std::vector<TileInfo> tilelist;
typedef vector<TileInfo> tilelist;

View file

@ -2,5 +2,26 @@
#include "afxcmn.h" #include "afxcmn.h"
#include "afxdlgs.h" #include "afxdlgs.h"
#undef min #ifndef STDAFX_H
#undef max #define STDAFX_H
#define NOMINMAX
#include <afxwin.h>
#include <afxcmn.h>
#include <afxdlgs.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <list>
#include "nel/3d/tile_bank.h"
#include "nel/3d/tile_bank.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/file.h"
#include "nel/misc/stream.h"
#include "nel/misc/rgba.h"
#endif

View file

@ -452,7 +452,7 @@
Name="pic" Name="pic"
> >
<File <File
RelativePath=".\Pic\Pic_BMP.c" RelativePath=".\Pic\Pic_BMP.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@ -488,7 +488,7 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath=".\Pic\Pic_JPG.c" RelativePath=".\Pic\Pic_JPG.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@ -524,7 +524,7 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath=".\Pic\Pic_Manage.c" RelativePath=".\Pic\Pic_Manage.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@ -560,7 +560,7 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath=".\Pic\PIC_System.c" RelativePath=".\Pic\PIC_System.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
@ -596,7 +596,7 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath=".\Pic\Pic_TGA.c" RelativePath=".\Pic\Pic_TGA.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"