To create a slave, pass ENEMY_IMMUNE for hp in create_enemy(). tip: create_enemyg(...) is an abbreviation for create_enemy(&global.enemies, ...). There is something like a super fancy event system for Enemies' logic rules now: logic_rule will be called with t = negative special values like EVENT_BIRTH or EVENT_DEATH on corresponding events. cool, isn't it? well those values have to be filtered out (like if(t < 0) return;) if you don't use them so they don't do strange things with your locus.
85 lines
No EOL
1.2 KiB
C
85 lines
No EOL
1.2 KiB
C
/*
|
|
* This software is licensed under the terms of the MIT-License
|
|
* See COPYING for further information.
|
|
* ---
|
|
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
|
*/
|
|
|
|
#ifndef GLOBAL_H
|
|
#define GLOBAL_H
|
|
|
|
#include <SDL/SDL.h>
|
|
#include "player.h"
|
|
#include "projectile.h"
|
|
#include "enemy.h"
|
|
#include "poweritem.h"
|
|
#include "audio.h"
|
|
#include "boss.h"
|
|
#include "laser.h"
|
|
#include "shader.h"
|
|
|
|
enum {
|
|
SCREEN_W = 800,
|
|
SCREEN_H = 600,
|
|
|
|
VIEWPORT_X = 40,
|
|
VIEWPORT_Y = 20,
|
|
VIEWPORT_W = 480,
|
|
VIEWPORT_H = 560,
|
|
|
|
POINT_OF_COLLECT = VIEWPORT_H/4,
|
|
|
|
SNDSRC_COUNT = 30,
|
|
|
|
EVENT_DEATH = -8999,
|
|
EVENT_BIRTH,
|
|
|
|
FPS = 60
|
|
};
|
|
|
|
#define FILE_PREFIX PREFIX "/share/taisei/"
|
|
|
|
typedef struct {
|
|
Player plr;
|
|
Projectile *projs;
|
|
Enemy *enemies;
|
|
Poweritem *poweritems;
|
|
Laser *lasers;
|
|
|
|
int frames;
|
|
|
|
Texture *textures;
|
|
Animation *animations;
|
|
Sound *sounds;
|
|
Shader *shaders;
|
|
|
|
struct {
|
|
GLuint fbo;
|
|
GLuint tex;
|
|
GLuint depth;
|
|
|
|
int nw,nh;
|
|
} rtt;
|
|
|
|
Boss *boss;
|
|
|
|
ALuint sndsrc[SNDSRC_COUNT];
|
|
|
|
int game_over;
|
|
int points;
|
|
|
|
int fpstime; // frame counter
|
|
int fps;
|
|
|
|
int lasttime;
|
|
} Global;
|
|
|
|
extern Global global;
|
|
|
|
void init_global();
|
|
void init_rtt();
|
|
void game_over();
|
|
|
|
void frame_rate();
|
|
|
|
#endif |