diff options
| author | Cracker64 <cracker642@gmail.com> | 2010-12-17 06:35:27 (GMT) |
|---|---|---|
| committer | Cracker64 <cracker642@gmail.com> | 2010-12-17 06:35:27 (GMT) |
| commit | 809676a1dcfb79ad9b2fa8043d553f9f7961680d (patch) | |
| tree | 649232587653f7c4459f90169afca64eebaba450 /src | |
| parent | d1ca1af8257378a0ef073d30385eeff3b964adf9 (diff) | |
| download | powder-809676a1dcfb79ad9b2fa8043d553f9f7961680d.zip powder-809676a1dcfb79ad9b2fa8043d553f9f7961680d.tar.gz | |
added invertion to rotate, ctrl-shift-r, will invert x-axis. NEUT+ACID=ISOZ,GLOW+WATR=DEUT. added ` to toggle replace mode for people without insert keys
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 21 | ||||
| -rw-r--r-- | src/powder.c | 83 |
2 files changed, 77 insertions, 27 deletions
@@ -1476,7 +1476,7 @@ int main(int argc, char *argv[]) } if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT))) active_menu = 11; - if(sdl_key==SDLK_INSERT) + if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE) REPLACE_MODE = !REPLACE_MODE; if(sdl_key=='g') { @@ -1510,7 +1510,12 @@ int main(int argc, char *argv[]) } } } - if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + if(sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT))) + { + save_mode = 1; + copy_mode = 4;//invert + } + else if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) { save_mode = 1; copy_mode = 3;//rotate @@ -1877,7 +1882,15 @@ int main(int argc, char *argv[]) { if(save_h>save_w) save_w = save_h; - rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL);//just do squares for now + rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==4)//invertion + { + if(save_h>save_w) + save_w = save_h; + rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now save_mode = 0; copy_mode = 0; } @@ -2161,7 +2174,7 @@ int main(int argc, char *argv[]) if(save_mode) { - if(copy_mode==3)//special drawing for rotate, can remove once it can do rectangles + if(copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles { if(save_h>save_w) save_w = save_h; diff --git a/src/powder.c b/src/powder.c index 7cb4142..4b888df 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2332,6 +2332,11 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_FWRK; if((r&0xFF)==PT_FWRK && 5>(rand()%100)) parts[r>>8].ctype = PT_DUST; + if((r&0xFF)==PT_ACID && 5>(rand()%100)) + { + parts[r>>8].type = PT_ISOZ; + parts[r>>8].life = 0; + } /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| @@ -2393,6 +2398,23 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_GLOW) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) + { + r = pmap[y+ny][x+nx]; + if((r>>8)>=NPART || !r) + continue; + if(parts[r>>8].type==PT_WATR&&5>(rand()%2000)) + { + t = parts[i].type = PT_NONE; + parts[r>>8].type = PT_DEUT; + parts[r>>8].life = 10; + } + } + } else if(t==PT_MORT) { create_part(-1, x, y-1, PT_SMKE); } @@ -2916,6 +2938,10 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_PRTI) { + int temprange = 100; + for( temp = 0; temp < MAX_TEMP; temp += temprange) + if(parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange) + parts[i].tmp = temp/100; int count =0; for(ny=-1; ny<2; ny++) for(nx=-1; nx<2; nx++) @@ -2928,10 +2954,10 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(parts[r>>8].type==PT_SPRK || (parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))) for( nnx=0;nnx<8;nnx++) - if(!portal[count-1][nnx]) + if(!portal[parts[i].tmp][count-1][nnx]) { - portal[count-1][nnx] = parts[r>>8].type; - portaltemp[count-1][nnx] = parts[r>>8].temp; + portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; + portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; if(parts[r>>8].type==PT_SPRK) parts[r>>8].type = parts[r>>8].ctype; else @@ -2942,6 +2968,10 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_PRTO) { + int temprange = 100; + for( temp = 0; temp < MAX_TEMP; temp += temprange) + if(parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange) + parts[i].tmp = temp/100; int count = 0; for(ny=1; ny>-2; ny--) for(nx=1; nx>-2; nx--) @@ -2961,26 +2991,26 @@ void update_particles_i(pixel *vid, int start, int inc) randomness=1; if(randomness>8) randomness=8; - if(portal[randomness-1][nnx]==PT_SPRK)//todo. make it look better + if(portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)//todo. make it look better { - create_part(-1,x+1,y,portal[randomness-1][nnx]); - create_part(-1,x+1,y+1,portal[randomness-1][nnx]); - create_part(-1,x+1,y-1,portal[randomness-1][nnx]); - create_part(-1,x,y-1,portal[randomness-1][nnx]); - create_part(-1,x,y+1,portal[randomness-1][nnx]); - create_part(-1,x-1,y+1,portal[randomness-1][nnx]); - create_part(-1,x-1,y,portal[randomness-1][nnx]); - create_part(-1,x-1,y-1,portal[randomness-1][nnx]); - portal[randomness-1][nnx] = 0; - portaltemp[randomness-1][nnx] = 0; + create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x+1,y+1,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x+1,y-1,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x,y-1,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x,y+1,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x-1,y+1,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x-1,y,portal[parts[i].tmp][randomness-1][nnx]); + create_part(-1,x-1,y-1,portal[parts[i].tmp][randomness-1][nnx]); + portal[parts[i].tmp][randomness-1][nnx] = 0; + portaltemp[parts[i].tmp][randomness-1][nnx] = 0; break; } - else if(portal[randomness-1][nnx]) + else if(portal[parts[i].tmp][randomness-1][nnx]) { - create_part(-1,x+nx,y+ny,portal[randomness-1][nnx]); - parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[randomness-1][nnx]; - portal[randomness-1][nnx] = 0; - portaltemp[randomness-1][nnx] = 0; + create_part(-1,x+nx,y+ny,portal[parts[i].tmp][randomness-1][nnx]); + parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; + portal[parts[i].tmp][randomness-1][nnx] = 0; + portaltemp[parts[i].tmp][randomness-1][nnx] = 0; break; } } @@ -4918,7 +4948,7 @@ void update_particles(pixel *vid) } -void rotate_area(int area_x, int area_y, int area_w, int area_h) +void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert) { int cx = 0; int cy = 0; @@ -4955,8 +4985,16 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h) { for(cx=0; cx<area_h; cx++)//rotate temp arrays { - rtbmap[((area_h-1)-cx)/CELL][cy/CELL] = tbmap[cy/CELL][cx/CELL]; - rtpmap[(area_h-1)-cx][cy] = tpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]; + if(invert) + { + rtbmap[cy/CELL][((area_h-1)-cx)/CELL] = tbmap[cy/CELL][cx/CELL]; + rtpmap[cy][(area_h-1)-cx] = tpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]; + } + else + { + rtbmap[((area_h-1)-cx)/CELL][cy/CELL] = tbmap[cy/CELL][cx/CELL]; + rtpmap[(area_h-1)-cx][cy] = tpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]; + } } } for(cy=0; cy<area_w; cy++) @@ -4970,7 +5008,6 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h) parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].x = area_x +cx; parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].y = area_y +cy; } - else bmap[(area_y+cy)/CELL][(area_x+cx)/CELL] = rtbmap[cy/CELL][cx/CELL]; } } |
