F3 to toggle debug markers, various visual tweaks

This commit is contained in:
Eric Myllyoja 2022-07-24 00:49:54 -04:00
parent aa0962fe62
commit 600c7e5441
2 changed files with 43 additions and 16 deletions

View file

@ -23,6 +23,7 @@ import funkin.charting.ChartingState;
import funkin.modding.IHook; import funkin.modding.IHook;
import funkin.modding.events.ScriptEvent; import funkin.modding.events.ScriptEvent;
import funkin.modding.events.ScriptEventDispatcher; import funkin.modding.events.ScriptEventDispatcher;
import funkin.play.GameOverSubstate;
import funkin.play.HealthIcon; import funkin.play.HealthIcon;
import funkin.play.Strumline.StrumlineArrow; import funkin.play.Strumline.StrumlineArrow;
import funkin.play.Strumline.StrumlineStyle; import funkin.play.Strumline.StrumlineStyle;
@ -31,15 +32,12 @@ import funkin.play.character.CharacterData;
import funkin.play.scoring.Scoring; import funkin.play.scoring.Scoring;
import funkin.play.stage.Stage; import funkin.play.stage.Stage;
import funkin.play.stage.StageData; import funkin.play.stage.StageData;
import funkin.play.GameOverSubstate;
import funkin.ui.PopUpStuff; import funkin.ui.PopUpStuff;
import funkin.ui.PreferencesMenu; import funkin.ui.PreferencesMenu;
import funkin.ui.stageBuildShit.StageOffsetSubstate; import funkin.ui.stageBuildShit.StageOffsetSubstate;
import funkin.util.Constants; import funkin.util.Constants;
import funkin.util.SortUtil; import funkin.util.SortUtil;
import lime.ui.Haptic; import lime.ui.Haptic;
import openfl.Assets;
import openfl.filters.ShaderFilter;
using StringTools; using StringTools;
@ -1344,8 +1342,6 @@ class PlayState extends MusicBeatState implements IHook
if (!isInCutscene) if (!isInCutscene)
keyShit(true); keyShit(true);
dispatchEvent(new UpdateScriptEvent(elapsed));
} }
function applyClipRect(daNote:Note):Void function applyClipRect(daNote:Note):Void

View file

@ -62,28 +62,41 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
{ {
buildStage(); buildStage();
this.refresh(); this.refresh();
debugIconGroup = new FlxSpriteGroup();
debugIconGroup.visible = false;
debugIconGroup.zIndex = 1000000;
add(debugIconGroup);
} }
public function resetStage():Void { public function resetStage():Void
{
// Reset positions of characters. // Reset positions of characters.
if (getBoyfriend() != null) { if (getBoyfriend() != null)
{
getBoyfriend().resetCharacter(false); getBoyfriend().resetCharacter(false);
} else { }
else
{
trace('STAGE RESET: No boyfriend found.'); trace('STAGE RESET: No boyfriend found.');
} }
if (getGirlfriend() != null) { if (getGirlfriend() != null)
{
getGirlfriend().resetCharacter(false); getGirlfriend().resetCharacter(false);
} }
if (getDad() != null) { if (getDad() != null)
{
getDad().resetCharacter(false); getDad().resetCharacter(false);
} }
// Reset positions of named props. // Reset positions of named props.
for (dataProp in _data.props) { for (dataProp in _data.props)
{
// Fetch the prop. // Fetch the prop.
var prop:FlxSprite = getNamedProp(dataProp.name); var prop:FlxSprite = getNamedProp(dataProp.name);
if (prop != null) { if (prop != null)
{
// Reset the position. // Reset the position.
prop.x = dataProp.position[0]; prop.x = dataProp.position[0];
prop.y = dataProp.position[1]; prop.y = dataProp.position[1];
@ -104,6 +117,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
this.camZoom = _data.cameraZoom; this.camZoom = _data.cameraZoom;
this.debugIconGroup = new FlxSpriteGroup();
for (dataProp in _data.props) for (dataProp in _data.props)
{ {
trace(' Placing prop: ${dataProp.name} (${dataProp.assetPath})'); trace(' Placing prop: ${dataProp.name} (${dataProp.assetPath})');
@ -270,6 +285,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
clipRectTransform(sprite, clipRect); clipRectTransform(sprite, clipRect);
} }
var debugIconGroup:FlxSpriteGroup;
/** /**
* Used by the PlayState to add a character to the stage. * Used by the PlayState to add a character to the stage.
*/ */
@ -348,8 +365,8 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
// Add the character to the scene. // Add the character to the scene.
this.add(character); this.add(character);
this.add(debugIcon); debugIconGroup.add(debugIcon);
this.add(debugIcon2); debugIconGroup.add(debugIcon2);
} }
public inline function getGirlfriendPosition():FlxPoint public inline function getGirlfriendPosition():FlxPoint
@ -512,6 +529,14 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
} }
} }
group.clear(); group.clear();
if (debugIconGroup != null && debugIconGroup.group != null)
{
debugIconGroup.kill();
}
else
{
debugIconGroup = null;
}
} }
/** /**
@ -535,6 +560,14 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
} }
} }
public function onUpdate(event:UpdateScriptEvent)
{
if (FlxG.keys.justPressed.F3)
{
debugIconGroup.visible = !debugIconGroup.visible;
}
}
public function onScriptEvent(event:ScriptEvent) {} public function onScriptEvent(event:ScriptEvent) {}
public function onPause(event:PauseScriptEvent) {} public function onPause(event:PauseScriptEvent) {}
@ -553,8 +586,6 @@ class Stage extends FlxSpriteGroup implements IHook implements IPlayStateScripte
public function onCountdownEnd(event:CountdownScriptEvent) {} public function onCountdownEnd(event:CountdownScriptEvent) {}
public function onUpdate(event:UpdateScriptEvent) {}
public function onNoteHit(event:NoteScriptEvent) {} public function onNoteHit(event:NoteScriptEvent) {}
public function onNoteMiss(event:NoteScriptEvent) {} public function onNoteMiss(event:NoteScriptEvent) {}