diff --git a/src/g_game.c b/src/g_game.c index 68edfed35..c7e13a7fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3041,12 +3041,6 @@ void G_DoReborn(INT32 playernum) player_t *player = &players[playernum]; boolean starpost = false; - /*if (modeattacking) // Not needed for SRB2Kart. - { - M_EndModeAttackRun(); - return; - }*/ - // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); @@ -3060,74 +3054,13 @@ void G_DoReborn(INT32 playernum) oldmo = player->mo; // Don't leave your carcass stuck 10-billion feet in the ground! P_RemoveMobj(player->mo); + P_SetTarget(&player->mo, NULL); } B_RespawnBot(playernum); if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); } - /*else if (countdowntimeup || (!multiplayer && !modeattacking)) - { - // reload the level from scratch - if (countdowntimeup) - { - player->starpostangle = 0; - player->starposttime = 0; - player->starpostx = 0; - player->starposty = 0; - player->starpostz = 0; - player->starpostnum = 0; - } - if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD)) - { - INT32 i; - - player->playerstate = PST_REBORN; - - P_LoadThingsOnly(); - - // Do a wipe - wipegamestate = -1; - - if (player->starpostnum) // SRB2kart - starpost = true; - - for (i = 0; i <= splitscreen; i++) - { - if (camera[i].chase) - P_ResetCamera(&players[displayplayers[i]], &camera[i]); - } - - // clear cmd building stuff - 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; - } - mousex = mousey = 0; - mouse2x = mouse2y = 0; - - // clear hud messages remains (usually from game startup) - CON_ClearHUD(); - - // Starpost support - G_SpawnPlayer(playernum, starpost); - - if (botingame) - { // Bots respawn next to their master. - players[displayplayers[1]].playerstate = PST_REBORN; - G_SpawnPlayer(displayplayers[1], false); - } - } - else - { - LUAh_MapChange(gamemap); - G_DoLoadLevel(true); - } - }*/ else { // respawn at the start @@ -3144,6 +3077,7 @@ void G_DoReborn(INT32 playernum) oldmo = player->mo; // Don't leave your carcass stuck 10-billion feet in the ground! P_RemoveMobj(player->mo); + P_SetTarget(&player->mo, NULL); } G_SpawnPlayer(playernum, starpost); diff --git a/src/p_mobj.c b/src/p_mobj.c index caf2a820e..df2c24db7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10557,7 +10557,9 @@ void P_SpawnPlayer(INT32 playernum) mobj = P_SpawnMobj(0, 0, 0, MT_PLAYER); I_Assert(mobj != NULL); - (mobj->player = p)->mo = mobj; + + mobj->player = p; + P_SetTarget(&p->mo, mobj); mobj->angle = 0; diff --git a/src/p_user.c b/src/p_user.c index 78c43c6fe..8c61b8736 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4022,7 +4022,7 @@ boolean P_SpectatorJoinGame(player_t *player) if (player->mo) { P_RemoveMobj(player->mo); - player->mo = NULL; + P_SetTarget(&player->mo, NULL); } player->spectator = false; player->pflags &= ~PF_WANTSTOJOIN;