Merge branch 'upstream' into dev
Conflicts: src/main.c
This commit is contained in:
commit
ded7bdf30d
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
|
||||
#define SAVE_VERSION 46
|
||||
#define MINOR_VERSION 3
|
||||
#define MINOR_VERSION 4
|
||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||
//#define BETA
|
||||
|
||||
|
@ -196,7 +196,8 @@
|
||||
#define PT_STAR 144
|
||||
#define PT_FROG 145
|
||||
#define PT_BRAN 146
|
||||
#define PT_NUM 147
|
||||
#define PT_WIND 147
|
||||
#define PT_NUM 148
|
||||
|
||||
#define R_TEMP 22
|
||||
#define MAX_TEMP 9999
|
||||
@ -435,9 +436,9 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", ST_SOLID, TYPE_PART, &update_YEST},
|
||||
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", ST_SOLID, TYPE_PART, NULL},
|
||||
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM},
|
||||
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
|
||||
{"GLOW", PIXPACK(0x445464), 0.3f, 0.02f * CFDS, 0.98f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
|
||||
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL},
|
||||
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
|
||||
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
|
||||
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},
|
||||
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE},
|
||||
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP},
|
||||
@ -516,6 +517,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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},
|
||||
{"WIND", PIXPACK(0x000000), 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_SPECIAL, 0.0f, 40, "Drag tool", ST_NONE, ST_NONE, NULL},
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
};
|
||||
|
||||
@ -678,6 +680,7 @@ static part_transition ptransitions[PT_NUM] =
|
||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
};
|
||||
#undef IPL
|
||||
#undef IPH
|
||||
|
@ -16,6 +16,10 @@ int update_GLOW(UPDATE_FUNC_ARGS) {
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
parts[i].ctype = pv[y/CELL][x/CELL]*16;
|
||||
|
||||
parts[i].tmp = abs((int)((vx[y/CELL][x/CELL]+vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
|
||||
//printf("%f %f\n", parts[i].vx, parts[i].vy);
|
||||
if (parts[i].type==PT_NONE) {
|
||||
kill_part(i);
|
||||
return 1;
|
||||
|
@ -2370,15 +2370,15 @@ void draw_parts(pixel *vid)
|
||||
}
|
||||
else if (t==PT_GLOW)
|
||||
{
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fr = 0;
|
||||
if (pv[ny/CELL][nx/CELL]>0) {
|
||||
fg = 6 * pv[ny/CELL][nx/CELL];
|
||||
fb = 4 * pv[ny/CELL][nx/CELL];
|
||||
fr = 2 * pv[ny/CELL][nx/CELL];
|
||||
}
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255));
|
||||
fr = restrict_flt(parts[i].temp-(275.13f+32.0f), 0, 128)/50.0f;
|
||||
fg = restrict_flt(parts[i].ctype, 0, 128)/50.0f;
|
||||
fb = restrict_flt(parts[i].tmp, 0, 128)/50.0f;
|
||||
|
||||
cr = restrict_flt(64.0f+parts[i].temp-(275.13f+32.0f), 0, 255);
|
||||
cg = restrict_flt(64.0f+parts[i].ctype, 0, 255);
|
||||
cb = restrict_flt(64.0f+parts[i].tmp, 0, 255);
|
||||
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
|
||||
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
|
||||
{
|
||||
x = nx/CELL;
|
||||
@ -2394,19 +2394,15 @@ void draw_parts(pixel *vid)
|
||||
fire_r[y][x] = fr;
|
||||
}
|
||||
if (cmode == CM_BLOB) {
|
||||
uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255);
|
||||
uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255);
|
||||
uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255);
|
||||
blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
|
||||
blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
|
||||
blendpixel(vid, nx, ny+1, cr, cg, cb, 223);
|
||||
blendpixel(vid, nx, ny-1, cr, cg, cb, 223);
|
||||
|
||||
blendpixel(vid, nx+1, ny, R, G, B, 223);
|
||||
blendpixel(vid, nx-1, ny, R, G, B, 223);
|
||||
blendpixel(vid, nx, ny+1, R, G, B, 223);
|
||||
blendpixel(vid, nx, ny-1, R, G, B, 223);
|
||||
|
||||
blendpixel(vid, nx+1, ny-1, R, G, B, 112);
|
||||
blendpixel(vid, nx-1, ny-1, R, G, B, 112);
|
||||
blendpixel(vid, nx+1, ny+1, R, G, B, 112);
|
||||
blendpixel(vid, nx-1, ny+1, R, G, B, 112);
|
||||
blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112);
|
||||
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112);
|
||||
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
|
||||
blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
|
||||
}
|
||||
}
|
||||
else if (t==PT_LCRY)
|
||||
|
@ -3841,10 +3841,11 @@ 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,cc,ci = -1;
|
||||
pixel *old_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
|
||||
command_history *currentcommand;
|
||||
ui_edit ed;
|
||||
ed.x = 15;
|
||||
ed.y = 210;
|
||||
ed.y = 207;
|
||||
ed.w = XRES;
|
||||
ed.nx = 1;
|
||||
ed.def = "";
|
||||
@ -3854,6 +3855,13 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
ed.multiline = 0;
|
||||
ed.cursor = 0;
|
||||
//fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
|
||||
memcpy(old_buf,vid_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
fillrect(old_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
|
||||
cc = 0;
|
||||
while(cc < 80){
|
||||
fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2));
|
||||
cc++;
|
||||
}
|
||||
while (!sdl_poll())
|
||||
{
|
||||
b = SDL_GetMouseState(&mx, &my);
|
||||
@ -3861,21 +3869,12 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
my /= sdl_scale;
|
||||
ed.focus = 1;
|
||||
|
||||
clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
|
||||
draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE);
|
||||
drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.2 (by cracker64)\n"
|
||||
"Current commands are quit, set, reset, load, create, file, kill, sound\n"
|
||||
"You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n"
|
||||
"You can also use 'all' instead of a particle number to do it to everything.\n"
|
||||
"You can now use particle names (ex. set type all deut)\n"
|
||||
"Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n"
|
||||
"To load a save use load saveID (ex. load 1337)\n"
|
||||
"Create particles with 'create deut x,y' where x and y are the coords\n"
|
||||
"Run scripts from file 'file filename'\n"
|
||||
"You can delete/kill a particle with 'kill x,y'"
|
||||
"Play a sound with (sound blah.wav)"
|
||||
,255, 187, 187, 255);
|
||||
|
||||
memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
draw_line(vid_buf, 0, 219, XRES+BARSIZE-1, 219, 228, 228, 228, XRES+BARSIZE);
|
||||
drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64)\n"
|
||||
"Current commands are quit, set, reset, load, create, file, kill, sound\n" //TODO: help command
|
||||
,255, 255, 255, 255);
|
||||
|
||||
cc = 0;
|
||||
currentcommand = last_command;
|
||||
while(cc < 10)
|
||||
@ -3899,8 +3898,11 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
}
|
||||
}
|
||||
|
||||
if(error)
|
||||
drawtext(vid_buf, 15, 190, error,255, 187, 187, 255);
|
||||
if(error && ed.str[0]=='\0')
|
||||
drawtext(vid_buf, 20, 207, error, 255, 127, 127, 200);
|
||||
|
||||
drawtext(vid_buf, 5, 207, ">", 255, 255, 255, 240);
|
||||
|
||||
ui_edit_draw(vid_buf, &ed);
|
||||
ui_edit_process(mx, my, b, &ed);
|
||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||
@ -3911,11 +3913,13 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
currentcommand->prev_command = last_command;
|
||||
currentcommand->command = mystrdup(ed.str);
|
||||
last_command = currentcommand;
|
||||
free(old_buf);
|
||||
return currentcommand->command;
|
||||
}
|
||||
if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE)
|
||||
{
|
||||
console_mode = 0;
|
||||
free(old_buf);
|
||||
return NULL;
|
||||
}
|
||||
if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN)
|
||||
@ -3951,6 +3955,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
}
|
||||
}
|
||||
console_mode = 0;
|
||||
free(old_buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
69
src/main.c
69
src/main.c
@ -118,7 +118,7 @@ void play_sound(char *file)
|
||||
}
|
||||
|
||||
static const char *it_msg =
|
||||
"\brThe Powder Toy - http://powdertoy.co.uk/\n"
|
||||
"\brThe Powder Toy - http://powdertoy.co.uk, irc.freenode.net #powder\n"
|
||||
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
|
||||
"\n"
|
||||
"\bgControl+C/V/X are Copy, Paste and cut respectively.\n"
|
||||
@ -138,12 +138,8 @@ static const char *it_msg =
|
||||
"The spacebar can be used to pause physics.\n"
|
||||
"'P' will take a screenshot and save it into the current directory.\n"
|
||||
"\n"
|
||||
"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
|
||||
"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n"
|
||||
"\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n"
|
||||
"\bgCopyright (c) 2010 cracker64\n"
|
||||
"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n"
|
||||
"\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n"
|
||||
"\bgCopyright (c) 2008-11 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
|
||||
"\bgCopyright (c) 2010-11 Simon Robertshaw, Skresanov Savely, cracker64, Bryan Hoyle, Nathan Cousins, jacksonmj\n"
|
||||
"\n"
|
||||
"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html"
|
||||
;
|
||||
@ -1193,7 +1189,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
char uitext[512] = "";
|
||||
char heattext[128] = "";
|
||||
char coordtext[13] = "";
|
||||
char coordtext[128] = "";
|
||||
int currentTime = 0;
|
||||
int FPS = 0;
|
||||
int pastFPS = 0;
|
||||
@ -1691,7 +1687,7 @@ int main(int argc, char *argv[])
|
||||
if (sdl_key==SDLK_BACKQUOTE)
|
||||
{
|
||||
console_mode = !console_mode;
|
||||
hud_enable = !console_mode;
|
||||
//hud_enable = !console_mode;
|
||||
}
|
||||
if (sdl_key=='g')
|
||||
{
|
||||
@ -1920,23 +1916,6 @@ int main(int argc, char *argv[])
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if(console_mode)
|
||||
{
|
||||
char *console;
|
||||
//char error[255] = "error!";
|
||||
sys_pause = 1;
|
||||
console = console_ui(vid_buf,console_error);
|
||||
console = mystrdup(console);
|
||||
strcpy(console_error,"");
|
||||
if(process_command(vid_buf,console,console_error)==-1)
|
||||
{
|
||||
free(console);
|
||||
break;
|
||||
}
|
||||
free(console);
|
||||
if(!console_mode)
|
||||
hud_enable = 1;
|
||||
}
|
||||
|
||||
bq = b;
|
||||
b = SDL_GetMouseState(&x, &y);
|
||||
@ -1996,6 +1975,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mx = x;
|
||||
my = y;
|
||||
if (update_flag)
|
||||
@ -2425,7 +2405,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
create_line(lx, ly, x, y, bsx, bsy, c);
|
||||
if (c == PT_WIND)
|
||||
{
|
||||
for (j=-bsy; j<=bsy; j++)
|
||||
for (i=-bsx; i<=bsx; i++)
|
||||
if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx))
|
||||
{
|
||||
vx[(y+j)/CELL][(x+i)/CELL] += (x-lx)*0.01f;
|
||||
vy[(y+j)/CELL][(x+i)/CELL] += (y-ly)*0.01f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
create_line(lx, ly, x, y, bsx, bsy, c);
|
||||
}
|
||||
lx = x;
|
||||
ly = y;
|
||||
}
|
||||
@ -2450,7 +2443,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (sdl_mod & (KMOD_CAPS))
|
||||
c = 0;
|
||||
if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
|
||||
if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&c!=PT_WIND&&!REPLACE_MODE)
|
||||
flood_parts(x, y, c, -1, -1);
|
||||
if (c==SPC_HEAT || c==SPC_COOL)
|
||||
create_parts(x, y, bsx, bsy, c);
|
||||
@ -2723,7 +2716,27 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140);
|
||||
drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200);
|
||||
|
||||
}
|
||||
|
||||
if(console_mode)
|
||||
{
|
||||
char *console;
|
||||
//char error[255] = "error!";
|
||||
sys_pause = 1;
|
||||
console = console_ui(vid_buf,console_error);
|
||||
console = mystrdup(console);
|
||||
strcpy(console_error,"");
|
||||
if(process_command(vid_buf,console,console_error)==-1)
|
||||
{
|
||||
free(console);
|
||||
break;
|
||||
}
|
||||
free(console);
|
||||
if(!console_mode)
|
||||
hud_enable = 1;
|
||||
}
|
||||
|
||||
sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE);
|
||||
|
||||
//Setting an element for the stick man
|
||||
|
16
src/powder.c
16
src/powder.c
@ -1320,8 +1320,12 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
for ( nnx=-1; nnx<2; nnx++)
|
||||
for ( nny=-1; nny<2; nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check
|
||||
{
|
||||
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][golnum] ++;
|
||||
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++;
|
||||
rt = pmap[((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL];
|
||||
if (!rt || ptypes[rt&0xFF].properties&PROP_LIFE)
|
||||
{
|
||||
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][golnum] ++;
|
||||
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parts[r>>8].tmp --;
|
||||
@ -1353,10 +1357,12 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
if (r && parts[r>>8].tmp<=0)
|
||||
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
|
||||
}
|
||||
for( z = 0;z<=NGOL;z++)
|
||||
gol2[nx][ny][z] = 0;//this improves performance A LOT compared to the memset, i was getting ~23 more fps with this.
|
||||
}
|
||||
if (createdsomething)
|
||||
GENERATION ++;
|
||||
memset(gol2, 0, sizeof(gol2));
|
||||
//memset(gol2, 0, sizeof(gol2));
|
||||
}
|
||||
if (ISWIRE==1)
|
||||
{
|
||||
@ -2858,6 +2864,10 @@ int create_parts(int x, int y, int rx, int ry, int c)
|
||||
b = WL_FANHELPER;
|
||||
dw = 1;
|
||||
}
|
||||
if (c == PT_WIND)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (dw==1)
|
||||
{
|
||||
rx = rx/CELL;
|
||||
|
Loading…
Reference in New Issue
Block a user