diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-11-20 15:16:41 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-11-24 16:23:09 -0500 |
| commit | 56c9984511f016eab7e1278ba9e40d88bb59a162 (patch) | |
| tree | 1bfa6d3aeb3bf2a6ffec71387ac073cd0b8b2a51 /apps/plugins/puzzles/html/javapage.pl | |
| parent | 29648f817677b84c03c2bcfe89eb8cf53653e7db (diff) | |
| download | rockbox-puzzles.zip rockbox-puzzles.tar.gz rockbox-puzzles.tar.bz2 rockbox-puzzles.tar.xz | |
[WIP] Port of Simon Tatham's Puzzle Collectionpuzzles
Original revision: 5123b1bf68777ffa86e651f178046b26a87cf2d9
MIT Licensed. Some games still crash and others are unplayable due to
issues with controls. Still need a "real" polygon filling algorithm.
The following games are at least partially broken for various reasons:
Cube: crash with certain settings
Galaxies: crash
Inertia: crash
Keen: input issues
Loopy: weird stuff happens
Map: crash on input
Mines: weird stuff happens on target
Palisade: input issues
Signpost: crash on input
Solo: input issues
Towers: input and drawing issues
Train Tracks: drawing issues
Twiddle: weird animation on target
Undead: input and drawing issues
Unequal: input and drawing issues
Untangle: input issues
All in all, about 40% of the games are at least partially broken.
Change-Id: I7c69b6860ab115f973c8d76799502e9bb3d52368
Diffstat (limited to 'apps/plugins/puzzles/html/javapage.pl')
| -rwxr-xr-x | apps/plugins/puzzles/html/javapage.pl | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/html/javapage.pl b/apps/plugins/puzzles/html/javapage.pl new file mode 100755 index 0000000..cd5e6a1 --- /dev/null +++ b/apps/plugins/puzzles/html/javapage.pl @@ -0,0 +1,104 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +open my $footerfile, "<", shift @ARGV or die "footer: open: $!\n"; +my $footer = ""; +$footer .= $_ while <$footerfile>; +close $footerfile; + +for my $arg (@ARGV) { + $arg =~ /(.*\/)?([^\/]+)\.html$/ or die; + my $filename = $2; + open my $gamefile, "<", $arg or die "$arg: open: $!\n"; + my $unfinished = 0; + my $docname = $filename; + chomp(my $puzzlename = <$gamefile>); + while ($puzzlename =~ s/^([^:=]+)(=([^:]+))?://) { + if ($1 eq "unfinished") { + $unfinished = 1; + } elsif ($1 eq "docname") { + $docname = $3; + } else { + die "$arg: unknown keyword '$1'\n"; + } + } + my $instructions = ""; + $instructions .= $_ while <$gamefile>; + close $gamefile; + + open my $outpage, ">", "${filename}.html"; + + my $unfinishedtitlefragment = $unfinished ? "an unfinished puzzle " : ""; + my $unfinishedheading = $unfinished ? "<h2 align=center>an unfinished puzzle</h2>\n" : ""; + my $unfinishedpara; + my $links; + if ($unfinished) { + $unfinishedpara = <<EOF; +<p> +You have found your way to a page containing an <em>unfinished</em> +puzzle in my collection, not linked from the <a href="../">main +puzzles page</a>. Don't be surprised if things are hard to understand +or don't work as you expect. +EOF + $links = <<EOF; +<p align="center"> +<a href="../">Back to main puzzles page</a> (which does not link to this) +EOF + } else { + $unfinishedpara = ""; + $links = <<EOF; +<p align="center"> +<a href="../doc/${docname}.html#${docname}">Full instructions</a> +| +<a href="../">Back to main puzzles page</a> +EOF + } + + print $outpage <<EOF; +<html> +<head> +<title>${puzzlename}, ${unfinishedtitlefragment}from Simon Tatham's Portable Puzzle Collection</title> +<link rel="stylesheet" type="text/css" href="../../sitestyle.css" name="Simon Tatham's Home Page Style"> +<script type="text/javascript" src="resize-puzzle-applet.js"></script> +</head> +<body onLoad="initResizablePuzzleApplet();"> +<h1 align=center>${puzzlename}</h1> +${unfinishedheading} +<h2 align=center>from Simon Tatham's Portable Puzzle Collection</h2> + +${unfinishedpara} + +<p align="center"> +<table cellpadding="0"> +<tr> +<td> +<applet id="applet" archive="${filename}.jar" code="PuzzleApplet" + width="700" height="500"> +</applet> +</td> +<td> +<div id="eresize" style="width:5px;height:500px;cursor:e-resize;"></div> +</td> +</tr> +<td> +<div id="sresize" style="width:700px;height:5px;cursor:s-resize;"></div> +</td> +<td> +<div id="seresize" style="width:5px;height:5px;cursor:se-resize;"></div> +</td> +</tr> +</table> + +${instructions} + +${links} + +${footer} +</body> +</html> +EOF + + close $outpage; +} |