shithub: sce

Download patch

ref: 10c73e7824f0d79cf910152355fe3d8fe0c0018e
parent: 12a568ab18771c9dd4d6aa47365ae2c4530b0c55
author: qwx <qwx@sciops.net>
date: Sat Dec 11 20:37:12 EST 2021

small typos

several pathfinding issues stem from the heuristics
for finding the nearest non-jump node to the target
being completely broken; not easy to fix, and all
of this shit is the wrong approach anyway

--- a/path.c
+++ b/path.c
@@ -489,6 +489,7 @@
 	return rectXrect(insetrect(r1, -1), r2);
 }
 
+/* FIXME: completely broken */
 static Node *
 nearestnonjump(Node *n, Node *b, Mobj *mo)
 {
@@ -525,6 +526,7 @@
 	return min;
 }
 
+/* FIXME: completely broken */
 void
 setgoal(Point *p, Mobj *mo, Mobj *block)
 {
@@ -631,8 +633,10 @@
 		a->y = mo->y;
 		b->x = (b - nodemap) % nodemapwidth;
 		b->y = (b - nodemap) / nodemapwidth;
-		if((n = a∗(a, b, mo)) == nil)
-			sysfatal("findpath: phase error");
+		if((n = a∗(a, b, mo)) != b){
+			werrstr("bug: failed to find path to nearest non-jump point");
+			return -1;
+		}
 	}
 	markmobj(mo, 1);
 	backtrack(n, a, mo);
--- a/sim.return.c
+++ b/sim.return.c
@@ -73,7 +73,7 @@
 	Command *c;
 
 	if((c = pushcommand(mo)) == nil){
-		fprint(2, "pushmovecommand: %r\n");
+		fprint(2, "pushreturncommand: %r\n");
 		return -1;
 	}
 	if((c->target1 = finddrop(mo)) == nil)