Mercurial > mm7
comparison mm7_2.cpp @ 271:1f0af5cac2dd
_42ECB5_PlayerAttacksActor
author | Nomad |
---|---|
date | Mon, 18 Feb 2013 13:07:25 +0200 |
parents | ac44e716d051 |
children | 0ea5fbd16edb 640a176c030f |
comparison
equal
deleted
inserted
replaced
268:0b58962bf229 | 271:1f0af5cac2dd |
---|---|
9122 while ( v6 ); | 9122 while ( v6 ); |
9123 } | 9123 } |
9124 } | 9124 } |
9125 | 9125 |
9126 //----- (00452A9E) -------------------------------------------------------- | 9126 //----- (00452A9E) -------------------------------------------------------- |
9127 signed int __fastcall sub_452A9E(signed int a1) | 9127 int sub_452A9E(int square_distance) |
9128 { | 9128 { |
9129 signed int result; // eax@2 | 9129 signed int result; // eax@2 |
9130 int v2; // edx@3 | 9130 int v2; // edx@3 |
9131 signed int v3; // edi@3 | 9131 unsigned int v3; // edi@3 |
9132 signed int v4; // ebx@3 | 9132 //signed int v4; // ebx@3 |
9133 int v5; // esi@4 | 9133 int v5; // esi@4 |
9134 | 9134 |
9135 if ( a1 > 1 ) | 9135 if (square_distance < 1) |
9136 { | 9136 return square_distance; |
9137 | |
9138 | |
9137 v2 = 0; | 9139 v2 = 0; |
9138 v3 = a1; | 9140 v3 = square_distance; |
9139 result = 0; | 9141 result = 0; |
9140 v4 = 16; | 9142 //v4 = 16; |
9141 do | 9143 for (uint i = 0; i < 16; ++i) |
9142 { | 9144 { |
9143 result *= 2; | 9145 result *= 2; |
9144 v2 = ((unsigned int)v3 >> 30) | 4 * v2; | 9146 v2 = (v3 >> 30) | 4 * v2; |
9145 v5 = 2 * result + 1; | 9147 v5 = 2 * result + 1; |
9146 v3 *= 4; | 9148 v3 *= 4; |
9147 if ( v2 >= (unsigned int)v5 ) | 9149 if ( v2 >= (unsigned int)v5 ) |
9148 { | 9150 { |
9149 ++result; | 9151 ++result; |
9150 v2 -= v5; | 9152 v2 -= v5; |
9151 } | 9153 } |
9152 --v4; | 9154 //--v4; |
9153 } | 9155 } |
9154 while ( v4 ); | 9156 //while ( v4 ); |
9155 if ( a1 - result * result >= (unsigned int)(result - 1) ) | 9157 if ( square_distance - result * result >= (unsigned int)(result - 1) ) |
9156 ++result; | 9158 ++result; |
9157 } | |
9158 else | |
9159 { | |
9160 result = a1; | |
9161 } | |
9162 return result; | |
9163 } | 9159 } |
9164 | 9160 |
9165 //----- (00452AE2) -------------------------------------------------------- | 9161 //----- (00452AE2) -------------------------------------------------------- |
9166 int __fastcall MakeColorMaskFromBitDepth(int a1) | 9162 int __fastcall MakeColorMaskFromBitDepth(int a1) |
9167 { | 9163 { |