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 "multi_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 | |
---|
27 | using namespace std; |
---|
28 | |
---|
29 | //! This creates a Factory to fabricate a MultiPlayerWorld |
---|
30 | CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD); |
---|
31 | |
---|
32 | |
---|
33 | MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root) |
---|
34 | : GameWorld(root) |
---|
35 | { |
---|
36 | this->constuctorInit("", -1); |
---|
37 | this->path = NULL; |
---|
38 | |
---|
39 | this->loadParams(root); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * remove the MultiPlayerWorld from memory |
---|
45 | * |
---|
46 | * delete everything explicitly, that isn't contained in the parenting tree! |
---|
47 | * things contained in the tree are deleted automaticaly |
---|
48 | */ |
---|
49 | MultiPlayerWorld::~MultiPlayerWorld () |
---|
50 | { |
---|
51 | PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n"); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | /** |
---|
56 | * initializes the world. |
---|
57 | * @param name the name of the world |
---|
58 | * @param worldID the ID of this world |
---|
59 | * |
---|
60 | * set all stuff here that is world generic and does not use to much memory |
---|
61 | * because the real init() function StoryEntity::init() will be called |
---|
62 | * shortly before start of the game. |
---|
63 | * since all worlds are initiated/referenced before they will be started. |
---|
64 | * NO LEVEL LOADING HERE - NEVER! |
---|
65 | */ |
---|
66 | void MultiPlayerWorld::constuctorInit(const char* name, int worldID) |
---|
67 | { |
---|
68 | this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld"); |
---|
69 | this->setName(name); |
---|
70 | |
---|
71 | this->gameTime = 0.0f; |
---|
72 | this->setSpeed(1.0); |
---|
73 | this->music = NULL; |
---|
74 | this->shell = NULL; |
---|
75 | this->localPlayer = NULL; |
---|
76 | this->localCamera = NULL; |
---|
77 | |
---|
78 | this->showPNodes = false; |
---|
79 | this->showBV = false; |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | /** |
---|
84 | * loads the parameters of a MultiPlayerWorld from an XML-element |
---|
85 | * @param root the XML-element to load from |
---|
86 | */ |
---|
87 | void MultiPlayerWorld::loadParams(const TiXmlElement* root) |
---|
88 | { |
---|
89 | static_cast<GameWorld*>(this)->loadParams(root); |
---|
90 | |
---|
91 | PRINTF(4)("Creating a MultiPlayerWorld\n"); |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | /** |
---|
97 | * this is executed just before load |
---|
98 | * |
---|
99 | * since the load function sometimes needs data, that has been initialized |
---|
100 | * before the load and after the proceeding storyentity has finished |
---|
101 | */ |
---|
102 | ErrorMessage MultiPlayerWorld::preLoad() |
---|
103 | { |
---|
104 | static_cast<GameWorld*>(this)->preLoad(); |
---|
105 | |
---|
106 | /* the the single player specific stuff */ |
---|
107 | } |
---|
108 | |
---|
109 | |
---|
110 | /** |
---|
111 | * loads the MultiPlayerWorld by initializing all resources, and set their default values. |
---|
112 | */ |
---|
113 | ErrorMessage MultiPlayerWorld::load() |
---|
114 | { |
---|
115 | static_cast<GameWorld*>(this)->load(); |
---|
116 | |
---|
117 | /* the the single player specific stuff here */ |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | /** |
---|
122 | * post loads the MultiPlayerWorld by initializing all resources, and set their default values. |
---|
123 | */ |
---|
124 | ErrorMessage MultiPlayerWorld::postLoad() |
---|
125 | { |
---|
126 | static_cast<GameWorld*>(this)->postLoad(); |
---|
127 | |
---|
128 | /* the single player specific stuff here */ |
---|
129 | } |
---|
130 | |
---|