Whitespace cleanup
svn-id: r38783
This commit is contained in:
parent
ac409a2ab7
commit
b5ce8d9320
69 changed files with 718 additions and 742 deletions
|
@ -47,7 +47,7 @@ bool Console::cmdGetVersion(int argc, const char **argv) {
|
||||||
|
|
||||||
DebugPrintf("Resource file version: %s\n", sci_version_types[_vm->getResMgr()->sci_version]);
|
DebugPrintf("Resource file version: %s\n", sci_version_types[_vm->getResMgr()->sci_version]);
|
||||||
|
|
||||||
DebugPrintf("Emulated interpreter version: %d.%03d.%03d\n",
|
DebugPrintf("Emulated interpreter version: %d.%03d.%03d\n",
|
||||||
SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver));
|
SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -173,7 +173,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
|
||||||
SCI_VERSION_AUTODETECT,
|
SCI_VERSION_AUTODETECT,
|
||||||
SCI_VERSION(0, 0, 294)
|
SCI_VERSION(0, 0, 294)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Christmas Card 1990: The Seasoned Professional - English DOS (16 Colors)
|
// Christmas Card 1990: The Seasoned Professional - English DOS (16 Colors)
|
||||||
{{"christmas1990", "16 Colors", {
|
{{"christmas1990", "16 Colors", {
|
||||||
{"resource.map", 0, "8f656714a05b94423ac6eb10ee8797d0", 600},
|
{"resource.map", 0, "8f656714a05b94423ac6eb10ee8797d0", 600},
|
||||||
|
@ -183,7 +183,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
|
||||||
SCI_VERSION_AUTODETECT,
|
SCI_VERSION_AUTODETECT,
|
||||||
SCI_VERSION(1, 0, 172)
|
SCI_VERSION(1, 0, 172)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Christmas Card 1990: The Seasoned Professional - English DOS (256 Colors)
|
// Christmas Card 1990: The Seasoned Professional - English DOS (256 Colors)
|
||||||
{{"christmas1990", "256 Colors", {
|
{{"christmas1990", "256 Colors", {
|
||||||
{"resource.map", 0, "44b8f45b841b9b5e17e939a35e443988", 600},
|
{"resource.map", 0, "44b8f45b841b9b5e17e939a35e443988", 600},
|
||||||
|
@ -193,7 +193,7 @@ static const struct SciGameDescription SciGameDescriptions[] = {
|
||||||
SCI_VERSION_AUTODETECT,
|
SCI_VERSION_AUTODETECT,
|
||||||
SCI_VERSION(1, 0, 174)
|
SCI_VERSION(1, 0, 174)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Christmas Card 1992 - English DOS
|
// Christmas Card 1992 - English DOS
|
||||||
{{"christmas1992", "", {
|
{{"christmas1992", "", {
|
||||||
{"resource.map", 0, "f1f8c8a8443f523422af70b4ec85b71c", 318},
|
{"resource.map", 0, "f1f8c8a8443f523422af70b4ec85b71c", 318},
|
||||||
|
@ -1041,8 +1041,8 @@ static const struct SciGameDescription SciGameDescriptions[] = {
|
||||||
SCI_VERSION(1, 001, 115)
|
SCI_VERSION(1, 001, 115)
|
||||||
},
|
},
|
||||||
|
|
||||||
// Larry 6 - English/German DOS CD - HIRES
|
// Larry 6 - English/German DOS CD - HIRES
|
||||||
{{"lsl6", "", {
|
{{"lsl6", "", {
|
||||||
{"resource.map", 0, "0c0804434ea62278dd15032b1947426c", 8872},
|
{"resource.map", 0, "0c0804434ea62278dd15032b1947426c", 8872},
|
||||||
{"resource.000", 0, "9a9f4870504444cda863dd14d077a680", 18520872},
|
{"resource.000", 0, "9a9f4870504444cda863dd14d077a680", 18520872},
|
||||||
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0},
|
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0},
|
||||||
|
|
|
@ -415,7 +415,7 @@ static int create_class_table_sci0(EngineState *s) {
|
||||||
|
|
||||||
s->classtable = (class_t*)sci_realloc(s->classtable, sizeof(class_t) * (classnr + 1));
|
s->classtable = (class_t*)sci_realloc(s->classtable, sizeof(class_t) * (classnr + 1));
|
||||||
// Clear after resize
|
// Clear after resize
|
||||||
memset(&(s->classtable[s->classtable_size]), 0, sizeof(class_t) * (1 + classnr - s->classtable_size));
|
memset(&(s->classtable[s->classtable_size]), 0, sizeof(class_t) * (1 + classnr - s->classtable_size));
|
||||||
|
|
||||||
s->classtable_size = classnr + 1; // Adjust maximum number of entries
|
s->classtable_size = classnr + 1; // Adjust maximum number of entries
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,7 @@ void vocab_gnf_dump(parse_tree_branch_t *branches, int branches_nr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int vocab_build_parse_tree(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
int vocab_build_parse_tree(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
||||||
parse_tree_branch_t *branch0, parse_rule_list_t *rules) {
|
parse_tree_branch_t *branch0, parse_rule_list_t *rules) {
|
||||||
return vocab_gnf_parse(nodes, words, words_nr, branch0, rules, 0);
|
return vocab_gnf_parse(nodes, words, words_nr, branch0, rules, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ static int _vbpt_write_subexpression(parse_tree_node_t *nodes, int *pos, parse_r
|
||||||
}
|
}
|
||||||
|
|
||||||
int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
||||||
parse_tree_branch_t *branch0, parse_rule_list_t *tlist, int verbose) {
|
parse_tree_branch_t *branch0, parse_rule_list_t *tlist, int verbose) {
|
||||||
// Get the start rules:
|
// Get the start rules:
|
||||||
parse_rule_list_t *work = _vocab_clone_rule_list_by_id(tlist, branch0->data[1]);
|
parse_rule_list_t *work = _vocab_clone_rule_list_by_id(tlist, branch0->data[1]);
|
||||||
parse_rule_list_t *results = NULL;
|
parse_rule_list_t *results = NULL;
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct int_hash_map_t {
|
||||||
node_t *next;
|
node_t *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
int base_value; // Starts at zero, counts upwards
|
int base_value; // Starts at zero, counts upwards
|
||||||
node_t *nodes[DCS_INT_HASH_MAX + 1];
|
node_t *nodes[DCS_INT_HASH_MAX + 1];
|
||||||
node_t *holes; /* List of freed entries to minimize
|
node_t *holes; /* List of freed entries to minimize
|
||||||
** memory operations and modifications
|
** memory operations and modifications
|
||||||
|
@ -61,7 +61,7 @@ struct int_hash_map_t {
|
||||||
public:
|
public:
|
||||||
int_hash_map_t();
|
int_hash_map_t();
|
||||||
~int_hash_map_t();
|
~int_hash_map_t();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a value is in the map, adds it if neccessary.
|
* Checks whether a value is in the map, adds it if neccessary.
|
||||||
* @param value The value to check for/add
|
* @param value The value to check for/add
|
||||||
|
|
|
@ -557,7 +557,7 @@ reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
return make_reg(0, retval);
|
return make_reg(0, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define K_MEMORY_ALLOCATE_CRITICAL 1
|
#define K_MEMORY_ALLOCATE_CRITICAL 1
|
||||||
#define K_MEMORY_ALLOCATE_NONCRITICAL 2
|
#define K_MEMORY_ALLOCATE_NONCRITICAL 2
|
||||||
#define K_MEMORY_FREE 3
|
#define K_MEMORY_FREE 3
|
||||||
#define K_MEMORY_MEMCPY 4
|
#define K_MEMORY_MEMCPY 4
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Sci {
|
||||||
#define KSIG_SPEC_ARITHMETIC 'i'
|
#define KSIG_SPEC_ARITHMETIC 'i'
|
||||||
#define KSIG_SPEC_NULL 'z'
|
#define KSIG_SPEC_NULL 'z'
|
||||||
#define KSIG_SPEC_ANY '.'
|
#define KSIG_SPEC_ANY '.'
|
||||||
#define KSIG_SPEC_ALLOW_INV '!' // Allow invalid pointers
|
#define KSIG_SPEC_ALLOW_INV '!' // Allow invalid pointers
|
||||||
#define KSIG_SPEC_ELLIPSIS '*' // Arbitrarily more TYPED arguments
|
#define KSIG_SPEC_ELLIPSIS '*' // Arbitrarily more TYPED arguments
|
||||||
|
|
||||||
#define KSIG_SPEC_SUM_DONE ('a' - 'A') // Use small letters to indicate end of sum type
|
#define KSIG_SPEC_SUM_DONE ('a' - 'A') // Use small letters to indicate end of sum type
|
||||||
|
|
|
@ -207,7 +207,7 @@ static FILE *getFileFromHandle(EngineState *s, int handle) {
|
||||||
SCIkwarn(SCIkERROR, "Attempt to use invalid/unused file handle %d\n", handle);
|
SCIkwarn(SCIkERROR, "Attempt to use invalid/unused file handle %d\n", handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s->file_handles[handle];
|
return s->file_handles[handle];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ reg_t kGetSaveFiles(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
char namebuf[SCI_MAX_SAVENAME_LENGTH]; // Save game name buffer
|
char namebuf[SCI_MAX_SAVENAME_LENGTH]; // Save game name buffer
|
||||||
strncpy(namebuf, meta.savegame_name, SCI_MAX_SAVENAME_LENGTH);
|
strncpy(namebuf, meta.savegame_name, SCI_MAX_SAVENAME_LENGTH);
|
||||||
namebuf[SCI_MAX_SAVENAME_LENGTH-1] = 0;
|
namebuf[SCI_MAX_SAVENAME_LENGTH-1] = 0;
|
||||||
|
|
||||||
if (strlen(namebuf) > 0) {
|
if (strlen(namebuf) > 0) {
|
||||||
if (namebuf[strlen(namebuf) - 1] == '\n')
|
if (namebuf[strlen(namebuf) - 1] == '\n')
|
||||||
namebuf[strlen(namebuf) - 1] = 0; // Remove trailing newline
|
namebuf[strlen(namebuf) - 1] = 0; // Remove trailing newline
|
||||||
|
@ -772,7 +772,7 @@ reg_t kValidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
return s->r_acc;
|
return s->r_acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define K_FILEIO_OPEN 0
|
#define K_FILEIO_OPEN 0
|
||||||
#define K_FILEIO_CLOSE 1
|
#define K_FILEIO_CLOSE 1
|
||||||
#define K_FILEIO_READ_RAW 2
|
#define K_FILEIO_READ_RAW 2
|
||||||
#define K_FILEIO_WRITE_RAW 3
|
#define K_FILEIO_WRITE_RAW 3
|
||||||
|
|
|
@ -58,34 +58,34 @@ namespace Sci {
|
||||||
|
|
||||||
|
|
||||||
#define ADD_TO_CURRENT_PORT(widget) \
|
#define ADD_TO_CURRENT_PORT(widget) \
|
||||||
{if (s->port) \
|
{if (s->port) \
|
||||||
s->port->add(GFXWC(s->port), GFXW(widget)); \
|
s->port->add(GFXWC(s->port), GFXW(widget)); \
|
||||||
else \
|
else \
|
||||||
s->picture_port->add(GFXWC(s->visual), GFXW(widget));}
|
s->picture_port->add(GFXWC(s->visual), GFXW(widget));}
|
||||||
|
|
||||||
#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
|
#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
|
||||||
{if (s->port) \
|
{if (s->port) \
|
||||||
s->port->add(GFXWC(s->port), GFXW(widget)); \
|
s->port->add(GFXWC(s->port), GFXW(widget)); \
|
||||||
else \
|
else \
|
||||||
s->picture_port->add(GFXWC(s->picture_port), GFXW(widget));}
|
s->picture_port->add(GFXWC(s->picture_port), GFXW(widget));}
|
||||||
|
|
||||||
#define ADD_TO_WINDOW_PORT(widget) \
|
#define ADD_TO_WINDOW_PORT(widget) \
|
||||||
s->wm_port->add(GFXWC(s->wm_port), GFXW(widget));
|
s->wm_port->add(GFXWC(s->wm_port), GFXW(widget));
|
||||||
|
|
||||||
#define ADD_TO_CURRENT_FG_WIDGETS(widget) \
|
#define ADD_TO_CURRENT_FG_WIDGETS(widget) \
|
||||||
ADD_TO_CURRENT_PICTURE_PORT(widget)
|
ADD_TO_CURRENT_PICTURE_PORT(widget)
|
||||||
|
|
||||||
#define ADD_TO_CURRENT_BG_WIDGETS(widget) \
|
#define ADD_TO_CURRENT_BG_WIDGETS(widget) \
|
||||||
ADD_TO_CURRENT_PICTURE_PORT(widget)
|
ADD_TO_CURRENT_PICTURE_PORT(widget)
|
||||||
|
|
||||||
#define FULL_REDRAW()\
|
#define FULL_REDRAW()\
|
||||||
if (s->visual) \
|
if (s->visual) \
|
||||||
s->visual->draw(GFXW(s->visual), gfxw_point_zero); \
|
s->visual->draw(GFXW(s->visual), gfxw_point_zero); \
|
||||||
gfxop_update(s->gfx_state);
|
gfxop_update(s->gfx_state);
|
||||||
|
|
||||||
#define FULL_INSPECTION()\
|
#define FULL_INSPECTION()\
|
||||||
if (s->visual) \
|
if (s->visual) \
|
||||||
s->visual->print(GFXW(s->visual), 0);
|
s->visual->print(GFXW(s->visual), 0);
|
||||||
|
|
||||||
|
|
||||||
#define GFX_ASSERT(x) { \
|
#define GFX_ASSERT(x) { \
|
||||||
|
@ -949,7 +949,7 @@ reg_t kNumCels(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
int cel = 0xffff;
|
int cel = 0xffff;
|
||||||
|
|
||||||
|
|
||||||
if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
|
if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
|
||||||
// OK, this is a hack and there's a
|
// OK, this is a hack and there's a
|
||||||
// real function to calculate cel numbers...
|
// real function to calculate cel numbers...
|
||||||
SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
|
SCIkwarn(SCIkERROR, "view.%d (0x%x) not found\n", view, view);
|
||||||
|
@ -1250,7 +1250,7 @@ static void _k_set_now_seen(EngineState *s, reg_t object) {
|
||||||
abs_rect_t absrect = get_nsrect(s, object, 0);
|
abs_rect_t absrect = get_nsrect(s, object, 0);
|
||||||
|
|
||||||
if (lookup_selector(s, object, s->selector_map.nsTop, NULL, NULL) != SELECTOR_VARIABLE) {
|
if (lookup_selector(s, object, s->selector_map.nsTop, NULL, NULL) != SELECTOR_VARIABLE) {
|
||||||
return;
|
return;
|
||||||
} // This isn't fatal
|
} // This isn't fatal
|
||||||
|
|
||||||
PUT_SEL32V(object, nsLeft, absrect.x);
|
PUT_SEL32V(object, nsLeft, absrect.x);
|
||||||
|
@ -1463,7 +1463,7 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
cursor = textlen;
|
cursor = textlen;
|
||||||
break;
|
break;
|
||||||
case SCI_K_RIGHT:
|
case SCI_K_RIGHT:
|
||||||
if (cursor + 1 <= textlen)
|
if (cursor + 1 <= textlen)
|
||||||
++cursor;
|
++cursor;
|
||||||
break;
|
break;
|
||||||
case SCI_K_LEFT:
|
case SCI_K_LEFT:
|
||||||
|
@ -1663,7 +1663,7 @@ static void draw_rect_to_control_map(EngineState *s, abs_rect_t abs_zone) {
|
||||||
|
|
||||||
SCIkdebug(SCIkGRAPHICS, " adding control block (%d,%d)to(%d,%d)\n", abs_zone.x, abs_zone.y, abs_zone.xend, abs_zone.yend);
|
SCIkdebug(SCIkGRAPHICS, " adding control block (%d,%d)to(%d,%d)\n", abs_zone.x, abs_zone.y, abs_zone.xend, abs_zone.yend);
|
||||||
|
|
||||||
box = gfxw_new_box(s->gfx_state, gfx_rect(abs_zone.x, abs_zone.y, abs_zone.xend - abs_zone.x,
|
box = gfxw_new_box(s->gfx_state, gfx_rect(abs_zone.x, abs_zone.y, abs_zone.xend - abs_zone.x,
|
||||||
abs_zone.yend - abs_zone.y), color, color, GFX_BOX_SHADE_FLAT);
|
abs_zone.yend - abs_zone.y), color, color, GFX_BOX_SHADE_FLAT);
|
||||||
|
|
||||||
assert_primary_widget_lists(s);
|
assert_primary_widget_lists(s);
|
||||||
|
@ -1725,7 +1725,7 @@ static void _k_view_list_do_postdraw(EngineState *s, gfxw_list_t *list) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_LSRECT
|
#ifdef DEBUG_LSRECT
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
|
fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2501,7 +2501,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
lWhite.alpha = 0;
|
lWhite.alpha = 0;
|
||||||
|
|
||||||
window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->font_nr, fgcolor, bgcolor,
|
window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->font_nr, fgcolor, bgcolor,
|
||||||
s->titlebar_port->font_nr, lWhite, black, argv[4 + argextra].segment ?
|
s->titlebar_port->font_nr, lWhite, black, argv[4 + argextra].segment ?
|
||||||
kernel_dereference_char_pointer(s, argv[4 + argextra], 0) : NULL, flags);
|
kernel_dereference_char_pointer(s, argv[4 + argextra], 0) : NULL, flags);
|
||||||
|
|
||||||
// PQ3 has the interpreter store underBits implicitly.
|
// PQ3 has the interpreter store underBits implicitly.
|
||||||
|
@ -2548,10 +2548,10 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
#define K_ANIMATE_OPEN_SIMPLE 100 // No animation
|
#define K_ANIMATE_OPEN_SIMPLE 100 // No animation
|
||||||
|
|
||||||
#define GRAPH_BLANK_BOX(s, x, y, xl, yl, color) GFX_ASSERT(gfxop_fill_box(s->gfx_state, \
|
#define GRAPH_BLANK_BOX(s, x, y, xl, yl, color) GFX_ASSERT(gfxop_fill_box(s->gfx_state, \
|
||||||
gfx_rect(x, (((y) < 10)? 10 : (y)), xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), s->ega_colors[color]));
|
gfx_rect(x, (((y) < 10)? 10 : (y)), xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), s->ega_colors[color]));
|
||||||
|
|
||||||
#define GRAPH_UPDATE_BOX(s, x, y, xl, yl) GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, \
|
#define GRAPH_UPDATE_BOX(s, x, y, xl, yl) GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, \
|
||||||
gfx_rect(x, (((y) < 10)? 10 : (y)) - 10, xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), Common::Point(x, ((y) < 10)? 10 : (y) )));
|
gfx_rect(x, (((y) < 10)? 10 : (y)) - 10, xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), Common::Point(x, ((y) < 10)? 10 : (y) )));
|
||||||
|
|
||||||
static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
int i, remaining_checkers;
|
int i, remaining_checkers;
|
||||||
|
|
|
@ -301,8 +301,8 @@ _menu_go_down(EngineState *s, int menu_nr, int item_nr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FULL_REDRAW \
|
#define FULL_REDRAW \
|
||||||
s->visual->draw(GFXW(s->visual), Common::Point(0, 0)); \
|
s->visual->draw(GFXW(s->visual), Common::Point(0, 0)); \
|
||||||
gfxop_update(s->gfx_state);
|
gfxop_update(s->gfx_state);
|
||||||
|
|
||||||
|
|
||||||
reg_t
|
reg_t
|
||||||
|
|
|
@ -65,9 +65,9 @@ namespace Sci {
|
||||||
// Visibility matrix
|
// Visibility matrix
|
||||||
#define VIS_MATRIX_ROW_SIZE(N) (((N) / 8) + ((N) % 8 ? 1 : 0))
|
#define VIS_MATRIX_ROW_SIZE(N) (((N) / 8) + ((N) % 8 ? 1 : 0))
|
||||||
#define SET_VISIBLE(S, P, Q) ((S)->vis_matrix)[(P) * VIS_MATRIX_ROW_SIZE((S)->vertices) \
|
#define SET_VISIBLE(S, P, Q) ((S)->vis_matrix)[(P) * VIS_MATRIX_ROW_SIZE((S)->vertices) \
|
||||||
+ (Q) / 8] |= (1 << ((Q) % 8))
|
+ (Q) / 8] |= (1 << ((Q) % 8))
|
||||||
#define IS_VISIBLE(S, P, Q) (((S)->vis_matrix[(P) * VIS_MATRIX_ROW_SIZE((S)->vertices) \
|
#define IS_VISIBLE(S, P, Q) (((S)->vis_matrix[(P) * VIS_MATRIX_ROW_SIZE((S)->vertices) \
|
||||||
+ (Q) / 8] & (1 << ((Q) % 8))) != 0)
|
+ (Q) / 8] & (1 << ((Q) % 8))) != 0)
|
||||||
|
|
||||||
#define VERTEX_HAS_EDGES(V) ((V) != CLIST_NEXT(V, entries))
|
#define VERTEX_HAS_EDGES(V) ((V) != CLIST_NEXT(V, entries))
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t
|
||||||
}
|
}
|
||||||
|
|
||||||
int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct,
|
int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct,
|
||||||
stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...) {
|
stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...) {
|
||||||
va_list argp;
|
va_list argp;
|
||||||
int i;
|
int i;
|
||||||
int framesize = 2 + 1 * argc;
|
int framesize = 2 + 1 * argc;
|
||||||
|
@ -224,7 +224,7 @@ reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
|
||||||
victim_obj->flags |= OBJECT_FLAG_FREED;
|
victim_obj->flags |= OBJECT_FLAG_FREED;
|
||||||
|
|
||||||
_k_view_list_mark_free(s, victim_addr); // Free on view list, if neccessary
|
_k_view_list_mark_free(s, victim_addr); // Free on view list, if neccessary
|
||||||
|
|
||||||
return s->r_acc;
|
return s->r_acc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
|
||||||
int
|
int
|
||||||
sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
||||||
int command, int arg1, int arg2);
|
int command, int arg1, int arg2);
|
||||||
|
|
||||||
reg_t
|
reg_t
|
||||||
kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
@ -472,7 +472,7 @@ kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
int looping = GET_SEL32V(obj, loop);
|
int looping = GET_SEL32V(obj, loop);
|
||||||
//int vol = GET_SEL32V(obj, vol);
|
//int vol = GET_SEL32V(obj, vol);
|
||||||
int pri = GET_SEL32V(obj, pri);
|
int pri = GET_SEL32V(obj, pri);
|
||||||
RESTORE_BEHAVIOR rb = (RESTORE_BEHAVIOR) UKPV(2); /* Too lazy to look up a default value for this */
|
RESTORE_BEHAVIOR rb = (RESTORE_BEHAVIOR) UKPV(2); /* Too lazy to look up a default value for this */
|
||||||
|
|
||||||
if (obj.segment) {
|
if (obj.segment) {
|
||||||
sfx_song_set_status(&s->sound,
|
sfx_song_set_status(&s->sound,
|
||||||
|
@ -609,33 +609,33 @@ kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
break; /* Doesn't happen */
|
break; /* Doesn't happen */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* switch (signal) */
|
/* switch (signal) */
|
||||||
/* { */
|
/* { */
|
||||||
/* case 0x00: */
|
/* case 0x00: */
|
||||||
/* if (dataInc!=GET_SEL32V(obj, dataInc)) */
|
/* if (dataInc!=GET_SEL32V(obj, dataInc)) */
|
||||||
/* { */
|
/* { */
|
||||||
/* PUT_SEL32V(obj, dataInc, dataInc); */
|
/* PUT_SEL32V(obj, dataInc, dataInc); */
|
||||||
/* PUT_SEL32V(obj, signal, dataInc+0x7f); */
|
/* PUT_SEL32V(obj, signal, dataInc+0x7f); */
|
||||||
/* } else */
|
/* } else */
|
||||||
/* { */
|
/* { */
|
||||||
/* PUT_SEL32V(obj, signal, signal); */
|
/* PUT_SEL32V(obj, signal, signal); */
|
||||||
/* } */
|
/* } */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* case 0xFF: /\* May be unnecessary *\/ */
|
/* case 0xFF: /\* May be unnecessary *\/ */
|
||||||
/* sfx_song_set_status(&s->sound, */
|
/* sfx_song_set_status(&s->sound, */
|
||||||
/* handle, SOUND_STATUS_STOPPED); */
|
/* handle, SOUND_STATUS_STOPPED); */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* default : */
|
/* default : */
|
||||||
/* if (dataInc!=GET_SEL32V(obj, dataInc)) */
|
/* if (dataInc!=GET_SEL32V(obj, dataInc)) */
|
||||||
/* { */
|
/* { */
|
||||||
/* PUT_SEL32V(obj, dataInc, dataInc); */
|
/* PUT_SEL32V(obj, dataInc, dataInc); */
|
||||||
/* PUT_SEL32V(obj, signal, dataInc+0x7f); */
|
/* PUT_SEL32V(obj, signal, dataInc+0x7f); */
|
||||||
/* } else */
|
/* } else */
|
||||||
/* { */
|
/* { */
|
||||||
/* PUT_SEL32V(obj, signal, signal); */
|
/* PUT_SEL32V(obj, signal, signal); */
|
||||||
/* } */
|
/* } */
|
||||||
/* break; */
|
/* break; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
PUT_SEL32V(obj, min, min);
|
PUT_SEL32V(obj, min, min);
|
||||||
PUT_SEL32V(obj, sec, sec);
|
PUT_SEL32V(obj, sec, sec);
|
||||||
|
@ -668,7 +668,7 @@ kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
|
||||||
int
|
int
|
||||||
sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
||||||
int command, int arg1, int arg2);
|
int command, int arg1, int arg2);
|
||||||
|
|
||||||
reg_t
|
reg_t
|
||||||
kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
@ -772,7 +772,7 @@ kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
s->acc = s->sound_server->command(s, SOUND_COMMAND_SET_VOLUME, 0, vol);
|
s->acc = s->sound_server->command(s, SOUND_COMMAND_SET_VOLUME, 0, vol);
|
||||||
else
|
else
|
||||||
s->acc = s->sound_server->command(s, SOUND_COMMAND_GET_VOLUME, 0, 0);
|
s->acc = s->sound_server->command(s, SOUND_COMMAND_GET_VOLUME, 0, 0);
|
||||||
break;*/
|
break;*/
|
||||||
}
|
}
|
||||||
case _K_SCI1_SOUND_MUTE_SOUND : {
|
case _K_SCI1_SOUND_MUTE_SOUND : {
|
||||||
/* if there's a parameter, we're setting it. Otherwise,
|
/* if there's a parameter, we're setting it. Otherwise,
|
||||||
|
|
|
@ -899,7 +899,7 @@ yy_reduce_print (yyvsp, yyrule)
|
||||||
fprintf (stderr, " $%d = ", yyi + 1);
|
fprintf (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||||||
);
|
);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1237,7 +1237,7 @@ yyparse ()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
int yystate;
|
int yystate;
|
||||||
int yyn;
|
int yyn;
|
||||||
int yyresult;
|
int yyresult;
|
||||||
|
@ -1939,7 +1939,7 @@ static tree_t said_paren(tree_t t1, tree_t t2) {
|
||||||
|
|
||||||
static tree_t said_value(int val, tree_t t) {
|
static tree_t said_value(int val, tree_t t) {
|
||||||
return said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, val), t);
|
return said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, val), t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static tree_t said_terminal(int val) {
|
static tree_t said_terminal(int val) {
|
||||||
|
@ -2138,7 +2138,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in
|
||||||
|
|
||||||
while (pos) {
|
while (pos) {
|
||||||
if ((word = aug_get_wgroup(tree, pos))) { // found a word
|
if ((word = aug_get_wgroup(tree, pos))) { // found a word
|
||||||
if (!refbranch && major == WORD_TYPE_BASE) {
|
if (!refbranch && major == WORD_TYPE_BASE) {
|
||||||
if ((*base_words_nr) == maxwords) {
|
if ((*base_words_nr) == maxwords) {
|
||||||
sciprintf("Out of regular words\n");
|
sciprintf("Out of regular words\n");
|
||||||
return; // return gracefully
|
return; // return gracefully
|
||||||
|
@ -2160,9 +2160,9 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in
|
||||||
}
|
}
|
||||||
if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF)
|
if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF)
|
||||||
sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major);
|
sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major);
|
||||||
|
|
||||||
} else // Did NOT find a word group: Attempt to recurse
|
} else // Did NOT find a word group: Attempt to recurse
|
||||||
aug_find_words_recursively(tree, pos, base_words, base_words_nr,
|
aug_find_words_recursively(tree, pos, base_words, base_words_nr,
|
||||||
ref_words, ref_words_nr, maxwords, refbranch || major == WORD_TYPE_REF);
|
ref_words, ref_words_nr, maxwords, refbranch || major == WORD_TYPE_REF);
|
||||||
|
|
||||||
pos = aug_get_next_sibling(tree, pos, &major, &minor);
|
pos = aug_get_next_sibling(tree, pos, &major, &minor);
|
||||||
|
@ -2404,7 +2404,7 @@ static int augment_parse_nodes(parse_tree_node_t *parset, parse_tree_node_t *sai
|
||||||
sciprintf("augment_parse_nodes(): Parse tree is corrupt\n");
|
sciprintf("augment_parse_nodes(): Parse tree is corrupt\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
augment_basepos = aug_get_base_node(saidt);
|
augment_basepos = aug_get_base_node(saidt);
|
||||||
if (!augment_basepos) {
|
if (!augment_basepos) {
|
||||||
sciprintf("augment_parse_nodes(): Said tree is corrupt\n");
|
sciprintf("augment_parse_nodes(): Said tree is corrupt\n");
|
||||||
|
|
|
@ -118,8 +118,8 @@ static int yyerror(const char *s) {
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
saidspec : leftspec optcont
|
saidspec : leftspec optcont
|
||||||
{ $$ = said_top_branch(said_attach_branch($1, $2)); }
|
{ $$ = said_top_branch(said_attach_branch($1, $2)); }
|
||||||
| leftspec midspec optcont
|
| leftspec midspec optcont
|
||||||
{ $$ = said_top_branch(said_attach_branch($1, said_attach_branch($2, $3))); }
|
{ $$ = said_top_branch(said_attach_branch($1, said_attach_branch($2, $3))); }
|
||||||
| leftspec midspec rightspec optcont
|
| leftspec midspec rightspec optcont
|
||||||
|
@ -180,7 +180,7 @@ wordset : word
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| wordset YY_COMMA wordset
|
| wordset YY_COMMA wordset
|
||||||
{ $$ = said_attach_branch($1, $3); }
|
{ $$ = said_attach_branch($1, $3); }
|
||||||
| wordset YY_BRACKETSO_LT wordrefset YY_BRACKETSC
|
| wordset YY_BRACKETSO_LT wordrefset YY_BRACKETSC
|
||||||
{ $$ = said_attach_branch($1, $3); }
|
{ $$ = said_attach_branch($1, $3); }
|
||||||
| wordset YY_COMMA YY_BRACKETSO wordset YY_BRACKETSC
|
| wordset YY_COMMA YY_BRACKETSO wordset YY_BRACKETSC
|
||||||
{ $$ = said_attach_branch($1, $3); }
|
{ $$ = said_attach_branch($1, $3); }
|
||||||
|
@ -295,7 +295,7 @@ static tree_t said_paren(tree_t t1, tree_t t2) {
|
||||||
|
|
||||||
static tree_t said_value(int val, tree_t t) {
|
static tree_t said_value(int val, tree_t t) {
|
||||||
return said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, val), t);
|
return said_branch_node(SAID_NEXT_NODE, said_leaf_node(SAID_NEXT_NODE, val), t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static tree_t said_terminal(int val) {
|
static tree_t said_terminal(int val) {
|
||||||
|
@ -494,7 +494,7 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in
|
||||||
|
|
||||||
while (pos) {
|
while (pos) {
|
||||||
if ((word = aug_get_wgroup(tree, pos))) { // found a word
|
if ((word = aug_get_wgroup(tree, pos))) { // found a word
|
||||||
if (!refbranch && major == WORD_TYPE_BASE) {
|
if (!refbranch && major == WORD_TYPE_BASE) {
|
||||||
if ((*base_words_nr) == maxwords) {
|
if ((*base_words_nr) == maxwords) {
|
||||||
sciprintf("Out of regular words\n");
|
sciprintf("Out of regular words\n");
|
||||||
return; // return gracefully
|
return; // return gracefully
|
||||||
|
@ -516,9 +516,9 @@ static void aug_find_words_recursively(parse_tree_node_t *tree, int startpos, in
|
||||||
}
|
}
|
||||||
if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF)
|
if (major != WORD_TYPE_SYNTACTIC_SUGAR && major != WORD_TYPE_BASE && major != WORD_TYPE_REF)
|
||||||
sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major);
|
sciprintf("aug_find_words_recursively(): Unknown word type %03x\n", major);
|
||||||
|
|
||||||
} else // Did NOT find a word group: Attempt to recurse
|
} else // Did NOT find a word group: Attempt to recurse
|
||||||
aug_find_words_recursively(tree, pos, base_words, base_words_nr,
|
aug_find_words_recursively(tree, pos, base_words, base_words_nr,
|
||||||
ref_words, ref_words_nr, maxwords, refbranch || major == WORD_TYPE_REF);
|
ref_words, ref_words_nr, maxwords, refbranch || major == WORD_TYPE_REF);
|
||||||
|
|
||||||
pos = aug_get_next_sibling(tree, pos, &major, &minor);
|
pos = aug_get_next_sibling(tree, pos, &major, &minor);
|
||||||
|
@ -760,7 +760,7 @@ static int augment_parse_nodes(parse_tree_node_t *parset, parse_tree_node_t *sai
|
||||||
sciprintf("augment_parse_nodes(): Parse tree is corrupt\n");
|
sciprintf("augment_parse_nodes(): Parse tree is corrupt\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
augment_basepos = aug_get_base_node(saidt);
|
augment_basepos = aug_get_base_node(saidt);
|
||||||
if (!augment_basepos) {
|
if (!augment_basepos) {
|
||||||
sciprintf("augment_parse_nodes(): Said tree is corrupt\n");
|
sciprintf("augment_parse_nodes(): Said tree is corrupt\n");
|
||||||
|
|
|
@ -251,7 +251,7 @@ RECORD song_t "song_t" {
|
||||||
int loops;
|
int loops;
|
||||||
int hold;
|
int hold;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECORD int_hash_map_t "int_hash_map_t" {
|
RECORD int_hash_map_t "int_hash_map_t" {
|
||||||
int base_value;
|
int base_value;
|
||||||
int_hash_map_node_tp nodes[STATIC DCS_INT_HASH_MAX+1];
|
int_hash_map_node_tp nodes[STATIC DCS_INT_HASH_MAX+1];
|
||||||
|
@ -481,7 +481,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
|
||||||
for (i = 0; i < songcount; i++) {
|
for (i = 0; i < songcount; i++) {
|
||||||
%CFSMLREAD song_tp &newsong FROM fh ERRVAR *hiteof FIRSTTOKEN lastval LINECOUNTER *line;
|
%CFSMLREAD song_tp &newsong FROM fh ERRVAR *hiteof FIRSTTOKEN lastval LINECOUNTER *line;
|
||||||
song_lib_add(*songlib, newsong);
|
song_lib_add(*songlib, newsong);
|
||||||
}
|
}
|
||||||
l = fh->readLine(); // "]"
|
l = fh->readLine(); // "]"
|
||||||
l = fh->readLine(); // "}"
|
l = fh->readLine(); // "}"
|
||||||
*line += 2;
|
*line += 2;
|
||||||
|
@ -567,7 +567,7 @@ int read_int_hash_map_node_tp(Common::SeekableReadStream *fh, int_hash_map_t::no
|
||||||
sciprintf("Expected opening bracket in hash_map_node_t on line %d\n", *line);
|
sciprintf("Expected opening bracket in hash_map_node_t on line %d\n", *line);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
(*line)++;
|
(*line)++;
|
||||||
SRSgets(buffer, 80, fh);
|
SRSgets(buffer, 80, fh);
|
||||||
|
@ -612,7 +612,7 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
||||||
WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name);
|
WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name);
|
||||||
%CFSMLWRITE int &foo->segmgr_id INTO fh;
|
%CFSMLWRITE int &foo->segmgr_id INTO fh;
|
||||||
switch (foo->type) {
|
switch (foo->type) {
|
||||||
case MEM_OBJ_SCRIPT:
|
case MEM_OBJ_SCRIPT:
|
||||||
|
@ -632,10 +632,10 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_HUNK:
|
case MEM_OBJ_HUNK:
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_LISTS:
|
case MEM_OBJ_LISTS:
|
||||||
%CFSMLWRITE list_table_t &foo->data.lists INTO fh;
|
%CFSMLWRITE list_table_t &foo->data.lists INTO fh;
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_NODES:
|
case MEM_OBJ_NODES:
|
||||||
%CFSMLWRITE node_table_t &foo->data.nodes INTO fh;
|
%CFSMLWRITE node_table_t &foo->data.nodes INTO fh;
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_DYNMEM:
|
case MEM_OBJ_DYNMEM:
|
||||||
|
@ -857,7 +857,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
|
||||||
|
|
||||||
if (!self->isSci1_1)
|
if (!self->isSci1_1)
|
||||||
scr->export_table += 3;
|
scr->export_table += 3;
|
||||||
|
|
||||||
for (j = 0; j < scr->objects_nr; j++) {
|
for (j = 0; j < scr->objects_nr; j++) {
|
||||||
byte *data = scr->buf + scr->objects[j].pos.offset;
|
byte *data = scr->buf + scr->objects[j].pos.offset;
|
||||||
scr->objects[j].base = scr->buf;
|
scr->objects[j].base = scr->buf;
|
||||||
|
@ -926,7 +926,7 @@ void reconstruct_clones(EngineState *s, SegManager *self) {
|
||||||
case MEM_OBJ_CLONES: {
|
case MEM_OBJ_CLONES: {
|
||||||
int j;
|
int j;
|
||||||
clone_entry_t *seeker = mobj->data.clones.table;
|
clone_entry_t *seeker = mobj->data.clones.table;
|
||||||
|
|
||||||
sciprintf("Free list: ");
|
sciprintf("Free list: ");
|
||||||
for (j = mobj->data.clones.first_free; j != HEAPENTRY_INVALID; j = mobj->data.clones.table[j].next_free) {
|
for (j = mobj->data.clones.first_free; j != HEAPENTRY_INVALID; j = mobj->data.clones.table[j].next_free) {
|
||||||
sciprintf("%d ", j);
|
sciprintf("%d ", j);
|
||||||
|
@ -941,7 +941,7 @@ void reconstruct_clones(EngineState *s, SegManager *self) {
|
||||||
sciprintf("\n");
|
sciprintf("\n");
|
||||||
|
|
||||||
for (j = 0; j < mobj->data.clones.max_entry; j++) {
|
for (j = 0; j < mobj->data.clones.max_entry; j++) {
|
||||||
object_t *base_obj;
|
object_t *base_obj;
|
||||||
|
|
||||||
if (!clone_entry_used(&mobj->data.clones, j)) {
|
if (!clone_entry_used(&mobj->data.clones, j)) {
|
||||||
seeker++;
|
seeker++;
|
||||||
|
|
|
@ -326,7 +326,7 @@ static char *_cfsml_unmangle_string(const char *s, unsigned int length) {
|
||||||
|
|
||||||
while ((source != end) && (c = *source++) && (c > 31)) {
|
while ((source != end) && (c = *source++) && (c > 31)) {
|
||||||
if (c == '\\') { // Escaped character?
|
if (c == '\\') { // Escaped character?
|
||||||
c = *source++;
|
c = *source++;
|
||||||
if ((c != '\\') && (c != '"')) // Un-escape 0-31 only
|
if ((c != '\\') && (c != '"')) // Un-escape 0-31 only
|
||||||
c -= ('a' - 1);
|
c -= ('a' - 1);
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc,
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -674,7 +674,7 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -771,7 +771,7 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -860,10 +860,10 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const
|
||||||
_cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->variables_nr = max ; // Set array size accordingly
|
save_struc->variables_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -962,7 +962,7 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1016,10 +1016,10 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con
|
||||||
_cfsml_error("Token expected by _cfsml_read_menu_t() for menus[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_menu_t() for menus[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->menus_nr = max ; // Set array size accordingly
|
save_struc->menus_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -1094,7 +1094,7 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1177,7 +1177,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1224,7 +1224,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_
|
||||||
_cfsml_error("Token expected by read_int_hash_map_node_tp() for nodes[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by read_int_hash_map_node_tp() for nodes[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
} else
|
} else
|
||||||
|
@ -1312,7 +1312,7 @@ _cfsml_read_SegManager(Common::SeekableReadStream *fh, SegManager* save_struc, c
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1373,10 +1373,10 @@ _cfsml_read_SegManager(Common::SeekableReadStream *fh, SegManager* save_struc, c
|
||||||
_cfsml_error("Token expected by read_mem_obj_tp() for heap[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by read_mem_obj_tp() for heap[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->heap_size = max ; // Set array size accordingly
|
save_struc->heap_size = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
if (!strcmp(token, "heap_size")) {
|
if (!strcmp(token, "heap_size")) {
|
||||||
#line 690 "engines/sci/engine/savegame.cfsml"
|
#line 690 "engines/sci/engine/savegame.cfsml"
|
||||||
|
@ -1506,7 +1506,7 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1661,7 +1661,7 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc,
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1729,7 +1729,7 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc,
|
||||||
_cfsml_error("Token expected by _cfsml_read_byte() for said[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_byte() for said[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
} else
|
} else
|
||||||
|
@ -1829,7 +1829,7 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -1943,7 +1943,7 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2011,10 +2011,10 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const
|
||||||
_cfsml_error("Token expected by _cfsml_read_byte() for buf[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_byte() for buf[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->size = max ; // Set array size accordingly
|
save_struc->size = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -2076,7 +2076,7 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2144,10 +2144,10 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t*
|
||||||
_cfsml_error("Token expected by read_reg_t() for locals[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by read_reg_t() for locals[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->nr = max ; // Set array size accordingly
|
save_struc->nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -2215,7 +2215,7 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2297,10 +2297,10 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru
|
||||||
_cfsml_error("Token expected by _cfsml_read_node_entry_t() for table[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_node_entry_t() for table[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->entries_nr = max ; // Set array size accordingly
|
save_struc->entries_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -2354,7 +2354,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2394,7 +2394,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st
|
||||||
_cfsml_error("Token expected by _cfsml_read_sys_string_t() for strings[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_sys_string_t() for strings[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
} else
|
} else
|
||||||
|
@ -2477,7 +2477,7 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2585,7 +2585,7 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2667,10 +2667,10 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru
|
||||||
_cfsml_error("Token expected by _cfsml_read_list_entry_t() for table[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_list_entry_t() for table[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->entries_nr = max ; // Set array size accordingly
|
save_struc->entries_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -2719,7 +2719,7 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2880,7 +2880,7 @@ _cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc,
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -2990,10 +2990,10 @@ _cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc,
|
||||||
_cfsml_error("Token expected by _cfsml_read_class_t() for classtable[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_class_t() for classtable[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->classtable_size = max ; // Set array size accordingly
|
save_struc->classtable_size = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
if (!strcmp(token, "sound")) {
|
if (!strcmp(token, "sound")) {
|
||||||
#line 690 "engines/sci/engine/savegame.cfsml"
|
#line 690 "engines/sci/engine/savegame.cfsml"
|
||||||
|
@ -3061,7 +3061,7 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3180,7 +3180,7 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3255,10 +3255,10 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha
|
||||||
_cfsml_error("Token expected by _cfsml_read_menu_item_t() for items[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_menu_item_t() for items[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->items_nr = max ; // Set array size accordingly
|
save_struc->items_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -3326,7 +3326,7 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3408,10 +3408,10 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st
|
||||||
_cfsml_error("Token expected by _cfsml_read_clone_entry_t() for table[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_clone_entry_t() for table[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->entries_nr = max ; // Set array size accordingly
|
save_struc->entries_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -3482,7 +3482,7 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3571,10 +3571,10 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c
|
||||||
_cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by read_reg_t() for variables[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->variables_nr = max ; // Set array size accordingly
|
save_struc->variables_nr = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
#line 699 "engines/sci/engine/savegame.cfsml"
|
#line 699 "engines/sci/engine/savegame.cfsml"
|
||||||
{
|
{
|
||||||
|
@ -3623,7 +3623,7 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3701,7 +3701,7 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3829,7 +3829,7 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
if (!assignment) {
|
if (!assignment) {
|
||||||
if (!strcmp(token, "}"))
|
if (!strcmp(token, "}"))
|
||||||
closed = 1;
|
closed = 1;
|
||||||
else {
|
else {
|
||||||
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
_cfsml_error("Expected assignment or closing braces in line %d\n", *line);
|
||||||
|
@ -3953,10 +3953,10 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
|
||||||
_cfsml_error("Token expected by _cfsml_read_object_t() for objects[i++] at line %d\n", *line);
|
_cfsml_error("Token expected by _cfsml_read_object_t() for objects[i++] at line %d\n", *line);
|
||||||
return CFSML_FAILURE;
|
return CFSML_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
done = 1;
|
done = 1;
|
||||||
} while (!done);
|
} while (!done);
|
||||||
save_struc->objects_allocated = max ; // Set array size accordingly
|
save_struc->objects_allocated = max ; // Set array size accordingly
|
||||||
} else
|
} else
|
||||||
if (!strcmp(token, "locals_offset")) {
|
if (!strcmp(token, "locals_offset")) {
|
||||||
#line 690 "engines/sci/engine/savegame.cfsml"
|
#line 690 "engines/sci/engine/savegame.cfsml"
|
||||||
|
@ -3991,7 +3991,7 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const
|
||||||
|
|
||||||
|
|
||||||
// Auto-generated CFSML declaration and function block ends here
|
// Auto-generated CFSML declaration and function block ends here
|
||||||
// Auto-generation performed by cfsml.pl 0.8.2
|
// Auto-generation performed by cfsml.pl 0.8.2
|
||||||
#line 447 "engines/sci/engine/savegame.cfsml"
|
#line 447 "engines/sci/engine/savegame.cfsml"
|
||||||
|
|
||||||
void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
|
void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) {
|
||||||
|
@ -4057,7 +4057,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha
|
||||||
// End of auto-generated CFSML data reader code
|
// End of auto-generated CFSML data reader code
|
||||||
#line 483 "engines/sci/engine/savegame.cfsml"
|
#line 483 "engines/sci/engine/savegame.cfsml"
|
||||||
song_lib_add(*songlib, newsong);
|
song_lib_add(*songlib, newsong);
|
||||||
}
|
}
|
||||||
l = fh->readLine(); // "]"
|
l = fh->readLine(); // "]"
|
||||||
l = fh->readLine(); // "}"
|
l = fh->readLine(); // "}"
|
||||||
*line += 2;
|
*line += 2;
|
||||||
|
@ -4202,7 +4202,7 @@ int read_int_hash_map_node_tp(Common::SeekableReadStream *fh, int_hash_map_t::no
|
||||||
sciprintf("Expected opening bracket in hash_map_node_t on line %d\n", *line);
|
sciprintf("Expected opening bracket in hash_map_node_t on line %d\n", *line);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
(*line)++;
|
(*line)++;
|
||||||
SRSgets(buffer, 80, fh);
|
SRSgets(buffer, 80, fh);
|
||||||
|
@ -4274,7 +4274,7 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
||||||
WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name);
|
WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name);
|
||||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||||
// Auto-generated CFSML data writer code
|
// Auto-generated CFSML data writer code
|
||||||
_cfsml_write_int(fh, &foo->segmgr_id);
|
_cfsml_write_int(fh, &foo->segmgr_id);
|
||||||
|
@ -4324,7 +4324,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_HUNK:
|
case MEM_OBJ_HUNK:
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_LISTS:
|
case MEM_OBJ_LISTS:
|
||||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||||
// Auto-generated CFSML data writer code
|
// Auto-generated CFSML data writer code
|
||||||
_cfsml_write_list_table_t(fh, &foo->data.lists);
|
_cfsml_write_list_table_t(fh, &foo->data.lists);
|
||||||
|
@ -4332,7 +4332,7 @@ void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) {
|
||||||
// End of auto-generated CFSML data writer code
|
// End of auto-generated CFSML data writer code
|
||||||
#line 637 "engines/sci/engine/savegame.cfsml"
|
#line 637 "engines/sci/engine/savegame.cfsml"
|
||||||
break;
|
break;
|
||||||
case MEM_OBJ_NODES:
|
case MEM_OBJ_NODES:
|
||||||
#line 814 "engines/sci/engine/savegame.cfsml"
|
#line 814 "engines/sci/engine/savegame.cfsml"
|
||||||
// Auto-generated CFSML data writer code
|
// Auto-generated CFSML data writer code
|
||||||
_cfsml_write_node_table_t(fh, &foo->data.nodes);
|
_cfsml_write_node_table_t(fh, &foo->data.nodes);
|
||||||
|
@ -4808,7 +4808,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
|
||||||
|
|
||||||
if (!self->isSci1_1)
|
if (!self->isSci1_1)
|
||||||
scr->export_table += 3;
|
scr->export_table += 3;
|
||||||
|
|
||||||
for (j = 0; j < scr->objects_nr; j++) {
|
for (j = 0; j < scr->objects_nr; j++) {
|
||||||
byte *data = scr->buf + scr->objects[j].pos.offset;
|
byte *data = scr->buf + scr->objects[j].pos.offset;
|
||||||
scr->objects[j].base = scr->buf;
|
scr->objects[j].base = scr->buf;
|
||||||
|
@ -4877,7 +4877,7 @@ void reconstruct_clones(EngineState *s, SegManager *self) {
|
||||||
case MEM_OBJ_CLONES: {
|
case MEM_OBJ_CLONES: {
|
||||||
int j;
|
int j;
|
||||||
clone_entry_t *seeker = mobj->data.clones.table;
|
clone_entry_t *seeker = mobj->data.clones.table;
|
||||||
|
|
||||||
sciprintf("Free list: ");
|
sciprintf("Free list: ");
|
||||||
for (j = mobj->data.clones.first_free; j != HEAPENTRY_INVALID; j = mobj->data.clones.table[j].next_free) {
|
for (j = mobj->data.clones.first_free; j != HEAPENTRY_INVALID; j = mobj->data.clones.table[j].next_free) {
|
||||||
sciprintf("%d ", j);
|
sciprintf("%d ", j);
|
||||||
|
@ -4892,7 +4892,7 @@ void reconstruct_clones(EngineState *s, SegManager *self) {
|
||||||
sciprintf("\n");
|
sciprintf("\n");
|
||||||
|
|
||||||
for (j = 0; j < mobj->data.clones.max_entry; j++) {
|
for (j = 0; j < mobj->data.clones.max_entry; j++) {
|
||||||
object_t *base_obj;
|
object_t *base_obj;
|
||||||
|
|
||||||
if (!clone_entry_used(&mobj->data.clones, j)) {
|
if (!clone_entry_used(&mobj->data.clones, j)) {
|
||||||
seeker++;
|
seeker++;
|
||||||
|
|
|
@ -78,7 +78,7 @@ char inputbuf[256] = "";
|
||||||
|
|
||||||
#define LOOKUP_SPECIES(species) (\
|
#define LOOKUP_SPECIES(species) (\
|
||||||
(species >= 1000) ? species : *(s->classtable[species].scriptposp) \
|
(species >= 1000) ? species : *(s->classtable[species].scriptposp) \
|
||||||
+ s->classtable[species].class_offset)
|
+ s->classtable[species].class_offset)
|
||||||
|
|
||||||
const char *_debug_get_input_default() {
|
const char *_debug_get_input_default() {
|
||||||
char newinpbuf[256];
|
char newinpbuf[256];
|
||||||
|
@ -2784,9 +2784,9 @@ int c_sci_version(EngineState *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// int c_sleep(EngineState *s) {
|
// int c_sleep(EngineState *s) {
|
||||||
// sleep(cmd_params[0].val);
|
// sleep(cmd_params[0].val);
|
||||||
//
|
//
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
static void _print_address(void * _, reg_t addr) {
|
static void _print_address(void * _, reg_t addr) {
|
||||||
|
@ -2860,7 +2860,7 @@ static int c_gc_list_reachable(EngineState *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, int *restadjust,
|
void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, int *restadjust,
|
||||||
seg_id_t *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) {
|
seg_id_t *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) {
|
||||||
// Do we support a separate console?
|
// Do we support a separate console?
|
||||||
|
|
||||||
if (sci_debug_flags & _DEBUG_FLAG_LOGGING) {
|
if (sci_debug_flags & _DEBUG_FLAG_LOGGING) {
|
||||||
|
@ -2936,7 +2936,7 @@ void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, r
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_debug_seeking = _DEBUG_SEEK_NOTHING;
|
_debug_seeking = _DEBUG_SEEK_NOTHING;
|
||||||
// OK, found whatever we were looking for
|
// OK, found whatever we were looking for
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3166,8 +3166,8 @@ void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, r
|
||||||
" sfx-01-track <song> <offset>\n\n"
|
" sfx-01-track <song> <offset>\n\n"
|
||||||
"SEE ALSO\n\n"
|
"SEE ALSO\n\n"
|
||||||
" sfx-01-header.1\n\n");
|
" sfx-01-header.1\n\n");
|
||||||
// con_hook_command(c_sleep, "sleep", "i", "Suspends everything for the\n"
|
// con_hook_command(c_sleep, "sleep", "i", "Suspends everything for the\n"
|
||||||
// " specified number of seconds");
|
// " specified number of seconds");
|
||||||
con_hook_command(c_gc_show_reachable, "gc-list-reachable", "!a",
|
con_hook_command(c_gc_show_reachable, "gc-list-reachable", "!a",
|
||||||
"Prints all addresses directly reachable from\n"
|
"Prints all addresses directly reachable from\n"
|
||||||
" the memory object specified as parameter.\n\n"
|
" the memory object specified as parameter.\n\n"
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Sci {
|
||||||
|
|
||||||
#undef DEBUG_SEG_MANAGER // Define to turn on debugging
|
#undef DEBUG_SEG_MANAGER // Define to turn on debugging
|
||||||
|
|
||||||
#define GET_SEGID() \
|
#define GET_SEGID() \
|
||||||
if (flag == SCRIPT_ID) \
|
if (flag == SCRIPT_ID) \
|
||||||
id = segGet(id); \
|
id = segGet(id); \
|
||||||
VERIFY(check(id), "invalid seg id");
|
VERIFY(check(id), "invalid seg id");
|
||||||
|
@ -383,10 +383,10 @@ mem_obj_t *SegManager::memObjAllocate(seg_id_t segid, int hash_id, memObjType ty
|
||||||
|
|
||||||
/* No longer in use?
|
/* No longer in use?
|
||||||
void SegManager::sm_object_init(object_t *object) {
|
void SegManager::sm_object_init(object_t *object) {
|
||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
object->variables_nr = 0;
|
object->variables_nr = 0;
|
||||||
object->variables = NULL;
|
object->variables = NULL;
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
void SegManager::freeScript(mem_obj_t *mem) {
|
void SegManager::freeScript(mem_obj_t *mem) {
|
||||||
|
@ -634,7 +634,7 @@ int SegManager::sm_hash_segment_data(int id) {
|
||||||
return 0;
|
return 0;
|
||||||
if (heap[id]->type == MEM_OBJ_NODES)
|
if (heap[id]->type == MEM_OBJ_NODES)
|
||||||
return 0;
|
return 0;
|
||||||
if (heap[id]->type == MEM_OBJ_CLONES)
|
if (heap[id]->type == MEM_OBJ_CLONES)
|
||||||
return 0;
|
return 0;
|
||||||
buf = (char *)dereference(make_reg(id, 0), &len);
|
buf = (char *)dereference(make_reg(id, 0), &len);
|
||||||
|
|
||||||
|
|
|
@ -158,11 +158,11 @@ public:
|
||||||
int getSynonymsNr(int id, idFlag flag);
|
int getSynonymsNr(int id, idFlag flag);
|
||||||
|
|
||||||
|
|
||||||
// 1b. Script Initialisation
|
// 1b. Script Initialisation
|
||||||
|
|
||||||
// The set of functions below are intended
|
// The set of functions below are intended
|
||||||
// to be used during script instantiation,
|
// to be used during script instantiation,
|
||||||
// i.e. loading and linking.
|
// i.e. loading and linking.
|
||||||
|
|
||||||
// Initializes a script's local variable block
|
// Initializes a script's local variable block
|
||||||
// Parameters: (seg_id_t) seg: Segment containing the script to initialize
|
// Parameters: (seg_id_t) seg: Segment containing the script to initialize
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
void scriptAddCodeBlock(reg_t location);
|
void scriptAddCodeBlock(reg_t location);
|
||||||
|
|
||||||
// Tells the segment manager whether exports are wide (32-bit) or not.
|
// Tells the segment manager whether exports are wide (32-bit) or not.
|
||||||
// Parameters: (int) flag: 1 if exports are wide, 0 otherwise
|
// Parameters: (int) flag: 1 if exports are wide, 0 otherwise
|
||||||
void setExportWidth(int flag);
|
void setExportWidth(int flag);
|
||||||
|
|
||||||
// Processes a relocation block witin a script
|
// Processes a relocation block witin a script
|
||||||
|
@ -249,7 +249,7 @@ public:
|
||||||
int scriptIsMarkedAsDeleted(seg_id_t seg);
|
int scriptIsMarkedAsDeleted(seg_id_t seg);
|
||||||
|
|
||||||
|
|
||||||
// 2. Clones
|
// 2. Clones
|
||||||
|
|
||||||
// Allocate a fresh clone
|
// Allocate a fresh clone
|
||||||
// Returns : (clone_t*): Reference to the memory allocated for the clone
|
// Returns : (clone_t*): Reference to the memory allocated for the clone
|
||||||
|
@ -261,9 +261,9 @@ public:
|
||||||
void free_clone(reg_t addr);
|
void free_clone(reg_t addr);
|
||||||
|
|
||||||
|
|
||||||
// 3. Objects (static, from Scripts, and dynmic, from Clones)
|
// 3. Objects (static, from Scripts, and dynmic, from Clones)
|
||||||
|
|
||||||
// Not all of these functions are fully operational for clones ATM
|
// Not all of these functions are fully operational for clones ATM
|
||||||
|
|
||||||
// Retrieves a 16 bit value from within a script's heap representation
|
// Retrieves a 16 bit value from within a script's heap representation
|
||||||
// Parameters: (reg_t) reg: The address to read from
|
// Parameters: (reg_t) reg: The address to read from
|
||||||
|
@ -287,7 +287,7 @@ public:
|
||||||
void mcpyInOut(int dst, const void *src, size_t n, int id, int flag);
|
void mcpyInOut(int dst, const void *src, size_t n, int id, int flag);
|
||||||
|
|
||||||
|
|
||||||
// 4. Stack
|
// 4. Stack
|
||||||
|
|
||||||
// Allocates a data stack
|
// Allocates a data stack
|
||||||
// Parameters: (int) size: Number of stack entries to reserve
|
// Parameters: (int) size: Number of stack entries to reserve
|
||||||
|
@ -296,7 +296,7 @@ public:
|
||||||
dstack_t *allocateStack(int size, seg_id_t *segid);
|
dstack_t *allocateStack(int size, seg_id_t *segid);
|
||||||
|
|
||||||
|
|
||||||
// 5. System Strings
|
// 5. System Strings
|
||||||
|
|
||||||
// Allocates a system string table
|
// Allocates a system string table
|
||||||
// Returns : (dstack_t *): The physical stack
|
// Returns : (dstack_t *): The physical stack
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
sys_strings_t *allocateSysStrings(seg_id_t *segid);
|
sys_strings_t *allocateSysStrings(seg_id_t *segid);
|
||||||
|
|
||||||
|
|
||||||
// 6, 7. Lists and Nodes
|
// 6, 7. Lists and Nodes
|
||||||
|
|
||||||
// Allocate a fresh list
|
// Allocate a fresh list
|
||||||
// Returns : (listY_t*): Reference to the memory allocated for the list
|
// Returns : (listY_t*): Reference to the memory allocated for the list
|
||||||
|
@ -362,7 +362,7 @@ public:
|
||||||
const char *getDescription(reg_t addr);
|
const char *getDescription(reg_t addr);
|
||||||
|
|
||||||
|
|
||||||
// 10. Reserved segments
|
// 10. Reserved segments
|
||||||
|
|
||||||
// Reserves a special-purpose segment
|
// Reserves a special-purpose segment
|
||||||
// Parameters: (char *) name: A string name identifying the segment (the string is cloned and retained)
|
// Parameters: (char *) name: A string name identifying the segment (the string is cloned and retained)
|
||||||
|
@ -372,7 +372,7 @@ public:
|
||||||
//seg_id_t sm_allocate_reserved_segment(char *name);
|
//seg_id_t sm_allocate_reserved_segment(char *name);
|
||||||
|
|
||||||
|
|
||||||
// Generic Operations on Segments and Addresses
|
// Generic Operations on Segments and Addresses
|
||||||
|
|
||||||
// Dereferences a raw memory pointer
|
// Dereferences a raw memory pointer
|
||||||
// Parameters: (reg_t) reg: The reference to dereference
|
// Parameters: (reg_t) reg: The reference to dereference
|
||||||
|
@ -449,7 +449,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 11. Segment interface, primarily for GC
|
// 11. Segment interface, primarily for GC
|
||||||
|
|
||||||
class SegInterface {
|
class SegInterface {
|
||||||
protected:
|
protected:
|
||||||
|
@ -464,7 +464,7 @@ public:
|
||||||
// For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)).
|
// For each valid address a, there exists a canonic address c(a) such that c(a) = c(c(a)).
|
||||||
// This address "governs" a in the sense that deallocating c(a) will deallocate a.
|
// This address "governs" a in the sense that deallocating c(a) will deallocate a.
|
||||||
virtual reg_t findCanonicAddress(reg_t sub_addr);
|
virtual reg_t findCanonicAddress(reg_t sub_addr);
|
||||||
|
|
||||||
// Deallocates all memory associated with the specified address
|
// Deallocates all memory associated with the specified address
|
||||||
// Parameters: (reg_t) sub_addr: The address (within the given segment) to deallocate
|
// Parameters: (reg_t) sub_addr: The address (within the given segment) to deallocate
|
||||||
virtual void freeAtAddress(reg_t sub_addr);
|
virtual void freeAtAddress(reg_t sub_addr);
|
||||||
|
@ -474,7 +474,7 @@ public:
|
||||||
// makes sense
|
// makes sense
|
||||||
// (void *) param: Parameter passed to 'note'
|
// (void *) param: Parameter passed to 'note'
|
||||||
virtual void listAllDeallocatable(void *param, void (*note)(void *param, reg_t addr));
|
virtual void listAllDeallocatable(void *param, void (*note)(void *param, reg_t addr));
|
||||||
|
|
||||||
// Iterates over all references reachable from the specified object
|
// Iterates over all references reachable from the specified object
|
||||||
// Parameters: (reg_t) object: The object (within the current segment) to analyse
|
// Parameters: (reg_t) object: The object (within the current segment) to analyse
|
||||||
// (void *) param: Parameter passed to 'note'
|
// (void *) param: Parameter passed to 'note'
|
||||||
|
|
|
@ -292,7 +292,7 @@ inline exec_stack_t *execute_method(EngineState *s, uint16 script, uint16 pubfun
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _exec_varselectors(EngineState *s) {
|
static void _exec_varselectors(EngineState *s) {
|
||||||
// Executes all varselector read/write ops on the TOS
|
// Executes all varselector read/write ops on the TOS
|
||||||
// Now check the TOS to execute all varselector entries
|
// Now check the TOS to execute all varselector entries
|
||||||
if (s->execution_stack_pos >= 0)
|
if (s->execution_stack_pos >= 0)
|
||||||
|
@ -461,7 +461,7 @@ exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, stac
|
||||||
// placed on the TOS; as soon as it returns, it will cause the second call to be executed.
|
// placed on the TOS; as soon as it returns, it will cause the second call to be executed.
|
||||||
for (; send_calls_nr >= 0; send_calls_nr--)
|
for (; send_calls_nr >= 0; send_calls_nr--)
|
||||||
if (send_calls[send_calls_nr].type == EXEC_STACK_TYPE_VARSELECTOR) // Write/read variable?
|
if (send_calls[send_calls_nr].type == EXEC_STACK_TYPE_VARSELECTOR) // Write/read variable?
|
||||||
retval = add_exec_stack_varselector(s, work_obj, send_calls[send_calls_nr].argc, send_calls[send_calls_nr].argp,
|
retval = add_exec_stack_varselector(s, work_obj, send_calls[send_calls_nr].argc, send_calls[send_calls_nr].argp,
|
||||||
send_calls[send_calls_nr].selector, send_calls[send_calls_nr].address.var, origin);
|
send_calls[send_calls_nr].selector, send_calls[send_calls_nr].address.var, origin);
|
||||||
else
|
else
|
||||||
retval = add_exec_stack_entry(s, send_calls[send_calls_nr].address.func, send_calls[send_calls_nr].sp, work_obj,
|
retval = add_exec_stack_entry(s, send_calls[send_calls_nr].address.func, send_calls[send_calls_nr].sp, work_obj,
|
||||||
|
@ -600,7 +600,7 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
object_t *obj = obj_get(s, xs->objp);
|
object_t *obj = obj_get(s, xs->objp);
|
||||||
script_t *local_script = script_locate_by_segment(s, xs->local_segment);
|
script_t *local_script = script_locate_by_segment(s, xs->local_segment);
|
||||||
int old_execution_stack_base = s->execution_stack_base;
|
int old_execution_stack_base = s->execution_stack_base;
|
||||||
// Used to detect the stack bottom, for "physical" returns
|
// Used to detect the stack bottom, for "physical" returns
|
||||||
byte *code_buf = NULL; // (Avoid spurious warning)
|
byte *code_buf = NULL; // (Avoid spurious warning)
|
||||||
|
|
||||||
if (!local_script) {
|
if (!local_script) {
|
||||||
|
@ -886,7 +886,7 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
|
|
||||||
case 0x0c: // not
|
case 0x0c: // not
|
||||||
s->r_acc = make_reg(0, !(s->r_acc.offset || s->r_acc.segment));
|
s->r_acc = make_reg(0, !(s->r_acc.offset || s->r_acc.segment));
|
||||||
// Must allow pointers to be negated, as this is used for checking whether objects exist
|
// Must allow pointers to be negated, as this is used for checking whether objects exist
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0d: // eq?
|
case 0x0d: // eq?
|
||||||
|
@ -913,76 +913,76 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
s->r_acc = ACC_ARITHMETIC_L((int16)POP() >= (int16)/*acc*/);
|
s->r_acc = ACC_ARITHMETIC_L((int16)POP() >= (int16)/*acc*/);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x11: // lt?
|
case 0x11: // lt?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
s->r_acc = ACC_ARITHMETIC_L((int16)POP() < (int16)/*acc*/);
|
s->r_acc = ACC_ARITHMETIC_L((int16)POP() < (int16)/*acc*/);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x12: // le?
|
case 0x12: // le?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
s->r_acc = ACC_ARITHMETIC_L((int16)POP() <= (int16)/*acc*/);
|
s->r_acc = ACC_ARITHMETIC_L((int16)POP() <= (int16)/*acc*/);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x13: // ugt?
|
case 0x13: // ugt?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
r_temp = POP32();
|
r_temp = POP32();
|
||||||
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset > s->r_acc.offset);
|
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset > s->r_acc.offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x14: // uge?
|
case 0x14: // uge?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
r_temp = POP32();
|
r_temp = POP32();
|
||||||
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset >= s->r_acc.offset);
|
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset >= s->r_acc.offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x15: // ult?
|
case 0x15: // ult?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
r_temp = POP32();
|
r_temp = POP32();
|
||||||
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset < s->r_acc.offset);
|
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset < s->r_acc.offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x16: // ule?
|
case 0x16: // ule?
|
||||||
s->r_prev = s->r_acc;
|
s->r_prev = s->r_acc;
|
||||||
r_temp = POP32();
|
r_temp = POP32();
|
||||||
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset <= s->r_acc.offset);
|
s->r_acc = make_reg(0, (r_temp.segment == s->r_acc.segment) && r_temp.offset <= s->r_acc.offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x17: // bt
|
case 0x17: // bt
|
||||||
if (s->r_acc.offset || s->r_acc.segment)
|
if (s->r_acc.offset || s->r_acc.segment)
|
||||||
xs->addr.pc.offset += opparams[0];
|
xs->addr.pc.offset += opparams[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x18: // bnt
|
case 0x18: // bnt
|
||||||
if (!(s->r_acc.offset || s->r_acc.segment))
|
if (!(s->r_acc.offset || s->r_acc.segment))
|
||||||
xs->addr.pc.offset += opparams[0];
|
xs->addr.pc.offset += opparams[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x19: // jmp
|
case 0x19: // jmp
|
||||||
xs->addr.pc.offset += opparams[0];
|
xs->addr.pc.offset += opparams[0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1a: // ldi
|
case 0x1a: // ldi
|
||||||
s->r_acc = make_reg(0, opparams[0]);
|
s->r_acc = make_reg(0, opparams[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1b: // push
|
case 0x1b: // push
|
||||||
PUSH32(s->r_acc);
|
PUSH32(s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1c: // pushi
|
case 0x1c: // pushi
|
||||||
PUSH(opparams[0]);
|
PUSH(opparams[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1d: // toss
|
case 0x1d: // toss
|
||||||
xs->sp--;
|
xs->sp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1e: // dup
|
case 0x1e: // dup
|
||||||
r_temp = xs->sp[-1];
|
r_temp = xs->sp[-1];
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1f: { // link
|
case 0x1f: { // link
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < opparams[0]; i++)
|
for (i = 0; i < opparams[0]; i++)
|
||||||
xs->sp[i] = NULL_REG;
|
xs->sp[i] = NULL_REG;
|
||||||
|
@ -990,8 +990,8 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x20: { // call
|
case 0x20: { // call
|
||||||
int argc = (opparams[1] >> 1) // Given as offset, but we need count
|
int argc = (opparams[1] >> 1) // Given as offset, but we need count
|
||||||
+ 1 + restadjust;
|
+ 1 + restadjust;
|
||||||
stack_ptr_t call_base = xs->sp - argc;
|
stack_ptr_t call_base = xs->sp - argc;
|
||||||
|
|
||||||
|
@ -999,20 +999,20 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
xs_new = add_exec_stack_entry(s, make_reg(xs->addr.pc.segment, xs->addr.pc.offset + opparams[0]),
|
xs_new = add_exec_stack_entry(s, make_reg(xs->addr.pc.segment, xs->addr.pc.offset + opparams[0]),
|
||||||
xs->sp, xs->objp, (validate_arithmetic(*call_base)) + restadjust,
|
xs->sp, xs->objp, (validate_arithmetic(*call_base)) + restadjust,
|
||||||
call_base, NULL_SELECTOR, xs->objp, s->execution_stack_pos, xs->local_segment);
|
call_base, NULL_SELECTOR, xs->objp, s->execution_stack_pos, xs->local_segment);
|
||||||
restadjust = 0; // Used up the &rest adjustment
|
restadjust = 0; // Used up the &rest adjustment
|
||||||
xs->sp = call_base;
|
xs->sp = call_base;
|
||||||
|
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x21: // callk
|
case 0x21: // callk
|
||||||
gc_countdown(s);
|
gc_countdown(s);
|
||||||
|
|
||||||
xs->sp -= (opparams[1] >> 1) + 1;
|
xs->sp -= (opparams[1] >> 1) + 1;
|
||||||
if (s->version >= SCI_VERSION_FTU_NEW_SCRIPT_HEADER) {
|
if (s->version >= SCI_VERSION_FTU_NEW_SCRIPT_HEADER) {
|
||||||
xs->sp -= restadjust;
|
xs->sp -= restadjust;
|
||||||
s->r_amp_rest = 0; // We just used up the restadjust, remember?
|
s->r_amp_rest = 0; // We just used up the restadjust, remember?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opparams[0] >= s->kfunct_nr) {
|
if (opparams[0] >= s->kfunct_nr) {
|
||||||
|
@ -1031,10 +1031,10 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
} else {
|
} else {
|
||||||
s->r_acc = s->kfunct_table[opparams[0]].fun(s, opparams[0], argc, xs->sp + 1);
|
s->r_acc = s->kfunct_table[opparams[0]].fun(s, opparams[0], argc, xs->sp + 1);
|
||||||
}
|
}
|
||||||
// Call kernel function
|
// Call kernel function
|
||||||
|
|
||||||
// Calculate xs again: The kernel function might
|
// Calculate xs again: The kernel function might
|
||||||
// have spawned a new VM
|
// have spawned a new VM
|
||||||
|
|
||||||
xs_new = s->execution_stack + s->execution_stack_pos;
|
xs_new = s->execution_stack + s->execution_stack_pos;
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
|
@ -1045,77 +1045,77 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x22: // callb
|
case 0x22: // callb
|
||||||
temp = ((opparams[1] >> 1) + restadjust + 1);
|
temp = ((opparams[1] >> 1) + restadjust + 1);
|
||||||
s_temp = xs->sp;
|
s_temp = xs->sp;
|
||||||
xs->sp -= temp;
|
xs->sp -= temp;
|
||||||
|
|
||||||
xs->sp[0].offset += restadjust;
|
xs->sp[0].offset += restadjust;
|
||||||
xs_new = execute_method(s, 0, opparams[0], s_temp, xs->objp, xs->sp[0].offset, xs->sp);
|
xs_new = execute_method(s, 0, opparams[0], s_temp, xs->objp, xs->sp[0].offset, xs->sp);
|
||||||
restadjust = 0; // Used up the &rest adjustment
|
restadjust = 0; // Used up the &rest adjustment
|
||||||
if (xs_new) // in case of error, keep old stack
|
if (xs_new) // in case of error, keep old stack
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x23: // calle
|
case 0x23: // calle
|
||||||
temp = ((opparams[2] >> 1) + restadjust + 1);
|
temp = ((opparams[2] >> 1) + restadjust + 1);
|
||||||
s_temp = xs->sp;
|
s_temp = xs->sp;
|
||||||
xs->sp -= temp;
|
xs->sp -= temp;
|
||||||
|
|
||||||
xs->sp[0].offset += restadjust;
|
xs->sp[0].offset += restadjust;
|
||||||
xs_new = execute_method(s, opparams[0], opparams[1], s_temp, xs->objp, xs->sp[0].offset, xs->sp);
|
xs_new = execute_method(s, opparams[0], opparams[1], s_temp, xs->objp, xs->sp[0].offset, xs->sp);
|
||||||
restadjust = 0; // Used up the &rest adjustment
|
restadjust = 0; // Used up the &rest adjustment
|
||||||
|
|
||||||
if (xs_new) // in case of error, keep old stack
|
if (xs_new) // in case of error, keep old stack
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x24: // ret
|
case 0x24: // ret
|
||||||
do {
|
do {
|
||||||
stack_ptr_t old_sp2 = xs->sp;
|
stack_ptr_t old_sp2 = xs->sp;
|
||||||
stack_ptr_t old_fp = xs->fp;
|
stack_ptr_t old_fp = xs->fp;
|
||||||
exec_stack_t *old_xs = s->execution_stack + s->execution_stack_pos;
|
exec_stack_t *old_xs = s->execution_stack + s->execution_stack_pos;
|
||||||
|
|
||||||
if (s->execution_stack_pos == s->execution_stack_base) { // Have we reached the base?
|
if (s->execution_stack_pos == s->execution_stack_base) { // Have we reached the base?
|
||||||
s->execution_stack_base = old_execution_stack_base; // Restore stack base
|
s->execution_stack_base = old_execution_stack_base; // Restore stack base
|
||||||
|
|
||||||
--(s->execution_stack_pos);
|
--(s->execution_stack_pos);
|
||||||
|
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
s->r_amp_rest = restadjust; // Update &rest
|
s->r_amp_rest = restadjust; // Update &rest
|
||||||
return; // "Hard" return
|
return; // "Hard" return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_xs->type == EXEC_STACK_TYPE_VARSELECTOR) {
|
if (old_xs->type == EXEC_STACK_TYPE_VARSELECTOR) {
|
||||||
// varselector access?
|
// varselector access?
|
||||||
if (old_xs->argc) // write?
|
if (old_xs->argc) // write?
|
||||||
*(old_xs->addr.varp) = old_xs->variables_argp[1];
|
*(old_xs->addr.varp) = old_xs->variables_argp[1];
|
||||||
else // No, read
|
else // No, read
|
||||||
s->r_acc = *(old_xs->addr.varp);
|
s->r_acc = *(old_xs->addr.varp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not reached the base, so let's do a soft return
|
// Not reached the base, so let's do a soft return
|
||||||
--(s->execution_stack_pos);
|
--(s->execution_stack_pos);
|
||||||
xs = old_xs - 1;
|
xs = old_xs - 1;
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
xs = s->execution_stack + s->execution_stack_pos;
|
xs = s->execution_stack + s->execution_stack_pos;
|
||||||
|
|
||||||
if (xs->sp == CALL_SP_CARRY // Used in sends to 'carry' the stack pointer
|
if (xs->sp == CALL_SP_CARRY // Used in sends to 'carry' the stack pointer
|
||||||
|| xs->type != EXEC_STACK_TYPE_CALL) {
|
|| xs->type != EXEC_STACK_TYPE_CALL) {
|
||||||
xs->sp = old_sp2;
|
xs->sp = old_sp2;
|
||||||
xs->fp = old_fp;
|
xs->fp = old_fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (xs->type == EXEC_STACK_TYPE_VARSELECTOR);
|
} while (xs->type == EXEC_STACK_TYPE_VARSELECTOR);
|
||||||
// Iterate over all varselector accesses
|
// Iterate over all varselector accesses
|
||||||
s->execution_stack_pos_changed = 1;
|
s->execution_stack_pos_changed = 1;
|
||||||
xs_new = xs;
|
xs_new = xs;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x25: // send
|
case 0x25: // send
|
||||||
s_temp = xs->sp;
|
s_temp = xs->sp;
|
||||||
xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack
|
xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack
|
||||||
|
|
||||||
xs->sp[1].offset += restadjust;
|
xs->sp[1].offset += restadjust;
|
||||||
xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
|
xs_new = send_selector(s, s->r_acc, s->r_acc, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
|
||||||
|
@ -1127,13 +1127,13 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x28: // class
|
case 0x28: // class
|
||||||
s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, xs->addr.pc);
|
s->r_acc = get_class_address(s, (unsigned)opparams[0], SCRIPT_GET_LOCK, xs->addr.pc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2a: // self
|
case 0x2a: // self
|
||||||
s_temp = xs->sp;
|
s_temp = xs->sp;
|
||||||
xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack
|
xs->sp -= ((opparams[0] >> 1) + restadjust); // Adjust stack
|
||||||
|
|
||||||
xs->sp[1].offset += restadjust;
|
xs->sp[1].offset += restadjust;
|
||||||
xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
|
xs_new = send_selector(s, xs->objp, xs->objp, s_temp, (int)(opparams[0] >> 1) + (uint16)restadjust, xs->sp);
|
||||||
|
@ -1144,14 +1144,14 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
restadjust = 0;
|
restadjust = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2b: // super
|
case 0x2b: // super
|
||||||
r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, xs->addr.pc);
|
r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, xs->addr.pc);
|
||||||
|
|
||||||
if (!r_temp.segment)
|
if (!r_temp.segment)
|
||||||
CORE_ERROR("VM", "Invalid superclass in object");
|
CORE_ERROR("VM", "Invalid superclass in object");
|
||||||
else {
|
else {
|
||||||
s_temp = xs->sp;
|
s_temp = xs->sp;
|
||||||
xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack
|
xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack
|
||||||
|
|
||||||
xs->sp[1].offset += restadjust;
|
xs->sp[1].offset += restadjust;
|
||||||
xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (uint16)restadjust, xs->sp);
|
xs_new = send_selector(s, r_temp, xs->objp, s_temp, (int)(opparams[1] >> 1) + (uint16)restadjust, xs->sp);
|
||||||
|
@ -1164,9 +1164,9 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2c: // &rest
|
case 0x2c: // &rest
|
||||||
temp = (uint16) opparams[0]; // First argument
|
temp = (uint16) opparams[0]; // First argument
|
||||||
restadjust = xs->argc - temp + 1; // +1 because temp counts the paramcount while argc doesn't
|
restadjust = xs->argc - temp + 1; // +1 because temp counts the paramcount while argc doesn't
|
||||||
if (restadjust < 0)
|
if (restadjust < 0)
|
||||||
restadjust = 0;
|
restadjust = 0;
|
||||||
|
|
||||||
|
@ -1175,72 +1175,72 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2d: // lea
|
case 0x2d: // lea
|
||||||
temp = (uint16) opparams[0] >> 1;
|
temp = (uint16) opparams[0] >> 1;
|
||||||
var_number = temp & 0x03; // Get variable type
|
var_number = temp & 0x03; // Get variable type
|
||||||
|
|
||||||
// Get variable block offset
|
// Get variable block offset
|
||||||
r_temp.segment = variables_seg[var_number];
|
r_temp.segment = variables_seg[var_number];
|
||||||
r_temp.offset = variables[var_number] - variables_base[var_number];
|
r_temp.offset = variables[var_number] - variables_base[var_number];
|
||||||
|
|
||||||
if (temp & 0x08) // Add accumulator offset if requested
|
if (temp & 0x08) // Add accumulator offset if requested
|
||||||
r_temp.offset += signed_validate_arithmetic(s->r_acc);
|
r_temp.offset += signed_validate_arithmetic(s->r_acc);
|
||||||
|
|
||||||
r_temp.offset += opparams[1]; // Add index
|
r_temp.offset += opparams[1]; // Add index
|
||||||
r_temp.offset *= sizeof(reg_t);
|
r_temp.offset *= sizeof(reg_t);
|
||||||
// That's the immediate address now
|
// That's the immediate address now
|
||||||
s->r_acc = r_temp;
|
s->r_acc = r_temp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 0x2e: // selfID
|
case 0x2e: // selfID
|
||||||
s->r_acc = xs->objp;
|
s->r_acc = xs->objp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x30: // pprev
|
case 0x30: // pprev
|
||||||
PUSH32(s->r_prev);
|
PUSH32(s->r_prev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x31: // pToa
|
case 0x31: // pToa
|
||||||
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x32: // aTop
|
case 0x32: // aTop
|
||||||
OBJ_PROPERTY(obj, (opparams[0] >> 1)) = s->r_acc;
|
OBJ_PROPERTY(obj, (opparams[0] >> 1)) = s->r_acc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x33: // pTos
|
case 0x33: // pTos
|
||||||
PUSH32(OBJ_PROPERTY(obj, opparams[0] >> 1));
|
PUSH32(OBJ_PROPERTY(obj, opparams[0] >> 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x34: // sTop
|
case 0x34: // sTop
|
||||||
OBJ_PROPERTY(obj, (opparams[0] >> 1)) = POP32();
|
OBJ_PROPERTY(obj, (opparams[0] >> 1)) = POP32();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x35: // ipToa
|
case 0x35: // ipToa
|
||||||
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
||||||
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(1 + /*acc*/);
|
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(1 + /*acc*/);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x36: // dpToa
|
case 0x36: // dpToa
|
||||||
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1));
|
||||||
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(-1 + /*acc*/);
|
s->r_acc = OBJ_PROPERTY(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(-1 + /*acc*/);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x37: // ipTos
|
case 0x37: // ipTos
|
||||||
ASSERT_ARITHMETIC(OBJ_PROPERTY(obj, (opparams[0] >> 1)));
|
ASSERT_ARITHMETIC(OBJ_PROPERTY(obj, (opparams[0] >> 1)));
|
||||||
temp = ++OBJ_PROPERTY(obj, (opparams[0] >> 1)).offset;
|
temp = ++OBJ_PROPERTY(obj, (opparams[0] >> 1)).offset;
|
||||||
PUSH(temp);
|
PUSH(temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x38: // dpTos
|
case 0x38: // dpTos
|
||||||
ASSERT_ARITHMETIC(OBJ_PROPERTY(obj, (opparams[0] >> 1)));
|
ASSERT_ARITHMETIC(OBJ_PROPERTY(obj, (opparams[0] >> 1)));
|
||||||
temp = --OBJ_PROPERTY(obj, (opparams[0] >> 1)).offset;
|
temp = --OBJ_PROPERTY(obj, (opparams[0] >> 1)).offset;
|
||||||
PUSH(temp);
|
PUSH(temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 0x39: // lofsa
|
case 0x39: // lofsa
|
||||||
s->r_acc.segment = xs->addr.pc.segment;
|
s->r_acc.segment = xs->addr.pc.segment;
|
||||||
|
|
||||||
if (s->version >= SCI_VERSION(1, 001, 000))
|
if (s->version >= SCI_VERSION(1, 001, 000))
|
||||||
|
@ -1259,7 +1259,7 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3a: // lofss
|
case 0x3a: // lofss
|
||||||
r_temp.segment = xs->addr.pc.segment;
|
r_temp.segment = xs->addr.pc.segment;
|
||||||
|
|
||||||
if (s->version >= SCI_VERSION_FTU_LOFS_ABSOLUTE)
|
if (s->version >= SCI_VERSION_FTU_LOFS_ABSOLUTE)
|
||||||
|
@ -1276,175 +1276,175 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3b: // push0
|
case 0x3b: // push0
|
||||||
PUSH(0);
|
PUSH(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3c: // push1
|
case 0x3c: // push1
|
||||||
PUSH(1);
|
PUSH(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3d: // push2
|
case 0x3d: // push2
|
||||||
PUSH(2);
|
PUSH(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3e: // pushSelf
|
case 0x3e: // pushSelf
|
||||||
PUSH32(xs->objp);
|
PUSH32(xs->objp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x40: // lag
|
case 0x40: // lag
|
||||||
case 0x41: // lal
|
case 0x41: // lal
|
||||||
case 0x42: // lat
|
case 0x42: // lat
|
||||||
case 0x43: // lap
|
case 0x43: // lap
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
s->r_acc = READ_VAR(var_type, var_number, s->r_acc);
|
s->r_acc = READ_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x44: // lsg
|
case 0x44: // lsg
|
||||||
case 0x45: // lsl
|
case 0x45: // lsl
|
||||||
case 0x46: // lst
|
case 0x46: // lst
|
||||||
case 0x47: // lsp
|
case 0x47: // lsp
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
PUSH32(READ_VAR(var_type, var_number, s->r_acc));
|
PUSH32(READ_VAR(var_type, var_number, s->r_acc));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x48: // lagi
|
case 0x48: // lagi
|
||||||
case 0x49: // lali
|
case 0x49: // lali
|
||||||
case 0x4a: // lati
|
case 0x4a: // lati
|
||||||
case 0x4b: // lapi
|
case 0x4b: // lapi
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
s->r_acc = READ_VAR(var_type, var_number, s->r_acc);
|
s->r_acc = READ_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x4c: // lsgi
|
case 0x4c: // lsgi
|
||||||
case 0x4d: // lsli
|
case 0x4d: // lsli
|
||||||
case 0x4e: // lsti
|
case 0x4e: // lsti
|
||||||
case 0x4f: // lspi
|
case 0x4f: // lspi
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
PUSH32(READ_VAR(var_type, var_number, s->r_acc));
|
PUSH32(READ_VAR(var_type, var_number, s->r_acc));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x50: // sag
|
case 0x50: // sag
|
||||||
case 0x51: // sal
|
case 0x51: // sal
|
||||||
case 0x52: // sat
|
case 0x52: // sat
|
||||||
case 0x53: // sap
|
case 0x53: // sap
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc);
|
WRITE_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x54: // ssg
|
case 0x54: // ssg
|
||||||
case 0x55: // ssl
|
case 0x55: // ssl
|
||||||
case 0x56: // sst
|
case 0x56: // sst
|
||||||
case 0x57: // ssp
|
case 0x57: // ssp
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
WRITE_VAR(var_type, var_number, POP32());
|
WRITE_VAR(var_type, var_number, POP32());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x58: // sagi
|
case 0x58: // sagi
|
||||||
case 0x59: // sali
|
case 0x59: // sali
|
||||||
case 0x5a: // sati
|
case 0x5a: // sati
|
||||||
case 0x5b: // sapi
|
case 0x5b: // sapi
|
||||||
// Special semantics because it wouldn't really make a whole lot
|
// Special semantics because it wouldn't really make a whole lot
|
||||||
// of sense otherwise, with acc being used for two things
|
// of sense otherwise, with acc being used for two things
|
||||||
// simultaneously...
|
// simultaneously...
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc = POP32());
|
WRITE_VAR(var_type, var_number, s->r_acc = POP32());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x5c: // ssgi
|
case 0x5c: // ssgi
|
||||||
case 0x5d: // ssli
|
case 0x5d: // ssli
|
||||||
case 0x5e: // ssti
|
case 0x5e: // ssti
|
||||||
case 0x5f: // sspi
|
case 0x5f: // sspi
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
WRITE_VAR(var_type, var_number, POP32());
|
WRITE_VAR(var_type, var_number, POP32());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x60: // +ag
|
case 0x60: // +ag
|
||||||
case 0x61: // +al
|
case 0x61: // +al
|
||||||
case 0x62: // +at
|
case 0x62: // +at
|
||||||
case 0x63: // +ap
|
case 0x63: // +ap
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
s->r_acc = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
s->r_acc = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc);
|
WRITE_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x64: // +sg
|
case 0x64: // +sg
|
||||||
case 0x65: // +sl
|
case 0x65: // +sl
|
||||||
case 0x66: // +st
|
case 0x66: // +st
|
||||||
case 0x67: // +sp
|
case 0x67: // +sp
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
r_temp = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
r_temp = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
WRITE_VAR(var_type, var_number, r_temp);
|
WRITE_VAR(var_type, var_number, r_temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x68: // +agi
|
case 0x68: // +agi
|
||||||
case 0x69: // +ali
|
case 0x69: // +ali
|
||||||
case 0x6a: // +ati
|
case 0x6a: // +ati
|
||||||
case 0x6b: // +api
|
case 0x6b: // +api
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
s->r_acc = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
s->r_acc = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc);
|
WRITE_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x6c: // +sgi
|
case 0x6c: // +sgi
|
||||||
case 0x6d: // +sli
|
case 0x6d: // +sli
|
||||||
case 0x6e: // +sti
|
case 0x6e: // +sti
|
||||||
case 0x6f: // +spi
|
case 0x6f: // +spi
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
r_temp = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
r_temp = make_reg(0, 1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
WRITE_VAR(var_type, var_number, r_temp);
|
WRITE_VAR(var_type, var_number, r_temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x70: // -ag
|
case 0x70: // -ag
|
||||||
case 0x71: // -al
|
case 0x71: // -al
|
||||||
case 0x72: // -at
|
case 0x72: // -at
|
||||||
case 0x73: // -ap
|
case 0x73: // -ap
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
s->r_acc = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
s->r_acc = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc);
|
WRITE_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x74: // -sg
|
case 0x74: // -sg
|
||||||
case 0x75: // -sl
|
case 0x75: // -sl
|
||||||
case 0x76: // -st
|
case 0x76: // -st
|
||||||
case 0x77: // -sp
|
case 0x77: // -sp
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0];
|
var_number = opparams[0];
|
||||||
r_temp = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
r_temp = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
WRITE_VAR(var_type, var_number, r_temp);
|
WRITE_VAR(var_type, var_number, r_temp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x78: // -agi
|
case 0x78: // -agi
|
||||||
case 0x79: // -ali
|
case 0x79: // -ali
|
||||||
case 0x7a: // -ati
|
case 0x7a: // -ati
|
||||||
case 0x7b: // -api
|
case 0x7b: // -api
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
s->r_acc = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
s->r_acc = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
WRITE_VAR(var_type, var_number, s->r_acc);
|
WRITE_VAR(var_type, var_number, s->r_acc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x7c: // -sgi
|
case 0x7c: // -sgi
|
||||||
case 0x7d: // -sli
|
case 0x7d: // -sli
|
||||||
case 0x7e: // -sti
|
case 0x7e: // -sti
|
||||||
case 0x7f: // -spi
|
case 0x7f: // -spi
|
||||||
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
var_type = (opcode >> 1) & 0x3; // Gets the variable type: g, l, t or p
|
||||||
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
var_number = opparams[0] + signed_validate_arithmetic(s->r_acc);
|
||||||
r_temp = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
r_temp = make_reg(0, -1 + validate_arithmetic(READ_VAR(var_type, var_number, s->r_acc)));
|
||||||
PUSH32(r_temp);
|
PUSH32(r_temp);
|
||||||
|
@ -1454,9 +1454,9 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
default:
|
default:
|
||||||
script_error(s, __FILE__, __LINE__, "Illegal opcode");
|
script_error(s, __FILE__, __LINE__, "Illegal opcode");
|
||||||
|
|
||||||
} // switch(opcode >> 1)
|
} // switch(opcode >> 1)
|
||||||
|
|
||||||
if (s->execution_stack_pos_changed) // Force initialization
|
if (s->execution_stack_pos_changed) // Force initialization
|
||||||
xs = xs_new;
|
xs = xs_new;
|
||||||
|
|
||||||
#ifndef DISABLE_VALIDATIONS
|
#ifndef DISABLE_VALIDATIONS
|
||||||
|
@ -1465,8 +1465,8 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (script_error_flag) {
|
if (script_error_flag) {
|
||||||
_debug_step_running = 0; // Stop multiple execution
|
_debug_step_running = 0; // Stop multiple execution
|
||||||
_debug_seeking = 0; // Stop special seeks
|
_debug_seeking = 0; // Stop special seeks
|
||||||
xs->addr.pc.offset = old_pc_offset;
|
xs->addr.pc.offset = old_pc_offset;
|
||||||
xs->sp = old_sp;
|
xs->sp = old_sp;
|
||||||
} else
|
} else
|
||||||
|
@ -1475,8 +1475,8 @@ void run_vm(EngineState *s, int restoring) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selector_t slc) {
|
static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selector_t slc) {
|
||||||
// Determines if obj explicitly defines slc as a varselector
|
// Determines if obj explicitly defines slc as a varselector
|
||||||
// Returns -1 if not found
|
// Returns -1 if not found
|
||||||
|
|
||||||
if (s->version < SCI_VERSION(1, 001, 000)) {
|
if (s->version < SCI_VERSION(1, 001, 000)) {
|
||||||
int varnum = obj->variable_names_nr;
|
int varnum = obj->variable_names_nr;
|
||||||
|
@ -1487,10 +1487,10 @@ static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selecto
|
||||||
obj->base_vars = (uint16 *) buf;
|
obj->base_vars = (uint16 *) buf;
|
||||||
|
|
||||||
for (i = 0; i < varnum; i++)
|
for (i = 0; i < varnum; i++)
|
||||||
if (getUInt16(buf + (i << 1)) == slc) // Found it?
|
if (getUInt16(buf + (i << 1)) == slc) // Found it?
|
||||||
return i; // report success
|
return i; // report success
|
||||||
|
|
||||||
return -1; // Failed
|
return -1; // Failed
|
||||||
} else {
|
} else {
|
||||||
byte *buf = (byte *) obj->base_vars;
|
byte *buf = (byte *) obj->base_vars;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1500,31 +1500,31 @@ static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selecto
|
||||||
buf = ((byte *) obj_get(s, obj->variables[SCRIPT_SUPERCLASS_SELECTOR])->base_vars);
|
buf = ((byte *) obj_get(s, obj->variables[SCRIPT_SUPERCLASS_SELECTOR])->base_vars);
|
||||||
|
|
||||||
for (i = 0; i < varnum; i++)
|
for (i = 0; i < varnum; i++)
|
||||||
if (getUInt16(buf + (i << 1)) == slc) // Found it?
|
if (getUInt16(buf + (i << 1)) == slc) // Found it?
|
||||||
return i; // report success
|
return i; // report success
|
||||||
|
|
||||||
return -1; // Failed
|
return -1; // Failed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _class_locate_funcselector(EngineState *s, object_t *obj, selector_t slc) {
|
static inline int _class_locate_funcselector(EngineState *s, object_t *obj, selector_t slc) {
|
||||||
// Determines if obj is a class and explicitly defines slc as a funcselector
|
// Determines if obj is a class and explicitly defines slc as a funcselector
|
||||||
// Does NOT say anything about obj's superclasses, i.e. failure may be
|
// Does NOT say anything about obj's superclasses, i.e. failure may be
|
||||||
// returned even if one of the superclasses defines the funcselector.
|
// returned even if one of the superclasses defines the funcselector.
|
||||||
int funcnum = obj->methods_nr;
|
int funcnum = obj->methods_nr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < funcnum; i++)
|
for (i = 0; i < funcnum; i++)
|
||||||
if (VM_OBJECT_GET_FUNCSELECTOR(obj, i) == slc) // Found it?
|
if (VM_OBJECT_GET_FUNCSELECTOR(obj, i) == slc) // Found it?
|
||||||
return i; // report success
|
return i; // report success
|
||||||
|
|
||||||
return -1; // Failed
|
return -1; // Failed
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _lookup_selector_function(EngineState *s, int seg_id, object_t *obj, selector_t selector_id, reg_t *fptr) {
|
static inline int _lookup_selector_function(EngineState *s, int seg_id, object_t *obj, selector_t selector_id, reg_t *fptr) {
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
// "recursive" lookup
|
// "recursive" lookup
|
||||||
|
|
||||||
while (obj) {
|
while (obj) {
|
||||||
index = _class_locate_funcselector(s, obj, selector_id);
|
index = _class_locate_funcselector(s, obj, selector_id);
|
||||||
|
@ -1553,7 +1553,7 @@ int lookup_selector(EngineState *s, reg_t obj_location, selector_t selector_id,
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
// Early SCI versions used the LSB in the selector ID as a read/write
|
// Early SCI versions used the LSB in the selector ID as a read/write
|
||||||
// toggle, meaning that we must remove it for selector lookup.
|
// toggle, meaning that we must remove it for selector lookup.
|
||||||
if (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER)
|
if (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER)
|
||||||
selector_id &= ~1;
|
selector_id &= ~1;
|
||||||
|
|
||||||
|
@ -1579,7 +1579,7 @@ int lookup_selector(EngineState *s, reg_t obj_location, selector_t selector_id,
|
||||||
index = _obj_locate_varselector(s, obj, selector_id);
|
index = _obj_locate_varselector(s, obj, selector_id);
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
// Found it as a variable
|
// Found it as a variable
|
||||||
if (vptr)
|
if (vptr)
|
||||||
*vptr = obj->variables + index;
|
*vptr = obj->variables + index;
|
||||||
return SELECTOR_VARIABLE;
|
return SELECTOR_VARIABLE;
|
||||||
|
@ -1588,7 +1588,7 @@ int lookup_selector(EngineState *s, reg_t obj_location, selector_t selector_id,
|
||||||
return _lookup_selector_function(s, obj_location.segment, obj, selector_id, fptr);
|
return _lookup_selector_function(s, obj_location.segment, obj, selector_id, fptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detects SCI versions by their different script header
|
// Detects SCI versions by their different script header
|
||||||
void script_detect_versions(EngineState *s) {
|
void script_detect_versions(EngineState *s) {
|
||||||
int c;
|
int c;
|
||||||
resource_t *script = {0};
|
resource_t *script = {0};
|
||||||
|
@ -1683,7 +1683,7 @@ int script_instantiate_common(EngineState *s, int script_nr, resource_t **script
|
||||||
|
|
||||||
if (!*script || (s->version >= SCI_VERSION(1, 001, 000) && !heap)) {
|
if (!*script || (s->version >= SCI_VERSION(1, 001, 000) && !heap)) {
|
||||||
sciprintf("Script 0x%x requested but not found\n", script_nr);
|
sciprintf("Script 0x%x requested but not found\n", script_nr);
|
||||||
//script_debug_flag = script_error_flag = 1;
|
//script_debug_flag = script_error_flag = 1;
|
||||||
if (s->version >= SCI_VERSION(1, 001, 000)) {
|
if (s->version >= SCI_VERSION(1, 001, 000)) {
|
||||||
if (*heap)
|
if (*heap)
|
||||||
sciprintf("Inconsistency: heap resource WAS found\n");
|
sciprintf("Inconsistency: heap resource WAS found\n");
|
||||||
|
@ -1709,7 +1709,7 @@ int script_instantiate_common(EngineState *s, int script_nr, resource_t **script
|
||||||
mem = s->seg_manager->heap[seg];
|
mem = s->seg_manager->heap[seg];
|
||||||
s->seg_manager->freeScript(mem);
|
s->seg_manager->freeScript(mem);
|
||||||
}
|
}
|
||||||
} else if (!(mem = s->seg_manager->allocateScript(s, script_nr, &seg_id))) { // ALL YOUR SCRIPT BASE ARE BELONG TO US
|
} else if (!(mem = s->seg_manager->allocateScript(s, script_nr, &seg_id))) { // ALL YOUR SCRIPT BASE ARE BELONG TO US
|
||||||
sciprintf("Not enough heap space for script size 0x%x of script 0x%x, should this happen?`\n", (*script)->size, script_nr);
|
sciprintf("Not enough heap space for script size 0x%x of script 0x%x, should this happen?`\n", (*script)->size, script_nr);
|
||||||
script_debug_flag = script_error_flag = 1;
|
script_debug_flag = script_error_flag = 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1720,7 +1720,7 @@ int script_instantiate_common(EngineState *s, int script_nr, resource_t **script
|
||||||
reg.segment = seg_id;
|
reg.segment = seg_id;
|
||||||
reg.offset = 0;
|
reg.offset = 0;
|
||||||
|
|
||||||
// Set heap position (beyond the size word)
|
// Set heap position (beyond the size word)
|
||||||
s->seg_manager->setLockers(1, reg.segment, SEG_ID);
|
s->seg_manager->setLockers(1, reg.segment, SEG_ID);
|
||||||
s->seg_manager->setExportTableOffset(0, reg.segment, SEG_ID);
|
s->seg_manager->setExportTableOffset(0, reg.segment, SEG_ID);
|
||||||
s->seg_manager->setSynonymsOffset(0, reg.segment, SEG_ID);
|
s->seg_manager->setSynonymsOffset(0, reg.segment, SEG_ID);
|
||||||
|
@ -1737,7 +1737,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
reg_t reg, reg_tmp;
|
reg_t reg, reg_tmp;
|
||||||
int seg_id;
|
int seg_id;
|
||||||
int relocation = -1;
|
int relocation = -1;
|
||||||
int magic_pos_adder; // Usually 0; 2 for older SCI versions
|
int magic_pos_adder; // Usually 0; 2 for older SCI versions
|
||||||
resource_t *script;
|
resource_t *script;
|
||||||
int was_new;
|
int was_new;
|
||||||
|
|
||||||
|
@ -1753,13 +1753,13 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
//
|
//
|
||||||
int locals_nr = getUInt16(script->data);
|
int locals_nr = getUInt16(script->data);
|
||||||
|
|
||||||
// Old script block
|
// Old script block
|
||||||
// There won't be a localvar block in this case
|
// There won't be a localvar block in this case
|
||||||
// Instead, the script starts with a 16 bit int specifying the
|
// Instead, the script starts with a 16 bit int specifying the
|
||||||
// number of locals we need; these are then allocated and zeroed.
|
// number of locals we need; these are then allocated and zeroed.
|
||||||
|
|
||||||
s->seg_manager->mcpyInOut(0, script->data, script->size, reg.segment, SEG_ID);
|
s->seg_manager->mcpyInOut(0, script->data, script->size, reg.segment, SEG_ID);
|
||||||
magic_pos_adder = 2; // Step over the funny prefix
|
magic_pos_adder = 2; // Step over the funny prefix
|
||||||
|
|
||||||
if (locals_nr)
|
if (locals_nr)
|
||||||
s->seg_manager->scriptInitialiseLocalsZero(reg.segment, locals_nr);
|
s->seg_manager->scriptInitialiseLocalsZero(reg.segment, locals_nr);
|
||||||
|
@ -1779,7 +1779,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
do {
|
do {
|
||||||
reg_t data_base;
|
reg_t data_base;
|
||||||
reg_t addr;
|
reg_t addr;
|
||||||
reg.offset += objlength; // Step over the last checked object
|
reg.offset += objlength; // Step over the last checked object
|
||||||
objtype = SEG_GET_HEAP(s, reg);
|
objtype = SEG_GET_HEAP(s, reg);
|
||||||
if (!objtype) break;
|
if (!objtype) break;
|
||||||
|
|
||||||
|
@ -1797,7 +1797,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sci_obj_synonyms:
|
case sci_obj_synonyms:
|
||||||
s->seg_manager->setSynonymsOffset(addr.offset, reg.segment, SEG_ID); // +4 is to step over the header
|
s->seg_manager->setSynonymsOffset(addr.offset, reg.segment, SEG_ID); // +4 is to step over the header
|
||||||
s->seg_manager->setSynonymsNr((objlength) / 4, reg.segment, SEG_ID);
|
s->seg_manager->setSynonymsNr((objlength) / 4, reg.segment, SEG_ID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1822,7 +1822,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
s->classtable[species].script = script_nr;
|
s->classtable[species].script = script_nr;
|
||||||
s->classtable[species].reg = addr;
|
s->classtable[species].reg = addr;
|
||||||
s->classtable[species].reg.offset = classpos;
|
s->classtable[species].reg.offset = classpos;
|
||||||
// Set technical class position-- into the block allocated for it
|
// Set technical class position-- into the block allocated for it
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1830,18 +1830,18 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (objtype != 0);
|
} while (objtype != 0);
|
||||||
// And now a second pass to adjust objects and class pointers, and the general pointers
|
// And now a second pass to adjust objects and class pointers, and the general pointers
|
||||||
|
|
||||||
objlength = 0;
|
objlength = 0;
|
||||||
reg.offset = magic_pos_adder; // Reset counter
|
reg.offset = magic_pos_adder; // Reset counter
|
||||||
|
|
||||||
do {
|
do {
|
||||||
reg_t addr;
|
reg_t addr;
|
||||||
reg.offset += objlength; // Step over the last checked object
|
reg.offset += objlength; // Step over the last checked object
|
||||||
objtype = SEG_GET_HEAP(s, reg);
|
objtype = SEG_GET_HEAP(s, reg);
|
||||||
if (!objtype) break;
|
if (!objtype) break;
|
||||||
objlength = SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + 2));
|
objlength = SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + 2));
|
||||||
reg.offset += 4; // Step over header
|
reg.offset += 4; // Step over header
|
||||||
|
|
||||||
addr = reg;
|
addr = reg;
|
||||||
|
|
||||||
|
@ -1850,22 +1850,22 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
s->seg_manager->scriptAddCodeBlock(addr);
|
s->seg_manager->scriptAddCodeBlock(addr);
|
||||||
break;
|
break;
|
||||||
case sci_obj_object:
|
case sci_obj_object:
|
||||||
case sci_obj_class: { // object or class?
|
case sci_obj_class: { // object or class?
|
||||||
object_t *obj = s->seg_manager->scriptObjInit(s, addr);
|
object_t *obj = s->seg_manager->scriptObjInit(s, addr);
|
||||||
object_t *base_obj;
|
object_t *base_obj;
|
||||||
|
|
||||||
// Instantiate the superclass, if neccessary
|
// Instantiate the superclass, if neccessary
|
||||||
obj->variables[SCRIPT_SPECIES_SELECTOR] = INST_LOOKUP_CLASS(obj->variables[SCRIPT_SPECIES_SELECTOR].offset);
|
obj->variables[SCRIPT_SPECIES_SELECTOR] = INST_LOOKUP_CLASS(obj->variables[SCRIPT_SPECIES_SELECTOR].offset);
|
||||||
|
|
||||||
base_obj = obj_get(s, obj->variables[SCRIPT_SPECIES_SELECTOR]);
|
base_obj = obj_get(s, obj->variables[SCRIPT_SPECIES_SELECTOR]);
|
||||||
obj->variable_names_nr = base_obj->variables_nr;
|
obj->variable_names_nr = base_obj->variables_nr;
|
||||||
obj->base_obj = base_obj->base_obj;
|
obj->base_obj = base_obj->base_obj;
|
||||||
// Copy base from species class, as we need its selector IDs
|
// Copy base from species class, as we need its selector IDs
|
||||||
|
|
||||||
obj->variables[SCRIPT_SUPERCLASS_SELECTOR] = INST_LOOKUP_CLASS(obj->variables[SCRIPT_SUPERCLASS_SELECTOR].offset);
|
obj->variables[SCRIPT_SUPERCLASS_SELECTOR] = INST_LOOKUP_CLASS(obj->variables[SCRIPT_SUPERCLASS_SELECTOR].offset);
|
||||||
} // if object or class
|
} // if object or class
|
||||||
break;
|
break;
|
||||||
case sci_obj_pointers: // A relocation table
|
case sci_obj_pointers: // A relocation table
|
||||||
relocation = addr.offset;
|
relocation = addr.offset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1873,7 +1873,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
reg.offset -= 4; // Step back on header
|
reg.offset -= 4; // Step back on header
|
||||||
|
|
||||||
} while ((objtype != 0) && (((unsigned)reg.offset) < script->size - 2));
|
} while ((objtype != 0) && (((unsigned)reg.offset) < script->size - 2));
|
||||||
|
|
||||||
|
@ -1882,7 +1882,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
|
||||||
|
|
||||||
s->seg_manager->scriptFreeUnusedObjects(reg.segment);
|
s->seg_manager->scriptFreeUnusedObjects(reg.segment);
|
||||||
|
|
||||||
return reg.segment; // instantiation successful
|
return reg.segment; // instantiation successful
|
||||||
}
|
}
|
||||||
|
|
||||||
int script_instantiate_sci11(EngineState *s, int script_nr) {
|
int script_instantiate_sci11(EngineState *s, int script_nr) {
|
||||||
|
@ -1931,15 +1931,15 @@ void script_uninstantiate_sci0(EngineState *s, int script_nr, seg_id_t seg) {
|
||||||
reg_t reg = make_reg(seg, (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER) ? 2 : 0);
|
reg_t reg = make_reg(seg, (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER) ? 2 : 0);
|
||||||
int objtype, objlength;
|
int objtype, objlength;
|
||||||
|
|
||||||
// Make a pass over the object in order uninstantiate all superclasses
|
// Make a pass over the object in order uninstantiate all superclasses
|
||||||
objlength = 0;
|
objlength = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
reg.offset += objlength; // Step over the last checked object
|
reg.offset += objlength; // Step over the last checked object
|
||||||
|
|
||||||
objtype = SEG_GET_HEAP(s, reg);
|
objtype = SEG_GET_HEAP(s, reg);
|
||||||
if (!objtype) break;
|
if (!objtype) break;
|
||||||
objlength = SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + 2)); // use SEG_UGET_HEAP ??
|
objlength = SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + 2)); // use SEG_UGET_HEAP ??
|
||||||
|
|
||||||
reg.offset += 4; // Step over header
|
reg.offset += 4; // Step over header
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,8 @@ gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text, int *width, int *height,
|
text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text, int *width, int *height,
|
||||||
int *lines, int *line_height_p, int *last_offset_p, int flags) {
|
int *lines, int *line_height_p, int *last_offset_p, int flags) {
|
||||||
int est_char_width = font->widths[(font->chars_nr > 'M')? 'M' : font->chars_nr - 1];
|
int est_char_width = font->widths[(font->chars_nr > 'M')? 'M' : font->chars_nr - 1];
|
||||||
// 'M' is typically among the widest chars
|
// 'M' is typically among the widest chars
|
||||||
int fragments_nr;
|
int fragments_nr;
|
||||||
|
@ -282,7 +282,7 @@ static inline void render_char(byte *dest, byte *src, int width, int line_width,
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters,
|
gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters,
|
||||||
gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg) {
|
gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg) {
|
||||||
unsigned char *text = (unsigned char *)stext;
|
unsigned char *text = (unsigned char *)stext;
|
||||||
int height = font->height;
|
int height = font->height;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
|
@ -52,12 +52,12 @@
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
static void FUNCTION_NAME(byte *dest, byte *src, int bytes_per_dest_line, int bytes_per_src_line,
|
static void FUNCTION_NAME(byte *dest, byte *src, int bytes_per_dest_line, int bytes_per_src_line,
|
||||||
int xl, int yl, byte *alpha, int bytes_per_alpha_line, int bytes_per_alpha_pixel,
|
int xl, int yl, byte *alpha, int bytes_per_alpha_line, int bytes_per_alpha_pixel,
|
||||||
unsigned int alpha_test_mask, unsigned int alpha_min
|
unsigned int alpha_test_mask, unsigned int alpha_min
|
||||||
#ifdef USE_PRIORITY
|
#ifdef USE_PRIORITY
|
||||||
, byte *priority_buffer, int bytes_per_priority_line, int bytes_per_priority_pixel, int priority
|
, byte *priority_buffer, int bytes_per_priority_line, int bytes_per_priority_pixel, int priority
|
||||||
#endif /* USE_PRIORITY */
|
#endif /* USE_PRIORITY */
|
||||||
) {
|
) {
|
||||||
int x, y;
|
int x, y;
|
||||||
int alpha_end = xl * bytes_per_alpha_pixel;
|
int alpha_end = xl * bytes_per_alpha_pixel;
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ static void lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Point end,
|
static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Point end,
|
||||||
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
||||||
uint32 scolor = color.visual.global_index;
|
uint32 scolor = color.visual.global_index;
|
||||||
int xsize = S->xsize;
|
int xsize = S->xsize;
|
||||||
int ysize = S->ysize;
|
int ysize = S->ysize;
|
||||||
|
@ -181,7 +181,7 @@ static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Poi
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2,
|
static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2,
|
||||||
gfx_rectangle_fill_t shade_mode) {
|
gfx_rectangle_fill_t shade_mode) {
|
||||||
if (color1.mask & GFX_MASK_VISUAL) {
|
if (color1.mask & GFX_MASK_VISUAL) {
|
||||||
for (int i = rect.y; i < rect.y + rect.yl; i++) {
|
for (int i = rect.y; i < rect.y + rect.yl; i++) {
|
||||||
memset(S->visual[1] + i * S->xsize + rect.x, color1.visual.global_index, rect.xl);
|
memset(S->visual[1] + i * S->xsize + rect.x, color1.visual.global_index, rect.xl);
|
||||||
|
@ -196,7 +196,7 @@ static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t
|
||||||
|
|
||||||
// Pixmap operations
|
// Pixmap operations
|
||||||
|
|
||||||
static int scummvm_draw_pixmap(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority,
|
static int scummvm_draw_pixmap(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priority,
|
||||||
rect_t src, rect_t dest, gfx_buffer_t buffer) {
|
rect_t src, rect_t dest, gfx_buffer_t buffer) {
|
||||||
int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1;
|
int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1;
|
||||||
int pribufnr = bufnr - 1;
|
int pribufnr = bufnr - 1;
|
||||||
|
|
|
@ -164,7 +164,7 @@ int gfxop_init_default(gfx_state_t *state, gfx_options_t *options, void *misc_in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_init(gfx_state_t *state, int xfact, int yfact, gfx_color_mode_t bpp,
|
int gfxop_init(gfx_state_t *state, int xfact, int yfact, gfx_color_mode_t bpp,
|
||||||
gfx_options_t *options, void *misc_info);
|
gfx_options_t *options, void *misc_info);
|
||||||
/* Initializes a custom graphics mode
|
/* Initializes a custom graphics mode
|
||||||
** Parameters: (gfx_state_t *) state: The state to initialize
|
** Parameters: (gfx_state_t *) state: The state to initialize
|
||||||
** (int x int) xfact, yfact: Horizontal and vertical scale factors
|
** (int x int) xfact, yfact: Horizontal and vertical scale factors
|
||||||
|
@ -230,9 +230,8 @@ int gfxop_set_clip_zone(gfx_state_t *state, rect_t zone);
|
||||||
/******************************/
|
/******************************/
|
||||||
|
|
||||||
int gfxop_draw_line(gfx_state_t *state,
|
int gfxop_draw_line(gfx_state_t *state,
|
||||||
Common::Point start, Common::Point end,
|
Common::Point start, Common::Point end, gfx_color_t color,
|
||||||
gfx_color_t color, gfx_line_mode_t line_mode,
|
gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
||||||
gfx_line_style_t line_style);
|
|
||||||
/* Renders a clipped line to the back buffer
|
/* Renders a clipped line to the back buffer
|
||||||
** Parameters: (gfx_state_t *) state: The state affected
|
** Parameters: (gfx_state_t *) state: The state affected
|
||||||
** (Common::Point) start: Starting point of the line
|
** (Common::Point) start: Starting point of the line
|
||||||
|
@ -244,7 +243,7 @@ int gfxop_draw_line(gfx_state_t *state,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode,
|
int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode,
|
||||||
gfx_line_style_t line_style);
|
gfx_line_style_t line_style);
|
||||||
/* Draws a non-filled rectangular box to the back buffer
|
/* Draws a non-filled rectangular box to the back buffer
|
||||||
** Parameters: (gfx_state_t *) state: The affected state
|
** Parameters: (gfx_state_t *) state: The affected state
|
||||||
** (rect_t) rect: The rectangular area the box is drawn to
|
** (rect_t) rect: The rectangular area the box is drawn to
|
||||||
|
@ -256,7 +255,7 @@ int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color_t color2,
|
int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color_t color2,
|
||||||
gfx_box_shade_t shade_type);
|
gfx_box_shade_t shade_type);
|
||||||
/* Draws a filled box to the back buffer
|
/* Draws a filled box to the back buffer
|
||||||
** Parameters: (gfx_state_t *) state: The affected state
|
** Parameters: (gfx_state_t *) state: The affected state
|
||||||
** (rect_t) box: The area to draw to
|
** (rect_t) box: The area to draw to
|
||||||
|
@ -326,7 +325,7 @@ int gfxop_disable_dirty_frames(gfx_state_t *state);
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
int gfxop_set_color(gfx_state_t *state, gfx_color_t *color, int r, int g, int b, int a,
|
int gfxop_set_color(gfx_state_t *state, gfx_color_t *color, int r, int g, int b, int a,
|
||||||
int priority, int control);
|
int priority, int control);
|
||||||
/* Maps an r/g/b value to a color and sets a gfx_color_t structure
|
/* Maps an r/g/b value to a color and sets a gfx_color_t structure
|
||||||
** Parameters: (gfx_state_t *) state: The current state
|
** Parameters: (gfx_state_t *) state: The current state
|
||||||
** (gfx_color_t *) color: Pointer to the structure to write to
|
** (gfx_color_t *) color: Pointer to the structure to write to
|
||||||
|
@ -468,7 +467,7 @@ int gfxop_overflow_cel(gfx_state_t *state, int nr, int *loop, int *cel);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_get_cel_parameters(gfx_state_t *state, int nr, int loop, int cel,
|
int gfxop_get_cel_parameters(gfx_state_t *state, int nr, int loop, int cel,
|
||||||
int *width, int *height, Common::Point *offset);
|
int *width, int *height, Common::Point *offset);
|
||||||
/* Retreives the width and height of a cel
|
/* Retreives the width and height of a cel
|
||||||
** Parameters: (gfx_state_t *) state: The state to use
|
** Parameters: (gfx_state_t *) state: The state to use
|
||||||
** (int) nr: Number of the view
|
** (int) nr: Number of the view
|
||||||
|
@ -482,7 +481,7 @@ int gfxop_get_cel_parameters(gfx_state_t *state, int nr, int loop, int cel,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_draw_cel(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
int gfxop_draw_cel(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
||||||
gfx_color_t color, int palette);
|
gfx_color_t color, int palette);
|
||||||
/* Draws (part of) a cel to the back buffer
|
/* Draws (part of) a cel to the back buffer
|
||||||
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
||||||
** (int) nr: Number of the view to draw
|
** (int) nr: Number of the view to draw
|
||||||
|
@ -496,7 +495,7 @@ int gfxop_draw_cel(gfx_state_t *state, int nr, int loop, int cel, Common::Point
|
||||||
|
|
||||||
|
|
||||||
int gfxop_draw_cel_static(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
int gfxop_draw_cel_static(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
||||||
gfx_color_t color, int palette);
|
gfx_color_t color, int palette);
|
||||||
/* Draws a cel to the static buffer; no clipping is performed
|
/* Draws a cel to the static buffer; no clipping is performed
|
||||||
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
||||||
** (int) nr: Number of the view to draw
|
** (int) nr: Number of the view to draw
|
||||||
|
@ -511,7 +510,7 @@ int gfxop_draw_cel_static(gfx_state_t *state, int nr, int loop, int cel, Common:
|
||||||
|
|
||||||
|
|
||||||
int gfxop_draw_cel_static_clipped(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
int gfxop_draw_cel_static_clipped(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
|
||||||
gfx_color_t color, int palette);
|
gfx_color_t color, int palette);
|
||||||
/* Draws (part of) a clipped cel to the static buffer
|
/* Draws (part of) a clipped cel to the static buffer
|
||||||
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
|
||||||
** (int) nr: Number of the view to draw
|
** (int) nr: Number of the view to draw
|
||||||
|
@ -574,8 +573,8 @@ int gfxop_get_font_height(gfx_state_t *state, int font_nr);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxop_get_text_params(gfx_state_t *state, int font_nr, const char *text,
|
int gfxop_get_text_params(gfx_state_t *state, int font_nr, const char *text,
|
||||||
int maxwidth, int *width, int *height, int flags,
|
int maxwidth, int *width, int *height, int flags,
|
||||||
int *lines_nr, int *lineheight, int *lastline_width);
|
int *lines_nr, int *lineheight, int *lastline_width);
|
||||||
/* Calculates the width and height of a specified text in a specified font
|
/* Calculates the width and height of a specified text in a specified font
|
||||||
** Parameters: (gfx_state_t *) state: The state to use
|
** Parameters: (gfx_state_t *) state: The state to use
|
||||||
** (int) font_nr: Font number to use for the calculation
|
** (int) font_nr: Font number to use for the calculation
|
||||||
|
@ -592,9 +591,8 @@ int gfxop_get_text_params(gfx_state_t *state, int font_nr, const char *text,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfx_text_handle_t *gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth,
|
gfx_text_handle_t *gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign,
|
gfx_alignment_t halign, gfx_alignment_t valign, gfx_color_t color1,
|
||||||
gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color,
|
gfx_color_t color2, gfx_color_t bg_color, int flags);
|
||||||
int flags);
|
|
||||||
/* Generates a new text handle that can be used to draw any text
|
/* Generates a new text handle that can be used to draw any text
|
||||||
** Parameters: (gfx_state_t *) state: The state to use
|
** Parameters: (gfx_state_t *) state: The state to use
|
||||||
** (int) font_nr: Font number to use for the calculation
|
** (int) font_nr: Font number to use for the calculation
|
||||||
|
|
|
@ -128,7 +128,7 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
|
||||||
|
|
||||||
#define WRITE_XPART(X_CALC_INTENSITY, DO_X_STEP) \
|
#define WRITE_XPART(X_CALC_INTENSITY, DO_X_STEP) \
|
||||||
for (subx = 0; subx < ((DO_X_STEP) ? (xfact >> 1) : 1); subx++) { \
|
for (subx = 0; subx < ((DO_X_STEP) ? (xfact >> 1) : 1); subx++) { \
|
||||||
unsigned int intensity; \
|
unsigned int intensity; \
|
||||||
wrcolor = 0; \
|
wrcolor = 0; \
|
||||||
for (i = 0; i < 3; i++) { \
|
for (i = 0; i < 3; i++) { \
|
||||||
intensity = X_CALC_INTENSITY; \
|
intensity = X_CALC_INTENSITY; \
|
||||||
|
@ -137,17 +137,17 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
|
||||||
i = 3; \
|
i = 3; \
|
||||||
intensity = X_CALC_INTENSITY; \
|
intensity = X_CALC_INTENSITY; \
|
||||||
if (inverse_alpha) \
|
if (inverse_alpha) \
|
||||||
intensity = ~intensity; \
|
intensity = ~intensity; \
|
||||||
wrcolor |= (intensity >> shifts[i]) & masks[i]; \
|
wrcolor |= (intensity >> shifts[i]) & masks[i]; \
|
||||||
if (separate_alpha_map) \
|
if (separate_alpha_map) \
|
||||||
*alpha_wrpos++ = intensity >> 24; \
|
*alpha_wrpos++ = intensity >> 24; \
|
||||||
wrcolor <<= (EXTRA_BYTE_OFFSET * 8); \
|
wrcolor <<= (EXTRA_BYTE_OFFSET * 8); \
|
||||||
memcpy(wrpos, &wrcolor, COPY_BYTES); \
|
memcpy(wrpos, &wrcolor, COPY_BYTES); \
|
||||||
wrpos += COPY_BYTES; \
|
wrpos += COPY_BYTES; \
|
||||||
if (DO_X_STEP) \
|
if (DO_X_STEP) \
|
||||||
column_valuator -= column_step; \
|
column_valuator -= column_step; \
|
||||||
} \
|
} \
|
||||||
if (DO_X_STEP) \
|
if (DO_X_STEP) \
|
||||||
column_step = -column_step
|
column_step = -column_step
|
||||||
// End of macro definition
|
// End of macro definition
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
|
||||||
int i; \
|
int i; \
|
||||||
SIZETYPE wrcolor; \
|
SIZETYPE wrcolor; \
|
||||||
wrpos = sublinepos; \
|
wrpos = sublinepos; \
|
||||||
alpha_wrpos = alpha_sublinepos; \
|
alpha_wrpos = alpha_sublinepos; \
|
||||||
for (i = 0; i < 4; i++) \
|
for (i = 0; i < 4; i++) \
|
||||||
linecolor[i] = LINE_COLOR; \
|
linecolor[i] = LINE_COLOR; \
|
||||||
/*-- left half --*/ \
|
/*-- left half --*/ \
|
||||||
|
@ -178,7 +178,7 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
|
||||||
MAKE_PIXEL((x + 1 == pxm->index_xl), othercolumn, ctexel, src[+1]); \
|
MAKE_PIXEL((x + 1 == pxm->index_xl), othercolumn, ctexel, src[+1]); \
|
||||||
WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \
|
WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \
|
||||||
if (DO_Y_STEP) \
|
if (DO_Y_STEP) \
|
||||||
line_valuator -= line_step; \
|
line_valuator -= line_step; \
|
||||||
sublinepos += pxm->xl * bytespp; \
|
sublinepos += pxm->xl * bytespp; \
|
||||||
alpha_sublinepos += pxm->xl; \
|
alpha_sublinepos += pxm->xl; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -96,7 +96,7 @@ struct gfx_resstate_t {
|
||||||
|
|
||||||
|
|
||||||
gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options,
|
gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options,
|
||||||
gfx_driver_t *driver, void *misc_payload);
|
gfx_driver_t *driver, void *misc_payload);
|
||||||
/* Allocates and initializes a new resource manager
|
/* Allocates and initializes a new resource manager
|
||||||
** Parameters: (int) version: Interpreter version
|
** Parameters: (int) version: Interpreter version
|
||||||
** (gfx_options_t *): Pointer to all relevant drawing options
|
** (gfx_options_t *): Pointer to all relevant drawing options
|
||||||
|
@ -145,7 +145,7 @@ void gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state);
|
||||||
|
|
||||||
|
|
||||||
gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags,
|
gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags,
|
||||||
int default_palette, int scaled);
|
int default_palette, int scaled);
|
||||||
/* Retreives a displayable (translated) pic resource
|
/* Retreives a displayable (translated) pic resource
|
||||||
** Parameters: (gfx_resstate_t *) state: The resource state
|
** Parameters: (gfx_resstate_t *) state: The resource state
|
||||||
** (int) nr: Number of the pic resource
|
** (int) nr: Number of the pic resource
|
||||||
|
@ -159,7 +159,7 @@ gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxr_pic_t *gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int flags,
|
gfxr_pic_t *gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int flags,
|
||||||
int old_default_palette, int default_palette, int scaled);
|
int old_default_palette, int default_palette, int scaled);
|
||||||
/* Retreives a displayable (translated) pic resource written ontop of an existing pic
|
/* Retreives a displayable (translated) pic resource written ontop of an existing pic
|
||||||
** Parameters: (gfx_resstate_t *) state: The resource state
|
** Parameters: (gfx_resstate_t *) state: The resource state
|
||||||
** (int) old_nr: Number of the pic resource to write on
|
** (int) old_nr: Number of the pic resource to write on
|
||||||
|
@ -218,7 +218,7 @@ gfx_pixmap_color_t *gfxr_get_palette(gfx_resstate_t *state, int nr);
|
||||||
|
|
||||||
|
|
||||||
int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
|
int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
|
||||||
gfx_options_t *options, void *internal, int palette);
|
gfx_options_t *options, void *internal, int palette);
|
||||||
/* Calculates a unique hash value for the specified options/type setup
|
/* Calculates a unique hash value for the specified options/type setup
|
||||||
** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for
|
** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for
|
||||||
** (int) version: The interpreter type and version
|
** (int) version: The interpreter type and version
|
||||||
|
@ -236,7 +236,7 @@ int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int *gfxr_interpreter_get_resources(gfx_resstate_t *state, gfx_resource_type_t type,
|
int *gfxr_interpreter_get_resources(gfx_resstate_t *state, gfx_resource_type_t type,
|
||||||
int version, int *entries_nr, void *internal);
|
int version, int *entries_nr, void *internal);
|
||||||
/* Retreives all resources of a specified type that are available from the interpreter
|
/* Retreives all resources of a specified type that are available from the interpreter
|
||||||
** Parameters: (gfx_resstate_t *) state: The relevant resource state
|
** Parameters: (gfx_resstate_t *) state: The relevant resource state
|
||||||
** (gfx_respirce_type_t) type: The resource type to query
|
** (gfx_respirce_type_t) type: The resource type to query
|
||||||
|
@ -270,7 +270,7 @@ void gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
||||||
int flags, int default_palette, int nr, void *internal);
|
int flags, int default_palette, int nr, void *internal);
|
||||||
/* Instructs the interpreter-specific code to calculate a picture
|
/* Instructs the interpreter-specific code to calculate a picture
|
||||||
** Parameters: (gfx_resstate_t *) state: The resource state, containing options and version information
|
** Parameters: (gfx_resstate_t *) state: The resource state, containing options and version information
|
||||||
** (gfxr_pic_t *) scaled_pic: The pic structure that is to be written to
|
** (gfxr_pic_t *) scaled_pic: The pic structure that is to be written to
|
||||||
|
|
|
@ -201,9 +201,7 @@ gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *font, gfx_mode_t *mode, gf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text,
|
text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text,
|
||||||
int *width, int *height,
|
int *width, int *height, int *lines, int *line_height, int *last_offset, int flags);
|
||||||
int *lines, int *line_height, int *last_offset,
|
|
||||||
int flags);
|
|
||||||
/* Calculates the size that would be occupied by drawing a specified text
|
/* Calculates the size that would be occupied by drawing a specified text
|
||||||
** Parameters: (gfx_bitmap_font_t *) font: The font to calculate with
|
** Parameters: (gfx_bitmap_font_t *) font: The font to calculate with
|
||||||
** (int) max_width: Maximum pixel width allowed for the output
|
** (int) max_width: Maximum pixel width allowed for the output
|
||||||
|
@ -221,7 +219,7 @@ text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *text, int characters,
|
gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *text, int characters,
|
||||||
gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg);
|
gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg);
|
||||||
/* Draws text in a specific font to a pixmap
|
/* Draws text in a specific font to a pixmap
|
||||||
** Parameters: (gfx_bitmap_font_t *) font: The font to use for drawing
|
** Parameters: (gfx_bitmap_font_t *) font: The font to use for drawing
|
||||||
** (char *) text: The start of the text to draw
|
** (char *) text: The start of the text to draw
|
||||||
|
@ -254,8 +252,8 @@ void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size);
|
||||||
|
|
||||||
|
|
||||||
void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette,
|
void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette,
|
||||||
int size, byte *resource, gfxr_pic0_params_t *style, int resid, int sci1,
|
int size, byte *resource, gfxr_pic0_params_t *style, int resid, int sci1,
|
||||||
gfx_pixmap_color_t *static_pal, int static_pal_nr);
|
gfx_pixmap_color_t *static_pal, int static_pal_nr);
|
||||||
/* Draws a pic resource (all formats prior to SCI1.1)
|
/* Draws a pic resource (all formats prior to SCI1.1)
|
||||||
** Parameters: (gfxr_pic_t *) pic: The pic to draw to
|
** Parameters: (gfxr_pic_t *) pic: The pic to draw to
|
||||||
** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
|
** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
|
||||||
|
@ -275,8 +273,8 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally, int default_palette,
|
void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally, int default_palette,
|
||||||
int size, byte *resource, gfxr_pic0_params_t *style, int resid,
|
int size, byte *resource, gfxr_pic0_params_t *style, int resid,
|
||||||
gfx_pixmap_color_t *static_pal, int static_pal_nr);
|
gfx_pixmap_color_t *static_pal, int static_pal_nr);
|
||||||
/* Draws a pic resource (SCI1.1)
|
/* Draws a pic resource (SCI1.1)
|
||||||
** Parameters: (gfxr_pic_t *) pic: The pic to draw to
|
** Parameters: (gfxr_pic_t *) pic: The pic to draw to
|
||||||
** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
|
** (int) fill_normally: If 1, the pic is drawn normally; if 0, all
|
||||||
|
@ -376,7 +374,7 @@ gfx_pixmap_color_t *gfxr_read_pal11(int id, int *colors_nr, byte *resource, int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal,
|
gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal,
|
||||||
int static_pal_nr);
|
int static_pal_nr);
|
||||||
/* Calculates an SCI1 view
|
/* Calculates an SCI1 view
|
||||||
** Parameters: (int) id: Resource ID of the view
|
** Parameters: (int) id: Resource ID of the view
|
||||||
** (byte *) resource: Pointer to the resource to read
|
** (byte *) resource: Pointer to the resource to read
|
||||||
|
|
|
@ -89,26 +89,26 @@ typedef int gfxw_op_int(gfxw_widget_t *, int);
|
||||||
typedef int gfxw_bin_op(gfxw_widget_t *, gfxw_widget_t *);
|
typedef int gfxw_bin_op(gfxw_widget_t *, gfxw_widget_t *);
|
||||||
|
|
||||||
#define WIDGET_COMMON \
|
#define WIDGET_COMMON \
|
||||||
int magic; /* Extra check after typecasting */ \
|
int magic; /* Extra check after typecasting */ \
|
||||||
int serial; /* Serial number */ \
|
int serial; /* Serial number */ \
|
||||||
int flags; /* Widget flags */ \
|
int flags; /* Widget flags */ \
|
||||||
gfxw_widget_type_t type; \
|
gfxw_widget_type_t type; \
|
||||||
rect_t bounds; /* Boundaries */ \
|
rect_t bounds; /* Boundaries */ \
|
||||||
gfxw_widget_t *next; /* Next widget in widget list */ \
|
gfxw_widget_t *next; /* Next widget in widget list */ \
|
||||||
int ID; /* Unique ID or GFXW_NO_ID */ \
|
int ID; /* Unique ID or GFXW_NO_ID */ \
|
||||||
int subID; /* A 'sub-ID', or GFXW_NO_ID */ \
|
int subID; /* A 'sub-ID', or GFXW_NO_ID */ \
|
||||||
gfxw_container_t *parent; /* The parent widget, or NULL if not owned */ \
|
gfxw_container_t *parent; /* The parent widget, or NULL if not owned */ \
|
||||||
gfxw_visual_t *visual; /* The owner visual */ \
|
gfxw_visual_t *visual; /* The owner visual */ \
|
||||||
int widget_priority; /* Drawing priority, or -1 */ \
|
int widget_priority; /* Drawing priority, or -1 */ \
|
||||||
gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \
|
gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \
|
||||||
gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \
|
gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \
|
||||||
gfxw_op *tag; /* Tag the specified widget */ \
|
gfxw_op *tag; /* Tag the specified widget */ \
|
||||||
gfxw_op_int *print; /* Prints the widget's contents, using sciprintf. Second parameter is indentation. */ \
|
gfxw_op_int *print; /* Prints the widget's contents, using sciprintf. Second parameter is indentation. */ \
|
||||||
gfxw_bin_op *compare_to; /* a.compare_to(a, b) returns <0 if a<b, =0 if a=b and >0 if a>b */ \
|
gfxw_bin_op *compare_to; /* a.compare_to(a, b) returns <0 if a<b, =0 if a=b and >0 if a>b */ \
|
||||||
gfxw_bin_op *equals; /* a equals b if both cause the same data to be displayed */ \
|
gfxw_bin_op *equals; /* a equals b if both cause the same data to be displayed */ \
|
||||||
gfxw_bin_op *should_replace; /* (only if a equals b) Whether b should replace a even though they are equivalent */ \
|
gfxw_bin_op *should_replace; /* (only if a equals b) Whether b should replace a even though they are equivalent */ \
|
||||||
gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \
|
gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \
|
||||||
gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */
|
gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */
|
||||||
|
|
||||||
struct gfxw_widget_t {
|
struct gfxw_widget_t {
|
||||||
WIDGET_COMMON;
|
WIDGET_COMMON;
|
||||||
|
@ -181,16 +181,16 @@ typedef int gfxw_container_op(gfxw_container_t *, gfxw_widget_t *);
|
||||||
typedef int gfxw_rect_op(gfxw_container_t *, rect_t, int);
|
typedef int gfxw_rect_op(gfxw_container_t *, rect_t, int);
|
||||||
|
|
||||||
#define WIDGET_CONTAINER \
|
#define WIDGET_CONTAINER \
|
||||||
WIDGET_COMMON; \
|
WIDGET_COMMON; \
|
||||||
rect_t zone; /* The writeable zone (absolute) for contained objects */ \
|
rect_t zone; /* The writeable zone (absolute) for contained objects */ \
|
||||||
gfx_dirty_rect_t *dirty; /* List of dirty rectangles */ \
|
gfx_dirty_rect_t *dirty; /* List of dirty rectangles */ \
|
||||||
gfxw_widget_t *contents; \
|
gfxw_widget_t *contents; \
|
||||||
gfxw_widget_t **nextpp; /* Pointer to the 'next' pointer in the last entry in contents */ \
|
gfxw_widget_t **nextpp; /* Pointer to the 'next' pointer in the last entry in contents */ \
|
||||||
gfxw_unary_container_op *free_tagged; /* Free all tagged contained widgets */ \
|
gfxw_unary_container_op *free_tagged; /* Free all tagged contained widgets */ \
|
||||||
gfxw_unary_container_op *free_contents; /* Free all contained widgets */ \
|
gfxw_unary_container_op *free_contents; /* Free all contained widgets */ \
|
||||||
gfxw_rect_op *add_dirty_abs; /* Add an absolute dirty rectangle */ \
|
gfxw_rect_op *add_dirty_abs; /* Add an absolute dirty rectangle */ \
|
||||||
gfxw_rect_op *add_dirty_rel; /* Add a relative dirty rectangle */ \
|
gfxw_rect_op *add_dirty_rel; /* Add a relative dirty rectangle */ \
|
||||||
gfxw_container_op *add /* Append widget to an appropriate position (for view and control lists) */
|
gfxw_container_op *add /* Append widget to an appropriate position (for view and control lists) */
|
||||||
|
|
||||||
|
|
||||||
struct gfxw_container_t {
|
struct gfxw_container_t {
|
||||||
|
|
|
@ -229,31 +229,31 @@ void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) {
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL,
|
static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL,
|
||||||
_gfx_crossblit_8,
|
_gfx_crossblit_8,
|
||||||
_gfx_crossblit_16,
|
_gfx_crossblit_16,
|
||||||
_gfx_crossblit_24,
|
_gfx_crossblit_24,
|
||||||
_gfx_crossblit_32
|
_gfx_crossblit_32
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*crossblit_fns_P[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
|
static void (*crossblit_fns_P[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
|
||||||
_gfx_crossblit_8_P,
|
_gfx_crossblit_8_P,
|
||||||
_gfx_crossblit_16_P,
|
_gfx_crossblit_16_P,
|
||||||
_gfx_crossblit_24_P,
|
_gfx_crossblit_24_P,
|
||||||
_gfx_crossblit_32_P
|
_gfx_crossblit_32_P
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*crossblit_fns_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL,
|
static void (*crossblit_fns_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL,
|
||||||
_gfx_crossblit_8_RA,
|
_gfx_crossblit_8_RA,
|
||||||
_gfx_crossblit_16_RA,
|
_gfx_crossblit_16_RA,
|
||||||
_gfx_crossblit_24_RA,
|
_gfx_crossblit_24_RA,
|
||||||
_gfx_crossblit_32_RA
|
_gfx_crossblit_32_RA
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*crossblit_fns_P_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
|
static void (*crossblit_fns_P_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
|
||||||
_gfx_crossblit_8_P_RA,
|
_gfx_crossblit_8_P_RA,
|
||||||
_gfx_crossblit_16_P_RA,
|
_gfx_crossblit_16_P_RA,
|
||||||
_gfx_crossblit_24_P_RA,
|
_gfx_crossblit_24_P_RA,
|
||||||
_gfx_crossblit_32_P_RA
|
_gfx_crossblit_32_P_RA
|
||||||
};
|
};
|
||||||
|
|
||||||
void _gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_line_width, int xl, int yl, int bpp) {
|
void _gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_line_width, int xl, int yl, int bpp) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace Sci {
|
||||||
|
|
||||||
|
|
||||||
/** Palette color description */
|
/** Palette color description */
|
||||||
struct gfx_palette_color_t {
|
struct gfx_palette_color_t {
|
||||||
|
|
||||||
int lockers; /* Number of pixmaps holding a lock on that color.
|
int lockers; /* Number of pixmaps holding a lock on that color.
|
||||||
** 0 means that the color is unused, -1 means that it is
|
** 0 means that the color is unused, -1 means that it is
|
||||||
|
|
|
@ -192,7 +192,7 @@ arrdup(int *src, int count) {
|
||||||
|
|
||||||
int *
|
int *
|
||||||
gfxr_interpreter_get_resources(gfx_resstate_t *resstate, gfx_resource_type_t type,
|
gfxr_interpreter_get_resources(gfx_resstate_t *resstate, gfx_resource_type_t type,
|
||||||
int version, int *entries_nr, void *internal) {
|
int version, int *entries_nr, void *internal) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
case GFX_RESOURCE_TYPE_VIEW:
|
case GFX_RESOURCE_TYPE_VIEW:
|
||||||
|
@ -295,7 +295,7 @@ gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) {
|
||||||
|
|
||||||
int
|
int
|
||||||
gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
||||||
int flags, int default_palette, int nr, void *internal) {
|
int flags, int default_palette, int nr, void *internal) {
|
||||||
gfxr_pic_t *pic = scaled_pic;
|
gfxr_pic_t *pic = scaled_pic;
|
||||||
int i, x, y, pos;
|
int i, x, y, pos;
|
||||||
int xfact = pic->mode->xfact;
|
int xfact = pic->mode->xfact;
|
||||||
|
|
|
@ -45,8 +45,8 @@ void gfx_clip_box_basic(rect_t *box, int maxx, int maxy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_mode_t *gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
|
gfx_mode_t *gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
|
||||||
unsigned int blue_mask, unsigned int alpha_mask, int red_shift, int green_shift,
|
unsigned int blue_mask, unsigned int alpha_mask, int red_shift, int green_shift,
|
||||||
int blue_shift, int alpha_shift, int palette, int flags) {
|
int blue_shift, int alpha_shift, int palette, int flags) {
|
||||||
gfx_mode_t *mode = (gfx_mode_t *)sci_malloc(sizeof(gfx_mode_t));
|
gfx_mode_t *mode = (gfx_mode_t *)sci_malloc(sizeof(gfx_mode_t));
|
||||||
|
|
||||||
mode->xfact = xfact;
|
mode->xfact = xfact;
|
||||||
|
|
|
@ -47,12 +47,12 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
extern int gfx_crossblit_alpha_threshold; /* Crossblitting functions use this value as threshold
|
extern int gfx_crossblit_alpha_threshold; /* Crossblitting functions use this value as threshold
|
||||||
** for distinguishing between transparent and opaque
|
** for distinguishing between transparent and opaque
|
||||||
** wrt alpha values */
|
** wrt alpha values */
|
||||||
|
|
||||||
gfx_mode_t *gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
|
gfx_mode_t *gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
|
||||||
unsigned int blue_mask, unsigned int alpha_mask, int red_shift, int green_shift,
|
unsigned int blue_mask, unsigned int alpha_mask, int red_shift, int green_shift,
|
||||||
int blue_shift, int alpha_shift, int palette, int flags);
|
int blue_shift, int alpha_shift, int palette, int flags);
|
||||||
/* Allocates a new gfx_mode_t structure with the specified parameters
|
/* Allocates a new gfx_mode_t structure with the specified parameters
|
||||||
** Parameters: (int x int) xfact x yfact: Horizontal and vertical scaling factors
|
** Parameters: (int x int) xfact x yfact: Horizontal and vertical scaling factors
|
||||||
** (int) bytespp: Bytes per pixel
|
** (int) bytespp: Bytes per pixel
|
||||||
|
@ -150,7 +150,7 @@ void gfx_draw_line_pixmap_i(gfx_pixmap_t *pxm, Common::Point start, Common::Poin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth,
|
void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth,
|
||||||
Common::Point start, Common::Point end, unsigned int color);
|
Common::Point start, Common::Point end, unsigned int color);
|
||||||
/* Draws a line to a linear pixel buffer
|
/* Draws a line to a linear pixel buffer
|
||||||
** Parameters: (byte *) buffer: Pointer to the start of the buffer to draw to
|
** Parameters: (byte *) buffer: Pointer to the start of the buffer to draw to
|
||||||
** (int) linewidth: Number of bytes per pixel line in the buffer
|
** (int) linewidth: Number of bytes per pixel line in the buffer
|
||||||
|
@ -202,10 +202,8 @@ void gfxr_antialiase(gfx_pixmap_t *pixmap, gfx_mode_t *mode, gfxr_antialiasing_t
|
||||||
** point corresponding to (dest.x, dest.y) */
|
** point corresponding to (dest.x, dest.y) */
|
||||||
|
|
||||||
int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority,
|
int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority,
|
||||||
rect_t src_coords, rect_t dest_coords, byte *dest,
|
rect_t src_coords, rect_t dest_coords, byte *dest, int dest_line_width,
|
||||||
int dest_line_width, byte *priority_dest,
|
byte *priority_dest, int priority_line_width, int priority_skip, int flags);
|
||||||
int priority_line_width, int priority_skip,
|
|
||||||
int flags);
|
|
||||||
/* Transfers the non-transparent part of a pixmap to a linear pixel buffer
|
/* Transfers the non-transparent part of a pixmap to a linear pixel buffer
|
||||||
** Parameters: (gfx_mode_t *) mode: The graphics mode of the target buffer
|
** Parameters: (gfx_mode_t *) mode: The graphics mode of the target buffer
|
||||||
** (gfx_pixmap_t *) pxm: The pixmap to transfer
|
** (gfx_pixmap_t *) pxm: The pixmap to transfer
|
||||||
|
|
|
@ -277,7 +277,7 @@ gfxw_primitive_t *gfxw_new_line(Common::Point start, Common::Point end, gfx_colo
|
||||||
#define GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET (1 << 1)
|
#define GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET (1 << 1)
|
||||||
|
|
||||||
gfxw_view_t *gfxw_new_view(gfx_state_t *state, Common::Point pos, int view, int loop, int cel, int palette, int priority, int control,
|
gfxw_view_t *gfxw_new_view(gfx_state_t *state, Common::Point pos, int view, int loop, int cel, int palette, int priority, int control,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign, int flags);
|
gfx_alignment_t halign, gfx_alignment_t valign, int flags);
|
||||||
/* Creates a new view (a cel, actually)
|
/* Creates a new view (a cel, actually)
|
||||||
** Parameters: (gfx_state_t *) state: The graphics state
|
** Parameters: (gfx_state_t *) state: The graphics state
|
||||||
** (Common::Point) pos: The position to place the view at
|
** (Common::Point) pos: The position to place the view at
|
||||||
|
@ -291,8 +291,7 @@ gfxw_view_t *gfxw_new_view(gfx_state_t *state, Common::Point pos, int view, int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette,
|
gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette,
|
||||||
int priority, int control, gfx_alignment_t halign, gfx_alignment_t valign,
|
int priority, int control, gfx_alignment_t halign, gfx_alignment_t valign, int sequence);
|
||||||
int sequence);
|
|
||||||
/* Creates a new dyn view
|
/* Creates a new dyn view
|
||||||
** Parameters: (gfx_state_t *) state: The graphics state
|
** Parameters: (gfx_state_t *) state: The graphics state
|
||||||
** (Common::Point) pos: The position to place the dynamic view at
|
** (Common::Point) pos: The position to place the dynamic view at
|
||||||
|
@ -310,8 +309,8 @@ gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
||||||
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2,
|
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2,
|
||||||
gfx_color_t bgcolor, int flags);
|
gfx_color_t bgcolor, int flags);
|
||||||
/* Creates a new text widget
|
/* Creates a new text widget
|
||||||
** Parameters: (gfx_state_t *) state: The state the text is to be calculated from
|
** Parameters: (gfx_state_t *) state: The state the text is to be calculated from
|
||||||
** (rect_t) area: The area the text is to be confined to (the yl value is only
|
** (rect_t) area: The area the text is to be confined to (the yl value is only
|
||||||
|
@ -327,7 +326,7 @@ gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void gfxw_text_info(gfx_state_t *state, gfxw_text_t *text, int *lines_nr,
|
void gfxw_text_info(gfx_state_t *state, gfxw_text_t *text, int *lines_nr,
|
||||||
int *lineheight, int *offset);
|
int *lineheight, int *offset);
|
||||||
/* Determines text widget meta-information
|
/* Determines text widget meta-information
|
||||||
** Parameters: (gfx_state_t *) state: The state to operate on
|
** Parameters: (gfx_state_t *) state: The state to operate on
|
||||||
** (gfx_text_t *) text: The widget to query
|
** (gfx_text_t *) text: The widget to query
|
||||||
|
@ -438,7 +437,7 @@ gfxw_port_t *gfxw_find_default_port(gfxw_visual_t *visual);
|
||||||
void gfxw_port_set_auto_restore(gfxw_visual_t *visual, gfxw_port_t *window, rect_t auto_rect);
|
void gfxw_port_set_auto_restore(gfxw_visual_t *visual, gfxw_port_t *window, rect_t auto_rect);
|
||||||
/* Sets rectangle to be restored upon port removal
|
/* Sets rectangle to be restored upon port removal
|
||||||
** Parameters: (state_t *) s: The state to operate on
|
** Parameters: (state_t *) s: The state to operate on
|
||||||
(gfxw_port_t *) window: The affected window
|
** (gfxw_port_t *) window: The affected window
|
||||||
** (rect_t) auto_rect: The area to restore
|
** (rect_t) auto_rect: The area to restore
|
||||||
** Returns : (void)
|
** Returns : (void)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Sci {
|
||||||
|
|
||||||
#define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate
|
#define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate
|
||||||
|
|
||||||
#undef GFXW_DEBUG_DIRTY
|
#undef GFXW_DEBUG_DIRTY
|
||||||
// Enable to debug stuff relevant for dirty rectsin widget management
|
// Enable to debug stuff relevant for dirty rectsin widget management
|
||||||
|
|
||||||
#ifdef GFXW_DEBUG_DIRTY
|
#ifdef GFXW_DEBUG_DIRTY
|
||||||
|
@ -251,7 +251,7 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int priority, int control,
|
static int _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int priority, int control,
|
||||||
rect_t src, rect_t dest, rect_t clip, int static_buf, gfx_pixmap_t *control_map, gfx_pixmap_t *priority_map) {
|
rect_t src, rect_t dest, rect_t clip, int static_buf, gfx_pixmap_t *control_map, gfx_pixmap_t *priority_map) {
|
||||||
int error;
|
int error;
|
||||||
rect_t clipped_dest = gfx_rect(dest.x, dest.y, dest.xl, dest.yl);
|
rect_t clipped_dest = gfx_rect(dest.x, dest.y, dest.xl, dest.yl);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ int gfxop_init_default(gfx_state_t *state, gfx_options_t *options, void *misc_in
|
||||||
}
|
}
|
||||||
|
|
||||||
int gfxop_init(gfx_state_t *state, int xfact, int yfact, gfx_color_mode_t bpp,
|
int gfxop_init(gfx_state_t *state, int xfact, int yfact, gfx_color_mode_t bpp,
|
||||||
gfx_options_t *options, void *misc_info) {
|
gfx_options_t *options, void *misc_info) {
|
||||||
int color_depth = bpp ? bpp : 1;
|
int color_depth = bpp ? bpp : 1;
|
||||||
int initialized = 0;
|
int initialized = 0;
|
||||||
|
|
||||||
|
@ -974,7 +974,7 @@ static int simulate_stippled_line_draw(gfx_driver_t *driver, int skipone, Common
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode,
|
static int _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode,
|
||||||
gfx_line_style_t line_style) {
|
gfx_line_style_t line_style) {
|
||||||
int retval;
|
int retval;
|
||||||
int skipone = (start.x ^ end.y) & 1; // Used for simulated line stippling
|
int skipone = (start.x ^ end.y) & 1; // Used for simulated line stippling
|
||||||
|
|
||||||
|
@ -1013,7 +1013,7 @@ static int _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Com
|
||||||
}
|
}
|
||||||
|
|
||||||
int gfxop_draw_line(gfx_state_t *state, Common::Point start, Common::Point end,
|
int gfxop_draw_line(gfx_state_t *state, Common::Point start, Common::Point end,
|
||||||
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
||||||
int xfact, yfact;
|
int xfact, yfact;
|
||||||
|
|
||||||
BASIC_CHECKS(GFX_FATAL);
|
BASIC_CHECKS(GFX_FATAL);
|
||||||
|
@ -1077,7 +1077,7 @@ int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx
|
||||||
lower_left = Common::Point(x, y + yl);
|
lower_left = Common::Point(x, y + yl);
|
||||||
lower_right = Common::Point(x + xl, y + yl);
|
lower_right = Common::Point(x + xl, y + yl);
|
||||||
|
|
||||||
#define PARTIAL_LINE(pt1, pt2) \
|
#define PARTIAL_LINE(pt1, pt2) \
|
||||||
retval |= _gfxop_draw_line_clipped(state, pt1, pt2, color, line_mode, line_style); \
|
retval |= _gfxop_draw_line_clipped(state, pt1, pt2, color, line_mode, line_style); \
|
||||||
draw_line_to_control_map(state, pt1##_u, pt2##_u, color); \
|
draw_line_to_control_map(state, pt1##_u, pt2##_u, color); \
|
||||||
_gfxop_add_dirty_x(state, gfx_rect(pt1##_u.x, pt1##_u.y, pt2##_u.x - pt1##_u.x, pt2##_u.y - pt1##_u.y))
|
_gfxop_add_dirty_x(state, gfx_rect(pt1##_u.x, pt1##_u.y, pt2##_u.x - pt1##_u.x, pt2##_u.y - pt1##_u.y))
|
||||||
|
@ -1222,7 +1222,7 @@ static int _gfxop_buffer_propagate_box(gfx_state_t *state, rect_t box, gfx_buffe
|
||||||
return GFX_OK;
|
return GFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int sci0_palette;
|
extern int sci0_palette;
|
||||||
|
|
||||||
int gfxop_clear_box(gfx_state_t *state, rect_t box) {
|
int gfxop_clear_box(gfx_state_t *state, rect_t box) {
|
||||||
BASIC_CHECKS(GFX_FATAL);
|
BASIC_CHECKS(GFX_FATAL);
|
||||||
|
@ -1932,18 +1932,18 @@ int gfxop_get_text_params(gfx_state_t *state, int font_nr, const char *text, int
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COL_XLATE(des,src) \
|
#define COL_XLATE(des,src) \
|
||||||
des = src.visual; /* The new gfx_color_t structure makes things a lot easier :-) */ /* \
|
des = src.visual; /* The new gfx_color_t structure makes things a lot easier :-) */ /* \
|
||||||
if (gfxop_set_color(state, &src, \
|
if (gfxop_set_color(state, &src, \
|
||||||
src.visual.r, \
|
src.visual.r, \
|
||||||
src.visual.g, \
|
src.visual.g, \
|
||||||
src.visual.b, \
|
src.visual.b, \
|
||||||
src.alpha, \
|
src.alpha, \
|
||||||
src.priority, \
|
src.priority, \
|
||||||
src.control)) \
|
src.control)) \
|
||||||
{ \
|
{ \
|
||||||
GFXERROR("Unable to set up colors"); \
|
GFXERROR("Unable to set up colors"); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfx_text_handle_t *gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth, gfx_alignment_t halign,
|
gfx_text_handle_t *gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth, gfx_alignment_t halign,
|
||||||
|
|
|
@ -81,20 +81,20 @@ gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options, g
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FREEALL(freecmd, type) \
|
#define FREEALL(freecmd, type) \
|
||||||
if (resource->scaled_data.type) \
|
if (resource->scaled_data.type) \
|
||||||
freecmd(driver, resource->scaled_data.type); \
|
freecmd(driver, resource->scaled_data.type); \
|
||||||
resource->scaled_data.type = NULL; \
|
resource->scaled_data.type = NULL; \
|
||||||
if (resource->unscaled_data.type) \
|
if (resource->unscaled_data.type) \
|
||||||
freecmd(driver, resource->unscaled_data.type); \
|
freecmd(driver, resource->unscaled_data.type); \
|
||||||
resource->unscaled_data.type = NULL;
|
resource->unscaled_data.type = NULL;
|
||||||
|
|
||||||
#define FREEALL_SIMPLE(freecmd, type) \
|
#define FREEALL_SIMPLE(freecmd, type) \
|
||||||
if (resource->scaled_data.type) \
|
if (resource->scaled_data.type) \
|
||||||
freecmd(resource->scaled_data.type); \
|
freecmd(resource->scaled_data.type); \
|
||||||
resource->scaled_data.type = NULL; \
|
resource->scaled_data.type = NULL; \
|
||||||
if (resource->unscaled_data.type) \
|
if (resource->unscaled_data.type) \
|
||||||
freecmd(resource->unscaled_data.type); \
|
freecmd(resource->unscaled_data.type); \
|
||||||
resource->unscaled_data.type = NULL;
|
resource->unscaled_data.type = NULL;
|
||||||
|
|
||||||
void gfxr_free_resource(gfx_driver_t *driver, gfx_resource_t *resource, int type) {
|
void gfxr_free_resource(gfx_driver_t *driver, gfx_resource_t *resource, int type) {
|
||||||
if (!resource)
|
if (!resource)
|
||||||
|
@ -227,13 +227,13 @@ void gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state) {
|
||||||
if (maps & key) { \
|
if (maps & key) { \
|
||||||
if (res->unscaled_data.pic&& (force || !res->unscaled_data.pic->entry->data)) { \
|
if (res->unscaled_data.pic&& (force || !res->unscaled_data.pic->entry->data)) { \
|
||||||
if (key == GFX_MASK_VISUAL) \
|
if (key == GFX_MASK_VISUAL) \
|
||||||
gfx_get_res_config(options, res->unscaled_data.pic->entry); \
|
gfx_get_res_config(options, res->unscaled_data.pic->entry); \
|
||||||
gfx_xlate_pixmap(res->unscaled_data.pic->entry, mode, filter); \
|
gfx_xlate_pixmap(res->unscaled_data.pic->entry, mode, filter); \
|
||||||
} if (scaled && res->scaled_data.pic && (force || !res->scaled_data.pic->entry->data)) { \
|
} if (scaled && res->scaled_data.pic && (force || !res->scaled_data.pic->entry->data)) { \
|
||||||
if (key == GFX_MASK_VISUAL) \
|
if (key == GFX_MASK_VISUAL) \
|
||||||
gfx_get_res_config(options, res->scaled_data.pic->entry); \
|
gfx_get_res_config(options, res->scaled_data.pic->entry); \
|
||||||
gfx_xlate_pixmap(res->scaled_data.pic->entry, mode, filter); \
|
gfx_xlate_pixmap(res->scaled_data.pic->entry, mode, filter); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode,
|
static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode,
|
||||||
|
|
|
@ -45,7 +45,7 @@ int sci0_palette = 0;
|
||||||
|
|
||||||
// Copied from include/kernel.h
|
// Copied from include/kernel.h
|
||||||
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
|
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
|
||||||
((first) + (((nr)-1) * (last - first)) / 14)))
|
((first) + (((nr)-1) * (last - first)) / 14)))
|
||||||
|
|
||||||
// Default color maps
|
// Default color maps
|
||||||
gfx_pixmap_color_t gfx_sci0_image_colors[SCI0_MAX_PALETTE+1][GFX_SCI0_IMAGE_COLORS_NR] = {
|
gfx_pixmap_color_t gfx_sci0_image_colors[SCI0_MAX_PALETTE+1][GFX_SCI0_IMAGE_COLORS_NR] = {
|
||||||
|
@ -202,22 +202,22 @@ void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size) {
|
||||||
|
|
||||||
#define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
|
#define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
|
||||||
linearend, nonlinearstart, linearmod, nonlinearmod, operation) \
|
linearend, nonlinearstart, linearmod, nonlinearmod, operation) \
|
||||||
x = (startx); y = (starty); \
|
x = (startx); y = (starty); \
|
||||||
incrNE = ((deltalinear) > 0)? (deltalinear) : -(deltalinear); \
|
incrNE = ((deltalinear) > 0)? (deltalinear) : -(deltalinear); \
|
||||||
incrNE <<= 1; \
|
incrNE <<= 1; \
|
||||||
deltanonlinear <<= 1; \
|
deltanonlinear <<= 1; \
|
||||||
incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear); \
|
incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear); \
|
||||||
d = nonlinearstart-1; \
|
d = nonlinearstart-1; \
|
||||||
while (linearvar != (linearend)) { \
|
while (linearvar != (linearend)) { \
|
||||||
buffer[linewidth * y + x] operation color; \
|
buffer[linewidth * y + x] operation color; \
|
||||||
/* color ^= color2; color2 ^= color; color ^= color2; */ /* Swap colors */ \
|
/* color ^= color2; color2 ^= color; color ^= color2; */ /* Swap colors */ \
|
||||||
linearvar += linearmod; \
|
linearvar += linearmod; \
|
||||||
if ((d+=incrE) < 0) { \
|
if ((d+=incrE) < 0) { \
|
||||||
d += incrNE; \
|
d += incrNE; \
|
||||||
nonlinearvar += nonlinearmod; \
|
nonlinearvar += nonlinearmod; \
|
||||||
}; \
|
}; \
|
||||||
}; \
|
}; \
|
||||||
buffer[linewidth * y + x] operation color;
|
buffer[linewidth * y + x] operation color;
|
||||||
|
|
||||||
static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int color2, int sci_titlebar_size) {
|
static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int color2, int sci_titlebar_size) {
|
||||||
int dx, dy, incrE, incrNE, d, finalx, finaly;
|
int dx, dy, incrE, incrNE, d, finalx, finaly;
|
||||||
|
@ -556,7 +556,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int x, int y,
|
static void _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int x, int y,
|
||||||
int rad_x, int rad_y, int color, int fillstyle) {
|
int rad_x, int rad_y, int color, int fillstyle) {
|
||||||
int xx = 0, yy = rad_y;
|
int xx = 0, yy = rad_y;
|
||||||
int i, x_i, y_i;
|
int i, x_i, y_i;
|
||||||
int xr = 2 * rad_x * rad_x;
|
int xr = 2 * rad_x * rad_x;
|
||||||
|
@ -621,7 +621,7 @@ static void _gfxr_fill_ellipse(gfxr_pic_t *pic, byte *buffer, int linewidth, int
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _gfxr_auxplot_brush(gfxr_pic_t *pic, byte *buffer, int yoffset, int offset, int plot,
|
static inline void _gfxr_auxplot_brush(gfxr_pic_t *pic, byte *buffer, int yoffset, int offset, int plot,
|
||||||
int color, gfx_brush_mode_t brush_mode, int randseed) {
|
int color, gfx_brush_mode_t brush_mode, int randseed) {
|
||||||
// yoffset 63680, offset 320, plot 1, color 34, brush_mode 0, randseed 432)*/
|
// yoffset 63680, offset 320, plot 1, color 34, brush_mode 0, randseed 432)*/
|
||||||
// Auxplot: Used by plot_aux_pattern to plot to visual and priority
|
// Auxplot: Used by plot_aux_pattern to plot to visual and priority
|
||||||
int xc, yc;
|
int xc, yc;
|
||||||
|
@ -690,7 +690,7 @@ static inline void _gfxr_auxplot_brush(gfxr_pic_t *pic, byte *buffer, int yoffse
|
||||||
#define PLOT_AUX_PATTERN_NO_RANDOM -1
|
#define PLOT_AUX_PATTERN_NO_RANDOM -1
|
||||||
|
|
||||||
static void _gfxr_plot_aux_pattern(gfxr_pic_t *pic, int x, int y, int size, int circle, int random,
|
static void _gfxr_plot_aux_pattern(gfxr_pic_t *pic, int x, int y, int size, int circle, int random,
|
||||||
int mask, int color, int priority, int control, gfx_brush_mode_t brush_mode, int map_nr) {
|
int mask, int color, int priority, int control, gfx_brush_mode_t brush_mode, int map_nr) {
|
||||||
// Plots an appropriate pattern to the aux buffer and the control buffer,
|
// Plots an appropriate pattern to the aux buffer and the control buffer,
|
||||||
// if mask & GFX_MASK_CONTROL
|
// if mask & GFX_MASK_CONTROL
|
||||||
// random should be set to the random index, or -1 to disable
|
// random should be set to the random index, or -1 to disable
|
||||||
|
@ -813,7 +813,7 @@ static void _gfxr_plot_aux_pattern(gfxr_pic_t *pic, int x, int y, int size, int
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int priority, int control, int drawenable,
|
static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int priority, int control, int drawenable,
|
||||||
int pattern_code, int pattern_size, int pattern_nr, gfx_brush_mode_t brush_mode, int sci_titlebar_size) {
|
int pattern_code, int pattern_size, int pattern_nr, gfx_brush_mode_t brush_mode, int sci_titlebar_size) {
|
||||||
int xsize = (pattern_size + 1) * pic->mode->xfact - 1;
|
int xsize = (pattern_size + 1) * pic->mode->xfact - 1;
|
||||||
int ysize = (pattern_size + 1) * pic->mode->yfact - 1;
|
int ysize = (pattern_size + 1) * pic->mode->yfact - 1;
|
||||||
int scaled_x, scaled_y;
|
int scaled_x, scaled_y;
|
||||||
|
@ -928,7 +928,7 @@ static inline void _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int color,
|
static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int color,
|
||||||
int priority, int control, int drawenable, int line_mode, int cmd, int sci_titlebar_size) {
|
int priority, int control, int drawenable, int line_mode, int cmd, int sci_titlebar_size) {
|
||||||
int scale_x = pic->mode->xfact;
|
int scale_x = pic->mode->xfact;
|
||||||
int scale_y = pic->mode->yfact;
|
int scale_y = pic->mode->yfact;
|
||||||
int xc, yc;
|
int xc, yc;
|
||||||
|
@ -1060,7 +1060,7 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_y, int x_320,
|
static inline int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_y, int x_320,
|
||||||
int y_200, int color, int drawenable, int *x, int *y) {
|
int y_200, int color, int drawenable, int *x, int *y) {
|
||||||
// returns -1 on failure, 0 on success
|
// returns -1 on failure, 0 on success
|
||||||
int linewidth = pic->mode->xfact * 320;
|
int linewidth = pic->mode->xfact * 320;
|
||||||
int mpos, ix, iy;
|
int mpos, ix, iy;
|
||||||
|
@ -1083,7 +1083,7 @@ static inline int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, i
|
||||||
test_map = pic->visual_map->index_data;
|
test_map = pic->visual_map->index_data;
|
||||||
|
|
||||||
if ((color & 0xf) == 0xf // When dithering with white, do more
|
if ((color & 0xf) == 0xf // When dithering with white, do more
|
||||||
// conservative checks
|
// conservative checks
|
||||||
|| (color & 0xf0) == 0xf0)
|
|| (color & 0xf0) == 0xf0)
|
||||||
legalcolor = 0xff;
|
legalcolor = 0xff;
|
||||||
else
|
else
|
||||||
|
@ -1127,7 +1127,7 @@ static inline int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, i
|
||||||
#undef TEST_POINT
|
#undef TEST_POINT
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
||||||
// Now include the actual filling code (with scaling support)
|
// Now include the actual filling code (with scaling support)
|
||||||
#define FILL_FUNCTION _gfxr_fill_any
|
#define FILL_FUNCTION _gfxr_fill_any
|
||||||
#define FILL_FUNCTION_RECURSIVE _gfxr_fill_any_recursive
|
#define FILL_FUNCTION_RECURSIVE _gfxr_fill_any_recursive
|
||||||
|
@ -1145,9 +1145,9 @@ static inline int _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, i
|
||||||
namespace Sci {
|
namespace Sci {
|
||||||
|
|
||||||
#endif // defined(WITH_PIC_SCALING)
|
#endif // defined(WITH_PIC_SCALING)
|
||||||
|
|
||||||
} // End of namespace Sci
|
} // End of namespace Sci
|
||||||
|
|
||||||
// Include again, but this time without support for scaling
|
// Include again, but this time without support for scaling
|
||||||
#define FILL_FUNCTION _gfxr_fill_1
|
#define FILL_FUNCTION _gfxr_fill_1
|
||||||
#define FILL_FUNCTION_RECURSIVE _gfxr_fill_1_recursive
|
#define FILL_FUNCTION_RECURSIVE _gfxr_fill_1_recursive
|
||||||
|
@ -1175,7 +1175,7 @@ namespace Sci {
|
||||||
x -= ((temp >> 4) & 0x7); \
|
x -= ((temp >> 4) & 0x7); \
|
||||||
else \
|
else \
|
||||||
x += (temp >> 4); \
|
x += (temp >> 4); \
|
||||||
\
|
\
|
||||||
if (temp & 0x08) \
|
if (temp & 0x08) \
|
||||||
y -= (temp & 0x7); \
|
y -= (temp & 0x7); \
|
||||||
else \
|
else \
|
||||||
|
@ -1666,7 +1666,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size,
|
||||||
|
|
||||||
// we can only safely replace the palette if it's static
|
// we can only safely replace the palette if it's static
|
||||||
// *if it's not for some reason, we should die
|
// *if it's not for some reason, we should die
|
||||||
|
|
||||||
if (!(view->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE) && !sci1) {
|
if (!(view->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE) && !sci1) {
|
||||||
sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view!\n");
|
sciprintf("gfx_draw_pic0(): can't set a non-static palette for an embedded view!\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace Sci {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void FILL_FUNCTION_RECURSIVE(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy, byte *bounds,
|
static void FILL_FUNCTION_RECURSIVE(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy, byte *bounds,
|
||||||
int legalcolor, int legalmask, int color, int priority, int drawenable, int sci_titlebar_size) {
|
int legalcolor, int legalmask, int color, int priority, int drawenable, int sci_titlebar_size) {
|
||||||
int linewidth = pic->mode->xfact * 320;
|
int linewidth = pic->mode->xfact * 320;
|
||||||
int miny = pic->mode->yfact * sci_titlebar_size;
|
int miny = pic->mode->yfact * sci_titlebar_size;
|
||||||
int maxy = pic->mode->yfact * 200;
|
int maxy = pic->mode->yfact * 200;
|
||||||
|
@ -265,7 +265,7 @@ static void FILL_FUNCTION_RECURSIVE(gfxr_pic_t *pic, int old_xl, int old_xr, int
|
||||||
|
|
||||||
|
|
||||||
static void FILL_FUNCTION(gfxr_pic_t *pic, int x_320, int y_200, int color, int priority, int control, int drawenable,
|
static void FILL_FUNCTION(gfxr_pic_t *pic, int x_320, int y_200, int color, int priority, int control, int drawenable,
|
||||||
int sci_titlebar_size) {
|
int sci_titlebar_size) {
|
||||||
int linewidth = pic->mode->xfact * 320;
|
int linewidth = pic->mode->xfact * 320;
|
||||||
int x, y;
|
int x, y;
|
||||||
int xl, xr;
|
int xl, xr;
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Sci {
|
||||||
#define CLIPMASK_HARD_BOUND 0x80 /* ensures that we don't re-fill filled stuff */
|
#define CLIPMASK_HARD_BOUND 0x80 /* ensures that we don't re-fill filled stuff */
|
||||||
|
|
||||||
static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy,
|
static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy,
|
||||||
int clipmask, int control, int sci_titlebar_size) {
|
int clipmask, int control, int sci_titlebar_size) {
|
||||||
int xl, xr;
|
int xl, xr;
|
||||||
int oldytotal = y * 320;
|
int oldytotal = y * 320;
|
||||||
#ifdef DRAW_SCALED
|
#ifdef DRAW_SCALED
|
||||||
|
@ -72,7 +72,7 @@ static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, i
|
||||||
|
|
||||||
if ((ytotal + xl) < 0) {
|
if ((ytotal + xl) < 0) {
|
||||||
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
fprintf(stderr, "AARGH-%d\n", __LINE__);
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
xr = xl;
|
xr = xl;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
|
||||||
int flags, int default_palette, int nr, void *internal) {
|
int flags, int default_palette, int nr, void *internal) {
|
||||||
ResourceManager *resmgr = (ResourceManager *)state->misc_payload;
|
ResourceManager *resmgr = (ResourceManager *)state->misc_payload;
|
||||||
resource_t *res = scir_find_resource(resmgr, sci_pic, nr, 0);
|
resource_t *res = scir_find_resource(resmgr, sci_pic, nr, 0);
|
||||||
int need_unscaled = unscaled_pic != NULL;
|
int need_unscaled = unscaled_pic != NULL;
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Sci {
|
||||||
literal_pos += n;
|
literal_pos += n;
|
||||||
|
|
||||||
static int decompress_sci_view(int id, int loop, int cel, byte *resource, byte *dest, int mirrored, int pixmap_size, int size,
|
static int decompress_sci_view(int id, int loop, int cel, byte *resource, byte *dest, int mirrored, int pixmap_size, int size,
|
||||||
int runlength_pos, int literal_pos, int xl, int yl, int color_key) {
|
int runlength_pos, int literal_pos, int xl, int yl, int color_key) {
|
||||||
int writepos = mirrored ? xl : 0;
|
int writepos = mirrored ? xl : 0;
|
||||||
|
|
||||||
if (mirrored) {
|
if (mirrored) {
|
||||||
|
@ -178,7 +178,7 @@ static int decompress_sci_view(int id, int loop, int cel, byte *resource, byte *
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decompress_sci_view_amiga(int id, int loop, int cel, byte *resource, byte *dest, int mirrored, int pixmap_size, int size,
|
static int decompress_sci_view_amiga(int id, int loop, int cel, byte *resource, byte *dest, int mirrored, int pixmap_size, int size,
|
||||||
int pos, int xl, int yl, int color_key) {
|
int pos, int xl, int yl, int color_key) {
|
||||||
int writepos = mirrored ? xl - 1 : 0;
|
int writepos = mirrored ? xl - 1 : 0;
|
||||||
|
|
||||||
while (writepos < pixmap_size && pos < size) {
|
while (writepos < pixmap_size && pos < size) {
|
||||||
|
@ -315,7 +315,7 @@ static int gfxr_draw_loop1(gfxr_loop_t *dest, int id, int loop, int mirrored, by
|
||||||
//static byte view_magics[V1_MAGICS_NR] = {0x80, 0x00, 0x00, 0x00, 0x00};
|
//static byte view_magics[V1_MAGICS_NR] = {0x80, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal,
|
gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal,
|
||||||
int static_pal_nr) {
|
int static_pal_nr) {
|
||||||
int i;
|
int i;
|
||||||
int palette_offset;
|
int palette_offset;
|
||||||
gfxr_view_t *view;
|
gfxr_view_t *view;
|
||||||
|
@ -457,7 +457,7 @@ gfx_pixmap_t *gfxr_draw_cel11(int id, int loop, int cel, int mirrored, byte *res
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxr_loop_t *gfxr_draw_loop11(int id, int loop, int mirrored, byte *resource_base, byte *loop_base, int size, int cels_nr,
|
gfxr_loop_t *gfxr_draw_loop11(int id, int loop, int mirrored, byte *resource_base, byte *loop_base, int size, int cels_nr,
|
||||||
gfxr_loop_t *result, gfxr_view_t *view, int bytes_per_cel) {
|
gfxr_loop_t *result, gfxr_view_t *view, int bytes_per_cel) {
|
||||||
byte *seeker = loop_base;
|
byte *seeker = loop_base;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ void *sbtree_get(sbtree_t *tree, int key);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sbtree_foreach(sbtree_t *tree, void *args, void *(*operation)(sbtree_t *, const int,
|
void sbtree_foreach(sbtree_t *tree, void *args, void *(*operation)(sbtree_t *, const int,
|
||||||
const void *, void *));
|
const void *, void *));
|
||||||
/* Operates once on each entry in the tree
|
/* Operates once on each entry in the tree
|
||||||
** Parameters: (sbtree_t *) tree: The tree to operate on
|
** Parameters: (sbtree_t *) tree: The tree to operate on
|
||||||
** (void *) arguments: Additional arguments to pass to 'operation'
|
** (void *) arguments: Additional arguments to pass to 'operation'
|
||||||
|
|
|
@ -128,7 +128,7 @@ static void sciw_make_window_fit(rect_t *rect, gfxw_port_t *parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
|
gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
|
||||||
int title_font, gfx_color_t title_color, gfx_color_t title_bgcolor, const char *title, int flags) {
|
int title_font, gfx_color_t title_color, gfx_color_t title_bgcolor, const char *title, int flags) {
|
||||||
gfxw_visual_t *visual = s->visual;
|
gfxw_visual_t *visual = s->visual;
|
||||||
gfx_state_t *state = s->gfx_state;
|
gfx_state_t *state = s->gfx_state;
|
||||||
int shadow_offset = 2;
|
int shadow_offset = 2;
|
||||||
|
@ -260,7 +260,7 @@ static inline rect_t _move_and_extend_rect(rect_t rect, Common::Point point, int
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_list_t *_sciw_add_text_to_list(gfxw_list_t *list, gfxw_port_t *port, rect_t zone, char *text,
|
gfxw_list_t *_sciw_add_text_to_list(gfxw_list_t *list, gfxw_port_t *port, rect_t zone, char *text,
|
||||||
int font, gfx_alignment_t align, char framed, char inverse, int flags, char gray_text) {
|
int font, gfx_alignment_t align, char framed, char inverse, int flags, char gray_text) {
|
||||||
gfx_color_t *color1, *color2, *bgcolor;
|
gfx_color_t *color1, *color2, *bgcolor;
|
||||||
|
|
||||||
if (inverse) {
|
if (inverse) {
|
||||||
|
@ -407,7 +407,7 @@ gfxw_list_t *sciw_new_edit_control(gfxw_port_t *port, reg_t ID, rect_t zone, cha
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int view, int loop, int cel,
|
gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int view, int loop, int cel,
|
||||||
char frame, char inverse) {
|
char frame, char inverse) {
|
||||||
gfxw_list_t *list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
|
gfxw_list_t *list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
|
||||||
gfxw_widget_t *icon;
|
gfxw_widget_t *icon;
|
||||||
gfxw_set_id(GFXW(list), ID.segment, ID.offset);
|
gfxw_set_id(GFXW(list), ID.segment, ID.offset);
|
||||||
|
@ -436,7 +436,7 @@ gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, char **entries_list,
|
gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, char **entries_list,
|
||||||
int entries_nr, int list_top, int selection, char inverse) {
|
int entries_nr, int list_top, int selection, char inverse) {
|
||||||
gfxw_list_t *list;
|
gfxw_list_t *list;
|
||||||
|
|
||||||
char arr_up[2], arr_down[2];
|
char arr_up[2], arr_down[2];
|
||||||
|
|
|
@ -182,7 +182,7 @@ static inline int verify_widget(gfxw_widget_t *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VERIFY_WIDGET(w) \
|
#define VERIFY_WIDGET(w) \
|
||||||
if (verify_widget((gfxw_widget_t *)(w))) { GFXERROR("Error occured while validating widget\n"); }
|
if (verify_widget((gfxw_widget_t *)(w))) { GFXERROR("Error occured while validating widget\n"); }
|
||||||
|
|
||||||
static void _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) {
|
static void _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) {
|
||||||
if (GFXW_IS_TEXT(widget)) {
|
if (GFXW_IS_TEXT(widget)) {
|
||||||
|
@ -205,15 +205,15 @@ static void _gfxw_unallocate_widget(gfx_state_t *state, gfxw_widget_t *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GFX_ASSERT(_x) \
|
#define GFX_ASSERT(_x) \
|
||||||
{ \
|
{ \
|
||||||
int retval = (_x); \
|
int retval = (_x); \
|
||||||
if (retval == GFX_ERROR) { \
|
if (retval == GFX_ERROR) { \
|
||||||
GFXERROR("Error occured while drawing widget!\n"); \
|
GFXERROR("Error occured while drawing widget!\n"); \
|
||||||
return 1; \
|
return 1; \
|
||||||
} else if (retval == GFX_FATAL) { \
|
} else if (retval == GFX_FATAL) { \
|
||||||
error("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \
|
error("Fatal error occured while drawing widget!\nGraphics state invalid; aborting program..."); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
//********** Widgets *************
|
//********** Widgets *************
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ static int _gfxwop_basic_should_replace(gfxw_widget_t *widget, gfxw_widget_t *ot
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _gfxw_set_ops(gfxw_widget_t *widget, gfxw_point_op *draw, gfxw_op *free, gfxw_op *tag, gfxw_op_int *print,
|
static inline void _gfxw_set_ops(gfxw_widget_t *widget, gfxw_point_op *draw, gfxw_op *free, gfxw_op *tag, gfxw_op_int *print,
|
||||||
gfxw_bin_op *compare_to, gfxw_bin_op *equals, gfxw_bin_op *superarea_of) {
|
gfxw_bin_op *compare_to, gfxw_bin_op *equals, gfxw_bin_op *superarea_of) {
|
||||||
widget->draw = draw;
|
widget->draw = draw;
|
||||||
widget->widfree = free;
|
widget->widfree = free;
|
||||||
widget->tag = tag;
|
widget->tag = tag;
|
||||||
|
@ -699,7 +699,7 @@ void _gfxw_set_ops_VIEW(gfxw_widget_t *view, char stat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_view_t *gfxw_new_view(gfx_state_t *state, Common::Point pos, int view_nr, int loop, int cel, int palette, int priority, int control,
|
gfxw_view_t *gfxw_new_view(gfx_state_t *state, Common::Point pos, int view_nr, int loop, int cel, int palette, int priority, int control,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign, int flags) {
|
gfx_alignment_t halign, gfx_alignment_t valign, int flags) {
|
||||||
gfxw_view_t *view;
|
gfxw_view_t *view;
|
||||||
|
|
||||||
if (flags & GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET) {
|
if (flags & GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET) {
|
||||||
|
@ -841,7 +841,7 @@ void _gfxw_set_ops_PICVIEW(gfxw_widget_t *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
gfxw_dyn_view_t *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign, int sequence) {
|
gfx_alignment_t halign, gfx_alignment_t valign, int sequence) {
|
||||||
gfxw_dyn_view_t *widget;
|
gfxw_dyn_view_t *widget;
|
||||||
int width, height;
|
int width, height;
|
||||||
int xalignmod, yalignmod;
|
int xalignmod, yalignmod;
|
||||||
|
@ -992,7 +992,7 @@ void _gfxw_set_ops_TEXT(gfxw_widget_t *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
||||||
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bgcolor, int text_flags) {
|
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bgcolor, int text_flags) {
|
||||||
gfxw_text_t *widget = (gfxw_text_t *)_gfxw_new_widget(sizeof(gfxw_text_t), GFXW_TEXT);
|
gfxw_text_t *widget = (gfxw_text_t *)_gfxw_new_widget(sizeof(gfxw_text_t), GFXW_TEXT);
|
||||||
|
|
||||||
widget->widget_priority = _gfxw_color_get_priority(color1);
|
widget->widget_priority = _gfxw_color_get_priority(color1);
|
||||||
|
@ -1047,10 +1047,10 @@ static int _gfxwop_container_add_dirty_rel(gfxw_container_t *cont, rect_t rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _gfxw_set_container_ops(gfxw_container_t *container, gfxw_point_op *draw, gfxw_op *free, gfxw_op *tag,
|
static inline void _gfxw_set_container_ops(gfxw_container_t *container, gfxw_point_op *draw, gfxw_op *free, gfxw_op *tag,
|
||||||
gfxw_op_int *print, gfxw_bin_op *compare_to, gfxw_bin_op *equals,
|
gfxw_op_int *print, gfxw_bin_op *compare_to, gfxw_bin_op *equals,
|
||||||
gfxw_bin_op *superarea_of, gfxw_visual_op *set_visual,
|
gfxw_bin_op *superarea_of, gfxw_visual_op *set_visual,
|
||||||
gfxw_unary_container_op *free_tagged, gfxw_unary_container_op *free_contents,
|
gfxw_unary_container_op *free_tagged, gfxw_unary_container_op *free_contents,
|
||||||
gfxw_rect_op *add_dirty, gfxw_container_op *add) {
|
gfxw_rect_op *add_dirty, gfxw_container_op *add) {
|
||||||
_gfxw_set_ops(GFXW(container), draw, free, tag, print, compare_to, equals, superarea_of);
|
_gfxw_set_ops(GFXW(container), draw, free, tag, print, compare_to, equals, superarea_of);
|
||||||
|
|
||||||
container->free_tagged = free_tagged;
|
container->free_tagged = free_tagged;
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct abs_rect_t {
|
||||||
|
|
||||||
|
|
||||||
#define INV_SEL(_object_, _selector_, _noinvalid_) \
|
#define INV_SEL(_object_, _selector_, _noinvalid_) \
|
||||||
s, _object_, s->selector_map._selector_, _noinvalid_, funct_nr, argv, argc, __FILE__, __LINE__
|
s, _object_, s->selector_map._selector_, _noinvalid_, funct_nr, argv, argc, __FILE__, __LINE__
|
||||||
/* Kludge for use with invoke_selector(). Used for compatibility with compilers that can't
|
/* Kludge for use with invoke_selector(). Used for compatibility with compilers that can't
|
||||||
** handle vararg macros.
|
** handle vararg macros.
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +88,7 @@ struct abs_rect_t {
|
||||||
reg_t read_selector(EngineState *s, reg_t object, selector_t selector_id, const char *fname, int line);
|
reg_t read_selector(EngineState *s, reg_t object, selector_t selector_id, const char *fname, int line);
|
||||||
void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t value, const char *fname, int line);
|
void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t value, const char *fname, int line);
|
||||||
int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct,
|
int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct,
|
||||||
stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...);
|
stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...);
|
||||||
|
|
||||||
|
|
||||||
/******************** Text functionality ********************/
|
/******************** Text functionality ********************/
|
||||||
|
@ -111,15 +111,15 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index);
|
||||||
#ifdef SCI_KERNEL_DEBUG
|
#ifdef SCI_KERNEL_DEBUG
|
||||||
|
|
||||||
#define CHECK_THIS_KERNEL_FUNCTION if (s->debug_mode & (1 << SCIkFUNCCHK_NR)) {\
|
#define CHECK_THIS_KERNEL_FUNCTION if (s->debug_mode & (1 << SCIkFUNCCHK_NR)) {\
|
||||||
int i;\
|
int i;\
|
||||||
sciprintf("Kernel CHECK: %s[%x](", s->kernel_names[funct_nr], funct_nr); \
|
sciprintf("Kernel CHECK: %s[%x](", s->kernel_names[funct_nr], funct_nr); \
|
||||||
for (i = 0; i < argc; i++) { \
|
for (i = 0; i < argc; i++) { \
|
||||||
sciprintf("%04x", 0xffff & UKPV(i)); \
|
sciprintf("%04x", 0xffff & UKPV(i)); \
|
||||||
if (i+1 < argc) sciprintf(", "); \
|
if (i+1 < argc) sciprintf(", "); \
|
||||||
} \
|
} \
|
||||||
sciprintf(")\n"); \
|
sciprintf(")\n"); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
#else /* !SCI_KERNEL_DEBUG */
|
#else /* !SCI_KERNEL_DEBUG */
|
||||||
|
|
||||||
#define CHECK_THIS_KERNEL_FUNCTION
|
#define CHECK_THIS_KERNEL_FUNCTION
|
||||||
|
@ -200,13 +200,13 @@ int _find_view_priority(EngineState *s, int y);
|
||||||
+ ((((y) - s->priority_first) * 14) / (s->priority_last - s->priority_first))))
|
+ ((((y) - s->priority_first) * 14) / (s->priority_last - s->priority_first))))
|
||||||
|
|
||||||
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
|
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
|
||||||
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 14)))
|
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 14)))
|
||||||
|
|
||||||
#define SCI0_VIEW_PRIORITY(y) (((y) < s->priority_first)? 0 : (((y) >= s->priority_last)? 14 : 1\
|
#define SCI0_VIEW_PRIORITY(y) (((y) < s->priority_first)? 0 : (((y) >= s->priority_last)? 14 : 1\
|
||||||
+ ((((y) - s->priority_first) * 15) / (s->priority_last - s->priority_first))))
|
+ ((((y) - s->priority_first) * 15) / (s->priority_last - s->priority_first))))
|
||||||
|
|
||||||
#define SCI0_PRIORITY_BAND_FIRST(nr) ((((nr) == 0)? 0 : \
|
#define SCI0_PRIORITY_BAND_FIRST(nr) ((((nr) == 0)? 0 : \
|
||||||
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 15)))
|
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 15)))
|
||||||
|
|
||||||
#define VIEW_PRIORITY(y) _find_view_priority(s, y)
|
#define VIEW_PRIORITY(y) _find_view_priority(s, y)
|
||||||
#define PRIORITY_BAND_FIRST(nr) _find_priority_band(s, nr)
|
#define PRIORITY_BAND_FIRST(nr) _find_priority_band(s, nr)
|
||||||
|
|
|
@ -106,7 +106,7 @@ struct { \
|
||||||
|
|
||||||
#define LIST_REMOVE(elm, field) do { \
|
#define LIST_REMOVE(elm, field) do { \
|
||||||
if ((elm)->field.le_next != NULL) \
|
if ((elm)->field.le_next != NULL) \
|
||||||
(elm)->field.le_next->field.le_prev = \
|
(elm)->field.le_next->field.le_prev = \
|
||||||
(elm)->field.le_prev; \
|
(elm)->field.le_prev; \
|
||||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
|
@ -71,8 +71,8 @@ void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
|
gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
|
||||||
int title_font, gfx_color_t title_color, gfx_color_t title_bg_color,
|
int title_font, gfx_color_t title_color, gfx_color_t title_bg_color,
|
||||||
const char *title, int flags);
|
const char *title, int flags);
|
||||||
/* Creates a new SCI style window
|
/* Creates a new SCI style window
|
||||||
** Parameters: (EngineState *) s: The affected game state
|
** Parameters: (EngineState *) s: The affected game state
|
||||||
** (rect_t) area: The screen area to frame (not including a potential window title)
|
** (rect_t) area: The screen area to frame (not including a potential window title)
|
||||||
|
@ -106,7 +106,7 @@ gfxw_list_t *sciw_new_button_control(gfxw_port_t *port, reg_t ID, rect_t zone, c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_text_control(gfxw_port_t *port, reg_t ID, rect_t zone, char *text, int font,
|
gfxw_list_t *sciw_new_text_control(gfxw_port_t *port, reg_t ID, rect_t zone, char *text, int font,
|
||||||
gfx_alignment_t align, char frame, char inverse);
|
gfx_alignment_t align, char frame, char inverse);
|
||||||
/* Creates a new text control list
|
/* Creates a new text control list
|
||||||
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
||||||
** (reg_t) ID: Text widget ID
|
** (reg_t) ID: Text widget ID
|
||||||
|
@ -120,7 +120,7 @@ gfxw_list_t *sciw_new_text_control(gfxw_port_t *port, reg_t ID, rect_t zone, cha
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_edit_control(gfxw_port_t *port, reg_t ID, rect_t zone, char *text, int font, unsigned int cursor,
|
gfxw_list_t *sciw_new_edit_control(gfxw_port_t *port, reg_t ID, rect_t zone, char *text, int font, unsigned int cursor,
|
||||||
char inverse);
|
char inverse);
|
||||||
/* Creates a new edit control list
|
/* Creates a new edit control list
|
||||||
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
||||||
** (reg_t) ID: Text widget ID
|
** (reg_t) ID: Text widget ID
|
||||||
|
@ -133,7 +133,7 @@ gfxw_list_t *sciw_new_edit_control(gfxw_port_t *port, reg_t ID, rect_t zone, cha
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int view, int loop, int cel,
|
gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int view, int loop, int cel,
|
||||||
char frame, char inverse);
|
char frame, char inverse);
|
||||||
/* Creates a new icon control list
|
/* Creates a new icon control list
|
||||||
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
||||||
** (reg_t) ID: Text widget ID
|
** (reg_t) ID: Text widget ID
|
||||||
|
@ -145,7 +145,7 @@ gfxw_list_t *sciw_new_icon_control(gfxw_port_t *port, reg_t ID, rect_t zone, int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, char **entries_list,
|
gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, char **entries_list,
|
||||||
int entries_nr, int list_top, int selection, char inverse);
|
int entries_nr, int list_top, int selection, char inverse);
|
||||||
/* Creates a new list control list
|
/* Creates a new list control list
|
||||||
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
** Parameters: (gfxw_port_t *) port: The port containing the color values to use
|
||||||
** (int) ID: Text widget ID
|
** (int) ID: Text widget ID
|
||||||
|
|
|
@ -160,7 +160,7 @@ struct resource_t {
|
||||||
resource_t *prev;
|
resource_t *prev;
|
||||||
|
|
||||||
resource_altsource_t *alt_sources; /* SLL of alternative resource data sources */
|
resource_altsource_t *alt_sources; /* SLL of alternative resource data sources */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ResourceManager {
|
struct ResourceManager {
|
||||||
|
@ -206,7 +206,7 @@ ResourceSource *scir_add_patch_dir(ResourceManager *mgr, const char *path);
|
||||||
ResourceSource *scir_get_volume(ResourceManager *mgr, ResourceSource *map, int volume_nr);
|
ResourceSource *scir_get_volume(ResourceManager *mgr, ResourceSource *map, int volume_nr);
|
||||||
|
|
||||||
ResourceSource *scir_add_volume(ResourceManager *mgr, ResourceSource *map, const char *filename,
|
ResourceSource *scir_add_volume(ResourceManager *mgr, ResourceSource *map, const char *filename,
|
||||||
int number, int extended_addressing);
|
int number, int extended_addressing);
|
||||||
/* Add a volume to the resource manager's list of sources.
|
/* Add a volume to the resource manager's list of sources.
|
||||||
** Parameters: (ResourceManager *) mgr: The resource manager to look up in
|
** Parameters: (ResourceManager *) mgr: The resource manager to look up in
|
||||||
** (ResourceSource *) map: The map associated with this volume
|
** (ResourceSource *) map: The map associated with this volume
|
||||||
|
@ -280,7 +280,7 @@ int sci0_read_resource_map(ResourceManager *mgr, ResourceSource *map, resource_t
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
|
int sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
|
||||||
resource_t **resource_p, int *resource_nr_p, int *sci_version);
|
resource_t **resource_p, int *resource_nr_p, int *sci_version);
|
||||||
/* Reads the SCI1 resource.map file from a local directory
|
/* Reads the SCI1 resource.map file from a local directory
|
||||||
** Parameters: (char *) path: (unused)
|
** Parameters: (char *) path: (unused)
|
||||||
** (resource_t **) resources: Pointer to a pointer
|
** (resource_t **) resources: Pointer to a pointer
|
||||||
|
|
|
@ -156,23 +156,23 @@ struct code_block_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VM_OBJECT_GET_VARSELECTOR(obj, i) \
|
#define VM_OBJECT_GET_VARSELECTOR(obj, i) \
|
||||||
(s->version < SCI_VERSION(1,001,000) ? \
|
(s->version < SCI_VERSION(1,001,000) ? \
|
||||||
getUInt16(obj->base_obj + obj->variables_nr * 2 + i*2) : \
|
getUInt16(obj->base_obj + obj->variables_nr * 2 + i*2) : \
|
||||||
*(obj->base_vars + i))
|
*(obj->base_vars + i))
|
||||||
#define VM_OBJECT_READ_PROPERTY(obj, i) (obj->variables[i])
|
#define VM_OBJECT_READ_PROPERTY(obj, i) (obj->variables[i])
|
||||||
#define VM_OBJECT_GET_FUNCSELECTOR(obj, i) \
|
#define VM_OBJECT_GET_FUNCSELECTOR(obj, i) \
|
||||||
(s->version < SCI_VERSION(1,001,000) ? \
|
(s->version < SCI_VERSION(1,001,000) ? \
|
||||||
getUInt16((byte *) (obj->base_method + i)) : \
|
getUInt16((byte *) (obj->base_method + i)) : \
|
||||||
getUInt16((byte *) (obj->base_method + i*2 + 1)))
|
getUInt16((byte *) (obj->base_method + i*2 + 1)))
|
||||||
#define VM_OBJECT_READ_FUNCTION(obj, i) \
|
#define VM_OBJECT_READ_FUNCTION(obj, i) \
|
||||||
(s->version < SCI_VERSION(1,001,000) ? \
|
(s->version < SCI_VERSION(1,001,000) ? \
|
||||||
make_reg(obj->pos.segment, \
|
make_reg(obj->pos.segment, \
|
||||||
getUInt16((byte *) (obj->base_method \
|
getUInt16((byte *) (obj->base_method \
|
||||||
+ obj->methods_nr + 1 \
|
+ obj->methods_nr + 1 \
|
||||||
+ i))) : \
|
+ i))) : \
|
||||||
make_reg(obj->pos.segment, \
|
make_reg(obj->pos.segment, \
|
||||||
getUInt16((byte *) (obj->base_method \
|
getUInt16((byte *) (obj->base_method \
|
||||||
+ i * 2 + 2))))
|
+ i * 2 + 2))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ extern int max_instance;
|
||||||
|
|
||||||
/*inline*/
|
/*inline*/
|
||||||
exec_stack_t *execute_method(EngineState *s, uint16 script, uint16 pubfunct, stack_ptr_t sp, reg_t calling_obj,
|
exec_stack_t *execute_method(EngineState *s, uint16 script, uint16 pubfunct, stack_ptr_t sp, reg_t calling_obj,
|
||||||
uint16 argc, stack_ptr_t argp);
|
uint16 argc, stack_ptr_t argp);
|
||||||
/* Executes function pubfunct of the specified script.
|
/* Executes function pubfunct of the specified script.
|
||||||
** Parameters: (EngineState *) s: The state which is to be executed with
|
** Parameters: (EngineState *) s: The state which is to be executed with
|
||||||
** (uint16) script: The script which is called
|
** (uint16) script: The script which is called
|
||||||
|
@ -480,7 +480,7 @@ exec_stack_t *execute_method(EngineState *s, uint16 script, uint16 pubfunct, sta
|
||||||
|
|
||||||
|
|
||||||
exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj,
|
exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj,
|
||||||
stack_ptr_t sp, int framesize, stack_ptr_t argp);
|
stack_ptr_t sp, int framesize, stack_ptr_t argp);
|
||||||
/* Executes a "send" or related operation to a selector
|
/* Executes a "send" or related operation to a selector
|
||||||
** Parameters: (EngineState *) s: The EngineState to operate on
|
** Parameters: (EngineState *) s: The EngineState to operate on
|
||||||
** (reg_t) send_obj: Heap address of the object to send to
|
** (reg_t) send_obj: Heap address of the object to send to
|
||||||
|
@ -498,8 +498,7 @@ exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj,
|
||||||
#define SCI_XS_CALLEE_LOCALS -1
|
#define SCI_XS_CALLEE_LOCALS -1
|
||||||
|
|
||||||
exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc,
|
exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc,
|
||||||
stack_ptr_t argp, selector_t selector, reg_t sendp, int origin,
|
stack_ptr_t argp, selector_t selector, reg_t sendp, int origin, seg_id_t local_segment);
|
||||||
seg_id_t local_segment);
|
|
||||||
/* Adds an entry to the top of the execution stack
|
/* Adds an entry to the top of the execution stack
|
||||||
** Parameters: (EngineState *) s: The state with which to execute
|
** Parameters: (EngineState *) s: The state with which to execute
|
||||||
** (reg_t) pc: The initial program counter
|
** (reg_t) pc: The initial program counter
|
||||||
|
@ -520,7 +519,7 @@ exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg
|
||||||
|
|
||||||
|
|
||||||
exec_stack_t *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, stack_ptr_t argp,
|
exec_stack_t *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, stack_ptr_t argp,
|
||||||
selector_t selector, reg_t *address, int origin);
|
selector_t selector, reg_t *address, int origin);
|
||||||
/* Adds one varselector access to the execution stack
|
/* Adds one varselector access to the execution stack
|
||||||
** Parameters: (EngineState *) s: The EngineState to use
|
** Parameters: (EngineState *) s: The EngineState to use
|
||||||
** (reg_t) objp: Pointer to the object owning the selector
|
** (reg_t) objp: Pointer to the object owning the selector
|
||||||
|
@ -552,10 +551,8 @@ void vm_handle_fatal_error(EngineState *s, int line, const char *file);
|
||||||
|
|
||||||
|
|
||||||
void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp,
|
void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp,
|
||||||
int *restadjust,
|
int *restadjust, seg_id_t *segids, reg_t **variables, reg_t **variables_base,
|
||||||
seg_id_t *segids, reg_t **variables, reg_t **variables_base,
|
int *variables_nr, int bp);
|
||||||
int *variables_nr,
|
|
||||||
int bp);
|
|
||||||
/* Debugger functionality
|
/* Debugger functionality
|
||||||
** Parameters: (EngineState *) s: The state at which debugging should take place
|
** Parameters: (EngineState *) s: The state at which debugging should take place
|
||||||
** (reg_t *) pc: Pointer to the program counter
|
** (reg_t *) pc: Pointer to the program counter
|
||||||
|
|
|
@ -284,8 +284,7 @@ void vocab_free_branches(parse_tree_branch_t *parser_branches);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
result_word_t *vocab_lookup_word(char *word, int word_len,
|
result_word_t *vocab_lookup_word(char *word, int word_len,
|
||||||
word_t **words, int words_nr,
|
word_t **words, int words_nr, suffix_t **suffices, int suffices_nr);
|
||||||
suffix_t **suffices, int suffices_nr);
|
|
||||||
/* Looks up a single word in the words and suffixes list
|
/* Looks up a single word in the words and suffixes list
|
||||||
** Parameters: (char *) word: Pointer to the word to look up
|
** Parameters: (char *) word: Pointer to the word to look up
|
||||||
** (int) word_len: Length of the word to look up
|
** (int) word_len: Length of the word to look up
|
||||||
|
@ -299,9 +298,7 @@ result_word_t *vocab_lookup_word(char *word, int word_len,
|
||||||
|
|
||||||
|
|
||||||
result_word_t *vocab_tokenize_string(char *sentence, int *result_nr,
|
result_word_t *vocab_tokenize_string(char *sentence, int *result_nr,
|
||||||
word_t **words, int words_nr,
|
word_t **words, int words_nr, suffix_t **suffices, int suffices_nr, char **error);
|
||||||
suffix_t **suffices, int suffices_nr,
|
|
||||||
char **error);
|
|
||||||
/* Tokenizes a string and compiles it into word_ts.
|
/* Tokenizes a string and compiles it into word_ts.
|
||||||
** Parameters: (char *) sentence: The sentence to examine
|
** Parameters: (char *) sentence: The sentence to examine
|
||||||
** (int *) result_nr: The variable to store the resulting number of words in
|
** (int *) result_nr: The variable to store the resulting number of words in
|
||||||
|
@ -338,7 +335,7 @@ void vocab_free_rule_list(parse_rule_list_t *rule_list);
|
||||||
|
|
||||||
|
|
||||||
int vocab_build_parse_tree(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
int vocab_build_parse_tree(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
||||||
parse_tree_branch_t *branch0, parse_rule_list_t *rules);
|
parse_tree_branch_t *branch0, parse_rule_list_t *rules);
|
||||||
/* Builds a parse tree from a list of words
|
/* Builds a parse tree from a list of words
|
||||||
** Parameters: (parse_tree_node_t *) nodes: A node list to store the tree in (must have
|
** Parameters: (parse_tree_node_t *) nodes: A node list to store the tree in (must have
|
||||||
** at least VOCAB_TREE_NODES entries)
|
** at least VOCAB_TREE_NODES entries)
|
||||||
|
@ -396,7 +393,7 @@ void vocab_synonymize_tokens(result_word_t *words, int words_nr, synonym_t *syno
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr,
|
||||||
parse_tree_branch_t *branch0, parse_rule_list_t *tlist, int verbose);
|
parse_tree_branch_t *branch0, parse_rule_list_t *tlist, int verbose);
|
||||||
|
|
||||||
void vocab_gnf_dump(parse_tree_branch_t *branches, int branches_nr);
|
void vocab_gnf_dump(parse_tree_branch_t *branches, int branches_nr);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ int decrypt1(uint8 *dest, uint8 *src, int length, int complength) {
|
||||||
bytectr++;
|
bytectr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token == 0x101)
|
if (token == 0x101)
|
||||||
return 0; // terminator
|
return 0; // terminator
|
||||||
if (token == 0x100) { // reset command
|
if (token == 0x100) { // reset command
|
||||||
maxtoken = 0x200;
|
maxtoken = 0x200;
|
||||||
|
|
|
@ -233,7 +233,7 @@ static void _scir_load_resource(ResourceManager *mgr, resource_t *res, bool prot
|
||||||
|
|
||||||
// Get patch file name
|
// Get patch file name
|
||||||
patch_sprintfers[mgr->sci_version](filename, res);
|
patch_sprintfers[mgr->sci_version](filename, res);
|
||||||
|
|
||||||
// FIXME: Instead of using SearchMan, maybe we should only search
|
// FIXME: Instead of using SearchMan, maybe we should only search
|
||||||
// a single dir specified by this RESSOURCE_TYPE_DIRECTORY ResourceSource?
|
// a single dir specified by this RESSOURCE_TYPE_DIRECTORY ResourceSource?
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -46,46 +46,46 @@ namespace Sci {
|
||||||
#define SCI01V_B3_RESFILE_SHIFT 4
|
#define SCI01V_B3_RESFILE_SHIFT 4
|
||||||
|
|
||||||
#define SCI0_RESID_GET_TYPE(bytes) \
|
#define SCI0_RESID_GET_TYPE(bytes) \
|
||||||
(((bytes)[1] & SCI0_B1_RESTYPE_MASK) >> SCI0_B1_RESTYPE_SHIFT)
|
(((bytes)[1] & SCI0_B1_RESTYPE_MASK) >> SCI0_B1_RESTYPE_SHIFT)
|
||||||
#define SCI0_RESID_GET_NUMBER(bytes) \
|
#define SCI0_RESID_GET_NUMBER(bytes) \
|
||||||
((((bytes)[1] & ~SCI0_B1_RESTYPE_MASK) << 8) | ((bytes)[0]))
|
((((bytes)[1] & ~SCI0_B1_RESTYPE_MASK) << 8) | ((bytes)[0]))
|
||||||
|
|
||||||
#define SCI0_RESFILE_GET_FILE(bytes) \
|
#define SCI0_RESFILE_GET_FILE(bytes) \
|
||||||
(((bytes)[3] & SCI0_B3_RESFILE_MASK) >> SCI0_B3_RESFILE_SHIFT)
|
(((bytes)[3] & SCI0_B3_RESFILE_MASK) >> SCI0_B3_RESFILE_SHIFT)
|
||||||
#define SCI0_RESFILE_GET_OFFSET(bytes) \
|
#define SCI0_RESFILE_GET_OFFSET(bytes) \
|
||||||
((((bytes)[3] & ~SCI0_B3_RESFILE_MASK) << 24) \
|
((((bytes)[3] & ~SCI0_B3_RESFILE_MASK) << 24) \
|
||||||
| (((bytes)[2]) << 16) \
|
| (((bytes)[2]) << 16) \
|
||||||
| (((bytes)[1]) << 8) \
|
| (((bytes)[1]) << 8) \
|
||||||
| (((bytes)[0]) << 0))
|
| (((bytes)[0]) << 0))
|
||||||
|
|
||||||
#define SCI01V_RESFILE_GET_FILE(bytes) \
|
#define SCI01V_RESFILE_GET_FILE(bytes) \
|
||||||
(((bytes)[3] & SCI01V_B3_RESFILE_MASK) >> SCI01V_B3_RESFILE_SHIFT)
|
(((bytes)[3] & SCI01V_B3_RESFILE_MASK) >> SCI01V_B3_RESFILE_SHIFT)
|
||||||
#define SCI01V_RESFILE_GET_OFFSET(bytes) \
|
#define SCI01V_RESFILE_GET_OFFSET(bytes) \
|
||||||
((((bytes)[3] & ~SCI01V_B3_RESFILE_MASK) << 24) \
|
((((bytes)[3] & ~SCI01V_B3_RESFILE_MASK) << 24) \
|
||||||
| (((bytes)[2]) << 16) \
|
| (((bytes)[2]) << 16) \
|
||||||
| (((bytes)[1]) << 8) \
|
| (((bytes)[1]) << 8) \
|
||||||
| (((bytes)[0]) << 0))
|
| (((bytes)[0]) << 0))
|
||||||
|
|
||||||
#define SCI1_B5_RESFILE_MASK 0xf0
|
#define SCI1_B5_RESFILE_MASK 0xf0
|
||||||
#define SCI1_B5_RESFILE_SHIFT 4
|
#define SCI1_B5_RESFILE_SHIFT 4
|
||||||
|
|
||||||
#define SCI1_RESFILE_GET_FILE(bytes) \
|
#define SCI1_RESFILE_GET_FILE(bytes) \
|
||||||
(((bytes)[5] & SCI1_B5_RESFILE_MASK) >> SCI1_B5_RESFILE_SHIFT)
|
(((bytes)[5] & SCI1_B5_RESFILE_MASK) >> SCI1_B5_RESFILE_SHIFT)
|
||||||
|
|
||||||
#define SCI1_RESFILE_GET_OFFSET(bytes) \
|
#define SCI1_RESFILE_GET_OFFSET(bytes) \
|
||||||
((((bytes)[5] & ~SCI1_B5_RESFILE_MASK) << 24) \
|
((((bytes)[5] & ~SCI1_B5_RESFILE_MASK) << 24) \
|
||||||
| (((bytes)[4]) << 16) \
|
| (((bytes)[4]) << 16) \
|
||||||
| (((bytes)[3]) << 8) \
|
| (((bytes)[3]) << 8) \
|
||||||
| (((bytes)[2]) << 0))
|
| (((bytes)[2]) << 0))
|
||||||
|
|
||||||
#define SCI1_RESFILE_GET_NUMBER(bytes) \
|
#define SCI1_RESFILE_GET_NUMBER(bytes) \
|
||||||
((((bytes)[1]) << 8) \
|
((((bytes)[1]) << 8) \
|
||||||
| (((bytes)[0]) << 0))
|
| (((bytes)[0]) << 0))
|
||||||
|
|
||||||
#define SCI11_RESFILE_GET_OFFSET(bytes) \
|
#define SCI11_RESFILE_GET_OFFSET(bytes) \
|
||||||
((((bytes)[4]) << 17) \
|
((((bytes)[4]) << 17) \
|
||||||
| (((bytes)[3]) << 9) \
|
| (((bytes)[3]) << 9) \
|
||||||
| (((bytes)[2]) << 1))
|
| (((bytes)[2]) << 1))
|
||||||
|
|
||||||
static int detect_odd_sci01(Common::File &file) {
|
static int detect_odd_sci01(Common::File &file) {
|
||||||
byte buf[6];
|
byte buf[6];
|
||||||
|
@ -119,7 +119,7 @@ static int detect_odd_sci01(Common::File &file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sci_res_read_entry(ResourceManager *mgr, ResourceSource *map,
|
static int sci_res_read_entry(ResourceManager *mgr, ResourceSource *map,
|
||||||
byte *buf, resource_t *res, int sci_version) {
|
byte *buf, resource_t *res, int sci_version) {
|
||||||
res->id = buf[0] | (buf[1] << 8);
|
res->id = buf[0] | (buf[1] << 8);
|
||||||
res->type = SCI0_RESID_GET_TYPE(buf);
|
res->type = SCI0_RESID_GET_TYPE(buf);
|
||||||
res->number = SCI0_RESID_GET_NUMBER(buf);
|
res->number = SCI0_RESID_GET_NUMBER(buf);
|
||||||
|
@ -372,7 +372,7 @@ static int sci10_or_11(int *types) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
|
int sci1_read_resource_map(ResourceManager *mgr, ResourceSource *map, ResourceSource *vol,
|
||||||
resource_t **resource_p, int *resource_nr_p, int *sci_version) {
|
resource_t **resource_p, int *resource_nr_p, int *sci_version) {
|
||||||
int fsize;
|
int fsize;
|
||||||
Common::File file;
|
Common::File file;
|
||||||
resource_t *resources, *resource_start;
|
resource_t *resources, *resource_start;
|
||||||
|
|
|
@ -41,7 +41,7 @@ void sci1_sprintf_patch_file_name(char *string, resource_t *res) {
|
||||||
|
|
||||||
// version-agnostic patch application
|
// version-agnostic patch application
|
||||||
static void process_patch(ResourceSource *source,
|
static void process_patch(ResourceSource *source,
|
||||||
Common::ArchiveMember &member, int restype, int resnumber, resource_t **resource_p, int *resource_nr_p) {
|
Common::ArchiveMember &member, int restype, int resnumber, resource_t **resource_p, int *resource_nr_p) {
|
||||||
Common::File file;
|
Common::File file;
|
||||||
|
|
||||||
if (restype == sci_invalid_resource)
|
if (restype == sci_invalid_resource)
|
||||||
|
|
|
@ -279,7 +279,7 @@ parse_tree_branch_t *vocab_get_branches(ResourceManager * resmgr, int *branches_
|
||||||
|
|
||||||
|
|
||||||
result_word_t *vocab_lookup_word(char *word, int word_len, word_t **words, int words_nr,
|
result_word_t *vocab_lookup_word(char *word, int word_len, word_t **words, int words_nr,
|
||||||
suffix_t **suffices, int suffices_nr) {
|
suffix_t **suffices, int suffices_nr) {
|
||||||
word_t *tempword = (word_t*)sci_malloc(sizeof(word_t) + word_len + 256);
|
word_t *tempword = (word_t*)sci_malloc(sizeof(word_t) + word_len + 256);
|
||||||
// 256: For suffices. Should suffice.
|
// 256: For suffices. Should suffice.
|
||||||
word_t **dict_word;
|
word_t **dict_word;
|
||||||
|
@ -518,8 +518,8 @@ int vocab_build_simple_parse_tree(parse_tree_node_t *nodes, result_word_t *words
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result_word_t *vocab_tokenize_string(char *sentence, int *result_nr, word_t **words, int words_nr,
|
result_word_t *vocab_tokenize_string(char *sentence, int *result_nr, word_t **words, int words_nr,
|
||||||
suffix_t **suffices, int suffices_nr, char **error) {
|
suffix_t **suffices, int suffices_nr, char **error) {
|
||||||
char *lastword = sentence;
|
char *lastword = sentence;
|
||||||
int pos_in_sentence = 0;
|
int pos_in_sentence = 0;
|
||||||
char c;
|
char c;
|
||||||
|
|
|
@ -731,7 +731,7 @@ void sfx_song_set_status(sfx_state_t *self, song_handle_t handle, int status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfx_song_set_fade(sfx_state_t *self, song_handle_t handle,
|
void sfx_song_set_fade(sfx_state_t *self, song_handle_t handle,
|
||||||
fade_params_t *params) {
|
fade_params_t *params) {
|
||||||
#ifdef DEBUG_SONG_API
|
#ifdef DEBUG_SONG_API
|
||||||
static const char *stopmsg[] = {"??? Should not happen", "Do not stop afterwards", "Stop afterwards"};
|
static const char *stopmsg[] = {"??? Should not happen", "Do not stop afterwards", "Stop afterwards"};
|
||||||
#endif
|
#endif
|
||||||
|
@ -808,7 +808,7 @@ static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
static const song_handle_t midi_send_base = 0xffff0000;
|
static const song_handle_t midi_send_base = 0xffff0000;
|
||||||
|
|
||||||
int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel,
|
||||||
int command, int arg1, int arg2) {
|
int command, int arg1, int arg2) {
|
||||||
byte buffer[5];
|
byte buffer[5];
|
||||||
tell_synth_func *tell = sfx_get_player_tell_func();
|
tell_synth_func *tell = sfx_get_player_tell_func();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ static struct MidiNode *midi_node = NULL;
|
||||||
|
|
||||||
#define ABORT(m) { \
|
#define ABORT(m) { \
|
||||||
if (CamdBase) \
|
if (CamdBase) \
|
||||||
IExec->CloseLibrary(CamdBase); \
|
IExec->CloseLibrary(CamdBase); \
|
||||||
sciprintf("[SFX] CAMD driver: "); \
|
sciprintf("[SFX] CAMD driver: "); \
|
||||||
sciprintf(m); \
|
sciprintf(m); \
|
||||||
sciprintf("\n"); \
|
sciprintf("\n"); \
|
||||||
|
|
|
@ -115,13 +115,11 @@ static inline int _parse_ticks(byte *data, int *offset_p, int size) {
|
||||||
|
|
||||||
|
|
||||||
static int _sci0_read_next_command(sci0_song_iterator_t *self,
|
static int _sci0_read_next_command(sci0_song_iterator_t *self,
|
||||||
unsigned char *buf, int *result);
|
unsigned char *buf, int *result);
|
||||||
|
|
||||||
|
|
||||||
static int _sci0_get_pcm_data(sci0_song_iterator_t *self,
|
static int _sci0_get_pcm_data(sci0_song_iterator_t *self,
|
||||||
sfx_pcm_config_t *format,
|
sfx_pcm_config_t *format, int *xoffset, unsigned int *xsize);
|
||||||
int *xoffset,
|
|
||||||
unsigned int *xsize);
|
|
||||||
|
|
||||||
#define PARSE_FLAG_LOOPS_UNLIMITED (1 << 0) /* Unlimited # of loops? */
|
#define PARSE_FLAG_LOOPS_UNLIMITED (1 << 0) /* Unlimited # of loops? */
|
||||||
#define PARSE_FLAG_PARAMETRIC_CUE (1 << 1) /* Assume that cues take an additional "cue value" argument */
|
#define PARSE_FLAG_PARAMETRIC_CUE (1 << 1) /* Assume that cues take an additional "cue value" argument */
|
||||||
|
@ -144,9 +142,8 @@ void _reset_synth_channels(base_song_iterator_t *self, song_iterator_channel_t *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf, int *result,
|
static int _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *buf,
|
||||||
song_iterator_channel_t *channel,
|
int *result, song_iterator_channel_t *channel, int flags) {
|
||||||
int flags) {
|
|
||||||
unsigned char cmd;
|
unsigned char cmd;
|
||||||
int paramsleft;
|
int paramsleft;
|
||||||
int midi_op;
|
int midi_op;
|
||||||
|
@ -354,8 +351,7 @@ static int _parse_sci_midi_command(base_song_iterator_t *self, unsigned char *bu
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _sci_midi_process_state(base_song_iterator_t *self, unsigned char *buf, int *result,
|
static int _sci_midi_process_state(base_song_iterator_t *self, unsigned char *buf, int *result,
|
||||||
song_iterator_channel_t *channel,
|
song_iterator_channel_t *channel, int flags) {
|
||||||
int flags) {
|
|
||||||
CHECK_FOR_END(0);
|
CHECK_FOR_END(0);
|
||||||
|
|
||||||
switch (channel->state) {
|
switch (channel->state) {
|
||||||
|
@ -449,7 +445,7 @@ static int _sci_midi_process_state(base_song_iterator_t *self, unsigned char *bu
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _sci_midi_process(base_song_iterator_t *self, unsigned char *buf, int *result,
|
static inline int _sci_midi_process(base_song_iterator_t *self, unsigned char *buf, int *result,
|
||||||
song_iterator_channel_t *channel, int flags) {
|
song_iterator_channel_t *channel, int flags) {
|
||||||
return _sci_midi_process_state(self, buf, result,
|
return _sci_midi_process_state(self, buf, result,
|
||||||
channel,
|
channel,
|
||||||
flags);
|
flags);
|
||||||
|
@ -473,9 +469,7 @@ static inline int _sci0_header_magic_p(unsigned char *data, int offset, int size
|
||||||
|
|
||||||
|
|
||||||
static int _sci0_get_pcm_data(sci0_song_iterator_t *self,
|
static int _sci0_get_pcm_data(sci0_song_iterator_t *self,
|
||||||
sfx_pcm_config_t *format,
|
sfx_pcm_config_t *format, int *xoffset, unsigned int *xsize) {
|
||||||
int *xoffset,
|
|
||||||
unsigned int *xsize) {
|
|
||||||
int tries = 2;
|
int tries = 2;
|
||||||
int found_it = 0;
|
int found_it = 0;
|
||||||
unsigned char *pcm_data;
|
unsigned char *pcm_data;
|
||||||
|
@ -634,7 +628,7 @@ static int _sci0_get_timepos(sci0_song_iterator_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _base_init_channel(song_iterator_channel_t *channel, int id, int offset,
|
static void _base_init_channel(song_iterator_channel_t *channel, int id, int offset,
|
||||||
int end) {
|
int end) {
|
||||||
channel->playmask = PLAYMASK_NONE; /* Disable all channels */
|
channel->playmask = PLAYMASK_NONE; /* Disable all channels */
|
||||||
channel->id = id;
|
channel->id = id;
|
||||||
channel->notes_played = 0;
|
channel->notes_played = 0;
|
||||||
|
@ -976,7 +970,7 @@ static sfx_pcm_feed_t *_sci1_get_pcm(sci1_song_iterator_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _sci1_process_next_command(sci1_song_iterator_t *self,
|
static int _sci1_process_next_command(sci1_song_iterator_t *self,
|
||||||
unsigned char *buf, int *result) {
|
unsigned char *buf, int *result) {
|
||||||
int retval = -42; /* Shouldn't happen, but gcc doesn't agree */
|
int retval = -42; /* Shouldn't happen, but gcc doesn't agree */
|
||||||
int chan;
|
int chan;
|
||||||
|
|
||||||
|
@ -1300,7 +1294,7 @@ song_iterator_t *new_cleanup_iterator(unsigned int channels) {
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
static int _ff_read_next_command(fast_forward_song_iterator_t *self,
|
static int _ff_read_next_command(fast_forward_song_iterator_t *self,
|
||||||
byte *buf, int *result) {
|
byte *buf, int *result) {
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (self->delta <= 0)
|
if (self->delta <= 0)
|
||||||
|
@ -1328,7 +1322,7 @@ static sfx_pcm_feed_t *_ff_check_pcm(fast_forward_song_iterator_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static song_iterator_t *_ff_handle_message(fast_forward_song_iterator_t *self,
|
static song_iterator_t *_ff_handle_message(fast_forward_song_iterator_t *self,
|
||||||
song_iterator_message_t msg) {
|
song_iterator_message_t msg) {
|
||||||
if (msg.recipient == _SIMSG_PLASTICWRAP)
|
if (msg.recipient == _SIMSG_PLASTICWRAP)
|
||||||
switch (msg.type) {
|
switch (msg.type) {
|
||||||
|
|
||||||
|
@ -1417,7 +1411,7 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *capsit, int delta) {
|
||||||
|
|
||||||
|
|
||||||
static int _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
|
static int _tee_read_next_command(tee_song_iterator_t *it, unsigned char *buf,
|
||||||
int *result) {
|
int *result) {
|
||||||
static int ready_masks[2] = {TEE_LEFT_READY, TEE_RIGHT_READY};
|
static int ready_masks[2] = {TEE_LEFT_READY, TEE_RIGHT_READY};
|
||||||
static int active_masks[2] = {TEE_LEFT_ACTIVE, TEE_RIGHT_ACTIVE};
|
static int active_masks[2] = {TEE_LEFT_ACTIVE, TEE_RIGHT_ACTIVE};
|
||||||
static int pcm_masks[2] = {TEE_LEFT_PCM, TEE_RIGHT_PCM};
|
static int pcm_masks[2] = {TEE_LEFT_PCM, TEE_RIGHT_PCM};
|
||||||
|
@ -1648,7 +1642,7 @@ static void _tee_free(tee_song_iterator_t *it) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void songit_tee_death_notification(tee_song_iterator_t *self,
|
static void songit_tee_death_notification(tee_song_iterator_t *self,
|
||||||
song_iterator_t *corpse) {
|
song_iterator_t *corpse) {
|
||||||
if (corpse == self->children[TEE_LEFT].it) {
|
if (corpse == self->children[TEE_LEFT].it) {
|
||||||
self->status &= ~TEE_LEFT_ACTIVE;
|
self->status &= ~TEE_LEFT_ACTIVE;
|
||||||
self->children[TEE_LEFT].it = NULL;
|
self->children[TEE_LEFT].it = NULL;
|
||||||
|
@ -1933,8 +1927,7 @@ song_iterator_t *songit_clone(song_iterator_t *it, int delta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void song_iterator_add_death_listener(song_iterator_t *it,
|
void song_iterator_add_death_listener(song_iterator_t *it,
|
||||||
void *client,
|
void *client, void (*notify)(void *self, void *notifier)) {
|
||||||
void (*notify)(void *self, void *notifier)) {
|
|
||||||
if (it->death_listeners_nr >= SONGIT_MAX_LISTENERS) {
|
if (it->death_listeners_nr >= SONGIT_MAX_LISTENERS) {
|
||||||
error("FATAL: Too many death listeners for song iterator");
|
error("FATAL: Too many death listeners for song iterator");
|
||||||
}
|
}
|
||||||
|
@ -1945,8 +1938,7 @@ void song_iterator_add_death_listener(song_iterator_t *it,
|
||||||
it->death_listeners_nr++;
|
it->death_listeners_nr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void song_iterator_remove_death_listener(song_iterator_t *it,
|
void song_iterator_remove_death_listener(song_iterator_t *it, void *client) {
|
||||||
void *client) {
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < it->death_listeners_nr; i++) {
|
for (i = 0; i < it->death_listeners_nr; i++) {
|
||||||
if (it->death_listeners[i].self == client) {
|
if (it->death_listeners[i].self == client) {
|
||||||
|
|
|
@ -434,16 +434,16 @@ static inline int mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames)
|
||||||
if (P->delta_observations > MAX_DELTA_OBSERVATIONS)
|
if (P->delta_observations > MAX_DELTA_OBSERVATIONS)
|
||||||
P->delta_observations = MAX_DELTA_OBSERVATIONS;
|
P->delta_observations = MAX_DELTA_OBSERVATIONS;
|
||||||
|
|
||||||
/* /\* Disabled, broken *\/ */
|
/* /\* Disabled, broken *\/ */
|
||||||
/* if (0 && P->delta_observations > MIN_DELTA_OBSERVATIONS) { /\* Start improving after a while *\/ */
|
/* if (0 && P->delta_observations > MIN_DELTA_OBSERVATIONS) { /\* Start improving after a while *\/ */
|
||||||
/* int diff = self->dev->conf.rate - P->max_delta; */
|
/* int diff = self->dev->conf.rate - P->max_delta; */
|
||||||
|
|
||||||
/* /\* log-approximate P->max_delta over time *\/ */
|
/* /\* log-approximate P->max_delta over time *\/ */
|
||||||
/* recommended_frames = P->max_delta + */
|
/* recommended_frames = P->max_delta + */
|
||||||
/* ((diff * MIN_DELTA_OBSERVATIONS) / P->delta_observations); */
|
/* ((diff * MIN_DELTA_OBSERVATIONS) / P->delta_observations); */
|
||||||
/* /\* WTF? *\/ */
|
/* /\* WTF? *\/ */
|
||||||
/* } else */
|
/* } else */
|
||||||
/* recommended_frames = self->dev->buf_size; /\* Initially, keep the buffer full *\/ */
|
/* recommended_frames = self->dev->buf_size; /\* Initially, keep the buffer full *\/ */
|
||||||
|
|
||||||
#if (DEBUG >= 1)
|
#if (DEBUG >= 1)
|
||||||
sciprintf("[soft-mixer] played since last time: %d, recommended: %d, free: %d\n",
|
sciprintf("[soft-mixer] played since last time: %d, recommended: %d, free: %d\n",
|
||||||
|
|
|
@ -56,7 +56,7 @@ static int pcmout_scummvm_init(sfx_pcm_device_t *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pcmout_scummvm_output(sfx_pcm_device_t *self, byte *buf, int count,
|
static int pcmout_scummvm_output(sfx_pcm_device_t *self, byte *buf, int count,
|
||||||
sfx_timestamp_t *timestamp) {
|
sfx_timestamp_t *timestamp) {
|
||||||
|
|
||||||
byte *__buf = new byte[count * pcmout_scummvm_framesize];
|
byte *__buf = new byte[count * pcmout_scummvm_framesize];
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ adlib_start_note(int chn, int note, int velocity) {
|
||||||
|
|
||||||
static int
|
static int
|
||||||
midi_adlib_open(int data_length, byte *data_ptr, int data2_length,
|
midi_adlib_open(int data_length, byte *data_ptr, int data2_length,
|
||||||
byte *data2_ptr, void *seq) {
|
byte *data2_ptr, void *seq) {
|
||||||
int nrdevs, i, n;
|
int nrdevs, i, n;
|
||||||
struct synth_info info;
|
struct synth_info info;
|
||||||
struct sbi_instrument sbi;
|
struct sbi_instrument sbi;
|
||||||
|
@ -357,7 +357,7 @@ sfx_sequencer_t sfx_sequencer_oss_adlib = {
|
||||||
003, /* patch.003 */
|
003, /* patch.003 */
|
||||||
SFX_SEQ_PATCHFILE_NONE,
|
SFX_SEQ_PATCHFILE_NONE,
|
||||||
0x04, /* playflag */
|
0x04, /* playflag */
|
||||||
0, /* do not play channel 9 */
|
0, /* do not play channel 9 */
|
||||||
ADLIB_VOICES, /* Max polyphony */
|
ADLIB_VOICES, /* Max polyphony */
|
||||||
0 /* Does not require any write-ahead by its own */
|
0 /* Does not require any write-ahead by its own */
|
||||||
};
|
};
|
||||||
|
|
|
@ -109,7 +109,7 @@ struct song_iterator_message_t {
|
||||||
#define INHERITS_SONG_ITERATOR \
|
#define INHERITS_SONG_ITERATOR \
|
||||||
songit_id_t ID; \
|
songit_id_t ID; \
|
||||||
uint16 channel_mask; \
|
uint16 channel_mask; \
|
||||||
fade_params_t fade; \
|
fade_params_t fade; \
|
||||||
unsigned int flags; \
|
unsigned int flags; \
|
||||||
int priority; \
|
int priority; \
|
||||||
int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \
|
int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \
|
||||||
|
@ -117,10 +117,10 @@ struct song_iterator_message_t {
|
||||||
song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \
|
song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \
|
||||||
void (*init) (song_iterator_t *self); \
|
void (*init) (song_iterator_t *self); \
|
||||||
void (*cleanup) (song_iterator_t *self); \
|
void (*cleanup) (song_iterator_t *self); \
|
||||||
int (*get_timepos) (song_iterator_t *self); \
|
int (*get_timepos) (song_iterator_t *self); \
|
||||||
listener_t death_listeners[SONGIT_MAX_LISTENERS]; \
|
listener_t death_listeners[SONGIT_MAX_LISTENERS]; \
|
||||||
int death_listeners_nr \
|
int death_listeners_nr \
|
||||||
|
|
||||||
#define SONGIT_MAX_LISTENERS 2
|
#define SONGIT_MAX_LISTENERS 2
|
||||||
|
|
||||||
struct song_iterator_t {
|
struct song_iterator_t {
|
||||||
|
@ -208,8 +208,7 @@ struct song_iterator_t {
|
||||||
** in the song-player thread. */
|
** in the song-player thread. */
|
||||||
|
|
||||||
void song_iterator_add_death_listener(song_iterator_t *it,
|
void song_iterator_add_death_listener(song_iterator_t *it,
|
||||||
void *client,
|
void *client, void (*notify)(void *self, void *notifier));
|
||||||
void (*notify)(void *self, void *notifier));
|
|
||||||
/* Adds a death listener to a song iterator
|
/* Adds a death listener to a song iterator
|
||||||
** Parameters: (song_iterator_t *) it: The iterator to add to
|
** Parameters: (song_iterator_t *) it: The iterator to add to
|
||||||
** (void *) client: The object wanting to be notified
|
** (void *) client: The object wanting to be notified
|
||||||
|
@ -220,8 +219,7 @@ void song_iterator_add_death_listener(song_iterator_t *it,
|
||||||
** Death listeners are NOT cloned.
|
** Death listeners are NOT cloned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void song_iterator_remove_death_listener(song_iterator_t *it,
|
void song_iterator_remove_death_listener(song_iterator_t *it, void *client);
|
||||||
void *client);
|
|
||||||
/* Removes a death listener from a song iterator
|
/* Removes a death listener from a song iterator
|
||||||
** Parameters: (song_iterator_t *) it: The iterator to modify
|
** Parameters: (song_iterator_t *) it: The iterator to modify
|
||||||
** (void *) client: The object no longer wanting to be notified
|
** (void *) client: The object no longer wanting to be notified
|
||||||
|
@ -298,7 +296,7 @@ void songit_free(song_iterator_t *it);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
song_iterator_message_t songit_make_message(songit_id_t id,
|
song_iterator_message_t songit_make_message(songit_id_t id,
|
||||||
int recipient_class, int type, int a1, int a2);
|
int recipient_class, int type, int a1, int a2);
|
||||||
/* Create a song iterator message
|
/* Create a song iterator message
|
||||||
** Parameters: (songit_id_t) id: song ID the message is targetted to
|
** Parameters: (songit_id_t) id: song ID the message is targetted to
|
||||||
** (int) recipient_class: Message recipient class
|
** (int) recipient_class: Message recipient class
|
||||||
|
@ -308,7 +306,7 @@ song_iterator_message_t songit_make_message(songit_id_t id,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
song_iterator_message_t songit_make_ptr_message(songit_id_t id,
|
song_iterator_message_t songit_make_ptr_message(songit_id_t id,
|
||||||
int recipient_class, int type, void * a1, int a2);
|
int recipient_class, int type, void * a1, int a2);
|
||||||
/* Create a song iterator message, wherein the first parameter is a pointer
|
/* Create a song iterator message, wherein the first parameter is a pointer
|
||||||
** Parameters: (songit_id_t) id: song ID the message is targetted to
|
** Parameters: (songit_id_t) id: song ID the message is targetted to
|
||||||
** (int) recipient_class: Message recipient class
|
** (int) recipient_class: Message recipient class
|
||||||
|
|
|
@ -220,8 +220,7 @@ struct tee_song_iterator_t {
|
||||||
|
|
||||||
|
|
||||||
sfx_pcm_feed_t *sfx_iterator_make_feed(byte *base_data, int offset,
|
sfx_pcm_feed_t *sfx_iterator_make_feed(byte *base_data, int offset,
|
||||||
int size,
|
int size, sfx_pcm_config_t conf);
|
||||||
sfx_pcm_config_t conf);
|
|
||||||
/* Generates a feed for a song iterator
|
/* Generates a feed for a song iterator
|
||||||
** Parameters: (byte *) base_data: A refcounted memory chunk containing
|
** Parameters: (byte *) base_data: A refcounted memory chunk containing
|
||||||
** (among other things) PCM data
|
** (among other things) PCM data
|
||||||
|
|
|
@ -177,7 +177,7 @@ GTimeVal song_next_wakeup_time(GTimeVal *lastslept, long ticks);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void song_lib_set_restore_behavior(songlib_t songlib, song_handle_t handle,
|
void song_lib_set_restore_behavior(songlib_t songlib, song_handle_t handle,
|
||||||
RESTORE_BEHAVIOR action);
|
RESTORE_BEHAVIOR action);
|
||||||
/* Determines what should be done with the song "handle" when
|
/* Determines what should be done with the song "handle" when
|
||||||
** restoring it from a saved game.
|
** restoring it from a saved game.
|
||||||
** Parameters: (songlib_t) songlib: The library that contains the song
|
** Parameters: (songlib_t) songlib: The library that contains the song
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int SN76496_set_option(sfx_softseq_t *self, const char *name, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
|
static int SN76496_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
|
||||||
int patch2_len) {
|
int patch2_len) {
|
||||||
return SFX_OK;
|
return SFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ fluidsynth_poll(sfx_softseq_t *self, byte *dest, int count) {
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fluidsynth_init(sfx_softseq_t *self, byte *data_ptr, int data_length,
|
fluidsynth_init(sfx_softseq_t *self, byte *data_ptr, int data_length,
|
||||||
byte *data2_ptr, int data2_length) {
|
byte *data2_ptr, int data2_length) {
|
||||||
int sfont_id;
|
int sfont_id;
|
||||||
double min, max;
|
double min, max;
|
||||||
|
|
||||||
|
|
|
@ -173,8 +173,8 @@ static inline int opl_write(int a, int v) {
|
||||||
/*
|
/*
|
||||||
static inline uint8 opl_read (int a)
|
static inline uint8 opl_read (int a)
|
||||||
{
|
{
|
||||||
OPLWrite (ym3812_L, 0x388, a);
|
OPLWrite (ym3812_L, 0x388, a);
|
||||||
return OPLRead (ym3812_L, 0x389);
|
return OPLRead (ym3812_L, 0x389);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ static void opl2_poll(sfx_softseq_t *self, byte *dest, int count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr,
|
static int opl2_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr,
|
||||||
int data2_length) {
|
int data2_length) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* load up the patch.003 file, parse out the instruments */
|
/* load up the patch.003 file, parse out the instruments */
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int sps_set_option(sfx_softseq_t *self, const char *name, const char *val
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
|
static int sps_init(sfx_softseq_t *self, byte *patch, int patch_len, byte *patch2,
|
||||||
int patch2_len) {
|
int patch2_len) {
|
||||||
return SFX_OK;
|
return SFX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue