Hook to fully wrap the EMPulseClass::Initialize for custom effects

Bug #895469 reported by DCoder DCoder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ares
Fix Released
Wishlist
DCoder DCoder

Bug Description

Since bug:856 wants more elaborate effects, a full wrap will be more effective than trying to hook in multiple times.

Revision history for this message
AlexB (alexander-b) wrote :

Indeed, creating EMPulseClass with negative EMP.Duration doesn't trigger anything. So no way to deal negative damage.

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

And here we go:
DEFINE_HOOK(4C54E0, EMPulseClass_Initialize, 6)
{
 GET(EMPulseClass *, pThis, ECX);
 GET_STACK(TechnoClass *, pGenerator, 0x4);
 return 0x4C58B6;
}
This is called inside EMPulseClass::EMPulseClass.
TS implementation does the following:
for each AircraftClass::Array in range and InAir
 ->Crash()

for each UnitClass::Array in range
 ->EMPDurationRemaining
 if ->Locomotion->Is_Moving()
  ->Locomotion->Stop_Moving()
 ->Locomotion->Power_Off()
 ->Anim

for each BuildingClass::Array in range
 ->EMPDurationRemaining
 ->DisableStuff()
 if ->Radar
  ->Owner->RadarOutage
 ->Anim

more details will be added if necessary.

Revision history for this message
AlexB (alexander-b) wrote :

Some more hooks needed:
SuperWeaponClass::Update to disallow the timer to decrease when building EMP'd.
Propably BuildingClass::Update? The loop that reactivates the robot tanks when a control center gets back online. => Say no, if still EMP'd

Revision history for this message
DCoder DCoder (dcoder1337) wrote :

For the first one, use the SuperClass::SetOnHold I just committed to YR++ r304.
For the second one, see bug:866.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.