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

Function FX_AddPoly

code/cgame/FxUtil.cpp:1120–1188  ·  view source on GitHub ↗

------------------------- FX_AddPoly -------------------------

Source from the content-addressed store, hash-verified

1118// FX_AddPoly
1119//-------------------------
1120CPoly *FX_AddPoly( vec3_t *verts, vec2_t *st, int numVerts,
1121 vec3_t vel, vec3_t accel,
1122 float alpha1, float alpha2, float alphaParm,
1123 vec3_t rgb1, vec3_t rgb2, float rgbParm,
1124 vec3_t rotationDelta, float bounce, int motionDelay,
1125 int killTime, qhandle_t shader, int flags )
1126{
1127 if ( theFxHelper.mFrameTime < 1 || !verts )
1128 { // disallow adding effects when the system is paused or the user doesn't pass in a vert array
1129 return 0;
1130 }
1131
1132 CPoly *fx = new CPoly;
1133
1134 if ( fx )
1135 {
1136 // Do a cheesy copy of the verts and texture coords into our own structure
1137 for ( int i = 0; i < numVerts; i++ )
1138 {
1139 VectorCopy( verts[i], fx->mOrg[i] );
1140 VectorCopy2( st[i], fx->mST[i] );
1141 }
1142
1143 fx->SetVel( vel );
1144 fx->SetAccel( accel );
1145
1146 // RGB----------------
1147 fx->SetRGBStart( rgb1 );
1148 fx->SetRGBEnd( rgb2 );
1149
1150 if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE )
1151 {
1152 fx->SetRGBParm( rgbParm * PI * 0.001f );
1153 }
1154 else if ( flags & FX_RGB_PARM_MASK )
1155 {
1156 // rgbParm should be a value from 0-100..
1157 fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime );
1158 }
1159
1160 // Alpha----------------
1161 fx->SetAlphaStart( alpha1 );
1162 fx->SetAlphaEnd( alpha2 );
1163
1164 if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE )
1165 {
1166 fx->SetAlphaParm( alphaParm * PI * 0.001f );
1167 }
1168 else if ( flags & FX_ALPHA_PARM_MASK )
1169 {
1170 fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime );
1171 }
1172
1173 fx->SetFlags( flags );
1174 fx->SetShader( shader );
1175 fx->SetRot( rotationDelta );
1176 fx->SetElasticity( bounce );
1177 fx->SetMotionTimeStamp( motionDelay );

Callers 2

CG_DoGlassQuadFunction · 0.70
CG_CubeFunction · 0.70

Calls 15

VectorCopyFunction · 0.85
VectorCopy2Function · 0.85
FX_AddPrimitiveFunction · 0.70
SetVelMethod · 0.45
SetAccelMethod · 0.45
SetRGBStartMethod · 0.45
SetRGBEndMethod · 0.45
SetRGBParmMethod · 0.45
SetAlphaStartMethod · 0.45
SetAlphaEndMethod · 0.45
SetAlphaParmMethod · 0.45
SetFlagsMethod · 0.45

Tested by

no test coverage detected