____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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"
#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 |
The patch manager.
Definition in file minimap.cpp.
| #define ATTACK_BLINK_DURATION (7 * CYCLES_PER_SECOND) |
| #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 |
| #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 |
| 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] |
Draw a unit on the minimap.
Definition at line 330 of file minimap.cpp.
References ATTACK_BLINK_DURATION, ATTACK_RED_DURATION, CUnit::Attacked, CPlayer::Color, ColorGreen, ColorRed, ColorWhite, Editor, GameCycle, CMinimap::H, CPlayer::Index, CUnit::IsVisible(), Map2MinimapX, Map2MinimapY, CVideo::MapRGB(), CUserInterface::Minimap, CUnitType::NeutralMinimapColorRGB, CUnit::Player, PlayerNumNeutral, ReplayRevealMap, CEditor::Running, CUnit::Seen, CUnit::Selected, SetMinimapPixel(), CMinimap::ShowSelected, TheScreen, ThisPlayer, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::_unit_seen_::Type, CUnit::Type, UI, Video, CMinimap::W, CUnit::X, CMinimap::XOffset, CUnit::Y, and CMinimap::YOffset.
Referenced by CMinimap::Update().
| 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 | |||
| ) |
Set MinimapTerrain pixel
Definition at line 232 of file minimap.cpp.
References CColor::A, CColor::B, CColor::G, CVideo::MapRGBA(), MinimapTerrainSurface, MinimapTerrainSurfaceGL, MinimapTextureWidth, CColor::R, UseOpenGL, and Video.
Referenced by CMinimap::UpdateTerrain().
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] |
generated minimap
Definition at line 72 of file minimap.cpp.
Referenced by ClearMinimap(), CopyMinimapTerrain(), CMinimap::Create(), CMinimap::Destroy(), CMinimap::Draw(), SetMinimapPixel(), and CMinimap::Update().
unsigned char* MinimapSurfaceGL [static] |
Definition at line 68 of file minimap.cpp.
Referenced by ClearMinimap(), CopyMinimapTerrain(), CMinimap::Create(), CreateMinimapTexture(), CMinimap::Destroy(), CMinimap::Draw(), and SetMinimapPixel().
SDL_Surface* MinimapTerrainSurface [static] |
generated minimap terrain
Definition at line 73 of file minimap.cpp.
Referenced by CopyMinimapTerrain(), CMinimap::Create(), CMinimap::Destroy(), SetMinimapTerrainPixel(), CMinimap::Update(), and CMinimap::UpdateTerrain().
unsigned char* MinimapTerrainSurfaceGL [static] |
Definition at line 69 of file minimap.cpp.
Referenced by CopyMinimapTerrain(), CMinimap::Create(), CMinimap::Destroy(), and SetMinimapTerrainPixel().
GLuint MinimapTexture [static] |
Definition at line 67 of file minimap.cpp.
Referenced by CreateMinimapTexture(), CMinimap::Destroy(), CMinimap::Draw(), and CMinimap::FreeOpenGL().
int MinimapTextureHeight [static] |
Definition at line 71 of file minimap.cpp.
Referenced by ClearMinimap(), CopyMinimapTerrain(), CMinimap::Create(), CreateMinimapTexture(), and CMinimap::Draw().
int MinimapTextureWidth [static] |
Definition at line 70 of file minimap.cpp.
Referenced by ClearMinimap(), CopyMinimapTerrain(), CMinimap::Create(), CreateMinimapTexture(), CMinimap::Draw(), SetMinimapPixel(), and SetMinimapTerrainPixel().
| int NumMinimapEvents |
Definition at line 93 of file minimap.cpp.
Referenced by CMinimap::AddEvent(), CMinimap::Create(), and DrawEvents().
1.5.6