[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/map map_fog.c
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src/map map_fog.c |
Date: |
15 Jan 2004 06:34:55 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/15 06:34:55
Modified files:
src/map : map_fog.c
Log message:
Faster fog
Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.137 stratagus/src/map/map_fog.c:1.138
--- stratagus/src/map/map_fog.c:1.137 Thu Jan 15 06:02:08 2004
+++ stratagus/src/map/map_fog.c Thu Jan 15 06:34:54 2004
@@ -5,13 +5,13 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
-// T H E W A R B E G I N S
-// Stratagus - A free fantasy real time strategy game engine
+// T H E W A R B E G I N S
+// Stratagus - A free fantasy real time strategy game engine
//
/address@hidden map_fog.c - The map fog of war handling. */
//
-// (c) Copyright 1999-2003 by Lutz Sammer, Vladi Shabanski,
-// Russell Smith, and Jimmy Salmon
+// (c) Copyright 1999-2003 by Lutz Sammer, Vladi Shabanski,
+// Russell Smith, and Jimmy Salmon
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -27,12 +27,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.137 2004/01/14 19:02:08 nobody_ Exp $
+// $Id: map_fog.c,v 1.138 2004/01/14 19:34:54 jsalmon3 Exp $
//@{
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@@ -52,7 +52,7 @@
#endif
/*----------------------------------------------------------------------------
--- Declarations
+-- Declarations
----------------------------------------------------------------------------*/
#ifdef DEBUG
@@ -1952,16 +1952,20 @@
unsigned char r;
unsigned char g;
unsigned char b;
- Uint32 color;
-
- // FIXME: optimize
- OnlyFogSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, TileSizeX,
TileSizeY,
- 32, RMASK, GMASK, BMASK, AMASK);
+ Uint32 color;
+ SDL_Surface* s;
+ s = SDL_CreateRGBSurface(SDL_SWSURFACE, TileSizeX, TileSizeY,
+ 32, RMASK, GMASK, BMASK, AMASK);
+
+ // FIXME: Make the color configurable
SDL_GetRGB(ColorBlack, TheScreen->format, &r, &g, &b);
- color = SDL_MapRGBA(OnlyFogSurface->format, r, g, b,
FogOfWarOpacity);
+ color = SDL_MapRGB(s->format, r, g, b);
- SDL_FillRect(OnlyFogSurface, NULL, color);
+ SDL_FillRect(s, NULL, color);
+ OnlyFogSurface = SDL_DisplayFormat(s);
+ SDL_SetAlpha(OnlyFogSurface, SDL_SRCALPHA | SDL_RLEACCEL,
FogOfWarOpacity);
+ SDL_FreeSurface(s);
}
VideoDrawUnexplored = VideoDrawUnexploredSDL;
VideoDrawFog = VideoDrawFogSDL;