mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-03-22 21:06:19 -04:00
commit
75938a5daf
6 changed files with 280 additions and 95 deletions
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
|
@ -1,6 +1,15 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "HTML5 Debug",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://127.0.0.1:3001",
|
||||
"sourceMaps": true,
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"preLaunchTask": "debug: html"
|
||||
},
|
||||
{
|
||||
"name": "Lime",
|
||||
"type": "lime",
|
||||
|
|
12
Project.xml
12
Project.xml
|
@ -204,6 +204,18 @@
|
|||
<haxedef name="CAN_OPEN_LINKS" unless="switch"/>
|
||||
<haxedef name="CAN_CHEAT" if="switch debug"/>
|
||||
|
||||
<!-- Skip the Intro -->
|
||||
<section if="debug">
|
||||
<!-- Starts the game at the specified week, at the first song -->
|
||||
<!-- <haxedef name="week" value="1" if="debug"/> -->
|
||||
|
||||
<!-- Starts the game at the specified song -->
|
||||
<!-- <haxedef name="song" value="bopeebo" if="debug"/> -->
|
||||
|
||||
<!-- Difficulty, only used for week or song, defaults to 1 -->
|
||||
<!-- <haxedef name="dif" value="2" if="debug"/> -->
|
||||
</section>
|
||||
|
||||
<!-- <haxedef name="CLEAR_INPUT_SAVE"/> -->
|
||||
|
||||
<section if="newgrounds">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
#if !(macro)
|
||||
import charting.ChartingState;
|
||||
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
|
@ -110,8 +111,52 @@ class InitState extends FlxTransitionableState
|
|||
|
||||
// FlxTransitionableState.skipNextTransOut = true;
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
|
||||
#if FREEPLAY
|
||||
|
||||
#if song
|
||||
|
||||
var song = getSong();
|
||||
|
||||
var weeks =
|
||||
[ ['bopeebo', 'fresh', 'dadbattle']
|
||||
, ['spookeez', 'south', 'monster']
|
||||
, ['spooky', 'spooky', 'monster']
|
||||
, ['pico', 'philly', 'blammed']
|
||||
, ['satin-panties', 'high', 'milf']
|
||||
, ['cocoa', 'eggnog', 'winter-horrorland']
|
||||
, ['senpai', 'roses', 'thorns']
|
||||
, ['ugh', 'guns', 'stress']
|
||||
];
|
||||
|
||||
var week = 0;
|
||||
for (i in 0...weeks.length)
|
||||
{
|
||||
if (weeks[i].contains(song))
|
||||
{
|
||||
week = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (week == 0)
|
||||
throw 'Invalid -D song=$song';
|
||||
|
||||
startSong(week, song, false);
|
||||
|
||||
#elseif week
|
||||
|
||||
var week = getWeek();
|
||||
|
||||
var songs =
|
||||
[ 'bopeebo', 'spookeez', 'spooky', 'pico'
|
||||
, 'satin-panties', 'cocoa', 'senpai', 'ugh'
|
||||
];
|
||||
|
||||
if (week <= 0 || week >= songs.length)
|
||||
throw "invalid -D week=" + week;
|
||||
|
||||
startSong(week, songs[week - 1], true);
|
||||
|
||||
#elseif FREEPLAY
|
||||
FlxG.switchState(new FreeplayState());
|
||||
#elseif ANIMATE
|
||||
FlxG.switchState(new animate.AnimTestStage());
|
||||
|
@ -128,4 +173,35 @@ class InitState extends FlxTransitionableState
|
|||
FlxG.switchState(new TitleState());
|
||||
#end
|
||||
}
|
||||
|
||||
function startSong(week, song, isStoryMode)
|
||||
{
|
||||
var dif = getDif();
|
||||
|
||||
PlayState.SONG = SongLoad.loadFromJson(song, song);
|
||||
PlayState.isStoryMode = isStoryMode;
|
||||
PlayState.storyDifficulty = dif;
|
||||
SongLoad.curDiff = switch (dif)
|
||||
{
|
||||
case 0: 'easy';
|
||||
case 1: 'normal';
|
||||
case 2: 'hard';
|
||||
default: 'normal';
|
||||
};
|
||||
PlayState.storyWeek = week;
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
function getWeek() return Std.parseInt(getDefine("week"));
|
||||
function getSong() return getDefine("song");
|
||||
function getDif() return Std.parseInt(getDefine("dif", "1"));
|
||||
|
||||
macro function getDefine(key:String, defaultValue:String = null):haxe.macro.Expr
|
||||
{
|
||||
var value = haxe.macro.Context.definedValue(key);
|
||||
if (value == null)
|
||||
value = defaultValue;
|
||||
return macro $v{value};
|
||||
}
|
||||
|
|
218
source/Note.hx
218
source/Note.hx
|
@ -16,12 +16,7 @@ import polymod.format.ParseRules.TargetSignatureElement;
|
|||
|
||||
class Note extends FlxSprite
|
||||
{
|
||||
public var data:NoteData = {
|
||||
strumTime: 0,
|
||||
noteData: 0,
|
||||
sustainLength: 0,
|
||||
altNote: false
|
||||
};
|
||||
public var data = new NoteData();
|
||||
|
||||
/**
|
||||
* code colors for.... code....
|
||||
|
@ -48,7 +43,29 @@ class Note extends FlxSprite
|
|||
public var isSustainNote:Bool = false;
|
||||
|
||||
public var colorSwap:ColorSwap;
|
||||
|
||||
|
||||
/** the lowercase name of the note, for anim control, i.e. left right up down */
|
||||
public var dirName(get, never):String;
|
||||
inline function get_dirName() return data.dirName;
|
||||
|
||||
/** the uppercase name of the note, for anim control, i.e. left right up down */
|
||||
public var dirNameUpper(get, never):String;
|
||||
inline function get_dirNameUpper() return data.dirNameUpper;
|
||||
|
||||
/** the lowercase name of the note's color, for anim control, i.e. purple blue green red */
|
||||
public var colorName(get, never):String;
|
||||
inline function get_colorName() return data.colorName;
|
||||
|
||||
/** the lowercase name of the note's color, for anim control, i.e. purple blue green red */
|
||||
public var colorNameUpper(get, never):String;
|
||||
inline function get_colorNameUpper() return data.colorNameUpper;
|
||||
|
||||
public var highStakes(get, never):Bool;
|
||||
inline function get_highStakes() return data.highStakes;
|
||||
|
||||
public var lowStakes(get, never):Bool;
|
||||
inline function get_lowStakes() return data.lowStakes;
|
||||
|
||||
public static var swagWidth:Float = 160 * 0.7;
|
||||
public static var PURP_NOTE:Int = 0;
|
||||
public static var GREEN_NOTE:Int = 2;
|
||||
|
@ -69,7 +86,7 @@ class Note extends FlxSprite
|
|||
// anything below sick threshold is sick
|
||||
public static var arrowColors:Array<Float> = [1, 1, 1, 1];
|
||||
|
||||
public function new(strumTime:Float = 0, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false)
|
||||
public function new(strumTime:Float = 0, noteData:NoteType, ?prevNote:Note, ?sustainNote:Bool = false)
|
||||
{
|
||||
super();
|
||||
|
||||
|
@ -150,21 +167,8 @@ class Note extends FlxSprite
|
|||
shader = colorSwap.shader;
|
||||
updateColors();
|
||||
|
||||
switch (noteData)
|
||||
{
|
||||
case 0:
|
||||
x += swagWidth * 0;
|
||||
animation.play('purpleScroll');
|
||||
case 1:
|
||||
x += swagWidth * 1;
|
||||
animation.play('blueScroll');
|
||||
case 2:
|
||||
x += swagWidth * 2;
|
||||
animation.play('greenScroll');
|
||||
case 3:
|
||||
x += swagWidth * 3;
|
||||
animation.play('redScroll');
|
||||
}
|
||||
x += swagWidth * data.int;
|
||||
animation.play(data.colorName + 'Scroll');
|
||||
|
||||
// trace(prevNote);
|
||||
|
||||
|
@ -177,17 +181,7 @@ class Note extends FlxSprite
|
|||
|
||||
x += width / 2;
|
||||
|
||||
switch (noteData)
|
||||
{
|
||||
case 2:
|
||||
animation.play('greenholdend');
|
||||
case 3:
|
||||
animation.play('redholdend');
|
||||
case 1:
|
||||
animation.play('blueholdend');
|
||||
case 0:
|
||||
animation.play('purpleholdend');
|
||||
}
|
||||
animation.play(data.colorName + 'holdend');
|
||||
|
||||
updateHitbox();
|
||||
|
||||
|
@ -198,18 +192,7 @@ class Note extends FlxSprite
|
|||
|
||||
if (prevNote.isSustainNote)
|
||||
{
|
||||
switch (prevNote.data.noteData)
|
||||
{
|
||||
case 0:
|
||||
prevNote.animation.play('purplehold');
|
||||
case 1:
|
||||
prevNote.animation.play('bluehold');
|
||||
case 2:
|
||||
prevNote.animation.play('greenhold');
|
||||
case 3:
|
||||
prevNote.animation.play('redhold');
|
||||
}
|
||||
|
||||
prevNote.animation.play(prevNote.colorName + 'hold');
|
||||
prevNote.updateHitbox();
|
||||
|
||||
var scaleThing:Float = Math.round((Conductor.stepCrochet) * (0.45 * FlxMath.roundDecimal(SongLoad.getSpeed(), 2)));
|
||||
|
@ -280,12 +263,151 @@ class Note extends FlxSprite
|
|||
alpha = 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
static public function fromData(data:NoteData, prevNote:Note, isSustainNote = false)
|
||||
{
|
||||
return new Note(data.strumTime, data.noteData, prevNote, isSustainNote);
|
||||
}
|
||||
}
|
||||
|
||||
typedef NoteData =
|
||||
typedef RawNoteData =
|
||||
{
|
||||
var strumTime:Float;
|
||||
var noteData:Int;
|
||||
var noteData:NoteType;
|
||||
var sustainLength:Float;
|
||||
var altNote:Bool;
|
||||
}
|
||||
|
||||
@:forward
|
||||
abstract NoteData(RawNoteData)
|
||||
{
|
||||
public function new (strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = false)
|
||||
{
|
||||
this =
|
||||
{ strumTime : strumTime
|
||||
, noteData : noteData
|
||||
, sustainLength : sustainLength
|
||||
, altNote : altNote
|
||||
}
|
||||
}
|
||||
|
||||
public var note(get, never):NoteType;
|
||||
inline function get_note() return this.noteData.value;
|
||||
|
||||
public var int(get, never):Int;
|
||||
inline function get_int() return this.noteData.int;
|
||||
|
||||
public var dir(get, never):NoteDir;
|
||||
inline function get_dir() return this.noteData.value;
|
||||
|
||||
public var dirName(get, never):String;
|
||||
inline function get_dirName() return dir.name;
|
||||
|
||||
public var dirNameUpper(get, never):String;
|
||||
inline function get_dirNameUpper() return dir.nameUpper;
|
||||
|
||||
public var color(get, never):NoteColor;
|
||||
inline function get_color() return this.noteData.value;
|
||||
|
||||
public var colorName(get, never):String;
|
||||
inline function get_colorName() return color.name;
|
||||
|
||||
public var colorNameUpper(get, never):String;
|
||||
inline function get_colorNameUpper() return color.nameUpper;
|
||||
|
||||
public var highStakes(get, never):Bool;
|
||||
inline function get_highStakes() return this.noteData.highStakes;
|
||||
|
||||
public var lowStakes(get, never):Bool;
|
||||
inline function get_lowStakes() return this.noteData.lowStakes;
|
||||
}
|
||||
|
||||
enum abstract NoteType(Int) from Int to Int
|
||||
{
|
||||
// public var raw(get, never):Int;
|
||||
// inline function get_raw() return this;
|
||||
|
||||
public var int(get, never):Int;
|
||||
inline function get_int() return this < 0 ? -this : this % 4;
|
||||
|
||||
public var value(get, never):NoteType;
|
||||
inline function get_value() return int;
|
||||
|
||||
public var highStakes(get, never):Bool;
|
||||
inline function get_highStakes() return this > 3;
|
||||
|
||||
public var lowStakes(get, never):Bool;
|
||||
inline function get_lowStakes() return this < 0;
|
||||
}
|
||||
|
||||
@:forward
|
||||
enum abstract NoteDir(NoteType) from Int to Int from NoteType
|
||||
{
|
||||
var LEFT = 0;
|
||||
var DOWN = 1;
|
||||
var UP = 2;
|
||||
var RIGHT = 3;
|
||||
|
||||
var value(get, never):NoteDir;
|
||||
inline function get_value() return this.value;
|
||||
|
||||
public var name(get, never):String;
|
||||
function get_name()
|
||||
{
|
||||
return switch(value)
|
||||
{
|
||||
case LEFT : "left" ;
|
||||
case DOWN : "down" ;
|
||||
case UP : "up" ;
|
||||
case RIGHT: "right";
|
||||
}
|
||||
}
|
||||
|
||||
public var nameUpper(get, never):String;
|
||||
function get_nameUpper()
|
||||
{
|
||||
return switch(value)
|
||||
{
|
||||
case LEFT : "LEFT" ;
|
||||
case DOWN : "DOWN" ;
|
||||
case UP : "UP" ;
|
||||
case RIGHT: "RIGHT";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@:forward
|
||||
enum abstract NoteColor(NoteType) from Int to Int from NoteType
|
||||
{
|
||||
var PURPLE = 0;
|
||||
var BLUE = 1;
|
||||
var GREEN = 2;
|
||||
var RED = 3;
|
||||
|
||||
var value(get, never):NoteColor;
|
||||
inline function get_value() return this.value;
|
||||
|
||||
public var name(get, never):String;
|
||||
function get_name()
|
||||
{
|
||||
return switch(value)
|
||||
{
|
||||
case PURPLE: "purple";
|
||||
case BLUE : "blue" ;
|
||||
case GREEN : "green" ;
|
||||
case RED : "red" ;
|
||||
}
|
||||
}
|
||||
|
||||
public var nameUpper(get, never):String;
|
||||
function get_nameUpper()
|
||||
{
|
||||
return switch(value)
|
||||
{
|
||||
case PURPLE: "PURPLE";
|
||||
case BLUE : "BLUE" ;
|
||||
case GREEN : "GREEN" ;
|
||||
case RED : "RED" ;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import Note;
|
||||
import Section.SwagSection;
|
||||
import SongLoad.SwagSong;
|
||||
import charting.ChartingState;
|
||||
|
@ -1592,7 +1593,7 @@ class PlayState extends MusicBeatState
|
|||
|
||||
var gottaHitNote:Bool = section.mustHitSection;
|
||||
|
||||
if (songNotes.noteData > 3)
|
||||
if (songNotes.highStakes)
|
||||
gottaHitNote = !section.mustHitSection;
|
||||
|
||||
var oldNote:Note;
|
||||
|
@ -2195,17 +2196,7 @@ class PlayState extends MusicBeatState
|
|||
|
||||
if (!daNote.isSustainNote)
|
||||
{
|
||||
switch (Math.abs(daNote.data.noteData))
|
||||
{
|
||||
case 0:
|
||||
dad.playAnim('singLEFT' + altAnim, true);
|
||||
case 1:
|
||||
dad.playAnim('singDOWN' + altAnim, true);
|
||||
case 2:
|
||||
dad.playAnim('singUP' + altAnim, true);
|
||||
case 3:
|
||||
dad.playAnim('singRIGHT' + altAnim, true);
|
||||
}
|
||||
dad.playAnim('sing' + daNote.dirNameUpper + altAnim, true);
|
||||
}
|
||||
|
||||
dad.holdTimer = 0;
|
||||
|
@ -2429,10 +2420,10 @@ class PlayState extends MusicBeatState
|
|||
|
||||
var healthMulti:Float = 1;
|
||||
|
||||
if (daNote.data.noteData >= 0)
|
||||
healthMulti *= 0.033;
|
||||
else
|
||||
if (daNote.lowStakes)
|
||||
healthMulti *= 0.002;
|
||||
else
|
||||
healthMulti *= 0.033;
|
||||
|
||||
if (noteDiff > Note.HIT_WINDOW * Note.BAD_THRESHOLD)
|
||||
{
|
||||
|
@ -2852,7 +2843,7 @@ class PlayState extends MusicBeatState
|
|||
return super.switchTo(nextState);
|
||||
}
|
||||
|
||||
function noteMiss(direction:Int = 1):Void
|
||||
function noteMiss(direction:NoteDir = 1):Void
|
||||
{
|
||||
// whole function used to be encased in if (!boyfriend.stunned)
|
||||
health -= 0.07;
|
||||
|
@ -2872,17 +2863,7 @@ class PlayState extends MusicBeatState
|
|||
boyfriend.stunned = false;
|
||||
});*/
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
boyfriend.playAnim('singLEFTmiss', true);
|
||||
case 1:
|
||||
boyfriend.playAnim('singDOWNmiss', true);
|
||||
case 2:
|
||||
boyfriend.playAnim('singUPmiss', true);
|
||||
case 3:
|
||||
boyfriend.playAnim('singRIGHTmiss', true);
|
||||
}
|
||||
boyfriend.playAnim('sing' + direction.nameUpper + 'miss', true);
|
||||
}
|
||||
|
||||
/* not used anymore lol
|
||||
|
@ -2914,18 +2895,8 @@ class PlayState extends MusicBeatState
|
|||
combo += 1;
|
||||
popUpScore(note.data.strumTime, note);
|
||||
}
|
||||
|
||||
switch (note.data.noteData)
|
||||
{
|
||||
case 0:
|
||||
boyfriend.playAnim('singLEFT', true);
|
||||
case 1:
|
||||
boyfriend.playAnim('singDOWN', true);
|
||||
case 2:
|
||||
boyfriend.playAnim('singUP', true);
|
||||
case 3:
|
||||
boyfriend.playAnim('singRIGHT', true);
|
||||
}
|
||||
|
||||
boyfriend.playAnim('sing' + note.dirNameUpper, true);
|
||||
|
||||
playerStrums.forEach(function(spr:FlxSprite)
|
||||
{
|
||||
|
|
|
@ -161,12 +161,7 @@ class SongLoad
|
|||
|
||||
public static function getDefaultNoteData():NoteData
|
||||
{
|
||||
return {
|
||||
strumTime: 0,
|
||||
altNote: false,
|
||||
sustainLength: 0,
|
||||
noteData: 0
|
||||
}
|
||||
return new NoteData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue