VINE, plant grows up the side of WOOD. INST wire is now also a battery and will charge if it doesn't give off a spark right away. Will give spark to NSCN or SWCH that is on. found some more wall defines i missed. moved wall code up 100 numbers. INVS, solid that turns invisible to elements when under pressure.

This commit is contained in:
Cracker64 2010-11-28 16:58:57 -05:00
parent 3b4caf409d
commit 77a17ecaee
4 changed files with 172 additions and 116 deletions

View File

@ -17,32 +17,32 @@
#define CM_VEL 0
#define UI_WALLSTART 122
#define UI_ACTUALSTART 22
#define UI_WALLSTART 222
#define UI_ACTUALSTART 122
#define UI_WALLCOUNT 19
#define WL_WALLELEC 22
#define WL_EWALL 23
#define WL_DETECT 24
#define WL_STREAM 25
#define WL_SIGN 26
#define WL_FAN 27
#define WL_WALLELEC 122
#define WL_EWALL 123
#define WL_DETECT 124
#define WL_STREAM 125
#define WL_SIGN 126
#define WL_FAN 127
#define WL_FANHELPER 255
#define WL_ALLOWLIQUID 28
#define WL_DESTROYALL 29
#define WL_ERASE 30
#define WL_WALL 31
#define WL_ALLOWAIR 32
#define WL_ALLOWSOLID 33
#define WL_ALLOWALLELEC 34
#define WL_EHOLE 35
#define WL_ALLOWLIQUID 128
#define WL_DESTROYALL 129
#define WL_ERASE 130
#define WL_WALL 131
#define WL_ALLOWAIR 132
#define WL_ALLOWSOLID 133
#define WL_ALLOWALLELEC 134
#define WL_EHOLE 135
#define SPC_AIR 136
#define SPC_HEAT 137
#define SPC_COOL 138
#define SPC_VACUUM 139
#define SPC_AIR 236
#define SPC_HEAT 237
#define SPC_COOL 238
#define SPC_VACUUM 239
#define WL_ALLOWGAS 40
#define WL_ALLOWGAS 140
@ -160,7 +160,12 @@
#define PT_PSTE 111
#define PT_PSTS 112
#define PT_ANAR 113
#define PT_NUM 114
#define PT_VINE 114
#define PT_INVIS 115
#define PT_EQUALVEL 116//all particles equal their velocities
#define PT_INST2 117
#define PT_INST3 118
#define PT_NUM 119
#define R_TEMP 22
#define MAX_TEMP 9999
@ -357,7 +362,7 @@ static const part_type ptypes[PT_NUM] =
{"@_@", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_CRACKER, R_TEMP+0.0f +273.15f, 29, "@_@, contradicts the normal state changes.", TYPE_LIQUID},
{"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER, R_TEMP-200.0f +273.15f, 42, "@_@ gas", TYPE_GAS},
{"@_@S", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER, R_TEMP+300.0f +273.15f, 251, "@_@ solid", TYPE_SOLID},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls", TYPE_SOLID|PROP_CONDUCTS},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery.", TYPE_SOLID|PROP_CONDUCTS},
{"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID},
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 40, "Portal IN. Things go in here", TYPE_SOLID},
@ -365,6 +370,12 @@ static const part_type ptypes[PT_NUM] =
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Colloid", TYPE_LIQUID},
{"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "blah blah solid not in the menu", TYPE_SOLID},
{"ANAR", PIXPACK(0xFFFFEE), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves", TYPE_PART},
{"VINE", PIXPACK(0x0A9C00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 65, "Vine, not in menu", TYPE_SOLID},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description
};
@ -485,6 +496,11 @@ static part_state pstates[PT_NUM] =
/* PSTE */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PSTS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ANAR */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* VINE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* INVS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST3*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
};
static int grule[NGOL][9] =

View File

@ -447,7 +447,7 @@ void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswa
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
{
int i, j, c;
if(b>=121)
if(b>=UI_WALLSTART)
{
b = b-100;
//x = (2+32*((b-22)/1));
@ -470,7 +470,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 23:
case WL_EWALL:
for(j=1; j<15; j++)
{
for(i=1; i<6+j; i++)
@ -489,7 +489,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 24:
case WL_DETECT:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -498,7 +498,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 25:
case WL_STREAM:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -512,7 +512,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255);
}
break;
case 26:
case WL_SIGN:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -523,7 +523,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255);
drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255);
break;
case 27:
case WL_FAN:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -532,7 +532,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 28:
case WL_ALLOWLIQUID:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -544,7 +544,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 29:
case WL_DESTROYALL:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -553,7 +553,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 30:
case WL_ERASE:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<13; i+=2)
@ -569,7 +569,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 32:
case WL_ALLOWAIR:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -578,7 +578,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 33:
case WL_ALLOWSOLID:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -587,7 +587,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 34:
case WL_ALLOWALLELEC:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -599,7 +599,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 36:
case SPC_AIR-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -618,7 +618,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255);
break;
case 37:
case SPC_HEAT-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -637,7 +637,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255);
break;
case 38:
case SPC_COOL-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -656,7 +656,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255);
break;
case 39:
case SPC_VACUUM-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -675,7 +675,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255);
break;
case 40:
case WL_ALLOWGAS:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -693,7 +693,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
}
if(b==30)
if(b==WL_ERASE)
{
for(j=4; j<12; j++)
{
@ -1586,6 +1586,8 @@ void draw_parts(pixel *vid)
}
else if(t==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
blendpixel(vid, nx, ny, 15, 0, 150, 100);
else if(t==PT_ACID)
{
if(parts[i].life>255) parts[i].life = 255;

View File

@ -1646,9 +1646,9 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255);
}
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122))
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART))
{
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255);
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-UI_WALLSTART].descs)-BARSIZE, sy-10, (char *)mwalls[h-UI_WALLSTART].descs, 255, 255, 255, 255);
}
else
{
@ -2756,15 +2756,16 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
//Draw the score bars
if(info->voteup>0||info->votedown>0)
{
lv = (info->voteup>info->votedown?info->voteup:info->votedown);
lv = (info->voteup>info->votedown)?info->voteup:info->votedown;
lv = (lv>10)?lv:10;
if(50>lv)
{
ry = ((float)(50)/(float)lv);
if(lv<8)
{
ry = ry/(8-lv);
}
//if(lv<8)
//{
// ry = ry/(8-lv);
//}
nyu = info->voteup*ry;
nyd = info->votedown*ry;
}
@ -2774,11 +2775,13 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
nyu = info->voteup/ry;
nyd = info->votedown/ry;
}
nyu = nyu>50?50:nyu;
nyd = nyd>50?50:nyd;
fillrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+53, 54, 6, 0, 107, 10, 255);
fillrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+59, 54, 6, 107, 10, 0, 255);
drawrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+53, 54, 6, 128, 128, 128, 255);
drawrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+59, 54, 6, 128, 128, 128, 255);
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 0, 107, 10, 255);
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 107, 10, 0, 255);
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 128, 128, 128, 255);
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 128, 128, 128, 255);
fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255);
fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255);
@ -2790,7 +2793,9 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
ccy += 12;
ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185);
ccy += 10;
draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE);
if(ccy+52<YRES+MENUSIZE){ //Try not to draw off the screen.
draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE);
}
}
hasdrawninfo = 1;
myown = svf_login && !strcmp(info->author, svf_user);
@ -2917,8 +2922,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
execute_submit(vid_buf, save_id, ed.str);
}
}
if(!(mx>50 && my>50 && mx<XRES+BARSIZE-50 && my<XRES+MENUSIZE-50) && b && !queue_open){
if(!(mx>50 && my>50 && mx<XRES+BARSIZE-100 && my<YRES+MENUSIZE-100) && b && !queue_open){
retval = 0;
break;
}
@ -2971,7 +2975,9 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128);
}
}
if(!info_ready || !data_ready){
info_box(vid_buf, "Loading");
}
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
if(info_ready && svf_login){

View File

@ -91,25 +91,21 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr)
return 0;
if(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[ny/CELL][nx/CELL])
return 2;
if(bmap[ny/CELL][nx/CELL]==WL_ALLOWAIR)
return 0;
if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==WL_ALLOWSOLID)
return 0;
if(r && (r&0xFF) < PT_NUM){
//if(ptypes[pt].properties&TYPE_ENERGY && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&TYPE_ENERGY))))
if(ptypes[pt].properties&TYPE_ENERGY && ptypes[(r&0xFF)].properties&TYPE_ENERGY)
return 2;
if(ptypes[pt].properties&TYPE_ENERGY && ptypes[(r&0xFF)].properties&TYPE_ENERGY)
return 2;
//if(pt==PT_NEUT && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE))))
if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPASS)
return 2;
if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)
return 1;
if((r&0xFF)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE)
return 0;
if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPASS)
return 2;
if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)
return 1;
if((r&0xFF)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE)
return 0;
}
if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight)))
@ -132,7 +128,8 @@ int try_move(int i, int x, int y, int nx, int ny)
return 1;
e = eval_move(parts[i].type, nx, ny, &r);
if((pmap[ny][nx]&0xFF)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
return 1;
/* half-silvered mirror */
if(!e && parts[i].type==PT_PHOT &&
(((r&0xFF)==PT_BMTL && rand()<RAND_MAX/2) ||
@ -401,6 +398,25 @@ inline int create_part(int p, int x, int y, int t)
return -1;
}
}
if(t==PT_INST2)
if((pmap[y][x]&0xFF)==PT_INST)
{
parts[pmap[y][x]>>8].type = PT_INST2;
parts[pmap[y][x]>>8].life += 5;
pmap[y][x] = (pmap[y][x]&~0xFF) | PT_INST2;
return pmap[y][x]>>8;
}
if(t==PT_INST3)
if((pmap[y][x]&0xFF)==PT_INST||(pmap[y][x]&0xFF)==PT_INST2)
{
parts[pmap[y][x]>>8].type = PT_INST3;
if(parts[pmap[y][x]>>8].life%4==0)
parts[pmap[y][x]>>8].life -=0;
else
parts[pmap[y][x]>>8].life -= 2;
pmap[y][x] = (pmap[y][x]&~0xFF) | PT_INST3;
return pmap[y][x]>>8;
}
if(t==SPC_AIR)
{
pv[y/CELL][x/CELL] += 0.03f;
@ -444,8 +460,7 @@ inline int create_part(int p, int x, int y, int t)
(pmap[y][x]&0xFF)!=PT_BRMT &&
(pmap[y][x]&0xFF)!=PT_NBLE &&
(pmap[y][x]&0xFF)!=PT_IRON &&
(pmap[y][x]&0xFF)!=PT_INWR &&
(pmap[y][x]&0xFF)!=PT_INST)
(pmap[y][x]&0xFF)!=PT_INWR)
return -1;
if(parts[pmap[y][x]>>8].life!=0)
return -1;
@ -1043,7 +1058,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_DEUT)
{
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)))
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)) && !(parts[i].life%4==0 && parts[i].type==PT_INST))
parts[i].life--;
if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST)
{
@ -1063,6 +1078,8 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = 64;
if(t == PT_SLTW)
parts[i].life = 54;
if(t == PT_SWCH)
parts[i].life = 15;
}
}
@ -1283,7 +1300,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
parts[i].pavg[0] = parts[i].pavg[1];
parts[i].pavg[1] = pv[y/CELL][x/CELL];
if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f)
if(parts[i].pavg[1]-parts[i].pavg[0] > 0.25f || parts[i].pavg[1]-parts[i].pavg[0] < -0.25f)
{
parts[i].type = PT_BGLA;
}
@ -1822,6 +1839,10 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_NONE;
parts[i].life = rand()%60 + 60;
}
else if((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2)
{
create_part(-1,(x+nx)+(rand()%3)-1,(y+ny)+(rand()%3)-1,PT_VINE);
}
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
//t = parts[i].type = PT_WATR;
}
@ -1841,6 +1862,25 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = 0;
}
}
else if(t==PT_VINE)
{
nx=(rand()%3)-1;
ny=(rand()%3)-1;
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART)
continue;
if(1>rand()%15)
parts[i].type=PT_PLNT;
else if(!r)
{
create_part(-1,x+nx,y+ny,PT_VINE);
parts[i].type=PT_PLNT;
}
}
}
else if(t==PT_THRM)
{
for(nx=-2; nx<3; nx++)
@ -2656,31 +2696,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_INST)
{
if(pmap[y-1][x]&0xFF==t&&pmap[y+1][x]&0xFF==t&&pmap[y][x-1]&0xFF==t&&pmap[y][x+1]&0xFF==t)
{
parts[i].tmp = 1;//x
//parts[i].flags = 1;//y
parts[pmap[y-1][x]].flags=1;
parts[pmap[y+1][x]].flags=1;
parts[pmap[y][x-1]].tmp = 1;
parts[pmap[y][x+1]].tmp =1;
}
/*else if(pmap[y-1][x]&0xFF!=t&&pmap[y+1][x]&0xFF==t&&pmap[y][x-1]&0xFF==t&&pmap[y][x+1]&0xFF==t)
{
parts[i].tmp = 1;
}
else if(pmap[y-1][x]&0xFF==t&&pmap[y+1][x]&0xFF!=t&&pmap[y][x-1]&0xFF==t&&pmap[y][x+1]&0xFF==t)
{
parts[i].tmp = 1;
}
else if(pmap[y-1][x]&0xFF==t&&pmap[y+1][x]&0xFF==t&&pmap[y][x-1]&0xFF!=t&&pmap[y][x+1]&0xFF==t)
{
parts[i].flags = 1;
}
else if(pmap[y-1][x]&0xFF==t&&pmap[y+1][x]&0xFF==t&&pmap[y][x-1]&0xFF==t&&pmap[y][x+1]&0xFF!=t)
{
parts[i].flags = 1;
}*/
for(nx=-2; nx<3; nx++)
for(ny=-2; ny<3; ny++)
if(x+nx>=0 && y+ny>0 &&
@ -2689,12 +2704,28 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
continue;
if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN))
else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0)
{
flood_parts(x,y,PT_SPRK,PT_INST,-1);
flood_parts(x,y,PT_INST2,PT_INST,-1);
}
else if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0&&(parts[i].life>=4)&&parts[i].life%4<=1)
{
create_part(-1,x+nx,y+ny,PT_SPRK);
flood_parts(x,y,PT_INST3,PT_INST,-1);
}
else if(parts[r>>8].type==PT_SWCH&&parts[r>>8].life==10&&(parts[i].life>=4)&&parts[i].life%4<=1)
{
parts[r>>8].type=PT_SPRK;
parts[r>>8].ctype=PT_SWCH;
parts[r>>8].life=4;
flood_parts(x,y,PT_INST3,PT_INST,-1);
}
}
}
else if(t==PT_INST2 || t==PT_INST3)
{
t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_PRTI)
{
int count =0;
@ -3146,7 +3177,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].temp = 3500;
pv[y/CELL][x/CELL] += 1;
}
if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1)
if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=0)
{
parts[i].type = PT_SWCH;
parts[i].life = 14;
@ -4474,8 +4505,8 @@ int flood_parts(int x, int y, int c, int cm, int bm)
{
int x1, x2, dy = (c<PT_NUM)?1:CELL;
int co = c;
if(cm==PT_INST&&co==PT_SPRK)
if((pmap[y][x]&0xFF)==PT_SPRK)
if(cm==PT_INST&&(co==PT_INST2||co==PT_INST3))
if((pmap[y][x]&0xFF)==PT_INST2 || (pmap[y][x]&0xFF)==PT_INST3)
return 0;
if(c>=UI_WALLSTART&&c<=UI_WALLSTART+UI_WALLCOUNT)
{
@ -4528,38 +4559,39 @@ int flood_parts(int x, int y, int c, int cm, int bm)
// fill span
for(x=x1; x<=x2; x++)
{
if(!create_parts(x, y, 0, 0, co))
return 0;
}
// fill children
if(cm==PT_INST&&co==PT_SPRK)
if(cm==PT_INST&&(co==PT_INST2||co==PT_INST3))
{
if(y>=CELL+dy && x1==x2 &&
((pmap[y-1][x1-1]&0xFF)==PT_INST||(pmap[y-1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1]&0xFF)==PT_INST||(pmap[y-1][x1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || (pmap[y-1][x1+1]&0xFF)==PT_SPRK) &&
(pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||(pmap[y-2][x1]&0xFF)==PT_SPRK) && (pmap[y-2][x1+1]&0xFF)!=PT_INST)
((pmap[y-1][x1-1]&0xFF)==PT_INST||((pmap[y-1][x1-1]&0xFF)==PT_INST3||(pmap[y-1][x1-1]&0xFF)==PT_INST2)) && ((pmap[y-1][x1]&0xFF)==PT_INST||((pmap[y-1][x1]&0xFF)==PT_INST3||(pmap[y-1][x1]&0xFF)==PT_INST2)) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || ((pmap[y-1][x1+1]&0xFF)==PT_INST3||(pmap[y-1][x1+1]&0xFF)==PT_INST2)) &&
(pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||((pmap[y-2][x1]&0xFF)==PT_INST3||(pmap[y-2][x1]&0xFF)==PT_INST2)) && (pmap[y-2][x1+1]&0xFF)!=PT_INST)
flood_parts(x1, y-2, co, cm, bm);
else if(y>=CELL+dy)
for(x=x1; x<=x2; x++)
if((pmap[y-1][x]&0xFF)!=PT_SPRK)
if((pmap[y-1][x]&0xFF)!=co)
{
if(x==x1 || x==x2 || y>=YRES-CELL-1 ||
(pmap[y-1][x-1]&0xFF)==PT_INST || (pmap[y-1][x+1]&0xFF)==PT_INST ||
(pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=PT_SPRK) || (pmap[y+1][x+1]&0xFF)==PT_INST)
(pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=co) || (pmap[y+1][x+1]&0xFF)==PT_INST)
flood_parts(x, y-dy, co, cm, bm);
}
if(y<YRES-CELL-dy && x1==x2 &&
((pmap[y+1][x1-1]&0xFF)==PT_INST||(pmap[y+1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y+1][x1]&0xFF)==PT_INST||(pmap[y+1][x1]&0xFF)==PT_SPRK) && ((pmap[y+1][x1+1]&0xFF)==PT_INST || (pmap[y+1][x1+1]&0xFF)==PT_SPRK) &&
(pmap[y+2][x1-1]&0xFF)!=PT_INST && ((pmap[y+2][x1]&0xFF)==PT_INST ||(pmap[y+2][x1]&0xFF)==PT_SPRK) && (pmap[y+2][x1+1]&0xFF)!=PT_INST)
((pmap[y+1][x1-1]&0xFF)==PT_INST||((pmap[y+1][x1-1]&0xFF)==PT_INST3||(pmap[y+1][x1-1]&0xFF)==PT_INST2)) && ((pmap[y+1][x1]&0xFF)==PT_INST||((pmap[y+1][x1]&0xFF)==PT_INST3||(pmap[y+1][x1]&0xFF)==PT_INST2)) && ((pmap[y+1][x1+1]&0xFF)==PT_INST || ((pmap[y+1][x1+1]&0xFF)==PT_INST3||(pmap[y+1][x1+1]&0xFF)==PT_INST2)) &&
(pmap[y+2][x1-1]&0xFF)!=PT_INST && ((pmap[y+2][x1]&0xFF)==PT_INST ||((pmap[y+2][x1]&0xFF)==PT_INST3||(pmap[y+2][x1]&0xFF)==PT_INST2)) && (pmap[y+2][x1+1]&0xFF)!=PT_INST)
flood_parts(x1, y+2, co, cm, bm);
else if(y<YRES-CELL-dy)
for(x=x1; x<=x2; x++)
if((pmap[y+1][x]&0xFF)!=PT_SPRK)
if((pmap[y+1][x]&0xFF)!=co)
{
if(x==x1 || x==x2 || y<0 ||
(pmap[y+1][x-1]&0xFF)==PT_INST || (pmap[y+1][x+1]&0xFF)==PT_INST ||
(pmap[y-1][x-1]&0xFF)==PT_INST || ((pmap[y-1][x]&0xFF)!=PT_INST&&(pmap[y-1][x]&0xFF)!=PT_SPRK) || (pmap[y-1][x+1]&0xFF)==PT_INST)
(pmap[y-1][x-1]&0xFF)==PT_INST || ((pmap[y-1][x]&0xFF)!=PT_INST&&(pmap[y-1][x]&0xFF)!=co) || (pmap[y-1][x+1]&0xFF)==PT_INST)
flood_parts(x, y+dy, co, cm, bm);
}
@ -4577,7 +4609,7 @@ int flood_parts(int x, int y, int c, int cm, int bm)
if(!flood_parts(x, y+dy, co, cm, bm))
return 0;
}
if(!(cm==PT_INST&&co==PT_SPRK))
if(!(cm==PT_INST&&(co==PT_INST2||co==PT_INST3)))
return 1;
}
@ -4746,7 +4778,7 @@ void create_line(int x1, int y1, int x2, int y2, float rx, float ry, int c)
if(e >= 0.5f)
{
y += sy;
if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !(rx+ry))
if(c==WL_EHOLE || c==WL_ALLOWGAS || c==WL_ALLOWALLELEC || c==WL_ALLOWSOLID || c==WL_ALLOWAIR || c==WL_WALL || c==WL_DESTROYALL || c==WL_ALLOWLIQUID || c==WL_FAN || c==WL_STREAM || c==WL_DETECT || c==WL_EWALL || c==WL_WALLELEC || !(rx+ry))
{
if(cp)
create_parts(y, x, rx, ry, c);