summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-04 17:24:54 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-04 17:24:54 (GMT)
commitd56684312dd9429da8be8666206ad1656d3185a9 (patch)
treed8db260b8b24c1e193bc6a76700cb1de374ed7ef
parent01a2dcaf419b207702d959a5016107674c636325 (diff)
downloadpowder-d56684312dd9429da8be8666206ad1656d3185a9.zip
powder-d56684312dd9429da8be8666206ad1656d3185a9.tar.gz
WIFI, a wireless SPRK transmitter, has 25 'channels' controlled by temp. starting at 0C, every 100 degrees is a different channel, they are colored as well. Heat-gradient display, colors of elements is slightly changed based on temp. maybe some other fixes.
-rw-r--r--includes/defines.h1
-rw-r--r--includes/powder.h9
-rw-r--r--src/graphics.c32
-rw-r--r--src/interface.c7
-rw-r--r--src/main.c4
-rw-r--r--src/powder.c45
6 files changed, 92 insertions, 6 deletions
diff --git a/includes/defines.h b/includes/defines.h
index b2e1cca..a0db95d 100644
--- a/includes/defines.h
+++ b/includes/defines.h
@@ -124,6 +124,7 @@ int ISGOL;
int ISLOVE;
int ISLOLZ;
int ISGRAV;
+int ISWIRE;
int GSPEED;
int love[XRES/9][YRES/9];
int lolz[XRES/9][YRES/9];
diff --git a/includes/powder.h b/includes/powder.h
index 1442e63..a06249f 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -5,7 +5,8 @@
#include "defines.h"
#include "interface.h"
-#define CM_COUNT 9
+#define CM_COUNT 10
+#define CM_GRAD 9
#define CM_CRACK 8
#define CM_NOTHING 7
#define CM_FANCY 6
@@ -170,7 +171,8 @@
#define PT_SHLD3 121
#define PT_SHLD4 122
#define PT_LOLZ 123
-#define PT_NUM 124
+#define PT_WIFI 124
+#define PT_NUM 125
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -385,6 +387,7 @@ static const part_type ptypes[PT_NUM] =
{"SHD3", PIXPACK(0x444444), 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_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", 0},
{"SHD4", PIXPACK(0x212121), 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_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 4", 0},
{"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, 1, 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_CRACKER, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID|PROP_CONDUCTS},
//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
};
@@ -516,6 +519,7 @@ static part_state pstates[PT_NUM] =
/* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD4*/ {ST_SOLID, 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},
};
static int grule[NGOL][9] =
@@ -560,6 +564,7 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
};
int portal[8][8];
+int wireless[25];
extern int isplayer;
extern float player[27];
diff --git a/src/graphics.c b/src/graphics.c
index ed1a4b3..1af3f9b 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1409,6 +1409,29 @@ void draw_parts(pixel *vid)
cb = PIXB(ptypes[t].pcolors);
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
+ if(cmode==CM_GRAD)
+ {
+ float frequency = 0.05;
+ int q = parts[i].temp;
+ cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
+ cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
+ cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
+ if(cr>=255)
+ cr = 255;
+ if(cg>=255)
+ cg = 255;
+ if(cb>=255)
+ cb = 255;
+ if(cr<=0)
+ cr = 0;
+ if(cg<=0)
+ cg = 0;
+ if(cb<=0)
+ cb = 0;
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
+
+
+ }
else if(t==PT_MWAX&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
@@ -1539,6 +1562,15 @@ void draw_parts(pixel *vid)
cb=255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
+ else if(t==PT_WIFI)
+ {
+ float frequency = 0.25;
+ int q = parts[i].tmp;
+ cr = sin(frequency*q + 0) * 127 + 128;
+ cg = sin(frequency*q + 2) * 127 + 128;
+ cb = sin(frequency*q + 4) * 127 + 128;
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ }
else if(t==PT_PIPE)
{
if(parts[i].ctype==2)
diff --git a/src/interface.c b/src/interface.c
index a4ecc8f..3937ec8 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -550,10 +550,15 @@ void draw_svf_ui(pixel *vid_buf)
break;
case CM_FANCY:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255);
+ break;
case CM_NOTHING:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
+ break;
case CM_CRACK:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
+ break;
+ case CM_GRAD:
+ drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
break;
}
drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
@@ -1814,6 +1819,8 @@ void set_cmode(int cm)
strcpy(itc_msg, "Nothing Display");
else if(cmode==CM_CRACK)
strcpy(itc_msg, "Alternate Velocity Display");
+ else if(cmode==CM_GRAD)
+ strcpy(itc_msg, "Heat Gradient Display");
else
strcpy(itc_msg, "Velocity Display");
}
diff --git a/src/main.c b/src/main.c
index 05e4bc1..6fd5bf5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1307,6 +1307,10 @@ int main(int argc, char *argv[])
{
set_cmode(CM_CRACK);
}
+ if(sdl_key=='0')
+ {
+ set_cmode(CM_GRAD);
+ }
if(sdl_key==SDLK_TAB)
{
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
diff --git a/src/powder.c b/src/powder.c
index dbf05b0..ff5b926 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1112,8 +1112,16 @@ void update_particles_i(pixel *vid, int start, int inc)
gol2[nx][ny][z] = 0;
}
}
- if(CGOL==0)
- CGOL++;
+ if(ISWIRE==1)
+ {
+ CGOL = 0;
+ ISWIRE = 0;
+ }
+ if(CGOL==1)
+ {
+ for(int q = 0;q<25;q++)
+ wireless[q] = 0;
+ }
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
{
@@ -2817,12 +2825,12 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_INST2)
{
- if(parts[i].life%4==0)
+ if(parts[i].life%4<=1)
t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_INST3)
{
- if(parts[i].life%4!=0)
+ if(parts[i].life%4<=1)
t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_PRTI)
@@ -2894,6 +2902,35 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ else if(t==PT_WIFI)
+ {
+ CGOL = 1;
+ int temprange = 100;
+ for(int temp = 0; temp < 2500; temp += temprange)
+ if(parts[i].temp-273.15>temp&&parts[i].temp-273.15<temp+temprange)
+ parts[i].tmp = temp/100;
+ for(ny=-1; ny<2; ny++)
+ for(nx=-1; nx<2; nx++)
+ 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_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp])
+ {
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_NSCN;
+ parts[r>>8].life = 4;
+ }
+ else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp])
+ {
+ parts[r>>8].type = parts[r>>8].ctype;
+ wireless[parts[i].tmp] = 1;
+ ISWIRE = 1;
+ }
+ }
+ }
else if(t==PT_PCLN)
{
for(nx=-2; nx<3; nx++)