From 8731c6b7a4c426fc1cbe76931c9b55229e52c365 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 11 Aug 2020 16:13:17 -0400 Subject: [PATCH] Another round of fixing up - gametyperules are now fitting for kart, not applied to the whole codebase though - a few more files compile --- src/command.c | 20 +- src/d_clisrv.c | 15 +- src/d_event.h | 1 - src/d_main.c | 2 +- src/d_netcmd.c | 770 ++++++++-------------------------------- src/d_netcmd.h | 37 +- src/dehacked.c | 27 +- src/doomdata.h | 3 - src/doomstat.h | 59 ++- src/f_finale.c | 308 ---------------- src/g_demo.c | 36 +- src/g_game.c | 288 +++++---------- src/g_game.h | 6 - src/g_input.c | 65 +--- src/g_input.h | 4 +- src/hardware/hw_light.c | 1 - src/hardware/hw_light.h | 1 - src/hardware/hw_md2.c | 2 - src/hu_stuff.c | 12 +- src/i_system.h | 6 +- src/k_battle.c | 10 +- src/k_bot.c | 2 - src/k_collide.c | 4 +- src/k_color.c | 36 +- src/k_color.h | 4 - src/k_kart.c | 310 ++++++++-------- src/k_pwrlv.c | 8 +- src/lua_baselib.c | 45 --- src/lua_hooklib.c | 4 +- src/lua_mathlib.c | 1 - src/lua_script.c | 8 +- src/lua_skinlib.c | 31 +- src/m_cheat.c | 15 - src/m_cond.c | 5 +- src/m_menu.c | 517 +++++++++------------------ src/m_misc.c | 10 +- src/p_enemy.c | 64 ++-- src/p_inter.c | 216 +---------- src/p_map.c | 8 +- src/p_mobj.c | 621 ++------------------------------ src/p_saveg.c | 5 - src/p_setup.c | 196 +++------- src/p_spec.c | 84 +---- src/p_tick.c | 16 +- src/p_user.c | 129 ++----- src/r_skins.h | 12 +- src/s_sound.c | 5 +- src/screen.c | 6 - src/st_stuff.c | 57 ++- src/v_video.c | 1 - src/y_inter.c | 11 +- 51 files changed, 855 insertions(+), 3249 deletions(-) diff --git a/src/command.c b/src/command.c index 12387a392..aaa2f690c 100644 --- a/src/command.c +++ b/src/command.c @@ -1959,13 +1959,13 @@ void CV_AddValue(consvar_t *var, INT32 increment) var->func(); return; } - else if (var == &cv_playercolor) + else if (var == &cv_playercolor[0] || var == &cv_playercolor[1] || var == &cv_playercolor[2] || var == &cv_playercolor[3]) { // Special case for the playercolor variable, used only directly from the menu if (increment > 0) // Going up! { newvalue = var->value + 1; - if (newvalue > MAXSKINCOLORS-1) + if (newvalue > numskincolors-1) newvalue = 1; var->value = newvalue; var->string = var->PossibleValue[var->value].strvalue; @@ -1976,7 +1976,7 @@ void CV_AddValue(consvar_t *var, INT32 increment) { newvalue = var->value - 1; if (newvalue < 1) - newvalue = MAXSKINCOLORS-1; + newvalue = numskincolors-1; var->value = newvalue; var->string = var->PossibleValue[var->value].strvalue; var->func(); @@ -2077,13 +2077,13 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) switch (i) { default: - COM_BufInsertText(va("%s \"%s\"\n", cv_turnaxis.name, cv_turnaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_moveaxis.name, cv_moveaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_brakeaxis.name, cv_brakeaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_aimaxis.name, cv_aimaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_lookaxis.name, cv_lookaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_fireaxis.name, cv_fireaxis.defaultvalue)); - COM_BufInsertText(va("%s \"%s\"\n", cv_driftaxis.name, cv_driftaxis.defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_turnaxis[0].name, cv_turnaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_moveaxis[0].name, cv_moveaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_brakeaxis[0].name, cv_brakeaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_aimaxis[0].name, cv_aimaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_lookaxis[0].name, cv_lookaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_fireaxis[0].name, cv_fireaxis[0].defaultvalue)); + COM_BufInsertText(va("%s \"%s\"\n", cv_driftaxis[0].name, cv_driftaxis[0].defaultvalue)); break; } joyaxis_count[i]++; diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 87e3b2457..7c49e37b8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1013,8 +1013,6 @@ static void SV_SendResynch(INT32 node) netbuffer->packettype = PT_RESYNCHEND; netbuffer->u.resynchend.randomseed = P_GetRandSeed(); - if (gametyperules & GTR_TEAMFLAGS) - resynch_write_ctf(&netbuffer->u.resynchend); resynch_write_others(&netbuffer->u.resynchend); HSendPacket(node, true, 0, (sizeof(resynchend_pak))); @@ -2770,9 +2768,6 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason) if (K_IsPlayerWanted(&players[playernum])) K_CalculateBattleWanted(); - if (gametyperules & GTR_TEAMFLAGS) - P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you! - LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting // don't look through someone's view who isn't there @@ -2808,10 +2803,8 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason) LUA_InvalidatePlayer(&players[playernum]); - if (G_BattleGametype()) // SRB2Kart - K_CheckBumpers(); - else if (gametyperules & GTR_RACE) - P_CheckRacers(); + K_CheckBumpers(); + P_CheckRacers(); } void CL_Reset(void) @@ -3793,9 +3786,7 @@ static void Got_AddBot(UINT8 **p, INT32 playernum) HU_AddChatText(va("\x82*Bot %d has been added to the game", newplayernum+1), false); } -#ifdef HAVE_BLUA LUAh_PlayerJoin(newplayernum); -#endif } static boolean SV_AddWaitingPlayers(const char *name, const char *name2, const char *name3, const char *name4) @@ -4835,8 +4826,6 @@ static void HandlePacketFromPlayer(SINT8 node) P_SetRandSeed(netbuffer->u.resynchend.randomseed); - if (gametyperules & GTR_TEAMFLAGS) - resynch_read_ctf(&netbuffer->u.resynchend); resynch_read_others(&netbuffer->u.resynchend); break; diff --git a/src/d_event.h b/src/d_event.h index 96327823b..c69796573 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -25,7 +25,6 @@ typedef enum ev_console, ev_mouse, ev_joystick, - ev_mouse2, ev_joystick2, ev_joystick3, ev_joystick4, diff --git a/src/d_main.c b/src/d_main.c index 8f8542859..7b7c7a79d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -984,7 +984,7 @@ void D_StartTitle(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - players[i].availabilities = R_GetSkinAvailabilities(); + players[g_localplayers[i]].availabilities = R_GetSkinAvailabilities(); } splitscreen = 0; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c49e796c0..80fe6b817 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -93,8 +93,6 @@ static void NumLaps_OnChange(void); static void BaseNumLaps_OnChange(void); static void Mute_OnChange(void); -static void Hidetime_OnChange(void); - static void AutoBalance_OnChange(void); static void TeamScramble_OnChange(void); @@ -103,11 +101,6 @@ static void JoinTimeout_OnChange(void); static void Lagless_OnChange (void); -static void CoopStarposts_OnChange(void); -static void CoopLives_OnChange(void); -static void ExitMove_OnChange(void); - -static void Ringslinger_OnChange(void); static void Gravity_OnChange(void); static void ForceSkin_OnChange(void); @@ -209,19 +202,9 @@ static void Command_KartGiveItem_f(void); // CLIENT VARIABLES // ========================================================================= -void SendWeaponPref(void); -void SendWeaponPref2(void); -void SendWeaponPref3(void); -void SendWeaponPref4(void); +void SendWeaponPref(UINT8 n); static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) -static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"}, - {2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}}; -#else -static CV_PossibleValue_t mouse2port_cons_t[] = {{1, "COM1"}, {2, "COM2"}, {3, "COM3"}, {4, "COM4"}, - {0, NULL}}; -#endif #ifdef LJOYSTICK static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"}, @@ -236,14 +219,7 @@ static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2 static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"}, - {3, "None"}, {0, NULL}}; -static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, {2, "Unchanging"}, - {3, "None"}, {0, NULL}}; - -static CV_PossibleValue_t match_scoring_cons_t[] = {{0, "Normal"}, {1, "Classic"}, {0, NULL}}; -static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}}; static CV_PossibleValue_t pause_cons_t[] = {{0, "Server"}, {1, "All"}, {0, NULL}}; consvar_t cv_showinputjoy = {"showinputjoy", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -265,8 +241,6 @@ consvar_t cv_startinglives = {"startinglives", "3", CV_NETVAR|CV_CHEAT|CV_NOSHOW static CV_PossibleValue_t respawntime_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "Off"}, {0, NULL}}; consvar_t cv_respawntime = {"respawndelay", "1", CV_NETVAR|CV_CHEAT, respawntime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_competitionboxes = {"competitionboxes", "Mystery", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - #ifdef SEENAMES static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}}; consvar_t cv_seenames = {"seenames", "Off", CV_SAVE, seenames_cons_t, 0, 0, NULL, NULL, 0, 0, NULL}; @@ -301,55 +275,39 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, INT32 cv_debug; consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick = {"use_gamepad", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick2 = {"use_gamepad2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = { + {"use_gamepad", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick, 0, NULL, NULL, 0, 0, NULL}, + {"use_gamepad2", "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} +}; #if (defined (LJOYSTICK) || defined (HAVE_SDL)) +consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { + {"padscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL}, + {"padscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL}, + {"padscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL}, + {"padscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL} +}; + #ifdef LJOYSTICK -consvar_t cv_joyport = {"padport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_joyport2 = {"padport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later +consvar_t cv_joyport[MAXSPLITSCREENPLAYERS] = { //Alam: for later + {"padport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padport3", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padport4", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} +}; #endif - -consvar_t cv_joyscale = {"padscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_joyscale2 = {"padscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_joyscale3 = {"padscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_joyscale4 = {"padscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL}; #else -consvar_t cv_joyscale = {"padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save -consvar_t cv_joyscale2 = {"padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save +consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = { //Alam: Dummy for save + {"padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padscale3", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}, + {"padscale4", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL} +}; #endif -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) -consvar_t cv_mouse2port = {"mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_mouse2opt = {"mouse2opt", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_mouse2port = {"mouse2port", "COM2", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif - -consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, matchboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -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_superring = {"superring", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -448,8 +406,6 @@ consvar_t cv_kartdebugcolorize = {"kartdebugcolorize", "Off", CV_NOSHOWHELP, CV_ static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}}; consvar_t cv_votetime = {"votetime", "20", CV_NETVAR, votetime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_ringslinger = {"ringslinger", "No", CV_NETVAR|CV_NOSHOWHELP|CV_CALL|CV_CHEAT, CV_YesNo, - Ringslinger_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_gravity = {"gravity", "0.8", CV_RESTRICT|CV_FLOAT|CV_CALL, NULL, Gravity_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_soundtest = {"soundtest", "0", CV_CALL, NULL, SoundTest_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -457,14 +413,10 @@ consvar_t cv_soundtest = {"soundtest", "0", CV_CALL, NULL, SoundTest_OnChange, 0 static CV_PossibleValue_t minitimelimit_cons_t[] = {{15, "MIN"}, {9999, "MAX"}, {0, NULL}}; consvar_t cv_countdowntime = {"countdowntime", "30", CV_NETVAR|CV_CHEAT, minitimelimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_touchtag = {"touchtag", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_hidetime = {"hidetime", "30", CV_NETVAR|CV_CALL|CV_NOSHOWHELP, minitimelimit_cons_t, Hidetime_OnChange, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_autobalance = {"autobalance", "Off", CV_NETVAR|CV_CALL, CV_OnOff, AutoBalance_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_teamscramble = {"teamscramble", "Off", CV_NETVAR|CV_CALL|CV_NOINIT, teamscramble_cons_t, TeamScramble_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_scrambleonchange = {"scrambleonchange", "Off", CV_NETVAR, teamscramble_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_friendlyfire = {"friendlyfire", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_itemfinder = {"itemfinder", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, ItemFinder_OnChange, 0, NULL, NULL, 0, 0, NULL}; // Scoring type options @@ -473,12 +425,6 @@ consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR|CV_CHEAT, overtime_cons_t, consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t timetic_cons_t[] = {{0, "Classic"}, {1, "Centiseconds"}, {2, "Mania"}, {3, "Tics"}, {0, NULL}}; -consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - -static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}}; -consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - static CV_PossibleValue_t pointlimit_cons_t[] = {{1, "MIN"}, {MAXSCORE, "MAX"}, {0, "None"}, {0, NULL}}; consvar_t cv_pointlimit = {"pointlimit", "None", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -524,20 +470,9 @@ consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}}; consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t coopstarposts_cons_t[] = {{0, "Per-player"}, {1, "Shared"}, {2, "Teamwork"}, {0, NULL}}; -consvar_t cv_coopstarposts = {"coopstarposts", "Per-player", CV_NETVAR|CV_CALL, coopstarposts_cons_t, CoopStarposts_OnChange, 0, NULL, NULL, 0, 0, NULL}; - -static CV_PossibleValue_t cooplives_cons_t[] = {{0, "Infinite"}, {1, "Per-player"}, {2, "Avoid Game Over"}, {3, "Single pool"}, {0, NULL}}; -consvar_t cv_cooplives = {"cooplives", "Avoid Game Over", CV_NETVAR|CV_CALL|CV_CHEAT, cooplives_cons_t, CoopLives_OnChange, 0, NULL, NULL, 0, 0, NULL}; - static CV_PossibleValue_t advancemap_cons_t[] = {{0, "Same"}, {1, "Next"}, {2, "Random"}, {3, "Vote"}, {0, NULL}}; consvar_t cv_advancemap = {"advancemap", "Vote", CV_NETVAR, advancemap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}}; -consvar_t cv_playersforexit = {"playersforexit", "All", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; - -consvar_t cv_exitmove = {"exitmove", "On", CV_NETVAR|CV_CALL, CV_OnOff, ExitMove_OnChange, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_pause = {"pausepermission", "Server", CV_NETVAR, pause_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -552,7 +487,7 @@ boolean timedemo_quit; INT16 gametype = GT_RACE; UINT32 gametyperules = 0; -INT16 gametypecount = (GT_CTF + 1); +INT16 gametypecount = GT_FIRSTFREESLOT; boolean deferencoremode = false; boolean circuitmap = false; @@ -710,10 +645,8 @@ void D_RegisterServerCommands(void) // p_mobj.c CV_RegisterVar(&cv_itemrespawntime); CV_RegisterVar(&cv_itemrespawn); - CV_RegisterVar(&cv_flagtime); // misc - CV_RegisterVar(&cv_friendlyfire); CV_RegisterVar(&cv_pointlimit); CV_RegisterVar(&cv_numlaps); CV_RegisterVar(&cv_basenumlaps); @@ -722,43 +655,15 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_teamscramble); CV_RegisterVar(&cv_scrambleonchange); - CV_RegisterVar(&cv_touchtag); - CV_RegisterVar(&cv_hidetime); - CV_RegisterVar(&cv_inttime); CV_RegisterVar(&cv_advancemap); - CV_RegisterVar(&cv_playersforexit); - CV_RegisterVar(&cv_exitmove); CV_RegisterVar(&cv_timelimit); CV_RegisterVar(&cv_playbackspeed); CV_RegisterVar(&cv_forceskin); CV_RegisterVar(&cv_downloading); - CV_RegisterVar(&cv_coopstarposts); - CV_RegisterVar(&cv_cooplives); - - CV_RegisterVar(&cv_specialrings); - CV_RegisterVar(&cv_powerstones); - CV_RegisterVar(&cv_competitionboxes); - CV_RegisterVar(&cv_matchboxes); - - /*CV_RegisterVar(&cv_recycler); - CV_RegisterVar(&cv_teleporters); - CV_RegisterVar(&cv_superring); - CV_RegisterVar(&cv_supersneakers); - CV_RegisterVar(&cv_invincibility); - CV_RegisterVar(&cv_jumpshield); - CV_RegisterVar(&cv_watershield); - CV_RegisterVar(&cv_ringshield); - CV_RegisterVar(&cv_forceshield); - CV_RegisterVar(&cv_bombshield); - CV_RegisterVar(&cv_1up); - CV_RegisterVar(&cv_eggmanbox);*/ - K_RegisterKartStuff(); // SRB2kart - CV_RegisterVar(&cv_ringslinger); - CV_RegisterVar(&cv_startinglives); CV_RegisterVar(&cv_countdowntime); CV_RegisterVar(&cv_runscripts); @@ -825,13 +730,13 @@ void D_RegisterClientCommands(void) { INT32 i; - for (i = 0; i < MAXSKINCOLORS; i++) + for (i = 0; i < numskincolors; i++) { Color_cons_t[i].value = i; Color_cons_t[i].strvalue = skincolors[i].name; } - Color_cons_t[MAXSKINCOLORS].value = 0; - Color_cons_t[MAXSKINCOLORS].strvalue = NULL; + Color_cons_t[numskincolors].value = 0; + Color_cons_t[numskincolors].strvalue = NULL; // Set default player names // Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well @@ -985,42 +890,18 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_pauseifunfocused); // g_input.c - CV_RegisterVar(&cv_turnaxis); - CV_RegisterVar(&cv_turnaxis2); - CV_RegisterVar(&cv_turnaxis3); - CV_RegisterVar(&cv_turnaxis4); - CV_RegisterVar(&cv_moveaxis); - 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); - CV_RegisterVar(&cv_lookaxis4); - CV_RegisterVar(&cv_fireaxis); - CV_RegisterVar(&cv_fireaxis2); - CV_RegisterVar(&cv_fireaxis3); - CV_RegisterVar(&cv_fireaxis4); - CV_RegisterVar(&cv_driftaxis); - CV_RegisterVar(&cv_driftaxis2); - CV_RegisterVar(&cv_driftaxis3); - CV_RegisterVar(&cv_driftaxis4); - CV_RegisterVar(&cv_deadzone); - CV_RegisterVar(&cv_deadzone2); - CV_RegisterVar(&cv_deadzone3); - CV_RegisterVar(&cv_deadzone4); - CV_RegisterVar(&cv_digitaldeadzone); - CV_RegisterVar(&cv_digitaldeadzone2); - CV_RegisterVar(&cv_digitaldeadzone3); - CV_RegisterVar(&cv_digitaldeadzone4); + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + CV_RegisterVar(&cv_turnaxis[i]); + CV_RegisterVar(&cv_moveaxis[i]); + CV_RegisterVar(&cv_brakeaxis[i]); + CV_RegisterVar(&cv_aimaxis[i]); + CV_RegisterVar(&cv_lookaxis[i]); + CV_RegisterVar(&cv_fireaxis[i]); + CV_RegisterVar(&cv_driftaxis[i]); + CV_RegisterVar(&cv_deadzone[i]); + CV_RegisterVar(&cv_digitaldeadzone[i]); + } // filesrch.c CV_RegisterVar(&cv_addons_option); @@ -1030,37 +911,22 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_addons_search_type); CV_RegisterVar(&cv_addons_search_case); - // WARNING: the order is important when initialising mouse2 - // we need the mouse2port - CV_RegisterVar(&cv_mouse2port); -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) - CV_RegisterVar(&cv_mouse2opt); -#endif CV_RegisterVar(&cv_controlperkey); CV_RegisterVar(&cv_usemouse); - CV_RegisterVar(&cv_usemouse2); CV_RegisterVar(&cv_invertmouse); - CV_RegisterVar(&cv_invertmouse2); CV_RegisterVar(&cv_mousesens); - CV_RegisterVar(&cv_mousesens2); CV_RegisterVar(&cv_mouseysens); - CV_RegisterVar(&cv_mouseysens2); //CV_RegisterVar(&cv_mousemove); - //CV_RegisterVar(&cv_mousemove2); - CV_RegisterVar(&cv_usejoystick); - CV_RegisterVar(&cv_usejoystick2); - CV_RegisterVar(&cv_usejoystick3); - CV_RegisterVar(&cv_usejoystick4); + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + CV_RegisterVar(&cv_usejoystick[i]); + CV_RegisterVar(&cv_joyscale[i]); #ifdef LJOYSTICK - CV_RegisterVar(&cv_joyport); - CV_RegisterVar(&cv_joyport2); + CV_RegisterVar(&cv_joyport[i]); #endif - CV_RegisterVar(&cv_joyscale); - CV_RegisterVar(&cv_joyscale2); - CV_RegisterVar(&cv_joyscale3); - CV_RegisterVar(&cv_joyscale4); + } // s_sound.c CV_RegisterVar(&cv_soundvolume); @@ -1377,24 +1243,11 @@ UINT8 CanChangeSkin(INT32 playernum) // Server has skin change restrictions. if (cv_restrictskinchange.value) { - if (gametyperules & GTR_FRIENDLY) - return true; - // Can change skin during initial countdown. if (leveltime < starttime) return true; - if (G_TagGametype()) - { - // Can change skin during hidetime. - if (leveltime < hidetime * TICRATE) - return true; - - // IT players can always change skins to persue players hiding in character only locations. - if (players[playernum].pflags & PF_TAGIT) - return true; - } - + // Not in game, so you can change if (players[playernum].spectator || players[playernum].playerstate == PST_DEAD || players[playernum].playerstate == PST_REBORN) return true; @@ -1406,7 +1259,7 @@ UINT8 CanChangeSkin(INT32 playernum) static void ForceAllSkins(INT32 forcedskin) { - INT32 i; + INT32 i, j; for (i = 0; i < MAXPLAYERS; ++i) { if (!playeringame[i]) @@ -1415,16 +1268,16 @@ static void ForceAllSkins(INT32 forcedskin) SetPlayerSkinByNum(i, forcedskin); // If it's me (or my brother (or my sister (or my trusty pet dog))), set appropriate skin value in cv_skin - if (!dedicated) // But don't do this for dedicated servers, of course. + if (dedicated) // But don't do this for dedicated servers, of course. + continue; + + for (j = 0; j <= splitscreen; j++) { - if (i == consoleplayer) - CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (i == g_localplayers[1]) - CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (i == g_localplayers[2]) - CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (i == g_localplayers[3]) - CV_StealthSet(&cv_skin4, skins[forcedskin].name); + if (i == g_localplayers[j]) + { + CV_StealthSet(&cv_skin[j], skins[forcedskin].name); + break; + } } } } @@ -1471,9 +1324,9 @@ static INT32 chmappending = 0; static void SendNameAndColor(UINT8 n) { const INT32 playernum = g_localplayers[n]; - const player_t *player = &players[playernum]; + player_t *player = &players[playernum]; - XBOXSTATIC char buf[MAXPLAYERNAME+2]; + char buf[MAXPLAYERNAME+6]; char *p; if (splitscreen < playernum) @@ -1485,12 +1338,12 @@ static void SendNameAndColor(UINT8 n) p = buf; // don't allow inaccessible colors - if (!skincolors[cv_playercolor.value].accessible) + if (!skincolors[cv_playercolor[n].value].accessible) { if (player->skincolor && skincolors[player->skincolor].accessible) CV_StealthSetValue(&cv_playercolor[n], player->skincolor); - else if (skins[player->skin].prefcolor && skincolors[player->skin].prefcolor].accessible) - CV_StealthSetValue(&cv_playercolor, skins[player->skin].prefcolor); + else if (skins[player->skin].prefcolor && skincolors[skins[player->skin].prefcolor].accessible) + CV_StealthSetValue(&cv_playercolor[n], skins[player->skin].prefcolor); else if (skincolors[atoi(cv_playercolor[n].defaultvalue)].accessible) CV_StealthSet(&cv_playercolor[n], cv_playercolor[n].defaultvalue); else { @@ -1560,7 +1413,7 @@ static void SendNameAndColor(UINT8 n) // check if player has the skin loaded (cv_skin may have // the name of a skin that was available in the previous game) - cv_skin[n].value = R_SkinAvailable(cv_skin.string); + cv_skin[n].value = R_SkinAvailable(cv_skin[n].string); if ((cv_skin[n].value < 0) || !R_SkinUsable(playernum, cv_skin[n].value)) { CV_StealthSet(&cv_skin[n], DEFAULTSKIN); @@ -1623,7 +1476,6 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (server && !P_IsLocalPlayer(p)) { boolean kick = false; - INT32 s; // team colors if (G_GametypeHasTeams()) @@ -1639,10 +1491,27 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) kick = true; // availabilities - for (s = 0; s < MAXSKINS; s++) + for (i = 0; i < MAXSKINS; i++) { - if (!skins[s].availability && (p->availabilities & (1 << s))) + UINT32 playerhasunlocked = (p->availabilities & (1 << i)); + boolean islocked = false; + UINT8 j; + + for (j = 0; j < MAXUNLOCKABLES; j++) { + if (unlockables[j].type != SECRET_SKIN) + continue; + + if (unlockables[j].variable == i) + { + islocked = true; + break; + } + } + + if (islocked == false && playerhasunlocked == true) + { + // hacked client that enabled every bit kick = true; break; } @@ -1677,13 +1546,15 @@ void SendWeaponPref(UINT8 n) // Player option cvars that need to be synched go HERE SendNetXCmdForPlayer(n, XD_WEAPONPREF, buf, 1); - SendNetXCmd(); } static void Got_WeaponPref(UINT8 **cp,INT32 playernum) { UINT8 prefs = READUINT8(*cp); + (void)prefs; + (void)playernum; + //players[playernum].pflags &= ~(PF_FLIPCAM); // Player option cvars that need to be synched go HERE } @@ -1724,13 +1595,7 @@ static void Got_PartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal splitscreen invitation received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -1761,13 +1626,7 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -1831,13 +1690,7 @@ static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal cancel splitscreen invite received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); } } @@ -1849,13 +1702,7 @@ static void Got_LeaveParty(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -2464,7 +2311,7 @@ void D_SetupVote(void) UINT8 secondgt = G_SometimesGetDifferentGametype(); INT16 votebuffer[3] = {-1,-1,-1}; - if ((cv_kartencore.value == 1) && G_RaceGametype()) + if ((cv_kartencore.value == 1) && (gametyperules & GTR_CIRCUIT)) WRITEUINT8(p, (gametype|0x80)); else WRITEUINT8(p, gametype); @@ -2593,6 +2440,7 @@ static void Command_Map_f(void) size_t first_option; size_t option_force; size_t option_gametype; + size_t option_encore; const char *gametypename; boolean newresetplayers; @@ -2604,6 +2452,7 @@ static void Command_Map_f(void) char *realmapname = NULL; INT32 newgametype = gametype; + boolean newencoremode = (cv_kartencore.value == 1); INT32 d; @@ -2615,6 +2464,7 @@ static void Command_Map_f(void) option_force = COM_CheckPartialParm("-f"); option_gametype = COM_CheckPartialParm("-g"); + option_encore = COM_CheckPartialParm("-e"); newresetplayers = ! COM_CheckParm("-noresetplayers"); mustmodifygame = !(netgame || multiplayer) && !majormods; @@ -2719,21 +2569,18 @@ static void Command_Map_f(void) } // new encoremode value - // use cvar by default - - newencoremode = (cv_kartencore.value == 1); - - if (COM_CheckParm("-encore")) + if (option_encore) { - if (!M_SecretUnlocked(SECRET_ENCORE) && !newencoremode) + newencoremode = !newencoremode; + + if (!M_SecretUnlocked(SECRET_ENCORE) && newencoremode == true && !option_force) { CONS_Alert(CONS_NOTICE, M_GetText("You haven't unlocked Encore Mode yet!\n")); return; } - newencoremode = !newencoremode; } - if (!(i = COM_CheckParm("-force")) && newgametype == gametype) // SRB2Kart + if (!option_force && newgametype == gametype) // SRB2Kart newresetplayers = false; // if not forcing and gametypes is the same // don't use a gametype the map doesn't support @@ -2829,7 +2676,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) else if (gametype != lastgametype) D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype - if (!G_RaceGametype()) + if (!(gametyperules & GTR_CIRCUIT)) pencoremode = false; skipprecutscene = ((flags & (1<<2)) != 0); @@ -2861,7 +2708,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) { SetPlayerSkinByNum(0, cv_chooseskin.value-1); players[0].skincolor = skins[players[0].skin].prefcolor; - CV_StealthSetValue(&cv_playercolor, players[0].skincolor); + CV_StealthSetValue(&cv_playercolor[0], players[0].skincolor); } mapnumber = M_MapNumber(mapname[3], mapname[4]); @@ -2870,7 +2717,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING; demo.savebutton = 0; - G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS); + G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene, FLS); if (demo.playback && !demo.timing) precache = true; if (demo.timing) @@ -2998,7 +2845,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) INT32 respawnplayer = READINT32(*cp); // You can't respawn someone else. Nice try, there. - if (respawnplayer != playernum || players[respawnplayer].kartstuff[k_spinouttimer] || spbplace == players[respawnplayer].kartstuff[k_position]) // srb2kart: "|| (!G_RaceGametype())" + if (respawnplayer != playernum || players[respawnplayer].kartstuff[k_spinouttimer] || spbplace == players[respawnplayer].kartstuff[k_position]) // srb2kart: "|| (!(gametyperules & GTR_CIRCUIT))" { CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); if (server) @@ -3173,13 +3020,6 @@ static void HandleTeamChangeCommand(UINT8 localplayer) return; } - //additional check for hide and seek. Don't allow change of status after hidetime ends. - if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE)) - { - CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n")); - return; - } - usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); SendNetXCmdForPlayer(localplayer, XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); } @@ -3222,9 +3062,7 @@ static void Command_ServerTeamChange_f(void) if (COM_Argc() < 3) { - if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); - else if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); @@ -3233,20 +3071,7 @@ static void Command_ServerTeamChange_f(void) return; } - if (G_TagGametype()) - { - if (!strcasecmp(COM_Argv(2), "it") || !strcasecmp(COM_Argv(2), "1")) - NetPacket.packet.newteam = 1; - else if (!strcasecmp(COM_Argv(2), "notit") || !strcasecmp(COM_Argv(2), "2")) - NetPacket.packet.newteam = 2; - else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "3")) - NetPacket.packet.newteam = 3; - else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0")) - NetPacket.packet.newteam = 0; - else - error = true; - } - else if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) { if (!strcasecmp(COM_Argv(2), "red") || !strcasecmp(COM_Argv(2), "1")) NetPacket.packet.newteam = 1; @@ -3274,9 +3099,7 @@ static void Command_ServerTeamChange_f(void) if (error) { - if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); - else if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); @@ -3291,15 +3114,7 @@ static void Command_ServerTeamChange_f(void) return; } - if (G_TagGametype()) - { - if (( (players[NetPacket.packet.playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 1) || - (!(players[NetPacket.packet.playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 2) || - ( players[NetPacket.packet.playernum].spectator && !NetPacket.packet.newteam) || - (!players[NetPacket.packet.playernum].spectator && NetPacket.packet.newteam == 3)) - error = true; - } - else if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) { if (NetPacket.packet.newteam == (unsigned)players[NetPacket.packet.playernum].ctfteam || (players[NetPacket.packet.playernum].spectator && !NetPacket.packet.newteam)) @@ -3322,13 +3137,6 @@ static void Command_ServerTeamChange_f(void) return; } - //additional check for hide and seek. Don't allow change of status after hidetime ends. - if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE)) - { - CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n")); - return; - } - NetPacket.packet.verification = true; // This signals that it's a server change usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); @@ -3365,13 +3173,6 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // Prevent multiple changes in one go. if (players[playernum].spectator && !(players[playernum].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam) return; - else if (G_TagGametype()) - { - if (((players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 1) || - (!(players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 2) || - (!players[playernum].spectator && NetPacket.packet.newteam == 3)) - return; - } else if (G_GametypeHasTeams()) { if (NetPacket.packet.newteam && (NetPacket.packet.newteam == (unsigned)players[playernum].ctfteam)) @@ -3397,49 +3198,16 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled)) return; - //no status changes after hidetime - if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE))) - error = true; - //Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes. - switch (gametype) - { - case GT_HIDEANDSEEK: - //no status changes after hidetime - if (leveltime >= (hidetime * TICRATE)) - { - error = true; - break; - } - /* FALLTHRU */ - case GT_TAG: - switch (NetPacket.packet.newteam) - { - case 0: - break; - case 1: case 2: - if (!NetPacket.packet.verification) - error = true; //Only admin can change player's IT status' in tag. - break; - case 3: //Join game via console. - if (!NetPacket.packet.verification && !cv_allowteamchange.value) - error = true; - break; - } - - break; - default: #ifdef PARANOIA - if (!G_GametypeHasTeams() && !G_GametypeHasSpectators()) - I_Error("Invalid gametype after initial checks!"); + if (!G_GametypeHasTeams() && !G_GametypeHasSpectators()) + I_Error("Invalid gametype after initial checks!"); #endif - if (!cv_allowteamchange.value) - { - if (!NetPacket.packet.verification && NetPacket.packet.newteam) - error = true; //Only admin can change status, unless changing to spectator. - } - break; //Otherwise, you don't need special permissions. + if (!cv_allowteamchange.value) + { + if (!NetPacket.packet.verification && NetPacket.packet.newteam) + error = true; //Only admin can change status, unless changing to spectator. } if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error)) @@ -3466,37 +3234,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) //Now that we've done our error checking and killed the player //if necessary, put the player on the correct team/status. - if (G_TagGametype()) - { - if (!NetPacket.packet.newteam) - { - players[playernum].spectator = true; - players[playernum].pflags &= ~PF_TAGIT; - players[playernum].pflags &= ~PF_GAMETYPEOVER; - } - else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2. - { - players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false; - players[playernum].pflags &= ~PF_GAMETYPEOVER; //Just in case. - - if (NetPacket.packet.newteam == 1) //Make the player IT. - players[playernum].pflags |= PF_TAGIT; - else - players[playernum].pflags &= ~PF_TAGIT; - } - else // Just join the game. - { - players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false; - - //If joining after hidetime in normal tag, default to being IT. - if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG) && (leveltime > (hidetime * TICRATE))) - { - NetPacket.packet.newteam = 1; //minor hack, causes the "is it" message to be printed later. - players[playernum].pflags |= PF_TAGIT; //make the player IT. - } - } - } - else if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) { if (!NetPacket.packet.newteam) { @@ -3533,44 +3271,36 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) } else if (NetPacket.packet.newteam == 1) { - if (G_TagGametype()) - CONS_Printf(M_GetText("%s is now IT!\n"), player_names[playernum]); - else - CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x85', M_GetText("Red Team"), '\x80'); + CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x85', M_GetText("Red Team"), '\x80'); } else if (NetPacket.packet.newteam == 2) { - if (G_TagGametype()) - CONS_Printf(M_GetText("%s is no longer IT!\n"), player_names[playernum]); - else - CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); + CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); } else if (NetPacket.packet.newteam == 0) HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame //reset view if you are changed, or viewing someone who was changed. - if (playernum == consoleplayer || g_localplayers[0] == playernum) + if (playernum == consoleplayer || displayplayers[0] == playernum) { // Call ViewpointSwitch hooks here. // The viewpoint was forcibly changed. - if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal. + if (displayplayers[0] != consoleplayer) // You're already viewing yourself. No big deal. LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true); - g_localplayers[0] = consoleplayer; + displayplayers[0] = consoleplayer; } if (G_GametypeHasTeams()) { if (NetPacket.packet.newteam) { - if (playernum == consoleplayer) //CTF and Team Match colors. - CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5); - else if (playernum == displayplayers[1]) - CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5); - else if (playernum == displayplayers[2]) - CV_SetValue(&cv_playercolor3, NetPacket.packet.newteam + 5); - else if (playernum == displayplayers[3]) - CV_SetValue(&cv_playercolor4, NetPacket.packet.newteam + 5); + UINT8 i; + for (i = 0; i <= splitscreen; i++) + { + if (playernum == g_localplayers[i]) //CTF and Team Match colors. + CV_SetValue(&cv_playercolor[i], NetPacket.packet.newteam + 5); + } } } @@ -3582,7 +3312,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // Clear player score and rings if a spectator. if (players[playernum].spectator) { - if (G_BattleGametype()) // SRB2kart + if (gametyperules & GTR_BUMPERS) // SRB2kart { players[playernum].marescore = 0; if (K_IsPlayerWanted(&players[playernum])) @@ -3591,15 +3321,12 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) K_PlayerForfeit(playernum, true); - players[playernum].health = 1; if (players[playernum].mo) players[playernum].mo->health = 1; } - if (G_BattleGametype()) - K_CheckBumpers(); // SRB2Kart - else if (G_RaceGametype()) - P_CheckRacers(); // also SRB2Kart + K_CheckBumpers(); // SRB2Kart + P_CheckRacers(); // also SRB2Kart } // @@ -4360,7 +4087,7 @@ static void PointLimit_OnChange(void) static void NumLaps_OnChange(void) { - if (!G_RaceGametype() || (modeattacking || demo.playback)) + if (!(gametyperules & GTR_CIRCUIT) || (modeattacking || demo.playback)) return; if (server && Playing() @@ -4370,7 +4097,7 @@ static void NumLaps_OnChange(void) CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); // Just don't be verbose - if (gametyperules & GTR_RACE) + if (gametyperules & GTR_CIRCUIT) CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value); } @@ -4392,127 +4119,6 @@ Lagless_OnChange (void) server_lagless = true; } -static void CoopStarposts_OnChange(void) -{ - INT32 i; - - if (!(netgame || multiplayer) || !G_GametypeUsesCoopStarposts()) - return; - - switch (cv_coopstarposts.value) - { - case 0: - CONS_Printf(M_GetText("Starposts are now per-player.\n")); - break; - case 1: - CONS_Printf(M_GetText("Starposts are now shared between players.\n")); - break; - case 2: - CONS_Printf(M_GetText("Players now only spawn when starposts are hit.\n")); - return; - } - - if (G_IsSpecialStage(gamemap)) - return; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - - if (!players[i].spectator) - continue; - - if (players[i].lives <= 0) - continue; - - break; - } - - if (i == MAXPLAYERS) - return; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - - if (!players[i].spectator) - continue; - - if (players[i].lives <= 0 && (cv_cooplives.value == 1)) - continue; - - P_SpectatorJoinGame(&players[i]); - } -} - -static void CoopLives_OnChange(void) -{ - INT32 i; - - if (!(netgame || multiplayer) || !G_GametypeUsesCoopLives()) - return; - - switch (cv_cooplives.value) - { - case 0: - CONS_Printf(M_GetText("Players can now respawn indefinitely.\n")); - break; - case 1: - CONS_Printf(M_GetText("Lives are now per-player.\n")); - return; - case 2: - CONS_Printf(M_GetText("Players can now steal lives to avoid game over.\n")); - break; - case 3: - CONS_Printf(M_GetText("Lives are now shared between players.\n")); - break; - } - - if (cv_coopstarposts.value == 2) - return; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - - if (!players[i].spectator) - continue; - - if (players[i].lives > 0) - continue; - - P_SpectatorJoinGame(&players[i]); - } -} - -static void ExitMove_OnChange(void) -{ - UINT8 i; - - if (!(netgame || multiplayer) || !(gametyperules & GTR_FRIENDLY)) - return; - - if (cv_exitmove.value) - { - for (i = 0; i < MAXPLAYERS; ++i) - if (playeringame[i] && players[i].mo) - { - if (players[i].mo->target && players[i].mo->target->type == MT_SIGN) - P_SetTarget(&players[i].mo->target, NULL); - - if (players[i].pflags & PF_FINISHED) - P_GiveFinishFlags(&players[i]); - } - - CONS_Printf(M_GetText("Players can now move after completing the level.\n")); - } - else - CONS_Printf(M_GetText("Players can no longer move after completing the level.\n")); -} - UINT32 timelimitintics = 0; /** Deals with a timelimit change by printing the change to the console. @@ -4537,10 +4143,6 @@ static void TimeLimit_OnChange(void) CONS_Printf(M_GetText("Levels will end after %d second%s.\n"),cv_timelimit.value,cv_timelimit.value == 1 ? "" : "s"); // Graue 11-17-2003 timelimitintics = cv_timelimit.value * TICRATE; - //add hidetime for tag too! - if (G_TagGametype()) - timelimitintics += hidetime * TICRATE; - // Note the deliberate absence of any code preventing // pointlimit and timelimit from being set simultaneously. // Some people might like to use them together. It works. @@ -4574,33 +4176,13 @@ void D_GameTypeChanged(INT32 lastgametype) // There will always be a server, and this only needs to be done once. if (server && (multiplayer || netgame)) { - if (gametype == GT_COMPETITION) - CV_SetValue(&cv_itemrespawn, 0); - else if (!cv_itemrespawn.changed || lastgametype == GT_COMPETITION) - CV_SetValue(&cv_itemrespawn, 1); - - switch (gametype) + if (!cv_timelimit.changed) // user hasn't changed limits { - case GT_BATTLE: - if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits - { - // default settings for match: 2 mins, no pointlimit - CV_SetValue(&cv_pointlimit, 0); - CV_SetValue(&cv_timelimit, 120); - } - if (!cv_itemrespawntime.changed) - CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally - break; - - default: - if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits - { - CV_SetValue(&cv_timelimit, timelimits[gametype]); - CV_SetValue(&cv_pointlimit, pointlimits[gametype]); - } - if (!cv_itemrespawntime.changed) - CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally - break; + CV_SetValue(&cv_timelimit, timelimits[gametype]); + } + if (!cv_pointlimit.changed) + { + CV_SetValue(&cv_pointlimit, pointlimits[gametype]); } } else if (!multiplayer && !netgame) @@ -4611,20 +4193,16 @@ void D_GameTypeChanged(INT32 lastgametype) // reset timelimit and pointlimit in race/coop, prevent stupid cheats if (server) { - if (!(gametyperules & GTR_POINTLIMIT)) + if (!(gametyperules & GTR_TIMELIMIT)) { if (cv_timelimit.value) CV_SetValue(&cv_timelimit, 0); + } + if (!(gametyperules & GTR_POINTLIMIT)) + { if (cv_pointlimit.value) CV_SetValue(&cv_pointlimit, 0); } - else if ((cv_pointlimit.changed || cv_timelimit.changed) && cv_pointlimit.value) - { - if (lastgametype != GT_CTF && gametype == GT_CTF) - CV_SetValue(&cv_pointlimit, cv_pointlimit.value / 500); - else if (lastgametype == GT_CTF && gametype != GT_CTF) - CV_SetValue(&cv_pointlimit, cv_pointlimit.value * 500); - } } // don't retain teams in other modes or between changes from ctf to team match. @@ -4644,19 +4222,6 @@ void D_GameTypeChanged(INT32 lastgametype) } } -static void Ringslinger_OnChange(void) -{ - if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && cv_ringslinger.value && !cv_debug) - { - CONS_Printf(M_GetText("You haven't earned this yet.\n")); - CV_StealthSetValue(&cv_ringslinger, 0); - return; - } - - if (cv_ringslinger.value) // Only if it's been turned on - G_SetGameModified(multiplayer, true); -} - static void Gravity_OnChange(void) { if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug @@ -4850,21 +4415,6 @@ retryscramble: } } -static void Hidetime_OnChange(void) -{ - if (Playing() && G_TagGametype() && leveltime >= (hidetime * TICRATE)) - { - // Don't allow hidetime changes after it expires. - CV_StealthSetValue(&cv_hidetime, hidetime); - return; - } - hidetime = cv_hidetime.value; - - //uh oh, gotta change timelimitintics now too - if (G_TagGametype()) - timelimitintics = (cv_timelimit.value * TICRATE) + (hidetime * TICRATE); -} - static void Command_Showmap_f(void) { if (gamestate == GS_LEVEL) @@ -4904,7 +4454,7 @@ static void Command_Mapmd5_f(void) static void Command_ExitLevel_f(void) { - if (!(netgame || (multiplayer && gametype != GT_COOP)) && !cv_debug) + if (!(netgame || multiplayer) && !cv_debug) CONS_Printf(M_GetText("This only works in a netgame.\n")); else if (!(server || (IsPlayerAdmin(consoleplayer)))) CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); @@ -4942,13 +4492,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -4987,13 +4531,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -5019,13 +4557,7 @@ static void Got_GiveItemcmd(UINT8 **cp, INT32 playernum) M_GetText ("Illegal give item received from %s\n"), player_names[playernum]); if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } + SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); return; } @@ -5085,7 +4617,7 @@ void Command_ExitGame_f(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - players[i].availabilities = R_GetSkinAvailabilities(); + players[g_localplayers[i]].availabilities = R_GetSkinAvailabilities(); } splitscreen = 0; @@ -5624,7 +5156,7 @@ static void Command_ShowTime_f(void) // SRB2Kart: On change messages static void BaseNumLaps_OnChange(void) { - if (gametyperules & GTR_RACE && gamestate == GS_LEVEL) + if (gametyperules & GTR_CIRCUIT && gamestate == GS_LEVEL) { if (cv_basenumlaps.value) CONS_Printf(M_GetText("Number of laps will be changed to %d next round.\n"), cv_basenumlaps.value); @@ -5654,7 +5186,7 @@ static void KartSpeed_OnChange(void) return; } - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { if ((gamestate == GS_LEVEL && leveltime < starttime) && (cv_kartspeed.value != KARTSPEED_AUTO)) { @@ -5670,7 +5202,7 @@ static void KartSpeed_OnChange(void) static void KartEncore_OnChange(void) { - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { if ((cv_kartencore.value == 1) != encoremode && gamestate == GS_LEVEL /*&& leveltime > starttime*/) CONS_Printf(M_GetText("Encore Mode will be set to %s next round.\n"), cv_kartencore.string); @@ -5681,7 +5213,7 @@ static void KartEncore_OnChange(void) static void KartComeback_OnChange(void) { - if (G_BattleGametype()) + if (gametyperules & GTR_KARMA) { if ((boolean)cv_kartcomeback.value != comeback && gamestate == GS_LEVEL && leveltime > starttime) CONS_Printf(M_GetText("Karma Comeback will be turned %s next round.\n"), cv_kartcomeback.value ? M_GetText("on") : M_GetText("off")); @@ -5695,6 +5227,6 @@ static void KartComeback_OnChange(void) static void KartEliminateLast_OnChange(void) { - if (G_RaceGametype() && cv_karteliminatelast.value) + if ((gametyperules & GTR_CIRCUIT) && cv_karteliminatelast.value) P_CheckRacers(); } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 6fa09ee24..eaf2c9f82 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -28,36 +28,16 @@ extern consvar_t cv_splitplayers; extern consvar_t cv_seenames, cv_allowseenames; #endif extern consvar_t cv_usemouse; -extern consvar_t cv_usejoystick; -extern consvar_t cv_usejoystick2; -extern consvar_t cv_usejoystick3; -extern consvar_t cv_usejoystick4; +extern consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS]; #ifdef LJOYSTICK -extern consvar_t cv_joyport; -extern consvar_t cv_joyport2; -#endif -extern consvar_t cv_joyscale; -extern consvar_t cv_joyscale2; -extern consvar_t cv_joyscale3; -extern consvar_t cv_joyscale4; - -// splitscreen with second mouse -extern consvar_t cv_mouse2port; -extern consvar_t cv_usemouse2; -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) -extern consvar_t cv_mouse2opt; +extern consvar_t cv_joyport[MAXSPLITSCREENPLAYERS]; #endif // normally in p_mobj but the .h is not read extern consvar_t cv_itemrespawntime; extern consvar_t cv_itemrespawn; -extern consvar_t cv_flagtime; - -extern consvar_t cv_touchtag; -extern consvar_t cv_hidetime; - -extern consvar_t cv_friendlyfire; extern consvar_t cv_pointlimit; extern consvar_t cv_timelimit; extern consvar_t cv_numlaps; @@ -82,11 +62,6 @@ extern consvar_t cv_pause; extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_ingamecap, cv_respawntime; -/*extern consvar_t cv_teleporters, cv_superring, cv_supersneakers, cv_invincibility; -extern consvar_t cv_jumpshield, cv_watershield, cv_ringshield, cv_forceshield, cv_bombshield; -extern consvar_t cv_1up, cv_eggmanbox; -extern consvar_t cv_recycler;*/ - // SRB2kart items extern consvar_t cv_superring, cv_sneaker, cv_rocketsneaker, cv_invincibility, cv_banana; extern consvar_t cv_eggmanmonitor, cv_orbinaut, cv_jawz, cv_mine; @@ -120,16 +95,14 @@ extern consvar_t cv_kartdebugwaypoints; extern consvar_t cv_itemfinder; -extern consvar_t cv_inttime, cv_coopstarposts, cv_cooplives, cv_advancemap, cv_playersforexit, cv_exitmove; +extern consvar_t cv_inttime, cv_advancemap; extern consvar_t cv_overtime; extern consvar_t cv_startinglives; // for F_finale.c extern consvar_t cv_rollingdemos; -extern consvar_t cv_ringslinger, cv_soundtest; - -extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes; +extern consvar_t cv_soundtest; extern consvar_t cv_maxping; extern consvar_t cv_lagless; diff --git a/src/dehacked.c b/src/dehacked.c index 8752bdac7..ab938fdf8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -10810,7 +10810,6 @@ static const char *const POWERS_LIST[] = { "IGNORELATCH" }; -#ifdef HAVE_BLUA static const char *const KARTSTUFF_LIST[] = { "POSITION", "OLDPOSITION", @@ -10904,7 +10903,6 @@ static const char *const KARTSTUFF_LIST[] = { "KILLFIELD", "WRONGWAY" }; -#endif static const char *const HUDITEMS_LIST[] = { "LIVES", @@ -11133,20 +11131,9 @@ struct { {"NUMTRANSMAPS",NUMTRANSMAPS}, // Type of levels - {"TOL_SP",TOL_SP}, - {"TOL_COOP",TOL_COOP}, - {"TOL_COMPETITION",TOL_COMPETITION}, {"TOL_RACE",TOL_RACE}, - {"TOL_MATCH",TOL_MATCH}, - {"TOL_TAG",TOL_TAG}, - {"TOL_CTF",TOL_CTF}, - {"TOL_CUSTOM",TOL_CUSTOM}, - {"TOL_2D",TOL_2D}, - {"TOL_MARIO",TOL_MARIO}, - {"TOL_NIGHTS",TOL_NIGHTS}, + {"TOL_BATTLE",TOL_BATTLE}, {"TOL_TV",TOL_TV}, - {"TOL_XMAS",TOL_XMAS}, - //{"TOL_KART",TOL_KART}, // Level flags {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, @@ -11800,7 +11787,8 @@ static menutype_t get_menutype(const char *word) return MN_NONE; } -/*static INT16 get_gametype(const char *word) +/* +static INT16 get_gametype(const char *word) { // Returns the value of GT_ enumerations INT16 i; if (*word >= '0' && *word <= '9') @@ -11826,7 +11814,8 @@ static powertype_t get_power(const char *word) return i; deh_warning("Couldn't find power named 'pw_%s'",word); return pw_invulnerability; -}*/ +} +*/ /// \todo Make ANY of this completely over-the-top math craziness obey the order of operations. static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; } @@ -11854,7 +11843,8 @@ struct { }; // Returns the full word, cut at the first symbol or whitespace -/*static char *read_word(const char *line) +/* +static char *read_word(const char *line) { // Part 1: You got the start of the word, now find the end. const char *p; @@ -12078,7 +12068,8 @@ static fixed_t find_const(const char **rword) const_warning("constant",word); free(word); return 0; -}*/ +} +*/ // Loops through every constant and operation in word and performs its calculations, returning the final value. fixed_t get_number(const char *word) diff --git a/src/doomdata.h b/src/doomdata.h index d3257058e..f6e1e9697 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -218,9 +218,6 @@ typedef struct #define ZSHIFT 4 -//extern const char *Color_Names[MAXSKINCOLORS]; -//extern const UINT8 Color_Opposite[MAXSKINCOLORS*2]; - #define NUMMAPS 1035 #endif // __DOOMDATA__ diff --git a/src/doomstat.h b/src/doomstat.h index 3aba119da..fa946b8dc 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -451,38 +451,31 @@ enum GameType // Gametype rules enum GameTypeRules { - GTR_CAMPAIGN = 1, // Linear Co-op map progression, don't allow random maps - GTR_RINGSLINGER = 1<<1, // Outside of Co-op, Competition, and Race (overriden by cv_ringslinger) - GTR_SPECTATORS = 1<<2, // Outside of Co-op, Competition, and Race - GTR_LIVES = 1<<3, // Co-op and Competition - GTR_TEAMS = 1<<4, // Team Match, CTF - GTR_FIRSTPERSON = 1<<5, // First person camera - GTR_POWERSTONES = 1<<6, // Power stones (Match and CTF) - GTR_TEAMFLAGS = 1<<7, // Gametype has team flags (CTF) - GTR_FRIENDLY = 1<<8, // Co-op - GTR_SPECIALSTAGES = 1<<9, // Allow special stages - GTR_EMERALDTOKENS = 1<<10, // Spawn emerald tokens - GTR_EMERALDHUNT = 1<<11, // Emerald Hunt - GTR_RACE = 1<<12, // Race and Competition - GTR_TAG = 1<<13, // Tag and Hide and Seek - GTR_POINTLIMIT = 1<<14, // Ringslinger point limit - GTR_TIMELIMIT = 1<<15, // Ringslinger time limit - GTR_OVERTIME = 1<<16, // Allow overtime - GTR_HURTMESSAGES = 1<<17, // Hit and death messages - GTR_FRIENDLYFIRE = 1<<18, // Always allow friendly fire - GTR_STARTCOUNTDOWN = 1<<19, // Hide time countdown (Tag and Hide and Seek) - GTR_HIDEFROZEN = 1<<20, // Frozen after hide time (Hide and Seek, but not Tag) - GTR_BLINDFOLDED = 1<<21, // Blindfolded view (Tag and Hide and Seek) - GTR_RESPAWNDELAY = 1<<22, // Respawn delay - GTR_PITYSHIELD = 1<<23, // Award pity shield - GTR_DEATHPENALTY = 1<<24, // Death score penalty - GTR_NOSPECTATORSPAWN = 1<<25, // Use with GTR_SPECTATORS, spawn in the map instead of with the spectators - GTR_DEATHMATCHSTARTS = 1<<26, // Use deathmatch starts - GTR_SPAWNINVUL = 1<<27, // Babysitting deterrent - GTR_SPAWNENEMIES = 1<<28, // Spawn enemies - GTR_ALLOWEXIT = 1<<29, // Allow exit sectors - GTR_NOTITLECARD = 1<<30, // Don't show the title card - GTR_CUTSCENES = 1<<31, // Play cutscenes, ending, credits, and evaluation + // Race rules + GTR_CIRCUIT = 1, // Enables the finish line, laps, and the waypoint system. + GTR_RINGS = 1<<1, // Rings will be spawned in this mode. (Don't get too cheeky, ring sting is still enabled :]) + GTR_BOTS = 1<<2, // Allows bots in this gametype. Combine with BotTiccmd hooks to make bots support your gametype. + + // Battle gametype rules + GTR_BUMPERS = 1<<3, // Enables the bumper health system + GTR_KARMA = 1<<4, // Enables the Karma system if you're out of bumpers + GTR_ITEMARROWS = 1<<5, // Show item box arrows above players + GTR_BATTLESTARTS = 1<<6, // Use Battle Mode start positions. + GTR_POINTLIMIT = 1<<7, // Reaching point limit ends the round + GTR_TIMELIMIT = 1<<8, // Reaching time limit ends the round + GTR_OVERTIME = 1<<9, // Allow overtime behavior + + // Custom gametype rules + GTR_TEAMS = 1<<10, // Teams are forced on + GTR_NOTEAMS = 1<<11, // Teams are forced off + GTR_TEAMSTARTS = 1<<12, // Use team-based start positions + + // Grand Prix rules + GTR_CAMPAIGN = 1<<13, // Handles cup-based progression + GTR_LIVES = 1<<14, // Lives system, players are forced to spectate during Game Over. + GTR_SPECIALBOTS = 1<<15, // Bot difficulty gets stronger between rounds, and the rival system is enabled. + + // free: to and including 1<<31 }; // String names for gametypes @@ -672,8 +665,6 @@ extern INT16 votelevels[5][2]; extern SINT8 votes[MAXPLAYERS]; extern SINT8 pickedvote; -extern tic_t hidetime; - extern UINT32 timesBeaten; // # of times the game has been beaten. extern UINT32 timesBeatenWithEmeralds; //extern UINT32 timesBeatenUltimate; diff --git a/src/f_finale.c b/src/f_finale.c index 6c98cd02d..3c82a2684 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3177,314 +3177,6 @@ void F_WaitingPlayersDrawer(void) V_DrawFixedPatch((160<width / 2, 150<contangle & 7; - contcolormaps[0] = R_GetTranslationColormap(players[consoleplayer].skin, players[consoleplayer].skincolor, GTC_CACHE); - cont_spr2[0][4] = contskins[0]->sprites[cont_spr2[0][0]].numframes; - cont_spr2[0][5] = max(1, contskins[0]->contspeed); - - if (botskin) - { - INT32 secondplaya; - - if (secondarydisplayplayer != consoleplayer) - secondplaya = secondarydisplayplayer; - else // HACK - secondplaya = 1; - - contskins[1] = &skins[players[secondplaya].skin]; - cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT4, NULL); - cont_spr2[1][2] = (contskins[1]->contangle >> 3) & 7; - contcolormaps[1] = R_GetTranslationColormap(players[secondplaya].skin, players[secondplaya].skincolor, GTC_CACHE); - cont_spr2[1][4] = contskins[1]->sprites[cont_spr2[1][0]].numframes; - if (cont_spr2[1][0] == SPR2_CNT4) - cont_spr2[1][5] = 4; // sorry, this one is hardcoded - else - cont_spr2[1][5] = max(1, contskins[1]->contspeed); - } - else - { - contskins[1] = NULL; - contcolormaps[1] = NULL; - cont_spr2[1][0] = cont_spr2[1][2] = cont_spr2[1][4] = cont_spr2[1][5] = 0; - } - - cont_spr2[0][1] = cont_spr2[0][3] =\ - cont_spr2[1][1] = cont_spr2[1][3] = 0; - - timetonext = (11*TICRATE)+11; - continuetime = 0; -} - -// -// F_ContinueDrawer -// Moved continuing out of the HUD (hack removal!!) -// -void F_ContinueDrawer(void) -{ - spritedef_t *sprdef; - spriteframe_t *sprframe; - patch_t *patch; - INT32 i, x = (BASEVIDWIDTH>>1), ncontinues = players[consoleplayer].continues; - char numbuf[9] = "CONTNUM*"; - tic_t timeleft = (timetonext/TICRATE); - INT32 offsx = 0, offsy = 0, lift[2] = {0, 0}; - - if (continuetime >= 3*TICRATE) - { - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); - return; - } - - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - - if (timetonext >= (11*TICRATE)+10) - return; - - V_DrawLevelTitle(x - (V_LevelNameWidth("Continue?")>>1), 16, 0, "Continue?"); - - // Two stars... - patch = W_CachePatchName("CONTSTAR", PU_PATCH); - V_DrawScaledPatch(x-32, 160, 0, patch); - V_DrawScaledPatch(x+32, 160, 0, patch); - - // Time left! - if (timeleft > 9) - { - numbuf[7] = '1'; - V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH)); - numbuf[7] = '0'; - V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH)); - } - else - { - numbuf[7] = '0'+timeleft; - V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH)); - } - - // Draw the continue markers! Show continues. - if (!continuesInSession) - ; - else if (ncontinues > 10) - { - if (!(continuetime & 1) || continuetime > 17) - V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor); - V_DrawScaledPatch(x+12, 66, 0, stlivex); - V_DrawRightAlignedString(x+38, 64, 0, - va("%d",(imcontinuing ? ncontinues-1 : ncontinues))); - } - else - { - x += (ncontinues/2) * 30; - if (!(ncontinues & 1)) - x -= 15; - for (i = 0; i < ncontinues; ++i) - { - if (i == (ncontinues/2) && ((continuetime & 1) || continuetime > 17)) - continue; - V_DrawContinueIcon(x - (i*30), 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor); - } - x = BASEVIDWIDTH>>1; - } - - // Spotlight - V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH)); - - // warping laser - if (continuetime) - { - INT32 w = min(continuetime, 28), brightness = (continuetime>>1) & 7; - if (brightness > 3) - brightness = 8-brightness; - V_DrawFadeFill(x-w, 0, w<<1, 140, 0, 0, (3+brightness)); - } - - if (contskins[1]) - { - if (continuetime > 15) - { - angle_t work = FixedAngle((10*(continuetime-15))<>ANGLETOFINESHIFT; - offsy = FINESINE(work)<<1; - offsx = (27*FINECOSINE(work))>>1; - } - else - offsx = 27<<(FRACBITS-1); - lift[1] = continuetime-10; - if (lift[1] < 0) - lift[1] = 0; - else if (lift[1] > TICRATE+5) - lift[1] = TICRATE+5; - } - - lift[0] = continuetime-5; - if (lift[0] < 0) - lift[0] = 0; - else if (lift[0] > TICRATE+5) - lift[0] = TICRATE+5; - -#define drawchar(dx, dy, n) {\ - sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\ - sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\ - patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\ - V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<= 0) - drawchar((BASEVIDWIDTH<<(FRACBITS-1))-offsx, ((140-lift[0])< (11*TICRATE)) - V_DrawFadeScreen(31, timetonext-(11*TICRATE)); - if (continuetime > ((3*TICRATE) - 10)) - V_DrawFadeScreen(0, (continuetime - ((3*TICRATE) - 10))); -} - -void F_ContinueTicker(void) -{ - if (!imcontinuing) - { - if (timetonext > 0) - { - if (!(--timetonext)) - { - Command_ExitGame_f(); - return; - } - } - } - else - { - if (++continuetime == 3*TICRATE) - { - G_Continue(); - return; - } - - if (continuetime > 5 && ((continuetime & 1) || continuetime > TICRATE) && (++cont_spr2[0][2]) >= 8) - cont_spr2[0][2] = 0; - - if (continuetime > 10 && (!(continuetime & 1) || continuetime > TICRATE+5) && (++cont_spr2[1][2]) >= 8) - cont_spr2[1][2] = 0; - - if (continuetime == (3*TICRATE)-10) - S_StartSound(NULL, sfx_cdfm56); // or 31 - else if (continuetime == 5) - { - cont_spr2[0][0] = P_GetSkinSprite2(contskins[0], SPR2_CNT2, NULL); - cont_spr2[0][4] = contskins[0]->sprites[cont_spr2[0][0]].numframes; - cont_spr2[0][1] = cont_spr2[0][3] = 0; - cont_spr2[0][5] = 2; - } - else if (continuetime == TICRATE) - { - cont_spr2[0][0] = P_GetSkinSprite2(contskins[0], SPR2_CNT3, NULL); - cont_spr2[0][4] = contskins[0]->sprites[cont_spr2[0][0]].numframes; - cont_spr2[0][1] = cont_spr2[0][3] = 0; - } - else if (contskins[1]) - { - if (continuetime == 10) - { - cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT2, NULL); - cont_spr2[1][4] = contskins[1]->sprites[cont_spr2[1][0]].numframes; - cont_spr2[1][1] = cont_spr2[1][3] = 0; - cont_spr2[1][5] = 2; - } - else if (continuetime == TICRATE+5) - { - cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT3, NULL); - cont_spr2[1][4] = contskins[1]->sprites[cont_spr2[1][0]].numframes; - cont_spr2[1][1] = cont_spr2[1][3] = 0; - } - } - } - - if ((++cont_spr2[0][3]) >= cont_spr2[0][5]) - { - cont_spr2[0][3] = 0; - if (++cont_spr2[0][1] >= cont_spr2[0][4]) - cont_spr2[0][1] = 0; - } - - if (contskins[1] && (++cont_spr2[1][3]) >= cont_spr2[1][5]) - { - cont_spr2[1][3] = 0; - if (++cont_spr2[1][1] >= cont_spr2[1][4]) - cont_spr2[1][1] = 0; - } -} - -boolean F_ContinueResponder(event_t *event) -{ - INT32 key = event->data1; - - if (keypressed) - return true; - - if (timetonext >= 21*TICRATE/2) - return false; - if (event->type != ev_keydown) - return false; - - // remap virtual keys (mouse & joystick buttons) - switch (key) - { - case KEY_ENTER: - case KEY_SPACE: - case KEY_MOUSE1: - case KEY_JOY1: - case KEY_JOY1 + 2: - break; - default: - return false; - } - - keypressed = true; - imcontinuing = true; - S_StartSound(NULL, sfx_kc6b); - I_FadeSong(0, MUSICRATE, &S_StopMusic); - - return true; -} - // ================== // CUSTOM CUTSCENES // ================== diff --git a/src/g_demo.c b/src/g_demo.c index 8c3eef08b..0e6e60c50 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -268,8 +268,8 @@ void G_ReadDemoExtraData(void) // Color M_Memcpy(name, demo_p, 16); demo_p += 16; - for (i = 0; i < MAXSKINCOLORS; i++) - if (!stricmp(KartColor_Names[i], name)) // SRB2kart + for (i = 0; i < numskincolors; i++) + if (!stricmp(skincolors[i].name, name)) // SRB2kart { players[p].skincolor = i; if (players[p].mo) @@ -293,14 +293,12 @@ void G_ReadDemoExtraData(void) // Follower's color M_Memcpy(name, demo_p, 16); demo_p += 16; - for (i = 0; i < MAXSKINCOLORS; i++) - if (!stricmp(KartColor_Names[i], name)) // SRB2kart + for (i = 0; i < numskincolors; i++) + if (!stricmp(skincolors[i].name, name)) // SRB2kart { players[p].followercolor = i; break; } - - } if (extradata & DXD_PLAYSTATE) { @@ -342,10 +340,8 @@ void G_ReadDemoExtraData(void) G_ResetViews(); // maybe these are necessary? - if (G_BattleGametype()) - K_CheckBumpers(); // SRB2Kart - else if (G_RaceGametype()) - P_CheckRacers(); // also SRB2Kart + K_CheckBumpers(); + P_CheckRacers(); } @@ -410,7 +406,7 @@ void G_WriteDemoExtraData(void) { // Color memset(name, 0, 16); - strncpy(name, KartColor_Names[players[i].skincolor], 16); + strncpy(name, skincolors[players[i].skincolor].name, 16); M_Memcpy(demo_p,name,16); demo_p += 16; } @@ -2004,7 +2000,7 @@ void G_BeginRecording(void) // Color memset(name, 0, 16); - strncpy(name, KartColor_Names[player->skincolor], 16); + strncpy(name, skincolors[player->skincolor].name, 16); M_Memcpy(demo_p,name,16); demo_p += 16; @@ -2031,7 +2027,7 @@ void G_BeginRecording(void) WRITEUINT32(demo_p, player->score); // Power Levels - WRITEUINT16(demo_p, clientpowerlevels[p][G_BattleGametype() ? PWRLV_BATTLE : PWRLV_RACE]); + WRITEUINT16(demo_p, clientpowerlevels[p][gametype == GT_BATTLE ? PWRLV_BATTLE : PWRLV_RACE]); // Kart speed and weight WRITEUINT8(demo_p, skins[player->skin].kartspeed); @@ -2132,7 +2128,7 @@ void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT // Color memset(temp, 0, 16); - strncpy(temp, KartColor_Names[color], 16); + strncpy(temp, skincolors[color].name, 16); M_Memcpy(demo_p,temp,16); demo_p += 16; @@ -2595,8 +2591,8 @@ void G_LoadDemoInfo(menudemo_t *pdemo) // Color M_Memcpy(temp,extrainfo_p,16); extrainfo_p += 16; - for (i = 0; i < MAXSKINCOLORS; i++) - if (!stricmp(KartColor_Names[i],temp)) // SRB2kart + for (i = 0; i < numskincolors; i++) + if (!stricmp(skincolors[i].name,temp)) // SRB2kart { pdemo->standings[count].color = i; break; @@ -2958,8 +2954,8 @@ void G_DoPlayDemo(char *defdemoname) // Color M_Memcpy(color,demo_p,16); demo_p += 16; - for (i = 0; i < MAXSKINCOLORS; i++) - if (!stricmp(KartColor_Names[i],color)) // SRB2kart + for (i = 0; i < numskincolors; i++) + if (!stricmp(skincolors[i].name,color)) // SRB2kart { players[p].skincolor = i; break; @@ -2973,7 +2969,7 @@ void G_DoPlayDemo(char *defdemoname) // Follower colour M_Memcpy(color, demo_p, 16); demo_p += 16; - for (i = 0; i < MAXSKINCOLORS +2; i++) // +2 because of Match and Opposite + for (i = 0; i < numskincolors +2; i++) // +2 because of Match and Opposite { if (!stricmp(Followercolor_cons_t[i].strvalue, color)) { @@ -2986,7 +2982,7 @@ void G_DoPlayDemo(char *defdemoname) players[p].score = READUINT32(demo_p); // Power Levels - clientpowerlevels[p][G_BattleGametype() ? PWRLV_BATTLE : PWRLV_RACE] = READUINT16(demo_p); + clientpowerlevels[p][gametype == GT_BATTLE ? PWRLV_BATTLE : PWRLV_RACE] = READUINT16(demo_p); // Kart stats, temporarily kartspeed[p] = READUINT8(demo_p); diff --git a/src/g_game.c b/src/g_game.c index 7f1f4eb69..3198ae665 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -315,8 +315,6 @@ tic_t curlap; // Current lap time tic_t bestlap; // Best lap time static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to roll -tic_t hidetime; - // Grading UINT32 timesBeaten; UINT32 timesBeatenWithEmeralds; @@ -1204,7 +1202,7 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n) // void G_DoLoadLevel(boolean resetplayer) { - INT32 i; + INT32 i, j; // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); @@ -1277,13 +1275,10 @@ void G_DoLoadLevel(boolean resetplayer) memset(gamekeydown, 0, sizeof (gamekeydown)); for (i = 0;i < JOYAXISSET; i++) { - joyxmove[i] = joyymove[i] = 0; - joy2xmove[i] = joy2ymove[i] = 0; - joy3xmove[i] = joy3ymove[i] = 0; - joy4xmove[i] = joy4ymove[i] = 0; + for (j = 0; j < MAXSPLITSCREENPLAYERS; j++) + joyxmove[j][i] = joyymove[j][i] = 0; } mousex = mousey = 0; - mouse2x = mouse2y = 0; // clear hud messages remains (usually from game startup) CON_ClearHUD(); @@ -1637,36 +1632,18 @@ boolean G_CouldView(INT32 playernum) return false; // I don't know if we want this actually, but I'll humor the suggestion anyway - if (G_BattleGametype() && !demo.playback) + if ((gametyperules & GTR_BUMPERS) && !demo.playback) { if (player->kartstuff[k_bumper] <= 0) return false; } // SRB2Kart: we have no team-based modes, YET... - /*if (G_GametypeHasTeams()) + if (G_GametypeHasTeams()) { - if (players[consoleplayer].ctfteam - && player->ctfteam != players[consoleplayer].ctfteam) + if (players[consoleplayer].ctfteam && player->ctfteam != players[consoleplayer].ctfteam) return false; } - else if (gametype == GT_HIDEANDSEEK) - { - if (players[consoleplayer].pflags & PF_TAGIT) - return false; - } - // Other Tag-based gametypes? - else if (G_TagGametype()) - { - if (!players[consoleplayer].spectator - && (players[consoleplayer].pflags & PF_TAGIT) != (player->pflags & PF_TAGIT)) - return false; - } - else if (G_GametypeHasSpectators() && G_BattleGametype()) - { - if (!players[consoleplayer].spectator) - return false; - }*/ return true; } @@ -2234,8 +2211,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) itemtype = 0; itemamount = 0; growshrinktimer = 0; - bumper = (G_BattleGametype() ? K_StartingBumperCount() : 0); - rings = (G_BattleGametype() ? 0 : 5); + bumper = ((gametyperules & GTR_BUMPERS) ? K_StartingBumperCount() : 0); + rings = ((gametyperules & GTR_RINGS) ? 5 : 0); comebackpoints = 0; wanted = 0; } @@ -2342,17 +2319,19 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) { if (p->ctfteam == 1 && p->skincolor != skincolor_redteam) { - if (p == &players[consoleplayer]) - CV_SetValue(&cv_playercolor, skincolor_redteam); - else if (p == &players[secondarydisplayplayer]) - CV_SetValue(&cv_playercolor2, skincolor_redteam); + for (i = 0; i <= splitscreen; i++) + { + if (p == &players[g_localplayers[i]]) + CV_SetValue(&cv_playercolor[i], skincolor_redteam); + } } else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam) { - if (p == &players[consoleplayer]) - CV_SetValue(&cv_playercolor, skincolor_blueteam); - else if (p == &players[secondarydisplayplayer]) - CV_SetValue(&cv_playercolor2, skincolor_blueteam); + for (i = 0; i <= splitscreen; i++) + { + if (p == &players[g_localplayers[i]]) + CV_SetValue(&cv_playercolor[i], skincolor_blueteam); + } } } @@ -2384,9 +2363,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) if (leveltime > (starttime + (TICRATE/2)) && !p->spectator) p->kartstuff[k_respawn] = 48; // Respawn effect - - if (gametype == GT_COOP) - P_FindEmerald(); // scan for emeralds to hunt for } // @@ -2454,14 +2430,14 @@ void G_MovePlayerToSpawnOrStarpost(INT32 playernum) P_MovePlayerToSpawn(playernum, G_FindMapStart(playernum)); } -mapthing_t *G_FindCTFStart(INT32 playernum) +mapthing_t *G_FindTeamStart(INT32 playernum) { const boolean doprints = P_IsLocalPlayer(&players[playernum]); INT32 i,j; if (!numredctfstarts && !numbluectfstarts) //why even bother, eh? { - if ((gametyperules & GTR_TEAMFLAGS) && doprints)) + if ((gametyperules & GTR_TEAMSTARTS) && doprints)) CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n")); return NULL; } @@ -2509,7 +2485,7 @@ mapthing_t *G_FindCTFStart(INT32 playernum) return NULL; } -mapthing_t *G_FindMatchStart(INT32 playernum) +mapthing_t *G_FindBattleStart(INT32 playernum) { const boolean doprints = P_IsLocalPlayer(&players[playernum]); INT32 i, j; @@ -2627,22 +2603,31 @@ mapthing_t *G_FindRaceStart(INT32 playernum) } // Find a Co-op start, or fallback into other types of starts. -static inline mapthing_t *G_FindCoopStartOrFallback(INT32 playernum) +static inline mapthing_t *G_FindRaceStartOrFallback(INT32 playernum) { mapthing_t *spawnpoint = NULL; - if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start - && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start - spawnpoint = G_FindCTFStart(playernum); // fallback + if (!(spawnpoint = G_FindRaceStart(playernum)) // find a Race start + && !(spawnpoint = G_FindBattleStart(playernum))) // find a DM start + spawnpoint = G_FindTeamStart(playernum); // fallback return spawnpoint; } // Find a Match start, or fallback into other types of starts. -static inline mapthing_t *G_FindMatchStartOrFallback(INT32 playernum) +static inline mapthing_t *G_FindBattleStartOrFallback(INT32 playernum) { mapthing_t *spawnpoint = NULL; - if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start - && !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start - spawnpoint = G_FindCoopStart(playernum); // fallback + if (!(spawnpoint = G_FindBattleStart(playernum)) // find a DM start + && !(spawnpoint = G_FindTeamStart(playernum))) // find a CTF start + spawnpoint = G_FindRaceStart(playernum); // fallback + return spawnpoint; +} + +static inline mapthing_t *G_FindTeamStartOrFallback(INT32 playernum) +{ + mapthing_t *spawnpoint = NULL; + if (!(spawnpoint = G_FindTeamStart(playernum)) // find a CTF start + && !(spawnpoint = G_FindBattleStart(playernum))) // find a DM start + spawnpoint = G_FindRaceStart(playernum); // fallback return spawnpoint; } @@ -2654,49 +2639,45 @@ mapthing_t *G_FindMapStart(INT32 playernum) return NULL; // -- Spectators -- - // Order in platform gametypes: Coop->DM->CTF - // And, with deathmatch starts: DM->CTF->Coop + // Order in platform gametypes: Race->DM->CTF + // And, with deathmatch starts: DM->CTF->Race if (players[playernum].spectator) { // In platform gametypes, spawn in Co-op starts first - // Overriden by GTR_DEATHMATCHSTARTS. - if (G_PlatformGametype() && !(gametyperules & GTR_DEATHMATCHSTARTS)) - spawnpoint = G_FindCoopStartOrFallback(playernum); - else + // Overriden by GTR_BATTLESTARTS. + if (gametyperules & GTR_BATTLESTARTS) spawnpoint = G_FindMatchStartOrFallback(playernum); + else + spawnpoint = G_FindRaceStartOrFallback(playernum); } // -- CTF -- - // Order: CTF->DM->Coop - else if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam) - { - if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start - && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start - spawnpoint = G_FindCoopStart(playernum); // fallback - } + // Order: CTF->DM->Race + else if ((gametyperules & GTR_TEAMSTARTS) && players[playernum].ctfteam) + spawnpoint = G_FindTeamStartOrFallback(playernum); // -- DM/Tag/CTF-spectator/etc -- - // Order: DM->CTF->Coop - else if (G_TagGametype() ? (!(players[playernum].pflags & PF_TAGIT)) : (gametyperules & GTR_DEATHMATCHSTARTS)) - spawnpoint = G_FindMatchStartOrFallback(playernum); + // Order: DM->CTF->Race + else if (gametyperules & GTR_BATTLESTARTS) + spawnpoint = G_FindBattleStartOrFallback(playernum); // -- Other game modes -- - // Order: Coop->DM->CTF + // Order: Race->DM->CTF else - spawnpoint = G_FindCoopStartOrFallback(playernum); + spawnpoint = G_FindRaceStartOrFallback(playernum); //No spawns found. ANYWHERE. if (!spawnpoint) { if (nummapthings) { - if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer)) + if (P_IsLocalPlayer(&players[playernum])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); spawnpoint = &mapthings[0]; } else { - if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer)) + if (P_IsLocalPlayer(&players[playernum])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n")); } } @@ -2806,33 +2787,6 @@ void G_AddPlayer(INT32 playernum) P_DoPlayerExit(p); } -boolean G_EnoughPlayersFinished(void) -{ - UINT8 numneeded = (G_IsSpecialStage(gamemap) ? 4 : cv_playersforexit.value); - INT32 total = 0; - INT32 exiting = 0; - INT32 i; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator || players[i].bot) - continue; - if (players[i].quittime > 30 * TICRATE) - continue; - if (players[i].lives <= 0) - continue; - - total++; - if ((players[i].pflags & PF_FINISHED) || players[i].exiting) - exiting++; - } - - if (exiting) - return exiting * 4 / total >= numneeded; - else - return false; -} - void G_ExitLevel(void) { if (gamestate == GS_LEVEL) @@ -2848,8 +2802,7 @@ void G_ExitLevel(void) CV_SetValue(&cv_teamscramble, cv_scrambleonchange.value); } - if (!(gametyperules & (GTR_FRIENDLY|GTR_CAMPAIGN))) - CONS_Printf(M_GetText("The round has ended.\n")); + CON_LogMessage(M_GetText("The round has ended.\n")); // Remove CEcho text on round end. HU_ClearCEcho(); @@ -2884,9 +2837,9 @@ const char *Gametype_ConstantNames[NUMGAMETYPES] = UINT32 gametypedefaultrules[NUMGAMETYPES] = { // Race - GTR_RACE|GTR_SPAWNENEMIES|GTR_SPAWNINVUL|GTR_ALLOWEXIT, + GTR_CIRCUIT|GTR_RINGS|GTR_BOTS, // Battle - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD|GTR_DEATHPENALTY + GTR_BUMPERS|GTR_KARMA|GTR_ITEMARROWS|GTR_BATTLESTARTS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME }; // @@ -3037,15 +2990,17 @@ UINT32 gametypetol[NUMGAMETYPES] = { TOL_RACE, // Race TOL_BATTLE, // Battle + TOL_TV, // Midnight Channel effect }; tolinfo_t TYPEOFLEVEL[NUMTOLNAMES] = { {"RACE",TOL_RACE}, {"BATTLE",TOL_BATTLE}, + {"TV",TOL_TV}, {NULL, 0} }; -UINT32 lastcustomtol = (TOL_XMAS<<1); +UINT32 lastcustomtol = (TOL_TV<<1); // // G_AddTOL @@ -3099,7 +3054,7 @@ boolean G_IsSpecialStage(INT32 mapnum) #if 1 (void)mapnum; #else - if (gametype != GT_COOP || modeattacking == ATTACKING_RECORD) + if (modeattacking == ATTACKING_RECORD) return false; if (mapnum >= sstage_start && mapnum <= sstage_end) return true; @@ -3118,41 +3073,15 @@ boolean G_IsSpecialStage(INT32 mapnum) // boolean G_GametypeUsesLives(void) { - // SRB2kart NEEDS no lives -#if 0 - // Coop, Competitive if ((gametyperules & GTR_LIVES) && !(modeattacking || metalrecording) // No lives in Time Attack - && !G_IsSpecialStage(gamemap) - && !(maptol & TOL_NIGHTS)) // No lives in NiGHTS + && !battlecapsules // No lives in bonus game + && !G_IsSpecialStage(gamemap)) // No lives in special stage return true; -#endif return false; } -// -// G_GametypeUsesCoopLives -// -// Returns true if the current gametype uses -// the cooplives CVAR. False otherwise. -// -boolean G_GametypeUsesCoopLives(void) -{ - return (gametyperules & (GTR_LIVES|GTR_FRIENDLY)) == (GTR_LIVES|GTR_FRIENDLY); -} - -// -// G_GametypeUsesCoopStarposts -// -// Returns true if the current gametype uses -// the coopstarposts CVAR. False otherwise. -// -boolean G_GametypeUsesCoopStarposts(void) -{ - return (gametyperules & GTR_FRIENDLY); -} - // // G_GametypeHasTeams // @@ -3161,7 +3090,19 @@ boolean G_GametypeUsesCoopStarposts(void) // boolean G_GametypeHasTeams(void) { - return (gametyperules & GTR_TEAMS); + if (gametyperules & GTR_TEAMS) + { + // Teams forced on by this gametype + return true; + } + else if (gametyperules & GTR_NOTEAMS) + { + // Teams forced off by this gametype + return false; + } + + // Teams are determined by the "teamplay" modifier! + return false; // teamplay } // @@ -3172,12 +3113,7 @@ boolean G_GametypeHasTeams(void) // boolean G_GametypeHasSpectators(void) { - // SRB2Kart: We don't have any exceptions to not being able to spectate yet. Maybe when SP & bots roll around. -#if 0 - return (gametyperules & GTR_SPECTATORS); -#else - return (netgame || (multiplayer && demo.playback)); //true -#endif + return (netgame || (multiplayer && demo.playback)); } // @@ -3187,7 +3123,7 @@ boolean G_GametypeHasSpectators(void) // INT16 G_SometimesGetDifferentGametype(void) { - boolean encorepossible = ((M_SecretUnlocked(SECRET_ENCORE) || encorescramble == 1) && G_RaceGametype()); + boolean encorepossible = ((M_SecretUnlocked(SECRET_ENCORE) || encorescramble == 1) && (gametyperules & GTR_CIRCUIT)); if (!cv_kartvoterulechanges.value // never && encorescramble != 1) // destroying the code for this one instance @@ -3240,9 +3176,9 @@ INT16 G_SometimesGetDifferentGametype(void) break; } - if (gametype == GT_MATCH) + if (gametype == GT_BATTLE) return GT_RACE; - return GT_MATCH; + return GT_BATTLE; } // @@ -3256,64 +3192,16 @@ UINT8 G_GetGametypeColor(INT16 gt) if (modeattacking // == ATTACKING_RECORD || gamestate == GS_TIMEATTACK) return orangemap[0]; + if (gt == GT_MATCH) return redmap[0]; + if (gt == GT_RACE) return skymap[0]; + return 255; // FALLBACK } -// -// G_RaceGametype -// -// Returns true in Race gamemodes, previously was G_PlatformGametype. -// -boolean G_RaceGametype(void) -{ - return (gametype == GT_RACE); -} - -// -// G_BattleGametype -// -// Returns true in Battle gamemodes, previously was G_RingslingerGametype. -// -boolean G_BattleGametype(void) -{ - return (gametype == GT_BATTLE); -} - -// -// G_CoopGametype -// -// Returns true if a gametype is a Co-op gametype. -// -boolean G_CoopGametype(void) -{ - return ((gametyperules & (GTR_FRIENDLY|GTR_CAMPAIGN)) == (GTR_FRIENDLY|GTR_CAMPAIGN)); -} - -// -// 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 (gametyperules & GTR_TAG); -} - -// -// G_CompetitionGametype -// -// For gametypes that are race gametypes, and have lives. -// -boolean G_CompetitionGametype(void) -{ - return ((gametyperules & GTR_RACE) && (gametyperules & GTR_LIVES)); -} - /** 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. @@ -3500,7 +3388,7 @@ static void G_UpdateVisited(void) boolean spec = G_IsSpecialStage(gamemap); // Update visitation flags? if ((!modifiedgame || savemoddata) // Not modified - && !multiplayer && !demo.playback && (gametype == GT_COOP) // SP/RA/NiGHTS mode + && !multiplayer && !demo.playback // SP/RA/NiGHTS mode && !(spec && stagefailed)) // Not failed the special stage { UINT8 earnedEmblems; @@ -3614,7 +3502,7 @@ static void G_DoCompleted(void) } // play some generic music if there's no win/cool/lose music going on (for exitlevel commands) - if (G_RaceGametype() && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0)) + if ((gametyperules & GTR_CIRCUIT) && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0)) S_ChangeMusicInternal("racent", true); if (automapactive) @@ -3740,9 +3628,9 @@ static void G_DoCompleted(void) // Set up power level gametype scrambles if (netgame && cv_kartusepwrlv.value) { - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) powertype = PWRLV_RACE; - else if (G_BattleGametype()) + else if ((gametyperules & GTR_BUMPERS)) powertype = PWRLV_BATTLE; } @@ -4571,7 +4459,7 @@ void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar if (color != SKINCOLOR_NONE) { - CV_StealthSetValue(&cv_playercolor, color); + CV_StealthSetValue(&cv_playercolor[0], color); } if (mapname) diff --git a/src/g_game.h b/src/g_game.h index 1885b48ae..d5372356d 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -191,16 +191,10 @@ void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolo INT32 G_GetGametypeByName(const char *gametypestr); boolean G_IsSpecialStage(INT32 mapnum); boolean G_GametypeUsesLives(void); -boolean G_GametypeUsesCoopLives(void); -boolean G_GametypeUsesCoopStarposts(void); boolean G_GametypeHasTeams(void); boolean G_GametypeHasSpectators(void); -boolean G_BattleGametype(void); INT16 G_SometimesGetDifferentGametype(void); UINT8 G_GetGametypeColor(INT16 gt); -boolean G_RaceGametype(void); -boolean G_TagGametype(void); -boolean G_CompetitionGametype(void); boolean G_EnoughPlayersFinished(void); void G_ExitLevel(void); void G_NextLevel(void); diff --git a/src/g_input.c b/src/g_input.c index a34f98c5e..99066672c 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -34,11 +34,8 @@ consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_ INT32 mousex, mousey; INT32 mlooky; // like mousey but with a custom sensitivity for mlook -INT32 mouse2x, mouse2y, mlook2y; - // joystick values are repeated -INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET], -joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET]; +INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET]; // current state of the keys: true if pushed UINT8 gamekeydown[NUMINPUTS]; @@ -79,11 +76,7 @@ typedef struct UINT8 clicks; } dclick_t; static dclick_t mousedclicks[MOUSEBUTTONS]; -static dclick_t joydclicks[JOYBUTTONS + JOYHATS*4]; -static dclick_t mouse2dclicks[MOUSEBUTTONS]; -static dclick_t joy2dclicks[JOYBUTTONS + JOYHATS*4]; -static dclick_t joy3dclicks[JOYBUTTONS + JOYHATS*4]; -static dclick_t joy4dclicks[JOYBUTTONS + JOYHATS*4]; +static dclick_t joydclicks[MAXSPLITSCREENPLAYERS][JOYBUTTONS + JOYHATS*4]; // protos static UINT8 G_CheckDoubleClick(UINT8 state, dclick_t *dt); @@ -137,40 +130,32 @@ void G_MapEventsToControls(event_t *ev) i = ev->data1; if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on) break; - if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2; - if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3; + if (ev->data2 != INT32_MAX) joyxmove[0][i] = ev->data2; + if (ev->data3 != INT32_MAX) joyymove[0][i] = ev->data3; break; case ev_joystick2: // buttons are virtual keys i = ev->data1; if (i >= JOYAXISSET || menuactive) break; - if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2; - if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3; + if (ev->data2 != INT32_MAX) joyxmove[1][i] = ev->data2; + if (ev->data3 != INT32_MAX) joyymove[1][i] = ev->data3; break; case ev_joystick3: i = ev->data1; if (i >= JOYAXISSET) break; - if (ev->data2 != INT32_MAX) joy3xmove[i] = ev->data2; - if (ev->data3 != INT32_MAX) joy3ymove[i] = ev->data3; + if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2; + if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3; break; case ev_joystick4: i = ev->data1; if (i >= JOYAXISSET) break; - if (ev->data2 != INT32_MAX) joy4xmove[i] = ev->data2; - if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3; - break; - - case ev_mouse2: // buttons are virtual keys - if (menuactive || CON_Ready() || chat_on) - break; - mouse2x = (INT32)(ev->data2*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); - mouse2y = (INT32)(ev->data3*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); - mlook2y = (INT32)(ev->data3*((cv_mouseysens2.value*cv_mousesens2.value)/110.0f + 0.1f)); + if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2; + if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3; break; default: @@ -186,31 +171,25 @@ void G_MapEventsToControls(event_t *ev) for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++) { - flag = G_CheckDoubleClick(gamekeydown[KEY_JOY1+i], &joydclicks[i]); + flag = G_CheckDoubleClick(gamekeydown[KEY_JOY1+i], &joydclicks[0][i]); gamekeydown[KEY_DBLJOY1+i] = flag; } - for (i = 0; i < MOUSEBUTTONS; i++) - { - flag = G_CheckDoubleClick(gamekeydown[KEY_2MOUSE1+i], &mouse2dclicks[i]); - gamekeydown[KEY_DBL2MOUSE1+i] = flag; - } - for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++) { - flag = G_CheckDoubleClick(gamekeydown[KEY_2JOY1+i], &joy2dclicks[i]); + flag = G_CheckDoubleClick(gamekeydown[KEY_2JOY1+i], &joydclicks[1][i]); gamekeydown[KEY_DBL2JOY1+i] = flag; } for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++) { - flag = G_CheckDoubleClick(gamekeydown[KEY_3JOY1+i], &joy3dclicks[i]); + flag = G_CheckDoubleClick(gamekeydown[KEY_3JOY1+i], &joydclicks[2][i]); gamekeydown[KEY_DBL3JOY1+i] = flag; } for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++) { - flag = G_CheckDoubleClick(gamekeydown[KEY_4JOY1+i], &joy4dclicks[i]); + flag = G_CheckDoubleClick(gamekeydown[KEY_4JOY1+i], &joydclicks[3][i]); gamekeydown[KEY_DBL4JOY1+i] = flag; } } @@ -333,14 +312,6 @@ static keyname_t keynames[] = {KEY_MOUSE1+5,"MOUSE6"}, {KEY_MOUSE1+6,"MOUSE7"}, {KEY_MOUSE1+7,"MOUSE8"}, - {KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 - {KEY_2MOUSE1+1,"SEC_MOUSE1"}, - {KEY_2MOUSE1+2,"SEC_MOUSE3"}, - {KEY_2MOUSE1+3,"SEC_MOUSE4"}, - {KEY_2MOUSE1+4,"SEC_MOUSE5"}, - {KEY_2MOUSE1+5,"SEC_MOUSE6"}, - {KEY_2MOUSE1+6,"SEC_MOUSE7"}, - {KEY_2MOUSE1+7,"SEC_MOUSE8"}, {KEY_MOUSEWHEELUP, "Wheel 1 UP"}, {KEY_MOUSEWHEELDOWN, "Wheel 1 Down"}, {KEY_2MOUSEWHEELUP, "Wheel 2 UP"}, @@ -407,14 +378,6 @@ static keyname_t keynames[] = {KEY_DBLMOUSE1+5, "DBLMOUSE6"}, {KEY_DBLMOUSE1+6, "DBLMOUSE7"}, {KEY_DBLMOUSE1+7, "DBLMOUSE8"}, - {KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 - {KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"}, - {KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"}, - {KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"}, - {KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"}, - {KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"}, - {KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"}, - {KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"}, {KEY_DBLJOY1+0, "DBLJOY1"}, {KEY_DBLJOY1+1, "DBLJOY2"}, diff --git a/src/g_input.h b/src/g_input.h index e4ddfdd4e..2467633dd 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -115,10 +115,8 @@ extern consvar_t cv_controlperkey; extern INT32 mousex, mousey; extern INT32 mlooky; //mousey with mlookSensitivity -extern INT32 mouse2x, mouse2y, mlook2y; -extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET], - joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET]; +extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET]; // current state of the keys: true if pushed extern UINT8 gamekeydown[NUMINPUTS]; diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 5c5df0e94..9b4b1d984 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -1471,5 +1471,4 @@ void HWR_CreateStaticLightmaps(int bspnum) - finalement virer le hack splitscreen, il n'est plus necessaire ! */ #endif ->>>>>>> srb2/next #endif // HWRENDER diff --git a/src/hardware/hw_light.h b/src/hardware/hw_light.h index a652a2a3c..fed7db47f 100644 --- a/src/hardware/hw_light.h +++ b/src/hardware/hw_light.h @@ -91,5 +91,4 @@ typedef enum extern light_t lspr[NUMLIGHTS]; extern light_t *t_lspr[NUMSPRITES]; ->>>>>>> srb2/next #endif diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 893a53981..515b88b3e 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -38,8 +38,6 @@ #include "../r_draw.h" #include "../p_tick.h" -#include "../k_color.h" // colortranslations - #include "hw_model.h" #include "hw_main.h" diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 7045b2f0e..3ee9d51e5 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2415,18 +2415,12 @@ static void HU_DrawRankings(void) if (G_GametypeHasTeams()) { - if (gametype == GT_CTF) - p = bflagico; - else - p = bmatcico; + p = bmatcico; V_DrawSmallScaledPatch(128 - SHORT(p->width)/4, 4, 0, p); V_DrawCenteredString(128, 16, 0, va("%u", bluescore)); - if (gametype == GT_CTF) - p = rflagico; - else - p = rmatcico; + p = rmatcico; V_DrawSmallScaledPatch(192 - SHORT(p->width)/4, 4, 0, p); V_DrawCenteredString(192, 16, 0, va("%u", redscore)); @@ -2515,7 +2509,7 @@ static void HU_DrawRankings(void) tab[scorelines].name = player_names[i]; - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { if (circuitmap) tab[scorelines].count = players[i].laps; diff --git a/src/i_system.h b/src/i_system.h index bddffe13d..644e74774 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -220,14 +220,10 @@ const char *I_GetJoyName(INT32 joyindex); void I_UpdateMumble(const mobj_t *mobj, const listener_t listener); #endif -/** \brief Startup the first mouse +/** \brief Startup the mouse */ void I_StartupMouse(void); -/** \brief Startup the second mouse -*/ -void I_StartupMouse2(void); - /** \brief setup timer irq and user timer routine. */ void I_StartupTimer(void); diff --git a/src/k_battle.c b/src/k_battle.c index fe727cee3..ad1b09138 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -42,8 +42,10 @@ INT32 K_StartingBumperCount(void) boolean K_IsPlayerWanted(player_t *player) { UINT8 i; - if (!(G_BattleGametype())) + + if (!(gametyperules & GTR_WANTED)) return false; + for (i = 0; i < 4; i++) { if (battlewanted[i] == -1) @@ -63,7 +65,7 @@ void K_CalculateBattleWanted(void) boolean setbumper = false; UINT8 i, j; - if (!G_BattleGametype()) + if (!(gametyperules & GTR_WANTED)) { for (i = 0; i < 4; i++) battlewanted[i] = -1; @@ -211,7 +213,7 @@ void K_CheckBumpers(void) INT32 winnerscoreadd = 0; boolean nobumpers = false; - if (!G_BattleGametype()) + if (!(gametyperules & GTR_BUMPERS)) return; if (gameaction == ga_completed) @@ -560,7 +562,7 @@ void K_SpawnBattleCapsules(void) if (battlecapsules) return; - if (!G_BattleGametype()) + if (!(gametyperules & GTR_CAPSULES)) return; if (modeattacking != ATTACKING_CAPSULES) diff --git a/src/k_bot.c b/src/k_bot.c index 6beb6fe9e..9bd5da972 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -651,11 +651,9 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) return; } -#ifdef HAVE_BLUA // Complete override of all ticcmd functionality if (LUAh_BotTiccmd(player, cmd)) return; -#endif // Start boost handler if (leveltime <= starttime) diff --git a/src/k_collide.c b/src/k_collide.c index 1921e3d38..ecaa9bd8e 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -219,7 +219,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2) if (!P_CanPickupItem(t2->player, 2)) return true; - if (G_BattleGametype() && t2->player->kartstuff[k_bumper] <= 0) + if ((gametyperules & GTR_BUMPERS) && t2->player->kartstuff[k_bumper] <= 0) { if (t2->player->kartstuff[k_comebackmode] || t2->player->kartstuff[k_comebacktimer]) return true; @@ -253,7 +253,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2) if (t1->target && t1->target->player) { - if (G_RaceGametype() || t1->target->player->kartstuff[k_bumper] > 0) + if ((gametyperules & GTR_CIRCUIT) || t1->target->player->kartstuff[k_bumper] > 0) t2->player->kartstuff[k_eggmanblame] = t1->target->player-players; else t2->player->kartstuff[k_eggmanblame] = t2->player-players; diff --git a/src/k_color.c b/src/k_color.c index 1f420c7cf..050b8d1f1 100644 --- a/src/k_color.c +++ b/src/k_color.c @@ -32,6 +32,17 @@ UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b) return min(brightness, UINT8_MAX); } +/*-------------------------------------------------- + UINT16 K_RainbowColor(tic_t time) + + See header file for description. +--------------------------------------------------*/ + +UINT16 K_RainbowColor(tic_t time) +{ + return (UINT16)(SKINCOLOR_PINK + (time % (numskincolors - SKINCOLOR_PINK))); +} + /*-------------------------------------------------- void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) @@ -51,7 +62,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) // first generate the brightness of all the colours of that skincolour for (i = 0; i < 16; i++) { - color = V_GetColor(colortranslations[skincolor][i]); + color = V_GetColor(skincolors[skincolor].ramp[i]); colorbrightnesses[i] = K_ColorRelativeLuminance(color.s.red, color.s.green, color.s.blue); } @@ -75,7 +86,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor) if (temp < brightdif) { brightdif = (UINT16)temp; - dest_colormap[i] = colortranslations[skincolor][j]; + dest_colormap[i] = skincolors[skincolor].ramp[j]; } } } @@ -106,7 +117,7 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color) if (skinnum == TC_ALLWHITE) dest_colormap[i] = 0; else if (skinnum == TC_BLINK) - dest_colormap[i] = colortranslations[color][3]; + dest_colormap[i] = skincolors[color].ramp[3]; else dest_colormap[i] = (UINT8)i; } @@ -138,25 +149,8 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color) for (i = 0; i < SKIN_RAMP_LENGTH; i++) { // Sryder 2017-10-26: What was here before was most definitely not particularly readable, check above for new color translation table - dest_colormap[starttranscolor + i] = colortranslations[color][i]; + dest_colormap[starttranscolor + i] = skincolors[color].ramp[i]; } } -/** \brief Pulls kart color by name, to replace R_GetColorByName in r_draw.c - - \param name color name - - \return 0 -*/ -UINT8 K_GetKartColorByName(const char *name) -{ - UINT8 color = (UINT8)atoi(name); - if (color > 0 && color < MAXSKINCOLORS) - return color; - for (color = 1; color < MAXSKINCOLORS; color++) - if (!stricmp(KartColor_Names[color], name)) - return color; - return 0; -} - //} diff --git a/src/k_color.h b/src/k_color.h index 2a21473e2..02f659ae9 100644 --- a/src/k_color.h +++ b/src/k_color.h @@ -19,10 +19,6 @@ #define DEFAULT_STARTTRANSCOLOR 96 #define NUM_PALETTE_ENTRIES 256 -extern UINT8 colortranslations[MAXTRANSLATIONS][16]; -extern const char *KartColor_Names[MAXSKINCOLORS]; -extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2]; - /*-------------------------------------------------- UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b); diff --git a/src/k_kart.c b/src/k_kart.c index e00013128..d3687bc47 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -365,7 +365,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp if (!KartItemCVars[item-1]->value && !modeattacking) return 0; - if (G_BattleGametype()) + if (gametype == GT_BATTLE) { I_Assert(pos < 6); // DO NOT allow positions past the bounds of the table newodds = K_KartItemOddsBattle[item-1][pos]; @@ -386,7 +386,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp if (!playeringame[i] || players[i].spectator) continue; - if (!G_BattleGametype() || players[i].kartstuff[k_bumper]) + if (!(gametyperules & GTR_BUMPERS) || players[i].kartstuff[k_bumper]) pingame++; if (players[i].exiting) @@ -398,7 +398,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp return 0; } - if (players[i].mo && G_RaceGametype()) + if (players[i].mo && gametype == GT_RACE) { if (players[i].kartstuff[k_position] == 1 && first == -1) first = i; @@ -559,7 +559,7 @@ static UINT8 K_FindUseodds(player_t *player, fixed_t mashed, UINT32 pdis, UINT8 UINT8 j; boolean available = false; - if (G_BattleGametype() && i > 5) + if (gametype == GT_BATTLE && i > 5) { oddsvalid[i] = false; break; @@ -583,7 +583,7 @@ static UINT8 K_FindUseodds(player_t *player, fixed_t mashed, UINT32 pdis, UINT8 disttable[distlen++] = odds; \ totallen += num; - if (G_BattleGametype()) // Battle Mode + if (gametype == GT_BATTLE) // Battle Mode { SETUPDISTTABLE(0,1); SETUPDISTTABLE(1,1); @@ -772,7 +772,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // Record Attack / alone mashing behavior if (modeattacking || pingame == 1) { - if (G_RaceGametype()) + if (gametype == GT_RACE) { if (mashed && (modeattacking || cv_superring.value)) // ANY mashed value? You get rings. { @@ -792,7 +792,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) S_StartSound(NULL, sfx_itrolf); } } - else if (G_BattleGametype()) + else if (gametype == GT_BATTLE) { if (mashed && (modeattacking || cv_banana.value)) // ANY mashed value? You get a banana. { @@ -819,43 +819,40 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) return; } - if (G_RaceGametype()) + // SPECIAL CASE No. 4: + // Being in ring debt occasionally forces Super Ring on you if you mashed + if ((gametyperules & GTR_RINGS) && mashed && player->kartstuff[k_rings] < 0 && cv_superring.value) { - // SPECIAL CASE No. 4: - // Being in ring debt occasionally forces Super Ring on you if you mashed - if (mashed && player->kartstuff[k_rings] < 0 && cv_superring.value) + INT32 debtamount = min(20, abs(player->kartstuff[k_rings])); + if (P_RandomChance((debtamount*FRACUNIT)/20)) { - INT32 debtamount = min(20, abs(player->kartstuff[k_rings])); - if (P_RandomChance((debtamount*FRACUNIT)/20)) - { - K_KartGetItemResult(player, KITEM_SUPERRING); - player->karthud[khud_itemblink] = TICRATE; - player->karthud[khud_itemblinkmode] = 1; - player->kartstuff[k_itemroulette] = 0; - player->kartstuff[k_roulettetype] = 0; - if (P_IsDisplayPlayer(player)) - S_StartSound(NULL, sfx_itrolm); - return; - } - } - - // SPECIAL CASE No. 5: - // Force SPB onto 2nd if they get too far behind - if (player->kartstuff[k_position] == 2 && pdis > (DISTVAR*8) - && spbplace == -1 && !indirectitemcooldown && !dontforcespb - && cv_selfpropelledbomb.value) - { - K_KartGetItemResult(player, KITEM_SPB); + K_KartGetItemResult(player, KITEM_SUPERRING); player->karthud[khud_itemblink] = TICRATE; - player->karthud[khud_itemblinkmode] = (mashed ? 1 : 0); + player->karthud[khud_itemblinkmode] = 1; player->kartstuff[k_itemroulette] = 0; player->kartstuff[k_roulettetype] = 0; if (P_IsDisplayPlayer(player)) - S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); + S_StartSound(NULL, sfx_itrolm); return; } } + // SPECIAL CASE No. 5: + // Force SPB onto 2nd if they get too far behind + if ((gametyperules & GTR_CIRCUIT) && player->kartstuff[k_position] == 2 && pdis > (DISTVAR*8) + && spbplace == -1 && !indirectitemcooldown && !dontforcespb + && cv_selfpropelledbomb.value) + { + K_KartGetItemResult(player, KITEM_SPB); + player->karthud[khud_itemblink] = TICRATE; + player->karthud[khud_itemblinkmode] = (mashed ? 1 : 0); + player->kartstuff[k_itemroulette] = 0; + player->kartstuff[k_roulettetype] = 0; + if (P_IsDisplayPlayer(player)) + S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); + return; + } + // NOW that we're done with all of those specialized cases, we can move onto the REAL item roulette tables. // Initializes existing spawnchance values for (i = 0; i < NUMKARTRESULTS; i++) @@ -971,7 +968,7 @@ static void K_DebtStingPlayer(player_t *player, INT32 length) if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0 || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || ((gametyperules & GTR_BUMPERS) && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; player->kartstuff[k_ringboost] = 0; @@ -1602,17 +1599,38 @@ void K_DoIngameRespawn(player_t *player) UINT32 bestdist = UINT32_MAX; mapthing_t *beststart = NULL; UINT8 numstarts = 0; + UINT8 starttype = 0; - if (G_RaceGametype()) + if (gametyperules & GTR_TEAMSTARTS) { - numstarts = numcoopstarts; + if (player->ctfteam == 1) + { + starttype = 3; + numstarts = numredctfstarts; + } + else if (player->ctfteam == 2) + { + starttype = 4; + numstarts = numbluectfstarts; + } + else + { + starttype = 2; + numstarts = numdmstarts; + } } - else if (G_BattleGametype()) + else if (gametyperules & GTR_BATTLESTARTS) { + starttype = 2; numstarts = numdmstarts; } + else + { + starttype = 1; + numstarts = numcoopstarts; + } - if (numstarts > 0) + if (starttype > 0 && numstarts > 0) { UINT8 i = 0; @@ -1621,19 +1639,24 @@ void K_DoIngameRespawn(player_t *player) UINT32 dist = UINT32_MAX; mapthing_t *checkstart = NULL; - if (G_RaceGametype()) + switch (starttype) { - checkstart = playerstarts[i]; - } - else if (G_BattleGametype()) - { - checkstart = deathmatchstarts[i]; - } - else - { - break; + case 4: + checkstart = bluectfstarts[i]; + break; + case 3: + checkstart = redctfstarts[i]; + break; + case 2: + checkstart = deathmatchstarts[i]; + break; + case 1: + checkstart = playerstarts[i]; + break; } + I_Assert(checkstart != NULL); + dist = (UINT32)P_AproxDistance((player->mo->x >> FRACBITS) - checkstart->x, (player->mo->y >> FRACBITS) - checkstart->y); @@ -1902,7 +1925,7 @@ void K_RespawnChecker(player_t *player) //P_PlayRinglossSound(player->mo); P_PlayerRingBurst(player, 3); - if (G_BattleGametype()) + if (gametyperules & GTR_BUMPERS) { if (player->kartstuff[k_bumper] > 0) { @@ -2175,7 +2198,7 @@ void K_PlayOvertakeSound(mobj_t *source) { boolean tasteful = (!source->player || !source->player->karthud[khud_voices]); - if (!G_RaceGametype()) // Only in race + if (!gametype == GT_RACE) // Only in race return; // 4 seconds from before race begins, 10 seconds afterwards @@ -2338,7 +2361,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) fixed_t finalspeed; UINT8 kartspeed = player->kartspeed; - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + if ((gametyperules & (GTR_BUMPERS|GTR_KARMA)) == (GTR_BUMPERS|GTR_KARMA) && player->kartstuff[k_bumper] <= 0) kartspeed = 1; finalspeed = K_GetKartSpeedFromStat(kartspeed); @@ -2371,7 +2394,7 @@ fixed_t K_GetKartAccel(player_t *player) fixed_t k_accel = 32; // 36; UINT8 kartspeed = player->kartspeed; - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + if ((gametyperules & (GTR_BUMPERS|GTR_KARMA)) == (GTR_BUMPERS|GTR_KARMA) && player->kartstuff[k_bumper] <= 0) kartspeed = 1; //k_accel += 3 * (9 - kartspeed); // 36 - 60 @@ -2392,7 +2415,7 @@ UINT16 K_GetKartFlashing(player_t *player) if (!player) return tics; - if (G_BattleGametype()) + if (gametyperules & GTR_BUMPERS) tics *= 2; tics += (flashingtics/8) * (player->kartspeed); @@ -2475,7 +2498,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto { UINT8 scoremultiply = 1; // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too. -#ifdef HAVE_BLUA boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what. UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source); if (P_MobjWasRemoved(player->mo)) @@ -2484,16 +2506,12 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto force = true; else if (shouldForce == 2) return; -#else - static const boolean force = false; - (void)inflictor; // in case some weirdo doesn't want Lua. -#endif - if (!trapitem && G_BattleGametype()) + if ((gametyperules & GTR_POINTLIMIT) && !trapitem) { if (K_IsPlayerWanted(player)) scoremultiply = 3; - else if (player->kartstuff[k_bumper] == 1) + else if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] == 1) scoremultiply = 2; } @@ -2502,7 +2520,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2) || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 - || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || ((gametyperules & GTR_BUMPERS) && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) { if (!force) // if shoulddamage force, we go THROUGH that. { @@ -2511,10 +2529,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto } } -#ifdef HAVE_BLUA if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case. return; -#endif if (source && source != player->mo && source->player) K_PlayHitEmSound(source); @@ -2528,7 +2544,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto player->kartstuff[k_driftcharge] = 0; player->kartstuff[k_pogospring] = 0; - if (G_BattleGametype()) + if (gametyperules & GTR_BUMPERS) { if (source && source->player && player != source->player) { @@ -2625,7 +2641,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) { UINT8 scoremultiply = 1; // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too. -#ifdef HAVE_BLUA + boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what. UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source); if (P_MobjWasRemoved(player->mo)) @@ -2634,16 +2650,12 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) force = true; else if (shouldForce == 2) return; -#else - static const boolean force = false; - (void)inflictor; // Please stop forgetting to put inflictor in yer functions thank -Lat' -#endif - if (G_BattleGametype()) + if (gametyperules & GTR_POINTLIMIT) { if (K_IsPlayerWanted(player)) scoremultiply = 3; - else if (player->kartstuff[k_bumper] == 1) + else if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] == 1) scoremultiply = 2; } @@ -2652,7 +2664,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) 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 - || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || ((gametyperules & GTR_BUMPERS) && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) { if (!force) // You know the drill by now. { @@ -2661,10 +2673,8 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) } } -#ifdef HAVE_BLUA if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case. return; -#endif player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_levelbooster] = 0; @@ -2675,7 +2685,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) player->kartstuff[k_driftcharge] = 0; player->kartstuff[k_pogospring] = 0; - if (G_BattleGametype()) + if (gametyperules & GTR_BUMPERS) { if (source && source->player && player != source->player) { @@ -2746,7 +2756,6 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A bit of a hack, we just throw the player up higher here and extend their spinout timer { UINT8 scoremultiply = 1; -#ifdef HAVE_BLUA boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what. UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source); @@ -2757,11 +2766,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b else if (shouldForce == 2) return; -#else - static const boolean force = false; -#endif - - if (G_BattleGametype()) + if (gametyperules & GTR_BUMPERS) { if (K_IsPlayerWanted(player)) scoremultiply = 3; @@ -2773,7 +2778,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b return; if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 // Do not check spinout, because SPB and Eggman should combo - || (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || ((gametyperules & GTR_BUMPERS) && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) { if (!force) // ShouldDamage can bypass that, again. { @@ -2782,10 +2787,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b } } -#ifdef HAVE_BLUA if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah return; -#endif if (source && source != player->mo && source->player) K_PlayHitEmSound(source); @@ -2803,7 +2806,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b player->kartstuff[k_pogospring] = 0; // This is the only part that SHOULDN'T combo :VVVVV - if (G_BattleGametype() && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2))) + if ((gametyperules & GTR_BUMPERS) && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinouttype] != 2))) { if (source && source->player && player != source->player) { @@ -2879,7 +2882,7 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force) fixed_t newx, newy; mobj_t *newmo; - if (!G_BattleGametype()) + if (!(gametyperules & GTR_BUMPERS)) return; if (player->health <= 0 || victim->health <= 0) @@ -3247,10 +3250,10 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I return NULL; } -UINT8 K_DriftSparkColor(player_t *player, INT32 charge) +UINT16 K_DriftSparkColor(player_t *player, INT32 charge) { INT32 ds = K_GetKartDriftSparkValue(player); - UINT8 color = SKINCOLOR_NONE; + UINT16 color = SKINCOLOR_NONE; if (charge < 0) { @@ -3267,7 +3270,7 @@ UINT8 K_DriftSparkColor(player_t *player, INT32 charge) } else { - color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + color = K_RainbowColor(leveltime); } } else if (charge >= ds*2) @@ -3481,7 +3484,7 @@ void K_SpawnBoostTrail(player_t *player) if (!P_IsObjectOnGround(player->mo) || player->kartstuff[k_hyudorotimer] != 0 - || (G_BattleGametype() && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer])) + || ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer])) return; if (player->mo->eflags & MFE_VERTICALFLIP) @@ -4143,7 +4146,7 @@ static void K_DoHyudoroSteal(player_t *player) boolean sink = P_RandomChance(FRACUNIT/64); INT32 hyu = hyudorotime; - if (G_RaceGametype()) + if (gametype == GT_RACE) hyu *= 2; // double in race for (i = 0; i < MAXPLAYERS; i++) @@ -4152,8 +4155,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 - && (G_RaceGametype() //&& players[i].kartstuff[k_position] < player->kartstuff[k_position]) - || (G_BattleGametype() && players[i].kartstuff[k_bumper] > 0)) + && (gametype == GT_RACE //&& players[i].kartstuff[k_position] < player->kartstuff[k_position]) + || ((gametyperules & GTR_BUMPERS) && players[i].kartstuff[k_bumper] > 0)) // Has an item && (players[i].kartstuff[k_itemtype] @@ -4179,7 +4182,7 @@ static void K_DoHyudoroSteal(player_t *player) player->kartstuff[k_itemheld] = 0; return; } - else if ((G_RaceGametype() && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Oh well... + else if ((gametype == GT_RACE && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Oh well... { player->kartstuff[k_hyudorotimer] = hyu; player->kartstuff[k_stealingtimer] = stealtime; @@ -5185,7 +5188,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source) thisang = InvAngle(thisang); // Jawz only go after the person directly ahead of you in race... sort of literally now! - if (G_RaceGametype()) + if (gametype == GT_RACE) { // Don't go for people who are behind you if (thisang > ANGLE_67h) @@ -5385,7 +5388,7 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_tauntvoices]) player->karthud[khud_tauntvoices]--; - if (G_RaceGametype()) + if (gametype == GT_RACE) { // 0 is the fast spin animation, set at 30 tics of ring boost or higher! if (player->kartstuff[k_ringboost] >= 30) @@ -5438,7 +5441,7 @@ void K_KartPlayerHUDUpdate(player_t *player) player->karthud[khud_ringspblock] = (leveltime % 14); // reset to normal anim next time } - if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) + if ((gametyperules & GTR_BUMPERS) && (player->exiting || player->kartstuff[k_comebacktimer])) { if (player->exiting) { @@ -5462,7 +5465,7 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_cardanimation] < 0) player->karthud[khud_cardanimation] = 0; } - else if (G_RaceGametype() && player->exiting) + else if (gametype == GT_RACE && player->exiting) { if (player->karthud[khud_cardanimation] < 2*TICRATE) player->karthud[khud_cardanimation]++; @@ -5633,7 +5636,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } } - if (G_RaceGametype() && player->kartstuff[k_rings] <= 0) // spawn ring debt indicator + if (gametype == GT_RACE && player->kartstuff[k_rings] <= 0) // spawn ring debt indicator { mobj_t *debtflag = P_SpawnMobj(player->mo->x + player->mo->momx, player->mo->y + player->mo->momy, player->mo->z + player->mo->momz + player->mo->height + (24*player->mo->scale), MT_THOK); @@ -5917,7 +5920,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_KartPlayerHUDUpdate(player); - if (G_BattleGametype() && player->kartstuff[k_bumper] > 0 + if (gametype == GT_BATTLE && player->kartstuff[k_bumper] > 0 && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_squishedtimer] && !player->kartstuff[k_respawn] && !player->powers[pw_flashing]) { @@ -5948,7 +5951,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_eggmanexplode]) { - if (player->spectator || (G_BattleGametype() && !player->kartstuff[k_bumper])) + if (player->spectator || (gametype == GT_BATTLE && !player->kartstuff[k_bumper])) player->kartstuff[k_eggmanexplode] = 0; else { @@ -6569,7 +6572,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) INT32 K_GetKartDriftSparkValue(player_t *player) { - UINT8 kartspeed = (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + UINT8 kartspeed = (gametype == GT_BATTLE && player->kartstuff[k_bumper] <= 0) ? 1 : player->kartspeed; return (26*4 + kartspeed*2 + (9 - player->kartweight))*8; @@ -6830,7 +6833,7 @@ void K_KartUpdatePosition(player_t *player) if (!playeringame[i] || players[i].spectator || !players[i].mo) continue; - if (G_RaceGametype()) + if (gametype == GT_RACE) { if (player->exiting) // End of match standings { @@ -6849,7 +6852,7 @@ void K_KartUpdatePosition(player_t *player) } } } - else if (G_BattleGametype()) + else if (gametype == GT_BATTLE) { if (player->exiting) // End of match standings { @@ -7597,7 +7600,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { INT32 hyu = hyudorotime; - if (G_RaceGametype()) + if (gametype == GT_RACE) hyu *= 2; // double in race if (r_splitscreen) @@ -7645,14 +7648,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4); } - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) // dead in match? you da bomb + if (gametype == GT_BATTLE && player->kartstuff[k_bumper] <= 0) // dead in match? you da bomb { K_DropItems(player); //K_StripItems(player); K_StripOther(player); player->mo->flags2 |= MF2_SHADOW; player->powers[pw_flashing] = player->kartstuff[k_comebacktimer]; } - else if (G_RaceGametype() || player->kartstuff[k_bumper] > 0) + else if (gametype == GT_RACE || player->kartstuff[k_bumper] > 0) { player->mo->flags2 &= ~MF2_SHADOW; } @@ -7677,7 +7680,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->friction -= 2048; // Karma ice physics - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + if (gametype == GT_BATTLE && player->kartstuff[k_bumper] <= 0) player->mo->friction += 1228; if (player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)) @@ -7855,7 +7858,7 @@ void K_CheckSpectateStatus(void) continue; if (leveltime > (starttime + 20*TICRATE)) // DON'T allow if the match is 20 seconds in return; - if (G_RaceGametype() && players[i].laps >= 2) // DON'T allow if the race is at 2 laps + if (gametype == GT_RACE && players[i].laps >= 2) // DON'T allow if the race is at 2 laps return; continue; } @@ -8632,7 +8635,7 @@ static void K_drawKartItem(void) INT32 itembar = 0; INT32 maxl = 0; // itembar's normal highest value const INT32 barlength = (r_splitscreen > 1 ? 12 : 26); - UINT8 localcolor = SKINCOLOR_NONE; + UINT16 localcolor = SKINCOLOR_NONE; SINT8 colormode = TC_RAINBOW; UINT8 *colmap = NULL; boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff @@ -8845,7 +8848,7 @@ static void K_drawKartItem(void) switch (stplyr->karthud[khud_itemblinkmode]) { case 2: - localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + localcolor = K_RainbowColor(leveltime); break; case 1: localcolor = SKINCOLOR_RED; @@ -9278,10 +9281,8 @@ static boolean K_drawKartPositionFaces(void) if (numplayersingame <= 1) return true; -#ifdef HAVE_BLUA if (!LUA_HudEnabled(hud_minirankings)) return false; // Don't proceed but still return true for free play above if HUD is disabled. -#endif for (j = 0; j < numplayersingame; j++) { @@ -9316,7 +9317,7 @@ static boolean K_drawKartPositionFaces(void) else Y -= (9*5); - if (G_BattleGametype() || strank <= 2) // too close to the top, or playing battle, or a spectator? would have had (strank == -1) called out, but already caught by (strank <= 2) + if (gametype == GT_BATTLE || strank <= 2) // too close to the top, or playing battle, or a spectator? would have had (strank == -1) called out, but already caught by (strank <= 2) { i = 0; if (ranklines > 5) // could be both... @@ -9352,11 +9353,9 @@ static boolean K_drawKartPositionFaces(void) V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, facerankprefix[players[rankplayer[i]].skin], colormap); -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_battlebumpers)) { -#endif - if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_bumper] > 0) + if (gametype == GT_BATTLE && players[rankplayer[i]].kartstuff[k_bumper] > 0) { V_DrawMappedPatch(bumperx-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_tinybumper[0], colormap); for (j = 1; j < players[rankplayer[i]].kartstuff[k_bumper]; j++) @@ -9365,15 +9364,13 @@ static boolean K_drawKartPositionFaces(void) V_DrawMappedPatch(bumperx, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_tinybumper[1], colormap); } } -#ifdef HAVE_BLUA - } // A new level of stupidity: checking if lua is enabled to close a bracket. :Fascinating: -#endif + } } if (i == strank) V_DrawScaledPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_facehighlight[(leveltime / 4) % 8]); - if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_bumper] <= 0) + if (gametype == GT_BATTLE && players[rankplayer[i]].kartstuff[k_bumper] <= 0) V_DrawScaledPatch(FACE_X-4, Y-3, V_HUDTRANS|V_SNAPTOLEFT, kp_ranknobumpers); else { @@ -9471,7 +9468,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE); V_DrawMappedPatch(x, y-4, 0, facerankprefix[players[tab[i].num].skin], colormap); - /*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this + /*if (gametype == GT_BATTLE && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this { INT32 bumperx = x+19; V_DrawMappedPatch(bumperx-2, y-4, 0, kp_tinybumper[0], colormap); @@ -9486,7 +9483,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (tab[i].num == whiteplayer) V_DrawScaledPatch(x, y-4, 0, kp_facehighlight[(leveltime / 4) % 8]); - if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] <= 0) + if (gametype == GT_BATTLE && players[tab[i].num].kartstuff[k_bumper] <= 0) V_DrawScaledPatch(x-4, y-7, 0, kp_ranknobumpers); else { @@ -9497,7 +9494,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I V_DrawScaledPatch(x-5, y+6, 0, kp_facenum[pos]); } - if (G_RaceGametype()) + if (gametype == GT_RACE) { #define timestring(time) va("%i'%02i\"%02i", G_TicsToMinutes(time, true), G_TicsToSeconds(time), G_TicsToCentiseconds(time)) if (scorelines > 8) @@ -9736,7 +9733,7 @@ static void K_drawKartSpeedometer(void) numbers[1] = ((convSpeed / 10) % 10); numbers[2] = (convSpeed % 10); - if (G_BattleGametype()) + if (gametype == GT_BATTLE) battleoffset = 8; V_DrawScaledPatch(LAPS_X, LAPS_Y-25 + battleoffset, V_HUDTRANS|splitflags, kp_speedometersticker); @@ -10165,14 +10162,14 @@ static void K_drawKartMinimap(void) y -= SHORT(AutomapPic->topoffset); // Draw the super item in Battle - if (G_BattleGametype() && battleovertime.enabled) + if (gametype == GT_BATTLE && battleovertime.enabled) { if (battleovertime.enabled >= 10*TICRATE || (battleovertime.enabled & 1)) { const INT32 prevsplitflags = splitflags; splitflags &= ~V_HUDTRANSHALF; splitflags |= V_HUDTRANS; - colormap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); + colormap = R_GetTranslationColormap(TC_RAINBOW, K_RainbowColor(leveltime), GTC_CACHE); K_drawKartMinimapIcon(battleovertime.x, battleovertime.y, x, y, splitflags, kp_itemminimap, colormap, AutomapPic); splitflags = prevsplitflags; } @@ -10222,7 +10219,7 @@ static void K_drawKartMinimap(void) if (i != displayplayers[0] || r_splitscreen) { - if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) + if (gametype == GT_BATTLE && players[i].kartstuff[k_bumper] <= 0) continue; if (players[i].kartstuff[k_hyudorotimer] > 0) @@ -10259,8 +10256,8 @@ static void K_drawKartMinimap(void) K_drawKartMinimapIcon(players[i].mo->x, players[i].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); // Target reticule - if ((G_RaceGametype() && players[i].kartstuff[k_position] == spbplace) - || (G_BattleGametype() && K_IsPlayerWanted(&players[i]))) + if ((gametype == GT_RACE && players[i].kartstuff[k_position] == spbplace) + || (gametype == GT_BATTLE && K_IsPlayerWanted(&players[i]))) K_drawKartMinimapIcon(players[i].mo->x, players[i].mo->y, x, y, splitflags, kp_wantedreticle, NULL, AutomapPic); } } @@ -10312,8 +10309,8 @@ static void K_drawKartMinimap(void) K_drawKartMinimapIcon(players[localplayers[i]].mo->x, players[localplayers[i]].mo->y, x, y, splitflags, facemmapprefix[skin], colormap, AutomapPic); // Target reticule - if ((G_RaceGametype() && players[localplayers[i]].kartstuff[k_position] == spbplace) - || (G_BattleGametype() && K_IsPlayerWanted(&players[localplayers[i]]))) + if ((gametype == GT_RACE && players[localplayers[i]].kartstuff[k_position] == spbplace) + || (gametype == GT_BATTLE && K_IsPlayerWanted(&players[localplayers[i]]))) K_drawKartMinimapIcon(players[localplayers[i]].mo->x, players[localplayers[i]].mo->y, x, y, splitflags, kp_wantedreticle, NULL, AutomapPic); } } @@ -10381,10 +10378,9 @@ static void K_drawBattleFullscreen(void) INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead fixed_t scale = FRACUNIT; boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. -#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_battlecomebacktimer)) drawcomebacktimer = false; -#endif if (r_splitscreen) { @@ -10493,9 +10489,7 @@ static void K_drawBattleFullscreen(void) return; } -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_freeplay)) -#endif K_drawKartFreePlay(leveltime); } } @@ -10645,8 +10639,8 @@ static void K_drawInput(void) static INT32 pn = 0; INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT); INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col; - const INT32 accent1 = splitflags|colortranslations[stplyr->skincolor][5]; - const INT32 accent2 = splitflags|colortranslations[stplyr->skincolor][9]; + const INT32 accent1 = splitflags|skincolors[stplyr->skincolor].ramp[5]; + const INT32 accent2 = splitflags|skincolors[stplyr->skincolor].ramp[9]; ticcmd_t *cmd = &stplyr->cmd; if (timeinmap <= 105) @@ -11012,7 +11006,7 @@ void K_drawKartHUD(void) return; } - battlefullscreen = ((G_BattleGametype()) + battlefullscreen = ((gametype == GT_BATTLE) && (stplyr->exiting || (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] @@ -11022,52 +11016,40 @@ void K_drawKartHUD(void) if (!demo.title && (!battlefullscreen || r_splitscreen)) { // Draw the CHECK indicator before the other items, so it's overlapped by everything else -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_check)) // delete lua when? -#endif if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting && !freecam) K_drawKartPlayerCheck(); // Draw WANTED status - if (G_BattleGametype()) + if (gametype == GT_BATTLE) { -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_wanted)) -#endif K_drawKartWanted(); } if (cv_kartminimap.value) { -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_minimap)) -#endif K_drawKartMinimap(); } } if (battlefullscreen && !freecam) { -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_battlefullscreen)) -#endif K_drawBattleFullscreen(); return; } // Draw the item window -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_item) && !freecam) -#endif K_drawKartItem(); // If not splitscreen, draw... if (!r_splitscreen && !demo.title) { // Draw the timestamp -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_time)) -#endif K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0); if (!modeattacking) @@ -11085,9 +11067,7 @@ void K_drawKartHUD(void) // Draw the speedometer if (cv_kartspeedometer.value && !r_splitscreen) { -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_speedometer)) -#endif K_drawKartSpeedometer(); } @@ -11113,12 +11093,10 @@ void K_drawKartHUD(void) V_DrawTinyScaledPatch(x-54, y, 0, W_CachePatchName("TTKBANNR", PU_CACHE)); V_DrawTinyScaledPatch(x-54, y+25, 0, W_CachePatchName("TTKART", PU_CACHE)); } - else if (G_RaceGametype()) // Race-only elements + else if (gametype == GT_RACE) // Race-only elements { // Draw the lap counter -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_gametypeinfo)) -#endif K_drawKartLapsAndRings(); if (isfreeplay) @@ -11126,26 +11104,20 @@ void K_drawKartHUD(void) else if (!modeattacking) { // Draw the numerical position -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_position)) -#endif K_DrawKartPositionNum(stplyr->kartstuff[k_position]); } else //if (!(demo.playback && hu_showscores)) { // Draw the input UI -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_position)) -#endif K_drawInput(); } } - else if (G_BattleGametype()) // Battle-only + else if (gametype == GT_BATTLE) // Battle-only { // Draw the hits left! -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_gametypeinfo)) -#endif K_drawKartBumpersOrKarma(); } } @@ -11168,7 +11140,7 @@ void K_drawKartHUD(void) } // Race overlays - if (G_RaceGametype() && !freecam) + if (gametype == GT_RACE && !freecam) { if (stplyr->exiting) K_drawKartFinish(); @@ -11179,15 +11151,13 @@ void K_drawKartHUD(void) if (modeattacking || freecam) // everything after here is MP and debug only return; - if (G_BattleGametype() && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * + if (gametype == GT_BATTLE && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); // Draw FREE PLAY. if (isfreeplay && !stplyr->spectator && timeinmap > 113) { -#ifdef HAVE_BLUA if (LUA_HudEnabled(hud_freeplay)) -#endif K_drawKartFreePlay(leveltime); } @@ -11219,7 +11189,7 @@ void K_drawKartHUD(void) INT32 x = 0, y = 0; UINT8 c; - for (c = 1; c < MAXSKINCOLORS; c++) + for (c = 1; c < numskincolors; c++) { UINT8 *cm = R_GetTranslationColormap(TC_RAINBOW, c, GTC_CACHE); V_DrawFixedPatch(x<>1, 0, facewantprefix[stplyr->skin], cm); diff --git a/src/k_pwrlv.c b/src/k_pwrlv.c index 8101a013e..363600718 100644 --- a/src/k_pwrlv.c +++ b/src/k_pwrlv.c @@ -88,9 +88,9 @@ INT16 K_CalculatePowerLevelAvg(void) return 0; // No average. } - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) t = PWRLV_RACE; - else if (G_BattleGametype()) + else if ((gametyperules & GTR_BUMPERS)) t = PWRLV_BATTLE; if (t == PWRLV_DISABLED) @@ -282,9 +282,9 @@ void K_PlayerForfeit(UINT8 playernum, boolean pointloss) if (p < 2) // no players return; - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) powertype = PWRLV_RACE; - else if (G_BattleGametype()) + else if ((gametyperules & GTR_BUMPERS)) powertype = PWRLV_BATTLE; if (powertype == PWRLV_DISABLED) // No power type?! diff --git a/src/lua_baselib.c b/src/lua_baselib.c index fd9f56af9..d70ed8228 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3425,22 +3425,6 @@ static int lib_gGametypeUsesLives(lua_State *L) return 1; } -static int lib_gGametypeUsesCoopLives(lua_State *L) -{ - //HUDSAFE - INLEVEL - lua_pushboolean(L, G_GametypeUsesCoopLives()); - return 1; -} - -static int lib_gGametypeUsesCoopStarposts(lua_State *L) -{ - //HUDSAFE - INLEVEL - lua_pushboolean(L, G_GametypeUsesCoopStarposts()); - return 1; -} - static int lib_gGametypeHasTeams(lua_State *L) { //HUDSAFE @@ -3457,30 +3441,6 @@ static int lib_gGametypeHasSpectators(lua_State *L) return 1; } -static int lib_gBattleGametype(lua_State *L) -{ - //HUDSAFE - INLEVEL - lua_pushboolean(L, G_BattleGametype()); - return 1; -} - -static int lib_gRaceGametype(lua_State *L) -{ - //HUDSAFE - INLEVEL - lua_pushboolean(L, G_RaceGametype()); - return 1; -} - -static int lib_gTagGametype(lua_State *L) -{ - //HUDSAFE - INLEVEL - lua_pushboolean(L, G_TagGametype()); - return 1; -} - static int lib_gTicsToHours(lua_State *L) { tic_t rtic = luaL_checkinteger(L, 1); @@ -4251,13 +4211,8 @@ static luaL_Reg lib[] = { {"G_ExitLevel",lib_gExitLevel}, {"G_IsSpecialStage",lib_gIsSpecialStage}, {"G_GametypeUsesLives",lib_gGametypeUsesLives}, - {"G_GametypeUsesCoopLives",lib_gGametypeUsesCoopLives}, - {"G_GametypeUsesCoopStarposts",lib_gGametypeUsesCoopStarposts}, {"G_GametypeHasTeams",lib_gGametypeHasTeams}, {"G_GametypeHasSpectators",lib_gGametypeHasSpectators}, - {"G_BattleGametype",lib_gBattleGametype}, - {"G_RaceGametype",lib_gRaceGametype}, - {"G_TagGametype",lib_gTagGametype}, {"G_TicsToHours",lib_gTicsToHours}, {"G_TicsToMinutes",lib_gTicsToMinutes}, {"G_TicsToSeconds",lib_gTicsToSeconds}, diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 46d94373e..b670ca348 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -2213,7 +2213,8 @@ boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source) } lua_settop(gL, 0); return hooked; -======= +} + // Hook for game quitting void LUAh_GameQuit(void) { @@ -2238,5 +2239,4 @@ void LUAh_GameQuit(void) } lua_pop(gL, 1); // Pop error handler ->>>>>>> srb2/next } diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index fa49ddff9..7cbe7a6cc 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -15,7 +15,6 @@ #include "tables.h" #include "p_local.h" #include "doomstat.h" // for ALL7EMERALDS -#include "k_color.h" // KartColor_Opposite #include "lua_script.h" #include "lua_libs.h" diff --git a/src/lua_script.c b/src/lua_script.c index 06a89abc8..a812d7c18 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -320,14 +320,14 @@ int LUA_PushGlobals(lua_State *L, const char *word) LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); return 1; } else if (fastcmp(word,"displayplayer")) { // player visible on screen (aka display player 1) - if (displayplayer < 0 || !playeringame[displayplayer]) + if (displayplayers[0] < 0 || !playeringame[displayplayers[0]]) return 0; - LUA_PushUserdata(L, &players[displayplayer], META_PLAYER); + LUA_PushUserdata(L, &players[displayplayers[0]], META_PLAYER); return 1; } else if (fastcmp(word,"secondarydisplayplayer")) { // local/display player 2, for splitscreen - if (!splitscreen || secondarydisplayplayer < 0 || !playeringame[secondarydisplayplayer]) + if (splitscreen < 1 || displayplayers[1] < 0 || !playeringame[displayplayers[1]]) return 0; - LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER); + LUA_PushUserdata(L, &players[displayplayers[1]], META_PLAYER); return 1; } else if (fastcmp(word,"isserver")) { lua_pushboolean(L, server); diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 500a44b40..8fd6f6d62 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -25,7 +25,6 @@ enum skin { skin_wadnum, skin_flags, skin_realname, - skin_hudname, skin_facerank, skin_facewant, skin_facemmap, @@ -36,9 +35,11 @@ enum skin { skin_followitem, skin_starttranscolor, skin_prefcolor, - skin_highresscale, - skin_soundsid, - skin_availability + skin_supercolor, + skin_prefoppositecolor, + skin_highresscale, + skin_rivals, + skin_soundsid }; static const char *const skin_opt[] = { "valid", @@ -47,20 +48,19 @@ static const char *const skin_opt[] = { "wadnum", "flags", "realname", - "hudname", "facerank", "facewant", "facemmap", - // SRB2kart "kartspeed", "kartweight", - // "followitem", "starttranscolor", "prefcolor", + "supercolor", + "prefoppositecolor", "highresscale", + "rivals", "soundsid", - "availability", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field]) @@ -93,9 +93,6 @@ static int skin_get(lua_State *L) case skin_realname: lua_pushstring(L, skin->realname); break; - case skin_hudname: - lua_pushstring(L, skin->hudname); - break; case skin_facerank: for (i = 0; i < 8; i++) if (!skin->facerank[i]) @@ -131,15 +128,21 @@ static int skin_get(lua_State *L) case skin_prefcolor: lua_pushinteger(L, skin->prefcolor); break; + case skin_supercolor: + lua_pushinteger(L, skin->supercolor); + break; + case skin_prefoppositecolor: + lua_pushinteger(L, skin->prefoppositecolor); + break; case skin_highresscale: lua_pushinteger(L, skin->highresscale); break; + case skin_rivals: + // This would be pretty cool to push + return UNIMPLEMENTED; case skin_soundsid: LUA_PushUserdata(L, skin->soundsid, META_SOUNDSID); break; - case skin_availability: - lua_pushinteger(L, skin->availability); - break; } return 1; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 999e12089..577865ada 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -804,21 +804,6 @@ void Command_CauseCfail_f(void) players[consoleplayer].rings = 1337; players[consoleplayer].mo->destscale = 25; P_SetThingPosition(players[consoleplayer].mo); - - // CTF consistency test - if (gametyperules & GTR_TEAMFLAGS) - { - if (blueflag) { - P_RemoveMobj(blueflag); - blueflag = NULL; - } - if (redflag) - { - redflag->x = 423423; - redflag->y = 666; - redflag->z = 123311; - } - } } #endif diff --git a/src/m_cond.c b/src/m_cond.c index e90999b5e..b42a882e9 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -271,7 +271,10 @@ void M_SilentUpdateUnlockablesAndEmblems(void) unlockables[i].unlocked = M_Achieved(unlockables[i].conditionset - 1); } - players[consoleplayer].availabilities = players[1].availabilities = R_GetSkinAvailabilities(); // players[1] is supposed to be for 2p + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + players[g_localplayers[i]].availabilities = R_GetSkinAvailabilities(); + } } // Emblem unlocking shit diff --git a/src/m_menu.c b/src/m_menu.c index 02dff5cf3..06e54c01c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -272,7 +272,7 @@ static void M_SetupMultiHandler(INT32 choice); // Split into multiple parts due to size // Controls menu_t OP_ControlsDef, OP_AllControlsDef; -menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; +menu_t OP_MouseOptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def, OP_Joystick3Def, OP_Joystick4Def; static void M_VideoModeMenu(INT32 choice); static void M_Setup1PControlsMenu(INT32 choice); @@ -390,6 +390,9 @@ static void M_HandleMonitorToggles(INT32 choice); // Consvar onchange functions static void Nextmap_OnChange(void); static void Newgametype_OnChange(void); +#ifdef HWRENDER +static void Newrenderer_OnChange(void); +#endif static void Dummymenuplayer_OnChange(void); //static void Dummymares_OnChange(void); static void Dummystaff_OnChange(void); @@ -732,6 +735,7 @@ static menuitem_t MISC_HelpMenu[] = // Pause Menu Pandora's Box Options static menuitem_t SR_PandorasBox[] = { + /* {IT_STRING | IT_CVAR, NULL, "Rings", &cv_dummyrings, 20}, {IT_STRING | IT_CVAR, NULL, "Lives", &cv_dummylives, 30}, {IT_STRING | IT_CVAR, NULL, "Continues", &cv_dummycontinues, 40}, @@ -743,6 +747,7 @@ static menuitem_t SR_PandorasBox[] = {IT_STRING | IT_CALL, NULL, "Destroy All Robots", M_DestroyRobots, 100}, {IT_STRING | IT_CALL, NULL, "Ultimate Cheat", M_UltimateCheat, 130}, + */ }; // Sky Room Custom Unlocks @@ -829,7 +834,7 @@ enum static menuitem_t SP_GrandPrixPlaceholderMenu[] = { {IT_STRING|IT_CVAR, NULL, "Character", &cv_chooseskin, 10}, - {IT_STRING|IT_CVAR, NULL, "Color", &cv_playercolor, 20}, + {IT_STRING|IT_CVAR, NULL, "Color", &cv_playercolor[0], 20}, {IT_STRING|IT_CVAR, NULL, "Difficulty", &cv_dummygpdifficulty, 40}, {IT_STRING|IT_CVAR, NULL, "Encore Mode", &cv_dummygpencore, 50}, @@ -1168,49 +1173,49 @@ static menuitem_t OP_AllControlsMenu[] = static menuitem_t OP_Joystick1Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , 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}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[0] , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[0] , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[0] , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[0] , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[0] , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[0] , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[0] , 90}, }; static menuitem_t OP_Joystick2Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , 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}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[1] , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[1] , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[1] , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[1] , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[1] , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[1] , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[1] , 90}, }; static menuitem_t OP_Joystick3Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , 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}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[2] , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[2] , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[2] , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[2] , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[2] , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[2] , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[2] , 90}, }; static menuitem_t OP_Joystick4Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , 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}, + {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[3] , 30}, + {IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[3] , 40}, + {IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[3] , 50}, + {IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[3] , 60}, + {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[3] , 70}, + {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[3] , 80}, + {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis[3] , 90}, }; static menuitem_t OP_JoystickSetMenu[] = @@ -1225,7 +1230,8 @@ static menuitem_t OP_JoystickSetMenu[] = {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*8)+5}, }; -/*static menuitem_t OP_MouseOptionsMenu[] = +/* +static menuitem_t OP_MouseOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10}, @@ -1239,21 +1245,7 @@ static menuitem_t OP_JoystickSetMenu[] = {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 80}, }; - -static menuitem_t OP_Mouse2OptionsMenu[] = -{ - {IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10}, - {IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port", - &cv_mouse2port, 20}, - {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook2, 30}, - {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook2, 40}, - {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 60}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens2, 70}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens2, 80}, -};*/ +*/ static menuitem_t OP_VideoOptionsMenu[] = { @@ -2230,51 +2222,61 @@ static void Dummystaff_OnChange(void) // Newgametype. Used for gametype changes. static void Newgametype_OnChange(void) { - if (cv_nextmap.value && menuactive) + if (menuactive && cv_nextmap.value) { - if (!mapheaderinfo[cv_nextmap.value-1]) + if(!mapheaderinfo[cv_nextmap.value-1]) P_AllocMapHeader((INT16)(cv_nextmap.value-1)); - if ((cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || // SRB2kart - //(cv_newgametype.value == GT_COMPETITION && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_COMPETITION)) || - //(cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || - ((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH))) // || - //((cv_newgametype.value == GT_TAG || cv_newgametype.value == GT_HIDEANDSEEK) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_TAG)) || - //(cv_newgametype.value == GT_CTF && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_CTF))) - { - INT32 value = 0; - - switch (cv_newgametype.value) - { - case GT_COOP: - value = TOL_RACE; // SRB2kart - break; - case GT_COMPETITION: - value = TOL_COMPETITION; - break; - case GT_RACE: - value = TOL_RACE; - break; - case GT_MATCH: - case GT_TEAMMATCH: - value = TOL_MATCH; - break; - case GT_TAG: - case GT_HIDEANDSEEK: - value = TOL_TAG; - break; - case GT_CTF: - value = TOL_CTF; - break; - } - - CV_SetValue(&cv_nextmap, M_FindFirstMap(value)); - //CV_AddValue(&cv_nextmap, -1); - //CV_AddValue(&cv_nextmap, 1); - } + if (!(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & gametypetol[cv_newgametype.value])) + CV_SetValue(&cv_nextmap, M_GetFirstLevelInList(cv_newgametype.value)); } } +#ifdef HWRENDER +static void Newrenderer_AREYOUSURE(INT32 c) +{ + int n; + switch (c) + { + case 'y': + case KEY_ENTER: + n = cv_newrenderer.value; + newrenderer_set |= n; + CV_SetValue(&cv_renderer, n); + break; + default: + CV_StealthSetValue(&cv_newrenderer, cv_renderer.value); + } +} + +static void Newrenderer_OnChange(void) +{ +#if 0 + /* Well this works for now because there's only two options. */ + int n; + n = cv_newrenderer.value; + newrenderer_set |= cv_renderer.value; + if (( newrenderer_set & n )) + CV_SetValue(&cv_renderer, n); + else + { + M_StartMessage( + "The OpenGL renderer is incomplete.\n" + "Some visuals may fail to appear, or\n" + "appear incorrectly.\n" + "Do you still want to switch to it?\n" + "\n" + "(Press 'y' or 'n')", + Newrenderer_AREYOUSURE, MM_YESNO + ); + } +#else + // SRB2Kart: don't want the warning + CV_SetValue(&cv_renderer, n); +#endif +} +#endif/*HWRENDER*/ + void Screenshot_option_Onchange(void) { OP_ScreenshotOptionsMenu[op_screenshot_folder].status = @@ -2327,7 +2329,7 @@ static void M_ChangeCvar(INT32 choice) if (choice == -1) { - if (cv == &cv_playercolor) + if (cv == &cv_playercolor[0]) { SINT8 skinno = R_SkinAvailable(cv_chooseskin.string); if (skinno != -1) @@ -2513,7 +2515,7 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone.value) >> FRACBITS; + const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone[0].value) >> FRACBITS; if (ev->data3 != INT32_MAX) { if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) @@ -2699,8 +2701,11 @@ boolean M_Responder(event_t *ev) else { // dirty hack: for customising controls, I want only buttons/keys, not moves - if (ev->type == ev_mouse || ev->type == ev_mouse2 || ev->type == ev_joystick - || ev->type == ev_joystick2 || ev->type == ev_joystick3 || ev->type == ev_joystick4) + if (ev->type == ev_mouse + || ev->type == ev_joystick + || ev->type == ev_joystick2 + || ev->type == ev_joystick3 + || ev->type == ev_joystick4) return true; if (routine) { @@ -4229,7 +4234,7 @@ static void M_PatchSkinNameTable(void) } } - j = R_SkinAvailable(cv_skin.string); + j = R_SkinAvailable(cv_skin[0].string); if (j == -1) j = 0; @@ -4306,22 +4311,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (M_MapLocked(mapnum+1)) return false; // not unlocked - /*if (gt == GT_COOP && (mapheaderinfo[mapnum]->typeoflevel & TOL_COOP)) - return true; - - if (gt == GT_COMPETITION && (mapheaderinfo[mapnum]->typeoflevel & TOL_COMPETITION)) - return true; - - if (gt == GT_CTF && (mapheaderinfo[mapnum]->typeoflevel & TOL_CTF)) - return true; - - if ((gt == GT_TAG || gt == GT_HIDEANDSEEK) && (mapheaderinfo[mapnum]->typeoflevel & TOL_TAG)) - return true;*/ - - if ((gt == GT_MATCH || gt == GT_TEAMMATCH) && (mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH)) - return true; - - if (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) + if (mapheaderinfo[mapnum]->typeoflevel & gametypetol[gt]) return true; return false; @@ -4340,7 +4330,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) return false;*/ if ((levellistmode == LLM_TIMEATTACK && !(mapheaderinfo[mapnum]->typeoflevel & TOL_RACE)) - || (levellistmode == LLM_BREAKTHECAPSULES && !(mapheaderinfo[mapnum]->typeoflevel & TOL_MATCH))) + || (levellistmode == LLM_BREAKTHECAPSULES && !(mapheaderinfo[mapnum]->typeoflevel & TOL_BATTLE))) return false; if (M_MapLocked(mapnum+1)) @@ -7706,7 +7696,7 @@ void M_DrawTimeAttackMenu(void) // Character face! if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR) { - UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE); + UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor[0].value, GTC_MENUCACHE); V_DrawMappedPatch(BASEVIDWIDTH-x - SHORT(facewantprefix[cv_chooseskin.value-1]->width), y, 0, facewantprefix[cv_chooseskin.value-1], colormap); } @@ -9088,25 +9078,8 @@ Update the maxplayers label... while (++i <= 4) { - switch (i) - { - default: - pskin = R_SkinAvailable(cv_skin.string); - pcol = cv_playercolor.value; - break; - case 2: - pskin = R_SkinAvailable(cv_skin2.string); - pcol = cv_playercolor2.value; - break; - case 3: - pskin = R_SkinAvailable(cv_skin3.string); - pcol = cv_playercolor3.value; - break; - case 4: - pskin = R_SkinAvailable(cv_skin4.string); - pcol = cv_playercolor4.value; - break; - } + pskin = R_SkinAvailable(cv_skin[i-1].string); + pcol = cv_playercolor[i-1].value; if (pskin >= MAXSKINS) pskin = 0; @@ -9411,8 +9384,8 @@ static void M_DrawSetupMultiPlayerMenu(void) // draw the name of the color you have chosen // Just so people don't go thinking that "Default" is Green. - st = V_StringWidth(KartColor_Names[setupm_fakecolor], 0); - V_DrawString(BASEVIDWIDTH - mx - st, my + 152, highlightflags|V_ALLOWLOWERCASE, KartColor_Names[setupm_fakecolor]); // SRB2kart + st = V_StringWidth(skincolors[setupm_fakecolor].name, 0); + V_DrawString(BASEVIDWIDTH - mx - st, my + 152, highlightflags|V_ALLOWLOWERCASE, skincolors[setupm_fakecolor].name); // SRB2kart if (itemOn == 3) { V_DrawCharacter(BASEVIDWIDTH - mx - 10 - st - (skullAnimCounter/5), my + 152, @@ -9468,7 +9441,7 @@ static void M_DrawSetupMultiPlayerMenu(void) UINT8 h; while (col < 1) - col += MAXSKINCOLORS-1; + col += numskincolors-1; while (j <= colwidth) { if (!(j++)) @@ -9476,9 +9449,9 @@ static void M_DrawSetupMultiPlayerMenu(void) else w = indexwidth; for (h = 0; h < 16; h++) - V_DrawFill(x, my+162+h, w, 1, colortranslations[col][h]); - if (++col >= MAXSKINCOLORS) - col -= MAXSKINCOLORS-1; + V_DrawFill(x, my+162+h, w, 1, skincolors[col].ramp[h]); + if (++col >= numskincolors) + col -= numskincolors-1; x += w; } } @@ -9794,8 +9767,8 @@ static void M_HandleSetupMultiPlayer(INT32 choice) // check color if (setupm_fakecolor < 1) - setupm_fakecolor = MAXSKINCOLORS-1; - if (setupm_fakecolor > MAXSKINCOLORS-1) + setupm_fakecolor = numskincolors-1; + if (setupm_fakecolor > numskincolors-1) setupm_fakecolor = 1; if (exitmenu) @@ -10052,7 +10025,8 @@ static void M_ScreenshotOptions(INT32 choice) static void M_DrawJoystick(void) { - INT32 i, compareval4, compareval3, compareval2, compareval; + INT32 i; + INT32 compareval[MAXSPLITSCREENPLAYERS]; M_DrawGenericMenu(); @@ -10062,47 +10036,24 @@ static void M_DrawJoystick(void) //M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i); #ifdef JOYSTICK_HOTPLUG - if (atoi(cv_usejoystick4.string) > I_NumJoys()) - compareval4 = atoi(cv_usejoystick4.string); + if (atoi(cv_usejoystick[setupcontrolplayer-1].string) > I_NumJoys()) + compareval = atoi(cv_usejoystick[setupcontrolplayer-1].string); else - compareval4 = cv_usejoystick4.value; - - if (atoi(cv_usejoystick3.string) > I_NumJoys()) - compareval3 = atoi(cv_usejoystick3.string); - else - compareval3 = cv_usejoystick3.value; - - if (atoi(cv_usejoystick2.string) > I_NumJoys()) - compareval2 = atoi(cv_usejoystick2.string); - else - compareval2 = cv_usejoystick2.value; - - if (atoi(cv_usejoystick.string) > I_NumJoys()) - compareval = atoi(cv_usejoystick.string); - else - compareval = cv_usejoystick.value; -#else - compareval4 = cv_usejoystick4.value; - compareval3 = cv_usejoystick3.value; - compareval2 = cv_usejoystick2.value; - compareval = cv_usejoystick.value #endif + compareval = cv_usejoystick[setupcontrolplayer-1].value; - if ((setupcontrolplayer == 4 && (i == compareval4)) - || (setupcontrolplayer == 3 && (i == compareval3)) - || (setupcontrolplayer == 2 && (i == compareval2)) - || (setupcontrolplayer == 1 && (i == compareval))) - V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,V_GREENMAP,joystickInfo[i]); - else - V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,0,joystickInfo[i]); + V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4, (i == compareval) ? V_GREENMAP : 0, joystickInfo[i]); } } void M_SetupJoystickMenu(INT32 choice) { - INT32 i = 0; const char *joyNA = "Unavailable"; - INT32 n = I_NumJoys(); + const INT32 n = I_NumJoys(); + + INT32 i = 0; + INT32 j; + (void)choice; strcpy(joystickInfo[i], "None"); @@ -10123,14 +10074,11 @@ void M_SetupJoystickMenu(INT32 choice) // // Update cv_usejoystick.string here so that the user can // properly change this value. - if (i == cv_usejoystick.value) - CV_SetValue(&cv_usejoystick, i); - if (i == cv_usejoystick2.value) - CV_SetValue(&cv_usejoystick2, i); - if (i == cv_usejoystick3.value) - CV_SetValue(&cv_usejoystick3, i); - if (i == cv_usejoystick4.value) - CV_SetValue(&cv_usejoystick4, i); + for (j = 0; j < MAXSPLITSCREENPLAYERS; j++) + { + if (i == cv_usejoystick[j].value) + CV_SetValue(&cv_usejoystick[j], i); + } #endif } @@ -10167,139 +10115,41 @@ static void M_Setup4PJoystickMenu(INT32 choice) static void M_AssignJoystick(INT32 choice) { + const UINT8 p = setupcontrolplayer-1; + #ifdef JOYSTICK_HOTPLUG INT32 oldchoice, oldstringchoice; INT32 numjoys = I_NumJoys(); - if (setupcontrolplayer == 4) + oldchoice = oldstringchoice = atoi(cv_usejoystick[p].string) > numjoys ? atoi(cv_usejoystick[p].string) : cv_usejoystick[p].value; + CV_SetValue(&cv_usejoystick[p], choice); + + // Just in case last-minute changes were made to cv_usejoystick.value, + // update the string too + // But don't do this if we're intentionally setting higher than numjoys + if (choice <= numjoys) { - oldchoice = oldstringchoice = atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value; - CV_SetValue(&cv_usejoystick4, choice); + CV_SetValue(&cv_usejoystick[p], cv_usejoystick[p].value); - // Just in case last-minute changes were made to cv_usejoystick.value, - // update the string too - // But don't do this if we're intentionally setting higher than numjoys - if (choice <= numjoys) + // reset this so the comparison is valid + if (oldchoice > numjoys) + oldchoice = cv_usejoystick[p].value; + + if (oldchoice != choice) { - CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value); + if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device + CV_SetValue(&cv_usejoystick[p], (oldstringchoice > numjoys ? oldstringchoice : oldchoice)); - // reset this so the comparison is valid - if (oldchoice > numjoys) - oldchoice = cv_usejoystick4.value; - - if (oldchoice != choice) - { - if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device - CV_SetValue(&cv_usejoystick4, (oldstringchoice > numjoys ? oldstringchoice : oldchoice)); - - if (oldstringchoice == - (atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value)) - M_StartMessage("This joystick is used by another\n" - "player. Reset the joystick\n" - "for that player first.\n\n" - "(Press a key)\n", NULL, MM_NOTHING); - } - } - } - else if (setupcontrolplayer == 3) - { - oldchoice = oldstringchoice = atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value; - CV_SetValue(&cv_usejoystick3, choice); - - // Just in case last-minute changes were made to cv_usejoystick.value, - // update the string too - // But don't do this if we're intentionally setting higher than numjoys - if (choice <= numjoys) - { - CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value); - - // reset this so the comparison is valid - if (oldchoice > numjoys) - oldchoice = cv_usejoystick3.value; - - if (oldchoice != choice) - { - if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device - CV_SetValue(&cv_usejoystick3, (oldstringchoice > numjoys ? oldstringchoice : oldchoice)); - - if (oldstringchoice == - (atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value)) - M_StartMessage("This joystick is used by another\n" - "player. Reset the joystick\n" - "for that player first.\n\n" - "(Press a key)\n", NULL, MM_NOTHING); - } - } - } - else if (setupcontrolplayer == 2) - { - oldchoice = oldstringchoice = atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value; - CV_SetValue(&cv_usejoystick2, choice); - - // Just in case last-minute changes were made to cv_usejoystick.value, - // update the string too - // But don't do this if we're intentionally setting higher than numjoys - if (choice <= numjoys) - { - CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value); - - // reset this so the comparison is valid - if (oldchoice > numjoys) - oldchoice = cv_usejoystick2.value; - - if (oldchoice != choice) - { - if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device - CV_SetValue(&cv_usejoystick2, (oldstringchoice > numjoys ? oldstringchoice : oldchoice)); - - if (oldstringchoice == - (atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value)) - M_StartMessage("This joystick is used by another\n" - "player. Reset the joystick\n" - "for that player first.\n\n" - "(Press a key)\n", NULL, MM_NOTHING); - } - } - } - else if (setupcontrolplayer == 1) - { - oldchoice = oldstringchoice = atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value; - CV_SetValue(&cv_usejoystick, choice); - - // Just in case last-minute changes were made to cv_usejoystick.value, - // update the string too - // But don't do this if we're intentionally setting higher than numjoys - if (choice <= numjoys) - { - CV_SetValue(&cv_usejoystick, cv_usejoystick.value); - - // reset this so the comparison is valid - if (oldchoice > numjoys) - oldchoice = cv_usejoystick.value; - - if (oldchoice != choice) - { - if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device - CV_SetValue(&cv_usejoystick, (oldstringchoice > numjoys ? oldstringchoice : oldchoice)); - - if (oldstringchoice == - (atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value)) - M_StartMessage("This joystick is used by another\n" - "player. Reset the joystick\n" - "for that player first.\n\n" - "(Press a key)\n", NULL, MM_NOTHING); - } + if (oldstringchoice == + (atoi(cv_usejoystick[p].string) > numjoys ? atoi(cv_usejoystick[p].string) : cv_usejoystick[p].value)) + M_StartMessage("This joystick is used by another\n" + "player. Reset the joystick\n" + "for that player first.\n\n" + "(Press a key)\n", NULL, MM_NOTHING); } } #else - if (setupcontrolplayer == 4) - CV_SetValue(&cv_usejoystick4, choice); - else if (setupcontrolplayer == 3) - CV_SetValue(&cv_usejoystick3, choice); - else if (setupcontrolplayer == 2) - CV_SetValue(&cv_usejoystick2, choice); - else if (setupcontrolplayer == 1) - CV_SetValue(&cv_usejoystick, choice); + CV_SetValue(&cv_usejoystick[p], choice); #endif } @@ -10568,7 +10418,6 @@ static void M_ChangecontrolResponse(event_t *ev) { // ignore mouse/joy movements, just get buttons case ev_mouse: - case ev_mouse2: case ev_joystick: case ev_joystick2: case ev_joystick3: @@ -10669,6 +10518,7 @@ static void M_ChangeControl(INT32 choice) static void M_ResetControlsResponse(INT32 ch) { + const UINT8 p = setupcontrolplayer-1; INT32 i; if (ch != 'y' && ch != KEY_ENTER) @@ -10677,72 +10527,21 @@ static void M_ResetControlsResponse(INT32 ch) // clear all controls for (i = 0; i < num_gamecontrols; i++) { - switch (setupcontrolplayer) - { - case 4: - G_ClearControlKeys(gamecontrol[3], i); - break; - case 3: - G_ClearControlKeys(gamecontrol[2], i); - break; - case 2: - G_ClearControlKeys(gamecontrol[1], i); - break; - case 1: - default: - G_ClearControlKeys(gamecontrol[0], i); - break; - } + G_ClearControlKeys(gamecontrol[p], i); } // Setup original defaults G_Controldefault(setupcontrolplayer); // Setup gamepad option defaults (yucky) - switch (setupcontrolplayer) - { - case 4: - CV_StealthSet(&cv_usejoystick4, cv_usejoystick4.defaultvalue); - CV_StealthSet(&cv_turnaxis4, cv_turnaxis4.defaultvalue); - CV_StealthSet(&cv_moveaxis4, cv_moveaxis4.defaultvalue); - CV_StealthSet(&cv_brakeaxis4, cv_brakeaxis4.defaultvalue); - CV_StealthSet(&cv_aimaxis4, cv_aimaxis4.defaultvalue); - CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue); - CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue); - CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue); - break; - case 3: - CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue); - CV_StealthSet(&cv_turnaxis3, cv_turnaxis3.defaultvalue); - CV_StealthSet(&cv_moveaxis3, cv_moveaxis3.defaultvalue); - CV_StealthSet(&cv_brakeaxis3, cv_brakeaxis3.defaultvalue); - CV_StealthSet(&cv_aimaxis3, cv_aimaxis3.defaultvalue); - CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue); - CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue); - CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue); - break; - case 2: - CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue); - CV_StealthSet(&cv_turnaxis2, cv_turnaxis2.defaultvalue); - CV_StealthSet(&cv_moveaxis2, cv_moveaxis2.defaultvalue); - CV_StealthSet(&cv_brakeaxis2, cv_brakeaxis2.defaultvalue); - CV_StealthSet(&cv_aimaxis2, cv_aimaxis2.defaultvalue); - CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue); - CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue); - CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue); - break; - case 1: - default: - CV_StealthSet(&cv_usejoystick, cv_usejoystick.defaultvalue); - CV_StealthSet(&cv_turnaxis, cv_turnaxis.defaultvalue); - CV_StealthSet(&cv_moveaxis, cv_moveaxis.defaultvalue); - CV_StealthSet(&cv_brakeaxis, cv_brakeaxis.defaultvalue); - CV_StealthSet(&cv_aimaxis, cv_aimaxis.defaultvalue); - CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue); - CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue); - CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue); - break; - } + CV_StealthSet(&cv_usejoystick[p], cv_usejoystick[p].defaultvalue); + CV_StealthSet(&cv_turnaxis[p], cv_turnaxis[p].defaultvalue); + CV_StealthSet(&cv_moveaxis[p], cv_moveaxis[p].defaultvalue); + CV_StealthSet(&cv_brakeaxis[p], cv_brakeaxis[p].defaultvalue); + CV_StealthSet(&cv_aimaxis[p], cv_aimaxis[p].defaultvalue); + CV_StealthSet(&cv_lookaxis[p], cv_lookaxis[p].defaultvalue); + CV_StealthSet(&cv_fireaxis[p], cv_fireaxis[p].defaultvalue); + CV_StealthSet(&cv_driftaxis[p], cv_driftaxis[p].defaultvalue); S_StartSound(NULL, sfx_s224); } diff --git a/src/m_misc.c b/src/m_misc.c index 97c2e2f6b..865f1bbe1 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -106,7 +106,6 @@ consvar_t cv_screenshot_option = {"screenshot_option", "Default", CV_SAVE|CV_CAL consvar_t cv_screenshot_folder = {"screenshot_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_screenshot_colorprofile = {"screenshot_colorprofile", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; ->>>>>>> srb2/next static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}}; consvar_t cv_moviemode = {"moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange, 0, NULL, NULL, 0, 0, NULL}; @@ -572,10 +571,11 @@ void M_FirstLoadConfig(void) gameconfig_loaded = true; // reset to default player stuff - COM_BufAddText (va("%s \"%s\"\n",cv_skin.name,cv_defaultskin.string)); - COM_BufAddText (va("%s \"%s\"\n",cv_playercolor.name,cv_defaultplayercolor.string)); - COM_BufAddText (va("%s \"%s\"\n",cv_skin2.name,cv_defaultskin2.string)); - COM_BufAddText (va("%s \"%s\"\n",cv_playercolor2.name,cv_defaultplayercolor2.string)); + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + COM_BufAddText (va("%s \"%s\"\n",cv_skin[i].name,cv_skin[i].defaultvalue)); + COM_BufAddText (va("%s \"%s\"\n",cv_playercolor[i].name,cv_skin[i].defaultvalue)); + } } /** Saves the game configuration. diff --git a/src/p_enemy.c b/src/p_enemy.c index 11f6a7386..a2a752881 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -804,7 +804,7 @@ static int P_RecycleCompare(const void *p1, const void *p2) player_t *player2 = &players[*(const UINT8 *)p2]; // Non-shooting gametypes - if (!G_RaceGametype()) + if (!(gametyperules & GTR_CIRCUIT)) { // Invincibility. if (player1->powers[pw_invulnerability] > player2->powers[pw_invulnerability]) return -1; @@ -5083,7 +5083,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) return true; if (thing->player && (thing->player->kartstuff[k_hyudorotimer] - || (G_BattleGametype() && thing->player && thing->player->kartstuff[k_bumper] <= 0 && thing->player->kartstuff[k_comebacktimer]))) + || ((gametyperules & GTR_BUMPERS) && thing->player && thing->player->kartstuff[k_bumper] <= 0 && thing->player->kartstuff[k_comebacktimer]))) return true; if ((gametype == GT_CTF || gametype == GT_TEAMMATCH) @@ -5110,10 +5110,9 @@ void A_GrenadeRing(mobj_t *actor) { INT32 bx, by, xl, xh, yl, yh; explodedist = FixedMul(actor->info->painchance, mapobjectscale); -#ifdef HAVE_BLUA + if (LUA_CallAction("A_GrenadeRing", actor)) return; -#endif if (actor->flags2 & MF2_DEBRIS) return; @@ -5154,7 +5153,7 @@ static inline boolean PIT_MineExplode(mobj_t *thing) if (netgame && thing->player && thing->player->spectator) return true; - if (G_BattleGametype() && grenade->target && grenade->target->player && grenade->target->player->kartstuff[k_bumper] <= 0 && thing == grenade->target) + if ((gametyperules & GTR_BUMPERS) && grenade->target && grenade->target->player && grenade->target->player->kartstuff[k_bumper] <= 0 && thing == grenade->target) return true; // see if it went over / under @@ -5182,10 +5181,9 @@ void A_MineExplode(mobj_t *actor) INT32 locvar1 = var1; mobjtype_t type; explodedist = FixedMul((3*actor->info->painchance)/2, mapobjectscale); -#ifdef HAVE_BLUA + if (LUA_CallAction("A_MineExplode", actor)) return; -#endif if (actor->flags2 & MF2_DEBRIS) return; @@ -6629,9 +6627,8 @@ void A_MixUp(mobj_t *actor) if (!multiplayer) return; - // No mix-up monitors in hide and seek or time only race. // The random factor is okay for other game modes, but in these, it is cripplingly unfair. - if (gametype == GT_HIDEANDSEEK || gametype == GT_RACE) + if (gametyperules & GTR_CIRCUIT) { S_StartSound(actor, sfx_lose); return; @@ -9494,12 +9491,12 @@ void A_ItemPop(mobj_t *actor) if (actor->info->deathsound) S_StartSound(remains, actor->info->deathsound); - if (!(G_BattleGametype() && actor->target->player->kartstuff[k_bumper] <= 0)) + if (!((gametyperules & GTR_BUMPERS) && actor->target->player->kartstuff[k_bumper] <= 0)) actor->target->player->kartstuff[k_itemroulette] = 1; remains->flags2 &= ~MF2_AMBUSH; - if (G_BattleGametype() && (actor->threshold != 69 && actor->threshold != 70)) + if ((gametyperules & GTR_BUMPERS) && (actor->threshold != 69 && actor->threshold != 70)) numgotboxes++; P_RemoveMobj(actor); @@ -9512,14 +9509,13 @@ void A_JawzChase(mobj_t *actor) fixed_t thrustamount = 0; fixed_t frictionsafety = (actor->friction == 0) ? 1 : actor->friction; fixed_t topspeed = actor->movefactor; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_JawzChase", actor)) return; -#endif if (actor->tracer) { - /*if (G_RaceGametype()) // Stop looking after first target in race + /*if ((gametyperules & GTR_CIRCUIT)) // Stop looking after first target in race actor->extravalue1 = 1;*/ if (actor->tracer->health) @@ -9529,7 +9525,7 @@ void A_JawzChase(mobj_t *actor) angle_t angledelta = actor->angle - targetangle; boolean turnclockwise = true; - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { const fixed_t distbarrier = FixedMul(512*mapobjectscale, FRACUNIT + ((gamespeed-1) * (FRACUNIT/4))); const fixed_t distaway = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); @@ -9636,10 +9632,8 @@ void A_JawzExplode(mobj_t *actor) INT32 shrapnel = 2; mobj_t *truc; -#ifdef HAVE_BLUA if (LUA_CallAction("A_JawzExplode", actor)) return; -#endif truc = P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOOMEXPLODE); truc->scale = actor->scale*2; @@ -9791,10 +9785,8 @@ void A_SPBChase(mobj_t *actor) fixed_t pdist = 1536<x, actor->y, actor->z, MT_BALLHOGBOOM); P_SetScale(mo2, actor->scale*2); @@ -10195,10 +10186,10 @@ void A_BallhogExplode(mobj_t *actor) void A_LightningFollowPlayer(mobj_t *actor) { fixed_t sx, sy; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_LightningFollowPlayer", actor)) return; -#endif + if (!actor->target) return; @@ -10224,10 +10215,10 @@ void A_LightningFollowPlayer(mobj_t *actor) void A_FZBoomFlash(mobj_t *actor) { UINT8 i; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_FZBoomFlash", actor)) return; -#endif + for (i = 0; i < MAXPLAYERS; i++) { fixed_t dist; @@ -10247,10 +10238,10 @@ void A_FZBoomSmoke(mobj_t *actor) { INT32 i; INT32 rad = 47+(23*var1); -#ifdef HAVE_BLUA + if (LUA_CallAction("A_FZBoomSmoke", actor)) return; -#endif + for (i = 0; i < 8+(4*var1); i++) { mobj_t *smoke = P_SpawnMobj(actor->x + (P_RandomRange(-rad, rad)*actor->scale), actor->y + (P_RandomRange(-rad, rad)*actor->scale), @@ -10269,10 +10260,9 @@ void A_RandomShadowFrame(mobj_t *actor) { mobj_t *fire; mobj_t *fake; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_RandomShadowFrame", (actor))) return; -#endif if (!actor->extravalue1) // Hack that spawns thoks that look like random shadows. Otherwise the state would overwrite our frame and that's a pain. { @@ -10318,10 +10308,9 @@ void A_RoamingShadowThinker(mobj_t *actor) { mobj_t *wind; -#ifdef HAVE_BLUA if (LUA_CallAction("A_RoamingShadowThinker", (actor))) return; -#endif + // extravalue1 replaces "movetimer" // extravalue2 replaces "stoptimer" @@ -10376,10 +10365,9 @@ void A_MayonakaArrow(mobj_t *actor) { INT32 flip = 0; INT32 iswarning; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_MayonakaArrow", (actor))) return; -#endif iswarning = actor->spawnpoint->options & MTF_OBJECTSPECIAL; // is our object a warning sign? // "animtimer" is replaced by "extravalue1" here. @@ -10418,10 +10406,8 @@ void A_MementosTPParticles(mobj_t *actor) int i = 0; thinker_t *th; -#ifdef HAVE_BLUA if (LUA_CallAction("A_MementosTPParticles", (actor))) return; -#endif for (; i<4; i++) { @@ -10469,11 +10455,8 @@ void A_ReaperThinker(mobj_t *actor) player_t *player; // used as a shortcut in a loop. mobj_t *targetplayermo = NULL; // the player mo we can eventually target, or whatever. - -#ifdef HAVE_BLUA if (LUA_CallAction("A_ReaperThinker", (actor))) return; -#endif // We don't have custom variables or whatever so we'll do with whatever the fuck we have left. @@ -10642,10 +10625,9 @@ void A_FlameParticle(mobj_t *actor) { fixed_t rad = actor->radius>>FRACBITS, hei = actor->radius>>FRACBITS; mobj_t *par; -#ifdef HAVE_BLUA + if (LUA_CallAction("A_FlameParticle", actor)) return; -#endif par = P_SpawnMobj( actor->x + (P_RandomRange(-rad, rad)<exiting || mapreset) return false; - /*if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) // No bumpers in Match + /*if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0) // No bumpers in Match return false;*/ if (weapon) @@ -237,7 +237,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!P_CanPickupItem(player, 3) || (player->kartstuff[k_itemamount] && player->kartstuff[k_itemtype] != special->threshold)) return; - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0) return; player->kartstuff[k_itemtype] = special->threshold; @@ -258,7 +258,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!P_CanPickupItem(player, 1)) return; - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + if ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0) { if (player->kartstuff[k_comebackmode] || player->kartstuff[k_comebacktimer]) return; @@ -476,7 +476,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(special, sfx_s1a2); return; case MT_CDUFO: // SRB2kart - if (special->fuse || !P_CanPickupItem(player, 1) || (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)) + if (special->fuse || !P_CanPickupItem(player, 1) || ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0)) return; player->kartstuff[k_itemroulette] = 1; @@ -732,208 +732,6 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost) P_ClearStarPost(post->health); } -/** Prints death messages relating to a dying or hit player. - * - * \param player Affected player. - * \param inflictor The attack weapon used, can be NULL. - * \param source The attacker, can be NULL. - * \param damagetype The type of damage dealt to the player. If bit 7 (0x80) is set, this was an instant-kill. - */ -static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype) -{ - const char *str = NULL; - boolean deathonly = false; - boolean deadsource = false; - boolean deadtarget = false; - // player names complete with control codes - char targetname[MAXPLAYERNAME+4]; - char sourcename[MAXPLAYERNAME+4]; - - if (!(gametyperules & (GTR_RINGSLINGER|GTR_HURTMESSAGES))) - return; // Not in coop, etc. - - if (!player) - return; // Impossible! - - if (!player->mo) - return; // Also impossible! - - if (player->spectator) - return; // No messages for dying (crushed) spectators. - - if (!netgame) - return; // Presumably it's obvious what's happening in splitscreen. - - if (LUAh_HurtMsg(player, inflictor, source, damagetype)) - return; - - deadtarget = (player->mo->health <= 0); - - // Don't log every hazard hit if they don't want us to. - if (!deadtarget && !cv_hazardlog.value) - return; - - // Target's name - snprintf(targetname, sizeof(targetname), "%s%s%s", - CTFTEAMCODE(player), - player_names[player - players], - CTFTEAMENDCODE(player)); - - if (source) - { - // inflictor shouldn't be NULL if source isn't - I_Assert(inflictor != NULL); - - if (source->player) - { - // Source's name (now that we know there is one) - snprintf(sourcename, sizeof(sourcename), "%s%s%s", - CTFTEAMCODE(source->player), - player_names[source->player - players], - CTFTEAMENDCODE(source->player)); - - // We don't care if it's us. - // "Player 1's [redacted] killed Player 1." - if (source->player->playerstate == PST_DEAD && source->player != player && - (inflictor->flags2 & MF2_BEYONDTHEGRAVE)) - deadsource = true; - - if (inflictor->flags & MF_PUSHABLE) - { - str = M_GetText("%s%s's playtime with heavy objects %s %s.\n"); - } - else switch (inflictor->type) - { - case MT_PLAYER: - if (damagetype == DMG_NUKE) // SH_ARMAGEDDON, armageddon shield - str = M_GetText("%s%s's armageddon blast %s %s.\n"); - else if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && (inflictor->player->pflags & PF_SHIELDABILITY)) - str = M_GetText("%s%s's elemental stomp %s %s.\n"); - else if (inflictor->player->powers[pw_invulnerability]) - str = M_GetText("%s%s's invincibility aura %s %s.\n"); - else if (inflictor->player->powers[pw_super]) - str = M_GetText("%s%s's super aura %s %s.\n"); - else - str = M_GetText("%s%s's tagging hand %s %s.\n"); - break; - case MT_SPINFIRE: - str = M_GetText("%s%s's elemental fire trail %s %s.\n"); - break; - case MT_THROWNBOUNCE: - str = M_GetText("%s%s's bounce ring %s %s.\n"); - break; - case MT_THROWNINFINITY: - str = M_GetText("%s%s's infinity ring %s %s.\n"); - break; - case MT_THROWNAUTOMATIC: - str = M_GetText("%s%s's automatic ring %s %s.\n"); - break; - case MT_THROWNSCATTER: - str = M_GetText("%s%s's scatter ring %s %s.\n"); - break; - // TODO: For next two, figure out how to determine if it was a direct hit or splash damage. -SH - case MT_THROWNEXPLOSION: - str = M_GetText("%s%s's explosion ring %s %s.\n"); - break; - case MT_THROWNGRENADE: - str = M_GetText("%s%s's grenade ring %s %s.\n"); - break; - case MT_REDRING: - if (inflictor->flags2 & MF2_RAILRING) - str = M_GetText("%s%s's rail ring %s %s.\n"); - else - str = M_GetText("%s%s's thrown ring %s %s.\n"); - break; - default: - str = M_GetText("%s%s %s %s.\n"); - break; - } - - CONS_Printf(str, - deadsource ? M_GetText("The late ") : "", - sourcename, - deadtarget ? M_GetText("killed") : M_GetText("hit"), - targetname); - return; - } - else switch (source->type) - { - case MT_EGGMAN_ICON: - str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n"); - break; - case MT_SPIKE: - case MT_WALLSPIKE: - str = M_GetText("%s was %s by spikes.\n"); - break; - default: - str = M_GetText("%s was %s by an environmental hazard.\n"); - break; - } - } - else - { - // null source, environment kills - switch (damagetype) - { - case DMG_WATER: - str = M_GetText("%s was %s by dangerous water.\n"); - break; - case DMG_FIRE: - str = M_GetText("%s was %s by molten lava.\n"); - break; - case DMG_ELECTRIC: - str = M_GetText("%s was %s by electricity.\n"); - break; - case DMG_SPIKE: - str = M_GetText("%s was %s by spikes.\n"); - break; - case DMG_DROWNED: - deathonly = true; - str = M_GetText("%s drowned.\n"); - break; - case DMG_CRUSHED: - deathonly = true; - str = M_GetText("%s was crushed.\n"); - break; - case DMG_DEATHPIT: - if (deadtarget) - { - deathonly = true; - str = M_GetText("%s fell into a bottomless pit.\n"); - } - break; - case DMG_SPACEDROWN: - if (deadtarget) - { - deathonly = true; - str = M_GetText("%s asphyxiated in space.\n"); - } - break; - default: - if (deadtarget) - { - deathonly = true; - str = M_GetText("%s died.\n"); - } - break; - } - if (!str) - str = M_GetText("%s was %s by an environmental hazard.\n"); - } - - if (!str) // Should not happen! Unless we missed catching something above. - return; - - if (deathonly) - { - if (!deadtarget) - return; - CONS_Printf(str, targetname); - } - else - CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit")); -} - // Easily make it so that overtime works offline //#define TESTOVERTIMEINFREEPLAY @@ -1353,7 +1151,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if (target->player == &players[displayplayers[2]]) localaiming[2] = 0; if (target->player == &players[displayplayers[3]]) localaiming[3] = 0; - if (G_BattleGametype()) + if ((gametyperules & GTR_BUMPERS)) K_CheckBumpers(); target->player->kartstuff[k_pogospring] = 0; @@ -1828,7 +1626,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) P_SetTarget(&boom->target, player->mo); } - if (G_BattleGametype()) + if ((gametyperules & GTR_BUMPERS)) { if (player->kartstuff[k_bumper] > 0) { @@ -2047,7 +1845,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) fixed_t momxy = 5<player->kartstuff[k_bumper] && !tmthing->player->kartstuff[k_bumper]) || (tmthing->player->kartstuff[k_bumper] && !thing->player->kartstuff[k_bumper]))) { @@ -1392,7 +1392,7 @@ static boolean PIT_CheckThing(mobj_t *thing) mo1 = thing; mo2 = tmthing; - if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring]) + if ((gametyperules & GTR_BUMPERS) && tmthing->player->kartstuff[k_pogospring]) { K_StealBumper(tmthing->player, thing->player, false); K_SpinPlayer(thing->player, tmthing, 0, tmthing, false); @@ -1402,14 +1402,14 @@ static boolean PIT_CheckThing(mobj_t *thing) { zbounce = true; - if (G_BattleGametype() && thing->player->kartstuff[k_pogospring]) + if ((gametyperules & GTR_BUMPERS) && thing->player->kartstuff[k_pogospring]) { K_StealBumper(thing->player, tmthing->player, false); K_SpinPlayer(tmthing->player, thing, 0, thing, false); } } - if (G_BattleGametype()) + if ((gametyperules & GTR_BUMPERS)) { if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]) && !(thing->player->powers[pw_flashing])) // Don't steal bumpers while intangible { diff --git a/src/p_mobj.c b/src/p_mobj.c index 33f6afda0..e568eea61 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3337,7 +3337,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled dummy.z = thiscam->z; dummy.height = thiscam->height; - if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) + if ((player->pflags & PF_TIMEOVER) && (gametyperules & GTR_CIRCUIT)) { player->karthud[khud_timeovercam] = (2*TICRATE)+1; } @@ -3614,17 +3614,6 @@ void P_RecalcPrecipInSector(sector_t *sector) CalculatePrecipFloor(psecnode->m_thing); } -// -// P_NullPrecipThinker -// -// For "Blank" precipitation -// -void P_NullPrecipThinker(precipmobj_t *mobj) -{ - //(void)mobj; - mobj->precipflags &= ~PCF_THUNK; -} - void P_PrecipThinker(precipmobj_t *mobj) { P_CycleStateAnimation((mobj_t *)mobj); @@ -3683,49 +3672,8 @@ void P_PrecipThinker(precipmobj_t *mobj) mobj->precipflags |= PCF_SPLASH; } -static void P_KillRingsInLava(mobj_t *mo) -{ - msecnode_t *node; - I_Assert(mo != NULL); - I_Assert(!P_MobjWasRemoved(mo)); - - // go through all sectors being touched by the ring - for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) - { - if (!node->m_sector) - break; - - if (node->m_sector->ffloors) - { - ffloor_t *rover; - fixed_t topheight, bottomheight; - - for (rover = node->m_sector->ffloors; rover; rover = rover->next) // go through all fofs in the sector - { - if (!(rover->flags & FF_EXISTS)) continue; // fof must be real - - if (!(rover->flags & FF_SWIMMABLE // fof must be water - && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3)) // fof must be lava water - continue; - - // find heights of FOF - topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); - bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); - - if (mo->z <= topheight && mo->z + mo->height >= bottomheight) // if ring touches it, KILL IT - { - P_KillMobj(mo, NULL, NULL, DMG_FIRE); - return; - } - } ->>>>>>> srb2/next - } - } -} - static void P_RingThinker(mobj_t *mobj) { - mobj_t *spark; // Ring Fuse if (mobj->momx || mobj->momy) @@ -3762,9 +3710,7 @@ static void P_RingThinker(mobj_t *mobj) if (!mobj->fuse) { -#ifdef HAVE_BLUA if (!LUAh_MobjFuse(mobj)) -#endif { mobj->flags2 &= ~MF2_DONTDRAW; spark = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_SIGNSPARKLE); // Spawn a fancy sparkle @@ -7610,63 +7556,6 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (mobj->movedir) mobj->angle += mobj->movedir; break; - case MT_ROSY: - P_RosySceneryThink(mobj); - break; - case MT_CDLHRT: - { - if (mobj->cvmem < 24) - mobj->cvmem++; - mobj->movedir += ANG10; - P_UnsetThingPosition(mobj); - mobj->x = mobj->extravalue1 + P_ReturnThrustX(mobj, mobj->movedir, mobj->cvmem*mobj->scale); - mobj->y = mobj->extravalue2 + P_ReturnThrustY(mobj, mobj->movedir, mobj->cvmem*mobj->scale); - P_SetThingPosition(mobj); - - if (!mobj->fuse) - { - if (!LUAh_MobjFuse(mobj)) - P_RemoveMobj(mobj); - return; - } - if (mobj->fuse < 0) - return; - if (mobj->fuse < 6) - mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT)); - mobj->fuse--; - } - break; - case MT_FINISHFLAG: - { - if (!mobj->target || mobj->target->player->playerstate == PST_DEAD || !cv_exitmove.value) - { - P_RemoveMobj(mobj); - return; - } - - if (!camera.chase) - mobj->flags2 |= MF2_DONTDRAW; - else - mobj->flags2 &= ~MF2_DONTDRAW; - - P_UnsetThingPosition(mobj); - { - fixed_t radius = FixedMul(10*mobj->info->speed, mobj->target->scale); - angle_t fa; - - mobj->angle += FixedAngle(mobj->info->speed); - - fa = mobj->angle >> ANGLETOFINESHIFT; - - mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); - mobj->y = mobj->target->y + FixedMul(FINESINE(fa),radius); - mobj->z = mobj->target->z + mobj->target->height/2; - } - P_SetThingPosition(mobj); - - P_SetScale(mobj, mobj->target->scale); - } - break; case MT_ORBINAUT_SHIELD: // Kart orbit/trail items case MT_JAWZ_SHIELD: case MT_BANANA_SHIELD: @@ -7837,7 +7726,7 @@ static void P_MobjSceneryThink(mobj_t *mobj) mobj->color = mobj->target->color; K_MatchGenericExtraFlags(mobj, mobj->target); - if ((G_RaceGametype() || mobj->target->player->kartstuff[k_bumper] <= 0) + if (((gametyperules & GTR_CIRCUIT) || mobj->target->player->kartstuff[k_bumper] <= 0) #if 1 // Set to 0 to test without needing to host || (P_IsDisplayPlayer(mobj->target->player)) #endif @@ -8474,7 +8363,7 @@ static boolean P_MobjDeadThink(mobj_t *mobj) if (mobj->flags2 & MF2_AMBUSH) { mobj->colorized = true; - mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1))); + mobj->color = K_RainbowColor(leveltime); mobj->frame |= FF_FULLBRIGHT; } else @@ -9652,7 +9541,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) statenum_t state = (mobj->state-states); if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->spectator - || (G_RaceGametype() || mobj->target->player->kartstuff[k_bumper])) + || ((gametyperules & GTR_CIRCUIT) || mobj->target->player->kartstuff[k_bumper])) { P_RemoveMobj(mobj); return; @@ -9837,8 +9726,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) { if (newcolor != SKINCOLOR_NONE) { - cur->color = KartColor_Opposite[newcolor*2]; - cur->frame = states[S_SIGN_FACE].frame + KartColor_Opposite[newcolor*2+1]; + cur->color = skincolors[newcolor].invcolor; + cur->frame = states[S_SIGN_FACE].frame + skincolors[newcolor].invshade; } } else if (cur->state == &states[S_PLAY_SIGN]) @@ -10322,7 +10211,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (mobj->flags2 & MF2_AMBUSH) { mobj->colorized = true; - mobj->color = (1 + (leveltime % (MAXSKINCOLORS-1))); + mobj->color = K_RainbowColor(leveltime); mobj->frame |= FF_FULLBRIGHT; } else @@ -10769,9 +10658,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } } case MT_RANDOMITEM: - if (G_BattleGametype() && mobj->threshold == 70) + if ((gametyperules & GTR_BUMPERS) && mobj->threshold == 70) { - mobj->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); + mobj->color = K_RainbowColor(leveltime); mobj->colorized = true; if (battleovertime.enabled) @@ -10980,7 +10869,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->color = mobj->target->color; K_MatchGenericExtraFlags(mobj, mobj->target); - if ((G_RaceGametype() || mobj->target->player->kartstuff[k_bumper] <= 0) + if (((gametyperules & GTR_CIRCUIT) || mobj->target->player->kartstuff[k_bumper] <= 0) #if 1 // Set to 0 to test without needing to host || (P_IsDisplayPlayer(mobj->target->player)) #endif @@ -11518,7 +11407,7 @@ static boolean P_FuseThink(mobj_t *mobj) } return false; case MT_RANDOMITEM: - if (G_BattleGametype() && (mobj->threshold != 70)) + if ((gametyperules & GTR_BUMPERS) && (mobj->threshold != 70)) { if (mobj->threshold != 69) break; @@ -12501,7 +12390,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) if (randu > (FRACUNIT/2)) { - mobj->color = P_RandomKey(MAXSKINCOLORS-1)+1; + mobj->color = P_RandomKey(numskincolors-1)+1; break; } @@ -12903,8 +12792,6 @@ void P_RemoveSavegameMobj(mobj_t *mobj) static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; consvar_t cv_itemrespawntime = {"respawnitemtime", "2", CV_NETVAR|CV_CHEAT, respawnitemtime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_itemrespawn = {"respawnitem", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t flagtime_cons_t[] = {{0, "MIN"}, {300, "MAX"}, {0, NULL}}; -consvar_t cv_flagtime = {"flagtime", "30", CV_NETVAR|CV_CHEAT, flagtime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; void P_SpawnPrecipitation(void) { @@ -13097,7 +12984,7 @@ void P_RespawnBattleBoxes(void) { thinker_t *th; - if (!G_BattleGametype()) + if (!(gametyperules & GTR_BUMPERS)) return; for (th = thinkercap.next; th != &thinkercap; th = th->next) @@ -13163,7 +13050,7 @@ void P_RespawnSpecials(void) mobj_t *mo = NULL; mapthing_t *mthing = NULL; - if (G_BattleGametype() && numgotboxes >= (4*nummapboxes/5)) // Battle Mode respawns all boxes in a different way + if ((gametyperules & GTR_BUMPERS) && numgotboxes >= (4*nummapboxes/5)) // Battle Mode respawns all boxes in a different way P_RespawnBattleBoxes(); // wait time depends on player count @@ -13371,7 +13258,7 @@ void P_SpawnPlayer(INT32 playernum) if (p->kartstuff[k_respawn] != 0) p->mo->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY; - if (G_BattleGametype()) // SRB2kart + if ((gametyperules & GTR_BUMPERS)) // SRB2kart { mobj_t *overheadarrow = P_SpawnMobj(mobj->x, mobj->y, mobj->z + mobj->height + 16*FRACUNIT, MT_PLAYERARROW); P_SetTarget(&overheadarrow->target, mobj); @@ -13593,10 +13480,6 @@ void P_MovePlayerToStarpost(INT32 playernum) leveltime = p->starposttime; } -#define MAXHUNTEMERALDS 64 -mapthing_t *huntemeralds[MAXHUNTEMERALDS]; -INT32 numhuntemeralds; - fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t dz, const fixed_t offset, const boolean flip, const fixed_t scale) { const subsector_t *ss = R_PointInSubsector(x, y); @@ -13620,58 +13503,22 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt switch (mobjtype) { - // Bumpers never spawn flipped. - case MT_NIGHTSBUMPER: - flip = false; - break; - // Objects with a non-zero default height. - case MT_CRAWLACOMMANDER: - case MT_DETON: - case MT_JETTBOMBER: - case MT_JETTGUNNER: - case MT_EGGMOBILE2: - if (!dz) - dz = 33*FRACUNIT; - break; - case MT_EGGMOBILE: - if (!dz) - dz = 128*FRACUNIT; - break; - case MT_GOLDBUZZ: - case MT_REDBUZZ: - if (!dz) - dz = 288*FRACUNIT; - break; + // (None yet) // Horizontal springs, may float additional units with MTF_AMBUSH. case MT_YELLOWHORIZ: case MT_REDHORIZ: case MT_BLUEHORIZ: - offset += mthing->options & MTF_AMBUSH ? 16*FRACUNIT : 0; + offset += mthing->options & MTF_AMBUSH ? 16*mapobjectscale : 0; break; // Ring-like items, may float additional units with MTF_AMBUSH. case MT_SPIKEBALL: - case MT_EMERHUNT: - case MT_EMERALDSPAWN: - case MT_TOKEN: case MT_EMBLEM: case MT_RING: - case MT_REDTEAMRING: - case MT_BLUETEAMRING: - case MT_COIN: - case MT_BLUESPHERE: - case MT_BOMBSPHERE: - case MT_NIGHTSCHIP: - case MT_NIGHTSSTAR: - offset += mthing->options & MTF_AMBUSH ? 24*FRACUNIT : 0; + offset += mthing->options & MTF_AMBUSH ? 24*mapobjectscale : 0; break; - - // Remaining objects. - default: - if (P_WeaponOrPanel(mobjtype)) - offset += mthing->options & MTF_AMBUSH ? 24*FRACUNIT : 0; } if (!(dz + offset)) // Snap to the surfaces when there's no offset set. @@ -13735,13 +13582,8 @@ static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing) else if (mthing->type == 750 // Slope vertex point (formerly chaos spawn) || (mthing->type >= 600 && mthing->type <= 609) // Special placement patterns || mthing->type == 1705 || mthing->type == 1713) // Hoops - return true; // These are handled elsewhere. - else if (mthing->type == mobjinfo[MT_EMERHUNT].doomednum) { - // Emerald Hunt is Coop only. Don't spawn the emerald yet, but save the spawnpoint for later. - if ((gametyperules & GTR_EMERALDHUNT) && numhuntemeralds < MAXHUNTEMERALDS) - huntemeralds[numhuntemeralds++] = mthing; - return true; + return true; // These are handled elsewhere. } return false; @@ -13751,54 +13593,9 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i) { switch (i) { - case MT_EMERALD1: - case MT_EMERALD2: - case MT_EMERALD3: - case MT_EMERALD4: - case MT_EMERALD5: - case MT_EMERALD6: - case MT_EMERALD7: - if (!G_CoopGametype()) // Don't place emeralds in non-coop modes - return false; - - if (metalrecording) - return false; // Metal Sonic isn't for collecting emeralds. - - if (emeralds & mobjinfo[i].speed) // You already have this emerald! - return false; - - break; - case MT_EMERALDSPAWN: - if (!cv_powerstones.value) - return false; - - if (!(gametyperules & GTR_POWERSTONES)) - return false; - - runemeraldmanager = true; - break; - case MT_ROSY: - if (!(G_CoopGametype() || (mthing->options & MTF_EXTRA))) - return false; // she doesn't hang out here - - if (!mariomode && !(netgame || multiplayer) && players[consoleplayer].skin == 3) - return false; // no doubles - - break; - case MT_TOKEN: - if (!(gametyperules & GTR_EMERALDTOKENS)) - return false; // Gametype's not right - - if (tokenbits == 30) - return false; // Too many tokens - - if (tokenlist & (1 << tokenbits++)) - return false; // You already got this token - - break; case MT_EMBLEM: if (netgame || multiplayer) - return false; // Single player + return false; // Single player only if (modifiedgame && !savemoddata) return false; // No cheating!! @@ -13810,138 +13607,19 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i) if (metalrecording) // Metal Sonic can't use these things. { - if ((mobjinfo[i].flags & (MF_ENEMY|MF_BOSS)) || i == MT_TOKEN || i == MT_STARPOST - || i == MT_RING || i == MT_BLUETEAMRING || i == MT_REDTEAMRING || i == MT_COIN - || i == MT_BLUESPHERE || i == MT_BOMBSPHERE || i == MT_NIGHTSCHIP || i == MT_NIGHTSSTAR) + if ((mobjinfo[i].flags & (MF_ENEMY|MF_BOSS)) || i == MT_STARPOST || i == MT_RING) return false; } if (((mobjinfo[i].flags & MF_ENEMY) || (mobjinfo[i].flags & MF_BOSS)) && !(gametyperules & GTR_SPAWNENEMIES)) return false; // No enemies in ringslinger modes - if (!(gametyperules & GTR_ALLOWEXIT) && (i == MT_SIGN)) - return false; // Don't spawn exit signs in wrong game modes - - if (!G_PlatformGametype() && (i == MT_STARPOST)) - return false; // Don't spawn starposts in wrong game modes - - if (!G_RingSlingerGametype() || !cv_specialrings.value) - if (P_WeaponOrPanel(i)) - return false; // Don't place weapons/panels in non-ringslinger modes - - if (!(gametyperules & GTR_TEAMFLAGS)) // CTF specific things - { - if (i == MT_BLUEFLAG || i == MT_REDFLAG) - return false; // No flags in non-CTF modes! - } - else - { - if ((i == MT_BLUEFLAG && blueflag) || (i == MT_REDFLAG && redflag)) - { - CONS_Alert(CONS_ERROR, M_GetText("Only one flag per team allowed in CTF!\n")); - return false; - } - } - - if (modeattacking) // Record Attack special stuff - { - // Don't spawn starposts that wouldn't be usable - if (i == MT_STARPOST) - return false; - } - - if (ultimatemode) - { - if (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING - || i == MT_COIN || i == MT_NIGHTSSTAR || i == MT_NIGHTSCHIP - || i == MT_PITY_BOX || i == MT_ELEMENTAL_BOX || i == MT_ATTRACT_BOX - || i == MT_FORCE_BOX || i == MT_ARMAGEDDON_BOX || i == MT_WHIRLWIND_BOX - || i == MT_FLAMEAURA_BOX || i == MT_BUBBLEWRAP_BOX || i == MT_THUNDERCOIN_BOX - || i == MT_RING_BOX || i == MT_STARPOST) - return false; // No rings or shields in Ultimate mode - - // Don't include the gold repeating boxes here please. - // They're likely facets of the level's design and therefore required to progress. - } - return true; } -#define nightsreplace ((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) - static mobjtype_t P_GetMobjtypeSubstitute(mapthing_t *mthing, mobjtype_t i) { - // Altering monitor spawns via cvars - // If MF_GRENADEBOUNCE is set in the monitor's info, - // skip this step. (Used for gold monitors) - // Yeah, this is a dirty hack. - if ((mobjinfo[i].flags & (MF_MONITOR|MF_GRENADEBOUNCE)) == MF_MONITOR) - { - if (gametyperules & GTR_RACE) - { - // Set powerup boxes to user settings for competition. - switch (cv_competitionboxes.value) - { - case 1: // Mystery - return MT_MYSTERY_BOX; - case 2: // Teleport - return MT_MIXUP_BOX; - case 3: // None - return MT_NULL; // Don't spawn! - default: - return i; - } - } - // Set powerup boxes to user settings for other netplay modes - else if (!G_CoopGametype()) - { - switch (cv_matchboxes.value) - { - case 1: // Mystery - return MT_MYSTERY_BOX; - case 2: // Unchanging - if (i == MT_MYSTERY_BOX) - return MT_NULL; // don't spawn - mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning! - return i; - case 3: // Don't spawn - return MT_NULL; - default: - return i; - } - } - } - - if (nightsreplace) - { - if (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN) - return MT_NIGHTSSTAR; - - if (i == MT_BLUESPHERE) - return MT_NIGHTSCHIP; - } - - if (!(gametyperules & GTR_TEAMS)) - { - if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING) - return MT_RING; - - if (i == MT_RING_BLUEBOX || i == MT_RING_REDBOX) - return MT_RING_BOX; - } - - if (modeattacking && i == MT_1UP_BOX) // 1UPs -->> Score TVs - { - // Either or, doesn't matter which. - if (mthing->options & (MTF_AMBUSH | MTF_OBJECTSPECIAL)) - return MT_SCORE10K_BOX; // 10,000 - else - return MT_SCORE1K_BOX; // 1,000 - } - - if (mariomode && i == MT_ROSY) - return MT_TOAD; // don't remove on penalty of death - + // Don't need this for Kart YET! return i; } @@ -14380,145 +14058,6 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj) return true; } -static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) -{ - boolean flip = mthing->options & MTF_OBJECTFLIP; - boolean topaligned = (mthing->options & MTF_OBJECTSPECIAL) && !(mthing->options & MTF_EXTRA); - boolean middlealigned = (mthing->options & MTF_EXTRA) && !(mthing->options & MTF_OBJECTSPECIAL); - boolean bottomoffsetted = !(mthing->options & MTF_OBJECTSPECIAL) && !(mthing->options & MTF_EXTRA); - - INT16 timelimit = mthing->angle & 0xFFF; - fixed_t hitboxradius = ((mthing->angle & 0xF000) >> 12)*32*FRACUNIT; - fixed_t hitboxheight = mthing->extrainfo*32*FRACUNIT; - fixed_t oldheight = mobj->height; - fixed_t dronemanoffset, goaloffset, sparkleoffset, droneboxmandiff, dronemangoaldiff; - - if (timelimit > 0) - mobj->health = timelimit; - - if (hitboxradius > 0) - mobj->radius = hitboxradius; - - if (hitboxheight > 0) - mobj->height = hitboxheight; - else - mobj->height = mobjinfo[MT_NIGHTSDRONE].height; - - droneboxmandiff = max(mobj->height - mobjinfo[MT_NIGHTSDRONE_MAN].height, 0); - dronemangoaldiff = max(mobjinfo[MT_NIGHTSDRONE_MAN].height - mobjinfo[MT_NIGHTSDRONE_GOAL].height, 0); - - if (flip && mobj->height != oldheight) - P_TeleportMove(mobj, mobj->x, mobj->y, mobj->z - (mobj->height - oldheight)); - - if (!flip) - { - if (topaligned) // Align droneman to top of hitbox - { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = 24*FRACUNIT; - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - - sparkleoffset = goaloffset - FixedMul(15*FRACUNIT, mobj->scale); - } - else if (i == MT_WAYPOINT) - { - // just gets set on either the floor or ceiling - boolean flip = (!!(mobjinfo[i].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP)); - - // applying offsets! (if any) - if (flip) - { - z = ONCEILINGZ; - } - else - { - z = ONFLOORZ; - } - - if (z == ONFLOORZ) - mthing->z = 0; - else - mthing->z = (INT16)(z>>FRACBITS); - } - else - { - mobj->eflags |= MFE_VERTICALFLIP; - mobj->flags2 |= MF2_OBJECTFLIP; - - if (topaligned) // Align droneman to top of hitbox - { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - - sparkleoffset = goaloffset + FixedMul(15*FRACUNIT, mobj->scale); - } - - // spawn visual elements - { - mobj_t* goalpost = P_SpawnMobjFromMobj(mobj, 0, 0, goaloffset, MT_NIGHTSDRONE_GOAL); - mobj_t* sparkle = P_SpawnMobjFromMobj(mobj, 0, 0, sparkleoffset, MT_NIGHTSDRONE_SPARKLING); - mobj_t* droneman = P_SpawnMobjFromMobj(mobj, 0, 0, dronemanoffset, MT_NIGHTSDRONE_MAN); - - P_SetTarget(&mobj->target, goalpost); - P_SetTarget(&goalpost->target, sparkle); - P_SetTarget(&goalpost->tracer, droneman); - - // correct Z position - if (flip) - { - P_TeleportMove(goalpost, goalpost->x, goalpost->y, mobj->z + goaloffset); - P_TeleportMove(sparkle, sparkle->x, sparkle->y, mobj->z + sparkleoffset); - P_TeleportMove(droneman, droneman->x, droneman->y, mobj->z + dronemanoffset); - } - - // Remember position preference for later - mobj->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE); - if (topaligned) - mobj->flags |= MF_SLIDEME; - else if (middlealigned) - mobj->flags |= MF_GRENADEBOUNCE; - else if (!bottomoffsetted) - mobj->flags |= MF_SLIDEME|MF_GRENADEBOUNCE; - - // Remember old Z position and flags for correction detection - goalpost->movefactor = mobj->z; - goalpost->friction = mobj->height; - goalpost->threshold = mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE); - } - return true; -} - static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong) { angle_t angle = FixedAngle(mthing->angle << FRACBITS); @@ -14597,9 +14136,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->colorized = true; } break; - case MT_EGGMOBILE3: - mobj->cusval = mthing->extrainfo; - break; case MT_FAN: if (mthing->options & MTF_OBJECTSPECIAL) { @@ -14617,17 +14153,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean else mobj->health = FixedMul(mobj->subsector->sector->ceilingheight - mobj->subsector->sector->floorheight, 3*(FRACUNIT/4)) >> FRACBITS; break; - case MT_METALSONIC_RACE: - case MT_METALSONIC_BATTLE: - case MT_FANG: - case MT_ROSY: - if (mthing->options & MTF_EXTRA) - { - mobj->color = SKINCOLOR_SILVER; - mobj->colorized = true; - mobj->flags2 |= MF2_SLIDEPUSH; - } - break; case MT_BALLOON: if (mthing->angle > 0) mobj->color = ((mthing->angle - 1) % (numskincolors - 1)) + 1; @@ -14710,25 +14235,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->threshold = mthing->angle; mobj->movecount = mthing->extrainfo; break; - case MT_POPUPTURRET: - if (mthing->angle) - mobj->threshold = mthing->angle; - else - mobj->threshold = (TICRATE*2)-1; - break; - case MT_NIGHTSBUMPER: - // Lower 4 bits specify the angle of - // the bumper in 30 degree increments. - mobj->threshold = (mthing->options & 15) % 12; // It loops over, etc - P_SetMobjState(mobj, mobj->info->spawnstate + mobj->threshold); - break; - case MT_EGGCAPSULE: - if (mthing->angle <= 0) - mthing->angle = 20; // prevent 0 health - - mobj->health = mthing->angle; - mobj->threshold = min(mthing->extrainfo, 7); - break; case MT_TUBEWAYPOINT: { UINT8 sequence = mthing->angle >> 8; @@ -14738,24 +14244,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean P_AddWaypoint(sequence, id, mobj); break; } - case MT_IDEYAANCHOR: - mobj->health = mthing->extrainfo; - break; - case MT_NIGHTSDRONE: - if (!P_SetupNiGHTSDrone(mthing, mobj)) - return false; - break; - case MT_HIVEELEMENTAL: - if (mthing->extrainfo) - mobj->extravalue1 = mthing->extrainfo; - break; - case MT_GLAREGOYLE: - case MT_GLAREGOYLEUP: - case MT_GLAREGOYLEDOWN: - case MT_GLAREGOYLELONG: - if (mthing->angle >= 360) - mobj->tics += 7*(mthing->angle/360) + 1; // starting delay - break; case MT_DSZSTALAGMITE: case MT_DSZ2STALAGMITE: case MT_KELP: @@ -14802,23 +14290,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean if (mthing->angle > 0) mobj->tics += mthing->angle; break; - case MT_LAVAFALL: - mobj->fuse = 30 + mthing->angle; - if (mthing->options & MTF_AMBUSH) - { - P_SetScale(mobj, 2*mobj->scale); - mobj->destscale = mobj->scale; - } - break; - case MT_PYREFLY: - //start on fire if Ambush flag is set, otherwise behave normally - if (mthing->options & MTF_AMBUSH) - { - P_SetMobjState(mobj, mobj->info->meleestate); - mobj->extravalue2 = 2; - S_StartSound(mobj, sfx_s3kc2l); - } - break; case MT_BIGFERN: { angle_t angle = FixedAngle(mthing->angle << FRACBITS); @@ -14857,22 +14328,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->flags2 |= MF2_AXIS; break; - case MT_TOKEN: - // We advanced tokenbits earlier due to the return check. - // Subtract 1 here for the correct value. - mobj->health = 1 << (tokenbits - 1); - break; - case MT_CYBRAKDEMON: - if (mthing->options & MTF_AMBUSH) - { - mobj_t* elecmobj; - elecmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_CYBRAKDEMON_ELECTRIC_BARRIER); - P_SetTarget(&elecmobj->target, mobj); - elecmobj->angle = FixedAngle(mthing->angle << FRACBITS); - elecmobj->destscale = mobj->scale*2; - P_SetScale(elecmobj, elecmobj->destscale); - } - break; case MT_STARPOST: { thinker_t* th; @@ -14962,11 +14417,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean P_SetTarget(&mobj->tracer, base); } break; - case MT_RING_BOX: - //count 10 ring boxes into the number of rings equation too. - if (nummaprings >= 0) - nummaprings += 10; - break; case MT_BIGTUMBLEWEED: case MT_LITTLETUMBLEWEED: if (mthing->options & MTF_AMBUSH) @@ -14985,22 +14435,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean blueflag = mobj; bflagpoint = mobj->spawnpoint; break; - case MT_PUSH: - case MT_PULL: - mobj->health = 0; // Default behaviour: pushing uses XY, fading uses XYZ - - if (mthing->options & MTF_AMBUSH) - 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)) - P_SetMobjState(mobj, (mobj->type == MT_PUSH) ? S_GRAVWELLGREEN : S_GRAVWELLRED); - break; - case MT_NIGHTSSTAR: - if (maptol & TOL_XMAS) - P_SetMobjState(mobj, mobj->info->seestate); - break; // SRB2Kart case MT_WAYPOINT: { @@ -15442,17 +14876,6 @@ void P_SpawnHoop(mapthing_t *mthing) P_SpawnHoopInternal(mthing, 8 + (4*(mthing->options & 0xF)), 4*FRACUNIT); } -void P_SetBonusTime(mobj_t *mobj) -{ - if (!mobj) - return; - - if (mobj->type != MT_BLUESPHERE && mobj->type != MT_NIGHTSCHIP) - return; - - P_SetMobjState(mobj, mobj->info->raisestate); -} - static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numitemtypes, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) { mapthing_t dummything; diff --git a/src/p_saveg.c b/src/p_saveg.c index 3eada7453..aa9b2c2fd 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -712,7 +712,6 @@ static void P_NetUnArchiveColormaps(void) exc->colormap = existing_exc->colormap; // all our dummies are default values R_AddColormapToList(exc); } ->>>>>>> srb2/next } // Don't need these anymore @@ -4112,8 +4111,6 @@ static void P_NetArchiveMisc(void) WRITEUINT32(save_p, countdowntimer); WRITEUINT8(save_p, countdowntimeup); - WRITEUINT32(save_p, hidetime); - // SRB2kart WRITEINT32(save_p, numgotboxes); WRITEUINT8(save_p, numtargets); @@ -4244,8 +4241,6 @@ static inline boolean P_NetUnArchiveMisc(void) countdowntimer = (tic_t)READUINT32(save_p); countdowntimeup = (boolean)READUINT8(save_p); - hidetime = READUINT32(save_p); - // SRB2kart numgotboxes = READINT32(save_p); numtargets = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index e171c4d94..0e0f1f843 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -715,9 +715,7 @@ void P_ReloadRings(void) } continue; } - if (!(mo->type == MT_RING || mo->type == MT_COIN - || mo->type == MT_BLUESPHERE || mo->type == MT_BOMBSPHERE - || mo->type == MT_NIGHTSCHIP || mo->type == MT_NIGHTSSTAR)) + if (mo->type != MT_RING) continue; // Don't auto-disintegrate things being pulled to us @@ -731,12 +729,10 @@ void P_ReloadRings(void) for (i = 0; i < nummapthings; i++, mt++) { // Notice an omission? We handle hoops differently. - if (mt->type == mobjinfo[MT_RING].doomednum || mt->type == mobjinfo[MT_COIN].doomednum - || mt->type == mobjinfo[MT_REDTEAMRING].doomednum || mt->type == mobjinfo[MT_BLUETEAMRING].doomednum - || mt->type == mobjinfo[MT_BLUESPHERE].doomednum || mt->type == mobjinfo[MT_BOMBSPHERE].doomednum) + if (mt->type == mobjinfo[MT_RING].doomednum) { mt->mobj = NULL; - P_SetBonusTime(P_SpawnMapThing(mt)); + P_SpawnMapThing(mt); } else if (mt->type >= 600 && mt->type <= 609) // Item patterns { @@ -750,30 +746,6 @@ void P_ReloadRings(void) } } -void P_SwitchSpheresBonusMode(boolean bonustime) -{ - mobj_t *mo; - thinker_t *th; - - // scan the thinkers to find spheres to switch - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo = (mobj_t *)th; - - if (mo->type != MT_BLUESPHERE && mo->type != MT_NIGHTSCHIP - && mo->type != MT_FLINGBLUESPHERE && mo->type != MT_FLINGNIGHTSCHIP) - continue; - - if (!mo->health) - continue; - - P_SetMobjState(mo, ((bonustime) ? mo->info->raisestate : mo->info->spawnstate)); - } -} - #ifdef SCANTHINGS void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) { @@ -799,35 +771,37 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) type = READUINT16(data) & 4095; data += sizeof (INT16); // skip options - switch (type) + if (mt->type == mobjinfo[MT_RANDOMITEM].doomednum) + { + nummapboxes++; + } + else if (mt->type == mobjinfo[MT_BATTLECAPSULE].doomednum) + { + maptargets++; + } + else if (mt->type == mobjinfo[MT_RING].doomednum) { - case 300: // MT_RING - case 1800: // MT_COIN - case 308: // red team ring - case 309: // blue team ring maprings++; - break; - case 400: // MT_SUPERRINGBOX - case 414: // red ring box - case 415: // blue ring box - case 603: // 10 diagonal rings - maprings += 10; - break; - case 600: // 5 vertical rings - case 601: // 5 vertical rings - case 602: // 5 diagonal rings - maprings += 5; - break; - case 604: // 8 circle rings - case 609: // 16 circle rings & wings - maprings += 8; - break; - case 605: // 16 circle rings - maprings += 16; - break; - case 608: // 8 circle rings & wings - maprings += 4; - break; + } + else + { + switch (type) + { + case 603: // 10 diagonal rings + maprings += 10; + break; + case 600: // 5 vertical rings + case 601: // 5 vertical rings + case 602: // 5 diagonal rings + maprings += 5; + break; + case 604: // 8 circle rings + maprings += 8; + break; + case 605: // 16 circle rings + maprings += 16; + break; + } } } Z_Free(datastart); @@ -837,37 +811,12 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) } #endif -static void P_SpawnEmeraldHunt(void) -{ - INT32 emer[3], num[MAXHUNTEMERALDS], i, randomkey; - fixed_t x, y, z; - - for (i = 0; i < numhuntemeralds; i++) - num[i] = i; - - for (i = 0; i < 3; i++) - { - // generate random index, shuffle afterwards - randomkey = P_RandomKey(numhuntemeralds--); - emer[i] = num[randomkey]; - num[randomkey] = num[numhuntemeralds]; - num[numhuntemeralds] = emer[i]; - - // spawn emerald - x = huntemeralds[emer[i]]->x<y<type) @@ -883,8 +832,6 @@ static void P_SpawnMapThings(boolean spawnemblems) } } - numhuntemeralds = 0; - for (i = 0, mt = mapthings; i < nummapthings; i++, mt++) { if (mt->type == 1700 // MT_AXIS @@ -892,18 +839,8 @@ static void P_SpawnMapThings(boolean spawnemblems) || mt->type == 1702) // MT_AXISTRANSFERLINE continue; // These were already spawned - /* MOVE TO P_SPAWNMAPTHING - - if (mt->type == mobjinfo[MT_RANDOMITEM].doomednum) - nummapboxes++; - if (mt->type == mobjinfo[MT_BATTLECAPSULE].doomednum) - { - maptargets++; - continue; // These should not be spawned *yet* - } - - */ + continue; // This will spawn later if (!spawnemblems && mt->type == mobjinfo[MT_EMBLEM].doomednum) continue; @@ -917,10 +854,6 @@ static void P_SpawnMapThings(boolean spawnemblems) else // Everything else P_SpawnMapThing(mt); } - - // random emeralds for hunt - if (numhuntemeralds) - P_SpawnEmeraldHunt(); } // Experimental groovy write function! @@ -3425,7 +3358,6 @@ static void P_InitLevelSettings(void) players[i].gotcontinue = false; players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0; - players[i].health = 1; players[i].aiming = 0; players[i].pflags &= ~PF_TIMEOVER; } @@ -3462,7 +3394,7 @@ static void P_InitLevelSettings(void) } else { - if (G_BattleGametype()) + if ((gametyperules & GTR_BUMPERS)) gamespeed = KARTSPEED_EASY; else { @@ -3556,15 +3488,15 @@ static void P_ForceCharacter(const char *forcecharskin) if (splitscreen) { sprintf(skincmd, "skin2 %s\n", forcecharskin); - CV_Set(&cv_skin2, forcecharskin); + CV_Set(&cv_skin[1], forcecharskin); if (splitscreen > 1) { sprintf(skincmd, "skin3 %s\n", forcecharskin); - CV_Set(&cv_skin3, forcecharskin); + CV_Set(&cv_skin[2], forcecharskin); if (splitscreen > 2) { sprintf(skincmd, "skin4 %s\n", forcecharskin); - CV_Set(&cv_skin4, forcecharskin); + CV_Set(&cv_skin[3], forcecharskin); } } } @@ -3574,42 +3506,18 @@ static void P_ForceCharacter(const char *forcecharskin) } else { - if (splitscreen) + UINT8 i; + + for (i = 0; i <= splitscreen; i++) { - SetPlayerSkin(g_localplayers[1], forcecharskin); - if ((unsigned)cv_playercolor2.value != skins[players[g_localplayers[1]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[i], forcecharskin); + + // normal player colors in single player + if ((unsigned)cv_playercolor[i].value != skins[players[g_localplayers[i]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor2, skins[players[g_localplayers[1]].skin].prefcolor); - players[g_localplayers[1]].skincolor = skins[players[g_localplayers[1]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor[i], skins[players[g_localplayers[i]].skin].prefcolor); + players[g_localplayers[i]].skincolor = skins[players[g_localplayers[i]].skin].prefcolor; } - - if (splitscreen > 1) - { - SetPlayerSkin(g_localplayers[2], forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[g_localplayers[2]].skin].prefcolor && !modeattacking) - { - CV_StealthSetValue(&cv_playercolor3, skins[players[g_localplayers[2]].skin].prefcolor); - players[g_localplayers[2]].skincolor = skins[players[g_localplayers[2]].skin].prefcolor; - } - - if (splitscreen > 2) - { - SetPlayerSkin(g_localplayers[3], forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[g_localplayers[3]].skin].prefcolor && !modeattacking) - { - CV_StealthSetValue(&cv_playercolor4, skins[players[g_localplayers[3]].skin].prefcolor); - players[g_localplayers[3]].skincolor = skins[players[g_localplayers[3]].skin].prefcolor; - } - } - } - } - - SetPlayerSkin(consoleplayer, forcecharskin); - // normal player colors in single player - if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor && !modeattacking) - { - CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor); - players[consoleplayer].skincolor = skins[players[consoleplayer].skin].prefcolor; } } } @@ -3935,11 +3843,11 @@ static void P_InitPlayers(void) players[i].mo = NULL; - if (!G_RaceGametype()) + if (!(gametyperules & GTR_CIRCUIT)) { G_DoReborn(i); } - else // gametype is GT_COOP or GT_RACE + else // gametype is race { G_SpawnPlayer(i); if (players[i].starposttime) @@ -3957,9 +3865,7 @@ static void P_InitGametype(void) if (modeattacking && !demo.playback) P_LoadRecordGhosts(); - if (G_TagGametype()) - P_InitTagGametype(); - else if ((gametyperules & GTR_RACE) && server) + if ((gametyperules & GTR_CIRCUIT) && server) { if ((netgame || multiplayer) && cv_basenumlaps.value && (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) @@ -4241,7 +4147,7 @@ boolean P_LoadLevel(boolean fromnetsave) // The waypoint data that's in PU_LEVEL needs to be reset back to 0/NULL now since PU_LEVEL was cleared K_ClearWaypoints(); // Load the waypoints please! - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { if (K_SetupWaypointList() == false) { diff --git a/src/p_spec.c b/src/p_spec.c index 2450dc576..e244d2bd1 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2223,7 +2223,7 @@ void P_CrossSpecialLine(line_t *line, INT32 side, mobj_t *thing) { case 2001: // Finish Line { - if (G_RaceGametype() && !(player->exiting) && !(player->pflags & PF_HITFINISHLINE)) + if ((gametyperules & GTR_CIRCUIT) && !(player->exiting) && !(player->pflags & PF_HITFINISHLINE)) { if (((line->flags & (ML_NOCLIMB)) && (side == 0)) || (!(line->flags & (ML_NOCLIMB)) && (side == 1))) // crossed from behind to infront @@ -4059,11 +4059,6 @@ void P_SetupSignExit(player_t *player) if (thing->type != MT_SIGN) continue; - if (!numfound - && !(player->mo->target && player->mo->target->type == MT_SIGN) - && !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)) - P_SetTarget(&player->mo->target, thing); - if (thing->state != &states[thing->info->spawnstate]) continue; @@ -4085,11 +4080,6 @@ void P_SetupSignExit(player_t *player) if (thing->type != MT_SIGN) continue; - if (!numfound - && !(player->mo->target && player->mo->target->type == MT_SIGN) - && !((gametyperules & GTR_FRIENDLY) && (netgame || multiplayer) && cv_exitmove.value)) - P_SetTarget(&player->mo->target, thing); - if (thing->state != &states[thing->info->spawnstate]) continue; @@ -4838,70 +4828,8 @@ DoneSection2: } break; - case 3: // Red Team's Base - if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo)) - { - if (player->ctfteam == 1 && (player->gotflag & GF_BLUEFLAG)) - { - mobj_t *mo; - - // Make sure the red team still has their own - // flag at their base so they can score. - if (!P_IsFlagAtBase(MT_REDFLAG)) - break; - - HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); - HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("%s%s%s\\CAPTURED THE %sBLUE FLAG%s.\\\\\\\\"), "\x85", player_names[player-players], "\x80", "\x84", "\x80")); - - if (splitscreen || players[consoleplayer].ctfteam == 1) - S_StartSound(NULL, sfx_flgcap); - else if (players[consoleplayer].ctfteam == 2) - S_StartSound(NULL, sfx_lose); - - mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_BLUEFLAG); - player->gotflag &= ~GF_BLUEFLAG; - mo->flags &= ~MF_SPECIAL; - mo->fuse = TICRATE; - mo->spawnpoint = bflagpoint; - mo->flags2 |= MF2_JUSTATTACKED; - redscore += 1; - P_AddPlayerScore(player, 5); - } - } - break; - - case 4: // Blue Team's Base - if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo)) - { - if (player->ctfteam == 2 && (player->gotflag & GF_REDFLAG)) - { - mobj_t *mo; - - // Make sure the blue team still has their own - // flag at their base so they can score. - if (!P_IsFlagAtBase(MT_BLUEFLAG)) - break; - - HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); - HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("%s%s%s\\CAPTURED THE %sRED FLAG%s.\\\\\\\\"), "\x84", player_names[player-players], "\x80", "\x85", "\x80")); - - if (splitscreen || players[consoleplayer].ctfteam == 2) - S_StartSound(NULL, sfx_flgcap); - else if (players[consoleplayer].ctfteam == 1) - S_StartSound(NULL, sfx_lose); - - mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_REDFLAG); - player->gotflag &= ~GF_REDFLAG; - mo->flags &= ~MF_SPECIAL; - mo->fuse = TICRATE; - mo->spawnpoint = rflagpoint; - mo->flags2 |= MF2_JUSTATTACKED; - bluescore += 1; - P_AddPlayerScore(player, 5); - } - } + case 3: // Red Team's goal + case 4: // Blue Team's goal break; case 5: // Fan sector @@ -6890,14 +6818,14 @@ void P_SpawnSpecials(boolean fromnetsave) break; case 308: // Race-only linedef executor. Triggers once. - if (!(gametyperules & GTR_RACE)) + if (!(gametyperules & GTR_CIRCUIT)) lines[i].special = 0; break; // Linedef executor triggers for CTF teams. case 309: case 311: - if (!(gametyperules & GTR_TEAMFLAGS)) + if (!(gametyperules & GTR_TEAMS)) lines[i].special = 0; break; @@ -7137,7 +7065,7 @@ void P_SpawnSpecials(boolean fromnetsave) case 2000: // Waypoint Parameters break; case 2001: // Finish Line - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) circuitmap = true; break; case 2002: // Linedef Trigger: Race Lap diff --git a/src/p_tick.c b/src/p_tick.c index c06c2495e..b4a810679 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -489,9 +489,6 @@ void P_Ticker(boolean run) { players[i].quittime++; - if (players[i].quittime == 30 * TICRATE && G_TagGametype()) - P_CheckSurvivors(); - if (server && players[i].quittime >= (tic_t)FixedMul(cv_rejointimeout.value, 60 * TICRATE) && !(players[i].quittime % TICRATE)) SendKick(i, KICK_MSG_PLAYER_QUIT); @@ -590,7 +587,7 @@ void P_Ticker(boolean run) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); - if (G_BattleGametype() && battleovertime.enabled) + if ((gametyperules & GTR_BUMPERS) && battleovertime.enabled) K_RunBattleOvertime(); LUAh_ThinkFrame(); @@ -613,11 +610,10 @@ void P_Ticker(boolean run) if (!(modeattacking && !demo.playback) || leveltime >= starttime - TICRATE*4) timeinmap++; - /*if (G_TagGametype()) - P_DoTagStuff(); - + /* if (G_GametypeHasTeams()) - P_DoCTFStuff();*/ + P_DoCTFStuff(); + */ if (run) { @@ -650,7 +646,7 @@ void P_Ticker(boolean run) if (hyubgone > 1) hyubgone--; - if (G_BattleGametype()) + if ((gametyperules & GTR_BUMPERS)) { if (wantedcalcdelay && --wantedcalcdelay <= 0) K_CalculateBattleWanted(); @@ -773,7 +769,7 @@ void P_PreTicker(INT32 frames) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); - if (G_BattleGametype() && battleovertime.enabled) + if ((gametyperules & GTR_BUMPERS) && battleovertime.enabled) K_RunBattleOvertime(); LUAh_ThinkFrame(); diff --git a/src/p_user.c b/src/p_user.c index b0fc976ab..f00db15d0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -404,7 +404,7 @@ UINT8 P_FindLowestLap(void) INT32 i; UINT8 lowest = UINT8_MAX; - if (gametyperules & GTR_RACE) + if (gametyperules & GTR_CIRCUIT) return 0; for (i = 0; i < MAXPLAYERS; i++) @@ -431,7 +431,7 @@ UINT8 P_FindHighestLap(void) INT32 i; UINT8 highest = 0; - if (!G_RaceGametype()) + if (!(gametyperules & GTR_CIRCUIT)) return 0; for (i = 0; i < MAXPLAYERS; i++) @@ -489,7 +489,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) if (!player->mo) return; - if (G_BattleGametype()) // No rings in Battle Mode + if ((gametyperules & GTR_BUMPERS)) // No rings in Battle Mode return; player->kartstuff[k_rings] += num_rings; @@ -501,64 +501,12 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) player->rings = -20; // Chaotix ring debt! } -// -// P_GivePlayerLives -// -// Gives the player an extra life. -// Call this function when you want to add lives to the player. -// -void P_GivePlayerLives(player_t *player, INT32 numlives) -{ - UINT8 prevlives = player->lives; - if (!player) - return; - - if (player->bot) - player = &players[consoleplayer]; - - if (gamestate == GS_LEVEL) - { - if (player->lives == INFLIVES || !(gametyperules & GTR_LIVES)) - { - P_GivePlayerRings(player, 100*numlives); - return; - } - - if ((netgame || multiplayer) && G_GametypeUsesCoopLives() && cv_cooplives.value == 0) - { - P_GivePlayerRings(player, 100*numlives); - if (player->lives - prevlives >= numlives) - goto docooprespawn; - - numlives = (numlives + prevlives - player->lives); - } - } - else if (player->lives == INFLIVES) - return; - - player->lives += numlives; - - if (player->lives > 99) - player->lives = 99; - else if (player->lives < 1) - player->lives = 1; - -docooprespawn: - if (cv_coopstarposts.value) - return; - if (prevlives > 0) - return; - if (!player->spectator) - return; - P_SpectatorJoinGame(player); -} - // Adds to the player's score void P_AddPlayerScore(player_t *player, UINT32 amount) { //UINT32 oldscore; - if (!(G_BattleGametype())) + if (!((gametyperules & GTR_BUMPERS))) return; if (player->exiting) // srb2kart @@ -782,7 +730,7 @@ boolean P_EndingMusic(player_t *player) bestlocalpos = ((player->pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]); } - if (G_RaceGametype() && bestlocalpos == MAXPLAYERS+1) + if ((gametyperules & GTR_CIRCUIT) && bestlocalpos == MAXPLAYERS+1) sprintf(buffer, "k*fail"); // F-Zero death results theme else { @@ -796,9 +744,9 @@ boolean P_EndingMusic(player_t *player) S_SpeedMusic(1.0f); - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) buffer[1] = 'r'; - else if (G_BattleGametype()) + else if ((gametyperules & GTR_BUMPERS)) { buffer[1] = 'b'; looping = false; @@ -891,7 +839,7 @@ void P_RestoreMusic(player_t *player) #if 0 // Event - Final Lap // Still works for GME, but disabled for consistency - if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value)) + if ((gametyperules & GTR_CIRCUIT) && player->laps >= (UINT8)(cv_numlaps.value)) S_SpeedMusic(1.2f); #endif if (mapmusresume && cv_resume.value) @@ -1376,7 +1324,7 @@ void P_DoPlayerExit(player_t *player) if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback)) legitimateexit = true; - if (G_RaceGametype()) // If in Race Mode, allow + if ((gametyperules & GTR_CIRCUIT)) // If in Race Mode, allow { player->exiting = raceexittime+2; K_KartUpdatePosition(player); @@ -1411,7 +1359,7 @@ void P_DoPlayerExit(player_t *player) if (P_CheckRacers()) player->exiting = raceexittime+1; } - else if (G_BattleGametype()) // Battle Mode exiting + else if ((gametyperules & GTR_BUMPERS)) // Battle Mode exiting { player->exiting = battleexittime+1; P_EndingMusic(player); @@ -2792,7 +2740,7 @@ static void P_DeathThink(player_t *player) if (player->bot) // don't allow bots to do any of the below, B_CheckRespawn does all they need for respawning already goto notrealplayer; - if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) + if ((player->pflags & PF_TIMEOVER) && (gametyperules & GTR_CIRCUIT)) { player->karthud[khud_timeovercam]++; @@ -3264,7 +3212,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall || (leveltime < introtime)); // Kart intro cam #endif - if ((player->pflags & PF_TIMEOVER) && G_RaceGametype()) // 1 for momentum keep, 2 for turnaround + if ((player->pflags & PF_TIMEOVER) && (gametyperules & GTR_CIRCUIT)) // 1 for momentum keep, 2 for turnaround timeover = (player->karthud[khud_timeovercam] > 2*TICRATE ? 2 : 1); else timeover = 0; @@ -4194,8 +4142,7 @@ void P_PlayerThink(player_t *player) { seenplayer = NULL; - if (cv_seenames.value && cv_allowseenames.value && - !(G_TagGametype() && (player->pflags & PF_TAGIT))) + if (cv_seenames.value && cv_allowseenames.value) { mobj_t *mo = P_SpawnNameFinder(player->mo, MT_NAMECHECK); @@ -4251,7 +4198,7 @@ void P_PlayerThink(player_t *player) if (!mapreset) { - if (gametyperules & GTR_RACE) + if (gametyperules & GTR_CIRCUIT) { INT32 i; @@ -4293,7 +4240,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 < raceexittime+2 || !G_RaceGametype())) // SRB2kart - "&& player->exiting > 1" + if (player->exiting > 1 && (player->exiting < raceexittime+2 || !(gametyperules & GTR_CIRCUIT))) // SRB2kart - "&& player->exiting > 1" player->exiting--; if (player->exiting && exitcountdown) @@ -4302,39 +4249,8 @@ void P_PlayerThink(player_t *player) if (player->exiting == 2 || countdown2 == 2) { - UINT8 numneeded = (G_IsSpecialStage(gamemap) ? 4 : cv_playersforexit.value); - if (numneeded) // Count to be sure everyone's exited - { - INT32 i, total = 0, exiting = 0; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator || players[i].bot) - continue; - if (players[i].quittime > 30 * TICRATE) - continue; - if (players[i].lives <= 0) - continue; - - total++; - if (players[i].exiting && players[i].exiting < 4) - exiting++; - } - - if (!total || ((4*exiting)/total) >= numneeded) - { - if (server) - SendNetXCmd(XD_EXITLEVEL, NULL, 0); - } - } - } - - if (player->pflags & PF_FINISHED) - { - if (((gametyperules & GTR_FRIENDLY) && cv_exitmove.value) && !G_EnoughPlayersFinished()) - player->exiting = 0; - else - P_DoPlayerExit(player); + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); } // check water content, set stuff in mobj @@ -4351,8 +4267,8 @@ void P_PlayerThink(player_t *player) #else if (player->spectator && #endif - G_GametypeUsesCoopStarposts() && (netgame || multiplayer) && cv_coopstarposts.value == 2) - P_ConsiderAllGone(); + (gametyperules & GTR_LIVES)) + /*P_ConsiderAllGone()*/; if (player->playerstate == PST_DEAD) { @@ -4391,7 +4307,7 @@ void P_PlayerThink(player_t *player) // Synchronizes the "real" amount of time spent in the level. if (!player->exiting && !stoppedclock) { - if (gametyperules & GTR_RACE) + if (gametyperules & GTR_CIRCUIT) { player->realtime = leveltime - starttime; if (player == &players[consoleplayer]) @@ -4535,8 +4451,7 @@ void P_PlayerThink(player_t *player) player->pflags &= ~PF_USEDOWN; // IF PLAYER NOT HERE THEN FLASH END IF - if (player->quittime && player->powers[pw_flashing] < flashingtics - 1 - && !(G_TagGametype() && !(player->pflags & PF_TAGIT)) && !player->gotflag) + if (player->quittime && player->powers[pw_flashing] < flashingtics - 1 && !player->gotflag) player->powers[pw_flashing] = flashingtics - 1; // Counters, time dependent power ups. @@ -4572,7 +4487,7 @@ void P_PlayerThink(player_t *player) || player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either. || player->kartstuff[k_respawn] // Respawn timer (for drop dash effect) || (player->pflags & PF_TIMEOVER) // NO CONTEST explosion - || (G_BattleGametype() && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) + || ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || leveltime < starttime)) // Level intro { if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing(player) diff --git a/src/r_skins.h b/src/r_skins.h index 877034c5a..3249aa1d1 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -37,7 +37,6 @@ typedef struct skinflags_t flags; char realname[SKINNAMESIZE+1]; // Display name for level completion. - char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) char facerank[9], facewant[9], facemmap[9]; // Arbitrarily named patch lumps // SRB2kart @@ -50,18 +49,19 @@ typedef struct // Definable color translation table UINT8 starttranscolor; UINT16 prefcolor; + UINT16 supercolor; + UINT16 prefoppositecolor; // if 0 use tables instead + fixed_t highresscale; // scale of highres, default is 0.5 + char rivals[SKINRIVALS][SKINNAMESIZE+1]; // Your top 3 rivals for GP mode. Uses names so that you can reference skins that aren't added + // specific sounds per skin sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table // contains super versions too spritedef_t sprites[NUMPLAYERSPRITES*2]; spriteinfo_t sprinfo[NUMPLAYERSPRITES*2]; - - char rivals[SKINRIVALS][SKINNAMESIZE+1]; // Your top 3 rivals for GP mode. Uses names so that you can reference skins that aren't added - - UINT8 availability; // lock? } skin_t; /// Externs @@ -124,7 +124,7 @@ typedef struct follower_s } follower_t; extern INT32 numfollowers; -extern follower_t followers[MAXSKINS]; // again, use the same rules as skins, no reason not to. +extern follower_t followers[MAXSKINS]; // again, use the same rules as skins, no reason not to. INT32 R_FollowerAvailable(const char *name); boolean SetPlayerFollower(INT32 playernum,const char *skinname); diff --git a/src/s_sound.c b/src/s_sound.c index f03ad1fdf..2833a9272 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2617,7 +2617,6 @@ boolean S_RecallMusic(UINT16 status, boolean fromfirst) else if (!entry->status) { Z_Free(entry); ->>>>>>> srb2/next return false; } @@ -3308,8 +3307,8 @@ static void PlaySoundIfUnfocused_OnChange(void) S_EnableSound(); } } -======= +#ifndef NO_MIDI void MusicPref_OnChange(void) { if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio") || @@ -3321,6 +3320,7 @@ void MusicPref_OnChange(void) else if (S_PrefAvailable(cv_musicpref.value, "_clear")) S_ChangeMusicInternal("_clear", false); } +#endif #ifdef HAVE_OPENMPT void ModFilter_OnChange(void) @@ -3329,4 +3329,3 @@ void ModFilter_OnChange(void) openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value); } #endif ->>>>>>> srb2/next diff --git a/src/screen.c b/src/screen.c index 55b2292a3..b84d8847e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -593,11 +593,6 @@ void SCR_ClosedCaptions(void) basey -= 42; else if (splitscreen) basey -= 8; - else if ((modeattacking == ATTACKING_NIGHTS) - || (!(maptol & TOL_NIGHTS) - && ((cv_powerupdisplay.value == 2) // "Always" - || (cv_powerupdisplay.value == 1 && !camera.chase)))) // "First-person only" - basey -= 16; } for (i = 0; i < NUMCAPTIONS; i++) @@ -632,7 +627,6 @@ void SCR_ClosedCaptions(void) V_DrawRightAlignedString(BASEVIDWIDTH - 20, y, flags, va("%c [%s]", dot, (closedcaptions[i].s->caption[0] ? closedcaptions[i].s->caption : closedcaptions[i].s->name))); ->>>>>>> srb2/next } } diff --git a/src/st_stuff.c b/src/st_stuff.c index af75dfd30..42d830f96 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -173,22 +173,23 @@ hudinfo_t hudinfo[NUMHUDITEMS] = boolean ST_SameTeam(player_t *a, player_t *b) { - // Just pipe team messages to everyone in co-op or race. - if (!G_BattleGametype()) - return true; - // Spectator chat. if (a->spectator && b->spectator) + { return true; + } // Team chat. - if (G_GametypeHasTeams()) - return a->ctfteam == b->ctfteam; - - if (G_TagGametype()) - return ((a->pflags & PF_TAGIT) == (b->pflags & PF_TAGIT)); - - return false; + if (G_GametypeHasTeams() == true) + { + // You get team messages if you're on the same team. + return (a->ctfteam == b->ctfteam); + } + else + { + // Not that everyone's not on the same team, but team messages go to normal chat if everyone's not in the same team. + return true; + } } static boolean st_stopped = true; @@ -736,10 +737,10 @@ void ST_drawTitleCard(void) UINT8 colornum; const UINT8 *colormap; - if (players[consoleplayer].skincolor) - colornum = players[consoleplayer].skincolor; + if (players[g_localplayers[0]].skincolor) + colornum = players[g_localplayers[0]].skincolor; else - colornum = cv_playercolor.value; + colornum = cv_playercolor[0].value; colormap = R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE); @@ -901,9 +902,7 @@ static void ST_overlayDrawer(void) // draw level title Tails if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) -#ifdef HAVE_BLUA - && LUA_HudEnabled(hud_stagetitle) -#endif + && LUA_HudEnabled(hud_stagetitle) ) ST_drawLevelTitle(); @@ -955,15 +954,15 @@ static void ST_overlayDrawer(void) switch (demo.savemode) { case DSM_NOTSAVING: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|(G_BattleGametype() ? V_REDMAP : V_SKYMAP), "Look Backward: Save replay"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|((gametyperules & GTR_BUMPERS) ? V_REDMAP : V_SKYMAP), "Look Backward: Save replay"); break; case DSM_WILLAUTOSAVE: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|(G_BattleGametype() ? V_REDMAP : V_SKYMAP), "Replay will be saved. (Look Backward: Change title)"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|((gametyperules & GTR_BUMPERS) ? V_REDMAP : V_SKYMAP), "Replay will be saved. (Look Backward: Change title)"); break; case DSM_WILLSAVE: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|(G_BattleGametype() ? V_REDMAP : V_SKYMAP), "Replay will be saved."); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|((gametyperules & GTR_BUMPERS) ? V_REDMAP : V_SKYMAP), "Replay will be saved."); break; case DSM_TITLEENTRY: @@ -1023,7 +1022,7 @@ void ST_Drawer(void) R_ReloadHUDGraphics(); #ifdef SEENAMES - if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo) + if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo) { INT32 c = 0; switch (cv_seenames.value) @@ -1065,22 +1064,6 @@ void ST_Drawer(void) #endif if (rendermode != render_none) ST_doPaletteStuff(); - // Blindfold! - if ((gametyperules & GTR_BLINDFOLDED) - && (leveltime < hidetime * TICRATE)) - { - if (players[displayplayer].pflags & PF_TAGIT) - { - stplyr = &players[displayplayer]; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31|V_PERPLAYER); - } - else if (splitscreen && players[secondarydisplayplayer].pflags & PF_TAGIT) - { - stplyr = &players[secondarydisplayplayer]; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31|V_PERPLAYER); - } - } - st_translucency = cv_translucenthud.value; if (st_overlay) diff --git a/src/v_video.c b/src/v_video.c index 3cb129fd9..fe0cb9482 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -424,7 +424,6 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue) { working[0][q] = dolerp(working[0][q], working[1][q]); working[1][q] = dolerp(working[2][q], working[3][q]); ->>>>>>> srb2/next } linear = (*blue/255.0); for (q = 0; q < 3; q++) diff --git a/src/y_inter.c b/src/y_inter.c index 8140e69a5..95e2f7f99 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -41,7 +41,6 @@ #include "m_random.h" // M_RandomKey #include "g_input.h" // PLAYER1INPUTDOWN -#include "k_color.h" // colortranslations #include "k_battle.h" #include "k_pwrlv.h" #include "console.h" // cons_menuhighlight @@ -1039,7 +1038,7 @@ static void K_UpdatePowerLevels(void) CONS_Debug(DBG_GAMELOGIC, "Player %d's PWR.LV: %d\n", jpnum, theirpower); - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) { if (data.match.val[i] < data.match.val[j]) won = true; @@ -1164,9 +1163,9 @@ void Y_StartIntermission(void) if (netgame && cv_kartusepwrlv.value) { - if (G_RaceGametype()) + if ((gametyperules & GTR_CIRCUIT)) powertype = PWRLV_RACE; - else if (G_BattleGametype()) + else if ((gametyperules & GTR_BUMPERS)) powertype = PWRLV_BATTLE; } @@ -1453,7 +1452,7 @@ void Y_VoteDrawer(void) break; } - color = colortranslations[players[p].skincolor][7]; + color = skincolors[players[p].skincolor].ramp[7]; colormap = R_GetTranslationColormap(TC_DEFAULT, players[p].skincolor, GTC_CACHE); } @@ -1633,9 +1632,7 @@ void Y_VoteTicker(void) if (paused || P_AutoPause() || !voteclient.loaded) return; -#ifdef HAVE_BLUA LUAh_VoteThinker(); -#endif votetic++;