# HG changeset patch # User Ritor1 # Date 1359947869 -21600 # Node ID 170259c8c71fd243326bf23bba96e441b595cec4 # Parent ec84db4c8f9d2fe27257be78a5f46a4e9fd5189b# Parent be45fc285970a5f62bb37ca508d5128753ee85f1 Слияние diff -r ec84db4c8f9d -r 170259c8c71f Actor.cpp --- a/Actor.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Actor.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -1435,7 +1435,7 @@ void Actor::_43AC45(unsigned int uActorID, int a2) { Actor *v2; // esi@1 - char *v3; // edi@4 + Actor *v3; // edi@4 int v4; // ebx@8 int v5; // ST1C_4@8 int v6; // eax@8 @@ -1451,29 +1451,29 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = (char *)&pActors[0].vPosition.y; + v3 = pActors; do { - if ( ((Actor *)(v3 - 144))->CanAct() ) + if ( v3->CanAct() ) { if ( v9 != uActorID_ ) { - if ( Actor::_43ABB0(v2, (Actor *)(v3 - 144)) ) + if ( Actor::_43ABB0(v2, v3) ) { - v4 = abs(*((short *)v3 - 1) - v2->vPosition.x); - v5 = abs(*(short *)v3 - v2->vPosition.y); - v6 = abs(*((short *)v3 + 1) - v2->vPosition.z); + v4 = abs(v3->vPosition.x - v2->vPosition.x); + v5 = abs(v3->vPosition.y - v2->vPosition.y); + v6 = abs(v3->vPosition.z - v2->vPosition.z); if ( (double)sub_4621DA(v4, v5, v6) < 4096.0 ) { - *(v3 - 83) = 4; + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)4; if ( v7 == 1 ) - *(v3 - 106) |= 8u; + BYTE2(v3->uAttributes) |= 8u; } } } } ++v9; - v3 += 836; + ++v3; } while ( v9 < (signed int)uNumActors ); } @@ -3026,7 +3026,7 @@ signed int v6; // edx@2 ActorJob *v7; // eax@2 signed int v8; // edi@2 - char *v9; // ecx@2 + ActorJob *v9; // ecx@2 __int16 v10; // cx@15 signed int v12; // [sp+8h] [bp-4h]@1 @@ -3039,16 +3039,16 @@ v6 = 65535; v7 = &v4->pScheduledJobs[v3]; v8 = 7; - v9 = (char *)&v7[7].uHour; - while ( !(*(v9 - 3) & 1) || (unsigned __int8)*v9 > v12 ) + v9 = &v7[7];//(char *)&v7[7].uHour; + while ( !(v9->uAttributes & 1) || v9->uHour > v12 ) { --v8; - v9 -= 12; + --v9; if ( v8 < 0 ) - goto LABEL_8; + break; } - v6 = v8; -LABEL_8: + if( v8 >= 0 ) + v6 = v8; if ( !v8 && v6 == 65535 ) v6 = 7; v5 = &v7[v6]; @@ -3692,7 +3692,7 @@ unsigned int v4; // ebx@1 int v5; // ecx@1 unsigned int v6; // eax@1 - char *v7; // edi@2 + Actor *v7; // edi@2 __int16 v8; // ax@3 int v9; // eax@10 signed int v10; // eax@13 @@ -3728,25 +3728,25 @@ v26 = 0; if ( (signed int)uNumActors <= 0 ) goto LABEL_26; - v7 = (char *)&pActors[0].uAIState; + v7 = pActors; do { - v8 = *(short *)v7; - if ( *(short *)v7 == 5 || v8 == 4 || v8 == 11 || v8 == 17 || v8 == 19 || v22 == v5 ) + v8 = v7->uAIState; + if ( v7->uAIState == 5 || v8 == 4 || v8 == 11 || v8 == 17 || v8 == 19 || v22 == v5 ) goto LABEL_23; if ( v24 == v4 || (v9 = 8 * v5, LOBYTE(v9) = 8 * v5 | 3, v24 != v9) ) goto LABEL_13; - if ( ((Actor *)(v7 - 176))->IsAlive() == 1 ) + if ( v7->IsAlive() == 1 ) { v24 = v4; v3->uLastCharacterIDToHit = v4; LABEL_13: - v10 = v3->GetActorsRelation((Actor *)(v7 - 176)); + v10 = v3->GetActorsRelation(v7); if ( v10 == v4 ) goto LABEL_23; goto LABEL_14; } - v18 = *((unsigned int *)v7 + 133); + v18 = v7->uGroup; if ( (v18 != v4 || v3->uGroup != v4) && v18 == v3->uGroup ) goto LABEL_23; v10 = 4; @@ -3754,9 +3754,9 @@ if ( v3->pMonsterInfo.uHostilityType ) v10 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uHostilityType; v11 = dword_4DF380[v10]; - v23 = abs(v3->vPosition.x - *((short *)v7 - 17)); - v27 = abs(v3->vPosition.y - *((short *)v7 - 16)); - v12 = abs(v3->vPosition.z - *((short *)v7 - 15)); + v23 = abs(v3->vPosition.x - v7->vPosition.x); + v27 = abs(v3->vPosition.y - v7->vPosition.y); + v12 = abs(v3->vPosition.z - v7->vPosition.z); v19 = v12; if ( v23 <= v11 && v27 <= v11 @@ -3769,7 +3769,7 @@ } v4 = 0; LABEL_23: - v7 += 836; + ++v7; v5 = v26++ + 1; } while ( v26 < (signed int)uNumActors ); diff -r ec84db4c8f9d -r 170259c8c71f AudioPlayer.cpp --- a/AudioPlayer.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/AudioPlayer.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -1797,7 +1797,7 @@ { //AudioPlayer *v3; // esi@1 int v4; // ecx@1 - char *v5; // edi@4 + AudioPlayer_3DSample *v5; // edi@4 int v6; // ebx@12 MixerChannel *pChannel; // edi@14 //_STREAM *v8; // esi@23 @@ -1812,16 +1812,16 @@ v9 = 0; if ( uNum3DSamples > 0 ) { - v5 = (char *)&p3DSamples[0].field_8; + v5 = p3DSamples;//;(char *)&p3DSamples[0].field_8; do { if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) - && *(int *)v5 - && pSoundList->pSounds[*(int *)v5].eType != SOUND_DESC_SYSTEM) + && v5->field_8 + && pSoundList->pSounds[v5->field_8].eType != SOUND_DESC_SYSTEM) { - AIL_end_3D_sample(*((int **)v5 - 2)); - _4ABF23((AudioPlayer_3DSample *)(v5 - 8)); - *((int *)v5 - 1) = 0; + AIL_end_3D_sample(v5->hSample); + _4ABF23(v5); + v5->field_4 = 0; v4 = v9; } ++v4; diff -r ec84db4c8f9d -r 170259c8c71f GUIWindow.cpp --- a/GUIWindow.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/GUIWindow.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -20,6 +20,7 @@ #include "FactionTable.h" #include "StorylineTextTable.h" #include "Events2D.h" +#include "Autonotes.h" #include "mm7_data.h" @@ -477,7 +478,7 @@ dword_506524 = 0; dword_506528 = 0; dword_50651C = 0; - dword_506520 = 0; + dword_506520 = 0; if ( v1->ptr_1C == (void *)177 ) { byte_506360 = 0; @@ -562,11 +563,11 @@ memset(&pStru179, 0, 0xFA0u); for ( i = dword_506528; i < 512; ++i ) { - v14 = (&dword_722F10)[4 * i]; + v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i]; if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, i) && v14 ) { v15 = dword_506520++; - pStru179->field_0[v15] = i; + pStru179.field_0[v15] = i; } } } @@ -613,15 +614,16 @@ dword_506520 = 0; while ( v10 < 196 ) { - if ( dword_506568 == dword_72371C[2 * v10] ) + if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) { - v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; + //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; + v25 = (char *)pAutonoteTxt[v10-1].pText; if ( (short)v10 ) { if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) { v11 = dword_506520++; - pStru179->field_0[v11] = (signed __int16)v10; + pStru179.field_0[v11] = (signed __int16)v10; } } } diff -r ec84db4c8f9d -r 170259c8c71f Outdoor.cpp --- a/Outdoor.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Outdoor.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -58,7 +58,9 @@ v1 = 2; pIndoorCamera->sRotationX = pParty->sRotationX; pIndoorCamera->sRotationY = pParty->sRotationY; - pIndoorCamera->pos.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->field_18) >> 16); + pIndoorCamera->pos.x = pParty->vPosition.x + - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) + * (signed __int64)pParty->field_18) >> 16); v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); pIndoorCamera->field_4C = v1; pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); @@ -87,27 +89,27 @@ if ( !pRenderer->pRenderD3D ) { pRenderer->OnOutdoorRedrawSW(); - goto LABEL_16; } - //goto LABEL_14; - pRenderer->DrawSkyD3D(); - pRenderer->DrawBuildingsD3D(); - pRenderer->DrawBezierTerrain(); - goto LABEL_16; + else + { + pRenderer->DrawSkyD3D(); + pRenderer->DrawBuildingsD3D(); + pRenderer->DrawBezierTerrain(); + } } - if ( pRenderer->pRenderD3D ) + else if ( pRenderer->pRenderD3D ) { -//LABEL_14: pRenderer->DrawSkyD3D(); pRenderer->DrawBuildingsD3D(); pRenderer->DrawBezierTerrain();// Ritor1: sometimes crash - goto LABEL_16; } - pRenderer->DrawBuildingsSW(); - pRenderer->DrawBezierTerrain(); - sr_sub_486F92_MessWithEdgesAndSpans(); - pOutdoorCamera->_487355(); -LABEL_16: + else + { + pRenderer->DrawBuildingsSW(); + pRenderer->DrawBezierTerrain(); + sr_sub_486F92_MessWithEdgesAndSpans(); + pOutdoorCamera->_487355(); + } pMobileLightsStack->uNumLightsActive = 0; pStationaryLightsStack->uNumLightsActive = 0; if ( !pRenderer->pRenderD3D ) @@ -217,7 +219,7 @@ // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); //----- (00488EEF) -------------------------------------------------------- -unsigned int OutdoorLocation::GetTileTexture(int sX, int sZ) +unsigned int OutdoorLocation::GetTileTexture(int sX, int sY) { //OutdoorLocation *v3; // esi@1 unsigned int v4; // edi@1 @@ -232,7 +234,7 @@ else result = DoGetTileTexture(v5, v4); return result;*/ - v4 = WorldPosToGridCellZ(sZ); + v4 = WorldPosToGridCellZ(sY); v5 = WorldPosToGridCellX(sX); if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) return -1; @@ -1770,7 +1772,7 @@ for (uint i = 0; i < uNumBModels; ++i) { //v48 = 0; - auto model = pBModels + i; + auto model = &pBModels[i]; model->pVertices.pVertices = nullptr; model->pFaces = nullptr; @@ -1854,7 +1856,7 @@ //v149 = 0; //Str2 = (char *)ptr; - auto face = model->pFaces + j; + auto *face = &model->pFaces[j]; //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces; if (~face->uAttributes & 0x40) { @@ -2128,16 +2130,16 @@ //v151 = 0; for (uint i = 0; i < uNumBModels; ++i) { - auto model = pBModels + i; + auto model = pBModels[i]; //pNumItems = 0; //do //{ //v86 = pBModels; //thisa = 0; //v87 = (unsigned int)((char *)v86 + pNumItems); - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //if ( *(int *)(v87 + 76) > 0 ) //{ @@ -2145,7 +2147,7 @@ //do //{ //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); - memcpy(&face->uAttributes, pSrc, 4); + memcpy(&face.uAttributes, pSrc, 4); pSrc += 4; //v88 = pBModels; //++File; @@ -2158,20 +2160,20 @@ //v89 = pBModels; //thisa = 0; - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //pFilename = 0; //do //{ //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)]; //File = v90; - if (face->sCogTriggeredID) + if (face.sCogTriggeredID) { - if (face->HasEventHint()) - BYTE2(face->uAttributes) |= 0x10u; + if (face.HasEventHint()) + BYTE2(face.uAttributes) |= 0x10u; else - BYTE2(face->uAttributes) &= 0xEFu; + BYTE2(face.uAttributes) &= 0xEFu; } //++thisa; //v89 = pBModels; @@ -2397,9 +2399,9 @@ } //----- (0047ED08) -------------------------------------------------------- -unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uZ) +unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY) { - int uTileID; // esi@5 + int v3; // esi@5 unsigned int result; // eax@9 @@ -2416,19 +2418,19 @@ result = pTileTable->pTiles[v3].uBitmapID; } return result;*/ - if (uX > 127 || uZ > 127) + if (uX > 127 || uY > 127) return 0; - uTileID = this->pTerrain.pTilemap[uZ * 128 + uX]; - if (uTileID < 198) + v3 = this->pTerrain.pTilemap[uY * 128 + uX]; + if (v3 < 198) { - if (uTileID >= 90) - uTileID = uTileID + this->pTileTypes[(uTileID - 90) / 18].uTileID - 36 * (uTileID - 90) / 36 - 90; + if (v3 >= 90) + v3 = v3 + this->pTileTypes[(v3 - 90) / 18].uTileID - 36 * (v3 - 90) / 36 - 90; } else - uTileID = uTileID + this->pTileTypes[3].uTileID - 198; + v3 = v3 + this->pTileTypes[3].uTileID - 198; - return pTileTable->pTiles[uTileID].uBitmapID; + return pTileTable->pTiles[v3].uBitmapID; } //----- (0047ED83) -------------------------------------------------------- @@ -2787,7 +2789,7 @@ bool OutdoorLocation::InitalizeActors(int a1) { int v2; // ebx@1 - char *v3; // esi@2 + Actor *v3; // esi@2 int v4; // eax@3 __int16 v5; // ax@11 int v8; // [sp+348h] [bp-8h]@1 @@ -2798,50 +2800,67 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = (char *)&pActors[0].uAttributes; - while ( 1 ) - { - v4 = *(int *)v3; - if ( !(v4 & 0x100000) ) - break; - if ( a1 == v2 ) - goto LABEL_8; - if ( v8 != v2 ) - goto LABEL_9; - *((short *)v3 + 70) = 19; - *(int *)v3 = v4 | 0x10000; - v8 = GetAlertStatus(); -LABEL_17: - ++v9; - v3 += 836; - if ( v9 >= (signed int)uNumActors ) - goto LABEL_18; - } - if ( v8 != 1 ) + v3 = pActors;//[0].uAttributes; + while ( v9 < (signed int)uNumActors ) { -LABEL_9: - *((int *)v3 + 37) = v2; - *((short *)v3 + 62) = v2; - if ( v4 & 0x10000 ) - *((short *)v3 + 70) = 19; - v5 = *((short *)v3 + 70); - if ( v5 != 11 && v5 != 19 && (*((short *)v3 + 2) == (short)v2 || *((int *)v3 + 18) == v2) ) - *((short *)v3 + 70) = 5; - *((short *)v3 + 56) = v2; - *((short *)v3 + 57) = v2; - *((short *)v3 + 58) = v2; - ((Actor *)(v3 - 36))->UpdateAnimation(); - v3[25] = 0; - ((Actor *)(v3 - 36))->PrepareSprites(0); - v2 = 0; - goto LABEL_17; + v4 = v3->uAttributes; + if ( !(v4 & 0x100000) ) + { + if ( v8 != 1 ) + { + v3->uCurrentActionTime = v2; + v3->uCurrentActionLength = v2; + if ( v4 & 0x10000 ) + v3->uAIState = (AIState) 19; + v5 = v3->uAIState; + if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) + v3->uAIState = (AIState) 5; + v3->vVelocity.x = v2; + v3->vVelocity.y = v2; + v3->vVelocity.z = v2; + v3->UpdateAnimation(); + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + v3->PrepareSprites(0); + v2 = 0; + } + else + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + } + } + else if ( a1 == v2 ) + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + } + else if ( v8 != v2 ) + { + v3->uCurrentActionTime = v2; + v3->uCurrentActionLength = v2; + if ( v4 & 0x10000 ) + v3->uAIState = (AIState) 19; + v5 = v3->uAIState; + if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) + v3->uAIState = (AIState) 5; + v3->vVelocity.x = v2; + v3->vVelocity.y = v2; + v3->vVelocity.z = v2; + v3->UpdateAnimation(); + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + v3->PrepareSprites(0); + v2 = 0; + } + else + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + v8 = GetAlertStatus(); + } + ++v9; + ++v3; } -LABEL_8: - *((short *)v3 + 70) = 19; - *(int *)v3 = v4 | 0x10000; - goto LABEL_17; } -LABEL_18: pGameLoadingUI_ProgressBar->Progress(); Actor thisa; @@ -2874,7 +2893,7 @@ unsigned int OutdoorLocation::DrawActors() { unsigned int result; // eax@1 - char *v1; // edi@2 + Actor *v1; // edi@2 __int16 v2; // ax@3 int v3; // esi@5 float v4; // ST48_4@8 @@ -2942,23 +2961,23 @@ if ( (signed int)uNumActors > 0 ) { v54 = 0; - v1 = (char *)&pActors[0].vPosition.z; + v1 = pActors;//[0].vPosition.z; do { - v2 = *((short *)v1 + 15); - *(int *)(v1 - 110) &= 0xFFFFFFF7u; + v2 = v1->uAIState; + v1->uAttributes &= 0xFFFFFFF7u; if ( v2 == 11 || v2 == 19 ) goto LABEL_58; - v3 = *(short *)v1; + v3 = v1->vPosition.z; v49 = 0; - x = *((short *)v1 - 2); - y = *((short *)v1 - 1); - v61 = *(short *)v1; + x = v1->vPosition.x; + y = v1->vPosition.y; + v61 = v1->vPosition.z; if ( v2 == 17 ) { - if ( (v1[666] & 7) != 3 || pActors[*(int *)(v1 + 666) >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) + if ( (v1->uSummonerID & 7) != 3 || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) { - v6 = (double)*((short *)v1 - 4) * 0.5; + v6 = (double)v1->uActorHeight * 0.5; v7 = v6 + 6.7553994e15; v3 += LODWORD(v7); v61 = v3; @@ -2966,31 +2985,31 @@ else { v49 = 1; - pGame->pStru6Instance->_4A7F74(*((short *)v1 - 2), *((short *)v1 - 1), v3); + pGame->pStru6Instance->_4A7F74(v1->vPosition.x, v1->vPosition.y, v3); v4 = (1.0 - (double)*(signed int *)(v1 + 38) / (double)*((short *)v1 + 7)) - * (double)(2 * (signed int)*((short *)v1 - 4)); + * (double)(2 * (signed int)v1->uActorHeight); v5 = v4 + 6.7553994e15; v3 -= LODWORD(v5); v61 = v3; - if ( v3 > *(short *)v1 ) + if ( v3 > v1->vPosition.z ) { - v61 = *(short *)v1; - v3 = *(short *)v1; + v61 = v1->vPosition.z; + v3 = v1->vPosition.z; } } } v8 = stru_5C6E00->Atan2( - *((short *)v1 - 2) - pIndoorCamera->pos.x, - *((short *)v1 - 1) - pIndoorCamera->pos.y); - LOWORD(v9) = *((short *)v1 + 4); + v1->vPosition.x - pIndoorCamera->pos.x, + v1->vPosition.y - pIndoorCamera->pos.y); + LOWORD(v9) = v1->uYawAngle; v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; - v10 = *((short *)v1 + 16); + v10 = v1->uCurrentActionAnimation; if ( pParty->bTurnBasedModeOn ) { if ( v10 != 1 ) { LABEL_17: - v12 = *(int *)(v1 + 38); + v12 = v1->uCurrentActionTime; goto LABEL_18; } v11 = pMiscTimer->uTotalGameTimeElapsed; @@ -3003,9 +3022,9 @@ } v12 = v54 + v11; LABEL_18: - if ( *(_QWORD *)(v1 + 146) > 0i64 || *(_QWORD *)(v1 + 162) > 0i64 ) + if ( (signed __int64)v1->pActorBuffs[5].uExpireTime > 0 || (signed __int64)v1->pActorBuffs[6].uExpireTime > 0 ) v12 = 0; - v13 = *((short *)v1 + 15); + v13 = v1->uAIState; if ( v13 == 17 && !v49 ) { v40 = v12; @@ -3015,7 +3034,7 @@ goto LABEL_25; } v40 = v12; - v39 = *(short *)&v1[2 * v10 + 42]; + v39 = v1->pSpriteIDs[v10]; if ( v13 != 16 ) goto LABEL_24; v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12); @@ -3092,20 +3111,20 @@ return result; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - *(int *)(v1 - 110) |= 8u; + v1->uAttributes |= 8u; v28->uHwSpriteID = v15->pHwSpriteIDs[v41]; v29 = v15->uPaletteIndex; v28->uIndoorSectorID = 0; v28->uPalette = v29; v28->field_0 = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16; - v30 = *(int *)(v1 + 118) == 0; - v31 = *(int *)(v1 + 118) < 0; + v30 = HIDWORD(v1->pActorBuffs[3].uExpireTime) == 0; + v31 = SHIDWORD(v1->pActorBuffs[3].uExpireTime) < 0; v28->field_4 = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16; - if ( v31 || v31 | v30 && *(int *)(v1 + 114) <= 0u ) + if ( v31 || v31 | v30 && LODWORD(v1->pActorBuffs[3].uExpireTime) <= 0u ) { - if ( *(_QWORD *)(v1 + 226) > 0i64 ) + if ( (signed __int64)v1->pActorBuffs[10].uExpireTime > 0i64 ) { - v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F((Actor *)(v1 - 146)) + v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(v1) * (signed __int64)v28->field_4) >> 16; LABEL_53: LOWORD(v27) = v43; @@ -3114,10 +3133,10 @@ } else { - v32 = *((short *)v1 + 61); + v32 = v1->pActorBuffs[3].uPower; if ( v32 ) { - v33 = *((short *)v1 + 61); + v33 = v1->pActorBuffs[3].uPower; v28->field_0 = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->field_0) >> 16; v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->field_4) >> 16; goto LABEL_53; @@ -3134,20 +3153,20 @@ v28->sZValue = v34 + (8 * v59 | 3); v28->field_14 = v59; v35 = pMonsterList->pMonsters; - v36 = *((short *)v1 - 25); - v37 = *(int *)(v1 + 150) == 0; - v38 = *(int *)(v1 + 150) < 0; + v36 = v1->pMonsterInfo.uID; + v37 = HIDWORD(v1->pActorBuffs[5].uExpireTime) == 0; + v38 = SHIDWORD(v1->pActorBuffs[5].uExpireTime) < 0; v28->field_1E = v62 | 0x200; v28->pSpriteFrame = v15; v28->uTintColor = *((int *)&v35[v36] - 36); - if ( !v38 && (!(v38 | v37) || *(int *)(v1 + 146)) ) + if ( !v38 && (!(v38 | v37) || LODWORD(v1->pActorBuffs[5].uExpireTime)) ) v28->field_1E = v62 | 0x200; } LABEL_58: ++v59; v54 += 32; result = v59; - v1 += 836; + ++v1; } while ( v59 < (signed int)uNumActors ); } diff -r ec84db4c8f9d -r 170259c8c71f Party.cpp --- a/Party.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Party.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -870,13 +870,13 @@ //----- (004909F4) -------------------------------------------------------- void Party::_4909F4() { - char *v1; // esi@2 + Player *v1; // esi@2 unsigned int v2; // eax@3 __int16 v3; // cx@5 int v4; // edx@27 signed int v5; // eax@52 PlayerFrame *v6; // edx@53 - char *v7; // esi@60 + NPCData *v7; // esi@60 signed int v8; // ebp@61 int v9; // ebx@62 unsigned int v10; // edi@62 @@ -885,21 +885,21 @@ if ( dword_A75070 != stru_51076C.field_8 ) { dword_A75070 = stru_51076C.field_8; - v1 = (char *)&this->pPlayers[0].uExpressionID; + v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID; v11 = 4; do { - v2 = ((Player *)(v1 - 6812))->GetMajorConditionIdx(); + v2 = v1->GetMajorConditionIdx(); if ( v2 == 18 || v2 == 17 ) { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - if ( *((short *)v1 + 1) >= *((short *)v1 + 2) ) + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + if ( (unsigned __int16)v1->uExpressionTimePassed >= v1->uExpressionTimeLength ) { - if ( *(short *)v1 != 1 || rand() % 5 ) + if ( v1->uExpressionID != 1 || rand() % 5 ) { - *((short *)v1 + 1) = 0; - *(short *)v1 = 1; - *((short *)v1 + 2) = rand() % 256 + 32; + v1->uExpressionTimePassed = 0; + v1->uExpressionID = 1; + v1->uExpressionTimeLength = rand() % 256 + 32; } else { @@ -927,67 +927,67 @@ if ( v4 >= 82 ) { if ( v4 >= 88 ) - *(short *)v1 = (v4 >= 94) + 29; + v1->uExpressionID = (v4 >= 94) + 29; else - *(short *)v1 = 57; + v1->uExpressionID = 57; } else { - *(short *)v1 = 56; + v1->uExpressionID = 56; } } else { - *(short *)v1 = 55; + v1->uExpressionID = 55; } } else { - *(short *)v1 = 54; + v1->uExpressionID = 54; } } else { - *(short *)v1 = 20; + v1->uExpressionID = 20; } } else { - *(short *)v1 = 19; + v1->uExpressionID = 19; } } else { - *(short *)v1 = 18; + v1->uExpressionID = 18; } } else { - *(short *)v1 = 17; + v1->uExpressionID = 17; } } else { - *(short *)v1 = 16; + v1->uExpressionID = 16; } } else { - *(short *)v1 = 15; + v1->uExpressionID = 15; } } else { - *(short *)v1 = 14; + v1->uExpressionID = 14; } } else { - *(short *)v1 = 13; + v1->uExpressionID = 13; } v5 = 0; - *((short *)v1 + 1) = 0; - if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) + v1->uExpressionTimePassed = 0; + if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) { LABEL_56: v5 = 0; @@ -995,7 +995,7 @@ else { v6 = pPlayerFrameTable->pFrames; - while ( v6->uSequenceID != *(short *)v1 ) + while ( v6->uSequenceID != v1->uExpressionID ) { ++v5; ++v6; @@ -1003,62 +1003,62 @@ goto LABEL_56; } } - *((short *)v1 + 2) = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; + v1->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; } } } else { - v3 = *(short *)v1; - if ( *(short *)v1 != 34 && v3 != 35 && v3 != 36 - || (signed int)(pMiscTimer->uTimeElapsed + *((short *)v1 + 1)) >= *((short *)v1 + 2) ) + v3 = v1->uExpressionID; + if ( v1->uExpressionID != 34 && v3 != 35 && v3 != 36 + || (signed int)(pMiscTimer->uTimeElapsed + v1->uExpressionTimePassed) >= v1->uExpressionTimeLength ) { - *((short *)v1 + 2) = 0; - *((short *)v1 + 1) = 0; + v1->uExpressionTimeLength = 0; + v1->uExpressionTimePassed = 0; switch ( v2 ) { case 0xEu: - *(short *)v1 = 98; + v1->uExpressionID = 98; break; case 0xFu: - *(short *)v1 = 12; + v1->uExpressionID = 12; break; case 0x10u: - *(short *)v1 = 99; + v1->uExpressionID = 99; break; case 0u: - *(short *)v1 = 2; + v1->uExpressionID = 2; break; case 1u: - *(short *)v1 = 3; + v1->uExpressionID = 3; break; case 2u: - *(short *)v1 = 4; + v1->uExpressionID = 4; break; case 3u: - *(short *)v1 = 5; + v1->uExpressionID = 5; break; case 4u: - *(short *)v1 = 6; + v1->uExpressionID = 6; break; case 5u: - *(short *)v1 = 7; + v1->uExpressionID = 7; break; case 6u: case 8u: case 0xAu: - *(short *)v1 = 8; + v1->uExpressionID = 8; break; case 7u: case 9u: case 0xBu: - *(short *)v1 = 9; + v1->uExpressionID = 9; break; case 0xCu: - *(short *)v1 = 10; + v1->uExpressionID = 10; break; case 0xDu: - *(short *)v1 = 11; + v1->uExpressionID = 11; break; default: break; @@ -1066,38 +1066,38 @@ } else { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - } + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + } } - v1 += 6972; + ++v1; --v11; } while ( v11 ); - v7 = (char *)&pParty->pHirelings[0].evtb; + v7 = pParty->pHirelings;//(char *)&pParty->pHirelings[0].evtb; do { - v8 = *((int *)v7 + 1); + v8 = v7->evtc; if ( v8 ) { - v9 = *((int *)v7 - 1); - v10 = pMiscTimer->uTimeElapsed + *(int *)v7; + v9 = v7->bDrawSomeAnim; + v10 = pMiscTimer->uTimeElapsed + v7->evtb; if ( (signed int)v10 >= v8 ) { v9 = 0; v8 = 0; v10 = 0; - memset(v7 - 44, 0, 0x4Cu); + memset(v7, 0, 0x4Cu); pParty->field_709 = 0; //sub_44A56A();Ritor1: it's temporarily viewparams->bRedrawGameUI = 1; } - *(int *)v7 = v10; - *((int *)v7 + 1) = v8; - *((int *)v7 - 1) = v9; + v7->evtb = v10; + v7->evtc = v8; + v7->bDrawSomeAnim = v9; } - v7 += 76; + ++v7; } - while ( (signed int)v7 < (signed int)&pParty->field_777C[1] ); + while ( v7 <= &pParty->pHirelings[1] ); } } // A75070: using guessed type int dword_A75070; @@ -1111,7 +1111,7 @@ SpellBuff *v4; // edi@4 int v5; // eax@9 char v6; // zf@9 - char *v7; // eax@10 + ItemGen *v7; // eax@10 signed int v8; // ecx@10 int v9; // eax@18 int v10; // eax@25 @@ -1163,13 +1163,13 @@ if ( v6 ) { v14 = 0; - v7 = &v2->pInventoryItems[0].field_1A; + v7 = v2->pInventoryItems;//[0].field_1A; v8 = 138; do { - if ( *(int *)(v7 - 26) == 601 && (unsigned __int8)*v7 == v15 + 1 ) + if ( v7->uItemID == 601 && (unsigned __int8)v7->field_1A== v15 + 1 ) v14 = 1; - v7 += 36; + ++v7; --v8; } while ( v8 ); diff -r ec84db4c8f9d -r 170259c8c71f Player.cpp --- a/Player.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Player.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -18,7 +18,8 @@ #include "Events2D.h" #include "Outdoor.h" #include "StorylineTextTable.h" - +#include "Autonotes.h" +#include "Awards.h" #include "mm7_data.h" @@ -8413,12 +8414,13 @@ if ( var == VAR_AutoNotes ) { if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3]) - && (&dword_723718_autonote_related)[8 * a3] ) + //&& (&dword_723718_autonote_related)[8 * a3] ) + && pAutonoteTxt[a3-1].pText ) { v20 = pPlayers[v3 + 1]; v30 = 1; v20->PlaySound(96, 0); - v21 = dword_72371C[2 * a3]; + v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; dword_506568 = v21; } @@ -8482,7 +8484,8 @@ return; case VAR_Award: if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->field_152[((signed __int16)a3 - 1) >> 3]) - && dword_723E80_award_related[2 * a3] ) + //&& dword_723E80_award_related[2 * a3] ) + && pAwards[a3-1].pText ) { v12 = pPlayers[v3 + 1]; v30 = 1; @@ -8496,7 +8499,8 @@ goto LABEL_124; case VAR_QBits_QuestsDone: if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_award_bits[((signed __int16)a3 - 1) >> 3]) - && (&dword_722F10)[4 * a3] ) + // && (&dword_722F10)[4 * a3] ) + && pQuestTable[a3-1] ) { v14 = pPlayers[v3 + 1]; bFlashQuestBook = 1; @@ -8909,7 +8913,8 @@ v13 = pPlayers[uPlayerIdx + 1]; v33 = 0x80u >> ((signed __int16)val - 1) % 8; if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->field_152[((signed __int16)val - 1) >> 3]) - && dword_723E80_award_related[2 * val] ) + //&& dword_723E80_award_related[2 * val] ) + && pAwards[val-1].pText ) { v14 = pPlayers[uPlayerIdx + 1]; v34 = 1; @@ -8927,7 +8932,8 @@ goto _play_anim_and_exit; case VAR_QBits_QuestsDone: if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_award_bits[((signed __int16)val - 1) >> 3]) - && (&dword_722F10)[4 * val] ) + //&& (&dword_722F10)[4 * val] ) + && pQuestTable[val-1] ) { v17 = pPlayers[uPlayerIdx + 1]; bFlashQuestBook = 1; @@ -9191,12 +9197,13 @@ goto _play_sound; } if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3]) - && (&dword_723718_autonote_related)[8 * val] ) + //&& (&dword_723718_autonote_related)[8 * val] ) + && pAutonoteTxt[val-1].pText ) { v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; v23->PlaySound(96, 0); - v24 = dword_72371C[2 * val]; + v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; dword_506568 = v24; } diff -r ec84db4c8f9d -r 170259c8c71f SaveLoad.cpp --- a/SaveLoad.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/SaveLoad.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -247,7 +247,7 @@ int v17; // esi@37 unsigned int v18; // ecx@38 unsigned int v19; // esi@39 - char *v20; // edx@39 + BSPModel *v20; // edx@39 void *v21; // esi@41 void *v22; // esi@41 BSPModel *v23; // eax@42 @@ -265,16 +265,16 @@ //std::string v35; // [sp-18h] [bp-288h]@8 const char *v36; // [sp-10h] [bp-280h]@6 const char *v37; // [sp-Ch] [bp-27Ch]@6 - const char *v38; // [sp-8h] [bp-278h]@8 + unsigned int *v38; // [sp-8h] [bp-278h]@8 CHAR Buffer; // [sp+Ch] [bp-264h]@59 - char Dir; // [sp+8Ch] [bp-1E4h]@51 - char Drive; // [sp+ACh] [bp-1C4h]@51 + char Dir[255]; // [sp+8Ch] [bp-1E4h]@51 + char Drive[255]; // [sp+ACh] [bp-1C4h]@51 SavegameHeader header; // [sp+CCh] [bp-1A4h]@10 //int v43; // [sp+CCh] [bp-1A4h]@10 //char Dest[20]; // [sp+E0h] [bp-190h]@10 //unsigned __int64 pTimePlayed; // [sp+F4h] [bp-17Ch]@10 - char Filename; // [sp+130h] [bp-140h]@51 - char Ext; // [sp+150h] [bp-120h]@51 + char Filename[255]; // [sp+130h] [bp-140h]@51 + char Ext[255]; // [sp+150h] [bp-120h]@51 char v48; // [sp+151h] [bp-11Fh]@51 char Source[32]; // [sp+170h] [bp-100h]@51 char Str[120]; // [sp+190h] [bp-E0h]@8 @@ -419,7 +419,7 @@ } if ( !a2 ) { - __debugbreak(); + //__debugbreak(); sub_42FA22_mess_with_laying_item_list(); v9 = (int)malloc(0xF4240); v71 = (std::string *)v9; @@ -446,7 +446,7 @@ v68 = 0; for (int i = 0; i <= (signed int)pIndoor->uNumFaces; ++i) { - v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44; + v38 = &pIndoor->pFaces[i].uAttributes;//(char *)v68 + (unsigned int)pIndoor->pFaces + 44; memcpy(v11, v38, 4); v68 += 48; v11 = (char *)v11 + 4; @@ -489,11 +489,11 @@ if ( (signed int)pOutdoor->uNumBModels > 0 ) { v19 = pOutdoor->uNumBModels; - v20 = (char *)&pOutdoor->pBModels->uNumFaces; + v20 = &pOutdoor->pBModels[0]; do { - v18 += *(int *)v20; - v20 += 188; + v18 += v20->uNumFaces; + ++v20; --v19; pOutdoor->ddm.uNumFacesInBModels = v18; } @@ -512,16 +512,16 @@ { v23 = pOutdoor->pBModels; v24 = 76; - for (int i = 0; i <= (signed int)pOutdoor->uNumBModels ; ++i) + for (int i = 0; i < (signed int)pOutdoor->uNumBModels ; ++i) { - v25 = *(int *)&v23->pModelName[v24] == 0; - v26 = *(int *)&v23->pModelName[v24] < 0; + v25 = v23[i].uNumFaces == 0;//*(int *)&v23->pModelName[v24] == 0; + v26 = v23[i].uNumFaces < 0;//*(int *)&v23->pModelName[v24] < 0; if ( !(v26 | v25) ) { v68 = 0; - for (int j = 0; j <= *(int *)&pOutdoor->pBModels->pModelName[v24]; ++j) + for (int j = 0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j) { - v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28; + v38 = &(v23[i].pFaces[j].uAttributes); //(char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28; memcpy(v22, v38, 4); v23 = pOutdoor->pBModels; v68 += 154; @@ -560,7 +560,7 @@ } v32 = v17 + 56; strcpy(Source, pCurrentMapName); - _splitpath(Source, &Drive, &Dir, &Filename, &Ext); + _splitpath(Source, Drive, Dir, Filename, Ext); v48 = 100; Size = v32 - (int)DstBuf; v69 = 999984; diff -r ec84db4c8f9d -r 170259c8c71f Vis.cpp --- a/Vis.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Vis.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -119,10 +119,10 @@ char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4) { signed int v5; // esi@1 - char *v6; // edi@2 + RenderBillboardD3D *v6; // edi@2 double v7; // st7@9 int v8; // edx@9 - char *v9; // ecx@10 + RenderVertexSoft *v9; // ecx@10 char result; // al@24 Vis *thisa; // [sp+10h] [bp-8h]@1 float thisb; // [sp+10h] [bp-8h]@9 @@ -134,20 +134,24 @@ v5 = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 ) - goto LABEL_28; - v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + { + return 0; + } + v6 = pRenderer->pBillboardRenderListD3D; do { - if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4) + if ( IsPointInsideD3DBillboard(v6, a3, a4) && (v13 == -1 - || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) + || (unsigned int)pBillboardRenderList[v6->uParentBillboardID].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) v13 = v5; ++v5; - v6 += 156; + ++v6; } while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw ); if ( v13 == -1 ) - goto LABEL_28; + { + return 0; + } v7 = 3.4028235e38; v8 = a2; a4a = 3.4028235e38; @@ -155,18 +159,18 @@ thisb = -3.4028235e38; if ( a2 > 0 ) { - v9 = (char *)&a1->vWorldViewProjY; + v9 = a1; do { - if ( *((float *)v9 - 1) < v7 ) - v7 = *((float *)v9 - 1); - if ( *((float *)v9 - 1) > (double)a3a ) - a3a = *((float *)v9 - 1); - if ( *(float *)v9 < (double)a4a ) - a4a = *(float *)v9; - if ( *(float *)v9 > (double)thisb ) - thisb = *(float *)v9; - v9 += 48; + if ( v9->vWorldViewProjX < v7 ) + v7 = v9->vWorldViewProjX; + if ( v9->vWorldViewProjX > (double)a3a ) + a3a = v9->vWorldViewProjX; + if ( v9->vWorldViewProjY < (double)a4a ) + a4a = v9->vWorldViewProjY; + if ( v9->vWorldViewProjY > (double)thisb ) + thisb = v9->vWorldViewProjY; + ++v9; --v8; } while ( v8 ); @@ -175,7 +179,6 @@ || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb ) -LABEL_28: result = 0; else result = 1; @@ -237,14 +240,14 @@ int v6; // ST1C_4@6 Vis_stru1_stru0 *v7; // edi@6 Vis *thisa; // [sp+20h] [bp-Ch]@1 - void **v9; // [sp+24h] [bp-8h]@2 + RenderBillboardD3D *v9; // [sp+24h] [bp-8h]@2 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1 uD3DBillboardIdx = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 ) { - v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + v9 = pRenderer->pBillboardRenderListD3D;//[0].uParentBillboardID; do { if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) @@ -252,9 +255,9 @@ { if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) ) { - v6 = pBillboardRenderList[(int)*v9].sZValue; + v6 = pBillboardRenderList[v9->uParentBillboardID].sZValue; v7 = &a4->array_0004[a4->uNumPointers]; - v7->pObjectInfo = *v9; + v7->pObjectInfo = (void *)v9->uParentBillboardID; v7 = (Vis_stru1_stru0 *)((char *)v7 + 4); v7->pObjectInfo = (void *)v6; v7->sZValue = 1; @@ -262,7 +265,7 @@ } } ++uD3DBillboardIdx; - v9 += 39; + ++v9; } while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw ); } @@ -990,14 +993,18 @@ { v12 = a1a; a3[2 * a1a] = a6->pXInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[a1a]].x; *(a5a - 1) = a6->pYInterceptDisplacements[v12] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12]].y; *(__int16 *)((char *)a5a + (int)(char *)a3 - (char *)a4) = a6->pXInterceptDisplacements[v12 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] - + 12 * a6->pVertexIDs[v12 + 1]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] +// + 12 * a6->pVertexIDs[v12 + 1]); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12+1]].x; v13 = a6->pYInterceptDisplacements[v12 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12 + 1]].y; v14 = a5a; ++a1a; a5a += 2; @@ -1020,14 +1027,18 @@ { v16 = a1a; a3[2 * a1a] = a6->pXInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[a1a]].x; *(a5b - 1) = a6->pZInterceptDisplacements[v16] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8); - *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] - + 12 * a6->pVertexIDs[v16 + 1]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16]].y; + *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1] +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] +// + 12 * a6->pVertexIDs[v16 + 1]); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16+1]].x; v17 = a6->pZInterceptDisplacements[v16 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16+1]].z; v18 = a5b; ++a1a; a5b += 2; @@ -1048,15 +1059,19 @@ { v20 = a1a; a3[2 * a1a] = a6->pYInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[a1a]].y; *(a5c - 1) = a6->pZInterceptDisplacements[v20] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[a1a]].z; *(__int16 *)((char *)a5c + (int)(char *)a3 - (char *)a4) = a6->pYInterceptDisplacements[v20 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] - + 12 * a6->pVertexIDs[v20 + 1] - + 4); - v21 = a6->pZInterceptDisplacements[v20 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] +// + 12 * a6->pVertexIDs[v20 + 1] +// + 4); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[v20+1]].y; + v21 = a6->pZInterceptDisplacements[v20 + 1] +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[v20+1]].z; v22 = a5c; ++a1a; a5c += 2; diff -r ec84db4c8f9d -r 170259c8c71f mm7_1.cpp --- a/mm7_1.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_1.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -691,9 +691,9 @@ { while ( 1 ) { - v5 = pStru179->field_0[v21]; - v20 = 8 * pStru179->field_0[v21]; - v6 = (char *)dword_723E80_award_related[v20 / 4]; + v5 = pStru179.field_0[v21]; + v20 = 8 * pStru179.field_0[v21]; + v6 = (char *)pAwards[v20/8-1].pText;//(char *)dword_723E80_award_related[v20 / 4]; if ( v5 != 1 ) break; v17 = pParty->uFine; @@ -701,7 +701,7 @@ sprintf(pTmpBuf, v6, v17); v6 = pTmpBuf; LABEL_43: - v14 = dword_723E84[v20 / 4]; + v14 = pAwards[v20/8-1].uSort;//dword_723E84[v20 / 4]; ++dword_506520; v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( pAwardsTextColors[3 * v14 % 6], @@ -4253,7 +4253,7 @@ int v9; // [sp+9Ch] [bp-10h]@10 unsigned int v10; // [sp+A0h] [bp-Ch]@1 unsigned int v11; // [sp+A4h] [bp-8h]@8 - unsigned int *v12; // [sp+A8h] [bp-4h]@9 + ItemGen *v12; // [sp+A8h] [bp-4h]@9 v1 = 0; v2 = uChestID; @@ -4282,10 +4282,10 @@ v11 = 0; if ( uChestArea > 0 ) { - v12 = &pChests[v3].mm7__vector_pItems[0].uAttributes; + v12 = pChests[v3].mm7__vector_pItems;//&pChests[v3].mm7__vector_pItems[0].uAttributes; do { - v9 = *(v12 - 5); + v9 = v12->uItemID; if ( v9 ) { v6 = 0; @@ -4293,15 +4293,17 @@ { ++v6; if ( v6 >= uChestArea ) - goto LABEL_17; + break; } - Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); - if ( pChests[v3].uFlags & 4 ) - *v12 |= 1u; - } -LABEL_17: + if(v6uAttributes |= 1u; + } + } ++v11; - v12 += 9; + ++v12; } while ( (signed int)v11 < uChestArea ); } diff -r ec84db4c8f9d -r 170259c8c71f mm7_2.cpp --- a/mm7_2.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_2.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -2930,10 +2930,10 @@ { unsigned int v1; // esi@8 unsigned int v3; // ecx@10 - char *v4; // esi@15 + Player *v4; // esi@15 int v5; // ebx@16 int v6; // ST38_4@16 - char *v7; // esi@18 + Player *v7; // esi@18 int v8; // ebx@19 int v9; // ST30_4@19 int v10; // ST44_4@19 @@ -3064,10 +3064,10 @@ } if ( a1 == 11 ) { - v7 = (char *)&pParty->pPlayers[0].pConditions[15]; + v7 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pConditions[15]; do { - v8 = *((int *)v7 - 2); + /*v8 = *((int *)v7 - 2); v9 = *((int *)v7 - 1); v10 = *(int *)v7; v11 = *((int *)v7 + 1); @@ -3076,38 +3076,48 @@ v14 = *((int *)v7 + 8); v15 = *((int *)v7 + 9); v16 = *((int *)v7 + 4); - v17 = *((int *)v7 + 5); - memset(v7 - 120, 0, 0xA0u); - *((int *)v7 + 2) = v12; - *((int *)v7 + 3) = v13; - *(int *)v7 = v10; - *((int *)v7 + 1) = v11; - *((int *)v7 - 1) = v9; - *((int *)v7 + 8) = v14; - *((int *)v7 + 9) = v15; - *((int *)v7 + 4) = v16; - *((int *)v7 - 2) = v8; - *((int *)v7 + 5) = v17; - *((int *)v7 + 1585) = ((Player *)(v7 - 120))->GetMaxHealth(); - v7 += 6972; - } - while ( (signed int)v7 < (signed int)&pParty->pHirelings[1].evtb ); + v17 = *((int *)v7 + 5);*/ + v8 = LODWORD(v7->pConditions[14]); + v9 = HIDWORD(v7->pConditions[14]); + v10 = LODWORD(v7->pConditions[15]); + v11 = HIDWORD(v7->pConditions[15]); + v12 = LODWORD(v7->pConditions[16]); + v13 = HIDWORD(v7->pConditions[16]); + v14 = LODWORD(v7->pConditions[19]); + v15 = HIDWORD(v7->pConditions[19]); + v16 = LODWORD(v7->pConditions[17]); + v17 = HIDWORD(v7->pConditions[17]); + memset(v7, 0, 0xA0u); + LODWORD(v7->pConditions[16]) = v12; + HIDWORD(v7->pConditions[16]) = v13; + LODWORD(v7->pConditions[15]) = v10; + HIDWORD(v7->pConditions[15]) = v11; + HIDWORD(v7->pConditions[14]) = v9; + LODWORD(v7->pConditions[19]) = v14; + HIDWORD(v7->pConditions[19]) = v15; + LODWORD(v7->pConditions[17]) = v16; + LODWORD(v7->pConditions[14]) = v8; + HIDWORD(v7->pConditions[17]) = v17; + v7->sHealth = v7->GetMaxHealth(); + ++v7; + } + while ( v7 <= pPlayers[3] ); return 0; } if ( a1 == 12 ) { - v4 = (char *)&pParty->pPlayers[0].pActiveSkills[8]; + v4 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pActiveSkills[8]; do { - v5 = *((int *)v4 - 32); - v6 = *((int *)v4 - 31); - memset(v4 - 280, 0, 0xA0u); - *(int *)v4 = v5; - *((int *)v4 + 1) = v6; - *((int *)v4 + 1545) = ((Player *)(v4 - 280))->GetMaxHealth(); - v4 += 6972; - } - while ( (signed int)v4 < (signed int)&pParty->field_777C[22] ); + v5 = LODWORD(v4->pConditions[19]);//*((int *)v4 - 32); + v6 = HIDWORD(v4->pConditions[19]);//*((int *)v4 - 31); + memset(v4->pConditions, 0, 0xA0u); + v4->pActiveSkills[8] = v5; + v4->pActiveSkills[10] = v6; + v4->sHealth = v4->GetMaxHealth(); + ++v4; + } + while ( v4 <= pPlayers[3] ); return 0; } if ( a1 == 33 ) diff -r ec84db4c8f9d -r 170259c8c71f mm7_3.cpp --- a/mm7_3.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_3.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -3228,12 +3228,17 @@ { if ( v108 >> 6 < pOutdoor->uNumBModels ) { - v7 = (ODMFace *)&pOutdoor->pBModels[v108 >> 6].pFaces; + v7 = pOutdoor->pBModels[v108 >> 6].pFaces; v6 = v108 & 0x3F; - if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) + /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) { pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); + }*/ + if ( BYTE3(v7[v6].uAttributes) & 4 ) + { + pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; + v103 = v7[v6].sCogTriggeredID; } } } @@ -3774,7 +3779,7 @@ pParty->bFlying = 0; v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; v127 = v46; - v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; + v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1; v51 = __OFSUB__(v48, 32); v49 = v48 == 32; @@ -5026,12 +5031,12 @@ //----- (00476750) -------------------------------------------------------- void __cdecl InitializeAutonotes() { - char *v0; // ebp@3 + Autonote *v0; // ebp@3 int v1; // ebx@4 char *v2; // esi@4 char v3; // cl@5 int v4; // eax@5 - int v5; // edi@9 + char *v5; // edi@9 signed int v6; // [sp+0h] [bp-4h]@4 if ( pAutonoteTXT_Raw ) @@ -5039,7 +5044,7 @@ pAutonoteTXT_Raw = 0; pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); strtok(pAutonoteTXT_Raw, "\r"); - v0 = (char *)&pAutonoteTxt[0].eType; + v0 = pAutonoteTxt; for (uint i = 0; i < 195; ++i) { v1 = 0; @@ -5054,15 +5059,15 @@ ++v4; v3 = v2[v4]; } - v5 = (int)&v2[v4]; + v5 = &v2[v4]; if ( !v2[v4] ) v6 = 1; - *(char *)v5 = 0; + *v5 = 0; if ( v4 ) { if ( v1 == 1 ) { - *((int *)v0 - 1) = (int)RemoveQuotes(v2); + v0->pText = RemoveQuotes(v2); } else { @@ -5075,23 +5080,23 @@ if ( _strcmpi(v2, "seer") ) { if ( _strcmpi(v2, "obelisk") ) - *(int *)v0 = 5 - (_strcmpi(v2, "teacher") != 0); + v0->eType = (AUTONOTE_TYPE)(5 - (_strcmpi(v2, "teacher") != 0)); else - *(int *)v0 = 2; + v0->eType = (AUTONOTE_TYPE)2; } else { - *(int *)v0 = 3; + v0->eType = (AUTONOTE_TYPE)3; } } else { - *(int *)v0 = 1; + v0->eType = (AUTONOTE_TYPE)1; } } else { - *(int *)v0 = 0; + v0->eType = (AUTONOTE_TYPE)0; } } } @@ -5101,10 +5106,10 @@ v6 = 1; } ++v1; - v2 = (char *)(v5 + 1); + v2 = v5 + 1; } while ( v1 - 1 <= 2 && !v6 ); - v0 += 8; + ++v0; } //while ( (signed int)v0 < (signed int)&pScrolls[1] ); } @@ -6676,10 +6681,10 @@ { IndoorCameraD3D *v0; // eax@3 char result; // al@3 - Vec3_int_ **v2; // ebx@4 - Vec3_int_ *v3; // eax@6 + BSPModel *v2; // ebx@4 + int v3; // eax@6 ODMFace *pFace; // esi@6 - int v5; // ecx@8 + Vec3_int_ *v5; // ecx@8 int v6; // eax@8 stru148 *v7; // ebx@8 LightmapBuilder *v8; // eax@8 @@ -6693,11 +6698,13 @@ unsigned int v16; // edi@22 int v17; // eax@24 int v18; // edi@34 - char *v19; // eax@35 - char *v20; // ecx@35 + RenderVertexSoft *v19; // eax@35 + unsigned short *v20; // ecx@35 + unsigned short *v20b; // ecx@35 + unsigned short *v20c; // ecx@35 Vec3_int_ *v21; // edx@36 int v22; // edx@36 - char *v23; // edi@37 + RenderVertexSoft *v23; // edi@37 int v24; // eax@50 int v25; // ecx@55 int v26; // eax@57 @@ -6716,7 +6723,8 @@ LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 int v40; // [sp-4h] [bp-5Ch]@2 std::string *v41; // [sp+Ch] [bp-4Ch]@2 - Vec3_int_ *v42; // [sp+10h] [bp-48h]@6 + int v41b; + int v42; // [sp+10h] [bp-48h]@6 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 float v44; // [sp+18h] [bp-40h]@10 float v45; // [sp+1Ch] [bp-3Ch]@10 @@ -6730,7 +6738,7 @@ int v53; // [sp+3Ch] [bp-1Ch]@8 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6 int a1; // [sp+44h] [bp-14h]@3 - Vec3_int_ **v56; // [sp+48h] [bp-10h]@4 + BSPModel *v56; // [sp+48h] [bp-10h]@4 int uNumVertices; // [sp+4Ch] [bp-Ch]@34 int unused; // [sp+50h] [bp-8h]@3 int a3; // [sp+57h] [bp-1h]@2 @@ -6744,41 +6752,43 @@ a1 = 0; v47 = v0; result = LOBYTE(pOutdoor->pBModels); - v41 = (std::string *)pOutdoor->uNumBModels; + v41b = pOutdoor->uNumBModels; if ( (signed int)pOutdoor->uNumBModels > 0 ) { - v2 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; - v56 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; + v2 = pOutdoor->pBModels; + v56 = pOutdoor->pBModels; while ( 1 ) { if ( IsBModelVisible(a1, &unused) ) { - *(v2 - 3) = (Vec3_int_ *)((unsigned int)*(v2 - 3) | 1); - v3 = *v2; - pFace = (ODMFace *)v2[2]; + v2->field_40 |= 1u; + v3 = v2->uNumFaces; + pFace = v2->pFaces; v54 = 0; v46 = pFace; v42 = v3; - if ( (signed int)v3 > 0 ) + if ( v3 > 0 ) break; } LABEL_86: ++a1; - v2 += 47; + ++v2;// += 47; result = a1; v56 = v2; - if ( a1 >= (signed int)v41 ) + if ( a1 >= v41b ) return result; } while ( 1 ) { if (pFace->Invisible()) goto LABEL_85; - v5 = (int)*(v2 - 1); + //v5 = (int)*(v2 - 1); + v5 = v2->pVertices.pVertices; v6 = pFace->pVertexIDs[0]; v53 = 0; v7 = &array_77EC08[pOutdoorCamera->numStru148s]; - v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); + //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); + v8 = (LightmapBuilder *)v5[v6].z; *(int *)&v7->flags = 0; pLightmapBuilder = v8; v9 = pFace->uTextureID; @@ -6865,12 +6875,16 @@ uNumVertices = v18; if ( v18 > 0 ) { - v19 = (char *)&array_73D150[0].vWorldPosition.z; - v20 = (char *)pFace->pTextureUIDs; + //v19 = (char *)&array_73D150[0].vWorldPosition.z; + //v20 = (char *)pFace->pTextureUIDs; + v19 = array_73D150; + v20 = pFace->pTextureUIDs; + v20b = pFace->pVertexIDs; + v20c = pFace->pTextureVIDs; v51 = v18; do { - v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; +/* v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; *((float *)v19 - 2) = (double)v21->x; *((float *)v19 - 1) = (double)v21->y; *(float *)v19 = (double)v21->z; @@ -6881,29 +6895,52 @@ v20 += 2; v10 = v51-- == 1; v52 = v22; - *((float *)v19 - 4) = (double)v22 * v44; + *((float *)v19 - 4) = (double)v22 * v44;*/ + + //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20)); + v21 = &v56->pVertices.pVertices[*v20b]; + //*((float *)v19 - 2) = (double)v21->x; + //*((float *)v19 - 1) = (double)v21->y; + v19->vWorldPosition.x = (double)v21->x; + v19->vWorldPosition.y = (double)v21->y; + v19->vWorldPosition.z = (double)v21->z; + ++v19; + v52 = v7->sTextureDeltaU + (signed __int16)*v20; + //*((float *)v19 - 5) = (double)v52 * v45; + (v19-1)->u = (double)v52 * v45; + v22 = v7->sTextureDeltaV + (signed __int16)*v20c; + ++v20; + ++v20b; + ++v20c; + v10 = v51-- == 1; + v52 = v22; + //*((float *)v19 - 4) = (double)v22 * v44; + (v19-1)->v = (double)v22 * v44; } while ( !v10 ); - v23 = (char *)&array_73D150[0].vWorldViewPosition; + //v23 = (char *)&array_73D150[0].vWorldViewPosition; + v23 = array_73D150; v51 = uNumVertices; *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder; do { - if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) + //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) + if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) ++v53; - v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); - if ( *(float *)v23 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v23 ) - { - if ( *(float *)v23 >= 8.0 ) + //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); + v47->ViewTransform(v23, 1u); + if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) + { + if ( v23->vWorldViewPosition.x >= 8.0 ) v49 = 1; else v50 = 1; } else { - v47->Project((RenderVertexSoft *)(v23 - 12), 1u, 0); - } - v23 += 48; + v47->Project(v23, 1u, 0); + } + ++v23;// += 48; --v51; } while ( v51 ); @@ -7061,9 +7098,9 @@ BSPModel *Render::DrawBuildingsSW() { BSPModel *result; // eax@1 - unsigned int *v1; // ebx@2 + BSPModel *v1; // ebx@2 int v2; // eax@4 - int v3; // edi@4 + ODMFace *v3; // edi@4 int v4; // ecx@6 int v5; // eax@6 int v6; // ecx@6 @@ -7090,7 +7127,7 @@ signed int v27; // ecx@43 double v28; // st6@43 double v29; // st5@43 - int v30; // edx@44 + unsigned short *v30; // edx@44 int v31; // eax@44 double v32; // st4@45 int v33; // ecx@45 @@ -7136,12 +7173,12 @@ int v73; // [sp+8Ch] [bp-34h]@57 int v74; // [sp+90h] [bp-30h]@6 int v75; // [sp+94h] [bp-2Ch]@6 - int v76; // [sp+98h] [bp-28h]@4 + ODMFace *v76; // [sp+98h] [bp-28h]@4 int v77; // [sp+9Ch] [bp-24h]@6 - unsigned int *v78; // [sp+A0h] [bp-20h]@2 + BSPModel *v78; // [sp+A0h] [bp-20h]@2 int v79; // [sp+A4h] [bp-1Ch]@4 int a1; // [sp+A8h] [bp-18h]@1 - int v81; // [sp+ACh] [bp-14h]@7 + unsigned short *v81; // [sp+ACh] [bp-14h]@7 int v82; // [sp+B0h] [bp-10h]@6 int v83; // [sp+B4h] [bp-Ch]@6 signed int v84; // [sp+B8h] [bp-8h]@7 @@ -7149,20 +7186,20 @@ a2 = 0; a1 = 0; - result = pOutdoor->pBModels; + result = (BSPModel *)pOutdoor->pBModels; v66 = pOutdoor->uNumBModels; if ( (signed int)pOutdoor->uNumBModels > 0 ) { - v1 = &pOutdoor->pBModels->uNumFaces; - v78 = &pOutdoor->pBModels->uNumFaces; + v1 = pOutdoor->pBModels; + v78 = pOutdoor->pBModels; while ( 1 ) { if ( IsBModelVisible(a1, &a2) ) { - *(v1 - 3) |= 1u; - v2 = *v1; - v3 = v1[2]; - v79 = 0; + v1->field_40 |= 1u; + v2 = v1->uNumFaces; + v3 = (ODMFace *)v1->pFaces; + v74 = 0; v76 = v3; v68 = v2; if ( v2 > 0 ) @@ -7170,7 +7207,7 @@ } LABEL_73: ++a1; - v1 += 47; + ++v1; result = (BSPModel *)a1; v78 = v1; if ( a1 >= v66 ) @@ -7178,23 +7215,23 @@ } while ( 1 ) { - if ( !(*(char *)(v3 + 29) & 0x20) ) - { - v4 = 3 * *(short *)(v3 + 32); - v5 = (int)(v1 - 2); - v67 = (int)(v1 - 2); - v6 = *(int *)(*(v1 - 1) + 4 * v4 + 8) + 4; + if ( !v3->Invisible() ) + { + v4 = 3 * v3->pVertexIDs[0]; + v5 = (int)((char *)v1 - 8); + v67 = (int)((char *)v1 - 8); + v6 = *(_DWORD *)(*(&v1->uNumConvexFaces - 2) + 4 * v4 + 8) + 4; v82 = 0; v83 = v6; v74 = 0; - v7 = *(char *)(v3 + 302); + v7 = v3->uNumVertices; v75 = 0; v77 = v7; if ( v7 > 0 ) { v8 = (double)v83; v9 = (char *)&array_73D150[0].vWorldViewPosition; - v81 = v3 + 32; + v81 = v3->pVertexIDs; v83 = v7; *(float *)&v84 = v8; while ( 1 ) @@ -7239,9 +7276,9 @@ v82 = -pOutdoor->vSunlight.y; v84 = *(int *)(v3 + 4); v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16; - v81 = -pOutdoor->vSunlight.z; + v81 = (unsigned __int16 *)-pOutdoor->vSunlight.z; v84 = *(int *)(v3 + 8); - v81 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16; + v81 = (unsigned __int16 *)((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); v13 = (double)v84 * 0.000015258789; if ( v13 < 0.0 ) @@ -7315,7 +7352,7 @@ v29 = 1.0 / (double)v84; if ( v77 > 0 ) { - v30 = v3 + 112; + v30 = v3->pTextureVIDs; v31 = 0; v83 = v77; do @@ -7524,7 +7561,8 @@ v12 = v11 >> 16; if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 ) { - if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) + //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) + if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels[v14].sBoundingRadius) + 512 ) { result = v12 < 0; LOBYTE(result) = v12 >= 0; @@ -15449,7 +15487,7 @@ v5 = abs((signed)pY); v6 = abs((signed)pX); v7 = sub_4621DA(v6, v5, v2); - v8 = pOutdoor->pBModels; + v8 = &pOutdoor->pBModels[0]; if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) { v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); @@ -15506,7 +15544,7 @@ int v5; // edi@6 int v6; // eax@6 int v7; // eax@6 - BSPModel *v8; // ecx@6 + BSPModel **v8; // ecx@6 unsigned __int8 v9; // zf@7 unsigned __int8 v10; // sf@7 ODMFace *v11; // eax@9 @@ -15545,23 +15583,23 @@ { while ( 1 ) { - pX = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.x + v4) - v1; - pY = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.y + v4) - LODWORD(v19); + pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1; + pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); v5 = abs((signed)pY); v6 = abs((signed)pX); v7 = sub_4621DA(v6, v5, 0); - v8 = pOutdoor->pBModels; - if ( v7 < *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v4) ) - { - v9 = *(unsigned int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) == 0; - v10 = *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) < 0; + v8 = &pOutdoor->pBModels; + if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) + { + v9 = pOutdoor->pBModels[v4].uNumFaces == 0; + v10 = pOutdoor->pBModels[v4].uNumFaces < 0; v21 = 0; if ( !(v10 | v9) ) { v22 = 0; do { - v11 = &(*(ODMFace **)((char *)&v8->pFaces + v4))[v22 / 0x134]; + v11 = &v8[v4]->pFaces[v22 / 0x134]; v12 = v11->sCogTriggeredID; if ( v12 ) { @@ -15577,10 +15615,10 @@ } } ++v21; - v8 = pOutdoor->pBModels; + v8 = &pOutdoor->pBModels; v22 += 308; } - while ( v21 < *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) ); + while ( v21 < pOutdoor->pBModels[v4].uNumFaces ); } result = v17; if ( v17 ) @@ -16204,7 +16242,7 @@ { v23 = v0->evtf; LABEL_63: - v24 = (&dword_721660)[8 * v23]; + v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; if ( !v24 ) { v24 = ""; @@ -17767,12 +17805,12 @@ { if ( _5C3420_pDecoration == (LevelDecoration *)1 ) { - ptr_F8B1E8 = (&dword_721664)[8 * v90]; + ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; goto LABEL_291; } if ( a3 == 1 ) { - v91 = (&dword_721664)[8 * v90]; + v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; LABEL_248: ShowStatusBarString(v91, 2u); goto LABEL_291; @@ -17791,7 +17829,7 @@ v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) { - v93 = (&dword_721664)[8 * v92]; + v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; ptr_F8B1E8 = v93; } @@ -18326,9 +18364,9 @@ unsigned int v3; // ebx@1 unsigned int v4; // ebp@1 signed int v5; // edi@1 - char *v6; // esi@4 + Actor *v6; // esi@4 size_t v7; // ecx@10 - char *v8; // eax@11 + Actor *v8; // eax@11 unsigned __int16 v9; // dx@14 v4 = uGroupID; @@ -18340,20 +18378,20 @@ { if ( (signed int)uNumActors > Standing ) { - v6 = (char *)&pActors[0].uAttributes; + v6 = pActors;//[0].uAttributes; do { - if ( *((_DWORD *)v6 + 168) == v4 ) - { - *(_DWORD *)v6 |= v3; + if ( v6->uGroup == v4 ) + { + v6->uAttributes |= v3; if ( v3 == 0x10000 ) { - *((_WORD *)v6 + 70) = Disabled; - ((Actor *)(v6 - 36))->UpdateAnimation(); + v6->uAIState = Disabled; + v6->UpdateAnimation(); } } ++v5; - v6 += 836; + ++v6; } while ( v5 < (signed int)uNumActors ); } @@ -18363,23 +18401,23 @@ v7 = uNumActors; if ( (signed int)uNumActors > Standing ) { - v8 = (char *)&pActors[0].uAIState; + v8 = pActors;//[0].uAIState; do { - if ( *((_DWORD *)v8 + 133) == v4 ) + if ( v8->uGroup == v4 ) { if ( v3 == 0x10000 ) { - v9 = *(_WORD *)v8; - if ( *(_WORD *)v8 != Dead ) + v9 = v8->uAIState; + if ( v8->uAIState != Dead ) { if ( v9 != 4 && v9 != 11 ) - *(_WORD *)v8 = Standing; - } - } - *((_DWORD *)v8 - 35) &= ~v3; - } - v8 += 836; + v8->uAIState = Standing; + } + } + LODWORD(v8->uAttributes) &= ~v3; + } + ++v8; --v7; } while ( v7 ); @@ -19865,7 +19903,7 @@ //----- (004016FA) -------------------------------------------------------- int __cdecl BLV_4016FA_AI() { - char *v0; // esi@2 + Actor *v0; // esi@2 int v1; // eax@4 int v2; // ebx@4 unsigned int v3; // ecx@4 @@ -19889,7 +19927,7 @@ bool v21; // eax@33 int v22; // eax@34 signed int v23; // ebx@36 - char *v24; // esi@37 + Actor *v24; // esi@37 signed int v25; // eax@40 int v26; // eax@43 int v27; // ebx@45 @@ -19917,15 +19955,15 @@ v43 = 0; if ( (signed int)uNumActors > 0 ) { - v0 = (char *)&pActors[0].uAttributes; - do - { - v0[1] &= 0xFBu; - if ( ! ((Actor *)(v0 - 36))->CanAct() ) + v0 = pActors;//[0].uAttributes; + do + { + BYTE1(v0->uAttributes) &= 0xFBu; + if ( ! v0->CanAct() ) goto LABEL_60; - v39 = abs(pParty->vPosition.z - *((short *)v0 + 55)); - v38 = abs(pParty->vPosition.y - *((short *)v0 + 54)); - v1 = abs(pParty->vPosition.x - *((short *)v0 + 53)); + v39 = abs(pParty->vPosition.z - v0->vPosition.z); + v38 = abs(pParty->vPosition.y - v0->vPosition.y); + v1 = abs(pParty->vPosition.x - v0->vPosition.x); v2 = v38; v3 = v39; if ( v1 < v38 ) @@ -19947,7 +19985,7 @@ v2 = v6; } v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; - v8 = *((short *)v0 + 50); + v8 = v0->uActorRadius; v9 = v7 - v8; v40 = v7 - v8; if ( v40 < 0 ) @@ -19957,12 +19995,12 @@ } if ( v9 < 10240 ) { - v10 = *(int *)v0 & 0xFEFFFFFF; - *(int *)v0 = v10; - if ( v10 & 0x80000 || ((Actor *)(v0 - 36))->GetActorsRelation(0) ) + v10 = v0->uAttributes & 0xFEFFFFFF; + v0->uAttributes = v10; + if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) { v11 = (pParty->uFlags & 0x10) == 0; - *(int *)v0 = v10 | 0x1000000; + v0->uAttributes = v10 | 0x1000000; if ( v11 && (double)v40 < 307.2 ) pParty->uFlags |= 0x10u; if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) @@ -19975,10 +20013,10 @@ else { LABEL_60: - v0[1] &= 0xBFu; + BYTE1(v0->uAttributes) &= 0xBFu; } ++v43; - v0 += 836; + ++v0; } while ( v43 < (signed int)uNumActors ); } @@ -20034,17 +20072,17 @@ ai_arrays_size = v19; if ( (signed int)uNumActors > 0 ) { - v24 = (char *)&pActors[0].uAttributes; - do - { - if ( ((Actor *)(v24 - 36))->CanAct() && *((short *)v24 + 61) == v37 ) + v24 = pActors;//[0].uAttributes; + do + { + if ( v24->CanAct() && v24->uSectorID == v37 ) { v25 = 0; if ( v19 <= 0 ) { LABEL_43: v26 = ai_arrays_size; - v24[1] |= 0x40u; + BYTE1(v24->uAttributes) |= 0x40u; ++ai_arrays_size; ai_array_4F6638_actor_ids[v26] = v23; } @@ -20059,7 +20097,7 @@ } } ++v23; - v24 += 836; + ++v24; } while ( v23 < (signed int)uNumActors ); } @@ -20120,7 +20158,7 @@ int v2; // ecx@7 int v3; // eax@7 signed int v4; // edi@10 - char *v5; // esi@12 + Actor *v5; // esi@12 signed int v6; // eax@14 __int16 v7; // cx@14 Player **v8; // esi@20 @@ -20231,14 +20269,14 @@ v84 = 0; if ( (signed int)uNumActors > 0 ) { - v5 = (char *)&pActors[0].sCurrentHP; + v5 = pActors;//[0].sCurrentHP; do { - if ( ((Actor *)(v5 - 40))->CanAct() ) - { - v6 = stru_50C198.CalcMagicalDamageToActor((Actor *)(v5 - 40), 5, v4); - v7 = *(short *)v5 - v6; - *(short *)v5 = v7; + if ( v5->CanAct() ) + { + v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); + v7 = v5->sCurrentHP - v6; + v5->sCurrentHP = v7; if ( v6 ) { if ( v7 >= 0 ) @@ -20248,13 +20286,13 @@ else { Actor::Die(v84); - if ( *((int *)v5 + 19) ) - sub_4269A2_GivePartyExp(pMonsterStats->pInfos[*((short *)v5 + 28)].uExp); + if ( v5->pMonsterInfo.uExp ) + sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); } } } ++v84; - v5 += 836; + ++v5; } while ( (signed int)v84 < (signed int)uNumActors ); } diff -r ec84db4c8f9d -r 170259c8c71f mm7_4.cpp --- a/mm7_4.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_4.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -5047,7 +5047,7 @@ v24 = v23; dword_A74CDC = v23; } - v11 = (char *)dword_723E80_award_related[2 * v55[v24]]; + v11 = (char *)pAwards[v55[v24]-1].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; } else { @@ -10303,7 +10303,7 @@ { v23 = v58->evtf; LABEL_33: - v15 = (&dword_721660)[8 * v23]; + v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; if ( !v15 ) { v16->uControlParam = 0; @@ -10323,7 +10323,7 @@ v20 = v19 - 1; if ( !v20 ) { - v15 = (&dword_721660)[8 * v58->evtb]; + v15 = (char *)pNPCTopics[v58->evtb-1].pTopic;//(&dword_721660)[8 * v58->evtb]; if ( !v15 ) { v16->uControlParam = 0; diff -r ec84db4c8f9d -r 170259c8c71f mm7_5.cpp --- a/mm7_5.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_5.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -12102,7 +12102,7 @@ { unsigned int *v2; // esi@1 signed int v3; // ebx@1 - char *v4; // edi@2 + Actor *v4; // edi@2 int v5; // eax@3 int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 @@ -12116,21 +12116,21 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].pMonsterInfo.uID; + v4 = pActors;//[0].pMonsterInfo.uID; do { - v5 = *((int *)v4 - 15); // actor::attributes + v5 = v4->uAttributes; // actor::attributes if ( (v5 & 0x100000) == v8 ) { - if ( *(short *)v4 - 1 == v7 ) + if ( v4->pMonsterInfo.field_33 == v7 ) { ++*v2; - if ( ((Actor *)(v4 - 96))->IsAlive() == 1 ) + if ( v4->IsAlive() == 1 ) ++v9; } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); } @@ -12142,7 +12142,7 @@ { unsigned int *v2; // esi@1 signed int v3; // ebx@1 - char *v4; // edi@2 + Actor *v4; // edi@2 int v5; // eax@3 unsigned int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 @@ -12156,21 +12156,21 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uGroup; + v4 = pActors;//[0].uGroup; do { - v5 = *((int *)v4 - 168); + v5 = v4->uAttributes; if ( (v5 & 0x100000) == v8 ) { - if ( *(int *)v4 == v7 ) + if ( v4->uGroup == v7 ) { ++*v2; - if ( ((Actor *)(v4 - 708))->IsAlive() == 1 ) + if ( v4->IsAlive() == 1 ) ++v9; } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); } @@ -13539,7 +13539,7 @@ pRenderer->DrawTextureTransparent(v1, v12, v14); if ( !byte_5C6D50[dword_506528] ) { - v2 = pStru179->field_0[dword_506528]; + v2 = pStru179.field_0[dword_506528]; a1.uFrameWidth = 460; a1.uFrameX = 8; a1.uFrameY = 8; @@ -13577,7 +13577,7 @@ dword_50651C = 0; } dword_506544 = 0; - v6 = pStru179->field_0[dword_506528]; + v6 = pStru179.field_0[dword_506528]; dword_506548 = 0; dword_506520 = 0; v7 = *(&pStorylineText->field_0 + 3 * v6); @@ -13679,10 +13679,10 @@ dword_506520 = 0; while ( v3 < dword_506524 ) { - v4 = pStru179->field_0[v3]; + v4 = pStru179.field_0[v3]; ++dword_506520; - v5 = (&dword_722F10)[4 * v4]; - a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_722F10)[4 * v4], 0, 0, 0); + v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; + a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); v7 = a1.uFrameY + v6; if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight ) @@ -13928,15 +13928,17 @@ v8 = 0; do { - if ( dword_72371C[2 * v8] == dword_506568 ) - { - v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; + //if ( dword_72371C[2 * v8] == dword_506568 ) + if ( pAutonoteTxt[v8-1].eType == dword_506568 ) + { + //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; + v32 = (char *)pAutonoteTxt[v8-1].pText; if ( (short)v8 ) { if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) { v9 = dword_506520++; - pStru179->field_0[v9] = (signed __int16)v8; + pStru179.field_0[v9] = (signed __int16)v8; } } } @@ -13982,10 +13984,12 @@ dword_506540 = 0; while ( v12 < dword_506524 ) { - v13 = pStru179->field_0[v12]; + v13 = pStru179.field_0[v12]; ++dword_506520; - v14 = (&dword_723718_autonote_related)[8 * v13]; - a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); + //v14 = (&dword_723718_autonote_related)[8 * v13]; + v14 = pAutonoteTxt[v13-1].pText; + //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); + a1.DrawText(pAutonoteFont, 1, 0, 0, pAutonoteTxt[v13-1].pText, 0, 0, 0); v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0); v16 = a1.uFrameY + v15; if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight ) @@ -14224,6 +14228,15 @@ a1.uFrameZ = 467; a1.uFrameW = 467; a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[186], 3u); + if ( pParty->uCurrentHour >= 12 ) + { + if ( pParty->uCurrentHour >= 24 ) + v2=0; + else + v2=1; + } + else + v2=0; v1 = GetDayPart(); sprintf( pTmpBuf, @@ -17627,7 +17640,7 @@ unsigned __int8 v10; // of@7 stru179 *v11; // edi@9 int v12; // edx@11 - int v13; // [sp+Ch] [bp-8h]@2 + char *v13; // [sp+Ch] [bp-8h]@2 signed int v14; // [sp+Ch] [bp-8h]@9 int i; // [sp+10h] [bp-4h]@10 @@ -17643,11 +17656,11 @@ v2 = (unsigned __int8 *)pPlayer->field_152; do { - v13 = dword_723E80_award_related[2 * v1]; + v13 = (char *)pAwards[v1-1].pText;//dword_723E80_award_related[2 * v1]; if ( (unsigned __int16)_449B57_test_bit(v2, v1) && v13 ) { v3 = dword_506520++; - pStru179->field_0[v3] = v1; + pStru179.field_0[v3] = v1; } ++v1; } @@ -17667,21 +17680,22 @@ v9 = dword_506524 + v5++; v10 = v5 > dword_506524;//__OFSUB__(v5, dword_506524); v7 = v5 - dword_506524 < 0; - pStru179->field_0[v9] = v8; + pStru179.field_0[v9] = v8; } while ( v7 ^ v10 ); if ( result > 0 ) { v14 = 1; - v11 = pStru179; + v11 = &pStru179; do { for ( i = v14; i < result; ++i ) { - v12 = pStru179->field_0[i]; - if ( dword_723E84[2 * v12] < dword_723E84[2 * v11->field_0[0]] ) - { - pStru179->field_0[i] = v11->field_0[0]; + v12 = pStru179.field_0[i]; + //if ( dword_723E84[2 * v12] < dword_723E84[2 * v11->field_0[0]] ) + if(pAwards[v12-1].uSort < pAwards[v11->field_0[0]].uSort) + { + pStru179.field_0[i] = v11->field_0[0]; v11->field_0[0] = v12; } } diff -r ec84db4c8f9d -r 170259c8c71f mm7_6.cpp --- a/mm7_6.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_6.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -1296,13 +1296,13 @@ { unsigned __int64 v1; // qax@1 signed int v2; // ecx@1 - char *v3; // esi@1 + int *v3; // esi@1 bool v4; // edi@6 - char *v5; // edi@10 - char *v6; // esi@10 + int *v5; // edi@10 + Player *v6; // esi@10 int v7; // eax@13 unsigned __int8 v8; // cf@13 - char v10; // [sp+Ch] [bp-14h]@1 + int v10; // [sp+Ch] [bp-14h]@1 int v11; // [sp+1Ch] [bp-4h]@10 v1 = __PAIR__((int)((char *)&pParty + 2620), a1); @@ -1314,40 +1314,40 @@ && !*(int *)HIDWORD(v1) && !*(_QWORD *)(HIDWORD(v1) + 8) && !*(_QWORD *)(HIDWORD(v1) + 16); - *(int *)v3 = v4; + *v3 = v4; HIDWORD(v1) += 6972; v2 += v4; - v3 += 4; + ++v3; } while ( SHIDWORD(v1) < (signed int)&pParty->pHirelings[1].field_24 ); if ( v2 ) { LODWORD(v1) = (signed int)v1 / v2; v5 = &v10; - v6 = (char *)&pParty->pPlayers[0].uExperience; + v6 = pParty->pPlayers;//[0].uExperience; v11 = v1; do { - if ( *(int *)v5 ) + if ( *v5 ) { if ( v11 ) { - LOBYTE(v7) = ((Player *)(v6 - 160))->GetLearningPercent(); + LOBYTE(v7) = v6->GetLearningPercent(); v1 = v11 + v11 * v7 / 100; - v8 = __CFADD__((int)v1, *(int *)v6); - *(int *)v6 += v1; - *((int *)v6 + 1) += HIDWORD(v1) + v8; - if ( *(_QWORD *)v6 > 4000000000i64 ) + v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); + LODWORD(v6->uExperience) += v1; + HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; + if ( v6->uExperience > 4000000000i64 ) { - *((int *)v6 + 1) = 0; - *(int *)v6 = -294967296; + HIDWORD(v6->uExperience) = 0; + LODWORD(v6->uExperience) = -294967296; } } } - v6 += 6972; - v5 += 4; + ++v6; + ++v5; } - while ( (signed int)v6 < (signed int)&pParty->pPickedItem._bonus_strength ); + while ( v6 <= &pParty->pPlayers[3] ); } return v1; } @@ -7476,7 +7476,7 @@ if ( *(int *)v605 != v1 ) { v606 = HIDWORD(v733)++; - pStru179->field_0[v606] = (int)((char *)&_this->uItemID + 1); + pStru179.field_0[v606] = (int)((char *)&_this->uItemID + 1); } _this = (ItemGen *)((char *)_this + 1); v605 += 76; @@ -8292,7 +8292,7 @@ signed int __cdecl sub_42F4DA() { signed int v0; // edi@1 - char *v1; // esi@4 + Actor *v1; // esi@4 int v2; // ebx@5 int v3; // eax@5 int v4; // ebx@5 @@ -8317,12 +8317,12 @@ } else { - v1 = (char *)&pActors[0].uAIState; + v1 = pActors; while ( 1 ) { - v2 = abs(*((short *)v1 - 17) - pParty->vPosition.x); - v11 = abs(*((short *)v1 - 16) - pParty->vPosition.y); - v12 = abs(*((short *)v1 - 15) - pParty->vPosition.z); + v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); + v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); + v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); v3 = v2; v4 = v11; v5 = v12; @@ -8346,19 +8346,19 @@ } if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) { - v9 = *(short *)v1; - if ( *(short *)v1 != 5 ) + v9 = v1->uAIState; + if ( v1->uAIState != 5 ) { if ( v9 != 4 && v9 != 11 && v9 != 19 && v9 != 17 - && (*(v1 - 138) & 8 || ((Actor *)nullptr)->GetActorsRelation( (Actor *)(v1 - 176))) ) + && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) break; } } ++v13; - v1 += 836; + ++v1; if ( v13 >= (signed int)uNumActors ) goto LABEL_20; } @@ -8671,33 +8671,35 @@ } //----- (0042FA22) -------------------------------------------------------- -char *__cdecl sub_42FA22_mess_with_laying_item_list() +LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list() { size_t v0; // edx@1 int v1; // ebp@1 - char *result; // eax@1 - void *v3; // ebx@1 + LayingItem *result; // eax@1 + LayingItem *v3; // ebx@1 v0 = 0; v1 = 0; - result = (char *)&pLayingItems[0].uObjectDescID; + //result = (char *)&pLayingItems[0].uObjectDescID; + result = pLayingItems; v3 = pLayingItems; do { - if ( *(short *)result ) + if ( result->uObjectDescID ) { if ( v1 != v0 ) { - memcpy(v3, result - 2, 0x70u); - *(short *)result = 0; + memcpy(v3, result, 0x70u); + result->uObjectDescID = 0; } ++v0; - v3 = (char *)v3 + 112; + ++v3;// = (char *)v3 + 112; } - result += 112; + ++result;// += 112; ++v1; } - while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); + //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); + while( result <= &pLayingItems[999] ); uNumLayingItems = v0; return result; } diff -r ec84db4c8f9d -r 170259c8c71f mm7_data.cpp --- a/mm7_data.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_data.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -55,7 +55,7 @@ stru157 a3; // idb #include "stru179.h" -stru179 *pStru179; +stru179 pStru179; #include "stru123.h" stru123 stru_5E4C90; diff -r ec84db4c8f9d -r 170259c8c71f mm7_data.h --- a/mm7_data.h Mon Feb 04 09:17:35 2013 +0600 +++ b/mm7_data.h Mon Feb 04 09:17:49 2013 +0600 @@ -1,7 +1,7 @@ #pragma once #include #include "OSAPI.h" - +#include "LayingItem.h" #include "VectorTypes.h" typedef char _UNKNOWN; @@ -1940,7 +1940,7 @@ signed int __cdecl sub_42F4DA(); bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9); void __fastcall sub_42F960_create_object(int x, int y, int z); // idb -char *__cdecl sub_42FA22_mess_with_laying_item_list(); +LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list(); signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); bool __fastcall sub_42FB5C(signed int a1); // int __cdecl crt_sub_42FBB7(); diff -r ec84db4c8f9d -r 170259c8c71f stru179.h --- a/stru179.h Mon Feb 04 09:17:35 2013 +0600 +++ b/stru179.h Mon Feb 04 09:17:49 2013 +0600 @@ -9,4 +9,4 @@ }; #pragma pack(pop) -extern struct stru179 *pStru179; \ No newline at end of file +extern struct stru179 pStru179; \ No newline at end of file