Skip to content

Commit

Permalink
ACCESS: Tweaks to mWhileDoOpen and fixes to pan method
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 13, 2014
1 parent 1d70d61 commit 1d60368
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
3 changes: 2 additions & 1 deletion engines/access/amazon/amazon_resources.cpp
Expand Up @@ -1524,7 +1524,7 @@ const int TORCH[12] = {

const int SPEAR[3] = {30, -13, 1};

const int openObj[10][4] = {
const int OPENING_OBJS[10][4] = {
{8, -80, 120, 30},
{13, 229, 0, 50},
{12, 78, 0, 50},
Expand Down Expand Up @@ -1746,4 +1746,5 @@ const byte *RIVEROBJECTTBL[6] = {
};

} // End of namespace Amazon

} // End of namespace Access
3 changes: 2 additions & 1 deletion engines/access/amazon/amazon_resources.h
Expand Up @@ -82,7 +82,7 @@ extern const int TORCH[12];

extern const int SPEAR[3];

extern const int openObj[10][4];
extern const int OPENING_OBJS[10][4];

extern const byte MAP0[26];
extern const byte MAP1[27];
Expand All @@ -98,6 +98,7 @@ extern const byte RIVER2OBJECTS[530];
extern const byte ENDRIVER2[10];

extern const byte *RIVEROBJECTTBL[6];

} // End of namespace Amazon

} // End of namespace Access
Expand Down
30 changes: 18 additions & 12 deletions engines/access/amazon/amazon_scripts.cpp
Expand Up @@ -425,17 +425,20 @@ void AmazonScripts::pan() {
for (int i = 0; i < _pNumObj; i++) {
_pObjZ[i] += _zTrack;
_pObjXl[i] += (_pObjZ[i] * tx) & 0xff;
_pObjX[i] += (_pObjZ[i] * tx) >> 8;
_pObjX[i] += (_pObjZ[i] * tx) >> 8 + (_pObjXl[i] >> 8);
_pObjXl[i] &= 0xff;

_pObjYl[i] += (_pObjZ[i] * ty) & 0xff;
_pObjY[i] += (_pObjZ[i] * ty) >> 8;
_pObjY[i] += (_pObjZ[i] * ty) >> 8 + (_pObjYl[i] >> 8);
_pObjYl[i] &= 0xff;
}
}

for (int i = 0; i < _pNumObj; i++) {
ImageEntry ie;
ie._flags= 8;
ie._position = Common::Point(_pObjX[i], _pObjY[i]);
ie._offsetY = 0xFF;
ie._offsetY = 255;
ie._spritesPtr = _pObject[i];
ie._frameNumber = _pImgNum[i];

Expand Down Expand Up @@ -666,16 +669,16 @@ void AmazonScripts::mWhileDoOpen() {
screen.forceFadeOut();
_game->_skipStart = false;
if (_vm->_conversation != 2) {
// Cutscene at start of chapter 1
screen.setPanel(3);
_game->startChapter(1);
_game->establishCenter(0, 1);
}

Resource *data = _vm->_files->loadFile(1, 0);
SpriteResource *spr = new SpriteResource(_vm, data);
_vm->_objectsTable[1] = new SpriteResource(_vm, data);
delete data;

_vm->_objectsTable[1] = spr;
_vm->_files->_setPaletteFlag = false;
_vm->_files->loadScreen(1, 2);
_vm->_buffer2.copyFrom(*_vm->_screen);
Expand All @@ -698,10 +701,10 @@ void AmazonScripts::mWhileDoOpen() {

for (int i = 0; i < _pNumObj; i++) {
_pObject[i] = _vm->_objectsTable[1];
_pImgNum[i] = openObj[i][0];
_pObjX[i] = openObj[i][1];
_pObjY[i] = openObj[i][2];
_pObjZ[i] = openObj[i][3];
_pImgNum[i] = OPENING_OBJS[i][0];
_pObjX[i] = OPENING_OBJS[i][1];
_pObjY[i] = OPENING_OBJS[i][2];
_pObjZ[i] = OPENING_OBJS[i][3];
_pObjXl[i] = _pObjYl[i] = 0;
}

Expand All @@ -727,11 +730,14 @@ void AmazonScripts::mWhileDoOpen() {
startFl = true;
screen.forceFadeIn();
}
events.pollEvents();
warning("TODO: check on KEYBUFCNT");
if (events._leftButton || events._rightButton) {

events.pollEvents();
if (events._leftButton || events._rightButton || events._keypresses.size() > 0) {
_game->_skipStart = true;
_vm->_sound->newMusic(10, 1);

events.debounceLeft();
events.zeroKeys();
break;
}

Expand Down

0 comments on commit 1d60368

Please sign in to comment.