Skip to content

Commit e770a69

Browse files
committed
add
1 parent f3811cb commit e770a69

File tree

7 files changed

+123
-3
lines changed

7 files changed

+123
-3
lines changed

Client/mods/deathmatch/logic/CClientVehicle.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,70 @@ void CClientVehicle::SetHealth(float health)
795795
if (m_pVehicle)
796796
m_pVehicle->SetHealth(health);
797797
}
798+
/*
799+
800+
void CVehicleSA::SetSunGlare(bool show)
801+
{
802+
DEBUG_TRACE("void CVehicleSA::SetSunGlare ( bool show )");
803+
if (show)
804+
{
805+
// Converted from thiscall void CVehicle::DoSunGlare(void) 0x6DD6F0
806+
using Signature = void(__cdecl*)(DWORD vehicle);
807+
const auto doSunGlare = reinterpret_cast<Signature>(0x6DD6F0);
808+
809+
810+
doSunGlare(dwThis);
811+
g_pCore->GetConsole()->Printf("CVehicleSA:: SetSunGlare()");
812+
DWORD dwThis = (DWORD)GetInterface();
813+
DWORD dwFunc = 0x6DD6F0;
814+
815+
if (dwFunc)
816+
{
817+
_asm
818+
{
819+
mov ecx, dwThis
820+
call dwFunc
821+
}
822+
}
823+
printf("called");
824+
825+
}
826+
}
827+
*/
828+
void CClientVehicle::SetSunGlare(bool show)
829+
{
830+
g_pCore->GetConsole()->Printf("CClientVehicle:: SetSunGlare checking m_pVehicle...");
831+
if (m_pVehicle)
832+
{
833+
//m_pVehicle->SetSunGlare(true);
834+
g_pCore->GetConsole()->Printf("CClientVehicle:: m_pVehicle check pass");
835+
836+
/*
837+
using Signature = void(__cdecl*)(DWORD vehicle);
838+
const auto doSunGlare = reinterpret_cast<Signature>(0x6DD6F0);
839+
*/
840+
DWORD dwThis = (DWORD)m_pVehicle->GetInterface();
841+
DWORD dwFunc = 0x6DD6F0;
842+
843+
if (dwFunc)
844+
{
845+
_asm
846+
{
847+
mov ecx, dwThis
848+
call dwFunc
849+
}
850+
}
851+
852+
853+
g_pCore->GetConsole()->Printf("CClientVehicle:: SetSunGlare() run");
854+
}
855+
}
798856

799857
void CClientVehicle::Fix()
800858
{
801859
if (m_pVehicle)
802860
{
861+
g_pCore->GetConsole()->Printf("CClientVehicle::Fix:: m_pVehicle yes");
803862
m_pVehicle->Fix();
804863
// Make sure its visible, if its supposed to be
805864
m_pVehicle->SetVisible(m_bVisible);

Client/mods/deathmatch/logic/CClientVehicle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class CClientVehicle : public CClientStreamElement
212212
float GetHealth() const;
213213
void SetHealth(float health);
214214
void Fix();
215-
215+
void SetSunGlare(bool show);
216216
void Blow(VehicleBlowFlags blow);
217217
bool IsBlown() const noexcept { return m_blowState != VehicleBlowState::INTACT; }
218218
void SetBlowState(VehicleBlowState state) { m_blowState = state; }

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,17 @@ CClientVehicle* CStaticFunctionDefinitions::CreateVehicle(CResource& Resource, u
27602760

27612761
return nullptr;
27622762
}
2763+
bool CStaticFunctionDefinitions::AddVehicleSunGlare(CClientVehicle& Vehicle)
2764+
{
2765+
if (IS_VEHICLE(&Vehicle))
2766+
{
2767+
//memset((void*)0x6DD6F0, Entity,1);
2768+
Vehicle.SetSunGlare(true);
2769+
2770+
m_pCore->GetConsole()->Print("LUA VEHICLE GLAR CALLED");
2771+
}
2772+
return false;
2773+
}
27632774

27642775
bool CStaticFunctionDefinitions::FixVehicle(CClientEntity& Entity)
27652776
{

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class CStaticFunctionDefinitions
226226
static bool GetVehicleModelDummyDefaultPosition(unsigned short usModel, eVehicleDummies eDummy, CVector& vecPosition);
227227

228228
// Vehicle set functions
229+
static bool AddVehicleSunGlare(CClientVehicle& Vehicle);
229230
static bool FixVehicle(CClientEntity& Entity);
230231
static bool BlowVehicle(CClientEntity& Entity, std::optional<bool> withExplosion);
231232
static bool SetVehicleColor(CClientEntity& Entity, const CVehicleColor& color);
@@ -267,7 +268,7 @@ class CStaticFunctionDefinitions
267268
static bool SetVehiclePlateText(CClientEntity& Entity, const SString& strText);
268269
static bool SetHeliBladeCollisionsEnabled(CClientVehicle& Vehicle, bool bEnabled);
269270
static bool SetVehicleWindowOpen(CClientVehicle& Vehicle, uchar ucWindow, bool bOpen);
270-
271+
271272
// Object get funcs
272273
static CClientObject* CreateObject(CResource& Resource, unsigned short usModelID, const CVector& vecPosition, const CVector& vecRotation, bool bLowLod);
273274
static bool GetObjectScale(CClientObject& Object, CVector& vecScale);

Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void CLuaVehicleDefs::LoadFunctions()
9292
// Vehicle set funcs
9393
{"createVehicle", CreateVehicle},
9494
{"fixVehicle", FixVehicle},
95+
{"addVehicleSunGlare", AddVehicleSunGlare},
9596
{"blowVehicle", ArgumentParserWarn<false, BlowVehicle>},
9697
{"setVehicleTurnVelocity", SetVehicleTurnVelocity},
9798
{"setVehicleColor", SetVehicleColor},
@@ -1547,6 +1548,27 @@ int CLuaVehicleDefs::FixVehicle(lua_State* luaVM)
15471548
lua_pushboolean(luaVM, false);
15481549
return 1;
15491550
}
1551+
int CLuaVehicleDefs::AddVehicleSunGlare(lua_State* luaVM)
1552+
{
1553+
CClientVehicle* pVehicle = NULL;
1554+
CScriptArgReader argStream(luaVM);
1555+
argStream.ReadUserData(pVehicle);
1556+
1557+
if (!argStream.HasErrors())
1558+
{
1559+
if (CStaticFunctionDefinitions::AddVehicleSunGlare(*pVehicle))
1560+
{
1561+
lua_pushboolean(luaVM, true);
1562+
return 1;
1563+
}
1564+
}
1565+
else
1566+
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
1567+
1568+
lua_pushboolean(luaVM, false);
1569+
return 1;
1570+
}
1571+
15501572

15511573
bool CLuaVehicleDefs::IsVehicleBlown(CClientVehicle* vehicle)
15521574
{

Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class CLuaVehicleDefs : public CLuaDefs
8282
LUA_DECLARE(IsVehicleWindowOpen);
8383

8484
LUA_DECLARE(FixVehicle);
85+
LUA_DECLARE(AddVehicleSunGlare);
8586
static bool BlowVehicle(CClientEntity* entity, std::optional<bool> withExplosion);
8687
LUA_DECLARE(SetVehicleRotation);
8788
LUA_DECLARE(SetVehicleTurnVelocity);

Client/multiplayer_sa/CMultiplayerSA.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,26 @@ CMultiplayerSA::CMultiplayerSA()
578578
m_dwLastStaticAnimID = eAnimID::ANIM_ID_WALK;
579579
}
580580

581+
void CVehicle__DoSunGlare(void* this_)
582+
{
583+
//EAXJMP(0x6DD6F0);
584+
MemSet((void*)0x6DD6F0, 0x1, 1);
585+
}
586+
587+
void __declspec(naked) doglare(void)
588+
{
589+
_asm {
590+
mov ecx, 1
591+
cmp [ecx+8], 0 // doglare
592+
jle noglare
593+
mov ecx,esi
594+
call CVehicle__DoSunGlare
595+
noglare:
596+
mov [esp+0D4h], edi
597+
push 6ABD04h
598+
retn
599+
}
600+
}
581601
void CMultiplayerSA::InitHooks()
582602
{
583603
InitKeysyncHooks();
@@ -1510,7 +1530,7 @@ void CMultiplayerSA::InitHooks()
15101530
// Allow water cannon to hit objects and players visually
15111531
MemSet((void*)0x72925D, 0x1, 1); // objects
15121532
MemSet((void*)0x729263, 0x1, 1); // players
1513-
1533+
15141534
// Allow crouching with 1HP
15151535
MemPut((void*)0x6943AD, &fDuckingHealthThreshold);
15161536
fDuckingHealthThreshold = 0;
@@ -1519,6 +1539,12 @@ void CMultiplayerSA::InitHooks()
15191539
m_fShadowsOffset = 0.013f; // GTA default = 0.06f
15201540
for (auto uiAddr : shadowAddr)
15211541
MemPut(uiAddr, &m_fShadowsOffset);
1542+
//Fuck Sun Glar
1543+
//MemPut((void*)0x6ABCFD, 0x6DD6F0);
1544+
1545+
//Fuck the wet road reflection
1546+
MemSet((void*)0x6FB9A0, 0x1C, 1);
1547+
15221548

15231549
InitHooks_CrashFixHacks();
15241550

0 commit comments

Comments
 (0)