Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/input.cc4
-rw-r--r--src/core/info.cc16
-rw-r--r--src/core/info.h5
-rw-r--r--src/model/mapfile.cc7
-rw-r--r--src/render/render.cc26
-rw-r--r--src/render/render.h3
-rwxr-xr-xsrc/ui/modelview.cc13
-rw-r--r--src/ui/ui.cc2
8 files changed, 52 insertions, 24 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index ee4a789..8b49604 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -116,8 +116,8 @@ void func_ui_control(std::string const &args)
if (!core::localcontrol() || core::localplayer()->view())
return;
- if (input_mousecontrol->value() > 0) {
- (*input_mousecontrol) = 0.0f;
+ if (input_mousecontrol->value() > 0.0f) {
+ (*input_mousecontrol) = 0.0f;
} else {
(*input_mousecontrol) = 1.0f;
}
diff --git a/src/core/info.cc b/src/core/info.cc
index 4e0cb53..93837c0 100644
--- a/src/core/info.cc
+++ b/src/core/info.cc
@@ -12,7 +12,7 @@
namespace core
{
-Info::Registry Info::registry;
+Info::Registry Info::info_registry;
Info::Info(const std::string & label)
{
@@ -137,12 +137,12 @@ void Info::add(Info *info)
if (find(info->label()))
return;
- registry[info->label()] = info;
+ info_registry[info->label()] = info;
}
Info *Info::find(const char *label)
{
- for (Registry::iterator it = registry.begin(); it != registry.end(); it++) {
+ for (Registry::iterator it = info_registry.begin(); it != info_registry.end(); it++) {
Info *info = (*it).second;
if (info->label().compare(label) == 0) {
return info;
@@ -153,7 +153,7 @@ Info *Info::find(const char *label)
Info *Info::find(const std::string & label)
{
- for (Registry::iterator it = registry.begin(); it != registry.end(); it++) {
+ for (Registry::iterator it = info_registry.begin(); it != info_registry.end(); it++) {
Info *info = (*it).second;
if (info->label().compare(label) == 0) {
return info;
@@ -164,20 +164,20 @@ Info *Info::find(const std::string & label)
void Info::clear()
{
- for (Registry::iterator it = registry.begin(); it != registry.end(); it++) {
+ for (Registry::iterator it = info_registry.begin(); it != info_registry.end(); it++) {
Info *info = (*it).second;;
delete info;
}
- registry.clear();
+ info_registry.clear();
}
void Info::list()
{
- for (Registry::iterator it = registry.begin(); it != registry.end(); it++) {
+ for (Registry::iterator it = info_registry.begin(); it != info_registry.end(); it++) {
Info *info = (*it).second;;
con_print << info->label() << std::endl;
}
- con_print << registry.size() << " registered info " << aux::plural("record", registry.size()) << std::endl;
+ con_print << info_registry.size() << " registered info " << aux::plural("record", info_registry.size()) << std::endl;
}
}
diff --git a/src/core/info.h b/src/core/info.h
index 678c48d..1bc62a9 100644
--- a/src/core/info.h
+++ b/src/core/info.h
@@ -92,6 +92,9 @@ public:
/// list the info registry
static void list();
+ /// the info registry
+ static inline Registry & registry() { return info_registry; }
+
private:
std::string info_label;
std::string info_name;
@@ -99,7 +102,7 @@ private:
Text info_text;
long info_credits;
- static Registry registry;
+ static Registry info_registry;
unsigned long info_timestamp;
};
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index 575232e..d3d19f6 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1454,19 +1454,20 @@ Model * MapFile::load(std::string const &name)
}
- con_debug << " imported submodel '" << submodel->name() << "'" << std::endl;
+ //con_debug << " imported submodel '" << submodel->name() << "'" << std::endl;
}
delete submodel;
}
+ if (mapfile.warning_q2brush)
+ con_warn << mapfile.name() << " quake2 style brushes detected" << std::endl;
+
con_debug << " " << mapfile.name() << " " << mapfile.map_brushes << " brushes " <<
model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris " <<
model->model_quad_detail_count << "/" << model->model_quad_count << " detail/quads" << std::endl;
- if (mapfile.warning_q2brush)
- con_warn << " quake2 style brushes detected" << std::endl;
return model;
}
diff --git a/src/render/render.cc b/src/render/render.cc
index 4ad2d84..12445a6 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -130,10 +130,11 @@ void init(int width, int height)
func = core::Func::add("list_particles", func_list_particles);
func->set_info("list registered particle scripts");
+
+ load();
}
// unload game assets (zone change)
-/* TODO RenderExt class containing render state */
void unload()
{
// clear zone sky textures
@@ -165,8 +166,6 @@ void unload()
// clear all assets
void clear()
{
- //con_debug << " clearing render data...\n";
-
// clear zone sky textures
for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) {
core::Zone *zone = (*it).second;
@@ -200,6 +199,27 @@ void clear()
ParticleScript::clear();
}
+// load assets
+void load()
+{
+ // load entity models
+ for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) {
+ core::Entity *entity = (*it).second;
+
+ if (entity->modelname().size()) {
+ entity->set_model(model::Model::load(entity->modelname()));
+ }
+ }
+
+ // load info models
+ for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
+ core::Info *info = (*it).second;
+ if (info->modelname().size()) {
+ model::Model::load(info->modelname());
+ }
+ }
+}
+
// reset render subsystem (module disconnect)
void reset()
{
diff --git a/src/render/render.h b/src/render/render.h
index 765e0f9..17ba42c 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -30,6 +30,9 @@ namespace render {
/// reset all render data
void reset();
+ /// load game render data
+ void load();
+
/// unload game render data
void unload();
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index 1e89397..b913060 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -78,18 +78,19 @@ bool ModelView::on_keypress(const int key, const unsigned int modifier)
void ModelView::draw()
{
- if (!modelview_modelname.size())
+ if (!modelview_modelname.size()) {
return;
+ }
+ paint::color(1.0f, 1.0f, 1.0f);
model::Model *model = model::Model::find(modelview_modelname);
- if (!model)
+ if (!model) {
+ paint::bitmap(global_location(), size(), "bitmap/notex");
return;
+ }
- math ::Vector2f center(global_location());
+ math ::Vector2f center(global_location() + size() * 0.5f);
- center[0] += width() * 0.5f;
- center[1] += height() * 0.5f;
-
gl::clear(GL_DEPTH_BUFFER_BIT);
// gl 3d mode
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index 82d3990..f734a50 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -358,7 +358,7 @@ void UI::load_settings()
void UI::apply_render_options()
{
- con_debug << " initializing text colors" << std::endl;
+ //con_debug << " initializing text colors" << std::endl;
// apply palette colors
paint::assign_color('N', palette()->text());
paint::assign_color('D', palette()->debug());