Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

2
engines/bbvs/POTFILES Normal file
View File

@@ -0,0 +1,2 @@
engines/bbvs/bbvs.cpp
engines/bbvs/metaengine.cpp

1436
engines/bbvs/bbvs.cpp Normal file

File diff suppressed because it is too large Load Diff

469
engines/bbvs/bbvs.h Normal file
View File

@@ -0,0 +1,469 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_BBVS_H
#define BBVS_BBVS_H
#include "audio/mixer.h"
#include "common/array.h"
#include "common/events.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/random.h"
#include "common/str.h"
#include "common/substream.h"
#include "common/system.h"
#include "engines/engine.h"
#include "bbvs/detection.h"
struct ADGameDescription;
namespace Bbvs {
class ActionCommands;
struct Action;
class GameModule;
struct Condition;
struct Conditions;
struct ActionResult;
struct ActionResults;
struct ActionCommand;
struct CameraInit;
struct SceneObjectDef;
struct SceneObjectInit;
struct SceneExit;
struct Animation;
struct SceneSound;
class DrawList;
class SpriteModule;
class Screen;
class SoundMan;
#define BBVS_SAVEGAME_VERSION 0
enum BBVSAction {
kActionNone,
kActionInventory,
kActionLook,
kActionTalk,
kActionUse,
kActionWalk,
kActionEscape
};
enum {
kVerbLook = 0,
kVerbUse = 1,
kVerbTalk = 2,
kVerbWalk = 3,
kVerbInvItem = 4,
kVerbShowInv = 5
};
enum {
kITNone = 0,
kITEmpty = 1,
KITSceneObject = 2,
kITBgObject = 3,
kITDialog = 4,
kITScroll = 5,
kITSceneExit = 6,
kITInvItem = 7
};
enum {
kGSScene = 0,
kGSInventory = 1,
kGSVerbs = 2,
kGSWait = 3,
kGSDialog = 4,
kGSWaitDialog = 5
};
enum {
kActionCmdStop = 0,
kActionCmdWalkObject = 3,
kActionCmdMoveObject = 4,
kActionCmdAnimObject = 5,
kActionCmdSetCameraPos = 7,
kActionCmdPlaySpeech = 8,
kActionCmdPlaySound = 10,
kActionCmdStartBackgroundSound = 11,
kActionCmdStopBackgroundSound = 12
};
enum {
kCondUnused = 1,
kCondSceneObjectVerb = 2,
kCondBgObjectVerb = 3,
kCondSceneObjectInventory = 4,
kCondBgObjectInventory = 5,
kCondHasInventoryItem = 6,
kCondHasNotInventoryItem = 7,
kCondIsGameVar = 8,
kCondIsNotGameVar = 9,
kCondIsPrevSceneNum = 10,
kCondIsCurrTalkObject = 11,
kCondIsDialogItem = 12,
kCondIsCameraNum = 13,
kCondIsNotPrevSceneNum = 14,
kCondDialogItem0 = 15,
kCondIsButtheadAtBgObject = 16,
kCondIsNotSceneVisited = 17,
kCondIsSceneVisited = 18,
kCondIsCameraNumTransition = 19
};
enum {
kActResAddInventoryItem = 1,
kActResRemoveInventoryItem = 2,
kActResSetGameVar = 3,
kActResUnsetGameVar = 4,
kActResStartDialog = 5,
kActResChangeScene = 6
};
enum {
kLeftButtonClicked = 1,
kRightButtonClicked = 2,
kLeftButtonDown = 4,
kRightButtonDown = 8,
kAnyButtonClicked = kLeftButtonClicked | kRightButtonClicked,
kAnyButtonDown = kLeftButtonDown | kRightButtonDown
};
struct BBPoint {
int16 x, y;
};
struct BBRect {
int16 x, y, width, height;
};
struct BBPolygon {
const BBPoint *points;
int pointsCount;
};
struct Rect {
int16 left, top, right, bottom;
};
struct SceneObject {
uint32 x, y;
SceneObjectDef *sceneObjectDef;
Animation *anim;
int animIndex;
int frameIndex;
int frameTicks;
int walkCount;
int xIncr, yIncr;
int turnValue, turnCount, turnTicks;
Common::Point walkDestPt;
SceneObject() {
clear();
}
void clear() {
x = 0;
y = 0;
sceneObjectDef = nullptr;
anim = nullptr;
animIndex = 0;
frameIndex = 0;
frameTicks = 0;
walkCount = 0;
xIncr = 0;
yIncr = 0;
turnValue = 0;
turnCount = 0;
turnTicks = 0;
walkDestPt.x = 0;
walkDestPt.y = 0;
}
};
struct SceneObjectAction {
int sceneObjectIndex;
int animationIndex;
Common::Point walkDest;
};
struct WalkInfo {
int16 x, y;
int delta;
int direction;
Common::Point midPt;
int walkAreaIndex;
};
struct WalkArea {
int16 x, y, width, height;
bool checked;
int linksCount;
WalkArea *links[16];
WalkInfo *linksD1[32];
WalkInfo *linksD2[32];
bool contains(const Common::Point &pt) const;
};
const int kSnapshotSize = 23072;
const int kSceneObjectsCount = 64;
const int kSceneSoundsCount = 8;
const int kInventoryItemStatusCount = 50;
const int kDialogItemStatusCount = 50;
const int kGameVarsCount = 2000;
const int kSceneVisitedCount = 64;
const int kMainMenu = 44;
const int kCredits = 45;
const int kMaxDistance = 0xFFFFFF;
static const int8 kWalkTurnTbl[] = {
7, 9, 4, 8, 6, 10, 5, 11
};
class BbvsEngine : public Engine {
protected:
Common::Error run() override;
bool hasFeature(EngineFeature f) const override;
public:
BbvsEngine(OSystem *syst, const ADGameDescription *gd);
~BbvsEngine() override;
void newGame();
void continueGameFromQuickSave();
void setNewSceneNum(int newSceneNum);
const Common::String getTargetName() { return _targetName; }
const ADGameDescription *_gameDescription;
bool isDemo() const;
bool isLoogieDemo() const;
bool isLoogieAltDemo() const;
/**
* Disable support for ScummVM autosaves.
* This engine automatically saves to slot zero on every room change.
* The Continue button on the main menu loads this save.
*/
int getAutosaveSlot() const override { return -1; }
private:
Graphics::PixelFormat _pixelFormat;
#ifdef USE_TRANSLATION
Common::String _oldGUILanguage;
#endif
public:
Common::RandomSource *_random;
GameModule *_gameModule;
SpriteModule *_spriteModule;
SoundMan *_sound;
Screen *_screen;
int _bootSaveSlot;
int _mouseX, _mouseY;
uint _mouseButtons;
Common::KeyCode _keyCode;
Common::CustomEventType _customAction;
int _mouseCursorSpriteIndex;
int _gameState;
int _gameTicks;
Common::Point _mousePos;
Common::Point _verbPos;
Common::Point _walkMousePos;
int _activeItemType;
int _activeItemIndex;
int _currTalkObjectIndex;
Common::Point _cameraPos, _newCameraPos;
int _newSceneNum, _prevSceneNum, _currSceneNum;
int _playVideoNumber;
int _dialogSlotCount;
byte _dialogItemStatus[kDialogItemStatusCount];
byte _gameVars[kGameVarsCount];
byte _sceneVisited[kSceneVisitedCount];
int _currVerbNum;
int _currInventoryItem;
byte _inventoryItemStatus[kInventoryItemStatusCount];
int _inventoryButtonIndex;
Action *_currAction;
uint32 _currActionCommandTimeStamp;
int _currActionCommandIndex;
Common::Array<Action*> _walkAreaActions;
SceneObject _sceneObjects[kSceneObjectsCount];
Common::Array<SceneObjectAction> _sceneObjectActions;
SceneObject *_buttheadObject, *_beavisObject;
int _currCameraNum;
byte _backgroundSoundsActive[kSceneSoundsCount];
Audio::SoundHandle _speechSoundHandle;
int _walkAreasCount;
WalkArea _walkAreas[80];
int _walkInfosCount;
WalkInfo _walkInfos[256];
int _walkableRectsCount;
Common::Rect _walkableRects[256];
Common::Rect _tempWalkableRects1[256];
Common::Rect _tempWalkableRects2[256];
WalkInfo *_walkInfoPtrs[256];
WalkArea *_sourceWalkArea, *_destWalkArea;
Common::Point _sourceWalkAreaPt, _destWalkAreaPt, _finalWalkPt;
int _currWalkDistance;
bool _walkReachedDestArea;
bool _hasSnapshot;
byte *_snapshot;
Common::SeekableMemoryWriteStream *_snapshotStream;
char _easterEggInput[7];
void updateEvents();
int getRandom(int max);
void drawDebugInfo();
void drawScreen();
void updateGame();
bool evalCondition(Conditions &conditions);
bool evalCameraCondition(Conditions &conditions, int value);
int evalDialogCondition(Conditions &conditions);
void evalActionResults(ActionResults &results);
void updateBackgroundSounds();
void loadScene(int sceneNum);
void initScene(bool sounds);
bool changeScene();
bool update(int mouseX, int mouseY, uint mouseButtons, Common::CustomEventType customAction);
void buildDrawList(DrawList &drawList);
void updateVerbs();
void updateDialog(bool clicked);
void updateInventory(bool clicked);
void updateScene(bool clicked);
bool performActionCommand(ActionCommand *actionCommand);
bool processCurrAction();
void skipCurrAction();
void updateCommon();
void updateWalkableRects();
void startWalkObject(SceneObject *sceneObject);
void updateWalkObject(SceneObject *sceneObject);
void walkObject(SceneObject *sceneObject, const Common::Point &destPt, int walkSpeed);
void turnObject(SceneObject *sceneObject);
int rectSubtract(const Common::Rect &rect1, const Common::Rect &rect2, Common::Rect *outRects);
WalkInfo *addWalkInfo(int16 x, int16 y, int delta, int direction, int16 midPtX, int16 midPtY, int walkAreaIndex);
void initWalkAreas(SceneObject *sceneObject);
WalkArea *getWalkAreaAtPos(const Common::Point &pt);
bool canButtheadWalkToDest(const Common::Point &destPt);
void canWalkToDest(WalkArea *walkArea, int infoCount);
bool walkTestLineWalkable(const Common::Point &sourcePt, const Common::Point &destPt, WalkInfo *walkInfo);
void walkFindPath(WalkArea *sourceWalkArea, int infoCount);
int calcDistance(const Common::Point &pt1, const Common::Point &pt2);
void walkFoundPath(int count);
void updateSceneObjectsTurnValue();
void updateDialogConditions();
void playSpeech(int soundNum);
void stopSpeech();
void playSound(uint soundNum, bool loop = false);
void stopSound(uint soundNum);
void stopSounds();
bool runMinigame(int minigameNum);
void playVideo(int videoNum);
void runMainMenu();
void checkEasterEgg(char key);
// Savegame API
enum kReadSaveHeaderError {
kRSHENoError = 0,
kRSHEInvalidType = 1,
kRSHEInvalidVersion = 2,
kRSHEIoError = 3
};
struct SaveHeader {
Common::String description;
uint32 version;
byte gameID;
uint32 flags;
uint32 saveDate;
uint32 saveTime;
uint32 playTime;
Graphics::Surface *thumbnail;
};
bool _isSaveAllowed;
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return _isSaveAllowed; }
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return _isSaveAllowed; }
Common::Error loadGameState(int slot) override;
Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave = false) override;
void savegame(const char *filename, const char *description);
void loadgame(const char *filename);
bool existsSavegame(int num);
static Common::String getSavegameFilename(const Common::String &target, int num);
WARN_UNUSED_RESULT static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
void allocSnapshot();
void freeSnapshot();
void saveSnapshot();
void writeContinueSavegame();
};
} // End of namespace Bbvs
#endif // BBVS_BBVS_H

View File

@@ -0,0 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
add_engine bbvs "Beavis and Butthead in Virtual Stupidity" yes "" "" "indeo3" ""

3
engines/bbvs/credits.pl Normal file
View File

@@ -0,0 +1,3 @@
begin_section("BBVS");
add_person("Benjamin Haisch", "john_doe", "");
end_section();

115
engines/bbvs/detection.cpp Normal file
View File

@@ -0,0 +1,115 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "engines/advancedDetector.h"
#include "base/plugins.h"
#include "bbvs/detection.h"
static const PlainGameDescriptor bbvsGames[] = {
{ "bbvs", "Beavis and Butt-Head in Virtual Stupidity" },
{ nullptr, nullptr }
};
namespace Bbvs {
static const ADGameDescription gameDescriptions[] = {
{
"bbvs",
nullptr,
AD_ENTRY1s("vspr0001.vnm", "7ffe9b9e7ca322db1d48e86f5130578e", 1166628),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DROPPLATFORM,
GUIO1(GUIO_NOMIDI)
},
{
"bbvs",
"Demo",
AD_ENTRY1s("vspr0007.vnm", "5db44940fa93fdd5becb5c2a5ded7478", 242376),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NOMIDI)
},
{
"bbvs",
"Loogie Demo",
AD_ENTRY1s("BBLOOGIE.000", "607d3bf55ec6458dce484473b1eecb4d", 324416),
Common::EN_ANY,
Common::kPlatformWindows,
GF_LOOGIE_DEMO | ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NOMIDI)
},
{
"bbvs",
"Loogie Demo",
AD_ENTRY1s("BBLOOGIE.000", "83921c65bd93be7e35056c31bd37310b", 324764),
Common::EN_ANY,
Common::kPlatformWindows,
GF_LOOGIE_ALT_DEMO | ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NOMIDI)
},
{
"bbvs",
nullptr,
AD_ENTRY1s("vspr0001.vnm", "91c76b1048f93208cd7b1a05ebccb408", 1176976),
Common::RU_RUS,
Common::kPlatformWindows,
GF_GUILANGSWITCH | ADGF_DROPPLATFORM,
GUIO1(GUIO_NOMIDI)
},
AD_TABLE_END_MARKER
};
} // End of namespace Bbvs
static const char * const directoryGlobs[] = {
"vnm",
nullptr
};
class BbvsMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
public:
BbvsMetaEngineDetection() : AdvancedMetaEngineDetection(Bbvs::gameDescriptions, bbvsGames) {
_maxScanDepth = 3;
_directoryGlobs = directoryGlobs;
}
const char *getName() const override {
return "bbvs";
}
const char *getEngineName() const override {
return "MTV's Beavis and Butt-Head in Virtual Stupidity";
}
const char *getOriginalCopyright() const override {
return "(C) 1995 Viacom New Media";
}
};
REGISTER_PLUGIN_STATIC(BBVS_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, BbvsMetaEngineDetection);

35
engines/bbvs/detection.h Normal file
View File

@@ -0,0 +1,35 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_DETECTION_H
#define BBVS_DETECTION_H
namespace Bbvs {
enum BBVSGameFeatures {
GF_GUILANGSWITCH = (1 << 0), // If GUI language switch is required for menus
GF_LOOGIE_DEMO = (1 << 1),
GF_LOOGIE_ALT_DEMO = (1 << 2)
};
} // End of namespace Bbvs
#endif // BBVS_DETECTION_H

213
engines/bbvs/dialogs.cpp Normal file
View File

@@ -0,0 +1,213 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/dialogs.h"
#include "common/events.h"
#include "gui/widget.h"
#include "engines/advancedDetector.h"
namespace GUI {
class CommandSender;
}
namespace Bbvs {
struct MenuButton {
const char *label;
uint32 cmd;
};
static const MenuButton kMenuButtons[] = {
// Main menu
{"New Game", kCmdNewGame},
{"Continue", kCmdContinue},
{"Options", kCmdOptions},
{"Mini Games", kCmdMiniGames},
{"Quit", kCmdQuit},
// Options
{"Uninstall", kCmdUninstall},
{"Credits", kCmdCredits},
{"Opening", kCmdOpening},
{"Chicks 'n' Stuff", kCmdChicksNStuff},
{"Back ..", kCmdBack},
// Minigames
{"Hock-A-Loogie", kCmdHockALoogie},
{"Bug Justice", kCmdBugJustice},
{"Court Chaos", kCmdCourtChaos},
{"Air Guitar", kCmdAirGuitar},
{"Back ..", kCmdBack}
};
static const MenuButton kMenuButtonsRu[] = {
// Main menu
{"\xD0\x9D\xD0\xBE\xD0\xB2\xD0\xB0\xD1\x8F \xD0\xB8\xD0\xB3\xD1\x80\xD0\xB0", kCmdNewGame},
{"\xD0\x9F\xD1\x80\xD0\xBE\xD0\xB4\xD0\xBE\xD0\xBB\xD0\xB6\xD0\xB8\xD1\x82\xD1\x8C", kCmdContinue},
{"\xD0\x95\xD1\x89\xD0\xB5 ..", kCmdOptions},
{"\xD0\x9C\xD0\xB8\xD0\xBD\xD0\xB8 \xD0\x98\xD0\xB3\xD1\x80\xD1\x8B", kCmdMiniGames},
{"\xD0\x92\xD1\x8B\xD1\x85\xD0\xBE\xD0\xB4", kCmdQuit},
// Options
{"\xD0\x94\xD0\xB5\xD0\xB8\xD0\xBD\xD1\x81\xD1\x82\xD0\xB0\xD0\xBB\xD0\xBB\xD1\x8F\xD1\x86\xD0\xB8\xD1\x8F", kCmdUninstall},
{"\xD0\x90\xD0\xB2\xD1\x82\xD0\xBE\xD1\x80\xD1\x8B", kCmdCredits},
{"\xD0\x9F\xD1\x80\xD0\xBE\xD0\xBB\xD0\xBE\xD0\xB3", kCmdOpening},
{"\xD0\xA0\xD0\xB5\xD0\xBA\xD0\xBB\xD0\xB0\xD0\xBC\xD0\xB0", kCmdChicksNStuff},
{"\xD0\x9D\xD0\xB0\xD0\xB7\xD0\xB0\xD0\xB4 ..", kCmdBack},
// Minigames
{"\xD0\xA1\xD0\xBD\xD0\xB0\xD0\xB9\xD0\xBF\xD0\xB5\xD1\x80", kCmdHockALoogie},
{"\xD0\x96\xD1\x83\xD0\xBA\xD0\xBE\xD0\xB6\xD0\xB0\xD1\x80\xD0\xBA\xD0\xB0", kCmdBugJustice},
{"\xD0\x9F\xD1\x82\xD0\xB5\xD0\xBD\xD0\xB8\xD1\x81", kCmdCourtChaos},
{"\xD0\x96\xD0\xB8\xD0\xB2\xD0\xBE\xD0\xB9 \xD0\x97\xD0\xB2\xD1\x83\xD0\xBA", kCmdAirGuitar},
{"\xD0\x9D\xD0\xB0\xD0\xB7\xD0\xB0\xD0\xB4 ..", kCmdBack}
};
MainMenu::MainMenu(BbvsEngine *vm) : Dialog(0, 0, 1, 1), _vm(vm) {
_backgroundType = GUI::ThemeEngine::kDialogBackgroundNone;
init();
}
MainMenu::~MainMenu() {
}
void MainMenu::init() {
_buttons[0] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String());
_buttons[1] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String());
_buttons[2] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String());
_buttons[3] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String());
_buttons[4] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String());
gotoMenuScreen(kMainMenuScr);
}
void MainMenu::reflowLayout() {
const int screenW = _vm->_system->getOverlayWidth();
const int screenH = _vm->_system->getOverlayHeight();
const int buttonWidth = screenW * 70 / 320;
const int buttonHeight = screenH * 14 / 240;
const int buttonPadding = screenW * 3 / 320;
_w = 2 * buttonWidth + buttonPadding;
_h = 3 * buttonHeight + 3 * buttonPadding;
_x = (screenW - _w) / 2;
_y = screenH - _h - 2;
int x = 0, y = 0;
x = 0;
y = 0;
_buttons[0]->resize(x, y, buttonWidth, buttonHeight, false);
x += buttonWidth + buttonPadding;
_buttons[1]->resize(x, y, buttonWidth, buttonHeight, false);
x = 0;
y += buttonHeight + buttonPadding;
_buttons[2]->resize(x, y, buttonWidth, buttonHeight, false);
x += buttonWidth + buttonPadding;
_buttons[3]->resize(x, y, buttonWidth, buttonHeight, false);
x = (_w - buttonWidth) / 2; // Center the last button
y += buttonHeight + buttonPadding;
_buttons[4]->resize(x, y, buttonWidth, buttonHeight, false);
GUI::Dialog::reflowLayout();
}
void MainMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
switch (command) {
// Main menu
case kCmdNewGame:
close();
_vm->newGame();
break;
case kCmdContinue:
close();
_vm->continueGameFromQuickSave();
break;
case kCmdOptions:
gotoMenuScreen(kOptionsMenuScr);
break;
case kCmdMiniGames:
gotoMenuScreen(kMiniGamesMenuScr);
break;
case kCmdQuit:
close();
_vm->quitGame();
break;
// Options menu
case kCmdUninstall:
break;
case kCmdCredits:
gotoScene(45);
break;
case kCmdOpening:
gotoScene(43);
break;
case kCmdChicksNStuff:
gotoScene(41);
break;
// Minigames menu
case kCmdHockALoogie:
gotoScene(27);
break;
case kCmdBugJustice:
gotoScene(29);
break;
case kCmdCourtChaos:
gotoScene(28);
break;
case kCmdAirGuitar:
gotoScene(30);
break;
case kCmdBack:
gotoMenuScreen(kMainMenuScr);
break;
default:
Dialog::handleCommand(sender, command, data);
}
}
void MainMenu::gotoMenuScreen(int screen) {
for (int i = 0; i < 5; ++i) {
const MenuButton *btn;
if (_vm->_gameDescription->language == Common::RU_RUS) {
btn = &kMenuButtonsRu[screen * 5 + i];
} else {
btn = &kMenuButtons[screen * 5 + i];
}
_buttons[i]->setLabel(Common::U32String(btn->label, Common::kUtf8));
_buttons[i]->setCmd(btn->cmd);
_buttons[i]->setEnabled(btn->cmd != 0);
}
// Enable the "Continue" button if a savegame at slot 0 exists
if (screen == kMainMenuScr)
_buttons[1]->setEnabled(canContinue());
}
bool MainMenu::canContinue() {
return _vm->existsSavegame(0);
}
void MainMenu::gotoScene(int sceneNum) {
close();
_vm->setNewSceneNum(sceneNum);
}
} // End of namespace Hugo

84
engines/bbvs/dialogs.h Normal file
View File

@@ -0,0 +1,84 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_DIALOGS_H
#define BBVS_DIALOGS_H
#include "bbvs/bbvs.h"
#include "gui/dialog.h"
namespace GUI {
class ButtonWidget;
class CommandSender;
}
namespace Bbvs {
enum {
// Main menu
kCmdNewGame = 'NEWG',
kCmdContinue = 'CONT',
kCmdOptions = 'OPTN',
kCmdMiniGames = 'MINI',
kCmdQuit = 'QUIT',
// Options
kCmdUninstall = 0,
kCmdCredits = 'CRED',
kCmdOpening = 'OPEN',
kCmdChicksNStuff = 'CHIC',
// Minigames
kCmdHockALoogie = 'HOCK',
kCmdBugJustice = 'BUGJ',
kCmdCourtChaos = 'CORT',
kCmdAirGuitar = 'AIRG',
kCmdBack = 'BACK'
};
enum {
kMainMenuScr = 0,
kOptionsMenuScr = 1,
kMiniGamesMenuScr = 2
};
class MainMenu : public GUI::Dialog {
public:
MainMenu(BbvsEngine *vm);
~MainMenu() override;
void reflowLayout() override;
void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) override;
protected:
BbvsEngine *_vm;
void init();
GUI::ButtonWidget *_buttons[5];
void gotoMenuScreen(int index);
bool canContinue();
void gotoScene(int sceneNum);
};
}
#endif // BBVS_DIALOGS_H

499
engines/bbvs/gamemodule.cpp Normal file
View File

@@ -0,0 +1,499 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/gamemodule.h"
#include "engines/util.h"
namespace Bbvs {
GameModule::GameModule()
: _bgSpriteCount(0), _bgSpriteIndices(nullptr), _bgSpritePriorities(nullptr), _walkRectsCount(0),
_walkRects(nullptr), _sceneExitsCount(0), _sceneExits(nullptr), _bgObjectsCount(0), _bgObjects(nullptr),
_animationsCount(0), _animations(nullptr), _sceneObjectDefsCount(0), _sceneObjectDefs(nullptr),
_sceneObjectInitsCount(0), _sceneObjectInits(nullptr), _actionsCount(0), _actions(nullptr),
_sceneSoundsCount(0), _sceneSounds(nullptr), _preloadSoundsCount(0), _preloadSounds(nullptr) {
}
GameModule::~GameModule() {
unload();
}
void GameModule::load(const Common::Path &filename) {
debug(0, "GameModule::load()");
unload();
Common::File fd;
if (!fd.open(filename))
error("GameModule::load() Could not open %s", filename.toString(Common::Path::kNativeSeparator).c_str());
loadBgSprites(fd);
loadCameraInits(fd);
loadWalkRects(fd);
loadSceneExits(fd);
loadBgObjects(fd);
loadAnimations(fd);
loadSceneObjectDefs(fd);
loadSceneObjectInits(fd);
loadActions(fd);
loadGuiSpriteIndices(fd);
loadInventoryItemSpriteIndices(fd);
loadInventoryItemInfos(fd);
loadDialogItemSpriteIndices(fd);
loadSceneSounds(fd);
loadPreloadSounds(fd);
fd.seek(0xC);
_fieldC = fd.readUint32LE();
fd.seek(0x1A8);
_buttheadObjectIndex = fd.readUint32LE();
fd.close();
debug(0, "GameModule::load() OK");
}
int GameModule::getFieldC() {
return _fieldC;
}
int GameModule::getButtheadObjectIndex() {
return _buttheadObjectIndex;
}
int GameModule::getGuiSpriteIndex(int index) {
assert(index < kGuiSpriteCount);
return _guiSpriteIndices[index];
}
int GameModule::getInventoryItemSpriteIndex(int index) {
assert(index < kInventoryItemSpriteCount);
return _inventoryItemSpriteIndices[index];
}
int GameModule::getDialogItemSpriteIndex(int index) {
assert(index < kDialogItemSpriteCount);
return _dialogItemSpriteIndices[index];
}
int GameModule::getActionsCount() {
return _actionsCount;
}
Action *GameModule::getAction(int index) {
assert(index < _actionsCount);
return &_actions[index];
}
InventoryItemInfo *GameModule::getInventoryItemInfo(int index) {
assert(index < kInventoryItemCount);
return &_inventoryItemInfos[index];
}
CameraInit *GameModule::getCameraInit(int cameraNum) {
assert(cameraNum < kCameraInitsCount);
return &_cameraInits[cameraNum];
}
int GameModule::getSceneExitsCount() {
return _sceneExitsCount;
}
SceneExit *GameModule::getSceneExit(int index) {
assert(index < _sceneExitsCount);
return &_sceneExits[index];
}
int GameModule::getWalkRectsCount() {
return _walkRectsCount;
}
Common::Rect *GameModule::getWalkRects() {
return _walkRects;
}
int GameModule::getSceneObjectDefsCount() {
return _sceneObjectDefsCount;
}
SceneObjectDef *GameModule::getSceneObjectDef(int index) {
assert(index < _sceneObjectDefsCount);
return &_sceneObjectDefs[index];
}
int GameModule::getSceneObjectInitsCount() {
return _sceneObjectInitsCount;
}
SceneObjectInit *GameModule::getSceneObjectInit(int index) {
assert(index < _sceneObjectInitsCount);
return &_sceneObjectInits[index];
}
int GameModule::getBgObjectsCount() {
return _bgObjectsCount;
}
BgObject *GameModule::getBgObject(int index) {
assert(index < _bgObjectsCount);
return &_bgObjects[index];
}
int GameModule::getBgSpritesCount() {
return _bgSpriteCount;
}
int GameModule::getBgSpriteIndex(int index) {
assert(index < _bgSpriteCount);
return _bgSpriteIndices[index];
}
int GameModule::getBgSpritePriority(int index) {
assert(index < _bgSpriteCount);
return _bgSpritePriorities[index];
}
int GameModule::getSceneSoundsCount() {
return _sceneSoundsCount;
}
SceneSound *GameModule::getSceneSound(int index) {
assert(index < _sceneSoundsCount);
return &_sceneSounds[index];
}
uint GameModule::getSceneSoundIndex(uint soundNum) {
for (int i = 0; i < getSceneSoundsCount(); ++i)
if (getSceneSound(i)->soundNum == soundNum)
return i;
return 0;
}
uint GameModule::getPreloadSoundsCount() {
return _preloadSoundsCount;
}
uint GameModule::getPreloadSound(uint index) {
assert(index < _preloadSoundsCount);
return _preloadSounds[index];
}
Animation *GameModule::getAnimation(int index) {
assert(index < _animationsCount);
return &_animations[index];
}
Common::Point GameModule::readPoint(Common::SeekableReadStream &s) {
Common::Point p;
p.x = s.readUint16LE();
p.y = s.readUint16LE();
return p;
}
Common::Rect GameModule::readRect(Common::SeekableReadStream &s) {
Common::Rect r;
r.left = s.readUint16LE();
r.top = s.readUint16LE();
r.setWidth(s.readUint16LE());
r.setHeight(s.readUint16LE());
return r;
}
Conditions GameModule::readConditions(Common::SeekableReadStream &s) {
Conditions c;
for (int i = 0; i < 8; ++i) {
c.conditions[i].cond = s.readByte();
c.conditions[i].value1 = s.readByte();
c.conditions[i].value2 = s.readUint16LE();
}
return c;
}
void GameModule::unload() {
delete[] _bgSpriteIndices;
delete[] _bgSpritePriorities;
delete[] _walkRects;
delete[] _sceneExits;
delete[] _bgObjects;
delete[] _animations;
delete[] _sceneObjectDefs;
delete[] _sceneObjectInits;
delete[] _actions;
delete[] _sceneSounds;
delete[] _preloadSounds;
_bgSpriteIndices = nullptr;
_bgSpritePriorities = nullptr;
_walkRects = nullptr;
_sceneExits = nullptr;
_bgObjects = nullptr;
_animations = nullptr;
_sceneObjectDefs = nullptr;
_sceneObjectInits = nullptr;
_actions = nullptr;
_sceneSounds = nullptr;
_preloadSounds = nullptr;
}
void GameModule::loadBgSprites(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadBgSprites()");
s.seek(0x14);
_bgSpriteCount = s.readUint32LE();
uint32 bgSpriteIndicesOffs = s.readUint32LE();
uint32 bgSpritePrioritiesOffs = s.readUint32LE();
_bgSpriteIndices = new int[_bgSpriteCount];
_bgSpritePriorities = new int16[_bgSpriteCount];
s.seek(bgSpriteIndicesOffs);
for (int i = 0; i < _bgSpriteCount; ++i)
_bgSpriteIndices[i] = s.readUint32LE();
s.seek(bgSpritePrioritiesOffs);
for (int i = 0; i < _bgSpriteCount; ++i)
_bgSpritePriorities[i] = s.readUint16LE();
}
void GameModule::loadCameraInits(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadCameraInits()");
s.seek(0x20);
for (int i = 0; i < kCameraInitsCount; ++i) {
CameraInit &cameraInit = _cameraInits[i];
cameraInit.cameraPos = readPoint(s);
for (int j = 0; j < 8; ++j)
cameraInit.cameraLinks[j] = s.readByte();
for (int j = 0; j < 8; ++j)
cameraInit.rects[j] = readRect(s);
}
}
void GameModule::loadWalkRects(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadWalkRects()");
s.seek(0x150);
_walkRectsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_walkRects = new Common::Rect[_walkRectsCount];
s.seek(offs);
for (int i = 0; i < _walkRectsCount; ++i)
_walkRects[i] = readRect(s);
}
void GameModule::loadSceneExits(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadSceneExits()");
s.seek(0x158);
_sceneExitsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_sceneExits = new SceneExit[_sceneExitsCount];
s.seek(offs);
for (int i = 0; i < _sceneExitsCount; ++i) {
_sceneExits[i].rect = readRect(s);
_sceneExits[i].newModuleNum = s.readUint32LE();
}
}
void GameModule::loadBgObjects(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadBgObjects()");
s.seek(0x160);
_bgObjectsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_bgObjects = new BgObject[_bgObjectsCount];
s.seek(offs);
for (int i = 0; i < _bgObjectsCount; ++i) {
s.read(_bgObjects[i].name, 20);
_bgObjects[i].rect = readRect(s);
}
}
void GameModule::loadAnimations(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadAnimations()");
s.seek(0x168);
_animationsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_animations = new Animation[_animationsCount];
for (int i = 0; i < _animationsCount; ++i) {
Animation &anim = _animations[i];
s.seek(offs + i * 20);
anim.frameCount = s.readUint32LE();
uint32 frameSpriteIndicesOffs = s.readUint32LE();
uint32 frameTicksOffs = s.readUint32LE();
uint32 frameRects1Offs = s.readUint32LE();
uint32 frameRects2Offs = s.readUint32LE();
anim.frameSpriteIndices = new int[anim.frameCount];
s.seek(frameSpriteIndicesOffs);
for (int j = 0; j < anim.frameCount; ++j)
anim.frameSpriteIndices[j] = s.readUint32LE();
anim.frameTicks = new int16[anim.frameCount];
s.seek(frameTicksOffs);
for (int j = 0; j < anim.frameCount; ++j)
anim.frameTicks[j] = s.readUint16LE();
anim.frameRects1 = new Common::Rect[anim.frameCount];
s.seek(frameRects1Offs);
for (int j = 0; j < anim.frameCount; ++j)
anim.frameRects1[j] = readRect(s);
anim.frameRects2 = new Common::Rect[anim.frameCount];
s.seek(frameRects2Offs);
for (int j = 0; j < anim.frameCount; ++j)
anim.frameRects2[j] = readRect(s);
}
}
void GameModule::loadSceneObjectDefs(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadSceneObjectDefs()");
s.seek(0x170);
_sceneObjectDefsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_sceneObjectDefs = new SceneObjectDef[_sceneObjectDefsCount];
s.seek(offs);
for (int i = 0; i < _sceneObjectDefsCount; ++i) {
s.read(_sceneObjectDefs[i].name, 20);
_sceneObjectDefs[i].walkSpeed = s.readUint32LE();
for (int j = 0; j < 16; ++j)
_sceneObjectDefs[i].animIndices[j] = s.readUint32LE();
}
}
void GameModule::loadSceneObjectInits(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadSceneObjectInits()");
s.seek(0x178);
_sceneObjectInitsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_sceneObjectInits = new SceneObjectInit[_sceneObjectInitsCount];
s.seek(offs);
for (int i = 0; i < _sceneObjectInitsCount; ++i) {
_sceneObjectInits[i].conditions = readConditions(s);
_sceneObjectInits[i].sceneObjectIndex = s.readUint32LE();
_sceneObjectInits[i].animIndex = s.readUint32LE();
_sceneObjectInits[i].x = s.readUint16LE();
_sceneObjectInits[i].y = s.readUint16LE();
}
}
void GameModule::loadActions(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadActions()");
s.seek(0x180);
_actionsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_actions = new Action[_actionsCount];
for (int i = 0; i < _actionsCount; ++i) {
s.seek(offs + i * 72);
debug(0, "Action(%d) offs: %08X", i, offs + i * 72);
_actions[i].conditions = readConditions(s);
for (int j = 0; j < 8; ++j) {
_actions[i].results.actionResults[j].kind = s.readByte();
_actions[i].results.actionResults[j].value1 = s.readByte();
_actions[i].results.actionResults[j].value2 = s.readUint16LE();
}
const int actionListCount = s.readUint32LE();
const uint32 actionListOffs = s.readUint32LE();
s.seek(actionListOffs);
for (int j = 0; j < actionListCount; ++j) {
ActionCommand actionCommand;
actionCommand.cmd = s.readUint16LE();
actionCommand.sceneObjectIndex = s.readUint16LE();
actionCommand.timeStamp = s.readUint32LE();
actionCommand.walkDest = readPoint(s);
actionCommand.param = s.readUint32LE();
_actions[i].actionCommands.push_back(actionCommand);
}
}
}
void GameModule::loadGuiSpriteIndices(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadGuiSpriteIndices()");
s.seek(0x188);
uint32 offs = s.readUint32LE();
s.seek(offs);
for (int i = 0; i < kGuiSpriteCount; ++i)
_guiSpriteIndices[i] = s.readUint32LE();
}
void GameModule::loadInventoryItemSpriteIndices(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadInventoryItemSpriteIndices()");
s.seek(0x18C);
uint32 offs = s.readUint32LE();
s.seek(offs);
for (int i = 0; i < kInventoryItemSpriteCount; ++i)
_inventoryItemSpriteIndices[i] = s.readUint32LE();
}
void GameModule::loadInventoryItemInfos(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadInventoryItemInfos()");
s.seek(0x190);
uint32 offs = s.readUint32LE();
s.seek(offs);
for (int i = 0; i < kInventoryItemCount; ++i) {
_inventoryItemInfos[i].xOffs = s.readUint16LE();
_inventoryItemInfos[i].yOffs = s.readUint16LE();
_inventoryItemInfos[i].width = s.readUint16LE();
_inventoryItemInfos[i].height = s.readUint16LE();
s.skip(8); // Unused
}
}
void GameModule::loadDialogItemSpriteIndices(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadDialogItemSpriteIndices()");
s.seek(0x194);
uint32 offs = s.readUint32LE();
s.seek(offs);
for (int i = 0; i < kDialogItemSpriteCount; ++i) {
_dialogItemSpriteIndices[i] = s.readUint32LE();
}
}
void GameModule::loadSceneSounds(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadSceneSounds()");
s.seek(0x1A0);
_sceneSoundsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_sceneSounds = new SceneSound[_sceneSoundsCount];
s.seek(offs);
for (int i = 0; i < _sceneSoundsCount; ++i) {
_sceneSounds[i].conditions = readConditions(s);
_sceneSounds[i].soundNum = s.readUint32LE();
}
}
void GameModule::loadPreloadSounds(Common::SeekableReadStream &s) {
debug(0, "GameModule::loadPreloadSounds()");
s.seek(0x198);
_preloadSoundsCount = s.readUint32LE();
uint32 offs = s.readUint32LE();
_preloadSounds = new uint[_preloadSoundsCount];
s.seek(offs);
for (uint i = 0; i < _preloadSoundsCount; ++i)
_preloadSounds[i] = s.readUint32LE();
}
} // End of namespace Bbvs

250
engines/bbvs/gamemodule.h Normal file
View File

@@ -0,0 +1,250 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_GAMEMODULE_H
#define BBVS_GAMEMODULE_H
#include "common/array.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/rect.h"
#include "common/str.h"
namespace Bbvs {
const int kInventoryItemCount = 42;
const int kInventoryItemSpriteCount = 2 * kInventoryItemCount;
const int kDialogItemSpriteCount = 26;
const int kGuiSpriteCount = 21;
const int kCameraInitsCount = 4;
struct Condition {
byte cond;
byte value1;
int16 value2;
};
struct Conditions {
Condition conditions[8];
};
struct ActionResult {
byte kind;
byte value1;
int16 value2;
};
struct ActionResults {
ActionResult actionResults[8];
};
struct ActionCommand {
uint16 cmd;
int16 sceneObjectIndex;
uint32 timeStamp;
Common::Point walkDest;
int32 param;
};
class ActionCommands : public Common::Array<ActionCommand> {
};
struct Action {
Conditions conditions;
ActionResults results;
ActionCommands actionCommands;
};
struct InventoryItemInfo {
int16 xOffs, yOffs;
int16 width, height;
};
struct CameraInit {
Common::Point cameraPos;
byte cameraLinks[8];
Common::Rect rects[8];
};
struct SceneObjectDef {
char name[20];
int animIndices[16];
int walkSpeed;
};
struct SceneObjectInit {
Conditions conditions;
int sceneObjectIndex;
int animIndex;
int x, y;
};
struct BgObject {
char name[20];
Common::Rect rect;
};
struct Animation {
int frameCount;
int *frameSpriteIndices;
int16 *frameTicks;
Common::Rect *frameRects1;
Common::Rect *frameRects2;
Animation()
: frameCount(0), frameSpriteIndices(0), frameTicks(0), frameRects1(0), frameRects2(0) {
}
~Animation() {
delete[] frameSpriteIndices;
delete[] frameTicks;
delete[] frameRects1;
delete[] frameRects2;
}
};
struct SceneExit {
Common::Rect rect;
int newModuleNum;
};
struct SceneSound {
Conditions conditions;
uint soundNum;
};
class GameModule {
public:
GameModule();
~GameModule();
void load(const Common::Path &filename);
int getFieldC();
int getButtheadObjectIndex();
int getGuiSpriteIndex(int index);
int getInventoryItemSpriteIndex(int index);
int getDialogItemSpriteIndex(int index);
int getActionsCount();
Action *getAction(int index);
InventoryItemInfo *getInventoryItemInfo(int index);
CameraInit *getCameraInit(int cameraNum);
int getSceneExitsCount();
SceneExit *getSceneExit(int index);
int getWalkRectsCount();
Common::Rect *getWalkRects();
int getSceneObjectDefsCount();
SceneObjectDef *getSceneObjectDef(int index);
int getSceneObjectInitsCount();
SceneObjectInit *getSceneObjectInit(int index);
int getBgObjectsCount();
BgObject *getBgObject(int index);
int getBgSpritesCount();
int getBgSpriteIndex(int index);
int getBgSpritePriority(int index);
int getSceneSoundsCount();
SceneSound *getSceneSound(int index);
uint getSceneSoundIndex(uint soundNum);
uint getPreloadSoundsCount();
uint getPreloadSound(uint index);
Animation *getAnimation(int index);
protected:
int _bgSpriteCount;
int *_bgSpriteIndices;
int16 *_bgSpritePriorities;
CameraInit _cameraInits[kCameraInitsCount];
int _walkRectsCount;
Common::Rect *_walkRects;
int _sceneExitsCount;
SceneExit *_sceneExits;
int _bgObjectsCount;
BgObject *_bgObjects;
int _animationsCount;
Animation *_animations;
int _sceneObjectDefsCount;
SceneObjectDef *_sceneObjectDefs;
int _sceneObjectInitsCount;
SceneObjectInit *_sceneObjectInits;
int _actionsCount;
Action *_actions;
int _sceneSoundsCount;
SceneSound *_sceneSounds;
uint _preloadSoundsCount;
uint *_preloadSounds;
int _guiSpriteIndices[kGuiSpriteCount];
int _inventoryItemSpriteIndices[kInventoryItemSpriteCount];
InventoryItemInfo _inventoryItemInfos[kInventoryItemCount];
int _dialogItemSpriteIndices[kDialogItemSpriteCount];
int _fieldC;
int _buttheadObjectIndex;
Common::Point readPoint(Common::SeekableReadStream &s);
Common::Rect readRect(Common::SeekableReadStream &s);
Conditions readConditions(Common::SeekableReadStream &s);
void unload();
void loadBgSprites(Common::SeekableReadStream &s);
void loadCameraInits(Common::SeekableReadStream &s);
void loadWalkRects(Common::SeekableReadStream &s);
void loadSceneExits(Common::SeekableReadStream &s);
void loadBgObjects(Common::SeekableReadStream &s);
void loadAnimations(Common::SeekableReadStream &s);
void loadSceneObjectDefs(Common::SeekableReadStream &s);
void loadSceneObjectInits(Common::SeekableReadStream &s);
void loadActions(Common::SeekableReadStream &s);
void loadGuiSpriteIndices(Common::SeekableReadStream &s);
void loadInventoryItemSpriteIndices(Common::SeekableReadStream &s);
void loadInventoryItemInfos(Common::SeekableReadStream &s);
void loadDialogItemSpriteIndices(Common::SeekableReadStream &s);
void loadSceneSounds(Common::SeekableReadStream &s);
void loadPreloadSounds(Common::SeekableReadStream &s);
};
} // End of namespace Bbvs
#endif // BBVS_GAMEMODULE_H

142
engines/bbvs/graphics.cpp Normal file
View File

@@ -0,0 +1,142 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "graphics/paletteman.h"
#include "bbvs/graphics.h"
namespace Bbvs {
void DrawList::add(int index, int x, int y, int priority) {
debug(5, "DrawList::add() %d (%d, %d) %d", index, x, y, priority);
DrawListEntry drawListEntry;
drawListEntry.index = index;
drawListEntry.x = x;
drawListEntry.y = y;
drawListEntry.priority = priority;
// Insert the sprite at the correct position
uint insertIndex = 0;
while (insertIndex < size() && (*this)[insertIndex].priority <= priority)
++insertIndex;
insert_at(insertIndex, drawListEntry);
}
Screen::Screen(OSystem *system) : _system(system) {
_surface = new Graphics::Surface();
_surface->create(320, 240, Graphics::PixelFormat::createFormatCLUT8());
}
Screen::~Screen() {
_surface->free();
delete _surface;
}
void Screen::setPalette(Palette &palette) {
byte pal[768];
memset(pal, 0, 768);
memcpy(&pal[palette.start * 3], palette.data, palette.count * 3);
_system->getPaletteManager()->setPalette(pal, 0, 256);
}
void Screen::copyToScreen() {
_system->copyRectToScreen((const byte*)_surface->getBasePtr(0, 0), _surface->pitch, 0, 0, 320, 240);
_system->updateScreen();
}
void Screen::clear() {
_surface->fillRect(Common::Rect(0, 0, 320, 240), 0);
}
void Screen::drawDrawList(DrawList &drawList, SpriteModule *spriteModule) {
for (uint i = 0; i < drawList.size(); ++i) {
debug(4, "index: %d; x: %d; y: %d; priority: %d", drawList[i].index, drawList[i].x, drawList[i].y, drawList[i].priority);
Sprite sprite = spriteModule->getSprite(drawList[i].index);
drawSprite(sprite, drawList[i].x, drawList[i].y);
}
}
void Screen::drawSprite(Sprite &sprite, int x, int y) {
debug(5, "Screen::drawSprite()");
int destX, destY, width, height, skipX = 0, skipY = 0;
destX = sprite.xOffs + x;
destY = sprite.yOffs + y;
if (destX >= _surface->w || destY >= _surface->h)
return;
height = sprite.height;
if (destY < 0) {
height += destY;
if (height <= 0)
return;
skipY = -destY;
destY = 0;
}
if (destY + height > _surface->h)
height = _surface->h - destY;
width = sprite.width;
if (destX < 0) {
width += destX;
if (width <= 0)
return;
skipX = -destX;
destX = 0;
}
if (destX + width >= _surface->w)
width = _surface->w - destX;
debug(6, "drawSprite() (%d, %d, %d, %d); skipX: %d; skipY: %d; %d", destX, destY, width, height, skipX, skipY, sprite.type);
if (sprite.type == 1) {
for (int yc = 0; yc < height; ++yc) {
byte *source = sprite.getRow(skipY + yc);
byte *dest = (byte*)_surface->getBasePtr(destX, destY + yc);
int currWidth = -skipX;
while (currWidth < width) {
int8 op = *source++;
if (op < 0) {
currWidth += (-op);
} else {
while (op >= 0 && currWidth < width) {
if (currWidth >= 0)
dest[currWidth] = *source;
++source;
++currWidth;
--op;
}
}
}
}
} else {
for (int yc = 0; yc < height; ++yc) {
byte *source = sprite.getRow(skipY + yc) + skipX;
byte *dest = (byte*)_surface->getBasePtr(destX, destY + yc);
memcpy(dest, source, width);
}
}
debug(5, "Screen::drawSprite() OK");
}
} // End of namespace Bbvs

59
engines/bbvs/graphics.h Normal file
View File

@@ -0,0 +1,59 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_GRAPHICS_H
#define BBVS_GRAPHICS_H
#include "bbvs/spritemodule.h"
#include "common/array.h"
#include "common/system.h"
#include "graphics/surface.h"
namespace Bbvs {
struct DrawListEntry {
int index;
int x, y;
int priority;
};
class DrawList : public Common::Array<DrawListEntry> {
public:
void add(int index, int x, int y, int priority);
};
class Screen {
public:
Screen(OSystem *system);
~Screen();
void setPalette(Palette &palette);
void copyToScreen();
void drawDrawList(DrawList &drawList, SpriteModule *spriteModule);
void drawSprite(Sprite &sprite, int x, int y);
void clear();
//protected:
OSystem *_system;
Graphics::Surface *_surface;
};
} // End of namespace Bbvs
#endif // BBVS_GRAPHICS_H

270
engines/bbvs/logic.cpp Normal file
View File

@@ -0,0 +1,270 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "bbvs/gamemodule.h"
namespace Bbvs {
bool BbvsEngine::evalCondition(Conditions &conditions) {
bool result = true;
for (int i = 0; i < 8 && result; ++i) {
const Condition &condition = conditions.conditions[i];
switch (condition.cond) {
case kCondSceneObjectVerb:
result = _activeItemType == KITSceneObject &&
condition.value1 == _currVerbNum &&
condition.value2 == _activeItemIndex;
break;
case kCondBgObjectVerb:
result = _activeItemType == kITBgObject &&
condition.value1 == _currVerbNum &&
condition.value2 == _activeItemIndex;
break;
case kCondSceneObjectInventory:
result = _activeItemType == KITSceneObject &&
_currVerbNum == kVerbInvItem &&
condition.value1 == _currInventoryItem &&
condition.value2 == _activeItemIndex;
break;
case kCondBgObjectInventory:
result = _activeItemType == kITBgObject &&
_currVerbNum == kVerbInvItem &&
condition.value1 == _currInventoryItem &&
condition.value2 == _activeItemIndex;
break;
case kCondHasInventoryItem:
result = _inventoryItemStatus[condition.value1] != 0;
break;
case kCondHasNotInventoryItem:
result = _inventoryItemStatus[condition.value1] == 0;
break;
case kCondIsGameVar:
result = _gameVars[condition.value2] != 0;
break;
case kCondIsNotGameVar:
result = _gameVars[condition.value2] == 0;
break;
case kCondIsPrevSceneNum:
result = condition.value2 == _prevSceneNum;
break;
case kCondIsCurrTalkObject:
result = condition.value2 == _currTalkObjectIndex;
break;
case kCondIsDialogItem:
result = _activeItemType == kITDialog &&
condition.value1 == _activeItemIndex;
break;
case kCondIsCameraNum:
result = condition.value1 == _currCameraNum;
break;
case kCondIsNotPrevSceneNum:
result = condition.value2 != _prevSceneNum;
break;
case kCondIsButtheadAtBgObject:
result = _buttheadObject &&
_gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x / 65536, _buttheadObject->y / 65536);
break;
case kCondIsNotSceneVisited:
result = _sceneVisited[_currSceneNum] == 0;
break;
case kCondIsSceneVisited:
result = _sceneVisited[_currSceneNum] != 0;
break;
case kCondUnused:
case kCondDialogItem0:
case kCondIsCameraNumTransition:
result = false;
break;
default:
break;
}
}
return result;
}
bool BbvsEngine::evalCameraCondition(Conditions &conditions, int value) {
bool result = true;
for (int i = 0; i < 8 && result; ++i) {
const Condition &condition = conditions.conditions[i];
switch (condition.cond) {
case kCondHasInventoryItem:
result = _inventoryItemStatus[condition.value1] != 0;
break;
case kCondHasNotInventoryItem:
result = _inventoryItemStatus[condition.value1] == 0;
break;
case kCondIsGameVar:
result = _gameVars[condition.value2] != 0;
break;
case kCondIsNotGameVar:
result = _gameVars[condition.value2] == 0;
break;
case kCondIsPrevSceneNum:
result = condition.value2 == _prevSceneNum;
break;
case kCondIsNotPrevSceneNum:
result = condition.value2 != _prevSceneNum;
break;
case kCondIsNotSceneVisited:
result = _sceneVisited[_currSceneNum] == 0;
break;
case kCondIsSceneVisited:
result = _sceneVisited[_currSceneNum] != 0;
break;
case kCondIsCameraNumTransition:
result = condition.value1 == _currCameraNum &&
condition.value2 == value;
break;
case kCondUnused:
case kCondSceneObjectVerb:
case kCondBgObjectVerb:
case kCondSceneObjectInventory:
case kCondBgObjectInventory:
case kCondIsCurrTalkObject:
case kCondIsDialogItem:
case kCondIsCameraNum:
case kCondDialogItem0:
case kCondIsButtheadAtBgObject:
result = false;
break;
default:
break;
}
}
return result;
}
int BbvsEngine::evalDialogCondition(Conditions &conditions) {
int result = -1;
bool success = false;
for (int i = 0; i < 8; ++i) {
const Condition &condition = conditions.conditions[i];
switch (condition.cond) {
case kCondSceneObjectVerb:
success = _activeItemType == KITSceneObject &&
condition.value1 == _currVerbNum &&
condition.value2 == _activeItemIndex;
break;
case kCondBgObjectVerb:
success = _activeItemType == kITBgObject &&
condition.value1 == _currVerbNum &&
condition.value2 == _activeItemIndex;
break;
case kCondSceneObjectInventory:
success = _activeItemType == KITSceneObject &&
_currVerbNum == kVerbInvItem &&
condition.value1 == _currInventoryItem &&
condition.value2 == _activeItemIndex;
break;
case kCondBgObjectInventory:
success = _activeItemType == kITBgObject &&
_currVerbNum == kVerbInvItem &&
condition.value1 == _currInventoryItem &&
condition.value2 == _activeItemIndex;
break;
case kCondHasInventoryItem:
success = _inventoryItemStatus[condition.value1] != 0;
break;
case kCondHasNotInventoryItem:
success = _inventoryItemStatus[condition.value1] == 0;
break;
case kCondIsGameVar:
success = _gameVars[condition.value2] != 0;
break;
case kCondIsNotGameVar:
success = _gameVars[condition.value2] == 0;
break;
case kCondIsPrevSceneNum:
success = condition.value2 == _prevSceneNum;
break;
case kCondIsCurrTalkObject:
success = condition.value2 == _currTalkObjectIndex;
break;
case kCondIsDialogItem:
result = condition.value1;
break;
case kCondIsCameraNum:
success = condition.value1 == _currCameraNum;
break;
case kCondIsNotPrevSceneNum:
success = condition.value2 != _prevSceneNum;
break;
case kCondIsButtheadAtBgObject:
success = _buttheadObject &&
_gameModule->getBgObject(condition.value2)->rect.contains(_buttheadObject->x / 65536, _buttheadObject->y / 65536);
break;
case kCondIsNotSceneVisited:
success = _sceneVisited[_currSceneNum] == 0;
break;
case kCondIsSceneVisited:
success = _sceneVisited[_currSceneNum] != 0;
break;
case kCondDialogItem0:
return 0;
case kCondUnused:
case kCondIsCameraNumTransition:
success = false;
break;
default:
break;
}
if (!success)
return -1;
}
return result;
}
void BbvsEngine::evalActionResults(ActionResults &results) {
for (int i = 0; i < 8; ++i) {
const ActionResult &result = results.actionResults[i];
switch (result.kind) {
case kActResAddInventoryItem:
_inventoryItemStatus[result.value1] = 1;
_currVerbNum = kVerbInvItem;
_currInventoryItem = result.value1;
break;
case kActResRemoveInventoryItem:
_inventoryItemStatus[result.value1] = 0;
if (result.value1 == _currInventoryItem)
_currInventoryItem = -1;
if (_currVerbNum == kVerbInvItem)
_currVerbNum = kVerbLook;
break;
case kActResSetGameVar:
_gameVars[result.value2] = 1;
break;
case kActResUnsetGameVar:
_gameVars[result.value2] = 0;
break;
case kActResStartDialog:
_gameState = kGSDialog;
break;
case kActResChangeScene:
_newSceneNum = result.value2;
break;
default:
break;
}
}
}
} // End of namespace Bbvs

215
engines/bbvs/metaengine.cpp Normal file
View File

@@ -0,0 +1,215 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "common/config-manager.h"
#include "engines/advancedDetector.h"
#include "common/savefile.h"
#include "common/system.h"
#include "common/translation.h"
#include "base/plugins.h"
#include "graphics/thumbnail.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymapper.h"
#include "backends/keymapper/standard-actions.h"
namespace Bbvs {
bool BbvsEngine::isDemo() const {
return _gameDescription->flags & ADGF_DEMO;
}
bool BbvsEngine::isLoogieDemo() const {
return _gameDescription->flags & GF_LOOGIE_DEMO;
}
bool BbvsEngine::isLoogieAltDemo() const {
return _gameDescription->flags & GF_LOOGIE_ALT_DEMO;
}
} // End of namespace Bbvs
class BbvsMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
public:
const char *getName() const override {
return "bbvs";
}
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
int getMaximumSaveSlot() const override;
SaveStateList listSaves(const char *target) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
bool removeSaveState(const char *target, int slot) const override;
// Disable autosave (see mirrored method in bbvs.h for detailed explanation)
int getAutosaveSlot() const override { return -1; }
Common::KeymapArray initKeymaps(const char *target) const override;
};
bool BbvsMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsDeleteSave) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
(f == kSavesSupportCreationDate) ||
(f == kSimpleSavesNames);
}
bool BbvsMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.%03d", target, slot);
return g_system->getSavefileManager()->removeSavefile(fileName);
}
Common::KeymapArray BbvsMetaEngine::initKeymaps(const char *target) const {
using namespace Common;
using namespace Bbvs;
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "bbvs-default", _("Default keymappings"));
Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, "game-shortcuts", _("Game keymappings"));
// I18N: Escape is a key
Keymap *escapeKeyMap = new Keymap(Keymap::kKeymapTypeGame, "escape-shortcuts", _("Escape keymappings"));
Common::Action *act;
act = new Common::Action(kStandardActionLeftClick, _("Left click"));
act->setLeftClickEvent();
act->addDefaultInputMapping("MOUSE_LEFT");
act->addDefaultInputMapping("JOY_A");
engineKeyMap->addAction(act);
act = new Common::Action(kStandardActionRightClick, _("Right click"));
act->setRightClickEvent();
act->addDefaultInputMapping("MOUSE_RIGHT");
act->addDefaultInputMapping("JOY_B");
engineKeyMap->addAction(act);
act = new Common::Action("ESCAPE", _("Escape"));
act->setCustomEngineActionEvent(kActionEscape);
act->addDefaultInputMapping("JOY_X");
act->addDefaultInputMapping("ESCAPE");
escapeKeyMap->addAction(act);
act = new Common::Action("INVENTORY", _("Open inventory"));
act->setCustomEngineActionEvent(kActionInventory);
act->addDefaultInputMapping("i");
act->addDefaultInputMapping("SPACE");
act->addDefaultInputMapping("JOY_y");
gameKeyMap->addAction(act);
act = new Common::Action("LOOK", _("Look"));
act->setCustomEngineActionEvent(kActionLook);
act->addDefaultInputMapping("l");
act->addDefaultInputMapping("JOY_DOWN");
gameKeyMap->addAction(act);
act = new Common::Action("TALK", _("Talk"));
act->setCustomEngineActionEvent(kActionTalk);
act->addDefaultInputMapping("t");
act->addDefaultInputMapping("JOY_RIGHT");
gameKeyMap->addAction(act);
act = new Common::Action("USE", _("Use"));
act->setCustomEngineActionEvent(kActionUse);
act->addDefaultInputMapping("u");
act->addDefaultInputMapping("JOY_LEFT");
gameKeyMap->addAction(act);
act = new Common::Action("WALK", _("Walk"));
act->setCustomEngineActionEvent(kActionWalk);
act->addDefaultInputMapping("w");
act->addDefaultInputMapping("JOY_UP");
gameKeyMap->addAction(act);
KeymapArray keymaps(3);
keymaps[0] = engineKeyMap;
keymaps[1] = gameKeyMap;
keymaps[2] = escapeKeyMap;
return keymaps;
}
int BbvsMetaEngine::getMaximumSaveSlot() const {
return 999;
}
SaveStateList BbvsMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Bbvs::BbvsEngine::SaveHeader header;
Common::String pattern = target;
pattern += ".###";
Common::StringArray filenames = saveFileMan->listSavefiles(pattern.c_str());
SaveStateList saveList;
for (const auto &filename : filenames) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(filename.c_str() + filename.size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(filename.c_str());
if (in) {
if (Bbvs::BbvsEngine::readSaveHeader(in, header) == Bbvs::BbvsEngine::kRSHENoError) {
saveList.push_back(SaveStateDescriptor(this, slotNum, header.description));
}
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
SaveStateDescriptor BbvsMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String filename = Bbvs::BbvsEngine::getSavegameFilename(target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
if (in) {
Bbvs::BbvsEngine::SaveHeader header;
Bbvs::BbvsEngine::kReadSaveHeaderError error;
error = Bbvs::BbvsEngine::readSaveHeader(in, header, false);
delete in;
if (error == Bbvs::BbvsEngine::kRSHENoError) {
SaveStateDescriptor desc(this, slot, header.description);
desc.setThumbnail(header.thumbnail);
desc.setSaveDate(header.saveDate & 0xFFFF, (header.saveDate >> 16) & 0xFF, (header.saveDate >> 24) & 0xFF);
desc.setSaveTime((header.saveTime >> 16) & 0xFF, (header.saveTime >> 8) & 0xFF);
desc.setPlayTime(header.playTime * 1000);
return desc;
}
}
return SaveStateDescriptor();
}
Common::Error BbvsMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
*engine = new Bbvs::BbvsEngine(syst, desc);
return Common::kNoError;
}
#if PLUGIN_ENABLED_DYNAMIC(BBVS)
REGISTER_PLUGIN_DYNAMIC(BBVS, PLUGIN_TYPE_ENGINE, BbvsMetaEngine);
#else
REGISTER_PLUGIN_STATIC(BBVS, PLUGIN_TYPE_ENGINE, BbvsMetaEngine);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_MINIGAMES_BBAIRGUITAR_H
#define BBVS_MINIGAMES_BBAIRGUITAR_H
#include "bbvs/minigames/minigame.h"
namespace Bbvs {
class MinigameBbAirGuitar : public Minigame {
public:
MinigameBbAirGuitar(BbvsEngine *vm) : Minigame(vm) {};
bool run(bool fromMainGame) override;
public:
struct Obj {
int kind;
int x, y;
int xIncr, yIncr;
const ObjAnimation *anim;
int frameIndex;
int ticks;
int status;
int16 frameIndexAdd;
int16 unk2;
};
enum {
kMaxObjectsCount = 256,
kMaxTracks = 2048
};
struct PianoKeyInfo {
int x, y;
int frameIndex;
};
struct TrackEvt {
int8 noteNum;
int16 ticks;
};
Obj _objects[kMaxObjectsCount];
int _playerMode;
bool _modified;
TrackEvt _track[kMaxTracks];
int _trackIndex, _trackCount;
int _noteStartTime;
int _vuMeterLeft1, _vuMeterLeft2;
int _vuMeterRight1, _vuMeterRight2;
bool _resetAnims;
bool _rockTunePlaying;
int _currButtonNum;
int _buttonClickTicks;
int *_currFrameIndex;
int _btn3KindToggle;
const BBPolygon *_currPianoKeyArea;
const Rect *_currPlayerButtonRect;
bool _movingTrackBar;
int _trackBarMouseX;
int _trackBarX;
Rect _trackBarThumbRect;
int _currTrackPos, _totalTrackLength;
int _ticksDelta;
int _actionStartTrackPos, _actionTrackPos;
int _actionStartTime;
int _currNoteNum;
int _currPatchNum;
const ObjAnimation *getAnimation(int animIndex);
bool ptInRect(const Rect *r, int x, int y);
bool ptInPoly(const BBPolygon *poly, int x, int y);
void buildDrawList(DrawList &drawList);
void buildDrawList0(DrawList &drawList);
void buildDrawList1(DrawList &drawList);
void drawSprites();
void initObjs();
Obj *getFreeObject();
void initObjects();
void initObjects0();
void initObjects1();
bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
void updateObjs();
void update();
void play();
void record();
void setPlayerMode3();
void stop();
void changePatch(int patchNum);
void afterButtonReleased();
void calcTotalTicks2();
void calcTotalTicks1();
void noteOn(int noteNum);
void noteOff(int noteNum);
void resetObjs();
void loadSounds();
void playNote(int noteNum);
void stopNote(int noteNum);
bool getLoadFilename(Common::String &filename);
bool getSaveFilename(Common::String &filename);
bool querySaveModifiedDialog();
bool querySaveModifiedTracks();
bool loadTracks();
bool saveTracks();
bool loadFromStream(Common::ReadStream *stream);
void saveToStream(Common::WriteStream *stream);
};
} // End of namespace Bbvs
#endif // BBVS_MINIGAMES_BBAIRGUITAR_H

View File

@@ -0,0 +1,185 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/minigames/bbairguitar.h"
namespace Bbvs {
static const int kAnim0FrameIndices[] = {0, 1};
static const int16 kAnim0FrameTicks[] = {6, 6};
static const BBRect kAnim0FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim1FrameIndices[] = {2, 3};
static const int16 kAnim1FrameTicks[] = {6, 6};
static const BBRect kAnim1FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim2FrameIndices[] = {4, 5};
static const int16 kAnim2FrameTicks[] = {6, 6};
static const BBRect kAnim2FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim3FrameIndices[] = {6};
static const int16 kAnim3FrameTicks[] = {6};
static const BBRect kAnim3FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim4FrameIndices[] = {7};
static const int16 kAnim4FrameTicks[] = {6};
static const BBRect kAnim4FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim5FrameIndices[] = {8};
static const int16 kAnim5FrameTicks[] = {6};
static const BBRect kAnim5FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim6FrameIndices[] = {9, 10, 11};
static const int16 kAnim6FrameTicks[] = {6, 6, 6};
static const BBRect kAnim6FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim7FrameIndices[] = {12, 13, 14, 15};
static const int16 kAnim7FrameTicks[] = {10, 10, 10, 10};
static const BBRect kAnim7FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim8FrameIndices[] = {16};
static const int16 kAnim8FrameTicks[] = {10};
static const BBRect kAnim8FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim9FrameIndices[] = {17};
static const int16 kAnim9FrameTicks[] = {10};
static const BBRect kAnim9FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim10FrameIndices[] = {18};
static const int16 kAnim10FrameTicks[] = {6};
static const BBRect kAnim10FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim11FrameIndices[] = {19, 20, 21, 22, 23, 24, 25, 26, 27};
static const int16 kAnim11FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim11FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim12FrameIndices[] = {28, 29, 30, 31, 32, 33};
static const int16 kAnim12FrameTicks[] = {10, 10, 10, 10, 10, 10};
static const BBRect kAnim12FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim13FrameIndices[] = {34, 35};
static const int16 kAnim13FrameTicks[] = {6, 6};
static const BBRect kAnim13FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim14FrameIndices[] = {36, 37};
static const int16 kAnim14FrameTicks[] = {6, 6};
static const BBRect kAnim14FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim15FrameIndices[] = {38, 39};
static const int16 kAnim15FrameTicks[] = {6, 6};
static const BBRect kAnim15FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim16FrameIndices[] = {40, 41};
static const int16 kAnim16FrameTicks[] = {6, 6};
static const BBRect kAnim16FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim17FrameIndices[] = {42};
static const int16 kAnim17FrameTicks[] = {6};
static const BBRect kAnim17FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim18FrameIndices[] = {43};
static const int16 kAnim18FrameTicks[] = {6};
static const BBRect kAnim18FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim19FrameIndices[] = {44, 45};
static const int16 kAnim19FrameTicks[] = {6, 6};
static const BBRect kAnim19FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim20FrameIndices[] = {46, 47};
static const int16 kAnim20FrameTicks[] = {6, 6};
static const BBRect kAnim20FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim21FrameIndices[] = {48, 49};
static const int16 kAnim21FrameTicks[] = {6, 6};
static const BBRect kAnim21FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim22FrameIndices[] = {50, 51};
static const int16 kAnim22FrameTicks[] = {10, 10};
static const BBRect kAnim22FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim23FrameIndices[] = {52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64};
static const int16 kAnim23FrameTicks[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
static const BBRect kAnim23FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim24FrameIndices[] = {65, 66, 67};
static const int16 kAnim24FrameTicks[] = {11, 16, 6};
static const BBRect kAnim24FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim25FrameIndices[] = {68, 67, 69, 67};
static const int16 kAnim25FrameTicks[] = {6, 6, 11, 6};
static const BBRect kAnim25FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim26FrameIndices[] = {70, 71, 72, 71};
static const int16 kAnim26FrameTicks[] = {6, 6, 6, 6};
static const BBRect kAnim26FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim27FrameIndices[] = {73, 74, 75, 74};
static const int16 kAnim27FrameTicks[] = {6, 6, 6, 6};
static const BBRect kAnim27FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim28FrameIndices[] = {76};
static const int16 kAnim28FrameTicks[] = {6};
static const BBRect kAnim28FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim29FrameIndices[] = {77, 78, 79, 78};
static const int16 kAnim29FrameTicks[] = {6, 6, 18, 6};
static const BBRect kAnim29FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim30FrameIndices[] = {77, 80, 81, 80};
static const int16 kAnim30FrameTicks[] = {6, 6, 10, 6};
static const BBRect kAnim30FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim31FrameIndices[] = {82, 83, 84, 83};
static const int16 kAnim31FrameTicks[] = {6, 6, 6, 6};
static const BBRect kAnim31FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim32FrameIndices[] = {85, 86, 87, 86};
static const int16 kAnim32FrameTicks[] = {6, 6, 6, 6};
static const BBRect kAnim32FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim33FrameIndices[] = {88};
static const int16 kAnim33FrameTicks[] = {6};
static const BBRect kAnim33FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim34FrameIndices[] = {89};
static const int16 kAnim34FrameTicks[] = {6};
static const BBRect kAnim34FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim35FrameIndices[] = {90};
static const int16 kAnim35FrameTicks[] = {6};
static const BBRect kAnim35FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim36FrameIndices[] = {91, 92, 93, 91, 93, 91, 92, 93, 92, 91, 92, 93, 91, 93, 91, 92, 93, 92};
static const int16 kAnim36FrameTicks[] = {10, 6, 8, 6, 6, 8, 6, 6, 6, 10, 6, 8, 6, 6, 8, 6, 6, 6};
static const BBRect kAnim36FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim37FrameIndices[] = {94, 95, 96, 94, 96, 94, 95, 96, 95, 94, 95, 96, 94, 96, 94, 95, 96, 95};
static const int16 kAnim37FrameTicks[] = {10, 6, 8, 6, 6, 8, 6, 6, 6, 10, 6, 8, 6, 6, 8, 6, 6, 6};
static const BBRect kAnim37FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const ObjAnimation kAnimations[] = {
{2, kAnim0FrameIndices, kAnim0FrameTicks, kAnim0FrameRects},
{2, kAnim1FrameIndices, kAnim1FrameTicks, kAnim1FrameRects},
{2, kAnim2FrameIndices, kAnim2FrameTicks, kAnim2FrameRects},
{1, kAnim3FrameIndices, kAnim3FrameTicks, kAnim3FrameRects},
{1, kAnim4FrameIndices, kAnim4FrameTicks, kAnim4FrameRects},
{1, kAnim5FrameIndices, kAnim5FrameTicks, kAnim5FrameRects},
{3, kAnim6FrameIndices, kAnim6FrameTicks, kAnim6FrameRects},
{4, kAnim7FrameIndices, kAnim7FrameTicks, kAnim7FrameRects},
{1, kAnim8FrameIndices, kAnim8FrameTicks, kAnim8FrameRects},
{1, kAnim9FrameIndices, kAnim9FrameTicks, kAnim9FrameRects},
{1, kAnim10FrameIndices, kAnim10FrameTicks, kAnim10FrameRects},
{9, kAnim11FrameIndices, kAnim11FrameTicks, kAnim11FrameRects},
{6, kAnim12FrameIndices, kAnim12FrameTicks, kAnim12FrameRects},
{2, kAnim13FrameIndices, kAnim13FrameTicks, kAnim13FrameRects},
{2, kAnim14FrameIndices, kAnim14FrameTicks, kAnim14FrameRects},
{2, kAnim15FrameIndices, kAnim15FrameTicks, kAnim15FrameRects},
{2, kAnim16FrameIndices, kAnim16FrameTicks, kAnim16FrameRects},
{1, kAnim17FrameIndices, kAnim17FrameTicks, kAnim17FrameRects},
{1, kAnim18FrameIndices, kAnim18FrameTicks, kAnim18FrameRects},
{2, kAnim19FrameIndices, kAnim19FrameTicks, kAnim19FrameRects},
{2, kAnim20FrameIndices, kAnim20FrameTicks, kAnim20FrameRects},
{2, kAnim21FrameIndices, kAnim21FrameTicks, kAnim21FrameRects},
{2, kAnim22FrameIndices, kAnim22FrameTicks, kAnim22FrameRects},
{13, kAnim23FrameIndices, kAnim23FrameTicks, kAnim23FrameRects},
{3, kAnim24FrameIndices, kAnim24FrameTicks, kAnim24FrameRects},
{4, kAnim25FrameIndices, kAnim25FrameTicks, kAnim25FrameRects},
{4, kAnim26FrameIndices, kAnim26FrameTicks, kAnim26FrameRects},
{4, kAnim27FrameIndices, kAnim27FrameTicks, kAnim27FrameRects},
{1, kAnim28FrameIndices, kAnim28FrameTicks, kAnim28FrameRects},
{4, kAnim29FrameIndices, kAnim29FrameTicks, kAnim29FrameRects},
{4, kAnim30FrameIndices, kAnim30FrameTicks, kAnim30FrameRects},
{4, kAnim31FrameIndices, kAnim31FrameTicks, kAnim31FrameRects},
{4, kAnim32FrameIndices, kAnim32FrameTicks, kAnim32FrameRects},
{1, kAnim33FrameIndices, kAnim33FrameTicks, kAnim33FrameRects},
{1, kAnim34FrameIndices, kAnim34FrameTicks, kAnim34FrameRects},
{1, kAnim35FrameIndices, kAnim35FrameTicks, kAnim35FrameRects},
{18, kAnim36FrameIndices, kAnim36FrameTicks, kAnim36FrameRects},
{18, kAnim37FrameIndices, kAnim37FrameTicks, kAnim37FrameRects}
};
const ObjAnimation *MinigameBbAirGuitar::getAnimation(int animIndex) {
return &kAnimations[animIndex];
}
} // End of namespace Bbvs

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_MINIGAMES_BBANT_H
#define BBVS_MINIGAMES_BBANT_H
#include "bbvs/minigames/minigame.h"
namespace Bbvs {
class MinigameBbAnt : public Minigame {
public:
MinigameBbAnt(BbvsEngine *vm) : Minigame(vm) {};
bool run(bool fromMainGame) override;
public:
struct Obj {
int kind;
int x, y, priority;
int xIncr, yIncr;
const ObjAnimation *anim;
int frameIndex;
int ticks;
int otherObjIndex;
int animIndex;
int animIndexIncr;
int status;
int field30;
int damageCtr;
int smokeCtr;
int counter;
int hasSmoke;
const ObjAnimation *anim2;
int frameIndex2;
int ticks2;
int status2;
int flag;
};
enum {
kMaxObjectsCount = 256,
kScaleDim = 28
};
struct ObjInit {
const ObjAnimation *anim1;
const ObjAnimation *anim2;
const ObjAnimation *anim3;
int x, y;
};
Obj _objects[kMaxObjectsCount];
int _score, _hiScore;
int _totalBugsCount;
int _bugsChanceByKind[6], _bugsCountByKind[6];
int _skullBugCtr;
int _stompX, _stompY;
int _stompDelay1;
int _stompCounter1;
int _stompCounter2;
int _stompCount;
int _hasLastStompObj;
Obj *_lastStompObj;
int _counter1;
int _countdown10;
int _counter4;
int _levelTimeDelay;
int _levelTimeLeft;
int _countdown4;
int _countdown3;
int _countdown6;
int _countdown5;
int _countdown7;
byte _scaleBuf[kScaleDim * kScaleDim];
const ObjAnimation *getAnimation(int animIndex);
const ObjInit *getObjInit(int index);
const ObjAnimation * const *getObjKindAnimTable(int kind);
const ObjAnimation *getObjAnim(int index);
void buildDrawList0(DrawList &drawList);
void buildDrawList1(DrawList &drawList);
void buildDrawList2(DrawList &drawList);
void buildDrawList3(DrawList &drawList);
void drawMagnifyingGlass(DrawList &drawList);
void drawSprites();
void drawSprites0();
void drawSprites1();
void drawSprites2();
void drawSprites3();
Obj *getFreeObject();
void initObjects();
void initObjects0();
void initObjects1();
void initVars();
void initVars1();
void initVars2();
void initVars3();
bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus2(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus3(int mouseX, int mouseY, uint mouseButtons);
void getRandomBugObjValues(int &x, int &y, int &animIndexIncr, int &field30);
void insertBugSmokeObj(int x, int y, int bugObjIndex);
void insertSmokeObj(int x, int y);
void resetObj(int objIndex);
void insertStompObj(int x, int y);
void removeStompObj(Obj *obj);
void insertBugObj(int kind, int animIndexIncr, int always0, int x, int y, int field30, int always1);
void removeBugObj(int objIndex);
void updateBugObjAnim(int objIndex);
void updateObjAnim2(int objIndex);
void insertRandomBugObj(int kind);
bool isBugOutOfScreen(int objIndex);
void updateObjAnim3(int objIndex);
void updateBugObj1(int objIndex);
void updateObjKind2(int objIndex);
void updateObjKind3(int objIndex);
void updateObjKind4(int objIndex);
void updateObjKind5(int objIndex);
void updateStompObj(int objIndex);
void updateSmokeObj(int objIndex);
void updateFootObj(int objIndex);
bool isBugAtCandy(int objIndex, int &candyObjIndex);
bool isMagGlassAtBug(int objIndex);
bool isMagGlassAtBeavisLeg(int objIndex);
bool testObj5(int objIndex);
void updateObjs(uint mouseButtons);
void update();
void scale2x(int x, int y);
void loadSounds();
};
} // End of namespace Bbvs
#endif // BBVS_MINIGAMES_BBANT_H

View File

@@ -0,0 +1,756 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/minigames/bbant.h"
namespace Bbvs {
static const int kAnim0FrameIndices[] = {0, 1, 2};
static const int16 kAnim0FrameTicks[] = {10, 8, 8};
static const BBRect kAnim0FrameRects[] = {{-3, -8, 6, 14}, {-3, -8, 6, 13}, {-3, -7, 6, 12}};
static const int kAnim1FrameIndices[] = {3, 4, 5};
static const int16 kAnim1FrameTicks[] = {10, 8, 8};
static const BBRect kAnim1FrameRects[] = {{-5, -6, 13, 9}, {-5, -6, 13, 10}, {-5, -6, 13, 10}};
static const int kAnim2FrameIndices[] = {6, 7, 8};
static const int16 kAnim2FrameTicks[] = {10, 8, 8};
static const BBRect kAnim2FrameRects[] = {{-6, -6, 17, 7}, {-6, -6, 15, 6}, {-7, -6, 17, 6}};
static const int kAnim3FrameIndices[] = {9, 10, 11};
static const int16 kAnim3FrameTicks[] = {10, 8, 8};
static const BBRect kAnim3FrameRects[] = {{-5, -7, 13, 8}, {-5, -7, 12, 7}, {-5, -7, 12, 9}};
static const int kAnim4FrameIndices[] = {12, 13, 14};
static const int16 kAnim4FrameTicks[] = {10, 8, 8};
static const BBRect kAnim4FrameRects[] = {{-3, -9, 7, 11}, {-3, -9, 7, 11}, {-3, -9, 7, 11}};
static const int kAnim5FrameIndices[] = {15, 16, 17};
static const int16 kAnim5FrameTicks[] = {10, 8, 8};
static const BBRect kAnim5FrameRects[] = {{-7, -8, 13, 9}, {-7, -7, 13, 8}, {-7, -7, 13, 8}};
static const int kAnim6FrameIndices[] = {18, 19, 20};
static const int16 kAnim6FrameTicks[] = {10, 8, 8};
static const BBRect kAnim6FrameRects[] = {{-10, -6, 17, 7}, {-11, -6, 18, 7}, {-11, -6, 18, 6}};
static const int kAnim7FrameIndices[] = {21, 22, 23};
static const int16 kAnim7FrameTicks[] = {10, 8, 8};
static const BBRect kAnim7FrameRects[] = {{-7, -6, 13, 8}, {-7, -7, 12, 9}, {-7, -7, 13, 9}};
static const int kAnim8FrameIndices[] = {24};
static const int16 kAnim8FrameTicks[] = {8};
static const BBRect kAnim8FrameRects[] = {{-3, -9, 6, 12}};
static const int kAnim9FrameIndices[] = {25};
static const int16 kAnim9FrameTicks[] = {8};
static const BBRect kAnim9FrameRects[] = {{-5, -6, 12, 7}};
static const int kAnim10FrameIndices[] = {26};
static const int16 kAnim10FrameTicks[] = {8};
static const BBRect kAnim10FrameRects[] = {{-4, -6, 13, 6}};
static const int kAnim11FrameIndices[] = {27};
static const int16 kAnim11FrameTicks[] = {8};
static const BBRect kAnim11FrameRects[] = {{-5, -7, 11, 8}};
static const int kAnim12FrameIndices[] = {28};
static const int16 kAnim12FrameTicks[] = {8};
static const BBRect kAnim12FrameRects[] = {{-2, -10, 5, 12}};
static const int kAnim13FrameIndices[] = {29};
static const int16 kAnim13FrameTicks[] = {8};
static const BBRect kAnim13FrameRects[] = {{-6, -8, 13, 9}};
static const int kAnim14FrameIndices[] = {30};
static const int16 kAnim14FrameTicks[] = {8};
static const BBRect kAnim14FrameRects[] = {{-8, -6, 13, 6}};
static const int kAnim15FrameIndices[] = {31};
static const int16 kAnim15FrameTicks[] = {8};
static const BBRect kAnim15FrameRects[] = {{-7, -7, 12, 8}};
static const int kAnim16FrameIndices[] = {0, 1, 2};
static const int16 kAnim16FrameTicks[] = {6, 6, 6};
static const BBRect kAnim16FrameRects[] = {{-3, -8, 6, 14}, {-3, -8, 6, 13}, {-3, -7, 6, 12}};
static const int kAnim17FrameIndices[] = {3, 4, 5};
static const int16 kAnim17FrameTicks[] = {6, 6, 6};
static const BBRect kAnim17FrameRects[] = {{-5, -6, 13, 9}, {-5, -6, 13, 10}, {-5, -6, 13, 10}};
static const int kAnim18FrameIndices[] = {6, 7, 8};
static const int16 kAnim18FrameTicks[] = {6, 6, 6};
static const BBRect kAnim18FrameRects[] = {{-6, -6, 17, 7}, {-6, -6, 15, 6}, {-7, -6, 17, 6}};
static const int kAnim19FrameIndices[] = {9, 10, 11};
static const int16 kAnim19FrameTicks[] = {6, 6, 6};
static const BBRect kAnim19FrameRects[] = {{-5, -7, 13, 8}, {-5, -7, 12, 7}, {-5, -7, 12, 9}};
static const int kAnim20FrameIndices[] = {12, 13, 14};
static const int16 kAnim20FrameTicks[] = {6, 6, 6};
static const BBRect kAnim20FrameRects[] = {{-3, -9, 7, 11}, {-3, -9, 7, 11}, {-3, -9, 7, 11}};
static const int kAnim21FrameIndices[] = {15, 16, 17};
static const int16 kAnim21FrameTicks[] = {6, 6, 6};
static const BBRect kAnim21FrameRects[] = {{-7, -8, 13, 9}, {-7, -7, 13, 8}, {-7, -7, 13, 8}};
static const int kAnim22FrameIndices[] = {18, 19, 20};
static const int16 kAnim22FrameTicks[] = {6, 6, 6};
static const BBRect kAnim22FrameRects[] = {{-10, -6, 17, 7}, {-11, -6, 18, 7}, {-11, -6, 18, 6}};
static const int kAnim23FrameIndices[] = {21, 22, 23};
static const int16 kAnim23FrameTicks[] = {6, 6, 6};
static const BBRect kAnim23FrameRects[] = {{-7, -6, 13, 8}, {-7, -7, 12, 9}, {-7, -7, 13, 9}};
static const int kAnim24FrameIndices[] = {32, 33, 34, 35, 36, 37, 36, 37, 36, 37, 36, 37, 36, 38};
static const int16 kAnim24FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim24FrameRects[] = {{-3, -14, 12, 10}, {-2, -21, 11, 11}, {0, -23, 8, 14}, {-6, -15, 13, 11}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 5}};
static const int kAnim25FrameIndices[] = {39, 40, 41, 42, 43, 44, 43, 44, 43, 44, 43, 44, 43, 45};
static const int16 kAnim25FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim25FrameRects[] = {{-9, -14, 13, 10}, {-8, -22, 12, 12}, {-8, -24, 8, 15}, {-7, -15, 13, 10}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}};
static const int kAnim26FrameIndices[] = {46, 47, 48};
static const int16 kAnim26FrameTicks[] = {10, 8, 8};
static const BBRect kAnim26FrameRects[] = {{-3, -8, 6, 14}, {-3, -8, 6, 13}, {-3, -7, 6, 12}};
static const int kAnim27FrameIndices[] = {49, 50, 51};
static const int16 kAnim27FrameTicks[] = {10, 8, 8};
static const BBRect kAnim27FrameRects[] = {{-5, -6, 13, 9}, {-5, -6, 13, 10}, {-5, -6, 13, 10}};
static const int kAnim28FrameIndices[] = {52, 53, 54};
static const int16 kAnim28FrameTicks[] = {10, 8, 8};
static const BBRect kAnim28FrameRects[] = {{-6, -6, 17, 7}, {-6, -6, 15, 6}, {-7, -6, 17, 6}};
static const int kAnim29FrameIndices[] = {55, 56, 57};
static const int16 kAnim29FrameTicks[] = {10, 8, 8};
static const BBRect kAnim29FrameRects[] = {{-5, -7, 13, 8}, {-5, -7, 12, 7}, {-5, -7, 12, 9}};
static const int kAnim30FrameIndices[] = {58, 59, 60};
static const int16 kAnim30FrameTicks[] = {10, 8, 8};
static const BBRect kAnim30FrameRects[] = {{-3, -9, 7, 11}, {-3, -9, 7, 11}, {-3, -9, 7, 11}};
static const int kAnim31FrameIndices[] = {61, 62, 63};
static const int16 kAnim31FrameTicks[] = {10, 8, 8};
static const BBRect kAnim31FrameRects[] = {{-7, -8, 13, 9}, {-7, -7, 13, 8}, {-7, -7, 13, 8}};
static const int kAnim32FrameIndices[] = {64, 65, 66};
static const int16 kAnim32FrameTicks[] = {10, 8, 8};
static const BBRect kAnim32FrameRects[] = {{-10, -6, 17, 7}, {-11, -6, 18, 7}, {-11, -6, 18, 6}};
static const int kAnim33FrameIndices[] = {67, 68, 69};
static const int16 kAnim33FrameTicks[] = {10, 8, 8};
static const BBRect kAnim33FrameRects[] = {{-7, -6, 13, 8}, {-7, -7, 12, 9}, {-7, -7, 13, 9}};
static const int kAnim34FrameIndices[] = {70};
static const int16 kAnim34FrameTicks[] = {8};
static const BBRect kAnim34FrameRects[] = {{-3, -9, 6, 12}};
static const int kAnim35FrameIndices[] = {71};
static const int16 kAnim35FrameTicks[] = {8};
static const BBRect kAnim35FrameRects[] = {{-5, -6, 12, 7}};
static const int kAnim36FrameIndices[] = {72};
static const int16 kAnim36FrameTicks[] = {8};
static const BBRect kAnim36FrameRects[] = {{-4, -6, 13, 6}};
static const int kAnim37FrameIndices[] = {73};
static const int16 kAnim37FrameTicks[] = {8};
static const BBRect kAnim37FrameRects[] = {{-5, -7, 11, 8}};
static const int kAnim38FrameIndices[] = {74};
static const int16 kAnim38FrameTicks[] = {8};
static const BBRect kAnim38FrameRects[] = {{-2, -10, 5, 12}};
static const int kAnim39FrameIndices[] = {75};
static const int16 kAnim39FrameTicks[] = {8};
static const BBRect kAnim39FrameRects[] = {{-6, -8, 13, 9}};
static const int kAnim40FrameIndices[] = {76};
static const int16 kAnim40FrameTicks[] = {8};
static const BBRect kAnim40FrameRects[] = {{-8, -6, 13, 6}};
static const int kAnim41FrameIndices[] = {77};
static const int16 kAnim41FrameTicks[] = {8};
static const BBRect kAnim41FrameRects[] = {{-7, -7, 12, 8}};
static const int kAnim42FrameIndices[] = {46, 47, 48};
static const int16 kAnim42FrameTicks[] = {6, 6, 6};
static const BBRect kAnim42FrameRects[] = {{-3, -8, 6, 14}, {-3, -8, 6, 13}, {-3, -7, 6, 12}};
static const int kAnim43FrameIndices[] = {49, 50, 51};
static const int16 kAnim43FrameTicks[] = {6, 6, 6};
static const BBRect kAnim43FrameRects[] = {{-5, -6, 13, 9}, {-5, -6, 13, 10}, {-5, -6, 13, 10}};
static const int kAnim44FrameIndices[] = {52, 53, 54};
static const int16 kAnim44FrameTicks[] = {6, 6, 6};
static const BBRect kAnim44FrameRects[] = {{-6, -6, 17, 7}, {-6, -6, 15, 6}, {-7, -6, 17, 6}};
static const int kAnim45FrameIndices[] = {55, 56, 57};
static const int16 kAnim45FrameTicks[] = {6, 6, 6};
static const BBRect kAnim45FrameRects[] = {{-5, -7, 13, 8}, {-5, -7, 12, 7}, {-5, -7, 12, 9}};
static const int kAnim46FrameIndices[] = {58, 59, 60};
static const int16 kAnim46FrameTicks[] = {6, 6, 6};
static const BBRect kAnim46FrameRects[] = {{-3, -9, 7, 11}, {-3, -9, 7, 11}, {-3, -9, 7, 11}};
static const int kAnim47FrameIndices[] = {61, 62, 63};
static const int16 kAnim47FrameTicks[] = {6, 6, 6};
static const BBRect kAnim47FrameRects[] = {{-7, -8, 13, 9}, {-7, -7, 13, 8}, {-7, -7, 13, 8}};
static const int kAnim48FrameIndices[] = {64, 65, 66};
static const int16 kAnim48FrameTicks[] = {6, 6, 6};
static const BBRect kAnim48FrameRects[] = {{-10, -6, 17, 7}, {-11, -6, 18, 7}, {-11, -6, 18, 6}};
static const int kAnim49FrameIndices[] = {67, 68, 69};
static const int16 kAnim49FrameTicks[] = {6, 6, 6};
static const BBRect kAnim49FrameRects[] = {{-7, -6, 13, 8}, {-7, -7, 12, 9}, {-7, -7, 13, 9}};
static const int kAnim50FrameIndices[] = {78, 79, 80, 81, 82, 83, 82, 83, 82, 83, 82, 83, 82, 84};
static const int16 kAnim50FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim50FrameRects[] = {{-3, -14, 12, 10}, {-2, -21, 11, 11}, {0, -23, 8, 14}, {-6, -15, 13, 11}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 6}, {-8, -4, 15, 5}, {-9, -4, 16, 5}};
static const int kAnim51FrameIndices[] = {85, 86, 87, 88, 89, 90, 89, 90, 89, 90, 89, 90, 89, 91};
static const int16 kAnim51FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim51FrameRects[] = {{-9, -14, 13, 10}, {-8, -22, 12, 12}, {-8, -24, 8, 15}, {-7, -15, 13, 10}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}, {-6, -4, 15, 7}, {-7, -4, 16, 6}};
static const int kAnim52FrameIndices[] = {92, 93, 94};
static const int16 kAnim52FrameTicks[] = {10, 8, 8};
static const BBRect kAnim52FrameRects[] = {{-6, -14, 13, 24}, {-7, -13, 14, 23}, {-6, -13, 12, 22}};
static const int kAnim53FrameIndices[] = {95, 96, 97};
static const int16 kAnim53FrameTicks[] = {10, 8, 8};
static const BBRect kAnim53FrameRects[] = {{-4, -12, 19, 17}, {-3, -12, 18, 18}, {-2, -12, 17, 18}};
static const int kAnim54FrameIndices[] = {98, 99, 100};
static const int16 kAnim54FrameTicks[] = {10, 8, 8};
static const BBRect kAnim54FrameRects[] = {{-6, -16, 23, 14}, {-6, -15, 24, 13}, {-7, -15, 25, 14}};
static const int kAnim55FrameIndices[] = {101, 102, 103};
static const int16 kAnim55FrameTicks[] = {10, 8, 8};
static const BBRect kAnim55FrameRects[] = {{-4, -22, 16, 20}, {-3, -23, 14, 22}, {-4, -23, 14, 22}};
static const int kAnim56FrameIndices[] = {104, 105, 106};
static const int16 kAnim56FrameTicks[] = {10, 8, 8};
static const BBRect kAnim56FrameRects[] = {{-5, -24, 11, 23}, {-5, -25, 11, 25}, {-5, -25, 11, 26}};
static const int kAnim57FrameIndices[] = {107, 108, 109};
static const int16 kAnim57FrameTicks[] = {10, 8, 8};
static const BBRect kAnim57FrameRects[] = {{-10, -23, 15, 21}, {-11, -22, 16, 20}, {-11, -23, 17, 21}};
static const int kAnim58FrameIndices[] = {110, 111, 112};
static const int16 kAnim58FrameTicks[] = {10, 8, 8};
static const BBRect kAnim58FrameRects[] = {{-17, -15, 25, 15}, {-17, -15, 25, 14}, {-17, -15, 25, 14}};
static const int kAnim59FrameIndices[] = {113, 114, 115};
static const int16 kAnim59FrameTicks[] = {10, 8, 8};
static const BBRect kAnim59FrameRects[] = {{-14, -12, 20, 17}, {-14, -13, 19, 18}, {-14, -13, 19, 18}};
static const int kAnim60FrameIndices[] = {116};
static const int16 kAnim60FrameTicks[] = {6};
static const BBRect kAnim60FrameRects[] = {{-6, -12, 12, 23}};
static const int kAnim61FrameIndices[] = {117};
static const int16 kAnim61FrameTicks[] = {6};
static const BBRect kAnim61FrameRects[] = {{-5, -11, 20, 19}};
static const int kAnim62FrameIndices[] = {118};
static const int16 kAnim62FrameTicks[] = {6};
static const BBRect kAnim62FrameRects[] = {{-8, -14, 27, 15}};
static const int kAnim63FrameIndices[] = {119};
static const int16 kAnim63FrameTicks[] = {6};
static const BBRect kAnim63FrameRects[] = {{-4, -22, 17, 20}};
static const int kAnim64FrameIndices[] = {120};
static const int16 kAnim64FrameTicks[] = {6};
static const BBRect kAnim64FrameRects[] = {{-6, -25, 13, 25}};
static const int kAnim65FrameIndices[] = {121};
static const int16 kAnim65FrameTicks[] = {6};
static const BBRect kAnim65FrameRects[] = {{-11, -23, 17, 23}};
static const int kAnim66FrameIndices[] = {122};
static const int16 kAnim66FrameTicks[] = {6};
static const BBRect kAnim66FrameRects[] = {{-18, -13, 29, 13}};
static const int kAnim67FrameIndices[] = {123};
static const int16 kAnim67FrameTicks[] = {6};
static const BBRect kAnim67FrameRects[] = {{-14, -12, 21, 19}};
static const int kAnim68FrameIndices[] = {92, 93, 94};
static const int16 kAnim68FrameTicks[] = {6, 6, 6};
static const BBRect kAnim68FrameRects[] = {{-6, -14, 13, 24}, {-7, -13, 14, 23}, {-6, -13, 12, 22}};
static const int kAnim69FrameIndices[] = {95, 96, 97};
static const int16 kAnim69FrameTicks[] = {6, 6, 6};
static const BBRect kAnim69FrameRects[] = {{-4, -12, 19, 17}, {-3, -12, 18, 18}, {-2, -12, 17, 18}};
static const int kAnim70FrameIndices[] = {98, 99, 100};
static const int16 kAnim70FrameTicks[] = {6, 6, 6};
static const BBRect kAnim70FrameRects[] = {{-6, -16, 23, 14}, {-6, -15, 24, 13}, {-7, -15, 25, 14}};
static const int kAnim71FrameIndices[] = {101, 102, 103};
static const int16 kAnim71FrameTicks[] = {6, 6, 6};
static const BBRect kAnim71FrameRects[] = {{-4, -22, 16, 20}, {-3, -23, 14, 22}, {-4, -23, 14, 22}};
static const int kAnim72FrameIndices[] = {104, 105, 106};
static const int16 kAnim72FrameTicks[] = {6, 6, 6};
static const BBRect kAnim72FrameRects[] = {{-5, -24, 11, 23}, {-5, -25, 11, 25}, {-5, -25, 11, 26}};
static const int kAnim73FrameIndices[] = {107, 108, 109};
static const int16 kAnim73FrameTicks[] = {6, 6, 6};
static const BBRect kAnim73FrameRects[] = {{-10, -23, 15, 21}, {-11, -22, 16, 20}, {-11, -23, 17, 21}};
static const int kAnim74FrameIndices[] = {110, 111, 112};
static const int16 kAnim74FrameTicks[] = {6, 6, 6};
static const BBRect kAnim74FrameRects[] = {{-17, -15, 25, 15}, {-17, -15, 25, 14}, {-17, -15, 25, 14}};
static const int kAnim75FrameIndices[] = {113, 114, 115};
static const int16 kAnim75FrameTicks[] = {6, 6, 6};
static const BBRect kAnim75FrameRects[] = {{-14, -12, 20, 17}, {-14, -13, 19, 18}, {-14, -13, 19, 18}};
static const int kAnim76FrameIndices[] = {124, 125, 126, 127, 128, 129, 128, 129, 128, 129, 128, 129, 128, 130};
static const int16 kAnim76FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim76FrameRects[] = {{-14, -23, 23, 18}, {-12, -32, 18, 23}, {-16, -29, 18, 22}, {-17, -17, 23, 17}, {-17, -10, 26, 14}, {-17, -12, 25, 15}, {-17, -10, 26, 14}, {-17, -12, 25, 15}, {-17, -10, 26, 14}, {-17, -12, 25, 15}, {-17, -10, 26, 14}, {-17, -12, 25, 15}, {-17, -10, 26, 14}, {-18, -13, 28, 14}};
static const int kAnim77FrameIndices[] = {131, 132, 133, 134, 135, 136, 135, 136, 135, 136, 135, 136, 135, 137};
static const int16 kAnim77FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim77FrameRects[] = {{-6, -24, 21, 19}, {-5, -33, 19, 24}, {-1, -29, 18, 22}, {-5, -17, 22, 17}, {-6, -10, 23, 14}, {-7, -10, 26, 13}, {-6, -10, 23, 14}, {-7, -10, 26, 13}, {-6, -10, 23, 14}, {-7, -10, 26, 13}, {-6, -10, 23, 14}, {-7, -10, 26, 13}, {-6, -10, 23, 14}, {-7, -12, 26, 14}};
static const int kAnim78FrameIndices[] = {138, 139, 140};
static const int16 kAnim78FrameTicks[] = {10, 8, 8};
static const BBRect kAnim78FrameRects[] = {{-3, -17, 7, 20}, {-3, -16, 7, 19}, {-3, -16, 7, 19}};
static const int kAnim79FrameIndices[] = {141, 142, 143};
static const int16 kAnim79FrameTicks[] = {10, 8, 8};
static const BBRect kAnim79FrameRects[] = {{-6, -14, 13, 15}, {-7, -13, 14, 14}, {-6, -13, 13, 14}};
static const int kAnim80FrameIndices[] = {144, 145, 146};
static const int16 kAnim80FrameTicks[] = {10, 8, 8};
static const BBRect kAnim80FrameRects[] = {{-10, -10, 20, 9}, {-9, -9, 19, 8}, {-9, -9, 19, 8}};
static const int kAnim81FrameIndices[] = {147, 148, 149};
static const int16 kAnim81FrameTicks[] = {10, 8, 8};
static const BBRect kAnim81FrameRects[] = {{-7, -11, 16, 10}, {-7, -11, 16, 10}, {-7, -11, 16, 10}};
static const int kAnim82FrameIndices[] = {150, 151, 152};
static const int16 kAnim82FrameTicks[] = {10, 8, 8};
static const BBRect kAnim82FrameRects[] = {{-3, -13, 7, 16}, {-3, -13, 7, 16}, {-3, -12, 7, 15}};
static const int kAnim83FrameIndices[] = {153, 154, 155};
static const int16 kAnim83FrameTicks[] = {10, 8, 8};
static const BBRect kAnim83FrameRects[] = {{-8, -11, 18, 10}, {-7, -11, 16, 11}, {-7, -10, 17, 9}};
static const int kAnim84FrameIndices[] = {156, 157, 158};
static const int16 kAnim84FrameTicks[] = {10, 8, 8};
static const BBRect kAnim84FrameRects[] = {{-8, -9, 20, 7}, {-9, -9, 21, 8}, {-9, -9, 21, 8}};
static const int kAnim85FrameIndices[] = {159, 160, 161};
static const int16 kAnim85FrameTicks[] = {10, 8, 8};
static const BBRect kAnim85FrameRects[] = {{-6, -14, 15, 15}, {-5, -13, 12, 14}, {-6, -13, 14, 14}};
static const int kAnim86FrameIndices[] = {162};
static const int16 kAnim86FrameTicks[] = {6};
static const BBRect kAnim86FrameRects[] = {{-3, -15, 8, 18}};
static const int kAnim87FrameIndices[] = {163};
static const int16 kAnim87FrameTicks[] = {6};
static const BBRect kAnim87FrameRects[] = {{-7, -13, 14, 14}};
static const int kAnim88FrameIndices[] = {164};
static const int16 kAnim88FrameTicks[] = {6};
static const BBRect kAnim88FrameRects[] = {{-11, -9, 21, 8}};
static const int kAnim89FrameIndices[] = {165};
static const int16 kAnim89FrameTicks[] = {6};
static const BBRect kAnim89FrameRects[] = {{-9, -11, 18, 11}};
static const int kAnim90FrameIndices[] = {166};
static const int16 kAnim90FrameTicks[] = {6};
static const BBRect kAnim90FrameRects[] = {{-3, -12, 7, 15}};
static const int kAnim91FrameIndices[] = {167};
static const int16 kAnim91FrameTicks[] = {6};
static const BBRect kAnim91FrameRects[] = {{-8, -11, 17, 12}};
static const int kAnim92FrameIndices[] = {168};
static const int16 kAnim92FrameTicks[] = {6};
static const BBRect kAnim92FrameRects[] = {{-9, -10, 21, 9}};
static const int kAnim93FrameIndices[] = {169};
static const int16 kAnim93FrameTicks[] = {6};
static const BBRect kAnim93FrameRects[] = {{-6, -14, 14, 15}};
static const int kAnim94FrameIndices[] = {138, 139, 140};
static const int16 kAnim94FrameTicks[] = {6, 6, 6};
static const BBRect kAnim94FrameRects[] = {{-3, -17, 7, 20}, {-3, -16, 7, 19}, {-3, -16, 7, 19}};
static const int kAnim95FrameIndices[] = {141, 142, 143};
static const int16 kAnim95FrameTicks[] = {6, 6, 6};
static const BBRect kAnim95FrameRects[] = {{-6, -14, 13, 15}, {-7, -13, 14, 14}, {-6, -13, 13, 14}};
static const int kAnim96FrameIndices[] = {144, 145, 146};
static const int16 kAnim96FrameTicks[] = {6, 6, 6};
static const BBRect kAnim96FrameRects[] = {{-10, -10, 20, 9}, {-9, -9, 19, 8}, {-9, -9, 19, 8}};
static const int kAnim97FrameIndices[] = {147, 148, 149};
static const int16 kAnim97FrameTicks[] = {6, 6, 6};
static const BBRect kAnim97FrameRects[] = {{-7, -11, 16, 10}, {-7, -11, 16, 10}, {-7, -11, 16, 10}};
static const int kAnim98FrameIndices[] = {150, 151, 152};
static const int16 kAnim98FrameTicks[] = {6, 6, 6};
static const BBRect kAnim98FrameRects[] = {{-3, -13, 7, 16}, {-3, -13, 7, 16}, {-3, -12, 7, 15}};
static const int kAnim99FrameIndices[] = {153, 154, 155};
static const int16 kAnim99FrameTicks[] = {6, 6, 6};
static const BBRect kAnim99FrameRects[] = {{-8, -11, 18, 10}, {-7, -11, 16, 11}, {-7, -10, 17, 9}};
static const int kAnim100FrameIndices[] = {156, 157, 158};
static const int16 kAnim100FrameTicks[] = {6, 6, 6};
static const BBRect kAnim100FrameRects[] = {{-8, -9, 20, 7}, {-9, -9, 21, 8}, {-9, -9, 21, 8}};
static const int kAnim101FrameIndices[] = {159, 160, 161};
static const int16 kAnim101FrameTicks[] = {6, 6, 6};
static const BBRect kAnim101FrameRects[] = {{-6, -14, 15, 15}, {-5, -13, 12, 14}, {-6, -13, 14, 14}};
static const int kAnim102FrameIndices[] = {170, 171, 172, 173, 174, 175, 174, 175, 174, 175, 174, 175, 174, 176};
static const int16 kAnim102FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim102FrameRects[] = {{-7, -18, 15, 14}, {-6, -24, 11, 18}, {-6, -24, 9, 17}, {-5, -14, 16, 11}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}};
static const int kAnim103FrameIndices[] = {177, 178, 179, 180, 181, 182, 181, 182, 181, 182, 181, 182, 181, 183};
static const int16 kAnim103FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim103FrameRects[] = {{-9, -18, 16, 15}, {-6, -24, 12, 18}, {-6, -24, 13, 16}, {-12, -15, 17, 13}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -6, 21, 6}};
static const int kAnim104FrameIndices[] = {184, 185, 186};
static const int16 kAnim104FrameTicks[] = {10, 8, 8};
static const BBRect kAnim104FrameRects[] = {{-3, -17, 7, 20}, {-3, -16, 7, 19}, {-3, -16, 7, 19}};
static const int kAnim105FrameIndices[] = {187, 188, 189};
static const int16 kAnim105FrameTicks[] = {10, 8, 8};
static const BBRect kAnim105FrameRects[] = {{-6, -14, 13, 15}, {-7, -13, 14, 14}, {-6, -13, 13, 14}};
static const int kAnim106FrameIndices[] = {190, 191, 192};
static const int16 kAnim106FrameTicks[] = {10, 8, 8};
static const BBRect kAnim106FrameRects[] = {{-10, -10, 20, 9}, {-9, -9, 19, 8}, {-9, -9, 19, 8}};
static const int kAnim107FrameIndices[] = {193, 194, 195};
static const int16 kAnim107FrameTicks[] = {10, 8, 8};
static const BBRect kAnim107FrameRects[] = {{-7, -11, 16, 10}, {-7, -11, 16, 10}, {-7, -11, 16, 10}};
static const int kAnim108FrameIndices[] = {196, 197, 198};
static const int16 kAnim108FrameTicks[] = {10, 8, 8};
static const BBRect kAnim108FrameRects[] = {{-3, -13, 7, 16}, {-3, -13, 7, 16}, {-3, -12, 7, 15}};
static const int kAnim109FrameIndices[] = {199, 200, 201};
static const int16 kAnim109FrameTicks[] = {10, 8, 8};
static const BBRect kAnim109FrameRects[] = {{-8, -11, 18, 10}, {-7, -11, 16, 11}, {-7, -10, 17, 9}};
static const int kAnim110FrameIndices[] = {202, 203, 204};
static const int16 kAnim110FrameTicks[] = {10, 8, 8};
static const BBRect kAnim110FrameRects[] = {{-8, -9, 20, 7}, {-9, -9, 21, 8}, {-9, -9, 21, 8}};
static const int kAnim111FrameIndices[] = {205, 206, 207};
static const int16 kAnim111FrameTicks[] = {10, 8, 8};
static const BBRect kAnim111FrameRects[] = {{-6, -14, 15, 15}, {-5, -13, 12, 14}, {-6, -13, 14, 14}};
static const int kAnim112FrameIndices[] = {208};
static const int16 kAnim112FrameTicks[] = {6};
static const BBRect kAnim112FrameRects[] = {{-3, -15, 8, 18}};
static const int kAnim113FrameIndices[] = {209};
static const int16 kAnim113FrameTicks[] = {6};
static const BBRect kAnim113FrameRects[] = {{-7, -13, 14, 14}};
static const int kAnim114FrameIndices[] = {210};
static const int16 kAnim114FrameTicks[] = {6};
static const BBRect kAnim114FrameRects[] = {{-11, -9, 21, 8}};
static const int kAnim115FrameIndices[] = {211};
static const int16 kAnim115FrameTicks[] = {6};
static const BBRect kAnim115FrameRects[] = {{-9, -11, 18, 11}};
static const int kAnim116FrameIndices[] = {212};
static const int16 kAnim116FrameTicks[] = {6};
static const BBRect kAnim116FrameRects[] = {{-3, -12, 7, 15}};
static const int kAnim117FrameIndices[] = {213};
static const int16 kAnim117FrameTicks[] = {6};
static const BBRect kAnim117FrameRects[] = {{-8, -11, 17, 12}};
static const int kAnim118FrameIndices[] = {214};
static const int16 kAnim118FrameTicks[] = {6};
static const BBRect kAnim118FrameRects[] = {{-9, -10, 21, 9}};
static const int kAnim119FrameIndices[] = {215};
static const int16 kAnim119FrameTicks[] = {6};
static const BBRect kAnim119FrameRects[] = {{-6, -14, 14, 15}};
static const int kAnim120FrameIndices[] = {184, 185, 186};
static const int16 kAnim120FrameTicks[] = {6, 6, 6};
static const BBRect kAnim120FrameRects[] = {{-3, -17, 7, 20}, {-3, -16, 7, 19}, {-3, -16, 7, 19}};
static const int kAnim121FrameIndices[] = {187, 188, 189};
static const int16 kAnim121FrameTicks[] = {6, 6, 6};
static const BBRect kAnim121FrameRects[] = {{-6, -14, 13, 15}, {-7, -13, 14, 14}, {-6, -13, 13, 14}};
static const int kAnim122FrameIndices[] = {190, 191, 192};
static const int16 kAnim122FrameTicks[] = {6, 6, 6};
static const BBRect kAnim122FrameRects[] = {{-10, -10, 20, 9}, {-9, -9, 19, 8}, {-9, -9, 19, 8}};
static const int kAnim123FrameIndices[] = {193, 194, 195};
static const int16 kAnim123FrameTicks[] = {6, 6, 6};
static const BBRect kAnim123FrameRects[] = {{-7, -11, 16, 10}, {-7, -11, 16, 10}, {-7, -11, 16, 10}};
static const int kAnim124FrameIndices[] = {196, 197, 198};
static const int16 kAnim124FrameTicks[] = {6, 6, 6};
static const BBRect kAnim124FrameRects[] = {{-3, -13, 7, 16}, {-3, -13, 7, 16}, {-3, -12, 7, 15}};
static const int kAnim125FrameIndices[] = {199, 200, 201};
static const int16 kAnim125FrameTicks[] = {6, 6, 6};
static const BBRect kAnim125FrameRects[] = {{-8, -11, 18, 10}, {-7, -11, 16, 11}, {-7, -10, 17, 9}};
static const int kAnim126FrameIndices[] = {202, 203, 204};
static const int16 kAnim126FrameTicks[] = {6, 6, 6};
static const BBRect kAnim126FrameRects[] = {{-8, -9, 20, 7}, {-9, -9, 21, 8}, {-9, -9, 21, 8}};
static const int kAnim127FrameIndices[] = {205, 206, 207};
static const int16 kAnim127FrameTicks[] = {6, 6, 6};
static const BBRect kAnim127FrameRects[] = {{-6, -14, 15, 15}, {-5, -13, 12, 14}, {-6, -13, 14, 14}};
static const int kAnim128FrameIndices[] = {216, 217, 218, 219, 220, 221, 220, 221, 220, 221, 220, 221, 220, 222};
static const int16 kAnim128FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim128FrameRects[] = {{-7, -18, 15, 14}, {-6, -24, 11, 18}, {-6, -24, 9, 17}, {-5, -14, 16, 11}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}, {-7, -6, 18, 7}, {-8, -7, 19, 8}};
static const int kAnim129FrameIndices[] = {223, 224, 225, 226, 227, 228, 227, 228, 227, 228, 227, 228, 227, 229};
static const int16 kAnim129FrameTicks[] = {6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim129FrameRects[] = {{-9, -18, 16, 15}, {-6, -24, 12, 18}, {-6, -24, 13, 16}, {-12, -15, 17, 13}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -7, 21, 9}, {-10, -7, 19, 8}, {-11, -6, 21, 6}};
static const int kAnim130FrameIndices[] = {230};
static const int16 kAnim130FrameTicks[] = {6};
static const BBRect kAnim130FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim131FrameIndices[] = {231};
static const int16 kAnim131FrameTicks[] = {6};
static const BBRect kAnim131FrameRects[] = {{-8, -9, 16, 12}};
static const int kAnim132FrameIndices[] = {231, 232, 233};
static const int16 kAnim132FrameTicks[] = {6, 6, 6};
static const BBRect kAnim132FrameRects[] = {{-8, -9, 16, 12}, {-8, -11, 16, 12}, {-8, -13, 16, 12}};
static const int kAnim133FrameIndices[] = {233};
static const int16 kAnim133FrameTicks[] = {6};
static const BBRect kAnim133FrameRects[] = {{-8, -13, 16, 12}};
static const int kAnim134FrameIndices[] = {234};
static const int16 kAnim134FrameTicks[] = {6};
static const BBRect kAnim134FrameRects[] = {{-7, -6, 14, 10}};
static const int kAnim135FrameIndices[] = {234, 235, 236};
static const int16 kAnim135FrameTicks[] = {6, 6, 6};
static const BBRect kAnim135FrameRects[] = {{-7, -6, 14, 10}, {-7, -9, 14, 9}, {-7, -12, 14, 9}};
static const int kAnim136FrameIndices[] = {236};
static const int16 kAnim136FrameTicks[] = {6};
static const BBRect kAnim136FrameRects[] = {{-7, -12, 14, 9}};
static const int kAnim137FrameIndices[] = {237};
static const int16 kAnim137FrameTicks[] = {6};
static const BBRect kAnim137FrameRects[] = {{-7, -8, 16, 13}};
static const int kAnim138FrameIndices[] = {237, 238, 239};
static const int16 kAnim138FrameTicks[] = {6, 6, 6};
static const BBRect kAnim138FrameRects[] = {{-7, -8, 16, 13}, {-7, -11, 16, 12}, {-7, -14, 16, 13}};
static const int kAnim139FrameIndices[] = {239};
static const int16 kAnim139FrameTicks[] = {6};
static const BBRect kAnim139FrameRects[] = {{-7, -14, 16, 13}};
static const int kAnim140FrameIndices[] = {240};
static const int16 kAnim140FrameTicks[] = {6};
static const BBRect kAnim140FrameRects[] = {{-4, -4, 11, 7}};
static const int kAnim141FrameIndices[] = {240, 241, 242};
static const int16 kAnim141FrameTicks[] = {6, 6, 6};
static const BBRect kAnim141FrameRects[] = {{-4, -4, 11, 7}, {-5, -7, 12, 7}, {-5, -10, 12, 7}};
static const int kAnim142FrameIndices[] = {242};
static const int16 kAnim142FrameTicks[] = {6};
static const BBRect kAnim142FrameRects[] = {{-5, -10, 12, 7}};
static const int kAnim143FrameIndices[] = {243};
static const int16 kAnim143FrameTicks[] = {6};
static const BBRect kAnim143FrameRects[] = {{-5, -4, 12, 7}};
static const int kAnim144FrameIndices[] = {243, 244, 245};
static const int16 kAnim144FrameTicks[] = {6, 6, 6};
static const BBRect kAnim144FrameRects[] = {{-5, -4, 12, 7}, {-5, -7, 12, 7}, {-5, -10, 11, 7}};
static const int kAnim145FrameIndices[] = {245};
static const int16 kAnim145FrameTicks[] = {6};
static const BBRect kAnim145FrameRects[] = {{-5, -10, 11, 7}};
static const int kAnim146FrameIndices[] = {246};
static const int16 kAnim146FrameTicks[] = {6};
static const BBRect kAnim146FrameRects[] = {{-9, -11, 19, 15}};
static const int kAnim147FrameIndices[] = {246, 247, 248};
static const int16 kAnim147FrameTicks[] = {6, 6, 6};
static const BBRect kAnim147FrameRects[] = {{-9, -11, 19, 15}, {-9, -13, 19, 14}, {-9, -17, 19, 15}};
static const int kAnim148FrameIndices[] = {248};
static const int16 kAnim148FrameTicks[] = {6};
static const BBRect kAnim148FrameRects[] = {{-9, -17, 19, 15}};
static const int kAnim149FrameIndices[] = {249};
static const int16 kAnim149FrameTicks[] = {6};
static const BBRect kAnim149FrameRects[] = {{-9, -12, 22, 17}};
static const int kAnim150FrameIndices[] = {249, 250, 251};
static const int16 kAnim150FrameTicks[] = {6, 6, 6};
static const BBRect kAnim150FrameRects[] = {{-9, -12, 22, 17}, {-9, -15, 22, 17}, {-9, -18, 22, 17}};
static const int kAnim151FrameIndices[] = {251};
static const int16 kAnim151FrameTicks[] = {6};
static const BBRect kAnim151FrameRects[] = {{-9, -18, 22, 17}};
static const int kAnim152FrameIndices[] = {252};
static const int16 kAnim152FrameTicks[] = {6};
static const BBRect kAnim152FrameRects[] = {{-8, -5, 18, 9}};
static const int kAnim153FrameIndices[] = {252, 253, 254};
static const int16 kAnim153FrameTicks[] = {6, 6, 6};
static const BBRect kAnim153FrameRects[] = {{-8, -5, 18, 9}, {-7, -9, 17, 9}, {-8, -11, 19, 9}};
static const int kAnim154FrameIndices[] = {254};
static const int16 kAnim154FrameTicks[] = {6};
static const BBRect kAnim154FrameRects[] = {{-8, -11, 19, 9}};
static const int kAnim155FrameIndices[] = {255};
static const int16 kAnim155FrameTicks[] = {6};
static const BBRect kAnim155FrameRects[] = {{-8, -9, 18, 13}};
static const int kAnim156FrameIndices[] = {255, 256, 257};
static const int16 kAnim156FrameTicks[] = {6, 6, 6};
static const BBRect kAnim156FrameRects[] = {{-8, -9, 18, 13}, {-8, -12, 18, 13}, {-7, -15, 17, 13}};
static const int kAnim157FrameIndices[] = {257};
static const int16 kAnim157FrameTicks[] = {6};
static const BBRect kAnim157FrameRects[] = {{-7, -15, 17, 13}};
static const int kAnim158FrameIndices[] = {258, 259, 260, 261, 262, 263};
static const int16 kAnim158FrameTicks[] = {6, 8, 8, 8, 6, 6};
static const BBRect kAnim158FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim159FrameIndices[] = {264, 265, 266};
static const int16 kAnim159FrameTicks[] = {1, 1, 1};
static const BBRect kAnim159FrameRects[] = {{-9, -8, 18, 16}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim160FrameIndices[] = {267};
static const int16 kAnim160FrameTicks[] = {6};
static const BBRect kAnim160FrameRects[] = {{-25, -83, 43, 54}};
static const int kAnim161FrameIndices[] = {268};
static const int16 kAnim161FrameTicks[] = {6};
static const BBRect kAnim161FrameRects[] = {{-33, -93, 41, 60}};
static const int kAnim162FrameIndices[] = {269};
static const int16 kAnim162FrameTicks[] = {1};
static const BBRect kAnim162FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim163FrameIndices[] = {270};
static const int16 kAnim163FrameTicks[] = {5};
static const BBRect kAnim163FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim164FrameIndices[] = {271};
static const int16 kAnim164FrameTicks[] = {1};
static const BBRect kAnim164FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim165FrameIndices[] = {272};
static const int16 kAnim165FrameTicks[] = {1};
static const BBRect kAnim165FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim166FrameIndices[] = {273};
static const int16 kAnim166FrameTicks[] = {2};
static const BBRect kAnim166FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim167FrameIndices[] = {274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286};
static const int16 kAnim167FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim167FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim168FrameIndices[] = {287};
static const int16 kAnim168FrameTicks[] = {1};
static const BBRect kAnim168FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim169FrameIndices[] = {288};
static const int16 kAnim169FrameTicks[] = {6};
static const BBRect kAnim169FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim170FrameIndices[] = {289, 290, 291, 292, 293, 294};
static const int16 kAnim170FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim170FrameRects[] = {{-22, -91, 45, 93}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}};
static const int kAnim171FrameIndices[] = {295, 296, 297, 298, 299, 300};
static const int16 kAnim171FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim171FrameRects[] = {{-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}};
static const int kAnim172FrameIndices[] = {301, 302};
static const int16 kAnim172FrameTicks[] = {6, 6};
static const BBRect kAnim172FrameRects[] = {{-9, -9, 17, 15}, {-11, -10, 19, 16}};
static const ObjAnimation kAnimations[] = {
{3, kAnim0FrameIndices, kAnim0FrameTicks, kAnim0FrameRects},
{3, kAnim1FrameIndices, kAnim1FrameTicks, kAnim1FrameRects},
{3, kAnim2FrameIndices, kAnim2FrameTicks, kAnim2FrameRects},
{3, kAnim3FrameIndices, kAnim3FrameTicks, kAnim3FrameRects},
{3, kAnim4FrameIndices, kAnim4FrameTicks, kAnim4FrameRects},
{3, kAnim5FrameIndices, kAnim5FrameTicks, kAnim5FrameRects},
{3, kAnim6FrameIndices, kAnim6FrameTicks, kAnim6FrameRects},
{3, kAnim7FrameIndices, kAnim7FrameTicks, kAnim7FrameRects},
{1, kAnim8FrameIndices, kAnim8FrameTicks, kAnim8FrameRects},
{1, kAnim9FrameIndices, kAnim9FrameTicks, kAnim9FrameRects},
{1, kAnim10FrameIndices, kAnim10FrameTicks, kAnim10FrameRects},
{1, kAnim11FrameIndices, kAnim11FrameTicks, kAnim11FrameRects},
{1, kAnim12FrameIndices, kAnim12FrameTicks, kAnim12FrameRects},
{1, kAnim13FrameIndices, kAnim13FrameTicks, kAnim13FrameRects},
{1, kAnim14FrameIndices, kAnim14FrameTicks, kAnim14FrameRects},
{1, kAnim15FrameIndices, kAnim15FrameTicks, kAnim15FrameRects},
{3, kAnim16FrameIndices, kAnim16FrameTicks, kAnim16FrameRects},
{3, kAnim17FrameIndices, kAnim17FrameTicks, kAnim17FrameRects},
{3, kAnim18FrameIndices, kAnim18FrameTicks, kAnim18FrameRects},
{3, kAnim19FrameIndices, kAnim19FrameTicks, kAnim19FrameRects},
{3, kAnim20FrameIndices, kAnim20FrameTicks, kAnim20FrameRects},
{3, kAnim21FrameIndices, kAnim21FrameTicks, kAnim21FrameRects},
{3, kAnim22FrameIndices, kAnim22FrameTicks, kAnim22FrameRects},
{3, kAnim23FrameIndices, kAnim23FrameTicks, kAnim23FrameRects},
{14, kAnim24FrameIndices, kAnim24FrameTicks, kAnim24FrameRects},
{14, kAnim25FrameIndices, kAnim25FrameTicks, kAnim25FrameRects},
{3, kAnim26FrameIndices, kAnim26FrameTicks, kAnim26FrameRects},
{3, kAnim27FrameIndices, kAnim27FrameTicks, kAnim27FrameRects},
{3, kAnim28FrameIndices, kAnim28FrameTicks, kAnim28FrameRects},
{3, kAnim29FrameIndices, kAnim29FrameTicks, kAnim29FrameRects},
{3, kAnim30FrameIndices, kAnim30FrameTicks, kAnim30FrameRects},
{3, kAnim31FrameIndices, kAnim31FrameTicks, kAnim31FrameRects},
{3, kAnim32FrameIndices, kAnim32FrameTicks, kAnim32FrameRects},
{3, kAnim33FrameIndices, kAnim33FrameTicks, kAnim33FrameRects},
{1, kAnim34FrameIndices, kAnim34FrameTicks, kAnim34FrameRects},
{1, kAnim35FrameIndices, kAnim35FrameTicks, kAnim35FrameRects},
{1, kAnim36FrameIndices, kAnim36FrameTicks, kAnim36FrameRects},
{1, kAnim37FrameIndices, kAnim37FrameTicks, kAnim37FrameRects},
{1, kAnim38FrameIndices, kAnim38FrameTicks, kAnim38FrameRects},
{1, kAnim39FrameIndices, kAnim39FrameTicks, kAnim39FrameRects},
{1, kAnim40FrameIndices, kAnim40FrameTicks, kAnim40FrameRects},
{1, kAnim41FrameIndices, kAnim41FrameTicks, kAnim41FrameRects},
{3, kAnim42FrameIndices, kAnim42FrameTicks, kAnim42FrameRects},
{3, kAnim43FrameIndices, kAnim43FrameTicks, kAnim43FrameRects},
{3, kAnim44FrameIndices, kAnim44FrameTicks, kAnim44FrameRects},
{3, kAnim45FrameIndices, kAnim45FrameTicks, kAnim45FrameRects},
{3, kAnim46FrameIndices, kAnim46FrameTicks, kAnim46FrameRects},
{3, kAnim47FrameIndices, kAnim47FrameTicks, kAnim47FrameRects},
{3, kAnim48FrameIndices, kAnim48FrameTicks, kAnim48FrameRects},
{3, kAnim49FrameIndices, kAnim49FrameTicks, kAnim49FrameRects},
{14, kAnim50FrameIndices, kAnim50FrameTicks, kAnim50FrameRects},
{14, kAnim51FrameIndices, kAnim51FrameTicks, kAnim51FrameRects},
{3, kAnim52FrameIndices, kAnim52FrameTicks, kAnim52FrameRects},
{3, kAnim53FrameIndices, kAnim53FrameTicks, kAnim53FrameRects},
{3, kAnim54FrameIndices, kAnim54FrameTicks, kAnim54FrameRects},
{3, kAnim55FrameIndices, kAnim55FrameTicks, kAnim55FrameRects},
{3, kAnim56FrameIndices, kAnim56FrameTicks, kAnim56FrameRects},
{3, kAnim57FrameIndices, kAnim57FrameTicks, kAnim57FrameRects},
{3, kAnim58FrameIndices, kAnim58FrameTicks, kAnim58FrameRects},
{3, kAnim59FrameIndices, kAnim59FrameTicks, kAnim59FrameRects},
{1, kAnim60FrameIndices, kAnim60FrameTicks, kAnim60FrameRects},
{1, kAnim61FrameIndices, kAnim61FrameTicks, kAnim61FrameRects},
{1, kAnim62FrameIndices, kAnim62FrameTicks, kAnim62FrameRects},
{1, kAnim63FrameIndices, kAnim63FrameTicks, kAnim63FrameRects},
{1, kAnim64FrameIndices, kAnim64FrameTicks, kAnim64FrameRects},
{1, kAnim65FrameIndices, kAnim65FrameTicks, kAnim65FrameRects},
{1, kAnim66FrameIndices, kAnim66FrameTicks, kAnim66FrameRects},
{1, kAnim67FrameIndices, kAnim67FrameTicks, kAnim67FrameRects},
{3, kAnim68FrameIndices, kAnim68FrameTicks, kAnim68FrameRects},
{3, kAnim69FrameIndices, kAnim69FrameTicks, kAnim69FrameRects},
{3, kAnim70FrameIndices, kAnim70FrameTicks, kAnim70FrameRects},
{3, kAnim71FrameIndices, kAnim71FrameTicks, kAnim71FrameRects},
{3, kAnim72FrameIndices, kAnim72FrameTicks, kAnim72FrameRects},
{3, kAnim73FrameIndices, kAnim73FrameTicks, kAnim73FrameRects},
{3, kAnim74FrameIndices, kAnim74FrameTicks, kAnim74FrameRects},
{3, kAnim75FrameIndices, kAnim75FrameTicks, kAnim75FrameRects},
{14, kAnim76FrameIndices, kAnim76FrameTicks, kAnim76FrameRects},
{14, kAnim77FrameIndices, kAnim77FrameTicks, kAnim77FrameRects},
{3, kAnim78FrameIndices, kAnim78FrameTicks, kAnim78FrameRects},
{3, kAnim79FrameIndices, kAnim79FrameTicks, kAnim79FrameRects},
{3, kAnim80FrameIndices, kAnim80FrameTicks, kAnim80FrameRects},
{3, kAnim81FrameIndices, kAnim81FrameTicks, kAnim81FrameRects},
{3, kAnim82FrameIndices, kAnim82FrameTicks, kAnim82FrameRects},
{3, kAnim83FrameIndices, kAnim83FrameTicks, kAnim83FrameRects},
{3, kAnim84FrameIndices, kAnim84FrameTicks, kAnim84FrameRects},
{3, kAnim85FrameIndices, kAnim85FrameTicks, kAnim85FrameRects},
{1, kAnim86FrameIndices, kAnim86FrameTicks, kAnim86FrameRects},
{1, kAnim87FrameIndices, kAnim87FrameTicks, kAnim87FrameRects},
{1, kAnim88FrameIndices, kAnim88FrameTicks, kAnim88FrameRects},
{1, kAnim89FrameIndices, kAnim89FrameTicks, kAnim89FrameRects},
{1, kAnim90FrameIndices, kAnim90FrameTicks, kAnim90FrameRects},
{1, kAnim91FrameIndices, kAnim91FrameTicks, kAnim91FrameRects},
{1, kAnim92FrameIndices, kAnim92FrameTicks, kAnim92FrameRects},
{1, kAnim93FrameIndices, kAnim93FrameTicks, kAnim93FrameRects},
{3, kAnim94FrameIndices, kAnim94FrameTicks, kAnim94FrameRects},
{3, kAnim95FrameIndices, kAnim95FrameTicks, kAnim95FrameRects},
{3, kAnim96FrameIndices, kAnim96FrameTicks, kAnim96FrameRects},
{3, kAnim97FrameIndices, kAnim97FrameTicks, kAnim97FrameRects},
{3, kAnim98FrameIndices, kAnim98FrameTicks, kAnim98FrameRects},
{3, kAnim99FrameIndices, kAnim99FrameTicks, kAnim99FrameRects},
{3, kAnim100FrameIndices, kAnim100FrameTicks, kAnim100FrameRects},
{3, kAnim101FrameIndices, kAnim101FrameTicks, kAnim101FrameRects},
{14, kAnim102FrameIndices, kAnim102FrameTicks, kAnim102FrameRects},
{14, kAnim103FrameIndices, kAnim103FrameTicks, kAnim103FrameRects},
{3, kAnim104FrameIndices, kAnim104FrameTicks, kAnim104FrameRects},
{3, kAnim105FrameIndices, kAnim105FrameTicks, kAnim105FrameRects},
{3, kAnim106FrameIndices, kAnim106FrameTicks, kAnim106FrameRects},
{3, kAnim107FrameIndices, kAnim107FrameTicks, kAnim107FrameRects},
{3, kAnim108FrameIndices, kAnim108FrameTicks, kAnim108FrameRects},
{3, kAnim109FrameIndices, kAnim109FrameTicks, kAnim109FrameRects},
{3, kAnim110FrameIndices, kAnim110FrameTicks, kAnim110FrameRects},
{3, kAnim111FrameIndices, kAnim111FrameTicks, kAnim111FrameRects},
{1, kAnim112FrameIndices, kAnim112FrameTicks, kAnim112FrameRects},
{1, kAnim113FrameIndices, kAnim113FrameTicks, kAnim113FrameRects},
{1, kAnim114FrameIndices, kAnim114FrameTicks, kAnim114FrameRects},
{1, kAnim115FrameIndices, kAnim115FrameTicks, kAnim115FrameRects},
{1, kAnim116FrameIndices, kAnim116FrameTicks, kAnim116FrameRects},
{1, kAnim117FrameIndices, kAnim117FrameTicks, kAnim117FrameRects},
{1, kAnim118FrameIndices, kAnim118FrameTicks, kAnim118FrameRects},
{1, kAnim119FrameIndices, kAnim119FrameTicks, kAnim119FrameRects},
{3, kAnim120FrameIndices, kAnim120FrameTicks, kAnim120FrameRects},
{3, kAnim121FrameIndices, kAnim121FrameTicks, kAnim121FrameRects},
{3, kAnim122FrameIndices, kAnim122FrameTicks, kAnim122FrameRects},
{3, kAnim123FrameIndices, kAnim123FrameTicks, kAnim123FrameRects},
{3, kAnim124FrameIndices, kAnim124FrameTicks, kAnim124FrameRects},
{3, kAnim125FrameIndices, kAnim125FrameTicks, kAnim125FrameRects},
{3, kAnim126FrameIndices, kAnim126FrameTicks, kAnim126FrameRects},
{3, kAnim127FrameIndices, kAnim127FrameTicks, kAnim127FrameRects},
{14, kAnim128FrameIndices, kAnim128FrameTicks, kAnim128FrameRects},
{14, kAnim129FrameIndices, kAnim129FrameTicks, kAnim129FrameRects},
{1, kAnim130FrameIndices, kAnim130FrameTicks, kAnim130FrameRects},
{1, kAnim131FrameIndices, kAnim131FrameTicks, kAnim131FrameRects},
{3, kAnim132FrameIndices, kAnim132FrameTicks, kAnim132FrameRects},
{1, kAnim133FrameIndices, kAnim133FrameTicks, kAnim133FrameRects},
{1, kAnim134FrameIndices, kAnim134FrameTicks, kAnim134FrameRects},
{3, kAnim135FrameIndices, kAnim135FrameTicks, kAnim135FrameRects},
{1, kAnim136FrameIndices, kAnim136FrameTicks, kAnim136FrameRects},
{1, kAnim137FrameIndices, kAnim137FrameTicks, kAnim137FrameRects},
{3, kAnim138FrameIndices, kAnim138FrameTicks, kAnim138FrameRects},
{1, kAnim139FrameIndices, kAnim139FrameTicks, kAnim139FrameRects},
{1, kAnim140FrameIndices, kAnim140FrameTicks, kAnim140FrameRects},
{3, kAnim141FrameIndices, kAnim141FrameTicks, kAnim141FrameRects},
{1, kAnim142FrameIndices, kAnim142FrameTicks, kAnim142FrameRects},
{1, kAnim143FrameIndices, kAnim143FrameTicks, kAnim143FrameRects},
{3, kAnim144FrameIndices, kAnim144FrameTicks, kAnim144FrameRects},
{1, kAnim145FrameIndices, kAnim145FrameTicks, kAnim145FrameRects},
{1, kAnim146FrameIndices, kAnim146FrameTicks, kAnim146FrameRects},
{3, kAnim147FrameIndices, kAnim147FrameTicks, kAnim147FrameRects},
{1, kAnim148FrameIndices, kAnim148FrameTicks, kAnim148FrameRects},
{1, kAnim149FrameIndices, kAnim149FrameTicks, kAnim149FrameRects},
{3, kAnim150FrameIndices, kAnim150FrameTicks, kAnim150FrameRects},
{1, kAnim151FrameIndices, kAnim151FrameTicks, kAnim151FrameRects},
{1, kAnim152FrameIndices, kAnim152FrameTicks, kAnim152FrameRects},
{3, kAnim153FrameIndices, kAnim153FrameTicks, kAnim153FrameRects},
{1, kAnim154FrameIndices, kAnim154FrameTicks, kAnim154FrameRects},
{1, kAnim155FrameIndices, kAnim155FrameTicks, kAnim155FrameRects},
{3, kAnim156FrameIndices, kAnim156FrameTicks, kAnim156FrameRects},
{1, kAnim157FrameIndices, kAnim157FrameTicks, kAnim157FrameRects},
{6, kAnim158FrameIndices, kAnim158FrameTicks, kAnim158FrameRects},
{3, kAnim159FrameIndices, kAnim159FrameTicks, kAnim159FrameRects},
{1, kAnim160FrameIndices, kAnim160FrameTicks, kAnim160FrameRects},
{1, kAnim161FrameIndices, kAnim161FrameTicks, kAnim161FrameRects},
{1, kAnim162FrameIndices, kAnim162FrameTicks, kAnim162FrameRects},
{1, kAnim163FrameIndices, kAnim163FrameTicks, kAnim163FrameRects},
{1, kAnim164FrameIndices, kAnim164FrameTicks, kAnim164FrameRects},
{1, kAnim165FrameIndices, kAnim165FrameTicks, kAnim165FrameRects},
{1, kAnim166FrameIndices, kAnim166FrameTicks, kAnim166FrameRects},
{13, kAnim167FrameIndices, kAnim167FrameTicks, kAnim167FrameRects},
{1, kAnim168FrameIndices, kAnim168FrameTicks, kAnim168FrameRects},
{1, kAnim169FrameIndices, kAnim169FrameTicks, kAnim169FrameRects},
{6, kAnim170FrameIndices, kAnim170FrameTicks, kAnim170FrameRects},
{6, kAnim171FrameIndices, kAnim171FrameTicks, kAnim171FrameRects},
{2, kAnim172FrameIndices, kAnim172FrameTicks, kAnim172FrameRects}
};
static const MinigameBbAnt::ObjInit kObjInits[] = {
{&kAnimations[131], &kAnimations[132], &kAnimations[133], 160, 120},
{&kAnimations[134], &kAnimations[135], &kAnimations[136], 155, 130},
{&kAnimations[137], &kAnimations[138], &kAnimations[139], 150, 100},
{&kAnimations[140], &kAnimations[141], &kAnimations[142], 195, 150},
{&kAnimations[143], &kAnimations[144], &kAnimations[145], 120, 110},
{&kAnimations[146], &kAnimations[147], &kAnimations[148], 170, 170},
{&kAnimations[149], &kAnimations[150], &kAnimations[151], 175, 95},
{&kAnimations[152], &kAnimations[153], &kAnimations[154], 145, 165},
{&kAnimations[155], &kAnimations[156], &kAnimations[157], 110, 175}
};
static const ObjAnimation * const kAnimationsTbl[] = {&kAnimations[0], &kAnimations[1], &kAnimations[2], &kAnimations[3], &kAnimations[4], &kAnimations[5], &kAnimations[6], &kAnimations[7], &kAnimations[16], &kAnimations[17], &kAnimations[18], &kAnimations[19], &kAnimations[20], &kAnimations[21], &kAnimations[22], &kAnimations[23], &kAnimations[24], &kAnimations[25], &kAnimations[26], &kAnimations[27], &kAnimations[28], &kAnimations[29], &kAnimations[30], &kAnimations[31], &kAnimations[32], &kAnimations[33], &kAnimations[42], &kAnimations[43], &kAnimations[44], &kAnimations[45], &kAnimations[46], &kAnimations[47], &kAnimations[48], &kAnimations[49], &kAnimations[50], &kAnimations[51], &kAnimations[52], &kAnimations[53], &kAnimations[54], &kAnimations[55], &kAnimations[56], &kAnimations[57], &kAnimations[58], &kAnimations[59], &kAnimations[68], &kAnimations[69], &kAnimations[70], &kAnimations[71], &kAnimations[72], &kAnimations[73], &kAnimations[74], &kAnimations[75], &kAnimations[76], &kAnimations[77], &kAnimations[78], &kAnimations[79], &kAnimations[80], &kAnimations[81], &kAnimations[82], &kAnimations[83], &kAnimations[84], &kAnimations[85], &kAnimations[94], &kAnimations[95], &kAnimations[96], &kAnimations[97], &kAnimations[98], &kAnimations[99], &kAnimations[100], &kAnimations[101], &kAnimations[102], &kAnimations[103], &kAnimations[104], &kAnimations[105], &kAnimations[106], &kAnimations[107], &kAnimations[108], &kAnimations[109], &kAnimations[110], &kAnimations[111], &kAnimations[120], &kAnimations[121], &kAnimations[122], &kAnimations[123], &kAnimations[124], &kAnimations[125], &kAnimations[126], &kAnimations[127], &kAnimations[128], &kAnimations[129]};
static const ObjAnimation * const * const kObjKindAnimTables[] = {
nullptr, &kAnimationsTbl[0],
&kAnimationsTbl[18], &kAnimationsTbl[36],
&kAnimationsTbl[54], &kAnimationsTbl[72]
};
const ObjAnimation *MinigameBbAnt::getAnimation(int animIndex) {
return &kAnimations[animIndex];
}
const MinigameBbAnt::ObjInit *MinigameBbAnt::getObjInit(int index) {
return &kObjInits[index];
}
const ObjAnimation * const *MinigameBbAnt::getObjKindAnimTable(int kind) {
return kObjKindAnimTables[kind];
}
const ObjAnimation *MinigameBbAnt::getObjAnim(int index) {
return kAnimationsTbl[index];
}
} // End of namespace Bbvs

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,142 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_MINIGAMES_BBLOOGIE_H
#define BBVS_MINIGAMES_BBLOOGIE_H
#include "bbvs/minigames/minigame.h"
namespace Bbvs {
class MinigameBbLoogie : public Minigame {
public:
MinigameBbLoogie(BbvsEngine *vm) : Minigame(vm) {};
bool run(bool fromMainGame) override;
public:
struct Obj {
int kind;
int x, y;
int xIncr, yIncr;
const ObjAnimation *anim;
int frameIndex;
int ticks;
int status;
int16 frameIndexAdd;
int16 unk2;
};
enum {
kMaxObjectsCount = 256
};
enum {
kGSTitleScreen = 0, // Title screen
kGSMainGame = 1, // Game when called as part of the main game
kGSStandaloneGame = 2, // Game when called as standalone game
kGSScoreCountUp = 3 // Score countup and next level text
};
Obj _objects[kMaxObjectsCount];
int _playerKind;
const ObjAnimation *_playerAnim;
const uint *_playerSounds1, *_playerSounds2;
uint _playerSounds1Count, _playerSounds2Count;
int _level, _levelTimeLeft, _levelTimeDelay;
int _numberOfHits, _currScore, _hiScore;
int _doubleScore, _megaLoogieCount;
int _dispLevelScore, _nextLevelScore;
int _timeBonusCtr, _bonusDisplayDelay1, _bonusDisplayDelay2, _bonusDisplayDelay3;
int _carDelay;
int _bikeDelay;
int _squirrelDelay;
bool _squirrelDirection;
int _paperPlaneDelay;
int _principalDelay;
int _prevPrincipalStatus;
int _principalCtr, _principalFirstFrameIndex, _principalLastFrameIndex;
bool _principalAngry;
char _prefix[20];
const ObjAnimation *getAnimation(int animIndex);
void buildDrawList(DrawList &drawList);
void buildDrawList0(DrawList &drawList);
void buildDrawList1(DrawList &drawList);
void buildDrawList2(DrawList &drawList);
void buildDrawList3(DrawList &drawList);
void drawSprites();
void initObjs();
Obj *getFreeObject();
Obj *findLoogieObj(int startObjIndex);
bool isHit(Obj *obj1, Obj *obj2);
bool isCursorAtObj(int objIndex);
void initObjects();
void initObjects0();
void initObjects1();
void initObjects3();
void initVars();
void initVars0();
void initVars1();
void initVars2();
void initVars3();
bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus2(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus3(int mouseX, int mouseY, uint mouseButtons);
void updateObjs(uint mouseButtons);
void updatePlayer(int objIndex, uint mouseButtons);
void updateObjKind2(int objIndex);
void updateLoogie(int objIndex);
void updateCar(int objIndex);
void updateBike(int objIndex);
void updateSquirrel(int objIndex);
void updatePaperPlane(int objIndex);
void updateIndicator(int objIndex);
void updatePrincipal(int objIndex);
void incNumberOfHits();
void incScore(int incrAmount);
void playRndSound();
void update();
void loadSounds();
};
} // End of namespace Bbvs
#endif // BBVS_MINIGAMES_BBLOOGIE_H

View File

@@ -0,0 +1,137 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/minigames/bbloogie.h"
namespace Bbvs {
static const int kAnim0FrameIndices[] = {0, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 0, 5, 6, 7, 0, 0, 5, 6, 7, 8, 0, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 0};
static const int16 kAnim0FrameTicks[] = {22, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 8, 8, 10, 10, 10, 8, 22, 6, 12, 20, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 22};
static const BBRect kAnim0FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim1FrameIndices[] = {9, 10, 11, 12, 13, 10, 11, 12, 13, 10, 11, 12, 13, 9, 14, 15, 16, 9, 9, 14, 15, 16, 17, 9, 13, 12, 11, 10, 13, 12, 11, 10, 13, 12, 11, 10, 9};
static const int16 kAnim1FrameTicks[] = {22, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 20, 8, 8, 10, 10, 10, 8, 22, 6, 12, 20, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 22};
static const BBRect kAnim1FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim2FrameIndices[] = {18, 19, 20, 18, 21, 22};
static const int16 kAnim2FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim2FrameRects[] = {{-45, -43, 86, 38}, {-45, -43, 86, 38}, {-45, -43, 86, 38}, {-45, -43, 86, 38}, {-45, -43, 86, 38}, {-45, -43, 86, 38}};
static const int kAnim3FrameIndices[] = {23, 24, 25, 26, 27, 28, 27};
static const int16 kAnim3FrameTicks[] = {6, 6, 6, 6, 6, 7, 6};
static const BBRect kAnim3FrameRects[] = {{-24, -17, 48, 14}, {-24, -17, 48, 14}, {-24, -17, 48, 14}, {-24, -17, 48, 14}, {-24, -17, 48, 14}, {-24, -17, 48, 14}, {-24, -17, 48, 14}};
static const int kAnim4FrameIndices[] = {29, 30, 31, 32, 33, 34, 35, 36};
static const int16 kAnim4FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim4FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim5FrameIndices[] = {37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70};
static const int16 kAnim5FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim5FrameRects[] = {{-1, -11, 4, 11}, {-2, -15, 6, 8}, {-3, -24, 8, 8}, {-3, -31, 7, 9}, {-3, -33, 8, 8}, {-3, -34, 8, 10}, {-2, -34, 7, 8}, {-1, -34, 6, 7}, {-1, -34, 5, 6}, {-1, -34, 4, 4}, {0, -34, 3, 4}, {-1, -34, 4, 3}, {0, -34, 3, 4}, {0, -33, 3, 3}, {-1, -35, 5, 5}, {-3, -37, 9, 9}, {-4, -39, 12, 13}, {-3, -11, 7, 8}, {-3, -15, 8, 9}, {-5, -24, 11, 13}, {-4, -31, 10, 13}, {-5, -34, 11, 13}, {-5, -34, 11, 11}, {-4, -34, 9, 10}, {-4, -34, 9, 9}, {-3, -34, 7, 8}, {-2, -34, 6, 7}, {-2, -34, 5, 6}, {-2, -34, 4, 5}, {-7, -38, 13, 13}, {-10, -44, 22, 22}, {-13, -47, 27, 27}, {-17, -49, 32, 30}, {-17, -50, 34, 33}};
static const int kAnim6FrameIndices[] = {71};
static const int16 kAnim6FrameTicks[] = {1};
static const BBRect kAnim6FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim7FrameIndices[] = {72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 80, 79, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 110, 109, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129};
static const int16 kAnim7FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 30, 6, 20, 6, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 30, 6, 20, 6, 30, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim7FrameRects[] = {{-46, -6, 7, 6}, {-46, -12, 11, 12}, {-47, -15, 17, 15}, {-46, -14, 20, 12}, {-47, -10, 24, 10}, {-41, -11, 22, 11}, {-33, -10, 15, 10}, {-32, -10, 14, 10}, {-32, -9, 13, 9}, {-32, -9, 13, 9}, {-32, -9, 13, 9}, {-32, -10, 13, 10}, {-34, -11, 24, 11}, {-30, -12, 25, 9}, {-24, -10, 24, 10}, {-18, -11, 22, 11}, {-14, -11, 24, 10}, {-9, -12, 25, 9}, {-3, -10, 24, 10}, {4, -11, 22, 11}, {11, -10, 15, 10}, {12, -10, 13, 10}, {10, -11, 24, 11}, {15, -12, 25, 9}, {22, -16, 22, 16}, {34, -16, 9, 16}, {35, -12, 9, 12}, {38, -6, 6, 6}, {38, -6, 4, 4}, {36, -6, 7, 6}, {31, -12, 12, 12}, {27, -15, 17, 15}, {24, -12, 20, 12}, {19, -11, 22, 11}, {13, -11, 24, 11}, {7, -11, 25, 9}, {4, -10, 24, 10}, {1, -11, 22, 11}, {1, -10, 15, 10}, {2, -10, 13, 10}, {2, -10, 13, 10}, {2, -9, 13, 9}, {2, -10, 13, 10}, {2, -10, 13, 10}, {-7, -11, 24, 11}, {-14, -11, 25, 9}, {-21, -10, 24, 11}, {-27, -11, 23, 11}, {-34, -12, 24, 11}, {-44, -18, 22, 16}, {-44, -16, 9, 16}, {-46, -12, 9, 12}, {-45, -6, 7, 6}, {-45, -4, 6, 5}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim8FrameIndices[] = {130};
static const int16 kAnim8FrameTicks[] = {6};
static const BBRect kAnim8FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim9FrameIndices[] = {131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141};
static const int16 kAnim9FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim9FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim10FrameIndices[] = {142};
static const int16 kAnim10FrameTicks[] = {2};
static const BBRect kAnim10FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim11FrameIndices[] = {143};
static const int16 kAnim11FrameTicks[] = {1};
static const BBRect kAnim11FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim12FrameIndices[] = {144};
static const int16 kAnim12FrameTicks[] = {1};
static const BBRect kAnim12FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim13FrameIndices[] = {145};
static const int16 kAnim13FrameTicks[] = {1};
static const BBRect kAnim13FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim14FrameIndices[] = {146};
static const int16 kAnim14FrameTicks[] = {1};
static const BBRect kAnim14FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim15FrameIndices[] = {147};
static const int16 kAnim15FrameTicks[] = {1};
static const BBRect kAnim15FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim16FrameIndices[] = {148, 149, 150, 151, 152, 153, 154, 155};
static const int16 kAnim16FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim16FrameRects[] = {{-5, -5, 9, 9}, {-6, -5, 11, 11}, {-6, -4, 9, 9}, {-5, -5, 10, 10}, {-5, -3, 9, 9}, {-6, -5, 10, 10}, {-4, -4, 9, 9}, {-6, -4, 10, 10}};
static const int kAnim17FrameIndices[] = {156, 157};
static const int16 kAnim17FrameTicks[] = {6, 6};
static const BBRect kAnim17FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim18FrameIndices[] = {158, 159, 160, 161, 160, 162, 163, 162, 164, 165, 166, 167, 168, 167, 169, 170, 169, 171, 172, 173, 174, 175, 174, 176, 177, 176, 178, 179, 180, 181, 182, 181, 183, 184, 183, 185, 186, 187, 188, 189, 190, 188, 189, 191, 188, 190, 189, 187, 186};
static const int16 kAnim18FrameTicks[] = {10, 20, 8, 8, 8, 8, 8, 8, 6, 10, 20, 8, 8, 8, 8, 8, 8, 6, 10, 20, 8, 8, 8, 8, 8, 8, 6, 10, 20, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim18FrameRects[] = {{-13, -16, 26, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-10, -19, 18, 20}, {-8, -20, 15, 23}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-10, -18, 19, 20}, {-12, -17, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-12, -16, 24, 16}, {-10, -18, 20, 19}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-8, -20, 16, 22}, {-9, -19, 18, 20}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}, {-12, -17, 24, 17}};
static const int kAnim19FrameIndices[] = {192};
static const int16 kAnim19FrameTicks[] = {8};
static const BBRect kAnim19FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim20FrameIndices[] = {193};
static const int16 kAnim20FrameTicks[] = {5};
static const BBRect kAnim20FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim21FrameIndices[] = {194};
static const int16 kAnim21FrameTicks[] = {6};
static const BBRect kAnim21FrameRects[] = {{-7, -80, 17, 81}};
static const int kAnim22FrameIndices[] = {195, 196, 197, 198, 199, 200};
static const int16 kAnim22FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim22FrameRects[] = {{-22, -91, 45, 93}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}};
static const int kAnim23FrameIndices[] = {201};
static const int16 kAnim23FrameTicks[] = {6};
static const BBRect kAnim23FrameRects[] = {{-12, -75, 21, 75}};
static const int kAnim24FrameIndices[] = {202, 203, 204, 205, 206, 207};
static const int16 kAnim24FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim24FrameRects[] = {{-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}};
static const int kAnim25FrameIndices[] = {208, 209};
static const int16 kAnim25FrameTicks[] = {6, 6};
static const BBRect kAnim25FrameRects[] = {{-9, -9, 17, 15}, {-11, -10, 19, 16}};
static const ObjAnimation kAnimations[] = {
{37, kAnim0FrameIndices, kAnim0FrameTicks, kAnim0FrameRects},
{37, kAnim1FrameIndices, kAnim1FrameTicks, kAnim1FrameRects},
{6, kAnim2FrameIndices, kAnim2FrameTicks, kAnim2FrameRects},
{7, kAnim3FrameIndices, kAnim3FrameTicks, kAnim3FrameRects},
{8, kAnim4FrameIndices, kAnim4FrameTicks, kAnim4FrameRects},
{34, kAnim5FrameIndices, kAnim5FrameTicks, kAnim5FrameRects},
{1, kAnim6FrameIndices, kAnim6FrameTicks, kAnim6FrameRects},
{62, kAnim7FrameIndices, kAnim7FrameTicks, kAnim7FrameRects},
{1, kAnim8FrameIndices, kAnim8FrameTicks, kAnim8FrameRects},
{11, kAnim9FrameIndices, kAnim9FrameTicks, kAnim9FrameRects},
{1, kAnim10FrameIndices, kAnim10FrameTicks, kAnim10FrameRects},
{1, kAnim11FrameIndices, kAnim11FrameTicks, kAnim11FrameRects},
{1, kAnim12FrameIndices, kAnim12FrameTicks, kAnim12FrameRects},
{1, kAnim13FrameIndices, kAnim13FrameTicks, kAnim13FrameRects},
{1, kAnim14FrameIndices, kAnim14FrameTicks, kAnim14FrameRects},
{1, kAnim15FrameIndices, kAnim15FrameTicks, kAnim15FrameRects},
{8, kAnim16FrameIndices, kAnim16FrameTicks, kAnim16FrameRects},
{2, kAnim17FrameIndices, kAnim17FrameTicks, kAnim17FrameRects},
{49, kAnim18FrameIndices, kAnim18FrameTicks, kAnim18FrameRects},
{1, kAnim19FrameIndices, kAnim19FrameTicks, kAnim19FrameRects},
{1, kAnim20FrameIndices, kAnim20FrameTicks, kAnim20FrameRects},
{1, kAnim21FrameIndices, kAnim21FrameTicks, kAnim21FrameRects},
{6, kAnim22FrameIndices, kAnim22FrameTicks, kAnim22FrameRects},
{1, kAnim23FrameIndices, kAnim23FrameTicks, kAnim23FrameRects},
{6, kAnim24FrameIndices, kAnim24FrameTicks, kAnim24FrameRects},
{2, kAnim25FrameIndices, kAnim25FrameTicks, kAnim25FrameRects}
};
const ObjAnimation *MinigameBbLoogie::getAnimation(int animIndex) {
return &kAnimations[animIndex];
}
} // End of namespace Bbvs

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,133 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_MINIGAMES_BBTENNIS_H
#define BBVS_MINIGAMES_BBTENNIS_H
#include "bbvs/minigames/minigame.h"
namespace Bbvs {
class MinigameBbTennis : public Minigame {
public:
MinigameBbTennis(BbvsEngine *vm) : Minigame(vm) {};
bool run(bool fromMainGame) override;
public:
struct Obj {
int kind;
int x, y;
const ObjAnimation *anim;
int frameIndex;
int ticks;
int status;
int blinkCtr;
float fltStepX;
float fltStepY;
float fltX;
float fltY;
int targetX;
int targetY;
int ballStep;
int ballStepCtr;
int netPlayDirection;
};
enum {
kMaxObjectsCount = 256
};
enum {
kGSTitleScreen = 0, // Title screen
kGSMainGame = 1, // Game when called as part of the main game
kGSStandaloneGame = 2, // Game when called as standalone game
kGSScoreCountUp = 3 // Score countup and next level text
};
Obj _objects[kMaxObjectsCount];
int _numHearts;
int _squirrelDelay;
int _tennisPlayerDelay;
int _throwerDelay;
int _netPlayerDelay;
int _playerDecrease;
int _delayDecreaseTimer;
int _numBalls;
int _newBallTimer;
int _initBallTimer;
int _maxBalls;
int _rapidFireBallsCount;
int _score, _hiScore;
int _hitMissRatio;
bool _allHeartsGone;
bool _playedThisIsTheCoolest;
bool _startSoundPlayed;
bool _endSoundPlaying;
const ObjAnimation *getAnimation(int animIndex);
void buildDrawList(DrawList &drawList);
void buildDrawList0(DrawList &drawList);
void buildDrawList1(DrawList &drawList);
void buildDrawList2(DrawList &drawList);
void drawSprites();
void initObjs();
Obj *getFreeObject();
Obj *findTennisBall(int startObjIndex);
bool isHit(Obj *obj1, Obj *obj2);
void initObjects();
void initObjects0();
void initObjects1();
void initObjects2();
void initVars();
void initVars0();
void initVars1();
void initVars2();
bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
bool updateStatus2(int mouseX, int mouseY, uint mouseButtons);
void updateObjs();
void updateTennisBall(int objIndex);
void updateSquirrel(int objIndex);
void updateTennisPlayer(int objIndex);
void updateThrower(int objIndex);
void updateNetPlayer(int objIndex);
void updateEnemyTennisBall(int objIndex);
void makeEnemyBall(int x, int y, int frameIndex);
void hitSomething();
void update();
void loadSounds();
};
} // End of namespace Bbvs
#endif // BBVS_MINIGAMES_BBTENNIS_H

View File

@@ -0,0 +1,141 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/minigames/bbtennis.h"
namespace Bbvs {
static const int kAnim0FrameIndices[] = {0, 1, 2, 3};
static const int16 kAnim0FrameTicks[] = {6, 6, 6, 6};
static const BBRect kAnim0FrameRects[] = {{-15, -11, 22, 10}, {-15, -12, 23, 10}, {-14, -11, 22, 8}, {-13, -11, 20, 10}};
static const int kAnim1FrameIndices[] = {4, 5, 6, 7, 8, 3};
static const int16 kAnim1FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim1FrameRects[] = {{-16, -3, 7, 6}, {-13, -8, 11, 10}, {-14, -12, 15, 12}, {-15, -10, 17, 10}, {-17, -10, 22, 9}, {-13, -12, 20, 12}};
static const int kAnim2FrameIndices[] = {9, 10, 11, 12};
static const int16 kAnim2FrameTicks[] = {6, 8, 8, 8};
static const BBRect kAnim2FrameRects[] = {{-11, -14, 20, 14}, {-1, -14, 10, 15}, {3, -9, 6, 10}, {2, -5, 7, 6}};
static const int kAnim3FrameIndices[] = {13, 14, 15, 16, 17};
static const int16 kAnim3FrameTicks[] = {8, 8, 6, 6, 6};
static const BBRect kAnim3FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim4FrameIndices[] = {18, 19};
static const int16 kAnim4FrameTicks[] = {61, 22};
static const BBRect kAnim4FrameRects[] = {{-8, -12, 14, 11}, {-8, -12, 14, 11}};
static const int kAnim5FrameIndices[] = {20};
static const int16 kAnim5FrameTicks[] = {6};
static const BBRect kAnim5FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim6FrameIndices[] = {21, 22, 23, 24, 25, 26, 27, 28, 29};
static const int16 kAnim6FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim6FrameRects[] = {{-59, -43, 114, 114}, {-24, -13, 44, 46}, {-12, -5, 24, 25}, {-8, -3, 15, 15}, {-5, -3, 8, 8}, {-3, -2, 5, 5}, {-1, -1, 3, 3}, {0, 0, 2, 2}, {-56, 25, 102, 50}};
static const int kAnim7FrameIndices[] = {30};
static const int16 kAnim7FrameTicks[] = {6};
static const BBRect kAnim7FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim8FrameIndices[] = {31};
static const int16 kAnim8FrameTicks[] = {6};
static const BBRect kAnim8FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim9FrameIndices[] = {32};
static const int16 kAnim9FrameTicks[] = {6};
static const BBRect kAnim9FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim10FrameIndices[] = {33};
static const int16 kAnim10FrameTicks[] = {6};
static const BBRect kAnim10FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim11FrameIndices[] = {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 58, 59, 60, 61, 62, 63, 64, 42, 65};
static const int16 kAnim11FrameTicks[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 6, 6, 10, 10, 10, 10};
static const BBRect kAnim11FrameRects[] = {{0, -50, 16, 47}, {1, -49, 16, 47}, {-1, -49, 17, 46}, {0, -47, 16, 45}, {2, -46, 15, 46}, {0, -48, 17, 45}, {2, -50, 14, 49}, {-2, -46, 17, 46}, {0, -57, 15, 57}, {-2, -56, 14, 56}, {-4, -56, 13, 56}, {-4, -56, 15, 56}, {5, -51, 14, 49}, {4, -52, 15, 52}, {-1, -57, 13, 57}, {0, -55, 14, 55}, {-5, -50, 17, 49}, {-9, -50, 17, 49}, {-9, -48, 16, 47}, {-6, -49, 14, 48}, {-8, -50, 17, 50}, {-10, -48, 19, 48}, {-2, -50, 14, 50}, {2, -47, 13, 48}, {-1, -57, 13, 57}, {4, -55, 12, 56}, {4, -58, 13, 59}, {5, -58, 12, 59}, {5, -57, 15, 58}, {1, -57, 14, 57}, {-7, -51, 15, 51}, {-5, -53, 16, 53}, {0, -57, 15, 57}, {1, -55, 14, 55}};
static const int kAnim12FrameIndices[] = {66, 67, 68, 69, 70, 71, 72, 73, 69, 68, 67, 66, 74, 75};
static const int16 kAnim12FrameTicks[] = {10, 10, 10, 20, 10, 10, 6, 10, 20, 10, 10, 10, 8, 6};
static const BBRect kAnim12FrameRects[] = {{-5, -8, 12, 6}, {-12, -17, 24, 15}, {-12, -28, 24, 28}, {-10, -36, 20, 35}, {-9, -36, 18, 37}, {-11, -37, 17, 38}, {-6, -36, 16, 34}, {-5, -35, 20, 39}, {-10, -36, 20, 35}, {-12, -28, 24, 28}, {-12, -17, 24, 15}, {-5, -8, 12, 6}, {-15, -27, 23, 38}, {-19, -17, 15, 17}};
static const int kAnim13FrameIndices[] = {76, 77, 78, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 98, 102, 103, 90};
static const int16 kAnim13FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim13FrameRects[] = {{-21, -61, 16, 52}, {-42, -76, 7, 14}, {-43, -75, 13, 24}, {-42, -76, 7, 14}, {-42, -75, 4, 42}, {-42, -76, 11, 57}, {-40, -74, 13, 55}, {-36, -74, 11, 55}, {-31, -72, 12, 56}, {-27, -71, 14, 57}, {-20, -69, 15, 55}, {-12, -65, 15, 51}, {-7, -57, 18, 44}, {-3, -43, 18, 29}, {4, -27, 20, 14}, {0, -28, 13, 14}, {0, -38, 14, 24}, {-1, -49, 19, 36}, {0, -61, 17, 47}, {-2, -63, 19, 49}, {-5, -64, 19, 50}, {-3, -62, 18, 48}, {0, -61, 19, 47}, {0, -61, 16, 47}, {-4, -48, 17, 34}, {-9, -37, 15, 23}, {-13, -26, 14, 12}, {0, -61, 16, 47}, {0, -50, 15, 36}, {0, -39, 13, 25}, {0, -28, 12, 14}};
static const int kAnim14FrameIndices[] = {104, 105, 106, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 126, 130, 131, 118};
static const int16 kAnim14FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim14FrameRects[] = {{6, -61, 14, 52}, {35, -77, 7, 16}, {29, -76, 13, 24}, {35, -77, 7, 16}, {38, -76, 4, 43}, {32, -75, 10, 55}, {24, -74, 16, 54}, {22, -74, 14, 53}, {18, -72, 12, 55}, {12, -71, 15, 57}, {2, -69, 17, 55}, {-5, -65, 18, 51}, {-13, -57, 18, 43}, {-20, -43, 23, 29}, {-26, -30, 25, 16}, {-13, -28, 13, 14}, {-16, -38, 24, 24}, {-16, -49, 20, 35}, {-15, -61, 17, 47}, {-15, -63, 17, 49}, {-13, -64, 17, 51}, {-14, -62, 15, 48}, {-19, -61, 19, 47}, {-16, -61, 16, 48}, {-18, -48, 22, 34}, {-6, -37, 14, 23}, {0, -27, 12, 14}, {-16, -61, 16, 48}, {-16, -50, 19, 36}, {-14, -39, 15, 25}, {-12, -28, 12, 15}};
static const int kAnim15FrameIndices[] = {132, 133, 134, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 154, 158, 159, 146};
static const int16 kAnim15FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim15FrameRects[] = {{-21, -61, 16, 52}, {-42, -76, 7, 14}, {-43, -75, 13, 24}, {-42, -76, 7, 14}, {-42, -75, 4, 42}, {-42, -76, 11, 57}, {-40, -74, 13, 55}, {-36, -74, 11, 55}, {-31, -72, 12, 56}, {-27, -71, 14, 57}, {-20, -69, 15, 55}, {-12, -65, 15, 51}, {-7, -57, 18, 44}, {-3, -43, 18, 29}, {4, -27, 20, 14}, {0, -28, 13, 14}, {0, -38, 14, 24}, {-1, -49, 19, 36}, {0, -61, 17, 47}, {-2, -63, 19, 49}, {-5, -64, 19, 50}, {-3, -62, 18, 48}, {0, -61, 19, 47}, {0, -61, 16, 47}, {-4, -48, 17, 34}, {-9, -37, 15, 23}, {-13, -26, 14, 12}, {0, -61, 16, 47}, {0, -50, 15, 36}, {0, -39, 13, 25}, {0, -28, 12, 14}};
static const int kAnim16FrameIndices[] = {160, 161, 162, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 182, 186, 187, 174};
static const int16 kAnim16FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim16FrameRects[] = {{6, -61, 14, 52}, {35, -77, 7, 16}, {29, -76, 13, 24}, {35, -77, 7, 16}, {38, -76, 4, 43}, {32, -75, 10, 55}, {24, -74, 16, 54}, {22, -74, 14, 53}, {18, -72, 12, 55}, {12, -71, 15, 57}, {2, -69, 17, 55}, {-5, -65, 18, 51}, {-13, -57, 18, 43}, {-20, -43, 23, 29}, {-26, -30, 25, 16}, {-13, -28, 13, 14}, {-16, -38, 24, 24}, {-16, -49, 20, 35}, {-15, -61, 17, 47}, {-15, -63, 17, 49}, {-13, -64, 17, 51}, {-14, -62, 15, 48}, {-19, -61, 19, 47}, {-16, -61, 16, 48}, {-18, -48, 22, 34}, {-6, -37, 14, 23}, {0, -27, 12, 14}, {-16, -61, 16, 48}, {-16, -50, 19, 36}, {-14, -39, 15, 25}, {-12, -28, 12, 15}};
static const int kAnim17FrameIndices[] = {188, 189, 190, 189, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 210, 214, 215, 202};
static const int16 kAnim17FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim17FrameRects[] = {{-21, -61, 16, 52}, {-42, -76, 7, 14}, {-43, -75, 13, 24}, {-42, -76, 7, 14}, {-42, -75, 4, 42}, {-42, -76, 11, 57}, {-40, -74, 13, 55}, {-36, -74, 11, 55}, {-31, -72, 12, 56}, {-27, -71, 14, 57}, {-20, -69, 15, 55}, {-12, -65, 15, 51}, {-7, -57, 18, 44}, {-3, -43, 18, 29}, {4, -27, 20, 14}, {0, -28, 13, 14}, {0, -38, 14, 24}, {-1, -49, 19, 36}, {0, -61, 17, 47}, {-2, -63, 19, 49}, {-5, -64, 19, 50}, {-3, -62, 18, 48}, {0, -61, 19, 47}, {0, -61, 16, 47}, {-4, -48, 17, 34}, {-9, -37, 15, 23}, {-13, -26, 14, 12}, {0, -61, 16, 47}, {0, -50, 15, 36}, {0, -39, 13, 25}, {0, -28, 12, 14}};
static const int kAnim18FrameIndices[] = {216, 217, 218, 217, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 238, 242, 243, 230};
static const int16 kAnim18FrameTicks[] = {16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 10, 10, 6, 10, 10, 10, 10, 10, 10};
static const BBRect kAnim18FrameRects[] = {{6, -61, 14, 52}, {35, -77, 7, 16}, {29, -76, 13, 24}, {35, -77, 7, 16}, {38, -76, 4, 43}, {32, -75, 10, 55}, {24, -74, 16, 54}, {22, -74, 14, 53}, {18, -72, 12, 55}, {12, -71, 15, 57}, {2, -69, 17, 55}, {-5, -65, 18, 51}, {-13, -57, 18, 43}, {-20, -43, 23, 29}, {-26, -30, 25, 16}, {-13, -28, 13, 14}, {-16, -38, 24, 24}, {-16, -49, 20, 35}, {-15, -61, 17, 47}, {-15, -63, 17, 49}, {-13, -64, 17, 51}, {-14, -62, 15, 48}, {-19, -61, 19, 47}, {-16, -61, 16, 48}, {-18, -48, 22, 34}, {-6, -37, 14, 23}, {0, -27, 12, 14}, {-16, -61, 16, 48}, {-16, -50, 19, 36}, {-14, -39, 15, 25}, {-12, -28, 12, 15}};
static const int kAnim19FrameIndices[] = {244};
static const int16 kAnim19FrameTicks[] = {6};
static const BBRect kAnim19FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim20FrameIndices[] = {245, 246, 247, 248, 249, 250, 251, 252, 253, 254};
static const int16 kAnim20FrameTicks[] = {6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const BBRect kAnim20FrameRects[] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
static const int kAnim21FrameIndices[] = {255};
static const int16 kAnim21FrameTicks[] = {1};
static const BBRect kAnim21FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim22FrameIndices[] = {256};
static const int16 kAnim22FrameTicks[] = {5};
static const BBRect kAnim22FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim23FrameIndices[] = {257};
static const int16 kAnim23FrameTicks[] = {1};
static const BBRect kAnim23FrameRects[] = {{0, 0, 0, 0}};
static const int kAnim24FrameIndices[] = {258, 259};
static const int16 kAnim24FrameTicks[] = {6, 6};
static const BBRect kAnim24FrameRects[] = {{-9, -9, 17, 15}, {-11, -10, 19, 16}};
static const int kAnim25FrameIndices[] = {260, 261, 262, 263, 264, 265};
static const int16 kAnim25FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim25FrameRects[] = {{-22, -91, 45, 93}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}, {-21, -92, 43, 95}};
static const int kAnim26FrameIndices[] = {266, 267, 268, 269, 270, 271};
static const int16 kAnim26FrameTicks[] = {6, 6, 6, 6, 6, 6};
static const BBRect kAnim26FrameRects[] = {{-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}, {-21, -85, 38, 86}};
static const ObjAnimation kAnimations[] = {
{4, kAnim0FrameIndices, kAnim0FrameTicks, kAnim0FrameRects},
{6, kAnim1FrameIndices, kAnim1FrameTicks, kAnim1FrameRects},
{4, kAnim2FrameIndices, kAnim2FrameTicks, kAnim2FrameRects},
{5, kAnim3FrameIndices, kAnim3FrameTicks, kAnim3FrameRects},
{2, kAnim4FrameIndices, kAnim4FrameTicks, kAnim4FrameRects},
{1, kAnim5FrameIndices, kAnim5FrameTicks, kAnim5FrameRects},
{9, kAnim6FrameIndices, kAnim6FrameTicks, kAnim6FrameRects},
{1, kAnim7FrameIndices, kAnim7FrameTicks, kAnim7FrameRects},
{1, kAnim8FrameIndices, kAnim8FrameTicks, kAnim8FrameRects},
{1, kAnim9FrameIndices, kAnim9FrameTicks, kAnim9FrameRects},
{1, kAnim10FrameIndices, kAnim10FrameTicks, kAnim10FrameRects},
{34, kAnim11FrameIndices, kAnim11FrameTicks, kAnim11FrameRects},
{14, kAnim12FrameIndices, kAnim12FrameTicks, kAnim12FrameRects},
{31, kAnim13FrameIndices, kAnim13FrameTicks, kAnim13FrameRects},
{31, kAnim14FrameIndices, kAnim14FrameTicks, kAnim14FrameRects},
{31, kAnim15FrameIndices, kAnim15FrameTicks, kAnim15FrameRects},
{31, kAnim16FrameIndices, kAnim16FrameTicks, kAnim16FrameRects},
{31, kAnim17FrameIndices, kAnim17FrameTicks, kAnim17FrameRects},
{31, kAnim18FrameIndices, kAnim18FrameTicks, kAnim18FrameRects},
{1, kAnim19FrameIndices, kAnim19FrameTicks, kAnim19FrameRects},
{10, kAnim20FrameIndices, kAnim20FrameTicks, kAnim20FrameRects},
{1, kAnim21FrameIndices, kAnim21FrameTicks, kAnim21FrameRects},
{1, kAnim22FrameIndices, kAnim22FrameTicks, kAnim22FrameRects},
{1, kAnim23FrameIndices, kAnim23FrameTicks, kAnim23FrameRects},
{2, kAnim24FrameIndices, kAnim24FrameTicks, kAnim24FrameRects},
{6, kAnim25FrameIndices, kAnim25FrameTicks, kAnim25FrameRects},
{6, kAnim26FrameIndices, kAnim26FrameTicks, kAnim26FrameRects}
};
const ObjAnimation *MinigameBbTennis::getAnimation(int animIndex) {
return &kAnimations[animIndex];
}
} // End of namespace Bbvs

View File

@@ -0,0 +1,111 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/minigames/minigame.h"
#include "common/savefile.h"
namespace Bbvs {
Minigame::Minigame(BbvsEngine *vm)
: _vm(vm), _spriteModule(nullptr) {
memset(_hiScoreTable, 0, sizeof(_hiScoreTable));
_gameState = 0;
_gameTicks = 0;
_gameResult = false;
_gameDone = false;
_fromMainGame = false;
_backgroundSpriteIndex = 0;
_titleScreenSpriteIndex = 0;
_numbersAnim = nullptr;
}
Minigame::~Minigame() {
}
int Minigame::drawNumber(DrawList &drawList, int number, int x, int y) {
int digits = 1, rightX = x;
for (int mag = 10; number / mag != 0; mag *= 10)
++digits;
rightX = x + digits * 10;
x = rightX;
while (digits--) {
const int n = number % 10;
x -= 10;
drawList.add(_numbersAnim->frameIndices[n], x, y, 2000);
number /= 10;
}
return rightX;
}
void Minigame::playSound(uint index, bool loop) {
if (index > 0)
_vm->_sound->playSound(index - 1, loop);
}
void Minigame::stopSound(uint index) {
if (index > 0)
_vm->_sound->stopSound(index - 1);
}
bool Minigame::isSoundPlaying(uint index) {
return index > 0 && _vm->_sound->isSoundPlaying(index - 1);
}
bool Minigame::isAnySoundPlaying(const uint *indices, uint count) {
for (uint i = 0; i < count; ++i)
if (isSoundPlaying(indices[i]))
return true;
return false;
}
void Minigame::saveHiscore(int minigameNum, int score) {
Common::String filename = _vm->getTargetName() + "-highscore.dat";
Common::OutSaveFile *file = g_system->getSavefileManager()->openForSaving(filename);
if (file) {
// Reserve a byte for future usage (rarely a bad idea, you never know...)
file->writeByte(0);
_hiScoreTable[minigameNum] = score;
for (int i = 0; i < kMinigameCount; ++i)
file->writeUint32LE(_hiScoreTable[i]);
delete file;
}
}
int Minigame::loadHiscore(int minigameNum) {
int score = 0;
Common::String filename = _vm->getTargetName() + "-highscore.dat";
Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(filename);
if (file) {
file->readByte();
for (int i = 0; i < kMinigameCount; ++i)
_hiScoreTable[i] = file->readUint32LE();
delete file;
score = _hiScoreTable[minigameNum];
}
return score;
}
} // End of namespace Bbvs

View File

@@ -0,0 +1,81 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_MINIGAMES_MINIGAME_H
#define BBVS_MINIGAMES_MINIGAME_H
#include "bbvs/bbvs.h"
#include "bbvs/graphics.h"
#include "bbvs/sound.h"
#include "bbvs/spritemodule.h"
namespace Bbvs {
enum {
kMinigameBbLoogie = 0,
kMinigameBbTennis = 1,
kMinigameBbAnt = 2,
kMinigameBbAirGuitar = 3,
kMinigameCount
};
struct ObjAnimation {
int frameCount;
const int *frameIndices;
const int16 *frameTicks;
const BBRect *frameRects;
};
class Minigame {
public:
Minigame(BbvsEngine *vm);
virtual ~Minigame();
virtual bool run(bool fromMainGame) = 0;
protected:
BbvsEngine *_vm;
SpriteModule *_spriteModule;
int _gameState;
int _gameTicks;
bool _gameResult;
bool _gameDone;
bool _fromMainGame;
int _hiScoreTable[kMinigameCount];
int _backgroundSpriteIndex, _titleScreenSpriteIndex;
const ObjAnimation *_numbersAnim;
int drawNumber(DrawList &drawList, int number, int x, int y);
void playSound(uint index, bool loop = false);
void stopSound(uint index);
bool isSoundPlaying(uint index);
bool isAnySoundPlaying(const uint *indices, uint count);
void saveHiscore(int minigameNum, int score);
int loadHiscore(int minigameNum);
};
} // End of namespace Bbvs
#endif // BBVS_MINIGAMES_MINIGAME_H

35
engines/bbvs/module.mk Normal file
View File

@@ -0,0 +1,35 @@
MODULE := engines/bbvs
MODULE_OBJS := \
bbvs.o \
dialogs.o \
gamemodule.o \
graphics.o \
logic.o \
metaengine.o \
saveload.o \
scene.o \
sound.o \
spritemodule.o \
videoplayer.o \
walk.o \
minigames/bbairguitar.o \
minigames/bbairguitar_anims.o \
minigames/bbant.o \
minigames/bbant_anims.o \
minigames/bbloogie.o \
minigames/bbloogie_anims.o \
minigames/bbtennis.o \
minigames/bbtennis_anims.o \
minigames/minigame.o
# This module can be built as a plugin
ifeq ($(ENABLE_BBVS), DYNAMIC_PLUGIN)
PLUGIN := 1
endif
# Include common rules
include $(srcdir)/rules.mk
# Detection objects
DETECT_OBJS += $(MODULE)/detection.o

268
engines/bbvs/saveload.cpp Normal file
View File

@@ -0,0 +1,268 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "bbvs/gamemodule.h"
#include "common/savefile.h"
#include "graphics/thumbnail.h"
namespace Bbvs {
WARN_UNUSED_RESULT BbvsEngine::kReadSaveHeaderError BbvsEngine::readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail) {
header.version = in->readUint32LE();
if (header.version > BBVS_SAVEGAME_VERSION)
return kRSHEInvalidVersion;
byte descriptionLen = in->readByte();
header.description = "";
while (descriptionLen--)
header.description += (char)in->readByte();
if (!Graphics::loadThumbnail(*in, header.thumbnail, skipThumbnail)) {
return kRSHEIoError;
}
// Not used yet, reserved for future usage
header.gameID = in->readByte();
header.flags = in->readUint32LE();
header.saveDate = in->readUint32LE();
header.saveTime = in->readUint32LE();
header.playTime = in->readUint32LE();
return ((in->eos() || in->err()) ? kRSHEIoError : kRSHENoError);
}
void BbvsEngine::savegame(const char *filename, const char *description) {
Common::OutSaveFile *out;
if (!(out = _system->getSavefileManager()->openForSaving(filename))) {
warning("Can't create file '%s', game not saved", filename);
return;
}
TimeDate curTime;
_system->getTimeAndDate(curTime);
// Header start
out->writeUint32LE(BBVS_SAVEGAME_VERSION);
byte descriptionLen = strlen(description);
out->writeByte(descriptionLen);
out->write(description, descriptionLen);
Graphics::saveThumbnail(*out);
// Not used yet, reserved for future usage
out->writeByte(0);
out->writeUint32LE(0);
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint32 saveTime = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF);
uint32 playTime = g_engine->getTotalPlayTime() / 1000;
out->writeUint32LE(saveDate);
out->writeUint32LE(saveTime);
out->writeUint32LE(playTime);
// Header end
out->write(_snapshot, _snapshotStream->pos());
out->finalize();
delete out;
}
void BbvsEngine::loadgame(const char *filename) {
Common::InSaveFile *in;
if (!(in = _system->getSavefileManager()->openForLoading(filename))) {
warning("Can't open file '%s', game not loaded", filename);
return;
}
SaveHeader header;
kReadSaveHeaderError errorCode = readSaveHeader(in, header);
if (errorCode != kRSHENoError) {
warning("Error loading savegame '%s'", filename);
delete in;
return;
}
g_engine->setTotalPlayTime(header.playTime * 1000);
for (int i = 0; i < kSceneObjectsCount; ++i) {
_sceneObjects[i].clear();
_sceneObjects[i].walkDestPt.x = -1;
_sceneObjects[i].walkDestPt.y = -1;
}
_currSceneNum = 0;
_newSceneNum = in->readUint32LE();
initScene(false);
_prevSceneNum = in->readUint32LE();
_gameState = in->readUint32LE();
_mouseCursorSpriteIndex = in->readUint32LE();
_mousePos.x = in->readUint16LE();
_mousePos.y = in->readUint16LE();
_currVerbNum = in->readUint32LE();
_activeItemType = in->readUint32LE();
_activeItemIndex = in->readUint32LE();
_verbPos.x = in->readUint16LE();
_verbPos.y = in->readUint16LE();
_inventoryButtonIndex = in->readUint32LE();
_currInventoryItem = in->readUint32LE();
_currTalkObjectIndex = in->readUint32LE();
_currCameraNum = in->readUint32LE();
_cameraPos.x = in->readUint16LE();
_cameraPos.y = in->readUint16LE();
_newCameraPos.x = in->readUint16LE();
_newCameraPos.y = in->readUint16LE();
_dialogSlotCount = in->readUint32LE();
_walkMousePos.x = in->readUint16LE();
_walkMousePos.y = in->readUint16LE();
in->read(_backgroundSoundsActive, kSceneSoundsCount);
in->read(_inventoryItemStatus, kInventoryItemStatusCount);
in->read(_dialogItemStatus, kDialogItemStatusCount);
in->read(_gameVars, kGameVarsCount);
in->read(_sceneVisited, kSceneVisitedCount);
for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i) {
SceneObject *obj = &_sceneObjects[i];
obj->x = in->readUint32LE();
obj->y = in->readUint32LE();
obj->animIndex = in->readUint32LE();
obj->frameIndex = in->readUint32LE();
obj->frameTicks = in->readUint32LE();
obj->walkCount = in->readUint32LE();
obj->xIncr = in->readUint32LE();
obj->yIncr = in->readUint32LE();
obj->turnValue = in->readUint32LE();
obj->turnCount = in->readUint32LE();
obj->turnTicks = in->readUint32LE();
obj->walkDestPt.x = in->readUint16LE();
obj->walkDestPt.y = in->readUint16LE();
obj->anim = obj->animIndex > 0 ? _gameModule->getAnimation(obj->animIndex) : nullptr;
}
updateWalkableRects();
// Restart scene background sounds
for (int i = 0; i < _gameModule->getSceneSoundsCount(); ++i) {
if (_backgroundSoundsActive[i]) {
SceneSound *sceneSound = _gameModule->getSceneSound(i);
playSound(sceneSound->soundNum, true);
}
}
_currAction = nullptr;
_currActionCommandIndex = -1;
delete in;
}
Common::Error BbvsEngine::loadGameState(int slot) {
Common::String fileName = getSaveStateName(slot);
loadgame(fileName.c_str());
return Common::kNoError;
}
Common::Error BbvsEngine::saveGameState(int slot, const Common::String &description, bool isAutosave) {
Common::String fileName = getSaveStateName(slot);
savegame(fileName.c_str(), description.c_str());
return Common::kNoError;
}
Common::String BbvsEngine::getSavegameFilename(const Common::String &target, int num) {
assert(num >= 0 && num <= 999);
return Common::String::format("%s.%03d", target.c_str(), num);
}
bool BbvsEngine::existsSavegame(int num) {
return _system->getSavefileManager()->listSavefiles(getSavegameFilename(_targetName, num)).size() != 0;
}
void BbvsEngine::allocSnapshot() {
_snapshot = new byte[kSnapshotSize];
_snapshotStream = new Common::SeekableMemoryWriteStream(_snapshot, kSnapshotSize);
}
void BbvsEngine::freeSnapshot() {
delete _snapshotStream;
delete[] _snapshot;
}
void BbvsEngine::saveSnapshot() {
_hasSnapshot = true;
_snapshotStream->seek(0);
_snapshotStream->writeUint32LE(_currSceneNum);
_snapshotStream->writeUint32LE(_prevSceneNum);
_snapshotStream->writeUint32LE(_gameState);
_snapshotStream->writeUint32LE(_mouseCursorSpriteIndex);
_snapshotStream->writeUint16LE(_mousePos.x);
_snapshotStream->writeUint16LE(_mousePos.y);
_snapshotStream->writeUint32LE(_currVerbNum);
_snapshotStream->writeUint32LE(_activeItemType);
_snapshotStream->writeUint32LE(_activeItemIndex);
_snapshotStream->writeUint16LE(_verbPos.x);
_snapshotStream->writeUint16LE(_verbPos.y);
_snapshotStream->writeUint32LE(_inventoryButtonIndex);
_snapshotStream->writeUint32LE(_currInventoryItem);
_snapshotStream->writeUint32LE(_currTalkObjectIndex);
_snapshotStream->writeUint32LE(_currCameraNum);
_snapshotStream->writeUint16LE(_cameraPos.x);
_snapshotStream->writeUint16LE(_cameraPos.y);
_snapshotStream->writeUint16LE(_newCameraPos.x);
_snapshotStream->writeUint16LE(_newCameraPos.y);
_snapshotStream->writeUint32LE(_dialogSlotCount);
_snapshotStream->writeUint16LE(_walkMousePos.x);
_snapshotStream->writeUint16LE(_walkMousePos.y);
_snapshotStream->write(_backgroundSoundsActive, kSceneSoundsCount);
_snapshotStream->write(_inventoryItemStatus, kInventoryItemStatusCount);
_snapshotStream->write(_dialogItemStatus, kDialogItemStatusCount);
_snapshotStream->write(_gameVars, kGameVarsCount);
_snapshotStream->write(_sceneVisited, kSceneVisitedCount);
for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i) {
SceneObject *obj = &_sceneObjects[i];
_snapshotStream->writeUint32LE(obj->x);
_snapshotStream->writeUint32LE(obj->y);
_snapshotStream->writeUint32LE(obj->animIndex);
_snapshotStream->writeUint32LE(obj->frameIndex);
_snapshotStream->writeUint32LE(obj->frameTicks);
_snapshotStream->writeUint32LE(obj->walkCount);
_snapshotStream->writeUint32LE(obj->xIncr);
_snapshotStream->writeUint32LE(obj->yIncr);
_snapshotStream->writeUint32LE(obj->turnValue);
_snapshotStream->writeUint32LE(obj->turnCount);
_snapshotStream->writeUint32LE(obj->turnTicks);
_snapshotStream->writeUint16LE(obj->walkDestPt.x);
_snapshotStream->writeUint16LE(obj->walkDestPt.y);
}
}
void BbvsEngine::writeContinueSavegame() {
if (_hasSnapshot) {
saveGameState(0, "Continue");
}
}
} // End of namespace Bbvs

236
engines/bbvs/scene.cpp Normal file
View File

@@ -0,0 +1,236 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "bbvs/gamemodule.h"
#include "bbvs/graphics.h"
#include "bbvs/sound.h"
#include "engines/advancedDetector.h"
namespace Bbvs {
static const int kAfterVideoSceneNum[] = {
0, 43, 23, 12, 4, 44, 2,
16, 4, 4, 4, 44, 12, 44
};
static const int kAfterVideoSceneNumDemo[] = {
0, 32, 33, 23, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
};
void BbvsEngine::loadScene(int sceneNum) {
debug(0, "BbvsEngine::loadScene() sceneNum: %d", sceneNum);
Common::Path sprFilename(Common::String::format("vnm/vspr%04d.vnm", sceneNum));
Common::Path gamFilename(Common::String::format("vnm/game%04d.vnm", sceneNum));
_screen->clear();
_spriteModule->load(sprFilename);
_gameModule->load(gamFilename);
Palette palette = _spriteModule->getPalette();
_screen->setPalette(palette);
// Preload sounds
for (uint i = 0; i < _gameModule->getPreloadSoundsCount(); ++i) {
Common::Path filename(Common::String::format("snd/snd%05d.aif", _gameModule->getPreloadSound(i)));
_sound->loadSound(filename);
}
if (sceneNum >= kMainMenu) {
DrawList drawList;
drawList.add(_gameModule->getBgSpriteIndex(0), 0, 0, 0);
_screen->drawDrawList(drawList, _spriteModule);
drawScreen();
}
}
void BbvsEngine::initScene(bool sounds) {
stopSpeech();
stopSounds();
_sound->unloadSounds();
_gameState = kGSScene;
_prevSceneNum = _currSceneNum;
_sceneVisited[_currSceneNum] = 1;
_mouseCursorSpriteIndex = 0;
_verbPos.x = -1;
_verbPos.y = -1;
_activeItemType = kITEmpty;
_activeItemIndex = 0;
_cameraPos.x = 0;
_cameraPos.y = 0;
_newCameraPos.x = 0;
_newCameraPos.y = 0;
_inventoryButtonIndex = -1;
_currTalkObjectIndex = -1;
_currCameraNum = 0;
_walkMousePos.x = -1;
_walkMousePos.y = -1;
_currAction = nullptr;
_currActionCommandIndex = -1;
_currActionCommandTimeStamp = 0;
_dialogSlotCount = 0;
_buttheadObject = nullptr;
_beavisObject = nullptr;
memset(_backgroundSoundsActive, 0, sizeof(_backgroundSoundsActive));
for (int i = 0; i < kSceneObjectsCount; ++i) {
_sceneObjects[i].clear();
_sceneObjects[i].walkDestPt.x = -1;
_sceneObjects[i].walkDestPt.y = -1;
}
memset(_dialogItemStatus, 0, sizeof(_dialogItemStatus));
_sceneObjectActions.clear();
loadScene(_newSceneNum);
_currSceneNum = _newSceneNum;
_newSceneNum = 0;
for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i)
_sceneObjects[i].sceneObjectDef = _gameModule->getSceneObjectDef(i);
for (int i = 0; i < _gameModule->getSceneObjectInitsCount(); ++i) {
SceneObjectInit *soInit = _gameModule->getSceneObjectInit(i);
if (evalCondition(soInit->conditions)) {
SceneObject *sceneObject = &_sceneObjects[soInit->sceneObjectIndex];
sceneObject->anim = _gameModule->getAnimation(soInit->animIndex);
sceneObject->animIndex = soInit->animIndex;
sceneObject->frameIndex = sceneObject->anim->frameCount - 1;
sceneObject->frameTicks = 1;
sceneObject->x = soInit->x * 65536;
sceneObject->y = soInit->y * 65536;
}
}
if (_gameModule->getButtheadObjectIndex() >= 0) {
_buttheadObject = &_sceneObjects[_gameModule->getButtheadObjectIndex()];
// Search for the Beavis object
for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i)
if (!strcmp(_sceneObjects[i].sceneObjectDef->name, "Beavis")) {
_beavisObject = &_sceneObjects[i];
break;
}
}
updateSceneObjectsTurnValue();
updateWalkableRects();
_currCameraNum = 0;
if (_buttheadObject) {
int minDistance = 0xFFFFFF;
for (int cameraNum = 0; cameraNum < 4; ++cameraNum) {
CameraInit *cameraInit = _gameModule->getCameraInit(cameraNum);
int curDistance = ABS(cameraInit->cameraPos.x - (int)(_buttheadObject->x / 65536) + 160);
if (curDistance < minDistance) {
minDistance = curDistance;
_currCameraNum = cameraNum;
}
}
}
_cameraPos = _gameModule->getCameraInit(_currCameraNum)->cameraPos;
_newCameraPos = _cameraPos;
_walkAreaActions.clear();
for (int i = 0; i < _gameModule->getActionsCount(); ++i) {
Action *action = _gameModule->getAction(i);
for (int j = 0; j < 8; ++j)
if (action->conditions.conditions[j].cond == kCondIsButtheadAtBgObject)
_walkAreaActions.push_back(action);
}
_mouseCursorSpriteIndex = 0;
_activeItemIndex = 0;
_activeItemType = kITEmpty;
for (int i = 0; i < _gameModule->getActionsCount(); ++i) {
Action *action = _gameModule->getAction(i);
if (evalCondition(action->conditions)) {
_gameState = kGSWait;
_currAction = action;
for (uint j = 0; j < action->actionCommands.size(); ++j) {
ActionCommand *actionCommand = &action->actionCommands[j];
if (actionCommand->cmd == kActionCmdSetCameraPos) {
_currCameraNum = actionCommand->param;
_cameraPos = _gameModule->getCameraInit(_currCameraNum)->cameraPos;
_newCameraPos = _cameraPos;
break;
}
}
break;
}
}
if (sounds)
updateBackgroundSounds();
}
bool BbvsEngine::changeScene() {
writeContinueSavegame();
if (_newSceneNum >= 27 && _newSceneNum <= 30) {
// Run minigames
stopSpeech();
stopSounds();
_sceneVisited[_currSceneNum] = 1;
if (runMinigame(_newSceneNum - 27)) {
SWAP(_currSceneNum, _newSceneNum);
}
} else if (_newSceneNum >= 31 && _newSceneNum <= 43) {
// Play video
stopSpeech();
stopSounds();
_sceneVisited[_currSceneNum] = 1;
_playVideoNumber = _newSceneNum - 30;
_currSceneNum = _newSceneNum;
if (isDemo())
_newSceneNum = kAfterVideoSceneNumDemo[_playVideoNumber];
else
_newSceneNum = kAfterVideoSceneNum[_playVideoNumber];
} else if (_newSceneNum >= 100 && _currSceneNum == kCredits) {
// Play secret video
stopSounds();
_playVideoNumber = _newSceneNum;
_currSceneNum = 49;
_newSceneNum = kCredits;
} else {
// Normal scene
initScene(true);
}
return true;
}
} // End of namespace Bbvs

114
engines/bbvs/sound.cpp Normal file
View File

@@ -0,0 +1,114 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/sound.h"
#include "audio/audiostream.h"
#include "audio/decoders/aiff.h"
#include "common/debug.h"
#include "common/file.h"
#include "common/system.h"
namespace Bbvs {
Sound::Sound() : _stream(nullptr) {
}
Sound::~Sound() {
stop();
delete _stream;
}
void Sound::load(const Common::Path &filename) {
Common::File *fd = new Common::File();
if (!fd->open(filename)) {
delete fd;
error("SoundMan::loadSound() Could not load %s", filename.toString(Common::Path::kNativeSeparator).c_str());
}
_stream = Audio::makeAIFFStream(fd, DisposeAfterUse::YES);
_filename = filename;
}
void Sound::play(bool loop) {
debug(0, "Sound::play() [%s] loop:%d", _filename.toString(Common::Path::kNativeSeparator).c_str(), loop);
stop();
_stream->rewind();
if (loop) {
Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_handle, audioStream,
-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
} else {
g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_handle, _stream,
-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
}
void Sound::stop() {
g_system->getMixer()->stopHandle(_handle);
}
bool Sound::isPlaying() {
return g_system->getMixer()->isSoundHandleActive(_handle);
}
SoundMan::~SoundMan() {
stopAllSounds();
unloadSounds();
}
void SoundMan::loadSound(const Common::Path &filename) {
Sound *sound = new Sound();
sound->load(filename);
_sounds.push_back(sound);
}
void SoundMan::playSound(uint index, bool loop) {
_sounds[index]->play(loop);
}
void SoundMan::stopSound(uint index) {
_sounds[index]->stop();
}
bool SoundMan::isSoundPlaying(uint index) {
return _sounds[index]->isPlaying();
}
bool SoundMan::isAnySoundPlaying(uint *indices, uint count) {
for (uint i = 0; i < count; ++i)
if (isSoundPlaying(indices[i]))
return true;
return false;
}
void SoundMan::unloadSounds() {
for (uint i = 0; i < _sounds.size(); ++i)
delete _sounds[i];
_sounds.clear();
}
void SoundMan::stopAllSounds() {
for (uint i = 0; i < _sounds.size(); ++i)
_sounds[i]->stop();
}
} // End of namespace Bbvs

65
engines/bbvs/sound.h Normal file
View File

@@ -0,0 +1,65 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_SOUND_H
#define BBVS_SOUND_H
#include "audio/mixer.h"
#include "common/array.h"
namespace Audio {
class RewindableAudioStream;
}
namespace Bbvs {
class Sound {
public:
Sound();
~Sound();
void load(const Common::Path &filename);
void play(bool loop);
void stop();
bool isPlaying();
protected:
Audio::RewindableAudioStream *_stream;
Audio::SoundHandle _handle;
// Keep the filename for debugging purposes
Common::Path _filename;
};
class SoundMan {
public:
~SoundMan();
void loadSound(const Common::Path &fileName);
void playSound(uint index, bool loop = false);
void stopSound(uint index);
bool isSoundPlaying(uint index);
bool isAnySoundPlaying(uint *indices, uint count);
void unloadSounds();
void stopAllSounds();
protected:
Common::Array<Sound*> _sounds;
};
} // End of namespace Bbvs
#endif // BBVS_SOUND_H

View File

@@ -0,0 +1,112 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/spritemodule.h"
namespace Bbvs {
byte *Sprite::getRow(int y) {
if (type == 1)
return data + READ_LE_UINT32((data + offset) + y * 4);
else
return data + offset + y * width;
}
SpriteModule::SpriteModule()
: _spritesCount(0), _paletteStart(0), _paletteCount(0), _spriteData(nullptr), _spriteDataSize(0),
_spriteTblOffs(0), _paletteOffs(0) {
}
SpriteModule::~SpriteModule() {
unload();
}
void SpriteModule::load(const Common::Path &filename) {
unload();
Common::File fd;
if (!fd.open(filename))
error("SpriteModule::load() Could not open %s", filename.toString(Common::Path::kNativeSeparator).c_str());
fd.readUint32LE(); // Skip magic
fd.readUint32LE(); // Skip unused
fd.readUint32LE(); // Skip filesize
_paletteOffs = fd.readUint32LE();
fd.readUint32LE(); // Skip unused flagsTbl1Ofs
fd.readUint32LE(); // Skip unused flagsTbl2Ofs
_spriteTblOffs = fd.readUint32LE();
_paletteStart = fd.readUint32LE();
_paletteCount = fd.readUint32LE();
_spritesCount = fd.readUint32LE();
debug(0, "_paletteOffs: %08X", _paletteOffs);
debug(0, "_spriteTblOffs: %08X", _spriteTblOffs);
debug(0, "_paletteStart: %d", _paletteStart);
debug(0, "_paletteCount: %d", _paletteCount);
debug(0, "_spritesCount: %d", _spritesCount);
_spriteDataSize = fd.size();
_spriteData = new byte[_spriteDataSize];
fd.seek(0);
fd.read(_spriteData, _spriteDataSize);
// Convert palette
byte *palette = _spriteData + _paletteOffs;
for (int i = 0; i < _paletteCount; ++i) {
palette[i * 3 + 0] <<= 2;
palette[i * 3 + 1] <<= 2;
palette[i * 3 + 2] <<= 2;
}
}
Sprite SpriteModule::getSprite(int index) {
Sprite sprite;
uint32 spriteOffs = READ_LE_UINT32(_spriteData + _spriteTblOffs + index * 4);
byte *info = _spriteData + spriteOffs;
sprite.data = _spriteData;
sprite.offset = READ_LE_UINT32(info + 0);
sprite.type = READ_LE_UINT32(info + 4);
sprite.width = READ_LE_UINT32(info + 8);
sprite.height = READ_LE_UINT32(info + 12);
sprite.xOffs = READ_LE_UINT32(info + 16);
sprite.yOffs = READ_LE_UINT32(info + 20);
return sprite;
}
Palette SpriteModule::getPalette() {
Palette palette;
palette.data = _spriteData + _paletteOffs;
palette.start = _paletteStart;
palette.count = _paletteCount;
return palette;
}
void SpriteModule::unload() {
_spritesCount = 0;
_paletteStart = 0;
_paletteCount = 0;
delete[] _spriteData;
_spriteData = nullptr;
}
} // End of namespace Bbvs

View File

@@ -0,0 +1,67 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BBVS_SPRITEMODULE_H
#define BBVS_SPRITEMODULE_H
#include "common/array.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/rect.h"
#include "common/str.h"
namespace Bbvs {
struct Sprite {
int type;
int xOffs, yOffs;
int width, height;
byte *data;
uint32 offset;
byte *getRow(int y);
};
struct Palette {
byte *data;
int start, count;
};
class SpriteModule {
public:
SpriteModule();
~SpriteModule();
void load(const Common::Path &filename);
int getSpriteCount() { return _spritesCount; }
Sprite getSprite(int index);
Palette getPalette();
protected:
byte *_spriteData;
int _spriteDataSize;
int _spritesCount;
uint32 _spriteTblOffs;
uint32 _paletteOffs;
int _paletteStart, _paletteCount;
void unload();
};
} // End of namespace Bbvs
#endif // BBVS_SPRITEMODULE_H

View File

@@ -0,0 +1,86 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "engines/util.h"
#include "graphics/surface.h"
#include "video/avi_decoder.h"
namespace Bbvs {
void BbvsEngine::playVideo(int videoNum) {
Common::Path videoFilename;
if (videoNum >= 100)
videoFilename = Common::Path(Common::String::format("snd/snd%05d.aif", videoNum + 1400));
else
videoFilename = Common::Path(Common::String::format("vid/video%03d.avi", videoNum - 1));
Video::AVIDecoder videoDecoder;
if (!videoDecoder.loadFile(videoFilename)) {
warning("Unable to open video %s", videoFilename.toString(Common::Path::kNativeSeparator).c_str());
return;
}
// Set the correct video mode
initGraphics(320, 240, nullptr);
if (_system->getScreenFormat().bytesPerPixel == 1) {
warning("Couldn't switch to a RGB color video mode to play a video.");
return;
}
debug(0, "Screen format: %s", _system->getScreenFormat().toString().c_str());
videoDecoder.start();
bool skipVideo = false;
while (!shouldQuit() && !videoDecoder.endOfVideo() && !skipVideo) {
if (videoDecoder.needsUpdate()) {
const Graphics::Surface *frame = videoDecoder.decodeNextFrame();
if (frame) {
if (frame->format.bytesPerPixel > 1) {
Graphics::Surface *frame1 = frame->convertTo(_system->getScreenFormat());
_system->copyRectToScreen(frame1->getPixels(), frame1->pitch, 0, 0, frame1->w, frame1->h);
frame1->free();
delete frame1;
} else {
_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
}
_system->updateScreen();
}
}
Common::Event event;
while (_system->getEventManager()->pollEvent(event)) {
if ((event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START && event.customType == kActionEscape) ||
event.type == Common::EVENT_LBUTTONUP)
skipVideo = true;
}
_system->delayMillis(10);
}
initGraphics(320, 240);
}
} // End of namespace Bbvs

461
engines/bbvs/walk.cpp Normal file
View File

@@ -0,0 +1,461 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "bbvs/bbvs.h"
#include "bbvs/gamemodule.h"
namespace Bbvs {
static const int8 kTurnInfo[8][8] = {
{ 0, 1, 1, 1, 1, -1, -1, -1},
{-1, 0, 1, 1, 1, 1, -1, -1},
{-1, -1, 0, 1, 1, 1, 1, -1},
{-1, -1, -1, 0, 1, 1, 1, 1},
{ 1, -1, -1, -1, 0, 1, 1, 1},
{ 1, 1, -1, -1, -1, 0, 1, 1},
{ 1, 1, 1, -1, -1, -1, 0, 1},
{ 1, 1, 1, 1, -1, -1, -1, 0}
};
static const int8 kWalkAnimTbl[32] = {
3, 0, 0, 0, 2, 1, 1, 1,
15, 12, 14, 13, 0, 0, 0, 0,
7, 9, 4, 8, 6, 10, 5, 11,
3, 0, 2, 1, 15, 12, 14, 13
};
void BbvsEngine::startWalkObject(SceneObject *sceneObject) {
if (_buttheadObject != sceneObject && _beavisObject != sceneObject)
return;
initWalkAreas(sceneObject);
_sourceWalkAreaPt.x = sceneObject->x / 65536;
_sourceWalkAreaPt.y = sceneObject->y / 65536;
_sourceWalkArea = getWalkAreaAtPos(_sourceWalkAreaPt);
if (!_sourceWalkArea)
return;
_destWalkAreaPt = sceneObject->walkDestPt;
_destWalkArea = getWalkAreaAtPos(_destWalkAreaPt);
if (!_destWalkArea)
return;
if (_sourceWalkArea != _destWalkArea) {
_currWalkDistance = kMaxDistance;
walkFindPath(_sourceWalkArea, 0);
_destWalkAreaPt = _currWalkDistance == kMaxDistance ? _sourceWalkAreaPt : _finalWalkPt;
}
walkObject(sceneObject, _destWalkAreaPt, sceneObject->sceneObjectDef->walkSpeed);
}
void BbvsEngine::updateWalkObject(SceneObject *sceneObject) {
int animIndex;
if (sceneObject->walkCount > 0 && (sceneObject->xIncr != 0 || sceneObject->yIncr != 0)) {
if (ABS(sceneObject->xIncr) <= ABS(sceneObject->yIncr))
sceneObject->turnValue = sceneObject->yIncr >= 0 ? 0 : 4;
else
sceneObject->turnValue = sceneObject->xIncr >= 0 ? 6 : 2;
animIndex = sceneObject->sceneObjectDef->animIndices[kWalkAnimTbl[sceneObject->turnValue]];
sceneObject->turnCount = 0;
sceneObject->turnTicks = 0;
} else {
animIndex = sceneObject->sceneObjectDef->animIndices[kWalkTurnTbl[sceneObject->turnValue]];
}
Animation *anim = nullptr;
if (animIndex > 0)
anim = _gameModule->getAnimation(animIndex);
if (sceneObject->anim != anim) {
if (anim) {
sceneObject->anim = anim;
sceneObject->animIndex = animIndex;
sceneObject->frameTicks = 1;
sceneObject->frameIndex = anim->frameCount - 1;
} else {
sceneObject->anim = nullptr;
sceneObject->animIndex = 0;
sceneObject->frameTicks = 0;
sceneObject->frameIndex = 0;
}
}
}
void BbvsEngine::walkObject(SceneObject *sceneObject, const Common::Point &destPt, int walkSpeed) {
int deltaX = destPt.x - (sceneObject->x / 65536);
int deltaY = destPt.y - (sceneObject->y / 65536);
float distance = (float)sqrt((double)(deltaX * deltaX + deltaY * deltaY));
// NOTE The original doesn't have this check but without it the whole pathfinding breaks
if (distance > 0.0f) {
sceneObject->walkCount = (int)(distance / ((((float)ABS(deltaX) / distance) + 1.0f) * ((float)walkSpeed / 120)));
sceneObject->xIncr = (int)(((float)deltaX / sceneObject->walkCount) * 65536.0f);
sceneObject->yIncr = (int)(((float)deltaY / sceneObject->walkCount) * 65536.0f);
sceneObject->x = (sceneObject->x & 0xFFFF0000) | 0x8000;
sceneObject->y = (sceneObject->y & 0xFFFF0000) | 0x8000;
} else
sceneObject->walkCount = 0;
}
void BbvsEngine::turnObject(SceneObject *sceneObject) {
if (sceneObject->turnTicks > 0) {
--sceneObject->turnTicks;
} else {
int turnDir = kTurnInfo[sceneObject->turnValue][sceneObject->turnCount & 0x7F];
if (turnDir) {
sceneObject->turnValue = (sceneObject->turnValue + turnDir) & 7;
int turnAnimIndex = sceneObject->sceneObjectDef->animIndices[kWalkTurnTbl[sceneObject->turnValue]];
if (turnAnimIndex) {
Animation *anim = _gameModule->getAnimation(turnAnimIndex);
if (anim) {
sceneObject->anim = anim;
sceneObject->animIndex = turnAnimIndex;
sceneObject->turnTicks = 4;
sceneObject->frameTicks = 1;
sceneObject->frameIndex = anim->frameCount - 1;
}
}
} else {
sceneObject->turnCount = 0;
}
}
}
int BbvsEngine::rectSubtract(const Common::Rect &rect1, const Common::Rect &rect2, Common::Rect *outRects) {
int count = 0;
Common::Rect workRect = rect1.findIntersectingRect(rect2);
if (!workRect.isEmpty()) {
count = 0;
outRects[count] = Common::Rect(rect2.width(), workRect.top - rect2.top);
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, rect2.top);
++count;
}
outRects[count] = Common::Rect(workRect.left - rect2.left, workRect.height());
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, workRect.top);
++count;
}
outRects[count] = Common::Rect(rect2.right - workRect.right, workRect.height());
if (!outRects[count].isEmpty()) {
outRects[count].translate(workRect.right, workRect.top);
++count;
}
outRects[count] = Common::Rect(rect2.width(), rect2.bottom - workRect.bottom);
if (!outRects[count].isEmpty()) {
outRects[count].translate(rect2.left, workRect.bottom);
++count;
}
} else {
outRects[0] = rect2;
count = 1;
}
return count;
}
WalkInfo *BbvsEngine::addWalkInfo(int16 x, int16 y, int delta, int direction, int16 midPtX, int16 midPtY, int walkAreaIndex) {
WalkInfo *walkInfo = &_walkInfos[_walkInfosCount++];
walkInfo->walkAreaIndex = walkAreaIndex;
walkInfo->direction = direction;
walkInfo->x = x;
walkInfo->y = y;
walkInfo->delta = delta;
walkInfo->midPt.x = midPtX;
walkInfo->midPt.y = midPtY;
return walkInfo;
}
void BbvsEngine::initWalkAreas(SceneObject *sceneObject) {
int16 objX = sceneObject->x / 65536;
int16 objY = sceneObject->y / 65536;
Common::Rect rect;
bool doRect = false;
Common::Rect *workWalkableRects;
if (_buttheadObject == sceneObject && _beavisObject->anim) {
rect = _beavisObject->anim->frameRects2[_beavisObject->frameIndex];
rect.translate(_beavisObject->x / 65536, 1 + (_beavisObject->y / 65536));
doRect = !rect.isEmpty();
} else if (_buttheadObject->anim) {
rect = _buttheadObject->anim->frameRects2[_buttheadObject->frameIndex];
rect.translate(_buttheadObject->x / 65536, 1 + (_buttheadObject->y / 65536));
doRect = !rect.isEmpty();
}
workWalkableRects = _walkableRects;
_walkAreasCount = _walkableRectsCount;
if (doRect && !rect.contains(objX, objY)) {
_walkAreasCount = 0;
for (int i = 0; i < _walkableRectsCount; ++i)
_walkAreasCount += rectSubtract(rect, _walkableRects[i], &_tempWalkableRects1[_walkAreasCount]);
workWalkableRects = _tempWalkableRects1;
}
for (int i = 0; i < _walkAreasCount; ++i) {
_walkAreas[i].x = workWalkableRects[i].left;
_walkAreas[i].y = workWalkableRects[i].top;
_walkAreas[i].width = workWalkableRects[i].width();
_walkAreas[i].height = workWalkableRects[i].height();
_walkAreas[i].checked = false;
_walkAreas[i].linksCount = 0;
}
_walkInfosCount = 0;
// Find connections between the walkRects
for (int i = 0; i < _walkAreasCount; ++i) {
WalkArea *walkArea1 = &_walkAreas[i];
int xIter = walkArea1->x + walkArea1->width;
int yIter = walkArea1->y + walkArea1->height;
for (int j = 0; j < _walkAreasCount; ++j) {
WalkArea *walkArea2 = &_walkAreas[j];
if (i == j)
continue;
if (walkArea2->y == yIter) {
int wa1x = MAX(walkArea1->x, walkArea2->x);
int wa2x = MIN(walkArea2->x + walkArea2->width, xIter);
if (wa2x > wa1x) {
debug(5, "WalkArea %d connected to %d by Y", i, j);
WalkInfo *walkInfo1 = addWalkInfo(wa1x, yIter - 1, wa2x - wa1x, 0, wa1x + (wa2x - wa1x) / 2, yIter - 1, i);
WalkInfo *walkInfo2 = addWalkInfo(wa1x, yIter, wa2x - wa1x, 0, wa1x + (wa2x - wa1x) / 2, yIter, j);
walkArea1->linksD1[walkArea1->linksCount] = walkInfo1;
walkArea1->linksD2[walkArea1->linksCount] = walkInfo2;
walkArea1->links[walkArea1->linksCount++] = walkArea2;
walkArea2->linksD1[walkArea2->linksCount] = walkInfo2;
walkArea2->linksD2[walkArea2->linksCount] = walkInfo1;
walkArea2->links[walkArea2->linksCount++] = walkArea1;
}
}
if (walkArea2->x == xIter) {
int wa1y = MAX(walkArea1->y, walkArea2->y);
int wa2y = MIN(walkArea2->y + walkArea2->height, yIter);
if (wa2y > wa1y) {
debug(5, "WalkArea %d connected to %d by X", i, j);
WalkInfo *walkInfo1 = addWalkInfo(xIter - 1, wa1y, wa2y - wa1y, 1, xIter - 1, wa1y + (wa2y - wa1y) / 2, i);
WalkInfo *walkInfo2 = addWalkInfo(xIter, wa1y, wa2y - wa1y, 1, xIter, wa1y + (wa2y - wa1y) / 2, j);
walkArea1->linksD1[walkArea1->linksCount] = walkInfo1;
walkArea1->linksD2[walkArea1->linksCount] = walkInfo2;
walkArea1->links[walkArea1->linksCount++] = walkArea2;
walkArea2->linksD1[walkArea2->linksCount] = walkInfo2;
walkArea2->linksD2[walkArea2->linksCount] = walkInfo1;
walkArea2->links[walkArea2->linksCount++] = walkArea1;
}
}
}
}
}
WalkArea *BbvsEngine::getWalkAreaAtPos(const Common::Point &pt) {
for (int i = 0; i < _walkAreasCount; ++i) {
WalkArea *walkArea = &_walkAreas[i];
if (walkArea->contains(pt))
return walkArea;
}
return nullptr;
}
bool BbvsEngine::canButtheadWalkToDest(const Common::Point &destPt) {
Common::Point srcPt;
_walkReachedDestArea = false;
initWalkAreas(_buttheadObject);
srcPt.x = _buttheadObject->x / 65536;
srcPt.y = _buttheadObject->y / 65536;
_sourceWalkArea = getWalkAreaAtPos(srcPt);
if (_sourceWalkArea) {
_destWalkArea = getWalkAreaAtPos(destPt);
if (_destWalkArea)
canWalkToDest(_sourceWalkArea, 0);
}
return _walkReachedDestArea;
}
void BbvsEngine::canWalkToDest(WalkArea *walkArea, int infoCount) {
if (_destWalkArea == walkArea) {
_walkReachedDestArea = true;
return;
}
if (_gameModule->getFieldC() <= 320 || infoCount <= 20) {
walkArea->checked = true;
for (int linkIndex = 0; linkIndex < walkArea->linksCount; ++linkIndex) {
if (!walkArea->links[linkIndex]->checked) {
canWalkToDest(walkArea->links[linkIndex], infoCount + 2);
if (_walkReachedDestArea)
break;
}
}
walkArea->checked = false;
}
}
bool BbvsEngine::walkTestLineWalkable(const Common::Point &sourcePt, const Common::Point &destPt, WalkInfo *walkInfo) {
const float ptDeltaX = MAX<float>(destPt.x - sourcePt.x, 1.0f);
const float ptDeltaY = destPt.y - sourcePt.y;
const float wDeltaX = walkInfo->x - sourcePt.x;
const float wDeltaY = walkInfo->y - sourcePt.y;
if (walkInfo->direction) {
const float nDeltaY = wDeltaX * ptDeltaY / ptDeltaX + (float)sourcePt.y - (float)walkInfo->y;
return (nDeltaY >= 0.0f) && (nDeltaY < (float)walkInfo->delta);
} else {
const float nDeltaX = wDeltaY / ptDeltaX * ptDeltaY + (float)sourcePt.x - (float)walkInfo->x;
return (nDeltaX >= 0.0f) && (nDeltaX < (float)walkInfo->delta);
}
return false;
}
void BbvsEngine::walkFindPath(WalkArea *sourceWalkArea, int infoCount) {
if (_destWalkArea == sourceWalkArea) {
walkFoundPath(infoCount);
} else if (_gameModule->getFieldC() <= 320 || infoCount <= 20) {
sourceWalkArea->checked = true;
for (int linkIndex = 0; linkIndex < sourceWalkArea->linksCount; ++linkIndex) {
if (!sourceWalkArea->links[linkIndex]->checked) {
_walkInfoPtrs[infoCount + 0] = sourceWalkArea->linksD1[linkIndex];
_walkInfoPtrs[infoCount + 1] = sourceWalkArea->linksD2[linkIndex];
walkFindPath(sourceWalkArea->links[linkIndex], infoCount + 2);
}
}
sourceWalkArea->checked = false;
}
}
int BbvsEngine::calcDistance(const Common::Point &pt1, const Common::Point &pt2) {
return (int)sqrt((double)(pt1.x - pt2.x) * (pt1.x - pt2.x) + (pt1.y - pt2.y) * (pt1.y - pt2.y));
}
void BbvsEngine::walkFoundPath(int count) {
debug(5, "BbvsEngine::walkFoundPath(%d)", count);
Common::Point midPt = _sourceWalkAreaPt;
int totalMidPtDistance = 0;
if (count > 0) {
Common::Point lastMidPt;
int halfCount = (count + 1) >> 1;
for (int i = 0; i < halfCount; ++i) {
lastMidPt = midPt;
midPt = _walkInfoPtrs[i * 2]->midPt;
totalMidPtDistance += calcDistance(midPt, lastMidPt);
}
}
int distance = calcDistance(midPt, _destWalkAreaPt) + totalMidPtDistance;
debug(5, "BbvsEngine::walkFoundPath() distance: %d; _currWalkDistance: %d", distance, _currWalkDistance);
if (distance >= _currWalkDistance)
return;
debug(5, "BbvsEngine::walkFoundPath() distance smaller");
_currWalkDistance = distance;
Common::Point destPt = _destWalkAreaPt, newDestPt;
while (1) {
int index = 0;
if (count > 0) {
do {
if (!walkTestLineWalkable(_sourceWalkAreaPt, destPt, _walkInfoPtrs[index]))
break;
++index;
} while (index < count);
}
if (index == count)
break;
WalkInfo *walkInfo = _walkInfoPtrs[--count];
destPt.x = walkInfo->x;
destPt.y = walkInfo->y;
if (walkInfo->direction) {
newDestPt.x = walkInfo->x;
newDestPt.y = walkInfo->y + walkInfo->delta - 1;
} else {
newDestPt.x = walkInfo->x + walkInfo->delta - 1;
newDestPt.y = walkInfo->y;
}
if ((newDestPt.x - _destWalkAreaPt.x) * (newDestPt.x - _destWalkAreaPt.x) +
(newDestPt.y - _destWalkAreaPt.y) * (newDestPt.y - _destWalkAreaPt.y) <
(destPt.x - _destWalkAreaPt.x) * (destPt.x - _destWalkAreaPt.x) +
(destPt.y - _destWalkAreaPt.y) * (destPt.y - _destWalkAreaPt.y))
destPt = newDestPt;
}
debug(5, "BbvsEngine::walkFoundPath() destPt: (%d, %d)", destPt.x, destPt.y);
_finalWalkPt = destPt;
debug(5, "BbvsEngine::walkFoundPath() OK");
}
void BbvsEngine::updateWalkableRects() {
// Go through all walkable rects and subtract all scene object rects
Common::Rect *rectsList1 = _tempWalkableRects1;
Common::Rect *rectsList2 = _gameModule->getWalkRects();
_walkableRectsCount = _gameModule->getWalkRectsCount();
for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i) {
SceneObject *sceneObject = &_sceneObjects[i];
Animation *anim = sceneObject->anim;
if (anim && _buttheadObject != sceneObject && _beavisObject != sceneObject) {
Common::Rect rect = sceneObject->anim->frameRects2[sceneObject->frameIndex];
rect.translate(sceneObject->x / 65536, sceneObject->y / 65536);
int count = _walkableRectsCount;
_walkableRectsCount = 0;
for (int j = 0; j < count; ++j)
_walkableRectsCount += rectSubtract(rect, rectsList2[j], &rectsList1[_walkableRectsCount]);
if (rectsList1 == _tempWalkableRects1) {
rectsList1 = _tempWalkableRects2;
rectsList2 = _tempWalkableRects1;
} else {
rectsList1 = _tempWalkableRects1;
rectsList2 = _tempWalkableRects2;
}
}
}
for (int i = 0; i < _walkableRectsCount; ++i)
_walkableRects[i] = rectsList2[i];
}
} // End of namespace Bbvs