mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
z_lib fully matched (#85)
* z_lib OK * Documentation * Added stdbool and stdint * Fixup for new names * Fixup bad merge * Feedback * Use u/s32 for intptr_t
This commit is contained in:
+2
-2
@@ -18,7 +18,7 @@
|
||||
|
||||
/* Functions */
|
||||
|
||||
extern u32 osVirtualToPhysical(void*);
|
||||
extern void* osPhysicalToVirtual(u32);
|
||||
extern uintptr_t osVirtualToPhysical(void*);
|
||||
extern void* osPhysicalToVirtual(uintptr_t);
|
||||
|
||||
#endif
|
||||
|
||||
+50
-50
@@ -312,7 +312,7 @@ s32 osContStartReadData(OSMesgQueue* mq);
|
||||
void osContGetReadData(OSContPad* data);
|
||||
void __osPackReadData(void);
|
||||
// void func_8008A170(void);
|
||||
u32 osVirtualToPhysical(void* vaddr);
|
||||
uintptr_t osVirtualToPhysical(void* vaddr);
|
||||
u32 __osGetSR(void);
|
||||
void __osSetSR(u32 value);
|
||||
void osWritebackDCache(void* vaddr, s32 nbytes);
|
||||
@@ -1806,25 +1806,25 @@ u32 func_800FE4B8(GlobalContext* ctxt);
|
||||
void func_800FEAB0(void);
|
||||
// void func_800FEAC0(void);
|
||||
// void func_800FEAF4(void);
|
||||
void* Lib_bcopy(void* dst, void* src, size_t n);
|
||||
s32* Lib_MemSet(s32* buffer, s32 value, u32 size);
|
||||
void* Lib_MemCpy(void* dest, void* src, size_t size);
|
||||
void* Lib_MemSet(void* buffer, s32 value, size_t size);
|
||||
f32 Math_CosS(s16 angle);
|
||||
f32 Math_SinS(s16 angle);
|
||||
s32 Lib_StepTowardsGet_i(s32 start, s32 value, s32 step);
|
||||
void Lib_StepTowards_i(s32* start, s32 value, s32 step);
|
||||
s32 Lib_StepTowardsCheck_i(s32* start, s32 value, s32 step);
|
||||
s32 Lib_StepTowardsCheckFramerateScaled_s(s16* start, s16 target, s16 step);
|
||||
s32 Lib_StepTowardsCheck_s(s16* start, s16 target, s16 step);
|
||||
s32 Lib_StepTowardsCheck_c(s8* start, s8 target, s8 step);
|
||||
s32 Lib_StepTowardsCheck_f(f32* start, f32 target, f32 step);
|
||||
// void func_800FF0D0(void);
|
||||
// void func_800FF138(void);
|
||||
// void func_800FF1FC(void);
|
||||
// void func_800FF2A8(void);
|
||||
// void func_800FF2F8(void);
|
||||
// void func_800FF3A0(void);
|
||||
s32 Math_StepToIImpl(s32 start, s32 target, s32 step);
|
||||
void Math_StepToIGet(s32* pValue, s32 target, s32 step);
|
||||
s32 Math_StepToI(s32* pValue, s32 target, s32 step);
|
||||
s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_StepToS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_StepToC(s8* pValue, s8 target, s8 step);
|
||||
s32 Math_StepToF(f32* pValue, f32 target, f32 step);
|
||||
s32 Math_StepUntilAngleS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_AsymStepToS(s16* pValue, s16 target, s16 incrStep, s16 decrStep);
|
||||
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step);
|
||||
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
|
||||
void func_800FF3A0(f32* distOut, s16* angleOut, Input* input);
|
||||
s16 Rand_S16Offset(s16 base, s16 range);
|
||||
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range);
|
||||
s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range);
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src);
|
||||
void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src);
|
||||
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src);
|
||||
@@ -1836,45 +1836,45 @@ void Math_Vec3f_Scale(Vec3f* vec, f32 scale);
|
||||
void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest);
|
||||
void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest);
|
||||
void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
|
||||
void Math_Vec3f_ModifyRand(Vec3f* orig, f32 scale, Vec3f* dest);
|
||||
void Math_Vec3f_DistXYZAndStoreNormalizedDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
|
||||
void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest);
|
||||
void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
|
||||
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b);
|
||||
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* difference);
|
||||
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
|
||||
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b);
|
||||
f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* xDiff, f32* zDiff);
|
||||
f32 Math_Vec3f_PushAwayXZ(Vec3f* start, Vec3f* pusher, f32 distanceToApproach);
|
||||
f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* dx, f32* dz);
|
||||
f32 Math_Vec3f_StepToXZ(Vec3f* start, Vec3f* target, f32 speed);
|
||||
f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b);
|
||||
s16 Math_Vec3f_Yaw(Vec3f* from, Vec3f* to);
|
||||
s16 Math_Vec3f_Pitch(Vec3f* from, Vec3f* to);
|
||||
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* init);
|
||||
void IChain_Apply_u8(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_s8(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_u16(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_s16(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_u32(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_s32(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_f32(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_f32div1000(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_Vec3f(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_Vec3fdiv1000(u8* actor, InitChainEntry* init);
|
||||
void IChain_Apply_Vec3s(u8* actor, InitChainEntry* init);
|
||||
f32 Math_SmoothScaleMaxMinF(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4);
|
||||
void Math_SmoothScaleMaxF(f32* start, f32 target, f32 scale, f32 maxStep);
|
||||
void Math_SmoothDownscaleMaxF(f32* start, f32 scale, f32 maxStep);
|
||||
s32 Math_SmoothScaleMaxMinS(s16* start, s16 target, s16 scale, s16 maxStep, s16 minStep);
|
||||
void Math_SmoothScaleMaxS(s16* start, s16 target, s16 scale, s16 maxStep);
|
||||
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b);
|
||||
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b);
|
||||
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain);
|
||||
// void IChain_Apply_u8(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_s8(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_u16(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_s16(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_u32(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_s32(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_f32(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_f32div1000(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_Vec3f(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_Vec3fdiv1000(u8* actor, InitChainEntry* init);
|
||||
// void IChain_Apply_Vec3s(u8* actor, InitChainEntry* init);
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep);
|
||||
void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep);
|
||||
void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep);
|
||||
s32 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep);
|
||||
void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep);
|
||||
void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src);
|
||||
void func_801000A4(u16 param_1);
|
||||
void func_801000CC(u16 param_1);
|
||||
void func_801000F4(UNK_TYPE4 param_1, u16 param_2);
|
||||
void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src, Vec3f* dst);
|
||||
void func_801000A4(u16 sfxId);
|
||||
void func_801000CC(u16 sfxId);
|
||||
void func_801000F4(s32 a0, u16 a1);
|
||||
void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, Vec3f* src, Vec3f* dst);
|
||||
void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst);
|
||||
f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach);
|
||||
f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed);
|
||||
void Lib_Nop801004FC(void);
|
||||
void* Lib_PtrSegToVirt(void* ptr);
|
||||
void* Lib_PtrSegToVirtNull(void* ptr);
|
||||
void* Lib_PtrSegToK0(void* ptr);
|
||||
void* Lib_PtrSegToK0Null(void* ptr);
|
||||
void* Lib_SegmentedToVirtual(void* ptr);
|
||||
void* Lib_SegmentedToVirtualNull(void* ptr);
|
||||
void* Lib_PhysicalToVirtual(void* ptr);
|
||||
void* Lib_PhysicalToVirtualNull(void* ptr);
|
||||
void LifeMeter_Init(GlobalContext* ctxt);
|
||||
void LifeMeter_UpdateColors(GlobalContext* ctxt);
|
||||
// UNK_TYPE4 func_80100A80(GlobalContext* ctxt);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef _GUINT_H_
|
||||
#define _GUINT_H_
|
||||
|
||||
// TODO should be in libultra/gu
|
||||
|
||||
#include <PR/gbi.h>
|
||||
#include <PR/abi.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include <sptask.h> // TODO the load path for this is actually PR/sptask.h, why?
|
||||
#include <PR/gu.h>
|
||||
|
||||
typedef union {
|
||||
/* 0x0 */ struct {
|
||||
/* 0x0 */ unsigned int hi;
|
||||
/* 0x4 */ unsigned int lo;
|
||||
} word;
|
||||
/* 0x0 */ double d;
|
||||
} du;
|
||||
|
||||
|
||||
typedef union {
|
||||
/* 0x0 */ unsigned int i;
|
||||
/* 0x0 */ float f;
|
||||
} fu;
|
||||
|
||||
typedef float Matrix[4][4];
|
||||
|
||||
#endif
|
||||
+5
-4
@@ -2,19 +2,20 @@
|
||||
#define _MACROS_H_
|
||||
|
||||
#include "convert.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
||||
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xa0000000)
|
||||
|
||||
// UB: u32 casts here should be uintptr_t casts.
|
||||
// TODO: After uintptr_t cast change should have an AVOID_UB target that just toggles the KSEG0 bit in the address rather than add/sub 0x80000000
|
||||
#define PHYSICAL_TO_VIRTUAL(addr) ((u32)(addr) + 0x80000000)
|
||||
#define PHYSICAL_TO_VIRTUAL2(addr) ((u32)(addr) - 0x80000000)
|
||||
#define VIRTUAL_TO_PHYSICAL(addr) (u32)((u8*)(addr) - 0x80000000)
|
||||
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) + 0x80000000)
|
||||
#define PHYSICAL_TO_VIRTUAL2(addr) ((uintptr_t)(addr) - 0x80000000)
|
||||
#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000)
|
||||
#define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr))
|
||||
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
// Currently most often called ctxt in MM, TODO: Refactor names when its used
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#define M_PI 3.14159265358979323846f
|
||||
#define M_SQRT2 1.41421356237309504880f
|
||||
#define FLT_MAX 340282346638528859811704183484516925440.0f
|
||||
#define SHT_MAX 32767.0f
|
||||
#define SHT_MINV (1.0f / SHT_MAX)
|
||||
#define DEGTORAD(x) (x * M_PI / 180.0f)
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u32 hi;
|
||||
u32 lo;
|
||||
} word;
|
||||
|
||||
f64 d;
|
||||
} du;
|
||||
|
||||
typedef union {
|
||||
u32 i;
|
||||
f32 f;
|
||||
} fu;
|
||||
|
||||
extern f32 __libm_qnan_f;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef _STDBOOL_H_
|
||||
#define _STDBOOL_H_
|
||||
|
||||
#define false 0
|
||||
#define true !false
|
||||
|
||||
#endif /* _STDBOOL_H_ */
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef _STDINT_H_
|
||||
#define _STDINT_H_
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
typedef s32 intptr_t;
|
||||
typedef u32 uintptr_t;
|
||||
|
||||
#define INT8_MIN (-0x80)
|
||||
#define INT16_MIN (-0x8000)
|
||||
#define INT32_MIN (-0x80000000)
|
||||
#define INT64_MIN (-0x8000000000000000)
|
||||
|
||||
#define INT8_MAX 0x7f
|
||||
#define INT16_MAX 0x7fff
|
||||
#define INT32_MAX 0x7fffffff
|
||||
#define INT64_MAX 0x7fffffffffffffff
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
#define UINT16_MAX 0xffff
|
||||
#define UINT32_MAX 0xffffffff
|
||||
#define UINT64_MAX 0xffffffffffffffff
|
||||
|
||||
#define INTPTR_MIN (-0x80000000)
|
||||
#define INTPTR_MAX 0x7fffffff
|
||||
#define UINTPTR_MAX 0xffffffff
|
||||
|
||||
|
||||
#endif /* _STDINT_H_ */
|
||||
+1
-1
@@ -1010,7 +1010,7 @@ extern u8 kanfontOrdering[92];
|
||||
// extern UNK_TYPE1 D_801BE90C;
|
||||
// extern UNK_TYPE1 D_801BE92C;
|
||||
// extern UNK_TYPE1 D_801BE944;
|
||||
extern actor_init_var_func actorInitVarFuncs[11];
|
||||
// extern actor_init_var_func sInitChainHandlers[11];
|
||||
// extern UNK_TYPE2 D_801BE990;
|
||||
// extern UNK_TYPE2 D_801BE992;
|
||||
// extern UNK_TYPE2 D_801BE994;
|
||||
|
||||
+5
-3
@@ -1,13 +1,17 @@
|
||||
#ifndef _Z64_H_
|
||||
#define _Z64_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <PR/sched.h>
|
||||
#include <io/controller.h>
|
||||
#include <osint.h>
|
||||
#include <viint.h>
|
||||
#include <guint.h>
|
||||
#include <math.h>
|
||||
#include <os.h>
|
||||
#include <stdlib.h>
|
||||
#include <xstdio.h>
|
||||
@@ -444,8 +448,6 @@ typedef unsigned long(*func)(void);
|
||||
|
||||
typedef void(*func_ptr)(void);
|
||||
|
||||
typedef void(*actor_init_var_func)(u8*, InitChainEntry*);
|
||||
|
||||
typedef void(*osCreateThread_func)(void*);
|
||||
|
||||
typedef void*(*printf_func)(void*, char*, size_t);
|
||||
|
||||
@@ -487,7 +487,7 @@ SECTIONS
|
||||
build/asm/code/code_data_z_jpeg.o(.data)
|
||||
build/asm/code/code_data_z_kanfont.o(.data)
|
||||
build/asm/code/code_data_z_kankyo.o(.data)
|
||||
build/asm/code/code_data_z_lib.o(.data)
|
||||
build/src/code/z_lib.o(.data)
|
||||
build/asm/code/code_data_z_lifemeter.o(.data)
|
||||
build/src/code/z_lights.o(.data)
|
||||
build/asm/code/code_data_z_map_disp.o(.data)
|
||||
@@ -563,7 +563,7 @@ SECTIONS
|
||||
build/asm/code/code_rodata_z_horse.o(.rodata)
|
||||
build/asm/code/code_rodata_z_jpeg.o(.rodata)
|
||||
build/asm/code/code_rodata_z_kankyo.o(.rodata)
|
||||
build/asm/code/code_rodata_z_lib.o(.rodata)
|
||||
build/src/code/z_lib.o(.rodata)
|
||||
build/asm/code/code_rodata_z_lifemeter.o(.rodata)
|
||||
build/src/code/z_lights.o(.rodata)
|
||||
build/asm/code/code_rodata_z_map_disp.o(.rodata)
|
||||
|
||||
@@ -19,10 +19,10 @@ s32 nop_800E8EEC(UNK_TYPE4 param_1) {
|
||||
void nop_800E8EFC(UNK_TYPE4 param_1) {}
|
||||
|
||||
s32 func_800E8F08(Vec3s* param_1, Vec3s* param_2) {
|
||||
Math_SmoothScaleMaxMinS(¶m_1->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_1->x, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_2->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_2->x, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(¶m_1->y, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(¶m_1->x, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(¶m_2->y, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(¶m_2->x, 0, 6, 6200, 100);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
|
||||
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos,param_2);
|
||||
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos,param_2) - actor->world.rot.y;
|
||||
|
||||
Math_SmoothScaleMaxMinS(¶m_3->x, targetPitch, 6, 2000, 1);
|
||||
Math_SmoothStepToS(¶m_3->x, targetPitch, 6, 2000, 1);
|
||||
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
|
||||
|
||||
yawDiffFromTarget = Math_SmoothScaleMaxMinS(¶m_3->y, targetYaw, 6, 2000, 1);
|
||||
yawDiffFromTarget = Math_SmoothStepToS(¶m_3->y, targetYaw, 6, 2000, 1);
|
||||
param_3->y = (param_3->y < -8000)? -8000 : ((8000 < param_3->y)? 8000 : param_3->y);
|
||||
|
||||
if (yawDiffFromTarget != 0) {
|
||||
@@ -46,7 +46,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
|
||||
}
|
||||
}
|
||||
|
||||
Math_SmoothScaleMaxMinS(¶m_4->y, targetYaw - param_3->y, 4, 2000, 1);
|
||||
Math_SmoothStepToS(¶m_4->y, targetYaw - param_3->y, 4, 2000, 1);
|
||||
param_4->y = (param_4->y < -12000)? -12000 : ((12000 < param_4->y)? 12000 : param_4->y);
|
||||
|
||||
return 1;
|
||||
|
||||
+4
-4
@@ -265,11 +265,11 @@ void Actor_TitleCardCreate(GlobalContext* ctxt, TitleCardContext* titleCtxt, u32
|
||||
void Actor_TitleCardUpdate(GlobalContext* ctxt, TitleCardContext* titleCtxt) {
|
||||
if (DECR(titleCtxt->fadeInDelay) == 0) {
|
||||
if (DECR(titleCtxt->fadeOutDelay) == 0) {
|
||||
Lib_StepTowardsCheck_s(&titleCtxt->alpha, 0, 30);
|
||||
Lib_StepTowardsCheck_s(&titleCtxt->color, 0, 70);
|
||||
Math_StepToS(&titleCtxt->alpha, 0, 30);
|
||||
Math_StepToS(&titleCtxt->color, 0, 70);
|
||||
} else {
|
||||
Lib_StepTowardsCheck_s(&titleCtxt->alpha, 255, 10);
|
||||
Lib_StepTowardsCheck_s(&titleCtxt->color, 255, 20);
|
||||
Math_StepToS(&titleCtxt->alpha, 255, 10);
|
||||
Math_StepToS(&titleCtxt->color, 255, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur
|
||||
|
||||
if (mtx != NULL) {
|
||||
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_PtrSegToVirt(texture));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(texture));
|
||||
func_8012C9BC(gfxCtx);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rgPrimColorR, this->rgPrimColorG, this->rgPrimColorB,
|
||||
this->rgPrimColorA);
|
||||
|
||||
@@ -275,14 +275,14 @@ void func_800A640C(EnItem00* this, GlobalContext* ctxt) {
|
||||
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
|
||||
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) && (this->actor.params < ITEM00_BOMBS_0)) {
|
||||
if (this->unk152 == -1) {
|
||||
if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500)) {
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500)) {
|
||||
this->unk152 = -2;
|
||||
}
|
||||
} else if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, -0x4000 - this->actor.world.rot.x, 2, 3000, 1500)) {
|
||||
} else if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -0x4000 - this->actor.world.rot.x, 2, 3000, 1500)) {
|
||||
this->unk152 = -1;
|
||||
}
|
||||
|
||||
Math_SmoothScaleMaxMinS(&this->actor.world.rot.x, 0, 2, 2500, 500);
|
||||
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
|
||||
} else if ((this->actor.params == ITEM00_MAP) || (this->actor.params == ITEM00_COMPASS)) {
|
||||
this->unk152 = -1;
|
||||
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
|
||||
@@ -292,7 +292,7 @@ void func_800A640C(EnItem00* this, GlobalContext* ctxt) {
|
||||
this->actor.shape.yOffset = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + 850.0f;
|
||||
}
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
|
||||
|
||||
if (this->unk14C == 0) {
|
||||
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && (this->actor.params != ITEM00_HEART_CONTAINER)) {
|
||||
@@ -443,7 +443,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->actor.scale.x, this->unk154, 0.1f, this->unk154 * 0.1f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.scale.x, this->unk154, 0.1f, this->unk154 * 0.1f, 0.0f);
|
||||
this->actor.scale.z = this->actor.scale.x;
|
||||
this->actor.scale.y = this->actor.scale.x;
|
||||
|
||||
@@ -709,7 +709,7 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_801ADF30[iconNb]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF30[iconNb]));
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, &D_040622C0); // TODO symbol
|
||||
|
||||
@@ -751,7 +751,7 @@ void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) {
|
||||
|
||||
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_801ADF44[iconNb]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF44[iconNb]));
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
|
||||
+357
-263
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -28,7 +28,7 @@ void Room_DrawType0Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
|
||||
}
|
||||
|
||||
mesh = &room->mesh->type0;
|
||||
meshParams = (RoomMeshType0Params*)Lib_PtrSegToVirt(mesh->paramsStart);
|
||||
meshParams = (RoomMeshType0Params*)Lib_SegmentedToVirtual(mesh->paramsStart);
|
||||
for (i = 0; i < mesh->count; i++) {
|
||||
if ((flags & 1) && (meshParams->opaqueDl != NULL)) {
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, meshParams->opaqueDl);
|
||||
|
||||
+23
-23
@@ -157,7 +157,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
s16 temp16;
|
||||
u8 unk20;
|
||||
|
||||
ctxt->linkActorEntry = (ActorEntry*)Lib_PtrSegToVirt(entry->spawnList.segment) +
|
||||
ctxt->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(entry->spawnList.segment) +
|
||||
ctxt->setupEntranceList[ctxt->curSpawn].spawn;
|
||||
if ( (ctxt->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
|
||||
(gSaveContext.extra.unk10 == 0x02 && gSaveContext.extra.unk42 == 0x0CFF)
|
||||
@@ -181,13 +181,13 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
// Scene Command 0x01: Actor List
|
||||
void Scene_HeaderCommand01(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->sceneNumActorsToLoad = (u16)entry->actorList.num;
|
||||
ctxt->setupActorList = (ActorEntry*)Lib_PtrSegToVirt(entry->actorList.segment);
|
||||
ctxt->setupActorList = (ActorEntry*)Lib_SegmentedToVirtual(entry->actorList.segment);
|
||||
ctxt->actorCtx.unkC = (u16)0;
|
||||
}
|
||||
|
||||
// Scene Command 0x02: Cutscene Camera List
|
||||
void Scene_HeaderCommand02(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->unk18858 = (UNK_PTR)Lib_PtrSegToVirt(entry->csCameraList.segment);
|
||||
ctxt->unk18858 = (UNK_PTR)Lib_SegmentedToVirtual(entry->csCameraList.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x03: Collision Header
|
||||
@@ -195,18 +195,18 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
BgMeshHeader* temp_ret;
|
||||
BgMeshHeader* temp_s0;
|
||||
|
||||
temp_ret = (BgMeshHeader*)Lib_PtrSegToVirt(entry->colHeader.segment);
|
||||
temp_ret = (BgMeshHeader*)Lib_SegmentedToVirtual(entry->colHeader.segment);
|
||||
temp_s0 = temp_ret;
|
||||
temp_s0->vertices = (BgVertex*)Lib_PtrSegToVirt(temp_ret->vertices);
|
||||
temp_s0->polygons = (CollisionPoly*)Lib_PtrSegToVirt(temp_s0->polygons);
|
||||
temp_s0->vertices = (BgVertex*)Lib_SegmentedToVirtual(temp_ret->vertices);
|
||||
temp_s0->polygons = (CollisionPoly*)Lib_SegmentedToVirtual(temp_s0->polygons);
|
||||
if (temp_s0->attributes != 0) {
|
||||
temp_s0->attributes = (BgPolygonAttributes*)Lib_PtrSegToVirt(temp_s0->attributes);
|
||||
temp_s0->attributes = (BgPolygonAttributes*)Lib_SegmentedToVirtual(temp_s0->attributes);
|
||||
}
|
||||
if (temp_s0->cameraData != 0) {
|
||||
temp_s0->cameraData = (void*)Lib_PtrSegToVirt(temp_s0->cameraData);
|
||||
temp_s0->cameraData = (void*)Lib_SegmentedToVirtual(temp_s0->cameraData);
|
||||
}
|
||||
if (temp_s0->waterboxes != 0) {
|
||||
temp_s0->waterboxes = (BgWaterBox*)Lib_PtrSegToVirt(temp_s0->waterboxes);
|
||||
temp_s0->waterboxes = (BgWaterBox*)Lib_SegmentedToVirtual(temp_s0->waterboxes);
|
||||
}
|
||||
|
||||
BgCheck_Init(&ctxt->colCtx, ctxt, temp_s0);
|
||||
@@ -215,12 +215,12 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
// Scene Command 0x04: Room List
|
||||
void Scene_HeaderCommand04(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->numRooms = entry->roomList.num;
|
||||
ctxt->roomList = (RoomFileLocation*)Lib_PtrSegToVirt(entry->roomList.segment);
|
||||
ctxt->roomList = (RoomFileLocation*)Lib_SegmentedToVirtual(entry->roomList.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x06: Entrance List
|
||||
void Scene_HeaderCommand06(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->setupEntranceList = (EntranceEntry*)Lib_PtrSegToVirt(entry->entranceList.segment);
|
||||
ctxt->setupEntranceList = (EntranceEntry*)Lib_SegmentedToVirtual(entry->entranceList.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x07: Special Files
|
||||
@@ -250,7 +250,7 @@ void Scene_HeaderCommand08(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
|
||||
// Scene Command 0x0A: Mesh Header
|
||||
void Scene_HeaderCommand0A(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->roomContext.currRoom.mesh = (RoomMesh*)Lib_PtrSegToVirt(entry->mesh.segment);
|
||||
ctxt->roomContext.currRoom.mesh = (RoomMesh*)Lib_SegmentedToVirtual(entry->mesh.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x0B: Object List
|
||||
@@ -262,7 +262,7 @@ void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
|
||||
s16* objectEntry;
|
||||
void* nextPtr;
|
||||
|
||||
objectEntry = (s16*)Lib_PtrSegToVirt(entry->objectList.segment);
|
||||
objectEntry = (s16*)Lib_SegmentedToVirtual(entry->objectList.segment);
|
||||
k = 0;
|
||||
i = ctxt->sceneContext.spawnedObjectCount;
|
||||
status = &ctxt->sceneContext.objects[i];
|
||||
@@ -307,7 +307,7 @@ void Scene_HeaderCommand0C(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
s32 i;
|
||||
LightInfo* lightInfo;
|
||||
|
||||
lightInfo = (LightInfo*)Lib_PtrSegToVirt(entry->lightList.segment);
|
||||
lightInfo = (LightInfo*)Lib_SegmentedToVirtual(entry->lightList.segment);
|
||||
for (i = 0; i < entry->lightList.num; i++)
|
||||
{
|
||||
LightContext_InsertLight(ctxt, &ctxt->lightCtx, lightInfo);
|
||||
@@ -317,13 +317,13 @@ void Scene_HeaderCommand0C(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
|
||||
// Scene Command 0x0D: Path List
|
||||
void Scene_HeaderCommand0D(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->setupPathList = (void*)Lib_PtrSegToVirt(entry->pathList.segment);
|
||||
ctxt->setupPathList = (void*)Lib_SegmentedToVirtual(entry->pathList.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x0E: Transition Actor List
|
||||
void Scene_HeaderCommand0E(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->transitionActorCount = entry->transiActorList.num;
|
||||
ctxt->transitionActorList = (TransitionActorEntry*)Lib_PtrSegToVirt((void*)entry->transiActorList.segment);
|
||||
ctxt->transitionActorList = (TransitionActorEntry*)Lib_SegmentedToVirtual((void*)entry->transiActorList.segment);
|
||||
func_80105818(ctxt, ctxt->transitionActorCount, ctxt->transitionActorList);
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ void func_8012FEBC(GlobalContext* ctxt, u8* nbTransitionActors) {
|
||||
// Scene Command 0x0F: Light Setting List
|
||||
void Scene_HeaderCommand0F(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->kankyoContext.environmentSettingsCount = entry->lightSettingList.num;
|
||||
ctxt->kankyoContext.environmentSettingsList = (void*)Lib_PtrSegToVirt(entry->lightSettingList.segment);
|
||||
ctxt->kankyoContext.environmentSettingsList = (void*)Lib_SegmentedToVirtual(entry->lightSettingList.segment);
|
||||
}
|
||||
|
||||
s32 func_8012FF10(GlobalContext* ctxt, s32 fileIndex) {
|
||||
@@ -423,7 +423,7 @@ void Scene_HeaderCommand05(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
}
|
||||
|
||||
void Scene_HeaderCommand13(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->setupExitList = (void*)Lib_PtrSegToVirt(entry->exitList.segment);
|
||||
ctxt->setupExitList = (void*)Lib_SegmentedToVirtual(entry->exitList.segment);
|
||||
}
|
||||
|
||||
// Scene Command 0x09: Undefined
|
||||
@@ -450,10 +450,10 @@ void Scene_HeaderCommand18(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
SceneCmd** altHeaderList;
|
||||
SceneCmd* altHeader;
|
||||
if (gSaveContext.extra.sceneSetupIndex) {
|
||||
altHeaderList = (SceneCmd**)Lib_PtrSegToVirt(entry->altHeaders.segment);
|
||||
altHeaderList = (SceneCmd**)Lib_SegmentedToVirtual(entry->altHeaders.segment);
|
||||
altHeader = altHeaderList[gSaveContext.extra.sceneSetupIndex - 1];
|
||||
if (altHeader != NULL) {
|
||||
Scene_ProcessHeader(ctxt, (SceneCmd*)Lib_PtrSegToVirt(altHeader));
|
||||
Scene_ProcessHeader(ctxt, (SceneCmd*)Lib_SegmentedToVirtual(altHeader));
|
||||
(entry + 1)->base.code = 0x14;
|
||||
}
|
||||
}
|
||||
@@ -462,12 +462,12 @@ void Scene_HeaderCommand18(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
// Scene Command 0x17: Cutscene Data
|
||||
void Scene_HeaderCommand17(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->csCtx.cutsceneCount = (u8)entry->base.data1;
|
||||
ctxt->cutsceneList = (CutsceneEntry*)Lib_PtrSegToVirt((void*)entry->base.data2);
|
||||
ctxt->cutsceneList = (CutsceneEntry*)Lib_SegmentedToVirtual((void*)entry->base.data2);
|
||||
}
|
||||
|
||||
// Scene Command 0x1B: Cutscene Actor List
|
||||
void Scene_HeaderCommand1B(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ActorCutscene_Init(ctxt, (ActorCutscene*)Lib_PtrSegToVirt(entry->cutsceneActorList.segment),
|
||||
ActorCutscene_Init(ctxt, (ActorCutscene*)Lib_SegmentedToVirtual(entry->cutsceneActorList.segment),
|
||||
entry->cutsceneActorList.num);
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ void Scene_HeaderCommand19(GlobalContext *ctxt, SceneCmd *entry) {
|
||||
|
||||
// Scene Command 0x1A: Texture Animations
|
||||
void Scene_HeaderCommand1A(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->sceneTextureAnimations = (AnimatedTexture*)Lib_PtrSegToVirt(entry->textureAnimations.segment);
|
||||
ctxt->sceneTextureAnimations = (AnimatedTexture*)Lib_SegmentedToVirtual(entry->textureAnimations.segment);
|
||||
}
|
||||
|
||||
void func_801306A4(GlobalContext *ctxt) {
|
||||
|
||||
@@ -109,14 +109,14 @@ void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTex
|
||||
|
||||
void SceneProc_DrawType2Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) {
|
||||
Color_RGBA8* envColor;
|
||||
FlashingTexturePrimColor* primColor = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params->primColors);
|
||||
FlashingTexturePrimColor* primColor = (FlashingTexturePrimColor *)Lib_SegmentedToVirtual(params->primColors);
|
||||
u32 pad;
|
||||
u32 index = gSceneProcStep % params->cycleLength;
|
||||
|
||||
primColor += index;
|
||||
|
||||
if (params->envColors) {
|
||||
envColor = (Color_RGBA8*)Lib_PtrSegToVirt(params->envColors) + index;
|
||||
envColor = (Color_RGBA8*)Lib_SegmentedToVirtual(params->envColors) + index;
|
||||
} else {
|
||||
envColor = NULL;
|
||||
}
|
||||
@@ -133,8 +133,8 @@ s32 SceneProc_Lerp(s32 a, s32 b, f32 t) {
|
||||
void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) {
|
||||
FlashingTextureParams* params2 = params;
|
||||
Color_RGBA8* envColorTo;
|
||||
FlashingTexturePrimColor* primColorTo = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params2->primColors);
|
||||
u16* keyFrames = (u16*)Lib_PtrSegToVirt(params2->keyFrames);
|
||||
FlashingTexturePrimColor* primColorTo = (FlashingTexturePrimColor *)Lib_SegmentedToVirtual(params2->primColors);
|
||||
u16* keyFrames = (u16*)Lib_SegmentedToVirtual(params2->keyFrames);
|
||||
s32 index = gSceneProcStep % params2->cycleLength;
|
||||
s32 pad1;
|
||||
s32 keyFrameIndex;
|
||||
@@ -169,7 +169,7 @@ void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextur
|
||||
primColorIn.lodFrac = SceneProc_Lerp(primColorFrom->lodFrac, primColorTo->lodFrac, t);
|
||||
|
||||
if (params2->envColors) {
|
||||
envColorTo = (Color_RGBA8*)Lib_PtrSegToVirt(params2->envColors) + keyFrameIndex;
|
||||
envColorTo = (Color_RGBA8*)Lib_SegmentedToVirtual(params2->envColors) + keyFrameIndex;
|
||||
envColorFrom = envColorTo - 1;
|
||||
envColorIn.red = SceneProc_Lerp(envColorFrom->red, envColorTo->red, t);
|
||||
envColorIn.green = SceneProc_Lerp(envColorFrom->green, envColorTo->green, t);
|
||||
@@ -210,10 +210,10 @@ void SceneProc_DrawType5Texture(GlobalContext* ctxt, u32 segment, CyclingTexture
|
||||
GraphicsContext* gfxCtx;
|
||||
s32 step;
|
||||
|
||||
dls = (Gfx**)Lib_PtrSegToVirt(params->textureDls);
|
||||
offsets = (u8*)Lib_PtrSegToVirt(params->textureDlOffsets);
|
||||
dls = (Gfx**)Lib_SegmentedToVirtual(params->textureDls);
|
||||
offsets = (u8*)Lib_SegmentedToVirtual(params->textureDlOffsets);
|
||||
step = gSceneProcStep % params->cycleLength;
|
||||
dl = (Gfx*)Lib_PtrSegToVirt(dls[offsets[step]]);
|
||||
dl = (Gfx*)Lib_SegmentedToVirtual(dls[offsets[step]]);
|
||||
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
if (gSceneProcFlags & 1) {
|
||||
@@ -239,7 +239,7 @@ void SceneProc_DrawAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textur
|
||||
segment = textures->segment;
|
||||
segmentAbs = ((segment < 0)? -segment : segment) + 7;
|
||||
|
||||
gSceneProcDrawFuncs[textures->type](ctxt, segmentAbs, (void*)Lib_PtrSegToVirt(textures->params));
|
||||
gSceneProcDrawFuncs[textures->type](ctxt, segmentAbs, (void*)Lib_SegmentedToVirtual(textures->params));
|
||||
|
||||
textures++;
|
||||
} while (segment > -1);
|
||||
|
||||
+31
-31
@@ -39,7 +39,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
s32 pad;
|
||||
|
||||
Matrix_Push();
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = limbDrawTable[limbIndex];
|
||||
|
||||
@@ -98,7 +98,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
pos.z = limbDrawTable[0].z;
|
||||
@@ -147,7 +147,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
|
||||
rot = limbDrawTable[limbIndex];
|
||||
@@ -217,7 +217,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
pos.z = limbDrawTable[0].z;
|
||||
@@ -268,7 +268,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = limbDrawTable[limbIndex];
|
||||
pos.x = limbEntry->translation.x;
|
||||
@@ -321,7 +321,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
|
||||
Matrix_Push();
|
||||
rootLimb = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
rootLimb = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
@@ -365,7 +365,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = limbDrawTable[limbIndex];
|
||||
|
||||
@@ -429,7 +429,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
@@ -480,7 +480,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
|
||||
rot = limbDrawTable[limbIndex];
|
||||
@@ -551,7 +551,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
@@ -598,9 +598,9 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
* rotation value list, otherwise it is copied from the initial rotation value list
|
||||
*/
|
||||
void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst) {
|
||||
AnimationHeader* animationHeader = Lib_PtrSegToVirt(animationSeg);
|
||||
AnimationRotationIndex* index = Lib_PtrSegToVirt(animationHeader->rotationIndexSeg);
|
||||
AnimationRotationValue* rotationValueTable = Lib_PtrSegToVirt(animationHeader->rotationValueSeg);
|
||||
AnimationHeader* animationHeader = Lib_SegmentedToVirtual(animationSeg);
|
||||
AnimationRotationIndex* index = Lib_SegmentedToVirtual(animationHeader->rotationIndexSeg);
|
||||
AnimationRotationValue* rotationValueTable = Lib_SegmentedToVirtual(animationHeader->rotationValueSeg);
|
||||
AnimationRotationValue* frameRotationValueTable = &rotationValueTable[currentFrame];
|
||||
s32 i;
|
||||
u16 limit = animationHeader->limit;
|
||||
@@ -618,12 +618,12 @@ void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32
|
||||
}
|
||||
|
||||
s16 SkelAnime_GetTotalFrames(GenericAnimationHeader* animationSeg) {
|
||||
GenericAnimationHeader* animation = Lib_PtrSegToVirt(animationSeg);
|
||||
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg);
|
||||
return animation->frameCount;
|
||||
}
|
||||
|
||||
s16 SkelAnime_GetFrameCount(GenericAnimationHeader* animationSeg) {
|
||||
GenericAnimationHeader* animation = Lib_PtrSegToVirt(animationSeg);
|
||||
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg);
|
||||
|
||||
return (u16)animation->frameCount - 1;
|
||||
}
|
||||
@@ -641,7 +641,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
|
||||
rot = limbDrawTable[limbIndex];
|
||||
@@ -697,7 +697,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
@@ -744,7 +744,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = limbDrawTable[limbIndex];
|
||||
|
||||
@@ -808,7 +808,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
limbEntry = Lib_SegmentedToVirtual(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
pos.y = limbDrawTable[0].y;
|
||||
@@ -851,7 +851,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_skelanime/func_80134FFC.asm")
|
||||
|
||||
s16 func_801353D4(GenericAnimationHeader* animationSeg) {
|
||||
GenericAnimationHeader* animation = Lib_PtrSegToVirt(animationSeg);
|
||||
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg);
|
||||
|
||||
return animation->unk02;
|
||||
}
|
||||
@@ -861,7 +861,7 @@ s16 func_801353D4(GenericAnimationHeader* animationSeg) {
|
||||
* SkelAnime_GetTotalFrames
|
||||
*/
|
||||
s16 SkelAnime_GetTotalFrames2(GenericAnimationHeader* animationSeg) {
|
||||
GenericAnimationHeader* animation = Lib_PtrSegToVirt(animationSeg);
|
||||
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg);
|
||||
|
||||
return animation->frameCount;
|
||||
}
|
||||
@@ -871,7 +871,7 @@ s16 SkelAnime_GetTotalFrames2(GenericAnimationHeader* animationSeg) {
|
||||
* SkelAnime_GetFrameCount
|
||||
*/
|
||||
s16 SkelAnime_GetFrameCount2(GenericAnimationHeader* animationSeg) {
|
||||
GenericAnimationHeader* animation = Lib_PtrSegToVirt(animationSeg);
|
||||
GenericAnimationHeader* animation = Lib_SegmentedToVirtual(animationSeg);
|
||||
|
||||
return animation->frameCount - 1;
|
||||
}
|
||||
@@ -941,7 +941,7 @@ void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimetionEntry* l
|
||||
entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_LINKANIMETION);
|
||||
|
||||
if (entry != NULL) {
|
||||
linkAnimetionEntry = Lib_PtrSegToVirt(linkAnimetionSeg);
|
||||
linkAnimetionEntry = Lib_SegmentedToVirtual(linkAnimetionSeg);
|
||||
osCreateMesgQueue(&entry->types.type0.msgQueue, &entry->types.type0.msg, 1);
|
||||
DmaMgr_SendRequestImpl(
|
||||
&entry->types.type0.req, ram,
|
||||
@@ -1096,7 +1096,7 @@ void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime,
|
||||
s32 limbCount;
|
||||
u32 allocSize;
|
||||
|
||||
skeletonHeader = Lib_PtrSegToVirt(skeletonHeaderSeg);
|
||||
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
|
||||
headerCount = skeletonHeader->limbCount;
|
||||
skelAnime->initFlags = flags;
|
||||
limbCount = (flags & 2) ? headerCount : 1;
|
||||
@@ -1111,7 +1111,7 @@ void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime,
|
||||
|
||||
skelAnime->limbCount = limbCount;
|
||||
skelAnime->dListCount = skeletonHeader->dListCount;
|
||||
skelAnime->skeleton = Lib_PtrSegToVirt(skeletonHeader->skeletonSeg);
|
||||
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
|
||||
allocSize = sizeof(Vec3s) * limbCount;
|
||||
|
||||
if (flags & 8) {
|
||||
@@ -1363,9 +1363,9 @@ void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHead
|
||||
AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
|
||||
SkeletonHeader* skeletonHeader;
|
||||
|
||||
skeletonHeader = Lib_PtrSegToVirt(skeletonHeaderSeg);
|
||||
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
skelAnime->skeleton = Lib_PtrSegToVirt(skeletonHeader->skeletonSeg);
|
||||
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
|
||||
if (limbDrawTbl == NULL) {
|
||||
skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
|
||||
skelAnime->transitionDrawTbl = zelda_malloc(sizeof(*skelAnime->transitionDrawTbl) * skelAnime->limbCount);
|
||||
@@ -1383,10 +1383,10 @@ void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHe
|
||||
AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
|
||||
SkeletonHeader* skeletonHeader;
|
||||
|
||||
skeletonHeader = Lib_PtrSegToVirt(skeletonHeaderSeg);
|
||||
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
skelAnime->dListCount = skeletonHeader->dListCount;
|
||||
skelAnime->skeleton = Lib_PtrSegToVirt(skeletonHeader->skeletonSeg);
|
||||
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
|
||||
|
||||
if (limbDrawTbl == NULL) {
|
||||
skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
|
||||
@@ -1406,9 +1406,9 @@ void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, Skeleton
|
||||
AnimationHeader* animationSeg) {
|
||||
SkeletonHeader* skeletonHeader;
|
||||
|
||||
skeletonHeader = Lib_PtrSegToVirt(skeletonHeaderSeg);
|
||||
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
skelAnime->skeleton = Lib_PtrSegToVirt(skeletonHeader->skeletonSeg);
|
||||
skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
|
||||
skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
|
||||
skelAnime->transitionDrawTbl = zelda_malloc(sizeof(*skelAnime->transitionDrawTbl) * skelAnime->limbCount);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <guint.h>
|
||||
#include <math.h>
|
||||
|
||||
static const du P[] = {
|
||||
{0x3FF00000, 0x00000000},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user