No Description

game_engine.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /****************************************************************************
  2. * Copyright (C) 2015-2016 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. * @file game_engine.h
  24. * @author Sturmvogel
  25. * @date 15 dec 2016
  26. * @brief Game Environment
  27. *
  28. * This header file contains methods to interact with the game environment,
  29. * misc. functions i.e. access to flags / variables and (encrypted) pokémon
  30. * data.
  31. */
  32. #ifndef GAME_ENGINE_H
  33. #define GAME_ENGINE_H
  34. /* === INCLUDE === */
  35. #include <types.h>
  36. #include <battle_structs.h>
  37. /* === EXTERN METHODS === */
  38. /**
  39. * @brief get pointer of var
  40. * @param index variable to access
  41. * @return pointer to given variable storage
  42. */
  43. extern u16 *var_access(u32 index);
  44. /**
  45. * @brief gets value of variable at index
  46. * @param index index to get varaible value from
  47. * @return value of VAR[index]
  48. */
  49. extern u16 var_get(u16 index);
  50. /**
  51. * @brief sets variable at index to value
  52. * @param index unsigned index of the variable
  53. * @param value value to set the variable to
  54. * @return true on success, false otherwise
  55. */
  56. extern u8 var_set(u16 index, u16 value);
  57. /**
  58. * @brief checks if flag is set
  59. * @param flag index of flag to check
  60. * @return flag status (bool)
  61. */
  62. extern u8 flag_check(u32 flag);
  63. /**
  64. * @brief clears a flag
  65. * @param flag flag index to clear
  66. */
  67. extern void flag_clear(u16 flag);
  68. /**
  69. * @brief sets a flag
  70. * @param flag flag index to set
  71. */
  72. extern void flag_set(u16 flag);
  73. /**
  74. * @brief gets attribute of pokémon
  75. * @param poke_address address to pokémon structure
  76. * @param request request from the attribute request table
  77. * @param destination destination to write to (if not returned directly)
  78. * @return requested value (if not too big)
  79. */
  80. extern u32 pokemon_get_attribute(struct pokemon* poke_address, u8 request, void* destination);
  81. struct move_data {
  82. u8 effect;
  83. u8 damage;
  84. u8 type;
  85. u8 accuracy;
  86. u8 pp;
  87. u8 effect_accuracy;
  88. u8 target;
  89. s8 priority;
  90. u8 flags;
  91. u8 arg1;
  92. u8 split;
  93. u8 arg3;
  94. };
  95. extern struct move_data move_table[676];
  96. /**
  97. * @brief sets attribute of pokémon
  98. * @param poke_address address to pokémon structure
  99. * @param request request from the attribute request table
  100. * @param new_value pointer to new value
  101. */
  102. void pokemon_set_attribute(struct pokemon* poke_address, u8 request, void* new_value);
  103. /**
  104. * @brief gets the gender of the selected pokemon
  105. * @param poke_address address to pokémon structure
  106. * @return true if the pokémon is female, false otherwise
  107. */
  108. extern u8 pokemon_get_gender(struct pokemon* poke_address);
  109. /**
  110. * @brief gets x12 value of item
  111. * @param item_id item to get value of
  112. * @return corresponding x12 value
  113. */
  114. extern u8 item_get_x12(u16 item_id);
  115. /* TODO: Implement without macros */
  116. #define pokemon_party_player ((struct pokemon*) 0x02024284)
  117. #endif /* GAME_ENGINE_H */