Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-02-24 19:13:27 +0000
committerStijn Buys <ingar@osirion.org>2009-02-24 19:13:27 +0000
commit53faab4c1d692fed7c7ecfedea57fc457bf61e80 (patch)
treed5dab7709dd4dc5409ab0e62920bb4d62790a90a /src
parent0e96454c70e56de5cefa38ab1b5dc46196238d07 (diff)
Replaced 'The Osirion Project' with 'Project::OSiRioN' in messages,
added g_collision cflag to facillitate future development, added ShowOnMap entity flag
Diffstat (limited to 'src')
-rw-r--r--src/client/map.cc16
-rw-r--r--src/client/map.h4
-rw-r--r--src/core/core.cc2
-rw-r--r--src/core/entity.h5
-rw-r--r--src/core/parser.cc7
-rw-r--r--src/dedicated/console.cc2
-rw-r--r--src/game/base/game.cc7
-rw-r--r--src/game/base/game.h3
-rw-r--r--src/game/base/jumppoint.cc2
-rw-r--r--src/game/base/navpoint.cc1
-rw-r--r--src/game/base/planet.cc2
-rw-r--r--src/game/base/star.cc2
-rw-r--r--src/game/base/station.cc1
-rw-r--r--src/render/draw.cc17
14 files changed, 50 insertions, 21 deletions
diff --git a/src/client/map.cc b/src/client/map.cc
index 35fb6d1..f366b40 100644
--- a/src/client/map.cc
+++ b/src/client/map.cc
@@ -7,7 +7,6 @@
#include "core/application.h"
#include "client/map.h"
-#include "client/targets.h"
#include "client/input.h"
#include "ui/paint.h"
#include "render/gl.h"
@@ -20,6 +19,9 @@ Map::Map(ui::Widget *parent) : ui::Window(parent)
set_label("map");
set_border(true);
set_background(true);
+
+ map_target = 0;
+ map_hover = 0;
hide();
}
@@ -31,7 +33,7 @@ void Map::hide()
{
ui::Window::hide();
map_hover = 0;
-
+ map_target = 0;
}
void Map::toggle()
@@ -100,7 +102,7 @@ void Map::draw()
bool has_icon = false;
bool draw_icon = true;
- if ((entity->model()) || (entity->type() == core::Entity::Globe)) {
+ if (entity->flag_is_set(core::Entity::ShowOnMap)) {
has_icon = true;
if ((entity->type() == core::Entity::Dynamic) || (entity->type() == core::Entity::Controlable)) {
@@ -116,7 +118,7 @@ void Map::draw()
}
}
- if (entity == targets::current()) {
+ if (entity == map_target) {
if (core::application()->time() - floorf(core::application()->time()) < 0.5f) {
draw_icon = false;
}
@@ -134,7 +136,7 @@ void Map::draw()
if (draw_icon) {
if (entity->type() == core::Entity::Globe) {
- if ((entity->flags() & core::Entity::Bright) == core::Entity::Bright) {
+ if (entity->flag_is_set(core::Entity::Bright)) {
if (texture_current != texture_bright) {
gl::end();
texture_current = render::Textures::bind(texture_bright);
@@ -180,8 +182,10 @@ void Map::draw()
bool Map::on_keypress(const int key, const unsigned int modifier)
{
if ((hover()) && (key == 512 + SDL_BUTTON_LEFT)) {
- targets::select_target(hover());
+ //targets::select_target(hover());
+ //TODO set map target
return true;
+
} else if (key == SDLK_ESCAPE) {
if (visible()) {
hide();
diff --git a/src/client/map.h b/src/client/map.h
index d75024a..2b1bacf 100644
--- a/src/client/map.h
+++ b/src/client/map.h
@@ -8,6 +8,7 @@
#define __INCLUDED_CLIENT_MAP_H__
#include "ui/window.h"
+#include "core/entity.h"
namespace client {
@@ -32,6 +33,8 @@ protected:
virtual void draw();
size_t map_hover;
+
+ core::Entity *map_target;
};
@@ -39,3 +42,4 @@ protected:
#endif // __INCLUDED_CLIENT_MAP_H__
+
diff --git a/src/core/core.cc b/src/core/core.cc
index f511ee7..5984061 100644
--- a/src/core/core.cc
+++ b/src/core/core.cc
@@ -12,7 +12,7 @@
namespace core
{
-std::string core_name("The Osirion Project");
+std::string core_name("Project::OSiRiON");
std::string core_version(VERSION);
const std::string &name()
diff --git a/src/core/entity.h b/src/core/entity.h
index bd26abe..596a701 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -39,7 +39,7 @@ class Entity
public:
/// Entity flags
- enum Flags {Static=1, Solid=2, Bright=4, Dockable=8};
+ enum Flags {Static=1, Solid=2, Bright=4, Dockable=8, ShowOnMap=16};
/// Entity type constants
enum Type {Default=0, Dynamic=1, Controlable=2, Globe=3};
@@ -76,6 +76,9 @@ public:
/// entity flags
inline unsigned int flags() const { return entity_flags; }
+ /// returns true of a flag is set
+ inline bool flag_is_set(const Flags flag) const { return ((entity_flags & (unsigned int)flag) == (unsigned int)flag); }
+
/// entity label (can not contain double quotes ")
inline std::string const & label() { return entity_label; }
diff --git a/src/core/parser.cc b/src/core/parser.cc
index 1b35592..2cf0e39 100644
--- a/src/core/parser.cc
+++ b/src/core/parser.cc
@@ -18,6 +18,7 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
float direction;
float pitch;
float roll;
+ bool blnval;
if (inifile.got_key_string("shape", shapename)) {
@@ -47,6 +48,12 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
} else if (inifile.got_key_string("model", strval)) {
entity->set_modelname(strval);
return true;
+ } else if (inifile.got_key_bool("showonmap", blnval)) {
+ if (blnval)
+ entity->set_flag(Entity::ShowOnMap);
+ else
+ entity->unset_flag(Entity::ShowOnMap);
+ return true;
} else if (inifile.got_key_angle("direction", direction)) {
entity->axis().change_direction(direction);
return true;
diff --git a/src/dedicated/console.cc b/src/dedicated/console.cc
index 852b028..5b7d92f 100644
--- a/src/dedicated/console.cc
+++ b/src/dedicated/console.cc
@@ -192,7 +192,7 @@ void Console::draw_background()
// draw version string
color_set(2, NULL);
- std::string versionstr("The Osirion Project ");
+ std::string versionstr("Project::OSiRiON ");
versionstr.append(core::version());
int y = console_width - versionstr.size();
if (y < 0)
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 23eee3f..29c36d6 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -52,6 +52,7 @@ core::Cvar *Game::g_impulsespeed = 0;
core::Cvar *Game::g_impulseacceleration = 0;
core::Cvar *Game::g_jumppointrange = 0;
core::Cvar *Game::g_devel = 0;
+core::Cvar *Game::g_collision = 0;
core::Module *factory()
{
@@ -307,6 +308,9 @@ Game::Game() : core::Module("Project::OSiRiON", true)
g_devel = core::Cvar::get("g_devel", "0", core::Cvar::Archive);
g_devel->set_info("[bool] enable or disable developer mode");
+
+ g_collision = core::Cvar::get("g_collision", "0", core::Cvar::Archive);
+ g_collision->set_info("[bool] enable or disable collision detection");
}
Game::~Game()
@@ -853,7 +857,8 @@ void Game::frame(float seconds)
// TODO check Module::frame() is execute before are Entity::frame()
// collision
- Collision::frame(seconds);
+ if (g_collision->value())
+ Collision::frame(seconds);
}
void Game::player_connect(core::Player *player)
diff --git a/src/game/base/game.h b/src/game/base/game.h
index 0ea0d37..2af71ef 100644
--- a/src/game/base/game.h
+++ b/src/game/base/game.h
@@ -74,6 +74,9 @@ public:
/// game variable: enable or disable development mode
static core::Cvar *g_devel;
+ /// game variable: enable or disable collision
+ static core::Cvar *g_collision;
+
private:
bool load_world();
diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc
index e943c24..eb51b68 100644
--- a/src/game/base/jumppoint.cc
+++ b/src/game/base/jumppoint.cc
@@ -77,6 +77,8 @@ void JumpPoint::validate()
JumpGate::JumpGate() : JumpPoint()
{
unset_flag(core::Entity::Bright);
+ set_flag(core::Entity::ShowOnMap);
+
entity_radius = 1.0f;
entity_moduletypeid = jumpgate_enttype;
entity_eventstate = core::Entity::NoPower;
diff --git a/src/game/base/navpoint.cc b/src/game/base/navpoint.cc
index a8e44dc..2a7c876 100644
--- a/src/game/base/navpoint.cc
+++ b/src/game/base/navpoint.cc
@@ -12,6 +12,7 @@ namespace game
NavPoint::NavPoint() : core::Entity(core::Entity::Static | core::Entity::Bright)
{
+ set_flag(core::Entity::ShowOnMap);
entity_shape = core::Entity::Diamond;
entity_color.assign(1.0f, 1.0f);
entity_color_second.assign(0.6f, 1.0f);
diff --git a/src/game/base/planet.cc b/src/game/base/planet.cc
index 3bf719e..6bb1f59 100644
--- a/src/game/base/planet.cc
+++ b/src/game/base/planet.cc
@@ -12,6 +12,8 @@ namespace game {
Planet::Planet() : core::EntityGlobe(core::Entity::Static | core::Entity::Solid)
{
+ set_flag(core::Entity::ShowOnMap);
+
entity_color = math::Color(1,1,1,1); // white
entity_radius = 64; // 64 game units
diff --git a/src/game/base/star.cc b/src/game/base/star.cc
index b68b202..fa5dc32 100644
--- a/src/game/base/star.cc
+++ b/src/game/base/star.cc
@@ -12,6 +12,8 @@ namespace game {
Star::Star() : core::EntityGlobe(core::Entity::Static | core::Entity::Solid | core::Entity::Bright)
{
+ set_flag(core::Entity::ShowOnMap);
+
entity_color.assign(1,1,1,1);
entity_color_second.assign(1,1,1,1);
entity_radius = 96; // 96 game units
diff --git a/src/game/base/station.cc b/src/game/base/station.cc
index 0a959c3..d39f1c6 100644
--- a/src/game/base/station.cc
+++ b/src/game/base/station.cc
@@ -14,6 +14,7 @@ Station::Station() : Entity()
{
entity_moduletypeid = station_enttype;
set_flag(core::Entity::Dockable);
+ set_flag(core::Entity::ShowOnMap);
station_shipdealer = 0;
}
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 51530e3..a435eff 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -50,11 +50,6 @@ bool has_zone_light = false;
typedef std::map<float, core::EntityGlobe *> Globes;
Globes globes_list;
-// function to test flags
-inline bool flag_is_set(unsigned int const flags, unsigned int const flag) {
- return ((flags & flag) == flag);
-}
-
/* ---- Prepare the renderer state --------------------------------- */
void pass_prepare(float seconds)
@@ -87,7 +82,7 @@ void pass_prepare(float seconds)
}
// add level lights
- if (flag_is_set(globe->flags(), core::Entity::Bright)) {
+ if (globe->flag_is_set(core::Entity::Bright)) {
// bright globes set level light
GLfloat diffuse_light[4];
@@ -195,7 +190,7 @@ void draw_globe(core::EntityGlobe *globe)
math::Vector3f location(globe->location());
float radius = globe->radius();
- if(flag_is_set(globe->flags(), core::Entity::Bright)) {
+ if(globe->flag_is_set(core::Entity::Bright)) {
// bright globe, render fullbright
gl::disable(GL_LIGHTING);
} else {
@@ -240,7 +235,7 @@ void draw_globe(core::EntityGlobe *globe)
gl::pop();
- if(flag_is_set(globe->flags(), core::Entity::Bright)) {
+ if(globe->flag_is_set(core::Entity::Bright)) {
math::Vector3f v = globe->location() - Camera::eye();
v.normalize();
@@ -300,7 +295,7 @@ void draw_globe(core::EntityGlobe *globe)
}
}
- if (flag_is_set(globe->flags(), core::Entity::Bright)) {
+ if (globe->flag_is_set(core::Entity::Bright)) {
gl::enable(GL_LIGHTING);
} else {
gl::enable(GL_LIGHT0);
@@ -486,7 +481,7 @@ void draw_pass_default()
gl::translate(entity->location());
gl::multmatrix(entity->axis());
- if (flag_is_set(entity->flags(), core::Entity::Bright)) {
+ if (entity->flag_is_set(core::Entity::Bright)) {
gl::disable(GL_LIGHTING);
}
@@ -510,7 +505,7 @@ void draw_pass_default()
break;
}
- if (flag_is_set(entity->flags(), core::Entity::Bright)) {
+ if (entity->flag_is_set(core::Entity::Bright)) {
gl::enable(GL_LIGHTING);
}