added spawnpoints for stickmen, so they respawn.

This commit is contained in:
Cracker64 2010-12-18 23:22:10 -05:00
parent 039a4e2f31
commit 2dad930818
3 changed files with 88 additions and 12 deletions

View File

@ -141,6 +141,11 @@ int VINE_MODE;
int DEBUG_MODE;
int GENERATION;
int isplayer2;
int playerspawn;
int player2spawn;
int death2;
int ISSPAWN1;
int ISSPAWN2;
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;
@ -150,7 +155,7 @@ extern char itc_msg[64];
extern int do_open;
extern int sys_pause;
extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save.
extern int death, framerender;
extern int death, death2, framerender;
extern unsigned char last_major, last_minor, update_flag;

View File

@ -164,8 +164,8 @@
#define PT_VINE 114
#define PT_INVIS 115
#define PT_EQUALVEL 116//all particles equal their velocities
#define PT_INST2 117//blank element, replace with something new, has to be here for numbering
#define PT_INST3 118//blank same as above
#define PT_SPAWN2 117//blank element, replace with something new, has to be here for numbering
#define PT_SPAWN 118//blank same as above
#define PT_SHLD1 119
#define PT_SHLD2 120
#define PT_SHLD3 121
@ -384,8 +384,8 @@ static const part_type ptypes[PT_NUM] =
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART},
{"int2", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0},
{"int3", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0},
{"SPW2", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0},
{"SPWN", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Stickman spawnpoint, negative temp for STK2, positive for STKM", 0},
{"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0},
{"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 2", 0},
{"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", 0},
@ -520,8 +520,8 @@ static part_state pstates[PT_NUM] =
/* VINE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* INVS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPWN2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPAWN*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD1*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},

View File

@ -370,7 +370,24 @@ void kill_part(int i)
if(parts[i].type != PT_PHOT) {
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
if(parts[i].type == PT_STKM)
{
death = 1;
isplayer = 0;
}
if(parts[i].type == PT_STKM2)
{
death2 = 1;
isplayer2 = 0;
}
if(parts[i].type == PT_SPAWN)
{
ISSPAWN1 = 0;
}
if(parts[i].type == PT_SPAWN2)
{
ISSPAWN2 = 0;
}
if(x>=0 && y>=0 && x<XRES && y<YRES)
pmap[y][x] = 0;
}
@ -470,10 +487,16 @@ inline int create_part(int p, int x, int y, int t)
pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK;
return pmap[y][x]>>8;
}
if(t==PT_SPAWN&&ISSPAWN1)
return -1;
if(t==PT_SPAWN2&&ISSPAWN2)
return -1;
if(p==-1)//creating from anything but brush
{
if(pmap[y][x])
return -1;
if(pmap[y][x]&0xFF!=PT_SPAWN&&pmap[y][x]&0xFF!=PT_SPAWN2)
if(t!=PT_STKM&&t!=PT_STKM2)
return -1;
if(pfree == -1)
return -1;
i = pfree;
@ -587,6 +610,18 @@ inline int create_part(int p, int x, int y, int t)
{
if(isplayer==0)
{
if(pmap[y][x]&0xFF==PT_SPAWN)
{
parts[pmap[y][x]>>8].type = PT_STKM;
parts[pmap[y][x]>>8].vx = 0;
parts[pmap[y][x]>>8].vy = 0;
parts[pmap[y][x]>>8].life = 100;
parts[pmap[y][x]>>8].ctype = 0;
parts[pmap[y][x]>>8].temp = ptypes[t].heat;
}
else
{
parts[i].x = (float)x;
parts[i].y = (float)y;
parts[i].type = PT_STKM;
@ -595,6 +630,7 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 100;
parts[i].ctype = 0;
parts[i].temp = ptypes[t].heat;
}
@ -620,11 +656,26 @@ inline int create_part(int p, int x, int y, int t)
isplayer = 1;
}
//kill_part(playerspawn);
create_part(-1,x,y,PT_SPAWN);
ISSPAWN1 = 1;
}
else if(t==PT_STKM2)
{
if(isplayer2==0)
{
if(pmap[y][x]&0xFF==PT_SPAWN2)
{
parts[pmap[y][x]>>8].type = PT_STKM2;
parts[pmap[y][x]>>8].vx = 0;
parts[pmap[y][x]>>8].vy = 0;
parts[pmap[y][x]>>8].life = 100;
parts[pmap[y][x]>>8].ctype = 0;
parts[pmap[y][x]>>8].temp = ptypes[t].heat;
}
else
{
parts[i].x = (float)x;
parts[i].y = (float)y;
parts[i].type = PT_STKM2;
@ -633,6 +684,7 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 100;
parts[i].ctype = 0;
parts[i].temp = ptypes[t].heat;
}
@ -658,6 +710,9 @@ inline int create_part(int p, int x, int y, int t)
isplayer2 = 1;
}
//kill_part(player2spawn);
create_part(-1,x,y,PT_SPAWN2);
ISSPAWN2 = 1;
}
return i;
@ -3712,7 +3767,6 @@ killed:
//Death
if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
death = 0;
for(r=-2; r<=1; r++)
{
create_part(-1, x+r, y-2, player[2]);
@ -4101,9 +4155,8 @@ killed:
parts[i].temp += 1;
//Death
if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
if(parts[i].life<1 || death2 == 1 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
death = 0;
for(r=-2; r<=1; r++)
{
create_part(-1, x+r, y-2, player2[2]);
@ -4482,6 +4535,24 @@ killed:
isplayer2 = 1;
}
if(t==PT_SPAWN)
{
if(death==1)
{
playerspawn = create_part(-1,x,y,PT_STKM);
isplayer = 1;
}
death = 0;
}
if(t==PT_SPAWN2)
{
if(death2==1)
{
player2spawn = create_part(-1,x,y,PT_STKM2);
isplayer2 = 1;
}
death2 = 0;
}
if(t==PT_CLNE)
{
if(!parts[i].ctype)