diff options
-rw-r--r-- | engines/avalanche/celer2.cpp | 335 | ||||
-rw-r--r-- | engines/avalanche/enid2.cpp | 34 | ||||
-rw-r--r-- | engines/avalanche/gyro2.cpp | 38 | ||||
-rw-r--r-- | engines/avalanche/logger2.cpp | 79 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 34 | ||||
-rw-r--r-- | engines/avalanche/sequence2.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/timeout2.cpp | 215 | ||||
-rw-r--r-- | engines/avalanche/trip6.cpp | 682 |
8 files changed, 696 insertions, 727 deletions
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index cec2923c7e..4296f36f70 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -53,194 +53,119 @@ void Celer::setParent(AvalancheEngine *vm) { void Celer::pics_link() { byte xx; - if (_vm->_gyro.ddmnow) return; /* No animation when the menus are up. */ - - { - switch (_vm->_gyro.dna.room) { + if (_vm->_gyro.ddmnow) + return; /* No animation when the menus are up. */ + + + switch (_vm->_gyro.dna.room) { + case r__outsideargentpub: + if ((_vm->_gyro.roomtime % int32(12)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); + break; - case r__outsideargentpub: { - if ((_vm->_gyro.roomtime % int32(12)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4)); - } + case r__brummieroad: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); break; - case r__brummieroad: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); - break; - - case r__bridge: - if ((_vm->_gyro.roomtime % int32(2)) == 0) - show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); - break; - - case r__yours: - if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) - show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); - break; + case r__bridge: + if ((_vm->_gyro.roomtime % int32(2)) == 0) + show_one(int32(4) + (_vm->_gyro.roomtime / int32(2)) % int32(4)); + break; - case r__argentpub: { - if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { - /* Malagauche cycle */ - _vm->_gyro.dna.malagauche += 1; - switch (_vm->_gyro.dna.malagauche) { - case 1: - case 11: - case 21: - show_one(12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(11); - break; /* Looks at you. */ - case 30: - show_one(13); - break; /* Winks. */ - case 33: - _vm->_gyro.dna.malagauche = 0; - break; - } - } + case r__yours: + if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0)) + show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(2)); + break; - switch (_vm->_gyro.roomtime % 200) { - case 179: - case 197: - show_one(5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(6); + case r__argentpub: + if (((_vm->_gyro.roomtime % int32(7)) == 1) && (_vm->_gyro.dna.malagauche != 177)) { + /* Malagauche cycle */ + _vm->_gyro.dna.malagauche += 1; + switch (_vm->_gyro.dna.malagauche) { + case 1: + case 11: + case 21: + show_one(12); + break; /* Looks forwards. */ + case 8: + case 18: + case 28: + case 32: + show_one(11); + break; /* Looks at you. */ + case 30: + show_one(13); + break; /* Winks. */ + case 33: + _vm->_gyro.dna.malagauche = 0; break; - case 185: - show_one(7); - break; - case 199: - _vm->_gyro.dna.dogfoodpos = 177; - break; /* Impossible value for this. */ - } - - if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ - if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 3; - else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) - xx = 2; - else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) - xx = 4; - - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; - } } - } - break; - case r__westhall: - if ((_vm->_gyro.roomtime % int32(3)) == 0) - switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { - case 4: - show_one(1); - break; - case 1: - case 3: - case 5: - show_one(2); - break; - case 0: - case 2: - show_one(3); - break; - } + switch (_vm->_gyro.roomtime % 200) { + case 179: + case 197: + show_one(5); + break; /* Dogfood's drinking cycle */ + case 182: + case 194: + show_one(6); break; - - case r__lustiesroom: - if (!(_vm->_gyro.dna.lustie_is_asleep)) { - if ((_vm->_gyro.roomtime % int32(45)) > 42) - xx = 4; /* du Lustie blinks */ - - /* Bearing of Avvy from du Lustie. */ - else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 1; /* Middle. */ - else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) - xx = 2; /* Left. */ - else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) - xx = 3; /* Right. */ - - if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - } + case 185: + show_one(7); break; + case 199: + _vm->_gyro.dna.dogfoodpos = 177; + break; /* Impossible value for this. */ + } - case r__aylesoffice: - if ((! _vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { - switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { - case 0: - show_one(1); - break; /* Frame 2: EGA. */ - case 1: - show_one(3); - break; /* Frame 1: Natural. */ - } - } - break; - - case r__robins: - if (_vm->_gyro.dna.tied_up) - switch (_vm->_gyro.roomtime % int32(54)) { - case 20: - show_one(4); - break; /* Frame 4: Avalot blinks. */ - case 23: - show_one(2); - break; /* Frame 1: Back to normal. */ - } - break; - - case r__nottspub: { - /* Bearing of Avvy from Port. */ - if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) - xx = 2; /* Middle. */ - else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro.roomtime % int32(60)) > 57) xx--; /* Blinks */ + if ((_vm->_gyro.roomtime % 200 >= 0) && (_vm->_gyro.roomtime % 200 <= 178)) { /* Normally. */ + if (((_vm->_lucerna.bearing(2) >= 1) && (_vm->_lucerna.bearing(2) <= 90)) || ((_vm->_lucerna.bearing(2) >= 358) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 3; + else if ((_vm->_lucerna.bearing(2) >= 293) && (_vm->_lucerna.bearing(2) <= 357)) + xx = 2; + else if ((_vm->_lucerna.bearing(2) >= 271) && (_vm->_lucerna.bearing(2) <= 292)) + xx = 4; if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); - _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + _vm->_gyro.dna.dogfoodpos = xx; } + } + break; - switch (_vm->_gyro.roomtime % 50) { - case 45 : - show_one(9); - break; /* Spurge blinks */ - case 49 : - show_one(10); + case r__westhall: + if ((_vm->_gyro.roomtime % int32(3)) == 0) { + switch ((_vm->_gyro.roomtime / int32(3)) % int32(6)) { + case 4: + show_one(1); + break; + case 1: + case 3: + case 5: + show_one(2); + break; + case 0: + case 2: + show_one(3); break; } } break; - case r__ducks: { - if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ - show_one(1 + (_vm->_gyro.roomtime / 3) % 3); + case r__lustiesroom: + if (!(_vm->_gyro.dna.lustie_is_asleep)) { + if ((_vm->_gyro.roomtime % int32(45)) > 42) + xx = 4; /* du Lustie blinks */ - {/* _vm->_lucerna.bearing of Avvy from Duck. */ - if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) - xx = 4; /* Middle. */ + /* Bearing of Avvy from du Lustie. */ + else if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 1; /* Middle. */ else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) - xx = 6; /* Left. */ + xx = 2; /* Left. */ else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro.roomtime % int32(45)) > 42) xx += 1; /* Duck blinks */ + xx = 3; /* Right. */ if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ show_one(xx); @@ -249,18 +174,92 @@ void Celer::pics_link() { } break; + case r__aylesoffice: + if ((!_vm->_gyro.dna.ayles_is_awake) && (_vm->_gyro.roomtime % int32(14) == 0)) { + switch ((_vm->_gyro.roomtime / int32(14)) % int32(2)) { + case 0: + show_one(1); + break; /* Frame 2: EGA. */ + case 1: + show_one(3); + break; /* Frame 1: Natural. */ + } + } + break; + + case r__robins: + if (_vm->_gyro.dna.tied_up) { + switch (_vm->_gyro.roomtime % int32(54)) { + case 20: + show_one(4); + break; /* Frame 4: Avalot blinks. */ + case 23: + show_one(2); + break; /* Frame 1: Back to normal. */ + } + } + break; + + case r__nottspub: + /* Bearing of Avvy from Port. */ + if (((_vm->_lucerna.bearing(5) >= 0) && (_vm->_lucerna.bearing(5) <= 45)) || ((_vm->_lucerna.bearing(5) >= 315) && (_vm->_lucerna.bearing(5) <= 360))) + xx = 2; /* Middle. */ + else if ((_vm->_lucerna.bearing(5) >= 45) && (_vm->_lucerna.bearing(5) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(5) >= 181) && (_vm->_lucerna.bearing(5) <= 314)) + xx = 8; /* Right. */ + + if ((_vm->_gyro.roomtime % int32(60)) > 57) + xx--; /* Blinks */ + + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + } + + switch (_vm->_gyro.roomtime % 50) { + case 45 : + show_one(9); + break; /* Spurge blinks */ + case 49 : + show_one(10); + break; + } + break; + + case r__ducks: + if ((_vm->_gyro.roomtime % 3) == 0) /* The fire flickers */ + show_one(1 + (_vm->_gyro.roomtime / 3) % 3); + + {/* _vm->_lucerna.bearing of Avvy from Duck. */ + if (((_vm->_lucerna.bearing(2) >= 0) && (_vm->_lucerna.bearing(2) <= 45)) || ((_vm->_lucerna.bearing(2) >= 315) && (_vm->_lucerna.bearing(2) <= 360))) + xx = 4; /* Middle. */ + else if ((_vm->_lucerna.bearing(2) >= 45) && (_vm->_lucerna.bearing(2) <= 180)) + xx = 6; /* Left. */ + else if ((_vm->_lucerna.bearing(2) >= 181) && (_vm->_lucerna.bearing(2) <= 314)) + xx = 8; /* Right. */ + + if ((_vm->_gyro.roomtime % int32(45)) > 42) + xx += 1; /* Duck blinks */ + + if (xx != _vm->_gyro.dna.dogfoodpos) { /* Only if it's changed.*/ + show_one(xx); + _vm->_gyro.dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ } + break; + } +} - if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) + if ((_vm->_gyro.dna.ringing_bells) && (_vm->_gyro.flagset('B'))) { /* They're ringing the bells. */ switch (_vm->_gyro.roomtime % int32(4)) { - case 1: { - if (_vm->_gyro.dna.nextbell < 5) _vm->_gyro.dna.nextbell = 12; + case 1: + if (_vm->_gyro.dna.nextbell < 5) + _vm->_gyro.dna.nextbell = 12; _vm->_gyro.dna.nextbell -= 1; _vm->_gyro.note(_vm->_gyro.notes[_vm->_gyro.dna.nextbell]); - } - break; + break; case 2: //nosound; warning("STUB: Celer::pics_link()"); diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 3abb3ba84d..f0488db78a 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -96,7 +96,7 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { day = _vm->_gyro.strf(d); - if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) + if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31))) { switch (d % 10) { case 1: day = day + "st"; @@ -110,15 +110,12 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) { default: day = day + "th"; } + } expanddate_result = day + ' ' + month + ' ' + _vm->_gyro.strf(y); return expanddate_result; } - - - - void Enid::show_bug(char icon, Common::String strn) { _vm->_scrolls.display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); } @@ -159,17 +156,10 @@ void Enid::loaderror(Common::String x, char icon) { bug = true; } - - - void Enid::edna_load(Common::String name) { warning("STUB: Enid::edna_load()"); } - - - - void Enid::showheader() { _vm->_scrolls.display(Common::String("Dir: ") + path + "\r\r\4"); } @@ -260,21 +250,17 @@ void Enid::avvy_background() { /* Not really a filing procedure, } void Enid::to_sundry(sundry &sund) { - { - sund.qenid_filename = _vm->_gyro.enid_filename; - sund.qsoundfx = _vm->_gyro.soundfx; - sund.qthinks = _vm->_gyro.thinks; - sund.qthinkthing = _vm->_gyro.thinkthing; - } + sund.qenid_filename = _vm->_gyro.enid_filename; + sund.qsoundfx = _vm->_gyro.soundfx; + sund.qthinks = _vm->_gyro.thinks; + sund.qthinkthing = _vm->_gyro.thinkthing; } void Enid::from_sundry(sundry sund) { - { - _vm->_gyro.enid_filename = sund.qenid_filename; - _vm->_gyro.soundfx = sund.qsoundfx; - _vm->_gyro.thinks = sund.qthinks; - _vm->_gyro.thinkthing = sund.qthinkthing; - } + _vm->_gyro.enid_filename = sund.qenid_filename; + _vm->_gyro.soundfx = sund.qsoundfx; + _vm->_gyro.thinks = sund.qthinks; + _vm->_gyro.thinkthing = sund.qthinkthing; } void Enid::restore_dna() { diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fd86390c04..c247012256 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -331,14 +331,17 @@ void Gyro::slowdown() { } bool Gyro::flagset(char x) { - for (uint16 i = 0; i < flags.size(); i++) + for (uint16 i = 0; i < flags.size(); i++) { if (flags[i] == x) return true; + } + return false; } void Gyro::force_numlock() { - if ((locks & num) > 0) locks -= num; + if ((locks & num) > 0) + locks -= num; } bool Gyro::pennycheck(uint16 howmuchby) { @@ -385,7 +388,8 @@ Common::String Gyro::get_thing(byte which) { case onion: if (dna.rotten_onion) get_thing_result = "rotten onion"; - else get_thing_result = things[which]; + else + get_thing_result = things[which]; break; default: get_thing_result = things[which]; @@ -412,7 +416,9 @@ char Gyro::get_thingchar(byte which) { // Keep an eye open! ^^^^ Common::String Gyro::get_better(byte which) { Common::String get_better_result; - if (which > 150) which -= 149; + if (which > 150) + which -= 149; + switch (which) { case wine: switch (dna.winestate) { @@ -431,7 +437,8 @@ Common::String Gyro::get_better(byte which) { get_better_result = "a rotten onion"; else if (dna.onion_in_vinegar) get_better_result = "a pickled onion (in the vinegar)"; - else get_better_result = better[which]; + else + get_better_result = better[which]; break; default: if ((which < numobjs) && (which > '\0')) @@ -486,7 +493,8 @@ void Gyro::background(byte x) { void Gyro::hang_around_for_a_while() { byte fv; - for (fv = 1; fv <= 28; fv ++) slowdown(); + for (fv = 1; fv <= 28; fv ++) + slowdown(); } /* Super_Off and Super_On are two very useful procedures. Super_Off switches @@ -495,19 +503,25 @@ void Gyro::hang_around_for_a_while() { void Gyro::super_off() { super_was_off = visible == m_no; - if (super_was_off) return; + if (super_was_off) + return; super_was_virtual = visible == m_virtual; - if (visible == m_virtual) off_virtual(); - else off(); + if (visible == m_virtual) + off_virtual(); + else + off(); } void Gyro::super_on() { - if ((visible != m_no) || (super_was_off)) return; + if ((visible != m_no) || (super_was_off)) + return; - if (super_was_virtual) on_virtual(); - else on(); + if (super_was_virtual) + on_virtual(); + else + on(); } bool Gyro::mouse_near_text() { diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp index e4061dadec..08981f5d20 100644 --- a/engines/avalanche/logger2.cpp +++ b/engines/avalanche/logger2.cpp @@ -82,10 +82,12 @@ void Logger::setParent(AvalancheEngine *vm) { void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); fv ++) + /*for (fv = 1; fv <= size - (x / 2); + fv ++) output << logfile << ' ';*/ } @@ -108,7 +110,8 @@ void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ void Logger::log_divider() { /* Prints the divider sign. */ byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_divider()"); @@ -122,7 +125,8 @@ void Logger::log_divider() { /* Prints the divider sign. */ } void Logger::log_command(Common::String x) { /* Prints a command */ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_command()"); @@ -133,13 +137,17 @@ void Logger::log_command(Common::String x) { /* Prints a command */ } void Logger::log_addstuff(Common::String x) { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; + scroll_line += x; } void Logger::log_scrollchar(Common::String x) { /* print one character */ Common::String z; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; + switch (x[1]) { case '`': z = quote; @@ -158,33 +166,37 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */ } void Logger::log_italic() { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_italic()"); /*if (_vm->_gyro.log_epson) - log_addstuff(italic); + log_addstuff(italic); else - log_addstuff("*");*/ + log_addstuff("*");*/ } void Logger::log_roman() { - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_roman()"); - /* if (_vm->_gyro.log_epson) - log_addstuff(italic_off); + /* if (_vm->_gyro.log_epson) + log_addstuff(italic_off); else - log_addstuff("*");*/ + log_addstuff("*");*/ } void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_epsonroman()"); - //if (_vm->_gyro.log_epson) log_addstuff(italic_off); + //if (_vm->_gyro.log_epson) + // log_addstuff(italic_off); } void Logger::log_scrollline() { /* Set up a line for the scroll driver */ @@ -200,7 +212,8 @@ void Logger::log_scrollendline(bool centred) { warning("STUB: Logger::log_scrollendline()"); - /*for (fv = 1; fv <= x; fv ++) output << logfile << ' '; + /*for (fv = 1; fv <= x; fv ++) + output << logfile << ' '; output << logfile << scroll_line << NL;*/ } @@ -211,18 +224,21 @@ void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { warning("STUB: Logger::log_bubbleline()"); /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv ++) output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; + for (fv = 1; fv <= 15; fv ++) + output << logfile << ' '; + output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; } else { - for (fv = 1; fv <= 17; fv ++) output << logfile << ' '; - output << logfile << x << NL; + for (fv = 1; fv <= 17; fv ++) + output << logfile << ' '; + output << logfile << x << NL; }*/ } void Logger::log_newline() { warning("STUB: Logger::log_newline()"); - //if (_vm->_gyro.logging) output << logfile << NL; + //if (_vm->_gyro.logging) + // output << logfile << NL; } void Logger::log_newroom(Common::String where) { @@ -231,17 +247,20 @@ void Logger::log_newroom(Common::String where) { warning("STUB: Logger::log_newroom()"); - /*for (fv = 1; fv <= 20; fv ++) output << logfile << ' '; - if (_vm->_gyro.log_epson) output << logfile << emph_on; + /*for (fv = 1; fv <= 20; fv ++) + output << logfile << ' '; + if (_vm->_gyro.log_epson) + output << logfile << emph_on; output << logfile << Common::String('(') + where + ')'; - if (_vm->_gyro.log_epson) output << logfile << emph_off; + if (_vm->_gyro.log_epson) + output << logfile << emph_off; output << logfile << NL;*/ } -void Logger::log_aside(Common::String what) +void Logger::log_aside(Common::String what) { /* This writes "asides" to the printer. For example, moves in Nim. */ -{ - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_aside()"); @@ -251,11 +270,13 @@ void Logger::log_aside(Common::String what) void Logger::log_score(uint16 credit, uint16 now) { byte fv; - if (! _vm->_gyro.logging) return; + if (! _vm->_gyro.logging) + return; warning("STUB: Logger::log_score()"); - /*for (fv = 1; fv <= 50; fv ++) output << logfile << ' '; + /*for (fv = 1; fv <= 50; fv ++) + output << logfile << ' '; output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 40084148b5..aeb952c4a5 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -62,7 +62,8 @@ void Scrolls::setParent(AvalancheEngine *vm) { void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ byte page_; - if (_vm->_gyro.ledstatus == x) return; /* Already like that! */ + if (_vm->_gyro.ledstatus == x) + return; /* Already like that! */ warning("STUB: Scrolls::state(). Calls of Pascal units need to be removed."); //switch (x) { @@ -83,8 +84,8 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ _vm->_gyro.super_off(); /* for (page_ = 0; page_ <= 1; page_ ++) { - setactivepage(page_); - bar(419, 195, 438, 197); + setactivepage(page_); + bar(419, 195, 438, 197); }*/ _vm->_gyro.super_on(); @@ -97,10 +98,11 @@ void Scrolls::easteregg() { 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); + for (fv = 4; fv <= 100; fv ++) { + for (ff = 0; ff <= 70; ff ++) { + sound(fv * 100 + ff * 10); + delay(1); + } } nosound; setcolor(10); @@ -205,9 +207,8 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; for (fv = 1; fv <= sizeof(played); fv ++) - if (played[fv] != Gyro::tune[fv]) { + if (played[fv] != Gyro::tune[fv]) mistakes++; - } they_match_result = mistakes < 5; return they_match_result; @@ -227,17 +228,16 @@ void Scrolls::music_scroll() { _vm->_gyro.on(); _vm->_gyro.newpointer(4); //do { - //do { - // Gyro::check(); /* was "checkclick;" */ - // if (Enhanced::keypressede()) break; - //} while (!(Gyro::mpress > 0) || buttona1() || buttonb1()); + // 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. - // - //} + // if (Gyro::mpress == 0) + // inkey(); Needs Lucerna to proceed. //} } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index afa74d69b4..38d46d86c9 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -92,11 +92,11 @@ void Sequence::call_sequencer() { case 0: return; break; /* No more routines. */ - case 177: { + case 177: _vm->_gyro.dna.user_moves_avvy = true; _vm->_trip.fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */ - if (seq[0] == 177) shove_left(); - } + if (seq[0] == 177) + shove_left(); break; } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index 343e896e30..6bdfcde1f8 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -60,27 +60,28 @@ void Timeout::setParent(AvalancheEngine *vm) { void Timeout::set_up_timer(int32 howlong, byte whither, byte why) { fv = 1; - while ((fv < 8) && (times[fv].time_left != 0)) fv += 1; - if (fv == 8) return; /* Oh dear... */ + while ((fv < 8) && (times[fv].time_left != 0)) + fv += 1; - { - timetype &with = times[fv]; /* Everything's OK here! */ + if (fv == 8) + return; /* Oh dear... */ - with.time_left = howlong; - with.then_where = whither; - with.what_for = why; - } + timetype &with = times[fv]; /* Everything's OK here! */ + with.time_left = howlong; + with.then_where = whither; + with.what_for = why; } void Timeout::one_tick() { - if (_vm->_gyro.ddmnow) return; + if (_vm->_gyro.ddmnow) + return; for (fv = 1; fv <= 7; fv ++) { timetype &with = times[fv]; if (with.time_left > 0) { with.time_left -= 1; - if (with.time_left == 0) + if (with.time_left == 0) { switch (with.then_where) { case procopen_drawbridge : open_drawbridge(); @@ -206,6 +207,7 @@ void Timeout::one_tick() { give_lute_to_geida(); break; } + } } } _vm->_gyro.roomtime += 1; /* Cycles since you've been in this room. */ @@ -238,28 +240,25 @@ end;*/ /* Timeout procedures: */ void Timeout::open_drawbridge() { - { - _vm->_gyro.dna.drawbridge_open ++; - _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); + _vm->_gyro.dna.drawbridge_open ++; + _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1); - if (_vm->_gyro.dna.drawbridge_open == 4) - _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ - else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); - } + if (_vm->_gyro.dna.drawbridge_open == 4) + _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */ + else + set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls); } /* --- */ void Timeout::avaricius_talks() { - { - _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); - _vm->_gyro.dna.avaricius_talk ++; - - if (_vm->_gyro.dna.avaricius_talk < 17) - set_up_timer(177, procavaricius_talks, reason_avariciustalks); - else _vm->_lucerna.points(3); + _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk); + _vm->_gyro.dna.avaricius_talk ++; - } + if (_vm->_gyro.dna.avaricius_talk < 17) + set_up_timer(177, procavaricius_talks, reason_avariciustalks); + else + _vm->_lucerna.points(3); } void Timeout::urinate() { @@ -293,16 +292,14 @@ void Timeout::stairs() { } void Timeout::cardiff_survey() { - { - switch (_vm->_gyro.dna.cardiff_things) { - case 0: { - _vm->_gyro.dna.cardiff_things += 1; - _vm->_visa.dixi('q', 27); - } + switch (_vm->_gyro.dna.cardiff_things) { + case 0: + _vm->_gyro.dna.cardiff_things += 1; + _vm->_visa.dixi('q', 27); break; - } - _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); } + _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things); + _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things; set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey); } @@ -370,23 +367,20 @@ void Timeout::jacques_wakes_up() { _vm->_gyro.dna.jacques_awake += 1; switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */ - case 1 : { + case 1 : _vm->_celer.show_one(1); /* Eyes open. */ _vm->_visa.dixi('Q', 45); - } - break; - case 2 : { /* Going through the door. */ + break; + case 2 : /* Going through the door. */ _vm->_celer.show_one(2); /* Not on the floor. */ _vm->_celer.show_one(3); /* But going through the door. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* You can't wake him up now. */ - } - break; - case 3 : { /* Gone through the door. */ + break; + case 3 : /* Gone through the door. */ _vm->_celer.show_one(2); /* Not on the floor, either. */ _vm->_celer.show_one(4); /* He's gone... so the door's open. */ _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; /* Gone! */ - } - break; + break; } @@ -409,9 +403,8 @@ void Timeout::jacques_wakes_up() { } -void Timeout::naughty_duke() +void Timeout::naughty_duke() { /* This is when the Duke comes in and takes your money. */ -{ _vm->_trip.tr[2].init(9, false, &_vm->_trip); /* Here comes the Duke. */ _vm->_trip.apped(2, 1); /* He starts at the door... */ _vm->_trip.tr[2].walkto(3); /* He walks over to you. */ @@ -438,57 +431,53 @@ void Timeout::naughty_duke3() { } void Timeout::jump() { - { - dnatype &with = _vm->_gyro.dna; - - with.jumpstatus += 1; - - { - triptype &with1 = _vm->_trip.tr[1]; - switch (with.jumpstatus) { - case 1: - case 2: - case 3: - case 5: - case 7: - case 9: - with1.y -= 1; - break; - case 12: - case 13: - case 14: - case 16: - case 18: - case 19: - with1.y += 1; - break; - } - } + dnatype &with = _vm->_gyro.dna; - if (with.jumpstatus == 20) { - /* End of jump. */ - _vm->_gyro.dna.user_moves_avvy = true; - _vm->_gyro.dna.jumpstatus = 0; - } else { - /* Still jumping. */ - set_up_timer(1, procjump, reason_jumping); - } + with.jumpstatus += 1; - if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ - && (_vm->_gyro.dna.room == r__insidecardiffcastle) - && (_vm->_gyro.dna.arrow_in_the_door == true) - && (_vm->_trip.infield(3))) { /* beside the wall*/ - /* Grab the arrow! */ - if (_vm->_gyro.dna.carrying >= maxobjs) - _vm->_scrolls.display("You fail to grab it, because your hands are full."); - else { - _vm->_celer.show_one(2); - _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ - _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; - _vm->_lucerna.objectlist(); - _vm->_visa.dixi('q', 50); - _vm->_lucerna.points(3); - } + triptype &with1 = _vm->_trip.tr[1]; + switch (with.jumpstatus) { + case 1: + case 2: + case 3: + case 5: + case 7: + case 9: + with1.y -= 1; + break; + case 12: + case 13: + case 14: + case 16: + case 18: + case 19: + with1.y += 1; + break; + } + + if (with.jumpstatus == 20) { + /* End of jump. */ + _vm->_gyro.dna.user_moves_avvy = true; + _vm->_gyro.dna.jumpstatus = 0; + } else { + /* Still jumping. */ + set_up_timer(1, procjump, reason_jumping); + } + + if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */ + && (_vm->_gyro.dna.room == r__insidecardiffcastle) + && (_vm->_gyro.dna.arrow_in_the_door == true) + && (_vm->_trip.infield(3))) { /* beside the wall*/ + /* Grab the arrow! */ + if (_vm->_gyro.dna.carrying >= maxobjs) + _vm->_scrolls.display("You fail to grab it, because your hands are full."); + else { + _vm->_celer.show_one(2); + _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */ + _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true; + _vm->_lucerna.objectlist(); + _vm->_visa.dixi('q', 50); + _vm->_lucerna.points(3); } } } @@ -549,29 +538,27 @@ void Timeout::meet_avaroid() { _vm->_visa.dixi('Q', 60); _vm->_gyro.dna.met_avaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - { - triptype &with = _vm->_trip.tr[1]; - with.face = _vm->_trip.left; - with.x = 151; - with.ix = -3; - with.iy = -5; - } + + triptype &with = _vm->_trip.tr[1]; + with.face = _vm->_trip.left; + with.x = 151; + with.ix = -3; + with.iy = -5; + _vm->_gyro.background(2); } } void Timeout::rise_up_oubliette() { - { - triptype &with = _vm->_trip.tr[1]; + triptype &with = _vm->_trip.tr[1]; - with.visible = true; - with.iy += 1; /* decrements dx/dy! */ - with.y -= with.iy; /* Uuuupppp we go... */ - if (with.iy > 0) - set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); - else - _vm->_gyro.dna.user_moves_avvy = true; - } + with.visible = true; + with.iy += 1; /* decrements dx/dy! */ + with.y -= with.iy; /* Uuuupppp we go... */ + if (with.iy > 0) + set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); + else + _vm->_gyro.dna.user_moves_avvy = true; } void Timeout::robin_hood_and_geida() { @@ -602,10 +589,9 @@ void Timeout::avalot_returns() { _vm->_gyro.dna.user_moves_avvy = true; } -void Timeout::avvy_sit_down() +void Timeout::avvy_sit_down() { /* This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. */ -{ if (_vm->_trip.tr[1].homing) /* Still walking */ set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { @@ -621,7 +607,9 @@ void Timeout::ghost_room_phew() { } void Timeout::arkata_shouts() { - if (_vm->_gyro.dna.teetotal) return; + if (_vm->_gyro.dna.teetotal) + return; + _vm->_visa.dixi('q', 76); set_up_timer(160, procarkata_shouts, reason_arkata_shouts); } @@ -629,6 +617,7 @@ void Timeout::arkata_shouts() { void Timeout::winning() { _vm->_visa.dixi('q', 79); _vm->_pingo.winning_pic(); + do { _vm->_lucerna.checkclick(); } while (!(_vm->_gyro.mrelease == 0)); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 039c7693a7..7591c5c032 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -64,9 +64,10 @@ void triptype::andexor() { } void triptype::turn(byte whichway) { - if (whichway == 8) + if (whichway == 8) face = 0; - else face = whichway; + else + face = whichway; } void triptype::appear(int16 wx, int16 wy, byte wf) { @@ -83,17 +84,20 @@ void triptype::appear(int16 wx, int16 wy, byte wf) { bool triptype::collision_check() { byte fv; - bool collision_check_result; - for (fv = 1; fv <= _tr->numtr; fv ++) + bool collision_check_result = false; + for (fv = 1; fv <= _tr->numtr; fv ++) { if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && ((x + a.xl) > _tr->tr[fv].x) && (x < (_tr->tr[fv].x + _tr->tr[fv].a.xl)) && (_tr->tr[fv].y == y)) { - collision_check_result = true; - return collision_check_result; + collision_check_result = true; + break; } + // CHECKME: Only checks the first element of the for() statement collision_check_result = false; return collision_check_result; + } + return collision_check_result; } void triptype::walk() { @@ -103,8 +107,10 @@ void triptype::walk() { void triptype::bounce() { x = ox[_tr->_vm->_gyro.cp]; y = oy[_tr->_vm->_gyro.cp]; - if (check_me) _tr->stopwalking(); - else stopwalk(); + if (check_me) + _tr->stopwalking(); + else + stopwalk(); _tr->_vm->_gyro.oncandopageswap = false; _tr->_vm->_lucerna.showrw(); _tr->_vm->_gyro.oncandopageswap = true; @@ -112,8 +118,10 @@ void triptype::bounce() { int8 triptype::sgn(int16 x) { int8 sgn_result; - if (x > 0) sgn_result = 1; - else if (x < 0) sgn_result = -1; + if (x > 0) + sgn_result = 1; + else if (x < 0) + sgn_result = -1; else sgn_result = 0; /* x=0 */ return sgn_result; @@ -142,29 +150,40 @@ void triptype::homestep() { iy = 0; if (hy != y) { temp = hy - y; - if (temp > 4) iy = 4; - else if (temp < -4) iy = -4; - else iy = temp; + if (temp > 4) + iy = 4; + else if (temp < -4) + iy = -4; + else + iy = temp; } if (hx != x) { temp = hx - x; - if (temp > 4) ix = 4; - else if (temp < -4) ix = -4; - else ix = temp; + if (temp > 4) + ix = 4; + else if (temp < -4) + ix = -4; + else + ix = temp; } } void triptype::speed(int8 xx, int8 yy) { ix = xx; iy = yy; - if ((ix == 0) && (iy == 0)) return; /* no movement */ + if ((ix == 0) && (iy == 0)) + return; /* no movement */ if (ix == 0) { /* No horz movement */ - if (iy < 0) turn(_tr->up); - else turn(_tr->down); + if (iy < 0) + turn(_tr->up); + else + turn(_tr->down); } else { - if (ix < 0) turn(_tr->left); - else turn(_tr->right); + if (ix < 0) + turn(_tr->left); + else + turn(_tr->right); } } @@ -251,17 +270,16 @@ triptype *triptype::done() { int32 id; uint16 soa; - { - adxtype &with = a; + adxtype &with = a; - /* nds:=num div seq;*/ - xw = with.xl / 8; - if ((with.xl % 8) > 0) xw += 1; - for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { - totalnum --; - free(mani[totalnum]); - free(sil[totalnum]); /* <<- Width of a siltype. */ - } + /* nds:=num div seq;*/ + xw = with.xl / 8; + if ((with.xl % 8) > 0) + xw += 1; + for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) { + totalnum --; + free(mani[totalnum]); + free(sil[totalnum]); /* <<- Width of a siltype. */ } quick = false; @@ -269,11 +287,6 @@ triptype *triptype::done() { return this; } - - - - - getsettype *getsettype::init() { numleft = 0; /* initialise array pointer */ return this; @@ -290,11 +303,6 @@ void getsettype::recall(bytefield &r) { numleft --; } - - - - - Trip::Trip() { getsetclear(); mustexclaim = false; @@ -304,11 +312,12 @@ void Trip::setParent(AvalancheEngine *vm) { _vm = vm; } - void Trip::loadtrip() { byte gm; - for (gm = 1; gm <= numtr; gm ++) tr[gm].original(); + for (gm = 1; gm <= numtr; gm++) + tr[gm].original(); + // CHECKME: A 'i++' is missing somewhere, obviously! for (int i = 0; i < sizeof(aa); aa[i] = 0); } @@ -367,24 +376,18 @@ void Trip::catamove(byte ped) { _vm->_gyro.dna.geida_spin = 0; switch (xy_uint16) { - case 1801: { /* Exit catacombs */ + case 1801: /* Exit catacombs */ fliproom(r__lustiesroom, 4); _vm->_scrolls.display("Phew! Nice to be out of there!"); return; - } - break; - case 1033: { /* Oubliette */ + case 1033: /* Oubliette */ fliproom(r__oubliette, 1); _vm->_scrolls.display("Oh, NO!\231\2"); return; - } - break; - case 4: { + case 4: fliproom(r__geidas, 1); return; - } - break; - case 2307: { + case 2307: fliproom(r__lusties, 5); _vm->_scrolls.display("Oh no... here we go again..."); _vm->_gyro.dna.user_moves_avvy = false; @@ -392,156 +395,138 @@ void Trip::catamove(byte ped) { tr[1].ix = 0; return; } - break; - } - if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) _vm->_lucerna.load(29); + if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room) + _vm->_lucerna.load(29); here = _vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x]; switch (here & 0xf) { /* West. */ - case 0: { /* no connection (wall) */ + case 0: /* no connection (wall) */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); - } - break; - case 0x1: { /* no connection (wall + shield), */ + break; + case 0x1: /* no connection (wall + shield), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(29); /* ...shield. */ - } - break; - case 0x2: { /* wall with door */ + break; + case 0x2: /* wall with door */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door. */ - } - break; - case 0x3: { /* wall with door and shield */ + break; + case 0x3: /* wall with door and shield */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(29); /* ...shield. */ - } - break; - case 0x4: { /* no connection (wall + window), */ + break; + case 0x4: /* no connection (wall + window), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(5); /* ...window. */ - } - break; - case 0x5: { /* wall with door and window */ + break; + case 0x5: /* wall with door and window */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(5); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ + break; + case 0x6: /* no connection (wall + torches), */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.nix; /* No door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(7); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ + break; + case 0x7: /* wall with door and torches */ _vm->_gyro.magics[2].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[13].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(28); /* Wall, plus... */ _vm->_celer.show_one(30); /* ...door, and... */ _vm->_celer.show_one(7); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ + break; + case 0xf: /* straight-through corridor. */ _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* Sloping wall. */ _vm->_gyro.magics[3].op = _vm->_gyro.special; /* Straight wall. */ - } - break; + break; } /* ---- */ switch ((here & 0xf0) >> 4) { /* East */ - case 0: { /* no connection (wall) */ + case 0: /* no connection (wall) */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(19); - } - break; - case 0x1: { /* no connection (wall + window), */ + break; + case 0x1: /* no connection (wall + window), */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...window. */ - } - break; - case 0x2: { /* wall with door */ + break; + case 0x2: /* wall with door */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door. */ - } - break; - case 0x3: { /* wall with door and window */ + break; + case 0x3: /* wall with door and window */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(20); /* ...door, and... */ _vm->_celer.show_one(21); /* ...window. */ - } - break; - case 0x6: { /* no connection (wall + torches), */ + break; + case 0x6: /* no connection (wall + torches), */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* No door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(18); /* ...torches. */ - } - break; - case 0x7: { /* wall with door and torches */ + break; + case 0x7: /* wall with door and torches */ _vm->_gyro.magics[5].op = _vm->_gyro.bounces; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.special; /* Door. */ _vm->_celer.show_one(19); /* Wall, plus... */ _vm->_celer.show_one(21); /* ...door, and... */ _vm->_celer.show_one(18); /* ...torches. */ - } - break; - case 0xf: { /* straight-through corridor. */ + break; + case 0xf: /* straight-through corridor. */ _vm->_gyro.magics[5].op = _vm->_gyro.nix; /* Sloping wall. */ _vm->_gyro.magics[6].op = _vm->_gyro.special; /* Straight wall. */ _vm->_gyro.portals[15].op = _vm->_gyro.nix; /* Door. */ - } - break; + break; } /* ---- */ switch ((here & 0xf00) >> 8) { /* South */ - case 0: { /* No connection. */ + case 0: /* No connection. */ _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[12].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; - case 0x1: { + break; + case 0x1: _vm->_celer.show_one(22); if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows)) @@ -550,97 +535,95 @@ void Trip::catamove(byte ped) { _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[12].op = _vm->_gyro.bounces; - } - break; - case 0x2: { + break; + case 0x2: _vm->_celer.show_one(23); _vm->_gyro.magics[7].op = _vm->_gyro.special; /* Middle exit south. */ _vm->_gyro.magics[12].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; - case 0x3: { + break; + case 0x3: _vm->_celer.show_one(24); _vm->_gyro.magics[12].op = _vm->_gyro.special; /* Left exit south. */ _vm->_gyro.magics[7].op = _vm->_gyro.bounces; _vm->_gyro.magics[13].op = _vm->_gyro.bounces; - } - break; + break; } switch ((here & 0xf000) >> 12) { /* North */ - case 0: { /* No connection */ + case 0: /* No connection */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ - } - break; - /* LEFT handles: */ - /* $1: begin - _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - case 0x2: { + break; + // LEFT handles: +/* + case 0x1: _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ - _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; - /* $3: begin - _vm->_celer.show_one(4); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end; - { RIGHT handles: } - $4: begin - _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Left exit north. } { Change magic number! } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - case 0x5: { + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + case 0x2: + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // Middle exit north. + _vm->_gyro.portals[12].op = _vm->_gyro.special; // Door. + break; +/* case 0x3: + _vm->_celer.show_one(4); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; + // RIGHT handles: + case 0x4: + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + case 0x5: _vm->_celer.show_one(3); _vm->_gyro.magics[1].op = _vm->_gyro.bounces; /* Middle exit north. */ _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; - /* $6: begin - _vm->_celer.show_one(3); - _vm->_gyro.magics[1].op:=_vm->_gyro.bounces; { Right exit north. } - _vm->_gyro.portals[12].op:=_vm->_gyro.special; { Door. } - end;*/ - /* ARCHWAYS: */ + break; +/* + case 0x6: + _vm->_celer.show_one(3); + _vm->_gyro.magics[1].op = _vm->_gyro.bounces; // { Right exit north. } + _vm->_gyro.portals[12].op = _vm->_gyro.special; // { Door. } + break; +*/ + // ARCHWAYS: case 0x7: case 0x8: case 0x9: { _vm->_celer.show_one(6); - if (((here & 0xf000) >> 12) > 0x7) _vm->_celer.show_one(31); - if (((here & 0xf000) >> 12) == 0x9) _vm->_celer.show_one(32); + if (((here & 0xf000) >> 12) > 0x7) + _vm->_celer.show_one(31); + if (((here & 0xf000) >> 12) == 0x9) + _vm->_celer.show_one(32); _vm->_gyro.magics[1].op = _vm->_gyro.special; /* Middle arch north. */ _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ } break; /* DECORATIONS: */ - case 0xd: { /* No connection + WINDOW */ + case 0xd: /* No connection + WINDOW */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(14); - } - break; - case 0xe: { /* No connection + TORCH */ + break; + case 0xe: /* No connection + TORCH */ _vm->_gyro.magics[1].op = _vm->_gyro.bounces; _vm->_gyro.portals[12].op = _vm->_gyro.nix; /* Door. */ _vm->_celer.show_one(8); - } - break; + break; /* Recessed door: */ - case 0xf: { + case 0xf: _vm->_gyro.magics[1].op = _vm->_gyro.nix; /* Door to Geida's room. */ _vm->_celer.show_one(1); _vm->_gyro.portals[12].op = _vm->_gyro.special; /* Door. */ - } - break; + break; } switch (xy_uint16) { @@ -660,7 +643,8 @@ void Trip::catamove(byte ped) { } break; case 1287: - for (fv = 10; fv <= 13; fv ++) _vm->_celer.show_one(fv); + for (fv = 10; fv <= 13; fv ++) + _vm->_celer.show_one(fv); break; /* [7,5] : 4 candles. */ case 776: _vm->_celer.show_one(10); @@ -668,11 +652,10 @@ void Trip::catamove(byte ped) { case 2049: _vm->_celer.show_one(11); break; /* [1,8] : another candle. */ - case 257: { + case 257: _vm->_celer.show_one(12); _vm->_celer.show_one(13); - } - break; /* [1,1] : the other two. */ + break; /* [1,1] : the other two. */ } if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) { @@ -695,16 +678,15 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { - case 1: { /* _vm->_gyro.special 1: Room 22: top of stairs. */ + case 1: /* _vm->_gyro.special 1: Room 22: top of stairs. */ _vm->_celer.show_one(1); _vm->_gyro.dna.brummie_stairs = 1; _vm->_gyro.magics[10].op = _vm->_gyro.nix; _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); stopwalking(); _vm->_gyro.dna.user_moves_avvy = false; - } - break; - case 2: { /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ + break; + case 2: /* _vm->_gyro.special 2: Room 22: bottom of stairs. */ _vm->_gyro.dna.brummie_stairs = 3; _vm->_gyro.magics[11].op = _vm->_gyro.nix; _vm->_gyro.magics[12].op = _vm->_gyro.exclaim; @@ -713,9 +695,8 @@ void Trip::call_special(uint16 which) { stopwalking(); _vm->_visa.dixi('q', 26); _vm->_gyro.dna.user_moves_avvy = true; - } - break; - case 3: { /* _vm->_gyro.special 3: Room 71: triggers dart. */ + break; + case 3: /* _vm->_gyro.special 3: Room 71: triggers dart. */ tr[1].bounce(); /* Must include that. */ if (! _vm->_gyro.dna.arrow_triggered) { @@ -730,17 +711,13 @@ void Trip::call_special(uint16 which) { tr[2].call_eachstep = true; tr[2].eachstep = procarrow_procs; } - } - break; - - case 4: { /* This is the ghost room link. */ + break; + case 4: /* This is the ghost room link. */ _vm->_lucerna.dusk(); tr[1].turn(right); /* you'll see this after we get back from bootstrap */ _vm->_timeout.set_up_timer(1, _vm->_timeout.procghost_room_phew, _vm->_timeout.reason_ghost_room_phew); _vm->_enid.back_to_bootstrap(3); - } - break; - + break; case 5: if (_vm->_gyro.dna.friar_will_tie_you_up) { /* _vm->_gyro.special 5: Room 42: touched tree, and get tied up. */ @@ -759,17 +736,14 @@ void Trip::call_special(uint16 which) { _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); } break; - - case 6: { /* _vm->_gyro.special 6: fall down oubliette. */ + case 6: /* _vm->_gyro.special 6: fall down oubliette. */ _vm->_gyro.dna.user_moves_avvy = false; tr[1].ix = 3; tr[1].iy = 0; tr[1].face = right; _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); - } - break; - - case 7: { /* _vm->_gyro.special 7: stop falling down oubliette. */ + break; + case 7: /* _vm->_gyro.special 7: stop falling down oubliette. */ tr[1].visible = false; _vm->_gyro.magics[10].op = _vm->_gyro.nix; stopwalking(); @@ -778,9 +752,7 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); - } - break; - + break; case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */ if ((_vm->_gyro.dna.geida_follows) && (! _vm->_gyro.dna.lustie_is_asleep)) { _vm->_visa.dixi('q', 63); @@ -790,21 +762,20 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.gameover(); } break; - - case 9: { /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ - if (! _vm->_gyro.dna.geida_follows) return; /* DOESN'T COUNT: no Geida. */ + case 9: /* _vm->_gyro.special 9: lose Geida to Robin Hood... */ + if (! _vm->_gyro.dna.geida_follows) + return; /* DOESN'T COUNT: no Geida. */ tr[2].call_eachstep = false; /* She no longer follows Avvy around. */ tr[2].walkto(4); /* She walks to somewhere... */ tr[1].done(); /* Lose Avvy. */ _vm->_gyro.dna.user_moves_avvy = false; _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); - } - break; - - case 10: { /* _vm->_gyro.special 10: transfer north in catacombs. */ + break; + case 10: /* _vm->_gyro.special 10: transfer north in catacombs. */ if ((_vm->_gyro.dna.cat_x == 4) && (_vm->_gyro.dna.cat_y == 1)) { /* Into Geida's room. */ - if (_vm->_gyro.dna.obj[_vm->_gyro.key]) _vm->_visa.dixi('q', 62); + if (_vm->_gyro.dna.obj[_vm->_gyro.key]) + _vm->_visa.dixi('q', 62); else { _vm->_visa.dixi('q', 61); return; @@ -813,7 +784,8 @@ void Trip::call_special(uint16 which) { _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_y -= 1; catamove(4); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); switch ((_vm->_gyro.catamap[_vm->_gyro.dna.cat_y][_vm->_gyro.dna.cat_x] & 0xf00) >> 8) { case 0x1: @@ -827,78 +799,72 @@ void Trip::call_special(uint16 which) { } getback(); dawndelay(); - } - break; - case 11: { /* _vm->_gyro.special 11: transfer east in catacombs. */ + break; + case 11: /* _vm->_gyro.special 11: transfer east in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_x += 1; catamove(1); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 1); getback(); dawndelay(); - } - break; - case 12: { /* _vm->_gyro.special 12: transfer south in catacombs. */ + break; + case 12: /* _vm->_gyro.special 12: transfer south in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_y += 1; catamove(2); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 2); getback(); dawndelay(); - } - break; - case 13: { /* _vm->_gyro.special 13: transfer west in catacombs. */ + break; + case 13: /* _vm->_gyro.special 13: transfer west in catacombs. */ _vm->_lucerna.dusk(); _vm->_gyro.dna.cat_x -= 1; catamove(3); - if (_vm->_gyro.dna.room != r__catacombs) return; + if (_vm->_gyro.dna.room != r__catacombs) + return; _vm->_lucerna.delavvy(); apped(1, 3); getback(); dawndelay(); - } - break; + break; } } -void Trip::open_the_door(byte whither, byte ped, byte magicnum) +void Trip::open_the_door(byte whither, byte ped, byte magicnum) { /* This slides the door open. (The data really ought to be saved in the Also file, and will be next time. However, for now, they're here.) */ -{ switch (_vm->_gyro.dna.room) { case r__outsideyours: case r__outsidenottspub: - case r__outsideducks: { + case r__outsideducks: _vm->_sequence.first_show(1); _vm->_sequence.then_show(2); _vm->_sequence.then_show(3); - } - break; - case r__insidecardiffcastle: { + break; + case r__insidecardiffcastle: _vm->_sequence.first_show(1); _vm->_sequence.then_show(5); - } - break; + break; case r__avvysgarden: case r__entrancehall: - case r__insideabbey: { + case r__insideabbey: _vm->_sequence.first_show(1); _vm->_sequence.then_show(2); - } - break; + break; case r__musicroom: - case r__outsideargentpub: { + case r__outsideargentpub: _vm->_sequence.first_show(5); _vm->_sequence.then_show(6); - } - break; + break; case r__lusties: switch (magicnum) { case 14: @@ -915,12 +881,11 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) _vm->_sequence.then_show(9); } break; - case 12: { + case 12: _vm->_sequence.first_show(4); _vm->_sequence.then_show(5); _vm->_sequence.then_show(6); - } - break; + break; } break; } @@ -936,33 +901,31 @@ void Trip::newspeed() { } void Trip::rwsp(byte t, byte r) { - { - switch (r) { - case up: - tr[t].speed(0, -tr[t].ys); - break; - case down: - tr[t].speed(0, tr[t].ys); - break; - case left: - tr[t].speed(-tr[t].xs, 0); - break; - case right: - tr[t].speed(tr[t].xs, 0); - break; - case ul: - tr[t].speed(-tr[t].xs, -tr[t].ys); - break; - case ur: - tr[t].speed(tr[t].xs, -tr[t].ys); - break; - case dl: - tr[t].speed(-tr[t].xs, tr[t].ys); - break; - case dr: - tr[t].speed(tr[t].xs, tr[t].ys); - break; - } + switch (r) { + case up: + tr[t].speed(0, -tr[t].ys); + break; + case down: + tr[t].speed(0, tr[t].ys); + break; + case left: + tr[t].speed(-tr[t].xs, 0); + break; + case right: + tr[t].speed(tr[t].xs, 0); + break; + case ul: + tr[t].speed(-tr[t].xs, -tr[t].ys); + break; + case ur: + tr[t].speed(tr[t].xs, -tr[t].ys); + break; + case dl: + tr[t].speed(-tr[t].xs, tr[t].ys); + break; + case dr: + tr[t].speed(tr[t].xs, tr[t].ys); + break; } } @@ -994,19 +957,17 @@ void Trip::getback() { endangered = false; /* Super_Off;*/ - { - while (getset[1 - _vm->_gyro.cp].numleft > 0) { - getset[1 - _vm->_gyro.cp].recall(r); + while (getset[1 - _vm->_gyro.cp].numleft > 0) { + getset[1 - _vm->_gyro.cp].recall(r); - /* if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end;*/ + /* if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end;*/ - _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); - } + _vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp); } _vm->_lucerna.blitfix(); @@ -1028,7 +989,8 @@ void Trip::follow_avvy_y(byte tripnum) { return; if (tr[tripnum].ix == 0) { tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; tr[tripnum].count = 0; } } @@ -1045,8 +1007,10 @@ void Trip::back_and_forth(byte tripnum) { void Trip::face_avvy(byte tripnum) { if (! tr[tripnum].homing) { - if (tr[1].x >= tr[tripnum].x) tr[tripnum].face = right; - else tr[tripnum].face = left; + if (tr[1].x >= tr[tripnum].x) + tr[tripnum].face = right; + else + tr[tripnum].face = left; } } @@ -1119,22 +1083,22 @@ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ /* Still some way to go. */ if (tr[tripnum].x < tox) { tr[tripnum].x += 5; - if (tr[tripnum].x > tox) tr[tripnum].x = tox; + if (tr[tripnum].x > tox) + tr[tripnum].x = tox; } - if (tr[tripnum].y < toy) tr[tripnum].y += 1; + if (tr[tripnum].y < toy) + tr[tripnum].y += 1; tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; } } - - - - void Trip::take_a_step(byte &tripnum) { if (tr[tripnum].ix == 0) { tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) tr[tripnum].step = 0; + if (tr[tripnum].step == tr[tripnum].a.seq) + tr[tripnum].step = 0; tr[tripnum].count = 0; } } @@ -1142,7 +1106,8 @@ void Trip::take_a_step(byte &tripnum) { void Trip::spin(byte whichway, byte &tripnum) { if (tr[tripnum].face != whichway) { tr[tripnum].face = whichway; - if (tr[tripnum].whichsprite == 2) return; /* Not for Spludwick */ + if (tr[tripnum].whichsprite == 2) + return; /* Not for Spludwick */ _vm->_gyro.dna.geida_spin += 1; _vm->_gyro.dna.geida_time = 20; @@ -1157,7 +1122,8 @@ void Trip::spin(byte whichway, byte &tripnum) { void Trip::geida_procs(byte tripnum) { if (_vm->_gyro.dna.geida_time > 0) { _vm->_gyro.dna.geida_time -= 1; - if (_vm->_gyro.dna.geida_time == 0) _vm->_gyro.dna.geida_spin = 0; + if (_vm->_gyro.dna.geida_time == 0) + _vm->_gyro.dna.geida_spin = 0; } if (tr[tripnum].y < (tr[1].y - 2)) { @@ -1185,7 +1151,8 @@ void Trip::geida_procs(byte tripnum) { tr[tripnum].ix = -tr[1].xs; spin(left, tripnum); take_a_step(tripnum); - } else tr[tripnum].ix = 0; + } else + tr[tripnum].ix = 0; } /* That's all... */ @@ -1205,7 +1172,7 @@ void Trip::call_andexors() { do { ok = true; - for (fv = 1; fv <= 4; fv ++) + for (fv = 1; fv <= 4; fv ++) { if (((order[fv] != 0) && (order[fv + 1] != 0)) && (tr[order[fv]].y > tr[order[fv + 1]].y)) { /* Swap them! */ @@ -1214,17 +1181,20 @@ void Trip::call_andexors() { order[fv + 1] = temp; ok = false; } + } } while (!ok); - for (fv = 1; fv <= 5; fv ++) + for (fv = 1; fv <= 5; fv ++) { if (order[fv] > 0) tr[order[fv]].andexor(); + } } void Trip::trippancy_link() { byte fv; - if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) return; + if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll) + return; for (fv = 1; fv <= numtr; fv ++) { if (tr[fv].quick) tr[fv].walk(); @@ -1268,9 +1238,9 @@ void Trip::get_back_loretta() { /* for fv:=1 to numtr do with tr[fv] do if quick then getback;*/ for (fv = 1; fv <= numtr; fv ++) if (tr[fv].quick) { - getback(); - return; - } + getback(); + return; + } /* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/ } @@ -1285,63 +1255,68 @@ void Trip::tripkey(char dir) { if ((_vm->_gyro.ctrl == cjoy) | (! _vm->_gyro.dna.user_moves_avvy)) return; - { - triptype &with = tr[1]; - { - switch (dir) { - case 'H': - if (_vm->_gyro.dna.rw != up) { - _vm->_gyro.dna.rw = up; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'P': - if (_vm->_gyro.dna.rw != down) { - _vm->_gyro.dna.rw = down; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'K': - if (_vm->_gyro.dna.rw != left) { - _vm->_gyro.dna.rw = left; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'M': - if (_vm->_gyro.dna.rw != right) { - _vm->_gyro.dna.rw = right; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'I': - if (_vm->_gyro.dna.rw != ur) { - _vm->_gyro.dna.rw = ur; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'Q': - if (_vm->_gyro.dna.rw != dr) { - _vm->_gyro.dna.rw = dr; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'O': - if (_vm->_gyro.dna.rw != dl) { - _vm->_gyro.dna.rw = dl; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'G': - if (_vm->_gyro.dna.rw != ul) { - _vm->_gyro.dna.rw = ul; - rwsp(1, _vm->_gyro.dna.rw); - } else stopwalking(); - break; - case 'L': - stopwalking(); - break; - } - } + triptype &with = tr[1]; + + switch (dir) { + case 'H': + if (_vm->_gyro.dna.rw != up) { + _vm->_gyro.dna.rw = up; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'P': + if (_vm->_gyro.dna.rw != down) { + _vm->_gyro.dna.rw = down; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'K': + if (_vm->_gyro.dna.rw != left) { + _vm->_gyro.dna.rw = left; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'M': + if (_vm->_gyro.dna.rw != right) { + _vm->_gyro.dna.rw = right; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'I': + if (_vm->_gyro.dna.rw != ur) { + _vm->_gyro.dna.rw = ur; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'Q': + if (_vm->_gyro.dna.rw != dr) { + _vm->_gyro.dna.rw = dr; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'O': + if (_vm->_gyro.dna.rw != dl) { + _vm->_gyro.dna.rw = dl; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'G': + if (_vm->_gyro.dna.rw != ul) { + _vm->_gyro.dna.rw = ul; + rwsp(1, _vm->_gyro.dna.rw); + } else + stopwalking(); + break; + case 'L': + stopwalking(); + break; } } @@ -1350,9 +1325,7 @@ void Trip::readstick() { } void Trip::getsetclear() { - byte fv; - - for (fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv ++) getset[fv].init(); } @@ -1384,20 +1357,10 @@ void Trip::hide_in_the_cupboard() { } } - - - - - - - - void Trip::tidy_up(int16 a, int16 b, int16 c, int16 d) { warning("STUB: Trip::tidy_up()"); } - - void Trip::tidy_after_mouse() { tidy_up(beforex, beforey, beforex + 15, beforey + 15); _vm->_gyro.xycheck(); @@ -1407,7 +1370,6 @@ void Trip::tidy_after_mouse() { void Trip::fliproom(byte room, byte ped) { byte fv; - if (! _vm->_gyro.alive) { /* You can't leave the room if you're dead. */ tr[1].ix = 0; @@ -1462,9 +1424,7 @@ void Trip::fliproom(byte room, byte ped) { bool Trip::infield(byte which) { /* returns True if you're within field "which" */ - int16 yy; - - yy = tr[1].y + tr[1].a.yl; + int16 yy = tr[1].y + tr[1].a.yl; return (tr[1].x >= _vm->_gyro.fields[which].x1) && (tr[1].x <= _vm->_gyro.fields[which].x2) && (yy >= _vm->_gyro.fields[which].y1) && (yy <= _vm->_gyro.fields[which].y2); @@ -1492,7 +1452,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */ if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2) && (uy >= _vm->_gyro.fields[fv].y1) && (uy <= _vm->_gyro.fields[fv].y2)) - nd = true; + nd = true; } return nd; } |