From 031a39d706e3e26c7d709e10a6c15cbb0a35e997 Mon Sep 17 00:00:00 2001 From: Brendon Walsh Date: Mon, 18 Nov 2024 13:24:42 -0500 Subject: [PATCH] Update to Love 11.3 (with some minor bugfixes) (#2589) * Love 11.3 * Update conf.lua * Update i18n.lua * Update application.lua * commit * Update Makefile * Update .travis.yml * Update conf.lua * Fix for run * fix version * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * fix color * little fixe * fix color more * fix more * fix color again * fix color... * fix * Little fix * fix * fix color again * fix * fix * fix * update * fix * update * Update make.ps1 * More color fixes and minor cleanup --------- Co-authored-by: liberodark --- .travis.yml | 48 +++++++------- Makefile | 66 +++++++++---------- make.ps1 | 14 ++-- src/autosave_warning.lua | 4 +- src/blackjackgame.lua | 18 ++--- src/board.lua | 6 +- src/brewing.lua | 6 +- src/camera.lua | 5 +- src/character.lua | 8 +-- src/characterstrip.lua | 16 ++--- src/cheatscreen.lua | 14 ++-- src/conf.lua | 2 +- src/costumeselect.lua | 8 +-- src/credits.lua | 2 +- src/debugger.lua | 18 ++--- src/dialog.lua | 2 +- src/flyin.lua | 4 +- src/fonts.lua | 34 +++++----- src/hawk/application.lua | 10 +-- src/hawk/i18n.lua | 2 +- src/hawk/sparkle/windows.lua | 25 +++---- src/hawk/store.lua | 2 +- src/hud.lua | 10 +-- src/instructions.lua | 6 +- src/items/item.lua | 2 +- src/level.lua | 8 +-- src/main.lua | 21 ++---- src/nodes/consumable.lua | 2 +- src/nodes/cutscenes/welcome_to_hawkthorne.lua | 26 ++++---- src/nodes/enemies/acornBoss.lua | 6 +- src/nodes/enemies/benzalkBoss.lua | 8 +-- src/nodes/enemies/laserlotusBoss.lua | 8 +-- src/nodes/enemies/qfo.lua | 8 +-- src/nodes/enemies/tSnake.lua | 6 +- src/nodes/enemies/turkeyBoss.lua | 8 +-- src/nodes/enemy.lua | 8 +-- src/nodes/floorspace.lua | 6 +- src/nodes/liquid.lua | 8 +-- src/nodes/npc.lua | 12 ++-- src/nodes/splat.lua | 6 +- src/nodes/trampoline.lua | 4 +- src/options.lua | 8 +-- src/overworld.lua | 10 +-- src/pause.lua | 4 +- src/player.lua | 6 +- src/playerEffects.lua | 2 +- src/pokergame.lua | 18 ++--- src/prompt.lua | 12 ++-- src/scanning.lua | 4 +- src/select.lua | 6 +- src/selectbackground.lua | 2 +- src/shopping.lua | 10 +-- src/start.lua | 14 ++-- src/test/lunatest.lua | 2 +- src/test/test_updater.lua | 2 +- src/tooltip.lua | 8 +-- src/transition.lua | 4 +- src/tunnelparticles.lua | 4 +- src/update.lua | 6 +- src/vendor/TEsound.lua | 2 +- src/vendor/gamestate.lua | 2 +- src/vendor/mixpanel.lua | 2 +- src/vendor/mixpanel_thread.lua | 3 +- src/vendor/tmx.lua | 2 +- src/verticalparticles.lua | 4 +- src/welcome.lua | 8 +-- templates/conf.lua | 2 +- 67 files changed, 303 insertions(+), 321 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d79db8c0..430138035 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,31 @@ -language: python -os: linux +language: generic +os: + - linux dist: bionic -services: - - xvfb -before_install: - - "export DISPLAY=:99.0" -install: - - sudo apt-get update -y - - sudo apt-get install python-dev libffi-dev libssl-dev -y - - sudo apt-get install python-virtualenv lua5.1 -y - # download Love2D 0.10.1 and the liblove dependency (links are for x64 architecture) - - wget https://github.com/love2d/love/releases/download/0.10.1/liblove0_0.10.1ppa1_amd64.deb - - wget https://github.com/love2d/love/releases/download/0.10.1/love_0.10.1ppa1_amd64.deb - # install Love2D 0.10.1 - - sudo apt install libphysfs1 # required dependency - - sudo apt-get install ./liblove0_0.10.1ppa1_amd64.deb - - sudo apt-get install ./love_0.10.1ppa1_amd64.deb - - mkdir -p $TRAVIS_BUILD_DIR/share/love/ -env: - global: - - XDG_DATA_HOME="$TRAVIS_BUILD_DIR/share" -script: make deploy addons: + apt: + packages: + - xvfb + - python-dev + - libffi-dev + - libssl-dev + - python-virtualenv + - lua5.1 + - libpulse0 + - pulseaudio + - sndiod + - virtualenv + - libsdl2-2.0-0 + - alsa + - alsa-tools artifacts: paths: - ./build/hawkthorne-osx.zip - - ./build/hawkthorne-win-x86.zip + - ./build/hawkthorne-win-x86_64.zip - ./build/hawkthorne.love +env: + global: + - XDG_DATA_HOME="$TRAVIS_BUILD_DIR/share" +script: + - "mkdir -p $TRAVIS_BUILD_DIR/share/love/" + - "xvfb-run make deploy" diff --git a/Makefile b/Makefile index c6c0e4e4d..51909d5fd 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,12 @@ UNAME := $(shell uname) -LOVE2D_DOWNLOAD_URL = https://github.com/love2d/love/releases/download -LOVE2D_VERSION = 0.10.1 - ifeq ($(UNAME), Darwin) - TMXDIR = osx + TMXTAR = tmx2lua.osx.zip LOVE = bin/love.app/Contents/MacOS/love else - TMXDIR = linux - LOVE = /usr/bin/love + TMXTAR = tmx2lua.linux.tar.gz + LOVE = bin/love-11.3-x86_64.AppImage endif ifeq ($(shell which wget),) @@ -41,25 +38,24 @@ src/maps/%.lua: src/maps/%.tmx bin/tmx2lua # brew update && brew install golang bin/tmx2lua: mkdir -p bin - git clone https://github.com/hawkthorne/tmx2lua bin/tmx2lua-git - cd bin/tmx2lua-git; go mod init .git/config - cd bin/tmx2lua-git; go get github.com/kyleconroy/go-tmx/tmx - cd bin/tmx2lua-git; make - mv bin/tmx2lua-git/$(TMXDIR)/tmx2lua bin - rm -rf bin/tmx2lua-git + $(wget) https://github.com/hawkthorne/tmx2lua/releases/download/v1.0.0/$(TMXTAR) + tar -xzvf $(TMXTAR) + rm -f $(TMXTAR) + mv tmx2lua bin bin/love.app/Contents/MacOS/love: mkdir -p bin - $(wget) $(LOVE2D_DOWNLOAD_URL)/$(LOVE2D_VERSION)/love-$(LOVE2D_VERSION)-macosx-x64.zip - unzip -q love-$(LOVE2D_VERSION)-macosx-x64.zip - rm -f love-$(LOVE2D_VERSION)-macosx-x64.zip + $(wget) https://github.com/love2d/love/releases/download/11.3/love-11.3-macos.zip + unzip -q love-11.3-macos.zip + rm -f love-11.3-macos.zip mv love.app bin cp osx/Info.plist bin/love.app/Contents -/usr/bin/love: - sudo add-apt-repository -y ppa:bartbes/love-stable - sudo apt-get update -y -f - sudo apt-get install -y love +bin/love-11.3-x86_64.AppImage: + mkdir -p bin + $(wget) https://github.com/love2d/love/releases/download/11.3/love-11.3-x86_64.AppImage + mv love-11.3-x86_64.AppImage bin + chmod +x bin/love-11.3-x86_64.AppImage ###################################################### # THE REST OF THESE TARGETS ARE FOR RELEASE AUTOMATION @@ -80,23 +76,23 @@ positions: $(patsubst %.png,%.lua,$(wildcard src/positions/*.png)) src/positions/%.lua: psds/positions/%.png overlay2lua src/positions/config.json $< -win32/love.exe: - $(wget) $(LOVE2D_DOWNLOAD_URL)/$(LOVE2D_VERSION)/love-$(LOVE2D_VERSION)-win32.zip - unzip -q love-$(LOVE2D_VERSION)-win32.zip - mv love-$(LOVE2D_VERSION)-win32 win32 - rm -f love-$(LOVE2D_VERSION)-win32.zip - rm win32/changes.txt win32/game.ico win32/license.txt win32/love.ico win32/readme.txt +win64/love.exe: + $(wget) https://github.com/love2d/love/releases/download/11.3/love-11.3-win64.zip + unzip -q love-11.3-win64.zip + mv love-11.3-win64 win64 + rm -f love-11.3-win64.zip + rm win64/changes.txt win64/game.ico win64/license.txt win64/love.ico win64/readme.txt -win32/hawkthorne.exe: build/hawkthorne.love win32/love.exe - cat win32/love.exe build/hawkthorne.love > win32/hawkthorne.exe +win64/hawkthorne.exe: build/hawkthorne.love win64/love.exe + cat win64/love.exe build/hawkthorne.love > win64/hawkthorne.exe -build/hawkthorne-win-x86.zip: win32/hawkthorne.exe +build/hawkthorne-win-x86_64.zip: win64/hawkthorne.exe mkdir -p build rm -rf hawkthorne - rm -f hawkthorne-win-x86.zip - cp -r win32 hawkthorne - zip --symlinks -q -r hawkthorne-win-x86 hawkthorne -x "*/love.exe" - mv hawkthorne-win-x86.zip build + rm -f hawkthorne-win-x86_64.zip + cp -r win64 hawkthorne + zip --symlinks -q -r hawkthorne-win-x86_64 hawkthorne -x "*/love.exe" + mv hawkthorne-win-x86_64.zip build OSXAPP=Journey\ to\ the\ Center\ of\ Hawkthorne.app @@ -114,12 +110,12 @@ build/hawkthorne-osx.zip: $(OSXAPP) productionize: venv venv/bin/python scripts/productionize.py -binaries: build/hawkthorne-osx.zip build/hawkthorne-win-x86.zip +binaries: build/hawkthorne-osx.zip build/hawkthorne-win-x86_64.zip upload: binaries post.md venv venv/bin/python scripts/release.py -appcast: venv build/hawkthorne-osx.zip win32/hawkthorne.exe +appcast: venv build/hawkthorne-osx.zip win64/hawkthorne.exe venv/bin/python scripts/sparkle.py cat sparkle/appcast.json | python -m json.tool > /dev/null venv/bin/python scripts/upload.py / sparkle/appcast.json @@ -144,7 +140,7 @@ contributors: venv venv/bin/python scripts/credits.py > src/credits.lua test: $(LOVE) maps - $(LOVE) src --test + $(LOVE) src - --test validate: venv lint venv/bin/python scripts/validate.py src diff --git a/make.ps1 b/make.ps1 index 942df9621..f17a3b66b 100644 --- a/make.ps1 +++ b/make.ps1 @@ -16,8 +16,8 @@ if($check -eq $false){ } $webclient = New-Object System.Net.WebClient -$lovedir = "bin\love-0.10.1-win32\" -$check = Test-Path "bin\love-0.10.1-win32\love.exe" +$lovedir = "bin\love-11.3-win64\" +$check = Test-Path "bin\love-11.3-win64\love.exe" #add love to the path if necessary $foundlove = $env:Path.Contains($lovedir) @@ -27,13 +27,13 @@ if($foundlove -eq $false){ if($check -eq $false){ - $filename = (Get-Location).Path + "\bin\love-0.10.1-win32.zip" + $filename = (Get-Location).Path + "\bin\love-11.3-win64.zip" $check = Test-Path $filename if($check -eq $false){ Write-Host "Downloading love2d..." - $url = "https://github.com/love2d/love/releases/download/0.10.1/love-0.10.1-win32.zip" + $url = "https://github.com/love2d/love/releases/download/11.3/love-11.3-win64.zip" try { $webclient.DownloadFile($url,$filename) } catch { @@ -95,11 +95,11 @@ foreach($fileName in $fileEntries) if($args[0] -eq "run"){ Write-Host "Running Journey to the Center of Hawkthorne..." if($args.Length -ne 1){ - .\bin\love-0.10.1-win32\love.exe src $args[1..($args.Length-1)] + .\bin\love-11.3-win64\love.exe src $args[1..($args.Length-1)] }else{ - .\bin\love-0.10.1-win32\love.exe src + .\bin\love-11.3-win64\love.exe src } }elseif($args[0] -eq "test"){ Write-Host "Testing Journey to the Center of Hawkthorne..." - .\bin\love-0.10.1-win32\love.exe src --test --console + .\bin\love-11.3-win64\love.exe src --test --console } diff --git a/src/autosave_warning.lua b/src/autosave_warning.lua index d0601d373..194a1b877 100644 --- a/src/autosave_warning.lua +++ b/src/autosave_warning.lua @@ -34,7 +34,7 @@ end function state:draw() - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) VerticalParticles.draw() local width = self.background:getWidth() @@ -49,7 +49,7 @@ function state:draw() self.savingAnimation:draw(self.savingImage, x + 10, y + height - 26) self.savingAnimation:draw(self.savingImage, x + width - 27, y + height - 26) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf(self.text, x + 10, y + 65, width - 20, "center") end diff --git a/src/blackjackgame.lua b/src/blackjackgame.lua index d509fc487..5a7eb403f 100644 --- a/src/blackjackgame.lua +++ b/src/blackjackgame.lua @@ -166,7 +166,7 @@ function state:keypressed(button, player) betDelta = -((self.currentBet-250)%100) -- subtract out the portion that is not part of the standard increment end elseif self.currentBet > 125 then - if self.currentBet%25 == 0 then + if self.currentBet%25 == 0 then betDelta = -25 else betDelta = -(self.currentBet%25) -- subtract out the portion that is not part of the standard increment @@ -634,9 +634,9 @@ function state:draw() love.graphics.draw(self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() ) else - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle('fill', 0, 0, love.graphics:getDimensions() ) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end love.graphics.draw( self.table, self.center_x - ( self.table:getWidth() / 2 ), self.center_y - ( self.table:getHeight() / 2 )) @@ -679,14 +679,14 @@ function state:draw() local co = 0 -- color offset if not n.active then co = 180 end if i == self.selection + 1 then - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( self.options_arrow, x - 5, y + 4 ) co = 255 end - love.graphics.setColor( 255 - co, 255 - co, 255 - co ) + love.graphics.setColor( (255 - co) / 255, (255 - co) / 255, (255 - co) / 255 ) love.graphics.print( n.name, x + 3, y + 3, 0, 0.5 ) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) cx = 0 -- chip offset x for color,count in pairs( cardutils.getChipCounts( self.player.money ) ) do @@ -748,7 +748,7 @@ function state:draw() -- print current bet love.graphics.print('Bet $ ' .. self.currentBet, 361+camera.x, 141+camera.y, 0, 0.5) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) -- Ensure font is reverted fonts.revert() @@ -775,7 +775,7 @@ function state:drawCard( card, suit, flip, x, y, overlay ) darkness = 150 end - love.graphics.setColor( darkness, darkness, darkness ) + love.graphics.setColor( darkness/255, darkness/255, darkness/255 ) love.graphics.draw( self.cardSprite, _card, -- image, quad x + utils.map( flip, 50, limit, w / 2, 0 ), -- offset for flip @@ -785,7 +785,7 @@ function state:drawCard( card, suit, flip, x, y, overlay ) utils.map( flip, 50, limit , 1 + st, 1 ) -- scale height for flip ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end return state diff --git a/src/board.lua b/src/board.lua index 1e1d85f1c..a2636b811 100644 --- a/src/board.lua +++ b/src/board.lua @@ -85,11 +85,11 @@ function Board:draw(x, y) local halfWidth = math.floor(self.width / 2) local halfHeight = math.floor(self.height / 2) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle('fill', x - halfWidth, y - halfHeight, width, height) - love.graphics.setColor( 112, 28, 114, 255 ) + love.graphics.setColor( 112/255, 28/255, 114/255, 1 ) love.graphics.rectangle('line', x - halfWidth, y - halfHeight, width, height) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw(corner, x - halfWidth - 3, y - halfHeight - 3) love.graphics.draw(corner, x - halfWidth - 3, y + halfHeight - 3) love.graphics.draw(corner, x + halfWidth - 3, y + halfHeight - 3) diff --git a/src/brewing.lua b/src/brewing.lua index c1bfe6ca0..d4f4b8758 100644 --- a/src/brewing.lua +++ b/src/brewing.lua @@ -223,9 +223,9 @@ function state:draw() if self.screenshot then love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() ) else - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end self.hud:draw( self.player ) @@ -243,7 +243,7 @@ function state:draw() love.graphics.newQuad(0,0,selectionSprite:getWidth(),selectionSprite:getHeight(),selectionSprite:getWidth(),selectionSprite:getHeight()), firstcell_right, firstcell_top + ((self.selected-1) * 22)) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.printf(self.player.controls:getKey('JUMP') .. " BREW", 0, 200, width, 'center') love.graphics.printf(self.player.controls:getKey('START') .. " CANCEL", 0, 213, width, 'center') diff --git a/src/camera.lua b/src/camera.lua index a4be44d17..26454e497 100644 --- a/src/camera.lua +++ b/src/camera.lua @@ -73,8 +73,9 @@ function camera:setPosition(x, y) end function camera:setScale(sx, sy) - self.scaleX = sx or self.scaleX - self.scaleY = sy or self.scaleY + local scale = math.min(sx, sy) + self.scaleX = scale + self.scaleY = scale end return camera diff --git a/src/character.lua b/src/character.lua index 972fd7fca..aff5c3bae 100644 --- a/src/character.lua +++ b/src/character.lua @@ -69,11 +69,11 @@ function Character:getOverworld() end function module.pick(name, costume) - if not love.filesystem.exists("characters/" .. name .. ".json") then + if not love.filesystem.getInfo("characters/" .. name .. ".json") then error("Unknown character " .. name) end - if not love.filesystem.exists("images/characters/" .. name .. "/" .. costume .. ".png") then + if not love.filesystem.getInfo("images/characters/" .. name .. "/" .. costume .. ".png") then error("Unknown costume " .. costume .. " for character " .. name) end @@ -83,7 +83,7 @@ function module.pick(name, costume) end function module.load(character) - if not love.filesystem.exists("characters/" .. character .. ".json") then + if not love.filesystem.getInfo("characters/" .. character .. ".json") then error("Unknown character " .. character) end @@ -101,7 +101,7 @@ function module.current() local basePath = 'images/characters/' .. _character .. '/base.png' local characterPath = "characters/" .. _character .. ".json" - if not love.filesystem.exists(characterPath) then + if not love.filesystem.getInfo(characterPath) then error("Unknown character " .. _character) end diff --git a/src/characterstrip.lua b/src/characterstrip.lua index facc4ccfa..8cba116d8 100644 --- a/src/characterstrip.lua +++ b/src/characterstrip.lua @@ -68,7 +68,7 @@ end function CharacterStrip:draw() - love.graphics.stencil(function() self.stencilFunc(self) end) + love.graphics.stencil(function() self.stencilFunc(self) end) love.graphics.setStencilTest("greater", 0) for i, offset in ipairs(colorSpacing) do @@ -88,7 +88,7 @@ function CharacterStrip:draw() local x4 = x1 + stripSize * flipped local y4 = y1 + stripSize - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.polygon('line', x1, y1, x2, y2, x3, y3, x4, y4) -- I know not what I do end @@ -131,13 +131,13 @@ end function CharacterStrip:getColor(ratio) assert(ratio >= 0 and ratio <= 1, "Color ratio must be between 0 and 1.") - if ratio == 0 then return self.color1.r, self.color1.g, self.color1.b,255 end - if ratio == 1 then return self.color2.r, self.color2.g, self.color2.b,255 end + if ratio == 0 then return self.color1.r/255, self.color1.g/255, self.color1.b/255,1 end + if ratio == 1 then return self.color2.r/255, self.color2.g/255, self.color2.b/255,1 end - return self.color1.r + ( ( self.color2.r - self.color1.r ) * ratio ), - self.color1.g + ( ( self.color2.g - self.color1.g ) * ratio ), - self.color1.b + ( ( self.color2.b - self.color1.b ) * ratio ), - 255 + return self.color1.r/255 + ( ( self.color2.r/255 - self.color1.r/255 ) * ratio ), + self.color1.g/255 + ( ( self.color2.g/255 - self.color1.g/255 ) * ratio ), + self.color1.b/255 + ( ( self.color2.b/255 - self.color1.b/255 ) * ratio ), + 1 end function CharacterStrip:getOffset() diff --git a/src/cheatscreen.lua b/src/cheatscreen.lua index 9d024f089..3bc9e66cc 100644 --- a/src/cheatscreen.lua +++ b/src/cheatscreen.lua @@ -188,9 +188,9 @@ end function cheatscreen:draw() local y = self.cmd.offset_y - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle( 'fill', 0, 0, window.width, window.height ) - love.graphics.setColor( 88, 246, 0, 255 ) + love.graphics.setColor( 88/255, 246/255, 0, 1 ) for i,n in pairs(self.cmd.queue) do love.graphics.print( n, self.cmd.offset_x, y, 0, 0.5, 0.5 ) y = y + self.cmd.line_height @@ -218,13 +218,13 @@ function cheatscreen:draw() end if display then if self.current_key == key then - love.graphics.setColor( 88, 246, 0, 60 ) + love.graphics.setColor( 88/255, 246/255, 0, 60/255 ) love.graphics.rectangle( 'fill', kx + 0.5, ky + 0.5, w - 1, h - 1 ) - love.graphics.setColor( 88, 246, 0, 255 ) + love.graphics.setColor( 88/255, 246/255, 0, 1 ) else - love.graphics.setColor( 88, 246, 0, 35 ) + love.graphics.setColor( 88/255, 246/255, 0, 35/255 ) love.graphics.rectangle( 'fill', kx + 0.5, ky + 0.5, w - 1, h - 1 ) - love.graphics.setColor( 88, 246, 0, 240 ) + love.graphics.setColor( 88/255, 246/255, 0, 240/255 ) end utils.roundedrectangle( kx, ky, w, h, keywidth / 6 ) love.graphics.print( display, kx + 9, ky + 6, 0, 0.6, 0.7) @@ -232,7 +232,7 @@ function cheatscreen:draw() end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end return cheatscreen diff --git a/src/conf.lua b/src/conf.lua index 283cff3a0..eb64c030d 100644 --- a/src/conf.lua +++ b/src/conf.lua @@ -2,7 +2,7 @@ function love.conf(t) t.title = "Journey to the Center of Hawkthorne v0.0.0" t.url = "http://projecthawkthorne.com" t.author = "https://github.com/hawkthorne?tab=members" - t.version = "0.10.0" + t.version = "11.3" t.identity = "hawkthorne" t.window.width = 1056 t.window.height = 672 diff --git a/src/costumeselect.lua b/src/costumeselect.lua index 7b9ea15d0..de48d85d9 100644 --- a/src/costumeselect.lua +++ b/src/costumeselect.lua @@ -379,7 +379,7 @@ function state:draw() -- Only draw the details on the screen when the background is up if not background.slideIn then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(self.chartext, 0, window.height - 65, window.width, 'center') love.graphics.printf(self.menutext, 0, window.height - 45, window.width, 'center') @@ -395,10 +395,10 @@ function state:draw() end local x, y = background.getPosition(1, 3) - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 0.78) love.graphics.print("INSUFFICIENT", x, y + 5, 0, 0.5, 0.5, 12, -6) love.graphics.print( "FRIENDS" , x, y + 5, 0, 0.5, 0.5, -12, -32) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end for i=0,1,1 do @@ -412,7 +412,7 @@ function state:draw() end else VerticalParticles.draw() - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(self.costext, 0, window.height - 75, window.width, 'center') love.graphics.printf(self.backtext, 0, window.height - 55, window.width, 'center') diff --git a/src/credits.lua b/src/credits.lua index a323d0918..d7904270f 100644 --- a/src/credits.lua +++ b/src/credits.lua @@ -43,7 +43,7 @@ function state:keypressed( button ) end state.credits = { - app.i18n('credits'), + app.i18n('credits'), '', '6sutters', '8bitgentleman', 'a8252359', diff --git a/src/debugger.lua b/src/debugger.lua index 85e19f83c..84ce82846 100644 --- a/src/debugger.lua +++ b/src/debugger.lua @@ -16,7 +16,7 @@ Debugger.infowidth = 100 Debugger.infoheight = 125 Debugger.graphData = { - { name = 'gc', color = { 255, 0, 0, 150 } } + { name = 'gc', color = { 1, 0, 0, 150/255 } } } function Debugger:reset() @@ -98,7 +98,7 @@ function Debugger:draw() end Debugger.drawInfoBox( x, y ) camera:unset() - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1,1,1,1) end for k,v in pairs( Debugger.graphData ) do love.graphics.setColor( v.color ) @@ -113,16 +113,16 @@ function Debugger:draw() end end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) fonts.set('big') love.graphics.print(math.floor(collectgarbage('count')), window.screen_width - 30, window.screen_height - 10,0,0.5,0.5 ) fonts.revert() end function Debugger.drawShape( s, x, y, r, g, b ) - love.graphics.setColor(r,g,b,100) + love.graphics.setColor(r/255,g/255,b/255,100/255) s:draw('fill') - love.graphics.setColor(r,g,b,50) + love.graphics.setColor(r/255,g/255,b/255,50/255) s:draw('line') if s:contains( x, y ) and s.node and s.node.node then table.insert( Debugger.infoToShow, s.node.node ) @@ -130,17 +130,17 @@ function Debugger.drawShape( s, x, y, r, g, b ) end function Debugger.drawInfoBox( x, y ) - love.graphics.setColor(0,0,0,255) + love.graphics.setColor(0,0,0,1) love.graphics.line( x - 2, y, x + 2, y ) love.graphics.line( x, y - 2, x, y + 2 ) if #Debugger.infoToShow > 0 then if x + Debugger.infowidth * #Debugger.infoToShow >= camera.x + window.width then x = x - Debugger.infowidth * #Debugger.infoToShow end if y + Debugger.infoheight >= camera.y + window.height then y = y - Debugger.infoheight end - love.graphics.setColor(0,0,0,100) + love.graphics.setColor(0,0,0,100/255) love.graphics.rectangle( 'fill', x, y, Debugger.infowidth * #Debugger.infoToShow, Debugger.infoheight ) - love.graphics.setColor(0,0,0,50) + love.graphics.setColor(0,0,0,50/255) love.graphics.rectangle( 'line', x, y, Debugger.infowidth * #Debugger.infoToShow, Debugger.infoheight ) - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1,1,1,1) x, y = x + 5, y + 5 local origy = y for _,info in pairs(Debugger.infoToShow) do diff --git a/src/dialog.lua b/src/dialog.lua index 7ec188ebb..905680052 100644 --- a/src/dialog.lua +++ b/src/dialog.lua @@ -124,7 +124,7 @@ function Dialog:draw() self.drawable:draw() end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) return x, y end diff --git a/src/flyin.lua b/src/flyin.lua index 76392e7f2..0235389ef 100644 --- a/src/flyin.lua +++ b/src/flyin.lua @@ -105,13 +105,13 @@ function flyin:draw() for i = #flyin.flying, 1, -1 do local v = flyin.flying[i] if v.show then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) self:drawCharacter(v, v.x, v.y, v.r - (v.r % (math.pi / 2)), math.min(v.s, 5), math.min(v.s, 5), 22, 32) -- black mask while coming out of 'tunnel' if v.s <= 1 then - love.graphics.setColor(0, 0, 0, 255 * (1 - v.s )) + love.graphics.setColor(0, 0, 0, (1 - v.s )) self:drawCharacter(v, v.x, v.y, v.r - (v.r % (math.pi / 2)), math.min(v.s, 5), math.min(v.s, 5), 22, 32) diff --git a/src/fonts.lua b/src/fonts.lua index 366544ef8..97f17b948 100644 --- a/src/fonts.lua +++ b/src/fonts.lua @@ -11,27 +11,27 @@ local Fonts = { _last = nil, tasty = require 'vendor/tastytext', colors = { - white = {255, 255, 255}, - teal = {74, 205, 180}, - blue_light = {100, 143, 154}, - olive = {190, 198, 149}, - green_light = {90, 145, 111}, - green_dark = {0, 83, 67}, - grey = {139, 139, 139}, - peach = {238, 212, 191}, - yellow = {235, 207, 82}, - orange = {204, 132, 50}, - red_light = {166, 94, 96}, - red = {157, 26,18}, - red_dark = {95, 31, 41}, - purple = {96, 21, 99} + white = {1, 1, 1}, + teal = {74/255, 205/255, 180/255}, + blue_light = {100/255, 143/255, 154/255}, + olive = {190/255, 198/255, 149/255}, + green_light = {90/255, 145/255, 111/255}, + green_dark = {0, 83/255, 67/255}, + grey = {139/255, 139/255, 139/255}, + peach = {238/255, 212/255, 191/255}, + yellow = {235/255, 207/255, 82/255}, + orange = {204/255, 132/255, 50/255}, + red_light = {166/255, 94/255, 96/255}, + red = {157/255, 26/255, 18/255}, + red_dark = {95/255, 31/255, 41/255}, + purple = {96/255, 21/255, 99/255} } } for _,x in pairs( fonts ) do - local img = love.graphics.newImage( "images/fonts/" .. x .. ".png" ) - img:setFilter( 'nearest', 'nearest' ) - Fonts[x] = love.graphics.newImageFont( img, glyphs, 1 ) + local font = love.graphics.newImageFont("images/fonts/" .. x .. ".png", glyphs, 1) + font:setFilter( 'nearest', 'nearest' ) + Fonts[x] = font end function Fonts.set( x ) diff --git a/src/hawk/application.lua b/src/hawk/application.lua index 7a9cc1d5c..e71807d08 100644 --- a/src/hawk/application.lua +++ b/src/hawk/application.lua @@ -8,7 +8,7 @@ local api = require 'api' local Application = middle.class('Application') function Application:initialize(configurationPath) - assert(love.filesystem.exists(configurationPath), + assert(love.filesystem.getInfo(configurationPath), "Can't read app configuration at path: " .. configurationPath) self.config = config.load(configurationPath) self.gamesaves = gamesave(3) @@ -47,11 +47,11 @@ function Application:errhand(msg) -- Load. 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.newFont(14) love.graphics.setFont(font) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.clear() local trace = debug.traceback() @@ -96,11 +96,11 @@ function Application:releaseerrhand(msg) -- Load. 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.newFont(14) love.graphics.setFont(font) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.clear() diff --git a/src/hawk/i18n.lua b/src/hawk/i18n.lua index 30694e6c1..695e6d06a 100644 --- a/src/hawk/i18n.lua +++ b/src/hawk/i18n.lua @@ -10,7 +10,7 @@ end function i18n:getLocale(locale) local path = self.path .. "/" .. locale .. '.json' - assert(love.filesystem.exists(path), string.format("The locale %q is unknown", locale)) + assert(love.filesystem.getInfo(path), string.format("The locale %q is unknown", locale)) local contents, _ = love.filesystem.read(path) return json.decode(contents) end diff --git a/src/hawk/sparkle/windows.lua b/src/hawk/sparkle/windows.lua index 21c66d17b..50e92599b 100644 --- a/src/hawk/sparkle/windows.lua +++ b/src/hawk/sparkle/windows.lua @@ -46,25 +46,18 @@ end -- Remove all files in a directory. The directory must be in the game save -- folder function windows.removeRecursive(path) - if love.filesystem.isFile(path) then - return love.filesystem.remove(path) + if not love.filesystem.getInfo( path ) then + return true end - - for k, file in ipairs(love.filesystem.getDirectoryItems(path)) do - local subpath = path .. "/" .. file - - if love.filesystem.isDirectory(subpath) then - if not windows.removeRecursive(subpath) then - return false - end - end - - if not love.filesystem.remove(subpath) then - return false + if love.filesystem.getInfo( path , "directory" ) then + for _, child in ipairs( love.filesystem.getDirectoryItems( path )) do + windows.removeRecursive( path .. '/' .. child ) + love.filesystem.remove( path .. '/' .. child ) end + elseif love.filesystem.getInfo( path ) then + love.filesystem.remove( path ) end - - return true + return love.filesystem.remove( path ) end function windows.cleanup() diff --git a/src/hawk/store.lua b/src/hawk/store.lua index 5b9b4ba30..9be879711 100644 --- a/src/hawk/store.lua +++ b/src/hawk/store.lua @@ -6,7 +6,7 @@ local Datastore = middle.class('Datastore') function Datastore:initialize(namespace) self.path = namespace .. ".json" - if not love.filesystem.exists(self.path) then + if not love.filesystem.getInfo(self.path) then love.filesystem.write(self.path, json.encode({})) end diff --git a/src/hud.lua b/src/hud.lua index c8ec3cbfc..1be5a1df8 100644 --- a/src/hud.lua +++ b/src/hud.lua @@ -74,7 +74,7 @@ function HUD:draw( player ) self.x, self.y = camera.x + 10, camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( chevron, self.x, self.y) --love.graphics.stencil(function() self.energy_stencil(self.x, self.y) end)--doesn't pass arguments so is essentially useless love.graphics.setColor( @@ -89,7 +89,7 @@ function HUD:draw( player ) love.graphics.draw(energy, energy_quad, self.x + 50, self.y) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) local currentWeapon = player.inventory:currentWeapon() if currentWeapon and not player.doBasicAttack or (player.holdingAmmo and currentWeapon) then @@ -99,17 +99,17 @@ function HUD:draw( player ) love.graphics.draw(self.sheet, self.character_quad, self.x + 7, self.y + 17) end love.graphics.draw(lens, self.x, self.y) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.print(player.money, self.x + 69, self.y + 41,0,0.5,0.5) love.graphics.print(player.character.name, self.x + 60, self.y + 15,0,0.5,0.5) if player.activeEffects then - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) for i,effect in ipairs(player.activeEffects) do love.graphics.printf(effect, self.x + 20, self.y + 40 + (20 * i), 350, "left",0,0.5,0.5) end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) if self.saving then self.savingAnimation:draw(savingImage, self.x + camera:getWidth() - 60, self.y) diff --git a/src/instructions.lua b/src/instructions.lua index b15516c9e..2cfb5c9af 100644 --- a/src/instructions.lua +++ b/src/instructions.lua @@ -87,14 +87,14 @@ function state:draw() local n = 1 - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local back = controls:getKey("START") .. ": BACK TO MENU" local howto = controls:getKey("ATTACK") .. " OR " .. controls:getKey("JUMP") .. ": REASSIGN CONTROL" love.graphics.print(back, 25, 25) love.graphics.print(howto, 25, 55) love.graphics.print(self.statusText, self.left_column, 280) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) for i, button in ipairs(menu.options) do local y = self.top + self.spacing * (i - 1) @@ -108,7 +108,7 @@ function state:draw() love.graphics.print(key, self.right_column, y, 0, 0.5) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw(self.arrow, 135, 87 + self.spacing * menu:selected()) end diff --git a/src/items/item.lua b/src/items/item.lua index 52bda17b4..c31dcc00f 100644 --- a/src/items/item.lua +++ b/src/items/item.lua @@ -43,7 +43,7 @@ function Item.new(node, count) imagePath = 'images/' .. item.type .. 's/' .. item.name .. '.png' end - if not love.filesystem.exists(imagePath) then + if not love.filesystem.getInfo(imagePath) then return nil end diff --git a/src/level.lua b/src/level.lua index b873e23a3..2afb1a4c1 100644 --- a/src/level.lua +++ b/src/level.lua @@ -100,9 +100,9 @@ local function setBackgroundColor(map) love.graphics.setBackgroundColor(0, 0, 0) return end - love.graphics.setBackgroundColor(tonumber(prop.red), - tonumber(prop.green), - tonumber(prop.blue)) + love.graphics.setBackgroundColor(tonumber(prop.red)/255, + tonumber(prop.green)/255, + tonumber(prop.blue)/255) end local function getCameraOffset(map) @@ -136,7 +136,7 @@ function Level.new(name) level.state = 'idle' -- TODO: Use state machine level.name = name - assert( love.filesystem.exists( "maps/" .. name .. ".lua" ), + assert( love.filesystem.getInfo( "maps/" .. name .. ".lua" ), "maps/" .. name .. ".lua not found.\n\n" .. "Have you generated your maps lately?\n\n" .. "LINUX / OSX: run 'make maps'\n" .. diff --git a/src/main.lua b/src/main.lua index 2514e44b3..38222d45e 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1,14 +1,6 @@ local utils = require 'utils' local app = require 'app' -function love.errhand(msg) - app:errhand(msg) -end - -function love.releaseerrhand(msg) - app:releaseerrhand(msg) -end - local tween = require 'vendor/tween' local Gamestate = require 'vendor/gamestate' local sound = require 'vendor/TEsound' @@ -47,11 +39,10 @@ function love.load(arg) local version = utils.split(love._version:gsub("%.", "/"),"/") local major = tonumber(version[1]) local minor = tonumber(version[2]) - local revision = tonumber(version[3]) - if major ~= 0 or - minor ~= 10 then - error("Love 0.10.0 is required") + if major < 11 or + minor < 3 then + error("Love 11.3 or later is required") end -- The Mavericks builds of Love adds too many arguments @@ -308,16 +299,16 @@ function love.draw() camera:unset() if paused then - love.graphics.setColor(75, 75, 75, 125) + love.graphics.setColor(75/255, 75/255, 75/255, 125/255) love.graphics.rectangle('fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight()) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end if debugger.on then debugger:draw() end -- If the user has turned the FPS display on AND a screenshot is not being taken if window.showfps and window.dressing_visible then - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) fonts.set('big') love.graphics.print( love.timer.getFPS() .. ' FPS', love.graphics.getWidth() - 100, 5, 0, 1, 1 ) fonts.revert() diff --git a/src/nodes/consumable.lua b/src/nodes/consumable.lua index 9add29f87..669fe669b 100644 --- a/src/nodes/consumable.lua +++ b/src/nodes/consumable.lua @@ -21,7 +21,7 @@ function Consumable.new(node, collider) consumable.name = node.name consumable.type = 'consumable' - if not love.filesystem.exists('images/consumables/'..node.name..'.png') then + if not love.filesystem.getInfo('images/consumables/'..node.name..'.png') then return nil end diff --git a/src/nodes/cutscenes/welcome_to_hawkthorne.lua b/src/nodes/cutscenes/welcome_to_hawkthorne.lua index 800fbb10d..ab7a62677 100644 --- a/src/nodes/cutscenes/welcome_to_hawkthorne.lua +++ b/src/nodes/cutscenes/welcome_to_hawkthorne.lua @@ -33,7 +33,7 @@ function Lightning:initialize(x, y) end function Lightning:draw() - love.graphics.setColor(255, 255, 255, self.opacity) + love.graphics.setColor(1, 1, 1, self.opacity) self.animation:draw(self.image, self.position.x, self.position.y) end @@ -113,20 +113,20 @@ function Scene:start(player) "Today, moist towelettes are stocked in every supermarket, while arcade after arcade closes.", "Nevertheless, I designed this game to be played upon my death by you and whatever cabal of fruits, junkies, and sluts you call your friends.", "Only one player can win... the first to reach my throne inside Castle Hawkthorne. Their reward, Pierce, will be your inheritance.", - "So you see, Pierce, turns out you were right. Video games are important. Ha Ha Ha ! WORST SON EVER!", + "So you see, Pierce, turns out you were right. Video games are important. Ha Ha Ha! WORST SON EVER!", } self.dialog = dialog.new("Welcome to Hawkthorne.", function() tween(3, self.camera, {tx=x, ty=y + 48}, 'outQuad', function() - tween(0.1, self.lightning, {opacity=255}, 'outQuad', function() + tween(0.1, self.lightning, {opacity=1}, 'outQuad', function() self.shake = true self.enter = true tween(1, self.lightning, {opacity=0}, 'outQuad') - tween(1, self.fade, {0, 0, 200, 130}, 'outQuad') - tween(1, self.nodes.oval, {opacity=255}, 'outQuad', function() - tween(3, self.nodes.head, {opacity=255}, 'outQuad') - tween(3, self, {sparkle_opacity=255}, 'outQuad') + tween(1, self.fade, {0, 0, 200/255, 130/255}, 'outQuad') + tween(1, self.nodes.oval, {opacity=1}, 'outQuad', function() + tween(3, self.nodes.head, {opacity=1}, 'outQuad') + tween(3, self, {sparkle_opacity=1}, 'outQuad') self.shake = false self.oval = self.pulse @@ -184,24 +184,24 @@ function Scene:draw(player) love.graphics.setColor(unpack(self.fade)) love.graphics.rectangle('fill', camera.x, camera.y, love.graphics.getWidth(), love.graphics.getHeight()) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) -- Lightning self.lightning:draw() - love.graphics.setColor(255, 255, 255, self.nodes.oval.opacity) + love.graphics.setColor(1, 1, 1, self.nodes.oval.opacity) self.oval:draw(self.ovalImg, self.nodes.oval.x, self.nodes.oval.y) - love.graphics.setColor(255, 255, 255, self.nodes.head.opacity) + love.graphics.setColor(1, 1, 1, self.nodes.head.opacity) self.talking:draw(self.head, self.nodes.head.x, self.nodes.head.y) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) for i, s in pairs(self.sparkle_animations) do local spark = self.sparkles[i] - love.graphics.setColor(255, 255, 255, self.sparkle_opacity) + love.graphics.setColor(1, 1, 1, self.sparkle_opacity) s:draw(self.sparkle, self.nodes[spark].x, self.nodes[spark].y) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end diff --git a/src/nodes/enemies/acornBoss.lua b/src/nodes/enemies/acornBoss.lua index 791e3a447..602c356ff 100644 --- a/src/nodes/enemies/acornBoss.lua +++ b/src/nodes/enemies/acornBoss.lua @@ -136,7 +136,7 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) if enemy.state == 'rage' then love.graphics.draw(bossPicRage, x + 69, y + 10 ) @@ -144,7 +144,7 @@ return { love.graphics.draw(bossPic, x + 69, y + 10 ) end - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "ACORN KING", x + 15, y + 15, 100, 'left', 0, 0.9, 0.9 ) love.graphics.printf( "BOSS", x + 15, y + 41, 52, 'center' ) @@ -163,7 +163,7 @@ return { love.graphics.draw(energy, energy_quad, x , y) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemies/benzalkBoss.lua b/src/nodes/enemies/benzalkBoss.lua index 18c762f69..cd09c81da 100644 --- a/src/nodes/enemies/benzalkBoss.lua +++ b/src/nodes/enemies/benzalkBoss.lua @@ -119,11 +119,11 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) love.graphics.draw( bossPic, x + 69, y + 10 ) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "BENZALK", x + 15, y + 15, 52, 'center' ) love.graphics.printf( "GUARD", x + 15, y + 41, 52, 'center' ) @@ -141,8 +141,8 @@ return { local energy_quad = love.graphics.newQuad( -(max_hp - enemy.hp) * rate, 0, 70, 60, energy:getWidth(), energy:getHeight()) love.graphics.draw(energy, energy_quad, x , y) - - love.graphics.setColor( 255, 255, 255, 255 ) + + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemies/laserlotusBoss.lua b/src/nodes/enemies/laserlotusBoss.lua index bdd603103..e5de0d8ca 100644 --- a/src/nodes/enemies/laserlotusBoss.lua +++ b/src/nodes/enemies/laserlotusBoss.lua @@ -102,11 +102,11 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) love.graphics.draw( bossPic, x + 69, y + 10 ) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "LASER LOTUS", x + 15, y + 15, 100, 'left', 0, 0.9, 0.9 ) love.graphics.printf( "BOSS", x + 15, y + 41, 52, 'center' ) @@ -124,8 +124,8 @@ return { local energy_quad = love.graphics.newQuad( -(max_hp - enemy.hp) * rate, 0, 70, 60, energy:getWidth(), energy:getHeight()) love.graphics.draw(energy, energy_quad, x , y) - - love.graphics.setColor( 255, 255, 255, 255 ) + + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemies/qfo.lua b/src/nodes/enemies/qfo.lua index ff79baeca..325e73c26 100644 --- a/src/nodes/enemies/qfo.lua +++ b/src/nodes/enemies/qfo.lua @@ -102,11 +102,11 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) love.graphics.draw( bossPic, x + 69, y + 10 ) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "QFO", x + 15, y + 15, 52, 'center' ) love.graphics.printf( "BOSS", x + 15, y + 41, 52, 'center' ) @@ -124,8 +124,8 @@ return { local energy_quad = love.graphics.newQuad( -(max_hp - enemy.hp) * rate, 0, 70, 60, energy:getWidth(), energy:getHeight()) love.graphics.draw(energy, energy_quad, x , y) - - love.graphics.setColor( 255, 255, 255, 255 ) + + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemies/tSnake.lua b/src/nodes/enemies/tSnake.lua index 17b7dfa6a..13aee0175 100644 --- a/src/nodes/enemies/tSnake.lua +++ b/src/nodes/enemies/tSnake.lua @@ -110,11 +110,11 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) love.graphics.draw( bossPic, x + 69, y + 10 ) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "TROUSER SNAKE", x + 10, y + 15, 100, 'left' , 0, .8, .8) love.graphics.printf( "BOSS", x + 15, y + 41, 52, 'center' ) @@ -134,7 +134,7 @@ return { love.graphics.draw(energy, energy_quad, x , y) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemies/turkeyBoss.lua b/src/nodes/enemies/turkeyBoss.lua index 4ab51ee22..88c40a8f0 100644 --- a/src/nodes/enemies/turkeyBoss.lua +++ b/src/nodes/enemies/turkeyBoss.lua @@ -109,11 +109,11 @@ return { x, y = camera.x + window.width - 130 , camera.y + 10 - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( bossChevron, x , y ) love.graphics.draw( bossPic, x + 69, y + 10 ) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf( "JIVE MOTHER", x + 15, y + 15, 100, 'left', 0, 0.9, 0.9 ) love.graphics.printf( "BOSS", x + 15, y + 41, 52, 'center' ) @@ -131,8 +131,8 @@ return { local energy_quad = love.graphics.newQuad( -(max_hp - enemy.hp) * rate, 0, 70, 60, energy:getWidth(), energy:getHeight()) love.graphics.draw(energy, energy_quad, x , y) - - love.graphics.setColor( 255, 255, 255, 255 ) + + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end, diff --git a/src/nodes/enemy.lua b/src/nodes/enemy.lua index 0511b5ebd..3756ad496 100644 --- a/src/nodes/enemy.lua +++ b/src/nodes/enemy.lua @@ -113,7 +113,7 @@ function Enemy.new(node, collider, enemytype) enemy.knockbackDisabled = enemy.props.knockbackDisabled or false enemy.fadeIn = enemy.props.fadeIn or false - enemy.fade = {255, 255, 255, 0} + enemy.fade = {1, 1, 1, 0} enemy.animations = {} for state, data in pairs( enemy.props.animations ) do @@ -515,12 +515,12 @@ function Enemy:draw() local r, g, b, a = love.graphics.getColor() if self.flash then - love.graphics.setColor(255, 0, 0, 255) + love.graphics.setColor(1, 0, 0, 1) elseif self.fadeIn then - tween(2, self.fade, {255, 255, 255, 255}, 'outQuad', function() self.fadeIn = false end) + tween(2, self.fade, {1, 1, 1, 1}, 'outQuad', function() self.fadeIn = false end) love.graphics.setColor(unpack(self.fade)) else - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end if not self.dead then diff --git a/src/nodes/floorspace.lua b/src/nodes/floorspace.lua index 9e0d23d71..50f390082 100644 --- a/src/nodes/floorspace.lua +++ b/src/nodes/floorspace.lua @@ -68,13 +68,13 @@ function Footprint:moveBoundingBox() end function Footprint:draw() - love.graphics.setColor( 0, 0, 0, 20 ) + love.graphics.setColor( 0, 0, 0, 20/255 ) love.graphics.line( self.x, self.y-1-self.offset, self.x + self.width, self.y-1-self.offset ) love.graphics.line( self.x+1, self.y-self.offset, self.x + self.width+1, self.y-self.offset ) love.graphics.line( self.x, self.y+1-self.offset, self.x + self.width, self.y+1-self.offset ) - love.graphics.setColor( 0, 0, 0, 80 ) + love.graphics.setColor( 0, 0, 0, 80/255 ) love.graphics.line( self.x, self.y-self.offset, self.x + self.width, self.y-self.offset ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end local Floorspace = {} diff --git a/src/nodes/liquid.lua b/src/nodes/liquid.lua index 6f06ae5fe..db3db3c58 100644 --- a/src/nodes/liquid.lua +++ b/src/nodes/liquid.lua @@ -188,7 +188,7 @@ function Liquid:update(dt, player) end function Liquid:draw() - love.graphics.setColor( 255, 255, 255, self.fade and 255 or utils.map( self.opacity, 0, 1, 0, 255 ) ) + love.graphics.setColor( 1, 1, 1, self.fade and 1 or self.opacity ) for i = 0, ( self.width / 24 ) - 1, 1 do love.graphics.draw( self.image, @@ -198,10 +198,10 @@ function Liquid:draw() ) for j = 1, ( self.height / 24 ) - 1, 1 do love.graphics.setColor( - 255, 255, 255, + 1, 1, 1, utils.map( self.fade and ( 1 - ( ( 1 - self.opacity ) / ( ( self.height / 24 ) - 1 ) * j ) ) or self.opacity, - 0, 1, 0, 255 + 0, 1, 0, 1 ) ) love.graphics.draw( @@ -212,7 +212,7 @@ function Liquid:draw() ) end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end return Liquid diff --git a/src/nodes/npc.lua b/src/nodes/npc.lua index ab9ac28b4..759568433 100644 --- a/src/nodes/npc.lua +++ b/src/nodes/npc.lua @@ -165,7 +165,7 @@ function Menu:draw(x, y) i = i - self.offset if i > 0 then -- black text stroke created by 4 different offsets behind the white text - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf(value.text, x - self.itemWidth, y - (i - 1) * 12, self.itemWidth, 'right', 0, 1, 1, 0.5, 0.5) love.graphics.printf(value.text, x - self.itemWidth, y - (i - 1) * 12, @@ -175,18 +175,18 @@ function Menu:draw(x, y) love.graphics.printf(value.text, x - self.itemWidth, y - (i - 1) * 12, self.itemWidth, 'right', 0, 1, 1, -0.5, -0.5) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.printf(value.text, x - self.itemWidth, y - (i - 1) * 12, self.itemWidth, 'right') if self.choice == i then -- pointer - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw(self.tick, x - (Font:getWidth(value.text)+10), y - (i - 1) * 12 + 2) end end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) fonts.revert() end @@ -397,9 +397,9 @@ function NPC:draw() self.emotion:draw(self) if self.displayAffection then - love.graphics.setColor( 0, 0, 255, 255 ) + love.graphics.setColor( 0, 0, 1, 1 ) love.graphics.print("+ " .. self.affection, self.affectionText.x, self.affectionText.y, 0, 0.7, 0.7) - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1,1,1,1) end end diff --git a/src/nodes/splat.lua b/src/nodes/splat.lua index 5cf5d0a22..c00b83fb4 100644 --- a/src/nodes/splat.lua +++ b/src/nodes/splat.lua @@ -96,7 +96,7 @@ end function Splat:draw() - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) for _,s in pairs( self.splats ) do @@ -111,7 +111,7 @@ function Splat:draw() end end - love.graphics.setColor( 200, 200, 200, 255 ) -- Giving darker shade to splash on ceiling and floor + love.graphics.setColor( 200/255, 200/255, 200/255, 1 ) -- Giving darker shade to splash on ceiling and floor if s.floorQuad then if y < self.floor.y then @@ -126,7 +126,7 @@ function Splat:draw() end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end return Splat diff --git a/src/nodes/trampoline.lua b/src/nodes/trampoline.lua index 18ea1c3e4..85f85176e 100644 --- a/src/nodes/trampoline.lua +++ b/src/nodes/trampoline.lua @@ -84,9 +84,9 @@ end function Trampoline:draw() if self.whiteout > 0 then - love.graphics.setColor( 255, 255, 255, math.min( self.whiteout, 255 ) ) + love.graphics.setColor( 1, 1, 1, math.min( self.whiteout, 255 ) / 255 ) love.graphics.rectangle( 'fill', 0, 0, window.width, window.height * 2 ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end end diff --git a/src/options.lua b/src/options.lua index 5492270e0..761f2df37 100644 --- a/src/options.lua +++ b/src/options.lua @@ -332,7 +332,7 @@ end function state:draw() VerticalParticles.draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local back = controls:getKey("START") .. ": BACK TO MENU" love.graphics.print(back, 25, 25) @@ -342,7 +342,7 @@ function state:draw() camera:getWidth() / 2 - self.background:getWidth() / 2, camera:getHeight() / 2 - self.background:getHeight() / 2) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) local xoffset = self.page == 'optionspage' and 20 or 0 @@ -369,10 +369,10 @@ function state:draw() if self.page ~= 'optionspage' then love.graphics.draw( self.arrow, 138, 124 + ( 26 * ( menu.selection - 1 ) ) ) else - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1,1,1,1) love.graphics.draw( self.bigarrow, 138, 116 + ( 26 * ( menu.selection - 1) ) ) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end return state diff --git a/src/overworld.lua b/src/overworld.lua index 5545402fd..782734685 100644 --- a/src/overworld.lua +++ b/src/overworld.lua @@ -367,7 +367,7 @@ end function state:draw() - love.graphics.setBackgroundColor(133, 185, 250) + love.graphics.setBackgroundColor(133/255, 185/255, 250/255) for x=math.floor(camera.x / 36), math.floor((camera.x + camera:getWidth()) / 36) do for y=math.floor(camera.y / 36), math.floor((camera.y + camera:getHeight()) / 36) do @@ -394,7 +394,7 @@ function state:draw() --flags for _,flag in pairs(self.flags) do if flag then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(self.flag_image, flag['x'] * map.tileWidth + 10, flag['y'] * map.tileHeight - 24) end end @@ -428,13 +428,13 @@ function state:draw() end end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) for _,cloud in pairs(self.clouds) do if cloud then - love.graphics.setColor( 255, 255, 255, cloud.o * 255 ) + love.graphics.setColor( 1, 1, 1, cloud.o ) love.graphics.draw(self.cloudpuffsprite, self.cloudquads[cloud.q], cloud.x, cloud.y ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end end diff --git a/src/pause.lua b/src/pause.lua index 268796335..2aee5bd60 100644 --- a/src/pause.lua +++ b/src/pause.lua @@ -101,13 +101,13 @@ function state:draw() local controls = self.player.controls - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.print('Controls', 198, 101) love.graphics.print('Options', 198, 131) love.graphics.print('Quit to Map', 198, 161) love.graphics.print('Quit to Menu', 198, 191) love.graphics.print('Quit to Desktop', 198, 221) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw(self.arrow, 156, 96 + 30 * self.option) local back = controls:getKey("START") .. ": BACK TO GAME" local howto = controls:getKey("ATTACK") .. " OR " .. controls:getKey("JUMP") .. ": SELECT ITEM" diff --git a/src/player.lua b/src/player.lua index fdfcbf0f4..c743bf503 100644 --- a/src/player.lua +++ b/src/player.lua @@ -646,7 +646,7 @@ function Player:hurt(damage) self.showDamageText = true local color = self.color - self.color = {255, 0, 0, 255} + self.color = {1, 0, 0, 1} if not color then color = self.color end if damage ~= nil then @@ -863,11 +863,11 @@ function Player:draw() if self.showDamageText then local health = self.damageTaken if health > 0 then health = health * -1 end - love.graphics.setColor( 255, 0, 0, 255 ) + love.graphics.setColor( 1, 0, 0, 1 ) love.graphics.print(health, self.healthText.x, self.healthText.y, 0, 0.7, 0.7) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end diff --git a/src/playerEffects.lua b/src/playerEffects.lua index a5ab016d9..7860aec8f 100644 --- a/src/playerEffects.lua +++ b/src/playerEffects.lua @@ -78,7 +78,7 @@ function PlayerEffects.zombie(player) end)) end player:addEffectsTimer(Timer.add(6, function () -- Set costume to zombie and double unarmed player damage. - if love.filesystem.exists("images/characters/" .. player.character.name .. "/zombie.png") then + if love.filesystem.getInfo("images/characters/" .. player.character.name .. "/zombie.png") then player.character.costume = 'zombie' end HUDMessage("holy crap, you are a zombie!", player, 10) diff --git a/src/pokergame.lua b/src/pokergame.lua index 2ad50672d..15e008051 100644 --- a/src/pokergame.lua +++ b/src/pokergame.lua @@ -105,7 +105,7 @@ function state:enter(previous, player, screenshot) self.prompt = nil self.player = player - self.hasNakedSprite = love.filesystem.exists("images/characters/" .. self.player.character.name .. "/naked.png") + self.hasNakedSprite = love.filesystem.getInfo("images/characters/" .. self.player.character.name .. "/naked.png") self.naked = self.player.character.costume == 'naked' or false self.nakedBet = false self.nakedMoney = 100 @@ -434,9 +434,9 @@ function state:draw() if self.screenshot then love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() ) else - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle( 'fill', 0, 0, love.graphics:getDimensions() ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end love.graphics.draw( self.table, self.center_x - ( self.table:getWidth() / 2 ), self.center_y - ( self.table:getHeight() / 2 ) ) @@ -478,14 +478,14 @@ function state:draw() co = 0 -- color offset if not n.active then co = 180 end if i == self.selection + 1 and self.horizontal_selection == 0 then - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( self.options_arrow, x - 5, y + 4 ) co = 255 end - love.graphics.setColor( 255 - co, 255 - co, 255 - co ) + love.graphics.setColor( (255 - co) / 255, (255 - co) / 255, (255 - co) / 255 ) love.graphics.print( n.name, x + 3, y + 3, 0, 0.5 ) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) cx = 0 -- chip offset x for color,count in pairs( cardutils.getChipCounts( self.player.money ) ) do @@ -535,7 +535,7 @@ function state:draw() love.graphics.print( 'Bet $ ' .. self.bet , 315+36+camera.x, 112+33+camera.y, 0, 0.5 ) end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) -- Ensure font is reverted fonts.revert() @@ -559,7 +559,7 @@ function state:draw_card( card, suit, flip, x, y, offset, overlay ) if(overlay) then darkness = 150 end - love.graphics.setColor( darkness, darkness, darkness ) + love.graphics.setColor( darkness/255, darkness/255, darkness/255 ) love.graphics.draw( self.cardSprite, _card, -- image, quad x + utils.map( flip, 50, limit, w / 2, 0 ), -- offset for flip @@ -569,7 +569,7 @@ function state:draw_card( card, suit, flip, x, y, offset, overlay ) utils.map( flip, 50, limit , 1 + st, 1 ) -- scale height for flip ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end function get_first_nil(t) diff --git a/src/prompt.lua b/src/prompt.lua index 5bf5d3b27..d3243fca4 100644 --- a/src/prompt.lua +++ b/src/prompt.lua @@ -60,11 +60,11 @@ function Prompt:draw() local x = x2 - self.width + self.height / 2 local y = y1 - self.height / 2 - love.graphics.setColor(112, 28, 114, 255) + love.graphics.setColor(112/255, 28/255, 114/255, 1) love.graphics.rectangle('fill', x, y, self.width, self.height) - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 1) love.graphics.rectangle('line', x, y, self.width, self.height) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw(corner, x - 2, y - 2) love.graphics.draw(corner, x - 2, y + self.height - 2) love.graphics.draw(corner, x - 2 + self.width, y - 2) @@ -74,10 +74,10 @@ function Prompt:draw() y = y + self.height / 4 for i,o in pairs( self.options ) do - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) if i == self.selected then - love.graphics.setColor( 254, 204, 2, 255 ) + love.graphics.setColor( 254/255, 204/255, 2/255, 1 ) love.graphics.draw(arrow, x - arrow:getWidth() - 3, y + 1) end @@ -85,7 +85,7 @@ function Prompt:draw() x = x + font:getWidth(o) + 20 --padding end end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) fonts.revert() end diff --git a/src/scanning.lua b/src/scanning.lua index 7df829d22..5cbd14954 100644 --- a/src/scanning.lua +++ b/src/scanning.lua @@ -52,9 +52,9 @@ end function state:draw() --background colour - love.graphics.setColor( 60, 86, 173, 255 ) + love.graphics.setColor( 60/255, 86/255, 173/255, 1 ) love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) -- coloured backgrounds local width = window.width diff --git a/src/select.lua b/src/select.lua index 0b9d1e875..a3234a934 100644 --- a/src/select.lua +++ b/src/select.lua @@ -196,7 +196,7 @@ function state:update(dt) local current = character.current() current.changed = true - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) local level = Gamestate.get('overworld') level:reset() @@ -246,11 +246,11 @@ function state:draw() 23, window.width, 'center') local x, y = background.getPosition(1, 3) - love.graphics.setColor(255, 255, 255, 200) + love.graphics.setColor(1, 1, 1, 200/255) love.graphics.print("INSUFFICIENT", x, y + 5, 0, 0.5, 0.5, 12, -6) love.graphics.print( "FRIENDS" , x, y + 5, 0, 0.5, 0.5, -12, -32) love.graphics.print(self.current_page .. ' / ' .. #self.character_selections, x + 60, y + 15, 0, 0.5, 0.5 ) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end for i=0,1,1 do diff --git a/src/selectbackground.lua b/src/selectbackground.lua index 02b45505c..453c1c1cf 100644 --- a/src/selectbackground.lua +++ b/src/selectbackground.lua @@ -59,7 +59,7 @@ function selectBackground.draw() for _,strip in ipairs(strips) do strip:draw() end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) local x, y = strips[8]:getCharacterPos() love.graphics.draw(unknownFriend, x + 14, y + 10) diff --git a/src/shopping.lua b/src/shopping.lua index be1869fc4..12a2139e0 100644 --- a/src/shopping.lua +++ b/src/shopping.lua @@ -120,7 +120,7 @@ function state:enter(previous, player, screenshot, supplierName) local name = info[1] local amount = info[2] local item - if love.filesystem.exists('items/'..category) then + if love.filesystem.getInfo('items/'..category) then local itemNode = require ('items/' .. category .. '/' .. name) item = Item.new(itemNode) elseif category=="keys" then @@ -401,9 +401,9 @@ function state:draw() if self.screenshot then love.graphics.draw( self.screenshot, camera.x, camera.y, 0, window.width / love.graphics:getWidth(), window.height / love.graphics:getHeight() ) else - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) end -- HUD @@ -436,9 +436,9 @@ function state:draw() if not self.supplier[self.categories[i]] then love.graphics.draw( self.noselection, xcorner + 19 + 32*visI, ycorner + 22, 0 ) - love.graphics.setColor( 101, 101, 101, 213 ) + love.graphics.setColor( 101/255, 101/255, 101/255, 213/255 ) love.graphics.print(string.upper(category), xcorner + 13 + 32*visI + self.shift[category], ycorner + 45, 0, 0.5, 0.5 ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) else love.graphics.print(string.upper(category), xcorner + 13 + 32*visI + self.shift[category], ycorner + 45, 0, 0.5, 0.5 ) end diff --git a/src/start.lua b/src/start.lua index 19d5ed3b2..03dba9224 100644 --- a/src/start.lua +++ b/src/start.lua @@ -159,13 +159,13 @@ end function state:draw() VerticalParticles.draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(self.background, camera:getWidth() / 2 - self.background:getWidth() / 2, camera:getHeight() / 2 - self.background:getHeight() / 2) if self.window == 'main' then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local howto = controls:getKey("ATTACK") .. " OR " .. controls:getKey("JUMP") .. ": SELECT SLOT" local delete = controls:getKey("INTERACT") .. ": DELETE SLOT" love.graphics.print(howto, 25, 25) @@ -174,7 +174,7 @@ function state:draw() local y = 90 - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) for n, opt in pairs(self.options) do if tonumber( n ) ~= nil then @@ -189,7 +189,7 @@ function state:draw() end end end - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) -- Determine how far the arrow should move for the last menu item local arrowYFactor = 2 if self.selection > 2 then @@ -197,16 +197,16 @@ function state:draw() end love.graphics.draw( self.arrow, 135, 127 + ( (yFactor * arrowYFactor) * ( self.selection - 1 ) ) ) elseif self.window == 'deleteSlot' then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) local howto = controls:getKey("UP") .. " OR " .. controls:getKey("DOWN") .. ": CHANGE OPTION" local delete = controls:getKey("JUMP") .. ": SELECT OPTION" love.graphics.print(howto, 25, 25) love.graphics.print(delete, 25, 55) - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.printf('Are you sure you want to delete this slot?', 155, 110, self.background:getWidth() - 30, 'left') love.graphics.print('Yes', 175, 175, 0) love.graphics.print('No', 175, 205, 0) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( self.arrow, 140, 170 + 30 * self.selectionDelete ) end end diff --git a/src/test/lunatest.lua b/src/test/lunatest.lua index 68ac6d395..e6e1831b9 100644 --- a/src/test/lunatest.lua +++ b/src/test/lunatest.lua @@ -61,7 +61,7 @@ local debug = debug -- Use luasocket's gettime(), luaposix' gettimeofday(), or os.date for -- timestamps -local now = pcall(require, "socket") and socket.gettime or +local now = pcall(require, "socket") and socket and socket.gettime or pcall(require, "posix") and posix.gettimeofday and function () local s, us = posix.gettimeofday() diff --git a/src/test/test_updater.lua b/src/test/test_updater.lua index ae70e0783..4031cda60 100644 --- a/src/test/test_updater.lua +++ b/src/test/test_updater.lua @@ -88,7 +88,7 @@ function test_sparkle_remove_directory() love.filesystem.createDirectory("test_folder") love.filesystem.write("test_folder/foo.txt", "Hello") assert_true(windows.removeRecursive("test_folder")) - assert_false(love.filesystem.exists("test_folder/foo.txt")) + assert_false(love.filesystem.getInfo("test_folder/foo.txt")) end function test_sparkle_windows_basename() diff --git a/src/tooltip.lua b/src/tooltip.lua index 4fdca5914..4f7eb46a2 100644 --- a/src/tooltip.lua +++ b/src/tooltip.lua @@ -6,16 +6,16 @@ local function drawSeparator(x, y, width) y = y + 2 --draw dividing line - love.graphics.setColor(112, 28, 114) + love.graphics.setColor(112/255, 28/255, 114/255) love.graphics.line(x, y, x + width, y) --draw yellow squares on the ends of the dividing line - love.graphics.setColor(219, 206, 98) + love.graphics.setColor(219/255, 206/255, 98/255) love.graphics.rectangle("fill", x, y - 1, 2, 2) love.graphics.rectangle("fill", x + width, y - 1, 2, 2) -- set color back to white - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end local Tooltip = {} @@ -92,7 +92,7 @@ function Tooltip:draw(x, y, selectedItem, parent) -- Lastly, insert our item information after everything else love.graphics.printf("\n" .. item.info, textX, textY + (descriptionWrap + statWrap) * lineHeight, textWidth, "left") - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end diff --git a/src/transition.lua b/src/transition.lua index b04965539..c56d8c815 100644 --- a/src/transition.lua +++ b/src/transition.lua @@ -48,9 +48,9 @@ function Transition:update(dt) end function Transition:draw(x, y, width, height) - love.graphics.setColor(0, 0, 0, self.alpha * 255) + love.graphics.setColor(0, 0, 0, self.alpha) love.graphics.rectangle('fill', x, y, width, height) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end return Transition diff --git a/src/tunnelparticles.lua b/src/tunnelparticles.lua index 81c8401b0..843e651c0 100644 --- a/src/tunnelparticles.lua +++ b/src/tunnelparticles.lua @@ -40,7 +40,7 @@ end function TunnelParticle:draw() love.graphics.setPointSize((self.startSpeed / 50) * (self.distance / maxDistance)) - --love.graphics.setPointStyle("rough") + love.graphics.setPointStyle("rough") love.graphics.points( (window.width / 2) + (math.cos(self.radius) * self.distance), (window.height / 2) + (math.sin(self.radius) * self.distance) @@ -66,7 +66,7 @@ function TunnelParticles.update(dt) end function TunnelParticles.draw() - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) for _, particle in ipairs(particles) do particle:draw() end diff --git a/src/update.lua b/src/update.lua index b389c519a..ebdddd8e5 100644 --- a/src/update.lua +++ b/src/update.lua @@ -46,19 +46,19 @@ end function screen:leave() self.logo = nil - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end function screen:keypressed(button) end function screen:draw() - love.graphics.setColor(255, 255, 255, math.min(255, self.time * 100)) + love.graphics.setColor(1, 1, 1, math.min(255, self.time * 100) / 255) love.graphics.draw(self.logo, window.width / 2 - self.logo:getWidth() / 2, window.height / 2 - self.logo:getHeight() / 2) if self.progress > 0 then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.rectangle("line", 40, window.height - 75, window.width - 80, 10) love.graphics.rectangle("fill", 40, window.height - 75, (window.width - 80) * self.progress / 100, 10) diff --git a/src/vendor/TEsound.lua b/src/vendor/TEsound.lua index c4260753f..d22b77063 100644 --- a/src/vendor/TEsound.lua +++ b/src/vendor/TEsound.lua @@ -79,7 +79,7 @@ end -- Cleans up finished sounds, freeing memory. Call frequently! function TEsound.cleanup() for k,v in ipairs(TEsound.channels) do - if v[1]:isStopped() then + if not v[1]:isPlaying() then if v[2] then v[2](v[3]) end -- allow sounds to use custom functions (primarily for looping, but be creative!) table.remove(TEsound.channels, k) end diff --git a/src/vendor/gamestate.lua b/src/vendor/gamestate.lua index 70ccb53fd..3828d561b 100644 --- a/src/vendor/gamestate.lua +++ b/src/vendor/gamestate.lua @@ -54,7 +54,7 @@ function GS.new() end function GS.get(name) - if love.filesystem.exists("maps/" .. name .. ".lua") then + if love.filesystem.getInfo("maps/" .. name .. ".lua") then return require("level").new(name) else return require(name) diff --git a/src/vendor/mixpanel.lua b/src/vendor/mixpanel.lua index 3c06154c0..9a67a20bd 100644 --- a/src/vendor/mixpanel.lua +++ b/src/vendor/mixpanel.lua @@ -15,7 +15,7 @@ math.randomseed(os.time()) -- Generate a 10-digit random ID function mixpanel.distinctId() - if not love.filesystem.exists('mixpanel.txt') then + if not love.filesystem.getInfo('mixpanel.txt') then love.filesystem.write('mixpanel.txt', mixpanel.randomId()) end diff --git a/src/vendor/mixpanel_thread.lua b/src/vendor/mixpanel_thread.lua index ef17f4f04..aea4cdc24 100644 --- a/src/vendor/mixpanel_thread.lua +++ b/src/vendor/mixpanel_thread.lua @@ -2,8 +2,7 @@ local http = require "socket.http" local ltn12 = require "ltn12" local baseurl = "http://api.projecthawkthorne.com" -local glove = require 'vendor/glove' -local channel = glove.thread.getChannel("mixpanel") +local channel = love.thread.getChannel("mixpanel") while true do local payload = channel:demand() diff --git a/src/vendor/tmx.lua b/src/vendor/tmx.lua index 9bd8f2e62..b238bfe33 100644 --- a/src/vendor/tmx.lua +++ b/src/vendor/tmx.lua @@ -93,7 +93,7 @@ function tmx.load(level) for _, tilelayer in ipairs(level.tilelayers) do - if tilelayer.tiles then + if tilelayer.name ~= "collision" and tilelayer.tiles then for i, tile in ipairs(tilelayer.tiles) do local x = (i - 1) % level.width local y = math.floor((i - 1)/ level.width) diff --git a/src/verticalparticles.lua b/src/verticalparticles.lua index 6c08cb96f..91255ba83 100644 --- a/src/verticalparticles.lua +++ b/src/verticalparticles.lua @@ -28,7 +28,7 @@ end function Particle:draw() love.graphics.setPointSize(self.size) - --love.graphics.setPointStyle("rough") + love.graphics.setPointStyle("rough") love.graphics.points(self.pos.x, self.pos.y) end @@ -53,7 +53,7 @@ function VerticalParticles.update(dt) end function VerticalParticles.draw() - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) for _,particle in ipairs(particles) do particle:draw() end diff --git a/src/welcome.lua b/src/welcome.lua index 4f453623b..4cf692e90 100644 --- a/src/welcome.lua +++ b/src/welcome.lua @@ -88,13 +88,13 @@ end function state:draw() --background colour - love.graphics.setColor( 0, 0, 0, 255 ) + love.graphics.setColor( 0, 0, 0, 1 ) love.graphics.rectangle( 'fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight() ) - love.graphics.setColor( 255, 255, 255, 255 ) + love.graphics.setColor( 1, 1, 1, 1 ) -- green terminal fonts.set('courier') - love.graphics.setColor( 48, 254, 31, 225 ) + love.graphics.setColor( 48/255, 254/255, 31/255, 1 ) if self.code_loaded == false then love.graphics.print(self.line_short, 50, 50, 0, 0.5, 0.5 ) for i = 1, 7 do @@ -107,7 +107,7 @@ function state:draw() end end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) fonts.set( 'big' ) -- menu diff --git a/templates/conf.lua b/templates/conf.lua index b2f33b421..e606e2c95 100644 --- a/templates/conf.lua +++ b/templates/conf.lua @@ -2,7 +2,7 @@ function love.conf(t) t.title = "Journey to the Center of Hawkthorne v{{ version }}" t.url = "http://projecthawkthorne.com" t.author = "https://github.com/hawkthorne?tab=members" - t.version = "0.10.0" + t.version = "11.3" t.identity = "hawkthorne_release" t.window.width = 1056 t.window.height = 672