-
Notifications
You must be signed in to change notification settings - Fork 3
/
red_coin_value_dist.patch
52 lines (48 loc) · 1.37 KB
/
red_coin_value_dist.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c
index 87dd3d6..ccf0bc6 100644
--- a/src/game/object_list_processor.c
+++ b/src/game/object_list_processor.c
@@ -9,6 +9,8 @@
#include "engine/graph_node.h"
#include "engine/surface_collision.h"
#include "engine/surface_load.h"
+#include "game_init.h"
+#include "gfx_dimensions.h"
#include "interaction.h"
#include "level_update.h"
#include "mario.h"
@@ -17,6 +19,7 @@
#include "object_helpers.h"
#include "object_list_processor.h"
#include "platform_displacement.h"
+#include "print.h"
#include "profiler.h"
#include "spawn_object.h"
@@ -267,6 +270,21 @@ void spawn_particle(u32 activeParticleFlag, s16 model, const BehaviorScript *beh
}
}
+s16 gRedCoinDistActive;
+
+void print_value_of_nearest_red_coin(void) {
+ s32 redCount = count_objects_with_behavior(bhvRedCoin);
+ s32 redDist = (s32) cur_obj_dist_to_nearest_object_with_behavior(bhvRedCoin);
+
+ if (gPlayer1Controller->buttonPressed & L_TRIG) {
+ gRedCoinDistActive ^= 1;
+ }
+
+ if (redCount && gRedCoinDistActive) {
+ print_text_fmt_int(GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(20), 20, "RED %d", redDist / 100);
+ }
+}
+
/**
* Mario's primary behavior update function.
*/
@@ -290,6 +308,8 @@ void bhv_mario_update(void) {
i++;
}
+
+ print_value_of_nearest_red_coin();
}
/**