Skip to content

Commit 9f41936

Browse files
committed
Fix copying empty text selection alesan99#608
Fix Right click menus going off-screen alesan99#563 Fix shells hitting moving blocks alesan99#538 Fix game closing immmediately on crash Update version number
1 parent 6e56e4e commit 9f41936

File tree

5 files changed

+50
-18
lines changed

5 files changed

+50
-18
lines changed

editor.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -5916,6 +5916,7 @@ function openrightclickmenu(x, y, tileX, tileY)
59165916
--Move if out of screen
59175917
local scootx = ((x/scale)+rightclickobjects.width > width*16)
59185918
local scooty = ((y/scale)+rightclickobjects.height > height*16)
5919+
local shiftx = ((x/scale)-rightclickobjects.width < 0)
59195920
local shifty = ((y/scale)-rightclickobjects.height < 0)
59205921

59215922
local truey = rightclickobjects[1].y
@@ -5924,7 +5925,12 @@ function openrightclickmenu(x, y, tileX, tileY)
59245925
for i = 1, #rightclickobjects do
59255926
local obj = rightclickobjects[i]
59265927
if scootx then
5927-
rightclickobjects[i].x = rightclickobjects[i].x - rightclickobjects.width
5928+
if shiftx then
5929+
--neither work, just shift
5930+
rightclickobjects[i].x = ((width*16)-(x/scale))-rightclickobjects.width+rightclickobjects[i].x
5931+
else
5932+
rightclickobjects[i].x = rightclickobjects[i].x - rightclickobjects.width
5933+
end
59285934
end
59295935
if scooty then
59305936
if shifty then

enemies/koopa.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ function koopa:rightcollide(a, b)
685685
end
686686

687687
function koopa:hitwall(a, b, dir)
688-
if a == "tile" or a == "portalwall" or a == "spring" or a == "donut" or a == "springgreen" or a == "bigmole" or a == "muncher" or (a == "flipblock" and not b.flippable) or a == "frozencoin" or a == "buttonblock" or (a == "enemy" and (b.resistsenemykill or b.resistseverything)) or a == "clearpipesegment" then
688+
if a == "tile" or a == "portalwall" or a == "spring" or a == "donut" or a == "springgreen" or a == "bigmole" or a == "muncher" or (a == "flipblock" and not b.flippable) or a == "frozencoin" or a == "buttonblock" or (a == "enemy" and (b.resistsenemykill or b.resistseverything)) or a == "clearpipesegment" or a == "tilemoving" then
689689
if self.small then
690690
if not self.staystillfall then
691691
if self.t == "bigkoopa" or self.t == "bigbeetle" then
@@ -730,6 +730,8 @@ function koopa:hitwall(a, b, dir)
730730
if big and pass then
731731
return "pass"
732732
end
733+
elseif a == "tilemoving" then
734+
b:hit("koopa", self)
733735
else
734736
playsound(blockhitsound)
735737
end

gui.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ function guielement:keypress(key,textinput)
941941
if self.highlight then
942942
local highlight = {math.min(self.highlight,self.cursorpos),math.max(self.highlight,self.cursorpos)}
943943
if key == "x" and self.ctrl then
944+
-- cut text selection
944945
textclipboard = string.sub(self.value,highlight[1],highlight[2]-1)
945946
end
946947
self.value = string.sub(self.value,1,highlight[1]-1)..string.sub(self.value,highlight[2])
@@ -963,8 +964,11 @@ function guielement:keypress(key,textinput)
963964
self.highlight = 1
964965
self.cursorpos = string.len(self.value) + 1
965966
elseif key == "c" and self.ctrl then
966-
local highlight1, highlight2 = math.min(self.highlight,self.cursorpos),math.max(self.highlight,self.cursorpos)
967-
textclipboard = string.sub(self.value,highlight1,highlight2-1)
967+
--copy text selection
968+
if self.highlight then
969+
local highlight1, highlight2 = math.min(self.highlight,self.cursorpos),math.max(self.highlight,self.cursorpos)
970+
textclipboard = string.sub(self.value,highlight1,highlight2-1)
971+
end
968972
else
969973
if android then
970974
if not (textinput and textinput == "forcetextinput") then

main.lua

+33-13
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ if debugconsole then debuginputon = true; debuginput = "print()"; print("DEBUG O
6262
local debugGraph,fpsGraph,memGraph,drawGraph
6363
local debugGraphs = false
6464

65-
VERSION = 13.1005
66-
VERSIONSTRING = "13.1 (4/18/23)"
65+
VERSION = 13.1006
66+
VERSIONSTRING = "13.1a (8/9/24)"
6767
ANDROIDVERSION = 17
6868

6969
android = (love.system.getOS() == "Android" or love.system.getOS() == "iOS") --[DROID]
@@ -2708,25 +2708,32 @@ function love.errorhandler(msg)
27082708
if not love.window or not love.graphics or not love.event then
27092709
return
27102710
end
2711-
if not love.window.isOpen() then
2711+
2712+
if not love.graphics.isCreated() or not love.window.isOpen() then
27122713
local success, status = pcall(love.window.setMode, 800, 600)
27132714
if not success or not status then
27142715
return
27152716
end
27162717
end
2718+
2719+
-- Reset state.
27172720
if love.mouse then
27182721
love.mouse.setVisible(true)
27192722
love.mouse.setGrabbed(false)
27202723
love.mouse.setRelativeMode(false)
2724+
if love.mouse.isCursorSupported() then
2725+
love.mouse.setCursor()
2726+
end
27212727
end
2722-
if love.joystick then -- Stop all joystick vibrations.
2728+
if love.joystick then
2729+
-- Stop all joystick vibrations.
27232730
for i,v in ipairs(love.joystick.getJoysticks()) do
27242731
v:setVibration()
27252732
end
27262733
end
27272734
local screenshot = false
27282735
if love.graphics.captureScreenshot then
2729-
love.graphics.captureScreenshot(function(s) screenshot = s end)
2736+
love.graphics.captureScreenshot(function(s) screenshot = love.graphics.newImage(s) end)
27302737
end
27312738

27322739
-- Load.
@@ -2746,11 +2753,21 @@ function love.errorhandler(msg)
27462753

27472754
love.graphics.clear()
27482755

2756+
local sanitizedmsg = {}
2757+
for char in msg:gmatch(utf8.charpattern) do
2758+
table.insert(sanitizedmsg, char)
2759+
end
2760+
sanitizedmsg = table.concat(sanitizedmsg)
2761+
27492762
local err = {}
27502763
local traceback = {}
27512764

2752-
table.insert(err, "Error\n")
2753-
table.insert(err, msg.."\n\n")
2765+
table.insert(err, "Error\n")
2766+
table.insert(err, sanitizedmsg.."\n\n")
2767+
2768+
if #sanitizedmsg ~= #msg then
2769+
table.insert(err, "Invalid UTF-8 string in error message.")
2770+
end
27542771

27552772
for l in string.gmatch(trace, "(.-)\n") do
27562773
if not string.match(l, "boot.lua") then
@@ -2792,13 +2809,14 @@ function love.errorhandler(msg)
27922809
end
27932810

27942811
local function draw()
2812+
if not love.graphics.isActive() then return end
27952813
love.graphics.clear(love.graphics.getBackgroundColor())
27962814
if screenshot then
27972815
love.graphics.setColor(30/255, 30/255, 30/255)
27982816
love.graphics.draw(screenshot, 0, 0, 0, love.graphics.getWidth()/screenshot:getWidth(), love.graphics.getHeight()/screenshot:getHeight())
27992817
if gradientimg and width and height then
2800-
love.graphics.setColor(0, 0, 0)
2801-
love.graphics.draw(gradientimg, 0, 0, 0, love.graphics.getWidth()/(width*16), love.graphics.getHeight()/(height*16))
2818+
love.graphics.setColor(0, 0, 0)
2819+
love.graphics.draw(gradientimg, 0, 0, 0, love.graphics.getWidth()/(width*16), love.graphics.getHeight()/(height*16))
28022820
end
28032821
end
28042822
love.graphics.setColor(1, 1, 1)
@@ -2811,21 +2829,23 @@ function love.errorhandler(msg)
28112829

28122830
local e, a, b, c
28132831

2814-
while true do
2832+
return function()
28152833
love.event.pump()
28162834

28172835
for e, a, b, c in love.event.poll() do
28182836
if e == "quit" then
2819-
return
2837+
return 1
28202838
elseif e == "keypressed" and a == "escape" then
2821-
return
2839+
return 1
28222840
elseif e == "touchpressed" then
28232841
local name = love.window.getTitle()
28242842
if #name == 0 or name == "Untitled" then name = "Game" end
28252843
local buttons = {"OK", "Cancel"}
28262844
local pressed = love.window.showMessageBox("Quit "..name.."?", "", buttons)
28272845
if pressed == 1 then
2828-
return
2846+
return 1
2847+
elseif pressed == 3 then
2848+
copyToClipboard()
28292849
end
28302850
end
28312851
end

tilemoving.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ function tilemoving:leftcollide(a, b)
412412
return false
413413
end
414414
if a == "thwomp" or a == "skewer" or (a == "koopa" and b.small) then
415-
self:hit()
415+
self:hit(a, b)
416416
end
417417
return false
418418
end

0 commit comments

Comments
 (0)