mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 07:07:10 +00:00
AVALANCHE: Implement ShootEmUp::instructions().
Also implement connected functions and add fundamental parts to ShootEmUp::run() during the process.
This commit is contained in:
parent
f8cea0ebea
commit
5829615820
@ -594,15 +594,8 @@ Graphics::Surface GraphicManager::ghostLoadPicture(Common::File &file, Common::P
|
||||
coord.y = cb._y;
|
||||
|
||||
Graphics::Surface picture = loadPictureGraphic(file);
|
||||
|
||||
int bytesPerRow = (picture.w / 8);
|
||||
if ((picture.w % 8) > 0)
|
||||
bytesPerRow += 1;
|
||||
int loadedBytes = picture.h * bytesPerRow * 4 + 4;
|
||||
// * 4 is for the four planes, + 4 is for the reading of the width and the height at loadPictureGraphic's beginning.
|
||||
|
||||
int bytesToSkip = cb._size - loadedBytes;
|
||||
file.skip(bytesToSkip);
|
||||
skipDifference(cb._size, picture, file);
|
||||
|
||||
return picture;
|
||||
}
|
||||
@ -730,6 +723,51 @@ void GraphicManager::seuDrawTitle() {
|
||||
file.close();
|
||||
}
|
||||
|
||||
void GraphicManager::seuLoad() {
|
||||
Common::File file;
|
||||
|
||||
if (!file.open("notts.avd"))
|
||||
error("AVALANCHE: ShootEmUp: File not found: notts.avd");
|
||||
|
||||
for (int i = 0; i < 99; i++) {
|
||||
int size = file.readUint16LE();
|
||||
_seuPictures[i] = loadPictureGraphic(file);
|
||||
skipDifference(size, _seuPictures[i], file);
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void GraphicManager::seuFree() {
|
||||
for (int i = 0; i < 99; i++)
|
||||
_seuPictures[i].free();
|
||||
}
|
||||
|
||||
/**
|
||||
* @remarks Originally called 'display'
|
||||
*/
|
||||
void GraphicManager::seuDrawPicture(int x, int y, byte which) {
|
||||
drawPicture(_surface, _seuPictures[which], x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for skipping the difference between a stored 'size' value associated with a picture
|
||||
* and the actual size of the pictures when reading them from files for Ghostroom and Shoot em' up.
|
||||
* It's needed bacuse the original code loaded the pictures to arrays first and only used the useful parts
|
||||
* of these arrays when drawing the images, but in the ScummVM version, we only read the
|
||||
* useful parts from the files, so we have to skip these differences between readings.
|
||||
*/
|
||||
void GraphicManager::skipDifference(int size, const Graphics::Surface &picture, Common::File &file) {
|
||||
int bytesPerRow = (picture.w / 8);
|
||||
if ((picture.w % 8) > 0)
|
||||
bytesPerRow += 1;
|
||||
int loadedBytes = picture.h * bytesPerRow * 4 + 4;
|
||||
// * 4 is for the four planes, + 4 is for the reading of the width and the height at loadPictureGraphic's beginning.
|
||||
|
||||
int bytesToSkip = size - loadedBytes;
|
||||
file.skip(bytesToSkip);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function mimics Pascal's getimage().
|
||||
*/
|
||||
|
@ -109,6 +109,9 @@ public:
|
||||
|
||||
// Shoot em' up's functions:
|
||||
void seuDrawTitle();
|
||||
void seuLoad();
|
||||
void seuFree();
|
||||
void seuDrawPicture(int x, int y, byte which);
|
||||
|
||||
void clearAlso();
|
||||
void clearTextBar();
|
||||
@ -163,10 +166,15 @@ private:
|
||||
Graphics::Surface _nimInitials[3];
|
||||
Graphics::Surface _nimLogo;
|
||||
|
||||
// For the mini-game "Shoot em' up".
|
||||
Graphics::Surface _seuPictures[99];
|
||||
|
||||
byte _egaPalette[64][3];
|
||||
|
||||
AvalancheEngine *_vm;
|
||||
|
||||
void skipDifference(int size, const Graphics::Surface &picture, Common::File &file);
|
||||
|
||||
// Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data
|
||||
Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data.
|
||||
Graphics::Surface loadPictureSign(Common::File &file, int xl, int yl); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
|
||||
|
@ -32,6 +32,9 @@
|
||||
|
||||
namespace Avalanche {
|
||||
|
||||
const byte ShootEmUp::kFacingRight = 87;
|
||||
const byte ShootEmUp::kStocks = 27;
|
||||
|
||||
ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
|
||||
_vm = vm;
|
||||
|
||||
@ -39,7 +42,25 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
|
||||
}
|
||||
|
||||
void ShootEmUp::run() {
|
||||
CursorMan.showMouse(false);
|
||||
_vm->_graphics->saveScreen();
|
||||
_vm->fadeOut();
|
||||
_vm->_graphics->seuDrawTitle();
|
||||
_vm->fadeIn();
|
||||
|
||||
_vm->_graphics->seuLoad();
|
||||
|
||||
// Should we show the instructions?
|
||||
while (!_vm->shouldQuit()) {
|
||||
Common::Event event;
|
||||
_vm->getEvent(event);
|
||||
if (event.type == Common::EVENT_KEYDOWN) {
|
||||
if ((event.kbd.keycode == Common::KEYCODE_i) || (event.kbd.keycode == Common::KEYCODE_F1))
|
||||
instructions();
|
||||
break; // We don't show the instructions and simply go on with the minigame if not I or F1 was pressed.
|
||||
}
|
||||
}
|
||||
|
||||
setup();
|
||||
initRunner(20, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2);
|
||||
initRunner(600, 70, 48, 54, _vm->_rnd->getRandomNumber(4) + 1, _vm->_rnd->getRandomNumber(3) - 2);
|
||||
@ -60,6 +81,12 @@ void ShootEmUp::run() {
|
||||
check321();
|
||||
readKbd();
|
||||
} while (_time != 0);
|
||||
|
||||
_vm->fadeOut();
|
||||
_vm->_graphics->restoreScreen();
|
||||
_vm->_graphics->removeBackup();
|
||||
_vm->fadeIn();
|
||||
CursorMan.showMouse(true);
|
||||
}
|
||||
|
||||
bool ShootEmUp::overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y) {
|
||||
@ -113,11 +140,58 @@ void ShootEmUp::newEscape() {
|
||||
}
|
||||
|
||||
void ShootEmUp::nextPage() {
|
||||
warning("STUB: ShootEmUp::nextPage()");
|
||||
_vm->_graphics->drawNormalText("Press a key for next page >", _vm->_font, 8, 400, 190, kColorWhite);
|
||||
_vm->_graphics->refreshScreen();
|
||||
|
||||
while (!_vm->shouldQuit()) {
|
||||
Common::Event event;
|
||||
_vm->getEvent(event);
|
||||
if (event.type == Common::EVENT_KEYDOWN) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack);
|
||||
}
|
||||
|
||||
void ShootEmUp::instructions() {
|
||||
warning("STUB: ShootEmUp::instructions()");
|
||||
_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen.
|
||||
_vm->_graphics->seuDrawPicture(25, 25, kFacingRight);
|
||||
_vm->_graphics->drawNormalText("< Avvy, our hero, needs your help - you must move him around.", _vm->_font, 8, 60, 35, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("(He''s too terrified to move himself!)", _vm->_font, 8, 80, 45, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("Your task is to prevent the people in the stocks from escaping", _vm->_font, 8, 0, 75, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("by pelting them with rotten fruit, eggs and bread. The keys are:", _vm->_font, 8, 0, 85, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("LEFT SHIFT", _vm->_font, 8, 80, 115, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("Move left.", _vm->_font, 8, 200, 115, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("RIGHT SHIFT", _vm->_font, 8, 72, 135, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("Move right.", _vm->_font, 8, 200, 135, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("ALT", _vm->_font, 8, 136, 155, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("Throw something.", _vm->_font, 8, 200, 155, kColorWhite);
|
||||
|
||||
nextPage();
|
||||
|
||||
_vm->_graphics->seuDrawPicture(25, 35, kStocks);
|
||||
_vm->_graphics->drawNormalText("This man is in the stocks. Your job is to stop him getting out.", _vm->_font, 8, 80, 35, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("UNFORTUNATELY... the locks on the stocks are loose, and every", _vm->_font, 8, 88, 45, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("so often, someone will discover this and try to get out.", _vm->_font, 8, 88, 55, kColorWhite);
|
||||
_vm->_graphics->seuDrawPicture(25, 85, kStocks + 2);
|
||||
_vm->_graphics->drawNormalText("< Someone who has found a way out!", _vm->_font, 8, 80, 85, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("You MUST IMMEDIATELY hit people smiling like this, or they", _vm->_font, 8, 88, 95, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("will disappear and lose you points.", _vm->_font, 8, 88, 105, kColorWhite);
|
||||
_vm->_graphics->seuDrawPicture(25, 125, kStocks + 5);
|
||||
_vm->_graphics->seuDrawPicture(25, 155, kStocks + 4);
|
||||
_vm->_graphics->drawNormalText("< Oh dear!", _vm->_font, 8, 80, 125, kColorWhite);
|
||||
|
||||
nextPage();
|
||||
|
||||
_vm->_graphics->drawNormalText("Your task is made harder by:", _vm->_font, 8, 0, 35, kColorWhite);
|
||||
_vm->_graphics->seuDrawPicture(25, 55, 48);
|
||||
_vm->_graphics->drawNormalText("< Yokels. These people will run in front of you. If you hit", _vm->_font, 8, 60, 55, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("them, you will lose MORE points than you get hitting people", _vm->_font, 8, 68, 65, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("in the stocks. So BEWARE!", _vm->_font, 8, 68, 75, kColorWhite);
|
||||
_vm->_graphics->drawNormalText("Good luck with the game!", _vm->_font, 8, 80, 125, kColorWhite);
|
||||
|
||||
nextPage();
|
||||
}
|
||||
|
||||
void ShootEmUp::setup() {
|
||||
|
@ -38,6 +38,9 @@ public:
|
||||
void run();
|
||||
|
||||
private:
|
||||
static const byte kFacingRight;
|
||||
static const byte kStocks;
|
||||
|
||||
AvalancheEngine *_vm;
|
||||
|
||||
byte _time;
|
||||
|
Loading…
Reference in New Issue
Block a user