Untangled the parameters in gfxr_interpreter_get_view() as well. Updated comments

svn-id: r39332
This commit is contained in:
Filippos Karapetis 2009-03-11 17:09:30 +00:00
parent aacb916e5e
commit 3e7fe64a22
3 changed files with 21 additions and 17 deletions

View File

@ -241,7 +241,7 @@ int *gfxr_interpreter_get_resources(ResourceManager *resourceManager, gfx_resour
/* Retreives all resources of a specified type that are available from the interpreter
** Parameters: (gfx_resstate_t *) state: The relevant resource state
** (gfx_respirce_type_t) type: The resource type to query
** (int) version: The interpreter type and version
** (int) version: The interpreter version
** (int *) entries_nr: The variable the number of entries will eventually be stored in
** Returns : (int *) An array of resource numbers
** Unsupported/non-existing resources should return NULL here; this is equivalent to supported
@ -279,23 +279,26 @@ int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic
** Returns : (int) GFX_ERROR if the resource could not be found, GFX_OK otherwise
*/
gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, int palette);
gfxr_view_t *gfxr_interpreter_get_view(ResourceManager* resourceManager, int nr, int palette, Palette* staticPalette, int version);
/* Instructs the interpreter-specific code to calculate a view
** Parameters: (gfx_resstate_t *) state: The resource manager state
** Parameters: (ResourceManager *) resourceManager: The resource manager
** (int) nr: The view resource number
** (int) palette: The palette number to use
** (Palette*) staticPalette: The static palette to use in VGA games
** (int) version: The interpreter version
** Returns : (gfx_view_t *) The appropriate view, or NULL on error
*/
gfx_bitmap_font_t *gfxr_interpreter_get_font(ResourceManager *resourceManager, int nr);
/* Instructs the interpreter-specific code to calculate a font
** Parameters: (gfx_resstate_t *) state: The resource manager state
** Parameters: (ResourceManager *) resourceManager: The resource manager
** (int) nr: The font resource number
** Returns : (gfx_font_t *) The newly calculated font, or NULL on error
*/
gfx_pixmap_t *gfxr_interpreter_get_cursor(ResourceManager *resourceManager, int nr, int version);
/* Instructs the interpreter-specific code to calculate a cursor
** Paramaters: (gfx_resstate_t *) state: The resource manager state
** Parameters: (ResourceManager *) state: The resource manager
** (int nr): The cursor resource number
** (int version): The SCI version used
** Returns : (gfx_pixmap_t *) The cursor pixmap, or NULL on error
@ -303,7 +306,8 @@ gfx_pixmap_t *gfxr_interpreter_get_cursor(ResourceManager *resourceManager, int
Palette *gfxr_interpreter_get_static_palette(ResourceManager *resourceManager, int version, int *colors_nr);
/* Retreives the static palette (palette 999) from the interpreter-specific code
** Parameters: (int) version: Interpreter version to use
** Parameters: (ResourceManager *) state: The resource manager
** (int) version: Interpreter version to use
** (int *) colors_nr: Number of colors to use
** Returns : (gfx_pixmap_color_t *) *colors_nr static color entries
** if a static palette must be used, NULL otherwise
@ -311,7 +315,8 @@ Palette *gfxr_interpreter_get_static_palette(ResourceManager *resourceManager, i
Palette *gfxr_interpreter_get_palette(ResourceManager *resourceManager, int version, int *colors_nr, int nr);
/* Retreives the static palette from the interpreter-specific code
** Parameters: (int) version: Interpreter version to use
** Parameters: (ResourceManager *) state: The resource manager
** (int) version: Interpreter version to use
** (int *) colors_nr: Number of colors to use
** (int) nr: The palette to read
** Returns : (gfx_pixmap_color_t *) *colors_nr static color entries

View File

@ -459,7 +459,7 @@ gfxr_view_t *gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, i
res = (gfx_resource_t *) sbtree_get(tree, nr);
if (!res || res->mode != hash) {
view = gfxr_interpreter_get_view(state, nr, palette);
view = gfxr_interpreter_get_view(state->resManager, nr, palette, state->static_palette, state->version);
if (!view)
return NULL;

View File

@ -142,18 +142,17 @@ void gfxr_palettize_view(gfxr_view_t *view, Palette *source) {
gfxr_view_t *gfxr_draw_view11(int id, byte *resource, int size);
gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, int palette) {
ResourceManager *resmgr = state->resManager;
Resource *res = resmgr->findResource(kResourceTypeView, nr, 0);
gfxr_view_t *gfxr_interpreter_get_view(ResourceManager* resourceManager, int nr, int palette, Palette* staticPalette, int version) {
Resource *res = resourceManager->findResource(kResourceTypeView, nr, 0);
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
gfxr_view_t *result = 0;
if (!res || !res->data)
return NULL;
if (state->version < SCI_VERSION_01) palette = -1;
if (version < SCI_VERSION_01) palette = -1;
switch (state->version) {
switch (version) {
case SCI_VERSION_0:
case SCI_VERSION_01:
result = gfxr_draw_view0(resid, res->data, res->size, palette);
@ -162,7 +161,7 @@ gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, int palett
case SCI_VERSION_01_VGA_ODD:
case SCI_VERSION_1_EARLY:
case SCI_VERSION_1_LATE:
result = gfxr_draw_view1(resid, res->data, res->size, state->static_palette);
result = gfxr_draw_view1(resid, res->data, res->size, staticPalette);
break;
case SCI_VERSION_1_1:
case SCI_VERSION_32:
@ -170,12 +169,12 @@ gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, int palett
break;
}
if (state->version >= SCI_VERSION_01_VGA) {
if (version >= SCI_VERSION_01_VGA) {
if (!result->palette) {
result->palette = new Palette(state->static_palette->size());
result->palette = new Palette(staticPalette->size());
result->palette->name = "interpreter_get_view";
}
gfxr_palettize_view(result, state->static_palette);
gfxr_palettize_view(result, staticPalette);
}
return result;
}