From c96bd5f64ad7890c5866885aa4f3c34a7b15bbaa Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 10 Aug 2020 21:45:51 -0400 Subject: [PATCH] Many removals Lots of NiGHTS code, lots of ringslinger code, revert actnum behavior back to vanilla --- src/d_clisrv.c | 79 +-- src/d_clisrv.h | 5 - src/d_netcmd.c | 8 +- src/d_player.h | 24 - src/dehacked.c | 11 - src/g_game.c | 16 +- src/hu_stuff.c | 10 - src/lua_maplib.c | 2 +- src/lua_playerlib.c | 32 - src/m_cheat.c | 11 +- src/m_menu.c | 12 +- src/m_misc.c | 3 +- src/p_enemy.c | 27 +- src/p_inter.c | 3 - src/p_map.c | 5 - src/p_mobj.c | 1421 +------------------------------------------ src/p_saveg.c | 18 - src/p_setup.c | 3 - src/p_spec.c | 106 +--- src/p_tick.c | 138 +---- src/p_user.c | 55 +- src/r_main.c | 15 +- src/y_inter.c | 16 +- 23 files changed, 108 insertions(+), 1912 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 76a50b8cf..ef372d9a0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -586,12 +586,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->oldrelangleturn = (INT16)SHORT(players[i].oldrelangleturn); rsp->aiming = (angle_t)LONG(players[i].aiming); - rsp->currentweapon = LONG(players[i].currentweapon); - rsp->ringweapons = LONG(players[i].ringweapons); - - rsp->ammoremoval = (UINT16)SHORT(players[i].ammoremoval); - rsp->ammoremovaltimer = (tic_t)LONG(players[i].ammoremovaltimer); - rsp->ammoremovalweapon = LONG(players[i].ammoremovalweapon); for (j = 0; j < NUMPOWERS; ++j) rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]); @@ -602,12 +596,10 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) // Score is resynched in the rspfirm resync packet rsp->rings = SHORT(players[i].rings); - rsp->spheres = SHORT(players[i].spheres); rsp->lives = players[i].lives; rsp->continues = players[i].continues; rsp->scoreadd = players[i].scoreadd; rsp->xtralife = players[i].xtralife; - rsp->pity = players[i].pity; rsp->skincolor = players[i].skincolor; rsp->skin = LONG(players[i].skin); @@ -730,12 +722,6 @@ static void resynch_read_player(resynch_pak *rsp) players[i].oldrelangleturn = (INT16)SHORT(rsp->oldrelangleturn); players[i].aiming = (angle_t)LONG(rsp->aiming); - players[i].currentweapon = LONG(rsp->currentweapon); - players[i].ringweapons = LONG(rsp->ringweapons); - - players[i].ammoremoval = (UINT16)SHORT(rsp->ammoremoval); - players[i].ammoremovaltimer = (tic_t)LONG(rsp->ammoremovaltimer); - players[i].ammoremovalweapon = LONG(rsp->ammoremovalweapon); for (j = 0; j < NUMPOWERS; ++j) players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]); @@ -746,12 +732,10 @@ static void resynch_read_player(resynch_pak *rsp) // Score is resynched in the rspfirm resync packet players[i].rings = SHORT(rsp->rings); - players[i].spheres = SHORT(rsp->spheres); players[i].lives = rsp->lives; players[i].continues = rsp->continues; players[i].scoreadd = rsp->scoreadd; players[i].xtralife = rsp->xtralife; - players[i].pity = rsp->pity; players[i].skincolor = rsp->skincolor; players[i].skin = LONG(rsp->skin); @@ -876,16 +860,8 @@ static void resynch_read_player(resynch_pak *rsp) players[i].mo->scalespeed = (fixed_t)LONG(rsp->scalespeed); // And finally, SET THE MOBJ SKIN damn it. - if ((players[i].powers[pw_carry] == CR_NIGHTSMODE) && (skins[players[i].skin].sprites[SPR2_NFLY].numframes == 0)) - { - players[i].mo->skin = &skins[DEFAULTNIGHTSSKIN]; - players[i].mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor; // this will be corrected by thinker to super flash - } - else - { - players[i].mo->skin = &skins[players[i].skin]; - players[i].mo->color = players[i].skincolor; // this will be corrected by thinker to super flash/mario star - } + players[i].mo->skin = &skins[players[i].skin]; + players[i].mo->color = players[i].skincolor; // this will be corrected by thinker to super flash/mario star P_SetThingPosition(players[i].mo); } @@ -999,7 +975,6 @@ static inline void resynch_write_others(resynchend_pak *rst) UINT8 i; rst->ingame = 0; - rst->outofcoop = 0; for (i = 0; i < MAXPLAYERS; ++i) { @@ -1015,8 +990,6 @@ static inline void resynch_write_others(resynchend_pak *rst) if (!players[i].spectator) rst->ingame |= (1<outofcoop |= (1<ctfteam[i] = (INT32)LONG(players[i].ctfteam); rst->score[i] = (UINT32)LONG(players[i].score); rst->marescore[i] = (UINT32)LONG(players[i].marescore); @@ -1032,13 +1005,11 @@ static inline void resynch_read_others(resynchend_pak *p) { UINT8 i; UINT32 loc_ingame = (UINT32)LONG(p->ingame); - UINT32 loc_outofcoop = (UINT32)LONG(p->outofcoop); for (i = 0; i < MAXPLAYERS; ++i) { // We don't care if they're in the game or not, just write all the data. players[i].spectator = !(loc_ingame & (1<ctfteam[i]); // no, 0 does not mean spectator, at least not in Match players[i].score = (UINT32)LONG(p->score[i]); players[i].marescore = (UINT32)LONG(p->marescore[i]); @@ -1490,47 +1461,31 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) // set up the levelstring if (netbuffer->u.serverinfo.iszone || (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) { - if (mapheaderinfo[gamemap-1]->actnum[0]) - snprintf(netbuffer->u.serverinfo.maptitle, - sizeof netbuffer->u.serverinfo.maptitle, - "%s %s", - mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum); - else - snprintf(netbuffer->u.serverinfo.maptitle, - sizeof netbuffer->u.serverinfo.maptitle, - "%s", - mapheaderinfo[gamemap-1]->lvlttl); + if (snprintf(netbuffer->u.serverinfo.maptitle, + sizeof netbuffer->u.serverinfo.maptitle, + "%s", + mapheaderinfo[gamemap-1]->lvlttl) < 0); + { + // If there's an encoding error, send UNKNOWN, we accept that the above may be truncated + strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", sizeof netbuffer->u.serverinfo.maptitle); + } } else { - if (mapheaderinfo[gamemap-1]->actnum[0]) + if (snprintf(netbuffer->u.serverinfo.maptitle, + sizeof netbuffer->u.serverinfo.maptitle, + "%s %s", + mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl) < 0) { - if (snprintf(netbuffer->u.serverinfo.maptitle, - sizeof netbuffer->u.serverinfo.maptitle, - "%s %s %s", - mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum) < 0) - { - // If there's an encoding error, send UNKNOWN, we accept that the above may be truncated - strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", sizeof netbuffer->u.serverinfo.maptitle); - } - } - else - { - if (snprintf(netbuffer->u.serverinfo.maptitle, - sizeof netbuffer->u.serverinfo.maptitle, - "%s %s", - mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl) < 0) - { - // If there's an encoding error, send UNKNOWN, we accept that the above may be truncated - strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", sizeof netbuffer->u.serverinfo.maptitle); - } + // If there's an encoding error, send UNKNOWN, we accept that the above may be truncated + strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", sizeof netbuffer->u.serverinfo.maptitle); } } } else strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", sizeof netbuffer->u.serverinfo.maptitle); - netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum + netbuffer->u.serverinfo.actnum = mapheaderinfo[gamemap-1]->actnum; memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index a20f77b17..eb85568a0 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -188,7 +188,6 @@ typedef struct fixed_t flagz[2]; UINT32 ingame; // Spectator bit for each player - UINT32 outofcoop; // outofcoop bit for each player INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams) // Resynch game scores and the like all at once @@ -213,8 +212,6 @@ typedef struct INT16 oldrelangleturn; angle_t aiming; - INT32 currentweapon; - INT32 ringweapons; UINT16 powers[NUMPOWERS]; INT32 kartstuff[NUMKARTSTUFF]; // SRB2kart @@ -222,12 +219,10 @@ typedef struct // Score is resynched in the confirm resync packet INT16 rings; - INT16 spheres; SINT8 lives; SINT8 continues; UINT8 scoreadd; SINT8 xtralife; - SINT8 pity; UINT16 skincolor; INT32 skin; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7a74a6124..f1ba30d79 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5531,15 +5531,15 @@ static void Command_Showmap_f(void) { if (mapheaderinfo[gamemap-1]->zonttl[0] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) { - if (mapheaderinfo[gamemap-1]->actnum[0]) - CONS_Printf("%s (%d): %s %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum); + if (mapheaderinfo[gamemap-1]->actnum > 0) + CONS_Printf("%s (%d): %s %s %d\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum); else CONS_Printf("%s (%d): %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl); } else { - if (mapheaderinfo[gamemap-1]->actnum[0]) - CONS_Printf("%s (%d): %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum); + if (mapheaderinfo[gamemap-1]->actnum > 0) + CONS_Printf("%s (%d): %s %d\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum); else CONS_Printf("%s (%d): %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl); } diff --git a/src/d_player.h b/src/d_player.h index 6b392bec9..b649b933a 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -182,23 +182,8 @@ typedef enum typedef enum { CR_NONE = 0, - // The generic case is suitable for most objects. - CR_GENERIC, - // Tails carry. - CR_PLAYER, - // NiGHTS mode. Not technically a CARRYING, but doesn't stack with any of the others, so might as well go here. - CR_NIGHTSMODE, - CR_NIGHTSFALL, - // Old Brak sucks hard, but this gimmick could be used for something better, so we might as well continue supporting it. - CR_BRAKGOOP, // Specific level gimmicks. CR_ZOOMTUBE, - CR_ROPEHANG, - CR_MACESPIN, - CR_MINECART, - CR_ROLLOUT, - CR_PTERABYTE, - CR_DUSTDEVIL } carrytype_t; // pw_carry // Player powers. (don't edit this comment) @@ -517,15 +502,6 @@ typedef struct player_s // player's ring count INT16 rings; - INT16 spheres; - - SINT8 pity; // i pity the fool. - INT32 currentweapon; // current weapon selected. - INT32 ringweapons; // weapons currently obtained. - - UINT16 ammoremoval; // amount of ammo removed for the current weapon. - tic_t ammoremovaltimer; // flashing counter for ammo used. - INT32 ammoremovalweapon; // weapon from which the ammo was removed. // Power ups. invinc and invis are tic counters. UINT16 powers[NUMPOWERS]; diff --git a/src/dehacked.c b/src/dehacked.c index 4cf3c3bbc..e2bb92e10 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -11216,18 +11216,7 @@ struct { // Carrying {"CR_NONE",CR_NONE}, - {"CR_GENERIC",CR_GENERIC}, - {"CR_PLAYER",CR_PLAYER}, - {"CR_NIGHTSMODE",CR_NIGHTSMODE}, - {"CR_NIGHTSFALL",CR_NIGHTSFALL}, - {"CR_BRAKGOOP",CR_BRAKGOOP}, {"CR_ZOOMTUBE",CR_ZOOMTUBE}, - {"CR_ROPEHANG",CR_ROPEHANG}, - {"CR_MACESPIN",CR_MACESPIN}, - {"CR_MINECART",CR_MINECART}, - {"CR_ROLLOUT",CR_ROLLOUT}, - {"CR_PTERABYTE",CR_PTERABYTE}, - {"CR_DUSTDEVIL",CR_DUSTDEVIL}, // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon diff --git a/src/g_game.c b/src/g_game.c index 829774baf..417cdab67 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2152,9 +2152,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) boolean bot; UINT8 botdifficulty; - SINT8 pity; INT16 rings; - INT16 spheres; INT16 playerangleturn; INT16 oldrelangleturn; @@ -2227,7 +2225,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) mare = players[player].mare; bot = players[player].bot; botdifficulty = players[player].botvars.difficulty; - pity = players[player].pity; // SRB2kart if (betweenmaps || leveltime < starttime) @@ -2283,7 +2280,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->quittime = quittime; p->splitscreenindex = splitscreenindex; p->spectator = spectator; - p->outofcoop = outofcoop; p->angleturn = playerangleturn; p->oldrelangleturn = oldrelangleturn; @@ -2316,9 +2312,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->mare = mare; p->bot = bot; p->botvars.difficulty = botdifficulty; - p->pity = pity; p->rings = rings; - p->spheres = spheres; // SRB2kart p->kartstuff[k_itemroulette] = itemroulette; @@ -4784,17 +4778,15 @@ char *G_BuildMapTitle(INT32 mapnum) zonetext = M_GetText("Zone"); len += strlen(zonetext) + 1; // ' ' + zonetext } - if (strlen(mapheaderinfo[mapnum-1]->actnum) > 0) - { - actnum = M_GetText(mapheaderinfo[mapnum-1]->actnum); - len += strlen(actnum) + 1; // ' ' + actnum - } + + if (actnum > 0) + len += 1 + 11; // ' ' + INT32 title = Z_Malloc(len, PU_STATIC, NULL); sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl); if (zonetext) sprintf(title + strlen(title), " %s", zonetext); - if (actnum) sprintf(title + strlen(title), " %s", actnum); + if (actnum) sprintf(title + strlen(title), " %d", actnum); } return title; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4d2addbf5..7045b2f0e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2194,16 +2194,6 @@ void HU_Drawer(void) INT32 strength = ((pausedelay - 1 - NEWTICRATE/2)*10)/(NEWTICRATE/3); INT32 y = hudinfo[HUD_LIVES].y - 13; - if (players[consoleplayer].powers[pw_carry] == CR_NIGHTSMODE) - y -= 16; - else - { - if (players[consoleplayer].pflags & PF_AUTOBRAKE) - y -= 8; - if (players[consoleplayer].pflags & PF_ANALOGMODE) - y -= 8; - } - V_DrawThinString(hudinfo[HUD_LIVES].x-2, y, hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_SKYMAP : V_BLUEMAP), "HOLD TO RETRY..."); diff --git a/src/lua_maplib.c b/src/lua_maplib.c index cf1f6af07..352845dba 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2070,7 +2070,7 @@ static int mapheaderinfo_get(lua_State *L) else if (fastcmp(field,"zonttl")) lua_pushstring(L, header->zonttl); else if (fastcmp(field,"actnum")) - lua_pushstring(L, header->actnum); + lua_pushinteger(L, header->actnum); else if (fastcmp(field,"typeoflevel")) lua_pushinteger(L, header->typeoflevel); else if (fastcmp(field,"nextlevel")) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index b7ba8ea75..2123df8ba 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -211,20 +211,6 @@ static int player_get(lua_State *L) lua_pushangle(L, plr->drawangle); else if (fastcmp(field,"rings")) lua_pushinteger(L, plr->rings); - else if (fastcmp(field,"spheres")) - lua_pushinteger(L, plr->spheres); - else if (fastcmp(field,"pity")) - lua_pushinteger(L, plr->pity); - else if (fastcmp(field,"currentweapon")) - lua_pushinteger(L, plr->currentweapon); - else if (fastcmp(field,"ringweapons")) - lua_pushinteger(L, plr->ringweapons); - else if (fastcmp(field,"ammoremoval")) - lua_pushinteger(L, plr->ammoremoval); - else if (fastcmp(field,"ammoremovaltimer")) - lua_pushinteger(L, plr->ammoremovaltimer); - else if (fastcmp(field,"ammoremovalweapon")) - lua_pushinteger(L, plr->ammoremovalweapon); else if (fastcmp(field,"powers")) LUA_PushUserdata(L, plr->powers, META_POWERS); else if (fastcmp(field,"kartstuff")) @@ -421,8 +407,6 @@ static int player_get(lua_State *L) lua_pushangle(L, plr->awayviewaiming); else if (fastcmp(field,"spectator")) lua_pushboolean(L, plr->spectator); - else if (fastcmp(field,"outofcoop")) - lua_pushboolean(L, plr->outofcoop); else if (fastcmp(field,"bot")) lua_pushboolean(L, plr->bot); else if (fastcmp(field,"jointime")) @@ -502,20 +486,6 @@ static int player_set(lua_State *L) plr->drawangle = luaL_checkangle(L, 3); else if (fastcmp(field,"rings")) plr->rings = (INT32)luaL_checkinteger(L, 3); - else if (fastcmp(field,"spheres")) - plr->spheres = (INT32)luaL_checkinteger(L, 3); - else if (fastcmp(field,"pity")) - plr->pity = (SINT8)luaL_checkinteger(L, 3); - else if (fastcmp(field,"currentweapon")) - plr->currentweapon = (INT32)luaL_checkinteger(L, 3); - else if (fastcmp(field,"ringweapons")) - plr->ringweapons = (INT32)luaL_checkinteger(L, 3); - else if (fastcmp(field,"ammoremoval")) - plr->ammoremoval = (UINT16)luaL_checkinteger(L, 3); - else if (fastcmp(field,"ammoremovaltimer")) - plr->ammoremovaltimer = (tic_t)luaL_checkinteger(L, 3); - else if (fastcmp(field,"ammoremovalweapon")) - plr->ammoremovalweapon = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"powers")) return NOSET; else if (fastcmp(field,"pflags")) @@ -751,8 +721,6 @@ static int player_set(lua_State *L) plr->awayviewaiming = luaL_checkangle(L, 3); else if (fastcmp(field,"spectator")) plr->spectator = lua_toboolean(L, 3); - else if (fastcmp(field,"outofcoop")) - plr->outofcoop = lua_toboolean(L, 3); else if (fastcmp(field,"bot")) return NOSET; else if (fastcmp(field,"jointime")) diff --git a/src/m_cheat.c b/src/m_cheat.c index 253cf8508..999e12089 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1147,9 +1147,6 @@ boolean OP_FreezeObjectplace(void) if (!objectplacing) return false; - if ((maptol & TOL_NIGHTS) && (players[consoleplayer].powers[pw_carry] == CR_NIGHTSMODE)) - return false; - return true; } @@ -1476,9 +1473,6 @@ void Command_ObjectPlace_f(void) { objectplacing = true; - if (players[0].powers[pw_carry] == CR_NIGHTSMODE) - return; - if (!COM_CheckParm("-silent")) { HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE|V_AUTOFADEOUT); @@ -1545,9 +1539,8 @@ void Command_ObjectPlace_f(void) { objectplacing = false; - // Don't touch the NiGHTS Objectplace stuff. - // ... or if the mo mysteriously vanished. - if (!players[0].mo || (players[0].powers[pw_carry] == CR_NIGHTSMODE)) + // Don't touch if the mo mysteriously vanished. + if (!players[0].mo) return; // If still in dummy state, get out of it. diff --git a/src/m_menu.c b/src/m_menu.c index c11be2527..5ff538570 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3917,15 +3917,15 @@ static void M_DrawPauseMenu(void) if (strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) { - if (strlen(mapheaderinfo[gamemap-1]->actnum) > 0) - V_DrawString(40, 28, highlightflags, va("%s %s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum)); + if (mapheaderinfo[gamemap-1]->actnum > 0) + V_DrawString(40, 28, highlightflags, va("%s %s %d", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum)); else V_DrawString(40, 28, highlightflags, va("%s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl)); } else { - if (strlen(mapheaderinfo[gamemap-1]->actnum) > 0) - V_DrawString(40, 28, highlightflags, va("%s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum)); + if (mapheaderinfo[gamemap-1]->actnum > 0) + V_DrawString(40, 28, highlightflags, va("%s %d", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum)); else V_DrawString(40, 28, highlightflags, mapheaderinfo[gamemap-1]->lvlttl); } @@ -7445,11 +7445,11 @@ static void M_DrawStatsMaps(int location) M_DrawMapEmblems(mnum+1, 295, y); if (mapheaderinfo[mnum]->levelflags & LF_NOZONE) - V_DrawString(20, y, 0, va("%s %s", + V_DrawString(20, y, 0, va("%s %d", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->actnum)); else - V_DrawString(20, y, 0, va("%s %s %s", + V_DrawString(20, y, 0, va("%s %s %d", mapheaderinfo[mnum]->lvlttl, (mapheaderinfo[mnum]->zonttl[0] ? mapheaderinfo[mnum]->zonttl : "ZONE"), mapheaderinfo[mnum]->actnum)); diff --git a/src/m_misc.c b/src/m_misc.c index 2e7f3e894..162688b15 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -824,7 +824,8 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0') snprintf(lvlttltext, 48, "%s%s%s", mapheaderinfo[gamemap-1]->lvlttl, - (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " Zone", + (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : + (mapheaderinfo[gamemap-1]->zonttl[0] != '\0') ? va(" %s",mapheaderinfo[gamemap-1]->zonttl) : " Zone", (mapheaderinfo[gamemap-1]->actnum > 0) ? va(" %d",mapheaderinfo[gamemap-1]->actnum) : ""); else snprintf(lvlttltext, 48, "Unknown"); diff --git a/src/p_enemy.c b/src/p_enemy.c index 49366f94c..11f6a7386 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -6643,8 +6643,7 @@ void A_MixUp(mobj_t *actor) // Count the number of players in the game // and grab their xyz coords for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE - && !players[i].exiting && !players[i].powers[pw_super] && players[i].powers[pw_carry] != CR_NIGHTSMODE) + if (playeringame[i] && players[i].mo && players[i].mo->health > 0 && players[i].playerstate == PST_LIVE && !players[i].exiting) { if ((netgame || multiplayer) && players[i].spectator) // Ignore spectators continue; @@ -6774,7 +6773,7 @@ void A_MixUp(mobj_t *actor) for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && players[i].playerstate == PST_LIVE - && players[i].mo && players[i].mo->health > 0 && !players[i].exiting && !players[i].powers[pw_super] && players[i].powers[pw_carry] != CR_NIGHTSMODE) + && players[i].mo && players[i].mo->health > 0 && !players[i].exiting) { if ((netgame || multiplayer) && players[i].spectator)// Ignore spectators continue; @@ -6826,7 +6825,7 @@ void A_MixUp(mobj_t *actor) for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && players[i].playerstate == PST_LIVE - && players[i].mo && players[i].mo->health > 0 && !players[i].exiting && !players[i].powers[pw_super] && players[i].powers[pw_carry] != CR_NIGHTSMODE) + && players[i].mo && players[i].mo->health > 0 && !players[i].exiting) { if ((netgame || multiplayer) && players[i].spectator)// Ignore spectators continue; @@ -6858,7 +6857,7 @@ void A_MixUp(mobj_t *actor) if (teleported[i]) { if (playeringame[i] && players[i].playerstate == PST_LIVE - && players[i].mo && players[i].mo->health > 0 && !players[i].exiting && !players[i].powers[pw_super] && players[i].powers[pw_carry] != CR_NIGHTSMODE) + && players[i].mo && players[i].mo->health > 0 && !players[i].exiting) { if ((netgame || multiplayer) && players[i].spectator)// Ignore spectators continue; @@ -10729,6 +10728,8 @@ void A_OrbitNights(mobj_t* actor) boolean donotrescale = (var2 & 0x40000); INT32 xfactor = 32, yfactor = 32, zfactor = 20; + (void)ishelper; + if (LUA_CallAction("A_OrbitNights", actor)) return; @@ -10745,12 +10746,7 @@ void A_OrbitNights(mobj_t* actor) zfactor = (var2 & 0xFC000000) >> 26; } - if (!actor->target - || (actor->target->player && - // if NiGHTS special stage and not NiGHTSmode. - (((maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap) && !(actor->target->player->powers[pw_carry] == CR_NIGHTSMODE)) - // Also remove this object if they no longer have a NiGHTS helper - || (ishelper && !actor->target->player->powers[pw_nights_helper])))) + if (!actor->target) { if (cv_debug && !(actor->target && actor->target->player)) CONS_Printf("ERROR: Powerup has no target!\n"); @@ -10777,15 +10773,6 @@ void A_OrbitNights(mobj_t* actor) } P_SetThingPosition(actor); - if (ishelper && actor->target->player) // Flash a helper that's about to be removed. - { - if ((actor->target->player->powers[pw_nights_helper] < TICRATE) - && (actor->target->player->powers[pw_nights_helper] & 1)) - actor->flags2 |= MF2_DONTDRAW; - else - actor->flags2 &= ~MF2_DONTDRAW; - } - if (!donotrescale && actor->destscale != actor->target->destscale) actor->destscale = actor->target->destscale; } diff --git a/src/p_inter.c b/src/p_inter.c index 0940648aa..deb8eadfd 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1965,9 +1965,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->pflags & PF_GODMODE) return false; - - if ((maptol & TOL_NIGHTS) && target->player->powers[pw_carry] != CR_NIGHTSMODE && target->player->powers[pw_carry] != CR_NIGHTSFALL) - return false; } // Player hits another player diff --git a/src/p_map.c b/src/p_map.c index 2f7b06d33..ef86bc75f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -576,11 +576,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if ((thing->flags & MF_NOCLIPTHING) || !(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE|MF_SPRING))) return true; - // Don't collide with your buddies while NiGHTS-flying. - if (tmthing->player && thing->player && (maptol & TOL_NIGHTS) - && ((tmthing->player->powers[pw_carry] == CR_NIGHTSMODE) || (thing->player->powers[pw_carry] == CR_NIGHTSMODE))) - return true; - blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7091269db..c1180abec 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1017,29 +1017,6 @@ static void P_PlayerFlip(mobj_t *mo) G_GhostAddFlip((INT32) (mo->player - players)); // Flip aiming to match! - - if (mo->player->powers[pw_carry] == CR_NIGHTSMODE) // NiGHTS doesn't use flipcam - ; - else if (mo->player->pflags & PF_FLIPCAM) - { - UINT8 i; - - mo->player->aiming = InvAngle(mo->player->aiming); - - for (i = 0; i <= r_splitscreen; i++) - { - if (mo->player-players == displayplayers[i]) - { - localaiming[i] = mo->player->aiming; - if (camera[i].chase) { - camera[i].aiming = InvAngle(camera[i].aiming); - camera[i].z = mo->z - camera[i].z + mo->z; - if (mo->eflags & MFE_VERTICALFLIP) - camera[i].z += FixedMul(20*FRACUNIT, mo->scale); - } - } - } - } } // @@ -1791,40 +1768,6 @@ void P_XYMovement(mobj_t *mo) // Check the gravity status. P_CheckGravity(mo, false); - if (player && !moved && player->powers[pw_carry] == CR_NIGHTSMODE && mo->target) - { - angle_t fa; - - P_UnsetThingPosition(mo); - player->angle_pos = player->old_angle_pos; - player->speed = FixedMul(player->speed, 4*FRACUNIT/5); - if (player->flyangle >= 0 && player->flyangle < 90) - player->flyangle = 135; - else if (player->flyangle >= 90 && player->flyangle < 180) - player->flyangle = 45; - else if (player->flyangle >= 180 && player->flyangle < 270) - player->flyangle = 315; - else - player->flyangle = 225; - player->flyangle %= 360; - - if (player->pflags & PF_TRANSFERTOCLOSEST) - { - mo->x -= mo->momx; - mo->y -= mo->momy; - } - else - { - fa = player->old_angle_pos>>ANGLETOFINESHIFT; - - mo->x = mo->target->x + FixedMul(FINECOSINE(fa),mo->target->radius); - mo->y = mo->target->y + FixedMul(FINESINE(fa),mo->target->radius); - } - - mo->momx = mo->momy = 0; - P_SetThingPosition(mo); - } - if (mo->flags & MF_NOCLIPHEIGHT) return; // no frictions for objects that can pass through floors @@ -1834,9 +1777,6 @@ void P_XYMovement(mobj_t *mo) if (player && player->homing) // no friction for homing return; - if (player && player->powers[pw_carry] == CR_NIGHTSMODE) - return; // no friction for NiGHTS players - if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED) && (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes return; @@ -2719,21 +2659,6 @@ void P_PlayerZMovement(mobj_t *mo) else mo->z = mo->floorz; - if (mo->player->powers[pw_carry] == CR_NIGHTSMODE) - { - // bounce off floor if you were flying towards it - if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 0 && mo->player->flyangle < 180) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 180 && mo->player->flyangle <= 359)) - { - if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle += P_MobjFlip(mo)*90; - else - mo->player->flyangle -= P_MobjFlip(mo)*90; - mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); - } - goto nightsdone; - } - // Get up if you fell. if (mo->player->panim == PA_PAIN && mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) P_SetPlayerMobjState(mo, S_KART_STILL); @@ -2753,9 +2678,6 @@ void P_PlayerZMovement(mobj_t *mo) clipmomz = P_PlayerHitFloor(mo->player, true); - if (!(mo->player->pflags & PF_SPINNING) && mo->player->powers[pw_carry] != CR_NIGHTSMODE) - mo->player->pflags &= ~PF_STARTDASH; - if (clipmomz) mo->momz = (tmfloorthing ? tmfloorthing->momz : 0); } @@ -2782,8 +2704,6 @@ void P_PlayerZMovement(mobj_t *mo) P_CheckGravity(mo, true); } -nightsdone: - if (((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz)) && !(mo->flags & MF_NOCLIPHEIGHT)) { @@ -2792,21 +2712,6 @@ nightsdone: else mo->z = mo->ceilingz - mo->height; - if (mo->player->powers[pw_carry] == CR_NIGHTSMODE) - { - // bounce off ceiling if you were flying towards it - if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 180 && mo->player->flyangle <= 359) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 0 && mo->player->flyangle < 180)) - { - if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle -= P_MobjFlip(mo)*90; - else - mo->player->flyangle += P_MobjFlip(mo)*90; - mo->player->flyangle %= 360; - mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); - } - } - if (P_MobjFlip(mo)*mo->momz > 0) { if (CheckForMarioBlocks) @@ -3659,17 +3564,6 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } else { -#if 0 // i don't know why this is here, it's causing a few undesired state glitches, and disabling it doesn't appear to negatively affect the game, but i don't want it gone permanently just in case some obscure bug crops up - if (!(mobj->player->powers[pw_carry] == CR_NIGHTSMODE)) // used for drilling - mobj->player->pflags &= ~PF_STARTJUMP; - mobj->player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) - { - mobj->player->secondjump = 0; - mobj->player->powers[pw_tailsfly] = 0; - P_SetPlayerMobjState(mobj, S_KART_SLOW); - } -#endif mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -8680,920 +8574,6 @@ static void P_TracerAngleThink(mobj_t *mobj) mobj->cvmem = mobj->cusval; // reset failure timer } -static void P_ArrowThink(mobj_t *mobj) -{ - if (mobj->flags & MF_MISSILE) - { - // Calculate the angle of movement. - /* - momz - / | - / | - / | - 0------dist(momx,momy) - */ - - fixed_t dist = P_AproxDistance(mobj->momx, mobj->momy); - angle_t angle = R_PointToAngle2(0, 0, dist, mobj->momz); - - if (angle > ANG20 && angle <= ANGLE_180) - mobj->frame = 2; - else if (angle < ANG340 && angle > ANGLE_180) - mobj->frame = 0; - else - mobj->frame = 1; - - if (!(mobj->extravalue1) && (mobj->momz < 0)) - { - mobj->extravalue1 = 1; - S_StartSound(mobj, mobj->info->activesound); - } - if (leveltime & 1) - { - mobj_t *dust = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_PARTICLE); - dust->tics = 18; - dust->scalespeed = 4096; - dust->destscale = FRACUNIT/32; - } - } - else - mobj->flags2 ^= MF2_DONTDRAW; -} - -static void P_BumbleboreThink(mobj_t *mobj) -{ - statenum_t st = mobj->state - states; - if (st == S_BUMBLEBORE_FLY1 || st == S_BUMBLEBORE_FLY2) - { - if (!mobj->target) - P_SetMobjState(mobj, mobj->info->spawnstate); - else if (P_MobjFlip(mobj)*((mobj->z + (mobj->height >> 1)) - (mobj->target->z + (mobj->target->height >> 1))) > 0 - && R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y) <= 32*FRACUNIT) - { - mobj->momx >>= 1; - mobj->momy >>= 1; - if (++mobj->movefactor == 4) - { - S_StartSound(mobj, mobj->info->seesound); - mobj->momx = mobj->momy = mobj->momz = 0; - mobj->flags = (mobj->flags|MF_PAIN) & ~MF_NOGRAVITY; - P_SetMobjState(mobj, mobj->info->meleestate); - } - } - else - mobj->movefactor = 0; - } - else if (st == S_BUMBLEBORE_RAISE || st == S_BUMBLEBORE_FALL2) // no _FALL1 because it's an 0-tic - { - if (P_IsObjectOnGround(mobj)) - { - S_StopSound(mobj); - S_StartSound(mobj, mobj->info->attacksound); - mobj->flags = (mobj->flags | MF_NOGRAVITY) & ~MF_PAIN; - mobj->momx = mobj->momy = mobj->momz = 0; - P_SetMobjState(mobj, mobj->info->painstate); - } - else - { - mobj->angle += ANGLE_22h; - mobj->frame = mobj->state->frame + ((mobj->tics & 2) >> 1); - } - } - else if (st == S_BUMBLEBORE_STUCK2 && mobj->tics < TICRATE) - mobj->frame = mobj->state->frame + ((mobj->tics & 2) >> 1); -} - -static boolean P_HangsterThink(mobj_t *mobj) -{ - statenum_t st = mobj->state - states; - //ghost image trail when flying down - if (st == S_HANGSTER_SWOOP1 || st == S_HANGSTER_SWOOP2) - { - P_SpawnGhostMobj(mobj); - //curve when in line with target, otherwise curve to avoid crashing into floor - if ((mobj->z - mobj->floorz <= 80*FRACUNIT) || (mobj->target && (mobj->z - mobj->target->z <= 80*FRACUNIT))) - P_SetMobjState(mobj, (st = S_HANGSTER_ARC1)); - } - - //swoop arc movement stuff - if (st == S_HANGSTER_ARC1) - { - A_FaceTarget(mobj); - P_Thrust(mobj, mobj->angle, 1*FRACUNIT); - } - else if (st == S_HANGSTER_ARC2) - P_Thrust(mobj, mobj->angle, 2*FRACUNIT); - else if (st == S_HANGSTER_ARC3) - P_Thrust(mobj, mobj->angle, 4*FRACUNIT); - //if movement has stopped while flying (like hitting a wall), fly up immediately - else if (st == S_HANGSTER_FLY1 && !mobj->momx && !mobj->momy) - { - mobj->extravalue1 = 0; - P_SetMobjState(mobj, S_HANGSTER_ARCUP1); - } - //after swooping back up, check for ceiling - else if ((st == S_HANGSTER_RETURN1 || st == S_HANGSTER_RETURN2) && mobj->momz == 0 && mobj->ceilingz == (mobj->z + mobj->height)) - P_SetMobjState(mobj, (st = S_HANGSTER_RETURN3)); - - //should you roost on a ceiling with F_SKY1 as its flat, disappear forever - if (st == S_HANGSTER_RETURN3 && mobj->momz == 0 && mobj->ceilingz == (mobj->z + mobj->height) - && mobj->subsector->sector->ceilingpic == skyflatnum - && mobj->subsector->sector->ceilingheight == mobj->ceilingz) - { - P_RemoveMobj(mobj); - return false; - } - - return true; -} - -static boolean P_JetFume1Think(mobj_t *mobj) -{ - fixed_t jetx, jety; - - if (!mobj->target // if you have no target - || (!(mobj->target->flags & MF_BOSS) && mobj->target->health <= 0)) // or your target isn't a boss and it's popped now - { // then remove yourself as well! - P_RemoveMobj(mobj); - return false; - } - - jetx = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle, FixedMul(-64*FRACUNIT, mobj->target->scale)); - jety = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle, FixedMul(-64*FRACUNIT, mobj->target->scale)); - - if (mobj->fuse == 56) // First one - { - P_UnsetThingPosition(mobj); - mobj->x = jetx; - mobj->y = jety; - if (mobj->target->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->target->z + mobj->target->height - mobj->height - FixedMul(38*FRACUNIT, mobj->target->scale); - else - mobj->z = mobj->target->z + FixedMul(38*FRACUNIT, mobj->target->scale); - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - } - else if (mobj->fuse == 57) - { - P_UnsetThingPosition(mobj); - mobj->x = jetx + P_ReturnThrustX(mobj->target, mobj->target->angle - ANGLE_90, FixedMul(24*FRACUNIT, mobj->target->scale)); - mobj->y = jety + P_ReturnThrustY(mobj->target, mobj->target->angle - ANGLE_90, FixedMul(24*FRACUNIT, mobj->target->scale)); - if (mobj->target->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->target->z + mobj->target->height - mobj->height - FixedMul(12*FRACUNIT, mobj->target->scale); - else - mobj->z = mobj->target->z + FixedMul(12*FRACUNIT, mobj->target->scale); - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - } - else if (mobj->fuse == 58) - { - P_UnsetThingPosition(mobj); - mobj->x = jetx + P_ReturnThrustX(mobj->target, mobj->target->angle + ANGLE_90, FixedMul(24*FRACUNIT, mobj->target->scale)); - mobj->y = jety + P_ReturnThrustY(mobj->target, mobj->target->angle + ANGLE_90, FixedMul(24*FRACUNIT, mobj->target->scale)); - if (mobj->target->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->target->z + mobj->target->height - mobj->height - FixedMul(12*FRACUNIT, mobj->target->scale); - else - mobj->z = mobj->target->z + FixedMul(12*FRACUNIT, mobj->target->scale); - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - } - else if (mobj->fuse == 59) - { - boolean dashmod = ((mobj->target->flags & MF_PAIN) && (mobj->target->health <= mobj->target->info->damage)); - jetx = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle, -mobj->target->radius); - jety = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle, -mobj->target->radius); - P_UnsetThingPosition(mobj); - mobj->x = jetx; - mobj->y = jety; - mobj->destscale = mobj->target->scale; - if (!(dashmod && mobj->target->state == states + S_METALSONIC_BOUNCE)) - { - mobj->destscale = (mobj->destscale + FixedDiv(R_PointToDist2(0, 0, mobj->target->momx, mobj->target->momy), 36*mobj->target->scale))/3; - } - if (mobj->target->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->target->z + mobj->target->height/2 + mobj->height/2; - else - mobj->z = mobj->target->z + mobj->target->height/2 - mobj->height/2; - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - if (dashmod) - { - mobj->color = SKINCOLOR_SUNSET; - if (mobj->target->movecount == 3 && !mobj->target->reactiontime && (mobj->target->movedir == 0 || mobj->target->movedir == 2)) - P_SpawnGhostMobj(mobj); - } - else - mobj->color = SKINCOLOR_ICY; - } - mobj->fuse++; - return true; -} - -static boolean P_EggRobo1Think(mobj_t *mobj) -{ -#define SPECTATORRADIUS (96*mobj->scale) - if (!(mobj->flags2 & MF2_STRONGBOX)) - { - mobj->cusval = mobj->x; // eat my SOCs, p_mobj.h warning, we have lua now - mobj->cvmem = mobj->y; // ditto - mobj->movedir = mobj->angle; - mobj->threshold = P_MobjFlip(mobj)*10*mobj->scale; - if (mobj->threshold < 0) - mobj->threshold += (mobj->ceilingz - mobj->height); - else - mobj->threshold += mobj->floorz; - var1 = 4; - A_BossJetFume(mobj); - mobj->flags2 |= MF2_STRONGBOX; - } - - if (mobj->state == &states[mobj->info->deathstate]) // todo: make map actually set health to 0 for these - { - if (mobj->movecount) - { - if (!(--mobj->movecount)) - S_StartSound(mobj, mobj->info->deathsound); - } - else - { - mobj->momz += P_MobjFlip(mobj)*mobj->scale; - if (mobj->momz > 0) - { - if (mobj->z + mobj->momz > mobj->ceilingz + (1000 << FRACBITS)) - { - P_RemoveMobj(mobj); - return false; - } - } - else if (mobj->z + mobj->height + mobj->momz < mobj->floorz - (1000 << FRACBITS)) - { - P_RemoveMobj(mobj); - return false; - } - } - } - else - { - fixed_t basex = mobj->cusval, basey = mobj->cvmem; - - if (mobj->spawnpoint && mobj->spawnpoint->options & (MTF_AMBUSH|MTF_OBJECTSPECIAL)) - { - angle_t sideang = mobj->movedir + ((mobj->spawnpoint->options & MTF_AMBUSH) ? ANGLE_90 : -ANGLE_90); - fixed_t oscillate = FixedMul(FINESINE(((leveltime * ANG1) >> (ANGLETOFINESHIFT + 2)) & FINEMASK), 250*mobj->scale); - basex += P_ReturnThrustX(mobj, sideang, oscillate); - basey += P_ReturnThrustY(mobj, sideang, oscillate); - } - - mobj->z = mobj->threshold + FixedMul(FINESINE(((leveltime + mobj->movecount)*ANG2 >> (ANGLETOFINESHIFT - 2)) & FINEMASK), 8*mobj->scale); - if (mobj->state != &states[mobj->info->meleestate]) - { - boolean didmove = false; - - if (mobj->state == &states[mobj->info->spawnstate]) - { - UINT8 i; - fixed_t dist = INT32_MAX; - - for (i = 0; i < MAXPLAYERS; i++) - { - fixed_t compdist; - if (!playeringame[i]) - continue; - if (players[i].spectator) - continue; - if (!players[i].mo) - continue; - if (!players[i].mo->health) - continue; - if (P_PlayerInPain(&players[i])) - continue; - if (players[i].mo->z > mobj->z + mobj->height + 8*mobj->scale) - continue; - if (players[i].mo->z + players[i].mo->height < mobj->z - 8*mobj->scale) - continue; - compdist = P_AproxDistance( - players[i].mo->x + players[i].mo->momx - basex, - players[i].mo->y + players[i].mo->momy - basey); - if (compdist >= dist) - continue; - dist = compdist; - P_SetTarget(&mobj->target, players[i].mo); - } - - if (dist < (SPECTATORRADIUS << 1)) - { - didmove = true; - mobj->frame = 3 + ((leveltime & 2) >> 1); - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - - if (P_AproxDistance( - mobj->x - basex, - mobj->y - basey) - < mobj->scale) - S_StartSound(mobj, mobj->info->seesound); - - P_TeleportMove(mobj, - (15*(mobj->x >> 4)) + (basex >> 4) + P_ReturnThrustX(mobj, mobj->angle, SPECTATORRADIUS >> 4), - (15*(mobj->y >> 4)) + (basey >> 4) + P_ReturnThrustY(mobj, mobj->angle, SPECTATORRADIUS >> 4), - mobj->z); - } - else - { - angle_t diff = (mobj->movedir - mobj->angle); - if (diff > ANGLE_180) - diff = InvAngle(InvAngle(diff)/8); - else - diff /= 8; - mobj->angle += diff; - - dist = FINECOSINE(((leveltime + mobj->movecount)*ANG2 >> (ANGLETOFINESHIFT - 2)) & FINEMASK); - - if (abs(dist) < FRACUNIT/2) - mobj->frame = 0; - else - mobj->frame = (dist > 0) ? 1 : 2; - } - } - - if (!didmove) - { - if (P_AproxDistance(mobj->x - basex, mobj->y - basey) < mobj->scale) - P_TeleportMove(mobj, basex, basey, mobj->z); - else - P_TeleportMove(mobj, - (15*(mobj->x >> 4)) + (basex >> 4), - (15*(mobj->y >> 4)) + (basey >> 4), - mobj->z); - } - } - } - return true; -#undef SPECTATORRADIUS -} - -static void P_NiGHTSDroneThink(mobj_t *mobj) -{ - { - // variable setup - mobj_t *goalpost = NULL; - mobj_t *sparkle = NULL; - mobj_t *droneman = NULL; - - boolean flip = mobj->flags2 & MF2_OBJECTFLIP; - boolean topaligned = (mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); - boolean middlealigned = (mobj->flags & MF_GRENADEBOUNCE) && !(mobj->flags & MF_SLIDEME); - boolean bottomoffsetted = !(mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); - boolean flipchanged = false; - - fixed_t dronemanoffset, goaloffset, sparkleoffset, droneboxmandiff, dronemangoaldiff; - - if (mobj->target && mobj->target->type == MT_NIGHTSDRONE_GOAL) - { - goalpost = mobj->target; - if (goalpost->target && goalpost->target->type == MT_NIGHTSDRONE_SPARKLING) - sparkle = goalpost->target; - if (goalpost->tracer && goalpost->tracer->type == MT_NIGHTSDRONE_MAN) - droneman = goalpost->tracer; - } - - if (!goalpost || !sparkle || !droneman) - return; - - // did NIGHTSDRONE position, scale, flip, or flags change? all elements need to be synced - droneboxmandiff = max(mobj->height - droneman->height, 0); - dronemangoaldiff = max(droneman->height - goalpost->height, 0); - - if (!(goalpost->flags2 & MF2_OBJECTFLIP) && (mobj->flags2 & MF2_OBJECTFLIP)) - { - goalpost->eflags |= MFE_VERTICALFLIP; - goalpost->flags2 |= MF2_OBJECTFLIP; - sparkle->eflags |= MFE_VERTICALFLIP; - sparkle->flags2 |= MF2_OBJECTFLIP; - droneman->eflags |= MFE_VERTICALFLIP; - droneman->flags2 |= MF2_OBJECTFLIP; - flipchanged = true; - } - else if ((goalpost->flags2 & MF2_OBJECTFLIP) && !(mobj->flags2 & MF2_OBJECTFLIP)) - { - goalpost->eflags &= ~MFE_VERTICALFLIP; - goalpost->flags2 &= ~MF2_OBJECTFLIP; - sparkle->eflags &= ~MFE_VERTICALFLIP; - sparkle->flags2 &= ~MF2_OBJECTFLIP; - droneman->eflags &= ~MFE_VERTICALFLIP; - droneman->flags2 &= ~MF2_OBJECTFLIP; - flipchanged = true; - } - - if (goalpost->destscale != mobj->destscale - || goalpost->movefactor != mobj->z - || goalpost->friction != mobj->height - || flipchanged - || goalpost->threshold != (INT32)(mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE))) - { - goalpost->destscale = sparkle->destscale = droneman->destscale = mobj->destscale; - - // straight copy-pasta from P_SpawnMapThing, case MT_NIGHTSDRONE - 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 (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); - } - - P_TeleportMove(goalpost, mobj->x, mobj->y, mobj->z + goaloffset); - P_TeleportMove(sparkle, mobj->x, mobj->y, mobj->z + sparkleoffset); - if (goalpost->movefactor != mobj->z || goalpost->friction != mobj->height) - { - P_TeleportMove(droneman, mobj->x, mobj->y, mobj->z + dronemanoffset); - goalpost->movefactor = mobj->z; - goalpost->friction = mobj->height; - } - goalpost->threshold = mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE); - } - else - { - if (goalpost->x != mobj->x || goalpost->y != mobj->y) - { - P_TeleportMove(goalpost, mobj->x, mobj->y, goalpost->z); - P_TeleportMove(sparkle, mobj->x, mobj->y, sparkle->z); - } - - if (droneman->x != mobj->x || droneman->y != mobj->y) - P_TeleportMove(droneman, mobj->x, mobj->y, - droneman->z >= mobj->floorz && droneman->z <= mobj->ceilingz ? droneman->z : mobj->z); - } - - // now toggle states! - // GOAL mode? - if (sparkle->state >= &states[S_NIGHTSDRONE_SPARKLING1] && sparkle->state <= &states[S_NIGHTSDRONE_SPARKLING16]) - { - INT32 i; - boolean bonustime = false; - - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) - { - bonustime = true; - break; - } - - if (!bonustime) - { - CONS_Debug(DBG_NIGHTSBASIC, "Removing goal post\n"); - if (goalpost && goalpost->state != &states[S_INVISIBLE]) - P_SetMobjState(goalpost, S_INVISIBLE); - if (sparkle && sparkle->state != &states[S_INVISIBLE]) - P_SetMobjState(sparkle, S_INVISIBLE); - } - } - // Invisible/bouncing mode. - else - { - INT32 i; - boolean bonustime = false; - fixed_t zcomp; - - // Bouncy bouncy! - if (!flip) - { - if (topaligned) - zcomp = droneboxmandiff + mobj->z; - else if (middlealigned) - zcomp = (droneboxmandiff/2) + mobj->z; - else if (bottomoffsetted) - zcomp = mobj->z + FixedMul(24*FRACUNIT, mobj->scale); - else - zcomp = mobj->z; - } - else - { - if (topaligned) - zcomp = mobj->z; - else if (middlealigned) - zcomp = (droneboxmandiff/2) + mobj->z; - else if (bottomoffsetted) - zcomp = mobj->z + droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); - else - zcomp = mobj->z + droneboxmandiff; - } - - droneman->angle += ANG10; - if (!flip && droneman->z <= zcomp) - droneman->momz = FixedMul(5*FRACUNIT, droneman->scale); - else if (flip && droneman->z >= zcomp) - droneman->momz = FixedMul(-5*FRACUNIT, droneman->scale); - - // state switching logic - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) - { - bonustime = true; - break; - } - - if (bonustime) - { - CONS_Debug(DBG_NIGHTSBASIC, "Adding goal post\n"); - if (!(droneman->flags2 & MF2_DONTDRAW)) - droneman->flags2 |= MF2_DONTDRAW; - if (goalpost->state == &states[S_INVISIBLE]) - P_SetMobjState(goalpost, mobjinfo[goalpost->type].meleestate); - if (sparkle->state == &states[S_INVISIBLE]) - P_SetMobjState(sparkle, mobjinfo[sparkle->type].meleestate); - } - else if (!G_IsSpecialStage(gamemap)) - { - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].powers[pw_carry] != CR_NIGHTSMODE) - { - bonustime = true; // variable reuse - break; - } - - if (bonustime) - { - // show droneman if at least one player is non-nights - if (goalpost->state != &states[S_INVISIBLE]) - P_SetMobjState(goalpost, S_INVISIBLE); - if (sparkle->state != &states[S_INVISIBLE]) - P_SetMobjState(sparkle, S_INVISIBLE); - if (droneman->state != &states[mobjinfo[droneman->type].meleestate]) - P_SetMobjState(droneman, mobjinfo[droneman->type].meleestate); - if (droneman->flags2 & MF2_DONTDRAW) - droneman->flags2 &= ~MF2_DONTDRAW; - } - else - { - // else, hide it - if (!(droneman->flags2 & MF2_DONTDRAW)) - droneman->flags2 |= MF2_DONTDRAW; - } - } - } - } -} - -static boolean P_TurretThink(mobj_t *mobj) -{ - P_MobjCheckWater(mobj); - P_CheckPosition(mobj, mobj->x, mobj->y); - if (P_MobjWasRemoved(mobj)) - return false; - mobj->floorz = tmfloorz; - mobj->ceilingz = tmceilingz; - mobj->floorrover = tmfloorrover; - mobj->ceilingrover = tmceilingrover; - - if ((mobj->eflags & MFE_UNDERWATER) && mobj->health > 0) - { - P_SetMobjState(mobj, mobj->info->deathstate); - mobj->health = 0; - mobj->flags2 &= ~MF2_FIRING; - } - else if (mobj->health > 0 && mobj->z + mobj->height > mobj->ceilingz) // Crushed - { - INT32 i, j; - fixed_t ns; - fixed_t x, y, z; - mobj_t* mo2; - - z = mobj->subsector->sector->floorheight + FixedMul(64*FRACUNIT, mobj->scale); - for (j = 0; j < 2; j++) - { - for (i = 0; i < 32; i++) - { - const angle_t fa = (i*FINEANGLES/16) & FINEMASK; - ns = FixedMul(64*FRACUNIT, mobj->scale); - x = mobj->x + FixedMul(FINESINE(fa), ns); - y = mobj->y + FixedMul(FINECOSINE(fa), ns); - - mo2 = P_SpawnMobj(x, y, z, MT_EXPLODE); - ns = FixedMul(16*FRACUNIT, mobj->scale); - mo2->momx = FixedMul(FINESINE(fa), ns); - mo2->momy = FixedMul(FINECOSINE(fa), ns); - } - z -= FixedMul(32*FRACUNIT, mobj->scale); - } - P_SetMobjState(mobj, mobj->info->deathstate); - mobj->health = 0; - mobj->flags2 &= ~MF2_FIRING; - } - return true; -} - -static void P_SaloonDoorThink(mobj_t *mobj) -{ - fixed_t x = mobj->tracer->x; - fixed_t y = mobj->tracer->y; - fixed_t z = mobj->tracer->z; - angle_t oang = FixedAngle(mobj->extravalue1); - angle_t fa = (oang >> ANGLETOFINESHIFT) & FINEMASK; - fixed_t c0 = -96*FINECOSINE(fa); - fixed_t s0 = -96*FINESINE(fa); - angle_t fma; - fixed_t c, s; - angle_t angdiff; - - // Adjust angular speed - fixed_t da = AngleFixed(mobj->angle - oang); - if (da > 180*FRACUNIT) - da -= 360*FRACUNIT; - mobj->extravalue2 = 8*(mobj->extravalue2 - da/32)/9; - - // Update angle - mobj->angle += FixedAngle(mobj->extravalue2); - - angdiff = mobj->angle - FixedAngle(mobj->extravalue1); - if (angdiff > (ANGLE_90 - ANG2) && angdiff < ANGLE_180) - { - mobj->angle = FixedAngle(mobj->extravalue1) + (ANGLE_90 - ANG2); - mobj->extravalue2 /= 2; - } - else if (angdiff < (ANGLE_270 + ANG2) && angdiff >= ANGLE_180) - { - mobj->angle = FixedAngle(mobj->extravalue1) + (ANGLE_270 + ANG2); - mobj->extravalue2 /= 2; - } - - // Update position - fma = (mobj->angle >> ANGLETOFINESHIFT) & FINEMASK; - c = 48*FINECOSINE(fma); - s = 48*FINESINE(fma); - P_TeleportMove(mobj, x + c0 + c, y + s0 + s, z); -} - -static void P_PyreFlyThink(mobj_t *mobj) -{ - fixed_t hdist; - - mobj->extravalue1 = (mobj->extravalue1 + 3) % 360; - mobj->z += FINESINE(((mobj->extravalue1 * ANG1) >> ANGLETOFINESHIFT) & FINEMASK); - - if (!(mobj->flags2 & MF2_BOSSNOTRAP)) - P_LookForPlayers(mobj, true, false, 1500*FRACUNIT); - - if (!mobj->target) - return; - - if (mobj->extravalue2 == 1) - P_PyreFlyBurn(mobj, 0, 20, MT_SMOKE, 4*FRACUNIT); - else if (mobj->extravalue2 == 2) - { - INT32 fireradius = min(100 - mobj->fuse, 52); - P_PyreFlyBurn(mobj, P_RandomRange(0, fireradius) << FRACBITS, 20, MT_FLAMEPARTICLE, 4*FRACUNIT); - P_PyreFlyBurn(mobj, fireradius*FRACUNIT, 40, MT_PYREFLY_FIRE, 0); - } - - hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - - if (hdist > 1500*FRACUNIT) - { - mobj->flags2 &= ~MF2_BOSSNOTRAP; - P_SetTarget(&mobj->target, NULL); - return; - } - - if (!(mobj->flags2 & MF2_BOSSNOTRAP) && hdist <= 450*FRACUNIT) - mobj->flags2 |= MF2_BOSSNOTRAP; - - if (!(mobj->flags2 & MF2_BOSSNOTRAP)) - return; - - if (hdist < 1000*FRACUNIT) - { - //Aim for player z position. If too close to floor/ceiling, aim just above/below them. - fixed_t destz = min(max(mobj->target->z, mobj->target->floorz + 70*FRACUNIT), mobj->target->ceilingz - 80*FRACUNIT - mobj->height); - fixed_t dist = P_AproxDistance(hdist, destz - mobj->z); - P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT); - mobj->momz = FixedMul(FixedDiv(destz - mobj->z, dist), 2*FRACUNIT); - } - else - { - mobj->momx = 0; - mobj->momy = 0; - mobj->momz = 0; - } -} - -static void P_PterabyteThink(mobj_t *mobj) -{ - if (mobj->extravalue1 & 4) // Cooldown after grabbing - { - if (mobj->movefactor) - mobj->movefactor--; - else - { - P_SetTarget(&mobj->target, NULL); - mobj->extravalue1 &= 3; - } - } - - if ((mobj->extravalue1 & 3) == 0) // Hovering - { - fixed_t vdist, hdist, time; - fixed_t hspeed = 3*mobj->info->speed; - angle_t fa; - - var1 = 1; - var2 = 0; - A_CapeChase(mobj); - - if (mobj->target) - return; // Still carrying a player or in cooldown - - P_LookForPlayers(mobj, true, false, 256*FRACUNIT); - - if (!mobj->target) - return; - - if (mobj->target->player->powers[pw_flashing]) - { - P_SetTarget(&mobj->target, NULL); - return; - } - - vdist = mobj->z - mobj->target->z - mobj->target->height; - if (P_MobjFlip(mobj)*vdist <= 0) - { - P_SetTarget(&mobj->target, NULL); - return; - } - - hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - if (hdist > 450*FRACUNIT) - { - P_SetTarget(&mobj->target, NULL); - return; - } - - P_SetMobjState(mobj, S_PTERABYTE_SWOOPDOWN); - mobj->extravalue1++; - S_StartSound(mobj, mobj->info->attacksound); - time = FixedDiv(hdist, hspeed); - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - fa = (mobj->angle >> ANGLETOFINESHIFT) & FINEMASK; - mobj->momx = FixedMul(FINECOSINE(fa), hspeed); - mobj->momy = FixedMul(FINESINE(fa), hspeed); - mobj->momz = -2*FixedDiv(vdist, time); - mobj->extravalue2 = -FixedDiv(mobj->momz, time); //Z accel - mobj->movecount = time >> FRACBITS; - mobj->reactiontime = mobj->movecount; - } - else if ((mobj->extravalue1 & 3) == 1) // Swooping - { - mobj->reactiontime--; - mobj->momz += mobj->extravalue2; - if (mobj->reactiontime) - return; - - if (mobj->state - states == S_PTERABYTE_SWOOPDOWN) - { - P_SetMobjState(mobj, S_PTERABYTE_SWOOPUP); - mobj->reactiontime = mobj->movecount; - } - else if (mobj->state - states == S_PTERABYTE_SWOOPUP) - { - P_SetMobjState(mobj, S_PTERABYTE_FLY1); - mobj->extravalue1++; - if (mobj->target && mobj->target->tracer != mobj) - P_SetTarget(&mobj->target, NULL); // Failed to grab the target - mobj->momx = mobj->momy = mobj->momz = 0; - } - } - else // Returning - { - var1 = 2*mobj->info->speed; - var2 = 1; - A_HomingChase(mobj); - if (P_AproxDistance(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) - { - mobj->extravalue1 -= 2; - mobj->momx = mobj->momy = mobj->momz = 0; - } - } -} - -static void P_DragonbomberThink(mobj_t *mobj) -{ -#define DRAGONTURNSPEED ANG2 - mobj->movecount = (mobj->movecount + 9) % 360; - P_SetObjectMomZ(mobj, 4*FINESINE(((mobj->movecount*ANG1) >> ANGLETOFINESHIFT) & FINEMASK), false); - if (mobj->threshold > 0) // are we dropping mines? - { - mobj->threshold--; - if (mobj->threshold == 0) // if the timer hits 0, look for a mine to drop! - { - mobj_t *segment = mobj; - while (segment->tracer != NULL && !P_MobjWasRemoved(segment->tracer) && segment->tracer->state == &states[segment->tracer->info->spawnstate]) - segment = segment->tracer; - if (segment != mobj) // found an unactivated segment? - { - mobj_t *mine = P_SpawnMobjFromMobj(segment, 0, 0, 0, segment->info->painchance); - mine->angle = segment->angle; - P_InstaThrust(mine, mobj->angle, P_AproxDistance(mobj->momx, mobj->momy) >> 1); - P_SetObjectMomZ(mine, -2*FRACUNIT, true); - S_StartSound(mine, mine->info->seesound); - P_SetMobjState(segment, segment->info->raisestate); - mobj->threshold = mobj->info->painchance; - } - } - } - if (mobj->target) // Are we chasing a player? - { - fixed_t dist = P_AproxDistance(mobj->x - mobj->target->x, mobj->y - mobj->target->y); - if (dist > 2000*mobj->scale) // Not anymore! - P_SetTarget(&mobj->target, NULL); - else - { - fixed_t vspeed = FixedMul(mobj->info->speed >> 3, mobj->scale); - fixed_t z = mobj->target->z + (mobj->height >> 1) + (mobj->flags & MFE_VERTICALFLIP ? -128*mobj->scale : 128*mobj->scale + mobj->target->height); - angle_t diff = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y) - mobj->angle; - if (diff > ANGLE_180) - mobj->angle -= DRAGONTURNSPEED; - else - mobj->angle += DRAGONTURNSPEED; - if (!mobj->threshold && dist < 512*mobj->scale) // Close enough to drop bombs - { - mobj->threshold = mobj->info->painchance; - } - mobj->momz += max(min(z - mobj->z, vspeed), -vspeed); - } - } - else // Can we find a player to chase? - { - if (mobj->tracer == NULL || mobj->tracer->state != &states[mobj->tracer->info->spawnstate] - || !P_LookForPlayers(mobj, true, false, 2000*mobj->scale)) // if not, circle around the spawnpoint - { - if (!mobj->spawnpoint) // unless we don't have one, in which case uhhh just circle around wherever we currently are I guess?? - mobj->angle += DRAGONTURNSPEED; - else - { - boolean flip = mobj->spawnpoint->options & MTF_OBJECTFLIP; - fixed_t vspeed = FixedMul(mobj->info->speed >> 3, mobj->scale); - fixed_t x = mobj->spawnpoint->x << FRACBITS; - fixed_t y = mobj->spawnpoint->y << FRACBITS; - fixed_t z = (flip ? P_GetSectorCeilingZAt : P_GetSectorFloorZAt)(R_PointInSubsector(x, y)->sector, x, y) + (flip ? -1 : 1)*(mobj->spawnpoint->z << FRACBITS); - angle_t diff = R_PointToAngle2(mobj->x, mobj->y, x, y) - mobj->angle; - if (diff > ANGLE_180) - mobj->angle -= DRAGONTURNSPEED; - else - mobj->angle += DRAGONTURNSPEED; - mobj->momz += max(min(z - mobj->z, vspeed), -vspeed); - } - } - } - P_InstaThrust(mobj, mobj->angle, FixedMul(mobj->info->speed, mobj->scale)); -#undef DRAGONTURNSPEED -} - static boolean P_MobjRegularThink(mobj_t *mobj) { if ((mobj->flags & MF_ENEMY) && (mobj->state->nextstate == mobj->info->spawnstate && mobj->tics == 1)) @@ -9637,63 +8617,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) case MT_ARROW: P_ArrowThink(mobj); break; - case MT_EMERALDSPAWN: - if (mobj->threshold) - { - mobj->threshold--; - - if (!mobj->threshold && !mobj->target && mobj->reactiontime) - { - mobj_t *emerald = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->reactiontime); - emerald->threshold = 42; - P_SetTarget(&mobj->target, emerald); - P_SetTarget(&emerald->target, mobj); - } - } - break; - case MT_BUGGLE: - mobj->eflags |= MFE_UNDERWATER; //P_MobjCheckWater(mobj); // solely for MFE_UNDERWATER for A_FlickySpawn - { - if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0 - && P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16) - { - var1 = mobj->info->speed; - var2 = 1; - - // Home in on the target. - A_HomingChase(mobj); - - if (mobj->z < mobj->floorz) - mobj->z = mobj->floorz; - - if (leveltime % mobj->info->painchance == 0) - S_StartSound(mobj, mobj->info->activesound); - - if ((statenum_t)(mobj->state - states) != mobj->info->seestate) - P_SetMobjState(mobj, mobj->info->seestate); - } - else - { - // Try to find a player - P_LookForPlayers(mobj, true, true, mobj->radius*16); - mobj->momx >>= 1; - mobj->momy >>= 1; - mobj->momz >>= 1; - if ((statenum_t)(mobj->state - states) != mobj->info->spawnstate) - P_SetMobjState(mobj, mobj->info->spawnstate); - } - } - break; - case MT_BUMBLEBORE: - P_BumbleboreThink(mobj); - break; - case MT_BIGMINE: - mobj->extravalue1 += 3; - mobj->extravalue1 %= 360; - P_UnsetThingPosition(mobj); - mobj->z += FINESINE(mobj->extravalue1*(FINEMASK + 1)/360); - P_SetThingPosition(mobj); - break; case MT_FLAME: if (mobj->flags2 & MF2_BOSSNOTRAP) { @@ -9739,23 +8662,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } } break; - case MT_SPINCUSHION: - if (mobj->target && mobj->state - states >= S_SPINCUSHION_AIM1 && mobj->state - states <= S_SPINCUSHION_AIM5) - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - break; - case MT_CRUSHCLAW: - if (mobj->state - states == S_CRUSHCLAW_STAY && mobj->target) - { - mobj_t *chain = mobj->target->target; - SINT8 sign = ((mobj->tics & 1) ? mobj->tics : -(SINT8)(mobj->tics)); - while (chain) - { - chain->z = chain->movefactor + sign*mobj->scale; - sign = -sign; - chain = chain->target; - } - } - break; case MT_SMASHINGSPIKEBALL: mobj->momx = mobj->momy = 0; if (mobj->state - states == S_SMASHSPIKE_FALL && P_IsObjectOnGround(mobj)) @@ -9769,167 +8675,14 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_SetMobjState(mobj, S_SMASHSPIKE_FLOAT); } break; - case MT_HANGSTER: - if (!P_HangsterThink(mobj)) - return false; - break; - case MT_LHRT: - mobj->momx = FixedMul(mobj->momx, mobj->extravalue2); - mobj->momy = FixedMul(mobj->momy, mobj->extravalue2); - break; - case MT_EGGCAPSULE: - if (!mobj->reactiontime) - { - // Target nearest player on your mare. - // (You can make it float up/down by adding MF_FLOAT, - // but beware level design pitfalls.) - fixed_t shortest = 1024*FRACUNIT; - INT32 i; - P_SetTarget(&mobj->target, NULL); - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].mo - && players[i].mare == mobj->threshold && players[i].spheres > 0) - { - fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); - if (dist < shortest) - { - P_SetTarget(&mobj->target, players[i].mo); - shortest = dist; - } - } - } - break; - case MT_EGGMOBILE2_POGO: - if (!mobj->target - || !mobj->target->health - || mobj->target->state == &states[mobj->target->info->spawnstate] - || mobj->target->state == &states[mobj->target->info->raisestate]) - { - P_RemoveMobj(mobj); - return false; - } - P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z - mobj->height); - break; - case MT_HAMMER: - if (mobj->z <= mobj->floorz) - { - P_RemoveMobj(mobj); - return false; - } - break; - case MT_KOOPA: - P_KoopaThinker(mobj); - break; - case MT_FIREBALL: - if (P_AproxDistance(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them - { - P_KillMobj(mobj, NULL, NULL, 0); - return false; - } - break; - case MT_REDRING: - if (((mobj->z < mobj->floorz) || (mobj->z + mobj->height > mobj->ceilingz)) - && mobj->flags & MF_MISSILE) - { - P_ExplodeMissile(mobj); - return false; - } - break; - case MT_BOSSFLYPOINT: - return false; - case MT_NIGHTSCORE: - mobj->color = (UINT16)(leveltime % SKINCOLOR_WHITE); - break; - case MT_JETFUME1: - if (!P_JetFume1Think(mobj)) - return false; - break; - case MT_JETFLAME: - { - if (!mobj->target // if you have no target - || (!(mobj->target->flags & MF_BOSS) && mobj->target->health <= 0)) // or your target isn't a boss and it's popped now - { // then remove yourself as well! - P_RemoveMobj(mobj); - return false; - } - - P_UnsetThingPosition(mobj); - mobj->x = mobj->target->x; - mobj->y = mobj->target->y; - mobj->z = mobj->target->z - 50*mobj->target->scale; - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - } - break; - case MT_EGGROBO1: - if (!P_EggRobo1Think(mobj)) - return false; - break; - case MT_EGGROBO1JET: - { - if (!mobj->target || P_MobjWasRemoved(mobj->target) // if you have no target - || (mobj->target->health <= 0)) // or your target isn't a boss and it's popped now - { // then remove yourself as well! - P_RemoveMobj(mobj); - return false; - } - - mobj->flags2 ^= MF2_DONTDRAW; - - P_UnsetThingPosition(mobj); - mobj->x = mobj->target->x + P_ReturnThrustX(mobj, mobj->target->angle + ANGLE_90, mobj->movefactor*mobj->target->scale) - P_ReturnThrustX(mobj, mobj->target->angle, 19*mobj->target->scale); - mobj->y = mobj->target->y + P_ReturnThrustY(mobj, mobj->target->angle + ANGLE_90, mobj->movefactor*mobj->target->scale) - P_ReturnThrustY(mobj, mobj->target->angle, 19*mobj->target->scale); - mobj->z = mobj->target->z; - if (mobj->target->eflags & MFE_VERTICALFLIP) - mobj->z += (mobj->target->height - mobj->height); - mobj->floorz = mobj->z; - mobj->ceilingz = mobj->z + mobj->height; - P_SetThingPosition(mobj); - } - break; - case MT_NIGHTSDRONE: - P_NiGHTSDroneThink(mobj); - break; case MT_PLAYER: if (mobj->player) P_PlayerMobjThinker(mobj); return false; - case MT_SKIM: - // check mobj against possible water content, before movement code - P_MobjCheckWater(mobj); - - // Keep Skim at water surface - if (mobj->z <= mobj->watertop) - { - mobj->flags |= MF_NOGRAVITY; - if (mobj->z < mobj->watertop) - { - if (mobj->watertop - mobj->z <= FixedMul(mobj->info->speed*FRACUNIT, mobj->scale)) - mobj->z = mobj->watertop; - else - mobj->momz = FixedMul(mobj->info->speed*FRACUNIT, mobj->scale); - } - } - else - { - mobj->flags &= ~MF_NOGRAVITY; - if (mobj->z > mobj->watertop && mobj->z - mobj->watertop < FixedMul(MAXSTEPMOVE, mobj->scale)) - mobj->z = mobj->watertop; - } - break; case MT_RING: - case MT_REDTEAMRING: - case MT_BLUETEAMRING: - P_KillRingsInLava(mobj); if (P_MobjWasRemoved(mobj)) return false; - /* FALLTHRU */ - case MT_COIN: - case MT_BLUESPHERE: - case MT_BOMBSPHERE: - case MT_NIGHTSCHIP: - case MT_NIGHTSSTAR: + // No need to check water. Who cares? P_RingThinker(mobj); if (mobj->flags2 & MF2_NIGHTSPULL) @@ -9939,13 +8692,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) return false; // Flung items case MT_FLINGRING: - P_KillRingsInLava(mobj); if (P_MobjWasRemoved(mobj)) return false; - /* FALLTHRU */ - case MT_FLINGCOIN: - case MT_FLINGBLUESPHERE: - case MT_FLINGNIGHTSCHIP: + if (mobj->flags2 & MF2_NIGHTSPULL) P_NightsItemChase(mobj); else @@ -9955,135 +8704,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (mobj->flags2 & MF2_NIGHTSPULL) P_NightsItemChase(mobj); break; - case MT_SHELL: - if (mobj->threshold && mobj->threshold != TICRATE) - mobj->threshold--; - - if (mobj->threshold >= TICRATE) - { - mobj->angle += ((mobj->movedir == 1) ? ANGLE_22h : ANGLE_337h); - P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), (mobj->info->speed*mobj->scale)); - } - break; - case MT_TURRET: - if (!P_TurretThink(mobj)) - return false; - break; - case MT_BLUEFLAG: - case MT_REDFLAG: - { - sector_t* sec2; - sec2 = P_ThingOnSpecial3DFloor(mobj); - if ((sec2 && GETSECSPECIAL(sec2->special, 4) == 2) || (GETSECSPECIAL(mobj->subsector->sector->special, 4) == 2)) - mobj->fuse = 1; // Return to base. - break; - } - case MT_CANNONBALL: -#ifdef FLOORSPLATS - R_AddFloorSplat(mobj->tracer->subsector, mobj->tracer, "TARGET", mobj->tracer->x, - mobj->tracer->y, mobj->tracer->floorz, SPLATDRAWMODE_SHADE); -#endif - break; - case MT_SPINDUST: // Spindash dust - mobj->momx = FixedMul(mobj->momx, (3*FRACUNIT)/4); // originally 50000 - mobj->momy = FixedMul(mobj->momy, (3*FRACUNIT)/4); // same - //mobj->momz = mobj->momz+P_MobjFlip(mobj)/3; // no meaningful change in value to be frank - if (mobj->state >= &states[S_SPINDUST_BUBBLE1] && mobj->state <= &states[S_SPINDUST_BUBBLE4]) // bubble dust! - { - P_MobjCheckWater(mobj); - if (mobj->watertop != mobj->subsector->sector->floorheight - 1000*FRACUNIT - && mobj->z + mobj->height >= mobj->watertop - 5*FRACUNIT) - mobj->flags2 |= MF2_DONTDRAW; - } - break; - case MT_TRAINDUSTSPAWNER: - if (leveltime % 5 == 0) { - mobj_t* traindust = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_PARTICLE); - traindust->flags = MF_SCENERY; - P_SetMobjState(traindust, S_TRAINDUST); - traindust->frame = P_RandomRange(0, 8)|FF_TRANS90; - traindust->angle = mobj->angle; - traindust->tics = TICRATE*4; - traindust->destscale = FRACUNIT*64; - traindust->scalespeed = FRACUNIT/24; - P_SetScale(traindust, FRACUNIT*6); - } - break; - case MT_TRAINSTEAMSPAWNER: - if (leveltime % 5 == 0) { - mobj_t *steam = P_SpawnMobj(mobj->x + FRACUNIT*P_SignedRandom()/2, mobj->y + FRACUNIT*P_SignedRandom()/2, mobj->z, MT_PARTICLE); - P_SetMobjState(steam, S_TRAINSTEAM); - steam->frame = P_RandomRange(0, 1)|FF_TRANS90; - steam->tics = TICRATE*8; - steam->destscale = FRACUNIT*64; - steam->scalespeed = FRACUNIT/8; - P_SetScale(steam, FRACUNIT*16); - steam->momx = P_SignedRandom()*32; - steam->momy = -64*FRACUNIT; - steam->momz = 2*FRACUNIT; - } - break; - case MT_CANARIVORE_GAS: - { - fixed_t momz; - - if (mobj->flags2 & MF2_AMBUSH) - { - mobj->momx = FixedMul(mobj->momx, 50*FRACUNIT/51); - mobj->momy = FixedMul(mobj->momy, 50*FRACUNIT/51); - break; - } - - if (mobj->eflags & MFE_VERTICALFLIP) - { - if ((mobj->z + mobj->height + mobj->momz) <= mobj->ceilingz) - break; - } - else - { - if ((mobj->z + mobj->momz) >= mobj->floorz) - break; - } - - momz = abs(mobj->momz); - if (R_PointToDist2(0, 0, mobj->momx, mobj->momy) < momz) - P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), momz); - mobj->flags2 |= MF2_AMBUSH; - break; - } - case MT_SALOONDOOR: - P_SaloonDoorThink(mobj); - break; - case MT_MINECARTSPAWNER: - P_HandleMinecartSegments(mobj); - if (!mobj->fuse || mobj->fuse > TICRATE) - break; - if (mobj->fuse == 2) - { - mobj->fuse = 0; - break; - } - mobj->flags2 ^= MF2_DONTDRAW; - break; - case MT_LAVAFALLROCK: - if (P_IsObjectOnGround(mobj)) - P_RemoveMobj(mobj); - break; - case MT_PYREFLY: - P_PyreFlyThink(mobj); - break; - case MT_PTERABYTE: - P_PterabyteThink(mobj); - break; - case MT_DRAGONBOMBER: - P_DragonbomberThink(mobj); - break; - case MT_MINUS: - if (P_IsObjectOnGround(mobj)) - mobj->rollangle = 0; - else - mobj->rollangle = R_PointToAngle2(0, 0, mobj->momz, (mobj->scale << 1) - min(abs(mobj->momz), mobj->scale << 1)); - break; case MT_FLOATINGITEM: { if (mobj->flags & MF_NOCLIPTHING) @@ -12639,23 +11259,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_TeleportMove(mobj, x, y, z); } break; - case MT_SPINFIRE: - if (mobj->flags & MF_NOGRAVITY) - { - if (mobj->eflags & MFE_VERTICALFLIP) - mobj->z = mobj->ceilingz - mobj->height; - else - mobj->z = mobj->floorz; - } - else if ((!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z <= mobj->floorz) - || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z + mobj->height >= mobj->ceilingz)) - { - mobj->flags |= MF_NOGRAVITY; - mobj->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others - mobj->momy = mobj->momz = 0; - mobj->z = ((mobj->eflags & MFE_VERTICALFLIP) ? mobj->ceilingz - mobj->height : mobj->floorz); - } - /* FALLTHRU */ default: // check mobj against possible water content, before movement code P_MobjCheckWater(mobj); @@ -12693,20 +11296,8 @@ static void P_FiringThink(mobj_t *mobj) { mobj_t *missile; - if (mobj->target->player && mobj->target->player->powers[pw_carry] == CR_NIGHTSMODE) - { - fixed_t oldval = mobjinfo[mobj->extravalue1].speed; - - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x + mobj->target->momx, mobj->target->y + mobj->target->momy); - mobjinfo[mobj->extravalue1].speed = FixedMul(60*FRACUNIT, mobj->scale); - missile = P_SpawnMissile(mobj, mobj->target, mobj->extravalue1); - mobjinfo[mobj->extravalue1].speed = oldval; - } - else - { - mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - missile = P_SpawnMissile(mobj, mobj->target, mobj->extravalue1); - } + mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + missile = P_SpawnMissile(mobj, mobj->target, mobj->extravalue1); if (missile) { @@ -14671,7 +13262,6 @@ void P_SpawnPlayer(INT32 playernum) } else if (multiplayer && !netgame) { - p->outofcoop = false; if (netgame && p->jointime < 1) { // Averted by GTR_NOSPECTATORSPAWN. @@ -14778,9 +13368,6 @@ void P_SpawnPlayer(INT32 playernum) p->nightstime = sstimer; } - // Spawn with a pity shield if necessary. - //P_DoPityCheck(p); - if (p->kartstuff[k_respawn] != 0) p->mo->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY; diff --git a/src/p_saveg.c b/src/p_saveg.c index cd0ff4516..674e46d73 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -116,15 +116,6 @@ static void P_NetArchivePlayers(void) WRITEANGLE(save_p, players[i].awayviewaiming); WRITEINT32(save_p, players[i].awayviewtics); WRITEINT16(save_p, players[i].rings); - WRITEINT16(save_p, players[i].spheres); - - WRITESINT8(save_p, players[i].pity); - WRITEINT32(save_p, players[i].currentweapon); - WRITEINT32(save_p, players[i].ringweapons); - - WRITEUINT16(save_p, players[i].ammoremoval); - WRITEUINT32(save_p, players[i].ammoremovaltimer); - WRITEINT32(save_p, players[i].ammoremovaltimer); for (j = 0; j < NUMPOWERS; j++) WRITEUINT16(save_p, players[i].powers[j]); @@ -329,15 +320,6 @@ static void P_NetUnArchivePlayers(void) players[i].awayviewaiming = READANGLE(save_p); players[i].awayviewtics = READINT32(save_p); players[i].rings = READINT16(save_p); - players[i].spheres = READINT16(save_p); - - players[i].pity = READSINT8(save_p); - players[i].currentweapon = READINT32(save_p); - players[i].ringweapons = READINT32(save_p); - - players[i].ammoremoval = READUINT16(save_p); - players[i].ammoremovaltimer = READUINT32(save_p); - players[i].ammoremovalweapon = READINT32(save_p); for (j = 0; j < NUMPOWERS; j++) players[i].powers[j] = READUINT16(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 7fa89b7a1..4be2b8e41 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3966,9 +3966,6 @@ static void P_InitPlayers(void) if (!playeringame[i]) continue; - // Start players with pity shields if possible - players[i].pity = -1; - players[i].mo = NULL; if (!G_RaceGametype()) diff --git a/src/p_spec.c b/src/p_spec.c index 0e54c1128..2450dc576 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1602,10 +1602,10 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!playeringame[i] || players[i].spectator) continue; - if (!players[i].mo || ((maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings) <= 0) + if (!players[i].mo || players[i].rings <= 0) continue; - rings += (maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings; + rings += players[i].rings; } } else @@ -1613,7 +1613,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!(actor && actor->player)) return false; // no player to count rings from here, sorry - rings = (maptol & TOL_NIGHTS) ? actor->player->spheres : actor->player->rings; + rings = actor->player->rings; } if (triggerline->flags & ML_NOCLIMB) @@ -4541,15 +4541,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers S_StartSound(player->mo, sfx_itemup); } break; - case 11: // Special Stage Damage - if (player->exiting || player->bot) // Don't do anything for bots or players who have just finished - break; - - if (!(player->powers[pw_shield] || player->spheres > 0)) // Don't do anything if no shield or spheres anyway - break; - - P_SpecialStageDamage(player, NULL, NULL); - break; + case 11: // Unused case 12: // Wall Sector (Don't step-up/down) case 13: // Ramp Sector (Increase step-up/down) case 14: // Non-Ramp Sector (Don't step-down) @@ -8586,7 +8578,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) return false; // Allow this to affect pushable objects at some point? - if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || thing->player->powers[pw_carry] == CR_NIGHTSMODE)) + if (thing->player && !(thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) { INT32 dist; INT32 speed; @@ -8617,75 +8609,14 @@ static inline boolean PIT_PushThing(mobj_t *thing) // Written with bits and pieces of P_HomingAttack if ((speed > 0) && (P_CheckSight(thing, tmpusher->source))) { - if (thing->player->powers[pw_carry] != CR_NIGHTSMODE) + // only push wrt Z if health & 1 (mapthing has ambush flag) + if (tmpusher->source->health & 1) { - // only push wrt Z if health & 1 (mapthing has ambush flag) - if (tmpusher->source->health & 1) - { - fixed_t tmpmomx, tmpmomy, tmpmomz; - - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - if (tmpusher->source->type == MT_PUSH) // away! - { - tmpmomx *= -1; - tmpmomy *= -1; - tmpmomz *= -1; - } - - thing->momx += tmpmomx; - thing->momy += tmpmomy; - thing->momz += tmpmomz; - - if (thing->player) - { - thing->player->cmomx += tmpmomx; - thing->player->cmomy += tmpmomy; - thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); - thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); - } - } - else - { - angle_t pushangle; - - pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy); - if (tmpusher->source->type == MT_PUSH) - pushangle += ANGLE_180; // away - pushangle >>= ANGLETOFINESHIFT; - thing->momx += FixedMul(speed, FINECOSINE(pushangle)); - thing->momy += FixedMul(speed, FINESINE(pushangle)); - - if (thing->player) - { - thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle)); - thing->player->cmomy += FixedMul(speed, FINESINE(pushangle)); - thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); - thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); - } - } - } - else - { - //NiGHTS-specific handling. - //By default, pushes and pulls only affect the Z-axis. - //By having the ambush flag, it affects the X-axis. - //By having the object special flag, it affects the Y-axis. fixed_t tmpmomx, tmpmomy, tmpmomz; - if (tmpusher->source->health & 1) - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - else - tmpmomx = 0; - - if (tmpusher->source->health & 2) - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - else - tmpmomy = 0; - + tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); + tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - if (tmpusher->source->type == MT_PUSH) // away! { tmpmomx *= -1; @@ -8705,6 +8636,25 @@ static inline boolean PIT_PushThing(mobj_t *thing) thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); } } + else + { + angle_t pushangle; + + pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy); + if (tmpusher->source->type == MT_PUSH) + pushangle += ANGLE_180; // away + pushangle >>= ANGLETOFINESHIFT; + thing->momx += FixedMul(speed, FINECOSINE(pushangle)); + thing->momy += FixedMul(speed, FINESINE(pushangle)); + + if (thing->player) + { + thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle)); + thing->player->cmomy += FixedMul(speed, FINESINE(pushangle)); + thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); + thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); + } + } } } diff --git a/src/p_tick.c b/src/p_tick.c index 361a0853e..c06c2495e 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -328,12 +328,14 @@ static inline void P_RunThinkers(void) } +/* + // // P_DoAutobalanceTeams() // // Determine if the teams are unbalanced, and if so, move a player to the other team. // -/*static void P_DoAutobalanceTeams(void) +static void P_DoAutobalanceTeams(void) { changeteam_union NetPacket; UINT16 usvalue; @@ -447,136 +449,6 @@ void P_DoTeamscrambling(void) CV_SetValue(&cv_teamscramble, 0); } -static inline void P_DoSpecialStageStuff(void) -{ - boolean stillalive = false; - INT32 i; - - // Can't drown in a special stage - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator) - continue; - - players[i].powers[pw_underwater] = players[i].powers[pw_spacetime] = 0; - } - - //if (sstimer < 15*TICRATE+6 && sstimer > 7 && (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)) - //S_SpeedMusic(1.4f); - - if (sstimer && !objectplacing) - { - sstimer = 0; - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i]) - { - players[i].exiting = raceexittime+1; - players[i].pflags &= ~PF_GLIDING; - } - - if (i == consoleplayer) - S_StartSound(NULL, sfx_lose); - } - - if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC) - S_SpeedMusic(1.0f); - - stagefailed = true; - } - - if (sstimer > 1) // As long as time isn't up... - { - UINT16 countspheres = 0; - // Count up the rings of all the players and see if - // they've collected the required amount. - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) - { - tic_t oldnightstime = players[i].nightstime; - countspheres += players[i].spheres; - - if (!oldnightstime) - continue; - - // If in water, deplete timer 6x as fast. - if (players[i].mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER) && !(players[i].powers[pw_shield] & SH_PROTECTWATER)) - players[i].nightstime -= 5; - if (--players[i].nightstime > 6) - { - if (P_IsLocalPlayer(&players[i]) && oldnightstime > 10*TICRATE && players[i].nightstime <= 10*TICRATE) - S_ChangeMusicInternal("_drown", false); - stillalive = true; - } - else if (!players[i].exiting) - { - players[i].exiting = (14*TICRATE)/5 + 1; - players[i].pflags &= ~(PF_GLIDING|PF_BOUNCING); - players[i].nightstime = 0; - if (P_IsLocalPlayer(&players[i])) - S_StartSound(NULL, sfx_s3k66); - } - } - - if (stillalive) - { - if (countspheres >= ssspheres) - { - // Halt all the players - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && !players[i].exiting) - { - players[i].mo->momx = players[i].mo->momy = 0; - players[i].exiting = (14*TICRATE)/5 + 1; - } - sstimer = 0; - P_GiveEmerald(true); - P_RestoreMusic(&players[consoleplayer]); - } - } - else - sstimer = 0; - } -} - -static inline void P_DoTagStuff(void) -{ - INT32 i; - - // tell the netgame who the initial IT person is. - if (leveltime == TICRATE) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].pflags & PF_TAGIT) - { - CONS_Printf(M_GetText("%s is now IT!\n"), player_names[i]); // Tell everyone who is it! - break; - } - } - } - - //increment survivor scores - if (leveltime % TICRATE == 0 && leveltime > (hidetime * TICRATE)) - { - INT32 participants = 0; - - for (i=0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && !players[i].spectator) - participants++; - } - - for (i=0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && !players[i].spectator && players[i].playerstate == PST_LIVE - && !(players[i].pflags & (PF_TAGIT|PF_GAMETYPEOVER))) - //points given is the number of participating players divided by two. - P_AddPlayerScore(&players[i], participants/2); - } - } -} - static inline void P_DoCTFStuff(void) { // Automatic team balance for CTF and team match @@ -596,7 +468,9 @@ static inline void P_DoCTFStuff(void) if (cv_teamscramble.value && server) P_DoTeamscrambling(); } -}*/ +} + +*/ // // P_Ticker diff --git a/src/p_user.c b/src/p_user.c index d2940c1ab..926a64548 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -333,8 +333,7 @@ void P_GiveEmerald(boolean spawnObj) P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); // Make sure we're not being carried before our tracer is changed - if (players[i].powers[pw_carry] != CR_NIGHTSMODE) - players[i].powers[pw_carry] = CR_NONE; + players[i].powers[pw_carry] = CR_NONE; P_SetTarget(&players[i].mo->tracer, emmo); @@ -473,29 +472,9 @@ boolean P_PlayerInPain(player_t *player) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_STARTJUMP|PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY|PF_BOUNCING); - - if (player->powers[pw_carry] == CR_ROLLOUT) - { - if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) - { - player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->tracer, NULL); - } - P_SetTarget(&player->mo->tracer, NULL); - player->powers[pw_carry] = CR_NONE; - } - - if (!(player->powers[pw_carry] == CR_NIGHTSMODE || player->powers[pw_carry] == CR_NIGHTSFALL || player->powers[pw_carry] == CR_BRAKGOOP || player->powers[pw_carry] == CR_MINECART)) - player->powers[pw_carry] = CR_NONE; - - player->secondjump = 0; - player->glidetime = 0; - player->homing = 0; - player->climbing = 0; - player->powers[pw_tailsfly] = 0; + //player->pflags &= ~(PF_); + player->powers[pw_carry] = CR_NONE; player->onconveyor = 0; - player->skidtime = 0; } // @@ -1999,7 +1978,7 @@ static void P_DoBubbleBreath(player_t *player) fixed_t z = player->mo->z; mobj_t *bubble = NULL; - if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_PROTECTWATER) && !(player->powers[pw_carry] == CR_NIGHTSMODE)) || player->spectator) + if (!(player->mo->eflags & MFE_UNDERWATER) || (player->powers[pw_shield] & SH_PROTECTWATER) || player->spectator) return; if (player->charflags & SF_MACHINE) @@ -4440,8 +4419,7 @@ void P_PlayerThink(player_t *player) } // Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot. - if (!objectplacing && !((netgame || multiplayer) && player->spectator) - && maptol & TOL_NIGHTS && (player->powers[pw_carry] != CR_NIGHTSMODE || player->powers[pw_nights_helper])) + if (!objectplacing && !((netgame || multiplayer) && player->spectator)) { thinker_t *th; mobj_t *mo2; @@ -4551,13 +4529,10 @@ void P_PlayerThink(player_t *player) #endif // check for use - if (player->powers[pw_carry] != CR_NIGHTSMODE) - { - if (cmd->buttons & BT_BRAKE) - player->pflags |= PF_USEDOWN; - else - player->pflags &= ~PF_USEDOWN; - } + if (cmd->buttons & BT_BRAKE) + player->pflags |= PF_USEDOWN; + else + player->pflags &= ~PF_USEDOWN; // IF PLAYER NOT HERE THEN FLASH END IF if (player->quittime && player->powers[pw_flashing] < flashingtics - 1 @@ -4567,12 +4542,6 @@ void P_PlayerThink(player_t *player) // Counters, time dependent power ups. // Time Bonus & Ring Bonus count settings - if (player->ammoremovaltimer) - { - if (--player->ammoremovaltimer == 0) - player->ammoremoval = 0; - } - // Strength counts up to diminish fade. if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing(player))) @@ -4700,12 +4669,6 @@ void P_PlayerAfterThink(player_t *player) return; } - if (player->powers[pw_carry] == CR_NIGHTSMODE) - { - player->powers[pw_gravityboots] = 0; - //player->mo->eflags &= ~MFE_VERTICALFLIP; - } - if (player->pflags & PF_SLIDING) P_SetPlayerMobjState(player->mo, player->mo->info->painstate); diff --git a/src/r_main.c b/src/r_main.c index 53b02bc1e..85e64fbbd 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1418,13 +1418,18 @@ void R_SkyboxFrame(player_t *player) boolean R_ViewpointHasChasecam(player_t *player) { boolean chasecam = false; + UINT8 i; - if (splitscreen && player == &players[secondarydisplayplayer] && player != &players[consoleplayer]) - chasecam = (cv_chasecam2.value != 0); - else - chasecam = (cv_chasecam.value != 0); + for (i = 0; i <= splitscreen; i++) + { + if (player == &players[g_localplayers[i]]) + { + chasecam = (cv_chasecam[i].value != 0); + break; + } + } - if (player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode) + if (player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off diff --git a/src/y_inter.c b/src/y_inter.c index 956c55802..169a4521a 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -226,10 +226,10 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) // set up the levelstring if (mapheaderinfo[prevmap]->levelflags & LF_NOZONE) { - if (mapheaderinfo[prevmap]->actnum[0]) + if (mapheaderinfo[prevmap]->actnum > 0) snprintf(data.match.levelstring, sizeof data.match.levelstring, - "* %s %s *", + "* %s %d *", mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum); else snprintf(data.match.levelstring, @@ -240,10 +240,10 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) else { const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "ZONE"); - if (mapheaderinfo[prevmap]->actnum[0]) + if (mapheaderinfo[prevmap]->actnum > 0) snprintf(data.match.levelstring, sizeof data.match.levelstring, - "* %s %s %s *", + "* %s %s %d *", mapheaderinfo[prevmap]->lvlttl, zonttl, mapheaderinfo[prevmap]->actnum); else snprintf(data.match.levelstring, @@ -1905,10 +1905,10 @@ void Y_StartVote(void) // set up the levelstring if (mapheaderinfo[votelevels[i][0]]->levelflags & LF_NOZONE || !mapheaderinfo[votelevels[i][0]]->zonttl[0]) { - if (mapheaderinfo[votelevels[i][0]]->actnum[0]) + if (mapheaderinfo[votelevels[i][0]]->actnum > 0) snprintf(levelinfo[i].str, sizeof levelinfo[i].str, - "%s %s", + "%s %d", mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum); else snprintf(levelinfo[i].str, @@ -1918,10 +1918,10 @@ void Y_StartVote(void) } else { - if (mapheaderinfo[votelevels[i][0]]->actnum[0]) + if (mapheaderinfo[votelevels[i][0]]->actnum > 0) snprintf(levelinfo[i].str, sizeof levelinfo[i].str, - "%s %s %s", + "%s %s %d", mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl, mapheaderinfo[votelevels[i][0]]->actnum); else snprintf(levelinfo[i].str,