AVALANCHE: Fix more GCC warnings

This commit is contained in:
Strangerke 2013-09-04 17:54:08 +02:00
parent 6818dd2eb4
commit ad5529b5d2
9 changed files with 56 additions and 72 deletions

View file

@ -350,11 +350,11 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) {
ander = 170; ander = 170;
fontType font; fontType font;
for (byte fv = 0; fv < z.size(); fv++) for (byte idx = 0; idx < z.size(); idx++)
for (byte ff = 0; ff < 8; ff++) { for (byte ff = 0; ff < 8; ff++) {
font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; font[z[idx]][ff] = _vm->_gyro->characters[z[idx]][ff] & ander;
for (byte i = 0; i < 8; i++) for (byte i = 0; i < 8; i++)
*(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = lightgray; *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + idx * 8 + i, y + ff) = lightgray;
} }
_vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black); _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, black);
@ -363,14 +363,15 @@ void Dropdown::chalk(int16 x, int16 y, char t, Common::String z, bool valid) {
if (! z.contains(t)) if (! z.contains(t))
return; return;
else { else {
byte fv; byte idx = 0;
for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. for (; z[idx] != t; idx++)
; // Search for the character in the string.
byte pixel = ander; byte pixel = ander;
for (byte bit = 0; bit < 8; bit++) { for (byte bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1; byte pixelBit = (pixel >> bit) & 1;
if (pixelBit) if (pixelBit)
*_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = black; *_vm->_graphics->getPixel(x * 8 + idx * 8 + 7 - bit, y + 8) = black;
} }
} }
@ -385,26 +386,27 @@ void Dropdown::hlchalk(int16 x, int16 y, char t, Common::String z, bool valid) {
ander = 170; ander = 170;
fontType font; fontType font;
for (byte fv = 0; fv < z.size(); fv++) for (byte idx = 0; idx < z.size(); idx++) {
for (byte ff = 0; ff < 8; ff++) { for (byte ff = 0; ff < 8; ff++) {
font[z[fv]][ff] = _vm->_gyro->characters[z[fv]][ff] & ander; // Set the font. font[z[idx]][ff] = _vm->_gyro->characters[z[idx]][ff] & ander; // Set the font.
// And set the background of the text to black. // And set the background of the text to black.
for (byte i = 0; i < 8; i++) for (byte i = 0; i < 8; i++)
*(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + fv * 8 + i, y + ff) = black; *(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + idx * 8 + i, y + ff) = black;
} }
}
_vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, white); _vm->_graphics->drawText(_vm->_graphics->_surface, z, font, 8, x * 8, y, white);
// Underline the selected character. // Underline the selected character.
if (z.contains(t)) { if (z.contains(t)) {
byte fv; byte idx;
for (fv = 0; z[fv] != t; fv++); // Search for the character in the string. for (idx = 0; z[idx] != t; idx++); // Search for the character in the string.
byte pixel = ander; byte pixel = ander;
for (byte bit = 0; bit < 8; bit++) { for (byte bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1; byte pixelBit = (pixel >> bit) & 1;
if (pixelBit) if (pixelBit)
*_vm->_graphics->getPixel(x * 8 + fv * 8 + 7 - bit, y + 8) = white; *_vm->_graphics->getPixel(x * 8 + idx * 8 + 7 - bit, y + 8) = white;
} }
} }
@ -422,11 +424,11 @@ void Dropdown::bleep() {
warning("STUB: Dropdown::bleep()"); warning("STUB: Dropdown::bleep()");
} }
void Dropdown::parsekey(char r, char re) { void Dropdown::parsekey(char key1, char key2) {
switch (r) { switch (key1) {
case 0: case 0:
case 224: { case 224: {
switch (re) { switch (key2) {
case 'K': case 'K':
if (ddm_o.menunum > 1) { if (ddm_o.menunum > 1) {
ddm_o.wipe(); ddm_o.wipe();
@ -454,7 +456,7 @@ void Dropdown::parsekey(char r, char re) {
ddm_o.movehighlight(1); ddm_o.movehighlight(1);
break; break;
default: default:
ddm_m.extd(re); ddm_m.extd(key2);
} }
} }
break; break;
@ -463,7 +465,7 @@ void Dropdown::parsekey(char r, char re) {
break; break;
default: { default: {
if (ddm_o.menunow) if (ddm_o.menunow)
ddm_o.keystroke(r); ddm_o.keystroke(key1);
} }
} }
} }

View file

@ -133,7 +133,7 @@ public:
void find_what_you_can_do_with_it(); void find_what_you_can_do_with_it();
void parsekey(char r, char re); void parsekey(char key1, char key2);
void menu_link(); /* DDM menu-bar funcs */ void menu_link(); /* DDM menu-bar funcs */

View file

@ -267,12 +267,12 @@ Common::String Gyro::strf(int32 x) {
return q; return q;
} }
void Gyro::newpointer(byte m) { void Gyro::newpointer(byte id) {
if (m == cmp) if (id == cmp)
return; return;
cmp = m; cmp = id;
load_a_mouse(m); load_a_mouse(id);
} }
void Gyro::wait() { void Gyro::wait() {
@ -388,8 +388,8 @@ bool Gyro::flagset(char x) {
} }
void Gyro::force_numlock() { void Gyro::force_numlock() {
if ((locks & num) > 0) if ((locks & numlockCode) > 0)
locks -= num; locks -= numlockCode;
} }
bool Gyro::pennycheck(uint16 howmuchby) { bool Gyro::pennycheck(uint16 howmuchby) {

View file

@ -45,16 +45,10 @@ class AvalancheEngine;
static const char numobjs = 18; /* always preface with a # */ static const char numobjs = 18; /* always preface with a # */
static const int16 maxobjs = 12; /* carry limit */ static const int16 maxobjs = 12; /* carry limit */
static const byte howlong = 1/*8*/; /* 18 ticks. */
static const int16 num = 32; /* Code for Num Lock */
static const int16 numlockCode = 32; /* Code for Num Lock */
static const int16 mouse_size = 134; static const int16 mouse_size = 134;
typedef void (*proc)();
struct postype { struct postype {
uint16 x, y, datapos; uint16 x, y, datapos;
byte length; byte length;
@ -282,17 +276,6 @@ struct ednahead { /* Edna header */
/* DNA values follow, then footer (which is ignored) */ /* DNA values follow, then footer (which is ignored) */
}; };
/* Possible values of edhead.os:
1 = DOS 4 = Mac
2 = Windows 5 = Amiga
3 = OS/2 6 = ST
7 = Archimedes */
class Gyro { class Gyro {
public: public:
static const char *vernum; static const char *vernum;
@ -535,7 +518,7 @@ public:
Common::String flags; Common::String flags;
Common::String listen; Common::String listen;
uint16 oh, onh, om, h, m, s, s1; uint16 oh, onh, om, hour, minutes, seconds;
Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */
@ -612,7 +595,7 @@ public:
Common::String strf(int32 x); Common::String strf(int32 x);
void newpointer(byte m); void newpointer(byte id);
void wait(); // Makes hourglass. void wait(); // Makes hourglass.

View file

@ -61,8 +61,10 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) {
void Lucerna::init() { void Lucerna::init() {
_vm->_gyro->oh = 17717; _vm->_gyro->oh = 17717;
_vm->_gyro->om = 17717; _vm->_gyro->om = 17717;
if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; if (_vm->_enhanced->atbios)
else _vm->_gyro->atkey = "alt-"; _vm->_gyro->atkey = "f1";
else
_vm->_gyro->atkey = "alt-";
} }
void Lucerna::callverb(byte n) { void Lucerna::callverb(byte n) {
@ -1234,7 +1236,7 @@ void Lucerna::plothands() {
hand(am, brown); hand(am, brown);
calchand(nh, 14, ah, brown); calchand(nh, 14, ah, brown);
calchand(_vm->_gyro->m * 6, 17, am, brown); calchand(_vm->_gyro->minutes * 6, 17, am, brown);
hand(ah, yellow); hand(ah, yellow);
hand(am, yellow); hand(am, yellow);
@ -1253,26 +1255,26 @@ void Lucerna::clock_lucerna() {
/* ...Clock. */ /* ...Clock. */
TimeDate t; TimeDate t;
_vm->_system->getTimeAndDate(t); _vm->_system->getTimeAndDate(t);
_vm->_gyro->h = t.tm_hour; _vm->_gyro->hour = t.tm_hour;
_vm->_gyro->m = t.tm_min; _vm->_gyro->minutes = t.tm_min;
_vm->_gyro->s = t.tm_sec; _vm->_gyro->seconds = t.tm_sec;
nh = (_vm->_gyro->h % 12) * 30 + _vm->_gyro->m / 2; nh = (_vm->_gyro->hour % 12) * 30 + _vm->_gyro->minutes / 2;
if (_vm->_gyro->oh != _vm->_gyro->h) { if (_vm->_gyro->oh != _vm->_gyro->hour) {
plothands(); plothands();
chime(); chime();
} }
if (_vm->_gyro->om != _vm->_gyro->m) if (_vm->_gyro->om != _vm->_gyro->minutes)
plothands(); plothands();
if ((_vm->_gyro->h == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) if ((_vm->_gyro->hour == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717))
_vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); _vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!");
_vm->_gyro->oh = _vm->_gyro->h; _vm->_gyro->oh = _vm->_gyro->hour;
_vm->_gyro->onh = nh; _vm->_gyro->onh = nh;
_vm->_gyro->om = _vm->_gyro->m; _vm->_gyro->om = _vm->_gyro->minutes;
} }

View file

@ -464,7 +464,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t
void Scrolls::bubble(func2 gotoit) { void Scrolls::bubble(func2 gotoit) {
int16 xl, yl, my, xw, yw; int16 xl, yl, my, xw, yw;
byte fv;
Common::Point p[3]; Common::Point p[3];
// byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ // byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */
int16 xc; /* x correction */ int16 xc; /* x correction */
@ -478,7 +477,7 @@ void Scrolls::bubble(func2 gotoit) {
xl = 0; xl = 0;
yl = _vm->_gyro->scrolln * 5; yl = _vm->_gyro->scrolln * 5;
for (int8 fv = 0; fv < _vm->_gyro->scrolln; fv++) { for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) {
uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8; uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8;
if (textWidth > xl) if (textWidth > xl)
xl = textWidth; xl = textWidth;
@ -527,7 +526,7 @@ void Scrolls::bubble(func2 gotoit) {
// Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify().
// The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead.
// It's almost the same, only notable differences are '?', '!', etc. // It's almost the same, only notable differences are '?', '!', etc.
for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) {
int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8;
bool offset = _vm->_gyro->scroll[fv].size() % 2; bool offset = _vm->_gyro->scroll[fv].size() % 2;
_vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf);

View file

@ -45,7 +45,7 @@ Sequence::Sequence(AvalancheEngine *vm) {
void Sequence::first_show(byte what) { void Sequence::first_show(byte what) {
/* First, we need to blank out the entire array. */ /* First, we need to blank out the entire array. */
for (int i = 0; i < sizeof(seq); i++) for (uint i = 0; i < sizeof(seq); i++)
seq[i] = 0; seq[i] = 0;
/* Then it's just the same as then_show. */ /* Then it's just the same as then_show. */
@ -54,7 +54,7 @@ void Sequence::first_show(byte what) {
} }
void Sequence::then_show(byte what) { void Sequence::then_show(byte what) {
for (byte fv = 0; fv < seq_length; fv++) { for (int16 fv = 0; fv < seq_length; fv++) {
if (seq[fv] == 0) { if (seq[fv] == 0) {
seq[fv] = what; seq[fv] = what;
return; return;

View file

@ -271,10 +271,10 @@ void triptype::bounce() {
_tr->_vm->_gyro->oncandopageswap = true; _tr->_vm->_gyro->oncandopageswap = true;
} }
int8 triptype::sgn(int16 x) { int8 triptype::sgn(int16 val) {
if (x > 0) if (val > 0)
return 1; return 1;
else if (x < 0) else if (val < 0)
return -1; return -1;
else else
return 0; return 0;
@ -465,12 +465,10 @@ Trip::Trip(AvalancheEngine *vm) {
} }
void Trip::loadtrip() { void Trip::loadtrip() {
byte gm; for (int16 gm = 0; gm < numtr; gm++)
for (gm = 0; gm < numtr; gm++)
tr[gm].original(); tr[gm].original();
for (int i = 0; i < sizeof(aa); i++) for (uint16 i = 0; i < sizeof(aa); i++)
aa[i] = 0; aa[i] = 0;
} }
@ -1084,8 +1082,8 @@ void Trip::newspeed() {
} }
void Trip::rwsp(byte t, byte r) { void Trip::rwsp(byte t, byte dir) {
switch (r) { switch (dir) {
case up: case up:
tr[t].speed(0, -tr[t].ys); tr[t].speed(0, -tr[t].ys);
break; break;

View file

@ -121,7 +121,7 @@ private:
bool collision_check(); bool collision_check();
int8 sgn(int16 x); int8 sgn(int16 val);
}; };
@ -198,7 +198,7 @@ public:
void tripkey(char dir); void tripkey(char dir);
void rwsp(byte t, byte r); void rwsp(byte t, byte dir);
void apped(byte trn, byte np); void apped(byte trn, byte np);