diff --git a/src/k_hud.c b/src/k_hud.c index e8e3bcad7..520c6ae33 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1138,6 +1138,33 @@ static boolean K_UseColorSpeedo(int speedostyle) } } +enum +{ + GAUGE_DEFAULT = 1, + GAUGE_SMALL, + GAUGE_BIGNUM, + GAUGE_NUMONLY, + GAUGE_EXTRA, +}; + +static SINT8 K_GetDriftgaugeStyle(void) +{ + if (driftgaugegfx) + { + if (cv_driftgaugestyle.value == 1) + return GAUGE_DEFAULT; + else if (cv_driftgaugestyle.value == 2) + return GAUGE_SMALL; + else if (cv_driftgaugestyle.value == 3) + return GAUGE_BIGNUM; + else if (cv_driftgaugestyle.value == 5 && xtra_speedo3) + return GAUGE_EXTRA; + } + + // Fallback + return GAUGE_NUMONLY; // (cv_driftgaugestyle.value == 4) +} + static boolean K_IsHighResolution(void) { return (vid.width >= 640 && vid.height >= 400); @@ -3149,7 +3176,7 @@ static void K_drawDriftGauge(void) fixed_t basex, basey; const int dup = vid.dupx; int i; - UINT8 *cmap; + UINT8 *colormap = NULL; static const UINT8 driftcolors[3][4] = { {0, 0, 10, 16}, // no drift @@ -3195,23 +3222,21 @@ skipcrap: const INT32 driftcharge = min(driftval*4, stplyr->kartstuff[k_driftcharge]); const INT32 driftlevel = min(driftcharge / driftval, 2); const INT32 drifttrans = ((cv_driftgaugetrans.value) ? V_LocalTransFlag() : 0); + const SINT8 gaugestyle = K_GetDriftgaugeStyle(); basex = pos.x>>FRACBITS; basey = pos.y>>FRACBITS; - switch (cv_driftgaugestyle.value) + switch (gaugestyle) { - case 1: - case 2: - case 3: - case 5: + case GAUGE_DEFAULT: + case GAUGE_SMALL: + case GAUGE_EXTRA: + case GAUGE_BIGNUM: { - if (!driftgaugegfx) - break; + patch_t *driftpatch = NULL; - const boolean usescaledpatch = (cv_driftgaugestyle.value == 5 && xtra_speedo3); - - if (cv_driftgaugestyle.value == 1 || cv_driftgaugestyle.value == 3 || usescaledpatch) + if (gaugestyle == GAUGE_DEFAULT || gaugestyle == GAUGE_BIGNUM || gaugestyle == GAUGE_EXTRA) { barx = basex - dup*23; BAR_WIDTH = dup*47; @@ -3224,40 +3249,44 @@ skipcrap: bary = basey - dup*2; - if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code..... + if (gaugestyle == GAUGE_EXTRA) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code..... { - if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // Colourized hud + if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // We reuse the extra speedometer patch hence this check { - UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawStretchyFixedPatch((basex - dup*30)<= driftval*4) // rainbow sparks { - cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE); + colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE); for (i = 0; i < 4; i++) - V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans); + V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 17)] + i*2) | V_NOSCALESTART|drifttrans); } else // none/blue/red { const INT32 limit = (driftval * (driftcharge >= driftval*2 ? 2 : 1)); const INT32 width = ((driftcharge - (driftcharge >= driftval ? limit : 0)) * BAR_WIDTH) / limit; - cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE); + colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE); for (i = 0; i < 4; i++) { @@ -3269,20 +3298,20 @@ skipcrap: } // right, also draw a cool number - if (cv_driftgaugestyle.value == 3) - V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap); + if (gaugestyle == GAUGE_BIGNUM) + V_DrawPaddedTallColorNum(basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap); else - V_DrawPingNum(cv_driftgaugestyle.value == 2 ? basex + (dup*22) : basex + (dup*32), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, cmap); + V_DrawPingNum((gaugestyle == GAUGE_SMALL ? basex + (dup*22) : basex + (dup*32)), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, colormap); } break; - case 4: + case GAUGE_NUMONLY: { if (driftcharge >= driftval*4) - cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE); + colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE); else - cmap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel],GTC_CACHE); + colormap = R_GetTranslationColormap(TC_RAINBOW, driftskins[driftlevel], GTC_CACHE); - V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, cmap); + V_DrawPaddedTallColorNum(basex + (dup*16), basey, V_NOSCALESTART|V_OFFSET|drifttrans, driftcharge*100 / driftval, 3, colormap); } break; default: @@ -3343,6 +3372,7 @@ static void K_drawKartWanted(void) { basex = WANT_X; basey = WANT_Y; + if (splitscreen == 2) { basey += 16; // slight adjust for 3P @@ -4092,17 +4122,23 @@ static void K_drawKartFirstPerson(void) x -= xoffs; else x += xoffs; + if (!splitscreen) y += yoffs; } + const INT32 driftcharge = stplyr->kartstuff[k_driftcharge]; + // drift sparks! - if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsthree)) - colmap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE); - else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dstwo)) - colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE); - else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsone)) - colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE); + if ((leveltime & 1) && driftcharge) + { + if (driftcharge >= dsthree) + colmap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(), GTC_CACHE); + else if (driftcharge >= dstwo) + colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE); + else if (driftcharge >= dsone) + colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE); + } else #endif // invincibility/grow/shrink! diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 7842cfad3..27463fbac 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1511,7 +1511,7 @@ static polyobj_t *Polyobj_GetParent(polyobj_t *po) // Iteratively retrieves the children POs of a parent, // sorta like P_FindSectorSpecialFromTag. // -static polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start) +polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start) { for (; *start < numPolyObjects; (*start)++) { diff --git a/src/p_polyobj.h b/src/p_polyobj.h index 9a47cd150..92f46dd69 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -269,6 +269,7 @@ typedef struct polydisplacedata_s // polyobj_t *Polyobj_GetForNum(INT32 id); +polyobj_t *Polyobj_GetChild(polyobj_t *po, INT32 *start); void Polyobj_InitLevel(void); void Polyobj_MoveOnLoad(polyobj_t *po, angle_t angle, fixed_t x, fixed_t y); boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y); diff --git a/src/p_saveg.c b/src/p_saveg.c index 8dc50e1f6..b95e1a09e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2234,6 +2234,12 @@ static void LoadSpecialLevelThinker(savebuffer_t *save, actionf_p1 thinker, UINT } P_AddThinker(&ht->thinker); + + // interpolation + if (floorOrCeiling & 2) + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true); + if (floorOrCeiling & 1) + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false); } // @@ -2263,6 +2269,9 @@ static void LoadCeilingThinker(savebuffer_t *save, actionf_p1 thinker) if (ht->sector) ht->sector->ceilingdata = ht; P_AddThinker(&ht->thinker); + + // interpolation + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true); } // @@ -2287,6 +2296,9 @@ static void LoadFloormoveThinker(savebuffer_t *save, actionf_p1 thinker) if (ht->sector) ht->sector->floordata = ht; P_AddThinker(&ht->thinker); + + // interpolation + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false); } // @@ -2400,6 +2412,12 @@ static void LoadElevatorThinker(savebuffer_t *save, actionf_p1 thinker, UINT8 fl } P_AddThinker(&ht->thinker); + + // interpolation + if (floorOrCeiling & 2) + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, true); + if (floorOrCeiling & 1) + R_CreateInterpolator_SectorPlane(&ht->thinker, ht->sector, false); } // @@ -2422,6 +2440,22 @@ static void LoadScrollThinker(savebuffer_t *save, actionf_p1 thinker) ht->exclusive = READINT32(save->p); ht->type = READUINT8(save->p); P_AddThinker(&ht->thinker); + + // interpolation + switch (ht->type) + { + case sc_side: + R_CreateInterpolator_SideScroll(&ht->thinker, &sides[ht->affectee]); + break; + case sc_floor: + R_CreateInterpolator_SectorScroll(&ht->thinker, §ors[ht->affectee], false); + break; + case sc_ceiling: + R_CreateInterpolator_SectorScroll(&ht->thinker, §ors[ht->affectee], true); + break; + default: + break; + } } // @@ -2553,6 +2587,17 @@ static inline void LoadPolyrotatetThinker(savebuffer_t *save, actionf_p1 thinker ht->distance = READINT32(save->p); ht->turnobjs = READUINT8(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); } // @@ -2571,6 +2616,17 @@ static void LoadPolymoveThinker(savebuffer_t *save, actionf_p1 thinker) ht->distance = READINT32(save->p); ht->angle = READANGLE(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); } // @@ -2595,6 +2651,36 @@ static inline void LoadPolywaypointThinker(savebuffer_t *save, actionf_p1 thinke ht->diffy = READFIXED(save->p); ht->diffz = READFIXED(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + polyobj_t *oldpo; + INT32 start; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); + // T_PolyObjWaypoint is the only polyobject movement + // that can adjust z, so we add these ones too. + R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, false); + R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, true); + + // Most other polyobject functions handle children by recursively + // giving each child another thinker. T_PolyObjWaypoint handles + // it manually though, which means we need to manually give them + // interpolation here instead. + start = 0; + oldpo = po; + while ((po = Polyobj_GetChild(oldpo, &start))) + { + R_CreateInterpolator_Polyobj(&ht->thinker, po); + R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, false); + R_CreateInterpolator_SectorPlane(&ht->thinker, po->lines[0]->backsector, true); + } } // @@ -2620,6 +2706,17 @@ static inline void LoadPolyslidedoorThinker(savebuffer_t *save, actionf_p1 think ht->momy = READFIXED(save->p); ht->closing = READUINT8(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); } // @@ -2640,6 +2737,17 @@ static inline void LoadPolyswingdoorThinker(savebuffer_t *save, actionf_p1 think ht->distance = READINT32(save->p); ht->closing = READUINT8(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); } // @@ -2657,6 +2765,17 @@ static inline void LoadPolydisplaceThinker(savebuffer_t *save, actionf_p1 thinke ht->dy = READFIXED(save->p); ht->oldHeights = READFIXED(save->p); P_AddThinker(&ht->thinker); + + // interpolation + polyobj_t *po; + + if (!(po = Polyobj_GetForNum(ht->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjRotate: bad polyobj %d\n", ht->polyObjNum); + return; + } + + R_CreateInterpolator_Polyobj(&ht->thinker, po); } //