# HG changeset patch # User Grumpy7 # Date 1391465235 -3600 # Node ID 44d956d4f83843c34bca2935675659fdaa8beeda # Parent 34035536bbf5f33411d71a9a4357706f5271d524# Parent 3445abad44c5d7c65e05a2ca4e4bb12a02e788dc Merge diff -r 34035536bbf5 -r 44d956d4f838 CastSpellInfo.cpp --- a/CastSpellInfo.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/CastSpellInfo.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -1607,7 +1607,7 @@ spell_sound_flag = true; break; } - else if ( skill_level == 3 || skill_level == 4)//мастер и гранд + else if ( skill_level == 3 || skill_level == 4)//for master & GM not refactored(для мастера и гранда не отрефакторено) { v258 = 0; v725 = 0; diff -r 34035536bbf5 -r 44d956d4f838 Game.cpp --- a/Game.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/Game.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -3730,61 +3730,51 @@ pPlayer10->PlaySound(SPEECH_12, 0); byte_506550 = 0; continue; - case UIMSG_SpellBook_PressTab: - //__debugbreak(); + case UIMSG_SpellBook_PressTab://перелистывание страниц клавишей Tab + { if ( !uActiveCharacter ) continue; - pPlayer3 = pPlayers[uActiveCharacter]; - pNPCData4 = 0; + int skill_count = 0; uAction = 0; - v101 = 0; - thisl = (int)&pPlayer3->pActiveSkills[12]; - do + for ( uint i = 0; i < 9; i++ ) { - if ( *(short *)thisl ) + if ( pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i] ) { - if ( pPlayer3->lastOpenedSpellbookPage == v101 ) - uAction = (int)pNPCData4; - v102 = (int)pNPCData4; - pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); - v217[v102] = v101; + if ( pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i ) + uAction = skill_count; + v217[skill_count++] = i; } - thisl += 2; - ++v101; } - while ( v101 < 9 ); - if ( !pNPCData4 ) - { - v127 = rand() % 2 + 204; - pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( GetAsyncKeyState(16) ) - { - --uAction; - if ( uAction < 0 ) - uAction = (int)((char *)pNPCData4 - 1); - } + if ( !skill_count )//нет скиллов + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); else { - ++uAction; - if ( uAction >= (signed int)pNPCData4 ) - uAction = 0; + if ( GetAsyncKeyState(16) ) + { + --uAction; + if ( uAction < 0 ) + uAction = skill_count - 1; + } + else + { + ++uAction; + if ( uAction >= skill_count ) + uAction = 0; + } + OnCloseSpellBookPage(); + pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); + pGUIWindow_CurrentMenu->OpenSpellBook(); + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); } - OnCloseSpellBookPage(); - pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); - pGUIWindow_CurrentMenu->OpenSpellBook(); - v127 = rand() % 2 + 204; - pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); continue; + } case UIMSG_OpenSpellbookPage: if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) continue; OnCloseSpellBookPage(); pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; pGUIWindow_CurrentMenu->OpenSpellBook(); - v127 = rand() % 2 + 204; - pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_SelectSpell: { diff -r 34035536bbf5 -r 44d956d4f838 Outdoor.cpp --- a/Outdoor.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/Outdoor.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -4169,7 +4169,7 @@ else { v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); - pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле + pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 56 } pParty->walk_sound_timer = 96;//таймер для бега } diff -r 34035536bbf5 -r 44d956d4f838 Player.cpp --- a/Player.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/Player.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -1587,7 +1587,7 @@ totalDmg *= 2; } } - if ( (signed int)SkillToMastery(this->pActiveSkills[2]) >= 3 + if ( (signed int)SkillToMastery(this->pActiveSkills[PLAYER_SKILL_DAGGER]) >= 3 && pItemsTable->pItems[itemId].uSkillType == 2 && rand() % 100 < 10 ) totalDmg *= 3; @@ -1936,7 +1936,7 @@ } else { - v6 = this->pActiveSkills[34]; + v6 = this->pActiveSkills[PLAYER_SKILL_STEALING]; v7 = v6 & 0x3F; v8 = SkillToMastery(v6); itemvalue = itemToSteal->GetValue(); @@ -1999,7 +1999,7 @@ pGlobalTXT_LocalizationStrings[1]; if ( !(BYTE2(actroPtr->uAttributes) & 0x80) ) actroPtr->SetRandomGoldIfTheresNoItem(); - unsigned __int16 v6 = this->pActiveSkills[34]; + unsigned __int16 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING]; v7 = v6 & 0x3F; stealingMastery = SkillToMastery(v6); int v30 = StealingMasteryBonuses[stealingMastery]; diff -r 34035536bbf5 -r 44d956d4f838 Render.cpp --- a/Render.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/Render.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -3658,9 +3658,8 @@ //----- (004A0BEE) -------------------------------------------------------- void Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor) { - signed int v12; // eax@17 - //signed int v19; // qax@41 - //int v20; // edi@41 + signed int lower_bound; // eax@17 + signed int left_bound; unsigned int v21; // edi@46 int v22; // esi@47 int v23; // ebx@47 @@ -3674,12 +3673,9 @@ int v31; // edx@61 int v32; // edi@61 __int64 v36; // [sp+14h] [bp-8h]@1 - signed int v37; // [sp+18h] [bp-4h]@28 + signed int upper_bound; // [sp+18h] [bp-4h]@28 unsigned int uXa; // [sp+24h] [bp+8h]@49 - //unsigned int uYa; // [sp+28h] [bp+Ch]@28 int uYb; // [sp+28h] [bp+Ch]@47 - //int uZa; // [sp+2Ch] [bp+10h]@38 - bool left_border; v36 = 0i64; if ( uX < this->raster_clip_x )// x выходит за рамки левой границы @@ -3706,175 +3702,168 @@ if ( (unsigned int)v36 & HIDWORD(v36) ) return; - if ( !v36 ) //полностью в рамках - { -LABEL_46: - v21 = pRenderer->uTargetSurfacePitch; - if ( pRenderer->uTargetSurfacePitch ) - { - v12 = uX + uY * pRenderer->uTargetSurfacePitch; - v22 = uW - uY; - v23 = v22; - uYb = v22; - if ( v22 < 0 ) - { - v23 = -v22; - uYb = -v22; - v21 = -pRenderer->uTargetSurfacePitch; - } - uXa = uZ - uX; - if ( (uXa & 0x80000000u) == 0 ) - { - v24 = 1; + if ( v36 ) //не полностью в рамках + { + if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//for left and right(левая и правая) + { + if ( BYTE4(v36) & 8 )//left_border = true; + { + uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX); + uX = this->raster_clip_x; + } + else + { + uZ = this->raster_clip_x; + uW += ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ); + } + } + if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) + { + if ( BYTE4(v36) & 4 ) //right_border = true + { + uY += ((uW - uY) * (this->raster_clip_z - uX)) / (uZ - uX); + uX = this->raster_clip_z; } else { - uXa = -uXa; - v24 = -1; - } - v25 = 0; - - v26 = (unsigned __int16 *)this->pTargetSurface; - if ( v26 ) - { - if ( (signed int)uXa <= v23 )//рисуем вертикальную линию + uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ); + uZ = this->raster_clip_z; + } + } + upper_bound = 0; + if ( uY < this->raster_clip_y ) + upper_bound = 2; + if ( uY > this->raster_clip_w ) + upper_bound |= 1; + + lower_bound = 0; + if ( uW < this->raster_clip_y ) + lower_bound = 2; + if ( uW > this->raster_clip_w ) + lower_bound |= 1; + + if ( !(lower_bound & upper_bound) )//for up and down(для верха и низа) + { + lower_bound ^= upper_bound; + if ( lower_bound & 2 ) + { + if ( upper_bound & 2 ) + { + uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY); + uY = this->raster_clip_y; + } + else + { + uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW); + uW = this->raster_clip_y; + } + } + if ( lower_bound & 1 ) + { + if ( upper_bound & 1 ) + { + uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY); + uY = this->raster_clip_w; + } + else { - v30 = v23 + 1; - if ( v30 > 0 ) + uZ += ((uX - uZ) * (this->raster_clip_w - uW)) / (uY - uW); + uW = this->raster_clip_w; + } + } + } + } + v21 = pRenderer->uTargetSurfacePitch; + if ( pRenderer->uTargetSurfacePitch ) + { + //v12 = uX + uY * pRenderer->uTargetSurfacePitch; + v22 = uW - uY; + v23 = v22; + uYb = v22; + if ( v22 < 0 ) + { + v23 = -v22; + uYb = -v22; + v21 = -pRenderer->uTargetSurfacePitch; + } + uXa = uZ - uX; + if ((signed)(uZ - uX) >= 0) + v24 = 1; + else + { + uXa = -uXa; + v24 = -1; + } + v25 = 0; + + v26 = (unsigned __int16 *)this->pTargetSurface; + if ( v26 ) + { + if ( (signed int)uXa <= v23 )//рисуем вертикальную линию + { + v30 = v23 + 1; + if ( v30 > 0 ) + { + v31 = 2 * v24; + v32 = 2 * v21; + //v12 = (int)&v26[v12]; + int y = 0; + int x = 0; + for ( v30; v30; --v30 ) { - v31 = 2 * v24; - v32 = 2 * v21; - v12 = (int)&v26[v12]; - int y = 0; - int x = 0; - for ( v30; v30; --v30 ) + v25 += uXa; + //*(short *)v12 = uColor; + //v12 += v32; + WritePixel16(uX + x, uY + y, uColor); + if ( v32 >= 0 ) + y += 1; + else + y -= 1; + if ( v25 > 0 ) { - v25 += uXa; - //*(short *)v12 = uColor; - //v12 += v32; - WritePixel16(uX + x, uY + y, uColor); - if ( v32 >= 0 ) - y += 1; - else - y -= 1; - if ( v25 > 0 ) - { - v25 -= uYb; - //v12 += v31; - if ( v31 >= 0 ) - x += 1; - else - x -= 1; - } - } - } - } - else//рисуем горизонтальную линию - { - v27 = uXa + 1; - if ( (signed int)(uXa + 1) > 0 ) - { - v28 = 2 * v21; - v29 = 2 * v24; - int y = 0; - int x = 0; - v12 = (int)&v26[v12]; - for ( v27; v27; --v27 ) - { - v25 += uYb; - //*(short *)v12 = uColor; - //v12 += v29; - WritePixel16(uX + x, uY + y, uColor); - if ( v29 >= 0 ) + v25 -= uYb; + //v12 += v31; + if ( v31 >= 0 ) x += 1; else x -= 1; - if ( v25 > (signed int)uXa ) - { - v25 -= uXa; - //v12 += v28; - if ( v28 >= 0 ) - y += 1; - else - y -= 1; - } } } } } - } - return; - } - - if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//левая и - { - if ( BYTE4(v36) & 8 )//left_border = true; - { - uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX); - uX = this->raster_clip_x; - } - else - { - uZ = this->raster_clip_x; - uW += ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ); - } - } - if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) - { - if ( BYTE4(v36) & 4 ) //right_border = true - { - uY += ((uW - uY) * (this->raster_clip_z - uX)) / (uZ - uX); - uX = this->raster_clip_z; - } - else - { - uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ); - uY = this->raster_clip_z; - } - } - v37 = 0; - if ( uY < this->raster_clip_y ) - v37 = 2; - if ( uY > this->raster_clip_w ) - v37 |= 1; - - if ( uW >= this->raster_clip_y ) - v12 = 0; - else - v12 = 2; - if ( uW > this->raster_clip_w ) - v12 |= 1; - - if ( !(v12 & v37) ) - { - v12 ^= v37; - if ( v12 & 2 ) - { - if ( v37 & 2 ) - { - uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY); - uY = this->raster_clip_y; - } - else - { - uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW); - uW = this->raster_clip_y; - } - } - if ( v12 & 1 ) - { - if ( v37 & 1 ) - { - uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY); - uY = this->raster_clip_w; - } - else - { - uZ += ((uX - uZ) * (this->raster_clip_w - uW)) / (uY - uW); - uW = this->raster_clip_w; - } - } - goto LABEL_46; + else//рисуем горизонтальную линию + { + v27 = uXa + 1; + if ( (signed int)(uXa + 1) > 0 ) + { + v28 = 2 * v21; + v29 = 2 * v24; + int y = 0; + int x = 0; + //v12 = (int)&v26[v12]; + for ( v27; v27; --v27 ) + { + v25 += uYb; + //*(short *)v12 = uColor; + //v12 += v29; + WritePixel16(uX + x, uY + y, uColor); + if ( v29 >= 0 ) + x += 1; + else + x -= 1; + if ( v25 > (signed int)uXa ) + { + v25 -= uXa; + //v12 += v28; + if ( v28 >= 0 ) + y += 1; + else + y -= 1; + } + } + } + } + } } return; } @@ -7485,96 +7474,77 @@ //----- (004A65CC) -------------------------------------------------------- void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) { - //unsigned __int16 *v8; // esi@6 - unsigned int v9; // edi@6 - unsigned int v10; // eax@7 - unsigned int v11; // eax@8 - unsigned int v12; // eax@9 - unsigned int v13; // eax@10 + unsigned int uHeight; // edi@6 unsigned int v14; // edx@11 - unsigned int v15; // eax@13 unsigned int v16; // edx@14 unsigned int v17; // edx@17 - unsigned int v18; // eax@19 unsigned int v19; // edx@20 int v20; // eax@27 int v21; // edx@29 - int v22; // [sp+Ch] [bp-Ch]@6 int v23; // [sp+Ch] [bp-Ch]@24 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 int xa; // [sp+20h] [bp+8h]@26 unsigned int ya; // [sp+24h] [bp+Ch]@24 - int v27; // [sp+2Ch] [bp+14h]@6 + int Width; // [sp+2Ch] [bp+14h]@6 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) { - //v8 = &this->pTargetSurface[x + y * this->uTargetSurfacePitch]; v24 = a4->pLevelOfDetail0_prolly_alpha_mask; - v27 = a4->uTextureWidth; - v9 = a4->uTextureHeight; - v22 = a4->uTextureWidth; + Width = a4->uTextureWidth; + uHeight = a4->uTextureHeight; int clipped_out_x = x; int clipped_out_y = y; if ( this->bClip ) { - v10 = this->uClipX; - if ( (signed int)x < (signed int)v10 ) - { - v11 = v10 - x; - v24 += v11; - v27 += x - this->uClipX; - //v8 += v11; + if ( (signed int)x < (signed int)this->uClipX ) + { + v24 += this->uClipX - x; + Width += x - this->uClipX; clipped_out_x = uClipX; } - v12 = this->uClipY; - if ( (signed int)y < (signed int)v12 ) - { - v13 = v12 - y; - v24 += v22 * v13; - v9 = y - this->uClipY + a4->uTextureHeight; - //v8 += this->uTargetSurfacePitch * v13; + if ( (signed int)y < (signed int)this->uClipY ) + { + v24 += a4->uTextureWidth * (this->uClipY - y); + uHeight = y - this->uClipY + a4->uTextureHeight; clipped_out_y = uClipY; } v14 = this->uClipX; - if ( (signed int)v14 < (signed int)x ) + if ( (signed int)this->uClipX < (signed int)x ) v14 = x; - v15 = this->uClipZ; - if ( (signed int)(v27 + v14) > (signed int)v15 ) + if ( (signed int)(Width + v14) > (signed int)this->uClipZ ) { v16 = this->uClipX; - if ( (signed int)v16 < (signed int)x ) + if ( (signed int)this->uClipX < (signed int)x ) v16 = x; - v27 = v15 - v16; + Width = this->uClipZ - v16; } v17 = this->uClipY; - if ( (signed int)v17 < (signed int)y ) + if ( (signed int)this->uClipY < (signed int)y ) v17 = y; - v18 = this->uClipW; - if ( (signed int)(v9 + v17) > (signed int)v18 ) + if ( (signed int)(uHeight + v17) > (signed int)this->uClipW ) { v19 = this->uClipY; if ( (signed int)v19 < (signed int)y ) v19 = y; - v9 = v18 - v19; - } - } - - for (int dy = 0; dy < v9; ++dy) - { - for (int dx = 0; dx < v27; ++dx) - { - v20 = *v24; - if ( v20 >= a7 && v20 <= a8 ) - { - v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); - if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) - v21 = 2 * a8 - v21 - a7; - //*v8 = a4->pPalette16[v21]; - WritePixel16(clipped_out_x + dx, clipped_out_y + dy, a4->pPalette16[v21]); - } - ++v24; - } - v24 += v22 - v27; + uHeight = this->uClipW - v19; + } + } + + for (int dy = 0; dy < uHeight; ++dy) + { + for (int dx = 0; dx < Width; ++dx) + { + v20 = *v24; + if ( v20 >= a7 && v20 <= a8 ) + { + v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); + if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) + v21 = 2 * a8 - v21 - a7; + WritePixel16(clipped_out_x + dx, clipped_out_y + dy, a4->pPalette16[v21]); + } + ++v24; + } + v24 += a4->uTextureWidth - Width; } /*if ( (signed int)v9 > 0 ) { @@ -7613,31 +7583,20 @@ //----- (004A63E6) -------------------------------------------------------- void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) { - Texture *v8; // eax@2 - //Texture *v9; // ebx@4 - //unsigned __int16 *v10; // esi@6 - unsigned int v11; // edi@7 - unsigned int v12; // eax@9 - unsigned int v13; // eax@10 unsigned int v14; // edx@11 - unsigned int v15; // eax@13 unsigned int v16; // edx@14 unsigned int v17; // edx@17 - unsigned int v18; // eax@19 unsigned int v19; // edx@20 int v20; // eax@27 int v21; // edx@29 - int v22; // [sp+Ch] [bp-Ch]@6 int v23; // [sp+Ch] [bp-Ch]@24 - int v24; // [sp+10h] [bp-8h]@6 - int v25; // [sp+14h] [bp-4h]@6 - int i; // [sp+20h] [bp+8h]@25 + int Height; // [sp+10h] [bp-8h]@6 + int Width; // [sp+14h] [bp-4h]@6 int v27; // [sp+24h] [bp+Ch]@23 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 if ( this->uNumSceneBegins ) { - v8 = a4; if ( a4 ) { if ( a4->pPalette16 ) @@ -7646,61 +7605,54 @@ { if ( a5->pPalette16 ) { - //v10 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; v28 = a4->pLevelOfDetail0_prolly_alpha_mask; - v25 = v8->uTextureWidth; - v24 = v8->uTextureHeight; - v22 = v8->uTextureWidth; - + Width = a4->uTextureWidth; + Height = a4->uTextureHeight; int clipped_out_x = a2; int clipped_out_y = a3; if ( this->bClip ) { - v11 = this->uClipX; - if ( (signed int)a2 < (signed int)v11 ) + if ( (signed int)a2 < (signed int)this->uClipX ) { - v28 += v11 - a2; - v25 += a2 - v11; - //v10 += v11 - a2; + v28 += this->uClipX - a2; + Width += a2 - this->uClipX; clipped_out_x = uClipX; } - v12 = this->uClipY; - if ( (signed int)a3 < (signed int)v12 ) + + if ( (signed int)a3 < (signed int)this->uClipY ) { - v13 = v12 - a3; - v28 += v22 * v13; - v24 += a3 - this->uClipY; - //v10 += this->uTargetSurfacePitch * v13; + v28 += a4->uTextureWidth * (this->uClipY - a3); + Height += a3 - this->uClipY; clipped_out_y = uClipY; } + v14 = this->uClipX; - if ( (signed int)v14 < (signed int)a2 ) + if ( (signed int)this->uClipX < (signed int)a2 ) v14 = a2; - v15 = this->uClipZ; - if ( (signed int)(v25 + v14) > (signed int)v15 ) + if ( (signed int)(Width + v14) > (signed int)this->uClipZ ) { v16 = this->uClipX; - if ( (signed int)v16 < (signed int)a2 ) + if ( (signed int)this->uClipX < (signed int)a2 ) v16 = a2; - v25 = v15 - v16; + Width = this->uClipZ - v16; } + v17 = this->uClipY; - if ( (signed int)v17 < (signed int)a3 ) + if ( (signed int)this->uClipY < (signed int)a3 ) v17 = a3; - v18 = this->uClipW; - if ( (signed int)(v24 + v17) > (signed int)v18 ) + if ( (signed int)(Height + v17) > (signed int)this->uClipW ) { v19 = this->uClipY; - if ( (signed int)v19 < (signed int)a3 ) + if ( (signed int)this->uClipY < (signed int)a3 ) v19 = a3; - v24 = v18 - v19; + Height = this->uClipW - v19; } } v27 = 0; - for (int y = 0; y < v24; ++y) + for (int y = 0; y < Height; ++y) { - for (int x = 0; x < v25; ++x) + for (int x = 0; x < Width; ++x) { if ( *v28 ) { @@ -7720,7 +7672,7 @@ } v28++; } - v28 += v22 - v25; + v28 += a4->uTextureWidth - Width; } /*if ( v24 > 0 ) @@ -7755,8 +7707,6 @@ while ( v27 < v24 ); }*/ - - } } } @@ -7767,98 +7717,75 @@ //----- (004A6274) -------------------------------------------------------- void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) { - Texture *pCurrentTexture; // edi@2 int uHeight; // ebx@4 - //unsigned __int16 *v6; // eax@4 - unsigned int v7; // edx@5 - unsigned int v8; // edx@6 - unsigned int v9; // edx@7 - unsigned int v10; // edx@8 unsigned int v11; // edx@9 unsigned int v12; // esi@12 unsigned int v13; // esi@15 - unsigned int v14; // edx@17 unsigned int v15; // esi@18 - unsigned __int8 *v16; // ebx@22 - char uFlag; // zf@28 - int v18; // [sp+10h] [bp-10h]@4 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 int uWidth; // [sp+1Ch] [bp-4h]@4 - int uXa; // [sp+28h] [bp+8h]@24 - unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 - unsigned int pTexturea; // [sp+30h] [bp+10h]@11 if ( this->uNumSceneBegins ) { - pCurrentTexture = pTexture; if ( pTexture ) { if ( pTexture->pPalette16 ) { uHeight = pTexture->uTextureHeight; - //v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; uWidth = pTexture->uTextureWidth; - v18 = pTexture->uTextureWidth; int clipped_out_x = uX; int clipped_out_y = uY; if ( this->bClip ) { - v7 = this->uClipX; - if ( (signed int)uX < (signed int)v7 ) + if ( (signed int)uX < (signed int)this->uClipX ) { - v8 = v7 - uX; - v19 += v8; + v19 += this->uClipX - uX; uWidth += uX - this->uClipX; - //v6 += v8; clipped_out_x = uClipX; } - v9 = this->uClipY; + uHeight = pTexture->uTextureHeight; - if ( (signed int)uY < (signed int)v9 ) + if ( (signed int)uY < (signed int)this->uClipY ) { - v10 = v9 - uY; - v19 += v18 * v10; + v19 += pTexture->uTextureWidth * (this->uClipY - uY); uHeight = uY - this->uClipY + pTexture->uTextureHeight; - pCurrentTexture = pTexture; - //v6 += this->uTargetSurfacePitch * v10; clipped_out_y = uClipY; } v11 = this->uClipX; - if ( (signed int)v11 < (signed int)uX ) + if ( (signed int)this->uClipX < (signed int)uX ) v11 = uX; - pTexturea = this->uClipZ; - if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) + + if ( (signed int)(v11 + uWidth) > (signed int)this->uClipZ ) { v12 = this->uClipX; - if ( (signed int)v12 < (signed int)uX ) + if ( (signed int)this->uClipX < (signed int)uX ) v12 = uX; - uWidth = pTexturea - v12; + uWidth = this->uClipZ - v12; } v13 = this->uClipY; - if ( (signed int)v13 < (signed int)uY ) + if ( (signed int)this->uClipY < (signed int)uY ) v13 = uY; - v14 = this->uClipW; - if ( (signed int)(uHeight + v13) > (signed int)v14 ) + + if ( (signed int)(uHeight + v13) > (signed int)this->uClipW ) { v15 = this->uClipY; - if ( (signed int)v15 < (signed int)uY ) + if ( (signed int)this->uClipY < (signed int)uY ) v15 = uY; - uHeight = v14 - v15; + uHeight = this->uClipW - v15; } } - - v16 = v19; + for (int y = 0; y < uHeight; ++y) { for (int x = 0; x < uWidth; ++x) { - if ( *v16 ) - WritePixel16(clipped_out_x + x, clipped_out_y + y, pCurrentTexture->pPalette16[*v16]); - ++v16; + if ( *v19 ) + WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v19]); + ++v19; } - v16 += v18 - uWidth; + v19 += pTexture->uTextureWidth - uWidth; } /*if ( (signed int)uHeight > 0 ) { @@ -8078,30 +8005,22 @@ //----- (004A5EB2) -------------------------------------------------------- void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) { - Texture *v4; // edi@2 int v5; // ebx@4 - //unsigned __int16 *pTarget; // eax@4 - unsigned int v7; // edx@5 unsigned int v8; // edx@6 - unsigned int v9; // edx@7 unsigned int v10; // edx@8 unsigned int v11; // edx@9 unsigned int v12; // esi@12 unsigned int v13; // esi@15 - //unsigned int v14; // edx@17 unsigned int v15; // esi@18 - unsigned __int8 *v16; // edx@22 char v17; // zf@26 int v18; // [sp+10h] [bp-10h]@4 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 int v20; // [sp+1Ch] [bp-4h]@4 int uXa; // [sp+28h] [bp+8h]@24 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 - unsigned int v23; // [sp+30h] [bp+10h]@11 if ( this->uNumSceneBegins ) { - v4 = a4; if ( a4 ) { if ( a4->pPalette16 ) @@ -8116,37 +8035,36 @@ int clipped_out_y = uY; if ( this->bClip ) { - v7 = this->uClipX; - if ( (signed int)uX < (signed int)v7 ) + if ( (signed int)uX < (signed int)this->uClipX ) { - v8 = v7 - uX; + v8 = this->uClipX - uX; v19 += v8; v20 += uX - this->uClipX; - //pTarget += v8; clipped_out_x = uClipX; } - v9 = this->uClipY; + v5 = a4->uTextureHeight; - if ( (signed int)uY < (signed int)v9 ) + if ( (signed int)uY < (signed int)this->uClipY ) { - v10 = v9 - uY; + v10 = this->uClipY - uY; v19 += v18 * v10; v5 = uY - this->uClipY + a4->uTextureHeight; - v4 = a4; - //pTarget += this->uTargetSurfacePitch * v10; + //v4 = a4; clipped_out_y = uClipY; } + v11 = this->uClipX; if ( (signed int)v11 < (signed int)uX ) v11 = uX; - v23 = this->uClipZ; - if ( (signed int)(v11 + v20) > (signed int)v23 ) + + if ( (signed int)(v11 + v20) > (signed int)this->uClipZ ) { v12 = this->uClipX; if ( (signed int)v12 < (signed int)uX ) v12 = uX; - v20 = v23 - v12; + v20 = this->uClipZ - v12; } + v13 = this->uClipY; if ( (signed int)v13 < (signed int)uY ) v13 = uY; @@ -8159,16 +8077,16 @@ v5 = uClipW - v15; } } - - v16 = v19; + for (int y = 0; y < v5; ++y) { for (int x = 0; x < v20; ++x) { - WritePixel16(clipped_out_x + x, clipped_out_y + y, v4->pPalette16[*v16]); - ++v16; + if ( a4->pPalette16[*v19] != 0x7FF )// 2047 + WritePixel16(clipped_out_x + x, clipped_out_y + y, a4->pPalette16[*v19]); + ++v19; } - v16 += v18 - v20; + v19 += v18 - v20; } /*if ( (signed int)v5 > 0 ) { diff -r 34035536bbf5 -r 44d956d4f838 UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/UI/Books/UIMapBook.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -112,13 +112,13 @@ } pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); uNumMaxBeacons = 1; - if ( HIBYTE(pPlayer->pActiveSkills[14]) & 1 || (pPlayer->pActiveSkills[14] & 0x80u) != 0 ) + if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 ) { uNumMaxBeacons = 5; } else { - if ( pPlayer->pActiveSkills[14] & 0x40 ) + if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 ) uNumMaxBeacons = 3; } if ( uNumMaxBeacons > 0 ) @@ -381,14 +381,14 @@ { for( uint i = 0; i < screenHeight; ++i ) { - curr_line=&texture8_data[scaled_posY*textr_width]; - stepX_r=teal; + curr_line = &texture8_data[scaled_posY*textr_width]; + stepX_r = teal; for( uint j = 0; j < screenWidth; ++j ) { - scaled_posX=stepX_r>>16; + scaled_posX = stepX_r>>16; //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]); - stepX_r+=scale_increment; + stepX_r += scale_increment; } stepY_r+=scale_increment; scaled_posY=stepY_r>>16; diff -r 34035536bbf5 -r 44d956d4f838 UI/Books/UISpellBook.cpp --- a/UI/Books/UISpellBook.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/UI/Books/UISpellBook.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -129,11 +129,11 @@ pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); } } - pX_coord = (unsigned int)&player->pActiveSkills[12]; - pY_coord = (unsigned int)&player->pActiveSkills[12]; + //pX_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; + //pY_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; for ( uint i = 0; i < 9; i++ ) { - if ( player->pActiveSkills[12 + i] ) + if ( player->pActiveSkills[PLAYER_SKILL_FIRE + i] ) { if ( player->lastOpenedSpellbookPage == i ) { diff -r 34035536bbf5 -r 44d956d4f838 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/UI/UICharacter.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -2517,8 +2517,8 @@ return; } v50 = 0; - if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0) - || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 ) + if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DAGGER] & 0xFFC0) + || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_SWORD]) >= 3 ) { v18 = pMouse->uMouseClickX; v19 = pMouse->uMouseClickY; diff -r 34035536bbf5 -r 44d956d4f838 UI/UiGame.cpp --- a/UI/UiGame.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/UI/UiGame.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -1636,8 +1636,8 @@ void GameUI_DrawPartySpells() { unsigned int v0; // ebp@1 - Texture *v7; // [sp-4h] [bp-1Ch]@12 - Texture *v9; // [sp-4h] [bp-1Ch]@21 + Texture *spell_texture; // [sp-4h] [bp-1Ch]@12 + //Texture *v9; // [sp-4h] [bp-1Ch]@21 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); //v1 = 0; @@ -1660,22 +1660,22 @@ if (pParty->FlyActive()) { if ( pParty->bFlying ) - v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); else - v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(8, 8, v7); + pRenderer->DrawTextureIndexed(8, 8, spell_texture); /*else pRenderer->DrawTextureTransparent(8, 8, v7);*/ } if ( pParty->WaterWalkActive() ) { if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) - v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); else - v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(396, 8, v9); + pRenderer->DrawTextureIndexed(396, 8, spell_texture); /*else pRenderer->DrawTextureTransparent(396, 8, v9);*/ } diff -r 34035536bbf5 -r 44d956d4f838 mm7_2.cpp --- a/mm7_2.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/mm7_2.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -137,13 +137,13 @@ memset(player->pConditions.data(), 0, 0xA0u); __debugbreak(); - *(int *)&player->pActiveSkills[8] = v5; - *(int *)&player->pActiveSkills[10] = v6; + *(int *)&player->pActiveSkills[PLAYER_SKILL_SHIELD] = v5; + *(int *)&player->pActiveSkills[PLAYER_SKILL_CHAIN] = v6; } } break; - case Cook: + case Cook://Повар { if (pParty->uNumFoodRations >= 13) return 1; diff -r 34035536bbf5 -r 44d956d4f838 mm7_3.cpp --- a/mm7_3.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/mm7_3.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -1892,14 +1892,15 @@ float v41; // [sp+2Ch] [bp-4h]@6 float v42; // [sp+2Ch] [bp-4h]@9 - __debugbreak();//нужно почистить, срабатывает при применении закла Точечный взрыв + //__debugbreak();//нужно почистить, срабатывает при применении закла Точечный взрыв if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - v2 = 0; + if ( this->uNumVertices > 0 ) { v3 = (int)&this->field_14[1]; - do + //do + for ( v2 = 0; v2 < this->uNumVertices; ++v2 ) { v4 = *(float *)(v3 - 4); LODWORD(v37) = *(int *)v3; @@ -1941,7 +1942,7 @@ v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; } v13 = v12; - ++v2; + //++v2; *(int *)(v3 + 84) = LODWORD(v13); v14 = *(int *)(v3 + 8); *(float *)(v3 + 76) = v10; @@ -1949,14 +1950,14 @@ *(float *)(v3 + 80) = v11; v3 += 16; } - while ( v2 < this->uNumVertices ); + //while ( v2 < this->uNumVertices ); } } else { v15 = (char *)&this->field_14[1]; - v31 = 3; - do + //do + for ( v31 = 3; v31; --v31 ) { v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; @@ -1991,9 +1992,9 @@ *((int *)v15 + 22) = v29; *((float *)v15 + 20) = v26; v15 += 16; - --v31; + //--v31; } - while ( v31 ); + //while ( v31 ); } this->uNumVertices = 3; return 1; diff -r 34035536bbf5 -r 44d956d4f838 mm7_4.cpp --- a/mm7_4.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/mm7_4.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -2195,14 +2195,14 @@ } return v35; case 30: - v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); + v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_UNARMED]); if ( (v18 & 0x3Fu) < 0xA ) return v35; if ( !gold_transaction_amount ) goto LABEL_79; goto LABEL_42; case 31: - v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); + v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DODGE]); if ( (v18 & 0x3Fu) < 0xA ) return v35; if ( !gold_transaction_amount ) diff -r 34035536bbf5 -r 44d956d4f838 stru6.cpp --- a/stru6.cpp Mon Feb 03 23:06:14 2014 +0100 +++ b/stru6.cpp Mon Feb 03 23:07:15 2014 +0100 @@ -169,9 +169,9 @@ field_14[j].x = x_offset + scale * *(&pArray1->field_0 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); field_14[j].y = y_offset + scale * *(&pArray1->field_4 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); field_14[j].z = z_offset + scale * *(&pArray1->field_8 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); - int v10 = *(int *)((char *)&pArray2->field_0 + v7); + //int v10 = *(int *)((char *)&pArray2->field_0 + v7); - field_14[j].diffuse = *((int *)&pArray1[1].field_0 + 4 * v10); + field_14[j].diffuse = *((int *)&pArray1[1].field_0 + 4 * (*(int *)((char *)&pArray2->field_0 + v7))); v7 += 4; } @@ -354,18 +354,11 @@ { double v3; // st7@1 double v4; // st7@2 - int v6; // eax@6 - float v7; // ST0C_4@6 - float v8; // ST08_4@6 - float v9; // ST04_4@6 - float v10; // ST00_4@6 Particle_sw local_0; // [sp+1Ch] [bp-7Ch]@1 - float v13; // [sp+88h] [bp-10h]@1 memset(&local_0, 0, 0x68u); v3 = (double)a2->uSpriteFrameID / (double)pObjectList->pObjects[a2->uObjectDescID].uLifetime; - v13 = 512.0 * v3; if ( v3 >= 0.75 ) v4 = (1.0 - v3) * 4.0; else @@ -389,15 +382,10 @@ pGame->pParticleEngine->AddParticle(&local_0); } - v6 = ModulateColor(0xFF3C1E, v4); - v7 = (double)floorf(0.5f + v13); - v8 = (double)a2->vPosition.z; - v9 = (double)a2->vPosition.y; - v10 = (double)a2->vPosition.x; - pStru1->_47829F_sphere_particle(v10, v9, v8, v7, v6); + pStru1->_47829F_sphere_particle((double)a2->vPosition.x, (double)a2->vPosition.y, (double)a2->vPosition.z, + (double)floorf(0.5f + (512.0 * v3)), ModulateColor(0xFF3C1E, v4)); } - //----- (004A77FD) -------------------------------------------------------- void stru6::_4A77FD_implosion_particle_d3d(SpriteObject *a1) {