2010-01-27 19:14:07 +01:00
|
|
|
/* Residual - A 3D game interpreter
|
|
|
|
*
|
|
|
|
* Residual 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 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
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "engines/stark/scene.h"
|
|
|
|
#include "engines/stark/archive.h"
|
|
|
|
#include "engines/stark/xmg.h"
|
|
|
|
|
2010-08-29 19:09:03 +09:30
|
|
|
#include "engines/stark/actor.h"
|
2010-02-03 10:39:42 +01:00
|
|
|
#include "engines/stark/xrc.h"
|
|
|
|
|
2010-01-27 19:14:07 +01:00
|
|
|
namespace Stark {
|
|
|
|
|
|
|
|
Scene::Scene(GfxDriver *gfx) : _gfx(gfx) {
|
|
|
|
// Open the scene archive
|
|
|
|
XARCArchive xarc;
|
|
|
|
if (!xarc.open("45/00/00.xarc"))
|
|
|
|
warning("couldn't open archive");
|
|
|
|
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_layercenter.xmg", 0, 0));
|
|
|
|
//_elements.push_back(SceneElementXMG::load(&xarc, "vista-scapehaze-more-fog3-final.xmg", 0, 0));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop01_pillow.xmg", 384, 267));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop02_pillow.xmg", 324, 299));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop03_pillow.xmg", 141, 312));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop4_armrest.xmg", 171, 184));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop5_chair.xmg", 170, 164));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop6_wall.xmg", 0, 0));
|
|
|
|
_elements.push_back(SceneElementXMG::load(&xarc, "house_prop8_pillar.xmg", 534, 0));
|
2010-02-03 10:39:42 +01:00
|
|
|
|
2010-08-29 19:09:03 +09:30
|
|
|
SceneElementActor *actor = SceneElementActor::load(&xarc, "oldapril.cir");
|
|
|
|
actor->setAnim(&xarc, "oldapril_idle.ani");
|
2010-09-05 19:36:37 +09:30
|
|
|
actor->setTexture(&xarc, "oldapril.tm");
|
2010-08-29 19:09:03 +09:30
|
|
|
_elements.push_back(actor);
|
2010-02-03 10:39:42 +01:00
|
|
|
// Just to test the XRC loading code
|
|
|
|
XRCNode *node = XRCNode::read(xarc.createReadStreamForMember("00.xrc"));
|
|
|
|
delete node;
|
2010-01-27 19:14:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Scene::~Scene() {
|
|
|
|
// Delete all the elements
|
|
|
|
Common::Array<SceneElement *>::iterator element = _elements.begin();
|
|
|
|
while (element != _elements.end()) {
|
|
|
|
delete *element;
|
|
|
|
element++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-04 22:31:13 +09:30
|
|
|
void Scene::render(uint32 delta) {
|
2010-01-27 19:14:07 +01:00
|
|
|
// setup cam
|
2010-09-09 18:23:52 +02:00
|
|
|
|
2010-01-27 19:14:07 +01:00
|
|
|
// Draw bg
|
|
|
|
|
|
|
|
// Draw other things
|
|
|
|
|
|
|
|
// Render all the scene elements
|
|
|
|
Common::Array<SceneElement *>::iterator element = _elements.begin();
|
|
|
|
while (element != _elements.end()) {
|
|
|
|
// Draw the current element
|
2010-09-04 22:31:13 +09:30
|
|
|
(*element)->update(delta);
|
2010-01-27 19:14:07 +01:00
|
|
|
(*element)->render(_gfx);
|
|
|
|
|
|
|
|
// Go for the next one
|
|
|
|
element++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//_gfx->set3DMode();
|
|
|
|
|
|
|
|
// setup lights
|
|
|
|
|
|
|
|
// draw actors
|
|
|
|
|
|
|
|
// draw overlay
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Stark
|