Adoranda/include/player.h

57 lines
1.5 KiB
C
Raw Normal View History

2021-07-29 18:33:22 +02:00
#pragma once
#include "animation.h"
2021-08-07 01:49:03 +02:00
#include "engine.h"
2021-08-25 01:01:43 +02:00
#include "vec2.h"
2022-01-23 00:53:07 +01:00
#include "stats.h"
2022-01-24 15:15:12 +01:00
#include "capacite.h"
#include "inventory.h"
#include "define.h"
2021-08-15 03:46:49 +02:00
struct Player {
2021-08-19 02:29:51 +02:00
/*current position of the player on the map - Tile*/
2021-08-25 01:01:43 +02:00
struct Vec2 pos;
/*current position of the player on the map - pixels */
struct Vec2f pos_visual;
2022-01-23 00:53:07 +01:00
2022-02-13 21:46:52 +01:00
const struct Stats base_stats;
2022-01-23 00:53:07 +01:00
struct Stats stats;
2022-02-15 21:46:53 +01:00
struct Move *moves[NB_PLAYER_MOVES];
struct Inventory inventory;
2021-08-19 02:29:51 +02:00
/*player mid - offset pixels*/
int x_mid, y_mid;
2021-08-08 01:43:26 +02:00
/*the direction the player facing to*/
2021-07-29 18:33:22 +02:00
int direction;
2021-12-23 18:37:48 +01:00
/*if the player is sprinting*/
int sprint;
2021-08-08 01:43:26 +02:00
/*current frame of the animation*/
2021-07-29 18:33:22 +02:00
int frame;
2021-08-08 01:43:26 +02:00
/*where to draw the player on the screen*/
2021-08-04 20:12:53 +02:00
int show_x, show_y;
2021-08-08 01:43:26 +02:00
/*the current animation*/
int idle;
2021-08-15 03:46:49 +02:00
struct AnimData anim;
2021-07-29 18:33:22 +02:00
};
2022-03-23 01:16:24 +01:00
struct LevelUp {
int level;
int id_move;
};
struct LevelUpPlayer {
int nbLevelUp;
struct LevelUp *levelup[];
};
2021-08-08 01:43:26 +02:00
/*return the info tile value the player is facing to*/
2021-08-15 03:46:49 +02:00
int player_facing(struct Game const *game);
struct Player init_player(void);
2022-01-24 21:27:51 +01:00
void add_move(struct Player *player, struct Move move);
2022-01-24 23:57:07 +01:00
void draw_player_moves(struct Player *player);
2022-01-25 22:20:10 +01:00
void replace_capacities(struct Player *player, struct Move move);
void draw_ui(struct Player *player);
2022-02-17 01:04:45 +01:00
int get_nb_moves(struct Player *player);
2022-03-23 01:16:24 +01:00
void reset_pp(struct Player *player);
2022-04-02 01:57:54 +02:00
void check_level(struct Player *player, int prec_level);
2022-04-23 00:47:27 +02:00
void add_xp(struct Player *player, int xp);
int select_capacity(struct Player *player, char* context, bool allow_back);
void add_pp(struct Player *player, int amount);