Copy3DEngine/include/C3D/game.h
2024-10-27 23:52:11 +01:00

74 lines
1 KiB
C

// Voir README.md pour license précise, par Fcalva 2023-2024 et est sous GPLv3
// See README.md for the exact licensing, by ...
#pragma once
#include <gint/display.h>
#include "utils.h"
typedef struct {
V2d pos;
Rect coll;
int16_t tex;
int16_t hp;
} GPACKED(4) Sprite;
typedef struct {
int w, h;
uint8_t *dat;
int spritec;
Sprite sprites[SINDEX_S/2];
V2d start_pos;
} RcMap;
//Extension of Sprite, keep all first items common
typedef struct {
V2d pos;
Rect coll;
int16_t tex;
int16_t hp;
V2d dir;
V2d plane;
} RcActor;
typedef struct {
uint8_t exit;
uint8_t __pad;
int16_t v_offset;
} RcFlags;
typedef struct {
RcActor player;
int logic_time;
RcMap *current_map;
RcFlags flags;
} RcGame;
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);