# HG changeset patch # User Grumpy7 # Date 1380175745 -7200 # Node ID e8d477b4859606177116f368a2dcbd75e5b7fea5 # Parent 34dd357a489dec9a75140d6224ffc6dab4ff5945# Parent 79b9306f573a2abc5cc401b5b84ded07a0d5dfbc Merge diff -r 34dd357a489d -r e8d477b48596 Player.h --- a/Player.h Thu Sep 26 08:07:50 2013 +0200 +++ b/Player.h Thu Sep 26 08:09:05 2013 +0200 @@ -55,7 +55,7 @@ SPEECH_12 = 12, SPEECH_14 = 14, SPEECH_NoRoom = 15, // when placing to inventory - SPEECH_16 = 16, + SPEECH_DO_POTION_FINE = 16, SPEECH_17 = 17, SPEECH_18 = 18, SPEECH_19 = 19, @@ -143,9 +143,9 @@ SPEECH_101 = 101, SPEECH_PickMe = 102, SPEECH_103 = 103, - SPEECH_104 = 104, - SPEECH_105 = 105, - SPEECH_106 = 106, + SPEECH_IDENTIFY_MONSTER_WEAKER = 104, + SPEECH_IDENTIFY_MONSTER_STRONGER = 105, + SPEECH_IDENTIFY_MONSTER_106 = 106, SPEECH_107 = 107, SPEECH_108 = 108, SPEECH_109 = 109, diff -r 34dd357a489d -r e8d477b48596 UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/UI/Books/UIMapBook.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -193,12 +193,12 @@ GUIWindow map_window; // [sp+84h] [bp-54h]@35 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1 + if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2 + if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); @@ -265,11 +265,6 @@ void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) { int v20; // eax@16 - signed int v21; // esi@18 - int v22; // ecx@21 - BLVMapOutline *v23; // ecx@21 - Vec3_short_ *v24; // edx@21 - Vec3_short_ *v25; // eax@21 int v26; // ecx@21 unsigned __int16 *v27; // edi@21 int v28; // edx@21 @@ -313,16 +308,13 @@ unsigned __int16 *v67; // esi@96 int v68; // edi@98 unsigned __int16 v69; // cx@99 - unsigned int v70; // [sp-10h] [bp-48074h]@80 - unsigned int v71; // [sp-Ch] [bp-48070h]@80 - unsigned int v72; // [sp-8h] [bp-4806Ch]@80 signed int v73; // [sp-4h] [bp-48068h]@59 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 int v76; // [sp+4800Ch] [bp-58h]@23 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 - int v81; // [sp+48020h] [bp-44h]@23 + int map_tile_X; // [sp+48020h] [bp-44h]@23 unsigned __int16* render16_data; unsigned char* texture8_data; unsigned char* curr_line; @@ -343,7 +335,7 @@ unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 signed int screenWidth; // [sp+48054h] [bp-10h]@8 unsigned int v95; // [sp+48058h] [bp-Ch]@16 - int v96; // [sp+4805Ch] [bp-8h]@10 + int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 const void *v97; // [sp+48060h] [bp-4h]@16 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 int a5a; // [sp+48070h] [bp+Ch]@86 @@ -353,12 +345,12 @@ pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); pCenterX = viewparams->sViewCenterX; pCenterY = viewparams->sViewCenterY; - if ( viewparams->field_2C != 384 ) + if ( viewparams->uMapBookMapZoom != 384 ) { - if ( viewparams->field_2C == 768 ) + if ( viewparams->uMapBookMapZoom == 768 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->field_2C = 680; + viewparams->uMapBookMapZoom = 680; } } else @@ -367,7 +359,7 @@ pCenterX = viewparams->indoor_center_x; pCenterY = viewparams->indoor_center_y; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->field_2C = viewparams->field_2C - 34; + viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34; } if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { @@ -376,20 +368,16 @@ render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->field_2C; + scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30) << 16; - // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); + teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; - // v32 = map_texture_16; textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->field_2C / 384)+ 32768) / v30) << 16; - // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); - black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30); + stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16; + black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30); - // v76 = textr_width; scaled_posY = stepY_r >> 16; //nearest neiborhood scaling if ( texture8_data) @@ -445,64 +433,52 @@ screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; - v97 = (const void *)v20; - v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16; - v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->field_2C) >> 16; - v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16); - screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->field_2C) >> 16; + + v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16); + screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, - screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - screenHeight, black); + screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - screenHeight, black); } } } } - v21 = 0; if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) { - while ( 1 ) + for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j ) { - v22 = pBlueFacesInBLVMinimapIDs[v21]; - v87 = viewparams->field_2C; - v23 = &pIndoor->pMapOutlines->pOutlines[v22]; - v24 = &pIndoor->pVertices[v23->uVertex1ID]; - v25 = &pIndoor->pVertices[v23->uVertex2ID]; - v26 = v25->x; - v27 = (unsigned __int16 *)(v24->x - pCenterX); - v28 = v24->y - pCenterY; - v29 = v25->y - pCenterY; - v93 = v27; - screenHeight = v28; - v97 = (const void *)v29; - v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16; - v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->field_2C) >> 16; - uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16; - v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->field_2C) >> 16; - pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16), - screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - v95, teal); - ++v21; - if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) - break; + v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x; + v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX); + v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY; + v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY; + + v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16), + screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - v95, teal); } viewparams->sViewCenterX = pCenterX; } } - v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 3; - v81 = pParty->vPosition.y - pCenterY; - v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->field_2C) >> 16); + v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 3; + v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->uMapBookMapZoom) >> 16); v48 = 1; v49 = screenCenterY - (int)v97 - 3; if ( v47 >= (signed int)tl_x ) { if ( v47 > (signed int)br_x ) { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 6) > (signed int)br_x ) + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 6) > (signed int)br_x ) v48 = 0; v47 = br_x; } } else { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X) < (signed int)tl_x ) + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X) < (signed int)tl_x ) v48 = 0; v47 = tl_x; } @@ -542,8 +518,6 @@ v50 = 7; pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); } - result = TargetColor(0xFFu, 0xFFu, 0xFFu); - pCenterX = result; if ( (signed int)uNumLevelDecorations > 0 ) { for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) @@ -552,30 +526,22 @@ { screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); - v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; - v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->field_2C) >> 16); + v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X; + v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16); v55 = screenCenterY - (int)v97; - if ( v54 >= pRenderer->raster_clip_x ) + if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z + && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) { - if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) + if ( viewparams->uMapBookMapZoom > 512 ) { - if ( viewparams->field_2C > 512 ) - { - pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX); - pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, pCenterX); - ++v54; - v72 = v55 + 1; - v71 = v54; - v70 = v55 - 1; - } - else - { - v72 = screenCenterY - (int)v97; - v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; - v70 = screenCenterY - (int)v97; - } - pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX); + pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); } + else + pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, + ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X, + screenCenterY - (int)v97, TargetColor(0xFFu, 0xFFu, 0xFFu)); } } } @@ -585,35 +551,30 @@ screenCenterY = br_x - tl_x + 1; v95 = br_y - tl_y + 1; v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; - v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; - black = (1 << (v56 + 16)) / viewparams->field_2C; - v57 = (double)(1 << (16 - v56)); - v58 = 22528 / (viewparams->field_2C / 384); - v59 = (signed __int64)((double)(viewparams->sViewCenterX - v58 + 32768) / v57); - v60 = (int)v59 << 16; - v97 = (const void *)((int)v59 << 16); - v61 = (signed __int64)((double)(32768 - v58 - pCenterY) / v57); + black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; + v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16; + teal = v60 >> 16; pPalette_16 = (unsigned __int16 *)(v60 >> 16); - v62 = (int)v61 << 16; - teal = v60 >> 16; - v63 = (signed __int16)v61; + v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16); + v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16; + v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)); a4a = map_texture_16; - result = TargetColor(0xCu, 0xCu, 0xCu); for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X ) { if ( screenCenterY > 0 ) { - v96 = (v63 - 80) / 4; + map_tile_Y = (v63 - 80) / 4; v64 = teal; for ( a5a = 0; a5a < screenCenterY; ++a5a ) { - v81 = (v64 - 80) / 4; - if ( !pOutdoor->_47F04C(v81, v96) ) + map_tile_X = (v64 - 80) / 4; + if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) ) { - if ( pOutdoor->_47F097(v81, v96) ) + if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) ) { if ( !((a5a + screenCenter_X) % 2) ) - *a4a = result; + *a4a = TargetColor(0xCu, 0xCu, 0xCu); } else *a4a = 0; @@ -652,3 +613,63 @@ } } } + +//----- (00444564) -------------------------------------------------------- +const char * GetMapBookHintText() +{ + int v20; + int v21; // [sp+14h] [bp-Ch]@1 + double v0; // st7@3 + unsigned int pX; // [sp+1Ch] [bp-4h]@3 + unsigned int pY; // [sp+8h] [bp-18h]@3 + int global_coord_X; // ebx@3 + int global_coord_Y; + int map_tile_X; // edi@3 + int map_tile_Y; // eax@3 + const char *result; // eax@15 + + v20 = viewparams->sViewCenterX; + v21 = viewparams->sViewCenterY; + if ( viewparams->uMapBookMapZoom == 384 ) + { + v20 = viewparams->indoor_center_x; + v21 = viewparams->indoor_center_y; + } + pMouse->GetClickPos(&pX, &pY); + v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789); + + global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20); + global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0); + + result = 0; + map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме) + map_tile_Y = abs(global_coord_Y - 22528) / 512; + if ( pOutdoor->_47F04C(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 ) + { + for(int i = 0; i < pOutdoor->uNumBModels && !result; i++) + { + if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius ) + { + if ( pOutdoor->pBModels[i].uNumFaces > 0 ) + { + for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ ) + { + if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID ) + { + if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & 0x100000) ) + { + if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) ) + { + if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") ) + result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID); + } + } + } + } + } + } + } + } + return result; +} \ No newline at end of file diff -r 34dd357a489d -r e8d477b48596 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/UI/UIPopup.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -24,6 +24,7 @@ #include "..\texts.h" #include "..\mm7_data.h" +#include "..\Events.h" static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually @@ -440,13 +441,10 @@ unsigned __int8 v27; // sf@36 unsigned __int8 v28; // of@36 SpellBuff *v40; // eax@60 - int v41; // edi@61 - unsigned int v42; // eax@61 - int v43; // eax@62 - int v44; // eax@63 - signed int v45; // edi@65 + int skill_points; // edi@61 + unsigned int skill_level; // eax@61 int pTextHeight; // edi@90 - int v73; // [sp-8h] [bp-1F4h]@79 + PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 RECT v84; // [sp+ECh] [bp-100h]@26 @@ -457,7 +455,7 @@ unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 - int v115; // [sp+1C0h] [bp-2Ch]@3 + bool for_effects; // [sp+1C0h] [bp-2Ch]@3 bool normal_level; // [sp+1D0h] [bp-1Ch]@18 bool expert_level; // [sp+1C4h] [bp-28h]@18 bool master_level; // [sp+1C8h] [bp-24h]@18 @@ -465,8 +463,9 @@ char *pText; // [sp+1D4h] [bp-18h]@18 int pTextColorID; // [sp+1E4h] [bp-8h]@18 int a4; // [sp+1E8h] [bp-4h]@18 + int v115; - bool monster_full_informations = true; + bool monster_full_informations = false; static Actor pMonsterInfoUI_Doll; /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) { @@ -667,93 +666,60 @@ expert_level = 0; master_level = 0; grandmaster_level = 0; + for_effects = 0; pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; - v115 = 0; - if ( !uActiveCharacter ) - v45 = 1; - else + if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) { - int i = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); - if ( !i ) - v45 = 1; - else + skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; + skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; + if ( skill_level == 0 )//(normal) { - v41 = (unsigned __int8)i & 0x3F; - v42 = SkillToMastery(i) - 1; - if ( !v42 )//not master - { - if ( v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - } - else - v45 = 1; - } - else//he is master + if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) + normal_level = 1; + } + else if ( skill_level == 1 )//(expert) + { + if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { - v43 = v42 - 1; - if ( !v43 ) - { - if ( 2 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - expert_level = 1; - } - else - v45 = 1; - } - else - { - v44 = v43 - 1; - if ( !v44 ) - { - if ( 3 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - expert_level = 1; - master_level = 1; - } - else - v45 = 1; - } - else - { - if ( v44 != 1 ) - v45 = 1; - else - { - v45 = 1; - normal_level = 1; - expert_level = 1; - master_level = 1; - grandmaster_level = 1; - } - } - } + normal_level = 1; + expert_level = 1; } } - if ( pActors[uActorID].uAIState != Dead - && pActors[uActorID].uAIState != Dying - && !dword_507BF0_is_there_popup_onscreen && i ) + else if ( skill_level == 2 )//(master) { - if ( normal_level | expert_level | master_level | grandmaster_level ) + if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { - if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) - v73 = SPEECH_105; - else - v73 = SPEECH_104; + normal_level = 1; + expert_level = 1; + master_level = 1; } - else - v73 = SPEECH_106; - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v73, 0); + } + else if ( skill_level == 3 )//grandmaster + { + normal_level = 1; + expert_level = 1; + master_level = 1; + grandmaster_level = 1; } } + if ( pActors[uActorID].uAIState != Dead + && pActors[uActorID].uAIState != Dying + && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) + { + if ( normal_level | expert_level | master_level | grandmaster_level ) + { + if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) + speech = SPEECH_IDENTIFY_MONSTER_STRONGER; + else + speech = SPEECH_IDENTIFY_MONSTER_WEAKER; + } + else + speech = SPEECH_IDENTIFY_MONSTER_106; + pPlayers[uActiveCharacter]->PlaySound(speech, 0); + } - if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) - v115 = v45; + if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) + for_effects = 1; if ( monster_full_informations == true ) { @@ -761,11 +727,11 @@ expert_level = 1;// master_level = 1;// grandmaster_level = 1;// - v115 = 1; + for_effects = 1; } window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects - if ( !v115 ) + if ( !for_effects ) window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? else { @@ -937,19 +903,19 @@ pText = pGlobalTXT_LocalizationStrings[629];//Spells if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName); + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) { - sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName); + sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]); + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } @@ -1009,6 +975,7 @@ pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } } + //cast spell: Detect life if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) { sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points @@ -1017,191 +984,85 @@ } } - //----- (00417BB5) -------------------------------------------------------- const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) { - //enum PLAYER_SKILL_TYPE v2; // esi@1 - //unsigned int v3; // ebx@1 - int v4; // edi@1 - int v5; // eax@1 - Player *pPlayer; // ebx@7 - char v7; // al@7 - char v8; // cl@7 - unsigned int v9; // eax@8 - unsigned int v10; // eax@8 - unsigned int v11; // eax@8 - PLAYER_SKILL_TYPE v12; // edi@8 - unsigned int v13; // eax@8 - unsigned int v14; // eax@8 - PLAYER_SKILL_TYPE v15; // esi@8 - int v16; // edi@8 - char v17; // al@8 - int v18; // ST5C_4@8 - int v19; // ST4C_4@8 - int v20; // ST3C_4@8 - int v21; // ST2C_4@8 - int v22; // ST1C_4@8 - char *v23; // esi@8 - unsigned int v24; // eax@9 - unsigned int v25; // eax@9 - unsigned int v26; // eax@9 - unsigned int v27; // ecx@9 - PLAYER_SKILL_TYPE v28; // ebx@9 - unsigned int v29; // eax@9 - char a2[1200]; // [sp+Ch] [bp-538h]@7 - char Source[120]; // [sp+4BCh] [bp-88h]@7 - unsigned __int16 *v33; // [sp+534h] [bp-10h]@1 - int v34; // [sp+538h] [bp-Ch]@1 - unsigned __int16 *v35; // [sp+53Ch] [bp-8h]@1 - //enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1 + char a2[1200]; // [sp+Ch] [bp-538h]@7 + char Source[120]; // [sp+4BCh] [bp-88h]@7 + int v35; // [sp+53Ch] [bp-8h]@1 + + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand - //v2 = uPlayerSkillType; - //v3 = uPlayerID; - //v36 = uPlayerSkillType; - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal - v34 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert - v33 = (unsigned __int16 *)pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand - v35 = (unsigned __int16 *)v4; - if ( v34 > v4 ) - v35 = (unsigned __int16 *)v34; - if ( (signed int)v33 > (signed int)v35 ) - v35 = v33; - if ( v5 > (signed int)v35 ) - v35 = (unsigned __int16 *)v5; - pPlayer = &pParty->pPlayers[uPlayerID]; - //v33 = &pPlayer->pActiveSkills[uPlayerSkillType]; - v7 = pPlayer->GetActualSkillLevel(uPlayerSkillType); - v8 = pPlayer->pActiveSkills[uPlayerSkillType]; - a2[0] = 0; - Source[0] = 0; - if ( (v8 & 0x3F) == (v7 & 0x3F) ) - { - strcpy(a2, "%s\n\n"); - v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1); - sprintf(Source, "\f%05d", v24); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2); - sprintf(Source, "\f%05d", v25); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3); - sprintf(Source, "\f%05d", v26); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v27 = pPlayer->classType; - v28 = uPlayerSkillType; - v29 = GetSkillColor(v27, uPlayerSkillType, 4); - sprintf(Source, "\f%05d", v29); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - - v23 = static_sub_417BB5_out_string; - sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[v28], pGlobalTXT_LocalizationStrings[431], // Normal - (char *)v35 + 3, v35 + 5, pNormalSkillDesc[v28], pGlobalTXT_LocalizationStrings[433], // Expert - (char *)v35 + 3, v35 + 5, pExpertSkillDesc[v28], pGlobalTXT_LocalizationStrings[432], // Master - (char *)v35 + 3, v35 + 5, pMasterSkillDesc[v28], pGlobalTXT_LocalizationStrings[96], // Grand - (char *)v35 + 3, v35 + 5, pGrandSkillDesc[v28]); - } - else - { - strcpy(a2, "%s\n\n"); - v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1); - sprintf(Source, "\f%05d", v9); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2); - sprintf(Source, "\f%05d", v10); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3); - sprintf(Source, "\f%05d", v11); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v12 = uPlayerSkillType; - v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4); - sprintf(Source, "\f%05d", v13); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n"); - v14 = TargetColor(0xFFu, 0xFFu, 0xFFu); - sprintf(Source, "\f%05d", v14); - strcat(a2, Source); - strcat(a2, "%s: +%d"); - v15 = v12; - v16 = (int)(v35 + 5); - v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4); - v34 = (int)((char *)v35 + 3); - v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType); - v18 = *(int *)(pGrandSkillDesc[v15]); - v19 = *(int *)(pMasterSkillDesc[v15]); - v20 = *(int *)(pExpertSkillDesc[v15]); - v21 = *(int *)(pNormalSkillDesc[v15]); - v22 = *(int *)(pSkillDesc[v15]); - v23 = static_sub_417BB5_out_string; - sprintf( - static_sub_417BB5_out_string, - a2, - v22, - pGlobalTXT_LocalizationStrings[431], - v34, - v16, - v21, - pGlobalTXT_LocalizationStrings[433], - v34, - v16, - v20, - pGlobalTXT_LocalizationStrings[432], - v34, - v16, - v19, - pGlobalTXT_LocalizationStrings[96], - v34, - v16, - v18, - pGlobalTXT_LocalizationStrings[623], - (v17 & 0x3F) - (*(char *)v33 & 0x3F)); - } - return v23; - } + a2[0] = 0; + Source[0] = 0; + strcpy(a2, "%s\n\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) + { + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand + } + else + { + sprintf(Source, "\f%05d", TargetColor(0xFFu, 0xFFu, 0xFFu)); + strcat(a2, Source); + strcat(a2, "%s: +%d"); + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[623], //Bonus + (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); + } + return static_sub_417BB5_out_string; +} //----- (00417FE5) -------------------------------------------------------- - void CharacterUI_SkillsTab_ShowHint() - { - unsigned int v0; // ecx@1 - unsigned int v1; // eax@1 - GUIButton *i; // esi@6 - const char *v3; // eax@12 - unsigned int pX; // [sp+4h] [bp-8h]@1 - unsigned int pY; // [sp+8h] [bp-4h]@1 +void CharacterUI_SkillsTab_ShowHint() +{ + GUIButton *pButton; // esi@6 + unsigned int pX; // [sp+4h] [bp-8h]@1 + unsigned int pY; // [sp+8h] [bp-4h]@1 - pMouse->GetClickPos(&pX, &pY); - v0 = pX; - v1 = pY; - if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) - { - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) - { - if ( i->msg == UIMSG_SkillUp - && (signed int)v0 >= (signed int)i->uX - && (signed int)v0 <= (signed int)i->uZ - && (signed int)v1 >= (signed int)i->uY - && (signed int)v1 <= (signed int)i->uW ) - { - v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param); - CharacterUI_DrawTooltip(pSkillNames[i->msg_param], v3); - v1 = pY; - v0 = pX; - } - } - } - else - { - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); - } - + pMouse->GetClickPos(&pX, &pY); + if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) + { + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_SkillUp + && (signed int)pX >= (signed int)pButton->uX + && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY + && (signed int)pY <= (signed int)pButton->uW ) + { + CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); + } } + } + else + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Очки навыков +} //----- (00418083) -------------------------------------------------------- void CharacterUI_StatsTab_ShowHint() @@ -1211,7 +1072,6 @@ char *pHourWord; // ecx@17 char *pDayWord; // eax@20 int v15; // ebx@28 - int v16; // eax@33 POINT a2; // [sp+Ch] [bp-24h]@1 int pHour; // [sp+14h] [bp-1Ch]@15 unsigned int pDay; // [sp+24h] [bp-Ch]@15 @@ -1304,8 +1164,7 @@ pTmpBuf2[0] = 0; if ( v15 > pPlayers[uActiveCharacter]->uLevel ) sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); - v16 = GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); strcat(pTmpBuf.data(), "\n"); strcat(pTmpBuf.data(), pTmpBuf2.data()); sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); @@ -1368,463 +1227,794 @@ } } - //----- (00410B28) -------------------------------------------------------- - void DrawSpellDescriptionPopup(int spell_index) - { - Player *v1; // edi@1 - SpellInfo *v2; // esi@1 - unsigned int v3; // eax@2 - int v4; // eax@4 - LONG v5; // ecx@4 - int v6; // eax@10 - char *v7; // ST44_4@12 - unsigned __int16 v8; // ax@12 - GUIWindow a1; // [sp+Ch] [bp-68h]@4 - int v10; // [sp+60h] [bp-14h]@1 - POINT a2; // [sp+64h] [bp-10h]@1 - int v12; // [sp+6Ch] [bp-8h]@4 - int v13; // [sp+70h] [bp-4h]@4 +//----- (00410B28) -------------------------------------------------------- +void DrawSpellDescriptionPopup(int spell_index) +{ + SpellInfo *spell; // esi@1 + unsigned int v3; // eax@2 + LONG v5; // ecx@4 + GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 + POINT mouse; // [sp+64h] [bp-10h]@1 - v1 = pPlayers[uActiveCharacter]; - v10 = spell_index; - v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1]; - if ( pMouse->GetCursorPos(&a2)->y <= 250 ) - v3 = pMouse->GetCursorPos(&a2)->y + 30; - else - v3 = 30; - a1.uFrameY = v3; - a1.uFrameWidth = 328; - a1.uFrameHeight = 68; - a1.uFrameX = 90; - a1.uFrameZ = 417; - a1.uFrameW = v3 + 67; - a1.Hint = 0; - a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); - v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); - v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); - v5 = a2.y; - if ( v13 > a2.y ) - v5 = v13; - if ( v12 > v5 ) - v5 = v12; - if ( v4 > v5 ) - v5 = v4; - sprintf( pTmpBuf2.data(), + spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; + if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) + v3 = pMouse->GetCursorPos(&mouse)->y + 30; + else + v3 = 30; + spell_info_window.uFrameY = v3; + spell_info_window.uFrameWidth = 328; + spell_info_window.uFrameHeight = 68; + spell_info_window.uFrameX = 90; + spell_info_window.uFrameZ = 417; + spell_info_window.uFrameW = v3 + 67; + spell_info_window.Hint = 0; + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); + sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", - v2->pDescription, - pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], - v5 + 3, v5 + 10, - v2->pBasicSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], - v5 + 3, v5 + 10, - v2->pExpertSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], - v5 + 3, v5 + 10, - v2->pMasterSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], - v5 + 3, v5 + 10, - v2->pGrandmasterSkillDesc); - v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); - a1.uFrameHeight += v6; - if ( (signed int)a1.uFrameHeight < 150 ) - a1.uFrameHeight = 150; - a1.uFrameWidth = game_viewport_width; - a1.DrawMessageBox(0); - a1.uFrameWidth -= 12; - a1.uFrameHeight -= 12; - v7 = v2->pName; - a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; - a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; - v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); - a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); - a1.uFrameWidth = 108; - a1.uFrameZ = a1.uFrameX + 107; - a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u); - sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], - pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]); - // *(&[0].field_12 //temp_fix field_14 - // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6) - // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage))); - a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3u); - dword_507B00_spell_info_to_draw_in_popup = 0; - } + spell->pDescription, + pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); + spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); + if ( (signed int)spell_info_window.uFrameHeight < 150 ) + spell_info_window.uFrameHeight = 150; + spell_info_window.uFrameWidth = game_viewport_width; + spell_info_window.DrawMessageBox(0); + spell_info_window.uFrameWidth -= 12; + spell_info_window.uFrameHeight -= 12; + spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; + spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; + spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); + spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); + spell_info_window.uFrameWidth = 108; + spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; + spell_info_window.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); + sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], + pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]); + spell_info_window.DrawTitleText(pFontComic, 0xCu, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); + dword_507B00_spell_info_to_draw_in_popup = 0; +} // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup; - - - - //----- (00416D62) -------------------------------------------------------- void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this) { - signed int pPlayerNum; // eax@12 - char *v2; // eax@32 - void *v3; // ecx@52 - unsigned int v4; // eax@59 - int v5; // esi@62 - signed int v6; // esi@64 - signed int v7; // esi@69 - ItemGen *v8; // ecx@70 - unsigned int v9; // eax@72 - unsigned int v10; // eax@76 - //char v11; // zf@83 - GUIButton *pButton; // esi@84 - unsigned int v13; // ecx@85 - char *pStr; // edi@85 - //signed int pControlID; // eax@92 - int v16; // eax@95 - int v17; // eax@96 - PLAYER_SKILL_TYPE v18; // eax@98 - char *pStr2; // eax@99 - unsigned int v20; // eax@108 - unsigned int pSkillId; // eax@109 - const char *pSkillInfo; // eax@111 - //char *v23; // ebx@112 - char *pHint; // edx@113 - unsigned int pColor; // eax@113 - GUIWindow pWindow; // [sp+4h] [bp-74h]@32 - double v27; // [sp+58h] [bp-20h]@33 - struct tagPOINT Point; // [sp+60h] [bp-18h]@6 - char *v29; // [sp+68h] [bp-10h]@33 - float v30; // [sp+6Ch] [bp-Ch]@33 - unsigned int pX; // [sp+70h] [bp-8h]@3 - unsigned int pY; // [sp+74h] [bp-4h]@3 + int v5; // esi@62 + GUIButton *pButton; // esi@84 + char *pStr; // edi@85 + char *pHint; // edx@113 + GUIWindow popup_window; // [sp+4h] [bp-74h]@32 + struct tagPOINT Point; // [sp+60h] [bp-18h]@6 + unsigned int pX; // [sp+70h] [bp-8h]@3 + unsigned int pY; // [sp+74h] [bp-4h]@3 + + if ( pCurrentScreen == SCREEN_VIDEO ) + return; + if ( _this ) + { + pX = _this->x; + pY = _this->y; + } + else + { + pMouse->GetClickPos(&pX, &pY); + } + if ( pRenderer->bWindowMode ) + { + GetCursorPos(&Point); + ScreenToClient(hWnd, &Point); + if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) + { + back_to_game(); + return; + } + } + if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором + { + for ( uint i = 0; i < 4; ++i ) + { + if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] + && (signed int)pY > 375 && (signed int)pY < 466 ) + { + pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); + return; + } + } + } - if ( pCurrentScreen == SCREEN_VIDEO ) - return; - if ( _this ) - { - pX = _this->x; - pY = _this->y; - } + pEventTimer->Pause(); + switch(pCurrentScreen) + { + case SCREEN_CASTING: + { + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_CHEST: + { + if ( !pPlayers[uActiveCharacter]->CanAct() ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + popup_window.Hint = pTmpBuf.data(); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 180; + popup_window.uFrameY = 40; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; else - { - pMouse->GetClickPos(&pX, &pY); - } - if ( pRenderer->bWindowMode ) - { - GetCursorPos(&Point); - ScreenToClient(hWnd, &Point); - if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) - { - back_to_game(); - return; - } - } - - if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором + popup_window.uFrameX = pX - 414; + popup_window.DrawMessageBox(0); + } + else + { + if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) + GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); + } + break; + } + case SCREEN_GAME://In the main menu displays a pop-up window(В главном меню показывает всплывающее окно) + { + if (GetCurrentMenuID() > 0) + break; + if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) + { + popup_window.ptr_1C = (void *)((signed int)pX / 118); + if ( (signed int)pX / 118 < 4 )//portaits zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); + } + } + else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) + { + if ( (signed int)pY >= 130 ) + { + if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + popup_window._41D73D_draw_buff_tooltip(); + } + else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone + { + if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) { - //v1 = 0; - //do - for ( pPlayerNum = 0; pPlayerNum < 4; ++pPlayerNum) - { - if ( (signed int)pX > RightClickPortraitXmin[pPlayerNum] && (signed int)pX < RightClickPortraitXmax[pPlayerNum] - && (signed int)pY > 375 && (signed int)pY < 466 ) - { - pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(pPlayerNum + 1, 1); - return; - } - //++v1; - } - //while ( v1 < 4 ); + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup((void *)1);//NPC 2 } - - pEventTimer->Pause(); - - switch(pCurrentScreen) - { - case SCREEN_CASTING: - { - OnInventoryItemRightClick(); - break; - } - - case SCREEN_CHEST: + } + else + { + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup(0);//NPC 1 + } + } + else//minimap zone + { + popup_window.Hint = (char *)GameUI_GetMinimapHintText(); + popup_window.uFrameWidth = 256; + popup_window.uFrameX = 130; + popup_window.uFrameY = 140; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + } + } + else//game zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 320; + popup_window.uFrameHeight = 320; + popup_window.uFrameX = pX - 350; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; + popup_window.uFrameY = 40; + if ( pRenderer->pRenderD3D ) + LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); + else + v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) + { + if ( pRenderer->uNumSceneBegins ) + { + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + } + else + { + pRenderer->BeginScene(); + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + pRenderer->EndScene(); + } + } + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) + { + if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) + { + GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24); + } + } + } + break; + } + case SCREEN_BOOKS: + { + if ( !dword_506364 + || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X + || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y + || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) + break; + popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; + popup_window.uFrameX = pX + 5; + popup_window.uFrameY = pY + 5; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + break; + } + case SCREEN_CHARACTERS: + case SCREEN_E: + case SCREEN_CHEST_INVENTORY: + { + if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) + Inventory_ItemPopupAndAlchemy(); + else if ( (signed int)pY >= 345 ) + break; + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats + CharacterUI_StatsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills + CharacterUI_SkillsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_SPELL_BOOK: + { + if ( dword_507B00_spell_info_to_draw_in_popup ) + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); + break; + } + case SCREEN_HOUSE: + { + if ( (signed int)pY < 345 && (signed int)pX < 469 ) + ShowPopupShopItem(); + break; + } + case SCREEN_PARTY_CREATION: + { + popup_window.Hint = 0; + pStr = 0; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) + { + if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ + && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) + { + switch ( pButton->msg ) + { + case UIMSG_0: //stats info + popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; + pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; + break; + case UIMSG_PlayerCreationClickPlus: //Plus button info + pStr = pGlobalTXT_LocalizationStrings[670];//Добавить + popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" + break; + case UIMSG_PlayerCreationClickMinus: //Minus button info + pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть + popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" + break; + case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info + pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + break; + case UIMSG_PlayerCreationSelectClass: //Available Class Info + popup_window.Hint = pClassDescriptions[pButton->msg_param]; + pStr = pClassNames[pButton->msg_param]; + break; + case UIMSG_PlayerCreationClickOK: //OK Info + popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. + pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК + break; + case UIMSG_PlayerCreationClickReset: //Clear info + popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. + pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить + break; + case UIMSG_PlayerCreation_SelectAttribute: // Character info + pStr = pParty->pPlayers[pButton->msg_param].pName; + popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; + break; + } + if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info + { + pY = 0; + if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) { - if ( !pPlayers[uActiveCharacter]->CanAct() ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427],//%s не в состоянии %s - pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//Опознать предметы - pWindow.Hint = pTmpBuf.data(); - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 180; - pWindow.uFrameY = 40; - if ( (signed int)pX <= 320 ) - v10 = pX + 30; - else - v10 = pX - 414; - pWindow.uFrameX = v10; - pWindow.DrawMessageBox(0); - } - else - { - v9 = pX + pSRZBufferLineOffsets[pY]; - if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF ) - { + strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); + popup_window.Hint = pTmpBuf2.data(); + pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; + } + } + } + } + if ( popup_window.Hint ) + { + pHint = (char*)popup_window.Hint; + popup_window.Hint = 0; + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = 40; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", TargetColor(0xFF, 0xFF, 0x9B), pStr); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); + } + break; + } + default: + break; + } + dword_507BF0_is_there_popup_onscreen = 1; + viewparams->bRedrawGameUI = 1; +} +int no_rightlick_in_inventory = false; // 0050CDCC +//----- (00416196) -------------------------------------------------------- +void Inventory_ItemPopupAndAlchemy() +{ + int v14; // edx@25 + unsigned int v15; // edi@25 + signed int v16; // edx@27 + int v17; // eax@54 + unsigned int v18; // edx@57 + int v19; // eax@65 + int v20; // edi@67 + int v21; // eax@72 + int v22; // ecx@74 + int v23; // edx@78 + int v24; // eax@79 + int v25; // eax@80 + int v26; // eax@84 + ItemGen *v27; // esi@98 + double v31; // st7@112 + double v36; // st7@132 + signed __int64 v37; // qax@135 + Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 + GUIWindow message_window; // [sp+Ch] [bp-84h]@137 + int v45; // [sp+64h] [bp-2Ch]@10 + POINT a2; // [sp+78h] [bp-18h]@2 + unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 - // __debugbreak(); // invalid indexing will result in invalid object ptr - // v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime - // + (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); - v10=pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[v9] & 0xFFFF)-1]; - v8 =&pChests[pChestWindow->par1C].igChestItems[v10-1]; - GameUI_DrawItemInfo(v8); - } - } - break; - } - case SCREEN_GAME: - { - if (GetCurrentMenuID() > 0) - break; + if (no_rightlick_in_inventory) + return; + + pMouse->GetCursorPos(&a2); + int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1; + auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; + + if (a2.x <= 13 || a2.x >= 462) + { + GameUI_DrawItemInfo(item); + return; + } + + if (!item_pid) + { + int inventory_mouse_x = a2.x - 14; + int inventory_mouse_y = a2.y - 17; + + int mouse_cell_x = inventory_mouse_x / 32; + int mouse_cell_y = inventory_mouse_y / 32; + + if (mouse_cell_x + mouse_cell_y < 0) + return; + + int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; + if (inventory_idx > 126) + return; + + if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) + return; - if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) - { - pWindow.ptr_1C = (void *)((signed int)pX / 118); - if ( (signed int)pX / 118 < 4 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - GameUI_CharacterQuickRecord_Draw(&pWindow, pPlayers[(int)pWindow.ptr_1C + 1]); - } - } - else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) - { - if ( (signed int)pY >= 130 ) - { - if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - pWindow._41D73D_draw_buff_tooltip(); - } - else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 ) - { - if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) - { - pAudioPlayer->StopChannels(-1, -1); - v3 = (void *)1; - GameUI_DrawNPCPopup(v3); - } - } - else - { - pAudioPlayer->StopChannels(-1, -1); - v3 = 0; - GameUI_DrawNPCPopup(v3); - } - } - else - { - pWindow.Hint = (char *)GameUI_GetMinimapHintText(); - pWindow.uFrameWidth = 256; - pWindow.uFrameX = 130; - pWindow.uFrameY = 140; - pWindow.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); - } - } - else - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 320; - pWindow.uFrameHeight = 320; - v4 = pX - 350; - if ( (signed int)pX <= 320 ) - v4 = pX + 30; - pWindow.uFrameX = v4; - pWindow.uFrameY = 40; - if ( pRenderer->pRenderD3D ) - LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); - else - v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - v6 = (unsigned __int16)v5; - if (PID_TYPE(v6) != OBJECT_Item) - { - if (PID_TYPE(v6) == OBJECT_Actor) - { - if ( pRenderer->uNumSceneBegins ) - { - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID(v6), &pWindow); - } - else - { - pRenderer->BeginScene(); - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID(v6), &pWindow); - pRenderer->EndScene(); - } - } - } - else - { - v7 = PID_ID(v6); - if ( ! (pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) ) - { - v8 = &pSpriteObjects[v7].stru_24; - GameUI_DrawItemInfo(v8); - } - } - } - break; - } - case SCREEN_BOOKS: - { - if ( !dword_506364 - || (signed int)pX < (signed int)pViewport->uViewportTL_X - || (signed int)pX > (signed int)pViewport->uViewportBR_X - || (signed int)pY < (signed int)pViewport->uViewportTL_Y - || (signed int)pY > (signed int)pViewport->uViewportBR_Y - || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) ) - break; - v30 = (double)(pFontArrus->GetLineWidth(v2) + 32); - v27 = v30 + 6.7553994e15; - v29 = (char *)LODWORD(v27); - pWindow.uFrameWidth = LODWORD(v27); - pWindow.uFrameX = pX + 5; - pWindow.uFrameY = pY + 5; - pWindow.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); - break; - } - case SCREEN_CHARACTERS: - case SCREEN_E: - case SCREEN_CHEST_INVENTORY: + item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); + } +//check character condition(проверка состояния персонажа) + if (!pPlayers[uActiveCharacter]->CanAct()) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + message_window.Hint = pTmpBuf.data(); + message_window.uFrameWidth = 384; + message_window.uFrameHeight = 180; + if (a2.x <= 320 ) + message_window.uFrameX = a2.x + 30; + else + message_window.uFrameX = a2.x - 414; + message_window.uFrameY = 40; + message_window.DrawMessageBox(0); + return; + } + + int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; + int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)) - 1; + +// for potion bottle(простая бутылка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) + { + GameUI_DrawItemInfo(item); + return; + } +//for recharge potion(зелье перезарядка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle + item->uItemID < ITEM_POTION_CATALYST && // cant recharge + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + + v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; + if ( v36 < 0.0 ) + v36 = 0.0; + v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); + item->uMaxCharges = v37; + item->uNumCharges = v37; + + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// for harden potion(зелье закалка) + else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle + item->uItemID < ITEM_POTION_CATALYST && // cant harden + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->IsBroken() || // cant harden broken items + item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts + item->GetItemEquipType() < EQUIP_OFF_HAND || + item->GetItemEquipType() > EQUIP_WAND) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// several potions(несколько зелий) + else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && + pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || + pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle + item->uItemID < ITEM_POTION_CATALYST && // cant enchant + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || + item->uItemID >= ITEM_ARTIFACT_PUCK || + item->IsBroken() || + item->uSpecEnchantmentType || + item->uEnchantmentType || + item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->UpdateTempBonus(pParty->uTimePlayed); + if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + item->uSpecEnchantmentType = 40; // of Slaying + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + else + { + static int _4E2904_enchantment_by_potion_lut[] = + { + 164, 93, 22, + 164, 93, 22, + 11, 5, 13, 7, 59 + }; + item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + + v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; + v27->uAttributes = alchemy_skill_level | 0x18; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } + // use reagents(применение реагентов) + if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); + switch ( pParty->pPickedItem.uItemID ) + { + case 200: + case 201: + case 202: + case 203: + case 204: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; + break; + case 205: + case 206: + case 207: + case 208: + case 209: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; + break; + case 210: + case 211: + case 212: + case 213: + case 214: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; + break; + case 215: + case 216: + case 217: + case 218: + case 219: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; + break; + default: + break; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + } + return; + } + +//potions mixing(смешивание двух зелий) + if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || + pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) + { + if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || + pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) + { + if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && + (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && + pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && + pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) + GameUI_DrawItemInfo(item); + return; + } + + // src not reagent, dst not bottle + // src potion, dst potion + + v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; + v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; + + if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) + v16 = 5; + else + v16 = pItemsTable->potion_data[v15][v14 + 2]; + damage_level = v16; + if ( alchemy_skill_points ) + { + if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN )//< 225 >227 + { + if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 >= v16 <= 239 + { + if ( alchemy_skill_points == 1 ) + damage_level = 2; + } + if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 >= v16 <= 261 + { + if ( alchemy_skill_points <= 2 ) + damage_level = 3; + } + if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_points != 4 )//>= 262 + damage_level = 4; + } + } + else + { + if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 + damage_level = 1; + if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 + damage_level = 2; + if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 + damage_level = 3; + if ( v16 >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 + damage_level = 4; + } + int pOut_y = 0; + int pOut_x = item_pid + 1; + v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; + while ( *(int *)v17 != pOut_x ) + { + ++pOut_y; + v17 += 4; + if ( pOut_y >= 126 ) + { + v18 = pOut_y; + goto LABEL_59; + } + } + v18 = pOut_y; +LABEL_59: + if ( !damage_level ) + { + GameUI_DrawItemInfo(item); + return; + } + if ( damage_level == 1 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v26 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + } + else + { + if ( damage_level == 2 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v25 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); + v23 = 1; + } + else + { + if ( damage_level == 3 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v24 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); + v23 = 5; + } + else + { + if ( damage_level != 4 ) + { + if ( damage_level != 5 ) { - if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) - { - OnInventoryItemRightClick(); - } - else if ( (signed int)pY >= 345 ) - break; - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats - { - CharacterUI_StatsTab_ShowHint(); - } - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills - { - CharacterUI_SkillsTab_ShowHint(); - } - else - { - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory - OnInventoryItemRightClick(); - } - break; + v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); + if ( v19 ) + pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; + v20 = v14 + 50 * v15; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = damage_level; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) + / 2; + pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 + v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) + *(int *)(v22 + 552) |= 1u; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; } - case SCREEN_SPELL_BOOK: - { - if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); - break; - } - case SCREEN_HOUSE: - { - if ( (signed int)pY < 345 && (signed int)pX < 469 ) - ShowPopupShopItem(); - break; - } - case SCREEN_PARTY_CREATION: + if ( alchemy_skill_points ) { - pWindow.Hint = 0; - pStr = 0; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) - { - if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ - && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) - { - switch ( pButton->msg ) - { - case UIMSG_0: //stats info - pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; - pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; - break; - case UIMSG_PlayerCreationClickPlus: //Plus button info - pStr = pGlobalTXT_LocalizationStrings[670];//Добавить - pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" - break; - case UIMSG_PlayerCreationClickMinus: //Minus button info - pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть - pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" - break; - case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info - v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4); - pStr = pSkillNames[v18]; - pWindow.Hint = pSkillDesc[v18]; - break; - case UIMSG_PlayerCreationSelectClass: //Available Class Info - pWindow.Hint = pClassDescriptions[pButton->msg_param]; - pStr = pClassNames[pButton->msg_param]; - break; - case UIMSG_PlayerCreationClickOK: //OK Info - pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. - pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК - break; - case UIMSG_PlayerCreationClickReset: //Clear info - pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. - pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить - break; - case UIMSG_PlayerCreation_SelectAttribute: // Character info - pStr = pParty->pPlayers[pButton->msg_param].pName; - pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; - break; - } - if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info - { - pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48); - pY = 0; - if ( (signed int)pSkillId < 37 ) - { - pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId); - strcpy(pTmpBuf2.data(), pSkillInfo); - pWindow.Hint = pTmpBuf2.data(); - pStr = pSkillNames[pSkillId]; - } - } - } - } - if ( pWindow.Hint ) - { - pHint = (char*)pWindow.Hint; - pWindow.Hint = 0; - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 256; - pWindow.uFrameX = 128; - pWindow.uFrameY = 40; - pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pWindow.DrawMessageBox(0); - pWindow.uFrameX += 12; - pWindow.uFrameWidth -= 24; - pWindow.uFrameY += 12; - pWindow.uFrameHeight -= 12; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pColor = TargetColor(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" - pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); - pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); - } - break; + if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 ) + *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; + else + *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; + v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); + if ( v21 ) + //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; + pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; + v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) + *(int *)(v22 + 552) |= 1u; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; } - default: - { - break; - } - } - dword_507BF0_is_there_popup_onscreen = 1; - viewparams->bRedrawGameUI = 1; - } \ No newline at end of file + GameUI_DrawItemInfo(item); + return; + } + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); + v23 = 0; + } + } + pPlayers[uActiveCharacter]->ItemsEnchant(v23); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + } + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; +} diff -r 34dd357a489d -r e8d477b48596 UI/UIShops.cpp --- a/UI/UIShops.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/UI/UIShops.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -1352,8 +1352,8 @@ dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } - v66 = pMouse->GetCursorPos(&v98); - pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; + pMouse->GetCursorPos(&v98); + pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) { v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; diff -r 34dd357a489d -r e8d477b48596 UI/UiGame.cpp --- a/UI/UiGame.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/UI/UiGame.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -687,16 +687,16 @@ const char *v14; // eax@8 char *result; // eax@12 unsigned int pMapID; // eax@14 - int v19; // [sp+10h] [bp-1Ch]@1 - int v20; // [sp+14h] [bp-18h]@1 + int global_coord_X; // [sp+10h] [bp-1Ch]@1 + int global_coord_Y; // [sp+14h] [bp-18h]@1 unsigned int pY; // [sp+1Ch] [bp-10h]@1 unsigned int pX; // [sp+28h] [bp-4h]@1 result = 0; pMouse->GetClickPos(&pX, &pY); v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); - v19 = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); - v20 = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); + global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); + global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) { pMapID = pMapStats->GetMapInfo(pCurrentMapName); @@ -709,8 +709,8 @@ { for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) { - v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - v19), - abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - v20), 0); + v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0); if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) { if ( pOutdoor->pBModels[j].uNumFaces ) diff -r 34dd357a489d -r e8d477b48596 Viewport.cpp --- a/Viewport.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/Viewport.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -128,9 +128,9 @@ //----- (00443249) -------------------------------------------------------- void ViewingParams::CenterOnParty() { - this->field_2C = (32768 * (__int64)this->field_2C) >> 16; - if (this->field_2C < 384) - this->field_2C = 384; + this->uMapBookMapZoom = (32768 * (__int64)this->uMapBookMapZoom) >> 16; + if (this->uMapBookMapZoom < 384) + this->uMapBookMapZoom = 384; this->sViewCenterX = pParty->vPosition.x; this->sViewCenterY = pParty->vPosition.y; @@ -149,9 +149,9 @@ v2 = 3072; else assert(false); - this->field_2C *= 2; - if (this->field_2C > v2 ) - this->field_2C = v2; + this->uMapBookMapZoom *= 2; + if (this->uMapBookMapZoom > v2 ) + this->uMapBookMapZoom = v2; this->sViewCenterX = pParty->vPosition.x; this->sViewCenterY = pParty->vPosition.y; @@ -172,7 +172,7 @@ v1 = this; v2 = this->indoor_center_y; - v3 = 88 >> (this->field_2C / 384); + v3 = 88 >> (this->uMapBookMapZoom / 384); v4 = (44 - v3) << 9; if ( v1->sViewCenterY > v2 + v4 ) v1->sViewCenterY = v2 + v4; @@ -253,7 +253,7 @@ uMinimapZoom = _576E2C_current_minimap_zoom; field_28 = dword_576E28; } - field_2C = 384; + uMapBookMapZoom = 384; } //----- (0042213C) -------------------------------------------------------- void OnGameViewportClick() diff -r 34dd357a489d -r e8d477b48596 Viewport.h --- a/Viewport.h Thu Sep 26 08:07:50 2013 +0200 +++ b/Viewport.h Thu Sep 26 08:09:05 2013 +0200 @@ -65,7 +65,7 @@ int field_20; unsigned int uMinimapZoom; int field_28; - int field_2C; + unsigned int uMapBookMapZoom; int sViewCenterX; int sViewCenterY; __int16 indoor_center_x; diff -r 34dd357a489d -r e8d477b48596 mm7_3.cpp --- a/mm7_3.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/mm7_3.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -6772,90 +6772,6 @@ LoadLevel_InitializeLevelStr(); } -//----- (00444564) -------------------------------------------------------- -const char * sub_444564() -{ - double v0; // st7@3 - int v1; // ebx@3 - int v2; // edi@3 - int v3; // eax@3 - int v5; // edi@6 - int v6; // eax@6 - int v7; // eax@6 - unsigned __int8 v9; // zf@7 - unsigned __int8 v10; // sf@7 - ODMFace *v11; // eax@9 - __int16 v12; // cx@9 - const char *v13; // eax@11 - const char *v14; // edi@11 - const char *result; // eax@15 - unsigned int v16; // [sp+0h] [bp-20h]@3 - const char *v17; // [sp+4h] [bp-1Ch]@3 - unsigned int pY; // [sp+8h] [bp-18h]@3 - float v19; // [sp+Ch] [bp-14h]@1 - int v20; - int v21; // [sp+14h] [bp-Ch]@1 - unsigned int v22; // [sp+18h] [bp-8h]@8 - int pX; // [sp+1Ch] [bp-4h]@3 - - v20 = viewparams->sViewCenterX; - v21 = viewparams->sViewCenterY; - v19 = (double)viewparams->field_2C * 0.000015258789; - if ( viewparams->field_2C == 384 ) - { - v20 = viewparams->indoor_center_x; - v21 = viewparams->indoor_center_y; - } - v17 = 0; - v16 = pOutdoor->uNumBModels; - pMouse->GetClickPos((unsigned int *)&pX, &pY); - v0 = 1.0 / v19; - v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20); - LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); - v2 = abs(v1 + 22528) / 512; - v3 = abs((signed)LODWORD(v19) - 22528); - result = 0; - if ( pOutdoor->_47F04C(v2, v3 / 512) - && uCurrentlyLoadedLevelType == LEVEL_Outdoor - && (signed int)v16 > 0 ) - { - for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++) - { - pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1; - pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19); - v5 = abs((signed)pY); - v6 = abs((signed)pX); - v7 = int_get_vector_length(v6, v5, 0); - if ( v7 < pOutdoor->pBModels[i].sBoundingRadius ) - { - if ( pOutdoor->pBModels[i].uNumFaces > 0 ) - { - for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) - { - v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134]; - v12 = v11->sCogTriggeredID; - if ( v12 ) - { - if ( !(v11->uAttributes & 0x100000) ) - { - v13 = GetEventHintString(v12); - v14 = v13; - if ( v13 ) - { - if ( _stricmp(v13, "") ) - v17 = v14; - } - } - } - } - } - result = v17; - } - } - } - return result; -} - //----- (00444D80) -------------------------------------------------------- int GetTravelTime() { diff -r 34dd357a489d -r e8d477b48596 mm7_5.cpp --- a/mm7_5.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/mm7_5.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -4904,478 +4904,6 @@ DrawCopyrightWindow(); } - -int no_rightlick_in_inventory = false; // 0050CDCC -//----- (00416196) -------------------------------------------------------- -void OnInventoryItemRightClick() -{ - //Player *v0; // esi@2 - //POINT *v1; // edi@2 - //signed int v2; // ecx@5 - //signed int v3; // eax@5 - //int v4; // eax@5 - //char v5; // sf@5 - //int v6; // eax@5 - int v7; // eax@7 - //unsigned __int16 v8; // ax@10 - int v9; // edi@10 - //int v10; // eax@10 - //int v11; // edx@13 - //LONG v12; // edx@23 - //signed int v13; // edx@23 - int v14; // edx@25 - unsigned int v15; // edi@25 - signed int v16; // edx@27 - int v17; // eax@54 - unsigned int v18; // edx@57 - int v19; // eax@65 - int v20; // edi@67 - int v21; // eax@72 - int v22; // ecx@74 - int v23; // edx@78 - int v24; // eax@79 - int v25; // eax@80 - int v26; // eax@84 - ItemGen *v27; // esi@98 - //unsigned int v28; // eax@98 - //ItemGen *v29; // edi@98 - //unsigned int v30; // ecx@103 - double v31; // st7@112 - //unsigned __int64 v32; // qax@113 - //unsigned int v33; // ecx@117 - //int v34; // eax@126 - //unsigned int v35; // ecx@127 - double v36; // st7@132 - signed __int64 v37; // qax@135 - //unsigned int v38; // eax@138 - Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 - //int *v40; // [sp-Ch] [bp-9Ch]@83 - //int *v41; // [sp-8h] [bp-98h]@83 - //int *v42; // [sp-4h] [bp-94h]@83 - GUIWindow v43; // [sp+Ch] [bp-84h]@137 - //unsigned int pY; // [sp+60h] [bp-30h]@2 - int v45; // [sp+64h] [bp-2Ch]@10 - //unsigned int pX; // [sp+68h] [bp-28h]@2 - //int v47; // [sp+6Ch] [bp-24h]@25 - //POINT y; // [sp+70h] [bp-20h]@2 - POINT a2; // [sp+78h] [bp-18h]@2 - //Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 - unsigned int v51; // [sp+8Ch] [bp-4h]@23 - - if (no_rightlick_in_inventory) - return; - - pMouse->GetCursorPos(&a2); - if (a2.x <= 13 || a2.x >= 462) - return; - - auto player = pPlayers[uActiveCharacter]; - - int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - //pMouse->GetClickPos(&pX, &pY); - if (!item_pid) - { - int inventory_mouse_x = a2.x - 14; - int inventory_mouse_y = a2.y - 17; - - int mouse_cell_x = inventory_mouse_x / 32; - int mouse_cell_y = inventory_mouse_y / 32; - - if (mouse_cell_x + mouse_cell_y < 0) - return; - - int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; - if (inventory_idx > 126) - return; - - v7 = player->GetItemIDAtInventoryIndex(&inventory_idx); - if (v7 == 0) - return; - - item_pid = v7; - } - - if (!player->CanAct()) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]); - v43.Hint = pTmpBuf.data(); - v43.uFrameWidth = 384; - v43.uFrameHeight = 180; - if (a2.x <= 320 ) - v43.uFrameX = a2.x + 30; - else - v43.uFrameX = a2.x - 414; - v43.uFrameY = 40; - v43.DrawMessageBox(0); - return; - } - - --item_pid; - int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); - v9 = alchemy_level & 0x3F; - //v45 = alchemy_level & 0x3F; - int alchemy_skill = SkillToMastery(alchemy_level); - - auto item = &player->pInventoryItemList[item_pid]; - if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) - { -__show_item_desc: - GameUI_DrawItemInfo(item); - return; - } - - if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle - item->uItemID < ITEM_POTION_CATALYST && // cant recharge - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - - v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v36 < 0.0 ) - v36 = 0.0; - v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); - item->uMaxCharges = v37; - item->uNumCharges = v37; - - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - goto __show_item_desc; - } - - else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle - item->uItemID < ITEM_POTION_CATALYST && // cant harden - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->IsBroken() || // cant harden broken items - item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - item->GetItemEquipType() < EQUIP_OFF_HAND || - item->GetItemEquipType() > EQUIP_WAND) - goto __invalid_item; - - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - goto __show_item_desc; - } - - else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && - pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || - pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle - item->uItemID < ITEM_POTION_CATALYST && // cant enchant - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || - item->uItemID >= ITEM_ARTIFACT_PUCK || - item->IsBroken() || - item->uSpecEnchantmentType || - item->uEnchantmentType || - item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows - goto __invalid_item; - - item->UpdateTempBonus(pParty->uTimePlayed); - if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - item->uSpecEnchantmentType = 40; // of Slaying - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - else - { - static int _4E2904_enchantment_by_potion_lut[] = - { - 164, 93, 22, - 164, 93, 22, - 11, 5, 13, 7, 59 - }; - item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - - v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; - v27->uAttributes = alchemy_skill | 0x18; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - goto __show_item_desc; - } - - - - if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || - pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || - player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) - { - if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || - pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || - player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || - player->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) - { - if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && - (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && - pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && - pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) - goto __show_item_desc; - } - - // src not reagent, dst not bottle - // src potion, dst potion - - v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; - v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; - - if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || - item->uItemID == ITEM_POTION_CATALYST ) - { - v16 = 5; - } - else - { - v16 = pItemsTable->potion_data[v15][v14 + 2]; - } - v51 = v16; - if ( v9 ) - { - if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN ) - { - if ( v16 < ITEM_POTION_HASTE || v16 > ITEM_POTION_CURE_INSANITY ) - { - if ( v16 < ITEM_POTION_MIGHT_BOOST || v16 > ITEM_POTION_BODY_RESISTANE ) - { - if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_level != 4 ) - { -LABEL_53: - v51 = 4; - goto LABEL_54; - } - } - else - { - if ( alchemy_level <= 2 ) - { -LABEL_38: - v51 = 3; - goto LABEL_54; - } - } - } - else - { - if ( alchemy_level == 1 ) - { -LABEL_35: - v51 = 2; - goto LABEL_54; - } - } - } - } - else - { - if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN ) - { - v51 = 1; - goto LABEL_54; - } - if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY ) - goto LABEL_35; - if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE ) - goto LABEL_38; - if ( v16 >= ITEM_POTION_STONE_TO_FLESH ) - goto LABEL_53; - } -LABEL_54: - int pOut_y = 0; - int pOut_x = item_pid + 1; - v17 = (int)player->pInventoryMatrix; - while ( *(int *)v17 != pOut_x ) - { - ++pOut_y; - v17 += 4; - if ( pOut_y >= 126 ) - { - v18 = pOut_y; - goto LABEL_59; - } - } - v18 = pOut_y; -LABEL_59: - if ( !v51 ) - goto __show_item_desc;; - if ( v51 == 1 ) - { - player->RemoveItemAtInventoryIndex(v18); - v26 = rand(); - player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - if ( v51 == 2 ) - { - player->RemoveItemAtInventoryIndex(v18); - v25 = rand(); - player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); - v23 = 1; - } - else - { - if ( v51 == 3 ) - { - player->RemoveItemAtInventoryIndex(v18); - v24 = rand(); - player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); - v23 = 5; - } - else - { - if ( v51 != 4 ) - { - if ( v51 != 5 ) - { - v19 = player->AddItem(-1, 0xDCu); - if ( v19 ) - // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; - player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; - v20 = v14 + 50 * v15; - player->pInventoryItemList[item_pid].uItemID = v51; - player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + player->pInventoryItemList[item_pid].uEnchantmentType) - / 2; - player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 -LABEL_74: - v22 = (int)((char *)player + 36 * item_pid); - if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) - *(int *)(v22 + 552) |= 1u; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - player->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( v9 ) - { - if ( *(int *)(player + 36 * item_pid + 532) == 221 ) - *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; - else - *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; - v21 = player->AddItem(-1, 0xDCu); - if ( v21 ) - //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; - player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; - goto LABEL_74; - } - goto __show_item_desc; - } - player->RemoveItemAtInventoryIndex(v18); - player->SetCondition(0x10u, 0); - v23 = 0; - } - } - player->ItemsEnchant(v23); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( player->CanAct() ) - player->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - - // end alchemy - - player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice(); - switch ( pParty->pPickedItem.uItemID ) - { - case 0xC8u: - case 0xC9u: - case 0xCAu: - case 0xCBu: - case 0xCCu: - player->pInventoryItemList[item_pid].uItemID = 222; - break; - case 0xCDu: - case 0xCEu: - case 0xCFu: - case 0xD0u: - case 0xD1u: - player->pInventoryItemList[item_pid].uItemID = 223; - break; - case 0xD2u: - case 0xD3u: - case 0xD4u: - case 0xD5u: - case 0xD6u: - player->pInventoryItemList[item_pid].uItemID = 224; - break; - case 0xD7u: - case 0xD8u: - case 0xD9u: - case 0xDAu: - case 0xDBu: - player->pInventoryItemList[item_pid].uItemID = 221; - break; - default: - break; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - if ( dword_4E455C ) - { - player->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - } - return; - - -__invalid_item: - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; -} - //----- (00417AD4) -------------------------------------------------------- unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) { diff -r 34dd357a489d -r e8d477b48596 mm7_6.cpp --- a/mm7_6.cpp Thu Sep 26 08:07:50 2013 +0200 +++ b/mm7_6.cpp Thu Sep 26 08:09:05 2013 +0200 @@ -1545,7 +1545,7 @@ { if ( pItemsTable->uAllItemsCount ) { - for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i ) + for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) { if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) pSpellObject.stru_24.uItemID = i; diff -r 34dd357a489d -r e8d477b48596 mm7_data.h --- a/mm7_data.h Thu Sep 26 08:07:50 2013 +0200 +++ b/mm7_data.h Thu Sep 26 08:09:05 2013 +0200 @@ -1073,7 +1073,7 @@ void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); -void OnInventoryItemRightClick(); +void Inventory_ItemPopupAndAlchemy(); void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); void UI_OnMouseLeftClick(int *pXY); // idb unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos); @@ -1150,7 +1150,7 @@ void OnMapLeave(); void OnMapLoad(); void Level_LoadEvtAndStr(const char *pLevelName); -const char *sub_444564(); +const char *GetMapBookHintText();//sub_444564 char *GetEventHintString(unsigned int uEventID); // idb int GetTravelTime(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);