Skip to content

Commit

Permalink
woo songs can now have custom difficulties
Browse files Browse the repository at this point in the history
  • Loading branch information
GuglioIsStupid committed Sep 1, 2024
1 parent 9d14391 commit 15c265b
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 36 deletions.
3 changes: 2 additions & 1 deletion src/love/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"redundant-parameter",
"missing-parameter",
"lowercase-global",
"assign-type-mismatch"
"assign-type-mismatch",
"redefined-local"
],
"Lua.runtime.version": "LuaJIT",
"Lua.runtime.special": [],
Expand Down
4 changes: 2 additions & 2 deletions src/love/data/weeks/weekData.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
return {
[0] = require "weeks.test",
require "weeks.tutorial",
require "weeks.week1",
require "weeks.week2",
Expand All @@ -8,5 +7,6 @@ return {
require "weeks.week5",
require "weeks.week6",
require "weeks.week7",
require "weeks.weekend1"
require "weeks.weekend1",
require "weeks.test",
}
14 changes: 7 additions & 7 deletions src/love/data/weeks/weekMeta.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
return { -- Add/remove weeks here
[0] = {
"Test",
{
"Test"
}
},
{
"Tutorial",
{
Expand Down Expand Up @@ -76,5 +70,11 @@ return { -- Add/remove weeks here
{"Blazin"},
{"Cutscene", show=false}
}
}
},
{
"Test",
{
{"Test", diffs = {{"normal", ext=""}}}, -- Test only has a "normal" difficulty with no extension.
}
},
}
9 changes: 8 additions & 1 deletion src/love/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,17 @@ function love.load()
if song.show == nil then
song.show = true
end
if song.diffs == nil then
song.diffs = {{"easy", ext=""}, {"normal", ext=""}, {"hard", ext=""}}
else
for _, v in ipairs(song.diffs) do
v.ext = v[2]
end
end
end
end
end
modWeekPlacement = #weekMeta -- everything after the main weeks is a mod folder.
modWeekPlacement = #weekMeta-1 -- everything after the main weeks is a mod folder.

require "modules.extras"

Expand Down
1 change: 1 addition & 0 deletions src/love/modules/Option.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-global
local Option = {}

Option.__index = Option
Expand Down
2 changes: 2 additions & 0 deletions src/love/modules/mp4Handler.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---@diagnostic disable: undefined-global
--https://github.com/semyon422/aqua/blob/27ae6a4ab6ae40c0bd68d94b3f14a88607fe0120/video/video.lua
-- CURRENTLY ONLY SUPPORTS WINDOWS x64. PLEASE USE LOVE2D'S BUILT-IN .ogv SUPPORT FOR NOW.
-- ALSO ITS NOT EVEN ADDED YET LMFAO
if love.system.getOS() == "Windows" then
Try(
function()
Expand Down
8 changes: 8 additions & 0 deletions src/love/modules/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ function util.tryExcept(try, except)
end
end

function util.cloneTable(t)
local newT = {}
for k, v in pairs(t) do
newT[k] = v
end

return newT
end

-- God like coding
--[[
Expand Down
1 change: 1 addition & 0 deletions src/love/sprites/menu/uiStSheet.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return graphics.newSprite(
---@diagnostic disable-next-line: undefined-global
uiStSheetImg, -- Do not add the .png extension
{
{x = 0, y = 0, width = 200, height = 200, offsetX = 0, offsetY = 0, offsetWidth = 200, offsetHeight = 200}, -- 1: uiStSheet boolOff0000
Expand Down
4 changes: 2 additions & 2 deletions src/love/sprites/pixel/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ return graphics.newSprite(
{x = 60, y = 0, width = 30, height = 30, offsetX = 0, offsetY = 0, offsetWidth = 0, offsetHeight = 0} -- 3: Spirit
},
{
[bf] = {start = 1, stop = 1, speed = 0, offsetX = 0, offsetY = 0},
["bf"] = {start = 1, stop = 1, speed = 0, offsetX = 0, offsetY = 0},
["senpai"] = {start = 2, stop = 2, speed = 0, offsetX = 0, offsetY = 0},
["spirit"] = {start = 3, stop = 3, speed = 0, offsetX = 0, offsetY = 0}
},
bf,
"bf",
false,
{
floored = true
Expand Down
2 changes: 1 addition & 1 deletion src/love/stages/city.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ return {

if stageImages["Train"].x < -3000 and stageImages["Train"].finishing then
--trainReset() -- bruh this shit is trying to troll me rn
-- why does it reset the train then still do it 1 more time
-- why does it reset the train then still do it 1 more time
stageImages["Train"].doShit = false
stageImages["Train"].moving = false
stageImages["Train"].startedMoving = false
Expand Down
2 changes: 1 addition & 1 deletion src/love/stages/mall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ return {
if song == 3 then
camera.defaultZoom = 0.9

if scaryIntro then
if __scaryIntro then
camera.x, camera.y = -150, 750
camera.zoom = 2.5

Expand Down
23 changes: 10 additions & 13 deletions src/love/states/menu/menuFreeplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ local function CreateWeek(weekIndex, hasErect)
if not song.show then goto continue end
local song = {
name = song[1],
diffs = {
-- diffname, songExt
{"easy", ext=""},
{"normal", ext=""},
{"hard", ext=""},
(hasErect and {"erect", ext="-erect"} or nil),
(hasErect and {"nightmare", ext="-erect"} or nil),
(hasPico and {"pico", ext="-pico"} or nil)
}
diffs = util.cloneTable(song.diffs)
}

table.insert(song.diffs, (hasErect and {"erect", ext="-erect"} or nil))
table.insert(song.diffs, (hasErect and {"nightmare", ext="-erect"} or nil))
table.insert(song.diffs, (hasPico and {"pico", ext="-pico"} or nil))

table.insert(week.songs, song)
elseif type(song) == "string" then
local song = {
Expand Down Expand Up @@ -107,7 +103,6 @@ return {
curWeekScore = 0
averageAccuracy = 0
ratingText = "???"
songDifficulty = 2

curSongScore = 0
curSongAccuracy = 0
Expand All @@ -116,17 +111,19 @@ return {

averageAccuracy = string.format("%.2f%%", averageAccuracy)

for i = 0, #weekMeta do
for i = 1, #weekMeta do
allWeeks[i] = CreateWeek(i)
end

songDifficulty = util.clamp(2, 1, #allWeeks[weekNum].songs[songNum].diffs)
end,

update = function(self, dt)
if input:pressed("down") then
if menuNum == 1 then
weekNum = weekNum + 1
if weekNum > #weekMeta then
weekNum = 0
weekNum = 1
end
if songDifficulty > #allWeeks[weekNum].songs[songNum].diffs then
songDifficulty = #allWeeks[weekNum].songs[songNum].diffs
Expand All @@ -148,7 +145,7 @@ return {
elseif input:pressed("up") then
if menuNum == 1 then
weekNum = weekNum - 1
if weekNum < 0 then
if weekNum < 1 then
weekNum = #weekMeta
end

Expand Down
16 changes: 8 additions & 8 deletions src/love/weeks/week5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local walls, escalator, christmasTree, snow

local topBop, bottomBop, santa

local scaryIntro = false
__scaryIntro = false

return {
enter = function(self, from, songNum, songAppend, _songExt)
Expand All @@ -46,7 +46,7 @@ return {
if song == 3 then
camera.defaultZoom = 0.9

if scaryIntro then
if __scaryIntro then
camera.x, camera.y = -150, 750
camera.zoom = 2.5

Expand Down Expand Up @@ -80,11 +80,11 @@ return {

self:initUI()

if scaryIntro then
if __scaryIntro then
Timer.after(
5,
function()
scaryIntro = false
__scaryIntro = false

camTimer = Timer.tween(2, camera, {x = -boyfriend.x + 100, y = -boyfriend.y + 75, sizeX = 0.9, sizeY = 0.9}, "out-quad")

Expand Down Expand Up @@ -121,18 +121,18 @@ return {
end,

update = function(self, dt)
if not scaryIntro then
if not __scaryIntro then
weeks:update(dt)
stages["mall"]:update(dt)

if not (scaryIntro or countingDown or graphics.isFading()) and not (inst:isPlaying() and voicesBF:isPlaying()) and not paused then
if not (__scaryIntro or countingDown or graphics.isFading()) and not (inst:isPlaying() and voicesBF:isPlaying()) and not paused then
if storyMode and song < 3 then
weeks:saveData()
song = song + 1

-- Winter Horrorland setup
if song == 3 then
scaryIntro = true
__scaryIntro = true

audio.playSound(sounds.lightsOff)

Expand Down Expand Up @@ -169,7 +169,7 @@ return {
stages["mall"]:draw()
love.graphics.pop()

if not scaryIntro then
if not __scaryIntro then
weeks:drawUI()
end
end,
Expand Down

0 comments on commit 15c265b

Please sign in to comment.