Skip to content

Commit

Permalink
ko
Browse files Browse the repository at this point in the history
  • Loading branch information
Snirozu committed Dec 21, 2024
1 parent bf77cc2 commit 44cb0e9
Show file tree
Hide file tree
Showing 23 changed files with 230 additions and 65 deletions.
Binary file added art/flashFiles/heart.fla
Binary file not shown.
Binary file added assets/preload/images/heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/preload/sounds/fav.ogg
Binary file not shown.
Binary file added assets/preload/sounds/unfav.ogg
Binary file not shown.
2 changes: 1 addition & 1 deletion hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
{
"name": "lumod",
"type": "haxelib",
"version": "1.0.0"
"version": "2.0.0"
},
{
"name": "actuate",
Expand Down
13 changes: 10 additions & 3 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Main extends Sprite
#end

public static final PSYCH_ONLINE_VERSION:String = "0.9.3";
public static final CLIENT_PROTOCOL:Float = 6;
public static final CLIENT_PROTOCOL:Float = 7;
public static final GIT_COMMIT:String = online.backend.Macros.getGitCommitHash();

// You can pretty much ignore everything from here on - your code should go in your states.
Expand Down Expand Up @@ -112,8 +112,15 @@ class Main extends Sprite

CoolUtil.setDarkMode(true);

Lumod.get_scriptsRootPath = () -> {
return Lumod.scriptsRootPath = Paths.mods(Mods.currentModDirectory + "/lumod");
Lumod.scriptPathHandler = scriptPath -> {
var defaultPath:String = 'lumod/' + scriptPath;

// check if script exists in any of loaded mods
var path:String = Paths.modFolders(defaultPath);
if (FileSystem.exists(path))
return path;

return defaultPath;
}
Lumod.classResolver = Deflection.resolveClass;

Expand Down
9 changes: 7 additions & 2 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class SaveVariables {
'instakill' => false,
'practice' => false,
'botplay' => false,
'opponentplay' => false
'opponentplay' => false,
'nospecialnotes' => false,
];

public var comboOffset:Array<Int> = [0, 0, 0, 0];
Expand Down Expand Up @@ -90,6 +91,8 @@ class SaveVariables {
public var disableLagDetection:Bool = false;
public var groupSongsBy:String = 'No Grouping';
public var hiddenSongs:Array<String> = []; //format: 'songname-originfolder'
public var favSongs:Array<String> = []; //format: 'songname-originfolder'
public var modchartSkinChanges:Bool = false;

public function new()
{
Expand Down Expand Up @@ -120,6 +123,7 @@ class ClientPrefs {
'reset' => [R],
'taunt' => [SPACE],
'sidebar' => [GRAVEACCENT],
'fav' => [Q],

'volume_mute' => [ZERO],
'volume_up' => [NUMPADPLUS, PLUS],
Expand All @@ -144,7 +148,8 @@ class ClientPrefs {
'pause' => [START],
'reset' => [BACK],
'taunt' => [A],
'sidebar' => []
'sidebar' => [],
'fav' => []
];
public static var defaultKeys:Map<String, Array<FlxKey>> = null;
public static var defaultButtons:Map<String, Array<FlxGamepadInputID>> = null;
Expand Down
2 changes: 2 additions & 0 deletions source/backend/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ class Controls
public var RESET(get, never):Bool;
public var TAUNT(get, never):Bool;
public var SIDEBAR(get, never):Bool;
public var FAV(get, never):Bool;
private function get_ACCEPT() return justPressed('accept');
private function get_BACK() return justPressed('back');
private function get_PAUSE() return justPressed('pause');
private function get_RESET() return justPressed('reset');
private function get_TAUNT() return justPressed('taunt');
private function get_SIDEBAR() return justPressed('sidebar');
private function get_FAV() return justPressed('fav');

//Gamepad & Keyboard stuff
public var keyboardBinds:Map<String, Array<FlxKey>>;
Expand Down
6 changes: 3 additions & 3 deletions source/online/GameClient.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ class GameClient {
options.set("skinURL", OnlineMods.getModURL(ClientPrefs.data.modSkin[0]));
}

if (asHost) {
options.set("gameplaySettings", ClientPrefs.data.gameplaySettings);
}
// if (asHost) {
// options.set("gameplaySettings", ClientPrefs.data.gameplaySettings);
// }

return options;
}
Expand Down
11 changes: 11 additions & 0 deletions source/online/states/OnlineState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,17 @@ class OnlineState extends MusicBeatState {
// FlxG.openURL(GameClient.serverAddress + "/rooms");
FlxG.switchState(() -> new FindRoomState());
case "host":
var count:Float = 0;
for (mod in Mods.getModDirectories()) {
var url = OnlineMods.getModURL(mod);
if (url == null || !(url.startsWith('https://') || url.startsWith('http://')))
count++;
}

if (count > 0) {
Alert.alert('WARNING', count + ' of your mods doesn\'t have a valid URL set!');
}

disableInput = true;
GameClient.createRoom(GameClient.serverAddress, onRoomJoin);
case "options":
Expand Down
10 changes: 5 additions & 5 deletions source/online/states/ResultsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ class ResultsState extends MusicBeatState {

switch (GameClient.room.state.winCondition) {
case 0:
winner = (getPlayer(1).score >= getPlayer(2).score ? 0 : 1);
if (getPlayer(1).score == getPlayer(2).score)
winner = -1;
case 1:
winner = (p1Accuracy >= p2Accuracy ? 0 : 1);
if (p1Accuracy == p2Accuracy)
winner = -1;
case 1:
winner = (getPlayer(1).score >= getPlayer(2).score ? 0 : 1);
if (getPlayer(1).score == getPlayer(2).score)
winner = -1;
case 2:
winner = (getPlayer(1).misses <= getPlayer(2).misses ? 0 : 1);
if (getPlayer(1).misses == getPlayer(2).misses)
Expand Down Expand Up @@ -416,7 +416,7 @@ class ResultsState extends MusicBeatState {
if (FlxG.keys.justPressed.F12) {
trace('reloading lumod');
Lumod.cache.scripts.clear();
luaLoad();
lmLoad();
}

if (luaValue == false)
Expand Down
2 changes: 1 addition & 1 deletion source/online/states/RoomState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ class RoomState extends MusicBeatState {
if (FlxG.keys.justPressed.F12) {
trace('reloading lumod');
Lumod.cache.scripts.clear();
luaLoad();
lmLoad();
}

if (!GameClient.isConnected())
Expand Down
7 changes: 4 additions & 3 deletions source/online/states/SetupModsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ class SetupModsState extends MusicBeatState {
item.text = "> " + item.text + " <";
item.alpha = 1;
}
if (modsInput[item.ID].startsWith("http://") || modsInput[item.ID].startsWith("https://"))
item.color = FlxColor.LIME;
else

if (modsInput[item.ID] == null || !(modsInput[item.ID].startsWith('https://') || modsInput[item.ID].startsWith('http://')))
item.color = FlxColor.RED;
else
item.color = FlxColor.LIME;
item.screenCenter(X);
}
}
Expand Down
15 changes: 9 additions & 6 deletions source/online/states/SkinsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class SkinsState extends MusicBeatState {
camFollow.setPosition(FlxG.width / 2, FlxG.height / 2);

if (stopUpdates) {
camFollow.y += !ClientPrefs.data.lowQuality ? 800 : 200;
camFollow.y += !ClientPrefs.data.lowQuality ? 600 : 200;
return;
}

Expand All @@ -396,6 +396,9 @@ class SkinsState extends MusicBeatState {
if (controls.NOTE_RIGHT) {
character.members[0].playAnim("singRIGHT");
}
if (controls.TAUNT) {
character.members[0].playAnim("taunt");
}
}
}
else {
Expand Down Expand Up @@ -433,11 +436,7 @@ class SkinsState extends MusicBeatState {
}));
}

if (controls.BACK) {
switchState(() -> Type.createInstance(backClass, []));
}

if (controls.ACCEPT) {
if (!FlxG.keys.pressed.SHIFT && controls.ACCEPT) {
var charName = charactersName[curCharacter];
if (charName.endsWith("-player"))
charName = charName.substring(0, charName.length - "-player".length);
Expand Down Expand Up @@ -468,6 +467,10 @@ class SkinsState extends MusicBeatState {
character.members[0].playAnim("hey", true);
}

if (controls.BACK || (!FlxG.keys.pressed.SHIFT && controls.ACCEPT)) {
switchState(() -> Type.createInstance(backClass, []));
}

if (FlxG.keys.justPressed.EIGHT) {
Mods.currentModDirectory = charactersMod.get(charactersName[curCharacter]);
switchState(() -> new CharacterEditorState(charactersName[curCharacter], false, true));
Expand Down
4 changes: 2 additions & 2 deletions source/online/substates/RoomSettingsSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ class RoomSettingsSubstate extends MusicBeatSubstate {
if (GameClient.room.state.winCondition != prevCond) {
switch (GameClient.room.state.winCondition) {
case 0:
winCondition.descText.text = 'Player with the most Score wins!';
case 1:
winCondition.descText.text = 'Player with the highest Accuracy wins!';
case 1:
winCondition.descText.text = 'Player with the most Score wins!';
case 2:
winCondition.descText.text = 'Player with the least Misses wins!';
case 3:
Expand Down
1 change: 1 addition & 0 deletions source/options/ControlsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ControlsSubState extends MusicBeatSubstate
[true, 'Back', 'back', 'Back'],
[true, 'Pause', 'pause', 'Pause'],
[true, 'Sidebar', 'sidebar', 'Sidebar'],
[true, 'Favorite', 'fav', 'Favorite'],
[false],
[false, 'VOLUME'],
[false, 'Mute', 'volume_mute', 'Volume Mute'],
Expand Down
6 changes: 6 additions & 0 deletions source/options/GameplaySettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ class GameplaySettingsSubState extends BaseOptionsMenu
'bool');
addOption(option);

var option:Option = new Option('Modchart Skin Changes',
'If enabled, the song events will change the character of your active skin',
'modchartSkinChanges',
'bool');
addOption(option);

super();
}

Expand Down
2 changes: 1 addition & 1 deletion source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class VisualsUISubState extends BaseOptionsMenu
"How should songs on Freeplay menu be group by?",
'groupSongsBy',
'string',
['No Grouping', 'Alphabetically', 'Modpack', 'Hidden']);
['No Grouping', 'Alphabetically', 'Modpack', 'Favorites', 'Hidden']);
addOption(option);

super();
Expand Down
Loading

0 comments on commit 44cb0e9

Please sign in to comment.