diff options
-rw-r--r-- | engines/lab/graphics.cpp | 45 | ||||
-rw-r--r-- | engines/lab/intro.cpp | 3 | ||||
-rw-r--r-- | engines/lab/lab.cpp | 6 | ||||
-rw-r--r-- | engines/lab/lab.h | 5 | ||||
-rw-r--r-- | engines/lab/map.cpp | 5 | ||||
-rw-r--r-- | engines/lab/readdiff.cpp | 1 | ||||
-rw-r--r-- | engines/lab/special.cpp | 31 | ||||
-rw-r--r-- | engines/lab/text.cpp | 25 | ||||
-rw-r--r-- | engines/lab/vga.cpp | 107 |
9 files changed, 113 insertions, 115 deletions
diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index 7bd2af41d7..40b9aa1031 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -62,8 +62,6 @@ extern const char *CurFileName; /*---------------------------------------------------------------------------*/ -extern uint32 VGAScreenWidth, VGAScreenHeight, VGABytesPerPage; - /*****************************************************************************/ /* Reads in a picture into the dest bitmap. */ /*****************************************************************************/ @@ -81,8 +79,8 @@ bool readPict(const char *filename, bool PlayOnce) { return false; } - DispBitMap->BytesPerRow = VGAScreenWidth; - DispBitMap->Rows = VGAScreenHeight; + DispBitMap->BytesPerRow = g_lab->_screenWidth; + DispBitMap->Rows = g_lab->_screenHeight; DispBitMap->Flags = BITMAPF_VIDEO; readDiff(PlayOnce); @@ -292,7 +290,6 @@ uint32 flowText(void *font, /* the TextAttr pointer */ } -extern uint32 VGABytesPerPage; extern byte *VGABASEADDRESS; @@ -309,15 +306,15 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */ bool output, /* Whether to output any text */ uint16 x1, /* Cords */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ - uint32 res, vgabyte = VGABytesPerPage; + uint32 res, vgabyte = g_lab->_screenBytesPerPage; byte *tmp = VGABASEADDRESS; VGABASEADDRESS = DestIm->ImageData; - VGABytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; + g_lab->_screenBytesPerPage = (uint32) DestIm->Width * (int32) DestIm->Height; res = flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, x1, y1, x2, y2, str); - VGABytesPerPage = vgabyte; + g_lab->_screenBytesPerPage = vgabyte; VGABASEADDRESS = tmp; return res; @@ -462,8 +459,8 @@ static void doScrollBlack() { tempmem = mem; while (size) { - if (size > VGABytesPerPage) - copysize = VGABytesPerPage; + if (size > g_lab->_screenBytesPerPage) + copysize = g_lab->_screenBytesPerPage; else copysize = size; @@ -510,12 +507,12 @@ static void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startli size = (int32)(height - nheight) * (int32) width; mem += startline * width; - CurPage = ((int32) nheight * (int32) width) / VGABytesPerPage; - OffSet = ((int32) nheight * (int32) width) - (CurPage * VGABytesPerPage); + CurPage = ((int32) nheight * (int32) width) / g_lab->_screenBytesPerPage; + OffSet = ((int32) nheight * (int32) width) - (CurPage * g_lab->_screenBytesPerPage); while (size) { - if (size > (VGABytesPerPage - OffSet)) - copysize = VGABytesPerPage - OffSet; + if (size > (g_lab->_screenBytesPerPage - OffSet)) + copysize = g_lab->_screenBytesPerPage - OffSet; else copysize = size; @@ -665,7 +662,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } - ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -683,7 +680,7 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { linesdone = 0; } - rectFill(0, CurY, VGAScreenWidth - 1, CurY + 1); + rectFill(0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -696,16 +693,16 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { else CurFileName = getPictName(CPtr); - byte *BitMapMem = readPictToMem(CurFileName, VGAScreenWidth, LastY + 5); + byte *BitMapMem = readPictToMem(CurFileName, g_lab->_screenWidth, LastY + 5); VGASetPal(diffcmap, 256); if (BitMapMem) { - ImSource.Width = VGAScreenWidth; + ImSource.Width = g_lab->_screenWidth; ImSource.Height = LastY; ImSource.ImageData = BitMapMem; - ImDest.Width = VGAScreenWidth; - ImDest.Height = VGAScreenHeight; + ImDest.Width = g_lab->_screenWidth; + ImDest.Height = g_lab->_screenHeight; ImDest.ImageData = getVGABaseAddr(); for (counter = 0; counter < 2; counter++) { @@ -720,8 +717,8 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.ImageData = getVGABaseAddr(); - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); - ghoastRect(0, 0, CurY, VGAScreenWidth - 1, CurY + 1); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); + ghoastRect(0, 0, CurY, g_lab->_screenWidth - 1, CurY + 1); CurY += 4; linesdone++; } @@ -740,9 +737,9 @@ static void doTransWipe(CloseDataPtr *CPtr, char *filename) { ImDest.ImageData = getVGABaseAddr(); if (CurY == LastY) - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 1); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 1); else - bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, VGAScreenWidth, 2); + bltBitMap(&ImSource, 0, CurY, &ImDest, 0, CurY, g_lab->_screenWidth, 2); CurY += 4; linesdone++; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index eacfd12843..85c64c44b6 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -39,7 +39,6 @@ namespace Lab { extern bool nopalchange, DoBlack, IsHiRes; extern char diffcmap[256 * 3]; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern uint16 *FadePalette; Intro::Intro() { @@ -466,7 +465,7 @@ void Intro::introSequence() { if (_quitIntro) { setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + 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 c13f5cde9e..c6f8006a55 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -55,6 +55,10 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _extraGameFeatures(0) { g_lab = this; + _screenWidth = 320; + _screenHeight = 200; + _screenBytesPerPage = 65536; + //const Common::FSNode gameDataDir(ConfMan.get("path")); //SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); @@ -100,7 +104,7 @@ Common::Error LabEngine::run() { } else { knownVersion = false; } - + roomFile.close(); if (!knownVersion) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 989def2e1c..e9d27aea39 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -66,6 +66,11 @@ public: LargeSet *_conditions, *_roomsFound; + int _screenWidth; + int _screenHeight; + int _screenBytesPerPage; + + // timing.cpp void getTime(uint32 *secs, uint32 *micros); void addCurTime(uint32 sec, uint32 micros, uint32 *timeSec, uint32 *timeMicros); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f373fb8d9d..4ad9ba2511 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -49,7 +49,6 @@ static TextFont bmf; extern uint16 Direction; extern bool IsHiRes; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern CloseDataPtr CPtr; extern uint16 RoomNum; @@ -584,7 +583,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b fade(false, 0); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); drawImage(Map, 0, 0); drawGadgetList(MapGadgetList); @@ -880,7 +879,7 @@ void doMap(uint16 CurRoom) { blackAllScreen(); mouseHide(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); freeMapData(); blackAllScreen(); mouseShow(); diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 727a3394a2..421c2ce1ad 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -64,7 +64,6 @@ char diffcmap[256 * 3]; BitMap RawDiffBM; extern BitMap *DispBitMap, *DrawBitMap; -extern uint32 VGABytesPerPage; extern byte **startoffile; #define CONTINUOUS 0xFFFF diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 9d9ccc7241..41d938bdb8 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -89,7 +89,6 @@ extern uint16 *FadePalette; extern bool nopalchange, DoBlack, IsHiRes; extern BitMap *DispBitMap, *DrawBitMap; extern char diffcmap[3 * 256]; -extern uint32 VGAScreenWidth, VGAScreenHeight; extern byte *TempScrollData; extern CloseDataPtr CPtr; extern InventoryData *Inventory; @@ -120,7 +119,7 @@ static byte *loadBackPict(const char *fileName, bool tomem) { nopalchange = true; if (tomem) - res = readPictToMem(fileName, VGAScreenWidth, VGAScreenHeight); + res = readPictToMem(fileName, g_lab->_screenWidth, g_lab->_screenHeight); else readPict(fileName, true); @@ -190,8 +189,8 @@ static void changeCombination(uint16 number) { combnum = combination[number]; display.ImageData = getVGABaseAddr(); - display.Width = VGAScreenWidth; - display.Height = VGAScreenHeight; + display.Width = g_lab->_screenWidth; + display.Height = g_lab->_screenHeight; for (counter = 1; counter <= (Images[combnum]->Height / 2); counter++) { if (IsHiRes) { @@ -674,18 +673,18 @@ static void turnPage(bool FromLeft) { uint16 counter; if (FromLeft) { - for (counter = 0; counter < VGAScreenWidth; counter += 8) { + for (counter = 0; counter < g_lab->_screenWidth; counter += 8) { g_music->updateMusic(); waitTOF(); ScreenImage.ImageData = getVGABaseAddr(); - bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, VGAScreenHeight); + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } else { - for (counter = (VGAScreenWidth - 8); counter > 0; counter -= 8) { + 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, VGAScreenHeight); + bltBitMap(&JBackImage, counter, 0, &ScreenImage, counter, 0, 8, g_lab->_screenHeight); } } } @@ -707,7 +706,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { ScreenImage.ImageData = getVGABaseAddr(); if (wipenum == 0) - bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, VGAScreenWidth, VGAScreenHeight); + bltBitMap(&JBackImage, 0, 0, &ScreenImage, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); else turnPage((bool)(wipenum == 1)); @@ -726,7 +725,7 @@ static void drawJournal(uint16 wipenum, bool needFade) { fade(true, 0); nopalchange = true; - JBackImage.ImageData = readPictToMem("P:Journal.pic", VGAScreenWidth, VGAScreenHeight); + JBackImage.ImageData = readPictToMem("P:Journal.pic", g_lab->_screenWidth, g_lab->_screenHeight); GotBackImage = true; eatMessages(); @@ -787,8 +786,8 @@ void doJournal() { lastpage = false; GotBackImage = false; - JBackImage.Width = VGAScreenWidth; - JBackImage.Height = VGAScreenHeight; + JBackImage.Width = g_lab->_screenWidth; + JBackImage.Height = g_lab->_screenHeight; JBackImage.ImageData = NULL; BackG.NextGadget = &CancelG; @@ -812,7 +811,7 @@ void doJournal() { ScreenImage.ImageData = getVGABaseAddr(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + rectFill(0, 0, g_lab->_screenWidth - 1, g_lab->_screenHeight - 1); blackScreen(); freeAllStolenMem(); @@ -905,13 +904,13 @@ static void drawMonText(char *text, uint16 x1, uint16 y1, uint16 x2, uint16 y2, MonGadHeight = fheight; setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, y2); + rectFill(0, 0, g_lab->_screenWidth - 1, y2); for (counter = 0; counter < numlines; counter++) drawImage(MonButton, 0, counter * MonGadHeight); } else if (isinteractive) { setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, y2); + rectFill(0, 0, g_lab->_screenWidth - 1, y2); } else { setAPen(0); rectFill(x1, y1, x2, y2); @@ -1085,7 +1084,7 @@ void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, freeAllStolenMem(); setAPen(0); - rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1); + 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 c89cec389a..36b0116314 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/stddefines.h" #include "lab/labfun.h" #include "lab/text.h" @@ -35,8 +36,6 @@ namespace Lab { -extern uint32 VGAScreenWidth, VGABytesPerPage; - /*****************************************************************************/ /* Closes a font and frees all memory associated with it. */ /*****************************************************************************/ @@ -85,10 +84,10 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex VGATop = getVGABaseAddr(); for (counter = 0; counter < numchars; counter++) { - RealOffset = (VGAScreenWidth * y) + x; - curpage = RealOffset / VGABytesPerPage; - SegmentOffset = RealOffset - (curpage * VGABytesPerPage); - LeftInSegment = VGABytesPerPage - SegmentOffset; + RealOffset = (g_lab->_screenWidth * y) + x; + curpage = RealOffset / g_lab->_screenBytesPerPage; + SegmentOffset = RealOffset - (curpage * g_lab->_screenBytesPerPage); + LeftInSegment = g_lab->_screenBytesPerPage - SegmentOffset; VGACur = VGATop + SegmentOffset; if (tf->Widths[(uint)*text]) { @@ -121,10 +120,10 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex curpage++; VGATemp = (byte *)(VGATop - templeft); /* Set up VGATempLine for next line */ - VGATempLine -= VGABytesPerPage; + VGATempLine -= g_lab->_screenBytesPerPage; /* Set up LeftInSegment for next line */ - LeftInSegment += VGABytesPerPage + templeft; - templeft += VGABytesPerPage; + LeftInSegment += g_lab->_screenBytesPerPage + templeft; + templeft += g_lab->_screenBytesPerPage; } if (mask & data) @@ -141,13 +140,13 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex } } - VGATempLine += VGAScreenWidth; - LeftInSegment -= VGAScreenWidth; + VGATempLine += g_lab->_screenWidth; + LeftInSegment -= g_lab->_screenWidth; if (LeftInSegment <= 0) { curpage++; - VGATempLine -= VGABytesPerPage; - LeftInSegment += VGABytesPerPage; + VGATempLine -= g_lab->_screenBytesPerPage; + LeftInSegment += g_lab->_screenBytesPerPage; } } } diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 013b6ee9a6..5e1a1e828a 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/vga.h" #include "lab/stddefines.h" #include "lab/mouse.h" @@ -38,12 +39,8 @@ namespace Lab { -static byte curvgapal[256 * 3]; -static unsigned char curapen = 0; - -uint32 VGAScreenWidth = 320UL, - VGAScreenHeight = 200UL, - VGABytesPerPage = 65536UL; +static byte _curvgapal[256 * 3]; +static unsigned char _curapen = 0; byte *VGABASEADDRESS = 0; @@ -71,16 +68,16 @@ bool createScreen(bool HiRes) { VGABASEADDRESS = 0; if (HiRes) { - VGAScreenWidth = 640; - VGAScreenHeight = 480; + g_lab->_screenWidth = 640; + g_lab->_screenHeight = 480; } else { - VGAScreenWidth = 320; - VGAScreenHeight = 200; + g_lab->_screenWidth = 320; + g_lab->_screenHeight = 200; } - VGABytesPerPage = VGAScreenWidth * VGAScreenHeight; + g_lab->_screenBytesPerPage = g_lab->_screenWidth * g_lab->_screenHeight; - g_DisplayBuffer = (byte *)malloc(VGABytesPerPage); - g_Pixels = (byte *)calloc(VGABytesPerPage, 4); + g_DisplayBuffer = (byte *)malloc(g_lab->_screenBytesPerPage); + g_Pixels = (byte *)calloc(g_lab->_screenBytesPerPage, 4); return true; } @@ -138,8 +135,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseX = 0; g_MouseAtEdge = true; } - if (g_MouseX > VGAScreenWidth - 1) { - g_MouseX = VGAScreenWidth; + if (g_MouseX > g_lab->_screenWidth - 1) { + g_MouseX = g_lab->_screenWidth; g_MouseAtEdge = true; } @@ -148,8 +145,8 @@ void WSDL_ProcessInput(bool can_delay) { g_MouseY = 0; g_MouseAtEdge = true; } - if (g_MouseY > VGAScreenHeight - 1) { - g_MouseY = VGAScreenHeight; + if (g_MouseY > g_lab->_screenHeight - 1) { + g_MouseY = g_lab->_screenHeight; g_MouseAtEdge = true; } @@ -188,7 +185,7 @@ void WSDL_ProcessInput(bool can_delay) { break; } - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } } @@ -208,7 +205,7 @@ void waitTOF() { int untilOutOfRefresh = 1; if (g_ScreenWasLocked || untilOutOfRefresh) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } @@ -249,12 +246,12 @@ void WSDL_SetColors(byte *buf, uint16 first, uint16 numreg, uint16 slow) { /*****************************************************************************/ void writeColorRegs(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 0); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { WSDL_SetColors(buf, first, numreg, 1); - memcpy(&(curvgapal[first * 3]), buf, numreg * 3); + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } /*****************************************************************************/ @@ -267,7 +264,7 @@ void writeColorReg(byte *buf, uint16 regnum) { } void VGASetPal(void *cmap, uint16 numcolors) { - if (memcmp(cmap, curvgapal, numcolors * 3) != 0) + if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) writeColorRegs((byte *)cmap, 0, numcolors); } @@ -283,7 +280,7 @@ void WSDL_IgnoreUpdateDisplay(int state) { void WSDL_UpdateScreen() { if (g_ScreenWasLocked && !g_IgnoreUpdateDisplay) { - g_system->copyRectToScreen(g_DisplayBuffer, VGAScreenWidth, 0, 0, VGAScreenWidth, VGAScreenHeight); + g_system->copyRectToScreen(g_DisplayBuffer, g_lab->_screenWidth, 0, 0, g_lab->_screenWidth, g_lab->_screenHeight); g_system->updateScreen(); } @@ -326,20 +323,20 @@ void drawImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(d, s, w); s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -369,15 +366,15 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { byte *ss = s; @@ -392,7 +389,7 @@ void drawMaskImage(Image *Im, uint16 x, uint16 y) { } s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -422,20 +419,20 @@ void readScreenImage(Image *Im, uint16 x, uint16 y) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { byte *s = Im->ImageData + sy * Im->Width + sx; - byte *d = getVGABaseAddr() + dy * VGAScreenWidth + dx; + byte *d = getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { memcpy(s, d, w); s += Im->Width; - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -575,7 +572,7 @@ 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) { - curapen = (unsigned char)pennum; + _curapen = (unsigned char)pennum; } /*****************************************************************************/ @@ -599,24 +596,24 @@ void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { char *dd = d; int ww = w; while (ww-- > 0) { - *dd++ = curapen; + *dd++ = _curapen; } - d += VGAScreenWidth; + d += g_lab->_screenWidth; } } } @@ -656,14 +653,14 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { dy = 0; } - if ((uint)(dx + w) > VGAScreenWidth) - w = VGAScreenWidth - dx; + if ((uint)(dx + w) > g_lab->_screenWidth) + w = g_lab->_screenWidth - dx; - if ((uint)(dy + h) > VGAScreenHeight) - h = VGAScreenHeight - dy; + if ((uint)(dy + h) > g_lab->_screenHeight) + h = g_lab->_screenHeight - dy; if (w > 0 && h > 0) { - char *d = (char *)getVGABaseAddr() + dy * VGAScreenWidth + dx; + char *d = (char *)getVGABaseAddr() + dy * g_lab->_screenWidth + dx; while (h-- > 0) { char *dd = d; @@ -680,7 +677,7 @@ void ghoastRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { ww -= 2; } - d += VGAScreenWidth; + d += g_lab->_screenWidth; dy++; } } |