breakhack/src/monster.h

124 lines
2.4 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/>.
*/
#ifndef MONSTER_H_
#define MONSTER_H_
2018-02-21 00:29:21 +01:00
#include <SDL.h>
#include "sprite.h"
#include "stats.h"
2017-12-15 15:03:29 +01:00
#include "actiontext.h"
#include "player.h"
2018-05-15 11:16:56 +02:00
#include "linkedlist.h"
struct UpdateData;
typedef enum {
PACIFIST,
NORMAL,
HOSTILE,
GUERILLA,
2018-05-21 21:03:59 +02:00
COWARD,
SENTINEL,
FIRE_DEMON,
SORCERER,
ASSASSIN
} MonsterBehaviour;
typedef enum {
PASSIVE,
AGRESSIVE,
SCARED,
2018-05-21 21:03:59 +02:00
STATIONARY,
SLEEPING,
SCANNING,
STUNNED
} StateType;
typedef struct State {
StateType current;
StateType last;
unsigned int stepsSinceChange;
Uint8 forceCount;
} State;
typedef struct MonsterStateIndicator {
Sprite *sprite;
bool shownOnPlayerRoomEnter;
int displayCount;
} MonsterStateIndicator;
typedef struct Monster {
2018-01-17 09:32:49 +01:00
char *label;
2018-01-25 10:45:05 +01:00
char *lclabel;
Sprite *sprite;
Stats stats;
State state;
MonsterStateIndicator stateIndicator;
MonsterBehaviour behaviour;
2018-02-19 15:09:04 +01:00
unsigned int steps;
bool boss;
bool bloodlust;
} Monster;
2018-05-15 11:16:56 +02:00
Monster* monster_create(void);
2017-12-15 15:03:29 +01:00
void
monster_update_pos(Monster*, Position);
2018-02-19 15:09:04 +01:00
bool
2018-08-13 13:11:32 +02:00
monster_move(Monster*, RoomMatrix*, Map*);
2017-12-17 13:43:41 +01:00
void
monster_render(Monster*, Camera*);
void
monster_render_top_layer(Monster*, RoomMatrix*, Camera*);
void
monster_hit(Monster*, unsigned int dmg);
void
monster_update_stats_for_level(Monster*, unsigned int level);
2018-01-25 10:45:05 +01:00
2018-05-15 11:16:56 +02:00
void
monster_update(Monster*, struct UpdateData*);
2018-05-15 11:16:56 +02:00
void
monster_drop_loot(Monster*, Map*, Player*);
void
monster_set_behaviour(Monster *, MonsterBehaviour behaviour);
void
monster_set_state(Monster *m, StateType state, Uint8 forceCount);
2018-08-09 15:31:27 +02:00
void
monster_push(Monster *, Player *, RoomMatrix*, Vector2d dir);
void
monster_reset_steps(Monster *m);
void
monster_set_bloodlust(Monster*, bool bloodlust);
void
monster_destroy(Monster*);
#endif // MONSTER_H_