[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/map.h include/ui.h map/cc...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src include/map.h include/ui.h map/cc... |
Date: |
15 Jan 2004 01:06:44 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/15 01:06:43
Modified files:
src/include : map.h ui.h
src/map : ccl_map.c map_fog.c
src/stratagus : ccl.c
src/ui : ccl_ui.c ui.c
src/video : sdl.c
Log message:
SDL fog.
Patches:
Index: stratagus/src/include/map.h
diff -u stratagus/src/include/map.h:1.111 stratagus/src/include/map.h:1.112
--- stratagus/src/include/map.h:1.111 Fri Jan 9 16:44:37 2004
+++ stratagus/src/include/map.h Thu Jan 15 01:06:39 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map.h,v 1.111 2004/01/09 05:44:37 jsalmon3 Exp $
+// $Id: map.h,v 1.112 2004/01/14 14:06:39 nobody_ Exp $
#ifndef __MAP_H__
#define __MAP_H__
@@ -365,11 +365,7 @@
/// Use original style fog of war
extern int OriginalFogOfWar;
/// Contrast of fog of war
-extern int FogOfWarContrast;
- /// Brightness of fog of war
-extern int FogOfWarBrightness;
- /// Saturation of fog of war
-extern int FogOfWarSaturation;
+extern int FogOfWarOpacity;
/// Forest regeneration
extern int ForestRegeneration;
/// Flag must reveal the map
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.83 stratagus/src/include/ui.h:1.84
--- stratagus/src/include/ui.h:1.83 Wed Dec 24 11:35:20 2003
+++ stratagus/src/include/ui.h Thu Jan 15 01:06:39 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.83 2003/12/24 00:35:20 wizzard Exp $
+// $Id: ui.h,v 1.84 2004/01/14 14:06:39 nobody_ Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -139,10 +139,6 @@
char* Name; ///
interface name to select
int Width;
/// useable for this width
int Height;
/// useable for this height
-
- int Contrast;
/// General Contrast
- int Brightness;
/// General Brightness
- int Saturation;
/// General Saturation
int MouseScroll;
/// Enable mouse scrolling
int KeyScroll;
/// Enable keyboard scrolling
Index: stratagus/src/map/ccl_map.c
diff -u stratagus/src/map/ccl_map.c:1.52 stratagus/src/map/ccl_map.c:1.53
--- stratagus/src/map/ccl_map.c:1.52 Tue Jan 6 08:32:03 2004
+++ stratagus/src/map/ccl_map.c Thu Jan 15 01:06:40 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_map.c,v 1.52 2004/01/05 21:32:03 jsalmon3 Exp $
+// $Id: ccl_map.c,v 1.53 2004/01/14 14:06:40 nobody_ Exp $
//@{
@@ -437,38 +437,9 @@
}
/**
-** Gray style fog of war contrast.
-*/
-local int CclSetFogOfWarContrast(lua_State* l)
-{
- int i;
- int old;
-
- if (lua_gettop(l) != 1) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- i = LuaToNumber(l, 1);
- if (i < 0 || i > 400) {
- PrintFunction();
- fprintf(stdout, "Contrast should be 0 - 400\n");
- i = 100;
- }
- old = FogOfWarContrast;
- FogOfWarContrast = i;
-
- if (!CclInConfigFile) {
- InitMapFogOfWar();
- }
-
- lua_pushnumber(l, old);
- return 1;
-}
-
-/**
** Gray style fog of war brightness.
*/
-local int CclSetFogOfWarBrightness(lua_State* l)
+local int CclSetFogOfWarOpacity(lua_State* l)
{
int i;
int old;
@@ -478,42 +449,13 @@
lua_error(l);
}
i = LuaToNumber(l, 1);
- if (i < -100 || i > 100) {
- PrintFunction();
- fprintf(stdout, "Brightness should be -100 - 100\n");
- i = 100;
- }
- old = FogOfWarBrightness;
- FogOfWarBrightness = i;
-
- if (!CclInConfigFile) {
- InitMapFogOfWar();
- }
-
- lua_pushnumber(l, old);
- return 1;
-}
-
-/**
-** Gray style fog of war saturation.
-*/
-local int CclSetFogOfWarSaturation(lua_State* l)
-{
- int i;
- int old;
-
- if (lua_gettop(l) != 1) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- i = LuaToNumber(l, 1);
- if (i < -100 || i > 200) {
+ if (i < 0 || i > 255) {
PrintFunction();
- fprintf(stdout, "Saturation should be -100 - 200\n");
+ fprintf(stdout, "Opacity should be 0 - 256\n");
i = 100;
}
- old = FogOfWarSaturation;
- FogOfWarSaturation = i;
+ old = FogOfWarOpacity;
+ FogOfWarOpacity = i;
if (!CclInConfigFile) {
InitMapFogOfWar();
@@ -573,9 +515,7 @@
lua_register(Lua, "OriginalFogOfWar", CclOriginalFogOfWar);
lua_register(Lua, "AlphaFogOfWar", CclAlphaFogOfWar);
- lua_register(Lua, "SetFogOfWarContrast", CclSetFogOfWarContrast);
- lua_register(Lua, "SetFogOfWarBrightness", CclSetFogOfWarBrightness);
- lua_register(Lua, "SetFogOfWarSaturation", CclSetFogOfWarSaturation);
+ lua_register(Lua, "SetFogOfWarOpacity", CclSetFogOfWarOpacity);
lua_register(Lua, "SetForestRegeneration",CclSetForestRegeneration);
}
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.135 stratagus/src/map/map_fog.c:1.136
--- stratagus/src/map/map_fog.c:1.135 Fri Jan 9 16:44:38 2004
+++ stratagus/src/map/map_fog.c Thu Jan 15 01:06:40 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.135 2004/01/09 05:44:38 jsalmon3 Exp $
+// $Id: map_fog.c,v 1.136 2004/01/14 14:06:40 nobody_ Exp $
//@{
@@ -104,9 +104,7 @@
----------------------------------------------------------------------------*/
global int OriginalFogOfWar; /// Use original style
fog of war
-global int FogOfWarContrast = 50; /// Contrast of fog of war
-global int FogOfWarBrightness = 10; /// Brightness of fog of war
-global int FogOfWarSaturation = 40; /// Saturation of fog of war
+global int FogOfWarOpacity; /// Fog of war
Opacity.
#define MapFieldCompletelyVisible 0x0001 /// Field completely visible
#define MapFieldPartiallyVisible 0x0002 /// Field partially visible
@@ -144,11 +142,6 @@
local void (*VideoDrawOnlyFog)(const GraphicData*, int x, int y);
#endif
-/**
-** Precalculated fog of war alpha table.
-*/
-local void* FogOfWarAlphaTable;
-
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
@@ -490,6 +483,7 @@
----------------------------------------------------------------------------*/
#ifdef USE_SDL_SURFACE
+
/**
** Fast draw solid fog of war 16x16 tile for 8 bpp video modes.
**
@@ -497,29 +491,8 @@
** @param x X position into video memory.
** @param y Y position into video memory.
*/
-global void VideoDrawFogSolid(const int tile, int x, int y)
-{
- int tilepitch;
- SDL_Rect srect;
- SDL_Rect drect;
-
- tilepitch = TheMap.TileGraphic->Width / TileSizeX;
-
- srect.x = TileSizeX * (tile % tilepitch);
- srect.y = TileSizeY * (tile / tilepitch);
- srect.w = TileSizeX;
- srect.h = TileSizeY;
-
- drect.x = x;
- drect.y = y;
-
- SDL_BlitSurface(TheMap.TileGraphic->Surface, &srect, TheScreen, &drect);
-}
-
-global void VideoDrawOnlyFogSolid(int x, int y)
+global void VideoDrawFogSDL(const int tile, int x, int y)
{
- // FIXME:
-/*
int tilepitch;
SDL_Rect srect;
SDL_Rect drect;
@@ -534,11 +507,12 @@
drect.x = x;
drect.y = y;
+ SDL_SetAlpha(TheMap.TileGraphic->Surface, SDL_SRCALPHA | SDL_RLEACCEL,
128);
SDL_BlitSurface(TheMap.TileGraphic->Surface, &srect, TheScreen, &drect);
-*/
+ SDL_SetAlpha(TheMap.TileGraphic->Surface, SDL_RLEACCEL, 0);
}
-global void VideoDrawUnexploredSolid(const int tile, int x, int y)
+global void VideoDrawUnexploredSDL(const int tile, int x, int y)
{
int tilepitch;
SDL_Rect srect;
@@ -557,188 +531,13 @@
SDL_BlitSurface(TheMap.TileGraphic->Surface, &srect, TheScreen, &drect);
}
-// Routines for 16 bit displays .. -------------------------------------------
-
-global void VideoDraw16OnlyFogAlpha(int x, int y)
-{
- int i;
- int j;
- Uint16* p;
- int ex;
- int ey;
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint16*)TheScreen->pixels)[x + i * VideoWidth];
- for (j = x; j < ex; ++j) {
- *p = ((Uint16*)FogOfWarAlphaTable)[*p];
- ++p;
- }
- }
- VideoUnlockScreen();
-}
-
-global void VideoDraw16FogAlpha(const int tile, int x, int y)
-{
- int i;
- int j;
- Uint16* p;
- Uint8* ptile;
- int tilepitch;
- int sx;
- int sy;
- int ex;
- int ey;
-
- tilepitch = TheMap.TileGraphic->Width / TileSizeX;
- sx = TileSizeX * (tile % tilepitch);
- sy = TileSizeY * (tile / tilepitch);
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint16*)TheScreen->pixels)[x + i * VideoWidth];
- ptile = &((Uint8*)TheMap.TileGraphic->Surface->pixels)[
- sy + (i - y) * TheMap.TileGraphic->Surface->w + sx];
- for (j = x; j < ex; ++j) {
- if (COLOR_FOG_P(*ptile)) {
- *p = ((Uint16*)FogOfWarAlphaTable)[*p];
- }
- ++p;
- ++ptile;
- }
- }
- VideoUnlockScreen();
-}
-
-// Routines for 24 bit displays .. -------------------------------------------
-
-// FIXME: not written
-global void VideoDraw24OnlyFogAlpha(int x, int y)
-{
- int i;
- int j;
- Uint16* p;
- int ex;
- int ey;
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint16*)TheScreen->pixels)[x + i * VideoWidth];
- for (j = x; j < ex; ++j) {
- *p = ((Uint16*)FogOfWarAlphaTable)[*p];
- ++p;
- }
- }
- VideoUnlockScreen();
-}
-
-// FIXME: not written
-global void VideoDraw24FogAlpha(const int tile, int x, int y)
+global void VideoDrawOnlyFogSDL(int x, int y)
{
- int i;
- int j;
- Uint16* p;
- Uint8* ptile;
- int tilepitch;
- int sx;
- int sy;
- int ex;
- int ey;
-
- tilepitch = TheMap.TileGraphic->Width / TileSizeX;
- sx = TileSizeX * (tile % tilepitch);
- sy = TileSizeY * (tile / tilepitch);
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint16*)TheScreen->pixels)[x + i * VideoWidth];
- ptile = &((Uint8*)TheMap.TileGraphic->Surface->pixels)[
- sy + (i - y) * TheMap.TileGraphic->Surface->w + sx];
- for (j = x; j < ex; ++j) {
- if (COLOR_FOG_P(*ptile)) {
- *p = ((Uint16*)FogOfWarAlphaTable)[*p];
- }
- ++p;
- ++ptile;
- }
- }
- VideoUnlockScreen();
-}
-
-// Routines for 32 bit displays .. -------------------------------------------
-
-global void VideoDraw32OnlyFogAlpha(int x, int y)
-{
- int i;
- int j;
- Uint32* p;
- int ex;
- int ey;
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint32*)TheScreen->pixels)[x + i * VideoWidth];
- for (j = x; j < ex; ++j) {
- *p = ((Uint32*)FogOfWarAlphaTable)[
- ((*p & 0xf8) >> 3) | ((*p & 0xfc00) >> 5) |
((*p & 0xf80000) >> 8)];
- ++p;
- }
- }
- VideoUnlockScreen();
-}
-
-global void VideoDraw32FogAlpha(const int tile, int x, int y)
-{
- int i;
- int j;
- Uint32* p;
- Uint8* ptile;
- int tilepitch;
- int sx;
- int sy;
- int ex;
- int ey;
-
- tilepitch = TheMap.TileGraphic->Width / TileSizeX;
- sx = TileSizeX * (tile % tilepitch);
- sy = TileSizeY * (tile / tilepitch);
-
- ex = x + TileSizeX;
- ey = y + TileSizeY;
-
- VideoLockScreen();
- for (i = y; i < ey; ++i) {
- p = &((Uint32*)TheScreen->pixels)[x + i * VideoWidth];
- ptile = &((Uint8*)TheMap.TileGraphic->Surface->pixels)[
- sy + (i - y) * TheMap.TileGraphic->Surface->w + sx];
- for (j = x; j < ex; ++j) {
- if (COLOR_FOG_P(*ptile)) {
- *p = ((Uint32*)FogOfWarAlphaTable)[
- ((*p & 0xf8) >> 3) | ((*p & 0xfc00) >>
5) | ((*p & 0xf80000) >> 8)];
- }
- ++p;
- ++ptile;
- }
- }
- VideoUnlockScreen();
+ VideoFillTransRectangleClip(ColorBlack, x, y, TileSizeX, TileSizeY,
128);
}
#else
+
// Routines for 8 bit displays .. --------------------------------------------
/**
@@ -1726,6 +1525,13 @@
}
#endif
+
+#ifdef USE_OPENGL
+
+// ------------------------------------------------------------------
+// Routines for OpenGL .. -------------------------------------------
+// ------------------------------------------------------------------
+
/**
** Fast draw solid unexplored tile.
**
@@ -1733,70 +1539,27 @@
** @param x X position into video memory
** @param y Y position into video memory
*/
-#ifdef USE_OPENGL
global void VideoDrawUnexploredSolidOpenGL(
const GraphicData* data __attribute__((unused)),
int x __attribute__((unused)), int y __attribute__((unused)))
{
}
-#endif
-
-/*----------------------------------------------------------------------------
--- Draw real fog :-)
-----------------------------------------------------------------------------*/
-
-#ifndef USE_SDL_SURFACE
-// Routines for 8 bit displays .. --------------------------------------------
/**
-** Fast draw alpha fog of war 16x16 tile for 8 bpp video modes.
+** Fast draw alpha fog of war Opengl.
**
** @param data pointer to tile graphic data.
** @param x X position into video memory
** @param y Y position into video memory
-**
-** The random effect is commented out
*/
-global void VideoDraw8Fog16Alpha(const GraphicData* data, int x, int y)
+global void VideoDrawFogAlphaOpenGL(
+ const GraphicData* data __attribute__((unused)),
+ int x __attribute__((unused)), int y __attribute__((unused)))
{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType8* dp;
- VMemType8 fog;
- int da;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory8 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType8*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- if (dp[x] != fog) { \
- dp[x] =
((VMemType8*)FogOfWarAlphaTable)[dp[x]]; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL16(0);
- sp += TileSizeX;
- dp += da;
-
- UNROLL16(0);
- sp += TileSizeX;
- dp += da;
- }
}
/**
-** Fast draw 100% fog of war 16x16 tile for 8 bpp video modes.
+** Fast draw 100% fog of war 32x32 tile for 32 bpp video modes.
**
** 100% fog of war -- i.e. raster 10101.
**
01010 etc...
@@ -1804,976 +1567,72 @@
** @param data pointer to tile graphic data.
** @param x X position into video memory
** @param y Y position into video memory
-**
-** The random effect is commented out
*/
-global void VideoDraw8OnlyFog16Alpha(const GraphicData* data
__attribute__((unused)),
+global void VideoDrawOnlyFogAlphaOpenGL(
+ const GraphicData* data __attribute__((unused)),
int x, int y)
{
- const VMemType8* gp;
- VMemType8* dp;
- VMemType8 fog;
- int da;
-
- dp = VideoMemory8 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType8*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- dp[x] = ((VMemType8*)FogOfWarAlphaTable)[dp[x]];
\
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
+ GLint sx;
+ GLint ex;
+ GLint sy;
+ GLint ey;
+ Graphic *g;
- UNROLL16(0);
- dp += da;
+ g = TheMap.TileData;
+ sx = x;
+ ex = sx + TileSizeX;
+ ey = VideoHeight - y;
+ sy = ey - TileSizeY;
- UNROLL16(0);
- dp += da;
- }
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
+ glBegin(GL_QUADS);
+ glVertex2i(sx, sy);
+ glVertex2i(sx, ey);
+ glVertex2i(ex, ey);
+ glVertex2i(ex, sy);
+ glEnd();
+ glEnable(GL_TEXTURE_2D);
}
+#endif
+
+/*----------------------------------------------------------------------------
+-- Old version correct working but not 100% original
+----------------------------------------------------------------------------*/
/**
-** Fast draw alpha fog of war 32x32 tile for 8 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
+** Draw fog of war tile.
**
-** The random effect is commented out
+** @param sx Offset into fields to current tile.
+** @param sy Start of the current row.
+** @param dx X position into video memory.
+** @param dy Y position into video memory.
*/
-global void VideoDraw8Fog32Alpha(const GraphicData* data, int x, int y)
+local void DrawFogOfWarTile(int sx, int sy, int dx, int dy)
{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType8* dp;
- VMemType8 fog;
- int da;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory8 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType8*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- if (dp[x] != fog) { \
- dp[x] =
((VMemType8*)FogOfWarAlphaTable)[dp[x]]; \
- } \
- } \
+ int w;
+ int tile;
+ int tile2;
+ int x;
+ int y;
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
+#define IsMapFieldExploredTable(x, y) \
+ (VisibleTable[(y) * TheMap.Width + (x)])
+#define IsMapFieldVisibleTable(x, y) \
+ (VisibleTable[(y) * TheMap.Width + (x)] > 1)
- UNROLL32(0);
- sp += TileSizeX;
- dp += da;
+ w = TheMap.Width;
+ tile = tile2 = 0;
+ x = sx - sy;
+ y = sy / TheMap.Width;
- UNROLL32(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 32x32 tile for 8 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-**
-** The random effect is commented out
-*/
-global void VideoDraw8OnlyFog32Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType8* gp;
- VMemType8* dp;
- VMemType8 fog;
- int da;
-
- dp = VideoMemory8 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType8*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- dp[x] = ((VMemType8*)FogOfWarAlphaTable)[dp[x]];
\
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL32(0);
- dp += da;
-
- UNROLL32(0);
- dp += da;
- }
-}
-
-// Routines for 16 bit displays .. -------------------------------------------
-
-/**
-** Fast draw alpha fog of war 16x16 tile for 16 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-**
-** The random effect is commented out
-*/
-global void VideoDraw16Fog16Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType16* dp;
- VMemType16 fog;
- int da;
- //int o;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory16 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType16*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
- //static int a=1234567;
- //o=rand();
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- /* o=a=a*(123456*4+1)+1; */ \
- if (COLOR_FOG_P(sp[x])) { \
- dp[x] =
((VMemType16*)FogOfWarAlphaTable)[dp[x]/*^((o>>20)&4)*/]; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
- //o=(o>>1)|((o&1)<<31);
-
- UNROLL16(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 16x16 tile for 16 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-**
-** The random effect is commented out
-*/
-global void VideoDraw16OnlyFog16Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType16* gp;
- VMemType16* dp;
- VMemType16 fog;
- int da;
- //int o;
-
- dp = VideoMemory16 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType16*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
- //static int a=1234567;
- //o=rand();
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- /* o=a=a*(123456*4+1)+1; */ \
- dp[x] =
((VMemType16*)FogOfWarAlphaTable)[dp[x]/*^((o>>20)&4)*/]; \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
- //o=(o>>1)|((o&1)<<31);
-
- UNROLL16(0);
- dp += da;
- }
-}
-
-/**
-** Fast draw alpha fog of war 32x32 tile for 16 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-**
-** The random effect is commented out
-*/
-global void VideoDraw16Fog32Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType16* dp;
- VMemType16 fog;
- int da;
- //int o;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory16 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType16*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
- //static int a=1234567;
- //o=rand();
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- /* o=a=a*(123456*4+1)+1; */ \
- if (COLOR_FOG_P(sp[x])) { \
- dp[x] =
((VMemType16*)FogOfWarAlphaTable)[dp[x]/*^((o>>20)&4)*/]; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
- //o=(o>>1)|((o&1)<<31);
-
- UNROLL32(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 32x32 tile for 16 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-**
-** The random effect is commented out
-*/
-global void VideoDraw16OnlyFog32Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType16* gp;
- VMemType16* dp;
- VMemType16 fog;
- int da;
- //int o;
-
- dp = VideoMemory16 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType16*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
- //static int a=1234567;
- //o=rand();
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x] != fog) { \
- /* o=a=a*(123456*4+1)+1; */ \
- dp[x] =
((VMemType16*)FogOfWarAlphaTable)[dp[x]/*^((o>>20)&4)*/]; \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
- //o=(o>>1)|((o&1)<<31);
-
- UNROLL32(0);
- dp += da;
- }
-}
-
-// Routines for 24 bit displays .. -------------------------------------------
-
-/**
-** Fast draw alpha fog of war 16x16 tile for 24 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw24Fog16Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType24* dp;
- VMemType24 fog;
- int da;
- int r;
- int g;
- int b;
- int v ;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory24 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType24*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- if (dp[x].a != fog.a || dp[x].b != fog.b || dp[x].c !=
fog.c) { \
- r = dp[x].a & 0xff; \
- g = dp[x].b & 0xff; \
- b = dp[x].c & 0xff; \
- v = r + g + b; \
-\
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
-\
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x].a = r; \
- dp[x].b = g; \
- dp[x].c = b; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL16(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 16x16 tile for 24 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw24OnlyFog16Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType24* gp;
- VMemType24* dp;
- VMemType24 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
-
- dp = VideoMemory24 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType24*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x].a != fog.a || dp[x].b != fog.b || dp[x].c != fog.c) {
\
- r = dp[x].a & 0xff; \
- g = dp[x].b & 0xff; \
- b = dp[x].c & 0xff; \
- v = r + g + b; \
-\
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
-\
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x].a = r; \
- dp[x].b = g; \
- dp[x].c = b; \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL16(0);
- dp += da;
- }
-}
-
-/**
-** Fast draw alpha fog of war 32x32 tile for 24 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw24Fog32Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType24* dp;
- VMemType24 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory24 + x + y * VideoWidth;
- da = VideoWidth;
- fog = ((VMemType24*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- if (dp[x].a != fog.a || dp[x].b != fog.b || dp[x].c !=
fog.c) { \
- r = dp[x].a & 0xff; \
- g = dp[x].b & 0xff; \
- b = dp[x].c & 0xff; \
- v = r + g + b; \
-\
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
-\
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x].a = r; \
- dp[x].b = g; \
- dp[x].c = b; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL32(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 32x32 tile for 24 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw24OnlyFog32Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType24* gp;
- VMemType24* dp;
- VMemType24 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
-
- dp = VideoMemory24 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- fog = ((VMemType24*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (dp[x].a != fog.a || dp[x].b != fog.b || dp[x].c != fog.c) {
\
- r = dp[x].a & 0xff; \
- g = dp[x].b & 0xff; \
- b = dp[x].c & 0xff; \
- v = r + g + b; \
-\
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
-\
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x].a = r; \
- dp[x].b = g; \
- dp[x].c = b; \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL32(0);
- dp += da;
- }
-}
-
-// Routines for 32 bit displays .. -------------------------------------------
-
-/**
-** Fast draw alpha fog of war 16x16 tile for 32 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw32Fog16Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType32* dp;
- VMemType32 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
- VMemType32 i;
- VMemType32 lasti;
- VMemType32 lastrgb;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory32 + x + y * VideoWidth;
- da = VideoWidth;
- lastrgb = lasti = 0;
- fog = ((VMemType32*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- i = dp[x]; \
- if (i != fog) { \
- if (i == lasti) { \
- dp[x] = lastrgb; \
- } else { \
- lasti = i; \
- r = i & 0xff; \
- g = (i >> 8 ) & 0xff; \
- b = (i >> 16) & 0xff; \
- v = r + g + b; \
- \
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
- \
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x] = (r | (g << 8) | (b << 16)); \
- lastrgb = dp[x]; \
- } \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL16(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 16x16 tile for 32 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw32OnlyFog16Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType32* gp;
- VMemType32* dp;
- VMemType32 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
- VMemType32 i;
- VMemType32 lasti;
- VMemType32 lastrgb;
-
- dp = VideoMemory32 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- lastrgb = lasti = 0;
- fog = ((VMemType32*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- i = dp[x]; \
- if (i != fog) { \
- if (i == lasti) { \
- dp[x] = lastrgb; \
- } else { \
- lasti = i; \
- r = i & 0xff; \
- g = (i >> 8 ) & 0xff; \
- b = (i >> 16) & 0xff; \
- v = r + g + b; \
- \
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
- \
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x] = r | (g << 8) | (b << 16); \
- lastrgb = dp[x]; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL16(0);
- dp += da;
- }
-}
-
-/**
-** Fast draw alpha fog of war 32x32 tile for 32 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw32Fog32Alpha(const GraphicData* data, int x, int y)
-{
- const unsigned char* sp;
- const unsigned char* gp;
- VMemType32* dp;
- VMemType32 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
- VMemType32 i;
- VMemType32 lasti;
- VMemType32 lastrgb;
-
- sp = data;
- gp = sp + TileSizeY * TileSizeX;
- dp = VideoMemory32 + x + y * VideoWidth;
- da = VideoWidth;
- lastrgb = lasti = 0;
- fog = ((VMemType32*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (sp < gp) {
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness * 25600 * 3) / 30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- if (COLOR_FOG_P(sp[x])) { \
- i = dp[x]; \
- if (i != fog) { \
- if (i == lasti) { \
- dp[x] = lastrgb; \
- } else { \
- lasti = i; \
- r = i & 0xff; \
- g = (i >> 8 ) & 0xff; \
- b = (i >> 16) & 0xff; \
- v = r + g + b; \
- \
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
- \
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x] = (r | (g << 8) | (b << 16)); \
- lastrgb = dp[x]; \
- } \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL32(0);
- sp += TileSizeX;
- dp += da;
- }
-}
-
-/**
-** Fast draw 100% fog of war 32x32 tile for 32 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-global void VideoDraw32OnlyFog32Alpha(const GraphicData* data
__attribute__((unused)),
- int x, int y)
-{
- const VMemType32* gp;
- VMemType32* dp;
- VMemType32 fog;
- int da;
- int r;
- int g;
- int b;
- int v;
- VMemType32 i;
- VMemType32 lasti;
- VMemType32 lastrgb;
-
- dp = VideoMemory32 + x + y * VideoWidth;
- gp = dp + VideoWidth * TileSizeY;
- da = VideoWidth;
- lastrgb = lasti = 0;
- fog = ((VMemType32*)TheMap.TileData->Pixels)[COLOR_FOG];
-
- while (dp < gp) {
-
-#undef FOG_SCALE
-#define FOG_SCALE(x) \
- (((((x * 3 - v) * FogOfWarSaturation + v * 100) *
FogOfWarContrast) + \
- FogOfWarBrightness*25600*3)/30000)
-
-#undef UNROLL1
-#define UNROLL1(x) \
- i = dp[x]; \
- if (i != fog) { \
- if (i == lasti) { \
- dp[x] = lastrgb; \
- } else { \
- lasti = i; \
- r = i & 0xff; \
- g = (i >> 8 ) & 0xff; \
- b = (i >> 16) & 0xff; \
- v = r + g + b; \
- \
- r = FOG_SCALE(r); \
- g = FOG_SCALE(g); \
- b = FOG_SCALE(b); \
- \
- r = r < 0 ? 0 : r > 255 ? 255 : r; \
- g = g < 0 ? 0 : g > 255 ? 255 : g; \
- b = b < 0 ? 0 : b > 255 ? 255 : b; \
- dp[x] = r | (g << 8) | (b << 16); \
- lastrgb = dp[x]; \
- } \
- } \
-
-#undef UNROLL2
-#define UNROLL2(x) \
- UNROLL1(x + 0); \
- UNROLL1(x + 1); \
-
- UNROLL32(0);
- dp += da;
- }
-}
-#endif
-
-// Routines for OpenGL .. -------------------------------------------
-
-/**
-** Fast draw alpha fog of war 32x32 tile for 32 bpp video modes.
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-#ifdef USE_OPENGL
-global void VideoDrawFogAlphaOpenGL(
- const GraphicData* data __attribute__((unused)),
- int x __attribute__((unused)), int y __attribute__((unused)))
-{
-}
-#endif
-
-/**
-** Fast draw 100% fog of war 32x32 tile for 32 bpp video modes.
-**
-** 100% fog of war -- i.e. raster 10101.
-**
01010 etc...
-**
-** @param data pointer to tile graphic data.
-** @param x X position into video memory
-** @param y Y position into video memory
-*/
-#ifdef USE_OPENGL
-global void VideoDrawOnlyFogAlphaOpenGL(
- const GraphicData* data __attribute__((unused)),
- int x, int y)
-{
- GLint sx;
- GLint ex;
- GLint sy;
- GLint ey;
- Graphic *g;
-
- g = TheMap.TileData;
- sx = x;
- ex = sx + TileSizeX;
- ey = VideoHeight - y;
- sy = ey - TileSizeY;
-
- glDisable(GL_TEXTURE_2D);
- glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- glBegin(GL_QUADS);
- glVertex2i(sx, sy);
- glVertex2i(sx, ey);
- glVertex2i(ex, ey);
- glVertex2i(ex, sy);
- glEnd();
- glEnable(GL_TEXTURE_2D);
-}
-#endif
-
-/*----------------------------------------------------------------------------
--- Old version correct working but not 100% original
-----------------------------------------------------------------------------*/
-
-/**
-** Draw fog of war tile.
-**
-** @param sx Offset into fields to current tile.
-** @param sy Start of the current row.
-** @param dx X position into video memory.
-** @param dy Y position into video memory.
-*/
-local void DrawFogOfWarTile(int sx, int sy, int dx, int dy)
-{
- int w;
- int tile;
- int tile2;
- int x;
- int y;
-
-#define IsMapFieldExploredTable(x, y) \
- (VisibleTable[(y) * TheMap.Width + (x)])
-#define IsMapFieldVisibleTable(x, y) \
- (VisibleTable[(y) * TheMap.Width + (x)] > 1)
-
- w = TheMap.Width;
- tile = tile2 = 0;
- x = sx - sy;
- y = sy / TheMap.Width;
-
- //
- // Which Tile to draw for fog
- //
- // Investigate tiles around current tile
- // 1 2 3
- // 4 * 5
- // 6 7 8
+ //
+ // Which Tile to draw for fog
+ //
+ // Investigate tiles around current tile
+ // 1 2 3
+ // 4 * 5
+ // 6 7 8
if (sy) {
if (sx != sy) {
@@ -2977,7 +1836,7 @@
MapDrawTile(UNEXPLORED_TILE,
dx, dy);
#else
#ifdef USE_SDL_SURFACE
-
VideoFillRectangleClip(ColorBlack, dx, dy, TileSizeX, TileSizeY);
+ VideoFillRectangle(ColorBlack,
dx, dy, TileSizeX, TileSizeY);
#else
VideoDrawTile(TheMap.Tiles[UNEXPLORED_TILE], dx, dy);
#endif
@@ -3078,328 +1937,69 @@
VideoDrawOnlyFog = VideoDrawOnlyFogAlphaOpenGL;
VideoDrawUnexplored = VideoDrawUnexploredSolidOpenGL;
#else
-
#ifdef USE_SDL_SURFACE
- if (!OriginalFogOfWar) {
- int i;
- int n;
- int v;
- int r, g, b;
- int rmask, gmask, bmask;
- int rshft, gshft, bshft;
- int rloss, gloss, bloss;
-
- VideoDrawUnexplored = VideoDrawUnexploredSolid;
+ VideoDrawUnexplored = VideoDrawUnexploredSDL;
+ VideoDrawFog = VideoDrawFogSDL;
+ VideoDrawOnlyFog = VideoDrawOnlyFogSDL;
+#else
+ if (TileSizeX == 16 && TileSizeY == 16) {
switch (VideoDepth) {
- case 8:
- DebugLevel0Fn("Depth unsupported %d\n" _C_
VideoDepth);
- break;
- case 15:
- rshft = ( 0);
- gshft = ( 5);
- bshft = (10);
- rmask = (0x1F << rshft);
- gmask = (0x1F << gshft);
- bmask = (0x1F << bshft);
- rloss = ( 3);
- gloss = ( 3);
- bloss = ( 3);
- goto build_table;
- case 16:
- rshft = ( 0);
- gshft = ( 5);
- bshft = (11);
- rmask = (0x1F << rshft);
- gmask = (0x3F << gshft);
- bmask = (0x1F << bshft);
- rloss = ( 3);
- gloss = ( 2);
- bloss = ( 3);
-build_table:
- n = 1 << (sizeof(Uint16) * 8);
- if (!FogOfWarAlphaTable) {
- FogOfWarAlphaTable = malloc(n *
sizeof(Uint16));
- }
- for (i = 0; i < n; ++i) {
- r = (i & rmask) >> rshft << rloss;
- g = (i & gmask) >> gshft << gloss;
- b = (i & bmask) >> bshft << bloss;
- v = r + g + b;
-
- r = ((((r * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- g = ((((g * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- b = ((((b * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
-
- // Boundings
- r = r < 0 ? 0 : r > 255 ? 255 : r;
- g = g < 0 ? 0 : g > 255 ? 255 : g;
- b = b < 0 ? 0 : b > 255 ? 255 : b;
- ((Uint16*)FogOfWarAlphaTable)[i] =
- ((r >> rloss) << rshft) | ((g
>> gloss) << gshft) |
- ((b >> bloss) << bshft);
- }
- VideoDrawFog = VideoDraw16FogAlpha;
- VideoDrawOnlyFog = VideoDraw16OnlyFogAlpha;
+ case 8:
// 8 bpp video depth
+ VideoDrawFog = VideoDraw8Fog16Solid;
+ VideoDrawOnlyFog = VideoDraw8OnlyFog16Solid;
+ VideoDrawUnexplored =
VideoDraw8Unexplored16Solid;
break;
- case 24:
- VideoDrawFog = VideoDraw24FogAlpha;
- VideoDrawOnlyFog = VideoDraw24OnlyFogAlpha;
+
+ case 15:
// 15 bpp video depth
+ case 16:
// 16 bpp video depth
+ VideoDrawFog = VideoDraw16Fog16Solid;
+ VideoDrawOnlyFog = VideoDraw16OnlyFog16Solid;
+ VideoDrawUnexplored =
VideoDraw16Unexplored16Solid;
break;
- case 32:
- rshft = ( 0);
- gshft = ( 5);
- bshft = (11);
- rmask = (0x1F << rshft);
- gmask = (0x3F << gshft);
- bmask = (0x1F << bshft);
- rloss = ( 3);
- gloss = ( 2);
- bloss = ( 3);
-
- n = 1 << (sizeof(Uint16) * 8);
- if (!FogOfWarAlphaTable) {
- FogOfWarAlphaTable = malloc(n *
sizeof(Uint32));
- }
- for (i = 0; i < n; ++i) {
- r = (i & rmask) >> rshft << rloss;
- g = (i & gmask) >> gshft << gloss;
- b = (i & bmask) >> bshft << bloss;
- v = r + g + b;
-
- r = ((((r * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- g = ((((g * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- b = ((((b * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
-
- // Boundings
- r = r < 0 ? 0 : r > 255 ? 255 : r;
- g = g < 0 ? 0 : g > 255 ? 255 : g;
- b = b < 0 ? 0 : b > 255 ? 255 : b;
- ((Uint32*)FogOfWarAlphaTable)[i] = (r |
(g << 8) | (b << 16));
+ case 24:
// 24 bpp video depth
+ if (VideoBpp == 24) {
+ VideoDrawFog = VideoDraw24Fog16Solid;
+ VideoDrawOnlyFog =
VideoDraw24OnlyFog16Solid;
+ VideoDrawUnexplored =
VideoDraw24Unexplored16Solid;
+ break;
}
- VideoDrawFog = VideoDraw32FogAlpha;
- VideoDrawOnlyFog = VideoDraw32OnlyFogAlpha;
- break;
- default:
- DebugLevel0Fn("Depth unsupported %d\n" _C_
VideoDepth);
- break;
- }
- } else {
- VideoDrawUnexplored = VideoDrawUnexploredSolid;
- VideoDrawFog = VideoDrawFogSolid;
- VideoDrawOnlyFog = VideoDrawOnlyFogSolid;
-#if 0
- switch (VideoDepth) {
- case 8:
- break;
- case 15:
- case 16:
- VideoDrawFog = VideoDrawFogSolid;
- VideoDrawOnlyFog = VideoDrawOnlyFogSolid;
- break;
- case 24:
- break;
- case 32:
+ // FALL THROUGH
+ case 32:
// 32 bpp video depth
+ VideoDrawFog = VideoDraw32Fog16Solid;
+ VideoDrawOnlyFog = VideoDraw32OnlyFog16Solid;
+ VideoDrawUnexplored =
VideoDraw32Unexplored16Solid;
break;
+
default:
DebugLevel0Fn("Depth unsupported %d\n" _C_
VideoDepth);
break;
}
-#endif
- }
-
-#else
- if (!OriginalFogOfWar) {
- int i;
- int n;
- int v;
- int r, g, b;
- int rmask, gmask, bmask;
- int rshft, gshft, bshft;
- int rloss, gloss, bloss;
-
+ } else if (TileSizeX == 32 && TileSizeY == 32) {
switch (VideoDepth) {
- case 8:
- n = 1 << (sizeof(VMemType8) * 8);
- if (!FogOfWarAlphaTable) {
- FogOfWarAlphaTable = malloc(n *
sizeof(VMemType8));
- }
- if (lookup25trans8) { // if enabled, make use
of it in 8bpp ;)
- unsigned int trans_color;
- int j;
-
- trans_color = ColorBlack.D8;
- trans_color <<= 8;
-
- //FIXME: determine which lookup table
to use based on
- //FIXME:
FogOfWarSaturation,FogOfWarContrast and
- //FIXME: FogOfWarBrightness
- for (j = 0; j < n; ++j) {
-
((VMemType8*)FogOfWarAlphaTable)[j] =
-
lookup50trans8[trans_color | j];
- }
- } else {
- for (i = 0; i < n; ++i) {
- int j;
- int l;
- int d;
-
- r =
TheMap.TileData->Palette[i].r;
- g =
TheMap.TileData->Palette[i].g;
- b =
TheMap.TileData->Palette[i].b;
- DebugLevel3("%d,%d,%d\n" _C_ r
_C_ g _C_ b);
- v = r + g + b;
-
- r = ((((r * 3 - v) *
FogOfWarSaturation + v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- g = ((((g * 3 - v) *
FogOfWarSaturation + v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- b = ((((b * 3 - v) *
FogOfWarSaturation + v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
-
- // Boundings
- r = r < 0 ? 0 : r > 255 ? 255 :
r;
- g = g < 0 ? 0 : g > 255 ? 255 :
g;
- b = b < 0 ? 0 : b > 255 ? 255 :
b;
-
- //
- // Find the best
matching color
- //
- l = i;
- d = 256 * 3 + 256;
- for (j = 0; j < 256; ++j) {
- // simple color distance
- v =
(abs(TheMap.TileData->Palette[j].r - r) +
-
abs(TheMap.TileData->Palette[j].g - g) +
-
abs(TheMap.TileData->Palette[j].b - b)) * 3 +
- // light
-
abs(TheMap.TileData->Palette[j].r +
-
TheMap.TileData->Palette[j].g +
-
TheMap.TileData->Palette[j].b - (r + g + b)) * 1;
- if (v < d) {
- d = v;
- l = j;
- }
- }
- DebugLevel3("%d,%d,%d ->
%d,%d,%d\n" _C_ r _C_ g _C_ b _C_
-
TheMap.TileData->Palette[l].r _C_ TheMap.TileData->Palette[l].g _C_
-
TheMap.TileData->Palette[l].b);
-
((VMemType8*)FogOfWarAlphaTable)[i] = l;
- }
- }
-
- if (TileSizeX == 16 && TileSizeY == 16) {
- VideoDrawFog = VideoDraw8Fog16Alpha;
- VideoDrawOnlyFog =
VideoDraw8OnlyFog16Alpha;
- VideoDrawUnexplored =
VideoDraw8Unexplored16Solid;
- } else if (TileSizeX == 32 && TileSizeY == 32) {
- VideoDrawFog = VideoDraw8Fog32Alpha;
- VideoDrawOnlyFog =
VideoDraw8OnlyFog32Alpha;
- VideoDrawUnexplored =
VideoDraw8Unexplored32Solid;
- } else {
- printf("Tile size not supported:
(%dx%d)\n", TileSizeX, TileSizeY);
- exit(1);
- }
+ case 8:
// 8 bpp video depth
+ VideoDrawFog = VideoDraw8Fog32Solid;
+ VideoDrawOnlyFog = VideoDraw8OnlyFog32Solid;
+ VideoDrawUnexplored =
VideoDraw8Unexplored32Solid;
break;
- case 15:
// 15 bpp 555 video depth
- rshft = ( 0);
- gshft = ( 5);
- bshft = (10);
- rmask = (0x1F << rshft);
- gmask = (0x1F << gshft);
- bmask = (0x1F << bshft);
- rloss = ( 3);
- gloss = ( 3);
- bloss = ( 3);
- goto build_table;
-
- case 16:
// 16 bpp 565 video depth
- rshft = ( 0);
- gshft = ( 5);
- bshft = (11);
- rmask = (0x1F << rshft);
- gmask = (0x3F << gshft);
- bmask = (0x1F << bshft);
- rloss = ( 3);
- gloss = ( 2);
- bloss = ( 3);
-
-build_table:
- n = 1 << (sizeof(VMemType16) * 8);
- if (!FogOfWarAlphaTable) {
- FogOfWarAlphaTable = malloc(n *
sizeof(VMemType16));
- }
- for (i = 0; i < n; ++i) {
- r = (i & rmask) >> rshft << rloss;
- g = (i & gmask) >> gshft << gloss;
- b = (i & bmask) >> bshft << bloss;
- v = r + g + b;
-
- r = ((((r * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- g = ((((g * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
- b = ((((b * 3 - v) * FogOfWarSaturation
+ v * 100) *
- FogOfWarContrast) +
FogOfWarBrightness * 25600 * 3) / 30000;
-
- // Boundings
- r = r < 0 ? 0 : r > 255 ? 255 : r;
- g = g < 0 ? 0 : g > 255 ? 255 : g;
- b = b < 0 ? 0 : b > 255 ? 255 : b;
- ((VMemType16*)FogOfWarAlphaTable)[i] =
- ((r >> rloss) << rshft) | ((g
>> gloss) << gshft) |
- ((b >> bloss) << bshft);
- }
- if (TileSizeX == 16 && TileSizeY == 16) {
- VideoDrawFog = VideoDraw16Fog16Alpha;
- VideoDrawOnlyFog =
VideoDraw16OnlyFog16Alpha;
- VideoDrawUnexplored =
VideoDraw16Unexplored16Solid;
- } else if (TileSizeX == 32 && TileSizeY == 32) {
- VideoDrawFog = VideoDraw16Fog32Alpha;
- VideoDrawOnlyFog =
VideoDraw16OnlyFog32Alpha;
- VideoDrawUnexplored =
VideoDraw16Unexplored32Solid;
- } else {
- printf("Tile size not supported:
(%dx%d)\n", TileSizeX, TileSizeY);
- exit(1);
- }
+ case 15:
// 15 bpp video depth
+ case 16:
// 16 bpp video depth
+ VideoDrawFog = VideoDraw16Fog32Solid;
+ VideoDrawOnlyFog = VideoDraw16OnlyFog32Solid;
+ VideoDrawUnexplored =
VideoDraw16Unexplored32Solid;
break;
-
- case 24:
+ case 24:
// 24 bpp video depth
if (VideoBpp == 24) {
- if (TileSizeX == 16 && TileSizeY == 16)
{
- VideoDrawFog =
VideoDraw24Fog16Alpha;
- VideoDrawOnlyFog =
VideoDraw24OnlyFog16Alpha;
- VideoDrawUnexplored =
VideoDraw24Unexplored16Solid;
- } else if (TileSizeX == 32 && TileSizeY
== 32) {
- VideoDrawFog =
VideoDraw24Fog32Alpha;
- VideoDrawOnlyFog =
VideoDraw24OnlyFog32Alpha;
- VideoDrawUnexplored =
VideoDraw24Unexplored32Solid;
- } else {
- printf("Tile size not
supported: (%dx%d)\n", TileSizeX, TileSizeY);
- exit(1);
- }
+ VideoDrawFog = VideoDraw24Fog32Solid;
+ VideoDrawOnlyFog =
VideoDraw24OnlyFog32Solid;
+ VideoDrawUnexplored =
VideoDraw24Unexplored32Solid;
break;
}
// FALL THROUGH
- case 32:
- if (TileSizeX == 16 && TileSizeY == 16) {
- VideoDrawFog = VideoDraw32Fog16Alpha;
- VideoDrawOnlyFog =
VideoDraw32OnlyFog16Alpha;
- VideoDrawUnexplored =
VideoDraw32Unexplored16Solid;
- } else if (TileSizeX == 32 && TileSizeY == 32) {
- VideoDrawFog = VideoDraw32Fog32Alpha;
- VideoDrawOnlyFog =
VideoDraw32OnlyFog32Alpha;
- VideoDrawUnexplored =
VideoDraw32Unexplored32Solid;
- } else {
- printf("Tile size not supported:
(%dx%d)\n", TileSizeX, TileSizeY);
- exit(1);
- }
+ case 32:
// 32 bpp video depth
+ VideoDrawFog = VideoDraw32Fog32Solid;
+ VideoDrawOnlyFog = VideoDraw32OnlyFog32Solid;
+ VideoDrawUnexplored =
VideoDraw32Unexplored32Solid;
break;
default:
@@ -3407,74 +2007,8 @@
break;
}
} else {
- if (TileSizeX == 16 && TileSizeY == 16) {
- switch (VideoDepth) {
- case 8:
// 8 bpp video depth
- VideoDrawFog = VideoDraw8Fog16Solid;
- VideoDrawOnlyFog =
VideoDraw8OnlyFog16Solid;
- VideoDrawUnexplored =
VideoDraw8Unexplored16Solid;
- break;
-
- case 15:
// 15 bpp video depth
- case 16:
// 16 bpp video depth
- VideoDrawFog = VideoDraw16Fog16Solid;
- VideoDrawOnlyFog =
VideoDraw16OnlyFog16Solid;
- VideoDrawUnexplored =
VideoDraw16Unexplored16Solid;
- break;
- case 24:
// 24 bpp video depth
- if (VideoBpp == 24) {
- VideoDrawFog =
VideoDraw24Fog16Solid;
- VideoDrawOnlyFog =
VideoDraw24OnlyFog16Solid;
- VideoDrawUnexplored =
VideoDraw24Unexplored16Solid;
- break;
- }
- // FALL THROUGH
- case 32:
// 32 bpp video depth
- VideoDrawFog = VideoDraw32Fog16Solid;
- VideoDrawOnlyFog =
VideoDraw32OnlyFog16Solid;
- VideoDrawUnexplored =
VideoDraw32Unexplored16Solid;
- break;
-
- default:
- DebugLevel0Fn("Depth unsupported %d\n"
_C_ VideoDepth);
- break;
- }
- } else if (TileSizeX == 32 && TileSizeY == 32) {
- switch (VideoDepth) {
- case 8:
// 8 bpp video depth
- VideoDrawFog = VideoDraw8Fog32Solid;
- VideoDrawOnlyFog =
VideoDraw8OnlyFog32Solid;
- VideoDrawUnexplored =
VideoDraw8Unexplored32Solid;
- break;
-
- case 15:
// 15 bpp video depth
- case 16:
// 16 bpp video depth
- VideoDrawFog = VideoDraw16Fog32Solid;
- VideoDrawOnlyFog =
VideoDraw16OnlyFog32Solid;
- VideoDrawUnexplored =
VideoDraw16Unexplored32Solid;
- break;
- case 24:
// 24 bpp video depth
- if (VideoBpp == 24) {
- VideoDrawFog =
VideoDraw24Fog32Solid;
- VideoDrawOnlyFog =
VideoDraw24OnlyFog32Solid;
- VideoDrawUnexplored =
VideoDraw24Unexplored32Solid;
- break;
- }
- // FALL THROUGH
- case 32:
// 32 bpp video depth
- VideoDrawFog = VideoDraw32Fog32Solid;
- VideoDrawOnlyFog =
VideoDraw32OnlyFog32Solid;
- VideoDrawUnexplored =
VideoDraw32Unexplored32Solid;
- break;
-
- default:
- DebugLevel0Fn("Depth unsupported %d\n"
_C_ VideoDepth);
- break;
- }
- } else {
- printf("Tile size not supported: (%dx%d)\n", TileSizeX,
TileSizeY);
- exit(1);
- }
+ printf("Tile size not supported: (%dx%d)\n", TileSizeX,
TileSizeY);
+ exit(1);
}
#endif
#endif
@@ -3488,11 +2022,6 @@
if (VisibleTable) {
free(VisibleTable);
VisibleTable = NULL;
- }
-
- if (FogOfWarAlphaTable) {
- free(FogOfWarAlphaTable);
- FogOfWarAlphaTable = NULL;
}
}
Index: stratagus/src/stratagus/ccl.c
diff -u stratagus/src/stratagus/ccl.c:1.154 stratagus/src/stratagus/ccl.c:1.155
--- stratagus/src/stratagus/ccl.c:1.154 Wed Jan 14 10:38:35 2004
+++ stratagus/src/stratagus/ccl.c Thu Jan 15 01:06:41 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl.c,v 1.154 2004/01/13 23:38:35 jsalmon3 Exp $
+// $Id: ccl.c,v 1.155 2004/01/14 14:06:41 nobody_ Exp $
//@{
@@ -1091,7 +1091,7 @@
}
fprintf(fd, "--- -----------------------------------------\n");
- fprintf(fd, "--- $Id: ccl.c,v 1.154 2004/01/13 23:38:35 jsalmon3 Exp
$\n");
+ fprintf(fd, "--- $Id: ccl.c,v 1.155 2004/01/14 14:06:41 nobody_ Exp
$\n");
fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
fprintf(fd, "SetGroupKeys(\"");
@@ -1127,7 +1127,7 @@
}
fprintf(fd, "--- -----------------------------------------\n");
- fprintf(fd, "--- $Id: ccl.c,v 1.154 2004/01/13 23:38:35 jsalmon3 Exp
$\n");
+ fprintf(fd, "--- $Id: ccl.c,v 1.155 2004/01/14 14:06:41 nobody_ Exp
$\n");
// Global options
if (OriginalFogOfWar) {
@@ -1136,12 +1136,6 @@
fprintf(fd, "AlphaFogOfWar()\n");
}
fprintf(fd, "SetVideoFullScreen(%s)\n", VideoFullScreen ? "true" :
"false");
-#if 0
- // FIXME: Uncomment when this is configurable in the menus
- fprintf(fd, "SetContrast(%d)\n", TheUI.Contrast);
- fprintf(fd, "SetBrightness(%d)\n", TheUI.Brightness);
- fprintf(fd, "SetSaturation(%d)\n", TheUI.Saturation);
-#endif
fprintf(fd, "SetLocalPlayerName(\"%s\")\n", LocalPlayerName);
// Game options
@@ -1236,7 +1230,7 @@
extern SCM oblistvar;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.154 2004/01/13 23:38:35
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: CCL $Id: ccl.c,v 1.155 2004/01/14 14:06:41
nobody_ Exp $\n\n");
for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
SCM sym;
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.183 stratagus/src/ui/ccl_ui.c:1.184
--- stratagus/src/ui/ccl_ui.c:1.183 Sat Jan 10 17:04:23 2004
+++ stratagus/src/ui/ccl_ui.c Thu Jan 15 01:06:41 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.183 2004/01/10 06:04:23 wizzard Exp $
+// $Id: ccl_ui.c,v 1.184 2004/01/14 14:06:41 nobody_ Exp $
//@{
@@ -202,90 +202,6 @@
}
/**
-** Game contrast.
-**
-** @param contrast New contrast 0 - 400.
-** @return Old contrast.
-*/
-local int CclSetContrast(lua_State* l)
-{
- int i;
- lua_Number old;
-
- if (lua_gettop(l) != 1) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- old = TheUI.Contrast;
- i = LuaToNumber(l, 1);
- if (i < 0 || i > 400) {
- lua_pushstring(l, "Contrast should be 0 - 400");
- lua_error(l);
- }
- TheUI.Contrast = i;
- MustRedraw = RedrawEverything;
-
- lua_pushnumber(l, old);
- return 1;
-}
-
-/**
-** Game brightness.
-**
-** @param brightness New brightness -100 - 100.
-** @return Old brightness.
-*/
-local int CclSetBrightness(lua_State* l)
-{
- int i;
- lua_Number old;
-
- if (lua_gettop(l) != 1) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- old = TheUI.Brightness;
- i = LuaToNumber(l, 1);
- if (i < -100 || i > 100) {
- lua_pushstring(l, "Brightness should be -100 - 100");
- lua_error(l);
- }
- TheUI.Brightness = i;
- MustRedraw = RedrawEverything;
-
- lua_pushnumber(l, old);
- return 1;
-}
-
-/**
-** Game saturation.
-**
-** @param saturation New saturation -100 - 200.
-** @return Old saturation.
-*/
-local int CclSetSaturation(lua_State* l)
-{
- int i;
- lua_Number old;
-
- if (lua_gettop(l) != 1) {
- lua_pushstring(l, "incorrect argument");
- lua_error(l);
- }
- old = TheUI.Saturation;
- i = LuaToNumber(l, 1);
- if (i < -100 || i > 200) {
- lua_pushstring(l, "Saturation should be -100 - 200");
- lua_error(l);
- }
- TheUI.Saturation = i;
- MustRedraw = RedrawEverything;
-
- lua_pushnumber(l, old);
- return 1;
-}
-
-/**
** Set the video resolution.
**
** @param width Resolution width.
@@ -1333,10 +1249,6 @@
// This save the setup values FIXME: They are set by CCL.
- ui->Contrast = TheUI.Contrast;
- ui->Brightness = TheUI.Brightness;
- ui->Saturation = TheUI.Saturation;
-
ui->MouseScroll = TheUI.MouseScroll;
ui->KeyScroll = TheUI.KeyScroll;
ui->MouseScrollSpeedDefault = TheUI.MouseScrollSpeedDefault;
@@ -4382,10 +4294,6 @@
lua_register(Lua, "SetClickMissile", CclSetClickMissile);
lua_register(Lua, "SetDamageMissile", CclSetDamageMissile);
-
- lua_register(Lua, "SetContrast", CclSetContrast);
- lua_register(Lua, "SetBrightness", CclSetBrightness);
- lua_register(Lua, "SetSaturation", CclSetSaturation);
lua_register(Lua, "SetVideoResolution", CclSetVideoResolution);
lua_register(Lua, "SetVideoFullScreen", CclSetVideoFullScreen);
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.95 stratagus/src/ui/ui.c:1.96
--- stratagus/src/ui/ui.c:1.95 Wed Jan 14 17:19:23 2004
+++ stratagus/src/ui/ui.c Thu Jan 15 01:06:42 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.95 2004/01/14 06:19:23 jsalmon3 Exp $
+// $Id: ui.c,v 1.96 2004/01/14 14:06:42 nobody_ Exp $
//@{
@@ -687,12 +687,8 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.95 2004/01/14 06:19:23
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.96 2004/01/14 14:06:42
nobody_ Exp $\n\n");
- // Contrast, Brightness, Saturation
- CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);
- CLprintf(file, "(set-brightness! %d)\n", TheUI.Brightness);
- CLprintf(file, "(set-saturation! %d)\n\n", TheUI.Saturation);
// Scrolling
CLprintf(file, "(set-mouse-scroll! %s)\n", TheUI.MouseScroll ? "#t" :
"#f");
CLprintf(file, "(set-mouse-scroll-speed! %d)\n", SpeedMouseScroll);
Index: stratagus/src/video/sdl.c
diff -u stratagus/src/video/sdl.c:1.111 stratagus/src/video/sdl.c:1.112
--- stratagus/src/video/sdl.c:1.111 Sat Dec 20 16:33:50 2003
+++ stratagus/src/video/sdl.c Thu Jan 15 01:06:43 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sdl.c,v 1.111 2003/12/20 05:33:50 jsalmon3 Exp $
+// $Id: sdl.c,v 1.112 2004/01/14 14:06:43 nobody_ Exp $
//@{
@@ -898,17 +898,6 @@
g = (palette[i].g) & 0xFF;
b = (palette[i].b) & 0xFF;
v = r + g + b;
-
- // Apply global saturation,contrast and brightness
- r = ((((r * 3 - v) * TheUI.Saturation + v * 100)
- * TheUI.Contrast)
- + TheUI.Brightness * 25600 * 3) / 30000;
- g = ((((g * 3 - v) * TheUI.Saturation + v * 100)
- * TheUI.Contrast)
- + TheUI.Brightness * 25600 * 3) / 30000;
- b = ((((b * 3 - v) * TheUI.Saturation + v * 100)
- * TheUI.Contrast)
- + TheUI.Brightness * 25600 * 3) / 30000;
// Boundings
r = r < 0 ? 0 : r > 255 ? 255 : r;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/map.h include/ui.h map/cc...,
address@hidden <=