mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-08 00:14:00 +02:00
updated to simon's latest
This commit is contained in:
parent
e5e6006bc8
commit
f94986a3ba
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
|
||||
#define SAVE_VERSION 42
|
||||
#define MINOR_VERSION 0
|
||||
#define MINOR_VERSION 1
|
||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||
#define BETA
|
||||
|
||||
|
59
graphics.c
59
graphics.c
@ -971,6 +971,15 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||
#endif
|
||||
{
|
||||
#ifdef OpenGL
|
||||
if(x<0 || y<0 || x>=XRES || r>=YRES)
|
||||
return;
|
||||
if(a!=255)
|
||||
{
|
||||
glBegin (GL_QUADS);
|
||||
glColor4ub(r,g,b,a);
|
||||
glVertex2i(x, y);
|
||||
}
|
||||
vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b);
|
||||
#else
|
||||
pixel t;
|
||||
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
||||
@ -1171,6 +1180,48 @@ void draw_parts(pixel *vid)
|
||||
float pt = R_TEMP;
|
||||
for(i = 0; i<NPART; i++){
|
||||
#ifdef OpenGL
|
||||
if(cmode == 6) //If fire mode
|
||||
{
|
||||
|
||||
if(t==PT_MWAX)
|
||||
{
|
||||
for(x=-1; x<=1; x++)
|
||||
{
|
||||
for(y=-1; y<=1; y++)
|
||||
{
|
||||
if ((abs(x) == 0) && (abs(y) == 0))
|
||||
blendpixel(vid,x+nx,y+ny,224,224,170,255);
|
||||
else if (abs(y) != 0 && abs(x) != 0)
|
||||
blendpixel(vid,x+nx,y+ny,224,224,170,20);
|
||||
else
|
||||
blendpixel(vid,x+nx,y+ny,224,224,170,40);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if(t==PT_PLUT)
|
||||
{
|
||||
int tempx;
|
||||
int tempy;
|
||||
cr = 0x40;
|
||||
cg = 0x70;
|
||||
cb = 0x20;
|
||||
blendpixel(vid, nx, ny, cr, cg, cb, 192);
|
||||
blendpixel(vid, nx+1, ny, cr, cg, cb, 96);
|
||||
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
|
||||
blendpixel(vid, nx, ny+1, cr, cg, cb, 96);
|
||||
blendpixel(vid, nx, ny-1, cr, cg, cb, 96);
|
||||
for(tempx = 2; tempx < 10; tempx++) {
|
||||
for(tempy = 2; tempy < 10; tempy++) {
|
||||
blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5);
|
||||
blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5);
|
||||
blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5);
|
||||
blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(parts[i].type){
|
||||
//Do nothing
|
||||
t = parts[i].type;
|
||||
@ -2113,16 +2164,18 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
|
||||
{
|
||||
unsigned char *d,*c=save;
|
||||
int i,j,k,x,y,rx,ry,p=0;
|
||||
int bw,bh,w,h;
|
||||
int bw,bh,w,h,new_format = 0;
|
||||
pixel *fb;
|
||||
|
||||
if(size<16)
|
||||
return NULL;
|
||||
if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66)
|
||||
if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50))
|
||||
return NULL;
|
||||
if(c[4]>SAVE_VERSION)
|
||||
return NULL;
|
||||
|
||||
if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66){
|
||||
new_format = 1;
|
||||
}
|
||||
bw = c[6];
|
||||
bh = c[7];
|
||||
w = bw*CELL;
|
||||
|
115
interface.c
115
interface.c
@ -35,6 +35,7 @@ void *svf_last = NULL;
|
||||
int svf_lsize;
|
||||
|
||||
char *search_ids[GRID_X*GRID_Y];
|
||||
char *search_dates[GRID_X*GRID_Y];
|
||||
int search_votes[GRID_X*GRID_Y];
|
||||
int search_publish[GRID_X*GRID_Y];
|
||||
int search_scoredown[GRID_X*GRID_Y];
|
||||
@ -1609,11 +1610,11 @@ int sdl_poll(void)
|
||||
sdl_zoom_trig = 1;
|
||||
Z_keysym = event.key.keysym.sym;
|
||||
}
|
||||
if( event.key.keysym.sym == SDLK_PLUS || event.key.keysym.sym == SDLK_RIGHTBRACKET)
|
||||
if( event.key.keysym.sym == SDLK_PLUS)
|
||||
{
|
||||
sdl_wheel++;
|
||||
}
|
||||
if( event.key.keysym.sym == SDLK_MINUS || event.key.keysym.sym == SDLK_LEFTBRACKET)
|
||||
if( event.key.keysym.sym == SDLK_MINUS)
|
||||
{
|
||||
sdl_wheel--;
|
||||
}
|
||||
@ -1834,6 +1835,7 @@ int search_ui(pixel *vid_buf)
|
||||
memset(img_id, 0, sizeof(img_id));
|
||||
|
||||
memset(search_ids, 0, sizeof(search_ids));
|
||||
memset(search_dates, 0, sizeof(search_dates));
|
||||
memset(search_names, 0, sizeof(search_names));
|
||||
memset(search_scoreup, 0, sizeof(search_scoreup));
|
||||
memset(search_scoredown, 0, sizeof(search_scoredown));
|
||||
@ -2008,7 +2010,7 @@ int search_ui(pixel *vid_buf)
|
||||
}
|
||||
else
|
||||
pos = gi+GRID_X*gj;
|
||||
if(!search_ids[pos])
|
||||
if(!search_dates[pos])
|
||||
break;
|
||||
gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2;
|
||||
gy = ((((YRES-(MENUSIZE-20))+15)/GRID_Y)*gj) + ((YRES-(MENUSIZE-20))/GRID_Y-(YRES-(MENUSIZE-20))/GRID_S+10)/2 + 18;
|
||||
@ -2048,6 +2050,9 @@ int search_ui(pixel *vid_buf)
|
||||
dp = pos;
|
||||
}
|
||||
}
|
||||
drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255);
|
||||
fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255);
|
||||
fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255);
|
||||
if(mp==pos && !st)
|
||||
drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255);
|
||||
else
|
||||
@ -2106,11 +2111,10 @@ int search_ui(pixel *vid_buf)
|
||||
nyd = search_scoredown[pos]/ry;
|
||||
}
|
||||
|
||||
fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255);
|
||||
fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255);
|
||||
|
||||
drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255);
|
||||
drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255);
|
||||
fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255);
|
||||
fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255);
|
||||
//drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255);
|
||||
// drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2202,9 +2206,17 @@ int search_ui(pixel *vid_buf)
|
||||
fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255);
|
||||
info_box(vid_buf, "Loading...");
|
||||
|
||||
uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64);
|
||||
strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID=");
|
||||
strcaturl(uri, search_ids[mp]);
|
||||
if(search_dates[mp]){
|
||||
uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71);
|
||||
strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID=");
|
||||
strcaturl(uri, search_ids[mp]);
|
||||
strcaturl(uri, "&Date=");
|
||||
strcaturl(uri, search_dates[mp]);
|
||||
} else {
|
||||
uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64);
|
||||
strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID=");
|
||||
strcaturl(uri, search_ids[mp]);
|
||||
}
|
||||
data = http_simple_get(uri, &status, &dlen);
|
||||
free(uri);
|
||||
|
||||
@ -2481,7 +2493,7 @@ finish:
|
||||
int search_results(char *str, int votes)
|
||||
{
|
||||
int i,j;
|
||||
char *p,*q,*r,*s,*vu,*vd,*pu;
|
||||
char *p,*q,*r,*s,*vu,*vd,*pu,*sd;
|
||||
|
||||
for(i=0; i<GRID_X*GRID_Y; i++)
|
||||
{
|
||||
@ -2494,6 +2506,11 @@ int search_results(char *str, int votes)
|
||||
{
|
||||
free(search_names[i]);
|
||||
search_names[i] = NULL;
|
||||
}
|
||||
if(search_dates[i])
|
||||
{
|
||||
free(search_dates[i]);
|
||||
search_dates[i] = NULL;
|
||||
}
|
||||
if(search_owners[i])
|
||||
{
|
||||
@ -2587,9 +2604,77 @@ int search_results(char *str, int votes)
|
||||
search_owners[i] = mystrdup(q);
|
||||
search_names[i] = mystrdup(r);
|
||||
|
||||
if(s)
|
||||
search_votes[i] = atoi(s);
|
||||
thumb_cache_find(str, search_thumbs+i, search_thsizes+i);
|
||||
if(s)
|
||||
search_votes[i] = atoi(s);
|
||||
thumb_cache_find(str+5, search_thumbs+i, search_thsizes+i);
|
||||
i++;
|
||||
}
|
||||
else if(!strncmp(str, "HISTORY ", 8))
|
||||
{
|
||||
if(i>=GRID_X*GRID_Y)
|
||||
break;
|
||||
if(votes)
|
||||
{
|
||||
sd = strchr(str+8, ' ');
|
||||
if(!sd)
|
||||
return i;
|
||||
*(sd++) = 0;
|
||||
pu = strchr(sd, ' ');
|
||||
if(!pu)
|
||||
return i;
|
||||
*(pu++) = 0;
|
||||
s = strchr(pu, ' ');
|
||||
if(!s)
|
||||
return i;
|
||||
*(s++) = 0;
|
||||
vu = strchr(s, ' ');
|
||||
if(!vu)
|
||||
return i;
|
||||
*(vu++) = 0;
|
||||
vd = strchr(vu, ' ');
|
||||
if(!vd)
|
||||
return i;
|
||||
*(vd++) = 0;
|
||||
q = strchr(vd, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
sd = strchr(str+8, ' ');
|
||||
if(!sd)
|
||||
return i;
|
||||
*(sd++) = 0;
|
||||
pu = strchr(sd, ' ');
|
||||
if(!pu)
|
||||
return i;
|
||||
*(pu++) = 0;
|
||||
vu = strchr(pu, ' ');
|
||||
if(!vu)
|
||||
return i;
|
||||
*(vu++) = 0;
|
||||
vd = strchr(vu, ' ');
|
||||
if(!vd)
|
||||
return i;
|
||||
*(vd++) = 0;
|
||||
q = strchr(vd, ' ');
|
||||
}
|
||||
if(!q)
|
||||
return i;
|
||||
*(q++) = 0;
|
||||
r = strchr(q, ' ');
|
||||
if(!r)
|
||||
return i;
|
||||
*(r++) = 0;
|
||||
search_ids[i] = mystrdup(str+8);
|
||||
search_dates[i] = mystrdup(sd);
|
||||
search_publish[i] = atoi(pu);
|
||||
search_scoreup[i] = atoi(vu);
|
||||
search_scoredown[i] = atoi(vd);
|
||||
search_owners[i] = mystrdup(q);
|
||||
search_names[i] = mystrdup(r);
|
||||
|
||||
if(s)
|
||||
search_votes[i] = atoi(s);
|
||||
thumb_cache_find(str+8, search_thumbs+i, search_thsizes+i);
|
||||
i++;
|
||||
}
|
||||
else if(!strncmp(str, "TAG ", 4))
|
||||
|
@ -101,6 +101,7 @@ extern void *svf_last;
|
||||
extern int svf_lsize;
|
||||
|
||||
extern char *search_ids[GRID_X*GRID_Y];
|
||||
extern char *search_dates[GRID_X*GRID_Y];
|
||||
extern int search_votes[GRID_X*GRID_Y];
|
||||
extern int search_publish[GRID_X*GRID_Y];
|
||||
extern int search_scoredown[GRID_X*GRID_Y];
|
||||
|
175
main.c
175
main.c
@ -232,7 +232,7 @@ void *build_thumb(int *size, int bzip2)
|
||||
|
||||
void *build_save(int *size, int x0, int y0, int w, int h)
|
||||
{
|
||||
unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c;
|
||||
unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*8+MAXSIGNS*262), *c;
|
||||
int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int));
|
||||
int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL;
|
||||
|
||||
@ -311,30 +311,10 @@ void *build_save(int *size, int x0, int y0, int w, int h)
|
||||
i = m[j];
|
||||
if(i)
|
||||
{
|
||||
if(cracker)
|
||||
{
|
||||
int z;
|
||||
int temp1 = 0;
|
||||
int temp = parts[i-1].temp;
|
||||
int temp2 = temp;
|
||||
for(z = 15;z>=8;z--)
|
||||
{
|
||||
if(temp>0&&temp>=powf(2,z))
|
||||
{
|
||||
temp1 += powf(2,z-8);
|
||||
temp -= powf(2,z);
|
||||
}
|
||||
}
|
||||
d[p++] = (char)temp1;
|
||||
d[p++] = (char)temp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char tttemp = (unsigned char)((parts[i-1].temp+(-MIN_TEMP))/((MAX_TEMP+(-MIN_TEMP))/255));
|
||||
d[p++] = tttemp;
|
||||
}
|
||||
//if(tttemp<0) tttemp=0;
|
||||
//if(tttemp>255) tttemp=255;
|
||||
//New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format
|
||||
int tttemp = (int)parts[i-1].temp;
|
||||
d[p++] = ((tttemp&0xFF00)>>8);
|
||||
d[p++] = (tttemp&0x00FF);
|
||||
}
|
||||
}
|
||||
for(j=0; j<w*h; j++)
|
||||
@ -368,10 +348,12 @@ void *build_save(int *size, int x0, int y0, int w, int h)
|
||||
}
|
||||
|
||||
i = (p*101+99)/100 + 612;
|
||||
c = malloc(i);
|
||||
c[0] = 0x66;
|
||||
c[1] = 0x75;
|
||||
c[2] = 0x43;
|
||||
c = malloc(i);
|
||||
//New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
|
||||
//This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
|
||||
c[0] = 0x50; //0x66;
|
||||
c[1] = 0x53; //0x75;
|
||||
c[2] = 0x76; //0x43;
|
||||
c[3] = legacy_enable;
|
||||
c[4] = SAVE_VERSION;
|
||||
c[5] = CELL;
|
||||
@ -402,18 +384,23 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
unsigned char *d,*c=save;
|
||||
int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0;
|
||||
int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h;
|
||||
int fp[NPART], nf=0;
|
||||
int fp[NPART], nf=0, new_format = 0, ttv = 0;
|
||||
//New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
|
||||
//This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
|
||||
|
||||
if(size<16)
|
||||
return 1;
|
||||
if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66)
|
||||
return 1;
|
||||
if(c[4]>SAVE_VERSION)
|
||||
return 2;
|
||||
ver = c[4];
|
||||
if(size<16)
|
||||
return 1;
|
||||
if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50))
|
||||
return 1;
|
||||
if(c[2]==0x76 && c[1]==0x53 && c[0]==0x50){
|
||||
new_format = 1;
|
||||
}
|
||||
if(c[4]>SAVE_VERSION)
|
||||
return 2;
|
||||
ver = c[4];
|
||||
|
||||
if(ver<34)
|
||||
{
|
||||
if(ver<34)
|
||||
{
|
||||
legacy_enable = 1;
|
||||
}
|
||||
else
|
||||
@ -636,40 +623,34 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
{
|
||||
if(ver>=34&&legacy_beta==0)
|
||||
{
|
||||
if(p >= size)
|
||||
{
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART)
|
||||
if(p >= size)
|
||||
{
|
||||
if(cracker)
|
||||
{
|
||||
int z;
|
||||
int q = 0;
|
||||
int temp1 = d[p++];
|
||||
int temp2 = d[p++];
|
||||
for(z = 7;z>=0;z--)
|
||||
{
|
||||
if(temp1>0&&temp1>=powf(2,z))
|
||||
{
|
||||
q += powf(2,z+8);
|
||||
temp1 -= powf(2,z);
|
||||
}
|
||||
}
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART)
|
||||
{
|
||||
if(ver>=42){
|
||||
if(new_format){
|
||||
ttv = (d[p++])<<8;
|
||||
ttv |= (d[p++]);
|
||||
parts[i-1].temp = ttv;
|
||||
} else {
|
||||
|
||||
parts[i-1].temp = temp2 + q + 0.15;
|
||||
parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP;
|
||||
}
|
||||
}
|
||||
else if(ver>=42){
|
||||
parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP;
|
||||
} else {
|
||||
else {
|
||||
parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273.15;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p ++;
|
||||
if(new_format){
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parts[i-1].temp = ptypes[parts[i-1].type].heat;
|
||||
@ -1301,13 +1282,57 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
set_cmode(5);
|
||||
}
|
||||
if(sdl_key=='7')
|
||||
{
|
||||
set_cmode(6);
|
||||
}
|
||||
if(sdl_key==SDLK_SPACE)
|
||||
sys_pause = !sys_pause;
|
||||
if(sdl_key=='h')
|
||||
if(sdl_key=='7')
|
||||
{
|
||||
set_cmode(6);
|
||||
}
|
||||
if(sdl_key==SDLK_LEFTBRACKET){
|
||||
if(sdl_zoom_trig==1)
|
||||
{
|
||||
ZSIZE -= 1;
|
||||
if(ZSIZE>32)
|
||||
ZSIZE = 32;
|
||||
if(ZSIZE<2)
|
||||
ZSIZE = 2;
|
||||
ZFACTOR = 256/ZSIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
|
||||
bs -= 1;
|
||||
else
|
||||
bs -= ceil((bs/5)+0.5f);
|
||||
if(bs>1224)
|
||||
bs = 1224;
|
||||
if(bs<0)
|
||||
bs = 0;
|
||||
}
|
||||
}
|
||||
if(sdl_key==SDLK_RIGHTBRACKET){
|
||||
if(sdl_zoom_trig==1)
|
||||
{
|
||||
ZSIZE += 1;
|
||||
if(ZSIZE>32)
|
||||
ZSIZE = 32;
|
||||
if(ZSIZE<2)
|
||||
ZSIZE = 2;
|
||||
ZFACTOR = 256/ZSIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
|
||||
bs += 1;
|
||||
else
|
||||
bs += ceil((bs/5)+0.5f);
|
||||
if(bs>1224)
|
||||
bs = 1224;
|
||||
if(bs<0)
|
||||
bs = 0;
|
||||
}
|
||||
}
|
||||
if(sdl_key==SDLK_SPACE)
|
||||
sys_pause = !sys_pause;
|
||||
if(sdl_key=='h')
|
||||
hud_enable = !hud_enable;
|
||||
if(sdl_key=='p')
|
||||
dump_frame(vid_buf, XRES, YRES, XRES);
|
||||
|
11
powder.c
11
powder.c
@ -63,7 +63,7 @@ int try_move(int i, int x, int y, int nx, int ny)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(bmap[ny/CELL][nx/CELL]==20 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE)
|
||||
if(bmap[ny/CELL][nx/CELL]==20 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -247,6 +247,8 @@ inline int create_part(int p, int x, int y, int t)
|
||||
parts[i].life = rand()%120+240;
|
||||
if(t==PT_NBLE)
|
||||
parts[i].life = 0;
|
||||
if(t==PT_ICEI)
|
||||
parts[i].ctype = PT_WATR;
|
||||
if(t==PT_NEUT)
|
||||
{
|
||||
float r = (rand()%128+128)/127.0f;
|
||||
@ -526,6 +528,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
(bmap[y/CELL][x/CELL]==9) ||
|
||||
(bmap[y/CELL][x/CELL]==8 && ptypes[t].falldown!=2) ||
|
||||
(bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=1) ||
|
||||
(bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) ||
|
||||
(bmap[y/CELL][x/CELL]==4 && (t==PT_METL || t==PT_SPRK)) ||
|
||||
(bmap[y/CELL][x/CELL]==3 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM)))
|
||||
{
|
||||
@ -712,6 +715,8 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
int ctemp = pv[y/CELL][x/CELL]*2;
|
||||
c_heat = 0.0f;
|
||||
h_count = 0;
|
||||
if(t==PT_ICEI && !parts[i].ctype)
|
||||
parts[i].ctype = PT_WATR;
|
||||
if(ptypes[t].hconduct>(rand()%250))
|
||||
{
|
||||
for(nx=-1; nx<2; nx++)
|
||||
@ -833,11 +838,11 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
|
||||
}
|
||||
}
|
||||
if(t==PT_PTCT&&parts[i].temp>249.0f)
|
||||
if(t==PT_PTCT&&parts[i].temp>295.0f)
|
||||
{
|
||||
pt = parts[i].temp -= 2.5f;
|
||||
}
|
||||
if(t==PT_NTCT&&parts[i].temp>249.0f)
|
||||
if(t==PT_NTCT&&parts[i].temp>295.0f)
|
||||
{
|
||||
pt = parts[i].temp -= 2.5f;
|
||||
}
|
||||
|
14
powder.h
14
powder.h
@ -224,7 +224,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."},
|
||||
{"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."},
|
||||
{"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."},
|
||||
{"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f +273.15f, 70, "Liquid Nitrogen. Very cold."},
|
||||
{"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."},
|
||||
{"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."},
|
||||
{"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."},
|
||||
{"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+-16.0f+273.15f, 255, "White hole, pushes other particles away."},
|
||||
@ -235,10 +235,10 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"},
|
||||
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"},
|
||||
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."},
|
||||
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."},
|
||||
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f +273.15f, 115, "Plasma, extremely hot."},
|
||||
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."},
|
||||
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f, 115, "Plasma, extremely hot."},
|
||||
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"},
|
||||
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f +273.15f, 46, "Nitrogen Ice."},
|
||||
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."},
|
||||
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"},
|
||||
{"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."},
|
||||
{"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"},
|
||||
@ -247,7 +247,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"},
|
||||
{"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"},
|
||||
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."},
|
||||
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f +273.15f, 70, "Liquid Oxygen. Very cold. Reacts with fire"},
|
||||
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"},
|
||||
{"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."},
|
||||
{"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."},
|
||||
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."},
|
||||
@ -301,7 +301,7 @@ static part_state pstates[PT_NUM] =
|
||||
/* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f},
|
||||
/* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f},
|
||||
/* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f},
|
||||
/* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
@ -315,7 +315,7 @@ static part_state pstates[PT_NUM] =
|
||||
/* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 64.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
/* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f},
|
||||
/* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||
|
Loading…
x
Reference in New Issue
Block a user