Skip to content

Commit

Permalink
Fixed beatmaps using AudioLeadIn not starting at the correct time
Browse files Browse the repository at this point in the history
  • Loading branch information
sticks-stuff committed Nov 18, 2020
1 parent d0c757f commit 1c0e14e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion com/clubpenguin/games/dancing/GameEngine.as
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@
SHELL = _global.getCurrentShell();
} // end if
com.clubpenguin.games.dancing.GameEngine.SHELL.stopMusic();
_global.AudioFilename.start();
//_global.AudioFilename.start();
var timer = setInterval(function () {_global.AudioFilename.start(); clearInterval(timer)}, _global.AudioLeadIn);
this.handleScoreUpdate(Number.MAX_VALUE);
isPlayingGame = true;
isDancing = true;
Expand Down
6 changes: 6 additions & 0 deletions com/clubpenguin/games/dancing/MenuSystem.as
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,13 @@ class com.clubpenguin.games.dancing.MenuSystem
_global.noteLengths = result_lv.noteLengths.split(',');
var AudioFilename2 = result_lv.AudioFilename;
_global.playtime_seconds = result_lv.playtime_seconds;
_global.AudioLeadIn = 0;
if (result_lv.AudioLeadIn != null)
{
_global.AudioLeadIn = result_lv.AudioLeadIn;
}
trace(_global.AudioFilename);
trace(_global.AudioLeadIn);
trace("playtime_seconds " + _global.playtime_seconds);
_global.AudioFilename = new Sound();
_global.AudioFilename.onLoad = function () {
Expand Down
18 changes: 9 additions & 9 deletions convert_osu!_to_DC.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
include("getid3/getid3.php");
// $fileName = '1196084 Usada Pekora - Discommunication Alien.osz';
// $fileName = '404318 Waterflame - Electroman Adventures.osz';
$fileName = $_GET["fileName"];
// $chart = 'Usada Pekora - Discommunication Alien (LLENN-) [Easy]';
// $chart = 'Waterflame - Electroman Adventures (rinaldi28) [EZ]';
$chart = $_GET["chart"];
echo $fileName;
echo $chart;
$file = "./tmp/" . $fileName;
$zip = new ZipArchive;
$res = $zip->open($file);
$AudioLeadIn = 0;
$audioLeadIn = 0;
if ($res === TRUE) {
$result = file('zip://' . realpath($file) . '#' . $chart . '.osu');
$result_GC = file_get_contents('zip://' . realpath($file) . '#' . $chart . '.osu');
Expand All @@ -34,7 +34,7 @@
}
if(trim($tempExplodeVar[0]) == 'AudioLeadIn')
{
$AudioLeadIn = trim(end($tempExplodeVar));
$audioLeadIn = trim(end($tempExplodeVar));
}
}
}
Expand All @@ -48,7 +48,7 @@

$numLists = interpret_numbers_list($noteData);
// print_r($numLists[0][0]);
handle_number_lists($numLists);
handle_number_lists($numLists, $audioLeadIn);
// print_r($GLOBALS[0]);
$outputdata = format_output_lines();
// file_put_contents('output.txt', print_r($outputdata, true));
Expand Down Expand Up @@ -92,8 +92,8 @@ function handle_first_number($num) {
break;
}
}
function handle_third_number($num) {
write_to_line(1, strval($num + intval($AudioLeadIn)));
function handle_third_number($num, $audioLeadIn) {
write_to_line(1, strval($num + intval($audioLeadIn)));
}
function handle_fourth_and_fifth_number($third_num,$fourth_num,$sixth_num) {
if (($fourth_num == 128)) {
Expand All @@ -104,10 +104,10 @@ function handle_fourth_and_fifth_number($third_num,$fourth_num,$sixth_num) {
}
}

function handle_number_lists($numLists) {
function handle_number_lists($numLists, $audioLeadIn) {
foreach($numLists as $numList) {
handle_first_number($numList[0]);
handle_third_number($numList[2]);
handle_third_number($numList[2], $audioLeadIn);
handle_fourth_and_fifth_number($numList[2], $numList[3], $numList[5]);
}
}
Expand Down
Binary file modified ~dance.swf
Binary file not shown.

0 comments on commit 1c0e14e

Please sign in to comment.