Mercurial > might-and-magic-trilogy
comparison mm7_3.cpp @ 113:9a99c386885a
2012/11/7
author | Nomad |
---|---|
date | Wed, 07 Nov 2012 20:23:04 +0200 |
parents | 142de719a3ea |
children | 8e802a11b20d |
comparison
equal
deleted
inserted
replaced
103:142de719a3ea | 113:9a99c386885a |
---|---|
2176 } | 2176 } |
2177 | 2177 |
2178 | 2178 |
2179 | 2179 |
2180 //----- (0047253E) -------------------------------------------------------- | 2180 //----- (0047253E) -------------------------------------------------------- |
2181 void __cdecl UpdateObjects() | 2181 void UpdateObjects() |
2182 { | 2182 { |
2183 unsigned int v0; // ebx@0 | 2183 unsigned int v0; // ebx@0 |
2184 unsigned int v1; // edi@1 | 2184 //unsigned int v1; // edi@1 |
2185 char *v2; // esi@2 | 2185 char *v2; // esi@2 |
2186 __int16 v3; // dx@5 | 2186 //__int16 v3; // dx@5 |
2187 ObjectDesc *v4; // eax@5 | 2187 ObjectDesc *v4; // eax@5 |
2188 int v5; // ecx@6 | 2188 int v5; // ecx@6 |
2189 __int16 v6; // cx@7 | 2189 __int16 v6; // cx@7 |
2190 signed int v7; // eax@9 | 2190 signed int v7; // eax@9 |
2191 __int16 v8; // cx@14 | 2191 __int16 v8; // cx@14 |
2198 unsigned int v15; // ecx@27 | 2198 unsigned int v15; // ecx@27 |
2199 unsigned int v16; // edx@30 | 2199 unsigned int v16; // edx@30 |
2200 unsigned int v17; // edx@32 | 2200 unsigned int v17; // edx@32 |
2201 int v18; // [sp+4h] [bp-10h]@27 | 2201 int v18; // [sp+4h] [bp-10h]@27 |
2202 int v19; // [sp+8h] [bp-Ch]@27 | 2202 int v19; // [sp+8h] [bp-Ch]@27 |
2203 signed int v20; // [sp+10h] [bp-4h]@1 | 2203 //signed int v20; // [sp+10h] [bp-4h]@1 |
2204 | 2204 |
2205 v1 = 0; | 2205 //v1 = 0; |
2206 v20 = 0; | 2206 //v20 = 0; |
2207 if ( (signed int)uNumLayingItems > 0 ) | 2207 for (uint i = 0; i < uNumLayingItems; ++i) |
2208 { | 2208 { |
2209 __debugbreak(); | 2209 auto item = pLayingItems + i; |
2210 v2 = (char *)&pLayingItems[0].uSpriteFrameID; | 2210 v2 = (char *)&item->uSpriteFrameID; |
2211 do | 2211 //do |
2212 { | 2212 //{ |
2213 LOWORD(v0) = *((short *)v2 - 2); | 2213 //LOWORD(v0) = item->uAttributes; |
2214 if ( v0 & 0x40 ) | 2214 if (item->uAttributes & 0x40) |
2215 { | 2215 item->uAttributes &= 0xFFBF; |
2216 v0 &= 0xFFFFFFBFu; | 2216 else |
2217 *((short *)v2 - 2) = v0; | 2217 { |
2218 } | 2218 //v3 = item->uObjectDescID; |
2219 else | 2219 v4 = &pObjectList->pObjects[item->uObjectDescID]; |
2220 { | 2220 if (item->uAttributes) |
2221 v3 = *((short *)v2 - 14); | 2221 { |
2222 v4 = &pObjectList->pObjects[*((short *)v2 - 14)]; | |
2223 if ( (v0 & 0x80u) != 0 ) | |
2224 { | |
2225 v5 = *(int *)(v2 + 62) >> 3; | 2222 v5 = *(int *)(v2 + 62) >> 3; |
2226 *(int *)(v2 - 26) = pActors[v5].vPosition.x; | 2223 *(int *)(v2 - 26) = pActors[v5].vPosition.x; |
2227 *(int *)(v2 - 22) = pActors[v5].vPosition.y; | 2224 *(int *)(v2 - 22) = pActors[v5].vPosition.y; |
2228 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | 2225 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; |
2229 if ( !v3 || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) | 2226 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) |
2230 goto LABEL_36; | 2227 goto LABEL_36; |
2231 if ( v6 >= 0 ) | 2228 if ( v6 >= 0 ) |
2232 { | 2229 { |
2233 v7 = v4->uLifetime; | 2230 v7 = v4->uLifetime; |
2234 if ( v0 & 2 ) | 2231 if (item->uAttributes & 2) |
2235 v7 = *((short *)v2 + 1); | 2232 v7 = *((short *)v2 + 1); |
2236 if ( v6 < v7 ) | 2233 if ( v6 < v7 ) |
2237 goto LABEL_36; | 2234 goto LABEL_36; |
2238 } | 2235 } |
2239 goto LABEL_34; | 2236 goto LABEL_34; |
2240 } | 2237 } |
2241 if ( v3 ) | 2238 |
2242 { | 2239 if ( item->uObjectDescID ) |
2243 v8 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2; | 2240 { |
2244 *(short *)v2 = v8; | 2241 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID; |
2242 item->uSpriteFrameID = v8; | |
2245 v9 = v4->uFlags; | 2243 v9 = v4->uFlags; |
2246 if ( !(v9 & 4) ) | 2244 if ( !(v9 & 4) ) |
2247 goto LABEL_22; | 2245 goto LABEL_22; |
2248 if ( v8 < 0 ) | 2246 if ( v8 < 0 ) |
2249 { | 2247 { |
2250 v10 = v1; | 2248 v10 = i; |
2251 LABEL_35: | 2249 LABEL_35: |
2252 LayingItem::_42F933(v10); | 2250 LayingItem::_42F933(v10); |
2253 goto LABEL_36; | 2251 goto LABEL_36; |
2254 } | 2252 } |
2255 v11 = v4->uLifetime; | 2253 v11 = v4->uLifetime; |
2256 if ( v0 & 2 ) | 2254 if ( item->uAttributes & 2 ) |
2257 v11 = *((short *)v2 + 1); | 2255 v11 = *((short *)v2 + 1); |
2258 if ( v8 < v11 ) | 2256 if ( v8 < v11 ) |
2259 { | 2257 { |
2260 LABEL_22: | 2258 LABEL_22: |
2261 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 2259 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
2262 LayingItem::UpdateObject_fn0_BLV(v1); | 2260 LayingItem::UpdateObject_fn0_BLV(i); |
2263 else | 2261 else |
2264 LayingItem::UpdateObject_fn0_ODM(v1); | 2262 LayingItem::UpdateObject_fn0_ODM(i); |
2265 if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) ) | 2263 if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) ) |
2266 goto LABEL_36; | 2264 goto LABEL_36; |
2267 v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26)); | 2265 v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26)); |
2268 v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22)); | 2266 v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22)); |
2269 v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18)); | 2267 v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18)); |
2289 } | 2287 } |
2290 v0 = (unsigned int)(11 * v14) >> 5; | 2288 v0 = (unsigned int)(11 * v14) >> 5; |
2291 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) | 2289 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) |
2292 goto LABEL_36; | 2290 goto LABEL_36; |
2293 LABEL_34: | 2291 LABEL_34: |
2294 v10 = v20; | 2292 v10 = i; |
2295 goto LABEL_35; | 2293 goto LABEL_35; |
2296 } | 2294 } |
2297 v10 = v1; | 2295 v10 = i; |
2298 if ( !(v9 & 0x40) ) | 2296 if ( !(v9 & 0x40) ) |
2299 goto LABEL_35; | 2297 goto LABEL_35; |
2300 _46BFFA_check_object_intercept(v1, 8 * v1 | OBJECT_Item); | 2298 _46BFFA_check_object_intercept(i, 8 * i | OBJECT_Item); |
2301 } | 2299 } |
2302 } | 2300 } |
2303 LABEL_36: | 2301 LABEL_36: |
2304 v2 += 112; | 2302 ; |
2305 v1 = v20++ + 1; | 2303 //v2 += 112; |
2306 } | 2304 //v1 = v20++ + 1; |
2307 while ( v20 < (signed int)uNumLayingItems ); | 2305 //} |
2306 //while ( v20 < (signed int)uNumLayingItems ); | |
2308 } | 2307 } |
2309 } | 2308 } |
2310 | 2309 |
2311 //----- (0047272C) -------------------------------------------------------- | 2310 //----- (0047272C) -------------------------------------------------------- |
2312 int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) | 2311 int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |