20 #include "../Engine/InteractiveSurface.h" 21 #include "../Engine/Options.h" 28 class SavedBattleGame;
34 class BattlescapeMessage;
40 enum CursorType { CT_NONE, CT_NORMAL, CT_AIM, CT_PSI, CT_WAYPOINT, CT_THROW };
47 static const int SCROLL_INTERVAL = 15;
48 static const int BULLET_SPRITES = 35;
49 Timer *_scrollMouseTimer, *_scrollKeyTimer, *_obstacleTimer;
53 int _spriteWidth, _spriteHeight;
54 int _selectorX, _selectorY;
56 CursorType _cursorType;
60 bool _projectileInFOV;
61 std::list<Explosion *> _explosions;
62 bool _explosionInFOV, _launch;
65 int _visibleMapHeight;
66 std::vector<Position> _waypoints;
67 bool _unitDying, _smoothCamera, _smoothingEngaged, _flashScreen;
68 PathPreview _previewSetting;
72 void drawUnit(
Surface *surface,
Tile *unitTile,
Tile *currTile,
Position tileScreenPosition,
int shade,
int obstacleShade,
bool topLayer);
73 void drawTerrain(
Surface *surface);
74 int getTerrainLevel(
const Position& pos,
int size)
const;
75 int _iconHeight, _iconWidth, _messageColor;
76 const std::vector<Uint8> *_transparencies;
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:1276
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:77
void setSelectorPosition(int mx, int my)
Sets the battlescape selector position relative to mouseposition.
Definition: Map.cpp:1313
A game state that receives user input and reacts accordingly.
Definition: State.h:44
CursorType getCursorType() const
Gets the 3D cursor type.
Definition: Map.cpp:1523
void setProjectile(Projectile *projectile)
Sets projectile.
Definition: Map.cpp:1580
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:1760
void animate(bool redraw)
Rotates the tileframes 0-7.
Definition: Map.cpp:1329
void draw()
Draws the surface.
Definition: Map.cpp:183
Text string displayed on screen.
Definition: Text.h:40
void scrollMouse()
Mouse-scrolls the camera.
Definition: Map.cpp:1619
~Map()
Cleans up the map.
Definition: Map.cpp:122
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:1742
void resetObstacles()
Resets obstacle markers.
Definition: Map.cpp:1768
void setButtonsPressed(Uint8 button, bool pressed)
Set mouse-buttons' pressed state.
Definition: Map.cpp:1646
void scrollKey()
Keyboard-scrolls the camera.
Definition: Map.cpp:1627
std::list< Explosion * > * getExplosions()
Gets explosion set.
Definition: Map.cpp:1602
void setWidth(int width)
Special handling for updating map width.
Definition: Map.cpp:1684
void mouseOver(Action *action, State *state)
Special handling for mouse over.
Definition: Map.cpp:1298
void refreshSelectorPosition()
Refreshes the battlescape selector after scrolling.
Definition: Map.cpp:1663
int getSoundAngle(const Position &pos) const
Convert a map position to a sound angle.
Definition: Map.cpp:1722
Container of a set of surfaces.
Definition: SurfaceSet.h:35
void mousePress(Action *action, State *state)
Special handling for mouse press.
Definition: Map.cpp:1254
void cacheUnit(BattleUnit *unit)
Caches the unit.
Definition: Map.cpp:1543
Interactive map of the battlescape.
Definition: Map.h:44
void getSelectorPosition(Position *pos) const
Gets the currently selected position.
Definition: Map.cpp:1364
void think()
Handles timers.
Definition: Map.cpp:173
std::vector< Position > * getWaypoints()
Get waypoints vector.
Definition: Map.cpp:1636
void enableObstacles()
Enables obstacle markers.
Definition: Map.cpp:1783
Basic element of which a battle map is build.
Definition: Tile.h:42
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
void mouseRelease(Action *action, State *state)
Special handling for mouse release.
Definition: Map.cpp:1265
Camera * getCamera()
Gets the pointer to the camera.
Definition: Map.cpp:1611
void setBlastFlash(bool flash)
Set whether the screen should "flash" or not.
Definition: Map.cpp:1751
void disableObstacles()
Disables obstacle markers.
Definition: Map.cpp:1796
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:47
int getMessageY() const
Get the vertical position of the hidden movement screen.
Definition: Map.cpp:1695
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the palette.
Definition: Map.cpp:237
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:136
void setCursorType(CursorType type, int size=1)
Sets the 3D cursor type.
Definition: Map.cpp:1510
Projectile * getProjectile() const
Gets projectile.
Definition: Map.cpp:1593
Easy handling of X-Y-Z coordinates.
Definition: Position.h:28
void calculateWalkingOffset(BattleUnit *unit, Position *offset, int *shadeOffset=0)
Calculates the offset of a soldier, when it is walking in the middle of 2 tiles.
Definition: Map.cpp:1376
void setUnitDying(bool flag)
Sets the unitDying flag.
Definition: Map.cpp:1655
int getIconHeight() const
Get the icon height.
Definition: Map.cpp:1703
void keyboardRelease(Action *action, State *state)
Special handling for key releases.
Definition: Map.cpp:1287
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:1711
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:492
void setHeight(int height)
Special handling for updating map height.
Definition: Map.cpp:1672