stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/map map_draw.c map_fog.c tileset.c


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src/map map_draw.c map_fog.c tileset.c
Date: 15 Jan 2004 10:44:02 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/15 10:44:02

Modified files:
        src/map        : map_draw.c map_fog.c tileset.c 

Log message:
        Fixes for USE_OPENGL

Patches:
Index: stratagus/src/map/map_draw.c
diff -u stratagus/src/map/map_draw.c:1.58 stratagus/src/map/map_draw.c:1.59
--- stratagus/src/map/map_draw.c:1.58   Thu Jan 15 04:45:34 2004
+++ stratagus/src/map/map_draw.c        Thu Jan 15 10:44:00 2004
@@ -29,7 +29,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//             $Id: map_draw.c,v 1.58 2004/01/14 17:45:34 jsalmon3 Exp $
+//             $Id: map_draw.c,v 1.59 2004/01/14 23:44:00 jsalmon3 Exp $
 
 //@{
 
@@ -166,9 +166,7 @@
 **
 **             Draws tiles display and video mode independ
 */
-#ifdef USE_SDL_SURFACE
-global void VideoDrawTile(const int, int, int);
-#else
+#ifndef USE_SDL_SURFACE
 global void (*VideoDrawTile)(const GraphicData*, int, int);
 #endif
 
@@ -177,9 +175,7 @@
 **
 **             Draws tiles display and video mode independ
 */
-#ifdef USE_SDL_SURFACE
-global void MapDrawTile(int, int, int);
-#else
+#ifndef USE_SDL_SURFACE
 global void (*MapDrawTile)(int, int, int);
 #endif
 
@@ -2202,12 +2198,61 @@
 
 // ---------------------------------------------------------------------------
 
+/**
+**             Draw tile.
+**
+**             @param tile             Tile number to draw.
+**             @param x                X position into video memory
+**             @param y                Y position into video memory
+*/
 #ifdef USE_SDL_SURFACE
-local void MapDrawTile(int tile, int x, int y)
+#ifndef USE_OPENGL
+global void MapDrawTile(int tile, int x, int y)
 {
        VideoDrawTile(tile, x, y);
 }
 #else
+global void MapDrawTile(int tile, int x, int y)
+{
+       GLint sx;
+       GLint ex;
+       GLint sy;
+       GLint ey;
+       GLfloat stx;
+       GLfloat etx;
+       GLfloat sty;
+       GLfloat ety;
+       Graphic *g;
+       int t;
+
+       g = TheMap.TileGraphic;
+       sx = x;
+       ex = sx + TileSizeX;
+       ey = VideoHeight - y;
+       sy = ey - TileSizeY;
+
+       t = tile % (g->Width / TileSizeX);
+       stx=(GLfloat)t * TileSizeX / g->Width * g->TextureWidth;
+       etx=(GLfloat)(t * TileSizeX + TileSizeX) / g->Width * g->TextureWidth;
+       t = tile / (g->Width / TileSizeX);
+       sty=(GLfloat)t * TileSizeY / g->Height * g->TextureHeight;
+       ety=(GLfloat)(t * TileSizeY + TileSizeY) / g->Height * g->TextureHeight;
+
+       glBindTexture(GL_TEXTURE_2D, g->TextureNames[0]);
+       glBegin(GL_QUADS);
+       glTexCoord2f(stx, 1.0f - ety);
+       glVertex2i(sx, sy);
+       glTexCoord2f(stx, 1.0f - sty);
+       glVertex2i(sx, ey);
+       glTexCoord2f(etx, 1.0f - sty);
+       glVertex2i(ex, ey);
+       glTexCoord2f(etx, 1.0f - ety);
+       glVertex2i(ex, sy);
+       glEnd();
+}
+#endif
+
+#else
 
 /**
 **             Draw 16x16 tile for 8 bpp video modes with cache support.
@@ -2348,54 +2393,6 @@
 }
 #endif
 
-/**
-**             Draw tile.
-**
-**             @param tile             Tile number to draw.
-**             @param x                X position into video memory
-**             @param y                Y position into video memory
-*/
-#ifdef USE_OPENGL
-local void MapDrawTileOpenGL(int tile, int x, int y)
-{
-       GLint sx;
-       GLint ex;
-       GLint sy;
-       GLint ey;
-       GLfloat stx;
-       GLfloat etx;
-       GLfloat sty;
-       GLfloat ety;
-       Graphic *g;
-       int t;
-
-       g = TheMap.TileData;
-       sx = x;
-       ex = sx + TileSizeX;
-       ey = VideoHeight - y;
-       sy = ey - TileSizeY;
-
-       t = tile % (g->Width / TileSizeX);
-       stx=(GLfloat)t * TileSizeX / g->Width * g->TextureWidth;
-       etx=(GLfloat)(t * TileSizeX + TileSizeX) / g->Width * g->TextureWidth;
-       t = tile / (g->Width / TileSizeX);
-       sty=(GLfloat)t * TileSizeY / g->Height * g->TextureHeight;
-       ety=(GLfloat)(t * TileSizeY + TileSizeY) / g->Height * g->TextureHeight;
-
-       glBindTexture(GL_TEXTURE_2D, g->TextureNames[0]);
-       glBegin(GL_QUADS);
-       glTexCoord2f(stx, 1.0f - ety);
-       glVertex2i(sx, sy);
-       glTexCoord2f(stx, 1.0f - sty);
-       glVertex2i(sx, ey);
-       glTexCoord2f(etx, 1.0f - sty);
-       glVertex2i(ex, ey);
-       glTexCoord2f(etx, 1.0f - ety);
-       glVertex2i(ex, sy);
-       glEnd();
-}
-#endif
-
 #endif         // } USE_SMART_TILECACHE
 
 /*----------------------------------------------------------------------------
@@ -2904,10 +2901,6 @@
        MapColorCycle();
 #endif
 
-#ifdef USE_OPENGL
-       MapDrawTile = MapDrawTileOpenGL;
-#else
-
 #ifdef NEW_DECODRAW
        // StephanR: Using the decoration mechanism we need to support drawing 
tiles
        // clipped, as by only updating a small part of the tile, we don't have 
to
@@ -3002,8 +2995,6 @@
        }
 #endif // ifdef USE_SDL_SURFACE
 #endif // NEW_DECODRAW
-
-#endif // USE_OPENGL
 }
 
 //@}
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.140 stratagus/src/map/map_fog.c:1.141
--- stratagus/src/map/map_fog.c:1.140   Thu Jan 15 09:31:05 2004
+++ stratagus/src/map/map_fog.c Thu Jan 15 10:44:01 2004
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: map_fog.c,v 1.140 2004/01/14 22:31:05 nobody_ Exp $
+//      $Id: map_fog.c,v 1.141 2004/01/14 23:44:01 jsalmon3 Exp $
 
 //@{
 
@@ -1549,7 +1549,7 @@
 **             @param y                Y position into video memory
 */
 global void VideoDrawUnexploredSolidOpenGL(
-       const GraphicData* data __attribute__((unused)),
+       const int tile __attribute__((unused)),
        int x __attribute__((unused)), int y __attribute__((unused)))
 {
 }
@@ -1562,7 +1562,7 @@
 **             @param y                Y position into video memory
 */
 global void VideoDrawFogAlphaOpenGL(
-       const GraphicData* data __attribute__((unused)),
+       const int tile __attribute__((unused)),
        int x __attribute__((unused)), int y __attribute__((unused)))
 {
 }
@@ -1577,9 +1577,7 @@
 **             @param x                X position into video memory
 **             @param y                Y position into video memory
 */
-global void VideoDrawOnlyFogAlphaOpenGL(
-       const GraphicData* data __attribute__((unused)),
-       int x, int y)
+global void VideoDrawOnlyFogAlphaOpenGL(int x, int y)
 {
        GLint sx;
        GLint ex;
@@ -1587,7 +1585,7 @@
        GLint ey;
        Graphic *g;
 
-       g = TheMap.TileData;
+       g = TheMap.TileGraphic;
        sx = x;
        ex = sx + TileSizeX;
        ey = VideoHeight - y;
Index: stratagus/src/map/tileset.c
diff -u stratagus/src/map/tileset.c:1.62 stratagus/src/map/tileset.c:1.63
--- stratagus/src/map/tileset.c:1.62    Thu Jan 15 04:49:59 2004
+++ stratagus/src/map/tileset.c Thu Jan 15 10:44:01 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: tileset.c,v 1.62 2004/01/14 17:49:59 jsalmon3 Exp $
+//     $Id: tileset.c,v 1.63 2004/01/14 23:44:01 jsalmon3 Exp $
 
 //@{
 
@@ -131,7 +131,7 @@
        TheMap.TileData = LoadGraphic(buf);
 #endif
 #ifdef USE_OPENGL
-       MakeTexture(TheMap.TileData, TheMap.TileData->Width, 
TheMap.TileData->Height);
+       MakeTexture(TheMap.TileGraphic, TheMap.TileGraphic->Width, 
TheMap.TileGraphic->Height);
 #endif
 
        TileSizeX = Tilesets[i]->TileSizeX;
@@ -745,7 +745,7 @@
        char** sp;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: tileset $Id: tileset.c,v 1.62 2004/01/14 
17:49:59 jsalmon3 Exp $\n\n");
+       CLprintf(file, ";;; MODULE: tileset $Id: tileset.c,v 1.63 2004/01/14 
23:44:01 jsalmon3 Exp $\n\n");
 
        //  Original number to internal tileset name
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]