From 8604d27c7a4a442140d725be44bca7fc05cd7884 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Thu, 30 Dec 2010 14:59:39 -0500 Subject: [PATCH 1/3] simon updates, and SING improvements --- src/main.c | 15 ++++++++----- src/powder.c | 62 ++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/main.c b/src/main.c index 21e8a4702..59fcea417 100644 --- a/src/main.c +++ b/src/main.c @@ -2074,13 +2074,16 @@ int main(int argc, char *argv[]) } if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { - if(b & SDL_BUTTON_LMASK) + if(b & SDL_BUTTON_LMASK){ set_cmode((cmode+1) % CM_COUNT); - if(b & SDL_BUTTON_RMASK) - if((cmode+(CM_COUNT-1)) % CM_COUNT == CM_LIFE) - set_cmode(CM_GRAD); - else - set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT); + } + if(b & SDL_BUTTON_RMASK){ + if((cmode+(CM_COUNT-1)) % CM_COUNT == CM_LIFE) { + set_cmode(CM_GRAD); + } else { + set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT); + } + } save_presets(0); } if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) diff --git a/src/powder.c b/src/powder.c index 356db7c55..6a67b4915 100644 --- a/src/powder.c +++ b/src/powder.c @@ -426,6 +426,40 @@ void kill_part(int i) pfree = i; } +#if defined(WIN32) && !defined(__GNUC__) +_inline int create_n_parts(int n, int x, int y, int t) +#else +inline int create_n_parts(int n, int x, int y, float vx, float vy, int t) +#endif +{ + int i, c; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return -1; + + for (c; c0 && pv[y/CELL-1][x/CELL]0) + { + pv[y/CELL][x/CELL-1] += 0.1f*(singularity-pv[y/CELL][x/CELL-1]); + if(y+CELL>0) + pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]); + } } else { @@ -2462,7 +2504,9 @@ void update_particles_i(pixel *vid, int start, int inc) } if((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000)) { - +#ifdef SDEUT + create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT); +#else create_part(r>>8, x+nx, y+ny, PT_NEUT); parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; @@ -2475,6 +2519,7 @@ void update_particles_i(pixel *vid, int start, int inc) } else parts[r>>8].type = PT_NONE; +#endif } if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST; @@ -3604,31 +3649,24 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(parts[r>>8].type!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1) { - if(parts[r>>8].life >10) + if(parts[r>>8].type==PT_SING && parts[r>>8].life >10) { if(parts[i].life+parts[r>>8].life > 255) - { - if(parts[r>>8].type!=PT_SING && 1>rand()%20000) - { - parts[r>>8].type = PT_SING; - parts[r>>8].life = rand()%50+60; - } continue; - } parts[i].life += parts[r>>8].life; } else { - if(parts[i].life+1 > 255) + if(parts[i].life+3 > 255) { - if(parts[r>>8].type!=PT_SING && 1>rand()%20000) + if(parts[r>>8].type!=PT_SING && 1>rand()%100) { parts[r>>8].type = PT_SING; parts[r>>8].life = rand()%50+60; } continue; } - parts[i].life += 1; + parts[i].life += 3; } parts[i].temp = restrict_flt(parts[r>>8].temp+parts[i].temp, MIN_TEMP, MAX_TEMP); parts[r>>8].type=PT_NONE; From 2b253cf73cb835fd51e409853d7d14669229ee18 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Thu, 30 Dec 2010 16:55:02 -0500 Subject: [PATCH 2/3] simon update and small SING change to make it betterer. --- includes/powder.h | 2 +- src/powder.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index f6755c02f..4248a5849 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -406,7 +406,7 @@ static const part_type ptypes[PT_NUM] = {"STK2", 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}, {"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.02f * CFDS, 0.96f, 0.80f, 0.0f, 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}, + {"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}, {"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}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description diff --git a/src/powder.c b/src/powder.c index 6a67b4915..e9ebf20a6 100644 --- a/src/powder.c +++ b/src/powder.c @@ -433,7 +433,13 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t) #endif { int i, c; - + n = (n/10); + if(n<1){ + n = 1; + } + if(n>680){ + n = 680; + } if(x<0 || y<0 || x>=XRES || y>=YRES) return -1; @@ -2504,9 +2510,9 @@ void update_particles_i(pixel *vid, int start, int inc) } if((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000)) { -#ifdef SDEUT +//#ifdef SDEUT create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT); -#else +/*#else create_part(r>>8, x+nx, y+ny, PT_NEUT); parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; @@ -2519,7 +2525,7 @@ void update_particles_i(pixel *vid, int start, int inc) } else parts[r>>8].type = PT_NONE; -#endif +#endif*/ } if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST; From 97e7850de591b9855903ab7fc0449374391efa34 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Thu, 30 Dec 2010 16:56:11 -0500 Subject: [PATCH 3/3] oops, was testing --- src/powder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/powder.c b/src/powder.c index e9ebf20a6..c97f2afd2 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2510,9 +2510,9 @@ void update_particles_i(pixel *vid, int start, int inc) } if((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000)) { -//#ifdef SDEUT +#ifdef SDEUT create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT); -/*#else +#else create_part(r>>8, x+nx, y+ny, PT_NEUT); parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; @@ -2525,7 +2525,7 @@ void update_particles_i(pixel *vid, int start, int inc) } else parts[r>>8].type = PT_NONE; -#endif*/ +#endif } if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST;