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
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
|
|
|
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
2010-10-12 10:55:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STAGE_H
|
|
|
|
#define STAGE_H
|
|
|
|
|
2011-06-28 19:23:02 +02:00
|
|
|
/* taisei's strange macro language.
|
|
|
|
*
|
|
|
|
* sorry, I guess it is bad style, but I hardcode everything and in that case
|
|
|
|
* you'll find yourself soon in a situation where you have to spread your
|
|
|
|
* coherent thoughts over frames using masses of redundant ifs.
|
|
|
|
* I've just invented this thingy to keep track of my sanity.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-08-23 17:37:14 +02:00
|
|
|
#define TIMER(ptr) int *__timep = ptr; int _i = 0, _ni = 0; _i = _ni = _i;
|
|
|
|
#define AT(t) if(*__timep == t)
|
2011-07-04 13:14:33 +02:00
|
|
|
#define FROM_TO(start,end,step) _ni = _ni; _i = (*__timep - (start))/(step); if(*__timep >= (start) && *__timep <= (end) && !((*__timep - (start)) % (step)))
|
2011-06-28 19:23:02 +02:00
|
|
|
#define FROM_TO_INT(start, end, step, dur, istep) \
|
|
|
|
_i = (*__timep - (start))/(step+dur); _ni = ((*__timep - (start)) % (step+dur))/istep; \
|
|
|
|
if(*__timep >= (start) && *__timep <= (end) && (*__timep - (start)) % ((dur) + (step)) <= dur && !((*__timep - (start)) % (istep)))
|
2011-06-26 13:45:27 +02:00
|
|
|
|
2011-08-23 17:37:14 +02:00
|
|
|
#define GO_AT(obj, start, end, vel) if(*__timep >= (start) && *__timep <= (end)) (obj)->pos += (vel);
|
|
|
|
#define GO_TO(obj, p, f) (obj)->pos += (f)*((p) - (obj)->pos);
|
2011-06-26 13:45:27 +02:00
|
|
|
|
2011-06-25 12:41:40 +02:00
|
|
|
typedef void (*StageRule)(void);
|
2012-01-06 21:52:55 +01:00
|
|
|
typedef void (*ShaderRule)(int);
|
2011-06-25 12:41:40 +02:00
|
|
|
|
2012-07-14 09:40:37 +02:00
|
|
|
typedef struct StageInfo {
|
|
|
|
StageRule loop;
|
|
|
|
int hidden;
|
|
|
|
// reserved for draw_stage_title when/if it's used
|
|
|
|
char *title;
|
|
|
|
char *subtitle;
|
|
|
|
} StageInfo;
|
|
|
|
|
|
|
|
StageInfo* stage_get(int);
|
2012-01-06 21:52:55 +01:00
|
|
|
void stage_loop(StageRule start, StageRule end, StageRule draw, StageRule event, ShaderRule *shaderrules, int endtime);
|
2011-06-25 12:41:40 +02:00
|
|
|
|
2012-01-06 21:52:55 +01:00
|
|
|
void apply_bg_shaders(ShaderRule *shaderrules);
|
2011-11-06 16:17:46 +01:00
|
|
|
void draw_stage_title(int t, int dur, char *stage, char *subtitle);
|
2012-07-14 09:40:37 +02:00
|
|
|
|
|
|
|
void stage0_loop();
|
|
|
|
void stage1_loop();
|
|
|
|
|
|
|
|
#endif
|