mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 03:09:53 +02:00
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
This commit is contained in:
@@ -373,10 +373,10 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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},
|
||||
{"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},
|
||||
{"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_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS},
|
||||
{"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, 20, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE},
|
||||
{"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},
|
||||
{"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},
|
||||
{"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, 40, "Portal IN. Things go in here", TYPE_SOLID},
|
||||
{"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, 40, "Portal OUT. Things come out here", TYPE_SOLID},
|
||||
{"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", TYPE_SOLID},
|
||||
{"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", TYPE_SOLID},
|
||||
{"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},
|
||||
{"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},
|
||||
{"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},
|
||||
@@ -571,8 +571,8 @@ static int lolzrule[9][9] =
|
||||
{0,1,0,0,0,0,0,1,0},
|
||||
{0,1,0,0,0,0,0,1,0},
|
||||
};
|
||||
int portal[8][8];
|
||||
float portaltemp[8][8];
|
||||
int portal[MAX_TEMP/100][8][8];
|
||||
float portaltemp[MAX_TEMP/100][8][8];
|
||||
int wireless[MAX_TEMP/100][2];
|
||||
|
||||
extern int isplayer;
|
||||
@@ -634,7 +634,7 @@ void update_particles_i(pixel *vid, int start, int inc);
|
||||
|
||||
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);
|
||||
|
||||
void clear_area(int area_x, int area_y, int area_w, int area_h);
|
||||
|
||||
|
21
src/main.c
21
src/main.c
@@ -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;
|
||||
|
83
src/powder.c
83
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];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user