Browse Source

add fourth overworld table

SBird1337 7 years ago
parent
commit
c496c2332f
2 changed files with 8 additions and 6 deletions
  1. 1
    1
      battle_engine
  2. 7
    5
      src/overworld/overworld.c

+ 1
- 1
battle_engine

1
-Subproject commit a201b518834f0208efdb82ac95b08675f5279950
1
+Subproject commit 4a4fb7ac2ac3def1d4270796bdd2c04e8231d382

+ 7
- 5
src/overworld/overworld.c View File

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