From 47c6c36dc3def21963b4b7dcae1e705c34a8de82 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 1 Oct 2024 08:46:56 +0200 Subject: [PATCH] [headers] Create zelda_arena.h, move protos to z64effect.h, and misc fixups (#2248) * [headers] Create z64malloc.h, move protos to z64effect.h, and misc fixups * zelda_arena.h * bss * bss2 * bss3 * bss --- include/functions.h | 195 +---------------------------------- include/macros.h | 6 -- include/sfx.h | 3 + include/sys_math3d.h | 5 + include/z64.h | 1 + include/z64effect.h | 182 +++++++++++++++++++++++++++++++- include/zelda_arena.h | 37 +++++++ src/code/main.c | 2 +- src/code/sys_math3d.c | 2 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 6 +- 12 files changed, 233 insertions(+), 210 deletions(-) create mode 100644 include/zelda_arena.h diff --git a/include/functions.h b/include/functions.h index d50f966a2d..3fc311f9e9 100644 --- a/include/functions.h +++ b/include/functions.h @@ -37,180 +37,7 @@ void LogUtils_ResetHungup(void); EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params); EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params); void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params); -void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); -void EffectBlure_AddSpace(EffectBlure* this); -void EffectBlure_Init1(void* thisx, void* initParamsx); -void EffectBlure_Init2(void* thisx, void* initParamsx); -void EffectBlure_Destroy(void* thisx); -s32 EffectBlure_Update(void* thisx); -void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx); -void EffectShieldParticle_Init(void* thisx, void* initParamsx); -void EffectShieldParticle_Destroy(void* thisx); -s32 EffectShieldParticle_Update(void* thisx); -void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx); -void EffectSpark_Init(void* thisx, void* initParamsx); -void EffectSpark_Destroy(void* thisx); -s32 EffectSpark_Update(void* thisx); -void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx); -void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026608(PlayState* play); -void func_80026690(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026860(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_80026A6C(PlayState* play); -PlayState* Effect_GetPlayState(void); -void* Effect_GetByIndex(s32 index); -void Effect_InitContext(PlayState* play); -void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); -void Effect_DrawAll(GraphicsContext* gfxCtx); -void Effect_UpdateAll(PlayState* play); -void Effect_Delete(PlayState* play, s32 index); -void Effect_DeleteAll(PlayState* play); -void EffectSs_InitInfo(PlayState* play, s32 tableSize); -void EffectSs_ClearAll(PlayState* play); -void EffectSs_Delete(EffectSs* effectSs); -void EffectSs_Reset(EffectSs* effectSs); -void EffectSs_Insert(PlayState* play, EffectSs* effectSs); -void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams); -void EffectSs_UpdateAll(PlayState* play); -void EffectSs_DrawAll(PlayState* play); -s16 EffectSs_LerpInv(s16 a, s16 b, s32 weightInv); -s16 EffectSs_LerpS16(s16 a, s16 b, f32 weight); -u8 EffectSs_LerpU8(u8 a, u8 b, f32 weight); -void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture); -void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, - u8 updateMode); -void func_8002829C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028304(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002836C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800283D4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_8002843C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800284A4(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_80028510(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_8002865C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_800286CC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_8002873C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 life); -void func_800287AC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 life); -void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor); -void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor); -void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos); -void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos); -void EffectSsKiraKira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); -void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 scaleStep); -void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* innerColor, - Color_RGBA8* outerColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life); -void EffectSsBlast_SpawnWhiteShockwaveSetScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 scaleStep, s16 life); -void EffectSsBlast_SpawnShockwaveSetColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* innerColor, Color_RGBA8* outerColor, s16 life); -void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void EffectSsGSpk_SpawnRandColor(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - s16 scale, s16 scaleStep); -void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 alpha, s16 fadeDelay, s32 life); -void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, - s16 fadeDelay); -void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, - f32 scale); -void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); -void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 type, s16 scale); -void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos); -void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos); -void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 scale, s16 yaw, s16 life, s16 numBolts); -void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - s16 life, s16 colorProfile, s16 randXZ); -void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ); -void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, - s16 objId, s16 life, Gfx* dList); -void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, - s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); -void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw); -void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, - s16 direction, s16 scale); -void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); -void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, - s16 updateRate, s16 drawMode, s16 scale); -void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2); -void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos); -void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); -void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); -void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, - u8 param); -void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param); -void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); -void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, - s16* linkDetected); -void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, - s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, - s16 objId, Gfx* dList); -void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); -void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB, - s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB, - s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); -void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, - Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); -void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, - Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life); -void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, - f32 colorIntensity); -void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity); -void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); -void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); -void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); -void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height); -void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, - s32 arg14, s16 playSfx); -void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, - s32 life); -void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, - s32 randIter, s32 life); -void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 alpha, s32 life); -void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, - s32 life); -void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, - s16 lowerPriority, s16 repeatMode, s32 life); -void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, - s16 repeatMode, s32 life); -void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); + void FlagSet_Update(PlayState* play); void Overlay_LoadGameState(GameStateOverlay* overlayEntry); void Overlay_FreeGameState(GameStateOverlay* overlayEntry); @@ -264,24 +91,6 @@ void Health_DrawMeter(PlayState* play); void Health_UpdateBeatingHeart(PlayState* play); u32 Health_IsCritical(void); -void* ZeldaArena_Malloc(u32 size); -void* ZeldaArena_MallocR(u32 size); -void* ZeldaArena_Realloc(void* ptr, u32 newSize); -void ZeldaArena_Free(void* ptr); -void* ZeldaArena_Calloc(u32 num, u32 size); -void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); -void ZeldaArena_Check(void); -void ZeldaArena_Init(void* start, u32 size); -void ZeldaArena_Cleanup(void); -s32 ZeldaArena_IsInitialized(void); -#if OOT_DEBUG -void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* ZeldaArena_MallocDebug(u32 size, const char* file, int line); -void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line); -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); -void ZeldaArena_FreeDebug(void* ptr, const char* file, int line); -void ZeldaArena_Display(void); -#endif void MapMark_Init(PlayState* play); void MapMark_ClearPointers(PlayState* play); void MapMark_Draw(PlayState* play); @@ -475,8 +284,6 @@ void SysCfb_Init(s32 n64dd); void* SysCfb_GetFbPtr(s32 idx); void* SysCfb_GetFbEnd(void); -void Math3D_DrawSphere(PlayState* play, Sphere16* sph); -void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl); u64* SysUcode_GetUCodeBoot(void); size_t SysUcode_GetUCodeBootSize(void); u64* SysUcode_GetUCode(void); diff --git a/include/macros.h b/include/macros.h index c2df878459..dc317c22bf 100644 --- a/include/macros.h +++ b/include/macros.h @@ -93,9 +93,6 @@ #define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line) #define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line) #define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line) -#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_MallocDebug(size, file, line) -#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocRDebug(size, file, line) -#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_FreeDebug(size, file, line) #define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line) #define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line) #define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line) @@ -111,9 +108,6 @@ #define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size) #define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size) #define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size) -#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_Malloc(size) -#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocR(size) -#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_Free(size) #define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0 #define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0 #define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) diff --git a/include/sfx.h b/include/sfx.h index 0532109e9a..a55ca01885 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -1,6 +1,9 @@ #ifndef SFX_H #define SFX_H +#include "ultra64.h" +#include "z64math.h" + typedef enum SfxBankType { /* 0 */ BANK_PLAYER, /* 1 */ BANK_ITEM, diff --git a/include/sys_math3d.h b/include/sys_math3d.h index b01063a9f0..deeb093f4e 100644 --- a/include/sys_math3d.h +++ b/include/sys_math3d.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "z64math.h" +struct PlayState; + s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint); @@ -70,4 +72,7 @@ s32 Math3D_XZInSphere(Sphere16* sphere, f32 x, f32 z); s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y); s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); +void Math3D_DrawSphere(struct PlayState* play, Sphere16* sph); +void Math3D_DrawCylinder(struct PlayState* play, Cylinder16* cyl); + #endif diff --git a/include/z64.h b/include/z64.h index 5a8e6a4a38..93362edb00 100644 --- a/include/z64.h +++ b/include/z64.h @@ -45,6 +45,7 @@ #include "z64sram.h" #include "z64view.h" #include "z64vis.h" +#include "zelda_arena.h" #include "alignment.h" #include "audiothread_cmd.h" #include "seqcmd.h" diff --git a/include/z64effect.h b/include/z64effect.h index d21f2cb53d..bad2b1d324 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -2,7 +2,11 @@ #define Z64EFFECT_H #include "color.h" +#include "romfile.h" +#include "z64light.h" +#include "z64math.h" +struct Actor; struct GraphicsContext; struct PlayState; @@ -218,7 +222,7 @@ typedef struct EffectSs { /* 0x28 */ EffectSsDrawFunc draw; /* 0x2C */ Vec3f vec; // usage specific per effect /* 0x38 */ void* gfx; // mostly used for display lists, sometimes textures - /* 0x3C */ Actor* actor; // interfacing actor, usually the actor that spawned the effect + /* 0x3C */ struct Actor* actor; // interfacing actor, usually the actor that spawned the effect /* 0x40 */ s16 regs[13]; // specific per effect /* 0x5A */ u16 flags; /* 0x5C */ s16 life; // -1 means this entry is free @@ -258,4 +262,180 @@ typedef enum EffectSsType { #undef DEFINE_EFFECT_SS #undef DEFINE_EFFECT_SS_UNSET +void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); +void EffectBlure_AddSpace(EffectBlure* this); +void EffectBlure_Init1(void* thisx, void* initParamsx); +void EffectBlure_Init2(void* thisx, void* initParamsx); +void EffectBlure_Destroy(void* thisx); +s32 EffectBlure_Update(void* thisx); +void EffectBlure_Draw(void* thisx, struct GraphicsContext* gfxCtx); +void EffectShieldParticle_Init(void* thisx, void* initParamsx); +void EffectShieldParticle_Destroy(void* thisx); +s32 EffectShieldParticle_Update(void* thisx); +void EffectShieldParticle_Draw(void* thisx, struct GraphicsContext* gfxCtx); +void EffectSpark_Init(void* thisx, void* initParamsx); +void EffectSpark_Destroy(void* thisx); +s32 EffectSpark_Update(void* thisx); +void EffectSpark_Draw(void* thisx, struct GraphicsContext* gfxCtx); +void func_80026230(struct PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026400(struct PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026608(struct PlayState* play); +void func_80026690(struct PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026860(struct PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_80026A6C(struct PlayState* play); +struct PlayState* Effect_GetPlayState(void); +void* Effect_GetByIndex(s32 index); +void Effect_InitContext(struct PlayState* play); +void Effect_Add(struct PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); +void Effect_DrawAll(struct GraphicsContext* gfxCtx); +void Effect_UpdateAll(struct PlayState* play); +void Effect_Delete(struct PlayState* play, s32 index); +void Effect_DeleteAll(struct PlayState* play); +void EffectSs_InitInfo(struct PlayState* play, s32 tableSize); +void EffectSs_ClearAll(struct PlayState* play); +void EffectSs_Delete(EffectSs* effectSs); +void EffectSs_Reset(EffectSs* effectSs); +void EffectSs_Insert(struct PlayState* play, EffectSs* effectSs); +void EffectSs_Spawn(struct PlayState* play, s32 type, s32 priority, void* initParams); +void EffectSs_UpdateAll(struct PlayState* play); +void EffectSs_DrawAll(struct PlayState* play); +s16 EffectSs_LerpInv(s16 a, s16 b, s32 weightInv); +s16 EffectSs_LerpS16(s16 a, s16 b, f32 weight); +u8 EffectSs_LerpU8(u8 a, u8 b, f32 weight); +void EffectSs_DrawGEffect(struct PlayState* play, EffectSs* this, void* texture); +void EffectSsDust_Spawn(struct PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, + u8 updateMode); +void func_8002829C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_80028304(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_8002836C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_800283D4(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_8002843C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_800284A4(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_80028510(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_8002857C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800285EC(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_8002865C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_800286CC(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_8002873C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 life); +void func_800287AC(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 life); +void func_8002881C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor); +void func_80028858(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, + Color_RGBA8* envColor); +void func_80028990(struct PlayState* play, f32 randScale, Vec3f* srcPos); +void func_80028A54(struct PlayState* play, f32 randScale, Vec3f* srcPos); +void EffectSsKiraKira_SpawnSmallYellow(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsKiraKira_SpawnSmall(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor); +void EffectSsKiraKira_SpawnDispersed(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); +void EffectSsKiraKira_SpawnFocused(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); +void EffectSsBomb_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnFade(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsBomb2_SpawnLayered(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 scaleStep); +void EffectSsBlast_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* innerColor, + Color_RGBA8* outerColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life); +void EffectSsBlast_SpawnWhiteShockwaveSetScale(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + s16 scale, s16 scaleStep, s16 life); +void EffectSsBlast_SpawnShockwaveSetColor(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* innerColor, Color_RGBA8* outerColor, s16 life); +void EffectSsBlast_SpawnWhiteShockwave(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnAccel(struct PlayState* play, struct Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void EffectSsGSpk_SpawnNoAccel(struct PlayState* play, struct Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void EffectSsGSpk_SpawnFuse(struct PlayState* play, struct Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void EffectSsGSpk_SpawnRandColor(struct PlayState* play, struct Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + s16 scale, s16 scaleStep); +void EffectSsGSpk_SpawnSmall(struct PlayState* play, struct Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor); +void EffectSsDFire_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 alpha, s16 fadeDelay, s32 life); +void EffectSsDFire_SpawnFixedScale(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha, + s16 fadeDelay); +void EffectSsBubble_Spawn(struct PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, + f32 scale); +void EffectSsGRipple_Spawn(struct PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); +void EffectSsGSplash_Spawn(struct PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, + s16 scale); +void EffectSsGMagma_Spawn(struct PlayState* play, Vec3f* pos); +void EffectSsGFire_Spawn(struct PlayState* play, Vec3f* pos); +void EffectSsLightning_Spawn(struct PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, + s16 scale, s16 yaw, s16 life, s16 numBolts); +void EffectSsDtBubble_SpawnColorProfile(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 life, s16 colorProfile, s16 randXZ); +void EffectSsDtBubble_SpawnCustomColor(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ); +void EffectSsHahen_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, + s16 objId, s16 life, Gfx* dList); +void EffectSsHahen_SpawnBurst(struct PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, + s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); +void EffectSsStick_Spawn(struct PlayState* play, Vec3f* pos, s16 yaw); +void EffectSsSibuki_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, + s16 direction, s16 scale); +void EffectSsSibuki_SpawnBurst(struct PlayState* play, Vec3f* pos); +void EffectSsSibuki2_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void EffectSsGMagma2_Spawn(struct PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, + s16 updateRate, s16 drawMode, s16 scale); +void EffectSsStone1_Spawn(struct PlayState* play, Vec3f* pos, s32 arg2); +void EffectSsHitMark_Spawn(struct PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsHitMark_SpawnFixedScale(struct PlayState* play, s32 type, Vec3f* pos); +void EffectSsHitMark_SpawnCustomScale(struct PlayState* play, s32 type, s16 scale, Vec3f* pos); +void EffectSsFhgFlash_SpawnLightBall(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + u8 param); +void EffectSsFhgFlash_SpawnShock(struct PlayState* play, struct Actor* actor, Vec3f* pos, s16 scale, u8 param); +void EffectSsKFire_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type); +void EffectSsSolderSrchBall_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, + s16* linkDetected); +void EffectSsKakera_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, + s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, + s16 objId, Gfx* dList); +void EffectSsIcePiece_Spawn(struct PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life); +void EffectSsIcePiece_SpawnBurst(struct PlayState* play, Vec3f* refPos, f32 scale); +void EffectSsEnIce_SpawnFlyingVec3f(struct PlayState* play, struct Actor* actor, Vec3f* pos, s16 primR, s16 primG, + s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); +void EffectSsEnIce_SpawnFlyingVec3s(struct PlayState* play, struct Actor* actor, Vec3s* pos, s16 primR, s16 primG, + s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, f32 scale); +void EffectSsEnIce_Spawn(struct PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, + Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); +void EffectSsFireTail_Spawn(struct PlayState* play, struct Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5, + Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life); +void EffectSsFireTail_SpawnFlame(struct PlayState* play, struct Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, + f32 colorIntensity); +void EffectSsFireTail_SpawnFlameOnPlayer(struct PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity); +void EffectSsEnFire_SpawnVec3f(struct PlayState* play, struct Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, + s16 bodyPart); +void EffectSsEnFire_SpawnVec3s(struct PlayState* play, struct Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, + s16 bodyPart); +void EffectSsExtra_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); +void EffectSsFCircle_Spawn(struct PlayState* play, struct Actor* actor, Vec3f* pos, s16 radius, s16 height); +void EffectSsDeadDb_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused, + s32 arg14, s16 playSfx); +void EffectSsDeadDd_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep, + s32 life); +void EffectSsDeadDd_SpawnRandYellow(struct PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale, + s32 randIter, s32 life); +void EffectSsDeadDs_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 alpha, s32 life); +void EffectSsDeadDs_SpawnStationary(struct PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life); +void EffectSsDeadSound_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId, + s16 lowerPriority, s16 repeatMode, s32 life); +void EffectSsDeadSound_SpawnStationary(struct PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, + s32 life); +void EffectSsIceSmoke_Spawn(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); + #endif diff --git a/include/zelda_arena.h b/include/zelda_arena.h new file mode 100644 index 0000000000..6bec3e4f02 --- /dev/null +++ b/include/zelda_arena.h @@ -0,0 +1,37 @@ +#ifndef ZELDA_ARENA_H +#define ZELDA_ARENA_H + +#include "ultra64.h" + +void* ZeldaArena_Malloc(u32 size); +void* ZeldaArena_MallocR(u32 size); +void* ZeldaArena_Realloc(void* ptr, u32 newSize); +void ZeldaArena_Free(void* ptr); +void* ZeldaArena_Calloc(u32 num, u32 size); +void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); +void ZeldaArena_Check(void); +void ZeldaArena_Init(void* start, u32 size); +void ZeldaArena_Cleanup(void); +s32 ZeldaArena_IsInitialized(void); + +#if OOT_DEBUG +void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); +void* ZeldaArena_MallocDebug(u32 size, const char* file, int line); +void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line); +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void ZeldaArena_FreeDebug(void* ptr, const char* file, int line); +void ZeldaArena_Display(void); + +#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_MallocDebug(size, file, line) +#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocRDebug(size, file, line) +#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_FreeDebug(size, file, line) + +#else + +#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_Malloc(size) +#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocR(size) +#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_Free(size) + +#endif + +#endif diff --git a/src/code/main.c b/src/code/main.c index c7fc231a1d..7bec04a76a 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -23,7 +23,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.2:156 pal-1.0:154 pal-1.1:154" + "ntsc-1.2:155 pal-1.0:153 pal-1.1:153" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 8a1328e68c..d1db06253c 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -5,7 +5,7 @@ #include "macros.h" #include "sys_math3d.h" -#pragma increment_block_number "gc-eu:104 gc-eu-mq:104 gc-jp:104 gc-jp-ce:104 gc-jp-mq:104 gc-us:104 gc-us-mq:104" \ +#pragma increment_block_number "gc-eu:103 gc-eu-mq:103 gc-jp:103 gc-jp-ce:103 gc-jp-mq:103 gc-us:103 gc-us-mq:103" \ "ntsc-1.2:79 pal-1.0:80 pal-1.1:80" s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7a5a8dc63d..431578d36f 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.2:144" +#pragma increment_block_number "ntsc-1.2:140" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index b1036d5951..cebb5260ad 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3638,7 +3638,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:98 pal-1.0:96 pal-1.1:96" + "ntsc-1.2:97 pal-1.0:95 pal-1.1:95" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index fd0a83d984..14a12b96b7 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -7,7 +7,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:208" \ - "pal-1.0:208 pal-1.1:208" + "pal-1.0:200 pal-1.1:200" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); @@ -2271,10 +2271,6 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk } } -#if OOT_DEBUG -static s8 sBssDummy0; -#endif - void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol, Collider* acCol) { static TriNorm tri1; static TriNorm tri2;