Y U NO WORK. added logic for WIRE but it's not being called.

This commit is contained in:
lieuwe 2011-07-29 06:30:15 +08:00 committed by Simon Robertshaw
parent 15b4ba7532
commit 50c4bfd86d
3 changed files with 44 additions and 1 deletions

View File

@ -312,6 +312,7 @@ int update_PBCN(UPDATE_FUNC_ARGS);
int update_GPMP(UPDATE_FUNC_ARGS); int update_GPMP(UPDATE_FUNC_ARGS);
int update_CLST(UPDATE_FUNC_ARGS); int update_CLST(UPDATE_FUNC_ARGS);
int update_DLAY(UPDATE_FUNC_ARGS); int update_DLAY(UPDATE_FUNC_ARGS);
int update_WIRE(UPDATE_FUNC_ARGS);
int update_MISC(UPDATE_FUNC_ARGS); int update_MISC(UPDATE_FUNC_ARGS);
int update_legacy_PYRO(UPDATE_FUNC_ARGS); int update_legacy_PYRO(UPDATE_FUNC_ARGS);
@ -545,7 +546,7 @@ static const part_type ptypes[PT_NUM] =
{"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN}, {"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN},
{"GPMP", PIXPACK(0x0A3B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP}, {"GPMP", PIXPACK(0x0A3B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP},
{"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST}, {"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST},
{"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 0, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,NULL} {"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 0, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,&update_WIRE}
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description
}; };

32
src/elements/wire.c Normal file
View File

@ -0,0 +1,32 @@
#include <element.h>
int update_WIRE(UPDATE_FUNC_ARGS) {
int s,r,rx,ry,count;
printf("FUCK");
s=pmap[y][x];
/*
0: wire
1: spark head
2: spark tail
tmp is previous state, ctype is current state
*/
parts[s>>8].tmp=parts[s>>8].ctype;
if(parts[s>>8].tmp==1){parts[s>>8].ctype=2;}
if(parts[s>>8].tmp==2){parts[s>>8].ctype=0;}
for(rx=-1; rx<2; rx++)
for(ry=-1; ry<2; ry++)
{
count=0;
if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && rx==0 && ry==0 && (pmap[y+ry][x+rx]&0xFF)!=0xFF)
{
r = pmap[y+ry][x+rx];
if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1;}
if((r&0xFF)==PT_WIRE && parts[r>>8].tmp==1){count++;}
}
if(count==1 || count==2)
parts[s>>8].ctype=1;
}
return 0;
}

View File

@ -1724,6 +1724,16 @@ void draw_parts(pixel *vid)
draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), 245, 245, 220, XRES+BARSIZE); draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), 245, 245, 220, XRES+BARSIZE);
} }
if(t==PT_WIRE)
{
if (parts[i].ctype==0)
blendpixel(vid, nx, ny, 255, 204, 0, 255);
else if(parts[i].ctype==1)
blendpixel(vid, nx, ny, 0, 0, 255, 255);
else
blendpixel(vid, nx, ny, 255, 255, 255, 255);
}
if (cmode!=CM_HEAT) if (cmode!=CM_HEAT)
{ {
if (t==PT_STKM) if (t==PT_STKM)