Commit graph

55 commits

Author SHA1 Message Date
Franklin Wei
b3356e3aff puzzles: resync with upstream
This brings the code to upstream commit 3ece3d6 (I've made my own Rockbox-
specific changes on top of that).

Changes include using C99 `bool' throughout, and minor logic fixes for some
puzzles.

Change-Id: Ie823e73ae49a8ee1de411d6d406df2ba835af541
2018-12-21 22:13:33 -05:00
Franklin Wei
f727b0787a puzzles: minor nitpicks to fbb6a2f
Just some whitespace changes to maintain stylistic consistency.

Change-Id: I50b5d52db2795cfcb4155bdffbfb80c1c3773112
2018-06-12 12:11:06 -04:00
Franklin Wei
c2d5ac1762 puzzles: fix typo introduced by fbb6a2f
When zoomed in, the original commit made a mono bitmap (a.k.a. text) always
have the red component set to 255. This would cause drawn text to always be
red. Fixed.

Change-Id: Iec06256a3a783948c60c70557de042b375224448
2018-06-12 12:09:44 -04:00
Marcin Bukat
fbb6a2ff6d Agptek Rocker: Build plugins
Patch provided by Aapo Tahkola.

Change-Id: I37a42a950d78d6b8aa3927ec7aeb30030f7be7a5
2018-06-12 10:31:15 +02:00
Franklin Wei
992a12670e puzzles: update frontend for new upstream, misc. changes
The upstream code changed a little bit with regard to the request_keys()
API. Also, we save some bytes (especially on the c200v2) by compiling with
-ffunction-sections and -fdata-sections, which allows Net to fit once again.

Change-Id: I3ab30127169c73e4cd8996f0c12e1223ee18d79f
2018-04-24 19:06:30 -04:00
Franklin Wei
ef0fb52113 puzzles: silence some warnings
Change-Id: Id6fd9d8dd3021f5e2cb93565d7e419aaf07f9af0
2018-04-24 19:06:30 -04:00
Franklin Wei
22823e2f78 puzzles: save some bytes
This should cut just enough size off the binary to let Net still compile
for the c200v2. This is probably close to the last time I'll be able to do
this; I'm already resorting to dirty hacks like writing super terse error
messages.

Change-Id: I43344b9a601696d7ca56fc02af4a611fd9d1a150
2018-04-17 22:13:31 -04:00
Franklin Wei
6dc9d1d730 puzzles: enable all the remaining games
They all work now :). I merged in part of Chris Boyle's Android port of
Puzzles to give the front end a way to know what keys the back end needs.
This also re-syncs to the latest upstream sources.

Change-Id: Ie0409bbb32f617ae5abf4f81be3b45d1552db9bb
2018-04-17 18:20:12 -04:00
Franklin Wei
77641d59a7 puzzles: add formatting to help viewer
The help text is now processed to generate a style array to pass to the
display_text library in addition to the text itself. The help text is still
compressed using LZ4, and still fits on the c200v2.

Change-Id: I7a3a664f90f67a1a018956c72d2b62d92b8ffd17
2018-03-17 22:54:21 -04:00
Franklin Wei
d728b9775b puzzles: fix off-by-one in blitter clipping
Nobody to blame except myself for this one...

Change-Id: I8446b564c3c060411c46675e9baac1c72437c39a
2017-11-24 20:31:45 -05:00
Franklin Wei
f51544a0e5 puzzles: polish mouse mode
Reduces lag when dragging. Also throws some comments in.

Change-Id: Ibd0d95e94200ae6de8258ce8d2e001c931161385
2017-11-24 20:31:45 -05:00
Franklin Wei
ab6e40b977 puzzles: fix copy-paste typo
Change-Id: I09d065574a02a541c43c1a78d92e50a80b5e2ae0
2017-11-24 20:31:45 -05:00
Franklin Wei
e8e85c5762 puzzles: resync with upstream; add Loopy and Palisade, mouse mode
This brings a various small changes to the drawing and input code,
as well as a brand new "mouse mode", where input goes to a virtual
mouse cursor. Only Loopy has this mouse mode enabled by default,
while other games have it hidden away under the debug menu. Some
changes by me to Palisade were required to make it playable; those
are included here as well. Right now, sgt-net is pushing the c200v2's
upper limit on size and may have to be dropped in a future commit.

Change-Id: I495d2a2125462c2985aec1ffbc54bbe3fe5133bd
2017-11-21 19:29:45 -05:00
Franklin Wei
d9a55ac816 puzzles: fix blitting when zoomed
Both blitter_save() and blitter_load() functioned incorrectly when
zoomed in -- blitter_save() would copy from the wrong location, and
blitter_load() would ignore the y-coordinate of the destination.

Change-Id: I7c85debf5953575f72c4a81e3dbcf514202c3aed
2017-11-04 12:09:16 -04:00
Franklin Wei
7f1dd6f593 puzzles: clarify code and documentation
This adds no functionality, but instead cleans up the source and adds
some more substantial documentation.

Change-Id: I77328c171a61db7729bdf928ba094cfbed4ec0dd
2017-11-04 11:14:18 -04:00
Franklin Wei
9f62373735 puzzles: fix title drawing
This fixes two separate bugs: The first was that the drawmode was not
reliably set when drawing the title, occasionally leading to a black
rectangle where the title should be; the second that the title bar's
space wasn't being cleared before drawing, leading to artifacts when
the length of the title string changed.

Change-Id: I3859125b14d568e1098b095ab134645a504b2d45
2017-11-04 11:14:17 -04:00
Franklin Wei
65e7617ab6 puzzles: add an interaction mode to the "Zoom In" feature
This makes it possible to play the game while zoomed in. Read the
manual entry if you want to know more.

Change-Id: Iff8bab12f92ebd2798047c25d1fde7740aa543ce
2017-10-30 21:25:33 -04:00
Franklin Wei
47ebf623cb puzzles: improve zoom rendering
This adds colored font rendering, as well as a workaround for font
loading while zoomed. Additionally, the frontend has been modified to
match the new upstream API.

Change-Id: I8c3fe57e6854f176485bf792cf4778cd54a21674
2017-10-29 12:49:39 -04:00
Franklin Wei
9ba899f850 puzzles: fix clipping and 24-bit handling
Should fix the build.

Change-Id: I68f06702570389c2c9d0d76acc064c324cac457b
2017-10-27 20:17:28 -04:00
Franklin Wei
8b8e25f195 puzzles: add "Zoom In" option to improve usability
This adds a "Zoom In" option to the pause menu of each puzzle, which
displays the puzzle at triple size (subject to change). This should
help with tiny screens, modulo memory concerns associated with
allocating the temporary framebuffer to which drawing operations are
redirected. Coincidentally, there's an upstream bug with Map that
causes the cursor's positioning to be incorrectly displayed when
zoomed.

Change-Id: Ic8b7c2942acf558e295f4271dd7dc458cd336895
2017-10-27 19:10:53 -04:00
Franklin Wei
a644489ccf puzzles: adapt frontend to upstream changes
Change-Id: Idd911ac4ac6c2efa3c6b064be6058979d7a15447
2017-10-23 17:41:11 -04:00
Franklin Wei
752f7b1698 Harmonize plugin keymaps
Aims to provide a lib/keymaps.h for plugins needing simple button
functionality beyond that provided by PLA. Currently used by puzzles
and xworld.

Change-Id: Icb3493aaf176d401762de834dd48fc76a3824c5a
2017-09-30 20:13:49 -04:00
Franklin Wei
4dd300d9f0 puzzles: remove old combined build code
We don't really need it anymore.

Change-Id: I7c8149faa6b80807ca718b73483bdb2e41830cbd
2017-08-23 14:22:09 -04:00
Franklin Wei
71850e8e69 puzzles: various useless tweaks
Change-Id: Ibf9769f99d61581b184d0ffa4ef0614eb976f0e8
2017-08-16 11:40:42 -04:00
Franklin Wei
d0c4ef4b78 puzzles: enable long-press in Map
This allows for stippling regions.

Change-Id: If8f271b66f6f350c843d6669918ea39712acd818
2017-08-16 11:40:42 -04:00
Franklin Wei
bf25f3e6e7 puzzles: compress extensive help text
This is only really needed to save a few bytes on the c200v2, but
since it adds negligible overhead, so it's implemented for all
targets.

A stripped down version of the LZ4 reference implementation is found
in lz4tiny.c.

Change-Id: Ib914ba71c84e04da282328662c752e533912e197
2017-08-16 11:40:37 -04:00
Franklin Wei
ca228d3d87 puzzles: cut size for c200v2
- font caching is disabled
- font table is dynamically allocated
- side effect: tlsf isn't reset between runs anymore, memory leaks will have a bigger impact

Change-Id: I0b25c22665d956895e8007883d522256010d04ab
2017-08-09 21:51:23 -04:00
Franklin Wei
076cf0aa9b puzzles: new input scheme for Mines and Magnets
Both these puzzles now have long press mapped to spacebar.
2017-07-27 19:09:50 -04:00
Franklin Wei
f1b82b1acf puzzles: polish up the config menus 2017-07-27 19:09:50 -04:00
Franklin Wei
1a5149a0ae puzzles: tweak text positioning 2017-07-27 19:09:50 -04:00
Franklin Wei
aa7b168fd7 puzzles: font caching
This lets puzzles remember which fonts were loaded previously so
they can be preloaded when the puzzle is started (and the disk is
spinning), instead of while the game is being played.
2017-07-27 19:09:50 -04:00
Franklin Wei
eb43bce106 puzzles: add number chooser for integer settings
Sure beats typing on the virtual keyboard.
2017-07-27 19:09:50 -04:00
Franklin Wei
513fb8b332 puzzles: update debug menu
Add an option to visualize polygon rendering to aid in diagnosing
artifacts.
2017-07-27 19:09:50 -04:00
Franklin Wei
e7a35ba383 puzzles: dynamic text size via custom font pack
Up to now, we'd just ignore whatever font size the puzzle asked for,
and instead just go with either the UI font or system font regardless
of their size, which led to some horrible-looking puzzles. This patch
adds the ability to automatically load fonts of the proper size when
they are available, which makes text-based puzzles such as Pattern and
Slant function correctly with any UI font.

The font pack, which should be extracted to the system-wide fonts
directory consists of 3 small bitmap fonts from 7px to 10px and then
anti-aliased Deja Vu fonts from 10px to 36px. It is available in the
source tree (apps/plugins/puzzles/fonts.zip), or from
<http://download.rockbox.org/useful/sgt-fonts.zip>.

Change-Id: I05c8fe7bd6d867e14de9b941deb91e8c642ee4a8
2017-07-17 16:58:13 -04:00
Franklin Wei
84e13d5749 puzzles: allow using hints in Fifteen
This maps the select button to the "h" key for Fifteen only.

Change-Id: I7a5a61cec46e86254218fabfb191974f98c12319
2017-07-12 12:23:21 -04:00
Franklin Wei
552a271c6f puzzles: remove redundant help content
It used to be that each puzzle had a complete copy of the entire
puzzles manual and the "quick help" text for every single puzzle. This
was obviously a waste, so now each puzzle only has the sections of the
manual that apply to it, saving about 100KB or so per puzzle. This
also has the added benefit of shrinking binary size enough to allow
full help support on the c200v2, which has been enabled.

Change-Id: I76c799635de058e4a48e0c18b79537857af7cf85
2017-06-03 13:45:07 -04:00
Franklin Wei
cefbde0bbb puzzles: correct drawmode for text
DRMODE_FG should be used instead of DRMODE_COMPLEMENT to allow text to
be drawn in color, benefitting puzzles such as Slant and Pattern.

Change-Id: I292216490a58344cb93dc5c2ec1780229735313a
2017-06-02 18:19:10 -04:00
Franklin Wei
6bba062599 puzzles: clarify target-specific macros
Change-Id: I1f68f25a557bb2daa5e83a6d6f02711abeec5165
2017-05-21 14:37:17 -04:00
Franklin Wei
504346ab48 puzzles: fix Bridges crash on Clip Zip
- small screen could lead to invalid viewport coordinates

Change-Id: I1f2a323554e4ed31f250218220b464a02bffa308
2017-05-18 18:03:53 -04:00
Franklin Wei
7b6f34a456 puzzles: fix building
- disables help on c200v2
- renames conflicting function

Change-Id: I0c4ff1bb40e7e3cafd0170090f22b80bf0656741
2017-05-17 17:42:30 -04:00
Franklin Wei
001860ce78 puzzles: full help system
- embeds the upstream halibut documentation for plugin use

- currently every plugin has a copy of the help text, but in the
  future a centralized system using overlays might be better

Change-Id: Idb6eb9accc2fa786a4c6bc2b704e7cf5fd3f78dd
2017-05-16 16:45:39 -04:00
Franklin Wei
271c30f206 puzzles: remember the previous preset when selecting
Change-Id: I22c84257a3aa9b19bf5e94f9de51204bbade08c5
2017-05-04 20:37:04 -04:00
Franklin Wei
28fef2e415 Fix puzzles... again
Change-Id: I34dd8673ebcbc7fcd55681175d0e18c8bbc5fe6c
2017-04-30 13:57:13 -04:00
Franklin Wei
881746789a puzzles: refactor and resync with upstream
This brings puzzles up-to-date with upstream revision
2d333750272c3967cfd5cd3677572cddeaad5932, though certain changes made
by me, including cursor-only Untangle and some compilation fixes
remain. Upstream code has been moved to its separate subdirectory and
future syncs can be done by simply copying over the new sources.

Change-Id: Ia6506ca5f78c3627165ea6791d38db414ace0804
2017-04-29 18:24:42 -04:00
Franklin Wei
0bdb255a4e puzzles: fix building on c200v2
- disables Solo and Loopy

Change-Id: I3de15c0ad001683a4303950972af2f5988d438d0
2017-01-15 14:29:24 -05:00
Franklin Wei
d221ca6e5b puzzles: antialiased line drawing via Wu's algorithm and optional "shortcuts" for undo/redo
- line drawing should eventually be moved to xlcd, but for now it's very unportable code
- also fixes a minor issue with the configuration screens

Change-Id: I897f01b7210cbbec32665c2bc67920c965ea0bec
2017-01-15 14:29:24 -05:00
Franklin Wei
c1b913bb7d Revert "puzzles: antialiased line drawing and optional "shortcuts" for undo/redo"
This reverts commit 8e4429853d.

Change-Id: Id622d58ad4b3b9dd3313811c8a2f83202d21f5ee
2017-01-13 23:52:04 -05:00
Franklin Wei
823f726f83 puzzles: fix configuration menu (again!)
Change-Id: I440f3cea1bbeb3e7bda4aebefaaece3e8f3d44fd
2017-01-13 23:22:51 -05:00
Franklin Wei
8e4429853d puzzles: antialiased line drawing and optional "shortcuts" for undo/redo
- line drawing should eventually be moved to xlcd, but for now it's very nonportable code
- fixes a minor issue with the configuration screens

Change-Id: I897f01b7210cbbec32665c2bc67920c965ea0bec
2017-01-13 23:22:51 -05:00
Franklin Wei
637c7414a9 puzzles: enable fallback to audiobuf when smalloc() fails
- upon a failed smalloc(), the audio buffer will be used for further allocations
- should fix things on low-memory targets (c100 and c200v2), but breaks playback
- playback should still be intact on other targets

Change-Id: Ic239f1316efadc957050afacf5c614dbbca3f805
2017-01-13 19:00:09 -05:00