Browse Source

added virtual batchmaptile

SBird1337 7 years ago
parent
commit
f0b847e472

+ 1
- 1
makefile View File

18
 
18
 
19
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
19
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
20
 ASFLAGS   := -mthumb
20
 ASFLAGS   := -mthumb
21
-CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -Og -std=c11 -Wall -Wextra -Wunreachable-code -Isrc/include -fdiagnostics-color $(DEFINES)
21
+CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -Og -std=c11 -Wall -Wextra -Wunreachable-code -I$(PAGB_INCLUDE) -Isrc/include -fdiagnostics-color $(DEFINES)
22
 GRITFLAGS := -ftc -fa
22
 GRITFLAGS := -ftc -fa
23
 LDFLAGS   := -z muldefs
23
 LDFLAGS   := -z muldefs
24
 BLDPATH   := object
24
 BLDPATH   := object

+ 9
- 0
src/overworld/dyn_npc_hooks.S View File

1
+.align 2
2
+.text
3
+.thumb
4
+
5
+.global npc_spawn_hook:
6
+npc_spawn_hook:
7
+    ldrh r0, [r6, #2]
8
+    bl dynamic_npc_load_palette
9
+    lsl r1, r0, #4

+ 21
- 3
src/overworld/dynamic_overworld.c View File

1
-void npc_spawn()
1
+#include <pokeagb/pokeagb.h>
2
+
3
+enum PalStoreType{
4
+    UNUSED,
5
+    NPC,
6
+    REFLECTION,
7
+    OTHER
8
+};
9
+
10
+struct PalStoreEntry{
11
+    enum PalStoreType type;
12
+    u8 reference_count;
13
+    u16 tag; 
14
+};
15
+
16
+extern struct PalStoreEntry stored_palettes[16];
17
+
18
+u8 dynamic_npc_load_palette(u16 tag)
2
 {
19
 {
3
-    //placeholder for now
4
-}
20
+
21
+}
22
+

+ 20
- 0
src/specials/batch_maptile.c View File

1
+#include <pokeagb/pokeagb.h>
2
+
3
+void sp_batchmaptile(void) {
4
+    u16 tid_from = var_8000;
5
+    u16 tid_to = var_8001;
6
+    u8 collision_from = var_8002;
7
+    u8 collision_to = var_8003;
8
+
9
+    for (u8 x = 0; x < virtual_map_header.width; ++x) {
10
+        for(u8 y = 0; y < virtual_map_header.height; ++y)
11
+        {
12
+            struct MapTile *current = &virtual_map_header.data[x + virtual_map_header.width * y];
13
+            if(current->tile == tid_from && current->permission == collision_from)
14
+            {
15
+                current->tile = tid_to;
16
+                current->permission = collision_to;
17
+            }
18
+        }
19
+    }
20
+}

+ 5
- 2
src/specials/custom_specials.c View File

66
  */
66
  */
67
 void sp_random_number();
67
 void sp_random_number();
68
 
68
 
69
+extern void sp_batchmaptile(void);
70
+
69
 
71
 
70
 void get_text_pointer_from_lookup();
72
 void get_text_pointer_from_lookup();
71
 
73
 
73
 
75
 
74
 /* === STATICS === */
76
 /* === STATICS === */
75
 
77
 
76
-static callback special_routines[7] = {
78
+static callback special_routines[8] = {
77
     met_play,
79
     met_play,
78
     cam_sp_move_camera,
80
     cam_sp_move_camera,
79
     sp_init_script,
81
     sp_init_script,
80
     debug_some_test,
82
     debug_some_test,
81
     sp_dns_switch,
83
     sp_dns_switch,
82
     sp_random_number,
84
     sp_random_number,
83
-    sp_check_tileset
85
+    sp_check_tileset,
86
+    sp_batchmaptile
84
 };
87
 };
85
 
88
 
86
 /* === IMPLEMENTATIONS === */
89
 /* === IMPLEMENTATIONS === */