TRECISION: Amiga files are big-endian
This commit is contained in:
parent
49c4c26b44
commit
229d9415a0
15 changed files with 189 additions and 181 deletions
|
@ -2073,19 +2073,19 @@ void PathFinding3D::initSortPan() {
|
|||
}
|
||||
}
|
||||
|
||||
void PathFinding3D::read3D(Common::SeekableReadStream *ff) {
|
||||
void PathFinding3D::read3D(Common::SeekableReadStreamEndian *ff) {
|
||||
// read panels
|
||||
_panelNum = ff->readSint32LE();
|
||||
_panelNum = ff->readSint32();
|
||||
if (_panelNum > MAXPANELSINROOM)
|
||||
error("read3D(): Too many panels");
|
||||
|
||||
for (int i = 0; i < _panelNum; ++i) {
|
||||
_panel[i]._x1 = ff->readFloatLE();
|
||||
_panel[i]._z1 = ff->readFloatLE();
|
||||
_panel[i]._x2 = ff->readFloatLE();
|
||||
_panel[i]._z2 = ff->readFloatLE();
|
||||
_panel[i]._h = ff->readFloatLE();
|
||||
_panel[i]._flags = ff->readUint32LE();
|
||||
_panel[i]._x1 = ff->readFloat();
|
||||
_panel[i]._z1 = ff->readFloat();
|
||||
_panel[i]._x2 = ff->readFloat();
|
||||
_panel[i]._z2 = ff->readFloat();
|
||||
_panel[i]._h = ff->readFloat();
|
||||
_panel[i]._flags = ff->readUint32();
|
||||
|
||||
// Note : Despite the panels are stored in an int16 with a MAXPANELSINROOM set to 400,
|
||||
// _panelNum is stored in a int32 and nearPanel1 and 2 were stored in an int8
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
void goToPosition(int num);
|
||||
int nextStep();
|
||||
void initSortPan();
|
||||
void read3D(Common::SeekableReadStream *ff);
|
||||
void read3D(Common::SeekableReadStreamEndian *ff);
|
||||
void reset(uint16 idx, float px, float pz, float theta);
|
||||
void whereIs(int px, int py);
|
||||
void actorOrder();
|
||||
|
|
|
@ -309,50 +309,50 @@ void Actor::microproseHeadFix(uint32 actionNum) {
|
|||
}
|
||||
|
||||
void Actor::readModel(const char *filename) {
|
||||
Common::SeekableReadStream *ff = _vm->_dataFile.createReadStreamForMember(filename);
|
||||
Common::SeekableReadStreamEndian *ff = _vm->readEndian(_vm->_dataFile.createReadStreamForMember(filename));
|
||||
if (ff == nullptr)
|
||||
error("readModel - Error opening file %s", filename);
|
||||
|
||||
uint32 actionNum = ff->readUint32LE();
|
||||
_vertexNum = ff->readUint32LE();
|
||||
uint32 actionNum = ff->readUint32();
|
||||
_vertexNum = ff->readUint32();
|
||||
|
||||
_characterArea = new SVertex[_vertexNum * actionNum];
|
||||
for (uint i = 0; i < _vertexNum * actionNum; ++i) {
|
||||
_characterArea[i]._x = ff->readFloatLE();
|
||||
_characterArea[i]._y = ff->readFloatLE();
|
||||
_characterArea[i]._z = ff->readFloatLE();
|
||||
_characterArea[i]._nx = ff->readFloatLE();
|
||||
_characterArea[i]._ny = ff->readFloatLE();
|
||||
_characterArea[i]._nz = ff->readFloatLE();
|
||||
_characterArea[i]._x = ff->readFloat();
|
||||
_characterArea[i]._y = ff->readFloat();
|
||||
_characterArea[i]._z = ff->readFloat();
|
||||
_characterArea[i]._nx = ff->readFloat();
|
||||
_characterArea[i]._ny = ff->readFloat();
|
||||
_characterArea[i]._nz = ff->readFloat();
|
||||
}
|
||||
_vertex = _characterArea;
|
||||
_faceNum = ff->readUint32LE();
|
||||
_faceNum = ff->readUint32();
|
||||
delete ff;
|
||||
|
||||
ff = _vm->_dataFile.createReadStreamForMember("mat.tex");
|
||||
ff = _vm->readEndian(_vm->_dataFile.createReadStreamForMember("mat.tex"));
|
||||
if (ff == nullptr)
|
||||
error("readModel - Error opening file mat.tex");
|
||||
|
||||
for (uint16 i = 0; i < 256; ++i) {
|
||||
for (uint16 j = 0; j < 91; ++j)
|
||||
_textureMat[i][j] = ff->readUint16LE();
|
||||
_textureMat[i][j] = ff->readUint16();
|
||||
}
|
||||
|
||||
_vm->_graphicsMgr->updatePixelFormat((uint16 *)_textureMat, 91 * 256);
|
||||
|
||||
for (uint16 i = 0; i < MAXFACE; ++i) {
|
||||
for (uint16 j = 0; j < 3; ++j) {
|
||||
_textureCoord[i][j][0] = ff->readSint16LE();
|
||||
_textureCoord[i][j][1] = ff->readSint16LE();
|
||||
_textureCoord[i][j][0] = ff->readSint16();
|
||||
_textureCoord[i][j][1] = ff->readSint16();
|
||||
}
|
||||
}
|
||||
|
||||
_face = new SFace[_faceNum];
|
||||
for (uint i = 0; i < _faceNum; ++i) {
|
||||
_face[i]._a = ff->readUint16LE();
|
||||
_face[i]._b = ff->readUint16LE();
|
||||
_face[i]._c = ff->readUint16LE();
|
||||
_face[i]._mat = ff->readUint16LE();
|
||||
_face[i]._a = ff->readUint16();
|
||||
_face[i]._b = ff->readUint16();
|
||||
_face[i]._c = ff->readUint16();
|
||||
_face[i]._mat = ff->readUint16();
|
||||
}
|
||||
|
||||
delete ff;
|
||||
|
@ -444,34 +444,34 @@ void Actor::actorStop() {
|
|||
_vm->_pathFind->_lastStep = 0;
|
||||
}
|
||||
|
||||
void Actor::read3D(Common::SeekableReadStream *ff) {
|
||||
void Actor::read3D(Common::SeekableReadStreamEndian *ff) {
|
||||
// read rooms and lights
|
||||
SCamera *cam = _camera;
|
||||
cam->_ex = ff->readFloatLE();
|
||||
cam->_ey = ff->readFloatLE();
|
||||
cam->_ez = ff->readFloatLE();
|
||||
cam->_ex = ff->readFloat();
|
||||
cam->_ey = ff->readFloat();
|
||||
cam->_ez = ff->readFloat();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
cam->_e1[i] = ff->readFloatLE();
|
||||
cam->_e1[i] = ff->readFloat();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
cam->_e2[i] = ff->readFloatLE();
|
||||
cam->_e2[i] = ff->readFloat();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
cam->_e3[i] = ff->readFloatLE();
|
||||
cam->_fovX = ff->readFloatLE();
|
||||
cam->_fovY = ff->readFloatLE();
|
||||
cam->_e3[i] = ff->readFloat();
|
||||
cam->_fovX = ff->readFloat();
|
||||
cam->_fovY = ff->readFloat();
|
||||
|
||||
_lightNum = ff->readUint32LE();
|
||||
_lightNum = ff->readUint32();
|
||||
if (_lightNum > MAXLIGHT)
|
||||
error("read3D(): Too many lights");
|
||||
|
||||
for (uint32 i = 0; i < _lightNum; ++i) {
|
||||
_light[i]._x = ff->readFloatLE();
|
||||
_light[i]._y = ff->readFloatLE();
|
||||
_light[i]._z = ff->readFloatLE();
|
||||
_light[i]._dx = ff->readFloatLE();
|
||||
_light[i]._dy = ff->readFloatLE();
|
||||
_light[i]._dz = ff->readFloatLE();
|
||||
_light[i]._inr = ff->readFloatLE();
|
||||
_light[i]._outr = ff->readFloatLE();
|
||||
_light[i]._x = ff->readFloat();
|
||||
_light[i]._y = ff->readFloat();
|
||||
_light[i]._z = ff->readFloat();
|
||||
_light[i]._dx = ff->readFloat();
|
||||
_light[i]._dy = ff->readFloat();
|
||||
_light[i]._dz = ff->readFloat();
|
||||
_light[i]._inr = ff->readFloat();
|
||||
_light[i]._outr = ff->readFloat();
|
||||
_light[i]._hotspot = ff->readByte();
|
||||
_light[i]._fallOff = ff->readByte();
|
||||
_light[i]._inten = ff->readSByte();
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
void syncGameStream(Common::Serializer &ser);
|
||||
void actorDoAction(int action);
|
||||
void actorStop();
|
||||
void read3D(Common::SeekableReadStream *ff);
|
||||
void read3D(Common::SeekableReadStreamEndian *ff);
|
||||
float frameCenter(SVertex *v);
|
||||
void updateStepSound();
|
||||
};
|
||||
|
|
|
@ -698,50 +698,50 @@ void DialogManager::syncGameStream(Common::Serializer &ser) {
|
|||
}
|
||||
}
|
||||
|
||||
void DialogManager::loadData(Common::File *file) {
|
||||
void DialogManager::loadData(Common::SeekableReadStreamEndian *stream) {
|
||||
for (int i = 0; i < MAXDIALOG; ++i) {
|
||||
Dialog *dialog = &_dialog[i];
|
||||
|
||||
dialog->_flag = file->readUint16LE();
|
||||
dialog->_interlocutor = file->readUint16LE();
|
||||
dialog->_flag = stream->readUint16();
|
||||
dialog->_interlocutor = stream->readUint16();
|
||||
|
||||
file->read(&dialog->_startAnim, 14);
|
||||
stream->read(&dialog->_startAnim, 14);
|
||||
|
||||
dialog->_startLen = file->readUint16LE();
|
||||
dialog->_firstChoice = file->readUint16LE();
|
||||
dialog->_choiceNumb = file->readUint16LE();
|
||||
dialog->_startLen = stream->readUint16();
|
||||
dialog->_firstChoice = stream->readUint16();
|
||||
dialog->_choiceNumb = stream->readUint16();
|
||||
|
||||
for (int j = 0; j < MAXNEWSMKPAL; ++j)
|
||||
dialog->_newPal[j] = file->readUint16LE();
|
||||
dialog->_newPal[j] = stream->readUint16();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXCHOICE; ++i) {
|
||||
DialogChoice *choice = &_choice[i];
|
||||
|
||||
choice->_flag = file->readUint16LE();
|
||||
choice->_sentenceIndex = file->readUint16LE();
|
||||
choice->_firstSubTitle = file->readUint16LE();
|
||||
choice->_subTitleNumb = file->readUint16LE();
|
||||
choice->_flag = stream->readUint16();
|
||||
choice->_sentenceIndex = stream->readUint16();
|
||||
choice->_firstSubTitle = stream->readUint16();
|
||||
choice->_subTitleNumb = stream->readUint16();
|
||||
|
||||
for (int j = 0; j < MAXDISPCHOICES; ++j)
|
||||
choice->_on[j] = file->readUint16LE();
|
||||
choice->_on[j] = stream->readUint16();
|
||||
|
||||
for (int j = 0; j < MAXDISPCHOICES; ++j)
|
||||
choice->_off[j] = file->readUint16LE();
|
||||
choice->_off[j] = stream->readUint16();
|
||||
|
||||
choice->_startFrame = file->readUint16LE();
|
||||
choice->_nextDialog = file->readUint16LE();
|
||||
choice->_startFrame = stream->readUint16();
|
||||
choice->_nextDialog = stream->readUint16();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSUBTITLES; ++i) {
|
||||
DialogSubTitle *subTitle = &_subTitles[i];
|
||||
|
||||
subTitle->_sentence = file->readUint16LE();
|
||||
subTitle->_x = file->readUint16LE();
|
||||
subTitle->_y = file->readUint16LE();
|
||||
subTitle->_color = file->readUint16LE();
|
||||
subTitle->_startFrame = file->readUint16LE();
|
||||
subTitle->_length = file->readUint16LE();
|
||||
subTitle->_sentence = stream->readUint16();
|
||||
subTitle->_x = stream->readUint16();
|
||||
subTitle->_y = stream->readUint16();
|
||||
subTitle->_color = stream->readUint16();
|
||||
subTitle->_startFrame = stream->readUint16();
|
||||
subTitle->_length = stream->readUint16();
|
||||
}
|
||||
|
||||
if (_vm->isDemo()) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/serializer.h"
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
namespace Trecision {
|
||||
class TrecisionEngine;
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
uint16 getCurDialog() const { return _curDialog; }
|
||||
uint16 getCurChoice() const { return _curChoice; }
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadData(Common::File *file);
|
||||
void loadData(Common::SeekableReadStreamEndian *stream);
|
||||
};
|
||||
// end of class
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/savefile.h"
|
||||
#include "common/str.h"
|
||||
#include "common/translation.h"
|
||||
#include "common/substream.h"
|
||||
#include "gui/saveload.h"
|
||||
|
||||
#include "trecision/trecision.h"
|
||||
|
@ -38,55 +39,63 @@
|
|||
#include "trecision/video.h"
|
||||
#include "trecision/sound.h"
|
||||
|
||||
namespace Common {
|
||||
class File;
|
||||
}
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
Common::SeekableReadStreamEndian *TrecisionEngine::readEndian(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose) {
|
||||
return new Common::SeekableSubReadStreamEndian(
|
||||
stream,
|
||||
0,
|
||||
stream->size(),
|
||||
_gameDescription->platform == Common::kPlatformAmiga,
|
||||
dispose
|
||||
);
|
||||
}
|
||||
|
||||
void TrecisionEngine::loadAll() {
|
||||
Common::File dataNl;
|
||||
|
||||
if (!dataNl.open("DATA.NL"))
|
||||
error("loadAll : Couldn't open DATA.NL");
|
||||
Common::SeekableReadStreamEndian *data = readEndian(&dataNl, DisposeAfterUse::NO);
|
||||
|
||||
for (int i = 0; i < MAXROOMS; ++i)
|
||||
_room[i].loadRoom(&dataNl);
|
||||
_room[i].loadRoom(data);
|
||||
|
||||
for (int i = 0; i < MAXOBJ; ++i)
|
||||
_obj[i].loadObj(&dataNl);
|
||||
_obj[i].loadObj(data);
|
||||
|
||||
for (int i = 0; i < MAXINVENTORY; ++i)
|
||||
_inventoryObj[i].loadObj(&dataNl);
|
||||
_inventoryObj[i].loadObj(data);
|
||||
|
||||
_soundMgr->loadSamples(&dataNl);
|
||||
_soundMgr->loadSamples(data);
|
||||
|
||||
for (int i = 0; i < MAXSCRIPTFRAME; ++i) {
|
||||
_scriptFrame[i]._class = dataNl.readByte();
|
||||
_scriptFrame[i]._event = dataNl.readByte();
|
||||
_scriptFrame[i]._u8Param = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
_scriptFrame[i]._u16Param1 = dataNl.readUint16LE();
|
||||
_scriptFrame[i]._u16Param2 = dataNl.readUint16LE();
|
||||
_scriptFrame[i]._u32Param = dataNl.readUint16LE();
|
||||
_scriptFrame[i]._noWait = !(dataNl.readSint16LE() == 0);
|
||||
_scriptFrame[i]._class = data->readByte();
|
||||
_scriptFrame[i]._event = data->readByte();
|
||||
_scriptFrame[i]._u8Param = data->readByte();
|
||||
data->readByte(); // Padding
|
||||
_scriptFrame[i]._u16Param1 = data->readUint16();
|
||||
_scriptFrame[i]._u16Param2 = data->readUint16();
|
||||
_scriptFrame[i]._u32Param = data->readUint16();
|
||||
_scriptFrame[i]._noWait = !(data->readSint16() == 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSCRIPT; ++i) {
|
||||
_scriptFirstFrame[i] = dataNl.readUint16LE();
|
||||
dataNl.readByte(); // unused field
|
||||
dataNl.readByte(); // Padding
|
||||
_scriptFirstFrame[i] = data->readUint16();
|
||||
data->readByte(); // unused field
|
||||
data->readByte(); // Padding
|
||||
}
|
||||
|
||||
_animMgr->loadAnimTab(&dataNl);
|
||||
_dialogMgr->loadData(&dataNl);
|
||||
_animMgr->loadAnimTab(data);
|
||||
_dialogMgr->loadData(data);
|
||||
|
||||
dataNl.skip(620); // actions (unused)
|
||||
data->skip(620); // actions (unused)
|
||||
|
||||
int numFileRef = dataNl.readSint32LE();
|
||||
dataNl.skip(numFileRef * (12 + 4)); // fileRef name + offset
|
||||
int numFileRef = data->readSint32();
|
||||
data->skip(numFileRef * (12 + 4)); // fileRef name + offset
|
||||
|
||||
_textArea = new char[MAXTEXTAREA];
|
||||
dataNl.read(_textArea, MAXTEXTAREA);
|
||||
data->read(_textArea, MAXTEXTAREA);
|
||||
|
||||
_textPtr = _textArea;
|
||||
|
||||
|
@ -99,6 +108,7 @@ void TrecisionEngine::loadAll() {
|
|||
for (int a = 0; a < MAXSYSTEXT; a++)
|
||||
_sysText[a] = getNextSentence();
|
||||
|
||||
delete data;
|
||||
dataNl.close();
|
||||
}
|
||||
|
||||
|
@ -115,7 +125,7 @@ byte *TrecisionEngine::readData(const Common::String &fileName) {
|
|||
}
|
||||
|
||||
void TrecisionEngine::read3D(const Common::String &filename) {
|
||||
Common::SeekableReadStream *ff = _dataFile.createReadStreamForMember(filename);
|
||||
Common::SeekableReadStreamEndian *ff = readEndian(_dataFile.createReadStreamForMember(filename));
|
||||
if (ff == nullptr)
|
||||
error("read3D: Can't open 3D file %s", filename.c_str());
|
||||
|
||||
|
@ -133,7 +143,7 @@ void TrecisionEngine::read3D(const Common::String &filename) {
|
|||
_renderer->setClipping(0, TOP, MAXX, AREA + TOP);
|
||||
}
|
||||
|
||||
void TrecisionEngine::readObject(Common::SeekableReadStream *stream, uint16 objIndex, uint16 objectId) {
|
||||
void TrecisionEngine::readObject(Common::SeekableReadStreamEndian *stream, uint16 objIndex, uint16 objectId) {
|
||||
SObject *obj = &_obj[objectId];
|
||||
|
||||
if (obj->isModeFull()) {
|
||||
|
@ -143,7 +153,7 @@ void TrecisionEngine::readObject(Common::SeekableReadStream *stream, uint16 objI
|
|||
delete[] _objPointers[objIndex];
|
||||
_objPointers[objIndex] = new uint16[size];
|
||||
for (uint32 i = 0; i < size; ++i)
|
||||
_objPointers[objIndex][i] = stream->readUint16LE();
|
||||
_objPointers[objIndex][i] = stream->readUint16();
|
||||
|
||||
_graphicsMgr->updatePixelFormat(_objPointers[objIndex], size);
|
||||
}
|
||||
|
@ -151,15 +161,15 @@ void TrecisionEngine::readObject(Common::SeekableReadStream *stream, uint16 objI
|
|||
if (obj->isModeMask()) {
|
||||
obj->readRect(stream);
|
||||
|
||||
uint32 size = stream->readUint32LE();
|
||||
uint32 size = stream->readUint32();
|
||||
delete[] _objPointers[objIndex];
|
||||
_objPointers[objIndex] = new uint16[size];
|
||||
for (uint32 i = 0; i < size; ++i)
|
||||
_objPointers[objIndex][i] = stream->readUint16LE();
|
||||
_objPointers[objIndex][i] = stream->readUint16();
|
||||
|
||||
_graphicsMgr->updatePixelFormat(_objPointers[objIndex], size);
|
||||
|
||||
size = stream->readUint32LE();
|
||||
size = stream->readUint32();
|
||||
delete[] _maskPointers[objIndex];
|
||||
_maskPointers[objIndex] = new uint8[size];
|
||||
for (uint32 i = 0; i < size; ++i)
|
||||
|
@ -169,7 +179,7 @@ void TrecisionEngine::readObject(Common::SeekableReadStream *stream, uint16 objI
|
|||
refreshObject(objectId);
|
||||
}
|
||||
|
||||
void TrecisionEngine::readObj(Common::SeekableReadStream *stream) {
|
||||
void TrecisionEngine::readObj(Common::SeekableReadStreamEndian *stream) {
|
||||
if (!_room[_curRoom]._object[0])
|
||||
return;
|
||||
|
||||
|
@ -192,7 +202,7 @@ void TrecisionEngine::readExtraObj2C() {
|
|||
if (!_room[_curRoom]._object[32])
|
||||
return;
|
||||
|
||||
Common::SeekableReadStream *ff = _dataFile.createReadStreamForMember("2c2.bm");
|
||||
Common::SeekableReadStreamEndian *ff = readEndian(_dataFile.createReadStreamForMember("2c2.bm"));
|
||||
|
||||
for (uint16 objIndex = PATCHOBJ_ROOM2C; objIndex < MAXOBJINROOM; objIndex++) {
|
||||
const uint16 objectId = _room[_curRoom]._object[objIndex];
|
||||
|
@ -209,7 +219,7 @@ void TrecisionEngine::readExtraObj41D() {
|
|||
if (!_room[_curRoom]._object[32])
|
||||
return;
|
||||
|
||||
Common::SeekableReadStream *ff = _dataFile.createReadStreamForMember("41d2.bm");
|
||||
Common::SeekableReadStreamEndian *ff = readEndian(_dataFile.createReadStreamForMember("41d2.bm"));
|
||||
for (uint16 objIndex = PATCHOBJ_ROOM41D; objIndex < MAXOBJINROOM; objIndex++) {
|
||||
const uint16 objectId = _room[_curRoom]._object[objIndex];
|
||||
if (!objectId)
|
||||
|
|
|
@ -266,13 +266,13 @@ void SoundManager::loadRoomSounds() {
|
|||
}
|
||||
}
|
||||
|
||||
void SoundManager::loadSamples(Common::File *file) {
|
||||
void SoundManager::loadSamples(Common::SeekableReadStreamEndian *stream) {
|
||||
for (int i = 0; i < NUMSAMPLES; ++i) {
|
||||
for (int j = 0; j < 14; j++)
|
||||
_gSample[i]._name += file->readByte();
|
||||
_gSample[i]._volume = file->readByte();
|
||||
_gSample[i]._flag = file->readByte();
|
||||
_gSample[i]._panning = file->readSByte();
|
||||
_gSample[i]._name += stream->readByte();
|
||||
_gSample[i]._volume = stream->readByte();
|
||||
_gSample[i]._flag = stream->readByte();
|
||||
_gSample[i]._panning = stream->readSByte();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define TRECISION_SOUND_H
|
||||
|
||||
#include "trecision/fastfile.h"
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
#include "audio/mixer.h"
|
||||
#include "audio/audiostream.h"
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
int32 talkStart(const Common::String &name);
|
||||
void loadRoomSounds();
|
||||
|
||||
void loadSamples(Common::File *file);
|
||||
void loadSamples(Common::SeekableReadStreamEndian *stream);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
|
||||
namespace Trecision {
|
||||
|
||||
void SRoom::loadRoom(Common::File *file) {
|
||||
file->read(&_baseName, 4);
|
||||
_flag = file->readByte();
|
||||
file->readByte(); // Padding
|
||||
_bkgAnim = file->readUint16LE();
|
||||
void SRoom::loadRoom(Common::SeekableReadStreamEndian *stream) {
|
||||
stream->read(&_baseName, 4);
|
||||
_flag = stream->readByte();
|
||||
stream->readByte(); // Padding
|
||||
_bkgAnim = stream->readUint16();
|
||||
for (int j = 0; j < MAXOBJINROOM; ++j)
|
||||
_object[j] = file->readUint16LE();
|
||||
_object[j] = stream->readUint16();
|
||||
for (int j = 0; j < MAXSOUNDSINROOM; ++j)
|
||||
_sounds[j] = file->readUint16LE();
|
||||
_sounds[j] = stream->readUint16();
|
||||
for (int j = 0; j < MAXACTIONINROOM; ++j)
|
||||
_actions[j] = file->readUint16LE();
|
||||
_actions[j] = stream->readUint16();
|
||||
}
|
||||
|
||||
void SRoom::syncGameStream(Common::Serializer &ser) {
|
||||
|
@ -47,11 +47,11 @@ void SRoom::syncGameStream(Common::Serializer &ser) {
|
|||
|
||||
/********************************************************************/
|
||||
|
||||
void SObject::readRect(Common::SeekableReadStream *stream) {
|
||||
_rect.left = stream->readUint16LE();
|
||||
_rect.top = stream->readUint16LE();
|
||||
_rect.setWidth(stream->readUint16LE());
|
||||
_rect.setHeight(stream->readUint16LE());
|
||||
void SObject::readRect(Common::SeekableReadStreamEndian *stream) {
|
||||
_rect.left = stream->readUint16();
|
||||
_rect.top = stream->readUint16();
|
||||
_rect.setWidth(stream->readUint16());
|
||||
_rect.setHeight(stream->readUint16());
|
||||
}
|
||||
|
||||
void SObject::syncGameStream(Common::Serializer &ser) {
|
||||
|
@ -71,31 +71,31 @@ void SObject::syncGameStream(Common::Serializer &ser) {
|
|||
ser.syncAsSByte(_position);
|
||||
}
|
||||
|
||||
void SObject::loadObj(Common::File *file) {
|
||||
uint16 w = file->readUint16LE();
|
||||
uint16 h = file->readUint16LE();
|
||||
_rect.left = file->readUint16LE();
|
||||
_rect.top = file->readUint16LE();
|
||||
void SObject::loadObj(Common::SeekableReadStreamEndian *stream) {
|
||||
uint16 w = stream->readUint16();
|
||||
uint16 h = stream->readUint16();
|
||||
_rect.left = stream->readUint16();
|
||||
_rect.top = stream->readUint16();
|
||||
_rect.setWidth(w);
|
||||
_rect.setHeight(h);
|
||||
|
||||
_lim.left = file->readUint16LE();
|
||||
_lim.top = file->readUint16LE();
|
||||
_lim.right = file->readUint16LE();
|
||||
_lim.bottom = file->readUint16LE();
|
||||
_lim.left = stream->readUint16();
|
||||
_lim.top = stream->readUint16();
|
||||
_lim.right = stream->readUint16();
|
||||
_lim.bottom = stream->readUint16();
|
||||
|
||||
_position = file->readSByte();
|
||||
file->readByte(); // Padding
|
||||
_name = file->readUint16LE();
|
||||
_examine = file->readUint16LE();
|
||||
_action = file->readUint16LE();
|
||||
_goRoom = file->readByte();
|
||||
_nbox = file->readByte();
|
||||
_ninv = file->readByte();
|
||||
_mode = file->readByte();
|
||||
_flag = file->readByte();
|
||||
file->readByte(); // Padding
|
||||
_anim = file->readUint16LE();
|
||||
_position = stream->readSByte();
|
||||
stream->readByte(); // Padding
|
||||
_name = stream->readUint16();
|
||||
_examine = stream->readUint16();
|
||||
_action = stream->readUint16();
|
||||
_goRoom = stream->readByte();
|
||||
_nbox = stream->readByte();
|
||||
_ninv = stream->readByte();
|
||||
_mode = stream->readByte();
|
||||
_flag = stream->readByte();
|
||||
stream->readByte(); // Padding
|
||||
_anim = stream->readUint16();
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
|
@ -108,13 +108,13 @@ void SInvObject::syncGameStream(Common::Serializer &ser) {
|
|||
ser.syncAsByte(_flag);
|
||||
}
|
||||
|
||||
void SInvObject::loadObj(Common::File *file) {
|
||||
_name = file->readUint16LE();
|
||||
_examine = file->readUint16LE();
|
||||
_action = file->readUint16LE();
|
||||
_flag = file->readByte();
|
||||
file->readByte(); // Padding
|
||||
_anim = file->readUint16LE();
|
||||
void SInvObject::loadObj(Common::SeekableReadStreamEndian *stream) {
|
||||
_name = stream->readUint16();
|
||||
_examine = stream->readUint16();
|
||||
_action = stream->readUint16();
|
||||
_flag = stream->readByte();
|
||||
stream->readByte(); // Padding
|
||||
_anim = stream->readUint16();
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef TRECISION_STRUCT_H
|
||||
#define TRECISION_STRUCT_H
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/serializer.h"
|
||||
|
@ -45,7 +45,7 @@ struct SRoom {
|
|||
void setDone(bool on) { if (on) _flag |= kObjFlagDone; else _flag &= ~kObjFlagDone; }
|
||||
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadRoom(Common::File *file);
|
||||
void loadRoom(Common::SeekableReadStreamEndian *stream);
|
||||
|
||||
private:
|
||||
uint8 _flag = 0; // Room visited or not, extra or not
|
||||
|
@ -63,7 +63,7 @@ struct SObject {
|
|||
uint8 _ninv; // ptr inventory
|
||||
uint16 _anim;
|
||||
|
||||
void readRect(Common::SeekableReadStream *stream);
|
||||
void readRect(Common::SeekableReadStreamEndian *stream);
|
||||
void setFlagDone(bool on) { if (on) _flag |= kObjFlagDone; else _flag &= ~kObjFlagDone; }
|
||||
void setFlagExamine(bool on) { if (on) _flag |= kObjFlagExamine; else _flag &= ~kObjFlagExamine; }
|
||||
void setFlagExtra(bool on) { if (on) _flag |= kObjFlagExtra; else _flag &= ~kObjFlagExtra; }
|
||||
|
@ -94,7 +94,7 @@ struct SObject {
|
|||
void setModeStatus(bool on) { if (on) _mode |= OBJMODE_OBJSTATUS; else _mode &= ~OBJMODE_OBJSTATUS; }
|
||||
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadObj(Common::File *file);
|
||||
void loadObj(Common::SeekableReadStreamEndian *stream);
|
||||
|
||||
private:
|
||||
uint8 _flag = 0;
|
||||
|
@ -113,7 +113,7 @@ struct SInvObject {
|
|||
bool isUseWith() { return _flag & kObjFlagUseWith; }
|
||||
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadObj(Common::File *file);
|
||||
void loadObj(Common::SeekableReadStreamEndian *stream);
|
||||
|
||||
private:
|
||||
uint8 _flag = 0;
|
||||
|
|
|
@ -233,10 +233,6 @@ Common::Error TrecisionEngine::run() {
|
|||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool TrecisionEngine::isDemo() const {
|
||||
return _gameDescription->flags & ADGF_DEMO;
|
||||
}
|
||||
|
||||
void TrecisionEngine::eventLoop() {
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
|
@ -381,7 +377,7 @@ void TrecisionEngine::readLoc() {
|
|||
_graphicsMgr->clearScreenBufferTop();
|
||||
|
||||
Common::String filename = Common::String::format("%s.cr", _room[_curRoom]._baseName);
|
||||
Common::SeekableReadStream *picFile = _dataFile.createReadStreamForCompressedMember(filename);
|
||||
Common::SeekableReadStreamEndian *picFile = readEndian(_dataFile.createReadStreamForCompressedMember(filename));
|
||||
|
||||
SObject bgInfo;
|
||||
bgInfo.readRect(picFile);
|
||||
|
@ -432,7 +428,7 @@ void TrecisionEngine::redrawRoom() {
|
|||
}
|
||||
|
||||
Common::String filename = Common::String::format("%s.cr", _room[_curRoom]._baseName);
|
||||
Common::SeekableReadStream *picFile = _dataFile.createReadStreamForCompressedMember(filename);
|
||||
Common::SeekableReadStreamEndian *picFile = readEndian(_dataFile.createReadStreamForCompressedMember(filename));
|
||||
|
||||
SObject bgInfo;
|
||||
bgInfo.readRect(picFile);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "common/keyboard.h"
|
||||
#include "common/str.h"
|
||||
#include "common/serializer.h"
|
||||
#include "common/stream.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
#include "engines/engine.h"
|
||||
#include "graphics/surface.h"
|
||||
|
@ -134,8 +135,8 @@ class TrecisionEngine : public Engine {
|
|||
bool canPlayerInteract();
|
||||
|
||||
// Objects
|
||||
void readObj(Common::SeekableReadStream *stream);
|
||||
void readObject(Common::SeekableReadStream *stream, uint16 objIndex, uint16 objectId);
|
||||
void readObj(Common::SeekableReadStreamEndian *stream);
|
||||
void readObject(Common::SeekableReadStreamEndian *stream, uint16 objIndex, uint16 objectId);
|
||||
|
||||
char *_textArea;
|
||||
uint16 _curScriptFrame[10];
|
||||
|
@ -154,7 +155,7 @@ public:
|
|||
|
||||
// ScummVM
|
||||
Common::Error run() override;
|
||||
bool isDemo() const;
|
||||
bool isDemo() const { return _gameDescription->flags & ADGF_DEMO; }
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
bool canLoadGameStateCurrently() override { return canPlayerInteract() && _curRoom != kRoomIntro; }
|
||||
bool canSaveGameStateCurrently() override { return canPlayerInteract() && _curRoom != kRoomIntro; }
|
||||
|
@ -163,6 +164,7 @@ public:
|
|||
bool syncGameStream(Common::Serializer &ser);
|
||||
|
||||
// Data files
|
||||
Common::SeekableReadStreamEndian *readEndian(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::YES);
|
||||
void read3D(const Common::String &c);
|
||||
|
||||
// Inventory
|
||||
|
|
|
@ -551,27 +551,27 @@ void AnimManager::syncGameStream(Common::Serializer &ser) {
|
|||
}
|
||||
}
|
||||
|
||||
void AnimManager::loadAnimTab(Common::File *file) {
|
||||
void AnimManager::loadAnimTab(Common::SeekableReadStreamEndian *stream) {
|
||||
for (uint16 i = 0; i < MAXANIM; ++i) {
|
||||
file->read(&_animTab[i]._name, 14);
|
||||
stream->read(&_animTab[i]._name, 14);
|
||||
|
||||
_animTab[i]._flag = file->readUint16LE();
|
||||
_animTab[i]._flag = stream->readUint16();
|
||||
|
||||
for (uint8 j = 0; j < MAXCHILD; ++j) {
|
||||
_animTab[i]._lim[j].left = file->readUint16LE();
|
||||
_animTab[i]._lim[j].top = file->readUint16LE();
|
||||
_animTab[i]._lim[j].right = file->readUint16LE();
|
||||
_animTab[i]._lim[j].bottom = file->readUint16LE();
|
||||
_animTab[i]._lim[j].left = stream->readUint16();
|
||||
_animTab[i]._lim[j].top = stream->readUint16();
|
||||
_animTab[i]._lim[j].right = stream->readUint16();
|
||||
_animTab[i]._lim[j].bottom = stream->readUint16();
|
||||
}
|
||||
|
||||
_animTab[i]._nbox = file->readByte();
|
||||
file->readByte(); // Padding
|
||||
_animTab[i]._nbox = stream->readByte();
|
||||
stream->readByte(); // Padding
|
||||
|
||||
for (uint8 j = 0; j < MAXATFRAME; ++j) {
|
||||
_animTab[i]._atFrame[j]._type = file->readByte();
|
||||
_animTab[i]._atFrame[j]._child = file->readByte();
|
||||
_animTab[i]._atFrame[j]._numFrame = file->readUint16LE();
|
||||
_animTab[i]._atFrame[j]._index = file->readUint16LE();
|
||||
_animTab[i]._atFrame[j]._type = stream->readByte();
|
||||
_animTab[i]._atFrame[j]._child = stream->readByte();
|
||||
_animTab[i]._atFrame[j]._numFrame = stream->readUint16();
|
||||
_animTab[i]._atFrame[j]._index = stream->readUint16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef TRECISION_VIDEO_H
|
||||
#define TRECISION_VIDEO_H
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/serializer.h"
|
||||
#include "video/smk_decoder.h"
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
void stopAllSmkAnims();
|
||||
|
||||
void syncGameStream(Common::Serializer &ser);
|
||||
void loadAnimTab(Common::File *file);
|
||||
void loadAnimTab(Common::SeekableReadStreamEndian *stream);
|
||||
};
|
||||
} // End of namespace Trecision
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue