priority_first and priority_last are not used by the new drawing code, thus the new code didn't handle priority changes by kGraph()

svn-id: r45658
This commit is contained in:
Filippos Karapetis 2009-11-04 11:52:11 +00:00
parent f5d1ca32f2
commit f755311114
12 changed files with 46 additions and 30 deletions

View File

@ -1319,6 +1319,7 @@ bool Console::cmdDroppedViews(int argc, const char **argv) {
}
bool Console::cmdPriorityBands(int argc, const char **argv) {
#ifdef INCLUDE_OLDGFX
if (argc != 2) {
DebugPrintf("Priority bands start at y=%d. They end at y=%d\n", _vm->_gamestate->priority_first, _vm->_gamestate->priority_last);
DebugPrintf("Use %s <priority band> to print the start of priority for the specified priority band (0 - 15)\n", argv[0]);
@ -1326,7 +1327,7 @@ bool Console::cmdPriorityBands(int argc, const char **argv) {
}
int zone = CLIP<int>(atoi(argv[1]), 0, 15);
#ifdef INCLUDE_OLDGFX
DebugPrintf("Zone %x starts at y=%d\n", zone, _find_priority_band(_vm->_gamestate, zone));
#endif

View File

@ -162,8 +162,8 @@ const char *convertSierraGameId(const char *gameName, uint32 *gameFlags) {
return strdup(sierraId.c_str());
}
int _reset_graphics_input(EngineState *s) {
#ifdef INCLUDE_OLDGFX
int _reset_graphics_input(EngineState *s) {
Resource *resource;
int font_nr;
gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
@ -261,8 +261,6 @@ int _reset_graphics_input(EngineState *s) {
#if 0
s->titlebar_port->_bgcolor.mask |= GFX_MASK_PRIORITY;
s->titlebar_port->_bgcolor.priority = 11; // Standard priority for the titlebar port
#endif
#endif
s->priority_first = 42; // Priority zone 0 ends here
@ -279,6 +277,8 @@ int game_init_graphics(EngineState *s) {
return _reset_graphics_input(s);
}
#endif
static void _free_graphics_input(EngineState *s) {
debug(2, "Freeing graphics");
@ -406,9 +406,6 @@ int game_init(EngineState *s) {
#ifdef INCLUDE_OLDGFX
if (s->gfx_state && _reset_graphics_input(s))
return 1;
#else
if (_reset_graphics_input(s))
return 1;
#endif
s->successor = NULL; // No successor

View File

@ -221,19 +221,6 @@ int _find_priority_band(EngineState *s, int band);
*/
int _find_view_priority(EngineState *s, int y);
#define SCI0_VIEW_PRIORITY_14_ZONES(y) (((y) < s->priority_first)? 0 : (((y) >= s->priority_last)? 14 : 1\
+ ((((y) - s->priority_first) * 14) / (s->priority_last - s->priority_first))))
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
((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\
+ ((((y) - s->priority_first) * 15) / (s->priority_last - s->priority_first))))
#define SCI0_PRIORITY_BAND_FIRST(nr) ((((nr) == 0)? 0 : \
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 15)))
/******************** Dynamic view list functions ********************/

View File

@ -268,8 +268,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
case K_GRAPH_ADJUST_PRIORITY:
debugC(2, kDebugLevelGraphics, "adjust_priority(%d, %d)\n", argv[1].toSint16(), argv[2].toSint16());
s->priority_first = argv[1].toSint16() - 10;
s->priority_last = argv[2].toSint16() - 10;
s->_gui->modifyPriorityBands(argv[1].toSint16() - 10, argv[2].toSint16() - 10);
break;
case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:

View File

@ -658,8 +658,9 @@ void SegManager::reconstructScripts(EngineState *s) {
}
}
}
#ifdef INCLUDE_OLDGFX
int _reset_graphics_input(EngineState *s);
#endif
static void reconstruct_sounds(EngineState *s) {
Song *seeker;
@ -770,7 +771,9 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->gc_countdown = GC_INTERVAL - 1;
retval->sys_strings_segment = retval->_segMan->findSegmentByType(SEG_TYPE_SYS_STRINGS);
retval->sys_strings = (SystemStrings *)GET_SEGMENT(*retval->_segMan, retval->sys_strings_segment, SEG_TYPE_SYS_STRINGS);
#ifdef INCLUDE_OLDGFX
_reset_graphics_input(retval);
#endif
// Time state:
retval->last_wait_time = g_system->getMillis();

View File

@ -61,12 +61,12 @@ EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc,
dyn_views = 0;
drop_views = 0;
#endif
_menubar = 0;
priority_first = 0;
priority_last = 0;
#endif
_menubar = 0;
last_wait_time = 0;

View File

@ -169,12 +169,12 @@ public:
GfxList *dyn_views; /**< Pointers to pic and dynamic view lists */
GfxList *drop_views; /**< A list Animate() can dump dropped dynviews into */
#endif
Menubar *_menubar; /**< The menu bar */
int priority_first; /**< The line where priority zone 0 ends */
int priority_last; /**< The line where the highest priority zone starts */
#endif
Menubar *_menubar; /**< The menu bar */
uint32 game_start_time; /**< The time at which the interpreter was started */
uint32 last_wait_time; /**< The last time the game invoked Wait() */

View File

@ -101,6 +101,14 @@ void SciGui::initPriorityBands() {
}
}
void SciGui::modifyPriorityBands(int top, int bottom) {
if (_usesOldGfxFunctions) {
_gfx->PriorityBandsInit(15, top, bottom);
} else {
_gfx->PriorityBandsInit(14, top, bottom);
}
}
void SciGui::wait(int16 ticks) {
uint32 time;

View File

@ -143,6 +143,8 @@ public:
virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
virtual void portraitUnload(uint16 portraitId);
virtual void modifyPriorityBands(int top, int bottom);
virtual bool debugUndither(bool flag);
virtual bool debugShowMap(int mapNo);

View File

@ -75,6 +75,18 @@ namespace Sci {
_s->visual->draw(gfxw_point_zero); \
gfxop_update(_s->gfx_state);
#define SCI0_VIEW_PRIORITY_14_ZONES(y) (((y) < s->priority_first)? 0 : (((y) >= s->priority_last)? 14 : 1\
+ ((((y) - s->priority_first) * 14) / (s->priority_last - s->priority_first))))
#define SCI0_PRIORITY_BAND_FIRST_14_ZONES(nr) ((((nr) == 0)? 0 : \
((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\
+ ((((y) - s->priority_first) * 15) / (s->priority_last - s->priority_first))))
#define SCI0_PRIORITY_BAND_FIRST(nr) ((((nr) == 0)? 0 : \
((s->priority_first) + (((nr)-1) * (s->priority_last - s->priority_first)) / 15)))
#if 0
// Used for debugging
#define FULL_INSPECTION()\
@ -2996,6 +3008,11 @@ void SciGui32::moveCursor(Common::Point pos) {
gfxop_get_event(_s->gfx_state, SCI_EVT_PEEK);
}
void SciGui32::modifyPriorityBands(int top, int bottom) {
_s->priority_first = top;
_s->priority_last = bottom;
}
bool SciGui32::debugUndither(bool flag) {
return true;
}

View File

@ -109,6 +109,8 @@ public:
void setCursorPos(Common::Point pos);
void moveCursor(Common::Point pos);
void modifyPriorityBands(int top, int bottom);
bool debugUndither(bool flag);
bool debugShowMap(int mapNo);

View File

@ -168,12 +168,12 @@ Common::Error SciEngine::run() {
#ifdef INCLUDE_OLDGFX
gfxop_init(&gfx_state, _resMan, screen, palette, 1);
#endif
if (game_init_graphics(_gamestate)) { // Init interpreter graphics
warning("Game initialization failed: Error in GFX subsystem. Aborting...");
return Common::kUnknownError;
}
#endif
if (game_init_sound(_gamestate, 0)) {
warning("Game initialization failed: Error in sound subsystem. Aborting...");