From b305911aac58ca08af06e739fed704cebaecffb6 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 22 Jan 2019 18:38:17 +0100 Subject: [PATCH] Remove EDITORMODE switch Always on now --- CGame_Init.cpp | 37 --------------------------------- CMap.cpp | 44 +++------------------------------------ CSurface.cpp | 6 +----- callbacks.cpp | 56 +------------------------------------------------- callbacks.h | 4 ---- defines.h | 37 +++------------------------------ 6 files changed, 8 insertions(+), 176 deletions(-) diff --git a/CGame_Init.cpp b/CGame_Init.cpp index f1ab222..cd973b8 100644 --- a/CGame_Init.cpp +++ b/CGame_Init.cpp @@ -175,7 +175,6 @@ bool CGame::Init() } } -#ifdef _EDITORMODE // load only the palette at this time from editres.idx std::cout << "\nLoading palette from file: /DATA/EDITRES.IDX..."; if(!CFile::open_file(global::gameDataFilePath + "/DATA/EDITRES.IDX", IDX, true)) @@ -216,42 +215,6 @@ bool CGame::Init() std::cout << "failure"; return false; } -#else - // load only the palette at this time from resource.idx - std::cout << "\nLoading palette from file: /DATA/RESOURCE.IDX..."; - if(!CFile::open_file(global::gameDataFilePath + "/DATA/RESOURCE.IDX", IDX, true)) - { - std::cout << "failure"; - return false; - } - // set the right palette - CFile::set_palActual(CFile::get_palArray() - 1); - std::cout << "\nLoading file: /DATA/RESOURCE.IDX..."; - if(!CFile::open_file(global::gameDataFilePath + "/DATA/RESOURCE.IDX", IDX)) - { - std::cout << "failure"; - return false; - } - // set back palette - CFile::set_palActual(CFile::get_palArray()); - // load only the palette at this time from io.idx - std::cout << "\nLoading palette from file: /DATA/IO/IO.IDX..."; - if(!CFile::open_file(global::gameDataFilePath + "/DATA/IO/IO.IDX", IDX, true)) - { - std::cout << "failure"; - return false; - } - // set the right palette - CFile::set_palActual(CFile::get_palArray() - 1); - std::cout << "\nLoading file: /DATA/IO/IO.IDX..."; - if(!CFile::open_file(global::gameDataFilePath + "/DATA/IO/IO.IDX", IDX)) - { - std::cout << "failure"; - return false; - } - // set back palette - CFile::set_palActual(CFile::get_palArray()); -#endif // texture tilesets paths.clear(); diff --git a/CMap.cpp b/CMap.cpp index ca2e2d3..186f763 100644 --- a/CMap.cpp +++ b/CMap.cpp @@ -81,7 +81,7 @@ void CMap::constructMap(const std::string& filename, int width, int height, MapT loadMapPics(); CSurface::get_nodeVectors(*map); -#ifdef _EDITORMODE + // for safety recalculate build and shadow data and test if fishes and water is correct for(int i = 0; i < map->height; i++) { @@ -92,7 +92,7 @@ void CMap::constructMap(const std::string& filename, int width, int height, MapT modifyResource(j, i); } } -#endif + needSurface = true; active = true; VertexX_ = 10; @@ -521,7 +521,6 @@ void CMap::setMouseData(const SDL_MouseButtonEvent& button) { if(button.state == SDL_PRESSED) { -#ifdef _EDITORMODE // find out if user clicked on one of the game menu pictures // we start with lower menubar if(button.button == SDL_BUTTON_LEFT && button.x >= (displayRect.getSize().x / 2 - 236) @@ -659,25 +658,11 @@ void CMap::setMouseData(const SDL_MouseButtonEvent& button) saveCurrentVertices = true; } } -#else - // find out if user clicked on one of the game menu pictures - if(button.button == SDL_BUTTON_LEFT && button.x >= (displayRect.getSize().x / 2 - 74) - && button.x <= (displayRect.getSize().x / 2 - 37) && button.y >= (displayRect.getSize().y - 37) - && button.y <= (displayRect.getSize().y - 4)) - { - // the first picture was clicked - callback::GameMenu(INITIALIZING_CALL); - } -#endif } else if(button.state == SDL_RELEASED) { -#ifdef _EDITORMODE // stop touching vertex data if(button.button == SDL_BUTTON_LEFT) modify = false; -#else - -#endif } } @@ -915,7 +900,6 @@ void CMap::setKeyboardData(const SDL_KeyboardEvent& key) moveMap(offset); } break; -#ifdef _EDITORMODE case SDLK_F1: // help menu callback::EditorHelpMenu(INITIALIZING_CALL); break; @@ -975,7 +959,6 @@ void CMap::setKeyboardData(const SDL_KeyboardEvent& key) callback::PleaseWait(WINDOW_QUIT_MESSAGE); break; -#endif case SDLK_p: if(BitsPerPixel == 8) setBitsPerPixel(32); @@ -1152,8 +1135,7 @@ void CMap::render() if(!map->vertex.empty()) CSurface::DrawTriangleField(Surf_Map, displayRect, *map); - // draw pictures to cursor position -#ifdef _EDITORMODE + // draw pictures to cursor position int symbol_index, symbol_index2 = -1; switch(mode) { @@ -1207,10 +1189,6 @@ void CMap::render() CFont::writeText(Surf_Map, textBuffer, 20, 40, 14, FONT_ORANGE); } -#else - CSurface::Draw(Surf_Map, global::bmpArray[CIRCLE_FLAT_GREY].surface, MouseBlitX - 10, MouseBlitY - 10); -#endif - // draw the frame if(displayRect.getSize() == Extent(640, 480)) CSurface::Draw(Surf_Map, global::bmpArray[MAINFRAME_640_480].surface, 0, 0); @@ -1262,7 +1240,6 @@ void CMap::render() displayRect.getSize().y - global::bmpArray[MENUBAR].h); // draw pictures to lower menubar -#ifdef _EDITORMODE // backgrounds CSurface::Draw(Surf_Map, global::bmpArray[BUTTON_GREEN1_DARK].surface, displayRect.getSize().x / 2 - 236, displayRect.getSize().y - 36, 0, 0, 37, 32); @@ -1299,11 +1276,7 @@ void CMap::render() CSurface::Draw(Surf_Map, global::bmpArray[MENUBAR_MINIMAP].surface, displayRect.getSize().x / 2 + 131, displayRect.getSize().y - 37); CSurface::Draw(Surf_Map, global::bmpArray[MENUBAR_NEWWORLD].surface, displayRect.getSize().x / 2 + 166, displayRect.getSize().y - 37); CSurface::Draw(Surf_Map, global::bmpArray[MENUBAR_COMPUTER].surface, displayRect.getSize().x / 2 + 207, displayRect.getSize().y - 35); -#else -#endif - -#ifdef _EDITORMODE // right menubar // do we need a surface? if(!Surf_RightMenubar) @@ -1364,8 +1337,6 @@ void CMap::render() CSurface::Draw(Surf_Map, global::bmpArray[MENUBAR_BUGKILL].surface, displayRect.getSize().x - 37, displayRect.getSize().y / 2 + 200); sprintf(textBuffer, "Save"); CFont::writeText(Surf_Map, textBuffer, displayRect.getSize().x - 35, displayRect.getSize().y / 2 + 231); - -#endif } void CMap::drawMinimap(SDL_Surface* Window) @@ -1502,7 +1473,6 @@ void CMap::drawMinimap(SDL_Surface* Window) } } -#ifdef _EDITORMODE // draw the player flags char playerNumber[10]; for(int i = 0; i < MAXPLAYERS; i++) @@ -1519,7 +1489,6 @@ void CMap::drawMinimap(SDL_Surface* Window) CFont::writeText(Window, playerNumber, 6 + PlayerHQx[i] / num_x, 20 + PlayerHQy[i] / num_y, 9, FONT_MINTGREEN); } } -#endif // draw the arrow --> 6px is width of left window frame and 20px is the height of the upper window frame CSurface::Draw( @@ -2352,13 +2321,6 @@ void CMap::modifyBuild(int x, int y) building = 0x00; } } -#ifndef _EDITORMODE - if(building > 0x00) - { - if(mapVertices[0]->objectInfo == 0x80) - building = 0x00; - } -#endif // test for headquarters around (second section) if(building > 0x01) diff --git a/CSurface.cpp b/CSurface.cpp index 14b9a48..6c89234 100644 --- a/CSurface.cpp +++ b/CSurface.cpp @@ -1061,10 +1061,8 @@ void CSurface::DrawTriangle(SDL_Surface* display, const DisplayRectangle& displa break; // headquarter case 0x80: // node2.objectType is the number of the player beginning with 0x00 -//%7 cause in the original game there are only 7 players and 7 different flags -#ifdef _EDITORMODE + //%7 cause in the original game there are only 7 players and 7 different flags objIdx = FLAG_BLUE_DARK + P2.objectType % 7; -#endif break; default: break; @@ -1074,7 +1072,6 @@ void CSurface::DrawTriangle(SDL_Surface* display, const DisplayRectangle& displa (int)(p2.y - displayRect.top - global::bmpArray[objIdx].ny)); } -#ifdef _EDITORMODE // blit resources if(!isRSU) { @@ -1113,7 +1110,6 @@ void CSurface::DrawTriangle(SDL_Surface* display, const DisplayRectangle& displa (int)(p2.y - displayRect.top - global::bmpArray[PICTURE_SMALL_BEAR + P2.animal].ny)); } } -#endif // blit buildings if(global::s2->getMapObj()->getRenderBuildHelp()) diff --git a/callbacks.cpp b/callbacks.cpp index 4876bba..a1f8565 100644 --- a/callbacks.cpp +++ b/callbacks.cpp @@ -614,8 +614,7 @@ void callback::submenuOptions(int Param) } } -#ifdef _EDITORMODE -// now the editor callbacks will follow (editor mode) +// now the editor callbacks will follow void callback::EditorHelpMenu(int Param) { @@ -3036,59 +3035,6 @@ void callback::EditorCreateMenu(int Param) } } -#else -// now the 4 game callbacks from the menubar will follow - -void callback::GameMenu(int Param) -{ - static CWindow* WNDBackToMainMenu = nullptr; - - enum - { - BACKTOMAIN = 1, - WINDOWQUIT - }; - - switch(Param) - { - case INITIALIZING_CALL: - if(WNDBackToMainMenu) - break; - WNDBackToMainMenu = - new CWindow(GameMenu, WINDOWQUIT, global::s2->GameResolution.x / 2 - 125, global::s2->GameResolution.y / 2 - 60, 250, 140, - "Back to the main menu?", WINDOW_GREEN1, WINDOW_CLOSE); - if(global::s2->RegisterWindow(WNDBackToMainMenu)) - { - WNDBackToMainMenu->addButton(GameMenu, BACKTOMAIN, 20, 20, 200, 80, BUTTON_RED2, "Yes"); - } else - { - delete WNDBackToMainMenu; - WNDBackToMainMenu = nullptr; - return; - } - break; - - case BACKTOMAIN: - if(global::s2->getMapObj() != nullptr) - global::s2->delMapObj(); - WNDBackToMainMenu->setWaste(); - WNDBackToMainMenu = nullptr; - mainmenu(INITIALIZING_CALL); - break; - - case WINDOWQUIT: - if(WNDBackToMainMenu) - { - WNDBackToMainMenu->setWaste(); - WNDBackToMainMenu = nullptr; - } - break; - - default: break; - } -} -#endif - void callback::MinimapMenu(int Param) { static CWindow* WNDMinimap = nullptr; diff --git a/callbacks.h b/callbacks.h index 8e1e398..c10ffba 100644 --- a/callbacks.h +++ b/callbacks.h @@ -17,7 +17,6 @@ void ShowStatus(int Param); void mainmenu(int Param); void submenuOptions(int Param); void MinimapMenu(int Param); -#ifdef _EDITORMODE void EditorHelpMenu(int Param); void EditorMainMenu(int Param); void EditorLoadMenu(int Param); @@ -31,9 +30,6 @@ void EditorAnimalMenu(int Param); void EditorPlayerMenu(int Param); void EditorCreateMenu(int Param); void EditorCursorMenu(int Param); -#else -void GameMenu(int Param); -#endif #ifdef _ADMINMODE void debugger(int Param); diff --git a/defines.h b/defines.h index 1475557..590538d 100644 --- a/defines.h +++ b/defines.h @@ -12,8 +12,6 @@ struct TerrainDesc; // define the mode to compile (if all is uncommented, the game will compile in normal mode // in admin mode, there are some key combos to open debugger, resource viewer and so on //#define _ADMINMODE -// in editor mode there is the possibility to load, edit and save created maps -//#define _EDITORMODE // callback parameters enum @@ -749,9 +747,8 @@ enum WINDOW_BUTTON_RESIZE_MARKED, WINDOW_BUTTON_CLOSE_MARKED, WINDOW_BUTTON_MINIMIZE_MARKED, -// END: /DATA/RESOURCE.IDX (AND /DATA/RESOURCE.DAT) OR /DATA/EDITRES.IDX (AND /DATA/EDITRES.DAT) + // END: /DATA/RESOURCE.IDX (AND /DATA/RESOURCE.DAT) OR /DATA/EDITRES.IDX (AND /DATA/EDITRES.DAT) -#ifdef _EDITORMODE // BEGIN: /DATA/IO/EDITIO.IDX (AND /DATA/IO/EDITIO.DAT) BUTTON_GREY_BRIGHT, BUTTON_GREY_DARK, @@ -920,31 +917,7 @@ enum PICTURE_SMALL_DEER, PICTURE_SMALL_DUCK, PICTURE_SMALL_SHEEP, -// END: /DATA/EDITBOB.LST -#else - // BEGIN: /DATA/IO/IO.IDX (AND /DATA/IO/IO.DAT) - BUTTON_GREY_BRIGHT, - BUTTON_GREY_DARK, - BUTTON_RED1_BRIGHT, - BUTTON_RED1_DARK, - BUTTON_GREEN1_BRIGHT, - BUTTON_GREEN1_DARK, - BUTTON_GREEN2_BRIGHT, - BUTTON_GREEN2_DARK, - BUTTON_RED2_BRIGHT, - BUTTON_RED2_DARK, - BUTTON_STONE_BRIGHT, - BUTTON_STONE_DARK, - BUTTON_GREY_BACKGROUND, - BUTTON_RED1_BACKGROUND, - BUTTON_GREEN1_BACKGROUND, - BUTTON_GREEN2_BACKGROUND, - BUTTON_RED2_BACKGROUND, - BUTTON_STONE_BACKGROUND, - // some bobtype 14 pictures missing here - AVATAR_OCTAVIANUS_SMALL = 688 + 2070, -// END: /DATA/IO/IO.IDX (AND /DATA/IO/IO.DAT) -#endif + // END: /DATA/EDITBOB.LST // BEGIN: /GFX/TEXTURES/TEX5.LBM TILESET_GREENLAND_8BPP, @@ -1072,12 +1045,8 @@ enum MAPPIC_SHRUB7, MAPPIC_SNOWMAN, MAPPIC_DOOR, -// some pictures missing here -#ifdef _EDITORMODE + // some pictures missing here MAPPIC_LAST_ENTRY = 1432 + 2070 -#else - MAPPIC_LAST_ENTRY = 1523 + 2070 -#endif // END: /DATA/MAP00.LST };