updating
This commit is contained in:
parent
89b19bcbee
commit
a8439f221e
@ -8,9 +8,9 @@
|
||||
#endif
|
||||
|
||||
#define SAVE_VERSION 46
|
||||
#define MINOR_VERSION 1
|
||||
#define MINOR_VERSION 3
|
||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||
#define BETA
|
||||
//#define BETA
|
||||
|
||||
#define SERVER "powdertoy.co.uk"
|
||||
|
||||
@ -83,6 +83,10 @@ typedef unsigned int pixel;
|
||||
#define GLASS_IOR 1.9
|
||||
#define GLASS_DISP 0.07
|
||||
|
||||
#ifdef WIN32
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint8;
|
||||
|
||||
extern int amd;
|
||||
|
@ -46,6 +46,7 @@ extern unsigned char fire_b[YRES/CELL][XRES/CELL];
|
||||
|
||||
extern unsigned int fire_alpha[CELL*3][CELL*3];
|
||||
extern pixel *fire_bg;
|
||||
extern pixel *pers_bg;
|
||||
|
||||
pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f);
|
||||
|
||||
|
@ -52,10 +52,9 @@ static menu_wall mwalls[] =
|
||||
#define SC_LIQUID 4
|
||||
#define SC_NUCLEAR 7
|
||||
#define SC_LIFE 9
|
||||
#define SC_LIFE2 10
|
||||
#define SC_CRACKER 12
|
||||
#define SC_CRACKER2 13
|
||||
#define SC_TOTAL 11
|
||||
#define SC_TOTAL 10
|
||||
|
||||
static menu_section msections[] =
|
||||
{
|
||||
@ -154,8 +153,6 @@ extern char search_expr[256];
|
||||
extern char *tag_names[TAG_MAX];
|
||||
extern int tag_votes[TAG_MAX];
|
||||
|
||||
extern int Z_keysym;
|
||||
|
||||
extern int zoom_en;
|
||||
extern int zoom_x, zoom_y;
|
||||
extern int zoom_wx, zoom_wy;
|
||||
|
@ -511,11 +511,11 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
|
||||
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
};
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
#include <element.h>
|
||||
|
||||
int update_BCLN(UPDATE_FUNC_ARGS) {
|
||||
if (!parts[i].life)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL]>4.0f)
|
||||
if (!parts[i].life && pv[y/CELL][x/CELL]>4.0f)
|
||||
parts[i].life = rand()%40+80;
|
||||
if (parts[i].life)
|
||||
{
|
||||
float advection = 0.1f;
|
||||
parts[i].vx += advection*vx[y/CELL][x/CELL];
|
||||
parts[i].vy += advection*vy[y/CELL][x/CELL];
|
||||
parts[i].life = rand()%40+80;
|
||||
}
|
||||
}
|
||||
if (!parts[i].ctype)
|
||||
{
|
||||
|
@ -1,15 +1,13 @@
|
||||
#include <element.h>
|
||||
|
||||
int update_GOO(UPDATE_FUNC_ARGS) {
|
||||
if (!parts[i].life)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL]>1.0f)
|
||||
if (!parts[i].life && pv[y/CELL][x/CELL]>1.0f)
|
||||
parts[i].life = rand()%80+300;
|
||||
if (parts[i].life)
|
||||
{
|
||||
float advection = 0.1f;
|
||||
parts[i].vx += advection*vx[y/CELL][x/CELL];
|
||||
parts[i].vy += advection*vy[y/CELL][x/CELL];
|
||||
parts[i].life = rand()%80+300;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ unsigned char fire_b[YRES/CELL][XRES/CELL];
|
||||
|
||||
unsigned int fire_alpha[CELL*3][CELL*3];
|
||||
pixel *fire_bg;
|
||||
pixel *pers_bg;
|
||||
|
||||
pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f)
|
||||
{
|
||||
@ -447,6 +448,8 @@ 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 (x > XRES-26 || x < 0)
|
||||
return 26;
|
||||
if (b>=UI_WALLSTART)
|
||||
{
|
||||
b = b-100;
|
||||
@ -2961,23 +2964,9 @@ void render_signs(pixel *vid_buf)
|
||||
}
|
||||
drawtext(vid_buf, x+3, y+3, buff, 0, 191, 255, 255);
|
||||
}
|
||||
if(sregexp(signs[i].text, "^{e:.*|.*}$")==0)
|
||||
{
|
||||
int sldr, startm;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
for(sldr=3; signs[i].text[sldr-1] != '|'; sldr++)
|
||||
startm = sldr + 1;
|
||||
sldr = startm;
|
||||
while(signs[i].text[sldr] != '}')
|
||||
{
|
||||
buff[sldr - startm] = signs[i].text[sldr];
|
||||
sldr++;
|
||||
}
|
||||
drawtext(vid_buf, x+3, y+3, buff, 0, 255, 215, 255);
|
||||
}
|
||||
|
||||
//Usual text
|
||||
if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$") && sregexp(signs[i].text, "^{e:.*|.*}$"))
|
||||
if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
|
||||
drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255);
|
||||
|
||||
x = signs[i].x;
|
||||
|
@ -60,8 +60,6 @@ char search_expr[256] = "";
|
||||
char *tag_names[TAG_MAX];
|
||||
int tag_votes[TAG_MAX];
|
||||
|
||||
int Z_keysym = 'z';
|
||||
|
||||
int zoom_en = 0;
|
||||
int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2;
|
||||
int zoom_wx=0, zoom_wy=0;
|
||||
@ -105,25 +103,9 @@ void get_sign_pos(int i, int *x0, int *y0, int *w, int *h)
|
||||
}
|
||||
*w = textwidth(buff) + 5;
|
||||
}
|
||||
if(sregexp(signs[i].text, "^{e:.*|.*}$")==0)//character width limit in signs need to be incresed, as most commands don't fit..
|
||||
{
|
||||
int sldr, startm;
|
||||
char buff[256];
|
||||
memset(buff, 0, sizeof(buff));
|
||||
for(sldr=3; signs[i].text[sldr-1] != '|'; sldr++)
|
||||
startm = sldr + 1;
|
||||
|
||||
sldr = startm;
|
||||
while(signs[i].text[sldr] != '}')
|
||||
{
|
||||
buff[sldr - startm] = signs[i].text[sldr];
|
||||
sldr++;
|
||||
}
|
||||
*w = textwidth(buff) + 5;
|
||||
}
|
||||
|
||||
//Ususal width
|
||||
if (strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$") && sregexp(signs[i].text, "^{e:.*|.*}$"))
|
||||
if (strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}") && sregexp(signs[i].text, "^{c:[0-9]*|.*}$"))
|
||||
*w = textwidth(signs[i].text) + 5;
|
||||
*h = 14;
|
||||
*x0 = (signs[i].ju == 2) ? signs[i].x - *w :
|
||||
@ -1549,13 +1531,14 @@ 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;
|
||||
int h,x,y,n=0,height,width,sy,rows=0,xoff=0,fwidth;
|
||||
SEC = SEC2;
|
||||
mx /= sdl_scale;
|
||||
my /= sdl_scale;
|
||||
rows = ceil((float)msections[i].itemcount/16.0f);
|
||||
height = (ceil((float)msections[i].itemcount/16.0f)*18);
|
||||
width = restrict_flt(msections[i].itemcount*31, 0, 16*31);
|
||||
fwidth = msections[i].itemcount*31;
|
||||
h = -1;
|
||||
x = XRES-BARSIZE-18;
|
||||
y = YRES+1;
|
||||
@ -1566,11 +1549,11 @@ 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 (x-18<=2)
|
||||
/*if (x-18<=2)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
}*/
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
@ -1603,11 +1586,11 @@ 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 (x-18<=0)
|
||||
/*if (x-18<=0)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
}*/
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
@ -1637,11 +1620,11 @@ 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 (x-18<=0)
|
||||
/*if (x-18<=0)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
}*/
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
@ -1670,37 +1653,36 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fwidth > XRES-BARSIZE){
|
||||
float overflow = fwidth-(XRES-BARSIZE), location = ((float)XRES-BARSIZE)/((float)(mx-(XRES-BARSIZE)));
|
||||
xoff = (int)(overflow / location);
|
||||
}
|
||||
for (n = 0; n<PT_NUM; n++)
|
||||
{
|
||||
if (ptypes[n].menusection==i&&ptypes[n].menu==1)
|
||||
{
|
||||
if (x-18<=0)
|
||||
x -= draw_tool_xy(vid_buf, x-xoff, y, n, ptypes[n].pcolors)+5;
|
||||
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && my>=y && my< y+15)
|
||||
{
|
||||
x = XRES-BARSIZE-18;
|
||||
y += 19;
|
||||
}
|
||||
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
|
||||
if (!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
|
||||
drawrect(vid_buf, x+30-xoff, 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)))
|
||||
if (!bq && mx>=x+32-xoff && mx<x+58-xoff && 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);
|
||||
drawrect(vid_buf, x+30-xoff, 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);
|
||||
drawrect(vid_buf, x+30-xoff, 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);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 255, 0, 0, 255);
|
||||
}
|
||||
else if (n==*sr)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||
drawrect(vid_buf, x+30-xoff, y-1, 29, 17, 0, 0, 255, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1779,10 +1761,9 @@ int sdl_poll(void)
|
||||
sdl_ascii=event.key.keysym.unicode;
|
||||
if (event.key.keysym.sym == SDLK_CAPSLOCK)
|
||||
sdl_caps = 1;
|
||||
if (event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z')
|
||||
if (event.key.keysym.sym=='z')
|
||||
{
|
||||
sdl_zoom_trig = 1;
|
||||
Z_keysym = event.key.keysym.sym;
|
||||
}
|
||||
if ( event.key.keysym.sym == SDLK_PLUS)
|
||||
{
|
||||
@ -1832,7 +1813,7 @@ int sdl_poll(void)
|
||||
case SDL_KEYUP:
|
||||
if (event.key.keysym.sym == SDLK_CAPSLOCK)
|
||||
sdl_caps = 0;
|
||||
if (event.key.keysym.sym == Z_keysym)
|
||||
if (event.key.keysym.sym == 'z')
|
||||
sdl_zoom_trig = 0;
|
||||
if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT)
|
||||
{
|
||||
@ -1908,6 +1889,7 @@ void set_cmode(int cm)
|
||||
else if (cmode==CM_PERS)
|
||||
{
|
||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
strcpy(itc_msg, "Persistent Display");
|
||||
}
|
||||
else if (cmode==CM_PRESS)
|
||||
@ -1941,6 +1923,7 @@ void set_cmode(int cm)
|
||||
{
|
||||
strcpy(itc_msg, "Velocity Display");
|
||||
}
|
||||
save_presets(0);
|
||||
}
|
||||
|
||||
char *download_ui(pixel *vid_buf, char *uri, int *len)
|
||||
@ -3857,7 +3840,7 @@ struct command_history {
|
||||
typedef struct command_history command_history;
|
||||
command_history *last_command = NULL;
|
||||
char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
|
||||
int mx,my,b,bq,cc,ci = -1;
|
||||
int mx,my,b,cc,ci = -1;
|
||||
command_history *currentcommand;
|
||||
ui_edit ed;
|
||||
ed.x = 15;
|
||||
@ -3873,7 +3856,6 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
//fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
|
||||
while (!sdl_poll())
|
||||
{
|
||||
bq = b;
|
||||
b = SDL_GetMouseState(&mx, &my);
|
||||
mx /= sdl_scale;
|
||||
my /= sdl_scale;
|
||||
@ -3968,6 +3950,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
}
|
||||
}
|
||||
}
|
||||
console_mode = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -4010,9 +3993,9 @@ int console_parse_coords(char *txt, int *x, int *y, char *err)
|
||||
}
|
||||
int console_parse_partref(char *txt, int *which, char *err)
|
||||
{
|
||||
int i = -1, nx, ny;
|
||||
strcpy(err,"");
|
||||
// TODO: use regex?
|
||||
int i = -1, nx, ny;
|
||||
if (strchr(txt,',') && console_parse_coords(txt, &nx, &ny, err))
|
||||
{
|
||||
i = pmap[ny][nx];
|
||||
|
162
src/main.c
162
src/main.c
@ -169,7 +169,8 @@ int FPSB = 0;
|
||||
int MSIGN =-1;
|
||||
//int CGOL = 0;
|
||||
//int GSPEED = 1;//causes my .exe to crash..
|
||||
int sound_enable;
|
||||
int sound_enable = 0;
|
||||
int file_script = 0;
|
||||
|
||||
sign signs[MAXSIGNS];
|
||||
|
||||
@ -444,7 +445,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
|
||||
c[0] = 0x50; //0x66;
|
||||
c[1] = 0x53; //0x75;
|
||||
c[2] = 0x76; //0x43;
|
||||
c[3] = legacy_enable|((sys_pause<<1)&0x02);
|
||||
c[3] = legacy_enable|((sys_pause<<1)&0x02)|((gravityMode<<2)&0x0C)|((airMode<<4)&0x70);
|
||||
c[4] = SAVE_VERSION;
|
||||
c[5] = CELL;
|
||||
c[6] = bw;
|
||||
@ -500,6 +501,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
if (!sys_pause) {
|
||||
sys_pause = (c[3]>>1)&0x01;
|
||||
}
|
||||
if(ver>=46 && replace) {
|
||||
gravityMode = ((c[3]>>2)&0x03);// | ((c[3]>>2)&0x01);
|
||||
airMode = ((c[3]>>4)&0x07);// | ((c[3]>>4)&0x02) | ((c[3]>>4)&0x01);
|
||||
}
|
||||
} else {
|
||||
if (c[3]==1||c[3]==0) {
|
||||
legacy_enable = c[3];
|
||||
@ -545,8 +550,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
|
||||
if (replace)
|
||||
{
|
||||
gravityMode = 1;
|
||||
airMode = 1;
|
||||
if(ver<46){
|
||||
gravityMode = 0;
|
||||
airMode = 0;
|
||||
}
|
||||
memset(bmap, 0, sizeof(bmap));
|
||||
memset(emap, 0, sizeof(emap));
|
||||
memset(signs, 0, sizeof(signs));
|
||||
@ -1174,7 +1181,7 @@ int main(int argc, char *argv[])
|
||||
#ifdef BETA
|
||||
int is_beta = 0;
|
||||
#endif
|
||||
char uitext[255] = "";
|
||||
char uitext[512] = "";
|
||||
char heattext[128] = "";
|
||||
char coordtext[13] = "";
|
||||
int currentTime = 0;
|
||||
@ -1182,7 +1189,6 @@ int main(int argc, char *argv[])
|
||||
int pastFPS = 0;
|
||||
int past = 0;
|
||||
pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
|
||||
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
||||
void *http_ver_check;
|
||||
void *http_session_check = NULL;
|
||||
char *ver_data=NULL, *check_data=NULL, *tmp;
|
||||
@ -1198,9 +1204,10 @@ int main(int argc, char *argv[])
|
||||
void *load_data=NULL;
|
||||
pixel *load_img=NULL;//, *fbi_img=NULL;
|
||||
int save_mode=0, save_x=0, save_y=0, save_w=0, save_h=0, copy_mode=0;
|
||||
SDL_AudioSpec fmt;
|
||||
int username_flash = 0, username_flash_t = 1;
|
||||
GSPEED = 1;
|
||||
|
||||
SDL_AudioSpec fmt;
|
||||
/* Set 16-bit stereo audio at 22Khz */
|
||||
fmt.freq = 22050;
|
||||
fmt.format = AUDIO_S16;
|
||||
@ -1208,16 +1215,7 @@ int main(int argc, char *argv[])
|
||||
fmt.samples = 512;
|
||||
fmt.callback = mixaudio;
|
||||
fmt.userdata = NULL;
|
||||
/* Open the audio device and start playing sound! */
|
||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||
}
|
||||
else
|
||||
{
|
||||
sound_enable = 1;
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
|
||||
#ifdef MT
|
||||
numCores = core_count();
|
||||
#endif
|
||||
@ -1242,6 +1240,7 @@ int main(int argc, char *argv[])
|
||||
parts[NPART-1].life = -1;
|
||||
pfree = 0;
|
||||
fire_bg=calloc(XRES*YRES, PIXELSIZE);
|
||||
pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
||||
memset(signs, 0, sizeof(signs));
|
||||
|
||||
//fbi_img = render_packed_rgb(fbi, FBI_W, FBI_H, FBI_CMP);
|
||||
@ -1266,9 +1265,27 @@ int main(int argc, char *argv[])
|
||||
else if (!strncmp(argv[i], "kiosk", 5))
|
||||
{
|
||||
kiosk_enable = 1;
|
||||
sdl_scale = 2;
|
||||
//sdl_scale = 2; //Removed because some displays cannot handle the resolution
|
||||
hud_enable = 0;
|
||||
}
|
||||
else if (!strncmp(argv[i], "sound", 5))
|
||||
{
|
||||
/* Open the audio device and start playing sound! */
|
||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||
}
|
||||
else
|
||||
{
|
||||
sound_enable = 1;
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
}
|
||||
else if (!strncmp(argv[i], "scripts", 5))
|
||||
{
|
||||
file_script = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
save_presets(0);
|
||||
@ -1385,7 +1402,6 @@ int main(int argc, char *argv[])
|
||||
check_data = http_async_req_stop(http_session_check, &http_s_ret, NULL);
|
||||
if(http_ret==200 && check_data)
|
||||
{
|
||||
printf("{%s}\n", check_data);
|
||||
if(!strncmp(check_data, "EXPIRED", 7))
|
||||
{
|
||||
//Session expired
|
||||
@ -1409,6 +1425,7 @@ int main(int argc, char *argv[])
|
||||
svf_own = 0;
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
error_ui(vid_buf, "Unable to log in", "Your account has been suspended, consider reading the rules.");
|
||||
}
|
||||
else if(!strncmp(check_data, "OK", 2))
|
||||
{
|
||||
@ -1426,7 +1443,6 @@ int main(int argc, char *argv[])
|
||||
svf_mod = 1;
|
||||
}
|
||||
}
|
||||
save_presets(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1440,9 +1456,26 @@ int main(int argc, char *argv[])
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
}
|
||||
save_presets(0);
|
||||
free(check_data);
|
||||
}
|
||||
http_session_check = NULL;
|
||||
} else {
|
||||
clearrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14);
|
||||
drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255);
|
||||
if(username_flash>30){
|
||||
username_flash_t = -1;
|
||||
username_flash = 30;
|
||||
} else if(username_flash<0) {
|
||||
username_flash_t = 1;
|
||||
username_flash = 0;
|
||||
}
|
||||
username_flash += username_flash_t;
|
||||
if (svf_login)
|
||||
drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 175-(username_flash*5));
|
||||
else
|
||||
drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[checking]", 255, 255, 255, 255);
|
||||
}
|
||||
do_s_check = (do_s_check+1) & 15;
|
||||
}
|
||||
@ -1691,10 +1724,10 @@ int main(int argc, char *argv[])
|
||||
default:
|
||||
gravityMode = 0;
|
||||
case 0:
|
||||
strcpy(itc_msg, "Gravity: Off");
|
||||
strcpy(itc_msg, "Gravity: Vertical");
|
||||
break;
|
||||
case 1:
|
||||
strcpy(itc_msg, "Gravity: Vertical");
|
||||
strcpy(itc_msg, "Gravity: Off");
|
||||
break;
|
||||
case 2:
|
||||
strcpy(itc_msg, "Gravity: Radial");
|
||||
@ -1702,11 +1735,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (sdl_key=='y')
|
||||
{
|
||||
++airMode;
|
||||
itc = 52;
|
||||
|
||||
switch (airMode)
|
||||
{
|
||||
default:
|
||||
@ -1729,7 +1762,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sdl_key=='t')
|
||||
VINE_MODE = !VINE_MODE;
|
||||
if (sdl_key==SDLK_SPACE)
|
||||
@ -1930,36 +1962,30 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (!((cr>>8)>=NPART || !cr))
|
||||
{
|
||||
#ifdef BETA
|
||||
if (DEBUG_MODE)
|
||||
{
|
||||
int tctype = parts[cr>>8].ctype;
|
||||
if (tctype>=PT_NUM)
|
||||
tctype = 0;
|
||||
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life, cr>>8);
|
||||
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||
} else
|
||||
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||
sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale);
|
||||
} else {
|
||||
#ifdef BETA
|
||||
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||
#else
|
||||
if (DEBUG_MODE)
|
||||
{
|
||||
int tctype = parts[cr>>8].ctype;
|
||||
if (tctype>=PT_NUM)
|
||||
tctype = 0;
|
||||
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,cr>>8);
|
||||
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||
} else {
|
||||
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]);
|
||||
}
|
||||
if (DEBUG_MODE)
|
||||
{
|
||||
sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
mx = x;
|
||||
my = y;
|
||||
if (update_flag)
|
||||
@ -2109,7 +2135,7 @@ int main(int argc, char *argv[])
|
||||
if (!sdl_zoom_trig && zoom_en==1)
|
||||
zoom_en = 0;
|
||||
|
||||
if (sdl_key==Z_keysym && zoom_en==2)
|
||||
if (sdl_key=='z' && zoom_en==2)
|
||||
zoom_en = 1;
|
||||
|
||||
if (load_mode)
|
||||
@ -2277,7 +2303,7 @@ int main(int argc, char *argv[])
|
||||
svf_name[0] = 0;
|
||||
svf_tags[0] = 0;
|
||||
svf_description[0] = 0;
|
||||
gravityMode = 1;
|
||||
gravityMode = 0;
|
||||
airMode = 0;
|
||||
death = death2 = 0;
|
||||
isplayer2 = 0;
|
||||
@ -2286,6 +2312,7 @@ int main(int argc, char *argv[])
|
||||
ISSPAWN2 = 0;
|
||||
|
||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
@ -2293,8 +2320,10 @@ int main(int argc, char *argv[])
|
||||
if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476)))
|
||||
{
|
||||
login_ui(vid_buf);
|
||||
if (svf_login)
|
||||
if (svf_login){
|
||||
save_presets(0);
|
||||
http_session_check = NULL;
|
||||
}
|
||||
}
|
||||
if (x>=37 && x<=187 && svf_login)
|
||||
{
|
||||
@ -2314,6 +2343,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
search_ui(vid_buf);
|
||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
@ -2335,7 +2365,6 @@ int main(int argc, char *argv[])
|
||||
set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT);
|
||||
}
|
||||
}
|
||||
save_presets(0);
|
||||
}
|
||||
if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq)
|
||||
sys_pause = !sys_pause;
|
||||
@ -2353,7 +2382,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if(!bq)
|
||||
for(signi=0; signi<MAXSIGNS; signi++)
|
||||
{
|
||||
if(sregexp(signs[signi].text, "^{c:[0-9]*|.*}$")==0)
|
||||
{
|
||||
int signx, signy, signw, signh;
|
||||
@ -2368,31 +2396,8 @@ int main(int argc, char *argv[])
|
||||
for(sldr=3; signs[signi].text[sldr] != '|'; sldr++)
|
||||
buff[sldr-3] = signs[signi].text[sldr];
|
||||
|
||||
char buff2[sldr-2]; //TODO: Fix this for Visual Studio
|
||||
memset(buff2, 0, sizeof(buff2));
|
||||
memcpy(&buff2, &buff, sldr-3);
|
||||
open_ui(vid_buf, buff2, 0);
|
||||
}
|
||||
}
|
||||
if(sregexp(signs[signi].text, "^{e:.*|.*}$")==0)
|
||||
{
|
||||
int signx, signy, signw, signh;
|
||||
get_sign_pos(signi, &signx, &signy, &signw, &signh);
|
||||
if(x>=signx && x<=signx+signw && y>=signy && y<=signy+signh)
|
||||
{
|
||||
char buff[256];
|
||||
int sldr;
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
for(sldr=3; signs[signi].text[sldr] != '|'; sldr++)
|
||||
buff[sldr-3] = signs[signi].text[sldr];
|
||||
|
||||
char buff2[sldr-2]; //TODO: Fix this for Visual Studio
|
||||
memset(buff2, 0, sizeof(buff2));
|
||||
memcpy(&buff2, &buff, sldr-3);
|
||||
process_command(vid_buf, buff2,console_error);
|
||||
}
|
||||
buff[sldr-3] = '\0';
|
||||
open_ui(vid_buf, buff, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2676,10 +2681,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#ifdef BETA
|
||||
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
|
||||
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d Generation:%d Gravity:%d Air:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS, GENERATION, gravityMode, airMode);
|
||||
#else
|
||||
if (DEBUG_MODE)
|
||||
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
|
||||
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d Gravity:%d Air:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS, GENERATION, gravityMode, airMode);
|
||||
else
|
||||
sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
|
||||
#endif
|
||||
@ -2772,21 +2777,22 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
|
||||
}
|
||||
else if(strcmp(console2, "file")==0 && console3)
|
||||
{
|
||||
if(file_script){
|
||||
FILE *f=fopen(console3, "r");
|
||||
if(f)
|
||||
{
|
||||
char fileread[5000];//TODO: make this change with file size
|
||||
char pch[5000];
|
||||
char tokens[10];
|
||||
int tokensize;
|
||||
nx = 0;
|
||||
ny = 0;
|
||||
j = 0;
|
||||
m = 0;
|
||||
if(console4)
|
||||
console_parse_coords(console4, &nx , &ny, console_error);
|
||||
char fileread[5000];//TODO: make this change with file size
|
||||
char pch[5000];
|
||||
memset(pch,0,sizeof(pch));
|
||||
memset(fileread,0,sizeof(fileread));
|
||||
char tokens[10];
|
||||
int tokensize;
|
||||
fread(fileread,1,5000,f);
|
||||
for(i=0; i<strlen(fileread); i++)
|
||||
{
|
||||
@ -2849,8 +2855,16 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(console_error, "%s does not exist", console3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(console_error, "Scripts are not enabled");
|
||||
}
|
||||
|
||||
}
|
||||
else if(strcmp(console2, "sound")==0 && console3)
|
||||
{
|
||||
if (sound_enable) play_sound(console3);
|
||||
|
42
src/powder.c
42
src/powder.c
@ -12,7 +12,7 @@ float player2[27];
|
||||
particle *parts;
|
||||
particle *cb_parts;
|
||||
|
||||
int gravityMode = 1; // starts enabled in "vertical" mode...
|
||||
int gravityMode = 0; // starts enabled in "vertical" mode...
|
||||
int airMode = 0;
|
||||
|
||||
|
||||
@ -253,6 +253,7 @@ int try_move(int i, int x, int y, int nx, int ny)
|
||||
if (parts[e].type == PT_PHOT)
|
||||
return 1;
|
||||
|
||||
if ((pmap[ny][nx]>>8)==e) pmap[ny][nx] = 0;
|
||||
parts[e].x += x-nx;
|
||||
parts[e].y += y-ny;
|
||||
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type;
|
||||
@ -453,8 +454,8 @@ _inline void part_change_type(int i, int x, int y, int t)
|
||||
inline void part_change_type(int i, int x, int y, int t)
|
||||
#endif
|
||||
{
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
|
||||
return -1;
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART || t<0 || t>=PT_NUM)
|
||||
return;
|
||||
parts[i].type = t;
|
||||
if (t==PT_PHOT)// || t==PT_NEUT)
|
||||
{
|
||||
@ -484,7 +485,7 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t)
|
||||
if (n>680) {
|
||||
n = 680;
|
||||
}
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES)
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM)
|
||||
return -1;
|
||||
|
||||
for (c; c<n; c++) {
|
||||
@ -522,7 +523,7 @@ inline int create_part(int p, int x, int y, int t)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES)
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM))
|
||||
return -1;
|
||||
|
||||
if (t==SPC_HEAT||t==SPC_COOL)
|
||||
@ -1134,7 +1135,7 @@ int nearest_part(int ci, int t)
|
||||
|
||||
void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors;
|
||||
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors, createdsomething;
|
||||
float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl;
|
||||
int fin_x, fin_y, clear_x, clear_y;
|
||||
float fin_xf, fin_yf, clear_xf, clear_yf;
|
||||
@ -1337,14 +1338,14 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART)
|
||||
continue;
|
||||
for ( golnum = 1; golnum<=NGOL; golnum++)
|
||||
for ( goldelete = 0; goldelete<9; goldelete++)
|
||||
{
|
||||
if (neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2)
|
||||
goldelete = neighbors;
|
||||
if (gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2)
|
||||
{
|
||||
if (create_part(-1,nx,ny,goltype[golnum-1]))
|
||||
createdsomething = 1;
|
||||
}
|
||||
else if (neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself
|
||||
else if (gol[nx][ny]==golnum&&(grule[golnum][goldelete-1]==0||grule[golnum][goldelete-1]==2))//subtract 1 because it counted itself
|
||||
{
|
||||
if(parts[r>>8].tmp==grule[golnum][9]-1)
|
||||
parts[r>>8].tmp --;
|
||||
@ -1444,19 +1445,16 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = 0.0f;
|
||||
pGravY = ptypes[t].gravity;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
|
||||
|
||||
pGravX = ptypes[t].gravity * ((float)(x - XCNTR) / pGravD);
|
||||
pGravY = ptypes[t].gravity * ((float)(y - YCNTR) / pGravD);
|
||||
|
||||
}
|
||||
|
||||
parts[i].vx *= ptypes[t].loss;
|
||||
@ -1782,6 +1780,9 @@ killed:
|
||||
}
|
||||
}
|
||||
|
||||
rt = parts[i].flags & FLAG_STAGNANT;
|
||||
parts[i].flags &= ~FLAG_STAGNANT;
|
||||
|
||||
if ((t==PT_PHOT||t==PT_NEUT)) {
|
||||
if (t == PT_PHOT) {
|
||||
rt = pmap[fin_y][fin_x] & 0xFF;
|
||||
@ -2010,23 +2011,24 @@ killed:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (clear_x!=x&&clear_y!=y && try_move(i, x, y, clear_x, clear_y)) {
|
||||
else if ((clear_x!=x||clear_y!=y) && try_move(i, x, y, clear_x, clear_y)) {
|
||||
// if interpolation was done and haven't yet moved, try moving to last clear position
|
||||
parts[i].x = clear_xf;
|
||||
parts[i].y = clear_yf;
|
||||
}
|
||||
else
|
||||
parts[i].flags |= FLAG_STAGNANT;
|
||||
parts[i].vx *= ptypes[t].collision;
|
||||
parts[i].vy *= ptypes[t].collision;
|
||||
if (!s)
|
||||
parts[i].flags |= FLAG_STAGNANT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clear_x!=x&&clear_y!=y && try_move(i, x, y, clear_x, clear_y)) {
|
||||
if ((clear_x!=x||clear_y!=y) && try_move(i, x, y, clear_x, clear_y)) {
|
||||
// if interpolation was done, try moving to last clear position
|
||||
parts[i].x = clear_xf;
|
||||
parts[i].y = clear_yf;
|
||||
}
|
||||
else
|
||||
parts[i].flags |= FLAG_STAGNANT;
|
||||
parts[i].vx *= ptypes[t].collision;
|
||||
parts[i].vy *= ptypes[t].collision;
|
||||
@ -2710,7 +2712,7 @@ void create_box(int x1, int y1, int x2, int y2, int c)
|
||||
}
|
||||
for (j=y1; j<=y2; j++)
|
||||
for (i=x1; i<=x2; i++)
|
||||
create_parts(i, j, 1, 1, c);
|
||||
create_parts(i, j, 0, 0, c);
|
||||
}
|
||||
|
||||
int flood_parts(int x, int y, int c, int cm, int bm)
|
||||
|
Reference in New Issue
Block a user