Skip to content

Commit

Permalink
Remove EDITORMODE switch
Browse files Browse the repository at this point in the history
Always on now
  • Loading branch information
Flamefire committed Jan 22, 2019
1 parent b1aca88 commit b305911
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 176 deletions.
37 changes: 0 additions & 37 deletions CGame_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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();
Expand Down
44 changes: 3 additions & 41 deletions CMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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++)
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions CSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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())
Expand Down
56 changes: 1 addition & 55 deletions callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
37 changes: 3 additions & 34 deletions defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
};

Expand Down

0 comments on commit b305911

Please sign in to comment.