shithub: sce

Download patch

ref: 88e2efdc548c93b45b9f84bcab27b1d437873a65
parent: f65f1bb7adbcd97e8738d15c37903338d8885570
author: qwx <qwx@sciops.net>
date: Thu Apr 1 04:02:56 EDT 2021

map: fix node→map coordinate conversion

--- a/drw.c
+++ b/drw.c
@@ -365,7 +365,6 @@
 static Rectangle
 setdrawrect(void)
 {
-	int f;
 	Rectangle r;
 
 	r.min.x = pan.x / scale / Tilewidth;
--- a/map.c
+++ b/map.c
@@ -62,7 +62,7 @@
 			return -1;
 		}
 	}else if((o->f & Fair) == 0){
-		m = map + (y * mapwidth + x) / Node2Tile;
+		m = map + y / Node2Tile * mapwidth + x / Node2Tile;
 		for(mo=nil, ml=m->ml.l; ml!=&m->ml; ml=ml->l){
 			mo = ml->mo;
 			for(os=mo->o->spawn, n=mo->o->nspawn; n>0; n--, os++)
--- a/sim.c
+++ b/sim.c
@@ -39,7 +39,7 @@
 {
 	Map *m;
 
-	m = map + (mo->y * mapwidth + mo->x) / Node2Tile;
+	m = map + mo->y / Node2Tile * mapwidth + mo->x / Node2Tile;
 	mo->mobjl = linkmobj(mo->f & Fair ? m->ml.lp : &m->ml, mo, mo->mobjl);
 }