[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/video.h map/map_draw.c ma...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src include/video.h map/map_draw.c ma... |
Date: |
15 Jan 2004 17:44:31 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/15 17:44:30
Modified files:
src/include : video.h
src/map : map_draw.c map_fog.c minimap.c
src/stratagus : player.c
src/ui : ui.c
src/unit : unittype.c
src/video : linedraw.c sdl.c sprite.c sweepline.c
Log message:
More opengl updates
Patches:
Index: stratagus/src/include/video.h
diff -u stratagus/src/include/video.h:1.115 stratagus/src/include/video.h:1.116
--- stratagus/src/include/video.h:1.115 Thu Jan 15 15:20:41 2004
+++ stratagus/src/include/video.h Thu Jan 15 17:44:24 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: video.h,v 1.115 2004/01/15 04:20:41 jsalmon3 Exp $
+// $Id: video.h,v 1.116 2004/01/15 06:44:24 jsalmon3 Exp $
#ifndef __VIDEO_H__
#define __VIDEO_H__
@@ -322,6 +322,12 @@
extern int ColorIconCycleEnd; /// color # end for
color cycling
extern int ColorBuildingCycleStart; /// color # start for color
cycling
extern int ColorBuildingCycleEnd; /// color # end for color
cycling
+
+#ifndef USE_OPENGL
+#define VideoMapRGB(f, r, g, b) SDL_MapRGB((f), (r), (g), (b))
+#else
+#define VideoMapRGB(f, r, g, b) (((r) << 16) | ((g) << 8) | (b))
+#endif
#ifndef USE_OPENGL
/// Draw pixel unclipped.
Index: stratagus/src/map/map_draw.c
diff -u stratagus/src/map/map_draw.c:1.60 stratagus/src/map/map_draw.c:1.61
--- stratagus/src/map/map_draw.c:1.60 Thu Jan 15 13:06:21 2004
+++ stratagus/src/map/map_draw.c Thu Jan 15 17:44:25 2004
@@ -29,7 +29,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_draw.c,v 1.60 2004/01/15 02:06:21 jsalmon3 Exp $
+// $Id: map_draw.c,v 1.61 2004/01/15 06:44:25 jsalmon3 Exp $
//@{
@@ -1499,25 +1499,25 @@
g = TheMap.TileGraphic;
sx = x;
ex = sx + TileSizeX;
- ey = VideoHeight - y;
- sy = ey - TileSizeY;
+ sy = y;
+ ey = sy + TileSizeY;
t = tile % (g->Width / TileSizeX);
- stx=(GLfloat)t * TileSizeX / g->Width * g->TextureWidth;
- etx=(GLfloat)(t * TileSizeX + TileSizeX) / g->Width * g->TextureWidth;
+ 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;
+ 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);
+ glTexCoord2f(stx, sty);
glVertex2i(sx, sy);
- glTexCoord2f(stx, 1.0f - sty);
+ glTexCoord2f(stx, ety);
glVertex2i(sx, ey);
- glTexCoord2f(etx, 1.0f - sty);
+ glTexCoord2f(etx, ety);
glVertex2i(ex, ey);
- glTexCoord2f(etx, 1.0f - ety);
+ glTexCoord2f(etx, sty);
glVertex2i(ex, sy);
glEnd();
}
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.142 stratagus/src/map/map_fog.c:1.143
--- stratagus/src/map/map_fog.c:1.142 Thu Jan 15 13:06:22 2004
+++ stratagus/src/map/map_fog.c Thu Jan 15 17:44:25 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.142 2004/01/15 02:06:22 jsalmon3 Exp $
+// $Id: map_fog.c,v 1.143 2004/01/15 06:44:25 jsalmon3 Exp $
//@{
@@ -588,16 +588,16 @@
g = TheMap.TileGraphic;
sx = x;
ex = sx + TileSizeX;
- ey = VideoHeight - y;
- sy = ey - TileSizeY;
+ sy = y;
+ ey = sy + TileSizeY;
glDisable(GL_TEXTURE_2D);
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
glBegin(GL_QUADS);
glVertex2i(sx, sy);
- glVertex2i(sx, ey);
+ glVertex2i(sx, sy);
+ glVertex2i(ex, ey);
glVertex2i(ex, ey);
- glVertex2i(ex, sy);
glEnd();
glEnable(GL_TEXTURE_2D);
}
@@ -943,7 +943,7 @@
// FIXME: Make the color configurable
SDL_GetRGB(ColorBlack, TheScreen->format, &r, &g, &b);
- color = SDL_MapRGB(s->format, r, g, b);
+ color = VideoMapRGB(s->format, r, g, b);
SDL_FillRect(s, NULL, color);
OnlyFogSurface = SDL_DisplayFormat(s);
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.92 stratagus/src/map/minimap.c:1.93
--- stratagus/src/map/minimap.c:1.92 Thu Jan 15 13:06:22 2004
+++ stratagus/src/map/minimap.c Thu Jan 15 17:44:25 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: minimap.c,v 1.92 2004/01/15 02:06:22 jsalmon3 Exp $
+// $Id: minimap.c,v 1.93 2004/01/15 06:44:25 jsalmon3 Exp $
//@{
@@ -293,7 +293,7 @@
// FIXME: We should force unittypes to have a certain color on the
minimap.
//
if (unit->Player->Player == PlayerNumNeutral) {
- color = SDL_MapRGB(TheScreen->format,
+ color = VideoMapRGB(TheScreen->format,
unit->Type->NeutralMinimapColorRGB.r,
unit->Type->NeutralMinimapColorRGB.g,
unit->Type->NeutralMinimapColorRGB.b);
@@ -325,7 +325,7 @@
while (h-- >= 0) {
SDL_GetRGB(color, TheScreen->format, &c.r, &c.g, &c.b);
((Uint8*)MinimapSurface->pixels)[mx + w + (my + h) *
TheUI.MinimapW] =
- SDL_MapRGB(MinimapSurface->format, c.r, c.g,
c.b);
+ VideoMapRGB(MinimapSurface->format, c.r, c.g,
c.b);
}
}
}
@@ -363,7 +363,7 @@
((Uint8*)MinimapTerrainSurface->pixels)[mx + my * TheUI.MinimapW];
} else if (visiontype > 0) {
((Uint8*)MinimapSurface->pixels)[mx + my *
TheUI.MinimapW] =
- SDL_MapRGB(MinimapSurface->format, 0,
0, 0);
+ VideoMapRGB(MinimapSurface->format, 0,
0, 0);
}
}
}
Index: stratagus/src/stratagus/player.c
diff -u stratagus/src/stratagus/player.c:1.111
stratagus/src/stratagus/player.c:1.112
--- stratagus/src/stratagus/player.c:1.111 Thu Jan 15 13:07:39 2004
+++ stratagus/src/stratagus/player.c Thu Jan 15 17:44:26 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: player.c,v 1.111 2004/01/15 02:07:39 jsalmon3 Exp $
+// $Id: player.c,v 1.112 2004/01/15 06:44:26 jsalmon3 Exp $
//@{
@@ -157,7 +157,7 @@
Players[p].Type = PlayerNobody;
}
for (x = 0; x < 4; ++x) {
- PlayerColors[p][x] = SDL_MapRGB(TheScreen->format,
PlayerColorsRGB[p][x].r,
+ PlayerColors[p][x] = VideoMapRGB(TheScreen->format,
PlayerColorsRGB[p][x].r,
PlayerColorsRGB[p][x].g,
PlayerColorsRGB[p][x].b);
}
}
@@ -207,7 +207,7 @@
int j;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: players $Id: player.c,v 1.111 2004/01/15
02:07:39 jsalmon3 Exp $\n\n");
+ CLprintf(file, "--- MODULE: players $Id: player.c,v 1.112 2004/01/15
06:44:26 jsalmon3 Exp $\n\n");
#if 0
//
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.99 stratagus/src/ui/ui.c:1.100
--- stratagus/src/ui/ui.c:1.99 Thu Jan 15 13:09:57 2004
+++ stratagus/src/ui/ui.c Thu Jan 15 17:44:27 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.99 2004/01/15 02:09:57 jsalmon3 Exp $
+// $Id: ui.c,v 1.100 2004/01/15 06:44:27 jsalmon3 Exp $
//@{
@@ -183,7 +183,7 @@
SetViewportMode(VIEWPORT_SINGLE);
}
- TheUI.CompletedBarColor = SDL_MapRGB(TheScreen->format,
+ TheUI.CompletedBarColor = VideoMapRGB(TheScreen->format,
TheUI.CompletedBarColorRGB.r,
TheUI.CompletedBarColorRGB.g,
TheUI.CompletedBarColorRGB.b);
@@ -677,7 +677,7 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.99 2004/01/15 02:09:57
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.100 2004/01/15 06:44:27
jsalmon3 Exp $\n\n");
// Scrolling
CLprintf(file, "(set-mouse-scroll! %s)\n", TheUI.MouseScroll ? "#t" :
"#f");
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.139 stratagus/src/unit/unittype.c:1.140
--- stratagus/src/unit/unittype.c:1.139 Thu Jan 15 13:11:09 2004
+++ stratagus/src/unit/unittype.c Thu Jan 15 17:44:28 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.139 2004/01/15 02:11:09 jsalmon3 Exp $
+// $Id: unittype.c,v 1.140 2004/01/15 06:44:28 jsalmon3 Exp $
//@{
@@ -1187,7 +1187,7 @@
// char** sp;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.139
2004/01/15 02:11:09 jsalmon3 Exp $\n\n");
+ CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.140
2004/01/15 06:44:28 jsalmon3 Exp $\n\n");
#if 0
// Original number to internal unit-type name.
@@ -1536,7 +1536,7 @@
free(type->BoolFlag);
free(type->CanTargetFlag);
- if (type->SameSprite) {
+ if (type->SameSprite) {
free(type->SameSprite);
}
if (type->File[0]) {
@@ -1619,8 +1619,8 @@
VideoSafeFree(type->Sprite);
}
#ifdef USE_OPENGL
- for (i = 0; i < PlayerMax; ++i) {
- VideoSafeFree(type->PlayerColorSprite[i]);
+ for (j = 0; j < PlayerMax; ++j) {
+ VideoSafeFree(type->PlayerColorSprite[j]);
}
#endif
free(UnitTypes[i]);
Index: stratagus/src/video/linedraw.c
diff -u stratagus/src/video/linedraw.c:1.68 stratagus/src/video/linedraw.c:1.69
--- stratagus/src/video/linedraw.c:1.68 Thu Jan 15 15:20:42 2004
+++ stratagus/src/video/linedraw.c Thu Jan 15 17:44:29 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: linedraw.c,v 1.68 2004/01/15 04:20:42 jsalmon3 Exp $
+// $Id: linedraw.c,v 1.69 2004/01/15 06:44:29 jsalmon3 Exp $
//@{
@@ -657,7 +657,7 @@
24, RMASK, GMASK, BMASK, 0);
SDL_GetRGB(color, TheScreen->format, &r, &g, &b);
- color = SDL_MapRGB(s->format, r, g, b);
+ color = VideoMapRGB(s->format, r, g, b);
SDL_FillRect(s, NULL, color);
Index: stratagus/src/video/sdl.c
diff -u stratagus/src/video/sdl.c:1.115 stratagus/src/video/sdl.c:1.116
--- stratagus/src/video/sdl.c:1.115 Thu Jan 15 15:20:42 2004
+++ stratagus/src/video/sdl.c Thu Jan 15 17:44:29 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sdl.c,v 1.115 2004/01/15 04:20:42 jsalmon3 Exp $
+// $Id: sdl.c,v 1.116 2004/01/15 06:44:29 jsalmon3 Exp $
//@{
@@ -259,15 +259,15 @@
InitOpenGL();
#endif
- ColorBlack = SDL_MapRGB(TheScreen->format, 0, 0, 0);
- ColorDarkGreen = SDL_MapRGB(TheScreen->format, 48, 100, 4);
- ColorBlue = SDL_MapRGB(TheScreen->format, 0, 0, 252);
- ColorOrange = SDL_MapRGB(TheScreen->format, 248, 140, 20);
- ColorWhite = SDL_MapRGB(TheScreen->format, 252, 248, 240);
- ColorGray = SDL_MapRGB(TheScreen->format, 128, 128, 128);
- ColorRed = SDL_MapRGB(TheScreen->format, 252, 0, 0);
- ColorGreen = SDL_MapRGB(TheScreen->format, 0, 252, 0);
- ColorYellow = SDL_MapRGB(TheScreen->format, 252, 252, 0);
+ ColorBlack = VideoMapRGB(TheScreen->format, 0, 0, 0);
+ ColorDarkGreen = VideoMapRGB(TheScreen->format, 48, 100, 4);
+ ColorBlue = VideoMapRGB(TheScreen->format, 0, 0, 252);
+ ColorOrange = VideoMapRGB(TheScreen->format, 248, 140, 20);
+ ColorWhite = VideoMapRGB(TheScreen->format, 252, 248, 240);
+ ColorGray = VideoMapRGB(TheScreen->format, 128, 128, 128);
+ ColorRed = VideoMapRGB(TheScreen->format, 252, 0, 0);
+ ColorGreen = VideoMapRGB(TheScreen->format, 0, 252, 0);
+ ColorYellow = VideoMapRGB(TheScreen->format, 252, 252, 0);
DebugLevel3Fn("Video init ready %d %d\n" _C_ VideoDepth _C_ VideoBpp);
Index: stratagus/src/video/sprite.c
diff -u stratagus/src/video/sprite.c:1.63 stratagus/src/video/sprite.c:1.64
--- stratagus/src/video/sprite.c:1.63 Thu Jan 15 15:20:43 2004
+++ stratagus/src/video/sprite.c Thu Jan 15 17:44:29 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sprite.c,v 1.63 2004/01/15 04:20:43 jsalmon3 Exp $
+// $Id: sprite.c,v 1.64 2004/01/15 06:44:29 jsalmon3 Exp $
//@{
@@ -226,18 +226,18 @@
sx = x;
ex = sx + sprite->Width;
- ey = VideoHeight - y;
- sy = ey - sprite->Height;
+ sy = y;
+ ey = sy + sprite->Height;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 1.0f - sprite->TextureHeight);
+ glTexCoord2f(0.0f, 0.0f);
glVertex2i(sx, sy);
- glTexCoord2f(0.0f, 1.0f);
+ glTexCoord2f(0.0f, sprite->TextureHeight);
glVertex2i(sx, ey);
- glTexCoord2f(sprite->TextureWidth, 1.0f);
+ glTexCoord2f(sprite->TextureWidth, sprite->TextureHeight);
glVertex2i(ex, ey);
- glTexCoord2f(sprite->TextureWidth, 1.0f - sprite->TextureHeight);
+ glTexCoord2f(sprite->TextureWidth, 0.0f);
glVertex2i(ex, sy);
glEnd();
}
@@ -300,8 +300,8 @@
svx = x;
evx = svx + w;
- evy = VideoHeight - y;
- svy = evy - h;
+ svy = y;
+ evy = svy + h;
if (w < sprite->Width) {
if (ox == 0) {
@@ -312,8 +312,8 @@
}
stx = (GLfloat)ox / sprite->Width * sprite->TextureWidth;
etx = (GLfloat)(ox + w) / sprite->Width * sprite->TextureWidth;
- ety = 1.0f - (GLfloat)oy / sprite->Height * sprite->TextureHeight;
- sty = 1.0f - (GLfloat)(oy + h) / sprite->Height * sprite->TextureHeight;
+ sty = (GLfloat)oy / sprite->Height * sprite->TextureHeight;
+ ety = (GLfloat)(oy + h) / sprite->Height * sprite->TextureHeight;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
Index: stratagus/src/video/sweepline.c
diff -u stratagus/src/video/sweepline.c:1.11
stratagus/src/video/sweepline.c:1.12
--- stratagus/src/video/sweepline.c:1.11 Sat Dec 20 16:33:50 2003
+++ stratagus/src/video/sweepline.c Thu Jan 15 17:44:29 2004
@@ -4,12 +4,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 sweepline.c - Invalidate rectangles from given marked
areas *///
-// (c) Copyright 2002-2003 by Lutz Sammer and Stephan Rasenberg
+/address@hidden sweepline.c - Invalidate rectangles from given marked areas
*///
+//
+// (c) Copyright 2002-2004 by Lutz Sammer and Stephan Rasenberg
//
// 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
@@ -25,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sweepline.c,v 1.11 2003/12/20 05:33:50 jsalmon3 Exp $
+// $Id: sweepline.c,v 1.12 2004/01/15 06:44:29 jsalmon3 Exp $
//@{
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@@ -45,7 +46,7 @@
#include "sweepline.h"
/*----------------------------------------------------------------------------
--- Declarations
+-- Declarations
----------------------------------------------------------------------------*/
/**
@@ -113,13 +114,13 @@
/*----------------------------------------------------------------------------
--- Externals
+-- Externals
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
--- Variables
+-- Variables
----------------------------------------------------------------------------*/
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/video.h map/map_draw.c ma...,
address@hidden <=