Mercurial > mm7
changeset 2274:90f56da08d76
small cleaning
author | Ritor1 |
---|---|
date | Fri, 14 Mar 2014 09:32:25 +0600 |
parents | 8878fba164fd |
children | 8193a64c7461 |
files | DecorationList.cpp LightmapBuilder.cpp Overlays.cpp Render.cpp |
diffstat | 4 files changed, 101 insertions(+), 121 deletions(-) [+] |
line wrap: on
line diff
--- a/DecorationList.cpp Thu Feb 27 00:36:31 2014 +0100 +++ b/DecorationList.cpp Fri Mar 14 09:32:25 2014 +0600 @@ -47,13 +47,13 @@ FILE *v6; // ST18_4@12 char *i; // eax@12 unsigned __int16 v8; // ax@16 - const char *v9; // ST20_4@16 - const char *v10; // ST18_4@16 - __int16 v11; // ax@16 - const char *v12; // ST14_4@16 - unsigned __int16 v13; // ax@16 + //const char *v9; // ST20_4@16 + //const char *v10; // ST18_4@16 + //__int16 v11; // ax@16 + //const char *v12; // ST14_4@16 + //unsigned __int16 v13; // ax@16 const char *v14; // ST10_4@16 - __int16 v15; // ax@16 + //__int16 v15; // ax@16 const char *v16; // ST0C_4@16 unsigned __int8 v17; // al@16 const char *v18; // ST08_4@16 @@ -120,30 +120,30 @@ { strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); - v9 = v42.pProperties[2]; + //v9 = v42.pProperties[2]; v2->pDecorations[v2->uNumDecorations].uSpriteID = v8; - strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v9); - v10 = v42.pProperties[3]; + strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v42.pProperties[2]); + //v10 = v42.pProperties[3]; v2->pDecorations[v2->uNumDecorations].uType = 0; - v11 = atoi(v10); - v12 = v42.pProperties[4]; - v2->pDecorations[v2->uNumDecorations].uRadius = v11; - v13 = atoi(v12); - v14 = v42.pProperties[5]; - v2->pDecorations[v2->uNumDecorations].uDecorationHeight = v13; - v15 = atoi(v14); - v16 = v42.pProperties[6]; - v2->pDecorations[v2->uNumDecorations].uLightRadius = v15; - v17 = atoi(v16); - v18 = v42.pProperties[7]; - v2->pDecorations[v2->uNumDecorations].uColoredLightRed = v17; - v19 = atoi(v18); - v20 = v42.pProperties[8]; - v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19; - v21 = atoi(v20); - v22 = v42.pProperties[9]; - v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; - v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); + //v11 = atoi(v42.pProperties[3]); + //v12 = v42.pProperties[4]; + v2->pDecorations[v2->uNumDecorations].uRadius = atoi(v42.pProperties[3]); + //v13 = atoi(v42.pProperties[4]); + //v14 = v42.pProperties[5]; + v2->pDecorations[v2->uNumDecorations].uDecorationHeight = atoi(v42.pProperties[4]); + //v15 = atoi(v42.pProperties[5]); + //v16 = v42.pProperties[6]; + v2->pDecorations[v2->uNumDecorations].uLightRadius = atoi(v42.pProperties[5]); + //v17 = atoi(v42.pProperties[6]); + //v18 = v42.pProperties[7]; + v2->pDecorations[v2->uNumDecorations].uColoredLightRed = atoi(v42.pProperties[6]); + //v19 = atoi(v42.pProperties[7]); + //v20 = v42.pProperties[8]; + v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = atoi(v42.pProperties[7]); + //v21 = atoi(v42.pProperties[8]); + //v22 = v42.pProperties[9]; + v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = atoi(v42.pProperties[8]); + v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v42.pProperties[9]); v25 = __OFSUB__(v42.uPropCount, 10); v23 = v42.uPropCount == 10; v24 = v42.uPropCount - 10 < 0;
--- a/LightmapBuilder.cpp Thu Feb 27 00:36:31 2014 +0100 +++ b/LightmapBuilder.cpp Fri Mar 14 09:32:25 2014 +0600 @@ -856,7 +856,7 @@ { if ( pSlot >= 20 ) break; - ApplyLight_ODM(pStationaryLightsStack[i].pLights, pFace, (unsigned int *)&pSlot, 0); + ApplyLight_ODM(&pStationaryLightsStack->pLights[i], pFace, (unsigned int *)&pSlot, 0); } result = pSlot; stru_F8AD28.uNumLightsApplied = pSlot; @@ -1088,7 +1088,7 @@ pLight = (StationaryLight *)LODWORD(a1[1].vWorldPosition.x); v12 = a1[2].vWorldPosition.x; } - uStripType = LODWORD(v12); + //uStripType = LODWORD(v12); a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); v13 = v11->vWorldPosition.y; LABEL_5: @@ -1096,7 +1096,7 @@ LABEL_11: //v60 = v10; v59 = (const char *)v11; - v60 = uStripType; + v60 = v12;//uStripType; minz = pGame->pIndoorCameraD3D->GetPolygonMinZ(v11, uStripType); maxz = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v11, uStripType); result = v8->vPosition.x; @@ -1173,13 +1173,13 @@ stru_F8AD28._blv_lights_xs[*v53] = v8->vPosition.x; stru_F8AD28._blv_lights_ys[*v53] = v8->vPosition.y; stru_F8AD28._blv_lights_zs[*v53] = v8->vPosition.z; - a3 = (float *)v8->uLightColorR; - stru_F8AD28._blv_lights_rs[*v53] = (double)(signed int)a3 * 0.003921568859368563; - a3 = (float *)v8->uLightColorG; - stru_F8AD28._blv_lights_gs[*v53] = (double)(signed int)a3 * 0.003921568859368563; - a3 = (float *)v8->uLightColorB; - stru_F8AD28._blv_lights_bs[*v53] = (double)(signed int)a3 * 0.003921568859368563; - v54 = abs(v60); + //a3 = (float *)v8->uLightColorR; + stru_F8AD28._blv_lights_rs[*v53] = v8->uLightColorR / 255.0f; + //a3 = (float *)v8->uLightColorG; + stru_F8AD28._blv_lights_gs[*v53] = v8->uLightColorG / 255.0f; + //a3 = (float *)v8->uLightColorB; + stru_F8AD28._blv_lights_bs[*v53] = v8->uLightColorB / 255.0f; + v54 = abs(v63); v55 = pRenderer->bUsingSpecular; stru_F8AD28._blv_lights_light_dot_faces[*v53] = v54; stru_F8AD28._blv_lights_types[*v53] = v8->uLightType; @@ -1193,12 +1193,9 @@ { if ( stru_F8AD28._blv_lights_types[*v53] & 4 ) { - *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result) - * 0.3300000131130219; - *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result) - * 0.3300000131130219; - *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result) - * 0.3300000131130219; + stru_F8AD28._blv_lights_rs[result] = stru_F8AD28._blv_lights_rs[result] * 0.3300000131130219; + stru_F8AD28._blv_lights_gs[result] = stru_F8AD28._blv_lights_gs[result] * 0.3300000131130219; + stru_F8AD28._blv_lights_bs[result] = stru_F8AD28._blv_lights_bs[result] * 0.3300000131130219; } } ++*v53;
--- a/Overlays.cpp Thu Feb 27 00:36:31 2014 +0100 +++ b/Overlays.cpp Fri Mar 14 09:32:25 2014 +0600 @@ -43,54 +43,37 @@ //----- (004418B6) -------------------------------------------------------- int OtherOverlayList::_4418B6(int uOverlayID, __int16 a3, int a4, int a5, __int16 a6) { - signed int v6; // edx@1 - OtherOverlayList *v7; // eax@1 - //signed int result; // eax@4 signed int v9; // esi@6 - __int16 v10; // dx@9 __int16 v11; // dx@11 - v6 = 0; - v7 = this; - while ( v7->pOverlays[0].field_6 > 0 ) - { - ++v6; - v7 = (OtherOverlayList *)((char *)v7 + 20); - if ( v6 >= 50 ) - return 0; - } - v7->pOverlays[0].field_0 = 0; - v7->pOverlays[0].field_A = 0; - v7->pOverlays[0].field_8 = 0; - v7->pOverlays[0].field_C = a3; - v9 = 0; - if ( (signed int)pOverlayList->uNumOverlays <= 0 ) - { -LABEL_9: - v10 = 0; - } - else + for ( uint i = 0; i < 50; ++i ) { - while ( uOverlayID != pOverlayList->pOverlays[v9].uOverlayID ) + if ( this->pOverlays[i].field_6 <= 0 ) { - ++v9; - if ( v9 >= (signed int)pOverlayList->uNumOverlays ) - goto LABEL_9; + this->pOverlays[i].field_0 = 0; + this->pOverlays[i].field_A = 0; + this->pOverlays[i].field_8 = 0; + this->pOverlays[i].field_C = a3; + v9 = 0; + for ( v9; v9 < (signed int)pOverlayList->uNumOverlays; ++v9 ) + { + if ( uOverlayID == pOverlayList->pOverlays[v9].uOverlayID ) + break; + } + this->pOverlays[i].field_2 = v9; + this->pOverlays[i].field_4 = 0; + if ( a4 ) + v11 = a4; + else + v11 = 8 * pSpriteFrameTable->pSpriteSFrames[pOverlayList->pOverlays[v9].uSpriteFramesetID].uAnimLength; + this->pOverlays[i].field_6 = v11; + this->pOverlays[i].field_10 = a5; + this->pOverlays[i].field_E = a6; + bRedraw = true; + return true; } - v10 = v9; } - v7->pOverlays[0].field_2 = v10; - v7->pOverlays[0].field_4 = 0; - if ( a4 ) - v11 = a4; - else - v11 = 8 * pSpriteFrameTable->pSpriteSFrames[pOverlayList->pOverlays[v10].uSpriteFramesetID].uAnimLength; - v7->pOverlays[0].field_6 = v11; - v7->pOverlays[0].field_10 = a5; - v7->pOverlays[0].field_E = a6; - - bRedraw = true; - return true; + return 0; } //----- (00441964) -------------------------------------------------------- @@ -176,7 +159,7 @@ FILE *v4; // eax@1 unsigned int v5; // esi@3 void *v7; // eax@9 - FILE *v8; // ST0C_4@11 + //FILE *v8; // ST0C_4@11 char *i; // eax@11 char Buf; // [sp+10h] [bp-2F0h]@3 FrameTableTxtLine v18; // [sp+204h] [bp-FCh]@4 @@ -215,9 +198,9 @@ Error("OverlayDescriptionList::load - Out of Memory!"); memset(v7, v3, 8 * this->uNumOverlays); - v8 = File; + //v8 = File; this->uNumOverlays = v3; - fseek(v8, v3, v3); + fseek(File, v3, v3); for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) { *strchr(&Buf, 10) = 0; @@ -234,8 +217,7 @@ } else this->pOverlays[this->uNumOverlays].uOverlayType = 0; - this->pOverlays[this->uNumOverlays++].uSpriteFramesetID = pSpriteFrameTable->FastFindSprite( - (char *)v19.pProperties[2]); + this->pOverlays[this->uNumOverlays++].uSpriteFramesetID = pSpriteFrameTable->FastFindSprite((char *)v19.pProperties[2]); } } fclose(File);
--- a/Render.cpp Thu Feb 27 00:36:31 2014 +0100 +++ b/Render.cpp Fri Mar 14 09:32:25 2014 +0600 @@ -322,11 +322,11 @@ (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); - //if ( norm_idx < 0 || norm_idx > uNumTerrainNormals - 1 ) - //norm = 0; - //else - //norm = &pTerrainNormals[norm_idx]; - //pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &a3a, array_50AC10, 4, 1); + if ( norm_idx < 0 || norm_idx > uNumTerrainNormals - 1 ) + norm = 0; + else + norm = &pTerrainNormals[norm_idx]; + //pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &a3a, array_50AC10, 4, 1);//Ritor1: slows //pDecalBuilder->_49BE8A(pTilePolygon, norm, &a3a, array_50AC10, 4, 1); //----------------------------------------------------------------------------------------------- @@ -871,16 +871,17 @@ for (int i = 0; i < uNumLevelDecorations; ++i) { - LevelDecoration* decor = &pLevelDecorations[i]; - if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) - { - DecorationDesc* decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; + //LevelDecoration* decor = &pLevelDecorations[i]; + if ((!(pLevelDecorations[i].uFlags & LEVEL_DECORATION_OBELISK_CHEST) + || pLevelDecorations[i].IsObeliskChestActive()) && !(pLevelDecorations[i].uFlags & LEVEL_DECORATION_INVISIBLE)) + { + DecorationDesc* decor_desc = &pDecorationList->pDecorations[pLevelDecorations[i].uDecorationDescID]; if ( (char)decor_desc->uFlags >= 0 ) { if ( !(decor_desc->uFlags & 0x22) ) { v6 = pMiscTimer->uTotalGameTimeElapsed; - v7 = abs(decor->vPosition.x + decor->vPosition.y); + v7 = abs(pLevelDecorations[i].vPosition.x + pLevelDecorations[i].vPosition.y); #pragma region "New: seasons change" extern bool change_seasons; @@ -949,10 +950,10 @@ #pragma endregion //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, - decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + v10 = (unsigned __int16 *)stru_5C6E00->Atan2(pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, + pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); v38 = 0; - v13 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + decor->field_10_y_rot - (signed int)v10) >> 8) & 7; + v13 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + pLevelDecorations[i].field_10_y_rot - (signed int)v10) >> 8) & 7; v37 = (unsigned __int16 *)v13; if ( v8->uFlags & 2 ) v38 = 2; @@ -976,21 +977,21 @@ v14 = 255; v15 = 255; } - pStationaryLightsStack->AddLight(decor->vPosition.x, decor->vPosition.y, decor->vPosition.z + decor_desc->uDecorationHeight / 2, + pStationaryLightsStack->AddLight(pLevelDecorations[i].vPosition.x, pLevelDecorations[i].vPosition.y, pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, v8->uGlowRadius, v14, v15, v16, _4E94D0_light_type); } - v17 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + v17 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; if (pGame->pIndoorCameraD3D->sRotationX) { - v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; + v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; v18 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); - v41 = fixpoint_mul((decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); + v41 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); v19 = fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_cosine_x); - v20 = v19 + fixpoint_mul((decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); + v20 = v19 + fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { v21 = fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_sine_y); - v22 = fixpoint_mul((decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_x); + v22 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_x); if ( 2 * abs(v20) >= abs(v21) ) { LODWORD(v24) = 0; @@ -1014,9 +1015,9 @@ HIBYTE(v29) |= 2; pBillboardRenderList[::uNumBillboardsToDraw].uPalette = v8->uPaletteIndex; pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v29; - pBillboardRenderList[::uNumBillboardsToDraw].world_x = decor->vPosition.x; - pBillboardRenderList[::uNumBillboardsToDraw].world_y = decor->vPosition.y; - pBillboardRenderList[::uNumBillboardsToDraw].world_z = decor->vPosition.z; + pBillboardRenderList[::uNumBillboardsToDraw].world_x = pLevelDecorations[i].vPosition.x; + pBillboardRenderList[::uNumBillboardsToDraw].world_y = pLevelDecorations[i].vPosition.y; + pBillboardRenderList[::uNumBillboardsToDraw].world_z = pLevelDecorations[i].vPosition.z; pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceY = v40; HIWORD(v30) = HIWORD(v20); v31 = PID(OBJECT_Decoration,i); @@ -1035,13 +1036,13 @@ } else { - v42 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; - v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; + v42 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; + v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; v20 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) { v21 = fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v42, pGame->pIndoorCameraD3D->int_sine_y); - v22 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + v22 = (pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; v42 = v22; if ( 2 * abs(v20) >= abs(v21) ) { @@ -1066,9 +1067,9 @@ HIBYTE(v29) |= 2; pBillboardRenderList[::uNumBillboardsToDraw].uPalette = v8->uPaletteIndex; pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v29; - pBillboardRenderList[::uNumBillboardsToDraw].world_x = decor->vPosition.x; - pBillboardRenderList[::uNumBillboardsToDraw].world_y = decor->vPosition.y; - pBillboardRenderList[::uNumBillboardsToDraw].world_z = decor->vPosition.z; + pBillboardRenderList[::uNumBillboardsToDraw].world_x = pLevelDecorations[i].vPosition.x; + pBillboardRenderList[::uNumBillboardsToDraw].world_y = pLevelDecorations[i].vPosition.y; + pBillboardRenderList[::uNumBillboardsToDraw].world_z = pLevelDecorations[i].vPosition.z; pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceY = v40; HIWORD(v30) = HIWORD(v20); v31 = PID(OBJECT_Decoration,i); @@ -1092,9 +1093,9 @@ memset(&local_0, 0, 0x68); local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; local_0.uDiffuse = 0xFF3C1E; - local_0.x = (double)decor->vPosition.x; - local_0.y = (double)decor->vPosition.y; - local_0.z = (double)decor->vPosition.z; + local_0.x = (double)pLevelDecorations[i].vPosition.x; + local_0.y = (double)pLevelDecorations[i].vPosition.y; + local_0.z = (double)pLevelDecorations[i].vPosition.z; local_0.r = 0.0; local_0.g = 0.0; local_0.b = 0.0;