ソースを参照

added tile block check special

Philipp Auer 7 年 前
コミット
22aafb88e6
共有6 個のファイルを変更した117 個の追加2 個の削除を含む
  1. 2
    1
      .vscode/settings.json
  2. 3
    0
      bpre.sym
  3. 63
    0
      src/include/map.h
  4. 2
    1
      src/overworld/grass_animation.c
  5. 44
    0
      src/specials/check_tileset.c
  6. 3
    0
      src/specials/custom_specials.c

+ 2
- 1
.vscode/settings.json ファイルの表示

@@ -1,6 +1,7 @@
1 1
 {
2 2
     "files.associations": {
3 3
         "filesystem": "cpp",
4
-        "regex": "cpp"
4
+        "regex": "cpp",
5
+        "xlocmon": "cpp"
5 6
     }
6 7
 }

+ 3
- 0
bpre.sym ファイルの表示

@@ -27,6 +27,9 @@ camera_move_and_redraw = 0x0805ACB4|1;
27 27
 calc_circle = 0x0807EE2C|1;
28 28
 random = 0x08044EC8|1;
29 29
 
30
+current_map_block_id_at = 0x08058E48|1;
31
+player_get_pos_to = 0x0805C538|1;
32
+
30 33
 palette_unfaded_buffer = 0x020371F8;
31 34
 palette_faded_buffer = 0x020375F8;
32 35
 current_mapheader = 0x02036DFC;

+ 63
- 0
src/include/map.h ファイルの表示

@@ -0,0 +1,63 @@
1
+#ifndef MAP_H_
2
+#define MAP_H_
3
+
4
+#include <types.h>
5
+
6
+enum map_type {
7
+    UNK_00,
8
+    VILLAGE,
9
+    CITY,
10
+    ROUTE,
11
+    CELLAR,
12
+    UNDERWATER,
13
+    UNK_07,
14
+    UNK_08,
15
+    INSIDE,
16
+    SECRET_BASE
17
+};
18
+
19
+struct blockset {
20
+    u8 is_compressed;
21
+    u8 is_secondary;
22
+    u16 padding;
23
+    void* tiles;
24
+    void* palette;
25
+    void* block_tiles;
26
+    void* funcptr;
27
+    void* behavior;
28
+};
29
+
30
+struct mapdata_header {
31
+    u32 width;
32
+    u32 height;
33
+    void* border;
34
+    void* data;
35
+    struct blockset* blockset_one;
36
+    struct blockset* blockset_two;
37
+    u8 border_width;
38
+    u8 border_height;
39
+    u16 unknown;
40
+};
41
+
42
+struct mapheader {
43
+    struct mapdata_header* data_header;
44
+    void* events;
45
+    void* scripts;
46
+    void* connections;
47
+    u16 music;
48
+    u16 mapindex;
49
+    u8 name;
50
+    u8 cave;
51
+    u8 weather;
52
+    enum map_type maptype;
53
+    u8 field18;
54
+    u8 escape_rope;
55
+    u8 showname;
56
+    u8 battletype;
57
+};
58
+
59
+extern struct mapheader current_mapheader;
60
+
61
+u16 current_map_block_id_at(u16 x, u16 y);
62
+void player_get_pos_to(u16* x, u16* y);
63
+#endif //MAP_H_

+ 2
- 1
src/overworld/grass_animation.c ファイルの表示

@@ -4,6 +4,7 @@
4 4
 #include <agb_debug.h>
5 5
 
6 6
 extern u16 current_map_block_role_get(u16 x, u16 y);
7
+void sp_check_tileset(void);
7 8
 
8 9
 void grass_step_general(struct npc_state *npc)
9 10
 {
@@ -30,6 +31,6 @@ void grass_step_elastic(struct npc_state *npc)
30 31
     current_oe_state.field_1C = 1;
31 32
 
32 33
     /* use variable to determine the oe animation to play */
33
-
34
+    sp_check_tileset();
34 35
     (void)oe_exec(4);
35 36
 }

+ 44
- 0
src/specials/check_tileset.c ファイルの表示

@@ -0,0 +1,44 @@
1
+/****************************************************************************
2
+ * Copyright (C) 2015-2017 by the SotS Team                                 *
3
+ *                                                                          *
4
+ * This file is part of Sovereign of the Skies.                             *
5
+ *                                                                          *
6
+ *   Sovereign of the Skies is free software: you can redistribute it       *
7
+ *   and/or modify it                                                       *
8
+ *   under the terms of the GNU Lesser General Public License as published  *
9
+ *   by the Free Software Foundation, either version 3 of the License, or   *
10
+ *   (at your option) any later version provided you include a copy of the  *
11
+ *   licence and this header.                                               *
12
+ *                                                                          *
13
+ *   Sovereign of the Skies is distributed in the hope that it will be      *
14
+ *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
16
+ *   GNU Lesser General Public License for more details.                    *
17
+ *                                                                          *
18
+ *   You should have received a copy of the GNU Lesser General Public       *
19
+ *   License along with Sovereign of the Skies.                             *
20
+ *   If not, see <http://www.gnu.org/licenses/>.                            *
21
+ ****************************************************************************/
22
+
23
+ /**
24
+ * @file check_tileset.c
25
+ * @author Sturmvogel
26
+ * @date 21 may 2017
27
+ * @brief Check tileset stuff and store on last result
28
+ * 
29
+ */
30
+
31
+#include <map.h>
32
+#include <game_engine.h>
33
+#include <agb_debug.h>
34
+
35
+void sp_check_tileset(void)
36
+{
37
+    u16 x;
38
+    u16 y;
39
+    player_get_pos_to(&x, &y);
40
+    dprintf("reading from %d %d\n", x,y);
41
+    u16 block_id = current_map_block_id_at(x,y);
42
+    dprintf("block id: %d\n", block_id);
43
+    var_set(0x800D, current_map_block_id_at(x,y));
44
+}

+ 3
- 0
src/specials/custom_specials.c ファイルの表示

@@ -69,6 +69,8 @@ void sp_random_number();
69 69
 
70 70
 void get_text_pointer_from_lookup();
71 71
 
72
+void sp_check_tileset();
73
+
72 74
 /* === STATICS === */
73 75
 
74 76
 static callback special_routines[7] = {
@@ -78,6 +80,7 @@ static callback special_routines[7] = {
78 80
     debug_some_test,
79 81
     sp_dns_switch,
80 82
     sp_random_number,
83
+    sp_check_tileset
81 84
 };
82 85
 
83 86
 /* === IMPLEMENTATIONS === */