diff --git a/CREDITS.md b/CREDITS.md index 7328aa6ce6..c15a146fce 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 events in the 19000 range that are copies of the original events 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 e7a6f81cc5..12c3490877 100644 --- a/docs/AI-Scripting-and-Mapping.md +++ b/docs/AI-Scripting-and-Mapping.md @@ -881,3 +881,279 @@ In `mycampaign.map`: ID=EventCount,...,606,2,0,[AttachEffectType],... ... ``` + +#### `19001` Entered By ... by ID + +- Similar to map event 1, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19001,2,0,[ID],... +... +``` + +#### `19002` Spied By ... by ID + +- Similar to map event 2, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19002,2,0,[ID],... +... +``` + +#### `19005` House Discovered ... by ID + +- Similar to map event 5, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19005,2,0,[ID],... +... +``` + +#### `19009` Destroyed, Units, All ... by ID + +- Similar to map event 9, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19009,2,0,[ID],... +... +``` + +#### `19010` Destroyed, Buildings, All ... by ID + +- Similar to map event 10, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19010,2,0,[ID],... +... +``` + +#### `19011` Destroyed, All ... by ID + +- Similar to map event 11, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19011,2,0,[ID],... +... +``` + +#### `19019` Build building type ... by ID + +- Similar to map event 19, but uses a string ID from the `[BuildingTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19019,2,0,[ID],... +... +``` + +#### `19020` Build unit type ... by ID + +- Similar to map event 20, but uses a string ID from the `[VehicleTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19020,2,0,[ID],... +... +``` + +#### `19021` Build infantry type ... by ID + +- Similar to map event 21, but uses a string ID from the `[InfantryTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19021,2,0,[ID],... +... +``` + +#### `19022` Build aircraft type ... by ID + +- Similar to map event 22, but uses a string ID from the `[AircraftTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19022,2,0,[ID],... +... +``` + +#### `19024` Zone entry by ... by ID + +- Similar to map event 24, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19024,2,0,[ID],... +... +``` + +#### `19025` Crosses horizontal line ... by ID + +- Similar to map event 25, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19025,2,0,[ID],... +... +``` + +#### `19026` Crosses vertical line ... by ID + +- Similar to map event 26, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19026,2,0,[ID],... +... +``` + +#### `19030` Low power ... by ID + +- Similar to map event 30, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19030,2,0,[ID],... +... +``` + +#### `19032` Building exists ... by ID + +- Similar to map event 32, but uses a string ID from the `[BuildingTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19032,2,0,[ID],... +... +``` + +#### `19044` Attacked by (house) ... by ID + +- Similar to map event 44, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19044,2,0,[ID],... +... +``` + +#### `19053` Spy entering as House ... by ID + +- Similar to map event 53, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19053,2,0,[ID],... +... +``` + +#### `19054` Spy entering as Infantry ... by ID + +- Similar to map event 54, but uses a string ID from the `[InfantryTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19054,2,0,[ID],... +... +``` + +#### `19055` Destroyed Units, Naval ... by ID + +- Similar to map event 55, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19055,2,0,[ID],... +... +``` + +#### `19056` Destroyed Units, Land ... by ID + +- Similar to map event 56, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19056,2,0,[ID],... +... +``` + +#### `19057`Building does not exist ... by ID + +- Similar to map event 57, but uses a string ID from the `[BuildingTypes]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19057,2,0,[ID],... +... +``` + +#### `19058` Power Full ... by ID + +- Similar to map event 58, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19058,2,0,[ID],... +... +``` + +#### `19059` Entered or Overflown By ... by ID + +- Similar to map event 59, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19059,2,0,[ID],... +... +``` diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 2c9e5186c4..72ff7b44e2 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 (by TaranDahl) +- New map events in the 19000 range that are copies of the original events 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/TEvent/Body.h b/src/Ext/TEvent/Body.h index 553494e697..cb580c89e9 100644 --- a/src/Ext/TEvent/Body.h +++ b/src/Ext/TEvent/Body.h @@ -56,6 +56,30 @@ enum PhobosTriggerEvent CellHasAnyTechnoTypeFromList = 605, AttachedIsUnderAttachedEffect = 606, + EnteredByByID = 19001, + SpiedByByID = 19002, + HouseDiscoveredByID = 19005, + DestroyedUnitsAllByID = 19009, + DestroyedBuildingsAllByID = 19010, + DestroyedAllByID = 19011, + BuildBuildingTypeByID = 19019, + BuildUnitTypeByID = 19020, + BuildInfantryTypeByID = 19021, + BuildAircraftTypeByID = 19022, + ZoneEntryByByID = 19024, + CrossesHorizontalLineByID = 19025, + CrossesVerticalLineByID = 19026, + LowPowerByID = 19030, + BuildingExistsByID = 19032, + AttackedByHouseByID = 19044, + SpyAsHouseByID = 19053, + SpyAsInfantryByID = 19054, + DestroyedUnitsNavalByID = 19055, + DestroyedUnitsLandByID = 19056, + BuildingDoesNotExistByID = 19057, + PowerFullByID = 19058, + EnteredOrOverflownByByID = 19059, + _DummyMaximum, }; diff --git a/src/Ext/TEvent/Hooks.cpp b/src/Ext/TEvent/Hooks.cpp index 1fddc8ef26..9169964f03 100644 --- a/src/Ext/TEvent/Hooks.cpp +++ b/src/Ext/TEvent/Hooks.cpp @@ -83,3 +83,109 @@ DEFINE_HOOK(0x71ECE1, TriggerClass_SpyAsInfantryOrHouse, 0x8) // SpyAsInfantry return 0x71F163; } + +DEFINE_HOOK(0x71F58B, TEventClass_ReadINI_MaskedTEvents, 0x7) +{ + REF_STACK(TEventClass*, pThis, 0x4); + + switch (static_cast(pThis->EventKind)) + { + case PhobosTriggerEvent::EnteredByByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::EnteredBy; + break; + case PhobosTriggerEvent::SpiedByByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::SpiedBy; + break; + case PhobosTriggerEvent::HouseDiscoveredByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::HouseDiscovered; + break; + case PhobosTriggerEvent::DestroyedUnitsAllByID: + pThis->Value = UnitTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedUnitsAll; + break; + case PhobosTriggerEvent::DestroyedBuildingsAllByID: + pThis->Value = BuildingTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedBuildingsAll; + break; + case PhobosTriggerEvent::DestroyedAllByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedAll; + break; + case PhobosTriggerEvent::BuildBuildingTypeByID: + pThis->Value = BuildingTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::BuildBuildingType; + break; + case PhobosTriggerEvent::BuildUnitTypeByID: + pThis->Value = UnitTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::BuildUnitType; + break; + case PhobosTriggerEvent::BuildInfantryTypeByID: + pThis->Value = InfantryTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::BuildInfantryType; + break; + case PhobosTriggerEvent::BuildAircraftTypeByID: + pThis->Value = AircraftTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::BuildAircraftType; + break; + case PhobosTriggerEvent::ZoneEntryByByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::ZoneEntryBy; + break; + case PhobosTriggerEvent::CrossesHorizontalLineByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::CrossesHorizontalLine; + break; + case PhobosTriggerEvent::CrossesVerticalLineByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::CrossesVerticalLine; + break; + case PhobosTriggerEvent::LowPowerByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::LowPower; + break; + case PhobosTriggerEvent::BuildingExistsByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::BuildingExists; + break; + case PhobosTriggerEvent::AttackedByHouseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::AttackedByHouse; + break; + case PhobosTriggerEvent::SpyAsHouseByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::SpyAsHouse; + break; + case PhobosTriggerEvent::SpyAsInfantryByID: + pThis->Value = InfantryTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::SpyAsInfantry; + break; + case PhobosTriggerEvent::DestroyedUnitsNavalByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedUnitsNaval; + break; + case PhobosTriggerEvent::DestroyedUnitsLandByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedUnitsLand; + break; + case PhobosTriggerEvent::BuildingDoesNotExistByID: + pThis->Value = BuildingTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::BuildingDoesNotExist; + break; + case PhobosTriggerEvent::PowerFullByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::PowerFull; + break; + case PhobosTriggerEvent::EnteredOrOverflownByByID: + pThis->Value = HouseTypeClass::FindIndexOfName(pThis->String); + pThis->EventKind = TriggerEvent::EnteredOrOverflownBy; + break; + + default: + break; + } + + return 0; +}