"Added Air modes using Gravitymode code"

This commit is contained in:
Cate 2011-02-09 23:17:57 +08:00 committed by FacialTurd
parent 3a4b7f6983
commit d5fe05d760
4 changed files with 58 additions and 1 deletions

View File

@ -778,6 +778,7 @@ extern float player[27];
extern float player2[27]; extern float player2[27];
extern int gravityMode; extern int gravityMode;
extern int airMode;
extern particle *parts; extern particle *parts;
extern particle *cb_parts; extern particle *cb_parts;

View File

@ -33,6 +33,9 @@ void update_air(void)
{ {
int x, y, i, j; int x, y, i, j;
float dp, dx, dy, f, tx, ty; float dp, dx, dy, f, tx, ty;
if (airMode != 4) {
for (i=0; i<YRES/CELL; i++) for (i=0; i<YRES/CELL; i++)
{ {
pv[i][0] = pv[i][0]*0.8f; pv[i][0] = pv[i][0]*0.8f;
@ -177,6 +180,28 @@ void update_air(void)
if (dy > 256.0f) dy = 256.0f; if (dy > 256.0f) dy = 256.0f;
if (dy < -256.0f) dy = -256.0f; if (dy < -256.0f) dy = -256.0f;
switch (airMode)
{
default:
case 0: //Default
break;
case 1: //0 Pressure
dp = 0.0f;
break;
case 2: //0 Velocity
dx = 0.0f;
dy = 0.0f;
break;
case 3: //0 Air
dx = 0.0f;
dy = 0.0f;
dp = 0.0f;
break;
case 4: //No Update
break;
}
ovx[y][x] = dx; ovx[y][x] = dx;
ovy[y][x] = dy; ovy[y][x] = dy;
opv[y][x] = dp; opv[y][x] = dp;
@ -185,3 +210,4 @@ void update_air(void)
memcpy(vy, ovy, sizeof(vy)); memcpy(vy, ovy, sizeof(vy));
memcpy(pv, opv, sizeof(pv)); memcpy(pv, opv, sizeof(pv));
} }
}

View File

@ -543,7 +543,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
if (replace) if (replace)
{ {
gravityMode = 1; gravityMode = 1;
airMode = 1;
memset(bmap, 0, sizeof(bmap)); memset(bmap, 0, sizeof(bmap));
memset(emap, 0, sizeof(emap)); memset(emap, 0, sizeof(emap));
memset(signs, 0, sizeof(signs)); memset(signs, 0, sizeof(signs));
@ -1697,6 +1697,33 @@ int main(int argc, char *argv[])
} }
} }
if (sdl_key=='y')
{
++airMode;
itc = 52;
switch (airMode)
{
default:
airMode = 0;
case 0:
strcpy(itc_msg, "Air: On");
break;
case 1:
strcpy(itc_msg, "Air: Pressure Off");
break;
case 2:
strcpy(itc_msg, "Air: Velocity Off");
break;
case 3:
strcpy(itc_msg, "Air: Off");
break;
case 4:
strcpy(itc_msg, "Air: No Update");
break;
}
}
if (sdl_key=='t') if (sdl_key=='t')
VINE_MODE = !VINE_MODE; VINE_MODE = !VINE_MODE;
if (sdl_key==SDLK_SPACE) if (sdl_key==SDLK_SPACE)
@ -2246,6 +2273,7 @@ int main(int argc, char *argv[])
svf_tags[0] = 0; svf_tags[0] = 0;
svf_description[0] = 0; svf_description[0] = 0;
gravityMode = 1; gravityMode = 1;
airMode = 0;
death = death2 = 0; death = death2 = 0;
isplayer2 = 0; isplayer2 = 0;
isplayer = 0; isplayer = 0;

View File

@ -13,6 +13,8 @@ particle *parts;
particle *cb_parts; particle *cb_parts;
int gravityMode = 1; // starts enabled in "vertical" mode... int gravityMode = 1; // starts enabled in "vertical" mode...
int airMode = 0;
unsigned char bmap[YRES/CELL][XRES/CELL]; unsigned char bmap[YRES/CELL][XRES/CELL];
unsigned char emap[YRES/CELL][XRES/CELL]; unsigned char emap[YRES/CELL][XRES/CELL];