From 82f00215ac4d6b608d029ad632445ab3ce21f8f9 Mon Sep 17 00:00:00 2001 From: Matthew Marsalko Date: Tue, 2 Jan 2018 11:33:13 -0800 Subject: [PATCH 01/39] Remove unncessary extra boss frames --- src/dehacked.c | 3 --- src/info.c | 13 +++++-------- src/info.h | 3 --- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index cb76c663e..b4dee1b46 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3861,9 +3861,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE_PANIC5", "S_EGGMOBILE_PANIC6", "S_EGGMOBILE_PANIC7", - "S_EGGMOBILE_PANIC8", - "S_EGGMOBILE_PANIC9", - "S_EGGMOBILE_PANIC10", "S_EGGMOBILE_PAIN", "S_EGGMOBILE_PAIN2", "S_EGGMOBILE_DIE1", diff --git a/src/info.c b/src/info.c index acb12379a..aa9be6400 100644 --- a/src/info.c +++ b/src/info.c @@ -1054,15 +1054,12 @@ state_t states[NUMSTATES] = {SPR_EGGM, 19, 10, {NULL}, 0, 0, S_EGGMOBILE_RATK10}, // S_EGGMOBILE_RATK9 {SPR_EGGM, 20, 2, {NULL}, 0, 0, S_EGGMOBILE_STND}, // S_EGGMOBILE_RATK10 {SPR_EGGM, 3, 12, {NULL}, 0, 0, S_EGGMOBILE_PANIC2}, // S_EGGMOBILE_PANIC1 - {SPR_EGGM, 4, 4, {A_Boss1Spikeballs}, 0, 4, S_EGGMOBILE_PANIC3}, // S_EGGMOBILE_PANIC2 + {SPR_EGGM, 4, 45, {A_Boss1Laser}, MT_LASER, 2, S_EGGMOBILE_PANIC3}, // S_EGGMOBILE_PANIC2 {SPR_EGGM, 3, 8, {NULL}, 0, 0, S_EGGMOBILE_PANIC4}, // S_EGGMOBILE_PANIC3 - {SPR_EGGM, 4, 4, {A_Boss1Spikeballs}, 1, 4, S_EGGMOBILE_PANIC5}, // S_EGGMOBILE_PANIC4 - {SPR_EGGM, 3, 8, {NULL}, 0, 0, S_EGGMOBILE_PANIC6}, // S_EGGMOBILE_PANIC5 - {SPR_EGGM, 4, 4, {A_Boss1Spikeballs}, 2, 4, S_EGGMOBILE_PANIC7}, // S_EGGMOBILE_PANIC6 - {SPR_EGGM, 3, 8, {NULL}, 0, 0, S_EGGMOBILE_PANIC8}, // S_EGGMOBILE_PANIC7 - {SPR_EGGM, 4, 4, {A_Boss1Spikeballs}, 3, 4, S_EGGMOBILE_PANIC9}, // S_EGGMOBILE_PANIC8 - {SPR_EGGM, 3, 8, {NULL}, 0, 0, S_EGGMOBILE_PANIC10},// S_EGGMOBILE_PANIC9 - {SPR_EGGM, 0, 35, {A_SkullAttack}, 0, 0, S_EGGMOBILE_STND}, // S_EGGMOBILE_PANIC10 + {SPR_EGGM, 4, 45, {A_Boss1Laser}, MT_LASER, 2, S_EGGMOBILE_PANIC5 }, // S_EGGMOBILE_PANIC4 + {SPR_EGGM, 3, 8, {NULL}, 0, 0, S_EGGMOBILE_PANIC6}, // S_EGGMOBILE_PANIC5 + {SPR_EGGM, 4, 45, {A_Boss1Laser}, MT_LASER, 2, S_EGGMOBILE_PANIC7 }, // S_EGGMOBILE_PANIC6 + {SPR_EGGM, 0, 35, {NULL}, 0, 0, S_EGGMOBILE_STND }, // S_EGGMOBILE_PANIC7 {SPR_EGGM, 21, 24, {A_Pain}, 0, 0, S_EGGMOBILE_PAIN2}, // S_EGGMOBILE_PAIN {SPR_EGGM, 21, 16, {A_SkullAttack}, 1, 1, S_EGGMOBILE_STND}, // S_EGGMOBILE_PAIN2 {SPR_EGGM, 22, 8, {A_Fall}, 0, 0, S_EGGMOBILE_DIE2}, // S_EGGMOBILE_DIE1 diff --git a/src/info.h b/src/info.h index 35a3f5f15..25a9e1562 100644 --- a/src/info.h +++ b/src/info.h @@ -1167,9 +1167,6 @@ typedef enum state S_EGGMOBILE_PANIC5, S_EGGMOBILE_PANIC6, S_EGGMOBILE_PANIC7, - S_EGGMOBILE_PANIC8, - S_EGGMOBILE_PANIC9, - S_EGGMOBILE_PANIC10, S_EGGMOBILE_PAIN, S_EGGMOBILE_PAIN2, S_EGGMOBILE_DIE1, From 0e148451551c5bfd6ee1dec203796233fca8e4de Mon Sep 17 00:00:00 2001 From: Matthew Marsalko Date: Tue, 2 Jan 2018 11:34:13 -0800 Subject: [PATCH 02/39] Add triple laser --- src/p_enemy.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 9acc8430e..70386c858 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2106,6 +2106,8 @@ void A_Boss7FireMissiles(mobj_t *actor) // var2: // 0 - Boss 1 Left side // 1 - Boss 1 Right side +// 2 - Triple laser +// >3 - Boss 1 Middle // void A_Boss1Laser(mobj_t *actor) { @@ -2141,6 +2143,15 @@ void A_Boss1Laser(mobj_t *actor) else z = actor->z + FixedMul(56*FRACUNIT, actor->scale); break; + case 2: + var2 = 3; // Fire middle laser + A_Boss1Laser(actor); + var2 = 0; // Fire left laser + A_Boss1Laser(actor); + var2 = 1; // Fire right laser + A_Boss1Laser(actor); + return; + break; default: x = actor->x; y = actor->y; @@ -2148,7 +2159,7 @@ void A_Boss1Laser(mobj_t *actor) break; } - if (!(actor->flags2 & MF2_FIRING)) + if (!(actor->flags2 & MF2_FIRING) && actor->tics > 1) { actor->angle = R_PointToAngle2(x, y, actor->target->x, actor->target->y); if (mobjinfo[locvar1].seesound) @@ -2170,6 +2181,7 @@ void A_Boss1Laser(mobj_t *actor) angle = FixedAngle(FixedDiv(actor->tics*160*FRACUNIT, actor->state->tics*FRACUNIT) + 10*FRACUNIT); else angle = R_PointToAngle2(z + (mobjinfo[locvar1].height>>1), 0, actor->target->z, R_PointToDist2(x, y, actor->target->x, actor->target->y)); + point = P_SpawnMobj(x, y, z, locvar1); P_SetTarget(&point->target, actor); point->angle = actor->angle; From 91502f14999f46c6e4179ad5e0b5abd47326564f Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 15 Jul 2019 15:39:58 -0700 Subject: [PATCH 03/39] Don't send login final hashes to everyone Someone thought it was a good fucking idea to make logins NetXCmds. NetXCmds are sent to everyone however. Thankfully logins are two passes. And the second pass uses a salt based on the playernum. Therefore, in order to actually make use of the final hash, you'd have to be the same playernum as who originally sent it. Still a stupid exploit. P.S. The netcode is LOL XD by VincyTM -Telos --- src/d_clisrv.c | 58 +++++++++++++++++++++++++++++++++++++++ src/d_clisrv.h | 9 +++++++ src/d_netcmd.c | 73 ++++---------------------------------------------- src/d_netcmd.h | 4 +-- 4 files changed, 74 insertions(+), 70 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 274fe398a..64d3ee6da 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -44,6 +44,7 @@ #include "lzf.h" #include "lua_script.h" #include "lua_hook.h" +#include "md5.h" #ifdef CLIENT_LOADINGSCREEN // cl loading screen @@ -116,6 +117,9 @@ static UINT8 resynch_local_inprogress = false; // WE are desynched and getting p static UINT8 player_joining = false; UINT8 hu_resynching = 0; +UINT8 adminpassmd5[MD5_LEN]; +boolean adminpasswordset = false; + // Client specific static ticcmd_t localcmds; static ticcmd_t localcmds2; @@ -3760,6 +3764,7 @@ static void HandlePacketFromPlayer(SINT8 node) XBOXSTATIC INT32 netconsole; XBOXSTATIC tic_t realend, realstart; XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak; + XBOXSTATIC UINT8 finalmd5[MD5_LEN];/* Well, it's the cool thing to do? */ FILESTAMP txtpak = NULL; @@ -3958,6 +3963,33 @@ FILESTAMP textcmd[0] += (UINT8)netbuffer->u.textcmd[0]; } break; + case PT_LOGIN: + CONS_Printf("I received LOGIN\n"); + if (client) + break; + +#ifndef NOMD5 + if (doomcom->datalength < MD5_LEN)/* ignore partial sends */ + break; + + if (!adminpasswordset) + { + CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[netconsole]); + break; + } + + // Do the final pass to compare with the sent md5 + D_MD5PasswordPass(adminpassmd5, MD5_LEN, va("PNUM%02d", netconsole), &finalmd5); + + if (!memcmp(netbuffer->u.md5sum, finalmd5, MD5_LEN)) + { + CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[netconsole]); + COM_BufInsertText(va("promote %d\n", netconsole)); // do this immediately + } + else + CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[netconsole]); +#endif + break; case PT_NODETIMEOUT: case PT_CLIENTQUIT: if (client) @@ -4841,3 +4873,29 @@ tic_t GetLag(INT32 node) { return gametic - nettics[node]; } + +void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest) +{ +#ifdef NOMD5 + (void)buffer; + (void)len; + (void)salt; + memset(dest, 0, 16); +#else + XBOXSTATIC char tmpbuf[256]; + const size_t sl = strlen(salt); + + if (len > 256-sl) + len = 256-sl; + + memcpy(tmpbuf, buffer, len); + memmove(&tmpbuf[len], salt, sl); + //strcpy(&tmpbuf[len], salt); + len += strlen(salt); + if (len < 256) + memset(&tmpbuf[len],0,256-len); + + // Yes, we intentionally md5 the ENTIRE buffer regardless of size... + md5_buffer(tmpbuf, 256, dest); +#endif +} diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 8443b3fc0..96591ed93 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -70,6 +70,9 @@ typedef enum PT_NODETIMEOUT, // Packet sent to self if the connection times out. PT_RESYNCHING, // Packet sent to resync players. // Blocks game advance until synched. + + PT_LOGIN, // Login attempt from the client. + #ifdef NEWPING PT_PING, // Packet sent to tell clients the other client's latency to server. #endif @@ -398,6 +401,7 @@ typedef struct UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...) filetx_pak filetxpak; // 139 bytes clientconfig_pak clientcfg; // 136 bytes + UINT8 md5sum[MD5_LEN]; serverinfo_pak serverinfo; // 1024 bytes serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...) askinfo_pak askinfo; // 61 bytes @@ -526,5 +530,10 @@ void D_ResetTiccmds(void); tic_t GetLag(INT32 node); UINT8 GetFreeXCmdSize(void); +void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest); + extern UINT8 hu_resynching; + +extern UINT8 adminpassmd5[MD5_LEN]; +extern boolean adminpasswordset; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 998eef05d..1c2d380c1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -34,13 +34,13 @@ #include "p_spec.h" #include "m_cheat.h" #include "d_clisrv.h" +#include "d_net.h" #include "v_video.h" #include "d_main.h" #include "m_random.h" #include "f_finale.h" #include "filesrch.h" #include "mserv.h" -#include "md5.h" #include "z_zone.h" #include "lua_script.h" #include "lua_hook.h" @@ -143,7 +143,6 @@ static void Command_Clearscores_f(void); // Remote Administration static void Command_Changepassword_f(void); static void Command_Login_f(void); -static void Got_Login(UINT8 **cp, INT32 playernum); static void Got_Verification(UINT8 **cp, INT32 playernum); static void Got_Removal(UINT8 **cp, INT32 playernum); static void Command_Verify_f(void); @@ -437,7 +436,6 @@ void D_RegisterServerCommands(void) // Remote Administration COM_AddCommand("password", Command_Changepassword_f); - RegisterNetXCmd(XD_LOGIN, Got_Login); COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin COM_AddCommand("promote", Command_Verify_f); RegisterNetXCmd(XD_VERIFIED, Got_Verification); @@ -2652,35 +2650,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // Attempts to make password system a little sane without // rewriting the entire goddamn XD_file system // -#include "md5.h" -static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest) -{ -#ifdef NOMD5 - (void)buffer; - (void)len; - (void)salt; - memset(dest, 0, 16); -#else - XBOXSTATIC char tmpbuf[256]; - const size_t sl = strlen(salt); - - if (len > 256-sl) - len = 256-sl; - memcpy(tmpbuf, buffer, len); - memmove(&tmpbuf[len], salt, sl); - //strcpy(&tmpbuf[len], salt); - len += strlen(salt); - if (len < 256) - memset(&tmpbuf[len],0,256-len); - - // Yes, we intentionally md5 the ENTIRE buffer regardless of size... - md5_buffer(tmpbuf, 256, dest); -#endif -} - #define BASESALT "basepasswordstorage" -static UINT8 adminpassmd5[16]; -static boolean adminpasswordset = false; void D_SetPassword(const char *pw) { @@ -2718,7 +2688,6 @@ static void Command_Login_f(void) // If we have no MD5 support then completely disable XD_LOGIN responses for security. CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n"); #else - XBOXSTATIC UINT8 finalmd5[16]; const char *pw; if (!netgame) @@ -2738,47 +2707,15 @@ static void Command_Login_f(void) pw = COM_Argv(1); // Do the base pass to get what the server has (or should?) - D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &finalmd5); + D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &netbuffer->u.md5sum); // Do the final pass to get the comparison the server will come up with - D_MD5PasswordPass(finalmd5, 16, va("PNUM%02d", consoleplayer), &finalmd5); + D_MD5PasswordPass(netbuffer->u.md5sum, MD5_LEN, va("PNUM%02d", consoleplayer), &netbuffer->u.md5sum); CONS_Printf(M_GetText("Sending login... (Notice only given if password is correct.)\n")); - SendNetXCmd(XD_LOGIN, finalmd5, 16); -#endif -} - -static void Got_Login(UINT8 **cp, INT32 playernum) -{ -#ifdef NOMD5 - // If we have no MD5 support then completely disable XD_LOGIN responses for security. - (void)cp; - (void)playernum; -#else - UINT8 sentmd5[16], finalmd5[16]; - - READMEM(*cp, sentmd5, 16); - - if (client) - return; - - if (!adminpasswordset) - { - CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[playernum]); - return; - } - - // Do the final pass to compare with the sent md5 - D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", playernum), &finalmd5); - - if (!memcmp(sentmd5, finalmd5, 16)) - { - CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]); - COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately - } - else - CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[playernum]); + netbuffer->packettype = PT_LOGIN; + HSendPacket(servernode, true, 0, MD5_LEN); #endif } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index b82065c82..244693356 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -125,8 +125,8 @@ typedef enum XD_ADDPLAYER, // 10 XD_TEAMCHANGE, // 11 XD_CLEARSCORES, // 12 - XD_LOGIN, // 13 - XD_VERIFIED, // 14 + // UNUSED 13 (Because I don't want to change these comments) + XD_VERIFIED = 14,//14 XD_RANDOMSEED, // 15 XD_RUNSOC, // 16 XD_REQADDFILE, // 17 From e3aec8e067ce71698c4ffd447e204f718d1c1780 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 10 Aug 2019 16:06:59 +0100 Subject: [PATCH 04/39] Fix all our landing woes. (For now.) * Player state upon collision with ground after rolling now sets state properly. * Fix the thing where Knuckles can glide up a slope like it's nothing WHILE keeping things working for bouncers. --- src/p_slopes.c | 10 ++++++---- src/p_user.c | 13 +++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index f89dd3c96..b06460084 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -716,9 +716,11 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) vector3_t mom; // Ditto. if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated. - if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope - //thing->momz = -P_MobjFlip(thing); + if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope + { thing->standingslope = slope; + if (!thing->player || !(thing->player->pflags & PF_BOUNCING)) + thing->momz = -P_MobjFlip(thing); } return; } @@ -732,9 +734,9 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope thing->momx = mom.x; thing->momy = mom.y; - //thing->momz = -P_MobjFlip(thing); - thing->standingslope = slope; + if (!thing->player || !(thing->player->pflags & PF_BOUNCING)) + thing->momz = -P_MobjFlip(thing); } } diff --git a/src/p_user.c b/src/p_user.c index 0861398d6..128d4e7d7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2194,13 +2194,10 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) if ((clipmomz = !(P_CheckDeathPitCollide(player->mo))) && player->mo->health && !player->spectator) { - if (dorollstuff) - { - if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) - player->pflags |= PF_SPINNING; - else - player->pflags &= ~PF_SPINNING; - } + if (dorollstuff && (player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) + player->pflags |= PF_SPINNING; + else if (!(player->pflags & PF_STARTDASH)) + player->pflags &= ~PF_SPINNING; if (player->pflags & PF_SPINNING) { @@ -2268,7 +2265,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) } else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2) ; - else if (player->pflags & PF_JUMPED || player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED) + else if (player->panim != PA_IDLE && player->panim != PA_WALK && player->panim != PA_RUN && player->panim != PA_DASH) { if (player->cmomx || player->cmomy) { From ed8ad7abde7968688b027ad6da23b7ccd7de495e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 11 Aug 2019 14:36:52 +0100 Subject: [PATCH 05/39] Did some testing, needed to fix one more issue with moving surfaces and spinning. --- src/p_map.c | 2 +- src/p_user.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6beca92f1..8b00397ca 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2884,7 +2884,7 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (thing->z != oldz) { if (thing->player) - P_PlayerHitFloor(thing->player, false); + P_PlayerHitFloor(thing->player, !onfloor); } // debug: be sure it falls to the floor diff --git a/src/p_user.c b/src/p_user.c index 128d4e7d7..c583e076b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2194,10 +2194,13 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) if ((clipmomz = !(P_CheckDeathPitCollide(player->mo))) && player->mo->health && !player->spectator) { - if (dorollstuff && (player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) - player->pflags |= PF_SPINNING; - else if (!(player->pflags & PF_STARTDASH)) - player->pflags &= ~PF_SPINNING; + if (dorollstuff) + { + if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) + player->pflags |= PF_SPINNING; + else if (!(player->pflags & PF_STARTDASH)) + player->pflags &= ~PF_SPINNING; + } if (player->pflags & PF_SPINNING) { From f85bc7c61fa4f3d28221b6e0f7d08a872448cb24 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 11 Aug 2019 19:37:15 +0100 Subject: [PATCH 06/39] Fix Rob's Knuckles issue. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index c583e076b..82bf9f99f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2217,7 +2217,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) player->skidtime = TICRATE; player->mo->tics = -1; } - else + else if (!player->skidtime) player->pflags &= ~PF_GLIDING; } else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) From 9ae750d09c3361789ea15029df97a35f374d27bf Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 12 Aug 2019 00:34:42 +0100 Subject: [PATCH 07/39] Since I had to do a clean build to get this up to date (the state list was updated), I decided to redo all the boss explosion animations to be way more aesthetically pleasing. Basically, think "Sonic 3". https://cdn.discordapp.com/attachments/371082353990303745/610233312765673493/srb20047.gif --- src/dehacked.c | 42 ----------------- src/info.c | 124 ++++++++++++++++--------------------------------- src/info.h | 42 ----------------- src/p_enemy.c | 26 +++++++---- src/p_mobj.c | 43 ++++++++++------- src/p_user.c | 6 +-- 6 files changed, 88 insertions(+), 195 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index d6ad00962..e191b4968 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4622,16 +4622,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE_DIE2", "S_EGGMOBILE_DIE3", "S_EGGMOBILE_DIE4", - "S_EGGMOBILE_DIE5", - "S_EGGMOBILE_DIE6", - "S_EGGMOBILE_DIE7", - "S_EGGMOBILE_DIE8", - "S_EGGMOBILE_DIE9", - "S_EGGMOBILE_DIE10", - "S_EGGMOBILE_DIE11", - "S_EGGMOBILE_DIE12", - "S_EGGMOBILE_DIE13", - "S_EGGMOBILE_DIE14", "S_EGGMOBILE_FLEE1", "S_EGGMOBILE_FLEE2", "S_EGGMOBILE_BALL", @@ -4652,16 +4642,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE2_DIE2", "S_EGGMOBILE2_DIE3", "S_EGGMOBILE2_DIE4", - "S_EGGMOBILE2_DIE5", - "S_EGGMOBILE2_DIE6", - "S_EGGMOBILE2_DIE7", - "S_EGGMOBILE2_DIE8", - "S_EGGMOBILE2_DIE9", - "S_EGGMOBILE2_DIE10", - "S_EGGMOBILE2_DIE11", - "S_EGGMOBILE2_DIE12", - "S_EGGMOBILE2_DIE13", - "S_EGGMOBILE2_DIE14", "S_EGGMOBILE2_FLEE1", "S_EGGMOBILE2_FLEE2", @@ -4711,16 +4691,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE3_DIE2", "S_EGGMOBILE3_DIE3", "S_EGGMOBILE3_DIE4", - "S_EGGMOBILE3_DIE5", - "S_EGGMOBILE3_DIE6", - "S_EGGMOBILE3_DIE7", - "S_EGGMOBILE3_DIE8", - "S_EGGMOBILE3_DIE9", - "S_EGGMOBILE3_DIE10", - "S_EGGMOBILE3_DIE11", - "S_EGGMOBILE3_DIE12", - "S_EGGMOBILE3_DIE13", - "S_EGGMOBILE3_DIE14", "S_EGGMOBILE3_FLEE1", "S_EGGMOBILE3_FLEE2", @@ -4767,16 +4737,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE4_DIE2", "S_EGGMOBILE4_DIE3", "S_EGGMOBILE4_DIE4", - "S_EGGMOBILE4_DIE5", - "S_EGGMOBILE4_DIE6", - "S_EGGMOBILE4_DIE7", - "S_EGGMOBILE4_DIE8", - "S_EGGMOBILE4_DIE9", - "S_EGGMOBILE4_DIE10", - "S_EGGMOBILE4_DIE11", - "S_EGGMOBILE4_DIE12", - "S_EGGMOBILE4_DIE13", - "S_EGGMOBILE4_DIE14", "S_EGGMOBILE4_FLEE1", "S_EGGMOBILE4_FLEE2", "S_EGGMOBILE4_MACE", @@ -5153,8 +5113,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_METALSONIC_DEATH4", "S_METALSONIC_FLEE1", "S_METALSONIC_FLEE2", - "S_METALSONIC_FLEE3", - "S_METALSONIC_FLEE4", "S_MSSHIELD_F1", "S_MSSHIELD_F2", diff --git a/src/info.c b/src/info.c index 3f2e95ad4..182b5950c 100644 --- a/src/info.c +++ b/src/info.c @@ -1043,8 +1043,8 @@ state_t states[NUMSTATES] = {SPR_CBFS, 7, 1, {A_FaceStabHurl}, 6, S_FACESTABBER_CHARGE4, S_FACESTABBER_CHARGE3}, // S_FACESTABBER_CHARGE3 {SPR_CBFS, 7, 1, {A_FaceStabMiss}, 0, S_FACESTABBER_STND1, S_FACESTABBER_CHARGE4}, // S_FACESTABBER_CHARGE4 {SPR_CBFS, 0, 35, {A_Pain}, 0, 0, S_FACESTABBER_STND1}, // S_FACESTABBER_PAIN - {SPR_CBFS, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_FACESTABBER_DIE2}, // S_FACESTABBER_DIE1 - {SPR_NULL, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_FACESTABBER_DIE3}, // S_FACESTABBER_DIE2 + {SPR_CBFS, 0, 2, {A_BossScream}, 1, 0, S_FACESTABBER_DIE2}, // S_FACESTABBER_DIE1 + {SPR_NULL, 0, 2, {A_BossScream}, 1, 0, S_FACESTABBER_DIE3}, // S_FACESTABBER_DIE2 {SPR_NULL, 0, 0, {A_Repeat}, 7, S_FACESTABBER_DIE1, S_XPLD_FLICKY}, // S_FACESTABBER_DIE3 {SPR_STAB, FF_PAPERSPRITE|FF_TRANS50|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_FACESTABBERSPEAR @@ -1213,22 +1213,12 @@ state_t states[NUMSTATES] = {SPR_EGGM, 0, 35, {NULL}, 0, 0, S_EGGMOBILE_STND }, // S_EGGMOBILE_PANIC7 {SPR_EGGM, 21, 24, {A_Pain}, 0, 0, S_EGGMOBILE_PAIN2}, // S_EGGMOBILE_PAIN {SPR_EGGM, 21, 16, {A_SkullAttack}, 1, 1, S_EGGMOBILE_STND}, // S_EGGMOBILE_PAIN2 - {SPR_EGGM, 22, 8, {A_Fall}, 0, 0, S_EGGMOBILE_DIE2}, // S_EGGMOBILE_DIE1 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE3}, // S_EGGMOBILE_DIE2 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE4}, // S_EGGMOBILE_DIE3 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE5}, // S_EGGMOBILE_DIE4 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE6}, // S_EGGMOBILE_DIE5 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE7}, // S_EGGMOBILE_DIE6 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE8}, // S_EGGMOBILE_DIE7 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE9}, // S_EGGMOBILE_DIE8 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE10}, // S_EGGMOBILE_DIE9 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE11}, // S_EGGMOBILE_DIE10 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE12}, // S_EGGMOBILE_DIE11 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE13}, // S_EGGMOBILE_DIE12 - {SPR_EGGM, 22, 8, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE14}, // S_EGGMOBILE_DIE13 - {SPR_EGGM, 22, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE_DIE14 - {SPR_EGGM, 23, 5, {NULL}, 0, 0, S_EGGMOBILE_FLEE2}, // S_EGGMOBILE_FLEE1 - {SPR_EGGM, 24, 5, {NULL}, 0, 0, S_EGGMOBILE_FLEE1}, // S_EGGMOBILE_FLEE2 + {SPR_EGGM, 22, 2, {A_Fall}, 0, 0, S_EGGMOBILE_DIE2}, // S_EGGMOBILE_DIE1 + {SPR_EGGM, 22, 2, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE3}, // S_EGGMOBILE_DIE2 + {SPR_EGGM, 22, 0, {A_Repeat}, 17, S_EGGMOBILE_DIE2, S_EGGMOBILE_DIE4}, // S_EGGMOBILE_DIE3 + {SPR_EGGM, 22, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE_DIE4 + {SPR_EGGM, 23, 1, {NULL}, 0, 0, S_EGGMOBILE_FLEE2}, // S_EGGMOBILE_FLEE1 + {SPR_EGGM, 24, 1, {A_BossScream}, 0, 0, S_EGGMOBILE_FLEE1}, // S_EGGMOBILE_FLEE2 {SPR_UNID, 1, 1, {A_UnidusBall}, 2, 0, S_EGGMOBILE_BALL}, // S_EGGMOBILE_BALL {SPR_NULL, 0, 1, {A_FocusTarget}, 0, 0, S_EGGMOBILE_TARGET}, // S_EGGMOBILE_TARGET @@ -1243,22 +1233,12 @@ state_t states[NUMSTATES] = {SPR_EGGN, 1, 2, {NULL}, 0, 0, S_EGGMOBILE2_POGO4}, // S_EGGMOBILE2_POGO7 {SPR_EGGN, 3, 24, {A_Boss2TakeDamage}, 24+TICRATE, 0, S_EGGMOBILE2_STND}, // S_EGGMOBILE2_PAIN {SPR_EGGN, 4, 24, {A_Boss2TakeDamage}, 24+TICRATE, 0, S_EGGMOBILE2_POGO4}, // S_EGGMOBILE2_PAIN2 - {SPR_EGGN, 5, 8, {A_Fall}, 0, 0, S_EGGMOBILE2_DIE2}, // S_EGGMOBILE2_DIE1 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE3}, // S_EGGMOBILE2_DIE2 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE4}, // S_EGGMOBILE2_DIE3 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE5}, // S_EGGMOBILE2_DIE4 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE6}, // S_EGGMOBILE2_DIE5 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE7}, // S_EGGMOBILE2_DIE6 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE8}, // S_EGGMOBILE2_DIE7 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE9}, // S_EGGMOBILE2_DIE8 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE10}, // S_EGGMOBILE2_DIE9 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE11}, // S_EGGMOBILE2_DIE10 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE12}, // S_EGGMOBILE2_DIE11 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE13}, // S_EGGMOBILE2_DIE12 - {SPR_EGGN, 5, 8, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE14}, // S_EGGMOBILE2_DIE13 - {SPR_EGGN, 5, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE2_DIE14 - {SPR_EGGN, 6, 5, {NULL}, 0, 0, S_EGGMOBILE2_FLEE2}, // S_EGGMOBILE2_FLEE1 - {SPR_EGGN, 7, 5, {NULL}, 0, 0, S_EGGMOBILE2_FLEE1}, // S_EGGMOBILE2_FLEE2 + {SPR_EGGN, 5, 2, {A_Fall}, 0, 0, S_EGGMOBILE2_DIE2}, // S_EGGMOBILE2_DIE1 + {SPR_EGGN, 5, 2, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE3}, // S_EGGMOBILE2_DIE2 + {SPR_EGGN, 5, 0, {A_Repeat}, 17, S_EGGMOBILE2_DIE2, S_EGGMOBILE2_DIE4}, // S_EGGMOBILE2_DIE3 + {SPR_EGGN, 5, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE2_DIE4 + {SPR_EGGN, 6, 1, {NULL}, 0, 0, S_EGGMOBILE2_FLEE2}, // S_EGGMOBILE2_FLEE1 + {SPR_EGGN, 7, 1, {A_BossScream}, 0, 0, S_EGGMOBILE2_FLEE1}, // S_EGGMOBILE2_FLEE2 {SPR_TNKA, 0, 35, {NULL}, 0, 0, S_NULL}, // S_BOSSTANK1 {SPR_TNKB, 0, 35, {NULL}, 0, 0, S_NULL}, // S_BOSSTANK2 @@ -1302,22 +1282,12 @@ state_t states[NUMSTATES] = {SPR_EGGO, 7, 4, {NULL}, 0, 0, S_EGGMOBILE3_STND}, // S_EGGMOBILE3_LAUGH20 {SPR_EGGO, 8, 1, {A_Boss3TakeDamage}, 0, 0, S_EGGMOBILE3_PAIN2}, // S_EGGMOBILE3_PAIN {SPR_EGGO, 8, 23, {A_Pain}, 0, 0, S_EGGMOBILE3_STND}, // S_EGGMOBILE3_PAIN2 - {SPR_EGGO, 9, 8, {A_Fall}, 0, 0, S_EGGMOBILE3_DIE2}, // S_EGGMOBILE3_DIE1 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE3}, // S_EGGMOBILE3_DIE2 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE4}, // S_EGGMOBILE3_DIE3 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE5}, // S_EGGMOBILE3_DIE4 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE6}, // S_EGGMOBILE3_DIE5 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE7}, // S_EGGMOBILE3_DIE6 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE8}, // S_EGGMOBILE3_DIE7 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE9}, // S_EGGMOBILE3_DIE8 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE10}, // S_EGGMOBILE3_DIE9 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE11}, // S_EGGMOBILE3_DIE10 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE12}, // S_EGGMOBILE3_DIE11 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE13}, // S_EGGMOBILE3_DIE12 - {SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE14}, // S_EGGMOBILE3_DIE13 - {SPR_EGGO, 9, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE3_DIE14 - {SPR_EGGO, 10, 5, {NULL}, 0, 0, S_EGGMOBILE3_FLEE2}, // S_EGGMOBILE3_FLEE1 - {SPR_EGGO, 11, 5, {NULL}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2 + {SPR_EGGO, 9, 2, {A_Fall}, 0, 0, S_EGGMOBILE3_DIE2}, // S_EGGMOBILE3_DIE1 + {SPR_EGGO, 9, 2, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE3}, // S_EGGMOBILE3_DIE2 + {SPR_EGGO, 9, 0, {A_Repeat}, 17, S_EGGMOBILE3_DIE2, S_EGGMOBILE3_DIE4}, // S_EGGMOBILE3_DIE3 + {SPR_EGGO, 9, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE3_DIE4 + {SPR_EGGO, 10, 1, {NULL}, 0, 0, S_EGGMOBILE3_FLEE2}, // S_EGGMOBILE3_FLEE1 + {SPR_EGGO, 11, 1, {A_BossScream}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2 // Boss 3 Propeller {SPR_PRPL, 0, 1, {NULL}, 0, 0, S_PROPELLER2}, // S_PROPELLER1 @@ -1358,26 +1328,16 @@ state_t states[NUMSTATES] = {SPR_EGGP,13|FF_ANIMATE, -1, {NULL}, 1, 10, S_NULL}, // S_EGGMOBILE4_RAISE2 {SPR_EGGP,11, 0, {A_Boss4Reverse}, sfx_alarm, sfx_s3k60, S_EGGMOBILE4_PAIN2}, // S_EGGMOBILE4_PAIN1 {SPR_EGGP,11, 24, {A_Pain}, 0, 0, S_EGGMOBILE4_STND}, // S_EGGMOBILE4_PAIN2 - {SPR_EGGP,12, 8, {A_Fall}, 0, 0, S_EGGMOBILE4_DIE2}, // S_EGGMOBILE4_DIE1 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE3}, // S_EGGMOBILE4_DIE2 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE4}, // S_EGGMOBILE4_DIE3 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE5}, // S_EGGMOBILE4_DIE4 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE6}, // S_EGGMOBILE4_DIE5 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE7}, // S_EGGMOBILE4_DIE6 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE8}, // S_EGGMOBILE4_DIE7 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE9}, // S_EGGMOBILE4_DIE8 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE10}, // S_EGGMOBILE4_DIE9 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE11}, // S_EGGMOBILE4_DIE10 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE12}, // S_EGGMOBILE4_DIE11 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE13}, // S_EGGMOBILE4_DIE12 - {SPR_EGGP,12, 8, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE14}, // S_EGGMOBILE4_DIE13 - {SPR_EGGP,12, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE4_DIE14 - {SPR_EGGP,13, 5, {NULL}, 0, 0, S_EGGMOBILE4_FLEE2}, // S_EGGMOBILE4_FLEE1 - {SPR_EGGP,14, 5, {NULL}, 0, 0, S_EGGMOBILE4_FLEE1}, // S_EGGMOBILE4_FLEE2 + {SPR_EGGP,12, 2, {A_Fall}, 0, 0, S_EGGMOBILE4_DIE2}, // S_EGGMOBILE4_DIE1 + {SPR_EGGP,12, 2, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE3}, // S_EGGMOBILE4_DIE2 + {SPR_EGGP,12, 0, {A_Repeat}, 17, S_EGGMOBILE4_DIE2, S_EGGMOBILE4_DIE4}, // S_EGGMOBILE4_DIE3 + {SPR_EGGP,12, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE4_DIE4 + {SPR_EGGP,13, 1, {NULL}, 0, 0, S_EGGMOBILE4_FLEE2}, // S_EGGMOBILE4_FLEE1 + {SPR_EGGP,14, 1, {A_BossScream}, 0, 0, S_EGGMOBILE4_FLEE1}, // S_EGGMOBILE4_FLEE2 {SPR_BMCE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_EGGMOBILE4_MACE - {SPR_BMCE, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_EGGMOBILE4_MACE_DIE2}, // S_EGGMOBILE4_MACE_DIE1 - {SPR_NULL, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_EGGMOBILE4_MACE_DIE3}, // S_EGGMOBILE4_MACE_DIE2 - {SPR_NULL, 0, 0, {A_Repeat}, 7, S_EGGMOBILE4_MACE_DIE1, S_BOSSEXPLODE}, // S_EGGMOBILE4_MACE_DIE3 + {SPR_BMCE, 0, 2, {A_BossScream}, 1, 0, S_EGGMOBILE4_MACE_DIE2}, // S_EGGMOBILE4_MACE_DIE1 + {SPR_NULL, 0, 2, {A_BossScream}, 1, 0, S_EGGMOBILE4_MACE_DIE3}, // S_EGGMOBILE4_MACE_DIE2 + {SPR_NULL, 0, 0, {A_Repeat}, 7, S_EGGMOBILE4_MACE_DIE1, S_SONIC3KBOSSEXPLOSION1}, // S_EGGMOBILE4_MACE_DIE3 // Boss 4 jet flame {SPR_EFIR, FF_FULLBRIGHT|FF_ANIMATE, -1, {NULL}, 1, 1, S_NULL}, // S_JETFLAME @@ -1618,7 +1578,7 @@ state_t states[NUMSTATES] = {SPR_BRAK, 18, 0, {A_CheckHealth}, 3, S_CYBRAKDEMON_PAIN3, S_CYBRAKDEMON_CHOOSE_ATTACK1}, // S_CYBRAKDEMON_PAIN2 {SPR_BRAK, 18, 0, {A_LinedefExecute}, LE_PINCHPHASE, 0, S_CYBRAKDEMON_CHOOSE_ATTACK1}, // S_CYBRAKDEMON_PAIN3 {SPR_BRAK, 18, 1, {A_Repeat}, 1, S_CYBRAKDEMON_DIE1, S_CYBRAKDEMON_DIE2}, // S_CYBRAKDEMON_DIE1 - {SPR_BRAK, 18, 2, {A_BossScream}, 0, MT_SONIC3KBOSSEXPLODE, S_CYBRAKDEMON_DIE3}, // S_CYBRAKDEMON_DIE2 + {SPR_BRAK, 18, 2, {A_BossScream}, 0, 0, S_CYBRAKDEMON_DIE3}, // S_CYBRAKDEMON_DIE2 {SPR_BRAK, 18, 0, {A_Repeat}, 52, S_CYBRAKDEMON_DIE2, S_CYBRAKDEMON_DIE4}, // S_CYBRAKDEMON_DIE3 {SPR_BRAK, 13, 14, {A_PlaySound}, sfx_bedie2, 0, S_CYBRAKDEMON_DIE5}, // S_CYBRAKDEMON_DIE4 {SPR_BRAK, 14, 7, {NULL}, 0, 0, S_CYBRAKDEMON_DIE6}, // S_CYBRAKDEMON_DIE5 @@ -1734,7 +1694,7 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {A_SetFuse}, TICRATE, 0, S_CYBRAKDEMONVILEEXPLOSION2}, //S_CYBRAKDEMONVILEEXPLOSION1, {SPR_NULL, 0, 0, {A_ScoreRise}, 0, 0, S_CYBRAKDEMONVILEEXPLOSION3}, //S_CYBRAKDEMONVILEEXPLOSION2, - {SPR_NULL, 0, 1, {A_BossScream}, 0, MT_SONIC3KBOSSEXPLODE, S_CYBRAKDEMONVILEEXPLOSION1}, //S_CYBRAKDEMONVILEEXPLOSION3, + {SPR_NULL, 0, 1, {A_BossScream}, 0, 0, S_CYBRAKDEMONVILEEXPLOSION1}, //S_CYBRAKDEMONVILEEXPLOSION3, // Metal Sonic {SPR_METL, 0, 35, {NULL}, 0, 0, S_METALSONIC_WAIT1}, // S_METALSONIC_STAND @@ -1763,14 +1723,12 @@ state_t states[NUMSTATES] = {SPR_METL, 16, -1, {NULL}, 0, 0, S_NULL}, // S_METALSONIC_BADBOUNCE {SPR_METL, 13, -1, {NULL}, 0, 0, S_METALSONIC_GATHER},// S_METALSONIC_SHOOT {SPR_METL, 11, 40, {A_Pain}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_PAIN - {SPR_METL, 13, 8, {A_Fall}, 0, 0, S_METALSONIC_DEATH2},// S_METALSONIC_DEATH1 - {SPR_METL, 13, 8, {A_BossScream}, 0, 0, S_METALSONIC_DEATH3},// S_METALSONIC_DEATH2 - {SPR_METL, 13, 0, {A_Repeat}, 11, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4}, // S_METALSONIC_DEATH3 + {SPR_METL, 13, 2, {A_Fall}, 0, 0, S_METALSONIC_DEATH2},// S_METALSONIC_DEATH1 + {SPR_METL, 13, 4, {A_BossScream}, 0, 0, S_METALSONIC_DEATH3},// S_METALSONIC_DEATH2 + {SPR_METL, 13, 0, {A_Repeat}, 8, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4}, // S_METALSONIC_DEATH3 {SPR_METL, 13, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_METALSONIC_DEATH4 - {SPR_METL, 11, 4, {NULL}, 0, 0, S_METALSONIC_FLEE2}, // S_METALSONIC_FLEE1 - {SPR_METL, 11, 4, {A_BossScream}, 0, 0, S_METALSONIC_FLEE3}, // S_METALSONIC_FLEE2 - {SPR_METL, 11, 4, {NULL}, 0, 0, S_METALSONIC_FLEE4}, // S_METALSONIC_FLEE3 - {SPR_METL, 11, 4, {NULL}, 0, 0, S_METALSONIC_FLEE1}, // S_METALSONIC_FLEE4 + {SPR_METL, 11, 7, {NULL}, 0, 0, S_METALSONIC_FLEE2}, // S_METALSONIC_FLEE1 + {SPR_METL, 11, 1, {A_BossScream}, 0, 0, S_METALSONIC_FLEE1}, // S_METALSONIC_FLEE2 {SPR_MSCF, FF_FULLBRIGHT|FF_TRANS30| 0, 1, {NULL}, 0, 0, S_MSSHIELD_F2}, // S_MSSHIELD_F1 {SPR_MSCF, FF_FULLBRIGHT|FF_TRANS30| 1, 1, {NULL}, 0, 0, S_MSSHIELD_F3}, // S_MSSHIELD_F2 @@ -3733,8 +3691,8 @@ state_t states[NUMSTATES] = {SPR_HIVE, 2, 2, {NULL}, 0, 0, S_HIVEELEMENTAL_DORMANT}, // S_HIVEELEMENTAL_SHOOT2 {SPR_HIVE, 0, 5, {A_ParentTriesToSleep}, S_HIVEELEMENTAL_PREPARE1, 0, S_HIVEELEMENTAL_DORMANT}, // S_HIVEELEMENTAL_DORMANT {SPR_HIVE, 3, 35, {A_Pain}, 0, 0, S_HIVEELEMENTAL_LOOK}, // S_HIVEELEMENTAL_PAIN - {SPR_HIVE, 3, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_HIVEELEMENTAL_DIE2}, // S_HIVEELEMENTAL_DIE1 - {SPR_NULL, 0, 2, {A_BossScream}, 1, MT_SONIC3KBOSSEXPLODE, S_HIVEELEMENTAL_DIE3}, // S_HIVEELEMENTAL_DIE2 + {SPR_HIVE, 3, 2, {A_BossScream}, 1, 0, S_HIVEELEMENTAL_DIE2}, // S_HIVEELEMENTAL_DIE1 + {SPR_NULL, 0, 2, {A_BossScream}, 1, 0, S_HIVEELEMENTAL_DIE3}, // S_HIVEELEMENTAL_DIE2 {SPR_NULL, 0, 0, {A_Repeat}, 7, S_HIVEELEMENTAL_DIE1, S_XPLD_FLICKY}, // S_HIVEELEMENTAL_DIE3 {SPR_BUMB, 1, 10, {NULL}, 0, 0, S_BUMBLEBORE_LOOK1}, // S_BUMBLEBORE_SPAWN @@ -5396,7 +5354,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP, // flags + MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, @@ -5423,7 +5381,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP, // flags + MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, @@ -5450,7 +5408,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP, // flags + MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index d51744044..c0f40e571 100644 --- a/src/info.h +++ b/src/info.h @@ -1370,16 +1370,6 @@ typedef enum state S_EGGMOBILE_DIE2, S_EGGMOBILE_DIE3, S_EGGMOBILE_DIE4, - S_EGGMOBILE_DIE5, - S_EGGMOBILE_DIE6, - S_EGGMOBILE_DIE7, - S_EGGMOBILE_DIE8, - S_EGGMOBILE_DIE9, - S_EGGMOBILE_DIE10, - S_EGGMOBILE_DIE11, - S_EGGMOBILE_DIE12, - S_EGGMOBILE_DIE13, - S_EGGMOBILE_DIE14, S_EGGMOBILE_FLEE1, S_EGGMOBILE_FLEE2, S_EGGMOBILE_BALL, @@ -1400,16 +1390,6 @@ typedef enum state S_EGGMOBILE2_DIE2, S_EGGMOBILE2_DIE3, S_EGGMOBILE2_DIE4, - S_EGGMOBILE2_DIE5, - S_EGGMOBILE2_DIE6, - S_EGGMOBILE2_DIE7, - S_EGGMOBILE2_DIE8, - S_EGGMOBILE2_DIE9, - S_EGGMOBILE2_DIE10, - S_EGGMOBILE2_DIE11, - S_EGGMOBILE2_DIE12, - S_EGGMOBILE2_DIE13, - S_EGGMOBILE2_DIE14, S_EGGMOBILE2_FLEE1, S_EGGMOBILE2_FLEE2, @@ -1459,16 +1439,6 @@ typedef enum state S_EGGMOBILE3_DIE2, S_EGGMOBILE3_DIE3, S_EGGMOBILE3_DIE4, - S_EGGMOBILE3_DIE5, - S_EGGMOBILE3_DIE6, - S_EGGMOBILE3_DIE7, - S_EGGMOBILE3_DIE8, - S_EGGMOBILE3_DIE9, - S_EGGMOBILE3_DIE10, - S_EGGMOBILE3_DIE11, - S_EGGMOBILE3_DIE12, - S_EGGMOBILE3_DIE13, - S_EGGMOBILE3_DIE14, S_EGGMOBILE3_FLEE1, S_EGGMOBILE3_FLEE2, @@ -1515,16 +1485,6 @@ typedef enum state S_EGGMOBILE4_DIE2, S_EGGMOBILE4_DIE3, S_EGGMOBILE4_DIE4, - S_EGGMOBILE4_DIE5, - S_EGGMOBILE4_DIE6, - S_EGGMOBILE4_DIE7, - S_EGGMOBILE4_DIE8, - S_EGGMOBILE4_DIE9, - S_EGGMOBILE4_DIE10, - S_EGGMOBILE4_DIE11, - S_EGGMOBILE4_DIE12, - S_EGGMOBILE4_DIE13, - S_EGGMOBILE4_DIE14, S_EGGMOBILE4_FLEE1, S_EGGMOBILE4_FLEE2, S_EGGMOBILE4_MACE, @@ -1901,8 +1861,6 @@ typedef enum state S_METALSONIC_DEATH4, S_METALSONIC_FLEE1, S_METALSONIC_FLEE2, - S_METALSONIC_FLEE3, - S_METALSONIC_FLEE4, S_MSSHIELD_F1, S_MSSHIELD_F2, diff --git a/src/p_enemy.c b/src/p_enemy.c index 0d1b80bfa..8086252f2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3349,7 +3349,7 @@ void A_BossZoom(mobj_t *actor) // var1: // 0 - Use movecount to spawn explosions evenly // 1 - Use P_Random to spawn explosions at complete random -// var2 = Object to spawn. Default is MT_BOSSEXPLODE. +// var2 = Object to spawn. Default is MT_SONIC3KBOSSEXPLODE. // void A_BossScream(mobj_t *actor) { @@ -3381,7 +3381,7 @@ void A_BossScream(mobj_t *actor) // Determine what mobj to spawn. If undefined or invalid, use MT_BOSSEXPLODE as default. if (locvar2 <= 0 || locvar2 >= NUMMOBJTYPES) - explodetype = MT_BOSSEXPLODE; + explodetype = MT_SONIC3KBOSSEXPLODE; //MT_BOSSEXPLODE; -- piss to you, sonic 2 else explodetype = (mobjtype_t)locvar2; @@ -3948,14 +3948,24 @@ bossjustdie: mo->flags |= MF_NOGRAVITY|MF_NOCLIP; mo->flags |= MF_NOCLIPHEIGHT; + mo->movedir = 0; + mo->extravalue1 = 35; + mo->flags2 |= MF2_BOSSFLEE; + mo->momz = 2*mo->scale; + if (mo->target) { - mo->angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y); - mo->flags2 |= MF2_BOSSFLEE; - mo->momz = FixedMul(FixedDiv(mo->target->z - mo->z, P_AproxDistance(mo->x-mo->target->x,mo->y-mo->target->y)), FixedMul(2*FRACUNIT, mo->scale)); + angle_t diff = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y) - mo->angle; + if (diff) + { + if (diff > ANGLE_180) + diff = InvAngle(InvAngle(diff)/mo->extravalue1); + else + diff /= mo->extravalue1; + mo->movedir = diff; + } } - else - mo->momz = FixedMul(2*FRACUNIT, mo->scale); + break; } } @@ -12004,7 +12014,7 @@ void A_MineExplode(mobj_t *actor) { #define dist 64 UINT8 i; - mobjtype_t type = ((actor->eflags & MFE_UNDERWATER) ? MT_UWEXPLODE : MT_BOSSEXPLODE); + mobjtype_t type = ((actor->eflags & MFE_UNDERWATER) ? MT_UWEXPLODE : MT_SONIC3KBOSSEXPLODE); S_StartSound(actor, ((actor->eflags & MFE_UNDERWATER) ? sfx_s3k57 : sfx_s3k4e)); P_SpawnMobj(actor->x, actor->y, actor->z, type); for (i = 0; i < 16; i++) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5482f1a5d..60a4e9e63 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4236,12 +4236,7 @@ static void P_GenericBossThinker(mobj_t *mobj) if (!mobj->target || !(mobj->target->flags & MF_SHOOTABLE)) { if (mobj->health <= 0) - { - // look for a new target - if (P_BossTargetPlayer(mobj, false) && mobj->info->mass) // Bid farewell! - S_StartSound(mobj, mobj->info->mass); return; - } // look for a new target if (P_BossTargetPlayer(mobj, false) && mobj->info->seesound) @@ -4263,7 +4258,7 @@ static void P_GenericBossThinker(mobj_t *mobj) // AI for the first boss. static void P_Boss1Thinker(mobj_t *mobj) { - if (mobj->flags2 & MF2_FRET && (statenum_t)(mobj->state-states) == mobj->info->spawnstate) { + if (mobj->flags2 & MF2_FRET && (statenum_t)(mobj->state-states) < mobj->info->painstate) { mobj->flags2 &= ~(MF2_FRET|MF2_SKULLFLY); mobj->momx = mobj->momy = mobj->momz = 0; } @@ -4281,11 +4276,7 @@ static void P_Boss1Thinker(mobj_t *mobj) return; // It's okay, then. if (mobj->health <= 0) - { - if (P_BossTargetPlayer(mobj, false) && mobj->info->mass) // Bid farewell! - S_StartSound(mobj, mobj->info->mass); return; - } // look for a new target if (P_BossTargetPlayer(mobj, false) && mobj->info->seesound) @@ -4332,12 +4323,7 @@ static void P_Boss2Thinker(mobj_t *mobj) if (mobj->health <= mobj->info->damage && (!mobj->target || !(mobj->target->flags & MF_SHOOTABLE))) { if (mobj->health <= 0) - { - // look for a new target - if (P_BossTargetPlayer(mobj, false) && mobj->info->mass) // Bid farewell! - S_StartSound(mobj, mobj->info->mass); return; - } // look for a new target if (P_BossTargetPlayer(mobj, false) && mobj->info->seesound) @@ -7107,6 +7093,11 @@ void P_MobjThinker(mobj_t *mobj) switch (mobj->type) { + case MT_BOSSTANK1: + case MT_BOSSTANK2: + case MT_BOSSSPIGOT: + mobj->flags2 ^= MF2_DONTDRAW; + break; case MT_MACEPOINT: case MT_CHAINMACEPOINT: case MT_SPRINGBALLPOINT: @@ -7730,7 +7721,25 @@ void P_MobjThinker(mobj_t *mobj) break; } if (mobj->flags2 & MF2_BOSSFLEE) - P_InstaThrust(mobj, mobj->angle, FixedMul(12*FRACUNIT, mobj->scale)); + { + if (mobj->extravalue1) + { + if (!(--mobj->extravalue1)) + { + if (mobj->target) + { + mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, P_AproxDistance(mobj->x-mobj->target->x,mobj->y-mobj->target->y)), mobj->scale<<1); + mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + } + else + mobj->momz = 8*mobj->scale; + } + else + mobj->angle += mobj->movedir; + } + else if (mobj->target) + P_InstaThrust(mobj, mobj->angle, FixedMul(12*FRACUNIT, mobj->scale)); + } } else if (mobj->health <= 0) // Dead things think differently than the living. switch (mobj->type) @@ -7842,7 +7851,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->x + (P_RandomRange(r, -r) << FRACBITS), mobj->y + (P_RandomRange(r, -r) << FRACBITS), mobj->z + (P_RandomKey(mobj->height >> FRACBITS) << FRACBITS), - MT_BOSSEXPLODE); + MT_SONIC3KBOSSEXPLODE); S_StartSound(explosion, sfx_cybdth); } if (mobj->movedir == DMG_DROWNED) diff --git a/src/p_user.c b/src/p_user.c index 0861398d6..131dc8d61 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6509,12 +6509,12 @@ static void P_DoNiGHTSCapsule(player_t *player) player->capsule->health = sphereresult; } - // Spawn a 'pop' for every 5 tics - if (!((tictimer - firstpoptic) % 5)) + // Spawn a 'pop' for every 2 tics + if (!((tictimer - firstpoptic) % 2)) S_StartSound(P_SpawnMobj(player->capsule->x + ((P_SignedRandom()/2)<capsule->y + ((P_SignedRandom()/2)<capsule->z + (player->capsule->height/2) + ((P_SignedRandom()/2)< Date: Mon, 12 Aug 2019 14:00:26 +0100 Subject: [PATCH 08/39] Turn Color_Opposite into a 2D array to simplify usage somewhat. Also fix ColorOpposite for Lua --- src/doomdata.h | 2 +- src/lua_mathlib.c | 12 ++--- src/m_menu.c | 4 +- src/p_enemy.c | 6 +-- src/r_draw.c | 130 +++++++++++++++++++++++----------------------- 5 files changed, 78 insertions(+), 76 deletions(-) diff --git a/src/doomdata.h b/src/doomdata.h index 38727b85c..b4142463c 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -210,7 +210,7 @@ typedef struct extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16]; extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS]; -extern const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2]; +extern const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2]; #define NUMMAPS 1035 diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 1f0d6e287..4c5424577 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -173,15 +173,15 @@ static int lib_all7emeralds(lua_State *L) return 1; } -// Whee, special Lua-exclusive function for making use of Color_Opposite[] without needing *2 or +1 -// Returns both color and frame numbers! +// Whee, special Lua-exclusive function for making use of Color_Opposite[] +// Returns both color and signpost shade numbers! static int lib_coloropposite(lua_State *L) { UINT8 colornum = (UINT8)luaL_checkinteger(L, 1); - if (colornum >= MAXSKINCOLORS) - return luaL_error(L, "skincolor %d out of range (0 - %d).", colornum, MAXSKINCOLORS-1); - lua_pushinteger(L, Color_Opposite[colornum*2]); // push color - lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame + if (!colornum || colornum >= MAXSKINCOLORS) + return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, MAXSKINCOLORS-1); + lua_pushinteger(L, Color_Opposite[colornum-1][0]); // push color + lua_pushinteger(L, Color_Opposite[colornum-1][1]); // push sign shade index, 0-15 return 2; } diff --git a/src/m_menu.c b/src/m_menu.c index ca389a94d..128b15a76 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6980,8 +6980,8 @@ static void M_DrawLoadGameData(void) col = 134; else { - col = (charskin->prefcolor - 1)*2; - col = Color_Index[Color_Opposite[col]-1][Color_Opposite[col+1]]; + col = charskin->prefcolor - 1; + col = Color_Index[Color_Opposite[col][0]-1][Color_Opposite[col][1]]; } V_DrawFill(x+6, y+64, 72, 50, col); diff --git a/src/p_enemy.c b/src/p_enemy.c index 4126d0716..7bc9c14b7 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4898,12 +4898,12 @@ void A_SignPlayer(mobj_t *actor) of in the name. If you have a better idea, feel free to let me know. ~toast 2016/07/20 */ - actor->frame += (15 - Color_Opposite[(Color_Opposite[(skin->prefoppositecolor - 1)*2] - 1)*2 + 1]); + actor->frame += (15 - Color_Opposite[Color_Opposite[skin->prefoppositecolor - 1][0] - 1][1]); } else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor. { - actor->color = Color_Opposite[(actor->target->player->skincolor - 1)*2]; - actor->frame += (15 - Color_Opposite[(actor->target->player->skincolor - 1)*2 + 1]); + actor->color = Color_Opposite[actor->target->player->skincolor - 1][0]; + actor->frame += (15 - Color_Opposite[actor->target->player->skincolor - 1][1]); } if (skin->sprites[SPR2_SIGN].numframes) diff --git a/src/r_draw.c b/src/r_draw.c index f8e435624..af82d3fa8 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -352,77 +352,79 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = A word of warning: If the following array is non-symmetrical, A_SignPlayer's prefoppositecolor behaviour will break. */ -const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2] = +// [0] = opposite skin color, +// [1] = shade index used by signpost, 0-15 (actual sprite frame is 15 minus this value) +const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = { - // SKINCOLOR_NONE,8, // SKINCOLOR_NONE + // {SKINCOLOR_NONE, 8}, // SKINCOLOR_NONE // Greyscale ranges - SKINCOLOR_BLACK,5, // SKINCOLOR_WHITE, - SKINCOLOR_JET,7, // SKINCOLOR_BONE, - SKINCOLOR_CARBON,7, // SKINCOLOR_CLOUDY, - SKINCOLOR_AETHER,12, // SKINCOLOR_GREY, - SKINCOLOR_SLATE,12, // SKINCOLOR_SILVER, - SKINCOLOR_CLOUDY,7, // SKINCOLOR_CARBON, - SKINCOLOR_BONE,7, // SKINCOLOR_JET, - SKINCOLOR_WHITE,7, // SKINCOLOR_BLACK, + {SKINCOLOR_BLACK, 5}, // SKINCOLOR_WHITE, + {SKINCOLOR_JET, 7}, // SKINCOLOR_BONE, + {SKINCOLOR_CARBON, 7}, // SKINCOLOR_CLOUDY, + {SKINCOLOR_AETHER, 12}, // SKINCOLOR_GREY, + {SKINCOLOR_SLATE, 12}, // SKINCOLOR_SILVER, + {SKINCOLOR_CLOUDY, 7}, // SKINCOLOR_CARBON, + {SKINCOLOR_BONE, 7}, // SKINCOLOR_JET, + {SKINCOLOR_WHITE, 7}, // SKINCOLOR_BLACK, // Desaturated - SKINCOLOR_GREY,15, // SKINCOLOR_AETHER, - SKINCOLOR_SILVER,12, // SKINCOLOR_SLATE, - SKINCOLOR_AZURE,9, // SKINCOLOR_PINK, - SKINCOLOR_RUST,7, // SKINCOLOR_YOGURT, - SKINCOLOR_TAN,2, // SKINCOLOR_BROWN, - SKINCOLOR_BROWN,12, // SKINCOLOR_TAN, - SKINCOLOR_MOSS,5, // SKINCOLOR_BEIGE, - SKINCOLOR_BEIGE,13, // SKINCOLOR_MOSS, - SKINCOLOR_PINK,5, // SKINCOLOR_AZURE, - SKINCOLOR_GOLD,4, // SKINCOLOR_LAVENDER, + {SKINCOLOR_GREY, 15}, // SKINCOLOR_AETHER, + {SKINCOLOR_SILVER, 12}, // SKINCOLOR_SLATE, + {SKINCOLOR_AZURE, 9}, // SKINCOLOR_PINK, + {SKINCOLOR_RUST, 7}, // SKINCOLOR_YOGURT, + {SKINCOLOR_TAN, 2}, // SKINCOLOR_BROWN, + {SKINCOLOR_BROWN, 12}, // SKINCOLOR_TAN, + {SKINCOLOR_MOSS, 5}, // SKINCOLOR_BEIGE, + {SKINCOLOR_BEIGE, 13}, // SKINCOLOR_MOSS, + {SKINCOLOR_PINK, 5}, // SKINCOLOR_AZURE, + {SKINCOLOR_GOLD, 4}, // SKINCOLOR_LAVENDER, // Viv's vivid colours (toast 21/07/17) - SKINCOLOR_EMERALD,10, // SKINCOLOR_RUBY, - SKINCOLOR_FOREST,6, // SKINCOLOR_SALMON, - SKINCOLOR_GREEN,10, // SKINCOLOR_RED, - SKINCOLOR_ICY,10, // SKINCOLOR_CRIMSON, - SKINCOLOR_PURPLE,8, // SKINCOLOR_FLAME, - SKINCOLOR_TEAL,7, // SKINCOLOR_PEACHY, - SKINCOLOR_WAVE,5, // SKINCOLOR_QUAIL, - SKINCOLOR_SAPPHIRE,5, // SKINCOLOR_SUNSET, - SKINCOLOR_CYAN,4, // SKINCOLOR_APRICOT, - SKINCOLOR_BLUE,4, // SKINCOLOR_ORANGE, - SKINCOLOR_YOGURT,8, // SKINCOLOR_RUST, - SKINCOLOR_LAVENDER,10, // SKINCOLOR_GOLD, - SKINCOLOR_SKY,8, // SKINCOLOR_SANDY, - SKINCOLOR_CORNFLOWER,8, // SKINCOLOR_YELLOW, - SKINCOLOR_DUSK,3, // SKINCOLOR_OLIVE, - SKINCOLOR_MAGENTA,9, // SKINCOLOR_LIME, - SKINCOLOR_COBALT,2, // SKINCOLOR_PERIDOT, - SKINCOLOR_RED,6, // SKINCOLOR_GREEN, - SKINCOLOR_SALMON,9, // SKINCOLOR_FOREST, - SKINCOLOR_RUBY,4, // SKINCOLOR_EMERALD, - SKINCOLOR_VIOLET,5, // SKINCOLOR_MINT, - SKINCOLOR_PLUM,6, // SKINCOLOR_SEAFOAM, - SKINCOLOR_ROSY,7, // SKINCOLOR_AQUA, - SKINCOLOR_PEACHY,7, // SKINCOLOR_TEAL, - SKINCOLOR_QUAIL,5, // SKINCOLOR_WAVE, - SKINCOLOR_APRICOT,6, // SKINCOLOR_CYAN, - SKINCOLOR_SANDY,1, // SKINCOLOR_SKY, - SKINCOLOR_NEON,4, // SKINCOLOR_CERULEAN, - SKINCOLOR_CRIMSON,0, // SKINCOLOR_ICY, - SKINCOLOR_SUNSET,5, // SKINCOLOR_SAPPHIRE, - SKINCOLOR_YELLOW,4, // SKINCOLOR_CORNFLOWER, - SKINCOLOR_ORANGE,5, // SKINCOLOR_BLUE, - SKINCOLOR_PERIDOT,5, // SKINCOLOR_COBALT, - SKINCOLOR_LILAC,4, // SKINCOLOR_VAPOR, - SKINCOLOR_OLIVE,0, // SKINCOLOR_DUSK, - SKINCOLOR_BUBBLEGUM,9, // SKINCOLOR_PASTEL, - SKINCOLOR_FLAME,7, // SKINCOLOR_PURPLE, - SKINCOLOR_PASTEL,8, // SKINCOLOR_BUBBLEGUM, - SKINCOLOR_LIME,6, // SKINCOLOR_MAGENTA, - SKINCOLOR_CERULEAN,2, // SKINCOLOR_NEON, - SKINCOLOR_MINT,6, // SKINCOLOR_VIOLET, - SKINCOLOR_VAPOR,4, // SKINCOLOR_LILAC, - SKINCOLOR_MINT,7, // SKINCOLOR_PLUM, - SKINCOLOR_AQUA,1 // SKINCOLOR_ROSY, + {SKINCOLOR_EMERALD, 10}, // SKINCOLOR_RUBY, + {SKINCOLOR_FOREST, 6}, // SKINCOLOR_SALMON, + {SKINCOLOR_GREEN, 10}, // SKINCOLOR_RED, + {SKINCOLOR_ICY, 10}, // SKINCOLOR_CRIMSON, + {SKINCOLOR_PURPLE, 8}, // SKINCOLOR_FLAME, + {SKINCOLOR_TEAL, 7}, // SKINCOLOR_PEACHY, + {SKINCOLOR_WAVE, 5}, // SKINCOLOR_QUAIL, + {SKINCOLOR_SAPPHIRE, 5}, // SKINCOLOR_SUNSET, + {SKINCOLOR_CYAN, 4}, // SKINCOLOR_APRICOT, + {SKINCOLOR_BLUE, 4}, // SKINCOLOR_ORANGE, + {SKINCOLOR_YOGURT, 8}, // SKINCOLOR_RUST, + {SKINCOLOR_LAVENDER, 10}, // SKINCOLOR_GOLD, + {SKINCOLOR_SKY, 8}, // SKINCOLOR_SANDY, + {SKINCOLOR_CORNFLOWER, 8}, // SKINCOLOR_YELLOW, + {SKINCOLOR_DUSK, 3}, // SKINCOLOR_OLIVE, + {SKINCOLOR_MAGENTA, 9}, // SKINCOLOR_LIME, + {SKINCOLOR_COBALT, 2}, // SKINCOLOR_PERIDOT, + {SKINCOLOR_RED, 6}, // SKINCOLOR_GREEN, + {SKINCOLOR_SALMON, 9}, // SKINCOLOR_FOREST, + {SKINCOLOR_RUBY, 4}, // SKINCOLOR_EMERALD, + {SKINCOLOR_VIOLET, 5}, // SKINCOLOR_MINT, + {SKINCOLOR_PLUM, 6}, // SKINCOLOR_SEAFOAM, + {SKINCOLOR_ROSY, 7}, // SKINCOLOR_AQUA, + {SKINCOLOR_PEACHY, 7}, // SKINCOLOR_TEAL, + {SKINCOLOR_QUAIL, 5}, // SKINCOLOR_WAVE, + {SKINCOLOR_APRICOT, 6}, // SKINCOLOR_CYAN, + {SKINCOLOR_SANDY, 1}, // SKINCOLOR_SKY, + {SKINCOLOR_NEON, 4}, // SKINCOLOR_CERULEAN, + {SKINCOLOR_CRIMSON, 0}, // SKINCOLOR_ICY, + {SKINCOLOR_SUNSET, 5}, // SKINCOLOR_SAPPHIRE, + {SKINCOLOR_YELLOW, 4}, // SKINCOLOR_CORNFLOWER, + {SKINCOLOR_ORANGE, 5}, // SKINCOLOR_BLUE, + {SKINCOLOR_PERIDOT, 5}, // SKINCOLOR_COBALT, + {SKINCOLOR_LILAC, 4}, // SKINCOLOR_VAPOR, + {SKINCOLOR_OLIVE, 0}, // SKINCOLOR_DUSK, + {SKINCOLOR_BUBBLEGUM, 9}, // SKINCOLOR_PASTEL, + {SKINCOLOR_FLAME, 7}, // SKINCOLOR_PURPLE, + {SKINCOLOR_PASTEL, 8}, // SKINCOLOR_BUBBLEGUM, + {SKINCOLOR_LIME, 6}, // SKINCOLOR_MAGENTA, + {SKINCOLOR_CERULEAN, 2}, // SKINCOLOR_NEON, + {SKINCOLOR_MINT, 6}, // SKINCOLOR_VIOLET, + {SKINCOLOR_VAPOR, 4}, // SKINCOLOR_LILAC, + {SKINCOLOR_MINT, 7}, // SKINCOLOR_PLUM, + {SKINCOLOR_AQUA, 1} // SKINCOLOR_ROSY, }; CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; From b7a2b3f7a2afb40e2274c31038db8a462eeae83b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 12 Aug 2019 15:02:36 +0100 Subject: [PATCH 09/39] Added switch cases to skin color related functions in r_draw.c, added extra error checking --- src/r_draw.c | 77 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index af82d3fa8..847a117ec 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -523,33 +523,44 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U INT32 i, starttranscolor, skinramplength; // Handle a couple of simple special cases - if (skinnum == TC_BOSS - || skinnum == TC_ALLWHITE - || skinnum == TC_METALSONIC - || skinnum == TC_BLINK - || color == SKINCOLOR_NONE) + if (skinnum < TC_DEFAULT) { - if (skinnum == TC_ALLWHITE) - memset(dest_colormap, 0, NUM_PALETTE_ENTRIES * sizeof(UINT8)); - else if (skinnum == TC_BLINK && color != SKINCOLOR_NONE) - memset(dest_colormap, Color_Index[color-1][3], NUM_PALETTE_ENTRIES * sizeof(UINT8)); - else + switch (skinnum) { - for (i = 0; i < NUM_PALETTE_ENTRIES; i++) - dest_colormap[i] = (UINT8)i; + case TC_RAINBOW: + R_RainbowColormap(dest_colormap, color); + return; + case TC_ALLWHITE: + memset(dest_colormap, 0, NUM_PALETTE_ENTRIES * sizeof(UINT8)); + return; + case TC_BLINK: + if (color >= MAXTRANSLATIONS) + I_Error("Invalid skin color #%hu.", (UINT16)color); + if (color != SKINCOLOR_NONE) + { + memset(dest_colormap, Color_Index[color-1][3], NUM_PALETTE_ENTRIES * sizeof(UINT8)); + return; + } + /* FALLTHRU */ + case TC_BOSS: + case TC_METALSONIC: + default: + for (i = 0; i < NUM_PALETTE_ENTRIES; i++) + dest_colormap[i] = (UINT8)i; + + // White! + if (skinnum == TC_BOSS) + dest_colormap[31] = 0; + else if (skinnum == TC_METALSONIC) + dest_colormap[159] = 0; + + return; } - - // White! - if (skinnum == TC_BOSS) - dest_colormap[31] = 0; - else if (skinnum == TC_METALSONIC) - dest_colormap[159] = 0; - - return; } - else if (skinnum == TC_RAINBOW) + else if (color == SKINCOLOR_NONE) { - R_RainbowColormap(dest_colormap, color); + for (i = 0; i < NUM_PALETTE_ENTRIES; i++) + dest_colormap[i] = (UINT8)i; return; } @@ -558,6 +569,9 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR; + if (starttranscolor >= NUM_PALETTE_ENTRIES) + I_Error("Invalid startcolor #%d.", starttranscolor); + // Fill in the entries of the palette that are fixed for (i = 0; i < starttranscolor; i++) dest_colormap[i] = (UINT8)i; @@ -570,7 +584,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U skinramplength = 16; } else - skinramplength = i - NUM_PALETTE_ENTRIES; + skinramplength = i - NUM_PALETTE_ENTRIES; // shouldn't this be NUM_PALETTE_ENTRIES - starttranscolor? // Build the translated ramp for (i = 0; i < skinramplength; i++) @@ -592,13 +606,16 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags) INT32 skintableindex; // Adjust if we want the default colormap - if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX; - else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX; - else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX; - else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX; - else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX; - else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX; - else skintableindex = skinnum; + switch (skinnum) + { + case TC_DEFAULT: skintableindex = DEFAULT_TT_CACHE_INDEX; break; + case TC_BOSS: skintableindex = BOSS_TT_CACHE_INDEX; break; + case TC_METALSONIC: skintableindex = METALSONIC_TT_CACHE_INDEX; break; + case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break; + case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break; + case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break; + default: skintableindex = skinnum; break; + } if (flags & GTC_CACHE) { From 0685b9705c5c1a8f81a880a087349504c1a0f100 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 12 Aug 2019 15:18:36 +0100 Subject: [PATCH 10/39] Initialise player_names[] in D_RegisterClientCommands such that we don't need to have to manually update it if MAXPLAYERS ever changed --- src/d_netcmd.c | 5 +++++ src/g_game.c | 42 +++--------------------------------------- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e6f5244f0..1b57dd480 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -599,6 +599,11 @@ void D_RegisterClientCommands(void) Color_cons_t[MAXSKINCOLORS].value = 0; Color_cons_t[MAXSKINCOLORS].strvalue = NULL; + // Set default player names + // Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well + for (i = 0; i < MAXPLAYERS; i++) + sprintf(player_names[i], "Player %d", i); + if (dedicated) return; diff --git a/src/g_game.c b/src/g_game.c index c96b0805c..e70241269 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -416,49 +416,13 @@ consvar_t cv_spinaxis2 = {"joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL consvar_t cv_fireaxis2 = {"joyaxis2_fire", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#if MAXPLAYERS > 32 -#error "please update player_name table using the new value for MAXPLAYERS" -#endif - #ifdef SEENAMES player_t *seenplayer; // player we're aiming at right now #endif -char player_names[MAXPLAYERS][MAXPLAYERNAME+1] = -{ - "Player 1", - "Player 2", - "Player 3", - "Player 4", - "Player 5", - "Player 6", - "Player 7", - "Player 8", - "Player 9", - "Player 10", - "Player 11", - "Player 12", - "Player 13", - "Player 14", - "Player 15", - "Player 16", - "Player 17", - "Player 18", - "Player 19", - "Player 20", - "Player 21", - "Player 22", - "Player 23", - "Player 24", - "Player 25", - "Player 26", - "Player 27", - "Player 28", - "Player 29", - "Player 30", - "Player 31", - "Player 32" -}; +// now automatically allocated in D_RegisterClientCommands +// so that it doesn't have to be updated depending on the value of MAXPLAYERS +char player_names[MAXPLAYERS][MAXPLAYERNAME+1]; INT16 rw_maximums[NUM_WEAPONS] = { From 8605d77af6a5d213639a70b91d80c2bae15d5986 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 12 Aug 2019 18:49:58 +0100 Subject: [PATCH 11/39] Fix an issue with painstate-exiting detection in the boss1 thinker. --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 60a4e9e63..a0ac38f5c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4258,7 +4258,7 @@ static void P_GenericBossThinker(mobj_t *mobj) // AI for the first boss. static void P_Boss1Thinker(mobj_t *mobj) { - if (mobj->flags2 & MF2_FRET && (statenum_t)(mobj->state-states) < mobj->info->painstate) { + if (mobj->flags2 & MF2_FRET && mobj->state->nextstate == mobj->info->spawnstate && mobj->tics == 1) { mobj->flags2 &= ~(MF2_FRET|MF2_SKULLFLY); mobj->momx = mobj->momy = mobj->momz = 0; } From e62fefad5d45f3655d37251b23fb9d71a2d3140a Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 12 Aug 2019 18:50:23 +0100 Subject: [PATCH 12/39] Tweak the animation speed of the fleeing eggmobiles' sweatdrops. --- src/info.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/info.c b/src/info.c index 182b5950c..09443a2c6 100644 --- a/src/info.c +++ b/src/info.c @@ -1217,8 +1217,8 @@ state_t states[NUMSTATES] = {SPR_EGGM, 22, 2, {A_BossScream}, 0, 0, S_EGGMOBILE_DIE3}, // S_EGGMOBILE_DIE2 {SPR_EGGM, 22, 0, {A_Repeat}, 17, S_EGGMOBILE_DIE2, S_EGGMOBILE_DIE4}, // S_EGGMOBILE_DIE3 {SPR_EGGM, 22, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE_DIE4 - {SPR_EGGM, 23, 1, {NULL}, 0, 0, S_EGGMOBILE_FLEE2}, // S_EGGMOBILE_FLEE1 - {SPR_EGGM, 24, 1, {A_BossScream}, 0, 0, S_EGGMOBILE_FLEE1}, // S_EGGMOBILE_FLEE2 + {SPR_EGGM, 23, 2, {A_BossScream}, 0, 0, S_EGGMOBILE_FLEE2}, // S_EGGMOBILE_FLEE1 + {SPR_EGGM, 24, 2, {A_BossScream}, 0, 0, S_EGGMOBILE_FLEE1}, // S_EGGMOBILE_FLEE2 {SPR_UNID, 1, 1, {A_UnidusBall}, 2, 0, S_EGGMOBILE_BALL}, // S_EGGMOBILE_BALL {SPR_NULL, 0, 1, {A_FocusTarget}, 0, 0, S_EGGMOBILE_TARGET}, // S_EGGMOBILE_TARGET @@ -1237,8 +1237,8 @@ state_t states[NUMSTATES] = {SPR_EGGN, 5, 2, {A_BossScream}, 0, 0, S_EGGMOBILE2_DIE3}, // S_EGGMOBILE2_DIE2 {SPR_EGGN, 5, 0, {A_Repeat}, 17, S_EGGMOBILE2_DIE2, S_EGGMOBILE2_DIE4}, // S_EGGMOBILE2_DIE3 {SPR_EGGN, 5, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE2_DIE4 - {SPR_EGGN, 6, 1, {NULL}, 0, 0, S_EGGMOBILE2_FLEE2}, // S_EGGMOBILE2_FLEE1 - {SPR_EGGN, 7, 1, {A_BossScream}, 0, 0, S_EGGMOBILE2_FLEE1}, // S_EGGMOBILE2_FLEE2 + {SPR_EGGN, 6, 2, {A_BossScream}, 0, 0, S_EGGMOBILE2_FLEE2}, // S_EGGMOBILE2_FLEE1 + {SPR_EGGN, 7, 2, {A_BossScream}, 0, 0, S_EGGMOBILE2_FLEE1}, // S_EGGMOBILE2_FLEE2 {SPR_TNKA, 0, 35, {NULL}, 0, 0, S_NULL}, // S_BOSSTANK1 {SPR_TNKB, 0, 35, {NULL}, 0, 0, S_NULL}, // S_BOSSTANK2 @@ -1286,8 +1286,8 @@ state_t states[NUMSTATES] = {SPR_EGGO, 9, 2, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE3}, // S_EGGMOBILE3_DIE2 {SPR_EGGO, 9, 0, {A_Repeat}, 17, S_EGGMOBILE3_DIE2, S_EGGMOBILE3_DIE4}, // S_EGGMOBILE3_DIE3 {SPR_EGGO, 9, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE3_DIE4 - {SPR_EGGO, 10, 1, {NULL}, 0, 0, S_EGGMOBILE3_FLEE2}, // S_EGGMOBILE3_FLEE1 - {SPR_EGGO, 11, 1, {A_BossScream}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2 + {SPR_EGGO, 10, 2, {A_BossScream}, 0, 0, S_EGGMOBILE3_FLEE2}, // S_EGGMOBILE3_FLEE1 + {SPR_EGGO, 11, 2, {A_BossScream}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2 // Boss 3 Propeller {SPR_PRPL, 0, 1, {NULL}, 0, 0, S_PROPELLER2}, // S_PROPELLER1 @@ -1332,8 +1332,8 @@ state_t states[NUMSTATES] = {SPR_EGGP,12, 2, {A_BossScream}, 0, 0, S_EGGMOBILE4_DIE3}, // S_EGGMOBILE4_DIE2 {SPR_EGGP,12, 0, {A_Repeat}, 17, S_EGGMOBILE4_DIE2, S_EGGMOBILE4_DIE4}, // S_EGGMOBILE4_DIE3 {SPR_EGGP,12, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE4_DIE4 - {SPR_EGGP,13, 1, {NULL}, 0, 0, S_EGGMOBILE4_FLEE2}, // S_EGGMOBILE4_FLEE1 - {SPR_EGGP,14, 1, {A_BossScream}, 0, 0, S_EGGMOBILE4_FLEE1}, // S_EGGMOBILE4_FLEE2 + {SPR_EGGP,13, 2, {A_BossScream}, 0, 0, S_EGGMOBILE4_FLEE2}, // S_EGGMOBILE4_FLEE1 + {SPR_EGGP,14, 2, {A_BossScream}, 0, 0, S_EGGMOBILE4_FLEE1}, // S_EGGMOBILE4_FLEE2 {SPR_BMCE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_EGGMOBILE4_MACE {SPR_BMCE, 0, 2, {A_BossScream}, 1, 0, S_EGGMOBILE4_MACE_DIE2}, // S_EGGMOBILE4_MACE_DIE1 {SPR_NULL, 0, 2, {A_BossScream}, 1, 0, S_EGGMOBILE4_MACE_DIE3}, // S_EGGMOBILE4_MACE_DIE2 From f5332ccf8ee9b757e637ff58172351a4e4acc931 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 12 Aug 2019 19:06:18 +0100 Subject: [PATCH 13/39] Fixed TC_RAINBOW so it doesn't accept invalid colors, whoopsies --- src/r_draw.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 847a117ec..d8b720caf 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -527,12 +527,18 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U { switch (skinnum) { - case TC_RAINBOW: - R_RainbowColormap(dest_colormap, color); - return; case TC_ALLWHITE: memset(dest_colormap, 0, NUM_PALETTE_ENTRIES * sizeof(UINT8)); return; + case TC_RAINBOW: + if (color >= MAXTRANSLATIONS) + I_Error("Invalid skin color #%hu.", (UINT16)color); + if (color != SKINCOLOR_NONE) + { + R_RainbowColormap(dest_colormap, color); + return; + } + break; case TC_BLINK: if (color >= MAXTRANSLATIONS) I_Error("Invalid skin color #%hu.", (UINT16)color); @@ -541,21 +547,20 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U memset(dest_colormap, Color_Index[color-1][3], NUM_PALETTE_ENTRIES * sizeof(UINT8)); return; } - /* FALLTHRU */ - case TC_BOSS: - case TC_METALSONIC: + break; default: - for (i = 0; i < NUM_PALETTE_ENTRIES; i++) - dest_colormap[i] = (UINT8)i; - - // White! - if (skinnum == TC_BOSS) - dest_colormap[31] = 0; - else if (skinnum == TC_METALSONIC) - dest_colormap[159] = 0; - - return; + break; } + + for (i = 0; i < NUM_PALETTE_ENTRIES; i++) + dest_colormap[i] = (UINT8)i; + + // White! + if (skinnum == TC_BOSS) + dest_colormap[31] = 0; + else if (skinnum == TC_METALSONIC) + dest_colormap[159] = 0; + return; } else if (color == SKINCOLOR_NONE) { From 324c584e5d5f0bb8cac890ee87507f197881c6b7 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 13 Aug 2019 19:41:04 +0100 Subject: [PATCH 14/39] Tweak the ACZ3 fight a little, animationwise, since every other non-Brak boss got an upgrade to its death anim in this branch. Also make its bomb throw anim use all the new sprites. --- src/dehacked.c | 2 ++ src/info.c | 24 +++++++++++++----------- src/info.h | 2 ++ src/p_inter.c | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index e191b4968..04ac2ef4b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4792,6 +4792,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FANG_FIRE3", "S_FANG_FIRE4", "S_FANG_FIREREPEAT", + "S_FANG_LOBSHOT0", "S_FANG_LOBSHOT1", "S_FANG_LOBSHOT2", "S_FANG_WAIT1", @@ -4808,6 +4809,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FANG_PINCHFALL2", "S_FANG_PINCHSKID1", "S_FANG_PINCHSKID2", + "S_FANG_PINCHLOBSHOT0", "S_FANG_PINCHLOBSHOT1", "S_FANG_PINCHLOBSHOT2", "S_FANG_PINCHLOBSHOT3", diff --git a/src/info.c b/src/info.c index 09443a2c6..9dd3718ef 100644 --- a/src/info.c +++ b/src/info.c @@ -1387,7 +1387,7 @@ state_t states[NUMSTATES] = {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_SKID3, 0, S_FANG_SKID2}, // S_FANG_SKID2 {SPR_FANG, 4, 10, {NULL}, 0, 0, S_FANG_CHOOSEATTACK}, // S_FANG_SKID3 - {SPR_FANG, 0, 0, {A_RandomState}, S_FANG_LOBSHOT1, S_FANG_FIRESTART1, S_NULL}, // S_FANG_CHOOSEATTACK + {SPR_FANG, 0, 0, {A_RandomState}, S_FANG_LOBSHOT0, S_FANG_FIRESTART1, S_NULL}, // S_FANG_CHOOSEATTACK {SPR_FANG, 5, 0, {A_PrepareRepeat}, 3, 0, S_FANG_FIRESTART2}, // S_FANG_FIRESTART1 // Reset loop {SPR_FANG, 5, 18, {A_LookForBetter}, 1, 0, S_FANG_FIRE1}, // S_FANG_FIRESTART2 @@ -1397,7 +1397,8 @@ state_t states[NUMSTATES] = {SPR_FANG, 5, 5, {NULL}, 2, 0, S_FANG_FIREREPEAT}, // S_FANG_FIRE4 {SPR_FANG, 5, 0, {A_Repeat}, 3, S_FANG_FIRE1, S_FANG_WAIT1}, // S_FANG_FIREREPEAT // End of loop - {SPR_FANG, 19, 18, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2}, // S_FANG_LOBSHOT1 + {SPR_FANG, 18, 16, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT1}, // S_FANG_LOBSHOT0 + {SPR_FANG, 19, 2, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2}, // S_FANG_LOBSHOT1 {SPR_FANG, 20, 18, {A_BrakLobShot}, MT_FBOMB, 32+(1<<16), S_FANG_WAIT1}, // S_FANG_LOBSHOT2 {SPR_FANG, FF_ANIMATE|15, 70, {NULL}, 1, 5, S_FANG_WAIT2}, // S_FANG_WAIT1 @@ -1415,17 +1416,18 @@ state_t states[NUMSTATES] = {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL2}, // S_FANG_PINCHFALL1 {SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL1}, // S_FANG_PINCHFALL2 {SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID1 - {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_PINCHLOBSHOT1, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID2 - {SPR_FANG, 19, 18, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2}, // S_FANG_PINCHLOBSHOT1 + {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_PINCHLOBSHOT0, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID2 + {SPR_FANG, 18, 16, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT1}, // S_FANG_PINCHLOBSHOT0 + {SPR_FANG, 19, 2, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2}, // S_FANG_PINCHLOBSHOT1 {SPR_FANG, 20, 30, {A_Boss5MakeItRain}, MT_FBOMB, -16, S_FANG_PINCHLOBSHOT3}, // S_FANG_PINCHLOBSHOT2 - {SPR_FANG, 19, 18, {A_LinedefExecute}, LE_BOSS4DROP, 0, S_FANG_PINCHLOBSHOT4}, // S_FANG_PINCHLOBSHOT3 - {SPR_FANG, 19, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1}, // S_FANG_PINCHLOBSHOT4 + {SPR_FANG, 20, 18, {A_LinedefExecute}, LE_BOSS4DROP, 0, S_FANG_PINCHLOBSHOT4}, // S_FANG_PINCHLOBSHOT3 + {SPR_FANG, 0, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1}, // S_FANG_PINCHLOBSHOT4 - {SPR_FANG, 14, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2}, // S_FANG_DIE1 - {SPR_FANG, 14, 1, {A_Boss5CheckOnGround}, S_FANG_DIE3, 0, S_FANG_DIE2}, // S_FANG_DIE2 + {SPR_FANG, 21, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2}, // S_FANG_DIE1 + {SPR_FANG, 21, 1, {A_Boss5CheckOnGround}, S_FANG_DIE3, 0, S_FANG_DIE2}, // S_FANG_DIE2 - {SPR_FANG, 17, 0, {A_Scream}, 0, 0, S_FANG_DIE4}, // S_FANG_DIE3 - {SPR_FANG, 17, 104, {NULL}, 0, 0, S_FANG_DIE5}, // S_FANG_DIE4 + {SPR_FANG, 22, 0, {A_Scream}, 0, 0, S_FANG_DIE4}, // S_FANG_DIE3 + {SPR_FANG, 22, 104, {NULL}, 0, 0, S_FANG_DIE5}, // S_FANG_DIE4 {SPR_FANG, 11, 0, {A_PlaySound}, sfx_jump, 0, S_FANG_DIE6}, // S_FANG_DIE5 {SPR_FANG, 11, 1, {A_ZThrust}, 6, (1<<16)|1, S_FANG_DIE7}, // S_FANG_DIE6 @@ -1437,7 +1439,7 @@ state_t states[NUMSTATES] = {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_FLEEBOUNCE2}, // S_FANG_FLEEBOUNCE1 {SPR_FANG, 10, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_FANG_FLEEBOUNCE2 - {SPR_FANG, 18, 7*TICRATE, {NULL}, 0, 0, S_NULL}, // S_FANG_KO + {SPR_FANG, 17, 7*TICRATE, {NULL}, 0, 0, S_NULL}, // S_FANG_KO {SPR_FBOM, 0, 1, {A_GhostMe}, 0, 0, S_FBOMB2}, // S_FBOMB1 {SPR_FBOM, 1, 1, {A_GhostMe}, 0, 0, S_FBOMB1}, // S_FBOMB2 diff --git a/src/info.h b/src/info.h index c0f40e571..593c1fb7c 100644 --- a/src/info.h +++ b/src/info.h @@ -1540,6 +1540,7 @@ typedef enum state S_FANG_FIRE3, S_FANG_FIRE4, S_FANG_FIREREPEAT, + S_FANG_LOBSHOT0, S_FANG_LOBSHOT1, S_FANG_LOBSHOT2, S_FANG_WAIT1, @@ -1556,6 +1557,7 @@ typedef enum state S_FANG_PINCHFALL2, S_FANG_PINCHSKID1, S_FANG_PINCHSKID2, + S_FANG_PINCHLOBSHOT0, S_FANG_PINCHLOBSHOT1, S_FANG_PINCHLOBSHOT2, S_FANG_PINCHLOBSHOT3, diff --git a/src/p_inter.c b/src/p_inter.c index cbf5ce54a..0030e8e58 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -428,7 +428,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) || special->state == &states[S_FANG_BOUNCE4] || special->state == &states[S_FANG_PINCHBOUNCE3] || special->state == &states[S_FANG_PINCHBOUNCE4]) - && P_MobjFlip(special)*((special->z + special->height/2) - (toucher->z - toucher->height/2)) > 0) + && P_MobjFlip(special)*((special->z + special->height/2) - (toucher->z - toucher->height/2)) > -(special->height/4)) { P_DamageMobj(toucher, special, special, 1, 0); P_SetTarget(&special->tracer, toucher); From 598e9017b121ba0894bb97d3b50b3b4981bf0d14 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 13 Aug 2019 20:11:44 +0100 Subject: [PATCH 15/39] Fix P_PlayerCanDamage for CA_FLY and CA_BOUNCE to be less lenient in causing damage, by making them based off the top and bottom of the player object respectively rather than its vertical center. --- src/p_user.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b74cafd21..1bf906061 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1051,6 +1051,8 @@ void P_ResetPlayer(player_t *player) // boolean P_PlayerCanDamage(player_t *player, mobj_t *thing) { + fixed_t bottomheight, topheight; + if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing)) return false; @@ -1090,13 +1092,26 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing) return true; // From the top/bottom. - if (P_MobjFlip(player->mo)*(player->mo->z - (thing->z + thing->height/2)) > 0) + bottomheight = player->mo->z; + topheight = player->mo->z + player->mo->height; + + if (player->mo->eflags & MFE_VERTICALFLIP) { - if ((player->charflags & SF_STOMPDAMAGE || player->pflags & PF_BOUNCING) && (P_MobjFlip(player->mo)*player->mo->momz < 0)) + fixed_t swap = bottomheight; + bottomheight = topheight; + topheight = swap; + } + + if (P_MobjFlip(player->mo)*(bottomheight - (thing->z + thing->height/2)) > 0) + { + if ((player->charflags & SF_STOMPDAMAGE || player->pflags & PF_BOUNCING) && (P_MobjFlip(player->mo)*(player->mo->momz - thing->momz) < 0)) + return true; + } + else if (P_MobjFlip(player->mo)*(topheight - (thing->z + thing->height/2)) < 0) + { + if (player->charability == CA_FLY && player->panim == PA_ABILITY && (P_MobjFlip(player->mo)*(player->mo->momz - thing->momz) > 0)) return true; } - else if (player->charability == CA_FLY && player->panim == PA_ABILITY) - return true; // Shield stomp. if (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)) From 35f90e33223da4c3e76c8d43a6ab5a7281298978 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 13 Aug 2019 20:24:24 +0100 Subject: [PATCH 16/39] Use the softer explosion sound from s3k to go with the increased quantity of explosions. --- src/info.c | 16 ++++++++-------- src/p_mobj.c | 2 +- src/p_user.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/info.c b/src/info.c index 9dd3718ef..4b4767baa 100644 --- a/src/info.c +++ b/src/info.c @@ -4592,7 +4592,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FACESTABBER_CHARGE1, // missilestate S_FACESTABBER_DIE1, // deathstate S_NULL, // xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 3, // speed 32*FRACUNIT, // radius 72*FRACUNIT, // height @@ -5159,7 +5159,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_EGGMOBILE_RATK1, // missilestate S_EGGMOBILE_DIE1, // deathstate S_EGGMOBILE_FLEE1, // xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 4, // speed 24*FRACUNIT, // radius 76*FRACUNIT, // height @@ -5294,7 +5294,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = (statenum_t)MT_EGGMOBILE2_POGO, // missilestate S_EGGMOBILE2_DIE1, // deathstate S_EGGMOBILE2_FLEE1,// xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 2*FRACUNIT, // speed 24*FRACUNIT, // radius 76*FRACUNIT, // height @@ -5483,7 +5483,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_EGGMOBILE3_LAUGH1,// missilestate S_EGGMOBILE3_DIE1, // deathstate S_EGGMOBILE3_FLEE1, // xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 8*FRACUNIT, // speed 32*FRACUNIT, // radius 116*FRACUNIT, // height @@ -5591,7 +5591,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_EGGMOBILE4_RATK1,// missilestate S_EGGMOBILE4_DIE1, // deathstate S_EGGMOBILE4_FLEE1,// xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 0, // speed 24*FRACUNIT, // radius 76*FRACUNIT, // height @@ -6320,7 +6320,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_METALSONIC_SHOOT, // missilestate S_METALSONIC_DEATH1,// deathstate S_METALSONIC_FLEE1, // xdeathstate - sfx_s3k6e, // deathsound + sfx_s3kb4, // deathsound MT_ENERGYBALL, // speed 16*FRACUNIT, // radius 48*FRACUNIT, // height @@ -6507,7 +6507,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_BOSSEXPLODE, // deathstate + S_SONIC3KBOSSEXPLOSION1, // deathstate S_NULL, // xdeathstate sfx_cybdth, // deathsound 38*FRACUNIT, // speed @@ -18936,7 +18936,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // missilestate S_HIVEELEMENTAL_DIE1, // deathstate S_NULL, // xdeathstate - sfx_cybdth, // deathsound + sfx_s3kb4, // deathsound 6*FRACUNIT, // speed 30*FRACUNIT, // radius 80*FRACUNIT, // height diff --git a/src/p_mobj.c b/src/p_mobj.c index a0ac38f5c..1ee90d250 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7852,7 +7852,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->y + (P_RandomRange(r, -r) << FRACBITS), mobj->z + (P_RandomKey(mobj->height >> FRACBITS) << FRACBITS), MT_SONIC3KBOSSEXPLODE); - S_StartSound(explosion, sfx_cybdth); + S_StartSound(explosion, sfx_s3kb4); } if (mobj->movedir == DMG_DROWNED) P_SetObjectMomZ(mobj, -FRACUNIT / 2, true); // slower fall from drowning diff --git a/src/p_user.c b/src/p_user.c index 159684d00..aa05fad14 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6514,7 +6514,7 @@ static void P_DoNiGHTSCapsule(player_t *player) S_StartSound(P_SpawnMobj(player->capsule->x + ((P_SignedRandom()/2)<capsule->y + ((P_SignedRandom()/2)<capsule->z + (player->capsule->height/2) + ((P_SignedRandom()/2)< Date: Wed, 14 Aug 2019 10:22:14 +0100 Subject: [PATCH 17/39] Tweak the Metal Sonic death explosion sequence. It's longer than all the others before the egg capsule comes up, but so is Mecha Sonic in s3k, so it fits. (Not uploading an exe for this miniscule change. If you want to play with this, get it in Master. :P ) --- src/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/info.c b/src/info.c index 4b4767baa..18f0e838a 100644 --- a/src/info.c +++ b/src/info.c @@ -1727,10 +1727,10 @@ state_t states[NUMSTATES] = {SPR_METL, 11, 40, {A_Pain}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_PAIN {SPR_METL, 13, 2, {A_Fall}, 0, 0, S_METALSONIC_DEATH2},// S_METALSONIC_DEATH1 {SPR_METL, 13, 4, {A_BossScream}, 0, 0, S_METALSONIC_DEATH3},// S_METALSONIC_DEATH2 - {SPR_METL, 13, 0, {A_Repeat}, 8, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4}, // S_METALSONIC_DEATH3 + {SPR_METL, 13, 0, {A_Repeat}, 17, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4}, // S_METALSONIC_DEATH3 {SPR_METL, 13, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_METALSONIC_DEATH4 - {SPR_METL, 11, 7, {NULL}, 0, 0, S_METALSONIC_FLEE2}, // S_METALSONIC_FLEE1 - {SPR_METL, 11, 1, {A_BossScream}, 0, 0, S_METALSONIC_FLEE1}, // S_METALSONIC_FLEE2 + {SPR_METL, 11, 1, {A_BossScream}, 0, 0, S_METALSONIC_FLEE2}, // S_METALSONIC_FLEE1 + {SPR_METL, 11, 7, {NULL}, 0, 0, S_METALSONIC_FLEE1}, // S_METALSONIC_FLEE2 {SPR_MSCF, FF_FULLBRIGHT|FF_TRANS30| 0, 1, {NULL}, 0, 0, S_MSSHIELD_F2}, // S_MSSHIELD_F1 {SPR_MSCF, FF_FULLBRIGHT|FF_TRANS30| 1, 1, {NULL}, 0, 0, S_MSSHIELD_F3}, // S_MSSHIELD_F2 From 8fa54c1ab4a5d21be0183def857948f6ab6a052a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 15 Aug 2019 14:20:52 +0100 Subject: [PATCH 18/39] Modify P_CheckSector with a modified version of Sal's attempted proper fix for polyobjects crushing, so that we only need to check the polyobject's control sector directly in the waypoints code. This time I've definitely fixed that teleport to ground issue I'm pretty sure, I don't get it in my tests at least. --- src/p_map.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++- src/p_polyobj.c | 8 ++-- 2 files changed, 99 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 95ad02588..6540a99b2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3345,6 +3345,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) boolean P_CheckSector(sector_t *sector, boolean crunch) { msecnode_t *n; + size_t i; nofit = false; crushchange = crunch; @@ -3359,9 +3360,57 @@ boolean P_CheckSector(sector_t *sector, boolean crunch) // First, let's see if anything will keep it from crushing. + + // Sal: This stupid function chain is required to fix polyobjects not being able to crush. + // Monster Iestyn: don't use P_CheckSector actually just look for objects in the blockmap instead + validcount++; + + for (i = 0; i < sector->linecount; i++) + { + if (sector->lines[i]->polyobj) + { + polyobj_t *po = sector->lines[i]->polyobj; + if (po->validcount == validcount) + continue; // skip if already checked + if (!(po->flags & POF_SOLID)) + continue; + if (po->lines[0]->backsector == sector) // Make sure you're currently checking the control sector + { + INT32 x, y; + po->validcount = validcount; + + for (y = po->blockbox[BOXBOTTOM]; y <= po->blockbox[BOXTOP]; ++y) + { + for (x = po->blockbox[BOXLEFT]; x <= po->blockbox[BOXRIGHT]; ++x) + { + mobj_t *mo; + + if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) + continue; + + mo = blocklinks[y * bmapwidth + x]; + + for (; mo; mo = mo->bnext) + { + // Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect + + if (!P_MobjTouchingPolyobj(po, mo)) + continue; + + if (!PIT_ChangeSector(mo, false)) + { + nofit = true; + return nofit; + } + } + } + } + } + } + } + if (sector->numattached) { - size_t i; sector_t *sec; for (i = 0; i < sector->numattached; i++) { @@ -3421,9 +3470,53 @@ boolean P_CheckSector(sector_t *sector, boolean crunch) } while (n); // repeat from scratch until all things left are marked valid // Nothing blocked us, so lets crush for real! + + // Sal: This stupid function chain is required to fix polyobjects not being able to crush. + // Monster Iestyn: don't use P_CheckSector actually just look for objects in the blockmap instead + validcount++; + + for (i = 0; i < sector->linecount; i++) + { + if (sector->lines[i]->polyobj) + { + polyobj_t *po = sector->lines[i]->polyobj; + if (po->validcount == validcount) + continue; // skip if already checked + if (!(po->flags & POF_SOLID)) + continue; + if (po->lines[0]->backsector == sector) // Make sure you're currently checking the control sector + { + INT32 x, y; + po->validcount = validcount; + + for (y = po->blockbox[BOXBOTTOM]; y <= po->blockbox[BOXTOP]; ++y) + { + for (x = po->blockbox[BOXLEFT]; x <= po->blockbox[BOXRIGHT]; ++x) + { + mobj_t *mo; + + if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) + continue; + + mo = blocklinks[y * bmapwidth + x]; + + for (; mo; mo = mo->bnext) + { + // Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect + + if (!P_MobjTouchingPolyobj(po, mo)) + continue; + + PIT_ChangeSector(mo, true); + return nofit; + } + } + } + } + } + } if (sector->numattached) { - size_t i; sector_t *sec; for (i = 0; i < sector->numattached; i++) { diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 82c57c85b..21d8af5f2 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1860,7 +1860,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight = target->z - amtz; po->lines[0]->backsector->ceilingheight = target->z + amtz; // Sal: Remember to check your sectors! - P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // Apply action to mirroring polyobjects as well start = 0; @@ -1874,7 +1874,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += diffz; // move up/down by same amount as the parent did po->lines[0]->backsector->ceilingheight += diffz; // Sal: Remember to check your sectors! - P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } @@ -2037,7 +2037,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; // Sal: Remember to check your sectors! - P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing + //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // backsector may not be necessary, but just in case // Apply action to mirroring polyobjects as well @@ -2052,7 +2052,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; // Sal: Remember to check your sectors! - P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } } From 27dd99ae72366c09cf884e45d6bc60238524ae69 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 3 Aug 2019 19:06:45 +0100 Subject: [PATCH 19/39] Remove commented out P_CheckSector calls and add extra comments explaining the situation --- src/p_polyobj.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 21d8af5f2..ba01ee442 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1860,7 +1860,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight = target->z - amtz; po->lines[0]->backsector->ceilingheight = target->z + amtz; // Sal: Remember to check your sectors! - //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + // Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap + // updating objects in the front one too just added teleporting to ground bugs P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // Apply action to mirroring polyobjects as well start = 0; @@ -1874,7 +1875,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += diffz; // move up/down by same amount as the parent did po->lines[0]->backsector->ceilingheight += diffz; // Sal: Remember to check your sectors! - //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + // Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap + // updating objects in the front one too just added teleporting to ground bugs P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } @@ -2037,8 +2039,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; // Sal: Remember to check your sectors! - //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing - P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // backsector may not be necessary, but just in case + // Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap + // updating objects in the front one too just added teleporting to ground bugs + P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // Apply action to mirroring polyobjects as well start = 0; @@ -2052,7 +2055,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; // Sal: Remember to check your sectors! - //P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + // Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap + // updating objects in the front one too just added teleporting to ground bugs P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } } From c8d1dd3be8558408cc82396e09ce35c0856d3936 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 7 Aug 2019 23:27:26 +0100 Subject: [PATCH 20/39] P_LineOpening: set int32 max/min as defaults for opentop, openbottom etc if a linedef you touched belongs to a polyobjetc. the only thing that really matters in this scenario is the polyobject itself after all! # Conflicts: # src/p_maputl.c --- src/p_maputl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/p_maputl.c b/src/p_maputl.c index 1be57399c..bd17ecf4a 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -517,6 +517,20 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) I_Assert(front != NULL); I_Assert(back != NULL); +#ifdef POLYOBJECTS + if (linedef->polyobj) + { + // set these defaults so that polyobjects don't interfere with collision above or below them + opentop = INT32_MAX; + openbottom = INT32_MIN; + highceiling = INT32_MIN; + lowfloor = INT32_MAX; +#ifdef ESLOPE + opentopslope = openbottomslope = NULL; +#endif + } + else +#endif { // Set open and high/low values here fixed_t frontheight, backheight; From cda81cc1660cded2836e4b9130daadb0edb0c497 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 8 Aug 2019 16:37:09 +0100 Subject: [PATCH 21/39] Edit a lot of the rest of the polyobject-related code in P_LineOpening to make more sense and be more optimised. * If you collide with a line belonging to a polyobject, you should NEVER have to care about any FOFs that might be present in either sector of the linedef. This could lead to colliding with ghostly FOFs that aren't actually there or something dumb, if someone decided to give either of the polyobject's control sectors FOFs for some reason. We don't want that, obviously. * Polyobjects without POF_CLIPPLANE apparently are supposed to have a top and bottom "physical" height of value INT32_MAX and _MIN respectively, according to P_CheckPosition ...let's be consistent with this. * Finally, there is no more need for that back = front nonsense hack anymore with my changes made. # Conflicts: # src/p_maputl.c --- src/p_maputl.c | 85 ++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index bd17ecf4a..a98cc0340 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -500,19 +500,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) return; } - // Treat polyobjects kind of like 3D Floors -#ifdef POLYOBJECTS - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) - { - front = linedef->frontsector; - back = linedef->frontsector; - } - else -#endif - { - front = linedef->frontsector; - back = linedef->backsector; - } + front = linedef->frontsector; + back = linedef->backsector; I_Assert(front != NULL); I_Assert(back != NULL); @@ -636,13 +625,46 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } } } - - // Check for fake floors in the sector. - if (front->ffloors || back->ffloors #ifdef POLYOBJECTS - || linedef->polyobj + if (linedef->polyobj) + { + // Treat polyobj's backsector like a 3D Floor + if (linedef->polyobj->flags & POF_TESTHEIGHT) + { + const sector_t *polysec = linedef->backsector; + fixed_t polytop, polybottom; + fixed_t delta1, delta2; + + if (linedef->polyobj->flags & POF_CLIPPLANES) + { + polytop = polysec->ceilingheight; + polybottom = polysec->floorheight; + } + else + { + polytop = INT32_MAX; + polybottom = INT32_MIN; + } + + delta1 = abs(mobj->z - (polybottom + ((polytop - polybottom)/2))); + delta2 = abs(thingtop - (polybottom + ((polytop - polybottom)/2))); + + if (polybottom < opentop && delta1 >= delta2) + opentop = polybottom; + else if (polybottom < highceiling && delta1 >= delta2) + highceiling = polybottom; + + if (polytop > openbottom && delta1 < delta2) + openbottom = polytop; + else if (polytop > lowfloor && delta1 < delta2) + lowfloor = polytop; + } + // otherwise don't do anything special, pretend there's nothing else there + } + else #endif - ) + // Check for fake floors in the sector. + if (front->ffloors || back->ffloors) { ffloor_t *rover; @@ -744,33 +766,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } } -#ifdef POLYOBJECTS - // Treat polyobj's backsector like a 3D Floor - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) - { - const sector_t *polysec = linedef->backsector; - - delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - if (polysec->floorheight < lowestceiling && delta1 >= delta2) { - lowestceiling = polysec->floorheight; -#ifdef ESLOPE - ceilingslope = NULL; -#endif - } - else if (polysec->floorheight < highestceiling && delta1 >= delta2) - highestceiling = polysec->floorheight; - - if (polysec->ceilingheight > highestfloor && delta1 < delta2) { - highestfloor = polysec->ceilingheight; -#ifdef ESLOPE - floorslope = NULL; -#endif - } - else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) - lowestfloor = polysec->ceilingheight; - } -#endif if (highestceiling < highceiling) highceiling = highestceiling; From bbefc3b7f4c8d48b3b815c1e099f466ad7073631 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 8 Aug 2019 23:04:47 +0100 Subject: [PATCH 22/39] After looking at the FOF part of P_LineOpening for a while I now realise many of these variables aren't even necessary, so I removed them all. (Naturally I did the same to the camera equivalent) # Conflicts: # src/p_maputl.c --- src/p_maputl.c | 117 +++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 81 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index a98cc0340..5368c137e 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -418,10 +418,6 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors || back->ffloors) { ffloor_t *rover; - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; // Check for frontsector's fake floors @@ -437,15 +433,15 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } // Check for backsectors fake floors @@ -461,28 +457,16 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } - - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) - openbottom = highestfloor; - - if (lowestceiling < opentop) - opentop = lowestceiling; - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } openrange = opentop - openbottom; return; @@ -667,16 +651,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (front->ffloors || back->ffloors) { ffloor_t *rover; - - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; -#ifdef ESLOPE - pslope_t *ceilingslope = opentopslope; - pslope_t *floorslope = openbottomslope; -#endif // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) @@ -699,26 +674,26 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) { - lowestceiling = bottomheight; + if (bottomheight < opentop) { + opentop = bottomheight; #ifdef ESLOPE - ceilingslope = *rover->b_slope; + opentopslope = *rover->b_slope; #endif } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) { - highestfloor = topheight; + if (topheight > openbottom) { + openbottom = topheight; #ifdef ESLOPE - floorslope = *rover->t_slope; + openbottomslope = *rover->t_slope; #endif } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } @@ -743,48 +718,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) { - lowestceiling = bottomheight; + if (bottomheight < opentop) { + opentop = bottomheight; #ifdef ESLOPE - ceilingslope = *rover->b_slope; + opentopslope = *rover->b_slope; #endif } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) { - highestfloor = topheight; + if (topheight > openbottom) { + openbottom = topheight; #ifdef ESLOPE - floorslope = *rover->t_slope; + openbottomslope = *rover->t_slope; #endif } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } - - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) { - openbottom = highestfloor; -#ifdef ESLOPE - openbottomslope = floorslope; -#endif - } - - if (lowestceiling < opentop) { - opentop = lowestceiling; -#ifdef ESLOPE - opentopslope = ceilingslope; -#endif - } - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } } From d55790097fbcf81b15f28f2f8fe88dcfb268b798 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Nov 2018 21:01:55 +0000 Subject: [PATCH 23/39] split MT_TAILSOVERLAY handling code into a function of its own, since there's so much of it # Conflicts: # src/p_user.c --- src/p_user.c | 369 ++++++++++++++++++++++++++------------------------- 1 file changed, 187 insertions(+), 182 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b74cafd21..862aa1baa 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10134,6 +10134,7 @@ void P_DoPityCheck(player_t *player) } } + static sector_t *P_GetMinecartSector(fixed_t x, fixed_t y, fixed_t z, fixed_t *nz) { sector_t *sec = R_PointInSubsector(x, y)->sector; @@ -10546,6 +10547,191 @@ static void P_MinecartThink(player_t *player) player->powers[pw_flashing]--; } +// Handle Tails' fluff +static void P_DoTailsOverlay(player_t *player, mobj_t *tails) +{ + // init... + boolean smilesonground = P_IsObjectOnGround(player->mo); + angle_t horizangle = player->drawangle; + fixed_t zoffs = 0; + fixed_t backwards = -1*FRACUNIT; + boolean doroll = (player->panim == PA_ROLL || player->panim == PA_JUMP); + angle_t rollangle; + boolean panimchange; + INT32 ticnum = 0; + statenum_t chosenstate; + + if (!tails->skin) + { + tails->skin = player->mo->skin; + P_SetMobjState(tails, S_TAILSOVERLAY_STAND); + tails->movecount = -1; + } + + panimchange = (tails->movecount != (INT32)player->panim); + + // initial position... + if (doroll) + { + fixed_t testval, zdist; + if (player->speed < FRACUNIT) + testval = FRACUNIT; + else + { + testval = (FixedMul(player->speed, FINECOSINE((horizangle - R_PointToAngle2(0, 0, player->rmomx, player->rmomy)) >> ANGLETOFINESHIFT))); + if (testval < FRACUNIT) + testval = FRACUNIT; + } + if (smilesonground && !player->mo->reactiontime) + zdist = (player->mo->z - tails->threshold); + else + zdist = player->mo->momz; + rollangle = R_PointToAngle2(0, 0, testval, -P_MobjFlip(player->mo)*zdist); + zoffs = 3*FRACUNIT + 12*FINESINE(rollangle >> ANGLETOFINESHIFT); + backwards = -12*FINECOSINE(rollangle >> ANGLETOFINESHIFT); + } + else if (player->panim == PA_RUN) + backwards = -5*FRACUNIT; + else if (player->panim == PA_SPRING) + { + zoffs += 4*FRACUNIT; + backwards /= 2; + } + else if (player->panim == PA_PAIN) + backwards /= 16; + else if (player->mo->state-states == S_PLAY_GASP) + { + backwards /= 16; + zoffs += 12*FRACUNIT; + } + else if (player->mo->state-states == S_PLAY_EDGE) + { + backwards /= 16; + zoffs = 3*FRACUNIT; + } + else if (player->panim == PA_ABILITY2) + { + zoffs = -7*FRACUNIT; + backwards = -9*FRACUNIT; + } + else if (player->mo->sprite2 == SPR2_FLY || player->mo->sprite2 == SPR2_TIRE) + backwards = -5*FRACUNIT; + + // sprite... + if (doroll) + { + statenum_t add = ((rollangle > ANGLE_180) ? 2 : 0); + if (add) + rollangle = InvAngle(rollangle); + rollangle += ANG15; // modify the thresholds to be nice clean numbers + if (rollangle > ANG60) + chosenstate = S_TAILSOVERLAY_PLUS60DEGREES + add; + else if (rollangle > ANG30) + chosenstate = S_TAILSOVERLAY_PLUS30DEGREES + add; + else + chosenstate = S_TAILSOVERLAY_0DEGREES; + } + else if (player->panim == PA_SPRING) + chosenstate = S_TAILSOVERLAY_MINUS60DEGREES; + else if (player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE) + chosenstate = S_TAILSOVERLAY_PLUS60DEGREES; + else if (player->panim == PA_PAIN) + chosenstate = S_TAILSOVERLAY_PAIN; + else if (player->mo->state-states == S_PLAY_GASP) + chosenstate = S_TAILSOVERLAY_GASP; + else if (player->mo->state-states == S_PLAY_EDGE) + chosenstate = S_TAILSOVERLAY_EDGE; + else if (player->panim == PA_RUN) + chosenstate = S_TAILSOVERLAY_RUN; + else if (player->panim == PA_WALK) + { + if (!smilesonground || player->mo->state-states == S_PLAY_SKID) + chosenstate = S_TAILSOVERLAY_PLUS30DEGREES; + else if (player->speed >= FixedMul(player->runspeed/2, player->mo->scale)) + chosenstate = S_TAILSOVERLAY_0DEGREES; + else + chosenstate = S_TAILSOVERLAY_MINUS30DEGREES; + } + else if (player->mo->sprite2 == SPR2_FLY) + chosenstate = S_TAILSOVERLAY_FLY; + else if (player->mo->sprite2 == SPR2_TIRE) + chosenstate = S_TAILSOVERLAY_TIRE; + else if (player->panim == PA_ABILITY2) + chosenstate = S_TAILSOVERLAY_PLUS30DEGREES; + else if (player->panim == PA_IDLE) + chosenstate = S_TAILSOVERLAY_STAND; + else + chosenstate = S_INVISIBLE; + + // state... + if (panimchange) + { + tails->sprite2 = -1; + P_SetMobjState(tails, chosenstate); + } + else + { + if (tails->state != states+chosenstate) + { + if (states[chosenstate].sprite == SPR_PLAY) + tails->sprite2 = P_GetSkinSprite2(((skin_t *)tails->skin), (states[chosenstate].frame & FF_FRAMEMASK), player); + P_SetMobjState(tails, chosenstate); + } + } + + if (player->fly1 != 0 && player->powers[pw_tailsfly] != 0 && !smilesonground) + P_SetMobjState(tails, chosenstate); + + // animation... + if (player->panim == PA_SPRING || player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE) + { + if (FixedDiv(abs(player->mo->momz), player->mo->scale) < 20<panim == PA_PAIN) + ticnum = 2; + else if (player->mo->state-states == S_PLAY_GASP) + tails->tics = -1; + else if (player->mo->sprite2 == SPR2_TIRE) + ticnum = 4; + else if (player->panim != PA_IDLE) + ticnum = player->mo->tics; + + if (ticnum && tails->tics > ticnum) + tails->tics = ticnum; + + // final handling... + tails->color = player->mo->color; + tails->threshold = player->mo->z; + tails->movecount = player->panim; + tails->angle = horizangle; + P_SetScale(tails, player->mo->scale); + tails->destscale = player->mo->destscale; + tails->radius = player->mo->radius; + tails->height = player->mo->height; + zoffs = FixedMul(zoffs, tails->scale); + + if (player->mo->eflags & MFE_VERTICALFLIP) + { + tails->eflags |= MFE_VERTICALFLIP; + tails->flags2 |= MF2_OBJECTFLIP; + zoffs = player->mo->height - tails->height - zoffs; + } + else + { + tails->eflags &= ~MFE_VERTICALFLIP; + tails->flags2 &= ~MF2_OBJECTFLIP; + } + + P_UnsetThingPosition(tails); + tails->x = player->mo->x + P_ReturnThrustX(tails, tails->angle, FixedMul(backwards, tails->scale)); + tails->y = player->mo->y + P_ReturnThrustY(tails, tails->angle, FixedMul(backwards, tails->scale)); + tails->z = player->mo->z + zoffs; + P_SetThingPosition(tails); +} + // // P_PlayerThink // @@ -11684,188 +11870,7 @@ void P_PlayerAfterThink(player_t *player) switch (player->followmobj->type) { case MT_TAILSOVERLAY: // c: - { - // init... - boolean smilesonground = P_IsObjectOnGround(player->mo); - angle_t horizangle = player->drawangle; - fixed_t zoffs = 0; - fixed_t backwards = -1*FRACUNIT; - boolean doroll = (player->panim == PA_ROLL || player->panim == PA_JUMP); - angle_t rollangle; - boolean panimchange; - INT32 ticnum = 0; - statenum_t chosenstate; - - if (!player->followmobj->skin) - { - player->followmobj->skin = player->mo->skin; - P_SetMobjState(player->followmobj, S_TAILSOVERLAY_STAND); - player->followmobj->movecount = -1; - } - - panimchange = (player->followmobj->movecount != (INT32)player->panim); - - // initial position... - if (doroll) - { - fixed_t testval, zdist; - if (player->speed < FRACUNIT) - testval = FRACUNIT; - else - { - testval = (FixedMul(player->speed, FINECOSINE((horizangle - R_PointToAngle2(0, 0, player->rmomx, player->rmomy)) >> ANGLETOFINESHIFT))); - if (testval < FRACUNIT) - testval = FRACUNIT; - } - if (smilesonground && !player->mo->reactiontime) - zdist = (player->mo->z - player->followmobj->threshold); - else - zdist = player->mo->momz; - rollangle = R_PointToAngle2(0, 0, testval, -P_MobjFlip(player->mo)*zdist); - zoffs = 3*FRACUNIT + 12*FINESINE(rollangle >> ANGLETOFINESHIFT); - backwards = -12*FINECOSINE(rollangle >> ANGLETOFINESHIFT); - } - else if (player->panim == PA_RUN) - backwards = -5*FRACUNIT; - else if (player->panim == PA_SPRING) - { - zoffs += 4*FRACUNIT; - backwards /= 2; - } - else if (player->panim == PA_PAIN) - backwards /= 16; - else if (player->mo->state-states == S_PLAY_GASP) - { - backwards /= 16; - zoffs += 12*FRACUNIT; - } - else if (player->mo->state-states == S_PLAY_EDGE) - { - backwards /= 16; - zoffs = 3*FRACUNIT; - } - else if (player->panim == PA_ABILITY2) - { - zoffs = -7*FRACUNIT; - backwards = -9*FRACUNIT; - } - else if (player->mo->sprite2 == SPR2_FLY || player->mo->sprite2 == SPR2_TIRE) - backwards = -5*FRACUNIT; - - // sprite... - if (doroll) - { - statenum_t add = ((rollangle > ANGLE_180) ? 2 : 0); - if (add) - rollangle = InvAngle(rollangle); - rollangle += ANG15; // modify the thresholds to be nice clean numbers - if (rollangle > ANG60) - chosenstate = S_TAILSOVERLAY_PLUS60DEGREES + add; - else if (rollangle > ANG30) - chosenstate = S_TAILSOVERLAY_PLUS30DEGREES + add; - else - chosenstate = S_TAILSOVERLAY_0DEGREES; - } - else if (player->panim == PA_SPRING) - chosenstate = S_TAILSOVERLAY_MINUS60DEGREES; - else if (player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE) - chosenstate = S_TAILSOVERLAY_PLUS60DEGREES; - else if (player->panim == PA_PAIN) - chosenstate = S_TAILSOVERLAY_PAIN; - else if (player->mo->state-states == S_PLAY_GASP) - chosenstate = S_TAILSOVERLAY_GASP; - else if (player->mo->state-states == S_PLAY_EDGE) - chosenstate = S_TAILSOVERLAY_EDGE; - else if (player->panim == PA_RUN) - chosenstate = S_TAILSOVERLAY_RUN; - else if (player->panim == PA_WALK) - { - if (!smilesonground || player->mo->state-states == S_PLAY_SKID) - chosenstate = S_TAILSOVERLAY_PLUS30DEGREES; - else if (player->speed >= FixedMul(player->runspeed/2, player->mo->scale)) - chosenstate = S_TAILSOVERLAY_0DEGREES; - else - chosenstate = S_TAILSOVERLAY_MINUS30DEGREES; - } - else if (player->mo->sprite2 == SPR2_FLY) - chosenstate = S_TAILSOVERLAY_FLY; - else if (player->mo->sprite2 == SPR2_TIRE) - chosenstate = S_TAILSOVERLAY_TIRE; - else if (player->panim == PA_ABILITY2) - chosenstate = S_TAILSOVERLAY_PLUS30DEGREES; - else if (player->panim == PA_IDLE) - chosenstate = S_TAILSOVERLAY_STAND; - else - chosenstate = S_INVISIBLE; - - // state... - if (panimchange) - { - player->followmobj->sprite2 = -1; - P_SetMobjState(player->followmobj, chosenstate); - } - else - { - if (player->followmobj->state != states+chosenstate) - { - if (states[chosenstate].sprite == SPR_PLAY) - player->followmobj->sprite2 = P_GetSkinSprite2(((skin_t *)player->followmobj->skin), (states[chosenstate].frame & FF_FRAMEMASK), player); - P_SetMobjState(player->followmobj, chosenstate); - } - } - - if (player->fly1 != 0 && player->powers[pw_tailsfly] != 0 && !smilesonground) - P_SetMobjState(player->followmobj, chosenstate); - - // animation... - if (player->panim == PA_SPRING || player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE) - { - if (FixedDiv(abs(player->mo->momz), player->mo->scale) < 20<panim == PA_PAIN) - ticnum = 2; - else if (player->mo->state-states == S_PLAY_GASP) - player->followmobj->tics = -1; - else if (player->mo->sprite2 == SPR2_TIRE) - ticnum = 4; - else if (player->panim != PA_IDLE) - ticnum = player->mo->tics; - - if (ticnum && player->followmobj->tics > ticnum) - player->followmobj->tics = ticnum; - - // final handling... - player->followmobj->color = player->mo->color; - player->followmobj->threshold = player->mo->z; - player->followmobj->movecount = player->panim; - player->followmobj->angle = horizangle; - P_SetScale(player->followmobj, player->mo->scale); - player->followmobj->destscale = player->mo->destscale; - player->followmobj->radius = player->mo->radius; - player->followmobj->height = player->mo->height; - zoffs = FixedMul(zoffs, player->followmobj->scale); - - if (player->mo->eflags & MFE_VERTICALFLIP) - { - player->followmobj->eflags |= MFE_VERTICALFLIP; - player->followmobj->flags2 |= MF2_OBJECTFLIP; - zoffs = player->mo->height - player->followmobj->height - zoffs; - } - else - { - player->followmobj->eflags &= ~MFE_VERTICALFLIP; - player->followmobj->flags2 &= ~MF2_OBJECTFLIP; - } - - P_UnsetThingPosition(player->followmobj); - player->followmobj->x = player->mo->x + P_ReturnThrustX(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale)); - player->followmobj->y = player->mo->y + P_ReturnThrustY(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale)); - player->followmobj->z = player->mo->z + zoffs; - P_SetThingPosition(player->followmobj); - } + P_DoTailsOverlay(player, player->followmobj); break; default: var1 = 1; From 5c2786b1632962be9717071b8400591d6c7d6afc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 12 Nov 2018 11:30:51 +0000 Subject: [PATCH 24/39] Make the various carry types' handling code into a switch case --- src/p_user.c | 251 +++++++++++++++++++++++++++------------------------ 1 file changed, 135 insertions(+), 116 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 862aa1baa..09ac0a0ee 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11686,130 +11686,149 @@ void P_PlayerAfterThink(player_t *player) /* if (player->powers[pw_carry] == CR_NONE && player->mo->tracer && !player->homing) P_SetTarget(&player->mo->tracer, NULL); else */ - if (player->powers[pw_carry] == CR_PLAYER && player->mo->tracer) + if (player->mo->tracer) { - player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14*FRACUNIT,10*FRACUNIT)); - - if (player->mo->tracer->player && !(player->mo->tracer->player->pflags & PF_CANCARRY)) - player->powers[pw_carry] = CR_NONE; - - if (player->mo->eflags & MFE_VERTICALFLIP) + switch (player->powers[pw_carry]) { - if ((player->mo->tracer->z + player->mo->tracer->height + player->mo->height + FixedMul(FRACUNIT, player->mo->scale)) <= player->mo->tracer->ceilingz - && (player->mo->tracer->eflags & MFE_VERTICALFLIP)) // Reverse gravity check for the carrier - Flame - player->mo->z = player->mo->tracer->z + player->mo->tracer->height + FixedMul(FRACUNIT, player->mo->scale); - else - player->powers[pw_carry] = CR_NONE; - } - else - { - if ((player->mo->tracer->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale)) >= player->mo->tracer->floorz - && !(player->mo->tracer->eflags & MFE_VERTICALFLIP)) // Correct gravity check for the carrier - Flame - player->mo->z = player->mo->tracer->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale); - else - player->powers[pw_carry] = CR_NONE; - } - - if (player->mo->tracer->health <= 0) - player->powers[pw_carry] = CR_NONE; - else - { - P_TryMove(player->mo, player->mo->tracer->x, player->mo->tracer->y, true); - player->mo->momx = player->mo->tracer->momx; - player->mo->momy = player->mo->tracer->momy; - player->mo->momz = player->mo->tracer->momz; - } - - if (gametype == GT_COOP) - { - player->mo->angle = player->mo->tracer->angle; - - if (!demoplayback || P_AnalogMove(player)) + case CR_PLAYER: // being carried by a flying character (such as Tails) { - if (player == &players[consoleplayer]) - localangle = player->mo->angle; - else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; - } - } + mobj_t *tails = player->mo->tracer; + player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14*FRACUNIT,10*FRACUNIT)); - if (P_AproxDistance(player->mo->x - player->mo->tracer->x, player->mo->y - player->mo->tracer->y) > player->mo->radius) - player->powers[pw_carry] = CR_NONE; + if (tails->player && !(tails->player->pflags & PF_CANCARRY)) + player->powers[pw_carry] = CR_NONE; - if (player->powers[pw_carry] != CR_NONE) - { - if (player->mo->state-states != S_PLAY_RIDE) - P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); - } - else - P_SetTarget(&player->mo->tracer, NULL); - - if (player-players == consoleplayer && botingame) - CV_SetValue(&cv_analog2, (player->powers[pw_carry] != CR_PLAYER)); - } - else if (player->powers[pw_carry] == CR_GENERIC && player->mo->tracer) - { - // tracer is what you're hanging onto - P_UnsetThingPosition(player->mo); - player->mo->x = player->mo->tracer->x; - player->mo->y = player->mo->tracer->y; - if (player->mo->eflags & MFE_VERTICALFLIP) - player->mo->z = player->mo->tracer->z + player->mo->tracer->height - FixedDiv(player->mo->height, 3*FRACUNIT); - else - player->mo->z = player->mo->tracer->z - FixedDiv(player->mo->height, 3*FRACUNIT/2); - player->mo->momx = player->mo->momy = player->mo->momz = 0; - P_SetThingPosition(player->mo); - if (player->mo->state-states != S_PLAY_RIDE) - P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); - - // Controllable missile - if (player->mo->tracer->type == MT_BLACKEGGMAN_MISSILE) - { - if (cmd->forwardmove > 0) - player->mo->tracer->momz += FixedMul(FRACUNIT/4, player->mo->tracer->scale); - else if (cmd->forwardmove < 0) - player->mo->tracer->momz -= FixedMul(FRACUNIT/4, player->mo->tracer->scale); - - player->mo->tracer->angle = player->mo->angle; - P_InstaThrust(player->mo->tracer, player->mo->tracer->angle, FixedMul(player->mo->tracer->info->speed, player->mo->tracer->scale)); - - if (player->mo->z <= player->mo->floorz - || player->mo->tracer->health <= 0) - { - player->powers[pw_carry] = CR_NONE; - P_SetTarget(&player->mo->tracer, NULL); - } - } - } - else if (player->powers[pw_carry] == CR_MACESPIN && player->mo->tracer && player->mo->tracer->tracer) - { - player->mo->height = P_GetPlayerSpinHeight(player); - // tracer is what you're hanging onto.... - player->mo->momx = (player->mo->tracer->x - player->mo->x)*2; - player->mo->momy = (player->mo->tracer->y - player->mo->y)*2; - player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2; - P_TeleportMove(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2)); - if (!player->powers[pw_flashing]) // handle getting hurt - { - player->pflags |= PF_JUMPED; - player->pflags &= ~PF_NOJUMPDAMAGE; - player->secondjump = 0; - player->pflags &= ~PF_THOKKED; - - if ((player->mo->tracer->tracer->flags & MF_SLIDEME) // Noclimb on chain parameters gives this - && !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode? - { - player->mo->tracer->tracer->angle += cmd->sidemove<mo->angle += cmd->sidemove< ANGLE_MAX - - if (!demoplayback || P_AnalogMove(player)) + if (player->mo->eflags & MFE_VERTICALFLIP) { - if (player == &players[consoleplayer]) - localangle = player->mo->angle; // Adjust the local control angle. - else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; + if ((tails->z + tails->height + player->mo->height + FixedMul(FRACUNIT, player->mo->scale)) <= tails->ceilingz + && (tails->eflags & MFE_VERTICALFLIP)) // Reverse gravity check for the carrier - Flame + player->mo->z = tails->z + tails->height + FixedMul(FRACUNIT, player->mo->scale); + else + player->powers[pw_carry] = CR_NONE; } + else + { + if ((tails->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale)) >= tails->floorz + && !(tails->eflags & MFE_VERTICALFLIP)) // Correct gravity check for the carrier - Flame + player->mo->z = tails->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale); + else + player->powers[pw_carry] = CR_NONE; + } + + if (tails->health <= 0) + player->powers[pw_carry] = CR_NONE; + else + { + P_TryMove(player->mo, tails->x, tails->y, true); + player->mo->momx = tails->momx; + player->mo->momy = tails->momy; + player->mo->momz = tails->momz; + } + + if (gametype == GT_COOP) + { + player->mo->angle = tails->angle; + + if (!demoplayback || P_AnalogMove(player)) + { + if (player == &players[consoleplayer]) + localangle = player->mo->angle; + else if (player == &players[secondarydisplayplayer]) + localangle2 = player->mo->angle; + } + } + + if (P_AproxDistance(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) + player->powers[pw_carry] = CR_NONE; + + if (player->powers[pw_carry] != CR_NONE) + { + if (player->mo->state-states != S_PLAY_RIDE) + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); + } + else + P_SetTarget(&player->mo->tracer, NULL); + + if (player-players == consoleplayer && botingame) + CV_SetValue(&cv_analog2, (player->powers[pw_carry] != CR_PLAYER)); + break; } + case CR_GENERIC: // being carried by some generic item + { + mobj_t *item = player->mo->tracer; + // tracer is what you're hanging onto + P_UnsetThingPosition(player->mo); + player->mo->x = item->x; + player->mo->y = item->y; + if (player->mo->eflags & MFE_VERTICALFLIP) + player->mo->z = item->z + item->height - FixedDiv(player->mo->height, 3*FRACUNIT); + else + player->mo->z = item->z - FixedDiv(player->mo->height, 3*FRACUNIT/2); + player->mo->momx = player->mo->momy = player->mo->momz = 0; + P_SetThingPosition(player->mo); + if (player->mo->state-states != S_PLAY_RIDE) + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); + + // Controllable missile + if (item->type == MT_BLACKEGGMAN_MISSILE) + { + if (cmd->forwardmove > 0) + item->momz += FixedMul(FRACUNIT/4, item->scale); + else if (cmd->forwardmove < 0) + item->momz -= FixedMul(FRACUNIT/4, item->scale); + + item->angle = player->mo->angle; + P_InstaThrust(item, item->angle, FixedMul(item->info->speed, item->scale)); + + if (player->mo->z <= player->mo->floorz || item->health <= 0) + { + player->powers[pw_carry] = CR_NONE; + P_SetTarget(&player->mo->tracer, NULL); + } + } + break; + } + case CR_MACESPIN: // being carried by a spinning chain + { + mobj_t *chain; + mobj_t *macecenter; + if (!player->mo->tracer->tracer) // can't spin around a point if... there is no point in doing so + break; + chain = player->mo->tracer; + macecenter = player->mo->tracer->tracer; + + player->mo->height = P_GetPlayerSpinHeight(player); + // tracer is what you're hanging onto.... + player->mo->momx = (chain->x - player->mo->x)*2; + player->mo->momy = (chain->y - player->mo->y)*2; + player->mo->momz = (chain->z - (player->mo->height-chain->height/2) - player->mo->z)*2; + P_TeleportMove(player->mo, chain->x, chain->y, chain->z - (player->mo->height-chain->height/2)); + if (!player->powers[pw_flashing]) // handle getting hurt + { + player->pflags |= PF_JUMPED; + player->pflags &= ~PF_NOJUMPDAMAGE; + player->secondjump = 0; + player->pflags &= ~PF_THOKKED; + + if ((macecenter->flags & MF_SLIDEME) // Noclimb on chain parameters gives this + && !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode? + { + macecenter->angle += cmd->sidemove<mo->angle += cmd->sidemove< ANGLE_MAX + + if (!demoplayback || P_AnalogMove(player)) + { + if (player == &players[consoleplayer]) + localangle = player->mo->angle; // Adjust the local control angle. + else if (player == &players[secondarydisplayplayer]) + localangle2 = player->mo->angle; + } + } + } + break; + } + default: + break; } } From ae9ecef5920b0383ca7f5e5b7fecc70dddb4b6b3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 16 Aug 2019 14:54:01 +0100 Subject: [PATCH 25/39] Use P_MobjInsidePolyobj instead of P_MobjTouchingPolyobj, so that you can be crushed by the polyobject's middle rather than just its edges --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6540a99b2..3ce82b4da 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3394,7 +3394,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch) { // Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect - if (!P_MobjTouchingPolyobj(po, mo)) + if (!P_MobjInsidePolyobj(po, mo)) continue; if (!PIT_ChangeSector(mo, false)) @@ -3504,7 +3504,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch) { // Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect - if (!P_MobjTouchingPolyobj(po, mo)) + if (!P_MobjInsidePolyobj(po, mo)) continue; PIT_ChangeSector(mo, true); From e52a314ddb7d3f587638a4d54b7800251e20346f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 16 Aug 2019 20:14:01 +0100 Subject: [PATCH 26/39] Update version to 2.1.25 --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- src/doomdef.h | 8 ++++---- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b70221859..96e32a06d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # Version change is fine. project(SRB2 - VERSION 2.1.24 + VERSION 2.1.25 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index b37bd1a65..d58976fd5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.24.{branch}-{build} +version: 2.1.25.{branch}-{build} os: MinGW environment: diff --git a/src/doomdef.h b/src/doomdef.h index 6b6afbf1b..1c034f5f7 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,9 +150,9 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 201 // Game version -#define SUBVERSION 24 // more precise version number -#define VERSIONSTRING "v2.1.24" -#define VERSIONSTRINGW L"v2.1.24" +#define SUBVERSION 25 // more precise version number +#define VERSIONSTRING "v2.1.25" +#define VERSIONSTRINGW L"v2.1.25" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -217,7 +217,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 29 +#define MODVERSION 30 // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. // Increment MINOREXECVERSION whenever a config change is needed that does not correspond diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 878db3d8d..9297833e2 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.24; + CURRENT_PROJECT_VERSION = 2.1.25; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.24; + CURRENT_PROJECT_VERSION = 2.1.25; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 6b3997b1f..d67903819 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.24; + CURRENT_PROJECT_VERSION = 2.1.25; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.24; + CURRENT_PROJECT_VERSION = 2.1.25; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( From 450ea0cc43e303c00f5eaa27baf1077cdc2b72ae Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 16 Aug 2019 23:19:43 +0100 Subject: [PATCH 27/39] Disable the level end music fade code for now, because we discovered it causes freezes sometimes. --- src/p_user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 03e1e4e23..3710e87f1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8818,6 +8818,9 @@ void P_PlayerThink(player_t *player) if (player->exiting && countdown2) player->exiting = 5; + // The following code is disabled for now as this causes the game to freeze sometimes + // Monster Iestyn -- 16/08/19 +#if 0 // Same check as below, just at 1 second before // so we can fade music if (!exitfadestarted && @@ -8855,6 +8858,7 @@ void P_PlayerThink(player_t *player) S_FadeOutStopMusic(1*MUSICRATE); } } +#endif if (player->exiting == 2 || countdown2 == 2) { From 0949406b9cca290e9c0d95d2eb921503472caf5c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 17 Aug 2019 18:15:23 +0100 Subject: [PATCH 28/39] Update MD5 for patch.dta --- src/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 1e6a7f514..63d24a3be 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -35,7 +35,7 @@ #define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799" #define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4" +#define ASSET_HASH_PATCH_DTA "636BD1C9269629AEAC2C3C184754D471" #endif #endif From 19dd9a3c14365956e69e2cf5da9a9c01d6990a1e Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 17 Aug 2019 10:33:14 -0700 Subject: [PATCH 29/39] Kart discrepancies --- src/d_clisrv.c | 10 +++++----- src/d_clisrv.h | 4 ++-- src/d_netcmd.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 64d3ee6da..f62a4b6f0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -117,7 +117,7 @@ static UINT8 resynch_local_inprogress = false; // WE are desynched and getting p static UINT8 player_joining = false; UINT8 hu_resynching = 0; -UINT8 adminpassmd5[MD5_LEN]; +UINT8 adminpassmd5[16]; boolean adminpasswordset = false; // Client specific @@ -3764,7 +3764,7 @@ static void HandlePacketFromPlayer(SINT8 node) XBOXSTATIC INT32 netconsole; XBOXSTATIC tic_t realend, realstart; XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak; - XBOXSTATIC UINT8 finalmd5[MD5_LEN];/* Well, it's the cool thing to do? */ + XBOXSTATIC UINT8 finalmd5[16];/* Well, it's the cool thing to do? */ FILESTAMP txtpak = NULL; @@ -3969,7 +3969,7 @@ FILESTAMP break; #ifndef NOMD5 - if (doomcom->datalength < MD5_LEN)/* ignore partial sends */ + if (doomcom->datalength < 16)/* ignore partial sends */ break; if (!adminpasswordset) @@ -3979,9 +3979,9 @@ FILESTAMP } // Do the final pass to compare with the sent md5 - D_MD5PasswordPass(adminpassmd5, MD5_LEN, va("PNUM%02d", netconsole), &finalmd5); + D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", netconsole), &finalmd5); - if (!memcmp(netbuffer->u.md5sum, finalmd5, MD5_LEN)) + if (!memcmp(netbuffer->u.md5sum, finalmd5, 16)) { CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[netconsole]); COM_BufInsertText(va("promote %d\n", netconsole)); // do this immediately diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 96591ed93..c005f3f9a 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -401,7 +401,7 @@ typedef struct UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...) filetx_pak filetxpak; // 139 bytes clientconfig_pak clientcfg; // 136 bytes - UINT8 md5sum[MD5_LEN]; + UINT8 md5sum[16]; serverinfo_pak serverinfo; // 1024 bytes serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...) askinfo_pak askinfo; // 61 bytes @@ -534,6 +534,6 @@ void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void * extern UINT8 hu_resynching; -extern UINT8 adminpassmd5[MD5_LEN]; +extern UINT8 adminpassmd5[16]; extern boolean adminpasswordset; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1c2d380c1..38004d5ff 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2710,12 +2710,12 @@ static void Command_Login_f(void) D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &netbuffer->u.md5sum); // Do the final pass to get the comparison the server will come up with - D_MD5PasswordPass(netbuffer->u.md5sum, MD5_LEN, va("PNUM%02d", consoleplayer), &netbuffer->u.md5sum); + D_MD5PasswordPass(netbuffer->u.md5sum, 16, va("PNUM%02d", consoleplayer), &netbuffer->u.md5sum); CONS_Printf(M_GetText("Sending login... (Notice only given if password is correct.)\n")); netbuffer->packettype = PT_LOGIN; - HSendPacket(servernode, true, 0, MD5_LEN); + HSendPacket(servernode, true, 0, 16); #endif } From c1ba72ead8af7db7766e9838a1e992d9aff6c44f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 17 Aug 2019 10:33:33 -0700 Subject: [PATCH 30/39] Remove a printf --- src/d_clisrv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f62a4b6f0..28d327ece 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3964,7 +3964,6 @@ FILESTAMP } break; case PT_LOGIN: - CONS_Printf("I received LOGIN\n"); if (client) break; From 9c1fa867faeeabbd76122a3ec1d59312ff740ffd Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 17 Aug 2019 10:34:19 -0700 Subject: [PATCH 31/39] Include md5.h --- src/d_netcmd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 38004d5ff..aadebab80 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -46,6 +46,7 @@ #include "lua_hook.h" #include "m_cond.h" #include "m_anigif.h" +#include "md5.h" #ifdef NETGAME_DEVMODE #define CV_RESTRICT CV_NETVAR From 03ce0adef8264a9e80e04638fab423f90aa1959e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Aug 2019 14:13:38 +0100 Subject: [PATCH 32/39] Remove references to old console ports that slipped in from the 2.1 source code a while back --- src/apng.h | 2 -- src/command.c | 16 ---------------- 2 files changed, 18 deletions(-) diff --git a/src/apng.h b/src/apng.h index aa7fac3df..0f22dca6d 100644 --- a/src/apng.h +++ b/src/apng.h @@ -24,12 +24,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define APNG_H #ifndef _MSC_VER -#ifndef _WII #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/command.c b/src/command.c index 600803cdb..cfb36f02f 100644 --- a/src/command.c +++ b/src/command.c @@ -1666,7 +1666,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (joyaxis_default) { -#if !defined (_WII) && !defined (WMINPUT) if (!stricmp(v->name, "joyaxis_turn")) { if (joyaxis_count > 6) return false; @@ -1676,7 +1675,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "X-Axis")) joyaxis_count++; else joyaxis_default = false; } -#if !defined (PSP) if (!stricmp(v->name, "joyaxis_move")) { if (joyaxis_count > 6) return false; @@ -1685,8 +1683,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Y-Axis")) joyaxis_count++; else joyaxis_default = false; } -#endif -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis_side")) { if (joyaxis_count > 6) return false; @@ -1695,8 +1691,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Z-Axis")) joyaxis_count++; else joyaxis_default = false; } -#endif -#if !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis_look")) { if (joyaxis_count > 6) return false; @@ -1705,7 +1699,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis_count++; else joyaxis_default = false; } -#endif if (!stricmp(v->name, "joyaxis_fire") || !stricmp(v->name, "joyaxis_firenormal")) { @@ -1715,7 +1708,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis_count++; else joyaxis_default = false; } -#endif // reset all axis settings to defaults if (joyaxis_count == 6) { @@ -1732,7 +1724,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (joyaxis2_default) { -#if !defined (_WII) && !defined (WMINPUT) if (!stricmp(v->name, "joyaxis2_turn")) { if (joyaxis2_count > 6) return false; @@ -1742,7 +1733,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "X-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -// #if !defined (PSP) if (!stricmp(v->name, "joyaxis2_move")) { if (joyaxis2_count > 6) return false; @@ -1751,8 +1741,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Y-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -// #endif -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis2_side")) { if (joyaxis2_count > 6) return false; @@ -1761,8 +1749,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Z-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -#endif -#if !defined (_XBOX) // && !defined (PSP) if (!stricmp(v->name, "joyaxis2_look")) { if (joyaxis2_count > 6) return false; @@ -1771,7 +1757,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis2_count++; else joyaxis2_default = false; } -#endif if (!stricmp(v->name, "joyaxis2_fire") || !stricmp(v->name, "joyaxis2_firenormal")) { @@ -1781,7 +1766,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis2_count++; else joyaxis2_default = false; } -#endif // reset all axis settings to defaults if (joyaxis2_count == 6) From 2dd5f1abe3212eb9d6f2b9ee8e6127900fc68f6e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Aug 2019 18:18:29 +0100 Subject: [PATCH 33/39] Fixes for lib_cvRegisterVar (the Lua version of CV_RegisterVar): * Make sure the consvar's properties are all initialised to zeros as defaults * Error if the consvar is not given a name * Error if the consvar has CV_CALL but no call function * Error if the consvar has CV_NOINIT but not CV_CALL --- src/lua_consolelib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index dced4e43c..7766ba1c2 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -303,6 +303,8 @@ static int lib_cvRegisterVar(lua_State *L) #define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e); #define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1))) + memset(cvar, 0x00, sizeof(consvar_t)); // zero everything by default + lua_pushnil(L); while (lua_next(L, 1)) { // stack: cvar table, cvar userdata, key/index, value @@ -390,6 +392,13 @@ static int lib_cvRegisterVar(lua_State *L) #undef FIELDERROR #undef TYPEERROR + if (!cvar->name) + return luaL_error(L, M_GetText("Variable has no name!\n")); + if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL)) + return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name); + if ((cvar->flags & CV_CALL) && !cvar->func) + return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name); + // stack: cvar table, cvar userdata lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars"); I_Assert(lua_istable(L, 3)); From eacc589ae1737d7018331ba9e4bda50218cfc0c4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Aug 2019 20:31:28 +0100 Subject: [PATCH 34/39] Added quick validity checks for three linedef executor specials that require a player mobj to be the triggerer (432, 434 and 437) --- src/p_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 5e06a18a7..37a1652f0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3096,7 +3096,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 432: // Enable 2D Mode (Disable if noclimb) - if (mo->player) + if (mo && mo->player) { if (line->flags & ML_NOCLIMB) mo->flags2 &= ~MF2_TWOD; @@ -3122,7 +3122,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 434: // Custom Power - if (mo->player) + if (mo && mo->player) { mobj_t *dummy = P_SpawnMobj(mo->x, mo->y, mo->z, MT_NULL); @@ -3205,7 +3205,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 437: // Disable Player Controls - if (mo->player) + if (mo && mo->player) { UINT16 fractime = (UINT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); if (fractime < 1) From 6ef9ee5467cf8f67847999d0d530153b304ae562 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 20 Aug 2019 15:43:59 -0400 Subject: [PATCH 35/39] true not TRUE --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 6fa3ea113..05b851fef 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -109,7 +109,7 @@ static UINT8 cheatf_devmode(void) G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; - devparm = TRUE; + devparm = true; cv_debug |= 0x8000; // Refresh secrets menu existing. From fc1abdd7f8ac083f86c63722a80e7142b0f51299 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 22 Aug 2019 16:13:00 +0100 Subject: [PATCH 36/39] Autobrake polish! * Make it actually look like a brake, so people can tell it's on instead of just having high friction. * Fix it fucking with spring chains (caused by being unwittingly active for the first tic of spring collision). --- src/p_map.c | 3 +++ src/p_user.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index cc9209ea8..15fa97c8f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -285,6 +285,9 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance != 2) { + if (object->player) + object->player->pflags &= ~PF_APPLYAUTOBRAKE; + if ((horizspeed && vertispeed) || (object->player && object->player->homing)) // Mimic SA { object->momx = object->momy = 0; diff --git a/src/p_user.c b/src/p_user.c index fc1d97e49..74901c469 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11233,6 +11233,16 @@ void P_PlayerThink(player_t *player) if (!currentlyonground) acceleration /= 2; + // fake skidding! see P_SkidStuff for reference on conditionals + else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && P_AproxDistance(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed/2, player->mo->scale)) + { + if (player->mo->state-states != S_PLAY_SKID) + P_SetPlayerMobjState(player->mo, S_PLAY_SKID); + player->mo->tics = player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; + + if (P_IsLocalPlayer(player)) // the sound happens way more frequently now, so give co-op players' ears a brake... + S_StartSound(player->mo, sfx_skid); + } if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... acceleration = FixedMul(acceleration<mo->movefactor)>>FRACBITS; From e5071bb6052c5202ce1d48ef8af6738bdf090e34 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 23 Aug 2019 11:00:05 -0700 Subject: [PATCH 37/39] Compare the file name only for real CL_SendRequestFile prepends the path for each file. --- src/d_netfil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index deb04fbe1..d25b6a278 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -752,9 +752,12 @@ void Got_Filetxpak(void) { INT32 filenum = netbuffer->u.filetxpak.fileid; fileneeded_t *file = &fileneeded[filenum]; - char *filename = file->filename; + char *filename; static INT32 filetime = 0; + filename = va("%s", file->filename); + nameonly(filename); + if (!(strcmp(filename, "srb2.srb") && strcmp(filename, "srb2.wad") && strcmp(filename, "zones.dta") @@ -765,6 +768,8 @@ void Got_Filetxpak(void) )) I_Error("Tried to download \"%s\"", filename); + filename = file->filename; + if (filenum >= fileneedednum) { DEBFILE(va("fileframent not needed %d>%d\n", filenum, fileneedednum)); From db3a2e02a539e94db564159ca7b68f346e44ecfb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Aug 2019 22:24:08 +0100 Subject: [PATCH 38/39] Modify defaults for smpstage_start and smpstage_end to 60 and 66 respectively --- src/g_game.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e70241269..576ea0c33 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3285,9 +3285,11 @@ void G_LoadGameSettings(void) { // defaults spstage_start = 1; - sstage_start = smpstage_start = 50; - sstage_end = smpstage_end = 56; // 7 special stages in vanilla SRB2 + sstage_start = 50; + sstage_end = 56; // 7 special stages in vanilla SRB2 sstage_end++; // plus one weirdo + smpstage_start = 60; + smpstage_end = 66; // 7 multiplayer special stages too // initialize free sfx slots for skin sounds S_InitRuntimeSounds(); From 89c4989987b18c6f8cc746816b41d5848eed5df3 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 26 Aug 2019 16:07:17 -0700 Subject: [PATCH 39/39] Show a negative number to indicate ammo penalty --- src/d_clisrv.c | 8 +++++++ src/d_clisrv.h | 3 +++ src/d_player.h | 4 ++++ src/dehacked.c | 4 ++++ src/g_game.c | 2 ++ src/g_game.h | 1 + src/lua_playerlib.c | 12 ++++++++++ src/p_saveg.c | 8 +++++++ src/p_user.c | 57 +++++++++++++++++++++++++++++++-------------- src/st_stuff.c | 27 +++++++++++---------- 10 files changed, 96 insertions(+), 30 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 556d86384..01e94485d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -513,6 +513,10 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) 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]); @@ -644,6 +648,10 @@ static void resynch_read_player(resynch_pak *rsp) 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]); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index a6783fb3d..a2f140f33 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -164,6 +164,9 @@ typedef struct angle_t aiming; INT32 currentweapon; INT32 ringweapons; + UINT16 ammoremoval; + tic_t ammoremovaltimer; + INT32 ammoremovalweapon; UINT16 powers[NUMPOWERS]; // Score is resynched in the confirm resync packet diff --git a/src/d_player.h b/src/d_player.h index c133af703..5860cf1de 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -333,6 +333,10 @@ typedef struct player_s 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 04ac2ef4b..5db61a5b5 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3347,6 +3347,10 @@ static void readmaincfg(MYFILE *f) { gameovertics = get_number(word2); } + else if (fastcmp(word, "AMMOREMOVALTICS")) + { + ammoremovaltics = get_number(word2); + } else if (fastcmp(word, "INTROTOPLAY")) { introtoplay = (UINT8)get_number(word2); diff --git a/src/g_game.c b/src/g_game.c index 576ea0c33..d5faf6846 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -217,6 +217,8 @@ UINT16 nightslinktics = 2*TICRATE; INT32 gameovertics = 15*TICRATE; +UINT8 ammoremovaltics = 2*TICRATE; + UINT8 use1upSound = 0; UINT8 maxXtraLife = 2; // Max extra lives from rings diff --git a/src/g_game.h b/src/g_game.h index 4b63bc180..e161bc8ed 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -51,6 +51,7 @@ extern tic_t levelstarttic; // for modding? extern INT16 prevmap, nextmap; extern INT32 gameovertics; +extern UINT8 ammoremovaltics; extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard display) extern INT16 rw_maximums[NUM_WEAPONS]; extern INT32 pausedelay; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index b7bdaa1be..addd707e1 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -136,6 +136,12 @@ static int player_get(lua_State *L) 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,"pflags")) @@ -428,6 +434,12 @@ static int player_set(lua_State *L) 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")) diff --git a/src/p_saveg.c b/src/p_saveg.c index ea998b445..7c073b151 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -125,6 +125,10 @@ static void P_NetArchivePlayers(void) 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,6 +333,10 @@ static void P_NetUnArchivePlayers(void) 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_user.c b/src/p_user.c index 65f93a11c..09c8e36c0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3900,6 +3900,33 @@ static void P_SetWeaponDelay(player_t *player, INT32 delay) } } +// +// P_DrainWeaponAmmo +// +// Reduces rings and weapon ammo. Also penalizes the player +// for using weapon rings with no normal rings! >:V +// +static void P_DrainWeaponAmmo (player_t *player, INT32 power) +{ + player->powers[power]--; + + if (player->rings < 1) + { + player->ammoremovalweapon = player->currentweapon; + player->ammoremovaltimer = ammoremovaltics; + + if (player->powers[power] > 0) // can't take a ring that doesn't exist + { + player->powers[power]--; + player->ammoremoval = 2; + } + else + player->ammoremoval = 1; + } + else + player->rings--; +} + // // P_DoFiring() // @@ -3938,22 +3965,12 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) player->pflags |= PF_ATTACKDOWN; -#define TAKE_AMMO(player, power) \ - player->powers[power]--; \ - if (player->rings < 1) \ - { \ - if (player->powers[power] > 0) \ - player->powers[power]--; \ - } \ - else \ - player->rings--; - if (cmd->buttons & BT_FIRENORMAL) // No powers, just a regular ring. goto firenormal; //code repetition sucks. // Bounce ring else if (player->currentweapon == WEP_BOUNCE && player->powers[pw_bouncering]) { - TAKE_AMMO(player, pw_bouncering); + P_DrainWeaponAmmo(player, pw_bouncering); P_SetWeaponDelay(player, TICRATE/4); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNBOUNCE, MF2_BOUNCERING); @@ -3964,7 +3981,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) // Rail ring else if (player->currentweapon == WEP_RAIL && player->powers[pw_railring]) { - TAKE_AMMO(player, pw_railring); + P_DrainWeaponAmmo(player, pw_railring); P_SetWeaponDelay(player, (3*TICRATE)/2); mo = P_SpawnPlayerMissile(player->mo, MT_REDRING, MF2_RAILRING|MF2_DONTDRAW); @@ -3975,7 +3992,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) // Automatic else if (player->currentweapon == WEP_AUTO && player->powers[pw_automaticring]) { - TAKE_AMMO(player, pw_automaticring); + P_DrainWeaponAmmo(player, pw_automaticring); player->pflags &= ~PF_ATTACKDOWN; P_SetWeaponDelay(player, 2); @@ -3984,7 +4001,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) // Explosion else if (player->currentweapon == WEP_EXPLODE && player->powers[pw_explosionring]) { - TAKE_AMMO(player, pw_explosionring); + P_DrainWeaponAmmo(player, pw_explosionring); P_SetWeaponDelay(player, (3*TICRATE)/2); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNEXPLOSION, MF2_EXPLOSION); @@ -3992,7 +4009,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) // Grenade else if (player->currentweapon == WEP_GRENADE && player->powers[pw_grenadering]) { - TAKE_AMMO(player, pw_grenadering); + P_DrainWeaponAmmo(player, pw_grenadering); P_SetWeaponDelay(player, TICRATE/3); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNGRENADE, MF2_EXPLOSION); @@ -4011,7 +4028,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) angle_t shotangle = player->mo->angle; angle_t oldaiming = player->aiming; - TAKE_AMMO(player, pw_scatterring); + P_DrainWeaponAmmo(player, pw_scatterring); P_SetWeaponDelay(player, (2*TICRATE)/3); // Center @@ -4073,8 +4090,6 @@ firenormal: } } - #undef TAKE_AMMO - if (mo) { if (mo->flags & MF_MISSILE && mo->flags2 & MF2_RAILRING) @@ -11332,6 +11347,12 @@ 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_sneakers] && player->powers[pw_sneakers] < UINT16_MAX) player->powers[pw_sneakers]--; diff --git a/src/st_stuff.c b/src/st_stuff.c index aefb4c53c..142cd3e61 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1960,6 +1960,7 @@ static void ST_drawWeaponRing(powertype_t weapon, INT32 rwflag, INT32 wepflag, I static void ST_drawMatchHUD(void) { + char penaltystr[5]; const INT32 y = 176; // HUD_LIVES INT32 offset = (BASEVIDWIDTH / 2) - (NUM_WEAPONS * 10) - 6; @@ -1986,18 +1987,20 @@ static void ST_drawMatchHUD(void) ST_drawWeaponSelect(offset, y); } - offset += 20; - ST_drawWeaponRing(pw_automaticring, RW_AUTO, WEP_AUTO, offset, y, autoring); - offset += 20; - ST_drawWeaponRing(pw_bouncering, RW_BOUNCE, WEP_BOUNCE, offset, y, bouncering); - offset += 20; - ST_drawWeaponRing(pw_scatterring, RW_SCATTER, WEP_SCATTER, offset, y, scatterring); - offset += 20; - ST_drawWeaponRing(pw_grenadering, RW_GRENADE, WEP_GRENADE, offset, y, grenadering); - offset += 20; - ST_drawWeaponRing(pw_explosionring, RW_EXPLODE, WEP_EXPLODE, offset, y, explosionring); - offset += 20; - ST_drawWeaponRing(pw_railring, RW_RAIL, WEP_RAIL, offset, y, railring); + ST_drawWeaponRing(pw_automaticring, RW_AUTO, WEP_AUTO, offset + 20, y, autoring); + ST_drawWeaponRing(pw_bouncering, RW_BOUNCE, WEP_BOUNCE, offset + 40, y, bouncering); + ST_drawWeaponRing(pw_scatterring, RW_SCATTER, WEP_SCATTER, offset + 60, y, scatterring); + ST_drawWeaponRing(pw_grenadering, RW_GRENADE, WEP_GRENADE, offset + 80, y, grenadering); + ST_drawWeaponRing(pw_explosionring, RW_EXPLODE, WEP_EXPLODE, offset + 100, y, explosionring); + ST_drawWeaponRing(pw_railring, RW_RAIL, WEP_RAIL, offset + 120, y, railring); + + if (stplyr->ammoremovaltimer && leveltime % 8 < 4) + { + sprintf(penaltystr, "-%d", stplyr->ammoremoval); + V_DrawString(offset + 8 + stplyr->ammoremovalweapon * 20, y, + V_REDMAP, penaltystr); + } + } }