aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/op_cmd.cpp32
-rw-r--r--engines/agi/opcodes.cpp12
-rw-r--r--engines/agi/opcodes.h3
-rw-r--r--engines/agi/sound.cpp16
-rw-r--r--engines/agi/sprite.cpp4
5 files changed, 54 insertions, 13 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 80b150d2d6..17addc0c05 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -153,15 +153,27 @@ void cmdToggle(AgiGame *state, uint8 *p) {
}
void cmdSetV(AgiGame *state, uint8 *p) {
- setflag(_v[p0], true);
+ if (getVersion() < 0x2000) {
+ _v[p0] = 1;
+ } else {
+ setflag(_v[p0], true);
+ }
}
void cmdResetV(AgiGame *state, uint8 *p) {
- setflag(_v[p0], false);
+ if (getVersion() < 0x2000) {
+ _v[p0] = 0;
+ } else {
+ setflag(_v[p0], false);
+ }
}
void cmdToggleV(AgiGame *state, uint8 *p) {
- setflag(_v[p0], !getflag(_v[p0]));
+ if (getVersion() < 0x2000) {
+ _v[p0] ^= 1;
+ } else {
+ setflag(_v[p0], !getflag(_v[p0]));
+ }
}
void cmdNewRoom(AgiGame *state, uint8 *p) {
@@ -804,6 +816,10 @@ void cmdLoadPic(AgiGame *state, uint8 *p) {
state->_vm->_sprites->commitBoth();
}
+void cmdLoadPicV1(AgiGame *state, uint8 *p) {
+ state->_vm->agiLoadResource(rPICTURE, _v[p0]);
+}
+
void cmdDiscardPic(AgiGame *state, uint8 *p) {
debugC(6, kDebugLevelScripts, "--- discard pic ---");
// do nothing
@@ -1026,6 +1042,10 @@ void cmdAddToPic(AgiGame *state, uint8 *p) {
state->_vm->_sprites->addToPic(p0, p1, p2, p3, p4, p5, p6);
}
+void cmdAddToPicV1(AgiGame *state, uint8 *p) {
+ state->_vm->_sprites->addToPic(p0, p1, p2, p3, p4, p5, -1);
+}
+
void cmdAddToPicF(AgiGame *state, uint8 *p) {
state->_vm->_sprites->addToPic(_v[p0], _v[p1], _v[p2], _v[p3], _v[p4], _v[p5], _v[p6]);
}
@@ -1337,6 +1357,11 @@ void cmdQuit(AgiGame *state, uint8 *p) {
}
}
+void cmdQuitV1(AgiGame *state, uint8 *p) {
+ state->_vm->_sound->stopSound();
+ state->_vm->quitGame();
+}
+
void cmdRestartGame(AgiGame *state, uint8 *p) {
const char *buttons[] = { "Restart", "Continue", NULL };
int sel;
@@ -1677,6 +1702,7 @@ void cmdSetSpeed(AgiGame *state, uint8 *p) {
// V1 command
(void)state;
(void)p;
+ // speed = _v[p0];
}
void cmdSetItemView(AgiGame *state, uint8 *p) {
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 5571d5c67c..c2cecefc52 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -99,22 +99,22 @@ AgiInstruction insV1[] = {
{ "player.control", "", &cmdPlayerControl }, // 2F
{ "set.priority", "nn", &cmdSetPriority }, // 30
{ "release.priority", "n", &cmdReleasePriority }, // 31
- { "add.to.pic", "nnnnnn", &cmdAddToPic }, // 32 TODO: 7 vs 8 args
+ { "add.to.pic", "nnnnnn", &cmdAddToPicV1 }, // 32
{ "set.horizon", "n", &cmdSetHorizon }, // 33
{ "ignore.horizon", "n", &cmdIgnoreHorizon }, // 34
{ "observe.horizon", "n", &cmdObserveHorizon }, // 35
- { "load.logics", "n", &cmdLoadLogic }, // 36
+ { "load.logics", "n", &cmdLoadLogic }, // 36 TODO
{ "object.on.water", "n", &cmdObjectOnWater }, // 37
- { "load.pic", "v", &cmdLoadPic }, // 38
+ { "load.pic", "v", &cmdLoadPicV1 }, // 38
{ "load.sound", "n", &cmdLoadSound }, // 39
{ "sound", "nn", &cmdSound }, // 3A
{ "stop.sound", "", &cmdStopSound }, // 3B
{ "set.v", "v", &cmdSetV }, // 3C
{ "reset.v", "v", &cmdResetV }, // 3D
{ "toggle.v", "v", &cmdToggleV }, // 3E
- { "new.room.v", "v", &cmdNewRoomVV1 }, // 3F
- { "call", "n", &cmdCallV1 }, // 40
- { "...", "", &cmdUnknown }, // 41
+ { "new.room.v", "v", &cmdNewRoomVV1 }, // 3F TODO
+ { "call", "n", &cmdCallV1 }, // 40 TODO
+ { "quit", "", &cmdQuitV1 }, // 41
{ "set.speed", "v", &cmdSetSpeed }, // 42
{ "move.obj.v", "nvvvv", &cmdMoveObjF }, // 43
{ "...", "nn", &cmdUnknown }, // 44
diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h
index afc617478b..7f0f287550 100644
--- a/engines/agi/opcodes.h
+++ b/engines/agi/opcodes.h
@@ -62,6 +62,7 @@ void cmdLoadLogicF(AgiGame *state, uint8 *p);
void cmdCall(AgiGame *state, uint8 *p);
void cmdCallF(AgiGame *state, uint8 *p);
void cmdLoadPic(AgiGame *state, uint8 *p); // 0x18
+void cmdLoadPicV1(AgiGame *state, uint8 *p);
void cmdDrawPic(AgiGame *state, uint8 *p);
void cmdDrawPicV1(AgiGame *state, uint8 *p);
void cmdShowPic(AgiGame *state, uint8 *p);
@@ -169,6 +170,7 @@ void cmdPreventInput(AgiGame *state, uint8 *p);
void cmdAcceptInput(AgiGame *state, uint8 *p); // 0x78
void cmdSetKey(AgiGame *state, uint8 *p);
void cmdAddToPic(AgiGame *state, uint8 *p);
+void cmdAddToPicV1(AgiGame *state, uint8 *p);
void cmdAddToPicF(AgiGame *state, uint8 *p);
void cmdStatus(AgiGame *state, uint8 *p);
void cmdSaveGame(AgiGame *state, uint8 *p);
@@ -182,6 +184,7 @@ void cmdProgramControl(AgiGame *state, uint8 *p);
void cmdPlayerControl(AgiGame *state, uint8 *p);
void cmdObjStatusF(AgiGame *state, uint8 *p);
void cmdQuit(AgiGame *state, uint8 *p);
+void cmdQuitV1(AgiGame *state, uint8 *p);
void cmdShowMem(AgiGame *state, uint8 *p);
void cmdPause(AgiGame *state, uint8 *p); // 0x88
void cmdEchoLine(AgiGame *state, uint8 *p);
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 2a776d8914..ca3d799ecc 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -136,7 +136,12 @@ void SoundMgr::startSound(int resnum, int flag) {
// Reset the flag
_endflag = flag;
- _vm->setflag(_endflag, false);
+
+ if (_vm->getVersion() < 0x2000) {
+ _vm->_game.vars[_endflag] = 0;
+ } else {
+ _vm->setflag(_endflag, false);
+ }
}
void SoundMgr::stopSound() {
@@ -151,8 +156,13 @@ void SoundMgr::stopSound() {
// This is probably not needed most of the time, but there also should
// not be any harm doing it, so do it anyway.
- if (_endflag != -1)
- _vm->setflag(_endflag, true);
+ if (_endflag != -1) {
+ if (_vm->getVersion() < 0x2000) {
+ _vm->_game.vars[_endflag] = 1;
+ } else {
+ _vm->setflag(_endflag, true);
+ }
+ }
_endflag = -1;
}
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index cb081065de..cec0895073 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -604,7 +604,9 @@ void SpritesMgr::addToPic(int view, int loop, int cel, int x, int y, int pri, in
// If margin is 0, 1, 2, or 3, the base of the cel is
// surrounded with a rectangle of the corresponding priority.
// If margin >= 4, this extra margin is not shown.
- if (mar < 4) {
+ //
+ // -1 indicates ignore and is set for V1
+ if (mar < 4 && mar != -1) {
// add rectangle around object, don't clobber control
// info in priority data. The box extends to the end of
// its priority band!