hyperkaos/main.c

101 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 captive = 0;
int hasMusic = 0;
Timer fps = { 0 };
SDL_Event event;
SDL_Surface* screen = NULL;
Room* rightHere = 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;
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;
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;
enum dataChunks thisChunk;
enum dataChunks nextChunk;
int main (int argc, char* args[])
{
if (!init(argc, args))
{
printf("Init failed\n");
return 1;
}
/*
* intro discarded immediately after playing, so instead of increasing the
* complexity and offloading it somewhere, we just keep it in this include
* file for cleanliness and modularity
*/
#include "intro.c"
// 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;
}