events progress

This commit is contained in:
Yoshman29
2023-04-20 18:06:53 +02:00
parent 8aeecfb7aa
commit fa3b6d1953
10 changed files with 80 additions and 26 deletions
+9 -9
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="button.png">
<!-- Created without animate lol i wrote this-->
<SubTexture name="topleft" x="0" y="0" width="4" height="4"/>
<SubTexture name="top" x="4" y="0" width="12" height="4"/>
<SubTexture name="topright" x="16" y="0" width="4" height="4"/>
<SubTexture name="middleleft" x="0" y="4" width="4" height="15"/>
<SubTexture name="middle" x="4" y="4" width="12" height="15"/>
<SubTexture name="middleright" x="16" y="4" width="4" height="15"/>
<SubTexture name="bottomleft" x="0" y="19" width="4" height="4"/>
<SubTexture name="bottom" x="4" y="19" width="12" height="4"/>
<SubTexture name="bottomright" x="16" y="19" width="4" height="4"/>
<SubTexture name="topleft" x="0" y="0" width="11" height="4"/>
<SubTexture name="top" x="11" y="0" width="19" height="4"/>
<SubTexture name="topright" x="30" y="0" width="18" height="4"/>
<SubTexture name="middleleft" x="0" y="4" width="11" height="26"/>
<SubTexture name="middle" x="11" y="4" width="19" height="26"/>
<SubTexture name="middleright" x="30" y="4" width="18" height="26"/>
<SubTexture name="bottomleft" x="0" y="30" width="11" height="4"/>
<SubTexture name="bottom" x="11" y="30" width="19" height="4"/>
<SubTexture name="bottomright" x="30" y="30" width="18" height="4"/>
</TextureAtlas>
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
cd export/release/windows/bin/
start cmd /k CodenameEngine.exe -livereload
cd ../../../../
+7 -1
View File
@@ -120,7 +120,13 @@ class Conductor
*/
public static function mapBPMChanges(song:ChartData)
{
bpmChangeMap = [];
bpmChangeMap = [
{
stepTime: 0,
songTime: 0,
bpm: song.meta.bpm
}
];
if (song.events == null) return;
+25
View File
@@ -64,6 +64,7 @@ class Charter extends UIState {
*/
public var strumLines:FlxTypedGroup<CharterStrumline> = new FlxTypedGroup<CharterStrumline>();
public var notesGroup:CharterNoteGroup = new CharterNoteGroup();
public var eventsGroup:CharterEventGroup = new CharterEventGroup();
/**
* CAMERAS
@@ -381,6 +382,7 @@ class Charter extends UIState {
add(gridBackdrop);
add(sectionSeparator);
add(beatSeparator);
add(eventsGroup);
add(notesGroup);
add(topLimit);
add(conductorFollowerSpr);
@@ -424,6 +426,23 @@ class Charter extends UIState {
return FlxSort.byValues(FlxSort.ASCENDING, n1.step, n2.step);
});
trace("generating events...");
var __last:CharterEvent = null;
var __lastTime:Float = Math.NaN;
for(e in PlayState.SONG.events) {
if (e == null) continue;
if (__last != null && __lastTime == e.time) {
__last.events.push(e);
} else {
__last = new CharterEvent(Conductor.getStepForTime(e.time), [e]);
__lastTime = e.time;
eventsGroup.add(__last);
}
}
for(e in eventsGroup.members)
e.refreshEventIcons();
refreshBPMSensitive();
}
@@ -959,10 +978,16 @@ class Charter extends UIState {
public function buildChart() {
PlayState.SONG.strumLines = [];
PlayState.SONG.events = [];
for(s in strumLines) {
s.strumLine.notes = [];
PlayState.SONG.strumLines.push(s.strumLine);
}
for(e in eventsGroup.members) {
for(event in e.events) {
PlayState.SONG.events.push(event);
}
}
for(n in notesGroup.members) {
var strLineID = Std.int(n.id / 4);
if (PlayState.SONG.strumLines[strLineID] != null) {
+11 -6
View File
@@ -26,11 +26,16 @@ class CharterEvent extends UISliceSprite {
public var icons:Array<FlxSprite> = [];
public function new(step:Float, ?events:Array<ChartEvent>) {
super(-100, step * 40, 100, 34, 'editors/charter/event-spr');
super(-100, (step * 40) - 17, 100, 34, 'editors/charter/event-spr');
this.step = step;
this.events = events.getDefault([]);
}
refreshEventIcons();
public override function update(elapsed:Float) {
super.update(elapsed);
for(k=>i in icons) {
i.follow(this, (k * 22) + 23 - (i.width / 2), (bHeight - i.height) / 2);
}
}
public function refreshEventIcons() {
@@ -42,7 +47,7 @@ class CharterEvent extends UISliceSprite {
var f = function(type) {
var spr = new FlxSprite().loadGraphic(Paths.image('editors/charter/event-icons'), true, 16, 16);
spr.frame = spr.frames.frames[type];
spr.frame = spr.frames.frames[type+1];
icons.push(spr);
members.push(spr);
};
@@ -56,15 +61,15 @@ class CharterEvent extends UISliceSprite {
var state = cast(FlxG.state, Charter);
if (event.params[0] != null && event.params[0] >= 0 && event.params[0] < state.strumLines.length) {
// camera movement, use health icon
var healthIcon = new HealthIcon('${event.params[0]}');
healthIcon.setGraphicSize(24, 24);
healthIcon.updateHitbox();
var healthIcon = new HealthIcon('${state.strumLines.members[event.params[0]].strumLine.characters[0]}');
healthIcon.setUnstretchedGraphicSize(32, 32, false);
icons.push(healthIcon);
members.push(healthIcon);
} else
f(event.type);
}
}
x = -(bWidth = 32 + (icons.length * 22));
}
}
@@ -0,0 +1,5 @@
package funkin.editors.charter;
class CharterEventGroup extends FlxTypedGroup<CharterEvent> {
}
+1 -1
View File
@@ -91,7 +91,7 @@ class Note extends FlxSprite
private static var __customNoteTypeExists:Map<String, Bool> = [];
public var animSuffix:String = "";
public var animSuffix:String = null;
private static function customTypePathExists(path:String) {
+14 -8
View File
@@ -1167,14 +1167,20 @@ class PlayState extends MusicBeatState
switch(event.type) {
case CUSTOM:
var d = [for(d in event.params) d];
scripts.call(d.shift(), d);
if (event.params[0] is String && event.params[1] is Array) {
scripts.call(event.params[0], event.params[1]);
}
case CAM_MOVEMENT:
if (event.params.length > 0 && event.params[0] is Int)
if (event.params[0] is Int)
curCameraTarget = event.params[0];
case BPM_CHANGE:
// automatically handled by conductor
case ALT_ANIM_TOGGLE:
if (event.params[0] is Int && event.params[1] is Bool) {
var strLine = strumLines[event.params[0]];
if (strLine != null)
strLine.altAnim = cast event.params[1];
}
// todo!!!
default:
}
@@ -1469,9 +1475,9 @@ class PlayState extends MusicBeatState
var event:NoteHitEvent;
if (strumLine != null && !strumLine.cpu)
event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix, "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, note.noteData > 0 ? 0.023 : 0.004, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"));
event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(strumLine.altAnim ? "-alt" : ""), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, note.noteData > 0 ? 0.023 : 0.004, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"));
else
event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix, "game/score/", "", note.strumID, 0, null, 0, daRating, false));
event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(strumLine.altAnim ? "-alt" : ""), "game/score/", "", note.strumID, 0, null, 0, daRating, false));
strumLine.onHit.dispatch(event);
scripts.event("onNoteHit", event);
@@ -1524,7 +1530,7 @@ class PlayState extends MusicBeatState
FlxTween.tween(numScore, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
numScore.exists = false;
numScore.visible = numScore.active = false;
},
startDelay: Conductor.crochet * 0.002
});
@@ -1548,8 +1554,8 @@ class PlayState extends MusicBeatState
FlxTween.tween(comboSpr, {alpha: 0}, 0.2, {
onComplete: function(tween:FlxTween)
{
rating.exists = false;
comboSpr.exists = false;
rating.visible = rating.active = false;
comboSpr.visible = comboSpr.active = false;
},
startDelay: Conductor.crochet * 0.001
});
+4
View File
@@ -55,6 +55,10 @@ class StrumLine extends FlxTypedGroup<Strum> {
* Group of all of the notes in this strumline. Using `forEach` on this group will only loop through the first notes for performance reasons.
*/
public var notes:NoteGroup;
/**
* Whenever alt animation is enabled on this strumline.
*/
public var altAnim:Bool = false;
private function get_ghostTapping() {
if (this.ghostTapping != null) return this.ghostTapping;