Skip to content

Commit

Permalink
wasd
Browse files Browse the repository at this point in the history
  • Loading branch information
VMan-2002 committed Nov 14, 2023
1 parent edd2bfe commit a01e4b8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 41 deletions.
7 changes: 5 additions & 2 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,16 @@ class Character extends SpriteVManExtra {

//todo: i still haven't unhardcoded these characters (gf, gf-christmas, gf-tankmen, bf-holding-gf, gf-car, gf-pixel, mom-car, monster, monster-christmas, pico-speaker, bf, bf-dead, bf-christmas, bf-car, bf-pixel, bf-pixel-dead, bf-holding-gf-dead, senpai, senpai-angry, spirit, parents-christmas, tankman)
switch (curCharacter) {
case "emptyLoad":
case "emptyLoad" | "emptyInvisible":
//load the minimum required stuff
frames = null;
//todo: why doesn't this work hmmmm
loadGraphic(null, true);
antialiasing = false;
animation.add("idle", [0]);
addOffset("idle", 0, 0, 0);
playAnim("idle");
if (curCharacter == "emptyInvisible")
visible = false;
case 'gf':
// GIRLFRIEND CODE
AnimationDebug.imageFile = 'characters/GF_assets';
Expand Down
53 changes: 19 additions & 34 deletions source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ChartingState extends MusicBeatState {

var highlight:FlxSprite;

var GRID_SIZE:Int = 40;
final GRID_SIZE:Int = 40;

var dummyArrow:FlxSprite;

Expand Down Expand Up @@ -917,6 +917,11 @@ class ChartingState extends MusicBeatState {
FlxG.watch.addQuick('daBeat', curBeat);
FlxG.watch.addQuick('daStep', curStep);

var mouseOnGrid = FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * getLengthInSteps(curSection));

if (FlxG.mouse.justPressed) {
if (FlxG.mouse.overlaps(curRenderedNotes)) {
curRenderedNotes.forEach(function(note:ChartingNote) {
Expand All @@ -938,11 +943,7 @@ class ChartingState extends MusicBeatState {
}
});
} else {
if (FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * getLengthInSteps(curSection)))
{
if (mouseOnGrid) {
FlxG.log.add('added note');
var addCount:Int = 0;
if (check_stackActive.checked) {
Expand All @@ -957,11 +958,7 @@ class ChartingState extends MusicBeatState {
}
}

if (FlxG.mouse.x > gridBG.x
&& FlxG.mouse.x < gridBG.x + gridBG.width
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * getLengthInSteps(curSection)))
{
if (mouseOnGrid) {
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
if (FlxG.keys.pressed.SHIFT)
dummyArrow.y = FlxG.mouse.y;
Expand All @@ -971,8 +968,7 @@ class ChartingState extends MusicBeatState {
}
}

if (FlxG.keys.justPressed.ENTER)
{
if (FlxG.keys.justPressed.ENTER) {
lastSection = curSection;

PlayState.SONG = _song;
Expand All @@ -982,13 +978,9 @@ class ChartingState extends MusicBeatState {
}

if (FlxG.keys.justPressed.E)
{
changeNoteSustain(Conductor.stepCrochet);
}
if (FlxG.keys.justPressed.Q)
{
changeNoteSustain(-Conductor.stepCrochet);
}

if (FlxG.keys.justPressed.LBRACKET && curNotesLayer > 0) {
curNotesLayer -= 1;
Expand Down Expand Up @@ -1030,9 +1022,8 @@ class ChartingState extends MusicBeatState {
}
}

if (FlxG.keys.justPressed.R) {
if (FlxG.keys.justPressed.R)
resetSection(FlxG.keys.pressed.SHIFT);
}

if (FlxG.mouse.wheel != 0) {
if (FlxG.keys.pressed.CONTROL) {
Expand Down Expand Up @@ -1103,12 +1094,9 @@ class ChartingState extends MusicBeatState {
super.update(elapsed);
}

function changeNoteSustain(value:Float):Void
{
if (curSelectedNote != null)
{
if (curSelectedNote[2] != null)
{
function changeNoteSustain(value:Float):Void {
if (curSelectedNote != null) {
if (curSelectedNote[2] != null) {
curSelectedNote[2] += value;
curSelectedNote[2] = Math.max(curSelectedNote[2], 0);
}
Expand All @@ -1118,15 +1106,13 @@ class ChartingState extends MusicBeatState {
updateGrid();
}

function recalculateSteps():Int
{
function recalculateSteps():Int {
var lastChange:BPMChangeEvent = {
stepTime: 0,
songTime: 0,
bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{
for (i in 0...Conductor.bpmChangeMap.length) {
if (FlxG.sound.music.time + songAudioOffset > Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}
Expand All @@ -1137,8 +1123,7 @@ class ChartingState extends MusicBeatState {
return curStep;
}

function resetSection(songBeginning:Bool = false):Void
{
function resetSection(songBeginning:Bool = false):Void {
//updateGrid();

FlxG.sound.music.pause();
Expand Down Expand Up @@ -1202,7 +1187,7 @@ class ChartingState extends MusicBeatState {
{
var daSec = FlxMath.maxInt(curSection, sectionNum);

var result = getSectionNotes();
//var result = getSectionNotes();
var addTime:Float = sectionStartTime(daSec) - sectionStartTime(daSec - sectionNum);
for (note in (curNotesLayer == 0 ? _song.notes[daSec - sectionNum].sectionNotes : _song.notes[daSec - sectionNum].notesMoreLayers[curNotesLayer - 1])) {
var strum = note[0] + addTime;
Expand Down Expand Up @@ -1363,6 +1348,7 @@ class ChartingState extends MusicBeatState {
note.setGraphicSize(GRID_SIZE, GRID_SIZE);
note.width = GRID_SIZE;
note.height = GRID_SIZE;
note.offset.set(-0.5 * (GRID_SIZE - note.frameWidth), -0.5 * (GRID_SIZE - note.frameHeight));
note.x = Math.floor(daNoteInfo * GRID_SIZE);
note.y = Math.floor(getYfromStrum((daStrumTime - startThing) % (Conductor.stepCrochet * getLengthInSteps(curSection))));
note.mustPress = daNoteInfo < currentChartMania.keys;
Expand All @@ -1371,8 +1357,7 @@ class ChartingState extends MusicBeatState {

if (daSus > 0) {
var sustainVis:FlxSprite = new FlxSprite(note.x + (GRID_SIZE / 2),
note.y + GRID_SIZE).makeGraphic(8, 4);
sustainVis.scale.y = FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * currentTimeSignature, 0, gridBG.height);
note.y + GRID_SIZE)..makeGraphic(8, Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * 16, 0, gridBG.height)));
curRenderedSustains.add(sustainVis);
}
if ((!hasNormalNote || i[3] != normalNoteNum) && i.length >= 4) {
Expand Down
6 changes: 4 additions & 2 deletions source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MainMenuState extends MusicBeatState {

public var magenta:FlxSprite;
public var camFollow:FlxObject;
public var focusOn:Null<String> = null;

/*#if !html5
var hillarious:MultiWindow;
Expand Down Expand Up @@ -143,7 +144,8 @@ class MainMenuState extends MusicBeatState {
add(vmanEngineThing);

// NG.core.calls.event.logEvent('swag').send();

if (focusOn != null)
curSelected = a.optionShit.indexOf(focusOn);
changeItem(0, false);
FlxG.camera.snapToTarget();

Expand All @@ -155,7 +157,7 @@ class MainMenuState extends MusicBeatState {

public inline static function returnToMenuFocusOn(item:String) {
var a = new MainMenuState();
a.curSelected = a.optionShit.indexOf(item);
a.focusOn = item;
FlxG.switchState(a);
}

Expand Down
2 changes: 1 addition & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2878,7 +2878,7 @@ class PlayState extends MusicBeatState {
setHealth(health + noteTypeData.healthHold, newMax);
} else {
setHealth(health + switch(rating) {
case "sick" | "":
case "sick" | "" | "marvelous":
noteTypeData.healthHitSick;
case "good":
noteTypeData.healthHitGood;
Expand Down
4 changes: 3 additions & 1 deletion source/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef StageElement = {
var alpha:Null<Float>;
var showInFast:Null<Bool>; //todo: i should add this into the options menu!!!!!!!!!!!!!!!
var generateColor:Null<String>;
var angle:Null<Float>;
}

typedef SwagStage = {
Expand Down Expand Up @@ -146,7 +147,7 @@ class Stage {
if (colorGenArgs != null) {
switch(colorGenArgs.length) {
case 1: //solid color
sprite.makeGraphic(8, 8, FreeplayState.parseColor(colorGenArgs[0]));
sprite.makeGraphic(8, 8, CoolUtil.parseColor(colorGenArgs[0]));
sprite.scale.set(element.scaleX / 8, element.scaleY / 8);
case 2: //vertical gradient
case 3: //rotated gradient
Expand Down Expand Up @@ -174,6 +175,7 @@ class Stage {
sprite.scrollFactor.x = element.scrollX == null ? 1 : element.scrollX;
sprite.scrollFactor.y = element.scrollY == null ? 1 : element.scrollY;
sprite.visible = element.startVisible != false;
sprite.angle = element.angle == null ? 0 : element.angle;
if (element.blendMode != null) {
switch(element.blendMode.toLowerCase()) {
case "add" | "alpha" | "darken" | "difference" | "erase" | "hardlight" | "invert" | "layer" | "lighten" | "multiply" | "normal" | "overlay" | "screen" | "shader" | "subtract":
Expand Down
2 changes: 1 addition & 1 deletion source/StrumLine.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class StrumLine extends FlxTypedGroup<FlxSprite> {
public var y:Float;
public var scale:Float;
public var curManiaChangeNum:Int = 0;
public var strumNotes:Array<StrumNote>;
public var strumNotes = new Array<StrumNote>();
public var spanX:Float = 0;
public var spanY:Float = 0;
public var inManiaChange:Bool = false;
Expand Down

0 comments on commit a01e4b8

Please sign in to comment.