Ejemplo n.º 1
0
/**
 * Initializes all the elements in the MiniMapState screen.
 * @param game Pointer to the core game.
 * @param map The Battlescape map.
 * @param battleGame The Battlescape save.
*/
MiniMapState::MiniMapState (Game * game, Camera * camera, SavedBattleGame * battleGame) : State(game)
{
	_surface = new InteractiveSurface(320, 200);
	_miniMapView = new MiniMapView(222, 150, 49, 15, game, camera, battleGame);
	InteractiveSurface * btnLvlUp = new InteractiveSurface(18, 20, 24, 62);
	InteractiveSurface * btnLvlDwn = new InteractiveSurface(18, 20, 24, 88);
	InteractiveSurface * btnOk = new InteractiveSurface(32, 32, 275, 145);
	_txtLevel = new Text (20, 25, 281, 75);
	add(_surface);
	add(_miniMapView);
	add(btnLvlUp);
	add(btnLvlDwn);
	add(btnOk);
	add(_txtLevel);
	_game->getResourcePack()->getSurface("SCANBORD.PCK")->blit(_surface);
	btnLvlUp->onMouseClick((ActionHandler)&MiniMapState::btnLevelUpClick);
	btnLvlDwn->onMouseClick((ActionHandler)&MiniMapState::btnLevelDownClick);
	btnOk->onMouseClick((ActionHandler)&MiniMapState::btnOkClick);
	_txtLevel->setBig();
	_txtLevel->setColor(Palette::blockOffset(4));
	_txtLevel->setHighContrast(true);
	std::wstringstream s;
	s << camera->getViewHeight();
	_txtLevel->setText(s.str());
	_timerAnimate = new Timer(125);
	_timerAnimate->onTimer((StateHandler)&MiniMapState::animate);
	_timerAnimate->start();
	_miniMapView->draw();
}
Ejemplo n.º 2
0
/**
 * Initializes all the elements in the MiniMapState screen.
 * @param game Pointer to the core game.
 * @param camera The Battlescape camera.
 * @param battleGame The Battlescape save.
 */
MiniMapState::MiniMapState (Game * game, Camera * camera, SavedBattleGame * battleGame) : State(game)
{
	_surface = new InteractiveSurface(320, 200);
	_miniMapView = new MiniMapView(222, 150, 49, 15, game, camera, battleGame);
	InteractiveSurface * btnLvlUp = new InteractiveSurface(18, 20, 24, 62);
	InteractiveSurface * btnLvlDwn = new InteractiveSurface(18, 20, 24, 88);
	InteractiveSurface * btnOk = new InteractiveSurface(32, 32, 275, 145);
	_txtLevel = new Text (20, 25, 281, 75);
	add(_surface);
	add(_miniMapView);
	add(btnLvlUp);
	add(btnLvlDwn);
	add(btnOk);
	add(_txtLevel);

	centerAllSurfaces();

	if (_game->getScreen()->getDY() > 50)
	{
		_screen = false;
		SDL_Rect current;
		current.w = 223;
		current.h = 151;
		current.x = 46;
		current.y = 14;
		_surface->drawRect(&current, Palette::blockOffset(15)+15);
	}

	_game->getResourcePack()->getSurface("SCANBORD.PCK")->blit(_surface);
	btnLvlUp->onMouseClick((ActionHandler)&MiniMapState::btnLevelUpClick);
	btnLvlDwn->onMouseClick((ActionHandler)&MiniMapState::btnLevelDownClick);
	btnOk->onMouseClick((ActionHandler)&MiniMapState::btnOkClick);
	btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyCancel);
	btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyBattleMap);
	_txtLevel->setBig();
	_txtLevel->setColor(Palette::blockOffset(4));
	_txtLevel->setHighContrast(true);
	std::wostringstream s;
	s << camera->getViewLevel();
	_txtLevel->setText(s.str());
	_timerAnimate = new Timer(125);
	_timerAnimate->onTimer((StateHandler)&MiniMapState::animate);
	_timerAnimate->start();
	_miniMapView->draw();
}
Ejemplo n.º 3
0
SlideshowState::SlideshowState(const SlideshowHeader &slideshowHeader,
			       const std::vector<SlideshowSlide> *slideshowSlides)
		: _slideshowHeader(slideshowHeader), _slideshowSlides(slideshowSlides), _curScreen(-1)
{
	_wasLetterboxed = CutsceneState::initDisplay();

	// pre-render and queue up all the frames
	for (std::vector<SlideshowSlide>::const_iterator it = _slideshowSlides->begin(); it != _slideshowSlides->end(); ++it)
	{
		InteractiveSurface *slide =
			new InteractiveSurface(Screen::ORIGINAL_WIDTH, Screen::ORIGINAL_HEIGHT, 0, 0);
		slide->loadImage(FileMap::getFilePath(it->imagePath));
		slide->onMouseClick((ActionHandler)&SlideshowState::screenClick);
		slide->onKeyboardPress((ActionHandler)&SlideshowState::screenClick, Options::keyOk);
		slide->onKeyboardPress((ActionHandler)&SlideshowState::screenSkip, Options::keyCancel);
		slide->setVisible(false);
		_slides.push_back(slide);
		setPalette(slide->getPalette());
		add(slide);

		// initialize with default rect; may get overridden by
		// category/id definition
		Text *caption = new Text(it->w, it->h, it->x, it->y);
		caption->setColor(it->color);
		caption->setText(tr(it->caption));
		caption->setAlign(it->align);
		caption->setWordWrap(true);
		caption->setVisible(false);
		_captions.push_back(caption);
		add(caption);
	}

	centerAllSurfaces();

	int transitionSeconds = _slideshowHeader.transitionSeconds;
	if (_slideshowSlides->front().transitionSeconds > 0)
		transitionSeconds = _slideshowSlides->front().transitionSeconds;
	_transitionTimer = new Timer(transitionSeconds * 1000);
	_transitionTimer->onTimer((StateHandler)&SlideshowState::screenTimer);

	_game->getMod()->playMusic(_slideshowHeader.musicId);
	_game->getCursor()->setVisible(false);
	screenClick(0);
}
Ejemplo n.º 4
0
/**
 * Initialize the Medikit State
 * @param game Pointer to the core game.
 * @param targetUnit The wounded unit.
 * @param action The healing action.
 */
MedikitState::MedikitState (Game * game, BattleUnit * targetUnit, BattleAction *action) : State (game), _targetUnit(targetUnit), _action(action)
{
	_unit = action->actor;
	_item = action->weapon;
	_surface = new InteractiveSurface(320, 200);

	if (Screen::getDY() > 50)
	{
		_screen = false;
		SDL_Rect current;
		current.w = 190;
		current.h = 100;
		current.x = 67;
		current.y = 44;
		_surface->drawRect(&current, Palette::blockOffset(15)+15);
	}
	_partTxt = new Text(50, 15, 90, 120);
	_woundTxt = new Text(10, 15, 145, 120);
	_medikitView = new MedikitView(52, 58, 95, 60, _game, _targetUnit, _partTxt, _woundTxt);
	InteractiveSurface *endButton = new InteractiveSurface(20, 20,
							       220, 140);

	InteractiveSurface *stimulantButton = new MedikitButton(84);

	InteractiveSurface *pkButton = new MedikitButton(48);
	InteractiveSurface *healButton = new MedikitButton(120);
	_pkText = new MedikitTxt (50);
	_stimulantTxt = new MedikitTxt (85);
	_healTxt = new MedikitTxt (120);
	add(_surface);
	add(_medikitView);
	add(endButton);
	add(new MedikitTitle (37, _game->getLanguage()->getString("STR_PAIN_KILLER")));
	add(new MedikitTitle (73, _game->getLanguage()->getString("STR_STIMULANT")));
	add(new MedikitTitle (109, _game->getLanguage()->getString("STR_HEAL")));
	add(healButton);
	add(stimulantButton);
	add(pkButton);
	add(_pkText);
	add(_stimulantTxt);
	add(_healTxt);
	add(_partTxt);
	add(_woundTxt);

	centerAllSurfaces();

	_game->getResourcePack()->getSurface("MEDIBORD.PCK")->blit(_surface);
	_pkText->setBig();
	_stimulantTxt->setBig();
	_healTxt->setBig();
	_partTxt->setColor(Palette::blockOffset(2));
	_partTxt->setHighContrast(true);
	_woundTxt->setColor(Palette::blockOffset(2));
	_woundTxt->setHighContrast(true);
	endButton->onMouseClick((ActionHandler)&MedikitState::onEndClick);
	endButton->onKeyboardPress((ActionHandler)&MedikitState::onEndClick, (SDLKey)Options::getInt("keyCancel"));
	healButton->onMouseClick((ActionHandler)&MedikitState::onHealClick);
	stimulantButton->onMouseClick((ActionHandler)&MedikitState::onStimulantClick);
	pkButton->onMouseClick((ActionHandler)&MedikitState::onPainKillerClick);
	update();
}