From 4e4598d784e1c0eb1df6b064d79bdc8a4acbed38 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 30 Jul 2020 06:25:34 -0400 Subject: [PATCH 1/7] Fault line is here --- src/dehacked.c | 7 +++ src/info.c | 9 ++- src/info.h | 14 ++++- src/k_kart.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++ src/k_kart.h | 1 + src/p_tick.c | 6 ++ 6 files changed, 197 insertions(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 3474951d1..8eb16193f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7593,6 +7593,13 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_WATERTRAILUNDERLAY7", "S_WATERTRAILUNDERLAY8", + // Finish line beam + "S_FINISHBEAM1", + "S_FINISHBEAM2", + "S_FINISHBEAM3", + "S_FINISHBEAM4", + "S_FINISHBEAM5", + #ifdef SEENAMES "S_NAMECHECK", #endif diff --git a/src/info.c b/src/info.c index e67a7be69..827283b88 100644 --- a/src/info.c +++ b/src/info.c @@ -72,7 +72,7 @@ char sprnames[NUMSPRITES + 1][5] = "BFRT","OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN", "FWRK","MXCL","RGSP","DRAF","GRES","OTFG","DBOS","EGOO","WTRL","XMS4", - "XMS5","FBUB","GCHA","CHEZ","VIEW","DBCL","DBNC","DBST", + "XMS5","FBUB","GCHA","CHEZ","DBCL","DBNC","DBST","FLBM","VIEW", }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -3583,6 +3583,13 @@ state_t states[NUMSTATES] = {SPR_WTRL, FF_TRANS50|FF_PAPERSPRITE|14, 2, {NULL}, 0, 0, S_NULL}, // S_WATERTRAILUNDERLAY7 {SPR_WTRL, FF_TRANS50|FF_PAPERSPRITE|15, 2, {NULL}, 0, 0, S_NULL}, // S_WATERTRAILUNDERLAY8 + // Finish line beam + {SPR_FLBM, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM1 + {SPR_FLBM, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM2 + {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|4, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAM5 + #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif diff --git a/src/info.h b/src/info.h index e34e7bd53..8a63249f1 100644 --- a/src/info.h +++ b/src/info.h @@ -808,13 +808,15 @@ typedef enum sprite SPR_GCHA, // follower: generic chao SPR_CHEZ, // follower: cheese - // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later - SPR_VIEW, - SPR_DBCL, // Drift boost clip SPR_DBNC, // Drift boost clip's sparks SPR_DBST, // Drift boost plume + SPR_FLBM, // Finish line beam + + // First person view sprites; this is a sprite so that it can be replaced by a specialized MD2 draw later + SPR_VIEW, + SPR_FIRSTFREESLOT, SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, NUMSPRITES @@ -4278,6 +4280,12 @@ typedef enum state S_WATERTRAILUNDERLAY7, S_WATERTRAILUNDERLAY8, + S_FINISHBEAM1, + S_FINISHBEAM2, + S_FINISHBEAM3, + S_FINISHBEAM4, + S_FINISHBEAM5, + #ifdef SEENAMES S_NAMECHECK, #endif diff --git a/src/k_kart.c b/src/k_kart.c index 0af1ec658..915c243b1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3137,6 +3137,170 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I return NULL; } +// Spawns the finish line fault-indicator effect +#define FINISHLINEBEAM_SPACING (48*mapobjectscale) +static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t *line, boolean reverse) +{ + const fixed_t linelength = P_AproxDistance(line->dx, line->dy); + const fixed_t xstep = FixedDiv(line->dx, linelength); + const fixed_t ystep = FixedDiv(line->dy, linelength); + + fixed_t linex = line->v1->x; + fixed_t liney = line->v1->y; + angle_t lineangle = R_PointToAngle2(0, 0, line->dx, line->dy) + ANGLE_90; + + fixed_t drawz = players[displayplayers[0]].mo->z; + + if (line->flags & ML_NOCLIMB) + { + // Line is flipped + lineangle += ANGLE_180; + } + + linex += FixedMul(offset, xstep); + liney += FixedMul(offset, ystep); + + while (offset < linelength) + { +#define COLORCYCLELEN 10 + const UINT8 colorcycle[COLORCYCLELEN] = { + SKINCOLOR_PERIWINKLE, + SKINCOLOR_SLATE, + SKINCOLOR_BLOSSOM, + SKINCOLOR_RASPBERRY, + SKINCOLOR_ORANGE, + SKINCOLOR_YELLOW, + SKINCOLOR_LIME, + SKINCOLOR_TURTLE, + SKINCOLOR_ROBIN, + SKINCOLOR_JAWZ + }; + + const UINT8 numframes = 5; + const angle_t framethreshold = ANGLE_180 / (numframes-1); + const angle_t frameaim = aiming + (framethreshold / 2); + + fixed_t x, y, z; + UINT8 spriteframe = 0; + mobj_t *beam; + + x = linex + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINECOSINE(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)); + + if (frameaim > ANGLE_180) + { + spriteframe = (ANGLE_MAX - frameaim) / framethreshold; + } + else + { + spriteframe = frameaim / framethreshold; + } + + beam = P_SpawnMobj(x, y, z, MT_THOK); + P_SetMobjState(beam, S_FINISHBEAM1 + spriteframe); + + beam->colorized = true; + + if (reverse) + { + beam->color = colorcycle[((leveltime / 4) + (COLORCYCLELEN/2)) % COLORCYCLELEN]; + } + else + { + beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN]; + } + + offset += FINISHLINEBEAM_SPACING; + linex += FixedMul(FINISHLINEBEAM_SPACING, xstep); + liney += FixedMul(FINISHLINEBEAM_SPACING, ystep); + + if (reverse) + { + aiming -= ANGLE_45; + } + else + { + aiming += ANGLE_45; + } + } +} + +void K_RunFinishLineBeam(void) +{ + INT64 bounds[4]; + angle_t angle = 0; + UINT32 flags = 0; + boolean valid = false; + UINT32 i; + + // this does NOT support finish lines that curve. + // I wanted to! But I have a headache from trying to code it for like, 3 hours! + // so I'm not! + + bounds[0] = INT32_MAX; // min x + bounds[1] = INT32_MIN; // max x + bounds[2] = INT32_MAX; // min y + bounds[3] = INT32_MIN; // max y + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 2001) + { + bounds[0] = min(bounds[0], min(lines[i].v1->x, lines[i].v2->x)); // min x + bounds[1] = max(bounds[1], max(lines[i].v1->x, lines[i].v2->x)); // max x + bounds[2] = min(bounds[2], min(lines[i].v1->y, lines[i].v2->y)); // min y + bounds[3] = max(bounds[3], max(lines[i].v1->y, lines[i].v2->y)); // max y + + if (valid == false) + { + angle = R_PointToAngle2(0, 0, lines[i].dx, lines[i].dy); + flags = lines[i].flags; + } + + valid = true; + } + } + + if (valid == true) + { + fixed_t span = P_AproxDistance(bounds[1] - bounds[0], bounds[3] - bounds[2]); + + fixed_t cx = (bounds[0] + bounds[1]) / 2; + fixed_t cy = (bounds[2] + bounds[3]) / 2; + + vertex_t v1, v2; // fake vertexes + line_t junk; // fake linedef + + const angle_t angoffset = ANGLE_45; + const angle_t angadd = ANGLE_11hh; + const fixed_t speed = 6 * mapobjectscale; + + fixed_t offseta = (leveltime * speed) % FINISHLINEBEAM_SPACING; + angle_t aiminga = (angoffset * -((leveltime * speed) / FINISHLINEBEAM_SPACING)) + (angadd * leveltime); + + fixed_t offsetb = FINISHLINEBEAM_SPACING - offseta; + angle_t aimingb = (angoffset * -((leveltime * speed) / FINISHLINEBEAM_SPACING)) - (angadd * leveltime); + + v1.x = cx - FixedMul(span, FINECOSINE(angle >> ANGLETOFINESHIFT)); + v1.y = cy - FixedMul(span, FINESINE(angle >> ANGLETOFINESHIFT)); + + v2.x = cx + FixedMul(span, FINECOSINE(angle >> ANGLETOFINESHIFT)); + v2.y = cy + FixedMul(span, FINESINE(angle >> ANGLETOFINESHIFT)); + + junk.v1 = &v1; + junk.v2 = &v2; + junk.dx = v2.x - v1.x; + junk.dy = v2.y - v1.y; + junk.flags = flags; + + K_DrawFinishLineBeamForLine(offseta, aiminga, &junk, false); + K_DrawFinishLineBeamForLine(offsetb, aimingb, &junk, true); + } +} + +#undef FINISHLINEBEAM_SPACING + UINT8 K_DriftSparkColor(player_t *player, INT32 charge) { INT32 ds = K_GetKartDriftSparkValue(player); diff --git a/src/k_kart.h b/src/k_kart.h index d44be14f4..3ac152be8 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -44,6 +44,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor); void K_StealBumper(player_t *player, player_t *victim, boolean force); void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source); void K_SpawnMineExplosion(mobj_t *source, UINT8 color); +void K_RunFinishLineBeam(void); UINT8 K_DriftSparkColor(player_t *player, INT32 charge); void K_SpawnBoostTrail(player_t *player); void K_SpawnSparkleTrail(mobj_t *mo); diff --git a/src/p_tick.c b/src/p_tick.c index d57a6dc43..2a8398370 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -656,6 +656,9 @@ void P_Ticker(boolean run) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); + if (G_RaceGametype()) + K_RunFinishLineBeam(); + if (G_BattleGametype() && battleovertime.enabled) K_RunBattleOvertime(); @@ -831,6 +834,9 @@ void P_PreTicker(INT32 frames) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); + if (G_RaceGametype()) + K_RunFinishLineBeam(); + if (G_BattleGametype() && battleovertime.enabled) K_RunBattleOvertime(); From 2645e4dea81ff083255fa09e7a5f4b53326ef3e3 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 30 Jul 2020 07:33:01 -0400 Subject: [PATCH 2/7] Add magnets to the sides, make client-side, fix length --- src/dehacked.c | 2 + src/info.c | 2 + src/info.h | 2 + src/k_kart.c | 99 ++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 86 insertions(+), 19 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8eb16193f..7307b3558 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7599,6 +7599,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FINISHBEAM3", "S_FINISHBEAM4", "S_FINISHBEAM5", + "S_FINISHBEAMEND1", + "S_FINISHBEAMEND2", #ifdef SEENAMES "S_NAMECHECK", diff --git a/src/info.c b/src/info.c index 827283b88..c167d9fa2 100644 --- a/src/info.c +++ b/src/info.c @@ -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|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_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 {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK diff --git a/src/info.h b/src/info.h index 8a63249f1..36adbe06d 100644 --- a/src/info.h +++ b/src/info.h @@ -4285,6 +4285,8 @@ typedef enum state S_FINISHBEAM3, S_FINISHBEAM4, S_FINISHBEAM5, + S_FINISHBEAMEND1, + S_FINISHBEAMEND2, #ifdef SEENAMES S_NAMECHECK, diff --git a/src/k_kart.c b/src/k_kart.c index 915c243b1..d491dd0ef 100644 --- a/src/k_kart.c +++ b/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; 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) { @@ -3182,11 +3182,10 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t * fixed_t x, y, z; UINT8 spriteframe = 0; - mobj_t *beam; x = linex + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINECOSINE(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) { @@ -3197,18 +3196,27 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t * spriteframe = frameaim / framethreshold; } - beam = P_SpawnMobj(x, y, z, MT_THOK); - P_SetMobjState(beam, S_FINISHBEAM1 + spriteframe); - - beam->colorized = true; - - if (reverse) + for (i = 0; i <= r_splitscreen; i++) { - beam->color = colorcycle[((leveltime / 4) + (COLORCYCLELEN/2)) % COLORCYCLELEN]; - } - else - { - beam->color = colorcycle[(leveltime / 4) % COLORCYCLELEN]; + if (playeringame[displayplayers[i]] && players[displayplayers[i]].mo && !P_MobjWasRemoved(players[displayplayers[i]].mo)) + { + mobj_t *beam; + + 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; @@ -3224,6 +3232,59 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t * 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) @@ -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! // so I'm not! - bounds[0] = INT32_MAX; // min x - bounds[1] = INT32_MIN; // max x - bounds[2] = INT32_MAX; // min y - bounds[3] = INT32_MIN; // max y + bounds[0] = INT64_MAX; // min x + bounds[1] = INT64_MIN; // max x + bounds[2] = INT64_MAX; // min y + bounds[3] = INT64_MIN; // max y for (i = 0; i < numlines; i++) { @@ -3264,7 +3325,7 @@ void K_RunFinishLineBeam(void) 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 cy = (bounds[2] + bounds[3]) / 2; From d8563f547e74d8fe7e74204f9c92963e127b0c2c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 30 Jul 2020 07:39:23 -0400 Subject: [PATCH 3/7] Keep it around when rainbow start is available, just make the sprite weaker --- src/k_kart.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index d491dd0ef..27d07c742 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3187,7 +3187,11 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t * y = liney + FixedMul(FixedMul(FINISHLINEBEAM_SPACING, FINESINE(lineangle >> ANGLETOFINESHIFT)), FINECOSINE(aiming >> ANGLETOFINESHIFT)); z = FINISHLINEBEAM_SPACING + FixedMul(FINISHLINEBEAM_SPACING, FINESINE(aiming >> ANGLETOFINESHIFT)); - if (frameaim > ANGLE_180) + if (leveltime >= starttime) + { + spriteframe = 4; // Weakest sprite when passable + } + else if (frameaim > ANGLE_180) { spriteframe = (ANGLE_MAX - frameaim) / framethreshold; } @@ -3295,6 +3299,11 @@ void K_RunFinishLineBeam(void) boolean valid = false; UINT32 i; + if (!(leveltime < starttime || rainbowstartavailable == true)) + { + return; + } + // this does NOT support finish lines that curve. // I wanted to! But I have a headache from trying to code it for like, 3 hours! // so I'm not! From 58ea0bf6772c1028b188743705489ec13790851b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 8 Nov 2020 01:32:29 -0500 Subject: [PATCH 4/7] Give the ends MF2_LINKDRAW --- src/k_kart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 503ae1a49..c1a66eae1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3076,6 +3076,9 @@ static void K_DrawFinishLineBeamForLine(fixed_t offset, angle_t aiming, line_t * P_SetMobjState(end2, S_FINISHBEAMEND2); end2->drawflags = MFD_DONTDRAW & ~K_GetPlayerDontDrawFlag(&players[displayplayers[i]]); end2->angle = lineangle; + + P_SetTarget(&end2->tracer, end1); + end2->flags2 |= MF2_LINKDRAW; } } } From d627da75108f4e1aeb5cd62a771e4ae3b8ada8a8 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 14:34:48 -0500 Subject: [PATCH 5/7] Fix lap executors not happening, and also edit it so they act like Each Time rather than Once Allows for simplified executor logic on Desert Palace and Chrome Gadget, possibly Egg Zeppelin too --- src/doomstat.h | 1 + src/g_game.c | 1 + src/lua_script.c | 3 +++ src/p_saveg.c | 2 ++ src/p_setup.c | 1 + src/p_spec.c | 14 ++++++++++++-- src/p_user.c | 8 ++++---- 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 2df6caeb5..038944ef1 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -686,6 +686,7 @@ extern tic_t indirectitemcooldown; extern tic_t hyubgone; extern tic_t mapreset; extern boolean thwompsactive; +extern UINT8 lastLowestLap; extern SINT8 spbplace; extern boolean rainbowstartavailable; diff --git a/src/g_game.c b/src/g_game.c index 018d443ba..b62e7a6ce 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -315,6 +315,7 @@ tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any othe tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled tic_t mapreset; // Map reset delay when enough players have joined an empty game boolean thwompsactive; // Thwomps activate on lap 2 +UINT8 lastLowestLap; // Last lowest lap, for activating race lap executors SINT8 spbplace; // SPB exists, give the person behind better items boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten diff --git a/src/lua_script.c b/src/lua_script.c index 291a1936c..abf427e75 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -357,6 +357,9 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"thwompsactive")) { lua_pushboolean(L, thwompsactive); return 1; + } else if (fastcmp(word,"lastLowestLap")) { + lua_pushinteger(L, lastLowestLap); + return 1; } else if (fastcmp(word,"spbplace")) { lua_pushinteger(L, spbplace); return 1; diff --git a/src/p_saveg.c b/src/p_saveg.c index 650f77ef1..79b99e98f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4162,6 +4162,7 @@ static void P_NetArchiveMisc(void) WRITEINT16(save_p, nospectategrief[i]); WRITEUINT8(save_p, thwompsactive); + WRITEUINT8(save_p, lastLowestLap); WRITESINT8(save_p, spbplace); WRITEUINT8(save_p, rainbowstartavailable); @@ -4295,6 +4296,7 @@ static inline boolean P_NetUnArchiveMisc(void) nospectategrief[i] = READINT16(save_p); thwompsactive = (boolean)READUINT8(save_p); + lastLowestLap = READUINT8(save_p); spbplace = READSINT8(save_p); rainbowstartavailable = (boolean)READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 15e6767a5..13c0170a8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4098,6 +4098,7 @@ boolean P_LoadLevel(boolean fromnetsave) nospectategrief[i] = -1; thwompsactive = false; + lastLowestLap = 0; spbplace = -1; // clear special respawning que diff --git a/src/p_spec.c b/src/p_spec.c index 1fcba7585..06de8118e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1836,7 +1836,6 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || specialtype == 336 // Dye - Once || specialtype == 399 // Level Load || specialtype == 328 // SRB2Kart Encore Load - || specialtype == 2002 // SRB2Kart Race Lap ) triggerline->special = 0; // Clear it out @@ -1999,6 +1998,7 @@ static void K_HandleLapIncrement(player_t *player) { size_t i = 0; UINT8 nump = 0; + UINT8 lowestLap; for (i = 0; i < MAXPLAYERS; i++) { @@ -2082,6 +2082,8 @@ static void K_HandleLapIncrement(player_t *player) thwompsactive = true; // Lap 2 effects + lowestLap = P_FindLowestLap(); + for (i = 0; i < numlines; i++) { if (lines[i].special == 2002) // Race lap trigger @@ -2094,7 +2096,13 @@ static void K_HandleLapIncrement(player_t *player) } else { - lap = P_FindLowestLap(); + lap = lowestLap; + + if (lap <= lastLowestLap) + { + // Need to be able to search for E4 linedefs + continue; + } } if (lines[i].flags & ML_NOCLIMB) // Need higher than or equal to @@ -2116,6 +2124,8 @@ static void K_HandleLapIncrement(player_t *player) P_RunTriggerLinedef(&lines[i], player->mo, NULL); } } + + lastLowestLap = lowestLap; } else if (player->starpostnum) { diff --git a/src/p_user.c b/src/p_user.c index befea60fa..e7a94ef11 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -409,7 +409,7 @@ UINT8 P_FindLowestLap(void) INT32 i; UINT8 lowest = UINT8_MAX; - if (gametyperules & GTR_CIRCUIT) + if (!(gametyperules & GTR_CIRCUIT)) return 0; for (i = 0; i < MAXPLAYERS; i++) @@ -417,10 +417,10 @@ UINT8 P_FindLowestLap(void) if (!playeringame[i] || players[i].spectator) continue; - if (lowest == 255) - lowest = players[i].laps; - else if (players[i].laps < lowest) + if (lowest == UINT8_MAX || players[i].laps < lowest) + { lowest = players[i].laps; + } } CONS_Debug(DBG_GAMELOGIC, "Lowest laps found: %d\n", lowest); From 092a24540b547d6f007b48356e5598455fd265a6 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 22:28:02 -0500 Subject: [PATCH 6/7] Camera no longer updates while you're in hitlag The camera zooming out made it hard to focus on the hit, which is the opposite of what hitlag is intended to do :V --- src/p_user.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index befea60fa..e705c0d8a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3075,6 +3075,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall mo = player->mo; + if (mo->hitlag > 0) + { + // Do not move the camera while in hitlag! + // The camera zooming out after you got hit makes it hard to focus on the vibration. + return true; + } + #ifndef NOCLIPCAM cameranoclip = ((player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!! From 197f21d3838e272a9119842e7d7a7aa5d6251b4a Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 1 Feb 2021 23:23:37 -0500 Subject: [PATCH 7/7] Beam does not render if finish line is curved at ALL. Alternative will need created for sprint maps. Don't care atm. --- src/k_kart.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index c1a66eae1..65897e4c3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3110,6 +3110,8 @@ void K_RunFinishLineBeam(void) { if (lines[i].special == 2001) { + angle_t thisAngle = R_PointToAngle2(0, 0, lines[i].dx, lines[i].dy); + bounds[0] = min(bounds[0], min(lines[i].v1->x, lines[i].v2->x)); // min x bounds[1] = max(bounds[1], max(lines[i].v1->x, lines[i].v2->x)); // max x bounds[2] = min(bounds[2], min(lines[i].v1->y, lines[i].v2->y)); // min y @@ -3117,9 +3119,14 @@ void K_RunFinishLineBeam(void) if (valid == false) { - angle = R_PointToAngle2(0, 0, lines[i].dx, lines[i].dy); + angle = thisAngle; flags = lines[i].flags; } + else if (angle != thisAngle) + { + valid = false; + break; + } valid = true; }