# HG changeset patch # User Nomad # Date 1362581483 -7200 # Node ID 55d6b756e03a6f18c84cafc2eb7ce7d1deeadd2c # Parent badd65dff4e73dc0f9bb8acd965b40906864c6e7 Cave textures diff -r badd65dff4e7 -r 55d6b756e03a Indoor.cpp --- a/Indoor.cpp Wed Mar 06 16:14:21 2013 +0200 +++ b/Indoor.cpp Wed Mar 06 16:51:23 2013 +0200 @@ -527,8 +527,7 @@ stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist; } - if (stru_F8AD28.uNumLightsApplied > 0 && !pFace->uAttributes) - //!(pFace->uAttributes & 0x400000)) + if (stru_F8AD28.uNumLightsApplied > 0 && !(pFace->uAttributes & 0x400000)) pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); if (pDecalBuilder->uNumDecals > 0) @@ -557,17 +556,20 @@ v23 = pFace->uBitmapID; goto LABEL_42; } - else if (pFace->uAttributes)//(pFace->uAttributes & 0x4000) + else if (pFace->uAttributes & 0x4000) { v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); LABEL_42: v27 = pBitmaps_LOD->pHardwareTextures[v23]; - if (pFace->uAttributes & 0x400000) + if (pFace->uAttributes & FACE_DO_NOT_LIGHT) _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); else pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0); return; } + //v17 = 0xFFFFFFFF; + v23 = pFace->uBitmapID; + goto LABEL_42; } } } diff -r badd65dff4e7 -r 55d6b756e03a Indoor.h --- a/Indoor.h Wed Mar 06 16:14:21 2013 +0200 +++ b/Indoor.h Wed Mar 06 16:51:23 2013 +0200 @@ -257,6 +257,7 @@ #define FACE_TEXTURE_FRAME 0x00004000 // Texture ID is a frameset from TextureFrameTable, otherwise BitmapID #define FACE_OUTLINED 0x00010000 // outline face edges #define FACE_TEXTURE_FLOW 0x00040000 // The texture moves slowly. For horizontal facets only. +#define FACE_DO_NOT_LIGHT 0x00400000 #define FACE_CLICKABLE 0x02000000 // Event can be triggered by clicking on the facet. #define FACE_PRESSURE_PLATE 0x04000000 // Event can be triggered by stepping on the facet. #define FACE_ETHEREAL 0x20000000 // Untouchable. You can pass through it. diff -r badd65dff4e7 -r 55d6b756e03a LightmapBuilder.cpp --- a/LightmapBuilder.cpp Wed Mar 06 16:14:21 2013 +0200 +++ b/LightmapBuilder.cpp Wed Mar 06 16:51:23 2013 +0200 @@ -1621,7 +1621,7 @@ { //v30 = 0.0; //v4 = pRenderer->pRenderD3D->pDevice; - ErrD3D(v4->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); //v6 = (char *)stru_69BD44.c_str(); //if ( !stru_69BD44.c_str() ) // v6 = (char *)&dword_4D86F0; diff -r badd65dff4e7 -r 55d6b756e03a Render.cpp --- a/Render.cpp Wed Mar 06 16:14:21 2013 +0200 +++ b/Render.cpp Wed Mar 06 16:51:23 2013 +0200 @@ -7800,14 +7800,14 @@ double v17; // st6@10 //char v18; // zf@10 Texture *v19; // edx@10 - Texture *v23; // edx@16 - char *v24; // ecx@16 - char *v25; // eax@16 - double v26; // st6@17 - int v27; // esi@17 - double v28; // st6@17 - unsigned int v33; // ecx@18 - char *v34; // eax@19 + //Texture *v23; // edx@16 + //char *v24; // ecx@16 + //char *v25; // eax@16 + //double v26; // st6@17 + //int v27; // esi@17 + //double v28; // st6@17 + //unsigned int v33; // ecx@18 + //char *v34; // eax@19 //Texture *v45; // edx@23 //char *v46; // ecx@23 //char *v47; // eax@23 @@ -7908,36 +7908,47 @@ } else { - __debugbreak(); - if ( (signed int)uNumVertices > 0 ) - { - v23 = pTex; - v24 = (char *)&array_507D30[0].vWorldViewPosition; - v25 = (char *)&d3d_vertex_buffer[0].pos.y; - pTex = (Texture *)uNumVertices; - uint v18; - do - { - v26 = *(float *)v24 * 0.061758894; - v27 = *((int *)v24 + 3); - *((int *)v25 + 4) = 0; - *((int *)v25 - 1) = v27; - *(int *)v25 = *((int *)v24 + 4); - *((int *)v25 + 3) = uColor; - v25 += 32; - *((float *)v25 - 7) = 1.0 - 1.0 / v26; - v28 = 1.0 / *(float *)v24; - v24 += 48; - v18 = pTex == (Texture *)1; - pTex = (Texture *)((char *)pTex - 1); - *((float *)v25 - 6) = v28; + for (uint i = 0; i < uNumVertices; ++i) + { + d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; + d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; + d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); + d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; + d3d_vertex_buffer[i].diffuse = uColor; + d3d_vertex_buffer[i].specular = 0; + d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; + d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; + } + //__debugbreak(); + //if ( (signed int)uNumVertices > 0 ) + //{ + //v23 = pTex; + //v24 = (char *)&array_507D30[0].vWorldViewPosition; + //v25 = (char *)&d3d_vertex_buffer[0].pos.y; + //pTex = (Texture *)uNumVertices; + //uint v18; + //do + //{ + //v26 = *(float *)v24 * 0.061758894; + //v27 = *((int *)v24 + 3); + //*((int *)v25 + 4) = 0; + //*((int *)v25 - 1) = v27; + //*(int *)v25 = *((int *)v24 + 4); + //*((int *)v25 + 3) = uColor; + //v25 += 32; + //*((float *)v25 - 7) = 1.0 - 1.0 / v26; + //v28 = 1.0 / *(float *)v24; + //v24 += 48; + //v18 = pTex == (Texture *)1; + //pTex = (Texture *)((char *)pTex - 1); + //*((float *)v25 - 6) = v28; //a3 = (BLVFace *)v23->uTextureWidth; - *((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; + //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; //a3 = (BLVFace *)v23->uTextureHeight; - *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; - } - while ( !v18 ); - } + //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; + //} + //while ( !v18 ); + //} ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); @@ -7946,9 +7957,13 @@ d3d_vertex_buffer, uNumVertices, 28)); - ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); + + ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); - v33 = uNumVertices; + + for (uint i = 0; i < uNumVertices; ++i) + d3d_vertex_buffer[i].diffuse = uCorrectedColor; + /*v33 = uNumVertices; if ( (signed int)uNumVertices > 0 ) { v34 = (char *)&d3d_vertex_buffer[0].diffuse; @@ -7959,7 +7974,7 @@ --v33; } while ( v33 ); - } + }*/ ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); diff -r badd65dff4e7 -r 55d6b756e03a mm7_1.cpp --- a/mm7_1.cpp Wed Mar 06 16:14:21 2013 +0200 +++ b/mm7_1.cpp Wed Mar 06 16:51:23 2013 +0200 @@ -2511,8 +2511,8 @@ sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod); break; case EQUIP_POTION: - if ( inspect_item->uEncantmentType ) - sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEncantmentType); //"Power" + if ( inspect_item->uEnchantmentType ) + sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" break; case EQUIP_REAGENT: sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power" @@ -2522,10 +2522,10 @@ if ( !v77 ) { //v23 = item_desc->uEquipType; - if ( inspect_item->uEncantmentType ) + if ( inspect_item->uEnchantmentType ) { sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], - pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special" + pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special" } else if ( inspect_item->uSpecEnchantmentType ) { @@ -2565,7 +2565,7 @@ wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54; if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight ) wHintWindow.uFrameHeight = (unsigned int)Str; - if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) ) + if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight); v85 = 0; if ( pFontArrus->uFontHeight ) @@ -2633,7 +2633,7 @@ } else { - if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) ) + if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) { sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); strcpy(pTmpBuf, "Duration:"); @@ -4894,7 +4894,7 @@ { player = pPlayers[uActiveCharacter]; } - if(playerCanAct() || !pPlayers[uActiveCharacter]->CanAct()) + if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) player->PlaySound(SPEECH_NoRoom, 0); }