DragonflySotS 6 anni fa
parent
commit
365fc6d51a
4 ha cambiato i file con 41 aggiunte e 20 eliminazioni
  1. 1
    1
      g3headers
  2. 17
    17
      sprites.makefile
  3. 21
    0
      src/interface/show_item.c
  4. 2
    2
      src/overworld/tileset_animation/main_animator.c

+ 1
- 1
g3headers

@@ -1 +1 @@
1
-Subproject commit 96f9db527ac23ab26be5614c2aeda2b1e3e5c7ab
1
+Subproject commit a2e68703dcfccb4ef2319f8fd79a8ea7803a63c7

+ 17
- 17
sprites.makefile Vedi File

@@ -52,46 +52,46 @@ clean:
52 52
 
53 53
 
54 54
 $(SPRITES_BINARY): $(OW_OBJ) $(TS_OBJ) $(ITEM_OBJ)
55
-	@echo -e "\e[1;32mLinking $@\e[0m"
55
+	@echo "\033[1;32mLinking $@\033[0m"
56 56
 	@echo "INPUT($^)" > $(TMP_LD)
57 57
 	$(LD) -r -o $@ -T $(TMP_LD)
58 58
 
59 59
 # Item Targets
60 60
 $(GFX_BUILD_DIR)/item/%.o: $(GFX_BUILD_DIR)/item/%.s
61
-	@echo -e "\e[32mAssembling $<\e[0m"
61
+	@echo "\033[32mAssembling $<\033[0m"
62 62
 	$(AS) -o $@ $<
63 63
 
64 64
 .PRECIOUS: $(GFX_BUILD_DIR)/item/%.s
65 65
 $(GFX_BUILD_DIR)/item/%.s: $(ASSET_ROOT)/item_icons/%.png
66
-	@echo -e "\e[34mProcessing image $<\e[0m"
66
+	@echo "\033[34mProcessing image $<\033[0m"
67 67
 	$(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
68 68
 
69 69
 # OW Targets
70 70
 $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
71
-	@echo -e "\e[32mAssembling $<\e[0m"
71
+	@echo "\033[32mAssembling $<\033[0m"
72 72
 	$(AS) -o $@ $<
73 73
 
74 74
 .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
75 75
 $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
76
-	@echo -e "\e[34mProcessing image $<\e[0m"
76
+	@echo "\033[34mProcessing image $<\033[0m"
77 77
 	$(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
78 78
 
79 79
 # Trainer Sprite Targets
80 80
 $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
81
-	@echo -e "\e[32mAssembling $<\e[0m"
81
+	@echo "\033[32mAssembling $<\033[0m"
82 82
 	$(AS) -o $@ $<
83 83
 
84 84
 $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
85
-	@echo -e "\e[34mProcessing image $<\e[0m"
85
+	@echo "\033[34mProcessing image $<\033[0m"
86 86
 	$(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
87 87
 
88 88
 # Normal Palette Targets
89 89
 $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
90
-	@echo -e "\e[32mAssembling $<\e[0m"
90
+	@echo "\033[32mAssembling $<\033[0m"
91 91
 	$(AS) -o $@ $<
92 92
 
93 93
 $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
94
-	@echo -e "\e[34mProcessing palette $< (normal)\e[0m"
94
+	@echo "\033[34mProcessing palette $< (normal)\033[0m"
95 95
 	$(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
96 96
 		-s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
97 97
 		-o $@
@@ -135,41 +135,41 @@ $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
135 135
 
136 136
 # Misc hardcoded targets
137 137
 $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
138
-	@echo -e "\e[32mAssembling $<\e[0m"
138
+	@echo "\033[32mAssembling $<\033[0m"
139 139
 	$(AS) -o $@ $<
140 140
 
141 141
 $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
142
-	@echo -e "\e[34mProcessing palette $< (normal)\e[0m"
142
+	@echo "\033[34mProcessing palette $< (normal)\033[0m"
143 143
 	$(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
144 144
 		-s n_p_0385 -o $@
145 145
 
146 146
 
147 147
 $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
148
-	@echo -e "\e[32mAssembling $<\e[0m"
148
+	@echo "\033[32mAssembling $<\033[0m"
149 149
 	$(AS) -o $@ $<
150 150
 
151 151
 $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
152
-	@echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
152
+	@echo "\033[34mProcessing palette $< (shiny)\033[0m"
153 153
 	$(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
154 154
 		-s s_p_0385 -o $@
155 155
 
156 156
 
157 157
 $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
158
-	@echo -e "\e[32mAssembling $<\e[0m"
158
+	@echo "\033[32mAssembling $<\033[0m"
159 159
 	$(AS) -o $@ $<
160 160
 
161 161
 $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
162
-	@echo -e "\e[34mProcessing sprite $< (front)\e[0m"
162
+	@echo "\033[34mProcessing sprite $< (front)\033[0m"
163 163
 	$(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
164 164
 		-s front_0385 -o $@
165 165
 
166 166
 
167 167
 $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
168
-	@echo -e "\e[32mAssembling $<\e[0m"
168
+	@echo "\033[32mAssembling $<\033[0m"
169 169
 	$(AS) -o $@ $<
170 170
 
171 171
 $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
172
-	@echo -e "\e[34mProcessing sprite $< (back)\e[0m"
172
+	@echo "\033[34mProcessing sprite $< (back)\033[0m"
173 173
 	$(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
174 174
 		-s back_0385 -o $@
175 175
 

+ 21
- 0
src/interface/show_item.c Vedi 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
+}

+ 2
- 2
src/overworld/tileset_animation/main_animator.c Vedi File

@@ -46,11 +46,11 @@ void animate_from_structure(const struct TilesetAnimation *anim, u16 tile_skip)
46 46
     void *vram_address = (void *)(0x06000000 + (tile_skip * 0x20));
47 47
     u8 cur_anim = 0;
48 48
     while (anim[cur_anim].image != (void *)0xFFFFFFFF && cur_anim < NUM_MAX_ANIMATIONS) {
49
-        void *current_vram = vram_address + (0x20 * anim[cur_anim].tile_start);
49
+        void *current_vram = (u8*)vram_address + (0x20 * anim[cur_anim].tile_start);
50 50
 
51 51
         if (anim_state->cur_frame[cur_anim] == 0) {
52 52
             memcpy(current_vram,
53
-                   anim[cur_anim].image + (0x20 * anim[cur_anim].tile_length * anim_state->cur_tile[cur_anim]),
53
+                   (u8*)anim[cur_anim].image + (0x20 * anim[cur_anim].tile_length * anim_state->cur_tile[cur_anim]),
54 54
                    anim[cur_anim].tile_length * 0x20);
55 55
         }
56 56