Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Mar 30, 2024
1 parent 62d0a6e commit 59c2f5a
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 90 deletions.
18 changes: 8 additions & 10 deletions decompile/General/Particle/Particle_SetColors.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,25 @@ u_int DECOMP_Particle_SetColors(u_int flagColors, u_int flagAlpha, struct Partic
u_int color = 0;

if (flagColors & COLOR_FLAG_R)
{
//so we kinda store rgb value to a temp var
//and reuse it in case no color flag is set.
//this way if only red flag is set, it becomes grayscale? weird.

{
//process red
int temp = DECOMP_Particle_BitwiseClampByte(&p->axis[7].startVal);

color |= temp;
color = temp;

//process green
if (flagColors & COLOR_FLAG_G)
temp = DECOMP_Particle_BitwiseClampByte(&p->axis[8].startVal);
color = DECOMP_Particle_BitwiseClampByte(&p->axis[8].startVal);

color |= temp << 8;
// Must do it like this,
// dont do temp=blue color|=temp<<8,
// because that makes grass turn blue
color = temp | color<<8;

//process blue
if (flagColors & COLOR_FLAG_B)
temp = DECOMP_Particle_BitwiseClampByte(&p->axis[9].startVal);

color |= temp << 16;
color = color | temp << 16;
}
else
{
Expand Down
152 changes: 75 additions & 77 deletions decompile/General/Vehicle/VehFrameProc_Driving.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,14 @@ void DECOMP_VehFrameProc_Driving(struct Thread *t, struct Driver *d)
interp = VehCalc_InterpBySpeed(inst->animFrame, animSpeed, startFrame);
inst->animFrame = (short)interp;

// if not quite at the start
if ((unsigned int)(currAnimIndex - 2) > 1) return;

currFrame = *(char *)&inst->animFrame;
// kart animation frame
d->matrixIndex = currAnimIndex;
currFrame = *(char *)&inst->animFrame;
d->matrixIndex = currFrame;

// kart animation Index
if (currAnimIndex == 0)
if (currFrame == 0)
d->matrixArray = 0;

return;
Expand All @@ -105,90 +104,89 @@ void DECOMP_VehFrameProc_Driving(struct Thread *t, struct Driver *d)
d->matrixArray = 0;
d->matrixIndex = 0;
}
else
{ // just steering
if (animType == 0)

// just steering
if (animType == 0)
{
// half number of frames
iVar9 = numFrames >> 1;
// if you don't have a TNT over you
if (d->instTntRecv == 0)
{
// half number of frames
iVar9 = numFrames >> 1;
// if you don't have a TNT over you
if (d->instTntRecv == 0)
{
short burnTimer = d->burnTimer;
// not currently burned or just start burning
if ((burnTimer == 0) || (479 < burnTimer))
{
// negative turning stat while braking
iVar9 = -0x40;
// if you're not in accel prevention
if ((d->actionsFlagSet & 8) == 0)
{
iVar7 = d->simpTurnState;

// negative character's turn stat
animType = d->const_TurnRate;
iVar9 = -animType;
}
else
{
// positive turning stat while braking
animType = 0x40;
iVar7 = d->ampTurnState;
}
// seems like iVar9 gets set to 0 if you're turning, or to last frame index if you're not
iVar9 = DECOMP_VehCalc_MapToRange(-(iVar7), iVar9, animType, 0, (numFrames - 1));
short burnTimer = d->burnTimer;
// not currently burned or just start burning
if ((burnTimer == 0) || (479 < burnTimer))
{
// negative turning stat while braking
iVar9 = -0x40;
// if you're not in accel prevention
if ((d->actionsFlagSet & 8) == 0)
{
iVar7 = d->simpTurnState;

// negative character's turn stat
animType = d->const_TurnRate;
iVar9 = -animType;
}
else
{
iVar9 = (((burnTimer >> 5) % 5) >> 2) - 8 + iVar9;

inst->animFrame = (short)iVar9;
struct Particle *p = Particle_Init(0, gGT->iconGroup[1], &data.emSet_BurnSmoke[0]);
if (p != NULL)
{
p->unk18 = d->instSelf->unk50;
p->driverInst = d->instSelf;
p->unk19 = d->driverID;
}
// positive turning stat while braking
animType = 0x40;
iVar7 = d->ampTurnState;
}
// seems like iVar9 gets set to 0 if you're turning, or to last frame index if you're not
iVar9 = DECOMP_VehCalc_MapToRange(-(iVar7), iVar9, animType, 0, (numFrames - 1));
}
}
else
{
// jump animation
if (animType == 3)
else
{
interp = VehCalc_InterpBySpeed(inst->animFrame, 1, numFrames - 1);
inst->animFrame = interp;
iVar9 = (((burnTimer >> 5) % 5) >> 2) - 8 + iVar9;

inst->animFrame = (short)iVar9;
struct Particle *p = Particle_Init(0, gGT->iconGroup[1], &data.emSet_BurnSmoke[0]);
if (p != NULL)
{
p->unk18 = d->instSelf->unk50;
p->driverInst = d->instSelf;
p->unk19 = d->driverID;
}
}
}
}
else
{
// jump animation
if (animType == 3)
{
interp = VehCalc_InterpBySpeed(inst->animFrame, 1, numFrames - 1);
inst->animFrame = interp;

if (d->kartState == KS_MASK_GRABBED) return;
if (d->kartState == KS_MASK_GRABBED) return;

char charID = data.characterIDs[d->driverID];
char charID = data.characterIDs[d->driverID];

switch (charID)
{
// if this is Penta
case 13:
charID = 10; // Use Coco's
break;
// if this is Fake Crash or Oxide
case 14:
case 15:
charID = 7; // Use Crash's
break;
default:
charID += 7;
}
// set AnimType based on charID
d->matrixArray = charID;
// set animation frame
d->matrixIndex = *(char *)&inst->animFrame;
return;
switch (charID)
{
// if this is Penta
case 13:
charID = 10; // Use Coco's
break;
// if this is Fake Crash or Oxide
case 14:
case 15:
charID = 7; // Use Crash's
break;
default:
charID += 7;
}
// last frame
iVar9 = numFrames - 1;
// set AnimType based on charID
d->matrixArray = charID;
// set animation frame
d->matrixIndex = *(char *)&inst->animFrame;
return;
}
interp = VehCalc_InterpBySpeed(inst->animFrame, 1, iVar9);
inst->animFrame = interp;
// last frame
iVar9 = numFrames - 1;
}
interp = VehCalc_InterpBySpeed(inst->animFrame, 1, iVar9);
inst->animFrame = interp;
}
6 changes: 3 additions & 3 deletions ghidra/Particles.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,15 @@ uint FUN_8003f4c4(uint param_1,uint param_2,int param_3)
}
else
{
// Particle_BitwiseClampByte
// Particle_BitwiseClampByte (red)
uVar1 = FUN_8003f48c(param_3 + 0x5c);

// red
uVar2 = uVar1;

if ((param_1 & 0x100) != 0)
{
// Particle_BitwiseClampByte
// Particle_BitwiseClampByte (green)
uVar2 = FUN_8003f48c(param_3 + 0x64); // 0x64 = 100
}

Expand All @@ -496,7 +496,7 @@ uint FUN_8003f4c4(uint param_1,uint param_2,int param_3)

if ((param_1 & 0x200) != 0)
{
// Particle_BitwiseClampByte
// Particle_BitwiseClampByte (blue)
uVar1 = FUN_8003f48c(param_3 + 0x6c);
}

Expand Down

0 comments on commit 59c2f5a

Please sign in to comment.