New feature: transport groups (#172)

https://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=365395
This commit is contained in:
rftrdev
2023-07-04 20:58:56 -07:00
committed by GitHub
parent 8d3e6fce40
commit fb03cba2fa
37 changed files with 1471 additions and 102 deletions
+57 -5
View File
@@ -41,8 +41,10 @@ How to add a new admin action:
- if effect applies outside of towns, add help text range band as appropriate to SetupAdminActionBox
How to add a new mission:
- add to the RebelCommandAgentMissions enum in the header
- add strings to text files (szRebelCommandAgentMissionsText)
- add strings to text files (szRebelCommandText (trait bonuses), szRebelCommandAgentMissionsText (title/description))
- add to the RebelCommandText and RebelCommandAgentMissions enums in the header
- add to the RebelCommandAgentMissionsText enums in the cpp
- add mission variables to GameSettings
- add values to MissionHelpers::missionInfo table in SetupInfo()
- add to valid check in HandleStrategicEvent() (allows advance from first event/prepare to second event/active effect)
- add to SetupMissionAgentBox() (mission description and merc bonus text)
@@ -91,6 +93,7 @@ Points of interest:
#include "Strategic Mines.h"
#include "Strategic Movement.h"
#include "Strategic Town Loyalty.h"
#include "Strategic Transport Groups.h"
#include "Structure Wrap.h"
#include "Tactical Save.h"
#include "Text.h"
@@ -405,6 +408,7 @@ enum RebelCommandAgentMissionsText // keep this synced with szRebelCommandAgentM
{
MISSION_TEXT(DEEP_DEPLOYMENT)
MISSION_TEXT(DISRUPT_ASD)
MISSION_TEXT(FORGE_TRANSPORT_ORDERS)
MISSION_TEXT(GET_ENEMY_MOVEMENT_TARGETS)
MISSION_TEXT(IMPROVE_LOCAL_SHOPS)
MISSION_TEXT(REDUCE_STRATEGIC_DECISION_SPEED)
@@ -2221,6 +2225,7 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
{
case RCAM_DEEP_DEPLOYMENT: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_DEEP_DEPLOYMENT_TITLE]); break;
case RCAM_DISRUPT_ASD: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_DISRUPT_ASD_TITLE]); break;
case RCAM_FORGE_TRANSPORT_ORDERS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_FORGE_TRANSPORT_ORDERS_TITLE]); break;
case RCAM_GET_ENEMY_MOVEMENT_TARGETS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_GET_ENEMY_MOVEMENT_TARGETS_TITLE]); break;
case RCAM_IMPROVE_LOCAL_SHOPS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_IMPROVE_LOCAL_SHOPS_TITLE]); break;
case RCAM_REDUCE_STRATEGIC_DECISION_SPEED: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_REDUCE_STRATEGIC_DECISION_SPEED_TITLE]); break;
@@ -2241,6 +2246,7 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
{
case RCAM_DEEP_DEPLOYMENT: missionDurationBase = gRebelCommandSettings.iDeepDeploymentDuration; break;
case RCAM_DISRUPT_ASD: missionDurationBase = gRebelCommandSettings.iDisruptAsdDuration; break;
case RCAM_FORGE_TRANSPORT_ORDERS: missionDurationBase = 1; break; // instant effect
case RCAM_GET_ENEMY_MOVEMENT_TARGETS: missionDurationBase = gRebelCommandSettings.iGetEnemyMovementTargetsDuration; break;
case RCAM_IMPROVE_LOCAL_SHOPS: missionDurationBase = gRebelCommandSettings.iImproveLocalShopsDuration; break;
case RCAM_REDUCE_STRATEGIC_DECISION_SPEED: missionDurationBase = gRebelCommandSettings.iReduceStrategicDecisionSpeedDuration; break;
@@ -2264,6 +2270,7 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
{
case RCAM_DEEP_DEPLOYMENT: missionSuccessChanceBase = gRebelCommandSettings.iDeepDeploymentSuccessChance; break;
case RCAM_DISRUPT_ASD: missionSuccessChanceBase = gRebelCommandSettings.iDisruptAsdSuccessChance; break;
case RCAM_FORGE_TRANSPORT_ORDERS: missionSuccessChanceBase = gRebelCommandSettings.iForgeTransportOrdersSuccessChance; break;
case RCAM_GET_ENEMY_MOVEMENT_TARGETS: missionSuccessChanceBase = gRebelCommandSettings.iGetEnemyMovementTargetsSuccessChance; break;
case RCAM_IMPROVE_LOCAL_SHOPS: missionSuccessChanceBase = gRebelCommandSettings.iImproveLocalShopsSuccessChance; break;
case RCAM_REDUCE_STRATEGIC_DECISION_SPEED: missionSuccessChanceBase = gRebelCommandSettings.iReduceStrategicDecisionSpeedSuccessChance; break;
@@ -2284,6 +2291,7 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
{
case RCAM_DEEP_DEPLOYMENT: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_DEEP_DEPLOYMENT_DESC]); break;
case RCAM_DISRUPT_ASD: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_DISRUPT_ASD_DESC]); break;
case RCAM_FORGE_TRANSPORT_ORDERS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_FORGE_TRANSPORT_ORDERS_DESC]); break;
case RCAM_GET_ENEMY_MOVEMENT_TARGETS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_GET_ENEMY_MOVEMENT_TARGETS_DESC]); break;
case RCAM_IMPROVE_LOCAL_SHOPS: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_IMPROVE_LOCAL_SHOPS_DESC]); break;
case RCAM_REDUCE_STRATEGIC_DECISION_SPEED: swprintf(sText, szRebelCommandAgentMissionsText[RCAMT_REDUCE_STRATEGIC_DECISION_SPEED_DESC]); break;
@@ -2454,6 +2462,12 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
}
}
case RCAM_FORGE_TRANSPORT_ORDERS:
{
// no special modifiers. included for completeness.
}
break;
case RCAM_GET_ENEMY_MOVEMENT_TARGETS:
{
// no special modifiers. included for completeness.
@@ -2610,7 +2624,13 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index)
swprintf(sText, szRebelCommandText[RCT_MISSION_CANT_START_CONTRACT_EXPIRING]);
}
}
else if (agentIndex[index] == mercs.size() && rebelCommandSaveInfo.availableMissions[index] == RCAM_SEND_SUPPLIES_TO_TOWN)
else if (agentIndex[index] == mercs.size() &&
(
rebelCommandSaveInfo.availableMissions[index] == RCAM_SEND_SUPPLIES_TO_TOWN ||
rebelCommandSaveInfo.availableMissions[index] == RCAM_FORGE_TRANSPORT_ORDERS
)
)
{
canStartMission = FALSE;
swprintf(sText, szRebelCommandText[RCT_MISSION_CANT_USE_REBEL_AGENT]);
@@ -2847,6 +2867,14 @@ void PrepareMission(INT8 index)
}
break;
case RCAM_FORGE_TRANSPORT_ORDERS:
{
missionTitle = RCAMT_FORGE_TRANSPORT_ORDERS_TITLE;
missionSuccessChance = gRebelCommandSettings.iForgeTransportOrdersSuccessChance;
missionDuration = 12;
}
break;
case RCAM_GET_ENEMY_MOVEMENT_TARGETS:
{
missionTitle = RCAMT_GET_ENEMY_MOVEMENT_TARGETS_TITLE;
@@ -3897,6 +3925,7 @@ void DailyUpdate()
{
if (i == RCAM_SOLDIER_BOUNTIES_KINGPIN && !(CheckFact(FACT_KINGPIN_INTRODUCED_SELF, 0) == TRUE && CheckFact(FACT_KINGPIN_DEAD, 0) == FALSE && CheckFact(FACT_KINGPIN_IS_ENEMY, 0) == FALSE && CurrentPlayerProgressPercentage() >= 30)) continue;
else if (i == RCAM_DISRUPT_ASD && gGameExternalOptions.fASDActive == FALSE) continue;
else if (i == RCAM_FORGE_TRANSPORT_ORDERS && gGameExternalOptions.fStrategicTransportGroupsEnabled == FALSE) continue;
validMissions.insert(static_cast<RebelCommandAgentMissions>(i));
}
@@ -4299,6 +4328,16 @@ void SetupInfo()
{0, 0, 0, 0},
{0, MissionHelpers::DISRUPT_ASD_STEAL_FUEL, MissionHelpers::DISRUPT_ASD_DESTROY_RESERVES, 0}
});
//RCAM_FORGE_TRANSPORT_ORDERS
MissionHelpers::missionInfo.push_back(
{
{COVERT_NT },
{-1},
{0},
{0.f},
{0},
{0}
});
//RCAM_GET_ENEMY_MOVEMENT_TARGETS
MissionHelpers::missionInfo.push_back(
{
@@ -4902,6 +4941,7 @@ void HandleStrategicEvent(const UINT32 eventParam)
{
case RCAM_DEEP_DEPLOYMENT:
case RCAM_DISRUPT_ASD:
case RCAM_FORGE_TRANSPORT_ORDERS:
case RCAM_GET_ENEMY_MOVEMENT_TARGETS:
case RCAM_IMPROVE_LOCAL_SHOPS:
case RCAM_REDUCE_STRATEGIC_DECISION_SPEED:
@@ -4926,7 +4966,15 @@ void HandleStrategicEvent(const UINT32 eventParam)
if (validMission)
{
const UINT32 activatedMissionParam = SerialiseMissionSecondEvent(evt1.sentGenericRebelAgent, evt1.mercProfileId, mission, extraBits);
AddStrategicEvent(EVENT_REBELCOMMAND, GetWorldTotalMin() + 60 * evt1.missionDurationInHours, activatedMissionParam);
if (mission == RCAM_FORGE_TRANSPORT_ORDERS)
{
// don't send a follow-up event for instant-result missions
}
else
{
AddStrategicEvent(EVENT_REBELCOMMAND, GetWorldTotalMin() + 60 * evt1.missionDurationInHours, activatedMissionParam);
missionMap.insert(std::make_pair(mission, activatedMissionParam));
}
if (!evt1.sentGenericRebelAgent)
{
@@ -4935,6 +4983,11 @@ void HandleStrategicEvent(const UINT32 eventParam)
SOLDIERTYPE* pSoldier = MercPtrs[i];
if (pSoldier->ubProfile == evt1.mercProfileId)
{
if (mission == RCAM_FORGE_TRANSPORT_ORDERS)
{
ForceDeployTransportGroup(SECTOR(pSoldier->sSectorX, pSoldier->sSectorY));
}
// mission successful! give some experience pts
StatChange(pSoldier, LDRAMT, 20, FROM_SUCCESS);
StatChange(pSoldier, WISDOMAMT, 15, FROM_SUCCESS);
@@ -4943,7 +4996,6 @@ void HandleStrategicEvent(const UINT32 eventParam)
}
}
missionMap.insert(std::make_pair(mission, activatedMissionParam));
swprintf(msgBoxText, szRebelCommandText[RCT_MISSION_SUCCESS], szRebelCommandAgentMissionsText[evt1.missionId * 2]);
swprintf(screenMsgText, szRebelCommandText[RCT_MISSION_SUCCESS], szRebelCommandAgentMissionsText[evt1.missionId * 2]);
ScreenMsg(FONT_MCOLOR_LTGREEN, MSG_INTERFACE, screenMsgText);