Mercurial > mm7
diff mm7_2.cpp @ 461:197461e5acec
moved shop generators to item.cpp
author | Gloval |
---|---|
date | Sun, 24 Feb 2013 20:47:01 +0400 |
parents | a812665688e4 |
children | 37090bd974f9 |
line wrap: on
line diff
--- a/mm7_2.cpp Sun Feb 24 15:22:03 2013 +0200 +++ b/mm7_2.cpp Sun Feb 24 20:47:01 2013 +0400 @@ -925,84 +925,6 @@ } } -//----- (004B8E3D) -------------------------------------------------------- -void *__cdecl GenerateShopItems() -{ - GUIWindow *v0; // eax@1 - signed int v1; // edi@1 - signed int v2; // esi@1 - int v3; // ecx@3 - int v4; // ebx@3 - int v5; // ecx@3 - bool v6; // ebp@5 - int v7; // ecx@5 - void *result; // eax@15 - signed int v9; // [sp-Ch] [bp-14h]@7 - - v0 = window_SpeakInHouse; - v1 = 0; - v2 = (signed int)window_SpeakInHouse->ptr_1C; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - while ( v2 > 14 ) - { - if ( v2 <= 28 ) - { - v6 = v1 > 3; - v7 = v6 + 2 * v2 - 30; - v2 = (signed int)v0->ptr_1C; - v4 = word_4F0498[5 * v7]; - __debugbreak(); - //things happen around word_4F0400 actually - //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10]; - goto LABEL_13; - } - if ( v2 <= 41 ) - { - v4 = word_4F0576[v2]; - v9 = 22; //misc - goto LABEL_12; - } - if ( v2 <= 53 ) - { - if ( v1 >= 6 ) - { - v4 = word_4F0578[v2]; - v9 = 45; //reagent -LABEL_12: - v5 = v9; -LABEL_13: - pItemsTable->GenerateItem(v4, v5, (ItemGen *)&pParty->field_777C[v2][v1]);//9 * (v1 + 12 * v2)]); - v0 = window_SpeakInHouse; - pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes = 1; //identified - goto LABEL_14; - } - auto _t = (ItemGen *)&pParty->field_777C[v2][v1]; - _t->Reset(); - v0 = window_SpeakInHouse; - pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uItemID = 220; //potion bottle - } -LABEL_14: - v2 = (signed int)v0->ptr_1C; - ++v1; - //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v0->ptr_1C]] ) - if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v0->ptr_1C - 1].uType] ) - goto LABEL_15; - } - v3 = 5 * v2; - v2 = (signed int)v0->ptr_1C; - v4 = word_4F0404[v3 - 4]; - v5 = word_4F0404[5 * v2 + rand() % 4 - 2]; - goto LABEL_13; - } -LABEL_15: - result = v0->ptr_1C; - *(int *)&pParty->field_16154[4 * (int)result] = 0; - return result; -} - - //----- (004B910F) -------------------------------------------------------- char *__cdecl WeaponShopDialog() @@ -8071,202 +7993,6 @@ return a1a.Create(0, 0, 0, 0); } -//----- (00450218) -------------------------------------------------------- -void __cdecl sub_450218_prolly_generate_chests_loot() -{ - unsigned int v0; // eax@1 - Chest *v1; // ebx@1 - MapInfo *v2; // esi@1 - ItemGen *v3; // ebx@2 - int v4; // ebp@4 - int v5; // edi@4 - int v6; // esi@4 - int v7; // eax@4 - signed int v8; // esi@4 - int v9; // edx@4 - int v10; // esi@8 - int v11; // ebp@25 - int v12; // esi@25 - signed int v13; // ebp@27 - ItemGen *v14; // edi@28 - signed int v15; // edx@32 - signed __int64 v16; // qtt@32 - int v17; // esi@34 - signed int v18; // [sp+10h] [bp-18h]@1 - int v19; // [sp+14h] [bp-14h]@4 - MapInfo *v20; // [sp+18h] [bp-10h]@1 - Chest *v21; // [sp+1Ch] [bp-Ch]@1 - int v22; // [sp+20h] [bp-8h]@26 - signed int v23; // [sp+24h] [bp-4h]@2 - - v18 = rand() % 100; - v0 = pMapStats->GetMapInfo(pCurrentMapName); - v1 = pChests; - v2 = &pMapStats->pInfos[v0]; - v21 = pChests; - v20 = &pMapStats->pInfos[v0]; - do - { - v3 = v1->mm7__vector_pItems; - v23 = 140; - do - { - if ( (v3->uItemID & 0x80000000u) == 0 ) - goto LABEL_56; - v4 = rand() % 5 + 1; - v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; - v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; - v7 = rand(); - v8 = v6 - v5 + 1; - v9 = v5 + v7 % v8; - v19 = v5 + v7 % v8; - if ( v9 < 7 ) - { - if ( v18 < 20 ) - { - v3->Reset(); - goto LABEL_25; - } - if ( v18 < 60 ) - { - v10 = 0; - v3->Reset(); - if ( v19 == 1 ) - { - v10 = rand() % 51 + 50; - } - else - { - if ( v19 != 2 ) - { - if ( v19 == 3 ) - { - v10 = rand() % 301 + 200; - } - else - { - if ( v19 != 4 ) - { - if ( v19 == 5 ) - { - v10 = rand() % 1001 + 1000; -LABEL_15: - v3->uItemID = 199; - } - else - { - if ( v19 == 6 ) - { - v10 = rand() % 3001 + 2000; - goto LABEL_15; - } - } -LABEL_23: - v3->SetIdentified(); - v3->uSpecEnchantmentType = v10; -LABEL_25: - v11 = v4 - 1; - v12 = 0; - if ( v11 > 0 ) - { - v22 = v11; - while ( 1 ) - { - v13 = v12; - if ( v12 >= 140 ) - goto LABEL_52; - v14 = &v21->mm7__vector_pItems[v12]; - while ( v14->uItemID ) - { - ++v13; - ++v14; - if ( v13 >= 140 ) - goto LABEL_52; - } - v16 = rand(); - v15 = v16 % 100; - v18 = v16 % 100; - if ( v15 < 20 ) - goto LABEL_52; - if ( v15 >= 60 ) - { - pItemsTable->GenerateItem(v19, 0, v14); - goto LABEL_51; - } - v17 = 0; - v14->Reset(); - if ( v19 == 1 ) - { - v17 = rand() % 51 + 50; - goto LABEL_48; - } - if ( v19 == 2 ) - { - v17 = rand() % 101 + 100; -LABEL_48: - v14->uItemID = 197; - goto LABEL_49; - } - if ( v19 == 3 ) - { - v17 = rand() % 301 + 200; - goto LABEL_44; - } - if ( v19 == 4 ) - { - v17 = rand() % 501 + 500; -LABEL_44: - v14->uItemID = 198; - goto LABEL_49; - } - if ( v19 == 5 ) - break; - if ( v19 == 6 ) - { - v17 = rand() % 3001 + 2000; -LABEL_41: - v14->uItemID = 199; - } -LABEL_49: - v14->uSpecEnchantmentType = v17; -LABEL_51: - v12 = v13 + 1; -LABEL_52: - --v22; - if ( !v22 ) - goto LABEL_55; - } - v17 = rand() % 1001 + 1000; - goto LABEL_41; - } - goto LABEL_55; - } - v10 = rand() % 501 + 500; - } - v3->uItemID = 198; - goto LABEL_23; - } - v10 = rand() % 101 + 100; - } - v3->uItemID = 197; - goto LABEL_23; - } - pItemsTable->GenerateItem(v9, 0, v3); - goto LABEL_25; - } - v3->GenerateArtifact(); -LABEL_55: - v2 = v20; -LABEL_56: - ++v3; - --v23; - } - while ( v23 ); - v1 = v21 + 1; - ++v21; - } - while ( (signed int)v21 < (signed int)&uNumChests ); -} //----- (00450521) -------------------------------------------------------- signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)