Skip to content

Commit 67385ef

Browse files
johnwinstonclaude
andcommitted
it_items_ithitodeman: decompile it_802D48B0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ff65702 commit 67385ef

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

src/melee/it/items/ithitodeman.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "ithitodeman.h"
22

3+
#include <math.h>
34
#include <placeholder.h>
45
#include <platform.h>
56

@@ -100,7 +101,38 @@ bool it_802D48A8(Item_GObj* gobj)
100101
return false;
101102
}
102103

103-
/// #it_802D48B0
104+
void it_802D48B0(f32* value, f32 target, f32 max_val, f32 accel,
105+
f32 decel)
106+
{
107+
f32 current = *value;
108+
f32 diff = target - current;
109+
110+
if (ABS(diff) > ABS(accel)) {
111+
if (diff > 0.0F) {
112+
target = current + accel;
113+
} else {
114+
target = current - accel;
115+
}
116+
} else if (ABS(diff) < ABS(decel)) {
117+
if (diff > 0.0F) {
118+
target = current + decel;
119+
} else {
120+
target = current - decel;
121+
}
122+
}
123+
124+
if (target > 0.0F) {
125+
if (target > max_val) {
126+
target = max_val;
127+
}
128+
} else {
129+
if (target < -max_val) {
130+
target = -max_val;
131+
}
132+
}
133+
134+
*value = target;
135+
}
104136

105137
void it_802D4990(Item_GObj* gobj)
106138
{

src/melee/it/items/ithitodeman.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
/* 2D4564 */ bool it_802D4564(Item_GObj* gobj);
1717
/* 2D472C */ void it_802D472C(Item_GObj* gobj);
1818
/* 2D48A8 */ bool it_802D48A8(Item_GObj* gobj);
19-
/* 2D48B0 */ UNK_RET it_802D48B0(UNK_PARAMS);
19+
/* 2D48B0 */ void it_802D48B0(f32* value, f32 target, f32 max_val,
20+
f32 accel, f32 decel);
2021
/* 2D4990 */ void it_802D4990(Item_GObj*);
2122
/* 2D49E8 */ bool itHitodeman_UnkMotion1_Anim(Item_GObj* gobj);
2223
/* 2D4B14 */ void itHitodeman_UnkMotion1_Phys(Item_GObj* gobj);

0 commit comments

Comments
 (0)