Skip to content

Commit 817e0bc

Browse files
author
lopezloo
committed
Add "coronareflections" property to setWorldSpecialPropertyEnabled
(true by default)
1 parent 3cc3fd3 commit 817e0bc

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

Client/game_sa/CGameSA.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ bool CGameSA::IsCheatEnabled(const char* szCheatName)
603603
if (!strcmp(szCheatName, PROP_UNDERWORLD_WARP))
604604
return IsUnderWorldWarpEnabled();
605605

606+
if (!strcmp(szCheatName, PROP_CORONA_REFLECTIONS))
607+
return IsCoronaReflectionsEnabled();
608+
606609
std::map<std::string, SCheatSA*>::iterator it = m_Cheats.find(szCheatName);
607610
if (it == m_Cheats.end())
608611
return false;
@@ -635,6 +638,12 @@ bool CGameSA::SetCheatEnabled(const char* szCheatName, bool bEnable)
635638
return true;
636639
}
637640

641+
if (!strcmp(szCheatName, PROP_CORONA_REFLECTIONS))
642+
{
643+
SetCoronaReflectionsEnabled(bEnable);
644+
return true;
645+
}
646+
638647
std::map<std::string, SCheatSA*>::iterator it = m_Cheats.find(szCheatName);
639648
if (it == m_Cheats.end())
640649
return false;
@@ -651,6 +660,7 @@ void CGameSA::ResetCheats()
651660
SetMoonEasterEggEnabled(false);
652661
SetExtraAirResistanceEnabled(true);
653662
SetUnderWorldWarpEnabled(true);
663+
SetCoronaReflectionsEnabled(true);
654664

655665
std::map<std::string, SCheatSA*>::iterator it;
656666
for (it = m_Cheats.begin(); it != m_Cheats.end(); it++)
@@ -707,6 +717,25 @@ bool CGameSA::IsUnderWorldWarpEnabled()
707717
return !m_bUnderworldWarp;
708718
}
709719

720+
void CGameSA::SetCoronaReflectionsEnabled(bool bEnabled)
721+
{
722+
// Restore or disable calls to CCoronas::RenderReflections
723+
if(bEnabled) {
724+
MemCpy((void*)0x53DFD8, "\xE8\x53\xD6\x1B\x00", 5);
725+
MemCpy((void*)0x53DCAC, "\xE8\x7F\xD9\x1B\x00", 5);
726+
}
727+
else {
728+
MemSet((void*)0x53DFD8, 0x90, 5);
729+
MemSet((void*)0x53DCAC, 0x90, 5);
730+
}
731+
m_bCoronaReflections = bEnabled;
732+
}
733+
734+
bool CGameSA::IsCoronaReflectionsEnabled()
735+
{
736+
return m_bCoronaReflections;
737+
}
738+
710739
bool CGameSA::GetJetpackWeaponEnabled(eWeaponType weaponType)
711740
{
712741
if (weaponType >= WEAPONTYPE_BRASSKNUCKLE && weaponType < WEAPONTYPE_LAST_WEAPONTYPE)

Client/game_sa/CGameSA.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ extern unsigned int OBJECTDYNAMICINFO_MAX; // default: 160
8585
#define PROP_SNIPER_MOON "snipermoon"
8686
#define PROP_EXTRA_AIR_RESISTANCE "extraairresistance"
8787
#define PROP_UNDERWORLD_WARP "underworldwarp"
88+
#define PROP_CORONA_REFLECTIONS "coronareflections"
8889

8990
struct SCheatSA
9091
{
@@ -409,6 +410,9 @@ class CGameSA : public CGame
409410
bool IsUnderWorldWarpEnabled();
410411
void SetUnderWorldWarpEnabled(bool bEnable);
411412

413+
bool IsCoronaReflectionsEnabled();
414+
void SetCoronaReflectionsEnabled(bool bEnabled);
415+
412416
bool VerifySADataFileNames();
413417
bool PerformChecks();
414418
int& GetCheckStatus() { return m_iCheckStatus; }
@@ -505,6 +509,7 @@ class CGameSA : public CGame
505509
bool m_bASyncLoadingSuspended;
506510
int m_iCheckStatus;
507511
bool m_bUnderworldWarp;
512+
bool m_bCoronaReflections;
508513

509514
static unsigned int& ClumpOffset;
510515
static unsigned long* VAR_SystemTime;

Client/multiplayer_sa/CMultiplayerSA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ void CMultiplayerSA::InitHooks()
15231523

15241524
// Fix corona rain reflections aren't rendering (#2345)
15251525
// By using zBufferFar instead of zBufferNear for corona position
1526-
MemSet((void*)0x6FB9A0, 0x1C, 1);
1526+
MemPut<BYTE>(0x6FB9A0, 0x1C);
15271527

15281528
InitHooks_CrashFixHacks();
15291529

0 commit comments

Comments
 (0)