diff --git a/engines/glk/adrift/scobjcts.cpp b/engines/glk/adrift/scobjcts.cpp index 1c94874f60b..66c2e1e4ed7 100644 --- a/engines/glk/adrift/scobjcts.cpp +++ b/engines/glk/adrift/scobjcts.cpp @@ -757,15 +757,15 @@ static sc_bool obj_indirectly_in_room_internal(sc_gameref_t game, sc_int object, } } -sc_bool obj_indirectly_in_room(sc_gameref_t game, sc_int object, sc_int room) { +sc_bool obj_indirectly_in_room(sc_gameref_t game, sc_int object, sc_int Room) { sc_bool result; /* Check, trace result, and return. */ - result = obj_indirectly_in_room_internal(game, object, room); + result = obj_indirectly_in_room_internal(game, object, Room); if (obj_trace) { sc_trace("Object: checking for object %ld indirectly in room %ld, %s\n", - object, room, result ? "true" : "false"); + object, Room, result ? "true" : "false"); } return result; diff --git a/engines/glk/adrift/scprotos.h b/engines/glk/adrift/scprotos.h index 6b8a6f38450..efd7bb2ed39 100644 --- a/engines/glk/adrift/scprotos.h +++ b/engines/glk/adrift/scprotos.h @@ -91,7 +91,7 @@ extern sc_bool sc_strempty(const sc_char *string); extern sc_char *sc_trim_string(sc_char *string); extern sc_char *sc_normalize_string(sc_char *string); extern sc_bool sc_compare_word(const sc_char *string, - const sc_char *word, sc_int length); + const sc_char *Word, sc_int length); extern sc_uint sc_hash(const sc_char *string); /* TAF file reader/decompressor enumerations, opaque typedef and functions. */ @@ -281,7 +281,7 @@ extern void gs_copy(sc_gameref_t to, sc_gameref_t from); extern void gs_destroy(sc_gameref_t game); /* Game state accessors and mutators. */ -extern void gs_move_player_to_room(sc_gameref_t game, sc_int room); +extern void gs_move_player_to_room(sc_gameref_t game, sc_int Room); extern sc_bool gs_player_in_room(sc_gameref_t game, sc_int room); extern sc_var_setref_t gs_get_vars(sc_gameref_t gs); extern sc_prop_setref_t gs_get_bundle(sc_gameref_t gs); @@ -300,8 +300,8 @@ extern sc_int gs_event_state(sc_gameref_t gs, sc_int event); extern sc_int gs_event_time(sc_gameref_t gs, sc_int event); extern void gs_decrement_event_time(sc_gameref_t gs, sc_int event); extern sc_int gs_room_count(sc_gameref_t gs); -extern void gs_set_room_seen(sc_gameref_t gs, sc_int room, sc_bool seen); -extern sc_bool gs_room_seen(sc_gameref_t gs, sc_int room); +extern void gs_set_room_seen(sc_gameref_t gs, sc_int Room, sc_bool seen); +extern sc_bool gs_room_seen(sc_gameref_t gs, sc_int Room); extern sc_int gs_task_count(sc_gameref_t gs); extern void gs_set_task_done(sc_gameref_t gs, sc_int task, sc_bool done); extern void gs_set_task_scored(sc_gameref_t gs, sc_int task, sc_bool scored); @@ -367,9 +367,9 @@ enum { extern void lib_warn_battle_system(void); extern sc_int lib_random_roomgroup_member(sc_gameref_t game, sc_int roomgroup); -extern const sc_char *lib_get_room_name(sc_gameref_t game, sc_int room); -extern void lib_print_room_name(sc_gameref_t game, sc_int room); -extern void lib_print_room_description(sc_gameref_t game, sc_int room); +extern const sc_char *lib_get_room_name(sc_gameref_t game, sc_int Room); +extern void lib_print_room_name(sc_gameref_t game, sc_int Room); +extern void lib_print_room_description(sc_gameref_t game, sc_int Room); extern sc_bool lib_cmd_go_north(sc_gameref_t game); extern sc_bool lib_cmd_go_east(sc_gameref_t game); extern sc_bool lib_cmd_go_south(sc_gameref_t game); @@ -690,8 +690,8 @@ enum { NPC_NEUTER = 2 }; -extern sc_bool npc_in_room(sc_gameref_t game, sc_int npc, sc_int room); -extern sc_int npc_count_in_room(sc_gameref_t game, sc_int room); +extern sc_bool npc_in_room(sc_gameref_t game, sc_int npc, sc_int Room); +extern sc_int npc_count_in_room(sc_gameref_t game, sc_int Room); extern void npc_setup_initial(sc_gameref_t game); extern void npc_start_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk); extern void npc_tick_npcs(sc_gameref_t game); @@ -712,10 +712,10 @@ extern sc_bool obj_is_surface(sc_gameref_t game, sc_int object); extern sc_int obj_container_object(sc_gameref_t game, sc_int n); extern sc_int obj_surface_object(sc_gameref_t game, sc_int n); extern sc_bool obj_indirectly_in_room(sc_gameref_t game, - sc_int object, sc_int room); + sc_int object, sc_int Room); extern sc_bool obj_indirectly_held_by_player(sc_gameref_t game, sc_int object); extern sc_bool obj_directly_in_room(sc_gameref_t game, - sc_int object, sc_int room); + sc_int object, sc_int Room); extern sc_int obj_stateful_object(sc_gameref_t game, sc_int n); extern sc_int obj_dynamic_object(sc_gameref_t game, sc_int n); extern sc_int obj_wearable_object(sc_gameref_t game, sc_int n); diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp index 3ca90b7b282..6b0c68507b2 100644 --- a/engines/glk/comprehend/comprehend.cpp +++ b/engines/glk/comprehend/comprehend.cpp @@ -37,12 +37,12 @@ namespace Comprehend { Comprehend *g_comprehend; -struct dump_option { +struct DumpOption { const char *const option; unsigned flag; }; -static const dump_option dump_options[] = { +static const DumpOption dump_options[] = { {"strings", DUMP_STRINGS}, {"extra-strings", DUMP_EXTRA_STRINGS}, {"rooms", DUMP_ROOMS}, diff --git a/engines/glk/comprehend/comprehend.h b/engines/glk/comprehend/comprehend.h index d77f5491828..c961438d727 100644 --- a/engines/glk/comprehend/comprehend.h +++ b/engines/glk/comprehend/comprehend.h @@ -40,11 +40,11 @@ namespace Comprehend { #define PATH_MAX 256 struct GameInfo; -struct game_state; +struct gameState; #define EXTRA_STRING_TABLE(x) (0x8200 | (x)) -struct game_strings { +struct GameStrings { uint16 game_restart; }; diff --git a/engines/glk/comprehend/dictionary.cpp b/engines/glk/comprehend/dictionary.cpp index 2f6e4cf0257..70959a889e0 100644 --- a/engines/glk/comprehend/dictionary.cpp +++ b/engines/glk/comprehend/dictionary.cpp @@ -28,7 +28,7 @@ namespace Glk { namespace Comprehend { -static bool word_match(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)) @@ -37,7 +37,7 @@ static bool word_match(word *word, const char *string) return strncmp(word->_word, string, strlen(word->_word)) == 0; } -word *dict_find_word_by_string(ComprehendGame *game, +Word *dict_find_word_by_string(ComprehendGame *game, const char *string) { uint i; @@ -52,7 +52,7 @@ word *dict_find_word_by_string(ComprehendGame *game, return NULL; } -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 @@ word *dict_find_word_by_index_type(ComprehendGame *game, return NULL; } -word *find_dict_word_by_index(ComprehendGame *game, +Word *find_dict_word_by_index(ComprehendGame *game, uint8 index, uint8 type_mask) { uint i; diff --git a/engines/glk/comprehend/dictionary.h b/engines/glk/comprehend/dictionary.h index f6855138111..ed8fb569082 100644 --- a/engines/glk/comprehend/dictionary.h +++ b/engines/glk/comprehend/dictionary.h @@ -27,13 +27,13 @@ namespace Glk { namespace Comprehend { class ComprehendGame; -struct word; +struct Word; -word *find_dict_word_by_index(ComprehendGame *game, +Word *find_dict_word_by_index(ComprehendGame *game, uint8 index, uint8 type_mask); -word *dict_find_word_by_index_type(ComprehendGame *game, +Word *dict_find_word_by_index_type(ComprehendGame *game, uint8 index, uint8 type); -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); diff --git a/engines/glk/comprehend/dump_game_data.cpp b/engines/glk/comprehend/dump_game_data.cpp index bd99a5d4f3e..bef4f9ef0a2 100644 --- a/engines/glk/comprehend/dump_game_data.cpp +++ b/engines/glk/comprehend/dump_game_data.cpp @@ -114,8 +114,8 @@ static const char *opcode_names[] = { }; void dump_instruction(ComprehendGame *game, - function_state *func_state, - instruction *instr) + FunctionState *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) { - 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) { - action *action; - word *word; + Action *action; + Word *word; uint i, j; debugN("Action table (%zd entries)\n", game->_nr_actions); @@ -231,7 +231,7 @@ static void dump_action_table(ComprehendGame *game) static int word_index_compare(const void *a, const void *b) { - const word *word_a = (const word *)a, *word_b = (const word *)b; + const Word *word_a = (const Word *)a, *word_b = (const Word *)b; if (word_a->_index > word_b->_index) return 1; @@ -242,12 +242,12 @@ static int word_index_compare(const void *a, const void *b) static void dump_dictionary(ComprehendGame *game) { - word *dictionary; - word *words; + Word *dictionary; + Word *words; uint i; /* Sort the dictionary by index */ - dictionary = (word *)xmalloc(sizeof(*words) * game->_nr_words); + dictionary = (Word *)xmalloc(sizeof(*words) * game->_nr_words); memcpy(dictionary, game->_words, sizeof(*words) * game->_nr_words); qsort(dictionary, game->_nr_words, sizeof(*words), @@ -265,9 +265,9 @@ static void dump_dictionary(ComprehendGame *game) static void dump_word_map(ComprehendGame *game) { - word *word[3]; + Word *word[3]; char str[3][6]; - word_map *map; + WordMap *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) { - 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) { - 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(string_table *table) +static void dump_string_table(StringTable *table) { uint i; @@ -382,7 +382,7 @@ static void dump_replace_words(ComprehendGame *game) static void dump_header(ComprehendGame *game) { - game_header *header = &game->_header; + GameHeader *header = &game->_header; uint16 *dir_table = header->room_direction_table; debugN("Game header:\n"); @@ -420,12 +420,12 @@ static void dump_header(ComprehendGame *game) typedef void (*dump_func_t)(ComprehendGame *game); -struct dumper { +struct Dumper { dump_func_t dump_func; unsigned flag; }; -static dumper dumpers[] = { +static Dumper dumpers[] = { {dump_header, DUMP_HEADER}, {dump_game_data_strings, DUMP_STRINGS}, {dump_extra_strings, DUMP_EXTRA_STRINGS}, diff --git a/engines/glk/comprehend/dump_game_data.h b/engines/glk/comprehend/dump_game_data.h index 06c6609e6c3..311ff2b139b 100644 --- a/engines/glk/comprehend/dump_game_data.h +++ b/engines/glk/comprehend/dump_game_data.h @@ -27,8 +27,8 @@ namespace Glk { namespace Comprehend { class ComprehendGame; -struct function_state; -struct instruction; +struct FunctionState; +struct Instruction; #define DUMP_STRINGS (1 << 0) #define DUMP_EXTRA_STRINGS (1 << 1) @@ -43,8 +43,8 @@ struct instruction; #define DUMP_ALL (~0U) void dump_instruction(ComprehendGame *game, - function_state *func_state, - instruction *instr); + FunctionState *func_state, + Instruction *instr); void dump_game_data(ComprehendGame *game, unsigned flags); } // namespace Comprehend diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp index a41842497ed..20226563645 100644 --- a/engines/glk/comprehend/game.cpp +++ b/engines/glk/comprehend/game.cpp @@ -33,15 +33,15 @@ namespace Glk { namespace Comprehend { -struct sentence { - word words[4]; +struct Sentence { + Word words[4]; size_t nr_words; }; -struct winsize { +struct WinSize { uint ws_col; }; -static 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 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 room *get_room(ComprehendGame *game, uint16 index) { return &game->_rooms[index]; } -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 word_index *is_word_pair(ComprehendGame *game, - word *word1, word *word2) { - word_map *map; +static WordIndex *is_word_pair(ComprehendGame *game, + Word *word1, Word *word2) { + WordMap *map; uint i; /* Check if this is a word pair */ @@ -244,8 +244,8 @@ static word_index *is_word_pair(ComprehendGame *game, return NULL; } -static item *get_item_by_noun(ComprehendGame *game, - 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 item *get_item_by_noun(ComprehendGame *game, } static void update_graphics(ComprehendGame *game) { - item *item; - 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) { - 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) { - 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(function_state *func_state, bool value) { +static void func_set_test_result(FunctionState *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, 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, item *item, int new_room) { } static void eval_instruction(ComprehendGame *game, - function_state *func_state, - instruction *instr, - word *verb, word *noun) { + FunctionState *func_state, + Instruction *instr, + Word *verb, Word *noun) { uint8 *opcode_map; - room *room; - item *item; + Room *room; + Item *item; uint16 index; bool test; uint i, count; @@ -615,7 +615,7 @@ static void eval_instruction(ComprehendGame *game, if (noun) { for (i = 0; i < game->_header.nr_items; i++) { - struct item *itemP = &game->_items[i]; + Item *itemP = &game->_items[i]; if (itemP->word == noun->_index && itemP->room == instr->operand[0]) { @@ -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, function *func, - word *verb, word *noun) { - function_state func_state; +void eval_function(ComprehendGame *game, Function *func, + Word *verb, Word *noun) { + FunctionState 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, - sentence *sentence) { - function *func; - 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, - sentence *sentence) { + Sentence *sentence) { bool sentence_end = false; char *word_string, *p = *line; - word_index *pair; - word *word; + WordIndex *pair; + Word *word; int index; memset(sentence, 0, sizeof(*sentence)); diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h index 583f333f53a..ce4689a32a3 100644 --- a/engines/glk/comprehend/game.h +++ b/engines/glk/comprehend/game.h @@ -39,13 +39,13 @@ public: const char *_shortName; const char *_gameDataFile; - Common::Array _stringFiles; + Common::Array _stringFiles; Common::Array _locationGraphicFiles; Common::Array _itemGraphicFiles; const char *_savegameFileFormat; unsigned _colorTable; - struct game_strings *_gameStrings; + struct GameStrings *_gameStrings; public: ComprehendGame(); @@ -69,10 +69,10 @@ public: void console_println(ComprehendGame *game, const char *text); int console_get_key(void); -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); +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); diff --git a/engines/glk/comprehend/game_cc.cpp b/engines/glk/comprehend/game_cc.cpp index 4b1a5feab7a..da416aa32dd 100644 --- a/engines/glk/comprehend/game_cc.cpp +++ b/engines/glk/comprehend/game_cc.cpp @@ -26,7 +26,7 @@ namespace Glk { namespace Comprehend { -static game_strings cc1_strings = {0x9}; +static GameStrings cc1_strings = {0x9}; #ifdef TODO static game_ops cc2_ops = { @@ -43,7 +43,7 @@ CrimsonCrownGame::CrimsonCrownGame() : ComprehendGame() { _shortName = "cc1"; _gameDataFile = "cc1.gda"; - _stringFiles.push_back(string_file("ma.ms1", 0x89)); + _stringFiles.push_back(StringFile("ma.ms1", 0x89)); _locationGraphicFiles.push_back("RA.MS1"); _locationGraphicFiles.push_back("RB.MS1"); _locationGraphicFiles.push_back("RC.MS1"); diff --git a/engines/glk/comprehend/game_data.cpp b/engines/glk/comprehend/game_data.cpp index c28813e19f2..db9d1d6eecc 100644 --- a/engines/glk/comprehend/game_data.cpp +++ b/engines/glk/comprehend/game_data.cpp @@ -38,7 +38,7 @@ static char special_charset[] = "[]\n!\"#$%&'(),-/0123456789:;?<>"; static uint16 magic_offset; -void function_state::clear() { +void FunctionState::clear() { test_result = true; else_result = false; or_count = 0; @@ -49,7 +49,7 @@ void function_state::clear() { /*-------------------------------------------------------*/ -void room::clear() { +void Room::clear() { flags = 0; graphic = 0; string_desc = 0; @@ -58,7 +58,7 @@ void room::clear() { /*-------------------------------------------------------*/ -void item::clear() { +void Item::clear() { string_desc = 0; long_string = 0; room = 0; @@ -69,7 +69,7 @@ void item::clear() { /*-------------------------------------------------------*/ -void word::clear() { +void Word::clear() { _index = 0; _type = 0; Common::fill(&_word[0], &_word[7], '\0'); @@ -77,7 +77,7 @@ void word::clear() { /*-------------------------------------------------------*/ -void word_map::clear() { +void WordMap::clear() { flags = 0; for (int idx = 0; idx < 3; ++idx) word[idx].clear(); @@ -85,7 +85,7 @@ void word_map::clear() { /*-------------------------------------------------------*/ -void action::clear() { +void Action::clear() { type = 0; nr_words = 0; function = 0; @@ -95,7 +95,7 @@ void action::clear() { /*-------------------------------------------------------*/ -void instruction::clear() { +void Instruction::clear() { opcode = 0; nr_operands = 0; is_command= false; @@ -104,7 +104,7 @@ void instruction::clear() { /*-------------------------------------------------------*/ -void function::clear() { +void Function::clear() { nr_instructions = 0; for (int idx = 0; idx < 0x100; ++idx) instructions[idx].clear(); @@ -112,14 +112,14 @@ void function::clear() { /*-------------------------------------------------------*/ -void string_table::clear() { +void StringTable::clear() { nr_strings = 0; Common::fill(&strings[0], &strings[0xffff], nullptr); } /*-------------------------------------------------------*/ -void game_header::clear() { +void GameHeader::clear() { magic = 0; room_desc_table = 0; room_flags_table = 0; @@ -199,7 +199,7 @@ static bool opcode_is_command(uint8 opcode) { } static uint8 parse_vm_instruction(FileBuffer *fb, - instruction *instr) { + Instruction *instr) { uint i; /* Get the opcode */ @@ -215,8 +215,8 @@ static uint8 parse_vm_instruction(FileBuffer *fb, return instr->opcode; } -static void parse_function(FileBuffer *fb, function * func) { - instruction *instruction; +static void parse_function(FileBuffer *fb, Function * func) { + Instruction *instruction; uint8 *p, opcode; p = (uint8 *)memchr(fb->dataPtr(), 0x00, fb->size() - fb->pos()); @@ -237,7 +237,7 @@ static void parse_function(FileBuffer *fb, function * func) { } static void parse_vm(ComprehendGame *game, FileBuffer *fb) { - function *func; + Function *func; fb->seek(game->_header.addr_vm); while (1) { @@ -253,7 +253,7 @@ static void parse_vm(ComprehendGame *game, FileBuffer *fb) { static void parse_action_table_vvnn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 verb, count; int i, j; @@ -297,7 +297,7 @@ static void parse_action_table_vvnn(ComprehendGame *game, static void parse_action_table_vnjn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 join, count; int i; @@ -342,7 +342,7 @@ static void parse_action_table_vnjn(ComprehendGame *game, static void parse_action_table_vjn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 join, count; int i; @@ -383,7 +383,7 @@ static void parse_action_table_vjn(ComprehendGame *game, static void parse_action_table_vdn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 verb, count; int i; @@ -424,7 +424,7 @@ static void parse_action_table_vdn(ComprehendGame *game, static void parse_action_table_vnn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 verb, count; int i; @@ -466,7 +466,7 @@ static void parse_action_table_vnn(ComprehendGame *game, static void parse_action_table_vn(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 verb, count; int i; @@ -505,7 +505,7 @@ static void parse_action_table_vn(ComprehendGame *game, static void parse_action_table_v(ComprehendGame *game, FileBuffer *fb, size_t * index) { - action *action; + Action *action; uint8 verb, nr_funcs; uint16 func; int i; @@ -565,11 +565,11 @@ static void parse_action_table(ComprehendGame *game, } static void parse_dictionary(ComprehendGame *game, FileBuffer *fb) { - word *words; + Word *words; uint i, j; // FIXME - fixed size 0xff array? - game->_words = (word *)xmalloc(game->_nr_words * sizeof(words)); + game->_words = (Word *)xmalloc(game->_nr_words * sizeof(words)); fb->seek(game->_header.addr_dictionary); for (i = 0; i < game->_nr_words; i++) { @@ -588,7 +588,7 @@ static void parse_dictionary(ComprehendGame *game, FileBuffer *fb) { } static void parse_word_map(ComprehendGame *game, FileBuffer *fb) { - word_map *map; + WordMap *map; uint8 index, type, dummy; uint i; @@ -788,7 +788,7 @@ done: } static void parse_string_table(FileBuffer *fb, unsigned start_addr, - uint32 end_addr, string_table *table) { + uint32 end_addr, StringTable *table) { fb->seek(start_addr); while (1) { table->strings[table->nr_strings++] = parse_string(fb); @@ -848,7 +848,7 @@ static void parse_replace_words(ComprehendGame *game, * game data is. The offsets have a magic constant value added to them. */ static void parse_header(ComprehendGame *game, FileBuffer *fb) { - game_header *header = &game->_header; + GameHeader *header = &game->_header; uint16 dummy, addr_dictionary_end; uint8 dummy8; @@ -966,7 +966,7 @@ static void parse_header(ComprehendGame *game, FileBuffer *fb) { } static void load_extra_string_file(ComprehendGame *game, - string_file * string_file) { + StringFile * string_file) { FileBuffer fb(string_file->filename); unsigned end; diff --git a/engines/glk/comprehend/game_data.h b/engines/glk/comprehend/game_data.h index 2e243198f16..95c4c6a0286 100644 --- a/engines/glk/comprehend/game_data.h +++ b/engines/glk/comprehend/game_data.h @@ -43,7 +43,7 @@ enum { NR_DIRECTIONS, }; -struct function_state { +struct FunctionState { bool test_result; bool else_result; unsigned or_count; @@ -51,27 +51,27 @@ struct function_state { bool in_command; bool executed; - function_state() { + FunctionState() { clear(); } void clear(); }; -struct room { +struct Room { uint8 direction[NR_DIRECTIONS]; uint8 flags; uint8 graphic; uint16 string_desc; - room() { + Room() { clear(); } void clear(); }; -struct item { +struct Item { uint16 string_desc; uint16 long_string; /* Only used by version 2 */ uint8 room; @@ -79,30 +79,30 @@ struct item { uint8 word; uint8 graphic; - item() { + Item() { clear(); } void clear(); }; -struct word { +struct Word { char _word[7]; uint8 _index; uint8 _type; - word() { + Word() { clear(); } void clear(); }; -struct word_index { +struct WordIndex { uint8 index; uint8 type; - word_index() { + WordIndex() { clear(); } @@ -111,19 +111,19 @@ struct word_index { } }; -struct word_map { +struct WordMap { /* , == */ - word_index word[3]; + WordIndex word[3]; uint8 flags; - word_map() { + WordMap() { clear(); } void clear(); }; -struct action { +struct Action { int type; size_t nr_words; // FIXME - use struct word_index here. @@ -131,49 +131,49 @@ struct action { uint8 word_type[4]; uint16 function; - action() { + Action() { clear(); } void clear(); }; -struct instruction { +struct Instruction { uint8 opcode; size_t nr_operands; uint8 operand[3]; bool is_command; - instruction() { + Instruction() { clear(); } void clear(); }; -struct function { - instruction instructions[0x100]; +struct Function { + Instruction instructions[0x100]; size_t nr_instructions; - function() { + Function() { clear(); } void clear(); }; -struct string_table { +struct StringTable { char *strings[0xffff]; size_t nr_strings; - string_table() { + StringTable() { clear(); } void clear(); }; -struct game_header { +struct GameHeader { uint16 magic; uint16 room_desc_table; @@ -205,7 +205,7 @@ struct game_header { uint16 addr_vm; // FIXME - functions - game_header() { + GameHeader() { clear(); } @@ -213,35 +213,35 @@ struct game_header { }; struct GameInfo { - game_header _header; + GameHeader _header; unsigned _comprehendVersion; uint8 _startRoom; - room _rooms[0x100]; + Room _rooms[0x100]; size_t _nr_rooms; uint8 _currentRoom; - struct item _items[0xff]; + struct Item _items[0xff]; - struct word *_words; + struct Word *_words; size_t _nr_words; - struct word_map _wordMaps[0xff]; + struct WordMap _wordMaps[0xff]; size_t _nr_word_maps; - struct string_table _strings; - struct string_table _strings2; + struct StringTable _strings; + struct StringTable _strings2; - struct action _actions[0xffff]; + struct Action _actions[0xffff]; size_t _nr_actions; - struct function _functions[0xffff]; + struct Function _functions[0xffff]; size_t _nr_functions; - struct image_data _roomImages; - struct image_data _itemImages; + struct ImageData _roomImages; + struct ImageData _itemImages; bool _flags[MAX_FLAGS]; uint16 _variables[MAX_VARIABLES]; @@ -259,13 +259,13 @@ struct GameInfo { void clearInfo(); }; -struct string_file { +struct StringFile { const char *filename; uint32 base_offset; uint32 end_offset; - string_file() : filename(nullptr), base_offset(0), end_offset(0) {} - string_file(const char *fname, uint32 baseOfs, uint32 endO = 0) : filename(fname), base_offset(baseOfs), end_offset(endO) { + StringFile() : filename(nullptr), base_offset(0), end_offset(0) {} + StringFile(const char *fname, uint32 baseOfs, uint32 endO = 0) : filename(fname), base_offset(baseOfs), end_offset(endO) { } }; diff --git a/engines/glk/comprehend/game_oo.cpp b/engines/glk/comprehend/game_oo.cpp index b1faa9c705c..124f8d6e08a 100644 --- a/engines/glk/comprehend/game_oo.cpp +++ b/engines/glk/comprehend/game_oo.cpp @@ -40,11 +40,11 @@ OOToposGame::OOToposGame() : ComprehendGame() { _gameDataFile = "g0"; // Extra strings are (annoyingly) stored in the game binary - _stringFiles.push_back(string_file("NOVEL.EXE", 0x16564, 0x17640)); - _stringFiles.push_back(string_file("NOVEL.EXE", 0x17702, 0x18600)); - _stringFiles.push_back(string_file("NOVEL.EXE", 0x186b2, 0x19b80)); - _stringFiles.push_back(string_file("NOVEL.EXE", 0x19c62, 0x1a590)); - _stringFiles.push_back(string_file("NOVEL.EXE", 0x1a634, 0x1b080)); + _stringFiles.push_back(StringFile("NOVEL.EXE", 0x16564, 0x17640)); + _stringFiles.push_back(StringFile("NOVEL.EXE", 0x17702, 0x18600)); + _stringFiles.push_back(StringFile("NOVEL.EXE", 0x186b2, 0x19b80)); + _stringFiles.push_back(StringFile("NOVEL.EXE", 0x19c62, 0x1a590)); + _stringFiles.push_back(StringFile("NOVEL.EXE", 0x1a634, 0x1b080)); _locationGraphicFiles.push_back("RA"); _locationGraphicFiles.push_back("RB"); _locationGraphicFiles.push_back("RC"); @@ -61,7 +61,7 @@ OOToposGame::OOToposGame() : ComprehendGame() { int OOToposGame::room_is_special(unsigned room_index, unsigned *room_desc_string) { - room *room = &_rooms[room_index]; + Room *room = &_rooms[room_index]; /* Is the room dark */ if ((room->flags & OO_ROOM_FLAG_DARK) && @@ -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; - room *room = &_rooms[_currentRoom]; + Room *room = &_rooms[_currentRoom]; /* * Check if the room needs to be redrawn because the flashlight diff --git a/engines/glk/comprehend/game_tr.cpp b/engines/glk/comprehend/game_tr.cpp index 041b4dfef07..66a9a890b32 100644 --- a/engines/glk/comprehend/game_tr.cpp +++ b/engines/glk/comprehend/game_tr.cpp @@ -28,15 +28,15 @@ namespace Glk { namespace Comprehend { -const tr_monster TransylvaniaGame::WEREWOLF = { +const TransylvaniaMonster TransylvaniaGame::WEREWOLF = { 0x21, 7, (1 << 6), 5, 5 }; -const tr_monster TransylvaniaGame::VAMPIRE = { +const TransylvaniaMonster TransylvaniaGame::VAMPIRE = { 0x26, 5, (1 << 7), 0, 5 }; -static game_strings tr_strings = { +static GameStrings tr_strings = { EXTRA_STRING_TABLE(0x8a) }; @@ -46,11 +46,11 @@ TransylvaniaGame::TransylvaniaGame() : ComprehendGame() { _shortName = "tr"; _gameDataFile = "tr.gda"; - _stringFiles.push_back(string_file("MA.MS1", 0x88)); - _stringFiles.push_back(string_file("MB.MS1", 0x88)); - _stringFiles.push_back(string_file("MC.MS1", 0x88)); - _stringFiles.push_back(string_file("MD.MS1", 0x88)); - _stringFiles.push_back(string_file("ME.MS1", 0x88)); + _stringFiles.push_back(StringFile("MA.MS1", 0x88)); + _stringFiles.push_back(StringFile("MB.MS1", 0x88)); + _stringFiles.push_back(StringFile("MC.MS1", 0x88)); + _stringFiles.push_back(StringFile("MD.MS1", 0x88)); + _stringFiles.push_back(StringFile("ME.MS1", 0x88)); _locationGraphicFiles.push_back("RA.MS1"); _locationGraphicFiles.push_back("RB.MS1"); @@ -64,9 +64,9 @@ TransylvaniaGame::TransylvaniaGame() : ComprehendGame() { _gameStrings = &tr_strings; }; -void TransylvaniaGame::update_monster(const tr_monster *monster_info) { - item *monster; - room *room; +void TransylvaniaGame::update_monster(const TransylvaniaMonster *monster_info) { + 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) { - room *room = &_rooms[room_index]; + Room *room = &_rooms[room_index]; if (room_index == 0x28) { if (room_desc_string) diff --git a/engines/glk/comprehend/game_tr.h b/engines/glk/comprehend/game_tr.h index 634588c58f9..c9d4fdddb7f 100644 --- a/engines/glk/comprehend/game_tr.h +++ b/engines/glk/comprehend/game_tr.h @@ -28,7 +28,7 @@ namespace Glk { namespace Comprehend { -struct tr_monster { +struct TransylvaniaMonster { uint8 object; uint8 dead_flag; unsigned min_turns_before; @@ -38,10 +38,10 @@ struct tr_monster { class TransylvaniaGame : public ComprehendGame { private: - static const tr_monster WEREWOLF; - static const tr_monster VAMPIRE; + static const TransylvaniaMonster WEREWOLF; + static const TransylvaniaMonster VAMPIRE; - void update_monster(const tr_monster *monster_info); + void update_monster(const TransylvaniaMonster *monster_info); public: TransylvaniaGame(); diff --git a/engines/glk/comprehend/graphics.cpp b/engines/glk/comprehend/graphics.cpp index cb37182dc24..b053aceb5b4 100644 --- a/engines/glk/comprehend/graphics.cpp +++ b/engines/glk/comprehend/graphics.cpp @@ -48,7 +48,7 @@ static unsigned pen_colors[] = { RGB(0xff, 0x00, 0x00), }; -struct graphics_context { +struct GraphicsContext { Window *screen; /* @@ -63,7 +63,7 @@ struct graphics_context { // SDL_Surface *surface; }; -static graphics_context ctx; +static GraphicsContext ctx; unsigned g_set_pen_color(uint8 opcode) { return pen_colors[opcode - IMAGE_OP_PEN_COLOR_A]; diff --git a/engines/glk/comprehend/image_data.cpp b/engines/glk/comprehend/image_data.cpp index 1a5be26d622..9a44b21e8de 100644 --- a/engines/glk/comprehend/image_data.cpp +++ b/engines/glk/comprehend/image_data.cpp @@ -33,7 +33,7 @@ namespace Comprehend { #define IMAGES_PER_FILE 16 -struct image_context { +struct ImageContext { unsigned x; unsigned y; unsigned pen_color; @@ -46,7 +46,7 @@ struct image_context { static unsigned draw_flags; -void image_data::clear() { +void ImageData::clear() { fb = nullptr; image_offsets = nullptr; nr_images = 0; @@ -65,7 +65,7 @@ static uint16 image_get_operand(FileBuffer *fb) return val; } -static bool do_image_op(FileBuffer *fb, image_context *ctx) +static bool do_image_op(FileBuffer *fb, ImageContext *ctx) { uint8 opcode; uint16 a, b; @@ -254,12 +254,12 @@ static bool do_image_op(FileBuffer *fb, image_context *ctx) return false; } -void draw_image(image_data *info, unsigned index) +void draw_image(ImageData *info, unsigned index) { unsigned file_num; FileBuffer *fb; bool done = false; - image_context ctx = { + ImageContext ctx = { 0, 0, G_COLOR_BLACK, G_COLOR_BLACK, IMAGE_OP_SHAPE_CIRCLE_LARGE }; @@ -294,13 +294,13 @@ void draw_bright_room(void) g_clear_screen(G_COLOR_WHITE); } -void draw_location_image(image_data *info, unsigned index) +void draw_location_image(ImageData *info, unsigned index) { g_clear_screen(G_COLOR_WHITE); draw_image(info, index); } -static void load_image_file(image_data *info, const char *filename, +static void load_image_file(ImageData *info, const char *filename, unsigned file_num) { unsigned base = file_num * IMAGES_PER_FILE; @@ -329,7 +329,7 @@ static void load_image_file(image_data *info, const char *filename, } } -static void load_image_files(image_data *info, +static void load_image_files(ImageData *info, const Common::Array filenames) { uint i; @@ -344,7 +344,7 @@ static void load_image_files(image_data *info, } } -void comprehend_load_image_file(const char *filename, image_data *info) +void comprehend_load_image_file(const char *filename, ImageData *info) { Common::Array filenames; filenames.push_back(filename); diff --git a/engines/glk/comprehend/image_data.h b/engines/glk/comprehend/image_data.h index cb165e9fdbb..718b57c9aa9 100644 --- a/engines/glk/comprehend/image_data.h +++ b/engines/glk/comprehend/image_data.h @@ -31,12 +31,12 @@ namespace Comprehend { class ComprehendGame; struct FileBuffer; -struct image_data { +struct ImageData { FileBuffer *fb; uint16 *image_offsets; size_t nr_images; - image_data() { + ImageData() { clear(); } @@ -93,10 +93,10 @@ void image_set_draw_flags(unsigned flags); void draw_dark_room(void); void draw_bright_room(void); -void draw_image(image_data *info, unsigned index); -void draw_location_image(image_data *info, unsigned index); +void draw_image(ImageData *info, unsigned index); +void draw_location_image(ImageData *info, unsigned index); -void comprehend_load_image_file(const char *filename, image_data *info); +void comprehend_load_image_file(const char *filename, ImageData *info); void comprehend_load_images(ComprehendGame *game); } // namespace Comprehend