# HG changeset patch # User zipi # Date 1360185582 0 # Node ID 98cd93e14777a1f4ae2da2d44bb1da8a061b4412 # Parent 7bdf8f1150ebe447abd33660c74ae23c9b5c36a6 pointer fixes diff -r 7bdf8f1150eb -r 98cd93e14777 Party.cpp --- a/Party.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/Party.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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 ); @@ -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 7bdf8f1150eb -r 98cd93e14777 mm7_1.cpp --- a/mm7_1.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_1.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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 7bdf8f1150eb -r 98cd93e14777 mm7_2.cpp --- a/mm7_2.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_2.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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; diff -r 7bdf8f1150eb -r 98cd93e14777 mm7_3.cpp --- a/mm7_3.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_3.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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 7bdf8f1150eb -r 98cd93e14777 mm7_4.cpp --- a/mm7_4.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_4.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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[]; diff -r 7bdf8f1150eb -r 98cd93e14777 mm7_5.cpp --- a/mm7_5.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_5.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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,7 +4947,7 @@ int v24; // eax@18 Vec3_int_ v25; // ST04_12@19 unsigned int v26; // ebx@20 - char *v27; // edi@20 + Player *v27; // edi@20 char *v28; // edi@27 int v29; // ebx@29 int v30; // eax@29 @@ -5073,15 +5073,15 @@ 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; diff -r 7bdf8f1150eb -r 98cd93e14777 mm7_6.cpp --- a/mm7_6.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_6.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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 @@ -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 @@ -3263,6 +3276,8 @@ 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 @@ -3985,23 +4000,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 +4227,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 +4305,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 +5163,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; @@ -7104,7 +7120,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 +7136,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 +7145,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)), @@ -7514,21 +7531,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 7bdf8f1150eb -r 98cd93e14777 mm7_data.cpp --- a/mm7_data.cpp Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_data.cpp Wed Feb 06 21:19:42 2013 +0000 @@ -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 7bdf8f1150eb -r 98cd93e14777 mm7_data.h --- a/mm7_data.h Mon Feb 04 17:21:02 2013 +0600 +++ b/mm7_data.h Wed Feb 06 21:19:42 2013 +0000 @@ -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