19 #ifndef OPENXCOM_MAP_H
20 #define OPENXCOM_MAP_H
22 #include "../Engine/InteractiveSurface.h"
23 #include "../Engine/Options.h"
32 class SavedBattleGame;
37 class BattlescapeMessage;
42 enum CursorType { CT_NONE, CT_NORMAL, CT_AIM, CT_PSI, CT_WAYPOINT, CT_THROW };
49 static const int SCROLL_INTERVAL = 15;
50 static const int BULLET_SPRITES = 35;
51 Timer *_scrollMouseTimer, *_scrollKeyTimer;
56 int _spriteWidth, _spriteHeight;
57 int _selectorX, _selectorY;
59 CursorType _cursorType;
63 bool _projectileInFOV;
64 std::list<Explosion *> _explosions;
65 bool _explosionInFOV, _launch;
68 int _visibleMapHeight;
69 std::vector<Position> _waypoints;
70 bool _unitDying, _smoothCamera, _smoothingEngaged;
74 void drawTerrain(
Surface *surface);
75 int getTerrainLevel(
Position pos,
int size);
77 static const int ICON_HEIGHT = 56;
78 static const int ICON_WIDTH = 320;
80 Map(
Game *game,
int width,
int height,
int x,
int y,
int visibleMapHeight);
90 void setPalette(SDL_Color *colors,
int firstcolor = 0,
int ncolors = 256);
void keyboardPress(Action *action, State *state)
Special handling for key presses.
Definition: Map.cpp:1141
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
Map(Game *game, int width, int height, int x, int y, int visibleMapHeight)
Creates a new map at the specified position and size.
Definition: Map.cpp:80
void setSelectorPosition(int mx, int my)
Sets the battlescape selector position relative to mouseposition.
Definition: Map.cpp:1178
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void setProjectile(Projectile *projectile)
Sets projectile.
Definition: Map.cpp:1434
A class that represents a projectile.
Definition: Projectile.h:39
Timer used to run code in fixed intervals.
Definition: Timer.h:37
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
void animate(bool redraw)
Rotates the tileframes 0-7.
Definition: Map.cpp:1194
Projectile * getProjectile() const
Gets projectile.
Definition: Map.cpp:1447
void draw()
Draws the surface.
Definition: Map.cpp:164
Text string displayed on screen.
Definition: Text.h:41
void scrollMouse()
Mouse-scrolls the camera.
Definition: Map.cpp:1473
~Map()
Cleans up the map.
Definition: Map.cpp:113
Class handling camera movement, either by mouse or by events on the battlescape.
Definition: Camera.h:35
void setButtonsPressed(Uint8 button, bool pressed)
Set mouse-buttons' pressed state.
Definition: Map.cpp:1500
void scrollKey()
Keyboard-scrolls the camera.
Definition: Map.cpp:1481
std::list< Explosion * > * getExplosions()
Gets explosion set.
Definition: Map.cpp:1456
void setWidth(int width)
Special handling for updating map width.
Definition: Map.cpp:1537
PathPreview
Path preview modes (can be OR'd together).
Definition: Options.h:41
void mouseOver(Action *action, State *state)
Special handling for mouse over.
Definition: Map.cpp:1163
void refreshSelectorPosition()
Refreshes the battlescape selector after scrolling.
Definition: Map.cpp:1517
void mousePress(Action *action, State *state)
Special handling for mouse press.
Definition: Map.cpp:1119
void cacheUnit(BattleUnit *unit)
Caches the unit.
Definition: Map.cpp:1382
Interactive map of the battlescape.
Definition: Map.h:46
void think()
Handles timers.
Definition: Map.cpp:155
std::vector< Position > * getWaypoints()
Get waypoints vector.
Definition: Map.cpp:1490
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void mouseRelease(Action *action, State *state)
Special handling for mouse release.
Definition: Map.cpp:1130
Camera * getCamera()
Gets the pointer to the camera.
Definition: Map.cpp:1465
Packs of external game media.
Definition: ResourcePack.h:50
void cacheUnits()
Caches units.
Definition: Map.cpp:1370
Generic window used to display messages over the Battlescape map.
Definition: BattlescapeMessage.h:36
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
CursorType getCursorType() const
Gets the 3D cursor type.
Definition: Map.cpp:1362
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the palette.
Definition: Map.cpp:212
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
void init()
Initializes the map.
Definition: Map.cpp:126
void getSelectorPosition(Position *pos) const
Gets the currently selected position.
Definition: Map.cpp:1224
void setCursorType(CursorType type, int size=1)
Sets the 3D cursor type.
Definition: Map.cpp:1349
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
void calculateWalkingOffset(BattleUnit *unit, Position *offset)
Calculates the offset of a soldier, when it is walking in the middle of 2 tiles.
Definition: Map.cpp:1236
void setUnitDying(bool flag)
Sets the unitDying flag.
Definition: Map.cpp:1509
void keyboardRelease(Action *action, State *state)
Special handling for key releases.
Definition: Map.cpp:1152
int getMessageY()
Get the vertical position of the hidden movement screen.
Definition: Map.cpp:1548
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
void offset(int off, int min=-1, int max=-1, int mul=1)
Offsets the surface's colors by a set amount.
Definition: Surface.cpp:403
void setHeight(int height)
Special handling for updating map height.
Definition: Map.cpp:1526