aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/message.cpp74
-rw-r--r--engines/sci/engine/message.h4
2 files changed, 30 insertions, 48 deletions
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index c46ef81685..0ef4f2efb7 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -27,8 +27,7 @@
#if 0
// Unreferenced - removed
-static
-int get_talker_trivial(index_record_cursor_t *cursor) {
+static int get_talker_trivial(index_record_cursor_t *cursor) {
return -1;
}
#endif
@@ -37,8 +36,7 @@ int get_talker_trivial(index_record_cursor_t *cursor) {
#if 0
// Unreferenced - removed
-static
-void index_record_parse_2101(index_record_cursor_t *cursor, message_tuple_t *t) {
+static void index_record_parse_2101(index_record_cursor_t *cursor, message_tuple_t *t) {
int noun = *(cursor->index_record + 0);
int verb = *(cursor->index_record + 1);
@@ -50,8 +48,7 @@ void index_record_parse_2101(index_record_cursor_t *cursor, message_tuple_t *t)
#if 0
// Unreferenced - removed
-static
-void index_record_get_text_2101(index_record_cursor_t *cursor, char *buffer, int buffer_size) {
+static void index_record_get_text_2101(index_record_cursor_t *cursor, char *buffer, int buffer_size) {
int offset = getUInt16(cursor->index_record + 2);
char *stringptr = (char *)cursor->resource_beginning + offset;
@@ -61,16 +58,14 @@ void index_record_get_text_2101(index_record_cursor_t *cursor, char *buffer, int
#if 0
// Unreferenced - removed
-static
-int header_get_index_record_count_2101(byte *header) {
+static int header_get_index_record_count_2101(byte *header) {
return getUInt16(header + 4);
}
#endif
-/* Version 3.411 and later code ahead */
+// Version 3.411 and later code ahead
-static
-void index_record_parse_3411(index_record_cursor_t *cursor, message_tuple_t *t) {
+static void index_record_parse_3411(index_record_cursor_t *cursor, message_tuple_t *t) {
int noun = *(cursor->index_record + 0);
int verb = *(cursor->index_record + 1);
int cond = *(cursor->index_record + 2);
@@ -82,44 +77,34 @@ void index_record_parse_3411(index_record_cursor_t *cursor, message_tuple_t *t)
t->seq = seq;
}
-static
-int index_record_get_talker_3411(index_record_cursor_t *cursor) {
+static int index_record_get_talker_3411(index_record_cursor_t *cursor) {
return *(cursor->index_record + 4);
}
-static
-void index_record_get_text_3411(index_record_cursor_t *cursor, char *buffer, int buffer_size) {
+static void index_record_get_text_3411(index_record_cursor_t *cursor, char *buffer, int buffer_size) {
int offset = getUInt16(cursor->index_record + 5);
char *stringptr = (char *)cursor->resource_beginning + offset;
strncpy(buffer, stringptr, buffer_size);
}
-static
-int header_get_index_record_count_3411(byte *header) {
+static int header_get_index_record_count_3411(byte *header) {
return getUInt16(header + 8);
}
-/* Generic code from here on */
+// Generic code from here on
-static
-int four_tuple_match(message_tuple_t *t1, message_tuple_t *t2) {
- return
- t1->noun == t2->noun &&
- t1->verb == t2->verb &&
- t1->cond == t2->cond &&
- t1->seq == t2->seq;
+static int four_tuple_match(message_tuple_t *t1, message_tuple_t *t2) {
+ return t1->noun == t2->noun && t1->verb == t2->verb && t1->cond == t2->cond && t1->seq == t2->seq;
}
-static
-void index_record_cursor_initialize(message_state_t *state, index_record_cursor_t *cursor) {
+static void index_record_cursor_initialize(message_state_t *state, index_record_cursor_t *cursor) {
cursor->resource_beginning = state->current_res->data;
cursor->index_record = state->index_records;
cursor->index = 1;
}
-static
-int index_record_next(message_state_t *state, index_record_cursor_t *cursor) {
+static int index_record_next(message_state_t *state, index_record_cursor_t *cursor) {
if (cursor->index == state->record_count)
return 0;
cursor->index_record += state->handler->index_record_size;
@@ -127,8 +112,7 @@ int index_record_next(message_state_t *state, index_record_cursor_t *cursor) {
return 1;
}
-static
-int index_record_find(message_state_t *state, message_tuple_t *t, index_record_cursor_t *cursor) {
+static int index_record_find(message_state_t *state, message_tuple_t *t, index_record_cursor_t *cursor) {
message_tuple_t looking_at;
int found = 0;
@@ -176,8 +160,7 @@ int message_state_load_res(message_state_t *state, int module) {
state->module = module;
state->current_res = scir_find_resource(state->resmgr, sci_message, module, 0);
- if (state->current_res == NULL ||
- state->current_res->data == NULL) {
+ if (state->current_res == NULL || state->current_res->data == NULL) {
sciprintf("Message subsystem: Failed to load %d.MSG\n", module);
return 0;
}
@@ -189,23 +172,24 @@ int message_state_load_res(message_state_t *state, int module) {
return 1;
}
-static message_handler_t fixed_handler = {3411,
- index_record_parse_3411,
- index_record_get_talker_3411,
- index_record_get_text_3411,
- header_get_index_record_count_3411,
-
- 10,
- 11
- };
+static message_handler_t fixed_handler = {
+ 3411,
+ index_record_parse_3411,
+ index_record_get_talker_3411,
+ index_record_get_text_3411,
+ header_get_index_record_count_3411,
+ 10,
+ 11
+};
void message_state_initialize(ResourceManager *resmgr, message_state_t *state) {
-// resource_t *tester = scir_find_resource(resmgr, sci_message, 0, 0);
+ //resource_t *tester = scir_find_resource(resmgr, sci_message, 0, 0);
//int version;
-// if (tester == NULL) return;
+ //if (tester == NULL)
+ // return;
-// version = getUInt16(tester->data);
+ //version = getUInt16(tester->data);
state->initialized = 1;
state->module = -1;
diff --git a/engines/sci/engine/message.h b/engines/sci/engine/message.h
index 2b7b83655a..a4e0b90275 100644
--- a/engines/sci/engine/message.h
+++ b/engines/sci/engine/message.h
@@ -38,7 +38,7 @@ typedef struct {
byte *resource_beginning;
} index_record_cursor_t;
-typedef int index_record_size_t(void);
+typedef int index_record_size_t();
typedef void parse_index_record_t(index_record_cursor_t *index_record, message_tuple_t *t);
typedef int get_talker_t(index_record_cursor_t *cursor);
typedef void get_text_t(index_record_cursor_t *cursor, char *buffer, int buffer_size);
@@ -73,5 +73,3 @@ int message_get_length(message_state_t *state);
int message_get_text(message_state_t *state, char *buffer, int length);
int message_state_load_res(message_state_t *state, int module);
void message_state_initialize(ResourceManager *resmgr, message_state_t *state);
-
-