diff options
author | Paul Gilbert | 2014-03-01 17:28:24 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-03-01 17:28:24 -0500 |
commit | 7880ae0b18c3e2a25ed1c4a2bc42e22066d1ff3e (patch) | |
tree | 96de4f3470bd9bcc81bbae82a3e1c59f523a8edf /engines/avalanche | |
parent | badb8d97444767b7d8fea0f877ac044249696a5f (diff) | |
parent | 2218d14fb5276724c757406d5ac1ec581160721b (diff) | |
download | scummvm-rg350-7880ae0b18c3e2a25ed1c4a2bc42e22066d1ff3e.tar.gz scummvm-rg350-7880ae0b18c3e2a25ed1c4a2bc42e22066d1ff3e.tar.bz2 scummvm-rg350-7880ae0b18c3e2a25ed1c4a2bc42e22066d1ff3e.zip |
Merge branch 'master' into mads
Diffstat (limited to 'engines/avalanche')
38 files changed, 818 insertions, 321 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 74dd2100e5..1ec3dbd4d2 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index aa4e6482a4..375d117893 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 073b9a9425..27c366914a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -279,9 +279,9 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { if (!_favoriteSong.empty()) _favoriteSong.clear(); - uint16 favourite_songSize = 0; - sz.syncAsUint16LE(favourite_songSize); - for (uint16 i = 0; i < favourite_songSize; i++) { + uint16 favoriteSongSize = 0; + sz.syncAsUint16LE(favoriteSongSize); + for (uint16 i = 0; i < favoriteSongSize; i++) { sz.syncAsByte(actChr); _favoriteSong += actChr; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index d2e5678ae9..9d6ab1693a 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6648e8d961..2e89287f58 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 9afb4a7b63..04b945fd20 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index f49d103df3..e5b66c509b 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h index 67020c861d..98d6d36fed 100644 --- a/engines/avalanche/background.h +++ b/engines/avalanche/background.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/clock.cpp b/engines/avalanche/clock.cpp index 1c2c50c3bf..6d398d9921 100644 --- a/engines/avalanche/clock.cpp +++ b/engines/avalanche/clock.cpp @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. diff --git a/engines/avalanche/clock.h b/engines/avalanche/clock.h index 68e8e119f0..85ea508a80 100644 --- a/engines/avalanche/clock.h +++ b/engines/avalanche/clock.h @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 1cb2e84218..552b71b563 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/closing.h b/engines/avalanche/closing.h index 25217e347e..6e65deb310 100644 --- a/engines/avalanche/closing.h +++ b/engines/avalanche/closing.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/console.cpp b/engines/avalanche/console.cpp index e4b52116e4..29ae5cf9c3 100644 --- a/engines/avalanche/console.cpp +++ b/engines/avalanche/console.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/console.h b/engines/avalanche/console.h index 166515d913..b5b5fb63fc 100644 --- a/engines/avalanche/console.h +++ b/engines/avalanche/console.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 5f4f03a78b..028f167e70 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 2174df3580..36f6f4470c 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -455,7 +455,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { mx -= lx; my -= ly + 2; - bool centre = false; + bool center = false; byte iconIndent = 0; switch (_useIcon) { @@ -481,11 +481,11 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { if (!_scroll[i].empty()) switch (_scroll[i][_scroll[i].size() - 1]) { case kControlCenter: - centre = true; + center = true; _scroll[i].deleteLastChar(); break; case kControlLeftJustified: - centre = false; + center = false; _scroll[i].deleteLastChar(); break; case kControlQuestion: @@ -497,7 +497,7 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) { break; } - if (centre) + if (center) say(320 - _scroll[i].size() * 4 + iconIndent, my, _scroll[i]); else say(mx + iconIndent, my, _scroll[i]); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index defd152db5..4b50a61732 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h index 23192863f1..998c96a131 100644 --- a/engines/avalanche/enums.h +++ b/engines/avalanche/enums.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp index 6bd0da7834..1419a0cbab 100644 --- a/engines/avalanche/ghostroom.cpp +++ b/engines/avalanche/ghostroom.cpp @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. @@ -209,7 +209,7 @@ void GhostRoom::run() { CursorMan.showMouse(false); _vm->_graphics->saveScreen(); _vm->fadeOut(); - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen. + _vm->_graphics->blackOutScreen(); _vm->fadeIn(); // Only load the pictures if it's our first time walking into the room. @@ -257,7 +257,7 @@ void GhostRoom::run() { } // Blank out the Glerk's space. - _vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 530, 50), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 531, 51), kColorBlack); _vm->_graphics->refreshScreen(); @@ -265,7 +265,7 @@ void GhostRoom::run() { for (int y = -64; y <= 103; y++) { _vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y); if (y > 0) - _vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8, y), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8 + 1, y + 1), kColorBlack); _vm->_graphics->refreshScreen(); wait(27); @@ -276,7 +276,7 @@ void GhostRoom::run() { for (int i = 0; i < 4; i++) { for (int j = 0; j < 5; j++) { - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 169), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 170), kColorBlack); _vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]); _aarghCount++; @@ -320,12 +320,12 @@ void GhostRoom::run() { int xBound = x % 30; if ((22 <= xBound) && (xBound <= 27)) { if (xBound == 22) - _vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 134, x + 38, 138), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 134, x + 39, 138), kColorBlack); _vm->_graphics->ghostDrawPicture(_eyes[1], x + 23, 136); _vm->_graphics->drawDot(x + 22, 137, kColorBlack); } else { if (xBound == 28) - _vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 135, x + 38, 139), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 135, x + 39, 139), kColorBlack); _vm->_graphics->ghostDrawPicture(_eyes[1], x + 23, 135); _vm->_graphics->drawDot(x + 22, 136, kColorBlack); // Eyes would leave a trail 1 pixel high behind them. } diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h index b4917d8cb4..ebb02f7aac 100644 --- a/engines/avalanche/ghostroom.h +++ b/engines/avalanche/ghostroom.h @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index ab1a108194..9510f4f72a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -478,12 +478,16 @@ void GraphicManager::drawDebugLines() { } } +void GraphicManager::drawRectangle(Common::Rect rect, Color color) { + _surface.frameRect(rect, color); +} + void GraphicManager::drawFilledRectangle(Common::Rect rect, Color color) { _surface.fillRect(rect, color); } -void GraphicManager::drawRectangle(Common::Rect rect, Color color) { - _surface.frameRect(rect, color); +void GraphicManager::blackOutScreen() { + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); } void GraphicManager::nimLoad() { @@ -687,7 +691,7 @@ void GraphicManager::helpDrawHighlight(byte which, Color color) { return; which &= 31; - drawRectangle(Common::Rect(466, 38 + which * 27, 555, 63 + which * 27), color); + drawRectangle(Common::Rect(466, 38 + which * 27, 556, 63 + which * 27), color); } /** @@ -744,13 +748,46 @@ void GraphicManager::seuFree() { } /** - * @remarks Originally called 'display' + * @remarks Originally called 'display' and it also replaces 'display_const' */ void GraphicManager::seuDrawPicture(int x, int y, byte which) { drawPicture(_surface, _seuPictures[which], x, y); } /** + * @remarks Originally called 'cameo_display' + */ +void GraphicManager::seuDrawCameo(int destX, int destY, byte w1, byte w2) { + // First we make the pixels of the previous sprite (cameo) blank: + uint16 maxX = _seuPictures[w2].w; + uint16 maxY = _seuPictures[w2].h; + + if (destX + maxX > _surface.w) + maxX = _surface.w - destX; + + if (destY + maxY > _surface.h) + maxY = _surface.h - destY; + + for (uint16 y = 0; y < maxY; y++) { + for (uint16 x = 0; x < maxX; x++) { + if (*(const byte *)_seuPictures[w2].getBasePtr(x, y) != 0) + *(byte *)_surface.getBasePtr(x + destX, y + destY) = 0; + } + } + + // Then we draw the desired sprite: + drawPicture(_surface, _seuPictures[w1], destX, destY); +} + +uint16 GraphicManager::seuGetPicWidth(int which) { + return _seuPictures[which].w; +} + +uint16 GraphicManager::seuGetPicHeight(int which) { + return _seuPictures[which].h; +} + +/** * This function is for skipping the difference between a stored 'size' value associated with a picture * and the actual size of the pictures when reading them from files for Ghostroom and Shoot em' up. * It's needed bacuse the original code loaded the pictures to arrays first and only used the useful parts @@ -786,7 +823,10 @@ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) { byte pixel = file.readByte(); for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); + // If the picture's width is not a multiple of 8, and we get over the boundary with the 'x' cycle, pixelBit is surely == 0. + // Otherwise, it doesn't cause trouble, since addign 0 doesn't have an effect at all. + if (pixelBit != 0) + *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } } @@ -819,22 +859,21 @@ Graphics::Surface GraphicManager::loadPictureRaw(Common::File &file, uint16 widt return picture; } -Graphics::Surface GraphicManager::loadPictureSign(Common::File &file, int xl, int yl) { +Graphics::Surface GraphicManager::loadPictureSign(Common::File &file, uint16 width, uint16 height) { // I know it looks very similar to the other loadPicture methods, but in truth it's the combination of the two. - uint16 width = xl * 8; - uint16 height = yl; + width *= 8; Graphics::Surface picture; // We make a Surface object for the picture itself. picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (int yy = 0; yy < height; yy++) { + for (int y = 0; y < height; y++) { for (int8 plane = 0; plane < 4; plane++) { // The planes are in the "right" order. - for (uint16 xx = 0; xx < width; xx += 8) { + for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (int bit = 0; bit < 8; bit++) { byte pixelBit = (pixel >> bit) & 1; - *(byte *)picture.getBasePtr(xx + 7 - bit, yy) += (pixelBit << plane); + *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } } diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e5538bca7a..acc0c92a15 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -59,13 +59,14 @@ public: void loadDigits(); void loadMouse(byte which); + void drawRectangle(Common::Rect rect, Color color); + void drawFilledRectangle(Common::Rect rect, Color color); + void blackOutScreen(); void drawDot(int x, int y, Color color); void drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color); Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color); void drawTriangle(Common::Point *p, Color color); - void drawFilledRectangle(Common::Rect rect, Color color); - void drawRectangle(Common::Rect rect, Color color); void drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); void drawBigText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two. void drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); @@ -112,6 +113,9 @@ public: void seuLoad(); void seuFree(); void seuDrawPicture(int x, int y, byte which); + void seuDrawCameo(int destX, int destY, byte w1, byte w2); + uint16 seuGetPicWidth(int which); + uint16 seuGetPicHeight(int which); void clearAlso(); void clearTextBar(); @@ -177,7 +181,7 @@ private: // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. - Graphics::Surface loadPictureSign(Common::File &file, int xl, int yl); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim. + Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim. void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 0e60f5fadb..b24f6c40d8 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. @@ -180,6 +180,7 @@ bool Help::handleMouse(const Common::Event &event) { } else { // LBUTTONDOWN or MOUSEMOVE int highlightIs = 0; + // Decide which button we are hovering the cursor over: if ((mousePos.x > 470) && (mousePos.x <= 550) && (((mousePos.y - 13) % 27) <= 20)) { // No click, so highlight. highlightIs = (mousePos.y - 13) / 27 - 1; if ((highlightIs < 0) || (5 < highlightIs)) @@ -187,20 +188,21 @@ bool Help::handleMouse(const Common::Event &event) { } else highlightIs = 177; - if (((highlightIs != 177) && (event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft) { + Color highlightColor = kColorLightblue; + // If we clicked on a button or we are holding down the button, we have to highlight it with cyan: + if (((highlightIs != 177) && ((event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft)) { _holdLeft = true; - highlightIs += 32; + highlightColor = kColorLightcyan; } - if (_highlightWas != highlightIs) { + // Erase the previous highlight only if it's needed: + if (_highlightWas != highlightIs) _vm->_graphics->helpDrawHighlight(_highlightWas, kColorBlue); + + // Highligt the current one with the proper color: + if (_buttons[highlightIs]._trigger != Common::KEYCODE_INVALID) { _highlightWas = highlightIs; - if (_buttons[highlightIs & 31]._trigger != Common::KEYCODE_INVALID) { - if (highlightIs > 31) - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightcyan); - else - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightblue); - } + _vm->_graphics->helpDrawHighlight(highlightIs, highlightColor); } } diff --git a/engines/avalanche/help.h b/engines/avalanche/help.h index f31a73d189..7543d87047 100644 --- a/engines/avalanche/help.h +++ b/engines/avalanche/help.h @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index c3fa709ee4..af3caf880e 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index b7674fbb9d..f4833d31c4 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index e4897a6d49..9457a5065b 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -152,7 +152,7 @@ void Nim::setup() { _vm->fadeIn(); _vm->_graphics->nimLoad(); - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); + _vm->_graphics->blackOutScreen(); // Upper left rectangle. _vm->_graphics->drawRectangle(Common::Rect(10, 5, 381, 71), kColorRed); _vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 380, 70), kColorBrown); @@ -383,8 +383,8 @@ void Nim::takeSome() { int x1 = 63 + (_stones[_row] - _number) * 64; int y1 = 38 + 35 * (_row + 1); - int x2 = 54 + _stones[_row] * 64; - int y2 = 63 + 35 * (_row + 1); + int x2 = 55 + _stones[_row] * 64; + int y2 = 64 + 35 * (_row + 1); _vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlue); // Draw the selection rectangle. _vm->_graphics->refreshScreen(); @@ -396,8 +396,8 @@ void Nim::takeSome() { _vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlack); // Erase the previous selection. x1 = 63 + (_stones[_row] - _number) * 64; y1 = 38 + 35 * (_row + 1); - x2 = 54 + _stones[_row] * 64; - y2 = 63 + 35 * (_row + 1); + x2 = 55 + _stones[_row] * 64; + y2 = 64 + 35 * (_row + 1); _vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlue); // Draw the new one. _vm->_graphics->refreshScreen(); } diff --git a/engines/avalanche/nim.h b/engines/avalanche/nim.h index 7e5f55e69f..3c2f0455cf 100644 --- a/engines/avalanche/nim.h +++ b/engines/avalanche/nim.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 1a9585e2a3..5e58d1df5c 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 20066329e5..46408f518a 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 3a60c4ec1d..d63532a457 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index d3c1b54963..8062118059 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp index 79720fcb8c..bf041b5ad8 100644 --- a/engines/avalanche/shootemup.cpp +++ b/engines/avalanche/shootemup.cpp @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. @@ -32,13 +32,65 @@ namespace Avalanche { -const byte ShootEmUp::kFacingRight = 87; const byte ShootEmUp::kStocks = 27; +const byte ShootEmUp::kAvvyShoots = 86; +const byte ShootEmUp::kFacingRight = 87; +const byte ShootEmUp::kFacingLeft = 93; +const long int ShootEmUp::kFlag = -20047; +const byte ShootEmUp::kFrameDelayMax = 2; +const byte ShootEmUp::kAvvyY = 150; +const byte ShootEmUp::kShooting[7] = { 86, 79, 80, 81, 80, 79, 86 }; +const byte ShootEmUp::kTimesASecond = 18; +const byte ShootEmUp::kFlashTime = 20; // If flash_time is <= this, the word "time" will flash. Should be about 20. ShootEmUp::ShootEmUp(AvalancheEngine *vm) { _vm = vm; - _time = 0; + _time = 120; + for (int i = 0; i < 7; i++) + _stockStatus[i] = 0; + for (int i = 0; i < 99; i++) { + _sprites[i]._ix = 0; + _sprites[i]._iy = 0; + _sprites[i]._x = kFlag; + _sprites[i]._y = 0; + _sprites[i]._p = 0; + _sprites[i]._timeout = 0; + _sprites[i]._cameo = false; + _sprites[i]._cameoFrame = 0; + _sprites[i]._missile = false; + _sprites[i]._wipe = false; + } + _rectNum = 0; + _avvyWas = 320; + _avvyPos = 320; + _avvyAnim = 1; + _avvyFacing = kFacingLeft; + _altWasPressedBefore = false; + _throwNext = 74; + _firing = false; + for (int i = 0; i < 4; i++) { + _running[i]._x = kFlag; + _running[i]._y = 0; + _running[i]._frame = 0; + _running[i]._tooHigh = 0; + _running[i]._lowest = 0; + _running[i]._ix = 0; + _running[i]._iy = 0; + _running[i]._frameDelay = 0; + } + for (int i = 0; i < 7; i++) + _hasEscaped[i] = false; + _count321 = 255; // Counting down. + _howManyHaveEscaped = 0; + _escapeCount = 0; + _escaping = false; + _timeThisSecond = 0; + _cp = false; + _wasFacing = 0; + _score = 0; + _escapeStock = 0; + _gotOut = false; } void ShootEmUp::run() { @@ -62,11 +114,10 @@ void ShootEmUp::run() { } setup(); - initRunner(20, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2); - initRunner(600, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2); - initRunner(600, 100, 61, 67, -(_vm->_rnd->getRandomNumber(4)) + 1, _vm->_rnd->getRandomNumber(3) - 2); - initRunner(20, 100, 61, 67, -(_vm->_rnd->getRandomNumber(4)) + 1, _vm->_rnd->getRandomNumber(3) - 2); + do { + uint32 beginLoop = _vm->_system->getMillis(); + blankIt(); hitPeople(); plotThem(); @@ -80,6 +131,15 @@ void ShootEmUp::run() { updateTime(); check321(); readKbd(); + + _cp = !_cp; + + _vm->_graphics->refreshScreen(); + + uint32 delay = _vm->_system->getMillis() - beginLoop; + if (delay <= 55) + _vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight). + } while (_time != 0); _vm->fadeOut(); @@ -90,53 +150,142 @@ void ShootEmUp::run() { } bool ShootEmUp::overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y) { - warning("STUB: ShootEmUp::overlap()"); - return false; + // By De Morgan's law: + return (a2x >= b1x) && (b2x >= a1x) && (a2y >= b1y) && (b2y >= a1y); } -byte ShootEmUp::getStockNumber(byte x) { - warning("STUB: ShootEmUp::getStockNumber()"); - return 0; +byte ShootEmUp::getStockNumber(byte index) { + while (_hasEscaped[index]) { + index++; + if (index == 7) + index = 0; + } + return index; } void ShootEmUp::blankIt() { - warning("STUB: ShootEmUp::blankIt()"); + for (int i = 0; i < _rectNum; i++) + _vm->_graphics->drawFilledRectangle(_rectangles[i], kColorBlack); + _rectNum = 0; } void ShootEmUp::moveThem() { - warning("STUB: ShootEmUp::moveThem()"); + for (int i = 0; i < 99; i++) { + if (_sprites[i]._x != kFlag) { + _sprites[i]._x += _sprites[i]._ix; + _sprites[i]._y += _sprites[i]._iy; + } + } +} + +void ShootEmUp::blank(Common::Rect rect) { + _rectangles[_rectNum++] = rect; } void ShootEmUp::plotThem() { - warning("STUB: ShootEmUp::plotThem()"); + for (int i = 0; i < 99; i++) { + if (_sprites[i]._x != kFlag) { + if (_sprites[i]._cameo) { + _vm->_graphics->seuDrawCameo(_sprites[i]._x, _sprites[i]._y, _sprites[i]._p, _sprites[i]._cameoFrame); + if (!_cp) { + _sprites[i]._cameoFrame += 2; + _sprites[i]._p += 2; + } + } else + _vm->_graphics->seuDrawPicture(_sprites[i]._x, _sprites[i]._y, _sprites[i]._p); + + if (_sprites[i]._wipe) + blank(Common::Rect(_sprites[i]._x, _sprites[i]._y, _sprites[i]._x + _vm->_graphics->seuGetPicWidth(_sprites[i]._p), _sprites[i]._y + _vm->_graphics->seuGetPicHeight(_sprites[i]._p))); + + if (_sprites[i]._timeout > 0) { + _sprites[i]._timeout--; + if (_sprites[i]._timeout == 0) + _sprites[i]._x = kFlag; + } + } + } } -void ShootEmUp::define(int16 xx, int16 yy, byte pp, int8 ixx, int8 iyy, int16 time, bool isAMissile, bool doWeWipe) { - warning("STUB: ShootEmUp::define()"); +void ShootEmUp::define(int16 x, int16 y, int8 p, int8 ix, int8 iy, int16 time, bool isAMissile, bool doWeWipe) { + for (int i = 0; i < 99; i++) { + if (_sprites[i]._x == kFlag) { + _sprites[i]._x = x; + _sprites[i]._y = y; + _sprites[i]._p = p; + _sprites[i]._ix = ix; + _sprites[i]._iy = iy; + _sprites[i]._timeout = time; + _sprites[i]._cameo = false; + _sprites[i]._missile = isAMissile; + _sprites[i]._wipe = doWeWipe; + return; + } + } } -void ShootEmUp::defineCameo(int16 xx, int16 yy, byte pp, int16 time) { - warning("STUB: ShootEmUp::defineCameo()"); +void ShootEmUp::defineCameo(int16 x, int16 y, int8 p, int16 time) { + for (int i = 0; i < 99; i++) { + if (_sprites[i]._x == kFlag) { + _sprites[i]._x = x; + _sprites[i]._y = y; + _sprites[i]._p = p; + _sprites[i]._ix = 0; + _sprites[i]._iy = 0; + _sprites[i]._timeout = time; + _sprites[i]._cameo = true; + _sprites[i]._cameoFrame = p + 1; + _sprites[i]._missile = false; + _sprites[i]._wipe = false; + return; + } + } } -void ShootEmUp::showStock(byte x) { - warning("STUB: ShootEmUp::showStock()"); +void ShootEmUp::showStock(byte index) { + if (_escaping && (index == _escapeStock)) { + _vm->_graphics->seuDrawPicture(index * 90 + 20, 30, kStocks + 2); + return; + } + + if (_stockStatus[index] > 5) + return; + + _vm->_graphics->seuDrawPicture(index * 90 + 20, 30, kStocks + _stockStatus[index]); + _stockStatus[index] = 1 - _stockStatus[index]; +} + +void ShootEmUp::drawNumber(int number, int size, int x) { + for (int i = 0; i < size - 1; i++) { + int divisor = 10; + for (int j = 0; j < size - 2 - i; j++) + divisor *= 10; + char value = number / divisor; + _vm->_graphics->seuDrawPicture(x + i * 10, 0, value); + number -= value * divisor; + } + _vm->_graphics->seuDrawPicture(x + (size - 1) * 10, 0, number % 10); } void ShootEmUp::showScore() { - warning("STUB: ShootEmUp::showScore()"); + drawNumber(_score, 5, 40); } void ShootEmUp::showTime() { - warning("STUB: ShootEmUp::showTime()"); + drawNumber(_time, 3, 140); } void ShootEmUp::gain(int8 howMuch) { - warning("STUB: ShootEmUp::gain()"); + if ((_score + howMuch) < 0) // howMuch can be negative! + _score = 0; + else + _score += howMuch; + + showScore(); } void ShootEmUp::newEscape() { - warning("STUB: ShootEmUp::newEscape()"); + _escapeCount = _vm->_rnd->getRandomNumber(17) * 20; + _escaping = false; } void ShootEmUp::nextPage() { @@ -151,11 +300,11 @@ void ShootEmUp::nextPage() { } } - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); + _vm->_graphics->blackOutScreen(); } void ShootEmUp::instructions() { - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen. + _vm->_graphics->blackOutScreen(); _vm->_graphics->seuDrawPicture(25, 25, kFacingRight); _vm->_graphics->drawNormalText("< Avvy, our hero, needs your help - you must move him around.", _vm->_font, 8, 60, 35, kColorWhite); _vm->_graphics->drawNormalText("(He''s too terrified to move himself!)", _vm->_font, 8, 80, 45, kColorWhite); @@ -195,15 +344,79 @@ void ShootEmUp::instructions() { } void ShootEmUp::setup() { - warning("STUB: ShootEmUp::setup()"); + _vm->_graphics->blackOutScreen(); + + newEscape(); + + for (int i = 0; i < 7; i++) { + _stockStatus[i] = _vm->_rnd->getRandomNumber(1); + showStock(i); + } + + // Set up status line: + _vm->_graphics->seuDrawPicture(0, 0, 16); // Score: + showScore(); // Value of score (00000 here). + _vm->_graphics->seuDrawPicture(110, 0, 19); // Time: + showTime(); // Value of time. + + _vm->_graphics->refreshScreen(); + + // From the original core cycle: + initRunner(20, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2); + initRunner(600, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2); + initRunner(600, 100, 61, 67, (-(int8)_vm->_rnd->getRandomNumber(4)) + 1, _vm->_rnd->getRandomNumber(3) - 2); + initRunner(20, 100, 61, 67, (-(int8)_vm->_rnd->getRandomNumber(4)) + 1, _vm->_rnd->getRandomNumber(3) - 2); } -void ShootEmUp::initRunner(int16 xx, int16 yy, byte f1, byte f2, int8 ixx, int8 iyy) { - warning("STUB: ShootEmUp::initRunner()"); +void ShootEmUp::initRunner(int16 x, int16 y, byte f1, byte f2, int8 ix, int8 iy) { + for (int i = 0; i < 4; i++) { + if (_running[i]._x == kFlag) { + _running[i]._x = x; + _running[i]._y = y; + _running[i]._frame = f1; + _running[i]._tooHigh = f2; + _running[i]._lowest = f1; + _running[i]._ix = ix; + _running[i]._iy = iy; + if ((ix == 0) && (iy == 0)) + _running[i]._ix = 2; // To stop them running on the spot! + _running[i]._frameDelay = kFrameDelayMax; + return; + } + } } void ShootEmUp::moveAvvy() { - warning("STUB: ShootEmUp::moveAvvy()"); + if (_avvyWas < _avvyPos) + _avvyFacing = kFacingRight; + else if (_avvyWas > _avvyPos) + _avvyFacing = kFacingLeft; + + if (!_firing) { + if (_avvyWas == _avvyPos) + _avvyAnim = 1; + else { + _avvyAnim++; + if (_avvyAnim == 6) + _avvyAnim = 0; + } + } + + if (_avvyFacing == kAvvyShoots) + define(_avvyPos, kAvvyY, kShooting[_avvyAnim], 0, 0, 1, false, true); + else + define(_avvyPos, kAvvyY, _avvyAnim + _avvyFacing, 0, 0, 1, false, true); + + _avvyWas = _avvyPos; + + if (_avvyFacing == kAvvyShoots) { + if (_avvyAnim == 6) { + _avvyFacing = _wasFacing; + _avvyAnim = 0; + _firing = false; + } else + _avvyAnim++; + } } void ShootEmUp::readKbd() { @@ -211,39 +424,225 @@ void ShootEmUp::readKbd() { } void ShootEmUp::animate() { - warning("STUB: ShootEmUp::animate()"); + if (_vm->_rnd->getRandomNumber(9) == 1) + showStock(getStockNumber(_vm->_rnd->getRandomNumber(5))); + for (int i = 0; i < 7; i++) { + if (_stockStatus[i] > 5) { + _stockStatus[i]--; + if (_stockStatus[i] == 8) { + _stockStatus[i] = 0; + showStock(i); + } + } + } } void ShootEmUp::collisionCheck() { - warning("STUB: ShootEmUp::collisionCheck()"); + for (int i = 0; i < 99; i++) { + if ((_sprites[i]._x != kFlag) && (_sprites[i]._missile) && + (_sprites[i]._y < 60) && (_sprites[i]._timeout == 1)) { + int distFromSide = (_sprites[i]._x - 20) % 90; + int thisStock = (_sprites[i]._x - 20) / 90; + if ((!_hasEscaped[thisStock]) && (distFromSide > 17) && (distFromSide < 34)) { + _vm->_sound->playNote(999, 3); + _vm->_system->delayMillis(3); + define(_sprites[i]._x + 20, _sprites[i]._y, 25 + _vm->_rnd->getRandomNumber(1), 3, 1, 12, false, true); // Well done! + define(thisStock * 90 + 20, 30, 30, 0, 0, 7, false, false); // Face of man + defineCameo(thisStock * 90 + 20 + 10, 35, 40, 7); // Splat! + define(thisStock * 90 + 20 + 20, 50, 33 + _vm->_rnd->getRandomNumber(4), 0, 2, 9, false, true); // Oof! + _stockStatus[thisStock] = 17; + gain(3); // Score for hitting a face. + + if (_escaping && (_escapeStock = thisStock)) { // Hit the escaper. + _vm->_sound->playNote(1777, 1); + _vm->_system->delayMillis(1); + gain(5); // Bonus for hitting escaper. + _escaping = false; + newEscape(); + } + } else { + define(_sprites[i]._x, _sprites[i]._y, 82 + _vm->_rnd->getRandomNumber(2), 2, 2, 17, false, true); // Missed! + if ((!_hasEscaped[thisStock]) && (distFromSide > 3) && (distFromSide < 43)) { + define(thisStock * 90 + 20, 30, 29, 0, 0, 7, false, false); // Face of man + if (distFromSide > 35) + defineCameo(_sprites[i]._x - 27, 35, 40, 7); // Splat! + else + defineCameo(_sprites[i]._x - 7, 35, 40, 7); + _stockStatus[thisStock] = 17; + } + } + } + } } void ShootEmUp::turnAround(byte who, bool randomX) { - warning("STUB: ShootEmUp::turnAround()"); + if (randomX) { + int8 ix = (_vm->_rnd->getRandomNumber(4) + 1); + if (_running[who]._ix > 0) + _running[who]._ix = -(ix); + else + _running[who]._ix = ix; + } else + _running[who]._ix = -(_running[who]._ix); + + _running[who]._iy = -(_running[who]._iy); } void ShootEmUp::bumpFolk() { - warning("STUB: ShootEmUp::bumpFolk()"); + for (int i = 0; i < 4; i++) { + if (_running[i]._x != kFlag) { + for (int j = i + 1; j < 4; j++) { + bool overlaps = overlap(_running[i]._x, _running[i]._y, _running[i]._x + 17, _running[i]._y + 24, + _running[j]._x, _running[j]._y, _running[j]._x + 17, _running[j]._y + 24); + if ((_running[i]._x != kFlag) && overlaps) { + turnAround(i, false); // Opp. directions. + turnAround(j, false); + } + } + } + } } void ShootEmUp::peopleRunning() { - warning("STUB: ShootEmUp::peopleRunning()"); + if (_count321 != 0) + return; + + for (int i = 0; i < 4; i++) { + if (_running[i]._x != kFlag) { + if (((_running[i]._y + _running[i]._iy) <= 53) || ((_running[i]._y + _running[i]._iy) >= 120)) + _running[i]._iy = -(_running[i]._iy); + + byte frame = 0; + if (_running[i]._ix < 0) + frame = _running[i]._frame - 1; + else + frame = _running[i]._frame + 6; + define(_running[i]._x, _running[i]._y, frame, 0, 0, 1, false, true); + + if (_running[i]._frameDelay == 0) { + _running[i]._frame++; + if (_running[i]._frame == _running[i]._tooHigh) + _running[i]._frame = _running[i]._lowest; + _running[i]._frameDelay = kFrameDelayMax; + _running[i]._y += _running[i]._iy; + } else + _running[i]._frameDelay--; + + if (((_running[i]._x + _running[i]._ix) <= 0) || ((_running[i]._x + _running[i]._ix) >= 620)) + turnAround(i, true); + + _running[i]._x += _running[i]._ix; + } + } } void ShootEmUp::updateTime() { - warning("STUB: ShootEmUp::updateTime()"); + if (_count321 != 0) + return; + + _timeThisSecond++; + + if (_timeThisSecond < kTimesASecond) + return; + + _time--; + showTime(); + _timeThisSecond = 0; + + if (_time <= kFlashTime) { + int timeMode = 0; + if ((_time % 2) == 1) + timeMode = 19; // Normal 'Time:' + else + timeMode = 85; // Flash 'Time:' + + _vm->_graphics->seuDrawPicture(110, 0, timeMode); + } } void ShootEmUp::hitPeople() { - warning("STUB: ShootEmUp::hitPeople()"); + if (_count321 != 0) + return; + + for (int i = 0; i < 99; i++) { + if ((_sprites[i]._missile) && (_sprites[i]._x != kFlag)) { + for (int j = 0; j < 4; j++) { + + bool overlaps = overlap(_sprites[i]._x, _sprites[i]._y, _sprites[i]._x + 7, _sprites[i]._y + 10, + _running[j]._x, _running[j]._y, _running[j]._x + 17, _running[j]._y + 24); + + if ((_running[j]._x != kFlag) && (overlaps)) { + _vm->_sound->playNote(7177, 1); + _sprites[i]._x = kFlag; + gain(-5); + define(_running[j]._x + 20, _running[j]._y + 3, 33 + _vm->_rnd->getRandomNumber(5), 1, 3, 9, false, true); // Oof! + define(_sprites[i]._x, _sprites[i]._y, 82, 1, 0, 17, false, true); // Oops! + } + } + } + } } void ShootEmUp::escapeCheck() { - warning("STUB: ShootEmUp::escapeCheck()"); + if (_count321 != 0) + return; + + if (_escapeCount > 0) { + _escapeCount--; + return; + } + + // Escape_count = 0; now what ? + + if (_escaping) { + if (_gotOut) { + newEscape(); + _escaping = false; + _vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 4); + } else { + _vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 5); + _escapeCount = 20; + _gotOut = true; + define(_escapeStock * 90 + 20, 50, 24, 0, 2, 17, false, true); // Escaped! + gain(-10); + _hasEscaped[_escapeStock] = true; + + _howManyHaveEscaped++; + + if (_howManyHaveEscaped == 7) { + _vm->_graphics->seuDrawPicture(266, 90, 23); + _time = 0; + } + } + } else { + _escapeStock = getStockNumber(_vm->_rnd->getRandomNumber(6)); + _escaping = true; + _gotOut = false; + _vm->_graphics->seuDrawPicture(_escapeStock * 90 + 20, 30, kStocks + 2); // Smiling! + _escapeCount = 200; + } } void ShootEmUp::check321() { - warning("STUB: ShootEmUp::check321()"); + if (_count321 == 0) + return; + + _count321--; + + switch (_count321) { + case 84: + define(320, 60, 15, 2, 1, 94, false, true); + break; + case 169: + define(320, 60, 14, 0, 1, 94, false, true); + break; + case 254: + define(320, 60, 13, -2, 1, 94, false, true); + define(0, 100, 17, 2, 0, 254, false, true); + break; + default: + break; + } } } // End of namespace Avalanche diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h index b2cf8ba34a..ada39066fd 100644 --- a/engines/avalanche/shootemup.h +++ b/engines/avalanche/shootemup.h @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. @@ -38,21 +38,74 @@ public: void run(); private: - static const byte kFacingRight; + struct Sprite { + int8 _ix, _iy; + int16 _x, _y; + int8 _p; + int16 _timeout; + bool _cameo; + byte _cameoFrame; + bool _missile; + bool _wipe; + }; + + struct Runner { + int16 _x, _y; + byte _frame; + byte _tooHigh; + byte _lowest; + int8 _ix, _iy; + byte _frameDelay; + }; + static const byte kStocks; + static const byte kAvvyShoots; + static const byte kFacingRight; + static const byte kFacingLeft; + static const long int kFlag; + static const byte kFrameDelayMax; + static const byte kAvvyY; + static const byte kShooting[7]; + static const byte kTimesASecond; + static const byte kFlashTime; AvalancheEngine *_vm; + uint16 _score; byte _time; + byte _stockStatus[7]; + Sprite _sprites[99]; + byte _rectNum; // Original: 'rsize' + Common::Rect _rectangles[99]; + uint16 _avvyWas; + uint16 _avvyPos; + byte _avvyAnim; + byte _avvyFacing; + bool _altWasPressedBefore; + byte _throwNext; + bool _firing; + Runner _running[4]; + bool _hasEscaped[7]; + byte _count321; + byte _howManyHaveEscaped; + uint16 _escapeCount; + bool _escaping; + byte _timeThisSecond; + bool _cp; + byte _wasFacing; + byte _escapeStock; + bool _gotOut; bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y); - byte getStockNumber(byte x); + byte getStockNumber(byte index); void blankIt(); void moveThem(); + void blank(Common::Rect rect); void plotThem(); - void define(int16 xx, int16 yy, byte pp, int8 ixx, int8 iyy, int16 time, bool isAMissile, bool doWeWipe); - void defineCameo(int16 xx, int16 yy, byte pp, int16 time); - void showStock(byte x); + void define(int16 x, int16 y, int8 p, int8 ix, int8 iy, int16 time, bool isAMissile, bool doWeWipe); + void defineCameo(int16 x, int16 y, int8 p, int16 time); + void showStock(byte index); + void drawNumber(int number, int size, int x); void showScore(); void showTime(); void gain(int8 howMuch); diff --git a/engines/avalanche/sound.cpp b/engines/avalanche/sound.cpp index c324df4713..229d046cc1 100644 --- a/engines/avalanche/sound.cpp +++ b/engines/avalanche/sound.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/sound.h b/engines/avalanche/sound.h index 25b6b267d3..a67016a206 100644 --- a/engines/avalanche/sound.h +++ b/engines/avalanche/sound.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index b7a8433e71..69e0d84b3c 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/avalanche/timer.h b/engines/avalanche/timer.h index 9a91c4d24b..fd51544fd1 100644 --- a/engines/avalanche/timer.h +++ b/engines/avalanche/timer.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |