mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 05:36:12 +00:00
SLUDGE: Complete snapshot
This commit is contained in:
parent
fe1617ac51
commit
c25a6ba4af
@ -32,6 +32,8 @@
|
|||||||
#include "sludge/fileset.h"
|
#include "sludge/fileset.h"
|
||||||
#include "sludge/backdrop.h"
|
#include "sludge/backdrop.h"
|
||||||
#include "sludge/moreio.h"
|
#include "sludge/moreio.h"
|
||||||
|
#include "sludge/statusba.h"
|
||||||
|
#include "sludge/talk.h"
|
||||||
#include "sludge/zbuffer.h"
|
#include "sludge/zbuffer.h"
|
||||||
#include "sludge/graphics.h"
|
#include "sludge/graphics.h"
|
||||||
#include "sludge/sludge.h"
|
#include "sludge/sludge.h"
|
||||||
@ -61,6 +63,7 @@ extern int zBufferToSet;
|
|||||||
|
|
||||||
Graphics::Surface lightMap;
|
Graphics::Surface lightMap;
|
||||||
Graphics::Surface backdropSurface;
|
Graphics::Surface backdropSurface;
|
||||||
|
Graphics::Surface snapshotSurface;
|
||||||
|
|
||||||
float snapTexW = 1.0;
|
float snapTexW = 1.0;
|
||||||
float snapTexH = 1.0;
|
float snapTexH = 1.0;
|
||||||
@ -77,127 +80,40 @@ extern int cameraX, cameraY;
|
|||||||
extern float cameraZoom;
|
extern float cameraZoom;
|
||||||
|
|
||||||
void nosnapshot() {
|
void nosnapshot() {
|
||||||
#if 0
|
if (snapshotSurface.getPixels())
|
||||||
deleteTextures(1, &snapshotTextureName);
|
snapshotSurface.free();
|
||||||
snapshotTextureName = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSnapshot(Common::WriteStream *stream) {
|
void saveSnapshot(Common::WriteStream *stream) {
|
||||||
#if 0
|
if (snapshotSurface.getPixels()) {
|
||||||
if (snapshotTextureName) {
|
|
||||||
stream->writeByte(1); // 1 for snapshot follows
|
stream->writeByte(1); // 1 for snapshot follows
|
||||||
saveCoreHSI(stream, snapshotTextureName, winWidth, winHeight);
|
Image::writePNG(*stream, snapshotSurface);
|
||||||
} else {
|
} else {
|
||||||
stream->writeByte(0);
|
stream->writeByte(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool snapshot() {
|
bool snapshot() {
|
||||||
|
|
||||||
nosnapshot();
|
nosnapshot();
|
||||||
if (!freeze())
|
if (!freeze())
|
||||||
return false;
|
return false;
|
||||||
#if 0
|
|
||||||
setPixelCoords(true);
|
|
||||||
glGenTextures(1, &snapshotTextureName);
|
|
||||||
|
|
||||||
int w = winWidth;
|
// draw snapshot to backdrop
|
||||||
int h = winHeight;
|
displayBase();
|
||||||
if (!NPOT_textures) {
|
viewSpeech(); // ...and anything being said
|
||||||
w = getNextPOT(winWidth);
|
|
||||||
h = getNextPOT(winHeight);
|
|
||||||
snapTexW = ((double)winWidth) / w;
|
|
||||||
snapTexH = ((double)winHeight) / h;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, snapshotTextureName);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
||||||
|
|
||||||
texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, snapshotTextureName);
|
|
||||||
|
|
||||||
// Render scene
|
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear The Screen
|
|
||||||
glDepthMask(GL_FALSE);
|
|
||||||
|
|
||||||
drawBackDrop();// Draw the room
|
|
||||||
drawZBuffer(cameraX, cameraY, false);
|
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
drawPeople();// Then add any moving characters...
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
viewSpeech();// ...and anything being said
|
|
||||||
drawStatusBar();
|
drawStatusBar();
|
||||||
// Copy Our ViewPort To The Texture
|
|
||||||
copyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewportOffsetX, viewportOffsetY, winWidth, winHeight, snapshotTextureName);
|
|
||||||
|
|
||||||
setPixelCoords(false);
|
// copy backdrop to snapshot
|
||||||
#endif
|
snapshotSurface.copyFrom(backdropSurface);
|
||||||
|
|
||||||
unfreeze(false);
|
unfreeze(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool restoreSnapshot(Common::SeekableReadStream *stream) {
|
bool restoreSnapshot(Common::SeekableReadStream *stream) {
|
||||||
uint picWidth = stream->readUint16BE();
|
if (!(ImgLoader::loadImage(stream, &snapshotSurface))) {
|
||||||
uint picHeight = stream->readUint16BE();
|
|
||||||
|
|
||||||
if ((picWidth != winWidth) || (picHeight != winHeight))
|
|
||||||
return false;
|
return false;
|
||||||
#if 0
|
|
||||||
uint t1, t2, n;
|
|
||||||
uint16 c;
|
|
||||||
GLubyte *target;
|
|
||||||
if (!NPOT_textures) {
|
|
||||||
picWidth = getNextPOT(picWidth);
|
|
||||||
picHeight = getNextPOT(picHeight);
|
|
||||||
snapTexW = ((double)winWidth) / picWidth;
|
|
||||||
snapTexH = ((double)winHeight) / picHeight;
|
|
||||||
}
|
}
|
||||||
GLubyte *snapshotTexture = new GLubyte [picHeight * picWidth * 4];
|
|
||||||
if (!snapshotTexture) return fatal("Out of memory while restoring snapshot.");
|
|
||||||
|
|
||||||
for (t2 = 0; t2 < winHeight; t2++) {
|
|
||||||
t1 = 0;
|
|
||||||
while (t1 < winWidth) {
|
|
||||||
c = (uint16)stream->readUint16BE();
|
|
||||||
if (c & 32) {
|
|
||||||
n = stream->readByte() + 1;
|
|
||||||
c -= 32;
|
|
||||||
} else {
|
|
||||||
n = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (n --) {
|
|
||||||
target = snapshotTexture + 4 * picWidth * t2 + t1 * 4;
|
|
||||||
target[0] = (GLubyte) redValue(c);
|
|
||||||
target[1] = (GLubyte) greenValue(c);
|
|
||||||
target[2] = (GLubyte) blueValue(c);
|
|
||||||
target[3] = (GLubyte) 255;
|
|
||||||
t1++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!snapshotTextureName) glGenTextures(1, &snapshotTextureName);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, snapshotTextureName);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
||||||
|
|
||||||
texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, picWidth, picHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, snapshotTexture, snapshotTextureName);
|
|
||||||
|
|
||||||
delete snapshotTexture;
|
|
||||||
snapshotTexture = NULL;
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +58,6 @@ void drawBackDrop();
|
|||||||
void blankScreen(int x1, int y1, int x2, int y2);
|
void blankScreen(int x1, int y1, int x2, int y2);
|
||||||
void darkScreen();
|
void darkScreen();
|
||||||
void saveHSI(Common::WriteStream *stream);
|
void saveHSI(Common::WriteStream *stream);
|
||||||
#if 0
|
|
||||||
void saveCoreHSI(Common::WriteStream *stream, GLuint texture, int w, int h);
|
|
||||||
#endif
|
|
||||||
bool loadHSI(Common::SeekableReadStream *stream, int, int, bool);
|
bool loadHSI(Common::SeekableReadStream *stream, int, int, bool);
|
||||||
bool mixHSI(Common::SeekableReadStream *stream, int x = 0, int y = 0);
|
bool mixHSI(Common::SeekableReadStream *stream, int x = 0, int y = 0);
|
||||||
void drawHorizontalLine(uint, uint, uint);
|
void drawHorizontalLine(uint, uint, uint);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user