diff --git a/src/frontend.c b/src/frontend.c index 6a319a0f8..8ba491ddd 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -63,7 +63,7 @@ static int StartWithGame = 1; // New game starts in Cam 1. -tMode titleMode; // the global case +tMode titleMode; // the global case int FEFont; char pLevelName[MAX_LEVEL_NAME_SIZE+1]; //256]; // vital! the wrf file to use. @@ -182,7 +182,7 @@ void changeTitleMode(tMode mode) { tMode oldMode; - widgDelete(psWScreen,FRONTEND_BACKDROP); // delete backdrop. + widgDelete(psWScreen, FRONTEND_BACKDROP); // delete backdrop. oldMode = titleMode; // store old mode titleMode = mode; // set new mode @@ -291,22 +291,24 @@ BOOL startTitleMenu(void) addTopForm(); addBottomForm(); - addTextButton(FRONTEND_SINGLEPLAYER,FRONTEND_POS2X,FRONTEND_POS2Y, _("Single Player Campaign"),FALSE,FALSE); - if(!bDisableLobby) - { - addTextButton(FRONTEND_MULTIPLAYER, FRONTEND_POS3X,FRONTEND_POS3Y, _("Multi Player Game") ,FALSE,FALSE); - }else{ - addTextButton(FRONTEND_MULTIPLAYER, FRONTEND_POS3X,FRONTEND_POS3Y, _("Multi Player Game") ,FALSE,TRUE); - } - addTextButton(FRONTEND_TUTORIAL, FRONTEND_POS4X,FRONTEND_POS4Y, _("Tutorial") ,FALSE,FALSE); - addTextButton(FRONTEND_OPTIONS, FRONTEND_POS5X,FRONTEND_POS5Y, _("Options") ,FALSE,FALSE); + addTextButton(FRONTEND_SINGLEPLAYER, FRONTEND_POS2X, FRONTEND_POS2Y, _("Single Player Campaign"), FALSE, FALSE); + if(!bDisableLobby) + { + addTextButton(FRONTEND_MULTIPLAYER, FRONTEND_POS3X,FRONTEND_POS3Y, _("Multi Player Game"), FALSE, FALSE); + } + else + { + addTextButton(FRONTEND_MULTIPLAYER, FRONTEND_POS3X, FRONTEND_POS3Y, _("Multi Player Game"),FALSE,TRUE); + } + addTextButton(FRONTEND_TUTORIAL, FRONTEND_POS4X, FRONTEND_POS4Y, _("Tutorial") ,FALSE,FALSE); + addTextButton(FRONTEND_OPTIONS, FRONTEND_POS5X, FRONTEND_POS5Y, _("Options") ,FALSE,FALSE); - addTextButton(FRONTEND_QUIT, FRONTEND_POS6X,FRONTEND_POS6Y, _("Quit Game"),FALSE,FALSE); + addTextButton(FRONTEND_QUIT, FRONTEND_POS6X, FRONTEND_POS6Y, _("Quit Game"), FALSE, FALSE); - addSideText (FRONTEND_SIDETEXT , FRONTEND_SIDEX,FRONTEND_SIDEY,_("MAIN MENU")); + addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("MAIN MENU")); SetMousePos(320, FRONTEND_BOTFORMY + FRONTEND_POS2Y); - SnapToID(&InterfaceSnap,4); + SnapToID(&InterfaceSnap, 4); return TRUE; } @@ -318,11 +320,11 @@ BOOL runTitleMenu(void) processFrontendSnap(TRUE); - id = widgRunScreen(psWScreen); // Run the current set of widgets + id = widgRunScreen(psWScreen); // Run the current set of widgets - switch(id) - { - case FRONTEND_QUIT: + switch(id) + { + case FRONTEND_QUIT: changeTitleMode(CREDITS); break; case FRONTEND_MULTIPLAYER: @@ -339,10 +341,10 @@ BOOL runTitleMenu(void) break; default: break; - } + } StartCursorSnap(&InterfaceSnap); - widgDisplayScreen(psWScreen); // show the widgets currently running + widgDisplayScreen(psWScreen); // show the widgets currently running return TRUE; } diff --git a/src/frontend.h b/src/frontend.h index 6354d5edc..8518ba40f 100644 --- a/src/frontend.h +++ b/src/frontend.h @@ -27,28 +27,28 @@ // determines which option screen to use. when in GS_TITLE_SCREEN mode. typedef enum _title_mode { - TITLE, // 0 intro mode - SINGLE, // 1 single player menu - MULTI, // 2 multiplayer menu - OPTIONS, // 3 options menu - GAME, // 4 - TUTORIAL, // 5 tutorial/fastplay - CREDITS, // 6 credits - PROTOCOL, // 7 MULTIPLAYER, select proto - MULTIOPTION, // 8 MULTIPLAYER, select game options - FORCESELECT, // 9 MULTIPLAYER, Force design screen - GAMEFIND, // 10 MULTIPLAYER, gamefinder. - MULTILIMIT, // 11 MULTIPLAYER, Limit the multistuff. - STARTGAME, // 12 Fire up the game - SHOWINTRO, // 13 reshow the intro - QUIT, // 14 leaving game - LOADSAVEGAME, // 15 loading a save game - KEYMAP, // 16 keymap editor - GAME2, // 17 second options menu. - GAME3, // 18 third options menu. -// GRAPHICS, // 5 -// VIDEO, -// DEMOMODE, // demo mode. remove for release? + TITLE, // 0 intro mode + SINGLE, // 1 single player menu + MULTI, // 2 multiplayer menu + OPTIONS, // 3 options menu + GAME, // 4 + TUTORIAL, // 5 tutorial/fastplay + CREDITS, // 6 credits + PROTOCOL, // 7 MULTIPLAYER, select proto + MULTIOPTION, // 8 MULTIPLAYER, select game options + FORCESELECT, // 9 MULTIPLAYER, Force design screen + GAMEFIND, // 10 MULTIPLAYER, gamefinder. + MULTILIMIT, // 11 MULTIPLAYER, Limit the multistuff. + STARTGAME, // 12 Fire up the game + SHOWINTRO, // 13 reshow the intro + QUIT, // 14 leaving game + LOADSAVEGAME, // 15 loading a save game + KEYMAP, // 16 keymap editor + GAME2, // 17 second options menu. + GAME3, // 18 third options menu. +// GRAPHICS, +// VIDEO, +// DEMOMODE, // demo mode. remove for release? } tMode; // This dos'nt compile on the PSX. diff --git a/src/gateway.c b/src/gateway.c index 54f481466..31b1f6e82 100644 --- a/src/gateway.c +++ b/src/gateway.c @@ -83,8 +83,7 @@ BOOL gwInitialise(void) int i; #endif - ASSERT( psGateways == NULL, - "gwInitialise: gatway list has not been reset" ); + ASSERT( psGateways == NULL, "gwInitialise: gateway list has not been reset" ); psGateways = NULL; @@ -115,7 +114,7 @@ BOOL gwInitialise(void) // Shutdown the gateway system void gwShutDown(void) { - GATEWAY *psNext; + GATEWAY *psNext; while (psGateways != NULL) { @@ -484,9 +483,8 @@ void gwFreeGateway(GATEWAY *psDel) LIST_REMOVE(psGateways, psDel, GATEWAY); - if (psMapTiles) // this lines fixes the bug where we were closing the gateways after freeing the map + if (psMapTiles) // this lines fixes the bug where we were closing the gateways after freeing the map { - // clear the map flags if (psDel->x1 == psDel->x2) { @@ -507,7 +505,8 @@ void gwFreeGateway(GATEWAY *psDel) } - if(psDel->psLinks != NULL) { + if (psDel->psLinks != NULL) + { free(psDel->psLinks); } free(psDel); diff --git a/src/levels.c b/src/levels.c index 650e7daff..047e2b5d8 100644 --- a/src/levels.c +++ b/src/levels.c @@ -197,8 +197,8 @@ BOOL levParse(char *pBuffer, SDWORD size, searchPathMode datadir) case LTK_BETWEEN: case LTK_MKEEP: case LTK_MCLEAR: - case LTK_EXPAND_LIMBO: - case LTK_MKEEP_LIMBO: + case LTK_EXPAND_LIMBO: + case LTK_MKEEP_LIMBO: if (state == LP_START || state == LP_WAITDATA) { // start a new level data set @@ -328,8 +328,8 @@ BOOL levParse(char *pBuffer, SDWORD size, searchPathMode datadir) ||psDataSet->type == LDS_CAMCHANGE || psDataSet->type == LDS_EXPAND || psDataSet->type == LDS_MCLEAR || - psDataSet->type == LDS_EXPAND_LIMBO || - psDataSet->type == LDS_MKEEP_LIMBO + psDataSet->type == LDS_EXPAND_LIMBO || + psDataSet->type == LDS_MKEEP_LIMBO ) { levError("Missing dataset command"); @@ -589,8 +589,8 @@ BOOL levLoadBaseData(char *pName) psNewLevel->type != LDS_MKEEP && psNewLevel->type != LDS_EXPAND && psNewLevel->type != LDS_MCLEAR && - psNewLevel->type != LDS_EXPAND_LIMBO && - psNewLevel->type != LDS_MKEEP_LIMBO + psNewLevel->type != LDS_EXPAND_LIMBO && + psNewLevel->type != LDS_MKEEP_LIMBO ) { debug( LOG_ERROR, "levLoadBaseData: incorect level type" ); @@ -616,7 +616,7 @@ BOOL levLoadBaseData(char *pName) // load the data debug(LOG_WZ, "levLoadBaseData: Loading %s", psBaseData->apDataFiles[i]); if (!resLoad(psBaseData->apDataFiles[i], i, - DisplayBuffer, displayBufferSize)) + DisplayBuffer, displayBufferSize)) { return FALSE; } @@ -639,7 +639,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) { LEVEL_DATASET *psNewLevel, *psBaseData, *psChangeLevel; SDWORD i; - BOOL bCamChangeSaveGame; + BOOL bCamChangeSaveGame; debug(LOG_WZ, "Loading level %s", pName); // reset fog @@ -658,22 +658,22 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) /* Keep a copy of the present level name */ strcpy(currentLevelName,pName); - bCamChangeSaveGame = FALSE; - if (pSaveName && saveType == GTYPE_SAVE_START) - { - if (psNewLevel->psChange != NULL) - { - bCamChangeSaveGame = TRUE; - } - } + bCamChangeSaveGame = FALSE; + if (pSaveName && saveType == GTYPE_SAVE_START) + { + if (psNewLevel->psChange != NULL) + { + bCamChangeSaveGame = TRUE; + } + } // select the change dataset if there is one - psChangeLevel = NULL; + psChangeLevel = NULL; if (((psNewLevel->psChange != NULL) && (psCurrLevel != NULL)) || bCamChangeSaveGame) { - //store the level name + //store the level name debug( LOG_WZ, "levLoadData: Found CAMCHANGE dataset\n" ); - psChangeLevel = psNewLevel; + psChangeLevel = psNewLevel; psNewLevel = psNewLevel->psChange; } @@ -763,7 +763,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) // load the data debug(LOG_WZ, "levLoadData: Loading %s ...", psBaseData->apDataFiles[i]); if (!resLoad(psBaseData->apDataFiles[i], i, - DisplayBuffer, displayBufferSize)) + DisplayBuffer, displayBufferSize)) { return FALSE; } @@ -792,7 +792,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) } } - //set the mission type before the saveGame data is loaded + //set the mission type before the saveGame data is loaded if (saveType == GTYPE_SAVE_MIDMISSION) { debug( LOG_NEVER, "levLoadData: init mission stuff\n" ); @@ -828,9 +828,9 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) } } - //we need to load up the save game data here for a camchange - if (bCamChangeSaveGame) - { + //we need to load up the save game data here for a camchange + if (bCamChangeSaveGame) + { debug( LOG_NEVER, "levLoadData: no .gam file for level: BETWEEN mission\n" ); if (pSaveName != NULL) { @@ -848,31 +848,30 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) return FALSE; } - if (!campaignReset()) - { - return FALSE; - } + if (!campaignReset()) + { + return FALSE; + } - //we now need to go to the next level - //psNewLevel = psChangeLevel; - //psChangeLevel = NULL; + //we now need to go to the next level + //psNewLevel = psChangeLevel; + //psChangeLevel = NULL; - //stageTwoShutDown?? - } - } + //stageTwoShutDown?? + } + } // load the new data debug( LOG_NEVER, "levLoadData: loading mission dataset: %s\n", psNewLevel->pName ); - for(i=0; igame == i) { // do some more initialising if necessary - if (psNewLevel->type == LDS_COMPLETE || psNewLevel->type >= MULTI_TYPE_START || - (psBaseData != NULL && !bCamChangeSaveGame)) + if (psNewLevel->type == LDS_COMPLETE || psNewLevel->type >= MULTI_TYPE_START || (psBaseData != NULL && !bCamChangeSaveGame)) { - iV_Reset(); //unload font, to avoid crash on 8th load... ajl 15/sep/99 + iV_Reset(); //unload font, to avoid crash on 8th load... ajl 15/sep/99 if (!stageTwoInitialise()) { return FALSE; @@ -882,7 +881,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) // load a savegame if there is one - but not if already done so if (pSaveName != NULL && !bCamChangeSaveGame) { - //set the mission type before the saveGame data is loaded + //set the mission type before the saveGame data is loaded if (saveType == GTYPE_SAVE_MIDMISSION) { debug( LOG_NEVER, "levLoadData: init mission stuff\n" ); @@ -998,7 +997,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) // set the view position if necessary if ((pSaveName != NULL) - || ((psNewLevel->type != LDS_BETWEEN) + || ((psNewLevel->type != LDS_BETWEEN) && (psNewLevel->type != LDS_EXPAND) && (psNewLevel->type != LDS_EXPAND_LIMBO) )) @@ -1014,7 +1013,7 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) // load the data debug(LOG_WZ, "levLoadData: Loading %s", psNewLevel->apDataFiles[i]); if (!resLoad(psNewLevel->apDataFiles[i], i + CURRENT_DATAID, - DisplayBuffer, displayBufferSize)) + DisplayBuffer, displayBufferSize)) { return FALSE; } @@ -1024,17 +1023,17 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) dataClearSaveFlag(); //if (pSaveName != NULL && saveType == GTYPE_SAVE_MIDMISSION) - if (pSaveName != NULL) + if (pSaveName != NULL) { //load MidMission Extras if (!loadMissionExtras(pSaveName, psNewLevel->type)) { return FALSE; } - } + } - if (pSaveName != NULL && saveType == GTYPE_SAVE_MIDMISSION) - { + if (pSaveName != NULL && saveType == GTYPE_SAVE_MIDMISSION) + { //load script stuff // load the event system state here for a save game debug( LOG_NEVER, "levLoadData: loading script system state\n" ); @@ -1051,24 +1050,24 @@ BOOL levLoadData(char *pName, char *pSaveName, SDWORD saveType) //want to test with release build too //#ifdef DEBUG - //this enables us to to start cam2/cam3 without going via a save game and get the extra droids - //in from the script-controlled Transporters - if (!pSaveName && psNewLevel->type == LDS_CAMSTART) - { - eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NO_REINFORCEMENTS_LEFT); - } + //this enables us to to start cam2/cam3 without going via a save game and get the extra droids + //in from the script-controlled Transporters + if (!pSaveName && psNewLevel->type == LDS_CAMSTART) + { + eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NO_REINFORCEMENTS_LEFT); + } //#endif - //restore the level name for comparisons on next mission load up - if (psChangeLevel == NULL) - { - psCurrLevel = psNewLevel; - } - else - { - psCurrLevel = psChangeLevel; - } + //restore the level name for comparisons on next mission load up + if (psChangeLevel == NULL) + { + psCurrLevel = psNewLevel; + } + else + { + psCurrLevel = psChangeLevel; + } - return TRUE; + return TRUE; } diff --git a/src/loop.c b/src/loop.c index f65841d3a..af022d3e9 100644 --- a/src/loop.c +++ b/src/loop.c @@ -612,7 +612,6 @@ GAMECODE gameLoop(void) #ifdef DISP2D disp2DModeChange(); #endif - dispModeChange(); } } @@ -664,7 +663,6 @@ GAMECODE gameLoop(void) #ifdef DISP2D disp2DModeChange(); #endif - dispModeChange(); } return GAMECODE_QUITGAME; } diff --git a/src/mission.c b/src/mission.c index 4664a391e..848c57e89 100644 --- a/src/mission.c +++ b/src/mission.c @@ -322,10 +322,10 @@ BOOL missionLimboExpand(void) } -//mission initialisation game code +// mission initialisation game code void initMission(void) { - UDWORD inc; + UDWORD inc; debug( LOG_NEVER, "***Init Mission ***\n" ); //mission.type = MISSION_NONE; diff --git a/src/wrappers.c b/src/wrappers.c index 44bdd0301..09009e608 100644 --- a/src/wrappers.c +++ b/src/wrappers.c @@ -93,7 +93,6 @@ STAR stars[30]; // quick hack for loading stuff extern int WFont; extern BOOL bLoadSaveUp; -static BOOL firstcall; static UDWORD loadScreenCallNo=0; static BOOL bPlayerHasLost = FALSE; static BOOL bPlayerHasWon = FALSE; @@ -121,11 +120,8 @@ UDWORD i; // BOOL frontendInitVars(void) { - firstcall = TRUE; - initStars(); - return TRUE; } @@ -133,20 +129,22 @@ BOOL frontendInitVars(void) // Main Front end game loop. TITLECODE titleLoop(void) { + static BOOL firstcall = TRUE; TITLECODE RetCode = TITLECODE_CONTINUE; pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON); pie_SetFogStatus(FALSE); screen_RestartBackDrop(); - if (firstcall) { - startTitleMenu(); - titleMode = TITLE; + if (firstcall) + { firstcall = FALSE; - frameSetCursorFromRes(IDC_DEFAULT); // reset cursor (sw) + changeTitleMode(TITLE); - if(NetPlay.bLobbyLaunched) // lobbies skip title screens & go into the game + frameSetCursorFromRes(IDC_DEFAULT); // reset cursor (sw) + + if(NetPlay.bLobbyLaunched) // lobbies skip title screens & go into the game { if (NetPlay.bHost) { @@ -156,7 +154,6 @@ TITLECODE titleLoop(void) { ingame.bHostSetup = FALSE; } - changeTitleMode(QUIT); } } @@ -229,16 +226,13 @@ TITLECODE titleLoop(void) runGameOptions3Menu(); break; - case QUIT: RetCode = TITLECODE_QUITGAME; break; case STARTGAME: case LOADSAVEGAME: - initLoadingScreen(TRUE);//render active - if (titleMode == LOADSAVEGAME) { RetCode = TITLECODE_SAVEGAMELOAD; @@ -247,12 +241,9 @@ TITLECODE titleLoop(void) { RetCode = TITLECODE_STARTGAME; } - return RetCode; // don't flip! - break; case SHOWINTRO: - pie_SetFogStatus(FALSE); pie_ScreenFlip(CLEAR_BLACK);//flip to clear screen but not here//reshow intro video. pie_ScreenFlip(CLEAR_BLACK);//flip to clear screen but not here @@ -377,14 +368,13 @@ void startCreditsScreen(void) } /* This function does nothing - since it's already been drawn */ -void runCreditsScreen( void ) +void runCreditsScreen( void ) { // Check for key presses now. - if(keyReleased(KEY_ESC) + if( keyReleased(KEY_ESC) || keyReleased(KEY_SPACE) || mouseReleased(MOUSE_LMB) - || (gameTime-lastChange > 4000) - ) + || gameTime-lastChange > 4000 ) { lastChange = gameTime; changeTitleMode(QUIT);