Fish fillets remake https://glitchapp.codeberg.page/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
fish-fillets-remake/main.lua

561 lines
16 KiB

--[[
Copyright (C) 2022 Glitchapp
This program is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The license text can be found in GPL-2.0.txt.
--]]
require ("game/mainfunctions/globalvariables")
require ("lib/tesound")
--timer = require ("lib/hump.timer")
require("assets/loadassets")
require("assets/loadexternalassets")
loadavatars()
require("game/animatefauna")
--livecode = require ("livecode")
--local http = require "socket.http"
--moonvox = require ('lib/moonvox/main')
require("game/interface/loading")
loadingvariables() -- load loading icon and variables
require("game/levels/loadlevelvariables")
loadlevelvariables() -- load level specific variables
levelmenu = require ('game/levelmenu') -- load level selection menu
require ('game/levelcompleted') -- Menu and info on level completed
loadlevelcompleted()
require ('game/mainfunctions/savegame') -- Save mechanism
savegameload()
optionsmenu = require ('game/optionsmenu') -- Load options menu
extrasmenu = require ('game/extras') -- Load extras menu
leditormenu = require ('game/leditor') -- Load level editor
creditsmenu = require ('game/credits') -- Load credits menu
musicplayer = require ('game/musicplayer') -- Load music player
creditsload()
musicload()
optionsload()
extrasload()
leditorload()
--urutora:load()
function loadmultiresolution()
multiresactivated=true
mr = require ('lib/multiresolution/multiresolution') -- multiresolution library by darkfrei
local desktopWidth, desktopHeight = love.window.getDesktopDimensions()
-- love.window.setMode (desktopWidth/2, desktopHeight/2, {resizable=true, borderless=false})
love.window.setMode (3/4*desktopWidth, 3/4*desktopHeight, {resizable=true, borderless=false})
mr:load ()
changeresolution()
--resizeres (1920,1080)
end
function love.load()
require("assets/text/terminalinstructionstext")
Terminal = require ("lib/lv100/terminal")
require ("lib/lv100/main")
loadinstructions()
require ("shadows/myshadows")
myshadowsload()
require ("lib/lovebpm/main")
mybpm=112
--lovebpmload("lib/lovebpm/loop.ogg")
if skin=="remake" then lovebpmload("/externalassets/music/cleytonKauffman/CleytonRX-Underwater.ogg")
elseif skin=="classic" then lovebpmload("/externalassets/music/classic/menu.ogg")
end
require("/game/mainfunctions/achievements")
love.window.setMode(1920, 880, {resizable=true, borderless=false})
--rs.setGame(1920, 1080)
--require ('/game/mainfunctions/createcanvas') -- Canvas
require ('/game/mainfunctions/changeresolution') -- Resolution change
require ('/game/mainfunctions/keyinput') -- key input
require ('/game/mainfunctions/gamepadinput') -- gamepad input
require ('/lib/ShakeDetector/myshakedetector') -- shake detector
shakeload()
local level = require ('game/levels/level-1') -- load first level
levelload()
if android==false then
require ("game/levels/3dlevel") --3DreamEngine graphics
end
pb = require ('game/logic/push-blocks') -- load game logic
require ('game/logic/events') -- load events
require ('game/logic/drawassets') -- draw the assets with the game logic
require ('game/logic/drawassets30') -- draw the assets after level 30 with the game logic
require "game/interface/touchinterface1" --require touch interface
loadtouchtext()
require "game/interface/showhelp" --require help
touchinterfaceison=false
require("game/levels/changelevel")
require("game/levels/loadlevelmusic")
require("game/levels/loadlevelmusicclassic")
require("game/levels/loadlevelsounds")
require("game/levels/assignfrgbck")
require("game/levels/assignfrgbckclassic")
require("game/levels/loadlevelassets")
require("game/levels/loadlevelassetsclassic")
require("game/levels/loadsubtitles")
require("game/levels/loadvoices")
require("game/levels/loadvoices20")
require("game/levels/loadvoices40")
require("game/levels/loadvoices60")
require("game/levels/loadleveltitle")
Talkies = require ("lib/talkies/talkies") --Load dialogs library
Obey = require("lib/talkies/example/other") --Functions that render the dialogs
require("game/dialogs/subtitlessync1")
stepdone=0
require ('game/gameover') -- game over function
loadgameover()
require("game/dialogs/borescript") --bore dialogs
loadborescript()
love.window.setVSync(false)
--shaders = require "shaders" -- Shadertoy shaders
--selectshadertoy("shader/underwater.glsl")
-- moonshine shaders
moonshine = require 'assets/shaders/moonshine'
--moonshine shaders parameters
--chain moonshine effects
effect = moonshine(1920,1080,moonshine.effects.filmgrain)
.chain(moonshine.effects.colorgradesimple)
.chain(moonshine.effects.vignette)
.chain(moonshine.effects.scanlines)
.chain(moonshine.effects.crt)
.chain(moonshine.effects.dmg)
.chain(moonshine.effects.godsray)
.chain(moonshine.effects.desaturate)
.chain(moonshine.effects.pixelate)
.chain(moonshine.effects.posterize)
.chain(moonshine.effects.boxblur)
.chain(moonshine.effects.fastgaussianblur)
.chain(moonshine.effects.chromasep)
.chain(moonshine.effects.glow)
--
effect.disable("colorgradespimple","vignette","scanlines","crt","dmg","godsray","desaturate","pixelate","posterize","boxblur","fastgaussianblur","chromasep")
effect.enable("scanlines","crt","glow","filmgrain")
effect.scanlines.opacity=0.1
effect.glow.min_luma = 1
effect.filmgrain.size=0.5
effect.filmgrain.opacity=1
--moonshine shaders parameters 2
--effect.enable("pixelate","dmg")
--waterwarp shader
waterwarp = require 'shaders/waterwarp' --warp effect intensity 10
waterwarp2 = require 'shaders/waterwarp2' --warp effect intensity 15
waterwarp3 = require 'shaders/waterwarp3' --warp effect #vec2(2, 2) // / 12;
waterwarp4 = require 'shaders/waterwarp4' --warp effect vec2(1, 20) // / 12;
require ("assets/text/help")
local ddwidth, ddheight = love.window.getDesktopDimensions( display )
width, height = love.graphics.getDimensions( )
screenoptions=false
--debug game states
--gamestatus="assets" -- There are possible values: levelselection, options,credits,assets and game
gamestatus="levelselection"
nLevel = 1
pb:load (level) -- load level from the game logic
require ("game/levels/drawborders") -- Wall borders and other contour highlight
loadwallborder() --load borders for the canvas
--loadLevel() --load level for the canvas
--createcanvas()
love.mouse.setVisible(true) -- make default mouse invisible
end
function love.update(dt)
--rs.update() --update resolution solution
if multiresactivated then mr.update(dt) end
--timer.update(dt) --update timer
if gamestatus=="credits" then creditsupdate(dt) --update credits
shader2=false
elseif gamestatus=="music" then musicupdate(dt) --update music
if cdplaying==true then equalizerupdate(dt) end
--equalizerupdate(dt)
--elseif gamestatus=="options" then
--shader2=false
elseif gamestatus=="extras" then extrasupdate(dt) --update extras
if advertising1playing==true then
--timer = timer + dt
Talkies.update(dt)
subtitle21advertising1()
elseif advertising2playing==true then
--timer = timer + dt
Talkies.update(dt)
subtitle21advertising2()
end
--elseif gamestatus=="leditor" then leditorupdate(dt) --update level editor
elseif gamestatus=="game" then --update game
lovebpmupdate(dt)
if isloading==true then loadingupdate(dt) fadeloadingprocess(dt) end -- rotate loading icon if loading
if loadingprocess==true then triggerloadingprocess(dt) end
--shader2=true
--shakeupdate(dt)
if talkies==true then --update dialogs
Talkies.update(dt)
end
if dt > 0.05 then dt = 0.05 end
--update resource loader
if threeD==true and android==false then --Update 3d graphics from 3DreamEngine
dream:update()
end
if tetris==true then blocksupdate(dt) end -- update tetris
elseif gamestatus=="levelcompleted" then lovebpmupdate(dt) timer = timer + dt
--[[elseif gamestatus=="gameover" then
timer=timer +dt
timer2=timer2 +dt
if screenshake==true then
if timer2>0.5 then screenshake=false end
end
if fish2status=="dead" and aleatorygameoversentence==6 then subtitlegameoverdarn()
elseif fish1status=="dead" and aleatorygameoversentence==2 and accent=="us" then subtitlesgameoverparrot()
end
--]]
elseif gamestatus=="assets" then
shader2=false
term:update(dt)
elseif gamestatus=="instructions" then
instructionsupdate(dt)
elseif gamestatus=="intro" then
introupdate(dt)
elseif gamestatus=="record" then
recordupdate(dt)
elseif gamestatus=="briefcasemssage" then
briefcaseupdate(dt)
elseif gamestatus=="endmenu" then
timer = timer + dt -- timer update
endmenuupdate(dt)
elseif gamestatus=="fishhouseend" then
timer = timer + dt -- timer update
fishhouseendupdate(dt)
--subtitle8end()
elseif gamestatus=="shipwrecksend" then
timer = timer + dt -- timer update
shipwrecksendupdate(dt)
subtitle19end()
elseif gamestatus=="silversshipend" then
timer = timer + dt -- timer update
silversshipendupdate(dt)
subtitle51end()
elseif gamestatus=="cityinthedeepend" then
timer = timer + dt -- timer update
cityinthedeependupdate(dt)
subtitle29end()
elseif gamestatus=="ufoend" then
if playerplaying==true then
timer = timer + dt -- timer update
ufoendupdate(dt)
subtitle58end()
lovebpmupdate(dt)
end
elseif gamestatus=="coralreefend" then
timer = timer + dt -- timer update
coralreefendupdate(dt)
subtitle37end()
elseif gamestatus=="treasurecaveend" then
timer = timer + dt -- timer update
subtitle64end()
elseif gamestatus=="barrelend" then
timer = timer + dt -- timer update
barrelendupdate(dt)
subtitle44end()
elseif gamestatus=="secretcomputerend" then
timer = timer + dt -- timer update
subtitle70end()
elseif gamestatus=="linuxend" then
timer = timer + dt -- timer update
subtitle77end()
elseif gamestatus=="gameend" then
timer = timer + dt -- timer update
subtitle79end()
end
if gamestatus=="levelselection" or gamestatus=="levelselection2" then
timer2 = timer2 + dt
myshadowsupdate()
lovebpmupdate(dt)
if isloading==true then loadingupdate(dt) end -- rotate loading icon if loading
if loadingprocess==true then triggerloadingprocess(dt) end
end
end
--function testprint(dt)
--print("x")
--end
function resizeres (w, h)
mr.resize () -- update new translation and scale
end
function love.draw(dt)
if multiresactivated then mr.draw() end
--print(lahvacstate)
--print(zframe)
--print(linuxakframe)
--print(nLevel)
--print(timer)
--print(fish1status)
--print(gamestatus)
if gamestatus=="game" then
-- music:on("beat", function(n) print("beat:", n) end)
-- 3d background
lovebpmdraw()
--shakedraw()
if threeD==true and android==false then
threeDdraw() --Draw 3d graphics if enabled
end
if shader1==true and shader2==false then -- Draw first shader if enabled (Moonshine)
love.graphics.setShader()
effect(function()
if skin=="remake" or skin=="retro" then drawallcontent() drawforshader2()
elseif skin=="classic" then drawallcontentclassic() drawforshader2classic()
end
--push:start()
--love.graphics.setColor(0.146, 0.73, 0.73)
if palette==1 then love.graphics.setColor(cs1bck)
elseif palette==2 then love.graphics.setColor(cs2bck)
elseif palette==3 then love.graphics.setColor(cs3bck)
elseif palette==4 then love.graphics.setColor(cs4bck)
elseif palette==5 then love.graphics.setColor(cs5bck)
elseif palette==6 then love.graphics.setColor(cs6bck)
elseif palette==7 then love.graphics.setColor(cs7bck)
end
if talkies==true then
Talkies.draw() end
end)
end
if shader1==true and shader2==true then -- Draw two shaders if enabled
effect(function()
if skin=="remake" or skin=="retro" then drawallcontent() love.graphics.setShader(shader) drawforshader2()
elseif skin=="classic" then drawallcontentclassic() love.graphics.setShader(shader) drawforshader2classic()
end
if talkies==true and shader1==false then --Draw Dialogs if enabled
Talkies.draw()
end
love.graphics.setShader()
end)
end
if shader1==false and shader2==true then --Draw second shader if enabled (shadertoy)
if skin=="remake" or skin=="retro" then drawallcontent() love.graphics.setShader(shader) drawforshader2()
elseif skin=="classic" then drawallcontentclassic() love.graphics.setShader(shader) drawforshader2classic()
end
love.graphics.setShader()
end
if shader1==false and shader2==false then -- If both shaders are disabled
if skin=="remake" or skin=="retro" then drawforshader2()
elseif skin=="classic" then drawforshader2classic()
end
if diorama==false then
if palette==7 then
love.graphics.setColor(0,0,0)
else
end
end
if skin=="remake" or skin=="retro" then drawallcontent()
elseif skin=="classic" then drawallcontentclassic()
end
end
if talkies==true and shader1==false then --Draw Dialogs if enabled
Talkies.draw()
end
drawtouchinterface()
elseif gamestatus=="levelselection" then -- Level selection menu
shader2=false
myshadowsdraw(dt)
lovebpmdraw()
leveldraw()
if isloading==true then loadingdraw(dt) end --draw loading icon if loading
elseif gamestatus=="levelselection2" then -- Level selection menu 2
shader2=false
myshadowsdraw(dt)
lovebpmdraw()
leveldraw2()
elseif gamestatus=="levelcompleted" then -- Level completed
drawlevelcompleted()
elseif gamestatus=="gameover" then -- game over
drawgameover()
elseif gamestatus=="music" then musicdraw(dt) -- Music menu
if cdplaying==true then equalizerdraw(dt) end
elseif gamestatus=="extras" then extrasdraw(dt)
if advertising1playing==true then Talkies.draw(dt)
elseif advertising2playing==true then Talkies.draw(dt)
end -- Extras menu
if introvideoplaying==true then
love.graphics.draw(introvideo, 0, 0)
if hideplayercontrols==false then
love.graphics.print(extrasReturnButton.text,extrasReturnButton.x,extrasReturnButton.y,extrasReturnButton.r,extrasReturnButton.sx)
end
drawintrosceneplayer() --draw the media player interface
end
if cdplaying==true then equalizerdraw(dt) end
elseif gamestatus=="leditor" then leditordraw(dt) -- Level editor
elseif gamestatus=="options" then optionsdraw(dt) -- Options menu
elseif gamestatus=="credits" then creditsdraw(dt) -- Credits menu
elseif gamestatus=="assets" then assetsmenudraw() -- Assets menu
elseif gamestatus=="instructions" then instructionsdraw() -- Instructions
--elseif gamestatus=="intro" then introdraw(dt)
elseif gamestatus=="record" then recorddraw()
elseif gamestatus=="briefcasemessage" then
briefcasedraw(dt)
Talkies.draw()
elseif gamestatus=="endmenu" then endmenudraw(dt)
elseif gamestatus=="fishhouseend" then fishhouseenddraw(dt)
elseif gamestatus=="shipwrecksend" then shipwrecksenddraw(dt)
elseif gamestatus=="silversshipend" then silversshipenddraw(dt)
elseif gamestatus=="cityinthedeepend" then cityinthedeependdraw(dt)
elseif gamestatus=="ufoend" then
if moonshineeffect==1 or moonshineeffect==3 or moonshineeffect==4 then -- if moonshine shaders are on apply them to the scene player
love.graphics.setShader()
effect(function()
ufoenddraw(dt)
end)
drawscenetext()
elseif moonshineeffect==2 then
love.graphics.setShader()
effect(function()
ufoenddraw(dt)
drawscenetext()
end)
elseif moonshineeffect==0 then ufoenddraw(dt) drawscenetext()
end
elseif gamestatus=="coralreefend" then coralreefenddraw(dt)
elseif gamestatus=="treasurecaveend" then treasurecaveenddraw(dt)
elseif gamestatus=="barrelend" then barrelenddraw(dt)
elseif gamestatus=="secretcomputerend" then secretcomputerenddraw(dt)
elseif gamestatus=="linuxend" then linuxenddraw(dt)
elseif gamestatus=="gameend" then gameenddraw(dt)
--elseif gamestatus=="tetris" then
--blocksdraw(dt)
end
if isloading==true then loadingdraw(dt) end --draw loading icon if loading
--rs.stop()
end