Mercurial > mm7
changeset 2472:e42e01ff1526
goto cleaning
author | zipi |
---|---|
date | Mon, 18 Aug 2014 18:17:20 +0100 |
parents | b61ebbb46ace |
children | 98eda972505f |
files | Arcomage.cpp GUIWindow.cpp Indoor.cpp IndoorCameraD3D.cpp LightmapBuilder.cpp Mouse.cpp Outdoor.cpp |
diffstat | 7 files changed, 318 insertions(+), 221 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/Arcomage.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -1074,7 +1074,7 @@ pArcomageGame->field_F6 = 1; byte_4FAA24 = 1; IncreaseResourcesInTurn(current_player_num); -LABEL_8: +//LABEL_8: while ( byte_4FAA24 ) { played_card_id = -1; @@ -1085,8 +1085,8 @@ if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand ) break; need_to_discard_card = 1; - if ( pArcomageGame->field_F4 ) - goto LABEL_8; + if (pArcomageGame->field_F4) + continue; } need_to_discard_card = 0; } @@ -2149,9 +2149,8 @@ if ( am_Players[current_player_num].cards_at_hand[v2] == -1 ) { ++v0; - goto LABEL_15; } - if ( v2 != amuint_4FAA4C ) + else if ( v2 != amuint_4FAA4C ) { if ( am_Players[current_player_num].IsHisTurn == 0 && byte_505881 == 0 ) { @@ -2161,19 +2160,26 @@ pSrcXYZW.bottom = 128; pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);//рисуется оборотные стороны карт противника pTargetXY.x += v24 + 96; - goto LABEL_15; } - pArcomageGame->GetCardRect(v7, &pSrcXYZW); - if ( !CanCardBePlayed(current_player_num, v2) ) - { - pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);//рисуются неактивные карты - pTargetXY.x += v24 + 96; - goto LABEL_15; - } - pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);//рисуются активные карты + else + { + + pArcomageGame->GetCardRect(v7, &pSrcXYZW); + if (!CanCardBePlayed(current_player_num, v2)) + { + pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0);//рисуются неактивные карты + pTargetXY.x += v24 + 96; + } + else + { + pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2);//рисуются активные карты + pTargetXY.x += v24 + 96; + } + } } - pTargetXY.x += v24 + 96; -LABEL_15: + else + pTargetXY.x += v24 + 96; +//LABEL_15: if ( am_byte_4E185D ) { pTargetXY.x -= am_Players[current_player_num].card_shift[v2].x;
--- a/GUIWindow.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/GUIWindow.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -2903,7 +2903,8 @@ current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); NPCHireableDialogPrepare(); dialogue_show_profession_details = false; - goto _return; + BackToHouseMenu(); + return; case 19: pEventNumber = pCurrentNPCInfo->evt_A; break; @@ -2923,7 +2924,8 @@ pEventNumber = pCurrentNPCInfo->evt_F; break; default: - goto _return; + BackToHouseMenu(); + return; } /*switch ( pEventNumber ) { @@ -2967,7 +2969,8 @@ { _4B3FE5_training_dialogue(pEventNumber); } - goto _return; + BackToHouseMenu(); + return; } if (uMessageParam != 76) { @@ -3078,18 +3081,23 @@ if (uActiveCharacter) { pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); - goto _return; + BackToHouseMenu(); + return; } } } } - goto _return; + BackToHouseMenu(); + return; } if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" - goto _return; + BackToHouseMenu(); + return; } + + if (pCurrentNPCInfo->uProfession != 51) //burglars have no hiring price { __debugbreak(); // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok @@ -3104,9 +3112,11 @@ if (uActiveCharacter) pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - goto _return; + BackToHouseMenu(); + return; } - Party::TakeGold(pPrice); + else + Party::TakeGold(pPrice); } //LOBYTE(v2->uFlags) |= 0x80u; pCurrentNPCInfo->uFlags |= 128; @@ -3140,6 +3150,7 @@ }*/ if (uActiveCharacter) pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); + _return: BackToHouseMenu(); }
--- a/Indoor.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/Indoor.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -1898,47 +1898,53 @@ _a = true; //v154 = 875; - if (_v244) - { - memset(v203, 0, 0x36B); - goto LABEL_132; - } - if (_a || !dlv.uLastRepawnDay ) + if (_v244 || (_a || !dlv.uLastRepawnDay)) { - memcpy(v203, pData, 0x36B); -LABEL_132: - free(pRawDLV); - dlv.uLastRepawnDay = a3; - if (_v244) - ++dlv.uNumRespawns; - //v201 = pFilename; - *(int *)pDest = 1; - File = pGames_LOD->FindContainer(pFilename, 0); - fread(&header, 0x10u, 1, File); - uint v155 = header.uCompressedSize; - uint Count = header.uDecompressedSize; - BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize); - pRawDLV = Src; - if ( v155 <= Count ) - { - if ( v155 == Count ) - fread(Src, 1, Count, File); - else - { - void* _uSourceLen = malloc(v155); - fread(_uSourceLen, v155, 1, File); - zlib::MemUnzip(Src, &Count, _uSourceLen, v155); - free(_uSourceLen); - } - } - else - MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); - pData = ((char *)Src + 40); - //v154 = 875; - goto LABEL_140; + if (_v244) + { + memset(v203, 0, 0x36B); + } + else if (_a || !dlv.uLastRepawnDay) + { + memcpy(v203, pData, 0x36B); + } + + free(pRawDLV); + dlv.uLastRepawnDay = a3; + if (_v244) + ++dlv.uNumRespawns; + //v201 = pFilename; + *(int *)pDest = 1; + File = pGames_LOD->FindContainer(pFilename, 0); + fread(&header, 0x10u, 1, File); + uint v155 = header.uCompressedSize; + uint Count = header.uDecompressedSize; + BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize); + pRawDLV = Src; + if (v155 <= Count) + { + if (v155 == Count) + fread(Src, 1, Count, File); + else + { + void* _uSourceLen = malloc(v155); + fread(_uSourceLen, v155, 1, File); + zlib::MemUnzip(Src, &Count, _uSourceLen, v155); + free(_uSourceLen); + } + } + else + MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0); + pData = ((char *)Src + 40); + //v154 = 875; } - *(int *)pDest = 0; -LABEL_140: + else + { + *(int *)pDest = 0; + } + + +//LABEL_140: //v202 = (int)".blv"; //v156 = strlen(pFilename); strcpy(&pFilename[strlen(pFilename) - 4], ".blv"); @@ -2375,9 +2381,8 @@ a3->y = 0; a3->z = 0xFFFF0000u; - goto LABEL_12; } - if ( this->uPolygonType == POLYGON_Floor || this->uPolygonType == POLYGON_Ceiling ) + else if ( this->uPolygonType == POLYGON_Floor || this->uPolygonType == POLYGON_Ceiling ) { a2->x = 0x10000u; a2->y = 0; @@ -2387,9 +2392,8 @@ a3->y = 0xFFFF0000u; a3->z = 0; - goto LABEL_12; } - if ( this->uPolygonType == POLYGON_InBetweenFloorAndWall || this->uPolygonType == POLYGON_InBetweenCeilingAndWall ) + else if ( this->uPolygonType == POLYGON_InBetweenFloorAndWall || this->uPolygonType == POLYGON_InBetweenCeilingAndWall ) { if ( abs(this->pFacePlane_old.vNormal.z) < 46441 ) { @@ -2406,19 +2410,20 @@ a3->z = 0xFFFF0000u; a3->x = 0; - goto LABEL_12; } - a2->x = 0x10000u; - a2->y = 0; - a2->z = 0; - - a3->x = 0; - a3->y = 0xFFFF0000u; - a3->z = 0; - - goto LABEL_12; + else + { + a2->x = 0x10000u; + a2->y = 0; + a2->z = 0; + + a3->x = 0; + a3->y = 0xFFFF0000u; + a3->z = 0; + } + } -LABEL_12: +//LABEL_12: if ( this->uAttributes & 0x800000 ) { a2->x = -a2->x; @@ -2521,8 +2526,10 @@ door->uState = BLVDoor::Open; if ( !(door->uAttributes & 6) && door->uNumVertices != 0) pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0); - goto LABEL_18; + //goto LABEL_18; } + else if (!(door->uAttributes & 6) && door->uNumVertices) + pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor, i), 1, -1, 0, 0, 0, 0); } else { @@ -2533,13 +2540,17 @@ door->uState = BLVDoor::Closed; if ( !(door->uAttributes & 6) && door->uNumVertices != 0) pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(OBJECT_BLVDoor,i), 0, -1, 0, 0, 0, 0); - goto LABEL_18; + //goto LABEL_18; } - v89 = door->uMoveLength - v5; + else + { + v89 = door->uMoveLength - v5; + if (!(door->uAttributes & 6) && door->uNumVertices) + pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor, i), 1, -1, 0, 0, 0, 0); + } } - if ( !(door->uAttributes & 6) && door->uNumVertices) - pAudioPlayer->PlaySound(eDoorSoundID, PID(OBJECT_BLVDoor,i), 1, -1, 0, 0, 0, 0); -LABEL_18: + +//LABEL_18: for (uint j = 0; j < door->uNumVertices; ++j) { pIndoor->pVertices[door->pVertexIDs[j]].x = fixpoint_mul(door->vDirection.x, v89) + door->pXOffsets[j]; @@ -2797,7 +2808,7 @@ + pActors[actor_id].vVelocity.y * pActors[actor_id].vVelocity.y + pActors[actor_id].vVelocity.z * pActors[actor_id].vVelocity.z >= 400 ) { - stru_721530.field_84 = -1; + stru_721530.field_84 = -1; stru_721530.field_70 = 0; stru_721530.field_0 = 1; stru_721530.field_8_radius = pActors[actor_id].uActorRadius; @@ -2875,7 +2886,7 @@ pActors[actor_id].vPosition.y = LOWORD(stru_721530.normal2.y); pActors[actor_id].vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; pActors[actor_id].uSectorID = LOWORD(stru_721530.uSectorID); - goto LABEL_123; + continue; } pActors[actor_id].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); pActors[actor_id].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); @@ -3033,12 +3044,12 @@ } else { - if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->turn_stage == TE_MOVEMENT) ) - goto LABEL_123; + if (pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->turn_stage == TE_MOVEMENT)) + continue; if ( !pActors[actor_id].pMonsterInfo.uHostilityType || v56 != v22 ) { Actor::AI_StandOrBored(actor_id, 4, v22, &v52); - goto LABEL_123; + continue; } } }
--- a/IndoorCameraD3D.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/IndoorCameraD3D.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -1099,54 +1099,77 @@ if ( v7 == a1a ) { v10 = pOutVertices; - goto LABEL_23; - } - v9 = *pOutNumVertices_; - if ( a1a ) - { - v10 = pOutVertices; - v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18)); - pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17); - pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11 - + *((float *)v8 - 16); - pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12); - pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11); - } - else - { - v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6)); - pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5); - pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12 - + *((float *)v8 - 4); - pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8; - pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1); - v10 = pOutVertices; + //goto LABEL_23; } - v10[*pOutNumVertices_].vWorldViewPosition.x = v6; - v10[*pOutNumVertices_]._rhw = 1.0 / v6; - if ( v7 ) - { - v13 = (unsigned int)&v10[*pOutNumVertices_]; - if ( *(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17) ) - goto LABEL_21; - v14 = 0; - v15 = *(float *)(v13 + 20) == *((float *)v8 - 16); - } - else - { - v16 = (unsigned int)&v10[*pOutNumVertices_]; - if ( *(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5) ) - { -LABEL_21: - ++*pOutNumVertices_; - goto LABEL_23; - } - v14 = 0; - v15 = *(float *)(v16 + 20) == *((float *)v8 - 4); - } - if ( !(v15 | v14) ) - goto LABEL_21; -LABEL_23: + else + { + + v9 = *pOutNumVertices_; + if (a1a) + { + v10 = pOutVertices; + v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18)); + pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17); + pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11 + + *((float *)v8 - 16); + pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12); + pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11); + } + else + { + v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6)); + pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5); + pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12 + + *((float *)v8 - 4); + pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8; + pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1); + v10 = pOutVertices; + } + v10[*pOutNumVertices_].vWorldViewPosition.x = v6; + v10[*pOutNumVertices_]._rhw = 1.0 / v6; + if (v7) + { + v13 = (unsigned int)&v10[*pOutNumVertices_]; + if (*(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17)) + { + ++*pOutNumVertices_; + //goto LABEL_23; + } + else + { + v14 = 0; + v15 = *(float *)(v13 + 20) == *((float *)v8 - 16); + if (!(v15 | v14)) + { + //goto LABEL_21; + ++*pOutNumVertices_; + //goto LABEL_23; + } + } + } + else + { + v16 = (unsigned int)&v10[*pOutNumVertices_]; + if (*(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5)) + { + //LABEL_21: + ++*pOutNumVertices_; + //goto LABEL_23; + } + else + { + v14 = 0; + v15 = *(float *)(v16 + 20) == *((float *)v8 - 4); + if (!(v15 | v14)) + { + //goto LABEL_21; + ++*pOutNumVertices_; + //goto LABEL_23; + } + } + } + } + //LABEL_23: if ( a1a ) { memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_]));
--- a/LightmapBuilder.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/LightmapBuilder.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -718,7 +718,7 @@ v8 = 0; if ( *a5 <= 0 ) { -LABEL_5: +//LABEL_5: a4[v7] = v6; ++*a5; } @@ -727,8 +727,13 @@ while ( a4[v8] != v6 ) { ++v8; - if ( v8 >= v7 ) - goto LABEL_5; + if (v8 >= v7) + { + a4[v7] = v6; + ++*a5; + break; + //goto LABEL_5; + } } } } @@ -1055,31 +1060,41 @@ { pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x); v12 = a1[3].vWorldPosition.x; + //uStripType = LODWORD(v12); + a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); + v13 = v11->vWorldPosition.y; } else { if ( uStripType != 3 ) { MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:981", 0); - goto LABEL_11; + //goto LABEL_11; } - if ( (unsigned char)X ) + else if ((unsigned char)X) { pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x); uStripType = LODWORD(a1[2].vWorldPosition.x); a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); v13 = v11[2].vWorldPosition.y; - goto LABEL_5; + v64 = v13; + //goto LABEL_11; + //goto LABEL_5; } - pLight = (StationaryLight *)LODWORD(a1[1].vWorldPosition.x); - v12 = a1[2].vWorldPosition.x; + else + { + pLight = (StationaryLight *)LODWORD(a1[1].vWorldPosition.x); + v12 = a1[2].vWorldPosition.x; + a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); + v13 = v11->vWorldPosition.y; + v64 = v13; + //uStripType = LODWORD(v12); + a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); + v13 = v11->vWorldPosition.y; + } } - //uStripType = LODWORD(v12); - a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); - v13 = v11->vWorldPosition.y; -LABEL_5: - v64 = v13; -LABEL_11: + +//LABEL_11: //v60 = v10; v59 = (const char *)v11; v60 = v12;//uStripType;
--- a/Mouse.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/Mouse.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -112,27 +112,43 @@ //} this->uMouseClickX = v2; this->uMouseClickY = result; - if ( true/*pRenderer->bWindowMode*/) + + /* + //This block has been commented out, because of the changed condition above "if(true)" + //Also the next condition and the first line has been commented out as well + + // if (pRenderer->bWindowMode) + if ( true ) goto LABEL_16; //if (pAsyncMouse) // goto LABEL_24; + + if ( v2 < 0 ) v2 = 0; if ( result < 0 ) result = 0; if ( v2 > window->GetWidth() - 1 ) v2 = window->GetWidth() - 1; - if ( result > window->GetHeight() - 1 ) - { - result = window->GetHeight() - 1; -LABEL_16: + */ + +// if ( result > window->GetHeight() - 1 ) +// { +// result = window->GetHeight() - 1; +//LABEL_16: //if (pAsyncMouse) // goto LABEL_24; - if (true/*pRenderer->bWindowMode*/ && (v2 < 0 || result < 0 || v2 > window->GetWidth() -1 || result > window->GetHeight() - 1) ) - goto LABEL_23; - } + if (true/*pRenderer->bWindowMode*/ && (v2 < 0 || result < 0 || v2 > window->GetWidth() - 1 || result > window->GetHeight() - 1)) + { + this->bActive = false; + //LABEL_24: + this->field_8 = 0; + return result; + } + //} + if ( this->field_C ) -LABEL_23: +//LABEL_23: this->bActive = false; //LABEL_24: this->field_8 = 0;
--- a/Outdoor.cpp Mon Aug 18 22:24:00 2014 +0600 +++ b/Outdoor.cpp Mon Aug 18 18:17:20 2014 +0100 @@ -1734,25 +1734,35 @@ { v62 = pBitmaps_LOD->LoadTexture(texFilename); // v63 = (ODMFace *)pFilename; - goto LABEL_68; + pBModels[i].pFaces[j].uTextureID = v62; + //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; + //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); + if ((signed __int16)v62 != -1) + pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1); + //goto LABEL_69; + //goto LABEL_68; } - //v61 = pTextureFrameTable->FindTextureByName(texFilename); - pBModels[i].pFaces[j].uTextureID = pTextureFrameTable->FindTextureByName(texFilename); - if (!pBModels[i].pFaces[j].uTextureID) - { - v62 = pBitmaps_LOD->LoadTexture(texFilename); - //v63 = (ODMFace *)pFilename; - pBModels[i].pFaces[j].uAttributes &= ~FACE_DONT_CACHE_TEXTURE; -LABEL_68: - pBModels[i].pFaces[j].uTextureID = v62; - //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; - //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); - if ((signed __int16)v62 != -1) - pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1); - goto LABEL_69; - } - pTextureFrameTable->LoadAnimationSequenceAndPalettes(pBModels[i].pFaces[j].uTextureID); -LABEL_69: + else + { + //v61 = pTextureFrameTable->FindTextureByName(texFilename); + pBModels[i].pFaces[j].uTextureID = pTextureFrameTable->FindTextureByName(texFilename); + if (!pBModels[i].pFaces[j].uTextureID) + { + v62 = pBitmaps_LOD->LoadTexture(texFilename); + //v63 = (ODMFace *)pFilename; + pBModels[i].pFaces[j].uAttributes &= ~FACE_DONT_CACHE_TEXTURE; + //LABEL_68: + pBModels[i].pFaces[j].uTextureID = v62; + //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; + //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); + if ((signed __int16)v62 != -1) + pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1); + //goto LABEL_69; + } + else + pTextureFrameTable->LoadAnimationSequenceAndPalettes(pBModels[i].pFaces[j].uTextureID); + } +//LABEL_69: if (pBModels[i].pFaces[j].sCogTriggeredID) { if (pBModels[i].pFaces[j].HasEventHint()) @@ -1924,52 +1934,57 @@ if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) pNumItems = 0x1BAF800; - if ( Str2 ) - { - memset(Dst, 0, 0x3C8u); - memset(Src, 0, 0x3C8u); - goto LABEL_112; - } - //v81 = ddm.uLastRepawnDay; - if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) + + if (Str2 || ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)) { - memcpy(Dst, pSrc, 0x3C8u); - memcpy(Src, pSrc + 968, 0x3C8u); -LABEL_112: - free(pSrcMem); - - ddm.uLastRepawnDay = (int)File; - if (Str2 == 0) - ++ddm.uNumRespawns; - v108 = 0; - *thisa = 1; - v39 = pGames_LOD->FindContainer(Str, 0); - fread(&header, 0x10, 1u, v39); - //pFilename = (char *)header.uCompressedSize; - //pDestLen = header.uDecompressedSize; - //v82 = malloc(header.uDecompressedSize); - pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); - //v149 = v82; - if (header.uCompressedSize == header.uDecompressedSize) - fread(pSrcMem, header.uDecompressedSize, 1, v39); - else if (header.uCompressedSize < header.uDecompressedSize) - { - void* compressedMem = malloc(header.uCompressedSize); - fread(compressedMem, header.uCompressedSize, 1u, v39); - - uint actualDecompressedSize = header.uDecompressedSize; - zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); - free(compressedMem); - } - else - MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); - - pSrc = pSrcMem + 40; - goto LABEL_120; - + + if (Str2) + { + memset(Dst, 0, 0x3C8u); + memset(Src, 0, 0x3C8u); + //goto LABEL_112; + } + //v81 = ddm.uLastRepawnDay; + if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) + { + memcpy(Dst, pSrc, 0x3C8u); + memcpy(Src, pSrc + 968, 0x3C8u); + } + //LABEL_112: + free(pSrcMem); + + ddm.uLastRepawnDay = (int)File; + if (Str2 == 0) + ++ddm.uNumRespawns; + v108 = 0; + *thisa = 1; + v39 = pGames_LOD->FindContainer(Str, 0); + fread(&header, 0x10, 1u, v39); + //pFilename = (char *)header.uCompressedSize; + //pDestLen = header.uDecompressedSize; + //v82 = malloc(header.uDecompressedSize); + pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); + //v149 = v82; + if (header.uCompressedSize == header.uDecompressedSize) + fread(pSrcMem, header.uDecompressedSize, 1, v39); + else if (header.uCompressedSize < header.uDecompressedSize) + { + void* compressedMem = malloc(header.uCompressedSize); + fread(compressedMem, header.uCompressedSize, 1u, v39); + + uint actualDecompressedSize = header.uDecompressedSize; + zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); + free(compressedMem); + } + else + MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); + + pSrc = pSrcMem + 40; + //goto LABEL_120; } - *thisa = 0; -LABEL_120: + else + *thisa = 0; +//LABEL_120: //v108 = (int)".odm"; //v83 = strlen(pContainer); //strcpy((char *)v141 + v83, (const char *)v108);