MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CG_SetEntitySoundPosition

Function CG_SetEntitySoundPosition

code/cgame/cg_ents.cpp:125–153  ·  view source on GitHub ↗

====================== CG_SetEntitySoundPosition Also called by event processing code ====================== */

Source from the content-addressed store, hash-verified

123======================
124*/
125vec3_t *CG_SetEntitySoundPosition( centity_t *cent ) {
126 static vec3_t v3Return;
127 if ( cent->currentState.solid == SOLID_BMODEL ) {
128 vec3_t origin;
129 float *v;
130
131 v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
132 VectorAdd( cent->lerpOrigin, v, origin );
133 cgi_S_UpdateEntityPosition( cent->currentState.number, origin );
134 VectorCopy(origin, v3Return);
135 } else {
136 if ( cent->currentState.eType == ET_PLAYER
137 && cent->gent
138 && cent->gent->client
139 && cent->gent->ghoul2.IsValid()
140 && cent->gent->ghoul2[0].animModelIndexOffset )//If it has an animOffset it's a cinematic anim
141 {//I might be running out of my bounding box, so use my headPoint from the last render frame...?
142 //NOTE: if I'm not rendered, will this not update correctly? Would cent->lerpOrigin be any more updated?
143 VectorCopy(cent->gent->client->renderInfo.eyePoint, v3Return);
144 }
145 else
146 {//just use my org
147 VectorCopy(cent->lerpOrigin, v3Return);
148 }
149 cgi_S_UpdateEntityPosition( cent->currentState.number, v3Return );
150 }
151
152 return &v3Return;
153}
154
155/*
156==================

Callers 2

CG_EntityEffectsFunction · 0.70
CG_CheckEventsFunction · 0.70

Calls 4

VectorAddFunction · 0.85
VectorCopyFunction · 0.85
IsValidMethod · 0.45

Tested by

no test coverage detected