diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 057bdf2a2..4b92acd49 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2323,6 +2323,8 @@ static void Command_StopMovie_f(void) INT32 mapchangepending = 0; +tic_t driftsparkGrowTimer[MAXPLAYERS]; + /** Runs a map change. * The supplied data are assumed to be good. If provided by a user, they will * have already been checked in Command_Map_f(). @@ -2356,6 +2358,9 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d encoremode=%d resetplayers=%d delay=%d skipprecutscene=%d\n", mapnum, newgametype, pencoremode, resetplayers, delay, skipprecutscene); + // just gonna hack in a timer reset here... + memset(driftsparkGrowTimer, 0, sizeof(driftsparkGrowTimer)); + if (netgame || multiplayer) FLS = false; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 5b1c7c859..a56cb780c 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -231,6 +231,8 @@ typedef union { #pragma pack() #endif +extern tic_t driftsparkGrowTimer[16]; + // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); diff --git a/src/g_game.c b/src/g_game.c index a76d4770e..7f8283ca3 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -526,6 +526,8 @@ consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NU consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}}; +consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL}; #if MAXPLAYERS > 16 #error "please update player_name table using the new value for MAXPLAYERS" diff --git a/src/g_game.h b/src/g_game.h index 0dcc69c39..5086bb4d1 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -124,6 +124,8 @@ extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_xdeadzone4,cv_ydeadzone4; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; +extern consvar_t cv_driftsparkpulse; + typedef enum { AXISNONE = 0, diff --git a/src/k_kart.c b/src/k_kart.c index d040b8d28..627f82a75 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2798,6 +2798,8 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I return NULL; } +#define DRIFTSPARKGROWTICS 8 + static void K_SpawnDriftSparks(player_t *player) { fixed_t newx; @@ -2823,14 +2825,28 @@ static void K_SpawnDriftSparks(player_t *player) for (i = 0; i < 2; i++) { + UINT8 pindex; + fixed_t driftExtraScale = 0; newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale)); spark = P_SpawnMobj(newx, newy, player->mo->z, MT_DRIFTSPARK); P_SetTarget(&spark->target, player->mo); spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift]; - spark->destscale = player->mo->scale; - P_SetScale(spark, player->mo->scale); + + // scale increase while driftspark level gained timer is running + + // hack to find the correct player number + for (pindex = 0; pindex < MAXPLAYERS; pindex++) + { + if (player == &players[pindex]) + { + driftExtraScale = FixedDiv(driftsparkGrowTimer[pindex], DRIFTSPARKGROWTICS); + break; + } + } + spark->destscale = FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value)); + P_SetScale(spark, FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value))); spark->momx = player->mo->momx/2; spark->momy = player->mo->momy/2; @@ -5196,24 +5212,54 @@ static void K_KartDrift(player_t *player, boolean onground) if (player->speed > minspeed*2) player->kartstuff[k_getsparks] = 1; + // Sound whenever you get a different tier of sparks + if ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone) + || (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo) + || (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree)) + { + UINT8 pindex; + //S_StartSound(player->mo, sfx_s3ka2); + if (P_IsLocalPlayer(player)) // UGHGHGH... + S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh... + + // hack to find the correct player number + for (pindex = 0; pindex < MAXPLAYERS; pindex++) + { + if (player == &players[pindex]) + { + driftsparkGrowTimer[pindex] = DRIFTSPARKGROWTICS; + break; + } + } + } + + + // moved this below sounds to help with scaling // This spawns the drift sparks if (player->kartstuff[k_driftcharge] + driftadditive >= dsone) K_SpawnDriftSparks(player); - // Sound whenever you get a different tier of sparks - if (P_IsLocalPlayer(player) // UGHGHGH... - && ((player->kartstuff[k_driftcharge] < dsone && player->kartstuff[k_driftcharge]+driftadditive >= dsone) - || (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo) - || (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree))) - { - //S_StartSound(player->mo, sfx_s3ka2); - S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh... - } - player->kartstuff[k_driftcharge] += driftadditive; player->kartstuff[k_driftend] = 0; } + { + //im putting this in a block because i want the variables here, not at the top of the block + UINT8 pindex; + + // hack to find the correct player number + for (pindex = 0; pindex < MAXPLAYERS; pindex++) + { + if (player == &players[pindex]) + { + if (driftsparkGrowTimer[pindex]) + driftsparkGrowTimer[pindex]--; + break; + } + } + } + + // Stop drifting if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed) { diff --git a/src/m_menu.c b/src/m_menu.c index b657d1c9b..d01a8b6ff 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1271,6 +1271,7 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90}, {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100}, {IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 110}, + {IT_STRING | IT_CVAR, NULL, "Drift spark pulse size",&cv_driftsparkpulse, 125}, #ifdef HWRENDER {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 130}, @@ -1292,6 +1293,7 @@ enum op_video_fps, op_video_vsync, op_video_fpscap, + op_video_driftsparkpulse, #ifdef HWRENDER op_video_ogl, #endif diff --git a/src/r_main.c b/src/r_main.c index b6643f06d..78c9672c9 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1520,6 +1520,8 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_cam4_rotate); CV_RegisterVar(&cv_cam4_rotspeed); + CV_RegisterVar(&cv_driftsparkpulse); + CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud);