Commit Graph

1205 Commits

Author SHA1 Message Date
yenatch
68eae566ec Merge remote-tracking branch 'origin/master'
Conflicts:
	pokemontools/gfx.py
2015-02-11 14:22:50 -08:00
yenatch
fb23f2754c Split the lz compression tools out of gfx.py. 2015-02-07 13:11:38 -08:00
yenatch
36f7ee513e Refactor the compressor again.
This is a little closer to the target compressor than before.
2015-02-07 13:06:08 -08:00
yenatch
78aa4f00be Pointless whitespace tweaks. 2015-02-07 12:40:15 -08:00
yenatch
aec2e7ff64 Refactor get_pic_animation. 2015-02-07 12:36:22 -08:00
Bryan Bishop
2c2ceb7456 Merge pull request #87 from Sanqui/master
Fix parsing arguments, fixes `make pngs` for pokecrystal
2015-01-28 13:10:57 -06:00
IIMarckus
f5248045ac redrle: reduce code duplication. 2015-01-08 03:14:58 -07:00
IIMarckus
fa0761ea70 redrle: Add a -r flag to compress by rows (matching GF's behavior). 2015-01-08 02:14:42 -07:00
Sanky
2e76f276d0 Fix parsing arguments 2014-12-19 21:39:56 +01:00
yenatch
0182bcaf8f Read gfx.yaml for graphics conversion options.
Keys count both as path nodes and attributes depending on context.

An example gfx.yaml:

```
gfx:
    pics:
        pal_file: normal.pal
        pic_dimensions: yes
        animate: yes
        stupid_bitmask_hack: [dewgong, lugia]
    pc:
        literal_only: yes
```

Here, all graphics matching gfx/pics/.../*.png will use palette gfx/pics/.../normal.pal and be interpreted as animated pics. gfx/pc.2bpp will compress using only the `literal` command.

If gfx.yaml doesn't exist, current behavior is unchanged. Filename arguments override yaml.
2014-12-03 20:10:47 -08:00
yenatch
41df23fce3 Refactor the Decompressed class and dump/convert pic animations. 2014-11-22 13:57:22 -08:00
yenatch
145269cdb7 Left a scalpel in the patient.
"whoops"
2014-11-02 00:14:05 -07:00
yenatch
ca42efaa0d More lenient palette handling.
Truncate colors in a palette beyond the limit of 4.

Make palette sorting more accurate by taking the sum of the hues rather than by luminance. Ultimately, palette order is up to the whim of whoever was drawing in the tile editor at the time, but this is a reasonable estimation.
2014-11-01 21:11:49 -07:00
yenatch
0dd6b20b2f BSSReader: Fix eval inserting __builtins__ into self.constants.
Eval should really not be used in the first place, but at least it works again.

Fixes 82b78e5c79, which replaced the constants_to_dict method with BSSReader.
2014-11-01 20:42:41 -07:00
yenatch
85e0e2af68 Refactor the de/compressor.
Speed, readability, accuracy and compression are all improved.

Also fix an off-by-one error in repeat commands in the compressor.
2014-10-28 22:00:52 -07:00
yenatch
074f8dfdf4 audio: Expose header reads via separate functions. 2014-10-28 21:59:07 -07:00
yenatch
aff76027a0 Fix the output of PointerLabelParam.to_asm.
Accidentally forgot to zfill either half of pointer_part, which would return malformed addresses.

Fixes de39f7c6ff.
2014-10-28 21:53:08 -07:00
Bryan Bishop
4d9fd56593 Merge pull request #83 from yenatch/fix-map-editor
Fix the map editor.
2014-10-02 23:21:17 -05:00
yenatch
c9d9a16fd6 map_editor: Fix automatic graphics decompression. 2014-10-02 23:47:00 -04:00
yenatch
0a68945a48 Merge remote-tracking branch 'origin/master' into fix-map-editor 2014-10-02 23:30:28 -04:00
yenatch
5cce990140 Fix the map editor.
The map editor can now be invoked in ipython:
	import extras.pokemontools.map_editor as ed
	app = ed.init()
Then <app> can be modified on the fly to make up for lacking functionality.
Also see app.map.crop().

Now works with all maps in both Red and Crystal.

The version defaults to Crystal. To use with pokered, invoke from the command line:
	python extras/pokemontools/map_editor.py red

Or in ipython:
	import extras.pokemontools.map_editor as ed
	app = ed.init(version='red')

Also displays connections, but they're unaligned.
2014-10-02 23:22:03 -04:00
yenatch
82b78e5c79 BSSReader now reads constants and variables.
This lets the map editor do cool things.
2014-10-02 23:21:54 -04:00
Bryan Bishop
c3da5178f5 Merge pull request #82 from yenatch/master
Rewrite scan_includes.py. Add include paths.
2014-09-24 15:26:59 -05:00
yenatch
31f843814c Add docstrings for IncludeReader methods. 2014-09-24 12:54:44 -07:00
yenatch
c9e7f22f8f Rewrite scan_includes.py. Add include paths. 2014-09-24 12:07:21 -07:00
Bryan Bishop
a87f66964c Merge pull request #81 from yenatch/master
Event commands "name" and "trainerclassname" take another argument.
2014-07-23 00:31:46 -05:00
yenatch
702f1f1102 Event commands "name" and "trainerclassname" take another argument. 2014-07-22 22:24:23 -07:00
Bryan Bishop
e0bbcbce7a Merge pull request #80 from yenatch/master
loadwilddata takes 3 params, and fix engine flag parsing.
2014-07-22 23:44:39 -05:00
yenatch
b639b0d3bf Merge remote-tracking branch 'kanzure/master' 2014-07-22 21:25:00 -07:00
yenatch
fb0029a78c Event command loadwilddata takes a third argument. 2014-07-22 21:24:08 -07:00
yenatch
9c7bce4ce7 The checkflag command family uses engine flags. 2014-07-22 21:22:20 -07:00
Bryan Bishop
3f27ebff7c Merge pull request #79 from dannye/master
Update Red music commands
2014-06-24 20:16:19 -05:00
yenatch
007151b05a gfx: Let .wxh filename arguments exceed 9.
Nothing needs this yet, but chances are it'll happen.
2014-06-15 16:27:46 -07:00
U-Fish-PC\Daniel
47a56912ea Update Red music commands 2014-06-10 12:36:51 -04:00
Bryan Bishop
10fb7465e4 Merge pull request #78 from yenatch/master
Refactor gfx.py with bytearrays, fix graphics dumps, rewrite the compressor.
2014-06-02 20:54:20 -05:00
yenatch
73aaa4a570 Merge remote-tracking branch 'yenatch/master'
Conflicts:
	pokemontools/gfx.py
2014-06-02 17:59:49 -07:00
yenatch
b07f9c7f76 Rewrite the lz compressor. 2014-06-02 17:57:43 -07:00
yenatch
20c718fbfd gfx.py: Forgot to add rom_offset. 2014-05-03 23:14:43 -04:00
yenatch
df7acdb50f Refactor gfx.py to use bytearrays. Fix some graphics dumping functions. 2014-05-02 19:52:24 -04:00
Bryan Bishop
c2c45d61eb Merge pull request #74 from yenatch/master
Transpose images by height from 2bpp to png and width from png to 2bpp.
2014-04-28 18:42:30 -05:00
Bryan Bishop
b52ee5629b Merge pull request #75 from mintpeter/master
Make extract_maps.py Python 3 compatible
2014-04-28 14:54:47 -05:00
Zack Marvel
c70144ddb8 Add import to extract_maps.py for print_function 2014-04-28 15:50:35 -04:00
Zack Marvel
4d168d0535 Change print statements in extract_maps.py for Python 3 compatibility 2014-04-28 15:31:44 -04:00
yenatch
9007b587a3 Transpose images by height from 2bpp to png and width from png to 2bpp.
Transposing non-square images would work over the expected width, rather than the current width (the expected height). This never came up since transposed images are typically square.
2014-04-19 02:54:21 -04:00
yenatch
698b0fc7e6 gfx: Don't try to load baserom.gbc unless it's actually being used.
This prevented pokered from building if the file "baserom.gbc" did not exist.
2014-04-16 01:37:48 -04:00
Bryan Bishop
1840111de5 Merge pull request #72 from yenatch/pics
pokered: pic de/compression.
2014-04-14 23:28:22 -05:00
yenatch
ac2df6b844 gfx: Decompress graphics that can be converted to png.
Before, converting a .2bpp.lz file required calling decompress and convert_to_png
on the compressed and decompressed files respectively.

gfx.py unlz {}.lz
gfx.py png {}

Putting a .lz file into convert_to_png would raise an exception.

Instead, passing compressed graphics into convert_to_png will decompress them first.
This skips the (now optional) manual decompress step.
2014-04-15 00:17:25 -04:00
yenatch
69f622a171 gfx: Transpose blocks of images instead of only the first block.
This allows transposed images to be grouped together (e.g. animations).
2014-04-15 00:06:05 -04:00
yenatch
345c792b69 Clearer explanation for porting https://github.com/magical/pokemon-sprites-rby to python 2.7. 2014-04-14 14:24:05 -04:00
yenatch
c9b6df3193 Optimize pic compression to be 50% faster. 2014-04-06 19:37:23 -04:00