Ignore num_tiles if it would truncate non-transparent tiles (#1729)

This commit is contained in:
Martin Griffin 2022-08-19 04:07:25 +01:00 committed by GitHub
parent 936ebbd973
commit 5e593a62fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 154 additions and 119 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 719 B

View File

@ -64,31 +64,31 @@ $(CASTFORMGFXDIR)/shiny.gbapal: $(CASTFORMGFXDIR)/shiny_normal_form.gbapal \
### Tilesets ###
$(TILESETGFXDIR)/secondary/petalburg/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 159
$(GFX) $< $@ -num_tiles 159 -Wnum_tiles
$(TILESETGFXDIR)/secondary/rustboro/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 498
$(GFX) $< $@ -num_tiles 498 -Wnum_tiles
$(TILESETGFXDIR)/secondary/dewford/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 503
$(GFX) $< $@ -num_tiles 503 -Wnum_tiles
$(TILESETGFXDIR)/secondary/slateport/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 504
$(GFX) $< $@ -num_tiles 504 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mauville/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 503
$(GFX) $< $@ -num_tiles 503 -Wnum_tiles
$(TILESETGFXDIR)/secondary/lavaridge/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 450
$(GFX) $< $@ -num_tiles 450 -Wnum_tiles
$(TILESETGFXDIR)/secondary/fortree/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 493
$(GFX) $< $@ -num_tiles 493 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pacifidlog/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 504
$(GFX) $< $@ -num_tiles 504 -Wnum_tiles
$(TILESETGFXDIR)/secondary/sootopolis/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 328
$(GFX) $< $@ -num_tiles 328 -Wnum_tiles
SOOTOPOLISANIMDIR := $(TILESETGFXDIR)/secondary/sootopolis/anim
@ -125,169 +125,169 @@ $(SOOTOPOLISANIMDIR)/stormy_water/7.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/7_ky
@cat $^ >$@
$(TILESETGFXDIR)/secondary/battle_frontier_outside_west/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 508
$(GFX) $< $@ -num_tiles 508 -Wnum_tiles
$(TILESETGFXDIR)/secondary/battle_frontier_outside_east/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 508
$(GFX) $< $@ -num_tiles 508 -Wnum_tiles
$(TILESETGFXDIR)/primary/building/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 502
$(GFX) $< $@ -num_tiles 502 -Wnum_tiles
$(TILESETGFXDIR)/secondary/shop/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 502
$(GFX) $< $@ -num_tiles 502 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pokemon_center/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 478
$(GFX) $< $@ -num_tiles 478 -Wnum_tiles
$(TILESETGFXDIR)/secondary/cave/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 425
$(GFX) $< $@ -num_tiles 425 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pokemon_school/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 278
$(GFX) $< $@ -num_tiles 278 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pokemon_fan_club/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 319
$(GFX) $< $@ -num_tiles 319 -Wnum_tiles
$(TILESETGFXDIR)/secondary/unused_1/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 17
$(GFX) $< $@ -num_tiles 17 -Wnum_tiles
$(TILESETGFXDIR)/secondary/meteor_falls/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 460
$(GFX) $< $@ -num_tiles 460 -Wnum_tiles
$(TILESETGFXDIR)/secondary/oceanic_museum/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 319
$(GFX) $< $@ -num_tiles 319 -Wnum_tiles
$(TILESETGFXDIR)/secondary/cable_club/unknown_tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 120
$(GFX) $< $@ -num_tiles 120 -Wnum_tiles
$(TILESETGFXDIR)/secondary/seashore_house/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 312
$(GFX) $< $@ -num_tiles 312 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pretty_petal_flower_shop/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 345
$(GFX) $< $@ -num_tiles 345 -Wnum_tiles
$(TILESETGFXDIR)/secondary/pokemon_day_care/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 355
$(GFX) $< $@ -num_tiles 355 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/brown_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/brown_cave/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/tree/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/tree/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/shrub/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/shrub/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/blue_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/blue_cave/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/yellow_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/yellow_cave/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/red_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/red_cave/tiles.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/brown_cave/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/tree/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/shrub/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/blue_cave/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/yellow_cave/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/secret_base/red_cave/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 83
$(GFX) $< $@ -num_tiles 83 -Wnum_tiles
$(TILESETGFXDIR)/secondary/inside_of_truck/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 62
$(GFX) $< $@ -num_tiles 62 -Wnum_tiles
$(TILESETGFXDIR)/secondary/contest/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 430
$(GFX) $< $@ -num_tiles 430 -Wnum_tiles
$(TILESETGFXDIR)/secondary/lilycove_museum/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 431
$(GFX) $< $@ -num_tiles 431 -Wnum_tiles
$(TILESETGFXDIR)/secondary/lab/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 500
$(GFX) $< $@ -num_tiles 500 -Wnum_tiles
$(TILESETGFXDIR)/secondary/underwater/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 500
$(GFX) $< $@ -num_tiles 500 -Wnum_tiles
$(TILESETGFXDIR)/secondary/generic_building/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 509
$(GFX) $< $@ -num_tiles 509 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mauville_game_corner/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 469
$(GFX) $< $@ -num_tiles 469 -Wnum_tiles
$(TILESETGFXDIR)/secondary/unused_2/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 150
$(GFX) $< $@ -num_tiles 150 -Wnum_tiles
$(TILESETGFXDIR)/secondary/rustboro_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 60
$(GFX) $< $@ -num_tiles 60 -Wnum_tiles
$(TILESETGFXDIR)/secondary/dewford_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 61
$(GFX) $< $@ -num_tiles 61 -Wnum_tiles
$(TILESETGFXDIR)/secondary/lavaridge_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 54
$(GFX) $< $@ -num_tiles 54 -Wnum_tiles
$(TILESETGFXDIR)/secondary/petalburg_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 148
$(GFX) $< $@ -num_tiles 148 -Wnum_tiles
$(TILESETGFXDIR)/secondary/fortree_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 61
$(GFX) $< $@ -num_tiles 61 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mossdeep_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 82
$(GFX) $< $@ -num_tiles 82 -Wnum_tiles
$(TILESETGFXDIR)/secondary/sootopolis_gym/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 484
$(GFX) $< $@ -num_tiles 484 -Wnum_tiles
$(TILESETGFXDIR)/secondary/trick_house_puzzle/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 294
$(GFX) $< $@ -num_tiles 294 -Wnum_tiles
$(TILESETGFXDIR)/secondary/inside_ship/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 342
$(GFX) $< $@ -num_tiles 342 -Wnum_tiles
$(TILESETGFXDIR)/secondary/elite_four/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 505
$(GFX) $< $@ -num_tiles 505 -Wnum_tiles
$(TILESETGFXDIR)/secondary/battle_frontier/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 310
$(GFX) $< $@ -num_tiles 310 -Wnum_tiles
$(TILESETGFXDIR)/secondary/battle_factory/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 424
$(GFX) $< $@ -num_tiles 424 -Wnum_tiles
$(TILESETGFXDIR)/secondary/battle_pike/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 382
$(GFX) $< $@ -num_tiles 382 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mirage_tower/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 420
$(GFX) $< $@ -num_tiles 420 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mossdeep_game_corner/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 95
$(GFX) $< $@ -num_tiles 95 -Wnum_tiles
$(TILESETGFXDIR)/secondary/island_harbor/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 503
$(GFX) $< $@ -num_tiles 503 -Wnum_tiles
$(TILESETGFXDIR)/secondary/trainer_hill/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 374
$(GFX) $< $@ -num_tiles 374 -Wnum_tiles
$(TILESETGFXDIR)/secondary/navel_rock/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 420
$(GFX) $< $@ -num_tiles 420 -Wnum_tiles
$(TILESETGFXDIR)/secondary/battle_frontier_ranking_hall/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 136
$(GFX) $< $@ -num_tiles 136 -Wnum_tiles
$(TILESETGFXDIR)/secondary/mystery_events_house/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 509
$(GFX) $< $@ -num_tiles 509 -Wnum_tiles
@ -335,13 +335,13 @@ graphics/title_screen/pokemon_logo.gbapal: %.gbapal: %.pal
$(GFX) $< $@ -num_colors 224
graphics/pokemon_jump/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 63
$(GFX) $< $@ -num_tiles 63 -Wnum_tiles
graphics/pokenav/region_map.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 233
$(GFX) $< $@ -num_tiles 233 -Wnum_tiles
$(MISCGFXDIR)/japanese_hof.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 29
$(GFX) $< $@ -num_tiles 29 -Wnum_tiles
$(BATINTGFXDIR)/textbox.gbapal: $(BATINTGFXDIR)/textbox_0.gbapal \
$(BATINTGFXDIR)/textbox_1.gbapal
@ -385,10 +385,10 @@ $(UNUSEDGFXDIR)/redyellowgreen_frame.bin: $(UNUSEDGFXDIR)/red_frame.bin \
@cat $^ >$@
$(UNUSEDGFXDIR)/color_frames.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 353
$(GFX) $< $@ -num_tiles 353 -Wnum_tiles
$(BATINTGFXDIR)/unused_window2bar.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 5
$(GFX) $< $@ -num_tiles 5 -Wnum_tiles
$(JPCONTESTGFXDIR)/composite_1.4bpp: $(JPCONTESTGFXDIR)/frame_1.4bpp \
$(JPCONTESTGFXDIR)/floor.4bpp \
@ -404,7 +404,7 @@ $(JPCONTESTGFXDIR)/composite_2.4bpp: $(JPCONTESTGFXDIR)/interface.4bpp \
@cat $^ >$@
$(JPCONTESTGFXDIR)/voltage.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 36
$(GFX) $< $@ -num_tiles 36 -Wnum_tiles
$(BTLANMSPRGFXDIR)/ice_crystals.4bpp: $(BTLANMSPRGFXDIR)/ice_crystals_0.4bpp \
$(BTLANMSPRGFXDIR)/ice_crystals_1.4bpp \
@ -426,13 +426,13 @@ $(BTLANMSPRGFXDIR)/spark.4bpp: $(BTLANMSPRGFXDIR)/spark_0.4bpp \
@cat $^ >$@
$(MASKSGFXDIR)/unused_level_up.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 14
$(GFX) $< $@ -num_tiles 14 -Wnum_tiles
$(BATTRANSGFXDIR)/vs_frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 16
$(GFX) $< $@ -num_tiles 16 -Wnum_tiles
graphics/party_menu/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 62
$(GFX) $< $@ -num_tiles 62 -Wnum_tiles
$(TYPESGFXDIR)/move_types.4bpp: $(types:%=$(TYPESGFXDIR)/%.4bpp) $(contest_types:%=$(TYPESGFXDIR)/contest_%.4bpp)
@cat $^ >$@
@ -443,29 +443,29 @@ $(TYPESGFXDIR)/move_types.gbapal: $(TYPESGFXDIR)/move_types_1.gbapal \
@cat $^ >$@
graphics/bag/menu.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 53
$(GFX) $< $@ -num_tiles 53 -Wnum_tiles
$(RAYQUAZAGFXDIR)/scene_2/rayquaza.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 227
$(GFX) $< $@ -num_tiles 227 -Wnum_tiles
$(RAYQUAZAGFXDIR)/scene_2/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 313
$(GFX) $< $@ -num_tiles 313 -Wnum_tiles
$(RAYQUAZAGFXDIR)/scene_3/rayquaza.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 124
$(GFX) $< $@ -num_tiles 124 -Wnum_tiles
$(RAYQUAZAGFXDIR)/scene_3/rayquaza_tail_fix.4bpp: $(RAYQUAZAGFXDIR)/scene_3/rayquaza_tail.4bpp
cp $< $@
head -c 12 /dev/zero >> $@
$(RAYQUAZAGFXDIR)/scene_4/streaks.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 19
$(GFX) $< $@ -num_tiles 19 -Wnum_tiles
$(RAYQUAZAGFXDIR)/scene_4/rayquaza.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 155
$(GFX) $< $@ -num_tiles 155 -Wnum_tiles
graphics/picture_frame/lobby.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 86
$(GFX) $< $@ -num_tiles 86 -Wnum_tiles
$(ROULETTEGFXDIR)/roulette_tilt.4bpp: $(ROULETTEGFXDIR)/shroomish.4bpp \
$(ROULETTEGFXDIR)/tailow.4bpp
@ -478,10 +478,10 @@ $(ROULETTEGFXDIR)/wheel_icons.4bpp: $(ROULETTEGFXDIR)/wynaut.4bpp \
@cat $^ >$@
$(BATTRANSGFXDIR)/regis.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 53
$(GFX) $< $@ -num_tiles 53 -Wnum_tiles
$(BATTRANSGFXDIR)/rayquaza.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 938
$(GFX) $< $@ -num_tiles 938 -Wnum_tiles
$(BATTRANSGFXDIR)/frontier_square_1.4bpp: $(BATTRANSGFXDIR)/frontier_squares_blanktiles.4bpp \
$(BATTRANSGFXDIR)/frontier_squares_1.4bpp
@ -504,20 +504,20 @@ $(SLOTMACHINEGFXDIR)/reel_time_gfx.4bpp: $(SLOTMACHINEGFXDIR)/reel_time_pikachu.
@cat $^ >$@
graphics/birch_speech/unused_beauty.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 822
$(GFX) $< $@ -num_tiles 822 -Wnum_tiles
### Pokémon Storage System ###
$(WALLPAPERGFXDIR)/forest/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 55
$(GFX) $< $@ -num_tiles 55 -Wnum_tiles
$(WALLPAPERGFXDIR)/forest/tiles.4bpp: $(WALLPAPERGFXDIR)/forest/frame.4bpp $(WALLPAPERGFXDIR)/forest/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/city/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 52
$(GFX) $< $@ -num_tiles 52 -Wnum_tiles
$(WALLPAPERGFXDIR)/city/tiles.4bpp: $(WALLPAPERGFXDIR)/city/frame.4bpp $(WALLPAPERGFXDIR)/city/bg.4bpp
@cat $^ >$@
@ -526,97 +526,97 @@ $(WALLPAPERGFXDIR)/desert/tiles.4bpp: $(WALLPAPERGFXDIR)/desert/frame.4bpp $(WAL
@cat $^ >$@
$(WALLPAPERGFXDIR)/savanna/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 45
$(GFX) $< $@ -num_tiles 45 -Wnum_tiles
$(WALLPAPERGFXDIR)/savanna/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 23
$(GFX) $< $@ -num_tiles 23 -Wnum_tiles
$(WALLPAPERGFXDIR)/savanna/tiles.4bpp: $(WALLPAPERGFXDIR)/savanna/frame.4bpp $(WALLPAPERGFXDIR)/savanna/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/crag/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 49
$(GFX) $< $@ -num_tiles 49 -Wnum_tiles
$(WALLPAPERGFXDIR)/crag/tiles.4bpp: $(WALLPAPERGFXDIR)/crag/frame.4bpp $(WALLPAPERGFXDIR)/crag/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/volcano/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 56
$(GFX) $< $@ -num_tiles 56 -Wnum_tiles
$(WALLPAPERGFXDIR)/volcano/tiles.4bpp: $(WALLPAPERGFXDIR)/volcano/frame.4bpp $(WALLPAPERGFXDIR)/volcano/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/snow/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 57
$(GFX) $< $@ -num_tiles 57 -Wnum_tiles
$(WALLPAPERGFXDIR)/snow/tiles.4bpp: $(WALLPAPERGFXDIR)/snow/frame.4bpp $(WALLPAPERGFXDIR)/snow/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/cave/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 55
$(GFX) $< $@ -num_tiles 55 -Wnum_tiles
$(WALLPAPERGFXDIR)/cave/tiles.4bpp: $(WALLPAPERGFXDIR)/cave/frame.4bpp $(WALLPAPERGFXDIR)/cave/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/beach/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 46
$(GFX) $< $@ -num_tiles 46 -Wnum_tiles
$(WALLPAPERGFXDIR)/beach/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 23
$(GFX) $< $@ -num_tiles 23 -Wnum_tiles
$(WALLPAPERGFXDIR)/beach/tiles.4bpp: $(WALLPAPERGFXDIR)/beach/frame.4bpp $(WALLPAPERGFXDIR)/beach/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/seafloor/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 54
$(GFX) $< $@ -num_tiles 54 -Wnum_tiles
$(WALLPAPERGFXDIR)/seafloor/tiles.4bpp: $(WALLPAPERGFXDIR)/seafloor/frame.4bpp $(WALLPAPERGFXDIR)/seafloor/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/river/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 51
$(GFX) $< $@ -num_tiles 51 -Wnum_tiles
$(WALLPAPERGFXDIR)/river/bg.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 11
$(GFX) $< $@ -num_tiles 11 -Wnum_tiles
$(WALLPAPERGFXDIR)/river/tiles.4bpp: $(WALLPAPERGFXDIR)/river/frame.4bpp $(WALLPAPERGFXDIR)/river/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/sky/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 45
$(GFX) $< $@ -num_tiles 45 -Wnum_tiles
$(WALLPAPERGFXDIR)/sky/tiles.4bpp: $(WALLPAPERGFXDIR)/sky/frame.4bpp $(WALLPAPERGFXDIR)/sky/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/polkadot/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 54
$(GFX) $< $@ -num_tiles 54 -Wnum_tiles
$(WALLPAPERGFXDIR)/polkadot/tiles.4bpp: $(WALLPAPERGFXDIR)/polkadot/frame.4bpp $(WALLPAPERGFXDIR)/polkadot/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/pokecenter/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 35
$(GFX) $< $@ -num_tiles 35 -Wnum_tiles
$(WALLPAPERGFXDIR)/pokecenter/tiles.4bpp: $(WALLPAPERGFXDIR)/pokecenter/frame.4bpp $(WALLPAPERGFXDIR)/pokecenter/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/machine/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 33
$(GFX) $< $@ -num_tiles 33 -Wnum_tiles
$(WALLPAPERGFXDIR)/machine/tiles.4bpp: $(WALLPAPERGFXDIR)/machine/frame.4bpp $(WALLPAPERGFXDIR)/machine/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/plain/frame.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 18
$(GFX) $< $@ -num_tiles 18 -Wnum_tiles
$(WALLPAPERGFXDIR)/plain/tiles.4bpp: $(WALLPAPERGFXDIR)/plain/frame.4bpp $(WALLPAPERGFXDIR)/plain/bg.4bpp
@cat $^ >$@
$(WALLPAPERGFXDIR)/friends_frame1.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 57
$(GFX) $< $@ -num_tiles 57 -Wnum_tiles
$(WALLPAPERGFXDIR)/friends_frame2.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 57
$(GFX) $< $@ -num_tiles 57 -Wnum_tiles
$(WALLPAPERGFXDIR)/zigzagoon/tiles.4bpp: $(WALLPAPERGFXDIR)/friends_frame1.4bpp $(WALLPAPERGFXDIR)/zigzagoon/bg.4bpp
@cat $^ >$@
@ -667,13 +667,13 @@ $(WALLPAPERGFXDIR)/whiscash/tiles.4bpp: $(WALLPAPERGFXDIR)/friends_frame2.4bpp $
@cat $^ >$@
$(OBJEVENTGFXDIR)/pics/effects/unknown_4F6D38/0.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 11
$(GFX) $< $@ -num_tiles 11 -Wnum_tiles
$(INTERFACEGFXDIR)/selector_outline.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 8
$(GFX) $< $@ -num_tiles 8 -Wnum_tiles
$(BATTRANSGFXDIR)/frontier_logo_center.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 43
$(GFX) $< $@ -num_tiles 43 -Wnum_tiles
@ -695,19 +695,19 @@ $(PKNAVOPTIONSGFXDIR)/options.4bpp: $(PKNAVOPTIONSGFXDIR)/hoenn_map.4bpp \
@cat $^ >$@
$(PKNAVGFXDIR)/header.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 53
$(GFX) $< $@ -num_tiles 53 -Wnum_tiles
$(PKNAVGFXDIR)/device_outline.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 53
$(GFX) $< $@ -num_tiles 53 -Wnum_tiles
$(PKNAVGFXDIR)/match_call/ui.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 13
$(GFX) $< $@ -num_tiles 13 -Wnum_tiles
$(POKEDEXGFXDIR)/region_map.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 232
$(GFX) $< $@ -num_tiles 232 -Wnum_tiles
$(POKEDEXGFXDIR)/region_map_affine.8bpp: %.8bpp: %.png
$(GFX) $< $@ -num_tiles 233
$(GFX) $< $@ -num_tiles 233 -Wnum_tiles
$(STARTERGFXDIR)/birch_help.4bpp: $(STARTERGFXDIR)/birch_bag.4bpp $(STARTERGFXDIR)/birch_grass.4bpp
@cat $^ >$@

View File

@ -397,7 +397,7 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int
free(buffer);
}
void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors)
{
int tileSize = bitDepth * 8;
@ -424,7 +424,8 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
FATAL_ERROR("The specified number of tiles (%d) is greater than the maximum possible value (%d).\n", numTiles, maxNumTiles);
int bufferSize = numTiles * tileSize;
unsigned char *buffer = malloc(bufferSize);
int maxBufferSize = maxNumTiles * tileSize;
unsigned char *buffer = malloc(maxBufferSize);
if (buffer == NULL)
FATAL_ERROR("Failed to allocate memory for pixels.\n");
@ -433,17 +434,36 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m
switch (bitDepth) {
case 1:
ConvertToTiles1Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles1Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
case 4:
ConvertToTiles4Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles4Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
case 8:
ConvertToTiles8Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
ConvertToTiles8Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors);
break;
}
WriteWholeFile(path, buffer, bufferSize);
bool zeroPadded = true;
for (int i = bufferSize; i < maxBufferSize && zeroPadded; i++) {
if (buffer[i] != 0)
{
switch (numTilesMode)
{
case NUM_TILES_IGNORE:
break;
case NUM_TILES_WARN:
fprintf(stderr, "Ignoring -num_tiles %d because tile %d contains non-transparent pixels.\n", numTiles, 1 + i / tileSize);
zeroPadded = false;
break;
case NUM_TILES_ERROR:
FATAL_ERROR("Tile %d contains non-transparent pixels.\n", 1 + i / tileSize);
break;
}
}
}
WriteWholeFile(path, buffer, zeroPadded ? bufferSize : maxBufferSize);
free(buffer);
}

View File

@ -44,8 +44,14 @@ struct Image {
bool isAffine;
};
enum NumTilesMode {
NUM_TILES_IGNORE,
NUM_TILES_WARN,
NUM_TILES_ERROR,
};
void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors);
void FreeImage(struct Image *image);
void ReadGbaPalette(char *path, struct Palette *palette);
void WriteGbaPalette(char *path, struct Palette *palette);

View File

@ -77,7 +77,7 @@ void ConvertPngToGba(char *inputPath, char *outputPath, struct PngToGbaOptions *
ReadPng(inputPath, &image);
WriteImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
WriteImage(outputPath, options->numTilesMode, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette);
FreeImage(&image);
}
@ -179,6 +179,7 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
char *outputFileExtension = GetFileExtensionAfterDot(outputPath);
int bitDepth = outputFileExtension[0] - '0';
struct PngToGbaOptions options;
options.numTilesMode = NUM_TILES_IGNORE;
options.numTiles = 0;
options.bitDepth = bitDepth;
options.metatileWidth = 1;
@ -203,6 +204,12 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a
if (options.numTiles < 1)
FATAL_ERROR("Number of tiles must be positive.\n");
}
else if (strcmp(option, "-Wnum_tiles") == 0) {
options.numTilesMode = NUM_TILES_WARN;
}
else if (strcmp(option, "-Werror=num_tiles") == 0) {
options.numTilesMode = NUM_TILES_ERROR;
}
else if (strcmp(option, "-mwidth") == 0)
{
if (i + 1 >= argc)

View File

@ -4,6 +4,7 @@
#define OPTIONS_H
#include <stdbool.h>
#include "gfx.h"
struct GbaToPngOptions {
char *paletteFilePath;
@ -18,6 +19,7 @@ struct GbaToPngOptions {
struct PngToGbaOptions {
int numTiles;
enum NumTilesMode numTilesMode;
int bitDepth;
int metatileWidth;
int metatileHeight;