Misc. Optimizations (#3993)

changes:

Overlays now creates less temporary lists.
Falling no longer queues unsimulated atoms that wouldn't fall anyways (incl. LOs).
Pixel-shifted AO is now cached too.
Changed some references to get_map_cell() to macro equivalents in random maps.
Added smoothing hinting to the icon smoother, allowing for major performance improvements in common cases.
Space initialization no longer involves appearance churn (and is much faster as a result).
This commit is contained in:
Lohikar
2017-12-23 21:27:51 +02:00
committed by Erki
parent 64d24c6979
commit bb5a34eaf8
12 changed files with 213 additions and 131 deletions
+18 -10
View File
@@ -162,7 +162,7 @@
..()
update()
/turf/simulated/open/Initialize()
/turf/simulated/open/Initialize(mapload)
. = ..()
icon_state = "" // Clear out the debug icon.
SSopenturf.openspace_turfs += src
@@ -170,23 +170,31 @@
if (no_mutate && plane == PLANE_SPACE_BACKGROUND)
// If the plane is default and we're a no_mutate turf, force it to 0 so the icon works properly.
plane = 0
update()
update(mapload)
/**
* Updates the turf with open turf's variables and basically resets it properly.
*/
/turf/simulated/open/proc/update()
/turf/simulated/open/proc/update(mapload = FALSE)
below = GetBelow(src)
// Edge case for when an open turf is above space on the lowest level.
if (below)
below.above = src
levelupdate()
if (is_hole)
for (var/atom/movable/A in src)
ADD_FALLING_ATOM(A)
update_icon()
if (mapload)
for (var/obj/O in src) // We're not going to try to make mobs fall here for performance reasons - they shouldn't be mapped in on openturfs anyways.
if (is_hole && O.simulated)
ADD_FALLING_ATOM(O)
else
for (var/thing in src)
var/obj/O = thing // This might not be an obj.
if (isobj(O))
O.hide(0)
if (is_hole && O.simulated)
ADD_FALLING_ATOM(O)
update_icon(mapload)
/turf/simulated/open/update_dirt()
return 0
@@ -196,12 +204,12 @@
for(var/obj/O in src)
O.hide(0)
/turf/simulated/open/update_icon()
/turf/simulated/open/update_icon(mapload)
if(!updating && below)
updating = TRUE
SSopenturf.queued_turfs += src
if (above) // Even if we're already updating, the turf above us might not be.
if (!mapload && above) // Even if we're already updating, the turf above us might not be.
// Cascade updates until we hit the top openturf.
above.update_icon()