Sin descripción

custom_specials.c 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 custom_specials.c
  24. * @author Sturmvogel
  25. * @date 15 dec 2016
  26. * @brief Special 0x68 implementation to read from LASTRESULT and execute
  27. *
  28. */
  29. /* === INCLUDES === */
  30. #include "cutscene_meteor.h"
  31. #include "camera_move.h"
  32. #include <callback.h>
  33. #include <debug.h>
  34. #include <game_engine.h>
  35. #include <config.h>
  36. /* === PROTOTYPES === */
  37. /**
  38. * @brief test routine to switch dns
  39. */
  40. void sp_dns_switch();
  41. /**
  42. * @brief clear some flags at the beginning of the game
  43. */
  44. void sp_init_script();
  45. /**
  46. * @brief callasm to call a var-based routine as defined
  47. */
  48. void sp_special_casm();
  49. /* === STATICS === */
  50. static callback special_routines[5] = {
  51. met_play,
  52. cam_sp_move_camera,
  53. sp_init_script,
  54. debug_some_test,
  55. sp_dns_switch,
  56. };
  57. /* === IMPLEMENTATIONS === */
  58. void sp_dns_switch()
  59. {
  60. volatile u8* test_pointer = (u8*) (0x0203FAB0);
  61. *(test_pointer+1) = (*(test_pointer+1) == 3 ? 0 : (*(test_pointer+1)) + 1);
  62. *test_pointer = 1;
  63. }
  64. void sp_init_script()
  65. {
  66. for(u16 i = 0x1000; i < 0x1800; ++i)
  67. {
  68. flag_clear(i);
  69. }
  70. }
  71. void sp_special_casm() //special 0x68
  72. {
  73. u16* var_special = var_access(CALLASM_VAR);
  74. special_routines[*var_special]();
  75. }