Skip to content

Commit

Permalink
Image asset rework (#1141)
Browse files Browse the repository at this point in the history
* poc

* A bit

* 19 files to go

* ique fixed this took me hours omg

* 4 more

* dead vines

* fixules

* drop .bin from needed macro
  • Loading branch information
ethteck authored Jan 7, 2024
1 parent f152efa commit 6da232d
Show file tree
Hide file tree
Showing 229 changed files with 2,198 additions and 1,730 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@
"black-formatter.args": [
"-l 120"
],
"search.useIgnoreFiles": false,
}
32 changes: 32 additions & 0 deletions include/include_asset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef _H_INCLUDE_ASSET

#define ASTRINGIFY_(x) #x
#define ASTRINGIFY(x) ASTRINGIFY_(x)

#define _INCLUDE_IMG(FILENAME, SYMBOLNAME) \
extern unsigned char SYMBOLNAME[]; \
__asm__( \
".globl " #SYMBOLNAME"\n" \
".data\n" \
".align 2\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
)

// two macros are needed for N() usage
#define INCLUDE_IMG(FILENAME, SYMBOLNAME) \
_INCLUDE_IMG(FILENAME, SYMBOLNAME)

#define INCLUDE_PAL(FILENAME, SYMBOLNAME) \
extern unsigned short SYMBOLNAME[]; \
__asm__( \
".globl " #SYMBOLNAME"\n" \
".data\n" \
".align 2\n" \
".type " #SYMBOLNAME", @object\n" \
#SYMBOLNAME":\n" \
".incbin \"ver/"ASTRINGIFY(VERSION)"/build/" FILENAME ".bin\"\n" \
)

#endif // _H_INCLUDE_ASSET
3 changes: 2 additions & 1 deletion src/8a160_len_700.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "common.h"
#include "include_asset.h"

#include "A2960.png.inc.c"
INCLUDE_IMG("A2960.png", D_801094B0);

Vp D_801096B0 = {
.vp = {
Expand Down
33 changes: 17 additions & 16 deletions src/battle/action_cmd/water_block.c
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
#include "common.h"
#include "battle/action_cmd.h"
#include "include_asset.h"

#define NAMESPACE action_command_water_block

#include "battle/action_cmd/water_block_1.png.inc.c"
#include "battle/action_cmd/water_block_1.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_1.png", battle_action_cmd_water_block_1_png);
INCLUDE_PAL("battle/action_cmd/water_block_1.pal", battle_action_cmd_water_block_1_pal);

#include "battle/action_cmd/water_block_2.png.inc.c"
#include "battle/action_cmd/water_block_2.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_2.png", battle_action_cmd_water_block_2_png);
INCLUDE_PAL("battle/action_cmd/water_block_2.pal", battle_action_cmd_water_block_2_pal);

#include "battle/action_cmd/water_block_3.png.inc.c"
#include "battle/action_cmd/water_block_3.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_3.png", battle_action_cmd_water_block_3_png);
INCLUDE_PAL("battle/action_cmd/water_block_3.pal", battle_action_cmd_water_block_3_pal);

#include "battle/action_cmd/water_block_0.png.inc.c"
#include "battle/action_cmd/water_block_0.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_0.png", battle_action_cmd_water_block_0_png);
INCLUDE_PAL("battle/action_cmd/water_block_0.pal", battle_action_cmd_water_block_0_pal);

#include "battle/action_cmd/water_block_block.png.inc.c"
#include "battle/action_cmd/water_block_block.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_block.png", battle_action_cmd_water_block_block_png);
INCLUDE_PAL("battle/action_cmd/water_block_block.pal", battle_action_cmd_water_block_block_pal);

#include "battle/action_cmd/water_block_circle.png.inc.c"
#include "battle/action_cmd/water_block_circle.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_circle.png", battle_action_cmd_water_block_circle_png);
INCLUDE_PAL("battle/action_cmd/water_block_circle.pal", battle_action_cmd_water_block_circle_pal);

#include "battle/action_cmd/water_block_cloud.png.inc.c"
#include "battle/action_cmd/water_block_cloud.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_cloud.png", battle_action_cmd_water_block_cloud_png);
INCLUDE_PAL("battle/action_cmd/water_block_cloud.pal", battle_action_cmd_water_block_cloud_pal);

#include "battle/action_cmd/water_block_4.png.inc.c"
#include "battle/action_cmd/water_block_4.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/water_block_4.png", battle_action_cmd_water_block_4_png);
INCLUDE_PAL("battle/action_cmd/water_block_4.pal", battle_action_cmd_water_block_4_pal);

HudScript HES_WaterBlock1 = {
HUD_ELEMENT_OP_SetVisible,
Expand Down
33 changes: 17 additions & 16 deletions src/battle/action_cmd/whirlwind.c
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
#include "common.h"
#include "battle/action_cmd.h"
#include "battle/action_cmd/whirlwind_bubble.png.h"
#include "include_asset.h"

#define NAMESPACE action_command_whirlwind

#include "battle/action_cmd/whirlwind_1.png.inc.c"
#include "battle/action_cmd/whirlwind_1.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_1.png", battle_action_cmd_whirlwind_1_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_1.pal", battle_action_cmd_whirlwind_1_pal);

#include "battle/action_cmd/whirlwind_2.png.inc.c"
#include "battle/action_cmd/whirlwind_2.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_2.png", battle_action_cmd_whirlwind_2_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_2.pal", battle_action_cmd_whirlwind_2_pal);

#include "battle/action_cmd/whirlwind_3.png.inc.c"
#include "battle/action_cmd/whirlwind_3.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_3.png", battle_action_cmd_whirlwind_3_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_3.pal", battle_action_cmd_whirlwind_3_pal);

#include "battle/action_cmd/whirlwind_4.png.inc.c"
#include "battle/action_cmd/whirlwind_4.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_4.png", battle_action_cmd_whirlwind_4_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_4.pal", battle_action_cmd_whirlwind_4_pal);

#include "battle/action_cmd/whirlwind_5.png.inc.c"
#include "battle/action_cmd/whirlwind_5.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_5.png", battle_action_cmd_whirlwind_5_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_5.pal", battle_action_cmd_whirlwind_5_pal);

#include "battle/action_cmd/whirlwind_6.png.inc.c"
#include "battle/action_cmd/whirlwind_6.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_6.png", battle_action_cmd_whirlwind_6_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_6.pal", battle_action_cmd_whirlwind_6_pal);

#include "battle/action_cmd/whirlwind_7.png.inc.c"
#include "battle/action_cmd/whirlwind_7.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_7.png", battle_action_cmd_whirlwind_7_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_7.pal", battle_action_cmd_whirlwind_7_pal);

#include "battle/action_cmd/whirlwind_bubble.png.inc.c"
#include "battle/action_cmd/whirlwind_bubble.pal.inc.c"
INCLUDE_IMG("battle/action_cmd/whirlwind_bubble.png", battle_action_cmd_whirlwind_bubble_png);
INCLUDE_PAL("battle/action_cmd/whirlwind_bubble.pal", battle_action_cmd_whirlwind_bubble_pal);

HudScript HES_Whirlwind1 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_1, 24, 24);

Expand Down
5 changes: 3 additions & 2 deletions src/battle/area/kzn2/actor/lava_piranha.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "ld_addrs.h"
#include "boss_common.h"
#include "mapfs/kzn_bt05_shape.h"
#include "include_asset.h"

#define NAMESPACE A(lava_piranha)

Expand Down Expand Up @@ -104,8 +105,8 @@ EntityModelScript N(ModelScript4) = {
ems_End
};

#include "battle/area/kzn2/lava_piranha_vine.png.inc.c"
#include "battle/area/kzn2/lava_piranha_vine.pal.inc.c"
INCLUDE_IMG("battle/area/kzn2/lava_piranha_vine.png", D_8021C940_5A3020);
INCLUDE_PAL("battle/area/kzn2/lava_piranha_vine.pal", D_8021CD40_5A3420);
#include "battle/area/kzn2/lava_piranha_vine.gfx.inc.c"

extern EvtScript N(EVS_Init);
Expand Down
5 changes: 3 additions & 2 deletions src/battle/area/sam2/actor/monstar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "sprite.h"
#include "sprite/npc/Monstar.h"
#include "battle/area/sam2/actor/img.png.h"
#include "include_asset.h"

#define NAMESPACE A(monstar)

Expand Down Expand Up @@ -143,8 +144,8 @@ EvtScript N(EVS_Init) = {
EVT_END
};

#include "battle/area/sam2/actor/img.png.inc.c"
#include "battle/area/sam2/actor/img.pal.inc.c"
INCLUDE_IMG("battle/area/sam2/actor/img.png", battle_area_sam2_actor_img_png);
INCLUDE_PAL("battle/area/sam2/actor/img.pal", battle_area_sam2_actor_img_pal);

ImgFXOverlayTexture N(MonstarDetailTexture) = {
.raster = battle_area_sam2_actor_img_png,
Expand Down
5 changes: 3 additions & 2 deletions src/battle/entity_model_icons.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include "common.h"
#include "entity.h"
#include "include_asset.h"

extern IMG_BIN ui_battle_menu_spirits_png[];
extern PAL_BIN ui_battle_menu_spirits_pal[];
extern IMG_BIN ui_battle_solid_star_png[];
extern PAL_BIN ui_battle_solid_star_pal[];

#include "ui/battle/cursor_hand.png.inc.c"
#include "ui/battle/cursor_hand.pal.inc.c"
INCLUDE_IMG("ui/battle/cursor_hand.png", ui_battle_cursor_hand_png);
INCLUDE_PAL("ui/battle/cursor_hand.pal", ui_battle_cursor_hand_pal);

Vtx BtlCursorModelVtx[] = {
{{{ -22, -6, 0 }, 0, { 1024, 1024 }, { 0, 0, 0, 255 }}},
Expand Down
17 changes: 9 additions & 8 deletions src/battle/move/hammer/hammer_throw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
#include "effects.h"
#include "entity.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_move_hammer_throw

#include "battle/common/move/HammerSupport.inc.c"

static s32 pad_images = 0;

#include "battle/move/hammer/dusty_hammer.png.inc.c"
#include "battle/move/hammer/dusty_hammer.pal.inc.c"
INCLUDE_IMG("battle/move/hammer/dusty_hammer.png", battle_move_hammer_throw_dusty_hammer_png);
INCLUDE_PAL("battle/move/hammer/dusty_hammer.pal", battle_move_hammer_throw_dusty_hammer_pal);

#include "battle/move/hammer/basic_hammer.png.inc.c"
#include "battle/move/hammer/basic_hammer.pal.inc.c"
INCLUDE_IMG("battle/move/hammer/basic_hammer.png", battle_move_hammer_throw_basic_hammer_png);
INCLUDE_PAL("battle/move/hammer/basic_hammer.pal", battle_move_hammer_throw_basic_hammer_pal);

#include "battle/move/hammer/super_hammer.png.inc.c"
#include "battle/move/hammer/super_hammer.pal.inc.c"
INCLUDE_IMG("battle/move/hammer/super_hammer.png", battle_move_hammer_throw_super_hammer_png);
INCLUDE_PAL("battle/move/hammer/super_hammer.pal", battle_move_hammer_throw_super_hammer_pal);

#include "battle/move/hammer/ultra_hammer.png.inc.c"
#include "battle/move/hammer/ultra_hammer.pal.inc.c"
INCLUDE_IMG("battle/move/hammer/ultra_hammer.png", battle_move_hammer_throw_ultra_hammer_png);
INCLUDE_PAL("battle/move/hammer/ultra_hammer.pal", battle_move_hammer_throw_ultra_hammer_pal);

#include "battle/move/hammer/hammer_throw.vtx.inc.c"

Expand Down
5 changes: 3 additions & 2 deletions src/battle/move/item/coconut.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "entity.h"
#include "ld_addrs.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_coconut

Expand All @@ -12,8 +13,8 @@
static s32 _pad = 0;

#include "battle/move/item/coconut.png.h"
#include "battle/move/item/coconut.png.inc.c"
#include "battle/move/item/coconut.pal.inc.c"
INCLUDE_IMG("battle/move/item/coconut.png", battle_item_coconut_png);
INCLUDE_PAL("battle/move/item/coconut.pal", battle_item_coconut_pal);

/// 32x32 square.
Vtx N(model)[] = {
Expand Down
5 changes: 3 additions & 2 deletions src/battle/move/item/dusty_hammer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "entity.h"
#include "ld_addrs.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_dusty_hammer

Expand All @@ -12,8 +13,8 @@
static s32 _pad = 0; // XXX

#include "battle/move/item/dusty_hammer.png.h"
#include "battle/move/item/dusty_hammer.png.inc.c"
#include "battle/move/item/dusty_hammer.pal.inc.c"
INCLUDE_IMG("battle/move/item/dusty_hammer.png", battle_item_dusty_hammer_png);
INCLUDE_PAL("battle/move/item/dusty_hammer.pal", battle_item_dusty_hammer_pal);

Vtx N(DustyHammerVtx)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
Expand Down
17 changes: 9 additions & 8 deletions src/battle/move/item/egg_missile.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "entity.h"
#include "ld_addrs.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_egg_missile

Expand All @@ -26,20 +27,20 @@ API_CALLABLE(N(func_802A123C_71CF1C)) {
static s32 _pad = 0;

#include "battle/move/item/egg_missile1.png.h"
#include "battle/move/item/egg_missile1.png.inc.c"
#include "battle/move/item/egg_missile1.pal.inc.c"
INCLUDE_IMG("battle/move/item/egg_missile1.png", battle_item_egg_missile1_png);
INCLUDE_PAL("battle/move/item/egg_missile1.pal", battle_item_egg_missile1_pal);

#include "battle/move/item/egg_missile2.png.h"
#include "battle/move/item/egg_missile2.png.inc.c"
#include "battle/move/item/egg_missile2.pal.inc.c"
INCLUDE_IMG("battle/move/item/egg_missile2.png", battle_item_egg_missile2_png);
INCLUDE_PAL("battle/move/item/egg_missile2.pal", battle_item_egg_missile2_pal);

#include "battle/move/item/egg_missile3.png.h"
#include "battle/move/item/egg_missile3.png.inc.c"
#include "battle/move/item/egg_missile3.pal.inc.c"
INCLUDE_IMG("battle/move/item/egg_missile3.png", battle_item_egg_missile3_png);
INCLUDE_PAL("battle/move/item/egg_missile3.pal", battle_item_egg_missile3_pal);

#include "battle/move/item/egg_missile4.png.h"
#include "battle/move/item/egg_missile4.png.inc.c"
#include "battle/move/item/egg_missile4.pal.inc.c"
INCLUDE_IMG("battle/move/item/egg_missile4.png", battle_item_egg_missile4_png);
INCLUDE_PAL("battle/move/item/egg_missile4.pal", battle_item_egg_missile4_pal);

Vtx N(EggMissileVtx)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
Expand Down
5 changes: 3 additions & 2 deletions src/battle/move/item/insecticide_herb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "entity.h"
#include "ld_addrs.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_insecticide_herb

Expand Down Expand Up @@ -57,8 +58,8 @@ API_CALLABLE(N(func_802A12E0_72AA30)) {
static s32 _pad = 0; // XXX

#include "battle/move/item/insecticide_herb.png.h"
#include "battle/move/item/insecticide_herb.png.inc.c"
#include "battle/move/item/insecticide_herb.pal.inc.c"
INCLUDE_IMG("battle/move/item/insecticide_herb.png", battle_item_insecticide_herb_png);
INCLUDE_PAL("battle/move/item/insecticide_herb.pal", battle_item_insecticide_herb_pal);

Vtx N(model)[] = {
{ .v = { .ob = {-16, -16, 0}, FALSE, .tc = {0, 0}, .cn = {0, 0, 0, 255} } },
Expand Down
5 changes: 3 additions & 2 deletions src/battle/move/item/mystery.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "effects.h"
#include "entity.h"
#include "ld_addrs.h"
#include "include_asset.h"

#define NAMESPACE battle_item_mystery

Expand All @@ -13,8 +14,8 @@
static s32 _pad = 0;

#include "battle/move/item/mystery.png.h"
#include "battle/move/item/mystery.png.inc.c"
#include "battle/move/item/mystery.pal.inc.c"
INCLUDE_IMG("battle/move/item/mystery.png", battle_item_mystery_png);
INCLUDE_PAL("battle/move/item/mystery.pal", battle_item_mystery_pal);

Vtx N(model)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
Expand Down
5 changes: 3 additions & 2 deletions src/battle/move/item/pebble.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "ld_addrs.h"
#include "entity.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_pebble

Expand All @@ -12,8 +13,8 @@
static s32 _pad = 0;

#include "battle/move/item/pebble.png.h"
#include "battle/move/item/pebble.png.inc.c"
#include "battle/move/item/pebble.pal.inc.c"
INCLUDE_IMG("battle/move/item/pebble.png", battle_item_pebble_png);
INCLUDE_PAL("battle/move/item/pebble.pal", battle_item_pebble_pal);

Vtx N(model)[] = {
{ .v = { { -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 } } },
Expand Down
13 changes: 7 additions & 6 deletions src/battle/move/item/sleepy_sheep.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "ld_addrs.h"
#include "effects.h"
#include "sprite/player.h"
#include "include_asset.h"

#define NAMESPACE battle_item_sleepy_sheep

Expand Down Expand Up @@ -172,16 +173,16 @@ API_CALLABLE(N(func_802A1848_71EE98)) {
static s32 _pad = 0;

#include "battle/move/item/sleepy_sheep1.png.h"
#include "battle/move/item/sleepy_sheep1.png.inc.c"
#include "battle/move/item/sleepy_sheep1.pal.inc.c"
INCLUDE_IMG("battle/move/item/sleepy_sheep1.png", battle_item_sleepy_sheep1_png);
INCLUDE_PAL("battle/move/item/sleepy_sheep1.pal", battle_item_sleepy_sheep1_pal);

#include "battle/move/item/sleepy_sheep2.png.h"
#include "battle/move/item/sleepy_sheep2.png.inc.c"
#include "battle/move/item/sleepy_sheep2.pal.inc.c"
INCLUDE_IMG("battle/move/item/sleepy_sheep2.png", battle_item_sleepy_sheep2_png);
INCLUDE_PAL("battle/move/item/sleepy_sheep2.pal", battle_item_sleepy_sheep2_pal);

#include "battle/move/item/sleepy_sheep3.png.h"
#include "battle/move/item/sleepy_sheep3.png.inc.c"
#include "battle/move/item/sleepy_sheep3.pal.inc.c"
INCLUDE_IMG("battle/move/item/sleepy_sheep3.png", battle_item_sleepy_sheep3_png);
INCLUDE_PAL("battle/move/item/sleepy_sheep3.pal", battle_item_sleepy_sheep3_pal);

Vtx N(model)[] = {
{ .v = {{ -28, 0, 0 }, FALSE, { 0, 1536 }, { 0, 0, 0, 255 }}},
Expand Down
Loading

0 comments on commit 6da232d

Please sign in to comment.