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
|
2017-02-11 04:52:08 +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 STAGE_H
|
|
|
|
#define STAGE_H
|
|
|
|
|
2011-06-28 19:23:02 +02:00
|
|
|
/* taisei's strange macro language.
|
2017-02-11 04:52:08 +01:00
|
|
|
*
|
2011-06-28 19:23:02 +02:00
|
|
|
* 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.
|
2017-02-11 04:52:08 +01:00
|
|
|
*
|
2011-06-28 19:23:02 +02:00
|
|
|
*/
|
|
|
|
|
2017-02-11 04:52:08 +01:00
|
|
|
#include <stdbool.h>
|
2017-02-10 11:39:42 +01:00
|
|
|
#include "projectile.h"
|
|
|
|
#include "boss.h"
|
2012-07-27 12:18:21 +02:00
|
|
|
|
2017-02-10 00:24:19 +01:00
|
|
|
typedef enum {
|
2017-02-10 11:39:42 +01:00
|
|
|
D_Any = 0,
|
|
|
|
D_Easy,
|
2017-02-10 00:24:19 +01:00
|
|
|
D_Normal,
|
|
|
|
D_Hard,
|
2017-02-10 11:39:42 +01:00
|
|
|
D_Lunatic,
|
|
|
|
D_Extra // reserved for later
|
2017-02-10 00:24:19 +01:00
|
|
|
} Difficulty;
|
|
|
|
|
2011-08-23 17:37:14 +02:00
|
|
|
#define TIMER(ptr) int *__timep = ptr; int _i = 0, _ni = 0; _i = _ni = _i;
|
2017-02-11 04:52:08 +01:00
|
|
|
#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
|
|
|
|
2017-02-10 11:39:42 +01:00
|
|
|
// highest bit of uint16_t, WAY higher than the amount of spells in this game can ever possibly be
|
|
|
|
#define STAGE_SPELL_BIT 0x8000
|
|
|
|
|
|
|
|
typedef enum StageType {
|
|
|
|
STAGE_STORY = 1,
|
|
|
|
STAGE_EXTRA,
|
|
|
|
STAGE_SPELL,
|
|
|
|
} StageType;
|
|
|
|
|
2012-07-14 09:40:37 +02:00
|
|
|
typedef struct StageInfo {
|
2017-02-11 10:52:37 +01:00
|
|
|
//
|
|
|
|
// don't reorder these!
|
|
|
|
//
|
|
|
|
|
2017-02-10 11:39:42 +01:00
|
|
|
uint16_t id; // must match type of ReplayStage.stage in replay.h
|
2012-07-14 09:40:37 +02:00
|
|
|
StageRule loop;
|
2017-02-10 11:39:42 +01:00
|
|
|
StageType type;
|
2012-07-14 09:40:37 +02:00
|
|
|
char *title;
|
|
|
|
char *subtitle;
|
2012-07-27 12:18:21 +02:00
|
|
|
Color titleclr;
|
2017-02-03 16:56:36 +01:00
|
|
|
Color bosstitleclr;
|
2017-02-10 11:39:42 +01:00
|
|
|
AttackInfo *spell;
|
|
|
|
Difficulty difficulty;
|
2017-02-11 10:52:37 +01:00
|
|
|
|
|
|
|
bool unlocked;
|
2012-07-14 09:40:37 +02:00
|
|
|
} StageInfo;
|
|
|
|
|
2012-07-14 10:40:21 +02:00
|
|
|
extern StageInfo stages[];
|
2017-02-10 11:39:42 +01:00
|
|
|
StageInfo* stage_get(uint16_t);
|
2017-02-10 23:34:48 +01:00
|
|
|
StageInfo* stage_get_by_spellcard(AttackInfo *spell, Difficulty diff);
|
2017-02-10 11:39:42 +01:00
|
|
|
void stage_init_array(void);
|
2012-07-14 10:40:21 +02:00
|
|
|
|
2017-02-10 11:39:42 +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);
|
2012-07-27 12:18:21 +02:00
|
|
|
|
|
|
|
void draw_stage_title(StageInfo *info);
|
2012-08-12 20:16:40 +02:00
|
|
|
void draw_hud(void);
|
2012-07-14 09:40:37 +02:00
|
|
|
|
2012-08-17 20:58:23 +02:00
|
|
|
void stage_pause(void);
|
|
|
|
void stage_gameover(void);
|
|
|
|
|
2017-02-10 11:39:42 +01:00
|
|
|
#include "stages/stage1.h"
|
|
|
|
#include "stages/stage2.h"
|
|
|
|
#include "stages/stage3.h"
|
|
|
|
#include "stages/stage4.h"
|
|
|
|
#include "stages/stage5.h"
|
|
|
|
#include "stages/stage6.h"
|
|
|
|
|
2012-07-14 09:40:37 +02:00
|
|
|
#endif
|