Browse Source

added method to show single item on overworld screen

SBird1337 6 years ago
parent
commit
bccd6f19b4
2 changed files with 22 additions and 1 deletions
  1. 1
    1
      g3headers
  2. 21
    0
      src/interface/show_item.c

+ 1
- 1
g3headers

@@ -1 +1 @@
1
-Subproject commit b72a218a99fc86fe062d26f3944b387f2424776a
1
+Subproject commit a2e68703dcfccb4ef2319f8fd79a8ea7803a63c7

+ 21
- 0
src/interface/show_item.c View File

@@ -0,0 +1,21 @@
1
+#include <pokeagb/pokeagb.h>
2
+
3
+const struct OamData item_oam = {.size = 2};
4
+
5
+void show_item_load_gfx(u16 item)
6
+{
7
+    struct SpriteTiles tiles = {.data = item_gfx_table[item].gfx, .size = 32*16, .tag = 0x1340};
8
+    struct SpritePalette pal = {.data = item_gfx_table[item].pal, .tag = 0x1340};
9
+    struct Template template = {
10
+        .tiles_tag = 0x1340,
11
+        .pal_tag = 0x1340,
12
+        .oam = &item_oam,
13
+        .animation = SPRITE_NO_ANIMATION,
14
+        .graphics = &tiles,
15
+        .rotscale = SPRITE_NO_ROTSCALE,
16
+        .callback = oac_nullsub
17
+    };
18
+    gpu_tile_obj_decompress_alloc_tag_and_upload(&tiles);
19
+    gpu_pal_obj_alloc_tag_and_apply(&pal);
20
+    template_instanciate_forward_search(&template, 100,100,0);
21
+}