123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
-
-
-
-
-
- #include <game_engine.h>
- #include <npc.h>
-
-
- #define OW_REPLACE_VAR 0x500A
- #define OW_REPLACE_TO_VAR 0x500B
-
-
-
- struct npc_type *npc_get_type(u16 npc_id);
-
-
- struct npc_type **ow_main_table;
- struct npc_type **ow_second_table;
- struct npc_type **ow_third_table;
-
-
- struct npc_type *npc_get_type(u16 npc_id)
- {
-
-
- struct npc_type **npc_tables[3] = {ow_main_table, ow_second_table, ow_third_table};
-
- u8 table_id = npc_id >> 8;
- if (table_id > 2)
- npc_id = (u8)npc_id;
-
- u16 replace_ow = var_get(OW_REPLACE_VAR);
- if (replace_ow > 0 && replace_ow - 1 == npc_id)
- {
- npc_id = var_get(OW_REPLACE_TO_VAR);
- }
- u8 table = (npc_id >> 8);
- return (npc_tables[table][npc_id & 0xFF]);
- }
|