ACCESS: Implement mWhile2 and plotInactive, change _inactive from Resource* to ImageEntry

This commit is contained in:
Strangerke 2014-09-16 22:04:10 +02:00
parent d37534fa9b
commit 9accfdab6f
7 changed files with 109 additions and 11 deletions

View File

@ -55,7 +55,9 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_mouseMode = 0;
_currentMan = 0;
_currentManOld = -1;
_inactive = nullptr;
_inactive._spritesPtr = nullptr;
_inactive._flags = _inactive._frameNumber = _inactive._offsetY = 0;
_inactive._position = Common::Point(0, 0);
_music = nullptr;
_title = nullptr;
_converseMode = 0;
@ -127,7 +129,7 @@ AccessEngine::~AccessEngine() {
delete _video;
freeCells();
delete _inactive;
delete _inactive._spritesPtr;
delete _music;
delete _title;
delete _eseg;
@ -212,8 +214,8 @@ void AccessEngine::freeCells() {
}
void AccessEngine::freeInactiveData() {
delete _inactive;
_inactive = nullptr;
delete _inactive._spritesPtr;
_inactive._spritesPtr = nullptr;
}
void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr) {

View File

@ -171,7 +171,7 @@ public:
int _mouseMode;
int _currentManOld;
Resource *_inactive;
ImageEntry _inactive;
Resource *_music;
Resource *_title;
int _converseMode;

View File

@ -65,7 +65,6 @@ private:
int _topList;
int _botList;
int _riverIndex;
int _inactiveYOff;
int _esTabTable[100];
// Other fields
@ -116,6 +115,7 @@ public:
int _rawInactiveX;
int _rawInactiveY;
int _inactiveYOff;
// Fields that are mapped to flags
int &_guardLocation;

View File

@ -77,7 +77,9 @@ void AmazonRoom::reloadRoom() {
void AmazonRoom::reloadRoom1() {
if (_vm->_player->_roomNumber == 29 || _vm->_player->_roomNumber == 31
|| _vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44) {
_vm->_inactive = _vm->_files->loadFile("MAYA.LZ");
Resource *spriteData = _vm->_files->loadFile("MAYA.LZ");
_vm->_inactive._spritesPtr = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_currentCharFlag = false;
}

View File

@ -153,10 +153,62 @@ void AmazonScripts::mWhile1() {
} while (_vm->_flags[52] == 4);
}
void AmazonScripts::mWhile2() {
_vm->_screen->setDisplayScan();
_vm->_screen->fadeOut();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 0);
_vm->_buffer2.copyFrom(*_vm->_screen);
_vm->_buffer1.copyFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_screen->forceFadeIn();
Resource *spriteData = _vm->_files->loadFile(14, 6);
_vm->_objectsTable[0] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2100;
do {
cLoop();
_sequence = 2100;
} while (_vm->_flags[52] == 1);
_vm->_screen->fadeOut();
_vm->freeCells();
spriteData = _vm->_files->loadFile(14, 9);
_vm->_objectsTable[3] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_screen->setDisplayScan();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 3);
_vm->_screen->setPalette();
_vm->_buffer2.copyFrom(*_vm->_screen);
_vm->_buffer1.copyFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2400;
do {
cLoop();
_sequence = 2400;
} while (_vm->_flags[52] == 4);
}
void AmazonScripts::mWhile(int param1) {
switch(param1) {
case 1:
warning("TODO MWHILE1");
mWhile1();
break;
case 2:
warning("TODO FLY");
@ -174,7 +226,7 @@ void AmazonScripts::mWhile(int param1) {
warning("TODO DOWNRIVER");
break;
case 7:
warning("TODO MWHILE2");
mWhile2();
break;
case 8:
warning("TODO JWALK2");
@ -212,6 +264,44 @@ void AmazonScripts::boatWalls(int param1, int param2) {
}
}
void AmazonScripts::plotInactive() {
if (_game->_charSegSwitch) {
_game->_currentCharFlag = true;
SpriteResource *tmp = _vm->_inactive._spritesPtr;
_vm->_inactive._spritesPtr = _vm->_player->_playerSprites;
_vm->_player->_playerSprites = tmp;
_game->_charSegSwitch = false;
} else if (_game->_jasMayaFlag != _game->_currentCharFlag) {
if (_vm->_player->_playerOff) {
_game->_jasMayaFlag = _game->_currentCharFlag;
} else {
_game->_currentCharFlag = _game->_jasMayaFlag;
int tmpX = _game->_rawInactiveX;
int tmpY = _game->_rawInactiveY;
_game->_rawInactiveX = _vm->_player->_rawPlayer.x;
_game->_rawInactiveY = _vm->_player->_rawPlayer.y;
_vm->_player->_rawPlayer.x = tmpX;
_vm->_player->_rawPlayer.y = tmpY;
_game->_inactiveYOff = _vm->_player->_playerOffset.y;
_vm->_player->calcManScale();
}
}
if (_vm->_player->_roomNumber == 44) {
warning("CHECKME: Only sets useless(?) flags 155 and 160");
}
_vm->_inactive._flags &= 0xFD;
_vm->_inactive._flags &= 0xF7;
_vm->_inactive._position.x = _game->_rawInactiveX;
_vm->_inactive._position.y = _game->_rawInactiveY - _game->_inactiveYOff;
_vm->_inactive._offsetY = _game->_inactiveYOff;
_vm->_inactive._frameNumber = 0;
_vm->_images.addToList(&_vm->_inactive);
}
void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
switch (commandIndex) {
case 1:
@ -236,7 +326,7 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
warning("TODO NEWMUSIC");
break;
case 11:
warning("TODO PLOTINACTIVE");
plotInactive();
break;
case 13:
warning("TODO RIVER");

View File

@ -41,8 +41,10 @@ protected:
void cLoop();
void mWhile1();
void mWhile2();
void mWhile(int param1);
void loadBackground(int param1, int param2);
void plotInactive();
void setInactive();
void boatWalls(int param1, int param2);

View File

@ -75,7 +75,9 @@ void MartianRoom::reloadRoom() {
void MartianRoom::reloadRoom1() {
if (_vm->_player->_roomNumber == 29 || _vm->_player->_roomNumber == 31
|| _vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44) {
_vm->_inactive = _vm->_files->loadFile("MAYA.LZ");
Resource *spriteData = _vm->_files->loadFile("MAYA.LZ");
_vm->_inactive._spritesPtr = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_currentCharFlag = false;
}