LAB: Get rid of g_lab in several LabEngine and DisplayMan functions
This commit is contained in:
parent
f7321fa278
commit
d376fd8dd0
2 changed files with 58 additions and 58 deletions
|
@ -66,7 +66,7 @@ uint16 DisplayMan::scaleX(uint16 x) {
|
|||
/* file, co-ordinates are set up on a 368x336 display. */
|
||||
/*****************************************************************************/
|
||||
uint16 DisplayMan::scaleY(uint16 y) {
|
||||
if (g_lab->_isHiRes)
|
||||
if (_vm->_isHiRes)
|
||||
return (y + (y / 14));
|
||||
else
|
||||
return ((y * 10) / 24);
|
||||
|
@ -76,7 +76,7 @@ uint16 DisplayMan::scaleY(uint16 y) {
|
|||
/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
|
||||
/*****************************************************************************/
|
||||
int16 DisplayMan::VGAScaleX(int16 x) {
|
||||
if (g_lab->_isHiRes)
|
||||
if (_vm->_isHiRes)
|
||||
return (x * 2);
|
||||
else
|
||||
return x;
|
||||
|
@ -86,14 +86,14 @@ int16 DisplayMan::VGAScaleX(int16 x) {
|
|||
/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
|
||||
/*****************************************************************************/
|
||||
int16 DisplayMan::VGAScaleY(int16 y) {
|
||||
if (g_lab->_isHiRes)
|
||||
if (_vm->_isHiRes)
|
||||
return ((y * 12) / 5);
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
uint16 DisplayMan::SVGACord(uint16 cord) {
|
||||
if (g_lab->_isHiRes)
|
||||
if (_vm->_isHiRes)
|
||||
return cord;
|
||||
else
|
||||
return 0;
|
||||
|
@ -133,12 +133,12 @@ bool DisplayMan::readPict(const char *filename, bool playOnce) {
|
|||
byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) {
|
||||
byte *mem;
|
||||
|
||||
g_lab->_anim->stopDiff();
|
||||
_vm->_anim->stopDiff();
|
||||
|
||||
allocFile((void **)&mem, (int32)x * (int32)y, "Bitmap");
|
||||
byte *curMem = mem;
|
||||
|
||||
byte **file = g_lab->_music->newOpen(filename);
|
||||
byte **file = _vm->_music->newOpen(filename);
|
||||
|
||||
if (file == NULL)
|
||||
return NULL;
|
||||
|
@ -152,7 +152,7 @@ byte *DisplayMan::readPictToMem(const char *filename, uint16 x, uint16 y) {
|
|||
DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000;
|
||||
DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000;
|
||||
|
||||
g_lab->_anim->readDiff(true);
|
||||
_vm->_anim->readDiff(true);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
@ -488,16 +488,16 @@ void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 st
|
|||
uint16 curPage;
|
||||
uint32 *baseAddr;
|
||||
|
||||
baseAddr = (uint32 *)g_lab->getCurrentDrawingBuffer();
|
||||
baseAddr = (uint32 *)_vm->getCurrentDrawingBuffer();
|
||||
|
||||
size = (int32)(height - nheight) * (int32)width;
|
||||
mem += startline * width;
|
||||
curPage = ((int32)nheight * (int32)width) / g_lab->_graphics->_screenBytesPerPage;
|
||||
offSet = ((int32)nheight * (int32)width) - (curPage * g_lab->_graphics->_screenBytesPerPage);
|
||||
curPage = ((int32)nheight * (int32)width) / _vm->_graphics->_screenBytesPerPage;
|
||||
offSet = ((int32)nheight * (int32)width) - (curPage * _vm->_graphics->_screenBytesPerPage);
|
||||
|
||||
while (size) {
|
||||
if (size > (g_lab->_graphics->_screenBytesPerPage - offSet))
|
||||
copysize = g_lab->_graphics->_screenBytesPerPage - offSet;
|
||||
if (size > (_vm->_graphics->_screenBytesPerPage - offSet))
|
||||
copysize = _vm->_graphics->_screenBytesPerPage - offSet;
|
||||
else
|
||||
copysize = size;
|
||||
|
||||
|
@ -669,7 +669,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *cPtr, char *filename) {
|
|||
else
|
||||
_vm->_curFileName = getPictName(cPtr);
|
||||
|
||||
byte *BitMapMem = readPictToMem(g_lab->_curFileName, _vm->_screenWidth, lastY + 5);
|
||||
byte *BitMapMem = readPictToMem(_vm->_curFileName, _vm->_screenWidth, lastY + 5);
|
||||
_vm->setPalette(_vm->_anim->_diffPalette, 256);
|
||||
|
||||
if (BitMapMem) {
|
||||
|
@ -833,7 +833,7 @@ bool DisplayMan::setUpScreens() {
|
|||
if (!createScreen(_vm->_isHiRes))
|
||||
return false;
|
||||
|
||||
Common::File *controlFile = g_lab->_resource->openDataFile("P:Control");
|
||||
Common::File *controlFile = _vm->_resource->openDataFile("P:Control");
|
||||
for (uint16 i = 0; i < 20; i++)
|
||||
_vm->_moveImages[i] = new Image(controlFile);
|
||||
delete controlFile;
|
||||
|
@ -883,7 +883,7 @@ bool DisplayMan::setUpScreens() {
|
|||
curGadget->NextGadget = createButton(289, y, 9, 0, _vm->_moveImages[10], _vm->_moveImages[11]);
|
||||
}
|
||||
|
||||
Common::File *invFile = g_lab->_resource->openDataFile("P:Inv");
|
||||
Common::File *invFile = _vm->_resource->openDataFile("P:Inv");
|
||||
|
||||
if (_vm->getPlatform() == Common::kPlatformWindows) {
|
||||
for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++)
|
||||
|
|
|
@ -299,8 +299,8 @@ void LabEngine::changeTile(uint16 col, uint16 row) {
|
|||
}
|
||||
|
||||
bool check = true;
|
||||
row = 0;
|
||||
col = 0;
|
||||
row = 0;
|
||||
col = 0;
|
||||
|
||||
while (row < 4) {
|
||||
while (col < 4) {
|
||||
|
@ -398,23 +398,23 @@ void LabEngine::showTile(const char *filename, bool showsolution) {
|
|||
uint16 start = showsolution ? 0 : 1;
|
||||
|
||||
resetBuffer();
|
||||
g_lab->_anim->_doBlack = true;
|
||||
g_lab->_anim->_noPalChange = true;
|
||||
g_lab->_graphics->readPict(filename, true);
|
||||
g_lab->_anim->_noPalChange = false;
|
||||
g_lab->_graphics->blackScreen();
|
||||
_anim->_doBlack = true;
|
||||
_anim->_noPalChange = true;
|
||||
_graphics->readPict(filename, true);
|
||||
_anim->_noPalChange = false;
|
||||
_graphics->blackScreen();
|
||||
|
||||
Common::File *tileFile = tileFile = g_lab->_resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile");
|
||||
Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile");
|
||||
|
||||
for (uint16 curBit = start; curBit < 16; curBit++)
|
||||
Tiles[curBit] = new Image(tileFile);
|
||||
|
||||
delete tileFile;
|
||||
|
||||
allocFile((void **)&g_lab->_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata");
|
||||
allocFile((void **)&_tempScrollData, Tiles[1]->_width * Tiles[1]->_height * 2L, "tempdata");
|
||||
|
||||
g_lab->doTile(showsolution);
|
||||
g_lab->setPalette(g_lab->_anim->_diffPalette, 256);
|
||||
doTile(showsolution);
|
||||
setPalette(_anim->_diffPalette, 256);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -425,33 +425,33 @@ void LabEngine::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
|
|||
uint16 last = 0, x1, y1;
|
||||
|
||||
if (scrolltype == LEFTSCROLL) {
|
||||
dX = g_lab->_graphics->VGAScaleX(5);
|
||||
sx = g_lab->_graphics->VGAScaleX(5);
|
||||
dX = _graphics->VGAScaleX(5);
|
||||
sx = _graphics->VGAScaleX(5);
|
||||
last = 6;
|
||||
} else if (scrolltype == RIGHTSCROLL) {
|
||||
dX = g_lab->_graphics->VGAScaleX(-5);
|
||||
dx = g_lab->_graphics->VGAScaleX(-5);
|
||||
sx = g_lab->_graphics->VGAScaleX(5);
|
||||
dX = _graphics->VGAScaleX(-5);
|
||||
dx = _graphics->VGAScaleX(-5);
|
||||
sx = _graphics->VGAScaleX(5);
|
||||
last = 6;
|
||||
} else if (scrolltype == UPSCROLL) {
|
||||
dY = g_lab->_graphics->VGAScaleY(5);
|
||||
sy = g_lab->_graphics->VGAScaleY(5);
|
||||
dY = _graphics->VGAScaleY(5);
|
||||
sy = _graphics->VGAScaleY(5);
|
||||
last = 5;
|
||||
} else if (scrolltype == DOWNSCROLL) {
|
||||
dY = g_lab->_graphics->VGAScaleY(-5);
|
||||
dy = g_lab->_graphics->VGAScaleY(-5);
|
||||
sy = g_lab->_graphics->VGAScaleY(5);
|
||||
dY = _graphics->VGAScaleY(-5);
|
||||
dy = _graphics->VGAScaleY(-5);
|
||||
sy = _graphics->VGAScaleY(5);
|
||||
last = 5;
|
||||
}
|
||||
|
||||
sx += g_lab->_graphics->SVGACord(2);
|
||||
sx += _graphics->SVGACord(2);
|
||||
|
||||
x1 = g_lab->_graphics->VGAScaleX(100) + (col * g_lab->_graphics->VGAScaleX(30)) + dx;
|
||||
y1 = g_lab->_graphics->VGAScaleY(25) + (row * g_lab->_graphics->VGAScaleY(25)) + dy;
|
||||
x1 = _graphics->VGAScaleX(100) + (col * _graphics->VGAScaleX(30)) + dx;
|
||||
y1 = _graphics->VGAScaleY(25) + (row * _graphics->VGAScaleY(25)) + dy;
|
||||
|
||||
for (uint16 i = 0; i < last; i++) {
|
||||
g_lab->waitTOF();
|
||||
scrollRaster(dX, dY, x1, y1, x1 + g_lab->_graphics->VGAScaleX(28) + sx, y1 + g_lab->_graphics->VGAScaleY(23) + sy);
|
||||
waitTOF();
|
||||
scrollRaster(dX, dY, x1, y1, x1 + _graphics->VGAScaleX(28) + sx, y1 + _graphics->VGAScaleY(23) + sy);
|
||||
x1 += dX;
|
||||
y1 += dY;
|
||||
}
|
||||
|
@ -474,22 +474,22 @@ void LabEngine::changeCombination(uint16 number) {
|
|||
|
||||
combnum = combination[number];
|
||||
|
||||
display._imageData = g_lab->getCurrentDrawingBuffer();
|
||||
display._width = g_lab->_screenWidth;
|
||||
display._height = g_lab->_screenHeight;
|
||||
display._imageData = getCurrentDrawingBuffer();
|
||||
display._width = _screenWidth;
|
||||
display._height = _screenHeight;
|
||||
|
||||
for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) {
|
||||
if (g_lab->_isHiRes) {
|
||||
if (_isHiRes) {
|
||||
if (i & 1)
|
||||
g_lab->waitTOF();
|
||||
waitTOF();
|
||||
} else
|
||||
g_lab->waitTOF();
|
||||
waitTOF();
|
||||
|
||||
display._imageData = g_lab->getCurrentDrawingBuffer();
|
||||
display._imageData = getCurrentDrawingBuffer();
|
||||
|
||||
g_lab->scrollDisplayY(2, g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, g_lab->_graphics->VGAScaleY(65) + (Images[combnum])->_height);
|
||||
scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height);
|
||||
|
||||
Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), g_lab->_graphics->VGAScaleX(COMBINATION_X[number]), g_lab->_graphics->VGAScaleY(65), (Images[combnum])->_width, 2);
|
||||
Images[combnum]->bltBitMap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2);
|
||||
}
|
||||
|
||||
for (uint16 i = 0; i < 6; i++)
|
||||
|
@ -522,25 +522,25 @@ void LabEngine::doCombination() {
|
|||
/*****************************************************************************/
|
||||
void LabEngine::showCombination(const char *filename) {
|
||||
resetBuffer();
|
||||
g_lab->_anim->_doBlack = true;
|
||||
g_lab->_anim->_noPalChange = true;
|
||||
g_lab->_graphics->readPict(filename, true);
|
||||
g_lab->_anim->_noPalChange = false;
|
||||
_anim->_doBlack = true;
|
||||
_anim->_noPalChange = true;
|
||||
_graphics->readPict(filename, true);
|
||||
_anim->_noPalChange = false;
|
||||
|
||||
g_lab->_graphics->blackScreen();
|
||||
_graphics->blackScreen();
|
||||
|
||||
Common::File *numFile = g_lab->_resource->openDataFile("P:Numbers");
|
||||
Common::File *numFile = _resource->openDataFile("P:Numbers");
|
||||
|
||||
for (uint16 CurBit = 0; CurBit < 10; CurBit++)
|
||||
Images[CurBit] = new Image(numFile);
|
||||
|
||||
delete numFile;
|
||||
|
||||
allocFile((void **)&g_lab->_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata");
|
||||
allocFile((void **)&_tempScrollData, Images[0]->_width * Images[0]->_height * 2L, "tempdata");
|
||||
|
||||
doCombination();
|
||||
|
||||
g_lab->setPalette(g_lab->_anim->_diffPalette, 256);
|
||||
setPalette(_anim->_diffPalette, 256);
|
||||
}
|
||||
|
||||
} // End of namespace Lab
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue