aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge/graphics.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sludge/graphics.h')
-rw-r--r--engines/sludge/graphics.h167
1 files changed, 165 insertions, 2 deletions
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index d866d9472a..024c8cacba 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -23,21 +23,184 @@
#ifndef SLUDGE_GRAPHICS_H
#define SLUDGE_GRAPHICS_H
+#include "graphics/surface.h"
+#include "graphics/transparent_surface.h"
+
namespace Sludge {
class Parallax;
+class SludgeEngine;
+class SpritePalette;
+
+struct stackHandler;
+struct FrozenStuffStruct;
+struct onScreenPerson;
+struct SpriteBank;
+struct Sprite;
+struct SpriteLayers;
+struct ZBufferData;
+
+enum ELightMapMode {
+ LIGHTMAPMODE_NONE = -1,
+ LIGHTMAPMODE_HOTSPOT,
+ LIGHTMAPMODE_PIXEL,
+ LIGHTMAPMODE_NUM
+};
class GraphicsManager {
public:
- GraphicsManager();
+ GraphicsManager(SludgeEngine *vm);
virtual ~GraphicsManager();
+ // graphics
+ void setWindowSize(uint winWidth, uint winHeight) { _winWidth = winWidth; _winHeight = winHeight; }
+ bool init();
+ void display();
+
// Parallax
- Parallax *_parallaxStuff;
bool loadParallax(uint16 v, uint16 fracX, uint16 fracY);
void killParallax();
void saveParallax(Common::WriteStream *fp);
void drawParallax();
+
+ // Backdrop
+ void killAllBackDrop();
+ bool resizeBackdrop(int x, int y);
+ bool killResizeBackdrop(int x, int y);
+ void killBackDrop();
+ void loadBackDrop(int fileNum, int x, int y);
+ void mixBackDrop(int fileNum, int x, int y);
+ void drawBackDrop();
+ void blankScreen(int x1, int y1, int x2, int y2);
+ void blankAllScreen();
+ void darkScreen();
+ void saveHSI(Common::WriteStream *stream);
+ bool loadHSI(Common::SeekableReadStream *stream, int, int, bool);
+ bool mixHSI(Common::SeekableReadStream *stream, int x = 0, int y = 0);
+ void drawLine(uint, uint, uint, uint);
+ void drawHorizontalLine(uint, uint, uint);
+ void drawVerticalLine(uint, uint, uint);
+ void hardScroll(int distance);
+ bool getRGBIntoStack(uint x, uint y, stackHandler *sH);
+
+ // Lightmap
+ int _lightMapMode;
+ void killLightMap();
+ bool loadLightMap(int v);
+ void saveLightMap(Common::WriteStream *stream);
+ bool loadLightMap(int ssgVersion, Common::SeekableReadStream *stream);
+
+ // Snapshot
+ void nosnapshot();
+ bool snapshot();
+ void saveSnapshot(Common::WriteStream *stream);
+ bool restoreSnapshot(Common::SeekableReadStream *stream);
+
+ // Camera
+ int getCamX() { return _cameraX; }
+ int getCamY() { return _cameraY; }
+ float getCamZoom() { return _cameraZoom; }
+ void setCamera(int camerX, int camerY, float camerZ) {
+ _cameraX = camerX;
+ _cameraY = camerY;
+ _cameraZoom = camerZ;
+ }
+ void aimCamera(int cameraX, int cameraY);
+ void zoomCamera(int z);
+
+ // Screen
+ int getCenterX(int width) { return (_winWidth - width) >> 1; }
+ int checkSizeValide(int width, int height) { return ((width >= 0) && (height >= 0) && (width < (int)_winWidth) && (height > (int)_winHeight)); }
+
+ // Freeze
+ bool freeze();
+ void unfreeze(bool killImage = true);
+ int howFrozen();
+ bool isFrozen() { return (_frozenStuff != nullptr); }
+
+ // Sprites
+ void forgetSpriteBank(SpriteBank &forgetme);
+ bool loadSpriteBank(char *filename, SpriteBank &loadhere);
+ bool loadSpriteBank(int fileNum, SpriteBank &loadhere, bool isFont);
+
+ void fontSprite(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
+ void flipFontSprite(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
+
+ bool scaleSprite(Sprite &single, const SpritePalette &fontPal, onScreenPerson *thisPerson, bool mirror);
+ void pasteSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
+ bool reserveSpritePal(SpritePalette &sP, int n);
+ void fixScaleSprite(int x1, int y1, Sprite &single, const SpritePalette &fontPal, onScreenPerson *thisPerson, const int camX, const int camY, bool);
+ void burnSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
+
+ void resetSpriteLayers(ZBufferData *ptrZBuffer, int x, int y, bool upsidedown);
+ void addSpriteDepth(Graphics::Surface *ptr, int depth, int x, int y, Graphics::FLIP_FLAGS flip, int width = -1, int height = -1, uint32 color = TS_ARGB(255, 255, 255, 255));
+ void displaySpriteLayers();
+ void killSpriteLayers();
+
+ // ZBuffer
+ bool setZBuffer(int y);
+ void killZBuffer();
+ void drawZBuffer(int x, int y, bool upsidedown);
+ void saveZBuffer(Common::WriteStream *stream);
+ bool loadZBuffer(Common::SeekableReadStream *stream);
+
+ // Colors
+ void setBlankColor(int r, int g, int b) { _currentBlankColour = _renderSurface.format.RGBToColor(r & 255, g & 255, b & 255);};
+ void setBurnColor(int r, int g, int b) {
+ _currentBurnG = r;
+ _currentBurnG = g;
+ _currentBurnB = b;
+ }
+ void saveColors(Common::WriteStream *stream);
+ void loadColors(Common::SeekableReadStream *stream);
+
+private:
+ SludgeEngine *_vm;
+
+ uint _winWidth, _winHeight, _sceneWidth, _sceneHeight;
+
+ // renderSurface
+ Graphics::Surface _renderSurface;
+
+ // Snapshot
+ Graphics::Surface _snapshotSurface;
+
+ // LightMap
+ int _lightMapNumber;
+ Graphics::Surface _lightMap;
+ byte _curLight[3];
+
+ // Parallax
+ Parallax *_parallaxStuff;
+
+ // Camera
+ float _cameraZoom;
+ int _cameraX, _cameraY;
+
+ // Freeze
+ FrozenStuffStruct *_frozenStuff;
+ Graphics::Surface _freezeSurface;
+ void freezeGraphics();
+
+ // Back drop
+ Graphics::Surface _backdropSurface;
+ Graphics::Surface _origBackdropSurface;
+ bool _backdropExists;
+ bool reserveBackdrop();
+
+ // Sprites
+ SpriteLayers *_spriteLayers;
+ void fontSprite(bool flip, int x, int y, Sprite &single, const SpritePalette &fontPal);
+ uint32 getDrawColor(onScreenPerson *thisPerson);
+
+ // ZBuffer
+ int _zBufferToSet;
+ ZBufferData *_zBuffer;
+ void sortZPal(int *oldpal, int *newpal, int size);
+
+ // Colors
+ uint _currentBlankColour;
+ byte _currentBurnR, _currentBurnG, _currentBurnB;
};
} // End of namespace Sludge