Skip to content

Commit

Permalink
Fix a glitch related to incorrect target setting for missiles (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Belonit authored Dec 29, 2023
1 parent a3858a0 commit 2c8c74e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This page lists all the individual contributions to the project by their author.
- Building Placement Preview Adjustment
- Check for Changelog/Documentation/Credits in Pull Requests
- Fix position and layer of info tip and reveal production cameo on selected building
- Fix a glitch related to incorrect target setting for missiles
- **Kerbiter (Metadorius)**:
- SHP debris respect `Shadow` fix
- Building upgrades enhancement
Expand Down
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- It is now possible to enable `Verses` and `PercentAtMax` to be applied on negative damage by setting `ApplyModifiersOnNegativeDamage` to true on the Warhead.
- Attached animations on flying units now have their layer updated immediately after the parent unit, if on same layer they always draw above the parent.
- Fixed the issue where the powered anims of `Powered`/`PoweredSpecial` buildings cease to update when being captured by enemies.
- Fix a glitch related to incorrect target setting for missiles.
## Fixes / interactions with other extensions

- All forms of type conversion (including Ares') now correctly update `OpenTopped` state of passengers in transport that is converted.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ Vanilla fixes:
- Fixed position and layer of info tip and reveal production cameo on selected building (by Belonit)
- Fixed `TurretOffset` to be supported for SHP vehicles (by TwinkleStar)
- `Powered`/`PoweredSpecial` buildings' powered anims will update as usual when being captured by enemies (by Trsdy)
- Fixed a glitch related to incorrect target setting for missiles (by Belonit)
Phobos fixes:
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)
Expand Down
17 changes: 17 additions & 0 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
#include <UnitClass.h>
#include <OverlayTypeClass.h>
#include <ScenarioClass.h>
#include <SpawnManagerClass.h>
#include <VoxelAnimClass.h>
#include <BulletClass.h>
#include <HouseClass.h>
#include <FlyLocomotionClass.h>
#include <JumpjetLocomotionClass.h>
#include <BombClass.h>
#include <WarheadTypeClass.h>

#include <Ext/Rules/Body.h>
#include <Ext/BuildingType/Body.h>
#include <Ext/Techno/Body.h>
Expand Down Expand Up @@ -796,3 +798,18 @@ bool __fastcall BuildingClass_SetOwningHouse_Wrapper(BuildingClass* pThis, void*
DEFINE_JUMP(VTABLE, 0x7E4290, GET_OFFSET(BuildingClass_SetOwningHouse_Wrapper));
DEFINE_JUMP(LJMP, 0x6E0BD4, 0x6E0BFE);
DEFINE_JUMP(LJMP, 0x6E0C1D, 0x6E0C8B);//Simplify TAction 36

// Fix a glitch related to incorrect target setting for missiles
// Author: Belonit
DEFINE_HOOK(0x6B75AC, SpawnManagerClass_AI_SetDestinationForMissiles, 0x5)
{
GET(SpawnManagerClass*, pSpawnManager, ESI);
GET(TechnoClass*, pSpawnTechno, EDI);

CoordStruct coord = pSpawnManager->Target->GetCenterCoords();
CellClass* pCellDestination = MapClass::Instance->TryGetCellAt(coord);

pSpawnTechno->SetDestination(pCellDestination, true);

return 0x6B75BC;
}

0 comments on commit 2c8c74e

Please sign in to comment.