AVALANCHE: Fix some more code formatting

This commit is contained in:
Strangerke 2013-06-30 22:01:05 +02:00
parent 63737c3878
commit 539ce56124
9 changed files with 418 additions and 401 deletions

File diff suppressed because it is too large Load Diff

View File

@ -251,7 +251,7 @@ namespace Avalanche {
zoomy = false;
// Call the menu by default. Might be modified later, if get_slope() gets implemented,
// becouse zoomy's value is given there. Not sure yet what "zoomy" stands for.
if (! zoomy)
if (!zoomy)
call_menu(); /* Not run when zoomy. */
do {

View File

@ -61,7 +61,7 @@ void Celer::pics_link() {
case r__outsideargentpub:
if ((_vm->_gyro.roomtime % int32(12)) == 0)
show_one(int32(1) + (_vm->_gyro.roomtime / int32(12)) % int32(4));
break;
break;
case r__brummieroad:
if ((_vm->_gyro.roomtime % int32(2)) == 0)
@ -74,7 +74,7 @@ void Celer::pics_link() {
break;
case r__yours:
if ((! _vm->_gyro.dna.avvy_is_awake) && ((_vm->_gyro.roomtime % int32(4)) == 0))
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;

View File

@ -493,7 +493,7 @@ void Gyro::background(byte x) {
void Gyro::hang_around_for_a_while() {
byte fv;
for (fv = 1; fv <= 28; fv ++)
for (fv = 1; fv <= 28; fv++)
slowdown();
}

View File

@ -82,13 +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)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::centre()");
/*for (fv = 1; fv <= size - (x / 2);
fv ++)
output << logfile << ' ';*/
/*for (fv = 1; fv <= size - (x / 2); fv++)
output << logfile << ' ';*/
}
void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */
@ -101,43 +100,48 @@ void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */
log_epson = printing;
logging = true;
if (! printing) {
quote = '"';
unquote = '"';
copyright = "(c)";
if (!printing) {
quote = '"';
unquote = '"';
copyright = "(c)";
}*/
}
void Logger::log_divider() { /* Prints the divider sign. */
byte fv;
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_divider()");
/*if (_vm->_gyro.log_epson) {
output << logfile << Common::String(' ') + double_width;
for (fv = 1; fv <= divide_indent; fv ++) output << logfile << ' ';
output << logfile << Common::String(' ') + double_off;
} else
for (fv = 1; fv <= 36; fv ++) output << logfile << ' ';
output << logfile << divide << NL;*/
/*
if (_vm->_gyro.log_epson) {
output << logfile << Common::String(' ') + double_width;
for (fv = 1; fv <= divide_indent; fv++)
output << logfile << ' ';
output << logfile << Common::String(' ') + double_off;
} else {
for (fv = 1; fv <= 36; fv++)
output << logfile << ' ';
}
output << logfile << divide << NL;
*/
}
void Logger::log_command(Common::String x) { /* Prints a command */
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_command()");
/*if (_vm->_gyro.log_epson)
output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL;
output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL;
else
output << logfile << Common::String("> ") + x << NL;*/
output << logfile << Common::String("> ") + x << NL;*/
}
void Logger::log_addstuff(Common::String x) {
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
scroll_line += x;
@ -145,7 +149,7 @@ void Logger::log_addstuff(Common::String x) {
void Logger::log_scrollchar(Common::String x) { /* print one character */
Common::String z;
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
switch (x[1]) {
@ -166,7 +170,7 @@ void Logger::log_scrollchar(Common::String x) { /* print one character */
}
void Logger::log_italic() {
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_italic()");
@ -178,7 +182,7 @@ void Logger::log_italic() {
}
void Logger::log_roman() {
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_roman()");
@ -190,7 +194,7 @@ void Logger::log_roman() {
}
void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_epsonroman()");
@ -206,29 +210,32 @@ void Logger::log_scrollline() { /* Set up a line for the scroll driver */
void Logger::log_scrollendline(bool centred) {
byte x, fv;
if (! _vm->_gyro.logging) return;
if (!_vm->_gyro.logging)
return;
x = 17;
if (centred) x += (50 - scroll_line_length) / 2;
if (centred)
x += (50 - scroll_line_length) / 2;
warning("STUB: Logger::log_scrollendline()");
/*for (fv = 1; fv <= x; fv ++)
/*for (fv = 1; fv <= x; fv++)
output << logfile << ' ';
output << logfile << scroll_line << NL;*/
}
void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) {
byte fv;
if (! _vm->_gyro.logging) return;
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_bubbleline()");
/*if (linenum == 1) {
for (fv = 1; fv <= 15; fv ++)
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 ++)
for (fv = 1; fv <= 17; fv++)
output << logfile << ' ';
output << logfile << x << NL;
}*/
@ -243,11 +250,12 @@ void Logger::log_newline() {
void Logger::log_newroom(Common::String where) {
byte fv;
if (! _vm->_gyro.logging) return;
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_newroom()");
/*for (fv = 1; fv <= 20; fv ++)
/*for (fv = 1; fv <= 20; fv++)
output << logfile << ' ';
if (_vm->_gyro.log_epson)
output << logfile << emph_on;
@ -259,7 +267,7 @@ void Logger::log_newroom(Common::String where) {
void Logger::log_aside(Common::String what) {
/* This writes "asides" to the printer. For example, moves in Nim. */
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_aside()");
@ -270,12 +278,12 @@ void Logger::log_aside(Common::String what) {
void Logger::log_score(uint16 credit, uint16 now) {
byte fv;
if (! _vm->_gyro.logging)
if (!_vm->_gyro.logging)
return;
warning("STUB: Logger::log_score()");
/*for (fv = 1; fv <= 50; fv ++)
/*for (fv = 1; fv <= 50; fv++)
output << logfile << ' ';
output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/
}

View File

@ -83,7 +83,7 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */
_vm->_gyro.super_off();
/* for (page_ = 0; page_ <= 1; page_ ++) {
/* for (page_ = 0; page_ <= 1; page_++) {
setactivepage(page_);
bar(419, 195, 438, 197);
}*/
@ -98,8 +98,8 @@ 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 ++) {
for (fv = 4; fv <= 100; fv++) {
for (ff = 0; ff <= 70; ff++) {
sound(fv * 100 + ff * 10);
delay(1);
}
@ -128,23 +128,22 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit
ox = 0;
_vm->_logger.log_scrollline();
for (xx = 1; xx <= lz; xx ++) {
for (xx = 1; xx <= lz; xx++) {
switch (z[xx]) {
case '\22': {
case '\22':
cfont = roman;
_vm->_logger.log_roman();
}
break;
case '\6': {
break;
case '\6':
cfont = italic;
_vm->_logger.log_italic();
}
break;
default: {
break;
default:
ox += 1;
for (yy = 1; yy <= 12; yy ++) itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1];
for (yy = 1; yy <= 12; yy++)
itw[yy][ox] = ~ ch[cfont][z[xx]][yy + 1];
_vm->_logger.log_scrollchar(Common::String(z[xx]));
}
break;
}
}
@ -152,10 +151,10 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit
if (offset) {
/* offsetting routine */
lz += 1;
for (yy = 1; yy <= 12; yy ++) {
for (yy = 1; yy <= 12; yy++) {
bit = 240;
itw[yy][lz] = 255;
for (xx = 1; xx <= lz; xx ++) {
for (xx = 1; xx <= lz; xx++) {
t = itw[yy][xx];
itw[yy][xx] = bit + t / 16;
bit = t << 4;
@ -163,9 +162,9 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit
}
}
yp = x + y * 80 + (1 - _vm->_gyro.cp) * _vm->_gyro.pagetop;
for (yy = 1; yy <= 12; yy ++) {
for (yy = 1; yy <= 12; yy++) {
yp += 80;
for (bit = 0; bit <= locol; bit ++) {
for (bit = 0; bit <= locol; bit++) {
/*port[0x3c4] = 2;
port[0x3ce] = 4;
port[0x3c5] = 1 << bit;
@ -190,23 +189,18 @@ void Scrolls::dialogue() {
warning("STUB: Scrolls::dialogue()");
}
void Scrolls::store_(byte what, tunetype &played) {
memcpy(played, played+1, sizeof(played) - 1);
played[30] = what;
}
bool Scrolls::they_match(tunetype &played) {
byte fv, mistakes;
bool they_match_result;
mistakes = 0;
for (fv = 1; fv <= sizeof(played); fv ++)
for (fv = 1; fv <= sizeof(played); fv++)
if (played[fv] != Gyro::tune[fv])
mistakes++;
@ -243,13 +237,4 @@ void Scrolls::music_scroll() {
}
} // End of namespace Avalanche

View File

@ -55,11 +55,12 @@ void Sequence::first_show(byte what) {
void Sequence::then_show(byte what) {
byte fv;
for (fv = 1; fv <= seq_length; fv ++)
for (fv = 1; fv <= seq_length; fv++) {
if (seq[fv] == 0) {
seq[fv] = what;
return;
}
}
}
void Sequence::then_flip(byte where, byte ped) {

View File

@ -76,7 +76,7 @@ void Timeout::one_tick() {
if (_vm->_gyro.ddmnow)
return;
for (fv = 1; fv <= 7; fv ++) {
for (fv = 1; fv <= 7; fv++) {
timetype &with = times[fv];
if (with.time_left > 0) {
with.time_left -= 1;
@ -217,7 +217,7 @@ void Timeout::one_tick() {
void Timeout::lose_timer(byte which) {
byte fv;
for (fv = 1; fv <= 7; fv ++) {
for (fv = 1; fv <= 7; fv++) {
timetype &with = times[fv];
if (with.what_for == which)
with.time_left = 0;
@ -240,7 +240,7 @@ end;*/
/* Timeout procedures: */
void Timeout::open_drawbridge() {
_vm->_gyro.dna.drawbridge_open ++;
_vm->_gyro.dna.drawbridge_open++;
_vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1);
if (_vm->_gyro.dna.drawbridge_open == 4)
@ -253,7 +253,7 @@ void Timeout::open_drawbridge() {
void Timeout::avaricius_talks() {
_vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk);
_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);

View File

@ -85,7 +85,7 @@ bool triptype::collision_check() {
byte fv;
bool collision_check_result = false;
for (fv = 1; fv <= _tr->numtr; fv ++) {
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)) &&
@ -93,7 +93,8 @@ bool triptype::collision_check() {
collision_check_result = true;
break;
}
// CHECKME: Only checks the first element of the for() statement
// CHECKME: Only checks the first element of the for() statement.
// Both lines should certainly be removed
collision_check_result = false;
return collision_check_result;
}
@ -276,8 +277,8 @@ triptype *triptype::done() {
xw = with.xl / 8;
if ((with.xl % 8) > 0)
xw += 1;
for (aa = 1; aa <= /*nds*seq*/ with.num; aa ++) {
totalnum --;
for (aa = 1; aa <= /*nds*seq*/ with.num; aa++) {
totalnum--;
free(mani[totalnum]);
free(sil[totalnum]); /* <<- Width of a siltype. */
}
@ -293,14 +294,14 @@ getsettype *getsettype::init() {
}
void getsettype::remember(bytefield r) {
numleft ++;
numleft++;
warning("STUB: _vm->_timeout.getsettype::remember()");
gs[numleft] = r;
}
void getsettype::recall(bytefield &r) {
r = gs[numleft];
numleft --;
numleft--;
}
Trip::Trip() {
@ -396,7 +397,7 @@ void Trip::catamove(byte ped) {
return;
}
if (! _vm->_gyro.dna.enter_catacombs_from_lusties_room)
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];
@ -531,7 +532,8 @@ void Trip::catamove(byte ped) {
if ((xy_uint16 == 2051) & (_vm->_gyro.dna.geida_follows))
_vm->_gyro.magics[13].op = _vm->_gyro.exclaim;
else _vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */
else
_vm->_gyro.magics[13].op = _vm->_gyro.special; /* Right exit south. */
_vm->_gyro.magics[7].op = _vm->_gyro.bounces;
_vm->_gyro.magics[12].op = _vm->_gyro.bounces;
@ -637,13 +639,13 @@ void Trip::catamove(byte ped) {
_vm->_celer.show_one(2);
break; /* [5,7] : "Ite Mingite" sign. */
case 258:
for (fv = 0; fv <= 2; fv ++) { /* [2,1] : Art gallery - pictures */
for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */
_vm->_celer.show_one_at(15, 130 + fv * 120, 70);
_vm->_celer.show_one_at(16, 184 + fv * 120, 78);
}
break;
case 1287:
for (fv = 10; fv <= 13; fv ++)
for (fv = 10; fv <= 13; fv++)
_vm->_celer.show_one(fv);
break; /* [7,5] : 4 candles. */
case 776:
@ -661,7 +663,7 @@ void Trip::catamove(byte ped) {
if ((_vm->_gyro.dna.geida_follows) & (ped > 0)) {
triptype &with = tr[2];
if (! with.quick) /* If we don't already have her... */
if (!with.quick) /* If we don't already have her... */
tr[2].init(5, true, this); /* ...Load Geida. */
apped(2, geida_ped(ped));
tr[2].call_eachstep = true;
@ -699,7 +701,7 @@ void Trip::call_special(uint16 which) {
case 3: /* _vm->_gyro.special 3: Room 71: triggers dart. */
tr[1].bounce(); /* Must include that. */
if (! _vm->_gyro.dna.arrow_triggered) {
if (!_vm->_gyro.dna.arrow_triggered) {
_vm->_gyro.dna.arrow_triggered = true;
apped(2, 4); /* The dart starts at ped 4, and... */
tr[2].walkto(5); /* flies to ped 5. */
@ -754,7 +756,7 @@ void Trip::call_special(uint16 which) {
_vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid);
break;
case 8: /* _vm->_gyro.special 8: leave du Lustie's room. */
if ((_vm->_gyro.dna.geida_follows) && (! _vm->_gyro.dna.lustie_is_asleep)) {
if ((_vm->_gyro.dna.geida_follows) && (!_vm->_gyro.dna.lustie_is_asleep)) {
_vm->_visa.dixi('q', 63);
tr[2].turn(down);
tr[2].stopwalk();
@ -763,7 +765,7 @@ void Trip::call_special(uint16 which) {
}
break;
case 9: /* _vm->_gyro.special 9: lose Geida to Robin Hood... */
if (! _vm->_gyro.dna.geida_follows)
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... */
@ -960,18 +962,24 @@ void Trip::getback() {
while (getset[1 - _vm->_gyro.cp].numleft > 0) {
getset[1 - _vm->_gyro.cp].recall(r);
/* if overlaps_with_mouse and not endangered then
/*
if overlaps_with_mouse and not endangered then
begin
endangered:=true;
blitfix;
Super_Off;
end;*/
end;
*/
_vm->_lucerna.mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro.cp);
}
_vm->_lucerna.blitfix();
/*if endangered then*/ /*Super_On;*/
/*
if endangered then
Super_On;
*/
}
/* Eachstep procedures: */
@ -997,7 +1005,7 @@ void Trip::follow_avvy_y(byte tripnum) {
}
void Trip::back_and_forth(byte tripnum) {
if (! tr[tripnum].homing) {
if (!tr[tripnum].homing) {
if (tr[tripnum].face == right)
tr[tripnum].walkto(4);
else
@ -1006,7 +1014,7 @@ void Trip::back_and_forth(byte tripnum) {
}
void Trip::face_avvy(byte tripnum) {
if (! tr[tripnum].homing) {
if (!tr[tripnum].homing) {
if (tr[1].x >= tr[tripnum].x)
tr[tripnum].face = right;
else
@ -1165,14 +1173,14 @@ void Trip::call_andexors() {
for (int i = 0; i < 5; i++)
order[i] = 0;
for (fv = 1; fv <= numtr; fv ++) {
for (fv = 1; fv <= numtr; fv++) {
if (tr[fv].quick && tr[fv].visible)
order[fv] = fv;
}
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! */
@ -1184,7 +1192,7 @@ void Trip::call_andexors() {
}
} while (!ok);
for (fv = 1; fv <= 5; fv ++) {
for (fv = 1; fv <= 5; fv++) {
if (order[fv] > 0)
tr[order[fv]].andexor();
}
@ -1195,13 +1203,13 @@ void Trip::trippancy_link() {
if (_vm->_gyro.ddmnow | _vm->_gyro.ontoolbar | _vm->_gyro.seescroll)
return;
for (fv = 1; fv <= numtr; fv ++) {
for (fv = 1; fv <= numtr; fv++) {
if (tr[fv].quick)
tr[fv].walk();
}
call_andexors();
for (fv = 1; fv <= numtr; fv ++) {
for (fv = 1; fv <= numtr; fv++) {
triptype &with = tr[fv];
if (with.quick && with.call_eachstep) {
switch (tr[fv].eachstep) {
@ -1237,9 +1245,11 @@ void Trip::get_back_loretta() {
byte fv;
/* 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;
for (fv = 1; fv <= numtr; fv++) {
if (tr[fv].quick) {
getback();
return;
}
}
/* for fv:=0 to 1 do begin cp:=1-cp; getback; end;*/
}
@ -1252,7 +1262,7 @@ void Trip::stopwalking() {
}
void Trip::tripkey(char dir) {
if ((_vm->_gyro.ctrl == cjoy) | (! _vm->_gyro.dna.user_moves_avvy))
if ((_vm->_gyro.ctrl == cjoy) | (!_vm->_gyro.dna.user_moves_avvy))
return;
triptype &with = tr[1];
@ -1325,7 +1335,7 @@ void Trip::readstick() {
}
void Trip::getsetclear() {
for (byte fv = 0; fv <= 1; fv ++)
for (byte fv = 0; fv <= 1; fv++)
getset[fv].init();
}
@ -1370,7 +1380,7 @@ void Trip::tidy_after_mouse() {
void Trip::fliproom(byte room, byte ped) {
byte fv;
if (! _vm->_gyro.alive) {
if (!_vm->_gyro.alive) {
/* You can't leave the room if you're dead. */
tr[1].ix = 0;
tr[1].iy = 0; /* Stop him from moving. */
@ -1397,7 +1407,7 @@ void Trip::fliproom(byte room, byte ped) {
getsetclear();
for (fv = 2; fv <= numtr; fv ++) {
for (fv = 2; fv <= numtr; fv++) {
if (tr[fv].quick)
tr[fv].done();
} /* Deallocate sprite */
@ -1412,7 +1422,7 @@ void Trip::fliproom(byte room, byte ped) {
_vm->_gyro.dna.rw = tr[1].face;
_vm->_lucerna.showrw();
for (fv = 0; fv <= 1; fv ++) {
for (fv = 0; fv <= 1; fv++) {
_vm->_gyro.cp = 1 - _vm->_gyro.cp;
getback();
}
@ -1447,7 +1457,7 @@ bool Trip::neardoor() { /* returns True if you're near a door! */
uy = tr[1].y + tr[1].a.yl;
nd = false;
for (fv = 9; fv <= _vm->_gyro.numfields; fv ++) {
for (fv = 9; fv <= _vm->_gyro.numfields; fv++) {
_vm->_gyro.fields[fv];
if ((ux >= _vm->_gyro.fields[fv].x1) && (ux <= _vm->_gyro.fields[fv].x2)