Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
656 changes: 217 additions & 439 deletions src/melee/ft/chara/ftCommon/ftCo_0A01.c

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/melee/ft/chara/ftCommon/ftCo_0D95.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include "ft/fighter.h"
#include "ft/ft_0892.h"
#include "ft/inlines.h"
#include "it/inlines.h"
#include "it/items/itsamusgrapple.h"
#include "it/types.h"
#include "lb/lb_00B0.h"
#include "mp/mplib.h"

#include <baselib/random.h>

Expand Down Expand Up @@ -104,7 +105,6 @@ bool fn_800D9930(Fighter_GObj* gobj)
Fighter* fp = GET_FIGHTER(gobj);
ftSs_DatAttrs* attrs;
Item_GObj* item;
s32 frame;
s32 i;
itSamusGrappleAttributes* grappleAttrs;
HSD_GObj* segGobj;
Expand All @@ -114,7 +114,7 @@ bool fn_800D9930(Fighter_GObj* gobj)
Vec3 vel;
f32 grav;
f32 r;
PAD_STACK(4);
PAD_STACK(12);

if (fp->kind == FTKIND_SAMUS) {
attrs = fp->dat_attrs;
Expand All @@ -133,12 +133,12 @@ bool fn_800D9930(Fighter_GObj* gobj)
} else if (grav > (f32) attrs->xAC) {
if (grav <= (f32) attrs->xB8) {
Item* it;
it = GET_ITEM(fp->u.ss.x223C);
it = fp->u.ss.x223C->user_data;
item = fp->u.ss.x223C;
grappleAttrs = it->xC4_article_data->x4_specialAttributes;
if (item != NULL) {
for (i = 0, frame = 0x14; i < 4; i++, frame += 3) {
if (fp->mv.ca.specials.grav == (f32) frame) {
for (i = 0; i < 4; i++) {
if (fp->mv.ca.specials.grav == (f32) (i * 3 + 0x14)) {
segGobj = it->xDD4_itemVar.samusgrapple.x0->gobj;
jobj = (HSD_JObj*) segGobj->hsd_obj;
HSD_JObjSetupMatrix(jobj);
Expand Down
42 changes: 27 additions & 15 deletions src/melee/ft/chara/ftCommon/ftCo_ItemThrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,19 @@ void ftCo_ItemThrow_Anim(Fighter_GObj* gobj)
}
}

static inline float getItemThrowFsm(Fighter* fp)
{
return -fp->cmd_timer / fp->frame_speed_mul;
}

void ftCo_80095EFC(Fighter_GObj* gobj)
{
Fighter* fp = GET_FIGHTER(gobj);
float interpolation;
Vec3 vec0;
Vec3 vec1;
Vec3 vec2;

PAD_STACK(0x4);

if (fp->item_gobj != NULL) {
lb_8000B1CC(it_80272C90(fp->item_gobj), NULL, &vec0);
if (ftCheckThrowB3(fp)) {
Expand All @@ -538,24 +542,32 @@ void ftCo_80095EFC(Fighter_GObj* gobj)
fp->cmd_vars[1] = 0;
}
{
ftCo_ItemThrowAttrs* throw_speed_arr =
(ftCo_ItemThrowAttrs*) Fighter_804D6550;
float cd_xB4 = co_attrs->heavy_throw_velocity_multiplier;
float base_throw_speed =
cd_xB4 *
float fsm = getItemThrowFsm(fp);
ftCo_ItemThrowAttrs* throw_speed_arr;
float velocity_multiplier;
float table_speed;
float base_throw_speed;
float throw_speed;
interpolation = fp->mv.co.itemthrow4.x8.x;
throw_speed_arr = (ftCo_ItemThrowAttrs*) Fighter_804D6550;
velocity_multiplier =
co_attrs->heavy_throw_velocity_multiplier;
table_speed =
throw_speed_arr[fp->motion_id - ftCo_MS_LightThrowF]
.x8;
float throw_speed_arg = throw_scale * base_throw_speed;
float throw_speed = throw_speed_arg;
float fsm = -fp->cmd_timer / fp->frame_speed_mul;
vec2.x =
fsm * (fp->mv.co.itemthrow4.x8.x - vec0.x) + vec0.x;
vec2.y =
base_throw_speed = velocity_multiplier * table_speed;
throw_scale *= base_throw_speed;
throw_speed = throw_scale;
interpolation = fsm * (interpolation - vec0.x) + vec0.x;
vec2.x = interpolation;
interpolation =
fsm * (fp->mv.co.itemthrow4.x8.y - vec0.y) + vec0.y;
vec2.y = interpolation;
vec2.z = 0;
pl_8003E978(fp->player_id, fp->x221F_b4, fp->item_gobj,
vec2.y, base_throw_speed, cd_xB4,
throw_speed_arg, vec0.x, vec0.y, fsm);
interpolation, base_throw_speed,
velocity_multiplier, throw_speed, vec0.x,
vec0.y, fsm);
{
FtMoveId msid = fp->motion_id;
if (msid == (FtMoveId) ftCo_MS_LightThrowDrop) {
Expand Down
114 changes: 54 additions & 60 deletions src/melee/ft/ftafterimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
{
Fighter* fp;
itSword_UnkBytes* params;
f32* distPtr;
u32 n4;
f32 cumDist[3];
AfterimageVtx vtx_buf[151];
f32 d2;
s32 numVerts;
s32 remaining;
s32 numSubdiv;
s32 nextIdx;

PAD_STACK(0x10);

if (arg1 != 2) {
return;
Expand Down Expand Up @@ -116,11 +113,15 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
}

{
s32 nextIdx;
f32 x20F8 = fp->x20F8;
f32 x20FC = fp->x20FC;
s32 ringIdx;
f32 totalDist;
f32* dp;
Vec3 prevPos, delta, crossProd, tempDir;

PAD_STACK(0x14);

{
s32 idx = fp->x2101_bits_0to6;
Expand All @@ -136,7 +137,6 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
dp = &cumDist[1];

{
Vec3 delta, prevPos;
s32 i;
s32 curIdx = ringIdx;

Expand All @@ -161,11 +161,7 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
prevPos = delta;

if (i != 0) {
if (curIdx != 0) {
nextIdx = curIdx - 1;
} else {
nextIdx = 2;
}
nextIdx = curIdx != 0 ? curIdx - 1 : 2;
}
curIdx = nextIdx;
}
Expand All @@ -176,34 +172,42 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
}

{
Vec3 tempDir, crossProd;
f32 scaleDiff = x20FC - x20F8;
s32 remaining;
f32* distPtr;
s32 numVerts;
f32 scaleDiff;
s32 curIdx2;
f32 blendedInner = params->x0 * scaleDiff + x20F8;
f32 blendedOuter = params->x4 * scaleDiff + x20F8;
f32 interpFactor = 1.0f;
f32 innerDiff = x20F8 - blendedInner;
f32 outerDiff = x20FC - blendedOuter;
s32 idx2;
f32 blendedOuter;
f32 blendedInner;
f32 interpFactor;
f32 innerDiff;
f32 outerDiff;
AfterimageVtx* vp;

scaleDiff = x20FC - x20F8;
idx2 = fp->x2101_bits_0to6;
blendedInner = params->x0 * scaleDiff + x20F8;
vp = vtx_buf;
blendedOuter = params->x4 * scaleDiff + x20F8;
numVerts = 0;

{
s32 idx2 = fp->x2101_bits_0to6;
if (idx2 != 0) {
curIdx2 = idx2 - 1;
} else {
curIdx2 = 2;
}
if (idx2 != 0) {
curIdx2 = idx2 - 1;
} else {
curIdx2 = 2;
}

innerDiff = x20F8 - blendedInner;
interpFactor = 1.0f;
remaining = (s8) (u8) fp->x2100 - 1;
outerDiff = x20FC - blendedOuter;
distPtr = &cumDist[0];
vp = &vtx_buf[0];

while (remaining >= 0) {
f32 outerScale, innerScale;
s32 alpha;
struct Fighter_x20B0_t* nextEntry;

struct Fighter_x20B0_t* curEntry = &fp->x20B0[curIdx2];
outerScale = interpFactor * outerDiff + blendedOuter;
Expand All @@ -222,7 +226,10 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
vp->b = params->xC;
vp->a = alpha;

(vp + 1)->x = curEntry->xC.x * outerScale + curEntry->x0.x;
{
f32 x = curEntry->xC.x * outerScale;
(vp + 1)->x = x + curEntry->x0.x;
}
(vp + 1)->y = curEntry->xC.y * outerScale + curEntry->x0.y;
(vp + 1)->z = curEntry->xC.z * outerScale + curEntry->x0.z;
(vp + 1)->r = params->xE;
Expand All @@ -234,7 +241,6 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)

if (remaining != 0) {
s32 nextRingIdx;
struct Fighter_x20B0_t* nextEntry;

if (curIdx2 != 0) {
nextRingIdx = curIdx2 - 1;
Expand Down Expand Up @@ -292,7 +298,7 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)
(f32) alpha));

for (j = 0; j < numSubdiv; j++) {
cumAngle += angle * frac;
cumAngle += frac * angle;
basePosX += stepPosX;
basePosY += stepPosY;
basePosZ += stepPosZ;
Expand Down Expand Up @@ -346,38 +352,26 @@ void ftCo_800C2600(Fighter_GObj* gobj, u32 arg1)

GXPosition3f32(vtx_buf[0].x, vtx_buf[0].y, vtx_buf[0].z);
GXColor4u8(vtx_buf[0].r, vtx_buf[0].g, vtx_buf[0].b, vtx_buf[0].a);
GXPosition3f32(vtx_buf[2].x, vtx_buf[2].y, vtx_buf[2].z);
GXColor4u8(vtx_buf[2].r, vtx_buf[2].g, vtx_buf[2].b, vtx_buf[2].a);

if (numVerts > 1) {
AfterimageVtx* p = &vtx_buf[1];
u32 count = (u32) (numVerts - 1);
n4 = count >> 2;
if (n4 != 0) {
do {
GXPosition3f32(p[0].x, p[0].y, p[0].z);
GXColor4u8(p[0].r, p[0].g, p[0].b, p[0].a);
GXPosition3f32(p[1].x, p[1].y, p[1].z);
GXColor4u8(p[1].r, p[1].g, p[1].b, p[1].a);
GXPosition3f32(p[2].x, p[2].y, p[2].z);
GXColor4u8(p[2].r, p[2].g, p[2].b, p[2].a);
GXPosition3f32(p[3].x, p[3].y, p[3].z);
GXColor4u8(p[3].r, p[3].g, p[3].b, p[3].a);
p += 4;
n4--;
} while (n4 != 0);
count &= 3;
if (count != 0) {
goto remainder;
{
AfterimageVtx* vtx = &vtx_buf[2];

GXPosition3f32(vtx->x, vtx->y, vtx->z);
{
u8 r = vtx->r;
GXColor4u8(r, vtx->g, vtx->b, vtx->a);
}
}

{
s32 i;
AfterimageVtx* vtx = &vtx_buf[1];

for (i = 1; i < numVerts; i++, vtx++) {
GXPosition3f32(vtx->x, vtx->y, vtx->z);
{
u8 r = vtx->r;
GXColor4u8(r, vtx->g, vtx->b, vtx->a);
}
} else {
remainder:
do {
GXPosition3f32(p->x, p->y, p->z);
GXColor4u8(p->r, p->g, p->b, p->a);
p++;
count--;
} while (count != 0);
}
}
}
Expand Down
Loading
Loading