/* Badguy type: */
-typedef struct bad_guy_type
- {
- int mode;
- DyingType dying;
- int kind;
- bool seen;
- int dir;
- int frame;
- base_type base;
- base_type old_base;
- timer_type timer;
- physic_type physic;
- }
-bad_guy_type;
+struct bad_guy_type
+{
+ int mode;
+ DyingType dying;
+ int kind;
+ bool seen;
+ int dir;
+ int frame;
+ base_type base;
+ base_type old_base;
+ timer_type timer;
+ physic_type physic;
+};
/* Bad guy kinds: */
#define BITW_MASK 31
#define BITN(n) ((BITW)1 << (n))
-typedef struct bitmask
+struct bitmask
{
int w,h;
BITW *bits;
-} bitmask;
+};
/* Creates a bitmask of width w and height h.
* The mask is automatically cleared when created.
BUTTON_HOVER
};
-typedef struct button_type
- {
- texture_type icon;
- texture_type* bkgd;
- char *info;
- SDLKey shortcut;
- int x;
- int y;
- int w;
- int h;
- bool show_info;
- ButtonState state;
- int tag;
- }
-button_type;
+struct button_type
+{
+ texture_type icon;
+ texture_type* bkgd;
+ char *info;
+ SDLKey shortcut;
+ int x;
+ int y;
+ int w;
+ int h;
+ bool show_info;
+ ButtonState state;
+ int tag;
+};
void button_load(button_type* pbutton,char* icon_file, char* info, SDLKey shortcut, int x, int y);
button_type* button_create(char* icon_file, char* info, SDLKey shortcut, int x, int y);
void button_event(button_type* pbutton, SDL_Event* event);
int button_get_state(button_type* pbutton);
-typedef struct button_panel_type
- {
- int num_items;
- int hidden;
- int x,y;
- int w,h;
- button_type* item;
- }
-button_panel_type;
+struct button_panel_type
+{
+ int num_items;
+ int hidden;
+ int x,y;
+ int w,h;
+ button_type* item;
+};
void button_panel_init(button_panel_type* pbutton_panel, int x, int y, int w, int h);
void button_panel_free(button_panel_type* pbutton_panel);
texture_draw(&img_solid[3], x, y);
else if (c == '$')
{
-
z = (frame / 2) % 6;
if (z < 4)
#define LEVEL_NAME_MAX 20
-typedef struct st_level
+struct st_level
{
std::string name;
std::string theme;
int bkgd_blue;
int width;
float gravity;
-}
-st_level;
+};
extern texture_type img_bkgd, img_bkgd_tile[2][4], img_solid[4], img_brick[2];
#ifndef SUPERTUX_LEVELEDITOR_H
#define SUPERTUX_LEVELEDITOR_H
-typedef struct square
- {
- int x1, y1, x2, y2;
- }
-square;
+struct square
+{
+ int x1, y1, x2, y2;
+};
/* selection modes */
enum {
MN_HL /* horizontal line */
};
-typedef struct menu_item_type
+struct menu_item_type
{
MenuItemKind kind;
int toggled;
char *input;
string_list_type* list;
void* target_menu;
- }
-menu_item_type;
+};
menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, void* target_menu);
void menu_item_change_text (menu_item_type* pmenu_item, const char *text);
void menu_item_change_input(menu_item_type* pmenu_item, const char *text);
-typedef struct menu_type
+struct menu_type
{
// center of the menu on the screen
int x;
int arrange_left;
menu_item_type *item;
timer_type effect;
-}
-menu_type;
+};
void menu_init (menu_type* pmenu);
void menu_free (menu_type* pmenu);
/* Physic type: */
-typedef struct physic_type
+struct physic_type
{
- int state;
- float start_vy;
- float start_vx;
- float acceleration;
- unsigned int start_time;
- }
-physic_type;
+ int state;
+ float start_vy;
+ float start_vx;
+ float acceleration;
+ unsigned int start_time;
+};
/* global variables. */
extern float gravity;
void player_input_init(player_input_type* pplayer_input);
-typedef struct player_type
+struct player_type
{
player_input_type input;
player_keymap_type keymap;
timer_type frame_timer;
physic_type vphysic;
physic_type hphysic;
-}
-player_type;
+};
extern texture_type tux_life,
tux_right[3], tux_left[3],
UPGRADE_HERRING
};
-typedef struct upgrade_type
- {
- int kind;
- base_type base;
- base_type old_base;
- }
-upgrade_type;
+struct upgrade_type
+{
+ int kind;
+ base_type base;
+ base_type old_base;
+};
-typedef struct bullet_type
- {
- base_type base;
- base_type old_base;
- }
-bullet_type;
+struct bullet_type
+{
+ base_type base;
+ base_type old_base;
+};
extern texture_type img_bullet;
extern bitmask* bm_bullet;
#include "texture.h"
/* Text type */
-typedef struct text_type
- {
- texture_type chars;
- texture_type shadow_chars;
- int kind;
- int w;
- int h;
- }
-text_type;
+struct text_type
+{
+ texture_type chars;
+ texture_type shadow_chars;
+ int kind;
+ int w;
+ int h;
+};
/* Kinds of texts. */
enum {
#include "screen.h"
/* Texture type */
-typedef struct texture_type
- {
- SDL_Surface* sdl_surface;
- unsigned gl_texture;
- int w;
- int h;
- } texture_type;
+struct texture_type
+{
+ SDL_Surface* sdl_surface;
+ unsigned gl_texture;
+ int w;
+ int h;
+};
void texture_setup(void);
extern void (*texture_load) (texture_type* ptexture, const std::string& file, int use_alpha);
#define SUPERTUX_TIMER_H
/* Timer type */
-typedef struct timer_type
- {
- unsigned int period;
- unsigned int time;
- unsigned int (*get_ticks) (void);
- }
-timer_type;
+struct timer_type
+{
+ unsigned int period;
+ unsigned int time;
+ unsigned int (*get_ticks) (void);
+};
extern unsigned int st_pause_ticks, st_pause_count;
/* 'Base' type for game objects */
-typedef struct base_type
- {
- float x;
- float y;
- float xm;
- float ym;
- float width;
- float height;
- }
-base_type;
-
-
-typedef struct string_list_type
+struct base_type
{
- int num_items;
- int active_item;
- char **item;
- }
-string_list_type;
+ float x;
+ float y;
+ float xm;
+ float ym;
+ float width;
+ float height;
+};
+
+struct string_list_type
+{
+ int num_items;
+ int active_item;
+ char **item;
+};
void string_list_init(string_list_type* pstring_list);
char* string_list_active(string_list_type* pstring_list);
#define NO_BOUNCE 0
#define BOUNCE 1
-typedef struct bouncy_distro_type /*It is easier to read the sources IMHO, if we don't write something like int a,b,c; */
- {
- base_type base;
- }
-bouncy_distro_type;
+struct bouncy_distro_type
+{
+ base_type base;
+};
extern texture_type img_distro[4];
#define BOUNCY_BRICK_MAX_OFFSET 8
#define BOUNCY_BRICK_SPEED 0.9
-typedef struct broken_brick_type
- {
- base_type base;
- timer_type timer;
- }
-broken_brick_type;
+struct broken_brick_type
+{
+ base_type base;
+ timer_type timer;
+};
void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float xm, float ym);
void broken_brick_action(broken_brick_type* pbroken_brick);
void broken_brick_draw(broken_brick_type* pbroken_brick);
-typedef struct bouncy_brick_type
- {
- float offset;
- float offset_m;
- int shape;
- base_type base;
- }
-bouncy_brick_type;
+struct bouncy_brick_type
+{
+ float offset;
+ float offset_m;
+ int shape;
+ base_type base;
+};
void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y);
void bouncy_brick_action(bouncy_brick_type* pbouncy_brick);
void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick);
-typedef struct floating_score_type
- {
- int value;
- timer_type timer;
- base_type base;
- }
-floating_score_type;
+struct floating_score_type
+{
+ int value;
+ timer_type timer;
+ base_type base;
+};
void floating_score_init(floating_score_type* pfloating_score, float x, float y, int s);
void floating_score_action(floating_score_type* pfloating_score);