summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-21 12:00:31 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-21 12:00:31 (GMT)
commitb6736f967e9889c7fc8a68b11abd5be1ad4cc5d7 (patch)
tree693cf90faed1cef2ec0e7ff6859e062134316859 /src
parente25d934856fdd7c2288e3a515cac907a0451e9c4 (diff)
downloadpowder-b6736f967e9889c7fc8a68b11abd5be1ad4cc5d7.zip
powder-b6736f967e9889c7fc8a68b11abd5be1ad4cc5d7.tar.gz
Add EMP flash, fixes #137
Diffstat (limited to 'src')
-rw-r--r--src/graphics/Renderer.cpp10
-rw-r--r--src/graphics/Renderer.h1
-rw-r--r--src/simulation/Simulation.cpp5
-rw-r--r--src/simulation/Simulation.h1
-rw-r--r--src/simulation/elements/EMP.cpp6
5 files changed, 15 insertions, 8 deletions
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index 2924503..f07d548 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -41,6 +41,7 @@ void Renderer::RenderBegin()
render_parts();
render_fire();
DrawWalls();
+ draw_other();
draw_grav_zones();
DrawSigns();
@@ -84,6 +85,7 @@ void Renderer::RenderBegin()
}
DrawWalls();
+ draw_other();
draw_grav_zones();
DrawSigns();
if(display_mode & DISPLAY_WARP)
@@ -127,6 +129,7 @@ void Renderer::RenderBegin()
}
DrawWalls();
+ draw_other();
draw_grav_zones();
DrawSigns();
@@ -2025,10 +2028,10 @@ void Renderer::render_parts()
void Renderer::draw_other() // EMP effect
{
int i, j;
- //if (emp_decor>0 && !sys_pause) emp_decor-=emp_decor/25+2; TODO: Render should render only, do not change simulation state
- if (emp_decor>40) emp_decor=40;
+ int emp_decor = sim->emp_decor;
+ if (emp_decor>40) emp_decor = 40;
if (emp_decor<0) emp_decor = 0;
- if (!(display_mode & DISPLAY_EFFE)) // no in nothing mode
+ if (!(render_mode & EFFECT)) // not in nothing mode
return;
if (emp_decor>0)
{
@@ -2485,7 +2488,6 @@ void Renderer::CompileRenderMode()
void Renderer::ClearAccumulation()
{
- emp_decor = 0;
std::fill(fire_r[0]+0, fire_r[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
std::fill(fire_g[0]+0, fire_g[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
std::fill(fire_b[0]+0, fire_b[(YRES/CELL)-1]+((XRES/CELL)-1), 0);
diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h
index dc5d633..7c84280 100644
--- a/src/graphics/Renderer.h
+++ b/src/graphics/Renderer.h
@@ -39,7 +39,6 @@ public:
unsigned int fire_alpha[CELL*3][CELL*3];
char * flm_data;
char * plasma_data;
- int emp_decor;
//
bool gravityZonesEnabled;
bool gravityFieldEnabled;
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 23c1a21..c5a07e5 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -1860,6 +1860,7 @@ void Simulation::create_arc(int sx, int sy, int dx, int dy, int midpoints, int v
void Simulation::clear_sim(void)
{
int i, x, y;
+ emp_decor = 0;
signs.clear();
currentTick = 0;
memset(bmap, 0, sizeof(bmap));
@@ -4394,6 +4395,10 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
gravWallChanged = false;
}
}
+ if(emp_decor>0)
+ emp_decor -= emp_decor/25+2;
+ if(emp_decor < 0)
+ emp_decor = 0;
}
memset(pmap, 0, sizeof(pmap));
diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h
index 0dafe33..7737c2b 100644
--- a/src/simulation/Simulation.h
+++ b/src/simulation/Simulation.h
@@ -76,6 +76,7 @@ public:
int elementCount[PT_NUM];
int ISWIRE;
int force_stacking_check;
+ int emp_decor;
//Gol sim
int CGOL;
int ISGOL;
diff --git a/src/simulation/elements/EMP.cpp b/src/simulation/elements/EMP.cpp
index 175e7e7..e21f69c 100644
--- a/src/simulation/elements/EMP.cpp
+++ b/src/simulation/elements/EMP.cpp
@@ -68,9 +68,9 @@ int Element_EMP::update(UPDATE_FUNC_ARGS)
if (!ok)
return 0;
parts[i].life=220;
- //emp_decor+=3; TODO: Fix
- //if (emp_decor>40)
- // emp_decor=40;
+ sim->emp_decor += 3;
+ if (sim->emp_decor > 40)
+ sim->emp_decor = 40;
for (r=0; r<=sim->parts_lastActiveIndex; r++)
{
t=parts[r].type;