diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3d864e39..9485e910 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2473,9 +2473,9 @@ static void CL_RemovePlayer(INT32 playernum) if (G_TagGametype()) //Check if you still have a game. Location flexible. =P P_CheckSurvivors(); - else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) - K_CheckBalloons(); // SRB2Kart - else if (gametype == GT_RACE || gametype == GT_COMPETITION) + else if (G_BattleGametype()) // SRB2Kart + K_CheckBalloons(); + else if (G_RaceGametype()) P_CheckRacers(); } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f558858e..a8dcf2c5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -799,10 +799,6 @@ void D_RegisterClientCommands(void) //CV_RegisterVar(&cv_alwaysfreelook2); // g_input.c - CV_RegisterVar(&cv_sideaxis); - CV_RegisterVar(&cv_sideaxis2); - CV_RegisterVar(&cv_sideaxis3); - CV_RegisterVar(&cv_sideaxis4); CV_RegisterVar(&cv_turnaxis); CV_RegisterVar(&cv_turnaxis2); CV_RegisterVar(&cv_turnaxis3); @@ -811,6 +807,14 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_moveaxis2); CV_RegisterVar(&cv_moveaxis3); CV_RegisterVar(&cv_moveaxis4); + CV_RegisterVar(&cv_brakeaxis); + CV_RegisterVar(&cv_brakeaxis2); + CV_RegisterVar(&cv_brakeaxis3); + CV_RegisterVar(&cv_brakeaxis4); + CV_RegisterVar(&cv_aimaxis); + CV_RegisterVar(&cv_aimaxis2); + CV_RegisterVar(&cv_aimaxis3); + CV_RegisterVar(&cv_aimaxis4); CV_RegisterVar(&cv_lookaxis); CV_RegisterVar(&cv_lookaxis2); CV_RegisterVar(&cv_lookaxis3); @@ -819,10 +823,10 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_fireaxis2); CV_RegisterVar(&cv_fireaxis3); CV_RegisterVar(&cv_fireaxis4); - CV_RegisterVar(&cv_firenaxis); - CV_RegisterVar(&cv_firenaxis2); - CV_RegisterVar(&cv_firenaxis3); - CV_RegisterVar(&cv_firenaxis4); + CV_RegisterVar(&cv_driftaxis); + CV_RegisterVar(&cv_driftaxis2); + CV_RegisterVar(&cv_driftaxis3); + CV_RegisterVar(&cv_driftaxis4); // WARNING: the order is important when initialising mouse2 // we need the mouse2port @@ -1961,12 +1965,10 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese void D_SetupVote(void) { - XBOXSTATIC char buf[8]; - char *p; + char buf[8]; + char *p = buf; INT32 i; - p = buf; - for (i = 0; i < 4; i++) { if (i == 3) @@ -1978,18 +1980,21 @@ void D_SetupVote(void) SendNetXCmd(XD_SETUPVOTE, buf, p - buf); } -void D_ModifyClientVote(INT8 voted) +void D_ModifyClientVote(SINT8 voted) { - XBOXSTATIC UINT8 buf[1]; - buf[0] = (UINT8)(voted+1); + char buf[1]; + char *p = buf; + + WRITESINT8(p, voted); SendNetXCmd(XD_MODIFYVOTE, &buf, 1); } void D_PickVote(void) { - XBOXSTATIC UINT8 buf[2]; - UINT8 temppicks[MAXPLAYERS]; - UINT8 templevels[MAXPLAYERS]; + char buf[2]; + char* p = buf; + SINT8 temppicks[MAXPLAYERS]; + SINT8 templevels[MAXPLAYERS]; UINT8 numvotes = 0, key = 0; INT32 i; @@ -1999,16 +2004,24 @@ void D_PickVote(void) continue; if (votes[i] != -1) { - temppicks[numvotes] = (UINT8)i; - templevels[numvotes] = (UINT8)votes[i]; + temppicks[numvotes] = i; + templevels[numvotes] = votes[i]; numvotes++; } } key = M_RandomKey(numvotes); - buf[0] = temppicks[key]; - buf[1] = templevels[key]; + if (numvotes > 0) + { + WRITESINT8(p, temppicks[key]); + WRITESINT8(p, templevels[key]); + } + else + { + WRITESINT8(p, -1); + WRITESINT8(p, 0); + } SendNetXCmd(XD_PICKVOTE, &buf, 2); } @@ -3225,7 +3238,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // In tag, check to see if you still have a game. if (G_TagGametype()) P_CheckSurvivors(); - else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) + else if (G_BattleGametype()) K_CheckBalloons(); // SRB2Kart } @@ -4110,7 +4123,7 @@ static void PointLimit_OnChange(void) static void NumLaps_OnChange(void) { // Just don't be verbose - if (gametype == GT_RACE) + if (G_RaceGametype()) CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value); } @@ -4604,14 +4617,14 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum) { - INT8 voted = READUINT8(*cp); - votes[playernum] = (INT8)(voted-1); + SINT8 voted = READSINT8(*cp); + votes[playernum] = voted; } static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) { - INT8 pick = READUINT8(*cp); - INT8 level = READUINT8(*cp); + SINT8 pick = READSINT8(*cp); + SINT8 level = READSINT8(*cp); if (playernum != serverplayer && !IsPlayerAdmin(playernum)) { @@ -4627,7 +4640,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) return; } - Y_SetupVoteFinish((INT8)pick, (INT8)level); + Y_SetupVoteFinish(pick, level); } /** Prints the number of the displayplayer. @@ -4717,7 +4730,7 @@ static void Command_RestartAudio_f(void) I_ShutdownSound(); I_StartupSound(); I_InitMusic(); - + // These must be called or no sound and music until manually set. I_SetSfxVolume(cv_soundvolume.value); @@ -4725,7 +4738,7 @@ static void Command_RestartAudio_f(void) I_SetMIDIMusicVolume(cv_midimusicvolume.value); if (Playing()) // Gotta make sure the player is in a level P_RestoreMusic(&players[consoleplayer]); - + } /** Quits a game and returns to the title screen. @@ -5190,23 +5203,23 @@ static void Command_ShowTime_f(void) static void KartFrantic_OnChange(void) { if (cv_kartfrantic.value != franticitems && gamestate == GS_LEVEL) - CONS_Printf(M_GetText("Frantic Items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off")); + CONS_Printf(M_GetText("Frantic items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off")); } static void KartSpeed_OnChange(void) { - if (cv_kartspeed.value != gamespeed && gametype == GT_RACE && gamestate == GS_LEVEL) + if (cv_kartspeed.value != gamespeed && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Game speed will be changed to \"%s\" next round.\n"), cv_kartspeed.string); } static void KartMirror_OnChange(void) { - if (cv_kartmirror.value != mirrormode && gametype == GT_RACE && gamestate == GS_LEVEL) + if (cv_kartmirror.value != mirrormode && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Mirror Mode will be turned %s next round.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off")); } static void KartComeback_OnChange(void) { - if (cv_kartcomeback.value != comeback && gametype == GT_MATCH && gamestate == GS_LEVEL) + if (cv_kartcomeback.value != comeback && G_BattleGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Karma Comeback will be turned %s next round.\n"), cv_kartcomeback.value ? M_GetText("on") : M_GetText("off")); } \ No newline at end of file diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 70ee6940..8b207012 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -255,7 +255,7 @@ void Command_Retry_f(void); void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); void D_SetupVote(void); -void D_ModifyClientVote(INT8 voted); +void D_ModifyClientVote(SINT8 voted); void D_PickVote(void); void ObjectPlace_OnChange(void); boolean IsPlayerAdmin(INT32 playernum); diff --git a/src/dehacked.c b/src/dehacked.c index 4b2db380..2b583b0d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7020,6 +7020,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_MINEEXPLOSIONSOUND", "MT_SMOLDERING", // New explosion + "MT_BOOMEXPLODE", "MT_BOOMPARTICLE", "MT_BLUELIGHTNING", // Grow/shrink stuff diff --git a/src/doomstat.h b/src/doomstat.h index 7d55f34f..d8dfd594 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -254,7 +254,7 @@ typedef struct // SRB2kart //boolean automap; ///< Displays a level's white map outline in modified games - fixed_t mobj_scale; ///< Replacement for TOL_ERZ3 + fixed_t mobj_scale; ///< Replacement for TOL_ERZ3 // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) @@ -450,8 +450,8 @@ extern boolean comebackshowninfo; extern tic_t curlap, bestlap; extern INT16 votelevels[4]; -extern INT8 votes[MAXPLAYERS]; -extern INT8 pickedvote; +extern SINT8 votes[MAXPLAYERS]; +extern SINT8 pickedvote; extern tic_t hidetime; diff --git a/src/g_game.c b/src/g_game.c index fdf554c7..bf972367 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -249,8 +249,8 @@ boolean comeback; // Battle Mode's karma comeback is on/off // Voting system INT16 votelevels[4]; // Levels that were rolled by the host -INT8 votes[MAXPLAYERS]; // Each player's vote -INT8 pickedvote; // What vote the host rolls +SINT8 votes[MAXPLAYERS]; // Each player's vote +SINT8 pickedvote; // What vote the host rolls // Client-sided variables (NEVER use in anything that needs to be synced with other players) boolean legitimateexit; // Did this client actually finish the match? @@ -416,81 +416,37 @@ consvar_t cv_useranalog3 = {"useranalog3", "Off", CV_SAVE|CV_CALL, CV_OnOff, Use consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog4_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif -#if defined (_WII) || defined (WMINPUT) -consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis = {"joyaxis_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis = {"joyaxis_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis = {"joyaxis_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis = {"joyaxis_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_turnaxis = {"joyaxis_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifdef PSP consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifdef _arch_dreamcast -consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_XBOX) -consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (PSP) -consvar_t cv_sideaxis = {"joyaxis_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_sideaxis = {"joyaxis_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifndef _XBOX -#ifdef PSP -consvar_t cv_lookaxis = {"joyaxis_look", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else +consvar_t cv_brakeaxis = {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_aimaxis = {"joyaxis_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#endif -consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis = {"joyaxis_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif +consvar_t cv_fireaxis = {"joyaxis_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis = {"joyaxis_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#if defined (_WII) || defined (WMINPUT) -consvar_t cv_turnaxis2 = {"joyaxis2_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis2 = {"joyaxis2_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis2 = {"joyaxis2_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis2 = {"joyaxis2_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis2 = {"joyaxis2_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifdef _arch_dreamcast -consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_XBOX) -consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_PSP) -consvar_t cv_sideaxis2 = {"joyaxis2_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_sideaxis2 = {"joyaxis2_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifndef _XBOX +consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_brakeaxis2 = {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif +consvar_t cv_fireaxis2 = {"joyaxis2_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis2 = {"joyaxis2_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis3 = {"joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis3 = {"joyaxis3_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis3 = {"joyaxis3_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_brakeaxis3 = {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis3 = {"joyaxis3_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis3 = {"joyaxis3_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis3 = {"joyaxis3_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis4 = {"joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis4 = {"joyaxis4_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis4 = {"joyaxis4_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_brakeaxis4 = {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis4 = {"joyaxis4_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fireaxis4 = {"joyaxis4_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_driftaxis4 = {"joyaxis4_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; #if MAXPLAYERS > 16 @@ -843,17 +799,20 @@ static INT32 Joy1Axis(axis_input_e axissel) case AXISMOVE: axisval = cv_moveaxis.value; break; + case AXISBRAKE: + axisval = cv_brakeaxis.value; + break; + case AXISAIM: + axisval = cv_aimaxis.value; + break; case AXISLOOK: axisval = cv_lookaxis.value; break; - case AXISSTRAFE: - axisval = cv_sideaxis.value; - break; case AXISFIRE: axisval = cv_fireaxis.value; break; - case AXISFIRENORMAL: - axisval = cv_firenaxis.value; + case AXISDRIFT: + axisval = cv_driftaxis.value; break; default: return 0; @@ -920,17 +879,20 @@ static INT32 Joy2Axis(axis_input_e axissel) case AXISMOVE: axisval = cv_moveaxis2.value; break; + case AXISBRAKE: + axisval = cv_brakeaxis2.value; + break; + case AXISAIM: + axisval = cv_aimaxis2.value; + break; case AXISLOOK: axisval = cv_lookaxis2.value; break; - case AXISSTRAFE: - axisval = cv_sideaxis2.value; - break; case AXISFIRE: axisval = cv_fireaxis2.value; break; - case AXISFIRENORMAL: - axisval = cv_firenaxis2.value; + case AXISDRIFT: + axisval = cv_driftaxis2.value; break; default: return 0; @@ -992,26 +954,29 @@ static INT32 Joy3Axis(axis_input_e axissel) //find what axis to get switch (axissel) { - case AXISTURN: - axisval = cv_turnaxis3.value; - break; - case AXISMOVE: - axisval = cv_moveaxis3.value; - break; - case AXISLOOK: - axisval = cv_lookaxis3.value; - break; - case AXISSTRAFE: - axisval = cv_sideaxis3.value; - break; - case AXISFIRE: - axisval = cv_fireaxis3.value; - break; - case AXISFIRENORMAL: - axisval = cv_firenaxis3.value; - break; - default: - return 0; + case AXISTURN: + axisval = cv_turnaxis3.value; + break; + case AXISMOVE: + axisval = cv_moveaxis3.value; + break; + case AXISBRAKE: + axisval = cv_brakeaxis3.value; + break; + case AXISAIM: + axisval = cv_aimaxis3.value; + break; + case AXISLOOK: + axisval = cv_lookaxis3.value; + break; + case AXISFIRE: + axisval = cv_fireaxis3.value; + break; + case AXISDRIFT: + axisval = cv_driftaxis3.value; + break; + default: + return 0; } @@ -1070,26 +1035,29 @@ static INT32 Joy4Axis(axis_input_e axissel) //find what axis to get switch (axissel) { - case AXISTURN: - axisval = cv_turnaxis4.value; - break; - case AXISMOVE: - axisval = cv_moveaxis4.value; - break; - case AXISLOOK: - axisval = cv_lookaxis4.value; - break; - case AXISSTRAFE: - axisval = cv_sideaxis4.value; - break; - case AXISFIRE: - axisval = cv_fireaxis4.value; - break; - case AXISFIRENORMAL: - axisval = cv_firenaxis4.value; - break; - default: - return 0; + case AXISTURN: + axisval = cv_turnaxis4.value; + break; + case AXISMOVE: + axisval = cv_moveaxis4.value; + break; + case AXISBRAKE: + axisval = cv_brakeaxis4.value; + break; + case AXISAIM: + axisval = cv_aimaxis4.value; + break; + case AXISLOOK: + axisval = cv_lookaxis4.value; + break; + case AXISFIRE: + axisval = cv_fireaxis4.value; + break; + case AXISDRIFT: + axisval = cv_driftaxis4.value; + break; + default: + return 0; } @@ -1365,11 +1333,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls { - if (InputDown(gc_accelerate, ssplayer)) + if (InputDown(gc_accelerate, ssplayer) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_ACCELERATE; - if (InputDown(gc_brake, ssplayer)) + if (InputDown(gc_brake, ssplayer) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_BRAKE; - axis = JoyAxis(AXISMOVE, ssplayer); + axis = JoyAxis(AXISAIM, ssplayer); if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0)) forward += forwardmove[1]; if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0)) @@ -1378,24 +1346,39 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) else { // forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward. - if (InputDown(gc_accelerate, ssplayer) || player->kartstuff[k_sneakertimer]) + axis = JoyAxis(AXISMOVE, ssplayer); + if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer]) { cmd->buttons |= BT_ACCELERATE; forward = forwardmove[1]; // 50 } + else if (analogjoystickmove && axis > 0) + { + cmd->buttons |= BT_ACCELERATE; + // JOYAXISRANGE is supposed to be 1023 (divide by 1024) + forward += ((axis * forwardmove[1]) >> 10)*2; + } - if (InputDown(gc_brake, ssplayer)) + axis = JoyAxis(AXISBRAKE, ssplayer); + if (InputDown(gc_brake, ssplayer) || (gamepadjoystickmove && axis > 0)) { cmd->buttons |= BT_BRAKE; if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0) forward -= forwardmove[0]; // 25 - Halved value so clutching is possible } + else if (analogjoystickmove && axis > 0) + { + cmd->buttons |= BT_BRAKE; + // JOYAXISRANGE is supposed to be 1023 (divide by 1024) + if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0) + forward -= ((axis * forwardmove[0]) >> 10); + } // But forward/backward IS used for aiming. - axis = JoyAxis(AXISMOVE, ssplayer); - if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0)) + axis = JoyAxis(AXISAIM, ssplayer); + if (InputDown(gc_aimforward, ssplayer) || (cv_usejoystick.value && axis < 0)) cmd->buttons |= BT_FORWARD; - if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0)) + if (InputDown(gc_aimbackward, ssplayer) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_BACKWARD; } @@ -1405,9 +1388,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->buttons |= BT_ATTACK; // drift button - if (InputDown(gc_drift, ssplayer)) + axis = JoyAxis(AXISDRIFT, ssplayer); + if (InputDown(gc_drift, ssplayer) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_DRIFT; - + // Lua scriptable buttons if (InputDown(gc_custom1, ssplayer)) cmd->buttons |= BT_CUSTOM1; @@ -1465,15 +1449,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->aiming = G_ClipAimingPitch(&laim); } - if (!mouseaiming && cv_mousemove.value) - forward += mousey; - - if (analog || - (!demoplayback && (player->climbing - || (player->pflags & PF_SLIDING)))) // Analog for mouse - side += mousex*2; - else - cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8)); + if (player->spectator) + cmd->angleturn = (INT16)(cmd->angleturn - (mousex*(mirrormode ? -1 : 1)*8)); mousex = mousey = mlooky = 0; @@ -1510,12 +1487,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) else { cmd->forwardmove = (SINT8)(cmd->forwardmove + forward); - cmd->sidemove = (SINT8)(cmd->sidemove + side); + if (mirrormode) + cmd->sidemove = (SINT8)(cmd->sidemove - side); + else + cmd->sidemove = (SINT8)(cmd->sidemove + side); } - if (mirrormode) - cmd->sidemove = -cmd->sidemove; - if (ssplayer == 2 && player->bot == 1) { if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons)) { @@ -2279,7 +2256,7 @@ static inline void G_PlayerFinishLevel(INT32 player) // SRB2kart: Increment the "matches played" counter. if (player == consoleplayer) { - if (legitimateexit && ((!modifiedgame || savemoddata) && !demoplayback)) + if (legitimateexit && !demoplayback) // (yes you're allowed to unlock stuff this way when the game is modified) { matchesplayed++; if (M_UpdateUnlockablesAndExtraEmblems()) @@ -2611,7 +2588,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) { if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start - spawnpoint = G_FindCoopStart(playernum); // fallback + spawnpoint = G_FindRaceStart(playernum); // fallback } // -- DM/Tag/CTF-spectator/etc -- @@ -2621,14 +2598,14 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) { if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start && !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start - spawnpoint = G_FindCoopStart(playernum); // fallback + spawnpoint = G_FindRaceStart(playernum); // fallback } // -- Other game modes -- // Order: Coop->DM->CTF else { - if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start + if (!(spawnpoint = G_FindRaceStart(playernum)) // find a Race start && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start spawnpoint = G_FindCTFStart(playernum); // fallback } @@ -2760,24 +2737,79 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return NULL; } -mapthing_t *G_FindCoopStart(INT32 playernum) +mapthing_t *G_FindRaceStart(INT32 playernum) { if (numcoopstarts) { - //if there's 6 players in a map with 3 player starts, this spawns them 1/2/3/1/2/3. - if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) - return playerstarts[playernum % numcoopstarts]; + UINT8 i; + UINT8 pos = 0; - //Don't bother checking to see if the player 1 start is open. - //Just spawn there. - return playerstarts[0]; + // SRB2Kart: figure out player spawn pos from points + if (!playeringame[playernum] || players[playernum].spectator) + return playerstarts[0]; // go to first spot if you're a spectator + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator) + continue; + if (i == playernum) + continue; + + if (players[i].score < players[playernum].score) + { + UINT8 j; + UINT8 num = 0; + + for (j = 0; j < MAXPLAYERS; j++) // I hate similar loops inside loops... :< + { + if (!playeringame[j] || players[j].spectator) + continue; + if (j == playernum) + continue; + if (j == i) + continue; + if (players[j].score == players[i].score) + num++; + } + + if (num > 1) // found dupes + pos++; + } + else + { + if (players[i].score > players[playernum].score || i < playernum) + pos++; + } + } + + if (G_CheckSpot(playernum, playerstarts[pos % numcoopstarts])) + return playerstarts[pos % numcoopstarts]; + + // Your spot isn't available? Find whatever you can get first. + for (i = 0; i < numcoopstarts; i++) + { + if (G_CheckSpot(playernum, playerstarts[i])) + return playerstarts[i]; + } + + // SRB2Kart: We have solid players, so this behavior is less ideal. + // Don't bother checking to see if the player 1 start is open. + // Just spawn there. + //return playerstarts[0]; + + if (playernum == consoleplayer + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) + CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); + return NULL; } if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer) || (splitscreen > 1 && playernum == thirddisplayplayer) || (splitscreen > 2 && playernum == fourthdisplayplayer)) - CONS_Alert(CONS_WARNING, M_GetText("No Co-op starts in this map!\n")); + CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } @@ -3044,11 +3076,11 @@ boolean G_BattleGametype(void) // // G_RaceGametype // -// Returns true in racing gamemodes, previously was G_PlatformGametype. +// Returns true in Race gamemodes, previously was G_PlatformGametype. // boolean G_RaceGametype(void) { - return (gametype == GT_RACE); //(gametype == GT_COOP || gametype == GT_RACE || gametype == GT_COMPETITION); + return (gametype == GT_RACE); } // @@ -3142,7 +3174,7 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb } } } - + if (isokmap) okmaps[numokmaps++] = ix; } @@ -3258,7 +3290,7 @@ static void G_DoCompleted(void) I_Error("Followed map %d to invalid map %d\n", prevmap + 1, nextmap + 1); // wrap around in race - if (nextmap >= 1100-1 && nextmap <= 1102-1 && (gametype == GT_RACE || gametype == GT_COMPETITION)) + if (nextmap >= 1100-1 && nextmap <= 1102-1 && G_RaceGametype()) nextmap = (INT16)(spstage_start-1); if (gametype == GT_COOP && token) @@ -3353,8 +3385,8 @@ static void G_DoWorldDone(void) { if (server) { - if (gametype == GT_RACE) // SRB2kart - // don't reset player between maps + if (G_RaceGametype()) + // SRB2kart: don't reset player between maps D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false); else // resetplayer in match/tag/CTF for more equality diff --git a/src/g_game.h b/src/g_game.h index 8ea9d8f6..78f08e36 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -56,10 +56,10 @@ extern INT16 rw_maximums[NUM_WEAPONS]; // used in game menu extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove; -extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis; -extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2; -extern consvar_t cv_sideaxis3,cv_turnaxis3,cv_moveaxis3,cv_lookaxis3,cv_fireaxis3,cv_firenaxis3; -extern consvar_t cv_sideaxis4,cv_turnaxis4,cv_moveaxis4,cv_lookaxis4,cv_fireaxis4,cv_firenaxis4; +extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis; +extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2; +extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3; +extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; typedef enum @@ -67,11 +67,12 @@ typedef enum AXISNONE = 0, AXISTURN, AXISMOVE, + AXISBRAKE, + AXISAIM, AXISLOOK, - AXISSTRAFE, AXISDEAD, //Axises that don't want deadzones AXISFIRE, - AXISFIRENORMAL, + AXISDRIFT, } axis_input_e; // mouseaiming (looking up/down with the mouse or keyboard) @@ -112,7 +113,7 @@ char *G_BuildMapTitle(INT32 mapnum); // XMOD spawning mapthing_t *G_FindCTFStart(INT32 playernum); mapthing_t *G_FindMatchStart(INT32 playernum); -mapthing_t *G_FindCoopStart(INT32 playernum); +mapthing_t *G_FindRaceStart(INT32 playernum); void G_SpawnPlayer(INT32 playernum, boolean starpost); // Can be called by the startup code or M_Responder. diff --git a/src/g_input.c b/src/g_input.c index cb5f189b..485263cb 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1282,6 +1282,16 @@ void G_Controldefault(void) gamecontrol[gc_fire ][0] = KEY_SPACE; gamecontrol[gc_lookback ][0] = KEY_LSHIFT; + gamecontrol[gc_aimforward ][1] = KEY_HAT1+0; + gamecontrol[gc_aimbackward][1] = KEY_HAT1+1; + gamecontrol[gc_turnleft ][1] = KEY_HAT1+2; + gamecontrol[gc_turnright ][1] = KEY_HAT1+3; + gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A + gamecontrol[gc_drift ][1] = KEY_JOY1+1; // X + gamecontrol[gc_brake ][1] = KEY_JOY1+2; // B + gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB + gamecontrol[gc_lookback ][1] = KEY_JOY1+5; // RB + // Extra controls gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; gamecontrol[gc_pause ][0] = KEY_PAUSE; @@ -1291,6 +1301,9 @@ void G_Controldefault(void) gamecontrol[gc_scores ][0] = KEY_TAB; gamecontrol[gc_spectate ][0] = '\''; + gamecontrol[gc_scores ][1] = KEY_JOY1+6; // Back + gamecontrol[gc_spectate ][1] = KEY_JOY1+7; // Start (This is sort of like MP's pause...?) + // Spectator controls gamecontrol[gc_lookup ][0] = KEY_PGUP; gamecontrol[gc_lookdown ][0] = KEY_PGDN; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 3941e6c1..c3c04bed 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1394,7 +1394,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I V_DrawSmallScaledPatch(x-32, y-4, 0, tagico); } - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { @@ -1564,7 +1564,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline } // All data drawn with thin string for space. - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { @@ -1708,7 +1708,7 @@ static void HU_DrawRankings(void) V_DrawCenteredString(192, 16, 0, va("%u", redscore)); } - if (gametype != GT_RACE && gametype != GT_COMPETITION && gametype != GT_COOP) + if (!G_RaceGametype()) { if (cv_timelimit.value && timelimitintics > 0) { @@ -1768,7 +1768,7 @@ static void HU_DrawRankings(void) tab[i].num = -1; tab[i].name = 0; - if (gametype == GT_RACE && !circuitmap) + if (G_RaceGametype() && !circuitmap) tab[i].count = INT32_MAX; } @@ -1781,7 +1781,7 @@ static void HU_DrawRankings(void) { if (playeringame[i] && !players[i].spectator) { - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { diff --git a/src/info.c b/src/info.c index 44f17734..ffe55b5c 100644 --- a/src/info.c +++ b/src/info.c @@ -1470,9 +1470,9 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 2*TICRATE, {NULL}, 0, 0, S_FLAMEJETSTART}, // S_FLAMEJETSTND {SPR_NULL, 0, 3*TICRATE, {A_ToggleFlameJet}, 0, 0, S_FLAMEJETSTOP}, // S_FLAMEJETSTART {SPR_NULL, 0, 1, {A_ToggleFlameJet}, 0, 0, S_FLAMEJETSTND}, // S_FLAMEJETSTOP - {SPR_FLME, FF_TRANS50 , 4, {NULL}, 0, 0, S_FLAMEJETFLAME2}, // S_FLAMEJETFLAME1 - {SPR_FLME, FF_TRANS60|1, 5, {NULL}, 0, 0, S_FLAMEJETFLAME3}, // S_FLAMEJETFLAME2 - {SPR_FLME, FF_TRANS70|2, 11, {NULL}, 0, 0, S_NULL}, // S_FLAMEJETFLAME3 + {SPR_FLME, FF_FULLBRIGHT|FF_TRANS50 , 4, {NULL}, 0, 0, S_FLAMEJETFLAME2}, // S_FLAMEJETFLAME1 + {SPR_FLME, FF_FULLBRIGHT|FF_TRANS60|1, 5, {NULL}, 0, 0, S_FLAMEJETFLAME3}, // S_FLAMEJETFLAME2 + {SPR_FLME, FF_FULLBRIGHT|FF_TRANS70|2, 11, {NULL}, 0, 0, S_NULL}, // S_FLAMEJETFLAME3 // Spinning flame jets // A: Counter-clockwise @@ -14848,6 +14848,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BOOMEXPLODE + -1, // doomednum + S_SLOWBOOM1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 1, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_BOUNCE|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_BOOMPARTICLE -1, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index fdf1fdaf..e7e582f4 100644 --- a/src/info.h +++ b/src/info.h @@ -4001,6 +4001,7 @@ typedef enum mobj_type MT_MINEEXPLOSIONSOUND, MT_SMOLDERING, // New explosion + MT_BOOMEXPLODE, MT_BOOMPARTICLE, MT_BLUELIGHTNING, // Grow/shrink stuff diff --git a/src/k_kart.c b/src/k_kart.c index c699ffa6..ed3390e5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -335,6 +335,30 @@ void K_RegisterKartStuff(void) //} +boolean K_IsPlayerLosing(player_t *player) +{ + INT32 winningpos = 1; + UINT8 i, pcount = 0; + + if (player->kartstuff[k_position] == 1) + return false; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + pcount++; + } + + if (pcount <= 1) + return false; + + winningpos = pcount/2; + if (pcount % 2) // any remainder? + winningpos++; + + return (player->kartstuff[k_position] > winningpos); +} + //{ SRB2kart Roulette Code - Position Based #define NUMKARTODDS 40 @@ -440,7 +464,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, INT8 item, player_t *player) INT32 i; UINT8 pingame = 0, pexiting = 0; - if (gametype == GT_MATCH) + if (G_BattleGametype()) newodds = K_KartItemOddsBalloons[item-1][pos]; else newodds = K_KartItemOddsDistance_Retro[item-1][pos]; @@ -628,7 +652,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) && players[i].kartstuff[k_position] < player->kartstuff[k_position]) pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x, players[i].mo->y - player->mo->y), - players[i].mo->z - player->mo->z) / FRACUNIT + players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale * (pingame - players[i].kartstuff[k_position]) / ((pingame - 1) * (pingame + 1) / 3); } @@ -636,7 +660,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) #define SETUPDISTTABLE(odds, num) \ for (i = num; i; --i) disttable[distlen++] = odds - if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) // Battle Mode + if (G_BattleGametype()) // Battle Mode { UINT8 wantedpos; @@ -1143,7 +1167,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_lapanimation]) player->kartstuff[k_lapanimation]--; - if (gametype != GT_RACE && (player->exiting || player->kartstuff[k_comebacktimer])) + if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) { if (player->exiting) { @@ -1244,21 +1268,7 @@ void K_KartPlayerAfterThink(player_t *player) static void K_PlayTauntSound(mobj_t *source) { - switch (P_RandomFixed() % 4) - { - case 1: - S_StartSound(source, sfx_taunt1); - return; - case 2: - S_StartSound(source, sfx_taunt2); - return; - case 3: - S_StartSound(source, sfx_taunt3); - return; - case 4: - S_StartSound(source, sfx_taunt4); - return; - } + S_StartSound(source, sfx_taunt1+P_RandomKey(4)); } void K_MomentumToFacing(player_t *player) @@ -1356,7 +1366,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) break; } - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; k_speed += kartspeed*3; // 153 - 177 @@ -1373,7 +1383,7 @@ fixed_t K_GetKartAccel(player_t *player) fixed_t k_accel = 32; // 36; UINT8 kartspeed = player->kartspeed; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; //k_accel += 3 * (9 - kartspeed); // 36 - 60 @@ -1385,7 +1395,7 @@ fixed_t K_GetKartAccel(player_t *player) UINT16 K_GetKartFlashing(void) { UINT16 tics = flashingtics; - if (gametype != GT_RACE) + if (G_BattleGametype()) { tics *= 2; //tics += (3*TICRATE/8) * (player->kartspeed-1); @@ -1400,7 +1410,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove fixed_t p_speed = K_GetKartSpeed(player, true); fixed_t p_accel = K_GetKartAccel(player); - if (!onground && !player->kartstuff[k_pogospring]) return 0; // If the player isn't on the ground, there is no change in speed + if (!onground) return 0; // If the player isn't on the ground, there is no change in speed // ACCELCODE!!!1!11! oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale); @@ -1434,7 +1444,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; if (source && source != player->mo && source->player && !source->player->kartstuff[k_sounds]) @@ -1446,7 +1456,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) P_AddPlayerScore(source->player, 1); @@ -1498,13 +1508,13 @@ void K_SquishPlayer(player_t *player, mobj_t *source) if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) P_AddPlayerScore(source->player, 1); @@ -1542,16 +1552,16 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; - player->mo->momz = 18*FRACUNIT; + player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale); player->mo->momx = player->mo->momy = 0; player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) { @@ -1607,7 +1617,7 @@ void K_StealBalloon(player_t *player, player_t *victim, boolean force) fixed_t newx, newy; mobj_t *newmo; - if (gametype == GT_RACE) + if (!G_BattleGametype()) return; if (player->health <= 0 || victim->health <= 0) @@ -1781,11 +1791,10 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, source->y + P_RandomRange(-radius, radius)*FRACUNIT, - source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOSSEXPLODE); + source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE); truc->scale = source->scale*2; truc->destscale = source->scale*6; - P_SetMobjState(truc, S_SLOWBOOM1); - speed = FixedMul(12*FRACUNIT, source->scale)>>FRACBITS; + speed = FixedMul(10*FRACUNIT, source->scale)>>FRACBITS; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; speed = FixedMul(25*FRACUNIT, source->scale)>>FRACBITS; @@ -1906,6 +1915,11 @@ void K_SpawnDriftTrail(player_t *player) I_Assert(player->mo != NULL); I_Assert(!P_MobjWasRemoved(player->mo)); + if (!P_IsObjectOnGround(player->mo) + || player->kartstuff[k_hyudorotimer] != 0 + || (G_BattleGametype() && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])) + return; + if (player->mo->eflags & MFE_VERTICALFLIP) ground = player->mo->ceilingz - FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale); else @@ -1918,9 +1932,6 @@ void K_SpawnDriftTrail(player_t *player) for (i = 0; i < 2; i++) { - if (player->kartstuff[k_hyudorotimer] != 0 || (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])) - continue; - newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); #ifdef ESLOPE @@ -2087,9 +2098,9 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map INT32 HEIGHT; if (dir == 2) - HEIGHT = 40*FRACUNIT + player->mo->momz; + HEIGHT = 40*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz; else - HEIGHT = 30*FRACUNIT + player->mo->momz; + HEIGHT = 30*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz; mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED); mo->momy = player->mo->momy + FixedMul(FINESINE(fa), PROJSPEED); @@ -2173,8 +2184,8 @@ static void K_DoHyudoroSteal(player_t *player) && player != &players[i] && !players[i].exiting && !players[i].spectator // Player in-game // Can steal from this player - && ((gametype == GT_RACE && players[i].kartstuff[k_position] < player->kartstuff[k_position]) - || (gametype != GT_RACE && players[i].kartstuff[k_balloon] > 0)) + && ((G_RaceGametype() && players[i].kartstuff[k_position] < player->kartstuff[k_position]) + || (G_BattleGametype() && players[i].kartstuff[k_balloon] > 0)) // Has an item && (players[i].kartstuff[k_itemtype] @@ -2188,7 +2199,7 @@ static void K_DoHyudoroSteal(player_t *player) prandom = P_RandomFixed(); - if ((gametype == GT_RACE && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Get longer invisibility for nothing + if ((G_RaceGametype() && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Get longer invisibility for nothing { player->kartstuff[k_hyudorotimer] = hyudorotime; player->kartstuff[k_stealingtimer] = stealtime; @@ -2380,9 +2391,6 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) if (player->spectator) return turnvalue; - if (player->kartstuff[k_pogospring] && !P_IsObjectOnGround(player->mo)) - adjustangle /= 2; - if (player->kartstuff[k_drift] != 0 && P_IsObjectOnGround(player->mo)) { // If we're drifting we have a completely different turning value @@ -2411,7 +2419,7 @@ static void K_KartDrift(player_t *player, boolean onground) UINT8 kartspeed = player->kartspeed; fixed_t dsone, dstwo; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; // IF YOU CHANGE THESE: MAKE SURE YOU UPDATE THE SAME VALUES IN p_mobjc, "case MT_DRIFT:" @@ -2547,7 +2555,7 @@ static void K_KartUpdatePosition(player_t *player) if (!playeringame[i] || players[i].spectator || !players[i].mo) continue; - if (gametype == GT_RACE) + if (G_RaceGametype()) { if ((((players[i].starpostnum) + (numstarposts + 1) * players[i].laps) > ((player->starpostnum) + (numstarposts + 1) * player->laps))) @@ -2623,7 +2631,7 @@ static void K_KartUpdatePosition(player_t *player) } } } - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) { if (player->exiting) return; @@ -2691,7 +2699,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // Race Spectator if (netgame && player->jointime < 1 - && gametype == GT_RACE && countdown) + && G_RaceGametype() && countdown) { player->spectator = true; player->powers[pw_nocontrol] = 5; @@ -3079,7 +3087,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { K_PlayTauntSound(player->mo); K_DoPogoSpring(player->mo, 32<pflags |= PF_ATTACKDOWN; player->kartstuff[k_pogospring] = 1; player->kartstuff[k_itemamount]--; @@ -3115,7 +3122,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) /*if (player->kartstuff[k_growshrinktimer] > 1) player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale)*3/2;*/ - if ((gametype != GT_RACE) + if (G_BattleGametype() && (player->kartstuff[k_itemtype] == KITEM_INVINCIBILITY || player->kartstuff[k_itemtype] == KITEM_GROW || player->kartstuff[k_invincibilitytimer] @@ -3149,7 +3156,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->flags2 &= ~MF2_DONTDRAW; } - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb { K_StripItems(player); player->mo->flags2 |= MF2_SHADOW; @@ -3177,7 +3184,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else player->mo->tracer->flags2 &= ~MF2_DONTDRAW; } - else if (gametype == GT_RACE || player->kartstuff[k_balloon] > 0) + else if (G_RaceGametype() || player->kartstuff[k_balloon] > 0) { player->mo->flags2 &= ~MF2_SHADOW; if (player->mo->tracer && player->mo->tracer->state == &states[S_PLAYERBOMB]) @@ -3193,7 +3200,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->friction += 4608; if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) player->mo->friction += 1608; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) { player->mo->friction += 1228; @@ -3215,6 +3222,19 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_KartDrift(player, onground); + // Feather strafing + if (player->kartstuff[k_feather] & 2) + { + fixed_t strafe = 0; + fixed_t strength = FRACUNIT/32; + if (cmd->buttons & BT_DRIFTLEFT) + strafe--; + if (cmd->buttons & BT_DRIFTRIGHT) + strafe++; + strength += FixedDiv(player->speed, K_GetKartSpeed(player, true)); + P_Thrust(player->mo, player->mo->angle-ANGLE_90, strafe*strength); + } + // Quick Turning // You can't turn your kart when you're not moving. // So now it's time to burn some rubber! @@ -3285,7 +3305,7 @@ void K_CheckBalloons(void) if (!multiplayer) return; - if (gametype != GT_MATCH) + if (!G_BattleGametype()) return; if (gameaction == ga_completed) @@ -3314,7 +3334,7 @@ void K_CheckBalloons(void) if (playeringame[winnernum]) { P_AddPlayerScore(&players[winnernum], numingame); - CONS_Printf(M_GetText("%s recieved %d points for winning!\n"), player_names[winnernum], numingame); // numingame/2 == 1 ? "" : "s" + CONS_Printf(M_GetText("%s recieved %d points for winning!\n"), player_names[winnernum], numingame*2); } for (i = 0; i < MAXPLAYERS; i++) @@ -3447,7 +3467,7 @@ void K_LoadKartHUDGraphics(void) { for (j = 0; j < NUMPOSFRAMES; j++) { - if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th + //if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th sprintf(buffer, "K_POSN%d%d", i, j); kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } @@ -3896,19 +3916,19 @@ static void K_DrawKartPositionNum(INT32 num) switch (leveltime % 9) { case 1: case 2: case 3: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][4]; else localpatch = kp_positionnum[num % 10][1]; break; case 4: case 5: case 6: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][5]; else localpatch = kp_positionnum[num % 10][2]; break; case 7: case 8: case 9: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][6]; else localpatch = kp_positionnum[num % 10][3]; @@ -3987,7 +4007,7 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { V_DrawSmallTranslucentPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin]); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -3999,7 +4019,7 @@ static void K_drawKartPositionFaces(void) else { V_DrawSmallScaledPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin]); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4024,7 +4044,7 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { V_DrawSmallTranslucentMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin], colormap); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4036,7 +4056,7 @@ static void K_drawKartPositionFaces(void) else { V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin], colormap); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4059,14 +4079,14 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] <= 0) V_DrawSmallTranslucentPatch(FACE_X-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_ranknoballoons); else V_DrawSmallTranslucentPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, localpatch); } else { - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] <= 0) V_DrawSmallScaledPatch(FACE_X-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_ranknoballoons); else V_DrawSmallScaledPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, localpatch); @@ -4206,12 +4226,12 @@ static void K_drawKartPlayerCheck(void) for (i = 0; i < MAXPLAYERS; i++) { - if (&players[i] == stplyr) - continue; if (!playeringame[i] || players[i].spectator) continue; if (!players[i].mo) continue; + if (&players[i] == stplyr) + continue; if ((players[i].kartstuff[k_invincibilitytimer] <= 0) && (leveltime & 2)) pnum++; // white frames @@ -4400,7 +4420,8 @@ static void K_drawKartMinimap(void) splitflags &= ~V_HUDTRANSHALF; splitflags |= V_HUDTRANS; - K_drawKartMinimapHead(stplyr, x, y, splitflags, AutomapPic); + if (stplyr->mo && !stplyr->spectator) + K_drawKartMinimapHead(stplyr, x, y, splitflags, AutomapPic); } static void K_drawBattleFullscreen(void) @@ -4469,6 +4490,8 @@ static void K_drawBattleFullscreen(void) || stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) ty += (BASEVIDHEIGHT/2); } + else + V_DrawFadeScreen(); if (!comebackshowninfo) V_DrawFixedPatch(x<exiting || (stplyr->kartstuff[k_balloon] <= 0 && stplyr->kartstuff[k_comebacktimer] @@ -4652,7 +4675,7 @@ void K_drawKartHUD(void) if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode { - if (gametype == GT_RACE) // Race-only elements + if (G_RaceGametype()) // Race-only elements { // Draw the lap counter K_drawKartLaps(); @@ -4670,7 +4693,7 @@ void K_drawKartHUD(void) K_DrawKartPositionNum(stplyr->kartstuff[k_position]); } } - else if (gametype == GT_MATCH) // Battle-only + else if (G_BattleGametype()) // Battle-only { // Draw the hits left! K_drawKartBalloonsOrKarma(); diff --git a/src/k_kart.h b/src/k_kart.h index fad11a2c..bce8f9db 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -17,6 +17,7 @@ UINT8 K_GetKartColorByName(const char *name); void K_RegisterKartStuff(void); +boolean K_IsPlayerLosing(player_t *player); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_LakituChecker(player_t *player); void K_KartMoveAnimation(player_t *player); diff --git a/src/m_cheat.c b/src/m_cheat.c index 6ad31d5b..fed76edd 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -74,19 +74,32 @@ typedef struct static UINT8 cheatf_warp(void) { - if (modifiedgame) - return 0; + UINT8 i; + boolean success = false; + + /*if (modifiedgame) + return 0;*/ if (menuactive && currentMenu != &MainDef) return 0; // Only on the main menu! - S_StartSound(0, sfx_itemup); + // Temporarily unlock EVERYTHING. + for (i = 0; i < MAXUNLOCKABLES; i++) + { + if (!unlockables[i].conditionset) + continue; + if (!unlockables[i].unlocked) + { + unlockables[i].unlocked = true; + success = true; + } + } - // Temporarily unlock stuff. - G_SetGameModified(false); - unlockables[1].unlocked = true; // credits - unlockables[2].unlocked = true; // sound test - //unlockables[16].unlocked = true; // level select + if (success) + { + G_SetGameModified(false); + S_StartSound(0, sfx_kc42); + } // Refresh secrets menu existing. M_ClearMenus(true); @@ -111,7 +124,7 @@ static UINT8 cheatf_devmode(void) G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; - devparm = TRUE; + devparm = true; cv_debug |= 0x8000; // Refresh secrets menu existing. @@ -135,14 +148,19 @@ static UINT8 cheatf_devmode(void) static cheatseq_t cheat_warp = { 0, cheatf_warp, - { SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } + //{ SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } + { SCRAMBLE('b'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), 0xff } }; static cheatseq_t cheat_warp_joy = { 0, cheatf_warp, - { SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), + /*{ SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), + SCRAMBLE(KEY_ENTER), 0xff }*/ + { SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_RIGHTARROW), + SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_LEFTARROW), + SCRAMBLE(KEY_DOWNARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_ENTER), 0xff } }; diff --git a/src/m_cond.c b/src/m_cond.c index 2dfb502a..72932365 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -117,8 +117,6 @@ unlockable_t unlockables[MAXUNLOCKABLES] = /* 02 */ {"Chaotic Kart Cup", "Collect 15 Emblems", 0, 2, SECRET_NONE, 0, false, false, 0}, /* 03 */ {"Record Attack", "", 0, -1, SECRET_RECORDATTACK, 0, true, true, 0}, - /* 04 */ {"Play Credits", "", 10, -1, SECRET_CREDITS, 0, true, true, 0}, - /* 05 */ {"Sound Test", "", 20, -1, SECRET_SOUNDTEST, 0, true, true, 0}, }; // Default number of emblems and extra emblems diff --git a/src/m_menu.c b/src/m_menu.c index 9d988ddf..ac955bfa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -111,7 +111,7 @@ const char *quitmsg[NUM_QUITMESSAGES]; // Stuff for customizing the player select screen Tails 09-22-2003 description_t description[32] = { - {"\x82Sonic\x80\n\x82Speed:\x80 6\n\x82Weight:\x80 4", "", "sonic"}, + {"\x82Sonic\x80\n\x82Speed:\x80 7\n\x82Weight:\x80 3", "", "sonic"}, {"???", "", ""}, {"???", "", ""}, {"???", "", ""}, @@ -207,8 +207,8 @@ menu_t MessageDef; menu_t SPauseDef; // Sky Room -static void M_CustomLevelSelect(INT32 choice); -static void M_CustomWarp(INT32 choice); +//static void M_CustomLevelSelect(INT32 choice); +//static void M_CustomWarp(INT32 choice); FUNCNORETURN static ATTRNORETURN void M_UltimateCheat(INT32 choice); static void M_LoadGameLevelSelect(INT32 choice); static void M_GetAllEmeralds(INT32 choice); @@ -231,7 +231,7 @@ static void M_ConfirmSpectate(INT32 choice); static void M_ConfirmEnterGame(INT32 choice); static void M_ConfirmTeamScramble(INT32 choice); static void M_ConfirmTeamChange(INT32 choice); -static void M_SecretsMenu(INT32 choice); +//static void M_SecretsMenu(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, MP_MainDef, OP_MainDef; @@ -475,11 +475,11 @@ static consvar_t cv_dummystaff = {"dummystaff", "0", CV_HIDEN|CV_CALL, dummystaf // --------- static menuitem_t MainMenu[] = { - {IT_CALL |IT_STRING, NULL, "Secrets", M_SecretsMenu, 84}, - {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 92}, - {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 100}, - {IT_CALL |IT_STRING, NULL, "Options", M_Options, 108}, - {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, + {IT_SUBMENU|IT_STRING, NULL, "Extras", &SR_UnlockChecklistDef, 84}, + {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 92}, + {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 100}, + {IT_CALL |IT_STRING, NULL, "Options", M_Options, 108}, + {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, }; typedef enum @@ -688,7 +688,7 @@ static menuitem_t SR_LevelSelectMenu[] = static menuitem_t SR_UnlockChecklistMenu[] = { - {IT_SUBMENU | IT_STRING, NULL, "NEXT", &SR_MainDef, 192}, + {IT_SUBMENU | IT_STRING, NULL, "NEXT", &MainDef, 192}, }; static menuitem_t SR_EmblemHintMenu[] = @@ -1040,6 +1040,9 @@ static menuitem_t OP_MainMenu[] = {IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70}, {IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, + + {IT_CALL | IT_STRING, NULL, "Play Credits", M_Credits, 100}, + {IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110}, }; static menuitem_t OP_ControlsMenu[] = @@ -1191,47 +1194,51 @@ static menuitem_t OP_MiscControlsMenu[] = static menuitem_t OP_Joystick1Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup1PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis , 80}, + {IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup1PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis , 90}, }; static menuitem_t OP_Joystick2Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup2PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis2 , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis2 , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis2 , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis2 , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis2 , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis2 , 80}, + {IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup2PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90}, }; #ifndef NOFOURPLAYER static menuitem_t OP_Joystick3Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup3PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis3 , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis3 , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis3 , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis3 , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis3 , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis3 , 80}, + {IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup3PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis3 , 90}, }; static menuitem_t OP_Joystick4Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup4PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis4 , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis4 , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis4 , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis4 , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis4 , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis4 , 80}, + {IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup4PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90}, }; #endif @@ -1452,13 +1459,14 @@ static menuitem_t OP_ServerOptionsMenu[] = #endif {IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 80}, - {IT_STRING | IT_CVAR, NULL, "Advance to next map", &cv_advancemap, 90}, + {IT_STRING | IT_CVAR, NULL, "Voting Timer", &cv_votetime, 90}, + {IT_STRING | IT_CVAR, NULL, "Advance to next map", &cv_advancemap, 100}, #ifndef NONET - {IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 110}, - {IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 120}, - {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 130}, - {IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 140}, + {IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 120}, + {IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 130}, + {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 140}, + {IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 150}, #endif }; @@ -1574,7 +1582,7 @@ menu_t SR_UnlockChecklistDef = { NULL, 1, - &SR_MainDef, + &MainDef, //&SR_MainDef SR_UnlockChecklistMenu, M_DrawChecklist, 280, 185, @@ -1788,7 +1796,18 @@ menu_t MP_PlayerSetupDef = }; // Options -menu_t OP_MainDef = DEFAULTMENUSTYLE("M_OPTTTL", OP_MainMenu, &MainDef, 60, 30); +menu_t OP_MainDef = +{ + "M_OPTTTL", + sizeof (OP_MainMenu)/sizeof (menuitem_t), + &MainDef, + OP_MainMenu, + M_DrawSkyRoom, + 60, 30, + 0, + NULL +}; + menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); //menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDef); @@ -2691,7 +2710,7 @@ void M_StartControlPanel(void) if (!Playing()) { // Secret menu! - MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + //MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); currentMenu = &MainDef; itemOn = singleplr; @@ -4144,6 +4163,8 @@ static void M_Options(INT32 choice) // if the player is playing _at all_, disable the erase data options OP_DataOptionsMenu[1].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); + // SRB2Kart: Same with the "Play Credits" option + OP_MainMenu[6].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL); OP_MainDef.prevMenu = currentMenu; M_SetupNextMenu(&OP_MainDef); @@ -4402,7 +4423,7 @@ static void M_HandleSoundTest(INT32 choice) } // Entering secrets menu -static void M_SecretsMenu(INT32 choice) +/*static void M_SecretsMenu(INT32 choice) { INT32 i, j, ul; UINT8 done[MAXUNLOCKABLES]; @@ -4477,7 +4498,7 @@ static void M_SecretsMenu(INT32 choice) } M_SetupNextMenu(&SR_MainDef); -} +}*/ // ================== // NEW GAME FUNCTIONS @@ -4495,14 +4516,14 @@ static void M_NewGame(void) M_SetupChoosePlayer(0); } -static void M_CustomWarp(INT32 choice) +/*static void M_CustomWarp(INT32 choice) { INT32 ul = skyRoomMenuTranslations[choice-1]; startmap = (INT16)(unlockables[ul].variable); M_SetupChoosePlayer(0); -} +}*/ static void M_Credits(INT32 choice) { @@ -4512,7 +4533,7 @@ static void M_Credits(INT32 choice) F_StartCredits(); } -static void M_CustomLevelSelect(INT32 choice) +/*static void M_CustomLevelSelect(INT32 choice) { INT32 ul = skyRoomMenuTranslations[choice-1]; @@ -4527,7 +4548,7 @@ static void M_CustomLevelSelect(INT32 choice) M_PrepareLevelSelect(); M_SetupNextMenu(&SR_LevelSelectDef); -} +}*/ // ================== // SINGLE PLAYER MENU diff --git a/src/m_misc.c b/src/m_misc.c index 74ba8b31..0d0be0f6 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -546,7 +546,7 @@ void M_SaveConfig(const char *filename) #if NUMSCREENS > 2 static const char *Newsnapshotfile(const char *pathname, const char *ext) { - static char freename[13] = "srb2XXXX.ext"; + static char freename[13] = "kartXXXX.ext"; int i = 5000; // start in the middle: num screenshots divided by 2 int add = i; // how much to add or subtract if wrong; gets divided by 2 each time int result; // -1 = guess too high, 0 = correct, 1 = guess too low @@ -1390,7 +1390,7 @@ void M_ScreenShot(void) } /** Takes a screenshot. - * The screenshot is saved as "srb2xxxx.pcx" (or "srb2xxxx.tga" in hardware + * The screenshot is saved as "kartxxxx.pcx" (or "kartxxxx.tga" in hardware * rendermode) where xxxx is the lowest four-digit number for which a file * does not already exist. * diff --git a/src/p_enemy.c b/src/p_enemy.c index fca6bf1c..3777e09e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3928,7 +3928,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) return true; if (thing->player && (thing->player->kartstuff[k_hyudorotimer] - || (gametype == GT_MATCH && thing->player && thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer]))) + || (G_BattleGametype() && thing->player && thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer]))) return true; if ((gametype == GT_CTF || gametype == GT_TEAMMATCH) @@ -8145,7 +8145,7 @@ void A_ItemPop(mobj_t *actor) remains->flags2 &= ~MF2_AMBUSH; - if (gametype != GT_RACE) + if (G_BattleGametype()) numgotboxes++; P_RemoveMobj(actor); @@ -8215,14 +8215,14 @@ void A_JawzChase(mobj_t *actor) && actor->target->player->ctfteam == player->ctfteam) continue; - if (gametype == GT_RACE) // Only in races, in match and CTF you should go after any nearby players + if (G_RaceGametype()) // Only in races, in match and CTF you should go after any nearby players { // USER TARGET if (actor->target->player->kartstuff[k_position] != (player->kartstuff[k_position] + 1)) // Jawz only go after the person directly ahead of you -Sryder continue; } - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (player->kartstuff[k_balloon] <= 0) continue; @@ -8233,7 +8233,7 @@ void A_JawzChase(mobj_t *actor) } } - if ((gametype == GT_RACE) || (gametype != GT_RACE // If in match etc. only home in when you get close enough, in race etc. home in all the time + if ((G_RaceGametype()) || (G_BattleGametype() // If in match etc. only home in when you get close enough, in race etc. home in all the time && P_AproxDistance(P_AproxDistance(player->mo->x-actor->x, player->mo->y-actor->y), player->mo->z-actor->z) < RING_DIST && player->kartstuff[k_balloon] > 0)) @@ -8244,7 +8244,7 @@ void A_JawzChase(mobj_t *actor) // done looking if (actor->lastlook == stop) { - if (gametype == GT_RACE) + if (G_RaceGametype()) actor->lastlook = -2; return; } @@ -8291,7 +8291,7 @@ void A_MineExplode(mobj_t *actor) if (mo2 == actor || mo2->type == MT_MINEEXPLOSIONSOUND) // Don't explode yourself! Endless loop! continue; - if (gametype == GT_MATCH && actor->target && actor->target->player && actor->target->player->kartstuff[k_balloon] <= 0 && mo2 == actor->target) + if (G_BattleGametype() && actor->target && actor->target->player && actor->target->player->kartstuff[k_balloon] <= 0 && mo2 == actor->target) continue; if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > actor->info->painchance) diff --git a/src/p_inter.c b/src/p_inter.c index 1a687d1f..267c437c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -158,7 +158,7 @@ boolean P_CanPickupItem(player_t *player, boolean weapon) //if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] <= flashingtics) // return false; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // No balloons in Match + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // No balloons in Match return false; if (player->kartstuff[k_attractiontimer]) // You should probably collect stuff when you're attracting it :V @@ -411,7 +411,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { case MT_RANDOMITEM: // SRB2kart case MT_FLINGRANDOMITEM: - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) { if (player->kartstuff[k_comebackmode] == 0 && !player->kartstuff[k_comebacktimer]) { @@ -426,7 +426,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!P_CanPickupItem(player, false) && special->tracer != toucher) return; - if (gametype != GT_RACE && special->tracer && special->tracer->player) + if (G_BattleGametype() && special->tracer && special->tracer->player) { special->tracer->player->kartstuff[k_comebackmode] = 0; @@ -1998,7 +1998,7 @@ boolean P_CheckRacers(void) // Check if all the players in the race have finished. If so, end the level. for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !players[i].exiting && players[i].lives > 0) + if (playeringame[i] && !players[i].spectator && !players[i].exiting && players[i].lives > 0) break; } @@ -2270,7 +2270,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } } } - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) { K_CheckBalloons(); } @@ -2552,7 +2552,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source) player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT? player->flyangle %= 360; - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) player->drillmeter -= 5*20; else { @@ -2726,7 +2726,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG|PF_NIGHTSMODE); // Burst weapons and emeralds in Match/CTF only - if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) + if (source && (G_BattleGametype())) { P_PlayerRingBurst(player, player->health - 1); P_PlayerEmeraldBurst(player, false); @@ -2770,7 +2770,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); }*/ - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (player->kartstuff[k_balloon] > 0) { @@ -3167,7 +3167,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da // Sudden-Death mode if (source && source->type == MT_PLAYER) { - if ((gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) && cv_suddendeath.value + if ((G_BattleGametype()) && cv_suddendeath.value && !player->powers[pw_flashing] && !player->powers[pw_invulnerability]) damage = 10000; } diff --git a/src/p_map.c b/src/p_map.c index 8e8af278..6fd333aa 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -383,7 +383,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) || (gametype == GT_MATCH) || (G_GametypeHasTeams() && tails->ctfteam != sonic->ctfteam)) sonic->pflags &= ~PF_CARRIED; */ - if (tails->spectator || sonic->spectator || gametype == GT_RACE) // SRB2kart + if (tails->spectator || sonic->spectator || G_RaceGametype()) // SRB2kart sonic->pflags &= ~PF_CARRIED; else { @@ -1633,18 +1633,18 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player->kartstuff[k_growshrinktimer] || thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_hyudorotimer] || thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_invincibilitytimer] || thing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (thing->player->kartstuff[k_balloon] <= 0 + || (G_BattleGametype() && (thing->player->kartstuff[k_balloon] <= 0 && (thing->player->kartstuff[k_comebacktimer] || thing->player->kartstuff[k_comebackmode] == 1))) || tmthing->player->kartstuff[k_growshrinktimer] || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_hyudorotimer] || tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_invincibilitytimer] || tmthing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (tmthing->player->kartstuff[k_balloon] <= 0 + || (G_BattleGametype() && (tmthing->player->kartstuff[k_balloon] <= 0 && (tmthing->player->kartstuff[k_comebacktimer] || tmthing->player->kartstuff[k_comebackmode] == 1)))) { return true; } - if (gametype != GT_RACE) + if (G_BattleGametype()) { if ((thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebackmode] == 0) || (tmthing->player->kartstuff[k_balloon] <= 0 && tmthing->player->kartstuff[k_comebackmode] == 0)) @@ -1667,7 +1667,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (P_IsObjectOnGround(thing) && tmthing->momz < 0) { K_KartBouncing(tmthing, thing, true, false); - if (gametype != GT_RACE && tmthing->player->kartstuff[k_pogospring]) + if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring]) { K_StealBalloon(tmthing->player, thing->player, false); K_SpinPlayer(thing->player, tmthing); @@ -1676,7 +1676,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) { K_KartBouncing(thing, tmthing, true, false); - if (gametype != GT_RACE && thing->player->kartstuff[k_pogospring]) + if (G_BattleGametype() && thing->player->kartstuff[k_pogospring]) { K_StealBalloon(thing->player, tmthing->player, false); K_SpinPlayer(tmthing->player, thing); @@ -1685,7 +1685,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else K_KartBouncing(tmthing, thing, false, false); - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer])) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 288c7855..9985bded 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3039,11 +3039,22 @@ static boolean P_SceneryZMovement(mobj_t *mo) switch (mo->type) { + case MT_BOOMEXPLODE: case MT_BOOMPARTICLE: if ((mo->flags & MF_BOUNCE) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) { + // set standingslope + P_TryMove(mo, mo->x, mo->y, true); mo->momz = -mo->momz; - mo->z += mo->momz; +#ifdef ESLOPE + if (mo->standingslope) + { + if (mo->flags & MF_NOCLIPHEIGHT) + mo->standingslope = NULL; + else if (!P_IsObjectOnGround(mo)) + P_SlopeLaunch(mo); + } +#endif S_StartSound(mo, mo->info->activesound); } break; @@ -6518,7 +6529,7 @@ void P_MobjThinker(mobj_t *mobj) INT32 HEIGHT; fixed_t radius; - if (gametype != GT_RACE && mobj->target->player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && mobj->target->player->kartstuff[k_balloon] <= 0) kartspeed = 1; dsone = 26*4 + kartspeed*2 + (9 - mobj->target->player->kartweight); @@ -6821,7 +6832,7 @@ void P_MobjThinker(mobj_t *mobj) fixed_t scale = mobj->target->scale; mobj->color = mobj->target->color; - if (!netgame || gametype == GT_RACE + if (!netgame || G_RaceGametype() || mobj->target->player == &players[displayplayer] || mobj->target->player->kartstuff[k_balloon] <= 0 || (mobj->target->player->mo->flags2 & MF2_DONTDRAW)) @@ -7103,7 +7114,7 @@ void P_MobjThinker(mobj_t *mobj) { x = mobj->target->x; y = mobj->target->y; - z = mobj->target->z + 80*FRACUNIT; + z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale); } P_TeleportMove(mobj, x, y, z); break; @@ -7820,10 +7831,12 @@ void P_MobjThinker(mobj_t *mobj) { finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); } + finalspeed = FixedMul(finalspeed, mapheaderinfo[gamemap-1]->mobj_scale); P_InstaThrust(mobj, mobj->angle, finalspeed); } else { + finalspeed = FixedMul(finalspeed, mapheaderinfo[gamemap-1]->mobj_scale); P_InstaThrust(mobj, mobj->angle, finalspeed); } @@ -7865,7 +7878,10 @@ void P_MobjThinker(mobj_t *mobj) distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4); } - if (gametype == GT_RACE && mobj->tracer) + distbarrier = FixedMul(distbarrier, mapheaderinfo[gamemap-1]->mobj_scale); + topspeed = FixedMul(topspeed, mapheaderinfo[gamemap-1]->mobj_scale); + + if (G_RaceGametype() && mobj->tracer) { distaway = P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y); if (distaway < distbarrier) @@ -7878,7 +7894,7 @@ void P_MobjThinker(mobj_t *mobj) } } - if (gametype != GT_RACE) + if (G_BattleGametype()) { mobj->friction -= 1228; if (mobj->friction > FRACUNIT) @@ -9343,7 +9359,7 @@ void P_RespawnSpecials(void) mobj_t *mo = NULL; mapthing_t *mthing = NULL; - if (gametype != GT_RACE) // Battle Mode vers + if (G_BattleGametype()) // Battle Mode vers { P_RespawnBattleSpecials(); return; @@ -9633,7 +9649,7 @@ void P_SpawnPlayer(INT32 playernum) overheadarrow->flags2 |= MF2_DONTDRAW; P_SetScale(overheadarrow, mobj->destscale); - if (gametype != GT_RACE) + if (G_BattleGametype()) { /*INT32 i; INT32 pcount = 0; @@ -10038,7 +10054,7 @@ void P_SpawnMapThing(mapthing_t *mthing) if (!cv_powerstones.value) return; - if (!(gametype == GT_MATCH || gametype == GT_CTF)) + if (!G_BattleGametype()) return; runemeraldmanager = true; diff --git a/src/p_setup.c b/src/p_setup.c index cc707baf..7f722548 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2871,7 +2871,7 @@ boolean P_SetupLevel(boolean skipprecip) CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n")); } - else if (gametype == GT_RACE && server && cv_usemapnumlaps.value) + else if (G_RaceGametype() && server && cv_usemapnumlaps.value) CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); // =========== @@ -2978,12 +2978,12 @@ boolean P_SetupLevel(boolean skipprecip) // SRB2Kart: map load variables if (modeattacking) gamespeed = 2; - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) gamespeed = 0; else gamespeed = cv_kartspeed.value; - if (gametype == GT_MATCH) + if (G_BattleGametype()) mirrormode = false; else mirrormode = cv_kartmirror.value; diff --git a/src/p_spec.c b/src/p_spec.c index 592e9b79..7e79291f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4133,10 +4133,10 @@ DoneSection2: case 10: // Finish Line // SRB2kart - 150117 - if (gametype == GT_RACE && (player->starpostcount >= numstarposts/2 || player->exiting)) + if (G_RaceGametype() && (player->starpostcount >= numstarposts/2 || player->exiting)) player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0; // - if (gametype == GT_RACE && !player->exiting) + if (G_RaceGametype() && !player->exiting) { if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { @@ -4204,13 +4204,13 @@ DoneSection2: { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); - else if (player->kartstuff[k_position] == 2 || player->kartstuff[k_position] == 3) - S_ChangeMusicInternal("karok", true); - else if (player->kartstuff[k_position] >= 4) + else if (K_IsPlayerLosing(player)) S_ChangeMusicInternal("karlos", true); + else + S_ChangeMusicInternal("karok", true); } else - S_ChangeMusicInternal("karwin", true); + S_ChangeMusicInternal("karok", true); // //HU_SetCEchoFlags(0); //HU_SetCEchoDuration(5); @@ -5617,7 +5617,7 @@ void P_SpawnSpecials(INT32 fromnetsave) switch(GETSECSPECIAL(sector->special, 4)) { case 10: // Circuit finish line - if (gametype == GT_RACE) + if (G_RaceGametype()) circuitmap = true; break; } @@ -6378,7 +6378,7 @@ void P_SpawnSpecials(INT32 fromnetsave) break; case 308: // Race-only linedef executor. Triggers once. - if (gametype != GT_RACE && gametype != GT_COMPETITION) + if (!G_RaceGametype()) lines[i].special = 0; break; diff --git a/src/p_user.c b/src/p_user.c index 86624bef..b990f072 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -350,7 +350,7 @@ UINT8 P_FindLowestMare(void) mobj_t *mo2; UINT8 mare = UINT8_MAX; - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) return 0; // scan the thinkers @@ -685,7 +685,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) P_RestoreMusic(player); P_SetMobjState(player->mo->tracer, S_SUPERTRANS1); - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) { if (player->drillmeter < 48*20) player->drillmeter = 48*20; @@ -1653,7 +1653,7 @@ void P_DoPlayerExit(player_t *player) && (!player->spectator && ((!modifiedgame || savemoddata) && !demoplayback))) legitimateexit = true; - if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow + if (G_RaceGametype()) // If in Race Mode, allow { // SRB2kart 120217 if (!countdown && !(netgame || multiplayer)) @@ -1676,13 +1676,13 @@ void P_DoPlayerExit(player_t *player) { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); - else if (player->kartstuff[k_position] == 2 || player->kartstuff[k_position] == 3) - S_ChangeMusicInternal("karok", true); - else if (player->kartstuff[k_position] >= 4) + else if (K_IsPlayerLosing(player)) S_ChangeMusicInternal("karlos", true); + else + S_ChangeMusicInternal("karok", true); } else - S_ChangeMusicInternal("karwin", true); + S_ChangeMusicInternal("karok", true); } player->exiting = 3*TICRATE; @@ -1696,7 +1696,7 @@ void P_DoPlayerExit(player_t *player) if (P_CheckRacers()) player->exiting = (14*TICRATE)/5 + 1; } - else if (gametype != GT_RACE) + else if (G_BattleGametype()) player->exiting = 8*TICRATE + 1; // Battle Mode exiting else player->exiting = (14*TICRATE)/5 + 2; // Accidental death safeguard??? @@ -5794,7 +5794,7 @@ static void P_NiGHTSMovement(player_t *player) && !player->exiting) player->nightstime--; } - else if (gametype != GT_RACE && gametype != GT_COMPETITION + else if (!G_RaceGametype() && !(player->mo->tracer->state >= &states[S_SUPERTRANS1] && player->mo->tracer->state <= &states[S_SUPERTRANS9]) && !(player->capsule && player->capsule->reactiontime) && !player->exiting) @@ -5947,7 +5947,7 @@ static void P_NiGHTSMovement(player_t *player) { player->mo->momx = player->mo->momy = 0; - if (gametype != GT_RACE && gametype != GT_COMPETITION) + if (!G_RaceGametype()) P_SetObjectMomZ(player->mo, 30*FRACUNIT, false); player->mo->tracer->angle += ANGLE_11hh; @@ -8110,7 +8110,7 @@ static void P_DeathThink(player_t *player) } } - if ((gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0)) + if ((G_RaceGametype() || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0)) { // Return to level music if (netgame) @@ -9250,7 +9250,7 @@ void P_PlayerThink(player_t *player) I_Error("player %s is in PST_REBORN\n", sizeu1(playeri)); #endif - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) { INT32 i; @@ -9303,7 +9303,7 @@ void P_PlayerThink(player_t *player) // If it is set, start subtracting // Don't allow it to go back to 0 - if (player->exiting > 1 && (player->exiting < 3*TICRATE || gametype != GT_RACE)) // SRB2kart - "&& player->exiting > 1" + if (player->exiting > 1 && (player->exiting < 3*TICRATE || !G_RaceGametype())) // SRB2kart - "&& player->exiting > 1" player->exiting--; if (player->exiting && countdown2) @@ -9666,7 +9666,7 @@ void P_PlayerThink(player_t *player) || (splitscreen > 1 && player == &players[thirddisplayplayer]) || (splitscreen > 2 && player == &players[fourthdisplayplayer])) && player->kartstuff[k_hyudorotimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0 - && (player->kartstuff[k_comebacktimer] == 0 || (gametype == GT_RACE || player->kartstuff[k_balloon] > 0))) + && (player->kartstuff[k_comebacktimer] == 0 || (G_RaceGametype() || player->kartstuff[k_balloon] > 0))) { if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing() && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW; diff --git a/src/r_local.h b/src/r_local.h index a3dfe7df..ae70cd8a 100644 --- a/src/r_local.h +++ b/src/r_local.h @@ -8,34 +8,177 @@ // terms of the GNU General Public License, version 2. // See the 'LICENSE' file for more details. //----------------------------------------------------------------------------- -/// \file r_local.h -/// \brief Refresh (R_*) module, global header. All the rendering/drawing stuff is here +/// \file r_draw.h +/// \brief Low-level span/column drawer functions -#ifndef __R_LOCAL__ -#define __R_LOCAL__ +#ifndef __R_DRAW__ +#define __R_DRAW__ -// Screen size related parameters. -#include "doomdef.h" +#include "r_defs.h" -// Binary Angles, sine/cosine/atan lookups. -#include "tables.h" +// ------------------------------- +// COMMON STUFF FOR 8bpp AND 16bpp +// ------------------------------- +extern UINT8 *ylookup[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup1[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup2[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup3[MAXVIDHEIGHT*4]; +extern UINT8 *ylookup4[MAXVIDHEIGHT*4]; +extern INT32 columnofs[MAXVIDWIDTH*4]; +extern UINT8 *topleft; -// this one holds the max vid sizes and standard aspect -#include "screen.h" +// ------------------------- +// COLUMN DRAWING CODE STUFF +// ------------------------- -#include "m_bbox.h" +extern lighttable_t *dc_colormap; +extern INT32 dc_x, dc_yl, dc_yh; +extern fixed_t dc_iscale, dc_texturemid; +extern UINT8 dc_hires; -#include "r_main.h" -#include "r_bsp.h" -#include "r_segs.h" -#include "r_plane.h" -#include "r_sky.h" -#include "r_data.h" -#include "r_things.h" -#include "r_draw.h" +extern UINT8 *dc_source; // first pixel in a column -extern drawseg_t *firstseg; +// translucency stuff here +extern UINT8 *transtables; // translucency tables, should be (*transtables)[5][256][256] +extern UINT8 *dc_transmap; -void SplitScreen_OnChange(void); +// translation stuff here -#endif // __R_LOCAL__ +extern UINT8 *dc_translation; + +extern struct r_lightlist_s *dc_lightlist; +extern INT32 dc_numlights, dc_maxlights; + +//Fix TUTIFRUTI +extern INT32 dc_texheight; + +// ----------------------- +// SPAN DRAWING CODE STUFF +// ----------------------- + +extern INT32 ds_y, ds_x1, ds_x2; +extern lighttable_t *ds_colormap; +extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep; +extern UINT8 *ds_source; // start of a 64*64 tile image +extern UINT8 *ds_transmap; + +#ifdef ESLOPE +typedef struct { + float x, y, z; +} floatv3_t; + +extern pslope_t *ds_slope; // Current slope being used +extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +extern float focallengthf, zeroheight; +#endif + +// Variable flat sizes +extern UINT32 nflatxshift; +extern UINT32 nflatyshift; +extern UINT32 nflatshiftup; +extern UINT32 nflatmask; + +/// \brief Top border +#define BRDR_T 0 +/// \brief Bottom border +#define BRDR_B 1 +/// \brief Left border +#define BRDR_L 2 +/// \brief Right border +#define BRDR_R 3 +/// \brief Topleft border +#define BRDR_TL 4 +/// \brief Topright border +#define BRDR_TR 5 +/// \brief Bottomleft border +#define BRDR_BL 6 +/// \brief Bottomright border +#define BRDR_BR 7 + +extern lumpnum_t viewborderlump[8]; + +// ------------------------------------------------ +// r_draw.c COMMON ROUTINES FOR BOTH 8bpp and 16bpp +// ------------------------------------------------ + +#define GTC_CACHE 1 + +#define TC_DEFAULT -1 +#define TC_BOSS -2 +#define TC_METALSONIC -3 // For Metal Sonic battle +#define TC_ALLWHITE -4 // For Cy-Brak-demon +#define TC_STARMAN -5 // For star power + +// Initialize color translation tables, for player rendering etc. +void R_InitTranslationTables(void); +UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags); +void R_FlushTranslationColormapCache(void); +UINT8 R_GetColorByName(const char *name); + +// Custom player skin translation +void R_InitViewBuffer(INT32 width, INT32 height); +void R_InitViewBorder(void); +void R_VideoErase(size_t ofs, INT32 count); + +// Rendering function. +#if 0 +void R_FillBackScreen(void); + +// If the view size is not full screen, draws a border around it. +void R_DrawViewBorder(void); +#endif + +// ----------------- +// 8bpp DRAWING CODE +// ----------------- + +void R_DrawColumn_8(void); +#define R_DrawWallColumn_8 R_DrawColumn_8 +void R_DrawShadeColumn_8(void); +void R_DrawTranslucentColumn_8(void); + +#ifdef USEASM +void ASMCALL R_DrawColumn_8_ASM(void); +#define R_DrawWallColumn_8_ASM R_DrawColumn_8_ASM +void ASMCALL R_DrawShadeColumn_8_ASM(void); +void ASMCALL R_DrawTranslucentColumn_8_ASM(void); +void ASMCALL R_Draw2sMultiPatchColumn_8_ASM(void); + +void ASMCALL R_DrawColumn_8_MMX(void); +#define R_DrawWallColumn_8_MMX R_DrawColumn_8_MMX + +void ASMCALL R_Draw2sMultiPatchColumn_8_MMX(void); +void ASMCALL R_DrawSpan_8_MMX(void); +#endif + +void R_DrawTranslatedColumn_8(void); +void R_DrawTranslatedTranslucentColumn_8(void); +void R_DrawSpan_8(void); +#ifdef ESLOPE +void R_CalcTiltedLighting(fixed_t start, fixed_t end); +void R_DrawTiltedSpan_8(void); +void R_DrawTiltedTranslucentSpan_8(void); +void R_DrawTiltedSplat_8(void); +#endif +void R_DrawSplat_8(void); +void R_DrawTranslucentSplat_8(void); +void R_DrawTranslucentSpan_8(void); +void R_Draw2sMultiPatchColumn_8(void); +void R_DrawFogSpan_8(void); +void R_DrawFogColumn_8(void); +void R_DrawColumnShadowed_8(void); + +// ------------------ +// 16bpp DRAWING CODE +// ------------------ + +#ifdef HIGHCOLOR +void R_DrawColumn_16(void); +void R_DrawWallColumn_16(void); +void R_DrawTranslucentColumn_16(void); +void R_DrawTranslatedColumn_16(void); +void R_DrawSpan_16(void); +#endif + +// ========================================================================= +#endif // __R_DRAW__ diff --git a/src/r_segs.c b/src/r_segs.c index 502ff330..b997c2a8 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -743,6 +743,12 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // Render FOF sides kinda like normal sides, with the frac and step and everything // NOTE: INT64 instead of fixed_t because overflow concerns INT64 top_frac, top_step, bottom_frac, bottom_step; + // skew FOF walls with slopes? + boolean slopeskew = false; + fixed_t ffloortextureslide = 0; + INT32 oldx = -1; + fixed_t left_top, left_bottom; // needed here for slope skewing + pslope_t *skewslope = NULL; #endif void (*colfunc_2s) (column_t *); @@ -966,21 +972,71 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) mceilingclip = ds->sprtopclip; dc_texheight = textureheight[texnum]>>FRACBITS; +#ifdef ESLOPE + // calculate both left ends + if (*pfloor->t_slope) + left_top = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y) - viewz; + else + left_top = *pfloor->topheight - viewz; + + if (*pfloor->b_slope) + left_bottom = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y) - viewz; + else + left_bottom = *pfloor->bottomheight - viewz; + skewslope = *pfloor->t_slope; // skew using top slope by default + if (newline) + { + if (newline->flags & ML_DONTPEGTOP) + slopeskew = true; + } + else if (pfloor->master->flags & ML_DONTPEGTOP) + slopeskew = true; + + if (slopeskew) + dc_texturemid = left_top; + else +#endif dc_texturemid = *pfloor->topheight - viewz; if (newline) { offsetvalue = sides[newline->sidenum[0]].rowoffset; if (newline->flags & ML_DONTPEGBOTTOM) + { +#ifdef ESLOPE + skewslope = *pfloor->b_slope; // skew using bottom slope + if (slopeskew) + dc_texturemid = left_bottom; + else +#endif offsetvalue -= *pfloor->topheight - *pfloor->bottomheight; + } } else { offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset; if (curline->linedef->flags & ML_DONTPEGBOTTOM) + { +#ifdef ESLOPE + skewslope = *pfloor->b_slope; // skew using bottom slope + if (slopeskew) + dc_texturemid = left_bottom; + else +#endif offsetvalue -= *pfloor->topheight - *pfloor->bottomheight; + } } +#ifdef ESLOPE + if (slopeskew) + { + angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y); + + if (skewslope) + ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT)); + } +#endif + dc_texturemid += offsetvalue; // Texture must be cached before setting colfunc_2s, @@ -999,23 +1055,18 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) #ifdef ESLOPE // Set heights according to plane, or slope, whichever { - fixed_t left_top, right_top, left_bottom, right_bottom; + fixed_t right_top, right_bottom; + // calculate right ends now if (*pfloor->t_slope) - { - left_top = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y) - viewz; right_top = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y) - viewz; - } else - left_top = right_top = *pfloor->topheight - viewz; + right_top = *pfloor->topheight - viewz; if (*pfloor->b_slope) - { - left_bottom = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y) - viewz; right_bottom = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y) - viewz; - } else - left_bottom = right_bottom = *pfloor->bottomheight - viewz; + right_bottom = *pfloor->bottomheight - viewz; // using INT64 to avoid 32bit overflow top_frac = (INT64)centeryfrac - (((INT64)left_top * ds->scale1) >> FRACBITS); @@ -1039,6 +1090,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) { if (maskedtexturecol[dc_x] != INT16_MAX) { +#ifdef ESLOPE + if (ffloortextureslide) { // skew FOF walls + if (oldx != -1) + dc_texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc_x])<prefcolor = SKINCOLOR_GREEN; // SRB2kart - skin->kartspeed = 6; - skin->kartweight = 4; + skin->kartspeed = 5; + skin->kartweight = 5; // skin->normalspeed = 36<ability = CA_THOK; skin->actionspd = 60<kartspeed = 7; + skin->kartweight = 3; + // + skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; diff --git a/src/s_sound.c b/src/s_sound.c index 27a54d2a..513415d1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -391,7 +391,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) { INT32 sep, pitch, priority, cnum; sfxinfo_t *sfx; - + const boolean reverse = (stereoreverse.value ^ mirrormode); const mobj_t *origin = (const mobj_t *)origin_p; listener_t listener = {0,0,0,0}; @@ -572,14 +572,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -627,14 +626,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -682,14 +680,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -732,14 +729,13 @@ dontplay: if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -1212,6 +1208,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v listener_t listensource; + const boolean reverse = (stereoreverse.value ^ mirrormode); + (void)pitch; if (!listener) return false; @@ -1309,6 +1307,9 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v else angle = angle + InvAngle(listensource.angle); + if (reverse) + angle = InvAngle(angle); + #ifdef SURROUND // Produce a surround sound for angle from 105 till 255 if (surround.value == 1 && (angle > ANG105 && angle < ANG255 )) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index d0368dd7..41a9d7cd 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -103,6 +103,10 @@ static inline VOID MakeCodeWritable(VOID) \return int */ +#if defined (__GNUC__) && (__GNUC__ >= 4) +#pragma GCC diagnostic ignored "-Wmissing-noreturn" +#endif + #ifdef FORCESDLMAIN int SDL_main(int argc, char **argv) #else diff --git a/src/sounds.c b/src/sounds.c index bcfdbf93..2de9d1f4 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -470,9 +470,9 @@ sfxinfo_t S_sfx[NUMSFX] = {"lkt1", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"lkt2", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"lkt3", true, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart1", false, 48, 16, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart2", false, 48, 16, -1, NULL, 0, -1, -1, LUMPERROR}, - {"kart3", false, 48, 16, -1, NULL, 0, -1, -1, LUMPERROR}, + {"kart1", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"kart2", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"kart3", false, 48, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mlap", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"sboost", true, 90, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mush", false, 90, 0, -1, NULL, 0, -1, -1, LUMPERROR}, @@ -574,7 +574,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"kc6c", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"kc6d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"kc6e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - + // SRB2kart - Skin sounds {"kwin", false, 64, 0, -1, NULL, 0, SKSWIN, -1, LUMPERROR}, {"klose", false, 64, 0, -1, NULL, 0, SKSLOSE, -1, LUMPERROR}, diff --git a/src/y_inter.c b/src/y_inter.c index 80a22bb8..d3723f9e 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -177,7 +177,7 @@ typedef struct typedef struct { - INT8 selection; + SINT8 selection; UINT8 delay; UINT8 ranim; UINT8 rtics; @@ -1351,7 +1351,7 @@ void Y_StartIntermission(void) { // setup time data data.coop.tics = players[consoleplayer].realtime; - + // Update visitation flags mapvisited[gamemap-1] |= MV_BEATEN; if (ALL7EMERALDS(emeralds)) @@ -1364,7 +1364,7 @@ void Y_StartIntermission(void) if (modeattacking == ATTACKING_RECORD) Y_UpdateRecordReplays(); } - + // Calculate who won Y_CalculateTournamentPoints(); @@ -2188,11 +2188,14 @@ void Y_VoteDrawer(void) } x = 20; - y = 15; + y = 10; for (i = 0; i < MAXPLAYERS; i++) { - if (votes[i] != -1) + if (dedicated && i == 0) // While leaving blank spots for non-existent players is largely intentional, the first spot *always* being blank looks a tad silly :V + continue; + + if ((playeringame[i] && !players[i].spectator) && votes[i] != -1) { patch_t *pic; @@ -2226,15 +2229,13 @@ void Y_VoteDrawer(void) y += 30; - if (y > BASEVIDHEIGHT-38) + if (y > BASEVIDHEIGHT-40) { - x += 100; - y = 15; + x += 60; + y = 10; } } - //V_DrawScaledPatch(x, y, V_SNAPTOBOTTOM, pic); - if (timer) V_DrawCenteredString(BASEVIDWIDTH/2, 188, V_YELLOWMAP|V_SNAPTOBOTTOM, va("Vote ends in %d seconds", timer/TICRATE)); @@ -2265,12 +2266,12 @@ void Y_VoteTicker(void) for (i = 0; i < MAXPLAYERS; i++) // Correct votes as early as possible, before they're processed by the game at all { if (!playeringame[i] || players[i].spectator) - votes[i] = -1; + votes[i] = -1; // Spectators are the lower class, and have effectively no voice in the government. Democracy sucks. else if (pickedvote != -1 && votes[i] == -1 && !splitscreen) votes[i] = 3; // Slow people get random } - if (server && votes[pickedvote] == -1) // Uh oh! The person who got picked left! Recalculate, quick! + if (server && pickedvote != -1 && votes[pickedvote] == -1) // Uh oh! The person who got picked left! Recalculate, quick! D_PickVote(); if (!votetic) @@ -2300,24 +2301,31 @@ void Y_VoteTicker(void) numvotes++; } + if (numvotes < 1) // Whoops! Get outta here. + { + Y_UnloadVoteData(); + Y_FollowIntermission(); + return; + } + voteclient.rtics--; if (voteclient.rtics <= 0) { voteclient.roffset++; - voteclient.rtics = min(TICRATE/2, (voteclient.roffset/2)+5); + voteclient.rtics = min(20, (3*voteclient.roffset/4)+5); S_StartSound(NULL, sfx_kc39); } if (voteclient.rendoff == 0 || voteclient.roffset < voteclient.rendoff) voteclient.ranim = tempvotes[((pickedvote + voteclient.roffset) % numvotes)]; - if (voteclient.roffset >= 24) + if (voteclient.roffset >= 20) { if (voteclient.rendoff == 0) { if (tempvotes[((pickedvote + voteclient.roffset + 4) % numvotes)] == pickedvote - && voteclient.rsynctime % (29*TICRATE/20) == 0) // Song is 1.45 seconds long (sorry @ whoever wants to replace it in a music wad :V) + && voteclient.rsynctime % 50 == 0) // Song is 1.45 seconds long (sorry @ whoever wants to replace it in a music wad :V) { voteclient.rendoff = voteclient.roffset+4; S_ChangeMusicInternal("voteeb", false); @@ -2338,9 +2346,8 @@ void Y_VoteTicker(void) if (votetic < 3*(NEWTICRATE/7)) // give it some time before letting you control it :V return; - if ((!playeringame[consoleplayer] || players[consoleplayer].spectator) && votes[consoleplayer] != -1) - D_ModifyClientVote(-1); - else if (pickedvote == -1 && votes[consoleplayer] == -1 && !voteclient.delay) + if ((playeringame[consoleplayer] && !players[consoleplayer].spectator) + && !voteclient.delay && pickedvote == -1 && votes[consoleplayer] == -1) { if (InputDown(gc_aimforward, 1) || JoyAxis(AXISMOVE, 1) < 0) { @@ -2365,36 +2372,39 @@ void Y_VoteTicker(void) if (pressed) { - S_StartSound(NULL, sfx_s3k5b); + S_StartSound(NULL, sfx_kc4a); voteclient.delay = NEWTICRATE/7; } if (server) { - UINT8 numplayers = 0, numvotes = 0; - - if (splitscreen) - { - numplayers = 1; - if (votes[0] != -1) - numvotes = 1; - } - else + if (timer == 0) { for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i] || players[i].spectator) - continue; - numplayers++; - if (votes[i] != -1) - numvotes++; + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen) + votes[i] = 3; + } + } + else + { + if (splitscreen) + { + if (votes[0] == -1) + return; + } + else + { + for (i = 0; i < MAXPLAYERS; i++) + { + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1) + return; + } } } - if (numvotes >= numplayers) - timer = 0; - - if (timer == 0 && voteendtic == -1) + timer = 0; + if (voteendtic == -1) D_PickVote(); } } @@ -2508,8 +2518,58 @@ static void Y_UnloadVoteData(void) // // Y_SetupVoteFinish // -void Y_SetupVoteFinish(INT8 pick, INT8 level) +void Y_SetupVoteFinish(SINT8 pick, SINT8 level) { + if (pick == -1) // No other votes? We gotta get out of here, then! + { + timer = 0; + Y_UnloadVoteData(); + Y_FollowIntermission(); + return; + } + + if (pickedvote == -1) + { + INT32 i; + SINT8 votecompare = -1; + INT32 endtype = 0; + + voteclient.rsynctime = 0; + + for (i = 0; i < MAXPLAYERS; i++) + { + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen) + votes[i] = 3; + + if (votes[i] == -1 || endtype > 1) // Don't need to go on + continue; + + if (votecompare == -1) + { + votecompare = votes[i]; + endtype = 1; + } + else if (votes[i] != votecompare) + endtype = 2; + } + + if (endtype == 0) // Might as well put this here, too. + { + timer = 0; + Y_UnloadVoteData(); + Y_FollowIntermission(); + return; + } + else if (endtype == 1) // Only one unique vote, so just end it immediately. + { + voteendtic = votetic + (5*TICRATE); + S_StartSound(NULL, sfx_kc48); + S_ChangeMusicInternal("voteeb", false); + } + else + S_ChangeMusicInternal("voteea", true); + } + pickedvote = pick; nextmap = votelevels[level]; timer = 0; diff --git a/src/y_inter.h b/src/y_inter.h index 6ba83583..6171f42b 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -21,7 +21,7 @@ void Y_VoteDrawer(void); void Y_VoteTicker(void); void Y_StartVote(void); void Y_EndVote(void); -void Y_SetupVoteFinish(INT8 pick, INT8 level); +void Y_SetupVoteFinish(SINT8 pick, SINT8 level); typedef enum {