hyperkaos/main.c

103 lines
No EOL
1.9 KiB
C

#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"
#include "Scene.h"
/*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;
int spellbutton = 0;
int captive = 0;
int hasMusic = 0;
Timer fps = { 0 };
SDL_Event event;
SDL_Surface* screen = NULL;
SDL_Surface* window = NULL;
Room* rightHere = NULL;
HyperKaos** spellBook = NULL;
SDL_Surface* saveMenu = NULL;
SDL_Surface* textBoxBG = NULL;
SDL_Surface* choiceBox = NULL;
SDL_Surface* nextArrow = NULL;
SDL_Surface* selectArrow = NULL;
SDL_Surface* loadingTxt = NULL;
SDL_Surface* spellGlyphs = 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;
int spellKnowledge[10] = {1,1,0,0,0,0,0,0,0,0};
int bookMark = 0;
Room** mapData = NULL;
Room** mapBuffer = NULL;
TextBox** dialogueData = NULL;
Mix_Music** bgmData = NULL;
Mix_Chunk** sfxData = NULL;
Kaos** kaosData = NULL;
Scene** theatre = NULL;
int kaosFlag = -1;
int spellFlag = -1;
enum dataChunks thisChunk;
enum dataChunks nextChunk;
int main (int argc, char* args[])
{
if (!init(argc, args))
{
printf("Init failed\n");
return 1;
}
intro();
// main game loop
while (!quit)
{
mainmenu();
while (playing)
{
timeStart(&fps);
interact();
movePlayer(hero, rightHere);
renderBackground();
renderForeground();
renderHUD();
frameAdvance();
kListen();
pager();
}
}
cleanup();
return 0;
}