diff options
| author | EllipticEllipsis <elliptic.ellipsis@gmail.com> | 2022-07-22 05:17:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-22 05:17:06 +0100 |
| commit | c8c55a15d3acf459615fc54c4b542d7d16555d62 (patch) | |
| tree | 65a0abb709eeed9d053bb3bad8ff7c69793269c2 /src/code | |
| parent | cbeeeb172ab151be24478d2175f4cf7305ceff8c (diff) | |
EnBjt OK and documented (#912)
* OK, data imported
* Fix some typos
* Start docs
* Struct almost finished
* Start object, add state enum
* undefined_syms
* Finish object, name some more stuff
* Name a few states and another function
* PlayState
* Minor tweaks in z_room and z_sub_s
* Complete documentation
* spec
* Review 1
* functions.txt
* Schedule result enum
* Rename schedule results
* Review
* Remove update comments
* Inventory_DeleteItem
* PLAYER_STATE
* Format
* Review
* Update struct name
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_lib.c | 16 | ||||
| -rw-r--r-- | src/code/z_room.c | 2 | ||||
| -rw-r--r-- | src/code/z_sub_s.c | 15 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/code/z_lib.c b/src/code/z_lib.c index aaf4bc7d9..03e6c395c 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -651,15 +651,15 @@ void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId) { Audio_PlaySfxAtPos(pos, sfxId); } -void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, Vec3f* src, Vec3f* dst) { - f32 sp1C; - f32 f0; +void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 rotAngle, Vec3f* src, Vec3f* dst) { + f32 cos; + f32 sin; - sp1C = Math_CosS(a); - f0 = Math_SinS(a); - dst->x = translation->x + (src->x * sp1C + src->z * f0); + cos = Math_CosS(rotAngle); + sin = Math_SinS(rotAngle); + dst->x = translation->x + (src->x * cos + src->z * sin); dst->y = translation->y + src->y; - dst->z = translation->z + (src->z * sp1C - src->x * f0); + dst->z = translation->z + (src->z * cos - src->x * sin); } void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst) { @@ -688,7 +688,7 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed) { start->z = start->z + f2 * diff.z; } else { Math_Vec3f_Copy(start, target); - f0 = 0; + f0 = 0.0f; } return f0; diff --git a/src/code/z_room.c b/src/code/z_room.c index b8646a2d0..3507765a5 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -143,7 +143,7 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.segment = NULL; func_800BA798(play, &play->actorCtx); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (-1 < roomCtx->currRoom.num) { + if (roomCtx->currRoom.num > -1) { Map_InitRoomData(play, roomCtx->currRoom.num); Minimap_SavePlayerRoomInitInfo(play); } diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index e7491a830..afc7f7168 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -830,43 +830,52 @@ s32 func_8013C964(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 it xzRange = actor->xzDistToPlayer + 1.0f; ret = Actor_PickUp(actor, play, itemId, xzRange, yRange); break; + case 2: if ((fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 3: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 4: yRange = fabsf(actor->playerHeightRel) + 1.0f; xzRange = actor->xzDistToPlayer + 1.0f; xzDistToPlayerTemp = actor->xzDistToPlayer; actor->xzDistToPlayer = 0.0f; - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); actor->xzDistToPlayer = xzDistToPlayerTemp; break; + case 5: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isTargeted) { - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 6: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + + default: + break; } + return ret; } |
