Skip to content

[BUGFIX + ENHANCEMENT] Use SongNoteData for pico-speaker and otis-speaker animations #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/changed-lines-count-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Add 'size: tiny' to any changes of at most 4 lines
'size: tiny':
max: 4

# Add 'size: small' to any changes between 5 and 10 lines
'size: small':
min: 5
max: 10

# Add 'size: medium' to any changes between 11 and 100 lines
'size: medium':
min: 11
max: 100

# Add 'size: large' to any changes between 101 and 500 lines
'size: large':
min: 101
max: 500

# Add 'size: huge' to any changes of more than 500 lines
'size: huge':
min: 501
56 changes: 56 additions & 0 deletions .github/label-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuration for Label Actions - https://github.com/dessant/label-actions

# Automatically close pull requests when the `status: duplicate` label is applied
'status: duplicate':
prs:
# Post a comment
comment: >
This pull request is a duplicate. Please direct all discussion to the original pull request.
# Close the pull request
close: true
# Remove other status labels
unlabel:
- 'status: accepted'
- 'status: needs clarification'
- 'status: needs r&d'
- 'status: needs revision'
- 'status: pending triage'
- 'status: rejected'
- 'status: resolved'
- 'status: resolved internally'
- 'status: reviewing internally'
- 'status: stale'

'status: stale':
prs:
# Close the pull request
close: true
# Remove other status labels
unlabel:
- 'status: accepted'
- 'status: duplicate'
- 'status: needs clarification'
- 'status: needs r&d'
- 'status: needs revision'
- 'status: pending triage'
- 'status: rejected'
- 'status: resolved'
- 'status: resolved internally'
- 'status: reviewing internally'

'status: rejected':
prs:
# Close the pull request
close: true
# Remove other status labels
unlabel:
- 'status: accepted'
- 'status: duplicate'
- 'status: needs clarification'
- 'status: needs r&d'
- 'status: needs revision'
- 'status: pending triage'
- 'status: resolved'
- 'status: resolved internally'
- 'status: reviewing internally'
- 'status: stale'
36 changes: 36 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Add Documentation tag to PR's changing markdown files, or anything in the docs folder
'pr: documentation':
- changed-files:
- any-glob-to-any-file: '**/*.md'

# Add HScript tag to PR's changing hscript files
'pr: hscript':
- changed-files:
- any-glob-to-any-file: '**/*.hxc'

# Add Chart tag to PR's changing chart files
'pr: chart':
- changed-files:
- any-glob-to-any-file: 'preload/data/songs/**'

# Add Audio tag to PR's changing audio files
'pr: audio':
- changed-files:
- any-glob-to-any-file:
- '**/*.mp3'
- '**/*.ogg'

# Add Art tag to PR's changing image or animation files
'pr: art':
- changed-files:
- any-glob-to-any-file:
- 'preload/images/**'
- 'shared/images/**'
- '**/*.png'

# Add GitHub tag to PR's changing yml files, or anything in the .github folder
'pr: github':
- changed-files:
- any-glob-to-any-file:
- '.github/**'
- '**/*.yml'
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Please read the Contributing Guide (https://github.com/FunkinCrew/Funkin/blob/main/docs/CONTRIBUTING.md) before submitting this PR. -->

<!-- Is this PR associated with a PR from the main repo? If so, link it below. -->
## Associated Funkin PR

<!-- Does this PR close any issues? If so, link them below. -->
## Linked Issues

<!-- Briefly describe the issue(s) fixed. -->
## Description

<!-- Include any relevant screenshots or videos. -->
## Screenshots/Videos
38 changes: 38 additions & 0 deletions .github/workflows/cancel-merged-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cancel queued workflows on PR merge

on:
pull_request:
types:
- closed

jobs:

cancel_stuff:
if: github.event.pull_request.merged == true
runs-on: build-set
permissions:
actions: write

steps:
- name: Cancel queued workflows for ${{ github.event.pull_request.head.ref }}
uses: actions/github-script@v7
with:
result-encoding: string
retries: 3
script: |
let branch_workflows = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "build-shit.yml",
status: "queued",
branch: "${{ github.event.pull_request.head.ref }}"
});
let runs = branch_workflows.data.workflow_runs;
runs.forEach((run) => {
github.rest.actions.cancelWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
});
console.log(runs);
29 changes: 29 additions & 0 deletions .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Perform actions when labels are applied to issues, discussions, or pull requests
# See .github/label-actions.yml
name: 'Label Actions'

on:
issues:
types:
- labeled
- unlabeled
pull_request_target:
types:
- labeled
- unlabeled
discussion:
types:
- labeled
- unlabeled

permissions:
contents: read
issues: write
pull-requests: write
discussions: write

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v4
19 changes: 19 additions & 0 deletions .github/workflows/label-pull-request-on-create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Pull Request Labeler 2 (Runs on PR creation)"
on:
pull_request_target:
types:
- opened

jobs:
# Apply `status: pending triage` to newly created pull requests
apply-pending-triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Apply "status pending triage" to new pull requests
uses: actions-ecosystem/action-add-labels@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: "status: pending triage"
29 changes: 29 additions & 0 deletions .github/workflows/label-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
# Apply labels to pull requests based on which files were edited
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Set basic labels
uses: actions/labeler@v5
with:
sync-labels: true
# Apply labels to pull requests based on how many lines were edited
changed-lines-count-labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
name: An action for automatically labelling pull requests based on the changed lines count
steps:
- name: Set change count labels
uses: vkirilichev/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/changed-lines-count-labeler.yml
21 changes: 7 additions & 14 deletions preload/scripts/characters/otis-speaker.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import Lambda;

class OtisSpeakerCharacter extends SparrowCharacter {

var shootTimes:Array<Float> = [];
var shootDirs:Array<Int> = [];
var shootNotes:Array<SongNoteData> = [];

var pupilState:Int = 0;

Expand Down Expand Up @@ -137,7 +136,6 @@ class OtisSpeakerCharacter extends SparrowCharacter {
function initTimemap():Void
{
trace('Initializing Otis timings...');
shootTimes = [];
// The tankmen's timings and directions are determined
// by the chart, specifically the internal "picospeaker" difficulty.
var animChart:SongDifficulty = PlayState.instance.currentSong.getDifficulty('picospeaker', PlayState.instance.currentVariation);
Expand All @@ -148,20 +146,14 @@ class OtisSpeakerCharacter extends SparrowCharacter {
} else {
trace('Initializing Otis (speaker); found `picospeaker` chart, continuing...');
}
var animNotes:Array<SongNoteData> = animChart.notes;
shootNotes = animChart.notes.copy();

// turns out sorting functions are completely useless in polymod right now and do nothing
// i had to sort the whole pico chart by hand im gonna go insane
animNotes.sort(function(a:SongNoteData, b:SongNoteData):Int
shootNotes.sort(function(a:SongNoteData, b:SongNoteData):Int
{
return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time);
});

for (note in animNotes)
{
shootTimes.push(note.time);
shootDirs.push(note.data);
}
}

override function onUpdate(event:UpdateScriptEvent):Void
Expand Down Expand Up @@ -245,9 +237,10 @@ class OtisSpeakerCharacter extends SparrowCharacter {
}

// Each Pico animation is shifted from the array when it's time to play it.
if (shootTimes.length > 0 && shootTimes[0] <= Conductor.instance.songPosition) {
var nextTime:Float = shootTimes.shift();
var nextDir:Int = shootDirs.shift();
if (shootNotes.length > 0 && shootNotes[0].time <= Conductor.instance.songPosition) {
var nextNoteData:SongNoteData = shootNotes.shift();
var nextTime:Float = nextNoteData.time;
var nextDir:Int = nextNoteData.getDirection();

playPicoAnimation(nextDir);
}
Expand Down
21 changes: 7 additions & 14 deletions preload/scripts/characters/pico-speaker.hxc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import funkin.util.SortUtil;
import Lambda;

class PicoSpeakerCharacter extends SparrowCharacter {
var shootTimes:Array<Float> = [];
var shootDirs:Array<Int> = [];
var shootNotes:Array<SongNoteData> = [];

function new() {
super('pico-speaker');
Expand Down Expand Up @@ -45,7 +44,6 @@ class PicoSpeakerCharacter extends SparrowCharacter {
function initTimemap():Void
{
trace('Initializing Pico timings...');
shootTimes = [];
// The tankmen's timings and directions are determined
// by the chart, specifically the internal "picospeaker" difficulty.
var animChart:SongDifficulty = PlayState.instance.currentSong.getDifficulty('picospeaker');
Expand All @@ -56,30 +54,25 @@ class PicoSpeakerCharacter extends SparrowCharacter {
} else {
trace('Initializing Pico (speaker); found `picospeaker` chart, continuing...');
}
var animNotes:Array<SongNoteData> = animChart.notes;
shootNotes = animChart.notes.copy();

// turns out sorting functions are completely useless in polymod right now and do nothing
// i had to sort the whole pico chart by hand im gonna go insane
animNotes.sort(function(a:SongNoteData, b:SongNoteData):Int
shootNotes.sort(function(a:SongNoteData, b:SongNoteData):Int
{
return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time);
});

for (note in animNotes)
{
shootTimes.push(note.time);
shootDirs.push(note.data);
}
}

override function onUpdate(event:UpdateScriptEvent):Void
{
super.onUpdate(event);

// Each Pico animation is shifted from the array when it's time to play it.
if (shootTimes.length > 0 && shootTimes[0] <= Conductor.instance.songPosition) {
var nextTime:Float = shootTimes.shift();
var nextDir:Int = shootDirs.shift();
if (shootNotes.length > 0 && shootNotes[0].time <= Conductor.instance.songPosition) {
var nextNoteData:SongNoteData = shootNotes.shift();
var nextTime:Float = nextNoteData.time;
var nextDir:Int = nextNoteData.getDirection();

if(nextDir == 3){
nextDir -= FlxG.random.int(0, 1);
Expand Down
Loading