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:
Cracker64
2010-12-17 01:35:27 -05:00
parent d1ca1af825
commit 809676a1dc
3 changed files with 83 additions and 33 deletions

View File

@@ -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}, {"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}, {"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}, {"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}, {"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}, {"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, 40, "Portal OUT. Things come out 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}, {"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}, {"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}, {"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},
{0,1,0,0,0,0,0,1,0}, {0,1,0,0,0,0,0,1,0},
}; };
int portal[8][8]; int portal[MAX_TEMP/100][8][8];
float portaltemp[8][8]; float portaltemp[MAX_TEMP/100][8][8];
int wireless[MAX_TEMP/100][2]; int wireless[MAX_TEMP/100][2];
extern int isplayer; extern int isplayer;
@@ -634,7 +634,7 @@ void update_particles_i(pixel *vid, int start, int inc);
void update_particles(pixel *vid); 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); void clear_area(int area_x, int area_y, int area_w, int area_h);

View File

@@ -1476,7 +1476,7 @@ int main(int argc, char *argv[])
} }
if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT))) if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
active_menu = 11; active_menu = 11;
if(sdl_key==SDLK_INSERT) if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE)
REPLACE_MODE = !REPLACE_MODE; REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g') 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; save_mode = 1;
copy_mode = 3;//rotate copy_mode = 3;//rotate
@@ -1877,7 +1882,15 @@ int main(int argc, char *argv[])
{ {
if(save_h>save_w) if(save_h>save_w)
save_w = save_h; 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; save_mode = 0;
copy_mode = 0; copy_mode = 0;
} }
@@ -2161,7 +2174,7 @@ int main(int argc, char *argv[])
if(save_mode) 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) if(save_h>save_w)
save_w = save_h; save_w = save_h;

View File

@@ -2332,6 +2332,11 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_FWRK; parts[r>>8].type = PT_FWRK;
if((r&0xFF)==PT_FWRK && 5>(rand()%100)) if((r&0xFF)==PT_FWRK && 5>(rand()%100))
parts[r>>8].ctype = PT_DUST; 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 && /*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_LIQUID||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| 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) { else if(t==PT_MORT) {
create_part(-1, x, y-1, PT_SMKE); 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) 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; int count =0;
for(ny=-1; ny<2; ny++) for(ny=-1; ny<2; ny++)
for(nx=-1; nx<2; nx++) for(nx=-1; nx<2; nx++)
@@ -2928,10 +2954,10 @@ void update_particles_i(pixel *vid, int start, int inc)
continue; 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))) 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++) 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; portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
portaltemp[count-1][nnx] = parts[r>>8].temp; portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
if(parts[r>>8].type==PT_SPRK) if(parts[r>>8].type==PT_SPRK)
parts[r>>8].type = parts[r>>8].ctype; parts[r>>8].type = parts[r>>8].ctype;
else else
@@ -2942,6 +2968,10 @@ void update_particles_i(pixel *vid, int start, int inc)
} }
else if(t==PT_PRTO) 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; int count = 0;
for(ny=1; ny>-2; ny--) for(ny=1; ny>-2; ny--)
for(nx=1; nx>-2; nx--) for(nx=1; nx>-2; nx--)
@@ -2961,26 +2991,26 @@ void update_particles_i(pixel *vid, int start, int inc)
randomness=1; randomness=1;
if(randomness>8) if(randomness>8)
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,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x+1,y+1,portal[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[randomness-1][nnx]); create_part(-1,x+1,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y-1,portal[randomness-1][nnx]); create_part(-1,x,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y+1,portal[randomness-1][nnx]); create_part(-1,x,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y+1,portal[randomness-1][nnx]); create_part(-1,x-1,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y,portal[randomness-1][nnx]); create_part(-1,x-1,y,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y-1,portal[randomness-1][nnx]); create_part(-1,x-1,y-1,portal[parts[i].tmp][randomness-1][nnx]);
portal[randomness-1][nnx] = 0; portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[randomness-1][nnx] = 0; portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
break; 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]); create_part(-1,x+nx,y+ny,portal[parts[i].tmp][randomness-1][nnx]);
parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[randomness-1][nnx]; parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
portal[randomness-1][nnx] = 0; portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[randomness-1][nnx] = 0; portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
break; 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 cx = 0;
int cy = 0; int cy = 0;
@@ -4954,11 +4984,19 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h)
for(cy=0; cy<area_w; cy++) for(cy=0; cy<area_w; cy++)
{ {
for(cx=0; cx<area_h; cx++)//rotate temp arrays for(cx=0; cx<area_h; cx++)//rotate temp arrays
{
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]; 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)]; rtpmap[(area_h-1)-cx][cy] = tpmap[(int)(cy+0.5f)][(int)(cx+0.5f)];
} }
} }
}
for(cy=0; cy<area_w; cy++) for(cy=0; cy<area_w; cy++)
{ {
for(cx=0; cx<area_h; cx++)//move particles and walls for(cx=0; cx<area_h; cx++)//move particles and walls
@@ -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].x = area_x +cx;
parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].y = area_y +cy; 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]; bmap[(area_y+cy)/CELL][(area_x+cx)/CELL] = rtbmap[cy/CELL][cx/CELL];
} }
} }