comparison mm7_2.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents c423f946dc99
children 8c2f689b5f0b
comparison
equal deleted inserted replaced
1296:c423f946dc99 1297:5450af4f57ef
457 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); 457 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
458 } 458 }
459 } 459 }
460 // F8B1B4: using guessed type int dword_F8B1B4; 460 // F8B1B4: using guessed type int dword_F8B1B4;
461 461
462 //----- (004BBF61) --------------------------------------------------------
463 void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z)
464 {
465 size_t v4; // esi@1
466 int monster_id; // edi@1
467 __int16 v6; // ax@4
468 Actor *v7; // esi@5
469 int v8; // eax@5
470 MonsterInfo *v9; // edi@5
471 MonsterDesc *v10; // ebx@5
472 unsigned __int16 *v11; // ebx@5
473 int v12; // ebx@7
474 int v13; // eax@8
475 __int16 x_; // [sp+8h] [bp-Ch]@1
476 __int16 v15; // [sp+Ch] [bp-8h]@1
477 __int16 v16; // [sp+10h] [bp-4h]@3
478 signed int ya; // [sp+1Ch] [bp+8h]@5
479
480 v4 = uNumActors;
481 monster_id = a1;
482 x_ = x;
483 v15 = a1;
484 if ( (signed int)uNumActors < 500
485 && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 )
486 {
487 v16 = 0;
488 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
489 {
490 v6 = pIndoor->GetSector(x, y, z);
491 v4 = uNumActors;
492 v16 = v6;
493 }
494 v7 = &pActors[v4];
495 v7->Reset();
496 v8 = monster_id;
497 v9 = &pMonsterStats->pInfos[monster_id];
498 v10 = &pMonsterList->pMonsters[v8 - 1];
499 strcpy(v7->pActorName, v9->pName);
500 v7->sCurrentHP = LOWORD(v9->uHP);
501 memcpy(&v7->pMonsterInfo, v9, 0x58u);
502 v7->word_000086_some_monster_id = v15;
503 v7->uActorRadius = v10->uMonsterRadius;
504 v7->uActorHeight = v10->uMonsterHeight;
505 v7->uMovementSpeed = v10->uMovementSpeed;
506 v7->vInitialPosition.x = x_;
507 v7->vPosition.x = x_;
508 BYTE2(v7->uAttributes) |= 8u;
509 v7->pMonsterInfo.uTreasureType = 0;
510 v7->pMonsterInfo.uTreasureLevel = 0;
511 v7->pMonsterInfo.uTreasureDiceSides = 0;
512 v7->pMonsterInfo.uTreasureDiceRolls = 0;
513 v7->pMonsterInfo.uTreasureDropChance = 0;
514 v7->vInitialPosition.y = y;
515 v7->vPosition.y = y;
516 v7->vInitialPosition.z = z;
517 v7->vPosition.z = z;
518 v7->uTetherDistance = 256;
519 v7->uSectorID = v16;
520 v7->uGroup = 1;
521 v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
522 v7->PrepareSprites(0);
523 v11 = v10->pSoundSampleIDs;
524 ya = 4;
525 do
526 {
527 pSoundList->LoadSound((signed __int16)*v11, 0);
528 ++v11;
529 --ya;
530 }
531 while ( ya );
532 v12 = 0;
533 do
534 LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u);
535 while ( v13 );
536 ++uNumActors;
537 }
538 }
539 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; 462 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
540 463
541 //----- (004BC109) -------------------------------------------------------- 464 //----- (004BC109) --------------------------------------------------------
542 void __cdecl ArenaFight() 465 void __cdecl ArenaFight()
543 { 466 {
747 _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1); 670 _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1);
748 } 671 }
749 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); 672 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0);
750 } 673 }
751 674
752 //----- (004BC8D5) --------------------------------------------------------
753 void SpellBookGenerator()//for GuildDialogs
754 {
755 int pItemNum; // esi@1
756 int v4; // esi@7
757
758 for( int i = 0; i < 12; ++i )
759 {
760 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 )
761 {
762 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 )
763 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345;
764 else
765 {
766 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 )
767 v4 = rand() % 4;
768 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 )
769 v4 = rand() % 3 + 4;
770 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 )
771 v4 = rand() % 2 + 7;
772 if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 )
773 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400;
774 }
775 }
776 if ( pItemNum == 487 )
777 {
778 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
779 pItemNum = 486;
780 }
781 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i];
782 item_spellbook->Reset();
783 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
784 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified();
785 ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE);
786 }
787 return;
788 }
789
790 //----- (004BCA33) --------------------------------------------------------
791 void UI_CreateEndConversationButton()
792 {
793 pDialogueWindow->Release();
794 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
795 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
796 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
797 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
798 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
799 }
800
801 //----- (004BD8B5) -------------------------------------------------------- 675 //----- (004BD8B5) --------------------------------------------------------
802 signed int __cdecl sub_4BD8B5() 676 signed int __cdecl sub_4BD8B5()
803 { 677 {
804 int v0; // eax@4 678 int v0; // eax@4
805 int v1; // eax@29 679 int v1; // eax@29
892 pVideoPlayer->_4BF5B2(); 766 pVideoPlayer->_4BF5B2();
893 return 1; 767 return 1;
894 } 768 }
895 } 769 }
896 return 0; 770 return 0;
897 }
898
899 //----- (004BDB56) --------------------------------------------------------
900 void __cdecl UIShop_Buy_Identify_Repair()
901 {
902 int v8; // eax@15
903 unsigned int pItemID; // esi@20
904 ItemGen *item; // esi@21
905 unsigned int v15; // eax@33
906 POINT *pCursorPos; // esi@37
907 int v18; // ecx@37
908 float pPriceMultiplier; // ST1C_4@38
909 int taken_item; // eax@40
910 ItemGen *bought_item; // esi@51
911 int party_reputation; // eax@55
912 int v39; // eax@63
913 int v42; // esi@74
914 signed int v43; // ebx@74
915 unsigned __int16 *pSkill; // esi@77
916 int v55; // [sp+0h] [bp-B4h]@26
917 POINT cursor; // [sp+40h] [bp-74h]@37
918 int a6; // [sp+98h] [bp-1Ch]@57
919 int a3; // [sp+9Ch] [bp-18h]@53
920 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
921 unsigned int v79; // [sp+A8h] [bp-Ch]@9
922 int uPriceItemService; // [sp+ACh] [bp-8h]@12
923
924 if ( pCurrentScreen == SCREEN_E )
925 {
926 OnInventoryLeftClick();
927 return;
928 }
929 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
930 {
931 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
932 return;
933 }
934
935 switch(dialog_menu_id)
936 {
937 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
938 {
939 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
940 OnInventoryLeftClick();
941 break;
942 }
943 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
944 {
945 pCursorPos = pMouse->GetCursorPos(&cursor);
946 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF;
947 if ( !v18 )
948 return;
949 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
950 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
951 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier);
952 GetAsyncKeyState(VK_CONTROL);
953 if ( pParty->uNumGold < uPriceItemService )
954 {
955 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
956 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
957 return;
958 }
959 taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
960 if ( taken_item )
961 {
962 bought_item->SetIdentified();
963 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u);
964 dword_F8B1E4 = 1;
965 Party::TakeGold(uPriceItemService);
966 viewparams->bRedrawGameUI = 1;
967 bought_item->Reset();
968 pRenderer->ClearZBuffer(0, 479);
969 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
970 return;
971 }
972 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
973 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!"
974 break;
975 }
976 case HOUSE_DIALOGUE_SHOP_SELL:
977 {
978 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
979 if ( pMouse->GetCursorPos(&cursor)->x <= 13
980 || pMouse->GetCursorPos(&cursor)->x >= 462
981 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) )
982 return;
983 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) )
984 {
985 dword_F8B1E4 = 1;
986 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C);
987 viewparams->bRedrawGameUI = 1;
988 pRenderer->ClearZBuffer(0, 479);
989 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
990 return;
991 }
992 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
993 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
994 break;
995 }
996 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
997 {
998 pMouse->GetCursorPos(&cursor);
999 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
1000 if (cursor.x > 13 && cursor.x < 462)
1001 {
1002 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
1003 if ( pItemID )
1004 {
1005 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1006 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
1007 if ( !(item->uAttributes & 1) )
1008 {
1009 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
1010 {
1011 if ( pParty->uNumGold >= uPriceItemService )
1012 {
1013 dword_F8B1E4 = 1;
1014 Party::TakeGold(uPriceItemService);
1015 item->uAttributes |= 1;
1016 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0);
1017 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2);
1018 return;
1019 }
1020 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1021 return;
1022 }
1023 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1024 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1025 return;
1026 }
1027 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1028 return;
1029 }
1030 }
1031 break;
1032 }
1033 case HOUSE_DIALOGUE_SHOP_REPAIR:
1034 {
1035 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
1036 if ( pMouse->GetCursorPos(&cursor)->x > 13 )
1037 {
1038 if ( pMouse->GetCursorPos(&cursor)->x < 462 )
1039 {
1040 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
1041 if ( pItemID )
1042 {
1043 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
1044 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1045 auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
1046 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier);
1047 if ( item->uAttributes & 2 )
1048 {
1049 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
1050 {
1051 if ( pParty->uNumGold >= uPriceItemService )
1052 {
1053 dword_F8B1E4 = 1;
1054 Party::TakeGold(uPriceItemService);
1055 v8 = item->uAttributes;
1056 LOBYTE(v8) = v8 & 0xFD;
1057 item->uAttributes = v8 | 1;
1058 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0);
1059 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2);
1060 return;
1061 }
1062 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1063 return;
1064 }
1065 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1066 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1067 return;
1068 }
1069 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1070 return;
1071 }
1072 }
1073 }
1074 break;
1075 }
1076 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
1077 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
1078 {
1079 pCursorPos = pMouse->GetCursorPos(&cursor);
1080 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF;
1081 if ( !v18 )
1082 return;
1083 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
1084 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
1085 else
1086 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
1087 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1088 uNumSeconds = 0;
1089 a3 = 0;
1090 if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
1091 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm;
1092 party_reputation = GetPartyReputation();
1093 if (pPlayers[uActiveCharacter]->CanSteal())
1094 {
1095 if ( GetAsyncKeyState(VK_CONTROL) )
1096 {
1097 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6);
1098 if ( !uNumSeconds )
1099 {
1100 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
1101 return;
1102 }
1103 }
1104 }
1105 if ( pParty->uNumGold < uPriceItemService )
1106 {
1107 if ( uNumSeconds != 2 )
1108 {
1109 if ( uNumSeconds != 1 )
1110 {
1111 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
1112 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
1113 return;
1114 }
1115 }
1116 }
1117 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
1118 if ( v39 )
1119 {
1120 bought_item->SetIdentified();
1121 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen));
1122 if ( pPlayers[uActiveCharacter]->CanSteal() )
1123 {
1124 if ( GetAsyncKeyState(VK_CONTROL) )
1125 {
1126 if ( uNumSeconds == 1 || uNumSeconds == 2 )
1127 {
1128 pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen();
1129 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
1130 viewparams->bRedrawGameUI = 1;
1131 bought_item->Reset();
1132 pRenderer->ClearZBuffer(0, 479);
1133 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
1134 return;
1135 }
1136 }
1137 }
1138 dword_F8B1E4 = 1;
1139 Party::TakeGold(uPriceItemService);
1140 viewparams->bRedrawGameUI = 1;
1141 bought_item->Reset();
1142 pRenderer->ClearZBuffer(0, 479);
1143 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
1144 return;
1145 }
1146 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
1147 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
1148 break;
1149 }
1150 default:// if click video screen in shop
1151 {
1152 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum
1153 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
1154 {
1155 v42 = dialog_menu_id - 36;
1156 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
1157 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1158 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1159 if ( uPriceItemService < v43 / 3 )
1160 uPriceItemService = v43 / 3;
1161 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] )
1162 {
1163 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42];
1164 if ( !*pSkill )
1165 {
1166 if ( pParty->uNumGold < uPriceItemService )
1167 {
1168 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
1169 if ( in_current_building_type == BildingType_Training )
1170 v55 = 4;
1171 else
1172 v55 = 2;
1173 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55);
1174 return;
1175 }
1176 Party::TakeGold(uPriceItemService);
1177 dword_F8B1E4 = 1;
1178 *pSkill = 1;
1179 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0);
1180 return;
1181 }
1182 }
1183 }
1184 break;
1185 }
1186 }
1187 }
1188 //----- (004BE386) --------------------------------------------------------
1189 void __fastcall log_error(const char *pMessage)
1190 {
1191 const char *v1; // edi@1
1192 FILE *f; // eax@1
1193 FILE *v3; // esi@1
1194
1195 v1 = pMessage;
1196 f = fopen("errorlog.txt", "a");
1197 v3 = f;
1198 if ( f )
1199 {
1200 fprintf(f, "%s\n", v1);
1201 fclose(v3);
1202 fflush(v3);
1203 }
1204 } 771 }
1205 772
1206 //----- (004BF91E) -------------------------------------------------------- 773 //----- (004BF91E) --------------------------------------------------------
1207 unsigned int __thiscall GameOverMenu(void *ecx0) 774 unsigned int __thiscall GameOverMenu(void *ecx0)
1208 { 775 {
2286 ++v231; 1853 ++v231;
2287 result = v231; 1854 result = v231;
2288 } 1855 }
2289 while(v231 < dstHeight); 1856 while(v231 < dstHeight);
2290 return result; 1857 return result;
2291 }
2292
2293 //----- (0044E1EC) --------------------------------------------------------
2294 int TextureFrameTable::FromFileTxt(const char *Args)
2295 {
2296 TextureFrameTable *v2; // ebx@1
2297 FILE *v3; // eax@1
2298 int v4; // esi@3
2299 const void *v5; // ST0C_4@10
2300 void *v6; // eax@10
2301 FILE *v7; // ST0C_4@12
2302 char *i; // eax@12
2303 signed int v9; // esi@15
2304 int v10; // eax@17
2305 int v11; // edx@22
2306 int v12; // ecx@23
2307 int v13; // eax@24
2308 signed int j; // eax@27
2309 TextureFrame *v15; // edx@28
2310 int v16; // esi@28
2311 int k; // ecx@29
2312 char Buf; // [sp+Ch] [bp-2F8h]@3
2313 FrameTableTxtLine v20; // [sp+200h] [bp-104h]@4
2314 int v21; // [sp+27Ch] [bp-88h]@4
2315 char *Str1; // [sp+280h] [bp-84h]@5
2316 char *Str; // [sp+284h] [bp-80h]@15
2317 int v24; // [sp+2F8h] [bp-Ch]@3
2318 int v25; // [sp+2FCh] [bp-8h]@3
2319 FILE *File; // [sp+300h] [bp-4h]@1
2320 int Argsa; // [sp+30Ch] [bp+8h]@28
2321
2322 v2 = this;
2323 v3 = fopen(Args, "r");
2324 File = v3;
2325 if ( !v3 )
2326 Abortf("CTextureFrameTable::load - Unable to open file: %s.", Args);
2327 v4 = 0;
2328 v24 = 0;
2329 v25 = 1;
2330 if ( fgets(&Buf, 490, v3) )
2331 {
2332 do
2333 {
2334 *strchr(&Buf, 10) = 0;
2335 memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu);
2336 if ( v21 && *Str1 != 47 )
2337 {
2338 if ( v21 < 2 )
2339 Abortf("CTextureFrameTable::load, too few arguments, %s line %i.", Args, v25);
2340 ++v24;
2341 }
2342 ++v25;
2343 }
2344 while ( fgets(&Buf, 490, File) );
2345 v4 = v24;
2346 }
2347 v5 = v2->pTextures;
2348 v2->sNumTextures = v4;
2349 v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames");
2350 v2->pTextures = (TextureFrame *)v6;
2351 if ( !v6 )
2352 Abortf("CTextureFrameTable::load - Out of Memory!");
2353 v7 = File;
2354 v2->sNumTextures = 0;
2355 fseek(v7, 0, 0);
2356 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
2357 {
2358 *strchr(&Buf, 10) = 0;
2359 memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu);
2360 if ( v21 && *Str1 != 47 )
2361 {
2362 strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1);
2363 v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str);
2364 v9 = 2;
2365 for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 )
2366 {
2367 if ( !_stricmp((&Str1)[4 * v9], "New") )
2368 {
2369 v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags;
2370 *(char *)v10 |= 2u;
2371 }
2372 }
2373 ++v2->sNumTextures;
2374 }
2375 }
2376 fclose(File);
2377 v11 = 0;
2378 if ( (signed int)(v2->sNumTextures - 1) > 0 )
2379 {
2380 v12 = 0;
2381 do
2382 {
2383 v13 = (int)&v2->pTextures[v12];
2384 if ( !(*(char *)(v13 + 38) & 2) )
2385 *(char *)(v13 + 18) |= 1u;
2386 ++v11;
2387 ++v12;
2388 }
2389 while ( v11 < (signed int)(v2->sNumTextures - 1) );
2390 }
2391 for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 )
2392 {
2393 v15 = v2->pTextures;
2394 Argsa = (int)&v15[j];
2395 v16 = *(short *)(Argsa + 14);
2396 if ( *(char *)(Argsa + 18) & 1 )
2397 {
2398 ++j;
2399 for ( k = (int)&v15[j]; *(char *)(k + 18) & 1; k += 20 )
2400 {
2401 v16 += *(short *)(k + 14);
2402 ++j;
2403 }
2404 LOWORD(v16) = v15[j].uAnimTime + v16;
2405 }
2406 ++j;
2407 }
2408 return 1;
2409 } 1858 }
2410 1859
2411 //----- (0044F57C) -------------------------------------------------------- 1860 //----- (0044F57C) --------------------------------------------------------
2412 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) 1861 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
2413 { 1862 {
4425 v1 = 212; 3874 v1 = 212;
4426 v2 = 150; 3875 v2 = 150;
4427 return TargetColor(v2, v1, v4); 3876 return TargetColor(v2, v1, v4);
4428 } 3877 }
4429 3878
4430 //----- (004583B0) --------------------------------------------------------
4431 LevelDecoration::LevelDecoration()
4432 {
4433 this->field_1A = 0;
4434 this->field_18 = 0;
4435 this->vPosition.z = 0;
4436 this->vPosition.y = 0;
4437 this->vPosition.x = 0;
4438 this->uDecorationDescID = 0;
4439 this->field_2 = 0;
4440 this->field_16_event_id = 0;
4441 this->uCog = 0;
4442 }
4443
4444 //----- (00458600) --------------------------------------------------------
4445 void DecorationList::ToFile()
4446 {
4447 DecorationList *v1; // esi@1
4448 FILE *v2; // eax@1
4449 FILE *v3; // edi@1
4450
4451 v1 = this;
4452 v2 = fopen("data\\ddeclist.bin", "wb");
4453 v3 = v2;
4454 if ( !v2 )
4455 Abortf("Unable to save ddeclist.bin!");
4456 fwrite(v1, 4u, 1u, v2);
4457 fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3);
4458 fclose(v3);
4459 }
4460
4461 //----- (0045864C) --------------------------------------------------------
4462 void DecorationList::FromFile(void *pSerialized)
4463 {
4464 uNumDecorations = *(int *)pSerialized;
4465 pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations,
4466 84 * uNumDecorations, "Dec Descrip");
4467 memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations);
4468 }
4469
4470 //----- (00458693) --------------------------------------------------------
4471 void DecorationList::InitializeDecorationSprite(unsigned int uDecID)
4472 {
4473 pSpriteFrameTable->InitializeSprite(this->pDecorations[uDecID].uSpriteID);
4474 }
4475
4476 //----- (004586B0) --------------------------------------------------------
4477 bool DecorationList::FromFileTxt(const char *Args)
4478 {
4479 DecorationList *v2; // ebx@1
4480 FILE *v3; // eax@1
4481 unsigned int v4; // esi@3
4482 void *v5; // eax@10
4483 FILE *v6; // ST18_4@12
4484 char *i; // eax@12
4485 unsigned __int16 v8; // ax@16
4486 const char *v9; // ST20_4@16
4487 const char *v10; // ST18_4@16
4488 __int16 v11; // ax@16
4489 const char *v12; // ST14_4@16
4490 unsigned __int16 v13; // ax@16
4491 const char *v14; // ST10_4@16
4492 __int16 v15; // ax@16
4493 const char *v16; // ST0C_4@16
4494 unsigned __int8 v17; // al@16
4495 const char *v18; // ST08_4@16
4496 unsigned __int8 v19; // al@16
4497 const char *v20; // ST04_4@16
4498 unsigned __int8 v21; // al@16
4499 const char *v22; // ST00_4@16
4500 unsigned __int8 v23; // zf@16
4501 char v24; // sf@16
4502 unsigned __int8 v25; // of@16
4503 int j; // edi@17
4504 const char *v27; // esi@18
4505 int v28; // eax@19
4506 int v29; // eax@21
4507 int v30; // eax@23
4508 int v31; // eax@25
4509 int v32; // eax@27
4510 int v33; // eax@29
4511 int v34; // eax@31
4512 int v35; // eax@33
4513 FrameTableTxtLine v37; // [sp+Ch] [bp-460h]@17
4514 FrameTableTxtLine v38; // [sp+88h] [bp-3E4h]@13
4515 char Dest; // [sp+104h] [bp-368h]@17
4516 char Buf; // [sp+17Ch] [bp-2F0h]@3
4517 FrameTableTxtLine v41; // [sp+370h] [bp-FCh]@4
4518 FrameTableTxtLine v42; // [sp+3ECh] [bp-80h]@4
4519 FILE *File; // [sp+468h] [bp-4h]@1
4520 unsigned int Argsa; // [sp+474h] [bp+8h]@3
4521
4522 v2 = this;
4523 v3 = fopen(Args, "r");
4524 File = v3;
4525 if ( !v3 )
4526 Abortf("DecorationDescriptionList::load - Unable to open file: %s.");
4527 v4 = 0;
4528 Argsa = 0;
4529 if ( fgets(&Buf, 490, v3) )
4530 {
4531 do
4532 {
4533 *strchr(&Buf, 10) = 0;
4534 memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42));
4535 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
4536 ++Argsa;
4537 }
4538 while ( fgets(&Buf, 490, File) );
4539 v4 = Argsa;
4540 }
4541 v2->uNumDecorations = v4;
4542 v5 = pAllocator->AllocNamedChunk(v2->pDecorations, 84 * v4, "Dec Descrip");
4543 v2->pDecorations = (DecorationDesc *)v5;
4544 if ( !v5 )
4545 Abortf("DecorationDescriptionList::load - Out of Memory!");
4546 v6 = File;
4547 v2->uNumDecorations = 0;
4548 fseek(v6, 0, 0);
4549 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
4550 {
4551 *strchr(&Buf, 10) = 0;
4552 memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42));
4553 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
4554 {
4555 strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]);
4556 v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName);
4557 v9 = v42.pProperties[2];
4558 v2->pDecorations[v2->uNumDecorations].uSpriteID = v8;
4559 strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v9);
4560 v10 = v42.pProperties[3];
4561 v2->pDecorations[v2->uNumDecorations].uType = 0;
4562 v11 = atoi(v10);
4563 v12 = v42.pProperties[4];
4564 v2->pDecorations[v2->uNumDecorations].uRadius = v11;
4565 v13 = atoi(v12);
4566 v14 = v42.pProperties[5];
4567 v2->pDecorations[v2->uNumDecorations].uDecorationHeight = v13;
4568 v15 = atoi(v14);
4569 v16 = v42.pProperties[6];
4570 v2->pDecorations[v2->uNumDecorations].uLightRadius = v15;
4571 v17 = atoi(v16);
4572 v18 = v42.pProperties[7];
4573 v2->pDecorations[v2->uNumDecorations].uColoredLightRed = v17;
4574 v19 = atoi(v18);
4575 v20 = v42.pProperties[8];
4576 v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19;
4577 v21 = atoi(v20);
4578 v22 = v42.pProperties[9];
4579 v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21;
4580 v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22);
4581 v25 = __OFSUB__(v42.uPropCount, 10);
4582 v23 = v42.uPropCount == 10;
4583 v24 = v42.uPropCount - 10 < 0;
4584 v2->pDecorations[v2->uNumDecorations].uFlags = 0;
4585 if ( !((unsigned __int8)(v24 ^ v25) | v23) )
4586 {
4587 strcpy(&Dest, v42.pProperties[10]);
4588 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41));
4589 for ( j = 0; j < v41.uPropCount; ++j )
4590 {
4591 v27 = v41.pProperties[j];
4592 if ( _stricmp(v41.pProperties[j], "NBM") )
4593 {
4594 if ( _stricmp(v27, "Invisible") )
4595 {
4596 if ( _stricmp(v27, "FS") )
4597 {
4598 if ( _stricmp(v27, "FM") )
4599 {
4600 if ( _stricmp(v27, "FF") )
4601 {
4602 if ( _stricmp(v27, "Marker") )
4603 {
4604 if ( _stricmp(v27, "LoopSlow") )
4605 {
4606 if ( _stricmp(v27, "EmitFire") )
4607 {
4608 if ( _stricmp(v27, "Dawn") )
4609 {
4610 if ( !_stricmp(v27, "Dusk") )
4611 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 2u;
4612 }
4613 else
4614 {
4615 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 1u;
4616 }
4617 }
4618 else
4619 {
4620 v35 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4621 *(char *)v35 |= 0x80u;
4622 }
4623 }
4624 else
4625 {
4626 v34 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4627 *(char *)v34 |= 0x40u;
4628 }
4629 }
4630 else
4631 {
4632 v33 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4633 *(char *)v33 |= 0x20u;
4634 }
4635 }
4636 else
4637 {
4638 v32 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4639 *(char *)v32 |= 0x10u;
4640 }
4641 }
4642 else
4643 {
4644 v31 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4645 *(char *)v31 |= 8u;
4646 }
4647 }
4648 else
4649 {
4650 v30 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4651 *(char *)v30 |= 4u;
4652 }
4653 }
4654 else
4655 {
4656 v29 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4657 *(char *)v29 |= 2u;
4658 }
4659 }
4660 else
4661 {
4662 v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
4663 *(char *)v28 |= 1u;
4664 }
4665 }
4666 }
4667 ++v2->uNumDecorations;
4668 }
4669 }
4670 fclose(File);
4671 return 1;
4672 }
4673
4674 //----- (0045E03A) --------------------------------------------------------
4675 unsigned short * MakeScreenshot( signed int width, signed int height )
4676 {
4677 //signed int v2; // edi@1
4678 unsigned __int16 *v3; // ebx@1
4679 int v4; // edx@7
4680 unsigned __int8 v5; // cf@9
4681 unsigned int v6; // ecx@9
4682 unsigned __int16 *v7; // edi@9
4683 int j; // ecx@9
4684 //unsigned __int16 *v9; // edi@15
4685 //int v10; // ecx@15
4686 //LONG v11; // esi@15
4687 //signed __int64 v12; // qax@18
4688 //unsigned int v13; // ST10_4@21
4689 HRESULT v14; // eax@21
4690 int v15; // edi@29
4691 signed __int64 v16; // qax@30
4692 signed int v17; // edx@34
4693 unsigned __int16 *v18; // edi@36
4694 int k; // ecx@36
4695 DDSURFACEDESC2 Dst; // [sp+4h] [bp-A0h]@6
4696 unsigned __int16 *pPixels; // [sp+80h] [bp-24h]@1
4697 float v23; // [sp+84h] [bp-20h]@1
4698 unsigned __int16 *_this; // [sp+88h] [bp-1Ch]@21
4699 float v25; // [sp+8Ch] [bp-18h]@1
4700 unsigned int v26; // [sp+90h] [bp-14h]@17
4701 //int v27; // [sp+94h] [bp-10h]@1
4702 int v28; // [sp+98h] [bp-Ch]@16
4703 int v29; // [sp+9Ch] [bp-8h]@15
4704 //int v30; // [sp+A0h] [bp-4h]@1
4705
4706 //v30 = width;
4707 //v2 = height;
4708 //v27 = height;
4709 v23 = game_viewport_width / (double)width;
4710 v25 = game_viewport_height / (double)height;
4711
4712 pPixels = (unsigned __int16 *)malloc(2 * height * width);
4713 memset(pPixels, 0 , 2 * height * width);
4714
4715 v3 = pPixels;
4716 if ( pRenderer->pRenderD3D )
4717 {
4718 pRenderer->BeginSceneD3D();
4719
4720 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
4721 pIndoor->Draw();
4722 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
4723 pOutdoor->Draw();
4724
4725 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
4726 memset(&Dst, 0, 0x7Cu);
4727 Dst.dwSize = sizeof(Dst);
4728
4729 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
4730 {
4731 auto src = (unsigned __int16 *)Dst.lpSurface;
4732 auto src_width = (Dst.lPitch / sizeof(short));
4733 auto src_height = Dst.dwHeight;
4734 auto dst = pPixels;
4735 for (uint y = 0; y < height; ++y)
4736 {
4737 //uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short));
4738 uint src_y = game_viewport_y + y * v25;
4739 assert(game_viewport_y + y * v25 < src_height);
4740 assert(y < height);
4741
4742 for (uint x = 0; x < width; ++x)
4743 {
4744 //uint src_x = game_viewport_x + x * v23;
4745 uint src_x = game_viewport_x + x * v23;
4746 assert(src_x < src_width);
4747 assert(x < width);
4748
4749 dst[y * width + x] = (((63*y)/117) << 5) | 31*x/155;//31*y/117;//src[src_y * src_width + src_x];
4750 }
4751 }
4752 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
4753 }
4754 else
4755 {
4756 __debugbreak(); // unrefactored
4757 v4 = height;
4758 if ( height > 0 )
4759 {
4760 do
4761 {
4762 if ( width > 0 )
4763 {
4764 v5 = width & 1;
4765 v6 = (unsigned int)width >> 1;
4766 memset(v3, 0, 4 * ((unsigned int)width >> 1));
4767 v7 = &v3[2 * v6];
4768 for ( j = v5; j; --j )
4769 {
4770 *v7 = 0;
4771 ++v7;
4772 }
4773 v3 += width;
4774 }
4775 --v4;
4776 }
4777 while ( v4 );
4778 }
4779 }
4780 }
4781 else
4782 {
4783 pRenderer->BeginScene();
4784 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
4785 {
4786 pIndoor->Draw();
4787 }
4788 else
4789 {
4790 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
4791 pOutdoor->Draw();
4792 }
4793 _this = pRenderer->pTargetSurface;
4794 v26 = pRenderer->uTargetSurfacePitch;
4795 if ( pRenderer->pTargetSurface )
4796 {
4797 v29 = 0;
4798 if ( height > 0 )
4799 {
4800 do
4801 {
4802 v28 = 0;
4803 if ( width > 0 )
4804 {
4805 v15 = v26 * (unsigned __int64)(signed __int64)((double)v29 * v25 + 8.0);
4806 do
4807 {
4808 v16 = (signed __int64)((double)v28++ * v23 + 8.0);
4809 *v3 = _this[v15 + (int)v16];
4810 ++v3;
4811 }
4812 while ( v28 < width );
4813 }
4814 ++v29;
4815 }
4816 while ( v29 < height );
4817 }
4818 }
4819 else
4820 {
4821 if ( height > 0 )
4822 {
4823 v17 = height;
4824 do
4825 {
4826 if ( width > 0 )
4827 {
4828 memset(v3, 0, 4 * ((unsigned int)width >> 1));
4829 v18 = &v3[2 * ((unsigned int)width >> 1)];
4830 for ( k = width & 1; k; --k )
4831 {
4832 *v18 = 0;
4833 ++v18;
4834 }
4835 v3 += width;
4836 }
4837 --v17;
4838 }
4839 while ( v17 );
4840 }
4841 }
4842 pRenderer->EndScene();
4843 }
4844 return pPixels;
4845 }
4846
4847 //----- (0045E26C) --------------------------------------------------------
4848 void __thiscall SaveScreenshot(const char *pFilename)
4849 {
4850 const char *v1; // edi@1
4851 unsigned __int16 *v2; // esi@1
4852
4853 v1 = pFilename;
4854 v2 = MakeScreenshot(92, 68);
4855 pRenderer->SavePCXImage(v1, (char *)v2, 92, 68);
4856 free(v2);
4857 }
4858
4859 //----- (00460706) --------------------------------------------------------
4860 void TryLoadLevelFromLOD()
4861 {
4862 FILE *v0; // eax@1
4863 FILE *v1; // esi@1
4864 __int32 v2; // edi@2
4865 char Ext[256]; // [sp+4h] [bp-40Ch]@1
4866 char Dir[256]; // [sp+104h] [bp-30Ch]@1
4867 char Filename[256]; // [sp+204h] [bp-20Ch]@1
4868 char a1[260]; // [sp+304h] [bp-10Ch]@1
4869 char Drive[4]; // [sp+408h] [bp-8h]@1
4870 int DstBuf; // [sp+40Ch] [bp-4h]@2
4871
4872 strcpy(a1, pCurrentMapName.data());
4873 _splitpath(a1, Drive, Dir, Filename, Ext);
4874 sprintf(a1, "levels\\%s%s", Filename, ".lod");
4875 v0 = fopen(a1, "rb");
4876 v1 = v0;
4877 if ( v0 )
4878 {
4879 fseek(v0, 0, 2);
4880 v2 = ftell(v1);
4881 rewind(v1);
4882 ptr_6A0D08 = pAllocator->AllocNamedChunk(ptr_6A0D08, v2, "LevelLod");
4883 fread(ptr_6A0D08, v2, 1u, v1);
4884 fseek(v1, v2 - 6, 0);
4885 DstBuf = 0;
4886 fread(&DstBuf, 4u, 1u, v1);
4887 fread(&_6A0D10_txt_lod_loading__unused, 2u, 1u, v1);
4888 _6A0D0C_txt_lod_loading = (int)((char *)ptr_6A0D08 + DstBuf);
4889 fclose(v1);
4890 }
4891 }
4892
4893 //----- (0046080D) --------------------------------------------------------
4894 void __cdecl sub_46080D()
4895 {
4896 pAllocator->FreeChunk(ptr_6A0D08);
4897 ptr_6A0D08 = 0;
4898 _6A0D0C_txt_lod_loading = 0;
4899 }
4900
4901 //----- (0046082C) --------------------------------------------------------
4902 bool Initialize_GamesLOD_NewLOD()
4903 {
4904 pGames_LOD = new LODWriteableFile;
4905 pGames_LOD->AllocSubIndicesAndIO(300, 0);
4906 if (pGames_LOD->LoadFile("data\\games.lod", 1))
4907 {
4908 pNew_LOD = new LODWriteableFile;
4909 pNew_LOD->AllocSubIndicesAndIO(300, 100000);
4910 return true;
4911 }
4912 return false;
4913 }
4914
4915 //----- (0046086A) --------------------------------------------------------
4916 void SaveNewGame()
4917 {
4918 FILE *v3; // eax@7
4919 void *pSave; // [sp+170h] [bp-8h]@3
4920
4921 if ( pVideoPlayer->AnyMovieLoaded() )
4922 pVideoPlayer->Unload();
4923 pSave = pAllocator->AllocNamedChunk(0, 1000000, 0);
4924 pNew_LOD->CloseWriteFile();
4925 remove("data\\new.lod");
4926
4927 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
4928 strcpy(this_.LodVersion, "MMVII");
4929 strcpy(this_.LodDescription, "newmaps for MMVII");
4930 this_.LODSize = 100;
4931 this_.dword_0000A8 = 0;
4932
4933 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
4934 a3.dword_000018 = 0;
4935 a3.word_00001E = 0;
4936 strcpy(a3.pFilename, "current");
4937 pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod");
4938 if (pNew_LOD->LoadFile("data\\new.lod", false))
4939 {
4940 pNew_LOD->CreateTempFile();
4941 pNew_LOD->uNumSubDirs = 0;
4942
4943 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
4944 for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i)
4945 {
4946 memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir));
4947 v3 = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1);
4948 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3);
4949 pNew_LOD->AppendDirectory(&pDir, pSave);
4950 }
4951
4952 LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9
4953 strcpy(pSavegameHeader[0].pLocationName, "out01.odm");
4954 strcpy(save_game_dir.pFilename, "header.bin");
4955 save_game_dir.uDataSize = sizeof(SavegameHeader);
4956 pNew_LOD->AppendDirectory(&save_game_dir, &pSavegameHeader[0]);
4957
4958 pNew_LOD->FixDirectoryOffsets();
4959 pParty->vPrevPosition.y = 0;
4960 pParty->vPrevPosition.x = 12552;
4961 pParty->vPosition.x = 12552;
4962 pParty->vPosition.z = 0;
4963 pParty->uFallStartY = 0;
4964 pParty->sPrevRotationX = 0;
4965 pParty->sRotationX = 0;
4966 pParty->vPrevPosition.z = 1816;
4967 pParty->vPosition.y = 1816;
4968 pParty->sPrevRotationY = 512;
4969 pParty->sRotationY = 512;
4970 SaveGame(1, 1);
4971 }
4972 pAllocator->FreeChunk(pSave);
4973 }
4974
4975 //----- (004610AA) -------------------------------------------------------- 3879 //----- (004610AA) --------------------------------------------------------
4976 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) 3880 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2)
4977 { 3881 {
4978 unsigned int v2; // edi@1 3882 unsigned int v2; // edi@1
4979 OutdoorCamera *v3; // esi@1 3883 OutdoorCamera *v3; // esi@1
7770 MENU_STATE GetCurrentMenuID() 6674 MENU_STATE GetCurrentMenuID()
7771 { 6675 {
7772 return uCurrentMenuID; 6676 return uCurrentMenuID;
7773 } 6677 }
7774 6678
7775 //----- (00467F48) --------------------------------------------------------
7776 void CreateMsgScrollWindow( signed int mscroll_id )
7777 {
7778 signed int v1; // esi@1
7779
7780 v1 = mscroll_id;
7781 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 )
7782 {
7783 if ( mscroll_id <= 782 )
7784 {
7785 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE);
7786 pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Scroll, v1 - 700, 0);
7787 }
7788 }
7789 }
7790 // 720980: using guessed type int uTextureID_720980; 6679 // 720980: using guessed type int uTextureID_720980;
7791 6680
7792 //----- (00467F9F) --------------------------------------------------------
7793 void __cdecl free_book_subwindow()
7794 {
7795 if ( pGUIWindow_ScrollWindow )
7796 {
7797 pGUIWindow_ScrollWindow->Release();
7798 pGUIWindow_ScrollWindow = 0;
7799 }
7800 }
7801
7802 //----- (00467FB6) --------------------------------------------------------
7803 void CreateScrollWindow()
7804 {
7805 unsigned int v0; // eax@1
7806 char *v1; // ST18_4@3
7807 unsigned int v2; // eax@3
7808 GUIWindow a1; // [sp+Ch] [bp-54h]@1
7809
7810 memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1));
7811 a1.Hint = 0;
7812 a1.uFrameX = 1;
7813 a1.uFrameY = 1;
7814 a1.uFrameWidth = 468;
7815 v0 = pFontSmallnum->CalcTextHeight(pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], &a1, 0, 0)
7816 + 2 * LOBYTE(pFontCreate->uFontHeight)
7817 + 24;
7818 a1.uFrameHeight = v0;
7819 if ( (signed int)(v0 + a1.uFrameY) > 479 )
7820 {
7821 v0 = 479 - a1.uFrameY;
7822 a1.uFrameHeight = 479 - a1.uFrameY;
7823 }
7824 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
7825 a1.uFrameW = v0 + a1.uFrameY - 1;
7826 a1.DrawMessageBox(0);
7827 a1.uFrameX += 12;
7828 a1.uFrameWidth -= 24;
7829 a1.uFrameY += 12;
7830 a1.uFrameHeight -= 12;
7831 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
7832 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
7833 v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
7834 v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
7835 sprintf(pTmpBuf.data(), format_4E2D80, v2, v1);
7836 a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
7837 a1.DrawText(
7838 pFontSmallnum,
7839 1,
7840 LOBYTE(pFontCreate->uFontHeight) - 3,
7841 0,
7842 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C],
7843 0,
7844 0,
7845 0);
7846 }
7847
7848 //----- (00468F8A) --------------------------------------------------------
7849 void __cdecl OnPaperdollLeftClick()
7850 {
7851 int v1; // ecx@1
7852 unsigned int v2; // edi@1
7853 unsigned int v3; // edx@4
7854 unsigned int pSkillType; // esi@5
7855 unsigned __int16 v5; // ax@7
7856 unsigned int v6; // edi@19
7857 int v7; // esi@27
7858 unsigned int v8; // eax@29
7859 int v9; // edx@32
7860 int v10; // esi@34
7861 int v11; // eax@34
7862 int v12; // esi@38
7863 int v13; // eax@38
7864 char v14; // zf@38
7865 int v15; // esi@42
7866 int v16; // eax@42
7867 int v17; // eax@44
7868 unsigned int v18; // ecx@55
7869 unsigned int v19; // eax@55
7870 int v20; // esi@60
7871 int v21; // eax@60
7872 unsigned int v22; // eax@61
7873 unsigned int v23; // eax@62
7874 int v24; // esi@65
7875 int v25; // eax@65
7876 unsigned int v26; // eax@69
7877 int v27; // esi@81
7878 int v28; // eax@81
7879 int v29; // esi@84
7880 int v30; // eax@84
7881 int v31; // eax@85
7882 unsigned int v32; // ecx@88
7883 unsigned int v33; // eax@88
7884 int v34; // esi@90
7885 unsigned int v35; // eax@91
7886 int v36; // esi@93
7887 int v37; // edi@93
7888 ItemGen *v38; // edi@93
7889 __int16 v39; // dx@99
7890 ItemGen _this; // [sp+Ch] [bp-40h]@1
7891 unsigned int v48; // [sp+30h] [bp-1Ch]@88
7892 unsigned int v49; // [sp+34h] [bp-18h]@57
7893 unsigned int v50; // [sp+38h] [bp-14h]@50
7894 int v51; // [sp+3Ch] [bp-10h]@1
7895 unsigned int v52; // [sp+40h] [bp-Ch]@5
7896 //int v53; // [sp+44h] [bp-8h]@1
7897 //unsigned int v54; // [sp+48h] [bp-4h]@1
7898
7899 v51 = 0;
7900 _this.Reset();
7901 //v0 = pPlayers[uActiveCharacter];
7902 v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand;
7903 v2 = pPlayers[uActiveCharacter]->pEquipment.uShield;
7904 //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield;
7905 //v53 = v1;
7906 if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1 - 1]].uEquipType == 1 )
7907 v51 = v1;
7908 v3 = pParty->pPickedItem.uItemID;
7909 if ( pParty->pPickedItem.uItemID )
7910 {
7911 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
7912 pSkillType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType;
7913 if ( pSkillType == 4 )
7914 {
7915 if ( v2 )
7916 {
7917 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
7918 if ( (signed int)SkillToMastery(v5) < 3 )
7919 {
7920 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
7921 return;
7922 }
7923 v3 = pParty->pPickedItem.uItemID;
7924 }
7925 }
7926 else
7927 {
7928 if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2)
7929 && v1
7930 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 )
7931 {
7932 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
7933 if ( (signed int)SkillToMastery(v5) < 3 )
7934 {
7935 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
7936 return;
7937 }
7938 }
7939 }
7940 if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) )
7941 {
7942
7943 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
7944 return;
7945 }
7946 if ( pParty->pPickedItem.uItemID == 604 )
7947 {
7948 pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)3);
7949 WetsuitOn(uActiveCharacter);
7950 return;
7951 }
7952 v6 = v52;
7953 switch ( v52 )
7954 {
7955 case 2u:
7956 case 3u:
7957 case 5u:
7958 case 6u:
7959 case 7u:
7960 case 8u:
7961 case 9u:
7962 case 0xBu:
7963 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
7964 {
7965 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
7966 return;
7967 }
7968 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
7969 {
7970 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
7971 return;
7972 }
7973 pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)v6);
7974 if ( pParty->pPickedItem.uItemID == 604 )
7975 WetsuitOff(uActiveCharacter);
7976 return;
7977 case 0xAu:
7978 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
7979 {
7980 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
7981 return;
7982 }
7983 v52 = 10;
7984 v7 = (int)&pPlayers[uActiveCharacter]->pEquipment.uRings;
7985 while ( 1 )
7986 {
7987 if ( !*(int *)v7 )
7988 {
7989 v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
7990 if ( (v8 & 0x80000000u) == 0 )
7991 {
7992 v9 = v52;
7993 pParty->pPickedItem.uBodyAnchor = v52 + 1;
7994 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8]));
7995 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1;
7996 pMouse->RemoveHoldingItem();
7997 break;
7998 }
7999 }
8000 ++v52;
8001 v7 += 4;
8002 if ( (signed int)v52 > 15 )
8003 break;
8004 }
8005 if ( v52 == 16 )
8006 {
8007 v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[6] - 1;
8008 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8009 v10 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v52);
8010 *(char *)(v10 + 556) = 0;
8011 pParty->pPickedItem.Reset();
8012 pParty->SetHoldingItem((ItemGen *)(v10 + 532));
8013 _this.uBodyAnchor = 16;
8014 v11 = v52 + 1;
8015 memcpy((void *)(v10 + 532), &_this, 0x24u);
8016 pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v11;
8017 }
8018 return;
8019 case 4u:
8020 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
8021 {
8022 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8023 return;
8024 }
8025 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
8026 {
8027 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
8028 return;
8029 }
8030 if ( v2 )
8031 {
8032 --v2;
8033 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8034 v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2);
8035 *(char *)(v12 + 556) = 0;
8036 pParty->pPickedItem.Reset();
8037 pParty->SetHoldingItem((ItemGen *)(v12 + 532));
8038 _this.uBodyAnchor = 1;
8039 v13 = v2 + 1;
8040 v14 = v51 == 0;
8041 memcpy((void *)(v12 + 532), &_this, 0x24u);
8042 pPlayers[uActiveCharacter]->pEquipment.uShield = v13;
8043 if ( v14 )
8044 return;
8045 }
8046 else
8047 {
8048 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
8049 if ( (v52 & 0x80000000u) != 0 )
8050 return;
8051 if ( !v51 )
8052 {
8053 pParty->pPickedItem.uBodyAnchor = 1;
8054 v17 = v52 + 1;
8055 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
8056 pPlayers[uActiveCharacter]->pEquipment.uShield = v17;
8057 pMouse->RemoveHoldingItem();
8058 return;
8059 }
8060 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8061 v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v1 - 1));
8062 *(char *)(v15 + 556) = 0;
8063 pParty->pPickedItem.Reset();
8064 pParty->SetHoldingItem((ItemGen *)(v15 + 532));
8065 _this.uBodyAnchor = 1;
8066 v16 = v52 + 1;
8067 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
8068 pPlayers[uActiveCharacter]->pEquipment.uShield = v16;
8069 }
8070 pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0;
8071 return;
8072 case 0u:
8073 case 0xCu:
8074 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
8075 && pParty->pPickedItem.uItemID != 64
8076 && pParty->pPickedItem.uItemID != 65 )
8077 {
8078 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8079 return;
8080 }
8081 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
8082 {
8083 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
8084 return;
8085 }
8086 v50 = 0;
8087 if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0)
8088 || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 )
8089 {
8090
8091 v18 = pMouse->uMouseClickX;
8092 v19 = pMouse->uMouseClickY;
8093
8094 v49 = v19;
8095 if ( (signed int)v18 >= 560 )
8096 {
8097 if ( !v51 )
8098 {
8099 if ( v2 )
8100 {
8101 --v2;
8102 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8103 v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2);
8104 *(char *)(v20 + 556) = 0;
8105 pParty->pPickedItem.Reset();
8106 pParty->SetHoldingItem((ItemGen *)(v20 + 532));
8107 _this.uBodyAnchor = 1;
8108 v21 = v2 + 1;
8109 v14 = v52 == 12;
8110 memcpy((void *)(v20 + 532), &_this, 0x24u);
8111 pPlayers[uActiveCharacter]->pEquipment.uShield = v21;
8112 if ( !v14 )
8113 return;
8114 v22 = _this.uItemID;
8115 v50 = v22;
8116 if ( v50 )
8117 {
8118 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
8119 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9);
8120 }
8121 break;
8122 }
8123 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
8124 if ( (v23 & 0x80000000u) != 0 )
8125 return;
8126 pParty->pPickedItem.uBodyAnchor = 1;
8127 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23];
8128 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23]));
8129 pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1;
8130 pMouse->RemoveHoldingItem();
8131 if ( v52 != 12 )
8132 return;
8133 v22 = *(int *)v50;
8134 v50 = v22;
8135 if ( v50 )
8136 {
8137 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
8138 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9);
8139 }
8140 break;
8141 }
8142 }
8143 }
8144 if ( !v1 )
8145 {
8146 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
8147 if ( (v26 & 0x80000000u) != 0 )
8148 return;
8149 pParty->pPickedItem.uBodyAnchor = 2;
8150 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26];
8151 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26]));
8152 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1;
8153 pMouse->RemoveHoldingItem();
8154 if ( v52 != 12 )
8155 return;
8156 v22 = *(int *)v50;
8157 v50 = v22;
8158 if ( v50 )
8159 {
8160 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
8161 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9);
8162 }
8163 break;
8164 }
8165 --v1;
8166 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8167 v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1);
8168 *(char *)(v24 + 556) = 0;
8169 pParty->pPickedItem.Reset();
8170 pParty->SetHoldingItem((ItemGen *)(v24 + 532));
8171 _this.uBodyAnchor = 2;
8172 v25 = v1 + 1;
8173 v14 = v52 == 12;
8174 memcpy((void *)(v24 + 532), &_this, 0x24u);
8175 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25;
8176 if ( v14 )
8177 v50 = _this.uItemID;
8178 if ( v51 )
8179 pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
8180 if ( v50 )
8181 {
8182 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
8183 stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9);
8184 }
8185 break;
8186 case 1u:
8187 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
8188 {
8189 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8190 return;
8191 }
8192 if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )
8193 {
8194 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
8195 return;
8196 }
8197 if ( v1 )
8198 {
8199 if ( v2 )
8200 {
8201 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8202 return;
8203 }
8204 --v1;
8205 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8206 v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1);
8207 *(char *)(v27 + 556) = 0;
8208 pParty->pPickedItem.Reset();
8209 pParty->SetHoldingItem((ItemGen *)(v27 + 532));
8210 _this.uBodyAnchor = 2;
8211 v28 = v1 + 1;
8212 memcpy((void *)(v27 + 532), &_this, 0x24u);
8213 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28;
8214 }
8215 else
8216 {
8217 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
8218 if ( (v52 & 0x80000000u) == 0 )
8219 {
8220 if ( v2 )
8221 {
8222 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
8223 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v2 - 1));
8224 *(char *)(v29 + 556) = 0;
8225 pParty->pPickedItem.Reset();
8226 pParty->SetHoldingItem((ItemGen *)(v29 + 532));
8227 _this.uBodyAnchor = 2;
8228 v30 = v52 + 1;
8229 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
8230 pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
8231 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30;
8232 }
8233 else
8234 {
8235 pParty->pPickedItem.uBodyAnchor = 2;
8236 v31 = v52 + 1;
8237 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
8238 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31;
8239 pMouse->RemoveHoldingItem();
8240 }
8241 }
8242 }
8243 return;
8244 default:
8245 pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);
8246 return;
8247 }
8248 return;
8249 }
8250
8251 v32 = pMouse->uMouseClickX;
8252 v33 = pMouse->uMouseClickY;
8253
8254 v34 = pRenderer->pActiveZBuffer[v32 + pSRZBufferLineOffsets[v33]] & 0xFFFF;
8255 if ( v34 )
8256 {
8257 v36 = v34 - 1;
8258 v37 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v36);
8259 v50 = v37;
8260 v38 = (ItemGen *)(v37 + 532);
8261 v14 = v38->uItemID == 604;
8262 v52 = pItemsTable->pItems[v38->uItemID].uEquipType;
8263 if ( v14 )
8264 {
8265 if ( bUnderwater )
8266 {
8267 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8268 return;
8269 }
8270 WetsuitOff(uActiveCharacter);
8271 }
8272 if ( unk_50C9A0 )
8273 {
8274 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
8275 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
8276 v39 = v52;
8277 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v36;
8278 *((short *)pGUIWindow_Settings->ptr_1C + 3) = v39;
8279 ptr_50C9A4 = v38;
8280 unk_50C9A0 = 0;
8281 if ( pMessageQueue_50CBD0->uNumMessages )
8282 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
8283 pMouse->SetCursorBitmap("MICON1");
8284 dword_50C9D4 = 0;
8285 dword_50C9D0 = 113;
8286 dword_50C9D8 = 256;
8287 }
8288 else
8289 {
8290 if ( !ptr_50C9A4 )
8291 {
8292 pParty->SetHoldingItem(v38);
8293 *(&pPlayers[uActiveCharacter]->uBirthYear + *(char *)(v50 + 556)) = 0;
8294 v38->Reset();
8295 }
8296 }
8297 }
8298 else
8299 {
8300 v35 = pPlayers[uActiveCharacter]->pEquipment.uBow;
8301 if ( v35 )
8302 {
8303 auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35 - 1];
8304 pParty->SetHoldingItem(_a);
8305 _a->Reset();
8306 pPlayers[uActiveCharacter]->pEquipment.uBow = 0;
8307 }
8308 }
8309 }
8310
8311
8312 //----- (0046A14B) --------------------------------------------------------
8313 void OnPressSpace()
8314 {
8315 //SHORT v0; // ax@2
8316 int *v1; // eax@2
8317 char *v2; // ebx@5
8318 unsigned int v3; // esi@5
8319 signed int v4; // edi@7
8320 unsigned int v5; // edx@7
8321 int v6; // ecx@8
8322 int v7; // eax@8
8323 int v8; // ecx@17
8324 int *v9; // esi@22
8325 signed int v10; // ebx@22
8326 int i; // edi@23
8327 int v12; // edx@24
8328 int v13; // ecx@24
8329 int j; // esi@28
8330 int v16; // [sp+4h] [bp-1Ch]@0
8331 char *v17; // [sp+8h] [bp-18h]@5
8332 unsigned int v18; // [sp+Ch] [bp-14h]@5
8333 int v19; // [sp+10h] [bp-10h]@8
8334 int *v20; // [sp+14h] [bp-Ch]@5
8335 int *v21; // [sp+18h] [bp-8h]@7
8336 int v22; // [sp+1Ch] [bp-4h]@4
8337
8338 if ( pRenderer->pRenderD3D )
8339 {
8340 pGame->PickKeyboard(GetAsyncKeyState(VK_CONTROL) & 0x8001, &vis_sprite_filter_3, &vis_door_filter);
8341 auto pid = pGame->pVisInstance->get_picked_object_zbuf_val();
8342 if ( pid != -1 )
8343 DoInteractionWithTopmostZObject(pid & 0xFFFF, PID_ID(pid));
8344 return;
8345 }
8346
8347
8348 // software render stuff following
8349
8350 static int dword_720660[100]; // 720660
8351 static int dword_7207F0[100]; // 7207F0
8352
8353 v22 = 0;
8354 v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer
8355 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
8356 {
8357 v2 = (char *)v1 - 50;
8358 v1 = (int *)((char *)v1 + 50);
8359 v3 = 640 * viewparams->uScreen_topL_Y;
8360 v17 = v2;
8361 v20 = v1;
8362 v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1;
8363 do
8364 {
8365 if ( (signed int)v2 < (signed int)v20 )
8366 {
8367 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
8368 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
8369 v4 = v22;
8370 v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
8371 do
8372 {
8373 v6 = 0;
8374 v7 = *v1 & 0xFFFF;
8375 v19 = 0;
8376 if ( v4 > 0 )
8377 {
8378 do
8379 {
8380 if ( dword_7207F0[v6] == v7 )
8381 break;
8382 ++v6;
8383 v19 = v6;
8384 }
8385 while ( v6 < v22 );
8386 }
8387 if ( PID_TYPE(v7) == OBJECT_Decoration)
8388 {
8389 v16 = (unsigned int)PID_ID(v7);
8390 if ( (signed int)(((unsigned int)*v21 >> 16)
8391 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)PID_ID(v7)].uDecorationDescID].uRadius) <= 512 )
8392 if ( v19 == v22 && v4 < 100 )
8393 {
8394 ++v22;
8395 ++v4;
8396 v8 = *v21;
8397 dword_7207F0[v4 - 1] = v7;
8398 dword_720660[v4 - 1] = v8;
8399 }
8400 }
8401 else if ( (unsigned int)*v21 <= 0x2000000 )
8402 {
8403 if ( v19 == v22 && v4 < 100 )
8404 {
8405 ++v22;
8406 ++v4;
8407 v8 = *v21;
8408 dword_7207F0[v4 - 1] = v7;
8409 dword_720660[v4 - 1] = v8;
8410 }
8411 }
8412 v1 = v21 + 2;
8413 --v5;
8414 v21 += 2;
8415 }
8416 while ( v5 );
8417 v2 = v17;
8418 }
8419 v3 += 1280;
8420 --v18;
8421 }
8422 while ( v18 );
8423 }
8424 if ( v22 > 0 )
8425 {
8426 v9 = dword_720660;
8427 v10 = 1;
8428 do
8429 {
8430 for ( i = v10; i < v22; ++i )
8431 {
8432 v12 = *v9;
8433 v13 = dword_720660[i];
8434 if ( v13 < *v9 )
8435 {
8436 *v9 = v13;
8437 dword_720660[i] = v12;
8438 }
8439 }
8440 ++v10;
8441 ++v9;
8442 LOBYTE(v1) = v10 - 1;
8443 }
8444 while ( v10 - 1 < v22 );
8445 }
8446 for ( j = 0; j < v22; ++j )
8447 {
8448 LOBYTE(v1) = DoInteractionWithTopmostZObject(dword_720660[j] & 0xFFFF, v16);
8449 if ( !(char)v1 )
8450 break;
8451 }
8452 }
8453
8454 //----- (0046A334) --------------------------------------------------------
8455 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2)
8456 {
8457 int v2; // edx@1
8458 BLVFace *v4; // eax@9
8459 unsigned int v5; // ecx@9
8460 unsigned __int16 v6; // ax@11
8461 //ODMFace *v7; // eax@16
8462 LevelDecoration *v8; // esi@19
8463 __int16 v9; // ax@19
8464 int v10; // eax@22
8465 int v11; // ecx@22
8466 int v12; // edi@23
8467 Actor *v13; // esi@23
8468 unsigned __int16 v14; // ax@23
8469 unsigned __int16 v15; // ax@33
8470 const char *v16; // eax@34
8471 int v17; // edi@36
8472 int v18; // eax@36
8473 ItemGen *v19; // esi@39
8474 unsigned int v20; // eax@39
8475 int v21; // ecx@40
8476 std::string v22; // [sp-18h] [bp-2Ch]@5
8477 const char *v23; // [sp-8h] [bp-1Ch]@5
8478 int v24; // [sp-4h] [bp-18h]@5
8479 char v25; // [sp+8h] [bp-Ch]@5
8480 int v26; // [sp+Ch] [bp-8h]@1
8481 int a3; // [sp+13h] [bp-1h]@5
8482
8483 v26 = a2;
8484 v2 = a1;
8485 switch ( PID_TYPE(a1) )
8486 {
8487 case OBJECT_Item: // take the item
8488 v17 = PID_ID(a1);
8489 v26 = PID_ID(a1);
8490 v18 = PID_ID(a1);
8491 if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10
8492 || v17 >= 1000
8493 || !pSpriteObjects[v18].uObjectDescID )
8494 return 1;
8495 v19 = &pSpriteObjects[v18].stru_24;
8496 v20 = pSpriteObjects[v18].stru_24.uItemID;
8497 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD)
8498 {
8499 party_finds_gold(v19->uSpecEnchantmentType, 0);
8500 viewparams->bRedrawGameUI = 1;
8501 v21 = v17;
8502 }
8503 else
8504 {
8505 if ( pParty->pPickedItem.uItemID )
8506 return 1;
8507 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
8508 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24);
8509 ShowStatusBarString(pTmpBuf2.data(), 2u);
8510 if ( v19->uItemID == 506 )
8511 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
8512 if ( v19->uItemID == 455 )
8513 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
8514 if ( !pParty->AddItem(v19) )
8515 pParty->SetHoldingItem(v19);
8516 v21 = v26;
8517 }
8518 SpriteObject::OnInteraction(v21);
8519 break;
8520
8521 case OBJECT_Actor:
8522 v12 = PID_ID(a1);
8523 v13 = &pActors[PID_ID(a1)];
8524 v14 = v13->uAIState;
8525 if ( v14 == 4 || v14 == 17 )
8526 return 1;
8527 if ( v14 == 5 )
8528 {
8529 stru_50C198.LootActor(&pActors[PID_ID(a1)]);
8530 }
8531 else
8532 {
8533 if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() )
8534 {
8535 Actor::AI_FaceObject(v12, 4u, 0, 0);
8536 if ( v13->sNPC_ID )
8537 {
8538 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0);
8539 }
8540 else
8541 {
8542 v15 = pNPCStats->pGroups_copy[v13->uGroup];
8543 if ( v15 )
8544 {
8545 v16 = pNPCStats->pCatchPhrases[v15];
8546 if ( v16 )
8547 {
8548 pParty->uFlags |= 2u;
8549 strcpy(byte_5B0938.data(), v16);
8550 sub_4451A8_press_any_key(0, 0, 0);
8551 }
8552 }
8553 }
8554 }
8555 }
8556 break;
8557
8558 case OBJECT_Decoration:
8559 v8 = &pLevelDecorations[PID_ID(a1)];
8560 v9 = v8->field_16_event_id;
8561 if ( v9 )
8562 {
8563 EventProcessor(v9, a1, 1);
8564 LOBYTE(v8->field_2) |= 8u;
8565 }
8566 else
8567 {
8568 if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() )
8569 return 1;
8570 v10 = v8->_idx_in_stru123;
8571 v24 = 1;
8572 v11 = stru_5E4C90._decor_events[v10 - 75] + 380;
8573 activeLevelDecoration = v8;
8574 EventProcessor(v11, 0, 1);
8575 activeLevelDecoration = NULL;
8576 }
8577 break;
8578
8579 default:
8580 MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0);
8581 return 1;
8582
8583 case OBJECT_BModel:
8584 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
8585 {
8586 int bmodel_id = a1 >> 9,
8587 face_id = PID_ID(a1) & 0x3F;
8588 if (bmodel_id >= pOutdoor->uNumBModels)
8589 return 1;
8590 auto face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id];
8591 if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 )
8592 return 1;
8593 EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1);
8594 }
8595 else
8596 {
8597 v4 = &pIndoor->pFaces[PID_ID(a1)];
8598 v5 = v4->uAttributes;
8599 if ( !(v5 & 0x2000000) )
8600 {
8601 ShowNothingHereStatus();
8602 return 1;
8603 }
8604 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
8605 return 1;
8606 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
8607 EventProcessor((signed __int16)v6, v2, 1);
8608 }
8609 return 0;
8610 break;
8611 }
8612 return 0;
8613 }
8614 // 4E28F8: using guessed type int pCurrentScreen; 6681 // 4E28F8: using guessed type int pCurrentScreen;
8615 6682
8616 //----- (0046A6AC) -------------------------------------------------------- 6683 //----- (0046A6AC) --------------------------------------------------------
8617 int __fastcall sub_46A6AC(int a1, int a2, int a3) 6684 int __fastcall sub_46A6AC(int a1, int a2, int a3)
8618 { 6685 {
9075 BLV_UpdateUserInputAndOther(); 7142 BLV_UpdateUserInputAndOther();
9076 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) 7143 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
9077 ODM_UpdateUserInputAndOther(); 7144 ODM_UpdateUserInputAndOther();
9078 7145
9079 area_of_effect__damage_evaluate(); 7146 area_of_effect__damage_evaluate();
9080 }
9081 }
9082
9083 //----- (0046BDF1) --------------------------------------------------------
9084 void __cdecl BLV_UpdateUserInputAndOther()
9085 {
9086 UpdateObjects();
9087 BLV_ProcessPartyActions();
9088 UpdateActors_BLV();
9089 BLV_UpdateDoors();
9090 check_event_triggers();
9091 }
9092
9093 //----- (0046BE0A) --------------------------------------------------------
9094 void __cdecl ODM_UpdateUserInputAndOther()
9095 {
9096 bool v0; // eax@5
9097 char pOut[32]; // [sp+8h] [bp-20h]@5
9098
9099 UpdateObjects();
9100 ODM_ProcessPartyActions();
9101 if ( pParty->vPosition.x < -22528
9102 || pParty->vPosition.x > 22528
9103 || pParty->vPosition.y < -22528
9104 || pParty->vPosition.y > 22528 )
9105 {
9106 strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
9107 v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32);
9108 if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 )
9109 {
9110 if ( pParty->vPosition.x < -22528 )
9111 pParty->vPosition.x = -22528;
9112 if ( pParty->vPosition.x > 22528 )
9113 pParty->vPosition.x = 22528;
9114 if ( pParty->vPosition.y < -22528 )
9115 pParty->vPosition.y = -22528;
9116 if ( pParty->vPosition.y > 22528 )
9117 pParty->vPosition.y = 22528;
9118 }
9119 else
9120 {
9121 pAudioPlayer->StopChannels(-1, -1);
9122 TravelUI_Load();
9123 }
9124 }
9125 UpdateActors_ODM();
9126 check_event_triggers();
9127 }
9128
9129 //----- (0046BEF1) --------------------------------------------------------
9130 void SpriteObject::_46BEF1_apply_spells_aoe()
9131 {
9132 SpriteObject *v1; // edi@1
9133 Actor *v2; // esi@2
9134 __int16 v3; // fps@4
9135 unsigned __int8 v4; // c0@4
9136 unsigned __int8 v5; // c3@4
9137 signed int v6; // [sp+8h] [bp-4h]@1
9138
9139 int v7,v8,v9,v10,v11;
9140
9141 v6 = 0;
9142 v1 = this;
9143 if ( (signed int)uNumActors > 0 )
9144 {
9145 v2 = pActors.data();//[0].vPosition.y;
9146 do
9147 {
9148 if ( v2->CanAct() )
9149 {
9150 //UNDEF(v3);
9151 //.text:0046BF26 movsx eax, word ptr [esi-2]
9152 //.text:0046BF2A sub eax, [edi+4]
9153 //.text:0046BF31 mov [ebp+var_8], eax
9154 //.text:0046BF37 fild [ebp+var_8]
9155 // v7 pushed to stack
9156 v7 = v2->vPosition.x - this->vPosition.x;
9157
9158 //.text:0046BF2D movsx ecx, word ptr [esi+2]
9159 v8 = v2->vPosition.z;
9160
9161 //.text:0046BF34 movsx eax, word ptr [esi]
9162 //.text:0046BF3A sub eax, [edi+8]
9163 //.text:0046BF3D mov [ebp+var_8], eax
9164 //.text:0046BF44 fild [ebp+var_8]
9165 // v9 pushed to stack
9166 v9 = v2->vPosition.y - this->vPosition.y;
9167
9168 //.text:0046BF40 movsx eax, word ptr [esi-6]
9169 //.text:0046BF47 sar eax, 1
9170 //.text:0046BF49 add eax, ecx
9171 //.text:0046BF4B sub eax, [edi+0Ch]
9172 //.text:0046BF4E mov [ebp+var_8], eax
9173 //.text:0046BF51 fild [ebp+var_8]
9174 //.text:0046BF58 fld st
9175 // v10 pushed to stack, two times
9176 v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y;
9177
9178 //.text:0046BF54 movsx eax, word ptr [esi-8]
9179 //.text:0046BF5A add eax, 100h
9180 //.text:0046BF63 mov ecx, eax
9181 v11 = this->vVelocity.x;
9182
9183 //.text:0046BF5F fmul st, st(1)
9184 // stack: v10*v10, v10, v9, v7
9185 //.text:0046BF61 fld st(2)
9186 // stack: v7, v10*v10, v10, v9, v7
9187
9188
9189 //.text:0046BF65 fmul st, st(3)
9190 // stack: v7*v9, v10*v10, v10, v9, v7
9191
9192 //.text:0046BF67 imul ecx, eax
9193 v11 = v11 * v11;
9194
9195 //.text:0046BF6A faddp st(1), st
9196 // stack: v10*v10+v7*v9, v10, v9, v7
9197 //.text:0046BF6C fld st(3)
9198 // stack: v7, v10*v10+v7*v9, v10, v9, v7
9199 //.text:0046BF6E fmul st, st(4)
9200 // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7
9201 //.text:0046BF70 faddp st(1), st
9202 // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7
9203
9204 //.text:0046BF72 mov [ebp+var_8], ecx
9205 //.text:0046BF75 fild [ebp+var_8]
9206 // v11 pushed to stack
9207
9208 //.text:0046BF78 fcompp
9209 // if ( v11 > v10*v10+v7*v9+v7*v7 )
9210 // stack: v10, v9, v7
9211
9212 //.text:0046BF7A fstp st
9213 // stack: v9, v7
9214
9215 //.text:0046BF7C fnstsw ax
9216 //.text:0046BF7E fstp st
9217 // stack: v7
9218
9219 //.text:0046BF80 test ah, 41h
9220 //.text:0046BF83 fstp st
9221 //.text:0046BF85 jnz short loc_46BFDD
9222
9223 if ( v11 >= v10*v10+v7*v9+v7*v7 )
9224 {
9225 if ( stru_50C198.GetMagicalResistance(v2, 0xAu) )
9226 {
9227 v2->pActorBuffs[v1->spell_id].Apply(
9228 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335),
9229 v1->spell_skill,
9230 4u,
9231 0,
9232 0);
9233 HIWORD(v2->uAttributes) |= 8u;
9234 }
9235 }
9236 }
9237 ++v6;
9238 ++v2;
9239 }
9240 while ( v6 < (signed int)uNumActors );
9241 } 7147 }
9242 } 7148 }
9243 7149
9244 //----- (0046BFFA) -------------------------------------------------------- 7150 //----- (0046BFFA) --------------------------------------------------------
9245 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) 7151 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)