| 1 |  | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
| 5 |  | 
|---|
| 6 |    Copyright (C) 2004 orx | 
|---|
| 7 |  | 
|---|
| 8 |    This program is free software; you can redistribute it and/or modify | 
|---|
| 9 |    it under the terms of the GNU General Public License as published by | 
|---|
| 10 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 11 |    any later version. | 
|---|
| 12 |  | 
|---|
| 13 |    ### File Specific: | 
|---|
| 14 |    main-programmer: Patrick Boenzli | 
|---|
| 15 |    co-programmer: | 
|---|
| 16 | */ | 
|---|
| 17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #include "npc_test.h" | 
|---|
| 21 | #include <stdio.h> | 
|---|
| 22 |  | 
|---|
| 23 | #include "state.h" | 
|---|
| 24 | #include "debug.h" | 
|---|
| 25 |  | 
|---|
| 26 | #include "loading/factory.h" | 
|---|
| 27 | #include "loading/load_param.h" | 
|---|
| 28 |  | 
|---|
| 29 | #include "md2/md2Model.h" | 
|---|
| 30 | #include "player.h" | 
|---|
| 31 | #include "playable.h" | 
|---|
| 32 |  | 
|---|
| 33 | #include "class_id_DEPRECATED.h" | 
|---|
| 34 | #include "movement_module.h" | 
|---|
| 35 | #include "ai_module.h" | 
|---|
| 36 | #include "ai_team.h" | 
|---|
| 37 | #include "ai_swarm.h" | 
|---|
| 38 | #include "ai_engine.h" | 
|---|
| 39 |  | 
|---|
| 40 | ObjectListDefinitionID(NPC2, CL_NPC_TEST2); | 
|---|
| 41 | CREATE_FACTORY(NPC2); | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | NPC2::NPC2(const TiXmlElement* root) : NPC(NULL) | 
|---|
| 45 | { | 
|---|
| 46 |         this->registerObject(this, NPC2::_objectList); | 
|---|
| 47 |  | 
|---|
| 48 |         if (root != NULL) | 
|---|
| 49 |                 this->loadParams(root); | 
|---|
| 50 |  | 
|---|
| 51 |         std::cout << "Team Number: " << teamNumber << "\n"; | 
|---|
| 52 |         std::cout << "Swarm Number:" << swarmNumber << "\n"; | 
|---|
| 53 |  | 
|---|
| 54 |         AITeam* myTeam=AIEngine::getInstance()->getCreateTeam(teamNumber); | 
|---|
| 55 |         //std::cout << "Testpoint 4: " << myTeam << "\n"; | 
|---|
| 56 |         AISwarm* mySwarm=myTeam->getCreateSwarm(swarmNumber); | 
|---|
| 57 |         //std::cout << "Testpoint 5: " << mySwarm << "\n"; | 
|---|
| 58 |         mySwarm->addToSwarm(new MovementModule(this)); | 
|---|
| 59 |  | 
|---|
| 60 | } | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
| 64 | void NPC2::loadParams(const TiXmlElement* root) | 
|---|
| 65 | { | 
|---|
| 66 |   NPC::loadParams(root); | 
|---|
| 67 |  | 
|---|
| 68 |   LoadParam(root, "team", this, NPC2, setTeamNumber) | 
|---|
| 69 |                 .describe("this sets the team number") | 
|---|
| 70 |                 .defaultValues(0); | 
|---|
| 71 |  | 
|---|
| 72 |   LoadParam(root, "swarm", this, NPC2, setSwarmNumber) | 
|---|
| 73 |                 .describe("this sets the swarm number") | 
|---|
| 74 |                 .defaultValues(0); | 
|---|
| 75 | } | 
|---|
| 76 |  | 
|---|
| 77 |  | 
|---|
| 78 |  | 
|---|
| 79 | void NPC2::tick(float dt) | 
|---|
| 80 | { | 
|---|
| 81 |         // animating the md2 model | 
|---|
| 82 |         if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID())) | 
|---|
| 83 |                 ((MD2Model*)this->getModel(0))->tick(dt); | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|