mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Fixed appearance of save game corruption when a game with different inventory set is loaded. Note that such games can still cause odd behavior and CTD's
Fixed old-style behavior when creating a soldier struct (caused memory corruption and leaks) Fixed soldiers unable to fire if an error happened while firing the off-hand weapon Fix animation system problems with soldiers interrupted while changing stance, such as twitching and not being able to navigate around obstacles Prevent splitting money while an item is in the hand, which would result in losing the original item Fix reverse of X,Y when checking visibility through a roof, which could make soldiers falsely visible/invisible Prevent militia from simply waiting on the border when enemies are known to be in the sector Fix stack overflow for soldier inventory debug display Optimized A* pathing and cleaned up VS2K5 specific code AI can now use all climb points for climbable buildings, not just a random few Fix to not allow flat roof butted against slanted roof to be identified as a climb point Prevent soldiers who cause an interrupt from a special action from continuing on their path after being interrupted Prevent soldiers who enter or leave deep water from moving a space too far and turning back Prevent soldiers from trying to crouch while in shallow water Make soldier turn in the closest direction when he must get up from prone and turn then fall back to prone Allow a soldier to swat for a tile before returning to prone if unable to return to prone immediately after a turn Fix civilians that should show up in a sector, missing because of others that aren't Fix a memset on a C++ class Place Skyrider in a sector near his helecopter once available and the helicopter is present Fix soldier corruption if too many shots burst-spread into too few tiles Include both first and last tile in spread when some locations must be skipped Fix to shoot at last location in burst Fix to remove other previous spread locations when calculating a new spread Fix to reload or rechamber off-hand when necessary, such as having a pistol shotgun in that hand git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1532 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+280
-270
@@ -1,51 +1,51 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Tactical All.h"
|
||||
#include "Tactical All.h"
|
||||
#else
|
||||
#include "builddefines.h"
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include "builddefines.h"
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "strategicmap.h"
|
||||
#include "overhead.h"
|
||||
#include "isometric utils.h"
|
||||
#include "strategicmap.h"
|
||||
#include "overhead.h"
|
||||
#include "isometric utils.h"
|
||||
|
||||
#include "soldier add.h"
|
||||
#include "soldier create.h"
|
||||
#include "Soldier Init List.h"
|
||||
#include "debug.h"
|
||||
#include "Random.h"
|
||||
#include "items.h"
|
||||
#include "soldier add.h"
|
||||
#include "soldier create.h"
|
||||
#include "Soldier Init List.h"
|
||||
#include "debug.h"
|
||||
#include "Random.h"
|
||||
#include "items.h"
|
||||
|
||||
#include "cursors.h"
|
||||
#include "cursors.h"
|
||||
|
||||
#include "Map Information.h"
|
||||
#include "soldier profile.h"
|
||||
#include "Sys Globals.h"
|
||||
#include "EditorMercs.h"
|
||||
#include "Animation Data.h"
|
||||
#include "message.h"
|
||||
#include "Font Control.h"
|
||||
#include "Sound Control.h"
|
||||
#include "Quests.h"
|
||||
#include "Render Fun.h"
|
||||
#include "meanwhile.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "mapscreen.h"
|
||||
#include "Debug Control.h"
|
||||
#include "Inventory Choosing.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "strategic.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "ai.h"
|
||||
#include "NPC.h"
|
||||
#include "Scheduling.h"
|
||||
#include "opplist.h"
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "screenids.h"
|
||||
#include "SaveLoadScreen.h"
|
||||
#include "Rotting Corpses.h"
|
||||
#include "Map Information.h"
|
||||
#include "soldier profile.h"
|
||||
#include "Sys Globals.h"
|
||||
#include "EditorMercs.h"
|
||||
#include "Animation Data.h"
|
||||
#include "message.h"
|
||||
#include "Font Control.h"
|
||||
#include "Sound Control.h"
|
||||
#include "Quests.h"
|
||||
#include "Render Fun.h"
|
||||
#include "meanwhile.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "mapscreen.h"
|
||||
#include "Debug Control.h"
|
||||
#include "Inventory Choosing.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "strategic.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "ai.h"
|
||||
#include "NPC.h"
|
||||
#include "Scheduling.h"
|
||||
#include "opplist.h"
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "screenids.h"
|
||||
#include "SaveLoadScreen.h"
|
||||
#include "Rotting Corpses.h"
|
||||
#endif
|
||||
|
||||
#include "Map Edgepoints.h"
|
||||
@@ -58,8 +58,8 @@ SOLDIERINITNODE *gOriginalSoldierInitListHead = NULL;
|
||||
SOLDIERINITNODE *gAlternateSoldierInitListHead = NULL;
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode );
|
||||
BOOLEAN gfDoDialogOnceGameScreenFadesIn = FALSE;
|
||||
BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode );
|
||||
BOOLEAN gfDoDialogOnceGameScreenFadesIn = FALSE;
|
||||
#endif
|
||||
|
||||
UINT32 CountNumberOfNodesWithSoldiers()
|
||||
@@ -83,14 +83,14 @@ void SortSoldierInitList();
|
||||
void InitSoldierInitList()
|
||||
{
|
||||
if( gSoldierInitHead )
|
||||
KillSoldierInitList();
|
||||
KillSoldierInitList();
|
||||
gSoldierInitHead = NULL;
|
||||
gSoldierInitTail = NULL;
|
||||
}
|
||||
|
||||
void KillSoldierInitList()
|
||||
{
|
||||
while( gSoldierInitHead )
|
||||
while( gSoldierInitHead )
|
||||
RemoveSoldierNodeFromInitList( gSoldierInitTail );
|
||||
if( gfOriginalList )
|
||||
gOriginalSoldierInitListHead = NULL;
|
||||
@@ -206,7 +206,7 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp )
|
||||
UINT32 i;
|
||||
UINT32 uiBytesWritten;
|
||||
SOLDIERINITNODE *curr;
|
||||
|
||||
|
||||
if( !fp )
|
||||
return FALSE;
|
||||
|
||||
@@ -220,11 +220,11 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp )
|
||||
//mode, and kill them all, while replacing them with the proper ones. Not only that, the alternate
|
||||
//editing mode is turned off, and if intentions are to play the game, the user will be facing many
|
||||
//enemies!
|
||||
#ifdef JA2EDITOR
|
||||
if( !gfOriginalList )
|
||||
ResetAllMercPositions();
|
||||
#endif
|
||||
|
||||
#ifdef JA2EDITOR
|
||||
if( !gfOriginalList )
|
||||
ResetAllMercPositions();
|
||||
#endif
|
||||
|
||||
curr = gSoldierInitHead;
|
||||
for( i=0; i < gMapInformation.ubNumIndividuals; i++ )
|
||||
{
|
||||
@@ -237,7 +237,7 @@ BOOLEAN SaveSoldiersToMap( HWFILE fp )
|
||||
{
|
||||
if( !curr->pDetailedPlacement )
|
||||
return FALSE;
|
||||
// WDS - Clean up inventory handling
|
||||
// WDS - Clean up inventory handling
|
||||
curr->pDetailedPlacement->CopyNewInventoryToOld();
|
||||
FileWrite( fp, curr->pDetailedPlacement, SIZEOF_SOLDIERCREATE_STRUCT_POD /*SIZEOF_SOLDIERCREATE_STRUCT*/, &uiBytesWritten );
|
||||
}
|
||||
@@ -263,7 +263,7 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer )
|
||||
KillSoldierInitList();
|
||||
UseEditorOriginalList();
|
||||
KillSoldierInitList();
|
||||
|
||||
|
||||
InitSoldierInitList();
|
||||
|
||||
if( ubNumIndividuals > MAX_INDIVIDUALS )
|
||||
@@ -275,7 +275,7 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer )
|
||||
{
|
||||
return TRUE; //no mercs
|
||||
}
|
||||
|
||||
|
||||
//Because we are loading the map, we needed to know how many
|
||||
//guys are being loaded, but when we add them to the list here, it
|
||||
//automatically increments that number, effectively doubling it, which
|
||||
@@ -295,7 +295,7 @@ BOOLEAN LoadSoldiersFromMap( INT8 **hBuffer )
|
||||
}
|
||||
if( tempBasicPlacement.fDetailedPlacement )
|
||||
{ //Add the static detailed placement information in the same newly created node as the basic placement.
|
||||
// WDS - Clean up inventory handling
|
||||
// WDS - Clean up inventory handling
|
||||
tempDetailedPlacement.initialize();
|
||||
//read static detailed placement from file
|
||||
LOADDATA( &tempDetailedPlacement, *hBuffer, SIZEOF_SOLDIERCREATE_STRUCT_POD );
|
||||
@@ -553,7 +553,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
}
|
||||
//else
|
||||
//{
|
||||
//break;
|
||||
//break;
|
||||
//}
|
||||
} while (pCorpse);
|
||||
}
|
||||
@@ -567,13 +567,13 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
if( ubProfile != NO_PROFILE && !gfEditMode )
|
||||
{
|
||||
if( gMercProfiles[ ubProfile ].sSectorX != gWorldSectorX ||
|
||||
gMercProfiles[ ubProfile ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ ubProfile ].bSectorZ != gbWorldSectorZ ||
|
||||
gMercProfiles[ ubProfile ].ubMiscFlags & (PROFILE_MISC_FLAG_RECRUITED | PROFILE_MISC_FLAG_EPCACTIVE) ||
|
||||
// gMercProfiles[ ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ||
|
||||
!gMercProfiles[ ubProfile ].bLife ||
|
||||
gMercProfiles[ ubProfile ].fUseProfileInsertionInfo
|
||||
)
|
||||
gMercProfiles[ ubProfile ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ ubProfile ].bSectorZ != gbWorldSectorZ ||
|
||||
gMercProfiles[ ubProfile ].ubMiscFlags & (PROFILE_MISC_FLAG_RECRUITED | PROFILE_MISC_FLAG_EPCACTIVE) ||
|
||||
// gMercProfiles[ ubProfile ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ||
|
||||
!gMercProfiles[ ubProfile ].bLife ||
|
||||
gMercProfiles[ ubProfile ].fUseProfileInsertionInfo
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -587,8 +587,8 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
if( curr->pDetailedPlacement->bBodyType == ICECREAMTRUCK )
|
||||
{ //Check to see if Hamous is here and not recruited. If so, add truck
|
||||
if( gMercProfiles[ HAMOUS ].sSectorX != gWorldSectorX ||
|
||||
gMercProfiles[ HAMOUS ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ HAMOUS ].bSectorZ )
|
||||
gMercProfiles[ HAMOUS ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ HAMOUS ].bSectorZ )
|
||||
{ //not here, so don't add
|
||||
return TRUE;
|
||||
}
|
||||
@@ -632,15 +632,15 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
|
||||
switch( PreRandom( 3 ) )
|
||||
{
|
||||
case 0:
|
||||
tempDetailedPlacement.bOrders = ONGUARD;
|
||||
break;
|
||||
case 1:
|
||||
tempDetailedPlacement.bOrders = CLOSEPATROL;
|
||||
break;
|
||||
case 2:
|
||||
tempDetailedPlacement.bOrders = ONCALL;
|
||||
break;
|
||||
case 0:
|
||||
tempDetailedPlacement.bOrders = ONGUARD;
|
||||
break;
|
||||
case 1:
|
||||
tempDetailedPlacement.bOrders = CLOSEPATROL;
|
||||
break;
|
||||
case 2:
|
||||
tempDetailedPlacement.bOrders = ONCALL;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -707,7 +707,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are
|
||||
//adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting
|
||||
//the associated facts are done elsewhere. There is also another place where NPCs can get added, which
|
||||
@@ -776,7 +776,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum )
|
||||
UINT8 ubSlotsToFill;
|
||||
UINT8 ubSlotsAvailable;
|
||||
SOLDIERINITNODE *curr;
|
||||
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListTeamToWorld"));
|
||||
//Sort the list in the following manner:
|
||||
//-Priority placements first
|
||||
@@ -857,6 +857,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum )
|
||||
if( AddPlacementToWorld( curr ) )
|
||||
{
|
||||
ubNumAdded++;
|
||||
ubSlotsToFill--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -864,9 +865,17 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum )
|
||||
//engine are already full. Besides, the strategic AI shouldn't be trying to fill a map with
|
||||
//more than the maximum allowable soldiers of team. All teams can have a max of 32 individuals,
|
||||
//except for the player which is 20. Players aren't processed in this list anyway.
|
||||
return ubNumAdded;
|
||||
// 0verhaul: Bzzzzzzzttttt.... Wrong! Other reasons for a false return:
|
||||
// Profiled merc not in sector
|
||||
// Profiled merc is recruited
|
||||
// Profiled merc is escorted
|
||||
// Profiled merc is dead
|
||||
// Profiled merc needs to use profile insertion data instead of placement
|
||||
// None of these instances is a reason to give up on the rest of the placements.
|
||||
//return ubNumAdded;
|
||||
}
|
||||
ubSlotsToFill--;
|
||||
// 0verhaul: However, move this to the point of successful insertion!
|
||||
//ubSlotsToFill--;
|
||||
}
|
||||
ubSlotsAvailable--;
|
||||
//With the decrementing of the slot vars in this manner, the chances increase so that all slots
|
||||
@@ -884,7 +893,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
INT32 iRandom;
|
||||
UINT8 ubMaxNum;
|
||||
INT8 bTeam = ENEMY_TEAM;
|
||||
UINT8 ubElitePDSlots = 0, ubEliteDSlots = 0, ubElitePSlots = 0, ubEliteBSlots = 0;
|
||||
UINT8 ubElitePDSlots = 0, ubEliteDSlots = 0, ubElitePSlots = 0, ubEliteBSlots = 0;
|
||||
UINT8 ubTroopPDSlots = 0, ubTroopDSlots = 0, ubTroopPSlots = 0, ubTroopBSlots = 0;
|
||||
UINT8 ubAdminPDSlots = 0, ubAdminDSlots = 0, ubAdminPSlots = 0, ubAdminBSlots = 0;
|
||||
UINT8 ubFreeSlots;
|
||||
@@ -898,13 +907,13 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
|
||||
//Specs call for only one profiled enemy can be in a sector at a time due to flavor reasons.
|
||||
gfProfiledEnemyAdded = FALSE;
|
||||
|
||||
|
||||
//Because the enemy defence forces work differently than the regular map placements, the numbers
|
||||
//of each type of enemy may not be the same. Elites will choose the best placements, then army, then
|
||||
//administrators.
|
||||
|
||||
ubMaxNum = ubTotalAdmin + ubTotalTroops + ubTotalElite;
|
||||
|
||||
|
||||
//Sort the list in the following manner:
|
||||
//-Priority placements first
|
||||
//-Basic placements next
|
||||
@@ -921,36 +930,36 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
{
|
||||
switch( curr->pBasicPlacement->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubElitePDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubElitePSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubEliteDSlots++;
|
||||
else
|
||||
ubEliteBSlots++;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubAdminPDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubAdminPSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubAdminDSlots++;
|
||||
else
|
||||
ubAdminBSlots++;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubTroopPDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubTroopPSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubTroopDSlots++;
|
||||
else
|
||||
ubTroopBSlots++;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubElitePDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubElitePSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubEliteDSlots++;
|
||||
else
|
||||
ubEliteBSlots++;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubAdminPDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubAdminPSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubAdminDSlots++;
|
||||
else
|
||||
ubAdminBSlots++;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement )
|
||||
ubTroopPDSlots++;
|
||||
else if( curr->pBasicPlacement->fPriorityExistance )
|
||||
ubTroopPSlots++;
|
||||
else if( curr->pDetailedPlacement )
|
||||
ubTroopDSlots++;
|
||||
else
|
||||
ubTroopBSlots++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
@@ -964,23 +973,23 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
//First, prepare the counters.
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminPDSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubElitePDSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopPDSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminPDSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubElitePDSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopPDSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
}
|
||||
//Now, loop through the priority existance and detailed placement section of the list.
|
||||
curr = gSoldierInitHead;
|
||||
while( curr && ubMaxNum && *pCurrTotal && *pCurrSlots &&
|
||||
curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance )
|
||||
curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance )
|
||||
{
|
||||
if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
@@ -1020,23 +1029,23 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
//First, prepare the counters.
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminPSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubElitePSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopPSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminPSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubElitePSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopPSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
}
|
||||
//Now, loop through the priority existance and non detailed placement section of the list.
|
||||
curr = mark;
|
||||
while( curr && ubMaxNum && *pCurrTotal && *pCurrSlots &&
|
||||
!curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance )
|
||||
!curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance )
|
||||
{
|
||||
if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
@@ -1067,7 +1076,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
while( curr && !curr->pDetailedPlacement && curr->pBasicPlacement->fPriorityExistance )
|
||||
curr = curr->next;
|
||||
mark = curr;
|
||||
|
||||
|
||||
//ADD PLACEMENTS WITH NO DETAILED PLACEMENT AND PRIORITY EXISTANCE INFORMATION SECOND
|
||||
//we now have the numbers of available slots for each soldier class, so loop through three times
|
||||
//and randomly choose some (or all) of the matching slots to fill. This is done randomly.
|
||||
@@ -1076,23 +1085,23 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
//First, prepare the counters.
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminDSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteDSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopDSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminDSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteDSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopDSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
}
|
||||
//Now, loop through the priority existance and detailed placement section of the list.
|
||||
curr = mark;
|
||||
while( curr && ubMaxNum && *pCurrTotal && *pCurrSlots &&
|
||||
curr->pDetailedPlacement && !curr->pBasicPlacement->fPriorityExistance )
|
||||
curr->pDetailedPlacement && !curr->pBasicPlacement->fPriorityExistance )
|
||||
{
|
||||
if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
@@ -1165,7 +1174,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
}
|
||||
if( !ubMaxNum )
|
||||
return;
|
||||
|
||||
|
||||
//ADD REMAINING PLACEMENTS WITH BASIC PLACEMENT INFORMATION
|
||||
//we now have the numbers of available slots for each soldier class, so loop through three times
|
||||
//and randomly choose some (or all) of the matching slots to fill. This is done randomly.
|
||||
@@ -1174,18 +1183,18 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
//First, prepare the counters.
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminBSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteBSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopBSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubAdminBSlots;
|
||||
pCurrTotal = &ubTotalAdmin;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteBSlots;
|
||||
pCurrTotal = &ubTotalElite;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubTroopBSlots;
|
||||
pCurrTotal = &ubTotalTroops;
|
||||
break;
|
||||
}
|
||||
//Now, loop through the regular basic placements section of the list.
|
||||
curr = mark;
|
||||
@@ -1266,9 +1275,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr
|
||||
/* DISABLE THE OVERRIDE FOR NOW...
|
||||
if( curr->pDetailedPlacement )
|
||||
{ //delete the detailed placement information.
|
||||
MemFree( curr->pDetailedPlacement );
|
||||
curr->pDetailedPlacement = NULL;
|
||||
curr->pBasicPlacement->fDetailedPlacement = FALSE;
|
||||
MemFree( curr->pDetailedPlacement );
|
||||
curr->pDetailedPlacement = NULL;
|
||||
curr->pBasicPlacement->fDetailedPlacement = FALSE;
|
||||
}
|
||||
*/
|
||||
if( AddPlacementToWorld( curr ) )
|
||||
@@ -1299,7 +1308,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
UINT8 ubMaxNum;
|
||||
BOOLEAN fDoPlacement;
|
||||
INT8 bTeam = ENEMY_TEAM;
|
||||
UINT8 ubEliteSlots = 0;
|
||||
UINT8 ubEliteSlots = 0;
|
||||
UINT8 ubRegSlots = 0;
|
||||
UINT8 ubGreenSlots = 0;
|
||||
UINT8 ubFreeSlots;
|
||||
@@ -1310,7 +1319,7 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListMilitia"));
|
||||
|
||||
ubMaxNum = ubNumGreen + ubNumRegs + ubNumElites;
|
||||
|
||||
|
||||
//Sort the list in the following manner:
|
||||
//-Priority placements first
|
||||
//-Basic placements next
|
||||
@@ -1380,9 +1389,9 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
{
|
||||
switch( curr->pBasicPlacement->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ELITE: ubEliteSlots++; break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: ubGreenSlots++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubRegSlots++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubEliteSlots++; break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: ubGreenSlots++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubRegSlots++; break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
@@ -1395,18 +1404,18 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
//First, prepare the counters.
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubGreenSlots;
|
||||
pCurrTotal = &ubNumGreen;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteSlots;
|
||||
pCurrTotal = &ubNumElites;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubRegSlots;
|
||||
pCurrTotal = &ubNumRegs;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
pCurrSlots = &ubGreenSlots;
|
||||
pCurrTotal = &ubNumGreen;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
pCurrSlots = &ubEliteSlots;
|
||||
pCurrTotal = &ubNumElites;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
pCurrSlots = &ubRegSlots;
|
||||
pCurrTotal = &ubNumRegs;
|
||||
break;
|
||||
}
|
||||
//Now, loop through the basic placement of the list.
|
||||
curr = mark; //mark is the marker where the basic placements start.
|
||||
@@ -1422,15 +1431,15 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
curr->pBasicPlacement->bOrders = STATIONARY;
|
||||
switch( ubCurrClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_GREEN_MILITIA;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_REG_MILITIA;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE_MILITIA;
|
||||
break;
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_GREEN_MILITIA;
|
||||
break;
|
||||
case SOLDIER_CLASS_ARMY:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_REG_MILITIA;
|
||||
break;
|
||||
case SOLDIER_CLASS_ELITE:
|
||||
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE_MILITIA;
|
||||
break;
|
||||
}
|
||||
//found matching team, so add this soldier to the game.
|
||||
if( AddPlacementToWorld( curr ) )
|
||||
@@ -1524,8 +1533,8 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
|
||||
}
|
||||
|
||||
void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants,
|
||||
UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales,
|
||||
UINT8 ubNumAdultFemales )
|
||||
UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales,
|
||||
UINT8 ubNumAdultFemales )
|
||||
{
|
||||
SOLDIERINITNODE *curr;
|
||||
INT32 iRandom;
|
||||
@@ -1556,9 +1565,9 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum
|
||||
}
|
||||
if( !fQueen )
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Couldn't place the queen." );
|
||||
#endif
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Couldn't place the queen." );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1622,7 +1631,7 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum
|
||||
{
|
||||
//Choose which team to use.
|
||||
iRandom = Random( ubNumCreatures );
|
||||
|
||||
|
||||
if( ubNumLarvae && iRandom < ubNumLarvae )
|
||||
{
|
||||
ubNumLarvae--;
|
||||
@@ -1839,7 +1848,7 @@ BOOLEAN LoadSoldierInitListLinks( HWFILE hfile )
|
||||
UINT32 uiNumBytesRead;
|
||||
SOLDIERINITNODE *curr;
|
||||
UINT8 ubSlots, ubSoldierID, ubNodeID;
|
||||
|
||||
|
||||
FileRead( hfile, &ubSlots, 1, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != 1 )
|
||||
{
|
||||
@@ -1867,9 +1876,9 @@ BOOLEAN LoadSoldierInitListLinks( HWFILE hfile )
|
||||
{
|
||||
curr->ubSoldierID = ubSoldierID;
|
||||
if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID ||
|
||||
ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID )
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID ||
|
||||
ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID )
|
||||
{ //only enemies and creatures.
|
||||
curr->pSoldier = MercPtrs[ ubSoldierID ];
|
||||
}
|
||||
@@ -1900,7 +1909,7 @@ void AddSoldierInitListBloodcats()
|
||||
{ //This map has no bloodcat placements, so don't waste CPU time.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( pSector->bBloodCatPlacements )
|
||||
{ //We don't yet know the number of bloodcat placements in this sector so
|
||||
//count them now, and permanently record it.
|
||||
@@ -1915,14 +1924,14 @@ void AddSoldierInitListBloodcats()
|
||||
curr = curr->next;
|
||||
}
|
||||
if( bBloodCatPlacements != pSector->bBloodCatPlacements &&
|
||||
ubSectorID != SEC_I16 && ubSectorID != SEC_N5 )
|
||||
ubSectorID != SEC_I16 && ubSectorID != SEC_N5 )
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
CHAR16 str[200];
|
||||
swprintf( str, L"Table specifies that there are %d bloodcat placements in sector %c%d, but the map actually has %d bloodcat placements. Map value takes precedence. KM,LC:1",
|
||||
pSector->bBloodCatPlacements, gWorldSectorY + 'A' - 1, gWorldSectorX, bBloodCatPlacements );
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
#endif
|
||||
#ifdef JA2BETAVERSION
|
||||
CHAR16 str[200];
|
||||
swprintf( str, L"Table specifies that there are %d bloodcat placements in sector %c%d, but the map actually has %d bloodcat placements. Map value takes precedence. KM,LC:1",
|
||||
pSector->bBloodCatPlacements, gWorldSectorY + 'A' - 1, gWorldSectorX, bBloodCatPlacements );
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
#endif
|
||||
pSector->bBloodCatPlacements = bBloodCatPlacements;
|
||||
pSector->bBloodCats = -1;
|
||||
if( !bBloodCatPlacements )
|
||||
@@ -1939,7 +1948,7 @@ void AddSoldierInitListBloodcats()
|
||||
UINT8 ubSlotsToFill;
|
||||
UINT8 ubSlotsAvailable;
|
||||
SOLDIERINITNODE *curr;
|
||||
|
||||
|
||||
//Sort the list in the following manner:
|
||||
//-Priority placements first
|
||||
//-Basic placements next
|
||||
@@ -2057,13 +2066,13 @@ void AddProfilesUsingProfileInsertionData()
|
||||
//Perform various checks to make sure the soldier is actually in the same sector, alive, and so on.
|
||||
//More importantly, the flag to use profile insertion data must be set.
|
||||
if( gMercProfiles[ i ].sSectorX != gWorldSectorX ||
|
||||
gMercProfiles[ i ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ i ].bSectorZ != gbWorldSectorZ ||
|
||||
gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ||
|
||||
gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE ||
|
||||
// gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ||
|
||||
!gMercProfiles[ i ].bLife ||
|
||||
!gMercProfiles[ i ].fUseProfileInsertionInfo
|
||||
gMercProfiles[ i ].sSectorY != gWorldSectorY ||
|
||||
gMercProfiles[ i ].bSectorZ != gbWorldSectorZ ||
|
||||
gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ||
|
||||
gMercProfiles[ i ].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE ||
|
||||
// gMercProfiles[ i ].ubMiscFlags2 & PROFILE_MISC_FLAG2_DONT_ADD_TO_SECTOR ||
|
||||
!gMercProfiles[ i ].bLife ||
|
||||
!gMercProfiles[ i ].fUseProfileInsertionInfo
|
||||
)
|
||||
{ //Don't add, so skip to the next soldier.
|
||||
continue;
|
||||
@@ -2075,7 +2084,8 @@ void AddProfilesUsingProfileInsertionData()
|
||||
UINT8 ubID;
|
||||
|
||||
//Set up the create struct so that we can properly create the profile soldier.
|
||||
memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
||||
// It's been C++'d, so don't do this!
|
||||
//memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
||||
MercCreateStruct.bTeam = CIV_TEAM;
|
||||
MercCreateStruct.ubProfile = (UINT8)i;
|
||||
MercCreateStruct.sSectorX = gWorldSectorX;
|
||||
@@ -2135,11 +2145,11 @@ void AddProfilesNotUsingProfileInsertionData()
|
||||
while( curr )
|
||||
{
|
||||
if( !curr->pSoldier &&
|
||||
curr->pBasicPlacement->bTeam == CIV_TEAM &&
|
||||
curr->pDetailedPlacement &&
|
||||
curr->pDetailedPlacement->ubProfile != NO_PROFILE &&
|
||||
!gMercProfiles[ curr->pDetailedPlacement->ubProfile ].fUseProfileInsertionInfo &&
|
||||
gMercProfiles[ curr->pDetailedPlacement->ubProfile ].bLife )
|
||||
curr->pBasicPlacement->bTeam == CIV_TEAM &&
|
||||
curr->pDetailedPlacement &&
|
||||
curr->pDetailedPlacement->ubProfile != NO_PROFILE &&
|
||||
!gMercProfiles[ curr->pDetailedPlacement->ubProfile ].fUseProfileInsertionInfo &&
|
||||
gMercProfiles[ curr->pDetailedPlacement->ubProfile ].bLife )
|
||||
{
|
||||
AddPlacementToWorld( curr );
|
||||
}
|
||||
@@ -2171,31 +2181,31 @@ BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode )
|
||||
{
|
||||
switch( ubCode )
|
||||
{
|
||||
case 1: //loading save
|
||||
swprintf( str, L"Error detected in save file WHILE LOADING. Please send save and text files associated with save to Kris and Dave."
|
||||
L" After doing so, go back into the game and immediately resave the game which will fix the problem."
|
||||
L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, str, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, ErrorDetectedInSaveCallback );
|
||||
break;
|
||||
case 2: //saving game
|
||||
//swprintf( str, L"Error detected WHILE SAVING file. Please send save and text files associated with save to Kris and Dave."
|
||||
// L" After doing so, go back into the game and try reloading the new save and saving it again which *could* fix the problem."
|
||||
// L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
//if( guiPreviousOptionScreen == MAP_SCREEN )
|
||||
// DoMapMessageBox( MSG_BOX_BASIC_STYLE, str, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
//else
|
||||
// DoMessageBox( MSG_BOX_BASIC_STYLE, str, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
break;
|
||||
case 3: //entering sector using temp files (before fade in)
|
||||
gfDoDialogOnceGameScreenFadesIn = TRUE;
|
||||
break;
|
||||
case 4: //after fade in
|
||||
gfDoDialogOnceGameScreenFadesIn = FALSE;
|
||||
swprintf( str, L"Error detected while entering sector USING TEMP FILES. Please send previous save and text files associated with save to Kris and Dave."
|
||||
L" After doing so, go back into the game and saving the game, reloading it, and saving it again *could* fix it."
|
||||
L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, str, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
break;
|
||||
case 1: //loading save
|
||||
swprintf( str, L"Error detected in save file WHILE LOADING. Please send save and text files associated with save to Kris and Dave."
|
||||
L" After doing so, go back into the game and immediately resave the game which will fix the problem."
|
||||
L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, str, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, ErrorDetectedInSaveCallback );
|
||||
break;
|
||||
case 2: //saving game
|
||||
//swprintf( str, L"Error detected WHILE SAVING file. Please send save and text files associated with save to Kris and Dave."
|
||||
// L" After doing so, go back into the game and try reloading the new save and saving it again which *could* fix the problem."
|
||||
// L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
//if( guiPreviousOptionScreen == MAP_SCREEN )
|
||||
// DoMapMessageBox( MSG_BOX_BASIC_STYLE, str, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
//else
|
||||
// DoMessageBox( MSG_BOX_BASIC_STYLE, str, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
break;
|
||||
case 3: //entering sector using temp files (before fade in)
|
||||
gfDoDialogOnceGameScreenFadesIn = TRUE;
|
||||
break;
|
||||
case 4: //after fade in
|
||||
gfDoDialogOnceGameScreenFadesIn = FALSE;
|
||||
swprintf( str, L"Error detected while entering sector USING TEMP FILES. Please send previous save and text files associated with save to Kris and Dave."
|
||||
L" After doing so, go back into the game and saving the game, reloading it, and saving it again *could* fix it."
|
||||
L" This is the bug responsible for mercs disappearing. Be prepared to answer lots of questions..." );
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, str, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2209,7 +2219,7 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile )
|
||||
UINT32 uiNumBytesRead;
|
||||
SOLDIERINITNODE *curr;
|
||||
UINT8 ubSlots, ubSoldierID, ubNodeID;
|
||||
|
||||
|
||||
FileRead( hfile, &ubSlots, 1, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != 1 )
|
||||
{
|
||||
@@ -2237,7 +2247,7 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile )
|
||||
{
|
||||
curr->ubSoldierID = ubSoldierID;
|
||||
if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID )
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID )
|
||||
{ //only enemies and creatures.
|
||||
curr->pSoldier = MercPtrs[ ubSoldierID ];
|
||||
}
|
||||
@@ -2255,7 +2265,7 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile )
|
||||
UINT32 uiNumBytesRead;
|
||||
SOLDIERINITNODE *curr;
|
||||
UINT8 ubSlots, ubSoldierID, ubNodeID;
|
||||
|
||||
|
||||
FileRead( hfile, &ubSlots, 1, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != 1 )
|
||||
{
|
||||
@@ -2283,7 +2293,7 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile )
|
||||
{
|
||||
curr->ubSoldierID = ubSoldierID;
|
||||
if( ubSoldierID >= gTacticalStatus.Team[ CIV_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID )
|
||||
ubSoldierID <= gTacticalStatus.Team[ CIV_TEAM ].bLastID )
|
||||
{ //only enemies and creatures.
|
||||
curr->pSoldier = MercPtrs[ ubSoldierID ];
|
||||
}
|
||||
@@ -2301,7 +2311,7 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile )
|
||||
UINT32 uiNumBytesRead;
|
||||
SOLDIERINITNODE *curr;
|
||||
UINT8 ubSlots, ubSoldierID, ubNodeID;
|
||||
|
||||
|
||||
FileRead( hfile, &ubSlots, 1, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != 1 )
|
||||
{
|
||||
@@ -2329,7 +2339,7 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile )
|
||||
{
|
||||
curr->ubSoldierID = ubSoldierID;
|
||||
if( ubSoldierID >= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID &&
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID )
|
||||
ubSoldierID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID )
|
||||
{ //only enemies and creatures.
|
||||
curr->pSoldier = MercPtrs[ ubSoldierID ];
|
||||
}
|
||||
@@ -2345,7 +2355,7 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated()
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
SOLDIERINITNODE *curr;
|
||||
|
||||
|
||||
if( !gfWorldLoaded || gbWorldSectorZ )
|
||||
{ //No world loaded or underground. Underground sectors don't matter
|
||||
//seeing enemies (not creatures) never rejuvenate underground.
|
||||
@@ -2407,15 +2417,15 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
|
||||
|
||||
switch( ubStrategicInsertionCode )
|
||||
{
|
||||
case INSERTION_CODE_NORTH: bDesiredDirection = SOUTHEAST; break;
|
||||
case INSERTION_CODE_EAST: bDesiredDirection = SOUTHWEST; break;
|
||||
case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break;
|
||||
case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break;
|
||||
default: AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" ); break;
|
||||
case INSERTION_CODE_NORTH: bDesiredDirection = SOUTHEAST; break;
|
||||
case INSERTION_CODE_EAST: bDesiredDirection = SOUTHWEST; break;
|
||||
case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break;
|
||||
case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break;
|
||||
default: AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" ); break;
|
||||
}
|
||||
#ifdef JA2TESTVERSION
|
||||
ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites );
|
||||
#endif
|
||||
#ifdef JA2TESTVERSION
|
||||
ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites );
|
||||
#endif
|
||||
|
||||
ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumGreen + ubNumReg + ubNumElites) );
|
||||
ubCurrSlot = 0;
|
||||
@@ -2448,7 +2458,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
|
||||
pSoldier->sNoiseGridno = (INT16)(CENTRAL_GRIDNO + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) + ( Random( CENTRAL_RADIUS * 2 + 1 ) - CENTRAL_RADIUS ) * WORLD_COLS);
|
||||
pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION;
|
||||
}
|
||||
|
||||
|
||||
//Setup the position
|
||||
if( ubCurrSlot < MapEdgepointInfo.ubNumPoints )
|
||||
{ //using an edgepoint
|
||||
@@ -2529,10 +2539,10 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
|
||||
pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION;
|
||||
}
|
||||
|
||||
// if ( GetTimeOfDayAmbientLightLevel() < NORMAL_LIGHTLEVEL_DAY + 2 )
|
||||
// gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition = TRUE;
|
||||
// gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = TRUE;
|
||||
|
||||
// if ( GetTimeOfDayAmbientLightLevel() < NORMAL_LIGHTLEVEL_DAY + 2 )
|
||||
// gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition = TRUE;
|
||||
// gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = TRUE;
|
||||
|
||||
//Setup the position
|
||||
if( ubCurrSlot < MapEdgepointInfo.ubNumPoints )
|
||||
{ //using an edgepoint
|
||||
|
||||
Reference in New Issue
Block a user