mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
FULLPIPE: Continued work on scene loading
This commit is contained in:
parent
751f435df0
commit
0b6591e491
200
engines/fullpipe/gfx.cpp
Normal file
200
engines/fullpipe/gfx.cpp
Normal file
@ -0,0 +1,200 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "fullpipe/fullpipe.h"
|
||||
|
||||
#include "fullpipe/objects.h"
|
||||
|
||||
namespace Fullpipe {
|
||||
|
||||
Background::Background() {
|
||||
_x = 0;
|
||||
_y = 0;
|
||||
_messageQueueId = 0;
|
||||
_bigPictureArray1Count = 0;
|
||||
_bigPictureArray2Count = 0;
|
||||
_bigPictureArray = 0;
|
||||
}
|
||||
|
||||
bool Background::load(MfcArchive &file) {
|
||||
_stringObj = file.readPascalString();
|
||||
|
||||
int count = file.readUint16LE();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
PictureObject *pct = new PictureObject();
|
||||
|
||||
pct->load(file, i == 0);
|
||||
addPictureObject(pct);
|
||||
}
|
||||
|
||||
assert(g_fullpipe->_gameProjectVersion >= 4);
|
||||
|
||||
_bigPictureArray1Count = file.readUint32LE();
|
||||
|
||||
assert(g_fullpipe->_gameProjectVersion >= 5);
|
||||
|
||||
_bigPictureArray2Count = file.readUint32LE();
|
||||
|
||||
_bigPictureArray = (BigPicture ***)calloc(_bigPictureArray1Count, sizeof(BigPicture **));
|
||||
|
||||
debug(0, "bigPictureArray[%d][%d]", _bigPictureArray1Count, _bigPictureArray2Count);
|
||||
|
||||
for (int i = 0; i < _bigPictureArray1Count; i++) {
|
||||
_bigPictureArray[i] = (BigPicture **)calloc(_bigPictureArray2Count, sizeof(BigPicture *));
|
||||
for (int j = 0; j < _bigPictureArray2Count; j++) {
|
||||
_bigPictureArray[i][j] = new BigPicture();
|
||||
|
||||
_bigPictureArray[i][j]->load(file);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Background::addPictureObject(PictureObject *pct) {
|
||||
warning("STUB: Background::addPictureObject");
|
||||
}
|
||||
|
||||
PictureObject::PictureObject() {
|
||||
_ox = 0;
|
||||
_oy = 0;
|
||||
_picture = 0;
|
||||
}
|
||||
|
||||
bool PictureObject::load(MfcArchive &file, bool bigPicture) {
|
||||
GameObject::load(file);
|
||||
|
||||
if (bigPicture)
|
||||
_picture = new BigPicture();
|
||||
else
|
||||
_picture = new Picture();
|
||||
|
||||
_picture->load(file);
|
||||
|
||||
_pictureObject2List = new CPtrList();
|
||||
|
||||
int count = file.readUint16LE();
|
||||
|
||||
if (count > 0) {
|
||||
GameObject *o = new GameObject();
|
||||
|
||||
o->load(file);
|
||||
_pictureObject2List->push_back(o);
|
||||
}
|
||||
|
||||
_ox2 = _ox;
|
||||
_oy2 = _oy;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObject::GameObject() {
|
||||
_field_4 = 0;
|
||||
_flags = 0;
|
||||
_id = 0;
|
||||
_ox = 0;
|
||||
_oy = 0;
|
||||
_priority = 0;
|
||||
_field_20 = 0;
|
||||
_field_8 = 0;
|
||||
}
|
||||
|
||||
bool GameObject::load(MfcArchive &file) {
|
||||
_field_4 = 0;
|
||||
_flags = 0;
|
||||
_field_20 = 0;
|
||||
|
||||
_id = file.readUint16LE();
|
||||
|
||||
_stringObj = file.readPascalString();
|
||||
_ox = file.readUint32LE();
|
||||
_oy = file.readUint32LE();
|
||||
_priority = file.readUint16LE();
|
||||
|
||||
if (g_fullpipe->_gameProjectVersion >= 11) {
|
||||
_field_8 = file.readUint32LE();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Picture::Picture() {
|
||||
_x = 0;
|
||||
_y = 0;
|
||||
_field_44 = 0;
|
||||
_field_54 = 0;
|
||||
_bitmap = 0;
|
||||
_alpha = -1;
|
||||
_paletteData = 0;
|
||||
_convertedBitmap = 0;
|
||||
}
|
||||
|
||||
bool Picture::load(MfcArchive &file) {
|
||||
MemoryObject::load(file);
|
||||
|
||||
_x = file.readUint32LE();
|
||||
_y = file.readUint32LE();
|
||||
_field_44 = file.readUint16LE();
|
||||
|
||||
assert(g_fullpipe->_gameProjectVersion >= 2);
|
||||
|
||||
_width = file.readUint32LE();
|
||||
_height = file.readUint32LE();
|
||||
|
||||
_flags |= 1;
|
||||
|
||||
_memoryObject2 = new MemoryObject2;
|
||||
_memoryObject2->load(file);
|
||||
|
||||
if (_memoryObject2->_data) {
|
||||
setAOIDs();
|
||||
}
|
||||
|
||||
assert (g_fullpipe->_gameProjectVersion >= 12);
|
||||
|
||||
_alpha = file.readUint32LE();
|
||||
|
||||
int havePal = file.readUint32LE();
|
||||
|
||||
if (havePal > 0) {
|
||||
_paletteData = (byte *)calloc(1024, 1);
|
||||
file.read(_paletteData, 1024);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Picture::setAOIDs() {
|
||||
warning("STUB: Picture::setAOIDs()");
|
||||
}
|
||||
|
||||
BigPicture::BigPicture() {
|
||||
}
|
||||
|
||||
bool BigPicture::load(MfcArchive &file) {
|
||||
Picture::load(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Fullpipe
|
@ -57,8 +57,7 @@ class BigPicture : public Picture {
|
||||
};
|
||||
|
||||
class GameObject : public CObject {
|
||||
friend class PictureObject;
|
||||
|
||||
protected:
|
||||
int16 _field_4;
|
||||
int16 _field_6;
|
||||
int _field_8;
|
||||
|
@ -44,8 +44,7 @@ struct InventoryPoolItem {
|
||||
typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
|
||||
|
||||
class CInventory : public CObject {
|
||||
friend class CInventory2;
|
||||
|
||||
protected:
|
||||
int16 _sceneId;
|
||||
int16 _field_6;
|
||||
InventoryPoolItems _itemsPool;
|
||||
|
@ -9,6 +9,7 @@ MODULE_OBJS = \
|
||||
ngiarchive.o \
|
||||
scene.o \
|
||||
stateloader.o \
|
||||
statics.o \
|
||||
utils.o
|
||||
|
||||
# This module can be built as a plugin
|
||||
|
@ -52,20 +52,20 @@ class CMctlCompound : public CMotionController {
|
||||
};
|
||||
|
||||
class Unk2 : public CObject {
|
||||
int _items;
|
||||
int _count;
|
||||
int _items;
|
||||
int _count;
|
||||
|
||||
public:
|
||||
Unk2() : _items(0), _count(0) {}
|
||||
};
|
||||
|
||||
class CMovGraphNode : public CObject {
|
||||
int _x;
|
||||
int _y;
|
||||
int _distance;
|
||||
int16 _field_10;
|
||||
int16 _field_12;
|
||||
int _field_14;
|
||||
int _x;
|
||||
int _y;
|
||||
int _distance;
|
||||
int16 _field_10;
|
||||
int16 _field_12;
|
||||
int _field_14;
|
||||
|
||||
public:
|
||||
CMovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) {}
|
||||
@ -73,7 +73,7 @@ class CMovGraphNode : public CObject {
|
||||
};
|
||||
|
||||
class CMovGraphReact : public CObject {
|
||||
// Empty
|
||||
// Empty
|
||||
};
|
||||
|
||||
class CMctlCompoundArrayItem : public CMotionController {
|
||||
@ -87,64 +87,64 @@ class CMctlCompoundArrayItem : public CMotionController {
|
||||
int _field_28;
|
||||
|
||||
public:
|
||||
CMctlCompoundArrayItem() : _movGraphReactObj(0) {}
|
||||
CMctlCompoundArrayItem() : _movGraphReactObj(0) {}
|
||||
};
|
||||
|
||||
class CReactParallel : public CMovGraphReact {
|
||||
//CRgn _rgn;
|
||||
int _x1;
|
||||
int _y1;
|
||||
int _x2;
|
||||
int _y2;
|
||||
int _dx;
|
||||
int _dy;
|
||||
Common::Point **_points;
|
||||
//CRgn _rgn;
|
||||
int _x1;
|
||||
int _y1;
|
||||
int _x2;
|
||||
int _y2;
|
||||
int _dx;
|
||||
int _dy;
|
||||
Common::Point **_points;
|
||||
|
||||
public:
|
||||
CReactParallel();
|
||||
virtual bool load(MfcArchive &file);
|
||||
void createRegion();
|
||||
CReactParallel();
|
||||
virtual bool load(MfcArchive &file);
|
||||
void createRegion();
|
||||
};
|
||||
|
||||
class CReactPolygonal : public CMovGraphReact {
|
||||
//CRgn _rgn;
|
||||
int _field_C;
|
||||
int _field_10;
|
||||
int _pointCount;
|
||||
Common::Point **_points;
|
||||
//CRgn _rgn;
|
||||
int _field_C;
|
||||
int _field_10;
|
||||
int _pointCount;
|
||||
Common::Point **_points;
|
||||
|
||||
public:
|
||||
CReactPolygonal();
|
||||
virtual bool load(MfcArchive &file);
|
||||
void createRegion();
|
||||
CReactPolygonal();
|
||||
virtual bool load(MfcArchive &file);
|
||||
void createRegion();
|
||||
};
|
||||
|
||||
class CMovGraphLink : public CObject {
|
||||
CMovGraphNode *_movGraphNode1;
|
||||
CMovGraphNode *_movGraphNode2;
|
||||
CDWordArray _dwordArray1;
|
||||
CDWordArray _dwordArray2;
|
||||
int _flags;
|
||||
int _field_38;
|
||||
int _field_3C;
|
||||
double _distance;
|
||||
double _angle;
|
||||
CMovGraphReact *_movGraphReact;
|
||||
char *_name;
|
||||
CMovGraphNode *_movGraphNode1;
|
||||
CMovGraphNode *_movGraphNode2;
|
||||
CDWordArray _dwordArray1;
|
||||
CDWordArray _dwordArray2;
|
||||
int _flags;
|
||||
int _field_38;
|
||||
int _field_3C;
|
||||
double _distance;
|
||||
double _angle;
|
||||
CMovGraphReact *_movGraphReact;
|
||||
char *_name;
|
||||
|
||||
public:
|
||||
CMovGraphLink();
|
||||
virtual bool load(MfcArchive &file);
|
||||
CMovGraphLink();
|
||||
virtual bool load(MfcArchive &file);
|
||||
};
|
||||
|
||||
class CMovGraph : public CMotionController {
|
||||
CObList _nodes;
|
||||
CObList _links;
|
||||
int _field_44;
|
||||
int _items;
|
||||
int _itemsCount;
|
||||
int (*_callback1)(int, int, int);
|
||||
Unk2 _unk2;
|
||||
CObList _nodes;
|
||||
CObList _links;
|
||||
int _field_44;
|
||||
int _items;
|
||||
int _itemsCount;
|
||||
int (*_callback1)(int, int, int);
|
||||
Unk2 _unk2;
|
||||
|
||||
public:
|
||||
CMovGraph();
|
||||
|
@ -113,8 +113,6 @@ Scene::Scene() {
|
||||
}
|
||||
|
||||
bool Scene::load(MfcArchive &file) {
|
||||
warning("STUB: Scene::load");
|
||||
|
||||
_bg.load(file);
|
||||
|
||||
_sceneId = file.readUint16LE();
|
||||
@ -141,9 +139,10 @@ bool Scene::load(MfcArchive &file) {
|
||||
|
||||
delete f;
|
||||
free(aniname);
|
||||
|
||||
|
||||
}
|
||||
|
||||
warning("STUB: Scene::load");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
114
engines/fullpipe/statics.cpp
Normal file
114
engines/fullpipe/statics.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "fullpipe/fullpipe.h"
|
||||
|
||||
#include "fullpipe/objects.h"
|
||||
#include "fullpipe/ngiarchive.h"
|
||||
#include "fullpipe/statics.h"
|
||||
|
||||
namespace Fullpipe {
|
||||
|
||||
StaticANIObject::StaticANIObject() {
|
||||
_shadowsOn = 1;
|
||||
_field_30 = 0;
|
||||
_field_34 = 1;
|
||||
_initialCounter = 0;
|
||||
_messageQueueId = 0;
|
||||
_animExFlag = 0;
|
||||
_counter = 0;
|
||||
_movementObj = 0;
|
||||
_staticsObj = 0;
|
||||
_flags = 0;
|
||||
_callback1 = 0;
|
||||
_callback2 = 0;
|
||||
_sceneId = -1;
|
||||
_someDynamicPhaseIndex = -1;
|
||||
}
|
||||
|
||||
bool StaticANIObject::load(MfcArchive &file) {
|
||||
GameObject::load(file);
|
||||
|
||||
int count = file.readUint16LE();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
Statics *st = new Statics();
|
||||
|
||||
st->load(file);
|
||||
_staticsList.push_back(st);
|
||||
}
|
||||
|
||||
count = file.readUint16LE();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int movNum = file.readUint16LE();
|
||||
|
||||
char *movname = genFileName(_id, movNum, "mov");
|
||||
|
||||
Common::SeekableReadStream *f = g_fullpipe->_currArchive->createReadStreamForMember(movname);
|
||||
|
||||
Movement *mov = new Movement();
|
||||
|
||||
MfcArchive archive(f);
|
||||
|
||||
mov->load(archive, this);
|
||||
|
||||
_movements.push_back(mov);
|
||||
|
||||
delete f;
|
||||
free(movname);
|
||||
}
|
||||
|
||||
Common::Point pt;
|
||||
if (count) { // We have movements
|
||||
((Movement *)_movements[0])->getCurrDynamicPhaseXY(pt);
|
||||
} else {
|
||||
pt.x = pt.y = 100;
|
||||
}
|
||||
|
||||
setOXY(pt.x, pt.y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void StaticANIObject::setOXY(int x, int y) {
|
||||
}
|
||||
|
||||
Movement::Movement() {
|
||||
}
|
||||
|
||||
bool Movement::load(MfcArchive &file) {
|
||||
warning("STUB: Movement::load");
|
||||
return true;
|
||||
}
|
||||
bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) {
|
||||
p.x = _currDynamicPhase->_x;
|
||||
p.y = _currDynamicPhase->_y;
|
||||
|
||||
return &p;
|
||||
}
|
||||
|
||||
} // End of namespace Fullpipe
|
@ -42,8 +42,10 @@ class StaticPhase : public Picture {
|
||||
};
|
||||
|
||||
class DynamicPhase : public StaticPhase {
|
||||
int _someX;
|
||||
int _someY;
|
||||
friend class Movement;
|
||||
|
||||
int _x;
|
||||
int _y;
|
||||
Common::Rect *_rectPtr;
|
||||
int16 _field_7C;
|
||||
int16 _field_7E;
|
||||
@ -57,6 +59,8 @@ class Statics : public DynamicPhase {
|
||||
int _picture;
|
||||
};
|
||||
|
||||
class StaticANIObject;
|
||||
|
||||
class Movement : public GameObject {
|
||||
int _field_24;
|
||||
int _field_28;
|
||||
@ -74,13 +78,20 @@ class Movement : public GameObject {
|
||||
int _counter;
|
||||
CPtrList _dynamicPhases;
|
||||
int _field_78;
|
||||
int _framePosOffsets;
|
||||
Common::Point *_framePosOffsets;
|
||||
int _currMovementObj;
|
||||
int _field_84;
|
||||
DynamicPhase *_currDynamicPhase;
|
||||
int _field_8C;
|
||||
int _currDynamicPhaseIndex;
|
||||
int _field_94;
|
||||
|
||||
public:
|
||||
Movement();
|
||||
virtual bool load(MfcArchive &file);
|
||||
bool load(MfcArchive &file, StaticANIObject *ani);
|
||||
|
||||
Common::Point *getCurrDynamicPhaseXY(Common::Point &p);
|
||||
};
|
||||
|
||||
class StaticANIObject : public GameObject {
|
||||
@ -105,6 +116,11 @@ class StaticANIObject : public GameObject {
|
||||
|
||||
public:
|
||||
int16 _sceneId;
|
||||
|
||||
public:
|
||||
StaticANIObject();
|
||||
virtual bool load(MfcArchive &file);
|
||||
void setOXY(int x, int y);
|
||||
};
|
||||
|
||||
} // End of namespace Fullpipe
|
||||
|
@ -78,9 +78,9 @@ class CObList : public Common::List<CObject>, public CObject {
|
||||
};
|
||||
|
||||
class MemoryObject : CObject {
|
||||
friend class MemoryObject2;
|
||||
friend class Picture;
|
||||
|
||||
protected:
|
||||
char *_filename;
|
||||
int _field_8;
|
||||
int _field_C;
|
||||
|
Loading…
x
Reference in New Issue
Block a user