Ejemplo n.º 1
0
void UINodeBackground::renderMiddle(int x, int y) const {
	const int renderHeight = getRenderHeight(false);
	renderImage(getCave(), x + getRenderX(false), y + getRenderY(false) + renderHeight - _imageHeight);
	if (_amountVertical > 1)
		renderImage(getCaveArt(), x + getRenderX(false), y + getRenderY(false) + renderHeight - 2 * _imageHeight);

	const int tileCnt = (int)_tiles.size();
	if (tileCnt > 0) {
		for (int row = 3; row <= _amountVertical; ++row) {
			renderImage(_tiles[(row * _amountHorizontal) % tileCnt],
					x + getRenderX(false), y + getRenderY(false) + renderHeight - row * _imageHeight);
		}

		for (int row = 1; row <= _amountVertical; ++row) {
			for (int col = 1; col < _amountHorizontal; ++col) {
				renderImage(_tiles[((row * _amountHorizontal) + col) % tileCnt],
						x + getRenderX(false) + _imageWidth * col,
						y + getRenderY(false) + renderHeight - row * _imageHeight);
			}
		}
	}
	if (_showVehicle && _amountHorizontal > 1 && _vehicle)
		renderImage(_vehicle, x + getRenderX(false) + _imageWidth, y + getRenderY(false) + renderHeight - _vehicle->getHeight());

	if (!_title.empty()) {
		x += getRenderCenterX() - _textWidth / 2;
		y += getRenderY() + 10;

		_font->print(_title, _fontColor, x, y);
	}
}
Ejemplo n.º 2
0
void NPCPackage::update (uint32_t deltaTime)
{
	INPCCave::update(deltaTime);

	if (isIdle() && !returnToInitialPosition())
		leavePackage();

	if (getCave()->moveBackIntoCave()) {
		Log::info(LOG_SERVER, "npc %i moved back into cave, remove from world", getID());
		_remove = true;
	}
}