1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 14:20:11 +00:00

ovl_demo_effect 100% OK (#466)

* Fully decompiles demo_effect actor.

* Formats z_demo_effect.c

* GET_ACTOR_TYPE is renamed to GET_EFFECT_TYPE

* Implements OPEN_DISPS macros for all draw functions.

* Fixes ugly float values

* Removes unnecessary union structs in the DemoEffect actor struct

* Renames DemoEffect SkelAnimeCurve member to skelCurve

* Names initObjectBankIndex DemoEffect struct member

* Renames jewel display list holders

* Renames initialization function pointers to initUpdateFunc and initDrawFunc

* Renames primitive and environment color DemoEffect struct members.

* Fixes a couple missed floats.

* Renames most draw and update functions.

* Finishes naming all update functions.

* Adds additional SFX defines.

* Renames the rest of the functions

* Renames all external object display lists and vertex references

* Renames DemoEffect global data variables

* Renames DemoEffect Medal function to GetItem because it's used by LightArrows too

* Fixes DemoEffect Timewarp_Timeblock documentation.

* DemoEffect_TimewarpTimeblock updates shrink functions to use decimal

* Converts DemoEffect hex to decimal where appopriate

* Names the rest of DemoEffect struct members.

* Names DemoEffect triforceSpot crystalLightOpacity

* Adds DemoEffect enums for light effect color and god lgt types.

* Renames DemoEffect_UpdateBlueOrb to DemoEffect_UpdateBlueOrbGrow

* Fixes compiler warning in DemoEffect_JewelSparkle

* Renames DemoEffect_MedalSparkle argument

* Reformatting DemoEffect struct offset comments.

* Formats z_demo_effect

* Updates DemoEffect oGfxCtx to use the new macros.

* Adds comments detailing what each function in the DemoEffect system does.

* Removes z_demo_effect.data.s

* Renames DemoEffect global variables and sets them to static

* Removes pointer from DemoEffect function references

* Removes unncecessary default: break; statements in DemoEffect

* Converts rotation values to hex in DemoEffect

* DemoEffect effectFlags now uses ~1 rather than 65534

* DemoEffect_DrawGodLgt now uses a cleaner conditional statement

* eventChkInf in DemoEffect now uses 1 << 9 and 1 << 11

* DemoEffect now uses VT macros.

* Converts DemoEffect colors to hex.

* Changes M_PI / 32768.0f to M_PI / 0x8000

* Updates demo_effect enums to be all caps

* ovl_demo_effect reloc info is now included via build process rather than included from original asm

* Adds param packing macro

* DemoEffect struct unions are now typedef'd outside of the main struct

* Reformats DemoEffect sJewelSparkleColors

* Removes an if(globalCtx){} in DemoEffect_Init

* Removes ActorFunc cast in DemoEffect_Wait

* Removes unncessary comment in DemoEffect_MedalSparkle

* Timer check in DemoEffect_UpdateLightRingShrinking now uses <= 255 rather than < 256

* Removes unnecessary comment in DemoEffect_SetJewelColor

* Removes unncessary comment in DemoEffect_MoveJewelActivateDoorOfTime

* Converts an angle to hex in DemoEffect_MoveJewelActivateDoorOfTime

* Converts a while to for loop in DemoEffect_JewelSparkle

* Moves stack variables in DemoEffect_UpdateDust to a new line for each one

* Removes globalCtx2 assignment to the beginning of the function in DemoEffect_DrawJewel

* Removes unnecessary comment in DemoEffect_DrawCrystalLight

* No longer wrapping rotation reset in if(1){} in DemoEffect_DrawGodLgt

* Converts DemoEffect if statements to use != 0 and == 0 when non-boolean ints are checked.

* DemoEffect initDrawFunc now uses type ActorFunc rather than DemoEffectFunc

* review 2

Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
Kenix3 2020-12-07 12:48:29 -05:00 committed by GitHub
parent eff219f79b
commit 353684c638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 2260 additions and 6657 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,157 @@
struct DemoEffect;
typedef struct DemoEffect {
typedef void (*DemoEffectFunc)(struct DemoEffect* this, GlobalContext* globalCtx);
typedef struct {
/* 0x00 */ u8 timer;
} DemoEffectFireBall;
typedef struct {
/* 0x00 */ u8 alpha;
/* 0x01 */ u8 scale;
/* 0x02 */ u8 pad;
/* 0x04 */ s16 rotation;
} DemoEffectBlueOrb;
typedef struct {
/* 0x00 */ u8 alpha;
/* 0x01 */ u8 scaleFlag;
/* 0x02 */ u8 flicker;
/* 0x04 */ s16 rotation;
} DemoEffectLight;
typedef struct {
/* 0x00 */ u8 alpha;
} DemoEffectLgtShower;
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 lightRingSpawnDelay;
/* 0x02 */ u8 rotation;
/* 0x04 */ s16 lightRingSpawnTimer;
} DemoEffectGodLgt;
typedef struct {
/* 0x00 */ u8 timerIncrement;
/* 0x01 */ u8 alpha;
/* 0x02 */ u8 pad;
/* 0x04 */ s16 timer;
} DemoEffectLightRing;
typedef struct {
/* 0x00 */ u8 triforceSpotOpacity;
/* 0x01 */ u8 lightColumnOpacity;
/* 0x02 */ u8 crystalLightOpacity;
/* 0x04 */ s16 rotation;
} DemoEffectTriforceSpot;
typedef struct {
/* 0x00 */ u8 isPositionInit;
/* 0x01 */ u8 isLoaded;
/* 0x02 */ u8 giIndex;
/* 0x04 */ s16 rotation;
} DemoEffectGetItem;
typedef struct {
/* 0x00 */ u8 pad;
/* 0x01 */ u8 pad2;
/* 0x02 */ u8 pad3;
/* 0x04 */ s16 shrinkTimer;
} DemoEffectTimeWarp;
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 isPositionInit;
/* 0x02 */ u8 alpha;
/* 0x04 */ s16 timer;
} DemoEffectJewel;
typedef struct {
/* 0x00 */ u8 timer;
} DemoEffectDust;
typedef struct {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x54];
/* 0x014C */ SkelAnimeCurve skelCurve;
/* 0x016C */ u8 initObjectBankIndex;
/* 0x0170 */ Gfx* jewelDisplayList;
/* 0x0174 */ Gfx* jewelHolderDisplayList;
/* 0x0178 */ u8 primXluColor[3];
/* 0x017B */ u8 envXluColor[3];
/* 0x017E */ u8 primOpaColor[3];
/* 0x0181 */ u8 envOpaColor[3];
/* 0x0184 */ union {
DemoEffectFireBall fireBall;
DemoEffectBlueOrb blueOrb;
DemoEffectLight light;
DemoEffectLgtShower lgtShower;
DemoEffectGodLgt godLgt;
DemoEffectLightRing lightRing;
DemoEffectTriforceSpot triforceSpot;
DemoEffectGetItem getItem;
DemoEffectTimeWarp timeWarp;
DemoEffectJewel jewel;
DemoEffectDust dust;
};
/* 0x018A */ s16 effectFlags;
/* 0x018C */ s16 csActionId;
/* 0x018E */ Vec3s jewelCsRotation;
/* 0x0194 */ DemoEffectFunc initUpdateFunc;
/* 0x0198 */ ActorFunc initDrawFunc;
/* 0x019C */ DemoEffectFunc updateFunc;
} DemoEffect; // size = 0x01A0
extern const ActorInit Demo_Effect_InitVars;
// These names come from the objects that correspond to this actor type.
typedef enum {
/* 0x00 */ DEMO_EFFECT_CRYSTAL_LIGHT,
/* 0x01 */ DEMO_EFFECT_FIRE_BALL,
/* 0x02 */ DEMO_EFFECT_BLUE_ORB, // Object is in GAMEPLAY_KEEP. Not a name from object. It's a blue orb.
/* 0x03 */ DEMO_EFFECT_LGT_SHOWER,
/* 0x04 */ DEMO_EFFECT_GOD_LGT_DIN,
/* 0x05 */ DEMO_EFFECT_GOD_LGT_NAYRU,
/* 0x06 */ DEMO_EFFECT_GOD_LGT_FARORE,
/* 0x07 */ DEMO_EFFECT_LIGHTRING_EXPANDING,
/* 0x08 */ DEMO_EFFECT_TRIFORCE_SPOT,
/* 0x09 */ DEMO_EFFECT_MEDAL_FIRE,
/* 0x0A */ DEMO_EFFECT_MEDAL_WATER,
/* 0x0B */ DEMO_EFFECT_MEDAL_FOREST,
/* 0x0C */ DEMO_EFFECT_MEDAL_SPIRIT,
/* 0x0D */ DEMO_EFFECT_MEDAL_SHADOW,
/* 0x0E */ DEMO_EFFECT_MEDAL_LIGHT,
/* 0x0F */ DEMO_EFFECT_TIMEWARP_MASTERSWORD,
/* 0x10 */ DEMO_EFFECT_LIGHTRING_SHRINKING,
/* 0x11 */ DEMO_EFFECT_LIGHTRING_TRIFORCE,
/* 0x12 */ DEMO_EFFECT_LIGHT,
/* 0x13 */ DEMO_EFFECT_JEWEL_KOKIRI,
/* 0x14 */ DEMO_EFFECT_JEWEL_GORON,
/* 0x15 */ DEMO_EFFECT_JEWEL_ZORA,
/* 0x16 */ DEMO_EFFECT_DUST, // Object is jewel, but this is really the dust in the ToT light arrow cutscene.
/* 0x17 */ DEMO_EFFECT_LIGHTARROW,
/* 0x18 */ DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE,
/* 0x19 */ DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL,
/* 0x1A */ DEMO_EFFECT_MAX_TYPE
} DemoEffectType;
typedef enum {
/* 0x00 */ DEMO_EFFECT_LIGHT_RED,
/* 0x01 */ DEMO_EFFECT_LIGHT_BLUE,
/* 0x02 */ DEMO_EFFECT_LIGHT_GREEN,
/* 0x03 */ DEMO_EFFECT_LIGHT_ORANGE,
/* 0x04 */ DEMO_EFFECT_LIGHT_YELLOW,
/* 0x05 */ DEMO_EFFECT_LIGHT_PURPLE,
/* 0x06 */ DEMO_EFFECT_LIGHT_GREEN2
} DemoEffectLightColor;
typedef enum {
/* 0x00 */ GOD_LGT_DIN,
/* 0x01 */ GOD_LGT_NAYRU,
/* 0x02 */ GOD_LGT_FARORE
} DemoEffectGodLgtType;
// params info
// type: (params & 0x00FF)
// light size: ((params & 0x0F00) >> 8)
// light color: ((params & 0xF000) >> 12)
#endif