78 lines
1.8 KiB
C
78 lines
1.8 KiB
C
#include "main.h"
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_image.h>
|
|
#include "fileHandler.h"
|
|
#include "logHelper.h"
|
|
|
|
#ifndef ARENAENGINE_H_
|
|
#define ARENAENGINE_H_
|
|
|
|
|
|
|
|
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];
|
|
int Race;
|
|
|
|
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);
|
|
int setTileTypeID(ARENA_H_TILE* arena, int x, int y, int new_id);
|
|
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);
|
|
int isGroundTile(TILE *t_list, int id);
|
|
SDL_Surface *getTileSurfaceFromID(TILE *t_list, int id);
|
|
int isPlayerAdjacent(PLAYER* p1, PLAYER* p2);
|
|
int isMoveCorrect(ARENA_H_TILE* arena, TILE *t_list, PLAYER *p_list, int coord_x, int coord_y, int direction);
|
|
int getRelativeDirection(SDL_Rect pos1, SDL_Rect pos2);
|
|
|
|
int NumberPlayerAlive(PLAYER *Head);
|
|
int canAttackPlayer(PLAYER *p1, PLAYER *p2);
|
|
void AttackPlayer(PLAYER *player1, PLAYER *player2);
|
|
void ActionPlayer(ARENA_H_TILE* arena,TILE *t_list,PLAYER *p_list,PLAYER *player,int action);
|
|
|
|
#endif
|