mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Initial commit - SVN checkpoint to git branch
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#pragma optimize("",off)
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Strategic All.h"
|
||||
#include "GameSettings.h"
|
||||
@@ -1658,6 +1659,9 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
// check if sam site
|
||||
if( fSamSitePresent == FALSE )
|
||||
{
|
||||
if (RebelCommand::CanTrainMilitiaAnywhere())
|
||||
return( TRUE );
|
||||
|
||||
// nope
|
||||
return ( FALSE );
|
||||
}
|
||||
@@ -1971,6 +1975,9 @@ BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
if (RebelCommand::CanTrainMilitiaAnywhere())
|
||||
ubFacilityTrainersAllowed = RebelCommand::GetMaxTrainersForTrainMilitiaAnywhere();
|
||||
|
||||
// Count number of trainers already operating here
|
||||
if ( CountMilitiaTrainersInSoldiersSector( pSoldier, TOWN_MILITIA ) >= ubFacilityTrainersAllowed )
|
||||
{
|
||||
@@ -2033,6 +2040,9 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
if (RebelCommand::CanTrainMilitiaAnywhere())
|
||||
return(TRUE);
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -2085,7 +2095,7 @@ BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 i
|
||||
// is there a town really here
|
||||
if( bTownId == BLANK_SECTOR )
|
||||
{
|
||||
fSamSitePresent = IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
|
||||
fSamSitePresent = IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) || RebelCommand::CanTrainMilitiaAnywhere();
|
||||
|
||||
// if there is a sam site here
|
||||
if( fSamSitePresent )
|
||||
@@ -6136,7 +6146,8 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
}
|
||||
|
||||
// check if we're doing a sector where militia can be trained
|
||||
if( ( (StrategicMap[CALCULATE_STRATEGIC_INDEX(sMapX, sMapY) ].bNameId != BLANK_SECTOR ) || ( fSamSiteInSector == TRUE ) ) && (bZ == 0) )
|
||||
const BOOL canTrainMilitiaAnywhere = RebelCommand::CanTrainMilitiaAnywhere();
|
||||
if( (canTrainMilitiaAnywhere || (StrategicMap[CALCULATE_STRATEGIC_INDEX(sMapX, sMapY) ].bNameId != BLANK_SECTOR ) || ( fSamSiteInSector == TRUE ) ) && (bZ == 0) )
|
||||
{
|
||||
// init town trainer list
|
||||
memset( TownTrainer, 0, sizeof( TownTrainer ) );
|
||||
@@ -7898,7 +7909,7 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1
|
||||
|
||||
// get town index
|
||||
ubTownId = StrategicMap[CALCULATE_STRATEGIC_INDEX(pTrainer->sSectorX, pTrainer->sSectorY ) ].bNameId;
|
||||
if( fSamSiteInSector == FALSE )
|
||||
if( fSamSiteInSector == FALSE && !RebelCommand::CanTrainMilitiaAnywhere())
|
||||
{
|
||||
AssertNE(ubTownId, BLANK_SECTOR);
|
||||
}
|
||||
@@ -20165,6 +20176,9 @@ BOOLEAN CanCharacterTrainMilitiaWithErrorReport( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
if (RebelCommand::CanTrainMilitiaAnywhere())
|
||||
ubFacilityTrainersAllowed = RebelCommand::GetMaxTrainersForTrainMilitiaAnywhere();
|
||||
|
||||
// If we are here, then TrainersAllowed > 0.
|
||||
// Otherwise we'd have failed the BasicCanTrain check
|
||||
if ( CountMilitiaTrainersInSoldiersSector( pSoldier, TOWN_MILITIA ) >= ubFacilityTrainersAllowed )
|
||||
|
||||
@@ -100,6 +100,7 @@ enum
|
||||
ADMINISTRATION, // merc boosts the effectiveness of other mercs
|
||||
EXPLORATION, // merc searches the sector for undiscovered items
|
||||
ASSIGNMENT_MINIEVENT,
|
||||
ASSIGNMENT_REBELCOMMAND,
|
||||
NUM_ASSIGNMENTS,
|
||||
};
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "Player Command.h" // added by Flugente
|
||||
#include "LuaInitNPCs.h" // added by Flugente
|
||||
#include "MiniEvents.h"
|
||||
#include "Rebel Command.h"
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -680,6 +681,10 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
CheckMiniEvents(pEvent->uiParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVENT_REBELCOMMAND:
|
||||
RebelCommand::HandleStrategicEvent(pEvent->uiParam);
|
||||
break;
|
||||
}
|
||||
gfPreventDeletionOfAnyEvent = fOrigPreventFlag;
|
||||
return TRUE;
|
||||
|
||||
@@ -152,6 +152,8 @@ enum
|
||||
|
||||
EVENT_MINIEVENT,
|
||||
|
||||
EVENT_REBELCOMMAND,
|
||||
|
||||
NUMBER_OF_EVENT_TYPES_PLUS_ONE,
|
||||
NUMBER_OF_EVENT_TYPES = NUMBER_OF_EVENT_TYPES_PLUS_ONE - 1
|
||||
};
|
||||
|
||||
@@ -140,6 +140,7 @@ CHAR16 gEventName[NUMBER_OF_EVENT_TYPES_PLUS_ONE][40]={
|
||||
L"bandit attack",
|
||||
L"ArmyFinishTraining",
|
||||
L"MiniEvent",
|
||||
L"ARC_Event",
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma optimize("",off)
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Strategic All.h"
|
||||
#include "GameSettings.h"
|
||||
@@ -49,6 +50,7 @@
|
||||
#include "Map Screen Interface Map Inventory.h" // added by Flugente
|
||||
#include "LuaInitNPCs.h" // added by Flugente
|
||||
#include "Game Event Hook.h" // added by Flugente
|
||||
#include "Rebel Command.h"
|
||||
#endif
|
||||
|
||||
#include "Quests.h"
|
||||
@@ -844,6 +846,42 @@ void fillMapColoursForVisitedSectors(INT32(&colorMap)[ MAXIMUM_VALID_Y_COORDINAT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RebelCommand::ShowEnemyMovementTargets())
|
||||
{
|
||||
const auto targetColor = MAP_SHADE_LT_RED;
|
||||
GROUP* pGroup = gpGroupList;
|
||||
|
||||
while (pGroup)
|
||||
{
|
||||
if (pGroup->usGroupTeam == ENEMY_TEAM)
|
||||
{
|
||||
const UINT8 intention = pGroup->pEnemyGroup->ubIntention;
|
||||
if (intention == STAGING
|
||||
|| intention == REINFORCEMENTS
|
||||
|| intention == PURSUIT
|
||||
|| intention == ASSAULT)
|
||||
{
|
||||
WAYPOINT* wp = pGroup->pWaypoints;
|
||||
|
||||
while (wp)
|
||||
{
|
||||
if (wp->next == nullptr)
|
||||
break;
|
||||
|
||||
wp = wp->next;
|
||||
}
|
||||
|
||||
if (GetSectorFlagStatus(wp->x-1, wp->y-1, (UINT8)iCurrentMapSectorZ, SF_ALREADY_VISITED))
|
||||
{
|
||||
colorMap[wp->y-1][wp->x-1] = targetColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1529,6 +1529,7 @@ void MiniEventsLua(UINT32 eventId)
|
||||
&& pSoldier->stats.bLife > 0
|
||||
&& pSoldier->bAssignment != IN_TRANSIT
|
||||
&& pSoldier->bAssignment != ASSIGNMENT_POW
|
||||
&& pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND
|
||||
&& !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE))
|
||||
{
|
||||
gAllMercs.push_back(pSoldier);
|
||||
|
||||
+1787
-133
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,43 @@
|
||||
#include "Types.h"
|
||||
|
||||
#define REBEL_COMMAND_MAX_ACTIONS_PER_REGION 6
|
||||
#define NUM_ARC_AGENT_SLOTS 2
|
||||
|
||||
namespace RebelCommand
|
||||
{
|
||||
// applies to RegionSaveInfo.actionLevels: use the MSB as the active flag since I don't expect it to be used otherwise
|
||||
constexpr UINT8 ADMIN_ACTION_ACTIVE_BIT = 1 << 7;
|
||||
|
||||
// for rebelCommandSaveInfo.uBitMask
|
||||
// requirement breakdown
|
||||
// 1 bit for notification toggle
|
||||
// 5 * 4 bits for random mission selection (2off, 2def) = 32 choices each
|
||||
// need some bits to track mission area (friendly/hostile? num towns?)
|
||||
// remaining bits to track up/downgrades?
|
||||
// some should be ASD specific?
|
||||
// can we not do this and just check strategic events? GetAllStrategicEventsOfType(). could be costly. iterates over event LL on each call
|
||||
// can we cache in-flight events on load? no real need to save this, right?
|
||||
//constexpr UINT64 AGENT_NOTIFICATION_BIT = 1 << 0;
|
||||
|
||||
// the FIRST and SECOND strategic events share the same type (EVENT_REBELCOMMAND - no need to have multiple types yet, I think...)
|
||||
// so the 32-bit int will have to block out information for both events
|
||||
// FIRST EVENT BREAKDOWN
|
||||
// A######B CCCCCCCC DDDDDDDD EEEEEEEE
|
||||
// A (1 bit) - always 0 to indicate that this is the FIRST event (ie, keeping a merc busy for a set duration)
|
||||
// B (1 bit) - 0 if the player sent a generic rebel agent, 1 if the player sent one of their own mercs
|
||||
// C (8 bit) - the profile number of the merc that was sent. invalid if B == 0
|
||||
// D (8 bit) - the mission ID. should match up with RebelCommandAgentMissions enum
|
||||
// E (8 bit) - the mission duration, in hours. if 0, mission failed.
|
||||
// the rest of the bits depend on the mission?
|
||||
//
|
||||
|
||||
// SECOND EVENT BREAKDOWN
|
||||
// A####### #######B CCCCCCCC DDDDDDDD
|
||||
// A (1 bit) - always 1 to indicate that this is the SECOND event (ie, this event fires when the mission bonus expires)
|
||||
// B (1 bit) - 0 if the player sent a generic rebel agent, 1 if the player sent one of their own mercs
|
||||
// C (8 bit) - the profile number of the merc that was sent. invalid if B == 0
|
||||
// D (8 bit) - the mission ID. should match up with RebelCommandAgentMissions enum
|
||||
// extra bits are for ???????????
|
||||
|
||||
enum RebelCommandDirectives
|
||||
{
|
||||
@@ -49,6 +83,36 @@ enum RebelCommandAdminActions
|
||||
RCAA_NUM_ACTIONS
|
||||
};
|
||||
|
||||
enum RebelCommandAgentMissions
|
||||
{
|
||||
RCAM_NONE = -1,
|
||||
RCAM_DEEP_DEPLOYMENT = 0,
|
||||
RCAM_GET_ENEMY_MOVEMENT_TARGETS, // aka Strategic Intel
|
||||
RCAM_IMPROVE_LOCAL_SHOPS,
|
||||
RCAM_REDUCE_STRATEGIC_DECISION_SPEED, // aka Slower Strategic Decisions
|
||||
RCAM_REDUCE_UNALERTED_ENEMY_VISION, // aka Lower Readiness
|
||||
RCAM_SABOTAGE_INFANTRY_EQUIPMENT, // aka Sabotage Equipment
|
||||
RCAM_SABOTAGE_MECHANICAL_UNITS, // aka Sabotage Vehicles
|
||||
RCAM_TRAIN_MILITIA_ANYWHERE,
|
||||
|
||||
RCAM_NUM_MISSIONS,
|
||||
|
||||
// ideas/unimplemented - rename some?
|
||||
// need to have permanent and temporary boons
|
||||
RCAM_SEND_SUPPLIES_TO_TOWN,
|
||||
RCAM_BOOST_TOWN_ADMIN_ACTIONS,
|
||||
RCAM_PROCURE_ITEMS,
|
||||
RCAM_MILITIA_SKILL_TRAITS, // should override militia skill traits ini option - split into multiple (weapon spec, bodybuilding, athletic, night ops)
|
||||
RCAM_OBSERVE_SECTORS, // ??? competes with scouts?
|
||||
RCAM_PURCHASE_SUPPLIES, // increase daily supply income, decrease daily $ income
|
||||
RCAM_SABOTAGE_ASD, // see ASD.cpp for things that can be played with
|
||||
RCAM_SABOTAGE_MINE,
|
||||
RCAM_REDUCE_ENEMY_POOL, // need to make sure enemy pool is not infinite // giReinforcementPool, also gfUnlimitedTroops = zDiffSetting[gGameOptions.ubDifficultyLevel].bUnlimitedPoolOfTroops;
|
||||
// militia/mercs get bonus vision (???)
|
||||
// share vision with civilians?
|
||||
|
||||
};
|
||||
|
||||
enum RegionAdminStatus
|
||||
{
|
||||
RAS_NONE,
|
||||
@@ -97,8 +161,13 @@ typedef struct RegionSaveInfo
|
||||
UINT8 actionLevels[REBEL_COMMAND_MAX_ACTIONS_PER_REGION];
|
||||
UINT8 ubMaxLoyalty;
|
||||
|
||||
BOOLEAN IsActive(UINT8 index) { return (actionLevels[index] & ADMIN_ACTION_ACTIVE_BIT) == 0; }
|
||||
// rftr: I know these fly in the face of convention, but I'm lazy and this preserves savegame compatibility without needing to add any additional code
|
||||
void SetActive(UINT8 index) { actionLevels[index] &= ~ADMIN_ACTION_ACTIVE_BIT; } // active bit value = 0
|
||||
void SetInactive(UINT8 index) { actionLevels[index] |= ADMIN_ACTION_ACTIVE_BIT; } // inactive bit value = 1
|
||||
INT32 GetAdminDeployCost(INT16 numAdminTeams) { return 10 * numAdminTeams * numAdminTeams; };
|
||||
INT32 GetAdminReactivateCost(INT16 numAdminTeams) { return GetAdminDeployCost(numAdminTeams) / 4; };
|
||||
UINT8 GetLevel(INT16 index) { return actionLevels[index] & ~ADMIN_ACTION_ACTIVE_BIT; }
|
||||
} RegionSaveInfo;
|
||||
|
||||
typedef struct SaveInfo
|
||||
@@ -110,9 +179,10 @@ typedef struct SaveInfo
|
||||
INT32 iActiveDirective;
|
||||
INT32 iSelectedDirective;
|
||||
INT8 iMilitiaStatsLevel;
|
||||
UINT8 uSupplyDropCount;
|
||||
UINT8 uSupplyDropCount; // keeping this around for compatibility with old saves
|
||||
INT8 availableMissions[NUM_ARC_AGENT_SLOTS];
|
||||
|
||||
INT8 filler[19];
|
||||
INT8 filler[17];
|
||||
} SaveInfo;
|
||||
|
||||
extern SaveInfo rebelCommandSaveInfo;
|
||||
@@ -122,6 +192,7 @@ void ExitWebsite();
|
||||
void RenderWebsite();
|
||||
void HandleWebsite();
|
||||
|
||||
// admin actions
|
||||
void ApplyEnemyPenalties(SOLDIERTYPE* pSoldier);
|
||||
void ApplyMilitiaBonuses(SOLDIERTYPE* pMilitia);
|
||||
UINT8 GetApproximateEnemyLocationResolutionIndex();
|
||||
@@ -139,17 +210,30 @@ FLOAT GetPathfindersSpeedBonus(UINT8 sector);
|
||||
BOOLEAN NeutraliseRole(const SOLDIERTYPE* pSoldier);
|
||||
void RaidMines(INT32 &playerIncome, INT32 &enemyIncome);
|
||||
BOOLEAN ShowApproximateEnemyLocations();
|
||||
void ShowWebsiteAvailableMessage();
|
||||
|
||||
// agent missions
|
||||
void ApplyEnemyMechanicalUnitPenalties(SOLDIERTYPE* pSoldier);
|
||||
void ApplyMilitiaTraits(SOLDIERTYPE* pSoldier);
|
||||
void ApplyVisionModifier(const SOLDIERTYPE* pSoldier, INT32& sight);
|
||||
BOOLEAN CanAssignTraitsToMilitia();
|
||||
BOOLEAN CanTrainMilitiaAnywhere();
|
||||
UINT8 GetMaxTrainersForTrainMilitiaAnywhere();
|
||||
INT16 GetAdditionalDeployRange(const UINT8 insertionCode);
|
||||
INT8 GetEnemyEquipmentCoolnessModifier();
|
||||
INT8 GetEnemyEquipmentStatusModifier(const INT8 initialStatus);
|
||||
UINT8 GetMerchantCoolnessBonus();
|
||||
FLOAT GetStrategicDecisionSpeedModifier();
|
||||
void HandleStrategicEvent(const UINT32 eventParam);
|
||||
BOOLEAN ShowEnemyMovementTargets();
|
||||
|
||||
void DailyUpdate();
|
||||
void HourlyUpdate();
|
||||
void Init();
|
||||
void ShowWebsiteAvailableMessage();
|
||||
BOOLEAN Load(HWFILE file);
|
||||
BOOLEAN Save(HWFILE file);
|
||||
|
||||
}
|
||||
|
||||
//BOOLEAN LoadRebelCommand( HWFILE file ) { return RebelCommand::Load( file ); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "Map Information.h"
|
||||
#include "interface dialogue.h"
|
||||
#include "ASD.h" // added by Flugente
|
||||
#include "Rebel Command.h"
|
||||
#endif
|
||||
|
||||
#include "GameInitOptionsScreen.h"
|
||||
@@ -1198,6 +1199,8 @@ void InitStrategicAI()
|
||||
dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus );
|
||||
}
|
||||
|
||||
dEnemyGeneralsSpeedupFactor *= RebelCommand::GetStrategicDecisionSpeedModifier();
|
||||
|
||||
giReinforcementPool = zDiffSetting[gGameOptions.ubDifficultyLevel].iQueensInitialPoolOfTroops;
|
||||
giForcePercentage = zDiffSetting[gGameOptions.ubDifficultyLevel].iInitialGarrisonPercentages;
|
||||
giArmyAlertness = zDiffSetting[gGameOptions.ubDifficultyLevel].iEnemyStartingAlertLevel;
|
||||
@@ -3456,6 +3459,8 @@ void EvaluateQueenSituation()
|
||||
{
|
||||
dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus );
|
||||
}
|
||||
|
||||
dEnemyGeneralsSpeedupFactor *= RebelCommand::GetStrategicDecisionSpeedModifier();
|
||||
|
||||
uiOffset += dEnemyGeneralsSpeedupFactor * (zDiffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDiffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance ));
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma optimize("",off)
|
||||
#include "builddefines.h"
|
||||
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
@@ -279,7 +280,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
|
||||
if( ubTownId == BLANK_SECTOR )
|
||||
{
|
||||
Assert( IsThisSectorASAMSector( sMapX, sMapY, 0 ) );
|
||||
Assert( IsThisSectorASAMSector( sMapX, sMapY, 0 ) || RebelCommand::CanTrainMilitiaAnywhere() );
|
||||
}
|
||||
|
||||
// force tactical to update militia status
|
||||
@@ -1293,7 +1294,7 @@ BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaTyp
|
||||
INT32 iMaxMilitiaPerSector = gGameExternalOptions.iMaxMilitiaPerSector;
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia5");
|
||||
// check if SAM site is ours?
|
||||
fSamSitePresent = IsThisSectorASAMSector( sSectorX, sSectorY, 0 );
|
||||
fSamSitePresent = IsThisSectorASAMSector(sSectorX, sSectorY, 0) || RebelCommand::CanTrainMilitiaAnywhere();
|
||||
|
||||
if( fSamSitePresent == FALSE )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user