[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/map map_fog.c
From: |
Nehal Mistry |
Subject: |
[Stratagus-CVS] stratagus/src/map map_fog.c |
Date: |
Sun, 30 Nov 2003 04:05:01 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Nehal Mistry <address@hidden> 03/11/30 04:05:01
Modified files:
src/map : map_fog.c
Log message:
fix fow brightness
Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.123 stratagus/src/map/map_fog.c:1.124
--- stratagus/src/map/map_fog.c:1.123 Sat Nov 29 21:29:08 2003
+++ stratagus/src/map/map_fog.c Sun Nov 30 04:05:00 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.123 2003/11/30 02:29:08 nehalmistry Exp $
+// $Id: map_fog.c,v 1.124 2003/11/30 09:05:00 nehalmistry Exp $
//@{
@@ -579,7 +579,7 @@
SDL_Rect drect;
SDL_Color csrc;
SDL_Color cdest;
- unsigned char alpha;
+ unsigned char bright;
unsigned char sat;
unsigned char max;
@@ -593,7 +593,7 @@
csrc.g = 255;
csrc.b = 255;
- alpha = (255 - FogOfWarBrightness * 255 / 100);
+ bright = FogOfWarBrightness * 255 / 100;
sat = 100 - FogOfWarSaturation;
SDL_LockSurface(TheScreen);
@@ -601,11 +601,11 @@
for (j = x; j < x + TileSizeX; ++j) {
p = &((Uint16*)TheScreen->pixels)[j + i * VideoWidth];
if (*p) {
- // Brightness
SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
- cdest.r = ((cdest.r * alpha) + (csrc.r * (255 - alpha))) >> 8;
- cdest.g = ((cdest.g * alpha) + (csrc.g * (255 - alpha))) >> 8;
- cdest.b = ((cdest.b * alpha) + (csrc.b * (255 - alpha))) >> 8;
+ // Brightness
+ cdest.r = (cdest.r) + (csrc.r * bright);
+ cdest.g = (cdest.g) + (csrc.g * bright);
+ cdest.b = (cdest.b) + (csrc.b * bright);
// Saturation
if (cdest.r > cdest.g && cdest.r > cdest.b) {
@@ -660,6 +660,7 @@
unsigned char alpha;
unsigned char sat;
unsigned char max;
+ unsigned char bright;
tilepitch = TheMap.TileGraphic->Width / TileSizeX;
@@ -682,7 +683,7 @@
csrc.g = 255;
csrc.b = 255;
- alpha = (255 - FogOfWarBrightness * 255 / 100);
+ bright = FogOfWarBrightness * 255 / 100;
sat = 100 - FogOfWarSaturation;
SDL_LockSurface(TheScreen);
@@ -696,9 +697,9 @@
if (!(cdest.r | cdest.g | cdest.b) && *p) {
SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
// Brightness
- cdest.r = ((cdest.r * alpha) + (csrc.r * (255 - alpha))) >> 8;
- cdest.g = ((cdest.g * alpha) + (csrc.g * (255 - alpha))) >> 8;
- cdest.b = ((cdest.b * alpha) + (csrc.b * (255 - alpha))) >> 8;
+ cdest.r = (cdest.r) + (csrc.r * bright);
+ cdest.g = (cdest.g) + (csrc.g * bright);
+ cdest.b = (cdest.b) + (csrc.b * bright);
// Saturation
if (cdest.r > cdest.g && cdest.r > cdest.b) {
- [Stratagus-CVS] stratagus/src/map map_fog.c, Jimmy Salmon, 2003/11/23
- [Stratagus-CVS] stratagus/src/map map_fog.c, Jimmy Salmon, 2003/11/23
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/28
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/29
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/29
- [Stratagus-CVS] stratagus/src/map map_fog.c,
Nehal Mistry <=
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/30
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/30
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/30
- [Stratagus-CVS] stratagus/src/map map_fog.c, Nehal Mistry, 2003/11/30