1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#ifndef _SUPPORT_H_
#define _SUPPORT_H_
#include <SDL/SDL.h>
#include <stdlib.h>
#include <string.h>
#include "stdarg.h"
#include <math.h>
#define clip_xmin(pnt) pnt->clip_rect.x
#define clip_xmax(pnt) pnt->clip_rect.x + pnt->clip_rect.w-1
#define clip_ymin(pnt) pnt->clip_rect.y
#define clip_ymax(pnt) pnt->clip_rect.y + pnt->clip_rect.h-1
#define sign(x) ((x) > 0 ? 1 : ((x) == 0 ? 0 : (-1) ))
#define CHECKPOINT error(ERR_DEBUG,"Checkpoint file:%s line:%d function:%s",__FILE__,__LINE__,__FUNCTION__)
#define WIDTH 320
#define HEIGHT 480
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define degtorad(x) ((M_PI/180.0)*(x))
#define radtodeg(x) ( (int)((x)/(M_PI/180.0)+360)%360 )
enum _errlevel { ERR_DEBUG, ERR_INFO, ERR_WARN, ERR_FATAL };
enum _state {
ST_START_INTRO,
ST_INTRO,
ST_MENU,
ST_GAME_DEMO,
ST_GAME_PLAY,
ST_GAME_OVER,
ST_SHOW_HCLIST,
ST_ENTRY_HCLIST,
ST_GAME_QUIT
};
enum _diff { DIFF_EASY=0, DIFF_MEDIUM=1, DIFF_HARD=2 };
typedef struct _imglist {
char name[256];
int refcount;
SDL_Surface *img;
struct _imglist *next;
} IMGLIST;
struct _gamestate {
int mainstate; /* Aktueller Status */
int substate; /* Aktueller Status Subsystem */
int newstate; /* 1: Statuswechsel */
};
typedef struct _gamestate GAMESTATE;
typedef struct {
int u;
int d;
int l;
int r;
int f;
int e;
} KEYCONFIG;
#include "font.h"
#include "menu.h"
#include "hiscore.h"
#include "fps.h"
void game_init(int argc, char *argv[]);
void toggle_fullscreen();
void error(int errorlevel, char *msg, ...);
SDL_Surface *loadbmp(char *filename);
void unloadbmp_by_surface(SDL_Surface *s);
void unloadbmp_by_name(char *name);
void imglist_add(SDL_Surface *s, char *name);
SDL_Surface *imglist_search(char *name);
void imglist_garbagecollect();
Uint32 getpixel(SDL_Surface *surface, int x, int y);
void putpixel(SDL_Surface *surface, int x, int y, Uint32 color);
void draw_line(SDL_Surface *s, int x1, int y1, int x2, int y2, Uint32 farbe1, Uint32 farbe2);
void draw_line_simple(SDL_Surface *s, int x1, int y1, int x2, int y2, Uint32 farbe1);
void blit_scaled(SDL_Surface *src, SDL_Rect *src_rct, SDL_Surface *dst, SDL_Rect *dst_rct);
void blit_calpha(SDL_Surface *src, SDL_Rect *src_rct, SDL_Surface *dst, SDL_Rect *dst_rct);
void keyboard_clear();
void keyboard_poll();
int keyboard_keypressed();
void newstate(int m, int s, int n);
void *mmalloc(size_t size);
void preload_gfx();
void display_vidinfo();
#endif
|