update of editor and g3dviewer
This commit is contained in:
parent
0537903a7d
commit
04aee1098d
|
@ -50,7 +50,7 @@ wxString ToUnicode(const string& str) {
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
const string g3dviewerVersionString= "v1.3.6";
|
const string g3dviewerVersionString= "v1.3.6";
|
||||||
const string MainWindow::winHeader= "G3D viewer " + g3dviewerVersionString + " - Built: " + __DATE__;
|
const string MainWindow::winHeader= "G3D viewer " + g3dviewerVersionString;
|
||||||
|
|
||||||
MainWindow::MainWindow(const string &modelPath)
|
MainWindow::MainWindow(const string &modelPath)
|
||||||
: wxFrame(NULL, -1, ToUnicode(winHeader),wxPoint(Renderer::windowX, Renderer::windowY),
|
: wxFrame(NULL, -1, ToUnicode(winHeader),wxPoint(Renderer::windowX, Renderer::windowY),
|
||||||
|
@ -66,7 +66,8 @@ MainWindow::MainWindow(const string &modelPath)
|
||||||
|
|
||||||
speed= 0.025f;
|
speed= 0.025f;
|
||||||
|
|
||||||
glCanvas = new GlCanvas(this);
|
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER }; // to prevent flicker
|
||||||
|
glCanvas = new GlCanvas(this, args);
|
||||||
|
|
||||||
//getGlPlatformExtensions();
|
//getGlPlatformExtensions();
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ MainWindow::MainWindow(const string &modelPath)
|
||||||
menuCustomColor->AppendCheckItem(miColorWhite, wxT("&White\t4"));
|
menuCustomColor->AppendCheckItem(miColorWhite, wxT("&White\t4"));
|
||||||
menuCustomColor->AppendCheckItem(miColorCyan, wxT("&Cyan\t5"));
|
menuCustomColor->AppendCheckItem(miColorCyan, wxT("&Cyan\t5"));
|
||||||
menuCustomColor->AppendCheckItem(miColorOrange, wxT("&Orange\t6"));
|
menuCustomColor->AppendCheckItem(miColorOrange, wxT("&Orange\t6"));
|
||||||
menuCustomColor->AppendCheckItem(miColorMagenta, wxT("&Magenta\t7"));
|
menuCustomColor->AppendCheckItem(miColorMagenta, wxT("&Pink\t7")); // it is called Pink everywhere else so...
|
||||||
menu->Append(menuCustomColor, wxT("&Custom Color"));
|
menu->Append(menuCustomColor, wxT("&Custom Color"));
|
||||||
|
|
||||||
menuMode->Check(miModeGrid, true);
|
menuMode->Check(miModeGrid, true);
|
||||||
|
@ -123,19 +124,19 @@ MainWindow::MainWindow(const string &modelPath)
|
||||||
rotX= 0.0f;
|
rotX= 0.0f;
|
||||||
rotY= 0.0f;
|
rotY= 0.0f;
|
||||||
zoom= 1.0f;
|
zoom= 1.0f;
|
||||||
|
backBrightness= 0.3f;
|
||||||
|
gridBrightness= 1.0f;
|
||||||
|
lightBrightness= 0.3f;
|
||||||
lastX= 0;
|
lastX= 0;
|
||||||
lastY= 0;
|
lastY= 0;
|
||||||
anim= 0.0f;
|
anim= 0.0f;
|
||||||
|
|
||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
|
|
||||||
//std::cout << "A" << std::endl;
|
|
||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//std::cout << "B" << std::endl;
|
|
||||||
wxIcon icon("IDI_ICON1");
|
wxIcon icon("IDI_ICON1");
|
||||||
#else
|
#else
|
||||||
//std::cout << "B" << std::endl;
|
|
||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
std::ifstream testFile("g3dviewer.ico");
|
std::ifstream testFile("g3dviewer.ico");
|
||||||
if(testFile.good()) {
|
if(testFile.good()) {
|
||||||
|
@ -143,7 +144,6 @@ MainWindow::MainWindow(const string &modelPath)
|
||||||
icon.LoadFile(wxT("g3dviewer.ico"),wxBITMAP_TYPE_ICO);
|
icon.LoadFile(wxT("g3dviewer.ico"),wxBITMAP_TYPE_ICO);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//std::cout << "C" << std::endl;
|
|
||||||
SetIcon(icon);
|
SetIcon(icon);
|
||||||
|
|
||||||
timer = new wxTimer(this);
|
timer = new wxTimer(this);
|
||||||
|
@ -165,8 +165,6 @@ void MainWindow::init(){
|
||||||
renderer->init();
|
renderer->init();
|
||||||
|
|
||||||
loadModel("");
|
loadModel("");
|
||||||
|
|
||||||
//SetTitle(ToUnicode(winHeader + "; " + modelPath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onPaint(wxPaintEvent &event){
|
void MainWindow::onPaint(wxPaintEvent &event){
|
||||||
|
@ -201,7 +199,7 @@ void MainWindow::onClose(wxCloseEvent &event){
|
||||||
|
|
||||||
unitParticleSystems.clear();
|
unitParticleSystems.clear();
|
||||||
unitParticleSystemTypes.clear();
|
unitParticleSystemTypes.clear();
|
||||||
|
|
||||||
projectileParticleSystems.clear();
|
projectileParticleSystems.clear();
|
||||||
projectileParticleSystemTypes.clear();
|
projectileParticleSystemTypes.clear();
|
||||||
splashParticleSystems.clear(); // as above
|
splashParticleSystems.clear(); // as above
|
||||||
|
@ -213,7 +211,7 @@ void MainWindow::onClose(wxCloseEvent &event){
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for the mouseweel
|
// for the mousewheel
|
||||||
void MainWindow::onMouseWheelDown(wxMouseEvent &event) {
|
void MainWindow::onMouseWheelDown(wxMouseEvent &event) {
|
||||||
wxPaintEvent paintEvent;
|
wxPaintEvent paintEvent;
|
||||||
zoom*= 1.1f;
|
zoom*= 1.1f;
|
||||||
|
@ -260,6 +258,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||||
modelPathList.clear();
|
modelPathList.clear();
|
||||||
loadModel((const char*)wxFNCONV(fileDialog.GetPath().c_str()));
|
loadModel((const char*)wxFNCONV(fileDialog.GetPath().c_str()));
|
||||||
}
|
}
|
||||||
|
isControlKeyPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
|
@ -278,6 +277,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
||||||
loadParticle(path);
|
loadParticle(path);
|
||||||
}
|
}
|
||||||
|
isControlKeyPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
|
@ -296,6 +296,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
||||||
loadProjectileParticle(path);
|
loadProjectileParticle(path);
|
||||||
}
|
}
|
||||||
|
isControlKeyPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
||||||
|
@ -314,7 +315,8 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
||||||
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
||||||
loadSplashParticle(path);
|
loadSplashParticle(path);
|
||||||
}
|
}
|
||||||
} // is it possible to join loadParticle(), loadProjectileParticle() and loadSplashParticle() to one method?
|
isControlKeyPressed = false;
|
||||||
|
} // is it possible to join loadParticle(), loadProjectileParticle() and loadSplashParticle() to one method?
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::onMenuFileClearAll(wxCommandEvent &event){
|
void MainWindow::onMenuFileClearAll(wxCommandEvent &event){
|
||||||
|
@ -328,7 +330,7 @@ void MainWindow::onMenuFileClearAll(wxCommandEvent &event){
|
||||||
|
|
||||||
unitParticleSystems.clear();
|
unitParticleSystems.clear();
|
||||||
unitParticleSystemTypes.clear();
|
unitParticleSystemTypes.clear();
|
||||||
|
|
||||||
projectileParticleSystems.clear();
|
projectileParticleSystems.clear();
|
||||||
projectileParticleSystemTypes.clear();
|
projectileParticleSystemTypes.clear();
|
||||||
splashParticleSystems.clear(); // as above
|
splashParticleSystems.clear(); // as above
|
||||||
|
@ -344,6 +346,7 @@ void MainWindow::onMenuFileClearAll(wxCommandEvent &event){
|
||||||
|
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(""));
|
GetStatusBar()->SetStatusText(ToUnicode(""));
|
||||||
timer->Start(100);
|
timer->Start(100);
|
||||||
|
isControlKeyPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuFileExit(wxCommandEvent &event) {
|
void MainWindow::onMenuFileExit(wxCommandEvent &event) {
|
||||||
|
@ -355,6 +358,7 @@ void MainWindow::loadModel(string path) {
|
||||||
this->modelPathList.push_back(path);
|
this->modelPathList.push_back(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string titlestring=winHeader;
|
||||||
for(unsigned int idx =0; idx < this->modelPathList.size(); idx++) {
|
for(unsigned int idx =0; idx < this->modelPathList.size(); idx++) {
|
||||||
string modelPath = this->modelPathList[idx];
|
string modelPath = this->modelPathList[idx];
|
||||||
|
|
||||||
|
@ -365,7 +369,9 @@ void MainWindow::loadModel(string path) {
|
||||||
model= tmpModel;
|
model= tmpModel;
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(getModelInfo().c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(getModelInfo().c_str()));
|
||||||
timer->Start(100);
|
timer->Start(100);
|
||||||
|
titlestring = extractFileFromDirectoryPath(modelPath) + " - "+ titlestring;
|
||||||
}
|
}
|
||||||
|
SetTitle(ToUnicode(titlestring));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadParticle(string path) {
|
void MainWindow::loadParticle(string path) {
|
||||||
|
@ -376,11 +382,11 @@ void MainWindow::loadParticle(string path) {
|
||||||
unitParticleSystemTypes.clear();
|
unitParticleSystemTypes.clear();
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
std::cout << "Adding to list..." << std::endl;
|
// std::cout << "Adding to list..." << std::endl;
|
||||||
this->particlePathList.push_back(path);
|
this->particlePathList.push_back(path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "Clearing list..." << std::endl;
|
// std::cout << "Clearing list..." << std::endl;
|
||||||
this->particlePathList.clear();
|
this->particlePathList.clear();
|
||||||
this->particlePathList.push_back(path);
|
this->particlePathList.push_back(path);
|
||||||
}
|
}
|
||||||
|
@ -388,6 +394,7 @@ void MainWindow::loadParticle(string path) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(this->particlePathList.size() > 0) {
|
if(this->particlePathList.size() > 0) {
|
||||||
|
string titlestring=winHeader;
|
||||||
for(unsigned int idx = 0; idx < this->particlePathList.size(); idx++) {
|
for(unsigned int idx = 0; idx < this->particlePathList.size(); idx++) {
|
||||||
string particlePath = this->particlePathList[idx];
|
string particlePath = this->particlePathList[idx];
|
||||||
string dir= extractDirectoryPathFromFile(particlePath);
|
string dir= extractDirectoryPathFromFile(particlePath);
|
||||||
|
@ -398,6 +405,7 @@ void MainWindow::loadParticle(string path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
particlePath= extractFileFromDirectoryPath(particlePath);
|
particlePath= extractFileFromDirectoryPath(particlePath);
|
||||||
|
titlestring = particlePath + " - "+ titlestring;
|
||||||
|
|
||||||
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
||||||
|
|
||||||
|
@ -415,7 +423,7 @@ void MainWindow::loadParticle(string path) {
|
||||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||||
|
|
||||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||||
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath, renderer);
|
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath, renderer);
|
||||||
|
@ -442,9 +450,10 @@ void MainWindow::loadParticle(string path) {
|
||||||
renderer->initTextureManager();
|
renderer->initTextureManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SetTitle(ToUnicode(titlestring));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest particle XML file, or broken"), wxICON_ERROR);
|
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest particle XML file, or broken"), wxICON_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -459,11 +468,11 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
projectileParticleSystemTypes.clear();
|
projectileParticleSystemTypes.clear();
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
std::cout << "Adding to list..." << std::endl;
|
// std::cout << "Adding to list..." << std::endl;
|
||||||
this->particleProjectilePathList.push_back(path);
|
this->particleProjectilePathList.push_back(path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "Clearing list..." << std::endl;
|
// std::cout << "Clearing list..." << std::endl;
|
||||||
this->particleProjectilePathList.clear();
|
this->particleProjectilePathList.clear();
|
||||||
this->particleProjectilePathList.push_back(path);
|
this->particleProjectilePathList.push_back(path);
|
||||||
}
|
}
|
||||||
|
@ -471,7 +480,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(this->particleProjectilePathList.size() > 0) {
|
if(this->particleProjectilePathList.size() > 0) {
|
||||||
|
string titlestring=winHeader;
|
||||||
for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
|
for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
|
||||||
string particlePath = this->particleProjectilePathList[idx];
|
string particlePath = this->particleProjectilePathList[idx];
|
||||||
string dir= extractDirectoryPathFromFile(particlePath);
|
string dir= extractDirectoryPathFromFile(particlePath);
|
||||||
|
@ -482,6 +491,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
particlePath= extractFileFromDirectoryPath(particlePath);
|
particlePath= extractFileFromDirectoryPath(particlePath);
|
||||||
|
titlestring = particlePath + " - "+ titlestring;
|
||||||
|
|
||||||
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
||||||
|
|
||||||
|
@ -499,18 +509,18 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(dir + folderDelimiter + particlePath);
|
xmlTree.load(dir + folderDelimiter + particlePath);
|
||||||
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
std::cout << "Loaded successfully, loading values..." << std::endl;
|
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||||
|
|
||||||
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||||
projectileParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer);
|
projectileParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer);
|
||||||
|
|
||||||
std::cout << "Values loaded, about to read..." << std::endl;
|
// std::cout << "Values loaded, about to read..." << std::endl;
|
||||||
|
|
||||||
projectileParticleSystemTypes.push_back(projectileParticleSystemType);
|
projectileParticleSystemTypes.push_back(projectileParticleSystemType);
|
||||||
|
|
||||||
|
@ -541,6 +551,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
//renderer.manageParticleSystem(psProj, rsGame);
|
//renderer.manageParticleSystem(psProj, rsGame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SetTitle(ToUnicode(titlestring));
|
||||||
|
|
||||||
if(path != "" && fileExists(path) == true) {
|
if(path != "" && fileExists(path) == true) {
|
||||||
renderer->initModelManager();
|
renderer->initModelManager();
|
||||||
|
@ -548,7 +559,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest projectile particle XML file, or broken"), wxICON_ERROR);
|
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest projectile particle XML file, or broken"), wxICON_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -560,14 +571,14 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
if(path != "" && fileExists(path) == true) {
|
if(path != "" && fileExists(path) == true) {
|
||||||
renderer->end();
|
renderer->end();
|
||||||
splashParticleSystems.clear();
|
splashParticleSystems.clear();
|
||||||
splashParticleSystemTypes.clear();
|
splashParticleSystemTypes.clear();
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
std::cout << "Adding to list..." << std::endl;
|
// std::cout << "Adding to list..." << std::endl;
|
||||||
this->particleSplashPathList.push_back(path);
|
this->particleSplashPathList.push_back(path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "Clearing list..." << std::endl;
|
// std::cout << "Clearing list..." << std::endl;
|
||||||
this->particleSplashPathList.clear();
|
this->particleSplashPathList.clear();
|
||||||
this->particleSplashPathList.push_back(path);
|
this->particleSplashPathList.push_back(path);
|
||||||
}
|
}
|
||||||
|
@ -575,7 +586,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(this->particleSplashPathList.size() > 0) {
|
if(this->particleSplashPathList.size() > 0) {
|
||||||
|
string titlestring=winHeader;
|
||||||
for(unsigned int idx = 0; idx < this->particleSplashPathList.size(); idx++) {
|
for(unsigned int idx = 0; idx < this->particleSplashPathList.size(); idx++) {
|
||||||
string particlePath = this->particleSplashPathList[idx];
|
string particlePath = this->particleSplashPathList[idx];
|
||||||
string dir= extractDirectoryPathFromFile(particlePath);
|
string dir= extractDirectoryPathFromFile(particlePath);
|
||||||
|
@ -586,6 +597,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
}
|
}
|
||||||
|
|
||||||
particlePath= extractFileFromDirectoryPath(particlePath);
|
particlePath= extractFileFromDirectoryPath(particlePath);
|
||||||
|
titlestring = particlePath + " - "+ titlestring;
|
||||||
|
|
||||||
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
std::string unitXML = dir + folderDelimiter + extractFileFromDirectoryPath(dir) + ".xml";
|
||||||
|
|
||||||
|
@ -603,18 +615,18 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(dir + folderDelimiter + particlePath);
|
xmlTree.load(dir + folderDelimiter + particlePath);
|
||||||
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
std::cout << "Loaded successfully, loading values..." << std::endl;
|
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||||
|
|
||||||
ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash();
|
ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash();
|
||||||
splashParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer); // <---- only that must be splash...
|
splashParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer); // <---- only that must be splash...
|
||||||
|
|
||||||
std::cout << "Values loaded, about to read..." << std::endl;
|
// std::cout << "Values loaded, about to read..." << std::endl;
|
||||||
|
|
||||||
splashParticleSystemTypes.push_back(splashParticleSystemType);
|
splashParticleSystemTypes.push_back(splashParticleSystemType);
|
||||||
|
|
||||||
|
@ -638,6 +650,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
renderer->manageParticleSystem(ps);
|
renderer->manageParticleSystem(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SetTitle(ToUnicode(titlestring));
|
||||||
|
|
||||||
if(path != "" && fileExists(path) == true) {
|
if(path != "" && fileExists(path) == true) {
|
||||||
renderer->initModelManager();
|
renderer->initModelManager();
|
||||||
|
@ -645,7 +658,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest splash particle XML file, or broken"), wxICON_ERROR);
|
wxMessageBox( ToUnicode(e.what()), wxT("Not a Mega-Glest splash particle XML file, or broken"), wxICON_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -798,8 +811,9 @@ string MainWindow::getModelInfo(){
|
||||||
|
|
||||||
void MainWindow::onKeyDown(wxKeyEvent &e) {
|
void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
|
|
||||||
std::cout << "e.ControlDown() = " << e.ControlDown() << " e.GetKeyCode() = " << e.GetKeyCode() << " isCtrl = " << (e.GetKeyCode() == WXK_CONTROL) << std::endl;
|
// std::cout << "e.ControlDown() = " << e.ControlDown() << " e.GetKeyCode() = " << e.GetKeyCode() << " isCtrl = " << (e.GetKeyCode() == WXK_CONTROL) << std::endl;
|
||||||
|
|
||||||
|
// Note: This ctrl-key handling is buggy since it never resests when ctrl is released later, so I reset it at end of loadcommands for now.
|
||||||
if(e.ControlDown() == true || e.GetKeyCode() == WXK_CONTROL) {
|
if(e.ControlDown() == true || e.GetKeyCode() == WXK_CONTROL) {
|
||||||
isControlKeyPressed = true;
|
isControlKeyPressed = true;
|
||||||
}
|
}
|
||||||
|
@ -807,16 +821,48 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
isControlKeyPressed = false;
|
isControlKeyPressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "isControlKeyPressed = " << isControlKeyPressed << std::endl;
|
// std::cout << "isControlKeyPressed = " << isControlKeyPressed << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// here also becuase + and - hotkeys don't work for numpad automaticly
|
// here also because + and - hotkeys don't work for numpad automaticly
|
||||||
if (e.GetKeyCode() == 388) speed*= 1.5f; //numpad+
|
if (e.GetKeyCode() == 388) speed*= 1.5f; //numpad+
|
||||||
else if (e.GetKeyCode() == 390) speed/= 1.5f; //numpad-
|
else if (e.GetKeyCode() == 390) speed/= 1.5f; //numpad-
|
||||||
|
else if (e.GetKeyCode() == 87) {
|
||||||
|
glClearColor(0.6f, 0.6f, 0.6f, 1.0f); //w key //backgroundcolor constant 0.3 -> 0.6
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// some posibility to adjust brightness:
|
||||||
|
/*
|
||||||
|
else if (e.GetKeyCode() == 322) { // Ins - Grid
|
||||||
|
gridBrightness += 0.1f; if (gridBrightness >1.0) gridBrightness =1.0;
|
||||||
|
}
|
||||||
|
else if (e.GetKeyCode() == 127) { // Del
|
||||||
|
gridBrightness -= 0.1f; if (gridBrightness <0) gridBrightness =0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
else if (e.GetKeyCode() == 313) { // Home - Background
|
||||||
|
backBrightness += 0.1f; if (backBrightness >1.0) backBrightness=1.0;
|
||||||
|
glClearColor(backBrightness, backBrightness, backBrightness, 1.0f);
|
||||||
|
}
|
||||||
|
else if (e.GetKeyCode() == 312) { // End
|
||||||
|
backBrightness -= 0.1f; if (backBrightness<0) backBrightness=0;
|
||||||
|
glClearColor(backBrightness, backBrightness, backBrightness, 1.0f);
|
||||||
|
}
|
||||||
|
else if (e.GetKeyCode() == 366) { // PgUp - Lightning of model
|
||||||
|
lightBrightness += 0.1f; if (lightBrightness >1.0) lightBrightness =1.0;
|
||||||
|
Vec4f ambientNEW= Vec4f(lightBrightness, lightBrightness, lightBrightness, 1.0f);
|
||||||
|
glLightfv(GL_LIGHT0,GL_AMBIENT, ambientNEW.ptr());
|
||||||
|
}
|
||||||
|
else if (e.GetKeyCode() == 367) { // pgDn
|
||||||
|
lightBrightness -= 0.1f; if (lightBrightness <0) lightBrightness =0;
|
||||||
|
Vec4f ambientNEW= Vec4f(lightBrightness, lightBrightness, lightBrightness, 1.0f);
|
||||||
|
glLightfv(GL_LIGHT0,GL_AMBIENT, ambientNEW.ptr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuRestart(wxCommandEvent &event){
|
void MainWindow::onMenuRestart(wxCommandEvent &event){
|
||||||
std::cout << "pressed R (restart particle animation)" << std::endl;
|
// std::cout << "pressed R (restart particle animation)" << std::endl;
|
||||||
renderer->end();
|
renderer->end();
|
||||||
|
|
||||||
unitParticleSystems.clear();
|
unitParticleSystems.clear();
|
||||||
|
@ -882,6 +928,12 @@ GlCanvas::GlCanvas(MainWindow * mainWindow):
|
||||||
this->mainWindow = mainWindow;
|
this->mainWindow = mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to prevent flicker
|
||||||
|
GlCanvas::GlCanvas(MainWindow * mainWindow, int *args)
|
||||||
|
: wxGLCanvas(mainWindow, -1, wxDefaultPosition, wxDefaultSize, 0, wxT("GLCanvas"), args) {
|
||||||
|
this->mainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
// for the mousewheel
|
// for the mousewheel
|
||||||
void GlCanvas::onMouseWheel(wxMouseEvent &event) {
|
void GlCanvas::onMouseWheel(wxMouseEvent &event) {
|
||||||
if(event.GetWheelRotation()>0) mainWindow->onMouseWheelDown(event);
|
if(event.GetWheelRotation()>0) mainWindow->onMouseWheelDown(event);
|
||||||
|
@ -918,10 +970,10 @@ bool App::OnInit(){
|
||||||
std::string modelPath;
|
std::string modelPath;
|
||||||
if(argc==2){
|
if(argc==2){
|
||||||
if(argv[1][0]=='-') { // any flag gives help and exits program.
|
if(argv[1][0]=='-') { // any flag gives help and exits program.
|
||||||
std::cout << "G3D viewer " << g3dviewerVersionString << std::endl << std::endl;
|
std::cout << "G3D viewer " << g3dviewerVersionString << std::endl << std::endl;
|
||||||
std::cout << "glest_g3dviewer [G3D 3D-MODEL FILE]" << std::endl << std::endl;
|
std::cout << "glest_g3dviewer [G3D 3D-MODEL FILE]" << std::endl << std::endl;
|
||||||
std::cout << "Displays glest 3D-models and unit/projectile/splash particle systems." << std::endl;
|
std::cout << "Displays glest 3D-models and unit/projectile/splash particle systems." << std::endl;
|
||||||
std::cout << "rotate with left mouse button, zoom with right mouse button or mousewheel." << std::endl;
|
std::cout << "rotate with left mouse button, zoom with right mouse button or mousewheel." << std::endl;
|
||||||
std::cout << "Use ctrl to load more than one particle system. Press R to restart particles." << std::endl << std::endl;
|
std::cout << "Use ctrl to load more than one particle system. Press R to restart particles." << std::endl << std::endl;
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,8 @@ private:
|
||||||
|
|
||||||
float speed;
|
float speed;
|
||||||
float anim;
|
float anim;
|
||||||
float rotX, rotY, zoom;
|
float rotX, rotY, zoom;
|
||||||
|
float backBrightness, gridBrightness, lightBrightness;
|
||||||
int lastX, lastY;
|
int lastX, lastY;
|
||||||
Renderer::PlayerColor playerColor;
|
Renderer::PlayerColor playerColor;
|
||||||
|
|
||||||
|
@ -139,8 +140,8 @@ private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlCanvas(MainWindow *mainWindow);
|
GlCanvas(MainWindow *mainWindow);
|
||||||
|
GlCanvas(MainWindow *mainWindow, int *args);
|
||||||
|
|
||||||
void onMouseWheel(wxMouseEvent &event);
|
void onMouseWheel(wxMouseEvent &event);
|
||||||
void onMouseMove(wxMouseEvent &event);
|
void onMouseMove(wxMouseEvent &event);
|
||||||
|
|
|
@ -186,7 +186,7 @@ void Renderer::init(){
|
||||||
customTextureYellow->getPixmap()->init(1, 1, 3);
|
customTextureYellow->getPixmap()->init(1, 1, 3);
|
||||||
customTextureYellow->getPixmap()->setPixel(0, 0, Vec3f(1.f, 1.f, 0.f));
|
customTextureYellow->getPixmap()->setPixel(0, 0, Vec3f(1.f, 1.f, 0.f));
|
||||||
|
|
||||||
//white tex
|
//white tex
|
||||||
customTextureWhite= textureManager->newTexture2D();
|
customTextureWhite= textureManager->newTexture2D();
|
||||||
customTextureWhite->getPixmap()->init(1, 1, 3);
|
customTextureWhite->getPixmap()->init(1, 1, 3);
|
||||||
customTextureWhite->getPixmap()->setPixel(0, 0, Vec3f(1.f, 1.f, 1.f));
|
customTextureWhite->getPixmap()->setPixel(0, 0, Vec3f(1.f, 1.f, 1.f));
|
||||||
|
@ -206,7 +206,7 @@ void Renderer::init(){
|
||||||
customTextureMagenta->getPixmap()->init(1, 1, 3);
|
customTextureMagenta->getPixmap()->init(1, 1, 3);
|
||||||
customTextureMagenta->getPixmap()->setPixel(0, 0, Vec3f(1.f, 0.5f, 1.f));
|
customTextureMagenta->getPixmap()->setPixel(0, 0, Vec3f(1.f, 0.5f, 1.f));
|
||||||
|
|
||||||
glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
|
glClearColor(0.3f, 0.3f, 0.3f, 1.0f); //backgroundcolor constant 0.3
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
@ -301,7 +301,7 @@ void Renderer::renderGrid(){
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f); // gridcolor constant
|
||||||
for(i=-10.0f; i<=10.0f; i+=1.0f){
|
for(i=-10.0f; i<=10.0f; i+=1.0f){
|
||||||
glVertex3f(i, 0.0f, 10.0f);
|
glVertex3f(i, 0.0f, 10.0f);
|
||||||
glVertex3f(i, 0.0f, -10.0f);
|
glVertex3f(i, 0.0f, -10.0f);
|
||||||
|
@ -347,7 +347,7 @@ void Renderer::renderTheModel(Model *model, float f){
|
||||||
glPushAttrib(GL_ENABLE_BIT);
|
glPushAttrib(GL_ENABLE_BIT);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f); //normalscolor constant
|
||||||
modelRenderer->renderNormalsOnly(model);
|
modelRenderer->renderNormalsOnly(model);
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_players_player[] = {
|
static const char *brush_players_player[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #FFFF00",
|
" c #FFFF00",
|
||||||
". c #008080",
|
". c #008080",
|
||||||
|
"@ c #000000",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXX......XXXXX",
|
"XXXXX......XXXXX",
|
||||||
|
@ -18,8 +19,8 @@ static const char *brush_players_player[] = {
|
||||||
"...... ........",
|
"...... ........",
|
||||||
"...... ........",
|
"...... ........",
|
||||||
"X..... .......X",
|
"X..... .......X",
|
||||||
"X.... ......X",
|
"X.... @@@@@@@",
|
||||||
"XX............XX",
|
"XX........@@@@@X",
|
||||||
"XXX..........XXX",
|
"XXX........@@@XX",
|
||||||
"XXXXX......XXXXX"
|
"XXXXX......X@XXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_surface_custom[] = {
|
static const char *brush_surface_custom[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #000000",
|
" c #2D2013",
|
||||||
". c #7c4645",
|
". c #7c4645",
|
||||||
|
"@ c #C48C54",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXXXXXXXXXXXXX",
|
"XXXXXXXXXXXXXXXX",
|
||||||
" ",
|
"@@@@@@@@@@@@@@@.",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" ",
|
" ",
|
||||||
"XXXXXXXXXXXXXXXX"
|
"XXXXXXXXXXXXXXXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_surface_grass1[] = {
|
static const char *brush_surface_grass1[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #000000",
|
" c #003300",
|
||||||
". c #00a000",
|
". c #00a000",
|
||||||
|
"@ c #00E000",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXXXXXXXXXXXXX",
|
"XXXXXXXXXXXXXXXX",
|
||||||
" ",
|
"@@@@@@@@@@@@@@@.",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" ",
|
" ",
|
||||||
"XXXXXXXXXXXXXXXX"
|
"XXXXXXXXXXXXXXXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_surface_grass2[] = {
|
static const char *brush_surface_grass2[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #000000",
|
" c #192600",
|
||||||
". c #536e0b",
|
". c #536e0b",
|
||||||
|
"@ c #70A800",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXXXXXXXXXXXXX",
|
"XXXXXXXXXXXXXXXX",
|
||||||
" ",
|
"@@@@@@@@@@@@@@@.",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" ",
|
" ",
|
||||||
"XXXXXXXXXXXXXXXX"
|
"XXXXXXXXXXXXXXXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_surface_road[] = {
|
static const char *brush_surface_road[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #000000",
|
" c #261300",
|
||||||
". c #800000",
|
". c #800000",
|
||||||
|
"@ c #A85400",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXXXXXXXXXXXXX",
|
"XXXXXXXXXXXXXXXX",
|
||||||
" ",
|
"@@@@@@@@@@@@@@@.",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" ",
|
" ",
|
||||||
"XXXXXXXXXXXXXXXX"
|
"XXXXXXXXXXXXXXXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static const char *brush_surface_stone[] = {
|
static const char *brush_surface_stone[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 3 1",
|
"16 16 4 1",
|
||||||
" c #000000",
|
" c #2D2D2D",
|
||||||
". c #808080",
|
". c #808080",
|
||||||
|
"@ c #C4C4C4",
|
||||||
"X c None",
|
"X c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"XXXXXXXXXXXXXXXX",
|
"XXXXXXXXXXXXXXXX",
|
||||||
" ",
|
"@@@@@@@@@@@@@@@.",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" .............. ",
|
"@.............. ",
|
||||||
" ",
|
" ",
|
||||||
"XXXXXXXXXXXXXXXX"
|
"XXXXXXXXXXXXXXXX"
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,16 +9,16 @@ static const char *edit_switch_surfaces[] = {
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
|
||||||
"..... .. . ",
|
"..... .. . ",
|
||||||
".... .. .. ",
|
".... .. .. ",
|
||||||
"... ..... ",
|
"... .. ... ",
|
||||||
"... ..... ",
|
".. ...... ",
|
||||||
|
".. ...... ",
|
||||||
|
"... .. ... ",
|
||||||
".... .. .. ",
|
".... .. .. ",
|
||||||
"..... .. . ",
|
"..... .. . ",
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
"........ ",
|
||||||
"........ ",
|
|
||||||
"........ "
|
"........ "
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,8 +22,10 @@ using namespace std;
|
||||||
|
|
||||||
namespace MapEditor {
|
namespace MapEditor {
|
||||||
|
|
||||||
const string MainWindow::versionString = "v1.5.0";
|
|
||||||
const string MainWindow::winHeader = "Glest Map Editor " + versionString + " - Built: " + __DATE__;
|
|
||||||
|
const string mapeditorVersionString = "v1.5.1";
|
||||||
|
const string MainWindow::winHeader = "Glest Map Editor " + mapeditorVersionString;
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
// class Global functions
|
// class Global functions
|
||||||
|
@ -69,6 +71,7 @@ MainWindow::MainWindow()
|
||||||
|
|
||||||
//file
|
//file
|
||||||
menuFile = new wxMenu();
|
menuFile = new wxMenu();
|
||||||
|
menuFile->Append(wxID_NEW);
|
||||||
menuFile->Append(wxID_OPEN);
|
menuFile->Append(wxID_OPEN);
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(wxID_SAVE);
|
menuFile->Append(wxID_SAVE);
|
||||||
|
@ -81,115 +84,133 @@ MainWindow::MainWindow()
|
||||||
menuEdit = new wxMenu();
|
menuEdit = new wxMenu();
|
||||||
menuEdit->Append(miEditUndo, wxT("&Undo\tCTRL+Z"));
|
menuEdit->Append(miEditUndo, wxT("&Undo\tCTRL+Z"));
|
||||||
menuEdit->Append(miEditRedo, wxT("&Redo\tCTRL+Y"));
|
menuEdit->Append(miEditRedo, wxT("&Redo\tCTRL+Y"));
|
||||||
menuEdit->Append(miEditReset, wxT("Rese&t"));
|
menuEdit->AppendSeparator();
|
||||||
menuEdit->Append(miEditResetPlayers, wxT("Reset &Players"));
|
// menuEdit->Append(miEditReset, wxT("Rese&t..."));
|
||||||
menuEdit->Append(miEditResize, wxT("Re&size"));
|
menuEdit->Append(miEditResetPlayers, wxT("Reset &Players..."));
|
||||||
|
menuEdit->Append(miEditResize, wxT("Re&size..."));
|
||||||
menuEdit->Append(miEditFlipX, wxT("Flip &X"));
|
menuEdit->Append(miEditFlipX, wxT("Flip &X"));
|
||||||
menuEdit->Append(miEditFlipY, wxT("Flip &Y"));
|
menuEdit->Append(miEditFlipY, wxT("Flip &Y"));
|
||||||
|
|
||||||
|
// Mirror submenu-------------------------------------------
|
||||||
|
menuEditMirror = new wxMenu();
|
||||||
|
menuEditMirror->Append(miEditMirrorX, wxT("Copy &Left to Right"));
|
||||||
|
menuEditMirror->Append(miEditMirrorY, wxT("Copy &Top to Bottom"));
|
||||||
|
menuEditMirror->Append(miEditMirrorXY, wxT("Copy &BottomLeft to TopRight"));
|
||||||
|
menuEditMirror->AppendSeparator();
|
||||||
|
menuEditMirror->Append(miEditRotatecopyX, wxT("&Rotate Left to Right"));
|
||||||
|
menuEditMirror->Append(miEditRotatecopyY, wxT("Rotate T&op to Bottom"));
|
||||||
|
menuEditMirror->Append(miEditRotatecopyXY, wxT("Rotate Botto&mLeft to TopRight"));
|
||||||
|
menuEditMirror->Append(miEditRotatecopyCorner, wxT("Rotate TopLeft &corner to TopRight"));
|
||||||
|
menuEdit->Append(miEditMirror, wxT("&Mirror"), menuEditMirror);
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
menuEdit->Append(miEditRandomizeHeights, wxT("Randomize &Heights"));
|
menuEdit->Append(miEditRandomizeHeights, wxT("Randomize &Heights"));
|
||||||
menuEdit->Append(miEditRandomize, wxT("Randomi&ze"));
|
menuEdit->Append(miEditRandomize, wxT("Randomi&ze Heights/Players"));
|
||||||
menuEdit->Append(miEditSwitchSurfaces, wxT("Switch Su&rfaces"));
|
menuEdit->Append(miEditSwitchSurfaces, wxT("Switch Sur&faces..."));
|
||||||
menuEdit->Append(miEditInfo, wxT("&Info"));
|
menuEdit->Append(miEditInfo, wxT("&Info..."));
|
||||||
menuEdit->Append(miEditAdvanced, wxT("&Advanced"));
|
menuEdit->Append(miEditAdvanced, wxT("&Advanced..."));
|
||||||
menuBar->Append(menuEdit, wxT("&Edit"));
|
menuBar->Append(menuEdit, wxT("&Edit"));
|
||||||
|
|
||||||
//misc
|
//view
|
||||||
menuMisc = new wxMenu();
|
menuView = new wxMenu();
|
||||||
menuMisc->Append(miMiscResetZoomAndPos, wxT("&Reset zoom and pos"));
|
menuView->Append(miViewResetZoomAndPos, wxT("&Reset zoom and pos"));
|
||||||
menuMisc->Append(miMiscAbout, wxT("&About"));
|
menuView->AppendSeparator();
|
||||||
menuMisc->Append(miMiscHelp, wxT("&Help"));
|
menuView->Append(miViewHelp, wxT("&Help..."));
|
||||||
menuBar->Append(menuMisc, wxT("&Misc"));
|
menuView->Append(miViewAbout, wxT("&About..."));
|
||||||
|
menuBar->Append(menuView, wxT("&View"));
|
||||||
|
|
||||||
//brush
|
//brush
|
||||||
menuBrush = new wxMenu();
|
// menuBrush = new wxMenu();
|
||||||
|
|
||||||
// Glest height brush
|
//surface
|
||||||
menuBrushHeight = new wxMenu();
|
menuBrushSurface = new wxMenu();
|
||||||
for (int i = 0; i < heightCount; ++i) {
|
menuBrushSurface->AppendCheckItem(miBrushSurface + 1, wxT("&Grass"));
|
||||||
menuBrushHeight->AppendCheckItem(miBrushHeight + i + 1, ToUnicode(intToStr(i - heightCount / 2)));
|
menuBrushSurface->AppendCheckItem(miBrushSurface + 2, wxT("S&econdary grass"));
|
||||||
}
|
menuBrushSurface->AppendCheckItem(miBrushSurface + 3, wxT("&Road"));
|
||||||
menuBrushHeight->Check(miBrushHeight + (heightCount + 1) / 2, true);
|
menuBrushSurface->AppendCheckItem(miBrushSurface + 4, wxT("&Stone"));
|
||||||
menuBrush->Append(miBrushHeight, wxT("&Height"), menuBrushHeight);
|
menuBrushSurface->AppendCheckItem(miBrushSurface + 5, wxT("Gr&ound"));
|
||||||
|
menuBar->Append(menuBrushSurface, wxT("&Surface"));
|
||||||
|
|
||||||
enabledGroup = ctHeight;
|
//resources
|
||||||
|
menuBrushResource = new wxMenu();
|
||||||
|
//menuBrushResource->AppendCheckItem(miBrushResource + 1, wxT("&0 - None"));
|
||||||
|
menuBrushResource->AppendCheckItem(miBrushResource+2, wxT("&Gold (unwalkable)"));
|
||||||
|
menuBrushResource->AppendCheckItem(miBrushResource+3, wxT("&Stone (unwalkable)"));
|
||||||
|
menuBrushResource->AppendCheckItem(miBrushResource+4, wxT("&3 - custom"));
|
||||||
|
menuBrushResource->AppendCheckItem(miBrushResource+5, wxT("&4 - custom"));
|
||||||
|
menuBrushResource->AppendCheckItem(miBrushResource+6, wxT("&5 - custom"));
|
||||||
|
menuBar->Append(menuBrushResource, wxT("&Resource"));
|
||||||
|
|
||||||
|
//objects
|
||||||
|
menuBrushObject = new wxMenu();
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+1, wxT("&None (erase)\tALT+0"));
|
||||||
|
menuBrushObject->AppendSeparator();
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+2, wxT("&Tree (harvestable)"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+3, wxT("&Dead tree/Cactuses/Thornbush"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+4, wxT("&Stone"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+5, wxT("&Bush/Grass/Fern (walkable)"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+6, wxT("&Water object/Reed/Papyrus (walkable)"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+7, wxT("Big tree/&Old palm"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+8, wxT("&Hanged/Impaled "));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+9, wxT("St&atues"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+10, wxT("&Mountain"));
|
||||||
|
menuBrushObject->AppendCheckItem(miBrushObject+11, wxT("&Invisible blocking object"));
|
||||||
|
menuBar->Append(menuBrushObject, wxT("&Object"));
|
||||||
|
|
||||||
// ZombiePirate height brush
|
// ZombiePirate height brush
|
||||||
menuBrushGradient = new wxMenu();
|
menuBrushGradient = new wxMenu();
|
||||||
for (int i = 0; i < heightCount; ++i) {
|
for (int i = 0; i < heightCount; ++i) {
|
||||||
menuBrushGradient->AppendCheckItem(miBrushGradient + i + 1, ToUnicode(intToStr(i - heightCount / 2)));
|
menuBrushGradient->AppendCheckItem(miBrushGradient + i + 1, ToUnicode((i>4?"&":"") +intToStr(i - heightCount / 2)));
|
||||||
}
|
}
|
||||||
menuBrush->Append(miBrushGradient, wxT("&Gradient"), menuBrushGradient);
|
menuBar->Append(menuBrushGradient, wxT("&Gradient"));
|
||||||
|
|
||||||
//surface
|
// Glest height brush
|
||||||
menuBrushSurface = new wxMenu();
|
menuBrushHeight = new wxMenu();
|
||||||
menuBrushSurface->AppendCheckItem(miBrushSurface + 1, wxT("&1 - Grass"));
|
for (int i = 0; i < heightCount; ++i) {
|
||||||
menuBrushSurface->AppendCheckItem(miBrushSurface + 2, wxT("&2 - Secondary Grass"));
|
menuBrushHeight->AppendCheckItem(miBrushHeight + i + 1, ToUnicode((i>4?"&":"") +intToStr(i - heightCount / 2)));
|
||||||
menuBrushSurface->AppendCheckItem(miBrushSurface + 3, wxT("&3 - Road"));
|
}
|
||||||
menuBrushSurface->AppendCheckItem(miBrushSurface + 4, wxT("&4 - Stone"));
|
menuBrushHeight->Check(miBrushHeight + (heightCount + 1) / 2, true);
|
||||||
menuBrushSurface->AppendCheckItem(miBrushSurface + 5, wxT("&5 - Ground"));
|
menuBar->Append(menuBrushHeight, wxT("&Height"));
|
||||||
menuBrush->Append(miBrushSurface, wxT("&Surface"), menuBrushSurface);
|
|
||||||
|
|
||||||
//objects
|
enabledGroup = ctHeight;
|
||||||
menuBrushObject = new wxMenu();
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject + 1, wxT("&0 - None (erase)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+2, wxT("&1 - Tree (unwalkable/harvestable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+3, wxT("&2 - DeadTree/Cactuses/Thornbush (unwalkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+4, wxT("&3 - Stone (unwalkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+5, wxT("&4 - Bush/Grass/Fern (walkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+6, wxT("&5 - Water Object/Reed/Papyrus (walkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+7, wxT("&6 - C1 BigTree/DeadTree/OldPalm (unwalkable/not harvestable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+8, wxT("&7 - C2 Hanged/Impaled (unwalkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+9, wxT("&8 - C3 Statues (unwalkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+10, wxT("&9 - C4 Big Rock (Mountain) (unwalkable)"));
|
|
||||||
menuBrushObject->AppendCheckItem(miBrushObject+11, wxT("10 &- C5 Invisible Blocking Object (unwalkable)"));
|
|
||||||
menuBrush->Append(miBrushObject, wxT("&Object"), menuBrushObject);
|
|
||||||
|
|
||||||
//resources
|
|
||||||
menuBrushResource = new wxMenu();
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource + 1, wxT("&0 - None"));
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource+2, wxT("&1 - gold (unwalkable)"));
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource+3, wxT("&2 - stone (unwalkable)"));
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource+4, wxT("&3 - custom"));
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource+5, wxT("&4 - custom"));
|
|
||||||
menuBrushResource->AppendCheckItem(miBrushResource+6, wxT("&5 - custom"));
|
|
||||||
menuBrush->Append(miBrushResource, wxT("&Resource"), menuBrushResource);
|
|
||||||
|
|
||||||
//players
|
|
||||||
menuBrushStartLocation = new wxMenu();
|
|
||||||
wxMenuItem *pmi1 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 1, wxT("&1 - Player 1"));
|
|
||||||
pmi1->SetBitmap(wxBitmap(brush_players_red));
|
|
||||||
menuBrushStartLocation->Append(pmi1);
|
|
||||||
wxMenuItem *pmi2 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 2, wxT("&2 - Player 2"));
|
|
||||||
pmi2->SetBitmap(wxBitmap(brush_players_blue));
|
|
||||||
menuBrushStartLocation->Append(pmi2);
|
|
||||||
wxMenuItem *pmi3 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 3, wxT("&3 - Player 3"));
|
|
||||||
pmi3->SetBitmap(wxBitmap(brush_players_green));
|
|
||||||
menuBrushStartLocation->Append(pmi3);
|
|
||||||
wxMenuItem *pmi4 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 4, wxT("&4 - Player 4"));
|
|
||||||
pmi4->SetBitmap(wxBitmap(brush_players_yellow));
|
|
||||||
menuBrushStartLocation->Append(pmi4);
|
|
||||||
wxMenuItem *pmi5 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 5, wxT("&5 - Player 5"));
|
|
||||||
pmi5->SetBitmap(wxBitmap(brush_players_white));
|
|
||||||
menuBrushStartLocation->Append(pmi5);
|
|
||||||
wxMenuItem *pmi6 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 6, wxT("&6 - Player 6"));
|
|
||||||
pmi6->SetBitmap(wxBitmap(brush_players_cyan));
|
|
||||||
menuBrushStartLocation->Append(pmi6);
|
|
||||||
wxMenuItem *pmi7 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 7, wxT("&7 - Player 7"));
|
|
||||||
pmi7->SetBitmap(wxBitmap(brush_players_orange));
|
|
||||||
menuBrushStartLocation->Append(pmi7);
|
|
||||||
wxMenuItem *pmi8 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 8, wxT("&8 - Player 8"));
|
|
||||||
pmi8->SetBitmap(wxBitmap(brush_players_pink));
|
|
||||||
menuBrushStartLocation->Append(pmi8);
|
|
||||||
menuBrush->Append(miBrushStartLocation, wxT("&Player"), menuBrushStartLocation);
|
|
||||||
menuBar->Append(menuBrush, wxT("&Brush"));
|
|
||||||
|
|
||||||
//radius
|
//radius
|
||||||
menuRadius = new wxMenu();
|
menuRadius = new wxMenu();
|
||||||
for (int i = 1; i <= radiusCount; ++i) {
|
for (int i = 1; i <= radiusCount; ++i) {
|
||||||
menuRadius->AppendCheckItem(miRadius + i, ToUnicode("&" + intToStr(i) + "\tALT+" + intToStr(i)));
|
menuRadius->AppendCheckItem(miRadius + i, ToUnicode("&" + intToStr(i) + " (diameter "+intToStr(i*2-1)+ ")"+ "\tALT+" + intToStr(i)));
|
||||||
}
|
}
|
||||||
menuRadius->Check(miRadius + 1, true);
|
menuRadius->Check(miRadius + 1, true);
|
||||||
menuBar->Append(menuRadius, wxT("&Radius"));
|
menuBar->Append(menuRadius, wxT("R&adius"));
|
||||||
|
|
||||||
|
//players
|
||||||
|
menuBrushStartLocation = new wxMenu();
|
||||||
|
wxMenuItem *pmi1 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 1, wxT("Player &1 Red"));
|
||||||
|
pmi1->SetBitmap(wxBitmap(brush_players_red));
|
||||||
|
menuBrushStartLocation->Append(pmi1);
|
||||||
|
wxMenuItem *pmi2 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 2, wxT("Player &2 Blue"));
|
||||||
|
pmi2->SetBitmap(wxBitmap(brush_players_blue));
|
||||||
|
menuBrushStartLocation->Append(pmi2);
|
||||||
|
wxMenuItem *pmi3 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 3, wxT("Player &3 Green"));
|
||||||
|
pmi3->SetBitmap(wxBitmap(brush_players_green));
|
||||||
|
menuBrushStartLocation->Append(pmi3);
|
||||||
|
wxMenuItem *pmi4 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 4, wxT("Player &4 Yellow"));
|
||||||
|
pmi4->SetBitmap(wxBitmap(brush_players_yellow));
|
||||||
|
menuBrushStartLocation->Append(pmi4);
|
||||||
|
wxMenuItem *pmi5 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 5, wxT("Player &5 White"));
|
||||||
|
pmi5->SetBitmap(wxBitmap(brush_players_white));
|
||||||
|
menuBrushStartLocation->Append(pmi5);
|
||||||
|
wxMenuItem *pmi6 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 6, wxT("Player &6 Cyan"));
|
||||||
|
pmi6->SetBitmap(wxBitmap(brush_players_cyan));
|
||||||
|
menuBrushStartLocation->Append(pmi6);
|
||||||
|
wxMenuItem *pmi7 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 7, wxT("Player &7 Orange"));
|
||||||
|
pmi7->SetBitmap(wxBitmap(brush_players_orange));
|
||||||
|
menuBrushStartLocation->Append(pmi7);
|
||||||
|
wxMenuItem *pmi8 = new wxMenuItem(menuBrushStartLocation, miBrushStartLocation + 8, wxT("Player &8 Pink")); // = Light Magenta :-)
|
||||||
|
pmi8->SetBitmap(wxBitmap(brush_players_pink));
|
||||||
|
menuBrushStartLocation->Append(pmi8);
|
||||||
|
menuBar->Append(menuBrushStartLocation, wxT("&Player"));
|
||||||
|
//menuBar->Append(menuBrush, wxT("&Brush"));
|
||||||
|
|
||||||
|
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
|
@ -217,34 +238,34 @@ MainWindow::MainWindow()
|
||||||
toolbar->AddTool(miEditUndo, _("undo"), wxBitmap(edit_undo), _("Undo"));
|
toolbar->AddTool(miEditUndo, _("undo"), wxBitmap(edit_undo), _("Undo"));
|
||||||
toolbar->AddTool(miEditRedo, _("redo"), wxBitmap(edit_redo), _("Redo"));
|
toolbar->AddTool(miEditRedo, _("redo"), wxBitmap(edit_redo), _("Redo"));
|
||||||
toolbar->AddTool(miEditRandomizeHeights, _("randomizeHeights"), wxBitmap(edit_randomize_heights), _("Randomize Heights"));
|
toolbar->AddTool(miEditRandomizeHeights, _("randomizeHeights"), wxBitmap(edit_randomize_heights), _("Randomize Heights"));
|
||||||
toolbar->AddTool(miEditRandomize, _("randomize"), wxBitmap(edit_randomize), _("Randomize"));
|
// toolbar->AddTool(miEditRandomize, _("randomize"), wxBitmap(edit_randomize), _("Randomize"));
|
||||||
toolbar->AddTool(miEditSwitchSurfaces, _("switch"), wxBitmap(edit_switch_surfaces), _("Switch Surfaces"));
|
toolbar->AddTool(miEditSwitchSurfaces, _("switch"), wxBitmap(edit_switch_surfaces), _("Switch Surfaces"));
|
||||||
toolbar->AddSeparator();
|
toolbar->AddSeparator();
|
||||||
toolbar->AddTool(miBrushSurface + 1, _("brush_grass1"), wxBitmap(brush_surface_grass1), _("Grass"));
|
toolbar->AddTool(miBrushSurface + 1, _("brush_grass1"), wxBitmap(brush_surface_grass1), _("Grass"));
|
||||||
toolbar->AddTool(miBrushSurface + 2, _("brush_grass2"), wxBitmap(brush_surface_grass2), _("Secondary Grass"));
|
toolbar->AddTool(miBrushSurface + 2, _("brush_grass2"), wxBitmap(brush_surface_grass2), _("Secondary grass"));
|
||||||
toolbar->AddTool(miBrushSurface + 3, _("brush_road"), wxBitmap(brush_surface_road), _("Road"));
|
toolbar->AddTool(miBrushSurface + 3, _("brush_road"), wxBitmap(brush_surface_road), _("Road"));
|
||||||
toolbar->AddTool(miBrushSurface + 4, _("brush_stone"), wxBitmap(brush_surface_stone), _("Stone"));
|
toolbar->AddTool(miBrushSurface + 4, _("brush_stone"), wxBitmap(brush_surface_stone), _("Stone"));
|
||||||
toolbar->AddTool(miBrushSurface + 5, _("brush_custom"), wxBitmap(brush_surface_custom), _("Ground"));
|
toolbar->AddTool(miBrushSurface + 5, _("brush_custom"), wxBitmap(brush_surface_custom), _("Ground"));
|
||||||
toolbar->AddSeparator();
|
toolbar->AddSeparator();
|
||||||
toolbar->AddTool(miBrushResource + 2, _("resource1"), wxBitmap(brush_resource_1_gold), _("gold (unwalkable)"));
|
toolbar->AddTool(miBrushResource + 2, _("resource1"), wxBitmap(brush_resource_1_gold), _("gold (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushResource + 3, _("resource2"), wxBitmap(brush_resource_2_stone), _("stone (unwalkable)"));
|
toolbar->AddTool(miBrushResource + 3, _("resource2"), wxBitmap(brush_resource_2_stone), _("stone (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushResource + 4, _("resource3"), wxBitmap(brush_resource_3), _("custom"));
|
toolbar->AddTool(miBrushResource + 4, _("resource3"), wxBitmap(brush_resource_3), _("custom3"));
|
||||||
toolbar->AddTool(miBrushResource + 5, _("resource4"), wxBitmap(brush_resource_4), _("custom"));
|
toolbar->AddTool(miBrushResource + 5, _("resource4"), wxBitmap(brush_resource_4), _("custom4"));
|
||||||
toolbar->AddTool(miBrushResource + 6, _("resource5"), wxBitmap(brush_resource_5), _("custom"));
|
toolbar->AddTool(miBrushResource + 6, _("resource5"), wxBitmap(brush_resource_5), _("custom5"));
|
||||||
toolbar->AddSeparator();
|
toolbar->AddSeparator();
|
||||||
toolbar->AddTool(miBrushObject + 1, _("brush_none"), wxBitmap(brush_none), _("None (erase)"));
|
toolbar->AddTool(miBrushObject + 1, _("brush_none"), wxBitmap(brush_none), _("None (erase)"));
|
||||||
toolbar->AddTool(miBrushObject + 2, _("brush_tree"), wxBitmap(brush_object_tree), _("Tree (unwalkable/harvestable)"));
|
toolbar->AddTool(miBrushObject + 2, _("brush_tree"), wxBitmap(brush_object_tree), _("Tree (unwalkable/harvestable)"));
|
||||||
toolbar->AddTool(miBrushObject + 3, _("brush_dead_tree"), wxBitmap(brush_object_dead_tree), _("DeadTree/Cactuses/Thornbush (unwalkable)"));
|
toolbar->AddTool(miBrushObject + 3, _("brush_dead_tree"), wxBitmap(brush_object_dead_tree), _("Dead tree/Cactuses/Thornbush (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushObject + 4, _("brush_stone"), wxBitmap(brush_object_stone), _("Stone (unwalkable)"));
|
toolbar->AddTool(miBrushObject + 4, _("brush_stone"), wxBitmap(brush_object_stone), _("Stone (unwalkable/not harvestable)"));
|
||||||
toolbar->AddTool(miBrushObject + 5, _("brush_bush"), wxBitmap(brush_object_bush), _("Bush/Grass/Fern (walkable)"));
|
toolbar->AddTool(miBrushObject + 5, _("brush_bush"), wxBitmap(brush_object_bush), _("Bush/Grass/Fern (walkable)"));
|
||||||
toolbar->AddTool(miBrushObject + 6, _("brush_water"), wxBitmap(brush_object_water_object), _("Water Object/Reed/Papyrus (walkable)"));
|
toolbar->AddTool(miBrushObject + 6, _("brush_water"), wxBitmap(brush_object_water_object), _("Water object/Reed/Papyrus (walkable)"));
|
||||||
toolbar->AddTool(miBrushObject + 7, _("brush_c1_bigtree"), wxBitmap(brush_object_c1_bigtree), _("C1 BigTree/DeadTree/OldPalm (unwalkable/not harvestable)"));
|
toolbar->AddTool(miBrushObject + 7, _("brush_c1_bigtree"), wxBitmap(brush_object_c1_bigtree), _("Big tree/Old palm (unwalkable/not harvestable)"));
|
||||||
toolbar->AddTool(miBrushObject + 8, _("brush_c2_hanged"), wxBitmap(brush_object_c2_hanged), _("C2 Hanged/Impaled (unwalkable)"));
|
toolbar->AddTool(miBrushObject + 8, _("brush_c2_hanged"), wxBitmap(brush_object_c2_hanged), _("Hanged/Impaled (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushObject + 9, _("brush_c3_statue"), wxBitmap(brush_object_c3_statue), _("C3, Statues (unwalkable))"));
|
toolbar->AddTool(miBrushObject + 9, _("brush_c3_statue"), wxBitmap(brush_object_c3_statue), _("Statues (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushObject +10, _("brush_c4_bigrock"), wxBitmap(brush_object_c4_bigrock), _("Big Rock (Mountain) (unwalkable)"));
|
toolbar->AddTool(miBrushObject +10, _("brush_c4_bigrock"), wxBitmap(brush_object_c4_bigrock), _("Mountain (unwalkable)"));
|
||||||
toolbar->AddTool(miBrushObject +11, _("brush_c5_blocking"), wxBitmap(brush_object_c5_blocking), _("Invisible Blocking Object (unwalkable)"));
|
toolbar->AddTool(miBrushObject +11, _("brush_c5_blocking"), wxBitmap(brush_object_c5_blocking), _("Invisible blocking object (unwalkable)"));
|
||||||
toolbar->AddSeparator();
|
toolbar->AddSeparator();
|
||||||
toolbar->AddTool(toolPlayer, _("brush_player"), wxBitmap(brush_players_player));
|
toolbar->AddTool(toolPlayer, _("brush_player"), wxBitmap(brush_players_player), _("Player start position"));
|
||||||
toolbar->Realize();
|
toolbar->Realize();
|
||||||
|
|
||||||
wxToolBar *toolbar2 = new wxToolBar(this->panel, wxID_ANY);
|
wxToolBar *toolbar2 = new wxToolBar(this->panel, wxID_ANY);
|
||||||
|
@ -282,12 +303,12 @@ MainWindow::MainWindow()
|
||||||
toolbar2->AddTool(miRadius + 8, _("radius8"), wxBitmap(radius_8));
|
toolbar2->AddTool(miRadius + 8, _("radius8"), wxBitmap(radius_8));
|
||||||
toolbar2->AddTool(miRadius + 9, _("radius9"), wxBitmap(radius_9));
|
toolbar2->AddTool(miRadius + 9, _("radius9"), wxBitmap(radius_9));
|
||||||
toolbar2->Realize();
|
toolbar2->Realize();
|
||||||
|
|
||||||
wxBoxSizer *boxsizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *boxsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
boxsizer->Add(toolbar, 0, wxEXPAND);
|
boxsizer->Add(toolbar, 0, wxEXPAND);
|
||||||
boxsizer->Add(toolbar2, 0, wxEXPAND);
|
boxsizer->Add(toolbar2, 0, wxEXPAND);
|
||||||
boxsizer->Add(glCanvas, 1, wxEXPAND);
|
boxsizer->Add(glCanvas, 1, wxEXPAND);
|
||||||
|
|
||||||
this->panel->SetSizer(boxsizer);
|
this->panel->SetSizer(boxsizer);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
||||||
|
@ -328,7 +349,7 @@ void MainWindow::init(string fname) {
|
||||||
currentFile = fname;
|
currentFile = fname;
|
||||||
fileName = cutLastExt(extractFileFromDirectoryPath(fname.c_str()));
|
fileName = cutLastExt(extractFileFromDirectoryPath(fname.c_str()));
|
||||||
}
|
}
|
||||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
SetTitle(ToUnicode(currentFile + " - " + winHeader));
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
setExtension();
|
setExtension();
|
||||||
}
|
}
|
||||||
|
@ -390,6 +411,19 @@ void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) {
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the mousewheel
|
||||||
|
void MainWindow::onMouseWheelDown(wxMouseEvent &event) {
|
||||||
|
wxPaintEvent ev;
|
||||||
|
program->incCellSize(1);
|
||||||
|
onPaint(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMouseWheelUp(wxMouseEvent &event) {
|
||||||
|
wxPaintEvent ev;
|
||||||
|
program->incCellSize(-1);
|
||||||
|
onPaint(ev);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) {
|
void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) {
|
||||||
bool repaint = false;
|
bool repaint = false;
|
||||||
int dif;
|
int dif;
|
||||||
|
@ -415,7 +449,7 @@ void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) {
|
||||||
int currObject = program->getObject(x, y);
|
int currObject = program->getObject(x, y);
|
||||||
SetStatusText(wxT("Object: ") + ToUnicode(object_descs[currObject]), siCURR_OBJECT);
|
SetStatusText(wxT("Object: ") + ToUnicode(object_descs[currObject]), siCURR_OBJECT);
|
||||||
resourceUnderMouse = 0;
|
resourceUnderMouse = 0;
|
||||||
objectUnderMouse = currObject;
|
objectUnderMouse = currObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastX = x;
|
lastX = x;
|
||||||
|
@ -433,6 +467,11 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxPaintDC dc(this); // "In a paint event handler must always create a wxPaintDC object even if you do not use it. (?)
|
||||||
|
// Otherwise, under MS Windows, refreshing for this and other windows will go wrong"
|
||||||
|
// http://docs.wxwidgets.org/2.6/wx_wxpaintevent.html
|
||||||
|
|
||||||
lastPaintEvent.start();
|
lastPaintEvent.start();
|
||||||
|
|
||||||
if(panel) panel->Update();
|
if(panel) panel->Update();
|
||||||
|
@ -445,7 +484,7 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
||||||
wxFileDialog fileDialog(this);
|
wxFileDialog fileDialog(this);
|
||||||
fileDialog.SetWildcard(wxT("Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm"));
|
fileDialog.SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm)|*.gbm;*.mgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm"));
|
||||||
if (fileDialog.ShowModal() == wxID_OK) {
|
if (fileDialog.ShowModal() == wxID_OK) {
|
||||||
currentFile = fileDialog.GetPath().ToAscii();
|
currentFile = fileDialog.GetPath().ToAscii();
|
||||||
program->loadMap(currentFile);
|
program->loadMap(currentFile);
|
||||||
|
@ -485,7 +524,7 @@ void MainWindow::onMenuFileExit(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditUndo(wxCommandEvent &event) {
|
void MainWindow::onMenuEditUndo(wxCommandEvent &event) {
|
||||||
std::cout << "Undo Pressed" << std::endl;
|
// std::cout << "Undo Pressed" << std::endl;
|
||||||
if (program->undo()) {
|
if (program->undo()) {
|
||||||
wxPaintEvent e;
|
wxPaintEvent e;
|
||||||
onPaint(e);
|
onPaint(e);
|
||||||
|
@ -494,7 +533,7 @@ void MainWindow::onMenuEditUndo(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditRedo(wxCommandEvent &event) {
|
void MainWindow::onMenuEditRedo(wxCommandEvent &event) {
|
||||||
std::cout << "Redo Pressed" << std::endl;
|
// std::cout << "Redo Pressed" << std::endl;
|
||||||
if (program->redo()) {
|
if (program->redo()) {
|
||||||
wxPaintEvent e;
|
wxPaintEvent e;
|
||||||
onPaint(e);
|
onPaint(e);
|
||||||
|
@ -505,11 +544,12 @@ void MainWindow::onMenuEditRedo(wxCommandEvent &event) {
|
||||||
void MainWindow::onMenuEditReset(wxCommandEvent &event) {
|
void MainWindow::onMenuEditReset(wxCommandEvent &event) {
|
||||||
program->setUndoPoint(ctAll);
|
program->setUndoPoint(ctAll);
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Altitude", "10");
|
simpleDialog.addValue("Width", "128","(must be 16,32,64,128,256,512...)"); // must be an exponent of two
|
||||||
simpleDialog.addValue("Surface", "1");
|
simpleDialog.addValue("Height", "128","(must be 16,32,64,128,256,512...)");
|
||||||
simpleDialog.addValue("Width", "128");
|
simpleDialog.addValue("Surface", "1","(Default surface material)");
|
||||||
simpleDialog.addValue("Height", "128");
|
simpleDialog.addValue("Altitude", "10","(Default surface height)");
|
||||||
simpleDialog.show();
|
simpleDialog.addValue("Number of players", "8");
|
||||||
|
if (!simpleDialog.show()) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
program->reset(
|
program->reset(
|
||||||
|
@ -517,7 +557,8 @@ void MainWindow::onMenuEditReset(wxCommandEvent &event) {
|
||||||
strToInt(simpleDialog.getValue("Height")),
|
strToInt(simpleDialog.getValue("Height")),
|
||||||
strToInt(simpleDialog.getValue("Altitude")),
|
strToInt(simpleDialog.getValue("Altitude")),
|
||||||
strToInt(simpleDialog.getValue("Surface")));
|
strToInt(simpleDialog.getValue("Surface")));
|
||||||
}
|
program->resetFactions(strToInt(simpleDialog.getValue("Number of players")));
|
||||||
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -527,12 +568,12 @@ void MainWindow::onMenuEditReset(wxCommandEvent &event) {
|
||||||
|
|
||||||
void MainWindow::onMenuEditResetPlayers(wxCommandEvent &event) {
|
void MainWindow::onMenuEditResetPlayers(wxCommandEvent &event) {
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Factions", intToStr(program->getMap()->getMaxFactions()));
|
simpleDialog.addValue("Number of players", intToStr(program->getMap()->getMaxFactions()));
|
||||||
simpleDialog.show();
|
if (!simpleDialog.show("Reset players")) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
program->resetFactions(strToInt(simpleDialog.getValue("Factions")));
|
program->resetFactions(strToInt(simpleDialog.getValue("Number of players")));
|
||||||
}
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -542,19 +583,19 @@ void MainWindow::onMenuEditResetPlayers(wxCommandEvent &event) {
|
||||||
|
|
||||||
void MainWindow::onMenuEditResize(wxCommandEvent &event) {
|
void MainWindow::onMenuEditResize(wxCommandEvent &event) {
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Altitude", "10");
|
simpleDialog.addValue("Width", intToStr(program->getMap()->getW()),"(must be 16,32,64,128,256,512...)");
|
||||||
simpleDialog.addValue("Surface", "1");
|
simpleDialog.addValue("Height", intToStr(program->getMap()->getH()),"(must be 16,32,64,128,256,512...)");
|
||||||
simpleDialog.addValue("Height", "128");
|
simpleDialog.addValue("Surface", "1","(surface material for new area around map)");
|
||||||
simpleDialog.addValue("Width", "128");
|
simpleDialog.addValue("Altitude", "10","(surface height for new area around map)");
|
||||||
simpleDialog.show();
|
if (!simpleDialog.show("Resze - expand around, shrink to topleft")) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
program->resize(
|
program->resize(
|
||||||
strToInt(simpleDialog.getValue("Height")),
|
|
||||||
strToInt(simpleDialog.getValue("Width")),
|
strToInt(simpleDialog.getValue("Width")),
|
||||||
|
strToInt(simpleDialog.getValue("Height")),
|
||||||
strToInt(simpleDialog.getValue("Altitude")),
|
strToInt(simpleDialog.getValue("Altitude")),
|
||||||
strToInt(simpleDialog.getValue("Surface")));
|
strToInt(simpleDialog.getValue("Surface")));
|
||||||
}
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -562,36 +603,84 @@ void MainWindow::onMenuEditResize(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditFlipX(wxCommandEvent &event) {
|
void MainWindow::onMenuEditFlipX(wxCommandEvent &event) {
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
program->flipX();
|
program->flipX();
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditFlipY(wxCommandEvent &event) {
|
void MainWindow::onMenuEditFlipY(wxCommandEvent &event) {
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
program->flipY();
|
program->flipY();
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditMirrorX(wxCommandEvent &event) { // copy left to right
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->mirrorX();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditMirrorY(wxCommandEvent &event) { // copy top to bottom
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->mirrorY();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditMirrorXY(wxCommandEvent &event) { // copy bottomleft tp topright
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->mirrorXY();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditRotatecopyX(wxCommandEvent &event) { // copy left to right, rotated
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->rotatecopyX();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditRotatecopyY(wxCommandEvent &event) { // copy top to bottom, rotated
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->rotatecopyY();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditRotatecopyXY(wxCommandEvent &event) { // copy bottomleft to topright, rotated
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->rotatecopyXY();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenuEditRotatecopyCorner(wxCommandEvent &event) { // copy top left 1/4 to top right 1/4, rotated
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
|
program->rotatecopyCorner();
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::onMenuEditRandomizeHeights(wxCommandEvent &event) {
|
void MainWindow::onMenuEditRandomizeHeights(wxCommandEvent &event) {
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
program->randomizeMapHeights();
|
program->randomizeMapHeights();
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditRandomize(wxCommandEvent &event) {
|
void MainWindow::onMenuEditRandomize(wxCommandEvent &event) {
|
||||||
|
program->setUndoPoint(ctAll);
|
||||||
program->randomizeMap();
|
program->randomizeMap();
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditSwitchSurfaces(wxCommandEvent &event) {
|
void MainWindow::onMenuEditSwitchSurfaces(wxCommandEvent &event) {
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Surface1", "1");
|
simpleDialog.addValue("Surface1", "1","replace this surface with...");
|
||||||
simpleDialog.addValue("Surface2", "2");
|
simpleDialog.addValue("Surface2", "2","...this and vice versa");
|
||||||
simpleDialog.show();
|
if (!simpleDialog.show("Switch surfaces")) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
program->setUndoPoint(ctSurface);
|
||||||
program->switchMapSurfaces(
|
program->switchMapSurfaces(
|
||||||
strToInt(simpleDialog.getValue("Surface1")),
|
strToInt(simpleDialog.getValue("Surface1")),
|
||||||
strToInt(simpleDialog.getValue("Surface2")));
|
strToInt(simpleDialog.getValue("Surface2")));
|
||||||
}
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -601,54 +690,59 @@ void MainWindow::onMenuEditSwitchSurfaces(wxCommandEvent &event) {
|
||||||
void MainWindow::onMenuEditInfo(wxCommandEvent &event) {
|
void MainWindow::onMenuEditInfo(wxCommandEvent &event) {
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Title", program->getMap()->getTitle());
|
simpleDialog.addValue("Title", program->getMap()->getTitle());
|
||||||
simpleDialog.addValue("Desc", program->getMap()->getDesc());
|
simpleDialog.addValue("Description", program->getMap()->getDesc());
|
||||||
simpleDialog.addValue("Author", program->getMap()->getAuthor());
|
simpleDialog.addValue("Author", program->getMap()->getAuthor());
|
||||||
|
if (!simpleDialog.show("Info",true)) return;
|
||||||
|
|
||||||
simpleDialog.show();
|
bool ischanged = false;
|
||||||
|
ischanged = program->setMapTitle(simpleDialog.getValue("Title"));
|
||||||
if (program->setMapTitle(simpleDialog.getValue("Title"))
|
ischanged = (program->setMapDesc(simpleDialog.getValue("Description")) || ischanged);
|
||||||
|| program->setMapDesc(simpleDialog.getValue("Desc"))
|
ischanged = (program->setMapAuthor(simpleDialog.getValue("Author")) || ischanged);
|
||||||
|| program->setMapAuthor(simpleDialog.getValue("Author"))) {
|
if (ischanged)
|
||||||
if (!isDirty()) {
|
if (!isDirty()) {
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuEditAdvanced(wxCommandEvent &event) {
|
void MainWindow::onMenuEditAdvanced(wxCommandEvent &event) {
|
||||||
SimpleDialog simpleDialog;
|
SimpleDialog simpleDialog;
|
||||||
simpleDialog.addValue("Height Factor", intToStr(program->getMap()->getHeightFactor()));
|
simpleDialog.addValue("Height Factor", intToStr(program->getMap()->getHeightFactor()),"(lower means map is more more zoomed in)");
|
||||||
simpleDialog.addValue("Water Level", intToStr(program->getMap()->getWaterLevel()));
|
simpleDialog.addValue("Water Level", intToStr(program->getMap()->getWaterLevel()),"(which level water is visible but still walkable)");
|
||||||
|
if (!simpleDialog.show("Advanced")) return;
|
||||||
simpleDialog.show();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
program->setMapAdvanced(
|
program->setMapAdvanced(
|
||||||
strToInt(simpleDialog.getValue("Height Factor")),
|
strToInt(simpleDialog.getValue("Height Factor")),
|
||||||
strToInt(simpleDialog.getValue("Water Level")));
|
strToInt(simpleDialog.getValue("Water Level")));
|
||||||
}
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuMiscResetZoomAndPos(wxCommandEvent &event) {
|
void MainWindow::onMenuViewResetZoomAndPos(wxCommandEvent &event) {
|
||||||
program->resetOfset();
|
program->resetOfset();
|
||||||
|
wxPaintEvent e;
|
||||||
|
onPaint(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuMiscAbout(wxCommandEvent &event) {
|
void MainWindow::onMenuViewAbout(wxCommandEvent &event) {
|
||||||
MsgDialog(
|
MsgDialog(
|
||||||
this,
|
this,
|
||||||
wxT("Glest Map Editor - Copyright 2004 The Glest Team\n(with improvements by others, 2010)."),
|
wxT("Glest Map Editor - Copyright 2004 The Glest Team\n(with improvements by others, 2010)."),
|
||||||
wxT("About")).ShowModal();
|
wxT("About")).ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuMiscHelp(wxCommandEvent &event) {
|
void MainWindow::onMenuViewHelp(wxCommandEvent &event) {
|
||||||
MsgDialog(
|
MsgDialog(this,
|
||||||
this,
|
wxT("Draw with left mouse\nMove viewport with right mouse drag\nZoom with center mouse drag, or mousewheel\n\
|
||||||
wxT("Left mouse click: draw\nRight mouse drag: move\nCenter mouse drag: zoom"),
|
You can change brush in the same category with key 1-9\n\
|
||||||
|
A good idea is to put some stone, gold and tree near starting position\n\
|
||||||
|
Starting position needs an open area for the tower and at starting units\n"),
|
||||||
wxT("Help")).ShowModal();
|
wxT("Help")).ShowModal();
|
||||||
|
/* 5 away and 10x10 empty area? */
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMenuBrushHeight(wxCommandEvent &e) {
|
void MainWindow::onMenuBrushHeight(wxCommandEvent &e) {
|
||||||
|
@ -837,7 +931,7 @@ void MainWindow::uncheckRadius() {
|
||||||
if (e.GetKeyCode() == 'H') {
|
if (e.GetKeyCode() == 'H') {
|
||||||
wxCommandEvent evt(wxEVT_NULL, miBrushHeight + height + heightCount / 2 + 1);
|
wxCommandEvent evt(wxEVT_NULL, miBrushHeight + height + heightCount / 2 + 1);
|
||||||
onMenuBrushHeight(evt);
|
onMenuBrushHeight(evt);
|
||||||
} else if (e.GetKeyCode() == ' ') {
|
} else if (e.GetKeyCode() == ' ') {
|
||||||
if (resourceUnderMouse != 0) {
|
if (resourceUnderMouse != 0) {
|
||||||
wxCommandEvent evt(wxEVT_NULL, miBrushResource + resourceUnderMouse + 1);
|
wxCommandEvent evt(wxEVT_NULL, miBrushResource + resourceUnderMouse + 1);
|
||||||
onMenuBrushResource(evt);
|
onMenuBrushResource(evt);
|
||||||
|
@ -869,11 +963,12 @@ BEGIN_EVENT_TABLE(MainWindow, wxFrame)
|
||||||
|
|
||||||
EVT_CLOSE(MainWindow::onClose)
|
EVT_CLOSE(MainWindow::onClose)
|
||||||
|
|
||||||
// these are 'handled' by GlCanvas and funneled to these handlers
|
// these are 'handled' by GlCanvas and funneled to these handlers. See BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas) below.
|
||||||
//EVT_LEFT_DOWN(MainWindow::onMouseDown)
|
//EVT_LEFT_DOWN(MainWindow::onMouseDown)
|
||||||
//EVT_MOTION(MainWindow::onMouseMove)
|
//EVT_MOTION(MainWindow::onMouseMove)
|
||||||
//EVT_KEY_DOWN(MainWindow::onKeyDown)
|
//EVT_KEY_DOWN(MainWindow::onKeyDown)
|
||||||
|
|
||||||
|
EVT_MENU(wxID_NEW, MainWindow::onMenuEditReset)
|
||||||
EVT_MENU(wxID_OPEN, MainWindow::onMenuFileLoad)
|
EVT_MENU(wxID_OPEN, MainWindow::onMenuFileLoad)
|
||||||
EVT_MENU(wxID_SAVE, MainWindow::onMenuFileSave)
|
EVT_MENU(wxID_SAVE, MainWindow::onMenuFileSave)
|
||||||
EVT_MENU(wxID_SAVEAS, MainWindow::onMenuFileSaveAs)
|
EVT_MENU(wxID_SAVEAS, MainWindow::onMenuFileSaveAs)
|
||||||
|
@ -881,20 +976,28 @@ BEGIN_EVENT_TABLE(MainWindow, wxFrame)
|
||||||
|
|
||||||
EVT_MENU(miEditUndo, MainWindow::onMenuEditUndo)
|
EVT_MENU(miEditUndo, MainWindow::onMenuEditUndo)
|
||||||
EVT_MENU(miEditRedo, MainWindow::onMenuEditRedo)
|
EVT_MENU(miEditRedo, MainWindow::onMenuEditRedo)
|
||||||
EVT_MENU(miEditReset, MainWindow::onMenuEditReset)
|
|
||||||
EVT_MENU(miEditResetPlayers, MainWindow::onMenuEditResetPlayers)
|
EVT_MENU(miEditResetPlayers, MainWindow::onMenuEditResetPlayers)
|
||||||
EVT_MENU(miEditResize, MainWindow::onMenuEditResize)
|
EVT_MENU(miEditResize, MainWindow::onMenuEditResize)
|
||||||
EVT_MENU(miEditFlipX, MainWindow::onMenuEditFlipX)
|
EVT_MENU(miEditFlipX, MainWindow::onMenuEditFlipX)
|
||||||
EVT_MENU(miEditFlipY, MainWindow::onMenuEditFlipY)
|
EVT_MENU(miEditFlipY, MainWindow::onMenuEditFlipY)
|
||||||
|
|
||||||
|
EVT_MENU(miEditMirrorX, MainWindow::onMenuEditMirrorX)
|
||||||
|
EVT_MENU(miEditMirrorY, MainWindow::onMenuEditMirrorY)
|
||||||
|
EVT_MENU(miEditMirrorXY, MainWindow::onMenuEditMirrorXY)
|
||||||
|
EVT_MENU(miEditRotatecopyX, MainWindow::onMenuEditRotatecopyX)
|
||||||
|
EVT_MENU(miEditRotatecopyY, MainWindow::onMenuEditRotatecopyY)
|
||||||
|
EVT_MENU(miEditRotatecopyXY, MainWindow::onMenuEditRotatecopyXY)
|
||||||
|
EVT_MENU(miEditRotatecopyCorner, MainWindow::onMenuEditRotatecopyCorner)
|
||||||
|
|
||||||
EVT_MENU(miEditRandomizeHeights, MainWindow::onMenuEditRandomizeHeights)
|
EVT_MENU(miEditRandomizeHeights, MainWindow::onMenuEditRandomizeHeights)
|
||||||
EVT_MENU(miEditRandomize, MainWindow::onMenuEditRandomize)
|
EVT_MENU(miEditRandomize, MainWindow::onMenuEditRandomize)
|
||||||
EVT_MENU(miEditSwitchSurfaces, MainWindow::onMenuEditSwitchSurfaces)
|
EVT_MENU(miEditSwitchSurfaces, MainWindow::onMenuEditSwitchSurfaces)
|
||||||
EVT_MENU(miEditInfo, MainWindow::onMenuEditInfo)
|
EVT_MENU(miEditInfo, MainWindow::onMenuEditInfo)
|
||||||
EVT_MENU(miEditAdvanced, MainWindow::onMenuEditAdvanced)
|
EVT_MENU(miEditAdvanced, MainWindow::onMenuEditAdvanced)
|
||||||
|
|
||||||
EVT_MENU(miMiscResetZoomAndPos, MainWindow::onMenuMiscResetZoomAndPos)
|
EVT_MENU(miViewResetZoomAndPos, MainWindow::onMenuViewResetZoomAndPos)
|
||||||
EVT_MENU(miMiscAbout, MainWindow::onMenuMiscAbout)
|
EVT_MENU(miViewAbout, MainWindow::onMenuViewAbout)
|
||||||
EVT_MENU(miMiscHelp, MainWindow::onMenuMiscHelp)
|
EVT_MENU(miViewHelp, MainWindow::onMenuViewHelp)
|
||||||
|
|
||||||
EVT_MENU_RANGE(miBrushHeight + 1, miBrushHeight + heightCount, MainWindow::onMenuBrushHeight)
|
EVT_MENU_RANGE(miBrushHeight + 1, miBrushHeight + heightCount, MainWindow::onMenuBrushHeight)
|
||||||
EVT_MENU_RANGE(miBrushGradient + 1, miBrushGradient + heightCount, MainWindow::onMenuBrushGradient)
|
EVT_MENU_RANGE(miBrushGradient + 1, miBrushGradient + heightCount, MainWindow::onMenuBrushGradient)
|
||||||
|
@ -903,9 +1006,9 @@ BEGIN_EVENT_TABLE(MainWindow, wxFrame)
|
||||||
EVT_MENU_RANGE(miBrushResource + 1, miBrushResource + resourceCount, MainWindow::onMenuBrushResource)
|
EVT_MENU_RANGE(miBrushResource + 1, miBrushResource + resourceCount, MainWindow::onMenuBrushResource)
|
||||||
EVT_MENU_RANGE(miBrushStartLocation + 1, miBrushStartLocation + startLocationCount, MainWindow::onMenuBrushStartLocation)
|
EVT_MENU_RANGE(miBrushStartLocation + 1, miBrushStartLocation + startLocationCount, MainWindow::onMenuBrushStartLocation)
|
||||||
EVT_MENU_RANGE(miRadius, miRadius + radiusCount, MainWindow::onMenuRadius)
|
EVT_MENU_RANGE(miRadius, miRadius + radiusCount, MainWindow::onMenuRadius)
|
||||||
|
|
||||||
EVT_PAINT(MainWindow::onPaint)
|
EVT_PAINT(MainWindow::onPaint)
|
||||||
|
|
||||||
EVT_TOOL(toolPlayer, MainWindow::onToolPlayer)
|
EVT_TOOL(toolPlayer, MainWindow::onToolPlayer)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -929,6 +1032,12 @@ void translateCoords(wxWindow *wnd, int &x, int &y) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the mousewheel
|
||||||
|
void GlCanvas::onMouseWheel(wxMouseEvent &event) {
|
||||||
|
if(event.GetWheelRotation()>0) mainWindow->onMouseWheelDown(event);
|
||||||
|
else mainWindow->onMouseWheelUp(event);
|
||||||
|
}
|
||||||
|
|
||||||
void GlCanvas::onMouseDown(wxMouseEvent &event) {
|
void GlCanvas::onMouseDown(wxMouseEvent &event) {
|
||||||
int x, y;
|
int x, y;
|
||||||
event.GetPosition(&x, &y);
|
event.GetPosition(&x, &y);
|
||||||
|
@ -950,20 +1059,28 @@ void GlCanvas::onKeyDown(wxKeyEvent &event) {
|
||||||
mainWindow->onKeyDown(event);
|
mainWindow->onKeyDown(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlCanvas::onPaint(wxPaintEvent &event) {
|
||||||
|
// wxPaintDC dc(this); //N "In a paint event handler must always create a wxPaintDC object even if you do not use it. (?)
|
||||||
|
// mainWindow->program->renderMap(GetClientSize().x, GetClientSize().y);
|
||||||
|
// SwapBuffers();
|
||||||
|
// event.Skip();
|
||||||
|
mainWindow->onPaint(event);
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas)
|
BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas)
|
||||||
EVT_KEY_DOWN(GlCanvas::onKeyDown)
|
EVT_KEY_DOWN(GlCanvas::onKeyDown)
|
||||||
|
EVT_MOUSEWHEEL(GlCanvas::onMouseWheel)
|
||||||
EVT_LEFT_DOWN(GlCanvas::onMouseDown)
|
EVT_LEFT_DOWN(GlCanvas::onMouseDown)
|
||||||
EVT_MOTION(GlCanvas::onMouseMove)
|
EVT_MOTION(GlCanvas::onMouseMove)
|
||||||
|
EVT_PAINT(GlCanvas::onPaint) // Because the drawing area needs to be repainted too.
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// ===============================================
|
// ===============================================
|
||||||
// class SimpleDialog
|
// class SimpleDialog
|
||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
void SimpleDialog::addValue(const string &key, const string &value) {
|
void SimpleDialog::addValue(const string &key, const string &value, const string &help) {
|
||||||
values.push_back(pair<string, string>(key, value));
|
values.push_back(pair<string, string>(key, value+"|"+help)); // I guess I need map<,> instead but I don't know how to do it
|
||||||
}
|
}
|
||||||
|
|
||||||
string SimpleDialog::getValue(const string &key) {
|
string SimpleDialog::getValue(const string &key) {
|
||||||
|
@ -975,27 +1092,32 @@ string SimpleDialog::getValue(const string &key) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleDialog::show() {
|
bool SimpleDialog::show(const string &title, bool wide) {
|
||||||
|
Create(NULL, -1, ToUnicode(title));
|
||||||
Create(NULL, -1, wxT("Edit Values"));
|
wxSizer *sizer2 = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxSizer *sizer = new wxFlexGridSizer(3);
|
||||||
wxSizer *sizer = new wxFlexGridSizer(2);
|
|
||||||
|
|
||||||
vector<wxTextCtrl*> texts;
|
vector<wxTextCtrl*> texts;
|
||||||
|
|
||||||
for (Values::iterator it = values.begin(); it != values.end(); ++it) {
|
for (Values::iterator it = values.begin(); it != values.end(); ++it) {
|
||||||
|
int helptextpos = it->second.find_first_of('|');
|
||||||
sizer->Add(new wxStaticText(this, -1, ToUnicode(it->first)), 0, wxALL, 5);
|
sizer->Add(new wxStaticText(this, -1, ToUnicode(it->first)), 0, wxALL, 5);
|
||||||
wxTextCtrl *text = new wxTextCtrl(this, -1, ToUnicode(it->second));
|
wxTextCtrl *text = new wxTextCtrl(this, -1, ToUnicode(it->second.substr(0,helptextpos)));
|
||||||
|
if(wide) text->SetMinSize( wxSize((text->GetSize().GetWidth())*4, text->GetSize().GetHeight())); // 4 time as wide as default
|
||||||
sizer->Add(text, 0, wxALL, 5);
|
sizer->Add(text, 0, wxALL, 5);
|
||||||
texts.push_back(text);
|
texts.push_back(text);
|
||||||
|
sizer->Add(new wxStaticText(this, -1, ToUnicode(it->second.substr(helptextpos+1))), 0, wxALL, 5);
|
||||||
}
|
}
|
||||||
SetSizerAndFit(sizer);
|
sizer2->Add(sizer);
|
||||||
|
sizer2->Add(CreateButtonSizer(wxOK|wxCANCEL),0,wxALIGN_RIGHT); // enable Cancel button
|
||||||
|
SetSizerAndFit(sizer2);
|
||||||
|
|
||||||
ShowModal();
|
ShowModal();
|
||||||
|
if(m_returnCode==wxID_CANCEL) return false; // don't change values if canceled
|
||||||
|
|
||||||
for (unsigned int i = 0; i < texts.size(); ++i) {
|
for (unsigned int i = 0; i < texts.size(); ++i) {
|
||||||
values[i].second = texts[i]->GetValue().ToAscii();
|
values[i].second = texts[i]->GetValue().ToAscii();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1006,6 +1128,17 @@ void SimpleDialog::show() {
|
||||||
bool App::OnInit() {
|
bool App::OnInit() {
|
||||||
string fileparam;
|
string fileparam;
|
||||||
if(argc==2){
|
if(argc==2){
|
||||||
|
if(argv[1][0]=='-') { // any flag gives help and exits program.
|
||||||
|
std::cout << "Glest map editor " << mapeditorVersionString << std::endl << std::endl;
|
||||||
|
std::cout << "glest_map_editor [GBM OR MGM FILE]" << std::endl << std::endl;
|
||||||
|
std::cout << "Creates or edits glest/megaglest maps." << std::endl;
|
||||||
|
std::cout << "Draw with left mouse button (select what and how large area in menu or toolbar)" << std::endl;
|
||||||
|
std::cout << "Pan trough the map with right mouse button" << std::endl;
|
||||||
|
std::cout << "Zoom with middle mouse button or mousewheel" << std::endl;
|
||||||
|
// std::cout << " ~ more helps should be written here ~" << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
fileparam = wxFNCONV(argv[1]);
|
fileparam = wxFNCONV(argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1013,7 +1146,7 @@ bool App::OnInit() {
|
||||||
mainWindow->Show();
|
mainWindow->Show();
|
||||||
mainWindow->init(fileparam);
|
mainWindow->init(fileparam);
|
||||||
mainWindow->Update();
|
mainWindow->Update();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
wxPoint pos = mainWindow->GetScreenPosition();
|
wxPoint pos = mainWindow->GetScreenPosition();
|
||||||
wxSize size = mainWindow->GetSize();
|
wxSize size = mainWindow->GetSize();
|
||||||
|
@ -1028,7 +1161,7 @@ int App::MainLoop() {
|
||||||
try {
|
try {
|
||||||
//throw runtime_error("test");
|
//throw runtime_error("test");
|
||||||
return wxApp::MainLoop();
|
return wxApp::MainLoop();
|
||||||
}
|
}
|
||||||
catch (const exception &e) {
|
catch (const exception &e) {
|
||||||
MsgDialog(NULL, ToUnicode(e.what()), wxT("Exception")).ShowModal();
|
MsgDialog(NULL, ToUnicode(e.what()), wxT("Exception")).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -1044,11 +1177,11 @@ MsgDialog::MsgDialog(wxWindow *parent,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos) {
|
const wxPoint& pos) {
|
||||||
|
|
||||||
m_sizerText = NULL;
|
m_sizerText = NULL;
|
||||||
// TODO: should we use main frame as parent by default here?
|
// TODO: should we use main frame as parent by default here?
|
||||||
if ( !wxDialog::Create(parent, wxID_ANY, caption,
|
if ( !wxDialog::Create(parent, wxID_ANY, caption,
|
||||||
pos, wxDefaultSize,
|
pos, wxDefaultSize,
|
||||||
style) ) {
|
style) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,24 +54,24 @@ enum StatusItems {
|
||||||
const char *object_descs[] = {
|
const char *object_descs[] = {
|
||||||
"None (Erase)",
|
"None (Erase)",
|
||||||
"Tree",
|
"Tree",
|
||||||
"Dead Tree",
|
"Dead tree",
|
||||||
"Stone",
|
"Stone (non harvest)",
|
||||||
"Bush",
|
"Bush",
|
||||||
"Water Object",
|
"Water object",
|
||||||
"Big/Dead Tree",
|
"Big tree",
|
||||||
"Trophy Corpse",
|
"Hanged/Impaled",
|
||||||
"Statues",
|
"Statues",
|
||||||
"Big Rock",
|
"Mountain",
|
||||||
"Invisible Blocking"
|
"Invisible blocking"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *resource_descs[] = {
|
const char *resource_descs[] = {
|
||||||
"None (Erase)", "Gold", "Stone", "Custom", "Custom", "Custom"
|
"None (Erase)", "Gold", "Stone", "Custom 4", "Custom 5", "Custom 6"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char *surface_descs[] = {
|
const char *surface_descs[] = {
|
||||||
"Grass", "Alt. Grass", "Road", "Stone", "Ground"
|
"Grass", "Sec. grass", "Road", "Stone", "Ground"
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -106,15 +106,25 @@ private:
|
||||||
miEditResize,
|
miEditResize,
|
||||||
miEditFlipX,
|
miEditFlipX,
|
||||||
miEditFlipY,
|
miEditFlipY,
|
||||||
|
|
||||||
|
miEditMirrorX,
|
||||||
|
miEditMirrorY,
|
||||||
|
miEditMirrorXY,
|
||||||
|
miEditRotatecopyX,
|
||||||
|
miEditRotatecopyY,
|
||||||
|
miEditRotatecopyXY,
|
||||||
|
miEditRotatecopyCorner,
|
||||||
|
miEditMirror,
|
||||||
|
|
||||||
miEditRandomizeHeights,
|
miEditRandomizeHeights,
|
||||||
miEditRandomize,
|
miEditRandomize,
|
||||||
miEditSwitchSurfaces,
|
miEditSwitchSurfaces,
|
||||||
miEditInfo,
|
miEditInfo,
|
||||||
miEditAdvanced,
|
miEditAdvanced,
|
||||||
|
|
||||||
miMiscResetZoomAndPos,
|
miViewResetZoomAndPos,
|
||||||
miMiscAbout,
|
miViewAbout,
|
||||||
miMiscHelp,
|
miViewHelp,
|
||||||
|
|
||||||
toolPlayer,
|
toolPlayer,
|
||||||
|
|
||||||
|
@ -134,11 +144,12 @@ private:
|
||||||
int lastX, lastY;
|
int lastX, lastY;
|
||||||
|
|
||||||
wxPanel *panel;
|
wxPanel *panel;
|
||||||
|
|
||||||
wxMenuBar *menuBar;
|
wxMenuBar *menuBar;
|
||||||
wxMenu *menuFile;
|
wxMenu *menuFile;
|
||||||
wxMenu *menuEdit;
|
wxMenu *menuEdit;
|
||||||
wxMenu *menuMisc;
|
wxMenu *menuEditMirror;
|
||||||
|
wxMenu *menuView;
|
||||||
wxMenu *menuBrush;
|
wxMenu *menuBrush;
|
||||||
wxMenu *menuBrushHeight;
|
wxMenu *menuBrushHeight;
|
||||||
wxMenu *menuBrushGradient;
|
wxMenu *menuBrushGradient;
|
||||||
|
@ -160,7 +171,7 @@ private:
|
||||||
int startLocation;
|
int startLocation;
|
||||||
int resourceUnderMouse;
|
int resourceUnderMouse;
|
||||||
int objectUnderMouse;
|
int objectUnderMouse;
|
||||||
|
|
||||||
ChangeType enabledGroup;
|
ChangeType enabledGroup;
|
||||||
|
|
||||||
string fileName;
|
string fileName;
|
||||||
|
@ -177,6 +188,8 @@ public:
|
||||||
|
|
||||||
void onMouseDown(wxMouseEvent &event, int x, int y);
|
void onMouseDown(wxMouseEvent &event, int x, int y);
|
||||||
void onMouseMove(wxMouseEvent &event, int x, int y);
|
void onMouseMove(wxMouseEvent &event, int x, int y);
|
||||||
|
void onMouseWheelDown(wxMouseEvent &event);
|
||||||
|
void onMouseWheelUp(wxMouseEvent &event);
|
||||||
|
|
||||||
void onPaint(wxPaintEvent &event);
|
void onPaint(wxPaintEvent &event);
|
||||||
void onKeyDown(wxKeyEvent &e);
|
void onKeyDown(wxKeyEvent &e);
|
||||||
|
@ -193,15 +206,24 @@ public:
|
||||||
void onMenuEditResize(wxCommandEvent &event);
|
void onMenuEditResize(wxCommandEvent &event);
|
||||||
void onMenuEditFlipX(wxCommandEvent &event);
|
void onMenuEditFlipX(wxCommandEvent &event);
|
||||||
void onMenuEditFlipY(wxCommandEvent &event);
|
void onMenuEditFlipY(wxCommandEvent &event);
|
||||||
|
|
||||||
|
void onMenuEditMirrorX(wxCommandEvent &event); // copy left to right
|
||||||
|
void onMenuEditMirrorY(wxCommandEvent &event); // copy top to bottom
|
||||||
|
void onMenuEditMirrorXY(wxCommandEvent &event); // copy bottomleft to topright
|
||||||
|
void onMenuEditRotatecopyX(wxCommandEvent &event); // copy left to right, rotated
|
||||||
|
void onMenuEditRotatecopyY(wxCommandEvent &event); // copy top to bottom, rotated
|
||||||
|
void onMenuEditRotatecopyXY(wxCommandEvent &event); // copy bottomleft to topright, rotated
|
||||||
|
void onMenuEditRotatecopyCorner(wxCommandEvent &event); // copy top left 1/4 to top right 1/4, rotated
|
||||||
|
|
||||||
void onMenuEditRandomizeHeights(wxCommandEvent &event);
|
void onMenuEditRandomizeHeights(wxCommandEvent &event);
|
||||||
void onMenuEditRandomize(wxCommandEvent &event);
|
void onMenuEditRandomize(wxCommandEvent &event);
|
||||||
void onMenuEditSwitchSurfaces(wxCommandEvent &event);
|
void onMenuEditSwitchSurfaces(wxCommandEvent &event);
|
||||||
void onMenuEditInfo(wxCommandEvent &event);
|
void onMenuEditInfo(wxCommandEvent &event);
|
||||||
void onMenuEditAdvanced(wxCommandEvent &event);
|
void onMenuEditAdvanced(wxCommandEvent &event);
|
||||||
|
|
||||||
void onMenuMiscResetZoomAndPos(wxCommandEvent &event);
|
void onMenuViewResetZoomAndPos(wxCommandEvent &event);
|
||||||
void onMenuMiscAbout(wxCommandEvent &event);
|
void onMenuViewAbout(wxCommandEvent &event);
|
||||||
void onMenuMiscHelp(wxCommandEvent &event);
|
void onMenuViewHelp(wxCommandEvent &event);
|
||||||
|
|
||||||
void onMenuBrushHeight(wxCommandEvent &event);
|
void onMenuBrushHeight(wxCommandEvent &event);
|
||||||
void onMenuBrushGradient(wxCommandEvent &event);
|
void onMenuBrushGradient(wxCommandEvent &event);
|
||||||
|
@ -210,7 +232,7 @@ public:
|
||||||
void onMenuBrushResource(wxCommandEvent &event);
|
void onMenuBrushResource(wxCommandEvent &event);
|
||||||
void onMenuBrushStartLocation(wxCommandEvent &event);
|
void onMenuBrushStartLocation(wxCommandEvent &event);
|
||||||
void onMenuRadius(wxCommandEvent &event);
|
void onMenuRadius(wxCommandEvent &event);
|
||||||
|
|
||||||
void onToolPlayer(wxCommandEvent &event);
|
void onToolPlayer(wxCommandEvent &event);
|
||||||
|
|
||||||
void change(int x, int y);
|
void change(int x, int y);
|
||||||
|
@ -237,8 +259,9 @@ public:
|
||||||
|
|
||||||
void onMouseDown(wxMouseEvent &event);
|
void onMouseDown(wxMouseEvent &event);
|
||||||
void onMouseMove(wxMouseEvent &event);
|
void onMouseMove(wxMouseEvent &event);
|
||||||
|
void onMouseWheel(wxMouseEvent &event);
|
||||||
void onKeyDown(wxKeyEvent &event);
|
void onKeyDown(wxKeyEvent &event);
|
||||||
|
void onPaint(wxPaintEvent &event);
|
||||||
private:
|
private:
|
||||||
MainWindow *mainWindow;
|
MainWindow *mainWindow;
|
||||||
};
|
};
|
||||||
|
@ -255,10 +278,10 @@ private:
|
||||||
Values values;
|
Values values;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void addValue(const string &key, const string &value);
|
void addValue(const string &key, const string &value, const string &help="");
|
||||||
string getValue(const string &key);
|
string getValue(const string &key);
|
||||||
|
|
||||||
void show();
|
bool show(const string &title="Edit values", bool wide=false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// License, or (at your option) any later version
|
// License, or (at your option) any later version
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
|
// This file is not used anoymore
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ void Map::pirateChangeHeight(int x, int y, int height, int radius) {
|
||||||
normI[1] = 2;
|
normI[1] = 2;
|
||||||
} else if (normIf < 0) {
|
} else if (normIf < 0) {
|
||||||
normI[1] = 0;
|
normI[1] = 0;
|
||||||
} else /*(normIf == 0)*/ {
|
} else { // (normIf == 0)
|
||||||
normI[1] = 1;
|
normI[1] = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -217,7 +218,7 @@ void Map::pirateChangeHeight(int x, int y, int height, int radius) {
|
||||||
normJ[1] = 2;
|
normJ[1] = 2;
|
||||||
} else if (normJf < 0) {
|
} else if (normJf < 0) {
|
||||||
normJ[1] = 0;
|
normJ[1] = 0;
|
||||||
} else /*(normJf == 0)*/ {
|
} else { // (normJf == 0)
|
||||||
normJ[1] = 1;
|
normJ[1] = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -316,6 +317,45 @@ void Map::flipY() {
|
||||||
delete [] oldCells;
|
delete [] oldCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Map::mirrorX() { // copy left to right
|
||||||
|
for (int i = 0; i < w/2; i++) {
|
||||||
|
for (int j = 0; j < h; j++) {
|
||||||
|
cells[w-i-1][j].height = cells[i][j].height;
|
||||||
|
cells[w-i-1][j].object = cells[i][j].object;
|
||||||
|
cells[w-i-1][j].resource = cells[i][j].resource;
|
||||||
|
cells[w-i-1][j].surface = cells[i][j].surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::mirrorY() { // copy top to bottom
|
||||||
|
for (int i = 0; i < w; i++) {
|
||||||
|
for (int j = 0; j < h/2; j++) {
|
||||||
|
cells[i][h-j-1].height = cells[i][j].height;
|
||||||
|
cells[i][h-j-1].object = cells[i][j].object;
|
||||||
|
cells[i][h-j-1].resource = cells[i][j].resource;
|
||||||
|
cells[i][h-j-1].surface = cells[i][j].surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::mirrorXY() { // copy leftbottom to topright
|
||||||
|
for (int i = 0; i < w-1; i++) {
|
||||||
|
for (int j = i+1; j < h; j++) {
|
||||||
|
cells[i][j].height = cells[j][i].height;
|
||||||
|
cells[i][j].object = cells[j][i].object;
|
||||||
|
cells[i][j].resource = cells[j][i].resource;
|
||||||
|
cells[i][j].surface = cells[j][i].surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
void Map::rotatecopyX();
|
||||||
|
void Map::rotatecopyY();
|
||||||
|
void Map::rotatecopyXY();
|
||||||
|
void Map::rotatecopyCorner();
|
||||||
|
*/
|
||||||
|
|
||||||
void Map::changeSurface(int x, int y, int surface, int radius) {
|
void Map::changeSurface(int x, int y, int surface, int radius) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int dist;
|
int dist;
|
||||||
|
@ -506,6 +546,7 @@ void Map::resetFactions(int maxPlayers) {
|
||||||
throw runtime_error("Max Players must be in the range 1-8");
|
throw runtime_error("Max Players must be in the range 1-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// perhaps we should NOT remove current starting posititons, since the user just want to change number of players....
|
||||||
if (startLocations != NULL) {
|
if (startLocations != NULL) {
|
||||||
delete [] startLocations;
|
delete [] startLocations;
|
||||||
startLocations = NULL;
|
startLocations = NULL;
|
||||||
|
@ -762,3 +803,5 @@ void Map::applyNewHeight(float newHeight, int x, int y, int strenght) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}// end namespace
|
}// end namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// License, or (at your option) any later version
|
// License, or (at your option) any later version
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
|
// This file is not used anoymore
|
||||||
|
|
||||||
#ifndef _MAPEDITOR_MAP_H_
|
#ifndef _MAPEDITOR_MAP_H_
|
||||||
#define _MAPEDITOR_MAP_H_
|
#define _MAPEDITOR_MAP_H_
|
||||||
|
|
||||||
|
@ -112,6 +114,13 @@ public:
|
||||||
|
|
||||||
void flipX();
|
void flipX();
|
||||||
void flipY();
|
void flipY();
|
||||||
|
void mirrorX();
|
||||||
|
void mirrorY();
|
||||||
|
void mirrorXY();
|
||||||
|
void rotatecopyX();
|
||||||
|
void rotatecopyY();
|
||||||
|
void rotatecopyXY();
|
||||||
|
void rotatecopyCorner();
|
||||||
void reset(int w, int h, float alt, int surf);
|
void reset(int w, int h, float alt, int surf);
|
||||||
void resize(int w, int h, float alt, int surf);
|
void resize(int w, int h, float alt, int surf);
|
||||||
void resetFactions(int maxFactions);
|
void resetFactions(int maxFactions);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
||||||
namespace MapEditor {
|
namespace MapEditor {
|
||||||
|
@ -24,7 +25,7 @@ namespace MapEditor {
|
||||||
int UndoPoint::w = 0;
|
int UndoPoint::w = 0;
|
||||||
int UndoPoint::h = 0;
|
int UndoPoint::h = 0;
|
||||||
|
|
||||||
UndoPoint::UndoPoint()
|
UndoPoint::UndoPoint()
|
||||||
: change(ctNone)
|
: change(ctNone)
|
||||||
, surface(0)
|
, surface(0)
|
||||||
, object(0)
|
, object(0)
|
||||||
|
@ -252,6 +253,124 @@ void Program::flipY() {
|
||||||
map->flipY();
|
map->flipY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Program::mirrorX() { // copy left to right
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
for (int i = 0; i < w/2; i++) {
|
||||||
|
for (int j = 0; j < h; j++) {
|
||||||
|
map->copyXY(w-i-1,j , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::mirrorY() { // copy top to bottom
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
for (int i = 0; i < w; i++) {
|
||||||
|
for (int j = 0; j < h/2; j++) {
|
||||||
|
map->copyXY(i,h-j-1 , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::mirrorXY() { // copy leftbottom to topright, can handle non-sqaure maps
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
if (h==w) {
|
||||||
|
for (int i = 0; i < w-1; i++) {
|
||||||
|
for (int j = i+1; j < h; j++) {
|
||||||
|
map->copyXY(j,i , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non-sqaure maps:
|
||||||
|
else if (h < w) { // copy horizontal strips
|
||||||
|
int s=w/h; // 2 if twice as wide as heigh
|
||||||
|
for (int i = 0; i < w/s-1; i++) {
|
||||||
|
for (int j = i+1; j < h; j++) {
|
||||||
|
for (int p = 0; p < s; p++) map->copyXY(j*s+p,i , i*s+p,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // copy vertical strips
|
||||||
|
int s=h/w; // 2 if twice as heigh as wide
|
||||||
|
for (int i = 0; i < w-1; i++) {
|
||||||
|
for (int j = i+1; j < h/s; j++) {
|
||||||
|
for (int p = 0; p < s; p++) map->copyXY(j,i*s+p , i,j*s+p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::rotatecopyX() {
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
for (int i = 0; i < w/2; i++) {
|
||||||
|
for (int j = 0; j < h; j++) {
|
||||||
|
map->copyXY(w-i-1,h-j-1 , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::rotatecopyY() {
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
for (int i = 0; i < w; i++) {
|
||||||
|
for (int j = 0; j < h/2; j++) {
|
||||||
|
map->copyXY(w-i-1,h-j-1 , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::rotatecopyXY() {
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
int sw=w/h; if(sw<1) sw=1; // x-squares per y
|
||||||
|
int sh=h/w; if(sh<1) sh=1; // y-squares per x
|
||||||
|
if (sh==1)
|
||||||
|
for (int j = 0; j < h-1; j++) { // row by row!
|
||||||
|
for (int i = j*sw; i < w; i++) {
|
||||||
|
map->copyXY(i,j , w-i-1,h-j-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
for (int i = 0; i <w; i++) { // column for colum!
|
||||||
|
for (int j = h-1-i*sh; j >= 0; j--) {
|
||||||
|
map->copyXY(w-i-1,j , i,h-j-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Program::rotatecopyCorner() { // rotate top left 1/4 to top right 1/4
|
||||||
|
int w=map->getW();
|
||||||
|
int h=map->getH();
|
||||||
|
if (h==w) {
|
||||||
|
for (int i = 0; i < w/2; i++) {
|
||||||
|
for (int j = 0; j < h/2; j++) {
|
||||||
|
map->copyXY(w-j-1,i , i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Non-sqaure maps:
|
||||||
|
else if (h < w) { // copy horizontal strips
|
||||||
|
int s=w/h; // 2 if twice as wide as heigh
|
||||||
|
for (int i = 0; i < w/s/2; i++) {
|
||||||
|
for (int j = 0; j < h/2; j++) {
|
||||||
|
for (int p = 0; p < s; p++) map->copyXY(w-j*s-1-p,i , i*s+p,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // copy vertical strips
|
||||||
|
int s=h/w; // 2 if twice as heigh as wide
|
||||||
|
for (int i = 0; i < w/2; i++) {
|
||||||
|
for (int j = 0; j < h/s/2; j++) {
|
||||||
|
for (int p = 0; p < s; p++) map->copyXY(w-j-1,i*s+p , i,j*s+p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Program::randomizeMapHeights() {
|
void Program::randomizeMapHeights() {
|
||||||
map->randomizeHeights();
|
map->randomizeHeights();
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,15 @@ public:
|
||||||
void setRefAlt(int x, int y);
|
void setRefAlt(int x, int y);
|
||||||
void flipX();
|
void flipX();
|
||||||
void flipY();
|
void flipY();
|
||||||
|
void mirrorX();
|
||||||
|
void mirrorY();
|
||||||
|
void mirrorXY();
|
||||||
|
void rotatecopyX();
|
||||||
|
void rotatecopyY();
|
||||||
|
void rotatecopyXY();
|
||||||
|
void rotatecopyCorner();
|
||||||
|
|
||||||
|
|
||||||
void randomizeMapHeights();
|
void randomizeMapHeights();
|
||||||
void randomizeMap();
|
void randomizeMap();
|
||||||
void switchMapSurfaces(int surf1, int surf2);
|
void switchMapSurfaces(int surf1, int surf2);
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
|
|
||||||
void flipX();
|
void flipX();
|
||||||
void flipY();
|
void flipY();
|
||||||
|
void copyXY(int x, int y, int sx, int sy); // destination x,y = source sx,sy
|
||||||
void reset(int w, int h, float alt, MapSurfaceType surf);
|
void reset(int w, int h, float alt, MapSurfaceType surf);
|
||||||
void resize(int w, int h, float alt, MapSurfaceType surf);
|
void resize(int w, int h, float alt, MapSurfaceType surf);
|
||||||
void resetFactions(int maxFactions);
|
void resetFactions(int maxFactions);
|
||||||
|
|
|
@ -344,6 +344,14 @@ void MapPreview::flipY() {
|
||||||
//delete [] oldCells;
|
//delete [] oldCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy a cell in the map from one cell to another, used by MirrorXY etc
|
||||||
|
void MapPreview::copyXY(int x, int y, int sx, int sy) {
|
||||||
|
cells[x][y].height = cells[sx][sy].height;
|
||||||
|
cells[x][y].object = cells[sx][sy].object;
|
||||||
|
cells[x][y].resource = cells[sx][sy].resource;
|
||||||
|
cells[x][y].surface = cells[sx][sy].surface;
|
||||||
|
}
|
||||||
|
|
||||||
void MapPreview::changeSurface(int x, int y, MapSurfaceType surface, int radius) {
|
void MapPreview::changeSurface(int x, int y, MapSurfaceType surface, int radius) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int dist;
|
int dist;
|
||||||
|
|
Loading…
Reference in New Issue