Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/info.cc8
-rw-r--r--src/core/info.h8
-rw-r--r--src/render/render.cc24
-rw-r--r--src/render/render.h5
4 files changed, 19 insertions, 26 deletions
diff --git a/src/core/info.cc b/src/core/info.cc
index 2ff6669..60a88f9 100644
--- a/src/core/info.cc
+++ b/src/core/info.cc
@@ -81,7 +81,6 @@ Info::Info(const InfoType *type, const char *label) : Label(label)
info_type = type;
info_registry.push_back(this);
- info_model = 0;
info_timestamp = 0;
info_price = 0;
info_volume = 0;
@@ -94,7 +93,6 @@ Info::Info(const unsigned int id)
info_type = 0;
info_registry.push_back(this);
- info_model = 0;
info_price = 0;
info_timestamp = 1;
@@ -108,7 +106,6 @@ Info::~Info()
info_modelname.clear();
info_text.clear();
info_timestamp = 0;
- info_model = 0;
info_type = 0;
}
@@ -132,11 +129,6 @@ void Info::set_modelname(const char *modelname)
info_modelname.assign(modelname);
}
-void Info::set_model(const model::Model *model)
-{
- info_model = model;
-}
-
void Info::set_price(const long price)
{
info_price = price;
diff --git a/src/core/info.h b/src/core/info.h
index d32ccab..dfec17c 100644
--- a/src/core/info.h
+++ b/src/core/info.h
@@ -94,10 +94,6 @@ public:
inline const std::string & modelname() const {
return info_modelname;
}
-
- inline const model::Model *model() const {
- return info_model;
- }
inline const long price() const {
return info_price;
@@ -133,8 +129,6 @@ public:
void set_modelname(const char *modelname);
- void set_model(const model::Model *model);
-
/**
* @brief associated price, in credits
*/
@@ -184,8 +178,6 @@ private:
unsigned long info_timestamp;
std::string info_modelname;
- const model::Model* info_model;
-
Text info_text;
/* ---- static info registry --------------------------------------- */
diff --git a/src/render/render.cc b/src/render/render.cc
index 1b0d90e..2a325e9 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -60,6 +60,11 @@ void func_list_particles(std::string const &args)
ParticleScript::list();
}
+void func_load_info_models(std::string const &args)
+{
+ load_info_models();
+}
+
void init(int width, int height)
{
con_print << "^BInitializing renderer..." << std::endl;
@@ -148,6 +153,9 @@ void init(int width, int height)
func = core::Func::add("list_particles", func_list_particles);
func->set_info("list registered particle scripts");
+
+ func = core::Func::add("r_loadmodels", func_load_info_models);
+ func->set_info("load all models referenced by info record");
load();
}
@@ -198,12 +206,6 @@ void clear()
}
}
- // clear info models
- for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
- core::Info *info = (*it);
- info->set_model(0);
- }
-
// clear model registry
model::Model::clear();
@@ -225,16 +227,19 @@ void load()
entity->set_model(model::Model::load(entity->modelname()));
}
}
+}
+// load all models referenced by info records
+void load_info_models()
+{
// load info models
for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
core::Info *info = (*it);
if (info->modelname().size()) {
- info->set_model(model::Model::load(info->modelname()));
- } else {
- info->set_model(0);
+ model::Model::load(info->modelname());
}
}
+
}
// reset render subsystem (module disconnect)
@@ -265,6 +270,7 @@ void shutdown()
core::Func::remove("list_materials");
core::Func::remove("list_particles");
core::Func::remove("list_textures");
+ core::Func::remove("r_loadmodels");
clear();
diff --git a/src/render/render.h b/src/render/render.h
index 97880cc..53a40dc 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -34,6 +34,9 @@ void reset();
/// load game render data
void load();
+/// load all models referenced by info records
+void load_info_models();
+
/// unload game render data
void unload();
@@ -75,7 +78,7 @@ inline RenderExt *ext_render(const core::Entity *entity)
{
return static_cast<RenderExt *>(entity->extension((size_t)core::Extension::Render));
}
-}
+} // namespace render
#endif // __INCLUDED_RENDER_H__