79 lines
1.5 KiB
C
79 lines
1.5 KiB
C
#include "main.h"
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_image.h>
|
|
|
|
#ifndef ARENAENGINE_H_
|
|
#define ARENAENGINE_H_
|
|
|
|
|
|
|
|
/*
|
|
typedef struct items{
|
|
int type_id;
|
|
//texture?
|
|
int isFlat;
|
|
int minedId;
|
|
struct items *nextItem;
|
|
}ITEMS;
|
|
*/
|
|
|
|
typedef struct tileType{
|
|
int type_id;
|
|
SDL_Surface *texture;
|
|
int isGround;
|
|
int canBeMined;
|
|
struct tileType *nextTile;
|
|
}TILE;
|
|
|
|
typedef struct Player
|
|
{
|
|
int Id;
|
|
char Name[35];
|
|
//char Race[20];
|
|
|
|
SDL_Surface *texture[4];
|
|
|
|
int HealthPoints;
|
|
int AttacksPoints;
|
|
int DefensePoints;
|
|
|
|
int PositionX;
|
|
int PositionY;
|
|
//char Weapons[Max_Weapons];
|
|
|
|
//int Coins;
|
|
|
|
struct Player * suiv;
|
|
|
|
}PLAYER;
|
|
|
|
typedef struct arena_h_tile{ //Rows chained list
|
|
int type_id;
|
|
//PLAYER* playerOnTile;
|
|
struct arena_h_tile *nextRow;
|
|
struct arena_w_tile *nextColumn;
|
|
}ARENA_H_TILE;
|
|
|
|
typedef struct arena_w_tile{ //Columns chained list
|
|
int type_id;
|
|
//PLAYER* playerOnTile;
|
|
struct arena_w_tile *nextColumn;
|
|
}ARENA_W_TILE;
|
|
|
|
|
|
//Generation functions
|
|
TILE* createTileList(void);
|
|
PLAYER *createPlayerList(void);
|
|
void clearRessourcesCache(TILE *t, PLAYER *p);
|
|
ARENA_H_TILE* genNewArena(int size_h, int size_w);
|
|
void deleteArena(ARENA_H_TILE* arena);
|
|
|
|
//Status functions
|
|
int getTileTypeID(ARENA_H_TILE* arena, int coord_x, int coord_y);
|
|
SDL_Surface *getTileSurfaceFromID(TILE *t_list, int id);
|
|
int isPlayerAdjacent(PLAYER* p1, PLAYER* p2);
|
|
int isMoveCorrect(int coord_x, int coord_y, int direction);
|
|
int getRelativeDirection(SDL_Rect pos1, SDL_Rect pos2);
|
|
|
|
#endif
|