The-Powder-Toy/src/simulation/tools/Vac.cpp

23 lines
592 B
C++
Raw Normal View History

#include "ToolClasses.h"
#include "simulation/Air.h"
//#TPT-Directive ToolClass Tool_Vac TOOL_VAC 2
Tool_Vac::Tool_Vac()
{
Identifier = "DEFAULT_TOOL_VAC";
Name = "VAC";
Colour = PIXPACK(0x303030);
Description = "Reduces air pressure";
}
int Tool_Vac::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{
sim->air->pv[y/CELL][x/CELL] -= strength*0.05f;;
2012-08-14 10:29:07 -05:00
if(sim->air->pv[y/CELL][x/CELL] > 256.0f)
sim->air->pv[y/CELL][x/CELL] = 256.0f;
if(sim->air->pv[y/CELL][x/CELL] < -256.0f)
sim->air->pv[y/CELL][x/CELL] = -256.0f;
return 1;
}
Tool_Vac::~Tool_Vac() {}