Skip to content

Commit

Permalink
Improve "Forgot to install CS 1.6" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Apr 12, 2024
1 parent c19c423 commit 839ff3f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
20 changes: 20 additions & 0 deletions GSChaos/CFeatureForgotCSS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ void CFeatureForgotCSS::OnFrame(double time)
}
}

void CFeatureForgotCSS::HUD_AddEntity(int type, struct cl_entity_s* ent, const char* modelname)
{
if (ent->model->type != mod_studio)
return;

if (!m_pErrorModel)
m_pErrorModel = sv->models[g_ErrorModel];

if (!m_pErrorModel)
return;

ent->model = m_pErrorModel;

ent->prevstate.renderfx = kRenderFxGlowShell;
ent->prevstate.rendercolor = { 255, 0, 0 };

ent->curstate.renderfx = kRenderFxGlowShell;
ent->curstate.rendercolor = { 255, 0, 0};
}

int CFeatureForgotCSS::GetTextureID()
{
return (*r_notexture_mip)->gl_texturenum;
Expand Down
3 changes: 3 additions & 0 deletions GSChaos/CFeatureForgotCSS.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ class CFeatureForgotCSS : public CChaosFeature
void DeactivateFeature() override;
void OnFrame(double time) override;
const char* GetFeatureName() override;
void HUD_AddEntity(int type, struct cl_entity_s* ent, const char* modelname) override;
virtual int GetTextureID();

public:
void ActivateFeature() override;
private:
bool m_bActivated = false;
model_t* m_pErrorModel;
int m_pErrorIndex;
};

#else //!__cplusplus
Expand Down
4 changes: 2 additions & 2 deletions GSChaos/dynamic_precache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int HOOKED_PF_precache_model_I(char* s)
if (sv->state == ss_loading)
{
if (sv->models[0] == nullptr)
g_ErrorModel = ORIG_PF_precache_model_I("models/player.mdl");
g_ErrorModel = ORIG_PF_precache_model_I("../chaos/error.mdl");

if (!g_bEncrypted && !g_bPreSteamPipe)
ORIG_PF_precache_model_I("../chaos/fastrun.bsp");
Expand Down Expand Up @@ -206,7 +206,7 @@ void HOOKED_PF_setmodel_I(edict_t* e, const char* m)
if (!HOOKED_PF_precache_model_I((char*)m))
{
pEngfuncs->Con_DPrintf("PF_setmodel_I: Could not set model %s \n", m);
m = "models/player.mdl";
m = "../chaos/error.mdl";
}

ORIG_PF_setmodel_I(e, m);
Expand Down
2 changes: 2 additions & 0 deletions GSChaos/dynamic_precache.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#ifdef __cplusplus

extern int g_ErrorModel;

typedef sfxcache_t* (*_S_LoadSound)(sfx_t* s, channel_t* ch);
typedef sfx_t* (*_S_FindName)(char* name, int* pfInCache);
typedef model_t* (*_Mod_ForName)(const char* name, qboolean crash, qboolean trackCRC);
Expand Down

0 comments on commit 839ff3f

Please sign in to comment.