Skip to content

Commit 086b2f9

Browse files
actually revert the softcoded abot for now
1 parent 1e57223 commit 086b2f9

File tree

3 files changed

+56
-103
lines changed

3 files changed

+56
-103
lines changed

assets/preload/scripts/characters/nene.hxc

Lines changed: 30 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,50 @@ import flixel.FlxG;
44
import flixel.FlxSprite;
55
import flixel.group.FlxTypedSpriteGroup;
66
import funkin.graphics.FunkinSprite;
7-
import funkin.Paths;
87
import funkin.modding.base.ScriptedFlxAtlasSprite;
98
import funkin.modding.base.ScriptedFlxSprite;
109
import funkin.modding.base.ScriptedFlxSpriteGroup;
1110
import funkin.graphics.adobeanimate.FlxAtlasSprite;
1211
import funkin.audio.visualize.ABotVis;
13-
import funkin.util.assets.SoundUtil;
14-
import funkin.vis.dsp.SpectralAnalyzer;
15-
import funkin.util.PlatformUtil;
16-
import funkin.util.HostPlatform;
17-
import Lambda;
18-
19-
// using Lambda;
2012

2113
class NeneCharacter extends SparrowCharacter {
2214
function new() {
2315
super('nene');
2416
}
2517

26-
var analyzer:SpectralAnalyzer;
27-
2818
var pupilState:Int = 0;
2919

3020
var PUPIL_STATE_NORMAL = 0;
3121
var PUPIL_STATE_LEFT = 1;
3222

3323
var abot:FlxAtlasSprite;
34-
var abotViz:FlxTypedSpriteGroup;
24+
var abotViz:ABotVis;
3525
var stereoBG:FlxSprite;
3626
var eyeWhites:FlxSprite;
3727
var pupil:FlxAtlasSprite;
3828

3929
function onCreate(event:ScriptEvent) {
4030
super.onCreate(event);
31+
4132
stereoBG = new FlxSprite(0, 0, Paths.image('characters/abot/stereoBG'));
33+
4234
eyeWhites = new FunkinSprite().makeSolidColor(160, 60);
35+
4336
pupil = new FlxAtlasSprite(0, 0, Paths.animateAtlas("characters/abot/systemEyes", "shared"));
4437
pupil.x = this.x;
4538
pupil.y = this.y;
39+
pupil.zIndex = this.zIndex - 5;
4640

4741
abot = ScriptedFlxAtlasSprite.init('ABotAtlasSprite', 0, 0);
4842
abot.x = this.x;
4943
abot.y = this.y;
44+
abot.zIndex = this.zIndex - 1;
5045

51-
abotViz = new FlxTypedSpriteGroup();
46+
abotViz = new ABotVis(FlxG.sound.music);
5247
abotViz.x = this.x;
5348
abotViz.y = this.y;
49+
abotViz.zIndex = abot.zIndex + 1;
5450
FlxG.debugger.track(abotViz);
55-
56-
var visFrms:FlxAtlasFrames = Paths.getSparrowAtlas('aBotViz');
57-
58-
// these are the differences in X position, from left to right
59-
var positionX:Array<Float> = [0, 59, 56, 66, 54, 52, 51];
60-
var positionY:Array<Float> = [0, -8, -3.5, -0.4, 0.5, 4.7, 7];
61-
62-
for (lol in 0...7)
63-
{
64-
// pushes initial value
65-
var posX:Float = 0;
66-
var posY:Float = 0;
67-
68-
for (i in 0...lol+1){
69-
posX += positionX[i];
70-
posY += positionY[i];
71-
}
72-
73-
var viz:FlxSprite = new FlxSprite(posX, posY);
74-
viz.frames = visFrms;
75-
abotViz.add(viz);
76-
77-
var visStr = 'viz';
78-
viz.animation.addByPrefix('VIZ', visStr + Std.string(lol+1), 0);
79-
viz.animation.play('VIZ', false, false, 6);
80-
}
8151
}
8252

8353
/**
@@ -199,6 +169,7 @@ class NeneCharacter extends SparrowCharacter {
199169
default:
200170
}
201171
}
172+
202173
}
203174

204175
function movePupilsLeft():Void {
@@ -249,7 +220,11 @@ class NeneCharacter extends SparrowCharacter {
249220
function onUpdate(event:UpdateScriptEvent) {
250221
super.onUpdate(event);
251222

252-
pupil.update(event.elapsed);
223+
// Set the visibility of ABot to match Nene's.
224+
abot.visible = this.visible;
225+
pupil.visible = this.visible;
226+
eyeWhites.visible = this.visible;
227+
stereoBG.visible = this.visible;
253228

254229
if (pupil?.anim?.isPlaying)
255230
{
@@ -276,21 +251,33 @@ class NeneCharacter extends SparrowCharacter {
276251
// refreshes just for the zIndex shit!
277252
if (!refershedLol)
278253
{
279-
abot.x = this.x - 132;
280-
abot.y = this.y + 310;
254+
abot.x = this.x - 100;
255+
abot.y = this.y + 216; // 764 - 740
256+
abot.zIndex = this.zIndex - 10;
257+
258+
PlayState.instance.currentStage.add(abot);
281259

282260
abotViz.x = abot.x + 200;
283261
abotViz.y = abot.y + 84;
262+
abotViz.zIndex = abot.zIndex - 1;
263+
PlayState.instance.currentStage.add(abotViz);
284264

285265
eyeWhites.x = abot.x + 40;
286266
eyeWhites.y = abot.y + 250;
267+
eyeWhites.zIndex = abot.zIndex - 10;
268+
PlayState.instance.currentStage.add(eyeWhites);
287269

288270
pupil.x = abot.x - 507;
289271
pupil.y = abot.y - 492;
272+
pupil.zIndex = eyeWhites.zIndex + 5;
273+
PlayState.instance.currentStage.add(pupil);
290274

291275
stereoBG.x = abot.x + 150;
292276
stereoBG.y = abot.y + 30;
277+
stereoBG.zIndex = abot.zIndex - 8;
278+
PlayState.instance.currentStage.add(stereoBG);
293279

280+
PlayState.instance.currentStage.refresh();
294281
refershedLol = true;
295282
}
296283

@@ -299,67 +286,14 @@ class NeneCharacter extends SparrowCharacter {
299286
}
300287
}
301288

302-
override function draw() {
303-
if(!this.visible)
304-
return;
305-
eyeWhites.draw();
306-
stereoBG.draw();
307-
pupil.draw();
308-
if (analyzer != null) drawFFT();
309-
abotViz.draw();
310-
if(!(this.animation.curAnim.name == 'lowerKnife' && this.animation.curAnim.curFrame >= 10))
311-
abot.draw();
312-
super.draw();
313-
}
314-
315-
var songStarted:Bool = false;
316-
317289
public function onScriptEvent(event:ScriptEvent):Void {
318290
if (event.type == "SONG_START")
319291
{
320-
initAnalyzer();
321-
songStarted = true;
292+
abotViz.snd = FlxG.sound.music;
293+
abotViz.initAnalyzer();
322294
}
323-
if (event.type == "COUNTDOWN_START")
324-
songStarted = false;
325295
}
326296

327-
function drawFFT():Void
328-
{
329-
var levels = analyzer.getLevels();
330-
331-
for (i in 0...Math.min(abotViz.members.length, levels.length - 1))
332-
{
333-
if (!songStarted)
334-
{
335-
abotViz.members[i].animation.curAnim.curFrame = abotViz.members[i].animation.curAnim.numFrames - 1;
336-
continue;
337-
}
338-
339-
var animFrame:Int = Math.round(levels[i+1].value * 5);
340-
341-
animFrame = Math.floor(Math.min(5, animFrame));
342-
animFrame = Math.floor(Math.max(0, animFrame));
343-
344-
animFrame = Std.int(Math.abs(animFrame - 5)); // shitty dumbass flip, cuz dave got da shit backwards lol!
345-
346-
abotViz.members[i].animation.curAnim.curFrame = animFrame;
347-
}
348-
}
349-
350-
public function initAnalyzer()
351-
{
352-
analyzer = new SpectralAnalyzer(SoundUtil.getSoundChannelSource(FlxG.sound.music), 8, 0.1, 40);
353-
354-
var platform:HostPlatform = PlatformUtil.detectHostPlatform();
355-
356-
if (platform != HostPlatform.HTML5) {
357-
// On desktop it uses FFT stuff that isn't as optimized as the direct browser stuff we use on HTML5
358-
// So we want to manually change it!
359-
analyzer.fftN = 256;
360-
}
361-
}
362-
363297
var animationFinished:Bool = false;
364298

365299
function onAnimationFinished(name:String) {

assets/preload/scripts/stages/phillyStreets.hxc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,7 @@ var rainCanPlay:Bool = true;
431431
}
432432

433433
var screen:FixedBitmapData;
434-
override function draw()
435-
{
436-
super.draw();
437434

438-
//screen = grabScreen(false);
439-
//BitmapDataUtil.applyFilter(screen, blurFilter);
440-
//rainShader.blurredScreen = screen;
441-
}
442435

443436
public override function onPause(event:PauseScriptEvent) {
444437
super.onPause(event);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import flixel.FlxSprite;
2+
import flixel.group.FlxTypedSpriteGroup;
3+
import funkin.Paths;
4+
5+
class ABotVisualizer extends FlxTypedSpriteGroup
6+
{
7+
function new()
8+
{
9+
super(0, 0);
10+
11+
var vizFrames = Paths.getSparrowAtlas('aBotViz');
12+
13+
for (i in 1...8)
14+
{
15+
var viz:FlxSprite = new FlxSprite(50 * i, 0);
16+
viz.frames = vizFrames;
17+
add(viz);
18+
19+
// note: in the a-bot files, dave named the symbols both "VIZ" and "viz"
20+
// I manually changed them in the xml file, but if it ever gets re-exported
21+
// it will need to either be renamed, or accomodated here!
22+
viz.animation.addByPrefix('VIZ', "viz" + i, 0);
23+
viz.animation.play("VIZ", false, false, 3);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)