Example #1
0
void Troll::gameOver() {
    // We do a check to see if the game should quit. Without this, the game show the picture, plays the
    // music, and then quits. So if the game is quitting, we shouldn't run the "game over" part.
    if (_vm->shouldQuit())
        return;

    char szMoves[40];

    _vm->clearTextArea();
    drawPic(42, true, true);

    playTune(4, 25);

    printUserMessage(16);

    printUserMessage(33);

    _vm->clearTextArea();

    drawPic(46, true, true);

    sprintf(szMoves, IDS_TRO_GAMEOVER_0, _moves);
    _vm->drawStr(21, 1, kColorDefault, szMoves);
    _vm->drawStr(22, 1, kColorDefault, IDS_TRO_GAMEOVER_1);
    _vm->_gfx->doUpdate();

    pressAnyKey();
}
Example #2
0
void HiRes1Engine::drawItem(Item &item, const Common::Point &pos) {
	if (item.isLineArt) {
		StreamPtr stream(_corners[item.picture - 1]->createReadStream());
		static_cast<Graphics_v1 *>(_graphics)->drawCorners(*stream, pos);
	} else
		drawPic(item.picture, pos);
}
Example #3
0
void Troll::intro() {
    // sierra on-line presents
    _vm->clearScreen(0x2F);
    _vm->drawStr(9, 10, kColorDefault, IDS_TRO_INTRO_0);
    _vm->drawStr(14, 15, kColorDefault, IDS_TRO_INTRO_1);
    _vm->_gfx->doUpdate();
    _vm->_system->updateScreen();
    _vm->_system->delayMillis(3200);

    CursorMan.showMouse(true);

    // Draw logo
    _vm->setDefaultTextColor(0x0f);
    drawPic(45, false, true);
    _vm->_gfx->doUpdate();

    // wait for keypress and alternate message
    waitAnyKeyIntro();

    // have you played this game before?
    _vm->drawStr(22, 3, kColorDefault, IDS_TRO_INTRO_4);
    _vm->drawStr(23, 6, kColorDefault, IDS_TRO_INTRO_5);
    _vm->_gfx->doUpdate();

    if (!_vm->getSelection(kSelYesNo))
        tutorial();

    credits();
}
Example #4
0
void drawText(char *text, int x, int y)
{
	SDL_Color color = {255, 255, 255};
	SDL_Surface *textsf;
	textsf = TTF_RenderText_Solid(font, text, color);
	drawPic(textsf, x, y);
	SDL_FreeSurface(textsf);
}
Example #5
0
int Troll::drawRoom(char *menu) {
    int n = 0;
    bool contFlag = false;

    if (_currentRoom == 1) {
        _vm->_picture->setDimensions(IDI_TRO_PIC_WIDTH, IDI_TRO_PIC_HEIGHT);
        _vm->clearScreen(0x00, false);
        _vm->_picture->clear();
    } else {

        if (_currentRoom != 42) {
            if (_roomPicDeltas[_currentRoom]) {
                contFlag = true;
            }
        }

        drawPic(_currentRoom, contFlag, true);
        _vm->_gfx->doUpdate();

        if (_currentRoom == 42) {
            drawPic(44, false, false); // don't clear
        } else {
            if (!_isTrollAway) {
                drawTroll();
            }
        }
    }

    _vm->_gfx->doUpdate();

    char tmp[10];
    strncat(menu, (char*)_gameData + _locMessagesIdx[_currentRoom], 39);

    for (int i = 0; i < 3; i++) {
        if (_roomDescs[_roomPicture - 1].options[i]) {
            sprintf(tmp, "\n  %d.", i);
            strcat(menu, tmp);

            strncat(menu, (char *)_gameData + _options[_roomDescs[_roomPicture - 1].options[i]- 1], 35);

            n = i + 1;
        }
    }

    return n;
}
Example #6
0
void draw(void)
{
	drawPic(images[GOLD], 16, 16);
	drawText("100", 38, 16);

	drawPic(images[TIME], 128, 16);
	drawText("1", 150, 16);

	drawPic(images[MAN], 256, 16);
	drawText("5", 278, 16);

	drawPic(images[FOOD], 384, 16);
	drawText("20", 406, 16);

	drawPic(images[HOUSE], 16, 42);
	drawText("0", 38, 42);
	SDL_Flip(screen);
}
Example #7
0
void Troll::drawTroll() {
    for (int i = 0; i < IDI_TRO_NUM_NONTROLL; i++)
        if (_currentRoom == _nonTrollRooms[i]) {
            _isTrollAway = true;
            return;
        }

    drawPic(43, false, false, true);
}
Example #8
0
void HiRes1Engine::showRoom() {
	_state.curPicture = getCurRoom().curPicture;
	clearScreen();
	loadRoom(_state.room);

	if (!_state.isDark) {
		drawPic(getCurRoom().curPicture);
		drawItems();
	}

	_display->updateHiResScreen();
	_messageDelay = false;
	printString(_roomData.description);
	_messageDelay = true;
}
Example #9
0
//-------------------------------------------------------------
void Polaroidframe::draw(){
    
    drawShadow();
    drawFrames();
    drawBottomBanner();
    drawPic();
    ofPushMatrix();
    ofTranslate(pos);
    ofRotateZ(angle);
    ofSetColor(color);
    ofRect(frame);
    ofPopMatrix();
    animation();
    
}
Example #10
0
void AdlEngine_v2::showRoom() {
	bool redrawPic = false;

	_state.curPicture = getCurRoom().curPicture;

	if (_state.room != _roomOnScreen) {
		loadRoom(_state.room);
		clearScreen();

		if (!_state.isDark)
			redrawPic = true;
	} else {
		if (_state.curPicture != _picOnScreen || _itemRemoved)
			redrawPic = true;
	}

	if (redrawPic) {
		_roomOnScreen = _state.room;
		_picOnScreen = _state.curPicture;

		drawPic(_state.curPicture);
		_itemRemoved = false;
		_itemsOnScreen = 0;

		Common::List<Item>::iterator item;
		for (item = _state.items.begin(); item != _state.items.end(); ++item)
			item->isOnScreen = false;
	}

	if (!_state.isDark)
		drawItems();

	_display->updateHiResScreen();
	printString(_roomData.description);

	// FIXME: move to main loop?
	_linesPrinted = 0;
}
Example #11
0
void Troll::pickupTreasure(int treasureId) {
    char tmp[40];

    _inventory[IDI_TRO_MAX_TREASURE - _treasuresLeft] = treasureId;

    if (_currentRoom != 24) {
        _vm->clearTextArea();
        drawPic(_currentRoom, false, true);
        _vm->_gfx->doUpdate();
    }

    printUserMessage(treasureId + 16);

    _vm->clearTextArea();

    _treasuresLeft--;

    switch (_treasuresLeft) {
    case 1:
        _vm->drawStr(22, 1, kColorDefault, IDS_TRO_TREASURE_7);
        break;
    case 0:
        _vm->drawStr(22, 1, kColorDefault, IDS_TRO_TREASURE_8);
        _vm->drawStr(23, 4, kColorDefault, IDS_TRO_TREASURE_9);

        _roomStates[6] = 1;

        _locMessagesIdx[6] = IDO_TRO_ALLTREASURES;
        break;
    default:
        sprintf(tmp, IDS_TRO_TREASURE_3, _treasuresLeft);
        _vm->drawStr(22, 1, kColorDefault, tmp);
        break;
    }

    pressAnyKey();
}
Example #12
0
void	PuzzleWin::mainDraw()
{
  PuzzleGame	*game;
  std::string	titlePic("Choose your Picture");
  std::string	titleDiff("Choose your Difficulty");
  sf::Event	event;
  sf::Event	last;
  bool		isIn = true;
  std::list<sf::Sprite*>	spr;

  getWindow().clear();
  if (getPicSet() == false)
    {
      drawTitle(titlePic);
      getWindow().display();
      setPicSet(true);
      loadPic(spr);
      getWindow().display();
      sleep(1);
      while (isIn == true)
	{
	  getWindow().pollEvent(event);
	  if (event.type != 15 && event.type != 10)
	    isIn = gestEvent(event);
	  if (event.type != 10 && last.type == 10)
	    isIn = gestMove(last);
	  last = event;
	  drawTitle(titlePic);
	  drawPic(spr);
	  getWindow().display();
	  usleep(40000);
	}

    }
  else if (getDiffSet() == false)
    {
      drawTitle(titleDiff);
      getWindow().display();
      drawDiff();
      setDiffSet(true);
      while (isIn == true)
	{
	  getWindow().pollEvent(event);
	  if (event.type != 15 && event.type != 10)
	    isIn = gestEvent(event);
	  if (event.type != 10 && last.type == 10)
	    isIn = gestMove(last);
	  last = event;
	  drawTitle(titleDiff);
	  getWindow().display();
	  usleep(40000);
	}
      this->setType(GAME);  
    }
  else
    {
      game = new PuzzleGame(getWindow());
      game->mainGame(_pic, _diff);
      setPicSet(false);
      setDiffSet(false);
      this->setType(GAME);
    }
}