2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
#ifndef RESOURCE_H__
|
|
|
|
#define RESOURCE_H__
|
|
|
|
|
|
|
|
#include "intern.h"
|
|
|
|
|
|
|
|
struct level_gate_t {
|
2019-06-01 15:24:36 +02:00
|
|
|
uint16_t enter_pos;
|
2019-05-29 01:54:47 +02:00
|
|
|
uint16_t tilemap_pos;
|
|
|
|
uint16_t dst_pos;
|
|
|
|
uint8_t scroll_flag;
|
2019-06-01 15:24:36 +02:00
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
struct level_platform_t {
|
|
|
|
uint16_t tilemap_pos;
|
|
|
|
uint8_t w;
|
|
|
|
uint8_t h;
|
|
|
|
uint16_t unk4;
|
|
|
|
uint16_t unk6;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t unk8;
|
2019-05-29 01:54:47 +02:00
|
|
|
uint8_t unk9;
|
2019-06-01 15:24:36 +02:00
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
struct level_bonus_t {
|
|
|
|
uint8_t tile_num0; /* new tile */
|
|
|
|
uint8_t tile_num1; /* original tile */
|
|
|
|
uint8_t count;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint16_t pos;
|
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
struct level_item_t {
|
|
|
|
int16_t x_pos, y_pos;
|
|
|
|
uint16_t spr_num;
|
|
|
|
int8_t y_delta;
|
2019-06-01 15:24:36 +02:00
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
struct level_trigger_t {
|
|
|
|
uint16_t x_pos;
|
|
|
|
uint16_t y_pos;
|
|
|
|
uint16_t spr_num;
|
|
|
|
uint8_t flags;
|
2019-05-29 02:07:54 +02:00
|
|
|
union {
|
|
|
|
struct {
|
2019-06-02 01:47:35 +02:00
|
|
|
uint8_t y_velocity;
|
2019-05-29 02:07:54 +02:00
|
|
|
uint8_t unk8;
|
|
|
|
uint8_t unk9;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t state;
|
|
|
|
uint16_t y_delta;
|
|
|
|
uint8_t counter;
|
2019-05-29 02:07:54 +02:00
|
|
|
} type8;
|
|
|
|
struct {
|
|
|
|
int16_t unk7;
|
|
|
|
uint8_t unk9;
|
|
|
|
int16_t unkA;
|
|
|
|
int16_t unkC;
|
|
|
|
} other;
|
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
uint8_t unkE;
|
2019-06-01 15:24:36 +02:00
|
|
|
};
|
2019-05-29 01:54:47 +02:00
|
|
|
|
2019-05-29 02:42:39 +02:00
|
|
|
struct level_monster_t {
|
|
|
|
uint8_t len;
|
|
|
|
uint8_t type;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint16_t spr_num;
|
|
|
|
uint8_t flags;
|
|
|
|
uint8_t energy;
|
2019-06-01 15:47:44 +02:00
|
|
|
uint8_t respawn_ticks;
|
2019-05-29 02:42:39 +02:00
|
|
|
uint8_t current_tick;
|
2019-06-01 15:44:23 +02:00
|
|
|
uint8_t score;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint16_t x_pos;
|
|
|
|
uint16_t y_pos;
|
2019-05-29 02:42:39 +02:00
|
|
|
union {
|
|
|
|
struct {
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t y_range;
|
|
|
|
int8_t unkE;
|
2019-05-29 02:42:39 +02:00
|
|
|
} type2;
|
2019-06-01 15:47:44 +02:00
|
|
|
struct {
|
|
|
|
uint8_t unkD;
|
|
|
|
} type3;
|
2019-05-29 02:49:50 +02:00
|
|
|
struct {
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t radius;
|
2019-05-29 02:49:50 +02:00
|
|
|
uint8_t unkE;
|
|
|
|
uint8_t angle;
|
2019-06-02 01:47:35 +02:00
|
|
|
uint8_t angle_step;
|
2019-05-29 02:49:50 +02:00
|
|
|
} type4;
|
2019-06-01 16:25:06 +02:00
|
|
|
struct {
|
|
|
|
uint8_t x_range;
|
|
|
|
uint8_t y_range;
|
|
|
|
uint8_t unkF;
|
|
|
|
} type5;
|
|
|
|
struct {
|
|
|
|
uint8_t x_range;
|
|
|
|
const uint8_t *pos;
|
|
|
|
} type6;
|
2019-06-01 15:47:44 +02:00
|
|
|
struct {
|
|
|
|
uint8_t unkD;
|
|
|
|
uint8_t unkE;
|
|
|
|
} type7;
|
2019-05-29 02:42:39 +02:00
|
|
|
struct {
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t x_range;
|
2019-06-01 15:44:23 +02:00
|
|
|
int8_t y_step;
|
|
|
|
int8_t x_step;
|
2019-06-01 15:24:36 +02:00
|
|
|
uint8_t y_range;
|
2019-05-29 02:42:39 +02:00
|
|
|
} type8;
|
2019-05-29 02:49:50 +02:00
|
|
|
struct {
|
2019-06-01 15:24:36 +02:00
|
|
|
int16_t unkD;
|
|
|
|
int16_t unkF;
|
2019-06-01 15:47:44 +02:00
|
|
|
int8_t x_step;
|
|
|
|
uint8_t x_dist;
|
2019-05-29 02:49:50 +02:00
|
|
|
} type9;
|
2019-06-01 15:24:36 +02:00
|
|
|
struct {
|
|
|
|
uint8_t unkD;
|
|
|
|
} type10;
|
2019-06-01 15:47:44 +02:00
|
|
|
struct {
|
|
|
|
uint8_t unkD;
|
|
|
|
uint8_t unkE;
|
|
|
|
uint8_t unkF;
|
|
|
|
} type11;
|
|
|
|
struct {
|
|
|
|
uint8_t unkD;
|
|
|
|
} type12;
|
2019-05-29 02:42:39 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-05-29 01:54:47 +02:00
|
|
|
#define MAX_LEVEL_GATES 20
|
|
|
|
#define MAX_LEVEL_PLATFORMS 15
|
|
|
|
#define MAX_LEVEL_BONUSES 80
|
|
|
|
#define MAX_LEVEL_ITEMS 70
|
|
|
|
#define MAX_LEVEL_TRIGGERS 16
|
2019-05-29 02:42:39 +02:00
|
|
|
#define MAX_LEVEL_MONSTERS 150
|
2019-05-29 01:54:47 +02:00
|
|
|
|
|
|
|
struct level_t {
|
|
|
|
uint8_t tile_attributes0[256];
|
|
|
|
uint8_t tile_attributes1[256];
|
|
|
|
uint8_t tile_attributes2[256]; /* 0x80: animated, 0x40: front, 0x20: animate if player is on top */
|
|
|
|
uint8_t scrolling_top;
|
|
|
|
uint16_t start_x_pos;
|
|
|
|
uint16_t start_y_pos;
|
|
|
|
uint16_t tilemap_w;
|
|
|
|
uint16_t scrolling_mask; /* 4: screen scroll down 1 line, 2: no horizontal scrolling, 1: wider vertical scrolling */
|
|
|
|
uint16_t front_tiles_lut[256];
|
|
|
|
struct level_gate_t gates_tbl[MAX_LEVEL_GATES];
|
|
|
|
struct level_platform_t platforms_tbl[MAX_LEVEL_PLATFORMS];
|
2019-05-29 02:42:39 +02:00
|
|
|
struct level_monster_t monsters_tbl[MAX_LEVEL_MONSTERS];
|
|
|
|
uint8_t monsters_count;
|
2019-05-29 01:54:47 +02:00
|
|
|
uint16_t items_spr_num_offset;
|
|
|
|
uint16_t monsters_spr_num_offset;
|
|
|
|
struct level_bonus_t bonuses_tbl[MAX_LEVEL_BONUSES];
|
|
|
|
uint8_t tile_attributes3[256];
|
|
|
|
struct level_item_t items_tbl[MAX_LEVEL_ITEMS];
|
|
|
|
struct level_trigger_t triggers_tbl[MAX_LEVEL_TRIGGERS];
|
2019-06-02 01:47:35 +02:00
|
|
|
uint16_t boss_xmin;
|
|
|
|
uint16_t boss_xmax;
|
|
|
|
uint8_t boss_counter;
|
|
|
|
uint16_t boss_energy;
|
2019-06-02 02:21:03 +02:00
|
|
|
uint8_t boss_state; /* !=255: has boss */
|
|
|
|
uint16_t boss_x_pos;
|
|
|
|
uint16_t boss_y_pos;
|
2019-05-29 01:54:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct resource_t {
|
|
|
|
bool dos_demo;
|
|
|
|
uint8_t *maps;
|
|
|
|
uint8_t *motif;
|
|
|
|
uint8_t *allfonts;
|
|
|
|
uint8_t *sprites;
|
|
|
|
uint8_t *frontdat;
|
|
|
|
int frontlen;
|
|
|
|
uint8_t *uniondat;
|
|
|
|
int unionlen;
|
|
|
|
uint8_t *leveldat;
|
|
|
|
int levellen;
|
|
|
|
uint8_t *vga;
|
|
|
|
uint8_t *background;
|
|
|
|
struct level_t level, restart;
|
|
|
|
uint8_t *samples;
|
2019-06-01 16:25:06 +02:00
|
|
|
uint16_t spr_monsters_offset;
|
|
|
|
uint16_t spr_monsters_count;
|
2019-05-29 01:54:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct resource_t g_res;
|
|
|
|
extern int g_uncompressed_size;
|
|
|
|
|
|
|
|
extern void res_init(const char *datapath, int vga_size);
|
|
|
|
extern void res_fini();
|
|
|
|
extern void load_leveldat(const uint8_t *data, struct level_t *level);
|
|
|
|
extern uint8_t *load_file(const char *filename);
|
|
|
|
|
|
|
|
#endif
|