Exemple #1
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;
}
Exemple #2
0
// Directly shows new screen starting up/down/left/right and going to the
// opposite direction - works on _picRect area only
void GfxTransitions::straight(int16 number, bool blackoutFlag) {
	int16 stepNr = 0;
	Common::Rect newScreenRect = _picRect;
	uint32 msecCount = 0;

	switch (number) {
	case SCI_TRANSITIONS_STRAIGHT_FROM_RIGHT:
		newScreenRect.left = newScreenRect.right - 1;
		while (newScreenRect.left >= _picRect.left) {
			copyRectToScreen(newScreenRect, blackoutFlag);
			if ((stepNr & 1) == 0) {
				msecCount += 2;
				updateScreenAndWait(msecCount);
			}
			stepNr++;
			newScreenRect.translate(-1, 0);
		}
		break;

	case SCI_TRANSITIONS_STRAIGHT_FROM_LEFT:
		newScreenRect.right = newScreenRect.left + 1;
		while (newScreenRect.right <= _picRect.right) {
			copyRectToScreen(newScreenRect, blackoutFlag);
			if ((stepNr & 1) == 0) {
				msecCount += 2;
				updateScreenAndWait(msecCount);
			}
			stepNr++;
			newScreenRect.translate(1, 0);
		}
		break;

	case SCI_TRANSITIONS_STRAIGHT_FROM_BOTTOM:
		newScreenRect.top = newScreenRect.bottom - 1;
		while (newScreenRect.top >= _picRect.top) {
			copyRectToScreen(newScreenRect, blackoutFlag);
			msecCount += 4;
			updateScreenAndWait(msecCount);
			stepNr++;
			newScreenRect.translate(0, -1);
		}
		break;

	case SCI_TRANSITIONS_STRAIGHT_FROM_TOP:
		newScreenRect.bottom = newScreenRect.top + 1;
		while (newScreenRect.bottom <= _picRect.bottom) {
			copyRectToScreen(newScreenRect, blackoutFlag);
			msecCount += 4;
			updateScreenAndWait(msecCount);
			stepNr++;
			newScreenRect.translate(0, 1);
		}
		break;
	}
}
Exemple #3
0
// Vertically displays new screen starting from edges - works on _picRect area
// only
void GfxTransitions::verticalRollToCenter(bool blackoutFlag) {
	Common::Rect leftRect = Common::Rect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom);
	Common::Rect rightRect = Common::Rect(_picRect.right - 1, _picRect.top, _picRect.right, _picRect.bottom);
	uint32 msecCount = 0;

	while (leftRect.left < rightRect.right) {
		copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(1, 0);
		copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(-1, 0);
		msecCount += 3;
		updateScreenAndWait(msecCount);
	}
}
Exemple #4
0
// Horizontally displays new screen starting from upper and lower edge - works
// on _picRect area only
void GfxTransitions::horizontalRollToCenter(bool blackoutFlag) {
	Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1);
	Common::Rect lowerRect = Common::Rect(upperRect.left, _picRect.bottom - 1, upperRect.right, _picRect.bottom);
	uint32 msecCount = 0;

	while (upperRect.top < lowerRect.bottom) {
		copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, 1);
		copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, -1);
		msecCount += 4;
		updateScreenAndWait(msecCount);
	}
}
Exemple #5
0
bool Text::doRender() {
	// Font-Resource locken.
	FontResource *fontPtr = lockFontResource();
	if (!fontPtr)
		return false;

	// Charactermap-Resource locken.
	ResourceManager *rmPtr = getResourceManager();
	BitmapResource *charMapPtr;
	{
		Resource *pResource = rmPtr->requestResource(fontPtr->getCharactermapFileName());
		if (!pResource) {
			BS_LOG_ERRORLN("Could not request resource \"%s\".", fontPtr->getCharactermapFileName().c_str());
			return false;
		}
		if (pResource->getType() != Resource::TYPE_BITMAP) {
			BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", fontPtr->getCharactermapFileName().c_str());
			return false;
		}

		charMapPtr = static_cast<BitmapResource *>(pResource);
	}

	// Framebufferobjekt holen.
	GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
	BS_ASSERT(gfxPtr);

	bool result = true;
	Common::Array<Line>::iterator iter = _lines.begin();
	for (; iter != _lines.end(); ++iter) {
		// Feststellen, ob überhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind.
		Common::Rect checkRect = (*iter).bbox;
		checkRect.translate(_absoluteX, _absoluteY);

		// Jeden Buchstaben einzeln Rendern.
		int curX = _absoluteX + (*iter).bbox.left;
		int curY = _absoluteY + (*iter).bbox.top;
		for (uint i = 0; i < (*iter).text.size(); ++i) {
			Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);

			Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
			int renderX = curX + (renderRect.left - renderRect.left);
			int renderY = curY + (renderRect.top - renderRect.top);
			renderRect.translate(curRect.left - curX, curRect.top - curY);
			result = charMapPtr->blit(renderX, renderY, Image::FLIP_NONE, &renderRect, _modulationColor);
			if (!result)
				break;

			curX += curRect.width() + fontPtr->getGapWidth();
		}
	}

	// Charactermap-Resource freigeben.
	charMapPtr->release();

	// Font-Resource freigeben.
	fontPtr->release();

	return result;
}
Exemple #6
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;
}
Exemple #7
0
void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
	if (!obj->isVisible()) {
		return;
	}

	Common::Rect rect;
	byte *data;

	obj->getRect(obj->frame, rect);

	int x = obj->x;
	int y = obj->y;
	if (_overlayMode) {
		x += _scrollPosX;
		y += _scrollPosY;
	}
	rect.translate(x, y);
	data = obj->getData(obj->frame);

	if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
		blt(rect, data, &surf, obj->layer, obj->scale, obj->transparentKey);
	} else {
		unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, obj->scale, obj->transparentKey);
	}

}
Exemple #8
0
void Screen::copyBlock(BaseSurface *src, const Common::Rect &bounds) {
	Common::Rect destBounds = bounds;
	destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff);

	copyRectToSurface(*src, destBounds.left, destBounds.top, bounds);
	addDirtyRect(destBounds);
}
Exemple #9
0
void Font::drawChar(ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const {
	drawChar(&dst->_innerSurface, chr, x, y, color);

	Common::Rect charBox = getBoundingBox(chr);
	charBox.translate(x, y);
	dst->addDirtyRect(charBox);
}
Exemple #10
0
void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
	if (!obj->isVisible()) {
		return;
	}

	Common::Rect rect;
	byte *data;

	obj->getRect(obj->frame, rect);

	int x = obj->x;
	int y = obj->y;
	if (_overlayMode) {
		x += _scrollPosX;
		y += _scrollPosY;
	}
	rect.translate(x, y);
	data = obj->getData(obj->frame);

	// WORKAROUND: During the end credits, game scripts try to show a
	// non-existing frame. We change it to an existing one here.
	if (obj->frame == 14 && obj->getNum() == 9 && !strcmp(obj->getName(), "Dinor"))
		obj->frame = 8;

	if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
		blt(rect, data, &surf, obj->layer, obj->scale, obj->transparentKey);
	} else {
		unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, obj->scale, obj->transparentKey);
	}

}
Exemple #11
0
// Vertically displays new screen starting from center - works on _picRect area
// only
void GfxTransitions::verticalRollFromCenter(bool blackoutFlag) {
	Common::Rect leftRect = Common::Rect(_picRect.left + (_picRect.width() / 2) -1, _picRect.top, _picRect.left + (_picRect.width() / 2), _picRect.bottom);
	Common::Rect rightRect = Common::Rect(leftRect.right, _picRect.top, leftRect.right + 1, _picRect.bottom);
	uint32 msecCount = 0;

	while ((leftRect.left >= _picRect.left) || (rightRect.right <= _picRect.right)) {
		if (leftRect.left < _picRect.left)
			leftRect.translate(1, 0);
		if (rightRect.right > _picRect.right)
			rightRect.translate(-1, 0);
		copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(-1, 0);
		copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(1, 0);
		msecCount += 3;
		updateScreenAndWait(msecCount);
	}
}
Exemple #12
0
Common::Rect SpotItemFace::getFaceRect() const {
	assert(_bitmap);

	Common::Rect r = Common::Rect(_bitmap->w, _bitmap->h);
	r.translate(_posX, _posY);
	return r;
}
Exemple #13
0
void Cursor::draw() {
	assert(_currentCursorID < ARRAYSIZE(availableCursors));

	const CursorData &cursor = availableCursors[_currentCursorID];

	Texture *texture = _textures[cursor.nodeID];
	if (!texture) {
		error("No texture for cursor with id %d", cursor.nodeID);
	}

	// Rect where to draw the cursor
	Common::Rect viewport = _vm->_gfx->viewport();
	float scale = MIN(
			viewport.width()  / (float) Renderer::kOriginalWidth,
			viewport.height() / (float) Renderer::kOriginalHeight
	);

	Common::Rect screenRect = Common::Rect(texture->width * scale, texture->height * scale);
	screenRect.translate(_position.x - cursor.hotspotX * scale, _position.y - cursor.hotspotY * scale);

	// Texture rect
	Common::Rect textureRect = Common::Rect(texture->width, texture->height);

	float transparency = 1.0f;

	int32 varTransparency = _vm->_state->getCursorTransparency();
	if (_lockedAtCenter || varTransparency == 0) {
		if (varTransparency >= 0)
			transparency = varTransparency / 100.0f;
		else
			transparency = getTransparencyForId(_currentCursorID);
	}

	_vm->_gfx->drawTexturedRect2D(screenRect, textureRect, texture, transparency);
}
Exemple #14
0
bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
	// Test if the current mouse position is contained in the specified rectangle
	Common::Point mousepos = _vm->_system->getEventManager()->getMousePos();
	bool contained = rect.contains(mousepos);

	// Show hotspots when debugging
	if (Common::isDebugChannelEnabled(kGroovieDebugHotspots) ||
	    Common::isDebugChannelEnabled(kGroovieDebugAll)) {
		rect.translate(0, -80);
		_vm->_graphicsMan->_foreground.frameRect(rect, 250);
		_vm->_system->copyRectToScreen((byte*)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), 640, 0, 80, 640, 320);
		_vm->_system->updateScreen();
	}

	// If there's an already planned action, do nothing
	if (_inputAction != -1) {
		return false;
	}

	if (contained) {
		// Change the mouse cursor
		if (_newCursorStyle == 5) {
			_newCursorStyle = cursor;
		}

		// If clicked with the mouse, jump to the specified address
		if (_mouseClicked) {
			_inputAction = address;
		}
	}

	return contained;
}
Exemple #15
0
bool PaintControl::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
    if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
        return false;

    if (_rectangle.contains(backgroundImageSpacePos)) {
        int mouseItem = _engine->getScriptManager()->getStateValue(StateKey_InventoryItem);

        if (eligeblity(mouseItem)) {
            _engine->getCursorManager()->changeCursor(_cursor);

            if (_mouseDown) {
                Common::Rect bkgRect = paint(backgroundImageSpacePos);
                if (!bkgRect.isEmpty()) {
                    Common::Rect imgRect = bkgRect;
                    imgRect.translate(-_rectangle.left, -_rectangle.top);

                    Graphics::Surface imgUpdate = _bkg->getSubArea(imgRect);

                    _engine->getRenderManager()->blitSurfaceToBkg(imgUpdate, bkgRect.left, bkgRect.top, _colorKey);
                }
            }
            return true;
        }
    }

    return false;
}
Exemple #16
0
bool ActionStreamVideo::execute() {
	Video::VideoDecoder *decoder;
	Common::Rect destRect = Common::Rect(_x1, _y1, _x2 + 1, _y2 + 1);
	Common::String subname = _fileName;
	subname.setChar('s', subname.size() - 3);
	subname.setChar('u', subname.size() - 2);
	subname.setChar('b', subname.size() - 1);
	bool subtitleExists = _engine->getSearchManager()->hasFile(subname);
	bool switchToHires = false;

// NOTE: We only show the hires MPEG2 videos when libmpeg2 is compiled in,
// otherwise we fall back to the lowres ones
#ifdef USE_MPEG2
	Common::String hiresFileName = _fileName;
	hiresFileName.setChar('d', hiresFileName.size() - 8);
	hiresFileName.setChar('v', hiresFileName.size() - 3);
	hiresFileName.setChar('o', hiresFileName.size() - 2);
	hiresFileName.setChar('b', hiresFileName.size() - 1);

	if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) {
		// TODO: Enable once AC3 support is implemented
		if (!_engine->getSearchManager()->hasFile(_fileName))	// Check for the regular video
			return true;
		warning("The hires videos of the DVD version of ZGI aren't supported yet, using lowres");
		//_fileName = hiresFileName;
		//switchToHires = true;
	} else if (!_engine->getSearchManager()->hasFile(_fileName))
		return true;
#else
	if (!_engine->getSearchManager()->hasFile(_fileName))
		return true;
#endif

	decoder = _engine->loadAnimation(_fileName);
	Subtitle *sub = (subtitleExists) ? new Subtitle(_engine, subname, switchToHires) : NULL;

	_engine->getCursorManager()->showMouse(false);

	if (switchToHires) {
		_engine->initHiresScreen();
		destRect = Common::Rect(40, -40, 760, 440);
		Common::Rect workingWindow = _engine->_workingWindow;
		workingWindow.translate(0, -40);
		_engine->getRenderManager()->initSubArea(HIRES_WINDOW_WIDTH, HIRES_WINDOW_HEIGHT, workingWindow);
	}

	_engine->playVideo(*decoder, destRect, _skippable, sub);

	if (switchToHires) {
		_engine->initScreen();
		_engine->getRenderManager()->initSubArea(WINDOW_WIDTH, WINDOW_HEIGHT, _engine->_workingWindow);
	}

	_engine->getCursorManager()->showMouse(true);

	delete decoder;
	delete sub;

	return true;
}
Exemple #17
0
// Horizontally displays new screen starting from center - works on _picRect
// area only
void GfxTransitions::horizontalRollFromCenter(bool blackoutFlag) {
	Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top + (_picRect.height() / 2) - 1, _picRect.right, _picRect.top + (_picRect.height() / 2));
	Common::Rect lowerRect = Common::Rect(upperRect.left, upperRect.bottom, upperRect.right, upperRect.bottom + 1);
	uint32 msecCount = 0;

	while ((upperRect.top >= _picRect.top) || (lowerRect.bottom <= _picRect.bottom)) {
		if (upperRect.top < _picRect.top)
			upperRect.translate(0, 1);
		if (lowerRect.bottom > _picRect.bottom)
			lowerRect.translate(0, -1);
		copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, -1);
		copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, 1);
		msecCount += 4;
		updateScreenAndWait(msecCount);
	}
}
Exemple #18
0
Common::Rect BaseRenderer::frameViewport() const {
	Common::Rect screen = viewport();

	Common::Rect frame = Common::Rect(screen.width(), screen.height() * kFrameHeight / kOriginalHeight);
	frame.translate(screen.left, screen.top + screen.height() * kBottomBorderHeight / kOriginalHeight);

	return frame;
}
Exemple #19
0
void Animation::getFrameRect(Common::Rect &r) const {
	r.setWidth(0); r.setHeight(0);
	if (!gfxobj) {
		return;
	}
	gfxobj->getRect(_frame, r);
	r.translate(_left, _top);
}
Exemple #20
0
bool Text::doRender(RectangleList *updateRects) {
	// lock Font Resource
	FontResource *fontPtr = lockFontResource();
	if (!fontPtr)
		return false;

	// lock Character map resource
	ResourceManager *rmPtr = getResourceManager();
	BitmapResource *charMapPtr;
	{
		Resource *pResource = rmPtr->requestResource(fontPtr->getCharactermapFileName());
		if (!pResource) {
			warning("Could not request resource \"%s\".", fontPtr->getCharactermapFileName().c_str());
			return false;
		}
		if (pResource->getType() != Resource::TYPE_BITMAP) {
			error("Requested resource \"%s\" is not a bitmap.", fontPtr->getCharactermapFileName().c_str());
			return false;
		}

		charMapPtr = static_cast<BitmapResource *>(pResource);
	}

	// Getting frame buffer object
	GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
	assert(gfxPtr);

	bool result = true;
	Common::Array<Line>::iterator iter = _lines.begin();
	for (; iter != _lines.end(); ++iter) {
		// Determine whether any letters of the current line are affected by the update.
		Common::Rect checkRect = (*iter).bbox;
		checkRect.translate(_absoluteX, _absoluteY);

		// Render each letter individually.
		int curX = _absoluteX + (*iter).bbox.left;
		int curY = _absoluteY + (*iter).bbox.top;
		for (uint i = 0; i < (*iter).text.size(); ++i) {
			Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);

			Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
			renderRect.translate(curRect.left - curX, curRect.top - curY);
			result = charMapPtr->blit(curX, curY, Graphics::FLIP_NONE, &renderRect, _modulationColor, -1, -1, updateRects);
			if (!result)
				break;

			curX += curRect.width() + fontPtr->getGapWidth();
		}
	}

	// Free Character map resource
	charMapPtr->release();

	// Free Font resource
	fontPtr->release();

	return result;
}
Exemple #21
0
void WidgetBase::handleScrolling(int &scrollIndex, int pageSize, int max) {
	Events &events = *_vm->_events;
	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
	Common::KeyCode keycode = ui._keyState.keycode;
	Common::Point mousePos = events.mousePos();

	Common::Rect r = getScrollBarBounds();
	r.translate(_bounds.left, _bounds.top);

	if (ui._scrollHighlight != SH_NONE || keycode == Common::KEYCODE_HOME || keycode == Common::KEYCODE_END
		|| keycode == Common::KEYCODE_PAGEUP || keycode == Common::KEYCODE_PAGEDOWN
		|| keycode == Common::KEYCODE_UP || keycode == Common::KEYCODE_DOWN) {
		// Check for the scrollbar
		if (ui._scrollHighlight == SH_THUMBNAIL) {
			int yp = mousePos.y;
			yp = CLIP(yp, r.top + BUTTON_SIZE + 3, r.bottom - BUTTON_SIZE - 3);

			// Calculate the line number that corresponds to the position that the mouse is on the scrollbar
			int lineNum = (yp - r.top - BUTTON_SIZE - 3) * (max - pageSize) / (r.height() - BUTTON_SIZE * 2 - 6);
			scrollIndex = CLIP(lineNum, 0, max - pageSize);
		}

		// Get the current frame so we can check the scroll timer against it
		uint32 frameNum = events.getFrameCounter();

		if (frameNum > _dialogTimer) {
			// Set the timeout for the next scroll if the mouse button remains held down
			_dialogTimer = (_dialogTimer == 0) ? frameNum + pageSize : frameNum + 1;

			// Check for Scroll Up
			if ((ui._scrollHighlight == SH_SCROLL_UP || keycode == Common::KEYCODE_UP) && scrollIndex)
				--scrollIndex;

			// Check for Page Up
			else if ((ui._scrollHighlight == SH_PAGE_UP || keycode == Common::KEYCODE_PAGEUP) && scrollIndex)
				scrollIndex -= pageSize;

			// Check for Page Down
			else if ((ui._scrollHighlight == SH_PAGE_DOWN || keycode == Common::KEYCODE_PAGEDOWN)
				&& (scrollIndex + pageSize < max)) {
				scrollIndex += pageSize;
				if (scrollIndex + pageSize >max)
					scrollIndex = max - pageSize;
			}

			// Check for Scroll Down
			else if ((ui._scrollHighlight == SH_SCROLL_DOWN || keycode == Common::KEYCODE_DOWN) && (scrollIndex + pageSize < max))
				++scrollIndex;
		}

		if (keycode == Common::KEYCODE_END)
			scrollIndex = max - pageSize;

		if (scrollIndex < 0 || keycode == Common::KEYCODE_HOME)
			scrollIndex = 0;
	}
}
Exemple #22
0
void GfxControls16::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) {
	Common::Rect workerRect = rect;
	GuiResourceId oldFontId = _text16->GetFontId();
	int16 oldPenColor = _ports->_curPort->penClr;
	uint16 fontSize = 0;
	int16 i;
	const char *listEntry;
	int16 listEntryLen;
	int16 lastYpos;

	// draw basic window
	_paint16->eraseRect(workerRect);
	workerRect.grow(1);
	_paint16->frameRect(workerRect);

	// draw UP/DOWN arrows
	//  we draw UP arrow one pixel lower than sierra did, because it looks nicer. Also the DOWN arrow has one pixel
	//  line inbetween as well
	// They "fixed" this in SQ4 by having the arrow character start one pixel line later, we don't adjust there
	if (g_sci->getGameId() != GID_SQ4)
		workerRect.top++;
	_text16->Box(controlListUpArrow, false, workerRect, SCI_TEXT16_ALIGNMENT_CENTER, 0);
	workerRect.top = workerRect.bottom - 10;
	_text16->Box(controlListDownArrow, false, workerRect, SCI_TEXT16_ALIGNMENT_CENTER, 0);

	// Draw inner lines
	workerRect.top = rect.top + 9;
	workerRect.bottom -= 10;
	_paint16->frameRect(workerRect);
	workerRect.grow(-1);

	_text16->SetFont(fontId);
	fontSize = _ports->_curPort->fontHeight;
	_ports->penColor(_ports->_curPort->penClr); _ports->backColor(_ports->_curPort->backClr);
	workerRect.bottom = workerRect.top + fontSize;
	lastYpos = rect.bottom - fontSize;

	// Write actual text
	for (i = upperPos; i < count; i++) {
		_paint16->eraseRect(workerRect);
		listEntry = entries[i];
		if (listEntry[0]) {
			_ports->moveTo(workerRect.left, workerRect.top);
			listEntryLen = strlen(listEntry);
			_text16->Draw(listEntry, 0, MIN(maxChars, listEntryLen), oldFontId, oldPenColor);
			if ((!isAlias) && (i == cursorPos)) {
				_paint16->invertRect(workerRect);
			}
		}
		workerRect.translate(0, fontSize);
		if (workerRect.bottom > lastYpos)
			break;
	}

	_text16->SetFont(oldFontId);
}
Exemple #23
0
void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) {
	const byte *buf = getBasePtr(bounds.left, bounds.top);

	Common::Rect destBounds = bounds;
	destBounds.translate(_clipBounds.left, _clipBounds.top);

	if (bounds.width() != 0 && bounds.height() != 0)
		g_system->copyRectToScreen(buf, this->pitch, destBounds.left, destBounds.top,
		destBounds.width(), destBounds.height());
}
Exemple #24
0
void Scene::drawBlackBorders() {
	Common::Rect top = Common::Rect(Renderer::kOriginalWidth, Renderer::kTopBorderHeight);

	Common::Rect bottom = Common::Rect(Renderer::kOriginalWidth, Renderer::kBottomBorderHeight);
	bottom.translate(0, Renderer::kTopBorderHeight + Renderer::kFrameHeight);

	uint32 black = Graphics::ARGBToColor< Graphics::ColorMasks<8888> >(255, 0, 0, 0);
	_vm->_gfx->drawRect2D(top, black);
	_vm->_gfx->drawRect2D(bottom, black);
}
Exemple #25
0
void Scene::drawSunspotFlare(const SunSpot &s) {
	Common::Rect frame = Common::Rect(Renderer::kOriginalWidth, Renderer::kFrameHeight);
	frame.translate(0, Renderer::kTopBorderHeight);

	uint8 a = (uint8)(s.intensity * s.radius);
	uint8 r, g, b;
	Graphics::colorToRGB< Graphics::ColorMasks<888> >(s.color, r, g, b);
	uint32 color = Graphics::ARGBToColor< Graphics::ColorMasks<8888> >(a, r, g, b);

	_vm->_gfx->drawRect2D(frame, color);
}
Exemple #26
0
void BaseRenderOSystem::repeatLastDraw(int offsetX, int offsetY, int numTimesX, int numTimesY) {
	if (_previousTicket && _lastAddedTicket != _renderQueue.end()) {
		RenderTicket *origTicket = _previousTicket;

		// Make sure drawSurface WILL start from the correct _lastAddedTicket
		if (!_tempDisableDirtyRects && !_disableDirtyRects && *_lastAddedTicket != origTicket) {
			RenderQueueIterator it;
			RenderQueueIterator endIterator = _renderQueue.end();
			for (it = _renderQueue.begin(); it != endIterator; ++it) {
				if ((*it) == _previousTicket) {
					_lastAddedTicket = it;
					break;
				}
			}
		}
		Common::Rect srcRect(0, 0, 0, 0);
		srcRect.setWidth(origTicket->getSrcRect()->width());
		srcRect.setHeight(origTicket->getSrcRect()->height());

		Common::Rect dstRect = origTicket->_dstRect;
		int initLeft = dstRect.left;
		int initRight = dstRect.right;

		TransformStruct temp = TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, BLEND_NORMAL, kDefaultRgbaMod, false, false, kDefaultOffsetX, kDefaultOffsetY);

		for (int i = 0; i < numTimesY; i++) {
			if (i == 0) {
				dstRect.translate(offsetX, 0);
			}
			for (int j = (i == 0 ? 1 : 0); j < numTimesX; j++) {
				drawSurface(origTicket->_owner, origTicket->getSurface(), &srcRect, &dstRect, temp); 
				dstRect.translate(offsetX, 0);
			}
			dstRect.left = initLeft;
			dstRect.right = initRight;
			dstRect.translate(0, offsetY);
		}
	} else {
		error("Repeat-draw failed (did you forget to draw something before this?)");
	}
}
Exemple #27
0
void GfxAnimate::animateShowPic() {
	Port *picPort = _ports->_picWind;
	Common::Rect picRect = picPort->rect;
	bool previousCursorState = _cursor->isVisible();

	if (previousCursorState)
		_cursor->kernelHide();
	// Adjust picRect to become relative to screen
	picRect.translate(picPort->left, picPort->top);
	_transitions->doit(picRect);
	if (previousCursorState)
		_cursor->kernelShow();
}
Exemple #28
0
Common::Rect Cursor::getHotRectangle() const {
	if (!_cursorImage) {
		return Common::Rect();
	} else {
		Common::Point hotSpot = _cursorImage->getHotspot();

		Common::Rect hotRectangle;
		hotRectangle.setWidth(_cursorImage->getWidth());
		hotRectangle.setHeight(_cursorImage->getHeight());
		hotRectangle.translate(-hotSpot.x, -hotSpot.y);

		return hotRectangle;
	}
}
Exemple #29
0
Graphics::Surface *BalloonManager_br::expandBalloon(Frames *data, int frameNum) {

	Common::Rect rect;
	data->getRect(frameNum, rect);

	rect.translate(-rect.left, -rect.top);

	Graphics::Surface *surf = new Graphics::Surface;
	surf->create(rect.width(), rect.height(), 1);

	_vm->_gfx->unpackBlt(rect, data->getData(frameNum), data->getRawSize(frameNum), surf, LAYER_FOREGROUND, 100, BALLOON_TRANSPARENT_COLOR_BR);

	return surf;
}
Exemple #30
0
void RivenVideo::disable() {
	if (needsUpdate()) {
		drawNextFrame();
	}

	if (_video) {
		Common::Rect targetRect = Common::Rect(_video->getWidth(), _video->getHeight());
		targetRect.translate(_x, _y);

		_vm->_gfx->copySystemRectToScreen(targetRect);
	}

	_enabled = false;
}