浏览代码

add fourth overworld table

SBird1337 7 年前
父节点
当前提交
c496c2332f
共有 2 个文件被更改,包括 8 次插入6 次删除
  1. 1
    1
      battle_engine
  2. 7
    5
      src/overworld/overworld.c

+ 1
- 1
battle_engine

@@ -1 +1 @@
1
-Subproject commit a201b518834f0208efdb82ac95b08675f5279950
1
+Subproject commit 4a4fb7ac2ac3def1d4270796bdd2c04e8231d382

+ 7
- 5
src/overworld/overworld.c 查看文件

@@ -34,6 +34,7 @@
34 34
 /* === DEFINES === */
35 35
 #define OW_REPLACE_VAR 0x500A
36 36
 #define OW_REPLACE_TO_VAR 0x500B
37
+#define MAX_NPC_TABLES 4
37 38
 
38 39
 /* === PROTOTYPES === */
39 40
 /**
@@ -44,19 +45,20 @@
44 45
 struct npc_type *npc_get_type(u16 npc_id);
45 46
 
46 47
 /* === EXTERN STATICS ===*/
47
-struct npc_type **ow_main_table;
48
-struct npc_type **ow_second_table;
49
-struct npc_type **ow_third_table;
48
+extern struct npc_type **ow_main_table;
49
+extern struct npc_type **ow_second_table;
50
+extern struct npc_type **ow_third_table;
51
+extern struct npc_type **ow_fourth_table;
50 52
 
51 53
 /* === IMPLEMENTATIONS === */
52 54
 struct npc_type *npc_get_type(u16 npc_id)
53 55
 {
54 56
 
55 57
     /* Not possible in a global scope because of gcc cow magic */
56
-    struct npc_type **npc_tables[3] = {ow_main_table, ow_second_table, ow_third_table};
58
+    struct npc_type **npc_tables[MAX_NPC_TABLES] = {ow_main_table, ow_second_table, ow_third_table, ow_fourth_table};
57 59
     //struct npc_type** npc_tables[] = {ow_main_table, ow_second_table, ow_third_table};
58 60
     u8 table_id = npc_id >> 8;
59
-    if (table_id > 2)
61
+    if (table_id > (MAX_NPC_TABLES -1))
60 62
         npc_id = (u8)npc_id;
61 63
 
62 64
     u16 replace_ow = var_get(OW_REPLACE_VAR);