Skip to content

Commit 63cbc96

Browse files
Synchronize changes from 1.6 master branch [ci skip]
4a746ec Add roadsignstext special world property (#3385)
2 parents ef8fc26 + 4a746ec commit 63cbc96

File tree

11 files changed

+51
-0
lines changed

11 files changed

+51
-0
lines changed

Client/game_sa/CGameSA.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,17 @@ void CGameSA::SetFireballDestructEnabled(bool isEnabled)
729729
m_isFireballDestructEnabled = isEnabled;
730730
}
731731

732+
void CGameSA::SetRoadSignsTextEnabled(bool isEnabled)
733+
{
734+
if (isEnabled == m_isRoadSignsTextEnabled)
735+
return;
736+
737+
// Skip JMP to CCustomRoadsignMgr::RenderRoadsignAtomic
738+
MemPut<BYTE>(0x5342ED, isEnabled ? 0xEB : 0x74);
739+
740+
m_isRoadSignsTextEnabled = isEnabled;
741+
}
742+
732743
bool CGameSA::PerformChecks()
733744
{
734745
std::map<std::string, SCheatSA*>::iterator it;

Client/game_sa/CGameSA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ class CGameSA : public CGame
219219
bool IsFireballDestructEnabled() const noexcept override { return m_isFireballDestructEnabled; }
220220
void SetFireballDestructEnabled(bool isEnabled) override;
221221

222+
bool IsRoadSignsTextEnabled() const noexcept override { return m_isRoadSignsTextEnabled; }
223+
void SetRoadSignsTextEnabled(bool isEnabled) override;
224+
222225
unsigned long GetMinuteDuration();
223226
void SetMinuteDuration(unsigned long ulTime);
224227

@@ -336,6 +339,7 @@ class CGameSA : public CGame
336339
bool m_areWaterCreaturesEnabled{true};
337340
bool m_isBurnFlippedCarsEnabled{true};
338341
bool m_isFireballDestructEnabled{true};
342+
bool m_isRoadSignsTextEnabled{true};
339343

340344
static unsigned int& ClumpOffset;
341345

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6091,6 +6091,9 @@ bool CClientGame::SetWorldSpecialProperty(WorldSpecialProperty property, bool is
60916091
case WorldSpecialProperty::FIREBALLDESTRUCT:
60926092
g_pGame->SetFireballDestructEnabled(isEnabled);
60936093
return true;
6094+
case WorldSpecialProperty::ROADSIGNSTEXT:
6095+
g_pGame->SetRoadSignsTextEnabled(isEnabled);
6096+
return true;
60946097
}
60956098
return false;
60966099
}
@@ -6122,6 +6125,8 @@ bool CClientGame::IsWorldSpecialProperty(WorldSpecialProperty property)
61226125
return g_pGame->IsBurnFlippedCarsEnabled();
61236126
case WorldSpecialProperty::FIREBALLDESTRUCT:
61246127
return g_pGame->IsFireballDestructEnabled();
6128+
case WorldSpecialProperty::ROADSIGNSTEXT:
6129+
return g_pGame->IsRoadSignsTextEnabled();
61256130
}
61266131
return false;
61276132
}

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
23872387
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::WATERCREATURES, wsProps.data.watercreatures);
23882388
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::BURNFLIPPEDCARS, wsProps.data.burnflippedcars);
23892389
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FIREBALLDESTRUCT, wsProps.data2.fireballdestruct);
2390+
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::ROADSIGNSTEXT, wsProps.data3.roadsignstext);
23902391

23912392
float fJetpackMaxHeight = 100;
23922393
if (!bitStream.Read(fJetpackMaxHeight))

Client/sdk/game/CGame.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ class __declspec(novtable) CGame
217217
virtual bool IsFireballDestructEnabled() const noexcept = 0;
218218
virtual void SetFireballDestructEnabled(bool isEnabled) = 0;
219219

220+
virtual bool IsRoadSignsTextEnabled() const noexcept = 0;
221+
virtual void SetRoadSignsTextEnabled(bool isEnabled) = 0;
222+
220223
virtual CWeapon* CreateWeapon() = 0;
221224
virtual CWeaponStat* CreateWeaponStat(eWeaponType weaponType, eWeaponSkill weaponSkill) = 0;
222225

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
246246
m_WorldSpecialProps[WorldSpecialProperty::WATERCREATURES] = true;
247247
m_WorldSpecialProps[WorldSpecialProperty::BURNFLIPPEDCARS] = true;
248248
m_WorldSpecialProps[WorldSpecialProperty::FIREBALLDESTRUCT] = true;
249+
m_WorldSpecialProps[WorldSpecialProperty::ROADSIGNSTEXT] = true;
249250

250251
m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true;
251252
m_JetpackWeapons[WEAPONTYPE_TEC9] = true;

Server/mods/deathmatch/logic/packets/CMapInfoPacket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ bool CMapInfoPacket::Write(NetBitStreamInterface& BitStream) const
189189
wsProps.data.watercreatures = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::WATERCREATURES);
190190
wsProps.data.burnflippedcars = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::BURNFLIPPEDCARS);
191191
wsProps.data2.fireballdestruct = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::FIREBALLDESTRUCT);
192+
wsProps.data3.roadsignstext = g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::ROADSIGNSTEXT);
192193
BitStream.Write(&wsProps);
193194
}
194195

Shared/mods/deathmatch/logic/Enums.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ ADD_ENUM(WorldSpecialProperty::CORONAZTEST, "coronaztest")
9898
ADD_ENUM(WorldSpecialProperty::WATERCREATURES, "watercreatures")
9999
ADD_ENUM(WorldSpecialProperty::BURNFLIPPEDCARS, "burnflippedcars")
100100
ADD_ENUM(WorldSpecialProperty::FIREBALLDESTRUCT, "fireballdestruct")
101+
ADD_ENUM(WorldSpecialProperty::ROADSIGNSTEXT, "roadsignstext")
101102
IMPLEMENT_ENUM_CLASS_END("world-special-property")
102103

103104
IMPLEMENT_ENUM_BEGIN(ePacketID)

Shared/mods/deathmatch/logic/Enums.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ enum class WorldSpecialProperty
8888
WATERCREATURES,
8989
BURNFLIPPEDCARS,
9090
FIREBALLDESTRUCT,
91+
ROADSIGNSTEXT,
9192
};
9293
DECLARE_ENUM_CLASS(WorldSpecialProperty);
9394

Shared/sdk/net/SyncStructures.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,10 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20322032
{
20332033
BITCOUNT2 = 1
20342034
};
2035+
enum
2036+
{
2037+
BITCOUNT3 = 1
2038+
};
20352039

20362040
bool Read(NetBitStreamInterface& bitStream)
20372041
{
@@ -2041,6 +2045,12 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20412045
else
20422046
data2.fireballdestruct = true;
20432047

2048+
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText))
2049+
isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data3), BITCOUNT3);
2050+
else
2051+
data3.roadsignstext = true;
2052+
2053+
20442054
//// Example for adding item:
20452055
// if (bitStream.Can(eBitStreamVersion::YourProperty))
20462056
// isOK &= bitStream.ReadBits(reinterpret_cast<char*>(&data9), BITCOUNT9);
@@ -2055,6 +2065,9 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20552065
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_FireballDestruct))
20562066
bitStream.WriteBits(reinterpret_cast<const char*>(&data2), BITCOUNT2);
20572067

2068+
if (bitStream.Can(eBitStreamVersion::WorldSpecialProperty_RoadSignsText))
2069+
bitStream.WriteBits(reinterpret_cast<const char*>(&data3), BITCOUNT3);
2070+
20582071
//// Example for adding item:
20592072
// if (bitStream.Can(eBitStreamVersion::YourProperty))
20602073
// bitStream.WriteBits(reinterpret_cast<const char*>(&data9), BITCOUNT9);
@@ -2082,6 +2095,11 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20822095
bool fireballdestruct : 1;
20832096
} data2;
20842097

2098+
struct
2099+
{
2100+
bool roadsignstext : 1;
2101+
} data3;
2102+
20852103
SWorldSpecialPropertiesStateSync()
20862104
{
20872105
// Set default states
@@ -2098,6 +2116,7 @@ struct SWorldSpecialPropertiesStateSync : public ISyncStructure
20982116
data.watercreatures = true;
20992117
data.burnflippedcars = true;
21002118
data2.fireballdestruct = true;
2119+
data3.roadsignstext = true;
21012120
}
21022121
};
21032122

0 commit comments

Comments
 (0)