aboutsummaryrefslogtreecommitdiff
path: root/src/entities.h
blob: 4469896c039a5a0c9b8ca9d37234b9a395fc96fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
   Kitsune's Curse
   Copyright (C) 2020-2023 Juan J. Martinez <jjm@usebox.net>

   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 <https://www.gnu.org/licenses/>.
 */
#ifndef _ENTITIES_H
#define _ENTITIES_H

#include <stdint.h>

#ifndef LOCAL
#define LOCAL extern
#endif

struct st_entity
{
    uint8_t type;
    uint8_t id;
    uint8_t frame;
    uint8_t delay;
    uint8_t x;
    uint8_t ox;
    uint8_t y;
    uint8_t oy;
    uint8_t param;
    uint8_t extra;
    void (*update)();
    void (*draw)();
    struct st_entity *n;
};

// entitiy structure size to *n
#define ET_SIZE_PT 14

// define MAX_ENTITIES and entity types
#include "et_config.h"

void init_entities();
uint8_t new_entity();
void destroy_entity();
void free_entities();

uint8_t check_for_point(struct st_entity *s, uint8_t x, uint8_t y, uint8_t w, uint8_t h);

void draw_entities();
void update_entities();

LOCAL struct st_entity *sp_used, *sp_new;

LOCAL struct st_entity *sp_it, *sp_it2;
LOCAL uint8_t sp_collect;

LOCAL uint8_t *it_x, *it_y, *it_ox, *it_oy, *it_param, *it_frame, *it_delay, *it_extra, it_k;

#undef LOCAL

#endif //  _ENTITIES_H