____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

minimap.cpp File Reference

The minimap. More...

#include <string.h>
#include "stratagus.h"
#include "video.h"
#include "map.h"
#include "minimap.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "ui.h"
#include "editor.h"
#include "patch.h"
#include "patch_type.h"

Go to the source code of this file.

Classes

struct  MinimapEvent

Defines

#define MINIMAP_FAC   (16 * 3)
 integer scale factor
#define ATTACK_RED_DURATION   (1 * CYCLES_PER_SECOND)
 unit attacked are shown blinking for this amount of cycles
#define ATTACK_BLINK_DURATION   (7 * CYCLES_PER_SECOND)
#define SCALE_PRECISION   100
#define MAX_MINIMAP_EVENTS   8

Functions

static void CreateMinimapTexture (void)
CColor GetColor (CPatch *patch, int xoffset, int yoffset, int mx, int my, int scalex, int scaley)
void SetMinimapTerrainPixel (int x, int y, CColor color)
static void ClearMinimap ()
static void CopyMinimapTerrain ()
static void SetMinimapPixel (int x, int y, Uint32 color)
static void DrawUnitOn (CUnit *unit, bool red_phase)
static void DrawEvents ()

Variables

static GLuint MinimapTexture
static unsigned char * MinimapSurfaceGL
static unsigned char * MinimapTerrainSurfaceGL
static int MinimapTextureWidth
static int MinimapTextureHeight
static SDL_Surface * MinimapSurface
 generated minimap
static SDL_Surface * MinimapTerrainSurface
 generated minimap terrain
static int * Minimap2MapX
 fast conversion table
static int * Minimap2MapY
 fast conversion table
static int Map2MinimapX [MaxMapWidth]
 fast conversion table
static int Map2MinimapY [MaxMapHeight]
 fast conversion table
static int MinimapScaleX
 Minimap scale to fit into window.
static int MinimapScaleY
 Minimap scale to fit into window.
struct MinimapEvent MinimapEvents [MAX_MINIMAP_EVENTS]
int NumMinimapEvents


Detailed Description

The minimap.

The patch manager.

Definition in file minimap.cpp.


Define Documentation

#define ATTACK_BLINK_DURATION   (7 * CYCLES_PER_SECOND)

Definition at line 58 of file minimap.cpp.

Referenced by DrawUnitOn().

#define ATTACK_RED_DURATION   (1 * CYCLES_PER_SECOND)

unit attacked are shown blinking for this amount of cycles

Definition at line 56 of file minimap.cpp.

Referenced by DrawUnitOn().

#define MAX_MINIMAP_EVENTS   8

Definition at line 86 of file minimap.cpp.

Referenced by CMinimap::AddEvent().

#define MINIMAP_FAC   (16 * 3)

integer scale factor

unit attacked are shown red for at least this amount of cycles

Definition at line 53 of file minimap.cpp.

Referenced by CMinimap::AddEvent(), CMinimap::Create(), CMinimap::DrawCursor(), CMinimap::Screen2MapX(), CMinimap::Screen2MapY(), and CMinimap::UpdateTerrain().

#define SCALE_PRECISION   100

Definition at line 60 of file minimap.cpp.

Referenced by GetColor(), and CMinimap::UpdateTerrain().


Function Documentation

static void ClearMinimap (  )  [static]

Clear the minimap

Definition at line 288 of file minimap.cpp.

References MinimapSurface, MinimapSurfaceGL, MinimapTextureHeight, MinimapTextureWidth, and UseOpenGL.

Referenced by CMinimap::Update().

static void CopyMinimapTerrain (  )  [static]

Copy the minimap terrain to the minimap

Definition at line 300 of file minimap.cpp.

References MinimapSurface, MinimapSurfaceGL, MinimapTerrainSurface, MinimapTerrainSurfaceGL, MinimapTextureHeight, MinimapTextureWidth, and UseOpenGL.

Referenced by CMinimap::Update().

static void CreateMinimapTexture ( void   )  [static]

Create the minimap texture

Definition at line 103 of file minimap.cpp.

References MinimapSurfaceGL, MinimapTexture, MinimapTextureHeight, and MinimapTextureWidth.

Referenced by CMinimap::Create(), and CMinimap::Reload().

static void DrawEvents (  )  [static]

Draw the minimap events

Definition at line 465 of file minimap.cpp.

References ColorWhite, CVideo::DrawTransCircleClip(), MinimapEvents, NumMinimapEvents, MinimapEvent::Size, Video, CMinimap::X, and CMinimap::Y.

Referenced by CMinimap::Draw().

static void DrawUnitOn ( CUnit unit,
bool  red_phase 
) [static]

CColor GetColor ( CPatch patch,
int  xoffset,
int  yoffset,
int  mx,
int  my,
int  scalex,
int  scaley 
)

Get the color from the patch to be used in the minimap

Definition at line 192 of file minimap.cpp.

References CPatchType::getGraphic(), CPatch::getType(), SCALE_PRECISION, CGraphic::Surface, TileSizeX, TileSizeY, and y.

Referenced by CMinimap::UpdateTerrain().

static void SetMinimapPixel ( int  x,
int  y,
Uint32  color 
) [static]

Set a pixel in the minimap

Definition at line 312 of file minimap.cpp.

References MinimapSurface, MinimapSurfaceGL, MinimapTextureWidth, and UseOpenGL.

Referenced by DrawUnitOn(), and CMinimap::Update().

void SetMinimapTerrainPixel ( int  x,
int  y,
CColor  color 
)


Variable Documentation

int Map2MinimapX[MaxMapWidth] [static]

fast conversion table

Definition at line 77 of file minimap.cpp.

Referenced by CMinimap::Create(), and DrawUnitOn().

int Map2MinimapY[MaxMapHeight] [static]

fast conversion table

Definition at line 78 of file minimap.cpp.

Referenced by CMinimap::Create(), and DrawUnitOn().

int* Minimap2MapX [static]

fast conversion table

Definition at line 75 of file minimap.cpp.

Referenced by CMinimap::Create(), CMinimap::Destroy(), CMinimap::Update(), and CMinimap::UpdateTerrain().

int* Minimap2MapY [static]

fast conversion table

Definition at line 76 of file minimap.cpp.

Referenced by CMinimap::Create(), CMinimap::Destroy(), CMinimap::Update(), and CMinimap::UpdateTerrain().

struct MinimapEvent MinimapEvents[MAX_MINIMAP_EVENTS]

Referenced by CMinimap::AddEvent(), and DrawEvents().

int MinimapScaleX [static]

Minimap scale to fit into window.

Definition at line 83 of file minimap.cpp.

Referenced by CMinimap::AddEvent(), CMinimap::Create(), CMinimap::DrawCursor(), CMinimap::Screen2MapX(), and CMinimap::UpdateTerrain().

int MinimapScaleY [static]

Minimap scale to fit into window.

Definition at line 84 of file minimap.cpp.

Referenced by CMinimap::AddEvent(), CMinimap::Create(), CMinimap::DrawCursor(), CMinimap::Screen2MapY(), and CMinimap::UpdateTerrain().

SDL_Surface* MinimapSurface [static]

unsigned char* MinimapSurfaceGL [static]

SDL_Surface* MinimapTerrainSurface [static]

unsigned char* MinimapTerrainSurfaceGL [static]

GLuint MinimapTexture [static]

int MinimapTextureHeight [static]

int MinimapTextureWidth [static]

Definition at line 93 of file minimap.cpp.

Referenced by CMinimap::AddEvent(), CMinimap::Create(), and DrawEvents().


Generated on Sat Feb 21 00:28:17 2009 for Bos Wars by  doxygen 1.5.6