/* 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 3 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, see .
*
*/
#include "engines/stark/resources/object.h"
#include "common/debug-channels.h"
#include "common/streamdebug.h"
#include "common/util.h"
#include "engines/stark/debug.h"
#include "engines/stark/formats/xrc.h"
namespace Stark {
namespace Resources {
Type::Type(ResourceType type) {
_type = type;
}
Type::Type() {
_type = kInvalid;
}
const char *Type::getName() const {
static const struct {
Type::ResourceType type;
const char *name;
} typeNames[] = {
{ Type::kInvalid, "Invalid" },
{ Type::kRoot, "Root" },
{ Type::kLevel, "Level" },
{ Type::kLocation, "Location" },
{ Type::kLayer, "Layer" },
{ Type::kCamera, "Camera" },
{ Type::kFloor, "Floor" },
{ Type::kFloorFace, "FloorFace" },
{ Type::kItem, "Item" },
{ Type::kScript, "Script" },
{ Type::kAnimHierarchy, "AnimHierarchy" },
{ Type::kAnim, "Anim" },
{ Type::kDirection, "Direction" },
{ Type::kImage, "Image" },
{ Type::kAnimScript, "AnimScript" },
{ Type::kAnimScriptItem, "AnimScriptItem" },
{ Type::kSoundItem, "SoundItem" },
{ Type::kPath, "Path" },
{ Type::kFloorField, "FloorField" },
{ Type::kBookmark, "Bookmark" },
{ Type::kKnowledgeSet, "KnowledgeSet" },
{ Type::kKnowledge, "Knowledge" },
{ Type::kCommand, "Command" },
{ Type::kPATTable, "PATTable" },
{ Type::kContainer, "Container" },
{ Type::kDialog, "Dialog" },
{ Type::kSpeech, "Speech" },
{ Type::kLight, "Light" },
{ Type::kCursor, "Cursor" },
{ Type::kBonesMesh, "BonesMesh" },
{ Type::kScroll, "Scroll" },
{ Type::kFMV, "FMV" },
{ Type::kLipSync, "LipSynch" },
{ Type::kAnimSoundTrigger, "AnimSoundTrigger" },
{ Type::kString, "String" },
{ Type::kTextureSet, "TextureSet" }
};
for (uint i = 0; i < ARRAYSIZE(typeNames); i++) {
if (typeNames[i].type == _type) {
return typeNames[i].name;
}
}
return nullptr;
}
Type::ResourceType Type::get() const {
return _type;
}
Object::Object(Object *parent, byte subType, uint16 index, const Common::String &name) :
_parent(parent),
_type(Type::kInvalid),
_subType(subType),
_index(index),
_name(name) {
}
Object::~Object() {
// Delete the children resources
Common::Array