Add EMP flash, fixes #137

This commit is contained in:
Simon Robertshaw 2012-08-21 13:00:31 +01:00
parent e25d934856
commit b6736f967e
5 changed files with 15 additions and 8 deletions

View File

@ -41,6 +41,7 @@ void Renderer::RenderBegin()
render_parts(); render_parts();
render_fire(); render_fire();
DrawWalls(); DrawWalls();
draw_other();
draw_grav_zones(); draw_grav_zones();
DrawSigns(); DrawSigns();
@ -84,6 +85,7 @@ void Renderer::RenderBegin()
} }
DrawWalls(); DrawWalls();
draw_other();
draw_grav_zones(); draw_grav_zones();
DrawSigns(); DrawSigns();
if(display_mode & DISPLAY_WARP) if(display_mode & DISPLAY_WARP)
@ -127,6 +129,7 @@ void Renderer::RenderBegin()
} }
DrawWalls(); DrawWalls();
draw_other();
draw_grav_zones(); draw_grav_zones();
DrawSigns(); DrawSigns();
@ -2025,10 +2028,10 @@ void Renderer::render_parts()
void Renderer::draw_other() // EMP effect void Renderer::draw_other() // EMP effect
{ {
int i, j; 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 int emp_decor = sim->emp_decor;
if (emp_decor>40) emp_decor = 40; if (emp_decor>40) emp_decor = 40;
if (emp_decor<0) emp_decor = 0; 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; return;
if (emp_decor>0) if (emp_decor>0)
{ {
@ -2485,7 +2488,6 @@ void Renderer::CompileRenderMode()
void Renderer::ClearAccumulation() void Renderer::ClearAccumulation()
{ {
emp_decor = 0;
std::fill(fire_r[0]+0, fire_r[(YRES/CELL)-1]+((XRES/CELL)-1), 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_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); std::fill(fire_b[0]+0, fire_b[(YRES/CELL)-1]+((XRES/CELL)-1), 0);

View File

@ -39,7 +39,6 @@ public:
unsigned int fire_alpha[CELL*3][CELL*3]; unsigned int fire_alpha[CELL*3][CELL*3];
char * flm_data; char * flm_data;
char * plasma_data; char * plasma_data;
int emp_decor;
// //
bool gravityZonesEnabled; bool gravityZonesEnabled;
bool gravityFieldEnabled; bool gravityFieldEnabled;

View File

@ -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) void Simulation::clear_sim(void)
{ {
int i, x, y; int i, x, y;
emp_decor = 0;
signs.clear(); signs.clear();
currentTick = 0; currentTick = 0;
memset(bmap, 0, sizeof(bmap)); memset(bmap, 0, sizeof(bmap));
@ -4394,6 +4395,10 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
gravWallChanged = false; gravWallChanged = false;
} }
} }
if(emp_decor>0)
emp_decor -= emp_decor/25+2;
if(emp_decor < 0)
emp_decor = 0;
} }
memset(pmap, 0, sizeof(pmap)); memset(pmap, 0, sizeof(pmap));

View File

@ -76,6 +76,7 @@ public:
int elementCount[PT_NUM]; int elementCount[PT_NUM];
int ISWIRE; int ISWIRE;
int force_stacking_check; int force_stacking_check;
int emp_decor;
//Gol sim //Gol sim
int CGOL; int CGOL;
int ISGOL; int ISGOL;

View File

@ -68,9 +68,9 @@ int Element_EMP::update(UPDATE_FUNC_ARGS)
if (!ok) if (!ok)
return 0; return 0;
parts[i].life=220; parts[i].life=220;
//emp_decor+=3; TODO: Fix sim->emp_decor += 3;
//if (emp_decor>40) if (sim->emp_decor > 40)
// emp_decor=40; sim->emp_decor = 40;
for (r=0; r<=sim->parts_lastActiveIndex; r++) for (r=0; r<=sim->parts_lastActiveIndex; r++)
{ {
t=parts[r].type; t=parts[r].type;