Skip to content

Commit a465a97

Browse files
committed
Adds Duration Arrows for some built-in events
1 parent 8506619 commit a465a97

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

source/funkin/backend/system/macros/Macros.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class Macros {
5858

5959
final macroPath = 'funkin.backend.system.macros.Macros';
6060
Compiler.addMetadata('@:build($macroPath.buildLimeAssetLibrary())', 'lime.utils.AssetLibrary');
61+
62+
//Adds Compat for #if hscript blocks when you have hscript improved
63+
if (Context.defined("hscript_improved") && !Context.defined("hscript")) {
64+
Compiler.define('hscript');
65+
}
6166
}
6267

6368
public static function buildLimeAssetLibrary():Array<Field> {

source/funkin/editors/charter/CharterEvent.hx

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable {
8282
}
8383

8484
/**
85-
* Pack data is a list of 4 strings separated by `________PACKSEP________`
85+
* Pack data is a list of 5 strings separated by `________PACKSEP________`
8686
* [0] Event Name
8787
* [1] Event Script
8888
* [2] Event JSON Info
@@ -276,10 +276,47 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable {
276276
}
277277

278278
case "Camera Movement":
279-
// camera movement, use health icon
280-
if(event.params != null) {
281-
var icon = getIconFromStrumline(event.params[0]);
282-
if(icon != null) return icon;
279+
var shouldDoArrow:Bool = false;
280+
var icon:Null<FlxSprite> = null;
281+
if (event.params != null) {
282+
shouldDoArrow = event.params[1] && event.params[3] != "CLASSIC"; // is Tweened and isnt Lerped
283+
icon = getIconFromStrumline(event.params[0]); // camera movement, use health icon
284+
}
285+
286+
if (icon == null) icon = generateDefaultIcon(event.name);
287+
288+
if(event.params != null && shouldDoArrow && !inMenu) {
289+
var group = new EventIconGroup();
290+
group.add(icon);
291+
group.members[0].x -= 8;
292+
group.members[0].y -= 8;
293+
generateEventIconDurationArrow(group, event.params[2]);
294+
return group;
295+
} else
296+
return icon;
297+
298+
case "Camera Position":
299+
var shouldDoArrow:Bool = false;
300+
if (event.params != null)
301+
shouldDoArrow = event.params[2] && event.params[4] != "CLASSIC"; // is Tweened and isnt Lerped
302+
303+
if(event.params != null && shouldDoArrow && !inMenu) {
304+
var group = new EventIconGroup();
305+
group.add(generateDefaultIcon(event.name));
306+
generateEventIconDurationArrow(group, event.params[3]);
307+
return group;
308+
}
309+
310+
case "Camera Zoom":
311+
var shouldDoArrow:Bool = false;
312+
if (event.params != null)
313+
shouldDoArrow = event.params[0];
314+
315+
if(event.params != null && shouldDoArrow && !inMenu) {
316+
var group = new EventIconGroup();
317+
group.add(generateDefaultIcon(event.name));
318+
generateEventIconDurationArrow(group, event.params[3]);
319+
return group;
283320
}
284321
}
285322
return generateDefaultIcon(event.name);

source/funkin/editors/charter/CharterEventGroup.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
1717
if (autoSort && members.length != __lastSort)
1818
sortEvents();
1919

20-
eventsRowText.y = FlxMath.lerp(eventsRowText.y, -40 + (members[0] != null ? Math.min(members[0].y, 0) : 0), 1/20);
20+
eventsRowText.y = FlxMath.lerp(eventsRowText.y, -40 + (members[0] != null ? Math.min(members[0].y, 0) : 0), 1/10);
2121
}
2222

2323
public override function remove(v:CharterEvent, force:Bool = true):CharterEvent {

source/funkin/options/TreeMenuScreen.hx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,26 @@ class TreeMenuScreen extends FlxSpriteGroup {
123123
updateItems();
124124
}
125125

126+
dynamic function updateItem(object:FlxSprite, itemHeight:Float, centerY:Float, lerpRatio:Float) {
127+
object.y = CoolUtil.fpsLerp(object.y, centerY - itemHeight * 0.5, lerpRatio);
128+
object.x = x + 100 - Math.pow(Math.abs((object.y - (FlxG.height - itemHeight) * 0.5) / itemHeight / FlxG.height * FlxG.initialHeight), 1.6) * 15;
129+
}
130+
126131
public function updateItems(force = false) {
127132
var r = force ? 1 : 0.25, initY = FlxG.height * 0.5;
128133
var i = curSelected, y = initY, object:FlxSprite = null, itemHeight:Float = 0;
129134

130-
inline function updateItem() {
131-
object.y = CoolUtil.fpsLerp(object.y, y - itemHeight * 0.5, r);
132-
object.x = x + 100 - Math.pow(Math.abs((object.y - (FlxG.height - itemHeight) * 0.5) / itemHeight / FlxG.height * FlxG.initialHeight), 1.6) * 15;
133-
}
134-
135135
while (i < length) if ((object = members[i++]) != null) {
136136
itemHeight = object.height;
137-
updateItem();
137+
updateItem(object, itemHeight, y, r);
138138
y += itemHeight;
139139
}
140140

141141
y = initY;
142142
i = curSelected;
143143
while (i-- > 0) if ((object = members[i]) != null) {
144144
y -= (itemHeight = object.height);
145-
updateItem();
145+
updateItem(object, itemHeight, y, r);
146146
}
147147
}
148148

0 commit comments

Comments
 (0)