Skip to content

Commit

Permalink
monthly major commit
Browse files Browse the repository at this point in the history
broke the chart editor again
remove latest lime and openfl shit
color blind filters (thanks em for the idea)
multiple icon fixes
clean some code to make things more modular
optimize some input maybe
  • Loading branch information
TheRealJake12 committed Nov 2, 2024
1 parent cd64ce2 commit 4ff479f
Show file tree
Hide file tree
Showing 25 changed files with 695 additions and 2,144 deletions.
57 changes: 0 additions & 57 deletions Preloader.hx

This file was deleted.

4 changes: 1 addition & 3 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<!-- ____________________________ Window Settings ___________________________ -->
<!-- These window settings apply to all targets -->
<window width="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" />
<window antialiasing="0" allow-high-dpi="true"/>
<window antialiasing="0" allow-high-dpi="true" />
<!-- HTML5-specific -->
<window if="html5" resizable="true" />
<!-- Desktop-specific -->
Expand Down Expand Up @@ -114,7 +114,6 @@
<haxedef name="haxeui_allow_drag_any_component" value="true" />
<haxedef name="haxeui_flixel_no_custom_cursors" value="true" />
<haxedef name="haxeui_dont_impose_base_class" value="true" />
<haxedef name="openfl_enable_experimental_update_queue"/>
<section if="COMPILE_ALL_CLASSES">
<haxeflag name="-dce" value="no" />
<haxeflag name="--macro" value="ClassMacro.addAdditionalClasses()" />
Expand All @@ -126,7 +125,6 @@
</section>
<!-- Basically Allows Videos To Render In Higher Quality On Higher Resoluttions -->
<haxedef name="openfl_dpi_aware" unless="web" />

<haxedef name="haxeui_focus_out_on_click" />
<!-- Tired Of HaxeUI Breaking Things -->
<haxeflag name="--macro" value="include('haxe.ui.backend.flixel.components')" />
Expand Down
39 changes: 18 additions & 21 deletions assets/shared/data/editors/charter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<menu text="Chart" style="padding: 5px;">
<menu-item id="chartSave" text="Save Chart" />
<menu-item id="chartReload" text="Reload Chart" />
<!--
<menu-item id="chartLoadAuto" text="Load Autosave" />
<menu-item id="chartClear" text="Clear Chart" />
-->
</menu>
<menu text="Preferences" style="padding: 5px;">
<menu-checkbox id="editorDrag" text="Drag Editor" />
<menu-item id="editorReset" text="Reset Editor Position" />
<menu-checkbox id="editorAutoSave" text="Autosave Chart" />
<menu-separator />
<vbox width="100%" style="padding: 5px;">
<label width="100%" styleName="menuHeader" text="Metronome Volume" verticalAlign="center" />
Expand All @@ -34,36 +35,30 @@
<vbox text="Assets">
<frame width="350" height="350">
<vbox>
<hbox>
<grid>
<label text="Player" horizontalAlign="center" />
<spacer width="75" />
<label text="GF" horizontalAlign="center" />
<spacer width="75" />
<label text="Opponent" verticalAlign="center" />
</hbox>
<hbox>
<dropdown id="playerSelect" width="75" horizontalAlign="center" />
<spacer />
<label text="GF" horizontalAlign="center" />
<dropdown id="gfSelect" width="75" horizontalAlign="center" />
<spacer />
<label text="Opponent" verticalAlign="center" />
<dropdown id="opponentSelect" width="75" horizontalAlign="center" />
</hbox>
</grid>
<menu-separator />
<hbox>
<label text="Stage" width="100" horizontalAlign="center" />
<label text="Style" width="100" horizontalAlign="center" />
<label text="Difficulty" width="100" horizontalAlign="center" />
</hbox>
<hbox>
<grid>
<label text="Stage" horizontalAlign="center" />
<dropdown id="stageSelect" width="90" horizontalAlign="center" />
<label text="Style" horizontalAlign="center" />
<dropdown id="styleSelect" width="90" horizontalAlign="center" />
<dropdown id="diffSelect" width="90" horizontalAlign="center" />
</hbox>
</grid>
</vbox>
</frame>
</vbox>
<vbox text="Section">

<frame width="350" height="350">
<vbox>
<checkbox id="sectionMustHit" text="Must Hit Section" horizontalAlign="center" />
</vbox>
</frame>
</vbox>
<vbox text="Song">
<frame>
Expand All @@ -78,6 +73,8 @@
<number-stepper id="dataBPM" pos="100" step="0.1" verticalAlign="center" />
<label text="Scroll Speed" verticalAlign="center" />
<number-stepper id="dataSpeed" pos="100" step="0.1" verticalAlign="center" />
<label text="Difficulty" horizontalAlign="center" />
<dropdown id="diffSelect" width="90" horizontalAlign="center" />
</grid>
</frame>
</vbox>
Expand Down
13 changes: 13 additions & 0 deletions classpath.exclusions
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; include paths that gets ignored by haxeui (it looks for module.xml files almost everywhere)
; speeds up building time and completion
; you can add your own paths too

\/kec\/.*
\/hxdiscord_rpc\/.*
\/flixel\/.*
\/flixel-text-input\/.*
\/flixel-addons\.*
\/openfl\/.*
\/hxcpp-debug-server\/.*
\/hxcpp\/.*
\/lime\/.*
1 change: 0 additions & 1 deletion setup/easysetup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ echo Press any key to install the git libraries.
pause >nul
title KEC Setup - Installing libraries
haxelib git polymod https://github.com/swordcube/scriptless-polymod.git
haxelib git tjson https://github.com/EliteMasterEric/TJSON.git
haxelib git hscript-improved https://github.com/FNF-CNE-Devs/hscript-improved.git
haxelib git haxeui-core https://github.com/haxeui/haxeui-core.git --skip-dependencies
haxelib git haxeui-flixel https://github.com/haxeui/haxeui-flixel.git --skip-dependencies
Expand Down
1 change: 0 additions & 1 deletion setup/easysetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ haxelib run lime setup flixel
haxelib run flixel-tools setup

haxelib git polymod https://github.com/swordcube/scriptless-polymod.git
haxelib git tjson https://github.com/EliteMasterEric/TJSON.git
haxelib git hscript-improved https://github.com/FNF-CNE-Devs/hscript-improved.git
haxelib git haxeui-core https://github.com/haxeui/haxeui-core.git --skip-dependencies
haxelib git haxeui-flixel https://github.com/haxeui/haxeui-flixel.git --skip-dependencies
Expand Down
4 changes: 4 additions & 0 deletions source/Init.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import kec.backend.util.FilterUtils;
#if cpp
import kec.backend.cpp.CPPInterface;
#end
Expand All @@ -25,6 +26,9 @@ class Init extends MusicBeatState
kec.backend.KadeEngineData.initSave();

kec.backend.KeyBinds.keyCheck();
FilterUtils.initializeFilters();

FilterUtils.setColorBlindess(FlxG.save.data.colorblind);

// Gotta run this before any assets get loaded.
kec.backend.modding.ModCore.initialize();
Expand Down
1 change: 1 addition & 0 deletions source/kec/backend/Constants.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Constants
public static final noteColors:Array<String> = ['purple', 'blue', 'green', 'red'];
// Animation Names
public static final singAnimations:Array<String> = ['singLEFT', 'singDOWN', 'singUP', 'singRIGHT'];
public static final colorFilters:Array<String> = ['None', 'Deuteranopia', 'Protanopia', 'Tritanopia'];

public static final discordRpc:String = "898970552600002561";
}
3 changes: 3 additions & 0 deletions source/kec/backend/KadeEngineData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ class KadeEngineData
if (FlxG.save.data.enabledMods == null)
FlxG.save.data.enabledMods = [];

if (FlxG.save.data.colorblind == null)
FlxG.save.data.colorblind = 0; // none

FlxSprite.defaultAntialiasing = FlxG.save.data.antialiasing;
FlxObject.defaultMoves = false;
PlayerSettings.player1.controls.loadKeyBinds();
Expand Down
45 changes: 41 additions & 4 deletions source/kec/backend/Options.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kec.backend;

import kec.backend.util.FilterUtils;
import lime.app.Application;
import lime.system.DisplayMode;
import kec.backend.Controls.KeyboardScheme;
Expand Down Expand Up @@ -1987,7 +1988,7 @@ class IconBump extends Option

private override function updateDisplay():String
{
return "Icon Bumping: < " + (FlxG.save.data.motion ? "Enabled" : "Disabled") + " >";
return "Icon Bumping: < " + (FlxG.save.data.iconBop ? "Enabled" : "Disabled") + " >";
}
}

Expand Down Expand Up @@ -2754,6 +2755,43 @@ class DeveloperMode extends Option
}
}

class ColorBlindOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}

public override function left():Bool
{
FlxG.save.data.colorblind--;
if (FlxG.save.data.colorblind < 0)
FlxG.save.data.colorblind = Constants.colorFilters.length - 1;

FilterUtils.setColorBlindess(FlxG.save.data.colorblind);

display = updateDisplay();
return true;
}

public override function right():Bool
{
FlxG.save.data.colorblind++;
if (FlxG.save.data.colorblind > Constants.colorFilters.length - 1)
FlxG.save.data.colorblind = 0;

FilterUtils.setColorBlindess(FlxG.save.data.colorblind);
display = updateDisplay();
return true;
}

private override function updateDisplay():String
{
return "Color Blindness: < " + (Constants.colorFilters[FlxG.save.data.colorblind]) + " >";
}
}

class ResetSettings extends Option
{
var confirm:Bool = false;
Expand Down Expand Up @@ -2810,16 +2848,13 @@ class ResetSettings extends Option
FlxG.save.data.camzoom = null;
FlxG.save.data.scoreScreen = null;
FlxG.save.data.inputShow = null;
FlxG.save.data.optimize = null;
FlxG.save.data.laneTransparency = 0;
// custom shit
FlxG.save.data.hitsound = null;
FlxG.save.data.notesplashes = null;
FlxG.save.data.mem = null;
FlxG.save.data.unload = null;
FlxG.save.data.gen = null;
FlxG.save.data.oldcharter = null;
FlxG.save.data.motion = null;
FlxG.save.data.fpsMark = null;
FlxG.save.data.borderless = null;
FlxG.save.data.resolution = null;
Expand All @@ -2842,6 +2877,8 @@ class ResetSettings extends Option
FlxG.save.data.playHitsounds = null;
FlxG.save.data.playHitsoundsE = null;
FlxG.save.data.developer = null;
FlxG.save.data.iconBop = null;
FlxG.save.data.colorblind = null;

KadeEngineData.initSave();
confirm = false;
Expand Down
8 changes: 7 additions & 1 deletion source/kec/backend/chart/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ class Song
public static function loadFromJson(songId:String, difficulty:String):Modern
{
final songFile = 'data/songs/$songId/$songId$difficulty';

final rawJson = Paths.loadJSON(songFile);
final metaData:SongMeta = loadMetadata(songId);
doesChartExist(songId, difficulty);
return parseJSONshit(songId, rawJson, metaData);
}

public static function doesChartExist(songId:String, diff:String):Bool
{
final songFile = 'data/songs/$songId/$songId$diff.json';
return Paths.fileExists(songFile);
}

public static function loadMetadata(songId:String):SongMeta
{
var rawMetaJson = null;
Expand Down
60 changes: 60 additions & 0 deletions source/kec/backend/util/FilterUtils.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package kec.backend.util;

import openfl.filters.ColorMatrixFilter;
import openfl.filters.BitmapFilter;
import haxe.ds.StringMap;

class FilterUtils
{
// Mapping filter names to their corresponding matrices
public static var filterMap:StringMap<Array<Float>> = new StringMap();

public static function setColorBlindess(num:Int)
{
if (num == 0)
{
FlxG.game.setFilters([]);
return;
}

FlxG.game.setFilters([getFilterByName(Constants.colorFilters[num])]);
}

public static function initializeFilters()
{
// Populate the map with filter configurations
filterMap.set("Deuteranopia", [
0.43, 0.72, -0.15, 0, 0,
0.34, 0.57, 0.09, 0, 0,
-0.02, 0.03, 1, 0, 0,
0, 0, 0, 1, 0,
]);

filterMap.set("Protanopia", [
0.20, 0.99, -0.19, 0, 0,
0.16, 0.79, 0.04, 0, 0,
0.01, -0.01, 1, 0, 0,
0, 0, 0, 1, 0,
]);

filterMap.set("Tritanopia", [
0.97, 0.11, -0.08, 0, 0,
0.02, 0.82, 0.16, 0, 0,
0.06, 0.88, 0.18, 0, 0,
0, 0, 0, 1, 0,
]);
}

// Function to get a BitmapFilter from a filter name
public static function getFilterByName(filterName:String):BitmapFilter
{
if (filterMap.exists(filterName))
{
// Retrieve the matrix and create a ColorMatrixFilter
var matrix = filterMap.get(filterName);
return new ColorMatrixFilter(matrix);
}
else
throw "No filter has been applied : " + filterName;
}
}
Loading

0 comments on commit 4ff479f

Please sign in to comment.