Browse Source

dns header

SBird1337 8 years ago
parent
commit
06c8f71ef4
4 changed files with 130 additions and 121 deletions
  1. 3
    0
      nbproject/configurations.xml
  2. 1
    0
      nbproject/private/configurations.xml
  3. 0
    121
      src/dns/dns_core.c
  4. 126
    0
      src/include/dns_core.h

+ 3
- 0
nbproject/configurations.xml View File

@@ -4631,6 +4631,7 @@
4631 4631
           <in>battle_initiative.h</in>
4632 4632
           <in>battle_test.h</in>
4633 4633
           <in>debug.h</in>
4634
+          <in>dns_core.h</in>
4634 4635
           <in>item_effects.h</in>
4635 4636
           <in>items.h</in>
4636 4637
           <in>pkmn_attributes.h</in>
@@ -27374,6 +27375,8 @@
27374 27375
       </item>
27375 27376
       <item path="src/include/debug.h" ex="false" tool="3" flavor2="0">
27376 27377
       </item>
27378
+      <item path="src/include/dns_core.h" ex="false" tool="3" flavor2="0">
27379
+      </item>
27377 27380
       <item path="src/include/item_effects.h" ex="false" tool="3" flavor2="0">
27378 27381
       </item>
27379 27382
       <item path="src/include/items.h" ex="false" tool="3" flavor2="0">

+ 1
- 0
nbproject/private/configurations.xml View File

@@ -6058,6 +6058,7 @@
6058 6058
           <in>config.h</in>
6059 6059
           <in>custom_structs.h</in>
6060 6060
           <in>debug.h</in>
6061
+          <in>dns_core.h</in>
6061 6062
           <in>fade.h</in>
6062 6063
           <in>item_effects.h</in>
6063 6064
           <in>items.h</in>

+ 0
- 121
src/dns/dns_core.c View File

@@ -1,126 +1,5 @@
1 1
 #include <bpre.h>
2 2
 
3
-enum time_type {
4
-    DAY,
5
-    NIGHT,
6
-    EVENING,
7
-    MORNING
8
-};
9
-
10
-enum map_type {
11
-    UNK_00,
12
-    VILLAGE,
13
-    CITY,
14
-    ROUTE,
15
-    CELLAR,
16
-    UNDERWATER,
17
-    UNK_07,
18
-    UNK_08,
19
-    INSIDE,
20
-    SECRET_BASE
21
-};
22
-
23
-struct mapdata_header {
24
-    u32 width;
25
-    u32 height;
26
-    void* border;
27
-    void* data;
28
-    struct blockset* blockset_one;
29
-    struct blockset* blockset_two;
30
-    u8 border_width;
31
-    u8 border_height;
32
-    u16 unknown;
33
-};
34
-
35
-struct mapheader {
36
-    struct mapdata_header* data_header;
37
-    void* events;
38
-    void* scripts;
39
-    void* connections;
40
-    u16 music;
41
-    u16 mapindex;
42
-    u8 name;
43
-    u8 cave;
44
-    u8 weather;
45
-    enum map_type maptype;
46
-    u8 field18;
47
-    u8 escape_rope;
48
-    u8 showname;
49
-    u8 battletype;
50
-};
51
-
52
-extern struct mapheader current_mapheader;
53
-
54
-struct color_shade {
55
-    struct color color;
56
-    u8 alpha;
57
-};
58
-
59
-struct npc_palette {
60
-    struct color* palette;
61
-    u16 tag;
62
-    u16 fill;
63
-};
64
-
65
-struct pal_replace {
66
-    void* blockset;
67
-    u8 pal;
68
-    u8 index;
69
-    struct color color;
70
-};
71
-
72
-struct blockset {
73
-    u8 is_compressed;
74
-    u8 is_secondary;
75
-    u16 padding;
76
-    void* tiles;
77
-    void* palette;
78
-    void* block_tiles;
79
-    void* funcptr;
80
-    void* behavior;
81
-};
82
-
83
-struct dynamic_pal {
84
-    u8 type;
85
-    u8 count;
86
-    u16 tag;
87
-};
88
-
89
-#define dynamic_palettes ((struct dynamic_pal*) 0x0203FF00)
90
-
91
-void blockset_load_virtual_palette_and_shade(struct blockset* blockset, u16 start, u16 len, struct color* destination);
92
-extern struct npc_palette* npc_palettes;
93
-extern volatile u8 tint_filter;
94
-void apply_shaders(u8 pal, u8 fade_copy, struct color* to_apply);
95
-struct color alpha_blend(struct color a, struct color b, u8 alpha);
96
-extern void blockset_load_palette_to_gpu(void* blockset, u16 start, u16 len);
97
-extern void gpu_pal_apply(struct color* src, u16 dst, u16 len);
98
-extern void load_palette_3(u16 start, u16 len);
99
-extern void tint_palette(u8 pal_slot);
100
-extern u8 gpu_pal_tags_index_of(u16 pal_tag);
101
-extern void lz77u_wram(void* src, void* dst);
102
-extern void* oe_read_word(void* oe_script_pointer);
103
-extern void some_weather_func(u8 pal_index);
104
-void copy_unfaded(u8 slot);
105
-void pal_patch_for_npc(u16 tag, u8 pal);
106
-u8 is_current_map_dn_valid(enum map_type current_type);
107
-//care, this has to be manually patched to be u16
108
-extern u16 npc_pal_idx_for_given_tag(u16 tag);
109
-struct color_shade get_color_from_time(enum time_type current_time);
110
-enum time_type get_time_of_day();
111
-void update_dns_palettes();
112
-void apply_lighting(void* blockset, u8 copy, struct color* to_apply);
113
-
114
-extern void mapdata_load_palettes_to_gpu(struct mapdata_header* data_header);
115
-extern u16 npc_paltag_by_palslot(u8 slot);
116
-
117
-extern void script_something();
118
-extern void camera_update();
119
-extern void foo_115798();
120
-extern void foo_5ae28();
121
-extern void foo_6ffbc();
122
-extern void tilemaps_sync();
123
-
124 3
 enum time_type get_time_of_day() {
125 4
     volatile u8* time_pointer = (u8*) (0x0203FAB1);
126 5
     return *time_pointer;

+ 126
- 0
src/include/dns_core.h View File

@@ -0,0 +1,126 @@
1
+#ifndef DNS_CORE_H
2
+#define DNS_CORE_H
3
+
4
+enum time_type {
5
+    DAY,
6
+    NIGHT,
7
+    EVENING,
8
+    MORNING
9
+};
10
+
11
+enum map_type {
12
+    UNK_00,
13
+    VILLAGE,
14
+    CITY,
15
+    ROUTE,
16
+    CELLAR,
17
+    UNDERWATER,
18
+    UNK_07,
19
+    UNK_08,
20
+    INSIDE,
21
+    SECRET_BASE
22
+};
23
+
24
+struct mapdata_header {
25
+    u32 width;
26
+    u32 height;
27
+    void* border;
28
+    void* data;
29
+    struct blockset* blockset_one;
30
+    struct blockset* blockset_two;
31
+    u8 border_width;
32
+    u8 border_height;
33
+    u16 unknown;
34
+};
35
+
36
+struct mapheader {
37
+    struct mapdata_header* data_header;
38
+    void* events;
39
+    void* scripts;
40
+    void* connections;
41
+    u16 music;
42
+    u16 mapindex;
43
+    u8 name;
44
+    u8 cave;
45
+    u8 weather;
46
+    enum map_type maptype;
47
+    u8 field18;
48
+    u8 escape_rope;
49
+    u8 showname;
50
+    u8 battletype;
51
+};
52
+
53
+extern struct mapheader current_mapheader;
54
+
55
+struct color_shade {
56
+    struct color color;
57
+    u8 alpha;
58
+};
59
+
60
+struct npc_palette {
61
+    struct color* palette;
62
+    u16 tag;
63
+    u16 fill;
64
+};
65
+
66
+struct pal_replace {
67
+    void* blockset;
68
+    u8 pal;
69
+    u8 index;
70
+    struct color color;
71
+};
72
+
73
+struct blockset {
74
+    u8 is_compressed;
75
+    u8 is_secondary;
76
+    u16 padding;
77
+    void* tiles;
78
+    void* palette;
79
+    void* block_tiles;
80
+    void* funcptr;
81
+    void* behavior;
82
+};
83
+
84
+struct dynamic_pal {
85
+    u8 type;
86
+    u8 count;
87
+    u16 tag;
88
+};
89
+
90
+#define dynamic_palettes ((struct dynamic_pal*) 0x0203FF00)
91
+
92
+void blockset_load_virtual_palette_and_shade(struct blockset* blockset, u16 start, u16 len, struct color* destination);
93
+extern struct npc_palette* npc_palettes;
94
+extern volatile u8 tint_filter;
95
+void apply_shaders(u8 pal, u8 fade_copy, struct color* to_apply);
96
+struct color alpha_blend(struct color a, struct color b, u8 alpha);
97
+extern void blockset_load_palette_to_gpu(void* blockset, u16 start, u16 len);
98
+extern void gpu_pal_apply(struct color* src, u16 dst, u16 len);
99
+extern void load_palette_3(u16 start, u16 len);
100
+extern void tint_palette(u8 pal_slot);
101
+extern u8 gpu_pal_tags_index_of(u16 pal_tag);
102
+extern void lz77u_wram(void* src, void* dst);
103
+extern void* oe_read_word(void* oe_script_pointer);
104
+extern void some_weather_func(u8 pal_index);
105
+void copy_unfaded(u8 slot);
106
+void pal_patch_for_npc(u16 tag, u8 pal);
107
+u8 is_current_map_dn_valid(enum map_type current_type);
108
+//care, this has to be manually patched to be u16
109
+extern u16 npc_pal_idx_for_given_tag(u16 tag);
110
+struct color_shade get_color_from_time(enum time_type current_time);
111
+enum time_type get_time_of_day();
112
+void update_dns_palettes();
113
+void apply_lighting(void* blockset, u8 copy, struct color* to_apply);
114
+
115
+extern void mapdata_load_palettes_to_gpu(struct mapdata_header* data_header);
116
+extern u16 npc_paltag_by_palslot(u8 slot);
117
+
118
+extern void script_something();
119
+extern void camera_update();
120
+extern void foo_115798();
121
+extern void foo_5ae28();
122
+extern void foo_6ffbc();
123
+extern void tilemaps_sync();
124
+
125
+#endif /* DNS_CORE_H */
126
+