Skip to content

Commit

Permalink
Update years in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Apr 17, 2023
1 parent 4d908df commit ed0b36f
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 62 deletions.
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ This page lists all the individual contributions to the project by their author.
- Allow iron-curtain effects on infantries
- Break the mindcontrol link when capturing a mind-controlled building with engineer
- Building LightSource tint S/L fix
- Misc code refactor & maintenance, CN doc fix
- Misc code refactor & maintenance, CN doc fixes, bugfixes
- **FlyStar**
- Campaign load screen PCX support
- New condition for automatic self-destruction logic when TechnoTypes exist/don't exist
Expand Down
2 changes: 2 additions & 0 deletions docs/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ DEFINE_HOOK(0x48381D, CellClass_SpreadTiberium_CellSpread, 0x6)
```
- Even if the hook doesn't use `return 0x0` to execute the overriden instructions, you still have to write correct hook size (last parameter of `DEFINE_HOOK` macro) to reduce potential issues if the person editing this hook decides to use `return 0x0`.
- New ingame "entity" classes are to be named with `Class` postfix (like `RadTypeClass`). Extension classes are to be named with `Ext` postfix instead (like `RadTypeExt`).
- Do not pollute the namespace.
- Avoid introducing unnecessary macros if they can be replaced by equivalent `constexpr` or `__forceinline` functions.

```{note}
The styleguide is not exhaustive and may be adjusted in the future.
Expand Down
40 changes: 40 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,46 @@ Pips.SelfHeal.Buildings.Offset=15,10 ; X,Y, pixels relative to default
SelfHealGainType= ; Self-Heal Gain Type Enumeration (none|infantry|units)
```

### Customizable veterancy insignias

- You can now customize veterancy insignia of TechnoTypes.
- `Insignia.(Rookie|Veteran|Elite)` can be used to set a custom insignia file, optionally for each veterancy stage. Like the original / default file, `pips.shp`, they are drawn using `palette.pal` as palette.
- `InsigniaFrame(.Rookie|Veteran|Elite)` can be used to set (zero-based) frame index of the insignia to display, optionally for each veterancy stage. Using -1 uses the default setting. Default settings are -1 (none) for rookie, 14 for veteran and 15 for elite.
- A shorthand `InsigniaFrames` can be used to list them in order from rookie, veteran and elite instead as well. `InsigniaFrame(.Rookie|Veteran|Elite)` takes priority over this.
- Normal insignia can be overridden for specific weapon modes of `Gunner=true` units by setting `Insignia(.Frame/.Frames).WeaponN` where `N` stands for 1-based weapon mode index. If not set, defaults to non-mode specific insignia settings.
- `Insignia.ShowEnemy` controls whether or not the insignia is shown to enemy players. Defaults to `[General]` -> `EnemyInsignia`, which in turn defaults to true.

In `rulesmd.ini`:
```ini
[General]
EnemyInsignia=true ; boolean

[SOMETECHNO] ; TechnoType
Insignia= ; filename - excluding the .shp extension
Insignia.Rookie= ; filename - excluding the .shp extension
Insignia.Veteran= ; filename - excluding the .shp extension
Insignia.Elite= ; filename - excluding the .shp extension
InsigniaFrame=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.WeaponN= ; filename - excluding the .shp extension
Insignia.WeaponN.Rookie= ; filename - excluding the .shp extension
Insignia.WeaponN.Veteran= ; filename - excluding the .shp extension
Insignia.WeaponN.Elite= ; filename - excluding the .shp extension
InsigniaFrame.WeaponN=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames.WeaponN=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.ShowEnemy= ; boolean
```

```{note}
Insignia customization besides the `InsigniaFrames` shorthand should function similarly to the equivalent feature introduced by Ares and takes precedence over it if Phobos is used together with Ares.
```

### Customizable harvester ore gathering animation

![image](_static/images/oregath.gif)
Expand Down
40 changes: 0 additions & 40 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,46 +646,6 @@ AutoFire=false ; boolean
AutoFire.TargetSelf=false ; boolean
```

### Customizable veterancy insignias

- You can now customize veterancy insignia of TechnoTypes.
- `Insignia.(Rookie|Veteran|Elite)` can be used to set a custom insignia file, optionally for each veterancy stage. Like the original / default file, `pips.shp`, they are drawn using `palette.pal` as palette.
- `InsigniaFrame(.Rookie|Veteran|Elite)` can be used to set (zero-based) frame index of the insignia to display, optionally for each veterancy stage. Using -1 uses the default setting. Default settings are -1 (none) for rookie, 14 for veteran and 15 for elite.
- A shorthand `InsigniaFrames` can be used to list them in order from rookie, veteran and elite instead as well. `InsigniaFrame(.Rookie|Veteran|Elite)` takes priority over this.
- Normal insignia can be overridden for specific weapon modes of `Gunner=true` units by setting `Insignia(.Frame/.Frames).WeaponN` where `N` stands for 1-based weapon mode index. If not set, defaults to non-mode specific insignia settings.
- `Insignia.ShowEnemy` controls whether or not the insignia is shown to enemy players. Defaults to `[General]` -> `EnemyInsignia`, which in turn defaults to true.

In `rulesmd.ini`:
```ini
[General]
EnemyInsignia=true ; boolean

[SOMETECHNO] ; TechnoType
Insignia= ; filename - excluding the .shp extension
Insignia.Rookie= ; filename - excluding the .shp extension
Insignia.Veteran= ; filename - excluding the .shp extension
Insignia.Elite= ; filename - excluding the .shp extension
InsigniaFrame=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.WeaponN= ; filename - excluding the .shp extension
Insignia.WeaponN.Rookie= ; filename - excluding the .shp extension
Insignia.WeaponN.Veteran= ; filename - excluding the .shp extension
Insignia.WeaponN.Elite= ; filename - excluding the .shp extension
InsigniaFrame.WeaponN=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames.WeaponN=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.ShowEnemy= ; boolean
```

```{note}
Insignia customization besides the `InsigniaFrames` shorthand should function similarly to the equivalent feature introduced by Ares and takes precedence over it if Phobos is used together with Ares.
```

### Customizable OpenTopped properties

- You can now override global `OpenTopped` transport properties per TechnoType.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = 'Phobos'
copyright = '2022, The Phobos Contributors'
copyright = '2023, The Phobos Contributors'
author = 'The Phobos Contributors'


Expand Down
15 changes: 9 additions & 6 deletions src/Ext/Techno/Hooks.Disguise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ DEFINE_HOOK(0x6F421C, TechnoClass_DefaultDisguise, 0x6) // TechnoClass_DefaultDi
return 0;
}

#define CAN_BLINK_DISGUISE(pTechno) \
HouseClass::IsCurrentPlayerObserver() || EnumFunctions::CanTargetHouse(RulesExt::Global()->DisguiseBlinkingVisibility, HouseClass::CurrentPlayer, pTechno->Owner)
__forceinline bool CanBlinkDisguise(TechnoClass* pTechno)
{
return HouseClass::IsCurrentPlayerObserver()
|| EnumFunctions::CanTargetHouse(RulesExt::Global()->DisguiseBlinkingVisibility, HouseClass::CurrentPlayer, pTechno->Owner);
}

DEFINE_HOOK(0x70EE53, TechnoClass_IsClearlyVisibleTo_BlinkAllyDisguise1, 0xA)
{
Expand All @@ -34,7 +37,7 @@ DEFINE_HOOK(0x70EE53, TechnoClass_IsClearlyVisibleTo_BlinkAllyDisguise1, 0xA)
GET(TechnoClass*, pThis, ESI);
GET(int, accum, EAX);

if (CAN_BLINK_DISGUISE(pThis))
if (CanBlinkDisguise(pThis))
return SkipGameCode;
else if (accum && !pThis->Owner->IsControlledByCurrentPlayer())
return Return;
Expand All @@ -48,7 +51,7 @@ DEFINE_HOOK(0x70EE6A, TechnoClass_IsClearlyVisibleTo_BlinkAllyDisguise2, 0x6)

GET(TechnoClass*, pThis, ESI);

if (CAN_BLINK_DISGUISE(pThis))
if (CanBlinkDisguise(pThis))
return ContinueChecks;

return DisallowBlinking;
Expand All @@ -60,7 +63,7 @@ DEFINE_HOOK(0x7062F5, TechnoClass_TechnoClass_DrawObject_BlinkAllyDisguise, 0x6)

GET(TechnoClass*, pThis, ESI);

if (CAN_BLINK_DISGUISE(pThis))
if (CanBlinkDisguise(pThis))
return ContinueChecks;

return DisallowBlinking;
Expand All @@ -72,7 +75,7 @@ DEFINE_HOOK(0x70EDAD, TechnoClass_DisguiseBlitFlags_BlinkAllyDisguise, 0x6)

GET(TechnoClass*, pThis, EDI);

if (CAN_BLINK_DISGUISE(pThis))
if (CanBlinkDisguise(pThis))
return AllowBlinking;

return DisallowBlinking;
Expand Down
12 changes: 7 additions & 5 deletions src/Ext/Techno/Hooks.Shield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#include <Ext/WarheadType/Body.h>
#include <Ext/TEvent/Body.h>

bool bSkipLowDamageCheck = false;

namespace RD
{
bool SkipLowDamageCheck = false;
}
// #issue 88 : shield logic
DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
{
Expand All @@ -35,17 +37,17 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
}

if (nDamageLeft == 0)
bSkipLowDamageCheck = true;
RD::SkipLowDamageCheck = true;
}
}
return 0;
}

DEFINE_HOOK(0x7019D8, TechnoClass_ReceiveDamage_SkipLowDamageCheck, 0x5)
{
if (bSkipLowDamageCheck)
if (RD::SkipLowDamageCheck)
{
bSkipLowDamageCheck = false;
RD::SkipLowDamageCheck = false;
}
else
{
Expand Down
19 changes: 14 additions & 5 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,21 @@ void TechnoTypeExt::ExtData::ParseBurstFLHs(INI_EX& exArtINI, const char* pArtSe
}
}

//TODO: YRpp this with proper casting
TechnoTypeClass* TechnoTypeExt::GetTechnoType(ObjectTypeClass* pType)
{
if (pType->WhatAmI() == AbstractType::AircraftType ||
pType->WhatAmI() == AbstractType::BuildingType ||
pType->WhatAmI() == AbstractType::InfantryType ||
pType->WhatAmI() == AbstractType::UnitType)
enum class IUnknownVtbl : DWORD
{
AircraftType = 0x7E2868,
BuildingType = 0x7E4570,
InfantryType = 0x7EB610,
UnitType = 0x7F6218,
};
auto const vtThis = static_cast<IUnknownVtbl>(VTABLE_GET(pType));
if (vtThis == IUnknownVtbl::AircraftType ||
vtThis == IUnknownVtbl::BuildingType ||
vtThis == IUnknownVtbl::InfantryType ||
vtThis == IUnknownVtbl::UnitType)
{
return static_cast<TechnoTypeClass*>(pType);
}
Expand Down Expand Up @@ -247,7 +256,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

char tempBuffer[32];

if (this->OwnerObject()->Gunner)
if (this->OwnerObject()->Gunner && this->Insignia_Weapon.empty())
{
int weaponCount = this->OwnerObject()->WeaponCount;
this->Insignia_Weapon.resize(weaponCount);
Expand Down
11 changes: 7 additions & 4 deletions src/Ext/WarheadType/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

#pragma region DETONATION

bool DetonationInDamageArea = true;
namespace Detonation
{
bool InDamageArea = true;
}

DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6)
{
Expand All @@ -30,20 +33,20 @@ DEFINE_HOOK(0x46920B, BulletClass_Detonate, 0x6)
pWHExt->Detonate(pOwner, pDecidedHouse, pBulletExt, *pCoords);
}

DetonationInDamageArea = false;
Detonation::InDamageArea = false;

return 0;
}

DEFINE_HOOK(0x46A290, BulletClass_Detonate_Return, 0x5)
{
DetonationInDamageArea = true;
Detonation::InDamageArea = true;
return 0;
}

DEFINE_HOOK(0x489286, MapClass_DamageArea, 0x6)
{
if (DetonationInDamageArea)
if (Detonation::InDamageArea)
{
// GET(const int, Damage, EDX);
// GET_BASE(const bool, AffectsTiberium, 0x10);
Expand Down

0 comments on commit ed0b36f

Please sign in to comment.