Skip to content

Commit 69faf38

Browse files
committed
Remove ViewmodelService and uses
- Change flashlight to always use attachment - Disable EntWatch hud until alternative implementation is added
1 parent 470f5d6 commit 69faf38

4 files changed

Lines changed: 17 additions & 53 deletions

File tree

src/cs2_sdk/entity/ccsplayerpawn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class CCSPlayerPawnBase : public CBasePlayerPawn
4242
SCHEMA_FIELD(QAngle, m_angEyeAngles)
4343
SCHEMA_FIELD(CSPlayerState, m_iPlayerState)
4444
SCHEMA_FIELD(CHandle<CCSPlayerController>, m_hOriginalController)
45-
SCHEMA_FIELD(CCSPlayer_ViewModelServices*, m_pViewModelServices)
4645
SCHEMA_FIELD(CCSPlayer_PingServices*, m_pPingServices)
4746

4847
CCSPlayerController* GetOriginalController()

src/entwatch.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,9 +1956,14 @@ void CEWHandler::Hook_Use(InputData_t* pInput)
19561956
RETURN_META(MRES_IGNORED);
19571957
}
19581958

1959+
// CURRENTLY DISABLED WHILE HUD IS NOT IMPLEMENTED
19591960
// Update cd and uses of all held items
19601961
float EW_UpdateHud()
19611962
{
1963+
////////////////////////
1964+
return -1.0f;
1965+
////////////////////////
1966+
19621967
if (!GetGlobals())
19631968
return EW_HUD_TICKRATE;
19641969

src/playermanager.cpp

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ void ZEPlayer::SpawnFlashLight()
180180

181181
CCSPlayerPawn* pPawn = (CCSPlayerPawn*)CCSPlayerController::FromSlot(GetPlayerSlot())->GetPawn();
182182

183-
// Ensure custom viewmodel exists if needed
184-
if (!g_cvarFlashLightUseAttachment.Get())
185-
{
186-
if (!pPawn->m_pViewModelServices() || !GetOrCreateCustomViewModel(pPawn))
187-
return;
188-
}
189-
190183
Vector origin = pPawn->GetAbsOrigin();
191184
Vector forward;
192185
AngleVectors(pPawn->m_angEyeAngles(), &forward);
@@ -214,20 +207,9 @@ void ZEPlayer::SpawnFlashLight()
214207
pKeyValues->SetString("lightcookie", "materials/effects/lightcookies/flashlight.vtex");
215208

216209
pLight->DispatchSpawn(pKeyValues);
217-
218-
if (g_cvarFlashLightUseAttachment.Get())
219-
{
220-
pLight->SetParent(pPawn);
221-
pLight->AcceptInput("SetParentAttachmentMaintainOffset", g_cvarFlashLightAttachment.Get().String());
222-
}
223-
else
224-
{
225-
CBaseViewModel* pViewModel = GetOrCreateCustomViewModel(pPawn);
226-
if (!pViewModel)
227-
return;
228-
229-
pLight->SetParent(pViewModel);
230-
}
210+
211+
pLight->SetParent(pPawn);
212+
pLight->AcceptInput("SetParentAttachmentMaintainOffset", g_cvarFlashLightAttachment.Get().String());
231213

232214
SetFlashLight(pLight);
233215
}
@@ -602,42 +584,21 @@ void ZEPlayer::ReplicateConVar(const char* pszName, const char* pszValue)
602584
delete data;
603585
}
604586

605-
CBaseViewModel* ZEPlayer::GetOrCreateCustomViewModel(CCSPlayerPawn* pPawn)
606-
{
607-
CBaseViewModel* pViewmodel = pPawn->m_pViewModelServices()->GetViewModel(2);
608-
if (pViewmodel)
609-
return pViewmodel;
610-
611-
pViewmodel = CreateEntityByName<CBaseViewModel>("predicted_viewmodel");
612-
if (!pViewmodel)
613-
return nullptr;
614-
615-
pViewmodel->DispatchSpawn();
616-
pViewmodel->SetOwner(pPawn);
617-
pPawn->m_pViewModelServices()->SetViewModel(2, pViewmodel);
618-
619-
return pViewmodel;
620-
}
621-
587+
// CURRENTLY DOES NOTHING
622588
void ZEPlayer::CreateEntwatchHud()
623589
{
590+
////////////////////////
591+
return;
592+
////////////////////////
593+
624594
CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
625595
if (!pController)
626596
return;
627597

628598
CCSPlayerPawn* pPawn = pController->GetPlayerPawn();
629599
if (!pPawn)
630600
return;
631-
632-
if (!pPawn->m_pViewModelServices())
633-
return;
634-
635-
CBaseViewModel* pViewModel = GetOrCreateCustomViewModel(pPawn);
636-
if (!pViewModel)
637-
{
638-
Panic("Failed to get or create custom viewmodel for entwatch hud.\n");
639-
return;
640-
}
601+
641602

642603
CPointWorldText* pText = GetEntwatchHud();
643604
if (pText)
@@ -670,10 +631,10 @@ void ZEPlayer::CreateEntwatchHud()
670631
pText->DispatchSpawn();
671632
SetEntwatchHud(pText);
672633

673-
pText->AcceptInput("SetParent", "!activator", pViewModel);
634+
//pText->AcceptInput("SetParent", "!activator", pViewModel);
674635

675-
Vector origin = pViewModel->GetAbsOrigin();
676-
QAngle vmangles = pViewModel->GetAbsRotation();
636+
//Vector origin = pViewModel->GetAbsOrigin();
637+
//QAngle vmangles = pViewModel->GetAbsRotation();
677638

678639
Vector forward;
679640
Vector right;

src/playermanager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ class ZEPlayer
303303
std::shared_ptr<ZRClass> GetActiveZRClass() { return m_pActiveZRClass; }
304304
std::shared_ptr<ZRModelEntry> GetActiveZRModel() { return m_pActiveZRModel; }
305305
int GetButtonWatchMode();
306-
CBaseViewModel* GetOrCreateCustomViewModel(CCSPlayerPawn* pPawn);
307306
int GetEntwatchHudMode();
308307
bool GetEntwatchClangtags() { return m_bEntwatchClantags; }
309308
CPointWorldText* GetEntwatchHud() { return m_hEntwatchHud.Get(); }

0 commit comments

Comments
 (0)