Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Mar 28, 2022
2 parents 756821d + 6a6336a commit 9c548a6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions dlls/cbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ CBaseEntity* CBaseEntity::GetNextTarget()
TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
{
DEFINE_FIELD(CBaseEntity, m_pGoalEnt, FIELD_CLASSPTR),
DEFINE_FIELD(CBaseEntity, m_EFlags, FIELD_CHARACTER),

DEFINE_FIELD(CBaseEntity, m_pfnThink, FIELD_FUNCTION), // UNDONE: Build table of these!!!
DEFINE_FIELD(CBaseEntity, m_pfnTouch, FIELD_FUNCTION),
Expand Down
5 changes: 5 additions & 0 deletions dlls/cbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ class CBaseEntity
CBaseEntity* m_pGoalEnt; // path corner we are heading towards
CBaseEntity* m_pLink; // used for temporary link-list operations.

/**
* @brief Entity flags sent to the client in ::AddToFullPack
*/
byte m_EFlags = 0;

virtual ~CBaseEntity() {}

// initialization functions
Expand Down
4 changes: 4 additions & 0 deletions dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ int AddToFullPack(struct entity_state_s* state, int e, edict_t* ent, edict_t* ho
{
int i;

auto entity = reinterpret_cast<CBaseEntity*>(GET_PRIVATE(ent));

// don't send if flagged for NODRAW and it's not the host getting the message
if ((ent->v.effects & EF_NODRAW) != 0 &&
(ent != host))
Expand Down Expand Up @@ -1201,6 +1203,8 @@ int AddToFullPack(struct entity_state_s* state, int e, edict_t* ent, edict_t* ho
state->eflags &= ~EFLAG_SLERP;
}

state->eflags |= entity->m_EFlags;

state->scale = ent->v.scale;
state->solid = ent->v.solid;
state->colormap = ent->v.colormap;
Expand Down
10 changes: 10 additions & 0 deletions dlls/doors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ class CMomentaryDoor : public CBaseToggle
static TYPEDESCRIPTION m_SaveData[];

void EXPORT DoorMoveDone();
void EXPORT StopMoveSound();

byte m_bMoveSnd; // sound a door makes while moving
};
Expand Down Expand Up @@ -1083,6 +1084,15 @@ void CMomentaryDoor::Use(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE
// The door has reached needed position.
//
void CMomentaryDoor::DoorMoveDone()
{
// Stop sounds at the next think, rather than here as another
// Use call might immediately follow the end of this move
//This think function will be replaced by LinearMove if that happens.
SetThink(&CMomentaryDoor::StopMoveSound);
pev->nextthink = pev->ltime + 0.1f;
}

void CMomentaryDoor::StopMoveSound()
{
STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving));
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM);
Expand Down
5 changes: 3 additions & 2 deletions dlls/nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2325,8 +2325,9 @@ bool CGraph::FLoadGraph(const char* szMapName)

const std::string fileName{std::string{"maps/graphs/"} + szMapName + ".nod"};

//Note: no path ID to allow loading graphs from addon content.
const auto buffer = FileSystem_LoadFileIntoBuffer(fileName.c_str());
//Note: "GAME" path ID to allow loading graphs from addon content.
//Do not allow loading from other games since they may have a different graph format.
const auto buffer = FileSystem_LoadFileIntoBuffer(fileName.c_str(), "GAME");

if (buffer.empty())
{
Expand Down
3 changes: 3 additions & 0 deletions dlls/tentacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ void CTentacle::Spawn()
pev->health = 75;
pev->sequence = 0;

//Always interpolate tentacles since they don't actually move.
m_EFlags |= EFLAG_SLERP;

SET_MODEL(ENT(pev), "models/tentacle2.mdl");
UTIL_SetSize(pev, Vector(-32, -32, 0), Vector(32, 32, 64));

Expand Down

0 comments on commit 9c548a6

Please sign in to comment.