Mercurial > mm7
changeset 182:6416ded80dcf
Слияние
author | Ritor1 |
---|---|
date | Thu, 14 Feb 2013 22:38:54 +0600 |
parents | 1860917d953f (current diff) d1dde383af89 (diff) |
children | 27573ee0d434 |
files | |
diffstat | 21 files changed, 1467 insertions(+), 562 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIWindow.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/GUIWindow.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -1056,10 +1056,7 @@ v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); + pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); if ( array_5913D8[6] != (NPCData *)uNumDialogueNPCPortraits || !uHouse_ExitPic ) { w.uFrameWidth = 130; @@ -1073,14 +1070,9 @@ v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(v2, &w, 0, 0); if ( v3 < 0 ) v3 = 0; - v18.DrawTitleText( - pFontCreate, - 0x1EAu, - v3 / 2 + 4, - v1, + v18.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, v1, //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], - p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName, - 3u); + p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName, 3); } } v18.uFrameWidth += 8; @@ -1099,10 +1091,7 @@ w.uFrameZ = 457; v5 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0); v6 = v5 + 7; - pRenderer->_4A6A68( - 8u, - 352 - (v5 + 7), - (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), + pRenderer->_4A6A68(8, 352 - (v5 + 7), (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v5 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0); @@ -1113,14 +1102,11 @@ goto LABEL_58; while ( 1 ) { - pRenderer->DrawTextureIndexed( - *(&_4E5E50_transui_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, - *(&_4E5EE0_transui_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, + pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, + *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed( - *(&_4E5E50_transui_x + v8 + 6 * uNumDialogueNPCPortraits - 6), - *(&_4E5EE0_transui_y + v8 + 6 * uNumDialogueNPCPortraits - 6), - pDialogueNPCPortraits[v8]); + pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6), + *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6), pDialogueNPCPortraits[v8]); if ( uNumDialogueNPCPortraits < 4 ) break; LABEL_57: @@ -1156,9 +1142,9 @@ goto LABEL_56; } v4 = (char *)array_5913D8[6] - 1; - pRenderer->DrawTextureIndexed(_4E5E50_transui_x - 4, _4E5EE0_transui_y - 4, + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pDialogueNPCPortraits[(signed int)v4]); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[(signed int)v4]); if ( pCurrentScreen == SCREEN_E ) { CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -1170,9 +1156,7 @@ } else { - sprintf( - pTmpBuf, - pGlobalTXT_LocalizationStrings[429], + sprintf( pTmpBuf, pGlobalTXT_LocalizationStrings[429], //p2DEvents_minus1_::08[13 * (unsigned int)ptr_507BC0->ptr_1C], p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pProprieterName, //p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]); @@ -1248,10 +1232,7 @@ LABEL_58: if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) { - pRenderer->DrawTextureIndexed( - 0x22Cu, - 0x1C3u, - (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0); v14 = 451; v12 = 476; @@ -1855,7 +1836,7 @@ case WINDOW_Book: pWindow->InitializeBookView(); break; - case WINDOW_A: + case WINDOW_Dialogue: pMainScreenNum = pCurrentScreen; pCurrentScreen = SCREEN_NPC_DIALOGUE; pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" @@ -1960,7 +1941,7 @@ (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x5Au, 0, 0x59u, pWindow->Hint, (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); - pWindow->CreateButton(_4E5E50_transui_x, _4E5EE0_transui_y, 0x3Fu, 0x49u, 1, 0, 0x5Au, 1u, 0x20u, pWindow->Hint, 0, 0, 0); + pWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 0x3Fu, 0x49u, 1, 0, 0x5Au, 1u, 0x20u, pWindow->Hint, 0, 0, 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x5Au, 1u, 0, pWindow->Hint, 0); break; case WINDOW_SpellBook: // @@ -2011,8 +1992,8 @@ v29 = pGlobalTXT_LocalizationStrings[435];// ^Pt[%s] } sprintf(&byte_591180[100 * v26], v29, v30); - array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&_4E5E50_transui_x + v26 + 6 * uNumDialogueNPCPortraits - 6), - *(&_4E5EE0_transui_y + v26 + 6 * uNumDialogueNPCPortraits - 6), + array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&pNPCPortraits_x + v26 + 6 * uNumDialogueNPCPortraits - 6), + *(&pNPCPortraits_y + v26 + 6 * uNumDialogueNPCPortraits - 6), 0x3Fu, 0x49u, 1, 0, 0x19Au, v26, 0, &byte_591180[100 * v26], 0, 0, 0); ++v26; v25 = uNumDialogueNPCPortraits; @@ -2035,7 +2016,7 @@ (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x19Bu, 0, 0x59u, pWindow->Hint, (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); - pWindow->CreateButton(_4E5E50_transui_x, _4E5EE0_transui_y, 0x3Fu, 0x49u, 1, 0, 0x19Bu, 1, 0x20u, pWindow->Hint, 0); + pWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 0x3Fu, 0x49u, 1, 0, 0x19Bu, 1, 0x20u, pWindow->Hint, 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x19Bu, 1u, 0, pWindow->Hint, 0); return pWindow; }
--- a/GUIWindow.h Thu Feb 14 22:38:44 2013 +0600 +++ b/GUIWindow.h Thu Feb 14 22:38:54 2013 +0600 @@ -15,15 +15,21 @@ MENU_FINISHED = 0x4, MENU_5 = 0x5, MENU_CREATEPARTY = 0x6, - MENU_7 = 0x7, - MENU_Credits = 0x8, - MENU_LOAD = 0x9, + MENU_NAMEPANELESC = 0x7, + MENU_CREDITSPROC = 0x8, + MENU_LOADINGPROC = 0x9, MENU_10 = 0xA, + MENU_CREDITSCLOSE = 0xB, }; - - +enum DIALOGUE_TYPE +{ + DIALOGUE_ARENA_WELCOME = 0x89, + DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 0x90, + DIALOGUE_ARENA_REWARD = 0x91, + DIALOGUE_ARENA_ALREADY_WON = 0x92, +}; @@ -38,7 +44,7 @@ WINDOW_CharacterRecord = 0x4, WINDOW_Options = 0x6, WINDOW_Book = 0x9, - WINDOW_A = 0xA, + WINDOW_Dialogue = 0xA, WINDOW_QuickReference = 0xC, WINDOW_Rest = 0x10, WINDOW_ChangeLocation = 0x11,
--- a/Game.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/Game.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -210,7 +210,7 @@ MSG Msg; // [sp+28h] [bp-3Ch]@20 char Source[64]; // [sp+44h] [bp-20h]@76 - bLoading = uCurrentMenuID == MENU_LOAD; + bLoading = uCurrentMenuID == MENU_LOADINGPROC; SetCurrentMenuID((MENU_STATE)-1); if (bLoading) {
--- a/IndoorCameraD3D.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/IndoorCameraD3D.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -1336,7 +1336,7 @@ v8 += 48; *(float *)(pOutNumVerticesa + v9) = *(float *)v9; *(float *)(pVerticesa + v9) = *(float *)(v9 + 28); - *(float *)((char *)&static_4371C3_array_50E5E0[0].flt_20 - (char *)v6 + v9) = *(float *)(v9 + 32); + *(float *)((char *)&static_4371C3_array_50E5E0[0]._rhw - (char *)v6 + v9) = *(float *)(v9 + 32); v9 += 48; } while ( v12 < (signed int)*v7 ); @@ -1368,7 +1368,7 @@ if ( (signed int)uNumInVertices > 0 ) { pOutVertices_ = (char *)&pOutVertices->vWorldViewProjY; - v7 = (char *)&pInVertices->flt_20; + v7 = (char *)&pInVertices->_rhw; v8 = (char *)pOutVertices - (char *)pInVertices; a2a = uNumInVertices; do @@ -1451,7 +1451,7 @@ v10 = pOutVertices; } v10[*pOutNumVertices_].vWorldViewPosition.x = v6; - v10[*pOutNumVertices_].flt_20 = 1.0 / v6; + v10[*pOutNumVertices_]._rhw = 1.0 / v6; if ( v7 ) { v13 = (unsigned int)&v10[*pOutNumVertices_]; @@ -1478,7 +1478,7 @@ if ( a1a ) { memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_])); - pOutVertices[*pOutNumVertices_].flt_20 = 1.0 / (*((float *)v8 - 6) + 0.0000001); + pOutVertices[*pOutNumVertices_]._rhw = 1.0 / (*((float *)v8 - 6) + 0.0000001); pOutVertices[(*pOutNumVertices_)++].flt_2C = *((float *)v8 + 2); } v7 = a1a; @@ -1548,7 +1548,7 @@ v8 = pOutVertices; } v8[*pOutNumVertices].vWorldViewPosition.x = 8.0; - v8[*pOutNumVertices].flt_20 = 0.125; + v8[*pOutNumVertices]._rhw = 0.125; if ( v5 ) { v11 = (unsigned int)&v8[*pOutNumVertices]; @@ -1575,7 +1575,7 @@ if ( a1a ) { memcpy(&v8[*pOutNumVertices], v6 - 36, sizeof(v8[*pOutNumVertices])); - pOutVertices[(*pOutNumVertices)++].flt_20 = 1.0 / (*((float *)v6 - 6) + 0.0000001); + pOutVertices[(*pOutNumVertices)++]._rhw = 1.0 / (*((float *)v6 - 6) + 0.0000001); } v5 = a1a; v6 += 48;
--- a/Keyboard.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/Keyboard.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -970,6 +970,7 @@ { void *v2; // esi@2 char v3; // bl@2 + bool result; if (bUsingAsynKeyboard) { @@ -982,7 +983,9 @@ return v3;*/ } else - return (GetAsyncKeyState(vKey) & 0x8001) != 0; + //return (GetAsyncKeyState(vKey) & 0x8001) != 0; + result = GetAsyncKeyState(vKey); + return result; } //----- (0045B0CE) -------------------------------------------------------- @@ -992,7 +995,7 @@ char v3; // bl@2 bool result; // eax@2 - if ( LOBYTE(this->bUsingAsynKeyboard) ) + if ( this->bUsingAsynKeyboard ) { __debugbreak(); /*v2 = pAsyncKeyboard; @@ -1003,8 +1006,8 @@ } else { - LOWORD(result) = GetAsyncKeyState(vKey); - LOBYTE(result) = result & 1; + result = GetAsyncKeyState(vKey); + //LOBYTE(result) = result & 1; } return result; }
--- a/Mouse.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/Mouse.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -929,7 +929,7 @@ int v13; // [sp+80h] [bp-4h]@3 Dst.dwSize = 124; - result = pRenderer->LockSurface_DDraw4(a2, &Dst, 1u); + result = pRenderer->LockSurface_DDraw4(a2, &Dst, DDLOCK_WAIT); if ( result ) { v5 = a1->pPalette16;
--- a/Outdoor.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/Outdoor.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -141,7 +141,7 @@ pRenderer->PrepareDecorationsRenderList_ODM(); pRenderer->DrawLayingItems_Shooting_Magic_ODM(); - pRenderer->TransformBillboardsAndSetPalettesODM();//Ritor1: do comment to test + pRenderer->TransformBillboardsAndSetPalettesODM(); sub_485F53((Vec2_int_ *)unnamed_6BE060); }
--- a/Render.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/Render.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -1825,7 +1825,7 @@ for (unsigned int k = 0; k < 4; ++k) { memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); - array_50AC10[k].flt_20 = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); } assert(v6 < 1000); // many random crashes here @@ -2059,19 +2059,19 @@ //goto LABEL_162; //} memcpy(&array_50AC10[0], v102, 0x30u); - array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[1].u = 0.0; array_50AC10[1].v = 1.0; memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[2].u = 1.0; array_50AC10[2].v = 1.0; memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); - array_50AC10[3].flt_20 = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[3].u = 1.0; array_50AC10[3].v = 0.0; /*if ( !(byte_76D5C0 & 1) ) @@ -2199,15 +2199,15 @@ goto LABEL_112; }*/ memcpy(&array_50AC10[0], v102, 0x30u); - array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; + array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; array_50AC10[1].u = 0.0; array_50AC10[1].v = 1.0; memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; + array_50AC10[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; array_50AC10[2].u = 1.0; array_50AC10[2].v = 1.0; static stru154 static_sub_0048034E_stru_76D590; @@ -2328,15 +2328,15 @@ goto LABEL_162; } memcpy(&array_50AC10[0], v102, 0x30u); - array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); + array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; + array_50AC10[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; array_50AC10[1].u = 1.0; array_50AC10[1].v = 1.0; memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097; + array_50AC10[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097; array_50AC10[2].u = 1.0; array_50AC10[2].v = 0.0; static stru154 static_sub_0048034E_stru_76D578; @@ -2640,22 +2640,22 @@ goto LABEL_104; v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); memcpy(array_50AC10, v104, 0x30u); - array_50AC10[0].flt_20 = v26; + array_50AC10[0]._rhw = v26; array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; v27 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / v27; + array_50AC10[1]._rhw = 1.0 / v27; array_50AC10[1].u = 0.0; array_50AC10[1].v = 1.0; v28 = v103->vWorldViewPosition.x + 0.0000001; memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / v28; + array_50AC10[2]._rhw = 1.0 / v28; array_50AC10[2].u = 1.0; array_50AC10[2].v = 1.0; v29 = v102->vWorldViewPosition.x + 0.0000001; memcpy(&array_50AC10[3], v102, sizeof(array_50AC10[3])); - array_50AC10[3].flt_20 = 1.0 / v29; + array_50AC10[3]._rhw = 1.0 / v29; array_50AC10[3].u = 1.0; array_50AC10[3].v = 0.0; pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1); @@ -2761,17 +2761,17 @@ goto LABEL_74; v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); memcpy(array_50AC10, v104, 0x30u); - array_50AC10[0].flt_20 = v48; + array_50AC10[0]._rhw = v48; array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; v49 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / v49; + array_50AC10[1]._rhw = 1.0 / v49; array_50AC10[1].u = 0.0; array_50AC10[1].v = 1.0; v50 = v103->vWorldViewPosition.x + 0.0000001; memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / v50; + array_50AC10[2]._rhw = 1.0 / v50; array_50AC10[2].u = 1.0; array_50AC10[2].v = 1.0; pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0); @@ -2855,17 +2855,17 @@ } v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); memcpy(array_50AC10, v104, 0x30u); - array_50AC10[0].flt_20 = v62; + array_50AC10[0]._rhw = v62; array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; v63 = v103->vWorldViewPosition.x + 0.0000001; memcpy(&array_50AC10[1], v103, sizeof(array_50AC10[1])); - array_50AC10[1].flt_20 = 1.0 / v63; + array_50AC10[1]._rhw = 1.0 / v63; array_50AC10[1].u = 1.0; array_50AC10[1].v = 1.0; v64 = v102->vWorldViewPosition.x + 0.0000001; memcpy(&array_50AC10[2], v102, sizeof(array_50AC10[2])); - array_50AC10[2].flt_20 = 1.0 / v64; + array_50AC10[2]._rhw = 1.0 / v64; array_50AC10[2].u = 1.0; array_50AC10[2].v = 0.0; pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1); @@ -4831,7 +4831,7 @@ { memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, 1u) ) + if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) return; v28 = Dst.lpSurface; v5 = Dst.lPitch >> 1; @@ -5027,7 +5027,7 @@ { memset(&Dst, 0, 0x7Cu); Dst = 124; - if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, 1u) ) + if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) ) return; v42 = v20; v6 = v19 >> 1; @@ -6136,7 +6136,7 @@ { memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, 1u) ) + if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, DDLOCK_WAIT) ) { pRenderer->pBackBuffer4->Unlock(0); v19 = ptr_400E8; @@ -6469,7 +6469,7 @@ bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) { IDirectDrawSurface4 *v4; // esi@1 - bool result; // eax@1 + HRESULT result; // eax@1 HRESULT v6; // eax@4 int v7; // [sp-8h] [bp-14h]@10 unsigned int v8; // [sp-4h] [bp-10h]@10 @@ -6839,7 +6839,7 @@ DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, 1u); + LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT); *pOutSurfacePtr = pDesc.lpSurface; v4 = pDesc.lPitch; } @@ -6884,7 +6884,7 @@ DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, 1u); + LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT); *pOutSurface = pDesc.lpSurface; v4 = pDesc.lPitch; } @@ -7172,7 +7172,7 @@ if (pRenderD3D) { pGame->draw_debug_outlines(); - DoRenderBillboards_D3D(); //Ritor1: it's temporarily + DoRenderBillboards_D3D(); pGame->pStru6Instance->RenderSpecialEffects(); pRenderD3D->pDevice->EndScene(); } @@ -7617,7 +7617,7 @@ pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; pVertices[i].pos.z = 0.99989998; - pVertices[i].rhw = array_50AC10[i].flt_20; + pVertices[i].rhw = array_50AC10[i]._rhw; pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); v7 = 0; @@ -7659,7 +7659,7 @@ pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; pVertices[i].pos.z = 0.99989998; - pVertices[i].rhw = array_50AC10[i].flt_20; + pVertices[i].rhw = array_50AC10[i]._rhw; pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); v7 = 0; @@ -8831,7 +8831,7 @@ memset(&desc, 0, sizeof(DDSURFACEDESC2)); desc.dwSize = sizeof(DDSURFACEDESC2); - if ( LockSurface_DDraw4(pNextSurf, &desc, 0x21u) ) + if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) { Dst.sub_451007_scale_image_bicubic( pHWLTexture->pPixels, @@ -8865,7 +8865,7 @@ memset(&desc, 0, sizeof(DDSURFACEDESC2)); desc.dwSize = sizeof(DDSURFACEDESC2); - if ( LockSurface_DDraw4(*pOutSurface, &desc, 0x21u) ) + if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) { bMipMaps = 0; v13 = pHWLTexture->pPixels; @@ -8941,7 +8941,7 @@ //v8 = pSprite; memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( LockSurface_DDraw4((IDirectDrawSurface4 *)v2->pTextureSurface, &Dst, 0x21u) ) + if ( LockSurface_DDraw4((IDirectDrawSurface4 *)v2->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) { v9 = v5->pPixels; v10 = Dst.lpSurface; @@ -8999,7 +8999,7 @@ { memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x801u) ) + if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) { v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; v3 = Dst.lPitch >> 1;
--- a/Render.h Thu Feb 14 22:38:44 2013 +0600 +++ b/Render.h Thu Feb 14 22:38:54 2013 +0600 @@ -26,7 +26,7 @@ Vec3_float_ vWorldViewPosition; float vWorldViewProjX; float vWorldViewProjY; - float flt_20; + float _rhw; float u; float v; float flt_2C;
--- a/SaveLoad.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/SaveLoad.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -614,7 +614,7 @@ int bNotArena; // [sp+2Ch] [bp-8h]@1 unsigned int v6; // [sp+30h] [bp-4h]@1 - __debugbreak(); + //__debugbreak(); v1 = uSlot; v6 = uSlot;
--- a/VideoPlayer.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/VideoPlayer.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -293,7 +293,7 @@ unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8 pVideoPlayer->bStopBeforeSchedule = false; - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; bGameoverLoop = 1; if ( !bNoVideo ) { @@ -1168,6 +1168,6 @@ void VideoPlayer::PlayDeathMovie() { bStopBeforeSchedule = 0; - field_40 = 0; + pResetflag = 0; pGame->pCShow->PlayMovie(MOVIE_Death, 1); } \ No newline at end of file
--- a/VideoPlayer.h Thu Feb 14 22:38:44 2013 +0600 +++ b/VideoPlayer.h Thu Feb 14 22:38:54 2013 +0600 @@ -121,7 +121,7 @@ { //RGBTexture::RGBTexture(&pVideoPlayer->pVideoFrame); bStopBeforeSchedule = false; - field_40 = 0; + pResetflag = 0; byte_F8BC0C = 0; //pBinkMovie = nullptr; } @@ -129,7 +129,7 @@ virtual ~VideoPlayer() { bStopBeforeSchedule = false; - field_40 = 0; + pResetflag = 0; pVideoFrame.Release(); } @@ -162,7 +162,7 @@ int field_34; MovieHeader *pMightVideoHeaders; MovieHeader *pMagicVideoHeaders; - int field_40; + int pResetflag; int field_44; unsigned int uNumMightVideoHeaders; unsigned int uNumMagicVideoHeaders;
--- a/mm7_1.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_1.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -3062,7 +3062,7 @@ { memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( !pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) + if ( !pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT)) goto LABEL_51; v20 = (char *)v124; v110 = pDesc.lpSurface; @@ -3109,7 +3109,7 @@ } memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) + if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT) ) { v108 = (unsigned __int16 *)pDesc.lpSurface; a2 = (Player *)v124; @@ -7740,7 +7740,7 @@ v3 = (char *)&array_507D30[0].vWorldViewPosition.z; v4 = (char *)&array_507D30[0].vWorldViewPosition.y; v5 = v1; - v23 = (char *)&array_507D30[0].flt_20; + v23 = (char *)&array_507D30[0]._rhw; v21 = array_507D30; v18 = (char *)&array_507D30[0].vWorldViewPosition.z; v19 = (char *)&array_507D30[0].vWorldViewPosition.y;
--- a/mm7_2.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_2.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -4400,20 +4400,8 @@ v3 = byte_591180; do { - array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton( - *(&_4E5E50_transui_x + v2 + 6 * v1 - 6), - *(&_4E5EE0_transui_y + v2 + 6 * v1 - 6), - 0x3Fu, - 0x49u, - 1, - 0, - 0x19Au, - v2, - 0, - v3, - 0, - 0, - 0); + array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton(*(&pNPCPortraits_x + v2 + 6 * v1 - 6), *(&pNPCPortraits_y + v2 + 6 * v1 - 6), + 0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, v3, 0, 0, 0); v1 = uNumDialogueNPCPortraits; ++v2; v3 += 100; @@ -5101,7 +5089,7 @@ pRenderer->ClearBlack(); pRenderer->EndScene(); pRenderer->Present(); - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; _449B57_test_bit(pParty->_award_bits, 99); _this.Load("winbg.pcx", 2); pRenderer->BeginScene(); @@ -11260,7 +11248,7 @@ pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, 1u) ) + if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) { v9 = (unsigned __int16 *)Dst.lpSurface; v10 = 0; @@ -11439,7 +11427,7 @@ GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF); GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); - if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOAD ) + if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC ) { pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0); if ( a4 ) @@ -11542,7 +11530,7 @@ if ( pGUIWindow_CurrentMenu->field_40 == 3 ) pGUIWindow_CurrentMenu->field_40 = 0; } - if (GetCurrentMenuID() == MENU_LOAD) + if (GetCurrentMenuID() == MENU_LOADINGPROC) { //v18 = pGlobalTXT_LocalizationStrings[135]; v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"" @@ -12049,8 +12037,8 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); // - auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); // + pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0); auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); @@ -12072,7 +12060,7 @@ POINT pt; pMouse->GetCursorPos(&pt); pWindow = pWindow_MainMenu; - if ( GetCurrentMenuID() == MENU_SAVELOAD)// + if ( GetCurrentMenuID() == MENU_SAVELOAD) { if ( pCurrentScreen != SCREEN_LOADGAME ) { @@ -12080,13 +12068,13 @@ pTexture_PCX.Load("lsave640.pcx", 0); pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pCurrentScreen = SCREEN_LOADGAME; - GameUI_DrawLoadMenu(0);// + GameUI_DrawLoadMenu(0); } pWindow = pGUIWindow_CurrentMenu; } MSG msg; - while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )// + while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) ) { if (msg.message == WM_QUIT) Game_DeinitializeAndTerminate(0); @@ -12103,13 +12091,13 @@ pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); - GUI_MainMenuMessageProc();// + GUI_MainMenuMessageProc(); GUI_UpdateWindows(); if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); - if (GetCurrentMenuID() != MENU_MAIN)// - { - if (GetCurrentMenuID() == MENU_LOAD)// + if (GetCurrentMenuID() != MENU_MAIN) + { + if (GetCurrentMenuID() == MENU_LOADINGPROC) { pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); @@ -13894,7 +13882,7 @@ - +bool new_sky = false; //----- (00462C94) -------------------------------------------------------- bool MM_Main(const wchar_t *pCmdLine) @@ -13939,6 +13927,8 @@ } if (wcsstr(pCmdLine, L"-nocd")) bNoCD = true; + if (wcsstr(pCmdLine, L"-new_sky")) + new_sky = true; } stru_51076C.registry_debug_flags = ReadWindowsRegistryInt("debug flags", 0); @@ -13977,54 +13967,59 @@ Log::Warning(L"MM: entering main loop"); while ( 1 ) { - MainMenu_Loop(); // + MainMenu_Loop(); uGameState = 0; //LABEL_21: while ( 1 ) { switch (uGameState) { - case GAME_FINISHED: // + case GAME_FINISHED: pGame->Deinitialize(); - return true; // MM_Main Win_Main - } - if (GetCurrentMenuID() == MENU_FINISHED) // + return true; + } + if (GetCurrentMenuID() == MENU_FINISHED) { uGameState = GAME_FINISHED; - continue; // - } - if (GetCurrentMenuID() == MENU_NEWGAME) // + continue; + } + if (GetCurrentMenuID() == MENU_NEWGAME) { if ( pAudioPlayer->hAILRedbook ) - AIL_redbook_stop(pAudioPlayer->hAILRedbook); // - pParty->Reset(); // + AIL_redbook_stop(pAudioPlayer->hAILRedbook); + pParty->Reset(); for (uint k = 0; k < 50; ++k) pOtherOverlayList->pOverlays[k].Reset(); - strcpy(pCurrentMapName, pStartingMapName); // - pParty->CreateDefaultParty(0); // + strcpy(pCurrentMapName, pStartingMapName); + pParty->CreateDefaultParty(0); PlayerCreationUI_Initialize(); - if ( PlayerCreationUI_Loop() ) // + if ( PlayerCreationUI_Loop() ) { DeleteCCharFont(); - break;// + break; } DeleteCCharFont(); bFlashQuestBook = true; - pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); // - Autosave(); // - //goto LABEL_48; - pGame->Loop(); // - break; // - } - if (GetCurrentMenuID() == MENU_CREDITS) // + pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); + Autosave(); + pGame->Loop(); + if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) + { + SetCurrentMenuID(MENU_NEWGAME); + uGameState = 0; + continue; + } + break; + } + if (GetCurrentMenuID() == MENU_CREDITS) { if ( pAudioPlayer->hAILRedbook ) - AIL_redbook_stop(pAudioPlayer->hAILRedbook);// + AIL_redbook_stop(pAudioPlayer->hAILRedbook); extern MENU_STATE __cdecl CreditsMenu__Loop(); - CreditsMenu__Loop(); // + CreditsMenu__Loop(); break; } - if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD) //??? + if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOADINGPROC) { uGameState = 0; } @@ -14060,7 +14055,7 @@ pAsyncKeyboard->Resume(); }*/ //LABEL_48: - pGame->Loop(); //game + pGame->Loop(); LABEL_49: if ( uGameState == 3 ) __debugbreak(); @@ -14071,7 +14066,7 @@ uGameState = 0; continue; }*/ - if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )//press NewGame button out GameMenu window + if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) { SetCurrentMenuID(MENU_NEWGAME); uGameState = 0; @@ -14373,10 +14368,11 @@ case MENU_FINISHED: return L"MENU_FINISHED"; case MENU_5: return L"MENU_5"; case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; - case MENU_7: return L"MENU_7"; - case MENU_Credits: return L"MENU_Credits"; - case MENU_LOAD: return L"MENU_LOAD"; + case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; + case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; + case MENU_LOADINGPROC: return L"MENU_LOADINGPROC"; case MENU_10: return L"MENU_10"; + case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; default: return L"unk"; }; }; @@ -16344,7 +16340,7 @@ UI_CreateTravelDialogue(); } } - UpdateActors_ODM();//Ritor1: it's temporarily + UpdateActors_ODM(); _46CC4B_check_event_triggers(); }
--- a/mm7_3.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_3.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -6989,7 +6989,7 @@ memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28])); ++v28; --v29; - array_50A2B0[v28 + 49].flt_20 = v30; + array_50A2B0[v28 + 49]._rhw = v30; } while ( v29 ); pFace = v46; @@ -7356,7 +7356,7 @@ v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001); memcpy(&array_50AC10[v31], &array_73D150[v31], sizeof(array_50AC10[v31])); ++v31; - array_50A2B0[v31 + 49].flt_20 = v32; + array_50A2B0[v31 + 49]._rhw = v32; v84 = v12->sTextureDeltaU + *(short *)(v30 - 40); array_50A2B0[v31 + 49].u = (double)v84 * v28; v33 = v12->sTextureDeltaV + *(short *)v30; @@ -7719,6 +7719,478 @@ return result; } + + +unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) +{ + #pragma pack(push, 1) + struct TGAHeader + { + unsigned char tgaSkip; + unsigned char colourmaptype; // type of colour map 0=none, 1=has palette + unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed + + short colourmapstart; // first colour map entry in palette + short colourmaplength; // number of colours in palette + char colourmapbits; // number of bits per palette entry 15,16,24,32 + + //unsigned char tgaDontCare2[9]; + short xstart; // image x origin + short ystart; // image y origin + + unsigned short tgaWidth; + unsigned short tgaHeight; + unsigned char tgaBPP; + + char descriptor; // image descriptor bits: 00vhaaaa + // h horizontal flip + // v vertical flip + // a alpha bits + }; + #pragma pack(pop) + + if (out_width) + *out_width = 0; + if (out_height) + *out_height = 0; + + DWORD w; + auto file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); + if (file == INVALID_HANDLE_VALUE) + return nullptr; + + TGAHeader header; + ReadFile(file, &header, sizeof(header), &w, nullptr); + SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); + + if (header.tgaBPP != 24 || header.tgaType != 2) + { + CloseHandle(file); + return nullptr; + } + + int imgSize = header.tgaWidth * header.tgaHeight * 3; + auto pixels = new unsigned char[imgSize]; + ReadFile(file, pixels, imgSize, &w, nullptr); + CloseHandle(file); + + if (w != imgSize) + { + delete [] pixels; + return nullptr; + } + + if (out_width) + *out_width = header.tgaWidth; + if (out_height) + *out_height = header.tgaHeight; + + auto pixels_16bit = new unsigned short[imgSize / 3]; + for (int i = 0; i < imgSize / 3; ++i) + { + pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | + ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | + ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); + } + delete [] pixels; + return pixels_16bit; +} + +unsigned short *skybox_xn, *skybox_xp, + *skybox_yn, *skybox_yp, + *skybox_zn, *skybox_zp; +int skybox_width, skybox_height; +IDirect3DTexture2 *skybox_texture; +IDirectDrawSurface4 *skybox_surface; +bool Skybox_Initialize(const wchar_t *skybox_name) +{ + wchar_t xn_filename[1024], xp_filename[1024], + yn_filename[1024], yp_filename[1024], + zn_filename[1024], zp_filename[1024]; + swprintf(xn_filename, L"%s_xn.tga", skybox_name); swprintf(xp_filename, L"%s_xp.tga", skybox_name); + swprintf(yn_filename, L"%s_yn.tga", skybox_name); swprintf(yp_filename, L"%s_yp.tga", skybox_name); + swprintf(zn_filename, L"%s_zn.tga", skybox_name); swprintf(zp_filename, L"%s_zp.tga", skybox_name); + + int xn_width, xn_height; + skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); + if (!skybox_xn) + return false; + + int xp_width, xp_height; + skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); + if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) + { + delete [] skybox_xn; + if (skybox_xp) delete [] skybox_xp; + return false; + } + + int yn_width, yn_height; + skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); + if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) + { + delete [] skybox_xn; + if (skybox_xp) delete [] skybox_xp; + if (skybox_yn) delete [] skybox_yn; + return false; + } + + int yp_width, yp_height; + skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); + if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) + { + delete [] skybox_xn; + if (skybox_xp) delete [] skybox_xp; + if (skybox_yn) delete [] skybox_yn; + if (skybox_yp) delete [] skybox_yp; + return false; + } + + int zn_width, zn_height; + skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); + if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) + { + delete [] skybox_xn; + if (skybox_xp) delete [] skybox_xp; + if (skybox_yn) delete [] skybox_yn; + if (skybox_yp) delete [] skybox_yp; + if (skybox_zn) delete [] skybox_zn; + return false; + } + + int zp_width, zp_height; + skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); + if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) + { + delete [] skybox_xn; + if (skybox_xp) delete [] skybox_xp; + if (skybox_yn) delete [] skybox_yn; + if (skybox_yp) delete [] skybox_yp; + if (skybox_zn) delete [] skybox_zn; + if (skybox_zp) delete [] skybox_zp; + return false; + } + + skybox_width = xn_width; + skybox_height = xn_height; + + + if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, + false, false, pRenderer->uMinDeviceTextureDim)) + return false; + + return true; +} + + +struct vector +{ + float x, y, z; +}; +struct matrix +{ + float m[4][4]; +}; +void VectorNormalize(vector *v) +{ + float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); + v->x *= invmag; + v->y *= invmag; + v->z *= invmag; +} +void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) +{ + memset(pout, 0, sizeof(matrix)); + pout->m[3][0] = 0; + pout->m[3][1] = 0; + pout->m[3][2] = 0; + pout->m[3][3] = 1; + + vector v; + v.x = pv->x; v.y = pv->y; v.z = pv->z; + VectorNormalize(&v); + + pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); + pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; + pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; + pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; + pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); + pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; + pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; + pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; + pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); +} +void VectorTransform(const matrix *m, const vector *v, vector *out) +{ + out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; + out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; + out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; +} + + +bool DrawSkyD3D_Skybox() +{ + static bool initialized = false, + initialization_failed = false; + if (initialization_failed) + return false; + + static int last_camera_rot_y, + last_camera_rot_x; + if (!initialized) + { + if (!Skybox_Initialize(L"data/skybox/stars")) + { + initialization_failed = true; + return false; + } + initialized = true; + + last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run + last_camera_rot_x = pParty->sRotationX + 1; + } + + /* + r(y) = +cos y 0 sin y 0 +0 1 0 0 +-sin y 0 cos y 0 +0 0 0 1 + +x cos y - z sin y +y +x sin y + z cos y +1 + + + +r(x) = // should be r(right) actually +1 0 0 0 +0 cos x -sin x 0 +0 sin x cos x 0 +0 0 0 1 + + +x +y cos x + z sin x +-y sin x + z cos x +1 + + */ + + if (last_camera_rot_y == pParty->sRotationY && + last_camera_rot_x == pParty->sRotationX) + { +draw: + struct RenderVertexD3D3 v[6]; + + v[0].pos.x = pViewport->uScreenX; + v[0].pos.y = pViewport->uScreenY; + v[0].pos.z = 0.99989998; + v[0].rhw = 1; + v[0].diffuse = 0xFFFFFFFF; + v[0].specular = 0; + v[0].texcoord.x = 0; + v[0].texcoord.y = 0; + + v[1].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; + v[1].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; + v[1].pos.z = 0.99989998; + v[1].rhw = 1; + v[1].diffuse = 0xFFFFFFFF; + v[1].specular = 0; + v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; + v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; + + v[2].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; + v[2].pos.y = pViewport->uScreenY; + v[2].pos.z = 0.99989998; + v[2].rhw = 1; + v[2].diffuse = 0xFFFFFFFF; + v[2].specular = 0; + v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; + v[2].texcoord.y = 0; + + memcpy(&v[3], &v[0], sizeof(*v)); + + v[4].pos.x = pViewport->uScreenX; + v[4].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; + v[4].pos.z = 0.99989998; + v[4].rhw = 1; + v[4].diffuse = 0xFFFFFFFF; + v[4].specular = 0; + v[4].texcoord.x = 0; + v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; + + memcpy(&v[5], &v[1], sizeof(*v)); + + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); + pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); + pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); + //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); + + return true; + } + + + DDSURFACEDESC2 desc; + desc.dwSize = sizeof(desc); + if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) + return false; + + last_camera_rot_y = pParty->sRotationY; + last_camera_rot_x = pParty->sRotationX; + + float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; + float fov_x = 3.141592f * (pOutdoorCamera->uCameraFovInDegrees + 0) / 360.0f; + float fov_y = fov_x / aspect; + + float ray_dx = fov_x / (float)pViewport->uScreenWidth, + ray_dy = fov_y / (float)pViewport->uScreenHeight; + float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, + party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; + for (int y = 0; y < pViewport->uScreenHeight; ++y) + for (int x = 0; x < pViewport->uScreenWidth; ++x) + { + float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; + float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; + + float _dir_x_ = 1, + _dir_y_ = 0, + _dir_z_ = 0; + + float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y + //float dir_y_ = _dir_y_; + float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); + + //float dir_x = dir_x_; // rotation around x + //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); + //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); + + vector right; // rotate around right actually to avoid space distortion + right.x = /*dir_y * 0*/ - dir_z_ * 1; + right.y = /*dir_z_ * 0 - dir_x_ * */0; + right.z = dir_x_ * 1/* - dir_y_ * 0*/; + //VectorNormalize(&right); + + matrix rightMatrix; + MatrixRotationAxis(&rightMatrix, &right, angle_x); + + vector v1, v2; + v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; + VectorTransform(&rightMatrix, &v1, &v2); + + float dir_x = v2.x, + dir_y = v2.y, + dir_z = v2.z; + + float abs_dir_x = fabsf(dir_x), + abs_dir_y = fabsf(dir_y), + abs_dir_z = fabsf(dir_z); + + unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange + if (abs_dir_x >= abs_dir_y) + { + if (abs_dir_x >= abs_dir_z) + { + if (dir_x >= 0) + { + float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 + float instersect_z = dir_z / (2.0f * dir_x); + + float u = 1.0f - (instersect_z + 0.5f), + v = 1.0f - (instersect_y + 0.5f); + + int tx = u * (skybox_width - 1), + ty = v * (skybox_height - 1); + + color = skybox_xp[ty * skybox_width + tx]; + //color = ty * 0x1F / skybox_height; + } + else + { + float instersect_y = dir_y / (2.0f * dir_x); + float instersect_z = dir_z / (2.0f * dir_x); + + float u = 1.0f - (instersect_z + 0.5f), + v = instersect_y + 0.5f; + + int tx = u * (skybox_width - 1), + ty = v * (skybox_height - 1); + + color = skybox_xn[ty * skybox_width + tx]; + //color = tx * 0x1F / skybox_height; + } + } + else if (dir_z >= 0) + goto DIR_ZP; + else + goto DIR_ZN; + } + else if (abs_dir_y >= abs_dir_z) + { + if (dir_y >= 0) + { + float instersect_x = dir_x / (2.0f * dir_y); + float instersect_z = dir_z / (2.0f * dir_y); + + float u = instersect_x + 0.5f, + v = instersect_z + 0.5f; + + int tx = u * (skybox_width - 1), + ty = v * (skybox_height - 1); + + color = skybox_yp[ty * skybox_width + tx]; + //color = tx * 0x1F / skybox_height; + } + /*else should never be seen i guess + { + __debugbreak(); + // -y + //Log::Warning(L"(%03u, %03u): -y", x, y); + }*/ + } + else if (dir_z >= 0) + { +DIR_ZP: + // +z + float instersect_x = dir_x / (2.0f * dir_z); + float instersect_y = dir_y / (2.0f * dir_z); + //float intersect_z = 0.5f; + + float u = instersect_x + 0.5f, + v = -instersect_y + 0.5f; + + int tx = u * (skybox_width - 1), + ty = v * (skybox_height - 1); + + color = skybox_zp[ty * skybox_width + tx]; + } + else + { +DIR_ZN: + // -z + float instersect_x = -dir_x / (2.0f * dir_z); + float instersect_y = -dir_y / (2.0f * dir_z); + //float intersect_z = -0.5f; + + float u = 1.0f - instersect_x - 0.5f, + v = -instersect_y + 0.5f; + + int tx = u * (skybox_width - 1), + ty = v * (skybox_height - 1); + + color = skybox_zn[ty * skybox_width + tx]; + } + + //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; + ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; + } + + ErrD3D((skybox_surface)->Unlock(0)); + goto draw; +} + //----- (00479543) -------------------------------------------------------- void Render::DrawSkyD3D() { @@ -7763,6 +8235,13 @@ int v38; // [sp+158h] [bp-Ch]@1 int v39; // [sp+15Ch] [bp-8h]@4 int v40; // [sp+160h] [bp-4h]@7 + + extern bool new_sky; + if (new_sky) + { + if (DrawSkyD3D_Skybox()) + return; + } v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY); @@ -7772,9 +8251,10 @@ _this._48607B(&stru_8019C8); _this.ptr_38->_48694B(); _this.uTileBitmapID = pOutdoor->uSky_TextureID; - _this.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0); + _this.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? &pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0); if (pOutdoor->uSky_TextureID == -1) return; + _this.field_58 = 0; _this.uNumVertices = 4; _this.v_18.x = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi + 16); @@ -7859,7 +8339,7 @@ v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8; array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[i].flt_20 = 1.0 / (double)(v17 / 65536); + 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); } @@ -7867,22 +8347,22 @@ float t = (GetTickCount() % 96000) / 96000.0f; array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; - array_50AC10[0].flt_20 = 1; + 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].flt_20 = 1; + 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].flt_20 = 1; + 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].flt_20 = 1; + array_50AC10[3]._rhw = 1; array_50AC10[3].u = 1; array_50AC10[3].v = 1 + t; pRenderer->DrawStrip(_this.uNumVertices, &_this, @@ -9290,7 +9770,7 @@ v5 = uNumVertices; do { - v6 = v1 * array_507D30[v4].flt_20; + v6 = v1 * array_507D30[v4]._rhw; v7 = v6 * array_507D30[v4].vWorldViewPosition.y; memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4])); array_50AC10[v4].vWorldViewProjX = v2 - v7; @@ -14028,7 +14508,7 @@ //----- (00442955) -------------------------------------------------------- -int __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074) +int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074) { int v5; // ebx@1 int v6; // edi@1 @@ -15616,7 +16096,7 @@ //----- (00444A51) -------------------------------------------------------- char *__cdecl TransitionUI_Draw() { - MapInfo *v0; // esi@5 + MapInfo *pMapInfo; // esi@5 char *v1; // eax@6 char *result; // eax@12 std::string v3; // [sp-18h] [bp-84h]@11 @@ -15633,31 +16113,19 @@ v10 = pMapStats->GetMapInfo(pCurrentMapName); v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureIndexed( - _4E5E50_transui_x - 4, - _4E5EE0_transui_y - 4, - (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pTexture_outside); + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pTexture_outside); uTextureID_507B04 = uTextureID_right_panel; - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); - pRenderer->DrawTextureIndexed( - 0x22Cu, - 0x1C3u, - (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); - pRenderer->DrawTextureIndexed( - 0x1DCu, - 0x1C3u, - (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0)); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); + pRenderer->DrawTextureIndexed(556, 451, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureIndexed(476, 451, (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0)); if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != 48 ) v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); - v0 = &pMapStats->pInfos[v10]; + pMapInfo = &pMapStats->pInfos[v10]; v8.uFrameX = 493; v8.uFrameWidth = 126; v8.uFrameZ = 366; - v8.DrawTitleText(pFontCreate, 0, 5u, 0, v0->pName, 3u); + v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); v8.uFrameX = 483; v8.uFrameWidth = 148; v8.uFrameZ = 334; @@ -15669,9 +16137,11 @@ { if ( v10 ) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], v0->pName);// "Do you wish to leave %s?" - v1 = pTmpBuf; - goto LABEL_12; + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" + v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101; + result = v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3); + dword_5B5924 = 1; + return result; } v1 = ""; } @@ -15680,12 +16150,8 @@ MessageBoxW(nullptr, L"No transition text found!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1410", 0); v1 = ""; } -LABEL_12: - v7 = 3; - v6 = v1; - v5 = 0; v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; - result = v8.DrawTitleText(pFontCreate, 0, v4, v5, v6, v7); + result = v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); dword_5B5924 = 1; return result; } @@ -15768,7 +16234,7 @@ pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pTexture_outside); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pTexture_outside); pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, @@ -15934,10 +16400,10 @@ //----- (00445350) -------------------------------------------------------- void __cdecl DrawDialogueUI() { - NPCData *v0; // ebx@2 + NPCData *pNPC; // ebx@2 int v1; // eax@2 unsigned __int16 v2; // di@2 - unsigned int v3; // eax@2 + //unsigned int v3; // eax@2 char *v4; // esi@3 int v5; // eax@11 char *v6; // ecx@13 @@ -15982,7 +16448,7 @@ unsigned int v45; // ecx@104 unsigned __int16 *v46; // edx@104 unsigned __int16 v47; // ax@104 - char pFont; // [sp+4h] [bp-110h]@39 + GUIWindow pWindow; // [sp+4h] [bp-110h]@39 int v49; // [sp+Ch] [bp-108h]@39 int v50; // [sp+14h] [bp-100h]@39 GUIWindow v51; // [sp+58h] [bp-BCh]@2 @@ -15996,7 +16462,7 @@ if ( !pDialogueWindow ) return; memcpy(&v51, pDialogueWindow, sizeof(v51)); - v0 = GetNPCData(uDialogue_SpeakingActorNPC_ID); + pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); v1 = sub_445C8B(uDialogue_SpeakingActorNPC_ID); v51.uFrameWidth -= 10; v51.uFrameZ -= 10; @@ -16004,47 +16470,81 @@ GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); - pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); - pRenderer->DrawTextureIndexed( - _4E5E50_transui_x - 4, - _4E5EE0_transui_y - 4, - (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pDialogueNPCPortraits[0]); - v3 = v0->uProfession; - if ( v3 ) - { - v4 = pTmpBuf; - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v0->pName, aNPCProfessionNames[v3]); - } - else - { - strcpy(pTmpBuf, v0->pName); - v4 = pTmpBuf; - } - v51.DrawTitleText(pFontArrus, 0x1E3u, 0x70u, v2, v4, 3u); + pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]); + if ( pNPC->uProfession ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + } + else + { + strcpy(pTmpBuf, pNPC->pName); + } + v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); pParty->GetPartyFame(); if ( (signed int)uDialogueType > 89 ) { if ( uDialogueType == 90 ) { - v7 = pGlobalTXT_LocalizationStrings[577]; // "Get back in there you wimps:" - goto LABEL_37; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:" + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); + goto LABEL_42; } if ( uDialogueType == 91 ) { sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold." pInString = v4; v8 = 0; - goto LABEL_39; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( uDialogueType == 92 ) { v7 = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" - goto LABEL_37; + v8 = 0; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } } else @@ -16052,12 +16552,46 @@ if ( uDialogueType == 89 ) { v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" - goto LABEL_37; + v8 = 0; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( uDialogueType == 13 ) { - v5 = 5 * v0->uProfession; - goto LABEL_18; + v5 = 5 * pNPC->uProfession; + v6 = (char *)*(&pNPCStats->field_13A64 + v5); + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( (signed int)uDialogueType > 18 ) { @@ -16065,44 +16599,103 @@ { if ( uDialogueType == 77 ) { - v5 = 5 * v0->uProfession; + v5 = 5 * pNPC->uProfession; if ( byte_F8B1EC ) { - v6 = (char *)*(&pNPCStats->field_13A5C + 5 * v0->uProfession); - goto LABEL_19; - } - if ( v0->uFlags & 0x80 ) - { - v6 = (char *)*(&pNPCStats->field_13A68 + 5 * v0->uProfession); -LABEL_19: + v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession); + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; + } + if ( pNPC->uFlags & 0x80 ) + { + v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); v8 = 0; v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); -LABEL_38: pInString = v7; - goto LABEL_39; - } -LABEL_18: + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; + } v6 = (char *)*(&pNPCStats->field_13A64 + v5); - goto LABEL_19; + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } goto LABEL_24; } if ( byte_5B0938[0] ) goto LABEL_24; v7 = (char *)ptr_F8B1E8; -LABEL_37: v8 = 0; - goto LABEL_38; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } } LABEL_24: if ( *(int *)v54 == 1 ) { - v11 = v0->greet; + v11 = pNPC->greet; v8 = 0; if ( v11 ) { - v10 = (char *)*(&pNPCStats->field_17884 + ((v0->uFlags & 3) == 2) + 2 * v11); + v10 = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * v11); goto LABEL_32; } } @@ -16111,32 +16704,28 @@ if ( *(int *)v54 == 2 ) { v8 = 0; - if ( v0->uFlags & 0x80 ) - v9 = (char *)*(&pNPCStats->field_13A68 + 5 * v0->uProfession); - else - v9 = (char *)*(&pNPCStats->field_13A64 + 5 * v0->uProfession); + if ( pNPC->uFlags & 0x80 ) + v9 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); + else + v9 = (char *)*(&pNPCStats->field_13A64 + 5 * pNPC->uProfession); //"Invalid String Passed" v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); LABEL_32: pInString = v10; if ( v10 == (char *)v8 ) goto LABEL_42; -LABEL_39: - v49 = 460; - v50 = 452; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; pOutString = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, (GUIWindow *)&pFont, 13, v8) + 7; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; if ( 352 - v12 < 8 ) { pOutString = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, (GUIWindow *)&pFont, 13, v8) + 7; - } - pRenderer->_4A6A68( - 8u, - 352 - v12, - (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, pOutString, (GUIWindow *)&pFont, 0xDu, v8); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); goto LABEL_42; } @@ -16173,7 +16762,10 @@ if ( v29 ) { if ( v29 != 1 ) - goto LABEL_71; + { + v24 = ""; + goto LABEL_79; + } v24 = pGlobalTXT_LocalizationStrings[581]; } else @@ -16198,10 +16790,9 @@ } else { - if ( v0->uFlags & 0x80 ) - { -LABEL_59: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v0->pName); + if ( pNPC->uFlags & 0x80 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); v24 = pTmpBuf; goto LABEL_79; } @@ -16212,9 +16803,9 @@ { if ( v16 == 24 ) { - v23 = v0->evtf; + v23 = pNPC->evtf; LABEL_63: - v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; + v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; if ( !v24 ) { v24 = ""; @@ -16225,7 +16816,7 @@ v17 = v16 - 9; if ( !v17 ) { - v24 = (const char *)sub_445308(v0->uProfession); + v24 = (const char *)sub_445308(pNPC->uProfession); goto LABEL_79; } v18 = v17 - 4; @@ -16234,38 +16825,41 @@ v19 = v18 - 6; if ( !v19 ) { - v23 = v0->bDrawSomeAnim; + v23 = pNPC->bDrawSomeAnim; goto LABEL_63; } v20 = v19 - 1; if ( !v20 ) { - v23 = v0->_anim_current_time; + v23 = pNPC->_anim_current_time; goto LABEL_63; } v21 = v20 - 1; if ( !v21 ) { - v23 = v0->_anim_end_time; + v23 = pNPC->_anim_end_time; goto LABEL_63; } v22 = v21 - 1; if ( !v22 ) { - v23 = v0->evtd; + v23 = pNPC->evtd; goto LABEL_63; } if ( v22 == 1 ) { - v23 = v0->evte; + v23 = pNPC->evte; goto LABEL_63; } -LABEL_71: v24 = ""; goto LABEL_79; } - if ( v0->uFlags & 0x80 ) - goto LABEL_59; + if ( pNPC->uFlags & 0x80 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); + v24 = pTmpBuf; + goto LABEL_79; + } v24 = pGlobalTXT_LocalizationStrings[122]; } LABEL_79: @@ -16346,10 +16940,7 @@ while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); } } - pRenderer->DrawTextureIndexed( - 0x1D7u, - 0x1BDu, - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); + pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); } //----- (004459F9) -------------------------------------------------------- @@ -16987,7 +17578,14 @@ { case EVENT_CheckSeason: if ( !sub_4465DF_check_season(_evt->v5) ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } v11 = _evt->v6; goto LABEL_130; case EVENT_ShowMovie: @@ -16998,7 +17596,7 @@ if ( pVideoPlayer->field_54 ) pVideoPlayer->Unload(); pVideoPlayer->bStopBeforeSchedule = 0; - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; if (pAsyncMouse) pAsyncMouse->Suspend(); v128 = pCurrentScreen; @@ -17014,16 +17612,47 @@ { pParty->uAlignment = 0; v18 = 0; -LABEL_23: LOBYTE(v17) = 1; SetUserInterface(v18, v17); - goto LABEL_28; + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( !_strcmpi(v16, "arbiter evil") ) { v18 = 2; pParty->uAlignment = 2; - goto LABEL_23; + LOBYTE(v17) = 1; + SetUserInterface(v18, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( !_strcmpi(v16, "pcout01") ) // moving to harmondale from emerald isle { @@ -17031,7 +17660,6 @@ pParty->RestAndHeal(); pParty->field_764 = 0; } -LABEL_28: if ( !v15 || v128 == 3 ) { pCurrentScreen = v128; @@ -17042,7 +17670,12 @@ } if (pAsyncMouse) pAsyncMouse->Resume(); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_CheckSkill: v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); if ( v127 < 0 ) @@ -17074,9 +17707,15 @@ { ++v20; if ( v20 >= 4 ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } -LABEL_50: v11 = _evt->v11; goto LABEL_130; } @@ -17090,8 +17729,16 @@ v138 = v24 & 0x80; v139 = v24 & 0x100; if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) - goto LABEL_50; - goto LABEL_291; + { + v11 = _evt->v11; + goto LABEL_130; + } + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SpeakNPC: if ( a3 ) { @@ -17109,7 +17756,12 @@ bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeEvent: v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); if ( v25 ) @@ -17122,13 +17774,23 @@ stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; LOBYTE(v26->field_2) |= 0x20u; } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCGreeting: v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; pNPCStats->pNewNPCData[v27].greet = v28; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCTopic: v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); @@ -17196,26 +17858,47 @@ } } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_NPCSetItem: - sub_448518_npc_set_item( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetActorItem: - Actor::GiveItem( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCGroupNews: pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetActorGroup: __debugbreak(); *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeGroup: v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); @@ -17226,14 +17909,19 @@ v41 = pActors;//[0].uGroup; do { - if ( v41->uGroup == v38 ) - v41->uGroup = v39; + if ( v41->uGroup == v38 ) + v41->uGroup = v39; ++v41; --v40; } while ( v40 ); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeGroupAlly: v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); @@ -17244,14 +17932,19 @@ v45 = pActors;//[0].uAlly; do { - if ( v45->uGroup == v42 ) - v45->uAlly = v43; + if ( v45->uGroup == v42 ) + v45->uAlly = v43; ++v45; --v44; } while ( v44 ); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MoveNPC: pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].house = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); if ( ptr_507BC0 ) @@ -17292,11 +17985,21 @@ pVideoPlayer->bLoopPlaying = 0; } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Jmp: //v124 = -1; v122 = _evt->v5 - 1; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ShowFace: v50 = _evt->v5; if ( (unsigned __int8)v50 <= 3u ) @@ -17304,25 +18007,41 @@ v117 = 0; v113 = _evt->v6; v53 = (unsigned __int8)v50; - goto LABEL_108; + v52 = &pParty->pPlayers[v53]; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( v50 == 4 ) { v117 = 0; v113 = _evt->v6; v52 = pPlayers[uActiveCharacter]; - goto LABEL_109; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( v50 != 5 ) { v117 = 0; v113 = _evt->v6; v53 = rand() % 4; -LABEL_108: v52 = &pParty->pPlayers[v53]; -LABEL_109: v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v51 = pParty->pPlayers; do @@ -17331,7 +18050,7 @@ ++v51; } while ( (signed int)v51 < (signed int)pParty->pHirelings ); -LABEL_291: +//LABEL_291: ++v122; //v4 = v124; //v5 = pSomeEVT; @@ -17363,7 +18082,12 @@ v56 = &pParty->pPlayers[v57]; LABEL_120: v56->PlaySound(v114, v118); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v55 = pParty->pPlayers; do @@ -17372,22 +18096,33 @@ ++v55; } while ( (signed int)v55 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ForPartyMember: v127 = _evt->v5; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SummonItem: - sub_42F7EB_DropItemAt( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), - _evt->v25, - _evt->v26, - 0, - 0); - goto LABEL_291; + _evt->v25, _evt->v26, 0, 0); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Compare: v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); if ( v127 == 5 ) @@ -17396,16 +18131,20 @@ v59 = pParty->pPlayers; while ( 1 ) { - LOBYTE(v60) = v59->CompareVariable( - (enum VariableType)(_evt->v5 - + ((uint)_evt->v6 << 8)), - v58); + LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); if ( v60 ) break; ++v130; ++v59; if ( (signed int)v59 >= (signed int)pParty->pHirelings ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } LABEL_129: v11 = _evt->v11; @@ -17442,7 +18181,12 @@ LABEL_140: if ( v62 ) goto LABEL_129; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_IsActorAlive: v62 = IsActorAlive( _evt->v5, @@ -17457,7 +18201,12 @@ if ( (void *)pParty->pPickedItem.uItemID == v63 ) { pMouse->RemoveHoldingItem(); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v65 = 0; v66 = pPlayers[uActiveCharacter]; @@ -17467,7 +18216,12 @@ if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) { v66->RemoveItemAtInventoryIndex(v65); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } ++v65; v67 += 4; @@ -17480,7 +18234,12 @@ if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) { *(&v66->pEquipment.uOffHand + v68) = 0; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } ++v68; v69 += 4; @@ -17522,7 +18281,14 @@ LABEL_170: v125 += 4; if ( v125 > (signed int)&pPlayers[4] ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } } v75 = v127; @@ -17537,10 +18303,13 @@ if ( v127 == 6 ) goto LABEL_180; LABEL_183: - ((Player *)v6)->SubtractVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v63); - goto LABEL_291; + ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( uActiveCharacter ) { @@ -17566,7 +18335,12 @@ ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Set: v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v78 = v127; @@ -17581,10 +18355,13 @@ if ( v127 == 6 ) goto LABEL_194; LABEL_197: - ((Player *)v6)->SetVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v77); - goto LABEL_291; + ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( uActiveCharacter ) { @@ -17610,7 +18387,12 @@ ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Add: v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v81 = v127; @@ -17658,7 +18440,12 @@ v83 = _evt->v5 + ((uint)_evt->v6 << 8); if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) viewparams->bRedrawGameUI = 1; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_InputString: if ( !dword_597F18 ) { @@ -17690,16 +18477,15 @@ LABEL_131: v122 = v11 - 1; } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_RandomGoTo: //v124 = -1; - v11 = (unsigned __int8)*(&_evt->v5 - + rand() - % ((_evt->v5 != 0) - + (_evt->v6 != 0) - + (_evt->v7 != 0) - + (_evt->v8 != 0) - + (_evt->v9 != 0) + v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) + (_evt->v10 != 0))); goto LABEL_131; case EVENT_ReceiveDamage: @@ -17715,7 +18501,14 @@ if ( v86 == 4 ) { if ( !uActiveCharacter ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } v119 = _evt->v6; v88 = pPlayers[uActiveCharacter]; v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); @@ -17730,7 +18523,12 @@ v88 = &pParty->pPlayers[v89]; LABEL_234: v88->ReceiveDamage(v115, v119); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v87 = pParty->pPlayers; do @@ -17739,53 +18537,92 @@ ++v87; } while ( (signed int)v87 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleIndoorLight: pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetFacesBit: - sub_44892E_set_faces_bit( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleChestFlag: - Chest::ToggleFlag( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleActorFlag: - Actor::ToggleFlag( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleActorGroupFlag: ToggleActorGroupFlag( _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetSnow: if ( !_evt->v5 ) pWeather->bRenderSnow = _evt->v6 != 0; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_StatusText: v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) { if ( _5C3420_pDecoration == (LevelDecoration *)1 ) { - ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - goto LABEL_291; + ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( a3 == 1 ) { v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; -LABEL_248: +//LABEL_248: ShowStatusBarString(v91, 2u); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } } else @@ -17793,10 +18630,21 @@ if ( a3 == 1 ) { v91 = &pLevelStr[pLevelStrOffsets[v90]]; - goto LABEL_248; - } - } - goto LABEL_291; + ShowStatusBarString(v91, 2u); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ShowMessage: v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) @@ -17809,50 +18657,80 @@ { strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_CastSpell: - sub_448DF8_cast_spell( - _evt->v5, - _evt->v6, - _evt->v7, - _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetTexture: sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetSprite: - SetDecorationSprite( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9, - (char *)&_evt->v10); - goto LABEL_291; + SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SummonMonsters: - sub_448CF4_spawn_monsters( - _evt->v5, - _evt->v6, - _evt->v7, + sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8)); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MouseOver: case EVENT_LocationName: --v122; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeDoorState: sub_449A49_door_switch_animation(_evt->v5, _evt->v6); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_OpenChest: if ( !Chest::Open(_evt->v5) ) goto LABEL_301; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MoveToMap: v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); @@ -17867,16 +18745,7 @@ { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A(); - sub_444839_move_map( - _evt->v29, - _evt->v30, - v135, - v132, - v126, - v129, - v95, - v134, - (char *)&_evt->v31); + sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); dword_5C3418 = uEventID; dword_5C341C = v122 + 1; goto LABEL_301; @@ -17958,7 +18827,12 @@ goto LABEL_302; } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_PlaySound: v120 = 0; v116 = 0; @@ -17978,7 +18852,12 @@ if ( v102 ) item.uItemID = v102; pParty->SetHoldingItem(&item); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SpeakInHouse: v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) @@ -17997,7 +18876,12 @@ ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_PressAnyKey: v121 = 33; v105 = v122 + 1; @@ -18005,7 +18889,12 @@ case EVENT_Exit: goto LABEL_301; default: - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } } //++v4; @@ -18508,7 +19397,7 @@ double v2; // st7@1 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); - v->flt_20 = v1; + v->_rhw = v1; v2 = v1 * (double)pOutdoorCamera->int_fov_rad; v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z;
--- a/mm7_4.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_4.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -5450,7 +5450,7 @@ { pGUIWindow_CurrentMenu->field_40 = 0; pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 124, 0, player->pName, 130, 0); - SetCurrentMenuID(MENU_7); + SetCurrentMenuID(MENU_NAMEPANELESC); } } else @@ -6208,7 +6208,7 @@ pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0); pCurrentScreen = SCREEN_CREATORS; - SetCurrentMenuID(MENU_Credits); + SetCurrentMenuID(MENU_CREDITSPROC); do { while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) @@ -6240,7 +6240,7 @@ GUI_MainMenuMessageProc(); } } - while ( GetCurrentMenuID() == MENU_Credits ); + while ( GetCurrentMenuID() == MENU_CREDITSPROC ); pAudioPlayer->_4AA258(1); pAllocator->FreeChunk(ptr); pAllocator->FreeChunk(pFontQuick); @@ -6758,7 +6758,7 @@ { memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, 1u) ) + if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) { //v26 = Dst.lpSurface; pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; @@ -11082,42 +11082,20 @@ { NPCData *v0; // ST40_4@1 signed int v1; // edi@1 - GUIWindow *v2; // ecx@1 - + //GUIWindow *v2; // ecx@1 + + __debugbreak(); v0 = GetNPCData(uDialogue_SpeakingActorNPC_ID); v1 = 0; pDialogueWindow->eWindowType = WINDOW_MainMenu; pDialogueWindow->Release(); - v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_A, 1, 0); - pDialogueWindow = v2; + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); if ( *(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) { - v2->CreateButton( - 0x1E0u, - 0xA0u, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0x88u, - 0x4Du, - 0, - pGlobalTXT_LocalizationStrings[407], - 0); + pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); v1 = 1; } - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1 + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0x88u, - 0x4Cu, - 0, - pGlobalTXT_LocalizationStrings[406], - 0); + pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);// pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); } @@ -11311,8 +11289,8 @@ (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); pDialogueWindow->CreateButton( - _4E5E50_transui_x, - _4E5EE0_transui_y, + pNPCPortraits_x, + pNPCPortraits_y, 63u, 73u, 1,
--- a/mm7_5.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_5.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -753,7 +753,7 @@ v130 = 0; v127 = 219; goto _play_sound_and_continue; - case 0x1A0: + case UIMSG_1A0: dword_506F08 = v0; continue; case UIMSG_1A1: @@ -3790,25 +3790,25 @@ pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex); switch (pUIMessageType) // For buttons of window MainMenu { - case UIMSG_MainMenu_ShowPartyCreationWnd:// + case UIMSG_MainMenu_ShowPartyCreationWnd: { GUIWindow::Create(495, 172, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0); SetCurrentMenuID(MENU_NEWGAME); } continue; - case UIMSG_MainMenu_ShowLoadWindow:// + case UIMSG_MainMenu_ShowLoadWindow: { GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0); SetCurrentMenuID(MENU_SAVELOAD); } continue; - case UIMSG_ShowCredits:// + case UIMSG_ShowCredits: { GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0); SetCurrentMenuID(MENU_CREDITS); } continue; - case UIMSG_ExitToWindows:// + case UIMSG_ExitToWindows: { GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); SetCurrentMenuID(MENU_FINISHED); @@ -3818,14 +3818,14 @@ switch (pUIMessageType) // For buttons of window LoadGame { - case UIMSG_LoadGame:// + case UIMSG_LoadGame: { if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) continue; - SetCurrentMenuID(MENU_LOAD); - continue; - } - case UIMSG_SelectLoadSlot: // + SetCurrentMenuID(MENU_LOADINGPROC); + continue; + } + case UIMSG_SelectLoadSlot: { //main menu save/load wnd clicking on savegame lines if (pGUIWindow_CurrentMenu->field_40 == 1) @@ -3851,12 +3851,12 @@ } continue; } - case UIMSG_LoadSlot: // + case UIMSG_LoadSlot: { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0); continue; } - case UIMSG_DownArrow:// + case UIMSG_DownArrow: { ++pSaveListPosition; if ( pSaveListPosition >= uNum ) @@ -3864,23 +3864,21 @@ if ( pSaveListPosition < 1 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - v8 = pGUIWindow_CurrentMenu->uFrameY + 323; - GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); - continue; - } - case UIMSG_Cancel:// + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); + continue; + } + case UIMSG_Cancel: { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0); continue; } - case UIMSG_ArrowUp:// + case UIMSG_ArrowUp: { --pSaveListPosition; if ( pSaveListPosition < 0 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - v8 = pGUIWindow_CurrentMenu->uFrameY + 197; - GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0); + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0); continue; } } @@ -3889,7 +3887,7 @@ { if ( pUIMessageType > UIMSG_DownArrow ) { - if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) // + if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) { pPlayer = &pParty->pPlayers[uNum]; v12 = (char)((int)pPlayer->uFace - 1) < 0; @@ -3912,7 +3910,7 @@ //v1 = (char *)pParty->pPlayers; continue; } - if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) // + if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) { pPlayer = &pParty->pPlayers[uNum]; v20 = (char)((int)pPlayer->uFace + 1) % 20; @@ -3937,7 +3935,7 @@ { __debugbreak(); GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0); - SetCurrentMenuID(MENU_LOAD); + SetCurrentMenuID(MENU_LOADINGPROC); continue; } if ( pUIMessageType != UIMSG_AE )//unknow @@ -3946,11 +3944,7 @@ continue; } GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0); -//LABEL_114: - v40 = 10; -//LABEL_89: - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_10); continue; } if ( pUIMessageType == UIMSG_6B )//unknow @@ -3967,7 +3961,6 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - //goto LABEL_93; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -3986,26 +3979,19 @@ pVideoPlayer->bStopBeforeSchedule = 1; viewparams->bRedrawGameUI = 1; viewparams->field_48 = 1; - if ( !GetCurrentMenuID() || GetCurrentMenuID() == 6 || GetCurrentMenuID() == 7 ) - { - v17 = pCurrentScreen; + if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) + { LABEL_83: - if ( v17 == 16 ) - pVideoPlayer->FastForwardToFrame(pVideoPlayer->field_40); - if (GetCurrentMenuID() == MENU_7) - { - v40 = 6; - //goto LABEL_89; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + if ( pCurrentScreen == SCREEN_VIDEO ) + pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); + if (GetCurrentMenuID() == MENU_NAMEPANELESC) + { + SetCurrentMenuID(MENU_CREATEPARTY); continue; } - if (GetCurrentMenuID() == MENU_Credits) - { - v40 = 11; - //goto LABEL_89; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + if (GetCurrentMenuID() == MENU_CREDITSPROC) + { + SetCurrentMenuID(MENU_CREDITSCLOSE); continue; } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -4020,7 +4006,6 @@ continue; } v16 = GetCurrentMenuID() == 8; - v17 = pCurrentScreen; if ( v16 && !pCurrentScreen ) goto LABEL_83; if ( pCurrentScreen == SCREEN_LOADGAME ) @@ -4095,9 +4080,8 @@ do { pCurrentPlayer->uVoiceID = (signed int)(pCurrentPlayer->uVoiceID + 1) % 20; - v10 = pCurrentPlayer->GetSexByVoice(); - } - while ( v10 != pSex ); + } + while ( pCurrentPlayer->GetSexByVoice() != pSex ); pButton = pCreationUI_BtnPressRight2[uNum]; GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); @@ -4111,12 +4095,11 @@ if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill ) { uPlayerCreationUI_SelectedCharacter = uNum; - v41 = 3; + //v41 = 3; //v1 = (char *)pParty->pPlayers; - v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; - pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; continue; } @@ -4203,9 +4186,7 @@ break; case UIMSG_3A://unknow __debugbreak(); - v40 = 10; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_10); break; } } @@ -14136,7 +14117,7 @@ dword_506538 = 0; dword_50653C = 0; dword_506540 = 0; - DrawSpellbook_Map_sub(97, 49, 361, 313, 0); + DrawBook_Map_sub(97, 49, 361, 313, 0); pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); v22.uFrameWidth = 460; v22.uFrameHeight = 344; @@ -15528,7 +15509,7 @@ } continue; } - if ( pWindowType != 10 ) + if ( pWindowType != 10 ) //pWindowType == 10 { v2 = pWindowType - 3; if ( v2 )//pWindowType > 3
--- a/mm7_6.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_6.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -91,7 +91,7 @@ v5 = (char *)&array_507D30[0].vWorldViewPosition.y; v6 = v1; v23 = (char *)&array_507D30[0].flt_2C; - v26 = (char *)&array_507D30[0].flt_20; + v26 = (char *)&array_507D30[0]._rhw; v24 = array_507D30; v20 = (char *)&array_507D30[0].vWorldViewPosition.z; v21 = (char *)&array_507D30[0].vWorldViewPosition.y; @@ -228,7 +228,7 @@ return 0; v2 = (char *)&array_507D30[0].vWorldViewPosition.z; v3 = (char *)&array_507D30[0].vWorldViewPosition.y; - v24 = (char *)&array_507D30[0].flt_20; + v24 = (char *)&array_507D30[0]._rhw; v22 = array_507D30; v19 = (char *)&array_507D30[0].vWorldViewPosition.z; v20 = (char *)&array_507D30[0].vWorldViewPosition.y; @@ -359,7 +359,7 @@ return 0; v3 = (char *)&array_507D30[0].vWorldViewPosition.z; v4 = (char *)&array_507D30[0].vWorldViewPosition.y; - v25 = (char *)&array_507D30[0].flt_20; + v25 = (char *)&array_507D30[0]._rhw; v23 = array_507D30; v20 = (char *)&array_507D30[0].vWorldViewPosition.z; v21 = (char *)&array_507D30[0].vWorldViewPosition.y; @@ -718,7 +718,7 @@ v137 = (char *)&array_50A2B0[0].vWorldViewProjX; v128 = (char *)&array_50A2B0[0].vWorldViewProjY; v121 = (char *)&array_50A2B0[0].flt_2C; - v114 = (char *)&array_50A2B0[0].flt_20; + v114 = (char *)&array_50A2B0[0]._rhw; v7 = (char *)&array_50AC10[0].flt_2C; do { @@ -804,14 +804,14 @@ v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportZ, v110 < 1) ) goto LABEL_112; - v25 = (char *)&array_509950[0].flt_20; + v25 = (char *)&array_509950[0]._rhw; v138 = array_509950; v129 = (char *)&array_50A2B0[0].vWorldViewProjX; v118 = (char *)&array_50A2B0[0].vWorldViewProjY; v133 = (char *)&array_509950[0].vWorldViewProjX; v122 = (char *)&array_509950[0].vWorldViewProjY; v124 = (char *)&array_509950[0].flt_2C; - v111 = (char *)&array_509950[0].flt_20; + v111 = (char *)&array_509950[0]._rhw; v26 = (char *)&array_50A2B0[0].flt_2C; while ( 2 ) { @@ -906,7 +906,7 @@ v119 = (char *)&array_508FF0[0].vWorldViewProjX; v139 = (char *)&array_508FF0[0].vWorldViewProjY; v125 = (char *)&array_508FF0[0].flt_2C; - v134 = (char *)&array_508FF0[0].flt_20; + v134 = (char *)&array_508FF0[0]._rhw; v45 = (char *)&array_509950[0].flt_2C; v112 = v115; while ( 2 ) @@ -997,7 +997,7 @@ v120 = (char *)&array_508690[0].vWorldViewProjX; v140 = (char *)&array_508690[0].vWorldViewProjY; v126 = (char *)&array_508690[0].flt_2C; - v135 = (char *)&array_508690[0].flt_20; + v135 = (char *)&array_508690[0]._rhw; v64 = (char *)&array_508FF0[0].flt_2C; v113 = v123; while ( 2 ) @@ -8943,17 +8943,29 @@ if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) - goto _do_move_forward; - if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) + //goto _do_move_forward; { - pTurnEngine->uActionPointsLeft -= 26; -_do_move_forward: v5 = pActionQueue; if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) partyAction = PARTY_RunForward; else partyAction = PARTY_WalkForward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; + } + if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) + { + pTurnEngine->uActionPointsLeft -= 26; +//_do_move_forward: + v5 = pActionQueue; + if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) + partyAction = PARTY_RunForward; + else + partyAction = PARTY_WalkForward; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } break; case INPUT_MoveBackwards: @@ -8968,7 +8980,9 @@ partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) { @@ -8979,7 +8993,9 @@ partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } break; case INPUT_StrafeLeft: @@ -8990,14 +9006,20 @@ //goto _do_strafe_left; { partyAction = PARTY_StrafeLeft; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; //_do_strafe_left: partyAction = PARTY_StrafeLeft; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_StrafeRight: //__debugbreak(); if ( pCurrentScreen ) @@ -9006,14 +9028,20 @@ //goto _do_strafe_right; { partyAction = PARTY_StrafeRight; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; //_do_strafe_right: partyAction = PARTY_StrafeRight; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_TurnLeft: if ( pCurrentScreen ) break; @@ -9038,7 +9066,9 @@ if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { v20 = 10; - goto LABEL_75; + //goto LABEL_75; + pWeather->_4C2F0B(v20); + break; } break; case INPUT_TurnRight: @@ -9065,7 +9095,7 @@ if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { v20 = -10; -LABEL_75: +//LABEL_75: pWeather->_4C2F0B(v20); } break; @@ -9075,7 +9105,10 @@ || pParty->bTurnBasedModeOn) break; partyAction = (PartyAction)12; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_Yell: //__debugbreak(); if ( !pCurrentScreen @@ -9152,7 +9185,11 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; - goto _send_message; + //goto _send_message; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; } } else @@ -9182,7 +9219,11 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) break; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; - goto _send_message; + //goto _send_message; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) { @@ -9193,9 +9234,9 @@ { v11 = 1; pMessageQueue_50CBD0->uNumMessages = 1; -LABEL_132: +//LABEL_132: pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; -_send_message: +//_send_message: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -9205,7 +9246,14 @@ pMessageQueue_50CBD0->uNumMessages = 0; } if ( (signed int)v11 < 40 ) - goto LABEL_132; + //goto LABEL_132; + { + pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; + } } break; case INPUT_CharCycle: @@ -9214,48 +9262,67 @@ || dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 176; - goto LABEL_155; + //goto LABEL_155; + dword_50C9F0[3 * dword_50C9E8] = 0; + *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + ++dword_50C9E8; + break; case INPUT_LookUp: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)7; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_CenterView: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)9; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_LookDown: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)8; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_FlyUp: //__debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)13; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_Land: //__debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)15; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_FlyDown: //__debugbreak(); if ( !pCurrentScreen && !pEventTimer->bPaused ) { partyAction = (PartyAction)14; -_add_action_and_continue_: +//_add_action_and_continue_: v5 = pActionQueue; -_add_action_and_continue: +//_add_action_and_continue: v5->Add(partyAction); } break; @@ -9264,13 +9331,17 @@ if ( dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 367; - goto LABEL_155; + //goto LABEL_155; + dword_50C9F0[3 * dword_50C9E8] = 0; + *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + ++dword_50C9E8; + break; case INPUT_ZoomOut: //__debugbreak(); if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 368; -LABEL_155: +//LABEL_155: dword_50C9F0[3 * dword_50C9E8] = 0; *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; ++dword_50C9E8;
--- a/mm7_data.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_data.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -736,9 +736,9 @@ char aBardataC[10]; // weak char aLoadprog[777]; // idb char aLoadingD_pcx[777]; // idb -int _4E5E50_transui_x; // idb +int pNPCPortraits_x = 521; // idb int dword_4E5EC8[777]; // weak -int _4E5EE0_transui_y; // idb +int pNPCPortraits_y = 38; // idb const char *pHouse_ExitPictures[11]; char *_4E6BDC_loc_names[11]; char aOutside[777]; // idb
--- a/mm7_data.h Thu Feb 14 22:38:44 2013 +0600 +++ b/mm7_data.h Thu Feb 14 22:38:54 2013 +0600 @@ -683,9 +683,9 @@ extern char aBardataC[10]; // weak extern char aLoadprog[]; // idb extern char aLoadingD_pcx[]; // idb -extern int _4E5E50_transui_x; // idb +extern int pNPCPortraits_x; // idb extern int dword_4E5EC8[]; // weak -extern int _4E5EE0_transui_y; // idb +extern int pNPCPortraits_y; // idb extern const char *pHouse_ExitPictures[11]; extern char *_4E6BDC_loc_names[11]; extern char aOutside[]; // idb @@ -2001,7 +2001,7 @@ void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); -int __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb +int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb int __cdecl Initialize2DA(); unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize); void __cdecl Initialize_GlobalEVT();
--- a/stru9.cpp Thu Feb 14 22:38:44 2013 +0600 +++ b/stru9.cpp Thu Feb 14 22:38:54 2013 +0600 @@ -127,7 +127,7 @@ v14 = (VertexBuffer *)((char *)v14 + 48); *(float *)v15 = *(float *)&v15[(char *)&static_AE33A0 - (char *)pVertices]; *((float *)v15 + 1) = *(float *)&v15[i]; - *((float *)v15 + 8) = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].flt_20 - (char *)pVertices]; + *((float *)v15 + 8) = *(float *)&v15[(char *)&static_AE33A0.pVertices[0]._rhw - (char *)pVertices]; *((float *)v15 + 9) = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].u - (char *)pVertices]; v13 = static_AE33A0.uNumVertices; v15 += 48;