Brak opisu

overworld.c 951B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <bpre.h>
  2. #define OW_REPLACE_VAR 0x500A
  3. #define OW_REPLACE_TO_VAR 0x500B
  4. struct coords16{
  5. u16 x;
  6. u16 y;
  7. };
  8. struct npc_type {
  9. u16 tiles_tag;
  10. u16 pal_num;
  11. u16 pal_tag_2;
  12. u16 field_6;
  13. struct coords16 pos_neg_center;
  14. u8 pal_slot_unk;
  15. u8 field_D;
  16. u16 pal_table;
  17. u32 oam;
  18. u32 field_14;
  19. u32 image_anims;
  20. u32 gfx_table;
  21. u32 rot_scale_anims;
  22. };
  23. extern struct npc_type* ow_main_table;
  24. extern struct npc_type* ow_second_table;
  25. extern struct npc_type* ow_third_table;
  26. struct npc_type* npc_get_type(u16 npc_id)
  27. {
  28. struct npc_type** npc_tables[] = {ow_main_table, ow_second_table, ow_third_table};
  29. u16* replace_ow = var_access(OW_REPLACE_VAR);
  30. if(*replace_ow > 0 && *replace_ow - 1 == npc_id)
  31. {
  32. npc_id = *var_access(OW_REPLACE_TO_VAR);
  33. }
  34. u8 table = (npc_id >> 8);
  35. return (npc_tables[table][npc_id & 0xFF]);
  36. }