Example #1
0
void Sprite::removeFrame(const uint32 frameNum) {
	_frameArray[frameNum].frame->_referenceCount--;
	if (_frameArray[frameNum].frame->_referenceCount == 0)
		delete _frameArray[frameNum].frame;

	// Calculate the new bounds
	Common::Rect frameBounds;
	for (uint32 i = 0; i < _numFrames; i++) {
		if (i == frameNum)
			continue;

		Common::Rect r;
		_frameArray[i].frame->getSurfaceBounds(r);
		r.translate(_frameArray[i].frameLeft, _frameArray[i].frameTop);
		frameBounds.extend(r);
	}

	_frameArray.remove_at(frameNum);

	frameBounds.moveTo(_bounds.left, _bounds.top);
	setBounds(frameBounds);

	if (_currentFrameNum == frameNum)
		triggerRedraw();
	else if (_currentFrameNum != 0xffffffff && _currentFrameNum > frameNum)
		--_currentFrameNum;
}
Example #2
0
void NoradElevator::openInteraction() {
	SpriteFrame *frame = new SpriteFrame();
	frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorLabelID, true);
	_elevatorControls.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorButtonsID, true);
	_elevatorControls.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorDownOnID, true);
	_elevatorControls.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kElevatorUpOnID, true);
	_elevatorControls.addFrame(frame, 0, 0);

	_elevatorControls.setCurrentFrameIndex(0);
	_elevatorControls.setDisplayOrder(kElevatorControlsOrder);

	Common::Rect r;
	frame->getSurfaceBounds(r);
	r.moveTo(kNoradAlphaElevatorControlsLeft, kNoradAlphaElevatorControlsTop);

	_elevatorControls.setBounds(r);
	_elevatorControls.startDisplaying();
	_elevatorControls.show();
}
Example #3
0
Common::Rect PaintControl::paint(const Common::Point &point) {
    Common::Rect paintRect = Common::Rect(_brush->w, _brush->h);
    paintRect.moveTo(point);
    paintRect.clip(_rectangle);

    if (!paintRect.isEmpty()) {
        Common::Rect brushRect = paintRect;
        brushRect.translate(-point.x, -point.y);

        Common::Rect bkgRect = paintRect;
        bkgRect.translate(-_rectangle.left, -_rectangle.top);

        for (int yy = 0; yy < brushRect.height(); yy++) {
            uint16 *mask = (uint16 *)_brush->getBasePtr(brushRect.left, brushRect.top + yy);
            uint16 *from = (uint16 *)_paint->getBasePtr(bkgRect.left, bkgRect.top + yy);
            uint16 *to   = (uint16 *)_bkg->getBasePtr(bkgRect.left, bkgRect.top + yy);
            for (int xx = 0; xx < brushRect.width(); xx++) {
                if (*mask != 0)
                    *(to + xx) = *(from + xx);

                mask++;
            }
        }

    }
    return paintRect;
}
Example #4
0
bool ASurface::clip(Common::Rect &r) {
	int skip;
	_leftSkip = _rightSkip = 0;
	_topSkip = _bottomSkip = 0;

	if (r.left > _clipWidth || r.left < 0) {
		if (r.left >= 0)
			return true;

		skip = -r.left;
		r.setWidth(r.width() - skip);
		_leftSkip = skip;
		r.moveTo(0, r.top);
	}

	int right = r.right - 1;
	if (right < 0)
		return true;
	else if (right > _clipWidth) {
		skip = right - _clipWidth;
		r.setWidth(r.width() - skip);
		_rightSkip = skip;
	}

	if (r.top > _clipHeight || r.top < 0) {
		if (r.top >= 0)
			return true;

		skip = -r.top;
		r.setHeight(r.height() - skip);
		_topSkip = skip;
		r.moveTo(r.left, 0);
	}

	int bottom = r.bottom - 1;
	if (bottom < 0)
		return true;
	else if (bottom > _clipHeight) {
		skip = bottom - _clipHeight;
		_bottomSkip = skip;
		r.setHeight(r.height() - skip);
	}

	return false;
}
Example #5
0
void InventoryRenderer::getItemRect(ItemPosition pos, Common::Rect &r) {

    r.setHeight(_props->_itemHeight);
    r.setWidth(_props->_itemWidth);

    uint16 line = pos / _props->_itemsPerLine;
    uint16 col = pos % _props->_itemsPerLine;

    r.moveTo(col * _props->_itemWidth, line * _props->_itemHeight);

}
Example #6
0
void PanoramaScroll::timeChanged(const TimeValue newTime) {
	CoordType leftPixel = (_totalWidth - _boundsWidth) * newTime / getDuration();

	Common::Rect r;
	_panorama.getViewBounds(r);
	if (leftPixel != r.left) {
		_panorama.getViewBounds(r);
		r.moveTo(leftPixel, 0);
		_panorama.setViewBounds(r);
		triggerRedraw();
	}
}
Example #7
0
void Movie::draw(const Common::Rect &r) {
	Common::Rect worldBounds = _movieBox;
	Common::Rect elementBounds;
	getBounds(elementBounds);

	worldBounds.moveTo(elementBounds.left, elementBounds.top);
	Common::Rect r1 = r.findIntersectingRect(worldBounds);

	Common::Rect r2 = r1;
	r2.translate(_movieBox.left - elementBounds.left, _movieBox.top - elementBounds.top);
	drawImage(r2, r1);
}
Example #8
0
void Picture::draw(const Common::Rect &r) {
	Common::Rect surfaceBounds;
	getSurfaceBounds(surfaceBounds);
	Common::Rect r1 = r;

	Common::Rect bounds;
	getBounds(bounds);
	surfaceBounds.moveTo(bounds.left, bounds.top);
	r1 = r1.findIntersectingRect(surfaceBounds);
	getSurfaceBounds(surfaceBounds);

	Common::Rect r2 = r1;
	r2.translate(surfaceBounds.left - bounds.left, surfaceBounds.top - bounds.top);
	drawImage(r2, r1);
}
Example #9
0
void Events::setCursor(CursorId cursorId, const Common::Point &cursorPos, const Graphics::Surface &surface) {
	_cursorId = cursorId;

	// Get the standard cursor frame
	Graphics::Surface &cursorImg = (*_cursorImages)[cursorId]._frame;

	// If the X pos for the cursor image is -100, this is a special value to indicate
	// the cursor should be horizontally centered
	Common::Point cursorPt = cursorPos;
	if (cursorPos.x == -100)
		cursorPt.x = (surface.w - cursorImg.w) / 2;

	// Figure total bounds needed for cursor image and passed image
	Common::Rect bounds(surface.w, surface.h);
	bounds.extend(Common::Rect(cursorPt.x, cursorPt.y, cursorPt.x + cursorImg.w, cursorPt.y + cursorImg.h));
	Common::Rect r = bounds;
	r.moveTo(0, 0);

	// Form a single surface containing both frames
	Surface s(r.width(), r.height());
	s.fill(TRANSPARENCY);

	// Draw the passed image
	Common::Point drawPos;
	if (cursorPt.x < 0)
		drawPos.x = -cursorPt.x;
	if (cursorPt.y < 0)
		drawPos.y = -cursorPt.y;
	s.blitFrom(surface, Common::Point(drawPos.x, drawPos.y));

	// Draw the cursor image
	drawPos = Common::Point(MAX(cursorPt.x, (int16)0), MAX(cursorPt.y, (int16)0));
	s.transBlitFrom(cursorImg, Common::Point(drawPos.x, drawPos.y));

	// Set up hotspot position for cursor, adjusting for cursor image's position within the surface
	Common::Point hotspot;
	if (cursorId == MAGNIFY)
		hotspot = Common::Point(8, 8);
	hotspot += drawPos;
	// Set the cursor
	setCursor(s.getRawSurface(), hotspot.x, hotspot.y);
}
Example #10
0
uint32 Sprite::addFrame(SpriteFrame *frame, const CoordType left, const CoordType top) {
	SpriteFrameRec frameRecord;
	frameRecord.frame = frame;
	frameRecord.frameLeft = left;
	frameRecord.frameTop = top;
	_frameArray.push_back(frameRecord);
	_numFrames++;
	frame->_referenceCount++;

	Common::Rect frameBounds;
	frame->getSurfaceBounds(frameBounds);

	// 9/3/96
	// BB Should this be + left or - left?
	frameBounds.moveTo(_bounds.left + left, _bounds.top + top);

	frameBounds.extend(_bounds);

	if (_bounds != frameBounds)
		setBounds(frameBounds);

	return _numFrames - 1;
}
Example #11
0
bool AgiEngine::handleMouseClicks(uint16 &key) {
	// No mouse click? -> exit
	if (key != AGI_MOUSE_BUTTON_LEFT)
		return false;

	if (!cycleInnerLoopIsActive()) {
		// Only do this, when no inner loop is currently active
		Common::Rect displayLineRect = _gfx->getFontRectForDisplayScreen(0, 0, FONT_COLUMN_CHARACTERS, 1);
//		Common::Rect displayLineRect(_gfx->getDisplayScreenWidth(), _gfx->getDisplayFontHeight());

		if (displayLineRect.contains(_mouse.pos)) {
			// Mouse is inside first line of the screen
			if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) {
				_menu->delayedExecuteViaMouse();
				key = 0; // eat event
				return true;
			}
		}

		if (_text->promptIsEnabled()) {
			// Prompt is currently enabled
			int16 promptRow = _text->promptRow_Get();

			displayLineRect.moveTo(0, promptRow * _gfx->getDisplayFontHeight());

			if (displayLineRect.contains(_mouse.pos)) {
				// and user clicked within the line of the prompt
				showPredictiveDialog();

				key = 0; // eat event
				return true;
			}
		}
	}

	if (cycleInnerLoopIsActive()) {
		// inner loop active, check what kind of loop it is. Then process / forward it
		switch (_game.cycleInnerLoopType) {
		case CYCLE_INNERLOOP_GETSTRING:
		case CYCLE_INNERLOOP_GETNUMBER: {
			// process in here
			int16 stringRow, stringColumn, stringMaxLen;

			_text->stringPos_Get(stringRow, stringColumn);
			stringMaxLen = _text->stringGetMaxLen();

			Common::Rect displayRect = _gfx->getFontRectForDisplayScreen(stringColumn, stringRow, stringMaxLen, 1);
			if (displayRect.contains(_mouse.pos)) {
				// user clicked inside the input space
				showPredictiveDialog();

				key = 0; // eat event
				return true;
			}
			break;
		}
		case CYCLE_INNERLOOP_INVENTORY:
			// TODO: forward
			break;

		case CYCLE_INNERLOOP_MENU_VIA_KEYBOARD:
			_menu->mouseEvent(key);
			key = 0; // eat event
			break;

		case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT:
			// TODO: forward
			break;

		default:
			break;
		}
	}
	return false;
}
Example #12
0
void Portrait::bitsShow() {
	Common::Rect bitmapRect = Common::Rect(_width, _height);
	bitmapRect.moveTo(_position.x, _position.y);
	_screen->copyDisplayRectToScreen(bitmapRect);
	g_system->updateScreen();
}
Example #13
0
reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
	reg_t displayArg;
	TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT;
	int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1;
	bool doSaveUnder = false;
	Common::Rect rect;
	reg_t result = NULL_REG;

	// Make a "backup" of the port settings (required for some SCI0LATE and
	// SCI01+ only)
	Port oldPort = *_ports->getPort();

	// setting defaults
	_ports->penMode(0);
	_ports->penColor(0);
	_ports->textGreyedOutput(false);
	// processing codes in argv
	while (argc > 0) {
		displayArg = argv[0];
		if (displayArg.segment)
			displayArg.offset = 0xFFFF;
		argc--; argv++;
		switch (displayArg.offset) {
		case SCI_DISPLAY_MOVEPEN:
			_ports->moveTo(argv[0].toUint16(), argv[1].toUint16());
			argc -= 2; argv += 2;
			break;
		case SCI_DISPLAY_SETALIGNMENT:
			alignment = argv[0].toSint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETPENCOLOR:
			colorPen = argv[0].toUint16();
			_ports->penColor(colorPen);
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETBACKGROUNDCOLOR:
			colorBack = argv[0].toUint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETGREYEDOUTPUT:
			_ports->textGreyedOutput(argv[0].isNull() ? false : true);
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETFONT:
			_text16->SetFont(argv[0].toUint16());
			argc--; argv++;
			break;
		case SCI_DISPLAY_WIDTH:
			width = argv[0].toUint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SAVEUNDER:
			doSaveUnder = true;
			break;
		case SCI_DISPLAY_RESTOREUNDER:
			bitsGetRect(argv[0], &rect);
			rect.translate(-_ports->getPort()->left, -_ports->getPort()->top);
			if (g_sci->getGameId() == GID_PQ3 && g_sci->getEngineState()->currentRoomNumber() == 29) {
				// WORKAROUND: PQ3 calls this without calling the associated
				// kDisplay(SCI_DISPLAY_SAVEUNDER) call before. Theoretically,
				// this would result in no rect getting restored. However, we
				// still maintain a pointer from the previous room, resulting
				// in invalidated content being restored on screen, and causing
				// graphics glitches. Thus, we simply don't restore a rect in
				// that room. The correct fix for this would be to erase hunk
				// pointers when changing rooms, but this will suffice for now,
				// as restoring from a totally invalid pointer is very rare.
				// Fixes bug #3037945.
			} else {
				bitsRestore(argv[0]);
			}
			kernelGraphRedrawBox(rect);
			// finishing loop
			argc = 0;
			break;
		case SCI_DISPLAY_DONTSHOWBITS:
			bRedraw = 0;
			break;

		// 2 Dummy functions, longbow-demo is using those several times but sierra sci doesn't support them at all
		// The Quest for Glory 1 EGA demo also calls kDisplay(114)
		case SCI_DISPLAY_DUMMY1:
		case SCI_DISPLAY_DUMMY2:
			if (!g_sci->isDemo() || (g_sci->getGameId() != GID_LONGBOW && g_sci->getGameId() != GID_QFG1))
				error("Unknown kDisplay argument %d", displayArg.offset);
			if (displayArg.offset == SCI_DISPLAY_DUMMY2) {
				if (argc) {
					argc--; argv++;
				} else {
					error("No parameter left for kDisplay(115)");
				}
			}
			break;
		default:
			SciTrackOriginReply originReply;
			SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
			if (solution.type == WORKAROUND_NONE)
				error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)", PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset);
			assert(solution.type == WORKAROUND_IGNORE);
			break;
		}
	}

	// now drawing the text
	_text16->Size(rect, text, -1, width);
	rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
	if (getSciVersion() >= SCI_VERSION_1_LATE) {
		int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right;
		int16 topPos = rect.bottom <= _screen->getHeight() ? 0 : _screen->getHeight() - rect.bottom;
		_ports->move(leftPos, topPos);
		rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
	}

	if (doSaveUnder)
		result = bitsSave(rect, GFX_SCREEN_MASK_VISUAL);
	if (colorBack != -1)
		fillRect(rect, GFX_SCREEN_MASK_VISUAL, colorBack, 0, 0);
	_text16->Box(text, false, rect, alignment, -1);
	if (_screen->_picNotValid == 0 && bRedraw)
		bitsShow(rect);
	// restoring port and cursor pos
	Port *currport = _ports->getPort();
	uint16 tTop = currport->curTop;
	uint16 tLeft = currport->curLeft;
	if (!g_sci->_features->usesOldGfxFunctions()) {
		// Restore port settings for some SCI0LATE and SCI01+ only.
		//
		// The change actually happened inbetween .530 (hoyle1) and .566 (heros
		// quest). We don't have any detection for that currently, so we are
		// using oldGfxFunctions (.502). The only games that could get
		// regressions because of this are hoyle1, kq4 and funseeker. If there
		// are regressions, we should use interpreter version (which would
		// require exe version detection).
		//
		// If we restore the port for whole SCI0LATE, at least sq3old will get
		// an issue - font 0 will get used when scanning for planets instead of
		// font 600 - a setfont parameter is missing in one of the kDisplay
		// calls in script 19. I assume this is a script bug, because it was
		// added in sq3new.
		*currport = oldPort;
	}
	currport->curTop = tTop;
	currport->curLeft = tLeft;
	return result;
}
Example #14
0
void DisplayElement::centerElementAt(const CoordType h, const CoordType v) {
	Common::Rect newBounds = _bounds;
	newBounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2));
	setBounds(newBounds);
}
Example #15
0
void InventoryRenderer::getRect(Common::Rect& r) const {
    r.setWidth(_props->_width);
    r.setHeight(_props->_itemHeight * getNumLines());
    r.moveTo(_pos);
}
Example #16
0
reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
	reg_t displayArg;
	TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT;
	int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1;
	bool doSaveUnder = false;
	Common::Rect rect;
	reg_t result = NULL_REG;

	// Make a "backup" of the port settings (required for some SCI0LATE and
	// SCI01+ only)
	Port oldPort = *_ports->getPort();

	// setting defaults
	_ports->penMode(0);
	_ports->penColor(0);
	_ports->textGreyedOutput(false);
	// processing codes in argv
	while (argc > 0) {
		displayArg = argv[0];
		if (displayArg.getSegment())
			displayArg.setOffset(0xFFFF);
		argc--; argv++;
		switch (displayArg.getOffset()) {
		case SCI_DISPLAY_MOVEPEN:
			_ports->moveTo(argv[0].toUint16(), argv[1].toUint16());
			argc -= 2; argv += 2;
			break;
		case SCI_DISPLAY_SETALIGNMENT:
			alignment = argv[0].toSint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETPENCOLOR:
			colorPen = argv[0].toUint16();
			_ports->penColor(colorPen);
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETBACKGROUNDCOLOR:
			colorBack = argv[0].toUint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETGREYEDOUTPUT:
			_ports->textGreyedOutput(!argv[0].isNull());
			argc--; argv++;
			break;
		case SCI_DISPLAY_SETFONT:
			_text16->SetFont(argv[0].toUint16());
			argc--; argv++;
			break;
		case SCI_DISPLAY_WIDTH:
			width = argv[0].toUint16();
			argc--; argv++;
			break;
		case SCI_DISPLAY_SAVEUNDER:
			doSaveUnder = true;
			break;
		case SCI_DISPLAY_RESTOREUNDER:
			bitsGetRect(argv[0], &rect);
			rect.translate(-_ports->getPort()->left, -_ports->getPort()->top);
			bitsRestore(argv[0]);
			kernelGraphRedrawBox(rect);
			// finishing loop
			argc = 0;
			break;
		case SCI_DISPLAY_DONTSHOWBITS:
			bRedraw = 0;
			break;

		// The following three dummy calls are not supported by the Sierra SCI
		// interpreter, but are erroneously called in some game scripts.
		case SCI_DISPLAY_DUMMY1:	// Longbow demo (all rooms) and QFG1 EGA demo (room 11)
		case SCI_DISPLAY_DUMMY2:	// Longbow demo (all rooms)
		case SCI_DISPLAY_DUMMY3:	// QFG1 EGA demo (room 11) and PQ2 (room 23)
			if (!(g_sci->getGameId() == GID_LONGBOW && g_sci->isDemo()) &&
				!(g_sci->getGameId() == GID_QFG1    && g_sci->isDemo()) &&
				!(g_sci->getGameId() == GID_PQ2))
				error("Unknown kDisplay argument %d", displayArg.getOffset());

			if (displayArg.getOffset() == SCI_DISPLAY_DUMMY2) {
				if (!argc)
					error("No parameter left for kDisplay(115)");
				argc--; argv++;
			}
			break;
		default:
			SciTrackOriginReply originReply;
			SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
			if (solution.type == WORKAROUND_NONE)
				error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
						PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
						originReply.scriptNr, originReply.localCallOffset);
			assert(solution.type == WORKAROUND_IGNORE);
			break;
		}
	}

//20140521 Text Exchange
	std::map<std::string, std::string>::iterator iter;
	if(g_sci->_ScriptData)
	{		
		_ShouterInfo* pInfo = g_sci->_ScriptData->GetShouterInfo();
		iter = pInfo->SentenceList.find(text);
		if(iter == pInfo->SentenceList.end())
			_text16->Size(rect, text, -1, width);
		else
			_text16->Size(rect, iter->second.c_str(), -1, width);
	}
	else
	{
		// now drawing the text
		_text16->Size(rect, text, -1, width);
	}
//End


	rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
	// Note: This code has been found in SCI1 middle and newer games. It was
	// previously only for SCI1 late and newer, but the LSL1 interpreter contains
	// this code.
	if (getSciVersion() >= SCI_VERSION_1_MIDDLE) {
		int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right;
		int16 topPos = rect.bottom <= _screen->getHeight() ? 0 : _screen->getHeight() - rect.bottom;
		_ports->move(leftPos, topPos);
		rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
	}

	if (doSaveUnder)
		result = bitsSave(rect, GFX_SCREEN_MASK_VISUAL);
	if (colorBack != -1)
		fillRect(rect, GFX_SCREEN_MASK_VISUAL, colorBack, 0, 0);

//20140521	
	if(g_sci->_ScriptData)
	{		
		if(iter == g_sci->_ScriptData->GetShouterInfo()->SentenceList.end())
			_text16->Box(text, false, rect, alignment, -1, false);
		else
			_text16->Box(iter->second.c_str(), false, rect, alignment, -1);
	}
	else
	{
		_text16->Box(text, false, rect, alignment, -1);
	}
//End

	if (_screen->_picNotValid == 0 && bRedraw)
		bitsShow(rect);
	// restoring port and cursor pos
	Port *currport = _ports->getPort();
	uint16 tTop = currport->curTop;
	uint16 tLeft = currport->curLeft;
	if (!g_sci->_features->usesOldGfxFunctions()) {
		// Restore port settings for some SCI0LATE and SCI01+ only.
		//
		// The change actually happened inbetween .530 (hoyle1) and .566 (heros
		// quest). We don't have any detection for that currently, so we are
		// using oldGfxFunctions (.502). The only games that could get
		// regressions because of this are hoyle1, kq4 and funseeker. If there
		// are regressions, we should use interpreter version (which would
		// require exe version detection).
		//
		// If we restore the port for whole SCI0LATE, at least sq3old will get
		// an issue - font 0 will get used when scanning for planets instead of
		// font 600 - a setfont parameter is missing in one of the kDisplay
		// calls in script 19. I assume this is a script bug, because it was
		// added in sq3new.
		*currport = oldPort;
	}
	currport->curTop = tTop;
	currport->curLeft = tLeft;
	return result;
}
Example #17
0
void PressureDoor::openInteraction() {
	if (_isUpperDoor) {
		_levelsMovie.initFromMovieFile("Images/Norad Alpha/Upper Levels Movie");
		_levelsMovie.moveElementTo(kNoradUpperLevelsLeft, kNoradUpperLevelsTop);
	} else {
		_levelsMovie.initFromMovieFile("Images/Norad Alpha/Lower Levels Movie");
		_levelsMovie.moveElementTo(kNoradLowerLevelsLeft, kNoradLowerLevelsTop);
	}

	_levelsScale = _levelsMovie.getScale();
	_levelsMovie.setDisplayOrder(kPressureLevelsOrder);
	_levelsMovie.startDisplaying();
	_levelsMovie.setSegment(kLevelsSplashStart * _levelsScale, kLevelsSplashStop * _levelsScale);
	_levelsMovie.setTime(kLevelsSplashStart * _levelsScale);
	_levelsMovie.redrawMovieWorld();
	_levelsMovie.show();

	_pressureCallBack.setNotification(&_pressureNotification);
	_pressureCallBack.initCallBack(&_levelsMovie, kCallBackAtExtremes);
	_pressureCallBack.setCallBackFlag(kSplashFinished);
	_pressureCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);

	_pressureNotification.notifyMe(this, kPressureNotificationFlags, kPressureNotificationFlags);

	if (_isUpperDoor) {
		_typeMovie.initFromMovieFile("Images/Norad Alpha/Upper Type Movie");
		_typeMovie.moveElementTo(kNoradUpperTypeLeft, kNoradUpperTypeTop);
	} else {
		_typeMovie.initFromMovieFile("Images/Norad Alpha/Lower Type Movie");
		_typeMovie.moveElementTo(kNoradLowerTypeLeft, kNoradLowerTypeTop);
	}

	_typeScale = _typeMovie.getScale();
	_typeMovie.setDisplayOrder(kPressureTypeOrder);
	_typeMovie.startDisplaying();
	_typeMovie.setTime(kDoorSealedTime * _typeScale);
	_typeMovie.redrawMovieWorld();

	SpriteFrame *frame = new SpriteFrame();
	if (_isUpperDoor)
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOffPICTID);
	else
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOffPICTID);
	_upButton.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	if (_isUpperDoor)
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureUpOnPICTID);
	else
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureUpOnPICTID);
	_upButton.addFrame(frame, 0, 0);

	_upButton.setCurrentFrameIndex(0);
	_upButton.setDisplayOrder(kPressureUpOrder);

	Common::Rect r;
	frame->getSurfaceBounds(r);
	if (_isUpperDoor)
		r.moveTo(kNoradUpperUpLeft, kNoradUpperUpTop);
	else
		r.moveTo(kNoradLowerUpLeft, kNoradLowerUpTop);

	_upButton.setBounds(r);
	_upButton.startDisplaying();
	_upButton.show();

	frame = new SpriteFrame();
	if (_isUpperDoor)
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOffPICTID);
	else
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOffPICTID);
	_downButton.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	if (_isUpperDoor)
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kLowerPressureDownOnPICTID);
	else
		frame->initFromPICTResource(((PegasusEngine *)g_engine)->_resFork, kUpperPressureDownOnPICTID);
	_downButton.addFrame(frame, 0, 0);

	_downButton.setCurrentFrameIndex(0);
	_downButton.setDisplayOrder(kPressureDownOrder);

	frame->getSurfaceBounds(r);
	if (_isUpperDoor)
		r.moveTo(kNoradUpperDownLeft, kNoradUpperDownTop);
	else
		r.moveTo(kNoradLowerDownLeft, kNoradLowerDownTop);

	_downButton.setBounds(r);
	_downButton.startDisplaying();
	_downButton.show();

	_utilityCallBack.setNotification(&_utilityNotification);
	_utilityCallBack.initCallBack(&_utilityTimer, kCallBackAtTime);
	_utilityNotification.notifyMe(this, kUtilityNotificationFlags, kUtilityNotificationFlags);
	_utilityTimer.setMasterTimeBase(getOwner()->getNavMovie());

	if (_playingAgainstRobot)
		_neighborhoodNotification->notifyMe(this, kExtraCompletedFlag | kDelayCompletedFlag |
				kSpotSoundCompletedFlag, kExtraCompletedFlag | kDelayCompletedFlag | kSpotSoundCompletedFlag);
	else
		_neighborhoodNotification->notifyMe(this, kDelayCompletedFlag | kSpotSoundCompletedFlag,
				kDelayCompletedFlag | kSpotSoundCompletedFlag);

	_gameState = kPlayingSplash;
}
Example #18
0
void DisplayElement::moveElementTo(const CoordType h, const CoordType v) {
	Common::Rect newBounds = _bounds;
	newBounds.moveTo(h, v);
	setBounds(newBounds);
}