diff --git a/BeatzGame.js b/BeatzGame.js index 7e35923..702f7f9 100644 --- a/BeatzGame.js +++ b/BeatzGame.js @@ -2,7 +2,7 @@ * Title: Beatz * Author: Victor//GuayabR * Date: 16/05/2024 - * Version: SONGv 3.7.1.1 test (release.version.subversion.bugfix) + * Version: SONGv 3.7.1.2 test (release.version.subversion.bugfix) * GitHub Repository: https://github.com/GuayabR/Beatz **/ @@ -426,6 +426,7 @@ function preloadSongs() { "Resources/Songs/The Automotivo Infernal 1.0.mp3", "Resources/Songs/WAKE UP!.mp3", "Resources/Songs/Flashing Lights.mp3", + "Resources/Songs/RUN!.mp3", "Resources/Songs/testingsong.mp3", ]; @@ -648,6 +649,7 @@ const songConfigs = { "Resources/Songs/THE SCOTTS.mp3": { BPM: 130, noteSpeed: 0 }, "Resources/Songs/WAKE UP!.mp3": { BPM: 125, noteSpeed: 8 }, "Resources/Songs/Flashing Lights.mp3": { BPM: 90, noteSpeed: 10.5 }, + "Resources/Songs/RUN!.mp3": { BPM: 135, noteSpeed: 10 }, // Song Versions @@ -929,6 +931,10 @@ const songToAlbumMap = { "THE SCOTTS": "THE SCOTTS", "WAKE UP!": "WAKE UP!", "Flashing Lights": "Graduation", + "RUN!": "RUN!", + + // Song Versions + "Finesse (feat. Cardi B)": "24K Magic", "WTF 2 - Slowed": "WTF 2 - Slowed", "WTF 2 - Sped Up": "WTF 2 - Sped Up", @@ -1014,6 +1020,10 @@ function preloadImages() { "Resources/Covers/THE SCOTTS.jpg", "Resources/Covers/ASTRONOMICAL.jpg", "Resources/Covers/WAKE UP!.jpg", + "Resources/Covers/RUN!.jpg", + + // Song Versions + "Resources/Covers/WTF 2 - Slowed.jpg", "Resources/Covers/WTF 2 - Sped Up.jpg", "Resources/Covers/Slide da Treme Melódica v2 - Slowed.jpg", @@ -1238,7 +1248,7 @@ function filterSongs() { let resultsCount = 0; // Find the last song index - const lastSongIndex = songList.length - 1; + const lastSongIndex = songList.length; songButtons.forEach(button => { const songText = button.textContent.toLowerCase(); @@ -1644,6 +1654,10 @@ function getArtist(songSrc) { "THE SCOTTS": "THE SCOTTS, Travis Scott, Kid Cudi", "WAKE UP!": "MoonDeity", "Flashing Lights": "Kanye West, Dwele", + "RUN!": "VALORANT, Odetari, Lay Banks", + + // Song Versions + "Finesse (feat. Cardi B)": "Bruno Mars, Cardi B", "WTF 2 - Slowed": "Ugovhb, EF", "WTF 2 - Sped Up": "Ugovhb, EF", @@ -2491,7 +2505,7 @@ function updateCanvas(timestamp, setIndex) { PERFECT_HIT_RANGE_MAX = 578; HIT_Y_RANGE_MIN = 485; HIT_Y_RANGE_MAX = 615; - MISS_RANGE = 610; + MISS_RANGE = 630; fpsBuffedHitRanges = true; // console.warn(`EXTREMELY Low FPS! Hit ranges have been buffed greatly. FPS: ${FPS}`); } @@ -2501,7 +2515,7 @@ function updateCanvas(timestamp, setIndex) { PERFECT_HIT_RANGE_MAX = 572; HIT_Y_RANGE_MIN = 490; HIT_Y_RANGE_MAX = 610; - MISS_RANGE = 620; + MISS_RANGE = 650; fpsBuffedHitRanges = true; // console.warn(`Low FPS! Hit ranges have been buffed. FPS: ${FPS}`); } @@ -2865,6 +2879,77 @@ function drawAutoHitText() { ctx.fillText("Points are disabled for this playthrough.", 10, HEIGHT - 10); } +// Get the modal and buttons +const customSongModal = document.getElementById("customSongModal"); +const openCustomSongModal = document.getElementById("openCustomSongModal"); +const closeCustomSong = document.getElementById("closeCustomSongModal"); +const createButton = document.getElementById("createCustomSong"); + +// Open the modal +openCustomSongModal.onclick = function () { + customSongModal.style.display = "block"; + deactivateKeybinds(); +}; + +// Close the modal +closeCustomSong.onclick = function () { + customSongModal.style.display = "none"; + activateKeybinds(); +}; + +// Close the modal when clicking outside of it +window.onclick = function (event) { + if (event.target === customSongModal) { + customSongModal.style.display = "none"; + } +}; + +// Handle file input and note generation +createButton.onclick = function () { + const fileInput = document.getElementById("songFile"); + const titleInput = document.getElementById("customSongTitle").value; + const noteSpeed = parseInt(document.getElementById("noteSpeed").value); + const bpm = parseInt(document.getElementById("bpm").value); + + if (fileInput.files.length === 0) { + alert("Please upload an MP3 file."); + return; + } + + const file = fileInput.files[0]; + if (file.type !== "audio/mp3") { + alert("Please upload a valid MP3 file."); + return; + } + + const audio = new Audio(URL.createObjectURL(file)); + audio.onloadedmetadata = function () { + const duration = audio.duration * 1000; // Convert duration to milliseconds + + // Generate notes + const notes = generateRandomNotes(duration); + + // Apply note speed and BPM + applyNoteSpeedAndBPM(noteSpeed, bpm); + + // Start the game with the custom song + startCustomGame(file, titleInput, notes); + }; +}; + +// Function to apply note speed and BPM +function applyNoteSpeedAndBPM(noteSpeed, bpm) { + // Implement your logic to apply note speed and BPM + console.log("Note Speed:", noteSpeed, "BPM:", bpm); +} + +// Function to start the game with the custom song +function startCustomGame(file, title, notes) { + // Implement your logic to start the game with the given song and notes + console.log("Starting custom game with title:", title); + console.log("Notes:", notes); +} + // Global variable to track if notes are generated let notesGenerated = false; diff --git a/BeatzGameTesting.js b/BeatzGameTesting.js index db85ca9..702f7f9 100644 --- a/BeatzGameTesting.js +++ b/BeatzGameTesting.js @@ -2,7 +2,7 @@ * Title: Beatz * Author: Victor//GuayabR * Date: 16/05/2024 - * Version: SONGv 3.7.1.1 test (release.version.subversion.bugfix) + * Version: SONGv 3.7.1.2 test (release.version.subversion.bugfix) * GitHub Repository: https://github.com/GuayabR/Beatz **/ @@ -426,6 +426,7 @@ function preloadSongs() { "Resources/Songs/The Automotivo Infernal 1.0.mp3", "Resources/Songs/WAKE UP!.mp3", "Resources/Songs/Flashing Lights.mp3", + "Resources/Songs/RUN!.mp3", "Resources/Songs/testingsong.mp3", ]; @@ -648,6 +649,7 @@ const songConfigs = { "Resources/Songs/THE SCOTTS.mp3": { BPM: 130, noteSpeed: 0 }, "Resources/Songs/WAKE UP!.mp3": { BPM: 125, noteSpeed: 8 }, "Resources/Songs/Flashing Lights.mp3": { BPM: 90, noteSpeed: 10.5 }, + "Resources/Songs/RUN!.mp3": { BPM: 135, noteSpeed: 10 }, // Song Versions @@ -929,6 +931,10 @@ const songToAlbumMap = { "THE SCOTTS": "THE SCOTTS", "WAKE UP!": "WAKE UP!", "Flashing Lights": "Graduation", + "RUN!": "RUN!", + + // Song Versions + "Finesse (feat. Cardi B)": "24K Magic", "WTF 2 - Slowed": "WTF 2 - Slowed", "WTF 2 - Sped Up": "WTF 2 - Sped Up", @@ -1014,6 +1020,10 @@ function preloadImages() { "Resources/Covers/THE SCOTTS.jpg", "Resources/Covers/ASTRONOMICAL.jpg", "Resources/Covers/WAKE UP!.jpg", + "Resources/Covers/RUN!.jpg", + + // Song Versions + "Resources/Covers/WTF 2 - Slowed.jpg", "Resources/Covers/WTF 2 - Sped Up.jpg", "Resources/Covers/Slide da Treme Melódica v2 - Slowed.jpg", @@ -1238,7 +1248,7 @@ function filterSongs() { let resultsCount = 0; // Find the last song index - const lastSongIndex = songList.length - 1; + const lastSongIndex = songList.length; songButtons.forEach(button => { const songText = button.textContent.toLowerCase(); @@ -1644,6 +1654,10 @@ function getArtist(songSrc) { "THE SCOTTS": "THE SCOTTS, Travis Scott, Kid Cudi", "WAKE UP!": "MoonDeity", "Flashing Lights": "Kanye West, Dwele", + "RUN!": "VALORANT, Odetari, Lay Banks", + + // Song Versions + "Finesse (feat. Cardi B)": "Bruno Mars, Cardi B", "WTF 2 - Slowed": "Ugovhb, EF", "WTF 2 - Sped Up": "Ugovhb, EF", @@ -2491,7 +2505,7 @@ function updateCanvas(timestamp, setIndex) { PERFECT_HIT_RANGE_MAX = 578; HIT_Y_RANGE_MIN = 485; HIT_Y_RANGE_MAX = 615; - MISS_RANGE = 610; + MISS_RANGE = 630; fpsBuffedHitRanges = true; // console.warn(`EXTREMELY Low FPS! Hit ranges have been buffed greatly. FPS: ${FPS}`); } @@ -2501,7 +2515,7 @@ function updateCanvas(timestamp, setIndex) { PERFECT_HIT_RANGE_MAX = 572; HIT_Y_RANGE_MIN = 490; HIT_Y_RANGE_MAX = 610; - MISS_RANGE = 620; + MISS_RANGE = 650; fpsBuffedHitRanges = true; // console.warn(`Low FPS! Hit ranges have been buffed. FPS: ${FPS}`); } diff --git a/BeatzSettings.js b/BeatzSettings.js index 7015fe4..bc5f185 100644 --- a/BeatzSettings.js +++ b/BeatzSettings.js @@ -43,9 +43,8 @@ function detectDeviceType() { function detectAndHandleDevice() { // Function to detect the type of device and handle accordingly - const deviceType = detectDeviceType(); // Detect the type of device - if (deviceType === "Mobile" || deviceType === "iOS" || deviceType === "Android") { + if (userDevice === "Mobile" || userDevice === "iOS" || userDevice === "Android") { // Check if the detected device is Mobile, iOS, or Android document.querySelectorAll("button").forEach(button => (button.disabled = true)); // Disable all buttons on the page @@ -60,7 +59,7 @@ function detectAndHandleDevice() { document.getElementById("unsupportedMessage").style.display = "block"; // Show the unsupported device message console.log("Mobile device detected. Game is not supported."); // Log a message indicating the game is not supported on mobile devices - } else if (deviceType === "Chromebook") { + } else if (userDevice === "Chromebook") { // Check if the detected device is a Chromebook canvas.style.scale = "0.9"; console.warn("Chromebook detected. Game might have reduced framerates."); // Log a warning about potential performance issues on Chromebooks @@ -112,9 +111,15 @@ function toggleFullScreen() { console.log(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`); }); console.log("Entered Fullscreen"); + if (userDevice === "Chromebook") { + canvas.style.scale = "1"; + } } else { document.exitFullscreen(); console.log("Exited Fullscreen"); + if (userDevice === "Chromebook") { + canvas.style.scale = "0.9"; + } } } diff --git a/versions.txt b/versions.txt index 8238e5e..4008a1b 100644 --- a/versions.txt +++ b/versions.txt @@ -455,8 +455,15 @@ Reworked album cover logic! - Added a progress bar with timestamp and duration of the current song playing. Flashes depending on the song's BPM. - Recent songs now saves when pressing next, previous or randomize song. - If user is playing Beatz on a Chromebook device, the scale factor for the canvas is reduced to 0.8 so it fits on the user's screen. +- Users with FPS lower than 60 will have their miss range up to Y = 620, while FPS lower than 30 will have their miss range up to Y = 610. - Added 2 missing songs from older updates: That's What I Like (Bruno Mars), Brand New Dance (Eminem) ## Fixes - Fixed recent song randomizing the index instead of playing your recent song. - Fixed notes being inconsistently checked for misses in lower framerates. -- Fixed setting presets not correctly applying new "Log Keys", "Default Hit Sound", and "Save Recent Songs" settings. \ No newline at end of file +- Fixed setting presets not correctly applying new "Log Keys", "Default Hit Sound", and "Save Recent Songs" settings. +// + +3.7.1.2 (SONGv 3.7! 08/08/2024) +- Added RUN! By VALORANT, Odetari, Lay Banks +- Fixed chromebooks users having black bars around the screen while playing Beatz! on fullscreen. +- Increased low FPS miss ranges. (60 FPS: 620 - 650 // 30 FPS: 610 - 640) \ No newline at end of file