mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
z_quake OK and documented (#213)
* Create z_quake.c file * Match all quake functions with OoT counterparts (quake2 left) * z_quake OK * Document first half of quake * More docs * more cleanup * remember to format! * PR Suggestions * More PR Suggestions
This commit is contained in:
+3
-2
@@ -180,8 +180,9 @@ VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b) {
|
||||
|
||||
/**
|
||||
* Takes the sum of positions `a` (x,y,z coordinates) and `sph` (geographic coordinates), result is in x,y,z position
|
||||
* Identical to Quake_AddVec from OoT
|
||||
*/
|
||||
Vec3f* OLib_VecSphToVec3fSum(Vec3f* dest, Vec3f* a, VecSph* sph) {
|
||||
Vec3f* OLib_VecSphAddToVec3f(Vec3f* dest, Vec3f* a, VecSph* sph) {
|
||||
Vec3f vec;
|
||||
Vec3f b;
|
||||
|
||||
@@ -279,7 +280,7 @@ void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode) {
|
||||
case 1:
|
||||
OLib_Vec3fToVecSphGeo(&sph, b);
|
||||
sph.yaw += a->rot.y;
|
||||
OLib_VecSphToVec3fSum(dest, &a->pos, &sph);
|
||||
OLib_VecSphAddToVec3f(dest, &a->pos, &sph);
|
||||
break;
|
||||
case 2:
|
||||
dest->x = a->pos.x + b->x;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+22
-22
@@ -33,13 +33,13 @@ void View_Init(View* view, GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
view->scale = 1.0f;
|
||||
view->upDir.y = 1.0f;
|
||||
view->up.y = 1.0f;
|
||||
view->fovy = 60.0f;
|
||||
view->eye.x = 0.0f;
|
||||
view->eye.y = 0.0f;
|
||||
view->focalPoint.x = 0.0f;
|
||||
view->upDir.x = 0.0f;
|
||||
view->upDir.z = 0.0f;
|
||||
view->at.x = 0.0f;
|
||||
view->up.x = 0.0f;
|
||||
view->up.z = 0.0f;
|
||||
view->zNear = 10.0f;
|
||||
view->zFar = 12800.0f;
|
||||
view->eye.z = -1.0f;
|
||||
@@ -47,24 +47,24 @@ void View_Init(View* view, GraphicsContext* gfxCtx) {
|
||||
View_InitCameraQuake(view);
|
||||
}
|
||||
|
||||
void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* focalPoint, Vec3f* upDir) {
|
||||
if (eye->x == focalPoint->x && eye->z == focalPoint->z) {
|
||||
void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
|
||||
if (eye->x == at->x && eye->z == at->z) {
|
||||
eye->z += 0.1f;
|
||||
upDir->z = 0.0f;
|
||||
upDir->x = 0.0f;
|
||||
upDir->y = 1.0f;
|
||||
up->z = 0.0f;
|
||||
up->x = 0.0f;
|
||||
up->y = 1.0f;
|
||||
}
|
||||
|
||||
view->eye = *eye;
|
||||
view->focalPoint = *focalPoint;
|
||||
view->upDir = *upDir;
|
||||
view->at = *at;
|
||||
view->up = *up;
|
||||
view->flags |= 1;
|
||||
}
|
||||
|
||||
void func_8013F050(View* view, Vec3f* eye, Vec3f* focalPoint, Vec3f* upDir) {
|
||||
void func_8013F050(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
|
||||
view->eye = *eye;
|
||||
view->focalPoint = *focalPoint;
|
||||
view->upDir = *upDir;
|
||||
view->at = *at;
|
||||
view->up = *up;
|
||||
}
|
||||
|
||||
void View_SetScale(View* view, f32 scale) {
|
||||
@@ -321,12 +321,12 @@ s32 View_RenderToPerspectiveMatrix(View* view) {
|
||||
viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing));
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
if (view->eye.x == view->focalPoint.x && view->eye.y == view->focalPoint.y && view->eye.z == view->focalPoint.z) {
|
||||
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
|
||||
view->eye.z += 2.0f;
|
||||
}
|
||||
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->focalPoint.x, view->focalPoint.y, view->focalPoint.z,
|
||||
view->upDir.x, view->upDir.y, view->upDir.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
|
||||
view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
||||
@@ -455,12 +455,12 @@ s32 func_8013FD74(View* view) {
|
||||
viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing));
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
if (view->eye.x == view->focalPoint.x && view->eye.y == view->focalPoint.y && view->eye.z == view->focalPoint.z) {
|
||||
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
|
||||
view->eye.z += 2.0f;
|
||||
}
|
||||
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->focalPoint.x, view->focalPoint.y, view->focalPoint.z,
|
||||
view->upDir.x, view->upDir.y, view->upDir.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
|
||||
view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
||||
@@ -472,8 +472,8 @@ s32 func_8013FD74(View* view) {
|
||||
}
|
||||
|
||||
s32 func_80140024(View* view) {
|
||||
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->focalPoint.x, view->focalPoint.y,
|
||||
view->focalPoint.z, view->upDir.x, view->upDir.y, view->upDir.z);
|
||||
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
|
||||
view->up.y, view->up.z);
|
||||
|
||||
view->unkE0 = *view->viewingPtr;
|
||||
view->viewingPtr = &view->unkE0;
|
||||
|
||||
@@ -64,12 +64,12 @@ void func_80C0A838(BgIkninSusceil* this, GlobalContext* globalCtx) {
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 y, s16 countdown, s32 arg4) {
|
||||
void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 verticalMag, s16 countdown, s32 arg4) {
|
||||
s32 pad;
|
||||
s16 quake = Quake_Add(ACTIVE_CAM, 3);
|
||||
|
||||
Quake_SetSpeed(quake, 0x7B30);
|
||||
Quake_SetQuakeValues(quake, y, 0, 0, 0);
|
||||
Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0);
|
||||
Quake_SetCountdown(quake, countdown);
|
||||
if (arg4 == 1) {
|
||||
func_8013ECE0(10000.0f, 255, 20, 150);
|
||||
@@ -191,7 +191,7 @@ void func_80C0AD64(BgIkninSusceil* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.velocity.y *= 0.98f;
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 365.0f, 0.5f,
|
||||
this->dyna.actor.velocity.y, 1.0f) < 0.1f) {
|
||||
func_80C0A86C(this, globalCtx, 1, 0xE, 3);
|
||||
func_80C0A86C(this, globalCtx, 1, 14, 3);
|
||||
ActorCutscene_Stop(this->dyna.actor.cutscene);
|
||||
func_80C0AB14(this);
|
||||
} else {
|
||||
|
||||
@@ -47,7 +47,7 @@ const ActorInit En_Guruguru_InitVars = {
|
||||
};
|
||||
|
||||
static u16 textIDs[] = { 0x292A, 0x292B, 0x292C, 0x292D, 0x292E, 0x292F, 0x2930, 0x2931,
|
||||
0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x294D, 0x294E };
|
||||
0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x294D, 0x294E };
|
||||
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
@@ -80,8 +80,7 @@ void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 19.0f);
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable,
|
||||
16);
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable, 16);
|
||||
this->actor.targetMode = 0;
|
||||
if (this->actor.params != 2) {
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
@@ -375,9 +374,10 @@ void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
s32 EnGuruguru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
|
||||
s32 EnGuruguru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnGuruguru* this = THIS;
|
||||
|
||||
|
||||
if (limbIndex == 14) {
|
||||
rot->x += this->headXRot;
|
||||
rot->z += this->headZRot;
|
||||
|
||||
@@ -269,9 +269,9 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, GlobalContext* globalCtx) {
|
||||
Actor* attackNiw;
|
||||
|
||||
if ((this->unkTimer252 == 0) && (this->unk290 < 7)) {
|
||||
xView = globalCtx->view.focalPoint.x - globalCtx->view.eye.x;
|
||||
yView = globalCtx->view.focalPoint.y - globalCtx->view.eye.y;
|
||||
zView = globalCtx->view.focalPoint.z - globalCtx->view.eye.z;
|
||||
xView = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
yView = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
zView = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
newNiwPos.x = ((Rand_ZeroOne() - 0.5f) * xView) + globalCtx->view.eye.x;
|
||||
newNiwPos.y = randPlusMinusPoint5Scaled(0.3f) + (globalCtx->view.eye.y + 50.0f + (yView * 0.5f));
|
||||
newNiwPos.z = ((Rand_ZeroOne() - 0.5f) * zView) + globalCtx->view.eye.z;
|
||||
@@ -835,9 +835,9 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
if ((this->actor.floorHeight <= BGCHECK_Y_MIN) || (this->actor.floorHeight >= 32000.0f)) {
|
||||
// if cucco is off the map?
|
||||
Vec3f camera;
|
||||
camera.x = globalCtx->view.focalPoint.x - globalCtx->view.eye.x;
|
||||
camera.y = globalCtx->view.focalPoint.y - globalCtx->view.eye.y;
|
||||
camera.z = globalCtx->view.focalPoint.z - globalCtx->view.eye.z;
|
||||
camera.x = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
camera.y = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
camera.z = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
camResult = camera.y / sqrtf(SQXYZ(camera));
|
||||
|
||||
this->actor.world.pos.x = this->actor.home.pos.x;
|
||||
|
||||
@@ -341,10 +341,10 @@ void EnPametfrog_ShakeCamera(EnPametfrog* this, GlobalContext* globalCtx, f32 ma
|
||||
Vec3f eye;
|
||||
|
||||
y = BINANG_ROT180(func_800DFCDC(camera));
|
||||
eye.x = (Math_SinS(y) * magShakeXZ) + camera->focalPoint.x;
|
||||
eye.y = camera->focalPoint.y + magShakeY;
|
||||
eye.z = (Math_CosS(y) * magShakeXZ) + camera->focalPoint.z;
|
||||
func_8016970C(globalCtx, this->camId, &camera->focalPoint, &eye);
|
||||
eye.x = (Math_SinS(y) * magShakeXZ) + camera->at.x;
|
||||
eye.y = camera->at.y + magShakeY;
|
||||
eye.z = (Math_CosS(y) * magShakeXZ) + camera->at.z;
|
||||
func_8016970C(globalCtx, this->camId, &camera->at, &eye);
|
||||
}
|
||||
|
||||
void EnPametfrog_StopCutscene(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
@@ -352,7 +352,7 @@ void EnPametfrog_StopCutscene(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (this->camId != 0) {
|
||||
camera = Play_GetCamera(globalCtx, this->camId);
|
||||
func_8016970C(globalCtx, 0, &camera->focalPoint, &camera->eye);
|
||||
func_8016970C(globalCtx, 0, &camera->at, &camera->eye);
|
||||
this->camId = 0;
|
||||
ActorCutscene_Stop(this->cutscene);
|
||||
func_800B724C(globalCtx, &this->actor, 6);
|
||||
@@ -1176,7 +1176,7 @@ void func_8086CD04(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
|
||||
void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
Vec3f eye;
|
||||
Vec3f focalPoint;
|
||||
Vec3f at;
|
||||
s16 yawDiff;
|
||||
|
||||
SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001B08, 3.0f);
|
||||
@@ -1192,15 +1192,15 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
focalPoint.x = this->actor.world.pos.x;
|
||||
focalPoint.z = this->actor.world.pos.z;
|
||||
focalPoint.y = this->actor.world.pos.y + 45.0f;
|
||||
eye.x = (Math_SinS(this->actor.shape.rot.y) * 90.0f) + focalPoint.x;
|
||||
eye.z = (Math_CosS(this->actor.shape.rot.y) * 90.0f) + focalPoint.z;
|
||||
eye.y = focalPoint.y + 4.0f;
|
||||
at.x = this->actor.world.pos.x;
|
||||
at.z = this->actor.world.pos.z;
|
||||
at.y = this->actor.world.pos.y + 45.0f;
|
||||
eye.x = (Math_SinS(this->actor.shape.rot.y) * 90.0f) + at.x;
|
||||
eye.z = (Math_CosS(this->actor.shape.rot.y) * 90.0f) + at.z;
|
||||
eye.y = at.y + 4.0f;
|
||||
|
||||
// Zooms in on Gekko
|
||||
func_8016970C(globalCtx, this->camId, &focalPoint, &eye);
|
||||
func_8016970C(globalCtx, this->camId, &at, &eye);
|
||||
this->timer = 0;
|
||||
this->actor.hintId = 0x5F;
|
||||
this->actionFunc = EnPametfrog_CallSnapper;
|
||||
@@ -1213,26 +1213,26 @@ void EnPametfrog_CallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) {
|
||||
Vec3f focalPoint;
|
||||
Vec3f at;
|
||||
Vec3f eye;
|
||||
s16 yaw;
|
||||
|
||||
EnPametfrog_PlaceSnapper(this, globalCtx);
|
||||
focalPoint.x = this->actor.child->world.pos.x;
|
||||
focalPoint.z = this->actor.child->world.pos.z;
|
||||
focalPoint.y = this->actor.child->floorHeight + 50.0f;
|
||||
at.x = this->actor.child->world.pos.x;
|
||||
at.z = this->actor.child->world.pos.z;
|
||||
at.y = this->actor.child->floorHeight + 50.0f;
|
||||
if ((s16)(Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y) > 0) {
|
||||
yaw = this->actor.child->shape.rot.y - 0x1000;
|
||||
} else {
|
||||
yaw = this->actor.child->shape.rot.y + 0x1000;
|
||||
}
|
||||
|
||||
eye.x = (Math_SinS(yaw) * 500.0f) + focalPoint.x;
|
||||
eye.y = focalPoint.y + 55.0f;
|
||||
eye.z = (Math_CosS(yaw) * 500.0f) + focalPoint.z;
|
||||
eye.x = (Math_SinS(yaw) * 500.0f) + at.x;
|
||||
eye.y = at.y + 55.0f;
|
||||
eye.z = (Math_CosS(yaw) * 500.0f) + at.z;
|
||||
|
||||
// Zooms in on Snapper spawn point
|
||||
func_8016970C(globalCtx, this->camId, &focalPoint, &eye);
|
||||
func_8016970C(globalCtx, this->camId, &at, &eye);
|
||||
this->quake = Quake_Add(ACTIVE_CAM, 6);
|
||||
Quake_SetSpeed(this->quake, 18000);
|
||||
Quake_SetQuakeValues(this->quake, 2, 0, 0, 0);
|
||||
@@ -1258,7 +1258,7 @@ void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* g
|
||||
Quake_RemoveFromIdx(this->quake);
|
||||
this->quake = Quake_Add(ACTIVE_CAM, 3);
|
||||
Quake_SetSpeed(this->quake, 20000);
|
||||
Quake_SetQuakeValues(this->quake, 0x11, 0, 0, 0);
|
||||
Quake_SetQuakeValues(this->quake, 17, 0, 0, 0);
|
||||
Quake_SetCountdown(this->quake, 12);
|
||||
func_8013ECE0(this->actor.xyzDistToPlayerSq, 255, 20, 150);
|
||||
this->actionFunc = EnPametfrog_TransitionGekkoSnapper;
|
||||
|
||||
@@ -367,7 +367,8 @@ void ObjLightSwitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), (0, (u8)(this->colorB >> 6)), (u8)(this->colorAlpha >> 6));
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), (0, (u8)(this->colorB >> 6)),
|
||||
(u8)(this->colorAlpha >> 6));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, &D_801AEFA0);
|
||||
|
||||
tempPos.x = this->actor.world.pos.x;
|
||||
@@ -402,7 +403,8 @@ void ObjLightSwitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), (0, (u8)(this->colorB >> 6)), (u8)(this->colorAlpha >> 6));
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), (0, (u8)(this->colorB >> 6)),
|
||||
(u8)(this->colorAlpha >> 6));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09, &D_801AEF88);
|
||||
|
||||
tempPos.x = this->actor.world.pos.x;
|
||||
|
||||
Reference in New Issue
Block a user