diff --git a/src/d_player.h b/src/d_player.h index a70456355..99455af1a 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -436,24 +436,6 @@ typedef enum //} -#define WEP_AUTO 1 -#define WEP_BOUNCE 2 -#define WEP_SCATTER 3 -#define WEP_GRENADE 4 -#define WEP_EXPLODE 5 -#define WEP_RAIL 6 -#define NUM_WEAPONS 7 - -typedef enum -{ - RW_AUTO = 1, - RW_BOUNCE = 2, - RW_SCATTER = 4, - RW_GRENADE = 8, - RW_EXPLODE = 16, - RW_RAIL = 32 -} ringweapons_t; - // player_t struct for all respawn variables typedef struct respawnvars_s { diff --git a/src/dehacked.c b/src/dehacked.c index acc42c870..054dcecc7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -11469,15 +11469,6 @@ struct { {"CR_NONE",CR_NONE}, {"CR_ZOOMTUBE",CR_ZOOMTUBE}, - // Ring weapons (ringweapons_t) - // Useful for A_GiveWeapon - {"RW_AUTO",RW_AUTO}, - {"RW_BOUNCE",RW_BOUNCE}, - {"RW_SCATTER",RW_SCATTER}, - {"RW_GRENADE",RW_GRENADE}, - {"RW_EXPLODE",RW_EXPLODE}, - {"RW_RAIL",RW_RAIL}, - // Character flags (skinflags_t) {"SF_HIRES",SF_HIRES}, {"SF_MACHINE",SF_MACHINE}, @@ -11580,15 +11571,6 @@ struct { {"PA_ABILITY2",PA_ABILITY2}, {"PA_RIDE",PA_RIDE}, - // Current weapon - {"WEP_AUTO",WEP_AUTO}, - {"WEP_BOUNCE",WEP_BOUNCE}, - {"WEP_SCATTER",WEP_SCATTER}, - {"WEP_GRENADE",WEP_GRENADE}, - {"WEP_EXPLODE",WEP_EXPLODE}, - {"WEP_RAIL",WEP_RAIL}, - {"NUM_WEAPONS",NUM_WEAPONS}, - // Value for infinite lives {"INFLIVES",INFLIVES}, diff --git a/src/doomstat.h b/src/doomstat.h index fcc2990a9..a2724add9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -98,8 +98,8 @@ extern boolean savemoddata; // This mod saves time/emblem data. extern boolean imcontinuing; // Temporary flag while continuing extern boolean metalrecording; -#define ATTACKING_NONE 0 -#define ATTACKING_RECORD 1 +#define ATTACKING_NONE 0 +#define ATTACKING_TIME 1 #define ATTACKING_CAPSULES 2 extern UINT8 modeattacking; @@ -684,7 +684,6 @@ extern SINT8 votes[MAXPLAYERS]; extern SINT8 pickedvote; extern UINT32 timesBeaten; // # of times the game has been beaten. -extern UINT32 timesBeatenWithEmeralds; // =========================== // Internal parameters, fixed. diff --git a/src/f_finale.c b/src/f_finale.c index 3d12f30d9..215c07989 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1101,9 +1101,6 @@ void F_GameEvaluationTicker(void) { ++timesBeaten; - if (ALL7EMERALDS(emeralds)) - ++timesBeatenWithEmeralds; - if (M_UpdateUnlockablesAndExtraEmblems()) S_StartSound(NULL, sfx_s3k68); diff --git a/src/g_demo.c b/src/g_demo.c index 19627dc97..22f7c735f 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1952,7 +1952,7 @@ void G_BeginRecording(void) { case ATTACKING_NONE: // 0 break; - case ATTACKING_RECORD: // 1 + case ATTACKING_TIME: // 1 demotime_p = demo_p; WRITEUINT32(demo_p,UINT32_MAX); // time WRITEUINT32(demo_p,UINT32_MAX); // lap @@ -2824,7 +2824,7 @@ void G_DoPlayDemo(char *defdemoname) { case ATTACKING_NONE: // 0 break; - case ATTACKING_RECORD: // 1 + case ATTACKING_TIME: // 1 hu_demotime = READUINT32(demo_p); hu_demolap = READUINT32(demo_p); break; @@ -3157,7 +3157,7 @@ void G_AddGhost(char *defdemoname) { case ATTACKING_NONE: // 0 break; - case ATTACKING_RECORD: // 1 + case ATTACKING_TIME: // 1 p += 8; // demo time, lap break; case ATTACKING_CAPSULES: // 2 @@ -3370,7 +3370,7 @@ void G_UpdateStaffGhostName(lumpnum_t l) { case ATTACKING_NONE: // 0 break; - case ATTACKING_RECORD: // 1 + case ATTACKING_TIME: // 1 p += 8; // demo time, lap break; case ATTACKING_CAPSULES: // 2 diff --git a/src/g_game.c b/src/g_game.c index 3e89305d6..596667889 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -45,7 +45,6 @@ #include "y_inter.h" #include "v_video.h" #include "lua_hook.h" -#include "lua_libs.h" // gL (Lua state) #include "k_bot.h" #include "m_cond.h" // condition sets #include "lua_hud.h" @@ -87,8 +86,8 @@ UINT32 mapmusresume; INT16 gamemap = 1; UINT32 maptol; -UINT8 globalweather = 0; -INT32 curWeather = PRECIP_NONE; +UINT8 globalweather = PRECIP_NONE; +UINT8 curWeather = PRECIP_NONE; precipprops_t precipprops[MAXPRECIP] = { @@ -153,17 +152,13 @@ INT16 bootmap; //bootmap for loading a map on startup INT16 tutorialmap = 0; // map to load for tutorial boolean tutorialmode = false; // are we in a tutorial right now? INT32 tutorialgcs = gcs_custom; // which control scheme is loaded? -INT32 tutorialusemouse = 0; // store cv_usemouse user value -INT32 tutorialfreelook = 0; // store cv_alwaysfreelook user value -INT32 tutorialmousemove = 0; // store cv_mousemove user value -INT32 tutorialanalog = 0; // store cv_analog[0] user value boolean looptitle = true; UINT16 skincolor_redteam = SKINCOLOR_RED; UINT16 skincolor_blueteam = SKINCOLOR_BLUE; UINT16 skincolor_redring = SKINCOLOR_RASPBERRY; -UINT16 skincolor_bluering = SKINCOLOR_CORNFLOWER; +UINT16 skincolor_bluering = SKINCOLOR_PERIWINKLE; tic_t countdowntimer = 0; boolean countdowntimeup = false; @@ -329,8 +324,6 @@ static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to // Grading UINT32 timesBeaten; -UINT32 timesBeatenWithEmeralds; -//UINT32 timesBeatenUltimate; typedef struct joystickvector2_s { @@ -365,8 +358,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, "More Axis Sets" #endif -static CV_PossibleValue_t deadzone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; - // don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler. // chat timer thingy @@ -458,6 +449,7 @@ consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS] = { {"joyaxis4_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, }; +static CV_PossibleValue_t zerotoone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS] = { {"joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"joy2_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, @@ -531,11 +523,10 @@ tic_t G_GetBestLap(INT16 map) // G_UpdateRecordReplays // // Update replay files/data, etc. for Record Attack -// See G_SetNightsRecords for NiGHTS Attack. // static void G_UpdateRecordReplays(void) { - const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; + const size_t glen = strlen(srb2home)+1+strlen("media")+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; char *gpath; char lastdemo[256], bestdemo[256]; UINT8 earnedEmblems; @@ -544,36 +535,49 @@ static void G_UpdateRecordReplays(void) if (!mainrecords[gamemap-1]) G_AllocMainRecordData(gamemap-1); - if (players[consoleplayer].score > mainrecords[gamemap-1]->score) - mainrecords[gamemap-1]->score = players[consoleplayer].score; + if (players[consoleplayer].pflags & PF_GAMETYPEOVER) + { + players[consoleplayer].realtime = UINT32_MAX; + } - if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) + if (((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) + && (players[consoleplayer].realtime < UINT32_MAX)) // DNF + { mainrecords[gamemap-1]->time = players[consoleplayer].realtime; + } - if ((UINT16)(players[consoleplayer].rings) > mainrecords[gamemap-1]->rings) - mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].rings); + if (modeattacking == ATTACKING_TIME) + { + if ((mainrecords[gamemap-1]->lap == 0) || (bestlap < mainrecords[gamemap-1]->lap)) + mainrecords[gamemap-1]->lap = bestlap; + } + else + { + mainrecords[gamemap-1]->lap = 0; + } // Save demo! bestdemo[255] = '\0'; lastdemo[255] = '\0'; - G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].score, (UINT16)(players[consoleplayer].rings)); + G_SetDemoTime(players[consoleplayer].realtime, bestlap); G_CheckDemoStatus(); - I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); - I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755); + gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s", + srb2home, timeattackfolder); + M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755); if ((gpath = malloc(glen)) == NULL) I_Error("Out of memory for replay filepath\n"); - sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); - snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, skins[cv_chooseskin.value-1].name); + sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); + snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, cv_chooseskin.string); if (FIL_FileExists(lastdemo)) { UINT8 *buf; size_t len = FIL_ReadFile(lastdemo, &buf); - snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, skins[cv_chooseskin.value-1].name); + snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, cv_chooseskin.string); if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1) { // Better time, save this demo. if (FIL_FileExists(bestdemo)) @@ -582,22 +586,16 @@ static void G_UpdateRecordReplays(void) CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); } - snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, skins[cv_chooseskin.value-1].name); - if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))) - { // Better score, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo); - } - - snprintf(bestdemo, 255, "%s-%s-rings-best.lmp", gpath, skins[cv_chooseskin.value-1].name); - if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<2))) - { // Better rings, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW MOST RINGS!"), M_GetText("Saved replay as"), bestdemo); + if (modeattacking == ATTACKING_TIME) + { + snprintf(bestdemo, 255, "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string); + if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)) + { // Better lap time, save this demo. + if (FIL_FileExists(bestdemo)) + remove(bestdemo); + FIL_WriteFile(bestdemo, buf, len); + CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD LAP!"), M_GetText("Saved replay as"), bestdemo); + } } //CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo); @@ -608,10 +606,13 @@ static void G_UpdateRecordReplays(void) // Check emblems when level data is updated if ((earnedEmblems = M_CheckLevelEmblems())) - CONS_Printf(M_GetText("\x82" "Earned %hu emblem%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : ""); + CONS_Printf(M_GetText("\x82" "Earned %hu medal%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : ""); - // Update timeattack menu's replay availability. - Nextmap_OnChange(); + if (M_UpdateUnlockablesAndExtraEmblems()) + S_StartSound(NULL, sfx_ncitem); + + // SRB2Kart - save here so you NEVER lose your earned times/medals. + G_SaveGameData(); } // for consistency among messages: this modifies the game and removes savemoddata. @@ -852,9 +853,8 @@ static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvect INT32 localaiming[MAXSPLITSCREENPLAYERS]; angle_t localangle[MAXSPLITSCREENPLAYERS]; -static fixed_t forwardmove[2] = {25<>16, 50<>16}; -static fixed_t sidemove[2] = {2<>16, 4<>16}; -static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn +static INT32 forwardmove = 50<>16; +static INT32 angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn INT16 ticcmd_oldangleturn[MAXSPLITSCREENPLAYERS]; @@ -864,7 +864,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) const INT32 speed = 1; const INT32 lookaxis = cv_lookaxis[forplayer].value; - const boolean mouseaiming = player->spectator; const boolean invertmouse = cv_invertmouse.value; const boolean analogjoystickmove = cv_usejoystick[forplayer].value && !Joystick[forplayer].bGamepadStyle; const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle; @@ -874,19 +873,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame - INT32 tspeed, forward, axis, i; + INT32 tspeed, forward, axis; joystickvector2_t joystickvector; boolean turnleft, turnright; - player_t *player = &player = &players[g_localplayers[forplayer]]; + player_t *player = &players[g_localplayers[forplayer]]; camera_t *thiscam = &camera[forplayer]; angle_t *lang = &localangle[forplayer]; - angle_t *laim = &localaiming[forplayer]; - INT32 *th = turnheld[forplayer]; - INT32 *kbl = keyboard_look[forplayer]; - INT32 *rd = resetdown[forplayer]; + INT32 *laim = &localaiming[forplayer]; + INT32 *th = &turnheld[forplayer]; + INT32 *kbl = &keyboard_look[forplayer]; + INT32 *rd = &resetdown[forplayer]; + const boolean mouseaiming = player->spectator; if (demo.playback) return; @@ -914,7 +914,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching) { cmd->angleturn = ticcmd_oldangleturn[forplayer]; - cmd->aiming = G_ClipAimingPitch(&laim); + cmd->aiming = G_ClipAimingPitch(laim); return; } @@ -939,7 +939,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) joystickvector.xaxis = -joystickvector.xaxis; } - if (gamepadjoystickmove && axis != 0) + if (gamepadjoystickmove && joystickvector.xaxis != 0) { turnright = turnright || (joystickvector.xaxis > 0); turnleft = turnleft || (joystickvector.xaxis < 0); @@ -1078,7 +1078,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) (player->mo && (player->mo->eflags & MFE_VERTICALFLIP) && (!thiscam->chase)) //because chasecam's not inverted ? -1 : 1; // set to -1 or 1 to multiply - INT32 configlookaxis = ssplayer == 1 ? cv_lookaxis.value : cv_lookaxis2.value; // mouse look stuff (mouse look is not the same as mouse aim) if (mouseaiming && player->spectator) @@ -1118,7 +1117,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (!cv_allowmlook.value) *laim = 0; - cmd->aiming = G_ClipAimingPitch(&laim); + cmd->aiming = G_ClipAimingPitch(laim); } mousex = mousey = mlooky = 0; @@ -1199,10 +1198,11 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n) for (i = 0; i < n; i++) { dest[i].forwardmove = src[i].forwardmove; - dest[i].sidemove = src[i].sidemove; dest[i].angleturn = SHORT(src[i].angleturn); dest[i].aiming = (INT16)SHORT(src[i].aiming); dest[i].buttons = (UINT16)SHORT(src[i].buttons); + dest[i].driftturn = SHORT(src[i].driftturn); + dest[i].latency = src[i].latency; } return dest; } @@ -1216,7 +1216,6 @@ void G_DoLoadLevel(boolean resetplayer) // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); - demosynced = true; levelstarttic = gametic; // for time calculation @@ -1260,8 +1259,6 @@ void G_DoLoadLevel(boolean resetplayer) return; } - P_FindEmerald(); - gameaction = ga_nothing; #ifdef PARANOIA Z_CheckHeap(-2); @@ -1317,10 +1314,10 @@ void G_StartTitleCard(void) void G_PreLevelTitleCard(void) { #ifndef NOWIPE - tic_t starttime = I_GetTime(); - tic_t endtime = starttime + (PRELEVELTIME*NEWTICRATERATIO); - tic_t nowtime = starttime; - tic_t lasttime = starttime; + tic_t strtime = I_GetTime(); + tic_t endtime = strtime + (PRELEVELTIME*NEWTICRATERATIO); + tic_t nowtime = strtime; + tic_t lasttime = strtime; while (nowtime < endtime) { // draw loop @@ -1342,28 +1339,11 @@ void G_PreLevelTitleCard(void) #endif } -static boolean titlecardforreload = false; - // // Returns true if the current level has a title card. // boolean G_IsTitleCardAvailable(void) { - // The current level header explicitly disabled the title card. - UINT16 titleflag = LF_NOTITLECARDFIRST; - - if (modeattacking != ATTACKING_NONE) - titleflag = LF_NOTITLECARDRECORDATTACK; - else if (titlecardforreload) - titleflag = LF_NOTITLECARDRESPAWN; - - if (mapheaderinfo[gamemap-1]->levelflags & titleflag) - return false; - - // The current gametype doesn't have a title card. - if (gametyperules & GTR_NOTITLECARD) - return false; - // The current level has no name. if (!mapheaderinfo[gamemap-1]->lvlttl[0]) return false; @@ -1382,6 +1362,8 @@ static INT32 camtoggledelay[MAXSPLITSCREENPLAYERS]; // boolean G_Responder(event_t *ev) { + UINT8 i; + // any other key pops up menu if in demos if (gameaction == ga_nothing && !demo.quitafterplaying && ((demo.playback && !modeattacking && !demo.title && !multiplayer) || gamestate == GS_TITLESCREEN)) @@ -1630,7 +1612,7 @@ boolean G_CouldView(INT32 playernum) // SRB2Kart: Only go through players who are actually playing if (player->exiting) return false; - if (( player->pflags & PF_TIMEOVER )) + if (( player->pflags & PF_GAMETYPEOVER )) return false; // I don't know if we want this actually, but I'll humor the suggestion anyway @@ -2049,7 +2031,6 @@ static inline void G_PlayerFinishLevel(INT32 player) memset(p->powers, 0, sizeof (p->powers)); memset(p->kartstuff, 0, sizeof (p->kartstuff)); // SRB2kart - p->ringweapons = 0; p->mo->drawflags &= ~(MFD_TRANSMASK|MFD_BRIGHTMASK); // cancel invisibility P_FlashPal(p, 0, 0); // Resets @@ -2137,7 +2118,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) INT32 bumper; INT32 comebackpoints; INT32 wanted; - INT32 rings; boolean songcredit = false; score = players[player].score; @@ -2159,9 +2139,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) playerangleturn = players[player].angleturn; oldrelangleturn = players[player].oldrelangleturn; - if (!betweenmaps) - pflags |= (players[player].pflags & PF_FINISHED); - // As long as we're not in multiplayer, carry over cheatcodes from map to map if (!(netgame || multiplayer)) pflags |= (players[player].pflags & (PF_GODMODE|PF_NOCLIP|PF_INVIS)); @@ -2327,12 +2304,17 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) // Check to make sure their color didn't change somehow... if (G_GametypeHasTeams()) { + UINT8 i; + if (p->ctfteam == 1 && p->skincolor != skincolor_redteam) { for (i = 0; i <= splitscreen; i++) { if (p == &players[g_localplayers[i]]) + { CV_SetValue(&cv_playercolor[i], skincolor_redteam); + break; + } } } else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam) @@ -2340,7 +2322,10 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) for (i = 0; i <= splitscreen; i++) { if (p == &players[g_localplayers[i]]) + { CV_SetValue(&cv_playercolor[i], skincolor_blueteam); + break; + } } } } @@ -2436,7 +2421,7 @@ void G_SpawnPlayer(INT32 playernum) void G_MovePlayerToSpawnOrStarpost(INT32 playernum) { - if (players[playernum].starposttime) + if (players[playernum].starpostnum) P_MovePlayerToStarpost(playernum); else P_MovePlayerToSpawn(playernum, G_FindMapStart(playernum)); @@ -2449,7 +2434,7 @@ mapthing_t *G_FindTeamStart(INT32 playernum) if (!numredctfstarts && !numbluectfstarts) //why even bother, eh? { - if ((gametyperules & GTR_TEAMSTARTS) && doprints)) + if ((gametyperules & GTR_TEAMSTARTS) && doprints) CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n")); return NULL; } @@ -2515,7 +2500,7 @@ mapthing_t *G_FindBattleStart(INT32 playernum) return NULL; } - if (doprints) + if ((gametyperules & GTR_BATTLESTARTS) && doprints) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -2658,7 +2643,7 @@ mapthing_t *G_FindMapStart(INT32 playernum) // In platform gametypes, spawn in Co-op starts first // Overriden by GTR_BATTLESTARTS. if (gametyperules & GTR_BATTLESTARTS) - spawnpoint = G_FindMatchStartOrFallback(playernum); + spawnpoint = G_FindBattleStartOrFallback(playernum); else spawnpoint = G_FindRaceStartOrFallback(playernum); } @@ -2731,8 +2716,6 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo) void G_DoReborn(INT32 playernum) { player_t *player = &players[playernum]; - boolean resetlevel = false; - INT32 i; // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); @@ -2757,43 +2740,9 @@ void G_DoReborn(INT32 playernum) void G_AddPlayer(INT32 playernum) { - INT32 countplayers = 0, notexiting = 0; - player_t *p = &players[playernum]; - - // Go through the current players and make sure you have the latest starpost set - if (G_PlatformGametype() && (netgame || multiplayer)) - { - INT32 i; - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - - if (players[i].bot) // ignore dumb, stupid tails - continue; - - countplayers++; - - if (!players[i].exiting) - notexiting++; - - p->starpostscale = players[i].starpostscale; - p->starposttime = players[i].starposttime; - p->starpostx = players[i].starpostx; - p->starposty = players[i].starposty; - p->starpostz = players[i].starpostz; - p->starpostangle = players[i].starpostangle; - p->starpostnum = players[i].starpostnum; - } - } - p->playerstate = PST_REBORN; - demo_extradata[playernum] |= DXD_PLAYSTATE|DXD_COLOR|DXD_NAME|DXD_SKIN|DXD_FOLLOWER; // Set everything - - if ((countplayers && !notexiting) || G_IsSpecialStage(gamemap)) - P_DoPlayerExit(p); } void G_ExitLevel(void) @@ -3104,7 +3053,7 @@ boolean G_IsSpecialStage(INT32 mapnum) #if 1 (void)mapnum; #else - if (modeattacking == ATTACKING_RECORD) + if (modeattacking == ATTACKING_TIME) return false; if (mapnum >= sstage_start && mapnum <= sstage_end) return true; @@ -3241,11 +3190,11 @@ INT16 G_SometimesGetDifferentGametype(void) // UINT8 G_GetGametypeColor(INT16 gt) { - if (modeattacking // == ATTACKING_RECORD + if (modeattacking // == ATTACKING_TIME || gamestate == GS_TIMEATTACK) return orangemap[0]; - if (gt == GT_MATCH) + if (gt == GT_BATTLE) return redmap[0]; if (gt == GT_RACE) @@ -3255,23 +3204,19 @@ UINT8 G_GetGametypeColor(INT16 gt) } /** 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. * \return The typeoflevel flag to check for that gametype. * \author Graue */ UINT32 G_TOLFlag(INT32 pgametype) { - if (!multiplayer) - return TOL_SP; - return gametypetol[pgametype]; } -static INT32 TOLMaps(INT16 tolflags) +static UINT32 TOLMaps(UINT32 tolflags) { - INT32 num = 0; - INT16 i; + UINT32 num = 0; + UINT32 i; // Find all the maps that are ok and and put them in an array. for (i = 0; i < NUMMAPS; i++) @@ -3447,27 +3392,14 @@ static void G_UpdateVisited(void) // Update visitation flags mapvisited[gamemap-1] |= MV_BEATEN; - // eh, what the hell - if (ultimatemode) - mapvisited[gamemap-1] |= MV_ULTIMATE; - // may seem incorrect but IS possible in what the main game uses as mp special stages, and nummaprings will be -1 in NiGHTS - if (nummaprings > 0 && players[consoleplayer].rings >= nummaprings) + + if (encoremode == true) { - mapvisited[gamemap-1] |= MV_PERFECT; - if (modeattacking) - mapvisited[gamemap-1] |= MV_PERFECTRA; - } - if (!spec) - { - // not available to special stages because they can only really be done in one order in an unmodified game, so impossible for first six and trivial for seventh - if (ALL7EMERALDS(emeralds)) - mapvisited[gamemap-1] |= MV_ALLEMERALDS; + mapvisited[gamemap-1] |= MV_ENCORE; } - if (modeattacking == ATTACKING_RECORD) + if (modeattacking) G_UpdateRecordReplays(); - else if (modeattacking == ATTACKING_NIGHTS) - G_SetNightsRecords(); if ((earnedEmblems = M_CompletionEmblems())) CONS_Printf(M_GetText("\x82" "Earned %hu emblem%s for level completion.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : ""); @@ -3476,7 +3408,8 @@ static void G_UpdateVisited(void) static boolean CanSaveLevel(INT32 mapnum) { - // SRB2Kart: + // SRB2Kart: No save files yet + (void)mapnum; return false; } @@ -3512,6 +3445,7 @@ static void G_HandleSaveLevel(void) static void G_DoCompleted(void) { INT32 i, j = 0; + boolean spec = G_IsSpecialStage(gamemap); SINT8 powertype = K_UsingPowerLevels(); if (modeattacking && pausedelay) @@ -3528,7 +3462,7 @@ static void G_DoCompleted(void) if (playeringame[i]) { // SRB2Kart: exitlevel shouldn't get you the points - if (!players[i].exiting && !(players[i].pflags & PF_TIMEOVER)) + if (!players[i].exiting && !(players[i].pflags & PF_GAMETYPEOVER)) { if (players[i].bot) { @@ -3536,7 +3470,7 @@ static void G_DoCompleted(void) } else { - players[i].pflags |= PF_TIMEOVER; + players[i].pflags |= PF_GAMETYPEOVER; if (P_IsLocalPlayer(&players[i])) { @@ -3566,8 +3500,11 @@ static void G_DoCompleted(void) if (nextmapoverride != 0) { nextmap = (INT16)(nextmapoverride-1); + } else if (marathonmode && mapheaderinfo[gamemap-1]->marathonnext) + { nextmap = (INT16)(mapheaderinfo[gamemap-1]->marathonnext-1); + } else if (grandprixinfo.gp == true) { if (grandprixinfo.roundnum == 0 || grandprixinfo.cup == NULL) // Single session @@ -3596,7 +3533,7 @@ static void G_DoCompleted(void) } // Remember last map for when you come out of the special stage. - if (!G_IsSpecialStage(gamemap)) + if (!spec) lastmap = nextmap; // If nextmap is actually going to get used, make sure it points to @@ -3738,7 +3675,7 @@ void G_AfterIntermission(void) return; } - if ((gametyperules & GTR_CUTSCENES) && mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking && skipstats <= 1 && (gamecomplete || !(marathonmode & MA_NOCUTSCENES))) // Start a custom cutscene. + if ((gametyperules & GTR_CAMPAIGN) && mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking && skipstats <= 1 && (gamecomplete || !(marathonmode & MA_NOCUTSCENES))) // Start a custom cutscene. F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false); else { @@ -3884,7 +3821,7 @@ void G_EndGame(void) G_SaveDemo(); // Only do evaluation and credits in coop games. - if (gametyperules & GTR_CUTSCENES) + if (gametyperules & GTR_CAMPAIGN) { if (nextmap == 1103-1) // end game with ending { @@ -4035,7 +3972,6 @@ void G_LoadGameData(void) } timesBeaten = READUINT32(save_p); - timesBeatenWithEmeralds = READUINT32(save_p); // Main records for (i = 0; i < NUMMAPS; ++i) @@ -4076,7 +4012,7 @@ void G_LoadGameData(void) // G_SaveGameData // Saves the main data file, which stores information such as emblems found, etc. -void G_SaveGameData(boolean force) +void G_SaveGameData(void) { size_t length; INT32 i, j; @@ -4092,6 +4028,16 @@ void G_SaveGameData(boolean force) return; } +#if 0 + // SRB2Kart: Let players unlock stuff with addons. + if (modifiedgame && !savemoddata) + { + free(savebuffer); + save_p = savebuffer = NULL; + return; + } +#endif + // Version test WRITEUINT32(save_p, 0xFCAFE211); @@ -4142,7 +4088,6 @@ void G_SaveGameData(boolean force) } WRITEUINT32(save_p, timesBeaten); - WRITEUINT32(save_p, timesBeatenWithEmeralds); // Main records for (i = 0; i < NUMMAPS; i++) @@ -4460,7 +4405,7 @@ void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar } SetPlayerSkinByNum(consoleplayer, pickedchar); - CV_StealthSet(&cv_skin, skins[pickedchar].name); + CV_StealthSet(&cv_skin[0], skins[pickedchar].name); if (color != SKINCOLOR_NONE) { @@ -4560,7 +4505,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool automapactive = false; imcontinuing = false; - if ((gametyperules & GTR_CUTSCENES) && !skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene. + if ((gametyperules & GTR_CAMPAIGN) && !skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking && !(marathonmode & MA_NOCUTSCENES)) // Start a custom cutscene. F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer); else { diff --git a/src/g_game.h b/src/g_game.h index 90df573fd..41735c88c 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -151,9 +151,10 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc); INT32 G_FindMapByNameOrCode(const char *query, char **foundmapnamep); // XMOD spawning -mapthing_t *G_FindCTFStart(INT32 playernum); -mapthing_t *G_FindMatchStart(INT32 playernum); +mapthing_t *G_FindTeamStart(INT32 playernum); +mapthing_t *G_FindBattleStart(INT32 playernum); mapthing_t *G_FindRaceStart(INT32 playernum); +mapthing_t *G_FindMapStart(INT32 playernum); void G_MovePlayerToSpawnOrStarpost(INT32 playernum); void G_SpawnPlayer(INT32 playernum); @@ -255,7 +256,7 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics); // Don't split up TOL handling UINT32 G_TOLFlag(INT32 pgametype); -INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer); +INT16 G_RandMap(UINT32 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer); void G_AddMapToBuffer(INT16 map); #endif diff --git a/src/g_input.c b/src/g_input.c index 99066672c..15b2edc1a 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -843,7 +843,7 @@ INT32 G_KeyStringtoNum(const char *keystr) void G_DefineDefaultControls(void) { - INT32 i, j; + INT32 i; // Keyboard controls gamecontroldefault[0][gcs_kart][gc_aimforward ][0] = KEY_UPARROW; @@ -874,17 +874,17 @@ void G_DefineDefaultControls(void) for (i = gcs_custom+1; i < num_gamecontrolschemes; i++) // skip gcs_custom { // Gamepad controls -- same for all schemes - gamecontroldefault[0][j][gc_accelerate ][1] = KEY_JOY1+0; // A - gamecontroldefault[0][j][gc_lookback ][1] = KEY_JOY1+2; // X - gamecontroldefault[0][j][gc_brake ][1] = KEY_JOY1+1; // B - gamecontroldefault[0][j][gc_fire ][1] = KEY_JOY1+4; // LB - gamecontroldefault[0][j][gc_drift ][1] = KEY_JOY1+5; // RB + gamecontroldefault[0][i][gc_accelerate ][1] = KEY_JOY1+0; // A + gamecontroldefault[0][i][gc_lookback ][1] = KEY_JOY1+2; // X + gamecontroldefault[0][i][gc_brake ][1] = KEY_JOY1+1; // B + gamecontroldefault[0][i][gc_fire ][1] = KEY_JOY1+4; // LB + gamecontroldefault[0][i][gc_drift ][1] = KEY_JOY1+5; // RB - gamecontroldefault[0][j][gc_viewpoint ][1] = KEY_JOY1+3; // Y - gamecontroldefault[0][j][gc_pause ][1] = KEY_JOY1+6; // Back - gamecontroldefault[0][j][gc_systemmenu ][0] = KEY_JOY1+7; // Start - gamecontroldefault[0][j][gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down - gamecontroldefault[0][j][gc_scores ][1] = KEY_HAT1+0; // D-Pad Up + gamecontroldefault[0][i][gc_viewpoint ][1] = KEY_JOY1+3; // Y + gamecontroldefault[0][i][gc_pause ][1] = KEY_JOY1+6; // Back + gamecontroldefault[0][i][gc_systemmenu ][0] = KEY_JOY1+7; // Start + gamecontroldefault[0][i][gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down + gamecontroldefault[0][i][gc_scores ][1] = KEY_HAT1+0; // D-Pad Up gamecontroldefault[1][i][gc_accelerate ][0] = KEY_2JOY1+0; // A gamecontroldefault[1][i][gc_lookback ][0] = KEY_2JOY1+2; // X @@ -945,17 +945,17 @@ void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const I } } -void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2]) +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[2], INT32 (*fromcontrolsb)[2], INT32 (*fromcontrolsc)[2], INT32 (*fromcontrolsd)[2]) { INT32 i; for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(fromcontrols[0][i][0])); + G_KeynumToString(fromcontrolsa[i][0])); - if (fromcontrols[0][i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[0][i][1])); + if (fromcontrolsa[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsa[i][1])); else fprintf(f, "\n"); } @@ -963,10 +963,10 @@ void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2]) for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(fromcontrols[1][i][0])); + G_KeynumToString(fromcontrolsb[i][0])); - if (fromcontrols[1][i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[1][i][1])); + if (fromcontrolsb[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsb[i][1])); else fprintf(f, "\n"); } @@ -974,10 +974,10 @@ void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2]) for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol3 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(fromcontrols[2][i][0])); + G_KeynumToString(fromcontrolsc[i][0])); - if (fromcontrols[2][i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[2][i][1])); + if (fromcontrolsc[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsc[i][1])); else fprintf(f, "\n"); } @@ -985,10 +985,10 @@ void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2]) for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol4 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(fromcontrols[3][i][0])); + G_KeynumToString(fromcontrolsd[i][0])); - if (fromcontrols[3][i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[3][i][1])); + if (fromcontrolsd[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsd[i][1])); else fprintf(f, "\n"); } diff --git a/src/g_input.h b/src/g_input.h index a778213fa..651f95324 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -124,7 +124,7 @@ extern UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2]; extern INT32 gamecontroldefault[MAXSPLITSCREENPLAYERS][num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention -#define PlayerInputDown(p, gc) (gamekeydown[p-1][gamecontrol[gc][0]] || gamekeydown[p-1][gamecontrol[gc][1]]) +#define PlayerInputDown(p, gc) (gamekeydown[gamecontrol[p-1][gc][0]] || gamekeydown[gamecontrol[p-1][gc][1]]) #define num_gcl_accelerate 1 #define num_gcl_brake 1 @@ -162,7 +162,7 @@ void Command_Setcontrol4_f(void); void G_DefineDefaultControls(void); INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); -void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]); +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[2], INT32 (*fromcontrolsb)[2], INT32 (*fromcontrolsc)[2], INT32 (*fromcontrolsd)[2]); INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify); #endif diff --git a/src/i_joy.h b/src/i_joy.h index 0e9c70b1e..b10f4c55d 100644 --- a/src/i_joy.h +++ b/src/i_joy.h @@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t; for palyer[sic] 1-4's joystick/gamepad */ -extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4; +extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS]; #endif // __I_JOY_H__ diff --git a/src/k_battle.c b/src/k_battle.c index 17b8a46f9..6279a301d 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -255,7 +255,7 @@ void K_CheckBumpers(void) { for (i = 0; i < MAXPLAYERS; i++) { - players[i].pflags |= PF_TIMEOVER; + players[i].pflags |= PF_GAMETYPEOVER; P_DoPlayerExit(&players[i]); } } diff --git a/src/m_cheat.c b/src/m_cheat.c index 542860afc..9e12a1ca7 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -279,9 +279,6 @@ boolean cht_Responder(event_t *ev) #define REQUIRE_SINGLEPLAYER if (netgame || multiplayer)\ { CONS_Printf(M_GetText("This only works in single player.\n")); return; } -#define REQUIRE_NOULTIMATE if (ultimatemode)\ -{ CONS_Printf(M_GetText("You're too good to be cheating!\n")); return; } - // command that can be typed at the console! void Command_CheatNoClip_f(void) { @@ -289,7 +286,6 @@ void Command_CheatNoClip_f(void) REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; plyr = &players[consoleplayer]; @@ -313,7 +309,6 @@ void Command_CheatGod_f(void) REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; plyr = &players[consoleplayer]; plyr->pflags ^= PF_GODMODE; @@ -328,7 +323,6 @@ void Command_CheatNoTarget_f(void) REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; plyr = &players[consoleplayer]; plyr->pflags ^= PF_INVIS; @@ -844,7 +838,6 @@ void Command_Savecheckpoint_f(void) /*void Command_Getallemeralds_f(void) { REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; REQUIRE_PANDORA; emeralds = ((EMERALD7)*2)-1; @@ -855,7 +848,6 @@ void Command_Savecheckpoint_f(void) void Command_Resetemeralds_f(void) { REQUIRE_SINGLEPLAYER; - REQUIRE_PANDORA; emeralds = 0; @@ -867,7 +859,6 @@ void Command_Devmode_f(void) #ifndef _DEBUG REQUIRE_SINGLEPLAYER; #endif - REQUIRE_NOULTIMATE; if (COM_Argc() > 1) { @@ -888,30 +879,20 @@ void Command_Devmode_f(void) G_SetGameModified(multiplayer, true); } -/*void Command_Setrings_f(void) +void Command_Setrings_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; REQUIRE_PANDORA; if (COM_Argc() > 1) { - if (!(maptol & TOL_NIGHTS)) - { - // P_GivePlayerRings does value clamping - players[consoleplayer].rings = 0; - P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); - players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings - } - else - { - players[consoleplayer].spheres = 0; - P_GivePlayerSpheres(&players[consoleplayer], atoi(COM_Argv(1))); - // no totalsphere addition to revert - } + // P_GivePlayerRings does value clamping + players[consoleplayer].rings = 0; + P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); + players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings - G_SetGameModified(multiplayer); + G_SetGameModified(multiplayer, true); } } @@ -919,14 +900,15 @@ void Command_Setlives_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; REQUIRE_PANDORA; if (COM_Argc() > 1) { SINT8 lives = atoi(COM_Argv(1)); if (lives == -1) + { players[consoleplayer].lives = INFLIVES; // infinity! + } else { // P_GivePlayerLives does value clamping @@ -934,37 +916,10 @@ void Command_Setlives_f(void) P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1))); } - G_SetGameModified(multiplayer); + G_SetGameModified(multiplayer, true); } } -void Command_Setcontinues_f(void) -{ - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - if (!continuesInSession) - { - CONS_Printf(M_GetText("This session does not use continues.\n")); - return; - } - - if (COM_Argc() > 1) - { - INT32 numcontinues = atoi(COM_Argv(1)); - if (numcontinues > 99) - numcontinues = 99; - else if (numcontinues < 0) - numcontinues = 0; - - players[consoleplayer].continues = numcontinues; - - G_SetGameModified(multiplayer); - } -}*/ - // // OBJECTPLACE (and related variables) // @@ -1441,7 +1396,6 @@ void Command_ObjectPlace_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; G_SetGameModified(multiplayer, true); diff --git a/src/m_cond.c b/src/m_cond.c index 7b93d46b0..20d041f4f 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -91,7 +91,7 @@ void M_ClearSecrets(void) for (i = 0; i < MAXCONDITIONSETS; ++i) conditionSets[i].achieved = false; - timesBeaten = timesBeatenWithEmeralds = 0; + timesBeaten = 0; // Re-unlock any always unlocked things M_SilentUpdateUnlockablesAndEmblems(); @@ -112,8 +112,6 @@ UINT8 M_CheckCondition(condition_t *cn) return (vspowerlevel[cn->extrainfo1] >= (unsigned)cn->requirement); case UC_GAMECLEAR: // Requires game beaten >= x times return (timesBeaten >= (unsigned)cn->requirement); - case UC_ALLEMERALDS: // Requires game beaten with all 7 emeralds >= x times - return (timesBeatenWithEmeralds >= (unsigned)cn->requirement); case UC_OVERALLTIME: // Requires overall time <= x return (M_GotLowEnoughTime(cn->requirement)); case UC_MAPVISITED: // Requires map x to be visited diff --git a/src/m_menu.c b/src/m_menu.c index 2f4d96e9c..c26f05b82 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1715,7 +1715,7 @@ inline static void M_GetGametypeColor(void) warningflags = V_REDMAP; recommendedflags = V_GREENMAP; - if (modeattacking // == ATTACKING_RECORD + if (modeattacking // == ATTACKING_TIME || gamestate == GS_TIMEATTACK) { highlightflags = V_ORANGEMAP; @@ -1732,7 +1732,7 @@ inline static void M_GetGametypeColor(void) else gt = gametype; - if (gt == GT_MATCH) + if (gt == GT_BATTLE) { highlightflags = V_REDMAP; warningflags = V_ORANGEMAP; @@ -7426,8 +7426,7 @@ static void M_Statistics(INT32 choice) if (!mapheaderinfo[i] || mapheaderinfo[i]->lvlttl[0] == '\0') continue; - if (!(mapheaderinfo[i]->typeoflevel & TOL_RACE) // TOL_SP - || (mapheaderinfo[i]->menuflags & (LF2_HIDEINSTATS|LF2_HIDEINMENU))) + if (mapheaderinfo[i]->menuflags & (LF2_HIDEINSTATS|LF2_HIDEINMENU)) continue; if (M_MapLocked(i+1)) // !mapvisited[i] @@ -8137,7 +8136,7 @@ static void M_ChooseTimeAttack(INT32 choice) (void)choice; emeralds = 0; M_ClearMenus(true); - modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_RECORD); + modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_TIME); gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder); @@ -8188,7 +8187,7 @@ static void M_HandleStaffReplay(INT32 choice) if (l == LUMPERROR) break; M_ClearMenus(true); - modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_RECORD); + modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_TIME); demo.loadfiles = false; demo.ignorefiles = true; // Just assume that record attack replays have the files needed G_DoPlayDemo(va("%sS%02u",G_BuildMapName(cv_nextmap.value),cv_dummystaff.value)); break; @@ -8209,7 +8208,7 @@ static void M_ReplayTimeAttack(INT32 choice) { const char *which; M_ClearMenus(true); - modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_RECORD); // set modeattacking before G_DoPlayDemo so the map loader knows + modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_TIME); // set modeattacking before G_DoPlayDemo so the map loader knows demo.loadfiles = false; demo.ignorefiles = true; // Just assume that record attack replays have the files needed if (currentMenu == &SP_ReplayDef) diff --git a/src/m_misc.c b/src/m_misc.c index 865f1bbe1..6ebd9e796 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -647,9 +647,9 @@ void M_SaveConfig(const char *filename) if (!dedicated) { if (tutorialmode && tutorialgcs) - G_SaveKeySetting(f, gamecontroldefault[0][gcs_custom], gamecontrol[1]); // using gcs_custom as temp storage + G_SaveKeySetting(f, gamecontroldefault[0][gcs_custom]); // using gcs_custom as temp storage else - G_SaveKeySetting(f, gamecontrol[0], gamecontrol[1]); + G_SaveKeySetting(f, gamecontrol); } fclose(f); diff --git a/src/p_enemy.c b/src/p_enemy.c index fb895759c..fdcd3eb53 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -797,132 +797,6 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed //return false; } -#ifdef WEIGHTEDRECYCLER -// Compares players to see who currently has the "best" items, etc. -static int P_RecycleCompare(const void *p1, const void *p2) -{ - player_t *player1 = &players[*(const UINT8 *)p1]; - player_t *player2 = &players[*(const UINT8 *)p2]; - - // Non-shooting gametypes - if (!(gametyperules & GTR_CIRCUIT)) - { - // Invincibility. - if (player1->powers[pw_invulnerability] > player2->powers[pw_invulnerability]) return -1; - else if (player2->powers[pw_invulnerability] > player1->powers[pw_invulnerability]) return 1; - - // One has a shield, the other doesn't. - if (player1->powers[pw_shield] && !player2->powers[pw_shield]) return -1; - else if (player2->powers[pw_shield] && !player1->powers[pw_shield]) return 1; - - // Sneakers. - if (player1->powers[pw_sneakers] > player2->powers[pw_sneakers]) return -1; - else if (player2->powers[pw_sneakers] > player1->powers[pw_sneakers]) return 1; - } - else // Match, Team Match, CTF, Tag, Etc. - { - UINT8 player1_em = M_CountBits((UINT32)player1->powers[pw_emeralds], 7); - UINT8 player2_em = M_CountBits((UINT32)player2->powers[pw_emeralds], 7); - - UINT8 player1_rw = M_CountBits((UINT32)player1->ringweapons, NUM_WEAPONS-1); - UINT8 player2_rw = M_CountBits((UINT32)player2->ringweapons, NUM_WEAPONS-1); - - UINT16 player1_am = player1->powers[pw_infinityring] // max 800 - + player1->powers[pw_automaticring] // max 300 - + (player1->powers[pw_bouncering] * 3) // max 100 - + (player1->powers[pw_explosionring] * 6) // max 50 - + (player1->powers[pw_scatterring] * 3) // max 100 - + (player1->powers[pw_grenadering] * 6) // max 50 - + (player1->powers[pw_railring] * 6); // max 50 - UINT16 player2_am = player2->powers[pw_infinityring] // max 800 - + player2->powers[pw_automaticring] // max 300 - + (player2->powers[pw_bouncering] * 3) // max 100 - + (player2->powers[pw_explosionring] * 6) // max 50 - + (player2->powers[pw_scatterring] * 3) // max 100 - + (player2->powers[pw_grenadering] * 6) // max 50 - + (player2->powers[pw_railring] * 6); // max 50 - - // Super trumps everything. - if (player1->powers[pw_super] && !player2->powers[pw_super]) return -1; - else if (player2->powers[pw_super] && !player1->powers[pw_super]) return 1; - - // Emerald count if neither player is Super. - if (player1_em > player2_em) return -1; - else if (player1_em < player2_em) return 1; - - // One has a shield, the other doesn't. - // (the likelihood of a shielded player being worse off than one without one is low.) - if (player1->powers[pw_shield] && !player2->powers[pw_shield]) return -1; - else if (player2->powers[pw_shield] && !player1->powers[pw_shield]) return 1; - - // Ring weapons count - if (player1_rw > player2_rw) return -1; - else if (player1_rw < player2_rw) return 1; - - // Ring ammo if they have the same number of weapons - if (player1_am > player2_am) return -1; - else if (player1_am < player2_am) return 1; - } - - // Identical for our purposes - return 0; -} -#endif - -// Handles random monitor weights via console. -static mobjtype_t P_DoRandomBoxChances(void) -{ - mobjtype_t spawnchance[256]; - INT32 numchoices = 0, i = 0; - - if (!(netgame || multiplayer)) - { - switch (P_RandomKey(10)) - { - case 0: - return MT_RING_ICON; - case 1: - return MT_SNEAKERS_ICON; - case 2: - return MT_INVULN_ICON; - case 3: - return MT_WHIRLWIND_ICON; - case 4: - return MT_ELEMENTAL_ICON; - case 5: - return MT_ATTRACT_ICON; - case 6: - return MT_FORCE_ICON; - case 7: - return MT_ARMAGEDDON_ICON; - case 8: - return MT_1UP_ICON; - case 9: - return MT_EGGMAN_ICON; - } - return MT_NULL; - } - -#define QUESTIONBOXCHANCES(type, cvar) \ -for (i = cvar.value; i; --i) spawnchance[numchoices++] = type - QUESTIONBOXCHANCES(MT_RING_ICON, cv_superring); - QUESTIONBOXCHANCES(MT_SNEAKERS_ICON, cv_supersneakers); - QUESTIONBOXCHANCES(MT_INVULN_ICON, cv_invincibility); - QUESTIONBOXCHANCES(MT_WHIRLWIND_ICON, cv_jumpshield); - QUESTIONBOXCHANCES(MT_ELEMENTAL_ICON, cv_watershield); - QUESTIONBOXCHANCES(MT_ATTRACT_ICON, cv_ringshield); - QUESTIONBOXCHANCES(MT_FORCE_ICON, cv_forceshield); - QUESTIONBOXCHANCES(MT_ARMAGEDDON_ICON, cv_bombshield); - QUESTIONBOXCHANCES(MT_1UP_ICON, cv_1up); - QUESTIONBOXCHANCES(MT_EGGMAN_ICON, cv_eggmanbox); - QUESTIONBOXCHANCES(MT_MIXUP_ICON, cv_teleporters); - QUESTIONBOXCHANCES(MT_RECYCLER_ICON, cv_recycler); -#undef QUESTIONBOXCHANCES - - if (numchoices == 0) return MT_NULL; - return spawnchance[P_RandomKey(numchoices)]; -} - // // ACTION ROUTINES // @@ -4174,40 +4048,6 @@ void A_CustomPower(mobj_t *actor) P_SpawnShieldOrb(player); } -// Function: A_GiveWeapon -// -// Description: Gives the player the specified weapon panels. -// -// var1 = Weapon index # -// var2 = unused -// -void A_GiveWeapon(mobj_t *actor) -{ - player_t *player; - INT32 locvar1 = var1; - - if (LUA_CallAction("A_GiveWeapon", actor)) - return; - - if (!actor->target || !actor->target->player) - { - CONS_Debug(DBG_GAMELOGIC, "Powerup has no target.\n"); - return; - } - - if (locvar1 >= 1<<(NUM_WEAPONS-1)) - { - CONS_Debug(DBG_GAMELOGIC, "Weapon #%d out of range!\n", locvar1); - return; - } - - player = actor->target->player; - - player->ringweapons |= locvar1; - if (actor->info->seesound) - S_StartSound(player->mo, actor->info->seesound); -} - // Function: A_RingBox // // Description: Awards the player 10 rings. @@ -6862,147 +6702,6 @@ void A_MixUp(mobj_t *actor) S_StartSound(NULL, sfx_mixup); } -// Function: A_RecyclePowers -// -// Description: Take all player's powers, and swap 'em. -// -// var1 = unused -// var2 = unused -// -void A_RecyclePowers(mobj_t *actor) -{ - INT32 i, j, k, numplayers = 0; - -#ifdef WEIGHTEDRECYCLER - UINT8 beneficiary = 255; -#endif - UINT8 playerslist[MAXPLAYERS]; - UINT8 postscramble[MAXPLAYERS]; - - UINT16 powers[MAXPLAYERS][NUMPOWERS]; - INT32 weapons[MAXPLAYERS]; - INT32 weaponheld[MAXPLAYERS]; - - if (LUA_CallAction("A_RecyclePowers", actor)) - return; - - if (!multiplayer) - { - S_StartSound(actor, sfx_lose); - return; - } - - numplayers = 0; - - // Count the number of players in the game - for (i = 0, j = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE - && !players[i].exiting && !((netgame || multiplayer) && players[i].spectator)) - { -#ifndef WEIGHTEDRECYCLER - if (players[i].powers[pw_super]) - continue; // Ignore super players -#endif - - numplayers++; - postscramble[j] = playerslist[j] = (UINT8)i; - -#ifdef WEIGHTEDRECYCLER - // The guy who started the recycle gets the best result - if (actor && actor->target && actor->target->player && &players[i] == actor->target->player) - beneficiary = (UINT8)i; -#endif - - // Save powers - for (k = 0; k < NUMPOWERS; k++) - powers[i][k] = players[i].powers[k]; - //1.1: ring weapons too - weapons[i] = players[i].ringweapons; - weaponheld[i] = players[i].currentweapon; - - j++; - } - } - - if (numplayers <= 1) - { - S_StartSound(actor, sfx_lose); - return; //nobody to touch! - } - - //shuffle the post scramble list, whee! - // hardcoded 0-1 to 1-0 for two players - if (numplayers == 2) - { - postscramble[0] = playerslist[1]; - postscramble[1] = playerslist[0]; - } - else - for (j = 0; j < numplayers; j++) - { - UINT8 tempint; - - i = j + ((P_RandomByte() + leveltime) % (numplayers - j)); - tempint = postscramble[j]; - postscramble[j] = postscramble[i]; - postscramble[i] = tempint; - } - -#ifdef WEIGHTEDRECYCLER - //the joys of qsort... - if (beneficiary != 255) { - qsort(playerslist, numplayers, sizeof(UINT8), P_RecycleCompare); - - // now, make sure the benificiary is in the best slot - // swap out whatever poor sap was going to get the best items - for (i = 0; i < numplayers; i++) - { - if (postscramble[i] == beneficiary) - { - postscramble[i] = postscramble[0]; - postscramble[0] = beneficiary; - break; - } - } - } -#endif - - // now assign! - for (i = 0; i < numplayers; i++) - { - UINT8 send_pl = playerslist[i]; - UINT8 recv_pl = postscramble[i]; - - // debugF - CONS_Debug(DBG_GAMELOGIC, "sending player %hu's items to %hu\n", (UINT16)send_pl, (UINT16)recv_pl); - - for (j = 0; j < NUMPOWERS; j++) - { - if (j == pw_flashing || j == pw_underwater || j == pw_spacetime || j == pw_carry - || j == pw_tailsfly || j == pw_extralife || j == pw_nocontrol || j == pw_super - || j == pw_pushing || j == pw_justsprung || j == pw_noautobrake || j == pw_justlaunched - || j == pw_ignorelatch) - continue; - players[recv_pl].powers[j] = powers[send_pl][j]; - } - - //1.1: weapon rings too - players[recv_pl].ringweapons = weapons[send_pl]; - players[recv_pl].currentweapon = weaponheld[send_pl]; - - if (((players[recv_pl].powers[pw_shield] & SH_NOSTACK) == SH_PINK) && (players[recv_pl].revitem == MT_LHRT || players[recv_pl].spinitem == MT_LHRT || players[recv_pl].thokitem == MT_LHRT)) // Healers can't keep their buff. - players[recv_pl].powers[pw_shield] &= SH_STACK; - - P_SpawnShieldOrb(&players[recv_pl]); - if (P_IsLocalPlayer(&players[recv_pl])) - P_RestoreMusic(&players[recv_pl]); - P_FlashPal(&players[recv_pl], PAL_RECYCLE, 10); - } - - S_StartSound(NULL, sfx_gravch); //heh, the sound effect I used is already in -} - // Function: A_Boss1Chase // // Description: Like A_Chase, but for Boss 1. diff --git a/src/p_inter.c b/src/p_inter.c index 8b90dc1c6..05809b174 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -715,22 +715,7 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost) if (player->starpostnum >= post->health) return; // Already hit this post - // Save the player's time and position. - player->starposttime = leveltime; - player->starpostx = checkbase->x>>FRACBITS; - player->starposty = checkbase->y>>FRACBITS; - player->starpostz = post->z>>FRACBITS; - player->starpostangle = post->angle; - player->starpostscale = player->mo->destscale; - if (post->flags2 & MF2_OBJECTFLIP) - { - player->starpostscale *= -1; - player->starpostz += post->height>>FRACBITS; - } player->starpostnum = post->health; - //S_StartSound(toucher, post->info->painsound); - - P_ClearStarPost(post->health); } // Easily make it so that overtime works offline @@ -927,7 +912,7 @@ boolean P_CheckRacers(void) numplayersingame++; - if (players[i].exiting || (players[i].pflags & PF_TIMEOVER)) + if (players[i].exiting || (players[i].pflags & PF_GAMETYPEOVER)) { numexiting++; } @@ -987,7 +972,7 @@ boolean P_CheckRacers(void) continue; } - if (players[i].exiting || (players[i].pflags & PF_TIMEOVER)) + if (players[i].exiting || (players[i].pflags & PF_GAMETYPEOVER)) { // You're done, you're free to go. continue; @@ -1367,7 +1352,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) target->momx = target->momy = target->momz = 0; - if (target->player && target->player->pflags & PF_TIMEOVER) + if (target->player && target->player->pflags & PF_GAMETYPEOVER) break; if (damagetype == DMG_DROWNED) // drowned diff --git a/src/p_map.c b/src/p_map.c index 5f2bcc7dc..05c4a6c46 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2329,7 +2329,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) #ifndef NOCLIPCAM if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!! #else - if (thiscam == &camera[i] && !(players[displayplayers[i]].pflags & PF_TIMEOVER)) // Time Over should not clip through walls + if (thiscam == &camera[i] && !(players[displayplayers[i]].pflags & PF_GAMETYPEOVER)) // Time Over should not clip through walls #endif { floatok = true; diff --git a/src/p_mobj.c b/src/p_mobj.c index c21a573ba..853a805ef 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3340,7 +3340,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) && (gametyperules & GTR_CIRCUIT)) + if ((player->pflags & PF_GAMETYPEOVER) && (gametyperules & GTR_CIRCUIT)) { player->karthud[khud_timeovercam] = (2*TICRATE)+1; } @@ -11495,7 +11495,7 @@ void P_SceneryThinker(mobj_t *mobj) if (!playeringame[mobj->threshold] || players[mobj->threshold].spectator) // focused on a valid player? return; - if (!(players[mobj->threshold].exiting) && !(players[mobj->threshold].pflags & PF_TIMEOVER)) // not finished yet? + if (!(players[mobj->threshold].exiting) && !(players[mobj->threshold].pflags & PF_GAMETYPEOVER)) // not finished yet? return; if (K_IsPlayerLosing(&players[mobj->threshold])) @@ -12928,9 +12928,6 @@ void P_AfterPlayerSpawn(INT32 playernum) if (CheckForReverseGravity) P_CheckGravity(mobj, false); - - if (p->pflags & PF_FINISHED) - P_GiveFinishFlags(p); } // spawn it at a playerspawn mapthing diff --git a/src/p_setup.c b/src/p_setup.c index 7fd1a6b98..396a6f4eb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -762,8 +762,6 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) UINT32 flags; tol = mapheaderinfo[mapnum-1]->typeoflevel; - if (!(tol & TOL_SP)) - return; flags = mapheaderinfo[mapnum-1]->levelflags; n = W_LumpLengthPwad(wadnum, lumpnum) / (5 * sizeof (INT16)); @@ -3375,7 +3373,7 @@ static void P_InitLevelSettings(void) players[i].deadtimer = players[i].numboxes = players[i].laps = 0; players[i].health = 1; players[i].aiming = 0; - players[i].pflags &= ~PF_TIMEOVER; + players[i].pflags &= ~PF_GAMETYPEOVER; } racecountdown = exitcountdown = exitfadestarted = 0; @@ -3537,23 +3535,18 @@ static void P_ForceCharacter(const char *forcecharskin) if (netgame) { char skincmd[33]; - if (splitscreen) + + for (i = 0; i <= splitscreen; i++) { - sprintf(skincmd, "skin2 %s\n", forcecharskin); - CV_Set(&cv_skin[1], forcecharskin); - if (splitscreen > 1) - { - sprintf(skincmd, "skin3 %s\n", forcecharskin); - CV_Set(&cv_skin[2], forcecharskin); - if (splitscreen > 2) - { - sprintf(skincmd, "skin4 %s\n", forcecharskin); - CV_Set(&cv_skin[3], forcecharskin); - } - } + const char *num = ""; + + if (i > 0) + num = va("%d", i+1); + + sprintf(skincmd, "skin%s %s\n", num, forcecharskin); + CV_Set(&cv_skin[i], forcecharskin); } - sprintf(skincmd, "skin %s\n", forcecharskin); COM_BufAddText(skincmd); } else @@ -3902,8 +3895,6 @@ static void P_InitPlayers(void) else // gametype is race { G_SpawnPlayer(i); - if (players[i].starposttime) - P_ClearStarPost(players[i].starpostnum); } } } diff --git a/src/p_spec.c b/src/p_spec.c index b33980f55..d61254b00 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2228,7 +2228,7 @@ static void K_HandleLapDecrement(player_t *player) void P_CrossSpecialLine(line_t *line, INT32 side, mobj_t *thing) { // only used for the players currently - if (!(thing && thing->player && !thing->player->spectator && !(thing->player->pflags & PF_TIMEOVER))) + if (!(thing && thing->player && !thing->player->spectator && !(thing->player->pflags & PF_GAMETYPEOVER))) return; { player_t *player = thing->player; diff --git a/src/p_telept.c b/src/p_telept.c index 9df3c71d6..5296fc4ee 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -92,7 +92,6 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, // Reset map starposts for the player's new info. P_ResetStarposts(); - P_ClearStarPost(starpostnum); P_ResetPlayer(thing->player); P_SetPlayerMobjState(thing, S_KART_STILL1); // SRB2kart - was S_PLAY_STND diff --git a/src/p_user.c b/src/p_user.c index 17c25e915..c06ac9578 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -703,19 +703,19 @@ boolean P_EndingMusic(player_t *player) // Check for if this is valid or not if (r_splitscreen) { - if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) - || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) - || ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) - || ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) + if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_GAMETYPEOVER)) + || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_GAMETYPEOVER)) + || ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_GAMETYPEOVER))) + || ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_GAMETYPEOVER))))) return false; bestlocalplayer = &players[displayplayers[0]]; - bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[displayplayers[0]].kartstuff[k_position]); + bestlocalpos = ((players[displayplayers[0]].pflags & PF_GAMETYPEOVER) ? MAXPLAYERS+1 : players[displayplayers[0]].kartstuff[k_position]); #define setbests(p) \ - if (((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]) < bestlocalpos) \ + if (((players[p].pflags & PF_GAMETYPEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]) < bestlocalpos) \ { \ bestlocalplayer = &players[p]; \ - bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ + bestlocalpos = ((players[p].pflags & PF_GAMETYPEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ } setbests(displayplayers[1]); if (r_splitscreen > 1) @@ -726,11 +726,11 @@ boolean P_EndingMusic(player_t *player) } else { - if (!(player->exiting || (player->pflags & PF_TIMEOVER))) + if (!(player->exiting || (player->pflags & PF_GAMETYPEOVER))) return false; bestlocalplayer = player; - bestlocalpos = ((player->pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]); + bestlocalpos = ((player->pflags & PF_GAMETYPEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]); } if ((gametyperules & GTR_CIRCUIT) && bestlocalpos == MAXPLAYERS+1) @@ -1816,110 +1816,6 @@ static void P_CheckQuicksand(player_t *player) } } -// -// P_CheckSneakerAndLivesTimer -// -// Restores music from sneaker and life fanfares -// -/* // SRB2kart - Can't drown. -static void P_CheckSneakerAndLivesTimer(player_t *player) -{ - if (player->powers[pw_extralife] == 1) // Extra Life! - P_RestoreMusic(player); - - //if (player->powers[pw_sneakers] == 1) // SRB2kart - // P_RestoreMusic(player); -} -*/ - -// -// P_CheckUnderwaterAndSpaceTimer -// -// Restores music from underwater and space warnings, and handles number generation -// -/* // SRB2kart - Can't drown. -static void P_CheckUnderwaterAndSpaceTimer(player_t *player) -{ - tic_t timeleft = (player->powers[pw_spacetime]) ? player->powers[pw_spacetime] : player->powers[pw_underwater]; - - if (player->exiting || (player->pflags & PF_FINISHED)) - player->powers[pw_underwater] = player->powers[pw_spacetime] = 0; - - timeleft--; // The original code was all n*TICRATE + 1, so let's remove 1 tic for simplicity - - if ((timeleft == 11*TICRATE) // 5 - || (timeleft == 9*TICRATE) // 4 - || (timeleft == 7*TICRATE) // 3 - || (timeleft == 5*TICRATE) // 2 - || (timeleft == 3*TICRATE) // 1 - || (timeleft == 1*TICRATE) // 0 - ) { - fixed_t height = (player->mo->eflags & MFE_VERTICALFLIP) - ? player->mo->z - FixedMul(8*FRACUNIT + mobjinfo[MT_DROWNNUMBERS].height, FixedMul(player->mo->scale, player->shieldscale)) - : player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, FixedMul(player->mo->scale, player->shieldscale)); - - mobj_t *numbermobj = P_SpawnMobj(player->mo->x, player->mo->y, height, MT_DROWNNUMBERS); - - timeleft /= (2*TICRATE); // To be strictly accurate it'd need to be ((timeleft/TICRATE) - 1)/2, but integer division rounds down for us - - if (player->charflags & SF_MACHINE) - { - S_StartSound(player->mo, sfx_buzz1); - timeleft += 6; - } - else - S_StartSound(player->mo, sfx_dwnind); - - if (timeleft) // Don't waste time setting the state if the time is 0. - P_SetMobjState(numbermobj, numbermobj->info->spawnstate+timeleft); - - P_SetTarget(&numbermobj->target, player->mo); - numbermobj->threshold = 40; - numbermobj->destscale = player->mo->scale; - P_SetScale(numbermobj, player->mo->scale); - } - // Underwater timer runs out - else if (timeleft == 1) - { - if ((netgame || multiplayer) && P_IsLocalPlayer(player)) - S_ChangeMusic(mapmusname, mapmusflags, true); - - if (player->powers[pw_spacetime] == 1) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_SPACEDROWN); - else - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_DROWNED); - } - - if (!(player->mo->eflags & MFE_UNDERWATER) && player->powers[pw_underwater]) - { - if (player->powers[pw_underwater] <= 12*TICRATE + 1) - { - player->powers[pw_underwater] = 0; - P_RestoreMusic(player); - } - else - player->powers[pw_underwater] = 0; - } - - if (player->powers[pw_spacetime] > 1 && !P_InSpaceSector(player->mo)) - player->powers[pw_spacetime] = 0; - - // Underwater audio cues - if (P_IsLocalPlayer(player)) - { - if ((player->powers[pw_underwater] == 25*TICRATE + 1) - || (player->powers[pw_underwater] == 20*TICRATE + 1) - || (player->powers[pw_underwater] == 15*TICRATE + 1)) - S_StartSound(NULL, sfx_wtrdng); - - if (player->powers[pw_underwater] == 11*TICRATE + 1 - && player == &players[consoleplayer]) - { - P_PlayJingle(player, JT_DROWN); - } - } -}*/ - // // P_CheckInvincibilityTimer // @@ -2804,7 +2700,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) && (gametyperules & GTR_CIRCUIT)) + if ((player->pflags & PF_GAMETYPEOVER) && (gametyperules & GTR_CIRCUIT)) { player->karthud[khud_timeovercam]++; @@ -2819,13 +2715,13 @@ static void P_DeathThink(player_t *player) K_KartPlayerHUDUpdate(player); - if (player->lives > 0 && !(player->pflags & PF_TIMEOVER) && player->deadtimer > TICRATE) + if (player->lives > 0 && !(player->pflags & PF_GAMETYPEOVER) && player->deadtimer > TICRATE) { player->playerstate = PST_REBORN; } // Keep time rolling - if (!(exitcountdown && !racecountdown) && !(player->exiting || mapreset) && !(player->pflags & PF_TIMEOVER)) + if (!(exitcountdown && !racecountdown) && !(player->exiting || mapreset) && !(player->pflags & PF_GAMETYPEOVER)) { if (leveltime >= starttime) { @@ -3258,7 +3154,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall || (leveltime < introtime)); // Kart intro cam #endif - if ((player->pflags & PF_TIMEOVER) && (gametyperules & GTR_CIRCUIT)) // 1 for momentum keep, 2 for turnaround + if ((player->pflags & PF_GAMETYPEOVER) && (gametyperules & GTR_CIRCUIT)) // 1 for momentum keep, 2 for turnaround timeover = (player->karthud[khud_timeovercam] > 2*TICRATE ? 2 : 1); else timeover = 0; @@ -4053,7 +3949,7 @@ static void P_CalcPostImg(player_t *player) void P_DoTimeOver(player_t *player) { - if (player->pflags & PF_TIMEOVER) + if (player->pflags & PF_GAMETYPEOVER) { // NO! Don't do this! return; @@ -4069,7 +3965,7 @@ void P_DoTimeOver(player_t *player) CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players])); } - player->pflags |= PF_TIMEOVER; + player->pflags |= PF_GAMETYPEOVER; if (G_GametypeUsesLives()) { @@ -4353,7 +4249,7 @@ static void P_HandleFollower(player_t *player) // Make the follower invisible if we no contest'd rather than removing it. No one will notice the diff seriously. // Also make the follower invisible if we choose not to have it displayed because it isn't ours. (also quick hacky check for f12) - if (player->pflags & PF_TIMEOVER || (!cv_showfollowers.value && (!P_IsDisplayPlayer(player) || displayplayers[0] != consoleplayer) )) + if (player->pflags & PF_GAMETYPEOVER || (!cv_showfollowers.value && (!P_IsDisplayPlayer(player) || displayplayers[0] != consoleplayer) )) player->follower->drawflags |= MFD_DONTDRAW; if (player->speed && (player->follower->momx || player->follower->momy)) @@ -4562,7 +4458,7 @@ void P_PlayerThink(player_t *player) { if (playeringame[i] && !players[i].spectator) { - if (!players[i].exiting && !(players[i].pflags & PF_TIMEOVER) && players[i].lives > 0) + if (!players[i].exiting && !(players[i].pflags & PF_GAMETYPEOVER) && players[i].lives > 0) break; } } @@ -4583,7 +4479,7 @@ void P_PlayerThink(player_t *player) // If you've hit the countdown and you haven't made // it to the exit, you're a goner! - if (racecountdown == 1 && !player->spectator && !player->exiting && !(player->pflags & PF_TIMEOVER) && player->lives > 0) + if (racecountdown == 1 && !player->spectator && !player->exiting && !(player->pflags & PF_GAMETYPEOVER) && player->lives > 0) { P_DoTimeOver(player); @@ -4767,12 +4663,8 @@ void P_PlayerThink(player_t *player) else if (player->onconveyor == 3) player->cmomy = player->cmomx = 0; - //P_DoSuperStuff(player); - //P_CheckSneakerAndLivesTimer(player); P_DoBubbleBreath(player); // Spawn Sonic's bubbles - //P_CheckUnderwaterAndSpaceTimer(player); // Display the countdown drown numbers! P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles - P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head #if 1 // "Blur" a bit when you have speed shoes and are going fast enough @@ -4852,7 +4744,7 @@ void P_PlayerThink(player_t *player) player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. || player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either. || (player->respawn.state != RESPAWNST_NONE) // Respawn timer (for drop dash effect) - || (player->pflags & PF_TIMEOVER) // NO CONTEST explosion + || (player->pflags & PF_GAMETYPEOVER) // NO CONTEST explosion || ((gametyperules & GTR_BUMPERS) && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || leveltime < starttime)) // Level intro { diff --git a/src/y_inter.c b/src/y_inter.c index 93efea725..915fe7d96 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -172,7 +172,7 @@ static void Y_UnloadVoteData(void); // static void Y_CompareTime(INT32 i) { - UINT32 val = ((players[i].pflags & PF_TIMEOVER || players[i].realtime == UINT32_MAX) + UINT32 val = ((players[i].pflags & PF_GAMETYPEOVER || players[i].realtime == UINT32_MAX) ? (UINT32_MAX-1) : players[i].realtime); if (!(val < data.match.val[data.match.numplayers])) @@ -184,11 +184,11 @@ static void Y_CompareTime(INT32 i) static void Y_CompareScore(INT32 i) { - UINT32 val = ((players[i].pflags & PF_TIMEOVER) + UINT32 val = ((players[i].pflags & PF_GAMETYPEOVER) ? (UINT32_MAX-1) : players[i].marescore); if (!(data.match.val[data.match.numplayers] == UINT32_MAX - || (!(players[i].pflags & PF_TIMEOVER) && val > data.match.val[data.match.numplayers]))) + || (!(players[i].pflags & PF_GAMETYPEOVER) && val > data.match.val[data.match.numplayers]))) return; data.match.val[data.match.numplayers] = val; @@ -317,7 +317,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) if ((powertype == PWRLV_DISABLED) && (!rankingsmode) - && !(players[i].pflags & PF_TIMEOVER) + && !(players[i].pflags & PF_GAMETYPEOVER) && (data.match.pos[data.match.numplayers] < (numplayersingame + numgriefers))) { // Online rank is handled further below in this file. @@ -916,107 +916,6 @@ void Y_Ticker(void) } } -// -// Y_UpdateRecordReplays -// -// Update replay files/data, etc. for Record Attack -// See G_SetNightsRecords for NiGHTS Attack. -// -static void Y_UpdateRecordReplays(void) -{ - const size_t glen = strlen(srb2home)+1+strlen("media")+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; - char *gpath; - char lastdemo[256], bestdemo[256]; - UINT8 earnedEmblems; - - // Record new best time - if (!mainrecords[gamemap-1]) - G_AllocMainRecordData(gamemap-1); - - if (players[consoleplayer].pflags & PF_TIMEOVER) - { - players[consoleplayer].realtime = UINT32_MAX; - } - - if (((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) - && (players[consoleplayer].realtime < UINT32_MAX)) // DNF - { - mainrecords[gamemap-1]->time = players[consoleplayer].realtime; - } - - if (modeattacking == ATTACKING_RECORD) - { - if ((mainrecords[gamemap-1]->lap == 0) || (bestlap < mainrecords[gamemap-1]->lap)) - mainrecords[gamemap-1]->lap = bestlap; - } - else - { - mainrecords[gamemap-1]->lap = 0; - } - - // Save demo! - bestdemo[255] = '\0'; - lastdemo[255] = '\0'; - G_SetDemoTime(players[consoleplayer].realtime, bestlap); - G_CheckDemoStatus(); - - gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s", - srb2home, timeattackfolder); - M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755); - - if ((gpath = malloc(glen)) == NULL) - I_Error("Out of memory for replay filepath\n"); - - sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); - snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, cv_chooseskin.string); - - if (FIL_FileExists(lastdemo)) - { - UINT8 *buf; - size_t len = FIL_ReadFile(lastdemo, &buf); - - snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, cv_chooseskin.string); - if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1) - { // Better time, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); - } - - if (modeattacking == ATTACKING_RECORD) - { - snprintf(bestdemo, 255, "%s-%s-lap-best.lmp", gpath, cv_chooseskin.string); - if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)) - { // Better lap time, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD LAP!"), M_GetText("Saved replay as"), bestdemo); - } - } - - //CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo); - - Z_Free(buf); - } - free(gpath); - - // Check emblems when level data is updated - if ((earnedEmblems = M_CheckLevelEmblems())) - CONS_Printf(M_GetText("\x82" "Earned %hu medal%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : ""); - - if (M_UpdateUnlockablesAndExtraEmblems()) - S_StartSound(NULL, sfx_ncitem); - - // SRB2Kart - save here so you NEVER lose your earned times/medals. - G_SaveGameData(); - - // Update timeattack menu's replay availability. - CV_AddValue(&cv_nextmap, 1); - CV_AddValue(&cv_nextmap, -1); -} - static void K_UpdatePowerLevels(void) { INT32 i, j; @@ -1618,7 +1517,7 @@ void Y_VoteDrawer(void) hilicol = cons_menuhighlight.value; else if (gametype == GT_RACE) hilicol = V_SKYMAP; - else //if (gametype == GT_MATCH) + else //if (gametype == GT_BATTLE) hilicol = V_REDMAP; V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol, va("Vote ends in %d", tickdown));