1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
21 // A level is, well, the current level.
31 #include "MediaLoader.h"
32 #include "PluginLoader.h"
33 #include "PhysicsSimulation.h"
34 #include "EventPipeline.h"
35 #include "parselevel.h"
37 #include "../plugins/graphics/Graphics.h"
38 #include "../plugins/script/ScriptVM.h"
39 #include "../plugins/audio/Audio.h"
40 #include "../plugins/input/InputManager.h"
44 typedef Pair
<int> LevelPair
;
45 const int PROCESS_TIME
= 20;
46 const float PROCESS_PIECE
= 0.05;
65 struct LActor
// this bullshit is not cool
83 std::string presentation
;
86 std::vector
<LevelActor
> actors
;
87 std::vector
<LevelGraphic
> static_graphics
;
93 std::map
<std::string
, LevelSlice
> slices
;
94 std::vector
<std::string
> presentations
;
96 LevelSlice
getSlice(std::string
);
97 std::string
toString();
100 class PhysicsSimulation
;
104 class Level
: public ScriptedClass
107 Level(LevelSlice
, Game
& game
);
108 Level(LevelSlice
, Level
&, Game
&);
111 void init(std::vector
<ActorData
> actor_defs
,
112 EventPipeline
* pipeline
, Audio
& audio
, ScriptVM
* script_vm
);
113 void cycle(Display
*);
117 func
getConstructor();
120 std::string
getClassName();
121 std::vector
<std::string
> getClassFunctions();
122 Variant
* callFunction(std::string funcname
,
123 std::vector
<Variant
*> params
, ScriptVM
* script_vm
);
127 static LevelData
parseXML(std::string source
,
128 MediaLoader
& media_loader
);
130 std::string presentation
;
131 LevelSlice level_data
;
133 PhysicsSimulation
* simulation
;
139 std::vector
<ActorData
> actor_defs
;
140 EventPipeline
* pipeline
;
144 std::vector
<LActor
> actors
;
145 std::vector
<StaticGraphic
> static_graphics
;