Mercurial > mm7
diff SpriteObject.cpp @ 2207:ff8920a40c21
fixpoint_mul
author | Ritor1 |
---|---|
date | Thu, 06 Feb 2014 17:20:12 +0600 |
parents | 00bd098f6435 |
children | aff7a7b072b7 |
line wrap: on
line diff
--- a/SpriteObject.cpp Thu Feb 06 00:38:03 2014 +0600 +++ b/SpriteObject.cpp Thu Feb 06 17:20:12 2014 +0600 @@ -274,9 +274,7 @@ } } else - { v58 = 1; - } if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) ) { if ( v58 ) @@ -493,21 +491,19 @@ + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16; if ( (stru_721530.speed >> 3) > v56 ) v56 = stru_721530.speed >> 3; - v57 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.x) >> 16; - v58 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.y) >> 16; - v60 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.z) >> 16; - pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57; - pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58; + //v57 = fixpoint_mul(v56, face->pFacePlane.vNormal.x); + //v58 = fixpoint_mul(v56, face->pFacePlane.vNormal.y); + v60 = fixpoint_mul(v56, face->pFacePlane.vNormal.z); + pSpriteObjects[uLayingItemID].vVelocity.x += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.x); + pSpriteObjects[uLayingItemID].vVelocity.y += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.y); if ( face->pFacePlane.vNormal.z <= 32000 ) - { v37 = 2 * (short)v60; - } else { v36 = v60; pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60; - v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16; - v37 = (unsigned int)(32000 * v36) >> 16; + v58 = fixpoint_mul(0x7D00, v36); + v37 = fixpoint_mul(32000, v36); } pSpriteObjects[uLayingItemID].vVelocity.z += v37; if ( BYTE3(face->uAttributes) & 0x10 ) @@ -518,7 +514,7 @@ if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 ) { - if ( BYTE3(face->uAttributes) & 0x10 ) + if ( face->uAttributes & 0x10000000 ) EventProcessor(face->sCogTriggeredID, 0, 1); goto LABEL_74; } @@ -536,8 +532,8 @@ + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y); v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y); - pSpriteObjects[uLayingItemID].vVelocity.x = (unsigned __int64)(stru_5C6E00->Cos(v38) * (signed __int64)v57) >> 16; - pSpriteObjects[uLayingItemID].vVelocity.y = (unsigned __int64)(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v57) >> 16; + pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v38), v57); + pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi), v57); goto LABEL_74; } }