From 6d38d25af3168c3b56f11179afa1f51ccaffeda1 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 14 Feb 2014 13:31:08 +0100 Subject: AVALANCHE: Add ShootEmUp's skeleton. --- engines/avalanche/avalanche.cpp | 3 + engines/avalanche/avalanche.h | 2 + engines/avalanche/module.mk | 3 +- engines/avalanche/shootemup.cpp | 179 ++++++++++++++++++++++++++++++++++++++++ engines/avalanche/shootemup.h | 77 +++++++++++++++++ engines/avalanche/timer.cpp | 5 +- 6 files changed, 265 insertions(+), 4 deletions(-) create mode 100644 engines/avalanche/shootemup.cpp create mode 100644 engines/avalanche/shootemup.h (limited to 'engines/avalanche') diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d04f2f8458..073b9a9425 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -57,6 +57,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * _nim = nullptr; _ghostroom = nullptr; _help = nullptr; + _shootemup = nullptr; _platform = gd->desc.platform; initVariables(); @@ -81,6 +82,7 @@ AvalancheEngine::~AvalancheEngine() { delete _nim; delete _ghostroom; delete _help; + delete _shootemup; for (int i = 0; i < 31; i++) { for (int j = 0; j < 2; j++) { @@ -165,6 +167,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _nim = new Nim(this); _ghostroom = new GhostRoom(this); _help = new Help(this); + _shootemup = new ShootEmUp(this); _graphics->init(); _dialogs->init(); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 5e5bc34464..d2e5678ae9 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -44,6 +44,7 @@ #include "avalanche/clock.h" #include "avalanche/ghostroom.h" #include "avalanche/help.h" +#include "avalanche/shootemup.h" #include "common/serializer.h" @@ -89,6 +90,7 @@ public: Nim *_nim; GhostRoom *_ghostroom; Help *_help; + ShootEmUp *_shootemup; OSystem *_system; diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 3ee29dc3c7..eb95e32585 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -18,7 +18,8 @@ MODULE_OBJS = \ nim.o \ clock.o \ ghostroom.o \ - help.o + help.o \ + shootemup.o # This module can be built as a plugin ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN) diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp new file mode 100644 index 0000000000..01c5a1977b --- /dev/null +++ b/engines/avalanche/shootemup.cpp @@ -0,0 +1,179 @@ +/* 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. +* +*/ + +/* +* This code is based on the original source code of Lord Avalot d'Argent version 1.3. +* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. +*/ + +#include "avalanche/avalanche.h" +#include "avalanche/shootemup.h" + +#include "common/random.h" + +namespace Avalanche { + +ShootEmUp::ShootEmUp(AvalancheEngine *vm) { + _vm = vm; + + _time = 0; +} + +void ShootEmUp::run() { + titles(); + 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 { + blankIt(); + hitPeople(); + plotThem(); + moveThem(); + moveAvvy(); + bumpFolk(); + peopleRunning(); + animate(); + escapeCheck(); + collisionCheck(); + updateTime(); + check321(); + readKbd(); + } while (_time != 0); +} + +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; +} + +byte ShootEmUp::getStockNumber(byte x) { + warning("STUB: ShootEmUp::getStockNumber()"); + return 0; +} + +void ShootEmUp::blankIt() { + warning("STUB: ShootEmUp::blankIt()"); +} + +void ShootEmUp::moveThem() { + warning("STUB: ShootEmUp::moveThem()"); +} + +void ShootEmUp::plotThem() { + warning("STUB: ShootEmUp::plotThem()"); +} + +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::defineCameo(int16 xx, int16 yy, byte pp, int16 time) { + warning("STUB: ShootEmUp::defineCameo()"); +} + +void ShootEmUp::showStock(byte x) { + warning("STUB: ShootEmUp::showStock()"); +} + +void ShootEmUp::showScore() { + warning("STUB: ShootEmUp::showScore()"); +} + +void ShootEmUp::showTime() { + warning("STUB: ShootEmUp::showTime()"); +} + +void ShootEmUp::gain(int8 howMuch) { + warning("STUB: ShootEmUp::gain()"); +} + +void ShootEmUp::newEscape() { + warning("STUB: ShootEmUp::newEscape()"); +} + +void ShootEmUp::nextPage() { + warning("STUB: ShootEmUp::nextPage()"); +} + +void ShootEmUp::instructions() { + warning("STUB: ShootEmUp::instructions()"); +} + +void ShootEmUp::setup() { + warning("STUB: ShootEmUp::setup()"); +} + +void ShootEmUp::initRunner(int16 xx, int16 yy, byte f1, byte f2, int8 ixx, int8 iyy) { + warning("STUB: ShootEmUp::initRunner()"); +} + +void ShootEmUp::titles() { + warning("STUB: ShootEmUp::titles()"); +} + +void ShootEmUp::moveAvvy() { + warning("STUB: ShootEmUp::moveAvvy()"); +} + +void ShootEmUp::readKbd() { + warning("STUB: ShootEmUp::readKbd()"); +} + +void ShootEmUp::animate() { + warning("STUB: ShootEmUp::animate()"); +} + +void ShootEmUp::collisionCheck() { + warning("STUB: ShootEmUp::collisionCheck()"); +} + +void ShootEmUp::turnAround(byte who, bool randomX) { + warning("STUB: ShootEmUp::turnAround()"); +} + +void ShootEmUp::bumpFolk() { + warning("STUB: ShootEmUp::bumpFolk()"); +} + +void ShootEmUp::peopleRunning() { + warning("STUB: ShootEmUp::peopleRunning()"); +} + +void ShootEmUp::updateTime() { + warning("STUB: ShootEmUp::updateTime()"); +} + +void ShootEmUp::hitPeople() { + warning("STUB: ShootEmUp::hitPeople()"); +} + +void ShootEmUp::escapeCheck() { + warning("STUB: ShootEmUp::escapeCheck()"); +} + +void ShootEmUp::check321() { + warning("STUB: ShootEmUp::check321()"); +} + +} // End of namespace Avalanche diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h new file mode 100644 index 0000000000..6a1f182881 --- /dev/null +++ b/engines/avalanche/shootemup.h @@ -0,0 +1,77 @@ +/* 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. +* +*/ + +/* +* This code is based on the original source code of Lord Avalot d'Argent version 1.3. +* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. +*/ + +#ifndef AVALANCHE_SHOOTEMUP_H +#define AVALANCHE_SHOOTEMUP_H + +namespace Avalanche { +class AvalancheEngine; + +class ShootEmUp { +public: + ShootEmUp(AvalancheEngine *vm); + + void run(); + +private: + AvalancheEngine *_vm; + + byte _time; + + bool overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y); + byte getStockNumber(byte x); + void blankIt(); + void moveThem(); + 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 showScore(); + void showTime(); + void gain(int8 howMuch); + void newEscape(); + void nextPage(); // Internal function of 'instructions' in the original. + void instructions(); + void setup(); + void initRunner(int16 xx, int16 yy, byte f1, byte f2, int8 ixx, int8 iyy); + void titles(); + void moveAvvy(); + void readKbd(); + void animate(); + void collisionCheck(); + void turnAround(byte who, bool randomX); + void bumpFolk(); + void peopleRunning(); + void updateTime(); + void hitPeople(); + void escapeCheck(); + void check321(); +}; + +} // End of namespace Avalanche + +#endif // AVALANCHE_SHOOTEMUP_H diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index f63098aea8..b7a8433e71 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -327,12 +327,11 @@ void Timer::hangAround2() { _vm->_animation->_sprites[0]->remove(); spr->remove(); // Get rid of Robin Hood and Friar Tuck. - addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); - // Immediately call the following proc (when you have a chance). + addTimer(1, kProcAfterTheShootemup, kReasonHangingAround); // Immediately call the following proc (when you have a chance). _vm->_tiedUp = false; - // _vm->_enid->backToBootstrap(1); Call the shoot-'em-up. TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then! + _vm->_shootemup->run(); } void Timer::afterTheShootemup() { -- cgit v1.2.3