EMI: Add support for TEXI components

This commit is contained in:
Dries Harnie 2012-07-14 12:11:05 +02:00
parent cf1d73420b
commit 6b0e289058
4 changed files with 117 additions and 2 deletions

View File

@ -0,0 +1,63 @@
/* 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 COPYRIGHT
* file distributed with this source distribution.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "engines/grim/costume.h"
#include "engines/grim/debug.h"
#include "engines/grim/material.h"
#include "engines/grim/savegame.h"
#include "engines/grim/emi/costumeemi.h"
#include "engines/grim/emi/modelemi.h"
#include "engines/grim/emi/costume/emimesh_component.h"
#include "engines/grim/emi/costume/emitexi_component.h"
namespace Grim {
EMITexiComponent::EMITexiComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag) : Component(parent, parentID, filename, tag) {
}
EMITexiComponent::~EMITexiComponent() {
if (_mat)
_mat->dereference();
}
void EMITexiComponent::init() {
EMICostume *c = static_cast<EMICostume *>(_cost);
_mat = c->findSharedMaterial(_name);
}
int EMITexiComponent::update(uint time) {
return 0;
}
void EMITexiComponent::setKey(int k) {
if (_mat)
_mat->setActiveTexture(k);
}
void EMITexiComponent::reset() {
}
void EMITexiComponent::draw() {
}
} // end of namespace Grim

View File

@ -0,0 +1,50 @@
/* 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 COPYRIGHT
* file distributed with this source distribution.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#ifndef GRIM_EMI_TEXI_COMPONENT_H
#define GRIM_EMI_TEXI_COMPONENT_H
#include "engines/grim/costume/component.h"
#include "engines/grim/material.h"
#include "engines/grim/resource.h"
#include "engines/grim/model.h"
namespace Grim {
class EMITexiComponent : public Component {
public:
EMITexiComponent(Component *parent, int parentID, const char *filename, Component *prevComponent, tag32 tag);
~EMITexiComponent();
void init();
int update(uint time);
void reset();
void draw();
void setKey(int k);
private:
Material * _mat;
};
} // end of namespace Grim
#endif

View File

@ -34,6 +34,7 @@
#include "engines/grim/emi/costume/emimesh_component.h"
#include "engines/grim/emi/costume/emiskel_component.h"
#include "engines/grim/emi/costume/emisprite_component.h"
#include "engines/grim/emi/costume/emitexi_component.h"
#include "engines/grim/costume/main_model_component.h"
namespace Grim {
@ -157,8 +158,8 @@ Component *EMICostume::loadComponent(Component *parent, int parentID, const char
//Debug::warning(Debug::Costumes, "Actor::loadComponentEMI Implement SKEL-handling: %s" , name);
return new EMISkelComponent(parent, parentID, name, prevComponent, tag);
} else if (tag == MKTAG('t','e','x','i')) {
Debug::warning(Debug::Costumes, "Actor::loadComponentEMI Implement TEXI-handling: %s" , name);
//return new MaterialComponent(parent, parentID, name, tag);
// Debug::warning(Debug::Costumes, "Actor::loadComponentEMI Implement TEXI-handling: %s" , name);
return new EMITexiComponent(parent, parentID, name, prevComponent, tag);
} else if (tag == MKTAG('a','n','i','m')) {
//Debug::warning(Debug::Costumes, "Actor::loadComponentEMI Implement ANIM-handling: %s" , name);
return new EMIAnimComponent(parent, parentID, name, prevComponent, tag);

View File

@ -18,6 +18,7 @@ MODULE_OBJS := \
emi/costume/emimesh_component.o \
emi/costume/emiskel_component.o \
emi/costume/emisprite_component.o \
emi/costume/emitexi_component.o \
emi/sound/aifftrack.o \
emi/sound/mp3track.o \
emi/sound/scxtrack.o \