From b8c4065e154b48643b57261223e4d8bd6dda3ffe Mon Sep 17 00:00:00 2001 From: Gerard Krol Date: Wed, 4 Apr 2007 11:17:48 +0000 Subject: [PATCH] 1. Fix an assert when winning or losing a skirmish game. 2. Remove some debug messages 3. Now display the mission result screen on the end of a skirmish/multiplayer game. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1359 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/intelmap.c | 18 ++++++++++++------ src/keymap.c | 3 --- src/mission.c | 16 ++++------------ src/scriptfuncs.c | 7 +++++-- src/wrappers.c | 3 +++ 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/intelmap.c b/src/intelmap.c index e751542b5..5f23ab949 100644 --- a/src/intelmap.c +++ b/src/intelmap.c @@ -1054,6 +1054,12 @@ void intIntelButtonPressed(BOOL proxMsg, UDWORD id) ASSERT( proxMsg != TRUE, "intIntelButtonPressed: Shouldn't be able to get a proximity message!" ); + if(id == 0) + { + intRemoveIntelMap(); + return; + } + /* message button has been pressed - clear the old button and messageView*/ if (messageID != 0) { @@ -1257,12 +1263,12 @@ void intRemoveIntelMap(void) // Start the window close animation. Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_FORM); - - ASSERT(Form != NULL, "intRemoveIntelMap: Form is NULL"); - - Form->display = intClosePlainForm; - Form->disableChildren = TRUE; - Form->pUserData = (void*)0; // Used to signal when the close anim has finished. + if(Form) + { + Form->display = intClosePlainForm; + Form->disableChildren = TRUE; + Form->pUserData = (void*)0; // Used to signal when the close anim has finished. + } ClosingIntelMap = TRUE; //remove the text label widgDelete(psWScreen, IDINTMAP_PAUSELABEL); diff --git a/src/keymap.c b/src/keymap.c index 4f042ccb0..9919304d9 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -956,7 +956,6 @@ UDWORD i; { if(keyPressed(i)) { - debug(LOG_WARNING, "%i pressed (KEY_Q: %i, KEY_P: %i)", i, KEY_Q, KEY_P); return(i); // top row key pressed } } @@ -965,7 +964,6 @@ UDWORD i; { if(keyPressed(i)) { - debug(LOG_WARNING, "%i pressed (KEY_A: %i, KEY_L: %i)", i, KEY_A, KEY_L); return(i); // middle row key pressed } } @@ -974,7 +972,6 @@ UDWORD i; { if(keyPressed(i)) { - debug(LOG_WARNING, "%i pressed (KEY_Z: %i, KEY_M: %i)", i, KEY_Z, KEY_M); return(i); // bottomw row key pressed } } diff --git a/src/mission.c b/src/mission.c index 3e5af18d3..bcb331469 100644 --- a/src/mission.c +++ b/src/mission.c @@ -3371,12 +3371,12 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess) sButInit.pTip = NULL; sButInit.pDisplay = displayTextOption; //if won or in debug mode - if(result || getDebugMappingStatus()) + if(result || getDebugMappingStatus() || bMultiPlayer) { //continue sButInit.x = MISSION_2_X; // Won the game, so display "Quit to main menu" - if(testPlayerHasWon()) + if(testPlayerHasWon() && !bMultiPlayer) { sButInit.id = IDMISSIONRES_QUIT; sButInit.y = MISSION_2_Y-8; @@ -3397,7 +3397,7 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess) /* Only add save option if in the game for real, ie, not fastplay. And the player hasn't just completed the whole game Don't add save option if just lost and in debug mode*/ - if (!testPlayerHasWon() && !(testPlayerHasLost() && getDebugMappingStatus())) + if (!bMultiPlayer && !testPlayerHasWon() && !(testPlayerHasLost() && getDebugMappingStatus())) { //save sButInit.id = IDMISSIONRES_SAVE; @@ -3534,18 +3534,10 @@ static void missionContineButtonPressed( void ) }*/ // intRemoveMissionResultNoAnim(); - - //just being paranoid here - definately don't want this in the final build -#ifdef DEBUG - //in the final build we won't be able to get here beciase the CONTINUE button will not be available - //if we're in debug mode and we've lost it is preferred if we just return to the game - if (getDebugMappingStatus() && testPlayerHasLost()) + if (bMultiPlayer) { intRemoveMissionResultNoAnim(); } -#endif - - } void intProcessMissionResult(UDWORD id) diff --git a/src/scriptfuncs.c b/src/scriptfuncs.c index 3a61f2995..4e28583ad 100644 --- a/src/scriptfuncs.c +++ b/src/scriptfuncs.c @@ -3244,6 +3244,8 @@ BOOL scrGameOverMessage(void) return FALSE; } + // stop the game time?? + //create the message psMessage = addMessage(msgType, FALSE, player); @@ -3267,8 +3269,9 @@ BOOL scrGameOverMessage(void) }*/ } - //this now called when the video Quit is processed - //displayGameOver(gameOver); + // this should be called when the video Quit is processed + // not always is tough, so better be sure + displayGameOver(gameOver); return TRUE; } diff --git a/src/wrappers.c b/src/wrappers.c index ab5032a55..c4a5da900 100644 --- a/src/wrappers.c +++ b/src/wrappers.c @@ -425,6 +425,7 @@ BOOL displayGameOver(BOOL bDidit) // this bit decides whether to auto quit to front end. //if(!getDebugMappingStatus()) + if(!bMultiPlayer) { if(bDidit) { @@ -446,6 +447,8 @@ BOOL displayGameOver(BOOL bDidit) else { updateMultiStatsLoses(); + clearMissionWidgets(); + intAddMissionResult(bDidit, TRUE); } }