diff --git a/src/atmos.c b/src/atmos.c index 4314f4acb..3668f6209 100644 --- a/src/atmos.c +++ b/src/atmos.c @@ -329,7 +329,6 @@ UDWORD i; void renderParticle( ATPART *psPart ) { Vector3i dv; - PIELIGHT brightness; SDWORD centreX, centreZ; SDWORD x, y, z, rx, rz; @@ -353,8 +352,7 @@ void renderParticle( ATPART *psPart ) /* Draw it... */ centreX = player.p.x + world_coord(visibleTiles.x / 2); centreZ = player.p.z + world_coord(visibleTiles.y / 2); - brightness = lightDoFogAndIllumination(WZCOL_WHITE, centreX - x, centreZ - z, NULL); - pie_Draw3DShape(psPart->imd, 0, 0, brightness, WZCOL_BLACK, pie_NO_BILINEAR, 0); + pie_Draw3DShape(psPart->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_NO_BILINEAR, 0); iV_MatrixEnd(); } diff --git a/src/component.c b/src/component.c index 02011adf7..53d865a44 100644 --- a/src/component.c +++ b/src/component.c @@ -839,7 +839,8 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton) PROPULSION_STATS *psPropStats; SDWORD frame; SDWORD pieFlag, iPieData; - PIELIGHT brightness, specular; + PIELIGHT brightness; + const PIELIGHT specular = WZCOL_BLACK; UDWORD colour; UDWORD bDarkSide = FALSE; UBYTE i; @@ -868,13 +869,12 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton) if(!bButton) { - brightness = lightDoFogAndIllumination(pal_SetBrightness(psDroid->illumination), getCentreX() - psDroid->x,getCentreZ() - psDroid->y, &specular); + brightness = pal_SetBrightness(psDroid->illumination); pieFlag = pie_SHADOW; } else { brightness = WZCOL_WHITE; - specular = WZCOL_BLACK; } /* We've got a z value here _and_ screen coords of origin */ diff --git a/src/display3d.c b/src/display3d.c index 4e12a2dba..3263d81f0 100644 --- a/src/display3d.c +++ b/src/display3d.c @@ -634,7 +634,8 @@ static void drawTiles(iView *camera, iView *player) TileIllum = pal_SetBrightness(psTile->illumination); } - tileScreenInfo[i][j].light = lightDoFogAndIllumination(TileIllum, rx - tileScreenInfo[i][j].pos.x, rz - world_coord(i - terrainMidY), &tileScreenInfo[i][j].specular); + tileScreenInfo[i][j].light = TileIllum; + tileScreenInfo[i][j].specular = WZCOL_BLACK; // Real fog of war - darken where we cannot see enemy units moving around if (bDisplaySensorRange && psTile && !psTile->activeSensor) @@ -700,8 +701,7 @@ static void drawTiles(iView *camera, iView *player) tileScreenInfo[i][j].water_height = tileScreenInfo[i][j].pos.y; // Calc the light for modified y coord and ignore the specular component - tileScreenInfo[i][j].wlight = lightDoFogAndIllumination(TileIllum, rx - tileScreenInfo[i][j].pos.x, rz - world_coord(i - terrainMidY), NULL); - + tileScreenInfo[i][j].wlight = TileIllum; tileScreenInfo[i][j].pos.y = tmp_y; } else @@ -1132,7 +1132,6 @@ void renderProjectile(PROJECTILE *psCurr) WEAPON_STATS *psStats; Vector3i dv; iIMDShape *pIMD; - PIELIGHT brightness, specular; SDWORD rx, rz; psStats = psCurr->psWStats; @@ -1183,15 +1182,14 @@ void renderProjectile(PROJECTILE *psCurr) imdRot2.x = DEG(psCurr->pitch); iV_MatrixRotateX(imdRot2.x); - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - psCurr->x, getCentreZ() - psCurr->y, &specular); - if(psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE || - psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) + if (psStats->weaponSubClass == WSC_ROCKET || psStats->weaponSubClass == WSC_MISSILE + || psStats->weaponSubClass == WSC_SLOWROCKET || psStats->weaponSubClass == WSC_SLOWMISSILE) { - pie_Draw3DShape(pIMD, 0, 0, brightness, WZCOL_BLACK, pie_ADDITIVE, 164); + pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, 164); } else { - pie_Draw3DShape(pIMD, 0, 0, brightness, specular, pie_NO_BILINEAR, 0); + pie_Draw3DShape(pIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_NO_BILINEAR, 0); } iV_MatrixEnd(); @@ -1226,7 +1224,7 @@ renderAnimComponent( const COMPONENT_OBJECT *psObj ) terrainMidY * TILE_UNITS - (psParentObj->y - player.p.z) }; SDWORD iPlayer; - PIELIGHT brightness, specular; + PIELIGHT brightness; psParentObj->sDisplay.frameNumber = currentGameFrame; @@ -1305,9 +1303,7 @@ renderAnimComponent( const COMPONENT_OBJECT *psObj ) brightness = pal_SetBrightness(avGetObjLightLevel((BASE_OBJECT*)psParentObj, brightness.byte.r)); } - brightness = lightDoFogAndIllumination(brightness, getCentreX() - posX, getCentreZ() - posY, &specular); - - pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, specular, pie_NO_BILINEAR|pie_STATIC_SHADOW, 0); + pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, WZCOL_BLACK, pie_NO_BILINEAR|pie_STATIC_SHADOW, 0); /* clear stack */ iV_MatrixEnd(); @@ -1606,7 +1602,7 @@ void renderFeature(FEATURE *psFeature) { UDWORD featX,featY; SDWORD rotation, rx, rz; - PIELIGHT brightness, specular; + PIELIGHT brightness; Vector3i dv; Vector3f *vecTemp; BOOL bForceDraw = ( !getRevealStatus() && psFeature->psStats->visibleAtStart); @@ -1661,8 +1657,6 @@ void renderFeature(FEATURE *psFeature) brightness = pal_SetBrightness(avGetObjLightLevel((BASE_OBJECT*)psFeature, brightness.byte.r)); } - brightness = lightDoFogAndIllumination(brightness, getCentreX() - featX, getCentreZ() - featY, &specular); - if (psFeature->psStats->subType == FEAT_BUILDING || psFeature->psStats->subType == FEAT_SKYSCRAPER || psFeature->psStats->subType == FEAT_OIL_DRUM) { @@ -1675,12 +1669,12 @@ void renderFeature(FEATURE *psFeature) vecTemp = psFeature->sDisplay.imd->points; flattenImd(psFeature->sDisplay.imd, psFeature->x, psFeature->y, 0); /* currentGameFrame/2 set anim running - GJ hack */ - pie_Draw3DShape(psFeature->sDisplay.imd, currentGameFrame/2, 0, brightness, specular, 0, 0); + pie_Draw3DShape(psFeature->sDisplay.imd, currentGameFrame/2, 0, brightness, WZCOL_BLACK, 0, 0); psFeature->sDisplay.imd->points = vecTemp; } else { - pie_Draw3DShape(psFeature->sDisplay.imd, 0, 0, brightness, specular, shadowFlags,0); + pie_Draw3DShape(psFeature->sDisplay.imd, 0, 0, brightness, WZCOL_BLACK, shadowFlags,0); } { @@ -1705,7 +1699,6 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) VIEW_PROXIMITY *pViewProximity = NULL; SDWORD x, y, r, rx, rz; iIMDShape *proxImd = NULL; - PIELIGHT brightness, specular; //store the frame number for when deciding what has been clicked on psProxDisp->frameNumber = currentGameFrame; @@ -1742,7 +1735,6 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) { ASSERT(!"unknown proximity display message type", "Buggered proximity message type"); } - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - msgX, getCentreZ() - msgY, &specular); dv.x = (msgX - player.p.x) - terrainMidX*TILE_UNITS; dv.z = terrainMidY*TILE_UNITS - (msgY - player.p.z); @@ -1801,11 +1793,11 @@ void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp) if(!gamePaused()) { - pie_Draw3DShape(proxImd, getTimeValueRange(1000,4), 0, brightness, specular, pie_ADDITIVE, 192); + pie_Draw3DShape(proxImd, getTimeValueRange(1000,4), 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, 192); } else { - pie_Draw3DShape(proxImd, 0, 0, brightness, specular, pie_ADDITIVE, 192); + pie_Draw3DShape(proxImd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, 192); } //get the screen coords for determining when clicked on @@ -1828,7 +1820,7 @@ void renderStructure(STRUCTURE *psStructure) SDWORD playerFrame; SDWORD animFrame; UDWORD nWeaponStat; - PIELIGHT buildingBrightness, specular; + PIELIGHT buildingBrightness, specular = WZCOL_BLACK; Vector3i dv; SDWORD i; iIMDShape *lImd = NULL, *imd = NULL; @@ -1974,7 +1966,6 @@ void renderStructure(STRUCTURE *psStructure) { buildingBrightness = pal_SetBrightness(avGetObjLightLevel((BASE_OBJECT*)psStructure, buildingBrightness.byte.r)); } - buildingBrightness = lightDoFogAndIllumination(buildingBrightness, getCentreX() - psStructure->x, getCentreZ() - psStructure->y, &specular); if (!defensive) { @@ -1983,7 +1974,7 @@ void renderStructure(STRUCTURE *psStructure) if (baseImd != NULL) { - pie_Draw3DShape(baseImd, 0, 0, buildingBrightness, specular, 0,0); + pie_Draw3DShape(baseImd, 0, 0, buildingBrightness, WZCOL_BLACK, 0,0); } // override @@ -2264,7 +2255,6 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition) Vector3i dv; SDWORD x, y, r, rx, rz; Vector3f *temp = NULL; - PIELIGHT buildingBrightness, specular; //store the frame number for when deciding what has been clicked on psPosition->frameNumber = currentGameFrame; @@ -2296,9 +2286,7 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition) pie_MatScale(50); // they are all big now so make this one smaller too - buildingBrightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - psPosition->coords.x, getCentreZ() - psPosition->coords.y, &specular); - - pie_Draw3DShape(pAssemblyPointIMDs[psPosition->factoryType][psPosition->factoryInc], 0, 0, buildingBrightness, specular, pie_NO_BILINEAR, 0); + pie_Draw3DShape(pAssemblyPointIMDs[psPosition->factoryType][psPosition->factoryInc], 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_NO_BILINEAR, 0); if(!psPosition->selected) { @@ -2317,7 +2305,7 @@ void renderDeliveryPoint(FLAG_POSITION *psPosition) static BOOL renderWallSection(STRUCTURE *psStructure) { SDWORD structX, structY, rx, rz; - PIELIGHT brightness, specular, buildingBrightness; + PIELIGHT brightness, specular = WZCOL_BLACK, buildingBrightness; iIMDShape *imd; SDWORD rotation; Vector3i dv; @@ -2331,8 +2319,6 @@ static BOOL renderWallSection(STRUCTURE *psStructure) /* Get it's x and y coordinates so we don't have to deref. struct later */ structX = psStructure->x; structY = psStructure->y; -// centreX = ( player.p.x + world_coord(visibleTiles.x / 2) ); -// centreZ = ( player.p.z + world_coord(visibleTiles.y / 2) ); buildingBrightness = pal_SetBrightness(200 - (100 - PERCENT(psStructure->body, structureBody(psStructure)))); if(psStructure->selected) @@ -2362,7 +2348,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure) buildingBrightness = pal_SetBrightness(avGetObjLightLevel((BASE_OBJECT*)psStructure, buildingBrightness.byte.r)); } - brightness = lightDoFogAndIllumination(buildingBrightness, getCentreX() - structX, getCentreZ() - structY, &specular); + brightness = buildingBrightness; /* Right, now the tricky bit, we need to bugger about with the coordinates of the imd to make it @@ -2482,7 +2468,6 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD ) Vector3i dv; Vector3f *pVecTemp; SDWORD shadowScale, rx, rz; - PIELIGHT brightness, specular; dv.x = (psDroid->x - player.p.x) - terrainMidX*TILE_UNITS; if(psDroid->droidType == DROID_TRANSPORTER) @@ -2523,9 +2508,7 @@ void renderShadow( DROID *psDroid, iIMDShape *psShadowIMD ) pie_MatRotZ( DEG( psDroid->roll ) ); } - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - psDroid->x, getCentreZ() - psDroid->y, &specular); - - pie_Draw3DShape(psShadowIMD, 0, 0, brightness, specular, pie_TRANSLUCENT, 128); + pie_Draw3DShape(psShadowIMD, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, 128); psShadowIMD->points = pVecTemp; iV_MatrixEnd(); @@ -4625,7 +4608,7 @@ static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure) SDWORD realY; Vector3i null, vec; SDWORD rx,rz; - PIELIGHT colour, specular; + PIELIGHT colour; null.x = null.y = null.z = 0; each.x = psDroid->x; @@ -4686,7 +4669,6 @@ static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure) // set the colour colour = pal_SetBrightness(UBYTE_MAX); - colour = lightDoFogAndIllumination(colour, getCentreX() - psDroid->x, getCentreZ() - psDroid->y, &specular); if (psDroid->action == DACTION_DEMOLISH || psDroid->action == DACTION_CLEARWRECK) { diff --git a/src/effects.c b/src/effects.c index 632080bf7..5afb7d795 100644 --- a/src/effects.c +++ b/src/effects.c @@ -1600,22 +1600,15 @@ void renderEffect(EFFECT *psEffect) /* drawing func for wapypoints . AJL. */ void renderWaypointEffect(EFFECT *psEffect) { - PIELIGHT brightness, specular; - positionEffect(psEffect); - // set up lighting - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - - pie_Draw3DShape(psEffect->imd, 0, 0, brightness, specular, 0, 0); + pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); iV_MatrixEnd(); } // ---------------------------------------------------------------------------------------- void renderFirework(EFFECT *psEffect) { - PIELIGHT brightness, specular; - /* these don't get rendered */ if(psEffect->type == FIREWORK_TYPE_LAUNCHER) { @@ -1627,10 +1620,8 @@ void renderFirework(EFFECT *psEffect) iV_MatrixRotateY(-player.r.y); iV_MatrixRotateX(-player.r.x); - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - pie_MatScale(psEffect->size); - pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE); + pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, EFFECT_EXPLOSION_ADDITIVE); iV_MatrixEnd(); } @@ -1638,18 +1629,13 @@ void renderFirework(EFFECT *psEffect) /* drawing func for blood. */ void renderBloodEffect(EFFECT *psEffect) { - PIELIGHT brightness, specular; - positionEffect(psEffect); iV_MatrixRotateY(-player.r.y); iV_MatrixRotateX(-player.r.x); pie_MatScale(psEffect->size); - // set up lighting - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - - pie_Draw3DShape(getImdFromIndex(MI_BLOOD), psEffect->frameNumber, 0, brightness, specular, pie_TRANSLUCENT, EFFECT_BLOOD_TRANSPARENCY); + pie_Draw3DShape(getImdFromIndex(MI_BLOOD), psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, EFFECT_BLOOD_TRANSPARENCY); iV_MatrixEnd(); } @@ -1658,7 +1644,6 @@ void renderDestructionEffect(EFFECT *psEffect) { float div; SDWORD percent; - PIELIGHT brightness,specular; if(psEffect->type!=DESTRUCTION_TYPE_SKYSCRAPER) { @@ -1674,16 +1659,13 @@ void renderDestructionEffect(EFFECT *psEffect) percent = (SDWORD)(div*pie_RAISE_SCALE); } - //get fog value - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - if(!gamePaused()) { iV_MatrixRotateX(SKY_SHIMMY); iV_MatrixRotateY(SKY_SHIMMY); iV_MatrixRotateZ(SKY_SHIMMY); } - pie_Draw3DShape(psEffect->imd, 0, 0, brightness, WZCOL_BLACK, pie_RAISE, percent); + pie_Draw3DShape(psEffect->imd, 0, 0, WZCOL_WHITE, WZCOL_BLACK, pie_RAISE, percent); iV_MatrixEnd(); } @@ -1721,7 +1703,7 @@ UDWORD timeSlice; void renderExplosionEffect(EFFECT *psEffect) { SDWORD percent; - PIELIGHT brightness, specular; + const PIELIGHT brightness = WZCOL_WHITE; if(psEffect->type == EXPLOSION_TYPE_LAND_LIGHT) { @@ -1758,8 +1740,6 @@ void renderExplosionEffect(EFFECT *psEffect) { pie_MatScale(psEffect->size); } - //get fog value - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); if(psEffect->type == EXPLOSION_TYPE_PLASMA) { @@ -1780,7 +1760,6 @@ void renderExplosionEffect(EFFECT *psEffect) // ---------------------------------------------------------------------------------------- void renderGravitonEffect(EFFECT *psEffect) { - PIELIGHT brightness, specular; positionEffect(psEffect); @@ -1798,10 +1777,8 @@ void renderGravitonEffect(EFFECT *psEffect) { pie_MatScale(100); } - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), - getCentreZ() - MAKEINT(psEffect->position.z), &specular); - pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, specular, 0, 0); + pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0); /* Pop the matrix */ iV_MatrixEnd(); @@ -1817,7 +1794,6 @@ void renderConstructionEffect(EFFECT *psEffect) SDWORD percent; UDWORD translucency; UDWORD size; - PIELIGHT brightness, specular; /* No rotation about arbitrary axis */ null.x = null.y = null.z = 0; @@ -1850,10 +1826,7 @@ void renderConstructionEffect(EFFECT *psEffect) if(size>90) size = 90; pie_MatScale(size); - // set up lighting - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - - pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, brightness, specular, pie_TRANSLUCENT, (UBYTE)(translucency)); + pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, pie_TRANSLUCENT, (UBYTE)(translucency)); /* Pop the matrix */ iV_MatrixEnd(); @@ -1868,7 +1841,8 @@ void renderSmokeEffect(EFFECT *psEffect) { UDWORD percent; UDWORD transparency = 0; - PIELIGHT brightness, specular; + const PIELIGHT brightness = WZCOL_WHITE; + const PIELIGHT specular = WZCOL_BLACK; positionEffect(psEffect); @@ -1904,9 +1878,6 @@ void renderSmokeEffect(EFFECT *psEffect) #endif } - // set up lighting - brightness = lightDoFogAndIllumination(WZCOL_WHITE, getCentreX() - MAKEINT(psEffect->position.x), getCentreZ() - MAKEINT(psEffect->position.z), &specular); - transparency = (transparency * 3) / 2; //JPS smoke strength increased for d3d 12 may 99 /* Make imds be transparent on 3dfx */ diff --git a/src/lighting.c b/src/lighting.c index fd1f7dedc..a8e43747f 100644 --- a/src/lighting.c +++ b/src/lighting.c @@ -513,130 +513,6 @@ float fraction,adjust; psDroid->illumination = (UBYTE)retVal; } - -PIELIGHT lightDoFogAndIllumination(PIELIGHT brightness, SDWORD dx, SDWORD dz, PIELIGHT *pSpecular) -{ - SDWORD umbraRadius; // Distance to start of light falloff - SDWORD penumbraRadius; // radius of area of obscurity - SDWORD umbra; - SDWORD distance = sqrtf(dx*dx + dz*dz); - SDWORD cosA,sinA; - PIELIGHT lighting, specular, fogColour; - SDWORD depth = 0; - SDWORD colour; - SDWORD fog = 0; - - penumbraRadius = world_coord(visibleTiles.x / 2); - - umbraRadius = penumbraRadius - UMBRA_RADIUS; - - if(distance < umbraRadius) - { - umbra = 255; - } - else if (distance > penumbraRadius) - { - umbra = 0; - } - else - { - umbra = 255 - (((distance-umbraRadius)*255)/(UMBRA_RADIUS)); - } - - if ((distance) < 32) - { - depth = 1; - } - - - if ((fogStatus & FOG_DISTANCE) || (fogStatus & FOG_BACKGROUND)) - { - //add fog - if (pie_GetFogEnabled()) - { - cosA = COS(player.r.y); - sinA = SIN(player.r.y); - depth = sinA * dx + cosA * dz; - depth >>= FP12_SHIFT; - depth += FOG_START; - depth /= FOG_RATE; - } - } - - if (fogStatus & FOG_DISTANCE) - { - //add fog - if (pie_GetFogEnabled()) - { - if (!(fogStatus & FOG_BACKGROUND))//black penumbra so fade fog effect - { - fog = depth - (255 - umbra); - } - else - { - fog = depth; - } - if (fog < 0) - { - fog = 0; - } - else if (fog > 255) - { - fog = 255; - } - } - } - - if ((fogStatus & FOG_BACKGROUND) && (pie_GetFogEnabled())) - { - //fog the umbra but only for distant points - if (depth > (float)-0.1) - { - fog = fog + (255 - umbra); - if (fog > 255) - { - fog = 255; - } - if (fog < 0) - { - fog = 0; - } - } - } - else - { - brightness = pal_SetBrightness(pie_ByteScale(brightness.byte.r, (UBYTE)umbra)); - } - - if (fog == 0) - { - if (pSpecular != NULL) - { - *pSpecular = WZCOL_BLACK; - } - lighting = brightness; - } - else - { - if (pSpecular != NULL) - { - fogColour = pie_GetFogColour(); - specular.byte.a = fog; - specular.byte.r = pie_ByteScale(fog, fogColour.byte.r); - specular.byte.g = pie_ByteScale(fog, fogColour.byte.g); - specular.byte.b = pie_ByteScale(fog, fogColour.byte.b); - *pSpecular = specular; - } - - //calculate new brightness - colour = 256 - fog; - brightness = pal_SetBrightness(pie_ByteScale(colour, brightness.byte.r)); - lighting = brightness; - } - - return lighting; -} - void doBuildingLights( void ) { STRUCTURE *psStructure; diff --git a/src/lighting.h b/src/lighting.h index 8e91e609c..2969cf603 100644 --- a/src/lighting.h +++ b/src/lighting.h @@ -53,7 +53,6 @@ extern void lightValueForTile(UDWORD tileX, UDWORD tileY); extern void calcTileIllum(UDWORD tileX, UDWORD tileY); extern void doBuildingLights( void ); extern void UpdateFogDistance(float distance); -extern PIELIGHT lightDoFogAndIllumination(PIELIGHT brightness, SDWORD dx, SDWORD dz, PIELIGHT *pSpecular); extern void calcDroidIllumination(DROID *psDroid); //darkens down the tiles that are outside the scroll limits extern void setScrollLimitLighting(void);