From 0424907d28aa847bd754b561cacbc235accf04d0 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sun, 26 Sep 2010 14:00:15 +0200 Subject: [PATCH] atzensty... astyle --- interface.c | 18 ++-- powder.c | 288 ++++++++++++++++++++++++++-------------------------- powder.h | 4 +- 3 files changed, 155 insertions(+), 155 deletions(-) mode change 100755 => 100644 powder.h diff --git a/interface.c b/interface.c index c5e9f0d98..27232c969 100644 --- a/interface.c +++ b/interface.c @@ -1952,7 +1952,7 @@ int search_ui(pixel *vid_buf) } mp = dp = -1; - dap = -1; + dap = -1; st = 0; for(gj=0; gj=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) + if(!search_dates[pos] && mx>=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) { mp = -1; dap = pos; @@ -2034,11 +2034,11 @@ int search_ui(pixel *vid_buf) if(!search_dates[pos] && own) { fillrect(vid_buf, gx-5, gy+YRES/GRID_S-3, 7, 8, 255, 255, 255, 255); - if(dap == pos){ - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); - } else { - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); - } + if(dap == pos) { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); + } else { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); + } //drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); } if(view_own || svf_admin || svf_mod) @@ -2156,10 +2156,10 @@ int search_ui(pixel *vid_buf) } } if(b && !bq && dap!=-1) - { + { sprintf(ed.str, "history:%s", search_ids[dap]); lasttime = TIMEOUT; - } + } if(b && !bq && tp!=-1) { diff --git a/powder.c b/powder.c index c47400986..5a0b95b4f 100644 --- a/powder.c +++ b/powder.c @@ -228,7 +228,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 0; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; - parts[i].tmp = 0; + parts[i].tmp = 0; } if(t==PT_ACID) { @@ -239,10 +239,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_FUSE){ + if(t==PT_FUSE) { parts[i].life = 50; - parts[i].tmp = 50; - } + parts[i].tmp = 50; + } if(t==PT_FSEP) parts[i].life = 50; if(t==PT_COAL) @@ -819,7 +819,7 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 0.50f; if(t==PT_FIRE) parts[i].life = rand()%50+120; - if(t==PT_HFLM) + if(t==PT_HFLM) parts[i].life = rand()%50+120; } } @@ -975,73 +975,73 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_FUSE) + else if(t==PT_FUSE) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if(pv[y/CELL][x/CELL] > 0.8f) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + { + if(parts[i].life>40) { + parts[i].life = 39; } - if(pv[y/CELL][x/CELL] > 0.8f) - parts[i].tmp--; - else if(parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } + } } - else if(t==PT_FSEP) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } + } } + } else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for(nx=-2; nx<3; nx++) @@ -1334,7 +1334,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1369,89 +1369,89 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) - { - t = parts[i].life++; - if(parts[i].life==3) - { - parts[i].type = PT_NONE; - kill_part(i); - } - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - kill_part(r>>8); - if(2>(rand()/(RAND_MAX/100))) - create_part(r>>8, x+nx, y+ny, PT_PHOT); - pv[y/CELL][x/CELL] -= 5.0f; - continue; - } + if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) + { + t = parts[i].life++; + if(parts[i].life==3) + { + parts[i].type = PT_NONE; + kill_part(i); + } + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + kill_part(r>>8); + if(2>(rand()/(RAND_MAX/100))) + create_part(r>>8, x+nx, y+ny, PT_PHOT); + pv[y/CELL][x/CELL] -= 5.0f; + continue; + } } } - else if(t==PT_FIRW){ - if(parts[i].tmp==0){ - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) - { - parts[i].tmp = 1; - parts[i].life = rand()%50+120; - } - } - } - else if(parts[i].tmp==1){ - if(parts[i].life==0){ - parts[i].tmp=2; - } else { - float newVel = parts[i].life/50; - parts[i].flags = parts[i].flags&0xFFFFFFFE; - if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE){ - parts[i].vy = -newVel; - ly-=newVel; - iy-=newVel; - } - } - } - else if(parts[i].tmp==2){ - for(nx=-2; nx<3; nx++){ - for(ny=-2; ny<3; ny++){ - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type==PT_FIRW){ - parts[r>>8].vx = (rand()%3-1)*tmul; - parts[r>>8].vy = (rand()%3-1)*tmul; - parts[r>>8].tmp = 3; - parts[r>>8].life = rand()%100+100; - parts[r>>8].temp = 6000.0f; - } - } - } - } - pv[y/CELL][x/CELL] += 20; - kill_part(i); - } else if(parts[i].tmp==3){ - if(parts[i].life<=0){ - kill_part(i); - } - } - } + else if(t==PT_FIRW) { + if(parts[i].tmp==0) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) + { + parts[i].tmp = 1; + parts[i].life = rand()%50+120; + } + } + } + else if(parts[i].tmp==1) { + if(parts[i].life==0) { + parts[i].tmp=2; + } else { + float newVel = parts[i].life/50; + parts[i].flags = parts[i].flags&0xFFFFFFFE; + if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE) { + parts[i].vy = -newVel; + ly-=newVel; + iy-=newVel; + } + } + } + else if(parts[i].tmp==2) { + for(nx=-2; nx<3; nx++) { + for(ny=-2; ny<3; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type==PT_FIRW) { + parts[r>>8].vx = (rand()%3-1)*tmul; + parts[r>>8].vy = (rand()%3-1)*tmul; + parts[r>>8].tmp = 3; + parts[r>>8].life = rand()%100+100; + parts[r>>8].temp = 6000.0f; + } + } + } + } + pv[y/CELL][x/CELL] += 20; + kill_part(i); + } else if(parts[i].tmp==3) { + if(parts[i].life<=0) { + kill_part(i); + } + } + } else if(t==PT_BTRY) { rt = 3 + (int)pv[y/CELL][x/CELL]; diff --git a/powder.h b/powder.h old mode 100755 new mode 100644 index ffe2dab96..1d19a2bde --- a/powder.h +++ b/powder.h @@ -353,7 +353,7 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, /* Dust */ /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, /* Watr */ /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,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