2024-10-05 00:56:13 +02:00
|
|
|
// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
|
2024-10-09 16:43:10 +02:00
|
|
|
// See README.md for the exact licensing, by ...
|
2024-10-05 00:56:13 +02:00
|
|
|
|
2024-10-10 17:53:09 +02:00
|
|
|
#pragma once
|
2024-10-05 00:56:13 +02:00
|
|
|
|
2024-10-27 23:52:11 +01:00
|
|
|
#include <gint/display.h>
|
2024-10-05 00:56:13 +02:00
|
|
|
#include "utils.h"
|
2024-10-10 17:53:09 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
V2d pos;
|
2024-10-22 12:27:16 +02:00
|
|
|
Rect coll;
|
2024-10-27 23:52:11 +01:00
|
|
|
int16_t tex;
|
|
|
|
int16_t hp;
|
|
|
|
} GPACKED(4) Sprite;
|
2024-10-10 17:53:09 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
uint8_t *dat;
|
|
|
|
|
|
|
|
int spritec;
|
|
|
|
|
|
|
|
Sprite sprites[SINDEX_S/2];
|
|
|
|
|
2024-10-27 23:52:11 +01:00
|
|
|
V2d start_pos;
|
|
|
|
|
2024-10-10 17:53:09 +02:00
|
|
|
} RcMap;
|
2024-10-05 00:56:13 +02:00
|
|
|
|
2024-10-22 12:27:16 +02:00
|
|
|
|
|
|
|
//Extension of Sprite, keep all first items common
|
2024-10-05 00:56:13 +02:00
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
V2d pos;
|
2024-10-22 12:27:16 +02:00
|
|
|
Rect coll;
|
2024-10-27 23:52:11 +01:00
|
|
|
int16_t tex;
|
|
|
|
int16_t hp;
|
|
|
|
|
2024-10-05 00:56:13 +02:00
|
|
|
V2d dir;
|
|
|
|
V2d plane;
|
|
|
|
|
|
|
|
} RcActor;
|
|
|
|
|
2024-10-09 16:43:10 +02:00
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
uint8_t exit;
|
2024-10-27 23:52:11 +01:00
|
|
|
uint8_t __pad;
|
|
|
|
int16_t v_offset;
|
2024-10-09 16:43:10 +02:00
|
|
|
|
|
|
|
} RcFlags;
|
|
|
|
|
2024-10-05 00:56:13 +02:00
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
RcActor player;
|
|
|
|
|
2024-10-09 16:43:10 +02:00
|
|
|
int logic_time;
|
|
|
|
|
2024-10-10 17:53:09 +02:00
|
|
|
RcMap *current_map;
|
2024-10-05 00:56:13 +02:00
|
|
|
|
2024-10-09 16:43:10 +02:00
|
|
|
RcFlags flags;
|
|
|
|
|
2024-10-05 00:56:13 +02:00
|
|
|
} RcGame;
|
|
|
|
|
2024-10-09 16:43:10 +02:00
|
|
|
typedef int (RcLogicFunc)(RcGame *);
|
|
|
|
|
|
|
|
//Returns non-zero on failure (likely max hook count was reached)
|
|
|
|
int add_logic_hook(RcLogicFunc *func);
|
|
|
|
|
|
|
|
//Retruns non-zero on failure
|
|
|
|
int remove_logic_hook(RcLogicFunc *func);
|
|
|
|
|
|
|
|
void clear_logic_hooks();
|
|
|
|
|
|
|
|
void do_logic(RcGame *game, int delta);
|
|
|
|
|