From 1d1e9a61356db93dce33ec0be361c76ef1970fd9 Mon Sep 17 00:00:00 2001 From: ineedbots Date: Mon, 10 May 2021 13:40:48 -0600 Subject: [PATCH] More updates :D --- maps/mp/bots/_bot_utility.gsc | 18 ++++++++++----- maps/mp/bots/_wp_editor.gsc | 43 ++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/maps/mp/bots/_bot_utility.gsc b/maps/mp/bots/_bot_utility.gsc index 3db8c03..fe73714 100644 --- a/maps/mp/bots/_bot_utility.gsc +++ b/maps/mp/bots/_bot_utility.gsc @@ -1055,12 +1055,18 @@ _WaypointsToKDTree(waypoints, dem) callbacksort = undefined; - if (dem == 0) // COMPILER bug! cannot assign variables outside the switch statement - callbacksort = ::HeapSortCoordX; - else if (dem == 1) - callbacksort = ::HeapSortCoordY; - else - callbacksort = ::HeapSortCoordZ; + switch(dem) + { + case 0: + callbacksort = ::HeapSortCoordX; + break; + case 1: + callbacksort = ::HeapSortCoordY; + break; + case 2: + callbacksort = ::HeapSortCoordZ; + break; + } heap = NewHeap(callbacksort); diff --git a/maps/mp/bots/_wp_editor.gsc b/maps/mp/bots/_wp_editor.gsc index 02318bf..0e2f10d 100644 --- a/maps/mp/bots/_wp_editor.gsc +++ b/maps/mp/bots/_wp_editor.gsc @@ -18,7 +18,6 @@ init() if(!getDVarint("bots_main_debug")) return; - // COMPILER until gsc can be ran on the client... /*if(!getDVarint("developer")) { setdvar("developer_script", 1); @@ -152,7 +151,8 @@ test() // test heap sorting - sort = NewHeap(maps\mp\bots\_bot_utility::ReverseHeap); + // DECOMPILER, for loops extra ; + sort = NewHeap(maps\mp\bots\_bot_utility::ReverseHeap); // COMPILER needs func pointers include search sort HeapInsert(3); sort HeapInsert(4); sort HeapInsert(1); @@ -284,6 +284,23 @@ drawWaypoint(i) level.drawn_wps[level.drawn_wps.size] = newdeathicon; } +drawPath(where) +{ + if (!isDefined(level.drawn_wps)) + level.drawn_wps = []; + + newdeathicon = newHudElem(); + newdeathicon.x = where[0]; + newdeathicon.y = where[1]; + newdeathicon.z = where[2] + 20; + newdeathicon.alpha = .61; + newdeathicon.archived = true; + newdeathicon setShader("headicon_dead", 5, 5); + newdeathicon setwaypoint( true, false ); + + level.drawn_wps[level.drawn_wps.size] = newdeathicon; +} + clearWaypoints() { if (!isDefined(level.drawn_wps)) @@ -389,7 +406,6 @@ updateWaypointsStats() myAngles = self GetPlayerAngles(); timeToUpdate = ((intTimer % getDvarInt("bots_main_debug_updateRate")) == 0); - // COMPILER need client gsc if (timeToUpdate) { clearWaypoints(); @@ -405,7 +421,6 @@ updateWaypointsStats() if(distance(level.waypoints[i].origin, self.origin) < getDvarFloat("bots_main_debug_distance") && (bulletTracePassed(myEye, wpOrg, false, self) || getDVarint("bots_main_debug_drawThrough"))) { - // COMPILER need client gsc if (timeToUpdate) { if(getConeDot(wpOrg, myEye, myAngles) > getDvarFloat("bots_main_debug_cone")) @@ -417,7 +432,7 @@ updateWaypointsStats() } } - // COMPILER need client gsc + // mw3 doesnt have debug gsc calls :( /*for(h = 0; h < level.waypoints[i].childCount; h++) line(wpOrg, level.waypoints[level.waypoints[i].children[h]].origin + (0, 0, 25), (1,0,1)); @@ -452,10 +467,15 @@ updateWaypointsStats() self iPrintLnBold(self.nearest + " children: " + buildChildString(self.nearest)); } - /*if (isDefined(self.astar)) + if (isDefined(self.astar)) { - print3d(self.astar.start + (0, 0, 35), "start", (0,0,1), 2); - print3d(self.astar.goal + (0, 0, 35), "goal", (0,0,1), 2); + //print3d(self.astar.start + (0, 0, 35), "start", (0,0,1), 2); + //print3d(self.astar.goal + (0, 0, 35), "goal", (0,0,1), 2); + if (timeToUpdate) + { + drawPath(self.astar.start); + drawPath(self.astar.goal); + } prev = self.astar.start + (0, 0, 35); @@ -463,13 +483,14 @@ updateWaypointsStats() { node = self.astar.nodes[i]; - line(prev, level.waypoints[node].origin + (0, 0, 35), (0,1,1)); + //line(prev, level.waypoints[node].origin + (0, 0, 35), (0,1,1)); + if (timeToUpdate) drawPath(level.waypoints[node].origin); prev = level.waypoints[node].origin + (0, 0, 35); } - line(prev, self.astar.goal + (0, 0, 35), (0,1,1)); - }*/ + //line(prev, self.astar.goal + (0, 0, 35), (0,1,1)); + } } }