summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2021-07-19 16:26:47 -0700
committerGitHub <noreply@github.com>2021-07-19 19:26:47 -0400
commit594a3ceaffa055dd015dd878dbe6bcf124567f9d (patch)
treed5aa405caf2354d5653c6b8ba5504bf8a05ff258 /src/code
parentb5c931e432c079f02e7373bf4a8e5130d2df981b (diff)
Ovl_En_Fsn Ok and Documented (#204)
* First decomp pass: Matched everything w/ data * Minor cleanup of func_80AE2F78 * Documented * Format * Some cleanup and PR suggestions * Format * Add the word player to a few functions to specify it is the player trying to buy * Add controller macros * Move common shopkeeper defines * name unk274 and add note to unk27A * Remove macros and just use flag defines * Convert Controller Macros to take globalCtx * Fix merge conflicts
Diffstat (limited to 'src/code')
-rw-r--r--src/code/code_0x800E8EA0.c18
-rw-r--r--src/code/code_0x8012EC80.c2
2 files changed, 11 insertions, 9 deletions
diff --git a/src/code/code_0x800E8EA0.c b/src/code/code_0x800E8EA0.c
index 145701240..d140bde7c 100644
--- a/src/code/code_0x800E8EA0.c
+++ b/src/code/code_0x800E8EA0.c
@@ -37,19 +37,19 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos, param_2) - actor->world.rot.y;
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);
+ param_3->x = CLAMP(param_3->x, -6000, 6000);
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);
+ param_3->y = CLAMP(param_3->y, -8000, 8000);
if (yawDiffFromTarget != 0) {
- if ((param_3->y < 0 ? -param_3->y : param_3->y) < 8000) {
+ if (ABS_ALT(param_3->y) < 8000) {
return 0;
}
}
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);
+ param_4->y = CLAMP(param_4->y, -12000, 12000);
return 1;
}
@@ -58,14 +58,15 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s*
Player* player = PLAYER;
s16 sVar3;
Vec3f local_14;
+ s16 sVar3A;
actor->focus.pos = actor->world.pos;
actor->focus.pos.y += param_5;
if (((globalCtx->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
- // TODO is this shifting because of a missing cast?
- if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
+ sVar3A = ABS_ALT(sVar3);
+ if (sVar3A >= 0x4300) {
func_800E8F08(param_3, param_4);
return 0;
}
@@ -86,13 +87,14 @@ s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s*
Player* player = PLAYER;
s16 sVar3;
Vec3f local_14;
+ s16 sVar3A;
actor->focus.pos = param_5;
if (((globalCtx->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
- // TODO is this shifting because of a missing cast?
- if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
+ sVar3A = ABS_ALT(sVar3);
+ if (sVar3A >= 0x4300) {
func_800E8F08(param_3, param_4);
return 0;
}
diff --git a/src/code/code_0x8012EC80.c b/src/code/code_0x8012EC80.c
index 2be7a0db1..092b7214a 100644
--- a/src/code/code_0x8012EC80.c
+++ b/src/code/code_0x8012EC80.c
@@ -61,7 +61,7 @@ u8 gItemSlots[] = {
0x1C, 0x2B, 0x21, 0x2A, 0x2D, 0x1B, 0x1F, 0x1A, 0x22, 0x2E, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
};
-u16 gItemPrices[] = {
+s16 gItemPrices[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 20, 0, 20,
5, 20, 20, 50, 50, 200, 20, 20, 20, 200, 5, 0, 200, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};