Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void func_808C12A4(ArmsHook* this, GlobalContext* globalCtx) {
- ActorPlayer* player = PLAYER;
- Actor* touchedActor;
- Actor* grabbed;
- Vec3f bodyDistDiffVec;
- Vec3f newPos;
- f32 bodyDistDiff;
- f32 phi_f16;
- DynaPolyActor* dynaPolyActor;
- f32 sp94;
- f32 sp90;
- s32 pad;
- BgPolygon* poly;
- u32 dynaPolyID;
- Vec3f sp78;
- Vec3f prevFrameDiff;
- Vec3f sp60;
- f32 sp5C;
- f32 sp58;
- f32 velocity;
- if ((this->actor.parent == NULL) || (!func_801240C8(player))) {
- func_808C1198(this);
- Actor_MarkForDeath(&this->actor);
- return;
- }
- func_800B8F98(&player->base, 0x100B);
- func_808C11C0(this);
- if (this->timer != 0) {
- if ((this->collider.base.flagsAT & 2) && (this->collider.body.unk20->unk14 != 4)) {
- touchedActor = this->collider.base.collisionAT;
- if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
- if (this->collider.body.unk20->unk16 & 4) {
- func_808C125C(this, touchedActor);
- if ((touchedActor->flags & 0x400) == 0x400) {
- func_808C1154(this);
- }
- }
- }
- this->timer = 0;
- func_8019F1C0(&this->actor.projectedPos, 0x1814);
- return;
- }
- }
- if (DECR(this->timer) == 0) {
- grabbed = this->grabbed;
- if (grabbed != NULL) {
- if ((grabbed->update == NULL) || (grabbed->flags & 0x2000) != 0x2000) {
- grabbed = NULL;
- this->grabbed = NULL;
- } else {
- if (this->actor.child != NULL) {
- sp94 = Actor_DistanceBetweenActors(this, grabbed);
- sp90 =
- sqrtf(SQ(this->unk_1FC.x) + SQ(this->unk_1FC.y) + SQ(this->unk_1FC.z));
- Math_Vec3f_Diff(&grabbed->currPosRot.pos, &this->unk_1FC, &this->actor.currPosRot.pos);
- if (50.0f < (sp94 - sp90)) {
- func_808C1198(this);
- grabbed = NULL;
- }
- }
- }
- }
- bodyDistDiff = Math_Vec3f_DistXYZAndStoreDiff(&player->unk368, &this->actor.currPosRot.pos, &bodyDistDiffVec);
- if (bodyDistDiff < 30.0f) {
- velocity = 0.0f;
- phi_f16 = 0.0f;
- } else {
- if (this->actor.child != NULL) {
- velocity = 30.0f;
- } else {
- if (grabbed != NULL) {
- velocity = 50.0f;
- } else {
- velocity = 200.0f;
- }
- }
- phi_f16 = bodyDistDiff - velocity;
- if (bodyDistDiff <= velocity) {
- phi_f16 = 0.0f;
- }
- velocity = phi_f16 / bodyDistDiff;
- }
- newPos.x = bodyDistDiffVec.x * velocity;
- newPos.y = bodyDistDiffVec.y * velocity;
- newPos.z = bodyDistDiffVec.z * velocity;
- if (this->actor.child == NULL) {
- Math_Vec3f_Sum(&player->unk368, &newPos, &this->actor.currPosRot.pos);
- if (grabbed != NULL) {
- Math_Vec3f_Sum(&this->actor.currPosRot.pos, &this->unk_1FC, &grabbed->currPosRot.pos);
- }
- } else {
- Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->base.velocity);
- player->base.currPosRot.rot.x =
- atans_flip(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
- }
- if (phi_f16 < 50.0f) {
- func_808C1198(this);
- if (phi_f16 == 0.0f) {
- func_808C1030(this, func_808C10F8);
- if (func_808C1168(this, player)) {
- Math_Vec3f_Diff(&this->actor.currPosRot.pos, &player->base.currPosRot.pos, &player->base.velocity);
- player->base.velocity.y -= 20.0f;
- return;
- }
- }
- }
- } else {
- Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
- Math_Vec3f_Diff(&this->actor.currPosRot.pos, &this->actor.lastPos, &prevFrameDiff);
- Math_Vec3f_Sum(&this->unk_1E0, &prevFrameDiff, &this->unk_1E0);
- this->actor.shape.rot.x = atans_flip(this->actor.speedXZ, -this->actor.velocity.y);
- sp60.x = this->unk_1EC.x - (this->unk_1E0.x - this->unk_1EC.x);
- sp60.y = this->unk_1EC.y - (this->unk_1E0.y - this->unk_1EC.y);
- sp60.z = this->unk_1EC.z - (this->unk_1E0.z - this->unk_1EC.z);
- if (func_800C55C4(&globalCtx->colCtx, &sp60, &this->unk_1E0, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID) != 0) {
- if (func_800B90AC(globalCtx, &this->actor, poly, dynaPolyID, &sp78) || func_800C576C(&globalCtx->colCtx, &sp60, &this->unk_1EC, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID)) {
- sp5C = poly->normal.x * (1 / SHT_MAX);
- sp58 = poly->normal.z * (1 / SHT_MAX);
- Math_Vec3f_Copy(&this->actor.currPosRot.pos, &sp78);
- this->actor.currPosRot.pos.x += 10.0f * sp5C;
- this->actor.currPosRot.pos.z += 10.0f * sp58;
- this->timer = 1;
- if (func_800C9CEC(&globalCtx->colCtx, poly, dynaPolyID) != 0) {
- if (dynaPolyID != 0x32) {
- dynaPolyActor = BgCheck_GetActorOfMesh(&globalCtx->colCtx, dynaPolyID);
- if (dynaPolyActor != NULL) {
- func_808C125C(this, &dynaPolyActor->actor);
- }
- }
- func_808C1154(this);
- func_8019F1C0(&this->actor.projectedPos, 0x1829);
- return;
- }
- func_800E8668(globalCtx, &this->actor.currPosRot.pos);
- func_8019F1C0(&this->actor.projectedPos, 0x1813);
- return;
- }
- }
- if ((globalCtx->state.input[0].pressEdge.buttons & 0xC01F)) {
- this->timer = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement