Added ARAY, a instant ray that can create holograms and transfer electrical energy

This commit is contained in:
Simon
2010-12-06 19:32:33 +00:00
parent 40ab51d79f
commit 122babe356
4 changed files with 88 additions and 22 deletions

View File

@@ -173,7 +173,9 @@
#define PT_LOLZ 123 #define PT_LOLZ 123
#define PT_WIFI 124 #define PT_WIFI 124
#define PT_FILT 125 #define PT_FILT 125
#define PT_NUM 126 #define PT_ARAY 126
#define PT_BRAY 127
#define PT_NUM 128
#define R_TEMP 22 #define R_TEMP 22
#define MAX_TEMP 9999 #define MAX_TEMP 9999
@@ -263,7 +265,7 @@ typedef struct part_state part_state;
*/ */
static const part_type ptypes[PT_NUM] = static const part_type ptypes[PT_NUM] =
{ {
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins Description
{"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", 0}, {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", 0},
{"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 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. Flammable.", TYPE_PART}, {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 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. Flammable.", TYPE_PART},
{"WATR", PIXPACK(0x2030D0), 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_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE}, {"WATR", PIXPACK(0x2030D0), 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_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE},
@@ -390,13 +392,14 @@ static const part_type ptypes[PT_NUM] =
{"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 373.0f, 40, "Lolz", TYPE_SOLID}, {"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 373.0f, 40, "Lolz", TYPE_SOLID},
{"WIFI", PIXPACK(0x40A060), 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_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID}, {"WIFI", PIXPACK(0x40A060), 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_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID},
{"FILT", PIXPACK(0x000056), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID}, {"FILT", PIXPACK(0x000056), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID},
{"ARAY", PIXPACK(0xFFBB00), 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_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", 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 {"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID}
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
}; };
static part_state pstates[PT_NUM] = static part_state pstates[PT_NUM] =
{ {
// Name Solid Frzp Liquid Mpnt Gas Bpoint // Name State Solid Frzp Liquid Mpnt Gas Bpoint 'Plasma' Flashpoint
/* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f},
@@ -523,6 +526,8 @@ static part_state pstates[PT_NUM] =
/* LOlZ */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LOlZ */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WIFI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WIFI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FILT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FILT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}
}; };
static int grule[NGOL][9] = static int grule[NGOL][9] =

View File

@@ -1789,6 +1789,21 @@ void draw_parts(pixel *vid)
cb = cb>255?255:cb; cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 127); blendpixel(vid, nx, ny, cr, cg, cb, 127);
} }
else if(t==PT_BRAY && parts[i].tmp==0)
{
int trans = parts[i].life * 7;
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
}
else if(t==PT_BRAY && parts[i].tmp==1)
{
int trans = parts[i].life/4;
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
}
else if(t==PT_BRAY && parts[i].tmp==2)
{
int trans = parts[i].life*100;
blendpixel(vid, nx, ny, 255, 150, 50, trans);
}
else if(t==PT_PHOT) else if(t==PT_PHOT)
{ {
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)

View File

@@ -1500,7 +1500,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{ {
if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
{ {
if(x-18<=20) if(x-18<=2)
{ {
x = XRES-BARSIZE-18; x = XRES-BARSIZE-18;
y += 19; y += 19;
@@ -1537,7 +1537,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{ {
if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
{ {
if(x-18<=20) if(x-18<=0)
{ {
x = XRES-BARSIZE-18; x = XRES-BARSIZE-18;
y += 19; y += 19;
@@ -1571,7 +1571,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{ {
if(ptypes[n].menusection==i&&ptypes[n].menu==1) if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{ {
if(x-18<=20) if(x-18<=0)
{ {
x = XRES-BARSIZE-18; x = XRES-BARSIZE-18;
y += 19; y += 19;
@@ -1608,7 +1608,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{ {
if(ptypes[n].menusection==i&&ptypes[n].menu==1) if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{ {
if(x-18<=20) if(x-18<=0)
{ {
x = XRES-BARSIZE-18; x = XRES-BARSIZE-18;
y += 19; y += 19;

View File

@@ -522,6 +522,8 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 50; parts[i].life = 50;
parts[i].tmp = 50; parts[i].tmp = 50;
} }
if(t==PT_BRAY)
parts[i].life = 30;
if(t==PT_PUMP) if(t==PT_PUMP)
parts[i].life= 10; parts[i].life= 10;
if(t==PT_FSEP) if(t==PT_FSEP)
@@ -1142,7 +1144,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].type==PT_PUMP)) && !(parts[i].life%4==0 && parts[i].type==PT_INST)) if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)) && !(parts[i].life%4==0 && parts[i].type==PT_INST))
parts[i].life--; 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_PUMP && 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 && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4) if(parts[i].life<=0 && t!=PT_METL && t!=PT_ARAY && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && 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 && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4)
{ {
kill_part(i); kill_part(i);
continue; continue;
@@ -1821,6 +1823,50 @@ void update_particles_i(pixel *vid, int start, int inc)
} }
} }
} }
else if(t==PT_ARAY && parts[i].life==0){
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((r&0xFF)==PT_SPRK){
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
for (int docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
r = pmap[y+nyi+nyy][x+nxi+nxx];
if(!((r>>8)>=NPART)) {
if(!r){
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
if(nr!=-1&&destroy){
parts[nr].tmp = 2;
parts[nr].life = 2;
}
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0&&!destroy){
if(nyy!=0 || nxx!=0){
parts[r>>8].type = PT_BRAY;
parts[r>>8].life = 1020;
parts[r>>8].tmp = 1;
}
docontinue = 0;
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
parts[r>>8].life = destroy?1:1020;
docontinue = 1;
} else if(!destroy) {
if(nyy!=0 || nxx!=0){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
docontinue = 0;
} else {
docontinue = 0;
}
}
}
}
//parts[i].life = 4;
}
}
}
}
else if(t==PT_FUSE) else if(t==PT_FUSE)
{ {
if(parts[i].life<=0) { if(parts[i].life<=0) {