Import blues from d3c295c2

This commit is contained in:
Gregory Montoir 2019-06-02 08:21:03 +08:00
parent 226a2db085
commit 9a76b82910
8 changed files with 696 additions and 175 deletions

View File

@ -5,7 +5,7 @@ This is a rewrite of the [Blues Brothers](https://www.mobygames.com/game/blues-b
![Screenshot1](blues1.png) ![Screenshot2](bbja2.png)
There is also early support for [Prehistorik 2](https://www.mobygames.com/game/prehistorik-2).
There is also some support for [Prehistorik 2](https://www.mobygames.com/game/prehistorik-2).
## Requirements

View File

@ -50,7 +50,7 @@ struct monster_t {
struct thing_t {
void *ref;
int16_t counter;
int16_t unkE;
int16_t y_velocity;
};
struct object_t {
@ -62,13 +62,13 @@ struct object_t {
struct player_t p; /* objects[1] */
struct club_projectile_t c; /* objects[2..5] */
struct monster_t m; /* objects[11..22] */
struct thing_t t;
struct thing_t t; /* objects[23..74] */
} data;
uint8_t hit_counter;
};
#define MONSTERS_COUNT 12
#define OBJECTS_COUNT 108
#define OBJECTS_COUNT 116
/*
offset count
0 1 : club
@ -78,9 +78,11 @@ struct object_t {
11 12 : monsters
23 32 : secret bonuses
55 20 : items
75 16 : bonus scores
75 16 : scores
91 7 : decor
98 5 : boss level 5 (tree)
103 5 : boss projectiles
108 8 : boss energy bars
*/
struct boss_level5_proj_t {
@ -124,6 +126,11 @@ struct vars_t {
uint32_t score;
uint16_t score_extra_life;
uint16_t level_complete_secrets_count;
uint16_t level_complete_bonuses_count;
uint16_t level_current_secrets_count;
uint16_t level_current_bonuses_count;
uint8_t level_completed_flag;
uint8_t restart_level_flag;
@ -133,7 +140,7 @@ struct vars_t {
uint16_t shake_screen_voffset;
uint8_t player_lifes;
uint8_t player_energy;
int8_t player_energy;
uint8_t player_death_flag;
uint8_t player_flying_flag;
uint8_t player_flying_counter;
@ -206,28 +213,42 @@ struct vars_t {
uint8_t type0_hdir;
} monster;
struct {
int16_t x_pos, y_pos;
uint8_t hdir;
int16_t x_dist;
} boss;
uint16_t draw_counter;
uint8_t unk_counter;
int16_t x_velocity, y_velocity;
bool hdir; /* facing to the right */
int16_t x_dist; /* horizontal distance from player */
int16_t state_counter;
uint8_t anim_num;
const uint8_t *prev_anim;
const uint8_t *next_anim;
const uint8_t *current_anim;
struct {
int16_t x_pos, y_pos;
uint16_t spr_num;
} parts[5];
struct object_t *obj1;
struct object_t *obj2;
struct object_t *obj3;
} boss; /* gorilla */
struct {
uint8_t unk1;
uint8_t energy;
uint8_t state; /* 3: boss dead */
uint8_t unk4; /* spr103_pos */
uint8_t unk5; /* spr106_pos */
uint8_t spr103_pos;
uint8_t spr106_pos;
uint8_t unk6;
uint8_t counter;
uint8_t unk8;
struct boss_level5_proj_t proj_tbl[5];
} boss_level5; /* tree */
struct {
int16_t unk1;
uint8_t unk2;
uint8_t unk3;
uint16_t energy;
uint8_t seq_counter;
uint8_t hit_counter;
const uint8_t *seq;
const uint16_t *anim;
} boss_level9; /* minotaur statue */
} boss_level9; /* minotaur */
struct {
int16_t x_pos, y_pos;
uint16_t spr_num;
@ -270,7 +291,9 @@ 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[1100];
extern const uint8_t boss_minotaur_seq_data[742];
extern const uint8_t boss_minotaur_seq_data[86];
extern const uint16_t boss_gorilla_data[19 * 10];
extern const uint16_t boss_gorilla_spr_tbl[46 * 3]; /* uint16_t: spr1_num, uint16_t: spr2_num, uint8_t: dx, uint8_t: dy */
/* game.c */
extern void update_input();
@ -296,6 +319,8 @@ extern void video_copy_img(const uint8_t *src);
extern void video_draw_panel(const uint8_t *src);
extern void video_draw_panel_number(int offset, int num);
extern void video_draw_number(int offset, int num);
extern void video_draw_character_spr(int offset, uint8_t chr);
extern void video_draw_string2(int offset, const char *str);
extern void video_draw_tile(const uint8_t *src, int x, int y);
extern void video_convert_tiles(uint8_t *data, int len);
extern void video_load_front_tiles();

File diff suppressed because it is too large Load Diff

View File

@ -251,9 +251,9 @@ void load_leveldat(const uint8_t *p, struct level_t *level) {
g_res.level.boss_xmax = READ_LE_UINT16(p); p += 2;
g_res.level.boss_counter = *p++;
g_res.level.boss_energy = READ_LE_UINT16(p); p += 2;
g_res.level.boss_flag = *p++;
g_res.level.end_x_pos = READ_LE_UINT16(p); p += 2;
g_res.level.end_y_pos = READ_LE_UINT16(p); p += 2;
g_res.level.boss_state = *p++;
g_res.level.boss_x_pos = READ_LE_UINT16(p); p += 2;
g_res.level.boss_y_pos = READ_LE_UINT16(p); p += 2;
const int total = p - g_res.leveldat;
print_debug(DBG_RESOURCE, "level total offset %d", total);
}

View File

@ -153,9 +153,9 @@ struct level_t {
uint16_t boss_xmax;
uint8_t boss_counter;
uint16_t boss_energy;
uint8_t boss_flag; /* !=255: has boss */
uint16_t end_x_pos;
uint16_t end_y_pos;
uint8_t boss_state; /* !=255: has boss */
uint16_t boss_x_pos;
uint16_t boss_y_pos;
};
struct resource_t {

View File

@ -88,6 +88,22 @@ void video_draw_number(int offset, int num) {
decode_planar(fnt + num * 88, g_res.vga + y * GAME_SCREEN_W + x, GAME_SCREEN_W, 16, 11, 0);
}
void video_draw_character_spr(int offset, uint8_t chr) {
const int y = (offset * 8) / 320;
const int x = (offset * 8) % 320;
video_draw_sprite(241 + chr, x, y, 0);
}
void video_draw_string2(int offset, const char *s) {
while (*s) {
const uint8_t chr = *s++;
if (chr != ' ') {
video_draw_character_spr(offset, chr - 0x41);
}
offset += 2;
}
}
void video_clear() {
memset(g_res.vga, 0, GAME_SCREEN_W * GAME_SCREEN_H);
}

View File

@ -57,6 +57,7 @@ struct mixerchannel_t {
static const int _rate = SYS_AUDIO_FREQ;
static struct mixerchannel_t _channel;
static ModPlugFile *_mpf;
static int _music_num;
static uint16_t sound_offsets_tbl[MAX_SOUNDS];
@ -99,6 +100,7 @@ void sound_init() {
sound_offsets_tbl[i] = offset;
offset += sound_sizes_tbl[i];
}
_music_num = -1;
g_sys.start_audio(mix, 0);
}
@ -130,6 +132,9 @@ void play_music(int num) {
if (g_res.dos_demo) { /* no .TRK files with demo */
return;
}
if (_music_num == num) {
return;
}
const char *filename = trk_names_tbl[num];
if (filename) {
print_debug(DBG_MIXER, "play_music '%s'", filename);
@ -145,6 +150,7 @@ void play_music(int num) {
print_debug(DBG_MIXER, "Loaded module '%s'", ModPlug_GetName(_mpf));
}
free(data);
_music_num = num;
}
g_sys.unlock_audio();
}

View File

@ -455,46 +455,30 @@ const uint8_t boss_minotaur_seq_data[] = {
0x03,0x03,0x03,0x03,0xF1,0x00,0x00,0xFF,0x03,0x03,0xFE,0x03,0x00,0x00,0x00,0x03,
0x03,0x03,0x03,0x00,0xFE,0x00,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x03,0xE7,0x04,
0x04,0x04,0x04,0x04,0x04,0x04,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,
0xFF,0x00,0x00,0x00,0x00,0xEA,0xA2,0x01,0x9A,0x01,0x95,0x01,0x9F,0x01,0xA0,0x01,
0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA2,0x01,0x9A,0x01,0x96,0x01,
0x9D,0x01,0xA0,0x01,0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA2,0x01,
0x9A,0x01,0x96,0x01,0x9C,0x01,0xA0,0x01,0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,
0x09,0xA6,0xA1,0x01,0x99,0x01,0x96,0x01,0x9D,0x01,0x9D,0x81,0x0F,0xA6,0x03,0xA6,
0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA2,0x01,0x9B,0x01,0x96,0x01,0x9D,0x01,0x9D,0x81,
0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA2,0x01,0x99,0x01,0x98,0x81,
0x9E,0x01,0x9E,0x81,0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA2,0x01,
0x9A,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,0x97,0x01,
0x9D,0x01,0x9E,0x81,0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0xF7,0xA5,0x09,0xA6,0xA3,0x01,
0x9A,0x01,0x95,0x01,0xA0,0x81,0x9D,0x81,0x0F,0xA6,0x03,0xA6,0xFD,0xA5,0x09,0xA6,
0xF7,0xA5,0xA2,0x01,0x99,0x01,0xF8,0xE9,0xA2,0x01,0x9A,0x01,0xFB,0xEB,0xA2,0x01,
0x9B,0x01,0xF6,0xE8,0xA1,0x01,0x99,0x01,0xF6,0xDB,0xA1,0x01,0x9A,0x01,0x01,0xDD,
0xA1,0x01,0x9B,0x01,0xF3,0xDA,0xA3,0x01,0x99,0x01,0xED,0xF0,0xA3,0x01,0x9A,0x01,
0xF0,0xF2,0xA3,0x01,0x9B,0x01,0xEB,0xF0,0x99,0x01,0x95,0x01,0xFF,0xE8,0x9A,0x01,
0x95,0x01,0xFB,0xEA,0x9B,0x01,0x95,0x01,0xF8,0xF7,0x99,0x01,0x96,0x01,0xFF,0xE8,
0x9A,0x01,0x96,0x01,0xFB,0xEA,0x9B,0x01,0x96,0x01,0xF8,0xF7,0x99,0x01,0x97,0x01,
0xFF,0xE8,0x9A,0x01,0x97,0x01,0xFB,0xEA,0x9B,0x01,0x97,0x01,0xF8,0xF7,0x99,0x01,
0x98,0x01,0xFF,0xE8,0x9A,0x01,0x98,0x01,0xFB,0xEA,0x9B,0x01,0x98,0x01,0xF8,0xF7,
0x99,0x01,0x98,0x81,0xFF,0xE8,0x9A,0x01,0x98,0x81,0xFB,0xEA,0x9B,0x01,0x98,0x81,
0xF8,0xF7,0x99,0x01,0x9C,0x01,0xE2,0xEC,0x99,0x01,0x9D,0x01,0xDD,0xF1,0x99,0x01,
0x9E,0x01,0xD6,0xE9,0x99,0x01,0x9F,0x01,0xE8,0x0C,0x9A,0x01,0x9C,0x01,0xE2,0xEC,
0x9A,0x01,0x9D,0x01,0xE0,0xF1,0x9A,0x01,0x9E,0x01,0xD4,0xEA,0x9A,0x01,0x9F,0x01,
0xEA,0x0F,0x9B,0x01,0x9C,0x01,0xDE,0xF8,0x9B,0x01,0x9D,0x01,0xDC,0x02,0x9B,0x01,
0x9E,0x01,0xCE,0xFB,0x9B,0x01,0x9F,0x01,0xE6,0x1D,0x99,0x01,0x9D,0x81,0x21,0xEB,
0x99,0x01,0x9E,0x81,0x2C,0xE4,0x99,0x01,0xA0,0x01,0x12,0x10,0x9A,0x01,0x9D,0x81,
0x18,0xEE,0x9A,0x01,0x9E,0x81,0x29,0xEA,0x9A,0x01,0xA0,0x01,0x09,0x13,0x9B,0x01,
0x9D,0x81,0x1A,0xF9,0x9B,0x01,0x9E,0x81,0x29,0xF3,0x9B,0x01,0xA0,0x01,0x0C,0x1E,
0x9A,0x01,0xA0,0x81,0xEC,0x16
0xFF,0x00,0x00,0x00,0x00,0xEA
};
const uint16_t boss_gorilla_data[] = {
0x01A2,0x019A,0x0195,0x019F,0x01A0,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0196,0x019D,0x01A0,0xA60F,
0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0196,0x019C,0x01A0,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A1,0x0199,
0x0196,0x019D,0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019B,0x0196,0x019D,0x819D,0xA60F,0xA603,0xA5FD,
0xA5F7,0xA609,0x01A2,0x0199,0x8198,0x019E,0x819E,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0198,0x019C,
0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0195,0x019E,0x819E,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,
0x01A2,0x0199,0x0195,0x019E,0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A3,0x0199,0x0195,0x019E,0x819D,0xA60F,
0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x0199,0x0195,0x019E,0x01A0,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A3,0x0199,
0x0195,0x019D,0x01A0,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A3,0x019B,0x0195,0x019E,0x819D,0xA60F,0xA603,0xA5FD,
0xA5F7,0xA609,0x01A3,0x019B,0x0195,0x019D,0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A3,0x019B,0x0195,0x019D,
0x01A0,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0198,0x019C,0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,
0x01A2,0x019A,0x0197,0x019E,0x819D,0xA60F,0xA603,0xA5FD,0xA5F7,0xA609,0x01A2,0x019A,0x0197,0x019D,0x819E,0xA60F,
0xA603,0xA5FD,0xA5F7,0xA609,0x01A3,0x019A,0x0195,0x81A0,0x819D,0xA60F,0xA603,0xA5FD,0xA609,0xA5F7
};
const uint16_t boss_gorilla_spr_tbl[] = {
0x01A2,0x0199,0xE9F8,0x01A2,0x019A,0xEBFB,0x01A2,0x019B,0xE8F6,0x01A1,0x0199,0xDBF6,0x01A1,0x019A,0xDD01,0x01A1,
0x019B,0xDAF3,0x01A3,0x0199,0xF0ED,0x01A3,0x019A,0xF2F0,0x01A3,0x019B,0xF0EB,0x0199,0x0195,0xE8FF,0x019A,0x0195,
0xEAFB,0x019B,0x0195,0xF7F8,0x0199,0x0196,0xE8FF,0x019A,0x0196,0xEAFB,0x019B,0x0196,0xF7F8,0x0199,0x0197,0xE8FF,
0x019A,0x0197,0xEAFB,0x019B,0x0197,0xF7F8,0x0199,0x0198,0xE8FF,0x019A,0x0198,0xEAFB,0x019B,0x0198,0xF7F8,0x0199,
0x8198,0xE8FF,0x019A,0x8198,0xEAFB,0x019B,0x8198,0xF7F8,0x0199,0x019C,0xECE2,0x0199,0x019D,0xF1DD,0x0199,0x019E,
0xE9D6,0x0199,0x019F,0x0CE8,0x019A,0x019C,0xECE2,0x019A,0x019D,0xF1E0,0x019A,0x019E,0xEAD4,0x019A,0x019F,0x0FEA,
0x019B,0x019C,0xF8DE,0x019B,0x019D,0x02DC,0x019B,0x019E,0xFBCE,0x019B,0x019F,0x1DE6,0x0199,0x819D,0xEB21,0x0199,
0x819E,0xE42C,0x0199,0x01A0,0x1012,0x019A,0x819D,0xEE18,0x019A,0x819E,0xEA29,0x019A,0x01A0,0x1309,0x019B,0x819D,
0xF91A,0x019B,0x819E,0xF329,0x019B,0x01A0,0x1E0C,0x019A,0x81A0,0x16EC
};