Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed an issue that jumpjet infantries' shadow is always drawn even if they are cloaked.
- Fixed an issue that technos head to building's dock even they are not going to dock.
- Fixed an issue that the jumpjet vehicles cannot stop correctly after going berserk.
- Fixed the issue where Ares' `Flash.Duration` cannot override the weapon's repair flash effect.

```{note}
The described behavior is a replica of and is compliant with XNA CnCNet Client's multiplayer save game support.
Expand Down
28 changes: 28 additions & 0 deletions src/Ext/TechnoType/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Body.h"
#include <Ext/House/Body.h>
#include <Ext/AnimType/Body.h>
#include <Ext/WarheadType/Body.h>

DEFINE_HOOK(0x73D223, UnitClass_DrawIt_OreGath, 0x6)
{
Expand Down Expand Up @@ -127,3 +128,30 @@ DEFINE_HOOK(0x71464A, TechnoTypeClass_ReadINI_Speed, 0x7)

return SkipGameCode;
}

DEFINE_HOOK(0x5F547E, ObjectClass_ReceiveDamage_FlashDuration, 0x6)
{
GET(ObjectClass*, pThis, ESI);
GET(int, nNewHealth, EDX);
LEA_STACK(args_ReceiveDamage*, pArgs, STACK_OFFSET(0x24, 0x4));
enum { SkipGameCode = 0x5F545C };

if (pThis->Health == nNewHealth)
return SkipGameCode;

int nFlashDuration = 7;
if (auto pWH = pArgs->WH)
{
if (auto pWHEXT = WarheadTypeExt::ExtMap.Find(pWH))
{
nFlashDuration = pWHEXT->Flash_Duration.Get(nFlashDuration);
}
}

if (nFlashDuration > 0)
{
pThis->Flash(nFlashDuration);
}

return SkipGameCode;
}
2 changes: 2 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
INI_EX exINI(pINI);

// Miscs
this->Flash_Duration.Read(exINI, pSection, "Flash.Duration");
this->Reveal.Read(exINI, pSection, "Reveal");
this->CreateGap.Read(exINI, pSection, "CreateGap");
this->TransactMoney.Read(exINI, pSection, "TransactMoney");
Expand Down Expand Up @@ -402,6 +403,7 @@ template <typename T>
void WarheadTypeExt::ExtData::Serialize(T& Stm)
{
Stm
.Process(this->Flash_Duration)
.Process(this->Reveal)
.Process(this->CreateGap)
.Process(this->TransactMoney)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class WarheadTypeExt
{
public:

Nullable<int> Flash_Duration;
Valueable<int> Reveal;
Valueable<int> CreateGap;
Valueable<int> TransactMoney;
Expand Down Expand Up @@ -229,6 +230,7 @@ class WarheadTypeExt

public:
ExtData(WarheadTypeClass* OwnerObject) : Extension<WarheadTypeClass>(OwnerObject)
, Flash_Duration { 0 }
, Reveal { 0 }
, CreateGap { 0 }
, TransactMoney { 0 }
Expand Down
Loading