diff --git a/CREDITS.md b/CREDITS.md index 16cb1d5396..4346b5390b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -152,6 +152,7 @@ This page lists all the individual contributions to the project by their author. - Warhead activation target health thresholds enhancements - Event 606: AttachEffect is attaching to a Techno - Linked superweapons + - New map actions in the 19000 range that are copies of the original actions but using ID entries instead of indexes - **Starkku**: - Misc. minor bugfixes & improvements - AI script actions: diff --git a/docs/AI-Scripting-and-Mapping.md b/docs/AI-Scripting-and-Mapping.md index 4e31d7e494..e04747166f 100644 --- a/docs/AI-Scripting-and-Mapping.md +++ b/docs/AI-Scripting-and-Mapping.md @@ -735,6 +735,342 @@ ID=ActionCount,[Action1],802,0,[Unique ID],0,0,0,0,A,[ActionX] ... ``` +### `19001` Winner Is... by ID + +- Similar to map action 1, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19001,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19002` Loser Is... by ID + +- Similar to map action 2, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19002,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19003` Production Begins... by ID + +- Similar to map action 3, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19003,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19006` All to Hunt... by ID + +- Similar to map action 6, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19006,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19009` Fire Sale... by ID + +- Similar to map action 9, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19009,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19013` Autocreate Begins... by ID + +- Similar to map action 13, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19013,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19014` Change House... by ID + +- Similar to map action 14, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19014,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19020` Play Music Theme... by ID + +- Similar to map action 20, but uses a string ID from the `[Themes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19020,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19033` Add One-Time Special Weapon... by ID + +- Similar to map action 33, but uses a string ID from the `[SuperWeaponTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19033,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19034` Add Repeating Special Weapon... by ID + +- Similar to map action 34, but uses a string ID from the `[SuperWeaponTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19034,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19036` All Change House... by ID + +- Similar to map action 36, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19036,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19037` Make Ally... by ID + +- Similar to map action 37, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19037,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19038` Make Enemy... by ID + +- Similar to map action 38, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19038,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19041` Play Anim at... by ID + +- Similar to map action 41, but uses a string ID from the `[Animations]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19041,4,[Unique ID],0,0,0,0,[WaypointIndex],[ActionX] +... +``` + +### `19042` Do Explosion at... by ID + +- Similar to map action 42, but uses a string ID from the `[Weapons]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19042,4,[Unique ID],0,0,0,0,[WaypointIndex],[ActionX] +... +``` + +### `19043` Create VoxelAnim at... by ID + +- Similar to map action 43, but uses a string ID from the `[VoxelAnims]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19043,4,[Unique ID],0,0,0,0,[WaypointIndex],[ActionX] +... +``` + +### `19074` AI Triggers Begin... by ID + +- Similar to map action 74, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19074,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19075` AI Triggers Stop... by ID + +- Similar to map action 75, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19075,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19088` ParticleSystem Anim at... by ID + +- Similar to map action 88, but uses a string ID from the `[ParticleSystems]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19088,4,[Unique ID],0,0,0,0,[WaypointIndex],[ActionX] +... +``` + +### `19113` Make House Cheer... by ID + +- Similar to map action 113, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19113,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19119` Destroy All of... by ID + +- Similar to map action 119, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19119,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19120` Destroy All Buildings of... by ID + +- Similar to map action 120, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19120,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19121` Destroy All Land Units of... by ID + +- Similar to map action 121, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19121,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19122` Destroy All Naval Units of... by ID + +- Similar to map action 122, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19122,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19123` Mind Control Base of... by ID + +- Similar to map action 123, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19123,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19124` Restore Mind Controlled Base to... by ID + +- Similar to map action 124, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19124,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19126` Restore Starting Technos of... by ID + +- Similar to map action 126, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19126,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + +### `19130` Restore Starting Buildings of... by ID + +- Similar to map action 130, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Actions] +... +ID=ActionCount,[Action1],19130,4,[Unique ID],0,0,0,0,A,[ActionX] +... +``` + ## Trigger events ### `500-511` Variable comparation diff --git a/docs/Whats-New.md b/docs/Whats-New.md index b36ab3b5fc..cf5a94be4a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -457,6 +457,7 @@ New: - Fast access structure (by FlyStar) - Toggle off laser trail and shake effects (by Ollerus) - [Dehardcode the `ZAdjust` of warhead anim](Fixed-or-Improved-Logics.md#dehardcode-the-zadjust-of-warhead-anim) (by TaranDahl) +- New map actions in the 19000 range that are copies of the original actions but using ID entries instead of indexes (by FS-21) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/TAction/Body.h b/src/Ext/TAction/Body.h index 72bf78126f..5e040d0366 100644 --- a/src/Ext/TAction/Body.h +++ b/src/Ext/TAction/Body.h @@ -27,6 +27,35 @@ enum class PhobosTriggerAction : unsigned int CreateBannerLocal = 800, // any banner w/ local variable CreateBannerGlobal = 801, // any banner w/ global variable DeleteBanner = 802, + + WinByID = 19001, + LoseByID = 19002, + ProductionBeginsByID = 19003, + AllToHuntByID = 19006, + FireSaleByID = 19009, + AutocreateBeginsByID = 19013, + ChangeHouseByID = 19014, + PlayMusicThemeByID = 19020, + AddOneTimeSuperWeaponByID = 19033, + AddRepeatingSuperWeaponByID = 19034, + AllChangeHouseByID = 19036, + MakeAllyByID = 19037, + MakeEnemyByID = 19038, + PlayAnimAtByID = 19041, + DoExplosionAtByID = 19042, + CreateVoxelAnimByID = 19043, + AITriggersBeginByID = 19074, + AITriggersStopByID = 19075, + ParticleAnimByID = 19088, + MakeHouseCheerByID = 19113, + DestroyAllByID = 19119, + DestroyAllBuildingsByID = 19120, + DestroyAllLandUnitsByID = 19121, + DestroyAllNavalUnitsByID = 19122, + MindControlBaseByID = 19123, + RestoreMindControlledBaseByID = 19124, + RestoreStartingUnitsByID = 19126, + RestoreStartingBuildingsByID = 19130, }; class TActionExt diff --git a/src/Ext/TAction/Hooks.cpp b/src/Ext/TAction/Hooks.cpp index 300294e217..9e0d125aa3 100644 --- a/src/Ext/TAction/Hooks.cpp +++ b/src/Ext/TAction/Hooks.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -131,3 +132,130 @@ DEFINE_HOOK(0x6E2368, TActionClass_PlayAnimAt, 0x7) return SkipGameCode; } + +DEFINE_HOOK(0x6DD791, TActionClass_ReadINI_MaskedTActions, 0xB) +{ + GET(TActionClass*, pThis, EBP); + + switch (static_cast(pThis->ActionKind)) + { + case PhobosTriggerAction::WinByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::Win; + break; + case PhobosTriggerAction::LoseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::Lose; + break; + case PhobosTriggerAction::ProductionBeginsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::ProductionBegins; + break; + case PhobosTriggerAction::AllToHuntByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::AllToHunt; + break; + case PhobosTriggerAction::FireSaleByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::FireSale; + break; + // Action 10 "Play movie", not possible yet because YRpp doesn't have code so no 19010 :-( + case PhobosTriggerAction::AutocreateBeginsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::AutocreateBegins; + break; + case PhobosTriggerAction::ChangeHouseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::ChangeHouse; + break; + case PhobosTriggerAction::PlayMusicThemeByID: + pThis->Value = ThemeClass::Instance.FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::PlayMusicTheme; + break; + case PhobosTriggerAction::AddOneTimeSuperWeaponByID: + pThis->Value = SuperWeaponTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::AddOneTimeSuperWeapon; + break; + case PhobosTriggerAction::AddRepeatingSuperWeaponByID: + pThis->Value = SuperWeaponTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::AddRepeatingSuperWeapon; + break; + case PhobosTriggerAction::AllChangeHouseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::AllChangeHouse; + break; + case PhobosTriggerAction::MakeAllyByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::MakeAlly; + break; + case PhobosTriggerAction::MakeEnemyByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::MakeEnemy; + break; + case PhobosTriggerAction::PlayAnimAtByID: + pThis->Value = AnimTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::PlayAnimAt; + break; + case PhobosTriggerAction::DoExplosionAtByID: + pThis->Value = WeaponTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::DoExplosionAt; + break; + case PhobosTriggerAction::CreateVoxelAnimByID: + pThis->Value = VoxelAnimTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::CreateVoxelAnim; + break; + case PhobosTriggerAction::AITriggersBeginByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::AITriggersBegin; + break; + case PhobosTriggerAction::AITriggersStopByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::AITriggersStop; + break; + case PhobosTriggerAction::ParticleAnimByID: + pThis->Value = ParticleSystemTypeClass::FindIndex(pThis->Text); + pThis->ActionKind = TriggerAction::ParticleAnim; + break; + case PhobosTriggerAction::MakeHouseCheerByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::MakeHouseCheer; + break; + case PhobosTriggerAction::DestroyAllByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::DestroyAll; + break; + case PhobosTriggerAction::DestroyAllBuildingsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::DestroyAllBuildings; + break; + case PhobosTriggerAction::DestroyAllLandUnitsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::DestroyAllLandUnits; + break; + case PhobosTriggerAction::DestroyAllNavalUnitsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::DestroyAllNavalUnits; + break; + case PhobosTriggerAction::MindControlBaseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::MindControlBase; + break; + case PhobosTriggerAction::RestoreMindControlledBaseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::RestoreMindControlledBase; + break; + case PhobosTriggerAction::RestoreStartingUnitsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::RestoreStartingUnits; + break; + case PhobosTriggerAction::RestoreStartingBuildingsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->Text); + pThis->ActionKind = TriggerAction::RestoreStartingBuildings; + break; + + default: + break; + } + + return 0; +}