[Scummvm-cvs-logs] SF.net SVN: scummvm:[44718] scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Oct 6 22:49:14 CEST 2009
Revision: 44718
http://scummvm.svn.sourceforge.net/scummvm/?rev=44718&view=rev
Author: thebluegr
Date: 2009-10-06 20:49:14 +0000 (Tue, 06 Oct 2009)
Log Message:
-----------
More work on the view wrapper code
Modified Paths:
--------------
scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp 2009-10-06 19:57:55 UTC (rev 44717)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp 2009-10-06 20:49:14 UTC (rev 44718)
@@ -497,68 +497,56 @@
}
gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
-
- // Wrapper code for the new view decoder - still WIP
-#if 0
-
IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_VIEW];
- gfx_resource_t *res = NULL;
- gfxr_view_t *result = (gfxr_view_t *)malloc(sizeof(gfxr_view_t));
+ gfx_resource_t *res = resMap.contains(nr) ? resMap[nr] : NULL;
+ int hash = palette;
- result->ID = nr;
- result->flags = 0;
+ gfxr_view_t *view = NULL;
+ gfxr_loop_t *loop_data = NULL;
+ gfx_pixmap_t *cel_data = NULL;
- SciGuiView *view = new SciGuiView(_resMan, _screen, _palette, nr);
+ if (!res || res->mode != hash) {
+ // Wrapper code for the new view decoder - still WIP
+#if 0
+ view = (gfxr_view_t *)malloc(sizeof(gfxr_view_t));
- result->loops_nr = view->getLoopCount();
- result->palette = NULL;
- result->loops = (gfxr_loop_t*)malloc(sizeof(gfxr_loop_t) * ((result->loops_nr) ? result->loops_nr : 1)); /* Alloc 1 if no loop */
+ view->ID = nr;
+ view->flags = 0;
- if (*loop >= result->loops_nr)
- *loop = result->loops_nr - 1;
+ SciGuiView *guiView = new SciGuiView(_resMan, _screen, _palette, nr);
- for (int i = 0; i < result->loops_nr; i++) {
- result->loops[i].cels_nr = view->getLoopInfo(i)->celCount;
- result->loops[i].cels = (gfx_pixmap_t**)calloc(result->loops[i].cels_nr, sizeof(gfx_pixmap_t *));
+ view->loops_nr = guiView->getLoopCount();
+ view->palette = _staticPalette->getref(); // TODO: this only works in non-VGA games
+ view->loops = (gfxr_loop_t*)malloc(sizeof(gfxr_loop_t) * ((view->loops_nr) ? view->loops_nr : 1)); /* Alloc 1 if no loop */
- if (*cel >= result->loops[i].cels_nr)
- *cel = result->loops[i].cels_nr - 1;
+ for (int i = 0; i < view->loops_nr; i++) {
+ view->loops[i].cels_nr = guiView->getLoopInfo(i)->celCount;
+ view->loops[i].cels = (gfx_pixmap_t**)calloc(view->loops[i].cels_nr, sizeof(gfx_pixmap_t *));
- for (int j = 0; j < result->loops[i].cels_nr; j++) {
- sciViewCelInfo *celInfo = view->getCelInfo(i, j);
- result->loops[i].cels[j] = gfx_pixmap_alloc_index_data(gfx_new_pixmap(celInfo->width, celInfo->height, nr, i, j));
- gfx_pixmap_t *curCel = result->loops[i].cels[j];
- curCel->alpha_map = 0; // TODO
- curCel->color_key = celInfo->clearKey;
- curCel->index_data = view->getBitmap(i, j);
- curCel->data = curCel->index_data;
- curCel->flags = 0;
- curCel->width = celInfo->width;
- curCel->height = celInfo->height;
- curCel->index_width = celInfo->width;
- curCel->index_height = celInfo->height;
- curCel->palette = 0; // TODO
- curCel->palette_revision = 0;
- curCel->xoffset = celInfo->displaceX;
- curCel->yoffset = celInfo->displaceY;
+ for (int j = 0; j < view->loops[i].cels_nr; j++) {
+ sciViewCelInfo *celInfo = guiView->getCelInfo(i, j);
+ view->loops[i].cels[j] = gfx_pixmap_alloc_index_data(gfx_new_pixmap(celInfo->width, celInfo->height, nr, i, j));
+ gfx_pixmap_t *curCel = view->loops[i].cels[j];
+ curCel->color_key = celInfo->clearKey;
+ curCel->index_data = guiView->getBitmap(i, j);
+ curCel->flags = 0;
+ curCel->width = celInfo->width;
+ curCel->height = celInfo->height;
+ curCel->index_width = celInfo->width;
+ curCel->index_height = celInfo->height;
+ curCel->palette = _staticPalette->getref(); // TODO: this only works in non-VGA games
+ curCel->palette_revision = 0;
+ curCel->xoffset = celInfo->displaceX;
+ curCel->yoffset = celInfo->displaceY;
+ curCel->alpha_map = 0; // will be allocated by gfx_xlate_pixmap()
+ curCel->data = 0; // will be allocated by gfx_xlate_pixmap()
+ }
}
- }
- return result;
-
#else
- // Existing code
- IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_VIEW];
- gfx_resource_t *res = NULL;
- int hash = palette;
- gfxr_view_t *view = NULL;
- gfxr_loop_t *loop_data = NULL;
- gfx_pixmap_t *cel_data = NULL;
+ // Existing code
- res = resMap.contains(nr) ? resMap[nr] : NULL;
-
- if (!res || res->mode != hash) {
Resource *viewRes = _resMan->findResource(ResourceId(kResourceTypeView, nr), 0);
if (!viewRes || !viewRes->data)
return NULL;
@@ -586,6 +574,8 @@
}
}
+#endif
+
if (!res) {
res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t));
res->scaled_data.view = NULL;
@@ -639,8 +629,6 @@
}
return view;
-
-#endif
}
gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list