20 #include "../Engine/InteractiveSurface.h" 21 #include "../Engine/Options.h" 28 class SavedBattleGame;
34 class BattlescapeMessage;
39 enum CursorType { CT_NONE, CT_NORMAL, CT_AIM, CT_PSI, CT_WAYPOINT, CT_THROW };
46 static const int SCROLL_INTERVAL = 15;
47 static const int BULLET_SPRITES = 35;
48 Timer *_scrollMouseTimer, *_scrollKeyTimer;
52 int _spriteWidth, _spriteHeight;
53 int _selectorX, _selectorY;
55 CursorType _cursorType;
59 bool _projectileInFOV;
60 std::list<Explosion *> _explosions;
61 bool _explosionInFOV, _launch;
64 int _visibleMapHeight;
65 std::vector<Position> _waypoints;
66 bool _unitDying, _smoothCamera, _smoothingEngaged, _flashScreen;
67 PathPreview _previewSetting;
71 void drawTerrain(
Surface *surface);
72 int getTerrainLevel(
const Position& pos,
int size)
const;
73 int _iconHeight, _iconWidth, _messageColor;
74 const std::vector<Uint8> *_transparencies;
77 Map(
Game* game,
int width,
int height,
int x,
int y,
int visibleMapHeight);
87 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:1281
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
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:78
void setSelectorPosition(int mx, int my)
Sets the battlescape selector position relative to mouseposition.
Definition: Map.cpp:1318
A game state that receives user input and reacts accordingly.
Definition: State.h:43
CursorType getCursorType() const
Gets the 3D cursor type.
Definition: Map.cpp:1523
void setProjectile(Projectile *projectile)
Sets projectile.
Definition: Map.cpp:1596
A class that represents a projectile.
Definition: Projectile.h:37
Timer used to run code in fixed intervals.
Definition: Timer.h:35
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
bool getBlastFlash() const
Check if the screen is flashing this.
Definition: Map.cpp:1776
void animate(bool redraw)
Rotates the tileframes 0-7.
Definition: Map.cpp:1334
void draw()
Draws the surface.
Definition: Map.cpp:179
Text string displayed on screen.
Definition: Text.h:40
void scrollMouse()
Mouse-scrolls the camera.
Definition: Map.cpp:1635
~Map()
Cleans up the map.
Definition: Map.cpp:120
Class handling camera movement, either by mouse or by events on the battlescape.
Definition: Camera.h:33
void resetCameraSmoothing()
Reset the camera smoothing bool.
Definition: Map.cpp:1758
void setButtonsPressed(Uint8 button, bool pressed)
Set mouse-buttons' pressed state.
Definition: Map.cpp:1662
void scrollKey()
Keyboard-scrolls the camera.
Definition: Map.cpp:1643
std::list< Explosion * > * getExplosions()
Gets explosion set.
Definition: Map.cpp:1618
void setWidth(int width)
Special handling for updating map width.
Definition: Map.cpp:1700
void mouseOver(Action *action, State *state)
Special handling for mouse over.
Definition: Map.cpp:1303
void refreshSelectorPosition()
Refreshes the battlescape selector after scrolling.
Definition: Map.cpp:1679
int getSoundAngle(const Position &pos) const
Convert a map position to a sound angle.
Definition: Map.cpp:1738
Container of a set of surfaces.
Definition: SurfaceSet.h:35
void mousePress(Action *action, State *state)
Special handling for mouse press.
Definition: Map.cpp:1259
void cacheUnit(BattleUnit *unit)
Caches the unit.
Definition: Map.cpp:1543
Interactive map of the battlescape.
Definition: Map.h:43
void getSelectorPosition(Position *pos) const
Gets the currently selected position.
Definition: Map.cpp:1369
void think()
Handles timers.
Definition: Map.cpp:170
std::vector< Position > * getWaypoints()
Get waypoints vector.
Definition: Map.cpp:1652
Element that is blit (rendered) onto the screen.
Definition: Surface.h:36
void mouseRelease(Action *action, State *state)
Special handling for mouse release.
Definition: Map.cpp:1270
Camera * getCamera()
Gets the pointer to the camera.
Definition: Map.cpp:1627
void setBlastFlash(bool flash)
Set whether the screen should "flash" or not.
Definition: Map.cpp:1767
void cacheUnits()
Caches units.
Definition: Map.cpp:1531
Generic window used to display messages over the Battlescape map.
Definition: BattlescapeMessage.h:34
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:46
int getMessageY() const
Get the vertical position of the hidden movement screen.
Definition: Map.cpp:1711
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the palette.
Definition: Map.cpp:233
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:41
void init()
Initializes the map.
Definition: Map.cpp:133
void setCursorType(CursorType type, int size=1)
Sets the 3D cursor type.
Definition: Map.cpp:1510
Projectile * getProjectile() const
Gets projectile.
Definition: Map.cpp:1609
Easy handling of X-Y-Z coordinates.
Definition: Position.h:28
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:1381
void setUnitDying(bool flag)
Sets the unitDying flag.
Definition: Map.cpp:1671
int getIconHeight() const
Get the icon height.
Definition: Map.cpp:1719
void keyboardRelease(Action *action, State *state)
Special handling for key releases.
Definition: Map.cpp:1292
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:59
int getIconWidth() const
Get the icon width.
Definition: Map.cpp:1727
Definition: BaseInfoState.cpp:40
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:452
void setHeight(int height)
Special handling for updating map height.
Definition: Map.cpp:1688