aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/graphics.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-02 19:59:13 +1100
committerPaul Gilbert2011-10-02 19:59:13 +1100
commitf99e904f9a85c4a6876b2b68285c1a32fe80835c (patch)
treeee2cc9112b8313360586bdc0bb2b09b29d26e4a7 /engines/tsage/graphics.cpp
parentedd1ebb8204fbdfcfd65f00e182dc604e3c38998 (diff)
downloadscummvm-rg350-f99e904f9a85c4a6876b2b68285c1a32fe80835c.tar.gz
scummvm-rg350-f99e904f9a85c4a6876b2b68285c1a32fe80835c.tar.bz2
scummvm-rg350-f99e904f9a85c4a6876b2b68285c1a32fe80835c.zip
TSAGE: Added 'g' prefix to global variables
Diffstat (limited to 'engines/tsage/graphics.cpp')
-rw-r--r--engines/tsage/graphics.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 69c9995b93..4b2da0b456 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -120,7 +120,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) {
uint size;
- byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
+ byte *imgData = g_resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
GfxSurface surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -202,8 +202,8 @@ void Rect::resize(const GfxSurface &surface, int xp, int yp, int percent) {
* Expands the pane region to contain the specified Rect
*/
void Rect::expandPanes() {
- _globals->_paneRegions[0].uniteRect(*this);
- _globals->_paneRegions[1].uniteRect(*this);
+ g_globals->_paneRegions[0].uniteRect(*this);
+ g_globals->_paneRegions[1].uniteRect(*this);
}
/**
@@ -408,7 +408,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
// Write for a mouse or keypress
Event event;
- while (!_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !_vm->shouldQuit())
+ while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit())
;
// Restore the display area
@@ -423,15 +423,15 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
* Loads a quarter of a screen from a resource
*/
void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection) {
- int screenNum = _globals->_sceneManager._scene->_activeScreenNumber;
+ int screenNum = g_globals->_sceneManager._scene->_activeScreenNumber;
Rect updateRect(0, 0, 160, 100);
updateRect.translate(xHalf * 160, yHalf * 100);
- int xHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
- int yHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
+ int xHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
+ int yHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
if (xSection < xHalfCount && ySection < yHalfCount) {
int rlbNum = xSection * yHalfCount + ySection;
- byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
+ byte *data = g_resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
for (int y = 0; y < updateRect.height(); ++y) {
byte *pSrc = data + y * 160;
@@ -582,8 +582,8 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
while (tempSrc < (pSrc + destBounds.width())) {
if (!priorityRegion || !priorityRegion->contains(Common::Point(
- xp + _globals->_sceneManager._scene->_sceneBounds.left,
- destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) {
+ xp + g_globals->_sceneManager._scene->_sceneBounds.left,
+ destBounds.top + y + g_globals->_sceneManager._scene->_sceneBounds.top))) {
if (*tempSrc != src._transColor)
*tempDest = *tempSrc;
}
@@ -609,7 +609,7 @@ void GfxSurface::draw(const Common::Point &pt, Rect *rect) {
*rect = tempRect;
} else {
// Draw image
- _globals->gfxManager().copyFrom(*this, tempRect, NULL);
+ g_globals->gfxManager().copyFrom(*this, tempRect, NULL);
}
}
@@ -623,12 +623,12 @@ GfxElement::GfxElement() {
void GfxElement::setDefaults() {
_flags = 0;
- _fontNumber = _globals->_gfxFontNumber;
- _colors = _globals->_gfxColors;
- _fontColors = _globals->_fontColors;
- _color1 = _globals->_color1;
- _color2 = _globals->_color2;
- _color3 = _globals->_color3;
+ _fontNumber = g_globals->_gfxFontNumber;
+ _colors = g_globals->_gfxColors;
+ _fontColors = g_globals->_fontColors;
+ _color1 = g_globals->_color1;
+ _color2 = g_globals->_color2;
+ _color3 = g_globals->_color3;
}
/**
@@ -636,13 +636,13 @@ void GfxElement::setDefaults() {
*/
void GfxElement::highlight() {
// Get a lock on the surface
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Graphics::Surface surface = gfxManager.lockSurface();
// Scan through the contents of the element, switching any occurances of the foreground
// color with the background color and vice versa
Rect tempRect(_bounds);
- tempRect.collapse(_globals->_gfxEdgeAdjust - 1, _globals->_gfxEdgeAdjust - 1);
+ tempRect.collapse(g_globals->_gfxEdgeAdjust - 1, g_globals->_gfxEdgeAdjust - 1);
for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) {
byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp);
@@ -661,7 +661,7 @@ void GfxElement::highlight() {
*/
void GfxElement::drawFrame() {
// Get a lock on the surface and save the active font
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
gfxManager.lockSurface();
uint8 bgColor, fgColor;
@@ -674,7 +674,7 @@ void GfxElement::drawFrame() {
}
Rect tempRect = _bounds;
- tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
+ tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
tempRect.collapse(-1, -1);
gfxManager.fillRect(tempRect, _colors.background);
@@ -715,10 +715,10 @@ bool GfxElement::focusedEvent(Event &event) {
// HACK: It should use the GfxManager object to figure out the relative
// position, but for now this seems like the easiest way.
- int xOffset = mousePos.x - _globals->_events._mousePos.x;
- int yOffset = mousePos.y - _globals->_events._mousePos.y;
+ int xOffset = mousePos.x - g_globals->_events._mousePos.x;
+ int yOffset = mousePos.y - g_globals->_events._mousePos.y;
- while (event.eventType != EVENT_BUTTON_UP && !_vm->shouldQuit()) {
+ while (event.eventType != EVENT_BUTTON_UP && !g_vm->shouldQuit()) {
g_system->delayMillis(10);
if (_bounds.contains(mousePos)) {
@@ -733,7 +733,7 @@ bool GfxElement::focusedEvent(Event &event) {
highlight();
}
- if (_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
+ if (g_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
if (event.eventType == EVENT_MOUSE_MOVE) {
mousePos.x = event.mousePos.x + xOffset;
mousePos.y = event.mousePos.y + yOffset;
@@ -769,7 +769,7 @@ void GfxImage::setDefaults() {
// Decode the image
uint size;
- byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
+ byte *imgData = g_resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
_surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -781,9 +781,9 @@ void GfxImage::setDefaults() {
void GfxImage::draw() {
Rect tempRect = _bounds;
- tempRect.translate(_globals->gfxManager()._topLeft.x, _globals->gfxManager()._topLeft.y);
+ tempRect.translate(g_globals->gfxManager()._topLeft.x, g_globals->gfxManager()._topLeft.y);
- _globals->gfxManager().copyFrom(_surface, tempRect);
+ g_globals->gfxManager().copyFrom(_surface, tempRect);
}
/*--------------------------------------------------------------------------*/
@@ -805,7 +805,7 @@ void GfxMessage::setDefaults() {
GfxElement::setDefaults();
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Rect tempRect;
gfxManager._font.setFontNumber(this->_fontNumber);
@@ -818,7 +818,7 @@ void GfxMessage::setDefaults() {
void GfxMessage::draw() {
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
// Set the font and color
gfxManager.setFillFlag(false);
@@ -838,7 +838,7 @@ void GfxButton::setDefaults() {
GfxElement::setDefaults();
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Rect tempRect;
// Get the string bounds and round up the x end to a multiple of 16
@@ -847,8 +847,8 @@ void GfxButton::setDefaults() {
tempRect.right = ((tempRect.right + 15) / 16) * 16;
// Set the button bounds
- tempRect.collapse(-_globals->_gfxEdgeAdjust, -_globals->_gfxEdgeAdjust);
- if (_vm->getFeatures() & GF_CD)
+ tempRect.collapse(-g_globals->_gfxEdgeAdjust, -g_globals->_gfxEdgeAdjust);
+ if (g_vm->getFeatures() & GF_CD)
--tempRect.top;
tempRect.moveTo(_bounds.left, _bounds.top);
_bounds = tempRect;
@@ -857,7 +857,7 @@ void GfxButton::setDefaults() {
void GfxButton::draw() {
// Get a lock on the surface and save the active font
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
gfxManager.lockSurface();
// Draw a basic frame for the button
@@ -873,8 +873,8 @@ void GfxButton::draw() {
// Display the button's text
Rect tempRect(_bounds);
- tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
- if (_vm->getFeatures() & GF_CD)
+ tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
+ if (g_vm->getFeatures() & GF_CD)
++tempRect.top;
gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER);
@@ -936,14 +936,14 @@ void GfxDialog::setDefaults() {
// Set the dialog boundaries
_gfxManager._bounds = tempRect;
- tempRect.collapse(-_globals->_gfxEdgeAdjust * 2, -_globals->_gfxEdgeAdjust * 2);
+ tempRect.collapse(-g_globals->_gfxEdgeAdjust * 2, -g_globals->_gfxEdgeAdjust * 2);
_bounds = tempRect;
}
void GfxDialog::remove() {
if (_savedArea) {
// Restore the area the dialog covered
- _globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
+ g_globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
delete _savedArea;
_savedArea = NULL;
@@ -954,7 +954,7 @@ void GfxDialog::draw() {
Rect tempRect(_bounds);
// Make a backup copy of the area the dialog will occupy
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Set the palette for use in the dialog
setPalette();
@@ -966,7 +966,7 @@ void GfxDialog::draw() {
drawFrame();
// Reset the dialog's graphics manager to only draw within the dialog boundaries
- tempRect.translate(_globals->_gfxEdgeAdjust * 2, _globals->_gfxEdgeAdjust * 2);
+ tempRect.translate(g_globals->_gfxEdgeAdjust * 2, g_globals->_gfxEdgeAdjust * 2);
_gfxManager._bounds = tempRect;
// Draw each element in the dialog in order
@@ -1003,7 +1003,7 @@ void GfxDialog::addElements(GfxElement *ge, ...) {
}
void GfxDialog::setTopLeft(int xp, int yp) {
- _bounds.moveTo(xp - _globals->_gfxEdgeAdjust * 2, yp - _globals->_gfxEdgeAdjust * 2);
+ _bounds.moveTo(xp - g_globals->_gfxEdgeAdjust * 2, yp - g_globals->_gfxEdgeAdjust * 2);
}
void GfxDialog::setCenter(int xp, int yp) {
@@ -1029,9 +1029,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
GfxButton *selectedButton = NULL;
bool breakFlag = false;
- while (!_vm->shouldQuit() && !breakFlag) {
+ while (!g_vm->shouldQuit() && !breakFlag) {
Event event;
- while (_globals->_events.getEvent(event) && !breakFlag) {
+ while (g_globals->_events.getEvent(event) && !breakFlag) {
// Adjust mouse positions to be relative within the dialog
event.mousePos.x -= _gfxManager._bounds.left;
event.mousePos.y -= _gfxManager._bounds.top;
@@ -1069,28 +1069,28 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
}
void GfxDialog::setPalette() {
- if (_vm->getGameID() == GType_BlueForce) {
- _globals->_scenePalette.loadPalette(2);
- _globals->_scenePalette.setPalette(0, 1);
- _globals->_scenePalette.setPalette(_globals->_gfxColors.background, 1);
- _globals->_scenePalette.setPalette(_globals->_gfxColors.foreground, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
- _globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff);
- _globals->_scenePalette.setPalette(255, 1);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ g_globals->_scenePalette.loadPalette(2);
+ g_globals->_scenePalette.setPalette(0, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_gfxColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_gfxColors.foreground, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
+ g_globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff);
+ g_globals->_scenePalette.setPalette(255, 1);
} else {
- _globals->_scenePalette.loadPalette(0);
- _globals->_scenePalette.setPalette(0, 1);
- _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
- _globals->_scenePalette.setPalette(255, 1);
+ g_globals->_scenePalette.loadPalette(0);
+ g_globals->_scenePalette.setPalette(0, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_scenePalette._colors.foreground, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
+ g_globals->_scenePalette.setPalette(255, 1);
}
}
/*--------------------------------------------------------------------------*/
-GfxManager::GfxManager() : _surface(_globals->_screenSurface), _oldManager(NULL) {
+GfxManager::GfxManager() : _surface(g_globals->_screenSurface), _oldManager(NULL) {
_font.setOwner(this);
_font._fillFlag = false;
_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -1109,19 +1109,19 @@ void GfxManager::setDefaults() {
_pane0Rect4 = screenBounds;
_font._edgeSize = Common::Point(1, 1);
- _font._colors = _globals->_fontColors;
- _font.setFontNumber(_globals->_gfxFontNumber);
+ _font._colors = g_globals->_fontColors;
+ _font.setFontNumber(g_globals->_gfxFontNumber);
}
void GfxManager::activate() {
- assert(!contains(_globals->_gfxManagers, this));
- _globals->_gfxManagers.push_front(this);
+ assert(!contains(g_globals->_gfxManagers, this));
+ g_globals->_gfxManagers.push_front(this);
}
void GfxManager::deactivate() {
// Assert that there will still be another manager, and we're correctly removing our own
- assert((_globals->_gfxManagers.size() > 1) && (&_globals->gfxManager() == this));
- _globals->_gfxManagers.pop_front();
+ assert((g_globals->_gfxManagers.size() > 1) && (&g_globals->gfxManager() == this));
+ g_globals->_gfxManagers.pop_front();
}
int GfxManager::getStringWidth(const char *s, int numChars) {
@@ -1159,7 +1159,7 @@ void GfxManager::setDialogPalette() {
// Get the main palette information
byte palData[256 * 3];
uint count, start;
- _resourceManager->getPalette(0, &palData[0], &start, &count);
+ g_resourceManager->getPalette(0, &palData[0], &start, &count);
g_system->getPaletteManager()->setPalette(&palData[0], start, count);
// Miscellaneous
@@ -1194,7 +1194,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) {
GfxFont::GfxFont() {
- _fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50;
+ _fontNumber = (g_vm->getFeatures() & GF_DEMO) ? 0 : 50;
_numChars = 0;
_bpp = 0;
_fontData = NULL;
@@ -1218,9 +1218,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) {
_fontNumber = fontNumber;
- _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
+ _fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
if (!_fontData)
- _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0);
+ _fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0);
_numChars = READ_LE_UINT16(_fontData + 4);
_fontSize.y = READ_LE_UINT16(_fontData + 6);
@@ -1509,17 +1509,17 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) {
/*--------------------------------------------------------------------------*/
GfxFontBackup::GfxFontBackup() {
- _edgeSize = _globals->gfxManager()._font._edgeSize;
- _position = _globals->gfxManager()._font._position;
- _colors = _globals->gfxManager()._font._colors;
- _fontNumber = _globals->gfxManager()._font._fontNumber;
+ _edgeSize = g_globals->gfxManager()._font._edgeSize;
+ _position = g_globals->gfxManager()._font._position;
+ _colors = g_globals->gfxManager()._font._colors;
+ _fontNumber = g_globals->gfxManager()._font._fontNumber;
}
GfxFontBackup::~GfxFontBackup() {
- _globals->gfxManager()._font.setFontNumber(_fontNumber);
- _globals->gfxManager()._font._edgeSize = _edgeSize;
- _globals->gfxManager()._font._position = _position;
- _globals->gfxManager()._font._colors = _colors;
+ g_globals->gfxManager()._font.setFontNumber(_fontNumber);
+ g_globals->gfxManager()._font._edgeSize = _edgeSize;
+ g_globals->gfxManager()._font._position = _position;
+ g_globals->gfxManager()._font._colors = _colors;
}