Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
foliage.hpp
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3#include "model.h"
4#include "effects.h"
5
6struct FoliageModelList {
7 s32 count;
8 s32* models;
9};
10
18
19struct FoliageDropList {
20 s32 count;
22};
23
24struct FoliageVectorList {
25 s32 count;
27};
28
29struct SearchBushConfig {
34};
35
36struct ShakeTreeConfig {
42};
43
44namespace foliage {
47}
48
49//used for shaking a bush that doesn't drop anything
50#define DEFINE_BUSH(name, model, pos_macro) \
51 namespace name { \
52 s32 BushModelsData[] = { model }; \
53 FoliageModelList BushModels = { .count = 1, .models = BushModelsData }; \
54 Vec3i EffectsData[] = { \
55 { pos_macro }, \
56 }; \
57 FoliageVectorList Effects = { \
58 .count = 1, \
59 .vectors = EffectsData, \
60 }; \
61 SearchBushConfig SearchBush = { \
62 .bush = &BushModels, \
63 .drops = NULL, \
64 .vectors = &Effects, \
65 }; \
66 }; \
67
68#define DEFINE_BUSH_WITH_DROP(name, model, pos_macro, item, spawn_mode, pickup_flag, spawn_flag) \
69 namespace name { \
70 s32 BushModelsData[] = { model }; \
71 FoliageModelList BushModels = { .count = 1, .models = BushModelsData }; \
72 FoliageDrop DropsData[] = { \
73 { \
74 .itemID = item, \
75 .pos = { pos_macro }, \
76 .spawnMode = spawn_mode, \
77 .pickupFlag = pickup_flag, \
78 .spawnFlag = spawn_flag, \
79 }, \
80 }; \
81 FoliageDropList Drops = { \
82 .count = 1, \
83 .drops = DropsData, \
84 }; \
85 Vec3i EffectsData[] = { \
86 { pos_macro }, \
87 }; \
88 FoliageVectorList Effects = { \
89 .count = 1, \
90 .vectors = EffectsData, \
91 }; \
92 SearchBushConfig SearchBush = { \
93 .bush = &BushModels, \
94 .drops = &Drops, \
95 .vectors = &Effects, \
96 }; \
97 }; \
98
99#define DEFINE_TREE(name, leaf_model, trunk_model, bomb_pos, bomb_diameter) \
100 namespace name { \
101 s32 LeafModelsData[] = { leaf_model }; \
102 FoliageModelList LeafModels = { .count = ARRAY_COUNT(LeafModelsData), .models = LeafModelsData }; \
103 s32 TrunkModelsData[] = { trunk_model }; \
104 FoliageModelList TrunkModels = { .count = ARRAY_COUNT(TrunkModelsData), .models = TrunkModelsData }; \
105 ShakeTreeConfig ShakeTree = { \
106 .leaves = &LeafModels, \
107 .trunk = &TrunkModels, \
108 .drops = NULL, \
109 }; \
110 BombTrigger BombPos = { \
111 .pos = { bomb_pos }, \
112 .diameter = bomb_diameter, \
113 }; \
114 }; \
115
116#define DEFINE_TREE_NO_LEAVES(name, trunk_model, bomb_pos, bomb_diameter) \
117 namespace name { \
118 s32 TrunkModelsData[] = { trunk_model }; \
119 FoliageModelList TrunkModels = { .count = 1, .models = TrunkModelsData }; \
120 ShakeTreeConfig ShakeTree = { \
121 .leaves = NULL, \
122 .trunk = &TrunkModels, \
123 .drops = NULL, \
124 }; \
125 BombTrigger BombPos = { \
126 .pos = { bomb_pos }, \
127 .diameter = bomb_diameter, \
128 }; \
129 }; \
130
131#define DEFINE_TREE_WITH_FALLING_LEAVES(name, leaf_model, trunk_model, bomb_pos, bomb_diameter, falling_leaves) \
132 namespace name { \
133 FoliageVectorList Vectors = { \
134 .count = ARRAY_COUNT(falling_leaves), \
135 .vectors = falling_leaves, \
136 }; \
137 s32 LeafModelsData[] = { leaf_model }; \
138 FoliageModelList LeafModels = { .count = 1, .models = LeafModelsData }; \
139 s32 TrunkModelsData[] = { trunk_model }; \
140 FoliageModelList TrunkModels = { .count = 1, .models = TrunkModelsData }; \
141 ShakeTreeConfig ShakeTree = { \
142 .leaves = &LeafModels, \
143 .trunk = &TrunkModels, \
144 .drops = NULL, \
145 .vectors = &Vectors, \
146 }; \
147 BombTrigger BombPos = { \
148 .pos = { bomb_pos }, \
149 .diameter = bomb_diameter, \
150 }; \
151 }; \
152
153#define DEFINE_TREE_WITH_DROP(name, leaf_model, trunk_model, bomb_pos, bomb_diameter, pos_macro, item, spawn_mode, spawn_flag) \
154 namespace name { \
155 s32 LeafModelsData[] = { leaf_model }; \
156 FoliageModelList LeafModels = { .count = 1, .models = LeafModelsData }; \
157 s32 TrunkModelsData[] = { trunk_model }; \
158 FoliageModelList TrunkModels = { .count = 1, .models = TrunkModelsData }; \
159 FoliageDrop DropsData[] = { \
160 { \
161 .itemID = item, \
162 .pos = { pos_macro }, \
163 .spawnMode = spawn_mode, \
164 .spawnFlag = spawn_flag, \
165 }, \
166 }; \
167 FoliageDropList Drops = { \
168 .count = 1, \
169 .drops = DropsData, \
170 }; \
171 ShakeTreeConfig ShakeTree = { \
172 .leaves = &LeafModels, \
173 .trunk = &TrunkModels, \
174 .drops = &Drops, \
175 }; \
176 BombTrigger BombPos = { \
177 .pos = { bomb_pos }, \
178 .diameter = bomb_diameter, \
179 }; \
180 }; \
181
183#define DEFINE_TREE_WITH_FALLING_LEAVES_WITH_DROP(name, leaf_model, trunk_model, bomb_pos, bomb_diameter, falling_leaves, pos_macro, item, spawn_mode, spawn_flag) \
184 namespace name { \
185 FoliageVectorList Vectors = { \
186 .count = ARRAY_COUNT(falling_leaves), \
187 .vectors = falling_leaves, \
188 }; \
189 s32 LeafModelsData[] = { leaf_model }; \
190 FoliageModelList LeafModels = { .count = 1, .models = LeafModelsData }; \
191 s32 TrunkModelsData[] = { trunk_model }; \
192 FoliageModelList TrunkModels = { .count = 1, .models = TrunkModelsData }; \
193 FoliageDrop DropsData[] = { \
194 { \
195 .itemID = item, \
196 .pos = { pos_macro }, \
197 .spawnMode = spawn_mode, \
198 .spawnFlag = spawn_flag, \
199 }, \
200 }; \
201 FoliageDropList Drops = { \
202 .count = 1, \
203 .drops = DropsData, \
204 }; \
205 ShakeTreeConfig ShakeTree = { \
206 .leaves = &LeafModels, \
207 .trunk = &TrunkModels, \
208 .drops = &Drops, \
209 .vectors = &Vectors, \
210 }; \
211 BombTrigger BombPos = { \
212 .pos = { bomb_pos }, \
213 .diameter = bomb_diameter, \
214 }; \
215 }; \
216
217#define BIND_BUSH(name, collider) \
218 Set(LVar0, Ref(name::SearchBush)) \
219 BindTrigger(Ref(foliage::EVS_SearchBush), TRIGGER_WALL_PRESS_A, collider, 1, 0)
220
221#define BIND_TREE(name, collider) \
222 Set(LVar0, Ref(name::ShakeTree)) \
223 BindTrigger(Ref(foliage::EVS_ShakeTree), TRIGGER_WALL_HAMMER, collider, 1, 0) \
224 BindTrigger(Ref(foliage::EVS_ShakeTree), TRIGGER_POINT_BOMB, Ref(name::BombPos), 1, 0)
Bytecode EvtScript[]
s32 Bytecode
Definition evt.h:7
FoliageDropList * drops
Bytecode spawnFlag
Definition foliage.hpp:16
Bytecode pickupFlag
Definition foliage.hpp:15
FoliageVectorList * vectors
FoliageModelList * trunk
FoliageModelList * bush
FoliageVectorList * vectors
FoliageDropList * drops
s32 spawnMode
Definition foliage.hpp:14
FoliageDrop * drops
Definition foliage.hpp:21
FoliageModelList * leaves
Vec3i pos
Definition foliage.hpp:13
EvtScript EVS_SearchBush
Definition foliage.cpp:46
EvtScript EVS_ShakeTree
Definition foliage.cpp:118