[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/map minimap.c
From: |
Nehal Mistry |
Subject: |
[Stratagus-CVS] stratagus/src/map minimap.c |
Date: |
Wed, 26 Nov 2003 18:05:31 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Nehal Mistry <address@hidden> 03/11/26 18:05:31
Modified files:
src/map : minimap.c
Log message:
minimap works with SDL_Surface
Patches:
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.76 stratagus/src/map/minimap.c:1.77
--- stratagus/src/map/minimap.c:1.76 Fri Nov 21 22:00:21 2003
+++ stratagus/src/map/minimap.c Wed Nov 26 18:05:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: minimap.c,v 1.76 2003/11/22 03:00:21 nehalmistry Exp $
+// $Id: minimap.c,v 1.77 2003/11/26 23:05:30 nehalmistry Exp $
//@{
@@ -52,12 +52,485 @@
-- Variables
----------------------------------------------------------------------------*/
-local Graphic* MinimapTerrainGraphic; /// generated minimap terrain
#ifdef USE_SDL_SURFACE
-local SDL_Surface* MinimapGraphic; /// generated minimap
-#else
+local SDL_Surface* MinimapSurface; /// generated minimap
+local SDL_Surface* MinimapTerrainSurface; /// generated minimap terrain
+local int* Minimap2MapX; /// fast conversion table
+local int* Minimap2MapY; /// fast conversion table
+local int Map2MinimapX[MaxMapWidth]; /// fast conversion table
+local int Map2MinimapY[MaxMapHeight]; /// fast conversion table
+
+// MinimapScale:
+// 32x32 64x64 96x96 128x128 256x256 512x512 ...
+// *4 *2 *4/3 *1 *1/2 *1/4
+local int MinimapScaleX; /// Minimap scale to fit into window
+local int MinimapScaleY; /// Minimap scale to fit into window
+global int MinimapX; /// Minimap drawing position x offset
+global int MinimapY; /// Minimap drawing position y offset
+
+global int MinimapWithTerrain = 1; /// display minimap with terrain
+global int MinimapFriendly = 1; /// switch colors of friendly
units
+global int MinimapShowSelected = 1; /// highlight selected units
+
+local int OldMinimapCursorX; /// Save MinimapCursorX
+local int OldMinimapCursorY; /// Save MinimapCursorY
+local int OldMinimapCursorW; /// Save MinimapCursorW
+local int OldMinimapCursorH; /// Save MinimapCursorH
+local int OldMinimapCursorSize; /// Saved image size
+
+local SDL_Surface* OldMinimapCursorImage; /// Saved image behind cursor
+
+/**
+** Create a mini-map from the tiles of the map.
+**
+** @todo Scaling and scrolling the minmap is currently not supported.
+*/
+global void CreateMinimap(void)
+{
+ int n;
+ SDL_Rect srect;
+
+ if (TheMap.Width > TheMap.Height) { // Scale to biggest value.
+ n = TheMap.Width;
+ } else {
+ n = TheMap.Height;
+ }
+ MinimapScaleX = (TheUI.MinimapW * MINIMAP_FAC + n - 1) / n;
+ MinimapScaleY = (TheUI.MinimapH * MINIMAP_FAC + n - 1) / n;
+
+ MinimapX = ((TheUI.MinimapW * MINIMAP_FAC) / MinimapScaleX - TheMap.Width)
/ 2;
+ MinimapY = ((TheUI.MinimapH * MINIMAP_FAC) / MinimapScaleY -
TheMap.Height) / 2;
+ MinimapX = (TheUI.MinimapW - (TheMap.Width * MinimapScaleX) / MINIMAP_FAC)
/ 2;
+ MinimapY = (TheUI.MinimapH - (TheMap.Height * MinimapScaleY) /
MINIMAP_FAC) / 2;
+
+ DebugLevel0Fn("MinimapScale %d %d (%d %d), X off %d, Y off %d\n" _C_
+ MinimapScaleX / MINIMAP_FAC _C_ MinimapScaleY / MINIMAP_FAC _C_
+ MinimapScaleX _C_ MinimapScaleY _C_
+ MinimapX _C_ MinimapY);
+
+ //
+ // Calculate minimap fast lookup tables.
+ //
+ // FIXME: this needs to be recalculated during map load - the map size
+ // might have changed!
+ Minimap2MapX = calloc(sizeof(int), TheUI.MinimapW * TheUI.MinimapH);
+ Minimap2MapY = calloc(sizeof(int), TheUI.MinimapW * TheUI.MinimapH);
+ for (n = MinimapX; n < TheUI.MinimapW - MinimapX; ++n) {
+ Minimap2MapX[n] = ((n - MinimapX) * MINIMAP_FAC) / MinimapScaleX;
+ }
+ for (n = MinimapY; n < TheUI.MinimapH - MinimapY; ++n) {
+ Minimap2MapY[n] = (((n - MinimapY) * MINIMAP_FAC) / MinimapScaleY) *
TheMap.Width;
+ }
+ for (n = 0; n < TheMap.Width; ++n) {
+ Map2MinimapX[n] = (n * MinimapScaleX) / MINIMAP_FAC;
+ }
+ for (n = 0; n < TheMap.Height; ++n) {
+ Map2MinimapY[n] = (n * MinimapScaleY) / MINIMAP_FAC;
+ }
+
+ MinimapTerrainSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
TheUI.MinimapW,
+ TheUI.MinimapH, 8, 0, 0, 0, 0);
+ SDL_SetPalette(MinimapTerrainSurface, SDL_LOGPAL,
+ TheMap.TileGraphic->Surface->format->palette->colors, 0, 256);
+
+ MinimapSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, TheUI.MinimapW,
+ TheUI.MinimapH, 8, 0, 0, 0, 0);
+ SDL_SetPalette(MinimapSurface, SDL_LOGPAL,
+ TheMap.TileGraphic->Surface->format->palette->colors, 0, 256);
+
+ srect.x = TheUI.MinimapPosX - TheUI.MinimapPanelX;
+ srect.y = TheUI.MinimapPosY - TheUI.MinimapPanelY;
+ srect.w = TheUI.MinimapW;
+ srect.h = TheUI.MinimapH;
+ SDL_BlitSurface(TheUI.MinimapPanel.Graphic->Surface, &srect,
+ MinimapSurface, NULL);
+
+ if (!TheUI.MinimapTransparent) {
+ VideoFillRectangle(ColorBlack, MinimapX, MinimapY,
+ TheUI.MinimapW, TheUI.MinimapH);
+ }
+
+ UpdateMinimapTerrain();
+}
+
+/**
+** Update a mini-map from the tiles of the map.
+**
+** @todo FIXME: this is not correct should use SeenTile.
+**
+** FIXME: this can surely be sped up??
+*/
+global void UpdateMinimapTerrain(void)
+{
+ int mx;
+ int my;
+ int scalex;
+ int scaley;
+ int tilepitch;
+ int xofs;
+ int yofs;
+
+ if (!(scalex = (MinimapScaleX / MINIMAP_FAC))) {
+ scalex = 1;
+ }
+ if (!(scaley = (MinimapScaleY / MINIMAP_FAC))) {
+ scaley = 1;
+ }
+
+ tilepitch = TheMap.TileGraphic->Surface->w / TileSizeX;
+
+ SDL_LockSurface(MinimapTerrainSurface);
+ SDL_LockSurface(TheMap.TileGraphic->Surface);
+ //
+ // Pixel 7,6 7,14, 15,6 15,14 are taken for the minimap picture.
+ //
+ for (my = MinimapY; my < TheUI.MinimapH - MinimapY; ++my) {
+ for (mx = MinimapX; mx < TheUI.MinimapW - MinimapX; ++mx) {
+ int tile;
+
+ tile = TheMap.Fields[Minimap2MapX[mx] + Minimap2MapY[my]].Tile;
+
+ xofs = TileSizeX * (tile % tilepitch);
+ yofs = TileSizeY * (tile / tilepitch);
+
+ ((Uint8*)MinimapTerrainSurface->pixels)[mx + my * TheUI.MinimapW] =
+ ((Uint8*)TheMap.TileGraphic->Surface->pixels)
+ [xofs + 7 + (mx % scalex) * 8 + (yofs + 6 + (my % scaley) *
8) * TheMap.TileGraphic->Surface->w];
+ }
+ }
+ SDL_UnlockSurface(MinimapTerrainSurface);
+ SDL_UnlockSurface(TheMap.TileGraphic->Surface);
+}
+
+// FIXME: todo
+global void UpdateMinimapXY(int tx, int ty)
+{
+ int mx;
+ int my;
+ int x;
+ int y;
+ int scalex;
+ int scaley;
+ int xofs;
+ int yofs;
+ int tilepitch;
+
+ scalex = MinimapScaleX / MINIMAP_FAC;
+ if (scalex == 0) {
+ scalex = 1;
+ }
+ scaley = MinimapScaleY / MINIMAP_FAC;
+ if (scaley == 0) {
+ scaley = 1;
+ }
+
+ tilepitch = TheMap.TileGraphic->Surface->w / TileSizeX;
+
+ //
+ // Pixel 7,6 7,14, 15,6 15,14 are taken for the minimap picture.
+ //
+ SDL_LockSurface(MinimapTerrainSurface);
+
+ ty *= TheMap.Width;
+ for (my = MinimapY; my < TheUI.MinimapH - MinimapY; ++my) {
+ y = Minimap2MapY[my];
+ if (y < ty) {
+ continue;
+ }
+ if (y > ty) {
+ break;
+ }
+
+ for (mx = MinimapX; mx < TheUI.MinimapW - MinimapX; ++mx) {
+ int tile;
+
+ x = Minimap2MapX[mx];
+ if (x < tx) {
+ continue;
+ }
+ if (x > tx) {
+ break;
+ }
+
+ tile = TheMap.Fields[x + y].Tile;
+
+ xofs = TileSizeX * (tile % tilepitch);
+ yofs = TileSizeY * (tile / tilepitch);
+
+ // FIXME: does this work?
+ ((unsigned char*)MinimapTerrainSurface->pixels)[mx + my *
TheUI.MinimapW] =
+ ((unsigned char*)TheMap.TileGraphic->Surface->pixels)[xofs + 7
+
+ (mx % scalex) * 8 + (yofs + 6 + (my % scaley) * 8) * TileSizeX];
+// ((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my *
TheUI.MinimapW] =
+// TheMap.Tiles[tile][7 + (mx % scalex) * 8 + (6 + (my % scaley) *
8) * TileSizeX];
+ }
+ }
+ SDL_UnlockSurface(MinimapTerrainSurface);
+}
+
+global void UpdateMinimap(void)
+{
+ static int red_phase;
+ int red_phase_changed;
+ int mx;
+ int my;
+ UnitType* type;
+ Unit** table;
+ Unit* unit;
+ int w;
+ int h;
+ int h0;
+ int visiontype; // 0 unexplored, 1 explored, >1 visible.
+ SDL_Color color;
+
+ red_phase_changed = red_phase != (int)((FrameCounter / FRAMES_PER_SECOND)
& 1);
+ if (red_phase_changed) {
+ red_phase = !red_phase;
+ }
+
+ SDL_LockSurface(MinimapSurface);
+ SDL_LockSurface(MinimapTerrainSurface);
+ //
+ // Draw the terrain
+ //
+ for (my = 0; my < TheUI.MinimapH; ++my) {
+ for (mx = 0; mx < TheUI.MinimapW; ++mx) {
+ if (ReplayRevealMap) {
+ visiontype = 2;
+ } else {
+ visiontype = IsTileVisible(ThisPlayer, Minimap2MapX[mx],
Minimap2MapY[my] / TheMap.Width);
+ }
+
+ if (MinimapWithTerrain && (visiontype > 1 || (visiontype == 1 &&
((mx & 1) == (my & 1))))) {
+ ((Uint8*)MinimapSurface->pixels)[mx + my * TheUI.MinimapW] =
+ ((Uint8*)MinimapTerrainSurface->pixels)[mx + my *
TheUI.MinimapW];
+ } else if (visiontype > 0) {
+ ((Uint8*)MinimapSurface->pixels)[mx + my * TheUI.MinimapW] = 0;
// FIXME: black
+ }
+ }
+ }
+
+ SDL_UnlockSurface(MinimapTerrainSurface);
+
+ //
+ // Draw units on map
+ // FIXME: I should rewrite this completely
+ // FIXME: make a bitmap of the units, and update it with the moves
+ // FIXME: and other changes
+ //
+
+ table = &CorpseList;
+
+ while (*table) {
+
+ // Only for buildings?
+ if (!(*table)->Type->Building) {
+ table = &(*table)->Next;
+ continue;
+ }
+ if (!UnitDrawableOnMap(*table) && (*table)->SeenState != 3
+ && !(*table)->SeenDestroyed && (type = (*table)->SeenType) ) {
+ if( (*table)->Player->Player == PlayerNumNeutral ) {
+ color = (*table)->Type->NeutralMinimapColorRGB;
+ } else {
+ color = (*table)->Player->Color;
+ }
+
+ mx = 1 + MinimapX + Map2MinimapX[(*table)->X];
+ my = 1 + MinimapY + Map2MinimapY[(*table)->Y];
+ w = Map2MinimapX[type->TileWidth];
+ if (mx + w >= TheUI.MinimapW) { // clip right side
+ w = TheUI.MinimapW - mx;
+ }
+ h0 = Map2MinimapY[type->TileHeight];
+ if (my + h0 >= TheUI.MinimapH) { // clip bottom side
+ h0 = TheUI.MinimapH - my;
+ }
+ while (w-- >= 0) {
+ h = h0;
+ while (h-- >= 0) {
+ ((Uint8*)MinimapSurface)[mx + w + (my + h) *
TheUI.MinimapW] =
+ SDL_MapRGB(MinimapSurface->format, color.r, color.g,
color.b);
+ }
+ }
+ }
+ table = &(*table)->Next;
+ }
+
+ for (table = Units; table < Units + NumUnits; ++table) {
+
+ unit = *table;
+
+ //
+ // If the unit is not known on map don't draw it.
+ // This function should cover shared vision and stuff.
+ //
+ if (!UnitDrawableOnMap(unit) && !ReplayRevealMap) {
+ continue;
+ }
+
+ type = unit->Type;
+ //
+ // FIXME: We should force unittypes to have a certain color on the
minimap.
+ //
+ if (unit->Player->Player == PlayerNumNeutral) {
+ color = (*table)->Type->NeutralMinimapColorRGB;
+ } else if (unit->Player == ThisPlayer) {
+ if (unit->Attacked && unit->Attacked + ATTACK_BLINK_DURATION >
GameCycle &&
+ (red_phase || unit->Attacked + ATTACK_RED_DURATION >
GameCycle)) {
+ color = ColorRed;
+ } else if (MinimapShowSelected && unit->Selected) {
+ color = ColorWhite;
+ } else {
+ color = ColorGreen;
+ }
+ } else {
+ color = unit->Player->Color;
+ }
+
+ mx = 1 + MinimapX + Map2MinimapX[unit->X];
+ my = 1 + MinimapY + Map2MinimapY[unit->Y];
+ w = Map2MinimapX[type->TileWidth];
+ if (mx + w >= TheUI.MinimapW) { // clip right side
+ w = TheUI.MinimapW - mx;
+ }
+ h0 = Map2MinimapY[type->TileHeight];
+ if (my + h0 >= TheUI.MinimapH) { // clip bottom side
+ h0 = TheUI.MinimapH - my;
+ }
+ while (w-- >= 0) {
+ h = h0;
+ while (h-- >= 0) {
+ ((Uint8*)MinimapSurface->pixels)[mx + w + (my + h) *
TheUI.MinimapW] =
+ SDL_MapRGB(MinimapSurface->format, color.r, color.g,
color.b);
+ }
+ }
+
+ }
+ SDL_UnlockSurface(MinimapSurface);
+}
+
+global void DrawMinimap(int vx __attribute__((unused)),
+ int vy __attribute__((unused)))
+{
+ SDL_Rect drect;
+
+ drect.x = TheUI.MinimapPosX;
+ drect.y = TheUI.MinimapPosY;
+
+ SDL_BlitSurface(MinimapSurface, NULL, TheScreen, &drect);
+}
+
+
+/**
+** Convert minimap cursor X position to tile map coordinate.
+**
+** @param x Screen X pixel coordinate.
+** @return Tile X coordinate.
+*/
+global int ScreenMinimap2MapX(int x)
+{
+ int tx;
+
+ tx = (((x - TheUI.MinimapPosX - MinimapX) * MINIMAP_FAC) / MinimapScaleX);
+ if (tx < 0) {
+ return 0;
+ }
+ return tx < TheMap.Width ? tx : TheMap.Width - 1;
+}
+
+/**
+** Convert minimap cursor Y position to tile map coordinate.
+**
+** @param y Screen Y pixel coordinate.
+** @return Tile Y coordinate.
+*/
+global int ScreenMinimap2MapY(int y)
+{
+ int ty;
+
+ ty = (((y - TheUI.MinimapPosY - MinimapY) * MINIMAP_FAC) / MinimapScaleY);
+ if (ty < 0) {
+ return 0;
+ }
+ return ty < TheMap.Height ? ty : TheMap.Height - 1;
+}
+
+/**
+** Destroy mini-map.
+*/
+global void DestroyMinimap(void)
+{
+ SDL_FreeSurface(MinimapTerrainSurface);
+ MinimapTerrainSurface = NULL;
+ if (MinimapSurface) {
+ SDL_FreeSurface(MinimapSurface);
+ MinimapSurface = NULL;
+ }
+ free(Minimap2MapX);
+ Minimap2MapX = NULL;
+ free(Minimap2MapY);
+ Minimap2MapY = NULL;
+}
+
+/**
+** Hide minimap cursor.
+*/
+global void HideMinimapCursor(void)
+{
+ if (OldMinimapCursorW) {
+ LoadCursorRectangle(OldMinimapCursorImage,
+ OldMinimapCursorX, OldMinimapCursorY,
+ OldMinimapCursorW, OldMinimapCursorH);
+ OldMinimapCursorW = 0;
+ }
+}
+
+/**
+** Draw minimap cursor.
+**
+** @param vx View point X position.
+** @param vy View point Y position.
+*/
+global void DrawMinimapCursor(int vx, int vy)
+{
+ int x;
+ int y;
+ int w;
+ int h;
+ int i;
+
+ // Determine and save region below minimap cursor
+ OldMinimapCursorX = x =
+ TheUI.MinimapPosX + MinimapX + (vx * MinimapScaleX) / MINIMAP_FAC;
+ OldMinimapCursorY = y =
+ TheUI.MinimapPosY + MinimapY + (vy * MinimapScaleY) / MINIMAP_FAC;
+ OldMinimapCursorW = w =
+ (TheUI.SelectedViewport->MapWidth * MinimapScaleX) / MINIMAP_FAC;
+ OldMinimapCursorH = h =
+ (TheUI.SelectedViewport->MapHeight * MinimapScaleY) / MINIMAP_FAC;
+
+ i = (w + 1 + h) * 2 * TheScreen->format->BytesPerPixel;
+
+ if (OldMinimapCursorSize < i) {
+ if (OldMinimapCursorImage) {
+ OldMinimapCursorImage = realloc(OldMinimapCursorImage, i);
+ } else {
+ OldMinimapCursorImage = malloc(i);
+ }
+ DebugLevel3("Cursor memory %d\n" _C_ i);
+ OldMinimapCursorSize = i;
+ }
+ SaveCursorRectangle(OldMinimapCursorImage, x, y, w, h);
+
+ // Draw cursor as rectangle (Note: unclipped, as it is always visible)
+ VideoDrawTransRectangle(TheUI.ViewportCursorColor, x, y, w, h, 50);
+}
+
+#else // USE_SDL_SURFACE
+
+local Graphic* MinimapTerrainGraphic; /// generated minimap terrain
local VMemType* MinimapGraphic; /// generated minimap
-#endif
local int* Minimap2MapX; /// fast conversion table
local int* Minimap2MapY; /// fast conversion table
local int Map2MinimapX[MaxMapWidth]; /// fast conversion table
@@ -141,20 +614,8 @@
tile = TheMap.Fields[x + y].Tile;
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
- int xofs;
- int yofs;
- xofs = TileSizeX * (tile % TheMap.TileGraphic->Surface->w);
- yofs = TileSizeY * (tile / TheMap.TileGraphic->Surface->w);
- SDL_LockSurface(MinimapTerrainGraphic->Surface);
- ((unsigned char*)MinimapTerrainGraphic->Surface->pixels)[mx + my *
TheUI.MinimapW] =
- ((unsigned char*)TheMap.TileGraphic->Surface->pixels)[7 + (mx %
scalex) * 8 + (6 + (my % scaley) * 8) * TileSizeX];
- SDL_UnlockSurface(MinimapTerrainGraphic->Surface);
-#else
((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my *
TheUI.MinimapW] =
TheMap.Tiles[tile][7 + (mx % scalex) * 8 + (6 + (my % scaley) *
8) * TileSizeX];
-#endif
}
}
}
@@ -189,12 +650,8 @@
tile = TheMap.Fields[Minimap2MapX[mx] + Minimap2MapY[my]].Tile;
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
-#else
((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my *
TheUI.MinimapW] =
TheMap.Tiles[tile][7 + (mx % scalex) * 8 + (6 + (my % scaley) *
8) * TileSizeX];
-#endif
}
}
}
@@ -250,32 +707,12 @@
MinimapTerrainGraphic = NewGraphic(8, TheUI.MinimapW, TheUI.MinimapH);
-#ifdef USE_SDL_SURFACE
- MinimapGraphic = SDL_CreateRGBSurface(SDL_SWSURFACE, TheUI.MinimapW,
- TheUI.MinimapH, 8, RMASK, GMASK, BMASK, AMASK);
-#else
memset(MinimapTerrainGraphic->Frames, 0, TheUI.MinimapW * TheUI.MinimapH);
MinimapGraphic = calloc(TheUI.MinimapW * TheUI.MinimapH, sizeof(VMemType));
-#endif
// FIXME: looks too complicated
for (y = 0; y < TheUI.MinimapH; ++y) {
for (x = 0; x < TheUI.MinimapW; ++x) {
-#ifdef USE_SDL_SURFACE
- SDL_Color c;
- int b;
-
- c = TheUI.MinimapPanel.Graphic->Surface->format->palette->colors[
- x + (TheUI.MinimapPosX - TheUI.MinimapPanelX) + (y +
TheUI.MinimapPosY -
- TheUI.MinimapPanelY) * TheUI.MinimapPanel.Graphic->Width];
-
- b = MinimapGraphic->format->BytesPerPixel;
-
- // FIXME: rgb: todo: ack
-
-// ((char*)MinimapGraphic->pixels)[x * b + y * TheUI.MinimapW * b] =
-// VideoMapRGB(c.r, c.g, c.b);
-#else
Palette p;
// this only copies the panel background... honest.
p = GlobalPalette[
@@ -284,19 +721,13 @@
(y + TheUI.MinimapPosY - TheUI.MinimapPanelY) *
TheUI.MinimapPanel.Graphic->Width]];
MinimapGraphic[x + y * TheUI.MinimapW] = VideoMapRGB(p.r, p.g, p.b);
-#endif
}
}
if (!TheUI.MinimapTransparent) {
// make only the inner part which is going to be used black
for (y = MinimapY; y < TheUI.MinimapH - MinimapY; ++y) {
for (x = MinimapX; x < TheUI.MinimapW - MinimapX; ++x) {
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
- VideoDrawPixel(ColorBlack, x, y);
-#else
MinimapGraphic[x + y * TheUI.MinimapW] = ColorBlack;
-#endif
}
}
}
@@ -354,9 +785,6 @@
} else {
visiontype = IsTileVisible(ThisPlayer, Minimap2MapX[mx],
Minimap2MapY[my] / TheMap.Width);
}
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
-#else
if (MinimapWithTerrain && (visiontype > 1 || (visiontype == 1 &&
((mx & 1) == (my & 1))))) {
Palette p;
p = GlobalPalette[
@@ -365,7 +793,6 @@
} else if (visiontype > 0) {
MinimapGraphic[mx + my * TheUI.MinimapW] = ColorBlack;
}
-#endif
}
}
@@ -378,11 +805,6 @@
table = &CorpseList;
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
- (int)type = (int)unit = w = h = h0 = 0;
-#else
-
while (*table) {
VMemType color;
@@ -473,7 +895,6 @@
}
}
-#endif
}
/**
@@ -485,9 +906,6 @@
global void DrawMinimap(int vx __attribute__((unused)),
int vy __attribute__((unused)))
{
-#ifdef USE_SDL_SURFACE
- // FIXME: todo
-#else
int i;
int j;
@@ -542,7 +960,6 @@
break;
}
}
-#endif
}
/**
@@ -581,11 +998,7 @@
(TheUI.SelectedViewport->MapWidth * MinimapScaleX) / MINIMAP_FAC;
OldMinimapCursorH = h =
(TheUI.SelectedViewport->MapHeight * MinimapScaleY) / MINIMAP_FAC;
-#ifdef USE_SDL_SURFACE
- i = (w + 1 + h) * 2 * TheScreen->format->BytesPerPixel;
-#else
i = (w + 1 + h) * 2 * VideoTypeSize;
-#endif
if (OldMinimapCursorSize < i) {
if (OldMinimapCursorImage) {
OldMinimapCursorImage = realloc(OldMinimapCursorImage, i);
@@ -598,11 +1011,7 @@
SaveCursorRectangle(OldMinimapCursorImage, x, y, w, h);
// Draw cursor as rectangle (Note: unclipped, as it is always visible)
-#ifdef USE_SDL_SURFACE
- VideoDrawTransRectangle(TheUI.ViewportCursorColor, x, y, w, h, 50);
-#else
VideoDraw50TransRectangle(TheUI.ViewportCursorColor, x, y, w, h);
-#endif
}
/**
@@ -638,5 +1047,6 @@
}
return ty < TheMap.Height ? ty : TheMap.Height - 1;
}
+#endif
//@}
- [Stratagus-CVS] stratagus/src/map minimap.c,
Nehal Mistry <=