mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Little Alien
- Moved new game settings from ja2.ini to Ja2_Options.ini - Moved all settings from NewGameSettings.cpp to GameSettings.cpp - New feature: Militia movement on strategic map v1.3 - New feature: Automatic reload Press Shift+R in tactical to reload all weapons of your team with magazines from sector inventory git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@60 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -12,10 +12,12 @@
|
||||
#include "PreBattle Interface.h"
|
||||
#endif
|
||||
|
||||
#include "MilitiaSquads.h"
|
||||
|
||||
BOOLEAN gfStrategicMilitiaChangesMade = FALSE;
|
||||
|
||||
BOOLEAN fFirstClickInMilitiaControlScreenMask = FALSE;
|
||||
BOOLEAN gfMSResetMilitia = FALSE;
|
||||
|
||||
|
||||
// render pre battle interface?
|
||||
@@ -98,11 +100,19 @@ extern BOOLEAN SoldierCanAffordNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesired
|
||||
|
||||
void ResetMilitia()
|
||||
{
|
||||
if( gfStrategicMilitiaChangesMade || gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
|
||||
BOOLEAN fBattleInProgress = FALSE;
|
||||
|
||||
if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
fBattleInProgress = TRUE;
|
||||
|
||||
if( ( gfStrategicMilitiaChangesMade && !fBattleInProgress ) || gTacticalStatus.uiFlags & LOADING_SAVED_GAME || gfMSResetMilitia )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
RemoveMilitiaFromTactical();
|
||||
|
||||
if( !gfMSResetMilitia )
|
||||
RemoveMilitiaFromTactical();
|
||||
PrepareMilitiaForTactical();
|
||||
gfMSResetMilitia = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +141,7 @@ void RemoveMilitiaFromTactical()
|
||||
void PrepareMilitiaForTactical()
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
// INT32 i;
|
||||
INT32 x;
|
||||
UINT8 ubGreen, ubRegs, ubElites;
|
||||
if( gbWorldSectorZ > 0 )
|
||||
return;
|
||||
@@ -144,16 +154,27 @@ void PrepareMilitiaForTactical()
|
||||
ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
|
||||
ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
|
||||
ubElites = pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
AddSoldierInitListMilitia( ubGreen, ubRegs, ubElites );
|
||||
/*
|
||||
for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
|
||||
{
|
||||
if( MercPtrs[ i ]->bInSector )
|
||||
|
||||
if(guiDirNumber)
|
||||
for( x = 0 ; x < guiDirNumber ; ++x )
|
||||
{
|
||||
MercPtrs[ i ]->bAttitude = AGGRESSIVE;
|
||||
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] );
|
||||
if( gpAttackDirs[ x ][ 3 ] != INSERTION_CODE_CENTER )
|
||||
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
// AddSoldierInitListMilitia( gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
// else
|
||||
}
|
||||
}
|
||||
*/
|
||||
else AddSoldierInitListMilitia( ubGreen, ubRegs, ubElites );
|
||||
|
||||
// for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
|
||||
// {
|
||||
// if( MercPtrs[ i ]->bInSector )
|
||||
// {
|
||||
// MercPtrs[ i ]->bOrders = SEEKENEMY;
|
||||
//// MercPtrs[ i ]->bAttitude = AGGRESSIVE;
|
||||
// }
|
||||
// }
|
||||
guiDirNumber = 0;
|
||||
}
|
||||
|
||||
void HandleMilitiaPromotions( void )
|
||||
|
||||
@@ -186,7 +186,7 @@ enum
|
||||
|
||||
|
||||
// CHANGE THIS VALUE TO AFFECT TOTAL SIGHT RANGE
|
||||
#define STRAIGHT_RANGE ubStraightSightRange
|
||||
#define STRAIGHT_RANGE gGameExternalOptions.ubStraightSightRange
|
||||
|
||||
// CHANGE THESE VALUES TO ADJUST VARIOUS FOV ANGLES
|
||||
#define STRAIGHT_RATIO 1 //* 1.5
|
||||
|
||||
+23
-6
@@ -3832,6 +3832,7 @@ void MilitiaChangesSides( void )
|
||||
{
|
||||
if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife)
|
||||
{
|
||||
if ( (gWorldSectorX ==0 && gWorldSectorY == 0) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
MakeCivHostile( pSoldier, 2 );
|
||||
RecalculateOppCntsDueToNoLongerNeutral( pSoldier );
|
||||
}
|
||||
@@ -5457,7 +5458,8 @@ void EnterCombatMode( UINT8 ubStartingTeam )
|
||||
// OK, make sure we have a selected guy
|
||||
// Madd: this was causing a weird crash becuase gusSelectedSoldier was 156 (out of the array bounds) for some reason
|
||||
//if ( MercPtrs[ gusSelectedSoldier ]->bOppCnt == 0 )
|
||||
//{
|
||||
if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->bOppCnt == 0 )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected");
|
||||
// OK, look through and find one....
|
||||
for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ )
|
||||
@@ -5468,7 +5470,7 @@ void EnterCombatMode( UINT8 ubStartingTeam )
|
||||
SelectSoldier( pTeamSoldier->ubID, FALSE, TRUE );
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... calling startplayerteamturn");
|
||||
|
||||
StartPlayerTeamTurn( FALSE, TRUE );
|
||||
@@ -5903,7 +5905,13 @@ void DeathNoMessageTimerCallback( void )
|
||||
CheckAndHandleUnloadingOfCurrentWorld();
|
||||
}
|
||||
|
||||
void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
|
||||
|
||||
pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0;
|
||||
pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0;
|
||||
}
|
||||
|
||||
//!!!!
|
||||
//IMPORTANT NEW NOTE:
|
||||
@@ -5962,6 +5970,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
//It is possible to have more than 20 enemies in a sector. By failing here,
|
||||
//it gives the engine a chance to add these soldiers as reinforcements. This
|
||||
//is naturally handled.
|
||||
AddPossiblePendingEnemiesToBattle();
|
||||
if( gfPendingEnemies )
|
||||
{
|
||||
fBattleWon = FALSE;
|
||||
@@ -6043,6 +6052,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
}
|
||||
}
|
||||
|
||||
// Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info
|
||||
RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY );
|
||||
|
||||
|
||||
// If here, the battle has been won!
|
||||
// hurray! a glorious victory!
|
||||
|
||||
@@ -6168,6 +6181,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
ShouldBeginAutoBandage();
|
||||
}
|
||||
|
||||
HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap();
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
|
||||
|
||||
// Loop through all militia and restore them to peaceful status
|
||||
cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID;
|
||||
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++,pTeamSoldier++)
|
||||
@@ -6180,10 +6197,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
pTeamSoldier->ubNoiseVolume = 0;
|
||||
pTeamSoldier->bNewSituation = FALSE;
|
||||
pTeamSoldier->bOrders = STATIONARY;
|
||||
if ( pTeamSoldier->bLife >= OKLIFE )
|
||||
{
|
||||
pTeamSoldier->bBleeding = 0;
|
||||
}
|
||||
if ( pTeamSoldier->bLife < OKLIFE )
|
||||
pTeamSoldier->bLife = OKLIFE;
|
||||
|
||||
pTeamSoldier->bBleeding = 0; // let's think, the autobandage was done for the militia too
|
||||
}
|
||||
}
|
||||
gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition = FALSE;
|
||||
|
||||
+9
-2
@@ -84,7 +84,7 @@ UINT8 gubBuildingInfoToSet;
|
||||
|
||||
// STANDARD maximums... configurable!
|
||||
#define MAX_SKIPLIST_LEVEL 5
|
||||
#define MAX_TRAIL_TREE (4096)
|
||||
#define MAX_TRAIL_TREE (16384)//(4096)
|
||||
#define MAX_PATHQ (512)
|
||||
|
||||
INT32 iMaxSkipListLevel = MAX_SKIPLIST_LEVEL;
|
||||
@@ -150,7 +150,7 @@ static INT32 iSkipListLevelLimit[8] = {0, 4, 16, 64, 256, 1024, 4192, 16384 };
|
||||
//#define ESTIMATEC (((dx<dy) ? ( (TRAVELCOST_FLAT * dx * 14) / 10 + dy) : (TRAVELCOST_FLAT * dy * 14 ) / 10 + dx) ) )
|
||||
#define ESTIMATE ESTIMATEC
|
||||
|
||||
#define MAXCOST (9990)
|
||||
#define MAXCOST (16384)//(9990)
|
||||
//#define MAXCOST (255)
|
||||
//#define TOTALCOST( pCurrPtr ) (pCurrPtr->usCostSoFar + pCurrPtr->usCostToGo)
|
||||
#define TOTALCOST( ptr ) (ptr->usTotalCost)
|
||||
@@ -2127,12 +2127,19 @@ void GlobalItemsReachableTest( INT16 sStartGridNo1, INT16 sStartGridNo2 )
|
||||
void RoofReachableTest( INT16 sStartGridNo, UINT8 ubBuildingID )
|
||||
{
|
||||
SOLDIERTYPE s;
|
||||
INT16 sGridNo;
|
||||
|
||||
memset( &s, 0, sizeof( SOLDIERTYPE ) );
|
||||
s.sGridNo = sStartGridNo;
|
||||
s.bLevel = 1;
|
||||
s.bTeam = 1;
|
||||
|
||||
// clearing flags
|
||||
|
||||
for( sGridNo = 0 ; sGridNo < NOWHERE ; ++sGridNo )
|
||||
gpWorldLevelData[ sGridNo ].uiFlags &= (~MAPELEMENT_REACHABLE);
|
||||
|
||||
|
||||
gubBuildingInfoToSet = ubBuildingID;
|
||||
|
||||
ReconfigurePathAI( ABSMAX_SKIPLIST_LEVEL, ABSMAX_TRAIL_TREE, ABSMAX_PATHQ );
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ FLOAT fpMinDropSpeed = 0;
|
||||
|
||||
|
||||
extern UINT32 guiCurrentScreen;
|
||||
extern BOOLEAN gfAllowRain;
|
||||
//extern BOOLEAN gfAllowRain;
|
||||
|
||||
extern INT16 gsVIEWPORT_WINDOW_END_Y;
|
||||
extern INT16 gsVIEWPORT_WINDOW_START_Y;
|
||||
@@ -149,7 +149,7 @@ INT8 GetRainIntensityFromEnvWeather()
|
||||
|
||||
BOOLEAN IsItAllowedToRenderRain()
|
||||
{
|
||||
if( !gfAllowRain )return FALSE;
|
||||
if( !gGameExternalOptions.gfAllowRain )return FALSE;
|
||||
|
||||
if( !( guiEnvWeather & (WEATHER_FORECAST_THUNDERSHOWERS | WEATHER_FORECAST_SHOWERS) ) )return FALSE;
|
||||
|
||||
|
||||
@@ -86,14 +86,14 @@
|
||||
#endif
|
||||
|
||||
//turnspeed
|
||||
UINT8 gubPlayerTurnSpeedUpFactor = 1;
|
||||
UINT8 gubEnemyTurnSpeedUpFactor = 1;
|
||||
UINT8 gubCreatureTurnSpeedUpFactor = 1;
|
||||
UINT8 gubMilitiaTurnSpeedUpFactor = 1;
|
||||
UINT8 gubCivTurnSpeedUpFactor = 1;
|
||||
//UINT8 gubPlayerTurnSpeedUpFactor = 1;
|
||||
//UINT8 gubEnemyTurnSpeedUpFactor = 1;
|
||||
//UINT8 gubCreatureTurnSpeedUpFactor = 1;
|
||||
//UINT8 gubMilitiaTurnSpeedUpFactor = 1;
|
||||
//UINT8 gubCivTurnSpeedUpFactor = 1;
|
||||
//turnspeed
|
||||
|
||||
extern BOOLEAN fAllowTacticalMilitiaCommand; //lal
|
||||
//extern BOOLEAN fAllowTacticalMilitiaCommand; //lal
|
||||
|
||||
extern INT16 DirIncrementer[8];
|
||||
|
||||
@@ -5879,18 +5879,17 @@ UINT8 GetSpeedUpFactor( )
|
||||
switch( gTacticalStatus.ubCurrentTeam )
|
||||
{
|
||||
case OUR_TEAM:
|
||||
return gubPlayerTurnSpeedUpFactor;
|
||||
return gGameExternalOptions.gubPlayerTurnSpeedUpFactor;
|
||||
case ENEMY_TEAM:
|
||||
return gubEnemyTurnSpeedUpFactor;
|
||||
return gGameExternalOptions.gubEnemyTurnSpeedUpFactor;
|
||||
case CREATURE_TEAM:
|
||||
return gubCreatureTurnSpeedUpFactor;
|
||||
return gGameExternalOptions.gubCreatureTurnSpeedUpFactor;
|
||||
case MILITIA_TEAM:
|
||||
return gubMilitiaTurnSpeedUpFactor;
|
||||
return gGameExternalOptions.gubMilitiaTurnSpeedUpFactor;
|
||||
case CIV_TEAM:
|
||||
return gubCivTurnSpeedUpFactor;
|
||||
return gGameExternalOptions.gubCivTurnSpeedUpFactor;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -10822,7 +10821,7 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL
|
||||
if ( GetCivType( pTSoldier ) != CIV_TYPE_NA )
|
||||
{
|
||||
//lal
|
||||
if ( ( pTSoldier->bTeam == MILITIA_TEAM ) && ( fAllowTacticalMilitiaCommand == TRUE ) && (pSoldier->bSide == pTSoldier->bSide) )
|
||||
if ( ( pTSoldier->bTeam == MILITIA_TEAM ) && ( gGameExternalOptions.fAllowTacticalMilitiaCommand == TRUE ) && (pSoldier->bSide == pTSoldier->bSide) )
|
||||
{
|
||||
PopupMilitiaControlMenu( pTSoldier );
|
||||
return( FALSE );
|
||||
|
||||
@@ -2048,7 +2048,8 @@ SOLDIERTYPE* TacticalCreateAdministrator()
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
{
|
||||
return ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ADMINISTRATOR );
|
||||
pSoldier = ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ADMINISTRATOR );
|
||||
if( pSoldier ) return pSoldier;
|
||||
}
|
||||
|
||||
memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) );
|
||||
@@ -2081,7 +2082,8 @@ SOLDIERTYPE* TacticalCreateArmyTroop()
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
{
|
||||
return ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ARMY );
|
||||
pSoldier = ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ARMY );
|
||||
if( pSoldier ) return pSoldier;
|
||||
}
|
||||
|
||||
memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) );
|
||||
@@ -2114,7 +2116,8 @@ SOLDIERTYPE* TacticalCreateEliteEnemy()
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
{
|
||||
return ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ELITE );
|
||||
pSoldier = ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_ELITE );
|
||||
if( pSoldier ) return pSoldier;
|
||||
}
|
||||
|
||||
memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) );
|
||||
@@ -2146,11 +2149,53 @@ SOLDIERTYPE* TacticalCreateEliteEnemy()
|
||||
return( pSoldier );
|
||||
}
|
||||
|
||||
SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass )
|
||||
{
|
||||
INT32 i, iStart, iEnd;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
|
||||
// For description look original ReserveTacticalSoldierForAutoresolve()
|
||||
|
||||
iStart = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID;
|
||||
iEnd = gTacticalStatus.Team[ MILITIA_TEAM ].bLastID;
|
||||
|
||||
for( i = iStart; i <= iEnd; i++ )
|
||||
{
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->bLife && MercPtrs[ i ]->sGridNo != NOWHERE )
|
||||
{
|
||||
if( MercPtrs[ i ]->ubSoldierClass == ubSoldierClass )
|
||||
{
|
||||
//reserve this soldier
|
||||
MercPtrs[ i ]->sGridNo = NOWHERE;
|
||||
|
||||
//Allocate and copy the soldier
|
||||
pSoldier = (SOLDIERTYPE*)MemAlloc( sizeof( SOLDIERTYPE ) );
|
||||
if( !pSoldier )
|
||||
return NULL;
|
||||
memcpy( pSoldier, MercPtrs[ i ], sizeof( SOLDIERTYPE ) );
|
||||
|
||||
//Assign a bogus ID, then return it
|
||||
pSoldier->ubID = 255;
|
||||
return pSoldier;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass )
|
||||
{
|
||||
BASIC_SOLDIERCREATE_STRUCT bp;
|
||||
SOLDIERCREATE_STRUCT pp;
|
||||
UINT8 ubID;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
{
|
||||
pSoldier = ReserveTacticalMilitiaSoldierForAutoresolve( ubMilitiaClass );
|
||||
if( pSoldier ) return pSoldier;
|
||||
}
|
||||
|
||||
memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) );
|
||||
memset( &pp, 0, sizeof( SOLDIERCREATE_STRUCT ) );
|
||||
@@ -2171,10 +2216,12 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType )
|
||||
BASIC_SOLDIERCREATE_STRUCT bp;
|
||||
SOLDIERCREATE_STRUCT pp;
|
||||
UINT8 ubID;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
{
|
||||
return ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_CREATURE );
|
||||
pSoldier = ReserveTacticalSoldierForAutoresolve( SOLDIER_CLASS_CREATURE );
|
||||
if( pSoldier ) return pSoldier;
|
||||
}
|
||||
|
||||
memset( &bp, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) );
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Font Control.h"
|
||||
#endif
|
||||
|
||||
#include "Map Edgepoints.h"
|
||||
BOOLEAN gfOriginalList = TRUE;
|
||||
|
||||
SOLDIERINITNODE *gSoldierInitHead = NULL;
|
||||
@@ -2326,4 +2327,119 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated()
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
////////
|
||||
//////// For militia squad attack!
|
||||
////////
|
||||
|
||||
#define CENTRAL_GRIDNO 13202
|
||||
#define CENTRAL_RADIUS 30
|
||||
|
||||
void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites )
|
||||
{
|
||||
SOLDIERTYPE *pSoldier;
|
||||
MAPEDGEPOINTINFO MapEdgepointInfo;
|
||||
UINT8 ubCurrSlot;
|
||||
UINT8 ubTotalSoldiers;
|
||||
UINT8 bDesiredDirection=0;
|
||||
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;
|
||||
}
|
||||
#ifdef JA2TESTVERSION
|
||||
ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites );
|
||||
#endif
|
||||
|
||||
ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites;
|
||||
|
||||
ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumGreen + ubNumReg + ubNumElites) );
|
||||
ubCurrSlot = 0;
|
||||
while( ubTotalSoldiers )
|
||||
{
|
||||
if( ubNumElites && Random( ubTotalSoldiers ) < ubNumElites )
|
||||
{
|
||||
ubNumElites--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_ELITE_MILITIA);
|
||||
|
||||
pSoldier->bOrders = SEEKENEMY;
|
||||
pSoldier->ubInsertionDirection = bDesiredDirection;
|
||||
|
||||
pSoldier->bAlertStatus = STATUS_YELLOW;
|
||||
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
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
|
||||
}
|
||||
else
|
||||
{ //no edgepoints left, so put him at the entrypoint.
|
||||
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
|
||||
}
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||
}
|
||||
else if( ubNumReg && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg) )
|
||||
{
|
||||
ubNumReg--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_REG_MILITIA);
|
||||
|
||||
pSoldier->bOrders = SEEKENEMY;
|
||||
pSoldier->ubInsertionDirection = bDesiredDirection;
|
||||
|
||||
pSoldier->bAlertStatus = STATUS_YELLOW;
|
||||
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
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
|
||||
}
|
||||
else
|
||||
{ //no edgepoints left, so put him at the entrypoint.
|
||||
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
|
||||
}
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||
}
|
||||
else if( ubNumGreen && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg + ubNumGreen) )
|
||||
{
|
||||
ubNumGreen--;
|
||||
ubTotalSoldiers--;
|
||||
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_GREEN_MILITIA);
|
||||
|
||||
pSoldier->bOrders = SEEKENEMY;
|
||||
pSoldier->ubInsertionDirection = bDesiredDirection;
|
||||
|
||||
pSoldier->bAlertStatus = STATUS_YELLOW;
|
||||
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;
|
||||
|
||||
|
||||
// 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
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = MapEdgepointInfo.sGridNo[ ubCurrSlot++ ];
|
||||
}
|
||||
else
|
||||
{ //no edgepoints left, so put him at the entrypoint.
|
||||
pSoldier->ubStrategicInsertionCode = ubStrategicInsertionCode;
|
||||
}
|
||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum
|
||||
UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales,
|
||||
UINT8 ubNumAdultFemales );
|
||||
void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites );
|
||||
void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites );
|
||||
|
||||
void AddSoldierInitListBloodcats();
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "Soldier macros.h"
|
||||
#endif
|
||||
|
||||
#include "Reinforcement.h"
|
||||
|
||||
extern void DecayPublicOpplist( INT8 bTeam );
|
||||
|
||||
//not in overhead.h!
|
||||
@@ -170,6 +172,8 @@ void HandleTacticalEndTurn( )
|
||||
//Check for enemy pooling (add enemies if there happens to be more than the max in the
|
||||
//current battle. If one or more slots have freed up, we can add them now.
|
||||
AddPossiblePendingEnemiesToBattle();
|
||||
|
||||
AddPossiblePendingMilitiaToBattle();
|
||||
|
||||
// Loop through each active team and decay public opplist...
|
||||
// May want this done every few times too
|
||||
|
||||
@@ -43,6 +43,36 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "Reinforcement.h"
|
||||
|
||||
|
||||
//extern UINT8 gubSpeedUpAnimationFactor;
|
||||
void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void RecalculateSoldiersAniSpeed()
|
||||
{
|
||||
UINT32 uiLoop;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
|
||||
// if( gubSpeedUpAnimationFactor == 1 )return;
|
||||
|
||||
for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
|
||||
{
|
||||
pSoldier = MercSlots[ uiLoop ];
|
||||
|
||||
// if this merc is inactive, at base, on assignment, dead, unconscious
|
||||
if (!pSoldier)
|
||||
{
|
||||
continue; // next merc
|
||||
}
|
||||
|
||||
SetSoldierAniSpeed( pSoldier );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern void DecayPublicOpplist(INT8 bTeam);
|
||||
extern void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier);
|
||||
void EndInterrupt( BOOLEAN fMarkInterruptOccurred );
|
||||
@@ -257,6 +287,8 @@ void EndTurn( UINT8 ubNextTeam )
|
||||
{
|
||||
AddPossiblePendingEnemiesToBattle();
|
||||
|
||||
AddPossiblePendingMilitiaToBattle();
|
||||
|
||||
// InitEnemyUIBar( );
|
||||
|
||||
FreezeInterfaceForEnemyTurn();
|
||||
@@ -430,6 +462,8 @@ void BeginTeamTurn( UINT8 ubTeam )
|
||||
|
||||
}
|
||||
|
||||
RecalculateSoldiersAniSpeed();
|
||||
|
||||
if (ubTeam == gbPlayerNum )
|
||||
{
|
||||
// ATE: Check if we are still in a valid battle...
|
||||
|
||||
@@ -225,7 +225,7 @@ void HandleStealthChangeFromUIKeys( );
|
||||
UINT8 gubCheatLevel = STARTING_CHEAT_LEVEL;
|
||||
|
||||
|
||||
|
||||
extern BOOLEAN CompatibleAmmoForGun( OBJECTTYPE *pTryObject, OBJECTTYPE *pTestObject );
|
||||
extern void DetermineWhichAssignmentMenusCanBeShown( void );
|
||||
extern void DetermineWhichMilitiaControlMenusCanBeShown( void ); //lal
|
||||
|
||||
@@ -2995,10 +2995,73 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
HandleStanceChangeFromUIKeys( ANIM_PRONE );
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
if (! (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
{
|
||||
SOLDIERTYPE *pTeamSoldier;
|
||||
INT8 bLoop;
|
||||
OBJECTTYPE *pGun, *pAmmo;
|
||||
|
||||
// Search for soldier
|
||||
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
|
||||
{
|
||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||
{
|
||||
|
||||
|
||||
// Search for gun
|
||||
for (UINT32 bLoop2 = 0; bLoop2 < NUM_INV_SLOTS; bLoop2++)
|
||||
{
|
||||
if (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN || Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER)
|
||||
{
|
||||
pGun = &(pTeamSoldier->inv[bLoop2]);
|
||||
//magazine is not full
|
||||
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
{
|
||||
|
||||
// Search for ammo in sector
|
||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
||||
{
|
||||
if ( gWorldItems[ uiLoop ].fExists)
|
||||
{
|
||||
pAmmo = &( gWorldItems[ uiLoop ].o );
|
||||
|
||||
if ( CompatibleAmmoForGun( pAmmo, pGun ) )
|
||||
{
|
||||
ReloadGun( pTeamSoldier, pGun, pAmmo );
|
||||
}
|
||||
|
||||
if (pAmmo->ubShotsLeft[0] == 0)
|
||||
{
|
||||
RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SOLDIERTYPE *pTeamSoldier;
|
||||
INT8 bLoop;
|
||||
|
||||
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
|
||||
{
|
||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||
{
|
||||
AutoReload( pTeamSoldier );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'r':
|
||||
if( gusSelectedSoldier != NO_SOLDIER )
|
||||
{
|
||||
|
||||
if( fAlt ) //reload selected merc's weapon
|
||||
{
|
||||
if ( CHEATER_CHEAT_LEVEL( ) )
|
||||
@@ -3015,24 +3078,27 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !MercInWater( MercPtrs[ gusSelectedSoldier ] ) && !(MercPtrs[ gusSelectedSoldier ]->uiStatusFlags & SOLDIER_ROBOT ) )
|
||||
{
|
||||
//change selected merc to run
|
||||
if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING )
|
||||
{
|
||||
UIHandleSoldierStanceChange( (UINT8)gusSelectedSoldier, ANIM_STAND );
|
||||
MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1;
|
||||
MercPtrs[ gusSelectedSoldier ]->usUIMovementMode = RUNNING;
|
||||
gfPlotNewMovement = TRUE;
|
||||
}
|
||||
}
|
||||
if ( !MercInWater( MercPtrs[ gusSelectedSoldier ] ) && !(MercPtrs[ gusSelectedSoldier ]->uiStatusFlags & SOLDIER_ROBOT ) )
|
||||
{
|
||||
//change selected merc to run
|
||||
if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != WALKING && MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING )
|
||||
{
|
||||
UIHandleSoldierStanceChange( (UINT8)gusSelectedSoldier, ANIM_STAND );
|
||||
MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MercPtrs[ gusSelectedSoldier ]->fUIMovementFast = 1;
|
||||
MercPtrs[ gusSelectedSoldier ]->usUIMovementMode = RUNNING;
|
||||
gfPlotNewMovement = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 's':
|
||||
|
||||
if( fCtrl )
|
||||
@@ -3347,7 +3413,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
// nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel
|
||||
if ( ( gpItemPointer == NULL ) )
|
||||
{
|
||||
HandleStealthChangeFromUIKeys( );
|
||||
HandleStealthChangeFromUIKeys( );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user