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
|
#include <string>
#include <conio.h>
#define Up 0
#define Down 1
#define Left 2
#define Right 3
#define UpLeft 4
#define UpRight 5
#define DownLeft 6
#define DownRight 7
#define Color_Black 0
#define Color_Blue 1
#define Color_Green 2
#define Color_Cyan 3
#define Color_Red 4
#define Color_Magenta 5
#define Color_Yellow 6
#define Color_Gray 8
// Lit Color Values ...
//
// Blue = 9
// Green = 10
// Cyan = 11
// Red = 12
// Magenta = 13
// Yellow = 14
// White = 15
struct Position {
int FGColor, BGColor, X, Y;
char* Graphic;
bool Lit;
};
struct Object {
int X, Y, FGColor, BGColor, ID;
char* Graphic;
bool Visible, Collision;
std::string Name;
Position LastPosition;
Position Collision_Pos;
};
struct Light {
int X, Y, Intensity, ID, Color;
bool Visible;
};
class Map {
public:
// Constructor & Misc Functions
Map(int MaxX_, int MaxY_, char* Background_, int FGColor_, int BGColor_);
void AGEInfo();
// Variable Declarations
int MaxX, MaxY, BackgroundColor, ForegroundColor;
char* Background;
Position XY[100][100];
Object Objects[100];
Light Lights[100];
// Map Draw Functions
void DrawMap(int MinX, int MinY, int MaxX_, int MaxY_, int ConPosX, int ConPosY);
void DrawAllMap(int ConPosX, int ConPosY);
void DrawFollowing(int ObjectID, int ConPosX, int ConPosY, int Radius);
// Map Painting Functions
void Point(int X, int Y, char* Graphic, int FGColor_, int BGColor_, bool Lit);
void Square(int X, int Y, char* Graphic, char* Fill, int FGColor_, int BGColor_, int Width, int Height, bool Lit);
void Line(int X, int Y, char* Graphic, int FGColor_, int BGColor_, int Direction, int Lenght, bool Lit);
// Map Properties Functions
bool IsFree(int X, int Y);
bool IsObject(int X, int Y);
// Object Functions
int Object_Create(int X, int Y, char* Graphic, int FGColor_, int BGColor_, std::string Name);
void Object_Hide(int ObjID);
void Object_Show(int ObjID);
bool Object_StepMove(int Direction, int Steps, int ObjID);
bool Object_Move(int Xto, int Yto, int ObjID);
// Light Functions
int Light_Create(int X, int Y, int Intensity);
void Light_Show(int LightID);
void Light_Hide(int LightID);
void Light_Move(int LightID, int Xto, int Yto);
void Light_StepMove(int LightID, int Direction, int Steps);
void Light_Intensity(int LightID, int Intensity);
private:
int ObjC, LgtC;
bool IsLit(int Color);
bool IsInvalid(int X, int Y);
int ToLight(int Color);
int ToDark(int Color);
};
|