CGE2: Allow Triggering of Carpet Workaround from Debug Console.

This allows the recovery of saved games with the dead-end condition from
bug Trac #6842.
This commit is contained in:
D G Turner 2018-10-09 18:10:40 +01:00
parent f39a9b5563
commit 110a1e3df5
2 changed files with 21 additions and 1 deletions

View file

@ -22,12 +22,27 @@
#include "cge2/console.h"
#include "cge2/vga13h.h"
namespace CGE2 {
CGE2Console::CGE2Console(CGE2Engine *vm) : GUI::Debugger() {
CGE2Console::CGE2Console(CGE2Engine *vm) : _vm(vm), GUI::Debugger() {
registerCmd("do_carpet_workaround", WRAP_METHOD(CGE2Console, doCarpetWorkaround));
}
CGE2Console::~CGE2Console() {
}
bool CGE2Console::doCarpetWorkaround(int argc, const char **argv) {
Sprite *spr = _vm->_vga->_showQ->locate(1537); // 1537 is Carpet
if (spr) {
if (spr->_actionCtrl[1]._ptr == 26) {
spr->_actionCtrl[1]._ptr = 8;
}
}
return true;
}
} // End of namespace CGE

View file

@ -33,6 +33,11 @@ class CGE2Console : public GUI::Debugger {
public:
CGE2Console(CGE2Engine *vm);
virtual ~CGE2Console();
private:
bool doCarpetWorkaround(int argc, const char **argv);
CGE2Engine *_vm;
};
} // End of namespace CGE