fork/training-mode-ce

git clone https://git.julia.blue/fork/training-mode-ce

jamsEggs-ercise ASM to C rewrite (#310)305b2f6

techchase-camera
48.5 KiB1055 linesraw
1#ifndef MEX_H_ITEM
2#define MEX_H_ITEM
3
4#include "structs.h"
5#include "datatypes.h"
6#include "obj.h"
7#include "gx.h"
8#include "color.h"
9#include "dynamics.h"
10#include <stdbool.h>
11
12// Item IDs
13enum ItemID
14{
15    ITEM_CAPSULE,
16    ITEM_BOX,
17    ITEM_BARREL,
18    ITEM_EGG,
19    ITEM_PARTYBALL,
20    ITEM_BARRELCANNON,
21    ITEM_BOBOMB,
22    ITEM_MRSATURN,
23    ITEM_HEARTCONTAINER,
24    ITEM_MAXIMTOMATO,
25    ITEM_STARMAN,
26    ITEM_HOMERUNBAT,
27    ITEM_BEAMSWORD,
28    ITEM_PARASOL,
29    ITEM_GREENSHELL,
30    ITEM_REDSHELL,
31    ITEM_RAYGUN,
32    ITEM_FREEZIE,
33    ITEM_FOOD,
34    ITEM_MOTIONSENSORBOMB,
35    ITEM_FLIPPER,
36    ITEM_SUPERSCOPE,
37    ITEM_STARROD,
38    ITEM_LIPSSTICK,
39    ITEM_FAN,
40    ITEM_FIREFLOWER,
41    ITEM_SUPERMUSHROOM,
42    ITEM_POISONMUSHROOM,
43    ITEM_HAMMER,
44    ITEM_WARPSTAR,
45    ITEM_SCREWATTACK,
46    ITEM_BUNNYHOOD,
47    ITEM_METALBOX,
48    ITEM_CLOAKINGDEVICE,
49    ITEM_POKEBALL,
50    ITEM_RAYGUNUNK,
51    ITEM_STARRODSTAR,
52    ITEM_LIPSSTICKDUST,
53    ITEM_SUPERSCOPEBEAM,
54    ITEM_RAYGUNBEAM,
55    ITEM_HAMMERHEAD,
56    ITEM_FLOWER,
57    ITEM_YOSHISEGG,
58    ITEM_GOOMBA,
59    ITEM_REDEAD,
60    ITEM_OCTAROK,
61    ITEM_OTTOSEA,
62    ITEM_STONE,
63    ITEM_MARIOFIRE,
64    ITEM_DRMARIOPILL,
65    ITEM_KIRBYCUTTER,
66    ITEM_KIRBYHAMMER,
67    ITEM_KIRBYABILITYSTAR,
68    ITEM_53,
69    ITEM_FOXLASER,
70    ITEM_FALCOLASER,
71    ITEM_FOXILLUSION,
72    ITEM_FALCOPHANTASM,
73    ITEM_LINKBOMB,
74    ITEM_CLINKBOMB,
75    ITEM_LINKBOOMERANG,
76    ITEM_CLINKBOOMERANG,
77    ITEM_LINKHOOKSHOT,
78    ITEM_CLINKHOOKSHOT,
79    ITEM_LINKARROW,
80    ITEM_CLINKARROW,
81    ITEM_NESSPKFIRE,
82    ITEM_NESSPKFIREEXPLODE,
83    ITEM_NESSPKFLASH,
84    ITEM_NESSPKTHUNDER,
85    ITEM_NESSPKTHUNDER1,
86    ITEM_NESSPKTHUNDER2,
87    ITEM_NESSPKTHUNDER3,
88    ITEM_NESSPKTHUNDER4,
89    ITEM_FOXGUN,
90    ITEM_FALCOGUN,
91    ITEM_LINKBOW,
92    ITEM_CLINKBOW,
93    ITEM_NESSPKFLASHEXPLODE,
94    ITEM_SHEIKNEEDLETHROWN,
95    ITEM_SHEIKNEEDLEHELD,
96    ITEM_PIKACHUTHUNDER,
97    ITEM_PICHUTHUNDER,
98    ITEM_MARIOCAPE,
99    ITEM_DRMARIOCAPE,
100    ITEM_SHEIKSMOKE,
101    ITEM_YOSHIEGGTHROWN,
102    ITEM_87,
103    ITEM_YOSHISTAR,
104    ITEM_89,
105    ITEM_90,
106    ITEM_91,
107    ITEM_92,
108    ITEM_SAMUSBOMB,
109    ITEM_SAMUSCHARGESHOT,
110    ITEM_SAMUSMISSILE,
111    ITEM_SAMUSGRAPPLE,
112    ITEM_SHEIKCHAIN,
113    ITEM_PEACHBOMBER,
114    ITEM_PEACHTURNIP,
115    ITEM_BOWSERFLAME,
116    ITEM_NESSBAT,
117    ITEM_NESSYOYO,
118    ITEM_PEACHPARASOL,
119    ITEM_PEACHTOAD,
120    ITEM_LUIGIFIRE,
121    ITEM_ICECLIMBERICE,
122    ITEM_ICECLIMBERBLIZZARD,
123    ITEM_ZELDAFIRE,
124    ITEM_ZELDAFIREEXPLODE,
125    ITEM_110,
126    ITEM_PEACHTOADSPORE,
127    ITEM_MEWTWOSHADOWBALL,
128    ITEM_ICECLIMBERROPE,
129    ITEM_GAWPESTICIDE,
130    ITEM_GAWMANHOLE,
131    ITEM_GAWFIRE,
132    ITEM_GAWPARACHUTE,
133    ITEM_GAWTURTLE,
134    ITEM_GAWSPERKY,
135    ITEM_GAWJUDGE,
136    ITEM_119,
137    ITEM_GAWSAUSAGE,
138    ITEM_CLINKMILK,
139    ITEM_GAWFIREFIGHTER,
140
141    // pokemon
142    ITEM_POKERANDOM = 160,
143    ITEM_GOLDEEN,
144    ITEM_CHICORITA,
145    ITEM_SNORLAX,
146    ITEM_BLASTOISE,
147    ITEM_WEEZING,
148    ITEM_CHARIZARD,
149    ITEM_MOLTRES,
150    ITEM_ZAPDOS,
151    ITEM_ARCTICUNO,
152    ITEM_WOBBUFFET,
153    ITEM_SCIZOR,
154    ITEM_UNOWN,
155    ITEM_ENTEI,
156    ITEM_RAIKOU,
157    ITEM_SUICUNE,
158    ITEM_BELLOSSOM,
159    ITEM_ELECTRODE,
160    ITEM_LUGIA,
161    ITEM_HOOH,
162    ITEM_DITTO,
163    ITEM_CLEFAIRY,
164    ITEM_TOGEPI,
165    ITEM_MEW,
166    ITEM_CELEBI,
167    ITEM_STARYU,
168    ITEM_CHANSEY,
169    ITEM_PORYGON2,
170    ITEM_CYNDAQUIL,
171    ITEM_MARILL,
172    ITEM_VENUSAUR,
173
174    // stage
175    ITEM_OLDGOOMBA = 208,
176    ITEM_TARGET,
177    ITEM_BIRDOEGG = 236,
178};
179
180// ItemStateChange Flags
181#define ITEMSTATE_UPDATEANIM 0x2
182#define ITEMSTATE_GRAB 0x4
183#define ITEMSTATE_KEEPHIT 0x10 // dont remove hitboxes on state change
184
185// Item hold_kind definitions
186enum ItHoldKind
187{
188    ITHOLD_NONE,      // no hand change
189    ITHOLD_OPENIN,    // open palm, facing inwards (towards fighter)
190    ITHOLD_SWORD,     // closed palm, holding thin long object
191    ITHOLD_OPENDOWN,  // open palm, facing down
192    ITHOLD_OPENFRONT, // open palm, facing forward
193};
194enum ItUnkKind
195{
196    ITUNK_HAND,  // held item, like a capsule
197    ITUNK_HEAVY, // overhead item, like a crate
198    ITUNK_2,
199    ITUNK_3,
200    ITUNK_4,
201    ITUNK_5,
202    ITUNK_6,
203    ITUNK_7,
204    ITUNK_NONE, // unable to be held
205};
206
207/*** Structs ***/
208
209struct ItemModelDesc
210{
211    JOBJ *model;
212    int bone_count;
213    int bone_attach_id;
214    int bit_field;
215};
216
217struct ItemStateDesc
218{
219    void *anim_joint;
220    void *matanim_joint;
221    void *param;
222    void *script;
223};
224
225struct ItemDesc
226{
227    int *common_attributes;
228    int *unqiue_attributes;
229    int *hurtboxes;
230    ItemStateDesc *states;
231    ItemModelDesc *model;
232    int *dynamics;
233};
234
235struct itCommonData
236{
237    int x00;
238    int x04;
239    int x08;
240    int x0C;
241    int x10;
242    int x14;
243    int x18;
244    int x1C;
245    int x20;
246    int x24;
247    int x28;
248    int x2C;
249    int x30;
250    int x34;
251    int x38;
252    int x3C;
253    int x40;
254    int x44;
255    float x48;
256    float x4C;
257    float x50;
258    float x54;
259    float x58;
260    float x5C;
261    float x60;
262    float x64;
263    float x68;
264    float x6C;
265    float x70;
266    float x74;
267    float x78;
268    float x7C;
269    float x80;
270    float x84;
271    float x88;
272    float x8C;
273    float x90;
274    float x94;
275    float x98;
276    float x9C;
277    float xA0;
278    float xA4;
279    float xA8;
280    float xAC;
281    float xB0;
282    int xB4;
283    float xB8;
284    float xBC;
285    float xC0;
286    float xC4;
287    float xC8;
288    float xCC;
289    float xD0;
290    float xD4;
291    int xD8;
292    int xDC;
293    float xE0;
294    float xE4;
295    float xE8;
296    float xEC;
297    float xF0;
298    float xF4;
299    float xF8;
300    int xFC;
301    int x100;
302    int x104;
303    int x108;
304    int x10C;
305    int x110;
306    int x114;
307    int x118;
308    int x11C;
309    int x120;
310    int x124;
311    int x128;
312    int x12C;
313    int x130;
314    int x134;
315    int x138;
316    int x13C;
317    int x140;
318    float x144;
319    int x148;
320    float x14C;
321    float x150;
322    float x154;
323    float x158;
324    float x15C;
325};
326
327struct itPublicData
328{
329    itCommonData *common_data;
330    ItemDesc **common_items;
331    ItemDesc **adventure_items;
332    ItemDesc **pokemon_items;
333    int *x10;
334    int *x14;
335};
336
337struct itData
338{
339    itCommonAttr *param;  // 0x00
340    float *param_ext;     // 0x04
341    void *hurtboxes;      // 0x08
342    void *states;         // 0x0C
343    void *model;          // 0x10
344    ItDynamics *dynamics; // 0x14
345};
346
347struct itCommonAttr
348{
349    char is_heavy : 1;          // 0x0, bit 0x80, is heavy item (crate)
350    char x0_78 : 4;             // unk
351    char hold_kind : 3;         // defines hand hold behavior
352    unsigned char x1_1 : 1;     // 0x1 0x80
353    unsigned char x1_2 : 1;     // 0x1 0x40
354    unsigned char x1_3 : 1;     // 0x1 0x20
355    unsigned char x1_4 : 1;     // 0x1 0x10
356    unsigned char x1_5 : 1;     // 0x1 0x08
357    unsigned char cam_kind : 2; // 0x1 0x06, is stored to 0xdcd
358    unsigned char x1_8 : 1;     // 0x1 0x01    char flags3; //0x2
359    char flags4;                // 0x3
360    float throw_speed_mult;     // 0x4, speed multiplier at which this item is thrown at
361    int x8;                     //
362    float spin_speed;           //
363    float fall_speed;           // 0x10
364    float fall_speed_max;       // 0x14
365    float x18;                  //
366    float dmg_mult;             // collision related? referenced on taking damage @ 80270f90
367    int x20;                    // 0x20
368    int x24;                    // 0x24
369    int x28;                    // 0x28
370    int x2c;                    // 0x2c
371    int x30;                    // 0x30
372    float x34;                  // 0x34
373    Vec2 grab_range;            // 0x38
374    float ecb_top;              // 0x40
375    float ecb_bot;              // 0x44
376    float ecb_right;            // 0x48
377    float ecb_left;             // 0x4c
378    float weight;               // 0x50
379    int x54;                    // 0x54
380    int x58;                    // 0x58
381    int x5c;                    // 0x5c
382    float scale;                // 0x60, does not affect hitboxes
383    int destroy_gfx;            // 0x64, ID of a gfx to play on destroy
384    int x68;                    // 0x68
385    int x6c;                    // 0x6c
386    int x70;                    // 0x70
387    int x74;                    // 0x74
388    int destroy_sfx;            // 0x78
389    int x7c;                    // 0x7c
390    int x80;                    // 0x80
391    int x84;                    // 0x84
392    int x88;                    // 0x88
393    int x8c;                    // 0x8c
394    int x90;                    // 0x90
395    int x94;                    // 0x94
396    int x98;                    // 0x98
397    int x9c;                    // 0x9c
398};
399
400struct ItemState
401{
402    int state;
403    void *animCallback;
404    void *physCallback;
405    void *collCallback;
406};
407
408struct SpawnItem
409{
410    GOBJ *parent_gobj;                  // 0x0
411    GOBJ *parent_gobj2;                 // 0x4
412    int it_kind;                        // 0x8, id of the item to spawn
413    int hold_kind;                      // 0xC, defines the behavior of the item, such as thrown and pickup. 0 = capsule
414    int unk2;                           // 0x10
415    Vec3 pos;                           // 0x14
416    Vec3 pos2;                          // 0x20
417    Vec3 vel;                           // 0x2C
418    float facing_direction;             // 0x38
419    short damage;                       // 0x3C
420    short unk5;                         // 0x3E
421    int unk6;                           // 0x40, 1 = correct initial position
422    unsigned char is_raycast_below : 1; // 0x44, 0x80 = perform initial collision check
423    int is_spin;                        // 0x48, enables item spinning
424};
425
426struct itHit
427{
428    int active;                               // 0x0
429    int x4;                                   // 0x4, depends on
430    int dmg;                                  // 0x8, projected damage
431    float dmg_f;                              // 0xc, staled damage, actually applied
432    Vec3 offset;                              // 0x10
433    float size;                               // 0x1c
434    int angle;                                // 0x20
435    int kb_growth;                            // 0x24
436    int wdsk;                                 // 0x28
437    int kb;                                   // 0x2c
438    int attribute;                            // 0x30
439    int shield_dmg;                           // 0x34
440    int hitsound_severity;                    // 0x38. hurtbox interaction. 0 = none, 1 = grounded, 2 = aerial, 3 = both
441    int hitsound_kind;                        // 0x3c
442    unsigned char x401 : 1;                   // 0x40 0x80
443    unsigned char x402 : 1;                   // 0x40 0x40
444    unsigned char hit_air : 1;                // 0x40 0x20. bool to check against aerial fighters
445    unsigned char hit_ground : 1;             // 0x40 0x10. bool to check against grounded fighters
446    unsigned char x405 : 1;                   // 0x40 0x08
447    unsigned char x406 : 1;                   // 0x40 0x04
448    unsigned char x407 : 1;                   // 0x40 0x02
449    unsigned char x408 : 1;                   // 0x40 0x01
450    unsigned char x41_80 : 1;                 // 0x41 0x80
451    unsigned char x41_40 : 1;                 // 0x41 0x40
452    unsigned char x41_20 : 1;                 // 0x41 0x20
453    unsigned char x41_10 : 1;                 // 0x41 0x10
454    unsigned char timed_rehit_on_item : 1;    // 0x41 0x08
455    unsigned char timed_rehit_on_fighter : 1; // 0x41 0x04
456    unsigned char timed_rehit_on_shield : 1;  // 0x41 0x02
457    unsigned char can_reflect : 1;            // 0x41 0x01
458    unsigned char can_absorb : 1;             // 0x42 0x80
459    unsigned char x42_40 : 1;                 // 0x42 0x40
460    unsigned char hit_facing : 1;             // 0x42 0x20. bool to only hit fighters facing the item
461    unsigned char can_deflect : 1;            // 0x42 0x10
462    unsigned char unk_reflect : 1;            // 0x42 0x08     ignore reflect?
463    unsigned char no_hurt : 1;                // 0x42 0x04     ignore hurtbox
464    unsigned char ignore_ungrab_hurtbox : 1;  // 0x42 0x02
465    unsigned char x42_01 : 1;                 // 0x42 0x01
466    unsigned char hit_item : 1;               // 0x43 0x80
467    unsigned char x432 : 1;                   // 0x43 0x40
468    unsigned char hit_all : 1;                // 0x43 0x20
469    unsigned char x434 : 1;                   // 0x43 0x10
470    unsigned char x435 : 1;                   // 0x43 0x08
471    unsigned char x436 : 1;                   // 0x43 0x04
472    unsigned char x437 : 1;                   // 0x43 0x02
473    unsigned char x438 : 1;                   // 0x43 0x01
474    int x44;                                  // 0x44
475    JOBJ *bone;                               // 0x48
476    Vec3 pos;                                 // 0x4c
477    Vec3 pos_prev;                            // 0x58
478    Vec3 pos_coll;                            // 0x64   position of hurt collision
479    float coll_distance;                      // 0x70   Distance From Collding Hurtbox (Used for phantom hit collision calculation)
480    HitVictim victims[24];                    // 0x74
481    int x134;                                 // 0x134
482    int x138;                                 // 0x138
483};
484
485struct ItHurt
486{
487    int hurt_status;              // 0x0
488    Vec3 hurt1_offset;            // 0x4
489    Vec3 hurt2_offset;            // 0x10
490    float scale;                  // 0x1c
491    JOBJ *jobj;                   // 0x20
492    unsigned char is_updated : 1; // 0x24, if enabled, wont update position
493    unsigned char x24_2 : 1;      // 0x24 0x40
494    unsigned char x24_3 : 1;      // 0x24 0x20
495    unsigned char x24_4 : 1;      // 0x24 0x10
496    unsigned char x24_5 : 1;      // 0x24 0x08
497    unsigned char x24_6 : 1;      // 0x24 0x04
498    unsigned char x24_7 : 1;      // 0x24 0x02
499    unsigned char x24_8 : 1;      // 0x24 0x01
500    Vec3 hurt1_pos;               // 0x28
501    Vec3 hurt2_pos;               // 0x34
502    int bone_index;               // 0x40
503};
504
505struct ItDynamics
506{
507    int dynamics_num;            // 0x8 number of dynamic bonesets for this fighter
508    DynamicsDesc *dynamics_desc; // 0x4 boneset data array (one for each boneset)
509};
510
511struct ItDynamicBoneset
512{
513    int apply_phys_num;     // if this is 256, dyanmics are not processed
514    JOBJ *root_bone;        // 0x4, is referenced when adding aobjs @ 80268c24, im guessing to skip adding the anims for dyn bones
515    DynamicBoneset boneset; // 0x8
516};
517
518struct ItemData
519{
520    int x0;                                             // 0x0
521    GOBJ *item;                                         // 0x0
522    int x8;                                             // 0x8
523    int spawn_kind;                                     // 0xC
524    int kind;                                           // 0x10
525    int x14;                                            // 0x14
526    int x18;                                            // 0x18
527    int x1c;                                            // 0x1c
528    u8 team_id;                                         // 0x20
529    int state;                                          // 0x24
530    int x28;                                            // 0x28
531    float facing_direction;                             // 0x2c
532    int x30;                                            // 0x30
533    float spin_unk;                                     // 0x34
534    float scale;                                        // 0x38
535    int x3c;                                            // 0x3c
536    Vec3 self_vel;                                      // 0x40
537    Vec3 pos;                                           // 0x4C
538    Vec3 vel_unk;                                       // 0x58 - 0x64
539    Vec3 vel_unk2;                                      // 0x64 - 0x70
540    Vec3 vel_nudge;                                     // 0x70 - 0x7C
541    Vec3 x7c;                                           // 0x7c
542    Vec3 x88;                                           // 0x88
543    int x94;                                            // 0x94
544    int x98;                                            // 0x98
545    int x9c;                                            // 0x9c
546    int xa0;                                            // 0xa0
547    int xa4;                                            // 0xa4
548    int xa8;                                            // 0xa8
549    int xac;                                            // 0xac
550    int xb0;                                            // 0xb0
551    int xb4;                                            // 0xb4
552    struct                                              //
553    {                                                   //
554        ItemState *item_states;                         // 0x0
555        void (*OnCreate)(GOBJ *item);                   // 0x4
556        void (*OnDestroy)(GOBJ *item);                  // 0x8
557        void (*OnPickup)(GOBJ *item);                   // 0xC
558        void (*OnDrop)(GOBJ *item);                     // 0x10
559        void (*OnThrow)(GOBJ *item);                    // 0x14
560        int (*OnGiveDamage)(GOBJ *item);                // 0x18, returns isDestroy
561        int (*OnTakeDamage)(GOBJ *item);                // 0x1c, returns isDestroy
562        void (*OnEnterAir)(GOBJ *item);                 // 0x20
563        void (*OnReflect)(GOBJ *item);                  // 0x24
564        void (*x28)(GOBJ *item);                        // 0x28
565        void (*x2c)(GOBJ *item);                        // 0x2c
566        int (*OnShieldBounce)(GOBJ *item);              // 0x30, returns isDestroy
567        int (*OnShieldHit)(GOBJ *item);                 // 0x34, returns isDestroy
568        void (*x38)(GOBJ *item);                        // 0x38
569    } *it_func;                                         // 0xb8, persistent item callbacks
570    ItemState *item_states;                             // 0xbc
571    int air_state;                                      // 0xc0
572    itData *itData;                                     // 0xc4
573    JOBJ *joint;                                        // 0xc8
574    itCommonAttr *common_attr;                          // 0xcc
575    int xd0;                                            // 0xd0
576    ItDynamicBoneset dynamics_boneset[24];              // 0xd4
577    int dynamics_num;                                   // 0x374
578    CollData coll_data;                                 // 0x378 -> 0x518
579    GOBJ *fighter_gobj;                                 // 0x518
580    int x51c;                                           // 0x51c
581    CmSubject *camera_subject;                          // 0x520
582    int x524;                                           // 0x524
583    int x528;                                           // 0x528
584    int *script_parse;                                  // 0x52c
585    int x530;                                           // 0x530
586    int x534;                                           // 0x534
587    int x538;                                           // 0x538
588    int x53c;                                           // 0x53c
589    int x540;                                           // 0x540
590    int x544;                                           // 0x544
591    ColorOverlay color;                                 // 0x548
592    int x5c8;                                           // 0x5c8
593    float current_frame;                                // 0x5cc
594    float framerate;                                    // 0x5d0
595    itHit hitbox[4];                                    // 0x5d4
596    int hit_exception_id;                               // 0xac4, cannot hit items with a matching index
597    int hurt_num;                                       // 0xac8
598    ItHurt it_hurt[2];                                  // 0xacc
599    struct 
600    {
601        int xb54;                                       // 0xb54
602        int xb58;                                       // 0xb58
603        float x1;                                       // 0xb5c
604        float x2;                                       // 0xb60
605        float y;                                        // 0xb64
606    } footstool;
607    int dynamics_xb68;                                  // 0xb68, dynamic_hit_num?
608    int xb6c;                                           // 0xb6c, dynamic hit
609    int xb70;                                           // 0xb70
610    int xb74;                                           // 0xb74
611    int xb78;                                           // 0xb78
612    int xb7c;                                           // 0xb7c
613    int xb80;                                           // 0xb80
614    int xb84;                                           // 0xb84
615    int xb88;                                           // 0xb88
616    int xb8c;                                           // 0xb8c
617    int xb90;                                           // 0xb90
618    int xb94;                                           // 0xb94
619    int xb98;                                           // 0xb98
620    int xb9c;                                           // 0xb9c
621    int xba0;                                           // 0xba0
622    int xba4;                                           // 0xba4
623    int xba8;                                           // 0xba8
624    int xbac;                                           // 0xbac
625    int xbb0;                                           // 0xbb0
626    int xbb4;                                           // 0xbb4
627    int xbb8;                                           // 0xbb8
628    JOBJ **bones;                                       // 0xbbc
629    Effect effect;                                      // 0xbc0
630    int xbec;                                           // 0xbec
631    int xbf0;                                           // 0xbf0
632    int xbf4;                                           // 0xbf4
633    int xbf8;                                           // 0xbf8
634    int xbfc;                                           // 0xbfc
635    int xc00;                                           // 0xc00
636    int xc04;                                           // 0xc04
637    int xc08;                                           // 0xc08
638    int xc0c;                                           // 0xc0c
639    int xc10;                                           // 0xc10
640    int xc14;                                           // 0xc14
641    int xc18;                                           // 0xc18
642    float ecb_top;                                      // 0xc1c
643    float ecb_bottom;                                   // 0xc20
644    float ecb_right;                                    // 0xc24
645    float ecb_left;                                     // 0xc28
646    int xc2c;                                           // 0xc2c
647    int xc30;                                           // 0xc30
648    struct                                              // dmg, 0xc9c
649    {                                                   //
650        int dealt;                                      // 0xc34, rounded down
651        int xc38;                                       // 0xc38
652        int xc3c;                                       // 0xc3c
653        int xc40;                                       // 0xc40
654        int xc44;                                       // 0xc44
655        int xc48;                                       // 0xc48
656        int xc4c;                                       // 0xc4c
657        int xc50;                                       // 0xc50
658        float shield_hit_angle;                         // 0xc54, angle at which the projectile touched the shield? 80077854
659        float shield_hit_xc58;                          // 0xc58
660        float shield_hit_xc5c;                          // 0xc5c
661        float shield_hit_xc60;                          // 0xc60
662        GOBJ *reflect;                                  // 0xc64, pointer to the gobj that reflected this item, is removed after processing the reflection
663        float xc68;                                     // 0xc68
664        int xc6c;                                       // 0xc6c
665        int xc70;                                       // 0xc70
666        int xc74;                                       // 0xc74
667        int xc78;                                       // 0xc78
668        int xc7c;                                       // 0xc7c
669        int xc80;                                       // 0xc80
670        int xc84;                                       // 0xc84
671        int xc88;                                       // 0xc88
672        int xc8c;                                       // 0xc8c
673        GOBJ *xc90;                                     // 0xc90
674        int xc94;                                       // 0xc94
675        int xc98;                                       // 0xc98
676        int total;                                      // 0xc9c
677        int recent;                                     // 0xca0
678        int xca4;                                       // 0xca4
679        int xca8;                                       // 0xca8, hitlag related, stems from the damage dealt 8026a41c
680        int angle;                                      // 0xcac
681        int source_ply;                                 // 0xcb0, damage source ply number
682        int xcb4;                                       // 0xcb4
683        float givedmg_direction;                        // 0xcb8, updated @ 80078184
684        float hitlag_frames;                            // 0xcbc, hitlag frames remaining
685        int xcc0;                                       // 0xcc0
686        int xcc4;                                       // 0xcc4
687        float kb;                                       // 0xcc8
688        float takedmg_direction;                        // 0xccc
689        float xcd0;                                     // 0xcd0
690        float xcd4;                                     // 0xcd4
691        float xcd8;                                     // 0xcd8
692        float xcdc;                                     // 0xcdc
693        float xce0;                                     // 0xce0
694        float xce4;                                     // 0xce4
695        float xce8;                                     // 0xce8
696        GOBJ *source_fighter;                           // 0xcec
697        GOBJ *source_item;                              // 0xcf0, is a fighter gobj, but is the owner of the item that hit the item
698    } dmg;                                              //
699    GOBJ *hit_fighter;                                  // 0xcf4, fighter that got hit by, shielded, or hit this item. is removed after processing the damage callbacks
700    GOBJ *detected_fighter;                             // 0xcf8, fighter that touched the items detect box. updated @ 800798d4
701    int xcfc;                                           // 0xcfc
702    GOBJ *grabbed_fighter;                              // 0xd00
703    GOBJ *attacker_item;                                // 0xd04
704    u8 xd08;                                            // 0xd08
705    u8 xd09;                                            // 0xd09
706    u8 xd0A;                                            // 0xd0A
707    u8 xd0B;                                            // 0xd0B
708    int xd0c;                                           // 0xd0c
709    int xd10;                                           // 0xd10
710    struct                                              // cb
711    {                                                   //
712        void (*anim)(GOBJ *item);                       // 0xd14
713        void (*phys)(GOBJ *item);                       // 0xd18
714        void (*coll)(GOBJ *item);                       // 0xd1c
715        void (*accessory)(GOBJ *item);                  // 0xd20
716        void (*on_detect)(GOBJ *item);                  // 0xd24
717        void (*on_enter_hitlag)(GOBJ *item);            // 0xd28, runs after applying hitlag in damage apply proc 8026a62c
718        void (*on_exit_hitlag)(GOBJ *item);             // 0xd2c, runs after exiting hitlag in hitlag update proc 8026a200
719        void *jumped_on;                                // 0xd30, runs when the item is "jumped on", 80269bac
720        void (*grabFt_onIt)(GOBJ *item);                // 0xd34, when grabbing a fighter, run this function on self
721        void (*grabFt_onFt)(GOBJ *fighter, GOBJ *item); // 0xd38, when grabbing a fighter, run this function on fighter
722    } cb;                                               //
723    float spin_speed;                                   // 0xd3c
724    int xd40;                                           // 0xd40
725    float lifetime;                                     // 0xd44
726    int xd48;                                           // 0xd48
727    int xd4c;                                           // 0xd4c
728    int land_num;                                       // 0xd50
729    int throw_num;                                      // 0xd54
730    int xd58;                                           // 0xd58
731    int xd5c;                                           // 0xd5c
732    int xd60;                                           // 0xd60
733    int xd64;                                           // 0xd64
734    int xd68;                                           // 0xd68
735    int xd6c;                                           // 0xd6c
736    int xd70;                                           // 0xd70
737    int xd74;                                           // 0xd74
738    int xd78;                                           // 0xd78
739    int destroy_sfx;                                    // 0xd7c
740    int xd80;                                           // 0xd80
741    int xd84;                                           // 0xd84
742    int atk_kind;                                       // 0xd88, copied from fighter atk_kind
743    u16 atk_instance;                                   // 0xd8c,  Contains an ID unique to the current move instance. e.g, if two dairs are done back to back, this ID will differ to tell them apart from each other. It is stored to 0x18EC of the victim upon colliding with someone.
744    int xd90;                                           // 0xd90
745    int xd94;                                           // 0xd94
746    int xd98;                                           // 0xd98
747    float xd9c;                                         // 0xd9c
748    int xda0;                                           // 0xda0
749    unsigned char xda4_80 : 1;                          // 0xda4, 0x80
750    unsigned char xda4_40 : 1;                          // 0xda4, 0x40
751    unsigned char xda4_20 : 1;                          // 0xda4, 0x20
752    unsigned char xda4_10 : 1;                          // 0xda4, 0x10
753    unsigned char xda4_08 : 1;                          // 0xda4, 0x08
754    unsigned char xda4_04 : 1;                          // 0xda4, 0x04
755    unsigned char xda4_02 : 1;                          // 0xda4, 0x02
756    unsigned char xda4_01 : 1;                          // 0xda4, 0x01
757    unsigned char xda5_80 : 1;                          // 0xda5, 0x80
758    unsigned char xda5_40 : 1;                          // 0xda5, 0x40
759    unsigned char xda5_20 : 1;                          // 0xda5, 0x20
760    unsigned char xda5_10 : 1;                          // 0xda5, 0x10
761    unsigned char xda5_08 : 1;                          // 0xda5, 0x08
762    unsigned char xda5_04 : 1;                          // 0xda5, 0x04
763    unsigned char xda5_02 : 1;                          // 0xda5, 0x02
764    unsigned char xda5_01 : 1;                          // 0xda5, 0x01
765    char xda6;                                          // 0xda6
766    char xda7;                                          // 0xda7
767    char xda8;                                          // 0xda8
768    char xda9;                                          // 0xda9
769    unsigned char xdaa1 : 1;                            // 0x80 - 0xdaa
770    unsigned char show_center_sphere : 1;               // 0x40 - 0xdaa
771    unsigned char show_item_pickup : 1;                 // 0x20 - 0xdaa
772    unsigned char show_footstool : 1;                   // 0x10 - 0xdaa
773    unsigned char xda8_x8 : 1;                          // 0x8 - 0xdaa
774    unsigned char show_dynamics : 1;                    // 0x4 - 0xdaa
775    unsigned char show_hit : 1;                         // 0x2 - 0xdaa
776    unsigned char show_model : 1;                       // 0x1 - 0xdaa
777    char xdab;                                          // 0xdab
778    struct                                              //
779    {                                                   //
780        int flag1;                                      // 0xdac
781        int flag2;                                      // 0xdb0
782        int flag3;                                      // 0xdb4
783        int flag4;                                      // 0xdb8
784        int flag5;                                      // 0xdbc
785    } itcmd_var;                                        //
786    int xdc0;                                           // 0xdc0
787    int xdc4;                                           // 0xdc4
788    u8 xdc8 : 8;                                        // 0xdc8
789    u8 xdc9_1 : 1;                                      // 0xdc9, 0x80
790    u8 is_hitlag : 1;                                   // 0xdc9, 0x40
791    u8 freeze : 1;                                      // 0xdc9, 0x20
792    u8 xdc9_10 : 1;                                     // 0xdc9, 0x10
793    u8 xdc9_f : 4;                                      // 0xdc9, 0xF
794    u16 xdca1 : 1;                                      // 0xdca 0x80
795    u16 xdca2 : 1;                                      // 0xdca 0x40
796    u16 xdca3 : 1;                                      // 0xdca 0x20
797    u16 xdca4 : 1;                                      // 0xdca 0x10
798    u16 xdca5 : 1;                                      // 0xdca 0x08
799    u16 can_hold : 1;                                   // 0xdca 0x04
800    u16 xdca7 : 1;                                      // 0xdca 0x02
801    u16 rotate_axis : 2;                                // 0xdca, 0x180
802    u16 rotate_axis_enable : 1;                         // 0xdcb, 0x40
803    u16 xdcb_x20 : 1;                                   // 0xdcb, 0x20
804    u16 xdcb_x10 : 1;                                   // 0xdcb, 0x10
805    u16 can_nudge : 1;                                  // 0xdcb, 0x08
806    u16 xdcb_5 : 2;                                     // 0xdcb, 0x06
807    u16 xdcb_7 : 1;                                     // 0xdcb, 0x01
808    unsigned char xdcc1 : 1;                            // 0xdcc, 0x80
809    unsigned char xdcc2 : 1;                            // 0xdcc, 0x40
810    unsigned char xdcc3 : 1;                            // 0xdcc, 0x20
811    unsigned char isCheckBlastzone : 1;                 // 0xdcc, 0x10
812    unsigned char isCheckRightBlastzone : 1;            // 0xdcc, 0x08
813    unsigned char isCheckLeftBlastzone : 1;             // 0xdcc, 0x04
814    unsigned char isCheckUpBlastzone : 1;               // 0xdcc, 0x02
815    unsigned char isCheckDownBlastzone : 1;             // 0xdcc, 0x01
816    unsigned char cam_kind : 2;                         // 0xdcd, 0xc0. indicates this item has a camera box
817    unsigned char no_play_hold_drop_throw_sfx : 1;      // 0xdcd, 0x20
818    unsigned char xdcd4 : 1;                            // 0xdcd, 0x10
819    unsigned char xdcd5 : 1;                            // 0xdcd, 0x08
820    unsigned char xdcd6 : 1;                            // 0xdcd, 0x04 (function 80275444 sets this when some items hit ground)
821    unsigned char xdcd7 : 1;                            // 0xdcd, 0x02 (function 80275444 sets this when some items hit ground)
822    unsigned char xdcd8 : 1;                            // 0xdcd, 0x01 (function 80275444 sets this when some items hit ground)
823    unsigned char xdce1 : 1;                            // 0xdce, 0x80
824    unsigned char xdce2 : 1;                            // 0xdce, 0x40
825    unsigned char xdce3 : 1;                            // 0xdce, 0x20
826    unsigned char xdce4 : 1;                            // 0xdce, 0x10
827    unsigned char xdce5 : 1;                            // 0xdce, 0x08
828    unsigned char xdce6 : 1;                            // 0xdce, 0x04, is checked when determining if an item should bounce off a shield 80269df0
829    unsigned char is_detect : 1;                        // 0xdce, 0x02, is flipped when a detect hitbox comes in contact with a hurtbox
830    unsigned char xdce8 : 1;                            // 0xdce, 0x01
831    unsigned char xdcf1 : 1;                            // 0xdcf, 0x80
832    unsigned char xdcf2 : 1;                            // 0xdcf, 0x40
833    unsigned char xdcf3 : 1;                            // 0xdcf, 0x20
834    unsigned char xdcf4 : 1;                            // 0xdcf, 0x10
835    unsigned char xdcf5 : 1;                            // 0xdcf, 0x08
836    unsigned char xdcf6 : 1;                            // 0xdcf, 0x04
837    unsigned char is_hurt_by_fighter : 1;               // 0xdcf, 0x02, metal box checks this to make sure it was hit directly by a fighter and not their item
838    unsigned char xdcf8 : 1;                            // 0xdcf, 0x01
839    unsigned char is_footstool : 1;                     // 0xdd0, 0x80
840    unsigned char xdd0_x40 : 1;                         // 0xdd0, 0x40
841    unsigned char xdd0_x20 : 1;                         // 0xdd0, 0x20
842    unsigned char xdd0_x10 : 1;                         // 0xdd0, 0x10
843    unsigned char is_grabbable : 1;                     // 0xdd0, 0x08
844    unsigned char xdd0_x04 : 1;                         // 0xdd0, 0x04
845    unsigned char xdd0_x02 : 1;                         // 0xdd0, 0x02
846    unsigned char xdd0_x01 : 1;                         // 0xdd0, 0x01
847    struct                                              // 0xdd4
848    {                                                   //
849        int var1;                                       // 0xdd4
850        int var2;                                       // 0xdd8
851        int var3;                                       // 0xddc
852        int var4;                                       // 0xde0
853        int var5;                                       // 0xde4
854        int var6;                                       // 0xde8
855        int var7;                                       // 0xdec
856        int var8;                                       // 0xdf0
857        int var9;                                       // 0xdf4
858        int var10;                                      // 0xdf8
859        int var11;                                      // 0xdfc
860        int var12;                                      // 0xe00
861        int xe04;                                       // 0xe04
862        int xe08;                                       // 0xe08
863        int xe0c;                                       // 0xe0c
864        int xe10;                                       // 0xe10
865        int xe14;                                       // 0xe14
866        int xe18;                                       // 0xe18
867        int xe1c;                                       // 0xe1c
868        int xe20;                                       // 0xe20
869        int xe24;                                       // 0xe24
870        int xe28;                                       // 0xe28
871        int xe2c;                                       // 0xe2c
872        int xe30;                                       // 0xe30
873        int xe34;                                       // 0xe34
874        int xe38;                                       // 0xe38
875        int xe3c;                                       // 0xe3c
876        int xe40;                                       // 0xe40
877        int xe44;                                       // 0xe44
878        int xe48;                                       // 0xe48
879        int xe4c;                                       // 0xe4c
880        int xe50;                                       // 0xe50
881        int xe54;                                       // 0xe54
882        int xe58;                                       // 0xe58
883        int xe5c;                                       // 0xe5c
884        int xe60;                                       // 0xe60
885        int xe64;                                       // 0xe64
886        int xe68;                                       // 0xe68
887        int xe6c;                                       // 0xe6c
888        int xe70;                                       // 0xe70
889        int xe74;                                       // 0xe74
890        int xe78;                                       // 0xe78
891        int xe7c;                                       // 0xe7c
892        int xe80;                                       // 0xe80
893        int xe84;                                       // 0xe84
894        int xe88;                                       // 0xe88
895        int xe8c;                                       // 0xe8c
896        int xe90;                                       // 0xe90
897        int xe94;                                       // 0xe94
898        int xe98;                                       // 0xe98
899        int xe9c;                                       // 0xe9c
900        int xea0;                                       // 0xea0
901        int xea4;                                       // 0xea4
902        int xea8;                                       // 0xea8
903        int xeac;                                       // 0xeac
904        int xeb0;                                       // 0xeb0
905        int xeb4;                                       // 0xeb4
906        int xeb8;                                       // 0xeb8
907        int xebc;                                       // 0xebc
908        int xec0;                                       // 0xec0
909        int xec4;                                       // 0xec4
910        int xec8;                                       // 0xec8
911        int xecc;                                       // 0xecc
912        int xed0;                                       // 0xed0
913        int xed4;                                       // 0xed4
914        int xed8;                                       // 0xed8
915        int xedc;                                       // 0xedc
916        int xee0;                                       // 0xee0
917        int xee4;                                       // 0xee4
918        int xee8;                                       // 0xee8
919        int xeec;                                       // 0xeec
920        int xef0;                                       // 0xef0
921        int xef4;                                       // 0xef4
922        int xef8;                                       // 0xef8
923        int xefc;                                       // 0xefc
924        int xf00;                                       // 0xf00
925        int xf04;                                       // 0xf04
926        int xf08;                                       // 0xf08
927        int xf0c;                                       // 0xf0c
928        int xf10;                                       // 0xf10
929        int xf14;                                       // 0xf14
930        int xf18;                                       // 0xf18
931        int xf1c;                                       // 0xf1c
932        int xf20;                                       // 0xf20
933        int xf24;                                       // 0xf24
934        int xf28;                                       // 0xf28
935        int xf2c;                                       // 0xf2c
936        int xf30;                                       // 0xf30
937        int xf34;                                       // 0xf34
938        int xf38;                                       // 0xf38
939        int xf3c;                                       // 0xf3c
940        int xf40;                                       // 0xf40
941        int xf44;                                       // 0xf44
942        int xf48;                                       // 0xf48
943        int xf4c;                                       // 0xf4c
944        int xf50;                                       // 0xf50
945        int xf54;                                       // 0xf54
946        int xf58;                                       // 0xf58
947        int xf5c;                                       // 0xf5c
948        int xf60;                                       // 0xf60
949        int xf64;                                       // 0xf64
950        int xf68;                                       // 0xf68
951        int xf6c;                                       // 0xf6c
952        int xf70;                                       // 0xf70
953        int xf74;                                       // 0xf74
954        int xf78;                                       // 0xf78
955        int xf7c;                                       // 0xf7c
956        int xf80;                                       // 0xf80
957        int xf84;                                       // 0xf84
958        int xf88;                                       // 0xf88
959        int xf8c;                                       // 0xf8c
960        int xf90;                                       // 0xf90
961        int xf94;                                       // 0xf94
962        int xf98;                                       // 0xf98
963        int xf9c;                                       // 0xf9c
964        int xfa0;                                       // 0xfa0
965        int xfa4;                                       // 0xfa4
966        int xfa8;                                       // 0xfa8
967        int xfac;                                       // 0xfac
968        int xfb0;                                       // 0xfb0
969        int xfb4;                                       // 0xfb4
970        int xfb8;                                       // 0xfb8
971        int xfbc;                                       // 0xfbc
972        int xfc0;                                       // 0xfc0
973        int xfc4;                                       // 0xfc4
974        int xfc8;                                       // 0xfc8
975    } item_var;                                         //
976};
977
978/*** static reference ***/
979
980static itPublicData **stc_itPublicData = R13_OFFSET(-0x4978);
981static ItemDesc **stc_itdesc_enemies = R13_OFFSET(-0x4968);
982
983/*** Functions ***/
984void Item_IndexStageItem(ItemDesc *item_desc, int index);
985void Item_Hold(GOBJ *item, GOBJ *fighter, int boneID);
986void Item_Catch(GOBJ *fighter, int unk);
987void Item_StoreItemDataToCharItemTable(int articleData, int articleID);
988void Items_StoreTimeout(GOBJ *item, float timeout);
989GOBJ *Item_CreateItem(SpawnItem *item_spawn); // sorry for confusion, use this one for best results
990GOBJ *Item_CreateItem1(SpawnItem *item_spawn);
991GOBJ *Item_CreateItem2(SpawnItem *item_spawn);
992GOBJ *Item_CreateItem3(SpawnItem *item_spawn);
993GOBJ *Item_CreateMapItem(int index, int initial_state, void *data, JOBJ *jobj, void *onHit, void *onHurt, void *onUnk);
994void Item_Destroy(GOBJ *item);
995int Item_CollGround_PassLedge(GOBJ *item, void *callback);
996int Item_CollGround_StopLedge(GOBJ *item, void *callback);
997int Item_CollAir_Bounce(GOBJ *item, void *callback);
998int Item_CollAir_Land(GOBJ *item, void *callback);
999int Item_CollAir_NoCB(GOBJ *item);
1000void Item_SetGroundedUpright(GOBJ *item);
1001void ItemStateChange(GOBJ *item, int stateID, int flags);
1002int ItemFrameTimer(GOBJ *item);
1003void Item_PlaceOnGroundBelow(GOBJ *item);
1004int Item_CheckIfTouchingWall(GOBJ *item, float *unk[]);
1005void Item_InitGrab(ItemData *item, int unk, void *OnItem, void *OnFighter);
1006void Item_ResetAllHitPlayers(ItemData *item);
1007int Item_CountActiveItems(int itemID);
1008void Item_CopyDevelopState(GOBJ *item, GOBJ *fighter);
1009void GXLink_Item(GOBJ *gobj, int pass);
1010void Item_UpdateSpin(GOBJ *item, float unk);
1011void Item_SetAirborne(ItemData *ip);
1012void Item_SetGrounded(ItemData *ip);
1013void Item_SetLifeTimer(GOBJ *item, float lifetime); // sets frames until item is destroyed
1014int Item_DecLifeTimer(GOBJ *item);                  // returns isEnd bool
1015JOBJ *Item_GetBoneJOBJ(GOBJ *item, int bone_index);
1016int Item_CheckIfEnabled(); // returns bool regarding if items are enabled for this match
1017int Item_GetGroundAirState(GOBJ *item);
1018void Item_UpdatePhysAndColl(GOBJ *item);
1019void Item_ProjectileVelocityCalculate(GOBJ *item, float fall_speed, float max_fall_speed);
1020void Item_PlayOnDestroySFXAgain(ItemData *, int sfxid, int volume, int panning);
1021void Item_UpdatePositionCollision(GOBJ *item);
1022void Item_ScaleToPlayerSize(GOBJ *item);
1023void Item_AnimateAndUpdateSubactions(GOBJ *item);
1024void Barrel_EnterBreak(GOBJ *item);
1025void Item_EnableHitlagFlag(GOBJ *item);
1026void Item_ReflectVelocity(GOBJ *item);
1027void Item_Throw(GOBJ *item, float unk, Vec3 *pos, Vec3 *vel);
1028JOBJ *Item_GetHeldBone(GOBJ *item);
1029void Item_BounceOffVictim(GOBJ *item);
1030void Item_BounceOffShield(GOBJ *item);
1031int Item_GenerateHitExceptionID();
1032int Item_CheckHeavy(GOBJ *item);
1033void Item_SetUngrabbable(GOBJ *item);
1034void Item_SetJobjHidden(GOBJ *item);
1035float Item_GetHitboxDamage(GOBJ *item);
1036void Item_SetHitboxDamage(itHit *hitbox, int damage, GOBJ *item);
1037void Item_RemoveAllHitboxes(GOBJ *item);
1038void Item_SetHurtboxTangibility(GOBJ *item, int tangibility);
1039void Item_CreateHurtbox(GOBJ *item, float x1, float y1, float z1, float x2, float y2, float z2, float size);
1040void Item_UpdateHurtboxes(GOBJ *item);
1041void Item_UpdateAnimationAndScriptTimers(GOBJ *item);
1042void Item_ClearVelocity(GOBJ *item);
1043void Item_ResetVelocity(GOBJ *item);
1044void Item_UpdateECBTopN(GOBJ *item);
1045int Item_GetWallCollFlags(GOBJ *item);
1046void Item_UpdateHitboxDamage(itHit *hit, int dmg, GOBJ *item);
1047GOBJ *Item_GiveOwnershipToAttacker(GOBJ *item);
1048char Item_GetHoldKind(GOBJ *item);
1049float Item_GetDistanceFromPointSquared(GOBJ *item, Vec3 *position);
1050void Item_DestroyAndRemovedGrabbed(GOBJ *item, int flag, float damage);
1051bool Item_RemoveFighterReference(GOBJ *item, GOBJ *fighter);
1052void Item_ClearHitlagFlag(GOBJ *item);
1053
1054void Egg_Destroy(GOBJ *egg_gobj);
1055#endif