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

Method Lerp2Angles

code/game/Q3_Interface.cpp:8148–8199  ·  view source on GitHub ↗

Lerps the angles to the destination value.

Source from the content-addressed store, hash-verified

8146
8147// Lerps the angles to the destination value.
8148void CQuake3GameInterface::Lerp2Angles( int taskID, int entID, vec3_t angles, float duration )
8149{
8150 gentity_t *ent = &g_entities[entID];
8151 vec3_t ang;
8152 int i;
8153
8154 if(!ent)
8155 {
8156 DebugPrint( WL_WARNING, "Lerp2Angles: invalid entID %d\n", entID);
8157 return;
8158 }
8159
8160 if ( ent->client || ent->NPC || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
8161 {
8162 DebugPrint( WL_ERROR, "Lerp2Angles: ent %d is NOT a mover!\n", entID);
8163 return;
8164 }
8165
8166 //If we want an instant move, don't send 0...
8167 ent->s.apos.trDuration = (duration>0) ? duration : 1;
8168
8169 for ( i = 0; i < 3; i++ )
8170 {
8171 ang [i] = AngleSubtract( angles[i], ent->currentAngles[i]);
8172 ent->s.apos.trDelta[i] = ( ang[i] / ( ent->s.apos.trDuration * 0.001f ) );
8173 }
8174
8175 VectorCopy( ent->currentAngles, ent->s.apos.trBase );
8176
8177 if ( ent->alt_fire )
8178 {
8179 ent->s.apos.trType = TR_LINEAR_STOP;
8180 }
8181 else
8182 {
8183 ent->s.apos.trType = TR_NONLINEAR_STOP;
8184 }
8185
8186 ent->s.apos.trTime = level.time;
8187
8188 Q3_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
8189
8190 //ent->e_ReachedFunc = reachedF_NULL;
8191 ent->e_ThinkFunc = thinkF_anglerCallback;
8192 ent->nextthink = level.time + duration;
8193
8194 // starting sound
8195 G_PlayDoorLoopSound( ent );
8196 G_PlayDoorSound( ent, BMS_START ); //??
8197
8198 gi.linkentity( ent );
8199}
8200
8201// Gets the value of a tag by the give name.
8202int CQuake3GameInterface::GetTag( int entID, const char *name, int lookup, vec3_t info )

Callers 1

RotateMethod · 0.80

Calls 6

Q_stricmpFunction · 0.85
AngleSubtractFunction · 0.85
VectorCopyFunction · 0.85
Q3_TaskIDSetFunction · 0.70
G_PlayDoorLoopSoundFunction · 0.70
G_PlayDoorSoundFunction · 0.70

Tested by

no test coverage detected