[Scummvm-cvs-logs] CVS: residual bitmap.cpp,1.16,1.17 driver_gl.cpp,1.6,1.7 driver_gl.h,1.4,1.5 engine.cpp,1.17,1.18 smush.cpp,1.26,1.27 smush.h,1.11,1.12
Pawel Kolodziejski
aquadran at users.sourceforge.net
Sun Feb 29 10:57:01 CET 2004
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26550
Modified Files:
bitmap.cpp driver_gl.cpp driver_gl.h engine.cpp smush.cpp
smush.h
Log Message:
- some indent cleanup
- came back overlay smush
- fixed smush sound
Index: bitmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- bitmap.cpp 24 Feb 2004 08:20:44 -0000 1.16
+++ bitmap.cpp 29 Feb 2004 18:38:25 -0000 1.17
@@ -50,11 +50,10 @@
if (codec == 0) {
memcpy(data_[i], data + pos, 2 * width_ * height_);
pos += 2 * width_ * height_ + 8;
- }
- else if (codec == 3) {
- int compressed_len = READ_LE_UINT32(data + pos);
- decompress_codec3(data + pos + 4, data_[i]);
- pos += compressed_len + 12;
+ } else if (codec == 3) {
+ int compressed_len = READ_LE_UINT32(data + pos);
+ decompress_codec3(data + pos + 4, data_[i]);
+ pos += compressed_len + 12;
}
}
@@ -117,7 +116,7 @@
// For now, just keep this here :-)
glDisable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
- }
+}
void Bitmap::draw() const {
if (format_ == 1) { // Normal image
@@ -158,7 +157,7 @@
return;
g_driver->drawDepthBitmap(curr_image_, x_, y_, width_, height_, data_);
- }
+ }
}
Bitmap::~Bitmap() {
Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- driver_gl.cpp 25 Feb 2004 05:52:47 -0000 1.6
+++ driver_gl.cpp 29 Feb 2004 18:38:26 -0000 1.7
@@ -71,7 +71,8 @@
}
#endif
- }
+ _smushNumTex = 0;
+}
void Driver::setupCamera(float fov, float nclip, float fclip, float roll) {
// Set perspective transformation
@@ -87,7 +88,7 @@
Vector3d up_vec(0, 0, 1);
glRotatef(roll, 0, 0, -1);
- }
+}
void Driver::positionCamera(Vector3d pos, Vector3d interest) {
Vector3d up_vec(0, 0, 1);
@@ -163,18 +164,21 @@
glPopMatrix();
}
-// drawSMUSHframe, used for quickly pushing full-screen images from cutscenes
-void Driver::drawSMUSHframe(int offsetX, int offsetY, int _width, int _height, uint8 *_dst) {
- int num_tex_;
- GLuint *tex_ids_;
+void Driver::prepareSmushFrame(int width, int height, byte *bitmap) {
+ // remove if already exist
+ if (_smushNumTex > 0) {
+ glDeleteTextures(_smushNumTex, _smushTexIds);
+ delete[] _smushTexIds;
+ _smushNumTex = 0;
+ }
// create texture
- num_tex_ = ((_width + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
- ((_height + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
- tex_ids_ = new GLuint[num_tex_];
- glGenTextures(num_tex_, tex_ids_);
- for (int i = 0; i < num_tex_; i++) {
- glBindTexture(GL_TEXTURE_2D, tex_ids_[i]);
+ _smushNumTex = ((width + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
+ ((height + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
+ _smushTexIds = new GLuint[_smushNumTex];
+ glGenTextures(_smushNumTex, _smushTexIds);
+ for (int i = 0; i < _smushNumTex; i++) {
+ glBindTexture(GL_TEXTURE_2D, _smushTexIds[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -185,30 +189,31 @@
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, _width);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
- int cur_tex_idx = 0;
- for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
- for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
- int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
- int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
- glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
+ int curTexIdx = 0;
+ for (int y = 0; y < height; y += BITMAP_TEXTURE_SIZE) {
+ for (int x = 0; x < width; x += BITMAP_TEXTURE_SIZE) {
+ int t_width = (x + BITMAP_TEXTURE_SIZE >= width) ? (width - x) : BITMAP_TEXTURE_SIZE;
+ int t_height = (y + BITMAP_TEXTURE_SIZE >= height) ? (height - y) : BITMAP_TEXTURE_SIZE;
+ glBindTexture(GL_TEXTURE_2D, _smushTexIds[curTexIdx]);
glTexSubImage2D(GL_TEXTURE_2D,
0,
0, 0,
- width, height,
+ t_width, t_height,
GL_RGB,
GL_UNSIGNED_SHORT_5_6_5,
- _dst + (y * 2 * _width) + (2 * x));
- cur_tex_idx++;
+ bitmap + (y * 2 * width) + (2 * x));
+ curTexIdx++;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ _smushWidth = width;
+ _smushHeight = height;
+}
-// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
+void Driver::drawSmushFrame(int offsetX, int offsetY) {
// prepare view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -228,14 +233,14 @@
glDepthMask(GL_FALSE);
glEnable(GL_SCISSOR_TEST);
- offsetY = 480 - offsetY - _height;
- cur_tex_idx = 0;
- for (int y = 0; y < _height; y += BITMAP_TEXTURE_SIZE) {
- for (int x = 0; x < _width; x += BITMAP_TEXTURE_SIZE) {
- int width = (x + BITMAP_TEXTURE_SIZE >= _width) ? (_width - x) : BITMAP_TEXTURE_SIZE;
- int height = (y + BITMAP_TEXTURE_SIZE >= _height) ? (_height - y) : BITMAP_TEXTURE_SIZE;
- glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
- glScissor(x, 480 - (y + height), x + width, 480 - y);
+ offsetY = 480 - offsetY - _smushHeight;
+ int curTexIdx = 0;
+ for (int y = 0; y < _smushHeight; y += BITMAP_TEXTURE_SIZE) {
+ for (int x = 0; x < _smushWidth; x += BITMAP_TEXTURE_SIZE) {
+ int t_width = (x + BITMAP_TEXTURE_SIZE >= _smushWidth) ? (_smushWidth - x) : BITMAP_TEXTURE_SIZE;
+ int t_height = (y + BITMAP_TEXTURE_SIZE >= _smushHeight) ? (_smushHeight - y) : BITMAP_TEXTURE_SIZE;
+ glBindTexture(GL_TEXTURE_2D, _smushTexIds[curTexIdx]);
+ glScissor(x, 480 - (y + t_height), x + t_width, 480 - y);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@@ -247,7 +252,7 @@
glTexCoord2f(0.0, 1.0);
glVertex2i(x, y + BITMAP_TEXTURE_SIZE);
glEnd();
- cur_tex_idx++;
+ curTexIdx++;
}
}
@@ -255,8 +260,4 @@
glDisable(GL_TEXTURE_2D);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
-
- // remove
- glDeleteTextures(num_tex_, tex_ids_);
- delete[] tex_ids_;
}
Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- driver_gl.h 24 Feb 2004 21:09:53 -0000 1.4
+++ driver_gl.h 29 Feb 2004 18:38:26 -0000 1.5
@@ -43,11 +43,16 @@
void drawBitmap();
void drawHackFont(int x, int y, const char *text, Color &fgColor);
- void drawSMUSHframe(int offsetX, int offsetY, int _width, int _height, uint8 *_dst);
+
+ void prepareSmushFrame(int width, int height, byte *bitmap);
+ void drawSmushFrame(int offsetX, int offsetY);
private:
GLuint hackFont; // FIXME: Temporary font drawing hack
-
+ int _smushNumTex;
+ GLuint *_smushTexIds;
+ int _smushWidth;
+ int _smushHeight;
};
extern Driver *g_driver;
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- engine.cpp 25 Feb 2004 05:52:47 -0000 1.17
+++ engine.cpp 29 Feb 2004 18:38:26 -0000 1.18
@@ -77,57 +77,62 @@
if (event.type == SDL_KEYDOWN) {
if (event.key.keysym.sym == SDLK_q)
return;
+ }
}
- }
- // Run asynchronous tasks
- lua_runtasks();
- if (SCREENBLOCKS_GLOBAL == 1)
- screenBlocksReset();
+ // Run asynchronous tasks
+ lua_runtasks();
- // Update actor costumes
- for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
- Actor *a = *i;
- assert(currScene_);
- if (a->inSet(currScene_->name()) && a->visible())
- a->update();
- }
+ if (SCREENBLOCKS_GLOBAL == 1)
+ screenBlocksReset();
+
+ // Update actor costumes
+ for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
+ Actor *a = *i;
+ assert(currScene_);
+ if (a->inSet(currScene_->name()) && a->visible())
+ a->update();
+ }
- if (g_smush->isPlaying()) {
- if (g_smush->isUpdateNeeded()) {
- g_driver->clearScreen();
- g_driver->drawSMUSHframe(g_smush->getX(), g_smush->getY(), g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr());
- g_smush->clearUpdateNeeded();
- }
- } else {
- glMatrixMode(GL_MODELVIEW);
g_driver->clearScreen();
if (SCREENBLOCKS_GLOBAL == 1)
screenBlocksBlitDirtyBlocks();
- Bitmap::prepareDraw();
- if (currScene_ != NULL)
- currScene_->drawBackground();
+ if (!g_smush->isPlaying() || (g_smush->isPlaying() && !g_smush->isFullSize())) {
+ Bitmap::prepareDraw();
+ if (currScene_ != NULL)
+ currScene_->drawBackground();
+ }
+
+ if (g_smush->isPlaying()) {
+ if (g_smush->isUpdateNeeded()) {
+ g_driver->prepareSmushFrame(g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr());
+ g_smush->clearUpdateNeeded();
+ }
+ g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY());
+ }
+
+ glMatrixMode(GL_MODELVIEW);
glEnable(GL_DEPTH_TEST);
if (currScene_ != NULL)
currScene_->setupCamera();
// Draw actors
- glEnable(GL_TEXTURE_2D);
- for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
- Actor *a = *i;
- if (a->inSet(currScene_->name()) && a->visible())
- a->draw();
+ if (!g_smush->isPlaying() || (g_smush->isPlaying() && !g_smush->isFullSize())) {
+ glEnable(GL_TEXTURE_2D);
+ for (actor_list_type::iterator i = actors_.begin(); i != actors_.end(); i++) {
+ Actor *a = *i;
+ if (a->inSet(currScene_->name()) && a->visible())
+ a->draw();
+ }
+ glDisable(GL_TEXTURE_2D);
+ //screenBlocksDrawDebug();
}
- glDisable(GL_TEXTURE_2D);
- //screenBlocksDrawDebug();
- }
- // Draw text
- for (text_list_type::iterator i = textObjects_.begin();
- i != textObjects_.end(); i++) {
+ // Draw text
+ for (text_list_type::iterator i = textObjects_.begin(); i != textObjects_.end(); i++) {
(*i)->draw();
}
Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- smush.cpp 25 Feb 2004 08:21:30 -0000 1.26
+++ smush.cpp 29 Feb 2004 18:38:26 -0000 1.27
@@ -118,7 +118,11 @@
handleBlocky16(frame + pos + 8);
pos += READ_BE_UINT32(frame + pos + 4) + 8;
} else if (READ_BE_UINT32(frame + pos) == MKID_BE('Wave')) {
-// handleWave(frame + pos + 8 + 4, READ_BE_UINT32(frame + pos + 8));
+ int decompressed_size = READ_BE_UINT32(frame + pos + 8);
+ if (decompressed_size < 0)
+ handleWave(frame + pos + 8 + 4 + 8, READ_BE_UINT32(frame + pos + 8 + 8));
+ else
+ handleWave(frame + pos + 8 + 4, decompressed_size);
pos += READ_BE_UINT32(frame + pos + 4) + 8;
} else {
error("unknown tag");
Index: smush.h
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- smush.h 25 Feb 2004 08:21:30 -0000 1.11
+++ smush.h 29 Feb 2004 18:38:26 -0000 1.12
@@ -131,6 +131,7 @@
int getWidth() {return _width; }
int getHeight() { return _height; }
void clearUpdateNeeded() { _updateNeeded = false; }
+ bool isFullSize() { return (_width == 640 && _height == 480); }
private:
static void timerCallback(void *ptr);
More information about the Scummvm-git-logs
mailing list