some minor changes to tools

This commit is contained in:
jacob1 2013-06-06 23:23:48 -04:00
parent 76b92952b1
commit e146ae50ab
8 changed files with 25 additions and 21 deletions

View File

@ -312,7 +312,7 @@ void GameModel::BuildMenus()
menuList[SC_TOOL]->AddTool(tempTool); menuList[SC_TOOL]->AddTool(tempTool);
} }
//Add special sign and prop tools //Add special sign and prop tools
menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement", 64, 64, 64, "DEFAULT_UI_WIND")); menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement.", 64, 64, 64, "DEFAULT_UI_WIND"));
menuList[SC_TOOL]->AddTool(new PropertyTool()); menuList[SC_TOOL]->AddTool(new PropertyTool());
menuList[SC_TOOL]->AddTool(new SignTool()); menuList[SC_TOOL]->AddTool(new SignTool());
menuList[SC_TOOL]->AddTool(new SampleTool(this)); menuList[SC_TOOL]->AddTool(new SampleTool(this));

View File

@ -45,7 +45,7 @@ class SignTool: public Tool
{ {
public: public:
SignTool(): SignTool():
Tool(0, "SIGN", "Sign. Click a sign to edit or anywhere else to create a new one", 0, 0, 0, "DEFAULT_UI_SIGN", SignTool::GetIcon) Tool(0, "SIGN", "Sign. Click a sign to edit or anywhere else to create a new one.", 0, 0, 0, "DEFAULT_UI_SIGN", SignTool::GetIcon)
{ {
} }
static VideoBuffer * GetIcon(int toolID, int width, int height); static VideoBuffer * GetIcon(int toolID, int width, int height);
@ -64,7 +64,7 @@ class SampleTool: public Tool
GameModel * gameModel; GameModel * gameModel;
public: public:
SampleTool(GameModel * model): SampleTool(GameModel * model):
Tool(0, "SMPL", "Sample an element on the screen", 0, 0, 0, "DEFAULT_UI_SAMPLE", SampleTool::GetIcon), Tool(0, "SMPL", "Sample an element on the screen.", 0, 0, 0, "DEFAULT_UI_SAMPLE", SampleTool::GetIcon),
gameModel(model) gameModel(model)
{ {
} }
@ -81,7 +81,7 @@ class PropertyTool: public Tool
{ {
public: public:
PropertyTool(): PropertyTool():
Tool(0, "PROP", "Property Edit. Click to alter the properties of elements in the field", 0xfe, 0xa9, 0x00, "DEFAULT_UI_PROPERTY", NULL) Tool(0, "PROP", "Property Edit. Click to alter the properties of elements in the field.", 0xfe, 0xa9, 0x00, "DEFAULT_UI_PROPERTY", NULL)
{ {
} }
virtual ~PropertyTool() {} virtual ~PropertyTool() {}

View File

@ -1,20 +1,21 @@
#include "ToolClasses.h" #include "ToolClasses.h"
#include "simulation/Air.h" #include "simulation/Air.h"
//#TPT-Directive ToolClass Tool_Air TOOL_AIR 3 //#TPT-Directive ToolClass Tool_Air TOOL_AIR 2
Tool_Air::Tool_Air() Tool_Air::Tool_Air()
{ {
Identifier = "DEFAULT_TOOL_AIR"; Identifier = "DEFAULT_TOOL_AIR";
Name = "AIR"; Name = "AIR";
Colour = PIXPACK(0xFFFFFF); Colour = PIXPACK(0xFFFFFF);
Description = "Creates air pressure"; Description = "Air, creates airflow and pressure.";
} }
int Tool_Air::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_Air::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{ {
sim->air->pv[y/CELL][x/CELL] += strength*0.05f; sim->air->pv[y/CELL][x/CELL] += strength*0.05f;
if(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; sim->air->pv[y/CELL][x/CELL] = 256.0f;
if(sim->air->pv[y/CELL][x/CELL] < -256.0f) else if (sim->air->pv[y/CELL][x/CELL] < -256.0f)
sim->air->pv[y/CELL][x/CELL] = -256.0f; sim->air->pv[y/CELL][x/CELL] = -256.0f;
return 1; return 1;
} }

View File

@ -5,7 +5,7 @@ Tool_Cool::Tool_Cool()
Identifier = "DEFAULT_TOOL_COOL"; Identifier = "DEFAULT_TOOL_COOL";
Name = "COOL"; Name = "COOL";
Colour = PIXPACK(0x00DDFF); Colour = PIXPACK(0x00DDFF);
Description = "Cools particles"; Description = "Cools the targeted element.";
} }
int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
@ -16,9 +16,10 @@ int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float s
cpart->temp -= strength*.1f; cpart->temp -= strength*.1f;
else else
cpart->temp -= strength*2.0f; cpart->temp -= strength*2.0f;
if(cpart->temp > MAX_TEMP)
if (cpart->temp > MAX_TEMP)
cpart->temp = MAX_TEMP; cpart->temp = MAX_TEMP;
if(cpart->temp < 0) else if (cpart->temp < 0)
cpart->temp = 0; cpart->temp = 0;
return 1; return 1;
} }

View File

@ -5,7 +5,7 @@ Tool_Heat::Tool_Heat()
Identifier = "DEFAULT_TOOL_HEAT"; Identifier = "DEFAULT_TOOL_HEAT";
Name = "HEAT"; Name = "HEAT";
Colour = PIXPACK(0xFFDD00); Colour = PIXPACK(0xFFDD00);
Description = "Heats particles"; Description = "Heats the targeted element.";
} }
int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
@ -16,9 +16,10 @@ int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float s
cpart->temp += strength*.1f; cpart->temp += strength*.1f;
else else
cpart->temp += strength*2.0f; cpart->temp += strength*2.0f;
if(cpart->temp > MAX_TEMP)
if (cpart->temp > MAX_TEMP)
cpart->temp = MAX_TEMP; cpart->temp = MAX_TEMP;
if(cpart->temp < 0) else if (cpart->temp < 0)
cpart->temp = 0; cpart->temp = 0;
return 1; return 1;
} }

View File

@ -6,7 +6,7 @@ Tool_NGrv::Tool_NGrv()
Identifier = "DEFAULT_TOOL_NGRV"; Identifier = "DEFAULT_TOOL_NGRV";
Name = "NGRV"; Name = "NGRV";
Colour = PIXPACK(0xAACCFF); Colour = PIXPACK(0xAACCFF);
Description = "Creates a short-lasting negative gravity well"; Description = "Creates a short-lasting negative gravity well.";
} }
int Tool_NGrv::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_NGrv::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)

View File

@ -6,7 +6,7 @@ Tool_PGrv::Tool_PGrv()
Identifier = "DEFAULT_TOOL_PGRV"; Identifier = "DEFAULT_TOOL_PGRV";
Name = "PGRV"; Name = "PGRV";
Colour = PIXPACK(0xCCCCFF); Colour = PIXPACK(0xCCCCFF);
Description = "Creates a short-lasting gravity well"; Description = "Creates a short-lasting gravity well.";
} }
int Tool_PGrv::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_PGrv::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)

View File

@ -1,20 +1,21 @@
#include "ToolClasses.h" #include "ToolClasses.h"
#include "simulation/Air.h" #include "simulation/Air.h"
//#TPT-Directive ToolClass Tool_Vac TOOL_VAC 2 //#TPT-Directive ToolClass Tool_Vac TOOL_VAC 3
Tool_Vac::Tool_Vac() Tool_Vac::Tool_Vac()
{ {
Identifier = "DEFAULT_TOOL_VAC"; Identifier = "DEFAULT_TOOL_VAC";
Name = "VAC"; Name = "VAC";
Colour = PIXPACK(0x303030); Colour = PIXPACK(0x303030);
Description = "Reduces air pressure"; Description = "Vacuum, reduces air pressure.";
} }
int Tool_Vac::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) int Tool_Vac::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{ {
sim->air->pv[y/CELL][x/CELL] -= strength*0.05f;; sim->air->pv[y/CELL][x/CELL] -= strength*0.05f;
if(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; sim->air->pv[y/CELL][x/CELL] = 256.0f;
if(sim->air->pv[y/CELL][x/CELL] < -256.0f) else if (sim->air->pv[y/CELL][x/CELL] < -256.0f)
sim->air->pv[y/CELL][x/CELL] = -256.0f; sim->air->pv[y/CELL][x/CELL] = -256.0f;
return 1; return 1;
} }