mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
GLK: COMPREHEND: Removal of redundant struct prefixes
This commit is contained in:
parent
5023e261ed
commit
269b83f31e
@ -58,7 +58,7 @@ static const dump_option dump_options[] = {
|
||||
|
||||
#ifdef TODO
|
||||
int main(int argc, char **argv) {
|
||||
struct option long_opts[] = {
|
||||
option long_opts[] = {
|
||||
{"debug", no_argument, 0, 'd'},
|
||||
{"dump", required_argument, 0, 'D'},
|
||||
{"no-play", no_argument, 0, 'p'},
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
static bool word_match(struct word *word, const char *string)
|
||||
static bool word_match(word *word, const char *string)
|
||||
{
|
||||
/* Words less than 6 characters must match exactly */
|
||||
if (strlen(word->_word) < 6 && strlen(string) != strlen(word->_word))
|
||||
@ -52,7 +52,7 @@ word *dict_find_word_by_string(ComprehendGame *game,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct word *dict_find_word_by_index_type(ComprehendGame *game,
|
||||
word *dict_find_word_by_index_type(ComprehendGame *game,
|
||||
uint8 index, uint8 type)
|
||||
{
|
||||
uint i;
|
||||
@ -66,7 +66,7 @@ struct word *dict_find_word_by_index_type(ComprehendGame *game,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct word *find_dict_word_by_index(ComprehendGame *game,
|
||||
word *find_dict_word_by_index(ComprehendGame *game,
|
||||
uint8 index, uint8 type_mask)
|
||||
{
|
||||
uint i;
|
||||
|
@ -29,11 +29,11 @@ namespace Comprehend {
|
||||
class ComprehendGame;
|
||||
struct word;
|
||||
|
||||
struct word *find_dict_word_by_index(ComprehendGame *game,
|
||||
word *find_dict_word_by_index(ComprehendGame *game,
|
||||
uint8 index, uint8 type_mask);
|
||||
struct word *dict_find_word_by_index_type(ComprehendGame *game,
|
||||
word *dict_find_word_by_index_type(ComprehendGame *game,
|
||||
uint8 index, uint8 type);
|
||||
struct word *dict_find_word_by_string(ComprehendGame *game,
|
||||
word *dict_find_word_by_string(ComprehendGame *game,
|
||||
const char *string);
|
||||
bool dict_match_index_type(ComprehendGame *game, const char *word,
|
||||
uint8 index, uint8 type_mask);
|
||||
|
@ -114,8 +114,8 @@ static const char *opcode_names[] = {
|
||||
};
|
||||
|
||||
void dump_instruction(ComprehendGame *game,
|
||||
struct function_state *func_state,
|
||||
struct instruction *instr)
|
||||
function_state *func_state,
|
||||
instruction *instr)
|
||||
{
|
||||
uint i;
|
||||
int str_index, str_table;
|
||||
@ -169,7 +169,7 @@ void dump_instruction(ComprehendGame *game,
|
||||
|
||||
static void dump_functions(ComprehendGame *game)
|
||||
{
|
||||
struct function *func;
|
||||
function *func;
|
||||
uint i, j;
|
||||
|
||||
debugN("Functions (%zd entries)\n", game->_nr_functions);
|
||||
@ -185,8 +185,8 @@ static void dump_functions(ComprehendGame *game)
|
||||
|
||||
static void dump_action_table(ComprehendGame *game)
|
||||
{
|
||||
struct action *action;
|
||||
struct word *word;
|
||||
action *action;
|
||||
word *word;
|
||||
uint i, j;
|
||||
|
||||
debugN("Action table (%zd entries)\n", game->_nr_actions);
|
||||
@ -265,9 +265,9 @@ static void dump_dictionary(ComprehendGame *game)
|
||||
|
||||
static void dump_word_map(ComprehendGame *game)
|
||||
{
|
||||
struct word *word[3];
|
||||
word *word[3];
|
||||
char str[3][6];
|
||||
struct word_map *map;
|
||||
word_map *map;
|
||||
uint i, j;
|
||||
|
||||
debugN("Word pairs (%zd entries)\n", game->_nr_word_maps);
|
||||
@ -292,7 +292,7 @@ static void dump_word_map(ComprehendGame *game)
|
||||
|
||||
static void dump_rooms(ComprehendGame *game)
|
||||
{
|
||||
struct room *room;
|
||||
room *room;
|
||||
uint i;
|
||||
|
||||
/* Room zero acts as the players inventory */
|
||||
@ -319,7 +319,7 @@ static void dump_rooms(ComprehendGame *game)
|
||||
|
||||
static void dump_items(ComprehendGame *game)
|
||||
{
|
||||
struct item *item;
|
||||
item *item;
|
||||
uint i, j;
|
||||
|
||||
debugN("Items (%zd entries)\n", game->_header.nr_items);
|
||||
@ -348,7 +348,7 @@ static void dump_items(ComprehendGame *game)
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_string_table(struct string_table *table)
|
||||
static void dump_string_table(string_table *table)
|
||||
{
|
||||
uint i;
|
||||
|
||||
@ -382,7 +382,7 @@ static void dump_replace_words(ComprehendGame *game)
|
||||
|
||||
static void dump_header(ComprehendGame *game)
|
||||
{
|
||||
struct game_header *header = &game->_header;
|
||||
game_header *header = &game->_header;
|
||||
uint16 *dir_table = header->room_direction_table;
|
||||
|
||||
debugN("Game header:\n");
|
||||
@ -425,7 +425,7 @@ struct dumper {
|
||||
unsigned flag;
|
||||
};
|
||||
|
||||
static struct dumper dumpers[] = {
|
||||
static dumper dumpers[] = {
|
||||
{dump_header, DUMP_HEADER},
|
||||
{dump_game_data_strings, DUMP_STRINGS},
|
||||
{dump_extra_strings, DUMP_EXTRA_STRINGS},
|
||||
|
@ -43,8 +43,8 @@ struct instruction;
|
||||
#define DUMP_ALL (~0U)
|
||||
|
||||
void dump_instruction(ComprehendGame *game,
|
||||
struct function_state *func_state,
|
||||
struct instruction *instr);
|
||||
function_state *func_state,
|
||||
instruction *instr);
|
||||
void dump_game_data(ComprehendGame *game, unsigned flags);
|
||||
|
||||
} // namespace Comprehend
|
||||
|
@ -89,42 +89,14 @@ size_t FileBuffer::strlen(bool *eof) {
|
||||
return end - &_data[_pos];
|
||||
}
|
||||
|
||||
|
||||
#ifdef TODO
|
||||
void file_buf_unmap(struct FileBuffer *fb) {
|
||||
free(fb->marked);
|
||||
free(fb->data);
|
||||
}
|
||||
|
||||
unsigned file_buf_get_pos(struct FileBuffer *fb) {
|
||||
return fb->p - fb->data;
|
||||
}
|
||||
|
||||
void file_buf_get_data(struct FileBuffer *fb, void *data, size_t data_size) {
|
||||
if (fb->pos() + data_size > fb->size)
|
||||
error("Not enough data in file (%x + %x > %x)",
|
||||
fb->pos(), data_size, fb->size);
|
||||
|
||||
if (data)
|
||||
memcpy(data, fb->p, data_size);
|
||||
|
||||
/* Mark this region of the file as read */
|
||||
memset(fb->marked + fb->pos(), '?', data_size);
|
||||
|
||||
fb->p += data_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Debugging function to show regions of a file that have not been read.
|
||||
*/
|
||||
void file_buf_show_unmarked(struct FileBuffer *fb) {
|
||||
void FileBuffer::showUnmarked() {
|
||||
int i, start = -1;
|
||||
|
||||
for (i = 0; i < (int)fb->size; i++) {
|
||||
if (!fb->marked[i] && start == -1)
|
||||
for (i = 0; i < (int)_data.size(); i++) {
|
||||
if (!_readBytes[i] && start == -1)
|
||||
start = i;
|
||||
|
||||
if ((fb->marked[i] || i == (int)fb->size - 1) && start != -1) {
|
||||
if ((_readBytes[i] || i == (int)_data.size() - 1) && start != -1) {
|
||||
warning("%.4x - %.4x unmarked (%d bytes)\n",
|
||||
start, i - 1, i - start);
|
||||
start = -1;
|
||||
@ -132,19 +104,5 @@ void file_buf_show_unmarked(struct FileBuffer *fb) {
|
||||
}
|
||||
}
|
||||
|
||||
void file_buf_put_u8(Common::WriteStream *fd, uint8 val) {
|
||||
fd->writeByte(val);
|
||||
}
|
||||
|
||||
void file_buf_put_le16(Common::WriteStream *fd, uint16 val) {
|
||||
fd->writeUint16LE(val);
|
||||
}
|
||||
|
||||
void file_buf_put_skip(Common::WriteStream *fd, size_t skip) {
|
||||
for (uint i = 0; i < skip; i++)
|
||||
file_buf_put_u8(fd, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Comprehend
|
||||
} // namespace Glk
|
||||
|
@ -53,36 +53,12 @@ public:
|
||||
const byte *dataPtr() const { return &_data[_pos]; }
|
||||
size_t strlen(bool *eof = nullptr);
|
||||
|
||||
/*
|
||||
* Debugging function to show regions of a file that have not been read.
|
||||
*/
|
||||
void showUnmarked();
|
||||
};
|
||||
|
||||
#ifdef TODO
|
||||
void file_buf_unmap(struct FileBuffer *fb);
|
||||
void file_buf_show_unmarked(struct FileBuffer *fb);
|
||||
|
||||
unsigned file_buf_get_pos(struct FileBuffer *fb);
|
||||
|
||||
size_t file_buf_strlen(struct FileBuffer *fb, bool *eof);
|
||||
|
||||
void file_buf_get_data(struct FileBuffer *fb, void *data, size_t data_size);
|
||||
|
||||
void file_buf_put_skip(Common::WriteStream *fd, size_t skip);
|
||||
void file_buf_put_u8(Common::WriteStream *fd, uint8 val);
|
||||
void file_buf_put_le16(Common::WriteStream *fd, uint16 val);
|
||||
|
||||
#define file_buf_put_array(fd, type, base, array, member, size) \
|
||||
do { \
|
||||
int __i; \
|
||||
for (__i = (base); __i < (base) + (size); __i++) \
|
||||
file_buf_put_##type(fd, (array)[__i].member); \
|
||||
} while (0)
|
||||
|
||||
#define file_buf_put_array_le16(fd, base, array, member, size) \
|
||||
file_buf_put_array(fd, le16, base, array, member, size)
|
||||
|
||||
#define file_buf_put_array_u8(fd, base, array, member, size) \
|
||||
file_buf_put_array(fd, u8, base, array, member, size)
|
||||
#endif
|
||||
|
||||
#define file_buf_get_array(fb, type, base, array, member, size) \
|
||||
do { \
|
||||
uint __i; \
|
||||
|
@ -34,14 +34,14 @@ namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
struct sentence {
|
||||
struct word words[4];
|
||||
word words[4];
|
||||
size_t nr_words;
|
||||
};
|
||||
|
||||
struct winsize {
|
||||
uint ws_col;
|
||||
};
|
||||
static struct winsize console_winsize;
|
||||
static winsize console_winsize;
|
||||
|
||||
ComprehendGame::ComprehendGame() : _gameName(nullptr),
|
||||
_shortName(nullptr),
|
||||
@ -157,7 +157,7 @@ void console_println(ComprehendGame *game, const char *text) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static struct room *get_room(ComprehendGame *game, uint16 index) {
|
||||
static room *get_room(ComprehendGame *game, uint16 index) {
|
||||
/* Room zero is reserved for the players inventory */
|
||||
if (index == 0)
|
||||
fatal_error("Room index 0 (player inventory) is invalid");
|
||||
@ -168,7 +168,7 @@ static struct room *get_room(ComprehendGame *game, uint16 index) {
|
||||
return &game->_rooms[index];
|
||||
}
|
||||
|
||||
struct item *get_item(ComprehendGame *game, uint16 index) {
|
||||
item *get_item(ComprehendGame *game, uint16 index) {
|
||||
if (index >= game->_header.nr_items)
|
||||
fatal_error("Bad item %d\n", index);
|
||||
|
||||
@ -225,9 +225,9 @@ void game_restart(ComprehendGame *game) {
|
||||
game->_updateFlags = UPDATE_ALL;
|
||||
}
|
||||
|
||||
static struct word_index *is_word_pair(ComprehendGame *game,
|
||||
struct word *word1, struct word *word2) {
|
||||
struct word_map *map;
|
||||
static word_index *is_word_pair(ComprehendGame *game,
|
||||
word *word1, word *word2) {
|
||||
word_map *map;
|
||||
uint i;
|
||||
|
||||
/* Check if this is a word pair */
|
||||
@ -244,8 +244,8 @@ static struct word_index *is_word_pair(ComprehendGame *game,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct item *get_item_by_noun(ComprehendGame *game,
|
||||
struct word *noun) {
|
||||
static item *get_item_by_noun(ComprehendGame *game,
|
||||
word *noun) {
|
||||
uint i;
|
||||
|
||||
if (!noun || !(noun->_type & WORD_TYPE_NOUN_MASK))
|
||||
@ -264,8 +264,8 @@ static struct item *get_item_by_noun(ComprehendGame *game,
|
||||
}
|
||||
|
||||
static void update_graphics(ComprehendGame *game) {
|
||||
struct item *item;
|
||||
struct room *room;
|
||||
item *item;
|
||||
room *room;
|
||||
int type;
|
||||
uint i;
|
||||
|
||||
@ -308,7 +308,7 @@ static void update_graphics(ComprehendGame *game) {
|
||||
}
|
||||
|
||||
static void describe_objects_in_current_room(ComprehendGame *game) {
|
||||
struct item *item;
|
||||
item *item;
|
||||
size_t count = 0;
|
||||
uint i;
|
||||
|
||||
@ -334,7 +334,7 @@ static void describe_objects_in_current_room(ComprehendGame *game) {
|
||||
}
|
||||
|
||||
static void update(ComprehendGame *game) {
|
||||
struct room *room = get_room(game, game->_currentRoom);
|
||||
room *room = get_room(game, game->_currentRoom);
|
||||
unsigned room_type, room_desc_string;
|
||||
|
||||
update_graphics(game);
|
||||
@ -363,7 +363,7 @@ static void move_to(ComprehendGame *game, uint8 room) {
|
||||
UPDATE_ITEM_LIST);
|
||||
}
|
||||
|
||||
static void func_set_test_result(struct function_state *func_state, bool value) {
|
||||
static void func_set_test_result(function_state *func_state, bool value) {
|
||||
if (func_state->or_count == 0) {
|
||||
/* And */
|
||||
if (func_state->_and) {
|
||||
@ -391,7 +391,7 @@ static size_t num_objects_in_room(ComprehendGame *game, int room) {
|
||||
return count;
|
||||
}
|
||||
|
||||
void move_object(ComprehendGame *game, struct item *item, int new_room) {
|
||||
void move_object(ComprehendGame *game, item *item, int new_room) {
|
||||
unsigned obj_weight = item->flags & ITEMF_WEIGHT_MASK;
|
||||
|
||||
if (item->room == new_room)
|
||||
@ -423,12 +423,12 @@ void move_object(ComprehendGame *game, struct item *item, int new_room) {
|
||||
}
|
||||
|
||||
static void eval_instruction(ComprehendGame *game,
|
||||
struct function_state *func_state,
|
||||
struct instruction *instr,
|
||||
struct word *verb, struct word *noun) {
|
||||
function_state *func_state,
|
||||
instruction *instr,
|
||||
word *verb, word *noun) {
|
||||
uint8 *opcode_map;
|
||||
struct room *room;
|
||||
struct item *item;
|
||||
room *room;
|
||||
item *item;
|
||||
uint16 index;
|
||||
bool test;
|
||||
uint i, count;
|
||||
@ -981,9 +981,9 @@ static void eval_instruction(ComprehendGame *game,
|
||||
* is reached. Otherwise the commands instructions are skipped over and the
|
||||
* next test sequence (if there is one) is tried.
|
||||
*/
|
||||
void eval_function(ComprehendGame *game, struct function *func,
|
||||
struct word *verb, struct word *noun) {
|
||||
struct function_state func_state;
|
||||
void eval_function(ComprehendGame *game, function *func,
|
||||
word *verb, word *noun) {
|
||||
function_state func_state;
|
||||
uint i;
|
||||
|
||||
func_state.else_result = true;
|
||||
@ -1056,9 +1056,9 @@ static void handle_debug_command(ComprehendGame *game,
|
||||
#endif
|
||||
|
||||
static bool handle_sentence(ComprehendGame *game,
|
||||
struct sentence *sentence) {
|
||||
struct function *func;
|
||||
struct action *action;
|
||||
sentence *sentence) {
|
||||
function *func;
|
||||
action *action;
|
||||
uint i, j;
|
||||
|
||||
if (sentence->nr_words == 0)
|
||||
@ -1102,11 +1102,11 @@ static bool handle_sentence(ComprehendGame *game,
|
||||
}
|
||||
|
||||
static void read_sentence(ComprehendGame *game, char **line,
|
||||
struct sentence *sentence) {
|
||||
sentence *sentence) {
|
||||
bool sentence_end = false;
|
||||
char *word_string, *p = *line;
|
||||
struct word_index *pair;
|
||||
struct word *word;
|
||||
word_index *pair;
|
||||
word *word;
|
||||
int index;
|
||||
|
||||
memset(sentence, 0, sizeof(*sentence));
|
||||
@ -1178,7 +1178,7 @@ static void after_turn(ComprehendGame *game) {
|
||||
|
||||
static void read_input(ComprehendGame *game) {
|
||||
#ifdef TODO
|
||||
struct sentence sentence;
|
||||
sentence sentence;
|
||||
char *line = NULL, buffer[1024];
|
||||
bool handled;
|
||||
|
||||
|
@ -69,10 +69,10 @@ public:
|
||||
void console_println(ComprehendGame *game, const char *text);
|
||||
int console_get_key(void);
|
||||
|
||||
struct item *get_item(ComprehendGame *game, uint16 index);
|
||||
void move_object(ComprehendGame *game, struct item *item, int new_room);
|
||||
void eval_function(ComprehendGame *game, struct function *func,
|
||||
struct word *verb, struct word *noun);
|
||||
item *get_item(ComprehendGame *game, uint16 index);
|
||||
void move_object(ComprehendGame *game, item *item, int new_room);
|
||||
void eval_function(ComprehendGame *game, function *func,
|
||||
word *verb, word *noun);
|
||||
|
||||
void comprehend_play_game(ComprehendGame *game);
|
||||
void game_save(ComprehendGame *game);
|
||||
|
@ -26,10 +26,10 @@
|
||||
namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
static struct game_strings cc1_strings = {0x9};
|
||||
static game_strings cc1_strings = {0x9};
|
||||
|
||||
#ifdef TODO
|
||||
static struct game_ops cc2_ops = {
|
||||
static game_ops cc2_ops = {
|
||||
nullptr,
|
||||
cc2_before_prompt,
|
||||
nullptr,
|
||||
|
@ -85,7 +85,7 @@ int OOToposGame::room_is_special(unsigned room_index,
|
||||
bool OOToposGame::before_turn() {
|
||||
/* FIXME - probably doesn't work correctly with restored games */
|
||||
static bool flashlight_was_on = false, googles_were_worn = false;
|
||||
struct room *room = &_rooms[_currentRoom];
|
||||
room *room = &_rooms[_currentRoom];
|
||||
|
||||
/*
|
||||
* Check if the room needs to be redrawn because the flashlight
|
||||
|
@ -36,7 +36,7 @@ const tr_monster TransylvaniaGame::VAMPIRE = {
|
||||
0x26, 5, (1 << 7), 0, 5
|
||||
};
|
||||
|
||||
static struct game_strings tr_strings = {
|
||||
static game_strings tr_strings = {
|
||||
EXTRA_STRING_TABLE(0x8a)
|
||||
};
|
||||
|
||||
@ -65,8 +65,8 @@ TransylvaniaGame::TransylvaniaGame() : ComprehendGame() {
|
||||
};
|
||||
|
||||
void TransylvaniaGame::update_monster(const tr_monster *monster_info) {
|
||||
struct item *monster;
|
||||
struct room *room;
|
||||
item *monster;
|
||||
room *room;
|
||||
uint16 turn_count;
|
||||
|
||||
room = &_rooms[_currentRoom];
|
||||
@ -98,7 +98,7 @@ void TransylvaniaGame::update_monster(const tr_monster *monster_info) {
|
||||
int TransylvaniaGame::room_is_special(unsigned room_index,
|
||||
unsigned *room_desc_string)
|
||||
{
|
||||
struct room *room = &_rooms[room_index];
|
||||
room *room = &_rooms[room_index];
|
||||
|
||||
if (room_index == 0x28) {
|
||||
if (room_desc_string)
|
||||
|
@ -63,7 +63,7 @@ struct graphics_context {
|
||||
// SDL_Surface *surface;
|
||||
};
|
||||
|
||||
static struct graphics_context ctx;
|
||||
static graphics_context ctx;
|
||||
|
||||
unsigned g_set_pen_color(uint8 opcode) {
|
||||
return pen_colors[opcode - IMAGE_OP_PEN_COLOR_A];
|
||||
|
@ -65,7 +65,7 @@ static uint16 image_get_operand(FileBuffer *fb)
|
||||
return val;
|
||||
}
|
||||
|
||||
static bool do_image_op(struct FileBuffer *fb, struct image_context *ctx)
|
||||
static bool do_image_op(FileBuffer *fb, image_context *ctx)
|
||||
{
|
||||
uint8 opcode;
|
||||
uint16 a, b;
|
||||
@ -254,10 +254,10 @@ static bool do_image_op(struct FileBuffer *fb, struct image_context *ctx)
|
||||
return false;
|
||||
}
|
||||
|
||||
void draw_image(struct image_data *info, unsigned index)
|
||||
void draw_image(image_data *info, unsigned index)
|
||||
{
|
||||
unsigned file_num;
|
||||
struct FileBuffer *fb;
|
||||
FileBuffer *fb;
|
||||
bool done = false;
|
||||
image_context ctx = {
|
||||
0, 0, G_COLOR_BLACK, G_COLOR_BLACK, IMAGE_OP_SHAPE_CIRCLE_LARGE
|
||||
@ -294,17 +294,17 @@ void draw_bright_room(void)
|
||||
g_clear_screen(G_COLOR_WHITE);
|
||||
}
|
||||
|
||||
void draw_location_image(struct image_data *info, unsigned index)
|
||||
void draw_location_image(image_data *info, unsigned index)
|
||||
{
|
||||
g_clear_screen(G_COLOR_WHITE);
|
||||
draw_image(info, index);
|
||||
}
|
||||
|
||||
static void load_image_file(struct image_data *info, const char *filename,
|
||||
static void load_image_file(image_data *info, const char *filename,
|
||||
unsigned file_num)
|
||||
{
|
||||
unsigned base = file_num * IMAGES_PER_FILE;
|
||||
struct FileBuffer *fb;
|
||||
FileBuffer *fb;
|
||||
uint16 version;
|
||||
int i;
|
||||
|
||||
@ -329,7 +329,7 @@ static void load_image_file(struct image_data *info, const char *filename,
|
||||
}
|
||||
}
|
||||
|
||||
static void load_image_files(struct image_data *info,
|
||||
static void load_image_files(image_data *info,
|
||||
const Common::Array<const char *> filenames) {
|
||||
uint i;
|
||||
|
||||
@ -344,7 +344,7 @@ static void load_image_files(struct image_data *info,
|
||||
}
|
||||
}
|
||||
|
||||
void comprehend_load_image_file(const char *filename, struct image_data *info)
|
||||
void comprehend_load_image_file(const char *filename, image_data *info)
|
||||
{
|
||||
Common::Array<const char *> filenames;
|
||||
filenames.push_back(filename);
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char **argv)
|
||||
{NULL, 0, 0, 0},
|
||||
};
|
||||
const char *short_opts = "w:h:c:t:spfd?";
|
||||
struct image_data info;
|
||||
image_data info;
|
||||
const char *filename;
|
||||
unsigned index, clear_color = G_COLOR_WHITE,
|
||||
graphics_width = G_RENDER_WIDTH,
|
||||
|
@ -1,201 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "glk/comprehend/comprehend.h"
|
||||
#include "glk/comprehend/dump_game_data.h"
|
||||
#include "glk/comprehend/game_data.h"
|
||||
#include "glk/comprehend/graphics.h"
|
||||
#include "glk/comprehend/game.h"
|
||||
#include "glk/comprehend/util.h"
|
||||
|
||||
namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
extern ComprehendGame game_transylvania;
|
||||
extern ComprehendGame game_crimson_crown_1;
|
||||
extern ComprehendGame game_crimson_crown_2;
|
||||
extern ComprehendGame game_oo_topos;
|
||||
extern ComprehendGame game_talisman;
|
||||
|
||||
static ComprehendGame *ComprehendGames[] = {
|
||||
&game_transylvania,
|
||||
&game_crimson_crown_1,
|
||||
&game_crimson_crown_2,
|
||||
&game_oo_topos,
|
||||
&game_talisman,
|
||||
};
|
||||
|
||||
struct dump_option {
|
||||
const char *option;
|
||||
unsigned flag;
|
||||
};
|
||||
|
||||
static struct dump_option dump_options[] = {
|
||||
{"strings", DUMP_STRINGS},
|
||||
{"extra-strings", DUMP_EXTRA_STRINGS},
|
||||
{"rooms", DUMP_ROOMS},
|
||||
{"items", DUMP_ITEMS},
|
||||
{"dictionary", DUMP_DICTIONARY},
|
||||
{"word-pairs", DUMP_WORD_PAIRS},
|
||||
{"actions", DUMP_ACTIONS},
|
||||
{"functions", DUMP_FUNCTIONS},
|
||||
{"replace-words", DUMP_REPLACE_WORDS},
|
||||
{"header", DUMP_HEADER},
|
||||
{"all", DUMP_ALL},
|
||||
};
|
||||
|
||||
static void usage(const char *progname)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Usage %s [OPTION]... GAME_NAME GAME_DIR\n", progname);
|
||||
printf("\nOptions:\n");
|
||||
printf(" -d, --debug Enable debugging\n");
|
||||
printf(" -D, --dump=OPTION Dump game data\n");
|
||||
for (i = 0; i < ARRAY_SIZE(dump_options); i++)
|
||||
printf(" %s\n", dump_options[i].option);
|
||||
printf(" -p, --no-play Don't run the interpreter\n");
|
||||
printf(" -g, --no-graphics Disable graphics\n");
|
||||
printf(" -f, --no-floodfill Disable floodfill\n");
|
||||
printf(" -w, --graphics-width=WIDTH Graphics width\n");
|
||||
printf(" -h, --graphics-height=HEIGHT Graphics height\n");
|
||||
|
||||
printf("\nSupported games:\n");
|
||||
for (i = 0; i < ARRAY_SIZE(ComprehendGames); i++)
|
||||
printf(" %-10s %s\n", ComprehendGames[i]->short_name,
|
||||
ComprehendGames[i]->game_name);
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct option long_opts[] = {
|
||||
{"debug", no_argument, 0, 'd'},
|
||||
{"dump", required_argument, 0, 'D'},
|
||||
{"no-play", no_argument, 0, 'p'},
|
||||
{"no-graphics", no_argument, 0, 'g'},
|
||||
{"no-floodfill", no_argument, 0, 'f'},
|
||||
{"graphics-width", required_argument, 0, 'w'},
|
||||
{"graphics-height", required_argument, 0, 'h'},
|
||||
{"help", no_argument, 0, '?'},
|
||||
{NULL, 0, 0, 0},
|
||||
};
|
||||
const char *short_opts = "dD:pgfw:h:?";
|
||||
ComprehendGame *game;
|
||||
const char *game_name, *game_dir;
|
||||
unsigned dump_flags = 0;
|
||||
int i, c, opt_index;
|
||||
unsigned graphics_width = G_RENDER_WIDTH,
|
||||
graphics_height = G_RENDER_HEIGHT;
|
||||
bool play_game = true, graphics_enabled = true;
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, short_opts, long_opts, &opt_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
case 'd':
|
||||
// FIXME
|
||||
debug_enable(DEBUG_FUNCTIONS);
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
for (i = 0; i < ARRAY_SIZE(dump_options); i++)
|
||||
if (strcmp(optarg, dump_options[i].option) == 0)
|
||||
break;
|
||||
if (i == ARRAY_SIZE(dump_options)) {
|
||||
printf("Invalid dump option '%s'\n", optarg);
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
dump_flags |= dump_options[i].flag;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
play_game = false;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
graphics_enabled = false;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
image_set_draw_flags(IMAGEF_NO_FLOODFILL);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
graphics_width = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
graphics_height = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
usage(argv[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Invalid option\n");
|
||||
usage(argv[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind >= argc || argc - optind != 2)
|
||||
usage(argv[0]);
|
||||
|
||||
game_name = argv[optind++];
|
||||
game_dir = argv[optind++];
|
||||
|
||||
/* Lookup game */
|
||||
game = NULL;
|
||||
for (i = 0; i < ARRAY_SIZE(ComprehendGames); i++) {
|
||||
if (strcmp(game_name, ComprehendGames[i]->short_name) == 0) {
|
||||
game = ComprehendGames[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!game) {
|
||||
printf("Unknown game '%s'\n", game_name);
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
if (graphics_enabled)
|
||||
g_init(graphics_width, graphics_height);
|
||||
|
||||
game->info = xmalloc(sizeof(*game->info));
|
||||
comprehend_load_game(game, game_dir);
|
||||
|
||||
if (dump_flags)
|
||||
dump_game_data(game, dump_flags);
|
||||
|
||||
if (play_game)
|
||||
comprehend_play_game(game);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
} // namespace Comprehend
|
||||
} // namespace Glk
|
@ -1,32 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GLK_COMPREHEND_RECOMPREHEND_H
|
||||
#define GLK_COMPREHEND_RECOMPREHEND_H
|
||||
|
||||
namespace Glk {
|
||||
namespace Comprehend {
|
||||
|
||||
} // namespace Comprehend
|
||||
} // namespace Glk
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user