From 068ebfe61d0ab59a7c2c58dcc19edcc2ddacf039 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 1 Apr 2024 23:54:24 +0200 Subject: Each Campaign now has a specific start date and time --- StarsEx/Campaign.cpp | 23 ++++++++++++++++++++--- StarsEx/Campaign.h | 5 ++++- StarsEx/CampaignSaveGame.cpp | 11 ++++++----- data/content/Campaigns/01/T3.def | 1 - data/content/Campaigns/01/T4.def | 1 - data/content/Campaigns/01/campaign.def | 4 ++-- data/content/Campaigns/02/campaign.def | 1 + data/content/Campaigns/03/campaign.def | 1 + data/content/Campaigns/04/campaign.def | 1 + data/content/Campaigns/05/campaign.def | 1 + data/shatter/Campaigns/01/campaign.def | 1 + data/shatter/Campaigns/02/campaign.def | 2 ++ data/shatter/Campaigns/03/campaign.def | 2 ++ data/shatter/Campaigns/04/campaign.def | 2 ++ data/shatter/Campaigns/05/campaign.def | 2 ++ 15 files changed, 45 insertions(+), 13 deletions(-) diff --git a/StarsEx/Campaign.cpp b/StarsEx/Campaign.cpp index b139787..3751db8 100644 --- a/StarsEx/Campaign.cpp +++ b/StarsEx/Campaign.cpp @@ -109,7 +109,7 @@ static Campaign* current_campaign = 0; Campaign::Campaign(int id, const char* n) : campaign_id(id), name(n), mission_id(-1), mission(0), net_mission(0), - scripted(false), sequential(false), time(0), load_time(0), + scripted(false), sequential(false), time(0), load_time(0), start_time(0), player_group(0), player_unit(0), status(CAMPAIGN_INIT), lockout(0), loaded_from_savegame(false) { @@ -119,7 +119,7 @@ Campaign::Campaign(int id, const char* n) Campaign::Campaign(int id, const char* n, const char* p) : campaign_id(id), name(n), mission_id(-1), mission(0), net_mission(0), - scripted(false), sequential(false), time(0), load_time(0), + scripted(false), sequential(false), time(0), load_time(0), start_time(0), player_group(0), player_unit(0), status(CAMPAIGN_INIT), lockout(0), loaded_from_savegame(false) { @@ -487,6 +487,9 @@ Campaign::LoadCampaign(DataLoader* loader, bool full) orders = ContentBundle::GetInstance()->GetText(orders); } } + else if (def->name()->value() == "stardate") { + GetDefNumber(start_time, def, filename); + } else if (def->name()->value() == "scripted") { if (def->term() && def->term()->isBool()) { scripted = def->term()->isBool()->value(); @@ -1880,7 +1883,7 @@ Campaign::Prep() LoadCampaign(loader, true); } - starshatter::engine::SetOperationStart(); + starshatter::engine::SetOperationStart(start_time); starshatter::engine::SetMissionStart(); Clock::GetInstance()->ResetGameTime(load_time); @@ -2083,6 +2086,20 @@ Campaign::SetLoadTime(long double value) load_time = value; } + +long double +Campaign::StartTime() const +{ + return start_time; +} + + +void +Campaign::SetStartTime(long double value) +{ + start_time = value; +} + // +--------------------------------------------------------------------+ bool diff --git a/StarsEx/Campaign.h b/StarsEx/Campaign.h index 8b38c51..e3548fb 100644 --- a/StarsEx/Campaign.h +++ b/StarsEx/Campaign.h @@ -189,8 +189,10 @@ public: int GetMissionId() const { return mission_id; } Bitmap* GetImage(int n) { return &image[n]; } long double GetTime() const { return time; } - long double LoadTime() const; + long double LoadTime() const; void SetLoadTime(long double value); + long double StartTime() const; + void SetStartTime(long double value); bool InCutscene() const; bool IsDynamic() const; @@ -268,6 +270,7 @@ protected: long double time; long double load_time; + long double start_time; int lockout; }; diff --git a/StarsEx/CampaignSaveGame.cpp b/StarsEx/CampaignSaveGame.cpp index 62f8438..0c6d655 100644 --- a/StarsEx/CampaignSaveGame.cpp +++ b/StarsEx/CampaignSaveGame.cpp @@ -192,8 +192,8 @@ CampaignSaveGame::Load(const char* filename) int grp_type = 0; int grp_id = 0; int status = 0; - long double baseTime = 0; - long double time = 0; + long double load_time = 0; + long double start_time = 0; Text unit; Text sitrep; Text orders; @@ -255,11 +255,11 @@ CampaignSaveGame::Load(const char* filename) } else if (def->name()->value() == "basetime") { - GetDefNumber(baseTime, def, filename); + GetDefNumber(start_time, def, filename); } else if (def->name()->value() == "time") { - GetDefNumber(time, def, filename); + GetDefNumber(load_time, def, filename); } else if (def->name()->value() == "sitrep") { @@ -472,7 +472,8 @@ CampaignSaveGame::Load(const char* filename) campaign->SetStatus(status); if (sitrep.length()) campaign->SetSituation(sitrep); if (orders.length()) campaign->SetOrders(orders); - campaign->SetLoadTime(time); + campaign->SetLoadTime(load_time); + campaign->SetStartTime(start_time); campaign->LockoutEvents(3600); campaign->Start(); diff --git a/data/content/Campaigns/01/T3.def b/data/content/Campaigns/01/T3.def index 11e0b1f..1f63e4e 100644 --- a/data/content/Campaigns/01/T3.def +++ b/data/content/Campaigns/01/T3.def @@ -9,7 +9,6 @@ objective: "c01.t03.obj" sitrep: "c01.t03.sitrep" start: "01/13:23:00" -stardate: 1084144000 degrees: true diff --git a/data/content/Campaigns/01/T4.def b/data/content/Campaigns/01/T4.def index 4e2e44c..0dcc1f8 100644 --- a/data/content/Campaigns/01/T4.def +++ b/data/content/Campaigns/01/T4.def @@ -9,7 +9,6 @@ objective: "c01.t04.obj" sitrep: "c01.t04.sitrep" start: "02/05:35:00" -stardate: 1084170240 degrees: true diff --git a/data/content/Campaigns/01/campaign.def b/data/content/Campaigns/01/campaign.def index 4e86a1f..4bcd2d1 100644 --- a/data/content/Campaigns/01/campaign.def +++ b/data/content/Campaigns/01/campaign.def @@ -4,8 +4,8 @@ name: "c01.name" desc: "c01.desc" situation: "c01.sitrep" orders: "c01.orders" - -scripted: true +stardate: 1084144000.0 +scripted: true action: { id: 0, diff --git a/data/content/Campaigns/02/campaign.def b/data/content/Campaigns/02/campaign.def index 4c20601..843e17b 100644 --- a/data/content/Campaigns/02/campaign.def +++ b/data/content/Campaigns/02/campaign.def @@ -4,6 +4,7 @@ name: "c02.name" desc: "c02.desc" situation: "c02.sitrep" orders: "c02.orders" +stardate: 17280000.0 combatant: { name: "Terellian Alliance", diff --git a/data/content/Campaigns/03/campaign.def b/data/content/Campaigns/03/campaign.def index 0966a78..70afdfa 100644 --- a/data/content/Campaigns/03/campaign.def +++ b/data/content/Campaigns/03/campaign.def @@ -4,6 +4,7 @@ name: "c03.name" desc: "c03.desc" situation: "c03.sitrep" orders: "c03.orders" +stardate: 22464000.0 combatant: { name: "Terellian Alliance", diff --git a/data/content/Campaigns/04/campaign.def b/data/content/Campaigns/04/campaign.def index 7262b90..684a2c8 100644 --- a/data/content/Campaigns/04/campaign.def +++ b/data/content/Campaigns/04/campaign.def @@ -4,6 +4,7 @@ name: "c04.name" desc: "c04.desc" situation: "c04.sitrep" orders: "c04.orders" +stardate: 27648000.0 combatant: { name: "Terellian Alliance", diff --git a/data/content/Campaigns/05/campaign.def b/data/content/Campaigns/05/campaign.def index cd4ba28..049b331 100644 --- a/data/content/Campaigns/05/campaign.def +++ b/data/content/Campaigns/05/campaign.def @@ -4,6 +4,7 @@ name: "c05.name" desc: "c05.desc" situation: "c05.sitrep" orders: "c05.orders" +stardate: 32832000.0 /******* diff --git a/data/shatter/Campaigns/01/campaign.def b/data/shatter/Campaigns/01/campaign.def index 6c2e727..6e93bc0 100644 --- a/data/shatter/Campaigns/01/campaign.def +++ b/data/shatter/Campaigns/01/campaign.def @@ -27,6 +27,7 @@ situation: orders: "\t* Execute all of the training missions in this campaign." +stardate: 1084144000.0 scripted: true action: { diff --git a/data/shatter/Campaigns/02/campaign.def b/data/shatter/Campaigns/02/campaign.def index 3e4eae8..ff79036 100644 --- a/data/shatter/Campaigns/02/campaign.def +++ b/data/shatter/Campaigns/02/campaign.def @@ -31,6 +31,8 @@ orders: "\t* Apprehend or destroy military units of the Dantari Separatists.\n" "\t* Determine the extent of Hegemony involvement in this conflict.\n" +stardate: 17280000.0 + combatant: { name: "Terellian Alliance", group: { type: carrier_group, id: 6 }, diff --git a/data/shatter/Campaigns/03/campaign.def b/data/shatter/Campaigns/03/campaign.def index d7ba6ca..9a0e103 100644 --- a/data/shatter/Campaigns/03/campaign.def +++ b/data/shatter/Campaigns/03/campaign.def @@ -29,6 +29,8 @@ orders: "\t* Evacuate civilians and government personnel as necessary.\n" "\t* Stop the Hegemony advance until a counterattack can be mounted.\n" +stardate: 22464000.0 + combatant: { name: "Terellian Alliance", group: { type: fleet, id: 4 }, diff --git a/data/shatter/Campaigns/04/campaign.def b/data/shatter/Campaigns/04/campaign.def index 8b3d928..9471d89 100644 --- a/data/shatter/Campaigns/04/campaign.def +++ b/data/shatter/Campaigns/04/campaign.def @@ -20,6 +20,8 @@ orders: "\t* Prepare the region for a general invasion of Tarsus.\n" "\t* Protect Alliance assets in the area.\n" +stardate: 27648000.0 + combatant: { name: "Terellian Alliance", group: { type: fleet, id: 6 }, // Ostara, Tarsus, Kolchev diff --git a/data/shatter/Campaigns/05/campaign.def b/data/shatter/Campaigns/05/campaign.def index 19ee3dc..acfc11b 100644 --- a/data/shatter/Campaigns/05/campaign.def +++ b/data/shatter/Campaigns/05/campaign.def @@ -29,6 +29,8 @@ orders: "\t* Second Fleet: Secure the Radix system.\n" "\t* Both fleets to converge on the Garrison system as soon as possible.\n" +stardate: 32832000.0 + /******* ISHAM -- cgit v1.1