diff options
author | Eugene Sandulenko | 2015-11-24 23:59:30 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:43 +0100 |
commit | 93e3ba9eddc7c50db7f6475305a24cd30f2893fa (patch) | |
tree | 661451d4f14f17929633926d07b2bfb8e7159b90 /engines | |
parent | 4b65faaa632d309f02f6c25d38d9b6afc0648cbd (diff) | |
download | scummvm-rg350-93e3ba9eddc7c50db7f6475305a24cd30f2893fa.tar.gz scummvm-rg350-93e3ba9eddc7c50db7f6475305a24cd30f2893fa.tar.bz2 scummvm-rg350-93e3ba9eddc7c50db7f6475305a24cd30f2893fa.zip |
LAB: Put vga.cpp into LabEngine class
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/engine.cpp | 66 | ||||
-rw-r--r-- | engines/lab/graphics.cpp | 99 | ||||
-rw-r--r-- | engines/lab/interface.cpp | 16 | ||||
-rw-r--r-- | engines/lab/interface.h | 1 | ||||
-rw-r--r-- | engines/lab/intro.cpp | 26 | ||||
-rw-r--r-- | engines/lab/lab.cpp | 14 | ||||
-rw-r--r-- | engines/lab/lab.h | 74 | ||||
-rw-r--r-- | engines/lab/labfun.h | 2 | ||||
-rw-r--r-- | engines/lab/labmusic.cpp | 3 | ||||
-rw-r--r-- | engines/lab/map.cpp | 101 | ||||
-rw-r--r-- | engines/lab/mouse.cpp | 36 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 33 | ||||
-rw-r--r-- | engines/lab/readdiff.cpp | 25 | ||||
-rw-r--r-- | engines/lab/special.cpp | 84 | ||||
-rw-r--r-- | engines/lab/text.cpp | 3 | ||||
-rw-r--r-- | engines/lab/timing.cpp | 1 | ||||
-rw-r--r-- | engines/lab/vga.cpp | 68 | ||||
-rw-r--r-- | engines/lab/vga.h | 74 |
18 files changed, 343 insertions, 383 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index c706dca110..18178d3972 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/intro.h" #include "lab/parsefun.h" @@ -132,7 +131,7 @@ static char initcolors[] = { '\x00', '\x00', '\x00', '\x30', /******************************************************************************/ /* Draws the control panel display. */ /******************************************************************************/ -void drawPanel() { +void LabEngine::drawPanel() { mouseHide(); setAPen(3); /* Clear Area */ @@ -219,7 +218,7 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) { /******************************************************************************/ /* Sets up the Labyrinth screens, and opens up the initial windows. */ /******************************************************************************/ -bool setUpScreens() { +bool LabEngine::setUpScreens() { uint16 counter; byte *buffer; byte *MovePanelBuffer, *InvPanelBuffer; @@ -349,7 +348,7 @@ bool setUpScreens() { /******************************************************************************/ /* Permanently flips the imagry of a gadget. */ /******************************************************************************/ -static void perFlipGadget(uint16 GadID) { +void LabEngine::perFlipGadget(uint16 GadID) { Image *Temp; Gadget *TopGad; @@ -391,7 +390,7 @@ void eatMessages() { /******************************************************************************/ /* Checks whether the close up is one of the special case closeups. */ /******************************************************************************/ -static bool doCloseUp(CloseDataPtr cptr) { +bool LabEngine::doCloseUp(CloseDataPtr cptr) { if (cptr == NULL) return false; @@ -527,8 +526,7 @@ static const char *Test; /******************************************************************************/ /* If the user hits the "Use" gadget; things that can get used on themselves. */ /******************************************************************************/ -static bool doUse(uint16 CurInv) { - +bool LabEngine::doUse(uint16 CurInv) { if (CurInv == MAPNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseMap); interfaceOff(); @@ -539,9 +537,7 @@ static bool doUse(uint16 CurInv) { VGASetPal(initcolors, 8); drawMessage(NULL); drawPanel(); - } - - else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ + } else if (CurInv == JOURNALNUM) { /* LAB: Labyrinth specific */ drawStaticMessage(kTextUseJournal); interfaceOff(); stopDiff(); @@ -550,17 +546,15 @@ static bool doUse(uint16 CurInv) { doJournal(); drawPanel(); drawMessage(NULL); - } - - else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ + } else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */ interfaceOff(); - if (g_lab->_conditions->in(LAMPON)) { + if (_conditions->in(LAMPON)) { drawStaticMessage(kTextTurnLampOff); - g_lab->_conditions->exclElement(LAMPON); + _conditions->exclElement(LAMPON); } else { drawStaticMessage(kTextTurnLampOn); - g_lab->_conditions->inclElement(LAMPON); + _conditions->inclElement(LAMPON); } DoBlack = false; @@ -570,32 +564,22 @@ static bool doUse(uint16 CurInv) { DoBlack = false; Test = getInvName(CurInv); - } - - else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ - if (!g_lab->_conditions->in(BELTGLOW)) - g_lab->_conditions->inclElement(BELTGLOW); + } else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */ + if (!_conditions->in(BELTGLOW)) + _conditions->inclElement(BELTGLOW); DoBlack = false; Test = getInvName(CurInv); - } - - else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseWhiskey); - } - - else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUsePith); - } - - else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ - g_lab->_conditions->inclElement(USEDHELMET); + } else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */ + _conditions->inclElement(USEDHELMET); drawStaticMessage(kTextUseHelmet); - } - - else + } else return false; return true; @@ -651,7 +635,7 @@ static void decIncInv(uint16 *CurInv, bool dec) { /******************************************************************************/ /* The main game loop */ /******************************************************************************/ -static void mainGameLoop() { +void LabEngine::mainGameLoop() { IntuiMessage *Msg; uint32 Class; @@ -1474,8 +1458,8 @@ byte dropCrumbsOff[] = { 0x00 }; Image DropCrumbsImage = { 24, 24, dropCrumbs }; Image DropCrumbsOffImage = { 24, 24, dropCrumbsOff }; -void mayShowCrumbIndicator() { - if (g_lab->getPlatform() != Common::kPlatformWindows) +void LabEngine::mayShowCrumbIndicator() { + if (getPlatform() != Common::kPlatformWindows) return; if (DroppingCrumbs && MainDisplay) { @@ -1485,8 +1469,8 @@ void mayShowCrumbIndicator() { } } -void mayShowCrumbIndicatorOff() { - if (g_lab->getPlatform() != Common::kPlatformWindows) +void LabEngine::mayShowCrumbIndicatorOff() { + if (getPlatform() != Common::kPlatformWindows) return; if (MainDisplay) { diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 62963137bb..b21c4f6e33 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -35,7 +35,6 @@ #include "lab/labfun.h" #include "lab/parsefun.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/resource.h" @@ -242,14 +241,14 @@ uint32 flowText(void *font, /* the TextAttr pointer */ uint16 x, y; if (fillback) { - setAPen(backpen); - rectFill(x1, y1, x2, y2); + g_lab->setAPen(backpen); + g_lab->rectFill(x1, y1, x2, y2); } if (str == NULL) return 0L; - setAPen(pencolor); + g_lab->setAPen(pencolor); fontheight = textHeight(msgfont) + spacing; numlines = (y2 - y1 + 1) / fontheight; @@ -289,10 +288,6 @@ uint32 flowText(void *font, /* the TextAttr pointer */ return (str - temp); } - -extern byte *_currentDsplayBuffer; - - /******************************************************************************/ /* Calls flowText, but flows it to memory. Same restrictions as flowText. */ /******************************************************************************/ @@ -307,15 +302,15 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint32 res, vgabyte = g_lab->_screenBytesPerPage; - byte *tmp = _currentDsplayBuffer; + byte *tmp = g_lab->_currentDsplayBuffer; - _currentDsplayBuffer = DestIm->ImageData; + g_lab->_currentDsplayBuffer = DestIm->ImageData; g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); g_lab->_screenBytesPerPage = vgabyte; - _currentDsplayBuffer = tmp; + g_lab->_currentDsplayBuffer = tmp; return res; } @@ -328,14 +323,14 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ void createBox(uint16 y2) { - setAPen(7); /* Message box area */ - rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); - - setAPen(0); /* Box around message area */ - drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); - drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); - drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); - drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); + g_lab->setAPen(7); /* Message box area */ + g_lab->rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2)); + + g_lab->setAPen(0); /* Box around message area */ + g_lab->drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317)); + g_lab->drawVLine(VGAScaleX(317), VGAScaleY(152), VGAScaleY(y2)); + g_lab->drawHLine(VGAScaleX(2), VGAScaleY(y2), VGAScaleX(317)); + g_lab->drawVLine(VGAScaleX(2), VGAScaleY(152), VGAScaleY(y2)); } @@ -355,8 +350,8 @@ int32 longDrawMessage(const char *str) { if (!LongWinInFront) { LongWinInFront = true; - setAPen(3); /* Clear Area */ - rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); + g_lab->setAPen(3); /* Clear Area */ + g_lab->rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); } createBox(198); @@ -387,7 +382,7 @@ void drawMessage(const char *str) { } else { if (LongWinInFront) { LongWinInFront = false; - drawPanel(); + g_lab->drawPanel(); } mouseHide(); @@ -434,10 +429,10 @@ static void doScrollBlack() { Im.Height = height; Im.ImageData = mem; g_music->updateMusic(); - readScreenImage(&Im, 0, 0); + g_lab->readScreenImage(&Im, 0, 0); g_music->updateMusic(); - BaseAddr = (uint32 *) getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); by = VGAScaleX(4); nheight = height; @@ -446,9 +441,9 @@ static void doScrollBlack() { g_music->updateMusic(); if (!IsHiRes) - waitTOF(); + g_lab->waitTOF(); - BaseAddr = (uint32 *) getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); if (by > nheight) by = nheight; @@ -470,10 +465,10 @@ static void doScrollBlack() { tempmem += copysize; } - setAPen(0); - rectFill(0, nheight, width - 1, nheight + by - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, nheight, width - 1, nheight + by - 1); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); if (!IsHiRes) { if (nheight <= (height / 8)) @@ -503,7 +498,7 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli uint16 CurPage; uint32 *BaseAddr; - BaseAddr = (uint32 *)getVGABaseAddr(); + BaseAddr = (uint32 *)g_lab->getVGABaseAddr(); size = (int32)(height - nheight) * (int32) width; mem += startline * width; @@ -539,12 +534,12 @@ static void doScrollWipe(char *filename) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } IsBM = true; readPict(filename, true); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsBM = false; mem = RawDiffBM.Planes[0]; @@ -566,7 +561,7 @@ static void doScrollWipe(char *filename) { copyPage(width, height, nheight, startline, mem); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); if (!nheight) startline += by; @@ -618,8 +613,8 @@ static void doScrollBounce() { startline -= newby[counter]; copyPage(width, height, 0, startline, mem); - WSDL_UpdateScreen(); - waitTOF(); + g_lab->WSDL_UpdateScreen(); + g_lab->waitTOF(); } for (int counter = 8; counter > 0; counter--) { @@ -627,8 +622,8 @@ static void doScrollBounce() { startline += newby1[counter - 1]; copyPage(width, height, 0, startline, mem); - WSDL_UpdateScreen(); - waitTOF(); + g_lab->WSDL_UpdateScreen(); + g_lab->waitTOF(); } @@ -658,17 +653,17 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } } - setAPen(0); + g_lab->setAPen(0); for (counter = 0; counter < 2; counter++) { CurY = counter * 2; @@ -676,11 +671,11 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -694,7 +689,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { CurFileName = getPictName(CPtr); byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); if (BitMapMem) { ImSource.Width = g_lab->_screenWidth; @@ -703,7 +698,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.Width = g_lab->_screenWidth; ImDest.Height = g_lab->_screenHeight; - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); for (counter = 0; counter < 2; counter++) { CurY = counter * 2; @@ -711,14 +706,14 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY < LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); - ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + g_lab->ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -730,16 +725,16 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { while (CurY <= LastY) { if (linesdone >= lineslast) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); linesdone = 0; } - ImDest.ImageData = getVGABaseAddr(); + ImDest.ImageData = g_lab->getVGABaseAddr(); if (CurY == LastY) - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); else - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + g_lab->bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); CurY += 4; linesdone++; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 1cd017d434..54a7e13499 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -28,11 +28,11 @@ * */ +#include "lab/lab.h" #include "lab/labfun.h" #include "lab/stddefines.h" #include "lab/interface.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "common/util.h" namespace Lab { @@ -82,7 +82,7 @@ void freeButtonList(Gadget *gptrlist) { /*****************************************************************************/ void drawGadgetList(Gadget *gadlist) { while (gadlist) { - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); if (GADGETOFF & gadlist->GadgetFlags) ghoastGadget(gadlist, 1); @@ -96,7 +96,7 @@ void drawGadgetList(Gadget *gadlist) { /* Ghoasts a gadget, and makes it unavailable for using. */ /*****************************************************************************/ void ghoastGadget(Gadget *curgad, uint16 pencolor) { - ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); + g_lab->ghoastRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->Im->Width - 1, curgad->y + curgad->Im->Height - 1); curgad->GadgetFlags |= GADGETOFF; } @@ -106,7 +106,7 @@ void ghoastGadget(Gadget *curgad, uint16 pencolor) { /* Unghoasts a gadget, and makes it available again. */ /*****************************************************************************/ void unGhoastGadget(Gadget *curgad) { - drawImage(curgad->Im, curgad->x, curgad->y); + g_lab->drawImage(curgad->Im, curgad->x, curgad->y); curgad->GadgetFlags &= !(GADGETOFF); } @@ -133,11 +133,11 @@ static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { (gadlist->KeyEquiv != 0 && makeGadgetKeyEquiv(key) == gadlist->KeyEquiv)) && !(GADGETOFF & gadlist->GadgetFlags)) { mouseHide(); - drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); g_system->delayMillis(80); mouseHide(); - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); return gadlist; @@ -155,8 +155,8 @@ static Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key) { /* Checks whether or not a key has been pressed. */ /*****************************************************************************/ static bool keyPress(uint16 *KeyCode) { - if (WSDL_HasNextChar()) { - *KeyCode = WSDL_GetNextChar(); + if (g_lab->WSDL_HasNextChar()) { + *KeyCode = g_lab->WSDL_GetNextChar(); return true; } diff --git a/engines/lab/interface.h b/engines/lab/interface.h index 84df28c767..524c4ff437 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -28,7 +28,6 @@ * */ -#include "lab/vga.h" #include "common/keyboard.h" #ifndef LAB_INTEFACE_H diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 85c64c44b6..feb4905824 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -115,8 +115,8 @@ void Intro::doPictText(const char *filename, bool isscreen) { fade(false, 0); if (isscreen) { - setAPen(7L); - rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); + g_lab->setAPen(7L); + g_lab->rectFill(VGAScaleX(10), VGAScaleY(10), VGAScaleX(310), VGAScaleY(190)); Drawn = flowText(_msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace); fade(true, 0); @@ -161,7 +161,7 @@ void Intro::doPictText(const char *filename, bool isscreen) { } } - waitTOF(); + g_lab->waitTOF(); } else { cls = msg->msgClass; qualifier = msg->qualifier; @@ -226,9 +226,9 @@ void Intro::musicDelay() { for (counter = 0; counter < 20; counter++) { g_music->updateMusic(); - waitTOF(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } } @@ -318,7 +318,7 @@ void Intro::introSequence() { palette[15] = temp; setAmigaPal(palette, 16); - waitTOF(); + g_lab->waitTOF(); } fade(false, 0); @@ -404,10 +404,10 @@ void Intro::introSequence() { diffcmap[counter1] = 255 - diffcmap[counter1]; g_music->updateMusic(); - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab-> waitTOF(); + g_lab->waitTOF(); } doPictText("i.12", false); @@ -464,8 +464,8 @@ void Intro::introSequence() { nReadPict("SubX", true); if (_quitIntro) { - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); DoBlack = true; } } diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index c6f8006a55..fcd826b366 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -59,6 +59,20 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _screenHeight = 200; _screenBytesPerPage = 65536; + _curapen = 0; + + _currentDsplayBuffer = 0; + _displayBuffer = 0; + + _lastWaitTOFTicks = 0; + + _mouseX = 0; + _mouseY = 0; + + _nextKeyIn = 0; + _nextKeyOut = 0; + _mouseAtEdge = false; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index e9d27aea39..36e2a43455 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -45,6 +45,12 @@ enum GameFeatures { GF_WINDOWS_TRIAL = 1 << 1 }; +struct Image { + uint16 Width; + uint16 Height; + byte *ImageData; +}; + #define ONESECOND 1000 class LabEngine : public Engine { @@ -83,6 +89,74 @@ private: // timing.cpp void microDelay(uint32 secs, uint32 micros); + + // vga.cpp + byte _curvgapal[256 * 3]; + byte _curapen; + +public: + byte *_currentDsplayBuffer; + + uint32 _mouseX; + uint32 _mouseY; + +private: + byte *_displayBuffer; + + int _lastWaitTOFTicks; + + uint16 _nextKeyIn; + uint16 _keyBuf[64]; + uint16 _nextKeyOut; + bool _mouseAtEdge; +public: + byte *_tempScrollData; + +private: + bool createScreen(bool HiRes); + +public: + void waitTOF(); + void setAPen(uint16 pennum); + void writeColorRegs(byte *buf, uint16 first, uint16 numreg); + byte *getVGABaseAddr(); + void readScreenImage(Image *Im, uint16 x, uint16 y); + void WSDL_UpdateScreen(); + void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); + void VGASetPal(void *cmap, uint16 numcolors); + void drawHLine(uint16 x, uint16 y1, uint16 y2); + void drawVLine(uint16 x1, uint16 y, uint16 x2); + void drawImage(Image *Im, uint16 x, uint16 y); + bool WSDL_HasNextChar(); + uint16 WSDL_GetNextChar(); + void WSDL_ProcessInput(bool can_delay); + void writeColorReg(byte *buf, uint16 regnum); + void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); + + void drawPanel(); + +private: + void quickWaitTOF(); + + /*---------- Drawing Routines ----------*/ + + void drawMaskImage(Image *Im, uint16 x, uint16 y); + void WSDL_GetMousePos(int *x, int *y); + void changeVolume(int delta); + void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow); + + // engine.cpp + bool setUpScreens(); + void perFlipGadget(uint16 gadID); + bool doCloseUp(CloseDataPtr cptr); + void mainGameLoop(); + bool doUse(uint16 curInv); + void mayShowCrumbIndicator(); + void mayShowCrumbIndicatorOff(); }; extern LabEngine *g_lab; diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index 5fac2e1157..1d2b5c640d 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -122,8 +122,6 @@ void gadgetsOnOff(void *gptr, void *win, int32 num, bool on); /*----------------------*/ void eatMessages(); -bool setUpScreens(); -void drawPanel(); bool quitPlaying(); /*---------------------------*/ diff --git a/engines/lab/labmusic.cpp b/engines/lab/labmusic.cpp index 50ba48dbb8..ed45bfa759 100644 --- a/engines/lab/labmusic.cpp +++ b/engines/lab/labmusic.cpp @@ -33,7 +33,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/lab.h" namespace Lab { @@ -72,7 +71,7 @@ Music::Music() { /* it from the Audio device. */ /*****************************************************************************/ void Music::updateMusic() { - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); updateMouse(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 4ad9ba2511..fdec095f1a 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/parsefun.h" @@ -70,7 +69,7 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { vgapal[vgacount++] = (byte)(((pal[counter] & 0x00f)) << 2); } - writeColorRegsSmooth(vgapal, 0, 16); + g_lab->writeColorRegsSmooth(vgapal, 0, 16); } void decrypt(byte *text) { @@ -310,7 +309,7 @@ void fade(bool fadein, uint16 res) { } setAmigaPal(newpal, 16); - waitTOF(); + g_lab->waitTOF(); g_music->updateMusic(); } } @@ -371,27 +370,27 @@ static void drawRoom(uint16 CurRoom, bool drawx) { case UPARROWROOM: case DOWNARROWROOM: if (Maps[CurRoom].SpecialID == NORMAL) - drawImage(Room, x, y); + g_lab->drawImage(Room, x, y); else if (Maps[CurRoom].SpecialID == DOWNARROWROOM) - drawImage(DownArrowRoom, x, y); + g_lab->drawImage(DownArrowRoom, x, y); else - drawImage(UpArrowRoom, x, y); + g_lab->drawImage(UpArrowRoom, x, y); offset = (Room->Width - Path->Width) / 2; if ((NORTHDOOR & flags) && (y >= Path->Height)) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + Room->Height); + g_lab->drawImage(Path, x + offset, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + Room->Width, y + offset); + g_lab->drawImage(Path, x + Room->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); xx = x + (Room->Width - XMark->Width) / 2; xy = y + (Room->Height - XMark->Height) / 2; @@ -399,7 +398,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case BRIDGEROOM: - drawImage(Bridge, x, y); + g_lab->drawImage(Bridge, x, y); xx = x + (Bridge->Width - XMark->Width) / 2; xy = y + (Bridge->Height - XMark->Height) / 2; @@ -407,37 +406,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case VCORRIDOR: - drawImage(VRoom, x, y); + g_lab->drawImage(VRoom, x, y); offset = (VRoom->Width - Path->Width) / 2; if (NORTHDOOR & flags) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + VRoom->Height); + g_lab->drawImage(Path, x + offset, y + VRoom->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + VRoom->Width, y + offset); + g_lab->drawImage(Path, x + VRoom->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); if (EASTBDOOR & flags) - drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTBDOOR & flags) - drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); offset = (VRoom->Height - Path->Height) / 2; if (EASTMDOOR & flags) - drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x + VRoom->Width, y - offset - Path->Height + VRoom->Height); if (WESTMDOOR & flags) - drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); + g_lab->drawImage(Path, x - Path->Width, y - offset - Path->Height + VRoom->Height); xx = x + (VRoom->Width - XMark->Width) / 2; xy = y + (VRoom->Height - XMark->Height) / 2; @@ -445,37 +444,37 @@ static void drawRoom(uint16 CurRoom, bool drawx) { break; case HCORRIDOR: - drawImage(HRoom, x, y); + g_lab->drawImage(HRoom, x, y); offset = (Room->Width - Path->Width) / 2; if (NORTHDOOR & flags) - drawImage(Path, x + offset, y - Path->Height); + g_lab->drawImage(Path, x + offset, y - Path->Height); if (SOUTHDOOR & flags) - drawImage(Path, x + offset, y + Room->Height); + g_lab->drawImage(Path, x + offset, y + Room->Height); if (NORTHRDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHRDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (HRoom->Width - Path->Width) / 2; if (NORTHMDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y - Path->Height); if (SOUTHMDOOR & flags) - drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); + g_lab->drawImage(Path, x - offset - Path->Width + HRoom->Width, y + Room->Height); offset = (Room->Height - Path->Height) / 2; if (EASTDOOR & flags) - drawImage(Path, x + HRoom->Width, y + offset); + g_lab->drawImage(Path, x + HRoom->Width, y + offset); if (WESTDOOR & flags) - drawImage(Path, x - Path->Width, y + offset); + g_lab->drawImage(Path, x - Path->Width, y + offset); xx = x + (HRoom->Width - XMark->Width) / 2; xy = y + (HRoom->Height - XMark->Height) / 2; @@ -487,7 +486,7 @@ static void drawRoom(uint16 CurRoom, bool drawx) { } if (drawx) - drawImage(XMark, xx, xy); + g_lab->drawImage(XMark, xx, xy); } @@ -582,10 +581,10 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b if (fadeout) fade(false, 0); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); - drawImage(Map, 0, 0); + g_lab->drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); for (drawroom = 1; drawroom <= MaxRooms; drawroom++) { @@ -621,16 +620,16 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b // Labyrinth specific code if (Floor == LOWERFLOOR) { if (onFloor(SURMAZEFLOOR)) - drawImage(Maze, mapScaleX(538), mapScaleY(277)); + g_lab->drawImage(Maze, mapScaleX(538), mapScaleY(277)); } else if (Floor == MIDDLEFLOOR) { if (onFloor(CARNIVAL)) - drawImage(Maze, mapScaleX(358), mapScaleY(72)); + g_lab->drawImage(Maze, mapScaleX(358), mapScaleY(72)); if (onFloor(MEDMAZEFLOOR)) - drawImage(Maze, mapScaleX(557), mapScaleY(325)); + g_lab->drawImage(Maze, mapScaleX(557), mapScaleY(325)); } else if (Floor == UPPERFLOOR) { if (onFloor(HEDGEMAZEFLOOR)) - drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); + g_lab->drawImage(HugeMaze, mapScaleX(524), mapScaleY(97)); } else if (Floor == SURMAZEFLOOR) { sptr = (char *)g_resource->getStaticText(kTextSurmazeMessage).c_str(); flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); @@ -708,14 +707,14 @@ void processMap(uint16 CurRoom) { newcolor[2] = newcolor[1]; } - waitTOF(); - writeColorReg(newcolor, 1); + g_lab->waitTOF(); + g_lab->writeColorReg(newcolor, 1); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); - waitTOF(); + g_lab->waitTOF(); updateMouse(); place++; @@ -822,8 +821,8 @@ void processMap(uint16 CurRoom) { if ((sptr = Rooms[CurMsg].RoomMsg)) { mouseHide(); - setAPen(3); - rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); + g_lab->setAPen(3); + g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); if (Maps[OldMsg].PageNumber == CurFloor) @@ -834,8 +833,8 @@ void processMap(uint16 CurRoom) { y1 = (y1 + y2) / 2; if ((CurMsg != CurRoom) && (Maps[CurMsg].PageNumber == CurFloor)) { - setAPen(1); - rectFill(x1 - 1, y1, x1, y1); + g_lab->setAPen(1); + g_lab->rectFill(x1 - 1, y1, x1, y1); } mouseShow(); @@ -844,7 +843,7 @@ void processMap(uint16 CurRoom) { } } - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } } } @@ -872,18 +871,18 @@ void doMap(uint16 CurRoom) { drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); mouseShow(); attachGadgetList(MapGadgetList); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); processMap(CurRoom); attachGadgetList(NULL); fade(false, 0); blackAllScreen(); mouseHide(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); freeMapData(); blackAllScreen(); mouseShow(); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } } // End of namespace Lab diff --git a/engines/lab/mouse.cpp b/engines/lab/mouse.cpp index 292ac3cb17..ef483f7e2d 100644 --- a/engines/lab/mouse.cpp +++ b/engines/lab/mouse.cpp @@ -28,8 +28,8 @@ * */ +#include "lab/lab.h" #include "lab/mouse.h" -#include "lab/vga.h" #include "lab/stddefines.h" #include "lab/interface.h" @@ -81,14 +81,14 @@ static Gadget *checkGadgetHit(Gadget *gadlist, uint16 x, uint16 y) { hitgad = gadlist; } else { mouseHide(); - drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->ImAlt, gadlist->x, gadlist->y); mouseShow(); for (counter = 0; counter < 3; counter++) - waitTOF(); + g_lab->waitTOF(); mouseHide(); - drawImage(gadlist->Im, gadlist->x, gadlist->y); + g_lab->drawImage(gadlist->Im, gadlist->x, gadlist->y); mouseShow(); } @@ -141,21 +141,21 @@ void updateMouse() { if (hitgad) { mouseHide(); - drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); + g_lab->drawImage(hitgad->ImAlt, hitgad->x, hitgad->y); mouseShow(); for (counter = 0; counter < 3; counter++) - waitTOF(); + g_lab->waitTOF(); mouseHide(); - drawImage(hitgad->Im, hitgad->x, hitgad->y); + g_lab->drawImage(hitgad->Im, hitgad->x, hitgad->y); mouseShow(); doUpdateDisplay = true; hitgad = NULL; } if (doUpdateDisplay) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); } @@ -178,7 +178,7 @@ void mouseShow() { NumHidden--; if ((NumHidden == 0) && MouseHidden) { - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); MouseHidden = false; } @@ -198,17 +198,13 @@ void mouseHide() { } } - -extern uint32 _mouseX; -extern uint32 _mouseY; - /*****************************************************************************/ /* Gets the current mouse co-ordinates. NOTE: On IBM version, will scale */ /* from virtual to screen co-ordinates automatically. */ /*****************************************************************************/ void mouseXY(uint16 *x, uint16 *y) { - *x = (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; if (!IsHiRes) (*x) /= 2; @@ -225,7 +221,7 @@ void mouseMove(uint16 x, uint16 y) { g_system->warpMouse(x, y); if (!MouseHidden) - WSDL_ProcessInput(0); + g_lab->WSDL_ProcessInput(0); } @@ -237,15 +233,15 @@ void mouseMove(uint16 x, uint16 y) { bool mouseButton(uint16 *x, uint16 *y, bool leftbutton) { if (leftbutton) { if (LeftClick) { - *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; LeftClick = false; return true; } } else { if (RightClick) { - *x = (!IsHiRes) ? (uint16)_mouseX / 2 : (uint16)_mouseX; - *y = (uint16)_mouseY; + *x = (!IsHiRes) ? (uint16)g_lab->_mouseX / 2 : (uint16)g_lab->_mouseX; + *y = (uint16)g_lab->_mouseY; RightClick = false; return true; } diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index d48a4ca807..e6e9d9135d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -37,7 +37,6 @@ #include "lab/parsefun.h" #include "lab/resource.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/interface.h" namespace Lab { @@ -484,7 +483,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { case WAITSECS: g_lab->addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); while (1) { g_music->updateMusic(); @@ -524,7 +523,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); - waitTOF(); + g_lab->waitTOF(); } break; @@ -567,23 +566,23 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { for (counter = (8 * 3); counter < (255 * 3); counter++) diffcmap[counter] = 255 - diffcmap[counter]; - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 4) { /* white the palette */ whiteScreen(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 6) { /* Restore the palette */ - waitTOF(); - VGASetPal(diffcmap, 256); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->VGASetPal(diffcmap, 256); + g_lab->waitTOF(); + g_lab->waitTOF(); } else if (APtr->Param1 == 7) { /* Quick pause */ - waitTOF(); - waitTOF(); - waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); + g_lab->waitTOF(); } break; @@ -599,7 +598,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); diffNextFrame(); - waitTOF(); + g_lab->waitTOF(); } } diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 421c2ce1ad..852b9c66b8 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -31,7 +31,6 @@ #include "lab/lab.h" #include "lab/diff.h" #include "lab/labfun.h" -#include "lab/vga.h" #include "lab/mouse.h" namespace Lab { @@ -91,7 +90,7 @@ void unDiff(byte *NewBuf, byte *OldBuf, byte *DiffData, uint16 bytesperrow, bool /*****************************************************************************/ void blackScreen() { memset(blackbuffer, 0, 248 * 3); - writeColorRegs(blackbuffer, 8, 248); + g_lab->writeColorRegs(blackbuffer, 8, 248); g_system->delayMillis(32); } @@ -101,7 +100,7 @@ void blackScreen() { /*****************************************************************************/ void whiteScreen() { memset(blackbuffer, 255, 248 * 3); - writeColorRegs(blackbuffer, 8, 248); + g_lab->writeColorRegs(blackbuffer, 8, 248); } /*****************************************************************************/ @@ -109,7 +108,7 @@ void whiteScreen() { /*****************************************************************************/ void blackAllScreen() { memset(blackbuffer, 0, 256 * 3); - writeColorRegs(blackbuffer, 0, 256); + g_lab->writeColorRegs(blackbuffer, 0, 256); g_system->delayMillis(32); } @@ -120,7 +119,7 @@ void diffNextFrame() { return; if (DispBitMap->Flags & BITMAPF_VIDEO) { - DispBitMap->Planes[0] = getVGABaseAddr(); + DispBitMap->Planes[0] = g_lab->getVGABaseAddr(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000; DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000; @@ -140,7 +139,7 @@ void diffNextFrame() { } if (IsPal && !nopalchange) { - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsPal = false; } @@ -148,7 +147,7 @@ void diffNextFrame() { } if (IsPal && !nopalchange && !IsBM && !donepal) { - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); IsPal = false; } @@ -163,7 +162,7 @@ void diffNextFrame() { CurBit = 0; if (DispBitMap->Flags & BITMAPF_VIDEO) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return; /* done with the next frame. */ } @@ -231,7 +230,7 @@ void diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } @@ -257,7 +256,7 @@ void diffNextFrame() { if (waitForEffect) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); if (DispBitMap->Flags & BITMAPF_VIDEO) didTOF = 1; @@ -268,7 +267,7 @@ void diffNextFrame() { mouseShow(); if (!didTOF) - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return; } @@ -445,7 +444,7 @@ void readSound(bool waitTillFinished, Common::File *file) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } @@ -460,7 +459,7 @@ void readSound(bool waitTillFinished, Common::File *file) { if (waitTillFinished) { while (g_music->isSoundEffectActive()) { g_music->updateMusic(); - waitTOF(); + g_lab->waitTOF(); } } } else diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 0104e3ee3f..16940e1cbc 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -38,7 +38,6 @@ #include "lab/parsefun.h" #include "lab/interface.h" #include "lab/diff.h" -#include "lab/vga.h" #include "lab/text.h" #include "lab/mouse.h" #include "lab/stddefines.h" @@ -89,7 +88,6 @@ extern uint16 *FadePalette; extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; -extern byte *_tempScrollData; extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 RoomNum, Direction; @@ -141,7 +139,7 @@ static void doCombination() { uint16 counter; for (counter = 0; counter <= 5; counter++) - drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); + g_lab->drawImage(Images[combination[counter]], VGAScaleX(combx[counter]), VGAScaleY(65)); } /*****************************************************************************/ @@ -164,11 +162,11 @@ void showCombination(const char *filename) { for (CurBit = 0; CurBit < 10; CurBit++) readImage(buffer, &(Images[CurBit])); - allocFile((void **)&_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Images[0]->Width * Images[0]->Height * 2L, "tempdata"); doCombination(); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); } @@ -188,22 +186,22 @@ static void changeCombination(uint16 number) { combnum = combination[number]; - display.ImageData = getVGABaseAddr(); + display.ImageData = g_lab->getVGABaseAddr(); display.Width = g_lab->_screenWidth; display.Height = g_lab->_screenHeight; for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { if (IsHiRes) { if (counter & 1) - waitTOF(); + g_lab->waitTOF(); } else - waitTOF(); + g_lab->waitTOF(); - display.ImageData = getVGABaseAddr(); + display.ImageData = g_lab->getVGABaseAddr(); - scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); + g_lab->scrollDisplayY(2, VGAScaleX(combx[number]), VGAScaleY(65), VGAScaleX(combx[number]) + (Images[combnum])->Width - 1, VGAScaleY(65) + (Images[combnum])->Height); - bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); + g_lab->bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2); } for (counter = 0; counter < 6; counter++) @@ -259,8 +257,8 @@ static void doTile(bool showsolution) { rows = VGAScaleY(31); cols = VGAScaleX(105); } else { - setAPen(0); - rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); + g_lab->setAPen(0); + g_lab->rectFill(VGAScaleX(97), VGAScaleY(22), VGAScaleX(220), VGAScaleY(126)); rowm = VGAScaleY(25); colm = VGAScaleX(30); @@ -277,7 +275,7 @@ static void doTile(bool showsolution) { num = CurTile[col] [row]; if (showsolution || num) - drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); + g_lab->drawImage(Tiles[num], cols + (col * colm), rows + (row * rowm)); col++; } @@ -315,19 +313,19 @@ void showTile(const char *filename, bool showsolution) { for (CurBit = start; CurBit < 16; CurBit++) readImage(buffer, &(Tiles[CurBit])); - allocFile((void **)&_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); + allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->Width * Tiles[1]->Height * 2L, "tempdata"); doTile(showsolution); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); } static void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { if (dx) - scrollDisplayX(dx, x1, y1, x2, y2); + g_lab->scrollDisplayX(dx, x1, y1, x2, y2); if (dy) - scrollDisplayY(dy, x1, y1, x2, y2); + g_lab->scrollDisplayY(dy, x1, y1, x2, y2); } /*****************************************************************************/ @@ -364,7 +362,7 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) { y1 = VGAScaleY(25) + (row * VGAScaleY(25)) + dy; for (counter = 0; counter < last; counter++) { - waitTOF(); + g_lab->waitTOF(); scrollRaster(dX, dY, x1, y1, x1 + VGAScaleX(28) + sx, y1 + VGAScaleY(23) + sy); x1 += dX; y1 += dY; @@ -479,7 +477,7 @@ void doNotes() { flowText(BigMsgFont, -2 + SVGACord(1), 0, 0, false, false, true, true, VGAScaleX(25) + SVGACord(15), VGAScaleY(50), VGAScaleX(295) - SVGACord(15), VGAScaleY(148), ntext); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); freeAllStolenMem(); } @@ -541,7 +539,7 @@ void doWestPaper() { CharsPrinted = flowText(BigMsgFont, -4, 0, 0, false, false, false, true, VGAScaleX(162), VGAScaleY(y), VGAScaleX(275), VGAScaleY(148), ntext); - VGASetPal(diffcmap, 256); + g_lab->VGASetPal(diffcmap, 256); freeAllStolenMem(); } @@ -675,16 +673,16 @@ static void turnPage(bool FromLeft) { if (FromLeft) { for (counter = 0; counter < g_lab->_screenWidth; counter += 8) { g_music->updateMusic(); - waitTOF(); - ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->waitTOF(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); + g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } else { for (counter = (g_lab->_screenWidth - 8); counter > 0; counter -= 8) { g_music->updateMusic(); - waitTOF(); - ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); + g_lab->waitTOF(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); + g_lab->bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } } @@ -703,10 +701,10 @@ static void drawJournal(uint16 wipenum, bool needFade) { drawJournalText(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); + g_lab->bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); else turnPage((bool)(wipenum == 1)); @@ -794,7 +792,7 @@ void doJournal() { CancelG.NextGadget = &ForwardG; ScreenImage = JBackImage; - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); g_music->updateMusic(); loadJournalData(); @@ -808,10 +806,10 @@ void doJournal() { fade(false, 0); mouseHide(); - ScreenImage.ImageData = getVGABaseAddr(); + ScreenImage.ImageData = g_lab->getVGABaseAddr(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackScreen(); freeAllStolenMem(); @@ -852,7 +850,7 @@ bool saveRestoreGame() { } } - WSDL_UpdateScreen(); + g_lab->WSDL_UpdateScreen(); return isOK; } @@ -903,17 +901,17 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, else MonGadHeight = fheight; - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, y2); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); for (counter = 0; counter < numlines; counter++) - drawImage(MonButton, 0, counter * MonGadHeight); + g_lab->drawImage(MonButton, 0, counter * MonGadHeight); } else if (isinteractive) { - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, y2); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, y2); } else { - setAPen(0); - rectFill(x1, y1, x2, y2); + g_lab->setAPen(0); + g_lab->rectFill(x1, y1, x2, y2); } while (DrawingToPage < monitorPage) { @@ -1083,8 +1081,8 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, freeAllStolenMem(); - setAPen(0); - rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); + g_lab->setAPen(0); + g_lab->rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackAllScreen(); } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 36b0116314..cf920d3f43 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -32,7 +32,6 @@ #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/text.h" -#include "lab/vga.h" namespace Lab { @@ -81,7 +80,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex int32 templeft, LeftInSegment; uint16 counter, counterb, bwidth, mask, curpage, rows, cols, data; - VGATop = getVGABaseAddr(); + VGATop = g_lab->getVGABaseAddr(); for (counter = 0; counter < numchars; counter++) { RealOffset = (g_lab->_screenWidth * y) + x; diff --git a/engines/lab/timing.cpp b/engines/lab/timing.cpp index ca767550dc..ba3dd40846 100644 --- a/engines/lab/timing.cpp +++ b/engines/lab/timing.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/vga.h" namespace Lab { diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 54cb50756d..c1d526b53a 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -29,7 +29,6 @@ */ #include "lab/lab.h" -#include "lab/vga.h" #include "lab/stddefines.h" #include "lab/mouse.h" @@ -39,27 +38,10 @@ namespace Lab { -static byte _curvgapal[256 * 3]; -static unsigned char _curapen = 0; - -byte *_currentDsplayBuffer = 0; -byte *_displayBuffer = 0; - -int _lastWaitTOFTicks = 0; - -uint32 _mouseX = 0; -uint32 _mouseY = 0; - -uint16 _nextKeyIn = 0; -uint16 _keyBuf[64]; -uint16 _nextKeyOut = 0; -bool _mouseAtEdge = false; -byte *_tempScrollData; - /*****************************************************************************/ /* Sets up either a low-res or a high-res 256 color screen. */ /*****************************************************************************/ -bool createScreen(bool HiRes) { +bool LabEngine::createScreen(bool HiRes) { if (HiRes) { g_lab->_screenWidth = 640; g_lab->_screenHeight = 480; @@ -77,11 +59,11 @@ bool createScreen(bool HiRes) { /*****************************************************************************/ /* Sets the current page on the VGA card. */ /*****************************************************************************/ -void changeVolume(int delta) { +void LabEngine::changeVolume(int delta) { warning("STUB: changeVolume()"); } -uint16 WSDL_GetNextChar() { +uint16 LabEngine::WSDL_GetNextChar() { uint16 c = 0; WSDL_ProcessInput(0); @@ -94,12 +76,12 @@ uint16 WSDL_GetNextChar() { return c; } -bool WSDL_HasNextChar() { +bool LabEngine::WSDL_HasNextChar() { WSDL_ProcessInput(0); return _nextKeyIn != _nextKeyOut; } -void WSDL_ProcessInput(bool can_delay) { +void LabEngine::WSDL_ProcessInput(bool can_delay) { int n; int lastMouseAtEdge; int flags = 0; @@ -186,14 +168,14 @@ void WSDL_ProcessInput(bool can_delay) { g_system->delayMillis(10); } -void WSDL_GetMousePos(int *x, int *y) { +void LabEngine::WSDL_GetMousePos(int *x, int *y) { WSDL_ProcessInput(0); *x = _mouseX; *y = _mouseY; } -void waitTOF() { +void LabEngine::waitTOF() { g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); @@ -207,7 +189,7 @@ void waitTOF() { _lastWaitTOFTicks = now; } -void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { +void LabEngine::WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { byte tmp[256 * 3]; for (int i = 0; i < 256 * 3; i++) { @@ -231,12 +213,12 @@ void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { /* The length of the buffer is 3 times the number of registers */ /* selected. */ /*****************************************************************************/ -void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { +void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 0); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } -void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { +void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 1); memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } @@ -246,16 +228,16 @@ void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { /* the first character in the string is the red value, then green, then */ /* blue. Each color value is a 6 bit value. */ /*****************************************************************************/ -void writeColorReg(byte *buf, uint16 regnum) { +void LabEngine::writeColorReg(byte *buf, uint16 regnum) { writeColorRegs(buf, regnum, 1); } -void VGASetPal(void *cmap, uint16 numcolors) { +void LabEngine::VGASetPal(void *cmap, uint16 numcolors) { if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) writeColorRegs((byte *)cmap, 0, numcolors); } -void WSDL_UpdateScreen() { +void LabEngine::WSDL_UpdateScreen() { g_system->copyRectToScreen(_displayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); @@ -265,7 +247,7 @@ void WSDL_UpdateScreen() { /*****************************************************************************/ /* Returns the base address of the current VGA display. */ /*****************************************************************************/ -byte *getVGABaseAddr() { +byte *LabEngine::getVGABaseAddr() { if (_currentDsplayBuffer) return _currentDsplayBuffer; @@ -275,7 +257,7 @@ byte *getVGABaseAddr() { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::drawImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -318,7 +300,7 @@ void drawImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Draws an image to the screen. */ /*****************************************************************************/ -void drawMaskImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::drawMaskImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -371,7 +353,7 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { /*****************************************************************************/ /* Reads an image from the screen. */ /*****************************************************************************/ -void readScreenImage(Image *Im, uint16 x, uint16 y) { +void LabEngine::readScreenImage(Image *Im, uint16 x, uint16 y) { int sx, sy, dx, dy, w, h; sx = 0; @@ -415,7 +397,7 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { /* Blits a piece of one image to another. */ /* NOTE: for our purposes, assumes that ImDest is to be in VGA memory. */ /*****************************************************************************/ -void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, +void LabEngine::bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height) { // I think the old code assumed that the source image data was valid for the given box. // I will proceed on that assumption. @@ -461,7 +443,7 @@ void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, /* The _tempScrollData variable must be initialized to some memory, or this */ /* function will fail. */ /*****************************************************************************/ -void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; @@ -503,7 +485,7 @@ void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Scrolls the display in the y direction by blitting. */ /*****************************************************************************/ -void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { Image Im; uint16 temp; @@ -545,14 +527,14 @@ void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Sets the pen number to use on all the drawing operations. */ /*****************************************************************************/ -void setAPen(uint16 pennum) { +void LabEngine::setAPen(uint16 pennum) { _curapen = (unsigned char)pennum; } /*****************************************************************************/ /* Fills in a rectangle. */ /*****************************************************************************/ -void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int dx, dy, w, h; dx = x1; @@ -595,21 +577,21 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { /*****************************************************************************/ /* Draws a horizontal line. */ /*****************************************************************************/ -void drawVLine(uint16 x, uint16 y1, uint16 y2) { +void LabEngine::drawVLine(uint16 x, uint16 y1, uint16 y2) { rectFill(x, y1, x, y2); } /*****************************************************************************/ /* Draws a vertical line. */ /*****************************************************************************/ -void drawHLine(uint16 x1, uint16 y, uint16 x2) { +void LabEngine::drawHLine(uint16 x1, uint16 y, uint16 x2) { rectFill(x1, y, x2, y); } /*****************************************************************************/ /* Ghoasts a region on the screen using the desired pen color. */ /*****************************************************************************/ -void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void LabEngine::ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int dx, dy, w, h; dx = x1; diff --git a/engines/lab/vga.h b/engines/lab/vga.h deleted file mode 100644 index ade6a2ac79..0000000000 --- a/engines/lab/vga.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on Labyrinth of Time code with assistance of - * - * Copyright (c) 1993 Terra Nova Development - * Copyright (c) 2004 The Wyrmkeep Entertainment Co. - * - */ - -#include "lab/stddefines.h" - -#ifndef LAB_VGA_H -#define LAB_VGA_H - -namespace Lab { - -struct Image { - uint16 Width; - uint16 Height; - byte *ImageData; -}; - -bool createScreen(bool HiRes); -void waitTOF(); -void quickWaitTOF(); -byte *getVGABaseAddr(); -void writeColorReg(byte *buf, uint16 regnum); -void writeColorRegs(byte *buf, uint16 first, uint16 numreg); -void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); -void VGASetPal(void *cmap, uint16 numcolors); - -/*---------- Drawing Routines ----------*/ - -void drawImage(Image *Im, uint16 x, uint16 y); -void drawMaskImage(Image *Im, uint16 x, uint16 y); -void readScreenImage(Image *Im, uint16 x, uint16 y); -void bltBitMap(Image *ImSource, uint16 xs, uint16 ys, Image *ImDest, uint16 xd, uint16 yd, uint16 width, uint16 height); -void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void setAPen(uint16 pennum); -void drawHLine(uint16 x, uint16 y1, uint16 y2); -void drawVLine(uint16 x1, uint16 y, uint16 x2); -void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); -void WSDL_UpdateScreen(); -void WSDL_GetMousePos(int *x, int *y); -uint16 WSDL_GetNextChar(); -bool WSDL_HasNextChar(); -void WSDL_ProcessInput(bool can_delay); - -} // End of namespace Lab - -#endif /* LAB_VGA_H */ |