Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cc3
-rw-r--r--src/render/dust.cc32
2 files changed, 16 insertions, 19 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index ede6b29..f5da1f0 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -92,8 +92,6 @@ void Client::init(int count, char **arguments)
cl_framerate = core::Cvar::get("cl_framerate", "125", core::Cvar::Archive);
cl_framerate->set_info("[int] client framerate in frames/sec");
- cl_frametime = core::Cvar::set("cl_frametime", "8", core::Cvar::ReadOnly);
- cl_frametime->set_info("[int] current minimal length of one frame, in milliseconds (read-only)");
// initialize SDL, but do not initialize any subsystems
SDL_Init(0);
@@ -146,7 +144,6 @@ void Client::run()
} else {
client_frame_lenght = 0;
}
- (*cl_frametime) = (float) client_frame_lenght;
// only advance per microsecond frame
Uint32 d = client_current_timestamp - client_previous_timestamp;
diff --git a/src/render/dust.cc b/src/render/dust.cc
index 64969e3..b1d4077 100644
--- a/src/render/dust.cc
+++ b/src/render/dust.cc
@@ -65,6 +65,7 @@ void Dust::draw()
free(dust);
dust = 0;
}
+ dustsize = 0;
return;
}
@@ -75,14 +76,13 @@ void Dust::draw()
dust = 0;
}
}
-
- dustsize = (size_t) r_dustsize->value();
-
- if (!dustsize) {
+
+ if (dustsize <= 0) {
if (dust) {
free(dust);
dust = 0;
}
+ dustsize = 0;
return;
}
@@ -95,6 +95,7 @@ void Dust::draw()
if (!dust) {
con_debug << " generating dust..." << std::endl;
+
dust = (float *) malloc(sizeof(float) * dustsize* 3);
for (size_t i = 0; i < dustsize; i++) {
@@ -120,21 +121,20 @@ void Dust::draw()
math::Vector3f v;
for (size_t i = 0; i < dustsize; i++) {
- v.assign(core::localcontrol()->location());
- for (size_t j = 0; j < 3; j++)
- v[j] -= dust[i*3+j];
-
- if (v.lengthsquared() > (core::localcontrol()->radius() + DUSTDISTANCE)*(core::localcontrol()->radius() + DUSTDISTANCE)) {
-
- dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());
- dust[i*3+1] = core::localcontrol()->location().y + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());
- dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());
+ float dsquare = 0;
+ for (size_t j = 0; j < 3; j++) {
+ dsquare += (core::localcontrol()->location()[j] - dust[i*3+j]) * (core::localcontrol()->location()[j] - dust[i*3+j]);
+ v[j] = dust[i*3+j] - Camera::eye()[j];
}
- for (size_t j = 0; j < 3; j++)
- v[j] = dust[i*3+j];
- v -= Camera::eye();
+ if (dsquare > (core::localcontrol()->radius() + DUSTDISTANCE)*(core::localcontrol()->radius() + DUSTDISTANCE)) {
+ for (size_t j = 0; j < 3; j++) {
+ dust[i*3+j] = core::localcontrol()->location()[j] + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());
+ v[j] = dust[i*3+j] - Camera::eye()[j];
+ }
+ }
gl::vertex(v);
+
v -= core::localcontrol()->state()->axis().forward() * traillength;
gl::vertex(v);
}