Skip to content

Commit

Permalink
FULLPIPE: Move Sc2 to gameloader.h
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 12, 2013
1 parent 6cd830f commit e8f4c28
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 97 deletions.
72 changes: 72 additions & 0 deletions engines/fullpipe/gameloader.cpp
Expand Up @@ -404,6 +404,78 @@ void CGameLoader::updateSystems(int counterdiff) {
}
}

Sc2::Sc2() {
_sceneId = 0;
_field_2 = 0;
_scene = 0;
_motionController = 0;
_data1 = 0;
_count1 = 0;
_defPicAniInfos = 0;
_defPicAniInfosCount = 0;
_picAniInfos = 0;
_picAniInfosCount = 0;
_isLoaded = 0;
_entranceData = 0;
_entranceDataCount = 0;
}

bool Sc2::load(MfcArchive &file) {
debug(5, "Sc2::load()");

_sceneId = file.readUint16LE();

_motionController = (CMotionController *)file.readClass();

_count1 = file.readUint32LE();
debug(4, "count1: %d", _count1);
if (_count1 > 0) {
_data1 = (int32 *)malloc(_count1 * sizeof(int32));

for (int i = 0; i < _count1; i++) {
_data1[i] = file.readUint32LE();
}
} else {
_data1 = 0;
}

_defPicAniInfosCount = file.readUint32LE();
debug(4, "defPicAniInfos: %d", _defPicAniInfosCount);
if (_defPicAniInfosCount > 0) {
_defPicAniInfos = (PicAniInfo **)malloc(_defPicAniInfosCount * sizeof(PicAniInfo *));

for (int i = 0; i < _defPicAniInfosCount; i++) {
_defPicAniInfos[i] = new PicAniInfo();

_defPicAniInfos[i]->load(file);
}
} else {
_defPicAniInfos = 0;
}

_picAniInfos = 0;
_picAniInfosCount = 0;

_entranceDataCount = file.readUint32LE();
debug(4, "_entranceData: %d", _entranceDataCount);

if (_entranceDataCount > 0) {
_entranceData = (EntranceInfo **)malloc(_entranceDataCount * sizeof(EntranceInfo *));

for (int i = 0; i < _entranceDataCount; i++) {
_entranceData[i] = new EntranceInfo();
_entranceData[i]->load(file);
}
} else {
_entranceData = 0;
}

if (file.size() - file.pos() > 0)
error("Sc2::load(): (%d bytes left)", file.size() - file.pos());

return true;
}

CGameVar *FullpipeEngine::getGameLoaderGameVar() {
if (_gameLoader)
return _gameLoader->_gameVar;
Expand Down
24 changes: 24 additions & 0 deletions engines/fullpipe/gameloader.h
Expand Up @@ -33,6 +33,30 @@ class SceneTag;
class CMctlCompound;
class CInputController;
class CInteractionController;
class CMotionController;

class Sc2 : public CObject {
public:
int16 _sceneId;
int16 _field_2;
Scene *_scene;
CMotionController *_motionController;
int32 *_data1; // FIXME, could be a struct
int _count1;
PicAniInfo **_defPicAniInfos;
int _defPicAniInfosCount;
PicAniInfo **_picAniInfos;
int _picAniInfosCount;
int _isLoaded;
EntranceInfo **_entranceData;
int _entranceDataCount;

public:
Sc2();
virtual bool load(MfcArchive &file);
};

typedef Common::Array<Sc2> Sc2Array;

struct PreloadItem {
int preloadId1;
Expand Down
25 changes: 0 additions & 25 deletions engines/fullpipe/objects.h
Expand Up @@ -63,31 +63,6 @@ struct PicAniInfo {
bool load(MfcArchive &file);
};

class CMotionController;

class Sc2 : public CObject {
public:
int16 _sceneId;
int16 _field_2;
Scene *_scene;
CMotionController *_motionController;
int32 *_data1; // FIXME, could be a struct
int _count1;
PicAniInfo **_defPicAniInfos;
int _defPicAniInfosCount;
PicAniInfo **_picAniInfos;
int _picAniInfosCount;
int _isLoaded;
EntranceInfo **_entranceData;
int _entranceDataCount;

public:
Sc2();
virtual bool load(MfcArchive &file);
};

typedef Common::Array<Sc2> Sc2Array;

union VarValue {
float floatValue;
int32 intValue;
Expand Down
72 changes: 0 additions & 72 deletions engines/fullpipe/stateloader.cpp
Expand Up @@ -314,78 +314,6 @@ CGameVar *CGameVar::getSubVarByIndex(int idx) {
return sub;
}

Sc2::Sc2() {
_sceneId = 0;
_field_2 = 0;
_scene = 0;
_motionController = 0;
_data1 = 0;
_count1 = 0;
_defPicAniInfos = 0;
_defPicAniInfosCount = 0;
_picAniInfos = 0;
_picAniInfosCount = 0;
_isLoaded = 0;
_entranceData = 0;
_entranceDataCount = 0;
}

bool Sc2::load(MfcArchive &file) {
debug(5, "Sc2::load()");

_sceneId = file.readUint16LE();

_motionController = (CMotionController *)file.readClass();

_count1 = file.readUint32LE();
debug(4, "count1: %d", _count1);
if (_count1 > 0) {
_data1 = (int32 *)malloc(_count1 * sizeof(int32));

for (int i = 0; i < _count1; i++) {
_data1[i] = file.readUint32LE();
}
} else {
_data1 = 0;
}

_defPicAniInfosCount = file.readUint32LE();
debug(4, "defPicAniInfos: %d", _defPicAniInfosCount);
if (_defPicAniInfosCount > 0) {
_defPicAniInfos = (PicAniInfo **)malloc(_defPicAniInfosCount * sizeof(PicAniInfo *));

for (int i = 0; i < _defPicAniInfosCount; i++) {
_defPicAniInfos[i] = new PicAniInfo();

_defPicAniInfos[i]->load(file);
}
} else {
_defPicAniInfos = 0;
}

_picAniInfos = 0;
_picAniInfosCount = 0;

_entranceDataCount = file.readUint32LE();
debug(4, "_entranceData: %d", _entranceDataCount);

if (_entranceDataCount > 0) {
_entranceData = (EntranceInfo **)malloc(_entranceDataCount * sizeof(EntranceInfo *));

for (int i = 0; i < _entranceDataCount; i++) {
_entranceData[i] = new EntranceInfo();
_entranceData[i]->load(file);
}
} else {
_entranceData = 0;
}

if (file.size() - file.pos() > 0)
error("Sc2::load(): (%d bytes left)", file.size() - file.pos());

return true;
}

bool PicAniInfo::load(MfcArchive &file) {
debug(5, "PicAniInfo::load()");

Expand Down

0 comments on commit e8f4c28

Please sign in to comment.