1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 * Copyright 2020 Google
22 *
23 */
24 #include "hadesch/hadesch.h"
25 #include "hadesch/video.h"
26
27 namespace Hadesch {
28 static const char *kNewButton = "newbutton";
29 static const char *kRestoreButton = "restorebutton";
30 static const char *kQuitButton = "quitbutton";
31
32 enum {
33 kBackgroundZ = 10000,
34 kWaterFallZ = 9000,
35 kButtonZ = 2101,
36 kLogoZ = 1101
37 };
38
39 class OlympusHandler : public Handler {
40 public:
handleClick(const Common::String & hotname)41 void handleClick(const Common::String &hotname) override {
42 if (hotname == "new") {
43 g_vm->newGame();
44 return;
45 }
46
47 if (hotname == "restore") {
48 g_vm->enterOptions();
49 return;
50 }
51
52 if (hotname == "quit") {
53 g_vm->quit();
54 return;
55 }
56 }
handleMouseOver(const Common::String & name)57 void handleMouseOver(const Common::String &name) override {
58 Common::SharedPtr<VideoRoom> room = g_vm->getVideoRoom();
59 if (name == "new") {
60 room->selectFrame(kNewButton, kButtonZ, 6);
61 return;
62 }
63 if (name == "restore") {
64 room->selectFrame(kRestoreButton, kButtonZ, 6);
65 return;
66 }
67 if (name == "quit") {
68 room->selectFrame(kQuitButton, kButtonZ, 6);
69 return;
70 }
71 }
handleMouseOut(const Common::String & name)72 void handleMouseOut(const Common::String &name) override {
73 Common::SharedPtr<VideoRoom> room = g_vm->getVideoRoom();
74 if (name == "new") {
75 room->selectFrame(kNewButton, kButtonZ, 5);
76 return;
77 }
78 if (name == "restore") {
79 room->selectFrame(kRestoreButton, kButtonZ, 5);
80 return;
81 }
82 if (name == "quit") {
83 room->selectFrame(kQuitButton, kButtonZ, 5);
84 return;
85 }
86 }
handleEvent(int eventId)87 void handleEvent(int eventId) override {
88 Common::SharedPtr<VideoRoom> room = g_vm->getVideoRoom();
89 switch (eventId) {
90 case 21001:
91 room->playSFX("o1010ea0");
92 break;
93 case 21002:
94 room->enableMouse();
95 room->selectFrame("logo", kLogoZ, 0);
96 room->playAnimLoop("waterfall1", kWaterFallZ);
97 room->playAnimLoop("waterfall2", kWaterFallZ);
98 room->playAnimLoop("waterfall3", kWaterFallZ);
99 room->playAnimLoop("waterfall4", kWaterFallZ);
100 room->playAnim(kNewButton, kButtonZ, PlayAnimParams::keepLastFrame().partial(0, 5));
101 room->playAnim(kQuitButton, kButtonZ, PlayAnimParams::keepLastFrame().partial(0, 5));
102 if (g_vm->hasAnySaves())
103 room->playAnim(kRestoreButton, kButtonZ, PlayAnimParams::keepLastFrame().partial(0, 5));
104 else
105 room->disableHotzone("restore");
106 break;
107 }
108 }
109
~OlympusHandler()110 ~OlympusHandler() override {}
111
prepareRoom()112 void prepareRoom() override {
113 Common::SharedPtr<VideoRoom> room = g_vm->getVideoRoom();
114 room->loadHotZones("Olympus.HOT");
115 room->addStaticLayer("background", kBackgroundZ);
116 room->disableMouse();
117 if (g_vm->getPreviousRoomId() == kOptionsRoom) {
118 room->playSFX("o1010ea0", 21002);
119 } else {
120 room->playVideo("movie", 201, 21002);
121 g_vm->addTimer(21001, 40000);
122 }
123 room->disableHeroBelt();
124 }
125 };
126
makeOlympusHandler()127 Common::SharedPtr<Hadesch::Handler> makeOlympusHandler() {
128 return Common::SharedPtr<Hadesch::Handler>(new OlympusHandler());
129 }
130
131 }
132