aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui/kia_section_pogo.cpp
blob: 037cea957c799a9f296219f6b589a53769c838f6 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* 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 "bladerunner/ui/kia_section_pogo.h"

#include "bladerunner/audio_player.h"
#include "bladerunner/bladerunner.h"
#include "bladerunner/font.h"
#include "bladerunner/game_info.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/time.h"

namespace BladeRunner {

const int KIASectionPogo::kTextColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };

const char *KIASectionPogo::kStrings[] = {
	"Air Conditioning",
	"Amy Shoopman",
	"Andy B. and the Milk Carton Kids",
	"Area 51",
	"Aspirin",
	"Babylon 5",
	"Bandit",
	"Bauer Inline Skates",
	"Bill Randolph",
	"Bill (Mr. Motorola) and Sarah",
	"Boo Berry and Frankenberry",
	"Brett W. Sperry",
	"Brianhead Ski Resort",
	"\"Bubba\"",
	"Bubbles",
	"Building 2 Parking",
	"The Buke",
	"Chan \"The Emporer\" Lee",
	"Cheezy Poofs",
	"Chuck \"Walter\" Karras",
	"Cinco De Mayo",
	"Club Med",
	"Code Complete",
	"Coffee Pub, Las Vegas",
	"Coke",
	"Coin Magic",
	"Count Chocula",
	"Dad",
	"David Arkenstone",
	"Digital Camera",
	"Direct X Team",
	"Denis and Joanne Dyack",
	"Blue Bayou, Disneyland",
	"Dongle-Boy",
	"Doves and Sparrows",
	"Dovey",
	"Draracles",
	"Dry Air",
	"Ed Del Castillo",
	"Eric \"Kick Ass\" Cartman",
	"FHM",
	"Fog City Diner",
	"Fog Studios",
	"Gatorade",
	"Gandhi Cuisine of India",
	"Giant Lava Lamp",
	"Eric and Nancy Gooch",
	"Grayford Family",
	"Comet Hale-Bopp",
	"Joseph B. Hewitt IV",
	"Hercules",
	"Hillbilly Jeopardy",
	"Home Cookin'",
	"Hooey Stick",
	"The Hypnotist",
	"Insects on the Move",
	"Intel",
	"James Hong",
	"Jasmine",
	"The Mysterious Cockatiel",
	"Joe's Frog",
	"\"Jed\"",
	"Jeeps",
	"\"Jeeter\"",
	"Jeff Brown",
	"JoeB",
	"\"Joe-Bob McClintock\"",
	"Joseph Turkel",
	"Jose Cuervo",
	"Juggling Balls",
	"Keith Parkinson",
	"Khan",
	"King of the Hill",
	"Kurt O. and the Toothbrush Squad",
	"Leonard and Shirley Legg",
	"\"Leroy\"",
	"Brion James",
	"Louis and his \"friend\"",
	"M.C. Crammer and Janie",
	"Men's Room Magna-Doodle",
	"Mark and Deepti Rowland",
	"Metro Pizza, Las Vegas",
	"Matt Vella",
	"Maui",
	"1 Million Candlepower Spotlight",
	"Mom",
	"Movie-makers",
	"Mr. Nonsense",
	"\"Needles\"",
	"Nerf Weaponry",
	"Nimbus",
	"Norm Vordahl",
	"KNPR",
	"Olive Garden",
	"Onkyo",
	"Orangey",
	"Osbur, the Human Resource Manager",
	"Our Cheery Friend Leary",
	"Ousted Gnome King",
	"Pepsi",
	"Peta Wilson",
	"Pogo the Mockingbird",
	"Poker Nights",
	"Pirates",
	"Playmate Lingerie Calendar",
	"Pop-Ice",
	"Powerhouse Gym",
	"Rade McDowell",
	"Red Rock Canyon",
	"Refrigeration",
	"Rhoda",
	"Richard and Kimberly Weier",
	"Ridley Scott",
	"Ruud the Dude",
	"Our old pal Rick Parks",
	"Ruby's Diner",
	"Savatage",
	"Scully and Mulder",
	"Sean Young",
	"Seinfeld",
	"The Shadow",
	"\"Shakes\"",
	"Shorts",
	"Silly Putty",
	"The Simpsons",
	"Thomas Christensen",
	"We love you Steve Wetherill!!!",
	"\"Skank\"",
	"\"Slice\"",
	"SSG",
	"Steve and Anne Tall",
	"South Park",
	"Snap 'n Pops",
	"Sneaker",
	"Star Wars Trilogy",
	"Nonstop Summer Pool Parties",
	"Sunsets",
	"T-Bone and Angie",
	"T-shirts",
	"Julio Schembari, Tango Pools",
	"The Thermostat Key",
	"The Wizard",
	"Tomb Raider",
	"Tom Elmer II",
	"Tujia Linden",
	"Turbo",
	"Tweeter",
	"Twonky",
	"Ty and Judy Coon",
	"The Courtyard",
	"U.F.C.",
	"Uli Boehnke",
	"\"Virgil\"",
	"Virtual Boy",
	"Westwood Offroad Excursion Team",
	"William Sanderson",
	"Xena",
	"Zion National Park"
};

KIASectionPogo::KIASectionPogo(BladeRunnerEngine *vm) : KIASectionBase(vm) {
	_stringIndex = 0;
	_timeLast    = 0;

	for (int i = 0; i < kStringCount; ++i) {
		_strings[i] = nullptr;
	}

	for (int i = 0; i < kLineCount; ++i) {
		_lineTexts[i]    = nullptr;
		_lineTimeouts[i] = 0;
		_lineOffsets[i]  = 0;
	}
}

void KIASectionPogo::open() {
	_stringIndex = 0;
	for (int i = 0; i < kStringCount; ++i) {
		_strings[i] = kStrings[i];
	}

	for (int i = 0; i < kStringCount; ++i) {
		int j = _vm->_rnd.getRandomNumberRng(i, kStringCount - 1);
		SWAP(_strings[i], kStrings[j]);
	}

	for (int i = 0; i < kLineCount; ++i) {
		_lineTexts[i] = nullptr;
		_lineTimeouts[i] = _vm->_rnd.getRandomNumberRng(0, 63);
		_lineOffsets[i] = 0;
	}

	_timeLast = _vm->_time->currentSystem();

	_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(319), 100, 0, 0, 50, 0);
}

void KIASectionPogo::draw(Graphics::Surface &surface) {
	// Timing fixed for 60Hz by ScummVM team
	int timeNow = _vm->_time->currentSystem();
	bool updateTimeout = false;
	if (timeNow - _timeLast > 1000 / 60) {
		updateTimeout = true;
		_timeLast = timeNow;
	}

	const char *title = "We 3 coders give special thanks to:";
	_vm->_mainFont->drawColor(title, surface, 313 - _vm->_mainFont->getTextWidth(title) / 2, 143, 0x7BB8);

	int y = 158;
	for (int i = 0; i < kLineCount; ++i) {
		if (updateTimeout) {
			if (_lineTimeouts[i] > 0) {
				--_lineTimeouts[i];
			} else {
				_lineTexts[i] = _strings[_stringIndex];
				_lineTimeouts[i] = 63;
				_lineOffsets[i] = _vm->_rnd.getRandomNumberRng(0, 306 - _vm->_mainFont->getTextWidth(_lineTexts[i])) + 155;

				_stringIndex = (_stringIndex + 1) % kStringCount;
			}
		}

		if (_lineTexts[i]) {
			int colorIndex = _lineTimeouts[i];
			if (colorIndex >= 32) {
				colorIndex = 63 - colorIndex;
			}
			colorIndex /= 2;
			_vm->_mainFont->drawColor(_lineTexts[i], surface, _lineOffsets[i], y, kTextColors[colorIndex]);
		}
		y += 10;
	}
}

} // End of namespace BladeRunner