From 0517b987e262138a058ed213f0f83c0dbeebd7c3 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 20 Mar 2023 22:15:58 +0000 Subject: [PATCH] Fix missing muzzle flash in JKA Not really sure why it didn't work, but this specific handling for the player seems to fix it --- .../jni/OpenJK/code/cgame/FxScheduler.cpp | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/cgame/FxScheduler.cpp b/Projects/Android/jni/OpenJK/code/cgame/FxScheduler.cpp index 5a6a156..c1463f5 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/FxScheduler.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/FxScheduler.cpp @@ -999,14 +999,41 @@ void CFxScheduler::CreateEffect( CPrimitiveTemplate *fx, int clientID, int delay case Particle: //--------- - FX_AddParticle( clientID, org, vel, accel, fx->mGravity.GetVal(), - fx->mSizeStart.GetVal(), fx->mSizeEnd.GetVal(), fx->mSizeParm.GetVal(), - fx->mAlphaStart.GetVal(), fx->mAlphaEnd.GetVal(), fx->mAlphaParm.GetVal(), - sRGB, eRGB, fx->mRGBParm.GetVal(), - fx->mRotation.GetVal(), fx->mRotationDelta.GetVal(), - fx->mMin, fx->mMax, fx->mElasticity.GetVal(), - fx->mDeathFxHandles.GetHandle(), fx->mImpactFxHandles.GetHandle(), - fx->mLife.GetVal(), fx->mMediaHandles.GetHandle(), flags ); + if ( clientID >= 0 && clientID < ENTITYNUM_WORLD ) + { + if (clientID == 0) + { + flags = fx->mFlags | FX_DEPTH_HACK; + } + + // ..um, ok..... + centity_t *cent = &cg_entities[clientID]; + + if (cent && cent->gent && cent->gent->client) + { + FX_AddParticle(-1, cent->gent->client->renderInfo.muzzlePoint, vel, accel, fx->mGravity.GetVal(), + fx->mSizeStart.GetVal(), fx->mSizeEnd.GetVal(), fx->mSizeParm.GetVal(), + fx->mAlphaStart.GetVal(), fx->mAlphaEnd.GetVal(), + fx->mAlphaParm.GetVal(), + sRGB, eRGB, fx->mRGBParm.GetVal(), + fx->mRotation.GetVal(), fx->mRotationDelta.GetVal(), + fx->mMin, fx->mMax, fx->mElasticity.GetVal(), + fx->mDeathFxHandles.GetHandle(), fx->mImpactFxHandles.GetHandle(), + fx->mLife.GetVal(), fx->mMediaHandles.GetHandle(), flags); + } + } + else + { + FX_AddParticle(clientID, org, vel, accel, fx->mGravity.GetVal(), + fx->mSizeStart.GetVal(), fx->mSizeEnd.GetVal(), fx->mSizeParm.GetVal(), + fx->mAlphaStart.GetVal(), fx->mAlphaEnd.GetVal(), + fx->mAlphaParm.GetVal(), + sRGB, eRGB, fx->mRGBParm.GetVal(), + fx->mRotation.GetVal(), fx->mRotationDelta.GetVal(), + fx->mMin, fx->mMax, fx->mElasticity.GetVal(), + fx->mDeathFxHandles.GetHandle(), fx->mImpactFxHandles.GetHandle(), + fx->mLife.GetVal(), fx->mMediaHandles.GetHandle(), flags); + } break; //---------