STARK: Add an anim script resource type

This commit is contained in:
Bastien Bouclet 2015-01-01 16:46:23 +01:00
parent 7c66c67baf
commit 8fec4a83fe
4 changed files with 134 additions and 0 deletions

View file

@ -13,6 +13,7 @@ MODULE_OBJS := \
gfx/tinygl.o \
resources/anim.o \
resources/animhierarchy.o \
resources/animscript.o \
resources/camera.o \
resources/command.o \
resources/floor.o \

View file

@ -0,0 +1,62 @@
/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* 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 "common/debug.h"
#include "engines/stark/resources/animscript.h"
#include "engines/stark/xrcreader.h"
namespace Stark {
AnimScript::~AnimScript() {
}
AnimScript::AnimScript(Resource *parent, byte subType, uint16 index, const Common::String &name) :
Resource(parent, subType, index, name) {
_type = TYPE;
}
void AnimScript::printData() {
}
AnimScriptItem::~AnimScriptItem() {
}
AnimScriptItem::AnimScriptItem(Resource *parent, byte subType, uint16 index, const Common::String &name) :
Resource(parent, subType, index, name),
_opcode(0),
_duration(0),
_operand(0) {
_type = TYPE;
}
void AnimScriptItem::readData(XRCReadStream *stream) {
_opcode = stream->readUint32LE();
_duration = stream->readUint32LE();
_operand = stream->readUint32LE();
}
void AnimScriptItem::printData() {
debug("op: %d, duration: %d ms, operand: %d", _opcode, _duration, _operand);
}
} // End of namespace Stark

View file

@ -0,0 +1,64 @@
/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* 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.
*
*/
#ifndef STARK_RESOURCES_ANIM_SCRIPT_H
#define STARK_RESOURCES_ANIM_SCRIPT_H
#include "common/str.h"
#include "engines/stark/resources/resource.h"
namespace Stark {
class XRCReadStream;
class AnimScript : public Resource {
public:
static const ResourceType::Type TYPE = ResourceType::kAnimScript;
AnimScript(Resource *parent, byte subType, uint16 index, const Common::String &name);
virtual ~AnimScript();
protected:
void printData() override;
};
class AnimScriptItem : public Resource {
public:
static const ResourceType::Type TYPE = ResourceType::kAnimScriptItem;
AnimScriptItem(Resource *parent, byte subType, uint16 index, const Common::String &name);
virtual ~AnimScriptItem();
void readData(XRCReadStream *stream) override;
uint32 _opcode;
uint32 _operand;
uint32 _duration;
protected:
void printData() override;
};
} // End of namespace Stark
#endif // STARK_RESOURCES_ANIM_SCRIPT_H

View file

@ -24,6 +24,7 @@
#include "engines/stark/resources/anim.h"
#include "engines/stark/resources/animhierarchy.h"
#include "engines/stark/resources/animscript.h"
#include "engines/stark/resources/camera.h"
#include "engines/stark/resources/command.h"
#include "engines/stark/resources/item.h"
@ -170,6 +171,12 @@ Resource *XRCReader::createResource(XRCReadStream *stream, Resource *parent) {
case ResourceType::kAnim:
resource = Anim::construct(parent, subType, index, name);
break;
case ResourceType::kAnimScript:
resource = new AnimScript(parent, subType, index, name);
break;
case ResourceType::kAnimScriptItem:
resource = new AnimScriptItem(parent, subType, index, name);
break;
case ResourceType::kCommand:
resource = new Command(parent, subType, index, name);
break;