Allow 24bits of var for create_part, add tool for tesc. Fixes #72
This commit is contained in:
parent
9e309135d4
commit
30f8049efc
@ -171,6 +171,10 @@ void GameModel::BuildMenus()
|
|||||||
{
|
{
|
||||||
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
||||||
}
|
}
|
||||||
|
else if(i == PT_TESC)
|
||||||
|
{
|
||||||
|
tempTool = new Element_TESC_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
||||||
|
}
|
||||||
else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
|
else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
|
||||||
{
|
{
|
||||||
tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour), sim->elements[i].IconGenerator);
|
||||||
|
@ -176,6 +176,27 @@ void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Element_TESC_Tool::Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)):
|
||||||
|
ElementTool(id, name, description, r, g, b, textureGen)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void Element_TESC_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position){
|
||||||
|
int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7;
|
||||||
|
sim->CreateParts(position.X, position.Y, toolID | (radiusInfo << 8), brush);
|
||||||
|
}
|
||||||
|
void Element_TESC_Tool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) {
|
||||||
|
int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7;
|
||||||
|
sim->CreateLine(position1.X, position1.Y, position2.X, position2.Y, toolID | (radiusInfo << 8), brush);
|
||||||
|
}
|
||||||
|
void Element_TESC_Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {
|
||||||
|
int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7;
|
||||||
|
sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID | (radiusInfo << 8), 0);
|
||||||
|
}
|
||||||
|
void Element_TESC_Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
|
||||||
|
int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7;
|
||||||
|
sim->FloodParts(position.X, position.Y, toolID | (radiusInfo << 8), -1, -1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void PlopTool::Click(Simulation * sim, Brush * brush, ui::Point position)
|
void PlopTool::Click(Simulation * sim, Brush * brush, ui::Point position)
|
||||||
{
|
{
|
||||||
sim->create_part(-1, position.X, position.Y, toolID);
|
sim->create_part(-1, position.X, position.Y, toolID);
|
||||||
|
@ -86,6 +86,7 @@ public:
|
|||||||
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ElementTool: public Tool
|
class ElementTool: public Tool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -97,6 +98,17 @@ public:
|
|||||||
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Element_TESC_Tool: public ElementTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Element_TESC_Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL);
|
||||||
|
virtual ~Element_TESC_Tool() {}
|
||||||
|
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position);
|
||||||
|
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false);
|
||||||
|
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2);
|
||||||
|
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
|
||||||
|
};
|
||||||
|
|
||||||
class PlopTool: public ElementTool
|
class PlopTool: public ElementTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -2443,12 +2443,14 @@ void Simulation::part_change_type(int i, int x, int y, int t)//changes the type
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Simulation::create_part(int p, int x, int y, int tv)//the function for creating a particle, use p=-1 for creating a new particle, -2 is from a brush, or a particle number to replace a particle.
|
//the function for creating a particle, use p=-1 for creating a new particle, -2 is from a brush, or a particle number to replace a particle.
|
||||||
|
//tv = Type (8 bits) + Var (24 bits), var is usually 0
|
||||||
|
int Simulation::create_part(int p, int x, int y, int tv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int t = tv & 0xFF;
|
int t = tv & 0xFF;
|
||||||
int v = (tv >> 8) & 0xFF;
|
int v = (tv >> 8) & 0xFFFFFF;
|
||||||
|
|
||||||
if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<=0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM&&t!=SPC_PGRV&&t!=SPC_NGRV))
|
if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<=0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM&&t!=SPC_PGRV&&t!=SPC_NGRV))
|
||||||
return -1;
|
return -1;
|
||||||
@ -2749,6 +2751,11 @@ int Simulation::create_part(int p, int x, int y, int tv)//the function for creat
|
|||||||
case PT_EMBR:
|
case PT_EMBR:
|
||||||
parts[i].life = 50;
|
parts[i].life = 50;
|
||||||
break;
|
break;
|
||||||
|
case PT_TESC:
|
||||||
|
parts[i].tmp = v;
|
||||||
|
if (parts[i].tmp > 300)
|
||||||
|
parts[i].tmp=300;
|
||||||
|
break;
|
||||||
case PT_STKM:
|
case PT_STKM:
|
||||||
if (player.spwn==0)
|
if (player.spwn==0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user