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

Method GetOriginAxisFromBolt

code/cgame/FxSystem.cpp:177–225  ·  view source on GitHub ↗

------------------------------------------------------

Source from the content-addressed store, hash-verified

175
176//------------------------------------------------------
177int SFxHelper::GetOriginAxisFromBolt(const centity_t &cent, int modelNum, int boltNum, vec3_t /*out*/origin, vec3_t /*out*/axis[3])
178{
179 if ((cg.time-cent.snapShotTime) > 200)
180 { //you were added more than 200ms ago, so I say you are no longer valid/in our snapshot.
181 return 0;
182 }
183
184 int doesBoltExist;
185 mdxaBone_t boltMatrix;
186 vec3_t G2Angles = {cent.lerpAngles[0] , cent.lerpAngles[1], cent.lerpAngles[2]};
187 if ( cent.currentState.eType == ET_PLAYER )
188 {//players use cent.renderAngles
189 VectorCopy( cent.renderAngles, G2Angles );
190
191 if ( cent.gent //has a game entity
192 && cent.gent->s.m_iVehicleNum != 0 //in a vehicle
193 && cent.gent->m_pVehicle //have a valid vehicle pointer
194 && cent.gent->m_pVehicle->m_pVehicleInfo->type != VH_FIGHTER //it's not a fighter
195 && cent.gent->m_pVehicle->m_pVehicleInfo->type != VH_SPEEDER //not a speeder
196 )
197 {
198 G2Angles[PITCH]=0;
199 G2Angles[ROLL] =0;
200 }
201 }
202
203 // go away and get me the bolt position for this frame please
204 doesBoltExist = gi.G2API_GetBoltMatrix(cent.gent->ghoul2, modelNum,
205 boltNum, &boltMatrix, G2Angles,
206 cent.lerpOrigin, cg.time, cgs.model_draw,
207 cent.currentState.modelScale);
208 // set up the axis and origin we need for the actual effect spawning
209 origin[0] = boltMatrix.matrix[0][3];
210 origin[1] = boltMatrix.matrix[1][3];
211 origin[2] = boltMatrix.matrix[2][3];
212
213 axis[1][0] = boltMatrix.matrix[0][0];
214 axis[1][1] = boltMatrix.matrix[1][0];
215 axis[1][2] = boltMatrix.matrix[2][0];
216
217 axis[0][0] = boltMatrix.matrix[0][1];
218 axis[0][1] = boltMatrix.matrix[1][1];
219 axis[0][2] = boltMatrix.matrix[2][1];
220
221 axis[2][0] = boltMatrix.matrix[0][2];
222 axis[2][1] = boltMatrix.matrix[1][2];
223 axis[2][2] = boltMatrix.matrix[2][2];
224 return doesBoltExist;
225}

Callers 2

UpdateMethod · 0.45
AddScheduledEffectsMethod · 0.45

Calls 1

VectorCopyFunction · 0.85

Tested by

no test coverage detected