Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
effect_model.c
Go to the documentation of this file.
1/* FIGHTSTG's effect models, the 3D effects of techniques. */
2
4
5/* An effect model's task: creates its model at its position and rotation on
6 layer BATTLE_LAYER_MODELS and ends when its motion is over */
8 switch (task->state) {
9 case TASK_INIT:
10 default:
11 task->control.layers[0].enabled = 1;
13 task->control.fighter = 0;
14 task->control.layers[0].wireframe = 0;
15 task->control.pos.x = task->pos.vx;
16 task->control.pos.y = task->pos.vy;
17 task->control.pos.z = task->pos.vz;
18 task->control.rot.x = task->rot.vx;
19 task->control.rot.y = task->rot.vy;
20 task->control.rot.z = task->rot.vz;
21 children[0] = FIGHTSTG_createPlainModel(task->file, task->motionFile, task->texPos, &task->control);
22 task->nextState(task);
23 break;
24 case TASK_RUN:
25 if (task->control.motionDone) {
26 task->setState(task, TASK_KILL);
27 }
28 break;
29 case TASK_DONE:
30 case TASK_KILL:
31 break;
32 }
33}
34
35/* the effect models, ended by an id of 0; the European version's differ */
36#if VERSION_US || VERSION_JP
38 { 39, 0x7FE001A, 0x7FE0000 },
39 { 65, 0x7600004, 0x7600000 },
40 { 66, 0x8050004, 0x8050001 },
41 { 85, 0x8290006, 0x8290000 },
42 { 86, 0x82A0007, 0x82A0000 },
43 { 87, 0x7C90016, 0x7C90000 },
44 { 88, 0x76E0006, 0x76E0000 },
45 { 89, 0x7EC0006, 0x7EC0000 },
46 { 90, 0x7F8000A, 0x7F80000 },
47 { 91, 0x7F90008, 0x7F90001 },
48 { 92, 0x7FA0006, 0x7FA0000 },
49 { 93, 0x74A001A, 0x74A0000 },
50 { 94, 0x74C002C, 0x74C0000 },
51 { 95, 0x763000A, 0x7630000 },
52 { 96, 0x7D5001A, 0x7D50004 },
53 { 97, 0x7F50003, 0x7F50000 },
54 { 98, 0x7F70007, 0x7F70000 },
55 { 99, 0x7FB0008, 0x7FB0001 },
56 { 100, 0x7FC0005, 0x7FC0006 },
57 { 101, 0x7ED0003, 0x7ED0001 },
58 { 102, 0x7EE0006, 0x7EE0001 },
59 { 103, 0x7EF0006, 0x7EF0001 },
60 { 106, 0x7F0000E, 0x7F00002 },
61 { 107, 0x7F1000A, 0x7F10001 },
62 { 108, 0x7CA000C, 0x7CA0000 },
63 { 109, 0x7CB001C, 0x7CB0005 },
64 { 113, 0x7FD0005, 0x7FD0006 },
65 { 114, 0x874000C, 0x8740002 },
66 { 115, 0x87D0001, 0x87D0000 },
67 { 116, 0x87E000A, 0x87E0000 },
68 { 201, 0x80D0004, 0x80D0000 },
69 { 202, 0x80E0004, 0x80E0000 },
70 { 203, 0x80F0004, 0x80F0000 },
71 { 204, 0x8100004, 0x8100000 },
72 { 205, 0x8110004, 0x8110000 },
73 { 206, 0x8120004, 0x8120000 },
74 { 207, 0x8130004, 0x8130000 },
75 { 208, 0x8140004, 0x8140000 },
76 { 209, 0x8150004, 0x8150000 },
77 { 210, 0x8160004, 0x8160000 },
78 { 211, 0x8170004, 0x8170000 },
79 { 212, 0x8180004, 0x8180000 },
80 { 213, 0x8190004, 0x8190000 },
81 { 214, 0x81A0004, 0x81A0000 },
82 { 215, 0x81B0004, 0x81B0000 },
83 { 216, 0x81C0004, 0x81C0000 },
84 { 217, 0x81D0004, 0x81D0000 },
85 { 218, 0x81E0004, 0x81E0000 },
86 { 219, 0x81F0004, 0x81F0000 },
87 { 220, 0x8200004, 0x8200000 },
88 { 221, 0x7C00004, 0x7C00000 },
89 { 222, 0x8210004, 0x8210000 },
90 { 223, 0x8220004, 0x8220000 },
91 { 224, 0x8230004, 0x8230000 },
92 { 225, 0x8240004, 0x8240000 },
93 { 226, 0x8250004, 0x8250000 },
94 { 301, 0x82B000E, 0x82B0000 },
95 { 302, 0x82D0015, 0x82D0016 },
96 { 303, 0x82E0004, 0x82E0001 },
97 { 306, 0x82F0004, 0x82F0000 },
98 { 307, 0x8300006, 0x8300000 },
99 { 308, 0x8310008, 0x8310000 },
100 { 309, 0x8320004, 0x8320000 },
101 { 310, 0x834000A, 0x8340000 },
102 { 310, 0x834000A, 0x8340000 },
103 { 311, 0x8350004, 0x8350000 },
104 { 312, 0x8360004, 0x8360000 },
105 { 313, 0x8370004, 0x8370000 },
106 { 314, 0x8380004, 0x8380000 },
107 { 315, 0x839000A, 0x8390000 },
108 { 316, 0x83A0006, 0x83A0001 },
109 { 317, 0x83B0001, 0x83B0000 },
110 { 318, 0x83C0004, 0x83C0001 },
111 { 319, 0x83D000A, 0x83D0006 },
112 { 320, 0x83E000A, 0x83E0000 },
113 { 321, 0x83F0004, 0x83F0000 },
114 { 322, 0x8400004, 0x8400000 },
115 { 323, 0x8410004, 0x8410000 },
116 { 324, 0x8420004, 0x8420000 },
117 { 325, 0x8430004, 0x8430000 },
118 { 326, 0x8440006, 0x8440000 },
119 { 327, 0x845000D, 0x845000E },
120 { 328, 0x8460006, 0x8460000 },
121 { 329, 0x8470006, 0x8470000 },
122 { 330, 0x8480008, 0x8480000 },
123 { 331, 0x8490008, 0x8490000 },
124 { 332, 0x84A0008, 0x84A0000 },
125 { 333, 0x84B000A, 0x84B0000 },
126 { 334, 0x84C000A, 0x84C0000 },
127 { 335, 0x84D0006, 0x84D0000 },
128 { 336, 0x84E0005, 0x84E0006 },
129 { 337, 0x84F000C, 0x84F0000 },
130 { 338, 0x8500006, 0x8500000 },
131 { 339, 0x8510007, 0x8510008 },
132 { 340, 0x8520005, 0x8520006 },
133 { 341, 0x853000C, 0x8530000 },
134 { 342, 0x8540001, 0x8540000 },
135 { 343, 0x8550001, 0x8550000 },
136 { 344, 0x8560000, 0x8560008 },
137 { 345, 0x8570000, 0x8570008 },
138 { 346, 0x8580015, 0x8580016 },
139 { 347, 0x8590004, 0x8590000 },
140 { 348, 0x85A0001, 0x85A0000 },
141 { 349, 0x85B000A, 0x85B0000 },
142 { 350, 0x85C0019, 0x85C001A },
143 { 351, 0x85D000A, 0x85D0000 },
144 { 352, 0x85E0008, 0x85E0000 },
145 { 353, 0x85F0008, 0x85F0000 },
146 { 354, 0x8600009, 0x860000A },
147 { 355, 0x8610001, 0x8610000 },
148 { 356, 0x8620008, 0x8620000 },
149 { 357, 0x8630001, 0x8630000 },
150 { 358, 0x864000A, 0x8640000 },
151 { 359, 0x8650008, 0x8650000 },
152 { 360, 0x866000C, 0x8660002 },
153 { 361, 0x8670011, 0x8670012 },
154 { 362, 0x868000C, 0x8680000 },
155 { 363, 0x8690011, 0x8690012 },
156 { 364, 0x86A0031, 0x86A0032 },
157 { 365, 0x86B001A, 0x86B0000 },
158 { 366, 0x86C0006, 0x86C0000 },
159 { 367, 0x86D0006, 0x86D0000 },
160 { 368, 0x86E0004, 0x86E0001 },
161 { 369, 0x86F0001, 0x86F0000 },
162 { 370, 0x8700012, 0x8700000 },
163 { 371, 0x8710008, 0x8710000 },
164 { 372, 0x872000A, 0x8720000 },
165 { 374, 0x8730012, 0x8730000 },
166 { 375, 0x833000E, 0x8330003 },
167 { 376, 0x8900012, 0x890000C },
168 { 0, 0, 0 },
169};
170#elif VERSION_EU
172 { 39, 0x80D001A, 0x80D0000 },
173 { 65, 0x76F0004, 0x76F0000 },
174 { 66, 0x8140004, 0x8140001 },
175 { 85, 0x83A0006, 0x83A0000 },
176 { 86, 0x83B0007, 0x83B0000 },
177 { 87, 0x7D80016, 0x7D80000 },
178 { 88, 0x77D0006, 0x77D0000 },
179 { 89, 0x7FB0006, 0x7FB0000 },
180 { 90, 0x807000A, 0x8070000 },
181 { 91, 0x8080008, 0x8080001 },
182 { 92, 0x8090006, 0x8090000 },
183 { 93, 0x75A001A, 0x75A0000 },
184 { 94, 0x75C002C, 0x75C0000 },
185 { 95, 0x772000A, 0x7720000 },
186 { 96, 0x7E4001A, 0x7E40004 },
187 { 97, 0x8040003, 0x8040000 },
188 { 98, 0x8060007, 0x8060000 },
189 { 99, 0x80A0008, 0x80A0001 },
190 { 100, 0x80B0005, 0x80B0006 },
191 { 101, 0x7FC0003, 0x7FC0001 },
192 { 102, 0x7FD0006, 0x7FD0001 },
193 { 103, 0x7FE0006, 0x7FE0001 },
194 { 106, 0x7FF000E, 0x7FF0002 },
195 { 107, 0x800000A, 0x8000001 },
196 { 108, 0x7D9000C, 0x7D90000 },
197 { 109, 0x7DA001C, 0x7DA0005 },
198 { 113, 0x80C0005, 0x80C0006 },
199 { 114, 0x885000C, 0x8850002 },
200 { 115, 0x88E0001, 0x88E0000 },
201 { 116, 0x88F000A, 0x88F0000 },
202 { 201, 0x81E0004, 0x81E0000 },
203 { 202, 0x81F0004, 0x81F0000 },
204 { 203, 0x8200004, 0x8200000 },
205 { 204, 0x8210004, 0x8210000 },
206 { 205, 0x8220004, 0x8220000 },
207 { 206, 0x8230004, 0x8230000 },
208 { 207, 0x8240004, 0x8240000 },
209 { 208, 0x8250004, 0x8250000 },
210 { 209, 0x8260004, 0x8260000 },
211 { 210, 0x8270004, 0x8270000 },
212 { 211, 0x8280004, 0x8280000 },
213 { 212, 0x8290004, 0x8290000 },
214 { 213, 0x82A0004, 0x82A0000 },
215 { 214, 0x82B0004, 0x82B0000 },
216 { 215, 0x82C0004, 0x82C0000 },
217 { 216, 0x82D0004, 0x82D0000 },
218 { 217, 0x82E0004, 0x82E0000 },
219 { 218, 0x82F0004, 0x82F0000 },
220 { 219, 0x8300004, 0x8300000 },
221 { 220, 0x8310004, 0x8310000 },
222 { 221, 0x7CF0004, 0x7CF0000 },
223 { 222, 0x8320004, 0x8320000 },
224 { 223, 0x8330004, 0x8330000 },
225 { 224, 0x8340004, 0x8340000 },
226 { 225, 0x8350004, 0x8350000 },
227 { 226, 0x8360004, 0x8360000 },
228 { 301, 0x83C000E, 0x83C0000 },
229 { 302, 0x83E0015, 0x83E0016 },
230 { 303, 0x83F0004, 0x83F0001 },
231 { 306, 0x8400004, 0x8400000 },
232 { 307, 0x8410006, 0x8410000 },
233 { 308, 0x8420008, 0x8420000 },
234 { 309, 0x8430004, 0x8430000 },
235 { 310, 0x845000A, 0x8450000 },
236 { 310, 0x845000A, 0x8450000 },
237 { 311, 0x8460004, 0x8460000 },
238 { 312, 0x8470004, 0x8470000 },
239 { 313, 0x8480004, 0x8480000 },
240 { 314, 0x8490004, 0x8490000 },
241 { 315, 0x84A000A, 0x84A0000 },
242 { 316, 0x84B0006, 0x84B0001 },
243 { 317, 0x84C0001, 0x84C0000 },
244 { 318, 0x84D0004, 0x84D0001 },
245 { 319, 0x84E000A, 0x84E0006 },
246 { 320, 0x84F000A, 0x84F0000 },
247 { 321, 0x8500004, 0x8500000 },
248 { 322, 0x8510004, 0x8510000 },
249 { 323, 0x8520004, 0x8520000 },
250 { 324, 0x8530004, 0x8530000 },
251 { 325, 0x8540004, 0x8540000 },
252 { 326, 0x8550006, 0x8550000 },
253 { 327, 0x856000D, 0x856000E },
254 { 328, 0x8570006, 0x8570000 },
255 { 329, 0x8580006, 0x8580000 },
256 { 330, 0x8590008, 0x8590000 },
257 { 331, 0x85A0008, 0x85A0000 },
258 { 332, 0x85B0008, 0x85B0000 },
259 { 333, 0x85C000A, 0x85C0000 },
260 { 334, 0x85D000A, 0x85D0000 },
261 { 335, 0x85E0006, 0x85E0000 },
262 { 336, 0x85F0005, 0x85F0006 },
263 { 337, 0x860000C, 0x8600000 },
264 { 338, 0x8610006, 0x8610000 },
265 { 339, 0x8620007, 0x8620008 },
266 { 340, 0x8630005, 0x8630006 },
267 { 341, 0x864000C, 0x8640000 },
268 { 342, 0x8650001, 0x8650000 },
269 { 343, 0x8660001, 0x8660000 },
270 { 344, 0x8670000, 0x8670008 },
271 { 345, 0x8680000, 0x8680008 },
272 { 346, 0x8690015, 0x8690016 },
273 { 347, 0x86A0004, 0x86A0000 },
274 { 348, 0x86B0001, 0x86B0000 },
275 { 349, 0x86C000A, 0x86C0000 },
276 { 350, 0x86D0019, 0x86D001A },
277 { 351, 0x86E000A, 0x86E0000 },
278 { 352, 0x86F0008, 0x86F0000 },
279 { 353, 0x8700008, 0x8700000 },
280 { 354, 0x8710009, 0x871000A },
281 { 355, 0x8720001, 0x8720000 },
282 { 356, 0x8730008, 0x8730000 },
283 { 357, 0x8740001, 0x8740000 },
284 { 358, 0x875000A, 0x8750000 },
285 { 359, 0x8760008, 0x8760000 },
286 { 360, 0x877000C, 0x8770002 },
287 { 361, 0x8780011, 0x8780012 },
288 { 362, 0x879000C, 0x8790000 },
289 { 363, 0x87A0011, 0x87A0012 },
290 { 364, 0x87B0031, 0x87B0032 },
291 { 365, 0x87C001A, 0x87C0000 },
292 { 366, 0x87D0006, 0x87D0000 },
293 { 367, 0x87E0006, 0x87E0000 },
294 { 368, 0x87F0004, 0x87F0001 },
295 { 369, 0x8800001, 0x8800000 },
296 { 370, 0x8810012, 0x8810000 },
297 { 371, 0x8820008, 0x8820000 },
298 { 372, 0x883000A, 0x8830000 },
299 { 374, 0x8840012, 0x8840000 },
300 { 375, 0x844000E, 0x8440003 },
301 { 376, 0x8A10012, 0x8A1000C },
302 { 0, 0, 0 },
303};
304#endif
305
306/* The model file of effect model id (FIGHTSTG_effectModels), or 0 for none */
308 EffectModelEntry *entry;
309
310 for (entry = FIGHTSTG_effectModels; entry->id != 0; entry++) {
311 if (entry->id == id) {
312 return entry->file >> 16;
313 }
314 }
315 return 0;
316}
317
318/* Starts the effect model id at pos and rot, its model in
319 FIGHTSTG_effectModels and its textures at (0x280, 0x100); killed at once
320 when id has no entry. The match depends on the entry pointer and on texPos
321 set as one Vec2 (as two members, gcc stores them sooner). */
322EffectModel *FIGHTSTG_startEffectModel(s32 id, SVECTOR *pos, SVECTOR *rot) {
324 EffectModelEntry *entry;
325
326 task->effect = 0;
327 for (entry = FIGHTSTG_effectModels; entry->id != 0; entry++) {
328 if (entry->id == id) {
329 task->effect = id;
330 task->motionFile = entry->motionFile;
331 task->file = entry->file;
332 task->texPos = (Vec2){ 0x280, 0x100 };
333 task->pos = *pos;
334 task->rot = *rot;
335 break;
336 }
337 }
338 if (task->effect == 0) {
339 task->setState(task, TASK_KILL);
340 }
341 return task;
342}
#define BATTLE_LAYER_MODELS
Definition types.h:30
FIGHTSTG.PRO: the battle.
signed int s32
Definition common.h:11
EffectModelEntry FIGHTSTG_effectModels[]
the effect models, ended by an id of 0; the European version's differ
EffectModel * FIGHTSTG_startEffectModel(s32 id, SVECTOR *pos, SVECTOR *rot)
Starts the effect model id at pos and rot, its model in FIGHTSTG_effectModels and its textures at (0x...
s32 FIGHTSTG_getEffectModelFile(s32 id)
The model file of effect model id (FIGHTSTG_effectModels), or 0 for none.
void FIGHTSTG_updateEffectModel(EffectModel *task, Model **children)
An effect model's task: creates its model at its position and rotation on layer BATTLE_LAYER_MODELS a...
Definition effect_model.c:7
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
Model * FIGHTSTG_createPlainModel(s32 file, s32 motionFile, Vec2 texPos, ModelControl *control)
A model whose motions just end (FIGHTSTG_createModel)
Definition model_mesh.c:502
A battle effect that is a model (FIGHTSTG_startEffectModel): FIGHTSTG_effectModels lists them,...
Definition model.h:166
s32 file
the model's file and index
Definition model.h:168
Shows an effect's model at a place until its motion ends (FIGHTSTG_startEffectModel)
Definition model.h:174
SVECTOR rot
Definition model.h:180
SVECTOR pos
Definition model.h:179
void(* nextState)(struct EffectModel *task)
Definition model.h:175
void(* setState)(struct EffectModel *task, s32 state)
Definition model.h:175
s32 motionFile
Definition model.h:178
Vec2 texPos
Definition model.h:181
s32 effect
0 if it has no entry
Definition model.h:176
s32 state
Definition model.h:175
s32 file
Definition model.h:177
ModelControl control
Definition model.h:182
ShortVec3 rot
Definition model.h:108
s32 wireframe
they are drawn as wireframe (Mesh.drawWireframe)
Definition model.h:114
s32 enabled
Definition model.h:112
ShortVec3 pos
Definition model.h:107
s32 layerId
the layer its meshes are drawn in
Definition model.h:113
struct ModelControl::@3 layers[2]
the model is drawn once for each one enabled
s32 fighter
the Models task's
Definition model.h:105
s32 motionDone
Definition model.h:104
A 3D model (FIGHTSTG_createModel), registered with id 0x11: a tree of bones, each drawn by a Mesh chi...
Definition model.h:132
s16 x
Definition model.h:15
s16 z
Definition model.h:17
s16 y
Definition model.h:16
Any task, seen through its header.
Definition task.h:62
Definition gfx.h:352
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
Definition task.c:105