mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'beam-sounds' into 'master'
Finish Beam: play sound when nearby Closes #1082 See merge request KartKrew/Kart!2070
This commit is contained in:
commit
08ef66d52e
1 changed files with 25 additions and 1 deletions
26
src/k_race.c
26
src/k_race.c
|
|
@ -241,12 +241,16 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
const fixed_t xstep = FixedDiv(line->dx, linelength);
|
const fixed_t xstep = FixedDiv(line->dx, linelength);
|
||||||
const fixed_t ystep = FixedDiv(line->dy, linelength);
|
const fixed_t ystep = FixedDiv(line->dy, linelength);
|
||||||
|
|
||||||
|
const boolean passable = (leveltime >= starttime || G_TimeAttackStart());
|
||||||
|
|
||||||
fixed_t linex = line->v1->x;
|
fixed_t linex = line->v1->x;
|
||||||
fixed_t liney = line->v1->y;
|
fixed_t liney = line->v1->y;
|
||||||
angle_t lineangle = line->angle + ANGLE_90;
|
angle_t lineangle = line->angle + ANGLE_90;
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
|
fixed_t dist[4] = {INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX};
|
||||||
|
|
||||||
if (line->flags & ML_NOCLIMB)
|
if (line->flags & ML_NOCLIMB)
|
||||||
{
|
{
|
||||||
// Line is flipped
|
// Line is flipped
|
||||||
|
|
@ -283,7 +287,7 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
y = liney + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINESINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT));
|
y = liney + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINESINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT));
|
||||||
z = FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT));
|
z = FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT));
|
||||||
|
|
||||||
if (leveltime >= starttime || G_TimeAttackStart())
|
if (passable)
|
||||||
{
|
{
|
||||||
spriteframe = 4; // Weakest sprite when passable
|
spriteframe = 4; // Weakest sprite when passable
|
||||||
}
|
}
|
||||||
|
|
@ -316,6 +320,16 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
{
|
{
|
||||||
beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN];
|
beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixed_t n =
|
||||||
|
R_PointToDist2(
|
||||||
|
players[displayplayers[i]].mo->x,
|
||||||
|
players[displayplayers[i]].mo->y,
|
||||||
|
beam->x,
|
||||||
|
beam->y
|
||||||
|
);
|
||||||
|
if (dist[i] > n)
|
||||||
|
dist[i] = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -388,6 +402,16 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
P_SetTarget(&end2->tracer, end1);
|
P_SetTarget(&end2->tracer, end1);
|
||||||
end2->flags2 |= MF2_LINKDRAW;
|
end2->flags2 |= MF2_LINKDRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!passable && leveltime % 40 == 0)
|
||||||
|
{
|
||||||
|
const fixed_t maxdist = 1280 * mapobjectscale;
|
||||||
|
const fixed_t mindist = 320 * mapobjectscale;
|
||||||
|
fixed_t f = min(dist[i], maxdist);
|
||||||
|
f = max(f, mindist);
|
||||||
|
S_StartSoundAtVolume(players[i].mo, sfx_s3k73,
|
||||||
|
FixedMul(FRACUNIT - FixedDiv(f - mindist, maxdist - mindist), 255));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue