-
Notifications
You must be signed in to change notification settings - Fork 0
/
BattleMap.h
139 lines (123 loc) · 4.01 KB
/
BattleMap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//////////////////////////////////////////////////////////////////////////
// Filename : CBattleMap.h
//
// Author : Ramon Johannessen (RJ)
//
// Purpose : To execute the individual battles that take place,
// drawing the isometric tile map, updating, getting input, etc...
//////////////////////////////////////////////////////////////////////////
#ifndef BATTLEMAP_H
#define BATTLEMAP_H
#include <windows.h>
#include <iostream>
using namespace std;
class CSGD_TextureManager;
class CSGD_DirectInput;
class CSGD_Direct3D;
class CGame;
class CAssets;
//class CBitmapFont;
class CTile;
class CFreeTile;
//class CHUD;
struct MY_POINT
{
int x;
int y;
};
class CBattleMap
{
struct sTileset
{
string name;
int id;
};
string m_strCurrVersion;
// IDs
int m_nBGImageID;
int m_nDotImageID;
int m_nCursorImageID;
// Map variables
int m_nMapWidth;
int m_nMapHeight;
int m_nNumCols;
int m_nNumRows;
int m_nTileWidth;
int m_nTileHeight;
int m_nTotalNumTiles;
int m_nCurrSelectedTile;
int m_nIsoCenterLeftY;
int m_nIsoCenterTopX;
int m_nFreeTileCount;
float m_fScrollX;
float m_fScrollY;
char* m_szMapName;
char* m_szFileName;
CTile* m_pTilesL1; // all tiles on the map, used for drawing first layer
CTile* m_pTilesL2; // all tiles on the map, used for drawing first layer
CTile* m_pMoveableTiles; // the open tiles, used for collision checking
CFreeTile* m_pFreeTiles;
sTileset m_pTilesets[4];
// battle variables
int m_nNumEnemiesLeft;
//////////////////////////////////////////////////////////////////////////
// Pointers to singletons
//CBitmapFont* m_pBitmapFont;
CAssets* m_pAssets;
CSGD_TextureManager* m_pTM;
//FMOD::System* m_pFMODsys;
CSGD_Direct3D* m_pD3D;
CSGD_DirectInput* m_pDI;
CGame* m_pGame;
//CHUD* m_pHUD;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Function : CreateEnemies
//
// Purpose : Make and place the m_nNumEnemiesLeft amount of enemies
// to the battle map
//////////////////////////////////////////////////////////////////////////
void CreateEnemies();
//////////////////////////////////////////////////////////////////////////
// Function : LoadMapInfo
//
// Purpose : Load in the new map, set up all of the members
//////////////////////////////////////////////////////////////////////////
void LoadMapInfo();
//////////////////////////////////////////////////////////////////////////
// Function : IsoTilePlot
//
// Purpose : Determines at which pixel on the screen the given map
// ID (xID, yID = pt.x, pt.y) should be drawn
//
// Return : The pixel point to draw at
//////////////////////////////////////////////////////////////////////////
MY_POINT IsoTilePlot(MY_POINT pt, int xOffset, int yOffset);
public:
CBattleMap(void);
CBattleMap(char* szFileName, char* szMapName = "Test", int nNumEnemies = 0);
~CBattleMap(void);
//////////////////////////////////////////////////////////////////////////
// Function : Update
//
// Purpose : Update the Battle Map
//////////////////////////////////////////////////////////////////////////
void Update(float fElapsedTime);
//////////////////////////////////////////////////////////////////////////
// Function : Render
//
// Purpose : Render the Map and all objects on it
//////////////////////////////////////////////////////////////////////////
void Render();
//////////////////////////////////////////////////////////////////////////
// Function : Input
//
// Purpose : Handle any user input for the battle, mouse or keyboard
//
// Return : true/false, false if we are exiting the game
//////////////////////////////////////////////////////////////////////////
bool Input(float, POINT);
//////////////////////////////////////////////////////////////////////////
int GetCurrSelectedTile() const {return m_nCurrSelectedTile;}
};
#endif