Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
60ca022
Add pure lua bitops lib
ThatAff Apr 23, 2023
b572f6d
Include the bitops lib in all files that use it
ThatAff Apr 23, 2023
b0bd9b1
Replace QueueableSource lib with LÖVE2D's builtins
ThatAff Apr 23, 2023
60922c6
Replace pcall(load...) with loadstring(...)
ThatAff Apr 23, 2023
8166750
Make shaders WebGL-compatible
ThatAff Apr 23, 2023
f7845d9
Change bxor implementation
ThatAff Apr 23, 2023
b185e83
Change no-argument default behaviour
ThatAff Apr 23, 2023
00938b7
Remove debug.upvalueid from deepcopy.lua
ThatAff Apr 23, 2023
8f428b3
Add custom HTML and CSS
ThatAff Apr 23, 2023
a29898c
Outline build process for web
ThatAff Apr 23, 2023
fa16ed4
Fix floating point comparison error
ThatAff Apr 23, 2023
8f05f29
Return faster bitops to non-web platforms
ThatAff Apr 23, 2023
5c1828d
Return faster deepcopy to non-web platforms
ThatAff Apr 23, 2023
3c08b23
Make shaders a bit shorter
ThatAff Apr 23, 2023
af26b2d
Add general web TODO to README
ThatAff Apr 23, 2023
a45f33b
Add love.js-api-player to the project
ThatAff Apr 24, 2023
61a2e80
Update README.md
ThatAff Apr 24, 2023
c9d52ea
Add the ability to open TASes by drag and dropping
ThatAff Apr 25, 2023
270e71f
Update README.md
ThatAff Apr 25, 2023
82034ff
Update .luacheckrc
ThatAff Apr 25, 2023
cf90184
Update makefile
ThatAff Apr 26, 2023
cc4460c
Add "web" recipe to makefile
ThatAff Apr 26, 2023
b7a7161
Update README.md
ThatAff Apr 26, 2023
df776fe
Raise error properly in makefile
ThatAff Apr 26, 2023
bcce0f0
Add Lua LS config file to gitignore
ThatAff Apr 23, 2023
915a182
Deduplicate code + init file properly
ThatAff Apr 29, 2023
c3af9e8
Add saving
ThatAff Apr 29, 2023
b8fa7f5
Remove console.log
ThatAff Apr 29, 2023
718e972
Add cctas custom cart loading
ThatAff Apr 29, 2023
b9505d8
Implement non-cctas custom carts
ThatAff Apr 29, 2023
3ba87d2
Contain temporary files in their own directory
ThatAff Apr 29, 2023
57fc23c
Add deploy to pages action
ThatAff Apr 29, 2023
618d6bc
Reduce code duplication
ThatAff Apr 30, 2023
c6f1644
Add my keybind lib to the project
ThatAff May 3, 2023
d5f0c98
Change to the new controls system
ThatAff May 3, 2023
2ec5e91
Part two of the controls system change
ThatAff May 3, 2023
dc44b9d
Third part of controls system change
ThatAff May 3, 2023
ef7ee29
Last part of controls system change
ThatAff May 3, 2023
29a2c91
Update submodule
ThatAff May 3, 2023
1efba57
Add config file reading/writing
ThatAff May 3, 2023
127cd3d
Update submodule again
ThatAff May 3, 2023
25e38ee
Add support for setting btn(6) and btn(7)
ThatAff May 3, 2023
04cf483
Rename last_[frame,level,object] to prev_[frame,level,object]
ThatAff May 3, 2023
cf34e0e
Make main.lua read default keyconfig from file
ThatAff May 3, 2023
825c6c0
Merge branch 'controls' into web
ThatAff May 3, 2023
aee381c
Add web-friendly control scheme
ThatAff May 3, 2023
767d57a
Allow .conf as an acceptable format in makefile
ThatAff May 3, 2023
62491b1
Make web-friendly control scheme actually web friendly
ThatAff May 3, 2023
3ced5da
Fix double input bug
ThatAff May 3, 2023
3e3658b
Fix oversight with next_frame and shift
ThatAff May 3, 2023
94601a4
Implement clipboard on web
ThatAff May 3, 2023
bb46e18
Add some helpful text
ThatAff May 3, 2023
ef8d5d1
Move keybinds.init to love.load()
ThatAff May 4, 2023
c785b2e
Fix inverted next_frame and prev_frame in visual mode
ThatAff May 4, 2023
a26d8c6
Fix select all in visual mode
ThatAff May 4, 2023
49a7528
Update README.md
ThatAff May 4, 2023
1137dc8
Switch to pico8.keymap instead of constants
ThatAff May 4, 2023
0ae811a
Switch tas:advance_keystate to use keybindings.lua
ThatAff May 4, 2023
c14678c
Update submodules
ThatAff May 8, 2023
8a50070
Update submodules once again
ThatAff May 8, 2023
3c31048
Automate deployment
ThatAff May 8, 2023
e3e1e5f
Add a "Back to Homepage" link
ThatAff May 8, 2023
5c5e605
Add clarifying text
ThatAff May 8, 2023
d279c4e
Quantify love.js dependency
ThatAff Jun 23, 2023
793eff0
Fix issue with carts/ never getting created
ThatAff Jun 23, 2023
5ef47c1
Merge branch 'master' of gonengazit/Celia
ThatAff Sep 16, 2023
427d8fa
Remove insane default keys for web
ThatAff Sep 16, 2023
ac99535
Merge branch 'master' of https://github.com/gonengazit/Celia
ThatAff Sep 25, 2023
b17d6e0
Print warning about deepcopy on web
ThatAff Oct 16, 2023
1d71712
Fix numberlua; Remove hack from cart.lua
ThatAff Oct 16, 2023
77ac9da
Try looking for love.js in node_modules
ThatAff Oct 16, 2023
dd6adc7
Add warning to webpage
ThatAff Apr 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Simple workflow for deploying static content to GitHub Pages
name: Build and deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install love.js
run: npm install -g love.js
- name: Run make recipe
run: make web
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'build/__site/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
!editor.p8
!test/*.p8
.DS_Store
build/*.love
build/*
luacov.report.out
luacov.stats.out
.luarc.json
node_modules/*
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "Love.js-Api-Player"]
path = Love.js-Api-Player
url = https://github.com/MrcSnm/Love.js-Api-Player
[submodule "keybindings.lua"]
path = keybindings.lua
url = https://github.com/ZatFinn/keybindings.lua
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ globals = {
"love.handlers",
"love.graphics.newScreenshot",
"love.graphics.isActive",
"ke",

-- functions
"warning",
Expand All @@ -34,6 +35,8 @@ ignore = {
}

exclude_files = {
"Love.js-Api-Player",
"keybindings.lua",
"lib",
"spec",
".DS_Store",
Expand Down
1 change: 1 addition & 0 deletions Love.js-Api-Player
Submodule Love.js-Api-Player added at fbdf10
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ In the center of the screen, you'll see the PICO-8 screen, displaying the curren
On the left, you'll see the HUD, displaying the current frame number, and an input display, with the currently pressed inputs
On the right, you'll see the pianoroll, which shows the inputs in the frames around the current one

### Web build

Some changes were made to make this project more compatible with
web/emscripten/wasm. Right now it is a work-in-progress. For building,
[Davidobot's fork of love.js](https://github.com/Davidobot/love.js) is used, so
make sure to have the npm package for it installed.

```shell
$ npm -g install love.js
$ git clone --recursive https://github.com/gonengazit/Celia && cd Celia
$ make web
$ python -m http.server -b 127.0.0.1 -d build/__site/ # example way to host
```

Building on Windows should be possible as well, since the js tools are
cross-platform. However without going to the lengths of installing cygwin or
git bash with info-zip, the [makefile](makefile) recipe won't run, and you'll
have to do the copying and zipping manually.

## Controls
* __L__ - advance 1 frame forward
* __K__ - rewind 1 frame back
Expand Down Expand Up @@ -91,9 +110,7 @@ Warning: making changes to variables in the PICO-8 instance, then rewinding befo
* [Original Celeste TAS tool by akliant917](https://github.com/CelesteClassic/ClassicTAS)
* [Lua parser taken and modified from LuaMinify](https://github.com/stravant/LuaMinify)







## Web specific
* [LuaJIT-like bitops implementation in pure lua by DavidM](https://github.com/davidm/lua-bit-numberlua)
* [Davidobot's fork of love.js](https://github.com/Davidobot/love.js)
* [globalizeFS.js from love.js-api-player by MrcSnm (included as a submodule)](https://github.com/MrcSnm/Love.js-Api-Player)
16 changes: 8 additions & 8 deletions api.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local bit = require("numberlua").bit

local api = {}

local flr = math.floor
Expand Down Expand Up @@ -75,15 +77,15 @@ end
function api._call(code)
code = patch_lua(code)

local ok, f, e = pcall(load, code, "repl")
if not ok or f == nil then
local f, e = loadstring(code, "repl")
if f == nil then
api.rectfill(0, api._getcursory(), 128, api._getcursory() + 5 + 6, 0)
api.print("syntax error", 14)
api.print(api.sub(e, 20), 6)
return false
else
setfenv(f, pico8.cart)
ok, e = pcall(f)
local ok, e = pcall(f)
if not ok then
api.rectfill(0, api._getcursory(), 128, api._getcursory() + 5 + 6, 0)
api.print("runtime error", 14)
Expand Down Expand Up @@ -1451,8 +1453,6 @@ function api.atan2(x, y)
return (0.75 + math.atan2(x, y) / (math.pi * 2)) % 1.0
end

local bit = require("bit")

function api.band(x, y)
return bit.band(x*0x10000, y*0x10000)/0x10000
end
Expand Down Expand Up @@ -1525,8 +1525,8 @@ function api.run()
pico8.cartdata[i] = 0
end

local ok, f, e = pcall(load, loaded_code, cartname)
if not ok or f == nil then
local f, e = loadstring(loaded_code, cartname)
if f == nil then
log("=======8<========")
log(loaded_code)
log("=======>8========")
Expand All @@ -1537,7 +1537,7 @@ function api.run()
love.graphics.setCanvas(pico8.screen)
love.graphics.origin()
restore_clip()
ok, e = pcall(f)
local ok, e = pcall(f)
if not ok then
error("Error running lua: " .. tostring(e))
else
Expand Down
1 change: 1 addition & 0 deletions cart.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local bit = require("numberlua").bit
local api = require("api")

local parse = require("parser/ParseLua")
Expand Down
65 changes: 32 additions & 33 deletions cctas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ local api = require("api")

local console = require("console")


--TODO: probably call load_level directly
--or at least make sure rng seeds are set etc
function cctas:init()
Expand Down Expand Up @@ -50,6 +49,7 @@ function cctas:init()
self.full_game_playback = false

self:state_changed()
self:update_working_file()
end

function cctas:perform_inject()
Expand Down Expand Up @@ -118,14 +118,14 @@ function cctas:keypressed(key, isrepeat)
self:loading_jank_keypress(key,isrepeat)
elseif self.modify_rng_seeds then
self:rng_seed_keypress(key,isrepeat)
elseif key=='a' and not isrepeat then
elseif ke.jank_offset and not isrepeat then
-- TODO: telegraph this better?
if not self.cart_settings.disable_loading_jank then
self:full_rewind()
self:push_undo_state()
self.modify_loading_jank = true
end
elseif key=='b' and not isrepeat then
elseif ke.rng_seeding and not isrepeat then
self.rng_seed_idx = -1
-- don't enable rng mode if no seedable objects exist
if self:advance_seeded_obj(1) then
Expand All @@ -134,49 +134,46 @@ function cctas:keypressed(key, isrepeat)
self:push_undo_state()
self.modify_rng_seeds = true
end
elseif key=='f' then
elseif ke.next_level then
self:push_undo_state()
self:next_level()
elseif key=='s' then
elseif ke.prev_level then
self:push_undo_state()
self:prev_level()
elseif key=='d' and love.keyboard.isDown('lshift', 'rshift') then
elseif ke.rewind then
self:player_rewind()
elseif key=='g' and love.keyboard.isDown('lshift', 'rshift') then
elseif ke.level_gif then
self:start_gif_recording()
elseif key == 'n' and love.keyboard.isDown('lshift', 'rshift') then
elseif ke.full_playback then
self:push_undo_state()
self:begin_full_game_playback()
elseif key == 'u' then
elseif ke.clean_save then
self:push_undo_state()
self:begin_cleanup_save()
elseif key == '=' then
if love.keyboard.isDown('lshift', 'rshift') then
-- +
if self.max_djump_overload ==-1 then
self.max_djump_overload = pico8.cart.max_djump + 1
else
self.max_djump_overload = self.max_djump_overload + 1
end
self:load_level(self:level_index(), false)
elseif ke.inc_djump then
if self.max_djump_overload ==-1 then
self.max_djump_overload = pico8.cart.max_djump + 1
else
self.max_djump_overload = -1
self:load_level(self:level_index(), false)
self.max_djump_overload = self.max_djump_overload + 1
end
elseif key == '-' then
self:load_level(self:level_index(), false)
elseif ke.reset_djump then
self.max_djump_overload = -1
self:load_level(self:level_index(), false)
elseif ke.dec_djump then
if self.max_djump_overload ==-1 then
self.max_djump_overload = pico8.cart.max_djump - 1
else
self.max_djump_overload = self.max_djump_overload - 1
end
self.max_djump_overload = math.max(self.max_djump_overload, 0)
self:load_level(self:level_index(), false)
elseif key=='y' then
elseif ke.print_pos then
local p = self:find_player()
if p then
print(p)
end
elseif key=='c' and love.keyboard.isDown('lctrl','rctrl','lgui','rgui') then
elseif ke.copy then
--copy player position to clipboard
local p = self:find_player()
if p then
Expand All @@ -188,11 +185,11 @@ function cctas:keypressed(key, isrepeat)
end

function cctas:loading_jank_keypress(key,isrepeat)
if key=='up' then
if ke.inc_jank then
self.loading_jank_offset = math.min(self.loading_jank_offset +1, math.max(#pico8.cart.objects-self.prev_obj_count + 1,0))
elseif key == 'down' then
elseif ke.dec_jank then
self.loading_jank_offset = math.max(self.loading_jank_offset - 1, math.min(-self.prev_obj_count+1,0))
elseif key == 'a' and not isrepeat then
elseif ke.quit_jank and not isrepeat then
self.modify_loading_jank = false
self:load_level(self:level_index(),false)
end
Expand All @@ -201,11 +198,11 @@ end

function cctas:rng_seed_keypress(key,isrepeat)
-- TODO: make seed visually update in the current frame, and make rewinding not visually broken
if key=='up' or key == 'down' then
if ke.inc_rng or ke.dec_rng then
local obj = pico8.cart.objects[self.rng_seed_idx]
local seed = self:get_seed_handler(obj)
if seed ~= nil then
if key=='up' then
if ke.inc_rng then
seed.increase_seed(obj)
else
seed.decrease_seed(obj)
Expand All @@ -220,11 +217,11 @@ function cctas:rng_seed_keypress(key,isrepeat)
-- self:rewind()
-- self:step()
end
elseif key == 'right' then
elseif ke.next_object then
self:advance_seeded_obj(1)
elseif key == 'left' then
elseif ke.prev_object then
self:advance_seeded_obj(-1)
elseif key == 'b' and not isrepeat then
elseif ke.quit_rng and not isrepeat then
self.modify_rng_seeds = false
end
end
Expand Down Expand Up @@ -336,7 +333,7 @@ function cctas:load_level(idx, reset_changes)
-- for the first level, assume no objects get loading janked by default
-- also do not apply loading jank if it is disable
self.loading_jank_offset =
(self.cart_settings.disable_loading_jank or self:level_index() == self.first_level) and #pico8.cart.objects + 1 or 0
(self.cart_settings.disable_loading_jank or self:level_index() == self.first_level) and #pico8.cart.objects + 1 or 0
end

for i = self.prev_obj_count+ self.loading_jank_offset, #pico8.cart.objects do
Expand Down Expand Up @@ -374,9 +371,11 @@ function cctas:level_index()
end
function cctas:next_level()
self:load_level(self:level_index()+1,true)
self:update_working_file()
end
function cctas:prev_level()
self:load_level(self:level_index()-1,true)
self:update_working_file()
end

function cctas:find_player()
Expand Down Expand Up @@ -464,7 +463,7 @@ function cctas:player_rewind()
else
self.seek = {
finish_condition = function()
return self.inputs_active
return self.inputs_active
end,
on_finish = function() end,
fast_forward=true
Expand Down
2 changes: 1 addition & 1 deletion conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function love.conf(t)
t.version = "11.3"

t.window.title = "Celia"
t.window.icon = "icon.png"
t.window.icon = "res/theme/icon.png"
t.window.width = 1344
t.window.height = 768
t.window.resizable = true
Expand Down
Loading