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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
#pragma once
#include "D3DGraphics.h"
#include "Keyboard.h"
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include "Mouse.h"
#include "Timer.h"
#include "Sound.h"
#define MAXITEMS 20
#define MAXCITY 6
#define DINGWIDTH 50
#define DINGHEIGHT 50
#define DINGNFRAMES 14
#define DINGFRAMETIME (60 / DINGNFRAMES)
#define DINGFILENAME "plaatjes\\ding"
class Game
{
public:
struct AnimatedSpriteTemplate
{
Sprite* frames;
int nFrames;
int frameDuration;
};
struct AnimatedSpriteInstance
{
AnimatedSpriteTemplate* templat;
int currentFrame;
int currentFrameExposure;
float x,y;
};
public:
Game( HWND hWnd,const KeyboardServer& kServer,const MouseServer& mServer );
~Game();
void LoadAnimatedSprite(AnimatedSpriteTemplate* templat,
const char* basename, int width, int height, int nFrames, int frameDuration);
void FreeAnimatedSprite( AnimatedSpriteTemplate* templat);
void CreateSpriteInstance(AnimatedSpriteTemplate* templat, AnimatedSpriteInstance* instance);
void UpdateAnimation(AnimatedSpriteInstance* instance);
void DrawSpriteInstance( AnimatedSpriteInstance* instance);
bool QuitGame;
void Go();
private:
void ComposeFrame();
//composeframe
void DrawScreen();
//sprite draw
void CloudsDraw();
void Background();
void RoadDraw();
void HouseBackDraw();
void ObjectsDraw();
void CharactersDraw();
void HouseFrontDraw();
void MouseDraw();
//save/load
void SaveGame(int SaveNum, bool ngame);
bool LoadGame(int Loadnum);
//animatie
void MoveUpdate();
//camera
void CamUpdate();
//player interface
void Gravity();
void Interface();
void MoveInterface();
void CityTravelInt();
//menu's tekenen
void OnscreenDraw();
void IngameMenuDraw();
void HeadMenuDraw();
void ErrorScreen(char* Error);
//menu's interface
void MenuActionHandler();
void SaveGameMenu();
void SaveGameMenuInt();
void HeadMenuInt();
void OptionsInt();
void LoadMenuInt();
void IngameMenuInt();
void ErrorMenuInt();
//tijd
void ConvertTime();
void DrawTime();
void TimeUpdate();
//handel AI
void GiveGoodsNames();
int Price(int GoodsNum, bool BuySell);
/********************************/
private:
D3DGraphics gfx;
KeyboardClient kbd;
MouseClient mouse;
DSound audio;
/********************************/
//prijs
float StartPrice[MAXITEMS];
float Inflation[MAXCITY];
int Money;
//steden
int City;
//ingame menu check
bool Menu;
/*stats & skills*/
int Pskills[10],Sskills[10],stats[5];
//gravity system player
bool Ajump, Djump,Afall, AVelocity, Amove,AmoveY;
int PlayerX, PlayerY;
float XVelocity, YVelocity;
//animation state player
int MoveState;
int MoveStateDelay;
//begin menu
bool GameStarted, savegame,optionsmenu,loadgame,credits;
int pressdelay;
bool PressCheck;
bool MenuButtonPressed[5];
//error menu check
bool errorscreen;
char* Error;
bool ErrorMenuPressed;
//bmp pictures
//lul figuur
AnimatedSpriteTemplate dingTemplate;
AnimatedSpriteInstance ding;
//background
Sprite BackgroundS;
//character
Character Farie;
//font
Font fixedSys;
//menu
MenuButton HeadMenu;
MenuButton IngameMenu;
//camera
int XCam,YCam;
int Height, Width;
//time
char* Years;
char* Months;
char* Days;
char* Hours;
char* Minutes;
int TimeSpeed;
bool timercheck;
int timebuffer;
int timesec;
Timer timer;
//goods
char* Goods[10];
int PlayerStock[MAXITEMS];
int Stock[MAXITEMS][MAXCITY];
//test
//quit
/********************************/
};
|