From 0f29ed0ce4af0a007b2138d2f4d85dfe19653bce Mon Sep 17 00:00:00 2001 From: WillWare Date: Thu, 16 Aug 2018 22:18:15 -0500 Subject: [PATCH 01/32] Inital 11.1 support --- andgate.lua | 2 +- animation.lua | 2 +- animationguiline.lua | 10 +- characterloader.lua | 24 ++- conf.lua | 2 +- customhats.lua | 2 +- delayer.lua | 2 +- dialogbox.lua | 12 +- editor.lua | 390 +++++++++++++++++++++------------------- emancipateanimation.lua | 2 +- emancipationfizzle.lua | 2 +- emancipationgrill.lua | 4 +- enemies.lua | 2 +- entity.lua | 2 +- entitytooltip.lua | 6 +- faithplate.lua | 2 +- funnel.lua | 4 +- game.lua | 305 +++++++++++++++++-------------- groundlight.lua | 4 +- gui.lua | 60 +++---- intro.lua | 16 +- levelscreen.lua | 8 +- lightbridge.lua | 8 +- lobby.lua | 14 +- magic.lua | 2 +- main.lua | 172 ++++++++++-------- mario.lua | 8 +- menu.lua | 322 ++++++++++++++++----------------- musicentity.lua | 2 +- musicloader.lua | 2 +- netplayinc/LUBE.lua | 4 +- notgate.lua | 2 +- notice.lua | 10 +- onlinemenu.lua | 30 ++-- orgate.lua | 2 +- pedestal.lua | 2 +- portal.lua | 8 +- portalparticle.lua | 4 +- portalprojectile.lua | 2 +- portalwall.lua | 2 +- quad.lua | 30 ++-- regiondrag.lua | 8 +- rightclickmenu.lua | 22 +-- rsflipflop.lua | 2 +- shaders/init.lua | 4 +- squarewave.lua | 2 +- variables.lua | 2 +- wallindicator.lua | 2 +- walltimer.lua | 2 +- 49 files changed, 806 insertions(+), 727 deletions(-) diff --git a/andgate.lua b/andgate.lua index 8456383..70080ac 100644 --- a/andgate.lua +++ b/andgate.lua @@ -50,7 +50,7 @@ end function andgate:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(andgateimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/animation.lua b/animation.lua index adc0ec5..6c9c988 100644 --- a/animation.lua +++ b/animation.lua @@ -316,7 +316,7 @@ function animation:update(dt) elseif v[1] == "addpoints" then addpoints(tonumber(v[2]) or 1) elseif v[1] == "changebackgroundcolor" then - love.graphics.setBackgroundColor(tonumber(v[2]) or 255, tonumber(v[3]) or 255, tonumber(v[4]) or 255) + love.graphics.setBackgroundColor(tonumber(v[2]) / 255 or 1, tonumber(v[3]) / 255 or 1, tonumber(v[4]) / 255 or 1) elseif v[1] == "killplayer" then if v[2] == "everyone" then for i = 1, players do diff --git a/animationguiline.lua b/animationguiline.lua index 14ffd18..5cf1ac9 100644 --- a/animationguiline.lua +++ b/animationguiline.lua @@ -838,13 +838,13 @@ function animationguiline:init(tabl, t2) local firstwidth = 22--#animationstrings[self.type][start] self.deletebutton = guielement:new("button", 0, 0, "x", function() self:delete() end, nil, nil, nil, 8, 0.1) - self.deletebutton.textcolor = {200, 0, 0} + self.deletebutton.textcolor = {0.6, 0, 0} self.downbutton = guielement:new("button", 0, 0, "_dir6", function() self:movedown() end, nil, nil, nil, 8, 0.1) - self.downbutton.textcolor = {255, 255, 255} + self.downbutton.textcolor = {1, 1, 1} self.upbutton = guielement:new("button", 0, 0, "_dir4", function() self:moveup() end, nil, nil, nil, 8, 0.1) - self.upbutton.textcolor = {255, 255, 255} + self.upbutton.textcolor = {1, 1, 1} self.elements[1].gui = guielement:new("dropdown", 0, 0, firstwidth, function(val) self:changemainthing(val) end, start, unpack(animationstrings[self.type])) self.elements[1].width = 14+firstwidth*8 @@ -950,7 +950,7 @@ end function animationguiline:draw(x, y) love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", x*scale, y*scale, (width*16-x)*scale, 11*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local xadd = 0 self.deletebutton.x = x+xadd @@ -970,7 +970,7 @@ function animationguiline:draw(x, y) for i = 1, #self.elements do if self.elements[i].t == "text" then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint(self.elements[i].value, (x+xadd-1)*scale, (y+2)*scale) xadd = xadd + self.elements[i].width else diff --git a/characterloader.lua b/characterloader.lua index fbbcc75..21aad1a 100644 --- a/characterloader.lua +++ b/characterloader.lua @@ -1,6 +1,6 @@ function loadcharacter(charname) local folder = "characters/" .. charname .. "/" - if not love.filesystem.exists(folder .. "config.txt") then + if not love.filesystem.getInfo(folder .. "config.txt") then return false end @@ -12,6 +12,16 @@ function loadcharacter(charname) local char = JSON:decode(s) char.name = (char.name and string.lower(char.name)) or string.lower(charname) + + if char.defaultcolors then + for i, colors in ipairs(char.defaultcolors) do + for j, color in ipairs (colors) do + for k = 1, 3 do + char.defaultcolors[i][j][k] = char.defaultcolors[i][j][k] / 255 + end + end + end + end ----------------- --IMAGE LOADING-- @@ -28,10 +38,10 @@ function loadcharacter(charname) curtype = "nogunbiganimations" end - if char.defaultcolors and love.filesystem.exists(folder .. curtype .. "1.png") then --MULTIPLE IMAGES + if char.defaultcolors and love.filesystem.getInfo(folder .. curtype .. "1.png") then --MULTIPLE IMAGES local imagecount = #char.defaultcolors[1] for i = 1, imagecount do - if not love.filesystem.exists(folder .. curtype .. i .. ".png") then + if not love.filesystem.getInfo(folder .. curtype .. i .. ".png") then if t <= 2 then return false else @@ -45,16 +55,16 @@ function loadcharacter(charname) end --0 Image - if love.filesystem.exists(folder .. curtype .. "0.png") then + if love.filesystem.getInfo(folder .. curtype .. "0.png") then char[curtype][0] = love.graphics.newImage(folder .. curtype .. "0.png") end --Dot Image - if love.filesystem.exists(folder .. curtype .. "dot.png") then + if love.filesystem.getInfo(folder .. curtype .. "dot.png") then char[curtype]["dot"] = love.graphics.newImage(folder .. curtype .. "dot.png") end else - if love.filesystem.exists(folder .. curtype .. ".png") then + if love.filesystem.getInfo(folder .. curtype .. ".png") then char[curtype] = love.graphics.newImage(folder .. curtype .. ".png") end end @@ -165,7 +175,7 @@ end characterlist = {} characters = {} for i, v in pairs(love.filesystem.getDirectoryItems("characters/")) do - if (love.filesystem.isDirectory("characters/" .. v)) then + if love.filesystem.getInfo("characters/" .. v).type == "directory" then local temp = loadcharacter(v) if temp then characters[v] = temp diff --git a/conf.lua b/conf.lua index bddd9f2..f9737f2 100644 --- a/conf.lua +++ b/conf.lua @@ -5,5 +5,5 @@ function love.conf(t) t.modules.physics = false t.release = false t.window = false - t.console = true + t.console = false end \ No newline at end of file diff --git a/customhats.lua b/customhats.lua index 40346f6..18e78df 100644 --- a/customhats.lua +++ b/customhats.lua @@ -12,7 +12,7 @@ function loadhat(path) return end - if not love.filesystem.exists("hats/" .. s1[7] .. ".png") or not love.filesystem.exists("hats/" .. s1[8] .. ".png") then + if not love.filesystem.getInfo("hats/" .. s1[7] .. ".png") or not love.filesystem.getInfo("hats/" .. s1[8] .. ".png") then return end diff --git a/delayer.lua b/delayer.lua index d590d51..a425223 100644 --- a/delayer.lua +++ b/delayer.lua @@ -70,7 +70,7 @@ end function delayer:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(delayerimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/dialogbox.lua b/dialogbox.lua index 05bae51..4c4ee61 100644 --- a/dialogbox.lua +++ b/dialogbox.lua @@ -26,7 +26,7 @@ function dialogbox:init(text, speaker) --take out that string self.text = string.sub(self.text, 1, i-1) .. string.sub(self.text, j+1) else - self.textcolors[i] = {tonumber(curcolor[1]), tonumber(curcolor[2]), tonumber(curcolor[3])} + self.textcolors[i] = {tonumber(curcolor[1]) / 255, tonumber(curcolor[2]) / 255, tonumber(curcolor[3]) / 255} i = i + 1 end end @@ -51,9 +51,9 @@ function dialogbox:draw() local boxheight = 45 local margin = 4 local lineheight = 10 - love.graphics.setColor(0, 0, 0, 127) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.rectangle("fill", scale*margin, (height*16-boxheight-margin)*scale, (width*16-margin*2)*scale, boxheight*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) drawrectangle(5, (height*16-margin-boxheight+1), (width*16-margin*2-2), boxheight-2) local availablepixelsx = width*16-margin*2-6 @@ -76,13 +76,13 @@ function dialogbox:draw() end if self.speaker then - love.graphics.setColor(0, 0, 0, 127) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.rectangle("fill", scale*margin, (height*16-boxheight-margin-10)*scale, (5+#self.speaker*8)*scale, 10*scale) - --love.graphics.setColor(255, 255, 255) + --love.graphics.setColor(1, 1, 1) --drawrectangle(5, (height*16-margin-boxheight+1-10), (3+#self.speaker*8), 11) - love.graphics.setColor(self.color or {232, 130, 30}) + love.graphics.setColor(self.color or {232/255, 130/255, 30/255}) properprint(self.speaker, (margin+2)*scale, (height*16-margin-boxheight+1-9)*scale) end end \ No newline at end of file diff --git a/editor.lua b/editor.lua index 76cfd16..7b66605 100644 --- a/editor.lua +++ b/editor.lua @@ -90,7 +90,7 @@ function editor_load() mtsavehighlighttime = 5 mtsavetimer = 0 mtjustsaved = false - mtsavecolors = {255, 112, 112, 128} + mtsavecolors = {1, 0.44, 0.44, 0.7} pastingtiles = false pastemode = false -- 1 transparent, 2 opaque @@ -106,26 +106,26 @@ function editor_load() secretcheckboxtext = {"secret feature", "really secret feature", "super secret feature", "very secret feature", "don't enable this", "exit editor", "copy enemies", "copy entities", "all of the above", "play music in editor", "shmuck bait", "disable tiles", "enable tiles", "goombas are cats", "hat stacking", "auto-update", "horizontal tileset scrollbar", "show mazes", "play space jam while editing", "get rid of this checkbox", "old editor", "disable better editor", "1.6 editor", "enable autocorrect", "make cool maps like willware", "snes mode", "disable crashing", "enable this checkbox", "enable the super secret checkbox", ""} guielements["tabmain"] = guielement:new("button", 1, 1, "main", maintab, 3) - guielements["tabmain"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} guielements["tabtiles"] = guielement:new("button", 43, 1, "tiles", tilestab, 3) - guielements["tabtiles"].fillcolor = {63, 63, 63} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} guielements["tabtools"] = guielement:new("button", 93, 1, "tools", toolstab, 3) - guielements["tabtools"].fillcolor = {63, 63, 63} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmaps"] = guielement:new("button", 143, 1, "maps", mapstab, 3) - guielements["tabmaps"].fillcolor = {63, 63, 63} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} guielements["tabanimations"] = guielement:new("button", 185, 1, "animations", animationstab, 3) - guielements["tabanimations"].fillcolor = {63, 63, 63} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} guielements["tabobjects"] = guielement:new("button", 275, 1, "objects", objectstab, 3) - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} --MAIN --left side - guielements["colorsliderr"] = guielement:new("scrollbar", 17, 75, 101, 11, 11, background[1]/255, "hor") - guielements["colorsliderr"].backgroundcolor = {255, 0, 0} - guielements["colorsliderg"] = guielement:new("scrollbar", 17, 87, 101, 11, 11, background[2]/255, "hor") - guielements["colorsliderg"].backgroundcolor = {0, 255, 0} - guielements["colorsliderb"] = guielement:new("scrollbar", 17, 99, 101, 11, 11, background[3]/255, "hor") - guielements["colorsliderb"].backgroundcolor = {0, 0, 255} + guielements["colorsliderr"] = guielement:new("scrollbar", 17, 75, 101, 11, 11, background[1], "hor") + guielements["colorsliderr"].backgroundcolor = {1, 0, 0} + guielements["colorsliderg"] = guielement:new("scrollbar", 17, 87, 101, 11, 11, background[2], "hor") + guielements["colorsliderg"].backgroundcolor = {0, 1, 0} + guielements["colorsliderb"] = guielement:new("scrollbar", 17, 99, 101, 11, 11, background[3], "hor") + guielements["colorsliderb"].backgroundcolor = {0, 0, 1} for i = 1, #backgroundcolor do guielements["defaultcolor" .. i] = guielement:new("button", 125+(math.mod(i-1, 3))*12, 63+(math.ceil(i/3))*12, "", defaultbackground, 0, {i}, 1, 8) @@ -172,8 +172,8 @@ function editor_load() guielements["testbutton"] = guielement:new("button", 204, 200, "test level", test_level, 2) guielements["widthbutton"] = guielement:new("button", 296, 200, "change size", openchangewidth, 2) - guielements["savebutton"].bordercolor = {255, 0, 0} - guielements["savebutton"].bordercolorhigh = {255, 127, 127} + guielements["savebutton"].bordercolor = {1, 0, 0} + guielements["savebutton"].bordercolorhigh = {1, 0.5, 0.5} --maybe I should use webkit next time --hahahahhahahaha no @@ -232,7 +232,7 @@ function editor_load() local mappackname = "" local mappackauthor = "" local mappackdescription = "" - if love.filesystem.exists("mappacks/" .. mappack .. "/settings.txt") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/settings.txt") then local data = love.filesystem.read("mappacks/" .. mappack .. "/settings.txt") local split1 = data:split("\n") for i = 1, #split1 do @@ -262,11 +262,11 @@ function editor_load() --TOOLS guielements["selectionbutton"] = guielement:new("button", 5, 22, "selection tool|click and drag to select entities|rightclick to configure all at once|hit del to delete.", selectionbutton, 2, false, 4, 383) - guielements["selectionbutton"].bordercolor = {0, 255, 0} - guielements["selectionbutton"].bordercolorhigh = {220, 255, 220} + guielements["selectionbutton"].bordercolor = {0, 1, 0} + guielements["selectionbutton"].bordercolorhigh = {0.86, 1, 0.86} guielements["lightdrawbutton"] = guielement:new("button", 5, 71, "advanced draw tool|place tiles seamlessly using premade tools", powerlinestab, 2, false, 2, 383) - guielements["lightdrawbutton"].bordercolor = {0, 0, 255} - guielements["lightdrawbutton"].bordercolorhigh = {127, 127, 255} + guielements["lightdrawbutton"].bordercolor = {0, 0, 1} + guielements["lightdrawbutton"].bordercolorhigh = {0.5, 0.5, 1} guielements["livesdecrease"] = guielement:new("button", 198, 104, "{", livesdecrease, 0) guielements["livesincrease"] = guielement:new("button", 194, 104, "}", livesincrease, 0) @@ -282,13 +282,13 @@ function editor_load() guielements["editauthor"] = guielement:new("input", 5, 140, 13, nil, mappackauthor, 13) guielements["editdescription"] = guielement:new("input", 5, 165, 17, nil, mappackdescription, 51, 3) guielements["savesettings"] = guielement:new("button", 5, 203, "save settings", savesettings, 2) - guielements["savesettings"].bordercolor = {255, 0, 0} - guielements["savesettings"].bordercolorhigh = {255, 127, 127} + guielements["savesettings"].bordercolor = {1, 0, 0} + guielements["savesettings"].bordercolorhigh = {1, 0.5, 0.5} --[[MAPS guielements["savebutton2"] = guielement:new("button", 10, 140, "save", savelevel, 2) - guielements["savebutton2"].bordercolor = {255, 0, 0} - guielements["savebutton2"].bordercolorhigh = {255, 127, 127}]] + guielements["savebutton2"].bordercolor = {1, 0, 0} + guielements["savebutton2"].bordercolorhigh = {1, 0.5, 0.5}]] guielements["mapscrollbar"] = guielement:new("scrollbar", 381, 21, 199, 15, 40, 0, "ver", nil, nil, nil, nil, true) guielements["mapsworldbox"] = guielement:new("input", 332, 21, 2, nil, nil, 2, 1, true, 0) guielements["mapslevelbox"] = guielement:new("input", 361, 21, 2, nil, nil, 2, 1, true, 0) @@ -299,13 +299,13 @@ function editor_load() guielements["animationsscrollbarhor"] = guielement:new("scrollbar", animationguiarea[1], animationguiarea[4], animationguiarea[3]-animationguiarea[1], 40, 10, 0, "hor", nil, nil, nil, nil, false) addanimationtriggerbutton = guielement:new("button", 0, 0, "+", addanimationtrigger, nil, nil, nil, 8) - addanimationtriggerbutton.textcolor = {0, 200, 0} + addanimationtriggerbutton.textcolor = {0, 0.8, 0} addanimationconditionbutton = guielement:new("button", 0, 0, "+", addanimationcondition, nil, nil, nil, 8) - addanimationconditionbutton.textcolor = {0, 200, 0} + addanimationconditionbutton.textcolor = {0, 0.8, 0} addanimationactionbutton = guielement:new("button", 0, 0, "+", addanimationaction, nil, nil, nil, 8) - addanimationactionbutton.textcolor = {0, 200, 0} + addanimationactionbutton.textcolor = {0, 0.8, 0} local args = {} for i, v in ipairs(animations) do @@ -321,11 +321,11 @@ function editor_load() --POWERLINE "SUBTAB" drawtools = 2 guielements["drawtool1"] = guielement:new("button", 5, 21, "power line draw", drawpowerlines, 2) - guielements["drawtool1"].bordercolor = {0, 0, 255} - guielements["drawtool1"].bordercolorhigh = {127, 127, 255} + guielements["drawtool1"].bordercolor = {0, 0, 1} + guielements["drawtool1"].bordercolorhigh = {0.5, 0.5, 1} guielements["drawtool2"] = guielement:new("button", 5, 38, "mushroom platforms", drawmushrooms, 2) - guielements["drawtool2"].bordercolor = {255, 0, 0} - guielements["drawtool2"].bordercolorhigh = {255, 127, 127} + guielements["drawtool2"].bordercolor = {1, 0, 0} + guielements["drawtool2"].bordercolorhigh = {1, 0.5, 0.5} multitileobjects = {} multitileobjectnames = {} @@ -790,7 +790,7 @@ function editor_update(dt) end function editor_draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local mousex, mousey = mouse.getPosition() @@ -822,7 +822,7 @@ function editor_draw() local selectionlist = selectiongettiles(x, y, width, height) - love.graphics.setColor(255, 255, 255, 100) + love.graphics.setColor(1, 1, 1, 0.4) for i = 1, #selectionlist do local v = selectionlist[i] if map[v.x][v.y][2] and entitylist[map[v.x][v.y][2]] and rightclickmenues[entitylist[map[v.x][v.y][2]].t] then @@ -845,10 +845,10 @@ function editor_draw() if w == 1 and pastemode == false then -- well, do nothing -- or better: draw empty tiles almost transparent - love.graphics.setColor(255, 255, 255, 8) + love.graphics.setColor(1, 1, 1, 0.03) love.graphics.drawq(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) else - love.graphics.setColor(255, 255, 255, 72) + love.graphics.setColor(1, 1, 1, 0.3) love.graphics.drawq(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) end end @@ -856,7 +856,7 @@ function editor_draw() --end end - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) if tileswitcherpressed then -- draw temporal overlay for all the tiles that will be switched @@ -880,7 +880,7 @@ function editor_draw() if tileselectionclick1 == false then if pastingtiles == false then -- no clicks yet - draw layer on single block - love.graphics.setColor(128,255,128,72) + love.graphics.setColor(0.5, 1, 0.5, 0.3) love.graphics.rectangle("fill",math.floor((x-xscroll-1)*16*scale), (((y-1)*16+8)*scale)-yscroll*16*scale, 16*scale, 16*scale) end elseif tileselectionclick2 == false then @@ -889,7 +889,7 @@ function editor_draw() lx1 = math.min(tileselectionclick1x, x) ly1 = math.min(tileselectionclick1y, y) - love.graphics.setColor(112,112,255,112) + love.graphics.setColor(0.44,0.44,1,0.44) love.graphics.rectangle("fill",math.floor((lx1-xscroll-1)*16*scale), (((ly1-1)*16+8)*scale)-yscroll*16*scale, (math.max(tileselectionclick1x, x)-lx1)*16*scale+16*scale, (math.max(tileselectionclick1y, y)-ly1)*16*scale+16*scale) else -- two clicks done @@ -899,7 +899,7 @@ function editor_draw() lx2 = math.max(tileselectionclick1x, tileselectionclick2x) ly2 = math.max(tileselectionclick1y, tileselectionclick2y) - love.graphics.setColor(172,255,172,72) + love.graphics.setColor(0.67,1,0.67,0.3) if mtjustsaved then local r, g, b, a = unpack(mtsavecolors) if r > 172 then @@ -926,8 +926,8 @@ function editor_draw() if a < 72 then a = 72 end - love.graphics.setColor(r, g, b, a) - if r ==172 and g ==255 and b ==172 and a == 72 then + love.graphics.setColor(r / 255, g / 255, b / 255, a / 255) + if r == 172 and g == 255 and b == 172 and a == 72 then mtsavehighlighttime = 5 mtsavetimer = 0 mtjustsaved = false @@ -955,10 +955,11 @@ function editor_draw() local cox, coy = getMouseTile(middlemode[2], middlemode[3]-8*scale) for i = 1, #enemies do local v = enemiesdata[ enemies[i] ] - love.graphics.setColor(255, 255, 255, 50) + love.graphics.setColor(1, 1, 1, 0.2) if i == currenttile then - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) end + --[[ COMPATABILITY FOR LOVE 0.9.X AND BELOW local t = "setStencil" local action = nil local int = nil @@ -980,9 +981,16 @@ function editor_draw() else love.graphics.setStencil() end + ]] + love.graphics.stencil(function() love.graphics.rectangle("fill", (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 16*scale, 16*scale) end, "replace", 1) + love.graphics.setStencilTest("greater", 0) + + love.graphics.drawq(v.graphic, v.quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) + + love.graphics.setStencilTest() if i == currenttile then - love.graphics.setColor(255, 0, 0, 155) + love.graphics.setColor(1, 0, 0, 0.6) drawrectangle((math.mod((i-1), 22)-offx)*17+cox*16, (math.floor((i-1)/22)-offy)*17+coy*16-9, 18, 18) end end @@ -1004,13 +1012,13 @@ function editor_draw() for i2, v in ipairs(entitylistitems) do for j, w in ipairs(v.entries) do local i = (i2-1)*22+j - love.graphics.setColor(255, 255, 255, 50) + love.graphics.setColor(1, 1, 1, 0.2) if w.i == currenttile then - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) end love.graphics.drawq(entityquads[w.i].image, entityquads[w.i].quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) if w.i == currenttile then - love.graphics.setColor(255, 0, 0, 155) + love.graphics.setColor(1, 0, 0, 0.6) drawrectangle((math.mod((i-1), 22)-offx)*17+cox*16, (math.floor((i-1)/22)-offy)*17+coy*16-9, 18, 18) end end @@ -1021,20 +1029,20 @@ function editor_draw() local cox, coy = getMouseTile(middlemode[2], middlemode[3]-8*scale) for a = 1, tilelistcount+1 do local i = a+tileliststart-1 - love.graphics.setColor(255, 255, 255, 50) + love.graphics.setColor(1, 1, 1, 0.2) if i == currenttile then - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) end love.graphics.drawq(tilequads[i].image, tilequads[i]:quad(), (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) if i == currenttile then - love.graphics.setColor(255, 0, 0, 155) + love.graphics.setColor(1, 0, 0, 0.6) drawrectangle((math.mod((i-1), 22)-offx)*17+cox*16, (math.floor((i-1)/22)-offy)*17+coy*16-9, 18, 18) end end end love.graphics.pop() elseif pastingtiles == false then - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) local cox, coy = middlemode[2], middlemode[3] if love.mouse.isDown("m") then cox, coy = getMouseTile(love.mouse.getX(), love.mouse.getY()-8*scale) @@ -1084,9 +1092,9 @@ function editor_draw() local drawline = false if cox == x and coy == y and tablecontains(outputsi, map[x][y][2]) then - love.graphics.setColor(255, 255, 150, 255) + love.graphics.setColor(1, 1, 0.6, 1) elseif tablecontains(outputsi, map[x][y][2]) then - love.graphics.setColor(255, 255, 150, 150) + love.graphics.setColor(1, 1, 0.6, 0.6) end love.graphics.rectangle("fill", math.floor((x-1-xscroll)*16*scale), ((y-1-yscroll)*16-8)*scale, 16*scale, 16*scale) end @@ -1123,7 +1131,7 @@ function editor_draw() for i = 1, #drawtable do local x1, y1, x2, y2, t, c = unpack(drawtable[i]) local r, g, b = unpack(c) - love.graphics.setColor(r, g, b, math.max(0, (1-rightclicka)*255)) + love.graphics.setColor(r, g, b, math.max(0, 1-rightclicka)) if math.mod(i, 2) == 0 then drawlinkline2(x1, y1, x2, y2) @@ -1166,7 +1174,7 @@ function editor_draw() for i = 1, #drawtable do local x1, y1, x2, y2, t = unpack(drawtable[i]) - love.graphics.setColor(127, 127, 255*(i/#drawtable), 255*rightclicka) + love.graphics.setColor(0.5, 0.5, i/#drawtable, rightclicka) if math.mod(i, 2) == 0 then drawlinkline2(x1, y1, x2, y2) @@ -1181,11 +1189,11 @@ function editor_draw() local x1, y1 = math.floor((linktoolX-xscroll-.5)*16*scale), math.floor((linktoolY-yscroll-1)*16*scale) local x2, y2 = mousex, mousey - love.graphics.setColor(255, 172, 47, 255) + love.graphics.setColor(255 / 255, 172 / 255, 47 / 255, 1) drawlinkline(x1, y1, x2, y2) - love.graphics.setColor(200, 140, 30, 255) + love.graphics.setColor(200 / 255, 140 / 255, 30 / 255, 1) love.graphics.draw(linktoolpointerimg, x2-math.ceil(scale/2), y2, 0, scale, scale, 3, 3) @@ -1217,7 +1225,7 @@ function editor_draw() table.insert(pointstable, {x=x, y=y+yoffset}) until y > yscroll+height+.5 - love.graphics.setColor(62, 213, 244, 150*rightclicka) + love.graphics.setColor(62 / 255, 213 / 255, 244 / 255, 0.6*rightclicka) for i = 1, #pointstable-1 do local v = pointstable[i] local w = pointstable[i+1] @@ -1240,7 +1248,7 @@ function editor_draw() local mapx, mapy = (width*16 - w)/2, (height*16 - h)/2 - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", (mapx-2)*scale, (mapy-2)*scale, (w+4)*scale, (h+4)*scale) @@ -1257,10 +1265,10 @@ function editor_draw() end end - love.graphics.setColor(255, 0, 0, 255) + love.graphics.setColor(1, 0, 0, 1) drawrectangle(mapx-1, mapy-1, w+2, h+2) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprintbackground("old width: " .. mapwidth, 26*scale, (mapy-21)*scale, true) properprintbackground("old height: " .. mapheight, 26*scale, (mapy-11)*scale, true) @@ -1283,7 +1291,7 @@ function editor_draw() guielements["mapwidthapply"].x, guielements["mapwidthapply"].y = width*8+10, mapy+h+4 guielements["mapwidthcancel"].x, guielements["mapwidthcancel"].y = width*8+65, mapy+h+4 else - love.graphics.setColor(0, 0, 0, 230) + love.graphics.setColor(0, 0, 0, 0.9) if minimapdragging == false then love.graphics.rectangle("fill", 1*scale, 18*scale, 398*scale, 205*scale) @@ -1293,7 +1301,7 @@ function editor_draw() if editorstate == "tiles" then --TILES - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) drawrectangle(4, 37, 375, 167) @@ -1303,6 +1311,7 @@ function editor_draw() if editenemies then for i = 1, #enemies do local v = enemiesdata[enemies[i]] + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" local action = nil local int = nil @@ -1325,7 +1334,14 @@ function editor_draw() else love.graphics.setStencil() end - end + ]] + love.graphics.stencil(function() love.graphics.rectangle("fill", math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 16*scale, 16*scale) end, "replace", 1) + love.graphics.setStencilTest("greater", 0) + + love.graphics.drawq(v.graphic, v.quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) + + love.graphics.setStencilTest() + end else --ENTITIES for i, v in ipairs(entitylistitems) do @@ -1333,9 +1349,9 @@ function editor_draw() for j, k in ipairs(v.entries) do love.graphics.drawq(entityquads[k.i].image, entityquads[k.i].quad, (k.x+5)*scale, (k.y+38)*scale-tilesoffset, 0, scale, scale) if k:gethighlight(mouse.getX(), mouse.getY()) then - love.graphics.setColor(255, 255, 255, 127) + love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", (k.x+5)*scale, (k.y+38)*scale-tilesoffset, 16*scale, 16*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end end end @@ -1355,21 +1371,21 @@ function editor_draw() local tile = gettilelistpos(mouse.getX(), mouse.getY()) if editentities == false then if tile and tile <= tilelistcount+1 then - love.graphics.setColor(255, 255, 255, 127) + love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", (5+math.mod((tile-1), 22)*17)*scale, (38+math.floor((tile-1)/22)*17)*scale-tilesoffset, 16*scale, 16*scale) end elseif editenemies == false then else if tile and tile <= #enemies then - love.graphics.setColor(255, 255, 255, 127) + love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", (5+math.mod((tile-1), 22)*17)*scale, (38+math.floor((tile-1)/22)*17)*scale-tilesoffset, 16*scale, 16*scale) end end love.graphics.setScissor() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if editentities then if editenemies then if enemies[tile] then @@ -1462,10 +1478,10 @@ function editor_draw() properprint(s, x, y) end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) elseif editorstate == "main" then --MINIMAP - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("minimap", 3*scale, 21*scale) love.graphics.rectangle("fill", minimapx*scale, minimapy*scale, 394*scale, minimapheight*2*scale+4*scale) love.graphics.setColor(unpack(background)) @@ -1491,10 +1507,10 @@ function editor_draw() love.graphics.setScissor() - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) drawrectangle(xscroll*2+minimapx-minimapscroll*2, minimapy, (width+2)*2, minimapheight*2+4) drawrectangle(xscroll*2+minimapx-minimapscroll*2+1, minimapy+1, (width+1)*2, minimapheight*2+2) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if minimapdragging == false then properprint("portalgun:", 8*scale, 189*scale) @@ -1505,24 +1521,24 @@ function editor_draw() properprint("background color", 8*scale, 66*scale) if custombackground then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(150, 150, 150, 255) + love.graphics.setColor(0.6, 0.6, 0.6, 1) end properprint("scrollfactor", 199*scale, 142*scale) if customforeground then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(150, 150, 150, 255) + love.graphics.setColor(0.6, 0.6, 0.6, 1) end properprint("scrollfactor", 199*scale, 172*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("levelscreen:", 198*scale, 187*scale) end elseif editorstate == "maps" then - --[[love.graphics.setColor(255, 255, 255) + --[[love.graphics.setColor(1, 1, 1) for i = 1, 8 do properprint("w" .. i, ((i-1)*49 + 19)*scale, 23*scale) end @@ -1539,7 +1555,7 @@ function editor_draw() properprint("-", 351*scale, 22*scale) love.graphics.setScissor() elseif editorstate == "tools" then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("mappack title:", 5*scale, 106*scale) properprint("author:", 5*scale, 131*scale) properprint("description:", 5*scale, 156*scale) @@ -1553,7 +1569,7 @@ function editor_draw() properprint("editor settings:", 149*scale, 121*scale) - love.graphics.setColor(127, 127, 127) + love.graphics.setColor(0.5, 0.5, 0.5) love.graphics.setLineStyle("rough") love.graphics.line(148*scale, 118*scale, 397*scale, 118*scale) @@ -1577,7 +1593,7 @@ function editor_draw() local offx = -math.max(0, guielements["animationsscrollbarhor"].value/1*(completewidth-(animationguiarea[3]-animationguiarea[1]))) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local y = animationguiarea[2]+1-offy y = y + 2 @@ -1632,13 +1648,13 @@ function editor_draw() love.graphics.setScissor() - love.graphics.setColor(90, 90, 90) + love.graphics.setColor(0.35, 0.35, 0.35) drawrectangle(animationguiarea[1]-10, animationguiarea[4], 10, 10) end elseif editorstate == "objects" then local mtbutton = getmtbutton(love.mouse.getX()) for i = 1, #multitileobjects do - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if math.floor(i-1)*17*scale+42*scale-multitilesoffset < 200*scale then properprint(multitileobjectnames[i], 8*scale, math.floor(i-1)*17*scale+42*scale-multitilesoffset) end @@ -1654,11 +1670,11 @@ function editor_draw() properprint("delete", 10*scale, 210*scale) end elseif editorstate == "lightdrawcustomize" then - love.graphics.setColor(127,127,127) + love.graphics.setColor(0.5, 0.5, 0.5) properprint("more coming soon", 5*scale, 55*scale) - guielements["tabtools"].textcolor = {math.random(0,255),math.random(0,255),math.random(0,255)} - guielements["tabtools"].fillcolor = {math.random(0,255),math.random(0,255),math.random(0,255)} - guielements["tabtools"].bordercolor = {math.random(0,255),math.random(0,255),math.random(0,255)} + guielements["tabtools"].textcolor = {math.random(),math.random(),math.random()} + guielements["tabtools"].fillcolor = {math.random(),math.random(),math.random()} + guielements["tabtools"].bordercolor = {math.random(),math.random(),math.random()} end end end @@ -1718,11 +1734,11 @@ function maintab() end guielements["tabmain"].fillcolor = {0, 0, 0} - guielements["tabtiles"].fillcolor = {63, 63, 63} - guielements["tabtools"].fillcolor = {63, 63, 63} - guielements["tabmaps"].fillcolor = {63, 63, 63} - guielements["tabanimations"].fillcolor = {63, 63, 63} - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmain"].active = true guielements["tabtiles"].active = true guielements["tabtools"].active = true @@ -1770,12 +1786,12 @@ function tilestab() v.active = false end - guielements["tabmain"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} guielements["tabtiles"].fillcolor = {0, 0, 0} - guielements["tabtools"].fillcolor = {63, 63, 63} - guielements["tabmaps"].fillcolor = {63, 63, 63} - guielements["tabanimations"].fillcolor = {63, 63, 63} - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmain"].active = true guielements["tabtiles"].active = true guielements["tabtools"].active = true @@ -1808,12 +1824,12 @@ function toolstab() v.active = false end - guielements["tabmain"].fillcolor = {63, 63, 63} - guielements["tabtiles"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} guielements["tabtools"].fillcolor = {0, 0, 0} - guielements["tabmaps"].fillcolor = {63, 63, 63} - guielements["tabanimations"].fillcolor = {63, 63, 63} - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmain"].active = true guielements["tabtiles"].active = true guielements["tabtools"].active = true @@ -1856,12 +1872,12 @@ function mapstab() v.active = false end - guielements["tabmain"].fillcolor = {63, 63, 63} - guielements["tabtiles"].fillcolor = {63, 63, 63} - guielements["tabtools"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmaps"].fillcolor = {0, 0, 0} - guielements["tabanimations"].fillcolor = {63, 63, 63} - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmain"].active = true guielements["tabtiles"].active = true guielements["tabtools"].active = true @@ -1869,7 +1885,7 @@ function mapstab() guielements["tabanimations"].active = true guielements["tabobjects"].active = true guielements["mapsnewlevel"].active = true - guielements["mapsnewlevel"].textcolor = {0, 255, 0} + guielements["mapsnewlevel"].textcolor = {0, 1, 0} guielements["mapsworldbox"].active = true guielements["mapslevelbox"].active = true @@ -1890,12 +1906,12 @@ function animationstab() v.active = false end - guielements["tabmain"].fillcolor = {63, 63, 63} - guielements["tabtiles"].fillcolor = {63, 63, 63} - guielements["tabtools"].fillcolor = {63, 63, 63} - guielements["tabmaps"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} guielements["tabanimations"].fillcolor = {0, 0, 0} - guielements["tabobjects"].fillcolor = {63, 63, 63} + guielements["tabobjects"].fillcolor = {0.25, 0.25, 0.25} guielements["tabmain"].active = true guielements["tabtiles"].active = true guielements["tabtools"].active = true @@ -1926,11 +1942,11 @@ function objectstab() v.active = false end - guielements["tabmain"].fillcolor = {63, 63, 63} - guielements["tabtiles"].fillcolor = {63, 63, 63} - guielements["tabtools"].fillcolor = {63, 63, 63} - guielements["tabmaps"].fillcolor = {63, 63, 63} - guielements["tabanimations"].fillcolor = {63, 63, 63} + guielements["tabmain"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtiles"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabtools"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabmaps"].fillcolor = {0.25, 0.25, 0.25} + guielements["tabanimations"].fillcolor = {0.25, 0.25, 0.25} guielements["tabobjects"].fillcolor = {0, 0, 0} guielements["tabmain"].active = true guielements["tabtiles"].active = true @@ -1986,8 +2002,8 @@ end function fromlightdrawcustomizetab() --the name for this tab is all over the place guielements["tabtools"].text = "tools" - guielements["tabtools"].textcolor = {255,255,255} - guielements["tabtools"].bordercolor = {127,127,127} + guielements["tabtools"].textcolor = {1, 1, 1} + guielements["tabtools"].bordercolor = {0.5, 0.5, 0.5} for i = 1, drawtools do guielements["drawtool" .. i].active = false end @@ -2068,7 +2084,7 @@ function createnewanimation() s.actions = {} local i = 1 - while love.filesystem.exists("mappacks/" .. mappack .. "/animations/animation" .. i .. ".json") do + while love.filesystem.getInfo("mappacks/" .. mappack .. "/animations/animation" .. i .. ".json") do i = i + 1 end love.filesystem.createDirectory("mappacks/" .. mappack .. "/animations/") @@ -2186,7 +2202,7 @@ function loadmtobjects() multitileobjects = {} multitileobjectnames = nil multitileobjectnames = {} - if love.filesystem.exists("mappacks/" .. mappack .. "/objects.txt") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/objects.txt") then local data = love.filesystem.read("mappacks/" .. mappack .. "/objects.txt") if #data > 0 then data = string.sub(data, 1, -2) @@ -2363,13 +2379,13 @@ function changenewmapsize(side, dir) end function tilesall() - guielements["tilesall"].textcolor = {255, 255, 255} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {1, 1, 1} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = false tileliststart = 1 @@ -2385,13 +2401,13 @@ function tilesall() end function tilessmb() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {255, 255, 255} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {1, 1, 1} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = false tileliststart = 1 @@ -2407,13 +2423,13 @@ function tilessmb() end function tilesportal() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {255, 255, 255} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {1, 1, 1} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = false tileliststart = smbtilecount + 1 @@ -2429,13 +2445,13 @@ function tilesportal() end function tilescustom() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {255, 255, 255} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {1, 1, 1} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = false tileliststart = smbtilecount + portaltilecount + 1 @@ -2451,13 +2467,13 @@ function tilescustom() end function tilesanimated() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {255, 255, 255} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {1, 1, 1} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = true tileliststart = 1 @@ -2473,13 +2489,13 @@ function tilesanimated() end function tilesentities() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {255, 255, 255} - guielements["tilesenemies"].textcolor = {127, 127, 127} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {1, 1, 1} + guielements["tilesenemies"].textcolor = {0.5, 0.5, 0.5} animatedtilelist = false editentities = true @@ -2491,13 +2507,13 @@ function tilesentities() end function tilesenemies() - guielements["tilesall"].textcolor = {127, 127, 127} - guielements["tilessmb"].textcolor = {127, 127, 127} - guielements["tilesportal"].textcolor = {127, 127, 127} - guielements["tilescustom"].textcolor = {127, 127, 127} - guielements["tilesanimated"].textcolor = {127, 127, 127} - guielements["tilesentities"].textcolor = {127, 127, 127} - guielements["tilesenemies"].textcolor = {255, 255, 255} + guielements["tilesall"].textcolor = {0.5, 0.5, 0.5} + guielements["tilessmb"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesportal"].textcolor = {0.5, 0.5, 0.5} + guielements["tilescustom"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesanimated"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesentities"].textcolor = {0.5, 0.5, 0.5} + guielements["tilesenemies"].textcolor = {1, 1, 1} animatedtilelist = false tilescrollbarheight = math.max(0, math.ceil((#enemies)/22)*17 - 1 - (17*9) - 12) @@ -2667,7 +2683,7 @@ function getmaps() mapbuttons["plus" .. worlds .. "-" .. levels] = guielement:new("button", 62+(string.len(worlds)+string.len(levels))*8, yadd+19, "+", mapnumberclick, 0, {worlds, levels, 1}) mapbuttons["plus" .. worlds .. "-" .. levels].starty = yadd+19 yadd = yadd + 10 - if love.filesystem.exists("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. ".png") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. ".png") then mapbuttons[worlds .. "-" .. levels .. "_" .. sublevels or 0] = guielement:new("button", 4, yadd+21, love.graphics.newImage("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. ".png"), mapnumberclick, 0, {worlds, levels}) else mapbuttons[worlds .. "-" .. levels .. "_" .. sublevels or 0] = guielement:new("button", 4, yadd+21, "no preview", mapnumberclick, 0, {worlds, levels}) @@ -2686,14 +2702,14 @@ function getmaps() levels = tonumber(levels) sublevels = tonumber(sublevels) if not mapbuttons["text" .. worlds .. "-" .. levels] then - mapbuttons["text" .. worlds .. "-" .. levels] = guielement:new("text", 4, yadd+21, "world " .. worlds .. "-" .. levels, {127, 127, 127}) + mapbuttons["text" .. worlds .. "-" .. levels] = guielement:new("text", 4, yadd+21, "world " .. worlds .. "-" .. levels, {0.5, 0.5, 0.5}) mapbuttons["text" .. worlds .. "-" .. levels].starty = yadd+21 yadd = yadd + 10 end - mapbuttons["text" .. worlds .. "-" .. levels .. "_" .. sublevels] = guielement:new("text", 4, yadd+26, "sub " .. sublevels, {127, 127, 127}) + mapbuttons["text" .. worlds .. "-" .. levels .. "_" .. sublevels] = guielement:new("text", 4, yadd+26, "sub " .. sublevels, {0.5, 0.5, 0.5}) mapbuttons["text" .. worlds .. "-" .. levels .. "_" .. sublevels].starty = yadd+26 xadd = 50 - if love.filesystem.exists("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. "_" .. sublevels ..".png") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. "_" .. sublevels ..".png") then mapbuttons[worlds .. "-" .. levels .. "_" .. sublevels] = guielement:new("button", 54, yadd+21, love.graphics.newImage("mappacks/" .. mappack .. "/" .. worlds .. "-" .. levels .. "_" .. sublevels .. ".png"), mapnumberclick, 0, {worlds, levels, sublevels}) mapbuttons[worlds .. "-" .. levels .. "_" .. sublevels].starty = yadd+21 else @@ -2801,7 +2817,7 @@ end if love.filesystem.exists("mappacks/" .. mappack .. "/" .. s .. ".txt") then if k ~= 0 then - mapbuttons["text" .. i .. "-" .. j .. "_" .. k] = guielement:new("text", 4, yadd+26, "sub " .. k, {127, 127, 127}) + mapbuttons["text" .. i .. "-" .. j .. "_" .. k] = guielement:new("text", 4, yadd+26, "sub " .. k, {0.5, 0.5, 0.5}) mapbuttons["text" .. i .. "-" .. j .. "_" .. k].starty = yadd+26 xadd = 50 end @@ -3771,7 +3787,7 @@ end function savemtobject(objecttable, name) -- 1 read objects file local data, data2, datalines, objectname - if love.filesystem.exists("mappacks/" .. mappack .. "/objects.txt") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/objects.txt") then data = love.filesystem.read("mappacks/" .. mappack .. "/objects.txt") else data = "" @@ -3821,7 +3837,7 @@ function objectclipboardcopy(objecttable) end function moveline(file, line, direction) - if love.filesystem.exists(file) == false then + if love.filesystem.getInfo(file) == false then return false end if direction ~= "up" then @@ -3869,7 +3885,7 @@ function moveline(file, line, direction) end function deleteline(file, line) - if love.filesystem.exists(file) == false then + if love.filesystem.getInfo(file) == false then return false end line = tonumber(line) @@ -3887,7 +3903,7 @@ function deleteline(file, line) end function changeline(file, linenumber, newstring) - if love.filesystem.exists(file) == false then + if love.filesystem.getInfo(file) == false then return false end line = tonumber(line) @@ -3933,15 +3949,15 @@ function defaultbackground(i) background = {unpack(backgroundcolor[i])} love.graphics.setBackgroundColor(unpack(background)) - guielements["colorsliderr"].internvalue = background[1]/255 - guielements["colorsliderg"].internvalue = background[2]/255 - guielements["colorsliderb"].internvalue = background[3]/255 + guielements["colorsliderr"].internvalue = background[1] + guielements["colorsliderg"].internvalue = background[2] + guielements["colorsliderb"].internvalue = background[3] end function updatebackground() - background[1] = guielements["colorsliderr"].internvalue*255 - background[2] = guielements["colorsliderg"].internvalue*255 - background[3] = guielements["colorsliderb"].internvalue*255 + background[1] = guielements["colorsliderr"].internvalue + background[2] = guielements["colorsliderg"].internvalue + background[3] = guielements["colorsliderb"].internvalue love.graphics.setBackgroundColor(unpack(background)) end diff --git a/emancipateanimation.lua b/emancipateanimation.lua index 1ea668b..1dfebe4 100644 --- a/emancipateanimation.lua +++ b/emancipateanimation.lua @@ -56,7 +56,7 @@ function emancipateanimation:draw() local black = 1-self.timer/emancipateanimationtime local a = math.min(1, 1-(self.timer-(emancipateanimationtime-emancipatefadeouttime))/emancipatefadeouttime) - love.graphics.setColor(255*black, 255*black, 255*black, 255*a) + love.graphics.setColor(black, black, black, a) if self.quad then love.graphics.drawq(self.img, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor(((self.y-yscroll)*16-self.offsetY)*scale), self.rotation, scale, scale, self.quadcenterX, self.quadcenterY) else diff --git a/emancipationfizzle.lua b/emancipationfizzle.lua index 7dec57b..b8e622d 100644 --- a/emancipationfizzle.lua +++ b/emancipationfizzle.lua @@ -25,6 +25,6 @@ function emancipationfizzle:update(dt) end function emancipationfizzle:draw() - love.graphics.setColor(255*(1-self.timer/emancipationfizzletime), 255*(1-self.timer/emancipationfizzletime), 255*(1-self.timer/emancipationfizzletime), 255*(1-self.timer/emancipationfizzletime)) + love.graphics.setColor((1-self.timer/emancipationfizzletime), (1-self.timer/emancipationfizzletime), (1-self.timer/emancipationfizzletime), (1-self.timer/emancipationfizzletime)) love.graphics.draw(fizzleimg, (self.x-xscroll)*16*scale, (self.y-yscroll-.5)*16*scale, self.r, scale, scale, 2, 1) end \ No newline at end of file diff --git a/emancipationgrill.lua b/emancipationgrill.lua index cdb60a7..396c219 100644 --- a/emancipationgrill.lua +++ b/emancipationgrill.lua @@ -139,7 +139,7 @@ function emancipationgrill:draw() love.graphics.setColor(unpack(emancelinecolor)) love.graphics.rectangle("fill", math.floor((self.startx-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-2)*scale, self.range, scale*4) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) for i, v in pairs(self.particles.i) do local y = ((self.y-1-yscroll)*16-self.particles.mod[i])*scale @@ -166,7 +166,7 @@ function emancipationgrill:draw() love.graphics.setColor(unpack(emancelinecolor)) love.graphics.rectangle("fill", math.floor(((self.x-1-xscroll)*16+6)*scale), parstartup-8*scale, scale*4, self.range - emanceimgwidth*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) for i, v in pairs(self.particles.i) do local x = ((self.x-1-xscroll)*16-self.particles.mod[i]+9)*scale diff --git a/enemies.lua b/enemies.lua index 497509b..ac8b929 100644 --- a/enemies.lua +++ b/enemies.lua @@ -110,7 +110,7 @@ function loadenemy(filename) end --Load graphics if it exists - if love.filesystem.exists(folder .. s .. ".png") then + if love.filesystem.getInfo(folder .. s .. ".png") then enemiesdata[s].graphic = love.graphics.newImage(folder .. s .. ".png") end diff --git a/entity.lua b/entity.lua index d7ae608..577dd29 100644 --- a/entity.lua +++ b/entity.lua @@ -126,7 +126,7 @@ tooltipimages = {} for i = 1, #entitylist do local path = "graphics/entitytooltips/" .. entitylist[i].t .. ".png" - if love.filesystem.isFile(path) then + if love.filesystem.getInfo(path) then tooltipimages[i] = love.graphics.newImage(path) end end diff --git a/entitytooltip.lua b/entitytooltip.lua index faa491a..2aaf3e2 100644 --- a/entitytooltip.lua +++ b/entitytooltip.lua @@ -16,17 +16,17 @@ end function entitytooltip:draw(a) if tooltipimages[self.ent.i] then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) properprintbackground(self.ent.t, self.x, self.y, true) love.graphics.setColor(0, 0, 0, a) drawrectangle(self.x/scale, self.y/scale+8, (twidth+4), (theight+4)) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) drawrectangle(self.x/scale+1, self.y/scale+9, 66, theight+2) local r, g, b = love.graphics.getBackgroundColor() love.graphics.setColor(r, g, b, a) love.graphics.rectangle("fill", self.x+2*scale, self.y+10*scale, 64*scale, 64*scale) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) love.graphics.draw(tooltipimages[self.ent.i], self.x+2*scale, self.y+10*scale, 0, scale, scale) end end \ No newline at end of file diff --git a/faithplate.lua b/faithplate.lua index ce33303..50359c6 100644 --- a/faithplate.lua +++ b/faithplate.lua @@ -129,7 +129,7 @@ function faithplate:draw() love.graphics.setColor(unpack(background)) love.graphics.rectangle("fill", math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, 32*scale, 2*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if self.animationtimer < 1 then diff --git a/funnel.lua b/funnel.lua index e9a76b6..1e1f5b4 100644 --- a/funnel.lua +++ b/funnel.lua @@ -208,7 +208,7 @@ function funnel:update(dt) end function funnel:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if self.power then local img @@ -294,7 +294,7 @@ function funnel:draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if self.dir == "right" then love.graphics.drawq(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll-1)*16*scale), math.floor((self.coy-yscroll-1.5)*16*scale), 0, scale, scale) elseif self.dir == "left" then diff --git a/game.lua b/game.lua index 6e7b597..6b1993f 100644 --- a/game.lua +++ b/game.lua @@ -14,7 +14,7 @@ function game_load(suspended) --get mariolives mariolivecount = 3 - if love.filesystem.exists("mappacks/" .. mappack .. "/settings.txt") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/settings.txt") then local s = love.filesystem.read( "mappacks/" .. mappack .. "/settings.txt" ) local s1 = s:split("\n") for j = 1, #s1 do @@ -782,7 +782,7 @@ function drawlevel() end love.graphics.setColor(love.graphics.getBackgroundColor()) love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) local xtodraw if mapwidth < width+1 then xtodraw = math.ceil(mapwidth) @@ -943,25 +943,25 @@ function drawlevel() if #t > 1 and t[2] ~= "link" then tilenumber = t[2] - love.graphics.setColor(255, 255, 255, 150) + love.graphics.setColor(1, 1, 1, 0.6) if tablecontains(enemies, tilenumber) then --ENEMY PREVIEW THING local v = enemiesdata[tilenumber] local xoff, yoff = (((v.spawnoffsetx or 0)+v.width/2-.5)*16 - v.offsetX + v.quadcenterX)*scale, (((v.spawnoffsety or 0)-v.height+1)*16-v.offsetY - v.quadcenterY)*scale local mx, my = getMouseTile(mouse.getX(), mouse.getY()+8*scale) - local alpha = 150 + local alpha = 0.6 if x == mx and y == my then - alpha = 255 + alpha = 1 end - love.graphics.setColor(255, 0, 0, alpha) + love.graphics.setColor(1, 0, 0, alpha) love.graphics.rectangle("fill", math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 16*scale, 16*scale) - love.graphics.setColor(255, 255, 255, alpha) + love.graphics.setColor(1, 1, 1, alpha) love.graphics.drawq(v.graphic, v.quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale+xoff), math.floor(((y-1-math.mod(yscroll, 1))*16)*scale+yoff), 0, scale, scale) else love.graphics.drawq(entityquads[tilenumber].image, entityquads[tilenumber].quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end if entitylist[map[x][y][2]] and entitylist[map[x][y][2]].t == "platform" then @@ -975,20 +975,20 @@ function drawlevel() end - love.graphics.setColor(252, 152, 56, 150) + love.graphics.setColor(252 / 255, 152 / 255, 56 / 255, 0.6) if dir == "down" then love.graphics.line((x-xscroll-.5)*16*scale, (y-yscroll-1.2)*16*scale, (x-xscroll-.5)*16*scale, (y-yscroll-1.2+dist)*16*scale) elseif dir == "left" then love.graphics.line((x-xscroll-.5)*16*scale, (y-yscroll-1.2)*16*scale, (x-xscroll-.5-dist)*16*scale, (y-yscroll-1.2)*16*scale) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end end end end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --textentities for j, w in pairs(textentities) do w:draw() @@ -1002,7 +1002,7 @@ function drawui(hidetime) end ---UI - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.translate(0, -yoffset*scale) if yoffset < 0 then love.graphics.translate(0, yoffset*scale) @@ -1044,9 +1044,9 @@ function drawui(hidetime) local x = (width*16)/players/2 + (width*16)/players*(i-1) if mariolivecount ~= false then printfunction("p" .. i .. " * " .. mariolives[i], (x-string.len("p" .. i .. " * " .. mariolives[i])*4+4)*scale, 25*scale) - love.graphics.setColor(mariocolors[i][1] or {255, 255, 255}) + love.graphics.setColor(mariocolors[i][1] or {1, 1, 1}) love.graphics.rectangle("fill", (x-string.len("p" .. i .. " * " .. mariolives[i])*4-3)*scale, 25*scale, 7*scale, 7*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end end end @@ -1201,10 +1201,10 @@ function game_draw() currentscissor = {0, 0, ww, hh} --This is just silly if earthquake > 0 and #rainbooms > 0 then - local colortable = {{242, 111, 51}, {251, 244, 174}, {95, 186, 76}, {29, 151, 212}, {101, 45, 135}, {238, 64, 68}} + local colortable = {{242 / 255, 111 / 255, 51 / 255}, {251 / 255, 244 / 255, 174 / 255}, {95 / 255, 186 / 255, 76 / 255}, {29 / 255, 151 / 255, 212 / 255}, {101 / 255, 45 / 255, 135 / 255}, {238 / 255, 64 / 255, 68 / 255}} for i = 1, backgroundstripes do local r, g, b = unpack(colortable[math.mod(i-1, 6)+1]) - local a = earthquake/rainboomearthquake*255 + local a = earthquake/rainboomearthquake love.graphics.setColor(r, g, b, a) @@ -1218,7 +1218,7 @@ function game_draw() end end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) --tremoooor! if earthquake > 0 then tremorx = (math.random()-.5)*2*earthquake @@ -1227,7 +1227,7 @@ function game_draw() love.graphics.translate(round(tremorx), round(tremory)) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) --THIS IS WHERE MAP DRAWING AND SHIT BEGINS @@ -1238,13 +1238,13 @@ function game_draw() drawui() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --vines for j, w in pairs(objects["vine"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --warpzonetext if displaywarpzonetext then properprint("welcome to warp zone!", (mapwidth-14-1/16-xscroll)*16*scale, (5.5-yscroll)*16*scale) @@ -1253,37 +1253,37 @@ function game_draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --platforms for j, w in pairs(objects["platform"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --scaffolds for j, w in pairs(objects["scaffold"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --seesawplatforms for j, w in pairs(objects["seesawplatform"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --seesaws for j, w in pairs(seesaws) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --springs for j, w in pairs(objects["spring"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --flag if flagx then love.graphics.draw(flagimg, math.floor((flagimgx-1-xscroll)*16*scale), ((flagimgy-yscroll)*16-8)*scale, 0, scale, scale) @@ -1292,13 +1292,13 @@ function game_draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --axe if axex then love.graphics.drawq(axeimg, axequads[coinframe], math.floor((axex-1-xscroll)*16*scale), (axey-1.5-yscroll)*16*scale, 0, scale, scale) end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --levelfinish text and toad if levelfinished and levelfinishtype == "castle" then if marioworld ~= 8 then @@ -1336,75 +1336,75 @@ function game_draw() end end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Panels for j, w in pairs(objects["panel"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Fireworks for j, w in pairs(fireworks) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Buttons for j, w in pairs(objects["button"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Pushbuttons for j, w in pairs(objects["pushbutton"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --hardlight bridges for j, w in pairs(objects["lightbridgebody"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --lightbridge for j, w in pairs(objects["lightbridge"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --laser for j, w in pairs(objects["laser"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --laserdetector for j, w in pairs(objects["laserdetector"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Groundlights for j, w in pairs(objects["groundlight"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Faithplates for j, w in pairs(objects["faithplate"]) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --Bubbles for j, w in pairs(bubbles) do w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --miniblocks for i, v in pairs(miniblocks) do v:draw() @@ -1425,7 +1425,7 @@ function game_draw() v:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --OBJECTS for j, w in pairs(objects) do @@ -1433,7 +1433,7 @@ function game_draw() for i, v in pairs(w) do if v.drawable and v.graphic and v.quad then love.graphics.setScissor() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local dirscale if j == "player" then @@ -1485,6 +1485,7 @@ function game_draw() --SCISSOR FOR ENTRY if v.customscissor and v.portalable ~= false then + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" if v.invertedscissor then t = "setInvertedStencil" @@ -1502,6 +1503,9 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end + ]] + love.graphics.stencil(function() love.graphics.rectangle("fill", math.floor((v.customscissor[1]-xscroll)*16*scale), math.floor((v.customscissor[2]-.5-yscroll)*16*scale), v.customscissor[3]*16*scale, v.customscissor[4]*16*scale) end, "replace", 1) + love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end if v.static == false and v.portalable ~= false then @@ -1531,7 +1535,7 @@ function game_draw() if v.colors[k] then love.graphics.setColor(v.colors[k]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end love.graphics.drawq(v.graphic[k], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end @@ -1552,7 +1556,7 @@ function game_draw() if v.hats[i] == 1 then love.graphics.setColor(v.colors[1]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end if v.graphic == v.biggraphic or v.animationstate == "grow" then love.graphics.draw(bighat[v.hats[i]].graphic, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX - bighat[v.hats[i]].x + offsets[1], v.quadcenterY - bighat[v.hats[i]].y + offsets[2] + yadd) @@ -1564,12 +1568,12 @@ function game_draw() end end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end if type(v.graphic) == "table" then if v.graphic[0] then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.drawq(v.graphic[0], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot then @@ -1580,6 +1584,7 @@ function game_draw() --portal duplication if v.customscissor and v.portalable ~= false then + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" if v.invertedscissor then t = "setInvertedStencil" @@ -1597,6 +1602,9 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end + ]] + love.graphics.stencil(function() love.graphics.rectangle("fill", math.floor((v.customscissor[1]-xscroll)*16*scale), math.floor((v.customscissor[2]-.5-yscroll)*16*scale), v.customscissor[3]*16*scale, v.customscissor[4]*16*scale) end, "replace", 1) + love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end if v.static == false and (v.active or v.portaloverride) and v.portalable ~= false then @@ -1629,7 +1637,7 @@ function game_draw() if v.colors[k] then love.graphics.setColor(v.colors[k]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end love.graphics.drawq(v.graphic[k], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end @@ -1648,7 +1656,7 @@ function game_draw() if v.hats[i] == 1 then love.graphics.setColor(v.colors[1]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end if v.graphic == v.biggraphic or v.animationstate == "grow" then love.graphics.draw(bighat[v.hats[i]].graphic, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX - bighat[v.hats[i]].x + offsets[1], v.quadcenterY - bighat[v.hats[i]].y + offsets[2] + yadd) @@ -1664,7 +1672,7 @@ function game_draw() if type(v.graphic) == "table" then if v.graphic[0] then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.drawq(v.graphic[0], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot and v.lastportal then @@ -1675,17 +1683,19 @@ function game_draw() end end love.graphics.setScissor(unpack(currentscissor)) - if loveVersion > 9 then - love.graphics.setStencilTest() + -- if loveVersion > 9 then + love.graphics.setStencilTest() + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW else love.graphics.setStencil() end + ]] end end end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --bowser for j, w in pairs(objects["bowser"]) do @@ -1777,14 +1787,14 @@ function game_draw() w:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --portals for i, v in pairs(portals) do v:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --COINBLOCKanimation for i, v in pairs(coinblockanimations) do @@ -1865,7 +1875,7 @@ function game_draw() end end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) local dist = math.sqrt(((x-xscroll)*16*scale - (sourcex-xscroll)*16*scale)^2 + ((y-.5-yscroll)*16*scale - (sourcey-.5-yscroll)*16*scale)^2)/16/scale @@ -1881,19 +1891,20 @@ function game_draw() local radius = math.sqrt(xplus^2 + yplus^2)/scale - local alpha = 255 + local alpha = 1 if radius < portaldotsouter and a == 1 then alpha = (radius-portaldotsinner) * (255/(portaldotsouter-portaldotsinner)) if alpha < 0 then alpha = 0 end + alpha = alpha/255 end if portalpossible == false then - love.graphics.setColor(255, 0, 0, alpha) + love.graphics.setColor(1, 0, 0, alpha) else - love.graphics.setColor(0, 255, 0, alpha) + love.graphics.setColor(0, 1, 0, alpha) end love.graphics.draw(portaldotimg, math.floor(dotx-0.25*scale), math.floor(doty-0.25*scale), 0, scale, scale) @@ -1916,13 +1927,13 @@ function game_draw() dist = math.sqrt(((x-xscroll)*16*scale - (sourcex-xscroll)*16*scale)^2 + ((y-.5-yscroll)*16*scale - (sourcey-.5-yscroll)*16*scale)^2)/16/scale end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if cox ~= false then if portalpossible == false then - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) else - love.graphics.setColor(0, 255, 0) + love.graphics.setColor(0, 1, 0) end local rotation = 0 @@ -1944,7 +1955,7 @@ function game_draw() v:draw() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --nothing to see here for i, v in pairs(rainbooms) do @@ -2075,7 +2086,7 @@ function game_draw() if (facing == "left" and facing2 == "right") or (facing == "right" and facing2 == "left") or (facing == "up" and facing2 == "down") or (facing == "down" and facing2 == "up") then a = a - math.pi end - + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" local action = nil local int = nil @@ -2092,23 +2103,30 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest("greater", 0) end + ]] + love.graphics.stencil(function() + love.graphics.polygon("fill", p1x*16*scale, p1y*16*scale, p2x*16*scale, p2y*16*scale, p4x*16*scale, p4y*16*scale, p3x*16*scale, p3y*16*scale) + end, "replace", 1) --feels like javascript + love.graphics.setStencilTest("greater", 0) love.graphics.setColor(unpack(background)) love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(scenecanvas, (offx+ox)*16*scale, (offy+oy)*16*scale, a, xscale, yscale, ox*16*scale, oy*16*scale) local r, g, b = unpack(v["portal" .. i .. "color"]) - --love.graphics.setColor(r, g, b, 150) + --love.graphics.setColor(r, g, b, 0.6) --love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) - - if v > 9 then - love.graphics.setStencilTest() + + -- if v > 9 then + love.graphics.setStencilTest() + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW I think, it's hard to tell, is the v supposed to be loveVersion?? else love.graphics.setStencil() end + ]] love.graphics.setColor(r, g, b) love.graphics.line(p1x*16*scale, p1y*16*scale, p3x*16*scale, p3y*16*scale) love.graphics.line(p2x*16*scale, p2y*16*scale, p4x*16*scale, p4y*16*scale) @@ -2120,7 +2138,7 @@ function game_draw() scenedraw() end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) --Player markers for i = 1, players do @@ -2193,7 +2211,8 @@ function game_draw() local xadd = math.cos(r)*dist local yadd = math.sin(r)*dist - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" local action = nil local int = nil @@ -2207,6 +2226,9 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest("greater", 0) end + ]] + love.graphics.stencil(function() love.graphics.circle("fill", math.floor((x*16+xadd)*scale), math.floor((y*16+yadd-.5)*scale), 13.5*scale) end, "stencil", 1) + love.graphics.setStencilTest("greater", 0) local playerx, playery = x*16+xadd, y*16+yadd+3 @@ -2234,14 +2256,15 @@ function game_draw() end drawplayer(i, playerx, playery) - - if loveVersion > 9 then - love.graphics.setStencilTest() + -- if loveVersion > 9 then + love.graphics.setStencilTest() + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW else love.graphics.setStencil() end + ]] - love.graphics.setColor(v.colors[1] or {255, 255, 255}) + love.graphics.setColor(v.colors[1] or {1, 1, 1}) love.graphics.draw(markoverlayimg, math.floor(x*16*scale), math.floor(y*16*scale), r, scale, scale, 0, 15) end end @@ -2257,9 +2280,9 @@ function game_draw() if k.width then if xscroll >= k.x-width and k.x+k.width > xscroll then if k.active then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) else - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) end if incognito then love.graphics.rectangle("fill", math.floor((k.x-xscroll)*16*scale)+.5, math.floor((k.y-yscroll-.5)*16*scale)+.5, k.width*16*scale-1, k.height*16*scale-1) @@ -2275,11 +2298,11 @@ function game_draw() --Use region debug if userectdebug then - love.graphics.setColor(255, 255, 255, 100) + love.graphics.setColor(1, 1, 1, 0.4) for i, k in pairs(userects) do love.graphics.rectangle("fill", (k.x-xscroll)*16*scale, (k.y-yscroll-.5)*16*scale, k.width*16*scale, k.height*16*scale) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end @@ -2310,7 +2333,7 @@ function game_draw() --speed gradient if bullettime and speed < 1 then - love.graphics.setColor(255, 255, 255, 255-255*speed) + love.graphics.setColor(1, 1, 1, 1-speed) love.graphics.draw(gradientimg, 0, 0, 0, scale, scale) end @@ -2320,13 +2343,13 @@ function game_draw() love.graphics.translate(0, yoffset*scale) if testlevel then - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) properprint("testing level - press esc to return to editor", 0, 0) end --pause menu if pausemenuopen then - love.graphics.setColor(0, 0, 0, 100) + love.graphics.setColor(0, 0, 0, 0.4) love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) love.graphics.setColor(0, 0, 0) @@ -2334,13 +2357,13 @@ function game_draw() local menuwidth = 120 local menuheight = 170 love.graphics.rectangle("fill", (width*8*scale)-menuwidth/2*scale, (96*scale)-75*scale, menuwidth*scale, menuheight*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) drawrectangle(width*8-(menuwidth/2)+1, 96-74, menuwidth-2, menuheight-2) for i = 1, #pausemenuoptions do - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) if pausemenuselected == i and not menuprompt and not desktopprompt then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint(">", (width*8*scale)-(menuwidth/2-5)*scale, (96*scale)-60*scale+(i-1)*25*scale) end properprint(pausemenuoptions[i], (width*8*scale)-(menuwidth/2-15)*scale, (96*scale)-60*scale+(i-1)*25*scale) @@ -2356,65 +2379,65 @@ function game_draw() end if menuprompt then - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle("fill", (width*8*scale)-100*scale, (112*scale)-25*scale, 200*scale, 50*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle((width*8)-99, 112-24, 198, 48) properprint("quit to menu?", (width*8*scale)-string.len("quit to menu?")*4*scale, (112*scale)-10*scale) if pausemenuselected2 == 1 then properprint(">", (width*8*scale)-51*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) else properprint(">", (width*8*scale)+20*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) end end if desktopprompt then - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle("fill", (width*8*scale)-100*scale, (112*scale)-25*scale, 200*scale, 50*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle((width*8)-99, 112-24, 198, 48) properprint("quit to desktop?", (width*8*scale)-string.len("quit to desktop?")*4*scale, (112*scale)-10*scale) if pausemenuselected2 == 1 then properprint(">", (width*8*scale)-51*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) else properprint(">", (width*8*scale)+20*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) end end if suspendprompt then - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle("fill", (width*8*scale)-100*scale, (112*scale)-25*scale, 200*scale, 50*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle((width*8)-99, 112-24, 198, 48) properprint("suspend game? this can", (width*8*scale)-string.len("suspend game? this can")*4*scale, (112*scale)-20*scale) properprint("only be loaded once!", (width*8*scale)-string.len("only be loaded once!")*4*scale, (112*scale)-10*scale) if pausemenuselected2 == 1 then properprint(">", (width*8*scale)-51*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) else properprint(">", (width*8*scale)+20*scale, (112*scale)+4*scale) - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("yes", (width*8*scale)-44*scale, (112*scale)+4*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("no", (width*8*scale)+28*scale, (112*scale)+4*scale) end end @@ -2562,13 +2585,13 @@ function drawplayer(i, x, y, cscale, offsetX, offsetY, rotation, quadcenterX if v.colors[k] then love.graphics.setColor(v.colors[k]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end love.graphics.drawq(v.graphic[k], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end else if v.graphic and v.quad then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.drawq(v.graphic, v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end @@ -2584,7 +2607,7 @@ function drawplayer(i, x, y, cscale, offsetX, offsetY, rotation, quadcenterX if v.hats[i] == 1 then love.graphics.setColor(v.colors[1]) else - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end if v.graphic == v.biggraphic or v.animationstate == "grow" then love.graphics.draw(bighat[v.hats[i]].graphic, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX - bighat[v.hats[i]].x + offsets[1], v.quadcenterY - bighat[v.hats[i]].y + offsets[2] + yadd) @@ -2608,7 +2631,7 @@ function drawplayer(i, x, y, cscale, offsetX, offsetY, rotation, quadcenterX if type(v.graphic) == "table" then if v.graphic[0] then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.drawq(v.graphic[0], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot then @@ -3186,7 +3209,7 @@ end function loadmap(filename, createobjects) print("**************************" .. string.rep("*", #(mappack .. filename))) print("* Loading mappacks/" .. mappack .. "/" .. filename .. ".txt *") - if love.filesystem.exists("mappacks/" .. mappack .. "/" .. filename .. ".txt") == false then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. filename .. ".txt") == false then print("mappacks/" .. mappack .. "/" .. filename .. ".txt not found!") return false end @@ -3617,11 +3640,11 @@ function loadmap(filename, createobjects) for i = 3, #s2 do s3 = s2[i]:split(equalsign) if s3[1] == "backgroundr" then - background[1] = tonumber(s3[2]) + background[1] = tonumber(s3[2]) / 255 elseif s3[1] == "backgroundg" then - background[2] = tonumber(s3[2]) + background[2] = tonumber(s3[2]) / 255 elseif s3[1] == "backgroundb" then - background[3] = tonumber(s3[2]) + background[3] = tonumber(s3[2]) / 255 elseif s3[1] == "background" then background = {unpack(backgroundcolor[tonumber(s3[2])])} elseif s3[1] == "spriteset" then @@ -3666,7 +3689,7 @@ function loadmap(filename, createobjects) portalsavailable = {false, true} end elseif s3[1] == "levelscreenback" then - if love.filesystem.exists("mappacks/" .. mappack .. "/levelscreens/" .. s3[2] .. ".png") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/levelscreens/" .. s3[2] .. ".png") then levelscreenbackname = s3[2] levelscreenback = {} levelscreenback = love.graphics.newImage("mappacks/" .. mappack .. "/levelscreens/" .. s3[2] .. ".png") @@ -3742,25 +3765,31 @@ end function generatespritebatch() smbspritebatch:clear() smbspritebatchfront:clear() +--[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then smbspritebatch:bind() smbspritebatchfront:bind() end +]] portalspritebatch:clear() portalspritebatchfront:clear() +--[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then portalspritebatch:bind() portalspritebatchfront:bind() end +]] if customtiles then customspritebatch:clear() customspritebatchfront:clear() + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then customspritebatch:bind() customspritebatchfront:bind() end + ]] end @@ -3821,6 +3850,7 @@ function generatespritebatch() if not tilequads[tilenumber]:getproperty("foreground", cox, coy) then if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then + --[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then if tilenumber <= smbtilecount then smbspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) @@ -3830,17 +3860,19 @@ function generatespritebatch() customspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end else - if tilenumber <= smbtilecount then - smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end + ]] + if tilenumber <= smbtilecount then + smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end + -- end end else if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then + --[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then if tilenumber <= smbtilecount then smbspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) @@ -3850,14 +3882,15 @@ function generatespritebatch() customspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end else - if tilenumber <= smbtilecount then - smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end + ]] + if tilenumber <= smbtilecount then + smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end + -- end end end end @@ -3865,6 +3898,7 @@ function generatespritebatch() end end +--[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW --Unbind spritebatches if loveVersion <= 9 then smbspritebatch:unbind() @@ -3878,6 +3912,7 @@ function generatespritebatch() customspritebatchfront:unbind() end end +]] end function game_keypressed(key) @@ -3957,7 +3992,7 @@ function game_keypressed(key) if pausemenuoptions[pausemenuselected] == "resume" then pausemenuopen = false saveconfig() - love.audio.resume() + love.audio.play() elseif pausemenuoptions[pausemenuselected] == "suspend" then suspendprompt = true pausemenuselected2 = 1 @@ -3971,7 +4006,7 @@ function game_keypressed(key) elseif key == "escape" then pausemenuopen = false saveconfig() - love.audio.resume() + love.audio.play() elseif (key == "right" or key == "d") then if pausemenuoptions[pausemenuselected] == "music volume" then volumemusic = math.min(1, volumemusic + 0.1) @@ -4751,7 +4786,7 @@ function nextlevel() love.audio.stop() mariolevel = mariolevel + 1 - if not love.filesystem.exists("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. ".txt") then + if not love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. ".txt") then mariolevel = 1 marioworld = marioworld + 1 end @@ -4865,9 +4900,9 @@ function savemap(filename) end --options - s = s .. CATEGORYDELIMITER[v] .. "backgroundr" .. EQUALSIGN[v] .. background[1] - s = s .. CATEGORYDELIMITER[v] .. "backgroundg" .. EQUALSIGN[v] .. background[2] - s = s .. CATEGORYDELIMITER[v] .. "backgroundb" .. EQUALSIGN[v] .. background[3] + s = s .. CATEGORYDELIMITER[v] .. "backgroundr" .. EQUALSIGN[v] .. background[1] * 255 + s = s .. CATEGORYDELIMITER[v] .. "backgroundg" .. EQUALSIGN[v] .. background[2] * 255 + s = s .. CATEGORYDELIMITER[v] .. "backgroundb" .. EQUALSIGN[v] .. background[3] * 255 s = s .. CATEGORYDELIMITER[v] .. "spriteset" .. EQUALSIGN[v] .. spriteset if musicname then s = s .. CATEGORYDELIMITER[v] .. "music" .. EQUALSIGN[v] .. musicname @@ -4926,11 +4961,13 @@ function savemap(filename) --preview previewimg = renderpreview() - if loveVersion > 9 then - previewimg:encode("png", "mappacks/" .. mappack .. "/" .. filename .. ".png") +-- if loveVersion > 9 then + previewimg:encode("png", "mappacks/" .. mappack .. "/" .. filename .. ".png") +--[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW else previewimg:encode("mappacks/" .. mappack .. "/" .. filename .. ".png") end +]] print("Map saved as " .. "mappacks/" .. filename .. ".txt") notice.new("Map saved!", notice.white, 2) @@ -5273,7 +5310,7 @@ function playsound(sound) end soundlist[sound].source:stop() - soundlist[sound].source:rewind() + soundlist[sound].source:seek(0) soundlist[sound].source:play() end end diff --git a/groundlight.lua b/groundlight.lua index 974d347..28325ce 100644 --- a/groundlight.lua +++ b/groundlight.lua @@ -49,9 +49,9 @@ end function groundlight:draw() if self.lighted then - love.graphics.setColor(255, 122, 66, 255) + love.graphics.setColor(255 / 255, 122 / 255, 66 / 255, 255 / 255) else - love.graphics.setColor(60, 188, 252, 255) + love.graphics.setColor(60 / 255, 188 / 255, 252 / 255, 255 / 255) end love.graphics.drawq(entityquads[42+self.dir].image, entityquads[42+self.dir].quad, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) diff --git a/gui.lua b/gui.lua index c5668d0..b9a2eaf 100644 --- a/gui.lua +++ b/gui.lua @@ -78,11 +78,11 @@ function guielement:init(...) self.repeatwaittimer = self.repeatwait self.repeatdelaytimer = self.repeatdelay - self.bordercolorhigh = {255, 255, 255} - self.bordercolor = {127, 127, 127} + self.bordercolorhigh = {1, 1, 1} + self.bordercolor = {0.5, 0.5, 0.5} self.fillcolor = {0, 0, 0} - self.textcolor = {255, 255, 255} + self.textcolor = {1, 1, 1} elseif arg[1] == "scrollbar" then --scrollbar(x, y, range, width, height, default, dir, display, min, max, step, mousewheel) self.type = arg[1] @@ -107,9 +107,9 @@ function guielement:init(...) self.xrange = self.range - self.width end - self.backgroundcolor = {127, 127, 127} - self.bordercolorhigh = {255, 255, 255} - self.bordercolor = {127, 127, 127} + self.backgroundcolor = {0.5, 0.5, 0.5} + self.bordercolorhigh = {1, 1, 1} + self.bordercolor = {0.5, 0.5, 0.5} self.fillcolor = {0, 0, 0} elseif arg[1] == "input" then --input(x, y, width, enterfunc, start, maxlength, height, numerical, spacing) @@ -139,17 +139,17 @@ function guielement:init(...) end end - self.bordercolorhigh = {255, 255, 255} - self.bordercolor = {127, 127, 127} + self.bordercolorhigh = {1, 1, 1} + self.bordercolor = {0.5, 0.5, 0.5} self.fillcolor = {0, 0, 0} - self.textcolor = {255, 255, 255} + self.textcolor = {1, 1, 1} elseif arg[1] == "text" then --(x, y, s, color) self.type = arg[1] self.x = arg[2] self.y = arg[3] self.value = arg[4] or "" - self.color = arg[5] or {255, 255, 255} + self.color = arg[5] or {1, 1, 1} elseif arg[1] == "submenu" then self.type = arg[1] self.x = arg[2] @@ -249,7 +249,7 @@ function guielement:draw(a, offx, offy) local drawx = self.x + (offx or 0) local drawy = self.y + (offy or 0) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) if self.type == "checkbox" then local quad = 1 if self.var == true then @@ -269,13 +269,13 @@ function guielement:draw(a, offx, offy) local high = self:inhighlight(mouse.getPosition()) or (self.scrollbar and self.scrollbar.dragging) if self.extended then - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) love.graphics.rectangle("fill", (drawx+2)*scale, (drawy+2)*scale, (13+self.width*8)*scale, (10*(#self.entries+1)+1)*scale) end - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) if high then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end love.graphics.rectangle("fill", drawx*scale, drawy*scale, (3+self.width*8)*scale, 11*scale) @@ -284,9 +284,9 @@ function guielement:draw(a, offx, offy) love.graphics.setColor(0, 0, 0, a) love.graphics.rectangle("fill", (drawx+1)*scale, (drawy+1)*scale, (1+self.width*8)*scale, 9*scale) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) if self.extended then - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) end local s = self.entries[self.var] if self.cutoff then @@ -296,9 +296,9 @@ function guielement:draw(a, offx, offy) properprint(s, (drawx+1)*scale, (drawy+2)*scale) if self.extended then - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) if high then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end love.graphics.rectangle("fill", drawx*scale, (drawy+11)*scale, (13+self.width*8)*scale, (10*#self.entries)*scale) @@ -312,7 +312,7 @@ function guielement:draw(a, offx, offy) if high ~= i then love.graphics.setColor(0, 0, 0, a) love.graphics.rectangle("fill", (drawx+1)*scale, (drawy+1+i*10)*scale, (11+self.width*8)*scale, 9*scale) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) properprint(s, (drawx+1)*scale, (drawy+2+10*i)*scale) else love.graphics.setColor(0, 0, 0, a) @@ -390,7 +390,7 @@ function guielement:draw(a, offx, offy) love.graphics.rectangle("fill", (drawx+1+self.xrange*self.internvalue)*scale, (drawy+1)*scale, (self.width-2)*scale, (self.height-2)*scale) if self.displaynumber then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) properprint(formatscrollnumber(self.value), math.floor((drawx+self.xrange*self.internvalue)*scale), (drawy+1)*scale) end end @@ -457,9 +457,9 @@ function guielement:draw(a, offx, offy) elseif self.type == "submenu" then local high = self:inhighlight(mouse.getPosition()) or (self.scrollbar and self.scrollbar.dragging) - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) if high then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end love.graphics.rectangle("fill", drawx*scale, drawy*scale, (3+self.width*8)*scale, 11*scale) @@ -467,17 +467,17 @@ function guielement:draw(a, offx, offy) love.graphics.setColor(0, 0, 0, a) love.graphics.rectangle("fill", (drawx+1)*scale, (drawy+1)*scale, (1+self.width*8)*scale, 9*scale) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) if self.extended then - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) end properprint(string.sub(self.entries[self.value], 1, self.width), (drawx+1)*scale, (drawy+2)*scale) if self.extended then - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) if high then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end love.graphics.rectangle("fill", (self.subx+9+self.width*8)*scale, (self.suby)*scale, (3+self.width2*8)*scale, (10*#self.entries+1)*scale) @@ -486,7 +486,7 @@ function guielement:draw(a, offx, offy) if high ~= i then love.graphics.setColor(0, 0, 0, a) love.graphics.rectangle("fill", (self.subx+10+self.width*8)*scale, (self.suby+1+(i-1)*10)*scale, (1+self.width2*8)*scale, 9*scale) - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) properprint(string.sub(self.entries[i], 1, self.width2), (self.subx+10+self.width*8)*scale, (self.suby+2+10*(i-1))*scale) else love.graphics.setColor(0, 0, 0, a) @@ -499,13 +499,13 @@ function guielement:draw(a, offx, offy) end end - love.graphics.setColor(127, 127, 127, a) + love.graphics.setColor(0.5, 0.5, 0.5, a) if high then - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end love.graphics.draw(dropdownarrowimg, (drawx+5+self.width*8)*scale, (drawy+5)*scale, -math.pi/2, scale, scale, 6, 6) end - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) end function guielement:getheight() diff --git a/intro.lua b/intro.lua index d72a550..3a5b29a 100644 --- a/intro.lua +++ b/intro.lua @@ -31,7 +31,7 @@ function intro_update(dt) end end -function intro_draw() +function intro_draw() local logoscale = scale if logoscale <= 1 then logoscale = 0.5 @@ -40,14 +40,14 @@ function intro_draw() end if introprogress >= 0 and introprogress < introduration then - local a = 255 + local a = 1 if introprogress < introfadetime then - a = introprogress/introfadetime * 255 + a = introprogress/introfadetime elseif introprogress >= introduration-introfadetime then - a = (1-(introprogress-(introduration-introfadetime))/introfadetime) * 255 + a = (1-(introprogress-(introduration-introfadetime))/introfadetime) end - love.graphics.setColor(255, 255, 255, a) + love.graphics.setColor(1, 1, 1, a) if introprogress > introfadetime+0.3 and introprogress < introduration - introfadetime then local y = (introprogress-0.2-introfadetime) / (introduration-2*introfadetime) * 206 * 5 @@ -62,10 +62,10 @@ function intro_draw() love.graphics.draw(logo, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150) end - local a2 = math.max(0, (1-(introprogress-.5)/0.3)*255) - love.graphics.setColor(150, 150, 150, a2) + local a2 = math.max(0, (1-(introprogress-.5)/0.3)) + love.graphics.setColor(0.6, 0.6, 0.6, a2) properprint("loading mari0 se..", love.graphics.getWidth()/2-string.len("loading mari0 se..")*4*scale, love.graphics.getHeight()/2-170*logoscale-7*scale) - love.graphics.setColor(50, 50, 50, a2) + love.graphics.setColor(0.2, 0.2, 0.2, a2) properprint(loadingtext, love.graphics.getWidth()/2-string.len(loadingtext)*4*scale, love.graphics.getHeight()/2+165*logoscale) end end diff --git a/levelscreen.lua b/levelscreen.lua index 7f1947f..afff3c0 100644 --- a/levelscreen.lua +++ b/levelscreen.lua @@ -25,11 +25,11 @@ function levelscreen_load(reason, i) respawnsublevel = mariosublevel or 0 --check if next level doesn't exist - if mariosublevel > 0 and not love.filesystem.exists("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. "_" .. mariosublevel .. ".txt") then + if mariosublevel > 0 and not love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. "_" .. mariosublevel .. ".txt") then gamestate = "mappackfinished" blacktime = gameovertime music:play("princessmusic.ogg") - elseif not love.filesystem.exists("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. ".txt") then + elseif not love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. marioworld .. "-" .. mariolevel .. ".txt") then gamestate = "mappackfinished" blacktime = gameovertime music:play("princessmusic.ogg") @@ -107,7 +107,7 @@ function levelscreen_draw() --black background love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if levelscreenback then love.graphics.draw(levelscreenback, 0, 0, 0, scale, scale) @@ -137,7 +137,7 @@ function levelscreen_draw() drawplayer(nil, x+6, y+11, scale, v.smalloffsetX, v.smalloffsetY, 0, v.smallquadcenterX, v.smallquadcenterY, "idle", false, false, mariohats[i], v.animations, v.idle[angle], 0, false, false, mariocolors[i], 1, portalcolor[i][1], portalcolor[i][2], nil, nil, nil, nil, nil, nil, characters[mariocharacter[i]]) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if mariolivecount == false then properprint("* inf", (width/2*16)*scale-8*scale, y*scale+7*scale) else diff --git a/lightbridge.lua b/lightbridge.lua index 34aa25b..3ff19d0 100644 --- a/lightbridge.lua +++ b/lightbridge.lua @@ -284,21 +284,21 @@ function lightbridgebody:update(dt) end function lightbridgebody:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local glowa = self.parent:getglowa(self.i) if self.dir == "hor" then love.graphics.draw(lightbridgeimg, math.floor((self.cox-xscroll-1)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, scale, scale) - love.graphics.setColor(255, 255, 255, glowa*255) + love.graphics.setColor(1, 1, 1, glowa) love.graphics.draw(lightbridgeglowimg, math.floor((self.cox-xscroll-1)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, scale, scale) else love.graphics.draw(lightbridgeimg, math.floor((self.cox-xscroll-1/16)*16*scale), (self.coy-yscroll-1)*16*scale, math.pi/2, scale, scale, 8, 1) - love.graphics.setColor(255, 255, 255, glowa*255) + love.graphics.setColor(1, 1, 1, glowa) love.graphics.draw(lightbridgeglowimg, math.floor((self.cox-xscroll-1/16)*16*scale), (self.coy-yscroll-1)*16*scale, math.pi/2, scale, scale, 8, 1) end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --gel for i = 1, 4 do diff --git a/lobby.lua b/lobby.lua index 95d6bdd..cf69308 100644 --- a/lobby.lua +++ b/lobby.lua @@ -36,10 +36,10 @@ end function lobby_draw() --STUFF - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 3*scale, 3*scale, 233*scale, 104*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if usemagic and adjective and noun then properprintbackground("magicdns: " .. adjective .. " " .. noun, 4*scale, 98*scale, true) end @@ -53,7 +53,7 @@ function lobby_draw() local missingpixels = math.max(0, (players*41-3)-104) - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 239*scale, 3*scale, 150*scale, 104*scale) love.graphics.translate(0, -missingpixels*guielements.playerscroll.value*scale) @@ -76,9 +76,9 @@ function lobby_draw() love.graphics.setScissor() --chat - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 3*scale, 110*scale, 394*scale, 111*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle(4, 111, 392, 109) guielements.chatentry:draw() @@ -99,7 +99,7 @@ function lobby_draw() if pid ~= 0 then local nick = playerlist[pid].nick - local background = {255, 255, 255} + local background = {1, 1, 1} local adds = 0 for i = 1, 3 do @@ -113,7 +113,7 @@ function lobby_draw() love.graphics.setColor(unpack(playerlist[pid].colors[1])) properprintbackground(nick, 8*scale, (196-(height*10))*scale, true, background) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint(":" .. chatmessages[i].message, (8+(string.len(nick))*8)*scale, (196-(height*10))*scale) height = height + 1 end diff --git a/magic.lua b/magic.lua index d87c852..a4eee80 100644 --- a/magic.lua +++ b/magic.lua @@ -5,7 +5,7 @@ function magic:init() self.t = 0 self.x = math.floor(7+math.random()*188)*scale self.y = math.floor(88+math.random()*12)*scale - self.color = {202+(math.random()-.7)*50, 170+(math.random()-.7)*50, 209+(math.random()-.7)*50} + self.color = {202/255+(math.random()-.7)*0.2, 170/255+(math.random()-.7)*0.2, 209/255+(math.random()-.7)*0.2} end function magic:update(dt) diff --git a/main.lua b/main.lua index 0d49e0f..dde0145 100644 --- a/main.lua +++ b/main.lua @@ -24,7 +24,21 @@ ]] function love.run() - if love._version_minor < 9 then + --I can't believe I had to write this function in the first place + local function updateVersion() + local major, minor, revision, codename = love.getVersion() + if major > 0 then + return major + else + return minor + end + end + + loveVersion = updateVersion() + +--[[ COMPATABILITY FOR LOVE2D 0.8.X + + if loveVersion < 9 then --Cheap af but I don't care, COMPATIBILITY!!! love.math = {} love.math.setRandomSeed = math.randomseed @@ -59,16 +73,18 @@ function love.run() love.mouse.setGrabbed = love.mouse.setGrab end +]] + love.math.setRandomSeed(os.time()) for i=1, 2 do love.math.random() end - love.load(arg) + love.load(arg) - -- Main loop time. - while true do - -- Process events. + -- Main loop time. + while true do + -- Process events. love.event.pump() for e,a,b,c,d in love.event.poll() do if e == "quit" then @@ -90,18 +106,20 @@ function love.run() love.graphics.origin() --Fullscreen hack if not mkstation and fullscreen and gamestate ~= "intro" then + --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then completecanvas:clear() else - love.graphics.setCanvas(completecanvas) - love.graphics.clear() - end + ]] + love.graphics.setCanvas(completecanvas) + love.graphics.clear() + -- end love.graphics.setScissor() completecanvas:renderTo(love.draw) love.graphics.setScissor() - if loveVersion > 9 then + -- if loveVersion > 9 then love.graphics.setCanvas() - end + -- end if fullscreenmode == "full" then love.graphics.draw(completecanvas, 0, 0, 0, desktopsize.width/(width*16*scale), desktopsize.height/(height*16*scale)) else @@ -109,7 +127,7 @@ function love.run() love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", 0, 0, desktopsize.width, touchfrominsidemissing/2) love.graphics.rectangle("fill", 0, desktopsize.height-touchfrominsidemissing/2, desktopsize.width, touchfrominsidemissing/2) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end else love.graphics.setScissor() @@ -118,7 +136,7 @@ function love.run() love.graphics.present() love.timer.sleep(0.001) - end + end end function love.errhand(msg) @@ -156,7 +174,7 @@ function love.errhand(msg) return end - if not love.graphics.isCreated() or not love.window.isCreated() then + if not love.graphics.isCreated() or not love.window.isOpen() then local success, status = pcall(love.window.setMode, 800, 600) if not success or not status then return @@ -177,10 +195,10 @@ function love.errhand(msg) end if love.audio then love.audio.stop() end love.graphics.reset() - love.graphics.setBackgroundColor(89, 157, 220) + love.graphics.setBackgroundColor(89 / 255, 157 / 255, 220 / 255) local font = love.graphics.setNewFont(scale*7) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.origin() --love.graphics.clear() @@ -192,14 +210,14 @@ function love.errhand(msg) local function draw() --love.graphics.clear() - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.6) love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()) love.graphics.setColor(0, 0, 0) love.graphics.printf(p, 35*scale, 15*scale-1, love.graphics.getWidth() - 35*scale) love.graphics.printf(p, 35*scale+1, 15*scale, love.graphics.getWidth() - 35*scale) love.graphics.printf(p, 35*scale-1, 15*scale, love.graphics.getWidth() - 35*scale) love.graphics.printf(p, 35*scale, 15*scale+1, love.graphics.getWidth() - 35*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(p, 35*scale, 15*scale, love.graphics.getWidth() - 35*scale) love.graphics.present() end @@ -236,21 +254,12 @@ end function love.load(arg) marioversion = 1107 versionstring = "version 1.0se" - - --version check by checking for a const that was added in 0.8.0 --todo: change to 0.9.0 - if love._version_major == nil or (love._version_minor and love._version_minor < 9) then - --versionerror = true - --error("You have an outdated version of Love! Get 0.9.0 and retry.") - - --HOW ABOUT NO - --Leave backwards compatibility with Hugo! - end math.mod = math.fmod math.random = love.math.random --blame slime - if love._version_minor >= 9 then + if loveVersion >= 9 then love.graphics.drawq = love.graphics.draw end @@ -303,7 +312,7 @@ function love.load(arg) --=================-- -- VERSION CONTROL -- --=================-- - loveVersion = love._version_minor + if loveVersion > 9 then lkisDown = love.keyboard.isDown lmisDown = love.mouse.isDown @@ -319,11 +328,12 @@ function love.load(arg) end end - iconimg = love.image.newImageData("graphics/icon.png") +--[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then iconimg = love.graphics.newImage("graphics/icon.png") end +]] love.window.setIcon(iconimg) love.graphics.setDefaultFilter("nearest", "nearest") @@ -395,7 +405,7 @@ function love.load(arg) end love.graphics.clear() - love.graphics.setColor(100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4) loadingtexts = {"reticulating splines", "rendering important stuff", "01110000011011110110111001111001", "sometimes, i dream about cheese", "baking cake", "happy explosion day", "raising coolness by a fifth", "yay facepunch", "stabbing myself", "sharpening knives", "tanaka, thai kick", "slime will find you", "becoming self-aware", "it's a secret to everybody", "there is no minus world", @@ -421,12 +431,12 @@ function love.load(arg) logoscale = 1 end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(logo, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, logoscale, logoscale, 142, 150) - love.graphics.setColor(150, 150, 150) + love.graphics.setColor(0.6, 0.6, 0.6) properprint("loading mari0 se..", love.graphics.getWidth()/2-string.len("loading mari0 se..")*4*scale, love.graphics.getHeight()/2-170*logoscale-7*scale) - love.graphics.setColor(50, 50, 50) + love.graphics.setColor(0.2, 0.2, 0.2) properprint(loadingtext, love.graphics.getWidth()/2-string.len(loadingtext)*4*scale, love.graphics.getHeight()/2+165*logoscale) love.graphics.present() @@ -576,15 +586,15 @@ function love.load(arg) --Backgroundcolors backgroundcolor = { - {92, 148, 252}, - {0, 0, 0}, - {32, 56, 236}, - {158, 219, 248}, - {210, 159, 229}, - {237, 241, 243}, - {244, 178, 92}, - {253, 246, 175}, - {249, 183, 206}, + {92 / 255, 148 / 255, 252 / 255}, + {0 / 255, 0 / 255, 0 / 255}, + {32 / 255, 56 / 255, 236 / 255}, + {158 / 255, 219 / 255, 248 / 255}, + {210 / 255, 159 / 255, 229 / 255}, + {237 / 255, 241 / 255, 243 / 255}, + {244 / 255, 178 / 255, 92 / 255}, + {253 / 255, 246 / 255, 175 / 255}, + {249 / 255, 183 / 255, 206 / 255}, } add("Update Check, variables") @@ -939,6 +949,13 @@ function love.load(arg) soundlist[v] = {} soundlist[v].source = love.audio.newSource("sounds/" .. v .. ".ogg", "stream") soundlist[v].lastplayed = 0 + --[[ COMPATABILITY FOR LOVE2D 0.8.X + if loveVersion < 9 then + soundlist[v].isPlaying = function (self) + return not self:isStopped() + end + end + ]] end soundlist["scorering"].source:setLooping(true) @@ -1077,7 +1094,7 @@ function love.draw() shaders:postdraw() - love.graphics.setColor(255, 255,255) + love.graphics.setColor(1, 1, 1) if recording then screenshotimagedata = love.graphics.newScreenshot( ) @@ -1123,7 +1140,7 @@ function saveconfig() if #mariocolors[i] > 0 then for j = 1, #mariocolors[i] do --colorsets (dynamic) for k = 1, 3 do --R, G or B values - s = s .. mariocolors[i][j][k] + s = s .. mariocolors[i][j][k] * 255 if j == #mariocolors[i] and k == 3 then s = s .. ";" else @@ -1213,7 +1230,7 @@ function loadconfig() players = 1 defaultconfig() - if not love.filesystem.exists("options.txt") then + if not love.filesystem.getInfo("options.txt") then return end @@ -1248,7 +1265,7 @@ function loadconfig() s3 = s2[3]:split(",") mariocolors[tonumber(s2[2])] = {} for i = 1, #s3/3 do - mariocolors[tonumber(s2[2])][i] = {tonumber(s3[1+(i-1)*3]), tonumber(s3[2+(i-1)*3]), tonumber(s3[3+(i-1)*3])} + mariocolors[tonumber(s2[2])][i] = {tonumber(s3[1+(i-1)*3]) / 255, tonumber(s3[2+(i-1)*3]) / 255, tonumber(s3[3+(i-1)*3]) / 255} end elseif s2[1] == "portalhues" then if portalhues[tonumber(s2[2])] == nil then @@ -1294,7 +1311,7 @@ function loadconfig() elseif s2[1] == "mouseowner" then mouseowner = tonumber(s2[2]) elseif s2[1] == "mappack" then - if love.filesystem.exists("mappacks/" .. s2[2] .. "/settings.txt") then + if love.filesystem.getInfo("mappacks/" .. s2[2] .. "/settings.txt") then mappack = s2[2] end elseif s2[1] == "gamefinished" then @@ -1396,22 +1413,22 @@ function defaultconfig() --3: skin (yellow-orange) mariocolors = {} - mariocolors[1] = {{224, 32, 0}, {136, 112, 0}, {252, 152, 56}} - mariocolors[2] = {{255, 255, 255}, { 0, 160, 0}, {252, 152, 56}} - mariocolors[3] = {{ 0, 0, 0}, {200, 76, 12}, {252, 188, 176}} - mariocolors[4] = {{ 32, 56, 236}, { 0, 128, 136}, {252, 152, 56}} + mariocolors[1] = {{224 / 255, 32 / 255, 0 / 255}, {136 / 255, 112 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}} + mariocolors[2] = {{255 / 255, 255 / 255, 255 / 255}, { 0 / 255, 160 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}} + mariocolors[3] = {{ 0 / 255, 0 / 255, 0 / 255}, {200 / 255, 76 / 255, 12 / 255}, {252 / 255, 188 / 255, 176 / 255}} + mariocolors[4] = {{ 32 / 255, 56 / 255, 236 / 255}, { 0 / 255, 128 / 255, 136 / 255}, {252 / 255, 152 / 255, 56 / 255}} for i = 5, players do mariocolors[i] = mariocolors[math.random(4)] end --STARCOLORS starcolors = {} - starcolors[1] = {{ 0, 0, 0}, {200, 76, 12}, {252, 188, 176}} - starcolors[2] = {{ 0, 168, 0}, {252, 152, 56}, {252, 252, 252}} - starcolors[3] = {{252, 216, 168}, {216, 40, 0}, {252, 152, 56}} - starcolors[4] = {{216, 40, 0}, {252, 152, 56}, {252, 252, 252}} + starcolors[1] = {{ 0 / 255, 0 / 255, 0 / 255}, {200 / 255, 76 / 255, 12 / 255}, {252 / 255, 188 / 255, 176 / 255}} + starcolors[2] = {{ 0 / 255, 168 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}, {252 / 255, 252 / 255, 252 / 255}} + starcolors[3] = {{252 / 255, 216 / 255, 168 / 255}, {216 / 255, 40 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}} + starcolors[4] = {{216 / 255, 40 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}, {252 / 255, 252 / 255, 252 / 255}} - flowercolor = {{252, 216, 168}, {216, 40, 0}, {252, 152, 56}} + flowercolor = {{252 / 255, 216 / 255, 168 / 255}, {216 / 255, 40 / 255, 0 / 255}, {252 / 255, 152 / 255, 56 / 255}} --CHARACTERS mariocharacter = {"mario", "mario", "mario", "mario"} @@ -1443,7 +1460,7 @@ function loadcustomimages(path) local fl = love.filesystem.getDirectoryItems(path) for i = 1, #fl do local v = fl[i] - if love.filesystem.isFile(path .. "/" .. v) then + if love.filesystem.getInfo(path .. "/" .. v) and love.filesystem.getInfo(path .. "/" .. v).type == "file" then local s = string.sub(v, 1, -5) if tablecontains(imagelist, s) then _G[s .. "img"] = love.graphics.newImage(path .. "/" .. v) @@ -1461,7 +1478,7 @@ function loadcustomimages(path) local width = math.floor(imgwidth/17) local height = math.floor(imgheight/17) local imgdata - if love.filesystem.isFile(path .. "/smbtiles.png") then + if love.filesystem.getInfo(path .. "/smbtiles.png") then imgdata = love.image.newImageData(path .. "/smbtiles.png") else imgdata = love.image.newImageData("graphics/DEFAULT/smbtiles.png") @@ -1481,7 +1498,7 @@ function loadcustomimages(path) local width = math.floor(imgwidth/17) local height = math.floor(imgheight/17) local imgdata - if love.filesystem.isFile(path .. "/portaltiles.png") then + if love.filesystem.getInfo(path .. "/portaltiles.png") then imgdata = love.image.newImageData(path .. "/portaltiles.png") else imgdata = love.image.newImageData("graphics/DEFAULT/portaltiles.png") @@ -1527,7 +1544,7 @@ function suspendgame() end function continuegame() - if not love.filesystem.exists("suspend.txt") then + if not love.filesystem.getInfo("suspend.txt") then return end @@ -1604,11 +1621,12 @@ function changescale(s, init) uispace = math.floor(width*16*scale/4) love.window.setMode(width*16*scale, height*16*scale, {fullscreen=fullscreen, vsync=vsync--[[, fsaa=fsaa]]}) --25x14 blocks (15 blocks actual height) end - - if loveVersion > 9 or love.graphics.isSupported("canvas") then - completecanvas = love.graphics.newCanvas() - completecanvas:setFilter("linear", "linear") - end + +-- COMPATABILITY FOR LOVE2D 0.8.X +-- if loveVersion > 9 or love.graphics.isSupported("canvas") then + completecanvas = love.graphics.newCanvas() + completecanvas:setFilter("linear", "linear") +-- end gamewidth, gameheight = love.window.getMode() if shaders then @@ -1828,7 +1846,7 @@ function round(num, idp) --Not by me end function getrainbowcolor(i) - local whiteness = 255 + local whiteness = 1 local r, g, b if i < 1/6 then r = 1 @@ -1856,7 +1874,7 @@ function getrainbowcolor(i) b = (1/6-(i-5/6))*6 end - return {round(r*whiteness), round(g*whiteness), round(b*whiteness), 255} + return {round(r*whiteness), round(g*whiteness), round(b*whiteness), 1} end function newRecoloredImage(path, tablein, tableout) @@ -1867,7 +1885,7 @@ function newRecoloredImage(path, tablein, tableout) for x = 0, width-1 do local oldr, oldg, oldb, olda = imagedata:getPixel(x, y) - if olda > 128 then + if olda > 0.5 then for i = 1, #tablein do if oldr == tablein[i][1] and oldg == tablein[i][2] and oldb == tablein[i][3] then local r, g, b = unpack(tableout[i]) @@ -1914,7 +1932,7 @@ function getaveragecolor(imgdata, cox, coy) for x = xstart, xstart+15 do for y = ystart, ystart+15 do local pr, pg, pb, a = imgdata:getPixel(x, y) - if a > 127 then + if a > 0.5 then r, g, b = r+pr, g+pg, b+pb count = count + 1 end @@ -2075,7 +2093,7 @@ function loadcustombackgrounds() for i = 1, #fl do local v = "mappacks/" .. mappack .. "/backgrounds/" .. fl[i] - if love.filesystem.isFile(v) and v ~= ".DS_STORE" and v ~= ".DS_S" then + if love.filesystem.getInfo(v).type == "file" and v ~= ".DS_STORE" and v ~= ".DS_S" then if string.sub(v, -5, -5) == "1" then local name = string.sub(fl[i], 1, -6) local bg = string.sub(v, 1, -6) @@ -2085,7 +2103,7 @@ function loadcustombackgrounds() custombackgroundwidth[name] = {} custombackgroundheight[name] = {} - while love.filesystem.exists(bg .. i .. ".png") do + while love.filesystem.getInfo(bg .. i .. ".png") do custombackgroundimg[name][i] = love.graphics.newImage(bg .. i .. ".png") custombackgroundwidth[name][i] = custombackgroundimg[name][i]:getWidth()/16 custombackgroundheight[name][i] = custombackgroundimg[name][i]:getHeight()/16 @@ -2113,7 +2131,7 @@ function loadlevelscreens() for i = 1, #fl do local v = "mappacks/" .. mappack .. "/levelscreens/" .. fl[i] - if love.filesystem.isFile(v) then + if love.filesystem.getInfo(v).type == "file" then table.insert(levelscreens, string.lower(string.sub(fl[i], 1, -5))) end end @@ -2141,13 +2159,11 @@ function loadanimatedtiles() end local function loadfolder(folder) - local fl = love.filesystem.getDirectoryItems(folder) - local i = 1 - while love.filesystem.isFile(folder .. "/" .. i .. ".png") do + while love.filesystem.getInfo(folder .. "/" .. i .. ".png") do local v = folder .. "/" .. i .. ".png" - if love.filesystem.isFile(v) and string.sub(v, -4) == ".png" then - if love.filesystem.isFile(string.sub(v, 1, -5) .. ".txt") then + if love.filesystem.getInfo(v).type == "file" and string.sub(v, -4) == ".png" then + if love.filesystem.getInfo(string.sub(v, 1, -5) .. ".txt") and love.filesystem.getInfo(string.sub(v, 1, -5) .. ".txt").type == "file" then animatedtilecount = animatedtilecount + 1 local number = animatedtilecount+10000 local t = animatedquad:new(v, love.filesystem.read(string.sub(v, 1, -5) .. ".txt"), number) @@ -2166,7 +2182,7 @@ function loadanimatedtiles() end function loadcustomtiles() - if love.filesystem.exists("mappacks/" .. mappack .. "/tiles.png") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/tiles.png") then customtiles = true customtilesimg = love.graphics.newImage("mappacks/" .. mappack .. "/tiles.png") local imgwidth, imgheight = customtilesimg:getWidth(), customtilesimg:getHeight() diff --git a/mario.lua b/mario.lua index 3b266fc..ab35499 100644 --- a/mario.lua +++ b/mario.lua @@ -106,8 +106,8 @@ function mario:init(x, y, i, animation, size, t) self.customscissor = false if players == 1 and not arcade then - self.portal1color = {60, 188, 252} - self.portal2color = {232, 130, 30} + self.portal1color = {60 / 255, 188 / 255, 252 / 255} + self.portal2color = {232 / 255, 130 / 255, 30 / 255} else self.portal1color = portalcolor[self.playernumber][1] self.portal2color = portalcolor[self.playernumber][2] @@ -1092,7 +1092,7 @@ function mario:update(dt) end end - if not self.raccoonjump and self.raccoontimer == 0 and not soundlist["planemode"].source:isStopped() then + if not self.raccoonjump and self.raccoontimer == 0 and soundlist["planemode"].source:isPlaying() then soundlist["planemode"].source:stop() end @@ -3489,7 +3489,7 @@ end function mario:savereplaydata() local i = 1 - while love.filesystem.exists("replay" .. i .. ".txt") do + while love.filesystem.getInfo("replay" .. i .. ".txt") do i = i + 1 end diff --git a/menu.lua b/menu.lua index b66918d..81c475b 100644 --- a/menu.lua +++ b/menu.lua @@ -10,7 +10,7 @@ function menu_load() selection = 1 coinanimation = 1 - love.graphics.setBackgroundColor(92, 148, 252) + love.graphics.setBackgroundColor(92 / 255, 148 / 255, 252 / 255) scrollsmoothrate = 4 optionstab = 2 optionsselection = 1 @@ -35,7 +35,7 @@ function menu_load() infmarioYspeed = 200 infmarioRspeed = 4 - RGBchangespeed = 200 + RGBchangespeed = 0.8 huechangespeed = 0.5 spriteset = 1 @@ -45,7 +45,7 @@ function menu_load() end continueavailable = false - if love.filesystem.exists("suspend.txt") then + if love.filesystem.getInfo("suspend.txt") then continueavailable = true end @@ -149,10 +149,10 @@ function menu_update(dt) if characters[mariocharacter[skinningplayer]].colorables and optionsselection > 5 and optionsselection < 9 then local colorRGB = optionsselection-5 - if (love.keyboard.isDown("right") or love.keyboard.isDown("d")) and mariocolors[skinningplayer][colorsetedit][colorRGB] < 255 then + if (love.keyboard.isDown("right") or love.keyboard.isDown("d")) and mariocolors[skinningplayer][colorsetedit][colorRGB] < 1 then mariocolors[skinningplayer][colorsetedit][colorRGB] = mariocolors[skinningplayer][colorsetedit][colorRGB] + RGBchangespeed*dt - if mariocolors[skinningplayer][colorsetedit][colorRGB] > 255 then - mariocolors[skinningplayer][colorsetedit][colorRGB] = 255 + if mariocolors[skinningplayer][colorsetedit][colorRGB] > 1 then + mariocolors[skinningplayer][colorsetedit][colorRGB] = 1 end elseif (love.keyboard.isDown("left") or love.keyboard.isDown("a")) and mariocolors[skinningplayer][colorsetedit][colorRGB] > 0 then mariocolors[skinningplayer][colorsetedit][colorRGB] = mariocolors[skinningplayer][colorsetedit][colorRGB] - RGBchangespeed*dt @@ -222,22 +222,22 @@ function menu_draw() local portalcolor1, portalcolor2 = portalcolor[j][1], portalcolor[j][2] if players == 1 then - portalcolor1, portalcolor2 = {60, 188, 252}, {232, 130, 30} + portalcolor1, portalcolor2 = {60 / 255, 188 / 255, 252 / 255}, {232 / 255, 130 / 255, 30 / 255} end drawplayer(nil, ((startx[pid]-xscroll)*16)+8*(j-1), ((starty[pid]-yscroll)*16-12), scale, v.smalloffsetX, v.smalloffsetY, 0, v.smallquadcenterX, v.smallquadcenterY, "idle", false, false, mariohats[j], v.animations, v.idle[angle], 0, false, false, mariocolors[j], 1, portalcolor1, portalcolor2, nil, nil, nil, nil, nil, nil, characters[mariocharacter[j]]) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawforeground() if gamestate == "menu" then love.graphics.draw(titleimg, 40*scale, 24*scale, 0, scale, scale) if updatenotification then - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) properprint("version outdated!|go to stabyourself.net|to download latest", 220*scale, 90*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end if selection == 0 then @@ -293,16 +293,16 @@ function menu_draw() if selectworldopen then love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", 30*scale, 92*scale, 200*scale, 60*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) drawrectangle(31, 93, 198, 58) properprint("select world", 83*scale, 105*scale) for i = 1, 8 do if selectworldcursor == i then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) elseif reachedworlds[mappack][i] then - love.graphics.setColor(200, 200, 200) + love.graphics.setColor(0.8, 0.8, 0.8) elseif selectworldexists[i] then - love.graphics.setColor(50, 50, 50) + love.graphics.setColor(0.2, 0.2, 0.2) else love.graphics.setColor(0, 0, 0) end @@ -316,17 +316,17 @@ function menu_draw() elseif gamestate == "mappackmenu" then --background - love.graphics.setColor(0, 0, 0, 100) + love.graphics.setColor(0, 0, 0, 0.4) love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) --set scissor love.graphics.setScissor(21*scale, 16*scale, 218*scale, 200*scale) if loadingonlinemappacks then - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("a little patience..|downloading " .. currentdownload .. " of " .. downloadcount, 50*scale, 30*scale) drawrectangle(50, 55, 152, 10) love.graphics.rectangle("fill", 50*scale, 55*scale, 152*((currentfiledownload-1)/(filecount-1))*scale, 10*scale) @@ -339,9 +339,9 @@ function menu_draw() love.graphics.translate(0, -round(mappackscrollsmooth*60*scale)) love.graphics.setScissor(240*scale, 16*scale, 200*scale, 200*scale) - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 240*scale, 81*scale, 115*scale, 61*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if not savefolderfailed then properprint("press right to|access the dlc||press m to|open your|mappack folder", 241*scale, 83*scale) else @@ -364,17 +364,17 @@ function menu_draw() love.graphics.draw(mappackoverlay, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale) --name - love.graphics.setColor(200, 200, 200) + love.graphics.setColor(0.8, 0.8, 0.8) if mappackselection == i then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end properprint(string.sub(mappackname[i]:lower(), 1, 17), 83*scale, (26+(i-1)*60)*scale) --author - love.graphics.setColor(100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4) if mappackselection == i then - love.graphics.setColor(100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4) end if mappackauthor[i] then @@ -382,9 +382,9 @@ function menu_draw() end --description - love.graphics.setColor(130, 130, 130) + love.graphics.setColor(0.5, 0.5, 0.5) if mappackselection == i then - love.graphics.setColor(180, 180, 180) + love.graphics.setColor(0.7, 0.7, 0.7) end if mappackdescription[i] then @@ -399,7 +399,7 @@ function menu_draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --highlight if i == mappackselection then @@ -428,18 +428,18 @@ function menu_draw() end love.graphics.setScissor() - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 241*scale, 16*scale, 150*scale, 200*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint("wanna contribute?|make a mappack and|send an email to|mappack at|stabyourself.net!||include your map-|pack! you can find|it in your appdata|love/mari0 dir.", 244*scale, 19*scale) if outdated then - love.graphics.setColor(255, 0, 0, 255) + love.graphics.setColor(1, 0, 0, 1) properprint("version outdated!|you have an old|version of mari0!|mappacks could not|be downloaded.|go to|stabyourself.net|to download latest", 244*scale, 130*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) elseif downloaderror then - love.graphics.setColor(255, 0, 0, 255) + love.graphics.setColor(1, 0, 0, 1) properprint("download error!|something went|wrong while|downloading|mappacks.|press left and|right to try|again. sorry.", 244*scale, 130*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end love.graphics.setScissor(21*scale, 16*scale, 218*scale, 200*scale) @@ -459,17 +459,17 @@ function menu_draw() love.graphics.draw(mappackoverlay, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale) --name - love.graphics.setColor(200, 200, 200) + love.graphics.setColor(0.8, 0.8, 0.8) if onlinemappackselection == i then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end properprint(string.sub(onlinemappackname[i]:lower(), 1, 17), 83*scale, (26+(i-1)*60)*scale) --author - love.graphics.setColor(100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4) if onlinemappackselection == i then - love.graphics.setColor(100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4) end if onlinemappackauthor[i] then @@ -477,9 +477,9 @@ function menu_draw() end --description - love.graphics.setColor(130, 130, 130) + love.graphics.setColor(0.5, 0.5, 0.5) if onlinemappackselection == i then - love.graphics.setColor(180, 180, 180) + love.graphics.setColor(0.7, 0.7, 0.7) end if onlinemappackdescription[i] then @@ -494,7 +494,7 @@ function menu_draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) --highlight if i == onlinemappackselection then @@ -515,99 +515,99 @@ function menu_draw() love.graphics.setScissor() if mappackhorscroll == 0 then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.rectangle("fill", 22*scale, 3*scale, 44*scale, 13*scale) love.graphics.setColor(0, 0, 0) properprint("local", 23*scale, 6*scale) drawrectangle(22, 3, 44, 13) love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", 70*scale, 3*scale, 29*scale, 13*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("dlc", 72*scale, 6*scale) else love.graphics.setColor(0, 0, 0) love.graphics.rectangle("fill", 22*scale, 3*scale, 44*scale, 13*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("local", 23*scale, 6*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.rectangle("fill", 70*scale, 3*scale, 29*scale, 13*scale) love.graphics.setColor(0, 0, 0) properprint("dlc", 72*scale, 6*scale) drawrectangle(70, 3, 29, 13) end elseif gamestate == "options" then - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale) --Controls tab head if optionstab == 1 then - love.graphics.setColor(100, 100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4, 0.4) love.graphics.rectangle("fill", 25*scale, 20*scale, 67*scale, 11*scale) end if optionstab == 1 and optionsselection == 1 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("controls", 26*scale, 22*scale) --Skins tab head if optionstab == 2 then - love.graphics.setColor(100, 100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4, 0.4) love.graphics.rectangle("fill", 96*scale, 20*scale, 43*scale, 11*scale) end if optionstab == 2 and optionsselection == 1 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("skins", 97*scale, 22*scale) --Miscellaneous tab head if optionstab == 3 then - love.graphics.setColor(100, 100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4, 0.4) love.graphics.rectangle("fill", 145*scale, 20*scale, 39*scale, 11*scale) end if optionstab == 3 and optionsselection == 1 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("misc.", 146*scale, 22*scale) --Cheat tab head if optionstab == 4 then - love.graphics.setColor(100, 100, 100, 100) + love.graphics.setColor(0.4, 0.4, 0.4, 0.4) love.graphics.rectangle("fill", 190*scale, 20*scale, 43*scale, 11*scale) end if optionstab == 4 and optionsselection == 1 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("cheat", 191*scale, 22*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if optionstab == 1 then --CONTROLS if optionsselection == 2 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("edit player:" .. skinningplayer, 74*scale, 40*scale) if optionsselection == 3 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end if mouseowner == skinningplayer then @@ -619,9 +619,9 @@ function menu_draw() for i = 1, #controlstable do if mouseowner ~= skinningplayer or i <= 8 then if optionsselection == 3+i then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint(controlstable[i], 30*scale, (70+(i-1)*12)*scale) @@ -641,9 +641,9 @@ function menu_draw() end if keyprompt then - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle("fill", 30*scale, 100*scale, 200*scale, 60*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle(30, 100, 200, 60) if controlstable[optionsselection-3] == "aimx" then properprint("move stick right", 40*scale, 110*scale) @@ -655,11 +655,11 @@ function menu_draw() properprint("press \"esc\" to cancel", 40*scale, 140*scale) if buttonerror then - love.graphics.setColor(200, 0, 0) + love.graphics.setColor(0.8, 0, 0) properprint("you can only set", 40*scale, 120*scale) properprint("buttons for this", 40*scale, 130*scale) elseif axiserror then - love.graphics.setColor(200, 0, 0) + love.graphics.setColor(0.8, 0, 0) properprint("you can only set", 40*scale, 120*scale) properprint("axes for this", 40*scale, 130*scale) end @@ -667,9 +667,9 @@ function menu_draw() elseif optionstab == 2 then --SKINS if optionsselection == 2 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("edit player:" .. skinningplayer, 74*scale, 32*scale) @@ -698,7 +698,7 @@ function menu_draw() local portalframe = portalanimation - love.graphics.setColor(255, 255, 255, 80 - math.abs(portalframe-3)*10) + love.graphics.setColor(1, 1, 1, (80 - math.abs(portalframe-3)*10)/255) love.graphics.draw(portalglowimg, 174*scale, 59*scale, math.pi, scale, scale) love.graphics.draw(portalglowimg, 142*scale, 57*scale, 0, scale, scale) @@ -711,9 +711,9 @@ function menu_draw() --Character change if optionsselection == 3 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("{", 65*scale, 54*scale) @@ -722,9 +722,9 @@ function menu_draw() --HAT if optionsselection == 4 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end if mariohats[skinningplayer][1] == 0 then properprint("hat: none", (83)*scale, 90*scale) @@ -734,9 +734,9 @@ function menu_draw() if v.colorables then if optionsselection == 5 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end --NEW SKIN CUSTOMIZATION @@ -744,68 +744,68 @@ function menu_draw() properprint("{ " .. v.colorables[colorsetedit] .. " }", 120*scale-string.len("{ " .. v.colorables[colorsetedit] .. " }")*4*scale, 105*scale) if optionsselection > 5 and optionsselection < 9 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.rectangle("fill", 39*scale, 114*scale + (optionsselection-6)*10*scale, 142*scale, 10*scale) end - love.graphics.setColor(100, 0, 0) + love.graphics.setColor(0.4, 0, 0) properprint("r", 40*scale, (116)*scale) - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) properprint("r", 39*scale, (115)*scale) - love.graphics.setColor(0, 100, 0) + love.graphics.setColor(0, 0.4, 0) properprint("g", 40*scale, (126)*scale) - love.graphics.setColor(0, 255, 0) + love.graphics.setColor(0, 1, 0) properprint("g", 39*scale, (125)*scale) - love.graphics.setColor(0, 0, 100) + love.graphics.setColor(0, 0, 0.4) properprint("b", 40*scale, (136)*scale) - love.graphics.setColor(0, 0, 255) + love.graphics.setColor(0, 0, 1) properprint("b", 39*scale, (135)*scale) - love.graphics.setColor(100, 0, 0) - love.graphics.rectangle("fill", 51*scale, (116)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][1]/255)), 7*scale) - love.graphics.setColor(255, 0, 0) - love.graphics.rectangle("fill", 50*scale, (115)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][1]/255)), 7*scale) + love.graphics.setColor(0.4, 0, 0) + love.graphics.rectangle("fill", 51*scale, (116)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][1]), 7*scale) + love.graphics.setColor(1, 0, 0) + love.graphics.rectangle("fill", 50*scale, (115)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][1]), 7*scale) - love.graphics.setColor(100, 100, 100) - local s = math.floor(mariocolors[skinningplayer][colorsetedit][1]) + love.graphics.setColor(0.4, 0.4, 0.4) + local s = math.floor(mariocolors[skinningplayer][colorsetedit][1] * 255) properprint(s, 200*scale-string.len(s)*4*scale, 116*scale) - love.graphics.setColor(0, 100, 0) - love.graphics.rectangle("fill", 51*scale, (126)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][2]/255)), 7*scale) - love.graphics.setColor(0, 255, 0) - love.graphics.rectangle("fill", 50*scale, (125)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][2]/255)), 7*scale) + love.graphics.setColor(0, 0.4, 0) + love.graphics.rectangle("fill", 51*scale, (126)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][2]), 7*scale) + love.graphics.setColor(0, 1, 0) + love.graphics.rectangle("fill", 50*scale, (125)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][2]), 7*scale) - love.graphics.setColor(100, 100, 100) - local s = math.floor(mariocolors[skinningplayer][colorsetedit][2]) + love.graphics.setColor(0.4, 0.4, 0.4) + local s = math.floor(mariocolors[skinningplayer][colorsetedit][2] * 255) properprint(s, 200*scale-string.len(s)*4*scale, 126*scale) - love.graphics.setColor(0, 0, 100) - love.graphics.rectangle("fill", 51*scale, (136)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][3]/255)), 7*scale) - love.graphics.setColor(0, 0, 255) - love.graphics.rectangle("fill", 50*scale, (135)*scale, math.floor(129*scale * (mariocolors[skinningplayer][colorsetedit][3]/255)), 7*scale) + love.graphics.setColor(0, 0, 0.4) + love.graphics.rectangle("fill", 51*scale, (136)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][3]), 7*scale) + love.graphics.setColor(0, 0, 1) + love.graphics.rectangle("fill", 50*scale, (135)*scale, math.floor(129*scale * mariocolors[skinningplayer][colorsetedit][3]), 7*scale) - love.graphics.setColor(100, 100, 100) - local s = math.floor(mariocolors[skinningplayer][colorsetedit][3]) + love.graphics.setColor(0.4, 0.4, 0.4) + local s = math.floor(mariocolors[skinningplayer][colorsetedit][3] * 255) properprint(s, 200*scale-string.len(s)*4*scale, 136*scale) end --Portalhuehues --hue - local alpha = 100 + local alpha = 0.4 if characters[mariocharacter[skinningplayer]].colorables then if optionsselection == 9 then - alpha = 255 + alpha = 1 end else if optionsselection == 5 then - alpha = 255 + alpha = 1 end end - love.graphics.setColor(255, 255, 255, alpha) + love.graphics.setColor(1, 1, 1, alpha) properprint("coop portal 1 color:", 31*scale, 150*scale) @@ -817,18 +817,18 @@ function menu_draw() love.graphics.setColor(alpha, alpha, alpha) love.graphics.draw(huebarmarkerimg, math.floor(28 + (portalhues[skinningplayer][1])*178)*scale, 160*scale, 0, scale, scale) - alpha = 100 + alpha = 0.4 if characters[mariocharacter[skinningplayer]].colorables then if optionsselection == 10 then - alpha = 255 + alpha = 1 end else if optionsselection == 6 then - alpha = 255 + alpha = 1 end end - love.graphics.setColor(255, 255, 255, alpha) + love.graphics.setColor(1, 1, 1, alpha) properprint("coop portal 2 color:", 31*scale, 180*scale) @@ -841,9 +841,9 @@ function menu_draw() love.graphics.draw(huebarmarkerimg, math.floor(28 + (portalhues[skinningplayer][2])*178)*scale, 190*scale, 0, scale, scale) elseif optionstab == 3 then if optionsselection == 2 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("size:", 30*scale, 40*scale) if fullscreen then @@ -858,9 +858,9 @@ function menu_draw() if optionsselection == 3 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("shader1:", 30*scale, 55*scale) @@ -871,9 +871,9 @@ function menu_draw() end if optionsselection == 4 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("shader2:", 30*scale, 65*scale) if shaderssupported == false then @@ -882,14 +882,14 @@ function menu_draw() properprint(string.lower(shaderlist[currentshaderi2]), (180-string.len(shaderlist[currentshaderi2])*8)*scale, 65*scale) end - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("shaders will really", 30*scale, 80*scale) properprint("reduce performance!", 30*scale, 90*scale) if optionsselection == 5 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("game volume:", 30*scale, 105*scale) drawrectangle(138, 108, 90, 1) @@ -898,9 +898,9 @@ function menu_draw() love.graphics.draw(volumesliderimg, math.floor((137+89*volumesfx)*scale), 105*scale, 0, scale, scale) if optionsselection == 6 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("music volume:", 30*scale, 120*scale) drawrectangle(138, 123, 90, 1) @@ -909,25 +909,25 @@ function menu_draw() love.graphics.draw(volumesliderimg, math.floor((137+89*volumemusic)*scale), 120*scale, 0, scale, scale) if optionsselection == 7 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("reset game mappacks", 30*scale, 135*scale) if optionsselection == 8 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("reset all settings", 30*scale, 150*scale) if optionsselection == 9 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("vsync:", 30*scale, 165*scale) @@ -937,13 +937,13 @@ function menu_draw() properprint("off", (180-24)*scale, 165*scale) end - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) properprint("you can lock the|mouse with f12", 30*scale, 180*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) properprint(versionstring, 134*scale, 207*scale) elseif optionstab == 4 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if not gamefinished then properprint("unlock this by completing", 30*scale, 40*scale) properprint("the original levels pack!", 30*scale, 50*scale) @@ -952,18 +952,18 @@ function menu_draw() end if optionsselection == 2 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("mode:", 30*scale, 65*scale) properprint("{" .. playertype .. "}", (180-(string.len(playertype)+2)*8)*scale, 65*scale) if optionsselection == 3 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("knockback:", 30*scale, 80*scale) @@ -974,9 +974,9 @@ function menu_draw() end if optionsselection == 4 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("bullettime:", 30*scale, 95*scale) @@ -988,9 +988,9 @@ function menu_draw() end if optionsselection == 5 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("huge mario:", 30*scale, 120*scale) @@ -1001,9 +1001,9 @@ function menu_draw() end if optionsselection == 6 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("goomba attack:", 30*scale, 135*scale) @@ -1014,9 +1014,9 @@ function menu_draw() end if optionsselection == 7 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("sonic rainboom:", 30*scale, 150*scale) @@ -1027,9 +1027,9 @@ function menu_draw() end if optionsselection == 8 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("playercollision:", 30*scale, 165*scale) @@ -1040,9 +1040,9 @@ function menu_draw() end if optionsselection == 9 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("infinite time:", 30*scale, 180*scale) @@ -1053,9 +1053,9 @@ function menu_draw() end if optionsselection == 10 then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(100, 100, 100, 255) + love.graphics.setColor(0.4, 0.4, 0.4, 1) end properprint("infinite lives:", 30*scale, 195*scale) @@ -1135,7 +1135,7 @@ function loadbackground(backgroundlevel) itemanimations = {} textentities = {} - if love.filesystem.exists("mappacks/" .. mappack .. "/" .. backgroundlevel) == false then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. backgroundlevel) == false then return false else loadmap(backgroundlevel:sub(1, -5)) @@ -1200,7 +1200,7 @@ function loadmappacks() local delete = {} for i = 1, #mappacklist do - if love.filesystem.exists( "mappacks/" .. mappacklist[i] .. "/version.txt") or not love.filesystem.exists( "mappacks/" .. mappacklist[i] .. "/settings.txt") then + if love.filesystem.getInfo( "mappacks/" .. mappacklist[i] .. "/version.txt") or not love.filesystem.getInfo( "mappacks/" .. mappacklist[i] .. "/settings.txt") then table.insert(delete, i) end end @@ -1220,7 +1220,7 @@ function loadmappacks() mappackbackground = {} for i = 1, #mappacklist do - if love.filesystem.exists( "mappacks/" .. mappacklist[i] .. "/icon.png" ) then + if love.filesystem.getInfo( "mappacks/" .. mappacklist[i] .. "/icon.png" ) then mappackicon[i] = love.graphics.newImage("mappacks/" .. mappacklist[i] .. "/icon.png") else mappackicon[i] = nil @@ -1228,7 +1228,7 @@ function loadmappacks() mappackauthor[i] = "" mappackdescription[i] = "" - if love.filesystem.exists( "mappacks/" .. mappacklist[i] .. "/settings.txt" ) then + if love.filesystem.getInfo( "mappacks/" .. mappacklist[i] .. "/settings.txt" ) then local s = love.filesystem.read( "mappacks/" .. mappacklist[i] .. "/settings.txt" ) local s1 = s:split("\n") for j = 1, #s1 do @@ -1275,7 +1275,7 @@ function loadonlinemappacks() local delete = {} for i = 1, #onlinemappacklist do - if not love.filesystem.exists( "mappacks/" .. onlinemappacklist[i] .. "/version.txt") or not love.filesystem.exists( "mappacks/" .. onlinemappacklist[i] .. "/settings.txt") then + if not love.filesystem.getInfo( "mappacks/" .. onlinemappacklist[i] .. "/version.txt") or not love.filesystem.getInfo( "mappacks/" .. onlinemappacklist[i] .. "/settings.txt") then table.insert(delete, i) end end @@ -1295,7 +1295,7 @@ function loadonlinemappacks() onlinemappackbackground = {} for i = 1, #onlinemappacklist do - if love.filesystem.exists( "mappacks/" .. onlinemappacklist[i] .. "/icon.png" ) then + if love.filesystem.getInfo( "mappacks/" .. onlinemappacklist[i] .. "/icon.png" ) then onlinemappackicon[i] = love.graphics.newImage("mappacks/" .. onlinemappacklist[i] .. "/icon.png") else onlinemappackicon[i] = nil @@ -1303,7 +1303,7 @@ function loadonlinemappacks() onlinemappackauthor[i] = nil onlinemappackdescription[i] = nil - if love.filesystem.exists( "mappacks/" .. onlinemappacklist[i] .. "/settings.txt" ) then + if love.filesystem.getInfo( "mappacks/" .. onlinemappacklist[i] .. "/settings.txt" ) then local s = love.filesystem.read( "mappacks/" .. onlinemappacklist[i] .. "/settings.txt" ) local s1 = s:split("\n") for j = 1, #s1 do @@ -1379,7 +1379,7 @@ function downloadmappacks() for i = 1, #maplist do --check if current version is equal or newer local version = 0 - if love.filesystem.exists("mappacks/" .. maplist[i] .. "/version.txt") then + if love.filesystem.getInfo("mappacks/" .. maplist[i] .. "/version.txt") then local data = love.filesystem.read("mappacks/" .. maplist[i] .. "/version.txt") if data then version = tonumber(data) @@ -1393,7 +1393,7 @@ function downloadmappacks() currentdownload = i downloadcount = #maplist - if love.filesystem.exists("mappacks/" .. maplist[i] .. "/") then + if love.filesystem.getInfo("mappacks/" .. maplist[i] .. "/") then love.filesystem.remove("mappacks/" .. maplist[i] .. "/") end @@ -1451,7 +1451,7 @@ function downloadmappacks() --Delete stuff and stuff. if not success then - if love.filesystem.exists("mappacks/" .. maplist[i] .. "/") then + if love.filesystem.getInfo("mappacks/" .. maplist[i] .. "/") then local list = love.filesystem.getDirectoryItems("mappacks/" .. maplist[i] .. "/") for j = 1, #list do love.filesystem.remove("mappacks/" .. maplist[i] .. "/" .. list[j]) @@ -2016,7 +2016,7 @@ function reset_mappacks() end function delete_mappack(pack) - if not love.filesystem.exists("mappacks/" .. pack .. "/") then + if not love.filesystem.getInfo("mappacks/" .. pack .. "/") then return false end @@ -2030,7 +2030,7 @@ end function createmappack() local i = 1 - while love.filesystem.exists("mappacks/custom_mappack_" .. i .. "/") do + while love.filesystem.getInfo("mappacks/custom_mappack_" .. i .. "/") do i = i + 1 end @@ -2089,7 +2089,7 @@ function selectworld() selectworldexists = {} for i = 1, 8 do - if love.filesystem.exists("mappacks/" .. mappack .. "/" .. i .. "-1.txt") then + if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. i .. "-1.txt") then selectworldexists[i] = true end end diff --git a/musicentity.lua b/musicentity.lua index b3fea12..8cf15bf 100644 --- a/musicentity.lua +++ b/musicentity.lua @@ -49,7 +49,7 @@ end function musicentity:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(musicentityimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/musicloader.lua b/musicloader.lua index 9d6c2d1..89e6998 100644 --- a/musicloader.lua +++ b/musicloader.lua @@ -22,7 +22,7 @@ function getfilepath(name) local musicpaths = {"sounds/", "mappacks/" .. mappack .. "/music/"} for i = 1, #musicpaths do - if love.filesystem.isFile(musicpaths[i] .. name) then + if love.filesystem.getInfo(musicpaths[i] .. name) and love.filesystem.getInfo(musicpaths[i] .. name).type == "file" then return musicpaths[i] .. name end end diff --git a/netplayinc/LUBE.lua b/netplayinc/LUBE.lua index 5b181df..2438994 100644 --- a/netplayinc/LUBE.lua +++ b/netplayinc/LUBE.lua @@ -160,7 +160,7 @@ function lube.client:Init(socktype) if socktype then if self[socktype] then self.socktype = socktype - elseif love.filesystem.exists(socktype .. ".sock") then + elseif love.filesystem.getInfo(socktype .. ".sock") then love.filesystem.require(socktype .. ".sock") self[socktype] = _G[socktype] self.socktype = socktype @@ -373,7 +373,7 @@ function lube.server:Init(port, socktype) if socktype then if self[socktype] then self.socktype = socktype - elseif love.filesystem.exists(socktype .. ".sock") then + elseif love.filesystem.getInfo(socktype .. ".sock") then love.filesystem.require(socktype .. ".sock") self[socktype] = _G[socktype] self.socktype = socktype diff --git a/notgate.lua b/notgate.lua index 736385c..34ec55a 100644 --- a/notgate.lua +++ b/notgate.lua @@ -50,7 +50,7 @@ end function notgate:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(notgateimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/notice.lua b/notice.lua index ed67d4e..c436b03 100644 --- a/notice.lua +++ b/notice.lua @@ -1,6 +1,6 @@ notice = {} -notice.red = {255, 127, 127} -notice.white = {255, 255, 255} +notice.red = {1, 0.5, 0.5} +notice.white = {1, 1, 1} notice.notices = {} notice.duration = 5 --seconds notice.fadetime = 0.5 @@ -47,10 +47,10 @@ function notice.draw() love.graphics.setScissor(unpack(scissor)) - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", targetrect[1]*scale, targetrect[2]*scale, targetrect[3]*scale, targetrect[4]*scale) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) drawrectangle(targetrect[1]+1, targetrect[2]+1, targetrect[3]-2, targetrect[4]-2) love.graphics.setColor(v.color) @@ -59,7 +59,7 @@ function notice.draw() love.graphics.setScissor() end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end function notice.gety(y, life, height, duration) diff --git a/onlinemenu.lua b/onlinemenu.lua index dc4f461..00664aa 100644 --- a/onlinemenu.lua +++ b/onlinemenu.lua @@ -22,12 +22,12 @@ function onlinemenu_load() guielements.magiccheckbox = guielement:new("checkbox", 220, 147, togglemagic, true) guielements.hostbutton = guielement:new("button", 247, 199, "create game", creategame, 2) - guielements.hostbutton.bordercolor = {255, 0, 0} - guielements.hostbutton.bordercolorhigh = {255, 127, 127} + guielements.hostbutton.bordercolor = {1, 0, 0} + guielements.hostbutton.bordercolorhigh = {1, 0.5, 0.5} guielements.joinbutton = guielement:new("button", 61, 199, "join game", joingame, 2) - guielements.joinbutton.bordercolor = {0, 255, 0} - guielements.joinbutton.bordercolorhigh = {127, 255, 127} + guielements.joinbutton.bordercolor = {0, 1, 0} + guielements.joinbutton.bordercolorhigh = {0.5, 1, 0.5} runanimationtimer = 0 runanimationframe = 1 @@ -79,9 +79,9 @@ end function onlinemenu_draw() --TOP PART - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 3*scale, 3*scale, 394*scale, 52*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("online play", 4*scale, 5*scale) @@ -99,24 +99,24 @@ function onlinemenu_draw() --BOTTOM PART --LEFT (JOIN) - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 3*scale, 58*scale, 196*scale, 163*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("join game", 64*scale, 60*scale) properprint("address/magicdns", 36*scale, 77*scale) guielements.ipentry:draw() - love.graphics.setColor(150, 150, 150) + love.graphics.setColor(0.6, 0.6, 0.6) properprint("enter ip, hostname,", 24*scale, 107*scale) properprint("domain or magicdns", 28*scale, 117*scale) properprint("words to connect.", 32*scale, 127*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("optional port:", 21*scale, 148*scale) guielements.portentry2:draw() - love.graphics.setColor(150, 150, 150) + love.graphics.setColor(0.6, 0.6, 0.6) properprint("not needed when", 40*scale, 162*scale) properprint("connecting through", 28*scale, 172*scale) properprint("magicdns", 68*scale, 182*scale) @@ -124,23 +124,23 @@ function onlinemenu_draw() guielements.joinbutton:draw() --RIGHT (HOST) - love.graphics.setColor(0, 0, 0, 200) + love.graphics.setColor(0, 0, 0, 0.8) love.graphics.rectangle("fill", 202*scale, 58*scale, 195*scale, 163*scale) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) properprint("host game", 260*scale, 60*scale) properprint("port", 280*scale, 77*scale) guielements.portentry:draw() - love.graphics.setColor(150, 150, 150) + love.graphics.setColor(0.6, 0.6, 0.6) properprint("port will need to", 230*scale, 107*scale) properprint("be udp forwarded for", 218*scale, 117*scale) properprint("internet play!", 242*scale, 127*scale) guielements.magiccheckbox:draw() properprint("use magicdns words", 230*scale, 148*scale) - love.graphics.setColor(150, 150, 150) + love.graphics.setColor(0.6, 0.6, 0.6) properprint("allows friends", 238*scale, 162*scale) properprint("to join using", 242*scale, 172*scale) properprint("two short words", 234*scale, 182*scale) diff --git a/orgate.lua b/orgate.lua index 02689ae..65f8547 100644 --- a/orgate.lua +++ b/orgate.lua @@ -50,7 +50,7 @@ end function orgate:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(orgateimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/pedestal.lua b/pedestal.lua index 260c12b..bb69b12 100644 --- a/pedestal.lua +++ b/pedestal.lua @@ -52,7 +52,7 @@ function pedestal:update(dt) end function pedestal:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) if self.pickedup then local prog = self.progress / pedestaltime love.graphics.setScissor(math.floor((self.cox-1-xscroll)*16*scale), math.floor((self.coy-1.5-yscroll)*16*scale)+14*prog*scale, 16*scale, (14*(1-prog)+2)*scale) diff --git a/portal.lua b/portal.lua index a0979f3..63a5c4c 100644 --- a/portal.lua +++ b/portal.lua @@ -2,8 +2,8 @@ portal = class("portal") function portal:init(number, c1, c2) self.number = number - self.portal1color = c1 or {60, 188, 252} - self.portal2color = c2 or {232, 130, 30} + self.portal1color = c1 or {60 / 255, 188 / 255, 252 / 255} + self.portal2color = c2 or {232 / 255, 130 / 255, 30 / 255} self.animationtimer = 0 self.portalframe = 1 self.openscale = {0, 0} @@ -174,9 +174,9 @@ function portal:draw() local glowalpha = 100 if self.x2 and self.x1 then --portal glow - love.graphics.setColor(255, 255, 255, 80 - math.abs(self.portalframe-3)*10) + love.graphics.setColor(1, 1, 1, (80 - math.abs(self.portalframe-3)*10)/255) love.graphics.draw(portalglowimg, math.floor(((self["x" .. i]-1-xscroll)*16+offsetx)*scale), math.floor(((self["y" .. i]-yscroll-1)*16+offsety)*scale), rotation, scale*self.openscale[i], scale, 16, 20) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end love.graphics.setColor(unpack(self["portal" .. i .. "color"])) diff --git a/portalparticle.lua b/portalparticle.lua index 6ba9f41..29f5a7e 100644 --- a/portalparticle.lua +++ b/portalparticle.lua @@ -4,7 +4,7 @@ function portalparticle:init(x, y, color, direction) self.x = x or 0 self.y = y or 0 self.timer = 0 - self.color = color or {255, 255, 255, 0} + self.color = color or {1, 1, 1, 0} self.direction = direction self.speedx, self.speedy = 0, 0 @@ -42,7 +42,7 @@ end function portalparticle:draw() local r, g, b = unpack(self.color) - local a = (1 - self.timer/portalparticleduration) * 255 + local a = (1 - self.timer/portalparticleduration) love.graphics.setColor(r, g, b, a) love.graphics.draw(portalparticleimg, math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5)*16*scale), 0, scale, scale, .5, .5) end \ No newline at end of file diff --git a/portalprojectile.lua b/portalprojectile.lua index bf22d24..cb154e0 100644 --- a/portalprojectile.lua +++ b/portalprojectile.lua @@ -134,7 +134,7 @@ function portalprojectileparticle:update(dt) self.x = self.x + self.speedx*dt self.y = self.y + self.speedy*dt - self.alpha = self.alpha - dt*300 + self.alpha = self.alpha - dt*1.2 if self.alpha < 0 then self.alpha = 0 return true diff --git a/portalwall.lua b/portalwall.lua index d55cb8e..abf66d8 100644 --- a/portalwall.lua +++ b/portalwall.lua @@ -12,7 +12,7 @@ function portalwall:init(x, y, width, height) end function portalwall:draw()--debug - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) love.graphics.setPointSize(5) if self.width ~= 0 or self.height ~= 0 then love.graphics.line((self.x-xscroll)*16*scale, (self.y-.5-yscroll)*16*scale, (self.x-xscroll)*16*scale+self.width*16*scale, (self.y-.5-yscroll)*16*scale+self.height*16*scale) diff --git a/quad.lua b/quad.lua index f99a94e..bde1f35 100644 --- a/quad.lua +++ b/quad.lua @@ -39,91 +39,91 @@ function getquadprops(imgdata, x, y) --get collision self.collision = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17) - if a > 127 then + if a > 0.5 then self.collision = true end --get invisible self.invisible = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+1) - if a > 127 then + if a > 0.5 then self.invisible = true end --get breakable self.breakable = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+2) - if a > 127 then + if a > 0.5 then self.breakable = true end --get coinblock self.coinblock = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+3) - if a > 127 then + if a > 0.5 then self.coinblock = true end --get coin self.coin = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+4) - if a > 127 then + if a > 0.5 then self.coin = true end --get not portalable self.portalable = true local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+5) - if a > 127 then + if a > 0.5 then self.portalable = false end --get left slant self.slantupleft = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+6) - if a > 127 then + if a > 0.5 then self.slantupleft = true end --get right slant self.slantupright = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+7) - if a > 127 then + if a > 0.5 then self.slantupright = true end --get mirror self.mirror = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+8) - if a > 127 then + if a > 0.5 then self.mirror = true end --get grate self.grate = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+9) - if a > 127 then + if a > 0.5 then self.grate = true end --get platform self.platform = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+10) - if a > 127 then + if a > 0.5 then self.platform = true end --get watertile self.water = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+11) - if a > 127 then + if a > 0.5 then self.water = true end --get bridge self.bridge = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12) - if a > 127 then + if a > 0.5 then self.bridge = true end @@ -133,7 +133,7 @@ function getquadprops(imgdata, x, y) local v = t[i] self["spikes" .. v] = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12+i) - if a > 127 then + if a > 0.5 then self["spikes" .. v] = true end end @@ -141,7 +141,7 @@ function getquadprops(imgdata, x, y) --get foreground self.foreground = false local r, g, b, a = imgdata:getPixel(x*17-2, (y-1)*17+16) - if a > 127 then + if a > 0.5 then self.foreground = true end diff --git a/regiondrag.lua b/regiondrag.lua index fe4d6de..8f762a2 100644 --- a/regiondrag.lua +++ b/regiondrag.lua @@ -102,9 +102,9 @@ function regiondrag:draw() end if high == 5 or self.grabbed == 5 then - love.graphics.setColor(255, 255, 255, 100) + love.graphics.setColor(1, 1, 1, 0.4) else - love.graphics.setColor(255, 127, 39, 100) + love.graphics.setColor(1, 0.5, 0.15, 0.4) end love.graphics.rectangle("fill", (self.x-xscroll)*16*scale, (self.y-yscroll-.5)*16*scale, self.width*16*scale, self.height*16*scale) @@ -114,9 +114,9 @@ function regiondrag:draw() local x, y if i == self.grabbed or (self.grabbed == 0 and high == i) then - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.8) else - love.graphics.setColor(222, 97, 29, 200) + love.graphics.setColor(0.87, 0.4, 0.11, 0.8) end if i == 1 then diff --git a/rightclickmenu.lua b/rightclickmenu.lua index 64a4ed2..9fb5486 100644 --- a/rightclickmenu.lua +++ b/rightclickmenu.lua @@ -41,7 +41,7 @@ function rightclickmenu:init(x, y, elements, tx, ty) elseif v.t == "linkbutton" then table.insert(self.t, guielement:new("button", self.x, self.y+(rightclickcellheight+rightclickcellspacing)*(i-1), v.value, rightclickmenu.linkcallback, nil, {nil, self, v.link, false}, nil, rightclickwidth-14)) table.insert(self.t, guielement:new("button", self.x+rightclickwidth-11, self.y+(rightclickcellheight+rightclickcellspacing)*(i-1), "x", rightclickmenu.linkcallback, nil, {nil, self, v.link, true}, nil, 8)) - self.t[#self.t].textcolor = {200, 0, 0} + self.t[#self.t].textcolor = {0.8, 0, 0} table.insert(self.variables, v) elseif v.t == "regionselect" then @@ -58,7 +58,7 @@ function rightclickmenu:init(x, y, elements, tx, ty) table.insert(self.t, guielement:new(v.t, self.x+1, self.y+1+(rightclickcellheight+rightclickcellspacing)*(i-1), rightclickwidth-2, 33, rightclickcellheight, current, "hor", true, v.min, v.max, v.step)) set = true - self.t[#self.t].backgroundcolor = {0, 0, 0, 255} + self.t[#self.t].backgroundcolor = {0, 0, 0, 1} elseif v.t == "input" then local default = v.default @@ -101,8 +101,8 @@ function rightclickmenu:init(x, y, elements, tx, ty) j = j + 1 if map[tx][ty][actuali+2] == dir then - add[#add].bordercolor = {255, 0, 0} - add[#add].bordercolorhigh = {255, 127, 127} + add[#add].bordercolor = {1, 0, 0} + add[#add].bordercolorhigh = {1, 0.5, 0.5} variablesadd["value"] = dir @@ -169,17 +169,17 @@ function rightclickmenu:update(dt) end function rightclickmenu:draw() - love.graphics.setColor(50, 50, 50, 180*rightclicka) + love.graphics.setColor(0.2, 0.2, 0.2, 0.7*rightclicka) --background love.graphics.rectangle("fill", self.x*scale, self.y*scale, rightclickwidth*scale, ((rightclickcellheight+rightclickcellspacing)*#self.elements+1)*scale) for i, v in pairs(self.t) do if type(self.t[i][1]) == "table" then for j = 1, #self.t[i] do - self.t[i][j]:draw(rightclicka*255) + self.t[i][j]:draw(rightclicka) end else - self.t[i]:draw(rightclicka*255) + self.t[i]:draw(rightclicka) end end end @@ -257,14 +257,14 @@ end function rightclickmenu:directioncallback(self, y, x) for i = 1, #self.t[y] do - self.t[y][i].bordercolor = {127, 127, 127} - self.t[y][i].bordercolorhigh = {255, 255, 255} + self.t[y][i].bordercolor = {0.5, 0.5, 0.5} + self.t[y][i].bordercolorhigh = {1, 1, 1} end for i = 1, #self.t[y] do if self.t[y][i].arguments[4] == x then - self.t[y][i].bordercolor = {255, 0, 0} - self.t[y][i].bordercolorhigh = {255, 127, 127} + self.t[y][i].bordercolor = {1, 0, 0} + self.t[y][i].bordercolorhigh = {1, 0.5, 0.5} break end end diff --git a/rsflipflop.lua b/rsflipflop.lua index 7d046e0..a8d3d19 100644 --- a/rsflipflop.lua +++ b/rsflipflop.lua @@ -43,7 +43,7 @@ end function rsflipflop:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(rsflipflopimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/shaders/init.lua b/shaders/init.lua index 43ca275..d1a69de 100644 --- a/shaders/init.lua +++ b/shaders/init.lua @@ -138,7 +138,7 @@ function shaders:init(numpasses) local filename, filetype = v:match("(.+)%.(.-)$") if filetype == "frag" then local name = "shaders".."/"..v - if love.filesystem.isFile(name) then + if love.filesystem.getInfo(name).type == "file" then local str = love.filesystem.read(name) local success, effect = pcall(love.graphics.newShader, str) if success then @@ -241,7 +241,7 @@ function shaders:postdraw() local blendmode = love.graphics.getBlendMode() love.graphics.setBlendMode("alpha", "premultiplied") - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local activepasses = {} diff --git a/squarewave.lua b/squarewave.lua index 4a0adfb..775073b 100644 --- a/squarewave.lua +++ b/squarewave.lua @@ -67,7 +67,7 @@ end function squarewave:draw() if self.visible then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(squarewaveimg, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end end diff --git a/variables.lua b/variables.lua index 30b8ec1..87957ea 100644 --- a/variables.lua +++ b/variables.lua @@ -202,7 +202,7 @@ portalprojectileparticledelay = 0.002 emanceparticlespeed = 3 emanceparticlespeedmod = 0.3 emanceimgwidth = 64 -emancelinecolor = {100, 100, 255, 10} +emancelinecolor = {100/255, 100/255, 255/255, 10/255} boxfriction = 20 boxfrictionair = 0 diff --git a/wallindicator.lua b/wallindicator.lua index c38ec82..f2f6a1f 100644 --- a/wallindicator.lua +++ b/wallindicator.lua @@ -39,7 +39,7 @@ function wallindicator:update() end function wallindicator:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local quad = 1 if self.lighted then quad = 2 diff --git a/walltimer.lua b/walltimer.lua index fed2b5a..1bbd211 100644 --- a/walltimer.lua +++ b/walltimer.lua @@ -68,7 +68,7 @@ function walltimer:update(dt) end function walltimer:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.drawq(walltimerimg, walltimerquad[self.quad], math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end From 8cca150afa635b870b24eaed51e36875da2a6f8b Mon Sep 17 00:00:00 2001 From: WillWare Date: Thu, 16 Aug 2018 23:00:14 -0500 Subject: [PATCH 02/32] 11.1 support fixes --- characterloader.lua | 2 +- editor.lua | 6 +++--- game.lua | 8 ++++---- main.lua | 10 +++++----- menu.lua | 6 +++--- musicloader.lua | 4 ++-- shaders/CRT-Simple.frag | 24 ++++++++++++------------ shaders/CRT.frag | 24 ++++++++++++------------ shaders/dotnbloom.frag | 28 ++++++++++++++-------------- shaders/init.lua | 2 +- shaders/phosphor.frag | 4 ++-- 11 files changed, 59 insertions(+), 59 deletions(-) diff --git a/characterloader.lua b/characterloader.lua index 21aad1a..b5eb44d 100644 --- a/characterloader.lua +++ b/characterloader.lua @@ -175,7 +175,7 @@ end characterlist = {} characters = {} for i, v in pairs(love.filesystem.getDirectoryItems("characters/")) do - if love.filesystem.getInfo("characters/" .. v).type == "directory" then + if love.filesystem.getInfo("characters/" .. v, "directory") then local temp = loadcharacter(v) if temp then characters[v] = temp diff --git a/editor.lua b/editor.lua index 7b66605..7436b19 100644 --- a/editor.lua +++ b/editor.lua @@ -3837,7 +3837,7 @@ function objectclipboardcopy(objecttable) end function moveline(file, line, direction) - if love.filesystem.getInfo(file) == false then + if not love.filesystem.getInfo(file) then return false end if direction ~= "up" then @@ -3885,7 +3885,7 @@ function moveline(file, line, direction) end function deleteline(file, line) - if love.filesystem.getInfo(file) == false then + if not love.filesystem.getInfo(file) then return false end line = tonumber(line) @@ -3903,7 +3903,7 @@ function deleteline(file, line) end function changeline(file, linenumber, newstring) - if love.filesystem.getInfo(file) == false then + if not love.filesystem.getInfo(file) then return false end line = tonumber(line) diff --git a/game.lua b/game.lua index 6b1993f..7b0b94b 100644 --- a/game.lua +++ b/game.lua @@ -102,7 +102,7 @@ function game_update(dt) coinanimation = coinanimation - 5 end - coinframe = math.floor(coinanimation) + coinframe = math.max(1, math.floor(coinanimation)) --SCROLLING SCORES local delete = {} @@ -3209,7 +3209,7 @@ end function loadmap(filename, createobjects) print("**************************" .. string.rep("*", #(mappack .. filename))) print("* Loading mappacks/" .. mappack .. "/" .. filename .. ".txt *") - if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. filename .. ".txt") == false then + if not love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. filename .. ".txt") then print("mappacks/" .. mappack .. "/" .. filename .. ".txt not found!") return false end @@ -4995,10 +4995,10 @@ function renderpreview() local id = map[x][y+yadd][1] if id ~= nil and id ~= 0 and rgblist[id] and tilequads[id]:getproperty("invisible", x, y+yadd) == false then local r, g, b = unpack(rgblist[id]) - out:setPixel(x-1, y-1, r, g, b, 255) + out:setPixel(x-1, y-1, r, g, b, 1) else local r, g, b = unpack(background) - out:setPixel(x-1, y-1, r, g, b, 255) + out:setPixel(x-1, y-1, r, g, b, 1) end end end diff --git a/main.lua b/main.lua index dde0145..cf07ce2 100644 --- a/main.lua +++ b/main.lua @@ -1460,7 +1460,7 @@ function loadcustomimages(path) local fl = love.filesystem.getDirectoryItems(path) for i = 1, #fl do local v = fl[i] - if love.filesystem.getInfo(path .. "/" .. v) and love.filesystem.getInfo(path .. "/" .. v).type == "file" then + if love.filesystem.getInfo(path .. "/" .. v, "file") then local s = string.sub(v, 1, -5) if tablecontains(imagelist, s) then _G[s .. "img"] = love.graphics.newImage(path .. "/" .. v) @@ -2093,7 +2093,7 @@ function loadcustombackgrounds() for i = 1, #fl do local v = "mappacks/" .. mappack .. "/backgrounds/" .. fl[i] - if love.filesystem.getInfo(v).type == "file" and v ~= ".DS_STORE" and v ~= ".DS_S" then + if love.filesystem.getInfo(v, "file") and v ~= ".DS_STORE" and v ~= ".DS_S" then if string.sub(v, -5, -5) == "1" then local name = string.sub(fl[i], 1, -6) local bg = string.sub(v, 1, -6) @@ -2131,7 +2131,7 @@ function loadlevelscreens() for i = 1, #fl do local v = "mappacks/" .. mappack .. "/levelscreens/" .. fl[i] - if love.filesystem.getInfo(v).type == "file" then + if love.filesystem.getInfo(v, "file") then table.insert(levelscreens, string.lower(string.sub(fl[i], 1, -5))) end end @@ -2162,8 +2162,8 @@ function loadanimatedtiles() local i = 1 while love.filesystem.getInfo(folder .. "/" .. i .. ".png") do local v = folder .. "/" .. i .. ".png" - if love.filesystem.getInfo(v).type == "file" and string.sub(v, -4) == ".png" then - if love.filesystem.getInfo(string.sub(v, 1, -5) .. ".txt") and love.filesystem.getInfo(string.sub(v, 1, -5) .. ".txt").type == "file" then + if love.filesystem.getInfo(v, "file") and string.sub(v, -4) == ".png" then + if love.filesystem.getInfo(string.sub(v, 1, -5) .. ".txt", "file") then animatedtilecount = animatedtilecount + 1 local number = animatedtilecount+10000 local t = animatedquad:new(v, love.filesystem.read(string.sub(v, 1, -5) .. ".txt"), number) diff --git a/menu.lua b/menu.lua index 81c475b..c06574d 100644 --- a/menu.lua +++ b/menu.lua @@ -72,10 +72,10 @@ end function menu_update(dt) --coinanimation coinanimation = coinanimation + dt*6.75 - while coinanimation > 6 do + while coinanimation >= 6 do coinanimation = coinanimation - 5 end - coinframe = math.floor(coinanimation) + coinframe = math.max(1, math.floor(coinanimation)) --Animate animated tiles because I say so for i = 1, #animatedtiles do @@ -1135,7 +1135,7 @@ function loadbackground(backgroundlevel) itemanimations = {} textentities = {} - if love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. backgroundlevel) == false then + if not love.filesystem.getInfo("mappacks/" .. mappack .. "/" .. backgroundlevel) then return false else loadmap(backgroundlevel:sub(1, -5)) diff --git a/musicloader.lua b/musicloader.lua index 89e6998..e370ae3 100644 --- a/musicloader.lua +++ b/musicloader.lua @@ -22,7 +22,7 @@ function getfilepath(name) local musicpaths = {"sounds/", "mappacks/" .. mappack .. "/music/"} for i = 1, #musicpaths do - if love.filesystem.getInfo(musicpaths[i] .. name) and love.filesystem.getInfo(musicpaths[i] .. name).type == "file" then + if love.filesystem.getInfo(musicpaths[i] .. name, "file") then return musicpaths[i] .. name end end @@ -67,7 +67,7 @@ function music:play(name, fast) if self.loaded[name] then if soundenabled then self.loaded[name]:stop() - self.loaded[name]:rewind() + self.loaded[name]:seek(0) self.loaded[name]:setVolume(volumemusic or 1) self.loaded[name]:play() end diff --git a/shaders/CRT-Simple.frag b/shaders/CRT-Simple.frag index 0d1691e..fccee22 100644 --- a/shaders/CRT-Simple.frag +++ b/shaders/CRT-Simple.frag @@ -7,7 +7,7 @@ under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + modified by slime73 for use with love2d and mari0 */ @@ -33,7 +33,7 @@ extern vec2 textureSize; #define outputGamma 2.2 // Macros. -#define TEX2D(c) pow(checkTexelBounds(_tex0_, (c)), vec4(inputGamma)) +#define TEX2D(c) pow(checkTexelBounds(texture, (c)), vec4(inputGamma)) #define PI 3.141592653589 @@ -44,21 +44,21 @@ vec2 radialDistortion(vec2 coord, const vec2 ratio) float offsety = 1.0 - ratio.y; coord.y -= offsety; coord /= ratio; - + vec2 cc = coord - 0.5; float dist = dot(cc, cc) * distortion; vec2 result = coord + cc * (1.0 + dist) * dist; - + result *= ratio; result.y += offsety; - + return result; } #ifdef CURVATURE vec4 checkTexelBounds(Image texture, vec2 coords) { - vec2 ss = step(coords, vec2(bounds.x, 1.0)) * step(vec2(0.0, bounds.y), coords); + vec2 ss = step(coords, vec2(bounds.x, 1.0)) * step(vec2(0.0, bounds.y), coords); return Texel(texture, coords) * ss.x * ss.y; } #else @@ -73,13 +73,13 @@ vec4 checkTexelBounds(Image texture, vec2 coords) vec4 checkTexelBounds(Image texture, vec2 coords) { vec2 bounds = vec2(inputSize.x / textureSize.x, 1.0 - inputSize.y / textureSize.y); - + vec4 color; if (coords.x > bounds.x || coords.x < 0.0 || coords.y > 1.0 || coords.y < bounds.y) color = vec4(0.0, 0.0, 0.0, 1.0); else color = Texel(texture, coords); - + return color; } */ @@ -114,8 +114,8 @@ vec4 effect(vec4 vcolor, Image texture, vec2 texCoord, vec2 pixel_coords) { vec2 one = 1.0 / textureSize; float mod_factor = texCoord.x * textureSize.x * outputSize.x / inputSize.x; - - + + // Here's a helpful diagram to keep in mind while trying to // understand the code: // @@ -163,14 +163,14 @@ vec4 effect(vec4 vcolor, Image texture, vec2 texCoord, vec2 pixel_coords) // the current pixel. vec4 weights = scanlineWeights(uv_ratio.y, col); vec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2); - + vec4 mul_res_f = (col * weights + col2 * weights2); vec3 mul_res = mul_res_f.rgb; #else vec3 mul_res_f = TEX2D(xy); vec3 mul_res = mul_res_f.rgb; - + #endif // dot-mask emulation: diff --git a/shaders/CRT.frag b/shaders/CRT.frag index 66b0c3f..076dfa2 100644 --- a/shaders/CRT.frag +++ b/shaders/CRT.frag @@ -17,7 +17,7 @@ barrel distortion code was taken from the Curvature shader, which is under the GPL." ) - + modified by slime73 for use with love2d and mari0 */ @@ -59,9 +59,9 @@ extern vec2 textureSize; #endif #ifdef LINEAR_PROCESSING -# define TEX2D(c) pow(LEVELS(checkTexelBounds(_tex0_, (c))), vec4(inputGamma)) +# define TEX2D(c) pow(LEVELS(checkTexelBounds(texture, (c))), vec4(inputGamma)) #else -# define TEX2D(c) LEVELS(checkTexelBounds(_tex0_, (c))) +# define TEX2D(c) LEVELS(checkTexelBounds(texture, (c))) #endif @@ -73,14 +73,14 @@ vec2 radialDistortion(vec2 coord, const vec2 ratio) float offsety = 1.0 - ratio.y; coord.y -= offsety; coord /= ratio; - + vec2 cc = coord - 0.5; float dist = dot(cc, cc) * distortion; vec2 result = coord + cc * (1.0 + dist) * dist; - + result *= ratio; result.y += offsety; - + return result; } @@ -88,7 +88,7 @@ vec2 radialDistortion(vec2 coord, const vec2 ratio) vec4 checkTexelBounds(Image texture, vec2 coords) { vec2 ss = step(coords, vec2(bounds.x, 1.0)) * step(vec2(0.0, bounds.y), coords); - + return Texel(texture, coords) * ss.x * ss.y; // return texcolor; } @@ -129,7 +129,7 @@ vec4 effect(vec4 vcolor, Image texture, vec2 texCoord, vec2 pixel_coords) { vec2 one = 1.0 / textureSize; float mod_factor = texCoord.x * textureSize.x * outputSize.x / inputSize.x; - + // Here's a helpful diagram to keep in mind while trying to // understand the code: // @@ -207,16 +207,16 @@ vec4 effect(vec4 vcolor, Image texture, vec2 texCoord, vec2 pixel_coords) // the current pixel. vec4 weights = scanlineWeights(uv_ratio.y, col); vec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2); - + vec4 mul_res_f = (col * weights + col2 * weights2); vec3 mul_res = mul_res_f.rgb; - + #else - + vec4 mul_res_f = TEX2D(xy); vec3 mul_res = mul_res_f.rgb; - + #endif diff --git a/shaders/dotnbloom.frag b/shaders/dotnbloom.frag index 3758019..1fa0df7 100644 --- a/shaders/dotnbloom.frag +++ b/shaders/dotnbloom.frag @@ -25,10 +25,10 @@ float color_bloom(vec3 color) return mix(1.0 + shine, 1.0 - shine, bright); } -vec3 lookup(float offset_x, float offset_y, vec2 coord) +vec3 lookup(Image texture, float offset_x, float offset_y, vec2 coord) { vec2 offset = vec2(offset_x, offset_y); - vec3 color = Texel(_tex0_, coord).rgb; + vec3 color = Texel(texture, coord).rgb; float delta = dist(fract(gl_TexCoord[0].xy * textureSize), offset + vec2(0.5)); return color * exp(-gamma * delta * color_bloom(color)); } @@ -37,9 +37,9 @@ vec4 effect(vec4 vcolor, Image texture, vec2 tex, vec2 pixel_coords) { float dx = 1.0 / textureSize.x; float dy = 1.0 / textureSize.y; - + // number a = Texel(texture, tex).a; - + vec2 c00 = tex + vec2(-dx, -dy); vec2 c10 = tex + vec2( 0, -dy); vec2 c20 = tex + vec2( dx, -dy); @@ -49,18 +49,18 @@ vec4 effect(vec4 vcolor, Image texture, vec2 tex, vec2 pixel_coords) vec2 c02 = tex + vec2(-dx, dy); vec2 c12 = tex + vec2( 0, dy); vec2 c22 = tex + vec2( dx, dy); - - vec3 mid_color = lookup(0.0, 0.0, c11); + + vec3 mid_color = lookup(texture, 0.0, 0.0, c11); vec3 color = vec3(0.0); - color += lookup(-1.0, -1.0, c00); - color += lookup( 0.0, -1.0, c10); - color += lookup( 1.0, -1.0, c20); - color += lookup(-1.0, 0.0, c01); + color += lookup(texture, -1.0, -1.0, c00); + color += lookup(texture, 0.0, -1.0, c10); + color += lookup(texture, 1.0, -1.0, c20); + color += lookup(texture, -1.0, 0.0, c01); color += mid_color; - color += lookup( 1.0, 0.0, c21); - color += lookup(-1.0, 1.0, c02); - color += lookup( 0.0, 1.0, c12); - color += lookup( 1.0, 1.0, c22); + color += lookup(texture, 1.0, 0.0, c21); + color += lookup(texture, -1.0, 1.0, c02); + color += lookup(texture, 0.0, 1.0, c12); + color += lookup(texture, 1.0, 1.0, c22); vec3 out_color = mix(1.2 * mid_color, color, blend); return vec4(out_color, 1.0); diff --git a/shaders/init.lua b/shaders/init.lua index d1a69de..7024886 100644 --- a/shaders/init.lua +++ b/shaders/init.lua @@ -138,7 +138,7 @@ function shaders:init(numpasses) local filename, filetype = v:match("(.+)%.(.-)$") if filetype == "frag" then local name = "shaders".."/"..v - if love.filesystem.getInfo(name).type == "file" then + if love.filesystem.getInfo(name, "file") then local str = love.filesystem.read(name) local success, effect = pcall(love.graphics.newShader, str) if success then diff --git a/shaders/phosphor.frag b/shaders/phosphor.frag index f505d27..32d5961 100644 --- a/shaders/phosphor.frag +++ b/shaders/phosphor.frag @@ -82,14 +82,14 @@ vec4 grid_color( vec2 coords ) { vec2 snes = floor( coords * textureSize ); if ( (mod(snes.x, 3.0) == 0.0) && (mod(snes.y, 3.0) == 0.0) ) - return texture2D(_tex0_, coords); + return texture2D(texture, coords); else return vec4(0.0); } #define TEX2D(coords) GAMMA_IN( grid_color( coords ) ) #else // DEBUG -#define TEX2D(coords) GAMMA_IN( texture2D(_tex0_, coords) ) +#define TEX2D(coords) GAMMA_IN( texture2D(texture, coords) ) #endif // DEBUG From f16af648790ab6523dc63353186501b5d7d6d446 Mon Sep 17 00:00:00 2001 From: WillWare Date: Thu, 16 Aug 2018 23:31:52 -0500 Subject: [PATCH 03/32] Fix colors on portal projectiles and text entities --- portalprojectile.lua | 2 +- textentity.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/portalprojectile.lua b/portalprojectile.lua index cb154e0..f93ebe6 100644 --- a/portalprojectile.lua +++ b/portalprojectile.lua @@ -120,7 +120,7 @@ function portalprojectileparticle:init(x, y, color, r, g, b) self.speedx = math.random(-10, 10)/70 self.speedy = math.random(-10, 10)/70 - self.alpha = 150 + self.alpha = 0.6 self.timer = 0 end diff --git a/textentity.lua b/textentity.lua index b9aa524..b55b252 100644 --- a/textentity.lua +++ b/textentity.lua @@ -78,7 +78,7 @@ end function textentity:draw() if self.power then - love.graphics.setColor(self.red, self.green, self.blue) + love.graphics.setColor(self.red / 255, self.green / 255, self.blue / 255) properprint(self.text, math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5+0.25)*16*scale)) end end \ No newline at end of file From d833d7c74596bf7ce9766d30901ac2241d4215e2 Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 17 Aug 2018 01:07:30 -0500 Subject: [PATCH 04/32] Fixes an audio bug with resuming the game while paused --- game.lua | 6 +++--- main.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/game.lua b/game.lua index 7b0b94b..a83937a 100644 --- a/game.lua +++ b/game.lua @@ -3992,7 +3992,7 @@ function game_keypressed(key) if pausemenuoptions[pausemenuselected] == "resume" then pausemenuopen = false saveconfig() - love.audio.play() + love.audio.play(paused) elseif pausemenuoptions[pausemenuselected] == "suspend" then suspendprompt = true pausemenuselected2 = 1 @@ -4006,7 +4006,7 @@ function game_keypressed(key) elseif key == "escape" then pausemenuopen = false saveconfig() - love.audio.play() + love.audio.play(paused) elseif (key == "right" or key == "d") then if pausemenuoptions[pausemenuselected] == "music volume" then volumemusic = math.min(1, volumemusic + 0.1) @@ -4090,7 +4090,7 @@ function game_keypressed(key) return elseif not editormode and not everyonedead then pausemenuopen = true - love.audio.pause() + paused = love.audio.pause() playsound("pause") end end diff --git a/main.lua b/main.lua index cf07ce2..21d2c64 100644 --- a/main.lua +++ b/main.lua @@ -1981,7 +1981,7 @@ end function love.focus(f) --[[if not f and gamestate == "game"and not editormode and not levelfinished and not everyonedead then pausemenuopen = true - love.audio.pause() + paused = love.audio.pause() end--]] end From 403b0f2c4388fc15abfaad236817696c2061e41e Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 17 Aug 2018 01:59:40 -0500 Subject: [PATCH 05/32] Updated conf.lua to specify 11.1 --- conf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.lua b/conf.lua index f9737f2..599afbf 100644 --- a/conf.lua +++ b/conf.lua @@ -3,7 +3,7 @@ function love.conf(t) t.author = "Maurice" t.identity = "mari0_se" t.modules.physics = false - t.release = false t.window = false t.console = false + t.version = "11.1" end \ No newline at end of file From 159b4d290cf12f418666fd13fe89f8487469bbf3 Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 17 Aug 2018 15:07:51 -0500 Subject: [PATCH 06/32] Support for Love 0.9.x and 0.10.x; fix for pause menu audio crash --- conf.lua | 3 +- dialogbox.lua | 2 +- editor.lua | 22 ++-------- game.lua | 105 ++++++++++++++++++----------------------------- main.lua | 95 ++++++++++++++++++++++++++++++------------ quad.lua | 28 ++++++------- shaders/init.lua | 2 +- textentity.lua | 2 +- 8 files changed, 130 insertions(+), 129 deletions(-) diff --git a/conf.lua b/conf.lua index 599afbf..e644803 100644 --- a/conf.lua +++ b/conf.lua @@ -4,6 +4,5 @@ function love.conf(t) t.identity = "mari0_se" t.modules.physics = false t.window = false - t.console = false - t.version = "11.1" + t.console = true end \ No newline at end of file diff --git a/dialogbox.lua b/dialogbox.lua index 4c4ee61..35bb42a 100644 --- a/dialogbox.lua +++ b/dialogbox.lua @@ -26,7 +26,7 @@ function dialogbox:init(text, speaker) --take out that string self.text = string.sub(self.text, 1, i-1) .. string.sub(self.text, j+1) else - self.textcolors[i] = {tonumber(curcolor[1]) / 255, tonumber(curcolor[2]) / 255, tonumber(curcolor[3]) / 255} + self.textcolors[i] = {tonumber(curcolor[1]) / COLORCONVERT, tonumber(curcolor[2]) / COLORCONVERT, tonumber(curcolor[3]) / COLORCONVERT} i = i + 1 end end diff --git a/editor.lua b/editor.lua index 7436b19..bdde35f 100644 --- a/editor.lua +++ b/editor.lua @@ -959,7 +959,7 @@ function editor_draw() if i == currenttile then love.graphics.setColor(1, 1, 1, 0.8) end - --[[ COMPATABILITY FOR LOVE 0.9.X AND BELOW + local t = "setStencil" local action = nil local int = nil @@ -981,13 +981,6 @@ function editor_draw() else love.graphics.setStencil() end - ]] - love.graphics.stencil(function() love.graphics.rectangle("fill", (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 16*scale, 16*scale) end, "replace", 1) - love.graphics.setStencilTest("greater", 0) - - love.graphics.drawq(v.graphic, v.quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) - - love.graphics.setStencilTest() if i == currenttile then love.graphics.setColor(1, 0, 0, 0.6) @@ -1138,7 +1131,7 @@ function editor_draw() else drawlinkline(x1, y1, x2, y2) end - properprintbackground(t, math.floor(x2-string.len(t)*4*scale), y2+10*scale, true, {r, g, b, math.max(0, (1-rightclicka)*255)}) + properprintbackground(t, math.floor(x2-string.len(t)*4*scale), y2+10*scale, true, {r, g, b, math.max(0, (1-rightclicka))}) end end end @@ -1182,7 +1175,7 @@ function editor_draw() drawlinkline(x1, y1, x2, y2) end - properprintbackground(t, math.floor(x2-string.len(t)*4*scale), y2+10*scale, true, {0, 0, 0, 255*rightclicka}) + properprintbackground(t, math.floor(x2-string.len(t)*4*scale), y2+10*scale, true, {0, 0, 0, rightclicka}) end if linktoolt then @@ -1311,7 +1304,7 @@ function editor_draw() if editenemies then for i = 1, #enemies do local v = enemiesdata[enemies[i]] - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + local t = "setStencil" local action = nil local int = nil @@ -1334,13 +1327,6 @@ function editor_draw() else love.graphics.setStencil() end - ]] - love.graphics.stencil(function() love.graphics.rectangle("fill", math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 16*scale, 16*scale) end, "replace", 1) - love.graphics.setStencilTest("greater", 0) - - love.graphics.drawq(v.graphic, v.quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) - - love.graphics.setStencilTest() end else --ENTITIES diff --git a/game.lua b/game.lua index a83937a..dda1be4 100644 --- a/game.lua +++ b/game.lua @@ -1485,7 +1485,6 @@ function game_draw() --SCISSOR FOR ENTRY if v.customscissor and v.portalable ~= false then - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" if v.invertedscissor then t = "setInvertedStencil" @@ -1503,9 +1502,6 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end - ]] - love.graphics.stencil(function() love.graphics.rectangle("fill", math.floor((v.customscissor[1]-xscroll)*16*scale), math.floor((v.customscissor[2]-.5-yscroll)*16*scale), v.customscissor[3]*16*scale, v.customscissor[4]*16*scale) end, "replace", 1) - love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end if v.static == false and v.portalable ~= false then @@ -1584,7 +1580,6 @@ function game_draw() --portal duplication if v.customscissor and v.portalable ~= false then - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW local t = "setStencil" if v.invertedscissor then t = "setInvertedStencil" @@ -1602,9 +1597,6 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end - ]] - love.graphics.stencil(function() love.graphics.rectangle("fill", math.floor((v.customscissor[1]-xscroll)*16*scale), math.floor((v.customscissor[2]-.5-yscroll)*16*scale), v.customscissor[3]*16*scale, v.customscissor[4]*16*scale) end, "replace", 1) - love.graphics.setStencilTest((v.invertedscissor and "equal" or "greater"), 0) end if v.static == false and (v.active or v.portaloverride) and v.portalable ~= false then @@ -1683,13 +1675,11 @@ function game_draw() end end love.graphics.setScissor(unpack(currentscissor)) - -- if loveVersion > 9 then - love.graphics.setStencilTest() - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + if loveVersion > 9 then + love.graphics.setStencilTest() else love.graphics.setStencil() end - ]] end end end @@ -1972,9 +1962,9 @@ function game_draw() local pl = objects["player"][1] scenecanvas:clear() - love.graphics.setCanvas(scenecanvas) + love.graphics.setCanvas{scenecanvas, stencil=true} scenedraw() - love.graphics.setCanvas(completecanvas) + love.graphics.setCanvas{completecanvas, stencil=true} love.graphics.draw(scenecanvas, 0, 0) if firstpersonview and firstpersonrotate then @@ -2086,7 +2076,7 @@ function game_draw() if (facing == "left" and facing2 == "right") or (facing == "right" and facing2 == "left") or (facing == "up" and facing2 == "down") or (facing == "down" and facing2 == "up") then a = a - math.pi end - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + local t = "setStencil" local action = nil local int = nil @@ -2103,11 +2093,6 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest("greater", 0) end - ]] - love.graphics.stencil(function() - love.graphics.polygon("fill", p1x*16*scale, p1y*16*scale, p2x*16*scale, p2y*16*scale, p4x*16*scale, p4y*16*scale, p3x*16*scale, p3y*16*scale) - end, "replace", 1) --feels like javascript - love.graphics.setStencilTest("greater", 0) love.graphics.setColor(unpack(background)) love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) @@ -2120,13 +2105,12 @@ function game_draw() --love.graphics.setColor(r, g, b, 0.6) --love.graphics.rectangle("fill", 0, 0, width*16*scale, height*16*scale) - -- if v > 9 then - love.graphics.setStencilTest() - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW I think, it's hard to tell, is the v supposed to be loveVersion?? + if loveVersion > 9 then + love.graphics.setStencilTest() else love.graphics.setStencil() end - ]] + love.graphics.setColor(r, g, b) love.graphics.line(p1x*16*scale, p1y*16*scale, p3x*16*scale, p3y*16*scale) love.graphics.line(p2x*16*scale, p2y*16*scale, p4x*16*scale, p4y*16*scale) @@ -2212,7 +2196,7 @@ function game_draw() local yadd = math.sin(r)*dist love.graphics.setColor(1, 1, 1) - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + local t = "setStencil" local action = nil local int = nil @@ -2226,9 +2210,6 @@ function game_draw() if loveVersion > 9 then love.graphics.setStencilTest("greater", 0) end - ]] - love.graphics.stencil(function() love.graphics.circle("fill", math.floor((x*16+xadd)*scale), math.floor((y*16+yadd-.5)*scale), 13.5*scale) end, "stencil", 1) - love.graphics.setStencilTest("greater", 0) local playerx, playery = x*16+xadd, y*16+yadd+3 @@ -2256,13 +2237,11 @@ function game_draw() end drawplayer(i, playerx, playery) - -- if loveVersion > 9 then - love.graphics.setStencilTest() - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + if loveVersion > 9 then + love.graphics.setStencilTest() else love.graphics.setStencil() end - ]] love.graphics.setColor(v.colors[1] or {1, 1, 1}) love.graphics.draw(markoverlayimg, math.floor(x*16*scale), math.floor(y*16*scale), r, scale, scale, 0, 15) @@ -3765,31 +3744,25 @@ end function generatespritebatch() smbspritebatch:clear() smbspritebatchfront:clear() ---[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then smbspritebatch:bind() smbspritebatchfront:bind() end -]] portalspritebatch:clear() portalspritebatchfront:clear() ---[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then portalspritebatch:bind() portalspritebatchfront:bind() end -]] if customtiles then customspritebatch:clear() customspritebatchfront:clear() - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then customspritebatch:bind() customspritebatchfront:bind() end - ]] end @@ -3850,7 +3823,6 @@ function generatespritebatch() if not tilequads[tilenumber]:getproperty("foreground", cox, coy) then if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then - --[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then if tilenumber <= smbtilecount then smbspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) @@ -3860,19 +3832,17 @@ function generatespritebatch() customspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end else - ]] - if tilenumber <= smbtilecount then - smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + if tilenumber <= smbtilecount then + smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + end end - -- end end else if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then - --[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then if tilenumber <= smbtilecount then smbspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) @@ -3882,15 +3852,14 @@ function generatespritebatch() customspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end else - ]] - if tilenumber <= smbtilecount then - smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + if tilenumber <= smbtilecount then + smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + end end - -- end end end end @@ -3898,7 +3867,6 @@ function generatespritebatch() end end ---[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW --Unbind spritebatches if loveVersion <= 9 then smbspritebatch:unbind() @@ -3912,7 +3880,6 @@ function generatespritebatch() customspritebatchfront:unbind() end end -]] end function game_keypressed(key) @@ -3992,7 +3959,11 @@ function game_keypressed(key) if pausemenuoptions[pausemenuselected] == "resume" then pausemenuopen = false saveconfig() - love.audio.play(paused) + if loveVersion >= 11 then + love.audio.play(paused) + else + love.audio.resume() + end elseif pausemenuoptions[pausemenuselected] == "suspend" then suspendprompt = true pausemenuselected2 = 1 @@ -4006,7 +3977,11 @@ function game_keypressed(key) elseif key == "escape" then pausemenuopen = false saveconfig() - love.audio.play(paused) + if loveVersion >= 11 then + love.audio.play(paused) + else + love.audio.resume() + end elseif (key == "right" or key == "d") then if pausemenuoptions[pausemenuselected] == "music volume" then volumemusic = math.min(1, volumemusic + 0.1) @@ -4961,13 +4936,11 @@ function savemap(filename) --preview previewimg = renderpreview() --- if loveVersion > 9 then - previewimg:encode("png", "mappacks/" .. mappack .. "/" .. filename .. ".png") ---[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW + if loveVersion > 9 then + previewimg:encode("png", "mappacks/" .. mappack .. "/" .. filename .. ".png") else previewimg:encode("mappacks/" .. mappack .. "/" .. filename .. ".png") end -]] print("Map saved as " .. "mappacks/" .. filename .. ".txt") notice.new("Map saved!", notice.white, 2) @@ -4995,10 +4968,10 @@ function renderpreview() local id = map[x][y+yadd][1] if id ~= nil and id ~= 0 and rgblist[id] and tilequads[id]:getproperty("invisible", x, y+yadd) == false then local r, g, b = unpack(rgblist[id]) - out:setPixel(x-1, y-1, r, g, b, 1) + out:setPixel(x-1, y-1, r, g, b, COLORCONVERT) else local r, g, b = unpack(background) - out:setPixel(x-1, y-1, r, g, b, 1) + out:setPixel(x-1, y-1, r, g, b, COLORCONVERT) end end end diff --git a/main.lua b/main.lua index 21d2c64..192a367 100644 --- a/main.lua +++ b/main.lua @@ -26,17 +26,21 @@ function love.run() --I can't believe I had to write this function in the first place local function updateVersion() - local major, minor, revision, codename = love.getVersion() - if major > 0 then - return major + if love.getVersion then + local major, minor, revision, codename = love.getVersion() + if major > 0 then + return major + else + return minor + end else - return minor + return love._version_minor end end loveVersion = updateVersion() ---[[ COMPATABILITY FOR LOVE2D 0.8.X + COLORCONVERT = loveVersion < 11 and 1 or 255 if loveVersion < 9 then --Cheap af but I don't care, COMPATIBILITY!!! @@ -73,7 +77,6 @@ function love.run() love.mouse.setGrabbed = love.mouse.setGrab end -]] love.math.setRandomSeed(os.time()) for i=1, 2 do @@ -106,20 +109,22 @@ function love.run() love.graphics.origin() --Fullscreen hack if not mkstation and fullscreen and gamestate ~= "intro" then - --[[ COMPATABILITY FOR LOVE2D 0.9.X AND BELOW if loveVersion <= 9 then completecanvas:clear() else - ]] - love.graphics.setCanvas(completecanvas) - love.graphics.clear() - -- end + love.graphics.setCanvas{completecanvas, stencil=true} + love.graphics.clear() + end love.graphics.setScissor() - completecanvas:renderTo(love.draw) + -- Can't use Canvas:renderTo() anymore since 11.1 requires setting the stencil flag to use stencils + love.graphics.setCanvas{completecanvas, stencil=true} + love.draw() + love.graphics.setCanvas() + love.graphics.setScissor() - -- if loveVersion > 9 then + if loveVersion > 9 then love.graphics.setCanvas() - -- end + end if fullscreenmode == "full" then love.graphics.draw(completecanvas, 0, 0, 0, desktopsize.width/(width*16*scale), desktopsize.height/(height*16*scale)) else @@ -327,13 +332,54 @@ function love.load(arg) return lmisDown(button) end end + if loveVersion < 11 then + lgsetColor = love.graphics.setColor + function love.graphics.setColor(...) + local args = {...} + local newColors = {} + if type(args[1]) == "table" then + args = args[1] + end + for i=1, #args do + table.insert(newColors, args[i] * 255) + end + return lgsetColor(unpack(newColors)) + end + lgsetBackgroundColor = love.graphics.setBackgroundColor + function love.graphics.setBackgroundColor(...) + local args = {...} + local newColors = {} + if type(args[1]) == "table" then + args = args[1] + end + for i=1, #args do + table.insert(newColors, args[i] * 255) + end + return lgsetBackgroundColor(unpack(newColors)) + end + lggetBackgroundColor = love.graphics.getBackgroundColor + function love.graphics.getBackgroundColor() + local rgba = {lggetBackgroundColor()} + for i=1, #rgba do + rgba[i] = rgba[i] / 255 + end + return unpack(rgba) + end + function love.filesystem.getInfo(path, mode) + if not mode then + return love.filesystem.exists(path) + elseif mode == "directory" then + return love.filesystem.isDirectory(path) + else + return love.filesystem.isFile(path) + end + end + end iconimg = love.image.newImageData("graphics/icon.png") ---[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then iconimg = love.graphics.newImage("graphics/icon.png") end -]] love.window.setIcon(iconimg) love.graphics.setDefaultFilter("nearest", "nearest") @@ -949,13 +995,11 @@ function love.load(arg) soundlist[v] = {} soundlist[v].source = love.audio.newSource("sounds/" .. v .. ".ogg", "stream") soundlist[v].lastplayed = 0 - --[[ COMPATABILITY FOR LOVE2D 0.8.X if loveVersion < 9 then soundlist[v].isPlaying = function (self) return not self:isStopped() end end - ]] end soundlist["scorering"].source:setLooping(true) @@ -1594,7 +1638,7 @@ function changescale(s, init) return end - if love.graphics.isSupported("canvas") then + if loveVersion >= 10 or love.graphics.isSupported("canvas") then fullscreen = true end @@ -1622,11 +1666,10 @@ function changescale(s, init) love.window.setMode(width*16*scale, height*16*scale, {fullscreen=fullscreen, vsync=vsync--[[, fsaa=fsaa]]}) --25x14 blocks (15 blocks actual height) end --- COMPATABILITY FOR LOVE2D 0.8.X --- if loveVersion > 9 or love.graphics.isSupported("canvas") then - completecanvas = love.graphics.newCanvas() - completecanvas:setFilter("linear", "linear") --- end + if loveVersion > 9 or love.graphics.isSupported("canvas") then + completecanvas = love.graphics.newCanvas() + completecanvas:setFilter("linear", "linear") + end gamewidth, gameheight = love.window.getMode() if shaders then @@ -1885,7 +1928,7 @@ function newRecoloredImage(path, tablein, tableout) for x = 0, width-1 do local oldr, oldg, oldb, olda = imagedata:getPixel(x, y) - if olda > 0.5 then + if olda > 0.5*COLORCONVERT then for i = 1, #tablein do if oldr == tablein[i][1] and oldg == tablein[i][2] and oldb == tablein[i][3] then local r, g, b = unpack(tableout[i]) @@ -1932,7 +1975,7 @@ function getaveragecolor(imgdata, cox, coy) for x = xstart, xstart+15 do for y = ystart, ystart+15 do local pr, pg, pb, a = imgdata:getPixel(x, y) - if a > 0.5 then + if a > 0.5*COLORCONVERT then r, g, b = r+pr, g+pg, b+pb count = count + 1 end diff --git a/quad.lua b/quad.lua index bde1f35..1efd3a6 100644 --- a/quad.lua +++ b/quad.lua @@ -39,91 +39,91 @@ function getquadprops(imgdata, x, y) --get collision self.collision = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.collision = true end --get invisible self.invisible = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+1) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.invisible = true end --get breakable self.breakable = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+2) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.breakable = true end --get coinblock self.coinblock = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+3) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.coinblock = true end --get coin self.coin = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+4) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.coin = true end --get not portalable self.portalable = true local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+5) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.portalable = false end --get left slant self.slantupleft = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+6) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.slantupleft = true end --get right slant self.slantupright = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+7) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.slantupright = true end --get mirror self.mirror = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+8) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.mirror = true end --get grate self.grate = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+9) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.grate = true end --get platform self.platform = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+10) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.platform = true end --get watertile self.water = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+11) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.water = true end --get bridge self.bridge = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self.bridge = true end @@ -133,7 +133,7 @@ function getquadprops(imgdata, x, y) local v = t[i] self["spikes" .. v] = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12+i) - if a > 0.5 then + if a > 0.5*COLORCONVERT then self["spikes" .. v] = true end end diff --git a/shaders/init.lua b/shaders/init.lua index 7024886..4afe443 100644 --- a/shaders/init.lua +++ b/shaders/init.lua @@ -69,7 +69,7 @@ local function CreateShaderPass() function pass:predraw() if supported and self.on and self.canvas then --self.canvas.canvas:clear(love.graphics.getBackgroundColor()) - love.graphics.setCanvas(self.canvas.canvas) + love.graphics.setCanvas{self.canvas.canvas, stencil=true} love.graphics.clear(love.graphics.getBackgroundColor()) --0.10.0 return self.canvas.canvas end diff --git a/textentity.lua b/textentity.lua index b55b252..b4ccb7c 100644 --- a/textentity.lua +++ b/textentity.lua @@ -78,7 +78,7 @@ end function textentity:draw() if self.power then - love.graphics.setColor(self.red / 255, self.green / 255, self.blue / 255) + love.graphics.setColor(self.red / COLORCONVERT, self.green / COLORCONVERT, self.blue / COLORCONVERT) properprint(self.text, math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5+0.25)*16*scale)) end end \ No newline at end of file From 00c956fb933bca380ec8d8489ad524ec8cdb96c7 Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 17 Aug 2018 15:16:56 -0500 Subject: [PATCH 07/32] Turned off console again --- conf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.lua b/conf.lua index e644803..5e45eb4 100644 --- a/conf.lua +++ b/conf.lua @@ -4,5 +4,5 @@ function love.conf(t) t.identity = "mari0_se" t.modules.physics = false t.window = false - t.console = true + t.console = false end \ No newline at end of file From 93a82ea2ff481c4d32866e925c9e38ccf8c73399 Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 17 Aug 2018 15:53:00 -0500 Subject: [PATCH 08/32] Minimap colors fixed --- game.lua | 4 ++-- main.lua | 17 +++++++++-------- quad.lua | 28 ++++++++++++++-------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/game.lua b/game.lua index dda1be4..38cb29e 100644 --- a/game.lua +++ b/game.lua @@ -4968,10 +4968,10 @@ function renderpreview() local id = map[x][y+yadd][1] if id ~= nil and id ~= 0 and rgblist[id] and tilequads[id]:getproperty("invisible", x, y+yadd) == false then local r, g, b = unpack(rgblist[id]) - out:setPixel(x-1, y-1, r, g, b, COLORCONVERT) + out:setPixel(x-1, y-1, r * COLORSPACE, g * COLORSPACE, b * COLORSPACE, COLORSPACE) else local r, g, b = unpack(background) - out:setPixel(x-1, y-1, r, g, b, COLORCONVERT) + out:setPixel(x-1, y-1, r * COLORSPACE, g * COLORSPACE, b * COLORSPACE, COLORSPACE) end end end diff --git a/main.lua b/main.lua index 192a367..bdec734 100644 --- a/main.lua +++ b/main.lua @@ -40,6 +40,7 @@ function love.run() loveVersion = updateVersion() + COLORSPACE = loveVersion < 11 and 255 or 1 COLORCONVERT = loveVersion < 11 and 1 or 255 if loveVersion < 9 then @@ -679,7 +680,7 @@ function love.load(arg) for x = 1, width do table.insert(tilequads, quad:new(smbtilesimg, imgdata, x, y, imgwidth, imgheight)) local r, g, b = getaveragecolor(imgdata, x, y) - table.insert(rgblist, {r, g, b}) + table.insert(rgblist, {r / COLORSPACE, g / COLORSPACE, b / COLORSPACE}) end end smbtilecount = width*height @@ -694,7 +695,7 @@ function love.load(arg) for x = 1, width do table.insert(tilequads, quad:new(portaltilesimg, imgdata, x, y, imgwidth, imgheight)) local r, g, b = getaveragecolor(imgdata, x, y) - table.insert(rgblist, {r, g, b}) + table.insert(rgblist, {r / COLORSPACE, g / COLORSPACE, b / COLORSPACE}) end end portaltilecount = width*height @@ -1532,7 +1533,7 @@ function loadcustomimages(path) for x = 1, width do table.insert(tilequads, quad:new(smbtilesimg, imgdata, x, y, imgwidth, imgheight)) local r, g, b = getaveragecolor(imgdata, x, y) - table.insert(rgblist, {r, g, b}) + table.insert(rgblist, {r / COLORSPACE, g / COLORSPACE, b / COLORSPACE}) end end smbtilecount = width*height @@ -1552,7 +1553,7 @@ function loadcustomimages(path) for x = 1, width do table.insert(tilequads, quad:new(portaltilesimg, imgdata, x, y, imgwidth, imgheight)) local r, g, b = getaveragecolor(imgdata, x, y) - table.insert(rgblist, {r, g, b}) + table.insert(rgblist, {r / COLORSPACE, g / COLORSPACE, b / COLORSPACE}) end end portaltilecount = width*height @@ -1928,11 +1929,11 @@ function newRecoloredImage(path, tablein, tableout) for x = 0, width-1 do local oldr, oldg, oldb, olda = imagedata:getPixel(x, y) - if olda > 0.5*COLORCONVERT then + if olda > 0.5*COLORSPACE then for i = 1, #tablein do if oldr == tablein[i][1] and oldg == tablein[i][2] and oldb == tablein[i][3] then local r, g, b = unpack(tableout[i]) - imagedata:setPixel(x, y, r, g, b, olda) + imagedata:setPixel(x, y, r * COLORSPACE, g * COLORSPACE, b * COLORSPACE, olda) end end end @@ -1975,7 +1976,7 @@ function getaveragecolor(imgdata, cox, coy) for x = xstart, xstart+15 do for y = ystart, ystart+15 do local pr, pg, pb, a = imgdata:getPixel(x, y) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then r, g, b = r+pr, g+pg, b+pb count = count + 1 end @@ -2237,7 +2238,7 @@ function loadcustomtiles() for x = 1, width do table.insert(tilequads, quad:new(customtilesimg, imgdata, x, y, imgwidth, imgheight)) local r, g, b = getaveragecolor(imgdata, x, y) - table.insert(rgblist, {r, g, b}) + table.insert(rgblist, {r / COLORSPACE, g / COLORSPACE, b / COLORSPACE}) end end customtilecount = width*height diff --git a/quad.lua b/quad.lua index 1efd3a6..bcb638c 100644 --- a/quad.lua +++ b/quad.lua @@ -39,91 +39,91 @@ function getquadprops(imgdata, x, y) --get collision self.collision = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.collision = true end --get invisible self.invisible = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+1) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.invisible = true end --get breakable self.breakable = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+2) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.breakable = true end --get coinblock self.coinblock = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+3) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.coinblock = true end --get coin self.coin = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+4) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.coin = true end --get not portalable self.portalable = true local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+5) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.portalable = false end --get left slant self.slantupleft = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+6) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.slantupleft = true end --get right slant self.slantupright = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+7) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.slantupright = true end --get mirror self.mirror = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+8) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.mirror = true end --get grate self.grate = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+9) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.grate = true end --get platform self.platform = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+10) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.platform = true end --get watertile self.water = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+11) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.water = true end --get bridge self.bridge = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self.bridge = true end @@ -133,7 +133,7 @@ function getquadprops(imgdata, x, y) local v = t[i] self["spikes" .. v] = false local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+12+i) - if a > 0.5*COLORCONVERT then + if a > 0.5*COLORSPACE then self["spikes" .. v] = true end end From 3f2976635b21064734176e965119a890d00d67fc Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Fri, 17 Aug 2018 23:45:04 -0300 Subject: [PATCH 09/32] =?UTF-8?q?Fixes=20issues=20with=20running=20on=20L?= =?UTF-8?q?=C3=96VE=200.8.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On editor.lua, it tried saving files to a folder that didn't exist if you opened the SMB mappack. On enemy.lua, it had case-sensitivity issues. On several files, added the now-obsolete 0.8 :rewind() call. Changed error handler to redirect to the repository and made it actually display errors on 0.8.x. --- editor.lua | 6 +++++- enemy.lua | 8 ++++++++ game.lua | 3 +++ intro.lua | 6 ++++++ main.lua | 9 +++++---- mario.lua | 15 ++++++++++++++- musicloader.lua | 6 ++++++ 7 files changed, 47 insertions(+), 6 deletions(-) diff --git a/editor.lua b/editor.lua index bdde35f..007be7d 100644 --- a/editor.lua +++ b/editor.lua @@ -2167,7 +2167,11 @@ function saveanimation() animations[currentanimation].actions = out.actions local json = JSON:encode_pretty(out) - love.filesystem.write(animations[currentanimation].filepath, json) + + ok, err = pcall(love.filesystem.write, animations[currentanimation].filepath, json) + if not ok then + print(err .. " - File: " .. animations[currentanimation].filepath) + end end function addanimationtrigger() diff --git a/enemy.lua b/enemy.lua index abd4720..81e985a 100644 --- a/enemy.lua +++ b/enemy.lua @@ -145,6 +145,14 @@ function enemy:init(x, y, t, a) self.firstmovement = self.movement self.firstanimationtype = self.animationtype + + -- Apparently we now have to deal with case sensitivity. + -- This could definitely happen in more places, especially with custom enemies, so keep an eye out. + self.offsetX = self.offsetX or self.offsetx + self.offsetY = self.offsetY or self.offsety + self.quadcenterX = self.quadcenterX or self.quadcenterx + self.quadcenterY = self.quadcenterY or self.quadcentery + self.startoffsetY = self.offsetY self.startquadcenterY = self.quadcenterY self.startoffsetY = self.offsetY diff --git a/game.lua b/game.lua index 38cb29e..78ec5f4 100644 --- a/game.lua +++ b/game.lua @@ -5283,6 +5283,9 @@ function playsound(sound) end soundlist[sound].source:stop() + if loveVersion <= 8 then + soundlist[sound].source:rewind() + end soundlist[sound].source:seek(0) soundlist[sound].source:play() end diff --git a/intro.lua b/intro.lua index 3a5b29a..887762b 100644 --- a/intro.lua +++ b/intro.lua @@ -75,6 +75,9 @@ function intro_mousepressed() return end soundlist["stab"].source:stop() + if loveVersion <= 8 then + soundlist["stab"].source:rewind() + end menu_load() shaders:set(1, shaderlist[currentshaderi1]) shaders:set(2, shaderlist[currentshaderi2]) @@ -85,6 +88,9 @@ function intro_keypressed() return end soundlist["stab"].source:stop() + if loveVersion <= 8 then + soundlist["stab"].source:rewind() + end menu_load() shaders:set(1, shaderlist[currentshaderi1]) shaders:set(2, shaderlist[currentshaderi2]) diff --git a/main.lua b/main.lua index bdec734..89c624c 100644 --- a/main.lua +++ b/main.lua @@ -147,6 +147,7 @@ end function love.errhand(msg) msg = tostring(msg) + uphold(msg) local trace = debug.traceback() local err = {} @@ -155,7 +156,7 @@ function love.errhand(msg) table.insert(err, "Mari0 Over.") table.insert(err, "Crash = Very Yes.\n\n") if not versionerror then - table.insert(err, "Send us a screenshot of this to crash@stabyourself.net, that'd be swell.\nAlso tell us what you were doing.\n") + table.insert(err, "Send us a screenshot of this to https://github.com/HugoBDesigner/Mari0-Community-Edition/issues , that'd be swell.\nAlso tell us what you were doing.\n") end table.insert(err, "Mari0 " .. (marioversion or "UNKNOWN") .. ", LOVE " .. (love._version or "UNKNOWN") .. " running on " .. (love._os or "UNKNOWN") .. "\n") if love.graphics.getRendererInfo then @@ -180,7 +181,7 @@ function love.errhand(msg) return end - if not love.graphics.isCreated() or not love.window.isOpen() then + if not love.graphics.isCreated() or (loveVersion > 8 and not love.window.isOpen()) then local success, status = pcall(love.window.setMode, 800, 600) if not success or not status then return @@ -194,7 +195,7 @@ function love.errhand(msg) love.mouse.setVisible(true) love.mouse.setGrabbed(false) end - if love.joystick then -- Stop all joystick vibrations. + if love.joystick and love.joystick.getJoysticks then -- Stop all joystick vibrations. for i,v in ipairs(love.joystick.getJoysticks()) do v:setVibration() end @@ -2318,4 +2319,4 @@ function mouse.getY() else return love.mouse.getY() end -end +end \ No newline at end of file diff --git a/mario.lua b/mario.lua index ab35499..9068f17 100644 --- a/mario.lua +++ b/mario.lua @@ -541,6 +541,9 @@ function mario:update(dt) if mariotime <= 0 then subtractscore = false soundlist["scorering"].source:stop() + if loveVersion <= 8 then + soundlist["scorering"].source:rewind() + end castleflagmove = true mariotime = 0 end @@ -1092,8 +1095,18 @@ function mario:update(dt) end end - if not self.raccoonjump and self.raccoontimer == 0 and soundlist["planemode"].source:isPlaying() then + local soundPlaying + if loveVersion > 8 then --Love 0.9.x added Source:isPlaying(), so 0.8.x crashed here + soundPlaying = soundlist["planemode"].source:isPlaying() + else + soundPlaying = soundlist["planemode"].source:isStopped() + end + + if not self.raccoonjump and self.raccoontimer == 0 and soundPlaying then soundlist["planemode"].source:stop() + if loveVersion <= 8 then + soundlist["planemode"].source:rewind() + end end if self.raccoonascendtimer > 0 then diff --git a/musicloader.lua b/musicloader.lua index e370ae3..8d312ea 100644 --- a/musicloader.lua +++ b/musicloader.lua @@ -67,6 +67,9 @@ function music:play(name, fast) if self.loaded[name] then if soundenabled then self.loaded[name]:stop() + if loveVersion <= 8 then + self.loaded[name]:rewind() + end self.loaded[name]:seek(0) self.loaded[name]:setVolume(volumemusic or 1) self.loaded[name]:play() @@ -84,6 +87,9 @@ function music:stop(name, fast) if self.loaded[name] then self.loaded[name]:stop() + if loveVersion <= 8 then + self.loaded[name]:rewind() + end end end From 69c1d149451eebb1b64789bba36f44d48cba8c94 Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 18 Aug 2018 00:02:50 -0300 Subject: [PATCH 10/32] Attends to #73 --- conf.lua | 4 ++-- main.lua | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf.lua b/conf.lua index 5e45eb4..59038b7 100644 --- a/conf.lua +++ b/conf.lua @@ -1,8 +1,8 @@ function love.conf(t) - t.title = "Mari0 SE" + t.title = "Mari0: Community Edition" t.author = "Maurice" t.identity = "mari0_se" t.modules.physics = false t.window = false - t.console = false + t.console = true end \ No newline at end of file diff --git a/main.lua b/main.lua index 89c624c..aa06ed4 100644 --- a/main.lua +++ b/main.lua @@ -436,7 +436,7 @@ function love.load(arg) dlclist = {} hatcount = #love.filesystem.getDirectoryItems("graphics/standardhats") saveconfig() - love.window.setTitle( "Mari0 SE" ) + love.window.setTitle( "Mari0: Community Edition" ) love.graphics.setBackgroundColor(0, 0, 0) @@ -1116,7 +1116,8 @@ function love.update(dt) notice.update(dt) - love.window.setTitle("FPS:" .. love.timer.getFPS() .. " - Send feedback/issues to crash@stabyourself.net") + --No longer needed + --love.window.setTitle("FPS:" .. love.timer.getFPS() .. " - Send feedback/issues to crash@stabyourself.net") end end From 2e4cf20bda8f38f145fd6b678e78626716dfb261 Mon Sep 17 00:00:00 2001 From: WillWare Date: Sun, 19 Aug 2018 15:58:58 -0500 Subject: [PATCH 11/32] Fixed portal colors --- main.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.lua b/main.lua index aa06ed4..055875f 100644 --- a/main.lua +++ b/main.lua @@ -1892,7 +1892,6 @@ function round(num, idp) --Not by me end function getrainbowcolor(i) - local whiteness = 1 local r, g, b if i < 1/6 then r = 1 @@ -1920,7 +1919,7 @@ function getrainbowcolor(i) b = (1/6-(i-5/6))*6 end - return {round(r*whiteness), round(g*whiteness), round(b*whiteness), 1} + return {r, g, b, 1} end function newRecoloredImage(path, tablein, tableout) From 6b1ed0ba9b2394410af364d52e3d5805553992cf Mon Sep 17 00:00:00 2001 From: WillWare Date: Sun, 19 Aug 2018 16:07:03 -0500 Subject: [PATCH 12/32] Disable console by default --- conf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.lua b/conf.lua index 59038b7..4f40ff1 100644 --- a/conf.lua +++ b/conf.lua @@ -4,5 +4,5 @@ function love.conf(t) t.identity = "mari0_se" t.modules.physics = false t.window = false - t.console = true + t.console = false end \ No newline at end of file From 0e0a38df3a07dec0d4b19236237a14489e4235a9 Mon Sep 17 00:00:00 2001 From: WillWare Date: Mon, 20 Aug 2018 02:18:34 -0500 Subject: [PATCH 13/32] Temporary fix for 11.1 issue with streaming audio See https://love2d.org/forums/viewtopic.php?f=4&t=85356&p=222590 --- main.lua | 4 +++- musicloader.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.lua b/main.lua index 055875f..ea99929 100644 --- a/main.lua +++ b/main.lua @@ -43,6 +43,8 @@ function love.run() COLORSPACE = loveVersion < 11 and 255 or 1 COLORCONVERT = loveVersion < 11 and 1 or 255 + MUSICFIX = loveVersion < 11 and "static" or "stream" + if loveVersion < 9 then --Cheap af but I don't care, COMPATIBILITY!!! love.math = {} @@ -995,7 +997,7 @@ function love.load(arg) for i, v in pairs(soundstoload) do soundlist[v] = {} - soundlist[v].source = love.audio.newSource("sounds/" .. v .. ".ogg", "stream") + soundlist[v].source = love.audio.newSource("sounds/" .. v .. ".ogg", MUSICFIX) soundlist[v].lastplayed = 0 if loveVersion < 9 then soundlist[v].isPlaying = function (self) diff --git a/musicloader.lua b/musicloader.lua index 8d312ea..0d4a5a9 100644 --- a/musicloader.lua +++ b/musicloader.lua @@ -36,7 +36,7 @@ function music:load(name) end if not self.loaded[filepath] then - local loaded, source = pcall(love.audio.newSource, filepath, "stream") + local loaded, source = pcall(love.audio.newSource, filepath, MUSICFIX) if loaded then -- all music should loop source:setLooping(true) From a5e700c3e3dddb8abebb25cff692d64cef581e4c Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 24 Aug 2018 18:06:13 -0500 Subject: [PATCH 14/32] Removed support for 0.8.0 --- actionblock.lua | 2 +- blockdebris.lua | 2 +- bowser.lua | 2 +- button.lua | 8 ++-- editor.lua | 26 +++++------ emancipateanimation.lua | 2 +- faithplate.lua | 10 ++--- firework.lua | 2 +- funnel.lua | 8 ++-- game.lua | 99 ++++++++++++++++------------------------- groundlight.lua | 2 +- gui.lua | 2 +- intro.lua | 8 +--- itemanimation.lua | 2 +- magic.lua | 2 +- main.lua | 55 ++--------------------- mario.lua | 14 ++---- menu.lua | 4 +- miniblock.lua | 2 +- musicloader.lua | 7 +-- panel.lua | 2 +- portal.lua | 2 +- pushbutton.lua | 2 +- rainboom.lua | 38 +++++++++++++++- seesaw.lua | 14 +++--- shaders/init.lua | 6 +-- spring.lua | 2 +- vine.lua | 4 +- wallindicator.lua | 2 +- walltimer.lua | 2 +- 30 files changed, 140 insertions(+), 193 deletions(-) diff --git a/actionblock.lua b/actionblock.lua index 2c38c49..d7c7aa8 100644 --- a/actionblock.lua +++ b/actionblock.lua @@ -43,7 +43,7 @@ function actionblock:draw() if self.state == "on" then q = 2 end - love.graphics.drawq(actionblockimg, wallindicatorquad[q], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-.5-yscroll-bounceyoffset)*16*scale), 0, scale, scale) + love.graphics.draw(actionblockimg, wallindicatorquad[q], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-.5-yscroll-bounceyoffset)*16*scale), 0, scale, scale) end function actionblock:floorcollide(a, b, c, d) diff --git a/blockdebris.lua b/blockdebris.lua index 6e20003..df6cd6f 100644 --- a/blockdebris.lua +++ b/blockdebris.lua @@ -36,5 +36,5 @@ function blockdebris:update(dt) end function blockdebris:draw() - love.graphics.drawq(blockdebrisimg, blockdebrisquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5)*16*scale), 0, scale, scale, 4, 4) + love.graphics.draw(blockdebrisimg, blockdebrisquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5)*16*scale), 0, scale, scale, 4, 4) end diff --git a/bowser.lua b/bowser.lua index 891dfe1..8426663 100644 --- a/bowser.lua +++ b/bowser.lua @@ -149,7 +149,7 @@ function bowser:draw() --just for the hammers if not self.fall and not self.backwards then if self.hammertimer > self.hammertime - bowserhammerdrawtime then - love.graphics.drawq(enemiesdata["hammer"].graphic, enemiesdata["hammer"].quad, math.floor((self.x-xscroll)*16*scale), (self.y-yscroll-.5-11/16)*16*scale, 0, scale, scale) + love.graphics.draw(enemiesdata["hammer"].graphic, enemiesdata["hammer"].quad, math.floor((self.x-xscroll)*16*scale), (self.y-yscroll-.5-11/16)*16*scale, 0, scale, scale) end end end diff --git a/button.lua b/button.lua index 3547858..ea52447 100644 --- a/button.lua +++ b/button.lua @@ -123,13 +123,13 @@ function button:draw() end if self.dir == "down" then - love.graphics.drawq(buttonimg, buttonquad[quad], math.floor((self.x-1/16-xscroll)*16*scale), ((self.y-yscroll)*16-10)*scale, 0, scale, scale) + love.graphics.draw(buttonimg, buttonquad[quad], math.floor((self.x-1/16-xscroll)*16*scale), ((self.y-yscroll)*16-10)*scale, 0, scale, scale) elseif self.dir == "left" then - love.graphics.drawq(buttonimg, buttonquad[quad], math.floor((self.x+4/16-xscroll)*16*scale), ((self.y-yscroll)*16-21)*scale, math.pi/2, scale, scale) + love.graphics.draw(buttonimg, buttonquad[quad], math.floor((self.x+4/16-xscroll)*16*scale), ((self.y-yscroll)*16-21)*scale, math.pi/2, scale, scale) elseif self.dir == "right" then - love.graphics.drawq(buttonimg, buttonquad[quad], math.floor((self.x+10/16-xscroll)*16*scale), ((self.y-yscroll)*16+11)*scale, -math.pi/2, scale, scale) + love.graphics.draw(buttonimg, buttonquad[quad], math.floor((self.x+10/16-xscroll)*16*scale), ((self.y-yscroll)*16+11)*scale, -math.pi/2, scale, scale) elseif self.dir == "up" then - love.graphics.drawq(buttonimg, buttonquad[quad], math.floor((self.x+31/16-xscroll)*16*scale), ((self.y-yscroll)*16-16)*scale, math.pi, scale, scale) + love.graphics.draw(buttonimg, buttonquad[quad], math.floor((self.x+31/16-xscroll)*16*scale), ((self.y-yscroll)*16-16)*scale, math.pi, scale, scale) end end diff --git a/editor.lua b/editor.lua index 007be7d..48a69b8 100644 --- a/editor.lua +++ b/editor.lua @@ -846,10 +846,10 @@ function editor_draw() -- well, do nothing -- or better: draw empty tiles almost transparent love.graphics.setColor(1, 1, 1, 0.03) - love.graphics.drawq(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) + love.graphics.draw(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) else love.graphics.setColor(1, 1, 1, 0.3) - love.graphics.drawq(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) + love.graphics.draw(tilequads[w].image, quad, math.floor((x-xscroll-1 + pastecenter[1])*16*scale+(i-1)*16*scale), ((y-yscroll-1 + pastecenter[2])*16+8)*scale+((j-1)*16*scale), 0, scale, scale) end end end @@ -869,7 +869,7 @@ function editor_draw() local quad = tilequads[currenttile]:quad() --[[tilequads[w].quad]] if w[1] == mousetile then --print(i,j,w[1],"SWITCHED") - love.graphics.drawq(tilequads[currenttile].image, quad, (i-1)*16*scale-xscroll*16*scale, (((j-1)*16*scale)-8*scale)-yscroll*16*scale, 0, scale, scale) + love.graphics.draw(tilequads[currenttile].image, quad, (i-1)*16*scale-xscroll*16*scale, (((j-1)*16*scale)-8*scale)-yscroll*16*scale, 0, scale, scale) end end end @@ -974,7 +974,7 @@ function editor_draw() if loveVersion > 9 then love.graphics.setStencilTest("greater", 0) end - love.graphics.drawq(v.graphic, v.quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) + love.graphics.draw(v.graphic, v.quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) if loveVersion > 9 then love.graphics.setStencilTest() @@ -1009,7 +1009,7 @@ function editor_draw() if w.i == currenttile then love.graphics.setColor(1, 1, 1, 0.8) end - love.graphics.drawq(entityquads[w.i].image, entityquads[w.i].quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) + love.graphics.draw(entityquads[w.i].image, entityquads[w.i].quad, (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) if w.i == currenttile then love.graphics.setColor(1, 0, 0, 0.6) drawrectangle((math.mod((i-1), 22)-offx)*17+cox*16, (math.floor((i-1)/22)-offy)*17+coy*16-9, 18, 18) @@ -1026,7 +1026,7 @@ function editor_draw() if i == currenttile then love.graphics.setColor(1, 1, 1, 0.8) end - love.graphics.drawq(tilequads[i].image, tilequads[i]:quad(), (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) + love.graphics.draw(tilequads[i].image, tilequads[i]:quad(), (math.mod((i-1), 22)-offx)*17*scale+cox*16*scale+scale, (math.floor((i-1)/22)-offy)*17*scale+coy*16*scale-8*scale, 0, scale, scale) if i == currenttile then love.graphics.setColor(1, 0, 0, 0.6) drawrectangle((math.mod((i-1), 22)-offx)*17+cox*16, (math.floor((i-1)/22)-offy)*17+coy*16-9, 18, 18) @@ -1047,13 +1047,13 @@ function editor_draw() end for t1 = 1, brush[1] do for t2 = 1, brush[2] do - love.graphics.drawq(tilequads[currenttile].image, quad, math.floor((cox-xscroll-1+(t1-1))*16*scale), math.floor(((coy-yscroll-1+(t2-1))*16+8)*scale), 0, scale, scale) + love.graphics.draw(tilequads[currenttile].image, quad, math.floor((cox-xscroll-1+(t1-1))*16*scale), math.floor(((coy-yscroll-1+(t2-1))*16+8)*scale), 0, scale, scale) end end elseif editenemies == false then for t1 = 1, brush[1] do for t2 = 1, brush[2] do - love.graphics.drawq(entityquads[currenttile].image, entityquads[currenttile].quad, math.floor((cox-xscroll-1+(t1-1))*16*scale), math.floor(((coy-yscroll-1+(t2-1))*16+8)*scale), 0, scale, scale) + love.graphics.draw(entityquads[currenttile].image, entityquads[currenttile].quad, math.floor((cox-xscroll-1+(t1-1))*16*scale), math.floor(((coy-yscroll-1+(t2-1))*16+8)*scale), 0, scale, scale) end end else @@ -1061,7 +1061,7 @@ function editor_draw() local xoff, yoff = (((v.spawnoffsetx or 0)+v.width/2-.5)*16 - v.offsetX + v.quadcenterX)*scale, (((v.spawnoffsety or 0)-v.height+1)*16-v.offsetY - v.quadcenterY)*scale for t1 = 1, brush[1] do for t2 = 1, brush[2] do - love.graphics.drawq(v.graphic, v.quad, math.floor((cox-xscroll-1+(t1-1))*16*scale+xoff), math.floor(((coy-yscroll+(t2-1))*16)*scale+yoff), 0, scale, scale) + love.graphics.draw(v.graphic, v.quad, math.floor((cox-xscroll-1+(t1-1))*16*scale+xoff), math.floor(((coy-yscroll+(t2-1))*16)*scale+yoff), 0, scale, scale) end end end @@ -1321,7 +1321,7 @@ function editor_draw() love.graphics.setStencilTest("greater", 0) end - love.graphics.drawq(v.graphic, v.quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) + love.graphics.draw(v.graphic, v.quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) if loveVersion > 9 then love.graphics.setStencilTest() else @@ -1333,7 +1333,7 @@ function editor_draw() for i, v in ipairs(entitylistitems) do properprint(v.t, (5)*scale, (v.entries[1].y+30)*scale-tilesoffset) for j, k in ipairs(v.entries) do - love.graphics.drawq(entityquads[k.i].image, entityquads[k.i].quad, (k.x+5)*scale, (k.y+38)*scale-tilesoffset, 0, scale, scale) + love.graphics.draw(entityquads[k.i].image, entityquads[k.i].quad, (k.x+5)*scale, (k.y+38)*scale-tilesoffset, 0, scale, scale) if k:gethighlight(mouse.getX(), mouse.getY()) then love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", (k.x+5)*scale, (k.y+38)*scale-tilesoffset, 16*scale, 16*scale) @@ -1345,11 +1345,11 @@ function editor_draw() else if animatedtilelist then for i = 1, tilelistcount+1 do - love.graphics.drawq(tilequads[i+tileliststart-1+10000].image, tilequads[i+tileliststart-1+10000]:quad(), math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) + love.graphics.draw(tilequads[i+tileliststart-1+10000].image, tilequads[i+tileliststart-1+10000]:quad(), math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) end else for i = 1, tilelistcount+1 do - love.graphics.drawq(tilequads[i+tileliststart-1].image, tilequads[i+tileliststart-1]:quad(), math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) + love.graphics.draw(tilequads[i+tileliststart-1].image, tilequads[i+tileliststart-1]:quad(), math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale) end end end diff --git a/emancipateanimation.lua b/emancipateanimation.lua index 1dfebe4..a387586 100644 --- a/emancipateanimation.lua +++ b/emancipateanimation.lua @@ -58,7 +58,7 @@ function emancipateanimation:draw() love.graphics.setColor(black, black, black, a) if self.quad then - love.graphics.drawq(self.img, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor(((self.y-yscroll)*16-self.offsetY)*scale), self.rotation, scale, scale, self.quadcenterX, self.quadcenterY) + love.graphics.draw(self.img, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor(((self.y-yscroll)*16-self.offsetY)*scale), self.rotation, scale, scale, self.quadcenterX, self.quadcenterY) else love.graphics.draw(self.img, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor(((self.y-yscroll)*16-self.offsetY)*scale), self.rotation, scale, scale, self.quadcenterX, self.quadcenterY) end diff --git a/faithplate.lua b/faithplate.lua index 50359c6..623617f 100644 --- a/faithplate.lua +++ b/faithplate.lua @@ -143,7 +143,7 @@ function faithplate:draw() rot = math.pi/4*(1 - (self.animationtimer-0.3)/0.7) end - love.graphics.drawq(faithplateplateimg, faithplatequad[quad], math.floor((self.cox+1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, rot, scale, scale, 32) + love.graphics.draw(faithplateplateimg, faithplatequad[quad], math.floor((self.cox+1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, rot, scale, scale, 32) elseif self.dir == "left" then local rot = 0 if self.animationtimer < 0.1 then @@ -154,7 +154,7 @@ function faithplate:draw() rot = math.pi/4*(1 - (self.animationtimer-0.3)/0.7) end - love.graphics.drawq(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, -rot, -scale, scale, 32) + love.graphics.draw(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, -rot, -scale, scale, 32) elseif self.dir == "up" then local ymod = 0 if self.animationtimer < 0.1 then @@ -165,13 +165,13 @@ function faithplate:draw() ymod = .5*(1 - (self.animationtimer-0.3)/0.7) end - love.graphics.drawq(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5-ymod)*16*scale, 0, scale, scale) + love.graphics.draw(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5-ymod)*16*scale, 0, scale, scale) end else if self.dir ~= "left" then - love.graphics.drawq(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(faithplateplateimg, faithplatequad[quad], math.floor((self.cox-1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, scale, scale) else - love.graphics.drawq(faithplateplateimg, faithplatequad[quad], math.floor((self.cox+1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, -scale, scale) + love.graphics.draw(faithplateplateimg, faithplatequad[quad], math.floor((self.cox+1-xscroll)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, -scale, scale) end end diff --git a/firework.lua b/firework.lua index b665224..89f088f 100644 --- a/firework.lua +++ b/firework.lua @@ -29,5 +29,5 @@ function fireworkboom:draw() frame = 7 end - love.graphics.drawq(fireballimg, fireballquad[frame], math.floor((self.x-xscroll)*16*scale), (self.y-yscroll-0.5)*16*scale, 0, scale, scale, 8, 8) + love.graphics.draw(fireballimg, fireballquad[frame], math.floor((self.x-xscroll)*16*scale), (self.y-yscroll-0.5)*16*scale, 0, scale, scale, 8, 8) end \ No newline at end of file diff --git a/funnel.lua b/funnel.lua index 1e1f5b4..5063b3e 100644 --- a/funnel.lua +++ b/funnel.lua @@ -296,13 +296,13 @@ function funnel:draw() love.graphics.setColor(1, 1, 1) if self.dir == "right" then - love.graphics.drawq(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll-1)*16*scale), math.floor((self.coy-yscroll-1.5)*16*scale), 0, scale, scale) + love.graphics.draw(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll-1)*16*scale), math.floor((self.coy-yscroll-1.5)*16*scale), 0, scale, scale) elseif self.dir == "left" then - love.graphics.drawq(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll)*16*scale), math.floor((self.coy-yscroll+.5)*16*scale), math.pi, scale, scale) + love.graphics.draw(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll)*16*scale), math.floor((self.coy-yscroll+.5)*16*scale), math.pi, scale, scale) elseif self.dir == "up" then - love.graphics.drawq(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll-1)*16*scale), math.floor((self.coy-yscroll-.5)*16*scale), -math.pi/2, scale, scale) + love.graphics.draw(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll-1)*16*scale), math.floor((self.coy-yscroll-.5)*16*scale), -math.pi/2, scale, scale) elseif self.dir == "down" then - love.graphics.drawq(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll+1)*16*scale), math.floor((self.coy-yscroll-1.5)*16*scale), math.pi/2, scale, scale) + love.graphics.draw(excursionbaseimg, excursionquad[self.quad], math.floor((self.cox-xscroll+1)*16*scale), math.floor((self.coy-yscroll-1.5)*16*scale), math.pi/2, scale, scale) end end diff --git a/game.lua b/game.lua index 78ec5f4..b7c85dd 100644 --- a/game.lua +++ b/game.lua @@ -892,12 +892,12 @@ function drawlevel() local tilenumber = t[1] if tilequads[tilenumber]:getproperty("coinblock", cox, coy) and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false then --coinblock - love.graphics.drawq(coinblockimg, coinblockquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) + love.graphics.draw(coinblockimg, coinblockquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) elseif coinmap[cox][coy] then --coin - love.graphics.drawq(coinimg, coinquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) + love.graphics.draw(coinimg, coinquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) elseif bounceyoffset ~= 0 or tilenumber > 10000 then if not tilequads[tilenumber]:getproperty("invisible", cox, coy) then - love.graphics.drawq(tilequads[tilenumber].image, tilequads[tilenumber]:quad(flooredxscroll+x, flooredyscroll+y), math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) + love.graphics.draw(tilequads[tilenumber].image, tilequads[tilenumber]:quad(flooredxscroll+x, flooredyscroll+y), math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1)-bounceyoffset)*16-8)*scale), 0, scale, scale) end end @@ -938,7 +938,7 @@ function drawlevel() if editormode then if tilequads[t[1]]:getproperty("invisible", cox, coy) and t[1] ~= 1 then - love.graphics.drawq(tilequads[t[1]].image, tilequads[t[1]]:quad(), math.floor((x-1-math.mod(xscroll, 1))*16*scale), ((y-1-math.mod(yscroll, 1))*16-8)*scale, 0, scale, scale) + love.graphics.draw(tilequads[t[1]].image, tilequads[t[1]]:quad(), math.floor((x-1-math.mod(xscroll, 1))*16*scale), ((y-1-math.mod(yscroll, 1))*16-8)*scale, 0, scale, scale) end if #t > 1 and t[2] ~= "link" then @@ -957,9 +957,9 @@ function drawlevel() love.graphics.setColor(1, 0, 0, alpha) love.graphics.rectangle("fill", math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 16*scale, 16*scale) love.graphics.setColor(1, 1, 1, alpha) - love.graphics.drawq(v.graphic, v.quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale+xoff), math.floor(((y-1-math.mod(yscroll, 1))*16)*scale+yoff), 0, scale, scale) + love.graphics.draw(v.graphic, v.quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale+xoff), math.floor(((y-1-math.mod(yscroll, 1))*16)*scale+yoff), 0, scale, scale) else - love.graphics.drawq(entityquads[tilenumber].image, entityquads[tilenumber].quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) + love.graphics.draw(entityquads[tilenumber].image, entityquads[tilenumber].quad, math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) end love.graphics.setColor(1, 1, 1, 1) end @@ -1016,7 +1016,7 @@ function drawui(hidetime) printfunction("*", uispace*1.5-8*scale, 16*scale) - love.graphics.drawq(coinanimationimg, coinanimationquads[spriteset][coinframe], uispace*1.5-16*scale, 16*scale, 0, scale, scale) + love.graphics.draw(coinanimationimg, coinanimationquads[spriteset][coinframe], uispace*1.5-16*scale, 16*scale, 0, scale, scale) printfunction(addzeros(mariocoincount, 2), uispace*1.5-0*scale, 16*scale) printfunction("world", uispace*2.5 - 20*scale, 8*scale) @@ -1110,12 +1110,12 @@ function drawforeground() if tilequads[tilenumber]:getproperty("foreground", cox, coy) then if tilequads[tilenumber]:getproperty("coinblock", cox, coy) and not tilequads[tilenumber]:getproperty("invisible", cox, coy) then --coinblock - love.graphics.drawq(coinblockimg, coinblockquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) + love.graphics.draw(coinblockimg, coinblockquads[spriteset][coinframe], math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) elseif coinmap[x][y] then --coin - love.graphics.drawq(coinimg, coinquads[spriteset][coinframe], math.floor((x-1-xscroll)*16*scale), math.floor(((y-1-yscroll)*16-8)*scale), 0, scale, scale) + love.graphics.draw(coinimg, coinquads[spriteset][coinframe], math.floor((x-1-xscroll)*16*scale), math.floor(((y-1-yscroll)*16-8)*scale), 0, scale, scale) elseif tilenumber > 10000 then if not tilequads[tilenumber]:getproperty("invisible", cox, coy) then - love.graphics.drawq(tilequads[tilenumber].image, tilequads[tilenumber]:quad(flooredxscroll+x, flooredyscroll+y), math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) + love.graphics.draw(tilequads[tilenumber].image, tilequads[tilenumber]:quad(flooredxscroll+x, flooredyscroll+y), math.floor((x-1-math.mod(xscroll, 1))*16*scale), math.floor(((y-1-math.mod(yscroll, 1))*16-8)*scale), 0, scale, scale) end end @@ -1295,7 +1295,7 @@ function game_draw() love.graphics.setColor(1, 1, 1) --axe if axex then - love.graphics.drawq(axeimg, axequads[coinframe], math.floor((axex-1-xscroll)*16*scale), (axey-1.5-yscroll)*16*scale, 0, scale, scale) + love.graphics.draw(axeimg, axequads[coinframe], math.floor((axex-1-xscroll)*16*scale), (axey-1.5-yscroll)*16*scale, 0, scale, scale) end love.graphics.setColor(1, 1, 1) @@ -1533,11 +1533,11 @@ function game_draw() else love.graphics.setColor(1, 1, 1) end - love.graphics.drawq(v.graphic[k], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[k], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end else if v.graphic and v.quad then - love.graphics.drawq(v.graphic, v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic, v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end @@ -1570,11 +1570,11 @@ function game_draw() if type(v.graphic) == "table" then if v.graphic[0] then love.graphics.setColor(1, 1, 1) - love.graphics.drawq(v.graphic[0], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[0], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot then love.graphics.setColor(unpack(v["portal" .. (v.lastportal or 1) .. "color"])) - love.graphics.drawq(v.graphic["dot"], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic["dot"], v.quad, math.floor(((v.x-xscroll)*16+v.offsetX)*scale), math.floor(((v.y-yscroll)*16-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end @@ -1631,10 +1631,10 @@ function game_draw() else love.graphics.setColor(1, 1, 1) end - love.graphics.drawq(v.graphic[k], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[k], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end else - love.graphics.drawq(v.graphic, v.quad, math.ceil(((px-xscroll)*16+v.offsetX)*scale), math.ceil(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic, v.quad, math.ceil(((px-xscroll)*16+v.offsetX)*scale), math.ceil(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end --HAAAATS @@ -1665,11 +1665,11 @@ function game_draw() if type(v.graphic) == "table" then if v.graphic[0] then love.graphics.setColor(1, 1, 1) - love.graphics.drawq(v.graphic[0], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[0], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot and v.lastportal then love.graphics.setColor(unpack(v["portal" .. v.lastportal .. "color"])) - love.graphics.drawq(v.graphic["dot"], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic["dot"], v.quad, math.floor(((px-xscroll)*16+v.offsetX)*scale), math.floor(((py-yscroll)*16-v.offsetY)*scale), pr, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end end @@ -1788,7 +1788,7 @@ function game_draw() --COINBLOCKanimation for i, v in pairs(coinblockanimations) do - love.graphics.drawq(coinblockanimationimg, coinblockanimationquads[coinblockanimations[i].frame], math.floor((coinblockanimations[i].x - xscroll)*16*scale), math.floor(((coinblockanimations[i].y-yscroll)*16-8)*scale), 0, scale, scale, 4, 54) + love.graphics.draw(coinblockanimationimg, coinblockanimationquads[coinblockanimations[i].frame], math.floor((coinblockanimations[i].x - xscroll)*16*scale), math.floor(((coinblockanimations[i].y-yscroll)*16-8)*scale), 0, scale, scale, 4, 54) end --SCROLLING SCORE @@ -2230,7 +2230,7 @@ function game_draw() img = customtilesimg end - love.graphics.drawq(img, tilequads[tilenumber]:quad(), math.floor((x-1-v.x-6/16)*16*scale+playerx*scale), math.floor((y-1.5-v.y)*16*scale+playery*scale), 0, scale, scale) + love.graphics.draw(img, tilequads[tilenumber]:quad(), math.floor((x-1-v.x-6/16)*16*scale+playerx*scale), math.floor((y-1.5-v.y)*16*scale+playery*scale), 0, scale, scale) end end end @@ -2566,12 +2566,12 @@ function drawplayer(i, x, y, cscale, offsetX, offsetY, rotation, quadcenterX else love.graphics.setColor(1, 1, 1) end - love.graphics.drawq(v.graphic[k], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[k], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end else if v.graphic and v.quad then love.graphics.setColor(1, 1, 1) - love.graphics.drawq(v.graphic, v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic, v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end @@ -2611,11 +2611,11 @@ function drawplayer(i, x, y, cscale, offsetX, offsetY, rotation, quadcenterX if type(v.graphic) == "table" then if v.graphic[0] then love.graphics.setColor(1, 1, 1) - love.graphics.drawq(v.graphic[0], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic[0], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end if v.graphic.dot then love.graphics.setColor(unpack(v["portal" .. v.lastportal .. "color"])) - love.graphics.drawq(v.graphic["dot"], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) + love.graphics.draw(v.graphic["dot"], v.quad, math.floor((x+v.offsetX)*scale), math.floor((y-v.offsetY)*scale), v.rotation, dirscale, horscale, v.quadcenterX, v.quadcenterY) end end end @@ -3823,42 +3823,22 @@ function generatespritebatch() if not tilequads[tilenumber]:getproperty("foreground", cox, coy) then if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then - if loveVersion < 9 then - if tilenumber <= smbtilecount then - smbspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatch:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end - else - if tilenumber <= smbtilecount then - smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end + if tilenumber <= smbtilecount then + smbspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatch:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end end else if tilenumber ~= 0 and tilequads[tilenumber]:getproperty("invisible", cox, coy) == false and tilequads[tilenumber]:getproperty("coinblock", cox, coy) == false then - if loveVersion < 9 then - if tilenumber <= smbtilecount then - smbspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatchfront:addq( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end - else - if tilenumber <= smbtilecount then - smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount then - portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then - customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) - end + if tilenumber <= smbtilecount then + smbspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount then + portalspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) + elseif tilenumber <= smbtilecount+portaltilecount+customtilecount then + customspritebatchfront:add( tilequads[tilenumber]:quad(), (x-1)*16*scale, ((y)*16-8)*scale, 0, scale, scale ) end end end @@ -5262,7 +5242,7 @@ end function properprint2(s, x, y) for i = 1, string.len(tostring(s)) do if fontquads[string.sub(s, i, i)] then - love.graphics.drawq(fontimage2, font2quads[string.sub(s, i, i)], x+((i-1)*4)*scale, y, 0, scale, scale) + love.graphics.draw(fontimage2, font2quads[string.sub(s, i, i)], x+((i-1)*4)*scale, y, 0, scale, scale) end end end @@ -5283,9 +5263,6 @@ function playsound(sound) end soundlist[sound].source:stop() - if loveVersion <= 8 then - soundlist[sound].source:rewind() - end soundlist[sound].source:seek(0) soundlist[sound].source:play() end diff --git a/groundlight.lua b/groundlight.lua index 28325ce..275c8f3 100644 --- a/groundlight.lua +++ b/groundlight.lua @@ -54,7 +54,7 @@ function groundlight:draw() love.graphics.setColor(60 / 255, 188 / 255, 252 / 255, 255 / 255) end - love.graphics.drawq(entityquads[42+self.dir].image, entityquads[42+self.dir].quad, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) + love.graphics.draw(entityquads[42+self.dir].image, entityquads[42+self.dir].quad, math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end function groundlight:input(t, input) diff --git a/gui.lua b/gui.lua index b9a2eaf..31a2847 100644 --- a/gui.lua +++ b/gui.lua @@ -260,7 +260,7 @@ function guielement:draw(a, offx, offy) high = 2 end - love.graphics.drawq(checkboximg, checkboxquad[high][quad], drawx*scale, drawy*scale, 0, scale, scale) + love.graphics.draw(checkboximg, checkboxquad[high][quad], drawx*scale, drawy*scale, 0, scale, scale) if self.text then properprint(self.text, (drawx+10)*scale, (drawy+1)*scale) diff --git a/intro.lua b/intro.lua index 887762b..7679781 100644 --- a/intro.lua +++ b/intro.lua @@ -75,9 +75,7 @@ function intro_mousepressed() return end soundlist["stab"].source:stop() - if loveVersion <= 8 then - soundlist["stab"].source:rewind() - end + soundlist["stab"].source:seek(0) menu_load() shaders:set(1, shaderlist[currentshaderi1]) shaders:set(2, shaderlist[currentshaderi2]) @@ -88,9 +86,7 @@ function intro_keypressed() return end soundlist["stab"].source:stop() - if loveVersion <= 8 then - soundlist["stab"].source:rewind() - end + soundlist["stab"].source:seek(0) menu_load() shaders:set(1, shaderlist[currentshaderi1]) shaders:set(2, shaderlist[currentshaderi2]) diff --git a/itemanimation.lua b/itemanimation.lua index 76019f0..6ac2aee 100644 --- a/itemanimation.lua +++ b/itemanimation.lua @@ -20,6 +20,6 @@ end function itemanimation:draw() local yoffset = self.timer/mushroomtime*1 love.graphics.setScissor((self.x-xscroll-6)*16*scale, (self.y-yscroll-6.5)*16*scale, 176*scale, 80*scale) - love.graphics.drawq(self.v.graphic, self.v.quad, math.floor(((self.x-xscroll-.5-self.v.width/2+(self.v.spawnoffsetx or 0))*16+self.v.offsetX)*scale), math.floor(((self.y-yscroll-yoffset-self.v.height+(self.v.spawnoffsety or 0))*16-self.v.offsetY)*scale), 0, scale, scale, self.v.quadcenterX, self.v.quadcenterY) + love.graphics.draw(self.v.graphic, self.v.quad, math.floor(((self.x-xscroll-.5-self.v.width/2+(self.v.spawnoffsetx or 0))*16+self.v.offsetX)*scale), math.floor(((self.y-yscroll-yoffset-self.v.height+(self.v.spawnoffsety or 0))*16-self.v.offsetY)*scale), 0, scale, scale, self.v.quadcenterX, self.v.quadcenterY) love.graphics.setScissor() end \ No newline at end of file diff --git a/magic.lua b/magic.lua index a4eee80..c3c84e0 100644 --- a/magic.lua +++ b/magic.lua @@ -17,5 +17,5 @@ end function magic:draw() love.graphics.setColor(unpack(self.color)) - love.graphics.drawq(magicimg, magicquad[math.floor(self.t/self.lifetime*6)+1], self.x, self.y, 0, scale, scale, 5, 5) + love.graphics.draw(magicimg, magicquad[math.floor(self.t/self.lifetime*6)+1], self.x, self.y, 0, scale, scale, 5, 5) end \ No newline at end of file diff --git a/main.lua b/main.lua index ea99929..f253c4f 100644 --- a/main.lua +++ b/main.lua @@ -45,42 +45,6 @@ function love.run() MUSICFIX = loveVersion < 11 and "static" or "stream" - if loveVersion < 9 then - --Cheap af but I don't care, COMPATIBILITY!!! - love.math = {} - love.math.setRandomSeed = math.randomseed - love.math.random = math.random - - love.window = {} - love.window.setMode = love.graphics.setMode - love.window.getMode = love.graphics.getMode - love.window.setTitle = love.graphics.setCaption - love.window.setIcon = love.graphics.setIcon - love.window.getFullscreenModes = love.graphics.getModes - - love.filesystem.getDirectoryItems = love.filesystem.enumerate - love.filesystem.createDirectory = love.filesystem.mkdir - - love.graphics.setDefaultFilter = love.graphics.setDefaultImageFilter - love.graphics.origin = function() --Don't kill me for being cheap - local ptimes = 0 - local ok, msg = pcall(love.graphics.pull) - if not ok then - return - else - while ok do - ptimes = ptimes + 1 - ok, msg = pcall(love.graphics.pull) - end - for i = 1, ptimes do - love.graphics.push() - end - end - end - - love.mouse.setGrabbed = love.mouse.setGrab - end - love.math.setRandomSeed(os.time()) for i=1, 2 do love.math.random() @@ -267,11 +231,6 @@ function love.load(arg) math.mod = math.fmod math.random = love.math.random - --blame slime - if loveVersion >= 9 then - love.graphics.drawq = love.graphics.draw - end - print("Loading Mari0 SE!") print("=======================") lastline = debug.getinfo(1).currentline @@ -381,9 +340,6 @@ function love.load(arg) end iconimg = love.image.newImageData("graphics/icon.png") - if loveVersion < 9 then - iconimg = love.graphics.newImage("graphics/icon.png") - end love.window.setIcon(iconimg) love.graphics.setDefaultFilter("nearest", "nearest") @@ -999,11 +955,6 @@ function love.load(arg) soundlist[v] = {} soundlist[v].source = love.audio.newSource("sounds/" .. v .. ".ogg", MUSICFIX) soundlist[v].lastplayed = 0 - if loveVersion < 9 then - soundlist[v].isPlaying = function (self) - return not self:isStopped() - end - end end soundlist["scorering"].source:setLooping(true) @@ -2094,13 +2045,13 @@ function properprint(s, x, y, sc) else local char = string.sub(s, i, i) if string.sub(s, i, i+3) == "_dir" and tonumber(string.sub(s, i+4, i+4)) then - love.graphics.drawq(directionsimg, directionsquad[tonumber(string.sub(s, i+4, i+4))], x+((i-1)*8+1)*scale, y, 0, scale, scale) + love.graphics.draw(directionsimg, directionsquad[tonumber(string.sub(s, i+4, i+4))], x+((i-1)*8+1)*scale, y, 0, scale, scale) skip = 4 elseif char == "|" then x = startx-((i)*8)*scale y = y + 10*scale elseif fontquads[char] then - love.graphics.drawq(fontimage, fontquads[char], x+((i-1)*8+1)*scale, y, 0, scale, scale) + love.graphics.draw(fontimage, fontquads[char], x+((i-1)*8+1)*scale, y, 0, scale, scale) end end end @@ -2119,7 +2070,7 @@ function properprintbackground(s, x, y, include, color, sc) x = startx-((i)*8)*scale y = y + 10*scale elseif fontquadsback[char] then - love.graphics.drawq(fontimageback, fontquadsback[char], x+((i-1)*8)*scale, y-1*scale, 0, scale, scale) + love.graphics.draw(fontimageback, fontquadsback[char], x+((i-1)*8)*scale, y-1*scale, 0, scale, scale) end end end diff --git a/mario.lua b/mario.lua index 9068f17..d5a7188 100644 --- a/mario.lua +++ b/mario.lua @@ -541,9 +541,7 @@ function mario:update(dt) if mariotime <= 0 then subtractscore = false soundlist["scorering"].source:stop() - if loveVersion <= 8 then - soundlist["scorering"].source:rewind() - end + soundlist["scorering"].source:seek(0) castleflagmove = true mariotime = 0 end @@ -1096,17 +1094,11 @@ function mario:update(dt) end local soundPlaying - if loveVersion > 8 then --Love 0.9.x added Source:isPlaying(), so 0.8.x crashed here - soundPlaying = soundlist["planemode"].source:isPlaying() - else - soundPlaying = soundlist["planemode"].source:isStopped() - end + soundPlaying = soundlist["planemode"].source:isPlaying() if not self.raccoonjump and self.raccoontimer == 0 and soundPlaying then soundlist["planemode"].source:stop() - if loveVersion <= 8 then - soundlist["planemode"].source:rewind() - end + soundlist["planemode"].source:seek(0) end if self.raccoonascendtimer > 0 then diff --git a/menu.lua b/menu.lua index c06574d..8ff2a1e 100644 --- a/menu.lua +++ b/menu.lua @@ -703,9 +703,9 @@ function menu_draw() love.graphics.draw(portalglowimg, 142*scale, 57*scale, 0, scale, scale) love.graphics.setColor(unpack(portalcolor[skinningplayer][1])) - love.graphics.drawq(portalimg, portalquad[portalframe], 174*scale, 46*scale, math.pi, scale, scale) + love.graphics.draw(portalimg, portalquad[portalframe], 174*scale, 46*scale, math.pi, scale, scale) love.graphics.setColor(unpack(portalcolor[skinningplayer][2])) - love.graphics.drawq(portalimg, portalquad[portalframe], 142*scale, 70*scale, 0, scale, scale) + love.graphics.draw(portalimg, portalquad[portalframe], 142*scale, 70*scale, 0, scale, scale) love.graphics.setScissor() diff --git a/miniblock.lua b/miniblock.lua index 094027f..80d3eff 100644 --- a/miniblock.lua +++ b/miniblock.lua @@ -53,5 +53,5 @@ function miniblock:draw() end local yadd = math.sin(self.timer)*0.1+0.15 - love.graphics.drawq(img, tilequads[self.i]:quad(), math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5-yadd)*16*scale), 0, scale/2, scale/2, 8, 16) + love.graphics.draw(img, tilequads[self.i]:quad(), math.floor((self.x-xscroll)*16*scale), math.floor((self.y-yscroll-.5-yadd)*16*scale), 0, scale/2, scale/2, 8, 16) end \ No newline at end of file diff --git a/musicloader.lua b/musicloader.lua index 0d4a5a9..896a3ce 100644 --- a/musicloader.lua +++ b/musicloader.lua @@ -67,9 +67,6 @@ function music:play(name, fast) if self.loaded[name] then if soundenabled then self.loaded[name]:stop() - if loveVersion <= 8 then - self.loaded[name]:rewind() - end self.loaded[name]:seek(0) self.loaded[name]:setVolume(volumemusic or 1) self.loaded[name]:play() @@ -87,9 +84,7 @@ function music:stop(name, fast) if self.loaded[name] then self.loaded[name]:stop() - if loveVersion <= 8 then - self.loaded[name]:rewind() - end + self.loaded[name]:seek(0) end end diff --git a/panel.lua b/panel.lua index 84dfe63..ea52cee 100644 --- a/panel.lua +++ b/panel.lua @@ -65,7 +65,7 @@ function panel:draw() quad = 1 end - love.graphics.drawq(panelimg, panelquad[quad], math.floor((self.cox-1-xscroll+.5)*16*scale), math.floor((self.coy-1-yscroll)*16*scale), self.r, scale, scale, 8, 8) + love.graphics.draw(panelimg, panelquad[quad], math.floor((self.cox-1-xscroll+.5)*16*scale), math.floor((self.coy-1-yscroll)*16*scale), self.r, scale, scale, 8, 8) end function panel:input(t, input) diff --git a/portal.lua b/portal.lua index 63a5c4c..cb24ae9 100644 --- a/portal.lua +++ b/portal.lua @@ -180,7 +180,7 @@ function portal:draw() end love.graphics.setColor(unpack(self["portal" .. i .. "color"])) - love.graphics.drawq(portalimg, portalquad[self.portalframe], math.floor(((self["x" .. i]-1-xscroll)*16+offsetx)*scale), math.floor(((self["y" .. i]-yscroll-1)*16+offsety)*scale), rotation, scale*self.openscale[i], scale, 16, 8) + love.graphics.draw(portalimg, portalquad[self.portalframe], math.floor(((self["x" .. i]-1-xscroll)*16+offsetx)*scale), math.floor(((self["y" .. i]-yscroll-1)*16+offsety)*scale), rotation, scale*self.openscale[i], scale, 16, 8) end end end \ No newline at end of file diff --git a/pushbutton.lua b/pushbutton.lua index 263bd36..6f70b1b 100644 --- a/pushbutton.lua +++ b/pushbutton.lua @@ -59,7 +59,7 @@ function pushbutton:draw() r = math.pi*1.5 end - love.graphics.drawq(pushbuttonimg, pushbuttonquad[quad], math.floor((self.cox-0.5-xscroll)*16*scale), (self.coy-yscroll-1)*16*scale, r, horscale, scale, 8, 8) + love.graphics.draw(pushbuttonimg, pushbuttonquad[quad], math.floor((self.cox-0.5-xscroll)*16*scale), (self.coy-yscroll-1)*16*scale, r, horscale, scale, 8, 8) end function pushbutton:addoutput(a, t) diff --git a/rainboom.lua b/rainboom.lua index d8da87b..d5736e6 100644 --- a/rainboom.lua +++ b/rainboom.lua @@ -1 +1,37 @@ ---omygoshomygoshomygosh rainboom = class("rainboom") function rainboom:init(x, y, dir) self.x = x self.y = y self.dir = dir self.timer = 0 self.frame = 1 self.r = 0 if dir == "up" then self.r = -math.pi/2 elseif dir == "down" then self.r = math.pi/2 elseif dir == "left" then self.r = math.pi end end function rainboom:update(dt) self.timer = self.timer + dt while self.timer > rainboomdelay do self.frame = self.frame + 1 self.timer = self.timer - rainboomdelay end if self.frame > rainboomframes then return true end return false end function rainboom:draw() love.graphics.drawq(rainboomimg, rainboomquad[self.frame], (self.x-xscroll)*16*scale, (self.y-yscroll-0.5)*16*scale, self.r, scale, scale, 29, 92) end \ No newline at end of file +--omygoshomygoshomygosh +rainboom = class("rainboom") + +function rainboom:init(x, y, dir) + self.x = x + self.y = y + self.dir = dir + self.timer = 0 + self.frame = 1 + + self.r = 0 + if dir == "up" then + self.r = -math.pi/2 + elseif dir == "down" then + self.r = math.pi/2 + elseif dir == "left" then + self.r = math.pi + end +end + +function rainboom:update(dt) + self.timer = self.timer + dt + while self.timer > rainboomdelay do + self.frame = self.frame + 1 + self.timer = self.timer - rainboomdelay + end + + if self.frame > rainboomframes then + return true + end + + return false +end + +function rainboom:draw() + love.graphics.draw(rainboomimg, rainboomquad[self.frame], (self.x-xscroll)*16*scale, (self.y-yscroll-0.5)*16*scale, self.r, scale, scale, 29, 92) +end \ No newline at end of file diff --git a/seesaw.lua b/seesaw.lua index 1831556..fd1d2df 100644 --- a/seesaw.lua +++ b/seesaw.lua @@ -121,18 +121,18 @@ end function seesaw:draw() --left - love.graphics.drawq(seesawimg, seesawquad[1], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[1], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) if self.falloff == false and self.leftplatform.y-self.y >= 0 then love.graphics.setScissor((self.x-1-xscroll)*16*scale, (self.y-yscroll-0.5)*16*scale, 16*scale, math.floor((self.leftplatform.y-self.y)*16*scale)) for i = 1, math.ceil(self.leftplatform.y-self.y) do - love.graphics.drawq(seesawimg, seesawquad[3], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[3], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) end love.graphics.setScissor() else if self.falloffside == "left" then for i = 1, self.dist1+self.dist2-2 do - love.graphics.drawq(seesawimg, seesawquad[3], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[3], math.floor((self.x-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) end end end @@ -140,22 +140,22 @@ function seesaw:draw() --middle for i = 1, self.range-1 do - love.graphics.drawq(seesawimg, seesawquad[4], math.floor((self.x-1+i-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[4], math.floor((self.x-1+i-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) end --right - love.graphics.drawq(seesawimg, seesawquad[2], math.floor((self.x-1+self.range-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[2], math.floor((self.x-1+self.range-xscroll)*16*scale), (self.y-yscroll-1.5)*16*scale, 0, scale, scale) if self.falloff == false and self.rightplatform.y-self.y >= 0 then love.graphics.setScissor((self.x-1+self.range-xscroll)*16*scale, (self.y-yscroll-0.5)*16*scale, 16*scale, math.floor((self.rightplatform.y-self.y)*16*scale)) for i = 1, math.ceil(self.rightplatform.y-self.y) do - love.graphics.drawq(seesawimg, seesawquad[3], math.floor((self.x+self.range-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[3], math.floor((self.x+self.range-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) end love.graphics.setScissor() else if self.falloffside == "right" then for i = 1, self.dist1+self.dist2-2 do - love.graphics.drawq(seesawimg, seesawquad[3], math.floor((self.x+self.range-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) + love.graphics.draw(seesawimg, seesawquad[3], math.floor((self.x+self.range-1-xscroll)*16*scale), (self.y-yscroll+i-1.5)*16*scale, 0, scale, scale) end end end diff --git a/shaders/init.lua b/shaders/init.lua index 4afe443..e48722e 100644 --- a/shaders/init.lua +++ b/shaders/init.lua @@ -99,12 +99,12 @@ local function CreateShaderPass() if fullscreen then if fullscreenmode == "full" then - love.graphics.drawq(self.canvas.canvas, self.canvas.quad, 0, 0, 0, desktopsize.width/(width*16*scale), desktopsize.height/(height*16*scale)) + love.graphics.draw(self.canvas.canvas, self.canvas.quad, 0, 0, 0, desktopsize.width/(width*16*scale), desktopsize.height/(height*16*scale)) else - love.graphics.drawq(self.canvas.canvas, self.canvas.quad, 0, touchfrominsidemissing/2, 0, touchfrominsidescaling/scale, touchfrominsidescaling/scale) + love.graphics.draw(self.canvas.canvas, self.canvas.quad, 0, touchfrominsidemissing/2, 0, touchfrominsidescaling/scale, touchfrominsidescaling/scale) end else - love.graphics.drawq(self.canvas.canvas, self.canvas.quad, 0, 0) + love.graphics.draw(self.canvas.canvas, self.canvas.quad, 0, 0) end end end diff --git a/spring.lua b/spring.lua index e5ba386..4d0aed4 100644 --- a/spring.lua +++ b/spring.lua @@ -37,7 +37,7 @@ function spring:update(dt) end function spring:draw() - love.graphics.drawq(springimg, springquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), ((self.y-yscroll)*16-8)*scale, 0, scale, scale) + love.graphics.draw(springimg, springquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), ((self.y-yscroll)*16-8)*scale, 0, scale, scale) end function spring:hit() diff --git a/vine.lua b/vine.lua index 2399fd3..24f386a 100644 --- a/vine.lua +++ b/vine.lua @@ -62,9 +62,9 @@ function vine:draw() if bottom > top then love.graphics.setScissor(0, top, width*16*scale, bottom-top) - love.graphics.drawq(vineimg, vinequad[spriteset][1], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-yscroll-0.5-2/16)*16*scale, 0, scale, scale) + love.graphics.draw(vineimg, vinequad[spriteset][1], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-yscroll-0.5-2/16)*16*scale, 0, scale, scale) for i = 1, math.ceil(self.height-14/16+.7) do - love.graphics.drawq(vineimg, vinequad[spriteset][2], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-yscroll-0.5-2/16+i)*16*scale, 0, scale, scale) + love.graphics.draw(vineimg, vinequad[spriteset][2], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-yscroll-0.5-2/16+i)*16*scale, 0, scale, scale) end diff --git a/wallindicator.lua b/wallindicator.lua index f2f6a1f..7ba8346 100644 --- a/wallindicator.lua +++ b/wallindicator.lua @@ -45,7 +45,7 @@ function wallindicator:draw() quad = 2 end - love.graphics.drawq(wallindicatorimg, wallindicatorquad[quad], math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) + love.graphics.draw(wallindicatorimg, wallindicatorquad[quad], math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end function wallindicator:input(t, input) diff --git a/walltimer.lua b/walltimer.lua index 1bbd211..0d7d77c 100644 --- a/walltimer.lua +++ b/walltimer.lua @@ -70,7 +70,7 @@ end function walltimer:draw() love.graphics.setColor(1, 1, 1) - love.graphics.drawq(walltimerimg, walltimerquad[self.quad], math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) + love.graphics.draw(walltimerimg, walltimerquad[self.quad], math.floor((self.x-1-xscroll)*16*scale), ((self.y-yscroll-1)*16-8)*scale, 0, scale, scale) end function walltimer:out(t) From 83a06517d3b66c85a7682f3f56d61d561bc67b58 Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 19:07:32 -0400 Subject: [PATCH 15/32] Joystick fix Joystick fix --- main.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index ea99929..2883d27 100644 --- a/main.lua +++ b/main.lua @@ -1993,9 +1993,10 @@ end function keyprompt_update() if keyprompt then + local js = love.joystick:getJoysticks() for i = 1, prompt.joysticks do for j = 1, #prompt.joystick[i].validhats do - local dir = love.joystick.getHat(i, prompt.joystick[i].validhats[j]) + local dir = js[i]:getHat(prompt.joystick[i].validhats[j]) if dir ~= "c" then keypromptenter("joyhat", i, prompt.joystick[i].validhats[j], dir) return @@ -2003,7 +2004,7 @@ function keyprompt_update() end for j = 1, prompt.joystick[i].axes do - local value = love.joystick.getAxis(i, j) + local value = js[i]:getAxis(j) if value > prompt.joystick[i].axisposition[j] + joystickdeadzone then keypromptenter("joyaxis", i, j, "pos") return @@ -2321,4 +2322,4 @@ function mouse.getY() else return love.mouse.getY() end -end \ No newline at end of file +end From 6601969805d65499940faff978d02efd76b4d9d1 Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 19:08:34 -0400 Subject: [PATCH 16/32] Joystick fix Joystick fix --- game.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/game.lua b/game.lua index 78ec5f4..9d919e3 100644 --- a/game.lua +++ b/game.lua @@ -5354,27 +5354,28 @@ end function checkkey(s) if s[1] == "joy" then + local j = love.joystick:getJoysticks()[s[2]] if s[3] == "hat" then - if string.match(love.joystick.getHat(s[2], s[4]), s[5]) then + if string.match(j:getHat(s[4]), s[5]) then return true else return false end elseif s[3] == "but" then - if love.joystick.isDown(s[2], s[4]) then + if j:sDown(s[4]) then return true else return false end elseif s[3] == "axe" then if s[5] == "pos" then - if love.joystick.getAxis(s[2], s[4]) > joystickdeadzone then + if j:getAxis(s[4]) > joystickdeadzone then return true else return false end else - if love.joystick.getAxis(s[2], s[4]) < -joystickdeadzone then + if j:getAxis(s[4]) < -joystickdeadzone then return true else return false From 053aa2f13d78a467b7d82ef77cf939177c6be83a Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 19:09:14 -0400 Subject: [PATCH 17/32] Joystick fix Joystick fix --- mario.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mario.lua b/mario.lua index 9068f17..1f2729c 100644 --- a/mario.lua +++ b/mario.lua @@ -1216,9 +1216,10 @@ function mario:updateangle() elseif #controls[self.playernumber]["aimx"] > 0 then local x, y + local j = love.joystick.getJoysticks()[s[2]] local s = controls[self.playernumber]["aimx"] if s[1] == "joy" then - x = -love.joystick.getAxis(s[2], s[4]) + x = -j:getAxis(s[4]) if s[5] == "neg" then x = -x end @@ -1226,7 +1227,7 @@ function mario:updateangle() s = controls[self.playernumber]["aimy"] if s[1] == "joy" then - y = -love.joystick.getAxis(s[2], s[4]) + y = -j:getAxis(s[4]) if s[5] == "neg" then y = -y end @@ -3943,4 +3944,4 @@ function mario:portalpickup(i) end self.portalsavailable[i] = true -end \ No newline at end of file +end From c55b6e831cdb4c267c8c21cf11753b9f6e50787f Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 19:31:06 -0400 Subject: [PATCH 18/32] Joystick fix the sequel Fixed :sDown() typo to :isDown() --- game.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.lua b/game.lua index 9d919e3..89083b3 100644 --- a/game.lua +++ b/game.lua @@ -5362,7 +5362,7 @@ function checkkey(s) return false end elseif s[3] == "but" then - if j:sDown(s[4]) then + if j:isDown(s[4]) then return true else return false From 53c3cc96466770dc159571752893667dca318b6d Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 24 Aug 2018 19:20:59 -0500 Subject: [PATCH 19/32] Removed something that was breaking the error screen --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.lua b/main.lua index e21b287..5c07e1f 100644 --- a/main.lua +++ b/main.lua @@ -113,7 +113,7 @@ end function love.errhand(msg) msg = tostring(msg) - uphold(msg) + local trace = debug.traceback() local err = {} From 52c4688f63e7ccf4dec7833b53268fa67bae44dc Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 24 Aug 2018 20:04:07 -0500 Subject: [PATCH 20/32] Fixes multiplayer crashing on certain menus --- game.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.lua b/game.lua index a92274c..bb25f06 100644 --- a/game.lua +++ b/game.lua @@ -1039,7 +1039,7 @@ function drawui(hidetime) end end - if players > 1 and gamestate ~= "menu" then + if players > 1 and mariolives then for i = 1, players do local x = (width*16)/players/2 + (width*16)/players*(i-1) if mariolivecount ~= false then From 55217429021abaef593d2bda3d1179918e33caa3 Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 21:06:59 -0400 Subject: [PATCH 21/32] Joystick fix the sequel Joystick fix the sequel --- mario.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mario.lua b/mario.lua index 1f2729c..b0135b6 100644 --- a/mario.lua +++ b/mario.lua @@ -1216,8 +1216,8 @@ function mario:updateangle() elseif #controls[self.playernumber]["aimx"] > 0 then local x, y - local j = love.joystick.getJoysticks()[s[2]] local s = controls[self.playernumber]["aimx"] + local j = love.joystick.getJoysticks()[s[2]] if s[1] == "joy" then x = -j:getAxis(s[4]) if s[5] == "neg" then @@ -1226,6 +1226,7 @@ function mario:updateangle() end s = controls[self.playernumber]["aimy"] + j = love.joystick.getJoysticks()[s[2]] if s[1] == "joy" then y = -j:getAxis(s[4]) if s[5] == "neg" then From f7f9fd79dc18652fa4416430d32b76eed7c61d88 Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 21:07:27 -0400 Subject: [PATCH 22/32] Joystick fix the sequel Joystick fix the sequel --- game.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game.lua b/game.lua index 89083b3..d2e813b 100644 --- a/game.lua +++ b/game.lua @@ -1039,7 +1039,7 @@ function drawui(hidetime) end end - if players > 1 and gamestate ~= "menu" then + if players > 1 and mariolives then for i = 1, players do local x = (width*16)/players/2 + (width*16)/players*(i-1) if mariolivecount ~= false then @@ -5354,7 +5354,7 @@ end function checkkey(s) if s[1] == "joy" then - local j = love.joystick:getJoysticks()[s[2]] + local j = love.joystick.getJoysticks()[s[2]] if s[3] == "hat" then if string.match(j:getHat(s[4]), s[5]) then return true @@ -5362,7 +5362,7 @@ function checkkey(s) return false end elseif s[3] == "but" then - if j:isDown(s[4]) then + if (j:isGamepad() and j.isGamepadDown or j.isDown)(j,s[4]) then return true else return false @@ -5408,7 +5408,7 @@ function game_joystickpressed( joystick, button ) local s4 = controls[i]["use"] local s5 = controls[i]["left"] local s6 = controls[i]["right"] - if s1[1] == "joy" and joystick == tonumber(s1[2]) and s1[3] == "but" and button == tonumber(s1[4]) then + if s1[1] == "joy" and joystick == s1[2] and s1[3] == "but" and button == s1[4] then objects["player"][i]:jump() return elseif s2[1] == "joy" and joystick == s2[2] and s2[3] == "but" and button == s2[4] then @@ -5442,7 +5442,7 @@ function game_joystickpressed( joystick, button ) local s = controls[i]["portal2"] if s and s[1] == "joy" then if s[3] == "but" then - if joystick == tonumber(s[2]) and button == tonumber(s[4]) then + if joystick == s[2] and button == s[4] then shootportal(i, 2, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) return end @@ -5458,7 +5458,7 @@ function game_joystickreleased( joystick, button ) local s = controls[i]["jump"] if s[1] == "joy" then if s[3] == "but" then - if joystick == tonumber(s[2]) and button == tonumber(s[4]) then + if joystick == s[2] and button == s[4] then objects["player"][i]:stopjump() return end From 6baaba6356a8aba9ab42bcc737697c485bff81fb Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 21:08:19 -0400 Subject: [PATCH 23/32] Joystick fix the sequel Joystick fix the sequel --- main.lua | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/main.lua b/main.lua index 2883d27..aff8442 100644 --- a/main.lua +++ b/main.lua @@ -149,7 +149,7 @@ end function love.errhand(msg) msg = tostring(msg) - uphold(msg) + local trace = debug.traceback() local err = {} @@ -1868,26 +1868,46 @@ function love.mousereleased(x, y, button) end function love.joystickpressed(joystick, button) - if keyprompt then - keypromptenter("joybutton", joystick, button) - return + local joysticks,found = love.joystick.getJoysticks(),false + for i,v in ipairs(joysticks) do + if v:getID() == joystick:getID() then + joystick,found = i,true + break + end end - if gamestate == "menu" or gamestate == "options" then - menu_joystickpressed(joystick, button) - elseif gamestate == "game" then - game_joystickpressed(joystick, button) + if found then + if keyprompt then + keypromptenter("joybutton", joystick, button) + elseif gamestate == "menu" or gamestate == "options" then + menu_joystickpressed(joystick, button) + elseif gamestate == "game" then + game_joystickpressed(joystick, button) + end end end function love.joystickreleased(joystick, button) - if gamestate == "menu" or gamestate == "options" then - menu_joystickreleased(joystick, button) - elseif gamestate == "game" then - game_joystickreleased(joystick, button) + local joysticks,found = love.joystick.getJoysticks(),false + for i,v in ipairs(joysticks) do + if v:getID() == joystick:getID() then + joystick,found = i,true + break + end + end + + if found then + if gamestate == "menu" or gamestate == "options" then + menu_joystickreleased(joystick, button) + elseif gamestate == "game" then + game_joystickreleased(joystick, button) + end end end +love.gamepadpressed = love.joystickpressed +love.gamepadreleased = love.joystickreleased + function round(num, idp) --Not by me local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult @@ -1993,7 +2013,7 @@ end function keyprompt_update() if keyprompt then - local js = love.joystick:getJoysticks() + local js = love.joystick.getJoysticks() for i = 1, prompt.joysticks do for j = 1, #prompt.joystick[i].validhats do local dir = js[i]:getHat(prompt.joystick[i].validhats[j]) From be0695ea9a89a773c96e1da276d33751b5e58197 Mon Sep 17 00:00:00 2001 From: Joseph Fasulo Date: Fri, 24 Aug 2018 21:21:55 -0400 Subject: [PATCH 24/32] Joystick fix the epic finale Joystick fix the epic finale --- game.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/game.lua b/game.lua index d2e813b..90a2349 100644 --- a/game.lua +++ b/game.lua @@ -5355,6 +5355,10 @@ end function checkkey(s) if s[1] == "joy" then local j = love.joystick.getJoysticks()[s[2]] + if not j then + return false + end + if s[3] == "hat" then if string.match(j:getHat(s[4]), s[5]) then return true @@ -5362,7 +5366,7 @@ function checkkey(s) return false end elseif s[3] == "but" then - if (j:isGamepad() and j.isGamepadDown or j.isDown)(j,s[4]) then + if (type(s[4]) == "number" and j.isDown or j.isGamepadDown)(j,s[4]) then return true else return false From 64a6cf6126dfaa0428b1388995481e5f0edee571 Mon Sep 17 00:00:00 2001 From: WillWare Date: Fri, 24 Aug 2018 21:26:50 -0500 Subject: [PATCH 25/32] Another handful of joystick fixes --- editor.lua | 2 +- mario.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor.lua b/editor.lua index 48a69b8..5bca1fb 100644 --- a/editor.lua +++ b/editor.lua @@ -33,7 +33,7 @@ function editor_load() maxstates = 15 currentstate = 1 - tileswitcherkey = controls[1]["use"][1] + tileswitcherkey = controls[1]["use"][1] == "joy" and "e" or controls[1]["use"][1] if musiclist[#musiclist] ~= "princessmusic.ogg" then musiclist[#musiclist+1] = "princessmusic.ogg" diff --git a/mario.lua b/mario.lua index 96a2350..aaaf676 100644 --- a/mario.lua +++ b/mario.lua @@ -1211,7 +1211,7 @@ function mario:updateangle() local s = controls[self.playernumber]["aimx"] local j = love.joystick.getJoysticks()[s[2]] if s[1] == "joy" then - x = -j:getAxis(s[4]) + x = j and -j:getAxis(s[4]) or 0 if s[5] == "neg" then x = -x end @@ -1220,7 +1220,7 @@ function mario:updateangle() s = controls[self.playernumber]["aimy"] j = love.joystick.getJoysticks()[s[2]] if s[1] == "joy" then - y = -j:getAxis(s[4]) + y = j and -j:getAxis(s[4]) or 0 if s[5] == "neg" then y = -y end From b3e4557e3482430f8c2617ab7bddb5a81b1dd80c Mon Sep 17 00:00:00 2001 From: WillWare Date: Sat, 25 Aug 2018 00:55:26 -0500 Subject: [PATCH 26/32] Fixed controller support on vines Added support for portals bound to analog shoulder buttons --- conf.lua | 1 - game.lua | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.lua | 80 ++++++++++++++++++++++++++++++++++++++++++++++-- menu.lua | 10 +++++- 4 files changed, 178 insertions(+), 5 deletions(-) diff --git a/conf.lua b/conf.lua index 4f40ff1..cec33f9 100644 --- a/conf.lua +++ b/conf.lua @@ -4,5 +4,4 @@ function love.conf(t) t.identity = "mari0_se" t.modules.physics = false t.window = false - t.console = false end \ No newline at end of file diff --git a/game.lua b/game.lua index 9378031..d876f76 100644 --- a/game.lua +++ b/game.lua @@ -5448,6 +5448,98 @@ function game_joystickreleased( joystick, button ) end end +function game_joystickaxis(joystick, axis, value, stickmoved, shouldermoved) + if pausemenuopen then + return + end + if endpressbutton then + endgame() + return + end + + for i = 1, players do + if not noupdate and objects["player"][i].controlsenabled then + local s1 = controls[i]["left"] + local s2 = controls[i]["right"] + if s1[1] == "joy" and joystick == s1[2] and s1[3] == "axe" and s1[4] == axis and stickmoved and value < 0 then + objects["player"][i]:leftkey() + return + elseif s2[1] == "joy" and joystick == s2[2] and s2[3] == "axe" and s2[4] == axis and stickmoved and value > 0 then + objects["player"][i]:rightkey() + return + end + + if i ~= mouseowner then + local s = controls[i]["portal1"] + if s and s[1] == "joy" then + if s[3] == "axe" and s[4] == axis then + if joystick == s[2] and shouldermoved then + shootportal(i, 1, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) + return + end + end + end + + local s = controls[i]["portal2"] + if s and s[1] == "joy" then + if s[3] == "axe" and s[4] == axis then + if joystick == s[2] and shouldermoved then + shootportal(i, 2, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) + return + end + end + end + end + end + end +end + +function game_joystickhat(joystick, hat, direction) + if pausemenuopen then + return + end + if endpressbutton then + endgame() + return + end + + for i = 1, players do + if not noupdate and objects["player"][i].controlsenabled then + local s1 = controls[i]["left"] + local s2 = controls[i]["right"] + if s1[1] == "joy" and joystick == s1[2] and s1[3] == "hat" and s1[4] == hat and s1[5]:find(direction) then + objects["player"][i]:leftkey() + return + elseif s2[1] == "joy" and joystick == s2[2] and s2[3] == "hat" and s2[4] == hat and s2[5]:find(direction) then + objects["player"][i]:rightkey() + return + end + end + + if i ~= mouseowner then + local s = controls[i]["portal1"] + if s and s[1] == "joy" then + if s[3] == "hat" and s[4] == hat then + if joystick == s[2] and s[5]:find(direction) then + shootportal(i, 1, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) + return + end + end + end + + local s = controls[i]["portal2"] + if s and s[1] == "joy" then + if s[3] == "hat" and s[4] == hat then + if joystick == s[2] and s[5]:find(direction) then + shootportal(i, 2, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) + return + end + end + end + end + end +end + function inrange(i, a, b, include) if a > b then b, a = a, b diff --git a/main.lua b/main.lua index 1fb6365..15b43e8 100644 --- a/main.lua +++ b/main.lua @@ -343,7 +343,25 @@ function love.load(arg) love.window.setIcon(iconimg) love.graphics.setDefaultFilter("nearest", "nearest") - + + axisDeadZones = {} + joysticks = love.joystick.getJoysticks() + if #joysticks > 0 then + for i, v in ipairs(joysticks) do + axisDeadZones[i] = {} + for j=1, v:getAxisCount() do + axisDeadZones[i][j] = {} + axisDeadZones[i][j]["stick"] = true + axisDeadZones[i][j]["shoulder"] = true + end + for _, j in pairs({"leftx", "lefty", "rightx", "righty", "triggerleft", "triggerright"}) do + axisDeadZones[i][j] = {} + axisDeadZones[i][j]["stick"] = true + axisDeadZones[i][j]["shoulder"] = true + end + end + end + add("Variables, shaderlist") local suc, err = pcall(loadconfig) @@ -1856,8 +1874,64 @@ function love.joystickreleased(joystick, button) end end -love.gamepadpressed = love.joystickpressed -love.gamepadreleased = love.joystickreleased +function love.joystickaxis(joystick, axis, value) + local joysticks,found = love.joystick.getJoysticks(),false + for i,v in ipairs(joysticks) do + if v:getID() == joystick:getID() then + joystick,found = i,true + break + end + end + + if found then + local stickmoved = false + local shouldermoved = false + + --If this axis is a stick, get whether it just moved out of its deadzone + if math.abs(value) > joystickaimdeadzone and axisDeadZones[joystick][axis]["stick"] then + stickmoved = true + axisDeadZones[joystick][axis]["stick"] = false + elseif math.abs(value) < joystickaimdeadzone and not axisDeadZones[joystick][axis]["stick"] then + axisDeadZones[joystick][axis]["stick"] = true + end + + --If this axis is a shoulder, get whether it just moved out of its deadzone + if value > 0 and axisDeadZones[joystick][axis]["shoulder"] then + shouldermoved = true + axisDeadZones[joystick][axis]["shoulder"] = false + elseif value < 0 and not axisDeadZones[joystick][axis]["shoulder"] then + axisDeadZones[joystick][axis]["shoulder"] = true + end + + if gamestate == "menu" or gamestate == "options" then + menu_joystickaxis(joystick, axis, value, stickmoved, shouldermoved) + elseif gamestate == "game" then + game_joystickaxis(joystick, axis, value, stickmoved, shouldermoved) + end + end +end + +function love.joystickhat(joystick, hat, direction) + local joysticks,found = love.joystick.getJoysticks(),false + for i,v in ipairs(joysticks) do + if v:getID() == joystick:getID() then + joystick,found = i,true + break + end + end + + if found then + if gamestate == "menu" or gamestate == "options" then + menu_joystickhat(joystick, hat, direction) + elseif gamestate == "game" then + game_joystickhat(joystick, hat, direction) + end + end +end + +-- love.gamepadpressed = love.joystickpressed +-- love.gamepadreleased = love.joystickreleased +-- love.gamepadaxis = love.joystickaxis function round(num, idp) --Not by me local mult = 10^(idp or 0) diff --git a/menu.lua b/menu.lua index 8ff2a1e..368afd3 100644 --- a/menu.lua +++ b/menu.lua @@ -1913,6 +1913,14 @@ function menu_joystickreleased(joystick, button) end +function menu_joystickaxis(joystick, axis, value, stickmoved, shouldermoved) + +end + +function menu_joystickhat(joystick, hat, direction) + +end + function keypromptenter(t, ...) arg = {...} if t == "key" and (arg[1] == ";" or arg[1] == "," or arg[1] == "," or arg[1] == "-") then @@ -1920,7 +1928,7 @@ function keypromptenter(t, ...) end buttonerror = false axiserror = false - local buttononly = {"run", "jump", "reload", "use", "portal1", "portal2"} + local buttononly = {"run", "jump", "reload", "use"} local axisonly = {"aimx", "aimy"} if t ~= "key" or arg[1] ~= "escape" then if t == "key" then From 4283f9cbebbbeadde5c7fcf050aab7b2cdfad3fc Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 25 Aug 2018 03:23:36 -0300 Subject: [PATCH 27/32] Allows dragging trigger region while moving camera --- editor.lua | 82 +++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 50 deletions(-) diff --git a/editor.lua b/editor.lua index 5bca1fb..50d66ad 100644 --- a/editor.lua +++ b/editor.lua @@ -380,6 +380,38 @@ function editor_update(dt) end end + if changemapwidthmenu then + return + end + + --key scroll + if editormenuopen == false then + if not (love.keyboard.isDown("lshift") or love.keyboard.isDown("rshift")) then + local xdir = love.keyboard.isDown("left") and -1 or (love.keyboard.isDown("right") and 1 or 0) + local ydir = love.keyboard.isDown("up") and -1 or (love.keyboard.isDown("down") and 1 or 0) + + --xdir + local oldxscroll = xscroll + xscroll = math.max(0, math.min(mapwidth-width, xscroll + 30*gdt*xdir)) + splitxscroll[1] = math.max(0, math.min(mapwidth-width, splitxscroll[1])) + + --ydir + local oldyscroll = yscroll + yscroll = math.max(0, math.min(mapheight-height, yscroll + 30*gdt*ydir)) + + if oldxscroll ~= xscroll or oldyscroll ~= yscroll then + autoscroll = false + guielements["autoscrollcheckbox"].var = autoscroll + generatespritebatch() + + if regiondragging then + regiondragging.movex = regiondragging.movex + (oldxscroll-xscroll)*16*scale + regiondragging.movey = regiondragging.movey + (oldyscroll-yscroll)*16*scale + end + end + end + end + if regiondragging then if regiondragging:update(dt) then regiondragging = nil @@ -387,10 +419,6 @@ function editor_update(dt) return end - if changemapwidthmenu then - return - end - if love.keyboard.isDown("rctrl") or love.keyboard.isDown("lctrl") then ctrlpressed = true else @@ -419,52 +447,6 @@ function editor_update(dt) end if editormenuopen == false then - --key scroll - local shiftpressed = ((love.keyboard.isDown("lshift") or love.keyboard.isDown("rshift")) and true) or false - - if love.keyboard.isDown("left") and not shiftpressed then - autoscroll = false - guielements["autoscrollcheckbox"].var = autoscroll - xscroll = xscroll - 30*gdt - if xscroll < 0 then - xscroll = 0 - end - splitxscroll[1] = splitxscroll[1] - 30*gdt - if splitxscroll[1] < 0 then - splitxscroll[1] = 0 - end - generatespritebatch() - elseif love.keyboard.isDown("right") and not shiftpressed then - autoscroll = false - guielements["autoscrollcheckbox"].var = autoscroll - xscroll = xscroll + 30*gdt - if xscroll > mapwidth-width then - xscroll = mapwidth-width - end - splitxscroll[1] = splitxscroll[1] + 30*gdt - if splitxscroll[1] > mapwidth-width then - splitxscroll[1] = mapwidth-width - end - generatespritebatch() - end - if love.keyboard.isDown("up") and not shiftpressed then - autoscroll = false - guielements["autoscrollcheckbox"].var = autoscroll - yscroll = yscroll - 30*gdt - if yscroll < 0 then - yscroll = 0 - end - generatespritebatch() - elseif love.keyboard.isDown("down") and not shiftpressed then - autoscroll = false - guielements["autoscrollcheckbox"].var = autoscroll - yscroll = yscroll + 30*gdt - if yscroll > mapheight-height-1 then - yscroll = mapheight-height-1 - end - generatespritebatch() - end - if editorstate == "lightdraw" then if love.mouse.isDown("l") then local mousex, mousey = mouse.getPosition() From 12970e8ce0f1c3deb457fb9d1631435f7587c50d Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 25 Aug 2018 03:47:30 -0300 Subject: [PATCH 28/32] Fixes #83 Also yscroll went 1 tile further if you held down in editor, fixed too --- editor.lua | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/editor.lua b/editor.lua index 50d66ad..83a59bf 100644 --- a/editor.lua +++ b/editor.lua @@ -397,7 +397,7 @@ function editor_update(dt) --ydir local oldyscroll = yscroll - yscroll = math.max(0, math.min(mapheight-height, yscroll + 30*gdt*ydir)) + yscroll = math.max(0, math.min(mapheight-1-height, yscroll + 30*gdt*ydir)) if oldxscroll ~= xscroll or oldyscroll ~= yscroll then autoscroll = false @@ -3064,19 +3064,24 @@ function editor_mousepressed(x, y, button) id = math.min(id+1, #entitylistitems[list].entries) currenttile = entitylistitems[list].entries[id].i end - elseif animatedtilelist then - if currenttile > 10000 then - currenttile = currenttile - 1 - if currenttile == 10000 then - currenttile = 10000+animatedtilecount - end - end + -- elseif animatedtilelist then + -- if currenttile > 10000 then + -- currenttile = currenttile - 1 + -- if currenttile == 10000 then + -- currenttile = 10000+animatedtilecount + -- end + -- end else - if currenttile > 0 then + if currenttile > 0 and currenttile <= 10000 then currenttile = currenttile - 1 if currenttile == 0 then currenttile = smbtilecount+portaltilecount+customtilecount end + else + currenttile = currenttile - 1 + if currenttile == 10000 then + currenttile = 10000+animatedtilecount + end end end end @@ -3113,19 +3118,26 @@ function editor_mousepressed(x, y, button) id = math.max(1, id-1) currenttile = entitylistitems[list].entries[id].i end - elseif animatedtilelist then - if currenttile <= 10000+animatedtilecount then - currenttile = currenttile + 1 - if currenttile == 10001+animatedtilecount then - currenttile = 10001 - end - end + -- elseif animatedtilelist then + -- if currenttile <= 10000+animatedtilecount then + -- currenttile = currenttile + 1 + -- if currenttile == 10001+animatedtilecount then + -- currenttile = 10001 + -- end + -- end else if currenttile <= smbtilecount+portaltilecount+customtilecount then currenttile = currenttile + 1 if currenttile > smbtilecount+portaltilecount+customtilecount then currenttile = 1 end + else + if currenttile <= 10000+animatedtilecount then + currenttile = currenttile + 1 + if currenttile == 10001+animatedtilecount then + currenttile = 10001 + end + end end end end From c5bdf51ac8f3b6ac082e0601a023db2b04ee1a34 Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 25 Aug 2018 04:12:23 -0300 Subject: [PATCH 29/32] Region dragging when moving camera (again) Further fixes --- editor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor.lua b/editor.lua index 83a59bf..488ed7a 100644 --- a/editor.lua +++ b/editor.lua @@ -404,7 +404,7 @@ function editor_update(dt) guielements["autoscrollcheckbox"].var = autoscroll generatespritebatch() - if regiondragging then + if regiondragging and regiondragging.movex and regiondragging.movey then regiondragging.movex = regiondragging.movex + (oldxscroll-xscroll)*16*scale regiondragging.movey = regiondragging.movey + (oldyscroll-yscroll)*16*scale end From 6f737c3833fcbe323c32851514af0657983662e4 Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 25 Aug 2018 05:00:01 -0300 Subject: [PATCH 30/32] Fixes #82 --- physics.lua | 8 +++++--- platform.lua | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/physics.lua b/physics.lua index d37aa55..ed33142 100644 --- a/physics.lua +++ b/physics.lua @@ -209,16 +209,18 @@ function physicsupdate(dt) end end -function checkforemances(dt, v) +function checkforemances(dt, v, speedx, speedy) if v.emancipatecheck then for h, u in pairs(emancipationgrills) do if u.active then + local spx = speedx or v.speedx + local spy = speedy or v.speedy if u.dir == "hor" then - if inrange(v.x+6/16, u.startx-1, u.endx, true) and inrange(u.y-14/16, v.y, v.y+v.speedy*dt, true) then + if inrange(v.x+6/16, u.startx-1, u.endx, true) and inrange(u.y-14/16, v.y, v.y+spy*dt, true) then if v.emancipate then v:emancipate(h) end end else - if inrange(v.y+6/16, u.starty-1, u.endy, true) and inrange(u.x-14/16, v.x, v.x+v.speedx*dt, true) then + if inrange(v.y+6/16, u.starty-1, u.endy, true) and inrange(u.x-14/16, v.x, v.x+spx*dt, true) then if v.emancipate then v:emancipate(h) end end end diff --git a/platform.lua b/platform.lua index 3c4d0f7..aac020d 100644 --- a/platform.lua +++ b/platform.lua @@ -127,6 +127,7 @@ function platform:update(dt) for i, v in pairs(checktable) do for j, w in pairs(objects[v]) do if inrange(w.x, self.x-w.width, self.x+self.width) and inrange(w.y + w.height, self.y - 0.1, self.y + 0.1) then + checkforemances(dt, w, self.speedx, self.speedy) local newx = w.x + self.speedx*dt local newy = nexty - w.height if #checkrect(newx, newy, w.width, w.height, {"exclude", w, self}, true) == 0 then @@ -135,7 +136,6 @@ function platform:update(dt) blay = newy+w.height end - numberofobjects = numberofobjects + 1 end end end From a5f1d0c4b97bfae45dac85a2bc1f05a1f47e079a Mon Sep 17 00:00:00 2001 From: HugoBDesigner Date: Sat, 25 Aug 2018 05:10:21 -0300 Subject: [PATCH 31/32] Fixes #79 --- mario.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mario.lua b/mario.lua index aaaf676..1ddbb7a 100644 --- a/mario.lua +++ b/mario.lua @@ -3369,6 +3369,8 @@ end function mario:pickupbox(box) self.pickup = box + box.speedx = 0 + box.speedy = 0 end function mario:dropbox() From e81ad907cbc3b1ccf6493f579e1400eb1b1ec0ef Mon Sep 17 00:00:00 2001 From: WillWare Date: Mon, 27 Aug 2018 19:05:44 -0500 Subject: [PATCH 32/32] Fixes multiplayer crash in certain instances --- menu.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu.lua b/menu.lua index 368afd3..073697f 100644 --- a/menu.lua +++ b/menu.lua @@ -52,6 +52,8 @@ function menu_load() mariolevel = 1 marioworld = 1 mariosublevel = 0 + + mariolives = nil --load 1-1 as background loadbackgroundsafe("1-1.txt")