aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2018-01-29 20:32:28 +0100
committerPeter Kohaut2018-01-29 20:42:35 +0100
commita4229c93989843c17fcdef4363cdd9302f828725 (patch)
tree2a01e2ff6da1e18743ad68a99397a6505943b023 /engines/bladerunner/ui
parent0c930b06ed7030686c7774f18126b3d37a678d60 (diff)
downloadscummvm-rg350-a4229c93989843c17fcdef4363cdd9302f828725.tar.gz
scummvm-rg350-a4229c93989843c17fcdef4363cdd9302f828725.tar.bz2
scummvm-rg350-a4229c93989843c17fcdef4363cdd9302f828725.zip
BLADERUNNER: Completed KIA interface
Added Diagnostic section - small button above main buttons Added Pogo section - easter egg - write "pogo" while KIA is open Code formatting again
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r--engines/bladerunner/ui/kia.cpp7
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.cpp79
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.h14
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.cpp258
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.h18
-rw-r--r--engines/bladerunner/ui/kia_shapes.h4
-rw-r--r--engines/bladerunner/ui/ui_check_box.h4
-rw-r--r--engines/bladerunner/ui/ui_component.h3
-rw-r--r--engines/bladerunner/ui/ui_container.h4
-rw-r--r--engines/bladerunner/ui/ui_image_picker.cpp3
-rw-r--r--engines/bladerunner/ui/ui_input_box.cpp3
-rw-r--r--engines/bladerunner/ui/ui_input_box.h4
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.h4
-rw-r--r--engines/bladerunner/ui/ui_slider.h4
14 files changed, 379 insertions, 30 deletions
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 7e08a148fb..24316aa53e 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -195,8 +195,7 @@ void KIA::tick() {
} else {
if (_playerVqaFrame > 0) {
int newVqaFrame = MAX(_playerVqaFrame - timeDiffDiv48, 0);
- if (_playerVqaFrame >= 8 && newVqaFrame < 8)
- {
+ if (_playerVqaFrame >= 8 && newVqaFrame < 8) {
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(496), 100, 70, 70, 50, 0);
}
_playerVqaFrame = newVqaFrame;
@@ -1222,8 +1221,8 @@ void KIA::playTransitionSound(int transitionId) {
void KIA::playPrivateAddon() {
playerReset();
playSliceModel(524);
- playActorDialogue(14, 2060);
- playActorDialogue(14, 2070);
+ playActorDialogue(kActorBulletBob, 2060);
+ playActorDialogue(kActorBulletBob, 2070);
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.cpp b/engines/bladerunner/ui/kia_section_diagnostic.cpp
new file mode 100644
index 0000000000..d4ccc32433
--- /dev/null
+++ b/engines/bladerunner/ui/kia_section_diagnostic.cpp
@@ -0,0 +1,79 @@
+/* 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_diagnostic.h"
+
+#include "bladerunner/bladerunner.h"
+#include "bladerunner/font.h"
+#include "bladerunner/game_constants.h"
+#include "bladerunner/text_resource.h"
+#include "bladerunner/ui/kia.h"
+
+namespace BladeRunner {
+
+const int KIASectionDiagnostic::kTextColors[] = { 0x0000, 0x0821, 0x1061, 0x1C82, 0x24C2, 0x2CE3, 0x3524, 0x4145, 0x4586, 0x4DC7, 0x5609, 0x5E4B, 0x668C, 0x6EEE, 0x7730, 0x7B92 };
+
+KIASectionDiagnostic::KIASectionDiagnostic(BladeRunnerEngine *vm) : KIASectionBase(vm) {}
+
+void KIASectionDiagnostic::open() {
+ _text = new TextResource(_vm);
+ _text->open("KIACRED");
+ _vm->_kia->playActorDialogue(kActorRunciter, 140);
+ _offset = 0;
+ _timeLast = _vm->getTotalPlayTime();
+}
+
+void KIASectionDiagnostic::close() {
+ delete _text;
+}
+
+void KIASectionDiagnostic::draw(Graphics::Surface &surface) {
+ int timeNow = _vm->getTotalPlayTime();
+
+ for (int i = 0; i < _text->getCount(); ++i) {
+ int y = kLineHeight * i + 366 - _offset;
+ if (y >= 150 && y < 366) {
+ int colorIndex = 15;
+ if (y < 182) {
+ colorIndex = (y - 150) / 2;
+ } else if (y >= 334) {
+ colorIndex = (365 - y) / 2;
+ }
+
+ const char *text = _text->getText(i);
+ if (text) {
+ _vm->_mainFont->drawColor(text, surface, 320 - _vm->_mainFont->getTextWidth(text) / 2, y, kTextColors[colorIndex]);
+ }
+ }
+ }
+
+ // Timing fixed for 60Hz by ScummVM team
+ if (timeNow - _timeLast > 1000 / 60) {
+ ++_offset;
+ if (_offset > kLineHeight * _text->getCount() + 366) {
+ _offset = 0;
+ }
+ _timeLast = timeNow;
+ }
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.h b/engines/bladerunner/ui/kia_section_diagnostic.h
index 9a5b74b8af..192de8150f 100644
--- a/engines/bladerunner/ui/kia_section_diagnostic.h
+++ b/engines/bladerunner/ui/kia_section_diagnostic.h
@@ -27,11 +27,23 @@
namespace BladeRunner {
+class TextResource;
+
class KIASectionDiagnostic : public KIASectionBase {
+ static const int kTextColors[];
+ static const int kLineHeight = 18;
+
+ TextResource *_text;
+ int _offset;
+ int _timeLast;
public:
- KIASectionDiagnostic(BladeRunnerEngine *vm) : KIASectionBase(vm){}
+ KIASectionDiagnostic(BladeRunnerEngine *vm);
+
+ void open();
+ void close();
+ void draw(Graphics::Surface &surface);
};
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/kia_section_pogo.cpp b/engines/bladerunner/ui/kia_section_pogo.cpp
new file mode 100644
index 0000000000..27cd9891c6
--- /dev/null
+++ b/engines/bladerunner/ui/kia_section_pogo.cpp
@@ -0,0 +1,258 @@
+/* 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"
+
+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) {}
+
+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->getTotalPlayTime();
+
+ _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->getTotalPlayTime();
+ 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
diff --git a/engines/bladerunner/ui/kia_section_pogo.h b/engines/bladerunner/ui/kia_section_pogo.h
index d2a2edd859..122a729752 100644
--- a/engines/bladerunner/ui/kia_section_pogo.h
+++ b/engines/bladerunner/ui/kia_section_pogo.h
@@ -28,10 +28,26 @@
namespace BladeRunner {
class KIASectionPogo : public KIASectionBase {
+ static const int kStringCount = 158;
+ static const int kLineCount = 22;
+ static const char *kStrings[];
+ static const int kTextColors[];
+
+ const char *_strings[kStringCount];
+ int _stringIndex;
+
+ const char *_lineTexts[kLineCount];
+ int _lineTimeouts[kLineCount];
+ int _lineOffsets[kLineCount];
+
+ int _timeLast;
public:
- KIASectionPogo(BladeRunnerEngine *vm): KIASectionBase(vm){}
+ KIASectionPogo(BladeRunnerEngine *vm);
+
+ void open();
+ void draw(Graphics::Surface &surface);
};
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/ui/kia_shapes.h b/engines/bladerunner/ui/kia_shapes.h
index e075547542..0f36754626 100644
--- a/engines/bladerunner/ui/kia_shapes.h
+++ b/engines/bladerunner/ui/kia_shapes.h
@@ -31,9 +31,7 @@ namespace BladeRunner {
class BladeRunnerEngine;
-class KIAShapes
-{
-private:
+class KIAShapes {
static const int kShapeCount = 132;
BladeRunnerEngine *_vm;
diff --git a/engines/bladerunner/ui/ui_check_box.h b/engines/bladerunner/ui/ui_check_box.h
index cfd584b09e..01ee555148 100644
--- a/engines/bladerunner/ui/ui_check_box.h
+++ b/engines/bladerunner/ui/ui_check_box.h
@@ -29,9 +29,7 @@
namespace BladeRunner {
-class UICheckBox : public UIComponent
-{
-private:
+class UICheckBox : public UIComponent {
UIComponentCallback *_valueChangedCallback;
void *_callbackData;
diff --git a/engines/bladerunner/ui/ui_component.h b/engines/bladerunner/ui/ui_component.h
index 9c290d9dcb..c3a8c21b21 100644
--- a/engines/bladerunner/ui/ui_component.h
+++ b/engines/bladerunner/ui/ui_component.h
@@ -37,8 +37,7 @@ class BladeRunnerEngine;
typedef void UIComponentCallback(void *callbackData, void *source);
-class UIComponent
-{
+class UIComponent {
protected:
BladeRunnerEngine *_vm;
diff --git a/engines/bladerunner/ui/ui_container.h b/engines/bladerunner/ui/ui_container.h
index 9d5bded960..8e49d36dda 100644
--- a/engines/bladerunner/ui/ui_container.h
+++ b/engines/bladerunner/ui/ui_container.h
@@ -31,9 +31,7 @@ namespace BladeRunner {
class UIComponent;
-class UIContainer : public UIComponent
-{
-private:
+class UIContainer : public UIComponent {
Common::Array<UIComponent*> _components;
public:
diff --git a/engines/bladerunner/ui/ui_image_picker.cpp b/engines/bladerunner/ui/ui_image_picker.cpp
index 997ff7bc5e..6c46880e02 100644
--- a/engines/bladerunner/ui/ui_image_picker.cpp
+++ b/engines/bladerunner/ui/ui_image_picker.cpp
@@ -154,8 +154,7 @@ void UIImagePicker::activate(UIImagePickerCallback *mouseInCallback,
UIImagePickerCallback *mouseOutCallback,
UIImagePickerCallback *mouseDownCallback,
UIImagePickerCallback *mouseUpCallback,
- void *callbackData)
-{
+ void *callbackData) {
_isButtonDown = false;
_mouseInCallback = mouseInCallback;
_mouseOutCallback = mouseOutCallback;
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index 0b067f6608..fb46ec8d34 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -97,8 +97,7 @@ void UIInputBox::handleKeyUp(const Common::KeyState &kbd) {
}
}
-bool UIInputBox::charIsValid(const Common::KeyState &kbd)
-{
+bool UIInputBox::charIsValid(const Common::KeyState &kbd) {
return kbd.ascii >= ' '
&& kbd.ascii != '<'
&& kbd.ascii != '>'
diff --git a/engines/bladerunner/ui/ui_input_box.h b/engines/bladerunner/ui/ui_input_box.h
index 473fe175df..4dfe0785fc 100644
--- a/engines/bladerunner/ui/ui_input_box.h
+++ b/engines/bladerunner/ui/ui_input_box.h
@@ -30,9 +30,7 @@
namespace BladeRunner {
-class UIInputBox : public UIComponent
-{
-private:
+class UIInputBox : public UIComponent {
UIComponentCallback *_valueChangedCallback;
void *_callbackData;
diff --git a/engines/bladerunner/ui/ui_scroll_box.h b/engines/bladerunner/ui/ui_scroll_box.h
index 1f416baffc..da4c574c87 100644
--- a/engines/bladerunner/ui/ui_scroll_box.h
+++ b/engines/bladerunner/ui/ui_scroll_box.h
@@ -33,9 +33,7 @@ namespace BladeRunner {
typedef void UIScrollBoxCallback(void *callbackData, void *source, int lineData, int mouseButton);
-class UIScrollBox : public UIComponent
-{
-private:
+class UIScrollBox : public UIComponent {
static const int kLineHeight = 10;
static const int k3DFrameColors[];
static const int kTextBackgroundColors[];
diff --git a/engines/bladerunner/ui/ui_slider.h b/engines/bladerunner/ui/ui_slider.h
index 7cbd5bfda7..2783cb03f1 100644
--- a/engines/bladerunner/ui/ui_slider.h
+++ b/engines/bladerunner/ui/ui_slider.h
@@ -29,9 +29,7 @@
namespace BladeRunner {
-class UISlider : public UIComponent
-{
-private:
+class UISlider : public UIComponent {
static const uint16 kColors[];
UIComponentCallback *_valueChangedCallback;