Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-11 00:19:11 +0000
committerStijn Buys <ingar@osirion.org>2008-02-11 00:19:11 +0000
commitafec8e7c3aec1a186512b997ed3b717efef8fc43 (patch)
tree92f19ef9144bd271c72a19a15ae32b7dcdcd994c /src/game
parent825d5a44bd312772c53fdaa8924e4009cfb320a3 (diff)
renamed Entity.base_* to Entity.core_*
fixed camera::mode::Overview
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Makefile.am3
-rw-r--r--src/game/game.cc28
-rw-r--r--src/game/game.h10
-rw-r--r--src/game/ship.cc6
-rw-r--r--src/game/star.cc10
5 files changed, 41 insertions, 16 deletions
diff --git a/src/game/Makefile.am b/src/game/Makefile.am
index 584981a..f86c814 100644
--- a/src/game/Makefile.am
+++ b/src/game/Makefile.am
@@ -5,5 +5,4 @@ libgame_la_LDFLAGS = -avoid-version
libgame_la_SOURCES = game.cc sector.cc ship.cc shipspecs.cc star.cc
noinst_LTLIBRARIES = libgame.la
-noinst_HEADERS = game.h player.h sector.h shared.h ship.h shipspecs.h star.h \
- world.h
+noinst_HEADERS = game.h player.h sector.h ship.h shipspecs.h star.h world.h
diff --git a/src/game/game.cc b/src/game/game.cc
index 197700f..51bb565 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -108,26 +108,28 @@ bool Game::init()
ship->label = "ship: Micron Vector";
core::Entity *cube = new core::Entity(core::entity::Solid & core::entity::Static);
- cube->base_shape = core::entity::Cube;
- cube->base_color = Color(0.0f, 0.8f, 0.0f);
+ cube->core_shape = core::entity::Cube;
+ cube->core_color = Color(0.0f, 0.8f, 0.0f);
cube->location = Vector3f(24.0f, 0.0f, -24.0f);
cube->label ="cube: Borg cube green";
+ cube->type = cube_enttype;
cube = new core::Entity(core::entity::Solid & core::entity::Static);
- cube->base_shape = core::entity::Cube;
- cube->base_color = Color(1.0f, 0.0f, 0.0f);
+ cube->core_shape = core::entity::Cube;
+ cube->core_color = Color(1.0f, 0.0f, 0.0f);
cube->location = Vector3f(16.0f, 0.0f, -16.0f);
cube->label ="cube: Borg cube red";
+ cube->type = cube_enttype;
core::Entity *sphere = new core::Entity(core::entity::Solid & core::entity::Static);
- sphere->base_shape = core::entity::Sphere;
- sphere->base_color = Color(0.8f, 0.8f, 0.0f);
+ sphere->core_shape = core::entity::Sphere;
+ sphere->core_color = Color(0.8f, 0.8f, 0.0f);
sphere->location = Vector3f(0.0f, 0.0f, -32.0f);
sphere->label ="sphere: The Sphere";
core::Entity *axis = new core::Entity(core::entity::Static);
- axis->base_shape = core::entity::Diamond;
- axis->base_color = Color(1.0f, 1.0f, 0.0f);
+ axis->core_shape = core::entity::Diamond;
+ axis->core_color = Color(1.0f, 1.0f, 0.0f);
axis->location = Vector3f(0, 0, 0);
axis->label = "axis: Origin";
@@ -152,4 +154,14 @@ void Game::frame(float seconds)
ship->update(seconds);
}
+void Game::event_join(core::Player *player)
+{
+ if (!player)
+ return;
+
+ ship = new Ship();
+ ship->location = Vector3f(0,0,0);
+ ship->label = "ship: Micron Vector";
+}
+
}; // namespace game
diff --git a/src/game/game.h b/src/game/game.h
index bceb62d..abe0c0d 100644
--- a/src/game/game.h
+++ b/src/game/game.h
@@ -33,6 +33,9 @@ public:
/// execute one game grame
void frame(float seconds);
+ /// a player joins the game
+ void event_join(core::Player *player);
+
/// sectors in space
std::vector<Sector*> sectors;
@@ -47,6 +50,13 @@ private:
std::string author;
};
+// entity type constants
+const unsigned int ship_enttype = 256;
+const unsigned int star_enttype = 257;
+const unsigned int cube_enttype = 258;
+const unsigned int sphere_enttype = 259;
+const unsigned int axis_enttype = 260;
+
}
#endif // __INCLUDED_GAME_H__
diff --git a/src/game/ship.cc b/src/game/ship.cc
index 1ef4b9d..d6333cd 100644
--- a/src/game/ship.cc
+++ b/src/game/ship.cc
@@ -5,7 +5,7 @@
*/
// project headers
-#include "game/shared.h"
+#include "game/game.h"
#include "game/ship.h"
#include "math/mathlib.h"
@@ -17,8 +17,10 @@ using math::degrees180f;
namespace game {
-Ship::Ship() : core::Entity(0, ship_enttype)
+Ship::Ship() : core::Entity(0)
{
+ type = ship_enttype;
+
speed = 0;
yaw_current = 0;
yaw_target = yaw_current;
diff --git a/src/game/star.cc b/src/game/star.cc
index 5fed82a..10bb6ee 100644
--- a/src/game/star.cc
+++ b/src/game/star.cc
@@ -4,7 +4,7 @@
the terms of the GNU General Public License version 2.
*/
-#include "game/shared.h"
+#include "game/game.h"
#include "game/star.h"
@@ -12,9 +12,11 @@ namespace game {
Star::Star() : core::Entity(core::entity::Static & core::entity::Solid)
{
- base_shape = core::entity::Sphere; // a star is a sphere
- base_color = math::Color(1,1,1,1); // white
- base_radius = 48; // 48 game units
+ core_shape = core::entity::Sphere; // a star is a sphere
+ core_color = math::Color(1,1,1,1); // white
+ core_radius = 48; // 48 game units
+
+ type = star_enttype;
}
Star::~Star()