fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
4f5d26e
nix
1#ifndef MEX_H_EFFECTS 2#define MEX_H_EFFECTS 3 4#include "structs.h" 5#include "datatypes.h" 6#include "obj.h" 7 8#define PTCL_LINKMAX 16 9 10/*** Structs ***/ 11 12struct EffectModelDesc 13{ 14float frame_num ; 15JOBJSet jobjset ; 16}; 17 18struct PtclDesc 19{ 20u16 x0 ; 21u16 x2 ; 22int effect_idx_start ; 23int gen_num ; 24struct 25 { 26int x0 ; 27int x4 ; 28int flags ;// 0x8 29 }* gen []; 30}; 31 32struct TexGDesc 33{ 34int num ; 35struct 36 { 37int img_num ; 38GXTexFmt img_fmt ; 39int x8 ; 40int width ; 41int height ; 42int x14 ; 43void * img_ptr []; 44 }* data []; 45}; 46 47struct EffectDataTable // exists in the dat 48{ 49PtclDesc * particle ; 50TexGDesc * texg ; 51EffectModelDesc model_desc []; 52}; 53 54struct Effect 55{ 56GOBJ * child ; 57GOBJ * gobj ; 58GOBJ * parent ; 59int xc ; 60void * callback ; 61int x14 ; 62int x18 ; 63int x1c ; 64float x20 ; 65short lifetime ; 66char x26 ; 67char x27 ; 68char x28 ;// if this is == 2, the effect is not updated 69char x29 ; 70}; 71 72struct ptclGenCallback 73{ 74void (* cbSpawnParticle )(Particle * );// x00 75void (* cbDestroyParticle )(Particle * );// x04 76}; 77 78struct ptclGen // allocated at 8039d9c8 79{ 80struct ptclGen * next ;// 0x0 81int kind ;// x4 82float random ;// x8 83float num_to_spawn ;// xc 84JOBJ * joint ;// x10 85u16 genlife ;// x14 86u16 type ;// x16 87u8 ef_file ;// x18 88u8 link_no ;// x19, r3 for 8039f05c 89u8 tex_group ;// x1a 90u8 x1b ;// x1b 91u16 instance ;// x1c, is equal to idnum value in the particles it creates 92u16 life ;// x1e 93void * cmdList ;// x20, pointer to track data 94Vec3 pos ;// x24 95Vec3 vel ;// x30 96float gravity ;// x3c 97float friction ;// x40 98float size ;// x44 99float radius ;// x48 100float angle ;// x4c 101int particle_num ;// x50 102GeneratorAppSRT * appsrt ;// x54, points to an SRT mtx used for transforming the generator while attached to a joint 103ptclGenCallback * callbacks ;// x58 104void * x5C ;// x5C 105Vec3 x60 ;// x60 106Vec3 x6c ;// x6C 107Vec3 x78 ;// x78 108Vec3 x84 ;// x84 109short rect_flags ;// x90 110}; 111 112struct GeneratorAppSRT // allocated at 803a42b0 113{ 114int x0 ;// x0 115int x4 ;// x4 116Vec3 pos ;// x8 117Vec4 rot ;// x14 118Vec3 scale ;// x24 119int x30 ;// x30 120int x34 ;// x34 121int x38 ;// x38 122int x3c ;// x3c 123int x40 ;// x40 124int x44 ;// x44 125int x48 ;// x48 126int x4c ;// x4c 127int x50 ;// x50 128int x54 ;// x54 129int x58 ;// x58 130int x5c ;// x5c 131int x60 ;// x60 132int x64 ;// x64 133int x68 ;// x68 134int x6c ;// x6c 135int x70 ;// x70 136int x74 ;// x74 137int x78 ;// x78 138int x7c ;// x7c 139int x80 ;// x80 140int x84 ;// x84 141int x88 ;// x88 142int x8c ;// x8c 143int x90 ;// x90 144int x94 ;// x94 145int x98 ;// x98 146int x9c ;// x9c 147int xa0 ;// xa0 148u16 xa2 ; 149}; 150 151// courtesy of psilupan: https://pastebin.com/raw/yQdjypW0 152struct Particle // created at 80398c90. dont feel like labelling this, offsets are @ 80398de4 153{ 154struct Particle * next ;// 0x0 155u32 kind ;// 0x4, actually are flags. 0x800 pauses it 156u8 bank ;// 0x8 157u8 texGroup ;// 0x9 158u8 poseNum ;// 0xa 159u8 palNum ;// 0xb 160u16 sizeCount ;// 0xc 161u16 primColCount ;// 0xe 162u16 envColCount ;// 0x10 163u8 primCol [4 ];// 0x12 164u8 envCol [4 ];// 0x16 165u16 cmdWait ;// 0x1a 166u8 loopCount ;// 0x1c 167u8 linkNo ;// 0x1d 168u16 idnum ;// 0x1e 169void * cmdList ;// 0x20 170u16 cmdPtr ;// 0x24 171u16 cmdMarkPtr ;// 0x26 172u16 cmdLoopPtr ;// 0x28 173u16 life ;// 0x2a 174Vec3 v ;// 0x2C 175float grav ;// 0x38 176float fric ;// 0x3C 177Vec3 pos ;// 0x40 178float size ;// 0x4C 179float rotate ;// 0x50 180u16 aCmpCount ;// 0x54 181u8 aCmpMode ;// 0x56 182u8 aCmpParam1 ;// 0x57 183u8 aCmpParam2 ;// 0x58 184u8 pJObjOfs ;// 0x59 185u16 matColCount ;// 0x5A 186u16 ambColCount ;// 0x5C 187u16 rotateCount ;// 0x5E 188float sizeTarget ;// 0x60 189float rotateTarget ;// 0x64 190float rotateAcc ;// 0x68 191u16 primColRemain ;// 0x6C 192u16 envColRemain ;// 0x6E 193GXColor primColTarget ;// 0x70 194GXColor envColTarget ;// 0x74 195u16 matColRemain ;// 0x78 196u16 ambColRemain ;// 0x7A 197u16 aCmpRemain ;// 0x7C 198u8 aCmpParam1Target ;// 0x7D 199u8 aCmpParam2Target ;// 0x7E 200u8 matRGB ;// 0x7F 201u8 matA ;// 0x80 202u8 ambRGB ;// 0x81 203u8 ambA ;// 0x82 204// u8 matRGBTarget; // 0x83 205// u8 matATarget; // 0x84 206// u8 ambRGBTarget; // 0x85 207// u8 ambATarget; // 0x86 208float trail ;// 0x84 209ptclGen * gen ;// 0x88 210GeneratorAppSRT * appsrt ;// 0x8C 211void * userdata ;// 0x90 212void * callback ;// 0x94 213}; 214 215/*** Functions ***/ 216 217void Effect_LoadFile (int eff_file_idx ); 218Effect * Effect_SpawnSync (int gfx_id , ...); 219void Effect_SpawnAsync (GOBJ * fighter ,Effect * ptr ,int type ,int gfx_id , ...); 220void Effect_SpawnAsyncLookup (GOBJ * gobj ,int gfx_id ,int bone ,int unk ,int destroy_on_leave ,Vec3 * offset ,Vec3 * range ); 221void Effect_SpawnItEffectLookup (GOBJ * gobj ,int gfx_id ,int bone ,Vec3 * offset ,Vec3 * scatter ,int unk3 ); 222void Effect_SpawnItEffect (GOBJ * gobj ,int gfx_id ); 223void Effect_DestroyAll (GOBJ * fighter ); 224void Particle_DestroyAll (JOBJ * jobj ); 225void Effect_PauseAll (GOBJ * fighter ); 226void Effect_ResumeAll (GOBJ * fighter ); 227void Effect_CheckQueue (GOBJ * g ,Effect ** gfx ); 228void Particle_InitFile (void * ptcl ,void * texg ,int r5 ); 229ptclGen * psCreateGeneratorID (int linkno ,int bank_no ,int ptcl_index );// 8039f05c 230ptclGen * psCreateGeneratorIDJObj (int linkno ,int bank_no ,int ptcl_index ,JOBJ * jobj );// 8039efac 231void psInterpretParticles (u32 blacklist_link_nos );// input is a bitfield, shifted left by 16 bits! 232void psExecGenerator (u32 blacklist_link_nos );// input is a bitfield, shifted left by 16 bits! 233void psDispParticles (u32 whitelist_link_nos ,int pass );// input is a bitfield 234GeneratorAppSRT * psAddGeneratorAppSRT (ptclGen * ptcl_gen ,int unk ); 235int psRemoveParticleAppSRT (Particle * ptcl ); 236void psDeletePntJObjwithParticle (Particle * ptcl ); 237ptclGen * psKillGenerator (ptclGen * gen ,ptclGen * unk ); 238ptclGen * psKillGeneratorEZ (ptclGen * gen ); 239void psInitDataBanks (int bank_no ,void * ptcl ,void * texg ,int r6 ,int r7 ); 240 241static u16 * stc_ptclnum = R13_OFFSET (-0x3DBE );// number of pctls alive 242static Particle ** stc_ptcl = (void * )0x804d0908 ;// last created ptcl 243static ptclGen ** stc_ptclgen = R13_OFFSET (-0x3DA4 );// last created gen 244static ptclGen ** stc_ptclgencurr = R13_OFFSET (-0x3DA8 ); 245static u16 * stc_ptclgennum = R13_OFFSET (-0x3DC0 ); 246 247#endif