stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/unit ccl_unittype.c unit_draw.c u...


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src/unit ccl_unittype.c unit_draw.c u...
Date: 15 Jan 2004 13:11:11 +1100

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

Modified files:
        src/unit       : ccl_unittype.c unit_draw.c unittype.c 

Log message:
        USE_SDL_SURFACE is default

Patches:
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.129 
stratagus/src/unit/ccl_unittype.c:1.130
--- stratagus/src/unit/ccl_unittype.c:1.129     Sun Jan 11 07:54:42 2004
+++ stratagus/src/unit/ccl_unittype.c   Thu Jan 15 13:11:09 2004
@@ -5,12 +5,12 @@
 //     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
 //             \/                  \/          \//_____/            \/
 //  ______________________                           ______________________
-//                       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 ccl_unittype.c -       The unit-type ccl functions. */
+/address@hidden ccl_unittype.c - The unit-type ccl functions. */
 //
-//     (c) Copyright 1999-2003 by Lutz Sammer and Jimmy Salmon
+//      (c) Copyright 1999-2004 by Lutz Sammer 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
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.129 2004/01/10 20:54:42 jsalmon3 Exp $
+//      $Id: ccl_unittype.c,v 1.130 2004/01/15 02:11:09 jsalmon3 Exp $
 
 //@{
 
@@ -345,7 +345,6 @@
                                lua_pushstring(l, "incorrect argument");
                                lua_error(l);
                        }
-#ifdef USE_SDL_SURFACE
                        lua_rawgeti(l, -1, 1);
                        type->NeutralMinimapColorRGB.r = LuaToNumber(l, -1);
                        lua_pop(l, 1);
@@ -355,17 +354,6 @@
                        lua_rawgeti(l, -1, 3);
                        type->NeutralMinimapColorRGB.b = LuaToNumber(l, -1);
                        lua_pop(l, 1);
-#else
-                       lua_rawgeti(l, -1, 1);
-                       type->NeutralMinimapColorRGB.D24.a = LuaToNumber(l, -1);
-                       lua_pop(l, 1);
-                       lua_rawgeti(l, -1, 2);
-                       type->NeutralMinimapColorRGB.D24.b = LuaToNumber(l, -1);
-                       lua_pop(l, 1);
-                       lua_rawgeti(l, -1, 3);
-                       type->NeutralMinimapColorRGB.D24.c = LuaToNumber(l, -1);
-                       lua_pop(l, 1);
-#endif
                } else if (!strcmp(value, "BoxSize")) {
                        if (!lua_istable(l, -1) || luaL_getn(l, -1) != 2) {
                                lua_pushstring(l, "incorrect argument");
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.204 
stratagus/src/unit/unit_draw.c:1.205
--- stratagus/src/unit/unit_draw.c:1.204        Thu Jan 15 09:31:11 2004
+++ stratagus/src/unit/unit_draw.c      Thu Jan 15 13:11:09 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: unit_draw.c,v 1.204 2004/01/14 22:31:11 nobody_ Exp $
+//      $Id: unit_draw.c,v 1.205 2004/01/15 02:11:09 jsalmon3 Exp $
 
 //@{
 
@@ -93,13 +93,8 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void (*DrawSelection)(Uint32 color, int x1, int y1,
        int x2, int y2) = DrawSelectionNone;
-#else
-global void (*DrawSelection)(VMemType color, int x1, int y1,
-       int x2, int y2) = DrawSelectionNone;
-#endif
 
 /*----------------------------------------------------------------------------
 --             Functions
@@ -119,16 +114,15 @@
 **
 **             @return                         Color for selection, or NULL if 
not selected.
 */
-#ifdef USE_SDL_SURFACE
 local Uint32* SelectionColor(const Unit* unit)
 {
-       Uint32 *color;
+       Uint32* color;
 
        color = malloc(sizeof(Uint32));
 
        // FIXME: make these colors customizable via CVS
 
-       if (EditorRunning && unit==UnitUnderCursor &&
+       if (EditorRunning && unit == UnitUnderCursor &&
                        EditorState == EditorSelecting) {
                *color = ColorWhite;
                return color;
@@ -159,36 +153,6 @@
        }
        return NULL;
 }
-#else
-local VMemType* SelectionColor(const Unit* unit)
-{
-       if (EditorRunning && unit==UnitUnderCursor &&
-                       EditorState == EditorSelecting) {
-               return &ColorWhite;
-       }
-
-       if (unit->Selected || (unit->Blink & 1)) {
-               if (unit->Player->Player == PlayerNumNeutral) {
-                       return &ColorYellow;
-               }
-               // FIXME: better allied?
-               if (unit->Player == ThisPlayer) {
-                       return &ColorGreen;
-               }
-               if (IsEnemy(ThisPlayer, unit)) {
-                       return &ColorRed;
-               }
-               return &unit->Player->Color;
-       }
-
-       // If building mark all own buildings
-       if (CursorBuilding && unit->Type->Building &&
-                       unit->Player == ThisPlayer) {
-               return &ColorGray;
-       }
-       return NULL;
-}
-#endif
 
 /**
 **             Show selection marker around an unit.
@@ -197,11 +161,7 @@
 */
 global void DrawUnitSelection(const Unit* unit)
 {
-#ifdef USE_SDL_SURFACE
        Uint32* color;
-#else
-       VMemType* color;
-#endif
        int x;
        int y;
        UnitType* type;
@@ -219,9 +179,7 @@
                type->TileHeight * TileSizeY / 2 - type->BoxHeight/2 -
                (type->Height - VideoGraphicHeight(type->Sprite)) / 2;
        DrawSelection(*color, x, y, x + type->BoxWidth, y + type->BoxHeight);
-#ifdef USE_SDL_SURFACE
        free(color);
-#endif
 }
 
 /**
@@ -231,17 +189,10 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionNone(Uint32 color, int x1, int y1,
        int x2, int y2)
 {
 }
-#else
-global void DrawSelectionNone(VMemType color, int x1, int y1,
-       int x2, int y2)
-{
-}
-#endif
 
 /**
 **             Show selected units with circle.
@@ -250,13 +201,8 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionCircle(Uint32 color, int x1, int x2,
        int y1, int y2)
-#else
-global void DrawSelectionCircle(VMemType color, int x1, int x2,
-       int y1, int y2)
-#endif
 {
        VideoDrawCircleClip(color, (x1 + x2) / 2, (y1 + y2) / 2,
                min((x2 - x1) / 2, (y2 - y1) / 2));
@@ -271,21 +217,11 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionCircleWithTrans(Uint32 color, int x1, int y1,
        int x2, int y2)
-#else
-global void DrawSelectionCircleWithTrans(VMemType color, int x1, int y1,
-       int x2, int y2)
-#endif
 {
-#ifdef USE_SDL_SURFACE
        VideoFillTransCircleClip(color, (x1 + x2) / 2, (y1 + y2) / 2,
                min((x2 - x1) / 2, (y2 - y1) / 2), 95);
-#else
-       VideoFill75TransCircleClip(color, (x1 + x2) / 2, (y1 + y2) / 2,
-               min((x2 - x1) / 2, (y2 - y1) / 2));
-#endif
        VideoDrawCircleClip(color, (x1 + x2) / 2, (y1 + y2) / 2,
                min((x2 - x1) / 2, (y2 - y1) / 2));
 }
@@ -297,13 +233,8 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionRectangle(Uint32 color, int x1, int y1,
        int x2, int y2)
-#else
-global void DrawSelectionRectangle(VMemType color, int x1, int y1,
-       int x2, int y2)
-#endif
 {
        VideoDrawRectangleClip(color, x1, y1, x2 - x1, y2 - y1);
 }
@@ -315,22 +246,12 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionRectangleWithTrans(Uint32 color, int x1, int y1,
        int x2, int y2)
-#else
-global void DrawSelectionRectangleWithTrans(VMemType color, int x1, int y1,
-       int x2, int y2)
-#endif
 {
        VideoDrawRectangleClip(color, x1, y1, x2 - x1, y2 - y1);
-#ifdef USE_SDL_SURFACE
        VideoFillTransRectangleClip(color, x1 + 1, y1 + 1,
                x2 - x1 - 2, y2 - y1 - 2, 75);
-#else
-       VideoFill75TransRectangleClip(color, x1 + 1, y1 + 1,
-               x2 - x1 - 2, y2 - y1 - 2);
-#endif
 }
 
 /**
@@ -340,13 +261,8 @@
 **             @param x1,y1            Coordinates of the top left corner.
 **             @param x2,y2            Coordinates of the bottom right corner.
 */
-#ifdef USE_SDL_SURFACE
 global void DrawSelectionCorners(Uint32 color, int x1, int y1,
        int x2, int y2)
-#else
-global void DrawSelectionCorners(VMemType color, int x1, int y1,
-       int x2, int y2)
-#endif
 {
 #define CORNER_PIXELS 6
 
@@ -744,7 +660,7 @@
 {
 #if 0
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.204 
2004/01/14 22:31:11 nobody_ Exp $\n\n");
+       CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.205 
2004/01/15 02:11:09 jsalmon3 Exp $\n\n");
 
        CLprintf(file, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
                ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -940,11 +856,7 @@
 local void DrawDecoration(const Unit* unit, const UnitType* type, int x, int y)
 {
        int f;
-#ifdef USE_SDL_SURFACE
        Uint32 color;
-#else
-       VMemType color;
-#endif
        int w;
        int x1;
        int y1;
@@ -1570,13 +1482,8 @@
 {
        int x2;
        int y2;
-#ifdef USE_SDL_SURFACE
        Uint32 color;
        Uint32 e_color;
-#else
-       VMemType color;
-       VMemType e_color;
-#endif
        int dest;
 
        GetOrderPosition(unit, order, &x2, &y2);
@@ -1760,7 +1667,6 @@
        //
        if (NumSelected == 1 && unit->Selected) {
                if (ShowSightRange) {
-#ifdef USE_SDL_SURFACE
                        if (ShowSightRange == 1) {
                                VideoFillTransRectangleClip(ColorGreen,
                                        x + type->TileWidth * TileSizeX / 2 - 
stats->SightRange * TileSizeX,
@@ -1773,20 +1679,6 @@
                                        y + type->TileHeight * TileSizeY / 2,
                                        min((stats->SightRange + 
(type->TileWidth - 1) / 2) * TileSizeX,
                                        (stats->SightRange + (type->TileHeight 
- 1) / 2) * TileSizeY), 75);
-#else
-                       if (ShowSightRange == 1) {
-                               VideoFill75TransRectangleClip(ColorGreen,
-                                       x + type->TileWidth * TileSizeX / 2 - 
stats->SightRange * TileSizeX,
-                                       y + type->TileHeight * TileSizeY / 2 - 
stats->SightRange * TileSizeY,
-                                       stats->SightRange * TileSizeX * 2,
-                                       stats->SightRange * TileSizeY * 2);
-                       } else if (ShowSightRange == 2) {
-                               VideoFill75TransCircleClip(ColorGreen,
-                                       x + type->TileWidth * TileSizeX / 2,
-                                       y + type->TileHeight * TileSizeY / 2,
-                                       min((stats->SightRange + 
(type->TileWidth - 1) / 2) * TileSizeX,
-                                       (stats->SightRange + (type->TileHeight 
- 1) / 2) * TileSizeY));
-#endif
                        } else {
                                VideoDrawCircleClip(ColorGreen,
                                        x + type->TileWidth * TileSizeX / 2,
@@ -1828,32 +1720,10 @@
 */
 local void GraphicUnitPixels(const Unit* unit, const Graphic* sprite)
 {
-#ifdef USE_SDL_SURFACE
        SDL_SetColors(sprite->Surface, unit->Colors->Colors, 208, 4);
        if (sprite->SurfaceFlip) {
                SDL_SetColors(sprite->SurfaceFlip, unit->Colors->Colors, 208, 
4);
        }
-#else
-       switch (VideoBpp) {
-               case 8:
-                       *((struct __4pixel8__*)(((VMemType8*)sprite->Pixels) + 
208)) =
-                               unit->Colors->Depth8;
-                       break;
-               case 15:
-               case 16:
-                       *((struct __4pixel16__*)(((VMemType16*)sprite->Pixels) 
+ 208)) =
-                               unit->Colors->Depth16;
-                       break;
-               case 24:
-                       *((struct __4pixel24__*)(((VMemType24*)sprite->Pixels) 
+ 208)) =
-                               unit->Colors->Depth24;
-                       break;
-               case 32:
-                       *((struct __4pixel32__*)(((VMemType32*)sprite->Pixels) 
+ 208)) =
-                               unit->Colors->Depth32;
-                       break;
-       }
-#endif
 }
 
 #ifdef USE_OPENGL
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.138 stratagus/src/unit/unittype.c:1.139
--- stratagus/src/unit/unittype.c:1.138 Thu Jan 15 04:50:05 2004
+++ stratagus/src/unit/unittype.c       Thu Jan 15 13:11:09 2004
@@ -5,12 +5,12 @@
 //     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
 //             \/                  \/          \//_____/            \/
 //  ______________________                           ______________________
-//                       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 unittype.c     -       The unit types. */
+/address@hidden unittype.c - The unit types. */
 //
-//     (c) Copyright 1998-2003 by Lutz Sammer and Jimmy Salmon
+//      (c) Copyright 1998-2004 by Lutz Sammer 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
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.138 2004/01/14 17:50:05 jsalmon3 Exp $
+//      $Id: unittype.c,v 1.139 2004/01/15 02:11:09 jsalmon3 Exp $
 
 //@{
 
@@ -782,15 +782,9 @@
                CLprintf(file, "  'not-selectable\n");
        }
 
-#ifdef USE_SDL_SURFACE
        CLprintf(file, "  'neutral-minimap-color '(%d %d %d)\n",
                type->NeutralMinimapColorRGB.r,type->NeutralMinimapColorRGB.g,
                type->NeutralMinimapColorRGB.b);
-#else
-       CLprintf(file, "  'neutral-minimap-color '(%d %d %d)\n",
-               
type->NeutralMinimapColorRGB.D24.a,type->NeutralMinimapColorRGB.D24.b,
-               type->NeutralMinimapColorRGB.D24.c);
-#endif
 
        CLprintf(file, "  'sight-range %d", type->_SightRange);
        if (all || type->ReactRangeComputer) {
@@ -1193,7 +1187,7 @@
 //     char** sp;
 
        CLprintf(file, "\n--- -----------------------------------------\n");
-       CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.138 
2004/01/14 17:50:05 jsalmon3 Exp $\n\n");
+       CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.139 
2004/01/15 02:11:09 jsalmon3 Exp $\n\n");
 #if 0
        // Original number to internal unit-type name.
 
@@ -1378,9 +1372,7 @@
                        ShowLoadProgress("Unit `%s'", file);
                        type->ShadowSprite = LoadSprite(file, type->ShadowWidth,
                                type->ShadowHeight);
-#ifdef USE_SDL_SURFACE
                        FlipGraphic(type->ShadowSprite);
-#endif
                }
 
                //  Load empty/loaded graphics
@@ -1392,18 +1384,14 @@
                                                ShowLoadProgress("Unit `%s'", 
file);
                                                resinfo->SpriteWhenLoaded = 
LoadSprite(file, type->Width,
                                                        type->Height);
-#ifdef USE_SDL_SURFACE
                                                
FlipGraphic(resinfo->SpriteWhenLoaded);
-#endif
                                        }
                                        if ((file = resinfo->FileWhenEmpty)) {
                                                file = strcat(strcpy(buf, 
"graphics/"), file);
                                                ShowLoadProgress("Unit `%s'", 
file);
                                                resinfo->SpriteWhenEmpty = 
LoadSprite(file, type->Width,
                                                        type->Height);
-#ifdef USE_SDL_SURFACE
                                                
FlipGraphic(resinfo->SpriteWhenEmpty);
-#endif
                                        }
                                }
                        }
@@ -1431,9 +1419,7 @@
                        file = strcat(strcpy(buf, "graphics/"), file);
                        ShowLoadProgress("Unit `%s'", file);
                        type->Sprite = LoadSprite(file, type->Width, 
type->Height);
-#ifdef USE_SDL_SURFACE
                        FlipGraphic(type->Sprite);
-#endif
                }
        }
 




reply via email to

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