Mercurial > mm7
comparison mm7_4.cpp @ 907:f3ccfc765502
RentRoom
author | Ritor1 |
---|---|
date | Sun, 21 Apr 2013 19:22:42 +0600 |
parents | 10fa7dad1391 |
children | becbb0b11b7d |
comparison
equal
deleted
inserted
replaced
906:23655ae9cd18 | 907:f3ccfc765502 |
---|---|
6263 } | 6263 } |
6264 return result; | 6264 return result; |
6265 } | 6265 } |
6266 // F8B1E0: using guessed type int dword_F8B1E0; | 6266 // F8B1E0: using guessed type int dword_F8B1E0; |
6267 | 6267 |
6268 //view item details in shop? | |
6269 //----- (004B1A2D) -------------------------------------------------------- | 6268 //----- (004B1A2D) -------------------------------------------------------- |
6270 void __cdecl sub_4B1A2D() | 6269 void __cdecl ShowPopupShopItem() |
6271 { | 6270 { |
6272 //Player *v0; // edi@1 | |
6273 POINT *v1; // esi@5 | 6271 POINT *v1; // esi@5 |
6274 unsigned int v2; // eax@5 | 6272 unsigned int v2; // eax@5 |
6275 int v3; // ecx@5 | 6273 int v3; // ecx@5 |
6276 POINT *v4; // esi@12 | 6274 POINT *v4; // esi@12 |
6277 int v5; // eax@12 | 6275 int v5; // eax@12 |
6285 POINT v13; // [sp+20h] [bp-2Ch]@17 | 6283 POINT v13; // [sp+20h] [bp-2Ch]@17 |
6286 POINT v14; // [sp+28h] [bp-24h]@17 | 6284 POINT v14; // [sp+28h] [bp-24h]@17 |
6287 POINT v15; // [sp+30h] [bp-1Ch]@17 | 6285 POINT v15; // [sp+30h] [bp-1Ch]@17 |
6288 POINT v16; // [sp+38h] [bp-14h]@5 | 6286 POINT v16; // [sp+38h] [bp-14h]@5 |
6289 POINT a2; // [sp+40h] [bp-Ch]@5 | 6287 POINT a2; // [sp+40h] [bp-Ch]@5 |
6290 int v18; // [sp+48h] [bp-4h]@5 | 6288 |
6291 | |
6292 //v0 = pPlayers[uActiveCharacter]; | |
6293 if ( in_current_building_type <= 0 ) | 6289 if ( in_current_building_type <= 0 ) |
6294 return; | 6290 return; |
6295 if ( in_current_building_type <= BildingType_AlchemistShop ) | 6291 if ( in_current_building_type <= BildingType_AlchemistShop ) |
6296 { | 6292 { |
6297 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 6293 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6299 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 6295 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6300 return; | 6296 return; |
6301 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) | 6297 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
6302 { | 6298 { |
6303 v8 = pMouse->GetCursorPos(&v15)->x - 14; | 6299 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6304 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | 6300 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
6305 if ( pMouse->GetCursorPos(&v13)->x <= 13 | 6301 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6306 || pMouse->GetCursorPos(&v12)->x >= 462 | 6302 || pMouse->GetCursorPos(&v12)->x >= 462 |
6307 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) | 6303 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
6308 return; | 6304 return; |
6309 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; | 6305 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
6310 LABEL_15: | |
6311 GameUI_DrawItemInfo(v7); | |
6312 return; | 6306 return; |
6313 } | 6307 } |
6314 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) | 6308 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
6315 return; | 6309 return; |
6316 } | 6310 } |
6317 v4 = pMouse->GetCursorPos(&v11); | 6311 v4 = pMouse->GetCursorPos(&v11); |
6318 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | 6312 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; |
6319 v18 = v5; | |
6320 if ( !v5 ) | 6313 if ( !v5 ) |
6321 return; | 6314 return; |
6322 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); | 6315 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
6323 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); | 6316 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
6324 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | 6317 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6325 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; | 6318 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6326 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; | 6319 GameUI_DrawItemInfo(v7); |
6327 goto LABEL_15; | 6320 return; |
6328 } | 6321 } |
6329 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) | 6322 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
6330 { | 6323 { |
6331 v1 = pMouse->GetCursorPos(&a2); | 6324 v1 = pMouse->GetCursorPos(&a2); |
6332 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; | 6325 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
6333 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | 6326 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6334 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | 6327 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6335 if ( v18 ) | 6328 if ( v5 ) |
6336 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); | 6329 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
6337 } | 6330 } |
6338 } | 6331 } |
6339 // F8B198: using guessed type int dword_F8B198; | 6332 // F8B198: using guessed type int dword_F8B198; |
6340 // F8B19C: using guessed type int dword_F8B19C; | 6333 // F8B19C: using guessed type int dword_F8B19C; |
6404 { | 6397 { |
6405 if ( in_current_building_type != BildingType_Temple ) | 6398 if ( in_current_building_type != BildingType_Temple ) |
6406 return; | 6399 return; |
6407 } | 6400 } |
6408 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; | 6401 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
6409 LABEL_28: | |
6410 PlayHouseSound(v1, (HouseSoundID)v0); | 6402 PlayHouseSound(v1, (HouseSoundID)v0); |
6411 return; | 6403 return; |
6412 } | 6404 } |
6413 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; | 6405 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
6414 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) | 6406 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
6416 if ( pParty->uNumGold <= 0x2710 ) | 6408 if ( pParty->uNumGold <= 0x2710 ) |
6417 { | 6409 { |
6418 if ( !dword_F8B1E4 ) | 6410 if ( !dword_F8B1E4 ) |
6419 return; | 6411 return; |
6420 v0 = 4; | 6412 v0 = 4; |
6421 goto LABEL_28; | 6413 PlayHouseSound(v1, (HouseSoundID)v0); |
6414 return; | |
6422 } | 6415 } |
6423 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); | 6416 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
6424 if ( !dword_F8B1E4 && !qword_A750D8 ) | 6417 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6425 { | 6418 { |
6426 v5 = 0; | 6419 v5 = 0; |
6435 if ( v5 ) | 6428 if ( v5 ) |
6436 { | 6429 { |
6437 qword_A750D8 = 256i64; | 6430 qword_A750D8 = 256i64; |
6438 word_A750E0 = 80; | 6431 word_A750E0 = 80; |
6439 v4 = LOWORD(v7[rand() % v5]); | 6432 v4 = LOWORD(v7[rand() % v5]); |
6440 goto LABEL_16; | 6433 word_A750E2 = v4; |
6434 return; | |
6441 } | 6435 } |
6442 } | 6436 } |
6443 } | 6437 } |
6444 else | 6438 else |
6445 { | 6439 { |
6457 if ( v2 ) | 6451 if ( v2 ) |
6458 { | 6452 { |
6459 qword_A750D8 = 256i64; | 6453 qword_A750D8 = 256i64; |
6460 word_A750E0 = 80; | 6454 word_A750E0 = 80; |
6461 v4 = LOWORD(v7[rand() % v2]); | 6455 v4 = LOWORD(v7[rand() % v2]); |
6462 LABEL_16: | |
6463 word_A750E2 = v4; | 6456 word_A750E2 = v4; |
6464 return; | 6457 return; |
6465 } | 6458 } |
6466 } | 6459 } |
6467 } | 6460 } |
8241 pGame->Draw(); | 8234 pGame->Draw(); |
8242 dword_7241C8 = 0; | 8235 dword_7241C8 = 0; |
8243 } | 8236 } |
8244 | 8237 |
8245 //----- (004BDAAF) -------------------------------------------------------- | 8238 //----- (004BDAAF) -------------------------------------------------------- |
8246 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | 8239 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
8247 { | 8240 { |
8248 int v2; // edx@1 | |
8249 unsigned int v3; // esi@1 | |
8250 unsigned int v4; // eax@1 | |
8251 signed int v5; // edi@1 | |
8252 int v6; // edx@8 | 8241 int v6; // edx@8 |
8253 int v7; // edx@9 | 8242 int v7; // edx@9 |
8254 int v8; // edx@10 | 8243 int v8; // edx@10 |
8255 unsigned __int8 v9; // zf@16 | 8244 unsigned __int8 v9; // zf@16 |
8256 char v10; // sf@16 | 8245 char v10; // sf@16 |
8257 unsigned __int8 v11; // of@16 | 8246 unsigned __int8 v11; // of@16 |
8258 bool test; | 8247 bool test; |
8259 | 8248 |
8260 auto a2 = _2da_idx; | 8249 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8261 //v2 = p2DEvents_minus1___00[26 * a2]; | 8250 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) |
8262 v2 = p2DEvents[a2 - 1].uType; | |
8263 v3 = a1->uItemID; | |
8264 v4 = a1->uItemID; | |
8265 v5 = pItemsTable->pItems[v4].uEquipType; | |
8266 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
8267 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) | |
8268 return 0; | 8251 return 0; |
8269 switch( p2DEvents[a2 - 1].uType ) | 8252 switch( p2DEvents[_2da_idx - 1].uType ) |
8270 { | 8253 { |
8271 case BildingType_WeaponShop: | 8254 case BildingType_WeaponShop: |
8272 { | 8255 { |
8273 test = v5 <= 2; | 8256 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; |
8274 break; | 8257 break; |
8275 } | 8258 } |
8276 case BildingType_ArmorShop: | 8259 case BildingType_ArmorShop: |
8277 { | 8260 { |
8278 test = v5 >= 3; | 8261 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; |
8279 break; | 8262 break; |
8280 } | 8263 } |
8281 case BildingType_MagicShop: | 8264 case BildingType_MagicShop: |
8282 { | 8265 { |
8283 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | 8266 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; |
8284 break; | 8267 break; |
8285 } | 8268 } |
8286 case BildingType_AlchemistShop: | 8269 case BildingType_AlchemistShop: |
8287 { | 8270 { |
8288 __debugbreak(); // need to test | 8271 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 |
8289 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | 8272 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 |
8290 break; | 8273 || (signed int)item->uItemID < 740) && item->uItemID != 771); |
8291 } | 8274 break; |
8292 default: | 8275 } |
8293 { | 8276 default: |
8294 test = 0; | 8277 { |
8295 break; | 8278 test = false; |
8296 } | 8279 break; |
8297 } | 8280 } |
8298 | 8281 } |
8299 return test; | 8282 return test; |
8300 /* | 8283 /* |
8301 if ( p2DEvents[a2 - 1].uType == 1 ) | 8284 if ( p2DEvents[a2 - 1].uType == 1 ) |
8302 { | 8285 { |
8303 v11 = __OFSUB__(v5, 2); | 8286 v11 = __OFSUB__(v5, 2); |