Jelajahi Sumber

Merges in Monkey's fixes PR with a resolution for a conflict

Areloch 10 tahun lalu
induk
melakukan
bedc79aacb

+ 1 - 1
Engine/lib/libvorbis/lib/codebook.c

@@ -450,7 +450,7 @@ long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
       }
     }
   }else{
-    int i,j;
+    int i;
 
     for(i=0;i<n;){
       a[i++]=0.f;

+ 2 - 1
Engine/source/console/consoleFunctions.cpp

@@ -476,7 +476,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
       if(!scan)
       {
          dStrcpy(ret + dstp, source + scanp);
-         break;
+         return ret;
       }
       U32 len = scan - (source + scanp);
       dStrncpy(ret + dstp, source + scanp, len);
@@ -1594,6 +1594,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),,
 DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/splash.bmp"),
    "Display a startup splash window suitable for showing while the engine still starts up.\n\n"
    "@note This is currently only implemented on Windows.\n\n"
+   "@param path	relative path to splash screen image to display.\n"
    "@return True if the splash window could be successfully initialized.\n\n"
    "@ingroup Platform" )
 {

+ 1 - 1
Engine/source/console/typeValidators.cpp

@@ -101,7 +101,7 @@ void Point3NormalizeValidator::validateType(SimObject *object, void *typePtr)
 namespace CommonValidators
 {
    FRangeValidator PositiveFloat(0.0f, F32_MAX);
-   FRangeValidator PositiveNonZeroFloat(F32( POINT_EPSILON ) , F32_MAX);
+   FRangeValidator PositiveNonZeroFloat((F32)POINT_EPSILON, F32_MAX);
    FRangeValidator NormalizedFloat(0.0f, 1.0f);
    Point3NormalizeValidator NormalizedPoint3(1.0f);
 };

+ 7 - 2
Engine/source/gfx/gFont.cpp

@@ -568,6 +568,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector<U32> &startLineOff
 
    for (U32 i = 0; i < len;)
    {
+      U32 wide = 0; 
       startLine = i;
       startLineOffset.push_back(startLine);
 
@@ -584,6 +585,10 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector<U32> &startLineOff
          else if(isValidChar(txt[i]))
          {
             lineStrWidth += getCharInfo(txt[i]).xIncrement;
+            if(txt[i] < 0) // symbols which code > 127
+            {  
+               wide++; i++;
+            }
             if( lineStrWidth > lineWidth )
             {
                needsNewLine = true;
@@ -595,7 +600,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector<U32> &startLineOff
       if (!needsNewLine)
       {
          // we are done!
-         lineLen.push_back(i - startLine);
+         lineLen.push_back(i - startLine - wide);
          return;
       }
 
@@ -628,7 +633,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector<U32> &startLineOff
          }
       }
 
-      lineLen.push_back(j - startLine);
+      lineLen.push_back(j - startLine - wide);
       i = j;
 
       // Now we need to increment through any space characters at the

+ 0 - 3
Engine/source/gui/containers/guiContainer.cpp

@@ -128,9 +128,6 @@ bool GuiContainer::reOrder(SimObject* obj, SimObject* target)
 
 bool GuiContainer::resize( const Point2I &newPosition, const Point2I &newExtent )
 {
-   RectI oldBounds = getBounds();
-   Point2I minExtent = getMinExtent();
-
    if( !Parent::resize( newPosition, newExtent ) )
       return false;
    

+ 2 - 0
Engine/source/gui/containers/guiScrollCtrl.cpp

@@ -493,6 +493,8 @@ void GuiScrollCtrl::calcThumbs()
 void GuiScrollCtrl::scrollDelta(S32 deltaX, S32 deltaY)
 {
    scrollTo(mChildRelPos.x + deltaX, mChildRelPos.y + deltaY);
+
+   onScroll_callback();
 }
 
 //-----------------------------------------------------------------------------

+ 1 - 1
Engine/source/gui/containers/guiTabBookCtrl.cpp

@@ -622,7 +622,7 @@ S32 GuiTabBookCtrl::calculatePageTabWidth( GuiTabPageCtrl *page )
 
    const char* text = page->getText();
 
-   if( !text || dStrlen(text) == 0 || mProfile->mFont == NULL )
+   if( !text || dStrlen(text) == 0 || mProfile == NULL || mProfile->mFont == NULL )
       return mMinTabWidth;
 
    GFont *font = mProfile->mFont;

+ 4 - 1
Engine/source/gui/controls/guiConsoleTextCtrl.cpp

@@ -113,7 +113,10 @@ void GuiConsoleTextCtrl::onPreRender()
 {   
    if ( mConsoleExpression.isNotEmpty() )
    {
-      mResult = (const char*)Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
+      Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
+      
+      //Fixes a bug with the above not always grabbing the console text.
+      mResult = Con::getVariable("$guiConsoleTextCtrlTemp");
       
       // Of the resulting string we will be printing,
       // Find the number of lines and length of each.      

+ 5 - 5
Engine/source/gui/controls/guiMLTextCtrl.cpp

@@ -168,7 +168,7 @@ DefineEngineMethod( GuiMLTextCtrl, scrollToTag, void, (S32 tagID),,
    object->scrollToTag( tagID );
 }
 
-DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, ( S32 param1, S32 param2),,
+DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, (),,
    "@brief Scroll to the top of the text.\n\n"
    "@tsexample\n"
    "// Inform GuiMLTextCtrl object to scroll to its top\n"
@@ -631,7 +631,7 @@ bool GuiMLTextCtrl::setCursorPosition(const S32 newPosition)
       mCursorPosition = 0;
       return true;
    }
-   else if (newPosition >= mTextBuffer.length()) 
+   else if (newPosition >= mTextBuffer.length() - 1)
    {
       mCursorPosition = mTextBuffer.length();
       return true;
@@ -669,11 +669,11 @@ void GuiMLTextCtrl::getCursorPositionAndColor(Point2I &cursorTop, Point2I &curso
 {
    S32 x = 0;
    S32 y = 0;
-   S32 height = mProfile->mFont->getHeight();
+   S32 height = (mProfile && mProfile->mFont) ? mProfile->mFont->getHeight() : 0;
    color = mProfile->mCursorColor;
    for(Line *walk = mLineList; walk; walk = walk->next)
    {
-      if ((mCursorPosition <= walk->textStart + walk->len) || (walk->next == NULL))
+      if ((mCursorPosition < walk->textStart + walk->len) || (walk->next == NULL))
       {
          // it's in the atoms on this line...
          y = walk->y;
@@ -768,7 +768,7 @@ void GuiMLTextCtrl::onMouseDown(const GuiEvent& event)
    mSelectionAnchorDropped = event.mousePoint;
    if (mSelectionAnchor < 0)
       mSelectionAnchor = 0;
-   else if (mSelectionAnchor >= mTextBuffer.length())
+   else if (mSelectionAnchor >= mTextBuffer.length() - 1)
       mSelectionAnchor = mTextBuffer.length();
 
    mVertMoveAnchorValid = false;

+ 3 - 2
Engine/source/gui/controls/guiTextEditCtrl.cpp

@@ -212,8 +212,7 @@ void GuiTextEditCtrl::execConsoleCallback()
    Parent::execConsoleCallback();
 
    // Update the console variable:
-   if ( mConsoleVariable[0] )
-      Con::setVariable( mConsoleVariable, mTextBuffer.getPtr8() );
+   setVariable(mTextBuffer.getPtr8());
 }
 
 void GuiTextEditCtrl::updateHistory( StringBuffer *inTxt, bool moveIndex )
@@ -374,6 +373,8 @@ S32 GuiTextEditCtrl::calculateCursorPos( const Point2I &globalPos )
 
 void GuiTextEditCtrl::onMouseDown( const GuiEvent &event )
 {
+   if(!isActive())
+      return;
    mDragHit = false;
 
    // If we have a double click, select all text.  Otherwise

+ 2 - 0
Engine/source/gui/core/guiControl.cpp

@@ -604,6 +604,8 @@ void GuiControl::setUpdate()
 void GuiControl::renderJustifiedText(Point2I offset, Point2I extent, const char *text)
 {
    GFont *font = mProfile->mFont;
+   if(!font)
+      return;
    S32 textWidth = font->getStrWidthPrecise((const UTF8*)text);
    U32 textHeight = font->getHeight();
 

+ 2 - 2
Engine/source/gui/editor/guiMenuBar.cpp

@@ -159,7 +159,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const ch
 // console methods
 //------------------------------------------------------------------------------
 
-DefineEngineMethod( GuiMenuBar, clearMenus, void, ( S32 param1, S32 param2),,
+DefineEngineMethod( GuiMenuBar, clearMenus, void, (),,
    "@brief Clears all the menus from the menu bar.\n\n"
    "@tsexample\n"
    "// Inform the GuiMenuBar control to clear all menus from itself.\n"
@@ -1035,7 +1035,7 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text,
    newMenuItem->checkGroup = checkGroup;
    newMenuItem->nextMenuItem = NULL;
    newMenuItem->acceleratorIndex = 0;
-   newMenuItem->enabled = text[0] != '-';
+   newMenuItem->enabled = (dStrlen(text) > 1 || text[0] != '-');
    newMenuItem->visible = true;
    newMenuItem->bitmapIndex = -1;
 

+ 4 - 0
Engine/source/gui/editor/guiShapeEdPreview.cpp

@@ -1608,6 +1608,8 @@ void GuiShapeEdPreview::renderNodes() const
 
 void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
 {
+   if(mModel->mNodeTransforms.size() <= index || index < 0)
+      return;
    const Point3F xAxis( 1.0f,  0.15f, 0.15f );
    const Point3F yAxis( 0.15f, 1.0f,  0.15f );
    const Point3F zAxis( 0.15f, 0.15f, 1.0f  );
@@ -1631,6 +1633,8 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
 
 void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
 {
+   if(index < 0 || index >= mModel->getShape()->nodes.size() || index >= mProjectedNodes.size())
+      return;
    const TSShape::Node& node = mModel->getShape()->nodes[index];
    const String& nodeName = mModel->getShape()->getName( node.nameIndex );
 

+ 9 - 14
Engine/source/gui/utility/guiMouseEventCtrl.cpp

@@ -46,7 +46,7 @@ ConsoleDocClass( GuiMouseEventCtrl,
 );
 
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDown, void, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDown, void, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ),
 														  ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse is pressed down while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -70,7 +70,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDown, void, ( U8 modifier, Point2I
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseUp, void, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseUp, void, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ),
 													    ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse is released while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -94,7 +94,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseUp, void, ( U8 modifier, Point2I m
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseMove, void, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseMove, void, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse is moved (without dragging) while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -118,7 +118,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseMove, void, ( U8 modifier, Point2I
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDragged, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDragged, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse is dragged while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -142,7 +142,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseDragged, void, (  U8 modifier, Poi
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseEnter, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseEnter, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse enters this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -166,7 +166,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseEnter, void, (  U8 modifier, Point
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseLeave, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseLeave, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse leaves this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -190,7 +190,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onMouseLeave, void, (  U8 modifier, Point
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseDown, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseDown, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the right mouse button is pressed while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -214,7 +214,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseDown, void, (  U8 modifier, P
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseUp, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseUp, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the right mouse button is released while in this control.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -238,7 +238,7 @@ IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseUp, void, (  U8 modifier, Poi
    "@see GuiControl\n\n"
 );
 
-IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseDragged, void, (  U8 modifier, Point2I mousePoint,U8 mouseClickCount  ),
+IMPLEMENT_CALLBACK( GuiMouseEventCtrl, onRightMouseDragged, void, (  S32 modifier, Point2I mousePoint, S32 mouseClickCount  ),
 												   ( modifier, mousePoint, mouseClickCount ),
    "@brief Callback that occurs whenever the mouse is dragged in this control while the right mouse button is pressed.\n\n"
    "@param modifier Key that was pressed during this callback. Values are:\n\n" 
@@ -270,11 +270,6 @@ GuiMouseEventCtrl::GuiMouseEventCtrl()
 //------------------------------------------------------------------------------
 void GuiMouseEventCtrl::sendMouseEvent(const char * name, const GuiEvent & event)
 {
-   char buf[3][32];
-   dSprintf(buf[0], 32, "%d", event.modifier);
-   dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
-   dSprintf(buf[2], 32, "%d", event.mouseClickCount);
-
    if(dStricmp(name,"onMouseDown") == 0)
 	   onMouseDown_callback(event.modifier, event.mousePoint, event.mouseClickCount);
    else if(dStricmp(name,"onMouseUp") == 0)

+ 9 - 9
Engine/source/gui/utility/guiMouseEventCtrl.h

@@ -41,15 +41,15 @@ class GuiMouseEventCtrl : public GuiControl
 
       GuiMouseEventCtrl();
 
-	  DECLARE_CALLBACK( void, onMouseDown, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-  	  DECLARE_CALLBACK( void, onMouseUp, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-  	  DECLARE_CALLBACK( void, onMouseMove, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-  	  DECLARE_CALLBACK( void, onMouseDragged, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-  	  DECLARE_CALLBACK( void, onMouseEnter, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-  	  DECLARE_CALLBACK( void, onMouseLeave, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-	  DECLARE_CALLBACK( void, onRightMouseDown, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-	  DECLARE_CALLBACK( void, onRightMouseUp, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
-	  DECLARE_CALLBACK( void, onRightMouseDragged, ( U8 modifier, Point2I mousePoint,U8 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseDown, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseUp, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseMove, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseDragged, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseEnter, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onMouseLeave, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onRightMouseDown, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onRightMouseUp, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
+      DECLARE_CALLBACK( void, onRightMouseDragged, ( S32 modifier, Point2I mousePoint, S32 mouseClickCount ));
 
       // GuiControl
       void onMouseDown(const GuiEvent & event);

+ 1 - 1
Engine/source/math/mMatrix.cpp

@@ -163,7 +163,7 @@ EulerF MatrixF::toEuler() const
    const F32 * mat = m;
 
    EulerF r;
-   r.x = mAsin(mat[MatrixF::idx(2,1)]);
+   r.x = mAsin(mClampF(mat[MatrixF::idx(2,1)], -1.0, 1.0));
 
    if(mCos(r.x) != 0.f)
    {

+ 28 - 1
Engine/source/math/mPoint3.h

@@ -233,11 +233,13 @@ class Point3D
    bool  isZero() const;
    F64 len()    const;
    F64 lenSquared() const;
+   F64 magnitudeSafe() const;
 
    //-------------------------------------- Mathematical mutators
   public:
    void neg();
    void normalize();
+   void normalizeSafe();
    void normalize(F64 val);
    void convolve(const Point3D&);
    void convolveInverse(const Point3D&);
@@ -728,11 +730,13 @@ inline Point3F& Point3F::operator*=(const Point3F &_vec)
 
 inline Point3F Point3F::operator/(const Point3F &_vec) const
 {
+   AssertFatal(_vec.x != 0.0f && _vec.y != 0.0f && _vec.z != 0.0f, "Error, div by zero attempted");
    return Point3F(x / _vec.x, y / _vec.y, z / _vec.z);
 }
 
 inline Point3F& Point3F::operator/=(const Point3F &_vec)
 {
+   AssertFatal(_vec.x != 0.0f && _vec.y != 0.0f && _vec.z != 0.0f, "Error, div by zero attempted");
    x /= _vec.x;
    y /= _vec.y;
    z /= _vec.z;
@@ -855,7 +859,8 @@ inline F64 Point3D::lenSquared() const
 
 inline F64 Point3D::len() const
 {
-   return mSqrtD(x*x + y*y + z*z);
+   F64 temp = x*x + y*y + z*z;
+   return (temp > 0.0) ? mSqrtD(temp) : 0.0;
 }
 
 inline void Point3D::normalize()
@@ -863,6 +868,28 @@ inline void Point3D::normalize()
    m_point3D_normalize(*this);
 }
 
+inline F64 Point3D::magnitudeSafe() const
+{
+   if( isZero() )
+   {
+      return 0.0;
+   }
+   else
+   {
+      return len();
+   }
+}
+
+inline void Point3D::normalizeSafe()
+{
+   F64 vmag = magnitudeSafe();
+
+   if( vmag > POINT_EPSILON )
+   {
+      *this *= F64(1.0 / vmag);
+   }
+}
+
 inline void Point3D::normalize(F64 val)
 {
    m_point3D_normalize_f(*this, val);

+ 43 - 28
Engine/source/math/mQuat.cpp

@@ -32,33 +32,48 @@ const QuatF QuatF::Identity(0.0f,0.0f,0.0f,1.0f);
 
 QuatF& QuatF::set( const EulerF & e )
 {
-   F32 cx, sx;
-   F32 cy, sy;
-   F32 cz, sz;
-   mSinCos( e.x * 0.5f, sx, cx );
-   mSinCos( e.y * 0.5f, sy, cy );
-   mSinCos( e.z * 0.5f, sz, cz );
-
-   // Qyaw(z) = [ (0, 0, sin z/2), cos z/2 ]
-   // Qpitch(x) = [ (sin x/2, 0, 0), cos x/2 ]
-   // Qroll(y) = [ (0, sin y/2, 0), cos y/2 ]
-   // this = Qresult = Qyaw*Qpitch*Qroll ZXY
-   //
-   // The code that folows is a simplification of:
-   // roll*=pitch;
-   // roll*=yaw;
-   // *this = roll;
-   F32 cycz, sysz, sycz, cysz;
-   cycz = cy*cz;
-   sysz = sy*sz;
-   sycz = sy*cz;
-   cysz = cy*sz;
-   w = cycz*cx - sysz*sx;
-   x = cycz*sx + sysz*cx;
-   y = sycz*cx + cysz*sx;
-   z = cysz*cx - sycz*sx;
-
-   return *this;
+	/*
+	F32 cx, sx;
+	F32 cy, sy;
+	F32 cz, sz;
+	mSinCos( -e.x * 0.5f, sx, cx );
+	mSinCos( -e.y * 0.5f, sy, cy );
+	mSinCos( -e.z * 0.5f, sz, cz );
+
+	// Qyaw(z)   = [ (0, 0, sin z/2), cos z/2 ]
+	// Qpitch(x) = [ (sin x/2, 0, 0), cos x/2 ]
+	// Qroll(y)  = [ (0, sin y/2, 0), cos y/2 ]
+	// this = Qresult = Qyaw*Qpitch*Qroll  ZXY
+	//
+	// The code that folows is a simplification of:
+	//    roll*=pitch;
+	//    roll*=yaw;
+	//    *this = roll;
+	F32 cycz, sysz, sycz, cysz;
+	cycz = cy*cz;
+	sysz = sy*sz;
+	sycz = sy*cz;
+	cysz = cy*sz;
+	w = cycz*cx + sysz*sx;
+	x = cycz*sx + sysz*cx;
+	y = sycz*cx - cysz*sx;
+	z = cysz*cx - sycz*sx;
+	*/
+	// Assuming the angles are in radians.
+	F32 c1 = mCos(e.y * 0.5f);
+	F32 s1 = mSin(e.y * 0.5f);
+	F32 c2 = mCos(e.z * 0.5f);
+	F32 s2 = mSin(e.z * 0.5f);
+	F32 c3 = mCos(e.x * 0.5f);
+	F32 s3 = mSin(e.x * 0.5f);
+	F32 c1c2 = c1*c2;
+	F32 s1s2 = s1*s2;
+	w =c1c2*c3 - s1s2*s3;
+	x =c1c2*s3 + s1s2*c3;
+	y =s1*c2*c3 + c1*s2*s3;
+	z =c1*s2*c3 - s1*c2*s3;
+
+	return *this;
 }
 
 QuatF& QuatF::operator *=( const QuatF & b )
@@ -289,7 +304,7 @@ QuatF & QuatF::interpolate( const QuatF & q1, const QuatF & q2, F32 t )
    return *this;
 }
 
-Point3F & QuatF::mulP(const Point3F& p, Point3F* r)
+Point3F & QuatF::mulP(const Point3F& p, Point3F* r) const
 {
    QuatF qq;
    QuatF qi = *this;

+ 1 - 1
Engine/source/math/mQuat.h

@@ -81,7 +81,7 @@ public:
    QuatF& interpolate( const QuatF & q1, const QuatF & q2, F32 t );
    F32  angleBetween( const QuatF & q );
 
-   Point3F& mulP(const Point3F& a, Point3F* b);   // r = p * this
+   Point3F& mulP(const Point3F& a, Point3F* r) const;   // r = p * this
    QuatF& mul(const QuatF& a, const QuatF& b);    // This = a * b
 
    // Vectors passed in must be normalized

+ 1 - 1
Engine/source/platformWin32/winFileio.cpp

@@ -998,7 +998,7 @@ S32 Platform::getFileSize(const char *pFilePath)
       return -1;
 
    // must be a real file then
-   return findData.nFileSizeLow;
+   return ((findData.nFileSizeHigh * (MAXDWORD+1)) + findData.nFileSizeLow);
 }
 
 

+ 5 - 0
Engine/source/scene/sceneContainer.cpp

@@ -1012,6 +1012,11 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
       F32 currStartX = normalStart.x;
 
       AssertFatal(currStartX != normalEnd.x, "This is going to cause problems in SceneContainer::castRay");
+      if(mIsNaN_F(currStartX))
+      {
+         PROFILE_END();
+         return false;
+      }
       while (currStartX != normalEnd.x)
       {
          F32 currEndX   = getMin(currStartX + csmTotalBinSize, normalEnd.x);

+ 2 - 2
Engine/source/scene/sceneObject.cpp

@@ -720,9 +720,9 @@ const char* SceneObject::_getRenderEnabled( void* object, const char* data )
 {
    SceneObject* obj = reinterpret_cast< SceneObject* >( object );
    if( obj->mObjectFlags.test( RenderEnabledFlag ) )
-      return "true";
+      return "1";
    else
-      return "false";
+      return "0";
 }
 
 //-----------------------------------------------------------------------------