Patched display and dealt with lying.

This commit is contained in:
JimTheCactus
2014-07-27 22:05:24 -06:00
parent 646aad945e
commit 1d7310c49d
2 changed files with 32 additions and 24 deletions

View File

@@ -637,7 +637,7 @@ The _flatIcons list is a cache for generated icon files.
proc // Creates a single icon from a given /atom or /image. Only the first argument is required.
getFlatIcon(image/A, defdir=A.dir, deficon=A.icon, defstate=A.icon_state, defblend=A.blend_mode)
// We start with a blank canvas, otherwise some icon procs crash silently
var/icon/flat = icon('icons/effects/effects.dmi', "nothing") // Final flattened icon
var/icon/flat = icon('icons/effects/effects.dmi', "icon_state"="nothing") // Final flattened icon
if(!A)
return flat
if(A.alpha <= 0)
@@ -666,7 +666,7 @@ proc // Creates a single icon from a given /atom or /image. Only the first argu
noIcon = TRUE // Do not render this object.
var/curdir
if(A.dir)
if(A.dir != 2)
curdir = A.dir
else
curdir = defdir
@@ -682,6 +682,7 @@ proc // Creates a single icon from a given /atom or /image. Only the first argu
var/image/copy
// Add the atom's icon itself, without pixel_x/y offsets.
if(!noIcon)
world.log << "***Rendering Icon [A.type] in state '[curstate]' on layer [A.layer] in direction [curdir]" // #JMO
copy = image(icon=curicon, icon_state=curstate, layer=A.layer, dir=curdir)
copy.color = A.color
copy.alpha = A.alpha
@@ -744,6 +745,7 @@ proc // Creates a single icon from a given /atom or /image. Only the first argu
curblend = BLEND_OVERLAY
add = icon(I:icon, I:icon_state, I:dir)
else // 'I' is an appearance object.
world.log << "***Recursing to render Icon [I:type] in state '[curstate]' in direction [curdir]" // #JMO
add = getFlatIcon(new/image(I), curdir, curicon, curstate, curblend)
// Find the new dimensions of the flat icon to fit the added overlay

View File

@@ -157,36 +157,41 @@
//i.e. pretty much all wall-mounted machinery
var/icon/res = icon('icons/effects/96x96.dmi', "")
var/icon/turficon = build_composite_icon(the_turf)
res.Blend(turficon, ICON_OVERLAY, 33, 33)
world.log << "***Calling build composite..." //#JMO
//var/icon/turficon = build_composite_icon(the_turf)
res.Blend(getFlatIcon(the_turf), blendMode2iconMode(the_turf.blend_mode),33,33)
world.log << "***Exiting build composite..." //#JMO
//res.Blend(turficon, ICON_OVERLAY, 33, 33)
var/atoms[] = list()
for(var/atom/A in the_turf)
if(A.invisibility) continue
atoms.Add(A)
//Sorting icons based on levels
var/gap = atoms.len
var/swapped = 1
while (gap > 1 || swapped)
swapped = 0
if(gap > 1)
gap = round(gap / 1.247330950103979)
if(gap < 1)
gap = 1
for(var/i = 1; gap + i <= atoms.len; i++)
var/atom/l = atoms[i] //Fucking hate
var/atom/r = atoms[gap+i] //how lists work here
if(l.layer > r.layer) //no "atoms[i].layer" for me
atoms.Swap(i, gap + i)
swapped = 1
//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)
for(var/i; i <= atoms.len; i++)
var/atom/A = atoms[i]
for(var/i; i <= sorted.len; i++)
var/atom/A = sorted[i]
if(A)
var/icon/img = getFlatIcon(A, A.dir)//build_composite_icon(A)
if(istype(img, /icon))
res.Blend(new/icon(img, "", A.dir), ICON_OVERLAY, 33 + A.pixel_x, 33 + A.pixel_y)
world.log << "**Calling getFlatIcon to render [A.type]" //#JMO
var/icon/img = getFlatIcon(A)//build_composite_icon(A)
if(istype(A, /mob/living) && A:lying)
world.log << "[A.type] is lying down. Making it look as such..." // #JMO;
img.BecomeLying()
//if(istype(img, /icon))
res.Blend(img, blendMode2iconMode(A.blend_mode), 33 + A.pixel_x, 33 + A.pixel_y)
return res
@@ -220,6 +225,7 @@
var/icon/temp = icon('icons/effects/96x96.dmi',"")
var/icon/black = icon('icons/turf/space.dmi', "black")
var/mobs = ""
world << "Proof that this thing is alive! 1.0" // #JMO
for(var/i = 1; i <= 3; i++)
for(var/j = 1; j <= 3; j++)
var/turf/T = locate(x_c, y_c, z_c)