comparison mm7_2.cpp @ 1416:b69805ffeb4b

mm7_2.cpp cleaning
author zipi
date Sun, 28 Jul 2013 16:34:52 +0100
parents ff495bf260d9
children 1dd0c79e1502
comparison
equal deleted inserted replaced
1415:ff495bf260d9 1416:b69805ffeb4b
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 );
1535 goto LABEL_35; 1540 goto LABEL_35;
1536 } 1541 }
1537 v14 = rand() % 3001 + 2000; 1542 v14 = rand() % 3001 + 2000;
1538 } 1543 }
1539 a1a.stru_24.uItemID = 199; 1544 a1a.stru_24.uItemID = 199;
1540 LABEL_19:
1541 v34 = v14; 1545 v34 = v14;
1542 goto LABEL_20; 1546 goto LABEL_20;
1543 } 1547 }
1544 v14 = rand() % 501 + 500; 1548 v14 = rand() % 501 + 500;
1545 } 1549 }
1546 a1a.stru_24.uItemID = 198; 1550 a1a.stru_24.uItemID = 198;
1547 goto LABEL_19; 1551 v34 = v14;
1552 goto LABEL_20;
1548 } 1553 }
1549 v14 = rand() % 101 + 100; 1554 v14 = rand() % 101 + 100;
1550 } 1555 }
1551 a1a.stru_24.uItemID = 197; 1556 a1a.stru_24.uItemID = 197;
1552 goto LABEL_19; 1557 v34 = v14;
1558 goto LABEL_20;
1553 } 1559 }
1554 result = a1a.stru_24.GenerateArtifact(); 1560 result = a1a.stru_24.GenerateArtifact();
1555 if ( !result ) 1561 if ( !result )
1556 return result; 1562 return result;
1557 v23 = 0; 1563 v23 = 0;
1732 0, 1738 0,
1733 &v26, 1739 &v26,
1734 &v27, 1740 &v27,
1735 0); 1741 0);
1736 v23 = 0; 1742 v23 = 0;
1737 if ( (signed int)pOutdoor->uNumBModels > 0 ) 1743 for( int i = 0; i < pOutdoor->uNumBModels; i++ )
1738 { 1744 {
1739 while ( 1 ) 1745 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[i].vBoundingCenter.y);
1740 { 1746 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[i].vBoundingCenter.x);
1741 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[v8].vBoundingCenter.y); 1747 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[i].sBoundingRadius + 256 )
1742 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[v8].vBoundingCenter.x); 1748 {
1743 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[v8].sBoundingRadius + 256 ) 1749 v22 = 1;
1744 break; 1750 break;
1745 ++v23; 1751 }
1746 ++v8; 1752 }
1747 if ( v23 >= (signed int)pOutdoor->uNumBModels )
1748 goto LABEL_16;
1749 }
1750 v22 = 1;
1751 }
1752 LABEL_16:
1753 v11 = uFaceID == 100; 1753 v11 = uFaceID == 100;
1754 if ( uFaceID >= 100 ) 1754 if ( uFaceID >= 100 )
1755 break; 1755 break;
1756 if ( v22 ) 1756 if ( v22 )
1757 { 1757 {
1795 while ( v26 < 100 ); 1795 while ( v26 < 100 );
1796 v11 = v26 == 100; 1796 v11 = v26 == 100;
1797 } 1797 }
1798 if ( v11 ) 1798 if ( v11 )
1799 { 1799 {
1800 LABEL_8:
1801 result = 0; 1800 result = 0;
1802 } 1801 }
1803 else 1802 else
1804 { 1803 {
1805 SpawnEncounter(a1, &v19, 0, 0, 1); 1804 SpawnEncounter(a1, &v19, 0, 0, 1);
2945 if ( a1 < 67 ) 2944 if ( a1 < 67 )
2946 { 2945 {
2947 if ( a1 < 78 ) 2946 if ( a1 < 78 )
2948 { 2947 {
2949 if ( a1 < 89 ) 2948 if ( a1 < 89 )
2950 goto LABEL_31; 2949 {
2951 goto LABEL_28; 2950 v4 = 0;
2951 v1 = 0;
2952 v2 = 0;
2953 return TargetColor(v2, v1, v4);
2954 }
2952 } 2955 }
2956 else
2957 {
2953 LABEL_25: 2958 LABEL_25:
2954 if ( a1 < 89 ) 2959 if ( a1 < 89 )
2955 { 2960 {
2956 v4 = 155; 2961 v4 = 155;
2957 v2 = 255; 2962 v2 = 255;
2958 goto LABEL_30; 2963 v1 = v2;
2959 } 2964 return TargetColor(v2, v1, v4);
2960 LABEL_28: 2965 }
2966 }
2961 if ( a1 < 100 ) 2967 if ( a1 < 100 )
2962 { 2968 {
2963 v4 = 240; 2969 v4 = 240;
2964 v2 = 192; 2970 v2 = 192;
2965 goto LABEL_30; 2971 v1 = v2;
2972 return TargetColor(v2, v1, v4);
2966 } 2973 }
2967 LABEL_31:
2968 v4 = 0; 2974 v4 = 0;
2969 v1 = 0; 2975 v1 = 0;
2970 goto LABEL_32; 2976 v2 = 0;
2977 return TargetColor(v2, v1, v4);
2971 } 2978 }
2972 LABEL_21: 2979 LABEL_21:
2973 if ( a1 < 78 ) 2980 if ( a1 < 78 )
2974 { 2981 {
2975 v4 = 0; 2982 v4 = 0;
2976 v1 = 128; 2983 v1 = 128;
2977 goto LABEL_23; 2984 v2 = 255;
2985 return TargetColor(v2, v1, v4);
2978 } 2986 }
2979 goto LABEL_25; 2987 goto LABEL_25;
2980 } 2988 }
2981 LABEL_18: 2989 LABEL_18:
2982 if ( a1 < 67 ) 2990 if ( a1 < 67 )
2990 } 2998 }
2991 LABEL_15: 2999 LABEL_15:
2992 if ( a1 < 56 ) 3000 if ( a1 < 56 )
2993 { 3001 {
2994 v2 = 225; 3002 v2 = 225;
2995 goto LABEL_13; 3003 v4 = v2;
3004 v1 = v2;
3005 return TargetColor(v2, v1, v4);
2996 } 3006 }
2997 goto LABEL_18; 3007 goto LABEL_18;
2998 } 3008 }
2999 LABEL_11: 3009 LABEL_11:
3000 if ( a1 < 45 ) 3010 if ( a1 < 45 )
3001 { 3011 {
3002 v2 = 128; 3012 v2 = 128;
3003 LABEL_13:
3004 v4 = v2; 3013 v4 = v2;
3005 LABEL_30:
3006 v1 = v2; 3014 v1 = v2;
3007 return TargetColor(v2, v1, v4); 3015 return TargetColor(v2, v1, v4);
3008 } 3016 }
3009 goto LABEL_15; 3017 goto LABEL_15;
3010 } 3018 }
3011 LABEL_8: 3019 LABEL_8:
3012 if ( a1 < 34 ) 3020 if ( a1 < 34 )
3013 { 3021 {
3014 v4 = 255; 3022 v4 = 255;
3015 v1 = 128; 3023 v1 = 128;
3016 LABEL_32:
3017 v2 = 0; 3024 v2 = 0;
3018 return TargetColor(v2, v1, v4); 3025 return TargetColor(v2, v1, v4);
3019 } 3026 }
3020 goto LABEL_11; 3027 goto LABEL_11;
3021 } 3028 }
3024 { 3031 {
3025 if ( a1 < 12 ) 3032 if ( a1 < 12 )
3026 { 3033 {
3027 v4 = 0; 3034 v4 = 0;
3028 v1 = 85; 3035 v1 = 85;
3029 LABEL_23:
3030 v2 = 255; 3036 v2 = 255;
3031 return TargetColor(v2, v1, v4); 3037 return TargetColor(v2, v1, v4);
3032 } 3038 }
3033 } 3039 }
3034 if ( a1 >= 23 ) 3040 if ( a1 >= 23 )
3115 } 3121 }
3116 else 3122 else
3117 { 3123 {
3118 if ( v4 != 1 ) 3124 if ( v4 != 1 )
3119 { 3125 {
3120 if ( v4 != 0 || pActor->sNPC_ID ) 3126 if ( v4 == 0 && pActor->sNPC_ID == 0 )
3121 continue; 3127 pActor->sNPC_ID = 0;
3122 goto LABEL_12; 3128 continue;
3123 } 3129 }
3124 } 3130 }
3125 if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 ) 3131 if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 )
3126 continue; 3132 continue;
3127 if ( v17 ) 3133 if ( v17 )
3130 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; 3136 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000;
3131 ++pNPCStats->uNewlNPCBufPos; 3137 ++pNPCStats->uNewlNPCBufPos;
3132 pActor->sNPC_ID = v14; 3138 pActor->sNPC_ID = v14;
3133 continue; 3139 continue;
3134 } 3140 }
3135 LABEL_12:
3136 pActor->sNPC_ID = 0; 3141 pActor->sNPC_ID = 0;
3137 //LABEL_13:
3138 //++v15; 3142 //++v15;
3139 //v2 += 836; 3143 //v2 += 836;
3140 //} 3144 //}
3141 //while ( v15 < (signed int)uNumActors ); 3145 //while ( v15 < (signed int)uNumActors );
3142 } 3146 }
4030 pArcomageGame->field_F9 = 1; 4034 pArcomageGame->field_F9 = 1;
4031 } 4035 }
4032 else 4036 else
4033 { 4037 {
4034 if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() ) 4038 if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() )
4035 //goto LABEL_20;
4036 { 4039 {
4037 EndPaint(hWnd, &Paint); 4040 EndPaint(hWnd, &Paint);
4038 return 0; 4041 return 0;
4039 } 4042 }
4040 } 4043 }
4041 pRenderer->Present(); 4044 pRenderer->Present();
4042 //LABEL_20:
4043 EndPaint(hWnd, &Paint); 4045 EndPaint(hWnd, &Paint);
4044 return 0; 4046 return 0;
4045 } 4047 }
4046 //goto _def_wnd_proc; 4048 //goto _def_wnd_proc;
4047 return DefWindowProcA(hWnd, Msg, wParam, lParam); 4049 return DefWindowProcA(hWnd, Msg, wParam, lParam);
4322 v4 = RegCloseKey; 4324 v4 = RegCloseKey;
4323 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) 4325 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey)
4324 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) 4326 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition)
4325 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition) 4327 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition)
4326 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) ) 4328 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) )
4327 goto LABEL_7; 4329 {
4328 if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) 4330 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
4331 }
4332 else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) )
4329 { 4333 {
4330 RegCloseKey(v14); 4334 RegCloseKey(v14);
4331 v14 = 0; 4335 v14 = 0;
4332 LABEL_7:
4333 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); 4336 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen);
4334 goto LABEL_8; 4337 }
4335 } 4338 else
4336 v4 = RegCloseKey; 4339 {
4337 RegCloseKey(v14); 4340 v4 = RegCloseKey;
4338 v14 = 0; 4341 RegCloseKey(v14);
4339 RegCloseKey(v13); 4342 v14 = 0;
4340 v13 = 0; 4343 RegCloseKey(v13);
4341 RegCloseKey(phkResult); 4344 v13 = 0;
4342 phkResult = 0; 4345 RegCloseKey(phkResult);
4343 result = RegCloseKey(hKey); 4346 phkResult = 0;
4344 hKey = 0; 4347 result = RegCloseKey(hKey);
4345 LABEL_8: 4348 hKey = 0;
4349 }
4346 if ( v14 ) 4350 if ( v14 )
4347 result = v4(v14); 4351 result = v4(v14);
4348 if ( v13 ) 4352 if ( v13 )
4349 result = v4(v13); 4353 result = v4(v13);
4350 if ( hKey ) 4354 if ( hKey )
4501 if ( a2 == 273 ) 4505 if ( a2 == 273 )
4502 { 4506 {
4503 if ( a3 == 2 ) 4507 if ( a3 == 2 )
4504 { 4508 {
4505 v12 = 0; 4509 v12 = 0;
4506 LABEL_9:
4507 EndDialog(hDlg, v12); 4510 EndDialog(hDlg, v12);
4508 return 1; 4511 return 1;
4509 } 4512 }
4510 v4 = a3 == 1; 4513 v4 = a3 == 1;
4511 } 4514 }
4514 v4 = a2 == 1025; 4517 v4 = a2 == 1025;
4515 } 4518 }
4516 if ( v4 ) 4519 if ( v4 )
4517 { 4520 {
4518 v12 = 1; 4521 v12 = 1;
4519 goto LABEL_9; 4522 EndDialog(hDlg, v12);
4523 return 1;
4520 } 4524 }
4521 return 0; 4525 return 0;
4522 } 4526 }
4523 4527
4524 //----- (00465061) -------------------------------------------------------- 4528 //----- (00465061) --------------------------------------------------------
5422 Log::Warning(L"MM: entering main loop"); 5426 Log::Warning(L"MM: entering main loop");
5423 while ( 1 ) 5427 while ( 1 )
5424 { 5428 {
5425 MainMenu_Loop(); 5429 MainMenu_Loop();
5426 uGameState = GAME_STATE_PLAYING; 5430 uGameState = GAME_STATE_PLAYING;
5427 //LABEL_21:
5428 while ( 1 ) 5431 while ( 1 )
5429 { 5432 {
5430 if (uGameState == GAME_FINISHED || 5433 if (uGameState == GAME_FINISHED ||
5431 GetCurrentMenuID() == MENU_EXIT_GAME) 5434 GetCurrentMenuID() == MENU_EXIT_GAME)
5432 { 5435 {
5478 break; 5481 break;
5479 } 5482 }
5480 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) 5483 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
5481 { 5484 {
5482 uGameState = GAME_STATE_PLAYING; 5485 uGameState = GAME_STATE_PLAYING;
5486 pGame->Loop();
5483 } 5487 }
5484 else 5488 else
5485 { 5489 {
5486 if (GetCurrentMenuID() != MENU_10) 5490 if (GetCurrentMenuID() == MENU_10)
5487 goto LABEL_49; 5491 {
5488 pMouse->Activate(0); 5492 pMouse->Activate(0);
5489 5493
5490 pParty->Reset(); 5494 pParty->Reset();
5491 pParty->CreateDefaultParty(1); 5495 pParty->CreateDefaultParty(1);
5492 crt_init_globals_46271C(); 5496 crt_init_globals_46271C();
5493 extern OPENFILENAMEA ofn; 5497 extern OPENFILENAMEA ofn;
5494 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) 5498 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
5495 { 5499 {
5496 pMouse->Activate(1); 5500 pMouse->Activate(1);
5497 5501 break;
5498 break; 5502 }
5499 } 5503 _chdir("..\\");
5500 _chdir("..\\"); 5504 strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle);
5501 strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); 5505 pMouse->Activate(1);
5502 pMouse->Activate(1); 5506 pGame->Loop();
5503 } 5507 }
5504 //LABEL_48: 5508 }
5505 pGame->Loop();
5506 LABEL_49:
5507 if ( uGameState == GAME_STATE_LOADING_GAME ) 5509 if ( uGameState == GAME_STATE_LOADING_GAME )
5508 { 5510 {
5509 SetCurrentMenuID(MENU_5); 5511 SetCurrentMenuID(MENU_5);
5510 uGameState = GAME_STATE_PLAYING; 5512 uGameState = GAME_STATE_PLAYING;
5511 continue; 5513 continue;
6089 return 0; 6091 return 0;
6090 v5 = 640 * v3; 6092 v5 = 640 * v3;
6091 v29 = 640 * v3; 6093 v29 = 640 * v3;
6092 while ( 2 ) 6094 while ( 2 )
6093 { 6095 {
6094 v31 = 100; 6096 v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2]-1;
6095 v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2];
6096 v7 = v0; 6097 v7 = v0;
6097 while ( 1 ) 6098 //while ( 1 )
6098 { 6099 for( int i = 0; i < 100; i++)
6100 {
6101 ++v6;
6099 v8 = *v6; 6102 v8 = *v6;
6100 --v31;
6101 if ( (unsigned int)*v6 <= 0x2000000 ) 6103 if ( (unsigned int)*v6 <= 0x2000000 )
6102 { 6104 {
6103 v9 = 0; 6105 v9 = 0;
6104 if ( v7 > 0 ) 6106 if ( v7 > 0 )
6105 { 6107 {
6128 goto LABEL_18; 6130 goto LABEL_18;
6129 } 6131 }
6130 } 6132 }
6131 } 6133 }
6132 } 6134 }
6133 if ( !v31 ) 6135 }
6134 break;
6135 ++v6;
6136 }
6137 v4 = -1; 6136 v4 = -1;
6138 ++v30; 6137 ++v30;
6139 v5 = v29 + 640; 6138 v5 = v29 + 640;
6140 v29 += 640; 6139 v29 += 640;
6141 if ( v30 < v28 ) 6140 if ( v30 >= v28 )
6142 continue; 6141 break;
6143 break;
6144 } 6142 }
6145 v12 = 0; 6143 v12 = 0;
6146 v10 = v0 == 0; 6144 v10 = v0 == 0;
6147 v11 = v0 < 0; 6145 v11 = v0 < 0;
6148 if ( !v0 ) 6146 if ( !v0 )
6181 if ( v20 >= 0x3E8 ) 6179 if ( v20 >= 0x3E8 )
6182 return 0; 6180 return 0;
6183 if ( !(pSpriteObjects[v20].uAttributes & 0x10) ) 6181 if ( !(pSpriteObjects[v20].uAttributes & 0x10) )
6184 { 6182 {
6185 v23 = pSpriteObjects[v20].stru_24.GetDisplayName(); 6183 v23 = pSpriteObjects[v20].stru_24.GetDisplayName();
6186 LABEL_36:
6187 v24 = v23; 6184 v24 = v23;
6188 goto LABEL_51; 6185 GameUI_SetFooterString(v24);
6189 } 6186 return v19;
6190 goto LABEL_41; 6187 }
6191 } 6188 }
6192 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) 6189 else
6193 { 6190 {
6194 if ( v20 >= 0xBB8 ) 6191 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor)
6195 return 0; 6192 {
6196 v24 = (const char *)&pActors[v20]; 6193 if ( v20 >= 0xBB8 )
6197 goto LABEL_51; 6194 return 0;
6198 } 6195 v24 = (const char *)&pActors[v20];
6199 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) 6196 GameUI_SetFooterString(v24);
6200 break; 6197 return v19;
6201 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) 6198 }
6202 { 6199 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration)
6203 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 6200 break;
6204 { 6201 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel)
6205 v21 = &pIndoor->pFaces[v20]; 6202 {
6206 if ( !(BYTE3(v21->uAttributes) & 2) ) 6203 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
6207 goto LABEL_41; 6204 {
6208 v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID; 6205 v21 = &pIndoor->pFaces[v20];
6209 } 6206 if ( BYTE3(v21->uAttributes) & 2 )
6210 else 6207 v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID;
6211 { 6208 }
6212 if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 >= pOutdoor->uNumBModels ) 6209 else
6213 goto LABEL_41; 6210 {
6214 v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; 6211 if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 < pOutdoor->uNumBModels )
6215 } 6212 {
6216 if ( v22 ) 6213 v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID;
6217 { 6214 if ( v22 )
6218 v23 = GetEventHintString(v22); 6215 {
6219 if ( v23 ) 6216 v23 = GetEventHintString(v22);
6220 goto LABEL_36; 6217 if ( v23 )
6221 } 6218 {
6222 } 6219 v24 = v23;
6223 LABEL_41: 6220 GameUI_SetFooterString(v24);
6224 ++v18; 6221 return v19;
6222 }
6223 }
6224 }
6225 }
6226 }
6227 }
6228 ++v18;
6225 if ( v18 >= v0 ) 6229 if ( v18 >= v0 )
6226 return 0; 6230 return 0;
6227 } 6231 }
6228 v25 = &pLevelDecorations[v20]; 6232 v25 = &pLevelDecorations[v20];
6229 v26 = v25; 6233 v26 = v25;
6231 if ( v27 ) 6235 if ( v27 )
6232 { 6236 {
6233 v23 = GetEventHintString(v27); 6237 v23 = GetEventHintString(v27);
6234 if ( !v23 ) 6238 if ( !v23 )
6235 return v19; 6239 return v19;
6236 goto LABEL_36; 6240 v24 = v23;
6241 GameUI_SetFooterString(v24);
6242 return v19;
6237 } 6243 }
6238 if ( v25->IsInteractive() ) 6244 if ( v25->IsInteractive() )
6239 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; 6245 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
6240 else 6246 else
6241 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; 6247 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20;
6242 LABEL_51:
6243 GameUI_SetFooterString(v24); 6248 GameUI_SetFooterString(v24);
6244 return v19; 6249 return v19;
6245 } 6250 }
6246 6251
6247 //----- (0046BDA8) -------------------------------------------------------- 6252 //----- (0046BDA8) --------------------------------------------------------
6513 } 6518 }
6514 v138 = 1; 6519 v138 = 1;
6515 if ( v151 != OBJECT_Actor) 6520 if ( v151 != OBJECT_Actor)
6516 { 6521 {
6517 if ( v6 != 9030 || v2->spell_skill != 4 ) 6522 if ( v6 != 9030 || v2->spell_skill != 4 )
6518 goto LABEL_246; 6523 {
6519 v2->_46BEF1_apply_spells_aoe(); 6524 SpriteObject::OnInteraction(v153);
6525 return 0;
6526 }
6527 v2->_46BEF1_apply_spells_aoe();
6520 LABEL_233: 6528 LABEL_233:
6521 if ( !v138 ) 6529 if ( !v138 )
6522 { 6530 {
6523 v109 = pObjectList->uNumObjects; 6531 v109 = pObjectList->uNumObjects;
6524 ++v2->uType; 6532 ++v2->uType;
6560 v128 = -1; 6568 v128 = -1;
6561 LOBYTE(v115) = PID(OBJECT_Item,v153); 6569 LOBYTE(v115) = PID(OBJECT_Item,v153);
6562 v127 = 0; 6570 v127 = 0;
6563 v126 = v115; 6571 v126 = v115;
6564 v116 = v143; 6572 v116 = v143;
6565 goto LABEL_269; 6573 v125 = v116 + 1;
6574 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
6575 return 0;
6566 } 6576 }
6567 LABEL_246:
6568 SpriteObject::OnInteraction(v153); 6577 SpriteObject::OnInteraction(v153);
6569 return 0; 6578 return 0;
6570 } 6579 }
6571 v106 = v145; 6580 v106 = v145;
6572 v150 = 0; 6581 v150 = 0;
6657 ++v52; 6666 ++v52;
6658 v94 += 56; 6667 v94 += 56;
6659 if ( v52 >= (signed int)v93 ) 6668 if ( v52 >= (signed int)v93 )
6660 goto LABEL_181; 6669 goto LABEL_181;
6661 } 6670 }
6662 goto LABEL_202; 6671 v95 = v52;
6672 v2->uObjectDescID = v95;
6673 if ( v95 == (short)v9 )
6674 SpriteObject::OnInteraction(v153);
6675 v96 = v2->uSoundID;
6676 v2->vVelocity.z = v9;
6677 v2->vVelocity.y = v9;
6678 v2->vVelocity.x = v9;
6679 v2->uSpriteFrameID = v9;
6680 if ( v96 == (short)v9 )
6681 v97 = 0;
6682 else
6683 v97 = (signed __int16)v96 + 4;
6684 v133 = v9;
6685 v131 = v9;
6686 v130 = v97;
6687 v92 = v153;
6688 goto LABEL_267;
6663 } 6689 }
6664 goto LABEL_181; 6690 goto LABEL_181;
6665 } 6691 }
6666 v79 = v7 == 8030; 6692 v79 = v7 == 8030;
6667 } 6693 }
6734 v129 = v9; 6760 v129 = v9;
6735 v128 = -1; 6761 v128 = -1;
6736 LOBYTE(v124) = v124 | 2; 6762 LOBYTE(v124) = v124 | 2;
6737 v127 = v9; 6763 v127 = v9;
6738 v126 = v124; 6764 v126 = v124;
6739 LABEL_268:
6740 v116 = word_4EE088_sound_ids[v2->spell_id - 1]; 6765 v116 = word_4EE088_sound_ids[v2->spell_id - 1];
6741 LABEL_269:
6742 v125 = v116 + 1; 6766 v125 = v116 + 1;
6743 goto LABEL_29; 6767 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
6768 return 0;
6744 } 6769 }
6745 v59 = v6 + 2; 6770 v59 = v6 + 2;
6746 v60 = pObjectList->uNumObjects; 6771 v60 = pObjectList->uNumObjects;
6747 v9 = 0; 6772 v9 = 0;
6748 v61 = 0; 6773 v61 = 0;
6845 v130 = v78; 6870 v130 = v78;
6846 v129 = v66; 6871 v129 = v66;
6847 v128 = -1; 6872 v128 = -1;
6848 v127 = v66; 6873 v127 = v66;
6849 v126 = v75; 6874 v126 = v75;
6850 goto LABEL_268; 6875 v116 = word_4EE088_sound_ids[v2->spell_id - 1];
6876 v125 = v116 + 1;
6877 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
6878 return 0;
6851 } 6879 }
6852 if ( v7 == 4090 ) 6880 if ( v7 == 4090 )
6853 { 6881 {
6854 v84 = v6 + 2; 6882 v84 = v6 + 2;
6855 v85 = pObjectList->uNumObjects; 6883 v85 = pObjectList->uNumObjects;
7051 v2->vVelocity.z = 0; 7079 v2->vVelocity.z = 0;
7052 v2->vVelocity.y = 0; 7080 v2->vVelocity.y = 0;
7053 v2->vVelocity.x = 0; 7081 v2->vVelocity.x = 0;
7054 v2->uSpriteFrameID = 0; 7082 v2->uSpriteFrameID = 0;
7055 if ( !v44 ) 7083 if ( !v44 )
7056 goto LABEL_27; 7084 {
7085 v133 = v9;
7086 v131 = v9;
7087 v130 = v9;
7088 v13 = 8 * v153;
7089 v129 = v9;
7090 v128 = -1;
7091 LOBYTE(v13) = PID(OBJECT_Item,v153);
7092 v127 = v9;
7093 v126 = v13;
7094 v125 = 8;
7095 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7096 return 0;
7097 }
7057 } 7098 }
7058 return 0; 7099 return 0;
7059 } 7100 }
7060 if ( v7 > 1100 ) 7101 if ( v7 > 1100 )
7061 { 7102 {
7088 ++v52; 7129 ++v52;
7089 v53 += 56; 7130 v53 += 56;
7090 if ( v52 >= (signed int)v51 ) 7131 if ( v52 >= (signed int)v51 )
7091 goto LABEL_181; 7132 goto LABEL_181;
7092 } 7133 }
7093 goto LABEL_202; 7134 v95 = v52;
7094 } 7135 }
7136 else
7137 {
7095 LABEL_181: 7138 LABEL_181:
7096 v95 = 0; 7139 v95 = 0;
7097 LABEL_182: 7140 }
7098 v2->uObjectDescID = v95; 7141 v2->uObjectDescID = v95;
7099 if ( v95 == (short)v9 ) 7142 if ( v95 == (short)v9 )
7100 SpriteObject::OnInteraction(v153); 7143 SpriteObject::OnInteraction(v153);
7101 v96 = v2->uSoundID; 7144 v96 = v2->uSoundID;
7102 v2->vVelocity.z = v9; 7145 v2->vVelocity.z = v9;
7161 v130 = 0; 7204 v130 = 0;
7162 v129 = 0; 7205 v129 = 0;
7163 v128 = -1; 7206 v128 = -1;
7164 v127 = 0; 7207 v127 = 0;
7165 v126 = v147; 7208 v126 = v147;
7166 goto LABEL_28; 7209 v125 = 8;
7210 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7211 return 0;
7167 } 7212 }
7168 v27 = v26 - 410; 7213 v27 = v26 - 410;
7169 if ( !v27 ) 7214 if ( !v27 )
7170 goto LABEL_93; 7215 goto LABEL_93;
7171 v28 = v27 - 40; 7216 v28 = v27 - 40;
7228 v130 = v47; 7273 v130 = v47;
7229 v129 = v32; 7274 v129 = v32;
7230 v128 = -1; 7275 v128 = -1;
7231 v127 = v32; 7276 v127 = v32;
7232 v126 = v149; 7277 v126 = v149;
7233 goto LABEL_268; 7278 v116 = word_4EE088_sound_ids[v2->spell_id - 1];
7279 v125 = v116 + 1;
7280 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7281 return 0;
7234 } 7282 }
7235 goto LABEL_195; 7283 goto LABEL_195;
7236 } 7284 }
7237 return 1; 7285 return 1;
7238 } 7286 }
7253 ++v52; 7301 ++v52;
7254 v123 += 56; 7302 v123 += 56;
7255 if ( v52 >= (signed int)v122 ) 7303 if ( v52 >= (signed int)v122 )
7256 goto LABEL_181; 7304 goto LABEL_181;
7257 } 7305 }
7258 LABEL_202:
7259 v95 = v52; 7306 v95 = v52;
7260 goto LABEL_182; 7307 v2->uObjectDescID = v95;
7308 if ( v95 == (short)v9 )
7309 SpriteObject::OnInteraction(v153);
7310 v96 = v2->uSoundID;
7311 v2->vVelocity.z = v9;
7312 v2->vVelocity.y = v9;
7313 v2->vVelocity.x = v9;
7314 v2->uSpriteFrameID = v9;
7315 if ( v96 == (short)v9 )
7316 v97 = 0;
7317 else
7318 v97 = (signed __int16)v96 + 4;
7319 v133 = v9;
7320 v131 = v9;
7321 v130 = v97;
7322 v92 = v153;
7323 goto LABEL_267;
7261 } 7324 }
7262 goto LABEL_181; 7325 goto LABEL_181;
7263 } 7326 }
7264 v117 = v6 + 1; 7327 v117 = v6 + 1;
7265 v118 = pObjectList->uNumObjects; 7328 v118 = pObjectList->uNumObjects;
7267 v44 = pObjectList->uNumObjects == 0; 7330 v44 = pObjectList->uNumObjects == 0;
7268 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; 7331 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
7269 v2->uType = v117; 7332 v2->uType = v117;
7270 if ( v20 | v44 ) 7333 if ( v20 | v44 )
7271 { 7334 {
7272 LABEL_255:
7273 v121 = 0; 7335 v121 = 0;
7274 } 7336 }
7275 else 7337 else
7276 { 7338 {
7277 v120 = (char *)&pObjectList->pObjects->uObjectID; 7339 v120 = (char *)&pObjectList->pObjects->uObjectID;
7278 while ( v117 != *(short *)v120 ) 7340 while ( v117 != *(short *)v120 )
7279 { 7341 {
7280 ++v119; 7342 ++v119;
7281 v120 += 56; 7343 v120 += 56;
7282 if ( v119 >= (signed int)v118 ) 7344 if ( v119 >= (signed int)v118 )
7283 goto LABEL_255; 7345 {
7346 v121 = 0;
7347 v2->uObjectDescID = v121;
7348 if ( !v121 )
7349 SpriteObject::OnInteraction(v153);
7350 v2->vVelocity.z = 0;
7351 v2->vVelocity.y = 0;
7352 v2->vVelocity.x = 0;
7353 v2->uSpriteFrameID = 0;
7354 v133 = v9;
7355 v131 = v9;
7356 v130 = v9;
7357 v13 = 8 * v153;
7358 v129 = v9;
7359 v128 = -1;
7360 LOBYTE(v13) = PID(OBJECT_Item,v153);
7361 v127 = v9;
7362 v126 = v13;
7363 v125 = 8;
7364 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7365 return 0;
7366 }
7284 } 7367 }
7285 v121 = v119; 7368 v121 = v119;
7286 } 7369 }
7287 v2->uObjectDescID = v121; 7370 v2->uObjectDescID = v121;
7288 if ( !v121 ) 7371 if ( !v121 )
7289 SpriteObject::OnInteraction(v153); 7372 SpriteObject::OnInteraction(v153);
7290 v2->vVelocity.z = 0; 7373 v2->vVelocity.z = 0;
7291 v2->vVelocity.y = 0; 7374 v2->vVelocity.y = 0;
7292 v2->vVelocity.x = 0; 7375 v2->vVelocity.x = 0;
7293 v2->uSpriteFrameID = 0; 7376 v2->uSpriteFrameID = 0;
7294 LABEL_27:
7295 v133 = v9; 7377 v133 = v9;
7296 v131 = v9; 7378 v131 = v9;
7297 v130 = v9; 7379 v130 = v9;
7298 v13 = 8 * v153; 7380 v13 = 8 * v153;
7299 v129 = v9; 7381 v129 = v9;
7300 v128 = -1; 7382 v128 = -1;
7301 LOBYTE(v13) = PID(OBJECT_Item,v153); 7383 LOBYTE(v13) = PID(OBJECT_Item,v153);
7302 v127 = v9; 7384 v127 = v9;
7303 v126 = v13; 7385 v126 = v13;
7304 LABEL_28:
7305 v125 = 8; 7386 v125 = 8;
7306 LABEL_29:
7307 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); 7387 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
7308 return 0; 7388 return 0;
7309 } 7389 }