aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/cge.cpp2
-rw-r--r--engines/cge/cge.h7
-rw-r--r--engines/cge/general.cpp33
-rw-r--r--engines/cge/general.h9
-rw-r--r--engines/cge/snail.cpp127
-rw-r--r--engines/cge/vga13h.cpp140
-rw-r--r--engines/cge/vga13h.h8
7 files changed, 71 insertions, 255 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 435a552bb4..168f45e45b 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -138,6 +138,8 @@ void CGEEngine::setup() {
_mode = 0;
_soundOk = 0;
+ _sprTv = NULL;
+ _gameCase2Cpt = 0;
_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 6d2842c613..835c47cb6e 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -107,7 +107,6 @@ public:
int _pocref[kPocketNX];
uint8 _volume[2];
int _maxCaveArr[5];
-
int _maxCave;
bool _flag[4];
bool _dark;
@@ -117,6 +116,12 @@ public:
char _usrFnam[15];
int _mode;
int _soundOk;
+ int _gameCase2Cpt;
+
+ Sprite *_sprTv;
+ Sprite *_sprK1;
+ Sprite *_sprK2;
+ Sprite *_sprK3;
Common::RandomSource _randomSource;
byte * _mini;
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 101c6cdd17..1947fc6061 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -331,39 +331,6 @@ int new_random(int range) {
return ((CGEEngine *)g_engine)->_randomSource.getRandomNumber(range - 1);
}
-//void interrupt (* Engine_::oldTimer) (...) = NULL;
-
-Engine_::Engine_(uint16 tdiv) {
-/*
- // steal timer interrupt
- OldTimer = getvect(TIMER_INT);
- setvect(TIMER_INT, NewTimer);
-
- // set turbo-timer mode
- asm mov al,0x36
- asm out 0x43,al
- asm mov ax,TMR_DIV
- asm out 0x40,al
- asm mov al,ah
- asm out 0x40,al
-*/
- warning("STUB: Engine_::Engine_");
-}
-
-Engine_::~Engine_() {
-/*
- // reset timer
- asm mov al,0x36
- asm out 0x43,al
- asm xor al,al
- asm out 0x40,al
- asm out 0x40,al
- // bring back timer interrupt
- setvect(TIMER_INT, OldTimer);
-*/
- warning("STUB: Engine_::~Engine_");
-}
-
DataCk::~DataCk() {
if (!_e && _buf)
free(_buf);
diff --git a/engines/cge/general.h b/engines/cge/general.h
index e340c962bd..d55193d85c 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -49,15 +49,6 @@ struct Dac {
typedef uint16 CRYPT(void *buf, uint16 siz, uint16 seed);
-class Engine_ {
-protected:
- static void (* oldTimer)(...);
- static void newTimer(...);
-public:
- Engine_(uint16 tdiv);
- ~Engine_();
-};
-
template <class T>
void swap(T &A, T &B) {
T a = A;
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index d1978ef845..aa37922b70 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -134,60 +134,55 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_snail->addCom(kSnSay, buref, 16008, NULL); // zgadnij!
_game = true;
}
-#undef STEPS
-#undef DRESSED
}
break;
//--------------------------------------------------------------------
case 2 : {
- static Sprite *k = NULL, * k1, * k2, * k3;
- static int count = 0;
-
- if (k == NULL) {
- k = _vga->_showQ->locate(20700);
- k1 = _vga->_showQ->locate(20701);
- k2 = _vga->_showQ->locate(20702);
- k3 = _vga->_showQ->locate(20703);
+ if (_sprTv == NULL) {
+ _sprTv = _vga->_showQ->locate(20700);
+ _sprK1 = _vga->_showQ->locate(20701);
+ _sprK2 = _vga->_showQ->locate(20702);
+ _sprK3 = _vga->_showQ->locate(20703);
}
if (!_game) { // init
_snail->addCom(kSnGame, 20002, 2, NULL);
_game = true;
} else { // cont
- k1->step(new_random(6));
- k2->step(new_random(6));
- k3->step(new_random(6));
+ _sprK1->step(new_random(6));
+ _sprK2->step(new_random(6));
+ _sprK3->step(new_random(6));
///--------------------
if (spr->_ref == 1 && _keyboard->_key[ALT]) {
- k1->step(5);
- k2->step(5);
- k3->step(5);
+ _sprK1->step(5);
+ _sprK2->step(5);
+ _sprK3->step(5);
}
///--------------------
_snail->addCom(kSnSetZ, 20700, 0, NULL);
- bool hit = (k1->_seqPtr + k2->_seqPtr + k3->_seqPtr == 15);
+ bool hit = (_sprK1->_seqPtr + _sprK2->_seqPtr + _sprK3->_seqPtr == 15);
if (hit) {
if (spr->_ref == 1) {
- _snail->addCom(kSnSay, 1, 20003, NULL); // hura!
- _snail->addCom(kSnSeq, 20011, 2, NULL); // kamera won
- _snail->addCom(kSnSend, 20701, -1, NULL); // k1 won
- _snail->addCom(kSnSend, 20702, -1, NULL); // k2 won
- _snail->addCom(kSnSend, 20703, -1, NULL); // k3 won
- _snail->addCom(kSnSend, 20700, -1, NULL); // tv won
- _snail->addCom(kSnKeep, 20007, 0, NULL); // do kieszeni
- _snail->addCom(kSnSend, 20006, 20, NULL); // bilon
+ _snail->addCom(kSnSay, 1, 20003, NULL); // hura!
+ _snail->addCom(kSnSeq, 20011, 2, NULL); // kamera won
+ _snail->addCom(kSnSend, 20701, -1, NULL); // k1 won
+ _snail->addCom(kSnSend, 20702, -1, NULL); // k2 won
+ _snail->addCom(kSnSend, 20703, -1, NULL); // k3 won
+ _snail->addCom(kSnSend, 20700, -1, NULL); // tv won
+ _snail->addCom(kSnKeep, 20007, 0, NULL); // do kieszeni
+ _snail->addCom(kSnSend, 20006, 20, NULL); // bilon
_snail->addCom(kSnSound, 20006, 20002, NULL); // bilon!
- _snail->addCom(kSnSay, 20002, 20004, NULL);
- _snail->addCom(kSnSend, 20010, 20, NULL); // papier
+ _snail->addCom(kSnSay, 20002, 20004, NULL);
+ _snail->addCom(kSnSend, 20010, 20, NULL); // papier
_snail->addCom(kSnSound, 20010, 20003, NULL); // papier!
- _snail->addCom(kSnSay, 20001, 20005, NULL);
+ _snail->addCom(kSnSay, 20001, 20005, NULL);
_game = false;
return;
} else
- k3->step(new_random(5));
+ _sprK3->step(new_random(5));
}
- if (count < 100) {
- switch (count) {
+ if (_gameCase2Cpt < 100) {
+ switch (_gameCase2Cpt) {
case 15 :
_snail->addCom(kSnSay, 20003, 20021, NULL);
break;
@@ -198,51 +193,51 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_snail->addCom(kSnSay, 20003, 20022, NULL);
break;
}
- count++;
+ _gameCase2Cpt++;
}
switch (spr->_ref) {
case 1 :
- _snail->addCom(kSnSay, 20001, 20011, NULL); // zapro
- _snail->addCom(kSnSeq, 20001, 1, NULL); // rzuŤ
- _snail->addCom(kSnWait, 20001, 1, NULL); // czekaj
- _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
- _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
- _snail->addCom(kSnWait, 20001, 16, NULL); // czekaj
- _snail->addCom(kSnSeq, 20007, 1, NULL); // lec†
- _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
+ _snail->addCom(kSnSay, 20001, 20011, NULL); // zapro
+ _snail->addCom(kSnSeq, 20001, 1, NULL); // rzuŤ
+ _snail->addCom(kSnWait, 20001, 1, NULL); // czekaj
+ _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
+ _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
+ _snail->addCom(kSnWait, 20001, 16, NULL); // czekaj
+ _snail->addCom(kSnSeq, 20007, 1, NULL); // lec†
+ _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
_snail->addCom(kSnSound, 20007, 20001, NULL); // grzech
- _snail->addCom(kSnWait, 20007, -1, NULL); // koniec
- _snail->addCom(kSnGame, 20001, 2, NULL); // again!
+ _snail->addCom(kSnWait, 20007, -1, NULL); // koniec
+ _snail->addCom(kSnGame, 20001, 2, NULL); // again!
break;
case 20001:
- _snail->addCom(kSnSay, 20002, 20012, NULL); // zapro
- _snail->addCom(kSnSeq, 20002, 1, NULL); // rzuŤ
- _snail->addCom(kSnWait, 20002, 3, NULL); // czekaj
- _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
- _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
- _snail->addCom(kSnWait, 20002, 10, NULL); // czekaj
- _snail->addCom(kSnSeq, 20007, 2, NULL); // lec†
- _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
+ _snail->addCom(kSnSay, 20002, 20012, NULL); // zapro
+ _snail->addCom(kSnSeq, 20002, 1, NULL); // rzuŤ
+ _snail->addCom(kSnWait, 20002, 3, NULL); // czekaj
+ _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
+ _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
+ _snail->addCom(kSnWait, 20002, 10, NULL); // czekaj
+ _snail->addCom(kSnSeq, 20007, 2, NULL); // lec†
+ _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
_snail->addCom(kSnSound, 20007, 20001, NULL); // grzech
- _snail->addCom(kSnWait, 20007, -1, NULL); // koniec
- _snail->addCom(kSnGame, 20002, 2, NULL); // again!
+ _snail->addCom(kSnWait, 20007, -1, NULL); // koniec
+ _snail->addCom(kSnGame, 20002, 2, NULL); // again!
break;
case 20002:
- _snail->addCom(kSnSay, 20002, 20010, NULL); // zapro
- _snail->addCom(kSnWalk, 20005, -1, NULL); // do stol
- _snail->addCom(kSnWait, 1, -1, NULL); // stoi
- _snail->addCom(kSnCover, 1, 20101, NULL); // grasol
- _snail->addCom(kSnSeq, 20101, 1, NULL); // rzuŤ
- _snail->addCom(kSnWait, 20101, 5, NULL); // czekaj
- _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
- _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
- _snail->addCom(kSnWait, 20101, 15, NULL); // czekaj
- _snail->addCom(kSnSeq, 20007, 1, NULL); // lec†
- _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
+ _snail->addCom(kSnSay, 20002, 20010, NULL); // zapro
+ _snail->addCom(kSnWalk, 20005, -1, NULL); // do stol
+ _snail->addCom(kSnWait, 1, -1, NULL); // stoi
+ _snail->addCom(kSnCover, 1, 20101, NULL); // grasol
+ _snail->addCom(kSnSeq, 20101, 1, NULL); // rzuŤ
+ _snail->addCom(kSnWait, 20101, 5, NULL); // czekaj
+ _snail->addCom(kSnSetZ, 20700, 2, NULL); // skryj k
+ _snail->addCom(kSnHide, 20007, 1, NULL); // skryj k
+ _snail->addCom(kSnWait, 20101, 15, NULL); // czekaj
+ _snail->addCom(kSnSeq, 20007, 1, NULL); // lec†
+ _snail->addCom(kSnHide, 20007, 0, NULL); // poka§
_snail->addCom(kSnSound, 20007, 20001, NULL); // grzech
- _snail->addCom(kSnWait, 20101, -1, NULL); // koniec
- _snail->addCom(kSnUncover, 1, 20101, NULL); // SDS
- _snail->addCom(kSnGame, 1, 2, NULL); // again!
+ _snail->addCom(kSnWait, 20101, -1, NULL); // koniec
+ _snail->addCom(kSnUncover, 1, 20101, NULL); // SDS
+ _snail->addCom(kSnGame, 1, 2, NULL); // again!
break;
}
}
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 7e1d8f9962..6e14666bd9 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -212,148 +212,10 @@ Sprite *locate(int ref) {
}
-Heart::Heart()
- : Engine_(TMR_DIV) {
+Heart::Heart() {
_enable = false;
- _xTimer = NULL;
}
-
-/*
-extern "C" void TimerProc() {
- static SPRITE * spr;
- static uint8 run = 0;
-
- // decrement external timer uint16
- if (_heart->_xTimer) {
- if (*_heart->_xTimer)
- *_heart->_xTimer--;
- else
- _heart->_xTimer = NULL;
- }
-
- if (!run && _heart->_enable) { // check overrun flag
- static uint16 oldSP, oldSS;
- run++; // disable 2nd call until current lasts
- asm mov ax,ds
- asm mov oldSS,ss
- asm mov oldSP,sp
- asm mov ss,ax
- asm mov sp,0xFF80
-
- // system pseudo-sprite
- if (Sys) {
- if (Sys->Time) {
- if (--Sys->Time == 0)
- Sys->tick();
- }
- }
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
- if (spr->Time) {
- if (!spr->_flags.Hide) {
- if (-- spr->Time == 0)
- spr->tick();
- }
- }
- }
- asm mov ss,oldSS
- asm mov sp,oldSP
- run--;
- }
-}
-*/
-
-
-void Engine_::newTimer(...) {
- /*
- static SPRITE *spr;
- static uint8 run = 0, cntr1 = TMR_RATE1, cntr2 = TMR_RATE2;
- ___1152_Hz___:
-
- SNDMIDIPlay();
- asm dec cntr1
- asm jz ___72_Hz___
- asm mov al,0x20 // send...
- asm out 0x020,al // ...e-o-i
- return;
-
- ___72_Hz___:
-
- asm mov cntr1,TMR_RATE1
- asm dec cntr2
- asm jnz my_eoi
-
- ___18_Hz___:
-
- OldTimer();
- asm mov cntr2,TMR_RATE2
- asm jmp short my_int
-
- // send E-O-I
- my_eoi:
- asm mov al,0x20
- asm out 0x020,al
- asm sti // enable interrupts
-
- my_int: //------72Hz-------//
-
- // decrement external timer uint16
- if (_heart->XTimer) {
- if (*_heart->XTimer)
- *_heart->XTimer--;
- else
- _heart->XTimer = NULL;
- }
-
- if (! run && _heart->Enable) { // check overrun flag
- static uint16 oldSP, oldSS;
-
- run++; // disable 2nd call until current lasts
- asm mov ax,ds
- asm mov oldSS,ss
- asm mov oldSP,sp
- asm mov ss,ax
- asm mov sp,0xFF80
-
- // system pseudo-sprite
- if (Sys) {
- if (Sys->Time) {
- if (--Sys->Time == 0)
- Sys->tick();
- }
- }
-
- for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) {
- if (spr->Time) {
- if (!spr->_flags.Hide) {
- if (--spr->Time == 0)
- spr->tick();
- }
- }
- }
- asm mov ss,oldSS
- asm mov sp,oldSP
- run--;
- }
-
- */
- warning("STUB: Engine_::NewTimer");
-}
-
-
-void Heart::setXTimer(uint16 *ptr) {
- if (_xTimer && ptr != _xTimer)
- *_xTimer = 0;
- _xTimer = ptr;
-}
-
-
-void Heart::setXTimer(uint16 *ptr, uint16 time) {
- setXTimer(ptr);
- *ptr = time;
-}
-
-
Sprite::Sprite(CGEEngine *vm, BMP_PTR *shpP)
: _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0),
_next(NULL), _prev(NULL), _seqPtr(NO_SEQ), _time(0), //Delay(0),
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index f192d962ff..535c7005d2 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -117,16 +117,10 @@ extern Seq _seq2[];
#define VGAST1 (VGAST1_ & 0xFF)
-class Heart : public Engine_ {
- friend class Engine_;
+class Heart {
public:
Heart();
-
bool _enable;
- uint16 *_xTimer;
-
- void setXTimer(uint16 *ptr);
- void setXTimer(uint16 *ptr, uint16 time);
};