Commit 010316ed authored by Gerhard Stein's avatar Gerhard Stein

Performance. More static singleton and better name for graphical resources

parent 5c4c7d6f
......@@ -218,7 +218,7 @@ void CResourceLoader::renderLoadingGraphic()
if(m_style == PROGRESS_STYLE_TEXT)
{
// Draw Loading Font... here!
GsFont &Font = g_pGfxEngine->getFont(0);
GsFont &Font = gGraphics.getFont(0);
int percent = m_permil/10;
int rest = m_permil%10;
std::string text = "Loading ... " + itoa(percent)+"."+ itoa(rest)+" \%";
......@@ -234,7 +234,7 @@ void CResourceLoader::renderLoadingGraphic()
}
else if(m_style == PROGRESS_STYLE_BITMAP)
{
CBitmap &Bitmap = *g_pGfxEngine->getBitmapFromStr("ONEMOMEN");
CBitmap &Bitmap = *gGraphics.getBitmapFromStr("ONEMOMEN");
SDL_Rect rect;
int width = Bitmap.getWidth();
int height = Bitmap.getHeight();
......@@ -420,7 +420,7 @@ void CResourceLoaderBackground::render()
if(m_style == PROGRESS_STYLE_TEXT)
{
// Draw Loading Font... here!
GsFont &Font = g_pGfxEngine->getFont(0);
GsFont &Font = gGraphics.getFont(0);
int percent = m_permil/10;
int rest = m_permil%10;
std::string text = "Loading ... " + itoa(percent)+"."+ itoa(rest)+" \%";
......@@ -436,7 +436,7 @@ void CResourceLoaderBackground::render()
}
else if(m_style == PROGRESS_STYLE_BITMAP)
{
CBitmap &Bitmap = *g_pGfxEngine->getBitmapFromStr("ONEMOMEN");
CBitmap &Bitmap = *gGraphics.getBitmapFromStr("ONEMOMEN");
SDL_Rect rect;
int width = Bitmap.getWidth();
int height = Bitmap.getHeight();
......
......@@ -254,8 +254,8 @@ void CGameLauncher::start()
// Load the graphics for menu and background.
// Resources for the main menu
// This is only for the menu. We only need one fontmap for the list of games and some buttons
g_pGfxEngine->createEmptyFontmaps(1);
GsFont &Font = g_pGfxEngine->getFont(0);
gGraphics.createEmptyFontmaps(1);
GsFont &Font = gGraphics.getFont(0);
Font.loadinternalFont();
......
......@@ -75,7 +75,7 @@ void CHUD::setup(const int id)
else // Galaxy HUD
{
m_Rect.w = 80; m_Rect.h = 30;
mHUDBox = *g_pGfxEngine->getSprite(mId,"HUDBACKGROUND");
mHUDBox = *gGraphics.getSprite(mId,"HUDBACKGROUND");
#if SDL_VERSION_ATLEAST(2, 0, 0)
#else
......@@ -117,7 +117,7 @@ void CHUD::CreateVorticonBackground()
headdstrect.x = 0;
headdstrect.y = 11;
mKeenHeadSprite = g_pGfxEngine->getSprite(mId,PMAPDOWNFRAME);
mKeenHeadSprite = gGraphics.getSprite(mId,PMAPDOWNFRAME);
SDL_Surface *keenHeadSfc = mKeenHeadSprite.getSDLSurface();
......@@ -137,7 +137,7 @@ void CHUD::CreateVorticonBackground()
else if(Episode == 3) sprite = OBJ_RAY_DEFSPRITE_EP3;
// Draw the shot
mKeenGunSprite = g_pGfxEngine->getSprite(mId,sprite);
mKeenGunSprite = gGraphics.getSprite(mId,sprite);
headdstrect.w = headsrGsRect.w = mKeenGunSprite.getWidth();
headdstrect.h = headsrGsRect.h = mKeenGunSprite.getHeight();
headdstrect.x = 45-(headsrGsRect.w/2);
......@@ -166,7 +166,7 @@ void CHUD::DrawCircle(int x, int y, int width)
SDL_Rect text, outline;
Uint8 r,g,b;
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
Font.getBGColour(&r, &g, &b);
outline.x = x+4;
......@@ -227,9 +227,9 @@ void CHUD::renderGalaxy()
if(lives >= 0)
{
g_pGfxEngine->drawDigits(getRightAlignedString(itoa(score),9), 4, 4, blitsfc );
g_pGfxEngine->drawDigits(getRightAlignedString(itoa(charges),2),60, 20, blitsfc );
g_pGfxEngine->drawDigits(getRightAlignedString(itoa(lives),2), 20, 20, blitsfc );
gGraphics.drawDigits(getRightAlignedString(itoa(score),9), 4, 4, blitsfc );
gGraphics.drawDigits(getRightAlignedString(itoa(charges),2),60, 20, blitsfc );
gGraphics.drawDigits(getRightAlignedString(itoa(lives),2), 20, 20, blitsfc );
if(g_pBehaviorEngine->mPlayers > 1 && mId == CCamera::getLead())
{
......@@ -259,7 +259,7 @@ void CHUD::renderVorticon()
SDL_BlitSurface(mpBackground.get(), NULL, mpHUDBlit.get(), NULL );
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
// Draw the lives
Font.drawFont(mpHUDBlit.get(), getRightAlignedString(itoa(lives),2), 15, 15);
......
......@@ -22,7 +22,7 @@ m_animation_enabled(true),
m_Dark(false),
mNumFuses(0),
mFuseInLevel(false),
m_Tilemaps(g_pGfxEngine->getTileMaps()),
m_Tilemaps(gGraphics.getTileMaps()),
mAnimtileTimer(0.0f),
mLocked(false)
{
......
......@@ -39,7 +39,7 @@ void CSpriteObject::performCollisionsSameBox()
*/
void CSpriteObject::calcBoundingBoxes()
{
CSprite &rSprite = g_pGfxEngine->getSprite(0,sprite);
CSprite &rSprite = gGraphics.getSprite(0,sprite);
m_BBox.x1 = rSprite.m_bboxX1;
m_BBox.x2 = rSprite.m_bboxX2;
......
......@@ -121,7 +121,7 @@ void CPlayer::walkbehindexitdoor()
int frame = playerbaseframe;
if(ep == 3) frame++;
auto &sprVec = g_pGfxEngine->getSpriteVec(mSprVar);
auto &sprVec = gGraphics.getSpriteVec(mSprVar);
// set new width of all player walk frames
sprVec[frame+0].setWidth(width);
......
......@@ -399,7 +399,7 @@ void CSpriteObject::draw()
if( sprite == BLANKSPRITE || dontdraw )
return;
CSprite &Sprite = g_pGfxEngine->getSprite(mSprVar, sprite);
CSprite &Sprite = gGraphics.getSprite(mSprVar, sprite);
if(!Sprite.valid())
return;
......
......@@ -96,7 +96,7 @@ void CStatusScreen::createInventorySfcEp1(const int varSpr)
int x,t,i,j;
std::string tempbuf;
int dlgW,dlgH;
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
dlgW = 29;
dlgH = 15;
......@@ -104,9 +104,9 @@ void CStatusScreen::createInventorySfcEp1(const int varSpr)
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
CTilemap &Tilemap = g_pGfxEngine->getTileMap(1);
CTilemap &Tilemap = gGraphics.getTileMap(1);
g_pGfxEngine->drawDialogBox( p_surface, 0, 0, dlgW,dlgH, Font.getBGColour(p_surface->format, true));
gGraphics.drawDialogBox( p_surface, 0, 0, dlgW,dlgH, Font.getBGColour(p_surface->format, true));
Font.drawFont( p_surface, g_pBehaviorEngine->getString("EP1_StatusBox"), 1<<3, 1<<3, true);
// Now draw some white rects. Those are the holders for items, numbers, etc.
......@@ -206,7 +206,7 @@ void CStatusScreen::createInventorySfcEp1(const int varSpr)
if (i>6) i=6;
for(j=0;j<i;j++)
{
CSprite &Sprite = g_pGfxEngine->getSprite(varSpr,m_baseframe);
CSprite &Sprite = gGraphics.getSprite(varSpr,m_baseframe);
const int w = Sprite.getWidth();
const int h = Sprite.getHeight();
Sprite.drawSprite( p_surface, x, (0+4)<<3, w, h);
......@@ -229,7 +229,7 @@ void CStatusScreen::createInventorySfcEp2(const int varSpr)
int x,i,j;
std::string tempbuf;
int dlgW,dlgH;
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
dlgW = 29;
dlgH = 14;
......@@ -237,10 +237,10 @@ void CStatusScreen::createInventorySfcEp2(const int varSpr)
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
CTilemap &Tilemap = g_pGfxEngine->getTileMap(1);
CTilemap &Tilemap = gGraphics.getTileMap(1);
tempbuf = g_pBehaviorEngine->getString("EP2_StatusBox");
g_pGfxEngine->drawDialogBox( p_surface, 0,0,dlgW,dlgH, Font.getBGColour(true));
gGraphics.drawDialogBox( p_surface, 0,0,dlgW,dlgH, Font.getBGColour(true));
Font.drawFont( p_surface, tempbuf, (0+1)<<3, (0+1)<<3, true);
// Now draw some white rects. Those are the holders for items, numbers, etc.
......@@ -320,7 +320,7 @@ void CStatusScreen::createInventorySfcEp2(const int varSpr)
if (i>7) i=7;
for(j=0;j<i;j++)
{
CSprite &Sprite = g_pGfxEngine->getSprite(0,m_baseframe);
CSprite &Sprite = gGraphics.getSprite(0,m_baseframe);
const int w = Sprite.getWidth();
const int h = Sprite.getHeight();
Sprite.drawSprite( p_surface, x, (0+4)<<3, w, h );
......@@ -353,7 +353,7 @@ void CStatusScreen::createInventorySfcEp3(const int varSpr)
int x,i,j;
std::string tempbuf;
int dlgW,dlgH;
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
dlgW = 29;
dlgH = 13;
......@@ -361,10 +361,10 @@ void CStatusScreen::createInventorySfcEp3(const int varSpr)
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
CTilemap &Tilemap = g_pGfxEngine->getTileMap(1);
CTilemap &Tilemap = gGraphics.getTileMap(1);
tempbuf = g_pBehaviorEngine->getString("EP3_StatusBox");
g_pGfxEngine->drawDialogBox( p_surface, 0,0,dlgW,dlgH, Font.getBGColour(true));
gGraphics.drawDialogBox( p_surface, 0,0,dlgW,dlgH, Font.getBGColour(true));
Font.drawFont( p_surface, tempbuf, (0+1)<<3, (0+1)<<3, true);
// Now draw some white rects. Those are the holders for items, numbers, etc.
......@@ -451,7 +451,7 @@ void CStatusScreen::createInventorySfcEp3(const int varSpr)
if (i>7) i=7;
for(j=0;j<i;j++)
{
CSprite &Sprite = g_pGfxEngine->getSprite(0,m_baseframe);
CSprite &Sprite = gGraphics.getSprite(0,m_baseframe);
const int w = Sprite.getWidth();
const int h = Sprite.getHeight();
Sprite.drawSprite( p_surface, x, (0+4)<<3, w, h);
......
......@@ -135,7 +135,7 @@ void CGamePlayMode::render()
std::string tempbuf = "FPS: " + ftoa(gTimer.LastFPS());
SDL_FillRect(mpFPSSurface.get(),NULL,0x88888888);
g_pGfxEngine->getFont(1).drawFont(mpFPSSurface.get(), tempbuf, 1, 1, false);
gGraphics.getFont(1).drawFont(mpFPSSurface.get(), tempbuf, 1, 1, false);
SDL_BlitSurface(mpFPSSurface.get(), NULL, gVideoDriver.getBlitSurface(), &rect);
}
......
......@@ -60,7 +60,7 @@ void CDlgFrame::setPos(const Uint32 x, const Uint32 y)
void CDlgFrame::drawVorticonFrame(SDL_Surface *dst)
{
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
// first draw the blank rect
int i, j;
......
......@@ -67,7 +67,7 @@ void CDlgOptionText::setText(const std::string &text, unsigned int delimit) {
*/
void CDlgOptionText::draw(SDL_Surface *Textsurface, Uint16 x, Uint16 y, bool highlight, Uint32 colour)
{
GsFont &Font = g_pGfxEngine->getFont(m_FontMapID);
GsFont &Font = gGraphics.getFont(m_FontMapID);
//Font.setFGColour(Textsurface->format, colour);
......
......@@ -196,7 +196,7 @@ unsigned char CTextViewer::getnextwordlength(const std::string nextword)
void CTextViewer::drawTextlines()
{
for(int i=1 ; i<(m_h/m_8x8tileheight) && i<(int)m_textline.size()-m_linepos ; i++)
g_pGfxEngine->getFont(1).drawFont(mpTextVSfc.get(),
gGraphics.getFont(1).drawFont(mpTextVSfc.get(),
m_textline[i+m_linepos-1],
m_x+m_8x8tilewidth,
m_y + (i)*m_8x8tileheight-m_scrollpos,
......@@ -250,7 +250,7 @@ void CTextViewer::renderBox()
SDL_Surface *sfc = mpTextVSfc.get();
// first draw the blank rect
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
int i, j;
for(j = 0 ; j < m_h - m_8x8tileheight ; j+= m_8x8tileheight )
{
......
......@@ -25,12 +25,12 @@ CIntro::CIntro()
void CIntro::init()
{
// Load the Title Bitmap
mp_bm[0] = g_pGfxEngine->getBitmapFromStr("AN");
mp_bm[1] = g_pGfxEngine->getBitmapFromStr("APOGEE");
mp_bm[2] = g_pGfxEngine->getBitmapFromStr("PRESENT");
mp_bm[3] = g_pGfxEngine->getBitmapFromStr("OFAN");
mp_bm[4] = g_pGfxEngine->getBitmapFromStr("IDSOFT");
mp_bm[5] = g_pGfxEngine->getBitmapFromStr("PRODUCT");
mp_bm[0] = gGraphics.getBitmapFromStr("AN");
mp_bm[1] = gGraphics.getBitmapFromStr("APOGEE");
mp_bm[2] = gGraphics.getBitmapFromStr("PRESENT");
mp_bm[3] = gGraphics.getBitmapFromStr("OFAN");
mp_bm[4] = gGraphics.getBitmapFromStr("IDSOFT");
mp_bm[5] = gGraphics.getBitmapFromStr("PRODUCT");
GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
......
......@@ -31,7 +31,7 @@ void CPassive::pumpEvent(const CEvent *evPtr)
void CPassive::createOutlinedText(const int splash_x, const int splash_y, const std::string &text)
{
GsFont &Font = g_pGfxEngine->getFont(1);
GsFont &Font = gGraphics.getFont(1);
SDL_Surface *sfc = mpTextSfc.get();
SDL_PixelFormat *format = sfc->format;
......
......@@ -36,7 +36,7 @@ bool CTitle::init(int Episode)
else
gEffectController.setupEffect(new CPixelate(16));
if( (pBitmap = g_pGfxEngine->getBitmapFromStr("TITLE")) != NULL )
if( (pBitmap = gGraphics.getBitmapFromStr("TITLE")) != NULL )
{
const int width = 160-(pBitmap->getWidth()/2);
std::unique_ptr<CSpriteObject> obj(new CEGABitmap( &mMap, pSurface, pBitmap ));
......@@ -51,10 +51,10 @@ bool CTitle::init(int Episode)
if(gameRes.w == 320 && gameRes.h == 200 )
{
if( (pBitmap = g_pGfxEngine->getBitmapFromStr("F1HELP")) != NULL )
if( (pBitmap = gGraphics.getBitmapFromStr("F1HELP")) != NULL )
{
const int width = (Episode == 3) ? 128 : 96;
pBitmap = g_pGfxEngine->getBitmapFromStr("F1HELP");
pBitmap = gGraphics.getBitmapFromStr("F1HELP");
std::unique_ptr<CSpriteObject> obj(new CEGABitmap( &mMap, pSurface, pBitmap ));
obj->setScrPos( width, 182 );
pBitmap->_draw( width, 182, pSurface);
......@@ -62,7 +62,7 @@ bool CTitle::init(int Episode)
}
}
mMap.changeTileArrayY(2, 15, 2, g_pGfxEngine->getTileMap(1).EmptyBackgroundTile());
mMap.changeTileArrayY(2, 15, 2, gGraphics.getTileMap(1).EmptyBackgroundTile());
mFinished = false;
......
......@@ -68,7 +68,7 @@ bool CLevelPlay::loadLevel(const Uint16 level)
const std::string loading_text = g_pBehaviorEngine->getString(level_text);
gEffectController.setupEffect(new CDimDark(8));
gEventManager.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"),
gEventManager.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"),
loading_text, LEFT) );
mMap.drawAll();
......
......@@ -24,9 +24,9 @@ namespace galaxy
CPassiveGalaxy::CPassiveGalaxy() :
processPonderMode(&CPassiveGalaxy::processIntro),
processRenderMode(&CPassiveGalaxy::renderIntro),
m_BackgroundBitmap(*g_pGfxEngine->getBitmapFromStr("TITLE")),
mCommanderTextSfc(g_pGfxEngine->getMiscBitmap(0)),
mKeenTextSfc(g_pGfxEngine->getMiscBitmap(1))
m_BackgroundBitmap(*gGraphics.getBitmapFromStr("TITLE")),
mCommanderTextSfc(gGraphics.getMiscBitmap(0)),
mKeenTextSfc(gGraphics.getMiscBitmap(1))
{
const int episode = g_pBehaviorEngine->getEpisode();
......@@ -37,7 +37,7 @@ mKeenTextSfc(g_pGfxEngine->getMiscBitmap(1))
else
mCreditsBmpID = 23;
mCurrentLogoBmp = g_pGfxEngine->getBitmapFromId(mCreditsBmpID);
mCurrentLogoBmp = gGraphics.getBitmapFromId(mCreditsBmpID);
GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
......@@ -174,7 +174,7 @@ void CPassiveGalaxy::processIntro()
mTerminatorLogoNum++;
mTerminatorTimer = 0;
mCurrentLogoBmp = g_pGfxEngine->getBitmapFromId(mCreditsBmpID+mTerminatorLogoNum);
mCurrentLogoBmp = gGraphics.getBitmapFromId(mCreditsBmpID+mTerminatorLogoNum);
mCurrentLogoBmp.optimizeSurface();
GsRect<Uint16> logoBmpRect;
......@@ -263,7 +263,7 @@ void CPassiveGalaxy::processIntroZoom()
gInput.flushAll();
processPonderMode = &CPassiveGalaxy::processTitle;
processRenderMode = &CPassiveGalaxy::renderTitle;
m_BackgroundBitmap = *g_pGfxEngine->getBitmapFromStr("TITLE");
m_BackgroundBitmap = *gGraphics.getBitmapFromStr("TITLE");
GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
m_BackgroundBitmap.scaleTo(gameRes);
......
......@@ -300,7 +300,7 @@ void CGalaxySpriteObject::setActionSprite()
if(sprite >= 0)
{
CSprite &rSprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &rSprite = gGraphics.getSprite(mSprVar,sprite);
oldBoxY2 = rSprite.m_bboxY2;
oldBoxY1 = rSprite.m_bboxY1;
}
......@@ -312,7 +312,7 @@ void CGalaxySpriteObject::setActionSprite()
// Check the lower box for better collisions and move the sprite whether needed
CSprite &rSprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &rSprite = gGraphics.getSprite(mSprVar,sprite);
int newBoxY2 = rSprite.m_bboxY2;
int newBoxY1 = rSprite.m_bboxY1;
......
......@@ -52,7 +52,7 @@ void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
SDL_Rect Dest;
// Create upper stomp support
CBitmap &SupportBmp = g_pGfxEngine->getMaskedBitmap(2);
CBitmap &SupportBmp = gGraphics.getMaskedBitmap(2);
SDL_Rect SupportRect;
SupportRect.w = SupportBmp.getSDLSurface()->w;
......@@ -70,7 +70,7 @@ void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
SDL_FillRect( mpStatusSurface.get(), &BackRect, 0xFFAAAAAA); //gray
// Draw the cables Bitmap
CBitmap &Cables_Bitmap = g_pGfxEngine->getMaskedBitmap(1);
CBitmap &Cables_Bitmap = gGraphics.getMaskedBitmap(1);
SDL_Rect CableRect;
CableRect.w = Cables_Bitmap.getSDLSurface()->w;
CableRect.h = Cables_Bitmap.getSDLSurface()->h;
......@@ -79,7 +79,7 @@ void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
SDL_BlitSurface( Cables_Bitmap.getSDLSurface(), NULL, mpStatusSurface.get(), &Dest );
// Now draw the borders
CTilemap &Tilemap = g_pGfxEngine->getTileMap(2);
CTilemap &Tilemap = gGraphics.getTileMap(2);
// Upper Left corner
Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y, 54);
......
......@@ -38,7 +38,7 @@ void CWorldMap::init()
if(!gpSaveGameController->busy())
{
gEventManager.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
gEventManager.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
}
mMap.drawAll();
......
......@@ -25,7 +25,7 @@ CGalaxySpriteObject(pmap, foeID, x, y, 0)
solid = false;
m_ieffect = ieffect;
CSprite &rSprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &rSprite = gGraphics.getSprite(mSprVar,sprite);
int moveup = (1<<CSF)-1;
moveup -= ((rSprite.getHeight()+1)<<STC);
......
......@@ -853,7 +853,7 @@ void CPlayerLevel::processCliffClimbingUp()
{
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
const int spriteID = getSpriteIDFromAction(A_KEEN_STAND);
CSprite &standSpr = g_pGfxEngine->getSprite(mSprVar,spriteID);
CSprite &standSpr = gGraphics.getSprite(mSprVar,spriteID);
if( xDirection < 0 ) // left upper
......@@ -1433,7 +1433,7 @@ void CPlayerLevel::processExiting()
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
EventContainer.add( new EventExitLevel(mp_Map->getLevel(), true, false, mSprVar) );
gEffectController.setupEffect(new CDimDark(8));
EventContainer.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
m_Inventory.Item.m_gem.clear();
mExitTouched = true;
}
......@@ -1550,7 +1550,7 @@ void CPlayerLevel::processPressUp() {
setAction(A_KEEN_ENTER_DOOR);
setActionSprite();
CSprite &rSprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &rSprite = gGraphics.getSprite(mSprVar,sprite);
// Here the Player will be snapped to the center
......@@ -1589,7 +1589,7 @@ void CPlayerLevel::processPressUp() {
setAction(A_KEEN_ENTER_DOOR);
setActionSprite();
CSprite &rSprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &rSprite = gGraphics.getSprite(mSprVar,sprite);
// Here the Player will be snapped to the center
......@@ -1741,7 +1741,7 @@ void CPlayerLevel::processEnterDoor()
g_pSound->playSound( SOUND_LEVEL_DONE );
CEventContainer& EventContainer = gEventManager;
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
EventContainer.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
gEventManager.add( new EventExitLevel(mp_Map->getLevel(), true, mustTeleportOnMap, mSprVar) );
......@@ -1758,7 +1758,7 @@ void CPlayerLevel::processEnterDoor()
g_pSound->playSound( SOUND_LEVEL_DONE );
CEventContainer& EventContainer = gEventManager;
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
EventContainer.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
gEventManager.add( new EventExitLevel(mp_Map->getLevel(), true, false, mSprVar) );
dontdraw = true;
m_Inventory.Item.m_gem.clear();
......@@ -2617,7 +2617,7 @@ void CPlayerLevel::process()
CEventContainer& EventContainer = gEventManager;
const std::string loading_text = g_pBehaviorEngine->getString("WORLDMAP_LOAD_TEXT");
EventContainer.wait(1.0f);
EventContainer.add( new EventSendBitmapDialogMsg(*g_pGfxEngine->getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(*gGraphics.getBitmapFromStr("KEENTHUMBSUP"), loading_text, LEFT) );
gEventManager.add( new EventExitLevel(mp_Map->getLevel(), true, false, mSprVar) );
m_Inventory.Item.m_gem.clear();
m_Inventory.Item.fuse_levels_completed++;
......
......@@ -319,7 +319,7 @@ void CPlayerWM::processMoving()
// Tell the player he cannot climb yet
CEventContainer& EventContainer = gEventManager;
EventContainer.add( new EventSendBitmapDialogMsg(
g_pGfxEngine->getBitmapFromId(29),
gGraphics.getBitmapFromId(29),
g_pBehaviorEngine->getString("KEEN_ROPE_REQUIRED"), RIGHT) );
moveYDir(-(climbDir<<CSF)/2);
......@@ -434,7 +434,7 @@ void CPlayerWM::processMoving()
CEventContainer& EventContainer = gEventManager;
g_pSound->playSound( SOUND_CANT_DO, PLAY_PAUSEALL );
EventContainer.add( new EventSendBitmapDialogMsg(g_pGfxEngine->getBitmapFromId(105),
EventContainer.add( new EventSendBitmapDialogMsg(gGraphics.getBitmapFromId(105),
g_pBehaviorEngine->getString("CANT_SWIM_TEXT"), LEFT) );
m_cantswim = true;
......@@ -987,7 +987,7 @@ bool CPlayerWM::finishLevel(const int object)
VectorD2<Uint32> src(getXPosition(), getYPosition());
// Here we move the coordinates in order get it positioned correctly in the pole
CSprite &FlagSprite = g_pGfxEngine->getSprite(mSprVar,WAVING_BASEFRAME);
CSprite &FlagSprite = gGraphics.getSprite(mSprVar,WAVING_BASEFRAME);
unsigned int csfX = (x<<CSF);
unsigned int csfY = (y<<CSF);
......
......@@ -104,7 +104,7 @@ void CStunnable::draw()
m_animation_timer++;
CSprite &StarSprite = g_pGfxEngine->getSprite(mSprVar,starSprite);
CSprite &StarSprite = gGraphics.getSprite(mSprVar,starSprite);
int yoffset = (StarSprite.getHeight()<<STC);
int xoffset = (StarSprite.getWidth()<<STC);
......
......@@ -195,7 +195,7 @@ void CPlatform::draw()
if( sprite == BLANKSPRITE || dontdraw )
return;
CSprite &Sprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &Sprite = gGraphics.getSprite(mSprVar,sprite);
scrx = (m_Pos.x>>STC)-mp_Map->m_scrollx;
scry = (m_Pos.y>>STC)-mp_Map->m_scrolly;
......@@ -224,7 +224,7 @@ void CPlatform::draw()
{
if(carriedObj)
{
CSprite &playSprite = g_pGfxEngine->getSprite(carriedObj->getSpriteVariantId(),carriedObj->sprite);
CSprite &playSprite = gGraphics.getSprite(carriedObj->getSpriteVariantId(),carriedObj->sprite);
int distx = carriedObj->getXPosition()-getXPosition();
int disty = carriedObj->getYPosition()-getYPosition();
......
......@@ -102,7 +102,7 @@ void CPlatformHorizontal::draw()
if( dontdraw )
return;
CSprite &Sprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &Sprite = gGraphics.getSprite(mSprVar,sprite);
const int sprW = Sprite.getWidth();
const int sprH = Sprite.getHeight();
......@@ -117,7 +117,7 @@ void CPlatformHorizontal::draw()
int showX = scrx+Sprite.getXOffset();
int showY = scry+Sprite.getYOffset();
CSprite &fireSprite = g_pGfxEngine->getSprite(mSprVar,m_FireSprite);
CSprite &fireSprite = gGraphics.getSprite(mSprVar,m_FireSprite);
const int w = fireSprite.getWidth();
const int h = fireSprite.getHeight();
......@@ -136,7 +136,7 @@ void CPlatformHorizontal::draw()
if(!player)
continue;
CSprite &playSprite = g_pGfxEngine->getSprite(player->getSpriteVariantId(),player->sprite);
CSprite &playSprite = gGraphics.getSprite(player->getSpriteVariantId(),player->sprite);
int distx = player->getXPosition()-getXPosition();
int disty = player->getYPosition()-getYPosition();
......
......@@ -120,7 +120,7 @@ void CPlatformVertical::draw()
if( dontdraw )
return;
CSprite &Sprite = g_pGfxEngine->getSprite(mSprVar,sprite);
CSprite &Sprite = gGraphics.getSprite(mSprVar,sprite);
scrx = (m_Pos.x>>STC)-mp_Map->m_scrollx;
scry = (m_Pos.y>>STC)-mp_Map->m_scrolly;
......@@ -137,8 +137,8 @@ void CPlatformVertical::draw()
if(drawFire && dimFire)
{
CSprite &fireSpriteR = g_pGfxEngine->getSprite(mSprVar,m_FireSprite);
CSprite &fireSpriteL = g_pGfxEngine->getSprite(mSprVar,m_FireSprite+2);
CSprite &fireSpriteR = gGraphics.getSprite(mSprVar,m_FireSprite);
CSprite &fireSpriteL = gGraphics.getSprite(mSprVar,m_FireSprite+2);
const int lw = fireSpriteL.getWidth();
const int lh = fireSpriteL.getHeight();
......@@ -156,7 +156,7 @@ void CPlatformVertical::draw()
if(!player)
continue;
CSprite &playSprite = g_pGfxEngine->getSprite(player->getSpriteVariantId(),
CSprite &playSprite = gGraphics.getSprite(player->getSpriteVariantId(),
player->sprite);
int distx = player->getXPosition()-getXPosition();
int disty = player->getYPosition()-getYPosition();
......
......@@ -23,7 +23,7 @@ CMessageBoxGalaxy::CMessageBoxGalaxy(const std::string& Text) :
mMustClose(false),
mText(Text)
{
GsFont &Font = g_pGfxEngine->getFont(FONT_ID);
GsFont &Font = gGraphics.getFont(FONT_ID);
mTextHeight = Font.getPixelTextHeight()*calcNumLines(mText);
GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
......@@ -70,7 +70,7 @@ void CMessageBoxGalaxy::initGalaxyFrame()
rect.w -= 16;
rect.h -= 16;
CTilemap &Tilemap = g_pGfxEngine->getTileMap(3);
CTilemap &Tilemap = gGraphics.getTileMap(3);
/// Now draw the borders
// Upper Left corner
......@@ -104,7 +104,7 @@ void CMessageBoxGalaxy::initGalaxyFrame()
void CMessageBoxGalaxy::initText(const SDL_Rect &rect)
{
GsFont &Font = g_pGfxEngine->getFont(FONT_ID);
GsFont &Font = gGraphics.getFont(FONT_ID);
SDL_PixelFormat *format = gVideoDriver.getBlitSurface()->format;
......
......@@ -33,7 +33,7 @@ blendup(true)
mText += "\n\n";
GsFont &Font = g_pGfxEngine->getFont(FONT_ID);
GsFont &Font = gGraphics.getFont(FONT_ID);
mTextHeight = Font.getPixelTextHeight()*calcNumLines(mText);
......@@ -59,7 +59,7 @@ void CMessageBoxSelection::init()
rect.