From d5fe05d76079fda752fa3f6be26abdcd828d1f26 Mon Sep 17 00:00:00 2001 From: Cate Date: Wed, 9 Feb 2011 23:17:57 +0800 Subject: [PATCH] "Added Air modes using Gravitymode code" --- includes/powder.h | 1 + src/air.c | 26 ++++++++++++++++++++++++++ src/main.c | 30 +++++++++++++++++++++++++++++- src/powder.c | 2 ++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/includes/powder.h b/includes/powder.h index 1b2824ecc..5e1639372 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -778,6 +778,7 @@ extern float player[27]; extern float player2[27]; extern int gravityMode; +extern int airMode; extern particle *parts; extern particle *cb_parts; diff --git a/src/air.c b/src/air.c index e9a8b9e93..aaf42d265 100644 --- a/src/air.c +++ b/src/air.c @@ -33,6 +33,9 @@ void update_air(void) { int x, y, i, j; float dp, dx, dy, f, tx, ty; + +if (airMode != 4) { + for (i=0; i 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; ovy[y][x] = dy; opv[y][x] = dp; @@ -185,3 +210,4 @@ void update_air(void) memcpy(vy, ovy, sizeof(vy)); memcpy(pv, opv, sizeof(pv)); } +} diff --git a/src/main.c b/src/main.c index 03bffa96d..3a2ae3fd0 100644 --- a/src/main.c +++ b/src/main.c @@ -543,7 +543,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if (replace) { gravityMode = 1; - + airMode = 1; memset(bmap, 0, sizeof(bmap)); memset(emap, 0, sizeof(emap)); 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') VINE_MODE = !VINE_MODE; if (sdl_key==SDLK_SPACE) @@ -2246,6 +2273,7 @@ int main(int argc, char *argv[]) svf_tags[0] = 0; svf_description[0] = 0; gravityMode = 1; + airMode = 0; death = death2 = 0; isplayer2 = 0; isplayer = 0; diff --git a/src/powder.c b/src/powder.c index 5a60d0d65..74f450799 100644 --- a/src/powder.c +++ b/src/powder.c @@ -13,6 +13,8 @@ particle *parts; particle *cb_parts; int gravityMode = 1; // starts enabled in "vertical" mode... +int airMode = 0; + unsigned char bmap[YRES/CELL][XRES/CELL]; unsigned char emap[YRES/CELL][XRES/CELL];