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

Function G_SetViewEntity

codeJK2/game/g_active.cpp:192–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
193{
194 if ( !self || !self->client || !viewEntity )
195 {
196 return;
197 }
198
199 if ( self->s.number == 0 && cg.zoomMode )
200 {
201 // yeah, it should really toggle them so it plays the end sound....
202 cg.zoomMode = 0;
203 }
204 if ( viewEntity->s.number == self->client->ps.viewEntity )
205 {
206 return;
207 }
208 //clear old one first
209 G_ClearViewEntity( self );
210 //set new one
211 self->client->ps.viewEntity = viewEntity->s.number;
212 viewEntity->svFlags |= SVF_BROADCAST;
213 //remember current angles
214 VectorCopy( self->client->ps.viewangles, self->pos4 );
215 if ( viewEntity->client )
216 {
217 //vec3_t clear = {0,0,0};
218 CG_SetClientViewAngles( viewEntity->client->ps.viewangles, qtrue );
219 //SetClientViewAngle( self, viewEntity->client->ps.viewangles );
220 //SetClientViewAngle( viewEntity, clear );
221 /*
222 VectorCopy( viewEntity->client->ps.viewangles, self->client->ps.viewangles );
223 for ( int i = 0; i < 3; i++ )
224 {
225 self->client->ps.delta_angles[i] = viewEntity->client->ps.delta_angles[i];
226 }
227 */
228 }
229 if ( !self->s.number )
230 {
231 CG_CenterPrint( "@INGAME_EXIT_VIEW", SCREEN_HEIGHT * 0.95 );
232 }
233}
234
235qboolean G_ControlledByPlayer( gentity_t *self )
236{

Callers 4

Q3_SetViewEntityFunction · 0.70
camera_useFunction · 0.70
panel_turret_useFunction · 0.70
ForceTelepathyFunction · 0.70

Calls 4

VectorCopyFunction · 0.85
G_ClearViewEntityFunction · 0.70
CG_SetClientViewAnglesFunction · 0.50
CG_CenterPrintFunction · 0.50

Tested by

no test coverage detected