138 lines
2.3 KiB
C
Executable File
138 lines
2.3 KiB
C
Executable File
#ifndef WORLD_H
|
|
#define WORLD_H
|
|
|
|
#include <stdint.h>
|
|
#include <gint/display.h>
|
|
|
|
#define W_CELL_SIZEPX 8
|
|
#define W_SIZE_X 160
|
|
#define W_SIZE_Y 16
|
|
|
|
|
|
#define EMPTY 0
|
|
|
|
#define EARTH 1 // X, Y, _ (XY tileset)
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned empty :16;
|
|
unsigned x :4;
|
|
unsigned y :4;
|
|
} earth_t;
|
|
|
|
#define BRICK 2
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned time_hit_id :8;
|
|
unsigned state :4;
|
|
unsigned hidden :4;
|
|
unsigned content :4;
|
|
unsigned number :4;
|
|
} brick_t;
|
|
|
|
#define BLOC 3
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned data :24; // raw binary format
|
|
} bloc_t;
|
|
|
|
#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;
|
|
|
|
#define TUYAU 5 // X, Y, _ (XY tileset)
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned empty :16;
|
|
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
|
|
{
|
|
unsigned type :8;
|
|
unsigned time_hit_id :8;
|
|
unsigned state :4;
|
|
unsigned hidden :4;
|
|
unsigned content :4;
|
|
unsigned number :4;
|
|
} gift_t;
|
|
|
|
#define COIN 7 // s, _, _ (state)
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned empty :20;
|
|
unsigned taken :4;
|
|
} coin_t;
|
|
|
|
#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;
|
|
|
|
// Generic container
|
|
typedef struct
|
|
{
|
|
unsigned type :8;
|
|
unsigned data :24; // raw binary format
|
|
} cell_t;
|
|
|
|
int world_get_width();
|
|
|
|
cell_t* world_get(int x, int y);
|
|
|
|
void display_cell(int cx, int cy, int sx, int sy, int plan);
|
|
|
|
void world_set(int w, int h, int x, int y, cell_t const * a);
|
|
|
|
void world_draw();
|
|
void world_move();
|
|
|
|
int world_get_real_x0();
|
|
int world_get_real_y0();
|
|
|
|
void world_reset();
|
|
|
|
#define CTG_SOIL 1
|
|
#define CTG_EMPTY 2
|
|
#define CTG_WATER 3
|
|
#define CTG_DEATH 4
|
|
int world_get_ctg(int x, int y);
|
|
|
|
void reset_camera();
|
|
|
|
void init_level(int w, int h, int x, int y, cell_t const * a);
|
|
|
|
typedef struct
|
|
{
|
|
int w;
|
|
int h;
|
|
int start_x;
|
|
int start_y;
|
|
cell_t data[];
|
|
}map_t;
|
|
|
|
extern map_t * map_current;
|
|
|
|
#endif
|