aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/swordsofxeen/swordsofxeen.cpp
blob: 386136770ad1b47beba4916a7b43149c9911a0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#include "xeen/swordsofxeen/swordsofxeen.h"

namespace Xeen {
namespace SwordsOfXeen {

SwordsOfXeenEngine::SwordsOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
		: XeenEngine(syst, gameDesc) {
}

void SwordsOfXeenEngine::showMainMenu() {
	// TODO: Implement Swords of Xeen main menu. For now, skip to playing game
	_saves->newGame();
	_gameMode = GMODE_PLAY_GAME;
}

void SwordsOfXeenEngine::death() {
	Windows &windows = *g_vm->_windows;

	_screen->loadBackground("blank.raw");
	windows[28].setBounds(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
	_screen->fadeIn(0x81);
	_screen->loadPalette("scr.pal");
	_screen->fadeIn(0x81);

	SpriteResource lose("lose.int");
	lose.draw(0, 0, Common::Point(0, 0));
	lose.draw(0, 1, Common::Point(160, 0));
	_sound->playSound("laff1.voc");

	bool breakFlag = false;
	for (int idx = 0, idx2 = 0; idx < (_files->_isDarkCc ? 10 : 23); ++idx) {
		_events->updateGameCounter();

		if (_files->_isDarkCc) {
			breakFlag = _events->wait(2);
		} else {
			if (idx == 1 || idx == 11)
				_sound->playFX(33);
			breakFlag = _events->wait(2);

			if (idx == 15)
				_sound->playFX(34);
		}

		if ((_files->_isDarkCc ? 9 : 10) == idx) {
			if ((_files->_isDarkCc ? 2 : 1) > idx2) {
				// Restart loop
				idx = -1;
				++idx2;
			}
		}
	}

	// Wait for press
	if (!breakFlag)
		_events->waitForPress();

	_screen->fadeOut(4);
	_screen->loadBackground("blank.raw");
	_screen->loadPalette("dark.pal");
	_sound->stopAllAudio();
}

void SwordsOfXeenEngine::dream() {
	// Swords of Xeen doesn't have any dreams
}

void SwordsOfXeenEngine::showCutscene(const Common::String &name, int status, uint score) {
	_gameMode = GMODE_MENU;
}

} // End of namespace SwordsOfXeen
} // End of namespace Xeen