Game Development Community

TGEA 1.8 & 1.7.1 Damage Flash not rendering

by Andy Rollins · in Torque Game Engine Advanced · 12/22/2008 (1:28 pm) · 19 replies

There appears to be a bug in stock TGEA where the console function setdamageflash() isn't rendering the Red screen flash as it does in TGE. I've tested this in stock TGEA 1.7.1 and 1.8 and it doesn't work in either.

Anyone come across this or have a solution to getting it working?

#1
12/22/2008 (2:08 pm)
Digging into this it appears that this has just been omitted from TGEA, if I read the code correctly the red damage flash is rendered by a call to void GameRenderFilters(const CameraQuery& camq) in game.cc looking at that function in TGEA though it's just a stub!!

void GameRenderFilters(const CameraQuery& camq)
{
   // Stubbed out currently - check version history for old code.
}

Can someone please confirm this to be the case?
#2
01/24/2009 (4:19 am)
this is the case
#3
01/25/2009 (3:08 am)
lol thanks... I think!!
#4
01/25/2009 (7:03 am)
I am confused as to why every time a newer version comes out , we lose more and more functionality from the last version. I am finding Stubb out/missing code all over the place.
#5
01/25/2009 (7:32 am)
Michael, don't you know yet? its because we dont need/want it, without anyone actually asking us if we need/want it. (what happened with player splash rings? we obviously dont want/need to see those rings when a player jumps into the water, do we now, and the associated wakes that we've been trying for weeks to implement, without realizing we dont really need/want them, and of course bullet splash rings, who needs those?)
I DO!!!!
#6
01/25/2009 (7:33 am)
Did they ever have this working in tgea?
I looked in tse_ms4 and the code is all there (it looks like) but it's all commented out.
void GameRenderFilters(const CameraQuery& camq) isn't in tgea_1.0.3 at all.
I'm wondering why they took the code out. I'm sure it didn't work, and with the different configuration of 1.8 from the rest, most likely wouldn't work here eather, but this is something that should have been fixed long ago.
#7
01/25/2009 (8:55 am)
@deepscratch:

Quote:
what happened with player splash rings? we obviously dont want/need to see those rings when a player jumps into the water, do we now, and the associated wakes that we've been trying for weeks to implement, without realizing we dont really need/want them, and of course bullet splash rings, who needs those?)

Do you mean like these?


What sort of problem are you seeing? Did you put in the water fixes, and the aligned particles resource?


#8
01/25/2009 (9:20 am)
That's a cool effect.
#9
01/25/2009 (10:35 am)
@Jaimi,
yes, thats what I've been trying to get right FOR WEEKS!!!, I've done the aligned particles resource, works 100%, even bought the sticks and twigs pack for the wake, tried a million combinations of datablocks, tried removing refs to splashdata, reinstated splashdata. I just keep getting a flurry of mist and foam, no wake whatsoever.
Jaimi, PLEASE can you try and help me to get it right? please?

BTW, what water fixes
#10
01/25/2009 (10:56 am)
Deepscratch...mabe you should take this discussion to it's own thread instead of derailing this one.
#11
01/25/2009 (12:06 pm)
yeah, you're right. will do
#12
01/25/2009 (12:54 pm)
Ok - I've been researching this, and there are two issues, not just one. First off, like Andy says, the GameRenderFilters() function does nothing. But even if you do fix it, there is another harder to find problem - in Gamebase.h, getDamageFlash is incorrectly defined. This results in getDamageFlash() from Shapebase objects always returning 1.0f when transmitted.

To fix this, go into Gamebase.h,

Find these two declarations:
virtual F32 getDamageFlash() { return 1.0f; }
   virtual F32 getWhiteOut() { return 1.0f; }
and mark them const, like this:
virtual F32 getDamageFlash() const { return 1.0f; }
   virtual F32 getWhiteOut() const { return 1.0f; }


in addition, if you are using AFX in 1.7.1, then you will need to remove the #ifdef that prohibits GameRenderFilters from being called at all in afxTSCtrl.cpp, afxTSCtrl::onRender:

//#if !defined(TGEA_ENGINE)
  CameraQuery camq;
  if (GameProcessCameraQuery(&camq))
    GameRenderFilters(camq);
//#endif

edit: Thanks to Alex Scarborough for figuring out the true cause.
#13
01/25/2009 (1:24 pm)
And, in case you need it, here's a working replacement for GameRenderFilters in GameConnection.cpp. It's simplistic, and only supports the damage flash, but you can extend it as needed. I've verified it works correctly by running around and hitting myself with Thor's Hammer.

void GameRenderFilters(const CameraQuery& camq)
{
   // Stubbed out currently - check version history for old code.
   GameConnection* connection = GameConnection::getConnectionToServer();

   F32 damageFlash = 0.0f;
   F32 whiteOut = 0.0f;
   F32 blackOut = 0.0f;

   if(connection)
   {
      damageFlash = connection->getDamageFlash();
      whiteOut = connection->getWhiteOut();
      blackOut = connection->getBlackOut();

      // add them all together and divide by 3. (invert blackOut...)
      GuiTSCtrl *tsCtrl;
      // if your screen is not called PlayGui, you will need to change this.
      // I'd considered adding a pointer to the tsctrl to the CameraQuery, but
      // since this is just a proof of concept, I didn't bother. I will do this 
      // for real later. (I want blood splatters, etc, not just a flash...)
      if (! Sim::findObject("PlayGui", tsCtrl)) 
      {
         return;
      }

      ColorI color(255,0,0,255 * damageFlash);
      GFX->getDrawUtil()->drawRectFill(Point2I(0,0),tsCtrl->getExtent(),color);
   }
}
#14
01/25/2009 (1:30 pm)
@Jaimi - sorry it's off topic, but what water fixes were you referring to?
#15
01/25/2009 (1:38 pm)
@Tony,deepscratch:

in Shapebase.cpp, the waterFind function was buggy. Replace it with this:

static void waterFind(SceneObject* obj,void * key)
{
   ShapeBase* shape = reinterpret_cast<ShapeBase*>(key);
   WaterBlock* wb   = dynamic_cast<WaterBlock*>(obj);
   AssertFatal(wb != NULL, "Error, not a water block!");
   if (wb == NULL) {
      sWaterCoverage = 0;
      return;
   }

   const Box3F& wbox = obj->getWorldBox();
   const Box3F& sbox = shape->getWorldBox();
   sWaterType = 0;
   if (wbox.isOverlapped(sbox)) 
   {      
      sWaterType = wb->getLiquidType();	  
      sWaterHeight = wb->getCenter();	  
      if(sbox.min.z < sWaterHeight)		
         sWaterCoverage = (sWaterHeight - sbox.min.z) / sbox.len_z();   
   }
}

Note: I'm not the original author of this fix.
#16
01/25/2009 (1:49 pm)
FYI - I'm going to post this as a resource so it doesn't get lost in the forums.
#17
01/25/2009 (2:56 pm)
Wow this thread has taken off and thanks for posting a solution Jaimi.. hadn't spotted the missing gameconnection issue.
#18
01/25/2009 (6:21 pm)
Note: Please see the resource for an updated fix.
#19
01/25/2009 (7:13 pm)
Thanks for the fix Jaimi. This is great.