From b39954aee77deb66e5cdd2fe59d553e193c6bfd9 Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 3 Mar 2014 21:03:36 +0000 Subject: [PATCH] Merged revision(s) 7018 from branches/ja2_source_official_2014: - Fix: reloading while mercs are exiting the helicopter could lock the gamescreen.cpp - Fix: helicopter airdrop could lock up if mercs were in a bad animation - Fix: wrong battle report texts used git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7019 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/CampaignHistory_Summary.cpp | 8 ++++---- Strategic/Map Screen Helicopter.cpp | 2 +- Tactical/Merc Entering.cpp | 4 ++++ gamescreen.cpp | 6 +++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Laptop/CampaignHistory_Summary.cpp b/Laptop/CampaignHistory_Summary.cpp index 4787e1a7..1ccc8747 100644 --- a/Laptop/CampaignHistory_Summary.cpp +++ b/Laptop/CampaignHistory_Summary.cpp @@ -793,9 +793,9 @@ void RenderCampaignHistory_MostImportant() UINT16 armysize = max(1, incident.usParticipants[CAMPAIGNHISTORY_SD_ENEMY_ADMIN] + incident.usParticipants[CAMPAIGNHISTORY_SD_ENEMY_ARMY] + incident.usParticipants[CAMPAIGNHISTORY_SD_ENEMY_ELITE] + incident.usParticipants[CAMPAIGNHISTORY_SD_ENEMY_TANK]); // if rebels won... - if ( incident.usIncidentFlags & INCIDENT_WIN ) + if ( incident.usIncidentFlags & INCIDENT_WIN && rebelsize ) { - FLOAT ratio = (FLOAT)(rebellosses / rebelsize); + FLOAT ratio = (FLOAT)(rebellosses) / (FLOAT)(rebelsize); if ( ratio < 0.1 ) swprintf(sText, szCampaignHistoryResultString[TEXT_CAMPAIGNHISTORY_RESULT_ONESIDED_REBEL] ); else if ( ratio < 0.3 ) @@ -815,9 +815,9 @@ void RenderCampaignHistory_MostImportant() else swprintf(sText, szCampaignHistoryResultString[TEXT_CAMPAIGNHISTORY_RESULT_HARD_REBEL] ); } - else // army won... + else if ( armysize ) // army won... { - FLOAT ratio = (FLOAT)(armylosses / armysize); + FLOAT ratio = (FLOAT)(armylosses) / (FLOAT)(armysize); BOOLEAN armyhadmore = (armysize > rebelsize); if ( ratio < 0.1 ) diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index e013718c..b6892485 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -1661,7 +1661,7 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( INT8 bNewSquad ) } // go through list of everyone in helicopter - for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) + for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iHelicopterVehicleId ].ubVehicleType ].iNewSeatingCapacities; ++iCounter ) { // get passenger pSoldier = pVehicleList[ iHelicopterVehicleId ].pPassengers[ iCounter ]; diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index c49b3009..d1c029ee 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -672,6 +672,10 @@ void HandleHeliDrop( ) // OK, Check if we have anybody left to send! if ( gbCurDrop < bEndVal ) { + // Flugente: it is now possible to use airdrops with soldiers after they have arrived in Arulco. In that case, they might have an animation that breaks EVENT_InitNewSoldierAnim prematurely. + // In the worst case, this can cause the game to be unable to finsih the airdrop. For that reason, we set all those soldier to the STANDING aniamtion. + MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING; + //sWorldX = CenterX( gsGridNoSweetSpot ); //sWorldY = CenterY( gsGridNoSweetSpot ); MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE ); diff --git a/gamescreen.cpp b/gamescreen.cpp index e91bfd15..566dcc78 100644 --- a/gamescreen.cpp +++ b/gamescreen.cpp @@ -634,10 +634,14 @@ UINT32 MainGameScreenHandle(void) } #else InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE ); -#endif +#endif + // Flugente: we might have reloaded the game, so we are currently not dropping mercs out of a helicopter + gfIngagedInDrop = FALSE; + // Start heli Run... StartHelicopterRun(); + // Update clock by one so that our DidGameJustStatrt() returns now false for things like LAPTOP, etc... SetGameTimeCompressionLevel( TIME_COMPRESS_X1 ); //UpdateClock( 1 );