diff UI/UiGame.cpp @ 2166:00bd098f6435

fixpoint_mul in different functions and others
author Ritor1
date Fri, 17 Jan 2014 17:58:48 +0600
parents 0a1438c16c2b
children 5b27c035a241
line wrap: on
line diff
--- a/UI/UiGame.cpp	Thu Jan 16 17:34:48 2014 +0600
+++ b/UI/UiGame.cpp	Fri Jan 17 17:58:48 2014 +0600
@@ -1985,10 +1985,10 @@
         long long _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
         uint _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
         int _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
-        pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-        pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
-        pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-        pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+        pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
+        pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
+        pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
+        pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
         v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
         if ( v15 > 100 )
           v15 = 100;
@@ -2001,10 +2001,10 @@
     for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
     {
       BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
-      pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-      pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
-      pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
-      pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
+      pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
+      pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
+      pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
+      pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
       pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color);
     }
   }
@@ -2040,8 +2040,8 @@
         if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID )
           continue;
         //if (uWizardEyeSkillLevel == 1
-        pPoint_X = uCenterX + ((unsigned __int64)((pSpriteObjects[i].vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((signed __int64)((pSpriteObjects[i].vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16);
+        pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom);
+        pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom);
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z &&
         //     pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w)
         {
@@ -2068,15 +2068,15 @@
     for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс)
     {
       if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled
-       && (pActors[i].uAIState == Dead || BYTE1(pActors[i].uAttributes) & 0x80) )
+       && (pActors[i].uAIState == Dead || pActors[i].uAttributes & 0x8000) )
       {
-        pPoint_X = uCenterX + ((unsigned __int64)(( pActors[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((unsigned __int64)(( pActors[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16);
+        pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom));
+        pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom));
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
         //  && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
         {
           pColor = ui_game_minimap_actor_friendly_color;
-          if ( BYTE3(pActors[i].uAttributes) & 1 )
+          if ( pActors[i].uAttributes & 0x1000000 )
             pColor = ui_game_minimap_actor_hostile_color;
           if ( pActors[i].uAIState == Dead)
             pColor = ui_game_minimap_actor_corpse_color;
@@ -2100,8 +2100,8 @@
     {
       if ( pLevelDecorations[i].uFlags & 8 )
       {
-        pPoint_X = uCenterX + ((unsigned __int64)((pLevelDecorations[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16);
-        pPoint_Y = uCenterY - ((unsigned __int64)((pLevelDecorations[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16);
+        pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom));
+        pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom));
         //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
         //  && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
         {