Skip to content

Commit

Permalink
life is roblox
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Nov 5, 2023
1 parent 2eb6bf3 commit 93efc36
Show file tree
Hide file tree
Showing 16 changed files with 300 additions and 44 deletions.
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
### FNF-Specific
# File used for the NG API. Should not be shared with others.
APIStuff.hx

art/build_x32-officialrelease.bat
art/build_x64-officialrelease.bat
art/test_x64-debug-officialrelease.bat

### VS Code
### MacOS-Specific
*.DS_Store

### Haxe
export/*
.vscode/*
.haxelib/

### VS Code

.vscode/*
*.code-workspace
vs_Community.exe
# Local history which shouldn't be shared.
Expand Down
4 changes: 4 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<define name="HSCRIPT_ALLOWED" if="desktop" />
<define name="LUA_ALLOWED" if="desktop" />
<define name="ACHIEVEMENTS_ALLOWED" />
<define name="LOADING_SCREEN" />
<define name="VIDEOS_ALLOWED" if="windows || linux || android" unless="32bits"/>
<define name="PSYCH_WATERMARKS"/> <!-- DELETE THIS TO REMOVE WATERMARKS/DEV NAMES ON TITLE SCREEN -->
<define name="TITLE_SCREEN_EASTER_EGG" if="officialBuild"/> <!-- DELETE THE if="officialBuild" for enabling this on an unofficial build -->
Expand Down Expand Up @@ -121,6 +122,8 @@
<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" />

<haxedef name="HXCPP_GC_BIG_BLOCKS" if="cpp " /> <!-- mmmm memory -->

<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />

Expand All @@ -133,6 +136,7 @@
<!--Macro fixes-->
<haxeflag name="--macro" value="allowPackage('flash')" />
<haxeflag name="--macro" value="include('my.pack')" />
<haxeflag name="-dce" value="no" if="HSCRIPT_ALLOWED" />

<!-- _________________________________ Custom _______________________________ -->

Expand Down
Binary file added assets/shared/images/credits/kirbykid.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/shared/images/creeper aw man.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Main {
var ref:String = data.ref == null ? "" : data.ref;
Sys.command('haxelib --quiet git ${data.name} ${data.url} ${data.ref}');
default: // and finally, throw an error if the library has no type
Sys.println('[PSYCH ENGINE SETUP]: Unable to resolve library of type "${data.type}" for library "${data.name}"');
Sys.println('[VS FOXA SETUP]: Unable to resolve library of type "${data.type}" for library "${data.name}"');
}
}

Expand Down
51 changes: 51 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import openfl.events.Event;
import openfl.display.StageScaleMode;
import lime.app.Application;
import states.TitleState;
import flixel.math.FlxMath;
import flixel.util.FlxColor;

#if linux
import lime.graphics.Image;
Expand Down Expand Up @@ -84,6 +86,13 @@ class Main extends Sprite
}

setupGame();

var timer = new haxe.Timer(1);
timer.run = function()
{
coloring();
if (fpsVar.textColor == 0) fpsVar.textColor = -4775566;
} // needs to be done because textcolor beco
}

private function setupGame():Void
Expand Down Expand Up @@ -149,6 +158,48 @@ class Main extends Sprite
});
}

// Chroma Effect (12 Colors)
var array:Array<FlxColor> = [
FlxColor.fromRGB(216, 34, 83),
FlxColor.fromRGB(255, 38, 0),
FlxColor.fromRGB(255, 80, 0),
FlxColor.fromRGB(255, 147, 0),
FlxColor.fromRGB(255, 199, 0),
FlxColor.fromRGB(255, 255, 0),
FlxColor.fromRGB(202, 255, 0),
FlxColor.fromRGB(0, 255, 0),
FlxColor.fromRGB(0, 146, 146),
FlxColor.fromRGB(0, 0, 255),
FlxColor.fromRGB(82, 40, 204),
FlxColor.fromRGB(150, 33, 146)
];
var skippedFrames = 0;
var currentColor = 0;

// Event Handlers
public function coloring():Void
{
// Hippity, Hoppity, your code is now my property (from KadeEngine)
if (ClientPrefs.data.fpsRainbow)
{
if (currentColor >= array.length) currentColor = 0;
currentColor = Math.round(FlxMath.lerp(0, array.length, skippedFrames / ClientPrefs.data.framerate));
(cast(Lib.current.getChildAt(0), Main)).changeFPSColor(array[currentColor]);
currentColor++;
skippedFrames++;
if (skippedFrames > ClientPrefs.data.framerate)
skippedFrames = 0;
}
else
fpsVar.textColor = FlxColor.fromRGB(255, 255, 255);
}

public function changeFPSColor(color:FlxColor)
{
fpsVar.textColor = color;
}


static function resetSpriteCache(sprite:Sprite):Void {
@:privateAccess {
sprite.__cacheBitmap = null;
Expand Down
5 changes: 5 additions & 0 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ class SaveVariables {
public var showFPS:Bool = true;
public var flashing:Bool = true;
public var autoPause:Bool = true;
public var fullscreen:Bool = false;
public var antialiasing:Bool = true;
public var noteSkin:String = 'Default';
public var splashSkin:String = 'Psych';
public var splashAlpha:Float = 0.6;
public var fpsRainbow:Bool = false; // kadedev
public var laneUnderlay:Float = 0;
public var coloredHealthBar = true;
public var showMsText:Bool = true;
public var lowQuality:Bool = false;
public var shaders:Bool = true;
public var cacheOnGPU:Bool = #if !switch false #else true #end; //From Stilic
Expand Down
9 changes: 3 additions & 6 deletions source/backend/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import backend.Mods;

class Paths
{
inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
inline public static var VIDEO_EXT = "mp4";
inline public static final SOUND_EXT = #if web "mp3" #else "ogg" #end;
inline public static final VIDEO_EXT = "mp4";

public static function excludeAsset(key:String) {
if (!dumpExclusions.contains(key))
Expand Down Expand Up @@ -265,12 +265,9 @@ class Paths
if (FileSystem.exists(file))
bitmap = BitmapData.fromFile(file);
#else
else
#end
{
if (OpenFlAssets.exists(file, IMAGE))
bitmap = OpenFlAssets.getBitmapData(file);
}
#end

if(bitmap == null) return null;
}
Expand Down
74 changes: 73 additions & 1 deletion source/objects/HealthIcon.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
package objects;

class HealthIcon extends FlxSprite
{
public var sprTracker:FlxSprite;

private var isOldIcon:Bool = false;
private var isPlayer:Bool = false;
private var char:String = '';
private var defChar:String = '';

public function new(char:String = 'bf', isPlayer:Bool = false, ?allowGPU:Bool = true)
{
super();
isOldIcon = (char == 'bf-old');
this.isPlayer = isPlayer;
changeIcon(char, allowGPU);
scrollFactor.set();
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (sprTracker != null) setPosition(sprTracker.x + sprTracker.width + 12, sprTracker.y - 30);
}

public function swapOldIcon(){
if (isOldIcon = !isOldIcon) changeIcon('bf-old');
else changeIcon(defChar);
}

private var iconOffsets:Array<Float> = [0, 0];
public function changeIcon(char:String, ?allowGPU:Bool = true){
if (this.char != char)
{
var name:String = 'icons/' + char;
if (!Paths.fileExists('images/' + name + '.png', IMAGE)) name = 'icons/icon-' + char; // Older versions of psych engine's support
if (!Paths.fileExists('images/' + name + '.png', IMAGE)) name = 'icons/icon-face'; // Prevents crash from missing icon

var graphic = Paths.image(name, allowGPU);
var ratio = graphic.width / graphic.height;
if (ratio == 3 || ratio == 2 || ratio == 1)
loadGraphic(graphic, true, Math.floor(graphic.width / ratio), Math.floor(graphic.height));
else{
trace("Invalid icon ratio for character: " + char);
loadGraphic(Paths.image("icons/icon-face", allowGPU), true, Math.floor(graphic.width / 2), Math.floor(graphic.height));
}

iconOffsets[0] = (width - 150) / 2;
iconOffsets[1] = (height - 150) / 2;
updateHitbox();

var anims:Array<Int> = (ratio == 3) ? [0, 1, 2] : (ratio == 1) ? [0] : [0, 1];
animation.add(char, anims, 0, false, isPlayer);
animation.play(char);
this.char = char;
if (!isOldIcon) defChar = char;

if (char.endsWith('-pixel')) antialiasing = false;
else
antialiasing = ClientPrefs.data.antialiasing;
}
}
override function updateHitbox(){
super.updateHitbox();
offset.x = iconOffsets[0];
offset.y = iconOffsets[1];
}

public function getCharacter():String{
return char;
}
}

// in case it breaks
/*class HealthIcon extends FlxSprite
{
public var sprTracker:FlxSprite;
private var isOldIcon:Bool = false;
Expand Down Expand Up @@ -58,4 +130,4 @@ class HealthIcon extends FlxSprite
public function getCharacter():String {
return char;
}
}
}*/
9 changes: 9 additions & 0 deletions source/options/GraphicsSettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class GraphicsSettingsSubState extends BaseOptionsMenu
'bool');
addOption(option);

var option:Option = new Option('Fullscreen', "If checked, makes the game cover the whole screen.\nIt's something most PC games have.", 'fullscreen', 'bool');
addOption(option);
option.onChange = onChangeFullscreen;

var option:Option = new Option('GPU Caching', //Name
"If checked, allows the GPU to be used for caching textures, decreasing RAM usage.\nDon't turn this on if you have a shitty Graphics Card.", //Description
'cacheOnGPU',
Expand Down Expand Up @@ -92,4 +96,9 @@ class GraphicsSettingsSubState extends BaseOptionsMenu
super.changeSelection(change);
boyfriend.visible = (antialiasingOption == curSelected);
}

public static function onChangeFullscreen()
{
FlxG.fullscreen = ClientPrefs.data.fullscreen;
}
}
14 changes: 14 additions & 0 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class VisualsUISubState extends BaseOptionsMenu
'hideHud',
'bool');
addOption(option);

var option:Option = new Option('Icon Colored Health Bar',
"If unchecked, the health bar will have the colors from vanilla FNF\nrather than colors based on the icons.",
'coloredHealthBar',
'bool');
addOption(option);

var option:Option = new Option('Time Bar:',
"What should the Time Bar display?",
Expand Down Expand Up @@ -112,6 +118,11 @@ class VisualsUISubState extends BaseOptionsMenu
option.changeValue = 0.1;
option.decimals = 1;
addOption(option);

var option:Option = new Option('Display MS Offset Every Hit',
'If checked, the text with the note offset (in milliseconds) will appear near notes.',
'showMsText', 'bool');
addOption(option);

#if !mobile
var option:Option = new Option('FPS Counter',
Expand All @@ -120,6 +131,9 @@ class VisualsUISubState extends BaseOptionsMenu
'bool');
addOption(option);
option.onChange = onChangeFPSCounter;

var option:Option = new Option('Rainbow FPS', "If checked, makes the FPS have a chroma effect.\nSo Kade Engine, isn't it?", 'fpsRainbow', 'bool');
addOption(option);
#end

var option:Option = new Option('Pause Screen Song:',
Expand Down
27 changes: 24 additions & 3 deletions source/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ class MainMenuState extends MusicBeatState
var menuItems:FlxTypedGroup<FlxSprite>;
private var camGame:FlxCamera;

public static var quotes:Array<String> = [
#if html5
"You're on web. Why the FUCK are you on web? You can't get even decent easter eggs, bitch."
#else
"500+ Giftcards! (-CharlesCatYT)",
"bro became starfire from teen titans go (-Monomouse)",
"Hi (-ScriptedMar)",
"Damn how many fnf mods are ya'll making1?!?! (-ItsToppy)",
"YOUR ARGUMENT, IS NOW INVALID! (-Monomouse)",
"when did we start playing freeze tag (-Vencerist)",
"top 100 reasons why I won't ask foxa unless she's online (-CharlesCatYT)",
"Lowkey smooth (-TheAnimateMan)",
"JHJJTLKGFD WHY IS MILKY SO LOUD IN THE EXPORT (-cyborg henry)",
"I like starting a fire (-Vencerist)"
#end
];

var optionShit:Array<String> = [
'story_mode',
'freeplay',
Expand Down Expand Up @@ -105,15 +122,19 @@ class MainMenuState extends MusicBeatState

FlxG.camera.follow(camFollow, null, 0);

var versionShit:FlxText = new FlxText(12, FlxG.height - 64, 0, 'Psych Engine v$psychEngineVersion', 12);
var versionShit:FlxText = new FlxText(12, FlxG.height - 84, 0, 'Psych Engine v$psychEngineVersion', 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
var versionShit:FlxText = new FlxText(12, FlxG.height - 64, 0, "Vs. Foxa v3.0", 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
var versionShit:FlxText = new FlxText(12, FlxG.height - 44, 0, "Vs. Foxa v3.0", 12);
var versionShit:FlxText = new FlxText(12, FlxG.height - 44, 0, "Friday Night Funkin' v" + Application.current.meta.get('version'), 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
var versionShit:FlxText = new FlxText(12, FlxG.height - 24, 0, "Friday Night Funkin' v" + Application.current.meta.get('version'), 12);
var versionShit:FlxText = new FlxText(12, FlxG.height - 44, 0, quotes[Std.random(quotes.length)], 12);
versionShit.scrollFactor.set();
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit);
Expand Down
Loading

0 comments on commit 93efc36

Please sign in to comment.