comparison mm7_3.cpp @ 1083:ddf53a2d0bf5

pointer cleaning
author zipi
date Sat, 25 May 2013 22:28:13 +0100
parents 9456f2ed5ff9
children 8b59f13c9c3e
comparison
equal deleted inserted replaced
1082:7033eb155558 1083:ddf53a2d0bf5
1332 //----- (0047253E) -------------------------------------------------------- 1332 //----- (0047253E) --------------------------------------------------------
1333 void UpdateObjects() 1333 void UpdateObjects()
1334 { 1334 {
1335 unsigned int v0; // ebx@0 1335 unsigned int v0; // ebx@0
1336 //unsigned int v1; // edi@1 1336 //unsigned int v1; // edi@1
1337 char *v2; // esi@2 1337 //char *v2; // esi@2
1338 //__int16 v3; // dx@5 1338 //__int16 v3; // dx@5
1339 ObjectDesc *v4; // eax@5 1339 ObjectDesc *v4; // eax@5
1340 int v5; // ecx@6 1340 int v5; // ecx@6
1341 __int16 v6; // cx@7 1341 __int16 v6; // cx@7
1342 signed int v7; // eax@9 1342 signed int v7; // eax@9
1357 //v1 = 0; 1357 //v1 = 0;
1358 //v20 = 0; 1358 //v20 = 0;
1359 for (uint i = 0; i < uNumSpriteObjects; ++i) 1359 for (uint i = 0; i < uNumSpriteObjects; ++i)
1360 { 1360 {
1361 auto item = pSpriteObjects + i; 1361 auto item = pSpriteObjects + i;
1362 v2 = (char *)&item->uSpriteFrameID; 1362 //v2 = (char *)&item->uSpriteFrameID;
1363 //do 1363 //do
1364 //{ 1364 //{
1365 //LOWORD(v0) = item->uAttributes; 1365 //LOWORD(v0) = item->uAttributes;
1366 if (item->uAttributes & 0x40) 1366 if (item->uAttributes & 0x40)
1367 item->uAttributes &= 0xFFBF; 1367 item->uAttributes &= 0xFFBF;
1370 //v3 = item->uObjectDescID; 1370 //v3 = item->uObjectDescID;
1371 v4 = &pObjectList->pObjects[item->uObjectDescID]; 1371 v4 = &pObjectList->pObjects[item->uObjectDescID];
1372 if (item->AttachedToActor()) 1372 if (item->AttachedToActor())
1373 { 1373 {
1374 v5 = PID_ID(item->spell_target_pid); 1374 v5 = PID_ID(item->spell_target_pid);
1375 *(int *)(v2 - 26) = pActors[v5].vPosition.x; 1375 item->vPosition.x = pActors[v5].vPosition.x;
1376 *(int *)(v2 - 22) = pActors[v5].vPosition.y; 1376 item->vPosition.y = pActors[v5].vPosition.y;
1377 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; 1377 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
1378 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) 1378 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) )
1379 goto LABEL_36; 1379 continue;
1380 if ( v6 >= 0 ) 1380 if ( v6 >= 0 )
1381 { 1381 {
1382 v7 = v4->uLifetime; 1382 v7 = v4->uLifetime;
1383 if (item->uAttributes & 2) 1383 if (item->uAttributes & 2)
1384 v7 = *((short *)v2 + 1); 1384 v7 = item->field_20;
1385 if ( v6 < v7 ) 1385 if ( v6 < v7 )
1386 goto LABEL_36; 1386 continue;
1387 } 1387 }
1388 goto LABEL_34; 1388 v10 = i;
1389 SpriteObject::OnInteraction(v10);
1390 continue;
1389 } 1391 }
1390 1392
1391 if ( item->uObjectDescID ) 1393 if ( item->uObjectDescID )
1392 { 1394 {
1393 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID; 1395 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
1394 item->uSpriteFrameID = v8; 1396 item->uSpriteFrameID = v8;
1395 v9 = v4->uFlags; 1397 v9 = v4->uFlags;
1396 if ( !(v9 & 4) ) 1398 if ( v9 & 4 )
1397 goto LABEL_22; 1399 {
1398 if ( v8 < 0 ) 1400 if ( v8 < 0 )
1401 {
1402 v10 = i;
1403 SpriteObject::OnInteraction(v10);
1404 continue;
1405 }
1406 v11 = v4->uLifetime;
1407 if (item->uAttributes & 2)
1408 v11 = item->field_20;
1409 }
1410 if ( !(v9 & 4) || v8 < v11 )
1399 { 1411 {
1400 v10 = i;
1401 LABEL_35:
1402 SpriteObject::OnInteraction(v10);
1403 goto LABEL_36;
1404 }
1405 v11 = v4->uLifetime;
1406 if (item->uAttributes & 2)
1407 v11 = *((short *)v2 + 1);
1408 if ( v8 < v11 )
1409 {
1410 LABEL_22:
1411 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 1412 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
1412 SpriteObject::UpdateObject_fn0_BLV(i); 1413 SpriteObject::UpdateObject_fn0_BLV(i);
1413 else 1414 else
1414 SpriteObject::UpdateObject_fn0_ODM(i); 1415 SpriteObject::UpdateObject_fn0_ODM(i);
1415 if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) ) 1416 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
1416 goto LABEL_36; 1417 continue;
1417 v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26)); 1418 v12 = abs(pParty->vPosition.x - item->vPosition.x);
1418 v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22)); 1419 v18 = abs(pParty->vPosition.y - item->vPosition.y);
1419 v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18)); 1420 v19 = abs(pParty->vPosition.z - item->vPosition.z);
1420 v13 = v12; 1421 v13 = v12;
1421 v14 = v18; 1422 v14 = v18;
1422 v15 = v19; 1423 v15 = v19;
1423 if ( v12 < v18 ) 1424 if ( v12 < v18 )
1424 { 1425 {
1437 v15 = v14; 1438 v15 = v14;
1438 v14 = v17; 1439 v14 = v17;
1439 } 1440 }
1440 v0 = (unsigned int)(11 * v14) >> 5; 1441 v0 = (unsigned int)(11 * v14) >> 5;
1441 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) 1442 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
1442 goto LABEL_36; 1443 continue;
1443 LABEL_34:
1444 v10 = i; 1444 v10 = i;
1445 goto LABEL_35; 1445 SpriteObject::OnInteraction(v10);
1446 continue;
1446 } 1447 }
1447 v10 = i; 1448 v10 = i;
1448 if ( !(v9 & 0x40) ) 1449 if ( !(v9 & 0x40) )
1449 goto LABEL_35; 1450 {
1451 SpriteObject::OnInteraction(v10);
1452 continue;
1453 }
1450 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); 1454 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
1451 } 1455 }
1452 } 1456 }
1453 LABEL_36:
1454 ;
1455 //v2 += 112; 1457 //v2 += 112;
1456 //v1 = v20++ + 1; 1458 //v1 = v20++ + 1;
1457 //} 1459 //}
1458 //while ( v20 < (signed int)uNumSpriteObjects ); 1460 //while ( v20 < (signed int)uNumSpriteObjects );
1459 } 1461 }