diff -Naur editor.org/GameMap.cpp editor/GameMap.cpp --- editor.org/GameMap.cpp 2005-07-01 15:28:56.000000000 +0200 +++ editor/GameMap.cpp 2005-07-04 15:55:45.197959729 +0200 @@ -2,7 +2,11 @@ #include "stdafx.h" #include "GameMap.h" #include "customnode.h" +#ifdef WIN32 #include +#else +#include +#endif GameMap::GameMap() { @@ -87,8 +91,13 @@ bool GameMap::SaveMap() { - DeleteFile("data/maps/map_graphic.imp"); - FILE *fl = fopen("data/maps/map_graphic.imp","wb"); + const char* savename="data/maps/map_graphic.imp"; +#ifdef WIN32 + DeleteFile(savename); +#else + unlink(savename); +#endif + FILE *fl = fopen(savename,"wb"); if(fl != NULL) { // Save size diff -Naur editor.org/GameMap.h editor/GameMap.h --- editor.org/GameMap.h 2005-07-01 14:30:28.000000000 +0200 +++ editor/GameMap.h 2005-07-04 15:56:50.001844116 +0200 @@ -2,8 +2,6 @@ #if !defined(AFX_SW2MAP_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_) #define AFX_SW2MAP_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_ -#pragma once - #include #include "MapObject.h" diff -Naur editor.org/Makefile editor/Makefile --- editor.org/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ editor/Makefile 2005-07-04 15:51:59.081765042 +0200 @@ -0,0 +1,17 @@ + +LDFLAGS = -L../../source/Irrlicht -lIrrlicht -lGLU -lGL -L/usr/X11R6/lib -lXxf86vm -lX11 +CPPFLAGS = -I../../include + +DEST = editor + +SRC = GameMap.cpp IrrMapEditor.cpp MapEditor.cpp ParticlesEditor.cpp stdafx.cpp strings.cpp +OBJS = $(SRC:.cpp=.o) + +editor: $(OBJS) + $(CXX) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) + +clean: + $(RM) $(OBJS) $(DEST) + +.PHONY: clean + diff -Naur editor.org/MapEditor.cpp editor/MapEditor.cpp --- editor.org/MapEditor.cpp 2005-07-01 15:17:34.000000000 +0200 +++ editor/MapEditor.cpp 2005-07-04 16:10:34.243878801 +0200 @@ -4,7 +4,12 @@ #include #include #include +#ifdef WIN32 #include +#else +#include +#include +#endif using namespace irr; @@ -17,7 +22,11 @@ MapEditor::MapEditor() { char buf[1024]; +#ifdef WIN32 GetCurrentDirectory(1024,buf); +#else + getcwd(buf,1024); +#endif dir = buf; shiftKey = false; @@ -47,7 +56,7 @@ map->width = 620; map->height = 620; - device = irr::createDevice(irr::video::EDT_DIRECTX8,irr::core::dimension2d(800,600),32,false,true,false,this,IRRLICHT_SDK_VERSION); + device = irr::createDevice(irr::video::EDT_OPENGL,irr::core::dimension2d(800,600),32,false,true,false,this,IRRLICHT_SDK_VERSION); driver = device->getVideoDriver(); driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true); smgr = device->getSceneManager(); @@ -199,7 +208,7 @@ water_properties = new IGUIEditBox*[11]; const wchar_t *wlabels[] = {L"tileSizeX",L"tileSizeY",L"tileCountX",L"tileCountY",L"countHillsX",L"countHillsY",L"textureRepeatCountX",L"textureRepeatCountY",L"waveHeight",L"waveSpeed",L"waveLenght"}; const wchar_t *wtex[] = {L"64", L"64", L"10", L"10", L"0", L"0", L"10", L"10", L"2.0", L"400", L"50"}; - for(j=0;j<11;j++) + for(int j=0;j<11;j++) { guienv->addStaticText(wlabels[j],rect(5,25+15*j,155,25+15*j+15),true,false,water_window); water_properties[j] = guienv->addEditBox(wtex[j],rect(155,25+15*j,255,25+15*j+15),true,water_window); @@ -376,6 +385,7 @@ iString MapEditor::extractFileName(char *fl) { +#ifdef WIN32 iString filename; for(int i=strlen(fl)-1;i>=0;i--) @@ -387,10 +397,17 @@ filename = fl; return filename; +#else + return basename(fl); +#endif } -bool MapEditor::addObject(char *fl,float x,float y,float z) +bool MapEditor::addObject(const wchar_t *wfl,float x,float y,float z) { + int slen = wcslen(wfl); + char *fl = new char[slen]; + wcstombs(fl,wfl,slen); + fl[slen] = 0x00; iString file = fl; iString filename = extractFileName(fl); @@ -595,7 +613,11 @@ void MapEditor::addSkyBox(iString up,iString dn,iString lf,iString rt,iString ft,iString bk,bool usedefcolor) { +#ifdef WIN32 SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif for(unsigned int i=0;imapobjects.size();i++) { if(map->mapobjects.pointer()[i].getType() == SKYBOX_NODE) @@ -659,7 +681,11 @@ } bool MapEditor::setTerrainProperties(iString heighmap,iString texture,core::vector3df scale,float texture_scale,bool usedefcolor) { +#ifdef WIN32 SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif removeTerrain(); @@ -699,7 +725,11 @@ void MapEditor::addWater(iString tex1,iString tex2,float p0,float p1,float p2,float p3,float p4,float p5,float p6,float p7,float p8,float p9,float p10,bool usedefcolor) { +#ifdef WIN32 SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif scene::IAnimatedMesh* mesh; scene::ISceneNode* node; @@ -1009,7 +1039,11 @@ s32 mid = ((IGUIContextMenu *)event.GUIEvent.Caller)->getItemCommandId(menuidx); if(mid == SAVE_MENU) { - SetCurrentDirectory(dir.c_str()); +#ifdef WIN32 + SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif map->SaveMap(); } if(mid == ADD_OBJECTS_WATER_MENU) @@ -1053,7 +1087,11 @@ if(mid == OPEN_MENU) { - SetCurrentDirectory(dir.c_str()); +#ifdef WIN32 + SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif tmpid = map->LoadMap("data/maps/map_graphic.imp",smgr,device,driver,tmpid); map->MakeAllVisibleForTest(true); map->setDefaultLight(true,true); @@ -1102,7 +1140,11 @@ } if(mid == ADD_PERTICLES_MENU) { - SetCurrentDirectory(dir.c_str()); +#ifdef WIN32 + SetCurrentDirectory(dir.c_str()); +#else + chdir(dir.c_str()); +#endif curr_pt = particles_editor->createDefaultParticle(smgr,driver); curr_pt->ps->setID(tmpid); setNodeInfrontOfCamera(curr_pt->ps); @@ -1139,12 +1181,10 @@ case EGET_FILE_SELECTED: { wchar_t str[4096]; - char val[4096]; swprintf(str,4096,L"%s",fopen_dlg->getFilename()); - sprintf(val,"%S",str); if(call_id == ADD_OBJECT_FILE_BUTTON) { - addObject(val); + addObject(fopen_dlg->getFilename()); } if(call_id == SEL_SKY_BOX_FILE_BUTTON) { diff -Naur editor.org/MapEditor.h editor/MapEditor.h --- editor.org/MapEditor.h 2005-06-03 17:59:48.000000000 +0200 +++ editor/MapEditor.h 2005-07-04 15:20:37.375377978 +0200 @@ -144,7 +144,7 @@ bool isNumber(const wchar_t *str); - bool addObject(char*filename,float x = 0.0f,float y = 0.0f,float z = 0.0f); + bool addObject(const wchar_t*filename,float x = 0.0f,float y = 0.0f,float z = 0.0f); void showObjectProperty(bool show,int objid); diff -Naur editor.org/MapObject.h editor/MapObject.h --- editor.org/MapObject.h 2005-07-01 15:41:58.000000000 +0200 +++ editor/MapObject.h 2005-07-04 15:56:55.238107553 +0200 @@ -2,8 +2,6 @@ #if !defined(AFX_SW2MAPOBJ_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_) #define AFX_SW2MAPOBJ_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_ -#pragma once - #include #include "Particle.h" #include "strings.h" diff -Naur editor.org/Particle.h editor/Particle.h --- editor.org/Particle.h 2005-07-01 15:42:54.000000000 +0200 +++ editor/Particle.h 2005-07-04 15:56:58.425659173 +0200 @@ -2,8 +2,6 @@ #if !defined(AFX_PARTICLE_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_) #define AFX_PARTICLE_H__F7431684_4B28_4CD4_A26B_AF445D3C614C__INCLUDED_ -#pragma once - #include #include "strings.h" diff -Naur editor.org/ParticlesEditor.h editor/ParticlesEditor.h --- editor.org/ParticlesEditor.h 2005-04-11 17:47:08.000000000 +0200 +++ editor/ParticlesEditor.h 2005-07-04 15:57:04.353825278 +0200 @@ -3,8 +3,6 @@ #include "stdafx.h" -#pragma once - #include #include "Particle.h" @@ -89,4 +87,4 @@ }; -#endif \ No newline at end of file +#endif diff -Naur editor.org/StdAfx.cpp editor/StdAfx.cpp --- editor.org/StdAfx.cpp 2005-03-29 14:35:40.000000000 +0200 +++ editor/StdAfx.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SW2MapEditor.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff -Naur editor.org/StdAfx.h editor/StdAfx.h --- editor.org/StdAfx.h 2005-03-29 14:35:40.000000000 +0200 +++ editor/StdAfx.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,22 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_) -#define AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_) diff -Naur editor.org/stdafx.cpp editor/stdafx.cpp --- editor.org/stdafx.cpp 1970-01-01 01:00:00.000000000 +0100 +++ editor/stdafx.cpp 2005-07-04 10:44:08.725400572 +0200 @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SW2MapEditor.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -Naur editor.org/stdafx.h editor/stdafx.h --- editor.org/stdafx.h 1970-01-01 01:00:00.000000000 +0100 +++ editor/stdafx.h 2005-03-29 14:35:40.000000000 +0200 @@ -0,0 +1,22 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_) +#define AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__87A2B579_E498_4F4C_89FB_84F2A09EB9ED__INCLUDED_) diff -Naur editor.org/strings.cpp editor/strings.cpp --- editor.org/strings.cpp 2004-07-08 15:15:24.000000000 +0200 +++ editor/strings.cpp 2005-07-04 16:12:03.648295333 +0200 @@ -93,7 +93,7 @@ wchar_t *iString::getWString() { int wlen = Length()+1; - swprintf(w_Buffer,wlen,L"%S",m_Buffer); + swprintf(w_Buffer,wlen,L"%s",m_Buffer); return w_Buffer; } @@ -144,7 +144,7 @@ return s; } -iString operator+(iString LVal, char *RVal) +iString operator+(iString LVal, const char *RVal) { iString s(LVal); s += RVal; @@ -158,7 +158,7 @@ return s; } */ -iString operator+(char *LVal, iString RVal) +iString operator+(const char *LVal, iString RVal) { iString s(LVal); s+=RVal; diff -Naur editor.org/strings.h editor/strings.h --- editor.org/strings.h 2004-07-08 14:48:56.000000000 +0200 +++ editor/strings.h 2005-07-04 11:15:10.705035742 +0200 @@ -47,9 +47,9 @@ }; iString operator+(iString &LVal, iString &RVal); -iString operator+(iString LVal, char *RVal); +iString operator+(iString LVal, const char *RVal); //iString operator+(char *LVal, iString &RVal); -iString operator+(char *LVal, iString RVal); +iString operator+(const char *LVal, iString RVal); //iString operator+(iString &LVal, int RVal); iString operator+(iString LVal, int RVal); iString operator+(int RVal, iString &LVal);