|
@@ -25,17 +25,17 @@
|
25
|
25
|
* @author Sturmvogel
|
26
|
26
|
* @date 15 dec 2016
|
27
|
27
|
* @brief Special 0x68 implementation to read from LASTRESULT and execute
|
28
|
|
- *
|
|
28
|
+ *
|
29
|
29
|
*/
|
30
|
30
|
|
31
|
31
|
/* === INCLUDES === */
|
32
|
32
|
|
33
|
|
-#include "cutscene_meteor.h"
|
34
|
33
|
#include "camera_move.h"
|
|
34
|
+#include "cutscene_meteor.h"
|
35
|
35
|
#include <callback.h>
|
|
36
|
+#include <config.h>
|
36
|
37
|
#include <debug.h>
|
37
|
38
|
#include <game_engine.h>
|
38
|
|
-#include <config.h>
|
39
|
39
|
#include <math.h>
|
40
|
40
|
|
41
|
41
|
/* === PROTOTYPES === */
|
|
@@ -50,7 +50,6 @@ void sp_dns_switch();
|
50
|
50
|
*/
|
51
|
51
|
void sp_init_script();
|
52
|
52
|
|
53
|
|
-
|
54
|
53
|
/**
|
55
|
54
|
* @brief callasm to call a var-based routine as defined
|
56
|
55
|
*/
|
|
@@ -68,7 +67,6 @@ void sp_random_number();
|
68
|
67
|
|
69
|
68
|
extern void sp_batchmaptile(void);
|
70
|
69
|
|
71
|
|
-
|
72
|
70
|
void get_text_pointer_from_lookup();
|
73
|
71
|
|
74
|
72
|
void sp_check_tileset();
|
|
@@ -78,53 +76,40 @@ extern void sp_crystal_fade(void);
|
78
|
76
|
/* === STATICS === */
|
79
|
77
|
|
80
|
78
|
static callback special_routines[9] = {
|
81
|
|
- met_play,
|
82
|
|
- cam_sp_move_camera,
|
83
|
|
- sp_init_script,
|
84
|
|
- debug_some_test,
|
85
|
|
- sp_dns_switch,
|
86
|
|
- sp_random_number,
|
87
|
|
- sp_check_tileset,
|
88
|
|
- sp_batchmaptile,
|
89
|
|
- sp_crystal_fade,
|
|
79
|
+ met_play, cam_sp_move_camera, sp_init_script, debug_some_test, sp_dns_switch,
|
|
80
|
+ sp_random_number, sp_check_tileset, sp_batchmaptile, sp_crystal_fade,
|
90
|
81
|
};
|
91
|
82
|
|
92
|
83
|
/* === IMPLEMENTATIONS === */
|
93
|
84
|
|
94
|
|
-void sp_dns_switch()
|
95
|
|
-{
|
96
|
|
- volatile u8* test_pointer = (u8*) (0x0203FAB0);
|
97
|
|
- *(test_pointer+1) = (*(test_pointer+1) == 3 ? 0 : (*(test_pointer+1)) + 1);
|
|
85
|
+void sp_dns_switch() {
|
|
86
|
+ volatile u8 *test_pointer = (u8 *)(0x0203FAB0);
|
|
87
|
+ *(test_pointer + 1) = (*(test_pointer + 1) == 3 ? 0 : (*(test_pointer + 1)) + 1);
|
98
|
88
|
*test_pointer = 1;
|
99
|
89
|
}
|
100
|
90
|
|
101
|
|
-void sp_init_script()
|
102
|
|
-{
|
103
|
|
- for(u16 i = 0x1000; i < 0x1800; ++i)
|
104
|
|
- {
|
105
|
|
- flag_clear(i);
|
106
|
|
- }
|
|
91
|
+void sp_init_script() {
|
|
92
|
+ for (u16 i = 0x1000; i < 0x1800; ++i)
|
|
93
|
+ flag_clear(i);
|
|
94
|
+ for (u16 i = 0x5000; i <= 0x5100; ++i)
|
|
95
|
+ var_set(i, 0);
|
107
|
96
|
}
|
108
|
97
|
|
109
|
|
-void sp_special_casm() //special 0x68
|
|
98
|
+void sp_special_casm() // special 0x68
|
110
|
99
|
{
|
111
|
|
- u16* var_special = var_access(CALLASM_VAR);
|
|
100
|
+ u16 *var_special = var_access(CALLASM_VAR);
|
112
|
101
|
special_routines[*var_special]();
|
113
|
102
|
}
|
114
|
103
|
|
115
|
|
-void sp_clear_variables()
|
116
|
|
-{
|
117
|
|
- (void) var_set(MUGHSOT_1_TABLE, 0);
|
118
|
|
- (void) var_set(MUGHSOT_2_TABLE, 0);
|
119
|
|
- (void) var_set(MUGSHOT_1_X, 0);
|
120
|
|
- (void) var_set(MUGSHOT_2_X, 0);
|
121
|
|
- (void) var_set(MUGSHOT_1_Y, 0);
|
122
|
|
- (void) var_set(MUGSHOT_2_Y, 0);
|
123
|
|
- (void) var_set(TEXT_VAR, 0);
|
|
104
|
+void sp_clear_variables() {
|
|
105
|
+ (void)var_set(MUGHSOT_1_TABLE, 0);
|
|
106
|
+ (void)var_set(MUGHSOT_2_TABLE, 0);
|
|
107
|
+ (void)var_set(MUGSHOT_1_X, 0);
|
|
108
|
+ (void)var_set(MUGSHOT_2_X, 0);
|
|
109
|
+ (void)var_set(MUGSHOT_1_Y, 0);
|
|
110
|
+ (void)var_set(MUGSHOT_2_Y, 0);
|
|
111
|
+ (void)var_set(TEXT_VAR, 0);
|
124
|
112
|
return;
|
125
|
113
|
}
|
126
|
114
|
|
127
|
|
-void sp_random_number()
|
128
|
|
-{
|
129
|
|
- var_set(0x800D, (random() % var_get(0x8000)));
|
130
|
|
-}
|
|
115
|
+void sp_random_number() { var_set(0x800D, (random() % var_get(0x8000))); }
|