void Game::loadMap(const QUrl &url, QQuickItem* parent) { m_players.clear(); //TODO: CLEAN UP PREVIOUS MAP Properly (esp units)! if(!m_engine) return; qDebug() << "loading " << url; if(!m_cc) m_cc = new QQmlComponent(m_engine, this); m_cc->loadUrl(url); m_gameArea = parent; if(m_cc->isLoading()) connect(m_cc, SIGNAL(statusChanged(QQmlComponent::Status)), this, SLOT(finishLoad())); else finishLoad(); }
XctionWorker::~XctionWorker() { finishLoad(); for (int i = 0; i < Const::PROCESSOR_XCTION_QUEUE_SIZE; ++i) { delete mpXctions[i]; } delete[] mpXctions; Logger::out(1, "XctionWorker: Destroyed!\n"); }
void OfflineService::onModuleLoad(bool success, const std::string & moduleName) { if (success) { finishLoad(); } else { Docker::getRef().forceStop(); } }
bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, TransformStruct transform) { BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); if (!_loaded) { finishLoad(); } if (renderer->_forceAlphaColor != 0) { transform._rgbaMod = renderer->_forceAlphaColor; } // TODO: This _might_ miss the intended behaviour by 1 in each direction // But I think it fits the model used in Wintermute. Common::Rect srcRect; srcRect.left = rect->left; srcRect.top = rect->top; srcRect.setWidth(rect->right - rect->left); srcRect.setHeight(rect->bottom - rect->top); Common::Rect position; if (newRect) { position.top = y; position.left = x; position.setWidth(newRect->width()); position.setHeight(newRect->height()); } else { Rect32 r; r.top = 0; r.left = 0; r.setWidth(rect->width()); r.setHeight(rect->height()); r = TransformTools::newRect(r, transform, 0); position.top = r.top + y + transform._offset.y; position.left = r.left + x + transform._offset.x; position.setWidth(r.width() * transform._numTimesX); position.setHeight(r.height() * transform._numTimesY); } renderer->modTargetRect(&position); // TODO: This actually requires us to have the SAME source-offsets every time, // But no checking is in place for that yet. // Optimize by not doing alpha-blits if we lack alpha if (_alphaType == TransparentSurface::ALPHA_OPAQUE && !transform._alphaDisable) { transform._alphaDisable = true; } renderer->drawSurface(this, _surface, &srcRect, &position, transform); return STATUS_OK; }
bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, float zoomY, uint32 alpha, bool alphaDisable, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer); if (!_loaded) { finishLoad(); } if (renderer->_forceAlphaColor != 0) { alpha = renderer->_forceAlphaColor; } byte r = RGBCOLGetR(alpha); byte g = RGBCOLGetG(alpha); byte b = RGBCOLGetB(alpha); byte a = RGBCOLGetA(alpha); renderer->setAlphaMod(a); renderer->setColorMod(r, g, b); #if 0 // These are kept for reference if BlendMode is reimplemented at some point. if (alphaDisable) { SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE); } else { SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_BLEND); } #endif // TODO: This _might_ miss the intended behaviour by 1 in each direction // But I think it fits the model used in Wintermute. Common::Rect srcRect; srcRect.left = rect->left; srcRect.top = rect->top; srcRect.setWidth(rect->right - rect->left); srcRect.setHeight(rect->bottom - rect->top); Common::Rect position; position.left = x + offsetX; position.top = y + offsetY; // Crop off-by-ones: if (position.left == -1) { position.left = 0; // TODO: Something is wrong } if (position.top == -1) { position.top = 0; // TODO: Something is wrong } position.setWidth((int16)((float)srcRect.width() * zoomX / 100.f)); position.setHeight((int16)((float)srcRect.height() * zoomX / 100.f)); renderer->modTargetRect(&position); /* position.left += offsetX; position.top += offsetY;*/ // TODO: This actually requires us to have the SAME source-offsets every time, // But no checking is in place for that yet. // TODO: Optimize by not doing alpha-blits if we lack or disable alpha bool hasAlpha; if (_hasAlpha && !alphaDisable) { hasAlpha = true; } else { hasAlpha = false; } if (alphaDisable) { warning("BaseSurfaceOSystem::drawSprite - AlphaDisable ignored"); } renderer->drawSurface(this, _surface, &srcRect, &position, mirrorX, mirrorY, !hasAlpha); return STATUS_OK; }