94 lines
1.6 KiB
C
Executable File
94 lines
1.6 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
|
|
{
|
|
int type :4;
|
|
unsigned empty :20;
|
|
unsigned x :4;
|
|
unsigned y :4;
|
|
} earth_t;
|
|
|
|
#define BRICK 2
|
|
typedef struct
|
|
{
|
|
int type :4;
|
|
unsigned time_hit_id :20;
|
|
unsigned content :4;
|
|
unsigned number :4;
|
|
} brick_t;
|
|
|
|
//#define PLATEFORM 4
|
|
#define TUYAU 5 // X, Y, _ (XY tileset)
|
|
typedef struct
|
|
{
|
|
int type :4;
|
|
unsigned empty :20;
|
|
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
|
|
{
|
|
int type :4;
|
|
unsigned time_hit_id :20;
|
|
unsigned content :4;
|
|
unsigned number :4;
|
|
} gift_t;
|
|
|
|
#define COIN 7 // s, _, _ (state)
|
|
typedef struct
|
|
{
|
|
int type :4;
|
|
int empty :24;
|
|
unsigned taken :4;
|
|
} coin_t;
|
|
|
|
// Generic container
|
|
typedef struct
|
|
{
|
|
int type :4;
|
|
unsigned data :28; // raw binary format
|
|
} world_t;
|
|
|
|
int world_get_width();
|
|
|
|
world_t* world_get(int x, int y);
|
|
|
|
void display_cell(int cx, int cy, int sx, int sy);
|
|
|
|
void world_set(world_t * w);
|
|
|
|
void world_draw(int x, int y);
|
|
|
|
int world_get_real_x0(int x);
|
|
int world_get_real_y0(int y);
|
|
|
|
void world_reset();
|
|
|
|
#define CTG_SOIL 1
|
|
#define CTG_EMPTY 2
|
|
#define CTG_DEATH 3
|
|
int world_get_ctg(int x, int y);
|
|
|
|
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 |