Added PIPE, yay. Added whole menu sections to be able to be specifically deleted.

This commit is contained in:
Philip
2010-11-18 00:01:46 -05:00
parent 9383c1ca4c
commit 5d0da4b138
5 changed files with 238 additions and 10 deletions

View File

@@ -113,6 +113,8 @@ int GSPEED;
int love[XRES/9][YRES/9];
int gol[XRES][YRES];
int gol2[XRES][YRES][NGOL];
int SEC;
int SEC2;
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@@ -139,7 +139,8 @@
#define PT_WARP 96
#define PT_PUMP 97
#define PT_FWRK 98
#define PT_NUM 99
#define PT_PIPE 99
#define PT_NUM 100
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -329,6 +330,7 @@ static const part_type ptypes[PT_NUM] =
{"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_GAS, R_TEMP +273.15f, 100, "This is what happens to your mind when catelite descibes an element.",TYPE_GAS},
{"PUMP", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.1f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, 273.15f, 0, "Changes pressure to its temp (use HEAT/COOL).", TYPE_SOLID},
{"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f+273.15f, 100, "First fireworks made, activated by heat/neutrons."},
{"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 273.15f, 0, "probably doesn't work", TYPE_SOLID},
//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
};

View File

@@ -745,7 +745,10 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
void draw_menu(pixel *vid_buf, int i, int hover)
{
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
if(i==SEC&&SEC!=0)
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 0, 255, 255, 255);
else
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
if(hover==i)
{
fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
@@ -1486,6 +1489,64 @@ void draw_parts(pixel *vid)
else
blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
}
else if(t==PT_PIPE)
{
if(parts[i].ctype==2)
{
cr = 50;
cg = 1;
cb = 1;
}
else if(parts[i].ctype==3)
{
cr = 1;
cg = 50;
cb = 1;
}
else if(parts[i].ctype==4)
{
cr = 1;
cg = 1;
cb = 50;
}
else if(parts[i].temp<272.15&&parts[i].ctype!=1)
{
if(parts[i].temp>173.25&&parts[i].temp<273.15)
{
cr = 50;
cg = 1;
cb = 1;
}
if(parts[i].temp>73.25&&parts[i].temp<=173.15)
{
cr = 1;
cg = 50;
cb = 1;
}
if(parts[i].temp>=0&&parts[i].temp<=73.15)
{
cr = 1;
cg = 1;
cb = 50;
}
}
else
{
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
}
if(parts[i].tmp)
{
cr = PIXR(ptypes[parts[i].tmp].pcolors);
cg = PIXG(ptypes[parts[i].tmp].pcolors);
cb = PIXB(ptypes[parts[i].tmp].pcolors);
}
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_ACID)
{
if(parts[i].life>255) parts[i].life = 255;

View File

@@ -1479,6 +1479,7 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
{
int h,x,y,n=0,height,width,sy,rows=0;
SEC = SEC2;
mx /= sdl_scale;
my /= sdl_scale;
rows = ceil((float)msections[i].itemcount/16.0f);
@@ -1505,6 +1506,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n;
}
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(n==SLALT)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
}
else if(n==*sl)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
@@ -1624,6 +1634,13 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
}
}
}
if(!bq&&mx>=sdl_scale*((XRES+BARSIZE)-16) && mx<sdl_scale*(XRES+BARSIZE-1) &&my>= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && my<sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)+15))
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
if(i>=0&&i<SC_TOTAL)
SEC = i;
}
if(h==-1)
{
@@ -1638,21 +1655,39 @@ 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 *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255);
}
if(b==1&&h==-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{
SLALT = -1;
SEC2 = SEC;
}
}
if(b==1&&h!=-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{
SLALT = h;
SEC2 = -1;
}
else{
*sl = h;
}
}
if(b==4&&h==-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{
SLALT = -1;
SEC2 = SEC;
}
}
if(b==4&&h!=-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{
SLALT = h;
SEC2 = -1;
}
else{
*sr = h;

View File

@@ -498,6 +498,8 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 110;
parts[i].tmp = 50;
}
if(t==PT_PIPE)
parts[i].life = 100;
if(t==PT_BCOL)
parts[i].life = 110;
if(t==PT_FIRE)
@@ -678,11 +680,16 @@ inline void delete_part(int x, int y)
i = pmap[y][x];
if(!i || (i>>8)>=NPART)
return;
if((parts[i>>8].type==SLALT)||SLALT==-1||SLALT==0)
if((parts[i>>8].type==SLALT)||SLALT==0)
{
kill_part(i>>8);
pmap[y][x] = 0;
}
else if(ptypes[parts[i>>8].type].menusection==SEC)
{
kill_part(i>>8);
pmap[y][x] = 0;
}
else
return;
}
@@ -981,7 +988,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)))
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)
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)
{
kill_part(i);
continue;
@@ -2164,7 +2171,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
}
}
for(int trade = 0; trade<9;trade ++)
for(int trade = 0; trade<4;trade ++)
{
nx = rand()%5-2;
ny = rand()%5-2;
@@ -2180,13 +2187,11 @@ void update_particles_i(pixel *vid, int start, int inc)
{
parts[r>>8].life ++;
parts[i].life --;
trade = 9;
}
else if(temp>0)
{
parts[r>>8].life += temp/2;
parts[i].life -= temp/2;
trade = 9;
}
}
}
@@ -2211,7 +2216,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].tmp = parts[r>>8].tmp;
parts[i].temp = parts[r>>8].temp;
parts[r>>8].type = PT_WARP;
parts[r>>8].life = rand()%90;
parts[r>>8].life = rand()%90+1;
trade = 5;
}
}
@@ -2305,6 +2310,129 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
else if(t==PT_PIPE)
{
if(!parts[i].ctype && parts[i].life<=50)
{
if(parts[i].temp<272.15)
{
if(parts[i].temp>173.25&&parts[i].temp<273.15)
{
parts[i].ctype = 2;
parts[i].life = 0;
}
if(parts[i].temp>73.25&&parts[i].temp<=173.15)
{
parts[i].ctype = 3;
parts[i].life = 0;
}
if(parts[i].temp>=0&&parts[i].temp<=73.15)
{
parts[i].ctype = 4;
parts[i].life = 0;
}
}
else
{
for(nx=-2; nx<3; nx++)
for(ny=-2; ny<3; ny++)
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(!r)
create_part(-1,x+nx,y+ny,PT_DMND);
}
if(parts[i].life==1)
parts[i].ctype = 1;
}
}
if(parts[i].ctype==1)
{
for(nx=-1; nx<2; nx++)
for(ny=-1; ny<2; ny++)
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(!r&&!parts[i].life)
{
parts[i].life=50;
continue;
}
if(!r)
continue;
}
if(parts[i].life==2)
{
parts[i].ctype = 2;
parts[i].life = 6;
}
}
if(parts[i].ctype>1)
for(int o = 0;o<3;o++)
for(int ctype = 2;ctype<5;ctype++)
{
if(parts[i].ctype==ctype)
{
if(parts[i].life==3)
{
for(nx=-1; nx<2; nx++)
for(ny=-1; ny<2; ny++)
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 || !r)
continue;
if(parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
{
//parts[r>>8].ctype = (((ctype-1)%3)+2);//forward
parts[r>>8].ctype = (((ctype)%3)+2);//reverse
parts[r>>8].life = 6;
}
}
//if(created == 0)
//{
// parts[i].ctype = (((ctype)%3)+2);
// parts[i].life = 6; //causes trippyness
//}
//else
// parts[i].life = 0;
}
else
{
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;
else if(!r&&parts[i].tmp!=0)
{
create_part(-1,x+nx,y+ny,parts[i].tmp);
parts[i].tmp = 0;
continue;
}
else if(!r)
continue;
else if(parts[r>>8].type!=PT_PIPE && parts[r>>8].type!=PT_DMND && parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
{
parts[i].tmp = parts[r>>8].type;
parts[r>>8].type = PT_NONE;
}
else if(parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
{
parts[r>>8].tmp = parts[i].tmp;
parts[i].tmp = 0;
}
}
}
}
}
}
else if(t==PT_PCLN)
{
for(nx=-2; nx<3; nx++)
@@ -4235,7 +4363,7 @@ int create_parts(int x, int y, int r, int c)
if(c == 0)
{
stemp = SLALT;
SLALT = -1;
SLALT = 0;
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)