Reworking ActorProject:project to fix doQuake

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Reworking ActorProject:project to fix doQuake

#1 Post by yufra »

The setting for this little issue is the Wyrmic talent Quake, particularly used when it is near the edges of the map. The issue is that core.fov.calc_circle does not currently check for the dimensions of the map, and so you can end up with coordinates that do not exist (either negative or beyond height/width). As a first pass, here is a Lua patch that should protect from this.

Code: Select all

Index: game/engines/default/engine/interface/ActorProject.lua
===================================================================
--- game/engines/default/engine/interface/ActorProject.lua	(revision 2410)
+++ game/engines/default/engine/interface/ActorProject.lua	(working copy)
@@ -85,6 +85,7 @@
 	end
 	if typ.ball and typ.ball > 0 then
 		core.fov.calc_circle(radius_x, radius_y, typ.ball, function(_, px, py)
+			if not game.level.map(px, py) then return true end
 			-- Deal damage: ball
 			addGrid(px, py)
 			if typ.block_radius and typ:block_radius(px, py) then return true end
@@ -92,6 +93,7 @@
 		addGrid(lx, ly)
 	elseif typ.cone and typ.cone > 0 then
 		core.fov.calc_beam(radius_x, radius_y, typ.cone, initial_dir, typ.cone_angle, function(_, px, py)
+			if not game.level.map(px, py) then return true end
 			-- Deal damage: cone
 			addGrid(px, py)
 			if typ.block_radius and typ:block_radius(px, py) then return true end
@@ -250,6 +252,7 @@
 
 	if typ.ball and typ.ball > 0 then
 		core.fov.calc_circle(rx, ry, typ.ball, function(_, px, py)
+			if not game.level.map(px, py) then return true end
 			-- Deal damage: ball
 			addGrid(px, py)
 			if typ.block_radius and typ:block_radius(px, py) then return true end
@@ -258,6 +261,7 @@
 	elseif typ.cone and typ.cone > 0 then
 		local initial_dir = lx and util.getDir(lx, ly, x, y) or 5
 		core.fov.calc_beam(rx, ry, typ.cone, initial_dir, typ.cone_angle, function(_, px, py)
+			if not game.level.map(px, py) then return true end
 			-- Deal damage: cone
 			addGrid(px, py)
 			if typ.block_radius and typ:block_radius(px, py) then return true end
Now it would be nice if the core.fov calculations were checking this, and am giving that a stab next. Segfaults here I come!
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Reworking ActorProject:project to fix doQuake

#2 Post by darkgod »

I fixed it C side :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Reworking ActorProject:project to fix doQuake

#3 Post by yufra »

Great!
<DarkGod> lets say it's intended

Post Reply