supercasiobros/include/world.h

131 lines
2.3 KiB
C
Raw Normal View History

2019-11-16 11:44:09 +01:00
#ifndef WORLD_H
#define WORLD_H
#include <stdint.h>
#include <gint/display.h>
2019-11-16 11:44:09 +01:00
#define W_CELL_SIZEPX 8
#define W_SIZE_X 160
#define W_SIZE_Y 16
2019-12-04 19:27:27 +01:00
#define EMPTY 0
2019-11-20 15:33:34 +01:00
#define EARTH 1 // X, Y, _ (XY tileset)
typedef struct
2019-12-04 19:27:27 +01:00
{
unsigned type :8;
unsigned empty :16;
2019-12-04 19:27:27 +01:00
unsigned x :4;
unsigned y :4;
} earth_t;
2019-11-20 15:33:34 +01:00
#define BRICK 2
typedef struct
2019-12-04 19:27:27 +01:00
{
unsigned type :8;
unsigned time_hit_id :8;
2019-12-07 14:32:38 +01:00
unsigned state :4;
unsigned hidden :4;
2019-12-04 19:27:27 +01:00
unsigned content :4;
unsigned number :4;
} brick_t;
2019-11-16 11:44:09 +01:00
#define BLOC 3
typedef struct
{
unsigned type :8;
unsigned data :24; // raw binary format
} bloc_t;
2019-12-08 16:34:32 +01:00
#define END_LEVEL 4
typedef struct
{
unsigned type :8;
unsigned empty :8;
unsigned avancement :4;
unsigned bonus :4; //*400
unsigned x :4; //=0
unsigned y :4;
} end_level_t;
2019-12-08 16:34:32 +01:00
2019-11-20 15:33:34 +01:00
#define TUYAU 5 // X, Y, _ (XY tileset)
typedef struct
2019-12-04 19:27:27 +01:00
{
unsigned type :8;
unsigned empty :16;
2019-12-04 19:27:27 +01:00
unsigned x :4;
unsigned y :4;
} tuyau_t;
#define GIFT 6 // s, t, n (state[hit time], type[vide=0, piece=1, ...], qté)
typedef struct
2019-12-04 19:27:27 +01:00
{
unsigned type :8;
unsigned time_hit_id :8;
2019-12-07 14:32:38 +01:00
unsigned state :4;
unsigned hidden :4;
2019-12-04 19:27:27 +01:00
unsigned content :4;
unsigned number :4;
} gift_t;
2019-11-20 15:33:34 +01:00
#define COIN 7 // s, _, _ (state)
typedef struct
2019-12-04 19:27:27 +01:00
{
unsigned type :8;
unsigned empty :20;
2019-12-04 19:27:27 +01:00
unsigned taken :4;
} coin_t;
2019-11-16 11:44:09 +01:00
#define NUAGE 8 // X, Y, _ (XY tileset)
#define BUISSON 9 // X, Y, _ (XY tileset)
#define COLLINE 10 // X, Y, _ (XY tileset)
#define CASTLE 11
typedef struct
{
unsigned type :8;
unsigned empty :16;
unsigned x :4;
unsigned y :4;
} deco_t;
2019-12-04 19:27:27 +01:00
// Generic container
typedef struct
2019-11-16 11:44:09 +01:00
{
unsigned type :8;
unsigned data :24; // raw binary format
2019-11-16 11:44:09 +01:00
} world_t;
int world_get_width();
2019-11-20 18:31:20 +01:00
world_t* world_get(int x, int y);
2019-11-16 11:44:09 +01:00
void display_cell(int cx, int cy, int sx, int sy, int plan);
2019-11-16 11:44:09 +01:00
2019-11-20 15:33:34 +01:00
void world_set(world_t * w);
2019-11-16 11:44:09 +01:00
2019-11-16 12:02:30 +01:00
void world_draw(int x, int y);
2019-12-08 16:34:32 +01:00
void world_move();
2019-11-16 12:02:30 +01:00
int world_get_real_x0();
int world_get_real_y0();
2019-11-20 15:33:34 +01:00
void world_reset();
2019-11-20 15:33:34 +01:00
#define CTG_SOIL 1
#define CTG_EMPTY 2
#define CTG_DEATH 3
int world_get_ctg(int x, int y);
void reset_camera();
extern world_t * w_current;
extern image_t * w_fond;
extern int w_current_x;
extern int w_current_y;
extern int w_mario_startx;
extern int w_mario_starty;
#endif