# HG changeset patch # User Gloval # Date 1360961078 -14400 # Node ID 9b77686e223958679b80c53f14b70978d2426011 # Parent 038a4d09406f982c94679b2c1b848efaf7c8dc2a# Parent 207b2492e14bcb72fe866b911515a485d5ba9beb Merge diff -r 038a4d09406f -r 9b77686e2239 Actor.cpp --- a/Actor.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Actor.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -155,9 +155,9 @@ int v10; // eax@11 GUIWindow *v11; // ecx@19 signed int v12; // eax@21 - int v13; // [sp-8h] [bp-44h]@34 + //int v13; // [sp-8h] [bp-44h]@34 const char *v14; // [sp-4h] [bp-40h]@4 - int v15; // [sp-4h] [bp-40h]@34 + //int v15; // [sp-4h] [bp-40h]@34 signed int v16; // [sp-4h] [bp-40h]@35 int v17; // [sp+10h] [bp-2Ch]@1 char pContainer[32]; // [sp+14h] [bp-28h]@3 @@ -271,21 +271,14 @@ pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); if ( v17 && uActiveCharacter && !(v5->uFlags & 0x80) ) { - if ( pParty->uCurrentHour < 5 || pParty->uCurrentHour > 0x15 ) - { - v15 = 0; - v13 = 23; - } + if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); else - { - v15 = 0; - v13 = 22; - } - pPlayers[uActiveCharacter]->PlaySound(v13, v15); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); } } - + //----- (0040894B) -------------------------------------------------------- bool Actor::CanAct() { diff -r 038a4d09406f -r 9b77686e2239 AudioPlayer.h --- a/AudioPlayer.h Sat Feb 16 00:33:21 2013 +0400 +++ b/AudioPlayer.h Sat Feb 16 00:44:38 2013 +0400 @@ -77,6 +77,7 @@ SOUND_EnteringAHouse = 0x6, SOUND_8 = 0x8, SOUND_27 = 0x1B, + SOUND_Button = 66, SOUND_Arcomage_LoseResources = 0x78, SOUND_Arcomage_AddResources = 0x79, SOUND_Arcomage_TowerWallDamage = 0x7A, diff -r 038a4d09406f -r 9b77686e2239 DecalBuilder.cpp --- a/DecalBuilder.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/DecalBuilder.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -774,28 +774,28 @@ return; if (pRenderer->bUsingSpecular) - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); auto pTex = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("hwsplat04"); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex)); DrawDecals(0.00039999999); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); if (pRenderer->bUsingSpecular) - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); } //----- (0049C550) -------------------------------------------------------- diff -r 038a4d09406f -r 9b77686e2239 GUIWindow.h --- a/GUIWindow.h Sat Feb 16 00:33:21 2013 +0400 +++ b/GUIWindow.h Sat Feb 16 00:44:38 2013 +0400 @@ -67,7 +67,7 @@ WINDOW_59 = 0x59, WINDOW_5A = 0x5A, WINDOW_5B = 0x5B, - WINDOW_5C = 0x5C, + WINDOW_VoiceSwitcherButton = 0x5C, WINDOW_5D = 0x5D, WINDOW_5E = 0x5E, WINDOW_5F = 0x5F, @@ -209,7 +209,7 @@ UIMSG_73 = 0x73, UIMSG_74 = 0x74, UIMSG_75 = 0x75, - UIMSG_PlayerCreationSelectQuality = 0x76, + UIMSG_PlayerCreation_SelectAttribute = 0x76, UIMSG_InventoryLeftClick = 0x78, UIMSG_SkillUp = 0x79, UIMSG_7A = 0x7A, @@ -229,8 +229,8 @@ UIMSG_8D = 0x8D, UIMSG_8E = 0x8E, UIMSG_8F = 0x8F, - UIMSG_PlayerCreationVoiceBack = 0x90, - UIMSG_PlayerCreationVoiceForward = 0x91, + UIMSG_PlayerCreation_VoicePrev = 0x90, + UIMSG_PlayerCreation_VoiceNext = 0x91, UIMSG_92 = 0x92, UIMSG_StartNPCDialogue = 0xA1, UIMSG_ArrowUp = 0xA2, @@ -242,8 +242,8 @@ UIMSG_A8 = 0xA8, UIMSG_A9 = 0xA9, UIMSG_AA = 0xAA, - UIMSG_SelectFacePlayerBack = 0xAB, - UIMSG_SelectFacePlayerForward = 0xAC, + UIMSG_PlayerCreation_FacePrev = 0xAB, + UIMSG_PlayerCreation_FaceNext = 0xAC, UIMSG_AD = 0xAD, UIMSG_AE = 0xAE, UIMSG_AF = 0xAF, diff -r 038a4d09406f -r 9b77686e2239 Game.cpp --- a/Game.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Game.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -471,7 +471,7 @@ if ( v11 ) { v12 = rand(); - pPlayers[v17[v12 % v11]]->PlaySound(99, 0); + pPlayers[v17[v12 % v11]]->PlaySound(SPEECH_99, 0); } ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.." "Вы снова обхитрили смерть! …" uGameState = 0; diff -r 038a4d09406f -r 9b77686e2239 Indoor.cpp --- a/Indoor.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Indoor.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -22,6 +22,7 @@ #include "TurnEngine.h" #include "PaletteManager.h" #include "MapInfo.h" +#include "IndoorCamera.h" #include "mm7_data.h" @@ -359,18 +360,18 @@ //----- (00441BD4) -------------------------------------------------------- void IndoorLocation::Draw() { - int v0; // eax@1 + //int v0; // eax@1 IndoorLocation_drawstru _this; // [sp+0h] [bp-4Ch]@5 int v2; // [sp+44h] [bp-8h]@5 int v3; // [sp+48h] [bp-4h]@5 - v0 = 0; - if ( viewparams->field_50_draw_debug_outlines ) - v0 = 1; - if ( viewparams->field_54 ) - LOBYTE(v0) = v0 | 2; + _this.uFlags = 0; + if (viewparams->draw_sw_outlines) + _this.uFlags |= INDOOR_CAMERA_DRAW_SW_OUTLINES; + if (viewparams->draw_d3d_outlines) + _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; + _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; - _this.uFlags = v0; _this.vPosition.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); diff -r 038a4d09406f -r 9b77686e2239 Indoor.h --- a/Indoor.h Sat Feb 16 00:33:21 2013 +0400 +++ b/Indoor.h Sat Feb 16 00:44:38 2013 +0400 @@ -493,7 +493,7 @@ struct IndoorLocation_drawstru { int field_0_timer; - int uFlags; + int uFlags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render d3d outlines Vec3_int_ vPosition; int sRotationY; int sRotationX; @@ -528,7 +528,7 @@ int Reset(struct IndoorLocation_drawstru *a2); int field_0_timer_; - int uFlags; + int uFlags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render d3d outlines Vec3_int_ vPartyPos; int sPartyRotY; int sPartyRotX; diff -r 038a4d09406f -r 9b77686e2239 IndoorCamera.h --- a/IndoorCamera.h Sat Feb 16 00:33:21 2013 +0400 +++ b/IndoorCamera.h Sat Feb 16 00:44:38 2013 +0400 @@ -1,6 +1,9 @@ #pragma once #include "VectorTypes.h" + +#define INDOOR_CAMERA_DRAW_SW_OUTLINES 1 +#define INDOOR_CAMERA_DRAW_D3D_OUTLINES 2 /* 157 */ #pragma pack(push, 1) struct IndoorCamera @@ -13,7 +16,7 @@ flt_1C_fov = 2000.0f; flt_20_inv_1C = 32.768002f; - field_4C = 0; + flags = 0; } void Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight); void Initialize2(); @@ -37,7 +40,7 @@ int _int_cosine; int _int_sine_2; int _int_cosine_2; - int field_4C; + int flags; // & INDOOR_CAMERA_DRAW_D3D_OUTLINES: render terrain outlines in d3d }; #pragma pack(pop) diff -r 038a4d09406f -r 9b77686e2239 LayingItem.cpp --- a/LayingItem.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/LayingItem.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -13,7 +13,7 @@ //----- (00438E35) -------------------------------------------------------- -__int16 LayingItem::_438E35() +void LayingItem::_438E35() { LayingItem *v1; // edi@1 MapInfo *pMapInfo; // esi@1 @@ -85,9 +85,9 @@ v18 = 2; break; default: - LOWORD(v10) = v1->uItemType - 814; + //LOWORD(v10) = v1->uItemType - 814; if ( v1->uItemType != 814 ) - return v10; + return; v18 = 8; break; } @@ -95,14 +95,13 @@ do { if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) ) - LOWORD(v10) = (*v12)->PlaySound(6, 0); + (*v12)->PlaySound(SPEECH_6, 0); else - LOWORD(v10) = (*v12)->ReceiveDamage(v11, v18); + (*v12)->ReceiveDamage(v11, v18); ++v12; } while ( (signed int)v12 <= (signed int)&pPlayers[4] ); } - return v10; } diff -r 038a4d09406f -r 9b77686e2239 LayingItem.h --- a/LayingItem.h Sat Feb 16 00:33:21 2013 +0400 +++ b/LayingItem.h Sat Feb 16 00:44:38 2013 +0400 @@ -10,7 +10,7 @@ LayingItem(); int Create(int yaw, int pitch, int a4, int a5); void _46BEF1_apply_spells(); - __int16 _438E35(); + void _438E35(); static void UpdateObject_fn0_BLV(unsigned int uLayingItemID); static void UpdateObject_fn0_ODM(unsigned int uLayingItemID); diff -r 038a4d09406f -r 9b77686e2239 LightmapBuilder.cpp --- a/LightmapBuilder.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/LightmapBuilder.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -1630,11 +1630,11 @@ pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); if ( !byte_4D864C || !(pGame->uFlags & 1) ) { - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, v7)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); v13 = a3; v33 = 1.0; v32 = 1.0; @@ -1681,24 +1681,24 @@ } } v15 = pRenderer->pRenderD3D->pDevice; - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); + ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } if ( pRenderer->bUsingSpecular ) { //LODWORD(v30) = 1; //v29 = 28; //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); //v30 = pRenderer->uFogColor; //v23 = pRenderer->pRenderD3D->pDevice; //v29 = 34; //v28 = (Lightmap *)v23; ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor)); //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, false)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } } return 1; @@ -1797,28 +1797,28 @@ return; if (pRenderer->bUsingSpecular) - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); auto pTex = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); DrawLightmaps2(0.00050000002); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); if (pRenderer->bUsingSpecular) - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); } \ No newline at end of file diff -r 038a4d09406f -r 9b77686e2239 MM7.h --- a/MM7.h Sat Feb 16 00:33:21 2013 +0400 +++ b/MM7.h Sat Feb 16 00:44:38 2013 +0400 @@ -225,15 +225,6 @@ -/* 301 */ -enum PlayerSpeech -{ - SPEECH_Yell = 0x41, -}; - - - - diff -r 038a4d09406f -r 9b77686e2239 Monsters.cpp --- a/Monsters.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Monsters.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -1060,6 +1060,7 @@ case 0x1A: v102->pInfos[v103].uSpell2UseChance = atoi((const char *)v2); goto LABEL_325; + case 0x1B: strcpy(Dest, (const char *)v2); Dest[0] = ' '; diff -r 038a4d09406f -r 9b77686e2239 NPC.h --- a/NPC.h Sat Feb 16 00:33:21 2013 +0400 +++ b/NPC.h Sat Feb 16 00:44:38 2013 +0400 @@ -19,7 +19,7 @@ { char *pName; unsigned int uPortraitID; - unsigned int uFlags; + unsigned int uFlags; // & 0x80 no greeting on dialogue start int fame; int rep; int house; diff -r 038a4d09406f -r 9b77686e2239 Outdoor.cpp --- a/Outdoor.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Outdoor.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -46,23 +46,20 @@ //----- (0047A59E) -------------------------------------------------------- void OutdoorLocation::ExecDraw(unsigned int bRedraw) { - int v1; // edi@1 //unsigned int v2; // ebx@1 int v3; // ST18_4@3 int v4; // ST04_4@19 int v5; // eax@19 - v1 = 0; - //v2 = bRedraw; - if ( viewparams->field_54 ) - v1 = 2; + pIndoorCamera->flags = 0; + if (viewparams->draw_d3d_outlines) + pIndoorCamera->flags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; + pIndoorCamera->sRotationX = pParty->sRotationX; pIndoorCamera->sRotationY = pParty->sRotationY; pIndoorCamera->pos.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); - //v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); - pIndoorCamera->field_4C = v1; pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; if (bRedraw || pRenderer->pRenderD3D) @@ -2012,8 +2009,7 @@ header.pMagic[2] != 'i' || header.pMagic[3] != 'i' ) { - MessageBoxW(nullptr, L"Can't load file!", - L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); + MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); Str2 = (char *)1; } //v74 = 0; diff -r 038a4d09406f -r 9b77686e2239 Player.cpp --- a/Player.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Player.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -1,5 +1,6 @@ +#include + #include "OSAPI.h" - #include "Player.h" #include "PlayerFrameTable.h" #include "Texture.h" @@ -570,43 +571,44 @@ } //----- (004948B1) -------------------------------------------------------- -__int16 Player::PlaySound(int a2, int a3) -{ - Player *pPlayer; // edi@1 - int v4; // eax@4 +void Player::PlaySound(PlayerSpeech speech, int a3) +{ + //Player *pPlayer; // edi@1 + //int v4; // eax@4 signed int v5; // esi@4 - short *v6; // ebx@4 + char *v6; // ebx@4 signed int v7; // ecx@5 unsigned __int8 v8; // al@6 int v9; // eax@10 - unsigned int pVoiceID; // ecx@10 + //unsigned int pVoiceID; // ecx@10 int v11; // esi@10 signed int v12; // eax@11 signed int v13; // esi@12 int v14; // eax@12 - int v15; // eax@17 + //int v15; // eax@17 int pExpression; // ebx@17 signed int v17; // ecx@19 char *pSoundID; // edi@20 int v20[5]; // [sp+Ch] [bp-1Ch]@7 - Player *pPlayer2; // [sp+20h] [bp-8h]@1 + //Player *pPlayer2; // [sp+20h] [bp-8h]@1 int pPlayerNum; // [sp+24h] [bp-4h]@1 int pSoundId; // [sp+30h] [bp+8h]@4 - pPlayer = this; - pPlayer2 = this; + //pPlayer = this; + //pPlayer2 = this; + pPlayerNum = 1; - do - { - if ( this == pPlayers[pPlayerNum] ) + for (int i = 0; i < 4; ++i) + if (&pParty->pPlayers[i] == this) + { + pPlayerNum = i + 1; break; - ++pPlayerNum; - } - while ( pPlayerNum <= 4 ); - v4 = a2;//102 + } + + //v4 = a2;//102 v5 = 0; pSoundId = 0; - v6 = &SoundSetAction[8 * v4];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? + v6 = (char *)&SoundSetAction[4 * speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? if ( uVoicesVolumeMultiplier ) { v7 = 0; @@ -621,15 +623,15 @@ if ( v5 ) { v9 = rand(); - pVoiceID = pPlayer->uVoiceID; + //pVoiceID = uVoiceID; v11 = v20[v9 % v5]; - if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) ) - { - pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) - + 2 * (v11 + 50 * pPlayer2->uVoiceID) + if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) ) + { + pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) + + 2 * (v11 + 50 * uVoiceID) + 4998; v12 = 8 * pPlayerNum + 312; - LOBYTE(v12) = v12 | 4; + LOBYTE(v12) = v12 | OBJECT_Player; pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); } } @@ -645,9 +647,8 @@ while ( -3 - (signed int)v6 + v14 < 5 ); if ( v13 ) { - v15 = rand(); pPlayerNum = 0; - pExpression = v20[v15 % v13]; + pExpression = v20[rand() % v13]; if ( pExpression == 21 && pSoundId ) { v17 = 0; @@ -670,26 +671,27 @@ if ( pSoundList->pSounds[v17].pSoundData[0] ) pPlayerNum = (sLastTrackLengthMS << 7) / 1000; } - LOWORD(v14) = pPlayer2->PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); - } - return v14; + /*LOWORD(v14) = */PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); + } + //return v14; } // 4948B1: using guessed type int var_1C[5]; //----- (00494A25) -------------------------------------------------------- -__int16 Player::PlayEmotion(CHARACTER_EXPRESSION_ID expr, int a3) -{ - signed int v3; // eax@1 - CHARACTER_EXPRESSION_ID v4; // dx@1 +void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) +{ + //signed int v3; // eax@1 + //CHARACTER_EXPRESSION_ID v4; // dx@1 signed int v5; // edi@15 PlayerFrame *v6; // esi@17 signed int v7; // eax@20 - LOWORD(v3) = this->expression; - v4 = expr; - if ( (short)v3 != 4 && (short)v3 != 12 || expr != 58 ) - { - v3 = (unsigned __int16)v3; + //LOWORD(v3) = this->expression; + //v4 = expr; + if (expression != CHARACTER_EXPRESSION_SLEEP && + expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) + { + int v3 = (unsigned)expression; if ( (signed int)(unsigned __int16)v3 >= 2 ) { if ( v3 <= 7 ) @@ -698,19 +700,19 @@ { if ( v3 > 11 ) { - if ( v3 == 12 || v3 > 97 && v3 <= 99 ) - return v3; + if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) + return; goto LABEL_15; } LABEL_12: - if ( expr != 34 && expr != 35 && expr != 36 ) - return v3; + if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) + return; goto LABEL_15; } } } LABEL_15: - LOWORD(v3) = a3; + //LOWORD(v3) = a3; v5 = 0; this->uExpressionTimeLength = a3; this->uExpressionTimePassed = 0; @@ -724,7 +726,7 @@ else { v6 = pPlayerFrameTable->pFrames; - while ( v6->expression != expr ) + while ( v6->expression != new_expression ) { ++v5; ++v6; @@ -733,13 +735,11 @@ } v7 = v5; } - v4 = expr; - LOWORD(v3) = 8 * pPlayerFrameTable->pFrames[v3].uAnimLength; - this->uExpressionTimeLength = v3; - } - this->expression = v4; + //v4 = expr; + this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; + } + expression = new_expression; viewparams->bRedrawGameUI = 1; - return v3; } //----- (0049327B) -------------------------------------------------------- @@ -1238,7 +1238,7 @@ goto LABEL_76; goto LABEL_82; case 0xDu: - v3->PlaySound(32, 0); + v3->PlaySound(SPEECH_32, 0); v13 = (char *)&v3->sHealth; goto LABEL_70; case 0xEu: @@ -1269,9 +1269,9 @@ goto LABEL_76; } v28 = 0; - v25 = 35; + v25 = SPEECH_35; LABEL_67: - v3->PlaySound(v25, v28); + v3->PlaySound((PlayerSpeech)v25, v28); if ( v3->sHealth > 0 ) v3->sHealth = 0; v13 = (char *)&v3->sMana; @@ -1296,7 +1296,7 @@ if ( v30 == 2 ) { if ( v31 == 1 ) - pPlayers[v21]->PlaySound(107, 0); + pPlayers[v21]->PlaySound(SPEECH_107, 0); } result = 1; break; @@ -1346,11 +1346,11 @@ } v26 = 0; v20 = (v18 != 0) + 23; - v23 = 99; + v23 = SPEECH_99; v3->uFace = v20; v3->uVoiceID = v20; LABEL_81: - v3->PlaySound(v23, v26); + v3->PlaySound((PlayerSpeech)v23, v26); goto LABEL_82; default: goto LABEL_82; @@ -1463,7 +1463,7 @@ if ( v12 == -1 ) { if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(15, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); result = 0; } else @@ -2333,10 +2333,10 @@ std::string v12; // [sp-18h] [bp-40h]@9 const char *v13; // [sp-8h] [bp-30h]@9 int v14; // [sp-4h] [bp-2Ch]@9 - int v15; // [sp+Ch] [bp-1Ch]@3 - int v16; // [sp+10h] [bp-18h]@3 - int v17; // [sp+14h] [bp-14h]@3 - int v18; // [sp+18h] [bp-10h]@3 + int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 + //int v16; // [sp+10h] [bp-18h]@3 + //int v17; // [sp+14h] [bp-14h]@3 + //int v18; // [sp+18h] [bp-10h]@3 Player *v19; // [sp+1Ch] [bp-Ch]@9 Party *v20; // [sp+20h] [bp-8h]@1 int v21; // [sp+24h] [bp-4h]@10 @@ -2347,17 +2347,17 @@ v2 = pItem->uItemID; if ( !BYTE2(pItemsTable->pItems[v2 + 1].uItemID) ) pItem->uAttributes |= 1u; - v15 = 0; - v16 = 1; - v18 = 3; - v17 = 2; + ///v15 = 0; + //v16 = 1; + //v18 = 3; + //v17 = 2; if ( uActiveCharacter ) { v3 = uActiveCharacter - 1; v4 = 0; do { - *(&v15 + v4++) = v3++; + v15[v4++] = v3++; if ( (signed int)v3 >= 4 ) v3 = 0; } @@ -2367,13 +2367,13 @@ if ( v5 ) { v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); - v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); + v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); v21 = areWeLoadingTexture; v8 = 0; while ( 1 ) { - v9 = &v20->pPlayers[*(&v15 + v8)]; - v19 = &v20->pPlayers[*(&v15 + v8)]; + v9 = &v20->pPlayers[v15[v8]]; + v19 = &v20->pPlayers[v15[v8]]; v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); if ( v10 ) break; @@ -2391,7 +2391,7 @@ memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); pItem->Reset(); pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); - v19->PlaySound(60, 0); + v19->PlaySound(SPEECH_60, 0); if ( !v21 ) { v7->Release(); @@ -3667,13 +3667,13 @@ unsigned int v7; // eax@8 char *v8; // ecx@9 int v9; // eax@9 - signed int typea; // [sp+14h] [bp+8h]@1 + //signed int typea; // [sp+14h] [bp+8h]@1 v3 = this; this->pConditions[2] = 0i64; v4 = CalculateIncommingDamage(resistance, type); v3->sHealth -= v4; - typea = v4; + //typea = v4; v5 = v3->sHealth; v6 = v5 < -10; LOBYTE(v6) = v5 <= -10; @@ -3706,9 +3706,9 @@ } } } - if ( typea && CanAct() ) - PlaySound(24, 0); - return typea; + if ( v4 && CanAct() ) + PlaySound(SPEECH_24, 0); + return v4; } //----- (0048DCF6) -------------------------------------------------------- @@ -4019,11 +4019,11 @@ v26 = v48; if ( *(char *)(v48 + 21) & 2 ) goto LABEL_84; - PlaySound(40, 0); + PlaySound(SPEECH_40, 0); *(int *)(v26 + 20) |= 2u; goto LABEL_79; case 20: - PlaySound(40, 0); + PlaySound(SPEECH_40, 0); v27 = pActor->array_000234; if ( pActor->array_000234[0].uItemID ) { @@ -4045,11 +4045,11 @@ v30 = (SoundID)47; goto LABEL_83; case 21: - PlaySound(42, 0); + PlaySound(SPEECH_42, 0); ++v5->sAgeModifier; goto LABEL_82; case 22: - PlaySound(41, 0); + PlaySound(SPEECH_41, 0); v5->sMana = 0; LABEL_82: v42 = 0; @@ -6408,7 +6408,7 @@ } //----- (00490141) -------------------------------------------------------- -int Player::GetSexByVoice() +PLAYER_SEX Player::GetSexByVoice() { signed int result; // eax@1 @@ -6427,8 +6427,8 @@ case 0x11u: case 0x14u: case 0x17u: - result = 0; - break; + return SEX_MALE; + case 4u: case 5u: case 6u: @@ -6441,12 +6441,11 @@ case 0x13u: case 0x15u: case 0x18u: - result = 1; - break; + return SEX_FEMALE; + default: - return result; - } - return result; + assert(false); + } } //----- (00490188) -------------------------------------------------------- @@ -7007,7 +7006,7 @@ pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); } LABEL_112: - v3->PlaySound(36, 0); + v3->PlaySound(SPEECH_36, 0); goto LABEL_173; } LABEL_172: @@ -7449,7 +7448,7 @@ ShowStatusBarString(pTmpBuf, 2u); pMouse->RemoveHoldingItem(); pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); - v3->PlaySound(93, 0); + v3->PlaySound(SPEECH_93, 0); pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) { @@ -7552,9 +7551,9 @@ { sub_467F48(pParty->pPickedItem.uItemID); v65 = 0; - v56 = 37; + v56 = SPEECH_37; LABEL_67: - v3->PlaySound(v56, v65); + v3->PlaySound((PlayerSpeech)v56, v65); return; } LABEL_89: @@ -7624,7 +7623,7 @@ goto LABEL_67; } *v72 = 1; - v3->PlaySound(21, 0); + v3->PlaySound(SPEECH_21, 0); v73 = 0; LABEL_173: v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; @@ -8435,7 +8434,7 @@ { v20 = pPlayers[v3 + 1]; v30 = 1; - v20->PlaySound(96, 0); + v20->PlaySound(SPEECH_96, 0); v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; dword_506568 = v21; @@ -8506,7 +8505,7 @@ v12 = pPlayers[v3 + 1]; v30 = 1; v31 = 1; - v12->PlaySound(96, 0); + v12->PlaySound(SPEECH_96, 0); } v13 = v4->field_152; goto LABEL_51; @@ -8522,7 +8521,7 @@ bFlashQuestBook = 1; v30 = 1; v31 = 1; - v14->PlaySound(93, 0); + v14->PlaySound(SPEECH_93, 0); } v13 = (char *)pParty->_award_bits; LABEL_51: @@ -8622,11 +8621,11 @@ this->uMightBonus = (unsigned __int8)a3; LABEL_111: v28 = 0; - v26 = 91; + v26 = SPEECH_91; LABEL_112: v19 = pPlayers[v3 + 1]; v31 = 1; - v19->PlaySound(v26, v28); + v19->PlaySound((PlayerSpeech)v26, v28); goto LABEL_169; } if ( var <= VAR_FireResistanceBonus ) @@ -8935,7 +8934,7 @@ v14 = pPlayers[uPlayerIdx + 1]; v34 = 1; v3 = 1; - v14->PlaySound(96, 0); + v14->PlaySound(SPEECH_96, 0); } v15 = v4->field_152; goto LABEL_44; @@ -8955,7 +8954,7 @@ bFlashQuestBook = 1; v34 = 1; v3 = 1; - v17->PlaySound(93, 0); + v17->PlaySound(SPEECH_93, 0); } v15 = (char *)pParty->_award_bits; LABEL_44: @@ -9106,10 +9105,10 @@ if ( *v19 > 255 ) *v19 = 255; v31 = 0; - v29 = 91; + v29 = SPEECH_91; LABEL_116: v3 = 1; - pPlayers[uPlayerIdx + 1]->PlaySound(v29, v31); + pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); goto _play_anim_and_maybe_sound; } if ( var <= VAR_DisarmTrapSkill ) @@ -9218,7 +9217,7 @@ { v23 = pPlayers[uPlayerIdx + 1]; v34 = 1; - v23->PlaySound(96, 0); + v23->PlaySound(SPEECH_96, 0); v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; dword_506568 = v24; @@ -9566,7 +9565,7 @@ goto LABEL_17; case VAR_QBits_QuestsDone: _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); - pPlayers[v4 + 1]->PlaySound(96, 0); + pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); return; case VAR_PlayerItemInHands: v15 = (char *)this->pInventoryIndices; @@ -9689,9 +9688,9 @@ this->sResMagicBonus -= (signed __int16)a3; LABEL_72: v25 = 0; - v23 = 91; + v23 = SPEECH_91; LABEL_73: - pPlayers[v4 + 1]->PlaySound(v23, v25); + pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); goto LABEL_17; case VAR_FixedFood: Party::TakeFood((unsigned int)a3); diff -r 038a4d09406f -r 9b77686e2239 Player.h --- a/Player.h Sat Feb 16 00:33:21 2013 +0400 +++ b/Player.h Sat Feb 16 00:44:38 2013 +0400 @@ -6,6 +6,124 @@ + + +/* 301 */ +enum PlayerSpeech +{ + SPEECH_1 = 1, + SPEECH_2 = 2, + SPEECH_3 = 3, + SPEECH_4 = 4, + SPEECH_5 = 5, + SPEECH_6 = 6, + SPEECH_7 = 7, + SPEECH_8 = 8, + SPEECH_9 = 9, + SPEECH_10 = 10, + SPEECH_11 = 11, + SPEECH_12 = 12, + SPEECH_14 = 14, + SPEECH_15 = 15, + SPEECH_16 = 16, + SPEECH_17 = 17, + SPEECH_18 = 18, + SPEECH_19 = 19, + SPEECH_20 = 20, + SPEECH_21 = 21, + SPEECH_GoodDay = 22, + SPEECH_GoodEvening = 23, + SPEECH_24 = 24, + SPEECH_25 = 25, + SPEECH_26 = 26, + SPEECH_27 = 27, + SPEECH_28 = 28, + SPEECH_29 = 29, + SPEECH_30 = 30, + SPEECH_31 = 31, + SPEECH_32 = 32, + SPEECH_33 = 33, + SPEECH_34 = 34, + SPEECH_35 = 35, + SPEECH_36 = 36, + SPEECH_37 = 37, + SPEECH_38 = 38, + SPEECH_39 = 39, + SPEECH_40 = 40, + SPEECH_41 = 41, + SPEECH_42 = 42, + SPEECH_43 = 43, + SPEECH_44 = 44, + SPEECH_45 = 45, + SPEECH_46 = 46, + SPEECH_47 = 47, + SPEECH_48 = 48, + SPEECH_49 = 49, + SPEECH_50 = 50, + SPEECH_51 = 51, + SPEECH_52 = 52, + SPEECH_53 = 53, + SPEECH_54 = 54, + SPEECH_55 = 55, + SPEECH_56 = 56, + SPEECH_57 = 57, + SPEECH_58 = 58, + SPEECH_59 = 59, + SPEECH_60 = 60, + SPEECH_61 = 61, + SPEECH_62 = 62, + SPEECH_63 = 63, + SPEECH_64 = 64, + SPEECH_Yell = 65, + SPEECH_66 = 66, + SPEECH_67 = 67, + SPEECH_68 = 68, + SPEECH_69 = 69, + SPEECH_70 = 70, + SPEECH_71 = 71, + SPEECH_72 = 72, + SPEECH_73 = 73, + SPEECH_74 = 74, + SPEECH_75 = 75, + SPEECH_76 = 76, + SPEECH_77 = 77, + SPEECH_78 = 78, + SPEECH_79 = 79, + SPEECH_80 = 80, + SPEECH_81 = 81, + SPEECH_82 = 82, + SPEECH_83 = 83, + SPEECH_84 = 84, + SPEECH_85 = 85, + SPEECH_86 = 86, + SPEECH_87 = 87, + SPEECH_88 = 88, + SPEECH_89 = 89, + SPEECH_90 = 90, + SPEECH_91 = 91, + SPEECH_92 = 92, + SPEECH_93 = 93, + SPEECH_94 = 94, + SPEECH_95 = 95, + SPEECH_96 = 96, + SPEECH_97 = 97, + SPEECH_98 = 98, + SPEECH_99 = 99, + SPEECH_100 = 100, + SPEECH_101 = 101, + SPEECH_PickMe = 102, + SPEECH_103 = 103, + SPEECH_104 = 104, + SPEECH_105 = 105, + SPEECH_106 = 106, + SPEECH_107 = 107, + SPEECH_108 = 108, + SPEECH_109 = 109, + SPEECH_110 = 110, +}; + + + /* 339 */ enum CHARACTER_RACE { @@ -255,6 +373,7 @@ CHARACTER_EXPRESSION_55 = 55, CHARACTER_EXPRESSION_56 = 56, CHARACTER_EXPRESSION_57 = 57, + CHARACTER_EXPRESSION_58 = 58, // ? @@ -363,7 +482,7 @@ char GetActualSkillLevel(enum PLAYER_SKILL_TYPE uSkillType); int GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); enum CHARACTER_RACE GetRace(); - int GetSexByVoice(); + PLAYER_SEX GetSexByVoice(); void SetInitialStats(); int SetSexByVoice(); void Reset(PLAYER_CLASS_TYPE classType); @@ -397,8 +516,8 @@ bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID); int SetCondition(unsigned int uConditionIdx, int a3); int _49327B(unsigned int uClass, int a3); - __int16 PlaySound(int a2, int a3); - __int16 PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); + void PlaySound(PlayerSpeech speech, int a3); + void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); char _4160CA(int a2); unsigned int GetItemIDAtInventoryIndex(int *a2); int _4B6FF9(); diff -r 038a4d09406f -r 9b77686e2239 Render.cpp --- a/Render.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/Render.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -53,7 +53,7 @@ RenderVertexSoft array_73D150[20]; -RenderVertexD3D3 arary_77E5C8[50]; +RenderVertexD3D3 d3d_vertex_buffer[50]; RenderVertexSoft *ptr_801A04; RenderVertexSoft *ptr_801A08; @@ -136,7 +136,7 @@ pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); @@ -144,7 +144,7 @@ ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, 3u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); @@ -1744,6 +1744,11 @@ //struct IndoorCameraD3D *pIndoorCameraD3D; //RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 + + //warning: the game uses CW culling by default, ccw is incosistent + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); + + v63 = 0; // basic optimizations unsigned int uStartX, uEndX, @@ -1783,6 +1788,7 @@ pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); } } + for (unsigned int z = uStartZ; z < uEndZ - 1; ++z) { for (unsigned int x = uStartX; x < uEndX - 1; ++x) @@ -1797,6 +1803,7 @@ v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v8->uTileBitmapID]; if (v8->uTileBitmapID == 0xFFFF) continue; + v8->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); v8->field_32 = 0; v8->field_59 = 1; @@ -1837,6 +1844,7 @@ array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); } + bool transparent = false; if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) { //v80 = false; @@ -1845,11 +1853,23 @@ else { v6 = v8->uTileBitmapID; - //v80 = true; + transparent = true; } assert(v6 < 1000); // many random crashes here - pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); + + // for all shore tiles - draw a tile water under them since they're half-empty + if (!strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX + { + pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting + pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]], false, true); + pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); + + } + + pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[v6], transparent, true); + + --pOutdoorCamera->numStru148s; --pOutdoorCamera->field_44; } @@ -1997,6 +2017,7 @@ v5 = abs(X);//v5 = 13108 v6 = abs(v83);//v6 = 13108 --X; + __debugbreak(); // uncoment & refactor following large if v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), @@ -2169,7 +2190,7 @@ v77 = (int)v16; //v76 = v16->uNumVertices; //LABEL_161: - pRenderer->DrawTerrainPolygon(v16, pBitmaps_LOD->pHardwareTextures[v39]);//pRenderer->DrawTerrainPolygon(v16->uNumVertices, v16, pBitmaps_LOD->pHardwareTextures[v39], false, v80); + pRenderer->DrawTerrainPolygon(v16->uNumVertices, v16, pBitmaps_LOD->pHardwareTextures[v39], false, v80); goto LABEL_162; } v38 = v16; @@ -2313,7 +2334,7 @@ v58 = v40->uTileBitmapID; v81 = 1; } - pRenderer->DrawTerrainPolygon(v40, pBitmaps_LOD->pHardwareTextures[v58]); + pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); } LABEL_112: v59 = &array_77EC08[pOutdoorCamera->numStru148s]; @@ -2434,7 +2455,7 @@ //v77 = (int)v71; //v76 = v71->uNumVertices; //goto LABEL_161; - pRenderer->DrawTerrainPolygon(v71, pBitmaps_LOD->pHardwareTextures[v75]);//pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); + pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); goto LABEL_162; } v38 = (stru148 *)v71; @@ -4414,18 +4435,18 @@ { if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) { - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u));//Режимы визуализации точечных спрайтов + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));//Режимы визуализации точечных спрайтов ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); if (bUsingSpecular) { - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); } if ( (signed int)uNumVertices > 0 ) { v45 = (char *)&array_50AC10[0].vWorldViewPosition; - v57 = (int)&arary_77E5C8[0].pos.y; + v57 = (int)&d3d_vertex_buffer[0].pos.y; v55 = uNumVertices; do { @@ -4459,7 +4480,7 @@ pRenderD3D->pDevice->SetTexture(0, pTexture); pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, D3DDP_DONOTLIGHT); } @@ -4467,9 +4488,9 @@ { if ( (signed int)uNumVertices > 0 ) { - v9 = (ODMFace *)&arary_77E5C8[0].pos.y; + v9 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; v10 = (char *)&array_50AC10[0].vWorldViewPosition; - a4 = (ODMFace *)&arary_77E5C8[0].pos.y; + a4 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; v56 = uNumVertices; while ( 1 ) { @@ -4504,15 +4525,15 @@ v9 = a4; } } - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); if (bUsingSpecular) - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, D3DDP_DONOTLIGHT)); //v50 = (const char *)v5->pRenderD3D->pDevice; @@ -4522,7 +4543,7 @@ v23 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { - v24 = (char *)&arary_77E5C8[0].diffuse; + v24 = (char *)&d3d_vertex_buffer[0].diffuse; do { *(int *)v24 = a2; @@ -4532,26 +4553,26 @@ while ( v23 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); if ( !pRenderer->bUsingSpecular ) - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); - - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, D3DDP_DONOTLIGHT)); if (bUsingSpecular) { - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); v33 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { - v34 = (char *)&arary_77E5C8[0].specular; + v34 = (char *)&d3d_vertex_buffer[0].specular; do { v35 = *(int *)v34; @@ -4563,22 +4584,22 @@ while ( v33 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, D3DDP_DONOTLIGHT)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, true)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; v41 = GetLevelFogColor(); pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); v6 = 0; pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); } - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); } } @@ -7208,7 +7229,7 @@ return ::GetActorTintColor(a3, a4, a2, a5, a6); } -void Render::DrawTerrainPolygon(stru148 *a3, IDirect3DTexture2 *pTexture)//new function +/*void Render::DrawTerrainPolygon_new(stru148 *a3, IDirect3DTexture2 *pTexture)//new function { int v5; // ebx@1 int v6; // edi@1 @@ -7268,13 +7289,13 @@ - this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); + this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); if (this->bUsingSpecular) { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); } pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; @@ -7320,12 +7341,13 @@ this->pRenderD3D->pDevice->SetTexture(0, pTexture); this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); -} +}*/ + //----- (004A26BC) -------------------------------------------------------- -void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7) -{ - RenderVertexSoft *pVertices; // esi@0 - int v7; // edi@1 +void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) +{ + //RenderVertexSoft *pVertices; // esi@0 + //int v7; // edi@1 unsigned int v8; // ebx@1 LightmapBuilder *v9; // esi@3 unsigned int v10; // edx@3 @@ -7367,7 +7389,7 @@ HRESULT v46; // eax@29 HRESULT v47; // eax@29 HRESULT v48; // eax@29 - IDirect3DDevice3 *v49; // eax@35 + //IDirect3DDevice3 *v49; // eax@35 //IDirect3DDevice3Vtbl *v50; // ecx@35 int v51; // eax@40 char *v52; // esi@40 @@ -7378,23 +7400,25 @@ double v57; // st7@42 float v58; // ST7C_4@43 int v59; // eax@43 - signed int v60; // [sp+78h] [bp-14h]@31 - RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 + //signed int v60; // [sp+78h] [bp-14h]@31 + //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 const char *v62; // [sp+80h] [bp-Ch]@0 const char *v63; // [sp+80h] [bp-Ch]@19 int v64; // [sp+84h] [bp-8h]@0 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 unsigned int v66; // [sp+88h] [bp-4h]@40 unsigned int a6a; // [sp+A0h] [bp+14h]@11 - - v7 = (int)this; + int a7; + + //v7 = (int)this; v8 = 0; - if ( !this->uNumD3DSceneBegins ) + if (!this->uNumD3DSceneBegins) return; if ( uNumVertices < 3) return; - v61 = pVertices; + //v61 = pVertices; + /* v9 = pGame->pLightmapBuilder; v65 = v9; v10 = v9->std__vector_000004_size;*/ @@ -7405,37 +7429,35 @@ } else { - if ( a6 || !pGame->pLightmapBuilder->std__vector_000004_size || + if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pGame->uFlags & 2 ) { - if ( (_BYTE)a7 ) - v60 = 3; + if (clampAtTextureBorders) + this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); else - v60 = 1; - this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60); - if ( a6 || this->bUsingSpecular ) - { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); - v49 = this->pRenderD3D->pDevice; - //v50 = v49->lpVtbl; - if ( a6 ) + this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); + + if (transparent || this->bUsingSpecular) + { + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); + if (transparent) { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5); - //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); + //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO); + //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); } else { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); - //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); - __debugbreak;//it's error + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); } - - } - if ( (signed int)uNumVertices > 0 ) - { - v51 = (int)&arary_77E5C8[0].pos.y; + } + if (uNumVertices > 0) + { + v51 = (int)&d3d_vertex_buffer[0].pos.y; v52 = (char *)&array_50AC10[0].vWorldViewPosition; - a7 = (int)&arary_77E5C8[0].pos.y; + a7 = (int)&d3d_vertex_buffer[0].pos.y; v66 = uNumVertices; while ( 1 ) { @@ -7471,22 +7493,21 @@ } } this->pRenderD3D->pDevice->SetTexture(0, a5); - this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, uNumVertices, 16); - if ( a6 ) - { - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); + this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); + if (transparent) + { + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); } } else { if ( (signed int)uNumVertices > 0 ) { - v12 = (int)&arary_77E5C8[0].pos.y; + v12 = (int)&d3d_vertex_buffer[0].pos.y; v13 = (char *)&array_50AC10[0].vWorldViewPosition; - a7 = (int)&arary_77E5C8[0].pos.y; + a7 = (int)&d3d_vertex_buffer[0].pos.y; a6a = uNumVertices; while ( 1 ) { @@ -7521,26 +7542,25 @@ v12 = a7; } } - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); - if ( pRenderer->bUsingSpecular ) - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); + if (pRenderer->bUsingSpecular) + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 16)); //v63 = (const char *)v7->pRenderD3D->pDevice; - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); //(*(void (**)(void))(*(int *)v63 + 88))(); pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); v26 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { - v27 = (char *)&arary_77E5C8[0].diffuse; + v27 = (char *)&d3d_vertex_buffer[0].diffuse; do { *(int *)v27 = -1; @@ -7550,28 +7570,27 @@ while ( v26 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); if ( !pRenderer->bUsingSpecular ) { - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - } - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3u)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + } + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 16)); if ( pRenderer->bUsingSpecular ) { - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); v37 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { - v38 = (char *)&arary_77E5C8[0].specular; + v38 = (char *)&d3d_vertex_buffer[0].specular; do { v39 = *(int *)v38; @@ -7583,28 +7602,29 @@ while ( v37 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5u)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 16)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); //v44 = pRenderer->pRenderD3D->pDevice; v45 = GetLevelFogColor(); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); v8 = 0; ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); } } - if ( pIndoorCamera->field_4C & 2 || pBLVRenderParams->uFlags & 2 ) - pGame->pIndoorCameraD3D->debug_outline_d3d(arary_77E5C8, uNumVertices, 0xFFFFFFu, 0.0); + + if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_D3D_OUTLINES || + pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES ) + pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); } // 4A26BC: could not find valid save-restore pair for esi @@ -7624,12 +7644,12 @@ if (uNumVertices >= 3) { - this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); + this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); if (this->bUsingSpecular) { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); } for (i = 0; i < uNumVertices; ++i) @@ -7667,12 +7687,12 @@ return; if ( uNumVertices >= 3 ) { - this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); + this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); if ( this->bUsingSpecular ) { - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); - this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); + this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); } for (i = 0; i < uNumVertices; ++i) { @@ -7716,14 +7736,14 @@ v4 = a2; if ( a2 >= 3 ) { - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); v5 = 31 - (a3->field_58 & 0x1F); if ( v5 < pOutdoor->field_CBC_terrain_triangles_shade_type ) v5 = pOutdoor->field_CBC_terrain_triangles_shade_type; v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); if ( a2 > 0 ) { - v7 = (char *)&arary_77E5C8[0].pos.y; + v7 = (char *)&d3d_vertex_buffer[0].pos.y; v8 = (char *)&array_507D30[0].vWorldViewProjY; do { @@ -7745,10 +7765,9 @@ while ( v4 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, a2, 28)); } @@ -7811,11 +7830,11 @@ { __debugbreak(); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); if ( (signed int)uNumVertices > 0 ) { v12 = (char *)&array_507D30[0].vWorldViewPosition; - v13 = (char *)&arary_77E5C8[0].pos.y; + v13 = (char *)&d3d_vertex_buffer[0].pos.y; auto a7 = uNumVertices; uint v18; do @@ -7841,12 +7860,12 @@ } while ( !v18 ); } - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 28)); pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); @@ -7858,21 +7877,21 @@ { for (uint i = 0; i < uNumVertices; ++i) { - arary_77E5C8[i].pos.x = array_507D30[i].vWorldViewProjX; - arary_77E5C8[i].pos.y = array_507D30[i].vWorldViewProjY; - arary_77E5C8[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); - arary_77E5C8[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; - arary_77E5C8[i].diffuse = uCorrectedColor; - arary_77E5C8[i].specular = 0; - arary_77E5C8[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; - arary_77E5C8[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; - } - - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); + d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; + d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); + d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; + d3d_vertex_buffer[i].diffuse = uCorrectedColor; + d3d_vertex_buffer[i].specular = 0; + d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; + d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; + } + + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 28)); } @@ -7883,7 +7902,7 @@ { v23 = pTex; v24 = (char *)&array_507D30[0].vWorldViewPosition; - v25 = (char *)&arary_77E5C8[0].pos.y; + v25 = (char *)&d3d_vertex_buffer[0].pos.y; pTex = (Texture *)uNumVertices; uint v18; do @@ -7909,12 +7928,11 @@ while ( !v18 ); } ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 28)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); @@ -7922,7 +7940,7 @@ v33 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { - v34 = (char *)&arary_77E5C8[0].diffuse; + v34 = (char *)&d3d_vertex_buffer[0].diffuse; do { *(int *)v34 = uCorrectedColor; @@ -7932,20 +7950,19 @@ while ( v33 ); } ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3)); - ErrD3D(pRenderD3D->pDevice->DrawPrimitive( - D3DPT_TRIANGLEFAN, + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); + ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - arary_77E5C8, + d3d_vertex_buffer, uNumVertices, 28)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, false)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); } } } @@ -8709,12 +8726,12 @@ v29[3].pos.y = v18 + srcY; v29[3].texcoord.x = 0.0; v29[3].texcoord.y = 0.0; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, @@ -8722,12 +8739,12 @@ v29, 4, 24)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); } @@ -9187,25 +9204,25 @@ v36[3].texcoord.x = 0.0; v36[3].texcoord.y = 0.0; ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 8u)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); ErrD3D(pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v36, 4, 28)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); } else { @@ -11296,9 +11313,9 @@ //----- (004A1C1E) -------------------------------------------------------- void DoRenderBillboards_D3D() { - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); /*if (pRenderer->uNumBillboardsToDraw) @@ -11349,16 +11366,16 @@ if (pRenderer->bFogEnabled) { pRenderer->bFogEnabled = false; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } @@ -11375,14 +11392,14 @@ if (pRenderer->bFogEnabled) { pRenderer->bFogEnabled = false; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); } break; @@ -11395,13 +11412,13 @@ if (!pRenderer->bFogEnabled) { pRenderer->bFogEnabled = true; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); - } - } - - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); + } + } + + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); } break; diff -r 038a4d09406f -r 9b77686e2239 Render.h --- a/Render.h Sat Feb 16 00:33:21 2013 +0400 +++ b/Render.h Sat Feb 16 00:44:38 2013 +0400 @@ -313,9 +313,8 @@ void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); unsigned int GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6); void DrawPolygon(unsigned int uNumVertices, stru148 *a3, ODMFace *a4, IDirect3DTexture2 *pTexture); - void DrawTerrainPolygon(stru148 *a3, IDirect3DTexture2 *pTexture); - void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7); - void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture); + void DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders); + void DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture); void DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *a4); void _4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex); void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8); @@ -513,7 +512,7 @@ extern RenderVertexSoft array_73D150[20]; -extern RenderVertexD3D3 arary_77E5C8[50]; +extern RenderVertexD3D3 d3d_vertex_buffer[50]; extern RenderVertexSoft *ptr_801A04; extern RenderVertexSoft *ptr_801A08; diff -r 038a4d09406f -r 9b77686e2239 Viewport.h --- a/Viewport.h Sat Feb 16 00:33:21 2013 +0400 +++ b/Viewport.h Sat Feb 16 00:44:38 2013 +0400 @@ -43,6 +43,12 @@ #pragma pack(push, 1) struct ViewingParams { + inline ViewingParams() + { + draw_sw_outlines = false; + draw_d3d_outlines = false; + } + int _443291(); unsigned int _443343(); int _443219(); @@ -76,8 +82,8 @@ int bRedrawGameUI; int field_48; int field_4C; - int field_50_draw_debug_outlines; - int field_54; + int draw_sw_outlines; + int draw_d3d_outlines; int field_58; int field_5C; int field_60; diff -r 038a4d09406f -r 9b77686e2239 mm7_1.cpp --- a/mm7_1.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_1.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -2082,7 +2082,7 @@ pWindowList[v3].pCurrentPosActiveItem -= v12; if ( v8 ) { - pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } @@ -2122,7 +2122,7 @@ pWindowList[v3].pCurrentPosActiveItem = v7; if ( v8 ) { - pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); + pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } @@ -2451,13 +2451,13 @@ } else { - v83 = (char *)8; + v83 = (char *)SPEECH_8; if ( _this->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) - v83 = (char *)7; + v83 = (char *)SPEECH_7; } if ( dword_4E455C ) { - pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); dword_4E455C = 0; } } @@ -2469,14 +2469,14 @@ if ( v10 ) _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; v10 = (v12->uAttributes & 2) == 0; - v83 = (char *)11; + v83 = (char *)SPEECH_11; if ( v10 ) - v83 = (char *)10; + v83 = (char *)SPEECH_10; else ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u); if ( dword_4E455C ) { - pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); dword_4E455C = 0; } } @@ -3264,15 +3264,15 @@ if ( v119 | v116 | i | (unsigned int)v112 ) { if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 ) - v73 = 105; + v73 = SPEECH_105; else - v73 = 104; + v73 = SPEECH_104; } else { - v73 = 106; - } - v47->PlaySound(v73, 0); + v73 = SPEECH_106; + } + v47->PlaySound((PlayerSpeech)v73, 0); } LABEL_84: a2 = pParty->pPlayers; @@ -4090,7 +4090,7 @@ if ( v22 == v5 ) { if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(15, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); return 0; } v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -4520,7 +4520,7 @@ if ( *(float *)&sRotY != 0.0 ) { if ( !dword_507CD8 ) - pPlayers[uActiveCharacter]->PlaySound(4, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_4, 0); } dword_507CD8 = 0; v3 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, a4, 0); @@ -5757,7 +5757,7 @@ goto LABEL_9; v4 = pPlayers[uActiveCharacter]; } - v4->PlaySound(15, 0); + v4->PlaySound(SPEECH_15, 0); } LABEL_9: if ( !pCurrentScreen ) diff -r 038a4d09406f -r 9b77686e2239 mm7_2.cpp --- a/mm7_2.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_2.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -244,7 +244,7 @@ if ( pParty->uFine < 0 ) pParty->uFine = 0; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(81, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); v0 = ptr_507BC0; } else @@ -348,7 +348,7 @@ Party::TakeGold(v7); pParty->uNumGoldInBank += v7; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(81, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); } v0 = ptr_507BC0; LABEL_16: @@ -744,7 +744,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(67, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); goto LABEL_43; } if ( pParty->uNumGold >= v7 ) @@ -4189,7 +4189,7 @@ Party::TakeGold(v37); dword_F8B1E4 = 1; *(short *)v38 = 1; - v35->PlaySound(78, 0); + v35->PlaySound(SPEECH_78, 0); } } } @@ -4600,7 +4600,7 @@ memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u); goto LABEL_42; } - v0->PlaySound(15, 0); + v0->PlaySound(SPEECH_15, 0); v54 = 5; LABEL_70: v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" @@ -4690,12 +4690,12 @@ pRenderer->ClearZBuffer(0, 479); v27 = v77; v53 = 0; - v51 = 75; + v51 = SPEECH_75; LABEL_81: - v27->PlaySound(v51, v53); + v27->PlaySound((PlayerSpeech)v51, v53); return; } - v0->PlaySound(15, 0); + v0->PlaySound(SPEECH_15, 0); v54 = 2; goto LABEL_70; } @@ -4718,7 +4718,7 @@ v51 = 77; goto LABEL_80; } - v0->PlaySound(79, 0); + v0->PlaySound(SPEECH_79, 0); v56 = 0; v52 = 0; v50 = 0; @@ -4754,7 +4754,7 @@ dword_F8B1E4 = 1; Party::TakeGold(v80); *(int *)(v12 + 20) |= 1u; - v0->PlaySound(73, 0); + v0->PlaySound(SPEECH_73, 0); v9 = pGlobalTXT_LocalizationStrings[569]; goto LABEL_25; } @@ -4807,7 +4807,7 @@ v8 = *(int *)(v3 + 20); LOBYTE(v8) = v8 & 0xFD; *(int *)(v3 + 20) = v8 | 1; - v0->PlaySound(74, 0); + v0->PlaySound(SPEECH_74, 0); v9 = pGlobalTXT_LocalizationStrings[570]; LABEL_25: v54 = 2; @@ -4873,10 +4873,11 @@ static_stru_F8BA58.field_0 = 0; if ( _this && *_this ) { - v2 = (char *)&unk_F8B668; + int i = 0; + v2 = (char *)&array_F8B668; v3 = 1; v7 = 0; - v4 = _this - (char *)&unk_F8B668; + v4 = _this - (char *)&array_F8B668; do { v5 = v2[v4]; @@ -4921,8 +4922,9 @@ if ( static_stru_F8BA58.field_0 >= 30 ) break; ++v2; - } - while ( (unsigned int)v2 < (unsigned int)&unk_F8BA50 ); + ++i; + } + while (i < 1000); *v2 = 0; } result = a2; @@ -14794,7 +14796,7 @@ if ( (signed int)SkillToMastery(v5) < 3 ) { LABEL_8: - v0->PlaySound(39, 0); + v0->PlaySound(SPEECH_39, 0); return; } v3 = pParty->pPickedItem.uItemID; diff -r 038a4d09406f -r 9b77686e2239 mm7_3.cpp --- a/mm7_3.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_3.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -2677,7 +2677,7 @@ if ( !uActiveCharacter ) goto LABEL_87; v65 = 0; - v63 = 63; + v63 = SPEECH_63; goto LABEL_76; case PARTY_LookDown: __debugbreak(); @@ -2688,9 +2688,9 @@ if ( uActiveCharacter ) { v65 = 0; - v63 = 64; + v63 = SPEECH_64; LABEL_76: - pPlayers[v35]->PlaySound(v63, v65); + pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65); } break; case PARTY_CenterView: @@ -3508,7 +3508,7 @@ if ( _angle_x > 128 ) _angle_x = 128; if (uActiveCharacter) - pPlayers[uActiveCharacter]->PlaySound(63, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0); break; case PARTY_LookDown: @@ -3516,7 +3516,7 @@ if ( _angle_x < -128 ) _angle_x = -128; if (uActiveCharacter) - pPlayers[uActiveCharacter]->PlaySound(64, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0); break; case PARTY_Jump: @@ -3624,7 +3624,7 @@ { auto player = pParty->pPlayers + i; if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct()) - player->PlaySound(66, 0); + player->PlaySound(SPEECH_66, 0); } } } @@ -9700,6 +9700,8 @@ //----- (004811A3) -------------------------------------------------------- void stru148::_4811A3() { + __debugbreak(); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]], @@ -18130,7 +18132,7 @@ LABEL_119: v56 = &pParty->pPlayers[v57]; LABEL_120: - v56->PlaySound(v114, v118); + v56->PlaySound((PlayerSpeech)v114, v118); ++v122; //v4 = v124; //v5 = pSomeEVT; @@ -18139,12 +18141,12 @@ break; } v55 = pParty->pPlayers; - do - { - v55->PlaySound(_evt->v6, 0); + for (int iii = 0; iii < 4; ++iii) + { + v55->PlaySound((PlayerSpeech)_evt->v6, 0); ++v55; } - while ( (signed int)v55 < (signed int)pParty->pHirelings ); + //while ( (signed int)v55 < (signed int)pParty->pHirelings ); ++v122; //v4 = v124; //v5 = pSomeEVT; diff -r 038a4d09406f -r 9b77686e2239 mm7_4.cpp --- a/mm7_4.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_4.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -3148,7 +3148,7 @@ if ( qword_A750D8 <= 0 ) { if ( pPlayers[word_A750E2]->CanAct() ) - pPlayers[word_A750E2]->PlaySound(word_A750E0, 0); + pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0); qword_A750D8 = 0i64; } } @@ -9566,7 +9566,7 @@ v13[1] |= 1u; break; } - pPlayers[uActiveCharacter]->PlaySound(85, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -9636,9 +9636,9 @@ if ( uActiveCharacter ) { v25 = 0; - v23 = 86; + v23 = SPEECH_86; LABEL_50: - pPlayers[v11]->PlaySound(v23, v25); + pPlayers[v11]->PlaySound((PlayerSpeech)v23, v25); goto _return; } } @@ -9665,7 +9665,7 @@ ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); v19 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_77; } @@ -11763,7 +11763,7 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) pOutdoor->SetFog(); } - v0->PlaySound(87, 0); + v0->PlaySound(SPEECH_87, 0); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// // "%s is now Level %lu and has earned %lu Skill Points!" ShowStatusBarString(pTmpBuf, 2u); @@ -12693,7 +12693,7 @@ byte_F8B1EC = 0; uDialogueType = 13; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); v7 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_64; } @@ -12725,7 +12725,7 @@ if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) pDialogue_SpeakingActor->uAIState = Removed; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(61, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); goto LABEL_87; } if ( v3 == 22 ) @@ -13497,7 +13497,7 @@ } } ++byte_F8B1EF[v29]; - v1->PlaySound(83, 0); + v1->PlaySound(SPEECH_83, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); goto LABEL_46; } @@ -13558,7 +13558,7 @@ HIDWORD(v1->pConditions[17]) = (int)v39; LABEL_63: pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - v1->PlaySound(82, 0); + v1->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); LABEL_46: result = pMessageQueue_50CBD0->uNumMessages; @@ -14221,7 +14221,7 @@ v12 = (unsigned __int8)v5[8]; if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) { - v63 = 72; + v63 = SPEECH_72; v13 = 2500; if ( CheckHiredNPCSpeciality(8u) ) v12 -= 2; @@ -14231,7 +14231,7 @@ } else { - v63 = 71; + v63 = SPEECH_71; v13 = 1500; v47[1] = (const char *)35; } @@ -14242,7 +14242,7 @@ if ( v12 < 1 ) v12 = 1; RestAndHeal(1440 * v12); - v61->PlaySound(v63, 0); + v61->PlaySound((PlayerSpeech)v63, 0); v14 = GetTickCount(); v15 = v14 + v13; if ( v15 < v14 ) @@ -14901,7 +14901,7 @@ if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) HousePlaySomeSound(v9, 1); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(47, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); result = v23; if ( v23 ) uCurrentHouse_Animation = v23; @@ -15107,7 +15107,7 @@ sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], v6, aAMPMNames[v7], v9, aAMPMNames[v8]); ShowStatusBarString(pTmpBuf, 2u); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(3, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); return 0; } } diff -r 038a4d09406f -r 9b77686e2239 mm7_5.cpp --- a/mm7_5.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_5.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -2880,9 +2880,9 @@ { v89 = uActiveCharacter; v176 = 0; - v160 = 108; + v160 = SPEECH_108; LABEL_619: - pPlayers[v89]->PlaySound(v160, v176); + pPlayers[v89]->PlaySound((PlayerSpeech)v160, v176); } } else @@ -3023,7 +3023,7 @@ pPlayers[uActiveCharacter]->uQuickSpell = v99; stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); if ( uActiveCharacter ) - pPlayer10->PlaySound(12, 0); + pPlayer10->PlaySound(SPEECH_12, 0); byte_506550 = 0; continue; case UIMSG_33: @@ -3244,7 +3244,7 @@ pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); free((void *)uNumSeconds); stru_506E40._40E55E("gamma.pcx", 0); - GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0); + GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); //LABEL_453: if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -3343,7 +3343,7 @@ { *(short *)v105 = uNumSeconds + 1; pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; - pPlayer4->PlaySound(14, 0); + pPlayer4->PlaySound(SPEECH_14, 0); v165 = 0; v151 = 0; v144 = 0; @@ -3745,11 +3745,11 @@ enum PLAYER_SKILL_TYPE v6; // edi@37 GUIWindow *pWindow; // eax@56 unsigned int v8; // edx@56 - Player *pCurrentPlayer; // edi@57 + //Player *pCurrentPlayer; // edi@57 signed int v10; // eax@58 GUIButton *pButton; // eax@59 - unsigned __int8 v12; // sf@62 - signed int v13; // eax@64 + //unsigned __int8 v12; // sf@62 + //signed int v13; // eax@64 unsigned int v14; // eax@66 int v15; // edi@70 char v16; // zf@73 @@ -3778,7 +3778,7 @@ int v43; // [sp-10h] [bp-20h]@56 int uNum; // [sp+4h] [bp-Ch]@3 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 - int pSex; // [sp+Ch] [bp-4h]@3 + //int pSex; // [sp+Ch] [bp-4h]@3 Player *pPlayer; if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3788,7 +3788,9 @@ pPlayer = pParty->pPlayers; do { - pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex); + int param2; + pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, ¶m2); + switch (pUIMessageType) // For buttons of window MainMenu { case UIMSG_MainMenu_ShowPartyCreationWnd: @@ -3817,6 +3819,99 @@ continue; } + + switch (pUIMessageType) // For buttons of Party Creation Window + { + case UIMSG_PlayerCreation_SelectAttribute: + { + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = uNum; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + } + continue; + + case UIMSG_PlayerCreation_VoicePrev: + { + auto player = &pParty->pPlayers[uNum]; + auto sex = player->GetSexByVoice(); + do + { + if (player->uVoiceID == 0) + player->uVoiceID = 19; + else --player->uVoiceID; + } + while (player->GetSexByVoice() != sex); + + pButton = pCreationUI_BtnPressLeft2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + player->PlaySound(SPEECH_PickMe, 0); + } + continue; + + case UIMSG_PlayerCreation_VoiceNext: + { + auto player = &pParty->pPlayers[uNum]; + auto sex = player->GetSexByVoice(); + do + { + player->uVoiceID = (player->uVoiceID + 1) % 20; + } + while (player->GetSexByVoice() != sex); + + pButton = pCreationUI_BtnPressRight2[uNum]; + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + player->PlaySound(SPEECH_PickMe, 0); + } + continue; + + case UIMSG_PlayerCreation_FacePrev: + { + pPlayer = &pParty->pPlayers[uNum]; + unsigned char v12 = (char)((int)pPlayer->uFace - 1) < 0; + --pPlayer->uFace; + if ( v12 ) + pPlayer->uFace = 19; + pPlayer->uVoiceID = pPlayer->uFace; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v25 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v25; + GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + } + continue; + + case UIMSG_PlayerCreation_FaceNext: + { + pPlayer = &pParty->pPlayers[uNum]; + v20 = (char)((int)pPlayer->uFace + 1) % 20; + pPlayer->uFace = v20; + pPlayer->uVoiceID = v20; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v21 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v21; + GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + pPlayer->PlaySound(SPEECH_PickMe, 0); + //v1 = (char *)pParty->pPlayers; + } + continue; + } + switch (pUIMessageType) // For buttons of window LoadGame { case UIMSG_LoadGame: @@ -3888,50 +3983,6 @@ { if ( pUIMessageType > UIMSG_DownArrow ) { - if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) - { - pPlayer = &pParty->pPlayers[uNum]; - v12 = (char)((int)pPlayer->uFace - 1) < 0; - --pPlayer->uFace; - if ( v12 ) - pPlayer->uFace = 19; - pPlayer->uVoiceID = pPlayer->uFace; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v25 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v25; - GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, - (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0.0, 0); - pPlayer->PlaySound(102, 0); - //v1 = (char *)pParty->pPlayers; - continue; - } - if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) - { - pPlayer = &pParty->pPlayers[uNum]; - v20 = (char)((int)pPlayer->uFace + 1) % 20; - pPlayer->uFace = v20; - pPlayer->uVoiceID = v20; - pPlayer->SetInitialStats(); - pPlayer->SetSexByVoice(); - pPlayer->RandomizeName(); - v21 = uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = v21; - GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (enum WindowType)92, - (int)pCreationUI_BtnPressRight[v21], 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - pPlayer->PlaySound(102, 0); - //v1 = (char *)pParty->pPlayers; - continue; - } if ( pUIMessageType == UIMSG_AD )//unknow { __debugbreak(); @@ -3958,7 +4009,7 @@ pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; } - GUIWindow::Create(602, 450, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0); + GUIWindow::Create(602, 450, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -4046,50 +4097,6 @@ //VideoPlayer::dtor(); } } - else - { - if ( pUIMessageType == UIMSG_PlayerCreationSelectQuality ) - { - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) - % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - uPlayerCreationUI_SelectedCharacter = uNum; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack )// есть проблема со звуками - { - pCurrentPlayer = &pPlayer[uNum]; - pSex = pCurrentPlayer->GetSexByVoice(); - do - { - v12 = (pCurrentPlayer->uVoiceID-- - 1) == 0; - if ( v12 ) - pCurrentPlayer->uVoiceID = 19; - v13 = pCurrentPlayer->GetSexByVoice(); - } - while ( v13 != pSex ); - pButton = pCreationUI_BtnPressLeft2[uNum]; - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - pCurrentPlayer->PlaySound(102, 0); - continue; - } - if ( pUIMessageType == UIMSG_PlayerCreationVoiceForward ) - { - pCurrentPlayer = &pPlayer[uNum]; - pSex = pCurrentPlayer->GetSexByVoice(); - do - { - pCurrentPlayer->uVoiceID = (signed int)(pCurrentPlayer->uVoiceID + 1) % 20; - } - while ( pCurrentPlayer->GetSexByVoice() != pSex ); - pButton = pCreationUI_BtnPressRight2[uNum]; - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - pCurrentPlayer->PlaySound(102, 0); - continue; - } - } } else { @@ -4134,7 +4141,7 @@ if ( pUIMessageType == UIMSG_PlayerCreationSelectClass ) { pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)uNum); - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); continue; } if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) @@ -4157,7 +4164,7 @@ { uPlayerCreationUI_SelectedCharacter = uNum; v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; - pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; + int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; v41 = 2; v5 = v4 % 7 + pSex + 7 * uNum; pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; @@ -5128,7 +5135,7 @@ // 50FE08: using guessed type stru298 stru_50FE08; //----- (00439474) -------------------------------------------------------- -bool __fastcall DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) +void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) { signed int v3; // eax@1 LayingItem *v4; // ebx@1 @@ -5213,8 +5220,8 @@ } v5 = v3 & 7; uPlayerID = v3 >> 3; - if ( v5 != 4 ) - return uPlayerID; + if (v5 != OBJECT_Player) + return; pPlayer = &pParty->pPlayers[uPlayerID]; if ( uPlayerID < 0 && uPlayerID > 3 ) { @@ -5223,7 +5230,7 @@ pMonster = &pActors[uActorID_Monster_]; uPlayerID = pMonster->IsAlive(); if ( uPlayerID ) - return uPlayerID; + return; BYTE1(pMonster->uAttributes) |= 0xC0u; if ( pMonster->uAIState == Fleeing ) pMonster->uAttributes |= 0x20000u; @@ -5312,7 +5319,7 @@ if ( uPlayerID >= 2560 ) { if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) - return uPlayerID; + return; v61 = 2; } else @@ -5364,8 +5371,8 @@ if ( !stru_50C198.PlayerHitOrMiss(pPlayer, pMonster, v61, a4) ) { LABEL_68: - LOWORD(uPlayerID) = pPlayer->PlaySound(52, 0); - return uPlayerID; + pPlayer->PlaySound(SPEECH_52, 0); + return; } goto LABEL_69; } @@ -5516,10 +5523,10 @@ Actor::_43AC45(uActorID_Monster_, 1); if ( pMonster->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); - v40 = 51; + v40 = SPEECH_51; if ( rand() % 100 < 20 ) v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; - pPlayer->PlaySound(v40, 0); + pPlayer->PlaySound((PlayerSpeech)v40, 0); v41 = 0; if ( bShowDamage ) { @@ -5586,7 +5593,7 @@ pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); } - return Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); + Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); } // 4D864C: using guessed type char byte_4D864C; @@ -5833,10 +5840,10 @@ Actor::_43AC45(uActorID, 1); if ( v7->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); - v34 = 51; + v34 = SPEECH_51; if ( rand() % 100 < 20 ) v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; - v6->PlaySound(v34, 0); + v6->PlaySound((PlayerSpeech)v34, 0); } } } @@ -5861,7 +5868,7 @@ if ( v6->sHealth > 0 ) { if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) - v6->PlaySound(48, 0); + v6->PlaySound(SPEECH_48, 0); } } } @@ -5893,7 +5900,7 @@ { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[637], v45->pName); ShowStatusBarString(pTmpBuf, 2u); - v45->PlaySound(6, 0); + v45->PlaySound(SPEECH_6, 0); return; } } @@ -6019,10 +6026,10 @@ Actor::_43AC45(uActorID, 1); if ( v44->pMonsterInfo.uExp ) sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); - v64 = 51; + v64 = SPEECH_51; if ( rand() % 100 < 20 ) v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; - v45->PlaySound(v64, 0); + v45->PlaySound((PlayerSpeech)v64, 0); } } } @@ -15295,7 +15302,7 @@ continue; } v18 = v17 - 1; - if ( pWindowType == WINDOW_5C ) // Change page in AutonotesBook + if ( pWindowType == WINDOW_VoiceSwitcherButton ) // Change page in AutonotesBook { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15891,7 +15898,7 @@ *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) goto LABEL_92; - v0->PlaySound(16, 0); + v0->PlaySound(SPEECH_16, 0); goto LABEL_91; } if ( v45 ) @@ -15932,7 +15939,7 @@ if ( dword_4E455C ) { if ( v0->CanAct() ) - v0->PlaySound(17, 0); + v0->PlaySound(SPEECH_17, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); LABEL_91: dword_4E455C = 0; @@ -15980,7 +15987,7 @@ dword_50CDCC = 1; if ( dword_4E455C ) { - v0->PlaySound(16, 0); + v0->PlaySound(SPEECH_16, 0); dword_4E455C = 0; } } diff -r 038a4d09406f -r 9b77686e2239 mm7_6.cpp --- a/mm7_6.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_6.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -4072,7 +4072,7 @@ } if ( v727 != 0.0 ) { - pPlayer->PlaySound(49, 0); + pPlayer->PlaySound(SPEECH_49, 0); goto LABEL_1162; } } @@ -5313,7 +5313,7 @@ pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, v1, v1, -1, v1, v1, v1, v1); v318 = v726; v3->spellnum = v1; - v318->PlaySound(43, v1); + v318->PlaySound(SPEECH_43, v1); } goto LABEL_83; } @@ -6090,7 +6090,7 @@ || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) { if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) - pParty->pPlayers[v396].PlaySound(25, v1); + pParty->pPlayers[v396].PlaySound(SPEECH_25, v1); if ( v731 == 4 ) { v397 = v3->uPlayerID_2; @@ -6425,7 +6425,7 @@ if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) { if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) - pParty->pPlayers[v440].PlaySound(25, v1); + pParty->pPlayers[v440].PlaySound(SPEECH_25, v1); if ( v731 == 4 ) { v441 = v3->uPlayerID_2; @@ -7741,7 +7741,7 @@ v222 = (char *)HIDWORD(v733); if ( v223 ) LABEL_439: - ((Player *)v222)->PlaySound(103, v1); + ((Player *)v222)->PlaySound(SPEECH_103, v1); } v222 += 6972; HIDWORD(v733) = (int)v222; @@ -8050,7 +8050,7 @@ else { v34 = 5; - v1->PlaySound(50, v3); + v1->PlaySound(SPEECH_50, v3); } switch ( v34 ) { @@ -9111,14 +9111,12 @@ v5->Add(partyAction); break; case INPUT_Yell: - //__debugbreak(); - if ( !pCurrentScreen - && uActiveCharacter ) + if (!pCurrentScreen && uActiveCharacter) { pParty->Yell(); - pPlayers[uActiveCharacter]->PlaySound(65, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); } - break; + break; case INPUT_Pass: //__debugbreak(); if ( pCurrentScreen ) diff -r 038a4d09406f -r 9b77686e2239 mm7_data.cpp --- a/mm7_data.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_data.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -1094,7 +1094,7 @@ "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu", "pc25lhu" }; -short SoundSetAction[192]= +short SoundSetAction[192]= // 4ED3D8 { 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 37, 38, 45, 0, 0, 37, 0, 0, 47, 53, 0, 0, 0, 2, 0, 0, 25, 0, 0, 0, 0, 1, 0, 0, 47, 0, 0, 0, 0, 3, 0, 0, 41, 42, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 5, 0, 0, 21, 22, 23, 24, 45, 6, 0, 0, 47, 0, 0, 0, 0, 7, 0, @@ -1856,8 +1856,8 @@ int dword_F8B1F4; // weak _UNKNOWN unk_F8B1F8; // weak _UNKNOWN unk_F8B5E0; // weak -_UNKNOWN unk_F8B668; // weak -_UNKNOWN unk_F8BA50; // weak +char array_F8B668[1000]; // weak +//_UNKNOWN unk_F8BA50; // weak char byte_F8BC0C; // weak int bGameoverLoop = 0; // weak __int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb diff -r 038a4d09406f -r 9b77686e2239 mm7_data.h --- a/mm7_data.h Sat Feb 16 00:33:21 2013 +0400 +++ b/mm7_data.h Sat Feb 16 00:44:38 2013 +0400 @@ -1711,8 +1711,8 @@ extern _UNKNOWN unk_F8B1F8; // weak extern _UNKNOWN unk_F8B5E0; // weak extern struct FrameTableTxtLine stru_F8B5E8; // weak -extern _UNKNOWN unk_F8B668; // weak -extern _UNKNOWN unk_F8BA50; // weak +extern char array_F8B668[]; // weak +//extern _UNKNOWN unk_F8BA50; // weak extern char byte_F8BC0C; // weak extern int bGameoverLoop; // weak extern __int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb @@ -2384,7 +2384,7 @@ int /*__usercall*/ sr_sub_4D72EC/**/(int a1/**/); int /*__usercall*/ sr_sub_4D73DF/**/(int a1/**/); signed int __fastcall SpawnRandomTreasure(struct MapInfo *a1, struct SpawnPointMM7 *a2); -bool __fastcall DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); +void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity); #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0) diff -r 038a4d09406f -r 9b77686e2239 stru6.cpp --- a/stru6.cpp Sat Feb 16 00:33:21 2013 +0400 +++ b/stru6.cpp Sat Feb 16 00:44:38 2013 +0400 @@ -1553,27 +1553,25 @@ pRenderer->pRenderD3D->pDevice->SetTexture( 0, pSprites_LOD->pHardwareSprites[v11].pTexture); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 8u); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS); pRenderer->pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, vd3d, 4, 28); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2), - "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\seffects.cpp:1348"); - ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1), - "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\seffects.cpp:1349"); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, true); - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE); + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS); } else {