# HG changeset patch # User Ritor1 # Date 1360223672 -21600 # Node ID 8c0fcfa72fce80785b4ceed4abc0fcf9a1a73304 # Parent bb449743ee81df1bee54f55066f7f2b5bdfe7aa0# Parent 448b02e9b8a35d91affe0e33ef78502e6af4cb41 Слияние diff -r bb449743ee81 -r 8c0fcfa72fce GUIFont.cpp --- a/GUIFont.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/GUIFont.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -463,7 +463,7 @@ size_t v9; // eax@3 signed int v10; // esi@3 int v11; // edx@4 - unsigned __int8 v12; // cl@4 + unsigned int v12; // cl@4 GUIFont *v13; // [sp+Ch] [bp-4h]@1 size_t uXa; // [sp+1Ch] [bp+Ch]@3 @@ -479,38 +479,45 @@ uXa = v9; if ( (signed int)v9 > 0 ) { - while ( !IsCharValid(*v8) ) + while ( v10 < (signed int)uXa ) { -LABEL_11: + if(IsCharValid(*v8)) + { + v12=(unsigned int)v8; + if ( v12 != 9 ) + { + if ( v12 == 10 ) + { + v6 = v6 + *(char *)(v11 + 5) - 3; + if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) + return (int)(v8 + 1); + if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) + return (int)v8; + } + else if ( v12 == 12 ) + { + v8 += 5; + v10 += 5; + if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) + return (int)v8; + } + else if ( v12 != 13 ) + { + if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) + return (int)v8; + } + } + if(v12 == 13 || v12 == 9) + { + v8 += 3; + v10 += 3; + } + if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) + return (int)v8; + } ++v10; ++v8; - if ( v10 >= (signed int)uXa ) - return (int)v8; } - if ( v12 != 9 ) - { - if ( v12 == 10 ) - { - v6 = v6 + *(char *)(v11 + 5) - 3; - if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) - return (int)(v8 + 1); - goto LABEL_10; - } - if ( v12 == 12 ) - { - v8 += 5; - v10 += 5; -LABEL_10: - if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) ) - return (int)v8; - goto LABEL_11; - } - if ( v12 != 13 ) - goto LABEL_10; - } - v8 += 3; - v10 += 3; - goto LABEL_10; } return (int)v8; } diff -r bb449743ee81 -r 8c0fcfa72fce GUIWindow.h --- a/GUIWindow.h Thu Feb 07 13:54:23 2013 +0600 +++ b/GUIWindow.h Thu Feb 07 13:54:32 2013 +0600 @@ -77,7 +77,7 @@ WINDOW_AutonotesBook = 0xC9, WINDOW_MapsBook = 0xCA, WINDOW_CalendarBook = 0xCB, - WINDOW_HistoryBook = 0xCC, + WINDOW_HistoryBook = 0xE0, }; /* 155 */ diff -r bb449743ee81 -r 8c0fcfa72fce Party.cpp --- a/Party.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/Party.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -82,9 +82,9 @@ Party *v1; // esi@1 int v2; // eax@4 signed int v4; // ecx@6 - char *v5; // edx@6 + Player *v5; // edx@6 Player *v6; // eax@7 - char *v7; // ecx@23 + Player *v7; // ecx@23 signed int v8; // esi@23 signed int v9; // edx@23 Player **v10; // edi@23 @@ -101,7 +101,7 @@ return v2 + 1; } v4 = 0; - v5 = (char *)&v1->pPlayers[0].uTimeToRecovery; + v5 = v1->pPlayers;//[0].uTimeToRecovery; while ( 1 ) { v6 = ::pPlayers[v4 + 1]; @@ -111,28 +111,28 @@ || v6->pConditions[14] || v6->pConditions[15] || v6->pConditions[16] - || *(short *)v5 ) + || v5->uTimeToRecovery ) { byte_AE3368[v4] = 1; - goto LABEL_21; } - if ( !byte_AE3368[v4] ) + else if ( !byte_AE3368[v4] ) break; -LABEL_21: ++v4; - v5 += 6972; + ++v5; if ( v4 >= 4 ) - goto LABEL_16; + break; } - v12 = v4; - byte_AE3368[v4] = 1; -LABEL_16: + if(v4<4) + { + v12 = v4; + byte_AE3368[v4] = 1; + } if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] ) memset(byte_AE3368, 0, 4u); v2 = v12; if ( v12 ) return v2 + 1; - v7 = (char *)&v1->pPlayers[0].uSpeedBonus; + v7 = v1->pPlayers;//[0].uSpeedBonus; v8 = 0; v9 = 1; v10 = &::pPlayers[1]; @@ -145,26 +145,25 @@ && !v11->pConditions[14] && !v11->pConditions[15] && !v11->pConditions[16] - && !*((short *)v7 + 3123) ) + && !v7->uTimeToRecovery ) { if ( v12 ) { - if ( *(short *)v7 > v8 ) + if ( v7->uSpeedBonus > v8 ) { - v8 = *(short *)v7; - goto LABEL_35; + v8 = v7->uSpeedBonus; + v12 = v9; } } else { v8 = *(short *)v7; -LABEL_35: v12 = v9; } } ++v10; ++v9; - v7 += 6972; + ++v7; if ( v9 - 1 < 4 ) continue; return v12; @@ -175,15 +174,15 @@ //----- (00493244) -------------------------------------------------------- bool Party::HasItem(unsigned int uItemID) { - char *v2; // edx@1 + Player *v2; // edx@1 signed int v3; // ecx@2 ItemGen *v4; // eax@2 - v2 = (char *)pParty->pPlayers[0].pInventoryItems; - while ( 2 ) + v2 = pParty->pPlayers;//[0].pInventoryItems; + while ( v2 <= &pParty->pPlayers[3] ) { v3 = 0; - v4 = (ItemGen *)v2; + v4 = v2->pInventoryItems; do { if ( v4->uItemID == uItemID ) @@ -192,10 +191,7 @@ ++v4; } while ( v3 < 138 ); - v2 += 6972; - if ( (signed int)v2 < (signed int)&pParty->field_777C[85] ) - continue; - break; + ++v2; } return 0; } @@ -261,16 +257,16 @@ unsigned int Party::GetPartyFame() { signed int v1; // eax@1 - char *v2; // ecx@1 + Player *v2; // ecx@1 signed int v3; // edx@1 v1 = 0; - v2 = (char *)&this->pPlayers[0].uExperience; + v2 = this->pPlayers;//[0].uExperience; v3 = 4; // (E exp) / 1000 do { - v1 += *(int *)v2; - v2 += 6972; + v1 += (int)v2->uExperience; // needs review + ++v2; --v3; } while ( v3 ); @@ -778,7 +774,7 @@ //----- (0043AD34) -------------------------------------------------------- void Party::Yell() { - void *v0; // esi@5 + Actor *v0; // esi@5 int v1; // edi@9 int v2; // ebx@9 int v3; // eax@9 @@ -791,19 +787,19 @@ v4 = 0; if ( (signed int)uNumActors > 0 ) { - v0 = &pActors[0].pMonsterInfo.uMovementType; + v0 = pActors;//[0].pMonsterInfo.uMovementType; do { - if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 ) + if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != 4 && v0->pMonsterInfo.uMovementType != 5 ) { - v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x); - v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.y); - v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.z); + v1 = abs(v0->vPosition.x - pParty->vPosition.x); + v2 = abs(v0->vPosition.y - pParty->vPosition.y); + v3 = abs(v0->vPosition.z - pParty->vPosition.z); if ( (double)sub_4621DA(v1, v2, v3) < 512.0 ) Actor::_402968(v4, 4, 0, 0); } ++v4; - v0 = (char *)v0 + 836; + ++v0; } while ( (signed int)v4 < (signed int)uNumActors ); } @@ -814,7 +810,7 @@ void Party::ResetPosMiscAndSpellBuffs() { Party *v1; // esi@1 - char *v2; // edi@1 + Player *v2; // edi@1 SpellBuff *v3; // ebx@2 SpellBuff *v4; // esi@5 signed int v5; // edi@5 @@ -839,11 +835,11 @@ this->field_6FC = 0; this->field_708 = 15; this->field_0 = 25; - v2 = (char *)this->pPlayers[0].pPlayerBuffs; + v2 = this->pPlayers;//[0].pPlayerBuffs; v6 = 4; do { - v3 = (SpellBuff *)v2; + v3 = v2->pPlayerBuffs; v7 = 24; do { @@ -852,7 +848,7 @@ --v7; } while ( v7 ); - v2 += 6972; + ++v2; --v6; } while ( v6 ); diff -r bb449743ee81 -r 8c0fcfa72fce Player.cpp --- a/Player.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/Player.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -112,10 +112,10 @@ unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; -short word_4EDFFC[30] = {500, 500, 400, 350, 300, 275, 250, 225, 200, 175, +short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, - 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; -unsigned char player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 255, 254, 253, 252, 251, 250, 0}; + 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; +signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; diff -r bb449743ee81 -r 8c0fcfa72fce mm7_1.cpp --- a/mm7_1.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_1.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -3695,7 +3695,7 @@ //----- (0041F6C1) -------------------------------------------------------- void __cdecl RestUI_Initialize() { - char *v0; // eax@10 + Player *v0; // eax@10 if ( !dword_506F14 ) pAudioPlayer->StopChannels(-1, -1); @@ -3718,16 +3718,16 @@ pParty->vPosition.z); if ( sub_476387() ) { - v0 = (char *)&pParty->pPlayers[0].uClass; - while ( *v0 != 31 ) - { - v0 += 6972; - if ( (signed int)v0 >= (signed int)((char *)&pParty->pPickedItem.uExpireTime + 5) ) - goto LABEL_15; - } - ++uRestUI_FoodRequiredToRest; - } -LABEL_15: + v0 = pParty->pPlayers;//[0].uClass; + while ( v0 <= &pParty->pPlayers[3] ) + { + ++v0; + if ( v0 > &pParty->pPlayers[3] ) + break; + } + if(v0->uClass == 31) + ++uRestUI_FoodRequiredToRest; + } if ( CheckHiredNPCSpeciality(0x1Du) ) --uRestUI_FoodRequiredToRest; if ( CheckHiredNPCSpeciality(0x1Eu) ) diff -r bb449743ee81 -r 8c0fcfa72fce mm7_2.cpp --- a/mm7_2.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_2.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -3225,7 +3225,7 @@ void __cdecl sub_4BBCDD() { signed int v0; // ebp@3 - char *v1; // eax@4 + Actor *v1; // eax@4 __int16 v2; // cx@5 int v3; // esi@8 Player *v4; // esi@14 @@ -3242,22 +3242,22 @@ else { v0 = 0; - if ( (signed int)uNumActors <= 0 ) - goto LABEL_23; - v1 = (char *)&pActors[0].uAIState; - v7 = uNumActors; - do - { - v2 = *(short *)v1; - if ( *(short *)v1 == 5 || v2 == 11 || v2 == 19 || (v3 = *((int *)v1 + 159)) != 0 && (v3 & 7) == 4 ) - ++v0; - v1 += 836; - --v7; - } - while ( v7 ); - if ( v0 >= (signed int)uNumActors ) - { -LABEL_23: + if ( (signed int)uNumActors > 0 ) + { + v1 = pActors;//[0].uAIState; + v7 = uNumActors; + do + { + v2 = v1->uAIState; + if ( v1->uAIState == 5 || v2 == 11 || v2 == 19 || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == 4 ) + ++v0; + ++v1; + --v7; + } + while ( v7 ); + } + if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) + { uDialogueType = 91; v4 = pParty->pPlayers; ++*((char *)&pParty->field_75A[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); @@ -5067,7 +5067,7 @@ { char *v1; // eax@2 unsigned int result; // eax@3 - char *v3; // eax@7 + Player *v3; // eax@7 char *v4; // ST24_4@9 int v5; // eax@9 char *v6; // eax@10 @@ -5084,7 +5084,7 @@ unsigned int v18; // [sp+B4h] [bp-1Ch]@5 unsigned int v19; // [sp+B8h] [bp-18h]@5 int v20; // [sp+BCh] [bp-14h]@7 - int i; // [sp+C0h] [bp-10h]@7 + Player *i; // [sp+C0h] [bp-10h]@7 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 @@ -5138,14 +5138,15 @@ v19 = 1; pRenderer->BeginScene(); pWindow.DrawTitleText(pFont, 1u, 0x23u, 1u, pGlobalTXT_LocalizationStrings[9], 3u); - v3 = pParty->pPlayers[0].pName; + v3 = pParty->pPlayers;//[0].pName; v23 = 0i64; v20 = 0; - for ( i = (int)pParty->pPlayers[0].pName; ; v3 = (char *)i ) - { - v4 = pClassNames[(unsigned __int8)v3[17]]; - v5 = ((Player *)(v3 - 168))->GetBaseLevel(); - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i, v5, v4); + //for ( i = (int)pParty->pPlayers[0].pName; ; v3 = (char *)i ) + for ( i = pParty->pPlayers; ; v3 = i ) + { + v4 = pClassNames[v3->uClass]; + v5 = v3->GetBaseLevel(); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4); pWindow.DrawTitleText( pFont, 1u, @@ -5153,10 +5154,10 @@ 1u, pTmpBuf, 3u); - v23 += __PAIR__(*(int *)(i - 4), *(int *)(i - 8)); + v23 += i->uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); ++v20; - i += 6972; - if ( i >= (signed int)&pParty->pPickedItem.uNumCharges ) + ++i; + if ( i > &pParty->pPlayers[3] ) break; } v23 = (signed __int64)v23 / v19; @@ -7780,7 +7781,7 @@ signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) { signed int v3; // ecx@6 - char *v4; // edx@7 + Actor *v4; // edx@7 signed int result; // eax@13 Actor *v6; // esi@16 char *v7; // ebx@16 @@ -7819,17 +7820,17 @@ v20 = uNumActors; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uAIState; - while ( *(short *)v4 != Removed ) + v4 = pActors;//[0].uAIState; + while ( v4->uAIState != Removed ) { ++v3; - v4 += 836; + ++v4; if ( v3 >= (signed int)uNumActors ) - goto LABEL_12; - } - v20 = v3; - } -LABEL_12: + break; + } + if( v3 < (signed int)uNumActors ) + v20 = v3; + } if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) { v21 = 0; @@ -15981,7 +15982,7 @@ int __fastcall sub_46A89E(int a1, int a2, signed int a3) { signed int v3; // edi@1 - char *v4; // esi@2 + Actor *v4; // esi@2 int v5; // ebx@3 int v6; // eax@3 int v7; // ebx@3 @@ -16003,12 +16004,12 @@ v19 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uAIState; + v4 = pActors;//[0].uAIState; do { - v5 = abs(*((short *)v4 - 17) - pParty->vPosition.x); - v17 = abs(*((short *)v4 - 16) - pParty->vPosition.y); - v18 = abs(*((short *)v4 - 15) - pParty->vPosition.z); + v5 = abs(v4->vPosition.x - pParty->vPosition.x); + v17 = abs(v4->vPosition.y - pParty->vPosition.y); + v18 = abs(v4->vPosition.z - pParty->vPosition.z); v6 = v5; v7 = v17; v8 = v18; @@ -16032,8 +16033,8 @@ } if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 ) { - v12 = *(short *)v4; - if ( *(short *)v4 != 5 ) + v12 = v4->uAIState; + if ( v4->uAIState != 5 ) { if ( v12 != 4 ) { @@ -16054,7 +16055,7 @@ } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); } @@ -16352,7 +16353,7 @@ void LayingItem::_46BEF1_apply_spells() { LayingItem *v1; // edi@1 - char *v2; // esi@2 + Actor *v2; // esi@2 __int16 v3; // fps@4 unsigned __int8 v4; // c0@4 unsigned __int8 v5; // c3@4 @@ -16362,28 +16363,28 @@ v1 = this; if ( (signed int)uNumActors > 0 ) { - v2 = (char *)&pActors[0].vPosition.y; + v2 = pActors;//[0].vPosition.y; do { - if ( ((Actor *)(v2 - 144))->CanAct() ) + if ( v2->CanAct() ) { //UNDEF(v3); if ( !(v4 | v5) ) { - if ( stru_50C198.GetMagicalResistance((Actor *)(v2 - 144), 0xAu) ) - { - ((SpellBuff *)&v2[16 * v1->field_48 + 68])->Apply( + if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) + { + v2->pActorBuffs[v1->field_48].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->field_4C << 7) * 0.033333335), v1->field_50, 4u, 0, 0); - *(v2 - 106) |= 8u; + HIWORD(v2->uAttributes) |= 8u; } } } ++v6; - v2 += 836; + ++v2; } while ( v6 < (signed int)uNumActors ); } @@ -16729,7 +16730,7 @@ pActors[v108].uAIState = Standing; pActors[v108].UpdateAnimation(); } - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[v136] + v108 * 836))->Apply( + pActors[v108].pActorBuffs[v136].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), v152, v150, diff -r bb449743ee81 -r 8c0fcfa72fce mm7_3.cpp --- a/mm7_3.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_3.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -18616,7 +18616,7 @@ signed int v29; // edx@66 char *v30; // ecx@67 unsigned __int16 v31; // ax@70 - char *v32; // eax@80 + Player *v32; // eax@80 unsigned __int16 v33; // si@85 int v34; // eax@96 int v35; // eax@97 @@ -18965,14 +18965,14 @@ } } levela = 1; - v32 = (char *)&pParty->pPlayers[0].pConditions[1]; + v32 = pParty->pPlayers;//[0].pConditions[1]; do { - if ( *(_QWORD *)v32 ) + if ( v32->pConditions[1] ) levela = 0; - v32 += 6972; - } - while ( (signed int)v32 < (signed int)&pParty->pHirelings[0].uFlags ); + ++v32; + } + while ( v32 <= &pParty->pPlayers[3] ); if ( !levela ) return; pParty->pPartyBuffs[8].Apply( @@ -21116,7 +21116,8 @@ int v33; // [sp+60h] [bp-14h]@10 int *v34; // [sp+64h] [bp-10h]@6 int v35; // [sp+68h] [bp-Ch]@5 - int v40; // [sp+6Ch] [bp-8h]@1 + Player *v40; // [sp+6Ch] [bp-8h]@1 + int v40b; unsigned int v37; // [sp+70h] [bp-4h]@7 pTurnEngine->field_18 &= 0xFFFFFFFDu; @@ -21125,7 +21126,7 @@ pAudioPlayer->StopChannels(-1, -1); v2 = 0; pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); - v40 = (int)pParty->pPlayers; + v40 = pParty->pPlayers; dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength; dword_50C994 = 0; v1->field_10 = 100; @@ -21136,21 +21137,21 @@ v3 = 0; do { - if ( ((Player *)v40)->CanAct() ) + if ( v40->CanAct() ) { *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = 8 * v3 | OBJECT_Player; v1->pQueue[v1->uActorQueueSize].field_C = 2; v1->pQueue[v1->uActorQueueSize].uActionLength = 0; pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; } - v40 += 6972; + ++v40; ++v3; } - while ( v40 < (signed int)pParty->pHirelings ); + while ( v40 <=&pParty->pPlayers[3] ); v35 = v1->uActorQueueSize; v4 = v35; - v40 = v35; - if ( v40 < v40 + ai_arrays_size ) + v40b = v35; + if ( v40b < v40b + ai_arrays_size ) { v34 = (int *)ai_array_4F7DB0_actor_ids; do @@ -21179,17 +21180,17 @@ } v4 = v35; } - ++v40; + ++v40b; ++v34; } - while ( v40 < v4 + ai_arrays_size ); + while ( v40b < v4 + ai_arrays_size ); v2 = 0; } v11 = __OFSUB__(v1->uActorQueueSize, v2); v9 = v1->uActorQueueSize == v2; v10 = ((v1->uActorQueueSize - v2) & 0x80000000u) != 0; v37 = v2; - v40 = v2; + v40b = v2; if ( !((unsigned __int8)(v10 ^ v11) | v9) ) { v12 = (char *)&v1->pQueue[0].field_4; @@ -21208,11 +21209,11 @@ goto LABEL_26; } v15 = v37++; - *(&a3.uDistance + v15) = v40; + *(&a3.uDistance + v15) = v40b; LABEL_26: - ++v40; + ++v40b; v12 += 16; - if ( v40 >= v1->uActorQueueSize ) + if ( v40b >= v1->uActorQueueSize ) goto LABEL_27; } if ( v13 != 3 ) @@ -21248,15 +21249,15 @@ v34 = (int *)1; do { - v40 = (int)v34; + v40b = (int)v34; if ( (signed int)v34 < (signed int)v37 ) { v19 = (char *)&v31.uDistance + v35; do { v20 = *(int *)v19; - v33 = 4 * v40; - v21 = (char *)(&v31.uDistance + v40); + v33 = 4 * v40b; + v21 = (char *)(&v31.uDistance + v40b); v22 = *(int *)v21; if ( *(int *)v21 < v20 ) { @@ -21270,9 +21271,9 @@ *(int *)v25 = v26; v2 = 0; } - ++v40; - } - while ( v40 < (signed int)v37 ); + ++v40b; + } + while ( v40b < (signed int)v37 ); } v34 = (int *)((char *)v34 + 1); v35 += 4; diff -r bb449743ee81 -r 8c0fcfa72fce mm7_4.cpp --- a/mm7_4.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_4.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -2871,31 +2871,31 @@ //----- (004908DE) -------------------------------------------------------- -signed int __cdecl sub_4908DE() -{ - char *v0; // esi@1 +signed int __cdecl PlayerCreation_Chose4Skills() +{ + Player *v0; // esi@1 signed int v1; // edx@2 - char *v2; // eax@2 + unsigned short *v2; // eax@2 signed int v3; // ecx@2 - v0 = (char *)pParty->pPlayers[0].pActiveSkills; + v0 = pParty->pPlayers;//[0].pActiveSkills; while ( 1 ) { v1 = 0; - v2 = v0; + v2 = v0->pActiveSkills; v3 = 37; do { - if ( *(short *)v2 ) + if ( *v2 ) ++v1; - v2 += 2; + ++v2; --v3; } while ( v3 ); if ( v1 < 4 ) break; - v0 += 6972; - if ( (signed int)v0 >= (signed int)&pParty->field_777C[18] ) + ++v0; + if ( v0 > &pParty->pPlayers[3] ) return 1; } return 0; @@ -9365,13 +9365,13 @@ int v3; // eax@4 signed int v4; // eax@9 int v5; // ebx@11 - char *v6; // esi@13 - char *v7; // eax@14 + Player *v6; // esi@13 + ItemGen *v7; // eax@14 signed int v8; // edi@14 - int v9; // [sp+Ch] [bp-Ch]@11 + ItemGen *v9; // [sp+Ch] [bp-Ch]@11 signed int v10; // [sp+10h] [bp-8h]@13 int v11; // [sp+14h] [bp-4h]@1 - char *v12; // [sp+14h] [bp-4h]@11 + Player *v12; // [sp+14h] [bp-4h]@11 dword_F8B1A8 = 0; v11 = 0; @@ -9380,13 +9380,13 @@ v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; while ( 1 ) { - if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, *(v0 - 1)) ) + if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, *v0) ) { v1 = 0; v2 = pParty->pPlayers; do { - LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *v0); + LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); if ( v3 ) break; ++v2; @@ -9398,55 +9398,57 @@ } ++v11; v0 += 2; - if ( (signed int)v0 >= (signed int)((char *)dword_4F08EC + 2) ) - goto LABEL_10; - } - ptr_F8B1E8 = (char *)pNPCTopics[666].pText; - v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; - dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; - pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); -LABEL_10: + if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) + break; + } + if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) + { + ptr_F8B1E8 = (char *)pNPCTopics[666].pText; + v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; + dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; + pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); + } if ( dword_F8B1A8 == 601 ) { v5 = 0; - v12 = (char *)&pParty->pPlayers[0].uClass; + v12 = pParty->pPlayers;//[0].uClass; v9 = 0; while ( 1 ) { - if ( *v12 == 35 ) + if ( v12->uClass == 35 ) { v10 = 0; - v6 = &pParty->pPlayers[0].pInventoryItems[0].field_1A; + v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; do { - v7 = v6; + v7 = v6->pInventoryItems; v8 = 138; do { - if ( *(int *)(v7 - 26) == 601 ) + if ( v7->uItemID == 601 ) { - if ( !*v7 ) - v9 = (int)(v7 - 26); - if ( (unsigned __int8)*v7 == v5 ) + if ( !v7->field_1A ) + v9 = v7; + if ( v7->field_1A == v5 ) v10 = 1; } - v7 += 36; + ++v7; --v8; } while ( v8 ); - v6 += 6972; - } - while ( (signed int)v6 < (signed int)((char *)&pParty->field_777C[91] + 2) ); + ++v6; + } + while ( v6 <= &pParty->pPlayers[3] ); if ( !v10 ) break; } - v12 += 6972; + ++v12; ++v5; - if ( (signed int)v12 >= (signed int)((char *)&pParty->pPickedItem.uExpireTime + 5) ) + if ( v12 > &pParty->pPlayers[3] ) return; } if ( v9 ) - *(char *)(v9 + 26) = v5; + v9->field_1A = v5; } } // 4F08EC: using guessed type int dword_4F08EC[]; @@ -14434,7 +14436,7 @@ AIDirection a3; // [sp+4h] [bp-68h]@21 AIDirection v14; // [sp+20h] [bp-4Ch]@21 AIDirection v15; // [sp+3Ch] [bp-30h]@21 - SpellBuff *v16; // [sp+58h] [bp-14h]@2 + Actor *v16; // [sp+58h] [bp-14h]@2 int v17; // [sp+5Ch] [bp-10h]@6 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 int v19; // [sp+64h] [bp-8h]@8 @@ -14446,12 +14448,13 @@ v20 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = pActors[0].pActorBuffs; - v16 = pActors[0].pActorBuffs; + //v3 = pActors;//[0].pActorBuffs; + v16 = pActors;//[0].pActorBuffs; + v3 = v16->pActorBuffs; do { - v4 = (Actor *)((char *)&v3[-13] - 4); - if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) + v4 = v16; + if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) v17 = v2; else v17 = 1; @@ -14514,8 +14517,8 @@ } } ++v20; - v3 = (SpellBuff *)((char *)v16 + 836); - v16 = (SpellBuff *)((char *)v16 + 836); + v3 = v16[1].pActorBuffs; + ++v16; } while ( (signed int)v20 < (signed int)uNumActors ); } diff -r bb449743ee81 -r 8c0fcfa72fce mm7_5.cpp --- a/mm7_5.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_5.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -4156,7 +4156,7 @@ if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) { GUIWindow::Create(580, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0); - if ( PlayerCreation_ComputeAttributeBonus() || !sub_4908DE() ) + if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) GameUI_StatusBar_TimedStringTimeLeft = GetTickCount() + 4000; else uGameState = 6; @@ -4947,8 +4947,8 @@ int v24; // eax@18 Vec3_int_ v25; // ST04_12@19 unsigned int v26; // ebx@20 - char *v27; // edi@20 - char *v28; // edi@27 + Player *v27; // edi@20 + Actor *v28; // edi@27 int v29; // ebx@29 int v30; // eax@29 int v31; // edx@29 @@ -5073,39 +5073,39 @@ if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) { v26 = 0; - v27 = (char *)&pParty->pPlayers[0].pConditions[15]; + v27 = pParty->pPlayers;//[0].pConditions[15]; do { - if ( !(*((int *)v27 - 1) | *((int *)v27 - 2)) && !*(_QWORD *)v27 && !*((_QWORD *)v27 + 1) ) + if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); - v27 += 6972; + ++v27; ++v26; } - while ( (signed int)v27 < (signed int)&pParty->pHirelings[1].evtb ); + while ( v27 <= &pParty->pPlayers[3] ); } } uActorID = 0; if ( (signed int)uNumActors > 0 ) { - v28 = (char *)&pActors[0].vPosition.z; + v28 = pActors;//[0].vPosition.z; do { - if ( ((Actor *)(v28 - 146))->CanAct() ) + if ( v28->CanAct() ) { v29 = *(short *)v1; - v30 = *((short *)v28 - 1) - *((short *)v1 - 100); - a1 = *((short *)v28 - 2) - *((short *)v1 - 200); - v31 = *(short *)v28; + v30 = v28->vPosition.y - *((short *)v1 - 100); + a1 = v28->vPosition.x - *((short *)v1 - 200); + v31 = v28->vPosition.z; v48 = v30; v44 = v31; - v32 = ((signed int)*((short *)v28 - 4) >> 1) - v29; - v33 = *((short *)v28 - 5) + *((short *)v1 + 100); + v32 = (v28->uActorHeight >> 1) - v29; + v33 = v28->uActorRadius + *((short *)v1 + 100); if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) { v34.z = *(short *)v1; v34.y = *((short *)v1 - 100); v34.x = *((short *)v1 - 200); - if ( sub_407A1C(*((short *)v28 - 2), *((short *)v28 - 1), *(short *)v28 + 50, v34) ) + if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) { Vec3_int_::Normalize(&a1, &v48, &v44); v35 = pVelocity; @@ -5118,7 +5118,7 @@ DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); break; case 3: - if ( v36 && pActors[v37].GetActorsRelation((Actor *)(v28 - 146)) ) + if ( v36 && pActors[v37].GetActorsRelation(v28) ) sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); break; case 2: @@ -5129,7 +5129,7 @@ } } ++uActorID; - v28 += 836; + ++v28; } while ( (signed int)uActorID < (signed int)uNumActors ); } diff -r bb449743ee81 -r 8c0fcfa72fce mm7_6.cpp --- a/mm7_6.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_6.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -1294,7 +1294,9 @@ //----- (004269A2) -------------------------------------------------------- int __fastcall sub_4269A2_GivePartyExp(unsigned int a1) { - unsigned __int64 v1; // qax@1 + //unsigned __int64 v1; // qax@1 + Player *v1; + int v1b; signed int v2; // ecx@1 int *v3; // esi@1 bool v4; // edi@6 @@ -1302,30 +1304,37 @@ Player *v6; // esi@10 int v7; // eax@13 unsigned __int8 v8; // cf@13 - int v10; // [sp+Ch] [bp-14h]@1 + int v10[4]; // [sp+Ch] [bp-14h]@1 int v11; // [sp+1Ch] [bp-4h]@10 - v1 = __PAIR__((int)((char *)&pParty + 2620), a1); + //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); + v1 = pParty->pPlayers; + v1b = a1; v2 = 0; - v3 = &v10; + v3 = v10; do { - v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) + /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) && !*(int *)HIDWORD(v1) && !*(_QWORD *)(HIDWORD(v1) + 8) - && !*(_QWORD *)(HIDWORD(v1) + 16); + && !*(_QWORD *)(HIDWORD(v1) + 16);*/ + v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) + && !v1->pConditions[14] + && !v1->pConditions[15] + && !v1->pConditions[16]; *v3 = v4; - HIDWORD(v1) += 6972; + //HIDWORD(v1) += 6972; + ++v1; v2 += v4; ++v3; } - while ( SHIDWORD(v1) < (signed int)&pParty->pHirelings[1].field_24 ); + while ( v1 <= &pParty->pPlayers[3] ); if ( v2 ) { - LODWORD(v1) = (signed int)v1 / v2; - v5 = &v10; + v1b = v1b / v2; + v5 = v10; v6 = pParty->pPlayers;//[0].uExperience; - v11 = v1; + v11 = v1b; do { if ( *v5 ) @@ -1333,10 +1342,11 @@ if ( v11 ) { LOBYTE(v7) = v6->GetLearningPercent(); - v1 = v11 + v11 * v7 / 100; - v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); - LODWORD(v6->uExperience) += v1; - HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; + v1b = v11 + v11 * v7 / 100; + //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); + //need review + LODWORD(v6->uExperience) += v1b; + //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; if ( v6->uExperience > 4000000000i64 ) { HIDWORD(v6->uExperience) = 0; @@ -1349,7 +1359,7 @@ } while ( v6 <= &pParty->pPlayers[3] ); } - return v1; + return v1b; } //----- (00426A5A) -------------------------------------------------------- @@ -1720,9 +1730,9 @@ unsigned __int8 v3; // cf@11 unsigned __int8 v4; // zf@11 SpellBuff *v6; // ecx@46 - char *v7; // esi@49 + Player *v7; // esi@49 signed int v8; // edx@50 - char *v9; // ecx@50 + SpellBuff *v9; // ecx@50 if ( a2 > 73 ) { @@ -1738,22 +1748,25 @@ while ( (signed __int64)v6->uExpireTime <= 0 ) { ++v6; - if ( (signed int)v6 >= (signed int)pParty->pPlayers ) - { - v7 = (char *)pParty->pPlayers[0].pPlayerBuffs; -LABEL_50: + if ( v6 > &pParty->pPartyBuffs[19] ) + { + v7 = pParty->pPlayers;//[0].pPlayerBuffs; v8 = 0; - v9 = v7; - while ( *(_QWORD *)v9 <= 0i64 ) + v9 = v7->pPlayerBuffs; + while ( v9->uExpireTime <= 0i64 ) { ++v8; - v9 += 16; + ++v9; if ( v8 >= 24 ) { - v7 += 6972; - if ( (signed int)v7 < (signed int)&pParty->field_871C[464] ) - goto LABEL_50; - return 0; + ++v7; + if ( v7 <= &pParty->pPlayers[3] ) + { + v8 = 0; + v9 = v7->pPlayerBuffs; + } + else + return 0; } } return 1; @@ -1802,9 +1815,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 5 ) + else if ( a2 == 5 ) { if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) return 1; @@ -1812,9 +1824,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 17 ) + else if ( a2 == 17 ) { if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) return 1; @@ -1822,9 +1833,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 38 ) + else if ( a2 == 38 ) { if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) return 1; @@ -1832,9 +1842,8 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 == 46 ) + else if ( a2 == 46 ) { if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) return 1; @@ -1842,28 +1851,32 @@ return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; - goto LABEL_15; } - if ( a2 != 47 ) - { - if ( a2 != 51 || SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) - { - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; - goto LABEL_15; - } - return 0; - } - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + else + { + if ( a2 != 47 ) + { + if ( a2 != 51 || SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) + { + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; + } + else + return 0; + } + else + { + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + } + } } -LABEL_15: if ( !(v3 | v4) ) return 0; return 1; @@ -2601,7 +2614,7 @@ const char *v66; // ecx@200 unsigned int v67; // edx@201 char v68; // al@207 - int v69; // esi@211 + ItemGen *v69; // esi@211 int v70; // ecx@214 int v71; // ecx@215 int v72; // ecx@216 @@ -2624,7 +2637,7 @@ stru6 *v89; // eax@245 double v90; // st7@245 int v91; // eax@250 - char *v92; // eax@255 + Player *v92; // eax@255 __int16 v93; // ST18_2@260 stru6 *v94; // eax@260 __int16 v95; // ST18_2@260 @@ -3050,7 +3063,7 @@ int v515; // ecx@951 int v516; // eax@953 int v517; // eax@956 - char *v518; // edx@957 + Actor *v518; // edx@957 __int16 v519; // cx@958 int v520; // ecx@968 int v521; // ecx@969 @@ -3085,7 +3098,7 @@ unsigned __int16 v550; // di@991 int v551; // ecx@993 int v552; // ecx@994 - char *v553; // edi@1001 + Player *v553; // edi@1001 __int16 v554; // ST18_2@1002 stru6 *v555; // eax@1002 __int16 v556; // ST18_2@1002 @@ -3144,8 +3157,8 @@ signed int v609; // eax@1104 int v610; // edi@1106 unsigned int v611; // eax@1106 - char *v612; // edi@1106 - char *v613; // eax@1108 + Player *v612; // edi@1106 + DDM_DLV_Header *v613; // eax@1108 int v614; // eax@1116 int v615; // edi@1119 __int16 v616; // ST1C_2@1122 @@ -3259,10 +3272,13 @@ ItemGen *_this; // [sp+E50h] [bp-34h]@23 float v725; // [sp+E54h] [bp-30h]@23 Player *v726; // [sp+E58h] [bp-2Ch]@131 + int v726b; float v727; // [sp+E5Ch] [bp-28h]@1 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 Player *pPlayer; // [sp+E64h] [bp-20h]@8 int v730; // [sp+E68h] [bp-1Ch]@53 + Player *v730b; + ItemGen *v730c; int v731; // [sp+E6Ch] [bp-18h]@48 signed int v732; // [sp+E70h] [bp-14h]@325 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 @@ -3693,9 +3709,9 @@ goto LABEL_83; v726 = (Player *)(a2 >> 3); HIDWORD(v733) = 836 * (a2 >> 3); - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + HIDWORD(v733)), 3u) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u) ) goto LABEL_1056; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[10] + HIDWORD(v733)))->Apply( + pActors[a2 >> 3].pActorBuffs[10].Apply( pMiscTimer->uTotalGameTimeElapsed + 128, v1, v1, @@ -3883,8 +3899,8 @@ goto LABEL_83; if ( (a2 & 7) != 3 || (v721 = 836 * (a2 >> 3), - LODWORD(v718) = (int)(char *)pActors + v721, - !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v721), 3u)) ) + LODWORD(v718) = (int)&pActors[a2 >> 3], + !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u)) ) goto LABEL_1056; v726 = (Player *)(23040 * v2); v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); @@ -3903,7 +3919,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; v730 = 836 * (a2 >> 3); - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 7u) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[a2>>3], 7u) ) goto LABEL_1056; LODWORD(v733) = 300 * v2; if ( v731 == 2 ) @@ -3929,7 +3945,7 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = a2 >> 3; goto LABEL_1086; case 92: if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -3985,23 +4001,23 @@ LABEL_196: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; - v730 = (int)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; - v726 = (Player *)&pItemsTable->pItems[*(int *)v730].pIconName; - ((ItemGen *)v730)->UpdateTempBonus(pParty->uTimePlayed); - if ( *(int *)v730 < 64 || *(int *)v730 > 65 ) - { - if ( !(*(char *)(v730 + 20) & 2) ) + v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; + v726 = (Player *)&pItemsTable->pItems[v730c->uItemID].pIconName; + v730c->UpdateTempBonus(pParty->uTimePlayed); + if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) + { + if ( !(v730c->uAttributes & 2) ) { - if ( *(int *)(v730 + 12) == v1 ) + if ( v730c->uAdditionalValue == v1 ) { - if ( *(int *)(v730 + 4) == v1 ) + if ( v730c->_bonus_type == v1 ) { v68 = BYTE4(v726->pConditions[3]); if ( !v68 || v68 == 1 || v68 == 2 ) { - if ( !pItemsTable->_456D5E_is_some_material((ItemGen *)v730) ) + if ( !pItemsTable->_456D5E_is_some_material(v730c) ) { - v69 = v730; + v69 = v730c; v14 = v731 == 4; *(int *)(v730 + 12) = amount; if ( !v14 ) @@ -4212,15 +4228,15 @@ LABEL_254: if ( pPlayer->CanCastSpell(uRequiredMana) ) { - v92 = (char *)&pParty->pPlayers[0].pConditions[1]; + v92 = pParty->pPlayers;//[0].pConditions[1]; LODWORD(v727) = 1; do { - if ( *(_QWORD *)v92 ) + if ( v92->pConditions ) LODWORD(v727) = v1; - v92 += 6972; + ++v92; } - while ( (signed int)v92 < (signed int)&pParty->pHirelings[0].uFlags ); + while ( v92 <= &pParty->pPlayers[3] ); if ( LODWORD(v727) != v1 ) { v726 = (Player *)((int)v733 << 7); @@ -4290,18 +4306,18 @@ v105 = 0; v726 = (Player *)((int)v733 << 7); v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); - v730 = (int)&pParty->pPlayers[0].pPlayerBuffs[1]; + v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; do { v106 = v3->spellnum; v107 = pGame->GetStru6(); pGame->GetStru6()->SetPlayerBuffAnim(v106, v105); v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, v1, 65536); - ((SpellBuff *)v730)->Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1); - v730 += 6972; + v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1); + ++v730b; ++v105; } - while ( v730 < (signed int)&pParty->field_871C[468] ); + while ( v730b <= &pParty->pPlayers[3] ); goto LABEL_1056; case 52: if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == 3 ) @@ -5148,7 +5164,8 @@ v239); if ( v731 == 4 ) pParty->pPartyBuffs[18].uFlags = 1; - goto LABEL_1112; + LODWORD(v727) = v232; + goto LABEL_83; case 28: if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; @@ -6291,23 +6308,23 @@ v730 = 836 * v426; if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) { - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); + pActors[v426].pActorBuffs[1].Reset(); + pActors[v426].pActorBuffs[12].Reset(); v732 = amount << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Apply( + pActors[v426].pActorBuffs[9].Apply( pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), v731, v1, v1, v1); - *(&pActors[0].pMonsterInfo.uHostilityType + v730) = MonsterInfo::Hostility_Long; + pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v426; goto LABEL_1086; case 66: if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -6319,12 +6336,12 @@ v730 = 836 * v427; if ( MonsterStats::BelongsToSupertype(pActors[v427].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) goto LABEL_83; - if ( stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 7u) ) - { - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); + if ( stru_50C198.GetMagicalResistance(&pActors[v427], 7u) ) + { + pActors[v427].pActorBuffs[9].Reset(); + pActors[v427].pActorBuffs[1].Reset(); v732 = amount << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Apply( + pActors[v427].pActorBuffs[12].Apply( pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), v731, v1, @@ -6336,7 +6353,7 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v427; goto LABEL_1086; case 63: v428 = v12 - 2; @@ -6900,17 +6917,17 @@ LOBYTE(v517) = v517 | 4; if ( (signed int)uNumActors > v1 ) { - v518 = (char *)&pActors[0].uAIState; - v726 = (Player *)uNumActors; + v518 = pActors;//[0].uAIState; + v726b = uNumActors; do { - v519 = *(short *)v518; - if ( *(short *)v518 != 5 && v519 != 11 && v519 != 19 && v517 == *((int *)v518 + 159) ) + v519 = v518->uAIState; + if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && v517 == v518->uSummonerID ) ++HIDWORD(v733); - v518 += 836; - v726 = (Player *)((char *)v726 - 1); + ++v518; + --v726; } - while ( *(float *)&v726 != 0.0 ); + while ( v726 != 0 ); } if ( SHIDWORD(v733) >= amount ) { @@ -7104,7 +7121,7 @@ v732 = (300 * amount * v2 + 60) << 7; v730 = v2 + 5; v726 = (Player *)v1; - v553 = (char *)&pParty->pPlayers[0].pConditions[1]; + v553 = pParty->pPlayers;//[0].pConditions[1]; *((float *)&v733 + 1) = (double)v732 * 0.033333335; do { @@ -7120,7 +7137,8 @@ v560 = v3->spellnum; v561 = pGame->GetStru6(); pGame->GetStru6()->SetPlayerBuffAnim(v560, 3u); - ((SpellBuff *)(v553 + 6056))->Apply( + //((SpellBuff *)(v553 + 6056))->Apply( + v553->pPlayerBuffs[4].Apply( (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, @@ -7128,9 +7146,9 @@ v1); if ( *(_QWORD *)v553 ) v726 = (Player *)1; - v553 += 6972; - } - while ( (signed int)v553 < (signed int)&pParty->pHirelings[0].uFlags ); + ++v553; + } + while ( v553 <= &pParty->pPlayers[3] ); v562 = v731; pParty->pPartyBuffs[9].Apply( (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), @@ -7420,12 +7438,12 @@ v730 = 836 * v599; if ( !MonsterStats::BelongsToSupertype(pActors[v599].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) goto LABEL_83; - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 0xAu) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[v599], 0xAu) ) goto LABEL_200; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); + pActors[v599].pActorBuffs[9].Reset(); + pActors[v599].pActorBuffs[1].Reset(); v732 = (int)v733 << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Apply( + pActors[v599].pActorBuffs[12].Apply( pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v1, @@ -7436,14 +7454,14 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v599; LABEL_1086: - v600 = *(__int16 *)((char *)&pActors[0].vPosition.y + v61); - v601 = *(__int16 *)((char *)&pActors[0].vPosition.x + v61); + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; a1.uObjectDescID = v60; a1.vPosition.x = v601; - v602 = *(unsigned __int16 *)((char *)&pActors[0].uActorHeight + v61); - v603 = *(__int16 *)((char *)&pActors[0].vPosition.z + v61); + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; a1.vPosition.y = v600; v676 = v603 + v602; v665 = v600; @@ -7514,21 +7532,20 @@ v611); v232 = 1; *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; - v612 = (char *)pParty->pPlayers; + v612 = pParty->pPlayers; do { - *((int *)v612 + 1615) = ((Player *)v612)->GetMaxHealth(); - *((int *)v612 + 1616) = ((Player *)v612)->GetMaxMana(); - v612 += 6972; - } - while ( (signed int)v612 < (signed int)pParty->pHirelings ); - v613 = (char *)&pOutdoor->ddm; + v612->sHealth = v612->GetMaxHealth(); + v612->sMana = v612->GetMaxMana(); + ++v612; + } + while ( v612 <= &pParty->pPlayers[3] ); + v613 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) - v613 = (char *)&pIndoor->dlv; - *((int *)v613 + 2) += 15; - if ( *((int *)v613 + 2) > 10000 ) - *((int *)v613 + 2) = 10000; -LABEL_1112: + v613 = &pIndoor->dlv; + v613->uReputation += 15; + if ( v613->uReputation > 10000 ) + v613->uReputation = 10000; LODWORD(v727) = v232; goto LABEL_83; case 95: diff -r bb449743ee81 -r 8c0fcfa72fce mm7_data.cpp --- a/mm7_data.cpp Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_data.cpp Thu Feb 07 13:54:32 2013 +0600 @@ -1138,7 +1138,16 @@ __int16 word_4F0754[49]; __int16 word_4F07B6[88]; __int16 word_4F0866[14]; -__int16 _4F0882_evt_VAR_PlayerItemInHands_vals[53]; +__int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]= +{ + 0x0D4, 0x270, 0x0D5, 0x21C, 0x0D6, 0x2BE, 0x0D7, 0x2BD, 0x0D8, 0x289, + 0x0D9, 0x258, 0x0DA, 0x2AB, 0x0DB, 0x281, 0x0DC, 0x280, 0x0DD, + 0x284, 0x0DE, 0x285, 0x0DF, 0x283, 0x0E0, 0x282, 0x0E1, 0x27F, + 0x0E2, 0x1E7, 0x0E3, 0x287, 0x0E4, 0x272, 0x0E5, 0x267, 0x0E6, + 0x275, 0x0E7, 0x25A, 0x0E8, 0x2A4, 0x0E9, 0x2A5, 0x0EA, 0x2A3, + 0x0EB, 0x25C, 0x0EC, 0x25D, 0x0ED, 0x259, 0x0F1, 0x21E +} +; int dword_4F08EC[777]; // weak char byte_4F09B0[777]; // weak char byte_4F09B1[777]; // weak diff -r bb449743ee81 -r 8c0fcfa72fce mm7_data.h --- a/mm7_data.h Thu Feb 07 13:54:23 2013 +0600 +++ b/mm7_data.h Thu Feb 07 13:54:32 2013 +0600 @@ -1014,7 +1014,7 @@ extern __int16 word_4F0754[49]; extern __int16 word_4F07B6[88]; extern __int16 word_4F0866[14]; -extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[53]; +extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]; extern int dword_4F08EC[]; // weak extern char byte_4F09B0[]; // weak extern char byte_4F09B1[]; // weak @@ -2254,7 +2254,7 @@ void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6); unsigned int ReplaceHSV(unsigned int uColor, float a2, float gamma, float a4); int _48B561_mess_with_scaling_along_z(/*int a1, */float a2); -signed int __cdecl sub_4908DE(); +signed int __cdecl PlayerCreation_Chose4Skills(); signed int __cdecl PlayerCreation_ComputeAttributeBonus(); void __cdecl LoadPlayerPortraintsAndVoices(); int __fastcall ReloadPlayerPortraits(int, int); // weak