breakhack/src/player.h

100 lines
2.1 KiB
C
Raw Normal View History

2018-02-16 18:11:26 +01:00
/*
* BreakHack - A dungeone crawler RPG
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2017-11-30 21:00:47 +01:00
#ifndef PLAYER_H_
#define PLAYER_H_
2018-02-21 00:29:21 +01:00
#include <SDL.h>
2017-11-30 21:00:47 +01:00
#include "sprite.h"
#include "stats.h"
#include "actiontext.h"
#include "camera.h"
#include "skill.h"
#include "linkedlist.h"
#include "input.h"
#define PLAYER_SKILL_COUNT 5
2017-11-30 21:00:47 +01:00
// Foward declare
struct UpdateData;
typedef enum PlayerClass { ENGINEER, MAGE, PALADIN, ROGUE, WARRIOR } class_t;
typedef enum PlayerState { ALIVE, DEAD, FALLING } state_t;
typedef struct PlayerStatData_t {
unsigned int total_steps;
unsigned int steps;
unsigned int hits;
unsigned int kills;
unsigned int misses;
} PlayerStatData;
2017-11-30 21:00:47 +01:00
typedef struct ExperienceData_t {
unsigned int previousLevel;
unsigned int current;
unsigned int nextLevel;
unsigned int level;
} ExperienceData;
2017-12-15 08:08:45 +01:00
typedef struct Player_t {
Sprite *sprite;
Stats stats;
unsigned int daggers;
LinkedList *projectiles;
2017-12-17 13:43:41 +01:00
unsigned int xp;
2018-01-25 10:45:05 +01:00
double gold;
PlayerStatData stat_data;
2018-02-03 13:02:39 +01:00
unsigned int potion_sips;
class_t class;
state_t state;
Skill *skills[PLAYER_SKILL_COUNT];
Timer *animationTimer;
} Player;
Player*
player_create(class_t, SDL_Renderer*);
ExperienceData
player_get_xp_data(Player*);
void
player_monster_kill_check(Player*, Monster*);
void
player_sip_health(Player*);
void
player_hit(Player*, unsigned int dmg);
void
player_reset_steps(Player*);
void
player_update(struct UpdateData *);
void
player_render(Player*, Camera*);
2017-12-17 13:43:41 +01:00
void
player_destroy(Player*);
2017-11-30 21:00:47 +01:00
bool
player_turn_over(Player*);
2017-11-30 21:00:47 +01:00
#endif // PLAYER_H_