From 164681f4e65904ae6996dc67aaad30e1d590f3a1 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 17:55:14 -0500 Subject: [PATCH 01/16] GoL speed improvements from jacksonmj (thank you very much) --- src/powder.c | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/src/powder.c b/src/powder.c index b999b3690..ab546807c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1236,8 +1236,8 @@ void update_particles_i(pixel *vid, int start, int inc) if(ISGOL==1&&CGOL>=GSPEED)//GSPEED is frames per generation { int createdsomething = 0; - for(nx=4;nx=XRES-4){ - gol2[4][YRES-5][golnum] ++; - gol2[4][YRES-5][0] ++; - } - else if(ny+nny>=YRES-4&&nx+nnx<4){ - gol2[XRES-5][4][golnum] ++; - gol2[XRES-5][4][0] ++; - } - else if(nx+nnx<4){ - gol2[XRES-5][ny+nny][golnum] ++; - gol2[XRES-5][ny+nny][0] ++; - } - else if(ny+nny<4){ - gol2[nx+nnx][YRES-5][golnum] ++; - gol2[nx+nnx][YRES-5][0] ++; - } - else if(ny+nny>=YRES-4&&nx+nnx>=XRES-4){ - gol2[4][4][golnum] ++; - gol2[4][4][0] ++; - } - else if(ny+nny>=YRES-4){ - gol2[nx+nnx][4][golnum] ++; - gol2[nx+nnx][4][0] ++; - } - else if(nx+nnx>=XRES-4){ - gol2[4][ny+nny][golnum] ++; - gol2[4][ny+nny][0] ++; - } - else{ - gol2[nx+nnx][ny+nny][golnum] ++; - gol2[nx+nnx][ny+nny][0] ++; - } + 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] ++; } } } - for(nx=4;nx Date: Sat, 8 Jan 2011 18:12:26 -0500 Subject: [PATCH 02/16] only add .15 to PUMP, so that things at absolute 0 load at 0. --- src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index f89eae1ab..c89f56f28 100644 --- a/src/main.c +++ b/src/main.c @@ -730,7 +730,11 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(new_format) { ttv = (d[p++])<<8; ttv |= (d[p++]); - parts[i-1].temp = ttv + 0.15; + if(parts[i-1].type==PT_PUMP) { + parts[i-1].temp = ttv + 0.15;//fix PUMP saved at 0, so that it loads at 0. + } else { + parts[i-1].temp = ttv; + } } else { parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; } From 6b06d37ca5adb5ce43642dad0df757921388c181 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 21:23:46 -0500 Subject: [PATCH 03/16] update with simon, and some other changes from jacksonmj. --- includes/defines.h | 6 +- includes/powder.h | 22 ++-- src/graphics.c | 37 ++++-- src/main.c | 9 ++ src/powder.c | 287 +++++++++++++++++++++++---------------------- 5 files changed, 196 insertions(+), 165 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index b2bec4e5b..9f12cb930 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,9 +8,9 @@ #endif #define SAVE_VERSION 45 -#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 +//#define BETA #define SERVER "powdertoy.co.uk" @@ -102,6 +102,8 @@ int GRAV_B2; extern int legacy_enable; +extern int kiosk_enable; + extern int sys_pause; extern int framerender; diff --git a/includes/powder.h b/includes/powder.h index 2d14f9c14..87e53f827 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -320,24 +320,24 @@ static const part_type ptypes[PT_NUM] = {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART | PROP_RADIOACTIVE, NULL}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures.", TYPE_SOLID, NULL}, {"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, 25, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax.", TYPE_LIQUID, NULL}, - {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor.", TYPE_SOLID, NULL}, - {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon.", TYPE_SOLID, NULL}, + {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor.", TYPE_SOLID | PROP_CONDUCTS, NULL}, + {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon.", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"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, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold.", TYPE_LIQUID, NULL}, {"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, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity.", TYPE_SOLID, NULL}, {"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, 100, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up.", TYPE_SOLID, NULL}, {"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, 100, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away.", TYPE_SOLID, NULL}, {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point", TYPE_SOLID|PROP_CONDUCTS, NULL}, {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", TYPE_LIQUID|PROP_CONDUCTS, NULL}, - {"NTCT", PIXPACK(0x505040), 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, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID, NULL}, + {"NTCT", PIXPACK(0x505040), 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, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", TYPE_PART, NULL}, {"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, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS | PROP_HOT_GLOW, NULL}, - {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID, NULL}, + {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"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, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", TYPE_PART | PROP_HOT_GLOW, NULL}, {"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, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY, NULL}, {"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, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot.", TYPE_GAS, NULL}, - {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", TYPE_SOLID, NULL}, + {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"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, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", TYPE_SOLID, NULL}, - {"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, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity", TYPE_GAS, NULL}, + {"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, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity", TYPE_GAS | PROP_CONDUCTS, NULL}, {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", TYPE_SOLID, NULL}, {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", TYPE_SOLID, NULL}, {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL}, @@ -347,7 +347,7 @@ static const part_type ptypes[PT_NUM] = {"COAL", PIXPACK(0x222222), 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.", TYPE_SOLID, NULL}, {"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, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire", TYPE_LIQUID, NULL}, {"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, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily.", TYPE_GAS, NULL}, - {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors.", TYPE_SOLID, NULL}, + {"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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors.", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"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).", TYPE_PART, NULL}, {"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.", 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 extremly high temperature.", TYPE_PART, NULL}, @@ -361,7 +361,7 @@ static const part_type ptypes[PT_NUM] = {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", TYPE_PART, NULL}, {"PCLN", PIXPACK(0x3B3B10), 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_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches.", TYPE_SOLID, NULL}, {"HSWC", PIXPACK(0x3B1010), 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, "Heat switch. Conducts Heat only when activated", TYPE_SOLID, NULL}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID, NULL}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID | PROP_CONDUCTS, NULL}, {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART, NULL}, {"GOL ", PIXPACK(0x0CAC00), 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, "Game Of Life! B3/S23", TYPE_SOLID|PROP_LIFE, NULL}, {"HLIF", 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, "High Life! B36/S23", TYPE_SOLID|PROP_LIFE, NULL}, @@ -391,14 +391,14 @@ static const part_type ptypes[PT_NUM] = {"BIZR", PIXPACK(0x00FF77), 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+0.0f +273.15f, 29, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID, NULL}, {"BIZG", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS, NULL}, {"BIZS", PIXPACK(0x00E455), 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_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID, NULL}, - {"INST", PIXPACK(0x404039), 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, "Instantly conducts, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS, NULL}, + {"INST", PIXPACK(0x404039), 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, "Instantly conducts, PSCN to charge, NSCN to take.", TYPE_SOLID, NULL}, {"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL}, {"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID, NULL}, {"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal IN. Things go in here, now with channels (same as WIFI)", TYPE_SOLID, NULL}, {"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal OUT. Things come out here, now with channels (same as WIFI)", TYPE_SOLID, NULL}, {"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, NULL}, {"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID, NULL}, - {"ANAR", PIXPACK(0xFFFFEE), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.1f, 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. Behaves opposite gravity", TYPE_PART, NULL}, + {"ANAR", PIXPACK(0xFFFFEE), -0.7f, -0.02f * CFDS, 0.96f, 0.80f, 0.1f, -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. Behaves opposite gravity", TYPE_PART, NULL}, {"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID, NULL}, {"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID | PROP_NEUTPASS, NULL}, {"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART, NULL}, @@ -417,7 +417,7 @@ static const part_type ptypes[PT_NUM] = {"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL}, {"C-5", PIXPACK(0x2050E0), 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_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", TYPE_SOLID | PROP_NEUTPENETRATE, NULL}, {"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", TYPE_PART, NULL}, - {"QRTZ", PIXPACK(0xAADDDD), 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_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID| PROP_HOT_GLOW, NULL}, + {"QRTZ", PIXPACK(0xAADDDD), 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_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID | PROP_CONDUCTS | PROP_HOT_GLOW, NULL}, {"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", TYPE_PART| PROP_HOT_GLOW, NULL}, {"SEED", PIXPACK(0xFBEC7D), 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, "B2/S", TYPE_SOLID|PROP_LIFE, NULL}, {"MAZE", PIXPACK(0xA8E4A0), 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, "B3/S12345", TYPE_SOLID|PROP_LIFE, NULL}, diff --git a/src/graphics.c b/src/graphics.c index e4a4a4cc4..b0d532d7f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1478,7 +1478,12 @@ void draw_parts(pixel *vid) cb = 0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if(cmode==CM_FANCY) + else if(cmode==CM_FANCY && + t!=PT_FIRE && t!=PT_PLSM && t!=PT_WTRV && + t!=PT_HFLM && t!=PT_SPRK && t!=PT_FIRW && + t!=PT_DUST && t!=PT_FIRW && t!=PT_FWRK && + t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB && + t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE) { if(ptypes[parts[i].type].properties&TYPE_LIQUID) { @@ -1934,13 +1939,21 @@ void draw_parts(pixel *vid) } else if(t==PT_ACID) { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); + if(parts[i].life>75) parts[i].life = 75; + if(parts[i].life<49) parts[i].life = 49; + s = (parts[i].life-49)*3; if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; + cr = 0x86 + s*4; + cg = 0x36 + s*1; + cb = 0x90 + s*2; + + if(cr>=255) + cr = 255; + if(cg>=255) + cg = 255; + if(cb>=255) + cb = 255; + blendpixel(vid, nx, ny, cr, cg, cb, 255); if(cmode==CM_BLOB) @@ -3373,9 +3386,15 @@ void sdl_open(void) //glFlush (); #else #ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); + if(kiosk_enable) + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_FULLSCREEN|SDL_SWSURFACE); + else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); #else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); + if(kiosk_enable) + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_FULLSCREEN|SDL_SWSURFACE); + else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); #endif #endif if(!sdl_scrn) diff --git a/src/main.c b/src/main.c index c89f56f28..97e73829c 100644 --- a/src/main.c +++ b/src/main.c @@ -134,6 +134,7 @@ int core_count() } int mousex = 0, mousey = 0; //They contain mouse position +int kiosk_enable = 0; void sdl_seticon(void) { @@ -1161,6 +1162,12 @@ int main(int argc, char *argv[]) else if(!strncmp(argv[i], "nohud", 5)) { hud_enable = 0; + } + else if(!strncmp(argv[i], "kiosk", 5)) + { + kiosk_enable = 1; + sdl_scale = 2; + hud_enable = 0; } } @@ -2202,6 +2209,8 @@ int main(int argc, char *argv[]) c = 0; if(c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE) flood_parts(x, y, c, -1, -1); + if(c==SPC_HEAT || c==SPC_COOL) + create_parts(x, y, bsx, bsy, c); lx = x; ly = y; lb = 0; diff --git a/src/powder.c b/src/powder.c index ab546807c..0b4373957 100644 --- a/src/powder.c +++ b/src/powder.c @@ -485,17 +485,23 @@ inline int create_part(int p, int x, int y, int t) { if(t==SPC_HEAT&&parts[pmap[y][x]>>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 0.1f, MIN_TEMP, MAX_TEMP); - else - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + if((pmap[y][x]&0xFF)==PT_PUMP) { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 0.1f, MIN_TEMP, MAX_TEMP); + } else if((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 50.0f, MIN_TEMP, MAX_TEMP); + } else { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } } if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) { - if((pmap[y][x]&0xFF)==PT_PUMP) - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 0.1f, MIN_TEMP, MAX_TEMP); - else - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + if((pmap[y][x]&0xFF)==PT_PUMP) { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 0.1f, MIN_TEMP, MAX_TEMP); + } else if((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 50.0f, MIN_TEMP, MAX_TEMP); + } else { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } } return pmap[y][x]>>8; } @@ -1236,11 +1242,11 @@ void update_particles_i(pixel *vid, int start, int inc) if(ISGOL==1&&CGOL>=GSPEED)//GSPEED is frames per generation { int createdsomething = 0; + CGOL=0; + ISGOL=0; for(nx=CELL;nx>8)>=NPART || !r) { @@ -1317,7 +1323,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--; - 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_QRTZ && 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 && !(ptypes[t].properties&PROP_CONDUCTS) && t!=PT_ARAY && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_SPRK && t!=PT_LAVA && t!=PT_LCRY && t!=PT_QRTZ && 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); continue; @@ -1365,18 +1371,9 @@ void update_particles_i(pixel *vid, int start, int inc) continue; } - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - if(t==PT_ANAR) - { - vx[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vy; - } - else - { - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - } + vx[y/CELL][x/CELL] = vx[y/CELL][x/CELL]*ptypes[t].airloss + ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] = vy[y/CELL][x/CELL]*ptypes[t].airloss + ptypes[t].airdrag*parts[i].vy; + if(t==PT_GAS||t==PT_NBLE) { if(pv[y/CELL][x/CELL]<3.5f) @@ -1517,16 +1514,8 @@ void update_particles_i(pixel *vid, int start, int inc) } - if(t==PT_ANAR) - { - parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; - parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; - } - else{ - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; - - } + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; } if(ptypes[t].diffusion) @@ -1735,110 +1724,122 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - if(parts[i].ctype==PT_THRM) - { - parts[i].tmp = 0; - parts[i].ctype = PT_BMTL; - } - if(parts[i].ctype==PT_PLUT) - { - parts[i].tmp = 0; - parts[i].ctype = PT_LAVA; - } - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_PQRT)?PT_QRTZ:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - if((t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)&&pt>=pstates[t].gtemp) - { - t = parts[i].type = pstates[t].gas; - } - else{ - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - } - - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_HFLM) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = 3500; - } - if(parts[i].ctype==PT_PLUT&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = MAX_TEMP; - } - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } + if(y-2 >= 0 && y-2 < YRES && ptypes[t].properties&TYPE_LIQUID){ + float swappage; + r = pmap[y-2][x]; + if(!((r>>8)>=NPART || !r || parts[i].type != (r&0xFF))){ + if(parts[i].temp>parts[r>>8].temp){ + swappage = parts[i].temp; + parts[i].temp = parts[r>>8].temp; + parts[r>>8].temp = swappage; + } + } + } + + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + if(parts[i].ctype==PT_THRM) + { + parts[i].tmp = 0; + parts[i].ctype = PT_BMTL; + } + if(parts[i].ctype==PT_PLUT) + { + parts[i].tmp = 0; + parts[i].ctype = PT_LAVA; + } + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_PQRT)?PT_QRTZ:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + if((t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)&&pt>=pstates[t].gtemp) + { + t = parts[i].type = pstates[t].gas; + } + else{ + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + } + + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_HFLM) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = 3500; + } + if(parts[i].ctype==PT_PLUT&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = MAX_TEMP; + } + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } } if(t==PT_PTCT&&parts[i].temp>295.0f) { @@ -1849,7 +1850,7 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp -= 2.5f; } - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_IRON || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + if((ptypes[t].properties&PROP_CONDUCTS) || t==PT_SPRK) { nx = x % CELL; if(nx == 0) @@ -1867,7 +1868,7 @@ void update_particles_i(pixel *vid, int start, int inc) ny = y/CELL; if(nx>=0 && ny>=0 && nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK) + if((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0 && !((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && parts[r>>8].ctype!=PT_SPRK) { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -2488,7 +2489,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_NONE; } } - else if (parts[i].life==50) + else if (parts[i].life<=50) { parts[i].life = 0; t = parts[i].type = PT_NONE; @@ -3810,7 +3811,7 @@ void update_particles_i(pixel *vid, int start, int inc) rt = parts[r>>8].type; if(parts_avg(i,r>>8,PT_INSL) != PT_INSL) { - if((rt==PT_METL||rt==PT_IRON||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + if((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { parts[r>>8].life = 4; parts[r>>8].ctype = rt; @@ -3976,7 +3977,7 @@ void update_particles_i(pixel *vid, int start, int inc) pavg = parts_avg(i, r>>8,PT_INSL); if(pavg != PT_INSL) { - if(t==PT_SPRK && (rt==PT_METL||rt==PT_IRON||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + if(t==PT_SPRK && (ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN))&&!(parts[i].ctype==PT_INST&&rt!=PT_NSCN) ) From d6837437f2eff9a2d020638646ba874a33580227 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sun, 9 Jan 2011 16:16:59 -0500 Subject: [PATCH 04/16] fix c-5 floodfill --- src/powder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index 0b4373957..440c0c297 100644 --- a/src/powder.c +++ b/src/powder.c @@ -5881,13 +5881,13 @@ void create_box(int x1, int y1, int x2, int y2, int c) int flood_parts(int x, int y, int c, int cm, int bm) { int x1, x2, dy = (c=UI_WALLSTART&&c<=UI_WALLSTART+UI_WALLCOUNT) { - c = c-100; + wall = c-100; } if(cm==-1) { @@ -5904,7 +5904,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) } if(bm==-1) { - if(c==WL_ERASE) + if(wall==WL_ERASE) { bm = bmap[y/CELL][x/CELL]; if(!bm) From f242566e30831963eee287b7dbe944b715457dae Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 10 Jan 2011 09:43:16 -0500 Subject: [PATCH 05/16] fix QRTZ spot saving, rotate should change FAN vector as well --- includes/defines.h | 2 +- src/graphics.c | 2 +- src/main.c | 2 +- src/powder.c | 23 +++++++++++++++++++---- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 9f12cb930..af414718a 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,7 +8,7 @@ #endif #define SAVE_VERSION 45 -#define MINOR_VERSION 1 +#define MINOR_VERSION 2 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. //#define BETA diff --git a/src/graphics.c b/src/graphics.c index b0d532d7f..ef8fb15eb 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1667,7 +1667,7 @@ void draw_parts(pixel *vid) } else if(t==PT_QRTZ || t==PT_PQRT) { - int z = parts[i].tmp; + int z = parts[i].tmp - 5; if(parts[i].temp>(pstates[t].ltemp-800.0f)) { float frequency = 3.1415/(2*pstates[t].ltemp-(pstates[t].ltemp-800.0f)); diff --git a/src/main.c b/src/main.c index 97e73829c..557673c58 100644 --- a/src/main.c +++ b/src/main.c @@ -1756,7 +1756,7 @@ int main(int argc, char *argv[]) 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", 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(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %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,parts[cr>>8].tmp); //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); diff --git a/src/powder.c b/src/powder.c index 440c0c297..5f6a78a48 100644 --- a/src/powder.c +++ b/src/powder.c @@ -648,9 +648,9 @@ inline int create_part(int p, int x, int y, int t) if(t==PT_SING) parts[i].life = rand()%50+60; if(t==PT_QRTZ) - parts[i].tmp = (rand()%11) -5; + parts[i].tmp = (rand()%11); if(t==PT_PQRT) - parts[i].tmp = (rand()%11) -5; + parts[i].tmp = (rand()%11); if(t==PT_FSEP) parts[i].life = 50; if(t==PT_COAL) { @@ -5785,16 +5785,25 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert) unsigned rtpmap[area_w][area_h]; unsigned char tbmap[area_h/CELL][area_w/CELL]; unsigned char rtbmap[area_w/CELL][area_h/CELL]; + float tfvy[area_h/CELL][area_w/CELL]; + float tfvx[area_h/CELL][area_w/CELL]; for(cy=0; cy>8].y = area_y +cy; } bmap[(area_y+cy)/CELL][(area_x+cx)/CELL] = rtbmap[cy/CELL][cx/CELL]; + fvy[(area_y+cy)/CELL][(area_x+cx)/CELL] = tfvy[cy/CELL][cx/CELL]; + fvx[(area_y+cy)/CELL][(area_x+cx)/CELL] = tfvx[cy/CELL][cx/CELL]; } } } From c7f1e2e423fea5772c3718e5b30f5bdd792267cc Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Tue, 11 Jan 2011 10:45:16 -0500 Subject: [PATCH 06/16] fix 1px brush replace mode --- src/powder.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index 5f6a78a48..877048c5d 100644 --- a/src/powder.c +++ b/src/powder.c @@ -6130,7 +6130,15 @@ int create_parts(int x, int y, int rx, int ry, int c) { if(rx==0&&ry==0) { - create_part(-2, x, y, c); + if((pmap[y][x]&0xFF)==SLALT || SLALT==0) + { + if((pmap[y][x])) + { + delete_part(x, y); + if(c!=0) + create_part(-2, x, y, c); + } + } } else for(j=-ry; j<=ry; j++) From cc4489ff295923dd2c0a0bef8cfa4210a7041410 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 12 Jan 2011 12:15:50 -0500 Subject: [PATCH 07/16] line for portals. wifi channels reset on reload. --- src/graphics.c | 28 ++++++++++++++++++++++++++++ src/main.c | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/src/graphics.c b/src/graphics.c index ef8fb15eb..121563b5e 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1834,6 +1834,34 @@ void draw_parts(pixel *vid) } } } + else if(t==PT_PRTI && DEBUG_MODE) + { + if(mousex==(nx) && mousey==(ny)) + { + int z; + for(z = 0; z=19 && x<=35 && svf_last && svf_open && !bq){ //int tpval = sys_pause; parse_save(svf_last, svf_lsize, 1, 0, 0); + for(j= 0;j<99;j++){ //reset wifi on reload + wireless[j][0] = 0; + wireless[j][1] = 0; + } //sys_pause = tpval; } if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) From 6083b64b727ce6fc2f0685b5fa1fb8fba970b792 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 12 Jan 2011 13:22:27 -0500 Subject: [PATCH 08/16] portal was invisible in debug, oops --- src/graphics.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics.c b/src/graphics.c index 121563b5e..be84b61d0 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1836,6 +1836,7 @@ void draw_parts(pixel *vid) } else if(t==PT_PRTI && DEBUG_MODE) { + blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255); if(mousex==(nx) && mousey==(ny)) { int z; @@ -1850,6 +1851,7 @@ void draw_parts(pixel *vid) } else if(t==PT_PRTO && DEBUG_MODE) { + blendpixel(vid,nx,ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors),255); if(mousex==(nx) && mousey==(ny)) { int z; From 1c8df0f09e3d3580bb23646578ce91826f2ee116 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 12 Jan 2011 16:36:08 -0500 Subject: [PATCH 09/16] fix photon heating particle number 0 --- src/powder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index 877048c5d..cc908c0f4 100644 --- a/src/powder.c +++ b/src/powder.c @@ -150,7 +150,7 @@ int try_move(int i, int x, int y, int nx, int ny) if(!e) { - if(!legacy_enable && parts[i].type==PT_PHOT) + if(!legacy_enable && parts[i].type==PT_PHOT && r) { if((r & 0xFF) == PT_COAL || (r & 0xFF) == PT_BCOL) parts[r>>8].temp = parts[i].temp; From 225dab24ea41fb1456216dfbc3e0d11c5a572d29 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 12 Jan 2011 19:11:46 -0500 Subject: [PATCH 10/16] fix some rare SWCH problems --- src/powder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index cc908c0f4..a05ed3e6a 100644 --- a/src/powder.c +++ b/src/powder.c @@ -3843,7 +3843,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].life = 10; } } - else if(parts[r>>8].type == PT_SPRK && parts[r>>8].ctype==PT_SWCH && parts[i].life<10&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL) + else if(parts[r>>8].type == PT_SPRK && parts[r>>8].ctype==PT_SWCH && parts[i].life<10 && parts[i].life>0 &&parts_avg(i,r>>8,PT_INSL)!=PT_INSL) { parts[r>>8].type = parts[r>>8].ctype; parts[r>>8].life = 9; From b673be0ac2db3bc3806f8b21eef66c606aabf4b2 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Fri, 14 Jan 2011 00:29:32 -0500 Subject: [PATCH 11/16] a fix so photons can be deleted and show up on HUD :) --- includes/powder.h | 2 ++ src/main.c | 6 +++++- src/powder.c | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 87e53f827..068edb22c 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -673,6 +673,8 @@ extern int pfree; extern unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; +unsigned photons[YRES][XRES]; + int try_move(int i, int x, int y, int nx, int ny); void kill_part(int i); diff --git a/src/main.c b/src/main.c index 452103f5a..a12ff9b48 100644 --- a/src/main.c +++ b/src/main.c @@ -1737,7 +1737,11 @@ int main(int argc, char *argv[]) if(y>0 && y0 && x>8)>=NPART || !cr)) { #ifdef BETA diff --git a/src/powder.c b/src/powder.c index a05ed3e6a..324a34f36 100644 --- a/src/powder.c +++ b/src/powder.c @@ -595,6 +595,8 @@ inline int create_part(int p, int x, int y, int t) } return -1; } + if(photons[y][x] && t==PT_PHOT) + return -1; if(pfree == -1) return -1; i = pfree; @@ -699,6 +701,8 @@ inline int create_part(int p, int x, int y, int t) parts[i].ctype = 0x47FFFF; if(t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP pmap[y][x] = t|(i<<8); + if(t==PT_PHOT) + photons[y][x] = t|(i<<8); else if(t==PT_STKM) { if(isplayer==0) @@ -909,7 +913,12 @@ inline void delete_part(int x, int y) if(x<0 || y<0 || x>=XRES || y>=YRES) return; - i = pmap[y][x]; + if(photons[y][x]){ + i = photons[y][x]; + } else { + i = pmap[y][x]; + } + if(!i || (i>>8)>=NPART) return; if((parts[i>>8].type==SLALT)||SLALT==0) @@ -5252,6 +5261,7 @@ void update_particles(pixel *vid) isplayer = 0; //Needed for player spawning isplayer2 = 0; memset(pmap, 0, sizeof(pmap)); + memset(photons, 0, sizeof(photons)); r = rand()%2; NUM_PARTS = 0; for(j=0; j=CELL) { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm || (photons[y][x1-1]&0xFF)!=cm) { break; } @@ -5946,7 +5958,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) } while(x2 Date: Fri, 14 Jan 2011 10:50:07 -0500 Subject: [PATCH 12/16] oops, didn't need the floodfill thing there. --- src/powder.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index 324a34f36..e8e3873df 100644 --- a/src/powder.c +++ b/src/powder.c @@ -24,6 +24,7 @@ int pfree; unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; +unsigned photons[YRES][XRES]; static int pn_junction_sprk(int x, int y, int pt) { @@ -580,7 +581,9 @@ inline int create_part(int p, int x, int y, int t) } } } - if(pfree == -1) + if(photons[y][x] && t==PT_PHOT) + return -1; + if(pfree == -1) return -1; i = pfree; pfree = parts[i].life; @@ -5950,7 +5953,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) x1 = x2 = x; while(x1>=CELL) { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm || (photons[y][x1-1]&0xFF)!=cm) + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) { break; } @@ -5958,7 +5961,7 @@ int flood_parts(int x, int y, int c, int cm, int bm) } while(x2 Date: Fri, 14 Jan 2011 21:23:23 -0500 Subject: [PATCH 13/16] fix photon causing infinite sparks --- src/powder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index e8e3873df..6b25eb4c5 100644 --- a/src/powder.c +++ b/src/powder.c @@ -34,7 +34,9 @@ static int pn_junction_sprk(int x, int y, int pt) r >>= 8; if(parts[r].type != pt) return 0; - + if(parts[r].life != 0) + return 0; + parts[r].ctype = pt; parts[r].type = PT_SPRK; parts[r].life = 4; From b1e09d421681ea7e3f57d0e6ee71582c8060cf04 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sun, 16 Jan 2011 01:29:49 -0500 Subject: [PATCH 14/16] Made GoL code work with more advanced rules with different life states, giving more interesting rules. --- includes/defines.h | 2 +- includes/powder.h | 63 ++++++++++++++++++++++++++++------------------ src/graphics.c | 29 +++++++++++++++++++++ src/powder.c | 37 +++++++++++++++++++-------- 4 files changed, 96 insertions(+), 35 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index af414718a..3d6b54981 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -61,7 +61,7 @@ extern unsigned char ZSIZE; #define STAMP_Y 4 #define STAMP_MAX 120 -#define NGOL 20 +#define NGOL 23 #define CIRCLE_BRUSH 0 #define SQUARE_BRUSH 1 diff --git a/includes/powder.h b/includes/powder.h index 068edb22c..1fdc3baeb 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -190,7 +190,10 @@ #define PT_REPL 139 #define PT_MYST 140 #define PT_BOYL 141 -#define PT_NUM 142 +#define PT_TEST 142 +#define PT_TEST2 143 +#define PT_TEST3 144 +#define PT_NUM 145 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -427,7 +430,10 @@ 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", 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", 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.", TYPE_GAS, NULL}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description + {"TEST", 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_SPECIAL, 9000.0f, 40, "S3458/B37/4", TYPE_SOLID|PROP_LIFE, NULL}, + {"TES2", 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_SPECIAL, 9000.0f, 40, "S124/B3/3", TYPE_SOLID|PROP_LIFE, NULL}, + {"TES4", 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_SPECIAL, 9000.0f, 40, "S3456/B278/6", 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 }; static part_state pstates[PT_NUM] = @@ -575,31 +581,37 @@ static part_state pstates[PT_NUM] = /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BOYL */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, 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][10] = { -// 0,1,2,3,4,5,6,7,8 live=1 spawn=2 spawn&live=3 - {0,0,0,0,0,0,0,0,0},//blank - {0,0,1,3,0,0,0,0,0},//GOL - {0,0,1,3,0,0,2,0,0},//HLIF - {0,0,0,2,3,3,1,1,0},//ASIM - {0,1,1,2,0,1,2,0,0},//2x2 - {0,0,0,3,1,0,3,3,3},//DANI - {0,1,0,3,0,3,0,2,1},//AMOE - {0,0,1,2,1,1,2,0,2},//MOVE - {0,0,1,3,0,2,0,2,1},//PGOL - {0,0,0,2,0,3,3,3,3},//DMOE - {0,0,0,3,3,0,0,0,0},//34 - {0,0,0,2,2,3,0,0,0},//LLIF - {0,0,1,3,0,1,3,3,3},//STAN - {0,0,2,0,0,0,0,0,0},//SEED - {0,1,1,3,1,1,0,0,0},//MAZE - {0,0,1,3,0,1,1,3,3},//COAG - {0,0,1,1,3,3,2,2,2},//WALL - {0,3,0,0,0,0,0,0,0},//GNAR - {0,3,0,3,0,3,0,3,0},//REPL - {1,0,0,2,2,3,1,1,3},//MYST +// 0,1,2,3,4,5,6,7,8,STATES live=1 spawn=2 spawn&live=3 States are kind of how long until it dies, normal ones use two states(living,dead) for others the intermediate states live but do nothing + {0,0,0,0,0,0,0,0,0,2},//blank + {0,0,1,3,0,0,0,0,0,2},//GOL + {0,0,1,3,0,0,2,0,0,2},//HLIF + {0,0,0,2,3,3,1,1,0,2},//ASIM + {0,1,1,2,0,1,2,0,0,2},//2x2 + {0,0,0,3,1,0,3,3,3,2},//DANI + {0,1,0,3,0,3,0,2,1,2},//AMOE + {0,0,1,2,1,1,2,0,2,2},//MOVE + {0,0,1,3,0,2,0,2,1,2},//PGOL + {0,0,0,2,0,3,3,3,3,2},//DMOE + {0,0,0,3,3,0,0,0,0,2},//34 + {0,0,0,2,2,3,0,0,0,2},//LLIF + {0,0,1,3,0,1,3,3,3,2},//STAN + {0,0,2,0,0,0,0,0,0,2},//SEED + {0,1,1,3,1,1,0,0,0,2},//MAZE + {0,0,1,3,0,1,1,3,3,2},//COAG + {0,0,1,1,3,3,2,2,2,2},//WALL + {0,3,0,0,0,0,0,0,0,2},//GNAR + {0,3,0,3,0,3,0,3,0,2},//REPL + {1,0,0,2,2,3,1,1,3,2},//MYST + {0,0,0,3,1,1,0,2,1,4},//TEST + {0,1,1,2,1,0,0,0,0,3},//TEST2 + {0,0,2,1,1,1,1,2,2,6},//TEST2 }; static int goltype[NGOL] = { @@ -622,6 +634,9 @@ static int goltype[NGOL] = PT_GNAR, PT_REPL, PT_MYST, + PT_TEST, + PT_TEST2, + PT_TEST3, }; static int loverule[9][9] = { diff --git a/src/graphics.c b/src/graphics.c index be84b61d0..824cee8aa 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1713,6 +1713,35 @@ void draw_parts(pixel *vid) cb = 20; blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + else if(t==PT_TEST) + { + if(parts[i].tmp==2) + blendpixel(vid, nx, ny, 255, 128, 0, 255); + else if(parts[i].tmp==1) + blendpixel(vid, nx, ny, 255, 255, 0, 255); + else + blendpixel(vid, nx, ny, 255, 0, 0, 255); + } + else if(t==PT_TEST2) + { + if(parts[i].tmp==2) + blendpixel(vid, nx, ny, 0, 100, 0, 255); + else + blendpixel(vid, nx, ny, 0, 255, 0, 255); + } + else if(t==PT_TEST3) + { + if(parts[i].tmp==4) + blendpixel(vid, nx, ny, 0, 0, 128, 255); + else if(parts[i].tmp==3) + blendpixel(vid, nx, ny, 0, 0, 150, 255); + else if(parts[i].tmp==2) + blendpixel(vid, nx, ny, 0, 0, 190, 255); + else if(parts[i].tmp==1) + blendpixel(vid, nx, ny, 0, 0, 230, 255); + else + blendpixel(vid, nx, ny, 0, 0, 70, 255); } else if(t==PT_DEUT) { diff --git a/src/powder.c b/src/powder.c index 6b25eb4c5..6aa4e411e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -658,6 +658,12 @@ inline int create_part(int p, int x, int y, int t) parts[i].tmp = (rand()%11); if(t==PT_PQRT) parts[i].tmp = (rand()%11); + if(ptypes[t].properties&PROP_LIFE) { + int r; + for(r = 0;r>8].type==goltype[golnum-1]) { - gol[nx][ny] = golnum; - 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] ++; + if(parts[r>>8].tmp == grule[golnum][9]-1) { + gol[nx][ny] = golnum; + 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] ++; + } + } else { + parts[r>>8].tmp --; + if(parts[r>>8].tmp<=0) + parts[r>>8].type = PT_NONE; } } } for(nx=CELL;nx>8].type = PT_NONE; + else if(neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2)) {//subtract 1 because it counted itself + if(parts[r>>8].tmp==grule[golnum][9]-1) + parts[r>>8].tmp --; + } + if(parts[r>>8].tmp<=0) + parts[r>>8].type = PT_NONE; } gol2[nx][ny][0] = 0; for( z = 1;z Date: Sun, 16 Jan 2011 13:54:36 -0500 Subject: [PATCH 15/16] fix loading of old GoL saves, and fix wall crash --- src/main.c | 7 ++++++- src/powder.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index a12ff9b48..8ff332909 100644 --- a/src/main.c +++ b/src/main.c @@ -405,7 +405,7 @@ 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 bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h, q; 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 @@ -707,6 +707,11 @@ int parse_save(void *save, int size, int replace, int x0, int y0) ttv = (d[p++])<<8; ttv |= (d[p++]); parts[i-1].tmp = ttv; + if(ptypes[parts[i-1].type].properties&PROP_LIFE && !parts[i-1].tmp) + for(q = 1; q>8)>=NPART) continue; for( golnum = 1;golnum Date: Sun, 16 Jan 2011 20:54:41 -0500 Subject: [PATCH 16/16] more life types using states, put them in new menu. Maybe get some way to switch to new menu on mouseover of last spot of current life menu --- includes/defines.h | 2 +- includes/interface.h | 8 +++++--- includes/powder.h | 20 +++++++++++++++----- src/graphics.c | 18 ++++++++++++++++-- src/main.c | 2 +- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 3d6b54981..562ee0dc6 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -61,7 +61,7 @@ extern unsigned char ZSIZE; #define STAMP_Y 4 #define STAMP_MAX 120 -#define NGOL 23 +#define NGOL 25 #define CIRCLE_BRUSH 0 #define SQUARE_BRUSH 1 diff --git a/includes/interface.h b/includes/interface.h index 159e2472f..29b5aadb1 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -52,9 +52,10 @@ static menu_wall mwalls[] = #define SC_LIQUID 4 #define SC_NUCLEAR 7 #define SC_LIFE 9 -#define SC_CRACKER 10 -#define SC_CRACKER2 11 -#define SC_TOTAL 10 +#define SC_LIFE2 10 +#define SC_CRACKER 12 +#define SC_CRACKER2 13 +#define SC_TOTAL 11 static menu_section msections[] = { @@ -68,6 +69,7 @@ static menu_section msections[] = {"\xC6", "Radioactive", 0, 1}, {"\xCC", "Special", 0, 1}, {"\xD2", "Life", 0, 1}, + {"\xD2", "More Life", 0, 1}, {"\xC8", "Cracker", 0, 0}, {"\xC8", "Cracker!", 0, 0}, }; diff --git a/includes/powder.h b/includes/powder.h index 1fdc3baeb..cc5980c42 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -193,7 +193,9 @@ #define PT_TEST 142 #define PT_TEST2 143 #define PT_TEST3 144 -#define PT_NUM 145 +#define PT_FROG 145 +#define PT_BRAN 146 +#define PT_NUM 147 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -430,9 +432,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", 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", 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.", TYPE_GAS, NULL}, - {"TEST", 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_SPECIAL, 9000.0f, 40, "S3458/B37/4", TYPE_SOLID|PROP_LIFE, NULL}, - {"TES2", 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_SPECIAL, 9000.0f, 40, "S124/B3/3", TYPE_SOLID|PROP_LIFE, NULL}, - {"TES4", 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_SPECIAL, 9000.0f, 40, "S3456/B278/6", 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_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", 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", 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", 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", 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", 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 }; @@ -584,6 +588,8 @@ static part_state pstates[PT_NUM] = /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static int grule[NGOL][10] = @@ -611,7 +617,9 @@ static int grule[NGOL][10] = {1,0,0,2,2,3,1,1,3,2},//MYST {0,0,0,3,1,1,0,2,1,4},//TEST {0,1,1,2,1,0,0,0,0,3},//TEST2 - {0,0,2,1,1,1,1,2,2,6},//TEST2 + {0,0,2,1,1,1,1,2,2,6},//TEST3 + {0,1,1,2,2,0,0,0,0,3},//FROG + {0,0,2,0,2,0,3,0,0,3},//BRAN }; static int goltype[NGOL] = { @@ -637,6 +645,8 @@ static int goltype[NGOL] = PT_TEST, PT_TEST2, PT_TEST3, + PT_FROG, + PT_BRAN, }; static int loverule[9][9] = { diff --git a/src/graphics.c b/src/graphics.c index 824cee8aa..ffaa33339 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1726,9 +1726,9 @@ void draw_parts(pixel *vid) else if(t==PT_TEST2) { if(parts[i].tmp==2) - blendpixel(vid, nx, ny, 0, 100, 0, 255); + blendpixel(vid, nx, ny, 0, 100, 50, 255); else - blendpixel(vid, nx, ny, 0, 255, 0, 255); + blendpixel(vid, nx, ny, 0, 255, 90, 255); } else if(t==PT_TEST3) { @@ -1743,6 +1743,20 @@ void draw_parts(pixel *vid) else blendpixel(vid, nx, ny, 0, 0, 70, 255); } + else if(t==PT_FROG) + { + if(parts[i].tmp==2) + blendpixel(vid, nx, ny, 0, 100, 0, 255); + else + blendpixel(vid, nx, ny, 0, 255, 0, 255); + } + else if(t==PT_BRAN) + { + if(parts[i].tmp==1) + blendpixel(vid, nx, ny, 150, 150, 0, 255); + else + blendpixel(vid, nx, ny, 255, 255, 0, 255); + } else if(t==PT_DEUT) { diff --git a/src/main.c b/src/main.c index 8ff332909..63081788c 100644 --- a/src/main.c +++ b/src/main.c @@ -1522,7 +1522,7 @@ int main(int argc, char *argv[]) } } if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT))) - active_menu = 11; + active_menu = 12; if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE) REPLACE_MODE = !REPLACE_MODE; if(sdl_key=='g')