From 128da9b6871c57d60fb4e0701fa7c902849313ed Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 19 May 2025 15:26:19 +0200 Subject: [PATCH] even more random cleanup 2 --- src/.gitignore | 1 - src/command.c | 11 +-- src/console.c | 41 ++++---- src/d_clisrv.c | 30 ------ src/d_netcmd.c | 147 +++++++--------------------- src/g_game.c | 154 +++++++----------------------- src/g_game.h | 23 +++-- src/hardware/hw_batching.c | 23 ++++- src/lua_baselib.c | 10 +- src/m_cheat.c | 191 +------------------------------------ src/p_inter.c | 64 ++----------- src/p_local.h | 1 - src/p_mobj.c | 71 +------------- src/p_spec.c | 10 -- src/p_user.c | 50 +--------- 15 files changed, 139 insertions(+), 688 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index d1d328f14..156f6f65f 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,4 +1,3 @@ /cscope.out -/srb2wii *.json *.idx diff --git a/src/command.c b/src/command.c index eb38a0f6a..e7dd9cc01 100644 --- a/src/command.c +++ b/src/command.c @@ -1984,7 +1984,7 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) return true; } -// Block the Xbox DInput default axes and reset to the current defaults +// Block the Xbox DInput default axes and reset to the current defaults static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr) { if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis")) @@ -2041,15 +2041,6 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2 { -#if 0 - // We don't have changed saved cvars yet - if (!stricmp(v->name, "alwaysmlook") - || !stricmp(v->name, "alwaysmlook2") - || !stricmp(v->name, "mousemove") - || !stricmp(v->name, "mousemove2")) - return false; -#endif - // axis defaults were changed to be friendly to 360 controllers // if ALL axis settings are defaults, then change them to new values if (!CV_FilterJoyAxisVars(v, valstr)) diff --git a/src/console.c b/src/console.c index 7f417625b..8c1824456 100644 --- a/src/console.c +++ b/src/console.c @@ -275,29 +275,28 @@ void CON_SetupBackColormap(void) switch (cons_backcolor.value) { - case 0: palindex = 15; break; // White - case 1: palindex = 31; break; // Gray - case 2: palindex = 47; break; // Sepia - case 3: palindex = 63; break; // Brown - case 4: palindex = 150; shift = 7; break; // Pink - case 5: palindex = 127; shift = 7; break; // Raspberry - case 6: palindex = 143; break; // Red - case 7: palindex = 86; shift = 7; break; // Creamsicle - case 8: palindex = 95; break; // Orange - case 9: palindex = 119; shift = 7; break; // Gold - case 10: palindex = 111; break; // Yellow - case 11: palindex = 191; shift = 7; break; // Emerald - case 12: palindex = 175; break; // Green - case 13: palindex = 219; break; // Cyan - case 14: palindex = 207; shift = 7; break; // Steel - case 15: palindex = 230; shift = 7; break; // Periwinkle - case 16: palindex = 239; break; // Blue - case 17: palindex = 199; shift = 7; break; // Purple - case 18: palindex = 255; shift = 7; break; // Lavender + case 0: palindex = 15; break; // White + case 1: palindex = 31; break; // Gray + case 2: palindex = 47; break; // Sepia + case 3: palindex = 63; break; // Brown + case 4: palindex = 150; shift = 7; break; // Pink + case 5: palindex = 127; shift = 7; break; // Raspberry + case 6: palindex = 143; break; // Red + case 7: palindex = 86; shift = 7; break; // Creamsicle + case 8: palindex = 95; break; // Orange + case 9: palindex = 119; shift = 7; break; // Gold + case 10: palindex = 111; break; // Yellow + case 11: palindex = 191; shift = 7; break; // Emerald + case 12: palindex = 175; break; // Green + case 13: palindex = 219; break; // Cyan + case 14: palindex = 207; shift = 7; break; // Steel + case 15: palindex = 230; shift = 7; break; // Periwinkle + case 16: palindex = 239; break; // Blue + case 17: palindex = 199; shift = 7; break; // Purple + case 18: palindex = 255; shift = 7; break; // Lavender // Default green default: palindex = 175; break; - -} + } // setup background colormap for (i = 0, j = 0; i < 768; i += 3, j++) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index fd14bad09..cc7334f27 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3319,36 +3319,6 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) if (gametype == GT_CTF) P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you! - // If in a special stage, redistribute the player's rings across - // the remaining players. - if (G_IsSpecialStage(gamemap)) - { - INT32 i, count, increment, rings; - - for (i = 0, count = 0; i < MAXPLAYERS; i++) - { - if (players[i].ingame) - count++; - } - - count--; - rings = players[playernum].health - 1; - increment = rings/count; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].ingame && i != playernum) - { - if (rings < increment) - P_GivePlayerRings(&players[i], rings); - else - P_GivePlayerRings(&players[i], increment); - - rings -= increment; - } - } - } - LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting if (playernum == displayplayers[0] && !demo.playback) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1a93cbd75..71c8d7216 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -211,14 +211,6 @@ void SendWeaponPref4(void); static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; -#ifdef LJOYSTICK -static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"}, - {4, "/dev/js3"}, {0, NULL}}; -#else -// accept whatever value - it is in fact the joystick device number -#define usejoystick_cons_t NULL -#endif - static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}}; static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; @@ -304,7 +296,7 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = { - {"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, {"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, {"verticallook3", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}, {"verticallook4", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL} @@ -312,28 +304,26 @@ consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = { #if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2 consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = { - {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL}, - {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}, - {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL}, - {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL} + {"use_joystick", "1", CV_SAVE|CV_CALL, NULL, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL}, + {"use_joystick2", "2", CV_SAVE|CV_CALL, NULL, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}, + {"use_joystick3", "3", CV_SAVE|CV_CALL, NULL, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL}, + {"use_joystick4", "4", CV_SAVE|CV_CALL, NULL, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL} }; #endif -#if (defined (LJOYSTICK) || defined (HAVE_SDL)) -#ifdef LJOYSTICK -consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later -#endif +#if defined (HAVE_SDL) consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { - {"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL}, + {"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL}, {"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL}, {"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL}, {"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL} }; #else -consvar_t cv_joyscale[2] = { //Alam: Dummy for save - {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, - {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL} +consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { //Alam: Dummy for save + {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyscale3", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyscale4", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL} }; #endif @@ -341,19 +331,6 @@ consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWH consvar_t cv_specialrings = {"specialrings", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_powerstones = {"powerstones", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -/*consvar_t cv_recycler = {"tv_recycler", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_teleporters = {"tv_teleporter", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_superring = {"tv_superring", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_supersneakers = {"tv_supersneaker", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_invincibility = {"tv_invincibility", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_jumpshield = {"tv_jumpshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_watershield = {"tv_watershield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_ringshield = {"tv_ringshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_forceshield = {"tv_forceshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_bombshield = {"tv_bombshield", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_1up = {"tv_1up", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_eggmanbox = {"tv_eggman", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};*/ - // SRB2kart consvar_t cv_sneaker = {"sneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_rocketsneaker = {"rocketsneaker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -469,7 +446,6 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; -//static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; consvar_t cv_jointimeout = {"jointimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_maxping = {"maxdelay", "20", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -993,7 +969,18 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_showfocuslost); CV_RegisterVar(&cv_pauseifunfocused); + // filesrch.c + CV_RegisterVar(&cv_addons_option); + CV_RegisterVar(&cv_addons_folder); + CV_RegisterVar(&cv_addons_md5); + CV_RegisterVar(&cv_addons_showall); + CV_RegisterVar(&cv_addons_search_type); + CV_RegisterVar(&cv_addons_search_case); + // g_input.c + CV_RegisterVar(&cv_controlperkey); + CV_RegisterVar(&cv_turnsmooth); + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { CV_RegisterVar(&cv_turnaxis[i]); @@ -1011,21 +998,9 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_custom3axis[i]); CV_RegisterVar(&cv_xdeadzone[i]); CV_RegisterVar(&cv_ydeadzone[i]); - } - // filesrch.c - CV_RegisterVar(&cv_addons_option); - CV_RegisterVar(&cv_addons_folder); - CV_RegisterVar(&cv_addons_md5); - CV_RegisterVar(&cv_addons_showall); - CV_RegisterVar(&cv_addons_search_type); - CV_RegisterVar(&cv_addons_search_case); - - CV_RegisterVar(&cv_controlperkey); - CV_RegisterVar(&cv_turnsmooth); - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { + CV_RegisterVar(&cv_usejoystick[i]); + CV_RegisterVar(&cv_joyscale[i]); CV_RegisterVar(&cv_rumble[i]); CV_RegisterVar(&cv_gamepadled[i]); } @@ -1034,21 +1009,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_invertmouse); CV_RegisterVar(&cv_mousesens); CV_RegisterVar(&cv_mouseysens); - //CV_RegisterVar(&cv_mousemove); - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - CV_RegisterVar(&cv_usejoystick[i]); - } -#ifdef LJOYSTICK - CV_RegisterVar(&cv_joyport); - CV_RegisterVar(&cv_joyport2); -#endif - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - CV_RegisterVar(&cv_joyscale[i]); - } // s_sound.c CV_RegisterVar(&cv_soundvolume); @@ -1097,6 +1057,7 @@ void D_RegisterClientCommands(void) } CV_RegisterVar(&cv_demodateformat); + CV_RegisterVar(&cv_showspecstuff); // ingame object placing COM_AddCommand("objectplace", Command_ObjectPlace_f); @@ -1131,8 +1092,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_discordasks); #endif - CV_RegisterVar(&cv_showspecstuff); - COM_AddCommand("listskins", Command_ListSkins); COM_AddCommand("skinsearch", Command_SkinSearch); } @@ -1441,6 +1400,7 @@ static void SetPlayerName(INT32 playernum, char *newname) else { CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1); + if (server && netgame) { SendKick(playernum, KICK_MSG_CON_FAIL); @@ -1798,24 +1758,8 @@ static void SendNameAndColor3(void) if ((foundskin = R_SkinAvailable(cv_skin3.string)) != -1) { - //boolean notsame; - cv_skin3.value = foundskin; - - //notsame = (cv_skin3.value != players[thirdplaya].skin); - SetPlayerSkin(thirdplaya, cv_skin3.string); - - // SRB2Kart - /*if (notsame) - { - CV_StealthSetValue(&cv_playercolor3, skins[players[thirdplaya].skin].prefcolor); - - players[thirdplaya].skincolor = (cv_playercolor3.value&0x3F) % MAXSKINCOLORS; - - if (players[thirdplaya].mo) - players[thirdplaya].mo->color = players[thirdplaya].skincolor; - }*/ } else { @@ -2127,6 +2071,7 @@ void D_SendPlayerConfig(void) SendNameAndColor3(); if (splitscreen > 2) SendNameAndColor4(); + SendWeaponPref(); if (splitscreen) SendWeaponPref2(); @@ -2150,7 +2095,7 @@ static INT32 LookupPlayer(const char *s) if (*s == '0')/* clever way to bypass atoi */ return 0; - if (( playernum = atoi(s) )) + if ((playernum = atoi(s))) { playernum = max(min(playernum, MAXPLAYERS-1), 0);/* not out of range */ return playernum; @@ -2231,8 +2176,7 @@ static void Command_View_f(void) if (viewnum > 1 && !( multiplayer && demo.playback )) { - CONS_Alert(CONS_NOTICE, - "You must be viewing a multiplayer replay to use this.\n"); + CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n"); return; } @@ -2315,10 +2259,9 @@ static void Command_SetViews_f(void) UINT8 splits; UINT8 newsplits; - if (!( demo.playback && multiplayer )) + if (!(demo.playback && multiplayer)) { - CONS_Alert(CONS_NOTICE, - "You must be viewing a multiplayer replay to use this.\n"); + CONS_Alert(CONS_NOTICE, "You must be viewing a multiplayer replay to use this.\n"); return; } @@ -2537,18 +2480,8 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r // Kick bot from special stages if (botskin) { - if (G_IsSpecialStage(mapnum)) + if (!botingame) { - if (botingame) - { - //CL_RemoveSplitscreenPlayer(); - botingame = false; - players[1].ingame = false; - } - } - else if (!botingame) - { - //CL_AddSplitscreenPlayer(); botingame = true; displayplayers[1] = 1; players[1].ingame = true; @@ -3134,20 +3067,6 @@ static void Command_Respawn(void) return; } - /*if (!G_RaceGametype()) // srb2kart: not necessary, respawning makes you lose a bumper in battle, so it's not desirable to use as a way to escape a hit - { - CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n")); - return; - }*/ - - // Retry is quicker. Probably should force people to use it. - // nope, this is srb2kart - a complete retry is overkill - /*if (!(netgame || multiplayer)) - { - CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n")); - return; - }*/ - SendNetXCmd(XD_RESPAWN, &buf, 4); } diff --git a/src/g_game.c b/src/g_game.c index 1c57613ff..3ab837fbb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -395,7 +395,6 @@ consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL, consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -//consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, {1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"}, @@ -416,105 +415,105 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_camstrafeaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_camstrafe", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_camturnaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_camturn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS] = { - {"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis2_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis3_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joyaxis4_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS] = { - {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS] = { - {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} @@ -1290,7 +1289,7 @@ static void G_DoLoadLevel(boolean resetplayer) for (i = 0; i < JOYAXISSET; i++) { - joyxmove[i] = joyymove[i] = 0; + joyxmove[i] = joyymove[i] = 0; joy2xmove[i] = joy2ymove[i] = 0; joy3xmove[i] = joy3ymove[i] = 0; joy4xmove[i] = joy4ymove[i] = 0; @@ -1582,10 +1581,7 @@ boolean G_CouldView(INT32 playernum) return false; // SRB2Kart: Only go through players who are actually playing - if (player->exiting) - return false; - - if (player->pflags & PF_TIMEOVER) + if (player->exiting || (player->pflags & PF_TIMEOVER)) return false; // I don't know if we want this actually, but I'll humor the suggestion anyway @@ -1847,11 +1843,11 @@ void G_Ticker(boolean run) { switch (gameaction) { - case ga_completed: G_DoCompleted(); break; + case ga_completed: G_DoCompleted(); break; case ga_startcont: G_DoStartContinue(); break; - case ga_continued: G_DoContinued(); break; - case ga_worlddone: G_DoWorldDone(); break; - case ga_startvote: G_DoStartVote(); break; + case ga_continued: G_DoContinued(); break; + case ga_worlddone: G_DoWorldDone(); break; + case ga_startvote: G_DoStartVote(); break; case ga_nothing: break; default: I_Error("gameaction = %d\n", gameaction); } @@ -2574,10 +2570,10 @@ mapthing_t *G_FindRaceStart(INT32 playernum) { if (!players[j].ingame || players[j].spectator) continue; - if (j == playernum) - continue; - if (j == i) + + if ((j == playernum) || (j == i)) continue; + if (players[j].score == players[i].score) num++; } @@ -2675,6 +2671,7 @@ void G_DoReborn(INT32 playernum) } B_RespawnBot(playernum); + if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); } @@ -2697,6 +2694,7 @@ void G_DoReborn(INT32 playernum) } G_SpawnPlayer(playernum, starpost); + if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); @@ -2765,62 +2763,6 @@ INT32 G_GetGametypeByName(const char *gametypestr) return -1; // unknown gametype } -// -// G_IsSpecialStage -// -// Returns TRUE if -// the given map is a special stage. -// -boolean G_IsSpecialStage(INT32 mapnum) -{ - (void)mapnum; - return false; -} - -// -// G_GametypeUsesLives -// -// Returns true if the current gametype uses -// the lives system. False otherwise. -// -boolean G_GametypeUsesLives(void) -{ - // SRB2kart NEEDS no lives - return false; -} - -// -// G_GametypeHasTeams -// -// Returns true if the current gametype uses -// Red/Blue teams. False otherwise. -// -boolean G_GametypeHasTeams(void) -{ - return (gametype == GT_TEAMMATCH || gametype == GT_CTF); -} - -// -// G_GametypeHasSpectators -// -// Returns true if the current gametype supports -// spectators. False otherwise. -// -boolean G_GametypeHasSpectators(void) -{ - return (netgame || (multiplayer && demo.playback)); //true -} - -// -// G_BattleGametype -// -// Returns true in Battle gamemodes, previously was G_RingSlingerGametype. -// -boolean G_BattleGametype(void) -{ - return (gametype == GT_MATCH); -} - // // G_SometimesGetDifferentGametype // @@ -2852,6 +2794,7 @@ UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype) default: break; } + if (encoreactual != (boolean)cv_kartencore.value) encoremodifier = 0x80; } @@ -2885,6 +2828,7 @@ UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype) return (GT_RACE|0x80); return (GT_RACE); } + // This might appear wrong HERE, but the game will display the Encore possibility on the second voting choice instead. return (GT_MATCH|encoremodifier); } @@ -2907,27 +2851,6 @@ UINT8 G_GetGametypeColor(INT16 gt) return 247; // FALLBACK } -// -// G_RaceGametype -// -// Returns true in Race gamemodes, previously was G_PlatformGametype. -// -boolean G_RaceGametype(void) -{ - return (gametype == GT_RACE); -} - -// -// G_TagGametype -// -// For Jazz's Tag/HnS modes that have a lot of special cases... -// SRB2Kart: do we actually want to add Kart tag later? :V -// -boolean G_TagGametype(void) -{ - return (gametype == GT_TAG || gametype == GT_HIDEANDSEEK); -} - /** Get the typeoflevel flag needed to indicate support of a gametype. * In single-player, this always returns TOL_SP. * \param gametype The gametype for which support is desired. @@ -2991,7 +2914,8 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maph if (extbuffer != NULL) { bufx = 0; - while (extbuffer[bufx]) { + while (extbuffer[bufx]) + { extbufsize++; bufx++; } } @@ -3120,7 +3044,6 @@ void G_AddMapToBuffer(INT16 map) static void G_DoCompleted(void) { INT32 i, j = 0; - boolean gottoken = false; tokenlist = 0; // Reset the list @@ -3169,15 +3092,13 @@ static void G_DoCompleted(void) nextmap = (INT16)(mapheaderinfo[gamemap-1]->nextlevel-1); // Remember last map for when you come out of the special stage. - if (!G_IsSpecialStage(gamemap)) - lastmap = nextmap; + lastmap = nextmap; // If nextmap is actually going to get used, make sure it points to // a map of the proper gametype -- skip levels that don't support // the current gametype. (Helps avoid playing boss levels in Race, // for instance). - if (!token && !G_IsSpecialStage(gamemap) && !modeattacking - && (nextmap >= 0 && nextmap < NUMMAPS)) + if (!token && !modeattacking && (nextmap >= 0 && nextmap < NUMMAPS)) { register INT16 cm = nextmap; INT16 tolflag = G_TOLFlag(gametype); @@ -3231,12 +3152,11 @@ static void G_DoCompleted(void) if (gametype == GT_COOP && token) { token--; - gottoken = true; if (!(emeralds & EMERALD1)) nextmap = (INT16)(sstage_start - 1); // Special Stage 1 else if (!(emeralds & EMERALD2)) - nextmap = (INT16)(sstage_start); // Special Stage 2 + nextmap = (INT16)(sstage_start); // Special Stage 2 else if (!(emeralds & EMERALD3)) nextmap = (INT16)(sstage_start + 1); // Special Stage 3 else if (!(emeralds & EMERALD4)) @@ -3247,13 +3167,8 @@ static void G_DoCompleted(void) nextmap = (INT16)(sstage_start + 4); // Special Stage 6 else if (!(emeralds & EMERALD7)) nextmap = (INT16)(sstage_start + 5); // Special Stage 7 - else - gottoken = false; } - if (G_IsSpecialStage(gamemap) && !gottoken) - nextmap = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001 - automapactive = false; if (gametype != GT_COOP) @@ -3840,9 +3755,6 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) if (demo.playback) // reset game engine G_StopDemo(); -// paused = false; -// automapactive = false; - // dearchive all the modifications if (!P_LoadGame(&save, mapoverride)) { diff --git a/src/g_game.h b/src/g_game.h index d7d380f50..27354f745 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -387,16 +387,24 @@ boolean G_CheckDemoStatus(void); void G_SaveDemo(void); boolean G_DemoTitleResponder(event_t *ev); +#define G_GametypeHasTeams() (G_IsGameType(GT_TEAMMATCH) || G_IsGameType(GT_CTF)) +#define G_BattleGametype() (G_IsGameType(GT_MATCH)) +#define G_RaceGametype() (G_IsGameType(GT_RACE)) +#define G_TagGametype() (G_IsGameType(GT_TAG) || G_IsGameType(GT_HIDEANDSEEK)) + +FUNCINLINE static ATTRINLINE boolean G_IsGameType(int type) +{ + return (gametype == type); +} + +FUNCINLINE static ATTRINLINE boolean G_GametypeHasSpectators(void) +{ + return (netgame || (multiplayer && demo.playback)); +} + INT32 G_GetGametypeByName(const char *gametypestr); -boolean G_IsSpecialStage(INT32 mapnum); -boolean G_GametypeUsesLives(void); -boolean G_GametypeHasTeams(void); -boolean G_GametypeHasSpectators(void); -boolean G_BattleGametype(void); UINT8 G_SometimesGetDifferentGametype(UINT8 prefgametype); UINT8 G_GetGametypeColor(INT16 gt); -boolean G_RaceGametype(void); -boolean G_TagGametype(void); void G_ExitLevel(void); void G_NextLevel(void); void G_Continue(void); @@ -426,7 +434,6 @@ void G_SetRetryFlag(void); void G_ClearRetryFlag(void); boolean G_GetRetryFlag(void); - void G_LoadGameData(void); void G_LoadGameSettings(void); diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 3c7a49af9..3655beb8a 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -88,7 +88,10 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt if (currently_batching) { if (!pSurf) + { I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to + } + if (polygonArraySize == polygonArrayAllocSize) { PolygonArrayEntry* new_array; @@ -228,7 +231,9 @@ void HWR_RenderBatches(void) int i; if (!currently_batching) + { I_Error("HWR_RenderBatches called without starting batching"); + } nextSurfaceInfo.LightInfo.fade_end = 0; nextSurfaceInfo.LightInfo.fade_start = 0; @@ -236,6 +241,7 @@ void HWR_RenderBatches(void) nextSurfaceInfo.LightInfo.directional = false; currently_batching = false;// no longer collecting batches + if (!polygonArraySize) { ps_hw_numpolys.value.i = ps_hw_numcalls.value.i = ps_hw_numshaders.value.i @@ -243,6 +249,7 @@ void HWR_RenderBatches(void) = ps_hw_numcolors.value.i = 0; return;// nothing to draw } + // init stats vars ps_hw_numpolys.value.i = polygonArraySize; ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0; @@ -291,7 +298,7 @@ void HWR_RenderBatches(void) else GL_SetTexture(currentTexture); - while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons) + while (1) // note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons) { int firstIndex; int lastIndex; @@ -361,23 +368,28 @@ void HWR_RenderBatches(void) nextTexture = nextEntry->texture; nextPolyFlags = nextEntry->polyFlags; nextSurfaceInfo = nextEntry->surf; + if (nextPolyFlags & PF_NoTexture) nextTexture = 0; + if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable) { changeState = true; changeShader = true; } + if (currentTexture != nextTexture) { changeState = true; changeTexture = true; } + if (currentPolyFlags != nextPolyFlags) { changeState = true; changePolyFlags = true; } + if (cv_glshaders.value && gl_shadersavailable) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || @@ -413,10 +425,12 @@ void HWR_RenderBatches(void) finalVertexWritePos = 0; finalIndexWritePos = 0; } - else continue; + else + continue; // if we're here then either its time to stop or time to change state - if (stopFlag) break; + if (stopFlag) + break; // change state according to change bools and next vars, update current vars and reset bools if (changeState) @@ -429,6 +443,7 @@ void HWR_RenderBatches(void) ps_hw_numshaders.value.i++; } + if (changeTexture) { // texture should be already ready for use from calls to GL_SetTexture during batch collection @@ -438,6 +453,7 @@ void HWR_RenderBatches(void) ps_hw_numtextures.value.i++; } + if (changePolyFlags) { currentPolyFlags = nextPolyFlags; @@ -445,6 +461,7 @@ void HWR_RenderBatches(void) ps_hw_numpolyflags.value.i++; } + if (changeSurfaceInfo) { currentSurfaceInfo = nextSurfaceInfo; diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7a2b559f3..475ed8f0a 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1512,12 +1512,7 @@ static int lib_pSetMobjStateNF(lua_State *L) static int lib_pDoSuperTransformation(lua_State *L) { - player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - boolean giverings = lua_optboolean(L, 2); NOHUD - if (!player) - return LUA_ErrInvalid(L, "player_t"); - P_DoSuperTransformation(player, giverings); return 0; } @@ -2569,16 +2564,15 @@ static int lib_gExitLevel(lua_State *L) static int lib_gIsSpecialStage(lua_State *L) { - INT32 mapnum = luaL_optinteger(L, 1, gamemap); //HUDSAFE - lua_pushboolean(L, G_IsSpecialStage(mapnum)); + lua_pushboolean(L, false); return 1; } static int lib_gGametypeUsesLives(lua_State *L) { //HUDSAFE - lua_pushboolean(L, G_GametypeUsesLives()); + lua_pushboolean(L, false); return 1; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 70b0db8d9..d4120368d 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -57,29 +57,11 @@ typedef struct // CHEAT Structures // ========================================================================== -// Cheat responders -/*static UINT8 cheatf_ultimate(void) -{ - if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef)) - return 0; // Only on the main menu, or the save select! - - S_StartSound(0, sfx_itemup); - ultimate_selectable = (!ultimate_selectable); - - // If on the save select, move to what is now Ultimate Mode! - if (currentMenu == &SP_LoadDef) - M_ForceSaveSlotSelected(NOSAVESLOT); - return 1; -}*/ - static UINT8 cheatf_warp(void) { UINT8 i; boolean success = false; - /*if (modifiedgame) - return 0;*/ - if (menuactive && currentMenu != &MainDef) return 0; // Only on the main menu! @@ -134,18 +116,6 @@ static UINT8 cheatf_devmode(void) } #endif -/*static cheatseq_t cheat_ultimate = { - 0, cheatf_ultimate, - { SCRAMBLE('u'), SCRAMBLE('l'), SCRAMBLE('t'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('t'), SCRAMBLE('e'), 0xff } -};*/ - -/*static cheatseq_t cheat_ultimate_joy = { - 0, cheatf_ultimate, - { SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_DOWNARROW), SCRAMBLE(KEY_DOWNARROW), - SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW), - SCRAMBLE(KEY_ENTER), 0xff } -};*/ - static cheatseq_t cheat_warp = { 0, cheatf_warp, //{ SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } @@ -376,70 +346,6 @@ void Command_Hurtme_f(void) P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1))); } -// Moves the NiGHTS player to another axis within the current mare -/*void Command_JumpToAxis_f(void) -{ - REQUIRE_DEVMODE; - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - - if (COM_Argc() != 2) - { - CONS_Printf(M_GetText("jumptoaxis : Jump to axis within current mare.\n")); - return; - } - - P_TransferToAxis(&players[consoleplayer], atoi(COM_Argv(1))); -} - -void Command_Charability_f(void) -{ - REQUIRE_DEVMODE; - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - - if (COM_Argc() < 3) - { - CONS_Printf(M_GetText("charability <1/2> : change character abilities\n")); - return; - } - - if (atoi(COM_Argv(1)) == 1) - players[consoleplayer].charability = (UINT8)atoi(COM_Argv(2)); - else if (atoi(COM_Argv(1)) == 2) - players[consoleplayer].charability2 = (UINT8)atoi(COM_Argv(2)); - else - CONS_Printf(M_GetText("charability <1/2> : change character abilities\n")); -} - -void Command_Charspeed_f(void) -{ - REQUIRE_DEVMODE; - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - - if (COM_Argc() < 3) - { - CONS_Printf(M_GetText("charspeed : set character speed\n")); - return; - } - - if (!strcasecmp(COM_Argv(1), "normalspeed")) - players[consoleplayer].normalspeed = atoi(COM_Argv(2))< : set character speed\n")); -}*/ - void Command_RTeleport_f(void) { fixed_t intx, inty, intz; @@ -682,28 +588,6 @@ void Command_Savecheckpoint_f(void) CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].starpostx, players[consoleplayer].starposty, players[consoleplayer].starpostz); } -// Like M_GetAllEmeralds() but for console devmode junkies. -/*void Command_Getallemeralds_f(void) -{ - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - emeralds = ((EMERALD7)*2)-1; - - CONS_Printf(M_GetText("You now have all 7 emeralds.\n")); -} - -void Command_Resetemeralds_f(void) -{ - REQUIRE_SINGLEPLAYER; - REQUIRE_PANDORA; - - emeralds = 0; - - CONS_Printf(M_GetText("Emeralds reset to zero.\n")); -}*/ - void Command_Devmode_f(void) { #ifndef _DEBUG @@ -730,63 +614,6 @@ void Command_Devmode_f(void) G_SetGameModified(multiplayer, true); } -/*void Command_Setrings_f(void) -{ - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - if (COM_Argc() > 1) - { - // P_GivePlayerRings does value clamping - players[consoleplayer].health = players[consoleplayer].mo->health = 1; - P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); - if (!G_IsSpecialStage(gamemap) || !useNightsSS) - players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings - - G_SetGameModified(multiplayer); - } -} - -void Command_Setlives_f(void) -{ - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - if (COM_Argc() > 1) - { - // P_GivePlayerLives does value clamping - players[consoleplayer].lives = 0; - P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1))); - - G_SetGameModified(multiplayer); - } -} - -void Command_Setcontinues_f(void) -{ - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - if (COM_Argc() > 1) - { - INT32 numcontinues = atoi(COM_Argv(1)); - if (numcontinues > 99) - numcontinues = 99; - else if (numcontinues < 0) - numcontinues = 0; - - players[consoleplayer].continues = numcontinues; - - G_SetGameModified(multiplayer); - } -}*/ - // // OBJECTPLACE (and related variables) // @@ -1006,17 +833,6 @@ void OP_NightsObjectplace(player_t *player) P_SpawnHoopsAndRings(mt); } - // This places a bumper! - /*if (cmd->buttons & BT_SPECTATE) - { - player->pflags |= PF_ATTACKDOWN; - if (!OP_HeightOkay(player, false)) - return; - - mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false); - P_SpawnMapThing(mt); - }*/ - // This places a ring! if (cmd->buttons & BT_BACKWARD) { @@ -1163,12 +979,7 @@ void OP_ObjectplaceMovement(player_t *player) return; } - /*if (cmd->buttons & BT_FORWARD) - { - OP_CycleThings(-1); - player->pflags |= PF_ATTACKDOWN; - } - else*/ if (cmd->buttons & BT_DRIFT) + if (cmd->buttons & BT_DRIFT) { OP_CycleThings(1); player->pflags |= PF_ATTACKDOWN; diff --git a/src/p_inter.c b/src/p_inter.c index 490e1879d..72f228173 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -106,26 +106,14 @@ void P_DoNightsScore(player_t *player) return; // Don't do any fancy shit for failures. dummymo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z+player->mo->height/2, MT_NIGHTSCORE); + if (player->bot) player = &players[consoleplayer]; - if (G_IsSpecialStage(gamemap)) // Global link count? Maybe not a good idea... - { - INT32 i; - for (i = 0; i < MAXPLAYERS; i++) - if (players[i].ingame) - { - if (++players[i].linkcount > players[i].maxlink) - players[i].maxlink = players[i].linkcount; - players[i].linktimer = 2*TICRATE; - } - } - else // Individual link counts - { - if (++player->linkcount > player->maxlink) - player->maxlink = player->linkcount; - player->linktimer = 2*TICRATE; - } + // Individual link counts + if (++player->linkcount > player->maxlink) + player->maxlink = player->linkcount; + player->linktimer = 2*TICRATE; if (player->linkcount < 10) { @@ -155,12 +143,10 @@ void P_DoNightsScore(player_t *player) } // Hoops are the only things that should add to your drill meter - //player->drillmeter += TICRATE; dummymo->momz = FRACUNIT; dummymo->fuse = 3*TICRATE; // What?! NO, don't use the camera! Scale up instead! - //P_InstaThrust(dummymo, R_PointToAngle2(dummymo->x, dummymo->y, camera[0].x, camera[0].y), 3*FRACUNIT); dummymo->scalespeed = FRACUNIT/25; dummymo->destscale = 2*FRACUNIT; } @@ -461,8 +447,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebacktimer] = comebacktime; - K_DropItems(player); //K_StripItems(player); - //K_StripOther(player); + K_DropItems(player); player->kartstuff[k_itemroulette] = 1; player->kartstuff[k_roulettetype] = 2; @@ -494,7 +479,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0) { - //player->powers[pw_flashing] = 0; K_DropHnextList(player); K_StripItems(player); } @@ -902,14 +886,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } return; case MT_NIGHTSWING: - if (G_IsSpecialStage(gamemap) && useNightsSS) - { // Pseudo-ring. - S_StartSound(toucher, special->info->painsound); - player->totalring++; - } - else - S_StartSound(toucher, special->info->activesound); - + S_StartSound(toucher, special->info->activesound); P_DoNightsScore(player); break; case MT_HOOPCOLLIDE: @@ -940,13 +917,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Hoops are the only things that should add to the drill meter // Also, one tic's worth of drill is too much. - if (G_IsSpecialStage(gamemap)) - { - for (i = 0; i < MAXPLAYERS; i++) - if (players[i].ingame && players[i].pflags & PF_NIGHTSMODE) - players[i].drillmeter += TICRATE/2; - } - else if (player->bot) + if (player->bot) players[consoleplayer].drillmeter += TICRATE/2; else player->drillmeter += TICRATE/2; @@ -1231,7 +1202,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetMobjState(special, special->info->deathstate); return; case MT_SPECIALSPIKEBALL: - if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages + if (useNightsSS) // Only for old special stages { P_DamageMobj(toucher, special, special, 1); return; @@ -1552,9 +1523,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) mobj_t *mo; int ms; - if (!useNightsSS && G_IsSpecialStage(gamemap) && target->player && sstimer > 6) - sstimer = 6; // Just let P_Ticker take care of the rest. - if (target->flags & (MF_ENEMY|MF_BOSS)) target->momx = target->momy = target->momz = 0; @@ -1658,20 +1626,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) target->flags |= MF_NOBLOCKMAP|MF_NOCLIPHEIGHT; P_SetThingPosition(target); - if (!target->player->bot && !G_IsSpecialStage(gamemap) - && G_GametypeUsesLives()) - { - target->player->lives -= 1; // Lose a life Tails 03-11-2000 - - if (target->player->lives <= 0) // Tails 03-14-2000 - { - if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */) - { - S_StopMusic(); // Stop the Music! Tails 03-14-2000 - S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000 - } - } - } target->player->playerstate = PST_DEAD; if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player)) diff --git a/src/p_local.h b/src/p_local.h index 016c7498d..87af202ae 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -476,7 +476,6 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state); boolean P_CheckMissileSpawn(mobj_t *th); void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move); -void P_DoSuperTransformation(player_t *player, boolean giverings); void P_ExplodeMissile(mobj_t *mo); void P_CheckGravity(mobj_t *mo, boolean affect); diff --git a/src/p_mobj.c b/src/p_mobj.c index 1aeac8290..98e77f808 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7351,28 +7351,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_SetTarget(&mobj->target, goalpost); } - if (G_IsSpecialStage(gamemap)) - { // Never show the NiGHTS drone in special stages. Check ANYONE for bonustime. - INT32 i; - boolean bonustime = false; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].ingame && players[i].bonustime) - { - bonustime = true; - break; - } - } - - if (!bonustime) - { - mobj->flags &= ~MF_NOGRAVITY; - P_SetMobjState(mobj, S_NIGHTSDRONE1); - mobj->flags2 |= MF2_DONTDRAW; - } - } - else if (mobj->tracer && mobj->tracer->player) + if (mobj->tracer && mobj->tracer->player) { if (!(mobj->tracer->player->pflags & PF_NIGHTSMODE)) { @@ -7389,39 +7368,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } else { - if (G_IsSpecialStage(gamemap)) // Never show the NiGHTS drone in special stages. Check ANYONE for bonustime. - { - INT32 i; - - boolean bonustime = false; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].ingame && players[i].bonustime) - { - bonustime = true; - break; - } - } - - if (bonustime) - { - P_SetMobjState(mobj, S_NIGHTSDRONE_SPARKLING1); - mobj->flags |= MF_NOGRAVITY; - } - else - { - if (mobj->target) - { - CONS_Debug(DBG_NIGHTSBASIC, "Removing goal post\n"); - P_RemoveMobj(mobj->target); - P_SetTarget(&mobj->target, NULL); - } - - mobj->flags2 |= MF2_DONTDRAW; - } - } - else if (mobj->tracer && mobj->tracer->player) + if (mobj->tracer && mobj->tracer->player) { if (mobj->target) { @@ -10604,10 +10551,6 @@ void P_RespawnSpecials(void) if (!cv_itemrespawn.value) return; - // Don't respawn in special stages! - if (G_IsSpecialStage(gamemap)) - return; - // nothing left to respawn? if (iquehead == iquetail) return; @@ -11323,7 +11266,7 @@ void P_SpawnMapThing(mapthing_t *mthing) if (i == MT_PITYTV || i == MT_GREENTV || i == MT_YELLOWTV || i == MT_BLUETV || i == MT_BLACKTV || i == MT_WHITETV) return; // No shields in Ultimate mode - if (i == MT_SUPERRINGBOX && !G_IsSpecialStage(gamemap)) + if (i == MT_SUPERRINGBOX) return; // No rings in Ultimate mode (except special stages) } @@ -11835,14 +11778,6 @@ ML_NOCLIMB : Direction not controllable mobj->health |= 1; // If ambush is set, push using XYZ if (mthing->options & MTF_OBJECTSPECIAL) mobj->health |= 2; // If object special is set, fade using XY - - if (G_IsSpecialStage(gamemap)) - { - if (i == MT_PUSH) - P_SetMobjState(mobj, S_GRAVWELLGREEN); - if (i == MT_PULL) - P_SetMobjState(mobj, S_GRAVWELLRED); - } } // ignore MTF_ flags and return early diff --git a/src/p_spec.c b/src/p_spec.c index 7c95fe462..d8a65924d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3610,8 +3610,6 @@ DoneSection2: case 2: // Special stage GOAL sector / Exit Sector / CTF Flag Return if (player->bot) break; - if (!useNightsSS && G_IsSpecialStage(gamemap) && sstimer > 6) - sstimer = 6; // Just let P_Ticker take care of the rest. // Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c) { @@ -4520,14 +4518,6 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) switch(GETSECSPECIAL(sector->special, 4)) { case 2: // Level Exit / GOAL Sector / Flag Return - if (!useNightsSS && G_IsSpecialStage(gamemap)) - { - // Special stage GOAL sector - // requires touching floor. - break; - } - /* FALLTHRU */ - case 1: // Starpost activator case 5: // Fan sector case 6: // Super Sonic Transform diff --git a/src/p_user.c b/src/p_user.c index 8bc03d3ae..7fd5dcd1a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -436,9 +436,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) player->mo->health += num_rings; player->health += num_rings; - - if (!G_IsSpecialStage(gamemap) || !useNightsSS) - player->totalring += num_rings; + player->totalring += num_rings; //{ SRB2kart - rings don't really do anything, but we don't want the player spilling them later. { @@ -446,24 +444,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) player->health = 1; } //} - - // Now extra life bonuses are handled here instead of in P_MovePlayer, since why not? - if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives()) - { - INT32 gainlives = 0; - - while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1)) - { - ++gainlives; - ++player->xtralife; - } - - if (gainlives) - { - P_GivePlayerLives(player, gainlives); - P_PlayLivesJingle(player); - } - } } // @@ -482,22 +462,10 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) player->lives = 1; } -// -// P_DoSuperTransformation -// -// Transform into Super Sonic! -void P_DoSuperTransformation(player_t *player, boolean giverings) -{ - (void)player; - (void)giverings; - - return; // SRB2kart - this is not a thing we need -} - // Adds to the player's score void P_AddPlayerScore(player_t *player, UINT32 amount) { - if (!(G_BattleGametype())) + if (!G_BattleGametype()) return; if (player->bot) @@ -826,20 +794,6 @@ boolean P_IsObjectOnGround(mobj_t *mo) { if (P_IsObjectInGoop(mo)) { -/* - // It's a crazy hack that checking if you're on the ground - // would actually CHANGE your position and momentum, - if (mo->z < mo->floorz) - { - mo->z = mo->floorz; - mo->momz = 0; - } - else if (mo->z + mo->height > mo->ceilingz) - { - mo->z = mo->ceilingz - mo->height; - mo->momz = 0; - } -*/ // but I don't want you to ever 'stand' while submerged in goo. // You're in constant vertical momentum, even if you get stuck on something. // No exceptions.