diff options
-rw-r--r-- | engines/cge/cge_main.cpp | 7 | ||||
-rw-r--r-- | engines/cge/events.cpp | 14 | ||||
-rw-r--r-- | engines/cge/mixer.cpp | 12 | ||||
-rw-r--r-- | engines/cge/mixer.h | 1 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 28 |
5 files changed, 45 insertions, 17 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 4c20f31cac..d35a985d89 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -1579,7 +1579,7 @@ void CGEEngine::runGame() { _vga->_showQ->append(_cavLight); _cavLight->_flags._hide = true; - static Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, + const Seq pocSeq[] = { { 0, 0, 0, 0, 20 }, { 1, 2, 0, 0, 4 }, { 2, 3, 0, 0, 4 }, { 3, 4, 0, 0, 16 }, @@ -1587,7 +1587,10 @@ void CGEEngine::runGame() { { 1, 6, 0, 0, 4 }, { 0, 1, 0, 0, 16 }, }; - _pocLight->setSeq(pocSeq); + Seq *seq = (Seq *)malloc(7 * sizeof(Seq)); + Common::copy(pocSeq, pocSeq + 7, seq); + _pocLight->setSeq(seq); + _pocLight->_flags._tran = true; _pocLight->_time = 1; _pocLight->_z = 120; diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 433f7c6db9..9c1741189f 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -142,11 +142,6 @@ void Keyboard::newKeyboard(Common::Event &event) { /*----------------- MOUSE interface -----------------*/ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0), _vm(vm) { - static Seq ms[] = { - { 0, 0, 0, 0, 1 }, - { 1, 1, 0, 0, 1 } - }; - _hold = NULL; _hx = 0; _hy = 0; @@ -155,7 +150,14 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0) _busy = NULL; _active = false; _flags._kill = false; - setSeq(ms); + + const Seq ms[] = { + { 0, 0, 0, 0, 1 }, + { 1, 1, 0, 0, 1 } + }; + Seq *seq = (Seq *)malloc(2 * sizeof(Seq)); + Common::copy(ms, ms + 2, seq); + setSeq(seq); BMP_PTR *MC = new BMP_PTR[3]; MC[0] = new Bitmap("MOUSE", true); diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index aea033ebc9..0e3a613e60 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -54,18 +54,24 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(MIX_FALL), _ // slaves uint i; + Seq ls[MIX_MAX]; + for (i = 0; i < MIX_MAX; i++) { static char fn[] = "V00"; wtom(i, fn + 1, 10, 2); _lb[i] = new Bitmap(fn, true); - _ls[i]._now = _ls[i]._next = i; - _ls[i]._dx = _ls[i]._dy = _ls[i]._dly = 0; + ls[i]._now = ls[i]._next = i; + ls[i]._dx = ls[i]._dy = ls[i]._dly = 0; } _lb[i] = NULL; for (i = 0; i < ArrayCount(_led); i++) { register Sprite *spr = new Sprite(_vm, _lb); - spr->setSeq(_ls); + + Seq *seq = (Seq *)malloc(MIX_MAX * sizeof(Seq)); + Common::copy(ls, ls + MIX_MAX, seq); + spr->setSeq(seq); + spr->gotoxy(x + 2 + 12 * i, y + 8); spr->_flags._tran = true; spr->_flags._kill = true; diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h index 8ded075514..ef53eec070 100644 --- a/engines/cge/mixer.h +++ b/engines/cge/mixer.h @@ -42,7 +42,6 @@ namespace CGE { class Mixer : public Sprite { BMP_PTR _mb[2]; BMP_PTR _lb[MIX_MAX + 1]; - Seq _ls[MIX_MAX]; Sprite *_led[2]; int _fall; void update(); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 4d8b5bf628..2cdca0004f 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -60,8 +60,24 @@ static VgaRegBlk VideoMode[] = { }; bool SpeedTest = false; -Seq _seq1[] = { { 0, 0, 0, 0, 0 } }; -Seq _seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } }; + +Seq *getConstantSeq(bool seqFlag) { + const Seq seq1[] = { { 0, 0, 0, 0, 0 } }; + const Seq seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } }; + + Seq *seq; + if (seqFlag) { + seq = (Seq *)malloc(1 * sizeof(Seq)); + *seq = seq1[0]; + } else { + seq = (Seq *)malloc(2 * sizeof(Seq)); + seq[0] = seq2[0]; + seq[1] = seq2[1]; + } + + return seq; +} + extern "C" void SNDMIDIPlay(); @@ -405,7 +421,7 @@ BMP_PTR *Sprite::setShapeList(BMP_PTR *shpP) { _ext->_shpList = shpP; _flags._bDel = true; if (!_ext->_seq) - setSeq((_shpCnt < 2) ? _seq1 : _seq2); + setSeq(getConstantSeq(_shpCnt < 2)); } return r; } @@ -590,7 +606,7 @@ Sprite *Sprite::expand() { error("Bad JUMP in SEQ [%s]", fname); setSeq(seq); } else - setSeq((_shpCnt == 1) ? _seq1 : _seq2); + setSeq(getConstantSeq(_shpCnt == 1)); //disable(); // disable interupt setShapeList(shplist); @@ -621,9 +637,11 @@ Sprite *Sprite::contract() { delete e->_shpList[i]; delete[] e->_shpList; } -// free(e->_seq); + + free(e->_seq); free(e->_near); free(e->_take); + delete e; _ext = NULL; } |