Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/dust.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/render/dust.cc b/src/render/dust.cc
index b0926dc..64969e3 100644
--- a/src/render/dust.cc
+++ b/src/render/dust.cc
@@ -23,8 +23,8 @@ const float TRAILLENGHT = 0.25f;
const float DUSTMAXALPHA = 0.8f;
const float DUSTDISTANCE = 8.0f;
-float *dust;
-size_t dustsize;
+float *dust = 0;
+size_t dustsize = 0;
void Dust::init()
{
@@ -41,7 +41,7 @@ void Dust::init()
void Dust::shutdown()
{
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
dustsize = 0;
}
@@ -49,8 +49,10 @@ void Dust::shutdown()
void Dust::reset()
{
- delete dust;
- dust = 0;
+ if (dust) {
+ free(dust);
+ dust = 0;
+ }
}
void Dust::draw()
@@ -60,7 +62,7 @@ void Dust::draw()
if (!r_dust->value()) {
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
return;
@@ -69,7 +71,7 @@ void Dust::draw()
if ((size_t) r_dustsize->value() != dustsize) {
con_debug << " changing dust size..." << std::endl;
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
}
@@ -78,7 +80,7 @@ void Dust::draw()
if (!dustsize) {
if (dust) {
- delete dust;
+ free(dust);
dust = 0;
}
return;
@@ -93,7 +95,7 @@ void Dust::draw()
if (!dust) {
con_debug << " generating dust..." << std::endl;
- dust = new float[dustsize*3];
+ dust = (float *) malloc(sizeof(float) * dustsize* 3);
for (size_t i = 0; i < dustsize; i++) {
dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius());