diff --git a/OpenDreamClient/Rendering/DreamIcon.cs b/OpenDreamClient/Rendering/DreamIcon.cs index 80b68b4795..6ff3804a39 100644 --- a/OpenDreamClient/Rendering/DreamIcon.cs +++ b/OpenDreamClient/Rendering/DreamIcon.cs @@ -321,11 +321,9 @@ private void UpdateAnimation() { if (endAppearance.Invisibility != _appearance.Invisibility) { appearance.Invisibility = endAppearance.Invisibility; } - /* TODO maptext - if (endAppearance.MapText != _appearance.MapText) { - appearance.MapText = endAppearance.MapText; + if (endAppearance.Maptext != _appearance.Maptext) { + appearance.Maptext = endAppearance.Maptext; } - */ /* TODO suffix if (endAppearance.Suffix != _appearance.Suffix) { appearance.Suffix = endAppearance.Suffix; @@ -383,24 +381,20 @@ private void UpdateAnimation() { } */ - /* TODO maptext - if (endAppearance.MapTextWidth != _appearance.MapTextWidth) { - appearance.MapTextWidth = (ushort)Math.Clamp(((1-factor) * _appearance.MapTextWidth) + (factor * endAppearance.MapTextWidth), 0, 65535); - } - - if (endAppearance.MapTextHeight != _appearance.MapTextHeight) { - appearance.MapTextHeight = (ushort)Math.Clamp(((1-factor) * _appearance.MapTextHeight) + (factor * endAppearance.MapTextHeight), 0, 65535); + if (endAppearance.MaptextSize != _appearance.MaptextSize) { + appearance.MaptextSize = new Vector2i( + (int)Math.Round(((1-factor) * _appearance.MaptextSize.X) + (factor * endAppearance.MaptextSize.X)), + (int)Math.Round(((1-factor) * _appearance.MaptextSize.Y) + (factor * endAppearance.MaptextSize.Y)) + ); } - if (endAppearance.MapTextX != _appearance.MapTextX) { - appearance.MapTextX = (short)Math.Clamp(((1-factor) * _appearance.MapTextX) + (factor * endAppearance.MapTextX), -32768, 32767); + if (endAppearance.MaptextOffset != _appearance.MaptextOffset) { + appearance.MaptextOffset = new Vector2i( + (int)Math.Round(((1-factor) * _appearance.MaptextOffset.X) + (factor * endAppearance.MaptextOffset.X)), + (int)Math.Round(((1-factor) * _appearance.MaptextOffset.Y) + (factor * endAppearance.MaptextOffset.Y)) + ); } - if (endAppearance.MapTextY != _appearance.MapTextY) { - appearance.MapTextY = (short)Math.Clamp(((1-factor) * _appearance.MapTextY) + (factor * endAppearance.MapTextY), -32768, 32767); - } - */ - if (endAppearance.PixelOffset != _appearance.PixelOffset) { Vector2 startingOffset = appearance.PixelOffset; Vector2 newPixelOffset = Vector2.Lerp(startingOffset, endAppearance.PixelOffset, 1.0f-factor); diff --git a/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs b/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs index 8c24545377..5a6335e043 100644 --- a/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs +++ b/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs @@ -156,7 +156,7 @@ public static DreamValue NativeProc_animate(NativeProc.Bundle bundle, DreamObjec return DreamValue.Null; chainAnim = true; } - + bundle.LastAnimatedObject = new DreamValue(obj); if(obj.IsSubtypeOf(bundle.ObjectTree.Filter)) {//TODO animate filters return DreamValue.Null; @@ -210,14 +210,16 @@ public static DreamValue NativeProc_animate(NativeProc.Bundle bundle, DreamObjec /* TODO these are not yet implemented if(!pixelZ.IsNull) pixelZ = new(pixelZ.UnsafeGetValueAsFloat() + obj.GetVariable("pixel_z").UnsafeGetValueAsFloat()); //TODO change to appearance when pixel_z is implemented + */ if(!maptextWidth.IsNull) - maptextWidth = new(maptextWidth.UnsafeGetValueAsFloat() + obj.GetVariable("maptext_width").UnsafeGetValueAsFloat()); //TODO change to appearance when maptext_width is implemented + maptextWidth = new(maptextWidth.UnsafeGetValueAsFloat() + appearance.MaptextSize.X); if(!maptextHeight.IsNull) - maptextHeight = new(maptextHeight.UnsafeGetValueAsFloat() + obj.GetVariable("maptext_height").UnsafeGetValueAsFloat()); //TODO change to appearance when maptext_height is implemented + maptextHeight = new(maptextHeight.UnsafeGetValueAsFloat() + appearance.MaptextSize.Y); if(!maptextX.IsNull) - maptextX = new(maptextX.UnsafeGetValueAsFloat() + obj.GetVariable("maptext_x").UnsafeGetValueAsFloat()); //TODO change to appearance when maptext_x is implemented + maptextX = new(maptextX.UnsafeGetValueAsFloat() + appearance.MaptextOffset.X); if(!maptextY.IsNull) - maptextY = new(maptextY.UnsafeGetValueAsFloat() + obj.GetVariable("maptext_y").UnsafeGetValueAsFloat()); //TODO change to appearance when maptext_y is implemented + maptextY = new(maptextY.UnsafeGetValueAsFloat() + appearance.MaptextOffset.Y); + /* if(!luminosity.IsNull) luminosity = new(luminosity.UnsafeGetValueAsFloat() + obj.GetVariable("luminosity").UnsafeGetValueAsFloat()); //TODO change to appearance when luminosity is implemented */ @@ -273,17 +275,30 @@ public static DreamValue NativeProc_animate(NativeProc.Bundle bundle, DreamObjec } */ - /* TODO maptext if (!maptextX.IsNull) { obj.SetVariableValue("maptext_x", maptextX); - maptextX.TryGetValueAsInteger(out appearance.MapTextOffset.X); + maptextX.TryGetValueAsInteger(out appearance.MaptextOffset.X); } if (!maptextY.IsNull) { obj.SetVariableValue("maptext_y", maptextY); - maptextY.TryGetValueAsInteger(out appearance.MapTextOffset.Y); + maptextY.TryGetValueAsInteger(out appearance.MaptextOffset.Y); + } + + if (!maptextWidth.IsNull) { + obj.SetVariableValue("maptext_width", maptextWidth); + maptextX.TryGetValueAsInteger(out appearance.MaptextSize.X); + } + + if (!maptextHeight.IsNull) { + obj.SetVariableValue("maptext_y", maptextHeight); + maptextY.TryGetValueAsInteger(out appearance.MaptextSize.Y); + } + + if(!maptext.IsNull){ + obj.SetVariableValue("maptext", maptext); + maptext.TryGetValueAsString(out appearance.Maptext); } - */ if (!dir.IsNull) { obj.SetVariableValue("dir", dir); diff --git a/TestGame/code.dm b/TestGame/code.dm index 1a97d06b5e..183d892589 100644 --- a/TestGame/code.dm +++ b/TestGame/code.dm @@ -186,6 +186,8 @@ src.maptext = null; else src.maptext = "Hello!" + animate(src, maptext="Hi!", maptext_x=64, maptext_y=64, time=50) + animate(maptext_x=-64, maptext_y=-64, time=50) verb/demo_filters()