2010-10-12 10:55:23 +02:00
|
|
|
/*
|
2011-03-05 13:44:21 +01:00
|
|
|
* This software is licensed under the terms of the MIT-License
|
2011-03-17 21:13:11 +01:00
|
|
|
* See COPYING for further information.
|
2011-03-05 13:44:21 +01:00
|
|
|
* ---
|
|
|
|
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
2010-10-12 10:55:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GLOBAL_H
|
|
|
|
#define GLOBAL_H
|
|
|
|
|
|
|
|
#include <SDL/SDL.h>
|
2011-06-13 18:48:36 +02:00
|
|
|
|
|
|
|
#include "resource/audio.h"
|
|
|
|
#include "resource/shader.h"
|
|
|
|
#include "resource/font.h"
|
|
|
|
#include "resource/animation.h"
|
|
|
|
|
|
|
|
#include "menu/menu.h"
|
|
|
|
|
2010-10-12 10:55:23 +02:00
|
|
|
#include "player.h"
|
|
|
|
#include "projectile.h"
|
2011-04-26 12:04:45 +02:00
|
|
|
#include "enemy.h"
|
2011-04-29 10:26:37 +02:00
|
|
|
#include "item.h"
|
2011-04-08 18:59:03 +02:00
|
|
|
#include "boss.h"
|
2011-04-24 15:39:17 +02:00
|
|
|
#include "laser.h"
|
2011-05-08 13:48:25 +02:00
|
|
|
#include "dialog.h"
|
2011-05-13 19:03:02 +02:00
|
|
|
#include "list.h"
|
2011-05-21 18:20:04 +02:00
|
|
|
#include "config.h"
|
2011-06-13 18:48:36 +02:00
|
|
|
#include "fbo.h"
|
2010-10-12 10:55:23 +02:00
|
|
|
|
2011-05-21 18:20:04 +02:00
|
|
|
#define FILE_PREFIX PREFIX "/share/taisei/"
|
2011-06-26 20:23:28 +02:00
|
|
|
#define CONFIG_FILE "config"
|
2011-06-13 18:48:36 +02:00
|
|
|
|
2011-04-25 19:40:21 +02:00
|
|
|
enum {
|
2010-10-12 10:55:23 +02:00
|
|
|
SCREEN_W = 800,
|
|
|
|
SCREEN_H = 600,
|
|
|
|
|
2010-11-28 07:31:26 +01:00
|
|
|
VIEWPORT_X = 40,
|
|
|
|
VIEWPORT_Y = 20,
|
|
|
|
VIEWPORT_W = 480,
|
|
|
|
VIEWPORT_H = 560,
|
2010-10-18 14:40:15 +02:00
|
|
|
|
2011-03-19 09:11:05 +01:00
|
|
|
POINT_OF_COLLECT = VIEWPORT_H/4,
|
2011-05-09 13:42:02 +02:00
|
|
|
ATTACK_START_DELAY = 40,
|
2011-06-25 12:41:40 +02:00
|
|
|
DEATHBOMB_TIME = 10,
|
2011-07-02 12:45:32 +02:00
|
|
|
|
2011-06-29 17:01:03 +02:00
|
|
|
PLR_MAXPOWER = 4,
|
2011-07-02 12:45:32 +02:00
|
|
|
PLR_START_LIVES = 2,
|
|
|
|
PLR_START_BOMBS = 3,
|
|
|
|
MAX_CONTINUES = 3,
|
2011-03-19 09:11:05 +01:00
|
|
|
|
2011-06-29 17:01:03 +02:00
|
|
|
SNDSRC_COUNT = 35,
|
2011-04-02 12:14:37 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
ACTION_DESTROY,
|
|
|
|
|
2011-04-26 12:04:45 +02:00
|
|
|
EVENT_DEATH = -8999,
|
|
|
|
EVENT_BIRTH,
|
|
|
|
|
2011-06-25 12:41:40 +02:00
|
|
|
FPS = 60,
|
|
|
|
|
|
|
|
GAMEOVER_DEFEAT = 1,
|
|
|
|
GAMEOVER_ABORT
|
2010-10-12 10:55:23 +02:00
|
|
|
};
|
|
|
|
|
2011-06-13 18:48:36 +02:00
|
|
|
typedef enum {
|
|
|
|
D_Easy,
|
|
|
|
D_Normal,
|
|
|
|
D_Hard,
|
|
|
|
D_Lunatic
|
|
|
|
} Difficulty;
|
|
|
|
|
2010-10-18 14:40:15 +02:00
|
|
|
typedef struct {
|
2011-06-13 18:48:36 +02:00
|
|
|
int fpstime; // frame counter
|
|
|
|
int fps;
|
|
|
|
int show_fps;
|
|
|
|
} FPSCounter;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Difficulty diff;
|
2011-06-24 19:16:05 +02:00
|
|
|
Character plrtype;
|
|
|
|
ShotMode plrmode;
|
2011-06-13 18:48:36 +02:00
|
|
|
|
2011-06-24 19:16:05 +02:00
|
|
|
Player plr;
|
|
|
|
|
2010-10-12 10:55:23 +02:00
|
|
|
Projectile *projs;
|
2011-04-26 12:04:45 +02:00
|
|
|
Enemy *enemies;
|
2011-04-29 10:26:37 +02:00
|
|
|
Item *items;
|
2011-04-24 15:39:17 +02:00
|
|
|
Laser *lasers;
|
2010-10-12 10:55:23 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
Projectile *particles;
|
|
|
|
|
2011-03-05 13:44:21 +01:00
|
|
|
int frames;
|
2011-05-09 13:42:02 +02:00
|
|
|
int lasttime;
|
2011-05-08 13:48:25 +02:00
|
|
|
int timer;
|
2010-10-12 10:55:23 +02:00
|
|
|
|
2011-03-19 16:21:48 +01:00
|
|
|
Texture *textures;
|
|
|
|
Animation *animations;
|
2011-04-02 12:14:37 +02:00
|
|
|
Sound *sounds;
|
2011-04-25 19:40:21 +02:00
|
|
|
Shader *shaders;
|
|
|
|
|
2011-06-13 18:48:36 +02:00
|
|
|
FBO fbg;
|
|
|
|
FBO fsec;
|
2011-04-02 12:14:37 +02:00
|
|
|
|
2011-04-08 18:59:03 +02:00
|
|
|
Boss *boss;
|
2011-06-13 18:48:36 +02:00
|
|
|
MenuData *menu;
|
2011-05-08 13:48:25 +02:00
|
|
|
Dialog *dialog;
|
2011-04-08 18:59:03 +02:00
|
|
|
|
2011-04-02 12:14:37 +02:00
|
|
|
ALuint sndsrc[SNDSRC_COUNT];
|
2010-10-17 09:27:44 +02:00
|
|
|
|
2011-05-13 19:03:02 +02:00
|
|
|
RefArray refs; // for super extra OOP-tardness: references. the cool way.
|
|
|
|
|
2010-10-17 09:27:44 +02:00
|
|
|
int game_over;
|
2011-04-10 10:23:24 +02:00
|
|
|
int points;
|
2011-07-02 15:28:38 +02:00
|
|
|
|
|
|
|
int fullscreenhotkey_state;
|
|
|
|
|
2011-06-13 18:48:36 +02:00
|
|
|
FPSCounter fps;
|
2011-06-24 12:35:03 +02:00
|
|
|
|
2010-10-12 10:55:23 +02:00
|
|
|
} Global;
|
|
|
|
|
|
|
|
extern Global global;
|
|
|
|
|
|
|
|
void init_global();
|
2011-04-25 19:40:21 +02:00
|
|
|
void init_rtt();
|
2010-10-17 09:27:44 +02:00
|
|
|
void game_over();
|
2010-10-12 10:55:23 +02:00
|
|
|
|
2010-10-18 14:40:15 +02:00
|
|
|
void frame_rate();
|
2011-06-26 16:10:13 +02:00
|
|
|
void calc_fps(FPSCounter *fps);
|
2011-06-24 12:35:03 +02:00
|
|
|
void set_ortho();
|
|
|
|
|
2011-07-02 16:06:10 +02:00
|
|
|
void toggle_fullscreen();
|
2011-07-02 15:28:38 +02:00
|
|
|
void global_input();
|
|
|
|
|
2011-06-28 19:23:02 +02:00
|
|
|
double frand();
|
|
|
|
|
2011-07-02 15:28:38 +02:00
|
|
|
#endif
|