Game Development Community

Fix for InteriorInstance's that only have NULL surfaces

by Matt Fairfax · in Torque Game Engine · 06/22/2007 (3:06 pm) · 5 replies

A small bug crept into TGE 1.5.1 and TGE 1.5.2 where if you try to add an InteriorInstance that only has NULL surfaces or an InteriorInstance that only uses Static Meshes and no brushes to a scene that already has an InteriorInstance in it, it would cause a hard crash.

This was caused because the lack of any visible surfaces would cause Interior::setupActivePolyList() to return early and some of the global variables that Interior uses for rendering would never get reset back to zero.

Simply add these lines to the top of Interior::setupActivePolyList() in engine\interior\interior.cc so that it looks like this:

void Interior::setupActivePolyList(ZoneVisDeterminer& zoneDeterminer,
                                   SceneState*        state,
                                   const Point3F&     rPoint,
                                   const Point3F&     osCamVector,
                                   const Point3F&     osZVec,
                                   const F32          worldZ,
                                   const Point3F&     scale)
{
   // These global variables need to be initialized in case we return early
   sgActivePolyListSize  = 0;
   sgEnvironPolyListSize = 0;
   sgFogPolyListSize     = 0;

About the author

I am a Game Designer at PopCap who has worked on PvZ Adventures, PvZ2, Peggle Blast, and Bejeweled Skies. I am an ex-GarageGames employee who helped ship TGE, TGEA, Torque 3D, and Constructor.


#1
06/22/2007 (4:47 pm)
Thanks Matt.
#2
07/07/2007 (5:59 am)
I also thank you Matt :)
#3
07/10/2007 (3:36 pm)
Matt, would this bug cause a high winding count to occur?
#4
06/25/2009 (5:51 am)
I did the following with a clean install of AFX 1.1 this morning, and, I get this error whenever I exec car.cs in my game:

www.mediabreeze.com/images/afxError.jpg
Note:


-- This error ONLY occurs when I exec car.cs within game.cs. So I am assuming it has something to do with the car and the particle emitter.

My car.cs script is below:

www.mediabreeze.com/images/car.html

Any help would be appreciated

Also, please note that the car works fine with the standard afx executable that came with the SDK (not the debug version that I created with SDK).


#5
06/25/2009 (6:09 am)
@Matt

This is actually a little more relevant to this post:
The other thing I noticed is that although this fix works (allowing for difs with null.png textures NOT to crash the engine), after you relight the scence, all textures on those interiors become black and it does not seem fixable. Please advise.