mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Ported nearest-neighbor scaling from TG
This commit is contained in:
@@ -836,3 +836,22 @@ proc/adjust_brightness(var/color, var/value)
|
||||
RGB[2] = Clamp(RGB[2]+value,0,255)
|
||||
RGB[3] = Clamp(RGB[3]+value,0,255)
|
||||
return rgb(RGB[1],RGB[2],RGB[3])
|
||||
|
||||
proc/sort_atoms_by_layer(var/list/atoms)
|
||||
// Comb sort icons based on levels
|
||||
var/list/result = atoms.Copy()
|
||||
var/gap = result.len
|
||||
var/swapped = 1
|
||||
while (gap > 1 || swapped)
|
||||
swapped = 0
|
||||
if(gap > 1)
|
||||
gap = round(gap / 1.3) // 1.3 is the emperic comb sort coefficient
|
||||
if(gap < 1)
|
||||
gap = 1
|
||||
for(var/i = 1; gap + i <= result.len; i++)
|
||||
var/atom/l = result[i] //Fucking hate
|
||||
var/atom/r = result[gap+i] //how lists work here
|
||||
if(l.layer > r.layer) //no "result[i].layer" for me
|
||||
result.Swap(i, gap + i)
|
||||
swapped = 1
|
||||
return result
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
/obj/item/weapon/photo/proc/show(mob/user as mob)
|
||||
user << browse_rsc(img, "tmp_photo.png")
|
||||
user << browse("<html><head><title>[name]</title></head>" \
|
||||
+ "<body style='overflow:hidden'>" \
|
||||
+ "<div> <img src='tmp_photo.png' width = '180'" \
|
||||
+ "[scribble ? "<div> Written on the back:<br><i>[scribble]</i>" : ]"\
|
||||
+ "</body></html>", "window=book;size=200x[scribble ? 400 : 200]")
|
||||
+ "<body style='overflow:hidden;margin:0;text-align:center'>" \
|
||||
+ "<img src='tmp_photo.png' width='192' style='-ms-interpolation-mode:nearest-neighbor' />" \
|
||||
+ "[scribble ? "<br>Written on the back:<br><i>[scribble]</i>" : ""]"\
|
||||
+ "</body></html>", "window=book;size=192x[scribble ? 400 : 192]")
|
||||
onclose(user, "[name]")
|
||||
return
|
||||
|
||||
@@ -166,18 +166,8 @@
|
||||
if(A.invisibility) continue
|
||||
atoms.Add(A)
|
||||
|
||||
//Sorting icons based on levels.
|
||||
//JMO: I have no idea what they were doing here before, but the magic number alone
|
||||
// was worth replacing it over. "gap = round(gap / 1.247330950103979)" really?
|
||||
var/list/sorted = list()
|
||||
var/j
|
||||
for(var/i = 1 to atoms.len)
|
||||
var/atom/c = atoms[i]
|
||||
for(j = sorted.len, j > 0, --j)
|
||||
var/atom/c2 = sorted[j]
|
||||
if(c2.layer <= c.layer)
|
||||
break
|
||||
sorted.Insert(j+1, c)
|
||||
// Sort the atoms into their layers
|
||||
var/list/sorted = sort_atoms_by_layer(atoms)
|
||||
|
||||
for(var/i; i <= sorted.len; i++)
|
||||
var/atom/A = sorted[i]
|
||||
@@ -222,6 +212,9 @@
|
||||
|
||||
var/icon/temp = icon('icons/effects/96x96.dmi',"")
|
||||
var/icon/black = icon('icons/turf/space.dmi', "black")
|
||||
// Initialize the photograph to black.
|
||||
temp.Blend("#000", ICON_OVERLAY)
|
||||
|
||||
var/mobs = ""
|
||||
for(var/i = 1; i <= 3; i++)
|
||||
for(var/j = 1; j <= 3; j++)
|
||||
|
||||
Reference in New Issue
Block a user