2019-11-16 11:44:09 +01:00
|
|
|
#ifndef WORLD_H
|
|
|
|
#define WORLD_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2019-11-24 14:28:04 +01:00
|
|
|
#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
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
typedef enum
|
2020-02-04 20:12:17 +01:00
|
|
|
{
|
|
|
|
EMPTY=0,
|
|
|
|
EARTH,
|
|
|
|
BRICK,
|
|
|
|
BLOC,
|
|
|
|
END_LEVEL,
|
|
|
|
TUYAU,
|
|
|
|
ARBRE,
|
|
|
|
GIFT,
|
|
|
|
COIN,
|
|
|
|
NUAGE,
|
|
|
|
BUISSON,
|
|
|
|
COLLINE,
|
|
|
|
CASTLE,
|
|
|
|
} cell_id;
|
2019-12-04 19:27:27 +01:00
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-04 19:27:27 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned empty :16;
|
2019-12-04 19:27:27 +01:00
|
|
|
unsigned x :4;
|
|
|
|
unsigned y :4;
|
|
|
|
} earth_t;
|
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-04 19:27:27 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned time_hit_id :8;
|
2019-12-07 14:32:38 +01:00
|
|
|
unsigned state :4;
|
2019-12-05 19:24:16 +01:00
|
|
|
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
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-05 19:24:16 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned data :24; // raw binary format
|
2019-12-05 19:24:16 +01:00
|
|
|
} bloc_t;
|
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
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
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-04 19:27:27 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned empty :16;
|
2019-12-04 19:27:27 +01:00
|
|
|
unsigned x :4;
|
|
|
|
unsigned y :4;
|
|
|
|
} tuyau_t;
|
|
|
|
|
2020-02-04 20:12:17 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned type :8;
|
|
|
|
unsigned empty :16;
|
|
|
|
unsigned x :4;
|
|
|
|
unsigned y :4;
|
|
|
|
} arbre_t;
|
|
|
|
|
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-04 19:27:27 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned time_hit_id :8;
|
2019-12-07 14:32:38 +01:00
|
|
|
unsigned state :4;
|
2019-12-05 19:24:16 +01:00
|
|
|
unsigned hidden :4;
|
2019-12-04 19:27:27 +01:00
|
|
|
unsigned content :4;
|
|
|
|
unsigned number :4;
|
|
|
|
} gift_t;
|
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-04 19:27:27 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +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
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-12-05 19:24:16 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned empty :16;
|
2019-12-05 19:24:16 +01:00
|
|
|
unsigned x :4;
|
|
|
|
unsigned y :4;
|
|
|
|
} deco_t;
|
|
|
|
|
2020-02-04 20:12:17 +01:00
|
|
|
// Generic container 32 bits
|
2020-01-06 18:43:36 +01:00
|
|
|
typedef struct
|
2019-11-16 11:44:09 +01:00
|
|
|
{
|
2020-01-06 18:43:36 +01:00
|
|
|
unsigned type :8;
|
|
|
|
unsigned data :24; // raw binary format
|
2020-01-30 21:09:18 +01:00
|
|
|
} cell_t;
|
2019-11-16 11:44:09 +01:00
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
int worldGetWidth();
|
2019-11-25 19:12:25 +01:00
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
cell_t* worldGetCell(int x, int y);
|
2019-11-16 11:44:09 +01:00
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
void cellDraw(int cx, int cy, int sx, int sy, int plan);
|
2019-11-16 11:44:09 +01:00
|
|
|
|
2020-02-18 13:03:57 +01:00
|
|
|
void worldSet(int w, int h, int x, int y, cell_t * a);
|
2019-11-16 11:44:09 +01:00
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
void worldDraw();
|
|
|
|
void worldMove();
|
2019-11-16 12:02:30 +01:00
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
void worldReset();
|
2019-11-20 15:33:34 +01:00
|
|
|
|
|
|
|
#define CTG_SOIL 1
|
|
|
|
#define CTG_EMPTY 2
|
2020-01-15 20:42:51 +01:00
|
|
|
#define CTG_WATER 3
|
|
|
|
#define CTG_DEATH 4
|
2020-02-16 20:43:35 +01:00
|
|
|
int worldGetCellCategory(int x, int y);
|
2020-01-30 21:09:18 +01:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
int start_x;
|
|
|
|
int start_y;
|
2020-02-18 13:03:57 +01:00
|
|
|
cell_t* data;
|
2020-01-30 21:09:18 +01:00
|
|
|
}map_t;
|
|
|
|
|
|
|
|
extern map_t * map_current;
|
2019-11-24 14:28:04 +01:00
|
|
|
|
2020-01-06 18:43:36 +01:00
|
|
|
#endif
|