Mercurial > mm7
changeset 609:42d5777c2f47
Слияние
author | Ritor1 |
---|---|
date | Wed, 06 Mar 2013 18:22:25 +0600 |
parents | 653724e9c234 (current diff) 3c7fca0e01a0 (diff) |
children | c615ff03b144 |
files | mm7_2.cpp mm7_3.cpp |
diffstat | 34 files changed, 3602 insertions(+), 3778 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Actor.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -3882,6 +3882,9 @@ uCurrentActionAnimation = ANIM_Dead; break; + case Removed: + return; + default: assert(false); }
--- a/Events.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Events.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -601,7 +601,7 @@ { sub_4BD8B5(); window_SpeakInHouse->Release(); - pParty->uFlags &= 0xFFFFFFFDu; + pParty->uFlags &= ~2; if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) { pAudioPlayer->StopChannels(-1, -1); @@ -702,7 +702,7 @@ sub_4BD8B5(); pVideoPlayer->Unload(); window_SpeakInHouse->Release(); - pParty->uFlags &= 0xFFFFFFFDu; + pParty->uFlags &= ~2; activeLevelDecoration = (LevelDecoration*)1; if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) {
--- a/GUIWindow.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/GUIWindow.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -203,10 +203,7 @@ uFramesetID = 1; if ( pPlayer->expression == CHARACTER_EXPRESSION_21) { - v15 = pPlayerFrameTable->GetFrameBy_y( - &pPlayer->field_1AA8, - &pPlayer->field_1AA4, - pMiscTimer->uTimeElapsed); + v15 = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); } else { @@ -1581,7 +1578,7 @@ } while ( (signed int)Str1a < (signed int)pNumLen ); } - pTmpBuf[Str1a + 1999] = 0; + pTmpBuf2[Str1a - 1] = 0; pNumLen = strlen(pTmpBuf2); v28 = pFont->GetLineWidth(pTmpBuf2); if ( a8 )
--- a/GUIWindow.h Wed Mar 06 18:22:07 2013 +0600 +++ b/GUIWindow.h Wed Mar 06 18:22:25 2013 +0600 @@ -408,4 +408,11 @@ extern int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[]; // idb extern struct GUIWindow *pWindow_MainMenu; -extern struct GUIWindow pWindowList[20]; \ No newline at end of file +extern struct GUIWindow pWindowList[20]; + + + + + + +void QuickRefDraw(); \ No newline at end of file
--- a/Game.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Game.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -113,8 +113,7 @@ if (pRenderer->pRenderD3D) { pDecalBuilder->DrawBloodsplats(); - if (pRenderer->pRenderD3D) - pGame->pLightmapBuilder->DrawLightmaps(2); + pGame->pLightmapBuilder->DrawLightmaps(2); } } } @@ -164,7 +163,7 @@ if ( !pVideoPlayer->AnyMovieLoaded() ) { pStru6Instance->DrawPlayerBuffAnims(); - pOtherOverlayList->_441964(v4); + pOtherOverlayList->DrawTurnBasedIcon(v4); GameUI_DrawTorchlightAndWizardEye(); } GUI_UpdateWindows(); @@ -178,7 +177,7 @@ pMouse->_469E1C(); pRenderer->EndScene(); pRenderer->Present(); - pParty->uFlags &= 0xFFFFFFFDu; + pParty->uFlags &= ~2; } @@ -399,7 +398,7 @@ while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); pParty->field_764 = 0; pParty->uTimePlayed += 0x276000ui64; - LOWORD(pParty->uFlags) &= 0xFDFBu; + LOWORD(pParty->uFlags) &= ~0x204; pParty->SetGold(0); pOtherOverlay = pOtherOverlayList->pOverlays; v8 = 50;
--- a/Game.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Game.h Wed Mar 06 18:22:25 2013 +0600 @@ -16,6 +16,8 @@ +#define GAME_FLAGS_2_DRAW_BLOODSPLATS 0x20 + /* 320 */
--- a/GameUIs.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/GameUIs.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -189,7 +189,7 @@ for (uint i = 0; i < 40; ++i) { v3 = pSavegameList->pFileList[i].pSaveFileName; - if ( !pSavegameList->pFileList[i].pSaveFileName ) + if ( !*pSavegameList->pFileList[i].pSaveFileName ) v3 = "1.mm7"; sprintf(pTmpBuf, "saves\\%s", v3); if ( _access(pTmpBuf, 0) || _access(pTmpBuf, 6) )
--- a/Indoor.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Indoor.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -372,25 +372,24 @@ _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; - _this.vPosition.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); - v2 = stru_5C6E00->Sin(pParty->sRotationY); - v3 = (unsigned __int64)(v2 * (signed __int64)pParty->y_rotation_granularity) >> 16; _this.field_1C_mb_fov = 65; - _this.vPosition.y = pParty->vPosition.y - v3; + _this.vPosition.x = pParty->vPosition.x - ((stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + _this.vPosition.y = pParty->vPosition.y - ((stru_5C6E00->Sin(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + _this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; + _this.sRotationX = pParty->sRotationX; _this.sRotationY = pParty->sRotationY; - _this.sRotationX = pParty->sRotationX; _this.pRenderTarget = pRenderer->pTargetSurface; _this.uViewportX = pViewport->uScreenX; _this.uViewportY = pViewport->uScreenY; _this.uViewportZ = pViewport->uScreenZ; _this.uViewportW = pViewport->uScreenW; _this.field_3C = pViewport->field_30; - _this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel; + _this.uTargetWidth = 640; _this.uTargetHeight = 480; _this.pTargetZ = pRenderer->pActiveZBuffer; sub_440BED(&_this); - pParty->uFlags &= 0xFFFFFFFDu; + pParty->uFlags &= ~2; pGame->DrawParticles(); array_5118E8._440F07(); } @@ -507,15 +506,8 @@ if (!pVertices || (pGame->pStru9Instance->_498377(a4, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) { - if (pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum( - static_vertices_F7C228, - &uNumVerticesa, - static_vertices_F7B628, - pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, - 4, - false, - 0) != 1 - || uNumVerticesa ) + if (pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(static_vertices_F7C228, &uNumVerticesa, + static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa ) { a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel); v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8); @@ -535,26 +527,12 @@ stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; } - if (stru_F8AD28.uNumLightsApplied > 0 && - !(pFace->uAttributes & 0x400000)) - pGame->pLightmapBuilder->ApplyLights( - &stru_F8AD28, - &stru_F7B60C, - uNumVerticesa, - array_507D30, - pVertices, - 0); + if (stru_F8AD28.uNumLightsApplied > 0 && !pFace->uAttributes) + //!(pFace->uAttributes & 0x400000)) + pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); if (pDecalBuilder->uNumDecals > 0) - pDecalBuilder->ApplyDecals( - a4a, - 1, - &stru_F7B60C, - uNumVerticesa, - array_507D30, - pVertices, - 0, - pFace->uSectorID); + pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); if (pFace->Animated() && pFace->uBitmapID == pRenderer->hd_water_tile_id ) @@ -579,18 +557,16 @@ v23 = pFace->uBitmapID; goto LABEL_42; } - else if (pFace->uAttributes & 0x4000) + else if (pFace->uAttributes)//(pFace->uAttributes & 0x4000) { - v23 = pTextureFrameTable->GetFrameTexture( - pFace->uBitmapID, - pBLVRenderParams->field_0_timer_); + v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); LABEL_42: - v27 = pBitmaps_LOD->pHardwareTextures[v23]; - if (pFace->uAttributes & 0x400000) - _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); - else - pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0); - return; + v27 = pBitmaps_LOD->pHardwareTextures[v23]; + if (pFace->uAttributes & 0x400000) + _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); + else + pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0); + return; } } } @@ -2679,28 +2655,28 @@ j += pSector->uNumFloors; pSector->pWalls = ptr_0002B0_sector_rdata + j; - j += pSector->field_C; + j += pSector->uNumWalls; pSector->pCeilings = ptr_0002B0_sector_rdata + j; - j += pSector->field_14; + j += pSector->uNumCeilings; pSector->pFluids = ptr_0002B0_sector_rdata + j; - j += pSector->field_1C; + j += pSector->uNumFluids; pSector->pPortals = ptr_0002B0_sector_rdata + j; j += pSector->uNumPortals; pSector->pFaceIDs = ptr_0002B0_sector_rdata + j; - j += pSector->field_2C; + j += pSector->uNumFaces; pSector->pCogs = ptr_0002B0_sector_rdata + j; - j += pSector->field_3C; + j += pSector->uNumCogs; pSector->pDecorationIDs = ptr_0002B0_sector_rdata + j; j += pSector->uNumDecorations; pSector->pMarkers = ptr_0002B0_sector_rdata + j; - j += pSector->field_4C; + j += pSector->uNumMarkers; //do @@ -2758,8 +2734,8 @@ for (uint i = 0, j = 0; i < uNumSectors; ++i) { - pSectors->pLights = (unsigned __int16 *)(ptr_0002B8_sector_lrdata + j); - j += pSectors->uNumLights; + pSectors[i].pLights = ptr_0002B8_sector_lrdata + j; + j += pSectors[i].uNumLights; } pGameLoadingUI_ProgressBar->Progress(); @@ -3712,8 +3688,7 @@ v25 = abs(v15->pFacePlane_old.vNormal.z); //v26 = v87; if ( v24 > v25 ) - Abortf( - "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", + Abortf("Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", door->uDoorID, door->pFaceIDs[v88], v15->pFacePlane_old.dist, @@ -3837,8 +3812,7 @@ { v52 = v15->uBitmapID; if ( v52 != -1 ) - v28->sTextureDeltaV -= v82 - + *(short *)((signed __int16)v52 != -1 ? 72 * (signed __int16)v52 + 7278780 + 0x1A : 26); + v28->sTextureDeltaV -= v82 + (v52 != -1 ? pBitmaps_LOD->pTextures[v52].uTextureHeight : 26); } } if ( BYTE2(v15->uAttributes) & 4 ) @@ -3886,7 +3860,9 @@ } //v2 = v87; } - LOWORD(v39) = v84 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); + LOWORD(v39) = v84; + if (v15->uBitmapID != -1) + LOWORD(v39) += pBitmaps_LOD->pTextures[v15->uBitmapID].uTextureWidth; LABEL_50: v28->sTextureDeltaU -= v39; goto LABEL_51; @@ -4667,8 +4643,8 @@ if (uItemID) { if (uItemID != 220 && pItemsTable->pItems[uItemID].uEquipType == EQUIP_POTION && - !p->stru_24.uEncantmentType) - p->stru_24.uEncantmentType = rand() % 15 + 5; + !p->stru_24.uEnchantmentType) + p->stru_24.uEnchantmentType = rand() % 15 + 5; pItemsTable->SetSpecialBonus(&p->stru_24); } }
--- a/Indoor.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Indoor.h Wed Mar 06 18:22:25 2013 +0600 @@ -347,34 +347,34 @@ unsigned __int16 uNumFloors; __int16 field_6; unsigned __int16 *pFloors; - __int16 field_C; + unsigned __int16 uNumWalls; __int16 field_E; unsigned __int16 *pWalls; - __int16 field_14; + unsigned __int16 uNumCeilings; __int16 field_16; unsigned __int16 *pCeilings; - __int16 field_1C; + unsigned __int16 uNumFluids; __int16 field_1E; unsigned __int16 *pFluids; __int16 uNumPortals; __int16 field_26; unsigned __int16 *pPortals; - __int16 field_2C; - __int16 uNumNonBSPFaces; + unsigned __int16 uNumFaces; + unsigned __int16 uNumNonBSPFaces; unsigned __int16 *pFaceIDs; - __int16 uNumCylinderFaces; + unsigned __int16 uNumCylinderFaces; __int16 field_36; int pCylinderFaces; - __int16 field_3C; + unsigned __int16 uNumCogs; __int16 field_3E; unsigned __int16 *pCogs; unsigned __int16 uNumDecorations; __int16 field_46; unsigned __int16 *pDecorationIDs; - __int16 field_4C; + unsigned __int16 uNumMarkers; __int16 field_4E; unsigned __int16 *pMarkers; - __int16 uNumLights; + unsigned __int16 uNumLights; __int16 field_56; unsigned __int16 *pLights; __int16 uWaterLevel;
--- a/Items.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Items.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -255,7 +255,7 @@ this->uNumCharges = 0; this->uSpecEnchantmentType = 0; this->_bonus_strength = 0; - this->uEncantmentType = 0; + this->uEnchantmentType = 0; this->uItemID = 0; this->uBodyAnchor = 0; this->uExpireTime = 0i64; @@ -268,7 +268,7 @@ { if ( uTimePlayed > (signed __int64)this->uExpireTime ) { - this->uEncantmentType = 0; + this->uEnchantmentType = 0; this->uSpecEnchantmentType = 0; this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS); } @@ -381,7 +381,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -485,7 +485,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -497,7 +497,7 @@ memset(&pSpecialEnchantmentsSumm, 0, 96); for(i=0;i<12;++i) { - for (j=0;j<pSpecialEnchantments_count;++j) + for (j=0;j<=pSpecialEnchantments_count;++j) pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; } @@ -746,9 +746,9 @@ ++test_char; } test_char=test_string; - if ((ii==tst_len)&&(tolower(*test_char)=='s')) + if ((ii==tst_len)&&(tolower(*test_char)!='s')) { - pItems[item_counter].uDamageDice=atoi(test_char+1); + pItems[item_counter].uDamageDice=atoi(test_char); pItems[item_counter].uDamageRoll=1; } break; @@ -838,7 +838,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -905,7 +905,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -1044,7 +1044,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -1096,7 +1096,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -1199,7 +1199,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -1236,7 +1236,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step; @@ -1251,7 +1251,7 @@ { if ( pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL ) { - pItem->uEncantmentType = pItems[pItem->uItemID]._bonus_type; + pItem->uEnchantmentType = pItems[pItem->uItemID]._bonus_type; pItem->uSpecEnchantmentType = pItems[pItem->uItemID]._additional_value; pItem->_bonus_strength = pItems[pItem->uItemID]._bonus_strength; } @@ -1441,7 +1441,7 @@ uBaseValue = pItemsTable->pItems[this->uItemID].uValue; if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) return uBaseValue; - if (uEncantmentType ) + if (uEnchantmentType ) return uBaseValue + 100 * _bonus_strength;; if (uSpecEnchantmentType ) { @@ -1494,10 +1494,10 @@ } if ( !pItemsTable->IsMaterialNonCommon(this) ) { - if ( uEncantmentType ) + if ( uEnchantmentType ) { strcat(item__getname_buffer, " "); - nameModificator = pItemsTable->pEnchantments[uEncantmentType-1].pOfName; + nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName; } else { @@ -1534,391 +1534,357 @@ //----- (00456620) -------------------------------------------------------- void ItemsTable::GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *out_item) -{ - -ItemGen *v4; // esi@1 - ItemsTable *v5; // edi@1 - int v6; // ebx@3 - int *v7; // ecx@33 - //int v8; // eax@34 - //int v9; // eax@39 - int v10; // ebx@43 - int v11; // ecx@47 - unsigned int *v12; // edx@48 - unsigned int v13; // eax@49 - signed int v14; // ebx@52 - int v15; // eax@53 - signed int v16; // eax@55 - int v17; // ebx@57 - int v18; // edx@62 - signed int v19; // ebx@70 - unsigned __int8 v20; // al@81 - int v21; // eax@84 - int v22; // ebx@85 - int v23; // eax@86 - int v24; // ebx@86 - int v25; // edx@86 - int v26; // edx@89 - unsigned int v27; // eax@89 - int i; // ebx@89 - unsigned int v29; // ecx@90 - int v30; // ebx@91 - int v31; // eax@91 - int v32; // ecx@91 - int v33; // eax@91 - int v34; // eax@97 - unsigned __int8 v35; // sf@97 - unsigned __int8 v36; // of@97 - int v37; // ebx@98 - int v38; // edx@99 - signed int v39; // ebx@101 - int v40; // ecx@102 - char v41; // zf@107 - char v42; // al@108 - char v43; // al@111 - int *v44; // edx@118 - int v45; // eax@120 - int v46; // edx@120 - int *j; // eax@121 - unsigned int v48; // ecx@123 - int v49; // eax@123 - int v50; // eax@123 - int Dst[800]; // [sp+Ch] [bp-C88h]@33 - int v52; // [sp+C8Ch] [bp-8h]@33 - int v53; // [sp+C90h] [bp-4h]@1 - int v54; // [sp+C9Ch] [bp+8h]@3 - //int v55; // [sp+CA0h] [bp+Ch]@34 - signed int v56; // [sp+CA0h] [bp+Ch]@55 - int v57; // [sp+CA0h] [bp+Ch]@62 - int *v58; // [sp+CA0h] [bp+Ch]@102 - int v59; // [sp+CA0h] [bp+Ch]@123 - //signed int a2a; // [sp+CA4h] [bp+10h]@33 - int a2b; // [sp+CA4h] [bp+10h]@101 - int a2c; // [sp+CA4h] [bp+10h]@120 + { - v53 = -1; - v5 = this; - if (!out_item) - out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); - memset(out_item, 0, sizeof(*out_item)); + ItemsTable *v5; // edi@1 + int v6; // ebx@3 + int *v7; // ecx@33 + //int v8; // eax@34 + //int v9; // eax@39 + int current_chance; // ebx@43 + int tmp_chance; // ecx@47 + unsigned int *v12; // edx@48 + unsigned int v13; // eax@49 + signed int v14; // ebx@52 + int v15; // eax@53 + signed int v16; // eax@55 + int v17; // ebx@57 + int v18; // edx@62 + signed int v19; // ebx@70 + unsigned __int8 v20; // al@81 + int v21; // eax@84 + int v22; // ebx@85 + int v23; // eax@86 + int v24; // ebx@86 + int special_chance; // edx@86 + int v26; // edx@89 + unsigned int v27; // eax@89 + int i; // ebx@89 + unsigned int v29; // ecx@90 + int v30; // ebx@91 + int v31; // eax@91 + int v32; // ecx@91 + int v33; // eax@91 + int v34; // eax@97 + unsigned __int8 v35; // sf@97 + unsigned __int8 v36; // of@97 + int v37; // ebx@98 + int v38; // edx@99 + signed int v39; // ebx@101 + int v40; // ecx@102 + char v41; // zf@107 + char v42; // al@108 + char v43; // al@111 + int *v44; // edx@118 + int v45; // eax@120 + int v46; // edx@120 + int j; // eax@121 + unsigned int v48; // ecx@123 + int v49; // eax@123 + int v50; // eax@123 + int val_list[800]; // [sp+Ch] [bp-C88h]@33 + int total_chance; // [sp+C8Ch] [bp-8h]@33 + int v53; // [sp+C90h] [bp-4h]@1 + int v54; // [sp+C9Ch] [bp+8h]@3 + //int v55; // [sp+CA0h] [bp+Ch]@34 + signed int v56; // [sp+CA0h] [bp+Ch]@55 + int v57; // [sp+CA0h] [bp+Ch]@62 + int *v58; // [sp+CA0h] [bp+Ch]@102 + int v59; // [sp+CA0h] [bp+Ch]@123 + //signed int a2a; // [sp+CA4h] [bp+10h]@33 + int a2b; // [sp+CA4h] [bp+10h]@101 + int a2c; // [sp+CA4h] [bp+10h]@120 + + v5 = this; + if (!out_item) + out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); + memset(out_item, 0, sizeof(*out_item)); + - v4 = out_item; - v6 = treasure_level - 1; - v54 = treasure_level - 1; - if ( uTreasureType ) //generate known treasure type - { - ITEM_EQUIP_TYPE requested_equip; - PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; - switch (uTreasureType) - { - case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; - case 21: requested_equip = EQUIP_ARMOUR; break; - case 22: requested_skill = PLAYER_SKILL_MISC; break; - case 23: requested_skill = PLAYER_SKILL_SWORD; break; - case 24: requested_skill = PLAYER_SKILL_DAGGER; break; - case 25: requested_skill = PLAYER_SKILL_AXE; break; - case 26: requested_skill = PLAYER_SKILL_SPEAR; break; - case 27: requested_skill = PLAYER_SKILL_BOW; break; - case 28: requested_skill = PLAYER_SKILL_MACE; break; - case 29: requested_skill = PLAYER_SKILL_CLUB; break; - case 30: requested_skill = PLAYER_SKILL_STAFF; break; - case 31: requested_skill = PLAYER_SKILL_LEATHER; break; - case 32: requested_skill = PLAYER_SKILL_CHAIN; break; - case 33: requested_skill = PLAYER_SKILL_PLATE; break; - case 34: requested_equip = EQUIP_SHIELD; break; - case 35: requested_equip = EQUIP_HELMET; break; - case 36: requested_equip = EQUIP_BELT; break; - case 37: requested_equip = EQUIP_CLOAK; break; - case 38: requested_equip = EQUIP_GAUNTLETS; break; - case 39: requested_equip = EQUIP_BOOTS; break; - case 40: requested_equip = EQUIP_RING; break; - case 41: requested_equip = EQUIP_AMULET; break; - case 42: requested_equip = EQUIP_WAND; break; - case 43: requested_equip = EQUIP_SPELL_SCROLL; break; - case 44: requested_equip = EQUIP_POTION; break; - case 45: requested_equip = EQUIP_REAGENT; break; - case 46: requested_equip = EQUIP_GEM; break; - default: - __debugbreak(); // check this condition - requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1); - break; - } - memset(Dst, 0, sizeof(Dst)); - v52 = 0; - v7 = Dst; - //a2a = 1; - if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed - { - for (uint i = 1; i < 500; ++i) - { - if (pItems[i].uEquipType == requested_equip) + v6 = treasure_level - 1; + v54 = treasure_level - 1; + if ( uTreasureType ) //generate known treasure type { - *v7++ = i; - v52 += pItems[i].uChanceByTreasureLvl[v6]; + ITEM_EQUIP_TYPE requested_equip; + PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; + switch (uTreasureType) + { + case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; + case 21: requested_equip = EQUIP_ARMOUR; break; + case 22: requested_skill = PLAYER_SKILL_MISC; break; + case 23: requested_skill = PLAYER_SKILL_SWORD; break; + case 24: requested_skill = PLAYER_SKILL_DAGGER; break; + case 25: requested_skill = PLAYER_SKILL_AXE; break; + case 26: requested_skill = PLAYER_SKILL_SPEAR; break; + case 27: requested_skill = PLAYER_SKILL_BOW; break; + case 28: requested_skill = PLAYER_SKILL_MACE; break; + case 29: requested_skill = PLAYER_SKILL_CLUB; break; + case 30: requested_skill = PLAYER_SKILL_STAFF; break; + case 31: requested_skill = PLAYER_SKILL_LEATHER; break; + case 32: requested_skill = PLAYER_SKILL_CHAIN; break; + case 33: requested_skill = PLAYER_SKILL_PLATE; break; + case 34: requested_equip = EQUIP_SHIELD; break; + case 35: requested_equip = EQUIP_HELMET; break; + case 36: requested_equip = EQUIP_BELT; break; + case 37: requested_equip = EQUIP_CLOAK; break; + case 38: requested_equip = EQUIP_GAUNTLETS; break; + case 39: requested_equip = EQUIP_BOOTS; break; + case 40: requested_equip = EQUIP_RING; break; + case 41: requested_equip = EQUIP_AMULET; break; + case 42: requested_equip = EQUIP_WAND; break; + case 43: requested_equip = EQUIP_SPELL_SCROLL; break; + case 44: requested_equip = EQUIP_POTION; break; + case 45: requested_equip = EQUIP_REAGENT; break; + case 46: requested_equip = EQUIP_GEM; break; + default: + __debugbreak(); // check this condition + requested_equip = (ITEM_EQUIP_TYPE)(uTreasureType - 1); + break; + } + memset(val_list, 0, sizeof(val_list)); + total_chance = 0; + j=0; + //a2a = 1; + if (requested_skill == PLAYER_SKILL_INVALID) // no skill for this item needed + { + for (uint i = 1; i < 500; ++i) + { + if (pItems[i].uEquipType == requested_equip) + { + val_list[j] = i; + ++j; + total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1]; + } + } + } + else //have needed skill + { + for (uint i = 1; i < 500; ++i) + { + if (pItems[i].uSkillType == requested_skill) + { + val_list[j] = i; + ++j; + total_chance += pItems[i].uChanceByTreasureLvl[treasure_level - 1]; + } + } + } + + current_chance = 0; + if ( total_chance ) + current_chance = rand() % total_chance; + + out_item->uItemID = val_list[0]; + if (!out_item->uItemID) + out_item->uItemID = 1; + + if ( pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1] < current_chance ) + { + j=0; + tmp_chance=pItems[out_item->uItemID].uChanceByTreasureLvl[treasure_level - 1]; + do + { + ++j; + out_item->uItemID = val_list[j]; + tmp_chance += pItems[val_list[j]].uChanceByTreasureLvl[treasure_level - 1]; + } + while ( tmp_chance < current_chance ); + } + + if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + {// if it potion set potion spec + out_item->uEnchantmentType = 0; + for (int i=0; i<2; ++i) + out_item->uEnchantmentType += rand() % 4 + 1; + out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level; + } } - } - } - else //have needed skill - { - for (uint i = 1; i < 500; ++i) - { - if (pItems[i].uSkillType == requested_skill) + else { - *v7++ = i; - v52 += pItems[i].uChanceByTreasureLvl[v6]; - } - } - } - - v10 = 0; - if ( v52 ) - v10 = rand() % v52; - - out_item->uItemID = *Dst; - if (!out_item->uItemID) - out_item->uItemID = 1; + //artifact + v56 = 0; + for(int i=0; i<29; ++i) + v56 += pParty->pIsArtifactFound[i]; - v11 = pItems[out_item->uItemID].uChanceByTreasureLvl[v6]; - if ( v11 < v10 ) - { - v12 = (uint *)Dst; - do - { - ++v12; - v13 = *v12; - out_item->uItemID = *v12; - v11 += pItems[v13].uChanceByTreasureLvl[v6]; - } - while ( v11 < v10 ); - } - - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) - {// if it potion set potion spec - out_item->uEncantmentType = 0; - for (int i=0; i<2; ++i) - out_item->uEncantmentType += rand() % 4 + 1; - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - } - else - { - v16 = 0; - v56 = 0; - do - v56 += pParty->pIsArtifactFound[v16++]; - while ( v16 < 29 ); - v17 = rand() % 29; - - if ( v6 == 5 && rand() % 100 < 5 && !pParty->pIsArtifactFound[v17] && v56 < 13 ) - { - pParty->pIsArtifactFound[v17] = 1; - out_item->uAttributes = 0; - out_item->uItemID = v17 + 500; - SetSpecialBonus(out_item); - return; - } + v17 = rand() % 29; - v57 = 0; - v18 = rand() % v5->uChanceByTreasureLvlSumm[v54];// v5->field_11684[v54]; - out_item->uItemID = 0; - if ( v18 > 0 ) - { - do - v57 += pItems[out_item->uItemID++ + 1].uChanceByTreasureLvl[v6]; - while ( v57 < v18 ); - } + if ( v6 == 5 && (rand() % 100 < 5) && !pParty->pIsArtifactFound[v17] && v56 < 13 ) + { + pParty->pIsArtifactFound[v17] = 1; + out_item->uAttributes = 0; + out_item->uItemID = v17 + 500; + SetSpecialBonus(out_item); + return; + } + + v57 = 0; + v18 = rand() % v5->uChanceByTreasureLvlSumm[treasure_level - 1]; + out_item->uItemID = 0; + if ( v18 > 0 ) + { + do + v57 += pItems[out_item->uItemID++ + 1].uChanceByTreasureLvl[v6]; + while ( v57 < v18 ); + } + + if ( !v18 ) + out_item->uItemID = 1; + if ( !out_item->uItemID ) + out_item->uItemID = 1; + if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + {// if it potion set potion spec + out_item->uEnchantmentType = 0; + for (int i=0; i<2; ++i) + out_item->uEnchantmentType += rand() % 4 + 1; + out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level; + } + out_item->uEnchantmentType = out_item->uEnchantmentType * treasure_level; + } + + if ( out_item->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION + && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) + out_item->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; + if ( pItemsTable->pItems[out_item->uItemID + 1].uItemID_Rep_St ) + out_item->uAttributes = 0; + else + out_item->uAttributes = 1; - if ( !v18 ) - out_item->uItemID = 1; - if ( !out_item->uItemID ) - out_item->uItemID = 1; - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) - {// if it potion set potion spec - out_item->uEncantmentType = 0; - for (int i=0; i<2; ++i) - out_item->uEncantmentType += rand() % 4 + 1; - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; - } - if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION - && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; - if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) - v4->uAttributes = 0; - else - v4->uAttributes = 1; - if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) - { - out_item->uSpecEnchantmentType = 0; - out_item->uEncantmentType = 0; - } - v20 = pItems[out_item->uItemID].uEquipType; - if ( v20 <= EQUIP_BOW ) - { - v37 = v5->uBonusChanceWpSpecial[v54]; - if ( !v37 ) - return; - v38 = rand() % 100; - v36 = __OFSUB__(v38, v37); - v35 = v38 - v37 < 0; - } - else - { - if ( v20 > EQUIP_AMULET ) - { - if ( v20 == EQUIP_WAND ) - { - v21 = rand() % 6 + pItemsTable->pItems[v4->uItemID].uDamageMod + 1; - out_item->uNumCharges = v21; - out_item->uMaxCharges = v21; - } - return; - } - v22 = uBonusChanceStandart[v6]; - if ( !v22 ) - return; - v24 = v22; - v25 = rand() % 100; - if ( !uBonusChanceSpecial[v6] && !(v25 < v24)) + if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) + { + out_item->uSpecEnchantmentType = 0; + out_item->uEnchantmentType = 0; + } + //try get special enhansment + switch (pItems[out_item->uItemID].uEquipType) + { + case EQUIP_ONE_OR_TWO_HANDS: + case EQUIP_TWO_HANDED : + case EQUIP_BOW : + if ( !uBonusChanceWpSpecial[v6] ) + return; + if ((rand() % 100)>=uBonusChanceWpSpecial[v6]) + return; + break; + case EQUIP_ARMOUR : + case EQUIP_SHIELD : + case EQUIP_HELMET : + case EQUIP_BELT : + case EQUIP_CLOAK : + case EQUIP_GAUNTLETS : + case EQUIP_BOOTS : + case EQUIP_RING : + + if ( !uBonusChanceStandart[v6] ) + return; + special_chance = rand() % 100; + if ( special_chance < uBonusChanceStandart[v6]) + { + v26 = rand() %pEnchantmentsSumm[pItems[out_item->uItemID].uEquipType-3]; + out_item->uEnchantmentType = 0; + v27=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3]; + if (v26>v27 ) + { + do + { + ++out_item->uEnchantmentType; + v27+=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3]; + } while (v26>v27); + } + ++out_item->uEnchantmentType; + + v33 = rand() % (bonus_ranges[v6].maxR - bonus_ranges[v6].minR + 1); + out_item->_bonus_strength = v33 + bonus_ranges[v6].minR; + v32 = out_item->uEnchantmentType - 1; + if ( v32 == 21 || v32 == 22 || v32 == 23 ) //Armsmaster skill, Dodge skill, Unarmed skill + out_item->_bonus_strength = out_item->_bonus_strength/2; + if ( out_item->_bonus_strength <= 0 ) + out_item->_bonus_strength = 1; + return; + + } + if ( !uBonusChanceSpecial[v6]) + return; + v34 = uBonusChanceStandart[v6] + uBonusChanceSpecial[v6]; + if ( special_chance>v34 ) + return; + break; + case EQUIP_WAND: + out_item->uNumCharges = rand() % 6 + pItemsTable->pItems[out_item->uItemID].uDamageMod + 1; + out_item->uMaxCharges = out_item->uNumCharges; + default: return; - if ( v25 < v24 || v25 < v24) - { - v26 = rand() % v5->uBonusChanceWpSpecial[v5->pItems[v4->uItemID].uEquipType + 3]; - v27 = v4->uItemID; - v4->uEncantmentType = 0; - for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; - i < v26; - i += pEnchantments[v4->uEncantmentType].to_item[pItems[v29].uEquipType + 1] ) - { - v29 = v4->uItemID; - ++v4->uEncantmentType; - } - ++v4->uEncantmentType; - v30 = 10;// v5->field_116D8[2 * v54 + 12]; - v31 = rand(); - v32 = v4->uEncantmentType - 1; - v33 = v31 % 10;//(v5->field_116D8[2 * v54 + 13] - v30 + 1) + v30; - v4->_bonus_strength = v33; - if ( v32 == 21 || v32 == 22 || v32 == 23 ) - v4->_bonus_strength = v33 >> 1; - if ( v4->_bonus_strength <= 0 ) - v4->_bonus_strength = 1; - return; - } - v34 = v24 + 10;//*(unsigned int *)&v5->field_1169C[4 * v54 + 24]; - v36 = __OFSUB__(v25, v34); - v35 = v25 - v34 < 0; - } - if ( !(v35 ^ v36) ) - return; - memset(&Dst, 0, 0xC80u); - v39 = 0; - a2b = 0; - if ( pSpecialEnchantments_count > 0 ) - { - v52 = -16 - (uint)this; - v58 = (int *)&Dst; - v40 = (int)&pSpecialEnchantments[1]; - do - { - switch ( v6 ) - { + } + + j=0; + int spc_sum=0; + int spc; + memset(&val_list, 0, 3200); + for (int i=0; i<pSpecialEnchantments_count;++i) + { + int tr_lv= pSpecialEnchantments[i].iTreasureLevel; + switch ( treasure_level - 1 ) + { case 2: - if ( !*(unsigned char *)v40 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; - } - ++a2b; - v40 += 28; - continue; - } - v41 = *(unsigned char *)v40 == 1; - break; + if ((tr_lv==1)||(tr_lv==0)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; case 3: - v43 = *(unsigned char *)v40; - if ( !*(unsigned char *)v40 || v43 == 1 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; + if ((tr_lv==2)||(tr_lv==1)||(tr_lv==0)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; + case 4: + if ((tr_lv==3)||(tr_lv==2)||(tr_lv==1)) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; + case 5: + if (tr_lv==3) + { + spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc_sum+=spc; + if(spc) + { + val_list[j++]=i; + } + } + break; } - ++a2b; - v40 += 28; - continue; - } - v41 = v43 == 2; - break; - case 4: - v42 = *(unsigned char *)v40; - if ( *(unsigned char *)v40 == 1 || v42 == 2 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) + } + + v46 = rand()%spc_sum+1; + j=0; + out_item->uSpecEnchantmentType =val_list[j]; + v45=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + if (v45<v46) + { + do { - v44 = v58; - ++v58; - *v44 = a2b; - } - ++a2b; - v40 += 28; - continue; - } - v41 = v42 == 3; - break; - default: - if ( v6 != 5 ) - { - ++a2b; - v40 += 28; - continue; - } - v41 = *(unsigned char *)v40 == 3; - break; - } - if ( v41 ) - { - v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) - { - v44 = v58; - ++v58; - *v44 = a2b; - } - } -LABEL_119: - ++a2b; - v40 += 28; - } - while ( a2b < pSpecialEnchantments_count ); - } - v45 = rand(); - v4->uSpecEnchantmentType = *(uint *)Dst; - v46 = v45 % v39 + 1; - a2c = *((unsigned char *)&uAllItemsCount + 28 * (*(uint *)Dst + 1389) + pItems[v4->uItemID].uEquipType); - if ( a2c < v46 ) - { - for ( j = (int *)&Dst; ; j = (int *)v59 ) - { - v48 = v4->uItemID; - v49 = (int)(j + 1); - v59 = v49; - v50 = *(unsigned int *)v49; - v4->uSpecEnchantmentType = v50; - a2c += *((unsigned char *)&uAllItemsCount + 28 * (v50 + 1389) + pItems[v48].uEquipType); - if ( a2c >= v46 ) - break; - } - } - ++v4->uSpecEnchantmentType; + ++j; + out_item->uSpecEnchantmentType=val_list[j]; + v45+=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + } while (v45<v46); + } + ++out_item->uSpecEnchantmentType; } //----- (004505CC) --------------------------------------------------------
--- a/Items.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Items.h Wed Mar 06 18:22:25 2013 +0600 @@ -140,7 +140,7 @@ int uItemID; - int uEncantmentType; + int uEnchantmentType; int _bonus_strength; int uSpecEnchantmentType; // 25: +5 levels int uNumCharges; @@ -157,7 +157,7 @@ /* 175 */ #pragma pack(push, 1) -struct ItemDesc +struct ItemDesc //30h { //Item # |Pic File|Name|Value|Equip Stat|Skill Group|Mod1|Mod2|material| ///ID/Rep/St|Not identified name|Sprite Index|VarA|VarB|Equip X|Equip Y|Notes char *pIconName; //0 4 @@ -225,14 +225,14 @@ /* 178 */ #pragma pack(push, 1) -struct ItemSpecialEnchantment +struct ItemSpecialEnchantment //1Ch { //Bonus Stat|Name Add|W1|W2|Miss|Arm|Shld|Helm|Belt|Cape|Gaunt|Boot|Ring|Amul|Value|Lvl|Description fo special Bonuses and values - char *pBonusStatement; - char *pNameAdd; - char to_item_apply[12]; - int iValue; - int iTreasureLevel; + char *pBonusStatement; //0 + char *pNameAdd; //4 + char to_item_apply[12]; //8 + int iValue; //14 + int iTreasureLevel; //18 }; #pragma pack(pop)
--- a/LOD.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/LOD.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -1691,7 +1691,7 @@ if ( !this->pIOBuffer || !this->uIOBufferSize ) return 3; v7 = this->uNumSubIndices == 0; - v8 = this->uNumSubIndices != 0; // v8 = (this->uNumSubIndices & 0x80000000u) != 0; + v8 = false;//this->uNumSubIndices != 0; // v8 = (this->uNumSubIndices & 0x80000000u) != 0; v36 = 0; v34 = 0; if ( v8 | v7 ) @@ -1703,7 +1703,7 @@ while ( 1 ) { v9 = pDir; - v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir); + v10 = _strcmpi(v4->pSubIndices[v5].pFilename + v35, pDir->pFilename); if ( v10 ) { if ( v10 > 0 ) @@ -1722,7 +1722,8 @@ v11 = v5 >= v4->uNumSubIndices; v8 = (v5 - v4->uNumSubIndices) != 0;//v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0; v34 = v5; - if ( !(v8 ^ v11) ) + //if ( !(v8 ^ v11) ) + if (v5 >= v4->uNumSubIndices) goto LABEL_22; } v12 = pDir->uNumSubIndices;
--- a/MM7.vcxproj.filters Wed Mar 06 18:22:07 2013 +0600 +++ b/MM7.vcxproj.filters Wed Mar 06 18:22:25 2013 +0600 @@ -149,7 +149,6 @@ <ClInclude Include="stru314.h" /> <ClInclude Include="SaveLoad.h" /> <ClInclude Include="stru287.h" /> - <ClInclude Include="stru179.h" /> <ClInclude Include="Awards.h" /> <ClInclude Include="Autonotes.h" /> <ClInclude Include="stru160.h" /> @@ -201,7 +200,6 @@ <ClInclude Include="resource.h" /> <ClInclude Include="stru346.h" /> <ClInclude Include="texts.h" /> - <ClInclude Include="SpriteObject.h" /> </ItemGroup> <ItemGroup> <Filter Include="lib">
--- a/NPC.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/NPC.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -484,7 +484,7 @@ } else { - if (!decode_step) + if (decode_step) break_loop = true; } ++decode_step;
--- a/Overlays.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Overlays.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -10,6 +10,7 @@ #include "TurnEngine.h" #include "LOD.h" #include "Render.h" +#include "GUIWindow.h" #include "mm7_data.h" @@ -87,7 +88,7 @@ } //----- (00441964) -------------------------------------------------------- -unsigned int OtherOverlayList::_441964(int a2) +void OtherOverlayList::DrawTurnBasedIcon(int a2) { unsigned int result; // eax@1 IconFrameTable *v3; // ecx@6 @@ -96,10 +97,9 @@ int v6; // [sp-4h] [bp-8h]@4 Texture *v7; // [sp-4h] [bp-8h]@14 - result = pCurrentScreen; - if ( pCurrentScreen - || pParty->bTurnBasedModeOn != 1 ) - return result; + if ( pCurrentScreen != SCREEN_GAME || !pParty->bTurnBasedModeOn) + return; + if ( pTurnEngine->field_4 == 3 ) { v6 = pEventTimer->uStartTime; @@ -142,7 +142,6 @@ if ( (signed int)result >= dword_50C998_turnbased_icon_1A ) dword_50C998_turnbased_icon_1A = 0; } - return result; } // 4E28F8: using guessed type int pCurrentScreen; // 50C994: using guessed type int dword_50C994;
--- a/Overlays.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Overlays.h Wed Mar 06 18:22:25 2013 +0600 @@ -30,7 +30,7 @@ int _4418B1(int a2, int a3, int a4, int a5); int _4418B6(int uOverlayID, __int16 a3, int a4, int a5, __int16 a6); - unsigned int _441964(int a2); + void DrawTurnBasedIcon(int a2); OtherOverlay pOverlays[50]; int field_3E8;
--- a/ParticleEngine.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/ParticleEngine.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -93,10 +93,10 @@ uTimeElapsed += pEventTimer->uTimeElapsed; pLines.uNumLines = 0; - //if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - //DrawParticles_BLV(); - //else - //DrawParticles_ODM(); + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + DrawParticles_BLV(); + else + DrawParticles_ODM(); if (pRenderer->pRenderD3D) {
--- a/Party.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Party.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -256,21 +256,10 @@ //----- (0049135E) -------------------------------------------------------- unsigned int Party::GetPartyFame() { - signed int v1; // eax@1 - Player *v2; // ecx@1 - signed int v3; // edx@1 - - v1 = 0; - v2 = this->pPlayers;//[0].uExperience; - v3 = 4; // (E exp) / 1000 - do - { - v1 += (int)v2->uExperience; // needs review - ++v2; - --v3; - } - while ( v3 ); - return v1 / 1000; + unsigned __int64 total_exp = 0; + for (uint i = 0; i < 4; ++i) + total_exp += pPlayers[i].uExperience; + return total_exp / 1000; } //----- (0049137D) --------------------------------------------------------
--- a/Party.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Party.h Wed Mar 06 18:22:25 2013 +0600 @@ -16,8 +16,10 @@ /* 355 */ enum PARTY_FLAGS_1: __int32 { + PARTY_FLAGS_1_FALLING = 0x0008, PARTY_FLAGS_1_ALERT_RED = 0x0010, PARTY_FLAGS_1_ALERT_YELLOW = 0x0020, + PARTY_FLAGS_1_STANDING_ON_WATER = 0x0080, PARTY_FLAGS_1_LANDING = 0x0100, }; enum PARTY_FLAGS_2: __int32
--- a/Player.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Player.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -2298,6 +2298,9 @@ field_100 = 0; field_104 = 0; + _expression21_animtime = 0; + _expression21_frameset = 0; + lastOpenedSpellbookPage = 0; } @@ -3572,7 +3575,7 @@ if ( pItemsTable->pItems[v17].uEquipType == 14 ) { if ( v16 != 220 ) - v27.uEncantmentType = 2 * rand() % 4 + 2; + v27.uEnchantmentType = 2 * rand() % 4 + 2; } } else @@ -6494,13 +6497,51 @@ spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; + spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; + spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; + spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; + spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; + spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; + pActiveSkills[PLAYER_SKILL_WATER] = 1; + spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; + spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; + spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; + spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; + spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; + spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; break; case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; break; case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; break; case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; break; case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break; case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; break; - case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; break; + case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; + spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; + pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; + spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; + break; case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; break; case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; break; } @@ -6965,10 +7006,10 @@ switch ( pParty->pPickedItem.uItemID ) { case 0xDEu: - v25 = pParty->pPickedItem.uEncantmentType + 10; + v25 = pParty->pPickedItem.uEnchantmentType + 10; goto LABEL_110; case 0xDFu: - v26 = pParty->pPickedItem.uEncantmentType + 10; + v26 = pParty->pPickedItem.uEnchantmentType + 10; goto LABEL_114; case 0xE0u: LODWORD(v3->pConditions[1]) = 0; @@ -7001,7 +7042,7 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[7]; goto LABEL_147; case 0xE5u: @@ -7009,7 +7050,7 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[8]; goto LABEL_147; case 0xE6u: @@ -7017,23 +7058,23 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[1]; goto LABEL_147; case 0xE7u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[11]; goto LABEL_147; case 0xE8u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[13]; goto LABEL_147; case 0xEAu: @@ -7041,12 +7082,12 @@ v59 = 0; v50 = 5; v46 = 3; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[14]; goto LABEL_147; case 0xEBu: v3->pPlayerBuffs[23].Apply( - pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335), + pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), 3u, 5u, 0, @@ -7067,49 +7108,49 @@ case 0xF0u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[19]; goto LABEL_147; case 0xF1u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[17]; goto LABEL_147; case 0xF2u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[20]; goto LABEL_147; case 0xF3u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[16]; goto LABEL_147; case 0xF4u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[21]; goto LABEL_147; case 0xF5u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[15]; goto LABEL_147; case 0xFBu: @@ -7132,12 +7173,12 @@ HIDWORD(v3->pConditions[16]) = v35; goto LABEL_112; case 0xFDu: - v25 = 5 * pParty->pPickedItem.uEncantmentType; + v25 = 5 * pParty->pPickedItem.uEnchantmentType; LABEL_110: v69 = v25; goto LABEL_111; case 0xFEu: - v26 = 5 * pParty->pPickedItem.uEncantmentType; + v26 = 5 * pParty->pPickedItem.uEnchantmentType; LABEL_114: v27 = (char *)&v3->sMana; *(int *)v27 += v26; @@ -7145,57 +7186,57 @@ case 0xFFu: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[18]; goto LABEL_147; case 0x100u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[5]; goto LABEL_147; case 0x101u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)v3->pPlayerBuffs; goto LABEL_147; case 0x102u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[22]; goto LABEL_147; case 0x103u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[3]; goto LABEL_147; case 0x104u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[9]; goto LABEL_147; case 0x105u: v70 = 0; v59 = 0; - v50 = 3 * LOWORD(pParty->pPickedItem.uEncantmentType); + v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); v46 = 0; - v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEncantmentType) * 0.033333335); + v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); v29 = (char *)&v3->pPlayerBuffs[2]; LABEL_147: ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70);
--- a/Player.h Wed Mar 06 18:22:07 2013 +0600 +++ b/Player.h Wed Mar 06 18:22:25 2013 +0600 @@ -717,8 +717,8 @@ unsigned __int16 uExpressionTimePassed; unsigned __int16 uExpressionTimeLength; __int16 field_1AA2; - int field_1AA4; - int field_1AA8; + int _expression21_animtime; + int _expression21_frameset; LloydBeacon pInstalledBeacons[5]; char uNumDivineInterventionCastsThisDay; char uNumArmageddonCasts;
--- a/Render.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/Render.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -1744,8 +1744,7 @@ v63 = 0; // basic optimizations - unsigned int uStartX, uEndX, - uStartZ, uEndZ; + unsigned int uStartX, uEndX, uStartZ, uEndZ; if (pIndoorCamera->sRotationY >= 0 && pIndoorCamera->sRotationY <= 1024) { uStartX = 0, uEndX = 128;
--- a/SaveLoad.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/SaveLoad.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -301,10 +301,11 @@ std::string *v71; // [sp+268h] [bp-8h]@8 int a3; // [sp+26Fh] [bp-1h]@8 - v66 = a2; + //v66 = a2; strcpy(byte_6BE3B0, pCurrentMapName); - if (!_strcmpi(pCurrentMapName, "d05.blv")) + if (!_strcmpi(pCurrentMapName, "d05.blv")) // arena return false; + DstBuf = malloc(0xF4240); pDir.Reset(); pPositionX = pParty->vPosition.x; @@ -328,16 +329,17 @@ free(pScreenshot); if (pCurrentScreen == SCREEN_SAVEGAME) { - pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); - pRenderer->DrawTextureIndexed(0x12, 0x8D, (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0)); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); v4 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[190]); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); // - v5 = pFontSmallnum->AlignText_Center(0xBA, (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot), 185, 0); + v5 = pFontSmallnum->AlignText_Center(0xBA, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); v6 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]); pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //, pRenderer->Present(); - } + } + if (pNew_LOD->Write(&pDir, DstBuf, 0)) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 200); // ! Code=%d @@ -379,7 +381,8 @@ MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0); } strcpy(pDir.pFilename, "npcdata.bin"); - pDir.uDataSize = 38076; + pDir.uDataSize = 501 * sizeof(NPCData); + assert(pDir.uDataSize == 38076); if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) ) { sprintf(Str, pGlobalTXT_LocalizationStrings[612], 205); @@ -535,7 +538,7 @@ if ( (signed int)uNumLevelDecorations > 0 ) { v66 = &pLevelDecorations[0].field_2; - for (int i = 0; i <= (signed int)uNumLevelDecorations; ++i) + for (int i = 0; i <= (signed int)uNumLevelDecorations; ++i) { memcpy(v22, v66, 2); v66 += 16; @@ -609,43 +612,39 @@ //----- (00460078) -------------------------------------------------------- void __fastcall DoSavegame(unsigned int uSlot) { - unsigned int v1; // esi@1 - int v2; // esi@2 - RGBTexture *v3; // ebx@3 + //unsigned int v1; // esi@1 + //int v2; // esi@2 + //RGBTexture *v3; // ebx@3 int bNotArena; // [sp+2Ch] [bp-8h]@1 - unsigned int v6; // [sp+30h] [bp-4h]@1 + //unsigned int v6; // [sp+30h] [bp-4h]@1 //__debugbreak(); - v1 = uSlot; - v6 = uSlot; + //v1 = uSlot; + //v6 = uSlot; bNotArena = _strcmpi(pCurrentMapName, "d05.blv"); if ( bNotArena ) { LOD::Directory pDir; // [sp+Ch] [bp-28h]@2 SaveGame(0, 0); - v2 = 100 * v1; - strcpy(&pSavegameHeader->pLocationName[v2], pCurrentMapName); - *(int *)((char *)&pSavegameHeader->uWordTime + v2) = LODWORD(pParty->uTimePlayed); - *(int *)((char *)&pSavegameHeader->uWordTime + v2 + 4) = HIDWORD(pParty->uTimePlayed); - strcpy((char *)&pDir, "header.bin"); + //v2 = 100 * v1; + strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName); + pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed; + strcpy(pDir.pFilename, "header.bin"); pDir.uDataSize = 100; - pNew_LOD->Write(&pDir, (char *)&pSavegameHeader + v2, 0); - sprintf(pTmpBuf, "saves\\save%03d.mm7", v6); + pNew_LOD->Write(&pDir, &pSavegameHeader[uSlot], 0); + sprintf(pTmpBuf, "saves\\save%03d.mm7", uSlot); pNew_LOD->CloseWriteFile(); CopyFileA("data\\new.lod", pTmpBuf, 0); } GUI_UpdateWindows(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_GAME; - v3 = pSavegameThumbnails; + //v3 = pSavegameThumbnails; viewparams->bRedrawGameUI = 1; - do - { - v3->Release(); - ++v3; - } - while ( (signed int)v3 < (signed int)&unk_6A0758 ); + for (uint i = 0; i < 45; i++) + pSavegameThumbnails[i].Release(); + //while ( (signed int)v3 < (signed int)&unk_6A0758 ); if ( bNotArena ) pNew_LOD->_4621A7(); else @@ -653,7 +652,7 @@ pIcons_LOD->_4355F7(); pEventTimer->Resume(); ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!" - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; } // 4E28F8: using guessed type int pCurrentScreen;
--- a/StorylineTextTable.h Wed Mar 06 18:22:07 2013 +0600 +++ b/StorylineTextTable.h Wed Mar 06 18:22:25 2013 +0600 @@ -17,7 +17,8 @@ struct StorylineText { void Initialize(); - StorylineRecord StoreLine[30]; + StorylineRecord StoreLine[29]; + int field_15C; //int field_0; // int field_4[87]; };
--- a/mm7_1.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_1.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -664,24 +664,23 @@ { result += awards_count; dword_506528 = result; - if ( (signed int)(awards_count + result) <= awards_count2 ) - goto LABEL_14; - result = awards_count2 - awards_count; - goto LABEL_13; + if ( (signed int)(awards_count + result) > awards_count2 ) + { + result = awards_count2 - awards_count; + dword_506528 = result; + } } - if ( dword_50651C > 0 ) + else if ( dword_50651C > 0 ) { result -= awards_count; dword_506528 = result; if ( (result & 0x80000000u) != 0 ) { result = 0; -LABEL_13: dword_506528 = result; - goto LABEL_14; } } -LABEL_14: +//LABEL_14: dword_506544 = 0; dword_506548 = 0; awards_count = 0; @@ -695,12 +694,71 @@ v20 = achievedAwardsIndex[v21]; v6 = (char *)pAwards[v20].pText;//(char *)dword_723E80_award_related[v20 / 4]; if ( v5 != 1 ) - break; - v17 = pParty->uFine; -LABEL_42: - sprintf(pTmpBuf, v6, v17); - v6 = pTmpBuf; -LABEL_43: + { + if (!( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) )) + { + if ( v5 > 89 ) + { + if ( v5 == 90 ) + { + v10 = (unsigned __int8)pParty->uNumArenaKnightWins; + v22 = v10; + } + else if ( v5 == 91 ) + { + v10 = (unsigned __int8)pParty->uNumArenaLordWins; + v22 = v10; + } + else if ( v5 == 103 ) + { + v10 = pParty->field_874; + v22 = v10; + } + else if ( v5 == 104 ) + { + v10 = pParty->field_878; + v22 = v10; + } + } + else + { + if ( v5 == 89 ) + { + v10 = (unsigned __int8)pParty->uNumArenaSquireWins; + v22 = v10; + } + else if ( v5 == 85 ) + { + v10 = pParty->uNumDeaths; + v22 = v10; + } + else if ( v5 == 86 ) + { + v10 = pParty->uNumBountiesCollected; + v22 = v10; + } + else if ( v5 == 87 ) + { + v10 = pParty->uNumPrisonTerms; + v22 = v10; + } + else if ( v5 == 88) + { + v10 = (unsigned __int8)pParty->uNumArenaPageWins; + v22 = v10; + } + } + v17 = v22; + sprintf(pTmpBuf, v6, v17); + v6 = pTmpBuf; + } + } + else + { + v17 = pParty->uFine; + sprintf(pTmpBuf, v6, v17); + v6 = pTmpBuf; + } v14 = pAwards[v20].uSort;//dword_723E84[v20 / 4]; ++awards_count; v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( @@ -720,70 +778,7 @@ } return; } - if ( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ) - goto LABEL_43; - if ( v5 > 89 ) - { - v11 = v5 - 90; - if ( !v11 ) - { - v10 = (unsigned __int8)pParty->uNumArenaKnightWins; - goto LABEL_40; - } - v12 = v11 - 1; - if ( !v12 ) - { - v10 = (unsigned __int8)pParty->uNumArenaLordWins; - goto LABEL_40; - } - v13 = v12 - 12; - if ( !v13 ) - { - v10 = pParty->field_874; - goto LABEL_40; - } - if ( v13 == 1 ) - { - v10 = pParty->field_878; - goto LABEL_40; - } - } - else - { - if ( v5 == 89 ) - { - v10 = (unsigned __int8)pParty->uNumArenaSquireWins; - goto LABEL_40; - } - v7 = v5 - 85; - if ( !v7 ) - { - v10 = pParty->uNumDeaths; - goto LABEL_40; - } - v8 = v7 - 1; - if ( !v8 ) - { - v10 = pParty->uNumBountiesCollected; - goto LABEL_40; - } - v9 = v8 - 1; - if ( !v9 ) - { - v10 = pParty->uNumPrisonTerms; - goto LABEL_40; - } - if ( v9 == 1 ) - { - v10 = (unsigned __int8)pParty->uNumArenaPageWins; -LABEL_40: - v22 = v10; - goto LABEL_41; - } - } -LABEL_41: - v17 = v22; - goto LABEL_42; + } return; } @@ -985,24 +980,18 @@ } while ( uCellID < 126 ); } -// 4E28F8: using guessed type int pCurrentScreen; -// 507958: using guessed type int uTextureID_507958; -// 50C9A8: using guessed type int dword_50C9A8; //----- (0041A556) -------------------------------------------------------- void __cdecl draw_leather() { - pRenderer->DrawTextureIndexed( - 8u, - 8u, - (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0)); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); } //----- (0041A57E) -------------------------------------------------------- -char __cdecl QuickRefDraw() +void QuickRefDraw() { unsigned int v0; // ebx@1 - unsigned int v1; // eax@1 + //unsigned int v1; // eax@1 Player *pPlayer; // ebp@2 int v3; // eax@6 int v4; // edi@6 @@ -1049,14 +1038,14 @@ unsigned int v46; // [sp+1Ch] [bp-10h]@1 unsigned int v47; // [sp+20h] [bp-Ch]@1 unsigned int v48; // [sp+24h] [bp-8h]@33 - unsigned int v49; // [sp+28h] [bp-4h]@1 + //unsigned int v49; // [sp+28h] [bp-4h]@1 v0 = 0; v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); + //v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); - v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v1 != -1 ? &pIcons_LOD->pTextures[v1] : 0)); + //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); v43 = 0; v45 = LOBYTE(pFontArrus->uFontHeight) + 1; do @@ -1167,23 +1156,24 @@ ++v43; } while ( v43 < 4 ); + v38 = GetPartyReputation(); if ( v38 >= 0 ) { - v39 = v49; if ( v38 <= 5 ) - v39 = 65535; + v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF); + else + v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0, 0); } else - { v39 = v46; - } + v40 = GetReputationString(v38); - sprintf(pTmpBuf, "%s: ", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation + sprintf(pTmpBuf, "%s: \xC" "%05d%s\xC" "00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); v41 = pParty->GetPartyFame(); sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame - return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); } //----- (0041ABFD) -------------------------------------------------------- @@ -1210,7 +1200,8 @@ v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); pButton = pCharacterScreen_StatsBtn; - break; + pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); + break; case WINDOW_CharacterWindow_Skills: // skills if ( dword_507CC0 != uActiveCharacter ) { @@ -1222,7 +1213,8 @@ v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); pButton = pCharacterScreen_SkillsBtn; - break; + pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); + break; case WINDOW_CharacterWindow_Awards: // awards sub_4196A0(); sub_419379(); @@ -1231,49 +1223,45 @@ v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); pButton = pCharacterScreen_AwardsBtn; + pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); break; - default: // inventory and other - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 ) - goto LABEL_13; + case WINDOW_CharacterWindow_Inventory: // inventory and other sub_4196A0(); sub_419379(); CharacterUI_InventoryTab_Draw(v1, 0); v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); pButton = pCharacterScreen_InventoryBtn; + pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); break; + default: + break; } - pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); -LABEL_13: if ( bRingsShownInCharScreen ) CharacterUI_DrawPaperdollWithRingOverlay(v1); else CharacterUI_DrawPaperdoll(v1); } } -// 507CC0: using guessed type int dword_507CC0; -// 5118E0: using guessed type int bRingsShownInCharScreen; //----- (0041AD6E) -------------------------------------------------------- void __cdecl GameUI_DrawRightPanelItems() { - if ( (signed int)((pParty->uTimePlayed - qword_507CC8) >> 32) <= 0 && (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) != 0i64 ) - qword_507CC8 = 0i64; - if ( (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) == 0i64 - && (!(SHIDWORD(pParty->uTimePlayed) < (LODWORD(pParty->uTimePlayed) < (unsigned int)qword_507CC8) - + HIDWORD(qword_507CC8) | (pParty->uTimePlayed - qword_507CC8) >> 32 == 0) - || (unsigned int)(LODWORD(pParty->uTimePlayed) - qword_507CC8) > 0x80) ) + if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed) + GameUI_RightPanel_BookFlashTimer = 0; + + if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128) { - qword_507CC8 = pParty->uTimePlayed; + GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; byte_50697C = byte_50697C == 0; if ( byte_50697C && pCurrentScreen != SCREEN_REST ) { if ( bFlashQuestBook ) - pRenderer->DrawTextureTransparent(493, 355, (Texture *)(uTextureID_ib_td1_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0)); + pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); if ( bFlashAutonotesBook ) - pRenderer->DrawTextureTransparent(527, 353, (Texture *)(uTextureID_ib_td2_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0)); + pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); if ( bFlashHistoryBook ) - pRenderer->DrawTextureTransparent(600, 361, (Texture *)(uTextureID_ib_td5_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0)); + pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); } else { @@ -1286,19 +1274,15 @@ //----- (0041AEBB) -------------------------------------------------------- void __cdecl GameUI_DrawFoodAndGold() { - unsigned int v0; // ebx@2 - unsigned int v1; // ebp@2 int v2; // esi@2 if ( uGameState != GAME_STATE_FINAL_WINDOW ) { - v0 = uGameUIFontMain; - v1 = uGameUIFontShadow; v2 = sub_44100D() != 0 ? 381 : 322; sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations); - pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); + pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow); sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold); - pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); + pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow); } } @@ -1334,17 +1318,14 @@ if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) { v7 = uTextureID_mhp_red; -LABEL_9: v9 = v7; - goto LABEL_10; } - if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) + else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) { v7 = uTextureID_mhp_yel; - goto LABEL_9; + v9 = v7; } } -LABEL_10: v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); pRenderer->DrawTextureIndexed( @@ -1399,61 +1380,59 @@ { v1 = &pParty->pPlayers[v16]; v11 = v1; - if ( v1->sHealth <= 0 ) - goto LABEL_24; - v11 = &pParty->pPlayers[v16]; - v2 = (double)v1->sHealth; - v3 = v2 / (double)v1->GetMaxHealth(); - if ( v3 <= 0.5 ) - { - if ( v3 <= 0.25 ) - { - if ( v3 <= 0.0 ) - goto LABEL_24; - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->Clip( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v13->uTextureWidth, - v13->uTextureHeight + 402); - v9 = v13; - } - else - { - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->Clip( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v14->uTextureWidth, - v14->uTextureHeight + 402); - v9 = v14; - } - } - else - { - if ( v3 > 1.0 ) - v3 = 1.0; - v4 = (signed __int64)((1.0 - v3) * v15); - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->Clip( - v17 + pHealthBarPos[v16], - v4 + 402, - v17 + pHealthBarPos[v16] + v0->uTextureWidth, - v0->uTextureHeight + 402); - v9 = v0; - } - pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); - pRenderer->ResetClip(); -LABEL_24: + if ( v1->sHealth > 0 ) + { + v11 = &pParty->pPlayers[v16]; + v2 = (double)v1->sHealth; + v3 = v2 / (double)v1->GetMaxHealth(); + if( v3 > 0.5 ) + { + if ( v3 > 1.0 ) + v3 = 1.0; + v4 = (signed __int64)((1.0 - v3) * v15); + if ( v16 == 2 || v16 == 3 ) + v17 = 2; + else + v17 = 0; + pRenderer->Clip( + v17 + pHealthBarPos[v16], + v4 + 402, + v17 + pHealthBarPos[v16] + v0->uTextureWidth, + v0->uTextureHeight + 402); + v9 = v0; + } + else if ( v3 > 0.25 ) + { + if ( v16 == 2 || v16 == 3 ) + v17 = 2; + else + v17 = 0; + pRenderer->Clip( + v17 + pHealthBarPos[v16], + (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, + v17 + pHealthBarPos[v16] + v14->uTextureWidth, + v14->uTextureHeight + 402); + v9 = v14; + } + else if ( v3 > 0.0 ) + { + if ( v16 == 2 || v16 == 3 ) + v17 = 2; + else + v17 = 0; + pRenderer->Clip( + v17 + pHealthBarPos[v16], + (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, + v17 + pHealthBarPos[v16] + v13->uTextureWidth, + v13->uTextureHeight + 402); + v9 = v13; + } + if( v3 > 0.0 ) + { + pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); + pRenderer->ResetClip(); + } + } v5 = v11; v12 = v11->sMana; if ( v12 > 0 ) @@ -1777,7 +1756,7 @@ (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24), (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26), 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93], - (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0); + (Texture *)(uTextureID_Btn_GameSettings != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0); pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u, (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), @@ -1788,7 +1767,7 @@ (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), 1, 0, 0xBCu, 1u, 0, "", (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0); - Load_isn_spells_21_27(); + LoadPartyBuffIcons(); } @@ -1952,214 +1931,241 @@ while ( 1 ) { v3 = pVisibleWindowsIdxs[v27] - 1; - if ( pWindowList[v3].field_44 == v1 ) - goto LABEL_47; - if ( v26 != 34 ) - break; - if ( pWindowList[v3].field_30 != v1 ) - { - pMouse->GetClickPos(&uClickX, &uClickY); - v4 = pWindowList[v3].pStartingPosActiveItem; - v29 = v4 + pWindowList[v3].pNumPresenceButton; - if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) - { - while ( 1 ) - { - v14 = pWindowList[v3].pControlsHead; - if ( v4 > 0 ) - { - v15 = v4; - do - { - v14 = v14->pNext; - --v15; - } - while ( v15 ); - } - if ( (signed int)uClickX >= (signed int)v14->uX - && (signed int)uClickX <= (signed int)v14->uZ - && (signed int)uClickY >= (signed int)v14->uY - && (signed int)uClickY <= (signed int)v14->uW ) - goto LABEL_66; - ++v4; - if ( v4 >= v29 ) - { -LABEL_45: - v1 = 0; - goto LABEL_46; - } - } - } - goto LABEL_46; - } -LABEL_47: + if ( pWindowList[v3].field_44 != v1 ) + { + switch(v26) + { + case VK_LEFT: + { + v12 = pWindowList[v3].field_34; + if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) + { + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; + pWindowList[v3].pCurrentPosActiveItem -= v12; + if ( v8 ) + { + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); + v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + if ( pWindowList[v3].field_30 != v1 ) + { + break; + } + v9 = pWindowList[v3].pControlsHead; + v13 = pWindowList[v3].pCurrentPosActiveItem; + if ( v13 > (signed int)v1 ) + { + do + { + v9 = v9->pNext; + --v13; + } + while ( v13 ); + } + v11 = v9->uControlParam; + /*if ( (signed int)v2 < 40 ) + { + pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; + v2 = pMessageQueue_50CBD0->uNumMessages + 1; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1); + break; + } + case VK_RIGHT: + { + v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; + if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) + { + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; + pWindowList[v3].pCurrentPosActiveItem = v7; + if ( v8 ) + { + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); + v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + if ( pWindowList[v3].field_30 != v1 ) + { + break; + } + v9 = pWindowList[v3].pControlsHead; + v10 = pWindowList[v3].pCurrentPosActiveItem; + if ( v10 > (signed int)v1 ) + { + do + { + v9 = v9->pNext; + --v10; + } + while ( v10 ); + } + v11 = v9->uControlParam; + pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1); + break; + } + case VK_DOWN: + { + v17 = pWindowList[v3].pStartingPosActiveItem; + v18 = pWindowList[v3].pCurrentPosActiveItem; + if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) + pWindowList[v3].pCurrentPosActiveItem = v17; + else + pWindowList[v3].pCurrentPosActiveItem = v18 + 1; + if ( pWindowList[v3].field_30 != v1 ) + return 1; + v19 = pWindowList[v3].pControlsHead; + v20 = pWindowList[v3].pCurrentPosActiveItem; + if ( v20 > (signed int)v1 ) + { + do + { + v19 = v19->pNext; + --v20; + } + while ( v20 ); + } + v21 = v19->uControlParam; + pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1); + return 1; + } + case VK_SELECT: + { + pMouse->GetClickPos(&uClickX, &uClickY); + v4 = pWindowList[v3].pStartingPosActiveItem; + v28 = v4 + pWindowList[v3].pNumPresenceButton; + if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) + { + while ( 1 ) + { + v5 = pWindowList[v3].pControlsHead; + if ( v4 > 0 ) + { + v6 = v4; + do + { + v5 = v5->pNext; + --v6; + } + while ( v6 ); + } + if ( (signed int)uClickX >= (signed int)v5->uX + && (signed int)uClickX <= (signed int)v5->uZ + && (signed int)uClickY >= (signed int)v5->uY + && (signed int)uClickY <= (signed int)v5->uW ) + break; + ++v4; + if ( v4 >= v28 ) + { + v1 = 0; + v2 = pMessageQueue_50CBD0->uNumMessages; + --v27; + if ( v27 < 0 ) + return 0; + continue; + } + } + pWindowList[v3].pCurrentPosActiveItem = v4; + return 1; + } + v2 = pMessageQueue_50CBD0->uNumMessages; + break; + } + case VK_UP: + { + v22 = pWindowList[v3].pCurrentPosActiveItem; + v23 = pWindowList[v3].pStartingPosActiveItem; + if ( v22 <= v23 ) + v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; + else + v24 = v22 - 1; + v8 = pWindowList[v3].field_30 == v1; + pWindowList[v3].pCurrentPosActiveItem = v24; + if ( !v8 ) + return 1; + v19 = pWindowList[v3].pControlsHead; + v25 = pWindowList[v3].pCurrentPosActiveItem; + if ( v25 > (signed int)v1 ) + { + do + { + v19 = v19->pNext; + --v25; + } + while ( v25 ); + } + v21 = v19->uControlParam; + /*if ( (signed int)v2 < 40 ) + { + pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1); + return 1; + } + case VK_NEXT: + { + if ( pWindowList[v3].field_30 != v1 ) + { + pMouse->GetClickPos(&uClickX, &uClickY); + v4 = pWindowList[v3].pStartingPosActiveItem; + v29 = v4 + pWindowList[v3].pNumPresenceButton; + if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) + { + while ( 1 ) + { + v14 = pWindowList[v3].pControlsHead; + if ( v4 > 0 ) + { + v15 = v4; + do + { + v14 = v14->pNext; + --v15; + } + while ( v15 ); + } + if ( (signed int)uClickX >= (signed int)v14->uX + && (signed int)uClickX <= (signed int)v14->uZ + && (signed int)uClickY >= (signed int)v14->uY + && (signed int)uClickY <= (signed int)v14->uW ) + { + pWindowList[v3].pCurrentPosActiveItem = v4; + return 1; + } + ++v4; + if ( v4 >= v29 ) + { + v1 = 0; + v2 = pMessageQueue_50CBD0->uNumMessages; + break; + } + } + } + else + { + v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + break; + } + default: + { + break; + } + + } + } --v27; if ( v27 < 0 ) return 0; } - if ( v26 == 37 ) - { - v12 = pWindowList[v3].field_34; - if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) - { - v8 = pCurrentScreen == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem -= v12; - if ( v8 ) - { - pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); - v2 = pMessageQueue_50CBD0->uNumMessages; - } - } - if ( pWindowList[v3].field_30 != v1 ) - goto LABEL_47; - v9 = pWindowList[v3].pControlsHead; - v13 = pWindowList[v3].pCurrentPosActiveItem; - if ( v13 > (signed int)v1 ) - { - do - { - v9 = v9->pNext; - --v13; - } - while ( v13 ); - } -LABEL_26: - v11 = v9->uControlParam; - /*if ( (signed int)v2 < 40 ) - { - pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - v2 = pMessageQueue_50CBD0->uNumMessages + 1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1); - goto LABEL_47; - } - if ( v26 != 38 ) - { - if ( v26 == 39 ) - { - v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; - if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) - { - v8 = pCurrentScreen == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem = v7; - if ( v8 ) - { - pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); - v2 = pMessageQueue_50CBD0->uNumMessages; - } - } - if ( pWindowList[v3].field_30 != v1 ) - goto LABEL_47; - v9 = pWindowList[v3].pControlsHead; - v10 = pWindowList[v3].pCurrentPosActiveItem; - if ( v10 > (signed int)v1 ) - { - do - { - v9 = v9->pNext; - --v10; - } - while ( v10 ); - } - goto LABEL_26; - } - if ( v26 == 40 ) - { - v17 = pWindowList[v3].pStartingPosActiveItem; - v18 = pWindowList[v3].pCurrentPosActiveItem; - if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) - pWindowList[v3].pCurrentPosActiveItem = v17; - else - pWindowList[v3].pCurrentPosActiveItem = v18 + 1; - if ( pWindowList[v3].field_30 != v1 ) - return 1; - v19 = pWindowList[v3].pControlsHead; - v20 = pWindowList[v3].pCurrentPosActiveItem; - if ( v20 > (signed int)v1 ) - { - do - { - v19 = v19->pNext; - --v20; - } - while ( v20 ); - } - goto LABEL_56; - } - if ( v26 == 41 ) - { - pMouse->GetClickPos(&uClickX, &uClickY); - v4 = pWindowList[v3].pStartingPosActiveItem; - v28 = v4 + pWindowList[v3].pNumPresenceButton; - if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) - { - while ( 1 ) - { - v5 = pWindowList[v3].pControlsHead; - if ( v4 > 0 ) - { - v6 = v4; - do - { - v5 = v5->pNext; - --v6; - } - while ( v6 ); - } - if ( (signed int)uClickX >= (signed int)v5->uX - && (signed int)uClickX <= (signed int)v5->uZ - && (signed int)uClickY >= (signed int)v5->uY - && (signed int)uClickY <= (signed int)v5->uW ) - break; - ++v4; - if ( v4 >= v28 ) - goto LABEL_45; - } -LABEL_66: - pWindowList[v3].pCurrentPosActiveItem = v4; - return 1; - } -LABEL_46: - v2 = pMessageQueue_50CBD0->uNumMessages; - goto LABEL_47; - } - goto LABEL_47; - } - v22 = pWindowList[v3].pCurrentPosActiveItem; - v23 = pWindowList[v3].pStartingPosActiveItem; - if ( v22 <= v23 ) - v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; - else - v24 = v22 - 1; - v8 = pWindowList[v3].field_30 == v1; - pWindowList[v3].pCurrentPosActiveItem = v24; - if ( !v8 ) - return 1; - v19 = pWindowList[v3].pControlsHead; - v25 = pWindowList[v3].pCurrentPosActiveItem; - if ( v25 > (signed int)v1 ) - { - do - { - v19 = v19->pNext; - --v25; - } - while ( v25 ); - } -LABEL_56: - v21 = v19->uControlParam; - /*if ( (signed int)v2 < 40 ) - { - pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1); - return 1; + } //----- (0041D20D) -------------------------------------------------------- @@ -2233,8 +2239,8 @@ //----- (0041D895) -------------------------------------------------------- -void GameUI_DrawItemInfo(ItemGen *ecx0) -{ +void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) + { ItemGen *v1; // esi@1 unsigned int v2; // eax@3 //char *v3; // edi@5 @@ -2242,7 +2248,6 @@ //unsigned int v5; // esi@5 signed int v6; // eax@5 int v7; // edx@5 - ItemGen *v8; // ecx@10 //unsigned int v9; // eax@12 char v10; // zf@16 ItemGen *v11; // eax@16 @@ -2264,7 +2269,7 @@ int v27; // eax@67 const char *v28; // edi@69 int v29; // eax@70 - char *v30; // edi@78 + char v30; // edi@78 const char *v31; // eax@78 int v32; // ecx@81 unsigned int v33; // eax@81 @@ -2296,7 +2301,7 @@ int v59; // [sp-8h] [bp-280h]@56 int v60; // [sp-8h] [bp-280h]@58 unsigned int v61; // [sp-8h] [bp-280h]@110 - char a1[300]; // [sp+8h] [bp-270h]@40 + char out_text[300]; // [sp+8h] [bp-270h]@40 //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 //char v64[100]; // [sp+D0h] [bp-1A8h]@40 char v65[120]; // [sp+134h] [bp-144h]@92 @@ -2314,31 +2319,30 @@ //char *v76; // [sp+1FCh] [bp-7Ch]@5 int v77; // [sp+200h] [bp-78h]@12 int v78; // [sp+204h] [bp-74h]@5 - GUIWindow v79; // [sp+208h] [bp-70h]@2 + GUIWindow wHintWindow; // [sp+208h] [bp-70h]@2 POINT a2; // [sp+25Ch] [bp-1Ch]@2 int v81; // [sp+264h] [bp-14h]@5 - GUIFont *v82; // [sp+268h] [bp-10h]@1 - char *v83; // [sp+26Ch] [bp-Ch]@18 + // GUIFont *pFontComic; // [sp+268h] [bp-10h]@1 + PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 + char* v84; + int v85; char *Str; // [sp+270h] [bp-8h]@65 - ItemGen *_this; // [sp+274h] [bp-4h]@1 - - v1 = ecx0; - _this = ecx0; + + v1 = inspect_item; var88 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v82 = pFontComic; - if (!v1->uItemID) + if (!inspect_item->uItemID) return; - v79.Hint = 0; - v79.uFrameWidth = 384; - v79.uFrameHeight = 180; - v79.uFrameY = 40; + wHintWindow.Hint = 0; + wHintWindow.uFrameWidth = 384; + wHintWindow.uFrameHeight = 180; + wHintWindow.uFrameY = 40; if ( pMouse->GetCursorPos(&a2)->x <= 320 ) v2 = pMouse->GetCursorPos(&a2)->x + 30; else - v2 = pMouse->GetCursorPos(&a2)->x - v79.uFrameWidth - 30; - v79.uFrameX = v2; - auto item_desc = &pItemsTable->pItems[_this->uItemID]; + v2 = pMouse->GetCursorPos(&a2)->x - wHintWindow.uFrameWidth - 30; + wHintWindow.uFrameX = v2; + auto item_desc = &pItemsTable->pItems[inspect_item->uItemID]; //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName; //v76 = v3; //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -2357,33 +2361,32 @@ v81 = 0; else v81 >>= 1; - v8 = _this; if ( !item_desc->uItemID_Rep_St ) - _this->SetIdentified(); + inspect_item->SetIdentified(); //v9 = v8->uAttributes; v77 = 0; //a2.y = v8->uAttributes & 2; - if (pItemsTable->pItems[v8->uItemID].uEquipType == EQUIP_GOLD) - v77 = v8->uSpecEnchantmentType; + if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD) + v77 = inspect_item->uSpecEnchantmentType; if ( uActiveCharacter ) { - if (!v8->Identified()) + //try to identify + if (!inspect_item->Identified()) { - v10 = pPlayers[uActiveCharacter]->CanIdentify(_this) == 1; - v11 = _this; - if ( v10 ) - _this->SetIdentified(); - v10 = !v11->Identified(); - v83 = (char *)9; - if ( v10 ) + + v11 = inspect_item; + if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) + inspect_item->SetIdentified(); + v83 = SPEECH_9; + if ( !inspect_item->Identified() ) { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u);//"Identify Failed" } else { - v83 = (char *)SPEECH_8; - if ( _this->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) - v83 = (char *)SPEECH_7; + v83 = SPEECH_8; + if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) + v83 = SPEECH_7; } if ( dword_4E455C ) { @@ -2391,96 +2394,107 @@ dword_4E455C = 0; } } - _this->UpdateTempBonus(pParty->uTimePlayed); - if (v8->Broken()) + inspect_item->UpdateTempBonus(pParty->uTimePlayed); + if (inspect_item->Broken()) { - v10 = pPlayers[uActiveCharacter]->CanRepair(_this) == 1; - v12 = _this; - if ( v10 ) - _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; - v10 = !v12->Broken(); - v83 = (char *)SPEECH_11; - if ( v10 ) - v83 = (char *)SPEECH_10; + if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 ) + inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1; + v83 = SPEECH_11; + if ( !inspect_item->Broken() ) + v83 = SPEECH_10; else - ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u);//"Repair Failed" if ( dword_4E455C ) { - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); + pPlayers[uActiveCharacter]->PlaySound(v83, 0); dword_4E455C = 0; } } } //v13 = _this->uAttributes; //v14 = _this->Identified(); - a2.y = _this->Identified(); - if (_this->Broken()) + //a2.y = inspect_item->Identified(); + if (inspect_item->Broken()) { - v79.DrawMessageBox(0); + wHintWindow.DrawMessageBox(0); //v15 = &; - pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); - v79.uFrameWidth -= 24; - v79.uFrameHeight -= 12; - v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; - v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - pRenderer->DrawTransparentRedShade(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73); - if ( a2.y ) - v16 = _this->GetIdentifiedName(); + pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, + wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); + wHintWindow.uFrameWidth -= 24; + wHintWindow.uFrameHeight -= 12; + wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; + wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1; + pRenderer->DrawTransparentRedShade(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73); + if ( inspect_item->Identified()) + v16 = inspect_item->GetIdentifiedName(); else v16 = item_desc->pUnidentifiedName; - v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u); - v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &v79, 0, 0); - v57 = 3; - v52 = pGlobalTXT_LocalizationStrings[32]; - goto LABEL_37; - } - if (!_this->Identified()) - { - v79.DrawMessageBox(0); - //v15 = pRenderer; - pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); - v79.uFrameWidth -= 24; - v79.uFrameHeight -= 12; - v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; - v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - pRenderer->DrawTextureTransparent(v79.uFrameX + v78, v81 + v79.uFrameY + 30, v73); - v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u); - v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &v79, 0, 0); - v57 = 3; - v52 = pGlobalTXT_LocalizationStrings[232]; -LABEL_37: + wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u); + v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &wHintWindow, 0, 0); //"Broken Item" v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); - v79.DrawTitleText(pFontArrus, 0x64u, ((signed int)v79.uFrameHeight >> 1) - v18, v19, v52, v57); - goto LABEL_116; + wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; } - - sprintfex(a1, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); - a1[100] = 0; - a1[200] = 0; + if (!inspect_item->Identified()) + { + wHintWindow.DrawMessageBox(0); + pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, + wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); + wHintWindow.uFrameWidth -= 24; + wHintWindow.uFrameHeight -= 12; + wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; + wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1; + pRenderer->DrawTextureTransparent(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73); + wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u); + v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &wHintWindow, 0, 0); ///"Not Identified" + v18 = v17 >> 1; + v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); + wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3); + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; + } + + sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s" + out_text[100] = 0; + out_text[200] = 0; //v20 = item_desc->uEquipType; switch (item_desc->uEquipType) { case EQUIP_ONE_OR_TWO_HANDS: case EQUIP_TWO_HANDED: - sprintfex(a1 + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[18], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); + sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], + (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); //"Damage" if (item_desc->uDamageMod) { char mod[16]; sprintf(mod, "+%d", (int)item_desc->uDamageMod); - strcat(a1 + 100, mod); + strcat(out_text + 100, mod); } break; case EQUIP_BOW: - sprintfex(a1 + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); + sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" + (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage" + (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); if (item_desc->uDamageMod) { char mod[16]; sprintf(mod, "+%d", (int)item_desc->uDamageMod); - strcat(a1 + 100, mod); + strcat(out_text + 100, mod); } break; @@ -2493,215 +2507,205 @@ case EQUIP_BOOTS: case EQUIP_RING: case EQUIP_AMULET: - if (item_desc->uDamageDice) - sprintfex(a1 + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod); + if (item_desc->uDamageDice) //"Armor" + sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod); break; + case EQUIP_POTION: + if ( inspect_item->uEncantmentType ) + sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEncantmentType); //"Power" + break; + case EQUIP_REAGENT: + sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power" + break; } - if ( v77 ) - goto LABEL_65; + if ( !v77 ) + { //v23 = item_desc->uEquipType; - if (item_desc->uEquipType == 14) - { - v24 = _this->uEncantmentType; - if ( v24 ) - goto LABEL_56; -LABEL_65: - v79.uFrameWidth -= 12; - a2.y = 3; - v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; - v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); - v83 = a1; - do - { - if ( *v83 ) + if ( inspect_item->uEncantmentType ) + { + sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], + pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special" + } + else if ( inspect_item->uSpecEnchantmentType ) + { + sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], + pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength); + } + + else if ( inspect_item->uNumCharges ) + { + sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" + + } + } + wHintWindow.uFrameWidth -= 12; + v85 = 3; + wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; + wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1; + Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); + v84 = &out_text[0]; + do { - v27 = v82->CalcTextHeight(v83, &v79, 100, 0); - Str += v27 + 3; - } - v83 += 100; - --a2.y; - } - while ( a2.y ); - v28 = item_desc->pDescription; - if ( *v28 ) - { - v29 = pFontSmallnum->CalcTextHeight(v28, &v79, 100, 0); - Str += v29; - } - v79.uFrameHeight = v73->uTextureHeight + v81 + 54; - if ( (signed int)Str > (signed int)v79.uFrameHeight ) - v79.uFrameHeight = (unsigned int)Str; - if ( _this->uAttributes & 8 && (_this->uSpecEnchantmentType || _this->uEncantmentType) ) - v79.uFrameHeight += LOBYTE(v82->uFontHeight); - v83 = 0; - if ( LOBYTE(pFontArrus->uFontHeight) ) - { - v79.uFrameWidth -= 24; - v30 = (char *)LOBYTE(pFontArrus->uFontHeight); - v31 = _this->GetIdentifiedName(); - if ( pFontArrus->CalcTextHeight(v31, &v79, 0, 0) / (signed int)v30 ) - v83 = v30; - v79.uFrameWidth += 24; - } - v79.uFrameWidth += 12; - v79.uFrameHeight += (unsigned int)v83; - v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; - v79.DrawMessageBox(0); - //v15 = pRenderer; - pRenderer->Clip(v79.uFrameX + 12, v79.uFrameY + 12, - v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); - v79.uFrameWidth -= 12; - v32 = v73->uTextureHeight; - v33 = v79.uFrameHeight; - v79.uFrameHeight -= 12; - v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; - v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; - pRenderer->DrawTextureTransparent( - v79.uFrameX + v78, - v79.uFrameY + (signed int)(v33 - v32) / 2, - v73); - a2.y = 3; - v34 = (int)(v83 + 35); - Str = a1; - do - { - if ( *Str ) - { - v79.DrawText(v82, 100, v34, 0, Str, 0, 0, 0); - v34 += v82->CalcTextHeight(Str, &v79, 100, 0) + 3; + if ( *v84 ) + { + v27 = pFontComic->CalcTextHeight(v84, &wHintWindow, 100, 0); + Str += v27 + 3; + } + v84 += 100; + --v85; } - Str += 100; - --a2.y; - } - while ( a2.y ); - v35 = item_desc->pDescription; - if ( *v35 ) - v79.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0); - v79.uFrameX += 12; - v79.uFrameWidth -= 24; - v36 = _this->GetIdentifiedName(); - v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u); - v79.uFrameWidth += 24; - v79.uFrameX -= 12; - if ( v77 ) - { - sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77); - v40 = v82; - v61 = 0; - v56 = 0; - v51 = 0; - v47 = pTmpBuf; - v44 = 0; - v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); - v41 = 100; - } - else - { - if ( _this->uAttributes & 8 && (_this->uSpecEnchantmentType || _this->uEncantmentType) ) - { - sub_493F79(&v67, _this->uExpireTime - pParty->uTimePlayed); - strcpy(pTmpBuf, "Duration:"); - Str = (char *)(v67.field_18_expire_year - game_starting_year); - if (v67.field_18_expire_year != 1168 ) - { - sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); - strcat(pTmpBuf, v65); - } - if ( (((v67.field_14_exprie_month || Str) && ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str) || v67.field_C_expire_day) - && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day) - || v67.field_8_expire_hour) - && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || v67.field_C_expire_day || v67.field_8_expire_hour) - || v67.field_4_expire_minute ) - { - sprintf(v65, " %d:mn", v67.field_4_expire_minute); - strcat(pTmpBuf, v65); - } - v79.DrawText(v82, 100, v79.uFrameHeight - 2 * LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); - } - v37 = _this->GetValue(); - sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37); - v79.DrawText(v82, 100, v79.uFrameHeight - LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); - v38 = _this->uAttributes; - if ( BYTE1(v38) & 1 ) - { - v61 = 0; - v56 = 0; - v51 = 0; - v47 = pGlobalTXT_LocalizationStrings[187]; - } - else - { - if ( !(BYTE1(v38) & 2) ) - goto LABEL_116; - v61 = 0; - v56 = 0; - v51 = 0; - v47 = pGlobalTXT_LocalizationStrings[651]; - } - LOWORD(v38) = LOWORD(pRenderer->uTargetRMask); - v44 = v38; - v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); - v39 = v82->GetLineWidth(pTmpBuf); - v40 = v82; - v41 = v39 + 132; - } - v79.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); -LABEL_116: - pRenderer->ResetClip(); - if ( !areWeLoadingTexture ) - { - v73->Release(); - pIcons_LOD->_40F9C5(); - } - return; - } - if (item_desc->uEquipType == 13) - { - v24 = pItemsTable->pItems[_this->uItemID].uDamageDice; -LABEL_56: - v59 = v24; - v54 = pGlobalTXT_LocalizationStrings[449]; - v49 = "%s: %d"; -LABEL_64: - sprintf(a1 + 200, v49, v54, v59); - goto LABEL_65; - } - v25 = _this->uEncantmentType; - if ( v25 ) - { - v60 = _this->_bonus_strength; - v55 = *((int *)&pItemsTable->pItems[799].uDamageMod + 5 * v25); - v50 = pGlobalTXT_LocalizationStrings[210]; - v46 = "%s: %s +%d"; - } - else - { - v26 = _this->uSpecEnchantmentType; - if ( !v26 ) - { - if ( _this->uNumCharges ) - { - v59 = _this->uNumCharges; - v54 = pGlobalTXT_LocalizationStrings[464]; - v49 = "%s: %lu"; - goto LABEL_64; - } - goto LABEL_65; - } - v60 = _this->_bonus_strength; - v55 = *((int *)&pItemsTable->pEnchantments[23].pBonusStat + 7 * v26); - v50 = pGlobalTXT_LocalizationStrings[210]; - v46 = "%s: %s"; - } - sprintf(a1 + 200, v46, v50, v55, v60); - goto LABEL_65; + while ( v85 ); + v28 = item_desc->pDescription; + if ( *v28 ) + { + v29 = pFontSmallnum->CalcTextHeight(v28, &wHintWindow, 100, 0); + Str += v29; + } + wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54; + if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight ) + wHintWindow.uFrameHeight = (unsigned int)Str; + if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) ) + wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight); + v85 = 0; + if ( pFontArrus->uFontHeight ) + { + wHintWindow.uFrameWidth -= 24; + v30 = pFontArrus->uFontHeight; + v31 = inspect_item->GetIdentifiedName(); + if ( pFontArrus->CalcTextHeight(v31, &wHintWindow, 0, 0) / (signed int)v30 ) + v85 = v30; + wHintWindow.uFrameWidth += 24; + } + wHintWindow.uFrameWidth += 12; + wHintWindow.uFrameHeight += (unsigned int)v85; + wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1; + wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; + wHintWindow.DrawMessageBox(0); + //v15 = pRenderer; + pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); + wHintWindow.uFrameWidth -= 12; + v32 = v73->uTextureHeight; + v33 = wHintWindow.uFrameHeight; + wHintWindow.uFrameHeight -= 12; + wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; + wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1; + pRenderer->DrawTextureTransparent( + wHintWindow.uFrameX + v78, + wHintWindow.uFrameY + (signed int)(v33 - v32) / 2, + v73); + + v34 = (int)(v85 + 35); + v85 = 3; + Str = out_text; + do + { + if ( *Str ) + { + wHintWindow.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0); + v34 += pFontComic->CalcTextHeight(Str, &wHintWindow, 100, 0) + 3; + } + Str += 100; + --v85; + } + while (v85 ); + v35 = item_desc->pDescription; + if ( *v35 ) + wHintWindow.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0); + wHintWindow.uFrameX += 12; + wHintWindow.uFrameWidth -= 24; + v36 = inspect_item->GetIdentifiedName(); + wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u); + wHintWindow.uFrameWidth += 24; + wHintWindow.uFrameX -= 12; + if ( v77 ) + { + sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" + v40 = pFontComic; + v61 = 0; + v56 = 0; + v51 = 0; + v47 = pTmpBuf; + v44 = 0; + v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight); + v41 = 100; + } + else + { + if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) ) + { + sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); + strcpy(pTmpBuf, "Duration:"); + Str = (char *)(v67.field_18_expire_year - game_starting_year); + if (v67.field_18_expire_year != 1168 ) + { + sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); + strcat(pTmpBuf, v65); + } + if ( (((v67.field_14_exprie_month || Str) && + ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str) + || v67.field_C_expire_day) + && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || + v67.field_C_expire_day) + || v67.field_8_expire_hour) + && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || + v67.field_C_expire_day || v67.field_8_expire_hour) + || v67.field_4_expire_minute ) + { + sprintf(v65, " %d:mn", v67.field_4_expire_minute); + strcat(pTmpBuf, v65); + } + wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0); + } + v37 = inspect_item->GetValue(); + sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37); + wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0); + v38 = inspect_item->uAttributes; + if ( BYTE1(v38) & 1 ) + { + v61 = 0; + v56 = 0; + v51 = 0; + v47 = pGlobalTXT_LocalizationStrings[187]; //"Stolen" + } + else + { + if ( !(BYTE1(v38) & 2) ) + { + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; + } + v61 = 0; + v56 = 0; + v51 = 0; + v47 = pGlobalTXT_LocalizationStrings[651]; //"Hardened" + } + LOWORD(v38) = LOWORD(pRenderer->uTargetRMask); + v44 = v38; + v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight); + v39 = pFontComic->GetLineWidth(pTmpBuf); + v40 = pFontComic; + v41 = v39 + 132; + } + wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; } // 4E455C: using guessed type int dword_4E455C; // 506128: using guessed type int areWeLoadingTexture; + //----- (0041E360) -------------------------------------------------------- char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) { @@ -5315,7 +5319,7 @@ { if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) { - pParty->uFlags |= 8u; + pParty->uFlags |= PARTY_FLAGS_1_FALLING; return; } if ( uActiveCharacter @@ -5380,14 +5384,17 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-c", 2); + + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2); + pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); @@ -5425,10 +5432,10 @@ uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); - dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); - dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); - dword_507964 = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); - dword_507960 = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); @@ -5465,10 +5472,10 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); @@ -5510,10 +5517,10 @@ uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); - dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); - dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); - dword_507964 = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); - dword_507960 = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); + uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); @@ -5561,10 +5568,10 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); @@ -5818,9 +5825,9 @@ _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; - thisa = _50B924_view_transformed_xs[0] >= 0x80000u; + thisa = _50B924_view_transformed_xs[0] >= (signed int)0x80000u; //int i = 1; - for (uint i = 1; i < v1->uNumVertices; ++i) + for (uint i = 1; i <= v1->uNumVertices; ++i) { v10 = _50B924_view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u; @@ -5862,11 +5869,11 @@ //++i; thisa = v81; } - ia = 0; v21 = v79; dword_50B918[v79] = dword_50B918[0]; dword_50B828[v79] = dword_50B828[0]; - for ( dword_50B738[v79] = dword_50B738[0]; ia < v79; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v35 ) + dword_50B738[v79] = dword_50B738[0]; + for (ia = 0; ia < v79; ++ia) { v22 = ia; thisc = abs(dword_50B918[ia]); @@ -5895,7 +5902,7 @@ } } v29 = dword_50B738[v22]; - dword_50BAF4_xs[v22 + 1] = v26; + dword_50BAF8_xs[v22] = v26; if ( abs(v29) >> 13 <= thisc ) { v33 = dword_50B738[v22]; @@ -5918,18 +5925,18 @@ v32 = (v31 & 0x800000) - 0x400000; } } - dword_50BA08[v22] = v32; - dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16; - v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16; - dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1]; - ++ia; + dword_50BA08_ys[v22] = v32; + dword_50BAF8_xs[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF8_xs[v22]) >> 16; + v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08_ys[v22]) >> 16; + dword_50BAF8_xs[v22] = pBLVRenderParams->uViewportCenterX - dword_50BAF8_xs[v22]; + dword_50BA08_ys[v22] = pBLVRenderParams->uViewportCenterY - v35; } v36 = 0; - dword_50BAF4_xs[v21 + 1] = dword_50BAF4_xs[1]; - dword_50BA08[v21] = dword_50BA08[0]; + dword_50BAF8_xs[v21] = dword_50BAF8_xs[0]; + dword_50BA08_ys[v21] = dword_50BA08_ys[0]; v37 = pBLVRenderParams->uViewportX; - v38 = dword_50BAF4_xs[1] < (signed int)pBLVRenderParams->uViewportX; - LOBYTE(v38) = dword_50BAF4_xs[1] >= (signed int)pBLVRenderParams->uViewportX; + v38 = dword_50BAF8_xs[0] < (signed int)pBLVRenderParams->uViewportX; + LOBYTE(v38) = dword_50BAF8_xs[0] >= (signed int)pBLVRenderParams->uViewportX; v39 = 1; ib = 1; if ( v79 < 1 ) @@ -5937,30 +5944,31 @@ do { v40 = v39; - v41 = dword_50BAF4_xs[v40 + 1]; + v41 = dword_50BAF8_xs[v40]; v82 = v41 >= (signed int)v37; if ( v38 ^ v82 ) { if ( v41 >= (signed int)v37 ) { - v67 = (signed int)(v37 - dword_50BAF4_xs[v40]) * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3]) / (v41 - dword_50BAF4_xs[v40]); - v42 = dword_50B9F8[v40 + 3]; + v67 = (signed int)(v37 - dword_50BAF8_xs[v40 - 1]) * (signed __int64)(dword_50BA08_ys[v40] - dword_50BA08_ys[v40 - 1]) / (v41 - dword_50BAF8_xs[v40 - 1]); + v42 = dword_50BA08_ys[v40 - 1]; } else { - v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40]) / (dword_50BAF4_xs[v40] - v41); - v42 = dword_50BA08[v40]; + v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50BA08_ys[v40 - 1] - dword_50BA08_ys[v40]) / (dword_50BAF8_xs[v40 - 1] - v41); + v42 = dword_50BA08_ys[v40]; } + dword_50B9FC_ys[v36] = v67 + v42; + v37 = pBLVRenderParams->uViewportX; + dword_50BAEC_xs[v36] = pBLVRenderParams->uViewportX; ++v36; - dword_50B9F8[v36] = v67 + v42; - v37 = pBLVRenderParams->uViewportX; - dword_50BAE8_xs[v36] = pBLVRenderParams->uViewportX; } v38 = v82; if ( v82 ) { - dword_50BAE8_xs[v36 + 1] = dword_50BAF4_xs[v40 + 1]; - dword_50B9F8[v36++ + 1] = dword_50BA08[v40]; + dword_50BAEC_xs[v36] = dword_50BAF8_xs[v40]; + dword_50B9FC_ys[v36] = dword_50BA08_ys[v40]; + ++v36; } v39 = ib++ + 1; } @@ -5970,38 +5978,38 @@ return 0; v43 = 0; - dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1]; - dword_50B9F8[v36 + 1] = dword_50B9F8[1]; + dword_50BAEC_xs[v36] = dword_50BAEC_xs[0]; + dword_50B9FC_ys[v36] = dword_50B9FC_ys[0]; v44 = pBLVRenderParams->uViewportZ; - thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ; + thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ; ic = 1; do { v45 = ic; - v46 = dword_50BAE8_xs[ic + 1]; + v46 = dword_50BAEC_xs[ic]; v83 = v46 <= (signed int)v44; if ( thisd ^ v83 ) { if ( v46 <= (signed int)v44 ) { - v68 = (signed int)(v44 - dword_50BAE8_xs[v45]) * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45]) / (v46 - dword_50BAE8_xs[v45]); - v47 = dword_50B9F8[v45]; + v68 = (signed int)(v44 - dword_50BAEC_xs[v45 - 1]) * (signed __int64)(dword_50B9FC_ys[v45] - dword_50B9FC_ys[v45 - 1]) / (v46 - dword_50BAEC_xs[v45 - 1]); + v47 = dword_50B9FC_ys[v45 - 1]; } else { - v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1]) / (dword_50BAE8_xs[v45] - v46); - v47 = dword_50B9F8[v45 + 1]; + v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9FC_ys[v45 - 1] - dword_50B9FC_ys[v45]) / (dword_50BAEC_xs[v45 - 1] - v46); + v47 = dword_50B9FC_ys[v45]; } + dword_50B9F0[v43] = v68 + v47; + v44 = pBLVRenderParams->uViewportZ; + dword_50BAE0[v43] = pBLVRenderParams->uViewportZ; ++v43; - dword_50B9EC[v43] = v68 + v47; - v44 = pBLVRenderParams->uViewportZ; - dword_50BADC_xs[v43] = pBLVRenderParams->uViewportZ; } if ( v83 ) { - dword_50BAE0[v43] = dword_50BAE8_xs[v45 + 1]; - dword_50B9F0[v43++] = dword_50B9F8[v45 + 1]; + dword_50BAE0[v43] = dword_50BAEC_xs[v45]; + dword_50B9F0[v43++] = dword_50B9FC_ys[v45]; } ++ic; thisd = v83; @@ -6028,24 +6036,24 @@ { if ( v53 >= (signed int)v49 ) { - v69 = (signed int)(v49 - dword_50B9EC[v52]) * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52]) / (v53 - dword_50B9EC[v52]); - v54 = dword_50BADC_xs[v52]; + v69 = (signed int)(v49 - dword_50B9F0[v52 - 1]) * (signed __int64)(dword_50BAE0[v52] - dword_50BAE0[v52 - 1]) / (v53 - dword_50B9F0[v52 - 1]); + v54 = dword_50BAE0[v52 - 1]; } else { - v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52]) / (dword_50B9EC[v52] - v53); + v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BAE0[v52 - 1] - dword_50BAE0[v52]) / (dword_50B9F0[v52 - 1] - v53); v54 = dword_50BAE0[v52]; } + dword_50BAD4[v48] = v69 + v54; + v49 = pBLVRenderParams->uViewportY; + dword_50B9E4[v48] = pBLVRenderParams->uViewportY; ++v48; - dword_50BAD0[v48] = v69 + v54; - v49 = pBLVRenderParams->uViewportY; - dword_50B9E0_ys[v48] = pBLVRenderParams->uViewportY; } v50 = v84; if ( v84 ) { dword_50BAD4[v48] = dword_50BAE0[v52]; - dword_50B9E0_ys[v48++ + 1] = dword_50B9F0[v52]; + dword_50B9E4[v48++] = dword_50B9F0[v52]; } v51 = id++ + 1; } @@ -6056,36 +6064,36 @@ v55 = 0; dword_50BAD4[v48] = dword_50BAD4[0]; - dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1]; + dword_50B9E4[v48] = dword_50B9E4[0]; v56 = pBLVRenderParams->uViewportW; - thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW; + thise = dword_50B9E4[0] <= (signed int)pBLVRenderParams->uViewportW; ie = 1; do { v57 = ie; - v58 = dword_50B9E0_ys[ie + 1]; + v58 = dword_50B9E4[ie]; v85 = v58 <= (signed int)v56; if ( thise ^ v85 ) { if ( v58 <= (signed int)v56 ) { - v70 = (signed int)(v56 - dword_50B9E0_ys[v57]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57]) / (v58 - dword_50B9E0_ys[v57]); - v59 = dword_50BAD0[v57]; + v70 = (signed int)(v56 - dword_50B9E4[v57 - 1]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD4[v57 - 1]) / (v58 - dword_50B9E4[v57 - 1]); + v59 = dword_50BAD4[v57 - 1]; } else { - v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57]) / (dword_50B9E0_ys[v57] - v58); + v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD4[v57 - 1] - dword_50BAD4[v57]) / (dword_50B9E4[v57 - 1] - v58); v59 = dword_50BAD4[v57]; } + dword_50BAC8[v55] = v70 + v59; + v56 = pBLVRenderParams->uViewportW; + dword_50B9D8_ys[v55] = pBLVRenderParams->uViewportW; ++v55; - dword_50BAC4[v55] = v70 + v59; - v56 = pBLVRenderParams->uViewportW; - unk_50B9D4[v55] = pBLVRenderParams->uViewportW; } if ( v85 ) { dword_50BAC8[v55] = dword_50BAD4[v57]; - dword_50B9D8_ys[v55++] = dword_50B9E0_ys[v57 + 1]; + dword_50B9D8_ys[v55++] = dword_50B9E4[v57]; } ++ie; thise = v85;
--- a/mm7_2.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_2.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -319,105 +319,127 @@ *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C == 7 ) - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v7 = v6; - if ( !v6 ) - { -LABEL_17: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return; - } - if ( v6 > pParty->uNumGold ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v7 = pParty->uNumGold; - } - if ( v7 ) - { - Party::TakeGold(v7); - pParty->uNumGoldInBank += v7; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - } - v0 = window_SpeakInHouse; -LABEL_16: - v0->field_40 = 0; - goto LABEL_17; - } -LABEL_15: - if ( v1 != 1 ) - return; - goto LABEL_16; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[60]; - } - else - { - if ( dword_F8B19C != 8 ) - return; - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - window_SpeakInHouse->field_40 = 0; - v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v3 = v2; - if ( v2 ) - { - if ( v2 > pParty->uNumGoldInBank ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v3 = pParty->uNumGoldInBank; - } - if ( v3 ) - { - Party::SetGold(pParty->uNumGold + v3); - pParty->uNumGoldInBank -= v3; - } - } - goto LABEL_17; - } - goto LABEL_15; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[244]; - } - sprintf(pTmpBuf, "%s\n%s", v10, v11); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v4 = pFontArrus; - v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); - return; - } - v8 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v8 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); - v9 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v9 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); + switch(dword_F8B19C) + { + case 1: + { + v8 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v8 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); + v9 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v9 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); + break; + } + case 7: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v7 = v6; + if ( !v6 ) + { +//LABEL_17: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return; + } + if ( v6 > pParty->uNumGold ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v7 = pParty->uNumGold; + } + if ( v7 ) + { + Party::TakeGold(v7); + pParty->uNumGoldInBank += v7; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + v0 = window_SpeakInHouse; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[60]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + break; + } + + case 8: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + window_SpeakInHouse->field_40 = 0; + v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v3 = v2; + if ( v2 ) + { + if ( v2 > pParty->uNumGoldInBank ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v3 = pParty->uNumGoldInBank; + } + if ( v3 ) + { + Party::SetGold(pParty->uNumGold + v3); + pParty->uNumGoldInBank -= v3; + } + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[244]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + return; + break; + } + + default: + { + break; + } + } } // F8B19C: using guessed type int dword_F8B19C; @@ -548,41 +570,57 @@ v7 = 1; v83 = 1; } - if ( dword_F8B19C > 101 ) - { - if ( dword_F8B19C == 102 ) - { - v65 = pFontArrus; - pOutString = pFontArrus; - strcpy(pTmpBuf, pNPCTopics[354].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - if ( 352 - v62 < 8 ) - { - pOutString = pFontCreate; - v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - } - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); - pRenderer->_4A6A68( - 8u, - 352 - v62, - pTex, - (pTex ? pTex->uTextureHeight : 26) - v62); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); - v64 = pOutString; - } - else - { - if ( dword_F8B19C != 103 ) - { - if ( dword_F8B19C != 104 || pArcomageGame->bGameInProgress == 1 ) + switch(dword_F8B19C) + { + case 102: + { + v65 = pFontArrus; + pOutString = pFontArrus; + strcpy(pTmpBuf, pNPCTopics[354].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + if ( 352 - v62 < 8 ) + { + pOutString = pFontCreate; + v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + } + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); + pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); + v64 = pOutString; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 103: + { + strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); + v62 = v61 + 7; + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); + pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); + v64 = pFontArrus; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 104: + { + if ( pArcomageGame->bGameInProgress == 1 ) return; v26 = pTmpBuf; if ( pArcomageGame->uGameResult ) @@ -597,42 +635,16 @@ v72 = pGlobalTXT_LocalizationStrings[639];// A tie! } strcpy(pTmpBuf, v72); -LABEL_97: +//LABEL_97: v71 = 3; v69 = v26; v67 = v84[0]; v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; - goto LABEL_98; - } - strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); - v62 = v61 + 7; - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); - pRenderer->_4A6A68( - 8u, - 352 - (v61 + 7), - pTex, - (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); - v64 = pFontArrus; - } - window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); - return; - } - if ( dword_F8B19C != 101 ) - { - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C == 15 ) - { + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + break; + } + case 15: + { if ( pParty->uNumGold >= (unsigned int)pOutString ) { Party::TakeGold((unsigned int)pOutString); @@ -655,96 +667,106 @@ ++pMessageQueue_50CBD0->uNumMessages; return; } - } - else - { - if ( dword_F8B19C != 16 ) - { - if ( dword_F8B19C != 96 || !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v8 = pDialogueWindow; - *(float *)&v89 = 0.0; - - //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - - pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); - if ( (signed int)pOutString < v9 / 3 ) - pOutString = (GUIFont *)(v9 / 3); - v10 = v8->pStartingPosActiveItem; - v11 = v10 + v8->pNumPresenceButton; - v86 = 0; - if ( (signed int)v10 < v11 ) - { - do - { - v12 = v8->GetControl(v10)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) - { - v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); - v89 += v13; - ++v86; - } - ++v10; - } - while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); - if ( v86 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); - v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - pOutString = (GUIFont *)((149 - v89) / v86); - if ( (149 - v89) / v86 > 32 ) - pOutString = (GUIFont *)32; - v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; - v89 = v8->pStartingPosActiveItem; - v83 = v14; - if ( v89 < v89 + v8->pNumPresenceButton ) - { - v86 = 2; - do - { - v15 = v8->GetControl(v89); - v16 = v15; - v17 = v15->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) - { - v16->uW = 0; - v16->uHeight = 0; - v16->uY = 0; - } - else - { - v18 = pSkillNames[v17]; - v16->uY = (unsigned int)((char *)pOutString + v83); - Str[1] = v18; - v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); - v20 = v16->uY; - v21 = v86; - v16->uHeight = v19; - v22 = v19 + v20 - 1; - v16->uW = v22; - v83 = v22; - v23 = v84[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) - v23 = v81; - v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); - } - v24 = v8->pNumPresenceButton; - ++v89; - v25 = v8->pStartingPosActiveItem + v24; - ++v86; - } - while ( v89 < v25 ); - } - return; - } - } - v26 = pTmpBuf; - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - goto LABEL_97; - } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 96: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v8 = pDialogueWindow; + *(float *)&v89 = 0.0; + + //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + + pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); + if ( (signed int)pOutString < v9 / 3 ) + pOutString = (GUIFont *)(v9 / 3); + v10 = v8->pStartingPosActiveItem; + v11 = v10 + v8->pNumPresenceButton; + v86 = 0; + if ( (signed int)v10 < v11 ) + { + do + { + v12 = v8->GetControl(v10)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) + { + v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); + v89 += v13; + ++v86; + } + ++v10; + } + while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); + if ( v86 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); + v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + pOutString = (GUIFont *)((149 - v89) / v86); + if ( (149 - v89) / v86 > 32 ) + pOutString = (GUIFont *)32; + v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; + v89 = v8->pStartingPosActiveItem; + v83 = v14; + if ( v89 < v89 + v8->pNumPresenceButton ) + { + v86 = 2; + do + { + v15 = v8->GetControl(v89); + v16 = v15; + v17 = v15->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) + { + v16->uW = 0; + v16->uHeight = 0; + v16->uY = 0; + } + else + { + v18 = pSkillNames[v17]; + v16->uY = (unsigned int)((char *)pOutString + v83); + Str[1] = v18; + v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); + v20 = v16->uY; + v21 = v86; + v16->uHeight = v19; + v22 = v19 + v20 - 1; + v16->uW = v22; + v83 = v22; + v23 = v84[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) + v23 = v81; + v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); + } + v24 = v8->pNumPresenceButton; + ++v89; + v25 = v8->pStartingPosActiveItem + v24; + ++v86; + } + while ( v89 < v25 ); + } + return; + } + } + v26 = pTmpBuf; + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v71 = 3; + v69 = v26; + v67 = v84[0]; + v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + break; + } + case 16: + { *(_QWORD *)Str = pParty->uNumFoodRations; //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) @@ -752,7 +774,8 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - goto LABEL_43; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + return; } if ( pParty->uNumGold >= v7 ) { @@ -761,172 +784,193 @@ pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); v5 = 1; -LABEL_43: +//LABEL_43: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); return; //goto LABEL_51; } - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); - goto LABEL_43; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v28 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v28 = v81; - sprintf(Dest, format_4E2DC8, v28); - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); - strcat(Dest, pTmpBuf2); - v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); - strcat(Dest, "\n \n"); - v29 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v29 = v81; - sprintf(a1, format_4E2DC8, v29); - sprintf(pTmpBuf2, - pGlobalTXT_LocalizationStrings[86], - //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], - (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, - v83); - strcat(a1, pTmpBuf2); - v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); - strcat(a1, "\n \n"); - v30 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) - v30 = v81; - sprintf(v77, format_4E2DC8, v30); - strcat(v77, pGlobalTXT_LocalizationStrings[160]); - v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); - strcat(v77, "\n \n"); - v75[0] = 0; - v87 = 0; - v31 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v31 >= 108 && v31 <= 120 ) - { - v32 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) - v32 = v81; - sprintf(v75, format_4E2DC8, v32); - strcat(v75, pGlobalTXT_LocalizationStrings[611]); - v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); - } - v33 = pDialogueWindow; - Str[1] = (char *)pDialogueWindow; - v34 = pDialogueWindow->pStartingPosActiveItem; - v35 = v34 + pDialogueWindow->pNumPresenceButton; - v36 = LOBYTE(pFontArrus->uFontHeight) - 3; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( !(v37 ^ __OFSUB__(v34, v35)) ) - { -LABEL_75: - sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); - v71 = 3; - v69 = pTmpBuf; - v67 = 0; - v66 = 146; -LABEL_98: - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - return; - } - while ( 1 ) - { - v38 = v33->GetControl((unsigned int)pOutString); - if ( v38->uControlParam == 15 ) - { - v46 = v90; - v38->uHeight = v90; - v38->uY = 146; - v41 = v46 + 145; - goto LABEL_73; - } - if ( v38->uControlParam == 16 ) - { - v44 = v88; - v45 = v90 + v36 + 146; - v38->uHeight = v88; - v38->uY = v45; - v41 = v45 + v44 - 1; - goto LABEL_73; - } - if ( v38->uControlParam == 96 ) - break; - if ( v38->uControlParam == 101 ) - { - v39 = v90 + 3 * v36 + v87 + v88 + 146; - v33 = (GUIWindow *)Str[1]; - v40 = v87; - v38->uHeight = v87; - v38->uY = v39; - v41 = v39 + v40 - 1; -LABEL_73: - v38->uW = v41; - } - v47 = v33->pStartingPosActiveItem; - pOutString = (GUIFont *)((char *)pOutString + 1); - if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) - goto LABEL_75; - } - v42 = v90 + v88 + 2 * v36 + 146; - v43 = v82; - v38->uY = v42; - v38->uHeight = v43; - v41 = v43 + v42 - 1; - goto LABEL_73; - } - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v48 = 2; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; - pOutString = 0; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; - if ( pParty->HasItem(0x28Bu) ) - { - pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; - v48 = 3; - } - for ( i = 0; i < v48; ++i ) - { - v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v50); - } - v86 = (174 - (signed int)pOutString) / v48; - v51 = pDialogueWindow; - v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; - v53 = v52 - HIDWORD(v52); - LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; - v54 = (v53 >> 1) - v86 / 2 + 138; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - v89 = pDialogueWindow->pStartingPosActiveItem; - if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) - { - v85 = (Player *)2; - pOutString = (GUIFont *)pShopOptions; - do - { - v55 = v51->GetControl(v89); - v56 = (const char **)pOutString; - v55->uY = v86 + v54; - v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); - v58 = v55->uY; - v59 = v85; - v55->uHeight = v57; - v54 = v57 + v58 - 1; - v55->uW = v54; - v60 = v84[0]; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) - v60 = v81; - v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); - v51 = pDialogueWindow; - v85 = (Player *)((char *)v85 + 1); - pOutString = (GUIFont *)((char *)pOutString + 4); - ++v89; - } - while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 1: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v28 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v28 = v81; + sprintf(Dest, format_4E2DC8, v28); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); + strcat(Dest, pTmpBuf2); + v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); + strcat(Dest, "\n \n"); + v29 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v29 = v81; + sprintf(a1, format_4E2DC8, v29); + sprintf(pTmpBuf2, + pGlobalTXT_LocalizationStrings[86], + //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], + (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, + v83); + strcat(a1, pTmpBuf2); + v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); + strcat(a1, "\n \n"); + v30 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) + v30 = v81; + sprintf(v77, format_4E2DC8, v30); + strcat(v77, pGlobalTXT_LocalizationStrings[160]); + v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); + strcat(v77, "\n \n"); + v75[0] = 0; + v87 = 0; + v31 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v31 >= 108 && v31 <= 120 ) + { + v32 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) + v32 = v81; + sprintf(v75, format_4E2DC8, v32); + strcat(v75, pGlobalTXT_LocalizationStrings[611]); + v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); + } + v33 = pDialogueWindow; + Str[1] = (char *)pDialogueWindow; + v34 = pDialogueWindow->pStartingPosActiveItem; + v35 = v34 + pDialogueWindow->pNumPresenceButton; + v36 = LOBYTE(pFontArrus->uFontHeight) - 3; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; + if ( !(v37 ^ __OFSUB__(v34, v35)) ) + { + //LABEL_75: + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + //LABEL_98: + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + while ( 1 ) + { + v38 = v33->GetControl((unsigned int)pOutString); + if ( v38->uControlParam == 15 ) + { + v46 = v90; + v38->uHeight = v90; + v38->uY = 146; + v41 = v46 + 145; + v38->uW = v41; + } + else if ( v38->uControlParam == 16 ) + { + v44 = v88; + v45 = v90 + v36 + 146; + v38->uHeight = v88; + v38->uY = v45; + v41 = v45 + v44 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 96 ) + { + v42 = v90 + v88 + 2 * v36 + 146; + v43 = v82; + v38->uY = v42; + v38->uHeight = v43; + v41 = v43 + v42 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 101 ) + { + v39 = v90 + 3 * v36 + v87 + v88 + 146; + v33 = (GUIWindow *)Str[1]; + v40 = v87; + v38->uHeight = v87; + v38->uY = v39; + v41 = v39 + v40 - 1; + //LABEL_73: + v38->uW = v41; + } + v47 = v33->pStartingPosActiveItem; + pOutString = (GUIFont *)((char *)pOutString + 1); + if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) + { + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + } + break; + } + case 101: + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v48 = 2; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; + pOutString = 0; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; + if ( pParty->HasItem(0x28Bu) ) + { + pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; + v48 = 3; + } + for ( i = 0; i < v48; ++i ) + { + v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); + pOutString = (GUIFont *)((char *)pOutString + v50); + } + v86 = (174 - (signed int)pOutString) / v48; + v51 = pDialogueWindow; + v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; + v53 = v52 - HIDWORD(v52); + LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; + HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; + v54 = (v53 >> 1) - v86 / 2 + 138; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + v89 = pDialogueWindow->pStartingPosActiveItem; + if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) + { + v85 = (Player *)2; + pOutString = (GUIFont *)pShopOptions; + do + { + v55 = v51->GetControl(v89); + v56 = (const char **)pOutString; + v55->uY = v86 + v54; + v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); + v58 = v55->uY; + v59 = v85; + v55->uHeight = v57; + v54 = v57 + v58 - 1; + v55->uW = v54; + v60 = v84[0]; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) + v60 = v81; + v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); + v51 = pDialogueWindow; + v85 = (Player *)((char *)v85 + 1); + pOutString = (GUIFont *)((char *)pOutString + 4); + ++v89; + } + while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + } + break; + } + default: + { + break; + } } } @@ -1054,65 +1098,62 @@ v101.uFrameZ = 334; v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dword_F8B19C > 5 ) - { - if ( dword_F8B19C == 94 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; - v65 = 0; - v66 = pShopOptions; - do - { - v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); - ++v66; - v65 += v67; - } - while ( (signed int)v66 < (signed int)&pShopOptions[3] ); - v68 = pDialogueWindow; - v109 = (const char **)((174 - v65) / 3); - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v106.y = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, (int)v69) ) - { - _this = (Player *)2; - v108 = (int)pShopOptions; - do - { - v71 = v68->GetControl(v106.y); - v72 = (const char **)v108; - v71->uY = (unsigned int)((char *)v109 + v70); - v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); - v74 = v71->uY; - v75 = _this; - v71->uHeight = v73; - v70 = v73 + v74 - 1; - v71->uW = v70; - v76 = v104; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) - v76 = v105; - v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); - v68 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - v108 += 4; - ++v106.y; - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( v106.y < (signed int)result ); - } - return result; - } - if ( dword_F8B19C != 95 ) - { - result = (char *)(dword_F8B19C - 96); - if ( dword_F8B19C == 96 ) - { + switch(dword_F8B19C) + { + case 94: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; + v65 = 0; + v66 = pShopOptions; + do + { + v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); + ++v66; + v65 += v67; + } + while ( (signed int)v66 < (signed int)&pShopOptions[3] ); + v68 = pDialogueWindow; + v109 = (const char **)((174 - v65) / 3); + result = (char *)pDialogueWindow->pStartingPosActiveItem; + v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; + v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + v106.y = pDialogueWindow->pStartingPosActiveItem; + if ( v20 ^ __OFSUB__((int)result, (int)v69) ) + { + _this = (Player *)2; + v108 = (int)pShopOptions; + do + { + v71 = v68->GetControl(v106.y); + v72 = (const char **)v108; + v71->uY = (unsigned int)((char *)v109 + v70); + v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); + v74 = v71->uY; + v75 = _this; + v71->uHeight = v73; + v70 = v73 + v74 - 1; + v71->uW = v70; + v76 = v104; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) + v76 = v105; + v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); + v68 = pDialogueWindow; + _this = (Player *)((char *)_this + 1); + v108 += 4; + ++v106.y; + result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + } + while ( v106.y < (signed int)result ); + } + break; + } + case 96: + { result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { @@ -1129,7 +1170,20 @@ v34 = v33 + v30->pNumPresenceButton; v109 = 0; if ( (signed int)v33 >= v34 ) - goto LABEL_105; + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v7 = pTmpBuf; + v86 = 3; + v84 = pTmpBuf; + v82 = v104; + v80 = 0; + v78 = 0; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } do { v35 = v30->GetControl(v33)->uControlParam - 36; @@ -1144,7 +1198,7 @@ while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); if ( !v109 ) { -LABEL_105: +//LABEL_105: sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); @@ -1155,7 +1209,8 @@ v80 = 0; v78 = 0; v77 = &v101; - goto LABEL_15; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); } sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); @@ -1205,115 +1260,232 @@ while ( v106.y < (signed int)result ); } } - } - return result; - } - } - else - { - if ( dword_F8B19C == 5 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v27 = pMouse->GetCursorPos(&v99)->x - 14; - v106.x = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v97)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v95); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v93); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - result = (char *)(9 * (int)result); - if ( _this->field_1F5[4 * (int)result + 15] & 2 ) - { - v85 = 0; - v83 = 5; - v81 = window_SpeakInHouse->ptr_1C; - v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5]; - v28 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v29 = _this->_490EEE( - (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5], - 1, - v28, - 5); - v6 = v110; - v5 = (char *)pMerchantsRepairPhrases[v29]; - goto LABEL_14; - } - } - } - } - } - return result; - } - if ( dword_F8B19C == 1 ) - { - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v103 = (174 - v14) / 4; - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, v18) ) - { - v108 = 2; - v109 = (const char **)pShopOptions; - do - { - v21 = v17->GetControl((unsigned int)_this); - v22 = v109; - v21->uY = v103 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); - v24 = v21->uY; - v25 = v108; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = v104; - if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = v105; - v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); - v17 = pDialogueWindow; - ++v108; - ++v109; - _this = (Player *)((char *)_this + 1); - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)_this < (signed int)result ); - } - } - return result; - } - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C == 3 ) - { + break; + } + case 95: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v109 = 0; + v108 = 0; + do + { + // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) + { + v52 = word_F8B158[(signed int)v109] + 30; + v53 = ItemsInShopTexture[(signed int)v109]; + v54 = 60 - ((signed int)v53->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); + sub_40F92A( + &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], + ItemsInShopTexture[(signed int)v109], + (int)((char *)v109 + 1)); + } + v109 = (const char **)((char *)v109 + 1); + v108 += 70; + } + while ( (signed int)v109 < 6 ); + result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v55 = 0; + v106.x = 0; + do + { + // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) + ++v106.x; + ++v55; + } + while ( v55 < 6 ); + v56 = GetAsyncKeyState(17); + v57 = _this->CanSteal(); + Str = (char *)v57; + if ( v56 && v57 ) + { + v58 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v58 = pGlobalTXT_LocalizationStrings[195]; + if ( dword_F8B19C != 2 ) + v58 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v58, 0); + if ( v106.x ) + { + v59 = pMouse->GetCursorPos(&v91); + result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v106.x = v60; + v61 = (int)window_SpeakInHouse->ptr_1C; + // v62 = 9 * (v60 + 12 * v61); + v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; + if ( dword_F8B19C != 2 ) + v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + if ( !v56 || !Str ) + { + v85 = 0; + v83 = 2; + v81 = window_SpeakInHouse->ptr_1C; + v79 = v63; + v110 = uActiveCharacter - 1; + v64 = _this->_490EEE(v63, 1, v61, 2); + v6 = v110; + v5 = (char *)pMerchantsBuyPhrases[v64]; + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + v5 = pGlobalTXT_LocalizationStrings[181]; + v85 = 0; + v83 = 2; + v81 = window_SpeakInHouse->ptr_1C; + v79 = v63; + v6 = uActiveCharacter - 1; + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + } + else + { + v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + result =0; //added + } + } + break; + } + case 2: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v48 = 0; + v108 = 0; + v109 = 0; + do + { + // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); + { + v49 = word_F8B158[(signed int)v48]; + v50 = ItemsInShopTexture[(signed int)v48]; + v49 += 30; + v51 = 60 - ((signed int)v50->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); + sub_40F92A( + &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], + ItemsInShopTexture[(signed int)v109], + (int)((char *)v109 + 1)); + v48 = v109; + } + v108 += 70; + v48 = (const char **)((char *)v48 + 1); + v109 = v48; + } + while ( (signed int)v48 < 6 ); + result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v55 = 0; + v106.x = 0; + v106.x = 0; + do + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + ++v106.x; + ++v55; + } + while ( v55 < 6 ); + v56 = GetAsyncKeyState(17); + v57 = _this->CanSteal(); + Str = (char *)v57; + if ( v56 && v57 ) + { + v58 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v58 = pGlobalTXT_LocalizationStrings[195]; + if ( dword_F8B19C != 2 ) + v58 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v58, 0); + if ( v106.x ) + { + v59 = pMouse->GetCursorPos(&v91); + result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v106.x = v60; + v61 = (int)window_SpeakInHouse->ptr_1C; + // v62 = 9 * (v60 + 12 * v61); + v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; + if ( dword_F8B19C != 2 ) + v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + if ( !v56 || !Str ) + { + v85 = 0; + v83 = 2; + v81 = window_SpeakInHouse->ptr_1C; + v79 = v63; + v110 = uActiveCharacter - 1; + v64 = _this->_490EEE(v63, 1, v61, 2); + v6 = v110; + v5 = (char *)pMerchantsBuyPhrases[v64]; + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + v5 = pGlobalTXT_LocalizationStrings[181]; + v85 = 0; + v83 = 2; + v81 = window_SpeakInHouse->ptr_1C; + v79 = v63; + v6 = uActiveCharacter - 1; + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + } + else + { + v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + result =0; //added + } + } + break; + } + case 3: + { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); @@ -1341,205 +1513,148 @@ v13 = _this->_490EEE(v79, 1, v12, 3); v6 = v110; v5 = (char *)pMerchantsSellPhrases[v13]; - goto LABEL_14; - } - } - } - } - } - else - { - result = (char *)(dword_F8B19C - 4); - if ( dword_F8B19C == 4 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v100); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v92); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - v85 = 0; - v83 = 4; - v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v4->Identified()) - { - v81 = window_SpeakInHouse->ptr_1C; - v79 = v4; - v9 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v10 = _this->_490EEE(v4, 1, v9, 4); - v6 = v110; - v5 = (char *)pMerchantsIdentifyPhrases[v10]; - goto LABEL_14; - } - v81 = window_SpeakInHouse->ptr_1C; - v5 = "%24"; - v79 = v4; -LABEL_13: - v6 = uActiveCharacter - 1; -LABEL_14: - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; -LABEL_15: - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); } } } } - } - return result; - } - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - if ( dword_F8B19C == 2 ) - { - v48 = 0; - v108 = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); - { - v49 = word_F8B158[(signed int)v48]; - v50 = ItemsInShopTexture[(signed int)v48]; - v49 += 30; - v51 = 60 - ((signed int)v50->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); - sub_40F92A( - &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - v48 = v109; - } - v108 += 70; - v48 = (const char **)((char *)v48 + 1); - v109 = v48; - } - while ( (signed int)v48 < 6 ); - } - else - { - v109 = 0; - v108 = 0; - do - { - // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) - { - v52 = word_F8B158[(signed int)v109] + 30; - v53 = ItemsInShopTexture[(signed int)v109]; - v54 = 60 - ((signed int)v53->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); - sub_40F92A( - &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - } - v109 = (const char **)((char *)v109 + 1); - v108 += 70; - } - while ( (signed int)v109 < 6 ); - } - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v55 = 0; - v106.x = 0; - if ( dword_F8B19C == 2 ) - { - v106.x = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - } - else - { - do - { - // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - } - v56 = GetAsyncKeyState(17); - v57 = _this->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dword_F8B19C != 2 ) - v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v110 = uActiveCharacter - 1; - v64 = _this->_490EEE(v63, 1, v61, 2); - v6 = v110; - v5 = (char *)pMerchantsBuyPhrases[v64]; - goto LABEL_14; - } - v5 = pGlobalTXT_LocalizationStrings[181]; - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - goto LABEL_13; - } - } - else - { - v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - result =0; //added - } + break; + } + case 4: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); + result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v2 = pMouse->GetCursorPos(&a2)->x - 14; + v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); + result = (char *)pMouse->GetCursorPos(&v100); + if ( *(int *)result > 13 ) + { + result = (char *)pMouse->GetCursorPos(&v92); + if ( *(int *)result < 462 ) + { + result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); + v3 = 0; + if ( result ) + { + v85 = 0; + v83 = 4; + v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; + if (!v4->Identified()) + { + v81 = window_SpeakInHouse->ptr_1C; + v79 = v4; + v9 = (int)window_SpeakInHouse->ptr_1C; + v110 = uActiveCharacter - 1; + v10 = _this->_490EEE(v4, 1, v9, 4); + v6 = v110; + v5 = (char *)pMerchantsIdentifyPhrases[v10]; + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + v81 = window_SpeakInHouse->ptr_1C; + v5 = "%24"; + v79 = v4; + //LABEL_13: + v6 = uActiveCharacter - 1; + //LABEL_14: + v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); + v86 = 3; + v84 = v7; + v82 = v105; + v80 = v3; + v78 = v3; + v77 = &v101; + //LABEL_15: + v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); + return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); + } + } + } + } + break; + } + case 1: + { + result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + v14 = 0; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + v15 = pShopOptions; + do + { + v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); + ++v15; + v14 += v16; + } + while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); + v17 = pDialogueWindow; + v103 = (174 - v14) / 4; + result = (char *)pDialogueWindow->pStartingPosActiveItem; + v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; + v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + _this = (Player *)pDialogueWindow->pStartingPosActiveItem; + if ( v20 ^ __OFSUB__((int)result, v18) ) + { + v108 = 2; + v109 = (const char **)pShopOptions; + do + { + v21 = v17->GetControl((unsigned int)_this); + v22 = v109; + v21->uY = v103 + v19; + v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); + v24 = v21->uY; + v25 = v108; + v21->uHeight = v23; + v19 = v24 + v23 - 1; + v21->uW = v19; + v26 = v104; + if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) + v26 = v105; + v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); + v17 = pDialogueWindow; + ++v108; + ++v109; + _this = (Player *)((char *)_this + 1); + result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + } + while ( (signed int)_this < (signed int)result ); + } + } + break; + } + default: + { + if( dword_F8B19C > 5 ) + result = (char *)(dword_F8B19C - 96); + else + result = (char *)(dword_F8B19C - 4); + break; + } } return result; } @@ -11501,10 +11616,6 @@ pIcons_LOD->_4114F2(); } -int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) - { - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } //----- (004637EB) -------------------------------------------------------- @@ -13053,9 +13164,9 @@ pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) - pGame->uFlags2 |= 0x20u; + pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; else - pGame->uFlags2 &= 0xFFFFFFDFu; + pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0); @@ -13289,7 +13400,7 @@ assert(sizeof(stru176) == 0x20); assert(sizeof(SavegameHeader) == 0x64); assert(sizeof(SavegameList) == 0x3138); - assert(sizeof(StorylineText) == 0x168); + assert(sizeof(StorylineText) == 0x160); assert(sizeof(FactionTable) == 0x1EF1); assert(sizeof(Decal) == 0xC20); assert(sizeof(DecalBuilder) == 0x30C038); @@ -13305,7 +13416,7 @@ assert(sizeof(GUIProgressBar) == 0x1B8); assert(sizeof(GUIFont) == 0x1020); assert(sizeof(stru262_TurnBased) == 0x40); - //assert(sizeof(ArcomageGame) == 0xFA); + assert(sizeof(ArcomageGame) == 0xFB); assert(sizeof(stru277) == 0x14); assert(sizeof(ArcomageCard) == 0x6C); assert(sizeof(stru320) == 0x3FC); @@ -14545,16 +14656,13 @@ { if ( v2 ) { -LABEL_7: LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) { -LABEL_8: v0->PlaySound(SPEECH_39, 0); return; } v3 = pParty->pPickedItem.uItemID; - goto LABEL_16; } } else @@ -14562,11 +14670,21 @@ if ( (v4 == 8 || v4 == 1 || v4 == 2) && v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 ) - goto LABEL_7; - } -LABEL_16: + { + LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); + if ( (signed int)SkillToMastery(v5) < 3 ) + { + v0->PlaySound(SPEECH_39, 0); + return; + } + } + } if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) - goto LABEL_8; + { + + v0->PlaySound(SPEECH_39, 0); + return; + } if ( pParty->pPickedItem.uItemID == 604 ) { sub_467E7F_EquipBody(3u); @@ -14585,16 +14703,39 @@ case 9u: case 0xBu: if ( !v0->HasSkill(v4) ) - goto LABEL_8; + { + v0->PlaySound(SPEECH_39, 0); + return; + } if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) - goto LABEL_95; + { + v46 = 0; + v45 = 0; + v44 = 0; + v43 = 0; + v42 = -1; + v41 = 0; + v40 = 0; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; + } sub_467E7F_EquipBody(v6); if ( pParty->pPickedItem.uItemID == 604 ) WetsuitOff(uActiveCharacter); return; case 0xAu: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - goto LABEL_95; + { + v46 = 0; + v45 = 0; + v44 = 0; + v43 = 0; + v42 = -1; + v41 = 0; + v40 = 0; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; + } v52 = 10; v7 = (int)&v0->pEquipment.field_28; while ( 1 ) @@ -14603,19 +14744,20 @@ { v8 = v0->FindFreeInventorySlot(); if ( (v8 & 0x80000000u) == 0 ) + { + v9 = v52; + pParty->pPickedItem.uBodyAnchor = v52 + 1; + memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8])); + *(&v0->pEquipment.uOffHand + v9) = v8 + 1; + pMouse->RemoveHoldingItem(); break; + } } ++v52; v7 += 4; if ( (signed int)v52 > 15 ) - goto LABEL_33; - } - v9 = v52; - pParty->pPickedItem.uBodyAnchor = v52 + 1; - memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8])); - *(&v0->pEquipment.uOffHand + v9) = v8 + 1; - pMouse->RemoveHoldingItem(); -LABEL_33: + break; + } if ( v52 == 16 ) { v52 = v0->pEquipment.field_3C - 1; @@ -14632,9 +14774,22 @@ return; case 4u: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - goto LABEL_95; + { + v46 = 0; + v45 = 0; + v44 = 0; + v43 = 0; + v42 = -1; + v41 = 0; + v40 = 0; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; + } if ( !v0->HasSkill(v4) ) - goto LABEL_8; + { + v0->PlaySound(SPEECH_39, 0); + return; + } if ( v54 ) { --v54; @@ -14662,7 +14817,8 @@ v17 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); v0->pEquipment.uOffHand = v17; - goto LABEL_45; + pMouse->RemoveHoldingItem(); + return; } memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); v15 = (int)((char *)v0 + 36 * (v53 - 1)); @@ -14681,9 +14837,22 @@ if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && pParty->pPickedItem.uItemID != 64 && pParty->pPickedItem.uItemID != 65 ) - goto LABEL_95; + { + v46 = 0; + v45 = 0; + v44 = 0; + v43 = 0; + v42 = -1; + v41 = 0; + v40 = 0; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; + } if ( !v0->HasSkill(v4) ) - goto LABEL_8; + { + v0->PlaySound(SPEECH_39, 0); + return; + } v50 = 0; if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) @@ -14719,9 +14888,12 @@ if ( !v14 ) return; v22 = _this.uItemID; -LABEL_73: v50 = v22; - goto LABEL_74; + if ( v50 ) + stru_A750F8[uActiveCharacter - 1]._494836( + *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), + uActiveCharacter - 1 + 9); + break; } v23 = v0->FindFreeInventorySlot(); if ( (v23 & 0x80000000u) != 0 ) @@ -14730,12 +14902,16 @@ v50 = (unsigned int)&v0->pInventoryItems[v23]; memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23])); v0->pEquipment.uOffHand = v23 + 1; -LABEL_71: pMouse->RemoveHoldingItem(); if ( v52 != 12 ) return; v22 = *(int *)v50; - goto LABEL_73; + v50 = v22; + if ( v50 ) + stru_A750F8[uActiveCharacter - 1]._494836( + *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), + uActiveCharacter - 1 + 9); + break; } } } @@ -14748,7 +14924,16 @@ v50 = (unsigned int)&v0->pInventoryItems[v26]; memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26])); v0->pEquipment.uMainHand = v26 + 1; - goto LABEL_71; + pMouse->RemoveHoldingItem(); + if ( v52 != 12 ) + return; + v22 = *(int *)v50; + v50 = v22; + if ( v50 ) + stru_A750F8[uActiveCharacter - 1]._494836( + *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), + uActiveCharacter - 1 + 9); + break; } --v53; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); @@ -14765,7 +14950,6 @@ v50 = _this.uItemID; if ( v51 ) v0->pEquipment.uOffHand = 0; -LABEL_74: if ( v50 ) stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), @@ -14773,9 +14957,22 @@ break; case 1u: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - goto LABEL_95; + { + v46 = 0; + v45 = 0; + v44 = 0; + v43 = 0; + v42 = -1; + v41 = 0; + v40 = 0; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; + } if ( !v0->HasSkill(v4) ) - goto LABEL_8; + { + v0->PlaySound(SPEECH_39, 0); + return; + } if ( v53 ) { if ( v54 ) @@ -14787,7 +14984,8 @@ v42 = -1; v41 = 0; v40 = 0; - goto LABEL_96; + pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); + return; } --v53; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); @@ -14824,7 +15022,6 @@ v31 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); v0->pEquipment.uMainHand = v31; -LABEL_45: pMouse->RemoveHoldingItem(); } } @@ -14861,7 +15058,6 @@ { if ( bUnderwater ) { -LABEL_95: v46 = 0; v45 = 0; v44 = 0; @@ -14869,7 +15065,6 @@ v42 = -1; v41 = 0; v40 = 0; -LABEL_96: pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); return; } @@ -14994,71 +15189,75 @@ } v22 = 0; v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1); - if ( (signed int)viewparams->uScreenY >= (signed int)viewparams->uScreenW ) - goto LABEL_21; - v2 = (char *)v1 - 50; - v1 = (int *)((char *)v1 + 50); - v3 = 640 * viewparams->uScreenY; - v17 = v2; - v20 = v1; - v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; - do - { - if ( (signed int)v2 >= (signed int)v20 ) - goto LABEL_20; - v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; - v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; - v4 = v22; - v5 = (((char *)v20 - v2 - 1) >> 1) + 1; - do - { - v6 = 0; - v7 = *v1 & 0xFFFF; - v19 = 0; - if ( v4 > 0 ) - { - do - { - if ( dword_7207F0[v6] == v7 ) - break; - ++v6; - v19 = v6; - } - while ( v6 < v22 ); - } - if ( (v7 & 7) == OBJECT_Decoration) - { - v16 = (unsigned int)v7 >> 3; - if ( (signed int)(((unsigned int)*v21 >> 16) - - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) > 512 ) - goto LABEL_18; - } - else - { - if ( (unsigned int)*v21 > 0x2000000 ) - goto LABEL_18; - } - if ( v19 == v22 && v4 < 100 ) - { - ++v22; - ++v4; - v8 = *v21; - dword_7207EC[v4] = v7; - dword_72065C[v4] = v8; - } -LABEL_18: - v1 = v21 + 2; - --v5; - v21 += 2; - } - while ( v5 ); - v2 = v17; -LABEL_20: - v3 += 1280; - --v18; - } - while ( v18 ); -LABEL_21: + if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW ) + { + v2 = (char *)v1 - 50; + v1 = (int *)((char *)v1 + 50); + v3 = 640 * viewparams->uScreenY; + v17 = v2; + v20 = v1; + v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; + do + { + if ( (signed int)v2 < (signed int)v20 ) + { + v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; + v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; + v4 = v22; + v5 = (((char *)v20 - v2 - 1) >> 1) + 1; + do + { + v6 = 0; + v7 = *v1 & 0xFFFF; + v19 = 0; + if ( v4 > 0 ) + { + do + { + if ( dword_7207F0[v6] == v7 ) + break; + ++v6; + v19 = v6; + } + while ( v6 < v22 ); + } + if ( (v7 & 7) == OBJECT_Decoration) + { + v16 = (unsigned int)v7 >> 3; + if ( (signed int)(((unsigned int)*v21 >> 16) + - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 ) + if ( v19 == v22 && v4 < 100 ) + { + ++v22; + ++v4; + v8 = *v21; + dword_7207EC[v4] = v7; + dword_72065C[v4] = v8; + } + } + else if ( (unsigned int)*v21 <= 0x2000000 ) + { + if ( v19 == v22 && v4 < 100 ) + { + ++v22; + ++v4; + v8 = *v21; + dword_7207EC[v4] = v7; + dword_72065C[v4] = v8; + } + } + v1 = v21 + 2; + --v5; + v21 += 2; + } + while ( v5 ); + v2 = v17; + } + v3 += 1280; + --v18; + } + while ( v18 ); + } if ( v22 > 0 ) { v9 = dword_720660; @@ -15233,7 +15432,6 @@ || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10) || (v6 = v7->sCogTriggeredID) == 0 ) return 1; -LABEL_13: EventProcessor((signed __int16)v6, v2, 1); return 0; } @@ -15247,7 +15445,10 @@ if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) return 1; if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) - goto LABEL_13; + { + EventProcessor((signed __int16)v6, v2, 1); + return 0; + } break; } return 0; @@ -15753,7 +15954,7 @@ { strcpy(pOutdoor->pLevelFilename, pCurrentMapName); v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, (char *)&pOut, 32); - if ( !bUnderwater && (pParty->uFlags & 0x8C || BYTE1(pParty->uFlags) & 2 || pParty->bFlying) || !v0 ) + if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) { if ( pParty->vPosition.x < -22528 ) pParty->vPosition.x = -22528;
--- a/mm7_3.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_3.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -125,7 +125,7 @@ { v9 = &pIndoor->pSectors[v33[result]]; v10 = 0; - v32 = v9->uNumFloors + v9->field_C + v9->field_14; + v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings; v26 = 0; if ( v32 > 0 ) break; @@ -1526,7 +1526,6 @@ int v7; // [sp+10h] [bp-8h]@1 signed int v8; // [sp+14h] [bp-4h]@1 - __debugbreak(); v5 = x - 2; v7 = x; v8 = y; @@ -1650,10 +1649,10 @@ v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); if ( pParty->bFlying ) { - pParty->bFlying = 0; - __debugbreak(); + pParty->bFlying = false; if (pParty->FlyActive()) - stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing] + pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; + //stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing] } if ( v80 == -30000 ) { @@ -1703,9 +1702,9 @@ LABEL_20: if ( v6 - party_z > 512 && !bFeatherFall && party_z <= v80 + 1 ) { - if ( BYTE1(pParty->uFlags) & 1 ) - { - BYTE1(pParty->uFlags) &= 0xFEu; + if (pParty->uFlags & PARTY_FLAGS_1_LANDING) + { + pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; } else for (uint i = 0; i < 4; ++i) { // receive falling damage @@ -1928,7 +1927,7 @@ v89 -= pEventTimer->uTimeElapsed * GetGravityStrength(); goto LABEL_92; } - if ( BYTE1(pParty->uFlags) & 1 ) + if (pParty->uFlags & PARTY_FLAGS_1_LANDING) goto LABEL_92; v89 = 0; } @@ -2182,16 +2181,16 @@ } } if ( !bJumping || bFeatherFall ) - pParty->uFlags &= 0xFFFFFFF7u; - else - pParty->uFlags |= 8u; - BYTE1(pParty->uFlags) &= 0xFDu; + pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; + else + pParty->uFlags |= PARTY_FLAGS_1_FALLING; + pParty->uFlags &= ~0x200; pParty->vPosition.x = new_party_x; pParty->vPosition.z = new_party_z; pParty->vPosition.y = new_party_y; pParty->uFallSpeed = v89; if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) - BYTE1(pParty->uFlags) |= 2u; + pParty->uFlags |= 0x200; if (uFaceEvent) EventProcessor(uFaceEvent, 0, 1); } @@ -2371,7 +2370,7 @@ } // bFeatherFall = 1; //LABEL_9: - LOBYTE(pParty->uFlags) &= 0x7Fu; + pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; if (pParty->WaterWalkActive()) { //LOBYTE(pParty->uFlags) &= 0x7Fu; @@ -2477,7 +2476,7 @@ pParty->bFlying = false; if (bUnderwater || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || - pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana <= 0 ) + pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) { if ( pParty->vPosition.z < 4000 || bJumping ) { @@ -2498,7 +2497,7 @@ pParty->field_6E0 = 0; pParty->field_6E4 = 0; pPartyActionQueue->uNumActions = 0; - BYTE1(pParty->uFlags) |= 1u; + pParty->uFlags |= PARTY_FLAGS_1_LANDING; pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; pParty->field_6F0 = v123; pParty->bFlying = 0; @@ -2518,7 +2517,7 @@ pParty->bFlying = 0; if ( bUnderwater || pParty->pPartyBuffs[7].uFlags & 1 - || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) + || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) { v123 -= 30; v113 -= 30; @@ -3148,9 +3147,9 @@ } } if ( !bJumping || v101 ) - pParty->uFlags &= 0xFFFFFFF7u; - else - pParty->uFlags |= 8u; + pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; + else + pParty->uFlags |= PARTY_FLAGS_1_FALLING; v126 = WorldPosToGridCellX(pParty->vPosition.x); v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; v114 = WorldPosToGridCellX(v116); @@ -3193,9 +3192,9 @@ pParty->vPosition.z = v105; if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater ) { - if ( pParty->uFlags & 0x100 ) - { - BYTE1(pParty->uFlags) &= 0xFEu; + if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) + { + pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; } else { @@ -3226,7 +3225,7 @@ pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; } } - LOWORD(pParty->uFlags) &= 0xFDFBu; + pParty->uFlags &= ~0x204; } return; } @@ -3261,15 +3260,17 @@ LABEL_313: if ( bWaterWalk ) { - LOBYTE(pParty->uFlags) &= 0x7Fu; - v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178; - *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; + pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; + //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178; + //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; + v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119]; + *(short *)v79 |= 1u; if ( !v122 || !v69 ) { if ( !v76 ) { v80 = *(short *)v79; - LOBYTE(pParty->uFlags) |= 0x80u; + pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER; *(short *)v79 = v80 & 0xFFFE; } } @@ -3313,9 +3314,9 @@ pParty->vPosition.z = v105; if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater ) { - if ( pParty->uFlags & 0x100 ) - { - BYTE1(pParty->uFlags) &= 0xFEu; + if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) + { + pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; } else { @@ -6165,47 +6166,38 @@ array_50AC10[3].vWorldViewProjX = pViewport->uViewportZ; array_50AC10[3].vWorldViewProjY = v38; - v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; + /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); for (int i = 0; i < _this.uNumVertices; ++i) { - v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); - v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; - v8 = v39 + _this.ptr_38->field_C; - - v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536; - v36 = v39 + _this.ptr_38->field_18; - - v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536; - v10 = _this.v_18.x + v9; - v39 = _this.v_18.x + v9; - if ( _this.v_18.x + v9 > 0 ) - { - v10 = 0; - v39 = 0; - } - v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; - v38 = v10; - v12 = array_50AC10[i].vWorldViewProjY - 1.0; - v13 = v33 * (pViewport->uScreenCenterX - v11); - v34 = -_this.field_24; - v32 = (signed __int64)v12; - v14 = v33 * (v30 - v32); - while ( 1 ) - { - v40 = v14; - if ( !v10 ) - goto LABEL_12; - v37 = abs(v34 >> 14); - v15 = abs(v10); - if ( v37 <= v15 || v32 <= pViewport->uViewportY ) - { - if ( v39 <= 0 ) - break; - } - v14 = v40; -LABEL_12: + v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); + v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; + v8 = v39 + _this.ptr_38->field_C; + + v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536; + v36 = v39 + _this.ptr_38->field_18; + + v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536; + v10 = _this.v_18.x + v9; + v39 = _this.v_18.x + v9; + if ( _this.v_18.x + v9 > 0 ) + { + v10 = 0; + v39 = 0; + } + v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; + v38 = v10; + v12 = array_50AC10[i].vWorldViewProjY - 1.0; + v13 = v33 * (pViewport->uScreenCenterX - v11); + v34 = -_this.field_24; + v32 = (signed __int64)v12; + v14 = v33 * (v30 - v32); + while ( 1 ) + { + //v40 = v14; + if ( !v10 ) + { v37 = _this.v_18.z; v16 = (unsigned __int64)(_this.v_18.z * (signed __int64)v14) >> 16; --v32; @@ -6215,46 +6207,66 @@ v38 = _this.v_18.x + v16; break; } - LODWORD(v17) = v34 << 16; - HIDWORD(v17) = v34 >> 16; - v18 = v17 / v38; - if ( v18 < 0 ) - v18 = pOutdoorCamera->shading_dist_mist; - - v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); - v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); - v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8; - v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8; - - array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[i]._rhw = 1.0 / (double)(v17 / 65536); - array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); - array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); - } - - float t = (GetTickCount() % 96000) / 96000.0f; - - array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[0]._rhw = 1; - array_50AC10[0].u = 0; - array_50AC10[0].v = 0 + t; - - array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[1]._rhw = 1; - array_50AC10[1].u = 0; - array_50AC10[1].v = 1 + t; - - array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[2]._rhw = 1; - array_50AC10[2].u = 1; - array_50AC10[2].v = 0 + t; - - array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[3]._rhw = 1; - array_50AC10[3].u = 1; - array_50AC10[3].v = 1 + t; - pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); - return; + v37 = abs(v34 >> 14); + v15 = abs(v10); + if ( v37 <= v15 || v32 <= pViewport->uViewportY ) + { + if ( v39 <= 0 ) + break; + } + //v14 = v40; + v37 = _this.v_18.z; + v16 = (unsigned __int64)(_this.v_18.z * v14) >> 16; + --v32; + v14 += v33; + v10 = _this.v_18.x + v16; + v39 = _this.v_18.x + v16; + v38 = _this.v_18.x + v16; + break; + } + LODWORD(v17) = v34 << 16; + HIDWORD(v17) = v34 >> 16; + v18 = v17 / v38; + if ( v18 < 0 ) + v18 = pOutdoorCamera->shading_dist_mist; + + v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); + v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); + v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8; + v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8; + */ + //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + //array_50AC10[i]._rhw = 1; + //array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); + //array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth); + //} + if ( _this.uNumVertices > 0) + { + float t = (GetTickCount() % 96000) / 96000.0f; + + array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + array_50AC10[0]._rhw = 1; + array_50AC10[0].u = 0; + array_50AC10[0].v = 0 + t; + + array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + array_50AC10[1]._rhw = 1; + array_50AC10[1].u = 0; + array_50AC10[1].v = 1 + t; + + array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + array_50AC10[2]._rhw = 1; + array_50AC10[2].u = 1; + array_50AC10[2].v = 0 + t; + + array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; + array_50AC10[3]._rhw = 1; + array_50AC10[3].u = 1; + array_50AC10[3].v = 1 + t; + pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); + return; + //} + } } @@ -11653,25 +11665,16 @@ //----- (0044100D) -------------------------------------------------------- bool __cdecl sub_44100D() { - return pCurrentScreen == SCREEN_NPC_DIALOGUE - || pCurrentScreen == SCREEN_CHARACTERS - || pCurrentScreen > SCREEN_LOADGAME - && (pCurrentScreen <= SCREEN_E - || pCurrentScreen > SCREEN_VIDEO - && (pCurrentScreen <= SCREEN_INPUT_BLV - || pCurrentScreen == SCREEN_CASTING)); + return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || + pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || + pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; } // 4E28F8: using guessed type int pCurrentScreen; //----- (00441498) -------------------------------------------------------- void __cdecl GameUI_DrawTorchlightAndWizardEye() { - unsigned int v0; // eax@15 - IconFrame *v1; // eax@15 - unsigned int v2; // eax@19 - IconFrame *v3; // eax@19 - - if ( !pCurrentScreen + if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_MENU || pCurrentScreen == SCREEN_OPTIONS || pCurrentScreen == SCREEN_REST @@ -11683,25 +11686,15 @@ || pCurrentScreen == SCREEN_BOOKS || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) { - if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) ) - { - v0 = pEventTimer->Time(); - v1 = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, v0); - pRenderer->DrawTextureTransparent( - pUIAnum_Torchlight->x, - pUIAnum_Torchlight->y, - &pIcons_LOD->pTextures[v1->uTextureID]); - } - if ( SHIDWORD(pParty->pPartyBuffs[19].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[19].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[19].uExpireTime)) ) - { - v2 = pEventTimer->Time(); - v3 = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, v2); - pRenderer->DrawTextureTransparent( - pUIAnim_WizardEye->x, - pUIAnim_WizardEye->y, - &pIcons_LOD->pTextures[v3->uTextureID]); + if (pParty->TorchlightActive()) + { + auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); + pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); + } + if (pParty->WizardEyeActive()) + { + auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); + pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); } } } @@ -11719,81 +11712,71 @@ //----- (004415C5) -------------------------------------------------------- -void __cdecl Load_isn_spells_21_27() -{ - signed int v0; // esi@1 - char pContainer[120]; // [sp+8h] [bp-20h]@2 - - v0 = 0; - do - { - sprintf(pContainer, "isn-%02d", v0 + 1); - pTextureIDs_isns[v0++] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - while ( v0 < 14 ); - uIconIdx_Spell21 = pIconsFrameTable->FindIcon("spell21"); - uIconIdx_Spell27 = pIconsFrameTable->FindIcon("spell27"); +void LoadPartyBuffIcons() +{ + for (uint i = 0; i < 14; ++i) + { + char filename[200]; + sprintf(filename, "isn-%02d", i + 1); + pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); + } + + uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); + uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); } //----- (0044162D) -------------------------------------------------------- void __cdecl GameUI_DrawPartySpells() { unsigned int v0; // ebp@1 - signed int v1; // edi@1 - int v2; // eax@2 - int v3; // ecx@5 - __int16 *v4; // ebx@25 - Player *v5; // edi@26 - unsigned int v6; // [sp-4h] [bp-1Ch]@11 + //signed int v1; // edi@1 + //int v2; // eax@2 + //int v3; // ecx@5 + //__int16 *v4; // ebx@25 + //Player *v5; // edi@26 + //unsigned int v6; // [sp-4h] [bp-1Ch]@11 Texture *v7; // [sp-4h] [bp-1Ch]@12 - unsigned int v8; // [sp-4h] [bp-1Ch]@20 + //unsigned int v8; // [sp-4h] [bp-1Ch]@20 Texture *v9; // [sp-4h] [bp-1Ch]@21 - Player **v10; // [sp+10h] [bp-8h]@25 + //Player **v10; // [sp+10h] [bp-8h]@25 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); - v1 = 0; - do - { - v2 = (unsigned __int8)byte_4E5DD8[v1]; - if ( SHIDWORD(pParty->pPartyBuffs[v2].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[v2].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[v2].uExpireTime) > 0) ) - { - v3 = pTextureIDs_isns[v1]; - pRenderer->_4A65CC( - pPartySpellbuffsUI_XYs[v1][0], - pPartySpellbuffsUI_XYs[v1][1], - (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0), - (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0), - v0 + 20 * pPartySpellbuffsUI_smthns[v1], - 0, - 63); - } - ++v1; - } - while ( v1 < 14 ); - if ( !pCurrentScreen - || pCurrentScreen == SCREEN_NPC_DIALOGUE ) - { - if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 ) + //v1 = 0; + for (uint i = 0; i < 14; ++i) + { + //v2 = byte_4E5DD8[v1]; + if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) + { + auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); + //v3 = pTextureIDs_PartyBuffIcons[i]; + if (tex) + pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], + pPartySpellbuffsUI_XYs[i][1], tex, tex, + v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); + } + //++v1; + } + //while ( v1 < 14 ); + + if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) + { + if (pParty->FlyActive()) { if ( pParty->bFlying ) - v6 = v0; - else - v6 = 0; - v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_Spell21, v6)->uTextureID]; + v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID]; + else + v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID]; if ( pRenderer->pRenderD3D ) pRenderer->DrawTextureIndexed(8u, 8u, v7); else pRenderer->DrawTextureTransparent(8u, 8u, v7); } - if ( SHIDWORD(pParty->pPartyBuffs[18].uExpireTime) >= 0 - && (SHIDWORD(pParty->pPartyBuffs[18].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[18].uExpireTime)) ) - { - if ( pParty->uFlags & 0x80 ) - v8 = v0; - else - v8 = 0; - v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_Spell27, v8)->uTextureID]; + if (pParty->WaterWalkActive()) + { + if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) + v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID]; + else + v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID]; if ( pRenderer->pRenderD3D ) pRenderer->DrawTextureIndexed(396u, 8u, v9); else @@ -11801,37 +11784,19 @@ } } - uint _it = 0; - v10 = &pPlayers[1]; - v4 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing; - do - { - v5 = *v10; - if ( (signed __int64)(*v10)->pPlayerBuffs[6].uExpireTime > 0 ) - pRenderer->DrawTextureIndexed( - *v4 + 72, - 0x1ABu, - (Texture *)(dword_507964 != -1 ? &pIcons_LOD->pTextures[dword_507964] : 0)); - if ( (signed __int64)v5->pPlayerBuffs[1].uExpireTime > 0 ) - pRenderer->DrawTextureIndexed( - *v4 + 72, - 0x189u, - (Texture *)(dword_50796C != -1 ? &pIcons_LOD->pTextures[dword_50796C] : 0)); - if ( (signed __int64)v5->pPlayerBuffs[11].uExpireTime > 0 ) - pRenderer->DrawTextureIndexed( - *v4 + 72, - 0x19Au, - (Texture *)(dword_507968 != -1 ? &pIcons_LOD->pTextures[dword_507968] : 0)); - if ( (signed __int64)v5->pPlayerBuffs[10].uExpireTime > 0 ) - pRenderer->DrawTextureIndexed( - *v4 + 72, - 0x1BCu, - (Texture *)(dword_507960 != -1 ? &pIcons_LOD->pTextures[dword_507960] : 0)); - ++v10; - ++v4; - } - //while ( (signed int)v4 < (signed int)pBaseHealthByClass ); - while (++_it != 4); + for (uint i = 0; i < 4; ++i) + { + auto player = pParty->pPlayers + i; + + if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); + if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); + if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); + if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); + } } //----- (00441A4E) -------------------------------------------------------- @@ -15522,8 +15487,8 @@ signed int v29; // edx@66 char *v30; // ecx@67 unsigned __int16 v31; // ax@70 - Player *v32; // eax@80 - unsigned __int16 v33; // si@85 + //Player *v32; // eax@80 + //unsigned __int16 v33; // si@85 int v34; // eax@96 int v35; // eax@97 unsigned __int64 v36; // qax@99 @@ -15535,7 +15500,7 @@ int v42; // esi@111 int v43; // ebx@111 int v44; // eax@117 - unsigned __int16 v45; // si@137 + //unsigned __int16 v45; // si@137 unsigned __int16 v46; // [sp-8h] [bp-BCh]@99 int v47; // [sp-4h] [bp-B8h]@35 unsigned __int16 v48; // [sp-4h] [bp-B8h]@99 @@ -15551,8 +15516,8 @@ //SpriteObject a1; // [sp+38h] [bp-7Ch]@12 int v59; // [sp+A8h] [bp-Ch]@1 int v60; // [sp+ACh] [bp-8h]@1 - int spellnum_; // [sp+B0h] [bp-4h]@1 - signed int levela; // [sp+BCh] [bp+8h]@80 + //int spellnum_; // [sp+B0h] [bp-4h]@1 + //signed int levela; // [sp+BCh] [bp+8h]@80 int a6_4; // [sp+C8h] [bp+14h]@117 float a7a; // [sp+CCh] [bp+18h]@6 signed int a7b; // [sp+CCh] [bp+18h]@12 @@ -15565,7 +15530,7 @@ v9 = 0; v59 = rank + 1; - spellnum_ = spellnum; + //spellnum_ = spellnum; v60 = 0; if ( tox || toy || toz ) { @@ -15608,12 +15573,12 @@ SpriteObject a1; // [sp+38h] [bp-7Ch]@12 //SpriteObject::SpriteObject(&a1); - a1.uType = stru_4E3ACC[spellnum_].field_0; - if ( spellnum_ > 58 ) - { - if ( spellnum_ == 69 ) + a1.uType = stru_4E3ACC[spellnum].field_0; + if ( spellnum > 58 ) + { + if ( spellnum == 69 ) goto LABEL_117; - if ( spellnum_ != 83 ) + if ( spellnum != 83 ) return; v40 = v15 - 2; if ( v40 ) @@ -15651,9 +15616,9 @@ v37->Apply(v36, v46, v48, v50, v52); goto LABEL_139; } - if ( spellnum_ != 58 ) - { - switch ( spellnum_ ) + if ( spellnum != 58 ) + { + switch ( spellnum ) { case 2: case 6: @@ -15665,7 +15630,7 @@ case 41: a1.stru_24.Reset(); v16 = 0; - a1.field_48 = spellnum_; + a1.field_48 = spellnum; a1.field_4C = level; a1.field_50 = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -15703,7 +15668,7 @@ a8b = a7c / (v60 - 1); a1.stru_24.Reset(); v21 = 0; - a1.field_48 = spellnum_; + a1.field_48 = spellnum; a1.field_4C = level; a1.field_50 = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -15746,7 +15711,7 @@ } a1.stru_24.Reset(); v16 = 0; - a1.field_48 = spellnum_; + a1.field_48 = spellnum; a1.field_4C = level; a1.field_50 = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -15799,7 +15764,7 @@ a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1); a1.stru_24.Reset(); v25 = 0; - a1.field_48 = spellnum_; + a1.field_48 = spellnum; a1.field_4C = level; a1.field_50 = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -15843,14 +15808,15 @@ return; a1.stru_24.Reset(); v29 = 0; - a1.field_48 = spellnum_; + a1.field_48 = spellnum; a1.field_4C = level; a1.field_50 = v15; if ( (signed int)pObjectList->uNumObjects <= 0 ) goto LABEL_70; v30 = (char *)&pObjectList->pObjects->uObjectID; break; - case 5: + + case SPELL_FIRE_HASTE: if ( v15 > 0 ) { if ( v15 <= 2 ) @@ -15870,28 +15836,25 @@ } } } - levela = 1; - v32 = pParty->pPlayers;//[0].pConditions[1]; - do - { - if ( v32->pConditions[1] ) - levela = 0; - ++v32; - } - while ( v32 <= &pParty->pPlayers[3] ); - if ( !levela ) - return; - pParty->pPartyBuffs[8].Apply( - pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335), + //levela = 1; + //v32 = pParty->pPlayers;//[0].pConditions[1]; + //do + for (uint i = 0; i < 4; ++i) + if (pParty->pPlayers[i].pConditions[Player::Condition_Weak]) + return; + //while ( v32 <= &pParty->pPlayers[3] ); + //if ( !levela ) + // return; + pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), v15, 0, 0, 0); - v33 = spellnum_; - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(v33, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(v33, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(v33, 3u); + //v33 = spellnum_; + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); goto LABEL_138; case 17: case 38: @@ -15909,7 +15872,7 @@ v9 = 3600 * (level + 1); break; } - switch ( spellnum_ ) + switch ( spellnum ) { case 17: v60 = 0; @@ -15926,10 +15889,10 @@ v60 = v34; break; } - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 3u); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); v52 = 0; v50 = 0; v48 = v60; @@ -15942,10 +15905,10 @@ v38 = 60 * level; else v38 = 600 * level; - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 3u); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); v52 = 0; v50 = 0; v48 = level; @@ -16017,7 +15980,7 @@ goto LABEL_124; } LABEL_125: - switch ( spellnum_ ) + switch ( spellnum ) { case 3: level = 6; @@ -16038,22 +16001,22 @@ level = 1; break; } - v45 = spellnum_; - pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(v45, 1u); - pGame->pStru6Instance->SetPlayerBuffAnim(v45, 2u); - pGame->pStru6Instance->SetPlayerBuffAnim(v45, 3u); + //v45 = spellnum_; + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); + pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); pParty->pPartyBuffs[level].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), v15, v60, 0, 0); - levela = 1; + //levela = 1; LABEL_138: - if ( levela ) + //if ( levela ) LABEL_139: - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum_], 0, 0, fromx, fromy, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum], 0, 0, fromx, fromy, 0, 0, 0); } // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
--- a/mm7_4.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_4.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -3210,7 +3210,7 @@ if ( v7 == 0 ) v7 = 1; if (pPlayer->expression == CHARACTER_EXPRESSION_21) - pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->field_1AA8, &pPlayer->field_1AA4, pMiscTimer->uTimeElapsed); + pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); else pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed); if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 ) @@ -3424,11 +3424,11 @@ { if ( pParty->bFlying ) { - if ( !(pParty->pPartyBuffs[7].uFlags & 1) ) - { - v5 = v4 * pParty->pPartyBuffs[7].uPower; - __debugbreak(); - v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[7].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; + if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) + { // colliding with something in the air - fall down + v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; + //__debugbreak(); + v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; v7 = *v6 < v5; *v6 -= v5; if ( v7 ) @@ -3441,25 +3441,27 @@ } } } + if (pParty->WaterWalkActive()) { - if (pParty->uFlags & 0x80 ) - { - if ( !(pParty->pPartyBuffs[18].uFlags & 1) ) - { - __debugbreak(); - v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[18].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; + if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) + { + if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) + { // taking on water + //__debugbreak(); + v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; v7 = *v8 < v4; *v8 -= v4; if ( v7 ) { *v8 = 0; - LOBYTE(pParty->uFlags) &= 0x7Fu; + pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; v51 = 1; } } } } + if (pParty->ImmolationActive()) { //SpriteObject::SpriteObject(&a1); @@ -4335,25 +4337,25 @@ } //----- (00494B5E) -------------------------------------------------------- -PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *a2, int *a3, int a4) +PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) { PlayerFrameTable *v4; // edi@1 int v5; // esi@1 int v6; // eax@2 v4 = this; - v5 = a4 + *a3; - if ( v5 < 8 * this->pFrames[*a2].uAnimTime ) - { - *a3 = v5; + v5 = a4 + *pAnimTime; + if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime ) + { + *pAnimTime = v5; } else { v6 = rand() % 4 + 21; - *a2 = v6; - *a3 = 8 * v5 % v4->pFrames[v6].uAnimTime; - } - return &v4->pFrames[*a2]; + *pFramesetID = v6; + *pAnimTime = 8 * v5 % v4->pFrames[v6].uAnimTime; + } + return &v4->pFrames[*pFramesetID]; } //----- (00494BC3) -------------------------------------------------------- @@ -4806,33 +4808,16 @@ //----- (00495430) -------------------------------------------------------- char *__fastcall GetReputationString(signed int a1) { - char *result; // eax@2 - - if ( a1 < 25 ) - { - if ( a1 < 6 ) - { - if ( a1 < -5 ) - { - result = pGlobalTXT_LocalizationStrings[402]; - if ( a1 < -24 ) - result = pGlobalTXT_LocalizationStrings[434]; - } - else - { - result = pGlobalTXT_LocalizationStrings[399]; - } - } - else - { - result = pGlobalTXT_LocalizationStrings[392]; - } - } + if (a1 >= 25) + return pGlobalTXT_LocalizationStrings[379]; // Hated + else if (a1 >= 6) + return pGlobalTXT_LocalizationStrings[392]; // Unfriendly + else if (a1 >= -5) + return pGlobalTXT_LocalizationStrings[399]; // Neutral; + else if (a1 >= -24) + return pGlobalTXT_LocalizationStrings[402]; // Friendly else - { - result = pGlobalTXT_LocalizationStrings[379]; - } - return result; + return pGlobalTXT_LocalizationStrings[434]; // Respected; } //----- (00495461) --------------------------------------------------------
--- a/mm7_5.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_5.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -5271,7 +5271,7 @@ //v55 = v33; if ( pRenderer->pRenderD3D ) { - if ( pGame->uFlags2 & 0x20 ) + if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { v50 = 0; pMonsterName = 0; @@ -5594,7 +5594,7 @@ v74 = v27; if ( pRenderer->pRenderD3D ) { - if ( pGame->uFlags2 & 0x20 ) + if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { v28 = (double)v74; v74 = v7->vPosition.z; @@ -5780,7 +5780,7 @@ v75 = v57; if ( pRenderer->pRenderD3D ) { - if ( pGame->uFlags2 & 0x20 ) + if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) { v58 = (double)(signed int)v75; v75 = v44->vPosition.z; @@ -11561,7 +11561,7 @@ v61 = 116 * v59; sDepthb = 0; for ( i = 116 * v59; - sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->field_C + v61) + sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); ++sDepthb ) { @@ -11715,7 +11715,7 @@ v89 = 116 * v87; v162 = 0; v112 = v89; - if ( *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) + if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) break; LABEL_148: @@ -11795,7 +11795,7 @@ LABEL_145: v88 = pIndoor->pSectors; ++v162; - if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) + if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) goto LABEL_148; } @@ -14794,7 +14794,7 @@ v2 = uTextureID_507C58; goto LABEL_12; } - if ( pGame->uFlags2 & 0x20 ) + if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) pRenderer->DrawTextureIndexed( 0x14u, 0x119u, @@ -14970,7 +14970,7 @@ //----- (00415485) -------------------------------------------------------- -char *__cdecl DrawCopyrightWindow() +void DrawCopyrightWindow() { GUIWindow Dst; // [sp+8h] [bp-54h]@1 @@ -14992,7 +14992,7 @@ Dst.uFrameHeight -= 12; Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - return Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[157], 3u); + Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[157], 3u); } @@ -15063,542 +15063,241 @@ pWindowType = pWindow->eWindowType; switch (pWindow->eWindowType) { - case WINDOW_MainMenu_Load: - GameUI_MainMenu_DrawLoad(); - continue; - case WINDOW_5E: // window that initiates savegame loading - { - if (pWindow->Hint != (char *)1) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - auto pGUIButton3 = (GUIButton *)pWindow->ptr_1C; - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton3->pTextures[0]); - pHint = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint && pHint != (char *)1 ) - pGUIButton3->DrawLabel(pHint, pFontCreate, 0, 0); - pWindow->Release(); - if (pCurrentScreen == SCREEN_SAVEGAME) - pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); - else - pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); - } - continue; - } - if ( (signed int)pWindowType > 70 ) - { - if ( (signed int)pWindowType > 95 ) - { - v33 = pWindowType - 96; - if ( pWindowType == WINDOW_60 )//96 - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pGUIButton = (GUIButton *)pWindow->ptr_1C; - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); - pHint = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint && pHint != (char *)1 ) - pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); - pWindow->Release(); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) - continue; - pNumMessages = pMessageQueue_50CBD0->uNumMessages; -//LABEL_151: - pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; -//LABEL_152: - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - continue; - } - v34 = v33 - 1; - if ( v34 )//pWindowType > 97 - { - v35 = v34 - 1; - if ( v35 )//pWindowType > 98 - { - v36 = v35 - 1; - if ( v36 )//pWindowType > 99 - { - v37 = v36 - 4; - if ( v37 )//pWindowType > 103 - { - v38 = v37 - 2; - if ( v38 )//pWindowType > 105 - { - if ( pWindowType == WINDOW_VideoOptions ) - GameMenuUI_DrawVideoOptions(); - } - else if ( pWindowType == WINDOW_KeyMappingOptions ) - { - GameMenuUI_DrawKeyBindings(); - } - } - else//pWindowType == WINDOW_67 - { - pWindow->DrawMessageBox(0); - pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); - if ( !pKeyActionMap->field_204 ) - { - ItemGen2.Reset(); - pWindow->Release(); - pEventTimer->Resume(); - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - if ( v39 > 0 ) - { - if ( v39 < 800 ) - SpawnActor(v39); - } - } - } - continue; - } - pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99 (0x63) WINDOW_63 + case WINDOW_MainMenu_Load: + { + GameUI_MainMenu_DrawLoad(); + break; + } + case WINDOW_5E: // window that initiates savegame loading + { + if (pWindow->Hint != (char *)1) + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + auto pGUIButton3 = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton3->pTextures[0]); + pHint = pWindow->Hint; + viewparams->bRedrawGameUI = 1; + if ( pHint && pHint != (char *)1 ) + pGUIButton3->DrawLabel(pHint, pFontCreate, 0, 0); + pWindow->Release(); + if (pCurrentScreen == SCREEN_SAVEGAME) + pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); + else + pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); + break; + } + case WINDOW_3: + { + pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3) + pY = pViewport->uViewportY; + pX = pViewport->uViewportX; + pRenderer->DrawTextureIndexed(pX, pY, pTexture); + viewparams->bRedrawGameUI = 1; + break; + } + case WINDOW_CharacterRecord: + { + CharacterUI_CharacterScreen_Draw(uActiveCharacter); + break; + } + case WINDOW_Options: + { + DrawGameOptions(); + break; + } + case WINDOW_Book: + { + SellectDrawBook((unsigned int)pWindow->ptr_1C); + break; + } + case WINDOW_QuickReference: + { + QuickRefDraw(); + break; + } + case WINDOW_Rest: + { + RestUI_Draw(); + break; + } + case WINDOW_Dialogue: + { + DrawDialogueUI(); + break; + } + case WINDOW_ChangeLocation: + { + TravelUI_Draw(); + break; + } + case WINDOW_SpellBook: + { + DrawSpellBookContent(); + break; + } + case WINDOW_GreetingNPC: + { + DrawBranchlessDialogueUI(); + break; + } + case WINDOW_Transition: + { + TransitionUI_Draw(); + break; + } + case WINDOW_Scroll: + { + CreateScrollWindow(); + break; + } + case WINDOW_FinalWindow: + { + sub_41420D_press_esc(); + break; + } + case WINDOW_VideoOptions: + { + GameMenuUI_DrawVideoOptions(); + break; + } + case WINDOW_KeyMappingOptions: + { + GameMenuUI_DrawKeyBindings(); + break; + } + case WINDOW_17: + { + sub_4606FE(); + break; + } + case WINDOW_1F: + { + pRenderer->ClearZBuffer(0, 479); + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_DrawPaperdoll(uActiveCharacter); + pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, + (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + break; + } + case WINDOW_RestWindow: + { + memset(&GUIButton2, 0, 0xBCu);//pWindowType == 98 (0x62) WINDOW_RestWindow + GUIButton2.uZ = 197; + GUIButton2.uW = 197; + GUIButton2.uX = 27; + GUIButton2.uY = 161; + GUIButton2.uWidth = 171; + GUIButton2.uHeight = 37; + GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); + viewparams->bRedrawGameUI = 1; + GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);// 8 + GUIButton2.pParent = 0; + pGUIWindow2 = pWindow; + pGUIWindow2->Release(); + break; + } + case WINDOW_60: + { + if ( pWindow->Hint != (char *)1 ) + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + pGUIButton = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); + pHint = pWindow->Hint; + viewparams->bRedrawGameUI = 1; + if ( pHint && pHint != (char *)1 ) + pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); + pWindow->Release(); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + break; + } + case WINDOW_61: + { + if ( pWindow->Hint != (char *)1 )//pWindowType == WINDOW_61 + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + v32 = pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16)); + pHint = pWindow->Hint; + viewparams->bRedrawGameUI = 1; + if ( pHint && pHint != (char *)1 ) + ((GUIButton *)v32)->DrawLabel(pHint, pFontCreate, 0, 0); + pWindow->Release(); + pNumMessages = pMessageQueue_50CBD0->uNumMessages; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + break; + } + case WINDOW_63: + { + pTexture = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15);//pWindowType == 99 (0x63) WINDOW_63 pY = pWindow->uFrameY; pX = pWindow->uFrameX; -//LABEL_18: pRenderer->DrawTextureIndexed(pX, pY, pTexture); -//LABEL_114: viewparams->bRedrawGameUI = 1; - continue; - } - memset(&GUIButton2, 0, 0xBCu);//pWindowType == 98 (0x62) WINDOW_RestWindow - GUIButton2.uZ = 197; - GUIButton2.uW = 197; - GUIButton2.uX = 27; - GUIButton2.uY = 161; - GUIButton2.uWidth = 171; - GUIButton2.uHeight = 37; - GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); - viewparams->bRedrawGameUI = 1; - GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);// 8 - GUIButton2.pParent = 0; - //goto LABEL_134; - pGUIWindow2 = pWindow; - //goto LABEL_110; - pGUIWindow2->Release(); - continue; - } - if ( pWindow->Hint != (char *)1 )//pWindowType == WINDOW_61 - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - v32 = pWindow->ptr_1C; - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16)); - //goto LABEL_138; - pHint = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint && pHint != (char *)1 ) - ((GUIButton *)v32)->DrawLabel(pHint, pFontCreate, 0, 0); - pWindow->Release(); - pNumMessages = pMessageQueue_50CBD0->uNumMessages; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - continue; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - continue; - } - - if ( pWindowType == WINDOW_5F ) - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - v32 = pWindow->ptr_1C; - pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 15)); -//LABEL_138: - pHint = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint && pHint != (char *)1 ) - ((GUIButton *)v32)->DrawLabel(pHint, pFontCreate, 0, 0); - pWindow->Release(); -//LABEL_142: - pNumMessages = pMessageQueue_50CBD0->uNumMessages; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - //goto LABEL_151; - { - pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; //0x71 - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - continue; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - continue; - } - v14 = pWindowType - 80; - if ( v14 )//pWindowType > 80 - { - v15 = v14 - 9; - if ( pWindowType == WINDOW_59) - { - pWindow->DrawMessageBox(0); - pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); - if ( !pKeyActionMap->field_204 ) - { - pItemGen.Reset(); - pWindow->Release(); - pEventTimer->Resume(); - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - if ( v26 > 0 ) - { - if ( v26 < 800 ) - { - pItemGen.SetIdentified(); - pItemGen.uItemID = v26; - if ( pItemsTable->pItems[v26].uEquipType == 12 ) + break; + } + case WINDOW_CharacterWindow_Inventory: + { + pWindow->DrawMessageBox(0); + pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); + pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + if ( !pKeyActionMap->field_204 ) + { + ItemGen2.Reset(); + pWindow->Release(); + pEventTimer->Resume(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + if ( v39 > 0 ) { - pItemGen.uNumCharges = rand() % 6 + pItemsTable->pItems[pItemGen.uItemID].uDamageMod + 1; - pItemGen.uMaxCharges = LOBYTE(pItemGen.uNumCharges); - } - else - { - if ( v26 >= 221 && v26 < 271 ) - pItemGen.uEncantmentType = rand() % 10 + 1; - } - pItemsTable->SetSpecialBonus(&pItemGen); - pParty->SetHoldingItem(&pItemGen); - } - } - } - continue; - } - v16 = v15 - 1; - if ( pWindowType == WINDOW_5A ) // Press buttons in title menu and in game, and escape in game - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pButtonPtr_1C = (GUIButton *)pWindow->ptr_1C; - if ( pButtonPtr_1C->uX >= 0 )//if ( (pButtonPtr_1C->uX & 0x80000000u) == 0 ) - { - if ( (signed int)pButtonPtr_1C->uX <= 640 ) - { - //v25 = pButtonPtr_1C->uY; - if ( pButtonPtr_1C->uY >= 0 ) //if ( (pButtonPtr_1C->uY & 0x80000000u) == 0 ) - { - if ( (signed int)pButtonPtr_1C->uY <= 480 ) - { - pTexture2 = pButtonPtr_1C->pTextures[0]; - //goto LABEL_94; - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pTexture2); - pHint1 = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint1 ) - { - v24 = pHint1 == (char *)1; - if ( !v24 ) - pButtonPtr_1C->DrawLabel(pHint1, pFontCreate, 0, 0); - } - pGUIWindow2 = pWindow; - pGUIWindow2->Release(); - continue; + if ( v39 < 800 ) + SpawnActor(v39); } - } - } - } - pHint1 = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint1 ) - { - v24 = pHint1 == (char *)1; - //goto LABEL_82; - if ( !v24 ) - pButtonPtr_1C->DrawLabel(pHint1, pFontCreate, 0, 0); - pGUIWindow2 = pWindow; - pGUIWindow2->Release(); - continue; - } -//LABEL_134: - pGUIWindow2 = pWindow; - //goto LABEL_110; - pGUIWindow2->Release(); - continue; - } - v17 = v16 - 1; - if ( pWindowType == WINDOW_5B )//Change button in Character window - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pButtonPtr_1C = (GUIButton *)pWindow->ptr_1C; - pTexture2 = pButtonPtr_1C->pTextures[1]; -//LABEL_94: - pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pTexture2); -//LABEL_80: - pHint1 = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint1 ) - { - v24 = pHint1 == (char *)1; -//LABEL_82: - if ( !v24 ) - pButtonPtr_1C->DrawLabel(pHint1, pFontCreate, 0, 0); - } - //goto LABEL_134; - pGUIWindow2 = pWindow; - //goto LABEL_110; - pGUIWindow2->Release(); - continue; - } - v18 = v17 - 1; - if ( pWindowType == WINDOW_VoiceSwitcherButton ) // Change page in AutonotesBook - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pButtonPtr_1C = (GUIButton *)pWindow->ptr_1C; - pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButtonPtr_1C->pTextures[0]); - //goto LABEL_80; - pHint1 = pWindow->Hint; - viewparams->bRedrawGameUI = 1; - if ( pHint1 ) - { - v24 = pHint1 == (char *)1; - if ( !v24 ) - pButtonPtr_1C->DrawLabel(pHint1, pFontCreate, 0, 0); - } - pGUIWindow2 = pWindow; - pGUIWindow2->Release(); - continue; - } - v19 = v18 - 1; - if ( pWindowType == WINDOW_5D ) - { - if ( pWindow->Hint != (char *)1 ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 16)); - viewparams->bRedrawGameUI = 1; - //goto LABEL_134; - pGUIWindow2 = pWindow; - //goto LABEL_110; - pGUIWindow2->Release(); - continue; - } - } - else if ( pWindowType == WINDOW_50 ) - { - v27 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - if ( ptr_507BD0->field_40 == 1 ) - { - ptr_507BD0->DrawMessageBox(0); - ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); - pGUIFont = pFontCreate; - v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pGUIFont); - continue; - } - if ( ptr_507BD0->field_40 == 2 ) - { - v29 = pMessageQueue_50CBD0->uNumMessages; - pWindow->field_40 = 0; - /*if ( (signed int)v29 < 40 ) - { - pMessageQueue_50CBD0->pMessages[v29].eType = (UIMessageType)(int)ptr_507BD0->ptr_1C; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); - pEventTimer->Resume(); - ptr_507BD0->Release(); - pCurrentScreen = SCREEN_GAME; - //goto LABEL_114; - viewparams->bRedrawGameUI = 1; - continue; - } - if ( ptr_507BD0->field_40 == 3 ) - { - pWindow->field_40 = 0; - pEventTimer->Resume(); - pGUIWindow2 = ptr_507BD0; -//LABEL_110: - pGUIWindow2->Release(); - continue; - } - } - } - else - { - if ( pWindowType == WINDOW_FinalWindow ) - { - sub_41420D_press_esc(); - continue; - } - if ( (signed int)pWindowType > 18 ) - { - if ( (signed int)pWindowType > 25 ) - { - v12 = pWindowType - 26; - if ( v12 )// pWindowType > 26 - { - v13 = v12 - 4; - if ( v13 )//pWindowType > 30 - { - if ( pWindowType == WINDOW_1F) - { - pRenderer->ClearZBuffer(0, 479); - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - CharacterUI_DrawPaperdoll(uActiveCharacter); - pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, - (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); - } - } - else if( pWindowType == WINDOW_Scroll) - { - CreateScrollWindow(); - } - } - else if ( pWindowType == WINDOW_Transition ) - { - TransitionUI_Draw(); - } - continue; - } - if ( pWindowType != 25 ) - { - v7 = pWindowType - 19; - if ( v7 )// pWindowType > 19 - { - v8 = v7 - 1; - if ( v8 )// pWindowType > 20 - { - v9 = v8 - 3; - if ( v9 )//pWindowType > 23 - { - //if ( v9 == 1 ) //pWindowType == 24 (0x18) WINDOW_MainMenu_Load - // sub_4606F7(); - } - else if ( pWindowType == WINDOW_17 ) - { - sub_4606FE(); - } - } - else if ( pWindowType == WINDOW_Chest ) - { - if ( pCurrentScreen == SCREEN_CHEST ) - { - Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); - } - else - { - if ( pCurrentScreen == SCREEN_F ) - { - pRenderer->ClearZBuffer(0, 479); - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, - (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); - } - } - } - } - else if (pWindowType == WINDOW_GreetingNPC ) - { - DrawBranchlessDialogueUI(); - } - continue; - } - pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); - if ( !window_SpeakInHouse ) - continue; - v10 = window_SpeakInHouse->ptr_1C; - if ( (signed int)v10 >= 53 ) - continue; - if ( pParty->field_3C._shop_ban_times[(signed int)v10] <=pParty->uTimePlayed ) - { - if ( (signed int)v10 < 53 ) - { - pParty->field_3C._shop_ban_times[(signed int)v10] = 0; - } - continue; - } - //goto LABEL_142; - pNumMessages = pMessageQueue_50CBD0->uNumMessages; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - continue; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - continue; - } - if ( pWindowType == WINDOW_SpellBook ) - { - DrawSpellBookContent(); - } - else - { - if ( (signed int)pWindowType > 10 ) - { - v5 = pWindowType - 12; - if ( v5 )//pWindowType >12 - { - v6 = v5 - 4; - if ( v6 )//pWindowType > 16 - { - if ( pWindowType == WINDOW_ChangeLocation ) - TravelUI_Draw(); - } - else if ( pWindowType == WINDOW_Rest ) - { - RestUI_Draw(); - } - } - else if (pWindowType == WINDOW_QuickReference ) - { - QuickRefDraw(); - } - continue; - } - if ( pWindowType != 10 ) //pWindowType == 10 - { - v2 = pWindowType - 3; - if ( v2 )//pWindowType > 3 - { - v3 = v2 - 1; - if ( v3 )// pWindowType > 4 - { - v4 = v3 - 2; - if ( v4 )//pWindowType > 6 - { - if ( pWindowType == WINDOW_Book ) - SellectDrawBook((unsigned int)pWindow->ptr_1C); - } - else if (pWindowType == WINDOW_Options) - { - DrawGameOptions(); - } - } - else if (pWindowType == WINDOW_CharacterRecord) - { - CharacterUI_CharacterScreen_Draw(uActiveCharacter); - } - continue; - } - pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3) - pY = pViewport->uViewportY; - pX = pViewport->uViewportX; - //goto LABEL_18; - pRenderer->DrawTextureIndexed(pX, pY, pTexture); - viewparams->bRedrawGameUI = 1; - continue; - } - DrawDialogueUI(); - } - } + } + break; + } + case WINDOW_Chest: + { + if ( pCurrentScreen == SCREEN_CHEST ) + { + Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); + } + else if ( pCurrentScreen == SCREEN_F ) + { + pRenderer->ClearZBuffer(0, 479); + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, + (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); + } + break; + } + case WINDOW_HouseInterior: + { + pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); + if ( !window_SpeakInHouse ) + continue; + v10 = window_SpeakInHouse->ptr_1C; + if ( (signed int)v10 >= 53 ) + continue; + if ( pParty->field_3C._shop_ban_times[(signed int)v10] <=pParty->uTimePlayed ) + { + if ( (signed int)v10 < 53 ) + { + pParty->field_3C._shop_ban_times[(signed int)v10] = 0; + } + continue; + } + pNumMessages = pMessageQueue_50CBD0->uNumMessages; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + break; + } + default: + { + break; + } + } } if ( GetCurrentMenuID() == -1 ) GameUI_DrawFoodAndGold(); @@ -15731,7 +15430,7 @@ v27 = &v0->pInventoryItems[pOut.z]; v28 = v27->uItemID; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; - v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEncantmentType); + v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); if ( pParty->pPickedItem.uItemID != 233 ) { if ( pParty->pPickedItem.uItemID == 236 ) @@ -15753,7 +15452,7 @@ if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 || (pOut.y = v27->uAttributes, pOut.y & 2) || v27->uSpecEnchantmentType - || v27->uEncantmentType + || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v33 >= 500 ) goto LABEL_92; @@ -15769,7 +15468,7 @@ && (signed int)v30 <= 65 || (pOut.y = v27->uAttributes, pOut.y & 2) || v27->uSpecEnchantmentType - || v27->uEncantmentType + || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v30 >= 500 ) goto LABEL_92; @@ -15787,7 +15486,7 @@ dword_50C9A8 = 256; goto LABEL_92; } - v36 = (70.0 - (double)pParty->pPickedItem.uEncantmentType) * 0.01; + v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; if ( v36 < 0.0 ) v36 = 0.0; if ( v51 != 12 ) @@ -15936,8 +15635,8 @@ *(int *)&v0->field_1F5[36 * v19 + 15] = 1; v20 = v47 + 50 * v15; v0->pInventoryItems[pOut.z].uItemID = v51; - v0->pInventoryItems[pOut.z].uEncantmentType = (pParty->pPickedItem.uEncantmentType - + v0->pInventoryItems[pOut.z].uEncantmentType) + v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + v0->pInventoryItems[pOut.z].uEnchantmentType) / 2; v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: @@ -15954,7 +15653,7 @@ if ( *(int *)(a2.y + 532) == 221 ) *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; else - *(int *)(a2.y + 536) = pParty->pPickedItem.uEncantmentType; + *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; v21 = v0->AddItem(0xFFFFFFFFu, 0xDCu); if ( v21 ) *(int *)&v0->field_1F5[36 * v21 + 15] = 1; @@ -16248,79 +15947,161 @@ } pEventTimer->Pause(); - if ( pCurrentScreen <= SCREEN_CHEST ) - { - if ( pCurrentScreen == SCREEN_CHEST ) - { - // __debugbreak(); - if ( !pPlayers[uActiveCharacter]->CanAct() ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427],//%s %s - pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);// - pWindow.Hint = pTmpBuf; - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 180; - pWindow.uFrameY = 40; - if ( (signed int)pX <= 320 ) - v10 = pX + 30; - else - v10 = pX - 414; - pWindow.uFrameX = v10; - pWindow.DrawMessageBox(0); - goto LABEL_132; - } - v9 = pX + pSRZBufferLineOffsets[pY]; - if ( !(pRenderer->pActiveZBuffer[v9] & 0xFFFF) ) - goto LABEL_132; - v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime - + (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); - } - else - { - if ( pCurrentScreen ) - { - if ( pCurrentScreen != SCREEN_BOOKS ) - { - if ( pCurrentScreen != SCREEN_CHARACTERS ) - { - if ( pCurrentScreen == SCREEN_SPELL_BOOK ) - { - if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); - } - goto LABEL_132; - } -LABEL_119: - if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) - { - identify_item(); - goto LABEL_132; - } - if ( (signed int)pY >= 345 ) - goto LABEL_132; - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats - { - CharacterUI_StatsTab_ShowHint(); - goto LABEL_132; - } - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills - { - CharacterUI_SkillsTab_ShowHint(); - goto LABEL_132; - } - v11 = pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103;//2DEvent - CharacerScreenInventory - if ( !v11 ) - goto LABEL_132; - identify_item(); - goto LABEL_132; - } + + switch(pCurrentScreen) + { + case SCREEN_CASTING: + { + identify_item(); + break; + } + + case SCREEN_CHEST: + { + if ( !pPlayers[uActiveCharacter]->CanAct() ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427],//%s %s + pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);// + pWindow.Hint = pTmpBuf; + pWindow.uFrameWidth = 384; + pWindow.uFrameHeight = 180; + pWindow.uFrameY = 40; + if ( (signed int)pX <= 320 ) + v10 = pX + 30; + else + v10 = pX - 414; + pWindow.uFrameX = v10; + pWindow.DrawMessageBox(0); + } + else + { + v9 = pX + pSRZBufferLineOffsets[pY]; + if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF ) + { + v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime + + (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); + GameUI_DrawItemInfo(v8); + } + } + break; + } + case SCREEN_GAME: + { + if (GetCurrentMenuID() > 0) + break; + + if ( (signed int)pY > (signed int)pViewport->uViewportW ) + { + pWindow.ptr_1C = (void *)((signed int)pX / 118); + if ( (signed int)pX / 118 < 4 ) + { + pWindow.Hint = 0; + pWindow.uFrameWidth = 400; + pWindow.uFrameHeight = 200; + pWindow.uFrameX = 38; + pWindow.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + pWindow.DrawQuickCharRecord(); + } + } + else if ( (signed int)pX > (signed int)pViewport->uViewportZ ) + { + if ( (signed int)pY >= 130 ) + { + if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 ) + { + pWindow.Hint = 0; + pWindow.uFrameWidth = 400; + pWindow.uFrameHeight = 200; + pWindow.uFrameX = 38; + pWindow.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + pWindow._41D73D_draw_buff_tooltip(); + } + else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 ) + { + if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) + { + pAudioPlayer->StopChannels(-1, -1); + v3 = (void *)1; + } + else + { + sub_416B01(v3); + } + } + else + { + pAudioPlayer->StopChannels(-1, -1); + v3 = 0; + sub_416B01(v3); + } + } + else + { + pWindow.Hint = _4443D5_GetMinimapRightClickText(); + pWindow.uFrameWidth = 256; + pWindow.uFrameX = 130; + pWindow.uFrameY = 140; + pWindow.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + pWindow.DrawMessageBox(0); + } + } + else + { + pWindow.Hint = 0; + pWindow.uFrameWidth = 320; + pWindow.uFrameHeight = 320; + v4 = pX - 350; + if ( (signed int)pX <= 320 ) + v4 = pX + 30; + pWindow.uFrameX = v4; + pWindow.uFrameY = 40; + if ( pRenderer->pRenderD3D ) + LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); + else + v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + v6 = (unsigned __int16)v5; + if ( (v6 & 7) != OBJECT_Item) + { + if ( (v6 & 7) == OBJECT_Actor) + { + if ( pRenderer->uNumSceneBegins ) + { + pWindow.DrawMessageBox(1); + MonsterPopup_Draw(v6 >> 3, &pWindow); + } + else + { + pRenderer->BeginScene(); + pWindow.DrawMessageBox(1); + MonsterPopup_Draw(v6 >> 3, &pWindow); + pRenderer->EndScene(); + } + } + } + else + { + v7 = v6 >> 3; + if ( ! (pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) ) + { + v8 = &pSpriteObjects[v7].stru_24; + GameUI_DrawItemInfo(v8); + } + } + } + break; + } + case SCREEN_BOOKS: + { if ( !dword_506364 || (signed int)pX < (signed int)pViewport->uViewportX || (signed int)pX > (signed int)pViewport->uViewportZ || (signed int)pY < (signed int)pViewport->uViewportY || (signed int)pY > (signed int)pViewport->uViewportW || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) ) - goto LABEL_132; + break; v30 = (double)(pFontArrus->GetLineWidth(v2) + 32); v27 = v30 + 6.7553994e15; v29 = (char *)LODWORD(v27); @@ -16330,205 +16111,137 @@ pWindow.uFrameHeight = 64; pAudioPlayer->StopChannels(-1, -1); pWindow.DrawMessageBox(0); - goto LABEL_132; - } - if (GetCurrentMenuID() > 0) - goto LABEL_132; - - if ( (signed int)pY > (signed int)pViewport->uViewportW ) - { - pWindow.ptr_1C = (void *)((signed int)pX / 118); - if ( (signed int)pX / 118 < 4 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawQuickCharRecord(); - } - goto LABEL_132; - } - if ( (signed int)pX > (signed int)pViewport->uViewportZ ) - { - if ( (signed int)pY >= 130 ) - { - if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - pWindow._41D73D_draw_buff_tooltip(); - goto LABEL_132; - } - if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 ) - { - if ( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 ) - goto LABEL_132; - pAudioPlayer->StopChannels(-1, -1); - v3 = (void *)1; - } - else - { - pAudioPlayer->StopChannels(-1, -1); - v3 = 0; - } - sub_416B01(v3); - goto LABEL_132; - } - pWindow.Hint = _4443D5_GetMinimapRightClickText(); - pWindow.uFrameWidth = 256; - pWindow.uFrameX = 130; - pWindow.uFrameY = 140; - pWindow.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); - goto LABEL_132; - } - pWindow.Hint = 0; - pWindow.uFrameWidth = 320; - pWindow.uFrameHeight = 320; - v4 = pX - 350; - if ( (signed int)pX <= 320 ) - v4 = pX + 30; - pWindow.uFrameX = v4; - pWindow.uFrameY = 40; - if ( pRenderer->pRenderD3D ) - LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); - else - v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - v6 = (unsigned __int16)v5; - if ( (v6 & 7) != OBJECT_Item) - { - if ( (v6 & 7) == OBJECT_Actor) - { - if ( pRenderer->uNumSceneBegins ) - { - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(v6 >> 3, &pWindow); - } - else - { - pRenderer->BeginScene(); - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(v6 >> 3, &pWindow); - pRenderer->EndScene(); - } - } - goto LABEL_132; - } - v7 = v6 >> 3; - if ( pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) - goto LABEL_132; - v8 = &pSpriteObjects[v7].stru_24; - } - GameUI_DrawItemInfo(v8); - goto LABEL_132; - } - if ( pCurrentScreen == SCREEN_HOUSE ) - { - if ( (signed int)pY < 345 && (signed int)pX < 469 ) - sub_4B1A2D();//identify item in inventory - goto LABEL_132; - } - if ( pCurrentScreen <= SCREEN_HOUSE ) - goto LABEL_132; - if ( pCurrentScreen <= SCREEN_F ) - goto LABEL_119; - if ( pCurrentScreen != SCREEN_PARTY_CREATION ) - { - v11 = pCurrentScreen == SCREEN_CASTING; - if ( !v11 ) - goto LABEL_132; - identify_item(); - goto LABEL_132; - } - pWindow.Hint = 0; - pStr = 0; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) - { - if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ - && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) - { - pControlID = pButton->uControlID; - switch ( pControlID ) - { - case 0: //stats info - pWindow.Hint = pAttributeDescriptions[(signed int)pButton->uControlParam % 7]; - pStr = aAttributeNames[(signed int)pButton->uControlParam % 7]; - break; - case 62: //Plus button info - pStr = pGlobalTXT_LocalizationStrings[670];// - pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//" , " - break; - case 63: //Minus button info - pStr = pGlobalTXT_LocalizationStrings[668];// - pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//" , " - break; - case 64: //Available skill button info - v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->uControlParam + 4); - pStr = pSkillNames[v18]; - pWindow.Hint = pSkillDesc[v18]; - break; - case 65: //Available Class Info - pWindow.Hint = pClassDescriptions[pButton->uControlParam]; - pStr = pClassNames[pButton->uControlParam]; - break; - case 66: //OK Info - pWindow.Hint = pGlobalTXT_LocalizationStrings[664];// . - pStr = pGlobalTXT_LocalizationStrings[665];// - break; - case 67: //Clear info - pWindow.Hint = pGlobalTXT_LocalizationStrings[666];// . - pStr = pGlobalTXT_LocalizationStrings[667];// - break; - case 118: // Character info - pStr = pParty->pPlayers[pButton->uControlParam].pName; - pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->uControlParam].classType]; - break; - } - if ( pControlID > 68 && pControlID <= 75 ) //Sellected skills info - { - pSkillId = pParty->pPlayers[pButton->uControlParam].GetSkillIdxByOrder(pControlID - 72); - pY = 0; - if ( (signed int)pSkillId < 37 ) - { - pSkillInfo = CharacterUI_GetSkillDescText(pButton->uControlParam, (enum PLAYER_SKILL_TYPE)pSkillId); - strcpy(pTmpBuf2, pSkillInfo); - pWindow.Hint = pTmpBuf2; - pStr = pSkillNames[pSkillId]; - } - } - } - } - if ( pWindow.Hint ) - { - pHint = pWindow.Hint; - pWindow.Hint = 0; - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 256; - pWindow.uFrameX = 128; - pWindow.uFrameY = 40; - pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pWindow.DrawMessageBox(0); - pWindow.uFrameX += 12; - pWindow.uFrameWidth -= 24; - pWindow.uFrameY += 12; - pWindow.uFrameHeight -= 12; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf, format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" - pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3); - pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); - } -LABEL_132: + break; + } + case SCREEN_CHARACTERS: + case SCREEN_E: + case SCREEN_F: + { + if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) + { + identify_item(); + } + else if ( (signed int)pY >= 345 ) + break; + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats + { + CharacterUI_StatsTab_ShowHint(); + } + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills + { + CharacterUI_SkillsTab_ShowHint(); + } + else + { + v11 = pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103;//2DEvent - CharacerScreenInventory + if ( v11 ) + identify_item(); + } + break; + } + case SCREEN_SPELL_BOOK: + { + if ( dword_507B00_spell_info_to_draw_in_popup ) + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); + break; + } + case SCREEN_HOUSE: + { + if ( (signed int)pY < 345 && (signed int)pX < 469 ) + sub_4B1A2D();//identify item in inventory + break; + } + + case SCREEN_PARTY_CREATION: + { + pWindow.Hint = 0; + pStr = 0; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) + { + if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ + && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) + { + pControlID = pButton->uControlID; + switch ( pControlID ) + { + case 0: //stats info + pWindow.Hint = pAttributeDescriptions[(signed int)pButton->uControlParam % 7]; + pStr = aAttributeNames[(signed int)pButton->uControlParam % 7]; + break; + case 62: //Plus button info + pStr = pGlobalTXT_LocalizationStrings[670];// + pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//" , " + break; + case 63: //Minus button info + pStr = pGlobalTXT_LocalizationStrings[668];// + pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//" , " + break; + case 64: //Available skill button info + v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->uControlParam + 4); + pStr = pSkillNames[v18]; + pWindow.Hint = pSkillDesc[v18]; + break; + case 65: //Available Class Info + pWindow.Hint = pClassDescriptions[pButton->uControlParam]; + pStr = pClassNames[pButton->uControlParam]; + break; + case 66: //OK Info + pWindow.Hint = pGlobalTXT_LocalizationStrings[664];// . + pStr = pGlobalTXT_LocalizationStrings[665];// + break; + case 67: //Clear info + pWindow.Hint = pGlobalTXT_LocalizationStrings[666];// . + pStr = pGlobalTXT_LocalizationStrings[667];// + break; + case 118: // Character info + pStr = pParty->pPlayers[pButton->uControlParam].pName; + pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->uControlParam].classType]; + break; + } + if ( pControlID > 68 && pControlID <= 75 ) //Sellected skills info + { + pSkillId = pParty->pPlayers[pButton->uControlParam].GetSkillIdxByOrder(pControlID - 72); + pY = 0; + if ( (signed int)pSkillId < 37 ) + { + pSkillInfo = CharacterUI_GetSkillDescText(pButton->uControlParam, (enum PLAYER_SKILL_TYPE)pSkillId); + strcpy(pTmpBuf2, pSkillInfo); + pWindow.Hint = pTmpBuf2; + pStr = pSkillNames[pSkillId]; + } + } + } + } + if ( pWindow.Hint ) + { + pHint = pWindow.Hint; + pWindow.Hint = 0; + pWindow.uFrameWidth = 384; + pWindow.uFrameHeight = 256; + pWindow.uFrameX = 128; + pWindow.uFrameY = 40; + pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; + pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; + pWindow.DrawMessageBox(0); + pWindow.uFrameX += 12; + pWindow.uFrameWidth -= 24; + pWindow.uFrameY += 12; + pWindow.uFrameHeight -= 12; + pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; + pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; + pColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); + sprintf(pTmpBuf, format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" + pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3); + pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); + } + break; + } + default: + { + break; + } + } dword_507BF0_is_there_popup_onscreen = 1; viewparams->bRedrawGameUI = 1; }
--- a/mm7_6.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_6.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -1431,7 +1431,7 @@ v4 = Dst.uItemID; } if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) - Dst.uEncantmentType = 2 * rand() % 4 + 2; + Dst.uEnchantmentType = 2 * rand() % 4 + 2; pItemsTable->SetSpecialBonus(&Dst); if ( !pParty->AddItem(&Dst) ) pParty->SetHoldingItem(&Dst); @@ -3756,7 +3756,7 @@ LABEL_139: DamageMonsterFromParty(8 * v42 | 2, v47, v670); goto LABEL_1056; - case 2: + case SPELL_FIRE_FIRE_BOLT: case 6: case 11: case 18: @@ -3980,7 +3980,7 @@ { if (!v730c->uSpecEnchantmentType) { - if (!v730c->uEncantmentType) + if (!v730c->uEnchantmentType) { v68 = BYTE4(v726->pConditions[3]); if ( !v68 || v68 == 1 || v68 == 2 ) @@ -4702,9 +4702,9 @@ } goto LABEL_1056; case 16: - if ( pParty->uFlags & 8 ) - { - v190 = pGlobalTXT_LocalizationStrings[493]; + if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) + { + v190 = pGlobalTXT_LocalizationStrings[493]; // Can't cast Jump while airborne! goto LABEL_462; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -4768,7 +4768,7 @@ case 21: if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { - v190 = pGlobalTXT_LocalizationStrings[494]; + v190 = pGlobalTXT_LocalizationStrings[494]; // Can not cast Fly indoors! LABEL_462: ShowStatusBarString(v190, 2u); pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); @@ -5307,7 +5307,7 @@ if ( v731 != 4 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 - || v726->pInventoryItems[a2].uEncantmentType != 0 + || v726->pInventoryItems[a2].uEnchantmentType != 0 || v726->pInventoryItems[a2]._bonus_strength != 0 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) goto LABEL_616; @@ -5412,7 +5412,7 @@ LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; if ( v290 > 134 || _this->uSpecEnchantmentType != 0 - || _this->uEncantmentType != 0 + || _this->uEnchantmentType != 0 || _this->_bonus_strength != 0 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 || v291 == 1 @@ -5487,13 +5487,13 @@ v293 = rand(); v294 = _this; v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; - _this->uEncantmentType = 0; + _this->uEnchantmentType = 0; for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; ; - kk += pItemsTable->pEnchantments[v294->uEncantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1] ) { - ++v294->uEncantmentType; + ++v294->uEnchantmentType; if ( kk >= v295 ) break; }
--- a/mm7_data.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_data.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -3,6 +3,7 @@ #include "NPC.h" #include "Actor.h" #include "GUIWindow.h" +#include "Party.h" @@ -945,9 +946,23 @@ char aItem3_3dvD[13]; // weak char aItem64v1[9]; // weak char aEffpar01[777]; // idb -int pPartySpellbuffsUI_XYs[14][2]; -char byte_4E5DD8[777]; // weak -unsigned __int8 pPartySpellbuffsUI_smthns[14]; + +int pPartySpellbuffsUI_XYs[14][2] = +{ + {477, 247}, {497, 247}, {522, 247}, {542, 247}, {564, 247}, {581, 247}, {614, 247}, + {477, 279}, {497, 279}, {522, 279}, {542, 279}, {564, 279}, {589, 279}, {612, 279} +}; +unsigned char byte_4E5DD8[14] = +{ + PARTY_BUFF_FEATHER_FALL, PARTY_BUFF_RESIST_FIRE, PARTY_BUFF_RESIST_AIR, PARTY_BUFF_RESIST_WATER, PARTY_BUFF_RESIST_MIND, PARTY_BUFF_RESIST_EARTH, PARTY_BUFF_RESIST_BODY, + PARTY_BUFF_HEROISM, PARTY_BUFF_HASTE, PARTY_BUFF_SHIELD, PARTY_BUFF_STONE_SKIN, PARTY_BUFF_PROTECTION_FROM_MAGIC, PARTY_BUFF_IMMOLATION, PARTY_BUFF_DAY_OF_GODS +}; +unsigned __int8 pPartySpellbuffsUI_smthns[14] = +{ + 14, 1, 10, 4, 7, 2, 9, + 3, 6, 15, 8, 3, 12, 0 +}; + char aSpell27[777]; // idb char aSpell21[777]; // idb char aIsn02d[777]; // idb @@ -1861,10 +1876,10 @@ char bFlashHistoryBook; // weak char bFlashAutonotesBook; // weak char bFlashQuestBook; // weak -int dword_507960; // weak -int dword_507964; // weak -int dword_507968; // weak -int dword_50796C; // weak +int uTextureID_PlayerBuff_PainReflection; // weak +int uTextureID_PlayerBuff_Hammerhands; // weak +int uTextureID_PlayerBuff_Preservation; // weak +int uTextureID_PlayerBuff_Bless; // weak int uTextureID_Btn_QuickReference; // weak int dword_5079B4; // weak int dword_5079C8; // weak @@ -1888,37 +1903,39 @@ int dword_507C0C; // weak int dword_507CBC; // weak int dword_507CC0; // weak -__int64 qword_507CC8; // weak +__int64 GameUI_RightPanel_BookFlashTimer; // weak int _507CD4_RestUI_hourglass_anim_controller; // weak int dword_507CD8; // weak int dword_50B570[777]; // weak int dword_50B638[777]; // weak int dword_50B700; // weak int dword_50B738[777]; // idb -int _50B744_view_transformed_ys[43]; +int _50B744_view_transformed_ys[45]; int dword_50B828[777]; -int _50B834_view_transformed_zs[43]; +int _50B834_view_transformed_zs[45]; int dword_50B918[777]; -int _50B924_view_transformed_xs[43]; -int unk_50B9D4[777]; // idb +int _50B924_view_transformed_xs[45]; +//int unk_50B9D4[777]; // idb int dword_50B9D8_ys[777]; -int dword_50B9E0_ys[777]; // idb -int dword_50B9EC[777]; // idb +int dword_50B9E4[777]; +//int dword_50B9E0_ys[777]; // idb +//int dword_50B9EC[777]; // idb int dword_50B9F0[2]; // idb -int dword_50BAE8_xs[777]; -int dword_50BAF4_xs[777]; -int dword_50B9F8[777]; // idb -int dword_50BA08[777]; // idb -int dword_50BAC4[777]; // weak +//int dword_50BAE8_xs[777]; +//int dword_50BAF4_xs[777]; +//int dword_50B9F8[777]; // idb +int dword_50B9FC_ys[3 + 45]; +int dword_50BA08_ys[48]; // idb +//int dword_50BAC4[777]; // weak int dword_50BAC8[777]; // idb -int dword_50BAD0[777]; // weak +//int dword_50BAD0[777]; // weak int dword_50BAD4[777]; // weak -int dword_50BADC_xs[777]; // weak +//int dword_50BADC_xs[777]; // weak int dword_50BAE0[777]; // weak int dword_50BAE8[777]; // weak -int dword_50BAEC_xs[777]; // weak -int dword_50BAF4[777]; // weak -int dword_50BAF8_xs[777]; // weak +int dword_50BAEC_xs[3 + 45]; // weak +//int dword_50BAF4[777]; // weak +int dword_50BAF8_xs[48]; // weak int dword_50BC10[777]; // weak int dword_50BDA0[777]; // weak int dword_50BF30[777]; // weak @@ -1976,9 +1993,9 @@ unsigned __int16 pOdmMinimap[117][137]; unsigned int uNumBlueFacesInBLVMinimap; unsigned __int16 pBlueFacesInBLVMinimapIDs[50]; -int pTextureIDs_isns[14]; -unsigned int uIconIdx_Spell21; -unsigned int uIconIdx_Spell27; +int pTextureIDs_PartyBuffIcons[14]; +unsigned int uIconIdx_FlySpell; +unsigned int uIconIdx_WaterWalk; int dword_576E28; // weak int dword_576E2C; // weak __int64 _5773B8_event_timer; // weak
--- a/mm7_data.h Wed Mar 06 18:22:07 2013 +0600 +++ b/mm7_data.h Wed Mar 06 18:22:25 2013 +0600 @@ -668,7 +668,7 @@ extern char aItem64v1[9]; // weak extern char aEffpar01[]; // idb extern int pPartySpellbuffsUI_XYs[14][2]; -extern char byte_4E5DD8[]; // weak +extern unsigned char byte_4E5DD8[]; // weak extern unsigned __int8 pPartySpellbuffsUI_smthns[14]; extern char aSpell27[]; // idb extern char aSpell21[]; // idb @@ -1191,10 +1191,10 @@ extern char bFlashHistoryBook; // weak extern char bFlashAutonotesBook; // weak extern char bFlashQuestBook; // weak -extern int dword_507960; // weak -extern int dword_507964; // weak -extern int dword_507968; // weak -extern int dword_50796C; // weak +extern int uTextureID_PlayerBuff_PainReflection; // weak +extern int uTextureID_PlayerBuff_Hammerhands; // weak +extern int uTextureID_PlayerBuff_Preservation; // weak +extern int uTextureID_PlayerBuff_Bless; // weak extern int uTextureID_Btn_QuickReference; // weak extern int dword_5079B4; // weak extern int dword_5079C8; // weak @@ -1218,36 +1218,38 @@ extern int dword_507C0C; // weak extern int dword_507CBC; // weak extern int dword_507CC0; // weak -extern __int64 qword_507CC8; // weak +extern __int64 GameUI_RightPanel_BookFlashTimer; // weak extern int _507CD4_RestUI_hourglass_anim_controller; // weak extern int dword_507CD8; // weak extern int dword_50B570[]; // weak extern int dword_50B638[]; // weak extern int dword_50B700; // weak extern int dword_50B738[]; // idb -extern int _50B744_view_transformed_ys[43]; +extern int _50B744_view_transformed_ys[]; extern int dword_50B828[]; -extern int _50B834_view_transformed_zs[43]; +extern int _50B834_view_transformed_zs[]; extern int dword_50B918[]; -extern int _50B924_view_transformed_xs[43]; -extern int unk_50B9D4[]; // idb +extern int _50B924_view_transformed_xs[]; +//extern int unk_50B9D4[]; // idb extern int dword_50B9D8_ys[]; -extern int dword_50B9E0_ys[]; // idb -extern int dword_50B9EC[]; // idb -extern int dword_50B9F0[2]; // idb -extern int dword_50BAE8_xs[]; -extern int dword_50BAF4_xs[]; -extern int dword_50B9F8[]; // idb -extern int dword_50BA08[]; // idb -extern int dword_50BAC4[]; // weak +extern int dword_50B9E4[]; +//extern int dword_50B9E0_ys[]; // idb +//extern int dword_50B9EC[]; // idb +extern int dword_50B9F0[]; // idb +//extern int dword_50BAE8_xs[]; +//extern int dword_50BAF4_xs[]; +//extern int dword_50B9F8_xs[]; // idb +extern int dword_50B9FC_ys[]; +extern int dword_50BA08_ys[]; // idb +//extern int dword_50BAC4[]; // weak extern int dword_50BAC8[]; // idb -extern int dword_50BAD0[]; // weak +//extern int dword_50BAD0[]; // weak extern int dword_50BAD4[]; // weak -extern int dword_50BADC_xs[]; // weak +//extern int dword_50BADC_xs[]; // weak extern int dword_50BAE0[]; // weak extern int dword_50BAE8[]; // weak extern int dword_50BAEC_xs[]; // weak -extern int dword_50BAF4[]; // weak +//extern int dword_50BAF4[]; // weak extern int dword_50BAF8_xs[]; // weak extern int dword_50BC10[]; // weak extern int dword_50BDA0[]; // weak @@ -1306,9 +1308,9 @@ extern unsigned __int16 pOdmMinimap[117][137]; extern unsigned int uNumBlueFacesInBLVMinimap; extern unsigned __int16 pBlueFacesInBLVMinimapIDs[50]; -extern int pTextureIDs_isns[14]; -extern unsigned int uIconIdx_Spell21; -extern unsigned int uIconIdx_Spell27; +extern int pTextureIDs_PartyBuffIcons[14]; +extern unsigned int uIconIdx_FlySpell; +extern unsigned int uIconIdx_WaterWalk; extern int dword_576E28; // weak extern int dword_576E2C; // weak extern __int64 _5773B8_event_timer; // weak @@ -1850,7 +1852,7 @@ void __cdecl GameMenuUI_DrawVideoOptions(); void __cdecl DrawGameOptions(); void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb -char *__cdecl DrawCopyrightWindow(); +void DrawCopyrightWindow(); void __cdecl GUI_UpdateWindows(); void __cdecl identify_item(); void __thiscall sub_416B01(void *_this); @@ -1877,7 +1879,6 @@ unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2); void __cdecl draw_leather(); -char __cdecl QuickRefDraw(); void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb void __cdecl GameUI_DrawRightPanelItems(); void __cdecl GameUI_DrawFoodAndGold(); @@ -1893,7 +1894,7 @@ void __cdecl GameUI_DrawStatusBar(); bool __thiscall sub_41CD4F(unsigned int _this); char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); -void GameUI_DrawItemInfo(struct ItemGen *_this); // idb +void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb char *__fastcall MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); void __cdecl nullsub_3(); // idb void __cdecl LoadActualSkyFrame(); @@ -1994,7 +1995,7 @@ bool sub_44100D(); void GameUI_DrawTorchlightAndWizardEye(); void GameUI_DrawCharacterSelectionFrame(); -void Load_isn_spells_21_27(); +void LoadPartyBuffIcons(); void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap);
--- a/stru123.h Wed Mar 06 18:22:07 2013 +0600 +++ b/stru123.h Wed Mar 06 18:22:25 2013 +0600 @@ -6,7 +6,7 @@ struct stru123 { char field_0[75]; - char _decor_events[125]; + unsigned char _decor_events[125]; }; #pragma pack(pop) extern stru123 stru_5E4C90; \ No newline at end of file
--- a/stru6.cpp Wed Mar 06 18:22:07 2013 +0600 +++ b/stru6.cpp Wed Mar 06 18:22:25 2013 +0600 @@ -741,11 +741,11 @@ //----- (004A81CA) -------------------------------------------------------- bool stru6::_4A81CA(SpriteObject *a2) { - stru6 *v2; // ebx@1 + //stru6 *v2; // ebx@1 int result; // eax@1 int v4; // eax@27 - unsigned int diffuse; // esi@41 - int v6; // ecx@49 + //unsigned int diffuse; // esi@41 + //int v6; // ecx@49 int v7; // eax@54 int v8; // eax@55 char v9; // zf@56 @@ -760,97 +760,172 @@ int v18; // eax@140 int v19; // eax@141 int v20; // eax@151 - unsigned int v21; // [sp-8h] [bp-20h]@66 - SpriteObject *v22; // [sp-8h] [bp-20h]@81 - unsigned int v23; // [sp-4h] [bp-1Ch]@4 - unsigned int v24; // [sp-4h] [bp-1Ch]@5 + //unsigned int v21; // [sp-8h] [bp-20h]@66 + //SpriteObject *v22; // [sp-8h] [bp-20h]@81 + //unsigned int v23; // [sp-4h] [bp-1Ch]@4 + //unsigned int v24; // [sp-4h] [bp-1Ch]@5 unsigned int v25; // [sp-4h] [bp-1Ch]@30 - unsigned int v26; // [sp-4h] [bp-1Ch]@57 - unsigned int v27; // [sp-4h] [bp-1Ch]@66 - int v28; // [sp-4h] [bp-1Ch]@81 - unsigned int v29; // [sp+0h] [bp-18h]@4 - unsigned int v30; // [sp+0h] [bp-18h]@5 - int v31; // [sp+0h] [bp-18h]@30 - unsigned int v32; // [sp+0h] [bp-18h]@45 - float v33; // [sp+0h] [bp-18h]@57 - float v34; // [sp+0h] [bp-18h]@66 - signed int v35; // [sp+0h] [bp-18h]@81 + //unsigned int v26; // [sp-4h] [bp-1Ch]@57 + //unsigned int v27; // [sp-4h] [bp-1Ch]@66 + //int v28; // [sp-4h] [bp-1Ch]@81 + //unsigned int v29; // [sp+0h] [bp-18h]@4 + //unsigned int v30; // [sp+0h] [bp-18h]@5 + //int v31; // [sp+0h] [bp-18h]@30 + //unsigned int v32; // [sp+0h] [bp-18h]@45 + //float v33; // [sp+0h] [bp-18h]@57 + //float v34; // [sp+0h] [bp-18h]@66 + //signed int v35; // [sp+0h] [bp-18h]@81 char pContainer[7]; // [sp+10h] [bp-8h]@81 - __debugbreak(); // need to refactor carefully & collect data - v2 = this; + //__debugbreak(); // need to refactor carefully & collect data + //v2 = this; result = a2->uType; - if ( result <= 545 ) + + switch (a2->uType) { - if ( result != 545 ) + case 545: + case 550: + case 555: return true; + + case 556: + AddMobileLight(a2, 0xFF0000, 256); + return false; + + case 600: + AddMobileLight(a2, 0xFF3C1E, 256); + return true; + + case 1010: // Fire Bolt + { + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); + AddMobileLight(a2, 0xFF3C1E, 256); + } + return false; + + case 1011: // Fire Bolt impact + { + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + AddMobileLight(a2, 0xFF3C1E, 256); + } + return false; + + case 1050: // Fireball + { + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); + AddMobileLight(a2, 0xFF3C1E, 256); + } + return false; + + case 1051: // Fireball hit { + AddMobileLight(a2, 0xFF3C1E, 256); + if (pRenderer->pRenderD3D) + { + result = a2->field_58_pid & 7; + if ((a2->field_58_pid & 7) != OBJECT_Actor && + (a2->field_58_pid & 7) != OBJECT_Item) + { + if (field_204 != 4) + { + field_204++; + _4A7688_fireball_collision_particle(a2); + } + return false; + } + } + } + return true; + + case 1081: + { + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 300.0); + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 250.0); + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 200.0); + AddMobileLight(a2, 0xFF3C1E, 256); + } + return false; + + case 2101: + { + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xC8C814, uTextureID_effpar1, 200.0); + AddMobileLight(a2, 0xC8C814, 256); + } + return false; + + case 3060: // Acid Burst + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0AB450, uTextureID_effpar1); + AddMobileLight(a2, 0x0AB450, 256); + return false; + + case 9000: return true; + } + + if ( result < 545 ) + { + __debugbreak(); // find out what kind of spells are these + result -= 500; switch ( result ) { case 0: case 30: - v29 = this->uTextureID_effpar1; - v23 = 0xAAAFFu; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xAAAFF, uTextureID_effpar1); + return false; case 1: case 31: - v30 = this->uTextureID_effpar1; - v24 = 0xAAAFFu; - goto LABEL_32; + _4A75CC_single_spell_collision_particle(a2, 0xAAAFF, uTextureID_effpar1); + return true; case 5: - v29 = this->uTextureID_effpar1; - v23 = 0x5C310Eu; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x5C310E, uTextureID_effpar1); + return false; case 10: - v29 = this->uTextureID_effpar1; - v23 = 0xFF3C1Eu; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); + return false; case 15: - v29 = this->uTextureID_effpar1; - v23 = 0x62D0u; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0062D0, uTextureID_effpar1); + return false; case 16: - v30 = this->uTextureID_effpar1; - v24 = 0x62D0u; - goto LABEL_32; + _4A75CC_single_spell_collision_particle(a2, 0x0062D0, uTextureID_effpar1); + return false; case 20: - v29 = this->uTextureID_effpar1; - v23 = 0xAB450u; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0AB450, uTextureID_effpar1); + return false; case 21: - v30 = this->uTextureID_effpar1; - v24 = 0xAB450u; - goto LABEL_32; + _4A75CC_single_spell_collision_particle(a2, 0x0AB450, uTextureID_effpar1); + return false; case 25: - v29 = this->uTextureID_effpar1; - v23 = 0xC8C805u; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xC8C805, uTextureID_effpar1); + return false; case 26: - v30 = this->uTextureID_effpar1; - v24 = 0xC8C805u; - goto LABEL_32; + _4A75CC_single_spell_collision_particle(a2, 0xC8C805, uTextureID_effpar1); + return false; case 35: - v29 = this->uTextureID_effpar1; - v23 = 0xFFFFFFu; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFFFFFF, uTextureID_effpar1); + return false; case 36: - v30 = this->uTextureID_effpar1; - goto LABEL_154; + _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar1); + return false; + case 40: - goto LABEL_17; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); + return false; + case 11: - goto LABEL_31; + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + return false; case 6: - goto LABEL_115; + _4A75CC_single_spell_collision_particle(a2, 0x5C310E, uTextureID_effpar1); + return false; + case 41: - goto LABEL_164; + _4A75CC_single_spell_collision_particle(a2, 0x7E7E7E, uTextureID_effpar1); + return false; default: - goto LABEL_168; + return false; } - goto LABEL_168; - } - goto LABEL_34; + return false; } + if ( result <= 4051 ) { if ( result != 4051 ) @@ -859,398 +934,285 @@ { if ( result != 2031 ) { - if ( result <= 1051 ) + if ( result < 1051 ) { - if ( result == 1051 ) - { - result = AddMobileLight(a2, 0xFF3C1Eu, 256);// fireball hit - if ( pRenderer->pRenderD3D ) - { - result = a2->field_58_pid & 7; - if ( result != 3 ) - { - if ( result != 2 ) - { - result = (bool)&v2->field_204; - v6 = v2->field_204; - if ( v6 != 4 ) - { - *(int *)result = v6 + 1; - _4A7688_fireball_collision_particle(a2); - } - goto LABEL_168; - } - } - } - goto LABEL_34; - } - if ( result <= 600 ) + if ( result < 600 ) { - if ( result == 600 ) - { - result = AddMobileLight(a2, 0xFF3C1Eu, 256); - goto LABEL_34; - } - result -= 550; - if ( !result ) - { -LABEL_34: - LOBYTE(result) = 1; - return result; - } - v4 = result - 1; - if ( v4 ) - { - result = v4 - 4; - if ( !result ) - goto LABEL_34; - --result; - if ( !result ) - { - v31 = 256; - v25 = 0xFF0000u; -LABEL_144: - result = AddMobileLight(a2, v25, v31); - goto LABEL_168; - } - goto LABEL_168; - } - goto LABEL_31; + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + return false; } if ( result < 811 ) - goto LABEL_168; + return false; if ( result <= 814 ) - goto LABEL_34; - if ( result == 1010 ) - goto LABEL_41; // fire strike - if ( result != 1011 ) - { - if ( result != 1050 ) - goto LABEL_168; -LABEL_41: - diffuse = 0xFF3C1Eu; -LABEL_42: - _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( - a2, - diffuse, - this->uTextureID_effpar1); -LABEL_43: - v31 = 256; -LABEL_44: - v25 = diffuse; - goto LABEL_144; - } - v32 = this->uTextureID_effpar1; - diffuse = 0xFF3C1Eu; -LABEL_146: - _4A75CC_single_spell_collision_particle(a2, diffuse, v32); - goto LABEL_43; + return true; + return false; + } if ( result <= 1081 ) { - if ( result == 1081 ) - { - diffuse = 0xFF3C1Eu; - _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning( - a2, - 0xFF3C1Eu, - this->uTextureID_effpar1, - 300.0); - _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning( - a2, - 0xFF3C1Eu, - v2->uTextureID_effpar1, - 250.0); - v33 = 200.0; - v26 = v2->uTextureID_effpar1; - } - else + if (result != 1081) { result -= 1060; if ( !result ) - goto LABEL_34; + return true; v7 = result - 1; if ( v7 ) { v8 = v7 - 9; if ( !v8 ) { -LABEL_31: - v30 = this->uTextureID_effpar1; - v24 = 0xFF3C1Eu; - goto LABEL_32; + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + return false; } result = v8 - 10; v9 = result == 0; -LABEL_129: +//LABEL_129: if ( v9 ) - goto LABEL_34; - goto LABEL_168; + return true; + return false; } - diffuse = 0xFF3C1Eu; - v33 = 250.0; - v26 = this->uTextureID_effpar1; + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 250.0); + AddMobileLight(a2, 0xFF3C1E, 256); + return false; } -LABEL_84: - _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, diffuse, v26, v33); - goto LABEL_43; +//LABEL_84: +// _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, diffuse, v26, v33); + //goto LABEL_43; + return false; } v10 = result - 1090; if ( v10 ) { result = v10 - 10; if ( !result ) - goto LABEL_34; + return true; v11 = result - 1; if ( !v11 ) { - diffuse = 0xFF3C1Eu; - _4A75CC_single_spell_collision_particle(a2, 0xFF3C1Eu, this->uTextureID_effpar1); - v32 = v2->uTextureID_effpar1; - goto LABEL_146; + //diffuse = 0xFF3C1E; + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + //v32 = v2->uTextureID_effpar1; + _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); + //goto LABEL_43; + AddMobileLight(a2, 0xFF3C1E, 256); + return false; } result = v11 - 929; if ( result ) - goto LABEL_168; -LABEL_63: + return false; +//LABEL_63: if ( !pRenderer->pRenderD3D ) - goto LABEL_34; + return true; _4A78AE_sparks_spell(a2); - v31 = 128; - v25 = 0x64640Fu; - goto LABEL_144; + AddMobileLight(a2, 0x64640F, 128); + return false; } - v34 = 250.0; - v27 = this->uTextureID_effpar1; - v21 = 0xFF3C1Eu; -LABEL_117: - _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, v21, v27, v34); - goto LABEL_168; + + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1Eu, uTextureID_effpar1, 250.0); + return false; } - goto LABEL_67; + //goto LABEL_67; } - if ( result <= 3060 ) + if ( result < 3060 ) { - if ( result == 3060 ) - goto LABEL_171; // acid burst - if ( result <= 2101 ) + if ( result < 2101 ) { - if ( result == 2101 ) - { - v33 = 200.0; - v26 = this->uTextureID_effpar1; - goto LABEL_83; - } if ( result != 2060 ) { if ( result != 2061 ) { if ( result <= 2079 ) - goto LABEL_168; + return false; if ( result <= 2081 ) { if ( pRenderer->pRenderD3D ) _4A77FD_some_stuff_d3d(a2); else _4A80DC_some_stuff_sw(a2); - goto LABEL_168; + return false; } v9 = result == 2100; - goto LABEL_129; + if ( v9 ) + return true; + return false; } -LABEL_67: - v33 = 200.0; - v26 = this->uTextureID_effpar2; -LABEL_83: - diffuse = (unsigned int)&pDecalBuilder->std__vector_pDecals[557].pVertices[57].vWorldViewPosition.y; - goto LABEL_84; + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xC8C814, uTextureID_effpar2, 200.0); + AddMobileLight(a2, 0xC8C814, 256); + return false; } if ( !pRenderer->pRenderD3D ) - goto LABEL_34; + return true; memcpy(pContainer, "sp18h1", 7); pRnd->SetRange(1, 6); pContainer[5] = pRnd->GetInRange() + '0'; - v35 = pBitmaps_LOD->LoadTexture(pContainer, TEXTURE_DEFAULT); - v28 = 100; - v22 = a2; -LABEL_157: - AddProjectile(v22, v28, v35); - goto LABEL_168; + AddProjectile(a2, 100, pBitmaps_LOD->LoadTexture(pContainer)); + return false; } v12 = result - 3010; if ( !v12 ) { -LABEL_171: - diffuse = 0xAB450u; - goto LABEL_42; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xAB450, uTextureID_effpar1); + AddMobileLight(a2, 0xAB450, 256); + return false; } v13 = v12 - 1; if ( !v13 ) { - v32 = this->uTextureID_effpar1; - diffuse = 0xAB450u; - goto LABEL_146; + _4A75CC_single_spell_collision_particle(a2, 0xAB450, uTextureID_effpar1); + AddMobileLight(a2, 0xAB450, 256); + return false; } result = v13 - 19; if ( !result ) - goto LABEL_34; + return true; --result; if ( result ) - goto LABEL_168; -LABEL_89: - v32 = this->uTextureID_effpar1; - diffuse = 0x9EB9F1u; - goto LABEL_146; + return false; + + _4A75CC_single_spell_collision_particle(a2, 0x9EB9F1, uTextureID_effpar1); + AddMobileLight(a2, 0x9EB9F1, 256); + return false; } if ( result > 4000 ) { result -= 4030; if ( !result || (--result, !result) ) - goto LABEL_34; + return true; result -= 19; v9 = result == 0; - goto LABEL_129; + if ( v9 ) + return true; + return false; } if ( result == 4000 ) { if ( !pRenderer->pRenderD3D ) - goto LABEL_34; + return true; _4A7C07(a2); - goto LABEL_168; + return false; } result -= 3061; if ( !result || (result -= 29) == 0 ) - goto LABEL_34; + return true; v14 = result - 1; if ( !v14 ) - goto LABEL_89; + { + _4A75CC_single_spell_collision_particle(a2, 0x9EB9F1, uTextureID_effpar1); + AddMobileLight(a2, 0x9EB9F1, 256); + return false; + } result = v14 - 1; if ( result ) - goto LABEL_168; - v29 = this->uTextureID_effpar1; - v23 = 0x9EB9F1u; -LABEL_8: - _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, v23, v29); - goto LABEL_168; + return false; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x9EB9F1, uTextureID_effpar1); + return false; } - goto LABEL_122; + _4A7948_mind_blast_after_effect(a2); + return false; } if ( result <= 7090 ) { if ( result == 7090 ) - goto LABEL_34; + return true; if ( result > 6030 ) { if ( result > 6091 ) { result -= 6100; if ( !result ) - goto LABEL_34; + return true; result -= 930; if ( result ) { --result; - if ( result ) - goto LABEL_168; - v30 = this->uTextureID_effpar1; - v24 = 0xF00000u; - goto LABEL_32; + if (!result) + _4A75CC_single_spell_collision_particle(a2, 0xF00000, uTextureID_effpar1); + return false; } - goto LABEL_63; + if ( !pRenderer->pRenderD3D ) + return true; + _4A78AE_sparks_spell(a2); + AddMobileLight(a2, 0x64640F, 128); + return false; } if ( result != 6091 ) { result -= 6040; if ( !result || (result -= 20) == 0 || (result -= 10) == 0 ) - goto LABEL_34; + return true; result -= 20; v9 = result == 0; - goto LABEL_129; + if ( v9 ) + return true; + return false; } } else { if ( result == 6030 ) - goto LABEL_34; + return true; if ( result <= 4091 ) { if ( result != 4091 ) { result -= 4070; if ( !result ) - goto LABEL_34; + return true; v15 = result - 1; if ( v15 ) { result = v15 - 9; if ( !result ) - goto LABEL_34; + return true; result -= 10; if ( !result ) { - _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( - a2, - 0x7E7E7Eu, - this->uTextureID_effpar1); - goto LABEL_34; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); + return true; } - goto LABEL_168; + return false; } -LABEL_115: - v30 = this->uTextureID_effpar1; - v24 = 0x5C310Eu; -LABEL_32: - _4A75CC_single_spell_collision_particle(a2, v24, v30); - goto LABEL_168; + _4A75CC_single_spell_collision_particle(a2, 0x5C310E, uTextureID_effpar1); + return false; } - v34 = 200.0; - v27 = this->uTextureID_effpar1; - v21 = 0x7E7E7Eu; - goto LABEL_117; + _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0x7E7E7E, uTextureID_effpar1, 200.0); + return false; } v16 = result - 4092; if ( !v16 ) { -LABEL_17: - v29 = this->uTextureID_effpar1; - v23 = 0x7E7E7Eu; - goto LABEL_8; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); + return false; } result = v16 - 8; if ( !result ) - goto LABEL_168; + return false; result -= 1910; if ( !result ) - goto LABEL_34; + return true; --result; if ( result ) - goto LABEL_168; + return false; } -LABEL_122: +//LABEL_122: _4A7948_mind_blast_after_effect(a2); - goto LABEL_168; + return false; } if ( result <= 9000 ) { - if ( result == 9000 ) - goto LABEL_34; if ( result <= 8030 ) { if ( result == 8030 ) - goto LABEL_34; + return true; v17 = result - 7091; if ( v17 ) { v18 = v17 - 909; if ( !v18 ) { - diffuse = 0xFFFFFFu; - _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc( - a2, - 0xFFFFFFu, - this->uTextureID_effpar3); - v31 = 128; - goto LABEL_44; + _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFFFFFF, uTextureID_effpar3); + AddMobileLight(a2, 0xFFFFFF, 128); + return false; } v19 = v18 - 1; if ( v19 ) @@ -1258,64 +1220,59 @@ result = v19 - 9; if ( !result ) { - v31 = 64; - v25 = 0xFFFFFFu; - goto LABEL_144; + AddMobileLight(a2, 0xFFFFFF, 64); + return false; } - goto LABEL_168; + return false; } - v32 = this->uTextureID_effpar2; - diffuse = 0xFFFFFFu; + _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar2); + AddMobileLight(a2, 0xFFFFFF, 256); + return false; } else { - v32 = this->uTextureID_effpar1; - diffuse = 0xF00000u; + _4A75CC_single_spell_collision_particle(a2, 0xF00000, uTextureID_effpar1); + AddMobileLight(a2, 0xF00000, 256); + return false; } - goto LABEL_146; } result -= 8040; if ( !result || (result -= 20) == 0 ) - goto LABEL_34; + return true; v20 = result - 30; if ( v20 ) { result = v20 - 1; if ( result ) - goto LABEL_168; - v30 = this->uTextureID_effpar3; -LABEL_154: - v24 = 16777215; - goto LABEL_32; + return false; + + _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar3); + return false; } - result = AddMobileLight(a2, 0xFFFFFFu, 128); + AddMobileLight(a2, 0xFFFFFFu, 128); if ( !pRenderer->pRenderD3D ) - goto LABEL_34; - v35 = -1; - v28 = 100; - v22 = a2; - goto LABEL_157; + return true; + AddProjectile(a2, 100, -1); + return false; } if ( result > 9050 ) { result -= 9070; if ( !result || (result -= 10) == 0 || (--result, !result) ) - goto LABEL_34; - goto LABEL_168; + return true; + return false; } if ( result == 9050 || (result -= 9010) == 0 || (result -= 20) == 0 || (result -= 10) == 0 ) - goto LABEL_34; + return true; --result; if ( !result ) { -LABEL_164: - v30 = this->uTextureID_effpar1; - v24 = 0x7E7E7Eu; - goto LABEL_32; +//LABEL_164: + _4A75CC_single_spell_collision_particle(a2, 0x7E7E7E, uTextureID_effpar1); + return false; } -LABEL_168: - LOBYTE(result) = 0; - return result; +//LABEL_168: + return false; } //----- (004A89BD) --------------------------------------------------------