2018-09-20 01:27:47 +00:00
|
|
|
#include "SDL/SDL.h"
|
|
|
|
#include "SDL/SDL_image.h"
|
|
|
|
#include "SDL/SDL_ttf.h"
|
|
|
|
#include "SDL/SDL_mixer.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "enum.h"
|
|
|
|
#include "Engine.h"
|
|
|
|
#include "Timer.h"
|
|
|
|
#include "Player.h"
|
|
|
|
#include "Room.h"
|
|
|
|
#include "TextBox.h"
|
|
|
|
#include "Kaos.h"
|
|
|
|
#include "HyperKaos.h"
|
|
|
|
#include "WorldData.h"
|
2018-09-22 23:08:53 +00:00
|
|
|
#include "Scene.h"
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
/*const int SCREEN_WIDTH = 320;
|
|
|
|
const int SCREEN_HEIGHT = 180;
|
|
|
|
const int SCREEN_BPP = 32;
|
|
|
|
|
|
|
|
const int FRAMES_PER_SECOND = 30;*/
|
|
|
|
|
|
|
|
int fullscreen = 0;
|
|
|
|
int playing = 0;
|
|
|
|
int quit = 0;
|
|
|
|
int actionbutton = 0;
|
2018-10-13 03:35:45 +00:00
|
|
|
int spellbutton = 0;
|
2018-09-20 01:27:47 +00:00
|
|
|
int captive = 0;
|
|
|
|
int hasMusic = 0;
|
|
|
|
|
|
|
|
Timer fps = { 0 };
|
|
|
|
SDL_Event event;
|
|
|
|
|
|
|
|
SDL_Surface* screen = NULL;
|
|
|
|
Room* rightHere = NULL;
|
2018-10-13 03:35:45 +00:00
|
|
|
HyperKaos** spellBook = NULL;
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
SDL_Surface* saveMenu = NULL;
|
|
|
|
SDL_Surface* textBoxBG = NULL;
|
|
|
|
SDL_Surface* choiceBox = NULL;
|
|
|
|
SDL_Surface* nextArrow = NULL;
|
|
|
|
SDL_Surface* selectArrow = NULL;
|
|
|
|
SDL_Surface* loadingTxt = NULL;
|
|
|
|
|
|
|
|
TTF_Font* font = NULL;
|
|
|
|
SDL_Color textColor = {255, 255, 255};
|
|
|
|
|
|
|
|
Player* hero = NULL;
|
|
|
|
Room* menuBG = NULL;
|
|
|
|
Mix_Music* menuBGM = NULL;
|
|
|
|
|
|
|
|
long long int savestate = 2;
|
2018-12-16 12:18:26 +00:00
|
|
|
int spellKnowledge[10] = {1,1,0,0,0,0,0,0,0,0};
|
2018-12-14 22:52:24 +00:00
|
|
|
int bookMark = 0;
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
Room** mapData = NULL;
|
|
|
|
Room** mapBuffer = NULL;
|
|
|
|
TextBox** dialogueData = NULL;
|
|
|
|
Mix_Music** bgmData = NULL;
|
|
|
|
Mix_Chunk** sfxData = NULL;
|
|
|
|
Kaos** kaosData = NULL;
|
2018-09-24 18:41:09 +00:00
|
|
|
Scene** theatre = NULL;
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
int kaosFlag = -1;
|
2018-10-13 03:35:45 +00:00
|
|
|
int spellFlag = -1;
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
enum dataChunks thisChunk;
|
|
|
|
enum dataChunks nextChunk;
|
|
|
|
|
|
|
|
int main (int argc, char* args[])
|
|
|
|
{
|
|
|
|
if (!init(argc, args))
|
|
|
|
{
|
|
|
|
printf("Init failed\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-10-08 21:57:15 +00:00
|
|
|
intro();
|
2018-09-20 01:27:47 +00:00
|
|
|
|
|
|
|
// main game loop
|
|
|
|
while (!quit)
|
|
|
|
{
|
|
|
|
mainmenu();
|
|
|
|
|
|
|
|
while (playing)
|
|
|
|
{
|
|
|
|
timeStart(fps);
|
|
|
|
interact();
|
|
|
|
movePlayer(hero, rightHere);
|
|
|
|
renderBackground();
|
|
|
|
renderForeground();
|
|
|
|
SDL_Flip(screen);
|
|
|
|
kListen(&kaosFlag);
|
|
|
|
pager();
|
|
|
|
timeDilation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
return 0;
|
|
|
|
}
|