[4555] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Patrick Boenzli |
---|
[1853] | 13 | */ |
---|
| 14 | |
---|
[3590] | 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD |
---|
| 16 | |
---|
[6358] | 17 | #include "single_player_world.h" |
---|
[3608] | 18 | |
---|
[4347] | 19 | #include "state.h" |
---|
[6358] | 20 | #include "class_list.h" |
---|
[4347] | 21 | |
---|
[4726] | 22 | #include "load_param.h" |
---|
[4940] | 23 | #include "fast_factory.h" |
---|
[4261] | 24 | #include "factory.h" |
---|
[4245] | 25 | |
---|
[6360] | 26 | #include "world_entity.h" |
---|
| 27 | #include "npcs/npc_test1.h" |
---|
[4504] | 28 | |
---|
[4747] | 29 | |
---|
[6358] | 30 | using namespace std; |
---|
[4820] | 31 | |
---|
[6358] | 32 | //! This creates a Factory to fabricate a SinglePlayerWorld |
---|
[6360] | 33 | CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD); |
---|
[5915] | 34 | |
---|
[5996] | 35 | |
---|
[5205] | 36 | |
---|
[6358] | 37 | SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root) |
---|
| 38 | : GameWorld(root) |
---|
[4010] | 39 | { |
---|
[6374] | 40 | this->setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerSinglePlayerWorld"); |
---|
| 41 | this->setName("SinglePlayerWorld uninitialized"); |
---|
| 42 | |
---|
[4261] | 43 | this->loadParams(root); |
---|
[4010] | 44 | } |
---|
| 45 | |
---|
[6358] | 46 | |
---|
[4555] | 47 | /** |
---|
[6358] | 48 | * remove the SinglePlayerWorld from memory |
---|
[6150] | 49 | * |
---|
| 50 | * delete everything explicitly, that isn't contained in the parenting tree! |
---|
| 51 | * things contained in the tree are deleted automaticaly |
---|
[4838] | 52 | */ |
---|
[6358] | 53 | SinglePlayerWorld::~SinglePlayerWorld () |
---|
[1872] | 54 | { |
---|
[6358] | 55 | PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n"); |
---|
| 56 | } |
---|
[3677] | 57 | |
---|
[5115] | 58 | |
---|
[3526] | 59 | /** |
---|
[6358] | 60 | * loads the parameters of a SinglePlayerWorld from an XML-element |
---|
[4978] | 61 | * @param root the XML-element to load from |
---|
| 62 | */ |
---|
[6358] | 63 | void SinglePlayerWorld::loadParams(const TiXmlElement* root) |
---|
[4261] | 64 | { |
---|
[6364] | 65 | static_cast<GameWorld*>(this)->loadParams(root); |
---|
[4261] | 66 | |
---|
[6358] | 67 | PRINTF(4)("Creating a SinglePlayerWorld\n"); |
---|
| 68 | } |
---|
[4834] | 69 | |
---|
| 70 | |
---|
[4261] | 71 | |
---|
[4829] | 72 | |
---|
[6365] | 73 | // ErrorMessage SinglePlayerWorld::load() |
---|
| 74 | // { |
---|
| 75 | // static_cast<GameWorld*>(this)->load(); |
---|
| 76 | // |
---|
| 77 | // /* the the single player specific stuff here */ |
---|
| 78 | // |
---|
| 79 | // /* some static world entities */ |
---|
| 80 | // for(int i = 0; i < 100; i++) |
---|
| 81 | // { |
---|
| 82 | // WorldEntity* tmp = new NPCTest1(); |
---|
| 83 | // char npcChar[10]; |
---|
| 84 | // sprintf (npcChar, "NPC_%d", i); |
---|
| 85 | // tmp->setName(npcChar); |
---|
| 86 | // tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30); |
---|
| 87 | // this->spawn(tmp); |
---|
| 88 | // } |
---|
| 89 | // } |
---|
[3526] | 90 | |
---|