mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-01 15:55:45 +00:00
Removed textDataPtr pointer as it's not used beyond the loadTextData function. Reworked loadTextData a bit so there are no two loops for the same thing (Also renamed some of the local variables).
svn-id: r33784
This commit is contained in:
parent
2d5a140725
commit
d6dde4b85f
@ -75,7 +75,6 @@ CineEngine::~CineEngine() {
|
||||
Common::clearAllSpecialDebugLevels();
|
||||
|
||||
free(palPtr);
|
||||
free(textDataPtr);
|
||||
}
|
||||
|
||||
int CineEngine::init() {
|
||||
@ -151,7 +150,6 @@ void CineEngine::initialize() {
|
||||
}
|
||||
|
||||
collisionPage = new byte[320 * 200];
|
||||
textDataPtr = (byte *)malloc(8000);
|
||||
|
||||
// Clear part buffer as there's nothing loaded into it yet.
|
||||
// Its size will change when loading data into it with the loadPart function.
|
||||
@ -161,7 +159,7 @@ void CineEngine::initialize() {
|
||||
readVolCnf();
|
||||
}
|
||||
|
||||
loadTextData("texte.dat", textDataPtr);
|
||||
loadTextData("texte.dat");
|
||||
|
||||
if (g_cine->getGameType() == Cine::GType_OS && !(g_cine->getFeatures() & GF_DEMO)) {
|
||||
loadPoldatDat("poldat.dat");
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
namespace Cine {
|
||||
|
||||
byte *textDataPtr;
|
||||
|
||||
const char **failureMessages;
|
||||
const CommandeType *defaultActionCommand;
|
||||
const CommandeType *systemMenu;
|
||||
@ -40,54 +38,40 @@ const char *commandPrepositionOn;
|
||||
|
||||
void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency);
|
||||
|
||||
void loadTextData(const char *pFileName, byte *pDestinationBuffer) {
|
||||
Common::File pFileHandle;
|
||||
uint16 entrySize;
|
||||
uint16 numEntry;
|
||||
uint16 i;
|
||||
byte *tempBuffer;
|
||||
uint16 dataSize;
|
||||
void loadTextData(const char *filename) {
|
||||
Common::File fileHandle;
|
||||
assert(filename);
|
||||
|
||||
assert(pFileName);
|
||||
assert(pDestinationBuffer);
|
||||
if (!fileHandle.open(filename))
|
||||
error("loadTextData(): Cannot open file %s", filename);
|
||||
|
||||
if (!pFileHandle.open(pFileName))
|
||||
error("loadTextData(): Cannot open file %s", pFileName);
|
||||
uint entrySize = fileHandle.readUint16BE();
|
||||
uint numEntry = fileHandle.readUint16BE();
|
||||
|
||||
entrySize = pFileHandle.readUint16BE();
|
||||
numEntry = pFileHandle.readUint16BE();
|
||||
|
||||
dataSize = numEntry * entrySize;
|
||||
pFileHandle.read(pDestinationBuffer, numEntry * entrySize);
|
||||
|
||||
tempBuffer = pDestinationBuffer;
|
||||
uint sourceSize = numEntry * entrySize;
|
||||
Common::Array<byte> source;
|
||||
source.resize(sourceSize);
|
||||
fileHandle.read(source.begin(), sourceSize);
|
||||
|
||||
const int fontHeight = 8;
|
||||
const int fontWidth = (g_cine->getGameType() == Cine::GType_FW) ? 16 : 8;
|
||||
uint numCharacters;
|
||||
uint bytesPerCharacter;
|
||||
if (g_cine->getGameType() == Cine::GType_FW) {
|
||||
int numCharacters;
|
||||
if (g_cine->getFeatures() & GF_ALT_FONT) {
|
||||
numCharacters = 85;
|
||||
} else {
|
||||
numCharacters = 78;
|
||||
}
|
||||
|
||||
dataSize = dataSize / numCharacters;
|
||||
|
||||
loadRelatedPalette(pFileName);
|
||||
|
||||
for (i = 0; i < numCharacters; i++) {
|
||||
gfxConvertSpriteToRaw(g_cine->_textHandler.textTable[i][0], tempBuffer, 16, 8);
|
||||
generateMask(g_cine->_textHandler.textTable[i][0], g_cine->_textHandler.textTable[i][1], 16 * 8, 0);
|
||||
tempBuffer += dataSize;
|
||||
}
|
||||
numCharacters = (g_cine->getFeatures() & GF_ALT_FONT) ? 85 : 78;
|
||||
bytesPerCharacter = sourceSize / numCharacters; // TODO: Check if this could be replaced with fontWidth * fontHeight
|
||||
loadRelatedPalette(filename);
|
||||
} else {
|
||||
for (i = 0; i < 90; i++) {
|
||||
gfxConvertSpriteToRaw(g_cine->_textHandler.textTable[i][0], tempBuffer, 8, 8);
|
||||
generateMask(g_cine->_textHandler.textTable[i][0], g_cine->_textHandler.textTable[i][1], 8 * 8, 0);
|
||||
tempBuffer += 0x40;
|
||||
}
|
||||
numCharacters = 90;
|
||||
bytesPerCharacter = fontWidth * fontHeight;
|
||||
}
|
||||
|
||||
pFileHandle.close();
|
||||
for (uint i = 0; i < numCharacters; i++) {
|
||||
gfxConvertSpriteToRaw(g_cine->_textHandler.textTable[i][0], &source[i * bytesPerCharacter], fontWidth, fontHeight);
|
||||
generateMask(g_cine->_textHandler.textTable[i][0], g_cine->_textHandler.textTable[i][1], fontWidth * fontHeight, 0);
|
||||
}
|
||||
|
||||
fileHandle.close();
|
||||
}
|
||||
|
||||
const CharacterEntry *fontParamTable;
|
||||
|
@ -33,8 +33,6 @@ namespace Cine {
|
||||
|
||||
typedef char CommandeType[20];
|
||||
|
||||
extern byte *textDataPtr;
|
||||
|
||||
struct TextHandler {
|
||||
byte textTable[256][2][16 * 8];
|
||||
};
|
||||
@ -53,7 +51,7 @@ struct CharacterEntry {
|
||||
|
||||
extern const CharacterEntry *fontParamTable;
|
||||
|
||||
void loadTextData(const char *pFileName, byte *pDestinationBuffer);
|
||||
void loadTextData(const char *filename);
|
||||
void loadErrmessDat(const char *fname);
|
||||
void freeErrmessDat(void);
|
||||
void loadPoldatDat(const char *fname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user