comparison mm7_2.cpp @ 1445:6de9c1316852

Слияние
author Ritor1
date Sat, 03 Aug 2013 00:00:31 +0600
parents a8b1bbac95d4 c7489dd19f88
children 8ff3c675a726
comparison
equal deleted inserted replaced
1444:7b1a94270756 1445:6de9c1316852
479 } 479 }
480 while ( (signed int)v2 < (signed int)pParty->pHirelings ); 480 while ( (signed int)v2 < (signed int)pParty->pHirelings );
481 if ( uDialogueType == 85 ) 481 if ( uDialogueType == 85 )
482 { 482 {
483 num_monsters = v4; 483 num_monsters = v4;
484 goto LABEL_22; 484 v4 /= 2;
485 } 485 }
486 if ( uDialogueType == 86 ) 486 else if ( uDialogueType == 86 )
487 { 487 {
488 v5 = (signed __int64)((double)v26 * 1.5); 488 v5 = (signed __int64)((double)v26 * 1.5);
489 goto LABEL_20; 489 num_monsters = v5;
490 } 490 v4 /= 2;
491 if ( uDialogueType == 87 ) 491 }
492 else if ( uDialogueType == 87 )
492 { 493 {
493 LODWORD(v5) = 2 * v4; 494 LODWORD(v5) = 2 * v4;
494 LABEL_20:
495 num_monsters = v5; 495 num_monsters = v5;
496 LABEL_22:
497 v4 /= 2; 496 v4 /= 2;
498 goto LABEL_24; 497 }
499 }
500 __debugbreak(); // warning C4700: uninitialized local variable 'v27' used
501 if ( uDialogueType == 88 )
502 num_monsters = 2 * v4;
503 else 498 else
504 v4 = v27; 499 {
505 LABEL_24: 500 __debugbreak(); // warning C4700: uninitialized local variable 'v27' used
501 if ( uDialogueType == 88 )
502 num_monsters = 2 * v4;
503 else
504 v4 = v27;
505 }
506 if ( v4 < 1 ) 506 if ( v4 < 1 )
507 v4 = 1; 507 v4 = 1;
508 if ( v4 > 100 ) 508 if ( v4 > 100 )
509 v4 = 100; 509 v4 = 100;
510 if ( num_monsters > 100 ) 510 if ( num_monsters > 100 )
553 if ( uDialogueType == 85 ) 553 if ( uDialogueType == 85 )
554 { 554 {
555 v16 = rand(); 555 v16 = rand();
556 v17 = 3; 556 v17 = 3;
557 v22 = 50; 557 v22 = 50;
558 goto LABEL_53; 558 v18 = v16 % v17;
559 } 559 v13 = v22;
560 if ( uDialogueType == 86 ) 560 v14 = v18 + 6;
561 }
562 else if ( uDialogueType == 86 )
561 { 563 {
562 v16 = rand(); 564 v16 = rand();
563 v17 = 7; 565 v17 = 7;
564 v22 = 100; 566 v22 = 100;
565 LABEL_53:
566 v18 = v16 % v17; 567 v18 = v16 % v17;
567 v13 = v22; 568 v13 = v22;
568 v14 = v18 + 6; 569 v14 = v18 + 6;
569 goto LABEL_55; 570 }
570 } 571 else if ( uDialogueType == 87 )
571 if ( uDialogueType == 87 )
572 { 572 {
573 v15 = rand() % 11; 573 v15 = rand() % 11;
574 v13 = 200; 574 v13 = 200;
575 v14 = v15 + 10; 575 v14 = v15 + 10;
576 } 576 }
585 { 585 {
586 v14 = v27; 586 v14 = v27;
587 v13 = gold_transaction_amount; 587 v13 = gold_transaction_amount;
588 } 588 }
589 } 589 }
590 LABEL_55:
591 i = 0; 590 i = 0;
592 for ( gold_transaction_amount = v26 * v13; i < v14; ++i ) 591 for ( gold_transaction_amount = v26 * v13; i < v14; ++i )
593 { 592 {
594 monster_y = pMonsterArenaPlacements[i].y; 593 monster_y = pMonsterArenaPlacements[i].y;
595 v21 = rand(); 594 v21 = rand();
629 if ( v0 && v0 != 1 ) 628 if ( v0 && v0 != 1 )
630 { 629 {
631 if ( v0 == -1 ) 630 if ( v0 == -1 )
632 { 631 {
633 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); 632 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1));
634 //LABEL_33:
635 pVideoPlayer->_4BF5B2(); 633 pVideoPlayer->_4BF5B2();
636 return 1; 634 return 1;
637 } 635 }
638 if ( v0 != 94 && v0 != 96 && v0 != 101 ) 636 if ( v0 != 94 && v0 != 96 && v0 != 101 )
639 { 637 {
646 else 644 else
647 { 645 {
648 if ( v0 != 102 && v0 != 103 && v0 != 104 ) 646 if ( v0 != 102 && v0 != 103 && v0 != 104 )
649 { 647 {
650 pVideoPlayer->_4BF5B2(); 648 pVideoPlayer->_4BF5B2();
651 //LABEL_28:
652 dialog_menu_id = HOUSE_DIALOGUE_MAIN; 649 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
653 InitializaDialogueOptions(in_current_building_type); 650 InitializaDialogueOptions(in_current_building_type);
654 return 1; 651 return 1;
655 } 652 }
656 pVideoPlayer->_4BF5B2(); 653 pVideoPlayer->_4BF5B2();
868 if ( v15 ) 865 if ( v15 )
869 { 866 {
870 /*if ( (signed int)result < 40 ) 867 /*if ( (signed int)result < 40 )
871 { 868 {
872 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; 869 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit;
873 goto LABEL_42;
874 }*/ 870 }*/
875 pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); 871 pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0);
876 goto LABEL_43;
877 } 872 }
878 else 873 else
879 { 874 {
880 pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); 875 pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0);
881 goto LABEL_43;
882 /*if ( (signed int)result < 40 ) 876 /*if ( (signed int)result < 40 )
883 { 877 {
884 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; 878 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
885 LABEL_42:
886 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 879 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
887 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; 880 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
888 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; 881 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
889 ++pMessageQueue_50CBD0->uNumMessages; 882 ++pMessageQueue_50CBD0->uNumMessages;
890 goto LABEL_43;
891 }*/ 883 }*/
892 } 884 }
893 LABEL_43:
894 bGameoverLoop = 0; 885 bGameoverLoop = 0;
895 return result; 886 return result;
896 } 887 }
897 888
898 889
1103 v10 = rand(); 1094 v10 = rand();
1104 v11 = pMapInfo->uEncounterMonster1AtMost; 1095 v11 = pMapInfo->uEncounterMonster1AtMost;
1105 pTexture = pMapInfo->pEncounterMonster1Texture; 1096 pTexture = pMapInfo->pEncounterMonster1Texture;
1106 v12 = v10 % (v11 - v9 + 1); 1097 v12 = v10 % (v11 - v9 + 1);
1107 v13 = pMapInfo->Dif_M1; 1098 v13 = pMapInfo->Dif_M1;
1108 goto LABEL_20; 1099 v57 = v13;
1100 v56 = v9 + v12;
1101 strcpy(Source, pTexture);
1102 break;
1109 case 3u: 1103 case 3u:
1110 pTexture = pMapInfo->pEncounterMonster1Texture; 1104 pTexture = pMapInfo->pEncounterMonster1Texture;
1111 v44 = "%s A"; 1105 v44 = "%s A";
1112 goto LABEL_25; 1106 sprintf(Source, v44, pTexture);
1107 break;
1113 case 4u: 1108 case 4u:
1114 pTexture = pMapInfo->pEncounterMonster2Texture; 1109 pTexture = pMapInfo->pEncounterMonster2Texture;
1115 v44 = "%s A"; 1110 v44 = "%s A";
1116 goto LABEL_25; 1111 sprintf(Source, v44, pTexture);
1112 break;
1117 case 5u: 1113 case 5u:
1118 pTexture = pMapInfo->pEncounterMonster3Texture; 1114 pTexture = pMapInfo->pEncounterMonster3Texture;
1119 v44 = "%s A"; 1115 v44 = "%s A";
1120 goto LABEL_25; 1116 sprintf(Source, v44, pTexture);
1117 break;
1121 case 1u: 1118 case 1u:
1122 v9 = pMapInfo->uEncounterMonster2AtLeast; 1119 v9 = pMapInfo->uEncounterMonster2AtLeast;
1123 v14 = rand(); 1120 v14 = rand();
1124 v15 = pMapInfo->uEncounterMonster2AtMost; 1121 v15 = pMapInfo->uEncounterMonster2AtMost;
1125 pTexture = pMapInfo->pEncounterMonster2Texture; 1122 pTexture = pMapInfo->pEncounterMonster2Texture;
1126 v12 = v14 % (v15 - v9 + 1); 1123 v12 = v14 % (v15 - v9 + 1);
1127 v13 = pMapInfo->Dif_M2; 1124 v13 = pMapInfo->Dif_M2;
1128 goto LABEL_20; 1125 v57 = v13;
1126 v56 = v9 + v12;
1127 strcpy(Source, pTexture);
1128 break;
1129 case 6u: 1129 case 6u:
1130 pTexture = pMapInfo->pEncounterMonster1Texture; 1130 pTexture = pMapInfo->pEncounterMonster1Texture;
1131 v44 = "%s B"; 1131 v44 = "%s B";
1132 goto LABEL_25; 1132 sprintf(Source, v44, pTexture);
1133 break;
1133 case 7u: 1134 case 7u:
1134 pTexture = pMapInfo->pEncounterMonster2Texture; 1135 pTexture = pMapInfo->pEncounterMonster2Texture;
1135 v44 = "%s B"; 1136 v44 = "%s B";
1136 goto LABEL_25; 1137 sprintf(Source, v44, pTexture);
1138 break;
1137 case 8u: 1139 case 8u:
1138 pTexture = pMapInfo->pEncounterMonster3Texture; 1140 pTexture = pMapInfo->pEncounterMonster3Texture;
1139 v44 = "%s B"; 1141 v44 = "%s B";
1140 goto LABEL_25; 1142 sprintf(Source, v44, pTexture);
1143 break;
1141 case 2u: 1144 case 2u:
1142 v9 = pMapInfo->uEncounterMonster3AtLeast; 1145 v9 = pMapInfo->uEncounterMonster3AtLeast;
1143 v16 = rand(); 1146 v16 = rand();
1144 v17 = pMapInfo->uEncounterMonster3AtMost; 1147 v17 = pMapInfo->uEncounterMonster3AtMost;
1145 pTexture = pMapInfo->pEncounterMonster3Texture; 1148 pTexture = pMapInfo->pEncounterMonster3Texture;
1146 v12 = v16 % (v17 - v9 + 1); 1149 v12 = v16 % (v17 - v9 + 1);
1147 v13 = pMapInfo->Dif_M3; 1150 v13 = pMapInfo->Dif_M3;
1148 LABEL_20:
1149 v57 = v13; 1151 v57 = v13;
1150 v56 = v9 + v12; 1152 v56 = v9 + v12;
1151 strcpy(Source, pTexture); 1153 strcpy(Source, pTexture);
1152 goto LABEL_26; 1154 break;
1153 case 9u: 1155 case 9u:
1154 pTexture = pMapInfo->pEncounterMonster1Texture; 1156 pTexture = pMapInfo->pEncounterMonster1Texture;
1155 v44 = "%s C"; 1157 v44 = "%s C";
1156 goto LABEL_25; 1158 sprintf(Source, v44, pTexture);
1159 break;
1157 case 0xAu: 1160 case 0xAu:
1158 pTexture = pMapInfo->pEncounterMonster2Texture; 1161 pTexture = pMapInfo->pEncounterMonster2Texture;
1159 v44 = "%s C"; 1162 v44 = "%s C";
1160 goto LABEL_25; 1163 sprintf(Source, v44, pTexture);
1164 break;
1161 case 0xBu: 1165 case 0xBu:
1162 pTexture = pMapInfo->pEncounterMonster3Texture; 1166 pTexture = pMapInfo->pEncounterMonster3Texture;
1163 v44 = "%s C"; 1167 v44 = "%s C";
1164 LABEL_25:
1165 sprintf(Source, v44, pTexture); 1168 sprintf(Source, v44, pTexture);
1166 LABEL_26:
1167 if (Source[0] == '0')
1168 return;
1169 v57 += a3;
1170 if ( v57 > 4 )
1171 v57 = 4;
1172 strcpy(Str2, Source);
1173 if ( a4 )
1174 v56 = a4;
1175 v18 = v56;
1176 if ( (signed int)(v56 + uNumActors) >= 500 )
1177 return;
1178 pSector = 0;
1179 pPosX = spawn->vPosition.x;
1180 a4 = spawn->vPosition.y;
1181 a3 = spawn->vPosition.z;
1182 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
1183 pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z);
1184 v53 = 0;
1185 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
1186 if ( v18 <= 0 )
1187 return;
1188 break; 1169 break;
1189 default: 1170 default:
1190 return; 1171 return;
1191 } 1172 }
1173 if (Source[0] == '0')
1174 return;
1175 v57 += a3;
1176 if ( v57 > 4 )
1177 v57 = 4;
1178 strcpy(Str2, Source);
1179 if ( a4 )
1180 v56 = a4;
1181 v18 = v56;
1182 if ( (signed int)(v56 + uNumActors) >= 500 )
1183 return;
1184 pSector = 0;
1185 pPosX = spawn->vPosition.x;
1186 a4 = spawn->vPosition.y;
1187 a3 = spawn->vPosition.z;
1188 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
1189 pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z);
1190 v53 = 0;
1191 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
1192 if ( v18 <= 0 )
1193 return;
1192 for (uint i = v53; i < v56; ++i) 1194 for (uint i = v53; i < v56; ++i)
1193 { 1195 {
1194 pMonster = &pActors[uNumActors]; 1196 pMonster = &pActors[uNumActors];
1195 pActors[uNumActors].Reset(); 1197 pActors[uNumActors].Reset();
1196 if ( v57 ) 1198 if ( v57 )
1220 v44 = "%s B"; 1222 v44 = "%s B";
1221 } 1223 }
1222 else 1224 else
1223 { 1225 {
1224 if ( v24 != 3 ) 1226 if ( v24 != 3 )
1225 goto LABEL_58; 1227 continue;
1226 pTexture = Source; 1228 pTexture = Source;
1227 v44 = "%s C"; 1229 v44 = "%s C";
1228 } 1230 }
1229 } 1231 }
1230 sprintf(Str2, v44, pTexture); 1232 sprintf(Str2, v44, pTexture);
1273 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; 1275 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16;
1274 a4 = a3 + spawn->vPosition.y; 1276 a4 = a3 + spawn->vPosition.y;
1275 v36 = spawn->vPosition.z; 1277 v36 = spawn->vPosition.z;
1276 a3 = spawn->vPosition.z; 1278 a3 = spawn->vPosition.z;
1277 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 1279 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
1278 goto LABEL_55; 1280 {
1281 if ( a5 )
1282 pMonster->uAttributes |= 0x080000;
1283 ++uNumActors;
1284 continue;
1285 }
1279 v37 = pIndoor->GetSector(pPosX, a4, v36); 1286 v37 = pIndoor->GetSector(pPosX, a4, v36);
1280 if ( v37 == pSector ) 1287 if ( v37 == pSector )
1281 { 1288 {
1282 v38 = BLV_GetFloorLevel(pPosX, a4, a3, v37, &uFaceID); 1289 v38 = BLV_GetFloorLevel(pPosX, a4, a3, v37, &uFaceID);
1283 v39 = v38; 1290 v39 = v38;
1284 if ( v38 != -30000 ) 1291 if ( v38 != -30000 )
1285 { 1292 {
1286 if ( abs(v38 - a3) <= 1024 ) 1293 if ( abs(v38 - a3) <= 1024 )
1287 { 1294 {
1288 a3 = v39; 1295 a3 = v39;
1289 LABEL_55:
1290 if ( a5 ) 1296 if ( a5 )
1291 pMonster->uAttributes |= 0x080000; 1297 pMonster->uAttributes |= 0x080000;
1292 ++uNumActors; 1298 ++uNumActors;
1293 goto LABEL_58; 1299 continue;
1294 } 1300 }
1295 } 1301 }
1296 } 1302 }
1297 LABEL_58:
1298 ; 1303 ;
1299 //v53 = (char *)v53 + 1; 1304 //v53 = (char *)v53 + 1;
1300 //result = v53; 1305 //result = v53;
1301 } 1306 }
1302 //while ( (signed int)v53 < v56 ); 1307 //while ( (signed int)v53 < v56 );
1435 signed __int64 v12; // qtt@1 1440 signed __int64 v12; // qtt@1
1436 int v13; // ebx@1 1441 int v13; // ebx@1
1437 int v14; // edx@10 1442 int v14; // edx@10
1438 signed int v15; // ebx@20 1443 signed int v15; // ebx@20
1439 unsigned __int16 v16; // dx@20 1444 unsigned __int16 v16; // dx@20
1440 char *v17; // ecx@21 1445 ObjectDesc *v17; // ecx@21
1441 unsigned __int16 v18; // ax@24 1446 unsigned __int16 v18; // ax@24
1442 int v19; // ST0C_4@27 1447 int v19; // ST0C_4@27
1443 int v20; // ST08_4@27 1448 int v20; // ST08_4@27
1444 int v21; // ST04_4@27 1449 int v21; // ST04_4@27
1445 int v22; // eax@27 1450 int v22; // eax@27
1446 signed int v23; // ebx@29 1451 signed int v23; // ebx@29
1447 unsigned __int16 v24; // dx@29 1452 unsigned __int16 v24; // dx@29
1448 char *v25; // ecx@30 1453 ObjectDesc *v25; // ecx@30
1449 unsigned __int16 v26; // ax@33 1454 unsigned __int16 v26; // ax@33
1450 //int v27; // ecx@35 1455 //int v27; // ecx@35
1451 //int v28; // eax@35 1456 //int v28; // eax@35
1452 //int v29; // esi@35 1457 //int v29; // esi@35
1453 //__int16 v30; // ax@35 1458 //__int16 v30; // ax@35
1485 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0); 1490 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0);
1486 } 1491 }
1487 if ( a2->uIndex == 1 ) 1492 if ( a2->uIndex == 1 )
1488 { 1493 {
1489 v14 = rand() % 51 + 50; 1494 v14 = rand() % 51 + 50;
1490 } 1495 a1a.stru_24.uItemID = 197;
1491 else 1496 v34 = v14;
1492 { 1497 }
1493 if ( a2->uIndex != 2 ) 1498 else if ( a2->uIndex == 2 )
1494 { 1499 {
1495 if ( a2->uIndex == 3 ) 1500 v14 = rand() % 101 + 100;
1501 a1a.stru_24.uItemID = 197;
1502 v34 = v14;
1503 }
1504 else if ( a2->uIndex == 3 )
1496 { 1505 {
1497 v14 = rand() % 301 + 200; 1506 v14 = rand() % 301 + 200;
1498 } 1507 a1a.stru_24.uItemID = 198;
1499 else 1508 v34 = v14;
1500 { 1509 }
1501 if ( a2->uIndex != 4 ) 1510 else if ( a2->uIndex == 4 )
1502 { 1511 {
1503 if ( a2->uIndex == 5 ) 1512 v14 = rand() % 501 + 500;
1513 a1a.stru_24.uItemID = 198;
1514 v34 = v14;
1515 }
1516 else if ( a2->uIndex == 5 )
1517 {
1518 v14 = rand() % 1001 + 1000;
1519 a1a.stru_24.uItemID = 199;
1520 v34 = v14;
1521 }
1522 else if ( a2->uIndex == 6 )
1523 {
1524 v14 = rand() % 3001 + 2000;
1525 a1a.stru_24.uItemID = 199;
1526 v34 = v14;
1527 }
1528 v15 = 0;
1529 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1530 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1531 v18 = 0;
1532 for( int i = 0; i < pObjectList->uNumObjects; i++ )
1504 { 1533 {
1505 v14 = rand() % 1001 + 1000; 1534 if ( pObjectList->pObjects[i].uObjectID == v16 )
1535 {
1536 v18 = i;
1537 break;
1538 }
1506 } 1539 }
1507 else 1540 a1a.stru_24.SetIdentified();
1508 { 1541 a1a.uObjectDescID = v18;
1509 if ( a2->uIndex != 6 ) 1542 a1a.stru_24.uSpecEnchantmentType = v34;
1510 {
1511 LABEL_20:
1512 v15 = 0;
1513 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1514 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1515 if ( (signed int)pObjectList->uNumObjects <= 0 )
1516 {
1517 LABEL_24:
1518 v18 = 0;
1519 }
1520 else
1521 {
1522 v17 = (char *)&pObjectList->pObjects->uObjectID;
1523 while ( v16 != *(short *)v17 )
1524 {
1525 ++v15;
1526 v17 += 56;
1527 if ( v15 >= (signed int)pObjectList->uNumObjects )
1528 goto LABEL_24;
1529 }
1530 v18 = v15;
1531 }
1532 a1a.stru_24.SetIdentified();
1533 a1a.uObjectDescID = v18;
1534 a1a.stru_24.uSpecEnchantmentType = v34;
1535 goto LABEL_35;
1536 }
1537 v14 = rand() % 3001 + 2000;
1538 }
1539 a1a.stru_24.uItemID = 199;
1540 LABEL_19:
1541 v34 = v14;
1542 goto LABEL_20;
1543 }
1544 v14 = rand() % 501 + 500;
1545 }
1546 a1a.stru_24.uItemID = 198;
1547 goto LABEL_19;
1548 }
1549 v14 = rand() % 101 + 100;
1550 }
1551 a1a.stru_24.uItemID = 197;
1552 goto LABEL_19;
1553 }
1554 result = a1a.stru_24.GenerateArtifact();
1555 if ( !result )
1556 return result;
1557 v23 = 0;
1558 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1559 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1560 if ( (signed int)pObjectList->uNumObjects <= 0 )
1561 {
1562 LABEL_33:
1563 v26 = 0;
1564 } 1543 }
1565 else 1544 else
1566 { 1545 {
1567 v25 = (char *)&pObjectList->pObjects->uObjectID; 1546 result = a1a.stru_24.GenerateArtifact();
1568 while ( v24 != *(short *)v25 ) 1547 if ( !result )
1569 { 1548 return result;
1570 ++v23; 1549 v23 = 0;
1571 v25 += 56; 1550 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1572 if ( v23 >= (signed int)pObjectList->uNumObjects ) 1551 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
1573 goto LABEL_33; 1552 v26 = 0;
1574 } 1553 for( int i = 0; i < pObjectList->uNumObjects; i++ )
1575 v26 = v23; 1554 {
1576 } 1555 if( v24 == pObjectList->pObjects[i].uObjectID )
1577 a1a.uObjectDescID = v26; 1556 {
1578 a1a.stru_24.Reset(); 1557 v26 = i;
1579 1558 break;
1580 LABEL_35: 1559 }
1560 }
1561 a1a.uObjectDescID = v26;
1562 a1a.stru_24.Reset();
1563 }
1581 a1a.vPosition.y = a2->vPosition.y; 1564 a1a.vPosition.y = a2->vPosition.y;
1582 a1a.uAttributes = 0; 1565 a1a.uAttributes = 0;
1583 a1a.uSoundID = 0; 1566 a1a.uSoundID = 0;
1584 a1a.uFacing = 0; 1567 a1a.uFacing = 0;
1585 a1a.vPosition.z = a2->vPosition.z; 1568 a1a.vPosition.z = a2->vPosition.z;
1609 v7 = a2; 1592 v7 = a2;
1610 pItemsTable->GenerateItem(v6, v7, &a1.stru_24); 1593 pItemsTable->GenerateItem(v6, v7, &a1.stru_24);
1611 v8 = 0; 1594 v8 = 0;
1612 v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; 1595 v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
1613 a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; 1596 a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
1614 if ( (signed int)pObjectList->uNumObjects <= 0 ) 1597 v11 = 0;
1615 { 1598 for( int i = 0; i < pObjectList->uNumObjects; i++ )
1616 LABEL_5: 1599 {
1617 v11 = 0; 1600 if( v9 == pObjectList->pObjects[i].uObjectID )
1618 } 1601 {
1619 else 1602 v11 = i;
1620 { 1603 break;
1621 v10 = (char *)&pObjectList->pObjects->uObjectID; 1604 }
1622 while ( v9 != *(short *)v10 ) 1605 }
1623 {
1624 ++v8;
1625 v10 += 56;
1626 if ( v8 >= (signed int)pObjectList->uNumObjects )
1627 goto LABEL_5;
1628 }
1629 v11 = v8;
1630 }
1631 a1.uObjectDescID = v11; 1606 a1.uObjectDescID = v11;
1632 a1.vPosition.y = a4; 1607 a1.vPosition.y = a4;
1633 a1.vPosition.x = a3; 1608 a1.vPosition.x = a3;
1634 a1.vPosition.z = a5; 1609 a1.vPosition.z = a5;
1635 a1.uFacing = a6; 1610 a1.uFacing = a6;
1732 0, 1707 0,
1733 &v26, 1708 &v26,
1734 &v27, 1709 &v27,
1735 0); 1710 0);
1736 v23 = 0; 1711 v23 = 0;
1737 if ( (signed int)pOutdoor->uNumBModels > 0 ) 1712 for( int i = 0; i < pOutdoor->uNumBModels; i++ )
1738 { 1713 {
1739 while ( 1 ) 1714 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[i].vBoundingCenter.y);
1740 { 1715 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[i].vBoundingCenter.x);
1741 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[v8].vBoundingCenter.y); 1716 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[i].sBoundingRadius + 256 )
1742 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[v8].vBoundingCenter.x); 1717 {
1743 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[v8].sBoundingRadius + 256 ) 1718 v22 = 1;
1744 break; 1719 break;
1745 ++v23; 1720 }
1746 ++v8; 1721 }
1747 if ( v23 >= (signed int)pOutdoor->uNumBModels )
1748 goto LABEL_16;
1749 }
1750 v22 = 1;
1751 }
1752 LABEL_16:
1753 v11 = uFaceID == 100; 1722 v11 = uFaceID == 100;
1754 if ( uFaceID >= 100 ) 1723 if ( uFaceID >= 100 )
1755 break; 1724 break;
1756 if ( v22 ) 1725 if ( v22 )
1757 { 1726 {
1795 while ( v26 < 100 ); 1764 while ( v26 < 100 );
1796 v11 = v26 == 100; 1765 v11 = v26 == 100;
1797 } 1766 }
1798 if ( v11 ) 1767 if ( v11 )
1799 { 1768 {
1800 LABEL_8:
1801 result = 0; 1769 result = 0;
1802 } 1770 }
1803 else 1771 else
1804 { 1772 {
1805 SpawnEncounter(a1, &v19, 0, 0, 1); 1773 SpawnEncounter(a1, &v19, 0, 0, 1);
2945 if ( a1 < 67 ) 2913 if ( a1 < 67 )
2946 { 2914 {
2947 if ( a1 < 78 ) 2915 if ( a1 < 78 )
2948 { 2916 {
2949 if ( a1 < 89 ) 2917 if ( a1 < 89 )
2950 goto LABEL_31; 2918 {
2951 goto LABEL_28; 2919 v4 = 0;
2920 v1 = 0;
2921 v2 = 0;
2922 return TargetColor(v2, v1, v4);
2923 }
2952 } 2924 }
2925 else
2926 {
2953 LABEL_25: 2927 LABEL_25:
2954 if ( a1 < 89 ) 2928 if ( a1 < 89 )
2955 { 2929 {
2956 v4 = 155; 2930 v4 = 155;
2957 v2 = 255; 2931 v2 = 255;
2958 goto LABEL_30; 2932 v1 = v2;
2959 } 2933 return TargetColor(v2, v1, v4);
2960 LABEL_28: 2934 }
2935 }
2961 if ( a1 < 100 ) 2936 if ( a1 < 100 )
2962 { 2937 {
2963 v4 = 240; 2938 v4 = 240;
2964 v2 = 192; 2939 v2 = 192;
2965 goto LABEL_30; 2940 v1 = v2;
2941 return TargetColor(v2, v1, v4);
2966 } 2942 }
2967 LABEL_31:
2968 v4 = 0; 2943 v4 = 0;
2969 v1 = 0; 2944 v1 = 0;
2970 goto LABEL_32; 2945 v2 = 0;
2946 return TargetColor(v2, v1, v4);
2971 } 2947 }
2972 LABEL_21: 2948 LABEL_21:
2973 if ( a1 < 78 ) 2949 if ( a1 < 78 )
2974 { 2950 {
2975 v4 = 0; 2951 v4 = 0;
2976 v1 = 128; 2952 v1 = 128;
2977 goto LABEL_23; 2953 v2 = 255;
2954 return TargetColor(v2, v1, v4);
2978 } 2955 }
2979 goto LABEL_25; 2956 goto LABEL_25;
2980 } 2957 }
2981 LABEL_18: 2958 LABEL_18:
2982 if ( a1 < 67 ) 2959 if ( a1 < 67 )
2990 } 2967 }
2991 LABEL_15: 2968 LABEL_15:
2992 if ( a1 < 56 ) 2969 if ( a1 < 56 )
2993 { 2970 {
2994 v2 = 225; 2971 v2 = 225;
2995 goto LABEL_13; 2972 v4 = v2;
2973 v1 = v2;
2974 return TargetColor(v2, v1, v4);
2996 } 2975 }
2997 goto LABEL_18; 2976 goto LABEL_18;
2998 } 2977 }
2999 LABEL_11: 2978 LABEL_11:
3000 if ( a1 < 45 ) 2979 if ( a1 < 45 )
3001 { 2980 {
3002 v2 = 128; 2981 v2 = 128;
3003 LABEL_13:
3004 v4 = v2; 2982 v4 = v2;
3005 LABEL_30:
3006 v1 = v2; 2983 v1 = v2;
3007 return TargetColor(v2, v1, v4); 2984 return TargetColor(v2, v1, v4);
3008 } 2985 }
3009 goto LABEL_15; 2986 goto LABEL_15;
3010 } 2987 }
3011 LABEL_8: 2988 LABEL_8:
3012 if ( a1 < 34 ) 2989 if ( a1 < 34 )
3013 { 2990 {
3014 v4 = 255; 2991 v4 = 255;
3015 v1 = 128; 2992 v1 = 128;
3016 LABEL_32:
3017 v2 = 0; 2993 v2 = 0;
3018 return TargetColor(v2, v1, v4); 2994 return TargetColor(v2, v1, v4);
3019 } 2995 }
3020 goto LABEL_11; 2996 goto LABEL_11;
3021 } 2997 }
3024 { 3000 {
3025 if ( a1 < 12 ) 3001 if ( a1 < 12 )
3026 { 3002 {
3027 v4 = 0; 3003 v4 = 0;
3028 v1 = 85; 3004 v1 = 85;
3029 LABEL_23:
3030 v2 = 255; 3005 v2 = 255;
3031 return TargetColor(v2, v1, v4); 3006 return TargetColor(v2, v1, v4);
3032 } 3007 }
3033 } 3008 }
3034 if ( a1 >= 23 ) 3009 if ( a1 >= 23 )
3115 } 3090 }
3116 else 3091 else
3117 { 3092 {
3118 if ( v4 != 1 ) 3093 if ( v4 != 1 )
3119 { 3094 {
3120 if ( v4 != 0 || pActor->sNPC_ID ) 3095 if ( v4 == 0 && pActor->sNPC_ID == 0 )
3121 continue; 3096 pActor->sNPC_ID = 0;
3122 goto LABEL_12; 3097 continue;
3123 } 3098 }
3124 } 3099 }
3125 if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 ) 3100 if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 )
3126 continue; 3101 continue;
3127 if ( v17 ) 3102 if ( v17 )
3130 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; 3105 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000;
3131 ++pNPCStats->uNewlNPCBufPos; 3106 ++pNPCStats->uNewlNPCBufPos;
3132 pActor->sNPC_ID = v14; 3107 pActor->sNPC_ID = v14;
3133 continue; 3108 continue;
3134 } 3109 }
3135 LABEL_12:
3136 pActor->sNPC_ID = 0; 3110 pActor->sNPC_ID = 0;
3137 //LABEL_13:
3138 //++v15; 3111 //++v15;
3139 //v2 += 836; 3112 //v2 += 836;
3140 //} 3113 //}
3141 //while ( v15 < (signed int)uNumActors ); 3114 //while ( v15 < (signed int)uNumActors );
3142 } 3115 }
4030 pArcomageGame->field_F9 = 1; 4003 pArcomageGame->field_F9 = 1;
4031 } 4004 }
4032 else 4005 else
4033 { 4006 {
4034 if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() ) 4007 if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() )
4035 //goto LABEL_20;
4036 { 4008 {
4037 EndPaint(hWnd, &Paint); 4009 EndPaint(hWnd, &Paint);
4038 return 0; 4010 return 0;
4039 } 4011 }
4040 } 4012 }
4041 pRenderer->Present(); 4013 pRenderer->Present();
4042 //LABEL_20:
4043 EndPaint(hWnd, &Paint); 4014 EndPaint(hWnd, &Paint);
4044 return 0; 4015 return 0;
4045 } 4016 }
4046 //goto _def_wnd_proc; 4017 //goto _def_wnd_proc;
4047 return DefWindowProcA(hWnd, Msg, wParam, lParam); 4018 return DefWindowProcA(hWnd, Msg, wParam, lParam);
4322 v4 = RegCloseKey; 4293 v4 = RegCloseKey;
4323 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) 4294 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey)
4324 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) 4295 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition)
4325 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition) 4296 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition)
4326 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) ) 4297 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) )
4327 goto LABEL_7; 4298 {
4328 if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) 4299 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
4300 }
4301 else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) )
4329 { 4302 {
4330 RegCloseKey(v14); 4303 RegCloseKey(v14);
4331 v14 = 0; 4304 v14 = 0;
4332 LABEL_7:
4333 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); 4305 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
4334 goto LABEL_8; 4306 }
4335 } 4307 else
4336 v4 = RegCloseKey; 4308 {
4337 RegCloseKey(v14); 4309 v4 = RegCloseKey;
4338 v14 = 0; 4310 RegCloseKey(v14);
4339 RegCloseKey(v13); 4311 v14 = 0;
4340 v13 = 0; 4312 RegCloseKey(v13);
4341 RegCloseKey(phkResult); 4313 v13 = 0;
4342 phkResult = 0; 4314 RegCloseKey(phkResult);
4343 result = RegCloseKey(hKey); 4315 phkResult = 0;
4344 hKey = 0; 4316 result = RegCloseKey(hKey);
4345 LABEL_8: 4317 hKey = 0;
4318 }
4346 if ( v14 ) 4319 if ( v14 )
4347 result = v4(v14); 4320 result = v4(v14);
4348 if ( v13 ) 4321 if ( v13 )
4349 result = v4(v13); 4322 result = v4(v13);
4350 if ( hKey ) 4323 if ( hKey )
4501 if ( a2 == 273 ) 4474 if ( a2 == 273 )
4502 { 4475 {
4503 if ( a3 == 2 ) 4476 if ( a3 == 2 )
4504 { 4477 {
4505 v12 = 0; 4478 v12 = 0;
4506 LABEL_9:
4507 EndDialog(hDlg, v12); 4479 EndDialog(hDlg, v12);
4508 return 1; 4480 return 1;
4509 } 4481 }
4510 v4 = a3 == 1; 4482 v4 = a3 == 1;
4511 } 4483 }
4514 v4 = a2 == 1025; 4486 v4 = a2 == 1025;
4515 } 4487 }
4516 if ( v4 ) 4488 if ( v4 )
4517 { 4489 {
4518 v12 = 1; 4490 v12 = 1;
4519 goto LABEL_9; 4491 EndDialog(hDlg, v12);
4492 return 1;
4520 } 4493 }
4521 return 0; 4494 return 0;
4522 } 4495 }
4523 4496
4524 //----- (00465061) -------------------------------------------------------- 4497 //----- (00465061) --------------------------------------------------------
5422 Log::Warning(L"MM: entering main loop"); 5395 Log::Warning(L"MM: entering main loop");
5423 while ( 1 ) 5396 while ( 1 )
5424 { 5397 {
5425 MainMenu_Loop(); 5398 MainMenu_Loop();
5426 uGameState = GAME_STATE_PLAYING; 5399 uGameState = GAME_STATE_PLAYING;
5427 //LABEL_21:
5428 while ( 1 ) 5400 while ( 1 )
5429 { 5401 {
5430 if (uGameState == GAME_FINISHED || 5402 if (uGameState == GAME_FINISHED ||
5431 GetCurrentMenuID() == MENU_EXIT_GAME) 5403 GetCurrentMenuID() == MENU_EXIT_GAME)
5432 { 5404 {
5478 break; 5450 break;
5479 } 5451 }
5480 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) 5452 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
5481 { 5453 {
5482 uGameState = GAME_STATE_PLAYING; 5454 uGameState = GAME_STATE_PLAYING;
5455 pGame->Loop();
5483 } 5456 }
5484 else 5457 else
5485 { 5458 {
5486 if (GetCurrentMenuID() != MENU_10) 5459 if (GetCurrentMenuID() == MENU_10)
5487 goto LABEL_49; 5460 {
5488 pMouse->Activate(0); 5461 pMouse->Activate(0);
5489 5462
5490 pParty->Reset(); 5463 pParty->Reset();
5491 pParty->CreateDefaultParty(1); 5464 pParty->CreateDefaultParty(1);
5492 crt_init_globals_46271C(); 5465 crt_init_globals_46271C();
5493 extern OPENFILENAMEA ofn; 5466 extern OPENFILENAMEA ofn;
5494 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) 5467 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
5495 { 5468 {
5496 pMouse->Activate(1); 5469 pMouse->Activate(1);
5497 5470 break;
5498 break; 5471 }
5499 } 5472 _chdir("..\\");
5500 _chdir("..\\"); 5473 strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle);
5501 strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); 5474 pMouse->Activate(1);
5502 pMouse->Activate(1); 5475 pGame->Loop();
5503 } 5476 }
5504 //LABEL_48: 5477 }
5505 pGame->Loop();
5506 LABEL_49:
5507 if ( uGameState == GAME_STATE_LOADING_GAME ) 5478 if ( uGameState == GAME_STATE_LOADING_GAME )
5508 { 5479 {
5509 SetCurrentMenuID(MENU_5); 5480 SetCurrentMenuID(MENU_5);
5510 uGameState = GAME_STATE_PLAYING; 5481 uGameState = GAME_STATE_PLAYING;
5511 continue; 5482 continue;
6089 return 0; 6060 return 0;
6090 v5 = 640 * v3; 6061 v5 = 640 * v3;
6091 v29 = 640 * v3; 6062 v29 = 640 * v3;
6092 while ( 2 ) 6063 while ( 2 )
6093 { 6064 {
6094 v31 = 100; 6065 v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2]-1;
6095 v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2];
6096 v7 = v0; 6066 v7 = v0;
6097 while ( 1 ) 6067 //while ( 1 )
6098 { 6068 for( int i = 0; i < 100; i++)
6069 {
6070 ++v6;
6099 v8 = *v6; 6071 v8 = *v6;
6100 --v31;
6101 if ( (unsigned int)*v6 <= 0x2000000 ) 6072 if ( (unsigned int)*v6 <= 0x2000000 )
6102 { 6073 {
6103 v9 = 0; 6074 v9 = 0;
6104 if ( v7 > 0 ) 6075 if ( v7 > 0 )
6105 { 6076 {
6128 goto LABEL_18; 6099 goto LABEL_18;
6129 } 6100 }
6130 } 6101 }
6131 } 6102 }
6132 } 6103 }
6133 if ( !v31 ) 6104 }
6134 break;
6135 ++v6;
6136 }
6137 v4 = -1; 6105 v4 = -1;
6138 ++v30; 6106 ++v30;
6139 v5 = v29 + 640; 6107 v5 = v29 + 640;
6140 v29 += 640; 6108 v29 += 640;
6141 if ( v30 < v28 ) 6109 if ( v30 >= v28 )
6142 continue; 6110 break;
6143 break;
6144 } 6111 }
6145 v12 = 0; 6112 v12 = 0;
6146 v10 = v0 == 0; 6113 v10 = v0 == 0;
6147 v11 = v0 < 0; 6114 v11 = v0 < 0;
6148 if ( !v0 ) 6115 if ( !v0 )
6181 if ( v20 >= 0x3E8 ) 6148 if ( v20 >= 0x3E8 )
6182 return 0; 6149 return 0;
6183 if ( !(pSpriteObjects[v20].uAttributes & 0x10) ) 6150 if ( !(pSpriteObjects[v20].uAttributes & 0x10) )
6184 { 6151 {
6185 v23 = pSpriteObjects[v20].stru_24.GetDisplayName(); 6152 v23 = pSpriteObjects[v20].stru_24.GetDisplayName();
6186 LABEL_36:
6187 v24 = v23; 6153 v24 = v23;
6188 goto LABEL_51; 6154 GameUI_SetFooterString(v24);
6189 } 6155 return v19;
6190 goto LABEL_41; 6156 }
6191 } 6157 }
6192 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) 6158 else
6193 { 6159 {
6194 if ( v20 >= 0xBB8 ) 6160 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor)
6195 return 0; 6161 {
6196 v24 = (const char *)&pActors[v20]; 6162 if ( v20 >= 0xBB8 )
6197 goto LABEL_51; 6163 return 0;
6198 } 6164 v24 = (const char *)&pActors[v20];
6199 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) 6165 GameUI_SetFooterString(v24);
6200 break; 6166 return v19;
6201 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) 6167 }
6202 { 6168 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration)
6203 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 6169 break;
6204 { 6170 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel)
6205 v21 = &pIndoor->pFaces[v20]; 6171 {
6206 if ( !(BYTE3(v21->uAttributes) & 2) ) 6172 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
6207 goto LABEL_41; 6173 {
6208 v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID; 6174 v21 = &pIndoor->pFaces[v20];
6209 } 6175 if ( BYTE3(v21->uAttributes) & 2 )
6210 else 6176 v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID;
6211 { 6177 }
6212 if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 >= pOutdoor->uNumBModels ) 6178 else
6213 goto LABEL_41; 6179 {
6214 v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; 6180 if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 < pOutdoor->uNumBModels )
6215 } 6181 {
6216 if ( v22 ) 6182 v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID;
6217 { 6183 if ( v22 )
6218 v23 = GetEventHintString(v22); 6184 {
6219 if ( v23 ) 6185 v23 = GetEventHintString(v22);
6220 goto LABEL_36; 6186 if ( v23 )
6221 } 6187 {
6222 } 6188 v24 = v23;
6223 LABEL_41: 6189 GameUI_SetFooterString(v24);
6224 ++v18; 6190 return v19;
6191 }
6192 }
6193 }
6194 }
6195 }
6196 }
6197 ++v18;
6225 if ( v18 >= v0 ) 6198 if ( v18 >= v0 )
6226 return 0; 6199 return 0;
6227 } 6200 }
6228 v25 = &pLevelDecorations[v20]; 6201 v25 = &pLevelDecorations[v20];
6229 v26 = v25; 6202 v26 = v25;
6231 if ( v27 ) 6204 if ( v27 )
6232 { 6205 {
6233 v23 = GetEventHintString(v27); 6206 v23 = GetEventHintString(v27);
6234 if ( !v23 ) 6207 if ( !v23 )
6235 return v19; 6208 return v19;
6236 goto LABEL_36; 6209 v24 = v23;
6210 GameUI_SetFooterString(v24);
6211 return v19;
6237 } 6212 }
6238 if ( v25->IsInteractive() ) 6213 if ( v25->IsInteractive() )
6239 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; 6214 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
6240 else 6215 else
6241 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; 6216 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20;
6242 LABEL_51:
6243 GameUI_SetFooterString(v24); 6217 GameUI_SetFooterString(v24);
6244 return v19; 6218 return v19;
6245 } 6219 }
6246 6220
6247 //----- (0046BDA8) -------------------------------------------------------- 6221 //----- (0046BDA8) --------------------------------------------------------
6273 } 6247 }
6274 6248
6275 //----- (0046BFFA) -------------------------------------------------------- 6249 //----- (0046BFFA) --------------------------------------------------------
6276 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) 6250 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)
6277 { 6251 {
6278 SpriteObject *v2; // esi@1 6252 //SpriteObject *v2; // esi@1
6279 ObjectDesc *v3; // ebx@1 6253 ObjectDesc *v3; // ebx@1
6280 unsigned __int16 v5; // cx@9 6254 unsigned __int16 v5; // cx@9
6281 unsigned __int16 v6; // cx@14 6255 //unsigned __int16 v6; // cx@14
6282 signed int v7; // edx@14 6256 //signed int v7; // edx@14
6283 unsigned int v8; // eax@19 6257 unsigned int v8; // eax@19
6284 unsigned int v9; // edi@19 6258 unsigned int v9; // edi@19
6285 signed int v10; // ebx@19 6259 signed int v10; // ebx@19
6286 char *v11; // edx@20 6260 char *v11; // edx@20
6287 unsigned __int16 v12; // ax@23 6261 unsigned __int16 v12; // ax@23
6288 int v13; // eax@27 6262 int v13; // eax@27
6289 unsigned int v14; // ebx@33 6263 unsigned int v14; // ebx@33
6290 unsigned __int16 v15; // ax@35 6264 //unsigned __int16 v15; // ax@35
6291 int v16; // eax@36 6265 int v16; // eax@36
6292 unsigned int v17; // eax@37 6266 unsigned int v17; // eax@37
6293 __int16 v18; // di@37 6267 __int16 v18; // di@37
6294 signed int v19; // edx@37 6268 signed int v19; // edx@37
6295 unsigned __int8 v20; // sf@37 6269 unsigned __int8 v20; // sf@37
6343 unsigned int v68; // ecx@124 6317 unsigned int v68; // ecx@124
6344 signed int v69; // ebx@124 6318 signed int v69; // ebx@124
6345 char *v70; // edx@125 6319 char *v70; // edx@125
6346 unsigned __int16 v71; // ax@128 6320 unsigned __int16 v71; // ax@128
6347 unsigned int v72; // ebx@131 6321 unsigned int v72; // ebx@131
6348 int v73; // ST14_4@132 6322 //int v73; // ST14_4@132
6349 int v74; // ST10_4@132 6323 //int v74; // ST10_4@132
6350 int v75; // ebx@132 6324 //int v75; // ebx@132
6351 int v76; // ST0C_4@132 6325 //int v76; // ST0C_4@132
6352 unsigned __int16 v77; // ax@132 6326 //unsigned __int16 v77; // ax@132
6353 int v78; // eax@133 6327 int v78; // eax@133
6354 char v79; // zf@139 6328 char v79; // zf@139
6355 unsigned int v80; // eax@140 6329 unsigned int v80; // eax@140
6356 signed int v81; // edx@140 6330 signed int v81; // edx@140
6357 char *v82; // ecx@141 6331 char *v82; // ecx@141
6371 unsigned __int16 v96; // ax@184 6345 unsigned __int16 v96; // ax@184
6372 int v97; // eax@185 6346 int v97; // eax@185
6373 unsigned __int16 v98; // ax@191 6347 unsigned __int16 v98; // ax@191
6374 unsigned int v99; // ecx@191 6348 unsigned int v99; // ecx@191
6375 char v100; // ST18_1@198 6349 char v100; // ST18_1@198
6376 int v101; // ST14_4@198 6350 //int v101; // ST14_4@198
6377 int v102; // eax@198 6351 int v102; // eax@198
6378 int v103; // ST10_4@198 6352 //int v103; // ST10_4@198
6379 int v104; // ST0C_4@198 6353 //int v104; // ST0C_4@198
6380 unsigned __int16 v105; // ax@200 6354 //unsigned __int16 v105; // ax@200
6381 signed int v106; // eax@208 6355 signed int v106; // eax@208
6382 unsigned int v107; // edx@220 6356 unsigned int v107; // edx@220
6383 signed int v108; // ebx@225 6357 signed int v108; // ebx@225
6384 unsigned int v109; // eax@234 6358 unsigned int v109; // eax@234
6385 signed int v110; // ebx@234 6359 signed int v110; // ebx@234
6386 char *v111; // ecx@235 6360 char *v111; // ecx@235
6387 unsigned __int16 v112; // ax@238 6361 unsigned __int16 v112; // ax@238
6388 unsigned __int16 v113; // si@241 6362 unsigned __int16 v113; // si@241
6389 int v114; // eax@242 6363 int v114; // eax@242
6390 int v115; // eax@245 6364 int v115; // eax@245
6391 signed int v116; // eax@245 6365 //signed int v116; // eax@245
6392 unsigned __int16 v117; // ax@251 6366 unsigned __int16 v117; // ax@251
6393 unsigned int v118; // ecx@251 6367 unsigned int v118; // ecx@251
6394 signed int v119; // ebx@251 6368 signed int v119; // ebx@251
6395 char *v120; // edx@252 6369 char *v120; // edx@252
6396 unsigned __int16 v121; // ax@255 6370 unsigned __int16 v121; // ax@255
6397 unsigned int v122; // eax@260 6371 unsigned int v122; // eax@260
6398 char *v123; // edx@261 6372 char *v123; // edx@261
6399 int v124; // eax@267 6373 int v124; // eax@267
6400 int v125; // [sp-20h] [bp-4Ch]@28 6374 int v125; // [sp-20h] [bp-4Ch]@28
6401 signed int v126; // [sp-1Ch] [bp-48h]@27 6375 //signed int v126; // [sp-1Ch] [bp-48h]@27
6402 unsigned int v127; // [sp-18h] [bp-44h]@27 6376 //unsigned int v127; // [sp-18h] [bp-44h]@27
6403 signed int v128; // [sp-14h] [bp-40h]@27 6377 //signed int v128; // [sp-14h] [bp-40h]@27
6404 signed int v129; // [sp-10h] [bp-3Ch]@27 6378 //signed int v129; // [sp-10h] [bp-3Ch]@27
6405 int v130; // [sp-Ch] [bp-38h]@27 6379 //int v130; // [sp-Ch] [bp-38h]@27
6406 unsigned int v131; // [sp-8h] [bp-34h]@27 6380 //unsigned int v131; // [sp-8h] [bp-34h]@27
6407 char v132; // [sp-8h] [bp-34h]@131 6381 char v132; // [sp-8h] [bp-34h]@131
6408 int v133; // [sp-4h] [bp-30h]@27 6382 //int v133; // [sp-4h] [bp-30h]@27
6409 char v134; // [sp-4h] [bp-30h]@131 6383 char v134; // [sp-4h] [bp-30h]@131
6410 signed int v135; // [sp-4h] [bp-30h]@217 6384 signed int v135; // [sp-4h] [bp-30h]@217
6411 int v136; // [sp+Ch] [bp-20h]@208 6385 int v136; // [sp+Ch] [bp-20h]@208
6412 int v137; // [sp+10h] [bp-1Ch]@208 6386 int v137; // [sp+10h] [bp-1Ch]@208
6413 signed int v138; // [sp+14h] [bp-18h]@207 6387 signed int v138; // [sp+14h] [bp-18h]@207
6419 char *v144; // [sp+1Ch] [bp-10h]@192 6393 char *v144; // [sp+1Ch] [bp-10h]@192
6420 signed int v145; // [sp+20h] [bp-Ch]@1 6394 signed int v145; // [sp+20h] [bp-Ch]@1
6421 signed int v146; // [sp+20h] [bp-Ch]@60 6395 signed int v146; // [sp+20h] [bp-Ch]@60
6422 int v147; // [sp+20h] [bp-Ch]@72 6396 int v147; // [sp+20h] [bp-Ch]@72
6423 signed int v148; // [sp+20h] [bp-Ch]@158 6397 signed int v148; // [sp+20h] [bp-Ch]@158
6424 int v149; // [sp+20h] [bp-Ch]@198 6398 //int v149; // [sp+20h] [bp-Ch]@198
6425 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 6399 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208
6426 int v151; // [sp+24h] [bp-8h]@1 6400 int v151; // [sp+24h] [bp-8h]@1
6427 signed int v152; // [sp+24h] [bp-8h]@208 6401 signed int v152; // [sp+24h] [bp-8h]@208
6428 unsigned int v153; // [sp+28h] [bp-4h]@1 6402 unsigned int v153; // [sp+28h] [bp-4h]@1
6429 6403
6430 v153 = uLayingItemID; 6404 v153 = uLayingItemID;
6431 v2 = &pSpriteObjects[uLayingItemID]; 6405 //v2 = &pSpriteObjects[uLayingItemID];
6432 v3 = &pObjectList->pObjects[v2->uObjectDescID]; 6406 v3 = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
6433 v145 = a2; 6407 v145 = a2;
6434 v151 = PID_TYPE(a2); 6408 v151 = PID_TYPE(a2);
6435 if ( PID_TYPE(a2) == OBJECT_Actor) 6409 if ( PID_TYPE(a2) == OBJECT_Actor)
6436 { 6410 {
6437 if ( PID_TYPE(v2->spell_caster_pid) == OBJECT_Actor && !pActors[PID_ID(v2->spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) 6411 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor
6412 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) )
6438 return 1; 6413 return 1;
6439 } 6414 }
6440 else 6415 else
6441 { 6416 {
6442 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(v2->spell_caster_pid) == OBJECT_Player) 6417 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player)
6443 return 1; 6418 return 1;
6444 } 6419 }
6445 if ( pParty->bTurnBasedModeOn == 1 ) 6420 if ( pParty->bTurnBasedModeOn == 1 )
6446 { 6421 {
6447 v5 = v2->uAttributes; 6422 v5 = pSpriteObjects[uLayingItemID].uAttributes;
6448 if ( v5 & 4 ) 6423 if ( v5 & 4 )
6449 { 6424 {
6450 --pTurnEngine->field_1C; 6425 --pTurnEngine->field_1C;
6451 v2->uAttributes = v5 & 0xFFFB; 6426 pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB;
6452 } 6427 }
6453 } 6428 }
6454 if ( v151 == OBJECT_BModel && PID_TYPE(v2->spell_caster_pid) != OBJECT_Player) 6429 if ( v151 == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
6455 { 6430 {
6456 if (PID_ID(v2->spell_caster_pid)<500) //bugfix PID_ID(v2->spell_caster_pid)==1000 6431 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000
6457 BYTE2(pActors[PID_ID(v2->spell_caster_pid)].uAttributes) |= 4; 6432 BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4;
6458 } 6433 }
6459 6434
6460 v6 = v2->uType; 6435 //v6 = v2->uType;
6461 v7 = v2->uType; 6436 //v7 = v2->uType;
6462 if ( v7 > 3060 ) 6437 if ( pSpriteObjects[uLayingItemID].uType > 3060 )
6463 { 6438 {
6464 if ( v7 > 6090 ) 6439 if ( pSpriteObjects[uLayingItemID].uType > 6090 )
6465 { 6440 {
6466 if ( v7 > 8090 ) 6441 if ( pSpriteObjects[uLayingItemID].uType > 8090 )
6467 { 6442 {
6468 if ( v7 == 9010 ) 6443 if ( pSpriteObjects[uLayingItemID].uType == 9010 )
6469 goto LABEL_247; 6444 goto LABEL_247;
6470 if ( v7 != 9030 ) 6445 if ( pSpriteObjects[uLayingItemID].uType != 9030 )
6471 { 6446 {
6472 if ( v7 != 9040 ) 6447 if ( pSpriteObjects[uLayingItemID].uType != 9040 )
6473 { 6448 {
6474 if ( v7 != 9080 ) 6449 if ( pSpriteObjects[uLayingItemID].uType != 9080 )
6475 return 0; 6450 return 0;
6476 LABEL_191: 6451 LABEL_191:
6477 v98 = v6 + 1; 6452 v98 = pSpriteObjects[uLayingItemID].uType + 1;
6478 v99 = pObjectList->uNumObjects; 6453 v99 = pObjectList->uNumObjects;
6479 v32 = 0; 6454 v32 = 0;
6480 v2->uType = v98; 6455 pSpriteObjects[uLayingItemID].uType = v98;
6481 v146 = 0; 6456 v146 = 0;
6482 if ( (signed int)v99 > 0 ) 6457 if ( (signed int)v99 > 0 )
6483 { 6458 {
6484 v144 = (char *)&pObjectList->pObjects->uObjectID; 6459 v144 = (char *)&pObjectList->pObjects->uObjectID;
6485 while ( v98 != *(short *)v144 ) 6460 while ( v98 != *(short *)v144 )
6486 { 6461 {
6487 ++v146; 6462 ++v146;
6488 v144 += 56; 6463 v144 += 56;
6489 if ( v146 >= (signed int)v99 ) 6464 if ( v146 >= (signed int)v99 )
6490 goto LABEL_195; 6465 {
6466 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
6467 if ( !v32 )
6468 SpriteObject::OnInteraction(v153);
6469 v100 = pSpriteObjects[uLayingItemID].field_61;
6470 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
6471 v102 = 8 * v153;
6472 LOBYTE(v102) = PID(OBJECT_Item,v153);
6473 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
6474 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
6475 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
6476 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
6477 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6478 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
6479 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
6480 v47 = 0;
6481 else
6482 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6483 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6484 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
6485 return 0;
6486 }
6491 } 6487 }
6492 goto LABEL_80; 6488 pSpriteObjects[uLayingItemID].uObjectDescID = v146;
6489 if ( v146 == (short)v32 )
6490 SpriteObject::OnInteraction(v153);
6491 v100 = pSpriteObjects[uLayingItemID].field_61;
6492 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
6493 v102 = 8 * v153;
6494 LOBYTE(v102) = PID(OBJECT_Item,v153);
6495 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
6496 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
6497 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
6498 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
6499 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6500 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
6501 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
6502 v47 = 0;
6503 else
6504 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6505 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6506 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
6507 return 0;
6493 } 6508 }
6494 LABEL_195: 6509 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
6495 v46 = 0; 6510 if ( !v32 )
6496 goto LABEL_196; 6511 SpriteObject::OnInteraction(v153);
6512 v100 = pSpriteObjects[uLayingItemID].field_61;
6513 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
6514 v102 = 8 * v153;
6515 LOBYTE(v102) = PID(OBJECT_Item,v153);
6516 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
6517 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
6518 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
6519 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
6520 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6521 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
6522 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
6523 v47 = 0;
6524 else
6525 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6526 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6527 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
6528 return 0;
6497 } 6529 }
6498 goto LABEL_93; 6530 goto LABEL_93;
6499 } 6531 }
6500 LABEL_172: 6532 LABEL_172:
6501 v143 = 17030; 6533 v143 = 17030;
6502 switch ( v6 ) 6534 switch ( pSpriteObjects[uLayingItemID].uType )
6503 { 6535 {
6504 case 0x1798u: 6536 case 0x1798u:
6505 v143 = 15040; 6537 v143 = 15040;
6506 break; 6538 break;
6507 case 0xFAAu: 6539 case 0xFAAu:
6512 break; 6544 break;
6513 } 6545 }
6514 v138 = 1; 6546 v138 = 1;
6515 if ( v151 != OBJECT_Actor) 6547 if ( v151 != OBJECT_Actor)
6516 { 6548 {
6517 if ( v6 != 9030 || v2->spell_skill != 4 ) 6549 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 )
6518 goto LABEL_246; 6550 {
6519 v2->_46BEF1_apply_spells_aoe(); 6551 SpriteObject::OnInteraction(v153);
6552 return 0;
6553 }
6554 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
6520 LABEL_233: 6555 LABEL_233:
6521 if ( !v138 ) 6556 if ( !v138 )
6522 { 6557 {
6523 v109 = pObjectList->uNumObjects; 6558 v109 = pObjectList->uNumObjects;
6524 ++v2->uType; 6559 ++pSpriteObjects[uLayingItemID].uType;
6525 v110 = 0; 6560 v110 = 0;
6526 if ( (signed int)v109 <= 0 ) 6561 if ( (signed int)v109 <= 0 )
6527 { 6562 {
6528 LABEL_238: 6563 LABEL_238:
6529 v112 = 0; 6564 v112 = 0;
6530 } 6565 }
6531 else 6566 else
6532 { 6567 {
6533 v111 = (char *)&pObjectList->pObjects->uObjectID; 6568 v111 = (char *)&pObjectList->pObjects->uObjectID;
6534 while ( v2->uType != *(short *)v111 ) 6569 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v111 )
6535 { 6570 {
6536 ++v110; 6571 ++v110;
6537 v111 += 56; 6572 v111 += 56;
6538 if ( v110 >= (signed int)v109 ) 6573 if ( v110 >= (signed int)v109 )
6539 goto LABEL_238; 6574 goto LABEL_238;
6540 } 6575 }
6541 v112 = v110; 6576 v112 = v110;
6542 } 6577 }
6543 v2->uObjectDescID = v112; 6578 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
6544 if ( !v112 ) 6579 if ( !v112 )
6545 SpriteObject::OnInteraction(v153); 6580 SpriteObject::OnInteraction(v153);
6546 v2->vVelocity.z = 0; 6581 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6547 v2->vVelocity.y = 0; 6582 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6548 v2->vVelocity.x = 0; 6583 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6549 v2->uSpriteFrameID = 0; 6584 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6550 v113 = v2->uSoundID; 6585 v113 = pSpriteObjects[uLayingItemID].uSoundID;
6551 if ( v113 ) 6586 if ( v113 )
6552 v114 = (signed __int16)v113 + 4; 6587 v114 = (signed __int16)v113 + 4;
6553 else 6588 else
6554 v114 = 0; 6589 v114 = 0;
6555 v133 = 0;
6556 v131 = 0;
6557 v130 = v114;
6558 v115 = 8 * v153; 6590 v115 = 8 * v153;
6559 v129 = 0;
6560 v128 = -1;
6561 LOBYTE(v115) = PID(OBJECT_Item,v153); 6591 LOBYTE(v115) = PID(OBJECT_Item,v153);
6562 v127 = 0; 6592 v125 = v143 + 1;
6563 v126 = v115; 6593 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
6564 v116 = v143; 6594 return 0;
6565 goto LABEL_269;
6566 } 6595 }
6567 LABEL_246:
6568 SpriteObject::OnInteraction(v153); 6596 SpriteObject::OnInteraction(v153);
6569 return 0; 6597 return 0;
6570 } 6598 }
6571 v106 = v145; 6599 v106 = v145;
6572 v150 = 0; 6600 v150 = 0;
6573 v139 = PID_ID(v106); 6601 v139 = PID_ID(v106);
6574 v137 = v2->spell_level; 6602 v137 = pSpriteObjects[uLayingItemID].spell_level;
6575 v152 = v2->spell_skill; 6603 v152 = pSpriteObjects[uLayingItemID].spell_skill;
6576 v136 = v2->spell_id; 6604 v136 = pSpriteObjects[uLayingItemID].spell_id;
6577 if ( v6 == 9030 ) 6605 if ( pSpriteObjects[uLayingItemID].uType == 9030 )
6578 { 6606 {
6579 v150 = 2; 6607 v150 = 2;
6580 if ( v152 == 2 ) 6608 if ( v152 == 2 )
6581 { 6609 {
6582 v150 = 3; 6610 v150 = 3;
6586 if ( v152 >= 3 ) 6614 if ( v152 >= 3 )
6587 v150 = 4; 6615 v150 = 4;
6588 } 6616 }
6589 BYTE2(pActors[v139].uAttributes) |= 8u; 6617 BYTE2(pActors[v139].uAttributes) |= 8u;
6590 } 6618 }
6591 if ( v7 == 6040 ) 6619 if ( pSpriteObjects[uLayingItemID].uType == 6040 )
6592 { 6620 {
6593 v135 = 7; 6621 v135 = 7;
6594 } 6622 }
6595 else 6623 else
6596 { 6624 {
6597 if ( v7 == 8030 ) 6625 if ( pSpriteObjects[uLayingItemID].uType == 8030 )
6598 { 6626 {
6599 v135 = 9; 6627 v135 = 9;
6600 } 6628 }
6601 else 6629 else
6602 { 6630 {
6603 if ( v7 != 9030 ) 6631 if ( pSpriteObjects[uLayingItemID].uType != 9030 )
6604 { 6632 {
6605 v107 = v136; 6633 v107 = v136;
6606 LABEL_222: 6634 LABEL_222:
6607 if ( v6 != 9030 || v152 != 4 ) 6635 if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 )
6608 { 6636 {
6609 v108 = v139; 6637 v108 = v139;
6610 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) 6638 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) )
6611 { 6639 {
6612 v138 = 0; 6640 v138 = 0;
6613 if ( v2->uType == 8030 ) 6641 if ( pSpriteObjects[uLayingItemID].uType == 8030 )
6614 { 6642 {
6615 pActors[v108].uAIState = Standing; 6643 pActors[v108].uAIState = Standing;
6616 pActors[v108].UpdateAnimation(); 6644 pActors[v108].UpdateAnimation();
6617 } 6645 }
6618 pActors[v108].pActorBuffs[v136].Apply( 6646 pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335),
6619 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), 6647 v152, v150, 0, 0);
6620 v152,
6621 v150,
6622 0,
6623 0);
6624 } 6648 }
6625 } 6649 }
6626 else 6650 else
6627 { 6651 {
6628 v2->_46BEF1_apply_spells_aoe(); 6652 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
6629 } 6653 }
6630 v2->spell_level = 0; 6654 pSpriteObjects[uLayingItemID].spell_level = 0;
6631 v2->spell_skill = 0; 6655 pSpriteObjects[uLayingItemID].spell_skill = 0;
6632 v2->spell_id = 0; 6656 pSpriteObjects[uLayingItemID].spell_id = 0;
6633 goto LABEL_233; 6657 goto LABEL_233;
6634 } 6658 }
6635 v135 = 10; 6659 v135 = 10;
6636 } 6660 }
6637 } 6661 }
6638 v107 = v135; 6662 v107 = v135;
6639 goto LABEL_222; 6663 goto LABEL_222;
6640 } 6664 }
6641 if ( v7 == 8090 || v7 == 7030 || v7 == 7090 || v7 == 8000 ) 6665 if ( pSpriteObjects[uLayingItemID].uType == 8090 || pSpriteObjects[uLayingItemID].uType == 7030 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 )
6642 goto LABEL_93; 6666 goto LABEL_93;
6643 if ( v7 == 8010 ) 6667 if ( pSpriteObjects[uLayingItemID].uType == 8010 )
6644 { 6668 {
6645 if ( v151 == 3 6669 if ( v151 == 3
6646 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) 6670 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6647 sub_43A97E(v153, v145); 6671 sub_43A97E(v153, v145);
6648 v93 = pObjectList->uNumObjects; 6672 v93 = pObjectList->uNumObjects;
6649 ++v2->uType; 6673 ++pSpriteObjects[uLayingItemID].uType;
6650 v9 = 0; 6674 v9 = 0;
6651 v52 = 0; 6675 v52 = 0;
6652 if ( (signed int)v93 > 0 ) 6676 if ( (signed int)v93 > 0 )
6653 { 6677 {
6654 v94 = (char *)&pObjectList->pObjects->uObjectID; 6678 v94 = (char *)&pObjectList->pObjects->uObjectID;
6655 while ( v2->uType != *(short *)v94 ) 6679 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v94 )
6656 { 6680 {
6657 ++v52; 6681 ++v52;
6658 v94 += 56; 6682 v94 += 56;
6659 if ( v52 >= (signed int)v93 ) 6683 if ( v52 >= (signed int)v93 )
6660 goto LABEL_181; 6684 goto LABEL_181;
6661 } 6685 }
6662 goto LABEL_202; 6686 v95 = v52;
6687 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
6688 if ( v95 == (short)v9 )
6689 SpriteObject::OnInteraction(v153);
6690 v96 = pSpriteObjects[uLayingItemID].uSoundID;
6691 pSpriteObjects[uLayingItemID].vVelocity.z = v9;
6692 pSpriteObjects[uLayingItemID].vVelocity.y = v9;
6693 pSpriteObjects[uLayingItemID].vVelocity.x = v9;
6694 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9;
6695 if ( v96 == (short)v9 )
6696 v97 = 0;
6697 else
6698 v97 = (signed __int16)v96 + 4;
6699 v92 = v153;
6700 v124 = 8 * v92;
6701 LOBYTE(v124) = v124 | 2;
6702 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6703 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9);
6704 return 0;
6663 } 6705 }
6664 goto LABEL_181; 6706 goto LABEL_181;
6665 } 6707 }
6666 v79 = v7 == 8030; 6708 v79 = pSpriteObjects[uLayingItemID].uType == 8030;
6667 } 6709 }
6668 else 6710 else
6669 { 6711 {
6670 if ( v7 == 6090 ) 6712 if ( pSpriteObjects[uLayingItemID].uType == 6090 )
6671 goto LABEL_93; 6713 goto LABEL_93;
6672 if ( v7 <= 4070 ) 6714 if ( pSpriteObjects[uLayingItemID].uType <= 4070 )
6673 { 6715 {
6674 if ( v7 != 4070 ) 6716 if ( pSpriteObjects[uLayingItemID].uType != 4070 )
6675 { 6717 {
6676 v48 = v7 - 3090; 6718 v48 = pSpriteObjects[uLayingItemID].uType - 3090;
6677 if ( v48 ) 6719 if ( v48 )
6678 { 6720 {
6679 v49 = v48 - 2; 6721 v49 = v48 - 2;
6680 if ( v49 ) 6722 if ( v49 )
6681 { 6723 {
6684 goto LABEL_93; 6726 goto LABEL_93;
6685 v45 = v50 - 30; 6727 v45 = v50 - 30;
6686 v44 = v45 == 0; 6728 v44 = v45 == 0;
6687 goto LABEL_91; 6729 goto LABEL_91;
6688 } 6730 }
6689 v54 = v6 - 1; 6731 v54 = pSpriteObjects[uLayingItemID].uType - 1;
6690 v55 = pObjectList->uNumObjects; 6732 v55 = pObjectList->uNumObjects;
6691 v9 = 0; 6733 v9 = 0;
6692 v56 = 0; 6734 v56 = 0;
6693 v44 = pObjectList->uNumObjects == 0; 6735 v44 = pObjectList->uNumObjects == 0;
6694 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 6736 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6695 v2->uType = v54; 6737 pSpriteObjects[uLayingItemID].uType = v54;
6696 if ( v20 | v44 ) 6738 if ( v20 | v44 )
6697 { 6739 {
6698 LABEL_102: 6740 LABEL_102:
6699 v58 = 0; 6741 v58 = 0;
6700 } 6742 }
6708 if ( v56 >= (signed int)v55 ) 6750 if ( v56 >= (signed int)v55 )
6709 goto LABEL_102; 6751 goto LABEL_102;
6710 } 6752 }
6711 v58 = v56; 6753 v58 = v56;
6712 } 6754 }
6713 v2->uObjectDescID = v58; 6755 pSpriteObjects[uLayingItemID].uObjectDescID = v58;
6714 if ( !v58 ) 6756 if ( !v58 )
6715 SpriteObject::OnInteraction(v153); 6757 SpriteObject::OnInteraction(v153);
6716 v14 = v153; 6758 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6717 v2->vVelocity.z = 0; 6759 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6718 v2->vVelocity.y = 0; 6760 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6719 v2->vVelocity.x = 0; 6761 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6720 v2->uSpriteFrameID = 0;
6721 sub_43A97E(v153, v145); 6762 sub_43A97E(v153, v145);
6722 LABEL_35: 6763 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 )
6723 v15 = v2->uSoundID;
6724 if ( v15 == (short)v9 )
6725 v16 = 0; 6764 v16 = 0;
6726 else 6765 else
6727 v16 = (signed __int16)v15 + 4; 6766 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6728 v133 = v9; 6767 v124 = 8 * v153;
6729 v131 = v9;
6730 v130 = v16;
6731 v92 = v14;
6732 LABEL_267:
6733 v124 = 8 * v92;
6734 v129 = v9;
6735 v128 = -1;
6736 LOBYTE(v124) = v124 | 2; 6768 LOBYTE(v124) = v124 | 2;
6737 v127 = v9; 6769 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
6738 v126 = v124; 6770 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6739 LABEL_268: 6771 return 0;
6740 v116 = word_4EE088_sound_ids[v2->spell_id - 1];
6741 LABEL_269:
6742 v125 = v116 + 1;
6743 goto LABEL_29;
6744 } 6772 }
6745 v59 = v6 + 2; 6773 v59 = pSpriteObjects[uLayingItemID].uType + 2;
6746 v60 = pObjectList->uNumObjects; 6774 v60 = pObjectList->uNumObjects;
6747 v9 = 0; 6775 v9 = 0;
6748 v61 = 0; 6776 v61 = 0;
6749 v44 = pObjectList->uNumObjects == 0; 6777 v44 = pObjectList->uNumObjects == 0;
6750 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 6778 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6751 v2->uType = v59; 6779 pSpriteObjects[uLayingItemID].uType = v59;
6752 if ( v20 | v44 ) 6780 if ( v20 | v44 )
6753 { 6781 {
6754 LABEL_111: 6782 LABEL_111:
6755 v63 = 0; 6783 v63 = 0;
6756 } 6784 }
6764 if ( v61 >= (signed int)v60 ) 6792 if ( v61 >= (signed int)v60 )
6765 goto LABEL_111; 6793 goto LABEL_111;
6766 } 6794 }
6767 v63 = v61; 6795 v63 = v61;
6768 } 6796 }
6769 v2->uObjectDescID = v63; 6797 pSpriteObjects[uLayingItemID].uObjectDescID = v63;
6770 if ( !v63 ) 6798 if ( !v63 )
6771 SpriteObject::OnInteraction(v153); 6799 SpriteObject::OnInteraction(v153);
6772 v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; 6800 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
6773 v44 = v2->spell_skill == 4; 6801 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4;
6774 v2->vVelocity.z = 0; 6802 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6775 v2->vVelocity.y = 0; 6803 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6776 v2->vVelocity.x = 0; 6804 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6777 v65 = 7; 6805 v65 = 7;
6778 if ( v44 ) 6806 if ( v44 )
6779 v65 = 9; 6807 v65 = 9;
6780 if ( v65 > 0 ) 6808 if ( v65 > 0 )
6781 { 6809 {
6782 v141 = v65; 6810 v141 = v65;
6783 do 6811 do
6784 { 6812 {
6785 v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; 6813 v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1;
6786 v2->Create(v64, 0, 1000, 0); 6814 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0);
6787 --v141; 6815 --v141;
6788 } 6816 }
6789 while ( v141 ); 6817 while ( v141 );
6790 } 6818 }
6791 LABEL_160: 6819 SpriteObject::OnInteraction(v153);
6792 v14 = v153; 6820 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 )
6793 LABEL_34: 6821 v16 = 0;
6794 SpriteObject::OnInteraction(v14); 6822 else
6795 goto LABEL_35; 6823 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6824 v124 = 8 * v153;
6825 LOBYTE(v124) = v124 | 2;
6826 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
6827 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6828 return 0;
6796 } 6829 }
6797 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) 6830 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) )
6798 return 1; 6831 return 1;
6799 v67 = v6 + 1; 6832 v67 = pSpriteObjects[uLayingItemID].uType + 1;
6800 v68 = pObjectList->uNumObjects; 6833 v68 = pObjectList->uNumObjects;
6801 v69 = 0; 6834 v69 = 0;
6802 v44 = pObjectList->uNumObjects == 0; 6835 v44 = pObjectList->uNumObjects == 0;
6803 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 6836 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6804 v2->uType = v67; 6837 pSpriteObjects[uLayingItemID].uType = v67;
6805 if ( v20 | v44 ) 6838 if ( v20 | v44 )
6806 { 6839 {
6807 LABEL_128: 6840 LABEL_128:
6808 v71 = 0; 6841 v71 = 0;
6809 } 6842 }
6817 if ( v69 >= (signed int)v68 ) 6850 if ( v69 >= (signed int)v68 )
6818 goto LABEL_128; 6851 goto LABEL_128;
6819 } 6852 }
6820 v71 = v69; 6853 v71 = v69;
6821 } 6854 }
6822 v2->uObjectDescID = v71; 6855 pSpriteObjects[uLayingItemID].uObjectDescID = v71;
6823 if ( !v71 ) 6856 if ( !v71 )
6824 SpriteObject::OnInteraction(v153); 6857 SpriteObject::OnInteraction(v153);
6825 v134 = 0; 6858 v134 = 0;
6826 v72 = v153; 6859 v72 = v153;
6827 v132 = 0; 6860 v132 = 0;
6828 LABEL_132: 6861 pSpriteObjects[uLayingItemID].vVelocity.z = v66;
6829 v73 = v2->vPosition.z; 6862 pSpriteObjects[uLayingItemID].vVelocity.y = v66;
6830 v74 = v2->vPosition.y; 6863 pSpriteObjects[uLayingItemID].vVelocity.x = v66;
6831 v75 = PID(OBJECT_Item,v72); 6864 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66;
6832 v2->vVelocity.z = v66; 6865 stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
6833 v2->vVelocity.y = v66; 6866 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 )
6834 v76 = v2->vPosition.x;
6835 v2->vVelocity.x = v66;
6836 v2->uSpriteFrameID = v66;
6837 stru_50FE08.Add(v75, 512, v76, v74, v73, v132, v134);
6838 v77 = v2->uSoundID;
6839 if ( v77 == (short)v66 )
6840 v78 = 0; 6867 v78 = 0;
6841 else 6868 else
6842 v78 = (signed __int16)v77 + 4; 6869 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6843 v133 = v66; 6870 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6844 v131 = v66; 6871 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66);
6845 v130 = v78; 6872 return 0;
6846 v129 = v66; 6873 }
6847 v128 = -1; 6874 if ( pSpriteObjects[uLayingItemID].uType == 4090 )
6848 v127 = v66; 6875 {
6849 v126 = v75; 6876 v84 = pSpriteObjects[uLayingItemID].uType + 2;
6850 goto LABEL_268;
6851 }
6852 if ( v7 == 4090 )
6853 {
6854 v84 = v6 + 2;
6855 v85 = pObjectList->uNumObjects; 6877 v85 = pObjectList->uNumObjects;
6856 v9 = 0; 6878 v9 = 0;
6857 v86 = 0; 6879 v86 = 0;
6858 v44 = pObjectList->uNumObjects == 0; 6880 v44 = pObjectList->uNumObjects == 0;
6859 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 6881 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6860 v2->uType = v84; 6882 pSpriteObjects[uLayingItemID].uType = v84;
6861 if ( v20 | v44 ) 6883 if ( v20 | v44 )
6862 { 6884 {
6863 LABEL_155: 6885 LABEL_155:
6864 v88 = 0; 6886 v88 = 0;
6865 } 6887 }
6873 if ( v86 >= (signed int)v85 ) 6895 if ( v86 >= (signed int)v85 )
6874 goto LABEL_155; 6896 goto LABEL_155;
6875 } 6897 }
6876 v88 = v86; 6898 v88 = v86;
6877 } 6899 }
6878 v2->uObjectDescID = v88; 6900 pSpriteObjects[uLayingItemID].uObjectDescID = v88;
6879 if ( !v88 ) 6901 if ( !v88 )
6880 SpriteObject::OnInteraction(v153); 6902 SpriteObject::OnInteraction(v153);
6881 v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; 6903 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
6882 v2->vVelocity.z = 0; 6904 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6883 v2->vVelocity.y = 0; 6905 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6884 v2->vVelocity.x = 0; 6906 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6885 v142 = v89; 6907 v142 = v89;
6886 v148 = 7; 6908 v148 = 7;
6887 do 6909 do
6888 { 6910 {
6889 pRnd->SetRange(-128, 128); 6911 pRnd->SetRange(-128, 128);
6890 v90 = pRnd->GetInRange(); 6912 v90 = pRnd->GetInRange();
6891 pRnd->SetRange(5, 500); 6913 pRnd->SetRange(5, 500);
6892 v91 = pRnd->GetInRange(); 6914 v91 = pRnd->GetInRange();
6893 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; 6915 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1;
6894 v2->Create(v90 + v142, 0, v91, 0); 6916 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0);
6895 --v148; 6917 --v148;
6896 } 6918 }
6897 while ( v148 ); 6919 while ( v148 );
6898 goto LABEL_160; 6920 SpriteObject::OnInteraction(v153);
6899 } 6921 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 )
6900 if ( v7 == 4092 ) 6922 v16 = 0;
6923 else
6924 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6925 v124 = 8 * v153;
6926 LOBYTE(v124) = v124 | 2;
6927 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
6928 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6929 return 0;
6930 }
6931 if ( pSpriteObjects[uLayingItemID].uType == 4092 )
6901 { 6932 {
6902 v80 = pObjectList->uNumObjects; 6933 v80 = pObjectList->uNumObjects;
6903 v66 = 0; 6934 v66 = 0;
6904 v81 = 0; 6935 v81 = 0;
6905 v44 = pObjectList->uNumObjects == 0; 6936 v44 = pObjectList->uNumObjects == 0;
6906 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 6937 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6907 v2->uType = 4091; 6938 pSpriteObjects[uLayingItemID].uType = 4091;
6908 if ( v20 | v44 ) 6939 if ( v20 | v44 )
6909 { 6940 {
6910 LABEL_144: 6941 LABEL_144:
6911 v83 = 0; 6942 v83 = 0;
6912 } 6943 }
6920 if ( v81 >= (signed int)v80 ) 6951 if ( v81 >= (signed int)v80 )
6921 goto LABEL_144; 6952 goto LABEL_144;
6922 } 6953 }
6923 v83 = v81; 6954 v83 = v81;
6924 } 6955 }
6925 v2->uObjectDescID = v83; 6956 pSpriteObjects[uLayingItemID].uObjectDescID = v83;
6926 if ( !v83 ) 6957 if ( !v83 )
6927 SpriteObject::OnInteraction(v153); 6958 SpriteObject::OnInteraction(v153);
6928 v134 = 0; 6959 v134 = 0;
6929 v72 = v153; 6960 v72 = v153;
6930 v132 = v2->field_61; 6961 v132 = pSpriteObjects[uLayingItemID].field_61;
6931 goto LABEL_132; 6962 pSpriteObjects[uLayingItemID].vVelocity.z = v66;
6932 } 6963 pSpriteObjects[uLayingItemID].vVelocity.y = v66;
6933 if ( v7 == 4100 || v7 == 6010 ) 6964 pSpriteObjects[uLayingItemID].vVelocity.x = v66;
6965 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66;
6966 stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
6967 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 )
6968 v78 = 0;
6969 else
6970 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6971 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6972 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66);
6973 return 0;
6974 }
6975 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 )
6934 goto LABEL_93; 6976 goto LABEL_93;
6935 v79 = v7 == 6040; 6977 v79 = pSpriteObjects[uLayingItemID].uType == 6040;
6936 } 6978 }
6937 if ( !v79 ) 6979 if ( !v79 )
6938 return 0; 6980 return 0;
6939 goto LABEL_172; 6981 goto LABEL_172;
6940 } 6982 }
6941 if ( v7 == 3060 ) 6983 if ( pSpriteObjects[uLayingItemID].uType == 3060 )
6942 goto LABEL_93; 6984 goto LABEL_93;
6943 if ( v7 <= 555 ) 6985 if ( pSpriteObjects[uLayingItemID].uType <= 555 )
6944 { 6986 {
6945 if ( v7 == 555 ) 6987 if ( pSpriteObjects[uLayingItemID].uType == 555 )
6946 { 6988 {
6947 sub_43A97E(v153, v145); 6989 sub_43A97E(v153, v145);
6948 v23 = pObjectList->uNumObjects; 6990 v23 = pObjectList->uNumObjects;
6949 ++v2->uType; 6991 ++pSpriteObjects[uLayingItemID].uType;
6950 v18 = 0; 6992 v18 = 0;
6951 v24 = 0; 6993 v24 = 0;
6952 if ( (signed int)v23 <= 0 ) 6994 if ( (signed int)v23 <= 0 )
6953 { 6995 {
6954 LABEL_41: 6996 LABEL_41:
6955 v22 = 0; 6997 v22 = 0;
6956 } 6998 }
6957 else 6999 else
6958 { 7000 {
6959 v25 = (char *)&pObjectList->pObjects->uObjectID; 7001 v25 = (char *)&pObjectList->pObjects->uObjectID;
6960 while ( v2->uType != *(short *)v25 ) 7002 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v25 )
6961 { 7003 {
6962 ++v24; 7004 ++v24;
6963 v25 += 56; 7005 v25 += 56;
6964 if ( v24 >= (signed int)v23 ) 7006 if ( v24 >= (signed int)v23 )
6965 goto LABEL_41; 7007 goto LABEL_41;
6966 } 7008 }
6967 v22 = v24; 7009 v22 = v24;
6968 } 7010 }
6969 LABEL_42: 7011 LABEL_42:
6970 v2->uObjectDescID = v22; 7012 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
6971 if ( v22 == v18 ) 7013 if ( v22 == v18 )
6972 SpriteObject::OnInteraction(v153); 7014 SpriteObject::OnInteraction(v153);
6973 v2->vVelocity.z = v18; 7015 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
6974 v2->vVelocity.y = v18; 7016 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
6975 v2->vVelocity.x = v18; 7017 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
6976 v2->uSpriteFrameID = v18; 7018 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
6977 } 7019 }
6978 else 7020 else
6979 { 7021 {
6980 switch ( v7 ) 7022 switch ( pSpriteObjects[uLayingItemID].uType )
6981 { 7023 {
6982 case 500: 7024 case 500:
6983 case 505: 7025 case 505:
6984 case 510: 7026 case 510:
6985 case 515: 7027 case 515:
6988 case 530: 7030 case 530:
6989 case 535: 7031 case 535:
6990 case 540: 7032 case 540:
6991 sub_43A97E(v153, v145); 7033 sub_43A97E(v153, v145);
6992 v8 = pObjectList->uNumObjects; 7034 v8 = pObjectList->uNumObjects;
6993 ++v2->uType; 7035 ++pSpriteObjects[uLayingItemID].uType;
6994 v9 = 0; 7036 v9 = 0;
6995 v10 = 0; 7037 v10 = 0;
6996 if ( (signed int)v8 <= 0 ) 7038 if ( (signed int)v8 <= 0 )
6997 goto LABEL_23; 7039 {
7040 v12 = 0;
7041 goto LABEL_24;
7042 }
6998 v11 = (char *)&pObjectList->pObjects->uObjectID; 7043 v11 = (char *)&pObjectList->pObjects->uObjectID;
6999 break; 7044 break;
7000 case 545: 7045 case 545:
7001 case 550: 7046 case 550:
7002 if ( v2->stru_24.uItemID != 405 && v2->stru_24.uSpecEnchantmentType != 3 ) 7047 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 )
7003 { 7048 {
7004 v14 = v153; 7049 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
7005 v9 = 0; 7050 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
7006 v2->vVelocity.z = 0; 7051 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
7007 v2->vVelocity.y = 0; 7052 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
7008 v2->vVelocity.x = 0;
7009 v2->uSpriteFrameID = 0;
7010 sub_43A97E(v153, v145); 7053 sub_43A97E(v153, v145);
7011 goto LABEL_34; 7054 SpriteObject::OnInteraction(v153);
7055 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 )
7056 v16 = 0;
7057 else
7058 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
7059 v124 = 8 * v153;
7060 LOBYTE(v124) = v124 | 2;
7061 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
7062 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
7063 return 0;
7012 } 7064 }
7013 v17 = pObjectList->uNumObjects; 7065 v17 = pObjectList->uNumObjects;
7014 v18 = 0; 7066 v18 = 0;
7015 v19 = 0; 7067 v19 = 0;
7016 v44 = pObjectList->uNumObjects == 0; 7068 v44 = pObjectList->uNumObjects == 0;
7017 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 7069 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
7018 v2->uType = 600; 7070 pSpriteObjects[uLayingItemID].uType = 600;
7019 if ( v20 | v44 ) 7071 if ( v20 | v44 )
7020 goto LABEL_41; 7072 goto LABEL_41;
7021 v21 = (char *)&pObjectList->pObjects->uObjectID; 7073 v21 = (char *)&pObjectList->pObjects->uObjectID;
7022 while ( *(short *)v21 != 600 ) 7074 while ( *(short *)v21 != 600 )
7023 { 7075 {
7029 v22 = v19; 7081 v22 = v19;
7030 goto LABEL_42; 7082 goto LABEL_42;
7031 default: 7083 default:
7032 return 0; 7084 return 0;
7033 } 7085 }
7034 while ( v2->uType != *(short *)v11 ) 7086 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 )
7035 { 7087 {
7036 ++v10; 7088 ++v10;
7037 v11 += 56; 7089 v11 += 56;
7038 if ( v10 >= (signed int)v8 ) 7090 if ( v10 >= (signed int)v8 )
7039 { 7091 {
7040 LABEL_23:
7041 v12 = 0; 7092 v12 = 0;
7042 goto LABEL_24; 7093 goto LABEL_24;
7043 } 7094 }
7044 } 7095 }
7045 v12 = v10; 7096 v12 = v10;
7046 LABEL_24: 7097 LABEL_24:
7047 v2->uObjectDescID = v12; 7098 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
7048 if ( !v12 ) 7099 if ( !v12 )
7049 SpriteObject::OnInteraction(v153); 7100 SpriteObject::OnInteraction(v153);
7050 v44 = v2->uType == 555; 7101 v44 = pSpriteObjects[uLayingItemID].uType == 555;
7051 v2->vVelocity.z = 0; 7102 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
7052 v2->vVelocity.y = 0; 7103 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
7053 v2->vVelocity.x = 0; 7104 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
7054 v2->uSpriteFrameID = 0; 7105 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
7055 if ( !v44 ) 7106 if ( !v44 )
7056 goto LABEL_27; 7107 {
7108 v13 = 8 * v153;
7109 LOBYTE(v13) = PID(OBJECT_Item,v153);
7110 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9);
7111 return 0;
7112 }
7057 } 7113 }
7058 return 0; 7114 return 0;
7059 } 7115 }
7060 if ( v7 > 1100 ) 7116 if ( pSpriteObjects[uLayingItemID].uType > 1100 )
7061 { 7117 {
7062 v41 = v7 - 2030; 7118 v41 = pSpriteObjects[uLayingItemID].uType - 2030;
7063 if ( !v41 ) 7119 if ( !v41 )
7064 goto LABEL_247; 7120 goto LABEL_247;
7065 v42 = v41 - 30; 7121 v42 = v41 - 30;
7066 if ( v42 ) 7122 if ( v42 )
7067 { 7123 {
7075 return 0; 7131 return 0;
7076 } 7132 }
7077 LABEL_93: 7133 LABEL_93:
7078 sub_43A97E(v153, v145); 7134 sub_43A97E(v153, v145);
7079 v51 = pObjectList->uNumObjects; 7135 v51 = pObjectList->uNumObjects;
7080 ++v2->uType; 7136 ++pSpriteObjects[uLayingItemID].uType;
7081 v9 = 0; 7137 v9 = 0;
7082 v52 = 0; 7138 v52 = 0;
7083 if ( (signed int)v51 > 0 ) 7139 if ( (signed int)v51 > 0 )
7084 { 7140 {
7085 v53 = (char *)&pObjectList->pObjects->uObjectID; 7141 v53 = (char *)&pObjectList->pObjects->uObjectID;
7086 while ( v2->uType != *(short *)v53 ) 7142 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v53 )
7087 { 7143 {
7088 ++v52; 7144 ++v52;
7089 v53 += 56; 7145 v53 += 56;
7090 if ( v52 >= (signed int)v51 ) 7146 if ( v52 >= (signed int)v51 )
7091 goto LABEL_181; 7147 goto LABEL_181;
7092 } 7148 }
7093 goto LABEL_202; 7149 v95 = v52;
7094 } 7150 }
7151 else
7152 {
7095 LABEL_181: 7153 LABEL_181:
7096 v95 = 0; 7154 v95 = 0;
7097 LABEL_182: 7155 }
7098 v2->uObjectDescID = v95; 7156 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
7099 if ( v95 == (short)v9 ) 7157 if ( v95 == (short)v9 )
7100 SpriteObject::OnInteraction(v153); 7158 SpriteObject::OnInteraction(v153);
7101 v96 = v2->uSoundID; 7159 v96 = pSpriteObjects[uLayingItemID].uSoundID;
7102 v2->vVelocity.z = v9; 7160 pSpriteObjects[uLayingItemID].vVelocity.z = v9;
7103 v2->vVelocity.y = v9; 7161 pSpriteObjects[uLayingItemID].vVelocity.y = v9;
7104 v2->vVelocity.x = v9; 7162 pSpriteObjects[uLayingItemID].vVelocity.x = v9;
7105 v2->uSpriteFrameID = v9; 7163 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9;
7106 if ( v96 == (short)v9 ) 7164 if ( v96 == (short)v9 )
7107 v97 = 0; 7165 v97 = 0;
7108 else 7166 else
7109 v97 = (signed __int16)v96 + 4; 7167 v97 = (signed __int16)v96 + 4;
7110 v133 = v9;
7111 v131 = v9;
7112 v130 = v97;
7113 v92 = v153; 7168 v92 = v153;
7114 goto LABEL_267; 7169 v124 = 8 * v92;
7115 } 7170 LOBYTE(v124) = v124 | 2;
7116 if ( v7 == 1100 ) 7171 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7172 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9);
7173 return 0;
7174 }
7175 if ( pSpriteObjects[uLayingItemID].uType == 1100 )
7117 goto LABEL_93; 7176 goto LABEL_93;
7118 v26 = v7 - 600; 7177 v26 = pSpriteObjects[uLayingItemID].uType - 600;
7119 if ( !v26 ) 7178 if ( !v26 )
7120 { 7179 {
7121 v33 = pObjectList->uNumObjects; 7180 v33 = pObjectList->uNumObjects;
7122 v34 = 0; 7181 v34 = 0;
7123 v44 = pObjectList->uNumObjects == 0; 7182 v44 = pObjectList->uNumObjects == 0;
7124 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 7183 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
7125 v2->uType = 601; 7184 pSpriteObjects[uLayingItemID].uType = 601;
7126 if ( v20 | v44 ) 7185 if ( v20 | v44 )
7127 { 7186 {
7128 LABEL_69: 7187 LABEL_69:
7129 v36 = 0; 7188 v36 = 0;
7130 } 7189 }
7138 if ( v34 >= (signed int)v33 ) 7197 if ( v34 >= (signed int)v33 )
7139 goto LABEL_69; 7198 goto LABEL_69;
7140 } 7199 }
7141 v36 = v34; 7200 v36 = v34;
7142 } 7201 }
7143 v2->uObjectDescID = v36; 7202 pSpriteObjects[uLayingItemID].uObjectDescID = v36;
7144 if ( !v36 ) 7203 if ( !v36 )
7145 SpriteObject::OnInteraction(v153); 7204 SpriteObject::OnInteraction(v153);
7146 v37 = v2->vPosition.z; 7205 v37 = pSpriteObjects[uLayingItemID].vPosition.z;
7147 v2->vVelocity.z = 0; 7206 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
7148 v38 = 8 * v153; 7207 v38 = 8 * v153;
7149 v39 = v2->vPosition.y; 7208 v39 = pSpriteObjects[uLayingItemID].vPosition.y;
7150 LOBYTE(v38) = PID(OBJECT_Item,v153); 7209 LOBYTE(v38) = PID(OBJECT_Item,v153);
7151 v2->vVelocity.y = 0; 7210 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
7152 v2->vVelocity.x = 0; 7211 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
7153 v40 = v2->vPosition.x; 7212 v40 = pSpriteObjects[uLayingItemID].vPosition.x;
7154 v2->uSpriteFrameID = 0; 7213 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
7155 v147 = v38; 7214 v147 = v38;
7156 stru_50FE08.Add(v38, 512, v40, v39, v37, 0, 0); 7215 stru_50FE08.Add(v38, 512, v40, v39, v37, 0, 0);
7157 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) 7216 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
7158 trail_particle_generator.GenerateTrailParticles(v2->vPosition.x, v2->vPosition.y, v2->vPosition.z, v3->uParticleTrailColor); 7217 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
7159 v133 = 0; 7218 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0);
7160 v131 = 0; 7219 return 0;
7161 v130 = 0;
7162 v129 = 0;
7163 v128 = -1;
7164 v127 = 0;
7165 v126 = v147;
7166 goto LABEL_28;
7167 } 7220 }
7168 v27 = v26 - 410; 7221 v27 = v26 - 410;
7169 if ( !v27 ) 7222 if ( !v27 )
7170 goto LABEL_93; 7223 goto LABEL_93;
7171 v28 = v27 - 40; 7224 v28 = v27 - 40;
7177 if ( v29 != 20 ) 7230 if ( v29 != 20 )
7178 return 0; 7231 return 0;
7179 LABEL_59: 7232 LABEL_59:
7180 if ( v151 != 3 ) 7233 if ( v151 != 3 )
7181 { 7234 {
7182 v30 = v6 + 1; 7235 v30 = pSpriteObjects[uLayingItemID].uType + 1;
7183 v31 = pObjectList->uNumObjects; 7236 v31 = pObjectList->uNumObjects;
7184 v32 = 0; 7237 v32 = 0;
7185 v2->uType = v30; 7238 pSpriteObjects[uLayingItemID].uType = v30;
7186 v146 = 0; 7239 v146 = 0;
7187 if ( (signed int)v31 > 0 ) 7240 if ( (signed int)v31 > 0 )
7188 { 7241 {
7189 v140 = (char *)&pObjectList->pObjects->uObjectID; 7242 v140 = (char *)&pObjectList->pObjects->uObjectID;
7190 while ( v30 != *(short *)v140 ) 7243 while ( v30 != *(short *)v140 )
7191 { 7244 {
7192 ++v146; 7245 ++v146;
7193 v140 += 56; 7246 v140 += 56;
7194 if ( v146 >= (signed int)v31 ) 7247 if ( v146 >= (signed int)v31 )
7195 goto LABEL_195; 7248 {
7196 } 7249 v46 = 0;
7197 LABEL_80: 7250 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
7251 if ( v46 == (short)v32 )
7252 SpriteObject::OnInteraction(v153);
7253 v100 = pSpriteObjects[uLayingItemID].field_61;
7254 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
7255 v102 = 8 * v153;
7256 LOBYTE(v102) = PID(OBJECT_Item,v153);
7257 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
7258 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
7259 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
7260 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
7261 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
7262 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
7263 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
7264 v47 = 0;
7265 else
7266 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
7267 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7268 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
7269 return 0;
7270 }
7271 }
7198 v46 = v146; 7272 v46 = v146;
7199 LABEL_196: 7273 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
7200 v2->uObjectDescID = v46;
7201 if ( v46 == (short)v32 ) 7274 if ( v46 == (short)v32 )
7202 SpriteObject::OnInteraction(v153); 7275 SpriteObject::OnInteraction(v153);
7203 v100 = v2->field_61; 7276 v100 = pSpriteObjects[uLayingItemID].field_61;
7204 v101 = v2->vPosition.z; 7277 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
7205 v2->uSpriteFrameID = v32;
7206 v102 = 8 * v153; 7278 v102 = 8 * v153;
7207 v103 = v2->vPosition.y;
7208 LOBYTE(v102) = PID(OBJECT_Item,v153); 7279 LOBYTE(v102) = PID(OBJECT_Item,v153);
7209 v2->vVelocity.x = v32; 7280 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
7210 v2->vVelocity.y = v32; 7281 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
7211 v104 = v2->vPosition.x; 7282 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
7212 v2->vVelocity.z = v32; 7283 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
7213 v149 = v102;
7214 stru_50FE08.Add(v102, 512, v104, v103, v101, v100, v32);
7215 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) 7284 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
7216 trail_particle_generator.GenerateTrailParticles( 7285 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
7217 v2->vPosition.x, 7286 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
7218 v2->vPosition.y,
7219 v2->vPosition.z,
7220 v3->uParticleTrailColor);
7221 v105 = v2->uSoundID;
7222 if ( v105 == (short)v32 )
7223 v47 = 0; 7287 v47 = 0;
7224 else 7288 else
7225 v47 = (signed __int16)v105 + 4; 7289 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
7226 v133 = v32; 7290 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7227 v131 = v32; 7291 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
7228 v130 = v47; 7292 return 0;
7229 v129 = v32; 7293 }
7230 v128 = -1; 7294 v46 = 0;
7231 v127 = v32; 7295 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
7232 v126 = v149; 7296 if ( v46 == (short)v32 )
7233 goto LABEL_268; 7297 SpriteObject::OnInteraction(v153);
7234 } 7298 v100 = pSpriteObjects[uLayingItemID].field_61;
7235 goto LABEL_195; 7299 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
7300 v102 = 8 * v153;
7301 LOBYTE(v102) = PID(OBJECT_Item,v153);
7302 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
7303 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
7304 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
7305 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
7306 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
7307 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
7308 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
7309 v47 = 0;
7310 else
7311 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
7312 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7313 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
7314 return 0;
7236 } 7315 }
7237 return 1; 7316 return 1;
7238 } 7317 }
7239 LABEL_247: 7318 LABEL_247:
7240 if ( v151 == 6 || v151 == 5 || (v9 = 0, !v151) ) 7319 if ( v151 == 6 || v151 == 5 || (v9 = 0, !v151) )
7241 return 1; 7320 return 1;
7242 if ( v151 != 2 ) 7321 if ( v151 != 2 )
7243 { 7322 {
7244 sub_43A97E(v153, v145); 7323 sub_43A97E(v153, v145);
7245 v122 = pObjectList->uNumObjects; 7324 v122 = pObjectList->uNumObjects;
7246 ++v2->uType; 7325 ++pSpriteObjects[uLayingItemID].uType;
7247 v52 = 0; 7326 v52 = 0;
7248 if ( (signed int)v122 > 0 ) 7327 if ( (signed int)v122 > 0 )
7249 { 7328 {
7250 v123 = (char *)&pObjectList->pObjects->uObjectID; 7329 v123 = (char *)&pObjectList->pObjects->uObjectID;
7251 while ( v2->uType != *(short *)v123 ) 7330 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v123 )
7252 { 7331 {
7253 ++v52; 7332 ++v52;
7254 v123 += 56; 7333 v123 += 56;
7255 if ( v52 >= (signed int)v122 ) 7334 if ( v52 >= (signed int)v122 )
7256 goto LABEL_181; 7335 goto LABEL_181;
7257 } 7336 }
7258 LABEL_202:
7259 v95 = v52; 7337 v95 = v52;
7260 goto LABEL_182; 7338 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
7339 if ( v95 == (short)v9 )
7340 SpriteObject::OnInteraction(v153);
7341 v96 = pSpriteObjects[uLayingItemID].uSoundID;
7342 pSpriteObjects[uLayingItemID].vVelocity.z = v9;
7343 pSpriteObjects[uLayingItemID].vVelocity.y = v9;
7344 pSpriteObjects[uLayingItemID].vVelocity.x = v9;
7345 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9;
7346 if ( v96 == (short)v9 )
7347 v97 = 0;
7348 else
7349 v97 = (signed __int16)v96 + 4;
7350 v92 = v153;
7351 v124 = 8 * v92;
7352 LOBYTE(v124) = v124 | 2;
7353 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7354 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9);
7355 return 0;
7261 } 7356 }
7262 goto LABEL_181; 7357 goto LABEL_181;
7263 } 7358 }
7264 v117 = v6 + 1; 7359 v117 = pSpriteObjects[uLayingItemID].uType + 1;
7265 v118 = pObjectList->uNumObjects; 7360 v118 = pObjectList->uNumObjects;
7266 v119 = 0; 7361 v119 = 0;
7267 v44 = pObjectList->uNumObjects == 0; 7362 v44 = pObjectList->uNumObjects == 0;
7268 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 7363 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
7269 v2->uType = v117; 7364 pSpriteObjects[uLayingItemID].uType = v117;
7270 if ( v20 | v44 ) 7365 if ( v20 | v44 )
7271 { 7366 {
7272 LABEL_255:
7273 v121 = 0; 7367 v121 = 0;
7274 } 7368 }
7275 else 7369 else
7276 { 7370 {
7277 v120 = (char *)&pObjectList->pObjects->uObjectID; 7371 v120 = (char *)&pObjectList->pObjects->uObjectID;
7278 while ( v117 != *(short *)v120 ) 7372 while ( v117 != *(short *)v120 )
7279 { 7373 {
7280 ++v119; 7374 ++v119;
7281 v120 += 56; 7375 v120 += 56;
7282 if ( v119 >= (signed int)v118 ) 7376 if ( v119 >= (signed int)v118 )
7283 goto LABEL_255; 7377 {
7378 v121 = 0;
7379 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
7380 if ( !v121 )
7381 SpriteObject::OnInteraction(v153);
7382 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
7383 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
7384 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
7385 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
7386 v13 = 8 * v153;
7387 LOBYTE(v13) = PID(OBJECT_Item,v153);
7388 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9);
7389 return 0;
7390 }
7284 } 7391 }
7285 v121 = v119; 7392 v121 = v119;
7286 } 7393 }
7287 v2->uObjectDescID = v121; 7394 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
7288 if ( !v121 ) 7395 if ( !v121 )
7289 SpriteObject::OnInteraction(v153); 7396 SpriteObject::OnInteraction(v153);
7290 v2->vVelocity.z = 0; 7397 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
7291 v2->vVelocity.y = 0; 7398 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
7292 v2->vVelocity.x = 0; 7399 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
7293 v2->uSpriteFrameID = 0; 7400 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
7294 LABEL_27:
7295 v133 = v9;
7296 v131 = v9;
7297 v130 = v9;
7298 v13 = 8 * v153; 7401 v13 = 8 * v153;
7299 v129 = v9;
7300 v128 = -1;
7301 LOBYTE(v13) = PID(OBJECT_Item,v153); 7402 LOBYTE(v13) = PID(OBJECT_Item,v153);
7302 v127 = v9; 7403 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9);
7303 v126 = v13;
7304 LABEL_28:
7305 v125 = 8;
7306 LABEL_29:
7307 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7308 return 0; 7404 return 0;
7309 } 7405 }