diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 336 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.h | 51 |
2 files changed, 207 insertions, 180 deletions
diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 57c15a2b8f..a577483463 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -25,6 +25,8 @@ * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. */ +#include "avalanche/avalanche.h" + #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" #include "avalanche/logger2.h" @@ -41,211 +43,203 @@ namespace Avalanche { - namespace Scrolls { +const int16 Scrolls::roman = 0; +const int16 Scrolls::italic = 1; - const int16 roman = 0; - const int16 italic = 1; +const int16 Scrolls::halficonwidth = 19; /* Half the width of an icon. */ - const int16 halficonwidth = 19; /* Half the width of an icon. */ - int16 dix, diy; - Gyro::raw ch[2]; - byte cfont; /* Current font */ - int16 dodgex, dodgey; - byte param; /* For using arguments code */ +Scrolls::Scrolls() : aboutscroll(false) { +} - byte use_icon; +void Scrolls::setParent(AvalancheEngine *vm) { + _vm = vm; +} - void initialize_scrolls() { - warning("STUB: Scrolls::initialize_scrolls()"); - } +void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ + byte page_; - void state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - - if (Gyro::ledstatus == x) return; /* Already like that! */ - - warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); - //switch (x) { - //case 0: - // setfillstyle(1, black); - // break; /* Off */ - //case 1: - // setfillstyle(9, green); - // break; /* Half-on (menus) */ - //case 2: - // setfillstyle(1, green); - // break; /* On (kbd) */ - //case 3: - // setfillstyle(6, green); - // break; /* Hit a key */ - //} - - Gyro::super_off(); - - /* for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - bar(419, 195, 438, 197); - }*/ - - Gyro::super_on(); - Gyro::ledstatus = x; - } + if (_vm->_gyro.ledstatus == x) return; /* Already like that! */ - void easteregg() { - uint16 fv, ff; + warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); + //switch (x) { + //case 0: + // setfillstyle(1, black); + // break; /* Off */ + //case 1: + // setfillstyle(9, green); + // break; /* Half-on (menus) */ + //case 2: + // setfillstyle(1, green); + // break; /* On (kbd) */ + //case 3: + // setfillstyle(6, green); + // break; /* Hit a key */ + //} - warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); + _vm->_gyro.super_off(); - /* background(15); - for (fv = 4; fv <= 100; fv ++) - for (ff = 0; ff <= 70; ff ++) { - sound(fv * 100 + ff * 10); - delay(1); - } - nosound; - setcolor(10); - settextstyle(0, 0, 3); - settextjustify(1, 1); - outtextxy(320, 100, "GIED"); - settextstyle(0, 0, 1); - settextjustify(0, 2);*/ - - Gyro::background(0); - } + /* for (page_ = 0; page_ <= 1; page_ ++) { + setactivepage(page_); + bar(419, 195, 438, 197); + }*/ - void say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ - const int16 locol = 2; - byte xx, yy, ox, bit, lz, t; - int16 yp; - bool offset; - byte itw[12][80]; - - offset = x % 8 == 4; - x = x / 8; - lz = z.size(); - ox = 0; - Logger::log_scrollline(); - - for (xx = 1; xx <= lz; xx ++) { - switch (z[xx]) { - case '\22': { - cfont = roman; - Logger::log_roman(); - } - break; - case '\6': { - cfont = italic; - Logger::log_italic(); - } - break; - default: { - ox += 1; - for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; - Logger::log_scrollchar(Common::String(z[xx])); - } - } + _vm->_gyro.super_on(); + _vm->_gyro.ledstatus = x; +} + +void Scrolls::easteregg() { + uint16 fv, ff; + + warning("STUB: Scrolls::easteregg(). Calls of Pascal units need to be removed."); + + /* background(15); + for (fv = 4; fv <= 100; fv ++) + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } + nosound; + setcolor(10); + settextstyle(0, 0, 3); + settextjustify(1, 1); + outtextxy(320, 100, "GIED"); + settextstyle(0, 0, 1); + settextjustify(0, 2);*/ + + _vm->_gyro.background(0); +} + +void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwriting */ + const int16 locol = 2; + byte xx, yy, ox, bit, lz, t; + int16 yp; + bool offset; + byte itw[12][80]; + + offset = x % 8 == 4; + x = x / 8; + lz = z.size(); + ox = 0; + _vm->_logger.log_scrollline(); + + for (xx = 1; xx <= lz; xx ++) { + switch (z[xx]) { + case '\22': { + cfont = roman; + _vm->_logger.log_roman(); + } + break; + case '\6': { + cfont = italic; + _vm->_logger.log_italic(); + } + break; + default: { + ox += 1; + for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1]; + _vm->_logger.log_scrollchar(Common::String(z[xx])); + } } + } - lz = ox; - if (offset) { - /* offsetting routine */ - lz += 1; - for (yy = 1; yy <= 12; yy ++) { - bit = 240; - itw[yy][lz] = 255; - for (xx = 1; xx <= lz; xx ++) { - t = itw[yy][xx]; - itw[yy][xx] = bit + t / 16; - bit = t << 4; - } + lz = ox; + if (offset) { + /* offsetting routine */ + lz += 1; + for (yy = 1; yy <= 12; yy ++) { + bit = 240; + itw[yy][lz] = 255; + for (xx = 1; xx <= lz; xx ++) { + t = itw[yy][xx]; + itw[yy][xx] = bit + t / 16; + bit = t << 4; } } - yp = x + y * 80 + (1 - Gyro::cp) * Gyro::pagetop; - for (yy = 1; yy <= 12; yy ++) { - yp += 80; - for (bit = 0; bit <= locol; bit ++) { - /*port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - move(itw[yy], mem[0xa000 * yp], lz); + } + yp = x + y * 80 + (1 - _vm->_gyro.cp) * _vm->_gyro.pagetop; + for (yy = 1; yy <= 12; yy ++) { + yp += 80; + for (bit = 0; bit <= locol; bit ++) { + /*port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + move(itw[yy], mem[0xa000 * yp], lz); - Some old Pascal-ish. To be removed. */ + Some old Pascal-ish. To be removed. */ - warning("STUB: Scrolls::say()"); - } + warning("STUB: Scrolls::say()"); } - } - /* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ +} - void normscroll() { - warning("STUB: Scrolls::normscroll()"); - } +/* Here are the procedures that Scroll calls */ /* So they must be... */ /*$F+*/ - void dialogue() { - warning("STUB: Scrolls::dialogue()"); - } +void Scrolls::normscroll() { + warning("STUB: Scrolls::normscroll()"); +} - void music_scroll(); +void Scrolls::dialogue() { + warning("STUB: Scrolls::dialogue()"); +} - static void store_(byte what, Gyro::tunetype &played) { - memcpy(played, played+1, sizeof(played) - 1); - played[30] = what; - } +void Scrolls::store_(byte what, tunetype &played) { + memcpy(played, played+1, sizeof(played) - 1); + played[30] = what; +} - static bool they_match(Gyro::tunetype &played) { - byte fv, mistakes; - bool they_match_result; - mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != Gyro::tune[fv]) { - mistakes++; - } +bool Scrolls::they_match(tunetype &played) { + byte fv, mistakes; - they_match_result = mistakes < 5; - return they_match_result; - } + bool they_match_result; + mistakes = 0; - void music_scroll() { - char r; - byte value; - - byte last_one, this_one; - - Gyro::tunetype played; - - - state(3); - Gyro::seescroll = true; - Gyro::on(); - Gyro::newpointer(4); - //do { - //do { - // Gyro::check(); /* was "checkclick;" */ - // if (Enhanced::keypressede()) break; - //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); - // - // Needs joystick - not sure it will be implemented. - - //if (Gyro::mpress == 0) { - // inkey(); Needs Lucerna to proceed. - // - //} - //} - - } + for (fv = 1; fv <= sizeof(played); fv ++) + if (played[fv] != Gyro::tune[fv]) { + mistakes++; + } + + they_match_result = mistakes < 5; + return they_match_result; +} + +void Scrolls::music_scroll() { + char r; + byte value; + + byte last_one, this_one; + + tunetype played; + + + state(3); + _vm->_gyro.seescroll = true; + _vm->_gyro.on(); + _vm->_gyro.newpointer(4); + //do { + //do { + // Gyro::check(); /* was "checkclick;" */ + // if (Enhanced::keypressede()) break; + //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); + // + // Needs joystick - not sure it will be implemented. + //if (Gyro::mpress == 0) { + // inkey(); Needs Lucerna to proceed. + // + //} + //} +} @@ -255,8 +249,6 @@ namespace Avalanche { - - } // End of namespace Scrolls } // End of namespace Avalanche diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index 07038335bd..914e463f3f 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -34,20 +34,23 @@ // #include "avalanche/joystick2.h" - Will be implemented later, if it will be implemented at all... namespace Avalanche { +class AvalancheEngine; - namespace Scrolls { +class Scrolls { +public: + bool aboutscroll; /* Is this the about box? */ - // Call it where Scrolls are first used. - // Procuded to replace the initizalization part of the original Pascal unit. - void initialize_scrolls(); - const bool aboutscroll = false; /* Is this the about box? */ + + Scrolls(); + + void setParent(AvalancheEngine *vm); void state(byte x); /* Sets "Ready" light to whatever */ - void drawscroll(Gyro::proc gotoit); /* This is one of the oldest procs in the game. */ + void drawscroll(proc gotoit); /* This is one of the oldest procs in the game. */ - void bubble(Gyro::proc gotoit); + void bubble(proc gotoit); void resetscroll(); @@ -65,7 +68,39 @@ namespace Avalanche { void musical_scroll(); - } // End of namespace Scrolls +private: + AvalancheEngine *_vm; + + static const int16 roman; + static const int16 italic; + + static const int16 halficonwidth; /* Half the width of an icon. */ + + int16 dix, diy; + raw ch[2]; + byte cfont; /* Current font */ + + int16 dodgex, dodgey; + byte param; /* For using arguments code */ + + byte use_icon; + + void easteregg(); + + void say(int16 x, int16 y, Common::String z); + + void normscroll(); + + void dialogue(); + + void store_(byte what, tunetype &played); + + bool they_match(tunetype &played); + + void music_scroll(); + + +}; } // End of namespace Avalanche |