1 | /* |
---|
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. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Patrick Boenzli |
---|
13 | */ |
---|
14 | |
---|
15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD |
---|
16 | |
---|
17 | #include "single_player_world.h" |
---|
18 | |
---|
19 | #include "state.h" |
---|
20 | #include "class_list.h" |
---|
21 | |
---|
22 | #include "load_param.h" |
---|
23 | #include "fast_factory.h" |
---|
24 | #include "factory.h" |
---|
25 | |
---|
26 | #include "world_entity.h" |
---|
27 | #include "npcs/npc_test1.h" |
---|
28 | |
---|
29 | |
---|
30 | using namespace std; |
---|
31 | |
---|
32 | //! This creates a Factory to fabricate a SinglePlayerWorld |
---|
33 | CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD); |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root) |
---|
38 | : GameWorld(root) |
---|
39 | { |
---|
40 | this->setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerSinglePlayerWorld"); |
---|
41 | this->setName("SinglePlayerWorld uninitialized"); |
---|
42 | |
---|
43 | this->loadParams(root); |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | /** |
---|
48 | * remove the SinglePlayerWorld from memory |
---|
49 | * |
---|
50 | * delete everything explicitly, that isn't contained in the parenting tree! |
---|
51 | * things contained in the tree are deleted automaticaly |
---|
52 | */ |
---|
53 | SinglePlayerWorld::~SinglePlayerWorld () |
---|
54 | { |
---|
55 | PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n"); |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | /** |
---|
60 | * loads the parameters of a SinglePlayerWorld from an XML-element |
---|
61 | * @param root the XML-element to load from |
---|
62 | */ |
---|
63 | void SinglePlayerWorld::loadParams(const TiXmlElement* root) |
---|
64 | { |
---|
65 | static_cast<GameWorld*>(this)->loadParams(root); |
---|
66 | |
---|
67 | PRINTF(4)("Creating a SinglePlayerWorld\n"); |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | |
---|
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 | // } |
---|
90 | |
---|