summaryrefslogtreecommitdiff
path: root/src/luaconsole.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-12-10 16:11:03 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-12-18 14:04:47 (GMT)
commitc819e2655e41363d0d416d478abe2804d40c1a95 (patch)
tree4889d45b1010351687c568d23ecc93a744c1f692 /src/luaconsole.c
parent934d1da66eb5aec49769feaf00d0949f805fd3d5 (diff)
downloadpowder-c819e2655e41363d0d416d478abe2804d40c1a95.zip
powder-c819e2655e41363d0d416d478abe2804d40c1a95.tar.gz
Fix some gravity memsets, remove gravx/y
Diffstat (limited to 'src/luaconsole.c')
-rw-r--r--src/luaconsole.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c
index 9482e7d..7cbbfa1 100644
--- a/src/luaconsole.c
+++ b/src/luaconsole.c
@@ -462,21 +462,22 @@ int luatpt_reset_gravity_field(lua_State* l)
int x1, y1, width, height;
x1 = abs(luaL_optint(l, 1, 0));
y1 = abs(luaL_optint(l, 2, 0));
- width = abs(luaL_optint(l, 3, XRES/CELL));
- height = abs(luaL_optint(l, 4, YRES/CELL));
- if(x1 > (XRES/CELL)-1)
- x1 = (XRES/CELL)-1;
- if(y1 > (YRES/CELL)-1)
- y1 = (YRES/CELL)-1;
- if(x1+width > (XRES/CELL)-1)
- width = (XRES/CELL)-x1;
- if(y1+height > (YRES/CELL)-1)
- height = (YRES/CELL)-y1;
+ width = abs(luaL_optint(l, 3, XRES));
+ height = abs(luaL_optint(l, 4, YRES));
+ if(x1 > XRES-1)
+ x1 = XRES-1;
+ if(y1 > YRES-1)
+ y1 = YRES-1;
+ if(x1+width > XRES-1)
+ width = XRES-x1;
+ if(y1+height > YRES-1)
+ height = YRES-y1;
for (nx = x1; nx<x1+width; nx++)
for (ny = y1; ny<y1+height; ny++)
{
- gravx[ny][nx] = 0;
- gravy[ny][nx] = 0;
+ gravxf[ny*XRES+nx] = 0;
+ gravyf[ny*XRES+nx] = 0;
+ gravpf[ny*XRES+nx] = 0;
}
return 0;
}