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 */
22
23 #include "common/textconsole.h"
24
25 #include "gob/gob.h"
26
27 #include "gob/pregob/onceupon/abracadabra.h"
28
29 static const uint8 kCopyProtectionColors[7] = {
30 14, 11, 13, 1, 7, 12, 2
31 };
32
33 static const uint8 kCopyProtectionShapes[7 * 20] = {
34 3, 4, 3, 0, 1, 2, 0, 2, 2, 0, 2, 4, 0, 3, 4, 1, 1, 4, 1, 3,
35 0, 2, 0, 4, 2, 4, 4, 2, 3, 0, 1, 1, 1, 1, 3, 0, 4, 2, 3, 4,
36 0, 0, 1, 2, 1, 1, 2, 4, 3, 1, 4, 2, 4, 4, 2, 4, 1, 2, 3, 3,
37 1, 0, 2, 3, 4, 2, 3, 2, 2, 0, 0, 0, 4, 2, 3, 4, 4, 0, 4, 1,
38 4, 2, 1, 1, 1, 1, 4, 3, 4, 2, 3, 0, 0, 3, 0, 2, 3, 0, 2, 4,
39 4, 2, 4, 3, 0, 4, 0, 2, 3, 1, 4, 1, 3, 1, 0, 0, 2, 1, 3, 2,
40 3, 1, 0, 3, 1, 3, 4, 2, 4, 4, 3, 2, 0, 2, 0, 1, 2, 0, 1, 4
41 };
42
43 static const uint8 kCopyProtectionObfuscate[4] = {
44 1, 0, 2, 3
45 };
46
47 namespace Gob {
48
49 namespace OnceUpon {
50
51 const OnceUpon::MenuButton Abracadabra::kAnimalsButtons = {
52 true, 131, 127, 183, 164, 193, 0, 243, 35, 132, 128, 0
53 };
54
55 const OnceUpon::MenuButton Abracadabra::kAnimalButtons[] = {
56 {false, 37, 89, 95, 127, 37, 89, 95, 127, 131, 25, 0},
57 {false, 114, 65, 172, 111, 114, 65, 172, 111, 131, 25, 1},
58 {false, 186, 72, 227, 96, 186, 72, 227, 96, 139, 25, 2},
59 {false, 249, 87, 282, 112, 249, 87, 282, 112, 143, 25, 3},
60 {false, 180, 102, 234, 138, 180, 102, 234, 138, 133, 25, 4},
61 {false, 197, 145, 242, 173, 197, 145, 242, 173, 137, 25, 5},
62 {false, 113, 151, 171, 176, 113, 151, 171, 176, 131, 25, 6},
63 {false, 114, 122, 151, 150, 114, 122, 151, 150, 141, 25, 7},
64 {false, 36, 136, 94, 176, 36, 136, 94, 176, 131, 25, 8},
65 {false, 243, 123, 295, 155, 243, 123, 295, 155, 136, 25, 9}
66 };
67
68 const char *Abracadabra::kAnimalNames[] = {
69 "loup",
70 "drag",
71 "arai",
72 "crap",
73 "crab",
74 "mous",
75 "saut",
76 "guep",
77 "rhin",
78 "scor"
79 };
80
81 // The houses where the stork can drop a bundle
82 const OnceUpon::MenuButton Abracadabra::kStorkHouses[] = {
83 {false, 16, 80, 87, 125, 0, 0, 0, 0, 0, 0, 0}, // Castle , Lord & Lady
84 {false, 61, 123, 96, 149, 0, 0, 0, 0, 0, 0, 1}, // Cottage, Farmers
85 {false, 199, 118, 226, 137, 0, 0, 0, 0, 0, 0, 2}, // Hut , Woodcutters
86 {false, 229, 91, 304, 188, 0, 0, 0, 0, 0, 0, 3} // Palace , King & Queen
87 };
88
89 // The stork bundle drop parameters
90 const Stork::BundleDrop Abracadabra::kStorkBundleDrops[] = {
91 { 14, 65, 127, true },
92 { 14, 76, 152, true },
93 { 14, 204, 137, true },
94 { 11, 275, 179, false }
95 };
96
97 // Parameters for the stork section.
98 const OnceUpon::StorkParam Abracadabra::kStorkParam = {
99 "present.cmp", ARRAYSIZE(kStorkHouses), kStorkHouses, kStorkBundleDrops
100 };
101
102
Abracadabra(GobEngine * vm)103 Abracadabra::Abracadabra(GobEngine *vm) : OnceUpon(vm) {
104 }
105
~Abracadabra()106 Abracadabra::~Abracadabra() {
107 }
108
run()109 void Abracadabra::run() {
110 init();
111
112 // Copy protection
113 bool correctCP = doCopyProtection(kCopyProtectionColors, kCopyProtectionShapes, kCopyProtectionObfuscate);
114 if (_vm->shouldQuit() || !correctCP)
115 return;
116
117 // Show the intro
118 showIntro();
119 if (_vm->shouldQuit())
120 return;
121
122 // Handle the start menu
123 doStartMenu(&kAnimalsButtons, ARRAYSIZE(kAnimalButtons), kAnimalButtons, kAnimalNames);
124 if (_vm->shouldQuit())
125 return;
126
127 // Play the actual game
128 playGame();
129 }
130
getStorkParameters() const131 const OnceUpon::StorkParam &Abracadabra::getStorkParameters() const {
132 return kStorkParam;
133 }
134
135 } // End of namespace OnceUpon
136
137 } // End of namespace Gob
138