Browse Source

update private, fix more overworld stuff, change script location

SBird1337 7 years ago
parent
commit
a1c7e5b1ba

+ 2
- 1
makefile View File

37
 MAPMAPS	  := $(MAPROOT)/maps
37
 MAPMAPS	  := $(MAPROOT)/maps
38
 MAPTS	  := $(MAPROOT)/tileset
38
 MAPTS	  := $(MAPROOT)/tileset
39
 MAP_PROJ	:= $(MAPROOT)/sots.json
39
 MAP_PROJ	:= $(MAPROOT)/sots.json
40
+SCRIPTROOT := $(MAPROOT)/script
40
 
41
 
41
 MAIN_OBJ  := $(BLDPATH)/linked.o
42
 MAIN_OBJ  := $(BLDPATH)/linked.o
42
 B_ENGINE  := battle_engine/build/linked.o
43
 B_ENGINE  := battle_engine/build/linked.o
67
 DATA_SRC    := $(call rwildcard,data/,*.s)
68
 DATA_SRC    := $(call rwildcard,data/,*.s)
68
 STRING		:= $(call rwildcard,string/$(LAN)/,*.txt)
69
 STRING		:= $(call rwildcard,string/$(LAN)/,*.txt)
69
 STRING_SRC	:= $(STRING:%.txt=%.s)
70
 STRING_SRC	:= $(STRING:%.txt=%.s)
70
-SCRIPT_SRC	:= $(call rwildcard,$(MAPMAPS)/,*.s)
71
+SCRIPT_SRC	:= $(call rwildcard,$(SCRIPTROOT)/,*.s)
71
 
72
 
72
 MAP_PROJ_S	:= $(MAP_PROJ:%.json=%.s)
73
 MAP_PROJ_S	:= $(MAP_PROJ:%.json=%.s)
73
 MAP_PROJ_O	:= $(MAP_PROJ:%.json=$(BLDPATH)/%.o)
74
 MAP_PROJ_O	:= $(MAP_PROJ:%.json=$(BLDPATH)/%.o)

+ 10
- 5
patches/dynamic_overworld_hooks.asm View File

255
 
255
 
256
 .pool
256
 .pool
257
 
257
 
258
-.org 0x08007280
258
+/*.org 0x08007280
259
 ldr r1, =obj_delete_and_free_tiles_hook|1
259
 ldr r1, =obj_delete_and_free_tiles_hook|1
260
 bx r1
260
 bx r1
261
-.pool
261
+.pool*/
262
 
262
 
263
 .org 0x0800779A
263
 .org 0x0800779A
264
 ldr r1, =obj_delete_all_hook|1
264
 ldr r1, =obj_delete_all_hook|1
278
 bx r4
278
 bx r4
279
 .pool
279
 .pool
280
 
280
 
281
-.org 0x0808265C
281
+/*.org 0x0808265C
282
 ldr r3, =ov_emot_load|1
282
 ldr r3, =ov_emot_load|1
283
 bx r3
283
 bx r3
284
-.pool
284
+.pool*/
285
 
285
 
286
 /*.org 0x08083614
286
 /*.org 0x08083614
287
 ldr r1, =oec01_load_pal_impl|1
287
 ldr r1, =oec01_load_pal_impl|1
291
 .org 0x0808365C
291
 .org 0x0808365C
292
 ldr r1, =oec02_load_pal_impl|1
292
 ldr r1, =oec02_load_pal_impl|1
293
 bx r1
293
 bx r1
294
-.pool*/
294
+.pool*/
295
+
296
+.org 0x0805E510
297
+ldr r1, =npc_delete_obj_and_free_tiles_for_npc_hack|1
298
+bx r1
299
+.pool

+ 2
- 2
patches/overworlds/overworld.asm View File

16
 ldrb r0, [r5, #3]
16
 ldrb r0, [r5, #3]
17
 strb r0, [r4, #0x1A]
17
 strb r0, [r4, #0x1A]
18
 
18
 
19
-.org 0x0805E510
19
+/*.org 0x0805E510
20
     ldr r1, =overworld_h_two+1
20
     ldr r1, =overworld_h_two+1
21
     bx r1
21
     bx r1
22
-    .pool
22
+    .pool*/
23
 
23
 
24
 .org 0x0805E744
24
 .org 0x0805E744
25
     lsl r4, r4, #0x10
25
     lsl r4, r4, #0x10

+ 1
- 1
sots-private

1
-Subproject commit 1824abff46e5206961d42a691f6235f8c82e125d
1
+Subproject commit 50f15740eefbb1757648d648c46e2b50a1170f62

+ 19
- 10
src/overworld/dynamic_overworld.c View File

81
     }
81
     }
82
 }
82
 }
83
 
83
 
84
-void npc_dynamic_remove_entry(u8 id, u16 tag) {
85
-    if (stored_palettes[id].tag == tag) {
86
-        if (stored_palettes[id].reference_count > 0) {
87
-            stored_palettes[id].reference_count--;
88
-            dprintf("npc_dynamic: removed entry #%d\n", id);
89
-            if (stored_palettes[id].reference_count == 0)
90
-                stored_palettes[id].tag = 0;
91
-        }
84
+void npc_dynamic_remove_entry(u8 id) {
85
+    if (stored_palettes[id].reference_count > 0) {
86
+        stored_palettes[id].reference_count--;
87
+        dprintf("npc_dynamic: removed entry #%d\n", id);
88
+        if (stored_palettes[id].reference_count == 0)
89
+            stored_palettes[id].tag = 0;
92
     }
90
     }
93
 }
91
 }
94
 
92
 
106
 
104
 
107
     struct Template template_to_load;
105
     struct Template template_to_load;
108
     u32 f14;
106
     u32 f14;
109
-    npc_to_objtemplate__with_indexed_objfunc(type_id, npc_to_load->running_behavior, &template_to_load,
110
-                                             &f14);
107
+    npc_to_objtemplate__with_indexed_objfunc(type_id, npc_to_load->running_behavior, &template_to_load, &f14);
111
     template_to_load.pal_tag = 0xFFFF;
108
     template_to_load.pal_tag = 0xFFFF;
112
     s8 pal_slot = npc_dynamic_load_palette(type_to_load->pal_num);
109
     s8 pal_slot = npc_dynamic_load_palette(type_to_load->pal_num);
113
 
110
 
222
     }
219
     }
223
     *oe_script += 4;
220
     *oe_script += 4;
224
 }
221
 }
222
+
223
+void npc_delete_obj_and_free_tiles_for_npc_hack(struct NpcState *state) {
224
+    struct SpriteTiles tiles;
225
+    u16 npc_id = ((u16)state->type_id) | (((u16)state->field1A << 8));
226
+    struct NpcType *type = npc_get_type(npc_id);
227
+    tiles.size = type->field_6;
228
+    objects[state->oam_id].gfx_table = &tiles;
229
+    u8 pal_num = objects[state->oam_id].final_oam.palette_num;
230
+    obj_delete_and_free(&objects[state->oam_id]);
231
+    npc_dynamic_remove_entry(pal_num);
232
+    dprintf("deleted npc state at x: %d y: %d\n", state->to.x, state->to.y);
233
+}