2 This file is part of POCA - a puzzle game
4 POCA is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This software is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>.
22 bmp
= love
.graphics
.newImage('gfx/trinkets/1000points.png'),
26 bmp
= love
.graphics
.newImage('gfx/trinkets/2000points.png'),
27 description
= 'Not bad.',
31 bmp
= love
.graphics
.newImage('gfx/trinkets/3000points.png'),
32 description
= 'Not one, not two, but three thousand points, found in Lighthouse.',
36 bmp
= love
.graphics
.newImage('gfx/trinkets/4000points.png'),
37 description
= 'Congratulations! These are all points in the game.',
41 bmp
= love
.graphics
.newImage('gfx/trinkets/beastfang.png'),
42 description
= 'A fang that once belonged to an ancient beast, sent to museum, but unfortunately lost in transport.'
45 name
= 'A Box of Cigarettes',
46 bmp
= love
.graphics
.newImage('gfx/trinkets/cigarettes.png'),
47 description
= 'A box of highly addictive cigarettes found in the City.',
50 name
= 'POCA Soundtrack',
51 bmp
= love
.graphics
.newImage('gfx/trinkets/casette.png'),
52 onclick
= function() change_screen('menu_casette') end
56 bmp
= love
.graphics
.newImage('gfx/trinkets/chocolate.png'),
59 name
= 'Scintilating frame',
60 bmp
= love
.graphics
.newImage('gfx/trinkets/frame.png'),
61 onclick
= function() change_screen('menu_frame') end,
62 description
= 'A display of some sort, not immediately useful.'
66 bmp
= love
.graphics
.newImage('gfx/trinkets/gameglitch.png'),
67 onclick
= function() gg
:main() end,
70 name
= 'A copy of the GNU GPL',
71 bmp
= love
.graphics
.newImage('gfx/trinkets/gpl3.png'),
72 onclick
= function() license
:main() end
75 name
= 'Book of Hints',
76 bmp
= love
.graphics
.newImage('gfx/trinkets/hints_book.png'),
77 description
= 'This book is badly damaged and can only be opened a few times. Please use sparingly!',
78 onclick
= function() change_screen('menu_hints') end
82 bmp
= love
.graphics
.newImage('gfx/trinkets/marbles.png'),
83 description
= 'Three glass marbles',
87 bmp
= love
.graphics
.newImage('gfx/map.png'),
88 onclick
= function() change_screen('menu_map') end
92 bmp
= love
.graphics
.newImage('gfx/trinkets/matches.png'),
93 description
= 'Matches are used to light cigarettes or illuminate dark places.',
94 onclick
= function () change_screen('menu_matches') end,
97 name
= '3-color pencil',
98 bmp
= love
.graphics
.newImage('gfx/trinkets/pencil.png'),
99 description
= 'A huge pencil, that can add color to the playfield, should it become too dull',
101 current
.painting
= not current
.painting
102 playfield
.paint_mode
= nil
103 change_screen('playfield')
107 name
= 'Photo Booth Photos',
108 bmp
= love
.graphics
.newImage('gfx/trinkets/photos.png'),
109 description
= 'Photos of me & my dad.',
113 bmp
= love
.graphics
.newImage('gfx/trinkets/pistol.png'),
114 description
= 'A dangerous object, not very useful in this game'
117 name
= 'Pocket explosions',
118 bmp
= love
.graphics
.newImage('gfx/trinkets/pocketexplosions.png'),
119 onclick
= function() pe
:main() end,
120 description
= 'A hard game',
123 name
= 'Snow Dome with Rabbit',
124 bmp
= love
.graphics
.newImage('gfx/trinkets/rabbit.png'),
125 description
= 'A rabbit is underneath a tiny dome. When you shake it, flakes unsettle and slowly fall, like snow.'
128 name
= 'Rainbow Ring',
129 bmp
= love
.graphics
.newImage('gfx/trinkets/rainbowring.png'),
130 onclick
= function() rr
:main() end,
134 bmp
= love
.graphics
.newImage('gfx/trinkets/raregem.png'),
138 bmp
= love
.graphics
.newImage('gfx/trinkets/robotoy.png'),
139 description
= 'A toy that says: "We are the space robots. We are here to protect you."'
142 name
= 'Ruben\'s Pyramid',
143 bmp
= love
.graphics
.newImage('gfx/trinkets/rubenspyramid.png'),
144 onclick
= function() rp
:main() end,
148 bmp
= love
.graphics
.newImage('gfx/trinkets/tinyheart.png'),
151 name
= 'Pocket Teleport',
152 bmp
= love
.graphics
.newImage('gfx/trinkets/teleport_ul.png'),
154 change_screen('playfield')
155 current
.phase
= 'play'
156 secrets_arrow(-1, -1)
161 name
= 'Pocket Teleport',
162 bmp
= love
.graphics
.newImage('gfx/trinkets/teleport_dl.png'),
164 change_screen('playfield')
165 current
.phase
= 'play'
171 name
= 'Pocket Teleport',
172 bmp
= love
.graphics
.newImage('gfx/trinkets/teleport_ur.png'),
174 change_screen('playfield')
175 current
.phase
= 'play'
181 name
= 'Tit Magazine',
182 bmp
= love
.graphics
.newImage('gfx/trinkets/titmagazine.png'),
183 description
= 'A magazine full of interesting pictures',
187 bmp
= love
.graphics
.newImage('gfx/trinkets/toyhorse.png'),
190 name
= 'Wooden Flower in a Vase',
191 bmp
= love
.graphics
.newImage('gfx/trinkets/woodenflower.png'),
193 autodescribe
= function(self
)
194 for k
, e
in pairs(self
) do
195 if (type(e
) == 'table') and (not e
.description
) and (not e
.onclick
) then
196 for l
= 1, #levels
do
197 if levels
[l
].trinket
== k
then
198 self
[k
].description
= self
[k
].name
..
199 ', found in ' .. level_labels
[l
] .. '.'
209 trinkets
:autodescribe()
212 function select_trinket(d
)
213 if #game
.trinkets
> 0 then
214 return (current
.trinket
- 1 + d
) % #game
.trinkets
+ 1
221 function get_trinket(trinket_name
)
222 if not trinket_name
then return end
224 local place
= #game
.trinkets
+ 1
225 if trinket_name
== '1000points' then -- if new 1000points are picked up
227 if game
.trinkets
[#game
.trinkets
] == '1000points' then
228 trinket_name
= '2000points'
229 elseif game
.trinkets
[#game
.trinkets
] == '2000points' then
230 trinket_name
= '3000points'
231 elseif game
.trinkets
[#game
.trinkets
] == '3000points' then
232 trinket_name
= '4000points'
233 else -- first 1000 points
237 game
.trinkets
[place
] = trinket_name
238 game
.former_trinkets
[#game
.former_trinkets
+ 1] = trinket_name
239 current
.trinket
= place
243 -- shifts back all trinkets after the replaced one
244 function lose_trinket(trinket_name
)
245 print('lose_trinket(' .. trinket_name
.. ')')
246 if not has_trinket(trinket_name
) then return end
247 local replace
= false
248 for a
= 1, #game
.trinkets
do
249 if game
.trinkets
[a
] == trinket_name
then
252 game
.trinkets
[a
- 1] = game
.trinkets
[a
]
255 game
.trinkets
[#game
.trinkets
] = nil
259 function had_trinket(t
)
260 for _
, gt
in ipairs(game
.former_trinkets
) do
261 if gt
== t
then return true end
267 function has_trinket(t
)
268 for _
, gt
in ipairs(game
.trinkets
) do
269 if gt
== t
then return true end
275 function click_corpse()
276 local content
= 'You search the remains of a dead explorer and find '
277 local s
= game
.searched_corpses
[game
.currentlevel
]
278 game
.searched_corpses
[game
.currentlevel
] = true
279 if not (s
or had_trinket('map')) then
281 content
= content
.. 'a map.'
282 elseif not (s
or had_trinket('rubenspyramid')) then
283 if not has_trinket('hints_book') then
284 get_trinket('hints_book')
285 content
= content
.. 'a Book of Hints and '
287 get_trinket('rubenspyramid')
288 content
= content
.. 'a strange puzzle.'
290 content
= content
.. 'nothing special.'