Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

refactor(gameengine): read no render object from the tick

Olcay Seygan586c8f879fb6
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
index b694fb8e2..cd35ecc6c 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/LogicThread.h
@@ -118,14 +118,10 @@ namespace LogicThread
void callAfterTick( const std::function<void()>& call );
/** LOGIC-THREAD.md phase 2, M6. The camera calls a tick's scripts make (moves, filters, letterbox,
- * fades, the time freeze) wait in a queue of their own, run first after the tick. Their own queue,
- * because a script asks the camera back in the same tick whether its move is finished and whether
- * time is frozen: readViewFromTick runs what is queued before such a read, so the answer is the
- * one an immediate call gave. That run counts as ondemandflush, not tacticalview; the read itself
- * counts as clientread, which M7's captured block replaces. */
+ * fades, the time freeze) wait in a queue of their own, run first after the tick. A script that
+ * asks the camera back in the same tick whether its move is finished or time frozen reads M7's
+ * block, which each queued call updates (noteViewEffect). */
void callViewAfterTick( const std::function<void()>& call );
- void readViewFromTick( void );
- /** defersEffects, except while readViewFromTick runs the queue: then a camera call runs its body. */
Bool defersView( void );
/** The tick cleared the game: what it queued has no game left to play in. GameEngine::reset. */
@@ -164,9 +160,9 @@ namespace LogicThread
/** What a queued camera call does to the two answers logic reads (time frozen, movement finished),
* written to the block at the call. This is the camera's state machine in four words, not the
* camera: a move whose path collapses to one point, or a motion blur the device refuses, leaves the
- * real camera finished where the block says moving. So -logicthread 0 keeps asking the camera
- * (readViewFromTick), exact as it always was, and counts every read where the block would have
- * answered otherwise; -logicthread 1 answers from the block. */
+ * real camera finished where the block says moving. Every setting answers from the block since
+ * phase 3: asking the camera meant running its queued calls inside the tick, and phase 2 counted 0
+ * of 18680 campaign reads where the two answers differed. */
enum ViewEffect
{
VIEW_MOVES, ///< a move, zoom, pitch or rotation starts
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
index da56080af..e07145795 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
@@ -541,15 +541,19 @@ public:
void clearAndSetModelConditionFlags( const ModelConditionFlags& clr, const ModelConditionFlags& set );
void replaceModelConditionFlags( const ModelConditionFlags &flags, Bool forceReplace = FALSE );
- Bool handleWeaponFireFX(
- WeaponSlotType wslot,
- Int specificBarrelToUse,
- const FXList* fxl,
- Real weaponSpeed,
- Real recoilAmount,
- Real recoilAngle,
+ /** A shot's recoil, muzzle flash and FX at the barrel's bone; with no draw module that has one, the FX
+ * at the victim (fxAtVictim, a contact weapon) or at the drawable. Inside a tick it is the drawable's
+ * deferred work, in its place between the condition states (LOGIC-THREAD.md phase 3). */
+ void handleWeaponFireFX(
+ WeaponSlotType wslot,
+ Int specificBarrelToUse,
+ const FXList* fxl,
+ Real weaponSpeed,
+ Real recoilAmount,
+ Real recoilAngle,
const Coord3D* victimPos,
- Real damageRadius
+ Real damageRadius,
+ Bool fxAtVictim
);
Int getBarrelCount(WeaponSlotType wslot) const;
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
index 6663fa8c6..ab459c1ca 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
@@ -79,6 +79,7 @@ public:
//Actually puts the laser in the world.
void initLaser( const Object *parent, const Object *target, const Coord3D *startPos, const Coord3D *endPos, AsciiString parentBoneName, Int sizeDeltaFrames = 0 );
void setDecayFrames( UnsignedInt decayFrames );
+ void moveEnds( const Coord3D *startPos, const Coord3D *endPos ) { m_startPos = *startPos; m_endPos = *endPos; m_dirty = TRUE; }
const Coord3D* getStartPos() { return &m_startPos; }
const Coord3D* getEndPos() { return &m_endPos; }
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h
index 6a306fec9..db357cfe2 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ParticleUplinkCannonUpdate.h
@@ -186,7 +186,8 @@ public:
Real computeOrbitBeamWidthScalar( UnsignedInt frame ) const;
Bool calculateDefaultInformation();
- Bool calculateUpBonePositions();
+ void calculateUpBonePositions();
+ void placeOnUpBones(); ///< after the tick: the raised antenna's bones, and what this tick placed at them
virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const; //Is it active now?
virtual Bool doesSpecialPowerHaveOverridableDestination() const { return true; } //Does it have it, even if it's not active?
@@ -246,6 +247,7 @@ protected:
Bool m_manualTargetMode;
Bool m_scriptedWaypointMode;
Bool m_clientShroudedLastFrame;
+ Bool m_upBonesToRead; ///< calculateUpBonePositions asked in this setClientStatus; not saved, a save is never inside a tick
};
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
index ad7e6232e..d67f074c8 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/LogicThread.cpp
@@ -100,8 +100,6 @@ namespace
// M7: what the tick reads of the client, see LogicThread::ClientBlock
LogicThread::ClientBlock s_block;
- Int64 s_viewReads = 0; ///< camera answers the tick asked the camera for, at -logicthread 0
- Int64 s_viewMispredicted = 0; ///< of those, the ones the block would have answered otherwise
/* The sync point: the main thread, before the tick, with every call the last tick queued already
run. So the block holds what the tick's first read of the client would have returned. */
@@ -122,11 +120,6 @@ namespace
TheAudio->captureForLogic();
}
- Bool blockSaysCameraFinished( void )
- {
- return s_block.cameraBlurring || !s_block.cameraMoving;
- }
-
void runViewCalls( void )
{
// swapped out first: a call that queues another (none does today) waits for the next run
@@ -349,12 +342,9 @@ void LogicThread::callAfterTick( const std::function<void()>& call )
}
//-------------------------------------------------------------------------------------------------
-// TRUE while readViewFromTick runs the queue inside the tick: a queued call runs its body then
-static Bool s_runningViewNow = FALSE;
-
Bool LogicThread::defersView( void )
{
- return defersEffects() && !s_runningViewNow;
+ return defersEffects();
}
//-------------------------------------------------------------------------------------------------
@@ -366,22 +356,6 @@ void LogicThread::callViewAfterTick( const std::function<void()>& call )
call();
}
-//-------------------------------------------------------------------------------------------------
-void LogicThread::readViewFromTick( void )
-{
- census( CENSUS_CLIENT_READ );
- if( s_viewCalls.empty() )
- return;
- census( CENSUS_ON_DEMAND_FLUSH );
- // the camera's own hooks would count this as the tick's tacticalview work; it is counted above
- const Bool onLogicThread = t_isLogicThread;
- t_isLogicThread = FALSE;
- s_runningViewNow = TRUE;
- runViewCalls();
- s_runningViewNow = FALSE;
- t_isLogicThread = onLogicThread;
-}
-
//-------------------------------------------------------------------------------------------------
const LogicThread::ClientBlock &LogicThread::clientBlock( void )
{
@@ -440,29 +414,18 @@ void LogicThread::noteViewEffect( ViewEffect effect )
}
//-------------------------------------------------------------------------------------------------
+/* Phase 3: the block at both settings. Asking the camera meant running the tick's queued camera calls
+ inside the tick, on the camera the render reads; phase 2's three campaign missions found 0 reads,
+ of 18680, where the camera and the block disagreed. */
Bool LogicThread::isCameraMovementFinishedForTick( void )
{
- if( s_enabled )
- return blockSaysCameraFinished();
- readViewFromTick();
- const Bool finished = TheTacticalView->isCameraMovementFinished();
- ++s_viewReads;
- if( finished != blockSaysCameraFinished() )
- ++s_viewMispredicted;
- return finished;
+ return s_block.cameraBlurring || !s_block.cameraMoving;
}
//-------------------------------------------------------------------------------------------------
Bool LogicThread::isTimeFrozenForTick( void )
{
- if( s_enabled )
- return s_block.cameraFrozen;
- readViewFromTick();
- const Bool frozen = TheTacticalView->isTimeFrozen();
- ++s_viewReads;
- if( frozen != s_block.cameraFrozen )
- ++s_viewMispredicted;
- return frozen;
+ return s_block.cameraFrozen;
}
//-------------------------------------------------------------------------------------------------
@@ -486,6 +449,4 @@ void LogicThread::report( void )
for( Int i = 0; i < CENSUS_COUNT; ++i )
used += snprintf( line + used, sizeof(line) - used, "%s%s %lld", i ? " | " : "", CHANNEL_NAMES[ i ], (long long)s_census[ i ] );
DEBUG_LOG(( "HEADLESS LOGICTHREAD CENSUS: %s\n", line ));
- DEBUG_LOG(( "HEADLESS LOGICTHREAD VIEW: %lld camera reads asked of the camera, %lld the block would have answered otherwise\n",
- (long long)s_viewReads, (long long)s_viewMispredicted ));
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index a14245517..fd55cec54 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -81,6 +81,7 @@
#include "GameClient/DisplayStringManager.h"
#include "GameClient/Drawable.h"
#include "GameClient/DrawGroupInfo.h"
+#include "GameClient/FXList.h"
#include "GameClient/GameClient.h"
#include "GameClient/GlobalLanguage.h"
#include "GameClient/InGameUI.h"
@@ -1059,8 +1060,8 @@ Int Drawable::getPristineBonePositions(const char* boneNamePrefix, Int startInde
Int Drawable::getCurrentClientBonePositions(const char* boneNamePrefix, Int startIndex, Coord3D* positions, Matrix3D* transforms, Int maxBones) const
{
Int count = 0;
- // the uplink cannon asks from the tick for its raised antenna: DEPLOYED starts on the animation's
- // last frame, and the pristine bones are its first, about 34 units lower
+ // the bones as drawn; asked after the tick (the uplink cannon's raised antenna, FX at bones), where
+ // what the tick deferred on this drawable is applied first
for (DrawModule** dm = const_cast<Drawable*>(this)->getDrawModulesFlushed(); *dm; ++dm)
{
if (maxBones <= 0)
@@ -1091,7 +1092,7 @@ Int Drawable::getCurrentClientBonePositions(const char* boneNamePrefix, Int star
//-------------------------------------------------------------------------------------------------
Bool Drawable::getCurrentWorldspaceClientBonePositions(const char* boneName, Matrix3D& transform) const
{
- // LaserUpdate asks from the tick; the bones have to be where the tick left the drawable
+ // a laser's client update and the attached models ask; the bones have to be where the tick left the drawable
for (DrawModule** dm = const_cast<Drawable*>(this)->getDrawModulesFlushed(); *dm; ++dm)
{
if (skipsForLogic(*dm))
@@ -5651,37 +5652,38 @@ void Drawable::reactToGeometryChange()
}
//-------------------------------------------------------------------------------------------------
-Bool Drawable::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelToUse, const FXList* fxl, Real weaponSpeed, Real recoilAmount, Real recoilAngle, const Coord3D* victimPos, Real damageRadius)
-{
- if (recoilAmount != 0.0f)
+void Drawable::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelToUse, const FXList* fxl, Real weaponSpeed, Real recoilAmount, Real recoilAngle, const Coord3D* victimPos, Real damageRadius, Bool fxAtVictim)
+{
+ // adjust recoil from absolute to relative, against the way the object faced when it fired
+ if (recoilAmount != 0.0f && getObject())
+ recoilAngle -= getObject()->getOrientation();
+ const Coord3D victim = *victimPos;
+
+ // After the tick, in its place among the condition states the tick set: the barrels, muzzle flash
+ // and FX bone are the state the shot set, and the tick never flushes a render object to read them
+ // (LOGIC-THREAD.md phase 3). A drawable made in this tick has its render objects by then.
+ doClientWork([=]()
{
- // adjust recoil from absolute to relative.
- if (getObject())
- recoilAngle -= getObject()->getOrientation();
- // flip direction 180 degrees.
- recoilAngle += PI;
- if (m_locoInfo)
+ if (recoilAmount != 0.0f && m_locoInfo)
{
- m_locoInfo->m_accelerationPitchRate += recoilAmount * Cos(recoilAngle);
- m_locoInfo->m_accelerationRollRate += recoilAmount * Sin(recoilAngle);
+ // flip direction 180 degrees.
+ const Real angle = recoilAngle + PI;
+ m_locoInfo->m_accelerationPitchRate += recoilAmount * Cos(angle);
+ m_locoInfo->m_accelerationRollRate += recoilAmount * Sin(angle);
}
- }
- // a drawable made this tick has no render object yet to take an FX bone or a muzzle flash from:
- // the weapon plays the FX at the drawable, as it does for a model with no FX bone (the jet
- // crash's impact and fire objects fire in the tick that makes them)
- if (m_renderPending)
- return false;
+ for (DrawModule** dm = getDrawModulesNonDirty(); *dm; ++dm)
+ {
+ ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
+ if (di && di->handleWeaponFireFX(wslot, specificBarrelToUse, fxl, weaponSpeed, &victim, damageRadius))
+ return;
+ }
- // the barrels, muzzle flash and FX bones of the state the shot set, where the tick left the drawable
- for (DrawModule** dm = getDrawModulesFlushed(); *dm; ++dm)
- {
- ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
- if (di && di->handleWeaponFireFX(wslot, specificBarrelToUse, fxl, weaponSpeed, victimPos, damageRadius))
- return true;
- }
- return false;
-}
+ // bah. just play it at the drawable's pos.
+ if (fxl)
+ FXList::doFXPos(fxl, fxAtVictim ? &victim : getPosition(), getTransformMatrix(), weaponSpeed, &victim, damageRadius);
+ }, WORK_AFTER_FLUSH, TRUE );
+}
//-------------------------------------------------------------------------------------------------
Int Drawable::getBarrelCount(WeaponSlotType wslot) const
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
index aee2b0884..878a88dc6 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
@@ -32,6 +32,7 @@
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
+#include "Common/LogicThread.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
#include "Common/Xfer.h"
@@ -286,8 +287,13 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C
m_parentID = parent->getDrawable()->getID();
// the parent's drawable as the object holds it: initLaser runs in the tick, which does not look
- // drawables up in the client's table (LOGIC-THREAD.md M8)
- updateStartPos( parent->getDrawable() );
+ // drawables up in the client's table (LOGIC-THREAD.md M8). Nor does it read a bone off a render
+ // object the tick has not caught up yet (phase 3): the beam starts at the drawable, and its own
+ // client update moves it to the bone before the first frame that draws it.
+ if( LogicThread::defersEffects() && m_parentBoneName.isNotEmpty() && parent->getDrawable() )
+ m_startPos = *parent->getDrawable()->getPosition();
+ else
+ updateStartPos( parent->getDrawable() );
}
else if( startPos )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
index 634cd9284..03da34acc 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
@@ -34,6 +34,7 @@
#define DEFINE_DEATH_NAMES
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
+#include "Common/LogicThread.h"
#include "Common/ThingTemplate.h"
#include "Common/ThingFactory.h"
#include "Common/Player.h"
@@ -188,6 +189,7 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu
m_connectorNodePosition.zero();
m_laserOriginPosition.zero();
m_upBonesCached = FALSE;
+ m_upBonesToRead = FALSE;
m_defaultInfoCached = FALSE;
m_invalidSettings = FALSE;
m_manualTargetMode = FALSE;
@@ -1203,7 +1205,18 @@ Bool ParticleUplinkCannonUpdate::calculateDefaultInformation()
}
//-------------------------------------------------------------------------------------------------
-Bool ParticleUplinkCannonUpdate::calculateUpBonePositions()
+/** The raised antenna's connector and fire bones are the render object's: DEPLOYED starts on the
+ animation's last frame, and the pristine bones are its first, about 34 units lower. Inside a tick
+ that render object has not caught up with the tick (LOGIC-THREAD.md phase 3), so the read waits
+ for the flush after it, and setClientStatus asks then for what it placed at them meanwhile. The two
+ positions only place beams, flares and the launch FX; logic decides nothing with them. */
+void ParticleUplinkCannonUpdate::calculateUpBonePositions()
+{
+ m_upBonesToRead = TRUE;
+}
+
+//-------------------------------------------------------------------------------------------------
+void ParticleUplinkCannonUpdate::placeOnUpBones()
{
const ParticleUplinkCannonUpdateModuleData *data = getParticleUplinkCannonUpdateModuleData();
Object *obj = getObject();
@@ -1222,7 +1235,31 @@ Bool ParticleUplinkCannonUpdate::calculateUpBonePositions()
obj->convertBonePosToWorldPos( &pos, &mtx, &m_laserOriginPosition, &mtx );
}
}
- return TRUE;
+
+ // the beams and flares the same setClientStatus made, which took the positions as they stood
+ static NameKeyType nameKeyClientUpdate = NAMEKEY( "LaserUpdate" );
+ for( Int i = 0; i < data->m_outerEffectNumBones; i++ )
+ {
+ Drawable *beam = TheGameClient->findDrawableByID( m_laserBeamIDs[ i ] );
+ LaserUpdate *update = beam ? (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ) : NULL;
+ if( update )
+ update->moveEnds( &m_outerNodePositions[ i ], &m_connectorNodePosition );
+ }
+ Drawable *beam = TheGameClient->findDrawableByID( m_groundToOrbitBeamID );
+ LaserUpdate *update = beam ? (LaserUpdate*)beam->findClientUpdateModule( nameKeyClientUpdate ) : NULL;
+ if( update )
+ {
+ Coord3D orbitPosition;
+ orbitPosition.set( &m_laserOriginPosition );
+ orbitPosition.z += ORBITAL_BEAM_Z_OFFSET;
+ update->moveEnds( &m_laserOriginPosition, &orbitPosition );
+ }
+ ParticleSystem *system = TheParticleSystemManager->findParticleSystem( m_connectorSystemID );
+ if( system )
+ system->setPosition( &m_connectorNodePosition );
+ system = TheParticleSystemManager->findParticleSystem( m_laserBaseSystemID );
+ if( system )
+ system->setPosition( &m_laserOriginPosition );
}
@@ -1436,6 +1473,20 @@ void ParticleUplinkCannonUpdate::setClientStatus( PUCStatus newStatus, Bool reve
break;
}
}
+
+ if( m_upBonesToRead )
+ {
+ m_upBonesToRead = FALSE;
+ // by ID: the tick may destroy the cannon before the flush
+ const ObjectID id = getObject()->getID();
+ LogicThread::callAfterTick( [id]() {
+ static const NameKeyType key = NAMEKEY( "ParticleUplinkCannonUpdate" );
+ Object *obj = TheGameLogic->findObjectByID( id );
+ ParticleUplinkCannonUpdate *cannon = obj ? (ParticleUplinkCannonUpdate *)obj->findUpdateModule( key ) : NULL;
+ if( cannon )
+ cannon->placeOnUpBones();
+ } );
+ }
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
index 9f836b1cd..aa033dd3c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
@@ -991,8 +991,6 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate
if ( TheGameLogic->getFrame() < firingWeapon->getSuspendFXFrame() )
fx = NULL;
- Bool handled;
-
// Whether the muzzle flash shows is simply whether this watcher can see the firer. The rule
// used to be spelled out as "not mine, and stealthed, and not detected, and not disguised",
// which reads the same for a player but hid the shot from an ally who shares your sight and
@@ -1000,32 +998,22 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate
// And it asks about stealth rather than about a drawable's hidden flag: a unit that has just
// left a tunnel has a visible drawable while it is still stealthed, and used to give itself
// away with its own muzzle flash.
- if(!sourceObj->isLogicallyVisible() // if the watcher cannot see us
- && !sourceObj->isKindOf(KINDOF_MINE) // and not a mine (which always do the FX, even if hidden)...
- && !isPlayFXWhenStealthed() // and not a weapon marked to playwhenstealthed
+ if(sourceObj->isLogicallyVisible() // the watcher can see us
+ || sourceObj->isKindOf(KINDOF_MINE) // or a mine (which always do the FX, even if hidden)...
+ || isPlayFXWhenStealthed() // or a weapon marked to playwhenstealthed
)
{
- handled = TRUE; // then let's just pretend like we did the fx by returning true
- }
- else
- {
- handled = sourceObj->getDrawable()->handleWeaponFireFX(wslot,
- specificBarrelToUse,
- fx,
- getWeaponSpeed(),
- reAngle,
- reDir,
- &targetPos,
- getPrimaryDamageRadius(bonus)
- );
- }
-
- if (handled == false && fx != NULL)
- {
- // bah. just play it at the drawable's pos.
- //DEBUG_LOG(("*** WeaponFireFX not fully handled by the client\n"));
- const Coord3D* where = isContactWeapon() ? &targetPos : sourceObj->getDrawable()->getPosition();
- FXList::doFXPos(fx, where, sourceObj->getDrawable()->getTransformMatrix(), getWeaponSpeed(), &targetPos, getPrimaryDamageRadius(bonus));
+ // the barrel's FX bone, or the drawable's (the victim's for a contact weapon) when it has none
+ sourceObj->getDrawable()->handleWeaponFireFX(wslot,
+ specificBarrelToUse,
+ fx,
+ getWeaponSpeed(),
+ reAngle,
+ reDir,
+ &targetPos,
+ getPrimaryDamageRadius(bonus),
+ isContactWeapon()
+ );
}
}