diff options
-rw-r--r-- | engines/cge/cge.cpp | 2 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 23 | ||||
-rw-r--r-- | engines/cge/cge_main.h | 1 | ||||
-rw-r--r-- | engines/cge/snail.cpp | 10 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 28 | ||||
-rw-r--r-- | engines/cge/vga13h.h | 11 |
6 files changed, 39 insertions, 36 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 8b3bea3eb5..f28be8b224 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -42,6 +42,8 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _console = new CGEConsole(this); Text = new TEXT(ProgName()); Vga = new VGA(M13H); + Heart = new HEART; + OffUseCount = atoi(Text->getText(OFF_USE_COUNT)); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index c6c6a3961b..3c1cb28b14 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -61,6 +61,9 @@ namespace CGE { extern uint16 _stklen = (STACK_SIZ * 2); +VGA *Vga; +HEART *Heart; + // 0.75 - 17II95 - full sound support // 0.76 - 18II95 - small MiniEMS in DEMO, // unhide CavLight in SNLEVEL @@ -117,7 +120,6 @@ static SPRITE *Sprite = NULL; static SPRITE *MiniCave = NULL; static SPRITE *Shadow = NULL; -VGA *Vga; static EMS *Mini = MiniEmm.Alloc((uint16)MINI_EMM_SIZE); static BMP_PTR *MiniShpList = NULL; static BMP_PTR MiniShp[] = { NULL, NULL }; @@ -582,7 +584,6 @@ static void SaveMapping(void); WALK *Hero = NULL; static INFO_LINE InfoLine = INFO_W; -static HEART Heart; static SPRITE CavLight = PR; @@ -738,7 +739,7 @@ static void CaveUp(void) { if (! Startup) Mouse.On(); - HEART::Enable = true; + Heart->Enable = true; } @@ -779,7 +780,7 @@ static void QGame(void) { void SwitchCave(int cav) { if (cav != Now) { - HEART::Enable = false; + Heart->Enable = false; if (cav < 0) { SNPOST(SNLABEL, -1, 0, NULL); // wait for repaint //TODO Change the SNPOST message send to a special way to send function pointer @@ -1673,7 +1674,7 @@ static void RunGame(void) { } KEYBOARD::SetClient(NULL); - HEART::Enable = false; + Heart->Enable = false; SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); Mouse.Off(); @@ -1691,13 +1692,13 @@ void Movie(const char *ext) { ExpandSprite(Vga->SpareQ->Locate(999)); FeedSnail(Vga->ShowQ->Locate(999), TAKE); Vga->ShowQ->Append(&Mouse); - HEART::Enable = true; + Heart->Enable = true; KEYBOARD::SetClient(Sys); while (! Snail.Idle()) { MainLoop(); } KEYBOARD::SetClient(NULL); - HEART::Enable = false; + Heart->Enable = false; SNPOST(SNCLEAR, -1, 0, NULL); SNPOST_(SNCLEAR, -1, 0, NULL); Vga->ShowQ->Clear(); @@ -1733,12 +1734,12 @@ bool ShowTitle(const char *name) { Vga->CopyPage(1, 2); Vga->CopyPage(0, 1); Vga->ShowQ->Append(&Mouse); - HEART::Enable = true; + Heart->Enable = true; Mouse.On(); for (SelectSound(); ! Snail.Idle() || VMENU::Addr;) MainLoop(); Mouse.Off(); - HEART::Enable = false; + Heart->Enable = false; Vga->ShowQ->Clear(); Vga->CopyPage(0, 2); STARTUP::SoundOk = 2; @@ -1771,10 +1772,10 @@ bool ShowTitle(const char *name) { Vga->CopyPage(0, 1); Vga->ShowQ->Append(&Mouse); //Mouse.On(); - HEART::Enable = true; + Heart->Enable = true; for (TakeName(); GET_TEXT::Ptr;) MainLoop(); - HEART::Enable = false; + Heart->Enable = false; if (KEYBOARD::Last() == Enter && *UsrFnam) usr_ok = true; if (usr_ok) diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index fe50e7bab3..0afdc0f820 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -170,6 +170,7 @@ void ContractSprite(SPRITE *spr); void cge_main(void); extern VGA *Vga; +extern HEART *Heart; extern int OffUseCount; } // End of namespace CGE diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index f40d2bc2fa..afe73b4d24 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -511,16 +511,16 @@ static void SNRTNext(SPRITE *sprel, int p) { static void SNZTrim(SPRITE *spr) { if (spr) if (spr->Active()) { - bool en = HEART::Enable; + bool en = Heart->Enable; SPRITE *s; - HEART::Enable = false; + Heart->Enable = false; s = (spr->Flags.Shad) ? spr->Prev : NULL; Vga->ShowQ->Insert(Vga->ShowQ->Remove(spr)); if (s) { s->Z = spr->Z; Vga->ShowQ->Insert(Vga->ShowQ->Remove(s), spr); } - HEART::Enable = en; + Heart->Enable = en; } } @@ -936,7 +936,7 @@ void SNAIL::RunCom(void) { case SNLABEL : break; case SNPAUSE : - HEART::SetXTimer(&Pause, snc->Val); + Heart->SetXTimer(&Pause, snc->Val); if (Talk) TextDelay = true; break; @@ -944,7 +944,7 @@ void SNAIL::RunCom(void) { if (sprel) { if (sprel->SeqTest(snc->Val) && (snc->Val >= 0 || sprel != Hero || Hero->TracePtr < 0)) { - HEART::SetXTimer(&Pause, sprel->Time); + Heart->SetXTimer(&Pause, sprel->Time); } else goto xit; } diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 54b34105d8..a8a0c5faf0 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -219,12 +219,10 @@ SPRITE *Locate(int ref) { } -bool HEART::Enable = false; -uint16 *HEART::XTimer = NULL; - - HEART::HEART(void) : ENGINE(TMR_DIV) { + Enable = false; + XTimer = NULL; } @@ -235,11 +233,11 @@ extern "C" void TimerProc (void) static uint8 run = 0; // decrement external timer uint16 - if (HEART::XTimer) - if (*HEART::XTimer) -- *HEART::XTimer; - else HEART::XTimer = NULL; + if (Heart->XTimer) + if (*Heart->XTimer) -- *Heart->XTimer; + else Heart->XTimer = NULL; - if (! run && HEART::Enable) // check overrun flag + if (! run && Heart->Enable) // check overrun flag { static uint16 oldSP, oldSS; @@ -299,11 +297,11 @@ void ENGINE::NewTimer(...) { my_int: //------72Hz-------// // decrement external timer uint16 - if (HEART::XTimer) - if (*HEART::XTimer) -- *HEART::XTimer; - else HEART::XTimer = NULL; + if (Heart->XTimer) + if (*Heart->XTimer) -- *Heart->XTimer; + else Heart->XTimer = NULL; - if (! run && HEART::Enable) // check overrun flag + if (! run && Heart->Enable) // check overrun flag { static uint16 oldSP, oldSS; @@ -473,8 +471,8 @@ void SPRITE::SetName(char *n) { SPRITE *SPRITE::Expand(void) { if (! Ext) { - bool enbl = HEART::Enable; - HEART::Enable = false; + bool enbl = Heart->Enable; + Heart->Enable = false; if ((Ext = new SPREXT) == NULL) error("No core"); if (*File) { @@ -596,7 +594,7 @@ SPRITE *SPRITE::Expand(void) { else TakePtr = NO_PTR; } - HEART::Enable = enbl; + Heart->Enable = enbl; } return this; } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index b467b0405f..63886d9a99 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -131,11 +131,12 @@ extern SEQ Seq2[]; class HEART : public ENGINE { friend class ENGINE; public: - static bool Enable; - static uint16 *XTimer; - static void SetXTimer(uint16 *ptr); - static void SetXTimer(uint16 *ptr, uint16 time); - HEART(void); + HEART(); + + bool Enable; + uint16 *XTimer; + void SetXTimer(uint16 *ptr); + void SetXTimer(uint16 *ptr, uint16 time); }; |