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:
Rozelette
2021-04-07 17:16:16 -04:00
committed by GitHub
parent b22e26dbd8
commit d2c181a0a9
34 changed files with 626 additions and 492 deletions
+7 -7
View File
@@ -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(&param_1->y, 0, 6, 6200, 100);
Math_SmoothScaleMaxMinS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothScaleMaxMinS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothScaleMaxMinS(&param_2->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_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(&param_3->x, targetPitch, 6, 2000, 1);
Math_SmoothStepToS(&param_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(&param_3->y, targetYaw, 6, 2000, 1);
yawDiffFromTarget = Math_SmoothStepToS(&param_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(&param_4->y, targetYaw - param_3->y, 4, 2000, 1);
Math_SmoothStepToS(&param_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
View File
@@ -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);
}
}
}
+1 -1
View File
@@ -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);
+7 -7
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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
View File
@@ -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) {
+9 -9
View File
@@ -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
View File
@@ -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);