Compare commits

..

3 Commits

Author SHA1 Message Date
2085ba5a63 Complete the rood 2024-02-11 21:53:19 -08:00
4747e297b4 Add sounds 2024-02-11 20:54:01 -08:00
bb2cfdd6af Add QOL features 2024-02-11 20:40:30 -08:00
14 changed files with 176 additions and 23 deletions

View File

@ -93,8 +93,10 @@ function board:get_completion_level()
end end
function board:undo() function board:undo()
if (not self.watcher:intercept("undo")) return if (not self.checkpoint) return
if (self.checkpoint) self.checkpoint:apply(self) if (not self.watcher:intercept("undo")) sounds:dire() return
sounds:menu()
self.checkpoint:apply(self)
self.checkpoint=nil self.checkpoint=nil
end end

View File

@ -55,7 +55,7 @@ function board:_animate_move_card(card,on_end,start_x,start_y,compute_end)
if (frame==0) end_x,end_y=compute_end() if (frame==0) end_x,end_y=compute_end()
frame+=1 frame+=1
progress=frame/7 progress=frame/7
if (progress>=1.0) on_end() return false if (progress>=1.0) sounds:deal_card() on_end() return false
return true return true
end end
function anim_obj:draw() function anim_obj:draw()

View File

@ -36,18 +36,21 @@ function cursor:toggle_grab()
local acc,src,tar=self:acceptance_state() local acc,src,tar=self:acceptance_state()
local slot=self:hover_slot() local slot=self:hover_slot()
if acc==acceptance_state.not_grabbed then if acc==acceptance_state.not_grabbed then
if (not self.board.watcher:intercept("grab",slot)) return if (not self.board.watcher:intercept("grab",slot)) sounds:dire() return
if (self.board.slots[slot]:peek()) self.grabbed=slot if (self.board.slots[slot]:peek()) self.grabbed=slot
sounds:menu()
elseif acc==acceptance_state.would_accept then elseif acc==acceptance_state.would_accept then
if (not self.board.watcher:intercept("drop",slot)) return if (not self.board.watcher:intercept("drop",slot)) sounds:dire() return
self.board:pre_move(src:peek()) self.board:pre_move(src:peek())
local card=src:pop() local card=src:pop()
tar:add(card) tar:add(card)
self.grabbed=nil self.grabbed=nil
self.board:on_move(card) self.board:on_move(card)
sounds:menu()
elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then
if (not self.board.watcher:intercept("cancel")) return if (not self.board.watcher:intercept("cancel")) sounds:dire() return
self.grabbed=nil self.grabbed=nil
sounds:menu()
else else
assert(false,"invalid acceptance state") assert(false,"invalid acceptance state")
end end

View File

@ -1,10 +1,16 @@
liturgy={ liturgy={
holy_book=gsv[[rood 1`1,2 holy_book=gsv[[rood 1`1,2
rood 2`3,4,5,6 rood 2`3,4,5,6
rood 3`7,8,9,10]], rood 3`7,8,9
rood 4`10,11,12
rood 5`13,14,15,16
rood 6`17,18,19
rood 7`20,21,22
rood 8`23,24,25
rood 9`26]],
sacred_text_lines=gsv sacred_text_lines=gsv
[[1`come into this thicket. [[1`come into this thicket.
1`i, o man, have a bright wreath. 1`i have a bright wreath.
1`my laurel is vibrant. 1`my laurel is vibrant.
2`the hollow of a stone. 2`the hollow of a stone.
2`this, too, opens to the key. 2`this, too, opens to the key.
@ -35,8 +41,69 @@ rood 3`7,8,9,10]],
9`catching a leaf, ride it. 9`catching a leaf, ride it.
9`suture its veins. 9`suture its veins.
9`scatter glass in the vineyard. 9`scatter glass in the vineyard.
10`one day, the seas will boil. 10`lanias came in silver.
10`no one will be born again.]] 10`silver pants. silver armor.
10`he broke a seed with his beak.
11`he milled the wheat and barley.
11`he took oranges from the trees.
11`apes scattered in the ferns.
11`he raised his bow and screamed.
12`the bolt became the wind.
12`the silver sails lashed.
12`the silver ospreys swarmed.
12`the silver shadow wailed.
13`burning oil from bay to sky.
13`scampering keas!
13`no one left. quiet.
13`lanias came and went in silver.
14`where were you? a small bird.
14`divine. you were in the fences.
14`you were seedling, little one.
14`the gorgeous lily blooms.
15`ravens are an old people.
15`but the mandate is new.
15`the spry one turns in the egg.
16`it doesn't hatch.
16`for a house in heaven, one
16`buys it on earth.
16`where does it go?
17`do not hate beauty.
17`what ages, molts.
17`do not envy sores and rashes.
18`do not despise vanity.
18`who is this written for?
18`the vain will not have it
19`you are a blossom in a blossom.
19`nobody will rip out your eyes.
19`you are waiting in the leaves.
20`you have your room.
20`i have mine.
20`let's dig a river,
20`and build a bridge.
21`let's burn herbs and
21`feed your grandparents
21`there's your soul!
21`where? inside your body.
22`let's dig a trap.
22`let's line it with spikes.
22`let's cover it with a sheet,
22`and bury it in soil.
23`is this what you want?
23`let me tell you.
23`you won't like how
23`this ends.
24`old men suffer and die
24`for nothing. listen:
24`when you grow up: you won't
24`understand it.
25`night is here.
25`you're asleep.
25`you leave this body.
25`you won't want to come back.
26`this rood is not for apes.
26`those we killed have been
26`planted how it says. like this
26`city, it will not be destroyed.]]
} }
function liturgy:init() function liturgy:init()
@ -56,7 +123,7 @@ function liturgy:init()
local lines=verse_lines[verse] local lines=verse_lines[verse]
annotated_verse_name..=":"..ix.."-" annotated_verse_name..=":"..ix.."-"
ix+=#lines ix+=#lines
annotated_verse_name..=ix annotated_verse_name..=ix-1
local annotated_verse="" local annotated_verse=""
for l in all(lines) do for l in all(lines) do
if (annotated_verse!="") annotated_verse..="\n" if (annotated_verse!="") annotated_verse..="\n"

View File

@ -5,7 +5,13 @@ function main:init()
extcmd("rec") extcmd("rec")
self.state_manager=state_manager:new() -- instantiate one global self.state_manager=state_manager:new() -- instantiate one global
self.state_manager:push(state_menu:new()) self.state_manager:push(state_menu:new())
-- TODO: Push menu here
--[[
local b=board:new(watcher:new(progression[#progression],1,{}))
b.last_card=75
self.state_manager:push(state_wonround:new(b))
]]
if (completion_tracker:should_show_tutorial()) self.state_manager:push(state_ironman:new(tutorial)) if (completion_tracker:should_show_tutorial()) self.state_manager:push(state_ironman:new(tutorial))
end end

39
main.p8
View File

@ -20,6 +20,7 @@ __lua__
#include progression.lua #include progression.lua
#include seed_constants.lua #include seed_constants.lua
#include seeds.lua #include seeds.lua
#include sounds.lua
#include state_archaeology.lua #include state_archaeology.lua
#include state_excavate_menu.lua #include state_excavate_menu.lua
#include state_manager.lua #include state_manager.lua
@ -34,7 +35,6 @@ __lua__
#include text.lua #include text.lua
#include watcher.lua #include watcher.lua
#include main.lua #include main.lua
--[[ --[[
srand(2) srand(2)
for i=1,10 do for i=1,10 do
@ -231,6 +231,43 @@ __sfx__
a51300003051030510305103051030510305103051030510305103051030510305103051030510305103051524500245002450024500245002450024500245002450024500245002450024500245002450024500 a51300003051030510305103051030510305103051030510305103051030510305103051030510305103051524500245002450024500245002450024500245002450024500245002450024500245002450024500
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
930a00003766437625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
954a00002b66518000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010400000c25512255232550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0108000013335113000c3000c3050c305000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__music__ __music__
01 00551544 01 00551544
00 01551544 00 01551544

View File

@ -7,4 +7,8 @@ function music_manager:update()
local should_be_playing = completion_tracker:get_music_preference() local should_be_playing = completion_tracker:get_music_preference()
if (is_playing and not should_be_playing) music(-1,500) if (is_playing and not should_be_playing) music(-1,500)
if (not is_playing and should_be_playing) music(0) if (not is_playing and should_be_playing) music(0)
local label,pref="start music",true
if (should_be_playing) label,pref="stop music",false
menuitem(1,label,function() completion_tracker:set_music_preference(pref) end)
end end

13
sounds.lua Normal file
View File

@ -0,0 +1,13 @@
sounds={}
function sounds:menu()
sfx(63,3)
end
function sounds:deal_card()
sfx(60,3)
end
function sounds:dire()
sfx(62,3)
end
function sounds:win()
sfx(61,3)
end

View File

@ -43,8 +43,8 @@ function state_archaeology:update()
local vel=0 local vel=0
if (btnp(0)) vel-=1 if (btnp(0)) vel-=1
if (btnp(1)) vel+=1 if (btnp(1)) vel+=1
if (btnp(5)) self.done=true if (btnp(5)) sounds:menu() self.done=true
if (vel!=0) self:select_book((self.selection+vel-1)%self.n_holy_books+1) if (vel!=0) sounds:menu() self:select_book((self.selection+vel-1)%self.n_holy_books+1)
end end
function state_archaeology:draw() function state_archaeology:draw()
local fullw,fullh=measure_text(self.full_text) local fullw,fullh=measure_text(self.full_text)

View File

@ -4,11 +4,21 @@ function state_gameround:init(watcher,ruleset)
self.outcome=nil self.outcome=nil
self.restart_frames=0 self.restart_frames=0
end end
function state_gameround:enter() end function state_gameround:enter() self:add_menu() end
function state_gameround:exit() end function state_gameround:exit() self:remove_menu() end
function state_gameround:reenter() self:add_menu() end
function state_gameround:suspend() self:remove_menu() end
function state_gameround:add_menu()
menuitem(4,"restart",function() self.outcome="restart" self.done=true end)
menuitem(5,"go to menu",function() self.outcome="menu" self.done=true end)
end
function state_gameround:remove_menu()
menuitem(4)
menuitem(5)
end
function state_gameround:reenter() end
function state_gameround:suspend() end
function state_gameround:update() function state_gameround:update()
self.board:update() self.board:update()

View File

@ -35,7 +35,7 @@ end
function state_menu:update() function state_menu:update()
self.frame+=1 self.frame+=1
self.frame%=1024 self.frame%=1024
if (btnp(1) or btnp(4)) self.options[self.selection]:cb() if (btnp(1) or btnp(4)) sounds:menu() self.options[self.selection]:cb() return
local vel=0 local vel=0
if (btnp(2)) vel-=1 if (btnp(2)) vel-=1

View File

@ -23,6 +23,7 @@ function state_reset_menu:update()
run() run()
end end
if self.code[self.code_i]==o then if self.code[self.code_i]==o then
sounds:dire()
self.code_i+=1 self.code_i+=1
if (self.code_i>#self.code) completion_tracker:reset() if (self.code_i>#self.code) completion_tracker:reset()
else else

View File

@ -2,6 +2,7 @@ state_wonironman=klass()
function state_wonironman:init() function state_wonironman:init()
end end
function state_wonironman:enter() function state_wonironman:enter()
sounds:win()
completion_tracker:incr_metascore() completion_tracker:incr_metascore()
end end
function state_wonironman:exit(new_top) end function state_wonironman:exit(new_top) end
@ -10,7 +11,7 @@ function state_wonironman:reenter() end
function state_wonironman:suspend() end function state_wonironman:suspend() end
function state_wonironman:update() function state_wonironman:update()
if (btnp(4)) self.done=true if (btnp(4)) sounds:menu() self.done=true
end end
function state_wonironman:draw() function state_wonironman:draw()
cls(13) cls(13)

View File

@ -7,23 +7,26 @@ function state_wonround:init(board)
self.card=self.board:get_endgame_card() self.card=self.board:get_endgame_card()
self.verse_id,self.verse_name,self.verse=liturgy:suggest_verse(self.board.ruleset,self.card) self.verse_id,self.verse_name,self.verse=liturgy:suggest_verse(self.board.ruleset,self.card)
end end
seen_tip_this_session=false
function state_wonround:enter() function state_wonround:enter()
sounds:win()
completion_tracker:mark_seen(self.verse_id) completion_tracker:mark_seen(self.verse_id)
completion_tracker:advance_completion_level(self.board:get_completion_level()) completion_tracker:advance_completion_level(self.board:get_completion_level())
self.has_tip = not seen_tip_this_session
seen_tip_this_session=true
end end
function state_wonround:exit(new_top) end function state_wonround:exit(new_top) end
function state_wonround:reenter() end function state_wonround:reenter() end
function state_wonround:suspend() end function state_wonround:suspend() end
function state_wonround:update() function state_wonround:update()
self.frame=min(self.frame+1,self.frames) self.frame=min(self.frame+1,self.frames)
self.progress=self.frame/self.frames self.progress=self.frame/self.frames
self.board:set_restart_progress(self.progress) self.board:set_restart_progress(self.progress)
if (self.progress<1.0) return if (self.progress<1.0) return
if (btnp(4)) self.done=true if (btnp(4)) sounds:menu() self.done=true
end end
function state_wonround:draw() function state_wonround:draw()
cls(13) cls(13)
@ -61,4 +64,10 @@ function state_wonround:draw()
line(oldx,y,oldx+oldw-2,y,15) line(oldx,y,oldx+oldw-2,y,15)
print("next",57,y+2,15) print("next",57,y+2,15)
print("(🅾️)",57,y+8,15) print("(🅾️)",57,y+8,15)
if self.has_tip then
local tip="tip: hold ❎ to restart"
local w=measure_text(tip)
print(tip,64-w\2,122,15)
end
end end