Where is the C code for firing in the Engine?
by Nocera Luciano · in Torque Game Engine · 11/09/2006 (9:37 pm) · 2 replies
I want to add some new effects on fire of the FPS. However, I could not find the exact corresponding code in the C++ engine. Like when I push the left mouse button when I aim at some object with the crossbow, the orc will fire. But if I just click on the menu, this event will not be invoked. I want to find the location of this exact fire code. In addition, if I push the mouse button continually, the orc will fire continually. I want to capture each shot. How can I make it? Thank you for your help in advance!
If possible, I want to find it in C++ level, like in which .cpp file and which function...
If possible, I want to find it in C++ level, like in which .cpp file and which function...
#2
void ShapeBase::setImageState(...)
That may seem a bit confusing, but this is technically where weapons are fired, since weapon firing is actually an effect of the image system changing states. You can use this if statement in that function to determine if this is a fire event or just something passive, like a reload or out of ammo state:
if (newState == image.dataBlock->fireState)
Note that the more traditional concept of "firing" actually takes place in the onFire function in your weapon's .CS file; this is where the projectile object is actually created and given velocity as well as where ammo is consumed.
11/24/2006 (2:11 am)
If you want to go to where the actual firing of a *weapon* is done, not just where triggers get processed (that's in the MoveManager stuff), then go to shapeImage.cpp and head for this function:void ShapeBase::setImageState(...)
That may seem a bit confusing, but this is technically where weapons are fired, since weapon firing is actually an effect of the image system changing states. You can use this if statement in that function to determine if this is a fire event or just something passive, like a reload or out of ammo state:
if (newState == image.dataBlock->fireState)
Note that the more traditional concept of "firing" actually takes place in the onFire function in your weapon's .CS file; this is where the projectile object is actually created and given velocity as well as where ammo is consumed.
Torque Owner Matt Vitelli