Skip to content

Commit

Permalink
hewwo!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackx2 committed Dec 1, 2024
1 parent e53d4ea commit c3b8907
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 200 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<!-- ______________________________ Haxedefines _____________________________ -->

<!-- A Script That Runs Before Complie -->
<prebuild haxe="source/Prebuild.hx"/>
<prebuild haxe="source/Prebuild.hx" unless="display"/>

<!--Disable the Flixel core focus lost screen-->
<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />
Expand Down
Binary file added assets/shared/images/erm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions assets/shared/images/erm.txt

Large diffs are not rendered by default.

Binary file modified assets/shared/images/timeBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions source/Prebuild.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,31 @@ package source;
#if !display
import sys.io.File;

class Prebuild
final class Prebuild
{
private inline static final title:String = "
▄▀█ █▀ ▀█▀ █▀█ █▀█   █▀▀ █▄░█ █▀▀ █ █▄░█ █▀▀
█▀█ ▄█ ░█░ █▀▄ █▄█   ██▄ █░▀█ █▄█ █ █░▀█ ██▄
";

private inline static final subtitle:String = "
█▀▀ █▀█ █▀▄▀█ █▀█ █ █░░ █▀▀ █▀█
█▄▄ █▄█ █░▀░█ █▀▀ █ █▄▄ ██▄ █▀▄
";
private inline static final lines:String = "
--------------------------------------------
";

private inline static final owoquote:String = "
erm, what the sigma? :3c
";

private inline static final binded:String = '$lines$title$subtitle$owoquote$lines';

static function main():Void
{
trace('Building!');
//trace('Building!');
trace(binded);
}
}
#end
7 changes: 5 additions & 2 deletions source/funkin/backend/base/BaseScorebar.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package funkin.backend.base;

import funkin.game.objects.scorebars.DefaultHUD;

class BaseScorebar extends FlxBasic
{
private var game(get, never):Dynamic;
Expand All @@ -16,8 +18,9 @@ class BaseScorebar extends FlxBasic
else
{
FlxG.log.add('Scorebar Created');

super();
game.baseUI = new DefaultHUD();
create();

game.stageUpdate = update;
Expand Down Expand Up @@ -55,7 +58,7 @@ class BaseScorebar extends FlxBasic
return cast FlxG.state;

private inline function get_defaultPos()
return game.healthBar.getPosition();
return game.baseUI.healthBar.getPosition();

// uhh owo?
function add(object:FlxBasic)
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/backend/funkinLua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ class FunkinLua {
left_color = CoolUtil.colorFromString(left);
if (right != null && right != '')
right_color = CoolUtil.colorFromString(right);
game.healthBar.setColors(left_color, right_color);
game.baseUI.healthBar.setColors(left_color, right_color);
});
Lua_helper.add_callback(lua, "setTimeBarColors", function(left:String, right:String) {
var left_color:Null<FlxColor> = null;
Expand All @@ -1175,7 +1175,7 @@ class FunkinLua {
left_color = CoolUtil.colorFromString(left);
if (right != null && right != '')
right_color = CoolUtil.colorFromString(right);
game.timeBar.setColors(left_color, right_color);
game.baseUI.timeBar.setColors(left_color, right_color);
});

Lua_helper.add_callback(lua, "setObjectCamera", function(obj:String, camera:String = 'game') {
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/backend/system/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MusicBeatState extends FlxState

public static function init()
{
trace('Init Complete'); // Makes Sure MusicBeatState isnt null fr
trace('Initialization Complete'); // Makes Sure MusicBeatState isnt null fr
}

public function addBehindObject(obj:FlxBasic, obj2:FlxBasic)
Expand Down
18 changes: 13 additions & 5 deletions source/funkin/backend/utils/CacheUtils.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ enum CacheType
{
COUNTDOWN;
POPUPSCORE;
CUSTOM;
NONE;
}

class CacheUtils
{
public static function cache(type:CacheType = COUNTDOWN)
public static function cache(type:CacheType = COUNTDOWN, ?doTrace:Bool = true)
{
trace('Cached: $type');
if(doTrace)
trace('Cached: $type');
switch (type)
{
case COUNTDOWN:
Expand All @@ -22,6 +25,12 @@ class CacheUtils
}
}

public static function cacheArgs(list:Array<CacheType>) {
for (i in list)
cache(i, false);
trace('Successfully Cached: ${list}');
}

public static function cacheCountdown()
{
final introSoundsSuffix = PlayState.instance.introSoundsSuffix;
Expand All @@ -39,9 +48,8 @@ class CacheUtils
for (asset in introAlts)
Paths.image(asset);

Paths.sound('intro3' + introSoundsSuffix);
Paths.sound('intro2' + introSoundsSuffix);
Paths.sound('intro1' + introSoundsSuffix);
for(i in 1...3)
Paths.sound('intro$i' + introSoundsSuffix);
Paths.sound('introGo' + introSoundsSuffix);
}

Expand Down
9 changes: 5 additions & 4 deletions source/funkin/game/objects/scorebars/AstroScore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class AstroScore extends BaseScorebar

override function create()
{
super.create();

scoreText = new FlxText(0, defaultPos.y + 36, FlxG.width, "ermOwo?", 20);
scoreText = new FlxText(0, defaultPos.y + 36, FlxG.width, "erm, owo???", 20);
scoreText.scrollFactor.set();
scoreText.borderSize = 1.25;
scoreText.visible = !ClientPrefs.data.hideFullHUD;
Expand Down Expand Up @@ -100,6 +98,10 @@ class AstroScore extends BaseScorebar
add(missTxt);
addCurveBG(missTxt.x - 10, missTxt.y - 2.5, sickTxt.fieldWidth - 10, 35, 35, 0, game.uiBackgroundGroup);
}

super.create();

game.baseUI.timeTxt.setFormat(Paths.font("PhantomMuff.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
}

override function update(f)
Expand All @@ -113,7 +115,6 @@ class AstroScore extends BaseScorebar

override function updateScore()
{
super.updateScore();
scoreText.text = 'Score: '
+ game.songScore
+ ' • Misses: '
Expand Down
170 changes: 170 additions & 0 deletions source/funkin/game/objects/scorebars/DefaultHUD.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
package funkin.game.objects.scorebars;

import flixel.util.FlxStringUtil;

class DefaultHUD extends FlxBasic
{
private var game:PlayState = PlayState.instance;

public var timeBar:Bar;
public var timeTxt:FlxText;
public var healthBar:Bar;

// Health Icons
public var iconP1:HealthIcon;
public var iconP2:HealthIcon;


public var botplaySine:Float = 0;
public var botplayTxt:FlxText;

public function new()
{
super();

game.baseUI = this;

createHealthBar();
createSongTimer();

botplayTxt = new FlxText(400, healthBar.y - 90, FlxG.width - 800, 'BOTPLAY', 32);
botplayTxt.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
botplayTxt.scrollFactor.set();
botplayTxt.borderSize = 1.25;
botplayTxt.visible = game.cpuControlled;
game.uiGroup.add(botplayTxt);
if (ClientPrefs.data.downScroll)
botplayTxt.y = healthBar.y + 70;
}

function createHealthBar()
{
healthBar = new Bar(0, FlxG.height * (!ClientPrefs.data.downScroll ? 0.89 : 0.11), 'healthBar', function() return game.health, 0, 2);
healthBar.screenCenter(X);
healthBar.leftToRight = false;
healthBar.scrollFactor.set();
healthBar.visible = !ClientPrefs.data.hideHud;
healthBar.alpha = ClientPrefs.data.healthBarAlpha;
reloadHealthBarColors();
game.uiGroup.add(healthBar);

// furry
iconP1 = new HealthIcon(game.boyfriend.healthIcon, true);
iconP1.y = healthBar.y - 75;
iconP1.visible = !ClientPrefs.data.hideFullHUD;
iconP1.alpha = ClientPrefs.data.healthBarAlpha;
game.uiGroup.add(iconP1);

iconP2 = new HealthIcon(game.dad.healthIcon, false);
iconP2.y = healthBar.y - 75;
iconP2.visible = !ClientPrefs.data.hideFullHUD;
iconP2.alpha = ClientPrefs.data.healthBarAlpha;
game.uiGroup.add(iconP2);
}

public function beatHit()
{
iconP1.scale.set(1.2, 1.2);
iconP2.scale.set(1.2, 1.2);

iconP1.updateHitbox();
iconP2.updateHitbox();
}

public function reloadHealthBarColors()
{
final dadColor:FlxColor = FlxColor.fromRGB(game.dad.healthColorArray[0], game.dad.healthColorArray[1], game.dad.healthColorArray[2]);
final boyfriendColor:FlxColor = FlxColor.fromRGB(game.boyfriend.healthColorArray[0], game.boyfriend.healthColorArray[1],
game.boyfriend.healthColorArray[2]);
healthBar.setColors(dadColor, boyfriendColor);
}

function createSongTimer()
{
var showTime:Bool = (ClientPrefs.data.timeBarType != 'Disabled');
timeTxt = new FlxText(PlayState.STRUM_X + (FlxG.width / 2) - 248, 14, 400, "eeeeeee", 32);
timeTxt.setFormat(Paths.font("vcr.ttf"), 35, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
timeTxt.scrollFactor.set();
timeTxt.alpha = 0;
timeTxt.borderSize = 2;
timeTxt.visible = showTime;

if (ClientPrefs.data.downScroll)
timeTxt.y = FlxG.height - 44;

if (ClientPrefs.data.timeBarType == 'Song Name')
timeTxt.text = PlayState.SONG.song;

@:privateAccess
PlayState.instance.updateTime = showTime;

@:privateAccess
timeBar = new Bar(0, timeTxt.y + (timeTxt.height / 4), 'timeBar', function() return game.songPercent, 0, 1);
timeBar.scrollFactor.set();
timeBar.screenCenter(X);
timeBar.alpha = 0;
timeBar.visible = showTime;
timeBar.leftBar.color = FlxColor.fromRGB(game.dad.healthColorArray[0], game.dad.healthColorArray[1], game.dad.healthColorArray[2]);
game.uiGroup.add(timeBar);
game.uiGroup.add(timeTxt);

if (ClientPrefs.data.hideFullHUD)
timeBar.visible = false;
else
timeBar.visible = showTime;

if (ClientPrefs.data.timeBarType == 'Song Name')
{
timeTxt.size = 24;
timeTxt.y += 3;
}
}

public function startSong()
{
FlxTween.tween(timeBar, {alpha: 1}, 0.5, {ease: FlxEase.circOut});
FlxTween.tween(timeTxt, {alpha: 1}, 0.5, {ease: FlxEase.circOut});
}


override public function update(elapsed:Float)
{
super.update(elapsed);

var mult:Float = FlxMath.lerp(1, iconP1.scale.x, CoolUtil.boundTo(1 - (elapsed * 9 * game.playbackRate), 0, 1));
iconP1.scale.set(mult, mult);
iconP1.updateHitbox();

var mult:Float = FlxMath.lerp(1, iconP2.scale.x, CoolUtil.boundTo(1 - (elapsed * 9 * game.playbackRate), 0, 1));
iconP2.scale.set(mult, mult);
iconP2.updateHitbox();

final iconOffset:Int = 26;

iconP1.x = healthBar.x
+ (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01))
+ (150 * iconP1.scale.x - 150) / 2
- iconOffset;
iconP2.x = healthBar.x
+ (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01))
- (150 * iconP2.scale.x) / 2
- iconOffset * 2;

if (healthBar.percent < 20)
iconP1.animation.curAnim.curFrame = 1;
else
iconP1.animation.curAnim.curFrame = 0;

if (healthBar.percent > 80)
iconP2.animation.curAnim.curFrame = 1;
else
iconP2.animation.curAnim.curFrame = 0;

if (botplayTxt.visible)
{
botplaySine += 180 * elapsed;
botplayTxt.alpha = 1 - Math.sin((Math.PI * botplaySine) / 180);
}
}

}
5 changes: 3 additions & 2 deletions source/funkin/game/objects/scorebars/PsychScore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class PsychScore extends BaseScorebar
{
super.create();

scoreText = new FlxText(0, defaultPos.y + 36, FlxG.width, "", 20);
//game.baseUI.defaultFont = Paths.font("vcr.ttf");

scoreText = new FlxText(0, defaultPos.y + 40, FlxG.width, "", 20);
scoreText.scrollFactor.set();
scoreText.borderSize = 1.25;
scoreText.visible = !ClientPrefs.data.hideFullHUD;
Expand All @@ -19,7 +21,6 @@ class PsychScore extends BaseScorebar

override function updateScore()
{
super.updateScore();
scoreText.text = 'Score: '
+ PlayState.instance.songScore
+ ' - Misses: '
Expand Down
11 changes: 6 additions & 5 deletions source/funkin/game/objects/scorebars/VSliceScore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ class VSliceScore extends BaseScorebar
private var scoreText:FlxText;

override function create()
{
super.create();

var defaultPosButBetter = game.healthBar.bg;
{
final defaultPosButBetter = game.baseUI.healthBar.bg;

scoreText = new FlxText(defaultPosButBetter.x + defaultPosButBetter.width - 190, defaultPosButBetter.y + 30, 0, '', 20);
scoreText.scrollFactor.set();
Expand All @@ -19,11 +17,14 @@ class VSliceScore extends BaseScorebar
scoreText.alpha = 0;
scoreText.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(scoreText);

super.create();

game.baseUI.timeTxt.visible = game.baseUI.timeBar.visible = false;
}

override function updateScore()
{
super.updateScore();
scoreText.text = 'Score: ' + FlxStringUtil.formatMoney(PlayState.instance.songScore, false, true);
}
}
Loading

0 comments on commit c3b8907

Please sign in to comment.