summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-04 18:26:28 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-04 18:26:28 (GMT)
commit5a37f32ca12a48432af5be190245d2a377005e49 (patch)
tree37debebea7e19e5529accdbdd2a3329189cb3014 /src
parent5b86cd5c217efa50df96a2ad36ee137646387655 (diff)
downloadpowder-5a37f32ca12a48432af5be190245d2a377005e49.zip
powder-5a37f32ca12a48432af5be190245d2a377005e49.tar.gz
update with simon, and shift-v now does every other frame properly
Diffstat (limited to 'src')
-rw-r--r--src/main.c79
-rw-r--r--src/powder.c44
2 files changed, 89 insertions, 34 deletions
diff --git a/src/main.c b/src/main.c
index 59fcea4..c5fc100 100644
--- a/src/main.c
+++ b/src/main.c
@@ -477,6 +477,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
if(replace)
{
+ gravityMode = 1;
memset(bmap, 0, sizeof(bmap));
memset(emap, 0, sizeof(emap));
memset(signs, 0, sizeof(signs));
@@ -1515,6 +1516,29 @@ int main(int argc, char *argv[])
else
GRID_MODE = (GRID_MODE+1)%10;
}
+
+ if(sdl_key=='w') //Gravity, by Moach
+ {
+ ++gravityMode; // cycle gravity mode
+ itc = 51;
+
+ switch (gravityMode)
+ {
+ default:
+ gravityMode = 0;
+ case 0:
+ strcpy(itc_msg, "Gravity: Off");
+ break;
+ case 1:
+ strcpy(itc_msg, "Gravity: Vertical");
+ break;
+ case 2:
+ strcpy(itc_msg, "Gravity: Radial");
+ break;
+
+ }
+ }
+
if(sdl_key=='t')
VINE_MODE = !VINE_MODE;
if(sdl_key==SDLK_SPACE)
@@ -1590,32 +1614,33 @@ int main(int argc, char *argv[])
}
}
#ifdef INTERNAL
- int counterthing;
- if(sdl_key=='v')
- {
- if(sdl_mod & (KMOD_SHIFT)){
- if(vs>=1)
- vs = 0;
- else
- vs = 2;
- }
- else{
- if(vs>=1)
- vs = 0;
- else
- vs = 1;
+ int counterthing;
+ if(sdl_key=='v'&&!(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
+ {
+ if(sdl_mod & (KMOD_SHIFT)){
+ if(vs>=1)
+ vs = 0;
+ else
+ vs = 3;//every other frame
+ }
+ else
+ {
+ if(vs>=1)
+ vs = 0;
+ else
+ vs = 1;
+ }
+ counterthing = 0;
}
- counterthing = 0;
- }
if(vs)
- {
- if(counterthing+1>=vs)
- {
- dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
- counterthing = 0;
- }
- counterthing = (counterthing+1)%3;
- }
+ {
+ if(counterthing+1>=vs)
+ {
+ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
+ counterthing = 0;
+ }
+ counterthing = (counterthing+1)%3;
+ }
#endif
if(sdl_wheel)
@@ -2033,6 +2058,8 @@ int main(int argc, char *argv[])
svf_id[0] = 0;
svf_name[0] = 0;
svf_tags[0] = 0;
+ svf_description[0] = 0;
+ gravityMode = 1;
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
memset(fire_r, 0, sizeof(fire_r));
@@ -2386,6 +2413,10 @@ int main(int argc, char *argv[])
strappend(uitext, " [CAP LOCKS]");
if(GRID_MODE)
sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE);
+#ifdef INTERNAL
+ if(vs)
+ strappend(uitext, " [FRAME CAPTURE]");
+#endif
if(sdl_zoom_trig||zoom_en)
{
diff --git a/src/powder.c b/src/powder.c
index 5409ee9..908b15e 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -12,6 +12,8 @@ float player2[27];
particle *parts;
particle *cb_parts;
+int gravityMode = 1; // starts enabled in "vertical" mode...
+
unsigned char bmap[YRES/CELL][XRES/CELL];
unsigned char emap[YRES/CELL][XRES/CELL];
@@ -1073,6 +1075,8 @@ void update_particles_i(pixel *vid, int start, int inc)
float c_heat = 0.0f;
int h_count = 0;
int starti = (start*-1);
+ float pGravX, pGravY, pGravD;
+
if(sys_pause&&!framerender)
return;
if(ISGRAV==1)
@@ -1500,16 +1504,36 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else
{
- if(t==PT_ANAR)
- {
- parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL];
- parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
- }
- else{
- parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
- parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
-
- }
+ //Gravity mode by Moach
+ switch (gravityMode)
+ {
+ default:
+ case 0:
+ pGravX = pGravY = 0.0f;
+ break;
+ case 1:
+ pGravX = 0.0f;
+ pGravY = ptypes[t].gravity;
+ break;
+ case 2:
+
+ pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
+
+ pGravX = ptypes[t].gravity * ((float)(x - XCNTR) / pGravD);
+ pGravY = ptypes[t].gravity * ((float)(y - YCNTR) / pGravD);
+
+ }
+
+ if(t==PT_ANAR)
+ {
+ parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX;
+ parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY;
+ }
+ else{
+ parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX;
+ parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY;
+
+ }
}
if(ptypes[t].diffusion)