From ce2e5e71c8b71d45ec3ad1cafe34b00d9a50b8a6 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 24 Oct 2022 21:58:33 +0200 Subject: Documentation pass on `DoorShutter` (#1352) * Documentation pass on `DoorShutter` * lockTimer -> unlockTimer * Add `DOORSHUTTER_STYLE_FROM_SCENE` * `DoorShutter_SetupType` -> `DoorShutter_WaitForObject` * perpendicularly -> perpendicular * `DoorShutter_CheckShouldDraw` -> `DoorShutter_ShouldDraw` * Improve comment on `DoorShutter_GetPlayerSide` * `jabuDoorClosed`/`barsClosed` +`Amount` * attempt to improve a comment * fix shameful left-aligned numbers * unname closing/opening * action funcs names * run formatter * enums improvements Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- src/code/z_actor.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/code') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a6c607243..4246a0b71 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -931,20 +931,24 @@ f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint) { return Math_Vec3f_DistXZ(&actor->world.pos, refPoint); } -void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) { - f32 cosRot2Y; - f32 sinRot2Y; +/** + * Convert `pos` to be relative to the actor's position and yaw, store into `dest`. + * Actor_WorldToActorCoords + */ +void func_8002DBD0(Actor* actor, Vec3f* dest, Vec3f* pos) { + f32 cosY; + f32 sinY; f32 deltaX; f32 deltaZ; - cosRot2Y = Math_CosS(actor->shape.rot.y); - sinRot2Y = Math_SinS(actor->shape.rot.y); - deltaX = arg2->x - actor->world.pos.x; - deltaZ = arg2->z - actor->world.pos.z; + cosY = Math_CosS(actor->shape.rot.y); + sinY = Math_SinS(actor->shape.rot.y); + deltaX = pos->x - actor->world.pos.x; + deltaZ = pos->z - actor->world.pos.z; - result->x = (deltaX * cosRot2Y) - (deltaZ * sinRot2Y); - result->z = (deltaX * sinRot2Y) + (deltaZ * cosRot2Y); - result->y = arg2->y - actor->world.pos.y; + dest->x = (deltaX * cosY) - (deltaZ * sinY); + dest->z = (deltaX * sinY) + (deltaZ * cosY); + dest->y = pos->y - actor->world.pos.y; } f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) { -- cgit v1.2.3