Mercurial > mm7
diff SpriteObject.cpp @ 1574:2d9c8f609a3c
Here and there cleanings.
author | Nomad |
---|---|
date | Mon, 09 Sep 2013 17:17:53 +0200 |
parents | 9a6567c6c76c |
children | 7182930263b3 |
line wrap: on
line diff
--- a/SpriteObject.cpp Sun Sep 08 19:16:37 2013 +0600 +++ b/SpriteObject.cpp Mon Sep 09 17:17:53 2013 +0200 @@ -82,11 +82,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -107,11 +107,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -132,11 +132,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16; + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16; + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -157,11 +157,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -182,11 +182,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -331,9 +331,9 @@ if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) ) v1->vVelocity.z = 0; - v1->vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.x) >> 16); - v1->vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.y) >> 16); - v1->vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.z) >> 16); + v1->vVelocity.x = fixpoint_sub0(58500, v1->vVelocity.x); + v1->vVelocity.y = fixpoint_sub0(58500, v1->vVelocity.y); + v1->vVelocity.z = fixpoint_sub0(58500, v1->vVelocity.z); if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 ) { @@ -620,12 +620,12 @@ int v18; // eax@52 int v19; // ecx@52 Vec3_short_ *v20; // ecx@53 - int v21; // ecx@57 + //int v21; // ecx@57 __int16 v22; // ax@57 int v23; // edi@62 - int v24; // edi@62 - int v25; // eax@62 - unsigned __int64 v26; // qax@62 + //int v24; // edi@62 + //int v25; // eax@62 + //unsigned __int64 v26; // qax@62 unsigned __int8 v27; // sf@64 unsigned __int8 v28; // of@64 __int16 v29; // di@67 @@ -641,7 +641,7 @@ int v39; // [sp+80h] [bp-10h]@33 Actor *v39b; int v40; // [sp+84h] [bp-Ch]@28 - int v41; // [sp+88h] [bp-8h]@34 + //int v41; // [sp+88h] [bp-8h]@34 int v42; // [sp+8Ch] [bp-4h]@4 //uLayingItemID_ = uLayingItemID; @@ -791,7 +791,7 @@ pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); - pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); + pSpriteObject->uSectorID = stru_721530.uSectorID; stru_721530.field_70 += stru_721530.field_7C; if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) return; @@ -801,15 +801,8 @@ v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); - v42 = stru_5C6E00->Cos(v23); - v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v24 = v23; - pSpriteObject->vVelocity.x = (unsigned int)(v42 * v40) >> 16; - v25 = stru_5C6E00->Sin(v23); - v42 = v25; - v26 = v25 * (signed __int64)v40; - v41 = v26 >> 16; - pSpriteObject->vVelocity.y = WORD1(v26); + pSpriteObject->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v23), v40); + pSpriteObject->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v23), v40); } else { @@ -823,25 +816,17 @@ + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; if ( (stru_721530.speed >> 3) > v42 ) v42 = stru_721530.speed >> 3; - v40 = v16->pFacePlane_old.vNormal.x; - v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v41 = v16->pFacePlane_old.vNormal.y; - v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - v39 = v16->pFacePlane_old.vNormal.z; - v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16; - pSpriteObject->vVelocity.x += 2 * v40; - pSpriteObject->vVelocity.y += 2 * v41; + pSpriteObject->vVelocity.x += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.x); + pSpriteObject->vVelocity.y += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.y); + v39 = fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.z); if ( v16->pFacePlane_old.vNormal.z <= 32000 ) { v22 = 2 * v39; } else { - v21 = v39; - v40 = 32000; pSpriteObject->vVelocity.z += v39; - v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16; - v22 = (unsigned int)(v40 * v21) >> 16; + v22 = fixpoint_sub0(32000, v39); } pSpriteObject->vVelocity.z += v22; if ( BYTE3(v16->uAttributes) & 0x10 ) @@ -876,20 +861,12 @@ LABEL_63: //v2 = v37; LABEL_64: - v41 = pSpriteObject->vVelocity.x; - v40 = 58500; - v41 = (unsigned __int64)(58500i64 * v41) >> 16; - pSpriteObject->vVelocity.x = v41; - v41 = pSpriteObject->vVelocity.y; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; - v40 = 58500; - pSpriteObject->vVelocity.y = v41; - v41 = pSpriteObject->vVelocity.z; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; + pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); ++uFaceID; v28 = __OFSUB__(uFaceID, 100); v27 = uFaceID - 100 < 0; - pSpriteObject->vVelocity.z = v41; if ( !(v27 ^ v28) ) return; v8 = 0; @@ -916,18 +893,10 @@ pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); v8 = 0; } - v42 = pSpriteObject->vVelocity.x; - uFaceID = 58500; - v42 = (unsigned __int64)(58500i64 * v42) >> 16; - pSpriteObject->vVelocity.x = v42; - v42 = pSpriteObject->vVelocity.y; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; - uFaceID = 58500; - pSpriteObject->vVelocity.y = v42; - v42 = pSpriteObject->vVelocity.z; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; + pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); v9 = pSpriteObject->vVelocity.x; - pSpriteObject->vVelocity.z = v42; if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) { pSpriteObject->vVelocity.z = v8;