Mercurial > mm7
changeset 599:deb559e4fe47
Merge
author | Gloval |
---|---|
date | Wed, 06 Mar 2013 22:47:21 +0400 |
parents | f8a4a2e0b4c9 (current diff) c03428cb4119 (diff) |
children | db4a23580e6c |
files | Party.cpp mm7_2.cpp mm7_data.h |
diffstat | 19 files changed, 1572 insertions(+), 1331 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/AudioPlayer.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -90,7 +90,7 @@ if ( pSoundList->pSounds[v2].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName), pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID), !pAudioPlayer->b3DSoundInitialized) - || (pSoundDesc = &pSoundList->pSounds[v2], !(pSoundDesc->uFlags & 2)) + || (pSoundDesc = &pSoundList->pSounds[v2], !(pSoundDesc->uFlags & SOUND_DESC_SWAP)) || !pSoundDesc->pSoundData[0] ) // нужно перевернуть goto LABEL_17; pSoundData = pSoundDesc->pSoundData[0]; @@ -163,8 +163,8 @@ if (!pSound) return 0; - if (pSound->uFlags & 2 && pSound->p3DSound || - ~pSound->uFlags & 2 && pSound->pSoundData[0]) + if (pSound->uFlags & SOUND_DESC_SWAP && pSound->p3DSound || + ~pSound->uFlags & SOUND_DESC_SWAP && pSound->pSoundData[0]) return uSoundIdx; if (!pSound->pSoundData[0]) @@ -174,12 +174,12 @@ return 0; if (a3) - pSound->uFlags |= 1u; + pSound->uFlags |= SOUND_DESC_SYSTEM; if (!pAudioPlayer->b3DSoundInitialized) return uSoundIdx; - if (~pSound->uFlags & 2 || !pSound->pSoundData[0]) + if (~pSound->uFlags & SOUND_DESC_SWAP || !pSound->pSoundData[0]) return uSoundIdx; @@ -368,7 +368,7 @@ ReleaseSoundData(v7); v2->pSounds[v3].pSoundData[0] = 0; } - v2->pSounds[v3].uFlags &= 0xFFFFFFFEu; + v2->pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM; } ++i; } @@ -387,19 +387,19 @@ v5 = &this->pSounds[uSoundID]; if ( v5->eType != SOUND_DESC_SYSTEM ) { - if ( v5->uFlags & 2 && v5->p3DSound && a3 ) + if ( v5->uFlags & SOUND_DESC_SWAP && v5->p3DSound && a3 ) { if ( LOBYTE(v5->bDecompressed) ) AIL_mem_free_lock(v5->p3DSound); pSounds[v3].p3DSound = 0; - pSounds[v3].uFlags &= 0xFFFFFFFEu; + pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM; } v6 = pSounds[v3].pSoundData[0]; if ( v6 ) { ReleaseSoundData(v6); pSounds[v3].pSoundData[0] = 0; - pSounds[v3].uFlags &= 0xFFFFFFFEu; + pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM; } } } @@ -521,7 +521,7 @@ if ( v19.field_0 >= 4 && !_strcmpi(v19.pProperties[3], "3D") ) { v15 = (int)&v2->pSounds[v2->uNumSounds].uFlags; - *(int *)v15 |= 2u; + *(int *)v15 |= SOUND_DESC_SWAP; } ++v2->uNumSounds; } @@ -1743,7 +1743,7 @@ auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID]; //v49 = v48->uFlags; - uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & 0x40) >> 6; + uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_SLOW_LOOP) >> 6; if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk()) { @@ -2231,7 +2231,7 @@ v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx]; if ( v4->eType == SOUND_DESC_SWAP) { - if ( v4->pSoundData[0] && !(v4->uFlags & 1) ) + if ( v4->pSoundData[0] && !(v4->uFlags & SOUND_DESC_SYSTEM) ) { v5 = this->uMixerChannels == 0; v6 = this->uMixerChannels < 0; @@ -2371,7 +2371,7 @@ v4 = &pSoundList->pSounds[a2->field_8]; if ( v4->eType == SOUND_DESC_SWAP) { - if ( v4->p3DSound && !(v4->uFlags & 1) ) + if ( v4->p3DSound && !(v4->uFlags & SOUND_DESC_SYSTEM) ) { v5 = this->uNum3DSamples == 0; v6 = this->uNum3DSamples < 0;
--- a/Chest.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/Chest.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -613,7 +613,7 @@ if(test_position<uChestArea) { Chest::PlaceItemAt((unsigned __int8)chest_cells_map[test_position], items_counter, uChestID); - if ( pChests[uChestID].uFlags & 4 ) + if ( pChests[uChestID].uFlags & CHEST_OPENED) pChests[uChestID].igChestItems[items_counter].SetIdentified(); } }
--- a/Game.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/Game.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -611,7 +611,7 @@ } else { - if ( uFlags2 & 0x10 ) + if ( uFlags2 & GAME_FLAGS_2_TARGETING_MODE ) { v11 = &vis_face_filter; v10 = &vis_sprite_filter_1;
--- a/Game.h Wed Mar 06 22:46:40 2013 +0400 +++ b/Game.h Wed Mar 06 22:47:21 2013 +0400 @@ -16,6 +16,11 @@ +#define GAME_FLAGS_2_SATURATE_LIGHTMAPS 0x02 +#define GAME_FLAGS_2_ALTER_GRAVITY 0x08 +#define GAME_FLAGS_2_TARGETING_MODE 0x10 +#define GAME_FLAGS_2_DRAW_BLOODSPLATS 0x20 + /* 320 */
--- a/Indoor.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/Indoor.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -372,20 +372,19 @@ _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; @@ -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,11 @@ 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 & 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 ) @@ -581,17 +558,18 @@ } else if (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 & FACE_DO_NOT_LIGHT) + _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); + else + pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0); + return; } + //v17 = 0xFFFFFFFF; + v23 = pFace->uBitmapID; + goto LABEL_42; } } }
--- a/Indoor.h Wed Mar 06 22:46:40 2013 +0400 +++ b/Indoor.h Wed Mar 06 22:47:21 2013 +0400 @@ -257,6 +257,7 @@ #define FACE_TEXTURE_FRAME 0x00004000 // Texture ID is a frameset from TextureFrameTable, otherwise BitmapID #define FACE_OUTLINED 0x00010000 // outline face edges #define FACE_TEXTURE_FLOW 0x00040000 // The texture moves slowly. For horizontal facets only. +#define FACE_DO_NOT_LIGHT 0x00400000 #define FACE_CLICKABLE 0x02000000 // Event can be triggered by clicking on the facet. #define FACE_PRESSURE_PLATE 0x04000000 // Event can be triggered by stepping on the facet. #define FACE_ETHEREAL 0x20000000 // Untouchable. You can pass through it.
--- a/LightmapBuilder.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/LightmapBuilder.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -1621,7 +1621,7 @@ { //v30 = 0.0; //v4 = pRenderer->pRenderD3D->pDevice; - ErrD3D(v4->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); //v6 = (char *)stru_69BD44.c_str(); //if ( !stru_69BD44.c_str() ) // v6 = (char *)&dword_4D86F0;
--- a/MM7.vcxproj.filters Wed Mar 06 22:46:40 2013 +0400 +++ b/MM7.vcxproj.filters Wed Mar 06 22:47:21 2013 +0400 @@ -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/ParticleEngine.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/ParticleEngine.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -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 22:46:40 2013 +0400 +++ b/Party.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -198,38 +198,31 @@ //----- (00492AD5) -------------------------------------------------------- -__int16 Party::SetFood(unsigned int uNumFood) +void Party::SetFood(unsigned int uNumFood) { - __int16 result; // ax@1 - pUIAnim_Food->uAnimTime = 0; pParty->uNumFoodRations = uNumFood; - result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; - return result; + pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; } //----- (00492B03) -------------------------------------------------------- void Party::TakeFood(unsigned int uNumFood) { - if ( ((pParty->uNumFoodRations - uNumFood) & 0x80000000u) == 0 ) - pParty->uNumFoodRations -= uNumFood; + if (pParty->uNumFoodRations <= uNumFood) + pParty->uNumFoodRations = 0; else - pParty->uNumFoodRations = 0; + pParty->uNumFoodRations -= uNumFood; + pUIAnim_Food->uAnimTime = 0; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; } //----- (00492B42) -------------------------------------------------------- -__int16 Party::GiveFood(unsigned int _this) +void Party::GiveFood(unsigned int _this) { - __int16 result; // ax@1 - pParty->uNumFoodRations += _this; pUIAnim_Food->uAnimTime = 0; - result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength; - return result; + pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; } //----- (00492B70) -------------------------------------------------------- @@ -237,7 +230,7 @@ { pParty->uNumGold = uNumGold; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); } @@ -249,7 +242,7 @@ else pParty->uNumGold = 0; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); }
--- a/Party.h Wed Mar 06 22:46:40 2013 +0400 +++ b/Party.h Wed Mar 06 22:47:21 2013 +0400 @@ -180,9 +180,9 @@ static void SetGold(unsigned int uNumGold); static void TakeGold(unsigned int uNumGold); - static __int16 SetFood(unsigned int uNumFood); + static void SetFood(unsigned int uNumFood); static void TakeFood(unsigned int uNumFood); - static __int16 GiveFood(unsigned int _this); + static void GiveFood(unsigned int _this); inline bool WizardEyeActive() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;} inline int WizardEyeSkillLevel() {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;}
--- a/Render.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/Render.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -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; @@ -7801,14 +7800,14 @@ double v17; // st6@10 //char v18; // zf@10 Texture *v19; // edx@10 - Texture *v23; // edx@16 - char *v24; // ecx@16 - char *v25; // eax@16 - double v26; // st6@17 - int v27; // esi@17 - double v28; // st6@17 - unsigned int v33; // ecx@18 - char *v34; // eax@19 + //Texture *v23; // edx@16 + //char *v24; // ecx@16 + //char *v25; // eax@16 + //double v26; // st6@17 + //int v27; // esi@17 + //double v28; // st6@17 + //unsigned int v33; // ecx@18 + //char *v34; // eax@19 //Texture *v45; // edx@23 //char *v46; // ecx@23 //char *v47; // eax@23 @@ -7909,36 +7908,47 @@ } else { - __debugbreak(); - if ( (signed int)uNumVertices > 0 ) - { - v23 = pTex; - v24 = (char *)&array_507D30[0].vWorldViewPosition; - v25 = (char *)&d3d_vertex_buffer[0].pos.y; - pTex = (Texture *)uNumVertices; - uint v18; - do - { - v26 = *(float *)v24 * 0.061758894; - v27 = *((int *)v24 + 3); - *((int *)v25 + 4) = 0; - *((int *)v25 - 1) = v27; - *(int *)v25 = *((int *)v24 + 4); - *((int *)v25 + 3) = uColor; - v25 += 32; - *((float *)v25 - 7) = 1.0 - 1.0 / v26; - v28 = 1.0 / *(float *)v24; - v24 += 48; - v18 = pTex == (Texture *)1; - pTex = (Texture *)((char *)pTex - 1); - *((float *)v25 - 6) = v28; + for (uint i = 0; i < uNumVertices; ++i) + { + d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; + d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); + d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; + d3d_vertex_buffer[i].diffuse = uColor; + d3d_vertex_buffer[i].specular = 0; + d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; + d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; + } + //__debugbreak(); + //if ( (signed int)uNumVertices > 0 ) + //{ + //v23 = pTex; + //v24 = (char *)&array_507D30[0].vWorldViewPosition; + //v25 = (char *)&d3d_vertex_buffer[0].pos.y; + //pTex = (Texture *)uNumVertices; + //uint v18; + //do + //{ + //v26 = *(float *)v24 * 0.061758894; + //v27 = *((int *)v24 + 3); + //*((int *)v25 + 4) = 0; + //*((int *)v25 - 1) = v27; + //*(int *)v25 = *((int *)v24 + 4); + //*((int *)v25 + 3) = uColor; + //v25 += 32; + //*((float *)v25 - 7) = 1.0 - 1.0 / v26; + //v28 = 1.0 / *(float *)v24; + //v24 += 48; + //v18 = pTex == (Texture *)1; + //pTex = (Texture *)((char *)pTex - 1); + //*((float *)v25 - 6) = v28; //a3 = (BLVFace *)v23->uTextureWidth; - *((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; + //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; //a3 = (BLVFace *)v23->uTextureHeight; - *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; - } - while ( !v18 ); - } + //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; + //} + //while ( !v18 ); + //} ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); @@ -7947,9 +7957,13 @@ d3d_vertex_buffer, uNumVertices, 28)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); + + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); - v33 = uNumVertices; + + for (uint i = 0; i < uNumVertices; ++i) + d3d_vertex_buffer[i].diffuse = uCorrectedColor; + /*v33 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { v34 = (char *)&d3d_vertex_buffer[0].diffuse; @@ -7960,7 +7974,7 @@ --v33; } while ( v33 ); - } + }*/ ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
--- a/StorylineTextTable.h Wed Mar 06 22:46:40 2013 +0400 +++ b/StorylineTextTable.h Wed Mar 06 22:47:21 2013 +0400 @@ -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 22:46:40 2013 +0400 +++ b/mm7_1.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -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; } @@ -1205,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 ) { @@ -1217,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(); @@ -1226,20 +1223,20 @@ 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 @@ -1321,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( @@ -1386,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 ) @@ -1939,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) -------------------------------------------------------- @@ -2416,7 +2435,13 @@ v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" - goto LABEL_116; + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; } if (!inspect_item->Identified()) { @@ -2434,7 +2459,13 @@ v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3); - goto LABEL_116; + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; } sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s" @@ -2479,37 +2510,35 @@ 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->uEnchantmentType ) + sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"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 (item_desc->uEquipType==EQUIP_POTION) - { - if ( inspect_item->uEnchantmentType ) - sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" - } - else if (item_desc->uEquipType== EQUIP_REAGENT) - {sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power" - } - else if ( inspect_item->uEnchantmentType ) - { - sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], - pItemsTable->pEnchantments[inspect_item->uEnchantmentType-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); - } + if ( !v77 ) + { + //v23 = item_desc->uEquipType; + if ( inspect_item->uEnchantmentType ) + { + sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], + pItemsTable->pEnchantments[inspect_item->uEnchantmentType-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" - - } - -LABEL_65: + 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; @@ -2643,7 +2672,15 @@ else { if ( !(BYTE1(v38) & 2) ) - goto LABEL_116; + { + pRenderer->ResetClip(); + if ( !areWeLoadingTexture ) + { + v73->Release(); + pIcons_LOD->_40F9C5(); + } + return; + } v61 = 0; v56 = 0; v51 = 0; @@ -2657,7 +2694,6 @@ v41 = v39 + 132; } wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); -LABEL_116: pRenderer->ResetClip(); if ( !areWeLoadingTexture ) { @@ -3156,132 +3192,139 @@ v74 = 0; v69 = 0; v66 = pGlobalTXT_LocalizationStrings[630]; - goto LABEL_123; + a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78); } - a4 = 0; - v51 = &v121->pActorBuffs[1]; - v222 = 0; - v120 = &v121->pActorBuffs[1]; - do + else { - if ( (signed __int64)v51->uExpireTime > 0 ) - { - switch ( (int)v51 ) - { - case 0u: - v124 = 60; - a4 = pGlobalTXT_LocalizationStrings[591]; - break; - case 1u: - v124 = 82; - a4 = pGlobalTXT_LocalizationStrings[649]; - break; - case 2u: - v124 = 92; - a4 = pGlobalTXT_LocalizationStrings[592]; - break; - case 3u: - v124 = 63; - a4 = pGlobalTXT_LocalizationStrings[4]; - break; - case 4u: - v52 = pGlobalTXT_LocalizationStrings[220]; - goto LABEL_100; - case 5u: - v52 = pGlobalTXT_LocalizationStrings[162]; -LABEL_100: - a4 = v52; - v124 = 81; - break; - case 6u: - v53 = pGlobalTXT_LocalizationStrings[593]; - v124 = 35; - goto LABEL_103; - case 8u: - v53 = pGlobalTXT_LocalizationStrings[608]; - v124 = 62; -LABEL_103: - a4 = v53; - break; - case 7u: - case 9u: - a4 = 0; - v124 = 0; - goto LABEL_119; - case 0xAu: - v124 = 47; - a4 = pGlobalTXT_LocalizationStrings[221]; - break; - case 0xBu: - v124 = 66; - a4 = pGlobalTXT_LocalizationStrings[607]; - break; - case 0xCu: - v124 = 85; - a4 = pGlobalTXT_LocalizationStrings[610]; - break; - case 0xDu: - v124 = 86; - a4 = pGlobalTXT_LocalizationStrings[609]; - break; - case 0xEu: - v124 = 17; - a4 = pGlobalTXT_LocalizationStrings[279]; - break; - case 0xFu: - v124 = 38; - a4 = pGlobalTXT_LocalizationStrings[442]; - break; - case 0x10u: - v124 = 46; - a4 = pGlobalTXT_LocalizationStrings[443]; - break; - case 0x11u: - v124 = 51; - a4 = pGlobalTXT_LocalizationStrings[440]; - break; - case 0x12u: - v124 = 5; - a4 = pGlobalTXT_LocalizationStrings[441]; - break; - case 0x13u: - v124 = 95; - a4 = pGlobalTXT_LocalizationStrings[229]; - break; - case 0x14u: - v124 = 73; - a4 = pGlobalTXT_LocalizationStrings[228]; - break; - default: - a4 = 0; - break; - } - if ( a4 ) - { - v54 = a4; - v55 = GetSpellColor(v124); - a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); - v50 = v50 + BYTE5(a2->pConditions[0]) - 3; - v51 = v120; - } - } -LABEL_119: - ++v51; - v222 = (IDirectDrawSurface *)((char *)v222 + 1); - v120 = v51; - - __debugbreak(); // fix condition - } - //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); - while (true); - if ( !a4 ) - { - v78 = 0; - v74 = 0; - v69 = 0; - v66 = pGlobalTXT_LocalizationStrings[153]; -LABEL_123: - a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78); + a4 = 0; + v51 = &v121->pActorBuffs[1]; + v222 = 0; + v120 = &v121->pActorBuffs[1]; + do + { + if ( (signed __int64)v51->uExpireTime > 0 ) + { + switch ( (int)v51 ) + { + case 0u: + v124 = 60; + a4 = pGlobalTXT_LocalizationStrings[591]; + break; + case 1u: + v124 = 82; + a4 = pGlobalTXT_LocalizationStrings[649]; + break; + case 2u: + v124 = 92; + a4 = pGlobalTXT_LocalizationStrings[592]; + break; + case 3u: + v124 = 63; + a4 = pGlobalTXT_LocalizationStrings[4]; + break; + case 4u: + v52 = pGlobalTXT_LocalizationStrings[220]; + a4 = v52; + v124 = 81; + break; + case 5u: + v52 = pGlobalTXT_LocalizationStrings[162]; + a4 = v52; + v124 = 81; + break; + case 6u: + v53 = pGlobalTXT_LocalizationStrings[593]; + v124 = 35; + a4 = v53; + break; + case 8u: + v53 = pGlobalTXT_LocalizationStrings[608]; + v124 = 62; + a4 = v53; + break; + case 7u: + case 9u: + a4 = 0; + v124 = 0; + ++v51; + v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v120 = v51; + __debugbreak(); // fix condition + continue; + case 0xAu: + v124 = 47; + a4 = pGlobalTXT_LocalizationStrings[221]; + break; + case 0xBu: + v124 = 66; + a4 = pGlobalTXT_LocalizationStrings[607]; + break; + case 0xCu: + v124 = 85; + a4 = pGlobalTXT_LocalizationStrings[610]; + break; + case 0xDu: + v124 = 86; + a4 = pGlobalTXT_LocalizationStrings[609]; + break; + case 0xEu: + v124 = 17; + a4 = pGlobalTXT_LocalizationStrings[279]; + break; + case 0xFu: + v124 = 38; + a4 = pGlobalTXT_LocalizationStrings[442]; + break; + case 0x10u: + v124 = 46; + a4 = pGlobalTXT_LocalizationStrings[443]; + break; + case 0x11u: + v124 = 51; + a4 = pGlobalTXT_LocalizationStrings[440]; + break; + case 0x12u: + v124 = 5; + a4 = pGlobalTXT_LocalizationStrings[441]; + break; + case 0x13u: + v124 = 95; + a4 = pGlobalTXT_LocalizationStrings[229]; + break; + case 0x14u: + v124 = 73; + a4 = pGlobalTXT_LocalizationStrings[228]; + break; + default: + a4 = 0; + break; + } + if ( a4 ) + { + v54 = a4; + v55 = GetSpellColor(v124); + a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); + v50 = v50 + BYTE5(a2->pConditions[0]) - 3; + v51 = v120; + } + } + + ++v51; + v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v120 = v51; + + __debugbreak(); // fix condition + } + //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); + while (true); + if ( !a4 ) + { + v78 = 0; + v74 = 0; + v69 = 0; + v66 = pGlobalTXT_LocalizationStrings[153]; + a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78); + } } v56 = pFontSmallnum; a4 = (char *)v106.uViewportY; @@ -3348,42 +3391,47 @@ v76 = 0; v71 = pGlobalTXT_LocalizationStrings[628]; v68 = "%s\f%05u\t080%s\n"; - goto LABEL_144; - } - v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628]; - v59 = v121; - v114 = v121->pMonsterInfo.uSpell1ID; - if ( v114 && v121->pMonsterInfo.uSpell2ID ) - v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629]; - if ( v114 ) - { - sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName); - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; - v59 = v121; - } - v60 = v59->pMonsterInfo.uSpell2ID; - if ( v60 ) - { - sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName); - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; - v59 = v121; - } - if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) - { - v80 = pGlobalTXT_LocalizationStrings[153]; - v76 = 0; - v71 = pGlobalTXT_LocalizationStrings[628]; - v68 = "%s\f%05u\t060%s\n"; -LABEL_144: sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); a4 = &a4[v58 - 3]; } + else + { + v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628]; + v59 = v121; + v114 = v121->pMonsterInfo.uSpell1ID; + if ( v114 && v121->pMonsterInfo.uSpell2ID ) + v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629]; + if ( v114 ) + { + sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName); + a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); + v58 = LOBYTE(v56->uFontHeight); + a4 = &a4[v58 - 3]; + v59 = v121; + } + v60 = v59->pMonsterInfo.uSpell2ID; + if ( v60 ) + { + sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName); + a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); + v58 = LOBYTE(v56->uFontHeight); + a4 = &a4[v58 - 3]; + v59 = v121; + } + if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) + { + v80 = pGlobalTXT_LocalizationStrings[153]; + v76 = 0; + v71 = pGlobalTXT_LocalizationStrings[628]; + v68 = "%s\f%05u\t060%s\n"; + sprintf(pTmpBuf, v68, v71, v76, v80); + a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); + v58 = LOBYTE(v56->uFontHeight); + a4 = &a4[v58 - 3]; + } + } a4 = &a4[v58 - 3]; a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; @@ -4286,9 +4334,131 @@ return; } v1 = uNumVisibleWindows; - if ( uNumVisibleWindows <= 0 ) + if ( uNumVisibleWindows > 0 ) { -LABEL_38: + while ( 1 ) // some other fullscreen ui + { + pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; + if ( (signed int)pX >= (signed int)pWindow->uFrameX + && (signed int)pX <= (signed int)pWindow->uFrameZ + && (signed int)pY >= (signed int)pWindow->uFrameY + && (signed int)pY <= (signed int)pWindow->uFrameW ) + { + for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) + { + if ( !pButton ) + break; + if ( pButton->uButtonType == 1 ) + { + if ( (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 ) + { + //LABEL_24: + pMessageType1 = (UIMessageType)pButton->field_1C; + if ( pMessageType1 ) + { + v12 = pButton->uControlParam; + pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + //LABEL_27: + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + } + //LABEL_28: + v13 = pButton->pButtonName; + //_set_status_and_ret: + sub_41C0B8_set_status_string(v13); + //LABEL_131: + uLastPointedObjectID = 1; + return; + } + } + else + { + if ( pButton->uButtonType == 2 ) + { + v45 = pX - pButton->uX; + v45 = pY - pButton->uY; + if ( (double)(signed int)pButton->uWidth != 0.0 ) + { + if ( (double)(signed int)pButton->uHeight != 0.0 ) + { + //UNDEF(v8); + //if ( v9 | v10 ) + //goto LABEL_24; + //{ + pMessageType1 = (UIMessageType)pButton->field_1C; + if ( pMessageType1 ) + { + v12 = pButton->uControlParam; + pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + } + v13 = pButton->pButtonName; + sub_41C0B8_set_status_string(v13); + uLastPointedObjectID = 1; + return; + //} + } + } + } + else // click on skill + { + if ( 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 ) + { + //LABEL_19: + pPlayer = pPlayers[uActiveCharacter]; + v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]); + v6 = pPlayer->uSkillPoints; + v7 = (v5 & 0x3F) + 1; + if ( v6 < v7 ) + { + v41 = v7 - v6; + v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" + } + else + { + v41 = v7; + v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" + } + sprintf(Str1, v39, v41); + v13 = Str1; + //goto _set_status_and_ret; + sub_41C0B8_set_status_string(v13); + uLastPointedObjectID = 1; + return; + } + } + } + } + } + if ( pWindow->uFrameHeight == 480 ) + break; + --v1; + if ( v1 <= 0 ) + { + break; + } + } + } + if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0)) + { if ( pCurrentScreen == SCREEN_CHEST ) { sub_42038D(); @@ -4501,126 +4671,6 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - while ( 1 ) // some other fullscreen ui - { - pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX - && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY - && (signed int)pY <= (signed int)pWindow->uFrameW ) - { - for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) - { - if ( !pButton ) - break; - if ( pButton->uButtonType == 1 ) - { - if ( (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 ) - { -//LABEL_24: - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - { - v12 = pButton->uControlParam; - pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; -//LABEL_27: - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - } -//LABEL_28: - v13 = pButton->pButtonName; -//_set_status_and_ret: - sub_41C0B8_set_status_string(v13); -//LABEL_131: - uLastPointedObjectID = 1; - return; - } - } - else - { - if ( pButton->uButtonType == 2 ) - { - v45 = pX - pButton->uX; - v45 = pY - pButton->uY; - if ( (double)(signed int)pButton->uWidth != 0.0 ) - { - if ( (double)(signed int)pButton->uHeight != 0.0 ) - { - //UNDEF(v8); - //if ( v9 | v10 ) - //goto LABEL_24; - //{ - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - { - v12 = pButton->uControlParam; - pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - } - v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); - uLastPointedObjectID = 1; - return; - //} - } - } - } - else // click on skill - { - if ( 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 ) - { -//LABEL_19: - pPlayer = pPlayers[uActiveCharacter]; - v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]); - v6 = pPlayer->uSkillPoints; - v7 = (v5 & 0x3F) + 1; - if ( v6 < v7 ) - { - v41 = v7 - v6; - v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" - } - else - { - v41 = v7; - v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" - } - sprintf(Str1, v39, v41); - v13 = Str1; - //goto _set_status_and_ret; - sub_41C0B8_set_status_string(v13); - uLastPointedObjectID = 1; - return; - } - } - } - } - } - if ( pWindow->uFrameHeight == 480 ) - break; - --v1; - if ( v1 <= 0 ) - { - goto LABEL_38; - } - } } @@ -4842,14 +4892,13 @@ if (!player->CanAct()) { - if ( pPlayers[uActiveCharacter]->CanAct()) - goto LABEL_9; player = pPlayers[uActiveCharacter]; } - player->PlaySound(SPEECH_NoRoom, 0); + if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) + player->PlaySound(SPEECH_NoRoom, 0); } -LABEL_9: +//LABEL_9: if (pCurrentScreen == SCREEN_GAME) { viewparams->bRedrawGameUI = true; @@ -5009,7 +5058,8 @@ memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; - goto LABEL_24; + pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); + return; } v13 = v8; if ( v8 ) @@ -5030,7 +5080,6 @@ } v9 = this_.uItemID; memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); -LABEL_24: pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; } @@ -5116,7 +5165,10 @@ SpriteObject::OnInteraction(a2.y); return; } - goto LABEL_13; + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; } if ( (v0 & 7) != OBJECT_Actor) { @@ -5124,7 +5176,12 @@ { v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } v14 = v13->field_16_event_id; if ( !v14 ) { @@ -5142,7 +5199,12 @@ else { if ( (v0 & 7) != OBJECT_BModel || (unsigned int)v0 >= 0x2000000 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } v2 = (signed int)(unsigned __int16)v0 >> 3; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { @@ -5150,61 +5212,61 @@ if ( !(v3->uAttributes & 0x2000000) ) { LABEL_11: - v4 = pParty->pPickedItem.uItemID; - if ( pParty->pPickedItem.uItemID ) - { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + { + ShowNothingHereStatus(); + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + } LABEL_14: - v5 = pItemsTable->pItems[v4].uSpriteID; - v6 = 0; - a1.uType = v5; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_18: - LOWORD(v6) = 0; - } - else - { - v7 = (char *)&pObjectList->pObjects->uObjectID; - while ( v5 != *(short *)v7 ) - { - ++v6; - v7 += 56; - if ( v6 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_18; - } - } - a1.uObjectDescID = v6; - a1.vPosition.y = pParty->vPosition.y; - a1.field_58_pid = OBJECT_Player; - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; - a1.uSoundID = 0; - a1.uFacing = 0; - a1.uAttributes = 8; - a1.uSectorID = pIndoor->GetSector( - pParty->vPosition.x, - pParty->vPosition.y, - pParty->sEyelevel + pParty->vPosition.z); - a1.uSpriteFrameID = 0; - memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); - v8 = (int *)pMouse->GetCursorPos(&v25); - v9 = UnprojectX(*v8); - a1.Create(pParty->sRotationY + v9, 184, 200, 0); - v10 = pIcons_LOD->LoadTexture( - pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, - TEXTURE_16BIT_PALETTE); - if (v10 != -1) - pIcons_LOD->pTextures[v10].Release(); - pMouse->RemoveHoldingItem(); - pIcons_LOD->_40F9C5(); - return; - } - ShowNothingHereStatus(); -LABEL_13: - v4 = pParty->pPickedItem.uItemID; - if ( !pParty->pPickedItem.uItemID ) - return; - goto LABEL_14; + v5 = pItemsTable->pItems[v4].uSpriteID; + v6 = 0; + a1.uType = v5; + if ( (signed int)pObjectList->uNumObjects <= 0 ) + { + LOWORD(v6) = 0; + } + else + { + v7 = (char *)&pObjectList->pObjects->uObjectID; + while ( v5 != *(short *)v7 ) + { + ++v6; + v7 += 56; + if ( v6 >= (signed int)pObjectList->uNumObjects ) + { + LOWORD(v6) = 0; + break; + } + } + } + a1.uObjectDescID = v6; + a1.vPosition.y = pParty->vPosition.y; + a1.field_58_pid = OBJECT_Player; + a1.vPosition.x = pParty->vPosition.x; + a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; + a1.uSoundID = 0; + a1.uFacing = 0; + a1.uAttributes = 8; + a1.uSectorID = pIndoor->GetSector( + pParty->vPosition.x, + pParty->vPosition.y, + pParty->sEyelevel + pParty->vPosition.z); + a1.uSpriteFrameID = 0; + memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); + v8 = (int *)pMouse->GetCursorPos(&v25); + v9 = UnprojectX(*v8); + a1.Create(pParty->sRotationY + v9, 184, 200, 0); + v10 = pIcons_LOD->LoadTexture( + pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, + TEXTURE_16BIT_PALETTE); + if (v10 != -1) + pIcons_LOD->pTextures[v10].Release(); + pMouse->RemoveHoldingItem(); + pIcons_LOD->_40F9C5(); + return; } v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; } @@ -5229,14 +5291,22 @@ stru_50C198.LootActor(&pActors[v16]); return; } - goto LABEL_13; + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) { if ( (unsigned int)v0 >= 0x2000000 ) - goto LABEL_13; + { + v4 = pParty->pPickedItem.uItemID; + if ( !pParty->pPickedItem.uItemID ) + return; + goto LABEL_14; + } if ( !v17->CanAct() ) return; v18 = a2.y;
--- a/mm7_2.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/mm7_2.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -3247,7 +3247,8 @@ v22 = 0; v21 = (SoundID)11090; } - goto LABEL_40; + pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31); + return 0; } if ( a1 == 10 ) { @@ -3828,37 +3829,31 @@ { //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType; - if ( v3 < 5 ) - goto LABEL_12; - if ( v3 <= 13 ) - { - v0 = rand() % word_4F0F30[(signed int)v1] - //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C] - + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType - + 345; - } - else - { - if ( v3 == 14 ) - { - v4 = rand() % 4; - } - else - { - if ( v3 == 15 ) - { - v4 = rand() % 3 + 4; - } - else - { - if ( v3 != 16 ) - goto LABEL_12; - v4 = rand() % 2 + 7; - } - } - v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400; - } -LABEL_12: + if ( v3 >= 5 ) + { + if ( v3 <= 13 ) + { + v0 = rand() % word_4F0F30[(signed int)v1] + //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C] + + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + + 345; + } + else + { + if ( v3 == 14 ) + { + v4 = rand() % 4; + } + else if ( v3 == 15 ) + { + v4 = rand() % 3 + 4; + } + else if ( v3 == 16 ) + v4 = rand() % 2 + 7; + if( v3 <= 16 ) + v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400; + } + } if ( v0 == 487 ) { if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) @@ -3958,58 +3953,72 @@ pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; if ( dword_F8B19C != 1 ) - goto LABEL_13; - if ( in_current_building_type == BildingType_Training ) - { - if ( uMessageParam == 17 ) - { - v4 = 0; - v5 = 0; - //v6 = pPlayers[uActiveCharacter]; - //v7 = pPlayers[uActiveCharacter]->uLevel; - if ( pPlayers[uActiveCharacter]->uLevel > 0 ) - { - do - v4 += v5++ + 1; - while ( v5 < pPlayers[uActiveCharacter]->uLevel ); - } - if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] - && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 ) - return; - } - goto LABEL_9; - } - v8 = window_SpeakInHouse; - if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) - && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) - || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) - { -LABEL_9: - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); - pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); -LABEL_10: - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - goto LABEL_11; - } - if ( uActiveCharacter != v1 ) - { - if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) - return; - goto LABEL_10; - } -LABEL_11: - dword_F8B19C = uMessageParam; - if ( in_current_building_type < BildingType_19 ) - { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - ShopTexture = &pIcons_LOD->pTextures[v9]; -LABEL_13: - v8 = window_SpeakInHouse; + { + v8 = window_SpeakInHouse; + } + else + { + if ( in_current_building_type == BildingType_Training ) + { + if ( uMessageParam == 17 ) + { + v4 = 0; + v5 = 0; + //v6 = pPlayers[uActiveCharacter]; + //v7 = pPlayers[uActiveCharacter]->uLevel; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) + { + do + v4 += v5++ + 1; + while ( v5 < pPlayers[uActiveCharacter]->uLevel ); + } + if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] + && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 ) + return; + } + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); + pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); +// LABEL_10: + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + } + else + { + v8 = window_SpeakInHouse; + if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) + && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) + || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) + { + //LABEL_9: + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); + pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); + // LABEL_10: + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + } + else if ( uActiveCharacter != v1 ) + { + if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) + return; + v8 = window_SpeakInHouse; + } + } + //LABEL_11: + dword_F8B19C = uMessageParam; + if ( in_current_building_type < BildingType_19 ) + { + v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + ShopTexture = &pIcons_LOD->pTextures[v9]; + //LABEL_13: + v8 = window_SpeakInHouse; + } } if ( in_current_building_type > BildingType_Tavern ) { @@ -4263,12 +4272,10 @@ v1 = 0; dword_F8B1A4 = pNPCTopics[352].pText; } - goto LABEL_196; - } - if ( uMessageParam == 100 ) + } + else if ( uMessageParam == 100 ) { pKeyActionMap->EnterText(1, 10, v8); - goto LABEL_196; } } } @@ -4527,7 +4534,7 @@ if ( v0 == -1 ) { _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); -LABEL_33: +//LABEL_33: pVideoPlayer->_4BF5B2(); return 1; } @@ -4544,7 +4551,7 @@ if ( v0 != 102 && v0 != 103 && v0 != 104 ) { pVideoPlayer->_4BF5B2(); -LABEL_28: +//LABEL_28: dword_F8B19C = 1; sub_4B3B42(in_current_building_type); return 1; @@ -4558,7 +4565,9 @@ } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - goto LABEL_28; + dword_F8B19C = 1; + sub_4B3B42(in_current_building_type); + return 1; } pDialogueNPCCount = 0; pDialogueWindow->Release(); @@ -4583,7 +4592,8 @@ } while ( (signed int)v2 < uNumDialogueNPCPortraits ); } - goto LABEL_33; + pVideoPlayer->_4BF5B2(); + return 1; } } return 0; @@ -4682,7 +4692,10 @@ v0 = pPlayers[uActiveCharacter]; v77 = pPlayers[uActiveCharacter]; if ( pCurrentScreen == SCREEN_E ) - goto LABEL_73; + { + sub_421EA6_OnInventoryLeftClick(); + return; + } if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { v56 = 0; @@ -4692,7 +4705,8 @@ v48 = -1; v47 = 0; v46 = 0; - goto LABEL_87; + pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); + return; } if ( dword_F8B19C > 18 ) { @@ -4719,14 +4733,17 @@ v55 = 4; else v55 = 2; - goto LABEL_84; + HousePlaySomeSound((unsigned int)v13, v55); + return; } Party::TakeGold(v44); v53 = 0; dword_F8B1E4 = 1; *pSkill = 1; v51 = 78; - goto LABEL_80; + v27 = v0; + v27->PlaySound((PlayerSpeech)v51, v53); + return; } } return; @@ -4738,7 +4755,7 @@ goto LABEL_49; } pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; -LABEL_73: +//LABEL_73: sub_421EA6_OnInventoryLeftClick(); return; } @@ -4760,11 +4777,12 @@ if ( pParty->uNumGold < v23 ) { v24 = 2; -LABEL_62: +//LABEL_62: HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24); v9 = pGlobalTXT_LocalizationStrings[155]; v54 = 2; - goto LABEL_71; + ShowStatusBarString(v9, v54); + return; } v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID); if ( v25 ) @@ -4772,13 +4790,23 @@ v26 = 1; v20->SetIdentified(); memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u); - goto LABEL_42; + dword_F8B1E4 = v26; + Party::TakeGold(v80); + viewparams->bRedrawGameUI = v26; + _this->Reset(); + pRenderer->ClearZBuffer(0, 479); + v27 = v77; + v53 = 0; + v51 = SPEECH_75; + v27->PlaySound((PlayerSpeech)v51, v53); + return; } v0->PlaySound(SPEECH_NoRoom, 0); v54 = 5; -LABEL_70: +//LABEL_70: v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" - goto LABEL_71; + ShowStatusBarString(v9, v54); + return; } if ( dword_F8B19C == 2 ) { @@ -4832,7 +4860,13 @@ if ( uNumSeconds != 2 ) { if ( uNumSeconds != 1 ) - goto LABEL_62; + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24); + v9 = pGlobalTXT_LocalizationStrings[155]; + v54 = 2; + ShowStatusBarString(v9, v54); + return; + } } } v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); @@ -4851,27 +4885,36 @@ { *(char *)(v40 + 517) |= 1u; sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); - goto LABEL_43; - } - } - } -LABEL_42: + viewparams->bRedrawGameUI = v26; + _this->Reset(); + pRenderer->ClearZBuffer(0, 479); + v27 = v77; + v53 = 0; + v51 = SPEECH_75; + v27->PlaySound((PlayerSpeech)v51, v53); + return; + } + } + } +//LABEL_42: dword_F8B1E4 = v26; Party::TakeGold(v80); -LABEL_43: +//LABEL_43: viewparams->bRedrawGameUI = v26; _this->Reset(); pRenderer->ClearZBuffer(0, 479); v27 = v77; v53 = 0; v51 = SPEECH_75; -LABEL_81: +//LABEL_81: v27->PlaySound((PlayerSpeech)v51, v53); return; } v0->PlaySound(SPEECH_NoRoom, 0); v54 = 2; - goto LABEL_70; + v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" + ShowStatusBarString(v9, v54); + return; } if ( dword_F8B19C == 3 ) { @@ -4890,8 +4933,10 @@ pRenderer->ClearZBuffer(0, 479); v53 = 0; v51 = 77; - goto LABEL_80; - } + v27 = v0; + v27->PlaySound((PlayerSpeech)v51, v53); + return; + } v0->PlaySound(SPEECH_79, 0); v56 = 0; v52 = 0; @@ -4900,7 +4945,7 @@ v48 = -1; v47 = 0; v46 = 0; -LABEL_87: +//LABEL_87: pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } @@ -4930,19 +4975,29 @@ *(int *)(v12 + 20) |= 1u; v0->PlaySound(SPEECH_73, 0); v9 = pGlobalTXT_LocalizationStrings[569]; - goto LABEL_25; + v54 = 2; + ShowStatusBarString(v9, v54); + return; } - goto LABEL_26; + v13 = _this; + v55 = 2; + HousePlaySomeSound((unsigned int)v13, v55); + return; } pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); v53 = 0; - goto LABEL_28; + v51 = 79; + v27 = v0; + v27->PlaySound((PlayerSpeech)v51, v53); + return; } v53 = 0; -LABEL_30: +//LABEL_30: v51 = 76; - goto LABEL_80; - } + v27 = v0; + v27->PlaySound((PlayerSpeech)v51, v53); + return; + } } } } @@ -4983,30 +5038,34 @@ *(int *)(v3 + 20) = v8 | 1; v0->PlaySound(SPEECH_74, 0); v9 = pGlobalTXT_LocalizationStrings[570]; -LABEL_25: +//LABEL_25: v54 = 2; -LABEL_71: +//LABEL_71: ShowStatusBarString(v9, v54); return; } -LABEL_26: +//LABEL_26: v13 = _this; v55 = 2; -LABEL_84: +//LABEL_84: HousePlaySomeSound((unsigned int)v13, v55); return; } pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); v53 = 0; -LABEL_28: +//LABEL_28: v51 = 79; -LABEL_80: +//LABEL_80: v27 = v0; - goto LABEL_81; + v27->PlaySound((PlayerSpeech)v51, v53); + return; } v53 = 0; - goto LABEL_30; - } + v51 = 76; + v27 = v0; + v27->PlaySound((PlayerSpeech)v51, v53); + return; + } } } } @@ -5130,15 +5189,26 @@ *v2 = v5; if ( !v5 ) { -LABEL_23: +//LABEL_23: *v2 = 0; break; } if ( v5 == ',' ) { if ( v3 ) - goto LABEL_18; - *v2 = 0; + { + if ( v4 ) + { + stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; + ++stru_F8B5E8.field_0; + } + v4 = 0; + } + else + { + *v2 = 0; + v4 = 1; + } } else { @@ -5161,35 +5231,50 @@ ++stru_F8B5E8.field_0; } } - goto LABEL_21; - } -LABEL_18: - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - v4 = 0; - goto LABEL_21; - } - if ( v3 ) - goto LABEL_18; - *v2 = 0; - if ( v4 ) - { - stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; - ++stru_F8B5E8.field_0; - } - } - v4 = 1; -LABEL_21: + } + else + { +//LABEL_18: + if ( v4 ) + { + stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; + ++stru_F8B5E8.field_0; + } + v4 = 0; + } + } + else + { + if ( v3 ) + { + if ( v4 ) + { + stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; + ++stru_F8B5E8.field_0; + } + v4 = 0; + } + else + { + *v2 = 0; + if ( v4 ) + { + stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; + ++stru_F8B5E8.field_0; + } + v4 = 1; + } + } + } +//LABEL_21: if ( stru_F8B5E8.field_0 < 30 ) { ++v2; if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 ) continue; } - goto LABEL_23; + *v2 = 0; + break; } } result = a2; @@ -11616,12 +11701,6 @@ pIcons_LOD->_4114F2(); } -int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) - { - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - - //----- (004637EB) -------------------------------------------------------- int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) { @@ -13168,9 +13247,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); @@ -13404,7 +13483,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); @@ -14660,16 +14739,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 @@ -14677,11 +14753,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); @@ -14700,16 +14786,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 ) @@ -14718,19 +14827,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; @@ -14747,9 +14857,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; @@ -14777,7 +14900,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)); @@ -14796,9 +14920,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 ) @@ -14834,9 +14971,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 ) @@ -14845,12 +14985,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; } } } @@ -14863,7 +15007,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)); @@ -14880,7 +15033,6 @@ v50 = _this.uItemID; if ( v51 ) v0->pEquipment.uOffHand = 0; -LABEL_74: if ( v50 ) stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), @@ -14888,9 +15040,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 ) @@ -14902,7 +15067,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)); @@ -14939,7 +15105,6 @@ v31 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); v0->pEquipment.uMainHand = v31; -LABEL_45: pMouse->RemoveHoldingItem(); } } @@ -14976,7 +15141,6 @@ { if ( bUnderwater ) { -LABEL_95: v46 = 0; v45 = 0; v44 = 0; @@ -14984,7 +15148,6 @@ v42 = -1; v41 = 0; v40 = 0; -LABEL_96: pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); return; } @@ -15109,71 +15272,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; @@ -15348,7 +15515,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; } @@ -15362,7 +15528,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;
--- a/mm7_3.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/mm7_3.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -6166,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; @@ -6216,47 +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; + //} + } }
--- a/mm7_5.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/mm7_5.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -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; @@ -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); } @@ -15978,6 +15978,8 @@ v9 = pX + pSRZBufferLineOffsets[pY]; if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF ) { + + __debugbreak(); // invalid indexing will result in invalid object ptr 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); @@ -16025,10 +16027,6 @@ pAudioPlayer->StopChannels(-1, -1); v3 = (void *)1; } - else - { - sub_416B01(v3); - } } else {
--- a/mm7_6.cpp Wed Mar 06 22:46:40 2013 +0400 +++ b/mm7_6.cpp Wed Mar 06 22:47:21 2013 +0400 @@ -1735,148 +1735,152 @@ signed int v8; // edx@50 SpellBuff *v9; // ecx@50 - if ( a2 > 73 ) + switch(a2) { - if ( a2 == 77 ) - { - if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) - return 0; - return 1; - } - if ( a2 == 80 ) - { - v6 = pParty->pPartyBuffs; - while ( (signed __int64)v6->uExpireTime <= 0 ) - { - ++v6; - if ( v6 > &pParty->pPartyBuffs[19] ) - { - v7 = pParty->pPlayers;//[0].pPlayerBuffs; - v8 = 0; - v9 = v7->pPlayerBuffs; - while ( v9->uExpireTime <= 0i64 ) - { - ++v8; - ++v9; - if ( v8 >= 24 ) - { - ++v7; - if ( v7 <= &pParty->pPlayers[3] ) - { - v8 = 0; - v9 = v7->pPlayerBuffs; - } - else - return 0; - } - } - return 1; - } - } - return 1; - } - if ( a2 == 85 ) - { - if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; - } - else - { - if ( a2 == 86 ) - { + case 77: + { + if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) + return 0; + return 1; + } + case 80: + { + v6 = pParty->pPartyBuffs; + while ( (signed __int64)v6->uExpireTime <= 0 ) + { + ++v6; + if ( v6 > &pParty->pPartyBuffs[19] ) + { + v7 = pParty->pPlayers;//[0].pPlayerBuffs; + v8 = 0; + v9 = v7->pPlayerBuffs; + while ( v9->uExpireTime <= 0i64 ) + { + ++v8; + ++v9; + if ( v8 >= 24 ) + { + ++v7; + if ( v7 <= &pParty->pPlayers[3] ) + { + v8 = 0; + v9 = v7->pPlayerBuffs; + } + else + return 0; + } + } + return 1; + } + } + return 1; + } + case 85: + { + if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; + break; + } + case 86: + { if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) - return 1; + return 1; if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) - return 0; + return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; - } - else - { - if ( a2 != 95 || SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) - return 1; + break; + } + case 95: + { + if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) + return 1; if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) - return 0; + return 0; v3 = 0; v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; - } - } - } - else - { - if ( a2 == 73 ) - { - if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; - } - else if ( a2 == 5 ) - { - if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; - } - else if ( a2 == 17 ) - { - if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; - } - else if ( a2 == 38 ) - { - if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; - } - else if ( a2 == 46 ) - { - if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; - } - else - { - if ( a2 != 47 ) + break; + } + case 73: + { + if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; + break; + } + case 5: + { + if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; + break; + } + case 17: + { + if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; + break; + } + case 38: { - if ( a2 != 51 || SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) + if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; + } + case 46: + { + if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) return 1; - if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) - { + if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; + break; + } + case 47: + { + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) + return 0; + v3 = 0; + v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + break; + } + case 51: + { + if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) + return 1; + if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) + { v3 = 0; v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; - } - else - return 0; } else + return 0; + break; + } + default: { - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) - return 1; - if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) - return 0; - v3 = 0; - v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; + return 1; } - } } if ( !(v3 | v4) ) return 0; @@ -3756,7 +3760,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:
--- a/mm7_data.h Wed Mar 06 22:46:40 2013 +0400 +++ b/mm7_data.h Wed Mar 06 22:47:21 2013 +0400 @@ -1852,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);