pog merge

pog request
This commit is contained in:
CyndaquilDAC 2021-04-06 08:24:48 -05:00 committed by GitHub
commit 58e8c360b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 494 additions and 157 deletions

View File

@ -7,7 +7,7 @@ assignees: ''
--- ---
#### Please check for duplicates or similar issues, as well performing simple troubleshooting steps (such as clearing cookies, clearing AppData, trying another browser) before submitting an issue. #### Please check for duplicates or similar issues, as well performing simple troubleshooting steps (such as deleting the export folder if it's an issue with compiling, reinstalling Kade Engine) before submitting an issue.
### If you are playing a downloaded version of the game, what operating system are you using? ### If you are playing a downloaded version of the game, what operating system are you using?
Windows (`x86`), Windows (`x86_64`), Linux, or macOS? Specify below. Windows (`x86`), Windows (`x86_64`), Linux, or macOS? Specify below.

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
export/ export/
.vscode/ .vscode/
APIStuff.hx

View File

@ -116,7 +116,7 @@
<haxelib name="newgrounds"/> <haxelib name="newgrounds"/>
<haxelib name="faxe" if='switch'/> <haxelib name="faxe" if='switch'/>
<haxelib name="polymod"/> <haxelib name="polymod"/>
<haxelib name="discord_rpc" if="desktop"/> <haxelib name="discord_rpc" if="windows"/>
<!-- <haxelib name="hxcpp-debug-server" if="desktop"/> --> <!-- <haxelib name="hxcpp-debug-server" if="desktop"/> -->
<!-- <haxelib name="markdown" /> --> <!-- <haxelib name="markdown" /> -->

View File

@ -15,12 +15,21 @@
This is the repository for Friday Night Funkin' Kade Engine, a game originally made for Ludum Dare 47 "Stuck In a Loop". And a completely reworked engine. This is the repository for Friday Night Funkin' Kade Engine, a game originally made for Ludum Dare 47 "Stuck In a Loop". And a completely reworked engine.
### Links to the original game
Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin
Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371 Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371
Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin
### Links to Kade Engine
Mod Page: https://gamebanana.com/gamefiles/16761 Mod Page: https://gamebanana.com/gamefiles/16761
Latest GitHub release: https://github.com/KadeDev/Kade-Engine/releases/latest
AppVeyor CI (Automatic builds of the latest commit):
- Windows: [AppVeyor Project](https://ci.appveyor.com/project/KadeDev/kade-engine-windows) | [Artifacts (downloads)](https://ci.appveyor.com/project/KadeDev/kade-engine-windows/build/artifacts)
- Linux: [AppVeyor Project](https://ci.appveyor.com/project/KadeDev/kade-engine-linux) | [Artifacts (downloads)](https://ci.appveyor.com/project/KadeDev/kade-engine-linux/build/artifacts)
## What is Kade Engine? ## What is Kade Engine?
Kade Engine is an engine rework of the OG games engine. Simply put, we give you some great new features while also giving you the latest GitHub features. Kade Engine is an engine rework of the OG games engine. Simply put, we give you some great new features while also giving you the latest GitHub features.

42
appveyor-linux.yml Normal file
View File

@ -0,0 +1,42 @@
version: '{build}'
image: Ubuntu2004
environment:
global:
HAXELIB_ROOT: /home/appveyor/haxelib
HAXE_INSTALLDIR: /home/appveyor/haxe
install:
- cd /home/appveyor
- sudo add-apt-repository ppa:haxe/releases -y
- sudo apt update
- sudo apt install neko tar -y
- wget https://github.com/HaxeFoundation/haxe/releases/download/4.1.5/haxe-4.1.5-linux64.tar.gz
- mkdir $HAXE_INSTALLDIR
- tar -xf haxe-4.1.5-linux64.tar.gz -C $HAXE_INSTALLDIR
- export PATH=$PATH:$HAXE_INSTALLDIR/haxe_20201231082044_5e33a78aa
- mkdir $HAXELIB_ROOT && haxelib setup $HAXELIB_ROOT
- haxelib install lime 7.9.0
- haxelib install openfl
- haxelib install flixel
- haxelib run lime setup flixel
- haxelib run lime setup
- haxelib install flixel-tools
- haxelib install flixel-addons
- haxelib install flixel-ui
- haxelib install hscript
- haxelib install newgrounds
- haxelib git faxe https://github.com/uhrobots/faxe
- haxelib git polymod https://github.com/larsiusprime/polymod.git
- haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
- haxelib list
- cd /home/appveyor/projects/kade-engine-linux
build_script:
- haxelib run lime build linux
after_build:
- tar -cvf funkin-ke.tar -C /home/appveyor/projects/kade-engine-linux/export/release/linux/bin .
artifacts:
- path: funkin-ke.tar
name: Linux build

45
appveyor-windows.yml Normal file
View File

@ -0,0 +1,45 @@
# Taken from https://github.com/andyli/HaxeCI/blob/master/appveyor.yml
version: "{build}"
environment:
global:
HAXELIB_ROOT: C:\projects\haxelib
install:
# http://help.appveyor.com/discussions/problems/5616-not-able-to-build-due-to-problem-in-chocolateyinstallps1
- ps: Set-Service wuauserv -StartupType Manual
# Install the neko chocolatey package (https://chocolatey.org/packages/neko)
- cinst neko --version 2.3.0 -y
# Install the haxe chocolatey package (https://chocolatey.org/packages/haxe)
- cinst haxe --version 4.1.5 -y
- RefreshEnv
# Setup haxelib
- mkdir "%HAXELIB_ROOT%"
- haxelib setup "%HAXELIB_ROOT%"
# Install project dependencies
- haxelib install lime 7.9.0
- haxelib install openfl
- haxelib install flixel
- haxelib run lime setup flixel
- haxelib run lime setup
- haxelib install flixel-tools
# haxelib run flixel-tools setup -y # Can't do this since it asks [y/n] even with -y argument! Stupid
- haxelib install flixel-addons
- haxelib install flixel-ui
- haxelib install hscript
- haxelib install newgrounds
- haxelib install flixel-addons
- haxelib git faxe https://github.com/uhrobots/faxe
- haxelib git polymod https://github.com/larsiusprime/polymod.git
- haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc
- haxelib list
# No tests idk lol
build_script:
- haxelib run lime build windows
# haxelib run lime build linux
artifacts:
- path: export/release/windows/bin
name: Windows release
type: zip

7
source/APIStuff.hx Normal file
View File

@ -0,0 +1,7 @@
package;
class APIStuff
{
public static var API:String = "";
public static var EncKey:String = "";
}

View File

@ -1,6 +1,7 @@
package; package;
import Song.SwagSong; import Song.SwagSong;
import flixel.FlxG;
/** /**
* ... * ...
@ -24,7 +25,8 @@ class Conductor
public static var offset:Float = 0; public static var offset:Float = 0;
public static var safeFrames:Int = 10; public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds public static var safeZoneOffset:Float = Math.floor((safeFrames / 60) * 1000); // is calculated in create(), is safeFrames in milliseconds
public static var timeScale:Float = Conductor.safeZoneOffset / 166;
public static var bpmChangeMap:Array<BPMChangeEvent> = []; public static var bpmChangeMap:Array<BPMChangeEvent> = [];
@ -32,6 +34,13 @@ class Conductor
{ {
} }
public static function recalculateTimings()
{
Conductor.safeFrames = FlxG.save.data.frames;
Conductor.safeZoneOffset = Math.floor((Conductor.safeFrames / 60) * 1000);
Conductor.timeScale = Conductor.safeZoneOffset / 166;
}
public static function mapBPMChanges(song:SwagSong) public static function mapBPMChanges(song:SwagSong)
{ {
bpmChangeMap = []; bpmChangeMap = [];

21
source/ConvertScore.hx Normal file
View File

@ -0,0 +1,21 @@
class ConvertScore
{
public static function convertScore(noteDiff:Float):Int
{
var daRating:String = Ratings.CalculateRating(noteDiff, 166);
switch(daRating)
{
case 'shit':
return -300;
case 'bad':
return 0;
case 'good':
return 200;
case 'sick':
return 350;
}
return 0;
}
}

View File

@ -1,5 +1,6 @@
package; package;
#if windows
import Sys.sleep; import Sys.sleep;
import discord_rpc.DiscordRpc; import discord_rpc.DiscordRpc;
@ -85,3 +86,4 @@ class DiscordClient
//trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp');
} }
} }
#end

View File

@ -11,7 +11,7 @@ import flixel.util.FlxColor;
import lime.utils.Assets; import lime.utils.Assets;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end #end
@ -53,7 +53,7 @@ class FreeplayState extends MusicBeatState
} }
*/ */
#if desktop #if windows
// Updating Discord Rich Presence // Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null); DiscordClient.changePresence("In the Menus", null);
#end #end

View File

@ -2,7 +2,7 @@ import flixel.math.FlxMath;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import flixel.FlxObject; import flixel.FlxObject;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
import sys.thread.Thread; import sys.thread.Thread;
#end #end
@ -33,7 +33,7 @@ class GameplayCustomizeState extends MusicBeatState
private var camHUD:FlxCamera; private var camHUD:FlxCamera;
public override function create() { public override function create() {
#if desktop #if windows
// Updating Discord Rich Presence // Updating Discord Rich Presence
DiscordClient.changePresence("Customizing Gameplay", null); DiscordClient.changePresence("Customizing Gameplay", null);
#end #end

View File

@ -26,9 +26,6 @@ class KadeEngineData
if (FlxG.save.data.songPosition == null) if (FlxG.save.data.songPosition == null)
FlxG.save.data.songPosition = false; FlxG.save.data.songPosition = false;
if (FlxG.save.data.etternaMode == null)
FlxG.save.data.etternaMode = false;
if (FlxG.save.data.fps == null) if (FlxG.save.data.fps == null)
FlxG.save.data.fps = false; FlxG.save.data.fps = false;
@ -54,6 +51,11 @@ class KadeEngineData
if (FlxG.save.data.npsDisplay == null) if (FlxG.save.data.npsDisplay == null)
FlxG.save.data.npsDisplay = false; FlxG.save.data.npsDisplay = false;
if (FlxG.save.data.frames == null)
FlxG.save.data.frames = 10;
Conductor.recalculateTimings();
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
} }
} }

View File

@ -14,7 +14,7 @@ import flixel.util.FlxColor;
import io.newgrounds.NG; import io.newgrounds.NG;
import lime.app.Application; import lime.app.Application;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end #end
@ -36,9 +36,9 @@ class MainMenuState extends MusicBeatState
var newGaming2:FlxText; var newGaming2:FlxText;
var newInput:Bool = true; var newInput:Bool = true;
public static var nightly:String = ""; public static var nightly:String = "-Nightly2";
public static var kadeEngineVer:String = "1.4" + nightly; public static var kadeEngineVer:String = "1.4.1" + nightly;
public static var gameVer:String = "0.2.7.1"; public static var gameVer:String = "0.2.7.1";
var magenta:FlxSprite; var magenta:FlxSprite;
@ -46,7 +46,7 @@ class MainMenuState extends MusicBeatState
override function create() override function create()
{ {
#if desktop #if windows
// Updating Discord Rich Presence // Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null); DiscordClient.changePresence("In the Menus", null);
#end #end

View File

@ -1,6 +1,8 @@
package; package;
#if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import openfl.Lib; import openfl.Lib;

View File

@ -48,7 +48,7 @@ class Note extends FlxSprite
x += 50; x += 50;
// MAKE SURE ITS DEFINITELY OFF SCREEN? // MAKE SURE ITS DEFINITELY OFF SCREEN?
y -= 2000; y -= 2000;
this.strumTime = strumTime + FlxG.save.data.offset; this.strumTime = strumTime;
if (this.strumTime < 0 ) if (this.strumTime < 0 )
this.strumTime = 0; this.strumTime = 0;
@ -172,7 +172,7 @@ class Note extends FlxSprite
prevNote.animation.play('redhold'); prevNote.animation.play('redhold');
} }
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.8 * PlayState.SONG.speed; prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.8 * FlxG.save.data.scrollSpeed;
prevNote.updateHitbox(); prevNote.updateHitbox();
// prevNote.setGraphicSize(); // prevNote.setGraphicSize();
} }

View File

@ -45,19 +45,28 @@ class Option
} }
private var description:String = ""; private var description:String = "";
private var display:String; private var display:String;
private var acceptValues:Bool = false;
public final function getDisplay():String public final function getDisplay():String
{ {
return display; return display;
} }
public final function getAccept():Bool
{
return acceptValues;
}
public final function getDescription():String public final function getDescription():String
{ {
return description; return description;
} }
// Returns whether the label is to be updated. // Returns whether the label is to be updated.
public function press():Bool { return throw "stub!"; } public function press():Bool { return throw "stub!"; }
private function updateDisplay():String { return throw "stub!"; } private function updateDisplay():String { return throw "stub!"; }
public function left():Bool { return throw "stub!"; }
public function right():Bool { return throw "stub!"; }
} }
class DFJKOption extends Option class DFJKOption extends Option
@ -150,24 +159,63 @@ class SongPositionOption extends Option
} }
} }
class EtternaModeOption extends Option class Judgement extends Option
{ {
public function new(desc:String) public function new(desc:String)
{ {
super(); super();
description = desc; description = desc;
acceptValues = true;
} }
public override function press():Bool public override function press():Bool
{ {
FlxG.save.data.etternaMode = !FlxG.save.data.etternaMode;
display = updateDisplay();
return true; return true;
} }
private override function updateDisplay():String private override function updateDisplay():String
{ {
return "Etterna Mode " + (!FlxG.save.data.etternaMode ? "off" : "on"); return "Safe Frames";
}
override function left():Bool {
if (Conductor.safeFrames == 1)
return false;
Conductor.safeFrames -= 1;
FlxG.save.data.frames = Conductor.safeFrames;
Conductor.recalculateTimings();
OptionsMenu.versionShit.text = "Current Safe Frames: " + Conductor.safeFrames + " - Description - " + description +
" - SIK: " + OptionsMenu.truncateFloat(45 * Conductor.timeScale, 0) +
"ms GD: " + OptionsMenu.truncateFloat(90 * Conductor.timeScale, 0) +
"ms BD: " + OptionsMenu.truncateFloat(135 * Conductor.timeScale, 0) +
"ms SHT: " + OptionsMenu.truncateFloat(155 * Conductor.timeScale, 0) +
"ms TOTAL: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset,0) + "ms";
return true;
}
override function right():Bool {
if (Conductor.safeFrames == 20)
return false;
Conductor.safeFrames += 1;
FlxG.save.data.frames = Conductor.safeFrames;
Conductor.recalculateTimings();
OptionsMenu.versionShit.text = "Current Safe Frames: " + Conductor.safeFrames + " - Description - " + description +
" - SIK: " + OptionsMenu.truncateFloat(45 * Conductor.timeScale, 0) +
"ms GD: " + OptionsMenu.truncateFloat(90 * Conductor.timeScale, 0) +
"ms BD: " + OptionsMenu.truncateFloat(135 * Conductor.timeScale, 0) +
"ms SHT: " + OptionsMenu.truncateFloat(155 * Conductor.timeScale, 0) +
"ms TOTAL: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset,0) + "ms";
return true;
} }
} }
@ -199,6 +247,7 @@ class FPSCapOption extends Option
{ {
super(); super();
description = desc; description = desc;
acceptValues = true;
} }
public override function press():Bool public override function press():Bool
@ -210,6 +259,28 @@ class FPSCapOption extends Option
{ {
return "FPS Cap"; return "FPS Cap";
} }
override function right():Bool {
if (FlxG.save.data.fpsCap > 290)
return false;
FlxG.save.data.fpsCap = FlxG.save.data.fpsCap + 10;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
OptionsMenu.versionShit.text = "Current FPS Cap: " + FlxG.save.data.fpsCap + " - Description - " + description;
return true;
}
override function left():Bool {
if (FlxG.save.data.fpsCap < 60)
return false;
FlxG.save.data.fpsCap = FlxG.save.data.fpsCap - 10;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
OptionsMenu.versionShit.text = "Current FPS Cap: " + FlxG.save.data.fpsCap + " - Description - " + description;
return true;
}
} }
@ -219,6 +290,7 @@ class ScrollSpeedOption extends Option
{ {
super(); super();
description = desc; description = desc;
acceptValues = true;
} }
public override function press():Bool public override function press():Bool
@ -230,6 +302,33 @@ class ScrollSpeedOption extends Option
{ {
return "Scroll Speed"; return "Scroll Speed";
} }
override function right():Bool {
FlxG.save.data.scrollSpeed += 0.1;
if (FlxG.save.data.scrollSpeed < 1)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.scrollSpeed > 10)
FlxG.save.data.scrollSpeed = 10;
OptionsMenu.versionShit.text = "Current Scroll Speed: " + OptionsMenu.truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + description;
return true;
}
override function left():Bool {
FlxG.save.data.scrollSpeed -= 0.1;
if (FlxG.save.data.scrollSpeed < 1)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.scrollSpeed > 10)
FlxG.save.data.scrollSpeed = 10;
OptionsMenu.versionShit.text = "Current Scroll Speed: " + OptionsMenu.truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + description;
return true;
}
} }

View File

@ -22,7 +22,10 @@ class OptionsMenu extends MusicBeatState
var options:Array<OptionCatagory> = [ var options:Array<OptionCatagory> = [
new OptionCatagory("Gameplay", [ new OptionCatagory("Gameplay", [
new DFJKOption(controls), new DFJKOption(controls),
new FPSCapOption("Cap your FPS (Left for -10, Right for -10)"), new Judgement("Customize your Hit Timings (LEFT or RIGHT)"),
#if !html
new FPSCapOption("Cap your FPS (Left for -10, Right for +10. SHIFT to go faster)"),
#end
new ScrollSpeedOption("Change your scroll speed (Left for -0.1, right for +0.1. If its at 1, it will be chart dependent)"), new ScrollSpeedOption("Change your scroll speed (Left for -0.1, right for +0.1. If its at 1, it will be chart dependent)"),
new OffsetMenu("Get a note offset based off of your inputs!"), new OffsetMenu("Get a note offset based off of your inputs!"),
new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference") new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference")
@ -30,22 +33,24 @@ class OptionsMenu extends MusicBeatState
new OptionCatagory("Appearence", [ new OptionCatagory("Appearence", [
new SongPositionOption("Show the songs current position (as a bar)"), new SongPositionOption("Show the songs current position (as a bar)"),
new DownscrollOption("Change the layout of the strumline."), new DownscrollOption("Change the layout of the strumline."),
#if !html
new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"), new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"),
#end
new AccuracyOption("Display accuracy information."), new AccuracyOption("Display accuracy information."),
new NPSDisplayOption("Shows your current Notes Per Second.") new NPSDisplayOption("Shows your current Notes Per Second.")
]), ]),
new OptionCatagory("Misc", [
new EtternaModeOption("Harder Hit Windows and a different scoring system."),
#if !mobile #if !mobile
new OptionCatagory("Misc", [
new FPSOption("Toggle the FPS Counter"), new FPSOption("Toggle the FPS Counter"),
#end
new ReplayOption("View replays") new ReplayOption("View replays")
]) ])
#end
]; ];
private var currentDescription:String = ""; private var currentDescription:String = "";
private var grpControls:FlxTypedGroup<Alphabet>; private var grpControls:FlxTypedGroup<Alphabet>;
var versionShit:FlxText; public static var versionShit:FlxText;
var currentSelectedCat:OptionCatagory; var currentSelectedCat:OptionCatagory;
@ -84,7 +89,7 @@ class OptionsMenu extends MusicBeatState
var isCat:Bool = false; var isCat:Bool = false;
function truncateFloat( number : Float, precision : Int): Float { public static function truncateFloat( number : Float, precision : Int): Float {
var num = number; var num = number;
num = num * Math.pow(10, precision); num = num * Math.pow(10, precision);
num = Math.round( num ) / Math.pow(10, precision); num = Math.round( num ) / Math.pow(10, precision);
@ -118,51 +123,36 @@ class OptionsMenu extends MusicBeatState
if (isCat) if (isCat)
{ {
switch(currentSelectedCat.getOptions()[curSelected].getDisplay()) if (currentSelectedCat.getOptions()[curSelected].getAccept())
{ {
case 'FPS Cap': if (FlxG.keys.pressed.SHIFT)
var fps = (cast (Lib.current.getChildAt(0), Main)).getFPSCap();
if (FlxG.keys.pressed.RIGHT && fps < 285) // actual cap is 285
{ {
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(fps + 10);
FlxG.save.data.fpsCap = fps + 10;
}
if (FlxG.keys.pressed.LEFT && fps > 60)
{
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(fps - 10);
FlxG.save.data.fpsCap = fps - 10;
}
versionShit.text = "Current FPS Cap: " + fps + " - Description - " + currentDescription;
case 'Scroll Speed':
if (FlxG.keys.justPressed.RIGHT)
FlxG.save.data.scrollSpeed += 0.1;
if (FlxG.keys.justPressed.LEFT)
FlxG.save.data.scrollSpeed -= 0.1;
// caps
if (FlxG.save.data.scrollSpeed < 1)
FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.scrollSpeed > 10)
FlxG.save.data.scrollSpeed = 10;
versionShit.text = "Current Scroll Speed: " + truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + currentDescription;
default:
if (FlxG.keys.pressed.RIGHT) if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset += 0.01; currentSelectedCat.getOptions()[curSelected].right();
if (FlxG.keys.pressed.LEFT) if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset -= 0.01; currentSelectedCat.getOptions()[curSelected].left();
}
else
{
if (FlxG.keys.justPressed.RIGHT)
currentSelectedCat.getOptions()[curSelected].right();
if (FlxG.keys.justPressed.LEFT)
currentSelectedCat.getOptions()[curSelected].left();
}
}
else
{
if (FlxG.keys.pressed.SHIFT)
if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset += 1;
else if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset -= 1;
else if (controls.RIGHT_P)
FlxG.save.data.offset += 0.1;
else if (controls.LEFT_P)
FlxG.save.data.offset -= 0.1;
versionShit.text = "Offset (Left, Right): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; versionShit.text = "Offset (Left, Right, Shift to go faster): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
} }
} }
else else
@ -173,7 +163,7 @@ class OptionsMenu extends MusicBeatState
if (FlxG.keys.pressed.LEFT) if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset-= 0.01; FlxG.save.data.offset-= 0.01;
versionShit.text = "Offset (Left, Right): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; versionShit.text = "Offset (Left, Right, Shift to go faster): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
} }

View File

@ -40,7 +40,7 @@ import openfl.display.BlendMode;
import openfl.display.StageQuality; import openfl.display.StageQuality;
import openfl.filters.ShaderFilter; import openfl.filters.ShaderFilter;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end #end
@ -72,7 +72,7 @@ class PlayState extends MusicBeatState
var songLength:Float = 0; var songLength:Float = 0;
#if desktop #if windows
// Discord RPC variables // Discord RPC variables
var storyDifficultyText:String = ""; var storyDifficultyText:String = "";
var iconRPC:String = ""; var iconRPC:String = "";
@ -107,7 +107,9 @@ class PlayState extends MusicBeatState
private var combo:Int = 0; private var combo:Int = 0;
public static var misses:Int = 0; public static var misses:Int = 0;
private var accuracy:Float = 0.00; private var accuracy:Float = 0.00;
private var accuracyDefault:Float = 0.00;
private var totalNotesHit:Float = 0; private var totalNotesHit:Float = 0;
private var totalNotesHitDefault:Float = 0;
private var totalPlayed:Int = 0; private var totalPlayed:Int = 0;
private var ss:Bool = false; private var ss:Bool = false;
@ -154,10 +156,10 @@ class PlayState extends MusicBeatState
var talking:Bool = true; var talking:Bool = true;
var songScore:Int = 0; var songScore:Int = 0;
var songScoreDef:Int = 0;
var scoreTxt:FlxText; var scoreTxt:FlxText;
var replayTxt:FlxText; var replayTxt:FlxText;
public static var campaignScore:Int = 0; public static var campaignScore:Int = 0;
var defaultCamZoom:Float = 1.05; var defaultCamZoom:Float = 1.05;
@ -173,15 +175,15 @@ class PlayState extends MusicBeatState
public static var timeCurrently:Float = 0; public static var timeCurrently:Float = 0;
public static var timeCurrentlyR:Float = 0; public static var timeCurrentlyR:Float = 0;
// Will fire once to prevent debug spam messages and broken animations
private var triggeredAlready:Bool = false;
// Will decide if she's even allowed to headbang at all depending on the song
private var allowedToHeadbang:Bool = false;
override public function create() override public function create()
{ {
if (FlxG.save.data.etternaMode)
Conductor.safeFrames = 5; // 116ms hit window (j3-4)
else
Conductor.safeFrames = 10; // 166ms hit window (j1)
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
FlxG.sound.music.stop(); FlxG.sound.music.stop();
@ -195,7 +197,7 @@ class PlayState extends MusicBeatState
repPresses = 0; repPresses = 0;
repReleases = 0; repReleases = 0;
#if desktop #if windows
// Making difficulty text for Discord Rich Presence. // Making difficulty text for Discord Rich Presence.
switch (storyDifficulty) switch (storyDifficulty)
{ {
@ -257,6 +259,8 @@ class PlayState extends MusicBeatState
Conductor.mapBPMChanges(SONG); Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm); Conductor.changeBPM(SONG.bpm);
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + Conductor.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale);
switch (SONG.song.toLowerCase()) switch (SONG.song.toLowerCase())
{ {
case 'tutorial': case 'tutorial':
@ -1181,11 +1185,15 @@ class PlayState extends MusicBeatState
songName.cameras = [camHUD]; songName.cameras = [camHUD];
} }
#if desktop // Song check real quick
switch(curSong)
{
case 'Bopeebo' | 'Philly' | 'Blammed' | 'Cocoa' | 'Eggnog': allowedToHeadbang = true;
default: allowedToHeadbang = false;
}
#if windows
// Updating Discord Rich Presence (with Time Left) // Updating Discord Rich Presence (with Time Left)
DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC);
#end #end
} }
@ -1225,7 +1233,9 @@ class PlayState extends MusicBeatState
for (songNotes in section.sectionNotes) for (songNotes in section.sectionNotes)
{ {
var daStrumTime:Float = songNotes[0]; var daStrumTime:Float = songNotes[0] + FlxG.save.data.offset;
if (daStrumTime < 0)
daStrumTime = 0;
var daNoteData:Int = Std.int(songNotes[1] % 4); var daNoteData:Int = Std.int(songNotes[1] % 4);
var gottaHitNote:Bool = section.mustHitSection; var gottaHitNote:Bool = section.mustHitSection;
@ -1411,7 +1421,7 @@ class PlayState extends MusicBeatState
vocals.pause(); vocals.pause();
} }
#if desktop #if windows
DiscordClient.changePresence("PAUSED on " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "Acc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); DiscordClient.changePresence("PAUSED on " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "Acc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC);
#end #end
if (!startTimer.finished) if (!startTimer.finished)
@ -1434,7 +1444,7 @@ class PlayState extends MusicBeatState
startTimer.active = true; startTimer.active = true;
paused = false; paused = false;
#if desktop #if windows
if (startTimer.finished) if (startTimer.finished)
{ {
DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses, iconRPC, true, songLength - Conductor.songPosition); DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses, iconRPC, true, songLength - Conductor.songPosition);
@ -1459,7 +1469,7 @@ class PlayState extends MusicBeatState
vocals.time = Conductor.songPosition; vocals.time = Conductor.songPosition;
vocals.play(); vocals.play();
#if desktop #if windows
DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC);
#end #end
} }
@ -1615,7 +1625,7 @@ class PlayState extends MusicBeatState
{ {
if (FlxG.save.data.accuracyDisplay) if (FlxG.save.data.accuracyDisplay)
{ {
scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + (FlxG.save.data.etternaMode ? Math.max(0,etternaModeScore) + " (" + songScore + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking(); scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + (Conductor.safeFrames != 10 ? songScore + " (" + songScoreDef + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking();
} }
else else
{ {
@ -1645,7 +1655,7 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.SEVEN) if (FlxG.keys.justPressed.SEVEN)
{ {
#if desktop #if windows
DiscordClient.changePresence("Chart Editor", null, null, true); DiscordClient.changePresence("Chart Editor", null, null, true);
#end #end
FlxG.switchState(new ChartingState()); FlxG.switchState(new ChartingState());
@ -1725,9 +1735,100 @@ class PlayState extends MusicBeatState
if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null)
{ {
if (curBeat % 4 == 0) // Make sure Girlfriend cheers only for certain songs
if(allowedToHeadbang)
{ {
// trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); // Don't animate GF if something else is already animating her (eg. train passing)
if(gf.animation.curAnim.name == 'danceLeft' || gf.animation.curAnim.name == 'danceRight' || gf.animation.curAnim.name == 'idle')
{
// Per song treatment since some songs will only have the 'Hey' at certain times
switch(curSong)
{
case 'Philly':
{
// General duration of the song
if(curBeat < 250)
{
// Beats to skip or to stop GF from cheering
if(curBeat != 184 && curBeat != 216)
{
if(curBeat % 16 == 8)
{
// Just a garantee that it'll trigger just once
if(!triggeredAlready)
{
gf.playAnim('cheer');
triggeredAlready = true;
}
}else triggeredAlready = false;
}
}
}
case 'Bopeebo':
{
// Where it starts || where it ends
if(curBeat > 5 && curBeat < 130)
{
if(curBeat % 8 == 7)
{
if(!triggeredAlready)
{
gf.playAnim('cheer');
triggeredAlready = true;
}
}else triggeredAlready = false;
}
}
case 'Blammed':
{
if(curBeat > 30 && curBeat < 190)
{
if(curBeat < 90 || curBeat > 128)
{
if(curBeat % 4 == 2)
{
if(!triggeredAlready)
{
gf.playAnim('cheer');
triggeredAlready = true;
}
}else triggeredAlready = false;
}
}
}
case 'Cocoa':
{
if(curBeat < 170)
{
if(curBeat < 65 || curBeat > 130 && curBeat < 145)
{
if(curBeat % 16 == 15)
{
if(!triggeredAlready)
{
gf.playAnim('cheer');
triggeredAlready = true;
}
}else triggeredAlready = false;
}
}
}
case 'Eggnog':
{
if(curBeat > 10 && curBeat != 111 && curBeat < 220)
{
if(curBeat % 8 == 7)
{
if(!triggeredAlready)
{
gf.playAnim('cheer');
triggeredAlready = true;
}
}else triggeredAlready = false;
}
}
}
}
} }
if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection)
@ -1839,7 +1940,7 @@ class PlayState extends MusicBeatState
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if desktop #if windows
// Game Over doesn't get his own variable because it's only used here // Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("GAME OVER -- " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(),"\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); DiscordClient.changePresence("GAME OVER -- " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(),"\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC);
#end #end
@ -2058,8 +2159,8 @@ class PlayState extends MusicBeatState
private function popUpScore(daNote:Note):Void private function popUpScore(daNote:Note):Void
{ {
var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); var noteDiff:Float = Math.abs(Conductor.songPosition - daNote.strumTime);
var wife:Float = EtternaFunctions.wife3(noteDiff, FlxG.save.data.etternaMode ? 1 : 1.7); var wife:Float = EtternaFunctions.wife3(noteDiff, Conductor.timeScale);
// boyfriend.playAnim('hey'); // boyfriend.playAnim('hey');
vocals.volume = 1; vocals.volume = 1;
@ -2107,9 +2208,6 @@ class PlayState extends MusicBeatState
sicks++; sicks++;
} }
if (FlxG.save.data.etternaMode)
etternaModeScore += Math.round(score / wife);
// trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife)); // trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife));
if (daRating != 'shit' || daRating != 'bad') if (daRating != 'shit' || daRating != 'bad')
@ -2117,6 +2215,7 @@ class PlayState extends MusicBeatState
songScore += Math.round(score); songScore += Math.round(score);
songScoreDef += Math.round(ConvertScore.convertScore(noteDiff));
/* if (combo > 60) /* if (combo > 60)
daRating = 'sick'; daRating = 'sick';
@ -2198,6 +2297,8 @@ class PlayState extends MusicBeatState
add(currentTimingShown); add(currentTimingShown);
var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2));
comboSpr.screenCenter(); comboSpr.screenCenter();
comboSpr.x = rating.x; comboSpr.x = rating.x;
@ -2463,14 +2564,7 @@ class PlayState extends MusicBeatState
{ {
var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition);
if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) daNote.rating = Ratings.CalculateRating(noteDiff);
daNote.rating = "shit";
else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50)
daNote.rating = "bad";
else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45)
daNote.rating = "good";
else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44)
daNote.rating = "sick";
if (NearlyEquals(daNote.strumTime,rep.replay.keyPresses[repPresses].time, 30)) if (NearlyEquals(daNote.strumTime,rep.replay.keyPresses[repPresses].time, 30))
{ {
@ -2520,14 +2614,7 @@ class PlayState extends MusicBeatState
{ {
var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition);
if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) daNote.rating = Ratings.CalculateRating(noteDiff);
daNote.rating = "shit";
else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50)
daNote.rating = "bad";
else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45)
daNote.rating = "good";
else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44)
daNote.rating = "sick";
goodNoteHit(daNote); goodNoteHit(daNote);
trace('force note hit'); trace('force note hit');
@ -2776,12 +2863,9 @@ class PlayState extends MusicBeatState
*/ */
function updateAccuracy() function updateAccuracy()
{ {
if (misses > 0 || accuracy < 96)
fc = false;
else
fc = true;
totalPlayed += 1; totalPlayed += 1;
accuracy = Math.max(0,totalNotesHit / totalPlayed * 100); accuracy = Math.max(0,totalNotesHit / totalPlayed * 100);
accuracyDefault = Math.max(0, totalNotesHitDefault / totalPlayed * 100);
} }
@ -2870,14 +2954,7 @@ class PlayState extends MusicBeatState
var noteDiff:Float = Math.abs(note.strumTime - Conductor.songPosition); var noteDiff:Float = Math.abs(note.strumTime - Conductor.songPosition);
if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) note.rating = Ratings.CalculateRating(noteDiff);
note.rating = "shit";
else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50)
note.rating = "bad";
else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45)
note.rating = "good";
else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44)
note.rating = "sick";
if (!note.isSustainNote) if (!note.isSustainNote)
notesHitArray.push(Date.now()); notesHitArray.push(Date.now());
@ -3034,7 +3111,7 @@ class PlayState extends MusicBeatState
// yes this updates every step. // yes this updates every step.
// yes this is bad // yes this is bad
// but i'm doing it to update misses and accuracy // but i'm doing it to update misses and accuracy
#if desktop #if windows
// Song duration in a float, useful for the time left feature // Song duration in a float, useful for the time left feature
songLength = FlxG.sound.music.length; songLength = FlxG.sound.music.length;

30
source/Ratings.hx Normal file
View File

@ -0,0 +1,30 @@
class Ratings
{
public static function CalculateRating(noteDiff:Float, ?customSafeZone:Float):String
{
var customTimeScale = Conductor.timeScale;
if (customSafeZone != null)
customTimeScale = customSafeZone / 166;
// trace(customTimeScale + ' vs ' + Conductor.timeScale);
// I HATE THIS IF CONDITION
// IF LEMON SEES THIS I'M SORRY :(
if (noteDiff > 135 * customTimeScale) // way early
return "shit";
else if (noteDiff > 90 * customTimeScale) // early
return "bad";
else if (noteDiff > 45 * customTimeScale) // your kinda there
return "good";
else if (noteDiff < -45 * customTimeScale) // little late
return "good";
else if (noteDiff < -90 * customTimeScale) // late
return "bad";
else if (noteDiff < -135 * customTimeScale) // late as fuck
return "shit";
return "sick";
}
}

View File

@ -13,7 +13,7 @@ import flixel.util.FlxColor;
import flixel.util.FlxTimer; import flixel.util.FlxTimer;
import lime.net.curl.CURLCode; import lime.net.curl.CURLCode;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end #end
@ -74,7 +74,7 @@ class StoryMenuState extends MusicBeatState
override function create() override function create()
{ {
#if desktop #if windows
// Updating Discord Rich Presence // Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null); DiscordClient.changePresence("In the Menus", null);
#end #end

View File

@ -24,8 +24,11 @@ import io.newgrounds.NG;
import lime.app.Application; import lime.app.Application;
import openfl.Assets; import openfl.Assets;
#if desktop #if windows
import Discord.DiscordClient; import Discord.DiscordClient;
#end
#if desktop
import sys.thread.Thread; import sys.thread.Thread;
#end #end
@ -59,7 +62,7 @@ class TitleState extends MusicBeatState
PlayerSettings.init(); PlayerSettings.init();
#if desktop #if windows
DiscordClient.initialize(); DiscordClient.initialize();
Application.current.onExit.add (function (exitCode) { Application.current.onExit.add (function (exitCode) {