diff --git a/assets/preload/data/characters/pico-speaker.json b/assets/preload/data/characters/pico-speaker.json index 5bb1559b..2be449c0 100644 --- a/assets/preload/data/characters/pico-speaker.json +++ b/assets/preload/data/characters/pico-speaker.json @@ -1,8 +1,9 @@ { "name": "Pico (Speaker)", - "asset": ["characters/picoSpeaker"], + "asset": [ + "characters/picoSpeaker" + ], "barColor": "#A5004D", - "charPos":[0, -100], "startingAnim": "shoot1", "animations": [ { @@ -10,55 +11,95 @@ "prefix": "Pico shoot 1", "looped": false, "nextAnim": "shoot1Loop", - "offsets": [0, 0] + "offsets": [ + 0, + 0 + ] }, { "name": "shoot2", "prefix": "Pico shoot 2", "looped": false, "nextAnim": "shoot2Loop", - "offsets": [-1, -128] + "offsets": [ + -1, + -128 + ] }, { "name": "shoot3", "prefix": "Pico shoot 3", "looped": false, "nextAnim": "shoot3Loop", - "offsets": [412, -64] + "offsets": [ + 412, + -64 + ] }, { "name": "shoot4", "prefix": "Pico shoot 4", "looped": false, "nextAnim": "shoot4Loop", - "offsets": [439, -19] + "offsets": [ + 439, + -19 + ] }, { "name": "shoot3Loop", "prefix": "Pico shoot 3", - "offsets": [412, -64], - "frameIndices": [50,51,52], + "offsets": [ + 412, + -64 + ], + "frameIndices": [ + 50, + 51, + 52 + ], "looped": true }, { "name": "shoot1Loop", "prefix": "Pico shoot 1", - "offsets": [0, 0], - "frameIndices": [23,24,25], + "offsets": [ + 0, + 0 + ], + "frameIndices": [ + 23, + 24, + 25 + ], "looped": true }, { "name": "shoot2Loop", "prefix": "Pico shoot 2", - "offsets": [-1, -128], - "frameIndices": [57,58,59], + "offsets": [ + -1, + -128 + ], + "frameIndices": [ + 57, + 58, + 59 + ], "looped": true }, { "name": "shoot4Loop", "prefix": "Pico shoot 4", - "offsets": [439, -19], - "frameIndices": [50,51,52], + "offsets": [ + 439, + -19 + ], + "frameIndices": [ + 50, + 51, + 52 + ], "looped": true } ] diff --git a/assets/preload/data/stages/halloween.json b/assets/preload/data/stages/halloween.json new file mode 100644 index 00000000..bbfaa348 --- /dev/null +++ b/assets/preload/data/stages/halloween.json @@ -0,0 +1,27 @@ +{ + "staticCam": false, + "positions": { + "bf": [ + 770, + 450 + ], + "gf": [ + 400, + 130 + ], + "spooky": [ + 100, + 300 + ], + "monster": [ + 100, + 200 + ] + }, + "camZoom": 1.05, + "hasGF": true, + "camPosition": [ + 751.5, + 454 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/limo.json b/assets/preload/data/stages/limo.json new file mode 100644 index 00000000..b60da5b5 --- /dev/null +++ b/assets/preload/data/stages/limo.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "gf-car": [ + 400, + 130 + ], + "mom-car": [ + 100, + 100 + ], + "bf-car": [ + 1030, + 230 + ] + }, + "camZoom": 0.9, + "hasGF": true, + "camPosition": [ + 787, + 454.5 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/mall.json b/assets/preload/data/stages/mall.json new file mode 100644 index 00000000..c71838f5 --- /dev/null +++ b/assets/preload/data/stages/mall.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "gf-christmas": [ + 400, + 130 + ], + "parents-christmas": [ + -400, + 100 + ], + "bf-christmas": [ + 970, + 450 + ] + }, + "camZoom": 0.8, + "hasGF": true, + "camPosition": [ + 808.5, + 487.5 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/mallEvil.json b/assets/preload/data/stages/mallEvil.json new file mode 100644 index 00000000..abc3568a --- /dev/null +++ b/assets/preload/data/stages/mallEvil.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "gf-christmas": [ + 400, + 130 + ], + "bf-christmas": [ + 1090, + 450 + ], + "monster-christmas": [ + 100, + 150 + ] + }, + "camZoom": 1.05, + "hasGF": true, + "camPosition": [ + 808.5, + 487.5 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/philly.json b/assets/preload/data/stages/philly.json new file mode 100644 index 00000000..f2fd3e13 --- /dev/null +++ b/assets/preload/data/stages/philly.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "bf": [ + 770, + 450 + ], + "gftrain": [ + 400, + 130 + ], + "pico": [ + 100, + 400 + ] + }, + "camZoom": 1.05, + "hasGF": true, + "camPosition": [ + 751.5, + 454 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/school.json b/assets/preload/data/stages/school.json new file mode 100644 index 00000000..c1217405 --- /dev/null +++ b/assets/preload/data/stages/school.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "gf-pixel": [ + 580, + 430 + ], + "senpai": [ + 250, + 460 + ], + "bf-pixel": [ + 970, + 670 + ] + }, + "camZoom": 1.05, + "hasGF": true, + "camPosition": [ + 600, + 500 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/schoolEvil.json b/assets/preload/data/stages/schoolEvil.json new file mode 100644 index 00000000..33ac9867 --- /dev/null +++ b/assets/preload/data/stages/schoolEvil.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "gf-pixel": [ + 580, + 430 + ], + "bf-pixel": [ + 970, + 670 + ], + "spirit": [ + -50, + 200 + ] + }, + "camZoom": 1.05, + "hasGF": true, + "camPosition": [ + 600, + 500 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/stage.json b/assets/preload/data/stages/stage.json new file mode 100644 index 00000000..49005b20 --- /dev/null +++ b/assets/preload/data/stages/stage.json @@ -0,0 +1,23 @@ +{ + "staticCam": false, + "positions": { + "bf": [ + 770, + 450 + ], + "gf": [ + 400, + 130 + ], + "dad": [ + 100, + 100 + ] + }, + "camZoom": 0.9, + "hasGF": true, + "camPosition": [ + 639, + 359 + ] +} \ No newline at end of file diff --git a/assets/preload/data/stages/tank.json b/assets/preload/data/stages/tank.json new file mode 100644 index 00000000..c1f917da --- /dev/null +++ b/assets/preload/data/stages/tank.json @@ -0,0 +1,27 @@ +{ + "staticCam": false, + "positions": { + "bf": [ + 810, + 450 + ], + "tankman": [ + 20, + 340 + ], + "gftank": [ + 200, + 65 + ], + "pico-speaker": [ + 320, + -60 + ], + "camZoom": 0.9, + "hasGF": true, + "camPosition": [ + 666.5, + 472.5 + ] + } +} \ No newline at end of file diff --git a/source/Debug.hx b/source/Debug.hx index 92d6b168..ec68176b 100644 --- a/source/Debug.hx +++ b/source/Debug.hx @@ -21,8 +21,8 @@ using StringTools; class Debug { static final LOG_STYLE_ERROR:LogStyle = new LogStyle('[ERROR] ', 'FF8888', 12, true, false, false, 'flixel/sounds/beep', true); - static final LOG_STYLE_WARN:LogStyle = new LogStyle('[WARN ] ', 'D9F85C', 12, true, false, false, 'flixel/sounds/beep', true); - static final LOG_STYLE_INFO:LogStyle = new LogStyle('[INFO ] ', '5CF878', 12, false); + static final LOG_STYLE_WARN:LogStyle = new LogStyle('[WARN] ', 'D9F85C', 12, true, false, false, 'flixel/sounds/beep', true); + static final LOG_STYLE_INFO:LogStyle = new LogStyle('[INFO] ', '5CF878', 12, false); static final LOG_STYLE_TRACE:LogStyle = new LogStyle('[TRACE] ', '5CF878', 12, false); static var logFileWriter:DebugLogWriter = null; diff --git a/source/PlayState.hx b/source/PlayState.hx index 34b28d89..4f2e7544 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -731,14 +731,17 @@ class PlayState extends MusicBeatState // Load Characters. if (!stageTesting) { - gf = new Character(400, 130, gfCheck); - - if (gf.frames == null) + if (Stage.hasGF) { - #if debug - FlxG.log.warn(["Couldn't load gf: " + gfCheck + ". Loading default gf"]); - #end - gf = new Character(400, 130, 'gf'); + gf = new Character(400, 130, gfCheck); + + if (gf.frames == null) + { + #if debug + FlxG.log.warn(["Couldn't load gf: " + gfCheck + ". Loading default gf"]); + #end + gf = new Character(400, 130, 'gf'); + } } boyfriend = new Boyfriend(770, 450, SONG.player1); @@ -783,20 +786,26 @@ class PlayState extends MusicBeatState { for (char => pos in positions) for (person in [boyfriend, gf, dad]) - if (person.curCharacter == char) - person.setPosition(pos[0], pos[1]); + if (person != null) + if (person.curCharacter == char) + person.setPosition(pos[0], pos[1]); } gfGroup = new FlxSpriteGroup(); boyfriendGroup = new FlxSpriteGroup(); dadGroup = new FlxSpriteGroup(); - gfGroup.add(gf); + if (gf != null) + gfGroup.add(gf); + dadGroup.add(dad); boyfriendGroup.add(boyfriend); - gf.x += gf.charPos[0]; - gf.y += gf.charPos[1]; + if (gf != null) + { + gf.x += gf.charPos[0]; + gf.y += gf.charPos[1]; + } dad.x += dad.charPos[0]; dad.y += dad.charPos[1]; boyfriend.x += boyfriend.charPos[0]; @@ -811,7 +820,7 @@ class PlayState extends MusicBeatState if (FlxG.save.data.distractions) { - if (SONG.songId == 'stress') + if (SONG.songId == 'stress' && gf != null) { switch (gf.curCharacter) { @@ -826,9 +835,12 @@ class PlayState extends MusicBeatState switch (index) { case 0: - if (Stage.hasGF) + if (Stage.hasGF && gf != null) + { add(gfGroup); - gf.scrollFactor.set(0.95, 0.95); + gf.scrollFactor.set(0.95, 0.95); + } + for (bg in array) add(bg); case 1: @@ -844,9 +856,11 @@ class PlayState extends MusicBeatState } else { - if (Stage.hasGF) + if (Stage.hasGF && gf != null) + { add(gfGroup); - gf.scrollFactor.set(0.95, 0.95); + gf.scrollFactor.set(0.95, 0.95); + } add(dadGroup); add(boyfriendGroup); @@ -871,7 +885,7 @@ class PlayState extends MusicBeatState camPos.x = Stage.camPosition[0]; camPos.y = Stage.camPosition[1]; - if (dad.replacesGF) + if (dad.replacesGF && gf != null) { if (!stageTesting) dad.setPosition(gf.x, gf.y); @@ -890,27 +904,7 @@ class PlayState extends MusicBeatState } var doof = null; - - switch (SONG.gfVersion) - { - case 'pico-speaker': - gf.x -= 50; - gf.y -= 200; - } - - switch (Stage.curStage) - { - case "tank": - gf.y += 10; - gf.x -= 30; - dad.x -= 80; - - if (SONG.gfVersion != 'pico-speaker') - { - gf.x -= 170; - gf.y -= 75; - } - } + if (isStoryMode) { @@ -1016,7 +1010,9 @@ class PlayState extends MusicBeatState new LuaCamera(camHUD, "camHUD").Register(ModchartState.lua); new LuaCamera(camStrums, "camStrums").Register(ModchartState.lua); new LuaCharacter(dad, "dad").Register(ModchartState.lua); - new LuaCharacter(gf, "gf").Register(ModchartState.lua); + if (gf != null) + new LuaCharacter(gf, "gf").Register(ModchartState.lua); + new LuaCharacter(boyfriend, "boyfriend").Register(ModchartState.lua); } #end @@ -1169,7 +1165,8 @@ class PlayState extends MusicBeatState startingSong = true; dad.dance(); boyfriend.dance(); - gf.dance(); + if (gf != null) + gf.dance(); cacheCountdown(); @@ -1257,7 +1254,7 @@ class PlayState extends MusicBeatState if (FlxG.save.data.distractions && FlxG.save.data.background) { - if (gfCheck == 'pico-speaker' && Stage.curStage == 'tank') + if (gfCheck == 'pico-speaker' && Stage.curStage == 'tank' && gf != null) { if (FlxG.save.data.distractions) { @@ -1884,7 +1881,7 @@ class PlayState extends MusicBeatState startTimer = createTimer((Conductor.crochet / 1000), function(tmr:FlxTimer) { // this just based on beatHit stuff but compact - if (allowedToHeadbang && swagCounter % gfSpeed == 0) + if (allowedToHeadbang && swagCounter % gfSpeed == 0 && gf != null) gf.dance(); if (swagCounter % Math.floor(idleBeat * songMultiplier) == 0) @@ -2329,7 +2326,7 @@ class PlayState extends MusicBeatState songLength = ((inst.length / songMultiplier) / 1000); if (allowedToHeadbang) - if (gf.curCharacter != 'pico-speaker') + if (gf != null && gf.curCharacter != 'pico-speaker') gf.dance(); if (idleToBeat && !boyfriend.animation.curAnim.name.startsWith("sing")) boyfriend.dance(forcedToIdle); @@ -3143,7 +3140,8 @@ class PlayState extends MusicBeatState case 'bf' | 'boyfriend': char = boyfriend; case 'gf' | 'girlfriend': - char = gf; + if (gf != null) + char = gf; default: char = dad; } @@ -3288,10 +3286,12 @@ class PlayState extends MusicBeatState } remove(boyfriend); remove(dad); - remove(gf); + if (gf != null) + remove(gf); }); StageDebugState.Stage = Stage; - LoadingState.loadAndSwitchState(new StageDebugState(Stage.curStage, gf.curCharacter, boyfriend.curCharacter, dad.curCharacter)); + StageDebugState.fromEditor = false; + LoadingState.loadAndSwitchState(new StageDebugState(Stage.curStage, if (gf != null) gf.curCharacter else "gf", boyfriend.curCharacter, dad.curCharacter)); #if FEATURE_LUAMODCHART if (luaModchart != null) { @@ -3448,7 +3448,7 @@ class PlayState extends MusicBeatState { if (gf.animation.curAnim.name == 'danceLeft' || gf.animation.curAnim.name == 'danceRight' - || gf.animation.curAnim.name == 'idle') + || gf.animation.curAnim.name == 'idle' && gf != null) { switch (curSong) { @@ -4068,9 +4068,11 @@ class PlayState extends MusicBeatState } remove(boyfriend); remove(dad); - remove(gf); + if (gf != null) + remove(gf); }); StageDebugState.Stage = Stage; + StageDebugState.fromEditor = false; LoadingState.loadAndSwitchState(new StageDebugState(Stage.curStage)); } else @@ -4839,7 +4841,7 @@ class PlayState extends MusicBeatState { if (daNote.causesMisses) { - if (combo > 5 && gf.animOffsets.exists('sad') && !PlayStateChangeables.opponentMode) + if (gf != null && combo > 5 && gf.animOffsets.exists('sad') && !PlayStateChangeables.opponentMode) { gf.playAnim('sad'); } @@ -5386,12 +5388,14 @@ class PlayState extends MusicBeatState if (curStep % 32 == 28 #if cpp && curStep != 316 #end && SONG.songId == 'bopeebo') { boyfriend.playAnim('hey', true); - gf.playAnim('cheer', true); + if (gf != null) + gf.playAnim('cheer', true); } if ((curStep == 190 * songMultiplier || curStep == 446 * songMultiplier) && SONG.songId == 'bopeebo') { boyfriend.playAnim('hey', true); - gf.playAnim('cheer', true); + if (gf != null) + gf.playAnim('cheer', true); } } diff --git a/source/debug/StageDebugState.hx b/source/debug/StageDebugState.hx index 5476eb08..546f67cc 100644 --- a/source/debug/StageDebugState.hx +++ b/source/debug/StageDebugState.hx @@ -24,6 +24,7 @@ import flixel.addons.ui.FlxUIInputText; import flixel.addons.ui.FlxUINumericStepper; import flixel.addons.ui.FlxUITabMenu; import flixel.addons.ui.FlxUITooltip.FlxUITooltipStyle; +import flixel.addons.ui.FlxUIButton; using StringTools; @@ -72,6 +73,7 @@ class StageDebugState extends MusicBeatState var gfDrop:FlxUIDropDownMenu; var hasGF:FlxUICheckBox; var staticCam:FlxUICheckBox; + var resetPos:FlxUIButton; var stageList:Array; var charList:Array; @@ -105,7 +107,13 @@ class StageDebugState extends MusicBeatState boyfriend.dance(); gf.dance(); + camFollow = new FlxObject(0, 0, 2, 2); + camFollow.screenCenter(); + add(camFollow); + loadStage(daStage); + + curChar = curChars[curCharIndex]; var positions = Stage.positions[daStage]; if (positions != null) @@ -126,14 +134,6 @@ class StageDebugState extends MusicBeatState */ PlayState.inDaPlay = false; - curChars = [dad, boyfriend, gf]; - if (!gf.visible) // for when gf is an opponent - curChars.pop(); - curChar = curChars[curCharIndex]; - - camFollow = new FlxObject(0, 0, 2, 2); - camFollow.screenCenter(); - add(camFollow); camEditor = new FlxCamera(); camHUD = new FlxCamera(); @@ -213,9 +213,15 @@ class StageDebugState extends MusicBeatState Stage.staticCam = !Stage.staticCam; }; + resetPos = new FlxUIButton(150, 75, "Reset Character Positions", function() + { + resetPositions(); + }); + tab_group.add(stageDropDown); tab_group.add(hasGF); tab_group.add(staticCam); + tab_group.add(resetPos); UI_options.addGroup(tab_group); } @@ -284,11 +290,6 @@ class StageDebugState extends MusicBeatState boyfriend = new Boyfriend(boyfriend.x, boyfriend.y, daBf); gf = new Character(gf.x, gf.y, daGf, false); - curChars = [dad, boyfriend, gf]; - if (!gf.visible || !Stage.hasGF) // for when gf is an opponent - curChars.pop(); - curChar = curChars[curCharIndex]; - Stage = new Stage(leStage); Stage.loadStageData(leStage); @@ -297,6 +298,19 @@ class StageDebugState extends MusicBeatState Stage.initCamPos(); + curChars = [dad, boyfriend, gf]; + if (dad.replacesGF) + { + gf.visible = false; + dad.setPosition(gf.x, gf.y); + } + + if (!gf.visible || !Stage.hasGF) // for when gf is an opponent + curChars.pop(); + curChar = curChars[curCharIndex]; + + camFollow.setPosition(Stage.camPosition[0], Stage.camPosition[1]); + getNextObject(); getNextChar(); @@ -340,6 +354,8 @@ class StageDebugState extends MusicBeatState // Idk why I felt like I had to add traces. Feels more cooler than it should be. } + + function loadStage(leStage:String) { Stage = new Stage(leStage); @@ -348,6 +364,26 @@ class StageDebugState extends MusicBeatState Stage.initStageProperties(); + Stage.initCamPos(); + + newStage = leStage; + + curChars = [dad, boyfriend, gf]; + if (dad.replacesGF) + { + gf.visible = false; + dad.setPosition(gf.x, gf.y); + } + + if (!gf.visible || !Stage.hasGF) // for when gf is an opponent + curChars.pop(); + curChar = curChars[curCharIndex]; + + getNextObject(); + getNextChar(); + + camFollow.setPosition(Stage.camPosition[0], Stage.camPosition[1]); + fakeZoom = Stage.camZoom; for (i in Stage.toAdd) @@ -376,6 +412,21 @@ class StageDebugState extends MusicBeatState } } + function resetPositions() + { + var positions = Stage.positions[newStage]; + if (positions != null) + { + for (char => pos in positions) + for (person in [boyfriend, gf, dad]) + if (person != null) + if (person.curCharacter == char) + person.setPosition(pos[0], pos[1]); + } + + Debug.logTrace("Reset Character Positions."); + } + var helpText:FlxText; function addHelpText():Void diff --git a/source/stages/Stage.hx b/source/stages/Stage.hx index 85a61b44..498977e4 100644 --- a/source/stages/Stage.hx +++ b/source/stages/Stage.hx @@ -61,26 +61,7 @@ class Stage extends MusicBeatState // BGs still must be added by using toAdd Array for them to show in game after slowBacks take effect!! // All of the above must be set or used in your stage case code block!! public var positions:Map>> = [ - // Assign your characters positions on stage here! - 'halloween' => ['spooky' => [100, 300], 'monster' => [100, 200]], - 'philly' => ['pico' => [100, 400]], - 'limo' => ['bf-car' => [1030, 230]], - 'mall' => ['bf-christmas' => [970, 450], 'parents-christmas' => [-400, 100]], - 'mallEvil' => ['bf-christmas' => [1090, 450], 'monster-christmas' => [100, 150]], - 'school' => [ - 'gf-pixel' => [580, 430], - 'bf-pixel' => [970, 670], - 'senpai' => [250, 460], - 'senpai-angry' => [250, 460] - ], - 'schoolEvil' => ['gf-pixel' => [580, 430], 'bf-pixel' => [970, 670], 'spirit' => [-50, 200]], - 'tank' => [ - 'tankman' => [50, 225], - 'bf' => [850, 400], - 'bf-holding-gf' => [850, 370], - 'gftank' => [330, 110], - 'pico-speaker' => [330, 165] - ] + // Assign your characters positions on stage here! Or use the json system. ]; public function new(daStage:String) @@ -658,7 +639,6 @@ class Stage extends MusicBeatState case 'stage': camZoom = 0.9; doesExist = true; - camPosition = [639, 359]; case 'halloween': camZoom = 1.05; doesExist = true; @@ -677,15 +657,12 @@ class Stage extends MusicBeatState case 'school': camZoom = 1.05; doesExist = true; - camPosition = [600, 500]; case 'schoolEvil': camZoom = 1.05; doesExist = true; - camPosition = [600, 500]; case 'tank': camZoom = 0.9; doesExist = true; - camPosition = [500, 400]; case 'void': camZoom = 0.9; doesExist = true; @@ -928,8 +905,11 @@ class Stage extends MusicBeatState { for (ext in extensions) { - files.push(sub); - break; // only one + if (sub.contains(ext)) + { + files.push(sub); + break; // only one + } } } @@ -1052,7 +1032,9 @@ class Stage extends MusicBeatState lightningStrikeBeat = curBeat; lightningOffset = FlxG.random.int(8, 24); - if (PlayState.boyfriend != null && PlayState.gf != null) + if (PlayState.boyfriend != null + && PlayState.gf != null + && PlayState.boyfriend.curCharacter == 'bf' && PlayState.gf.curCharacter == 'gf') { PlayState.boyfriend.playAnim('scared', true); PlayState.gf.playAnim('scared', true);