mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 04:22:34 +02:00
Fix some uninitialized variables, add back sandcolor changing
This commit is contained in:
@@ -3020,9 +3020,9 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
|||||||
{
|
{
|
||||||
int colr, colg, colb, randa;
|
int colr, colg, colb, randa;
|
||||||
randa = (rand()%30)-15;
|
randa = (rand()%30)-15;
|
||||||
colr = (PIXR(elements[t].Colour)+sandcolour_r+(rand()%20)-10+randa);
|
colr = (PIXR(elements[t].Colour)+sandcolour+(rand()%20)-10+randa);
|
||||||
colg = (PIXG(elements[t].Colour)+sandcolour_g+(rand()%20)-10+randa);
|
colg = (PIXG(elements[t].Colour)+sandcolour+(rand()%20)-10+randa);
|
||||||
colb = (PIXB(elements[t].Colour)+sandcolour_b+(rand()%20)-10+randa);
|
colb = (PIXB(elements[t].Colour)+sandcolour+(rand()%20)-10+randa);
|
||||||
colr = colr>255 ? 255 : (colr<0 ? 0 : colr);
|
colr = colr>255 ? 255 : (colr<0 ? 0 : colr);
|
||||||
colg = colg>255 ? 255 : (colg<0 ? 0 : colg);
|
colg = colg>255 ? 255 : (colg<0 ? 0 : colg);
|
||||||
colb = colb>255 ? 255 : (colb<0 ? 0 : colb);
|
colb = colb>255 ? 255 : (colb<0 ? 0 : colb);
|
||||||
@@ -4483,6 +4483,8 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
|
|||||||
if(emp_decor < 0)
|
if(emp_decor < 0)
|
||||||
emp_decor = 0;
|
emp_decor = 0;
|
||||||
}
|
}
|
||||||
|
sandcolour = (int)(20.0f*sin((float)sandcolour_frame*(M_PI/180.0f)));
|
||||||
|
sandcolour_frame = (sandcolour_frame++)%360;
|
||||||
|
|
||||||
memset(pmap, 0, sizeof(pmap));
|
memset(pmap, 0, sizeof(pmap));
|
||||||
memset(pmap_count, 0, sizeof(pmap_count));
|
memset(pmap_count, 0, sizeof(pmap_count));
|
||||||
@@ -4586,7 +4588,10 @@ Simulation::~Simulation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Simulation::Simulation():
|
Simulation::Simulation():
|
||||||
sys_pause(0)
|
sys_pause(0),
|
||||||
|
framerender(false),
|
||||||
|
pretty_powder(0),
|
||||||
|
sandcolour_frame(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1};
|
int tportal_rx[] = {-1, 0, 1, 1, 1, 0,-1,-1};
|
||||||
|
@@ -115,10 +115,8 @@ public:
|
|||||||
int sys_pause;
|
int sys_pause;
|
||||||
int framerender;
|
int framerender;
|
||||||
int pretty_powder;
|
int pretty_powder;
|
||||||
//
|
int sandcolour;
|
||||||
int sandcolour_r;
|
int sandcolour_frame;
|
||||||
int sandcolour_g;
|
|
||||||
int sandcolour_b; //TODO: Make a single variable
|
|
||||||
|
|
||||||
int Load(GameSave * save);
|
int Load(GameSave * save);
|
||||||
int Load(int x, int y, GameSave * save);
|
int Load(int x, int y, GameSave * save);
|
||||||
|
@@ -14,31 +14,37 @@ namespace vm
|
|||||||
TRAPDEF(sin)
|
TRAPDEF(sin)
|
||||||
{
|
{
|
||||||
Push<float4_t>(sin(ARG(0).float4));
|
Push<float4_t>(sin(ARG(0).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(cos)
|
TRAPDEF(cos)
|
||||||
{
|
{
|
||||||
Push<float4_t>(cos(ARG(0).float4));
|
Push<float4_t>(cos(ARG(0).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(atan2)
|
TRAPDEF(atan2)
|
||||||
{
|
{
|
||||||
Push<float4_t>(atan2(ARG(0).float4, ARG(1).float4));
|
Push<float4_t>(atan2(ARG(0).float4, ARG(1).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(sqrt)
|
TRAPDEF(sqrt)
|
||||||
{
|
{
|
||||||
Push<float4_t>(sqrt(ARG(0).float4));
|
Push<float4_t>(sqrt(ARG(0).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(floor)
|
TRAPDEF(floor)
|
||||||
{
|
{
|
||||||
Push<float4_t>(floor(ARG(0).float4));
|
Push<float4_t>(floor(ARG(0).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(ceil)
|
TRAPDEF(ceil)
|
||||||
{
|
{
|
||||||
Push<float4_t>(ceil(ARG(0).float4));
|
Push<float4_t>(ceil(ARG(0).float4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -47,6 +53,7 @@ namespace vm
|
|||||||
char *text;
|
char *text;
|
||||||
text = (char*)(ram) + ARG(0).int4;
|
text = (char*)(ram) + ARG(0).int4;
|
||||||
printf("%s", text);
|
printf("%s", text);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,31 +63,37 @@ namespace vm
|
|||||||
msg = (char*)(ram) + ARG(0).int4;
|
msg = (char*)(ram) + ARG(0).int4;
|
||||||
printf("%s", msg);
|
printf("%s", msg);
|
||||||
End();
|
End();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TRAPDEF(partCreate)
|
TRAPDEF(partCreate)
|
||||||
{
|
{
|
||||||
Push<int4_t>(sim->create_part(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4));
|
Push<int4_t>(sim->create_part(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(partChangeType)
|
TRAPDEF(partChangeType)
|
||||||
{
|
{
|
||||||
sim->part_change_type(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4);
|
sim->part_change_type(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(pmapData)
|
TRAPDEF(pmapData)
|
||||||
{
|
{
|
||||||
Push<int4_t>(sim->pmap[ARG(1).int4][ARG(0).int4]);
|
Push<int4_t>(sim->pmap[ARG(1).int4][ARG(0).int4]);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(deletePart)
|
TRAPDEF(deletePart)
|
||||||
{
|
{
|
||||||
sim->delete_part(ARG(0).int4, ARG(1).int4, ARG(2).int4);
|
sim->delete_part(ARG(0).int4, ARG(1).int4, ARG(2).int4);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRAPDEF(killPart)
|
TRAPDEF(killPart)
|
||||||
{
|
{
|
||||||
sim->kill_part(ARG(0).int4);
|
sim->kill_part(ARG(0).int4);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user