diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a17a4219b..c8a66e3a0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -108,7 +108,7 @@ UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values. static tic_t reference_lag; static UINT8 spike_time; tic_t lowest_lag; -tic_t simulated_lag; // just for ping readout without netticbuffer added +tic_t simulated_lag; boolean server_lagless; static void Lagless_OnChange(void) diff --git a/src/d_player.h b/src/d_player.h index 0991144fb..7ecef63de 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -553,6 +553,8 @@ typedef struct player_s tic_t driftsparkGrowTimer; + fixed_t spinoutrot; // When a player spins out, this value increments modulus 360. + fixed_t fovadd; // adjust FOV for hw rendering } player_t; diff --git a/src/g_game.h b/src/g_game.h index fa427b752..deec04226 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -180,6 +180,7 @@ extern consvar_t cv_sliptideroll; extern consvar_t cv_slamsound; extern consvar_t cv_sloperolldist; extern consvar_t cv_sparkroll; +extern consvar_t cv_spinoutroll; extern consvar_t cv_cechotoggle; diff --git a/src/k_kart.c b/src/k_kart.c index 5d6f040f7..dd3466c4e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -140,6 +140,7 @@ static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_spinoutroll = {"spinoutroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //hardcode saltyhop mhhm static void saltyhop_onchange(void); @@ -8826,7 +8827,9 @@ static void K_DrawKartPositionNum(INT32 num) } if (splitscreen || cv_smallposnum.value || wheeloffs) + { scale /= 2; + } W = FixedMul(W<>FRACBITS; @@ -8915,7 +8918,9 @@ static void K_DrawKartPositionNum(INT32 num) } } else + { localpatch = kp_positionnum[num % 10][0]; + } V_DrawFixedPatch((fx<width)*scale/2) : 0), (fy<height)*scale/2) : 0), scale, V_HUDTRANSHALF|fflags, localpatch, NULL); // ^ if we overtake as p1 or p3 in splitscren, we shift it so that it doesn't go off screen. @@ -10108,18 +10113,27 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) // The number being divided by is for how fast it moves. // The higher the number, the slower it moves. - // am xpos & ypos are the icon's starting position. Withouht + // am xpos & ypos are the icon's starting position. Without // it, they wouldn't 'spawn' on the top-right side of the HUD. - UINT8 skin = 0; - boolean skinlocal = mo->skinlocal; + UINT8 skinnum = 0; + const boolean skinlocal = mo->skinlocal; + const skin_t *skin = (skin_t*)(mo->localskin ? mo->localskin : mo->skin); fixed_t amnumxpos, amnumypos; INT32 amxpos, amypos, wntdamxpos, wntdamypos; fixed_t scale = FRACUNIT; + patch_t *minimaphead = NULL; + +#ifdef ROTSPRITE + angle_t rollangle = 0; + INT32 rot = 0; +#endif if (mo->skin) - skin = ((skin_t*)(mo->localskin ? mo->localskin : mo->skin))-(skinlocal ? localskins : skins); + skinnum = (skin-(skinlocal ? localskins : skins)); + + minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[skinnum]; amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x); amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y); @@ -10127,8 +10141,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) if (encoremode) amnumxpos = -amnumxpos; - amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width)) / 2)<height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height)) / 2)<width)-SHORT(minimaphead->width)) / 2)<height)-SHORT(minimaphead->height)) / 2)<player && !(modeattacking || gamestate == GS_TIMEATTACK)) { @@ -10141,22 +10155,37 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) if (cv_minihead.value) { - amxpos += (SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width) / 4)<height) / 4)<width) / 4)<height) / 4)<player) + { + // Rotate counterclockwise. + rollangle = FixedAngle(mo->player->spinoutrot * -1); + rot = R_GetRollAngle(rollangle); + + if (rot) + { + minimaphead = W_CachePatchNameRotated(skin->facemmap, rot, PU_STATIC); + } + } +#endif + if (!mo->color) // 'default' color - V_DrawSciencePatch(amxpos, amypos, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], scale); + V_DrawSciencePatch(amxpos, amypos, flags, minimaphead, scale); else { UINT8 *colormap; + if (mo->colorized) colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE); else colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); - V_DrawFixedPatch(amxpos, amypos, scale, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap); + V_DrawFixedPatch(amxpos, amypos, scale, flags, minimaphead, colormap); if (mo->player && ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace) diff --git a/src/m_menu.c b/src/m_menu.c index 4d8517e2d..18c72f9ca 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2363,15 +2363,16 @@ static menuitem_t OP_SaturnHudMenu[] = {IT_STRING | IT_CVAR, NULL, "Show Names on Minimap", &cv_showminimapnames, 135}, {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 140}, + {IT_STRING | IT_CVAR, NULL, "Spin Minimap Icons", &cv_spinoutroll, 150}, - {IT_STRING | IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 150}, + {IT_STRING | IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 160}, - {IT_STRING | IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 160}, + {IT_STRING | IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 170}, - {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 170}, - {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 175}, + {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 180}, + {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 185}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 185}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 195}, }; static const char* OP_SaturnHudTooltips[] = @@ -2395,6 +2396,7 @@ static const char* OP_SaturnHudTooltips[] = "Show the big Cecho Messages.", "Show player names on the minimap.", "Minimize the player icons on the minimap.", + "Erratically rotate player icons during spinouts.", "Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.", "Show the Director Toggle prompt when spectating.", "Nametag Options.", @@ -2423,6 +2425,7 @@ enum sh_cechotogle, sh_mapname, sh_smallmap, + sh_iconspinout, sh_betainter, sh_directorhud, sh_nametagmen, diff --git a/src/p_mobj.c b/src/p_mobj.c index 3f90d8bb0..111dc6558 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10733,6 +10733,8 @@ void P_SpawnPlayer(INT32 playernum) p->hitemtimer = 0; p->hitemvictim = 255; + p->spinoutrot = 0; + if (G_BattleGametype()) // SRB2kart { mobj_t *overheadarrow = P_SpawnMobj(mobj->x, mobj->y, mobj->z + P_GetPlayerHeight(p)+16*FRACUNIT, MT_PLAYERARROW); diff --git a/src/p_setup.c b/src/p_setup.c index 2af8e37a9..967c964f3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2264,13 +2264,21 @@ static void P_LevelInitStuff(boolean reloadinggamestate) players[i].realtime = racecountdown = exitcountdown = 0; +<<<<<<< HEAD +<<<<<<< HEAD for (INT32 j = 0; j < LAP__MAX; j++) { players[i].laptime[j] = 0; } players[i].driftsparkGrowTimer = 0; +======= + // Neptune + players[i].spinoutrot = 0; +>>>>>>> 052dcb263 (Add a cvar for minimap icon spinouts) +======= +>>>>>>> 432dcd3a3 (Refactor to prevent desynchs) players[i].gotcontinue = false; players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0; diff --git a/src/p_user.c b/src/p_user.c index 890fa2e5f..dacd18868 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4430,6 +4430,9 @@ DoABarrelRoll (player_t *player) player->tilt = slope; } +#define SPINOUTROTSPEED (24 * FRACUNIT) +#define MAXSPINROT (360 * FRACUNIT) + // // P_PlayerThink // @@ -4573,6 +4576,31 @@ void P_PlayerThink(player_t *player) } } + if (player->kartstuff[k_spinouttimer] && (player->spinoutrot == 0)) + { + player->spinoutrot = SPINOUTROTSPEED; + } + + // MKWii-styled icon spinouts: do a full 360 rotation before stopping. + if (player->spinoutrot && (player->spinoutrot < MAXSPINROT)) + { + if ((player->spinoutrot + SPINOUTROTSPEED) >= MAXSPINROT) + { + if (player->kartstuff[k_spinouttimer]) + { + player->spinoutrot = (player->spinoutrot + SPINOUTROTSPEED) % MAXSPINROT; + } + else + { + player->spinoutrot = 0; + } + } + else + { + player->spinoutrot += SPINOUTROTSPEED; + } + } + // If it is set, start subtracting // Don't allow it to go back to 0 if (player->exiting > 1 && (player->exiting < raceexittime+2 || !G_RaceGametype())) // SRB2kart - "&& player->exiting > 1" diff --git a/src/r_main.c b/src/r_main.c index ddbda9cc3..aa28078ae 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1566,6 +1566,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_sliptideroll); CV_RegisterVar(&cv_sloperolldist); CV_RegisterVar(&cv_sparkroll); + CV_RegisterVar(&cv_spinoutroll); CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud); diff --git a/src/w_wad.c b/src/w_wad.c index 82d71c814..8760fc8de 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1125,12 +1125,15 @@ lumpnum_t W_CheckNumForName(const char *name) break; //found it } - if (check == INT16_MAX) return LUMPERROR; + if (check == INT16_MAX) + { + return LUMPERROR; + } else { // Update the cache. lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1); - memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', 32); + memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', LUMPNUMCACHENAME); strncpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 8); lumpnumcache[lumpnumcacheindex].lumpnum = (i<<16)+check; @@ -1174,7 +1177,10 @@ lumpnum_t W_CheckNumForLongName(const char *name) } } - if (check == INT16_MAX) return LUMPERROR; + if (check == INT16_MAX) + { + return LUMPERROR; + } else { if (strlen(name) < 32)