Files
thepool/source/actor.h
JailDoctor 312bed64da - Afegit nom als actors
- [BUG] Els actors es movien magicament (push no definit)
- Clear de actors
- Comencem amb l'editor
2023-06-04 11:37:27 +02:00

81 lines
1.5 KiB
C++

#pragma once
#include <SDL2/SDL.h>
#include "misc.h"
#define FLAG_NONE 0
#define FLAG_HERO 1
#define FLAG_PUSHABLE 2
#define FLAG_REACTIVE 4
#define FLAG_MOVING 8
#define FLAG_ANIMATED 16
#define FLAG_ORIENTABLE 32
#define FLAG_DEADLY 64
#define FLAG_GRAVITY 128
#define PUSH_NONE 0
#define PUSH_XP 1
#define PUSH_XN 2
#define PUSH_YP 4
#define PUSH_YN 8
#define PUSH_ZP 16
#define PUSH_ZN 32
#define MOV_NONE 0
#define MOV_X 1
#define MOV_Y 2
#define MOV_Z 3
#define MOV_CW 4
#define MOV_CCW 5
#define MOV_RAND 6
#define MOV_HUNT 7
namespace actor
{
struct actor_t
{
char name[8];
SDL_Rect bmp_rect;
SDL_Point bmp_offset;
vec3_t pos;
vec3_t size;
uint8_t orient;
uint8_t anim_cycle;
uint8_t flags;
uint8_t push;
uint8_t react_mask;
uint8_t react_push;
uint8_t movement;
uint8_t mov_push;
actor_t *below;
actor_t *above;
actor_t *prev;
actor_t *next;
};
actor_t *getFirst();
actor_t *create(const char *name, vec3_t p, vec3_t s, SDL_Rect r, SDL_Point o);
void setDirty(actor_t *act, const bool force=false);
void reorder();
void update(actor_t *act, const bool update_all=true);
void draw(actor_t *act, const bool draw_all=true);
actor_t *find_at(const int x, const int y, const int z);
actor_t *get_collision(actor_t *act);
const bool check_collision(actor_t *obj1, actor_t *obj2);
void clear();
}