Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

Commit 0eca534

Browse files
committed
changed some traces to use colored logs
1 parent bfce72b commit 0eca534

13 files changed

Lines changed: 152 additions & 134 deletions

File tree

source/FreeplayState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ class FreeplayState extends MusicBeatState
723723
}
724724
catch (e:Dynamic)
725725
{
726-
trace('Error loading/playing file! $e');
726+
Logs.traceNew('Error loading/playing file! $e', ERROR);
727727
FlxG.sound.play(Paths.sound('cancelMenu'));
728728
}
729729
#end
@@ -753,7 +753,7 @@ class FreeplayState extends MusicBeatState
753753
curDifficulty = 1;
754754
trace('Couldnt find file');
755755
}*/
756-
trace(poop);
756+
Logs.traceNew(poop, ERROR);
757757

758758
PlayState.isStoryMode = false;
759759
PlayState.storyDifficulty = curDifficulty;

source/Paths.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ class Paths
9595
// Function that initializes the first note. This way, we can recycle the notes
9696
public static function initDefaultSkin(?noteSkin:String, ?inEditor:Bool = false)
9797
{
98-
trace(noteSkin);
98+
Logs.traceNew(noteSkin, WARNING);
9999
if (noteSkin.length > 0)
100100
defaultSkin = noteSkin;
101101
else if (!PlayState.isPixelStage)
102102
defaultSkin = 'NOTE_assets' + Note.getNoteSkinPostfix();
103103
else
104104
defaultSkin = 'NOTE_assets';
105-
trace(defaultSkin);
105+
Logs.traceNew(defaultSkin, WARNING);
106106
}
107107

108108
public static function initNote(keys:Int = 4, ?noteSkin:String)
@@ -271,7 +271,7 @@ class Paths
271271

272272
inline static public function shaderFragment(key:String, ?library:String)
273273
{
274-
trace(cne_getPath('shaders/$key.frag', library));
274+
Logs.traceNew(cne_getPath('shaders/$key.frag', library), INFO);
275275
return cne_getPath('shaders/$key.frag', library);
276276
}
277277

@@ -652,7 +652,7 @@ class Paths
652652
}
653653
catch (e:Dynamic)
654654
{
655-
trace(e);
655+
Logs.traceNew(e, ERROR);
656656
}
657657
}
658658
}

source/ResetScoreSubState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class ResetScoreSubState extends MusicBeatSubstate
123123
}
124124
catch (e:Dynamic)
125125
{
126-
trace('Icon does not have an XML!');
126+
Logs.traceNew('Icon does not have an XML!', ERROR);
127127

128128
@:privateAccess {
129129
leHealthIcon.char = '';

source/Snd.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ class Snd {
11131113
mode |= FmodMode.FMOD_2D;
11141114

11151115

1116-
if( DEBUG_TRACK) trace("Snd:loading " + path);
1116+
if( DEBUG_TRACK) Logs.traceNew("Snd:loading " + path, INFO);
11171117

11181118
var snd : cpp.RawPointer<faxe.Faxe.FmodSound> = cast null;
11191119
var sndR : cpp.RawPointer<cpp.RawPointer<faxe.Faxe.FmodSound>> = cpp.RawPointer.addressOf(snd);

source/codename/backend/Script.hx

Lines changed: 110 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -17,79 +17,80 @@ import openfl.utils.Assets;
1717
/**
1818
* Class used for scripting.
1919
*/
20-
class Script extends FlxBasic implements IFlxDestroyable {
20+
class Script extends FlxBasic implements IFlxDestroyable
21+
{
2122
/**
2223
* Use "static var thing = true;" in hscript to use those!!
2324
* are reset every mod switch so once you're done with them make sure to make them null!!
2425
*/
2526
public static var staticVariables:Map<String, Dynamic> = [];
2627

27-
public static function getDefaultVariables(?script:Script):Map<String, Dynamic> {
28+
public static function getDefaultVariables(?script:Script):Map<String, Dynamic>
29+
{
2830
return [
2931
// Haxe related stuff
30-
"Std" => Std,
31-
"Math" => Math,
32-
"Reflect" => Reflect,
33-
"StringTools" => StringTools,
34-
"Json" => haxe.Json,
32+
"Std" => Std,
33+
"Math" => Math,
34+
"Reflect" => Reflect,
35+
"StringTools" => StringTools,
36+
"Json" => haxe.Json,
3537

3638
// OpenFL & Lime related stuff
37-
"Assets" => openfl.utils.Assets,
38-
"Application" => lime.app.Application,
39-
"window" => lime.app.Application.current.window,
39+
"Assets" => openfl.utils.Assets,
40+
"Application" => lime.app.Application,
41+
"window" => lime.app.Application.current.window,
4042

4143
// Flixel related stuff
42-
"FlxG" => flixel.FlxG,
43-
"FlxSprite" => flixel.FlxSprite,
44-
"FlxBasic" => flixel.FlxBasic,
45-
"FlxCamera" => flixel.FlxCamera,
46-
"state" => flixel.FlxG.state,
47-
"FlxEase" => flixel.tweens.FlxEase,
48-
"FlxTween" => flixel.tweens.FlxTween,
49-
"FlxSound" => flixel.sound.FlxSound,
50-
"FlxAssets" => flixel.system.FlxAssets,
51-
"FlxMath" => flixel.math.FlxMath,
52-
"FlxGroup" => flixel.group.FlxGroup,
53-
"FlxTypedGroup" => flixel.group.FlxGroup.FlxTypedGroup,
54-
"FlxSpriteGroup" => flixel.group.FlxSpriteGroup,
55-
"FlxTypeText" => flixel.addons.text.FlxTypeText,
56-
"FlxText" => flixel.text.FlxText,
57-
"FlxTimer" => flixel.util.FlxTimer,
58-
"FlxPoint" => ScriptUtils.getMacroAbstractClass("flixel.math.FlxPoint"),
59-
"FlxAxes" => ScriptUtils.getMacroAbstractClass("flixel.util.FlxAxes"),
60-
"FlxColor" => ScriptUtils.getMacroAbstractClass("flixel.util.FlxColor"),
61-
62-
"ModState" => codename.scripting.ModState,
63-
"ModSubState" => codename.scripting.ModSubState,
64-
"PlayState" => PlayState,
65-
"GameOverSubstate" => GameOverSubstate,
66-
"HealthIcon" => HealthIcon,
67-
"Note" => Note,
68-
"StrumNote" => StrumNote,
69-
"Character" => Character,
70-
"Boyfriend" => Boyfriend, // for compatibility
71-
"PauseSubstate" => PauseSubState,
72-
"FreeplayState" => FreeplayState,
73-
"MainMenuState" => MainMenuState,
74-
"PauseSubState" => PauseSubState,
75-
"StoryMenuState" => StoryMenuState,
76-
"TitleState" => TitleState,
44+
"FlxG" => flixel.FlxG,
45+
"FlxSprite" => flixel.FlxSprite,
46+
"FlxBasic" => flixel.FlxBasic,
47+
"FlxCamera" => flixel.FlxCamera,
48+
"state" => flixel.FlxG.state,
49+
"FlxEase" => flixel.tweens.FlxEase,
50+
"FlxTween" => flixel.tweens.FlxTween,
51+
"FlxSound" => flixel.sound.FlxSound,
52+
"FlxAssets" => flixel.system.FlxAssets,
53+
"FlxMath" => flixel.math.FlxMath,
54+
"FlxGroup" => flixel.group.FlxGroup,
55+
"FlxTypedGroup" => flixel.group.FlxGroup.FlxTypedGroup,
56+
"FlxSpriteGroup" => flixel.group.FlxSpriteGroup,
57+
"FlxTypeText" => flixel.addons.text.FlxTypeText,
58+
"FlxText" => flixel.text.FlxText,
59+
"FlxTimer" => flixel.util.FlxTimer,
60+
"FlxPoint" => ScriptUtils.getMacroAbstractClass("flixel.math.FlxPoint"),
61+
"FlxAxes" => ScriptUtils.getMacroAbstractClass("flixel.util.FlxAxes"),
62+
"FlxColor" => ScriptUtils.getMacroAbstractClass("flixel.util.FlxColor"),
63+
64+
"ModState" => codename.scripting.ModState,
65+
"ModSubState" => codename.scripting.ModSubState,
66+
"PlayState" => PlayState,
67+
"GameOverSubstate" => GameOverSubstate,
68+
"HealthIcon" => HealthIcon,
69+
"Note" => Note,
70+
"StrumNote" => StrumNote,
71+
"Character" => Character,
72+
"Boyfriend" => Boyfriend, // for compatibility
73+
"PauseSubstate" => PauseSubState,
74+
"FreeplayState" => FreeplayState,
75+
"MainMenuState" => MainMenuState,
76+
"PauseSubState" => PauseSubState,
77+
"StoryMenuState" => StoryMenuState,
78+
"TitleState" => TitleState,
7779
// "Options" => options.SelectThing,
78-
"Paths" => Paths,
79-
"Conductor" => Conductor,
80-
"FunkinShader" => codename.backend.shaders.FunkinShader,
81-
"CustomShader" => codename.backend.shaders.CustomShader,
82-
"Alphabet" => Alphabet,
80+
"Paths" => Paths,
81+
"Conductor" => Conductor,
82+
"FunkinShader" => codename.backend.shaders.FunkinShader,
83+
"CustomShader" => codename.backend.shaders.CustomShader,
84+
"Alphabet" => Alphabet,
8385

84-
"CoolUtil" => CoolUtil,
86+
"CoolUtil" => CoolUtil,
8587
];
8688
}
89+
8790
/**
8891
* All available script extensions
8992
*/
90-
public static var scriptExtensions:Array<String> = [
91-
"hx", "hscript"
92-
];
93+
public static var scriptExtensions:Array<String> = ["hx", "hscript"];
9394

9495
/**
9596
* Currently executing script.
@@ -121,9 +122,12 @@ class Script extends FlxBasic implements IFlxDestroyable {
121122
* Creates a script from the specified asset path. The language is automatically determined.
122123
* @param path Path in assets
123124
*/
124-
public static function create(path:String):Script {
125-
if (Assets.exists(path)) {
126-
return switch(Path.extension(path).toLowerCase()) {
125+
public static function create(path:String):Script
126+
{
127+
if (Assets.exists(path))
128+
{
129+
return switch (Path.extension(path).toLowerCase())
130+
{
127131
case "hx" | "hscript":
128132
new HScript(path);
129133
default:
@@ -138,8 +142,10 @@ class Script extends FlxBasic implements IFlxDestroyable {
138142
* @param code code
139143
* @param path filename
140144
*/
141-
public static function fromString(code:String, path:String):Script {
142-
return switch(Path.extension(path).toLowerCase()) {
145+
public static function fromString(code:String, path:String):Script
146+
{
147+
return switch (Path.extension(path).toLowerCase())
148+
{
143149
case "hx" | "hscript":
144150
new HScript(path).loadFromString(code);
145151
default:
@@ -151,7 +157,8 @@ class Script extends FlxBasic implements IFlxDestroyable {
151157
* Creates a new instance of the script class.
152158
* @param path
153159
*/
154-
public function new(path:String) {
160+
public function new(path:String)
161+
{
155162
super();
156163

157164
rawPath = path;
@@ -161,21 +168,24 @@ class Script extends FlxBasic implements IFlxDestroyable {
161168
extension = Path.extension(path);
162169
this.path = path;
163170
onCreate(path);
164-
for(k=>e in getDefaultVariables(this)) {
171+
for (k => e in getDefaultVariables(this))
172+
{
165173
set(k, e);
166174
}
167-
set("disableScript", () -> {
175+
set("disableScript", () ->
176+
{
168177
active = false;
169178
});
170179
set("__script__", this);
171180
}
172181

173-
174182
/**
175183
* Loads the script
176184
*/
177-
public function load() {
178-
if(didLoad) return;
185+
public function load()
186+
{
187+
if (didLoad)
188+
return;
179189

180190
var oldScript = curScript;
181191
curScript = this;
@@ -189,38 +199,36 @@ class Script extends FlxBasic implements IFlxDestroyable {
189199
* HSCRIPT ONLY FOR NOW
190200
* Sets the "public" variables map for ScriptPack
191201
*/
192-
public function setPublicMap(map:Map<String, Dynamic>) {
193-
202+
public function setPublicMap(map:Map<String, Dynamic>)
203+
{
194204
}
195205

196206
/**
197207
* Hot-reloads the script, if possible
198208
*/
199-
public function reload() {
200-
209+
public function reload()
210+
{
201211
}
202212

203213
/**
204214
* Traces something as this script.
205215
*/
206-
public function trace(v:Dynamic) {
216+
public function trace(v:Dynamic)
217+
{
207218
var fileName = this.fileName;
208-
if(remappedNames.exists(fileName))
219+
if (remappedNames.exists(fileName))
209220
fileName = remappedNames.get(fileName);
210-
// Logs.traceColored([
211-
// Logs.logText('${fileName}: ', GREEN),
212-
// Logs.logText(Std.string(v))
213-
// ], TRACE);
221+
Logs.traceNew('${fileName}: '+Std.string(v), MISC);
214222
}
215223

216-
217224
/**
218225
* Calls the function `func` defined in the script.
219226
* @param func Name of the function
220227
* @param parameters (Optional) Parameters of the function.
221228
* @return Result (if void, then null)
222229
*/
223-
public function call(func:String, ?parameters:Array<Dynamic>):Dynamic {
230+
public function call(func:String, ?parameters:Array<Dynamic>):Dynamic
231+
{
224232
var oldScript = curScript;
225233
curScript = this;
226234

@@ -234,38 +242,47 @@ class Script extends FlxBasic implements IFlxDestroyable {
234242
* Loads the code from a string, doesnt really work after the script has been loaded
235243
* @param code The code.
236244
*/
237-
public function loadFromString(code:String) {
245+
public function loadFromString(code:String)
246+
{
238247
return this;
239248
}
240249

241250
/**
242251
* Sets a script's parent object so that its properties can be accessed easily. Ex: Passing `PlayState.instance` will allow `boyfriend` to be typed instead of `PlayState.instance.boyfriend`.
243252
* @param variable Parent variable.
244253
*/
245-
public function setParent(variable:Dynamic) {}
254+
public function setParent(variable:Dynamic)
255+
{
256+
}
246257

247258
/**
248259
* Gets the variable `variable` from the script's variables.
249260
* @param variable Name of the variable.
250261
* @return Variable (or null if it doesn't exists)
251262
*/
252-
public function get(variable:String):Dynamic {return null;}
263+
public function get(variable:String):Dynamic
264+
{
265+
return null;
266+
}
253267

254268
/**
255269
* Sets the variable `variable` from the script's variables.
256270
* @param variable Name of the variable.
257271
* @return Variable (or null if it doesn't exists)
258272
*/
259-
public function set(variable:String, value:Dynamic):Void {}
273+
public function set(variable:String, value:Dynamic):Void
274+
{
275+
}
260276

261277
/**
262278
* Shows an error from this script.
263279
* @param text Text of the error (ex: Null Object Reference).
264280
* @param additionalInfo Additional information you could provide.
265281
*/
266-
public function error(text:String, ?additionalInfo:Dynamic):Void {
282+
public function error(text:String, ?additionalInfo:Dynamic):Void
283+
{
267284
var fileName = this.fileName;
268-
if(remappedNames.exists(fileName))
285+
if (remappedNames.exists(fileName))
269286
fileName = remappedNames.get(fileName);
270287
// Logs.traceColored([
271288
// Logs.logText(fileName, RED),
@@ -287,10 +304,16 @@ class Script extends FlxBasic implements IFlxDestroyable {
287304
/**
288305
* PRIVATE HANDLERS - DO NOT TOUCH
289306
*/
290-
private function onCall(func:String, parameters:Array<Dynamic>):Dynamic {
307+
private function onCall(func:String, parameters:Array<Dynamic>):Dynamic
308+
{
291309
return null;
292310
}
293-
public function onCreate(path:String) {}
294311

295-
public function onLoad() {}
296-
}
312+
public function onCreate(path:String)
313+
{
314+
}
315+
316+
public function onLoad()
317+
{
318+
}
319+
}

0 commit comments

Comments
 (0)