/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx 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, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli co-programmer: */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "npc_test.h" #include #include "state.h" #include "debug.h" #include "loading/factory.h" #include "loading/load_param.h" #include "md2/md2Model.h" #include "player.h" #include "playable.h" #include "weapons/test_gun.h" #include "weapons/turret.h" #include "weapons/cannon.h" ObjectListDefinition(NPC2); CREATE_FACTORY(NPC2); NPC2::NPC2(const TiXmlElement* root) { this->registerObject(this, NPC2::_objectList); if (root != NULL) this->loadParams(root); // create the weapons and their manager this->getWeaponManager().changeWeaponConfig(1); Weapon* wpRight = new TestGun(0); wpRight->setName("testGun Right"); Weapon* wpLeft = new TestGun(1); wpLeft->setName("testGun Left"); this->addWeapon(wpLeft, 1, 0); this->addWeapon(wpRight,1 ,1); this->setHealthMax(100); this->setHealth(80); this->getWeaponManager().setSlotCount(7); this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0)); this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); this->getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0)); this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); this->getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5)); this->getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); this->getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5)); this->getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); this->getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5)); this->getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5)); this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0)); this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); this->getWeaponManager().getFixedTarget()->setParent(this); this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); } NPC2::~NPC2() { } void NPC2::loadParams(const TiXmlElement* root) { NPC::loadParams(root); } void NPC2::tick(float dt) { // animating the md2 model if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID())) ((MD2Model*)this->getModel(0))->tick(dt); }