diff --git a/Makefile b/Makefile index 8bee84a..f9dde18 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SDL_CFLAGS := `sdl2-config --cflags` SDL_LIBS := `sdl2-config --libs` -BB := decode.c fileio.c game.c level.c objects.c resource.c screen.c sound.c staticres.c tiles.c unpack.c +BB := decode.c game.c level.c objects.c resource.c screen.c sound.c staticres.c tiles.c unpack.c JA := game.c level.c resource.c screen.c sound.c staticres.c unpack.c P2 := game.c level.c monsters.c resource.c screen.c sound.c staticres.c unpack.c diff --git a/bb/resource.c b/bb/resource.c index dfb8743..b544b69 100644 --- a/bb/resource.c +++ b/bb/resource.c @@ -1,5 +1,4 @@ -#include "fileio.h" #include "resource.h" #include "sys.h" #include "unpack.h" @@ -7,8 +6,18 @@ struct resource_data_t g_res; +static bool file_exists(const char *filename) { + FILE *fp = fopen_nocase(g_res.datapath, filename); + if (fp) { + fclose(fp); + return true; + } + return false; +} + void res_init(const char *datapath, int vga_size) { - fio_init(datapath); + g_res.datapath = datapath; + static const int SQL_SIZE = 640 * 25; g_res.sql = (uint8_t *)malloc(SQL_SIZE); if (!g_res.sql) { @@ -40,7 +49,7 @@ void res_init(const char *datapath, int vga_size) { print_error("Failed to allocate tiles buffer, %d bytes", TILES_SIZE); } static const char *filename = "sound"; - if (fio_exists(filename)) { + if (file_exists(filename)) { g_res.snd = (uint8_t *)malloc(SOUND_SIZE); if (!g_res.snd) { print_warning("Failed to allocate sound buffer, %d bytes", SOUND_SIZE); @@ -48,16 +57,15 @@ void res_init(const char *datapath, int vga_size) { read_file(filename, g_res.snd, SOUND_SIZE); } } - if (fio_exists("demomag.sql")) { + if (file_exists("demomag.sql")) { g_res.dos_demo = true; } - if (fio_exists("mag.tbl")) { + if (file_exists("mag.tbl")) { g_res.amiga_data = true; } } void res_fini() { - fio_fini(); free(g_res.sql); g_res.sql = 0; free(g_res.spr_sqv); @@ -75,19 +83,32 @@ void res_fini() { } int read_file(const char *filename, uint8_t *dst, int size) { - const int f = fio_open(filename, 1); - const int filesize = fio_size(f); + FILE *fp = fopen_nocase(g_res.datapath, filename); + if (!fp) { + print_error("Unable to open '%s'", filename); + return 0; + } + fseek(fp, 0, SEEK_END); + const int filesize = ftell(fp); + fseek(fp, 0, SEEK_SET); if (size > 0 && size != filesize) { print_error("Unexpected '%s' file size %d (%d)", filename, filesize, size); - } else if (fio_read(f, dst, filesize) != filesize) { + } else if (fread(dst, 1, filesize, fp) != filesize) { print_error("Failed to read %d bytes from file '%s'", filesize, filename); } - fio_close(f); + fclose(fp); return filesize; } int read_compressed_file(const char *filename, uint8_t *dst) { - return unpack(filename, dst); + FILE *fp = fopen_nocase(g_res.datapath, filename); + if (!fp) { + print_error("Unable to open '%s'", filename); + return 0; + } + const int size = unpack(fp, dst); + fclose(fp); + return size; } extern const uint8_t dither_cga_table[]; diff --git a/bb/resource.h b/bb/resource.h index c9bfef8..139060f 100644 --- a/bb/resource.h +++ b/bb/resource.h @@ -29,6 +29,7 @@ struct trigger_t { #define SPRITES_COUNT 146 struct resource_data_t { + const char *datapath; uint8_t *sql; uint8_t *spr_sqv; uint8_t *avt_sqv; diff --git a/bb/sound.c b/bb/sound.c index 9e0b9bc..7b4cdad 100644 --- a/bb/sound.c +++ b/bb/sound.c @@ -1,5 +1,4 @@ -#include "fileio.h" #include "game.h" #include "resource.h" #include "sys.h" @@ -52,6 +51,31 @@ static const int _rate = SYS_AUDIO_FREQ; static struct mixerchannel_t _channel; static ModPlugFile *_mpf; +static uint8_t *load_file(const char *filename, int *size, uint8_t *buffer) { + FILE *fp = fopen_nocase(g_res.datapath, filename); + if (!fp) { + return 0; + } + fseek(fp, 0, SEEK_END); + const int filesize = ftell(fp); + fseek(fp, 0, SEEK_SET); + if (!buffer) { + buffer = (uint8_t *)malloc(filesize); + if (!buffer) { + print_warning("Failed to allocate %d bytes", filesize); + return 0; + } + } + if (fread(buffer, 1, filesize, fp) != filesize) { + print_warning("Failed to read %d bytes from '%s'", filesize, filename); + free(buffer); + buffer = 0; + } else { + *size = filesize; + } + return buffer; +} + static void mix(void *param, uint8_t *buf, int len) { memset(buf, 0, len); if (_mpf) { @@ -109,65 +133,50 @@ void play_music(int num) { ModPlug_Unload(_mpf); _mpf = 0; } - const char *filename = _modules[num * 2]; - if (fio_exists(filename)) { // Amiga - int slot = fio_open(filename, 1); - int size = fio_size(slot); - uint8_t *buf = (uint8_t *)malloc(size); - if (buf) { - fio_read(slot, buf, size); + const char *filename = _modules[num * 2]; // Amiga + int size = 0; + uint8_t *buf = load_file(filename, &size, 0); + if (buf) { + // append samples to the end of the buffer + static const int SONG_INFO_LEN = 20; + static const int NUM_SAMPLES = 8; + struct { + char name[23]; + int size; + } samples[8]; - // append samples to the end of the buffer - static const int SONG_INFO_LEN = 20; - static const int NUM_SAMPLES = 8; - struct { - char *name; - int size; - } samples[8]; - - int samples_size = 0; - int offset = SONG_INFO_LEN; - for (int i = 0; i < NUM_SAMPLES; ++i, offset += 30) { - samples[i].name = (char *)&buf[offset]; - samples[i].size = READ_BE_UINT16(&buf[offset + 22]) * 2; - string_lower(samples[i].name); - samples_size += samples[i].size; - } - - buf = (uint8_t *)realloc(buf, size + samples_size); - if (buf) { - memset(buf + size, 0, samples_size); - for (int i = 0; i < NUM_SAMPLES; ++i) { - if (samples[i].size != 0) { - if (samples[i].name[0]) { - const int sample_slot = fio_open(samples[i].name, 0); - if (sample_slot < 0) { - print_warning("Unable to open instrument '%s'", samples[i].name); - } else { - fio_read(sample_slot, buf + size, samples[i].size); - fio_close(sample_slot); - } - } - size += samples[i].size; - } - } - _mpf = ModPlug_Load(buf, size); - free(buf); - } + int samples_size = 0; + int offset = SONG_INFO_LEN; + for (int i = 0; i < NUM_SAMPLES; ++i, offset += 30) { + memcpy(samples[i].name, &buf[offset], 22); + samples[i].name[22] = 0; + samples[i].size = READ_BE_UINT16(&buf[offset + 22]) * 2; + string_lower(samples[i].name); + samples_size += samples[i].size; + } + buf = (uint8_t *)realloc(buf, size + samples_size); + if (buf) { + memset(buf + size, 0, samples_size); + for (int i = 0; i < NUM_SAMPLES; ++i) { + if (samples[i].size != 0) { + if (samples[i].name[0]) { + int sample_size = 0; + if (!load_file(samples[i].name, &sample_size, buf + size)) { + print_warning("Unable to load instrument '%s'", samples[i].name); + } + } + size += samples[i].size; + } + } + _mpf = ModPlug_Load(buf, size); + free(buf); } - fio_close(slot); } else { // ExoticA filename = _modules[num * 2 + 1]; - if (fio_exists(filename)) { - int slot = fio_open(filename, 1); - int size = fio_size(slot); - uint8_t *buf = (uint8_t *)malloc(size); - if (buf) { - fio_read(slot, buf, size); - _mpf = ModPlug_Load(buf, size); - free(buf); - } - fio_close(slot); + buf = load_file(filename, &size, 0); + if (buf) { + _mpf = ModPlug_Load(buf, size); + free(buf); } } g_sys.unlock_audio(); diff --git a/bb/unpack.c b/bb/unpack.c index e3af7e9..a44e71a 100644 --- a/bb/unpack.c +++ b/bb/unpack.c @@ -1,37 +1,33 @@ -#include "fileio.h" #include "unpack.h" #include "util.h" struct unpack_t { uint8_t dict_buf[0x200 * 2]; uint8_t rd[0x1000]; - int size; - int dict_len; }; static struct unpack_t g_unpack; -int unpack(const char *filename, uint8_t *dst) { - const int f = fio_open(filename, 1); - - fio_read(f, g_unpack.rd, 6); - g_unpack.size = (READ_LE_UINT16(g_unpack.rd) << 16) + READ_LE_UINT16(g_unpack.rd + 2); +int unpack(FILE *in, uint8_t *dst) { + fread(g_unpack.rd, 1, 6, in); + const int uncompressed_size = (READ_LE_UINT16(g_unpack.rd) << 16) + READ_LE_UINT16(g_unpack.rd + 2); const int dict_len = READ_LE_UINT16(g_unpack.rd + 4); - print_debug(DBG_UNPACK, "unpack '%s' size %d dict_len %d", filename, g_unpack.size, dict_len); - fio_read(f, g_unpack.dict_buf, dict_len); + print_debug(DBG_UNPACK, "SQV uncompressed size %d dict_len %d", uncompressed_size, dict_len); + fread(g_unpack.dict_buf, 1, dict_len, in); + const uint8_t *start = dst; const uint8_t *src = g_unpack.rd; int len = 1; int bytes_count = 2; uint16_t bits = 0; uint16_t val = 0; - while (1) { + while ((dst - start) < uncompressed_size) { --len; if (len == 0) { bytes_count -= 2; if (bytes_count == 0) { - bytes_count = fio_read(f, g_unpack.rd, 0x1000); + bytes_count = fread(g_unpack.rd, 1, 0x1000, in); if (bytes_count == 0) { break; } @@ -55,6 +51,6 @@ int unpack(const char *filename, uint8_t *dst) { *dst++ = val & 255; val = 0; } - fio_close(f); - return g_unpack.size; + assert((dst - start) == uncompressed_size); + return uncompressed_size; } diff --git a/bb/unpack.h b/bb/unpack.h index 1891a3b..2490459 100644 --- a/bb/unpack.h +++ b/bb/unpack.h @@ -4,6 +4,6 @@ #include "intern.h" -extern int unpack(const char *filename, uint8_t *dst); +extern int unpack(FILE *fp, uint8_t *dst); #endif /* UNPACK_H__ */ diff --git a/p2/game.c b/p2/game.c index d3aa9f5..89d4fa3 100644 --- a/p2/game.c +++ b/p2/game.c @@ -117,11 +117,6 @@ static void do_present_screen() { } static void do_demo_screen() { - uint8_t *data = load_file("JOYSTICK.SQZ"); - if (data) { - video_copy_img(data); - free(data); - } } static void do_menu() { diff --git a/p2/game.h b/p2/game.h index b8e238f..aa0f667 100644 --- a/p2/game.h +++ b/p2/game.h @@ -138,7 +138,6 @@ struct vars_t { uint8_t player_anim2_counter; int16_t player_prev_y_pos; uint8_t player_bonus_letters_blinking_counter; - int16_t player_monsters_unk_counter; uint8_t player_nojump_counter; uint8_t player_jumping_counter; uint8_t player_action_counter; @@ -192,6 +191,7 @@ struct vars_t { uint8_t type10_dist; uint8_t hit_mask; int16_t collide_y_dist; + uint8_t type0_hdir; } monster; struct { int16_t x_pos, y_pos; @@ -222,8 +222,8 @@ extern struct vars_t g_vars; extern const uint8_t *palettes_tbl[16]; extern const uint8_t credits_palette_data[16 * 3]; extern const uint8_t light_palette_data[16 * 3]; -extern const uint8_t spr_offs_tbl[892]; -extern const uint8_t spr_size_tbl[892]; +extern const uint8_t spr_offs_tbl[922]; +extern const uint8_t spr_size_tbl[922]; extern const uint16_t score_tbl[17]; extern const uint8_t score_spr_lut[110]; extern const uint8_t *object_anim_tbl[]; @@ -234,7 +234,7 @@ extern const uint8_t vscroll_offsets_data[132]; extern const uint8_t cos_tbl[256]; extern const uint8_t sin_tbl[256]; extern const uint16_t monster_spr_tbl[48]; -extern const uint8_t monster_anim_tbl[1018]; +extern const uint8_t monster_anim_tbl[1100]; /* game.c */ extern void update_input(); diff --git a/p2/level.c b/p2/level.c index 9947d0f..6b6e2e1 100644 --- a/p2/level.c +++ b/p2/level.c @@ -139,7 +139,7 @@ static void load_level_data_fix_monsters_spr_num() { if (num != 0xFFFF) { if (num >= g_res.level.monsters_spr_num_offset) { num -= g_res.level.monsters_spr_num_offset; - num += 305; + num += g_res.spr_monsters_offset; g_res.level.monsters_tbl[i].spr_num = num; } else if (num >= g_res.level.items_spr_num_offset) { num -= g_res.level.items_spr_num_offset; @@ -150,7 +150,7 @@ static void load_level_data_fix_monsters_spr_num() { } } g_res.level.items_spr_num_offset = 53; - g_res.level.monsters_spr_num_offset = 305; + g_res.level.monsters_spr_num_offset = g_res.spr_monsters_offset; } static void load_level_data_init_secret_bonus_tiles() { @@ -1073,7 +1073,7 @@ static void level_monster_update_anim(struct object_t *obj) { obj->data.m.anim = p + 2; } -static void level_monster_die(struct object_t *obj, struct level_monster_t *m) { +static void level_monster_die(struct object_t *obj, struct level_monster_t *m, struct object_t *obj_player) { /* di, bx, si */ const int num = m->score + 74; static const uint8_t data[] = { 1, 2, 3, 4, 6, 8 }; int count = data[(obj->data.m.hit_jump_counter >> 3) & 7]; @@ -1105,7 +1105,7 @@ static void level_monster_die(struct object_t *obj, struct level_monster_t *m) { dy = (-dy) << 3; obj->data.m.y_velocity = dy; int dx = dy >> 1; - if ((obj->data.m.flags & 0x80) == 0) { + if ((obj_player->spr_num & 0x8000) == 0) { dx = -dx; } obj->data.m.x_velocity = dx; @@ -1131,11 +1131,11 @@ static bool level_collide_axe_monsters(struct object_t *axe_obj) { obj->data.m.flags |= 0x40; obj->data.m.energy -= g_vars.player_club_power; if (obj->data.m.energy < 0) { - level_monster_die(obj, m); + level_monster_die(obj, m, axe_obj); } else { obj->x_pos -= obj->data.m.x_velocity >> 2; } - obj->spr_num = 0xFFFF; + axe_obj->spr_num = 0xFFFF; return true; } return false; @@ -1382,10 +1382,6 @@ extern void monster_func1(int type, struct object_t *obj); /* update */ extern bool monster_func2(int type, struct level_monster_t *m); /* init */ static void level_update_objects_monsters() { - if (!g_res.dos_demo) { - /* different monsters logic/tables */ - return; - } if (g_res.level.monsters_state != 0xFF) { level_update_monsters_state(); } @@ -1414,17 +1410,18 @@ static void level_update_objects_monsters() { } p += num; } - uint16_t dx = 305 + (num & 0x1FFF); - g_vars.monster.hit_mask = ((num >> 8) & 0xE0) | g_vars.player_monsters_unk_counter; - if (g_vars.player_monsters_unk_counter == 0) { + uint16_t dx = g_res.spr_monsters_offset + (num & 0x1FFF); + g_vars.monster.hit_mask = ((num >> 8) & 0xE0) | (g_vars.player_hit_monster_counter & 0xFF); + if (g_vars.player_hit_monster_counter == 0) { obj->data.m.anim = p + 2; } else { - if (g_vars.player_monsters_unk_counter == 7) { + if (g_vars.player_hit_monster_counter == 7) { g_vars.shake_screen_counter = 9; } const uint16_t *q = monster_spr_tbl; + const uint16_t *end = &monster_spr_tbl[48]; dx &= 0x1FFF; - while (1) { + while (q < end) { if (dx < q[0]) { obj->data.m.anim = p + 2; break; @@ -1435,6 +1432,10 @@ static void level_update_objects_monsters() { } q += 3; } + if (q >= end) { + print_warning("level_update_objects_monsters spr %d hit %d not found", dx, g_vars.player_hit_monster_counter); + continue; + } } dx &= 0x1FFF; if (obj->data.m.x_velocity < 0) { @@ -1452,20 +1453,22 @@ static void level_update_objects_monsters() { if (!monster_func2(type, m)) { continue; } + /* monster type */ const uint8_t *p = monster_anim_tbl; - const uint8_t *end = &monster_anim_tbl[1018]; - const int spr_num = m->spr_num - 305; + const uint8_t *end = &monster_anim_tbl[1100]; do { p += 2; - if (p >= end) { - print_warning("level_update_objects_monsters type %d spr %d not found", m->type, spr_num); - continue; - } - } while (READ_LE_UINT16(p) != 0x7D01 || READ_LE_UINT16(p + 2) != type); + } while (p < end && (READ_LE_UINT16(p) != 0x7D01 || READ_LE_UINT16(p + 2) != type)); p += 4; - while (READ_LE_UINT16(p) != spr_num) { + /* monster sprite */ + const int spr_num = m->spr_num - g_res.spr_monsters_offset; + while (p < end && READ_LE_UINT16(p) != spr_num) { p += 2; } + if (p >= end) { + print_warning("level_update_objects_monsters type %d spr %d not found", type, spr_num); + continue; + } g_vars.monster.current_object->data.m.anim = p; } } @@ -2366,8 +2369,8 @@ update_pos: if (g_vars.player_bonus_letters_blinking_counter > 0) { --g_vars.player_bonus_letters_blinking_counter; } - if (g_vars.player_monsters_unk_counter > 0) { - --g_vars.player_monsters_unk_counter; + if (g_vars.player_hit_monster_counter > 0) { + --g_vars.player_hit_monster_counter; } } @@ -2402,7 +2405,7 @@ static void level_update_player_collision() { continue; } if (g_vars.player_hit_monster_counter != 0) { - level_monster_die(obj, m); + level_monster_die(obj, m, &g_vars.objects_tbl[1]); continue; } if (!g_vars.player_jump_monster_flag && g_vars.objects_tbl[1].data.p.y_velocity < 0) { @@ -2617,7 +2620,7 @@ static void level_update_player_collision() { if ((obj->spr_num & 0x2000) == 0) { continue; } - level_monster_die(obj, m); + level_monster_die(obj, m, obj_player); } g_vars.shake_screen_counter = 9; level_clear_item(obj); @@ -2629,6 +2632,10 @@ static void level_update_player_collision() { if (obj->spr_num == 0xFFFF) { continue; } + struct level_monster_t *m = obj->data.m.ref; + if (m->flags & 0x10) { + continue; + } if ((obj->spr_num & 0x2000) == 0) { continue; } @@ -3026,7 +3033,7 @@ static void level_update_player_bonuses() { g_vars.player_bonus_letters_blinking_counter = 44; /* blink the letters in the panel */ } else if ((g_vars.player_utensils_mask & 0x38) == 0x38) { g_vars.player_utensils_mask &= ~0x38; - g_vars.player_monsters_unk_counter = 660; + g_vars.player_hit_monster_counter = 660; } } @@ -3301,6 +3308,7 @@ void do_level() { level_draw_panel(); level_sync(); g_vars.monster.type10_dist = 0; + g_vars.monster.type0_hdir = 0; random_reset(); while (!g_sys.input.quit) { level_update_objects_hit_animation(); diff --git a/p2/monsters.c b/p2/monsters.c index 61204a1..82f3c55 100644 --- a/p2/monsters.c +++ b/p2/monsters.c @@ -102,6 +102,33 @@ static void monster_update_y_velocity(struct object_t *obj, struct level_monster } } +static void monster_func1_type0(struct object_t *obj) { + monster_func1_helper(obj, obj->x_pos, obj->y_pos); + struct level_monster_t *m = obj->data.m.ref; + const uint8_t state = obj->data.m.state; + if (state == 0) { + if (monster_next_tick(m)) { + return; + } + if (obj->y_pos - g_vars.objects_tbl[1].y_pos >= TILEMAP_SCREEN_H) { + monster_reset(obj, m); + } else { + m->flags = 8; + obj->data.m.state = 1; + } + } else if (state == 1) { + if (obj->data.m.y_velocity != 0) { + return; + } + obj->data.m.state = 2; + const int x_vel = (obj->x_pos < g_vars.objects_tbl[1].x_pos) ? 32 : -32; + obj->data.m.x_velocity = x_vel; + monster_change_next_anim(obj); + } else if (state == 0xFF) { + monster_update_y_velocity(obj, m); + } +} + static void monster_func1_type2(struct object_t *obj) { monster_func1_helper(obj, obj->x_pos, obj->y_pos); struct level_monster_t *m = obj->data.m.ref; @@ -204,6 +231,96 @@ static void monster_func1_type4(struct object_t *obj) { } } +static void monster_func1_type5(struct object_t *obj) { + monster_func1_helper(obj, obj->x_pos, obj->y_pos); + struct level_monster_t *m = obj->data.m.ref; + const uint8_t state = obj->data.m.state; + if (state == 0) { + const int x_vel = (obj->x_pos <= g_vars.objects_tbl[1].x_pos) ? 1 : -1; + obj->data.m.x_velocity = x_vel; + const int dx = abs(g_vars.objects_tbl[1].x_pos - obj->x_pos) >> 4; + if (m->type5.x_range < dx) { + return; + } + const int dy = abs(g_vars.objects_tbl[1].y_pos - obj->y_pos) >> 4; + if (m->type5.y_range < dy) { + return; + } + obj->data.m.state = 10; + int x = m->type5.unkF << 4; + obj->data.m.y_velocity = x; + if (obj->data.m.x_velocity < 0){ + x = -x; + } + obj->data.m.x_velocity = x; + } else if (state == 10) { + if (abs(obj->y_pos - g_vars.objects_tbl[1].y_pos) <= 8) { + obj->data.m.state = 11; + obj->data.m.y_velocity = 10; + } + } else if (state == 0xFF) { + monster_update_y_velocity(obj, m); + } +} + +static void monster_func1_type6(struct object_t *obj) { + static const uint8_t data[] = { + 0x40, 0x28, 0x50, 0x26, 0x10, 0x30, 0x20, 0x36, 0x10, 0x3C, + 0x08, 0x32, 0xF8, 0x32, 0xF0, 0x30, 0xE0, 0x28, 0xF0, 0xFF + }; + monster_func1_helper(obj, obj->x_pos, obj->y_pos); + struct level_monster_t *m = obj->data.m.ref; + const int x_vel = (obj->x_pos <= g_vars.objects_tbl[1].x_pos) ? 1 : -1; + obj->data.m.x_velocity = x_vel; + const uint8_t state = obj->data.m.state; + if (state == 0) { + const int dx = abs(g_vars.objects_tbl[1].x_pos - obj->x_pos) >> 4; + if (m->type6.x_range < dx) { + return; + } + obj->data.m.state = 1; + m->type6.pos = data; + } else if (state == 1) { + const uint8_t *p = m->type6.pos; + bool flag = false; + int d = 3; + int x = g_vars.objects_tbl[1].x_pos + (int8_t)p[0] - obj->x_pos; + if (x <= 0) { + x = -x; + d = -d; + } + if (x >= 3) { + obj->x_pos += d; + flag = true; + } + int y = (int8_t)p[1]; + if (g_vars.player_anim_0x40_flag != 0) { + y += 5; + } + y -= g_vars.objects_tbl[1].y_pos; + y = -y; + d = 3; + y -= obj->y_pos; + if (y <= 0) { + y = -y; + d = -d; + } + if (y >= 3) { + obj->y_pos += d; + flag = true; + } + if (flag) { + if (p[2] == 0xFF) { + m->type6.pos = data; + } else { + m->type6.pos = p + 2; + } + } + } else if (state == 0xFF) { + monster_update_y_velocity(obj, m); + } +} + static void monster_func1_type7(struct object_t *obj) { monster_func1_helper(obj, obj->x_pos, obj->y_pos); struct level_monster_t *m = obj->data.m.ref; @@ -218,12 +335,11 @@ static void monster_func1_type7(struct object_t *obj) { obj->data.m.state = 10; int x = m->type7.unkE << 4; obj->data.m.y_velocity = x; - if (obj->data.m.x_velocity & 0x5000) { + if (obj->data.m.x_velocity & 0x5000) { /* typo, should be 0x8000, eg. < 0 ? */ x = -x; } obj->data.m.x_velocity = x; monster_change_next_anim(obj); - } else if (state == 10) { } else if (state == 0xFF) { monster_update_y_velocity(obj, m); } @@ -431,6 +547,9 @@ static void monster_func1_type12(struct object_t *obj) { void monster_func1(int type, struct object_t *obj) { switch (type) { + case 0: + monster_func1_type0(obj); + break; case 1: monster_func1_helper(obj, obj->x_pos, obj->y_pos); break; @@ -443,6 +562,12 @@ void monster_func1(int type, struct object_t *obj) { case 4: monster_func1_type4(obj); break; + case 5: + monster_func1_type5(obj); + break; + case 6: + monster_func1_type6(obj); + break; case 7: monster_func1_type7(obj); break; @@ -508,6 +633,42 @@ static bool monster_is_visible(int x_pos, int y_pos) { return true; } +static bool monster_func2_type0(struct level_monster_t *m) { + const uint16_t x = m->x_pos; + const uint16_t y = m->y_pos; + const int dx = (g_vars.objects_tbl[1].x_pos >> 4) - (x & 255); + if (dx < 0) { + return false; + } + if ((y & 255) < dx) { + return false; + } + const int dy = (g_vars.objects_tbl[1].y_pos >> 4) - (x >> 8); + if (dy < 0) { + return false; + } + if ((y >> 8) < dy) { + return false; + } + struct object_t *obj = find_object_monster(); + if (!obj) { + return false; + } + obj->data.m.hit_jump_counter = 0; + g_vars.monster.current_object = obj; + g_vars.monster.type0_hdir ^= 1; + obj->x_pos = g_vars.objects_tbl[1].x_pos + ((g_vars.monster.type0_hdir == 0) ? 192 : -192); + obj->y_pos = g_vars.objects_tbl[1].y_pos - TILEMAP_SCREEN_H; + obj->spr_num = m->spr_num; + obj->data.m.ref = m; + m->flags = 7; + obj->data.m.x_velocity = 0; + obj->data.m.y_velocity = 0; + obj->data.m.state = 0; + obj->data.m.energy = m->energy; + return true; +} + static bool monster_func2_type1(struct level_monster_t *m) { if (!monster_is_visible(m->x_pos, m->y_pos)) { return false; @@ -682,6 +843,8 @@ static bool monster_func2_type12(struct level_monster_t *m) { bool monster_func2(int type, struct level_monster_t *m) { switch (type) { + case 0: + return monster_func2_type0(m); case 1: return monster_func2_type1(m); case 2: diff --git a/p2/resource.c b/p2/resource.c index 1bb041a..549818c 100644 --- a/p2/resource.c +++ b/p2/resource.c @@ -59,6 +59,9 @@ void res_init(const char *path, int vga_size) { if (!g_res.dos_demo) { g_res.samples = load_file("SAMPLE.SQZ"); } + + g_res.spr_monsters_offset = 312; + g_res.spr_monsters_count = g_res.dos_demo ? 446 : 461; } void res_fini() { @@ -130,6 +133,9 @@ void load_leveldat(const uint8_t *p, struct level_t *level) { m->x_pos = READ_LE_UINT16(p + 0x9); m->y_pos = READ_LE_UINT16(p + 0xB); switch (type) { /* movement */ + case 0: + assert(len == 13); + break; case 1: assert(len == 13); break; @@ -139,6 +145,7 @@ void load_leveldat(const uint8_t *p, struct level_t *level) { m->type2.unkE = p[0xE]; break; case 3: + assert(len == 14); m->type3.unkD = p[0xD]; break; case 4: /* rotate (eg. spider) */ @@ -148,7 +155,19 @@ void load_leveldat(const uint8_t *p, struct level_t *level) { m->type4.angle = p[0xF]; m->type4.unk10 = p[0x10]; break; + case 5: + assert(len == 16); + m->type5.x_range = p[0xD]; + m->type5.y_range = p[0xE]; + m->type5.unkF = p[0xF]; + break; + case 6: + assert(len == 21); + m->type6.x_range = p[0xD]; + m->type6.pos = 0; + break; case 7: + assert(len == 15); m->type7.unkD = p[0xD]; m->type7.unkE = p[0xE]; break; @@ -171,12 +190,13 @@ void load_leveldat(const uint8_t *p, struct level_t *level) { m->type10.unkD = p[0xD]; break; case 11: + assert(len == 16); m->type11.unkD = p[0xD]; m->type11.unkE = p[0xE]; m->type11.unkF = p[0xF]; break; case 12: - assert(len == 14); + assert(len == 15); m->type12.unkD = p[0xD]; break; default: diff --git a/p2/resource.h b/p2/resource.h index e9f4fe0..7ca0468 100644 --- a/p2/resource.h +++ b/p2/resource.h @@ -83,6 +83,15 @@ struct level_monster_t { uint8_t angle; uint8_t unk10; } type4; + struct { + uint8_t x_range; + uint8_t y_range; + uint8_t unkF; + } type5; + struct { + uint8_t x_range; + const uint8_t *pos; + } type6; struct { uint8_t unkD; uint8_t unkE; @@ -165,6 +174,8 @@ struct resource_t { uint8_t *background; struct level_t level, restart; uint8_t *samples; + uint16_t spr_monsters_offset; + uint16_t spr_monsters_count; }; extern struct resource_t g_res; diff --git a/p2/screen.c b/p2/screen.c index 765e699..8da74f2 100644 --- a/p2/screen.c +++ b/p2/screen.c @@ -6,7 +6,7 @@ #include "sys.h" #include "util.h" -#define MAX_SPRITES 445 +#define MAX_SPRITES 480 #define MAX_SPRITESHEET_W 2048 #define MAX_SPRITESHEET_H 1024 #define MAX_FRONT_TILES 168 @@ -216,16 +216,23 @@ void video_load_sprites() { int offset = 0; int count = 0; uint8_t value; - for (int i = 0; (value = sprite_offsets[i] & 255) != 0; ++i, ++count) { + for (int i = 0; count < g_res.spr_monsters_count; ++i) { + if (g_res.dos_demo && (i >= 305 && i < 312)) { + /* demo is missing 7 (monster) sprites compared to full game */ + continue; + } + const int j = i; + + value = sprite_offsets[j] & 255; value = (value >> 3) | ((value & 7) << 5); if ((value & 0xE0) != 0) { value &= ~0xE0; ++value; } - const int h = sprite_offsets[i] >> 8; + const int h = sprite_offsets[j] >> 8; const int w = value * 8; - assert((sprite_offsets[i] & 255) == w); + assert((sprite_offsets[j] & 255) == w); const int size = (h * value) * 4; if (current_x + w > MAX_SPRITESHEET_W) { @@ -248,6 +255,8 @@ void video_load_sprites() { r[i].w = w; r[i].h = h; current_x += w; + + ++count; } assert(count <= MAX_SPRITES); assert(max_w <= MAX_SPRITESHEET_W); diff --git a/p2/staticres.c b/p2/staticres.c index da81c20..ba16379 100644 --- a/p2/staticres.c +++ b/p2/staticres.c @@ -122,24 +122,26 @@ const uint8_t spr_offs_tbl[] = { 0x0D,0x1A,0x19,0x1D,0x1C,0x0E,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C, 0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C,0x08,0x0C, 0x08,0x0C,0x08,0x0C,0x08,0x0C,0x10,0x15,0x04,0x0A,0x08,0x0C,0x08,0x0C,0x08,0x0C, - 0x20,0x1F,0x0C,0x18,0x10,0x1D,0x0C,0x1E,0x10,0x1D,0x18,0x28,0x10,0x13,0x10,0x19, - 0x0C,0x1C,0x10,0x0E,0x10,0x0F,0x10,0x0E,0x10,0x0F,0x08,0x1C,0x08,0x1C,0x08,0x1C, - 0x08,0x1C,0x0C,0x15,0x0C,0x19,0x10,0x17,0x11,0x17,0x0C,0x20,0x0C,0x1F,0x10,0x16, - 0x14,0x0E,0x14,0x09,0x0C,0x0F,0x0F,0x0B,0x0C,0x15,0x08,0x0A,0x08,0x09,0x04,0x0A, - 0x08,0x0A,0x08,0x0A,0x0C,0x07,0x08,0x0E,0x0C,0x0C,0x0C,0x0B,0x14,0x1D,0x10,0x1C, - 0x10,0x1C,0x14,0x18,0x14,0x24,0x14,0x1F,0x0C,0x20,0x0F,0x1F,0x0D,0x1F,0x10,0x1F, - 0x02,0x15,0x01,0x15,0xFF,0x18,0xFF,0x18,0x10,0x14,0x10,0x14,0x0C,0x1C,0x04,0x05, - 0x0C,0x07,0x10,0x0C,0x10,0x15,0x0C,0x06,0x0C,0x08,0x0C,0x16,0x10,0x1C,0x0C,0x1F, - 0x14,0x1E,0x10,0x1A,0x10,0x13,0x08,0x13,0x0C,0x12,0x0C,0x0B,0x0C,0x05,0x18,0x1B, - 0x18,0x1D,0x18,0x29,0x18,0x20,0x10,0x03,0x10,0x05,0x14,0x0B,0x18,0x13,0x1B,0x1A, - 0x20,0x20,0x1E,0x1F,0x20,0x1F,0x21,0x20,0x18,0x27,0x18,0x1D,0x15,0x1E,0x18,0x1B, - 0x20,0x22,0x1C,0x24,0x14,0x20,0x20,0x23,0x20,0x2B,0x1C,0x2D,0x10,0x25,0x10,0x25, - 0x10,0x22,0x10,0x25,0x18,0x2E,0x18,0x2B,0x1C,0x1E,0x14,0x1C,0x14,0x18,0x1C,0x10, - 0x10,0x31,0x10,0x3B,0x10,0x30,0x1C,0x22,0x20,0x1B,0x20,0x32,0x28,0x21,0x20,0x28, - 0x14,0x15,0x10,0x20,0x10,0x1F,0x10,0x1E,0x18,0x1C,0x28,0x20,0x14,0x1E,0x14,0x23, - 0x14,0x3E,0x1C,0x19,0x1C,0x19,0x1C,0x19,0x14,0x10,0x14,0x12,0x10,0x0E,0x34,0x29, - 0x08,0x16,0x0C,0x17,0x0C,0x17,0x0C,0x17,0x10,0x17,0x0C,0x18,0x10,0x18,0x10,0x18, - 0x10,0x17,0x10,0x1B,0x10,0x1B,0x10,0x18,0x0C,0x18,0x00,0x00 + 0x20,0x1F,0x10,0x10,0x04,0x0A,0x18,0x15,0x07,0x0B,0x04,0x0C,0x08,0x0C,0x08,0x1A, + 0x0C,0x18,0x10,0x1D,0x0C,0x1E,0x10,0x1D,0x18,0x28,0x10,0x13,0x10,0x19,0x0C,0x1C, + 0x10,0x0E,0x10,0x0F,0x10,0x0E,0x10,0x0F,0x08,0x1C,0x08,0x1C,0x08,0x1C,0x08,0x1C, + 0x0C,0x15,0x0C,0x19,0x10,0x17,0x11,0x17,0x0C,0x20,0x0C,0x1F,0x10,0x16,0x14,0x0E, + 0x14,0x09,0x0C,0x0F,0x0F,0x0B,0x0C,0x15,0x08,0x0A,0x08,0x09,0x04,0x0A,0x08,0x0A, + 0x08,0x0A,0x0C,0x07,0x08,0x0E,0x0C,0x0C,0x0C,0x0B,0x14,0x1D,0x10,0x1C,0x10,0x1C, + 0x14,0x18,0x14,0x24,0x14,0x1F,0x0C,0x20,0x0F,0x1F,0x0D,0x1F,0x10,0x1F,0x02,0x15, + 0x01,0x15,0xFF,0x18,0xFF,0x18,0x10,0x14,0x10,0x14,0x0C,0x1C,0x04,0x05,0x0C,0x07, + 0x10,0x0C,0x10,0x15,0x0C,0x06,0x0C,0x08,0x0C,0x16,0x10,0x1C,0x0C,0x1F,0x14,0x1E, + 0x10,0x1A,0x10,0x13,0x08,0x13,0x0C,0x12,0x0C,0x0B,0x0C,0x05,0x18,0x1B,0x18,0x1D, + 0x18,0x29,0x18,0x20,0x10,0x03,0x10,0x05,0x14,0x0B,0x18,0x13,0x1B,0x1A,0x20,0x20, + 0x1E,0x1F,0x20,0x1F,0x21,0x20,0x18,0x27,0x18,0x1D,0x15,0x1E,0x18,0x1B,0x20,0x22, + 0x1C,0x24,0x14,0x20,0x20,0x23,0x20,0x2B,0x1C,0x2D,0x10,0x25,0x10,0x25,0x10,0x22, + 0x10,0x25,0x18,0x2E,0x18,0x2B,0x1C,0x1E,0x14,0x1C,0x14,0x18,0x1C,0x10,0x10,0x31, + 0x10,0x3B,0x10,0x30,0x1C,0x22,0x20,0x1B,0x20,0x32,0x28,0x21,0x20,0x28,0x14,0x15, + 0x10,0x20,0x10,0x1F,0x10,0x1E,0x18,0x1C,0x28,0x20,0x14,0x1E,0x14,0x23,0x14,0x3E, + 0x1C,0x19,0x1C,0x19,0x1C,0x19,0x14,0x10,0x14,0x12,0x10,0x0E,0x34,0x29,0x08,0x16, + 0x0C,0x17,0x0C,0x17,0x0C,0x17,0x10,0x17,0x0C,0x18,0x10,0x18,0x10,0x18,0x10,0x17, + 0x10,0x1B,0x10,0x1B,0x10,0x18,0x0C,0x18,0x10,0x14,0x19,0x1C,0x20,0x1B,0x18,0x1D, + 0x18,0x26,0x14,0x22,0x10,0x1A,0x17,0x17,0x00,0x00 }; const uint8_t spr_size_tbl[] = { 0x28,0x24,0x20,0x23,0x18,0x24,0x20,0x22,0x20,0x25,0x20,0x25,0x20,0x24,0x20,0x23, @@ -180,24 +182,26 @@ const uint8_t spr_size_tbl[] = { 0x28,0x1B,0x30,0x1D,0x38,0x0E,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C, 0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C,0x10,0x0C, 0x10,0x0C,0x10,0x0C,0x10,0x0C,0x20,0x15,0x08,0x0A,0x10,0x0C,0x10,0x0C,0x10,0x0C, - 0x40,0x1F,0x18,0x18,0x20,0x1D,0x18,0x1E,0x20,0x1D,0x30,0x28,0x20,0x13,0x20,0x19, - 0x18,0x1C,0x20,0x0E,0x20,0x0F,0x20,0x0E,0x20,0x0F,0x10,0x1C,0x10,0x1C,0x10,0x1C, - 0x10,0x1C,0x18,0x15,0x18,0x19,0x20,0x17,0x20,0x17,0x18,0x20,0x18,0x1E,0x20,0x16, - 0x28,0x0E,0x28,0x0C,0x18,0x0F,0x20,0x0B,0x18,0x15,0x10,0x0A,0x10,0x09,0x08,0x0A, - 0x10,0x0A,0x10,0x0A,0x18,0x07,0x10,0x0E,0x18,0x0C,0x18,0x0B,0x28,0x1D,0x20,0x1C, - 0x20,0x1C,0x28,0x18,0x28,0x24,0x28,0x1F,0x18,0x20,0x20,0x1F,0x20,0x1F,0x20,0x1F, - 0x10,0x15,0x10,0x15,0x10,0x18,0x18,0x18,0x28,0x14,0x28,0x12,0x20,0x1C,0x08,0x05, - 0x18,0x07,0x20,0x0C,0x20,0x15,0x18,0x06,0x18,0x08,0x18,0x16,0x20,0x1C,0x18,0x1F, - 0x28,0x1E,0x20,0x1A,0x20,0x13,0x10,0x13,0x18,0x12,0x18,0x0B,0x18,0x05,0x30,0x1B, - 0x30,0x1D,0x30,0x29,0x30,0x20,0x20,0x03,0x20,0x05,0x28,0x0B,0x30,0x13,0x38,0x1B, - 0x40,0x20,0x40,0x1F,0x40,0x1F,0x40,0x20,0x30,0x27,0x30,0x1D,0x30,0x1E,0x30,0x1B, - 0x40,0x22,0x38,0x24,0x28,0x20,0x40,0x23,0x40,0x2B,0x38,0x2D,0x20,0x25,0x20,0x25, - 0x20,0x22,0x20,0x25,0x30,0x2E,0x30,0x2B,0x38,0x1E,0x28,0x1C,0x28,0x18,0x38,0x10, - 0x20,0x31,0x20,0x3B,0x20,0x30,0x38,0x22,0x40,0x1B,0x20,0x1E,0x20,0x1C,0x20,0x20, - 0x28,0x15,0x20,0x20,0x20,0x1F,0x20,0x1E,0x30,0x1C,0x50,0x20,0x28,0x1E,0x28,0x23, - 0x28,0x3E,0x38,0x16,0x38,0x18,0x38,0x17,0x28,0x10,0x28,0x12,0x20,0x0E,0x68,0x29, - 0x10,0x16,0x18,0x17,0x18,0x17,0x18,0x17,0x20,0x17,0x18,0x18,0x20,0x18,0x20,0x18, - 0x20,0x17,0x20,0x1B,0x20,0x1B,0x20,0x18,0x18,0x18,0x00,0x00 + 0x40,0x1F,0x20,0x10,0x08,0x0A,0x30,0x15,0x10,0x0C,0x08,0x0C,0x10,0x0C,0x10,0x1A, + 0x18,0x18,0x20,0x1D,0x18,0x1E,0x20,0x1D,0x30,0x28,0x20,0x13,0x20,0x19,0x18,0x1C, + 0x20,0x0E,0x20,0x0F,0x20,0x0E,0x20,0x0F,0x10,0x1C,0x10,0x1C,0x10,0x1C,0x10,0x1C, + 0x18,0x15,0x18,0x19,0x20,0x17,0x20,0x17,0x18,0x20,0x18,0x1E,0x20,0x16,0x28,0x0E, + 0x28,0x0C,0x18,0x0F,0x20,0x0B,0x18,0x15,0x10,0x0A,0x10,0x09,0x08,0x0A,0x10,0x0A, + 0x10,0x0A,0x18,0x07,0x10,0x0E,0x18,0x0C,0x18,0x0B,0x28,0x1D,0x20,0x1C,0x20,0x1C, + 0x28,0x18,0x28,0x24,0x28,0x1F,0x18,0x20,0x20,0x1F,0x20,0x1F,0x20,0x1F,0x10,0x15, + 0x10,0x15,0x10,0x18,0x18,0x18,0x28,0x14,0x28,0x12,0x20,0x1C,0x08,0x05,0x18,0x07, + 0x20,0x0C,0x20,0x15,0x18,0x06,0x18,0x08,0x18,0x16,0x20,0x1C,0x18,0x1F,0x28,0x1E, + 0x20,0x1A,0x20,0x13,0x10,0x13,0x18,0x12,0x18,0x0B,0x18,0x05,0x30,0x1B,0x30,0x1D, + 0x30,0x29,0x30,0x20,0x20,0x03,0x20,0x05,0x28,0x0B,0x30,0x13,0x38,0x1B,0x40,0x20, + 0x40,0x1F,0x40,0x1F,0x40,0x20,0x30,0x27,0x30,0x1D,0x30,0x1E,0x30,0x1B,0x40,0x22, + 0x38,0x24,0x28,0x20,0x40,0x23,0x40,0x2B,0x38,0x2D,0x20,0x25,0x20,0x25,0x20,0x22, + 0x20,0x25,0x30,0x2E,0x30,0x2B,0x38,0x1E,0x28,0x1C,0x28,0x18,0x38,0x10,0x20,0x31, + 0x20,0x3B,0x20,0x30,0x38,0x22,0x40,0x1B,0x20,0x1E,0x20,0x1C,0x20,0x20,0x28,0x15, + 0x20,0x20,0x20,0x1F,0x20,0x1E,0x30,0x1C,0x50,0x20,0x28,0x1E,0x28,0x23,0x28,0x3E, + 0x38,0x16,0x38,0x18,0x38,0x17,0x28,0x10,0x28,0x12,0x20,0x0E,0x68,0x29,0x10,0x16, + 0x18,0x17,0x18,0x17,0x18,0x17,0x20,0x17,0x18,0x18,0x20,0x18,0x20,0x18,0x20,0x17, + 0x20,0x1B,0x20,0x1B,0x20,0x18,0x18,0x18,0x20,0x14,0x30,0x1C,0x40,0x1C,0x30,0x1F, + 0x30,0x26,0x28,0x22,0x20,0x1A,0x30,0x17,0x00,0x00 }; const uint16_t score_tbl[] = { 0x000A,0x0014,0x001E,0x0032,0x003C,0x0046,0x004B,0x0050,0x0064,0x00C8,0x01F4,0x0320,0x03E8,0x07D0,0x0BB8,0x1770, @@ -212,76 +216,76 @@ const uint8_t score_spr_lut[] = { 0x0B,0x0A,0x04,0x06,0x04,0x07,0x05,0x04,0x04,0x05,0x07,0x04,0x0B,0x07,0x03,0x06, 0x06,0x06,0x06,0x03,0x06,0x0A,0x07,0x05,0x05,0x0B,0x0A,0x08,0x09,0x00 }; -static const uint8_t object_anim_5e71[] = { +static const uint8_t object_anim_7d93[] = { 0x09,0x00,0xFE,0xFF }; -static const uint8_t object_anim_5e79[] = { +static const uint8_t object_anim_7d9b[] = { 0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00, 0x04,0x00,0x04,0x00,0x05,0x00,0x05,0x00,0xE8,0xFF }; -static const uint8_t object_anim_5ead[] = { +static const uint8_t object_anim_7dcf[] = { 0x0B,0x00,0x0B,0x00,0x0B,0x00,0x0B,0x00,0x0C,0x00,0xFE,0xFF }; -static const uint8_t object_anim_5eb9[] = { +static const uint8_t object_anim_7ddb[] = { 0x22,0x00,0x22,0x00,0x23,0x00,0x23,0x00,0x24,0x00,0x24,0x00,0x24,0x40,0xF2,0xFF }; -static const uint8_t object_anim_5ec9[] = { +static const uint8_t object_anim_7deb[] = { 0x15,0x00,0x15,0x00,0x15,0x00,0x15,0x00,0x16,0x00,0x16,0x00,0x16,0x00,0x16,0x00, 0x17,0x00,0x17,0x00,0x17,0x00,0x17,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00, 0x13,0x00,0x13,0x00,0x13,0x00,0x13,0x00,0x14,0x00,0x14,0x00,0x14,0x00,0x14,0x00, 0xD0,0xFF }; -static const uint8_t object_anim_5efb[] = { +static const uint8_t object_anim_7e1d[] = { 0x12,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x11,0x00,0x11,0x00,0x11,0x00, 0x11,0x00,0x11,0x00,0xEC,0xFF }; -static const uint8_t object_anim_5f11[] = { +static const uint8_t object_anim_7e33[] = { 0x25,0x00,0x25,0x00,0x25,0x00,0x26,0x00,0x26,0x00,0x26,0x00,0x0E,0x00,0x0E,0x00, 0x0E,0x40,0xEE,0xFF }; -static const uint8_t object_anim_5f25[] = { +static const uint8_t object_anim_7e47[] = { 0x0F,0x00,0x0F,0x00,0x0F,0x00,0x23,0x00,0x23,0x00,0x23,0x00,0x10,0x00,0x10,0x00, 0x10,0x40,0xEE,0xFF }; -static const uint8_t object_anim_5f39[] = { +static const uint8_t object_anim_7e5b[] = { 0x21,0x00,0xFE,0xFF }; -static const uint8_t object_anim_5f4f[] = { +static const uint8_t object_anim_7e71[] = { 0x06,0x00,0x06,0x00,0x06,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x06,0x00,0x06,0x00, 0x06,0x00,0x06,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x06,0x00,0x06,0x00, 0x06,0x00,0x06,0x00,0x06,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00, 0xEC,0xFF }; -static const uint8_t object_anim_5f81[] = { +static const uint8_t object_anim_7ea3[] = { 0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x0A,0x00,0x0A,0x00,0x0A,0x00,0x0A,0x00, 0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00, 0xE0,0xFF }; -static const uint8_t object_anim_5f3d[] = { +static const uint8_t object_anim_7e5f[] = { 0x19,0x00,0x19,0x00,0x1A,0x00,0x1A,0x00,0x1B,0x00,0x1B,0x00,0x1C,0x00,0x1C,0x00, 0xF8,0xFF }; -static const uint8_t object_anim_5fa3[] = { +static const uint8_t object_anim_7ec5[] = { 0x1D,0x00,0x1D,0x00,0x1D,0x00,0x1F,0x00,0x1F,0x00,0x1F,0x00,0xF4,0xFF }; -static const uint8_t object_anim_5e75[] = { +static const uint8_t object_anim_7d97[] = { 0x2F,0x00,0xFE,0xFF }; -static const uint8_t object_anim_5e93[] = { +static const uint8_t object_anim_7db5[] = { 0x27,0x00,0x27,0x00,0x28,0x00,0x28,0x00,0x29,0x00,0x29,0x00,0x2A,0x00,0x2A,0x00, 0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0xE8,0xFF }; const uint8_t *object_anim_tbl[] = { - object_anim_5e71, object_anim_5e79, object_anim_5ead, object_anim_5eb9, - object_anim_5ec9, object_anim_5efb, object_anim_5f11, object_anim_5f25, - object_anim_5f39, 0, 0, 0, + object_anim_7d93, object_anim_7d9b, object_anim_7dcf, object_anim_7ddb, + object_anim_7deb, object_anim_7e1d, object_anim_7e33, object_anim_7e47, + object_anim_7e5b, 0, 0, 0, 0, 0, 0, 0, - object_anim_5f4f, object_anim_5f81, object_anim_5f3d, object_anim_5fa3, + object_anim_7e71, object_anim_7ea3, object_anim_7e5f, object_anim_7ec5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - object_anim_5e75, object_anim_5e93, 0, object_anim_5e75, - object_anim_5e75, object_anim_5e75, object_anim_5e75, object_anim_5e75, + object_anim_7d97, object_anim_7db5, 0, object_anim_7d97, + object_anim_7d97, object_anim_7d97, object_anim_7d97, object_anim_7d97, }; static const uint8_t club_anim_data[] = { 0x22,0x00,0x3A,0x00,0x0B,0x00,0x10,0x00,0x23,0x00,0x3B,0x00,0x07,0x00,0x19,0x00, @@ -323,9 +327,9 @@ const uint8_t player_anim_data[] = { 0xF3,0xE1,0x00,0x00 }; const uint8_t vscroll_offsets_data[] = { - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02, - 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, - 0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, + 0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, + 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x03,0x03,0x03,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, 0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x06, 0x07,0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x08,0x09,0x09,0x09,0x0A,0x0A,0x0B,0x0B, @@ -370,73 +374,78 @@ const uint8_t sin_tbl[] = { 0x3B,0x3B,0x3C,0x3C,0x3D,0x3D,0x3E,0x3E,0x3E,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F }; const uint16_t monster_spr_tbl[] = { - 0x0131,0x0135,0x0056,0x0137,0x0142,0x006F,0x0143,0x014C,0x006D,0x014D,0x014E,0x005D,0x014F,0x0151,0x005C,0x0152, - 0x0155,0x0068,0x0156,0x015B,0x0064,0x015C,0x015F,0x007D,0x0160,0x0166,0x006C,0x0167,0x016A,0x006F,0x016B,0x0173, - 0x006B,0x0174,0x0176,0x0056,0x0177,0x017A,0x005A,0x017B,0x0184,0x0051,0x0185,0x018A,0x005E,0x018B,0x018D,0x00A1 + 0x0138,0x013C,0x0056,0x013E,0x0149,0x006F,0x014A,0x0153,0x006D,0x0154,0x0155,0x005D,0x0156,0x0158,0x005C,0x0159, + 0x015C,0x0068,0x015D,0x0162,0x0064,0x0163,0x0166,0x007D,0x0167,0x016D,0x006C,0x016E,0x0171,0x006F,0x0172,0x017A, + 0x006B,0x017B,0x017D,0x0056,0x017E,0x0181,0x005A,0x0182,0x018B,0x0051,0x018C,0x0191,0x005E,0x0192,0x0194,0x00A1 }; const uint8_t monster_anim_tbl[] = { - 0xFF,0xFF,0x01,0x7D,0x00,0x00,0x28,0x00,0xFE,0xFF,0x26,0x00,0x26,0x00,0x26,0x00, - 0x26,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x27,0x00,0x27,0x00,0x27,0x00, - 0x27,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0xE0,0xFF,0x00,0x7D,0x2A,0x00, - 0xFE,0xFF,0x01,0x7D,0x01,0x00,0x05,0x00,0xFE,0xFF,0x01,0x7D,0x02,0x00,0x06,0x00, - 0x07,0x00,0xFE,0xFF,0x06,0x00,0xFE,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF,0x01,0x7D, - 0x03,0x00,0x36,0x00,0x36,0x00,0x37,0x00,0x37,0x00,0x38,0x00,0x38,0x00,0x39,0x00, - 0x39,0x00,0x06,0x00,0xFE,0xFF,0x07,0x00,0xFE,0xFF,0x08,0x00,0x08,0x00,0x09,0x00, - 0x09,0x00,0x0A,0x00,0x0A,0x00,0x0B,0x00,0x0B,0x00,0xF0,0xFF,0x10,0x00,0x10,0x00, - 0x0C,0x00,0x0C,0x00,0x0D,0x00,0x0D,0x00,0x0E,0x00,0x0E,0x00,0x0F,0x00,0x0F,0x00, - 0xF0,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF,0x01,0x7D,0x04,0x00,0x06,0x00,0x07,0x00, - 0xFE,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF,0x01,0x7D,0x05,0x00,0x12,0x00,0x13,0x00, - 0xFC,0xFF,0x14,0x00,0x15,0x00,0xFC,0xFF,0x00,0x7D,0x16,0x00,0xFE,0xFF,0x5C,0x00, - 0x5C,0x00,0x5C,0x00,0x5C,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5B,0x00, - 0x5B,0x00,0x5B,0x00,0x5B,0x00,0xE8,0xFF,0x5C,0x00,0x5C,0x00,0x5C,0x00,0x5A,0x00, - 0x5A,0x00,0x5A,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00,0xEE,0xFF,0x00,0x7D,0x5B,0x00, - 0xFE,0xFF,0x01,0x7D,0x06,0x00,0x12,0x00,0x13,0x00,0xFC,0xFF,0x00,0x7D,0x16,0x00, - 0xFE,0xFF,0x01,0x7D,0x07,0x00,0x12,0x00,0x13,0x00,0xFC,0xFF,0x12,0x00,0x13,0x00, - 0xFC,0xFF,0x00,0x7D,0x16,0x00,0xFE,0xFF,0x5C,0x00,0x5C,0x00,0x5C,0x00,0x5C,0x00, - 0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00, - 0xE8,0xFF,0x5C,0x00,0xFE,0xFF,0x00,0x7D,0x5A,0x00,0xFE,0xFF,0x01,0x7D,0x08,0x00, - 0x21,0x00,0xFE,0xFF,0x22,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x24,0x00,0xFE,0xFF, - 0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x23,0x00,0xFE,0xFF,0x00,0x7D,0x22,0x00, - 0xFE,0xFF,0x1D,0x00,0xFE,0xFF,0x1C,0x00,0xFE,0xFF,0x1D,0x00,0xFE,0xFF,0x00,0x7D, - 0x1C,0x00,0xFE,0xFF,0x1E,0x00,0xFE,0xFF,0x1F,0x00,0x1F,0x00,0x20,0x00,0x20,0x00, - 0x1E,0x00,0x1E,0x00,0xF4,0xFF,0x1F,0x00,0x1F,0x00,0x20,0x00,0x20,0x00,0x1E,0x00, - 0x1E,0x00,0xF4,0xFF,0x00,0x7D,0x1E,0x00,0xFE,0xFF,0x25,0x00,0xFE,0xFF,0x28,0x00, - 0x28,0x00,0x29,0x00,0xFE,0xFF,0x28,0x00,0xFE,0xFF,0x00,0x7D,0x2A,0x00,0xFE,0xFF, - 0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x55,0x00,0x55,0x00, - 0x55,0x00,0x55,0x00,0x55,0x00,0x55,0x00,0xE8,0xFF,0x57,0x00,0xFE,0xFF,0x58,0x00, - 0xFE,0xFF,0x00,0x7D,0x59,0x00,0xFE,0xFF,0x01,0x7D,0x09,0x00,0x17,0x00,0x17,0x00, - 0x18,0x00,0x18,0x00,0xF8,0xFF,0x00,0x7D,0x1B,0x00,0xFE,0xFF,0x46,0x00,0x46,0x00, - 0x47,0x00,0x47,0x00,0x48,0x00,0x48,0x00,0xF4,0xFF,0x00,0x7D,0x49,0x00,0xFE,0xFF, - 0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0x2D,0x00,0x2D,0x00,0xF4,0xFF,0x00,0x7D, - 0x2E,0x00,0xFE,0xFF,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00, - 0xF4,0xFF,0x00,0x7D,0x04,0x00,0xFE,0xFF,0x5A,0x00,0x5A,0x00,0x5B,0x00,0x5B,0x00, - 0x5C,0x00,0x5C,0x00,0xF4,0xFF,0x00,0x7D,0x5A,0x00,0xFE,0xFF,0x81,0x00,0x81,0x00, - 0x81,0x00,0x82,0x00,0x82,0x00,0x82,0x00,0x83,0x00,0x83,0x00,0x83,0x00,0xEE,0xFF, - 0x00,0x7D,0x84,0x00,0x84,0x00,0x85,0x00,0x85,0x00,0x86,0x00,0x86,0x00,0x8A,0x00, - 0x8A,0x00,0x8B,0x00,0x8B,0x00,0x87,0x00,0x87,0x00,0xEC,0xFF,0x01,0x7D,0x0A,0x00, - 0x45,0x00,0xFE,0xFF,0x44,0x00,0x44,0x00,0x44,0x00,0x44,0x00,0x43,0x00,0x43,0x00, - 0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x03,0x00, - 0x03,0x00,0x03,0x40,0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x02,0x00, - 0x03,0x00,0x03,0x00,0x03,0x00,0xEE,0xFF,0x00,0x00,0x00,0x00,0x43,0x00,0x43,0x00, - 0x44,0x00,0x44,0x00,0x45,0x40,0x45,0x00,0xFE,0xFF,0x00,0x7D,0x04,0x00,0xFE,0xFF, - 0x4A,0x00,0xFE,0xFF,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4C,0x00,0x4C,0x00,0x4C,0x00, - 0x4D,0x00,0x4D,0x00,0x4D,0x00,0x4E,0x00,0x4E,0x00,0x4E,0x40,0x4F,0x00,0x4F,0x00, - 0x4F,0x00,0x50,0x00,0x50,0x00,0x50,0x00,0x51,0x00,0x51,0x00,0x51,0x00,0x52,0x00, - 0x52,0x00,0x52,0x00,0xE8,0xFF,0x4E,0x00,0x4E,0x00,0x4D,0x00,0x4D,0x00,0x4C,0x00, - 0x4C,0x00,0x4B,0x00,0x4B,0x00,0x4A,0x40,0x4A,0x00,0xFE,0xFF,0x00,0x7D,0x53,0x00, - 0xFE,0xFF,0x3A,0x00,0xFE,0xFF,0x3A,0x00,0x3A,0x00,0x3A,0x00,0x3B,0x00,0x3B,0x00, - 0x3B,0x00,0x3C,0x00,0x3C,0x00,0x3C,0x00,0x3D,0x00,0x3D,0x00,0x3D,0x40,0x3E,0x00, - 0x3E,0x00,0x3E,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x00,0xF4,0xFF,0x3F,0x00,0x3F,0x00, - 0x3F,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00, - 0x42,0x00,0x42,0x40,0x42,0x00,0xFE,0xFF,0x00,0x7D,0x3F,0x00,0xFE,0xFF,0x01,0x7D, - 0x0B,0x00,0x2F,0x00,0x2F,0x00,0x2F,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x2F,0x00, + 0xFF,0xFF,0x91,0x00,0x91,0x00,0x92,0x00,0x92,0x00,0x93,0x00,0x93,0x00,0xF4,0xFF, + 0x01,0x7D,0x00,0x00,0x28,0x00,0xFE,0xFF,0x26,0x00,0x26,0x00,0x26,0x00,0x26,0x00, + 0x25,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x27,0x00,0x27,0x00,0x27,0x00,0x27,0x00, + 0x25,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0xE0,0xFF,0x00,0x7D,0x2A,0x00,0xFE,0xFF, + 0x96,0x00,0xFE,0xFF,0x94,0x00,0x94,0x00,0x94,0x00,0x95,0x00,0x95,0x00,0x95,0x00, + 0x96,0x00,0x96,0x00,0x96,0x00,0x97,0x00,0x97,0x00,0x97,0x00,0xE8,0xFF,0x00,0x7D, + 0x94,0x00,0xFE,0xFF,0x01,0x7D,0x01,0x00,0x05,0x00,0xFE,0xFF,0x01,0x7D,0x02,0x00, + 0x06,0x00,0x07,0x00,0xFE,0xFF,0x06,0x00,0xFE,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF, + 0x01,0x7D,0x03,0x00,0x36,0x00,0x36,0x00,0x37,0x00,0x37,0x00,0x38,0x00,0x38,0x00, + 0x39,0x00,0x39,0x00,0x06,0x00,0xFE,0xFF,0x07,0x00,0xFE,0xFF,0x08,0x00,0x08,0x00, + 0x09,0x00,0x09,0x00,0x0A,0x00,0x0A,0x00,0x0B,0x00,0x0B,0x00,0xF0,0xFF,0x10,0x00, + 0x10,0x00,0x0C,0x00,0x0C,0x00,0x0D,0x00,0x0D,0x00,0x0E,0x00,0x0E,0x00,0x0F,0x00, + 0x0F,0x00,0xF0,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF,0x01,0x7D,0x04,0x00,0x06,0x00, + 0x07,0x00,0xFE,0xFF,0x00,0x7D,0x11,0x00,0xFE,0xFF,0x01,0x7D,0x05,0x00,0x12,0x00, + 0x13,0x00,0xFC,0xFF,0x14,0x00,0x15,0x00,0xFC,0xFF,0x00,0x7D,0x16,0x00,0xFE,0xFF, + 0x5C,0x00,0x5C,0x00,0x5C,0x00,0x5C,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00, + 0x5B,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00,0xE8,0xFF,0x5C,0x00,0x5C,0x00,0x5C,0x00, + 0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00,0xEE,0xFF,0x00,0x7D, + 0x5B,0x00,0xFE,0xFF,0x01,0x7D,0x06,0x00,0x12,0x00,0x13,0x00,0xFC,0xFF,0x00,0x7D, + 0x16,0x00,0xFE,0xFF,0x8D,0x00,0x8D,0x00,0x8D,0x00,0x8E,0x00,0x8E,0x00,0x8E,0x00, + 0x8F,0x00,0x8F,0x00,0x8F,0x00,0x8E,0x00,0x8E,0x00,0x8E,0x00,0xE8,0xFF,0x00,0x7D, + 0x90,0x00,0xFE,0xFF,0x01,0x7D,0x07,0x00,0x12,0x00,0x13,0x00,0xFC,0xFF,0x12,0x00, + 0x13,0x00,0xFC,0xFF,0x00,0x7D,0x16,0x00,0xFE,0xFF,0x5C,0x00,0x5C,0x00,0x5C,0x00, + 0x5C,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5A,0x00,0x5B,0x00,0x5B,0x00,0x5B,0x00, + 0x5B,0x00,0xE8,0xFF,0x5C,0x00,0xFE,0xFF,0x00,0x7D,0x5A,0x00,0xFE,0xFF,0x01,0x7D, + 0x08,0x00,0x21,0x00,0xFE,0xFF,0x22,0x00,0x22,0x00,0x22,0x00,0x22,0x00,0x24,0x00, + 0xFE,0xFF,0x24,0x00,0x24,0x00,0x24,0x00,0x24,0x00,0x23,0x00,0xFE,0xFF,0x00,0x7D, + 0x22,0x00,0xFE,0xFF,0x1D,0x00,0xFE,0xFF,0x1C,0x00,0xFE,0xFF,0x1D,0x00,0xFE,0xFF, + 0x00,0x7D,0x1C,0x00,0xFE,0xFF,0x1E,0x00,0xFE,0xFF,0x1F,0x00,0x1F,0x00,0x20,0x00, + 0x20,0x00,0x1E,0x00,0x1E,0x00,0xF4,0xFF,0x1F,0x00,0x1F,0x00,0x20,0x00,0x20,0x00, + 0x1E,0x00,0x1E,0x00,0xF4,0xFF,0x00,0x7D,0x1E,0x00,0xFE,0xFF,0x25,0x00,0xFE,0xFF, + 0x28,0x00,0x28,0x00,0x29,0x00,0xFE,0xFF,0x28,0x00,0xFE,0xFF,0x00,0x7D,0x2A,0x00, + 0xFE,0xFF,0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x54,0x00,0x55,0x00, + 0x55,0x00,0x55,0x00,0x55,0x00,0x55,0x00,0x55,0x00,0xE8,0xFF,0x57,0x00,0xFE,0xFF, + 0x58,0x00,0xFE,0xFF,0x00,0x7D,0x59,0x00,0xFE,0xFF,0x01,0x7D,0x09,0x00,0x17,0x00, + 0x17,0x00,0x18,0x00,0x18,0x00,0xF8,0xFF,0x00,0x7D,0x1B,0x00,0xFE,0xFF,0x46,0x00, + 0x46,0x00,0x47,0x00,0x47,0x00,0x48,0x00,0x48,0x00,0xF4,0xFF,0x00,0x7D,0x49,0x00, + 0xFE,0xFF,0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0x2D,0x00,0x2D,0x00,0xF4,0xFF, + 0x00,0x7D,0x2E,0x00,0xFE,0xFF,0x01,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x03,0x00, + 0x03,0x00,0x02,0x00,0x02,0x00,0xF0,0xFF,0x00,0x7D,0x04,0x00,0xFE,0xFF,0x5A,0x00, + 0x5A,0x00,0x5B,0x00,0x5B,0x00,0x5C,0x00,0x5C,0x00,0xF4,0xFF,0x00,0x7D,0x5A,0x00, + 0xFE,0xFF,0x81,0x00,0x81,0x00,0x81,0x00,0x82,0x00,0x82,0x00,0x82,0x00,0x83,0x00, + 0x83,0x00,0x83,0x00,0xEE,0xFF,0x00,0x7D,0x84,0x00,0x84,0x00,0x85,0x00,0x85,0x00, + 0x86,0x00,0x86,0x00,0x8A,0x00,0x8A,0x00,0x8B,0x00,0x8B,0x00,0x87,0x00,0x87,0x00, + 0xEC,0xFF,0x01,0x7D,0x0A,0x00,0x45,0x00,0xFE,0xFF,0x44,0x00,0x44,0x00,0x44,0x00, + 0x44,0x00,0x43,0x00,0x43,0x00,0x43,0x00,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x40,0x01,0x00,0x01,0x00,0x01,0x00, + 0x02,0x00,0x02,0x00,0x02,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x02,0x00,0x02,0x00, + 0x02,0x00,0xE8,0xFF,0x00,0x00,0x00,0x00,0x43,0x00,0x43,0x00,0x44,0x00,0x44,0x00, + 0x45,0x40,0x45,0x00,0xFE,0xFF,0x00,0x7D,0x04,0x00,0xFE,0xFF,0x4A,0x00,0xFE,0xFF, + 0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4C,0x00,0x4C,0x00,0x4C,0x00,0x4D,0x00,0x4D,0x00, + 0x4D,0x00,0x4E,0x00,0x4E,0x00,0x4E,0x40,0x4F,0x00,0x4F,0x00,0x4F,0x00,0x50,0x00, + 0x50,0x00,0x50,0x00,0x51,0x00,0x51,0x00,0x51,0x00,0x52,0x00,0x52,0x00,0x52,0x00, + 0xE8,0xFF,0x4E,0x00,0x4E,0x00,0x4D,0x00,0x4D,0x00,0x4C,0x00,0x4C,0x00,0x4B,0x00, + 0x4B,0x00,0x4A,0x40,0x4A,0x00,0xFE,0xFF,0x00,0x7D,0x53,0x00,0xFE,0xFF,0x3A,0x00, + 0xFE,0xFF,0x3A,0x00,0x3A,0x00,0x3A,0x00,0x3B,0x00,0x3B,0x00,0x3B,0x00,0x3C,0x00, + 0x3C,0x00,0x3C,0x00,0x3D,0x00,0x3D,0x00,0x3D,0x40,0x3E,0x00,0x3E,0x00,0x3E,0x00, + 0x3F,0x00,0x3F,0x00,0x3F,0x00,0xF4,0xFF,0x3F,0x00,0x3F,0x00,0x3F,0x00,0x40,0x00, + 0x40,0x00,0x40,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x42,0x00,0x42,0x00,0x42,0x40, + 0x42,0x00,0xFE,0xFF,0x00,0x7D,0x3F,0x00,0xFE,0xFF,0x01,0x7D,0x0B,0x00,0x2F,0x00, 0x2F,0x00,0x2F,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x2F,0x00,0x2F,0x00,0x2F,0x00, - 0x30,0x00,0x30,0x00,0x30,0x00,0x31,0x00,0x31,0x00,0x32,0x00,0x32,0x40,0x33,0x00, - 0x33,0x00,0x34,0x00,0x34,0x00,0xF8,0xFF,0x00,0x7D,0x35,0x00,0xFE,0xFF,0x01,0x7D, - 0x0C,0x00,0x80,0x00,0x88,0x00,0x89,0x00,0xFC,0xFF,0x00,0x7D,0x84,0x00,0x84,0x00, - 0x85,0x00,0x85,0x00,0x86,0x00,0x86,0x00,0x8A,0x00,0x8A,0x00,0x8B,0x00,0x8B,0x00, - 0x87,0x00,0x87,0x00,0xEC,0xFF,0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0x2D,0x00, - 0x2D,0x00,0xF4,0xFF,0x00,0x7D,0x2E,0x00,0xFE,0xFF,0x3E,0x00,0x3E,0x00,0x3F,0x00, - 0x3F,0x00,0xF8,0xFF,0x00,0x7D,0x3E,0x00,0xFE,0xFF,0x57,0x00,0x57,0x00,0x58,0x00, - 0x58,0x00,0xF8,0xFF,0x00,0x7D,0x59,0x00,0xFE,0xFF + 0x30,0x00,0x30,0x00,0x30,0x00,0x2F,0x00,0x2F,0x00,0x2F,0x00,0x30,0x00,0x30,0x00, + 0x30,0x00,0x31,0x00,0x31,0x00,0x32,0x00,0x32,0x40,0x33,0x00,0x33,0x00,0x34,0x00, + 0x34,0x00,0xF8,0xFF,0x00,0x7D,0x35,0x00,0xFE,0xFF,0x01,0x7D,0x0C,0x00,0x80,0x00, + 0x88,0x00,0x89,0x00,0xFC,0xFF,0x00,0x7D,0x84,0x00,0x84,0x00,0x85,0x00,0x85,0x00, + 0x86,0x00,0x86,0x00,0x8A,0x00,0x8A,0x00,0x8B,0x00,0x8B,0x00,0x87,0x00,0x87,0x00, + 0xEC,0xFF,0x2B,0x00,0x2B,0x00,0x2C,0x00,0x2C,0x00,0x2D,0x00,0x2D,0x00,0xF4,0xFF, + 0x00,0x7D,0x2E,0x00,0xFE,0xFF,0x3E,0x00,0x3E,0x00,0x3F,0x00,0x3F,0x00,0xF8,0xFF, + 0x00,0x7D,0x3E,0x00,0xFE,0xFF,0x57,0x00,0x57,0x00,0x58,0x00 }; diff --git a/p2/unpack.c b/p2/unpack.c index 9b67b04..131bc8a 100644 --- a/p2/unpack.c +++ b/p2/unpack.c @@ -223,7 +223,6 @@ static int unpack_sqz(FILE *in, struct unpack_sqz_t *u) { struct unpack_sqv_t { uint8_t dict_buf[0x200 * 2]; uint8_t rd[0x1000]; - int dict_len; uint8_t *dst; }; @@ -243,7 +242,6 @@ static int unpack_sqv(FILE *in, struct unpack_sqv_t *u) { return 0; } - u->dst = output_buffer; uint8_t *dst = output_buffer; const uint8_t *src = u->rd; @@ -281,6 +279,7 @@ static int unpack_sqv(FILE *in, struct unpack_sqv_t *u) { val = 0; } assert((dst - output_buffer) == uncompressed_size); + u->dst = output_buffer; return uncompressed_size; }