mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add magnets to the sides, make client-side, fix length
This commit is contained in:
parent
4e4598d784
commit
2645e4dea8
4 changed files with 86 additions and 19 deletions
|
|
@ -7599,6 +7599,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||||
"S_FINISHBEAM3",
|
"S_FINISHBEAM3",
|
||||||
"S_FINISHBEAM4",
|
"S_FINISHBEAM4",
|
||||||
"S_FINISHBEAM5",
|
"S_FINISHBEAM5",
|
||||||
|
"S_FINISHBEAMEND1",
|
||||||
|
"S_FINISHBEAMEND2",
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
"S_NAMECHECK",
|
"S_NAMECHECK",
|
||||||
|
|
|
||||||
|
|
@ -3589,6 +3589,8 @@ state_t states[NUMSTATES] =
|
||||||
{SPR_FLBM, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM3
|
{SPR_FLBM, FF_FULLBRIGHT|2, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM3
|
||||||
{SPR_FLBM, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM4
|
{SPR_FLBM, FF_FULLBRIGHT|3, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM4
|
||||||
{SPR_FLBM, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM5
|
{SPR_FLBM, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM5
|
||||||
|
{SPR_FLBM, FF_PAPERSPRITE|5, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAMEND1
|
||||||
|
{SPR_FLBM, FF_PAPERSPRITE|6, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAMEND2
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
|
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
|
||||||
|
|
|
||||||
|
|
@ -4285,6 +4285,8 @@ typedef enum state
|
||||||
S_FINISHBEAM3,
|
S_FINISHBEAM3,
|
||||||
S_FINISHBEAM4,
|
S_FINISHBEAM4,
|
||||||
S_FINISHBEAM5,
|
S_FINISHBEAM5,
|
||||||
|
S_FINISHBEAMEND1,
|
||||||
|
S_FINISHBEAMEND2,
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
S_NAMECHECK,
|
S_NAMECHECK,
|
||||||
|
|
|
||||||
99
src/k_kart.c
99
src/k_kart.c
|
|
@ -3149,7 +3149,7 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
fixed_t liney = line->v1->y;
|
fixed_t liney = line->v1->y;
|
||||||
angle_t lineangle = R_PointToAngle2(0, 0, line->dx, line->dy) + ANGLE_90;
|
angle_t lineangle = R_PointToAngle2(0, 0, line->dx, line->dy) + ANGLE_90;
|
||||||
|
|
||||||
fixed_t drawz = players[displayplayers[0]].mo->z;
|
UINT8 i;
|
||||||
|
|
||||||
if (line->flags & ML_NOCLIMB)
|
if (line->flags & ML_NOCLIMB)
|
||||||
{
|
{
|
||||||
|
|
@ -3182,11 +3182,10 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
|
|
||||||
fixed_t x, y, z;
|
fixed_t x, y, z;
|
||||||
UINT8 spriteframe = 0;
|
UINT8 spriteframe = 0;
|
||||||
mobj_t *beam;
|
|
||||||
|
|
||||||
x = linex + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINECOSINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT));
|
x = linex + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINECOSINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT));
|
||||||
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 = drawz + FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT));
|
z = FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT));
|
||||||
|
|
||||||
if (frameaim > ANGLE_180)
|
if (frameaim > ANGLE_180)
|
||||||
{
|
{
|
||||||
|
|
@ -3197,18 +3196,27 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
spriteframe = frameaim / framethreshold;
|
spriteframe = frameaim / framethreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
beam = P_SpawnMobj(x, y, z, MT_THOK);
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
P_SetMobjState(beam, S_FINISHBEAM1 + spriteframe);
|
|
||||||
|
|
||||||
beam->colorized = true;
|
|
||||||
|
|
||||||
if (reverse)
|
|
||||||
{
|
{
|
||||||
beam->color = colorcycle[((leveltime / 4) + (COLORCYCLELEN/2)) % COLORCYCLELEN];
|
if (playeringame[displayplayers[i]] && players[displayplayers[i]].mo && !P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||||
}
|
{
|
||||||
else
|
mobj_t *beam;
|
||||||
{
|
|
||||||
beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN];
|
beam = P_SpawnMobj(x, y, players[displayplayers[i]].mo->z + z, MT_THOK);
|
||||||
|
P_SetMobjState(beam, S_FINISHBEAM1 + spriteframe);
|
||||||
|
|
||||||
|
beam->colorized = true;
|
||||||
|
beam->drawflags = MFD_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]);
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
beam->color = colorcycle[((leveltime / 4) + (COLORCYCLELEN/2)) % COLORCYCLELEN];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += FINISHLINEBEAM_SPACING;
|
offset += FINISHLINEBEAM_SPACING;
|
||||||
|
|
@ -3224,6 +3232,59 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *
|
||||||
aiming += ANGLE_45;
|
aiming += ANGLE_45;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
|
{
|
||||||
|
if (playeringame[displayplayers[i]] && players[displayplayers[i]].mo && !P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||||
|
{
|
||||||
|
UINT8 j;
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
vertex_t *v = line->v1;
|
||||||
|
mobj_t *end1, *end2;
|
||||||
|
angle_t a = R_PointToAngle2(0, 0, line->dx, line->dy);
|
||||||
|
fixed_t sx;
|
||||||
|
fixed_t sy;
|
||||||
|
|
||||||
|
//if (line->flags & ML_NOCLIMB)
|
||||||
|
//{
|
||||||
|
//a += ANGLE_180;
|
||||||
|
//}
|
||||||
|
|
||||||
|
sx = FixedMul(3*mapobjectscale, FINECOSINE(a >> ANGLETOFINESHIFT));
|
||||||
|
sy = FixedMul(3*mapobjectscale, FINESINE(a >> ANGLETOFINESHIFT));
|
||||||
|
|
||||||
|
if (j == 1)
|
||||||
|
{
|
||||||
|
v = line->v2;
|
||||||
|
sx = -sx;
|
||||||
|
sy = -sy;
|
||||||
|
}
|
||||||
|
|
||||||
|
end1 = P_SpawnMobj(
|
||||||
|
v->x + sx,
|
||||||
|
v->y + sy,
|
||||||
|
players[displayplayers[i]].mo->z + FINISHLINEBEAM_SPACING,
|
||||||
|
MT_THOK
|
||||||
|
);
|
||||||
|
|
||||||
|
P_SetMobjState(end1, S_FINISHBEAMEND1);
|
||||||
|
end1->drawflags = MFD_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]);
|
||||||
|
end1->angle = lineangle;
|
||||||
|
|
||||||
|
end2 = P_SpawnMobj(
|
||||||
|
v->x + (8*sx),
|
||||||
|
v->y + (8*sy),
|
||||||
|
players[displayplayers[i]].mo->z + FINISHLINEBEAM_SPACING,
|
||||||
|
MT_THOK
|
||||||
|
);
|
||||||
|
|
||||||
|
P_SetMobjState(end2, S_FINISHBEAMEND2);
|
||||||
|
end2->drawflags = MFD_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]);
|
||||||
|
end2->angle = lineangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_RunFinishLineBeam(void)
|
void K_RunFinishLineBeam(void)
|
||||||
|
|
@ -3238,10 +3299,10 @@ void K_RunFinishLineBeam(void)
|
||||||
// I wanted to! But I have a headache from trying to code it for like, 3 hours!
|
// I wanted to! But I have a headache from trying to code it for like, 3 hours!
|
||||||
// so I'm not!
|
// so I'm not!
|
||||||
|
|
||||||
bounds[0] = INT32_MAX; // min x
|
bounds[0] = INT64_MAX; // min x
|
||||||
bounds[1] = INT32_MIN; // max x
|
bounds[1] = INT64_MIN; // max x
|
||||||
bounds[2] = INT32_MAX; // min y
|
bounds[2] = INT64_MAX; // min y
|
||||||
bounds[3] = INT32_MIN; // max y
|
bounds[3] = INT64_MIN; // max y
|
||||||
|
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -3264,7 +3325,7 @@ void K_RunFinishLineBeam(void)
|
||||||
|
|
||||||
if (valid == true)
|
if (valid == true)
|
||||||
{
|
{
|
||||||
fixed_t span = P_AproxDistance(bounds[1] - bounds[0], bounds[3] - bounds[2]);
|
fixed_t span = P_AproxDistance(bounds[1] - bounds[0], bounds[3] - bounds[2]) / 2;
|
||||||
|
|
||||||
fixed_t cx = (bounds[0] + bounds[1]) / 2;
|
fixed_t cx = (bounds[0] + bounds[1]) / 2;
|
||||||
fixed_t cy = (bounds[2] + bounds[3]) / 2;
|
fixed_t cy = (bounds[2] + bounds[3]) / 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue