diff --git a/CREDITS.md b/CREDITS.md index 3dc89b359b..ea1afbf6f3 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -154,6 +154,7 @@ This page lists all the individual contributions to the project by their author. - Event 606: AttachEffect is attaching to a Techno - Linked superweapons - Unit & infantry auto-conversion on ammo change + - 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/YRpp b/YRpp index 5af96790ce..e5cca7465a 160000 --- a/YRpp +++ b/YRpp @@ -1 +1 @@ -Subproject commit 5af96790ce73e4ea068a390c60c124dccbc220e1 +Subproject commit e5cca7465a93a4a3bc8fb3e85e3a4c92e4dff71f diff --git a/docs/AI-Scripting-and-Mapping.md b/docs/AI-Scripting-and-Mapping.md index f6fb168e2c..ea8122f39e 100644 --- a/docs/AI-Scripting-and-Mapping.md +++ b/docs/AI-Scripting-and-Mapping.md @@ -900,3 +900,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],... +... +``` + +#### `19003` Thieved By ... by ID + +- Similar to map event 3, but uses a string ID from the `[Countries]` list instead of an index. + +In `mycampaign.map`: +```ini +[Events] +... +ID=EventCount,...,19003,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 948f47c38f..5c1c98ef4a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -469,6 +469,7 @@ New: - [CellSpread damage check if victim is in air or on floor](New-or-Enhanced-Logics.md#cellspread-enhancement) (by TaranDahl) - OpenTopped range bonus and damage multiplier customization for passengers (by Ollerus) - AutoDeath upon ownership change (by Ollerus) +- 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..23bb396643 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, + ThievedByByID = 19003, + 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 eef6aeb8aa..f6445dd183 100644 --- a/src/Ext/TEvent/Hooks.cpp +++ b/src/Ext/TEvent/Hooks.cpp @@ -100,3 +100,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::ThievedByByID: + 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 = HouseTypeClass::FindIndex(pThis->String); + pThis->EventKind = TriggerEvent::DestroyedUnitsAll; + break; + case PhobosTriggerEvent::DestroyedBuildingsAllByID: + pThis->Value = HouseTypeClass::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 = BuildingTypeClass::FindIndex(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; +}