[Scummvm-cvs-logs] SF.net SVN: scummvm:[39461] scummvm/trunk/engines/sword1
Hkz at users.sourceforge.net
Hkz at users.sourceforge.net
Mon Mar 16 23:25:37 CET 2009
Revision: 39461
http://scummvm.svn.sourceforge.net/scummvm/?rev=39461&view=rev
Author: Hkz
Date: 2009-03-16 22:25:37 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
sword1: added caching for train.plx when playing psx version
Modified Paths:
--------------
scummvm/trunk/engines/sword1/screen.cpp
scummvm/trunk/engines/sword1/screen.h
Modified: scummvm/trunk/engines/sword1/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword1/screen.cpp 2009-03-16 21:49:21 UTC (rev 39460)
+++ scummvm/trunk/engines/sword1/screen.cpp 2009-03-16 22:25:37 UTC (rev 39461)
@@ -53,6 +53,7 @@
_fadingStep = 0;
_currentScreen = 0xFFFF;
_updatePalette = false;
+ _extPlxCache = NULL;
}
Screen::~Screen(void) {
@@ -316,6 +317,10 @@
free(_screenBuf);
if (_screenGrid)
free(_screenGrid);
+ if (_extPlxCache) {
+ free(_extPlxCache);
+ _extPlxCache = NULL;
+ }
_screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
_screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
memset(_screenGrid, 0, _gridSizeX * _gridSizeY);
@@ -342,6 +347,10 @@
void Screen::quitScreen(void) {
uint8 cnt;
+ if (_extPlxCache) {
+ free(_extPlxCache);
+ _extPlxCache = NULL;
+ }
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++)
_resMan->resClose(_roomDefTable[_currentScreen].layers[cnt]);
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++)
@@ -413,14 +422,15 @@
// PSX version has parallax layer for this room in an external file (TRAIN.PLX)
if(SwordEngine::isPsx() && _currentScreen == 63) {
- Common::File parallax;
- uint8 *trainPLX = NULL;
- parallax.open("TRAIN.PLX");
- trainPLX = (uint8*) malloc(parallax.size());
- parallax.read(trainPLX, parallax.size());
- parallax.close();
- renderParallax(trainPLX);
- free(trainPLX);
+ // FIXME: this should be handled in a cleaner way...
+ if (!_extPlxCache) {
+ Common::File parallax;
+ parallax.open("TRAIN.PLX");
+ _extPlxCache = (uint8*) malloc(parallax.size());
+ parallax.read(_extPlxCache, parallax.size());
+ parallax.close();
+ }
+ renderParallax(_extPlxCache);
}
for (cnt = 0; cnt < _foreLength; cnt++)
Modified: scummvm/trunk/engines/sword1/screen.h
===================================================================
--- scummvm/trunk/engines/sword1/screen.h 2009-03-16 21:49:21 UTC (rev 39460)
+++ scummvm/trunk/engines/sword1/screen.h 2009-03-16 22:25:37 UTC (rev 39461)
@@ -144,6 +144,8 @@
bool _updatePalette;
uint16 _oldScrollX, _oldScrollY; // for drawing additional frames
+ uint8 *_extPlxCache; // Cache used for external PLX file in PSX version
+
uint32 _foreList[MAX_FORE];
uint32 _backList[MAX_BACK];
SortSpr _sortList[MAX_SORT];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list