comparison 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
comparison
equal deleted inserted replaced
2165:47ac9e87690c 2166:00bd098f6435
1983 else 1983 else
1984 { 1984 {
1985 long long _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); 1985 long long _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
1986 uint _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); 1986 uint _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
1987 int _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); 1987 int _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
1988 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); 1988 pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
1989 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); 1989 pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
1990 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); 1990 pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
1991 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); 1991 pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
1992 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; 1992 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
1993 if ( v15 > 100 ) 1993 if ( v15 > 100 )
1994 v15 = 100; 1994 v15 = 100;
1995 //if ( i == 1000 )//pY < 0 && pW > 16 ) 1995 //if ( i == 1000 )//pY < 0 && pW > 16 )
1996 //__debugbreak(); 1996 //__debugbreak();
1999 } 1999 }
2000 2000
2001 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) 2001 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
2002 { 2002 {
2003 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; 2003 BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
2004 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); 2004 pX = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x) << 16) - uZoom, pParty->vPosition.x);
2005 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); 2005 pY = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y) << 16) - uZoom, pParty->vPosition.y);
2006 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); 2006 pZ = uCenterX + fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x) << 16) - uZoom, pParty->vPosition.x);
2007 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); 2007 pW = uCenterY - fixpoint_mul((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y) << 16) - uZoom, pParty->vPosition.y);
2008 pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); 2008 pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color);
2009 } 2009 }
2010 } 2010 }
2011 2011
2012 //draw arrow on the minimap(include. Ritor1) 2012 //draw arrow on the minimap(include. Ritor1)
2038 for ( uint i = 0; i < uNumSpriteObjects; ++i ) 2038 for ( uint i = 0; i < uNumSpriteObjects; ++i )
2039 { 2039 {
2040 if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID ) 2040 if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID )
2041 continue; 2041 continue;
2042 //if (uWizardEyeSkillLevel == 1 2042 //if (uWizardEyeSkillLevel == 1
2043 pPoint_X = uCenterX + ((unsigned __int64)((pSpriteObjects[i].vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); 2043 pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom);
2044 pPoint_Y = uCenterY - ((signed __int64)((pSpriteObjects[i].vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); 2044 pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom);
2045 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z && 2045 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z &&
2046 // pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w) 2046 // pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w)
2047 { 2047 {
2048 if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) 2048 if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE)
2049 { 2049 {
2066 } 2066 }
2067 } 2067 }
2068 for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс) 2068 for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс)
2069 { 2069 {
2070 if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled 2070 if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled
2071 && (pActors[i].uAIState == Dead || BYTE1(pActors[i].uAttributes) & 0x80) ) 2071 && (pActors[i].uAIState == Dead || pActors[i].uAttributes & 0x8000) )
2072 { 2072 {
2073 pPoint_X = uCenterX + ((unsigned __int64)(( pActors[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); 2073 pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom));
2074 pPoint_Y = uCenterY - ((unsigned __int64)(( pActors[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); 2074 pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom));
2075 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z 2075 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
2076 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) 2076 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
2077 { 2077 {
2078 pColor = ui_game_minimap_actor_friendly_color; 2078 pColor = ui_game_minimap_actor_friendly_color;
2079 if ( BYTE3(pActors[i].uAttributes) & 1 ) 2079 if ( pActors[i].uAttributes & 0x1000000 )
2080 pColor = ui_game_minimap_actor_hostile_color; 2080 pColor = ui_game_minimap_actor_hostile_color;
2081 if ( pActors[i].uAIState == Dead) 2081 if ( pActors[i].uAIState == Dead)
2082 pColor = ui_game_minimap_actor_corpse_color; 2082 pColor = ui_game_minimap_actor_corpse_color;
2083 if ( uZoom > 1024 ) 2083 if ( uZoom > 1024 )
2084 { 2084 {
2098 } 2098 }
2099 for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(отрисовка предметов) 2099 for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(отрисовка предметов)
2100 { 2100 {
2101 if ( pLevelDecorations[i].uFlags & 8 ) 2101 if ( pLevelDecorations[i].uFlags & 8 )
2102 { 2102 {
2103 pPoint_X = uCenterX + ((unsigned __int64)((pLevelDecorations[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); 2103 pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom));
2104 pPoint_Y = uCenterY - ((unsigned __int64)((pLevelDecorations[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); 2104 pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom));
2105 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z 2105 //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z
2106 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) 2106 // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
2107 { 2107 {
2108 if ( (signed int)uZoom > 512 ) 2108 if ( (signed int)uZoom > 512 )
2109 { 2109 {