From 3fa22c508b36e62b8c264dda3dde874e652c6254 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 30 Mar 2020 17:41:48 -0700 Subject: [PATCH 01/20] Put screenshots, movies and replays under a "media" directory --- src/m_menu.c | 15 ++++++++------- src/m_misc.c | 8 ++++---- src/p_setup.c | 12 +++++++----- src/y_inter.c | 9 +++++---- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 267dbe07f..3abf64476 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2101,14 +2101,14 @@ static void Nextmap_OnChange(void) if (currentMenu == &SP_TimeAttackDef) { // see also p_setup.c's P_LoadRecordGhosts - const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; + const size_t glen = strlen(srb2home)+1+strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; char *gpath = malloc(glen); INT32 i; if (!gpath) return; - sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)); + sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)); CV_StealthSetValue(&cv_dummystaff, 0); @@ -5142,7 +5142,7 @@ void M_ReplayHut(INT32 choice) if (!demo.inreplayhut) { - snprintf(menupath, 1024, "%s"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home); + snprintf(menupath, 1024, "%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home); menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath); } if (!preparefilemenu(false, true)) @@ -7876,20 +7876,21 @@ static boolean M_QuitTimeAttackMenu(void) static void M_ChooseTimeAttack(INT32 choice) { char *gpath; - const size_t glen = strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; + const size_t glen = strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; char nameofdemo[256]; (void)choice; emeralds = 0; M_ClearMenus(true); modeattacking = (levellistmode == LLM_BREAKTHECAPSULES ? ATTACKING_CAPSULES : ATTACKING_RECORD); - I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); - I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755); + gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s", + srb2home, timeattackfolder); + M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755); if ((gpath = malloc(glen)) == NULL) I_Error("Out of memory for replay filepath\n"); - sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); + sprintf(gpath,"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, cv_chooseskin.string); if (!cv_autorecord.value) diff --git a/src/m_misc.c b/src/m_misc.c index 2de64d589..34cfb200a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1121,8 +1121,8 @@ void M_StartMovie(void) if (cv_movie_option.value != 3) { - strcat(pathname, PATHSEP"movies"PATHSEP); - I_mkdir(pathname, 0755); + strcat(pathname, PATHSEP"media"PATHSEP"movies"PATHSEP); + M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755); } if (rendermode == render_none) @@ -1483,8 +1483,8 @@ void M_DoScreenShot(void) if (cv_screenshot_option.value != 3) { - strcat(pathname, PATHSEP"screenshots"PATHSEP); - I_mkdir(pathname, 0755); + strcat(pathname, PATHSEP"media"PATHSEP"screenshots"PATHSEP); + M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755); } #ifdef USE_PNG diff --git a/src/p_setup.c b/src/p_setup.c index 40ea643b7..d569c6452 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2621,14 +2621,14 @@ static void P_ForceCharacter(const char *forcecharskin) static void P_LoadRecordGhosts(void) { // see also m_menu.c's Nextmap_OnChange - const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; + const size_t glen = strlen(srb2home)+1+strlen("media")+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; char *gpath = malloc(glen); INT32 i; if (!gpath) return; - sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); + sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); // Best Time ghost if (cv_ghost_besttime.value) @@ -3203,10 +3203,12 @@ boolean P_SetupLevel(boolean skipprecip) //@TODO I'd like to fix dedis crashing when recording replays for the future too... if (!demo.playback && multiplayer && !dedicated) { static char buf[256]; - sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap)); + char *path; + sprintf(buf, "media"PATHSEP"replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap)); + + path = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online", srb2home); + M_MkdirEach(path, M_PathParts(path) - 4, 0755); - I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); - I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755); G_RecordDemo(buf); } diff --git a/src/y_inter.c b/src/y_inter.c index e9e243b04..93771be5c 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -787,7 +787,7 @@ void Y_Ticker(void) // static void Y_UpdateRecordReplays(void) { - const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; + const size_t glen = strlen(srb2home)+1+strlen("media")+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1; char *gpath; char lastdemo[256], bestdemo[256]; UINT8 earnedEmblems; @@ -823,13 +823,14 @@ static void Y_UpdateRecordReplays(void) G_SetDemoTime(players[consoleplayer].realtime, bestlap); G_CheckDemoStatus(); - I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); - I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755); + gpath = va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s", + srb2home, timeattackfolder); + M_MkdirEach(gpath, M_PathParts(gpath) - 3, 0755); if ((gpath = malloc(glen)) == NULL) I_Error("Out of memory for replay filepath\n"); - sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); + sprintf(gpath,"%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, cv_chooseskin.string); if (FIL_FileExists(lastdemo)) From 735dd26dc64ff0d0e1207fcec327486ea22793f0 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 31 Mar 2020 15:23:24 -0700 Subject: [PATCH 02/20] Put downloads in addons/downloads instead of DOWNLOAD --- src/d_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index aed861e7d..8f42fc918 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1083,7 +1083,6 @@ void D_SRB2Main(void) // use user specific config file #ifdef DEFAULTDIR snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); - snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); else @@ -1094,7 +1093,6 @@ void D_SRB2Main(void) #else snprintf(srb2home, sizeof srb2home, "%s", userhome); - snprintf(downloaddir, sizeof downloaddir, "%s", userhome); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome); else @@ -1116,6 +1114,10 @@ void D_SRB2Main(void) snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons"); I_mkdir(addonsdir, 0755); + /* and downloads in a subdirectory */ + snprintf(downloaddir, sizeof downloaddir, "%.255s%.1s%.255s",/* fuck!! */ + addonsdir, PATHSEP, "downloads"); + // rand() needs seeded regardless of password srand((unsigned int)time(NULL)); From e4094bc2a92bdfd742c5de2af2fc9c2a88379682 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 31 Mar 2020 15:26:22 -0700 Subject: [PATCH 03/20] Remove some redundant code --- src/d_main.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 8f42fc918..1f2eafb3a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1083,6 +1083,10 @@ void D_SRB2Main(void) // use user specific config file #ifdef DEFAULTDIR snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); +#else + snprintf(srb2home, sizeof srb2home, "%s", userhome); +#endif + if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); else @@ -1090,17 +1094,6 @@ void D_SRB2Main(void) // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); - -#else - snprintf(srb2home, sizeof srb2home, "%s", userhome); - if (dedicated) - snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome); - else - snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome); - - // can't use sprintf since there is %u in savegamename - strcatbf(savegamename, userhome, PATHSEP); -#endif } configfile[sizeof configfile - 1] = '\0'; From 4a3a4c0801c258dbb7e68a8c5cbcdd3990ad3466 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 31 Mar 2020 15:50:39 -0700 Subject: [PATCH 04/20] This won't be needed --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 1f2eafb3a..a67c8addd 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1108,7 +1108,7 @@ void D_SRB2Main(void) I_mkdir(addonsdir, 0755); /* and downloads in a subdirectory */ - snprintf(downloaddir, sizeof downloaddir, "%.255s%.1s%.255s",/* fuck!! */ + snprintf(downloaddir, sizeof downloaddir, "%s%s%s", addonsdir, PATHSEP, "downloads"); // rand() needs seeded regardless of password From ccc746fbf40dd81d12a16a37410940311dd02d3e Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 9 Apr 2020 17:21:30 -0700 Subject: [PATCH 05/20] Change netvars in replays --- src/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index 625065120..6f3ccd7f6 100644 --- a/src/command.c +++ b/src/command.c @@ -1543,7 +1543,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) } // Only add to netcmd buffer if in a netgame, otherwise, just change it. - if (netgame || multiplayer) + if (netgame) { WRITEUINT16(p, var->netid); WRITESTRING(p, value); From 1618d61bfcc925bf5249fb2843556f051f4b6388 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 9 Apr 2020 20:56:15 -0400 Subject: [PATCH 06/20] Fix potential overflow --- src/k_kart.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 3342b809b..7ad459ad1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -796,6 +796,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem) { if (getitem == KITEM_SPB || getitem == KITEM_SHRINK) // Indirect items indirectitemcooldown = 20*TICRATE; + if (getitem == KITEM_HYUDORO) // Hyudoro cooldown hyubgone = 5*TICRATE; @@ -1167,7 +1168,17 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) && players[i].kartstuff[k_position] == 1) { // This player is first! Yay! - pdis = player->distancetofinish - players[i].distancetofinish; + + if (player->distancetofinish <= players[i].distancetofinish) + { + // Guess you're in first / tied for first? + pdis = 0; + } + else + { + // Subtract 1st's distance from your distance, to get your distance from 1st! + pdis = player->distancetofinish - players[i].distancetofinish; + } break; } } @@ -1281,7 +1292,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) player->kartstuff[k_itemroulette] = 0; player->kartstuff[k_roulettetype] = 0; if (P_IsDisplayPlayer(player)) - S_StartSound(NULL, (mashed ? sfx_itrolm : sfx_itrolf)); + S_StartSound(NULL, sfx_itrolm); return; } } From 43732b386d65619d4a2b259093c35e2bc03abaf9 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 9 Apr 2020 20:57:21 -0400 Subject: [PATCH 07/20] Fix being able to hold items to get them as early as possible (Doesn't matter in v2 because it'd waste your rings to do it, but y'know how it is. Maybe port for v1.2 if it works?) --- src/k_kart.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 7ad459ad1..1f0eb3462 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1150,17 +1150,21 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. // Finally, if you get past this check, now you can actually start calculating what item you get. - if ((cmd->buttons & BT_ATTACK) && (player->kartstuff[k_itemroulette] >= roulettestop) + if (((cmd->buttons & BT_ATTACK) && !(player->pflags & PF_ATTACKDOWN)) + && (player->kartstuff[k_itemroulette] >= roulettestop) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld] || player->kartstuff[k_userings])) { // Mashing reduces your chances for the good items mashed = FixedDiv((player->kartstuff[k_itemroulette])*FRACUNIT, ((TICRATE*3)+roulettestop)*FRACUNIT) - FRACUNIT; } - else if (!(player->kartstuff[k_itemroulette] >= (TICRATE*3))) - return; + else + { + if (cmd->buttons & BT_ATTACK) + player->pflags |= PF_ATTACKDOWN; - if (cmd->buttons & BT_ATTACK) - player->pflags |= PF_ATTACKDOWN; + if (!(player->kartstuff[k_itemroulette] >= (TICRATE*3))) + return; + } for (i = 0; i < MAXPLAYERS; i++) { From c8da95cbda0cf59f7f99c2d8c2f5f42d2e999ed8 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 9 Apr 2020 21:05:46 -0400 Subject: [PATCH 08/20] Revert "Fix being able to hold items to get them as early as possible" This reverts commit 43732b386d65619d4a2b259093c35e2bc03abaf9. --- src/k_kart.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 1f0eb3462..7ad459ad1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1150,21 +1150,17 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. // Finally, if you get past this check, now you can actually start calculating what item you get. - if (((cmd->buttons & BT_ATTACK) && !(player->pflags & PF_ATTACKDOWN)) - && (player->kartstuff[k_itemroulette] >= roulettestop) + if ((cmd->buttons & BT_ATTACK) && (player->kartstuff[k_itemroulette] >= roulettestop) && !(player->kartstuff[k_eggmanheld] || player->kartstuff[k_itemheld] || player->kartstuff[k_userings])) { // Mashing reduces your chances for the good items mashed = FixedDiv((player->kartstuff[k_itemroulette])*FRACUNIT, ((TICRATE*3)+roulettestop)*FRACUNIT) - FRACUNIT; } - else - { - if (cmd->buttons & BT_ATTACK) - player->pflags |= PF_ATTACKDOWN; + else if (!(player->kartstuff[k_itemroulette] >= (TICRATE*3))) + return; - if (!(player->kartstuff[k_itemroulette] >= (TICRATE*3))) - return; - } + if (cmd->buttons & BT_ATTACK) + player->pflags |= PF_ATTACKDOWN; for (i = 0; i < MAXPLAYERS; i++) { From 9b4e10d5d77d4695513fa33a811eafe08d092762 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 9 Apr 2020 22:56:31 -0400 Subject: [PATCH 09/20] Item dropping code cleanup --- src/k_kart.c | 111 ++++++++++++++++++++++++-------------------------- src/k_kart.h | 2 +- src/p_inter.c | 2 +- 3 files changed, 55 insertions(+), 60 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 3342b809b..4cddcee1d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1434,7 +1434,7 @@ static void K_DebtStingPlayer(player_t *player, INT32 length) if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); - K_DropHnextList(player); + K_DropHnextList(player, false); return; } @@ -2875,7 +2875,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto if (cv_kartdebughuddrop.value && !modeattacking) K_DropItems(player); else - K_DropHnextList(player); + K_DropHnextList(player, false); return; } @@ -3020,7 +3020,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor) if (cv_kartdebughuddrop.value && !modeattacking) K_DropItems(player); else - K_DropHnextList(player); + K_DropHnextList(player, false); return; } @@ -3226,7 +3226,7 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force) if (cv_kartdebughuddrop.value && !modeattacking) K_DropItems(victim); else - K_DropHnextList(victim); + K_DropHnextList(victim, false); return; } @@ -4689,54 +4689,51 @@ void K_UpdateHnextList(player_t *player, boolean clean) nextwork = work->hnext; - while ((work = nextwork) && !P_MobjWasRemoved(work)) + while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work))) { nextwork = work->hnext; if (!clean && (!work->movedir || work->movedir <= (UINT16)player->kartstuff[k_itemamount])) + { continue; + } P_RemoveMobj(work); } } // For getting hit! -void K_DropHnextList(player_t *player) +void K_DropHnextList(player_t *player, boolean keepshields) { mobj_t *work = player->mo, *nextwork, *dropwork; INT32 flip; mobjtype_t type; boolean orbit, ponground, dropall = true; + INT32 shield = K_GetShieldFromItem(player->kartstuff[k_itemtype]); - if (!work || P_MobjWasRemoved(work)) + if (work == NULL || P_MobjWasRemoved(work)) + { return; + } flip = P_MobjFlip(player->mo); ponground = P_IsObjectOnGround(player->mo); - if (player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) + if (shield != KSHIELD_NONE && !keepshields) { - K_DoThunderShield(player); - player->kartstuff[k_itemtype] = KITEM_NONE; - player->kartstuff[k_itemamount] = 0; + if (shield == KSHIELD_THUNDER) + { + K_DoThunderShield(player); + } + player->kartstuff[k_curshield] = KSHIELD_NONE; - } - else if (player->kartstuff[k_itemtype] == KITEM_BUBBLESHIELD) - { player->kartstuff[k_itemtype] = KITEM_NONE; - player->kartstuff[k_itemamount] = 0; - player->kartstuff[k_curshield] = KSHIELD_NONE; - } - else if (player->kartstuff[k_itemtype] == KITEM_FLAMESHIELD) - { - player->kartstuff[k_itemtype] = KITEM_NONE; - player->kartstuff[k_itemamount] = 0; - player->kartstuff[k_curshield] = KSHIELD_NONE; + player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; } nextwork = work->hnext; - while ((work = nextwork) && !P_MobjWasRemoved(work)) + while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work))) { nextwork = work->hnext; @@ -4765,20 +4762,20 @@ void K_DropHnextList(player_t *player) orbit = false; type = MT_EGGMANITEM; break; - // intentionally do nothing - case MT_SINK_SHIELD: - case MT_ROCKETSNEAKER: - return; default: continue; } dropwork = P_SpawnMobj(work->x, work->y, work->z, type); + P_SetTarget(&dropwork->target, player->mo); - P_AddKartItem(dropwork); // needs to be called here so shrink can bust items off players in front of the user. + P_AddKartItem(dropwork); // needs to be called here so shrink can bust items off players in front of the user. + dropwork->angle = work->angle; - dropwork->flags2 = work->flags2; + dropwork->flags |= MF_NOCLIPTHING; + dropwork->flags2 = work->flags2; + dropwork->floorz = work->floorz; dropwork->ceilingz = work->ceilingz; @@ -4807,19 +4804,29 @@ void K_DropHnextList(player_t *player) if (orbit) // splay out { dropwork->flags2 |= MF2_AMBUSH; + dropwork->z += flip; + dropwork->momx = player->mo->momx>>1; dropwork->momy = player->mo->momy>>1; dropwork->momz = 3*flip*mapobjectscale; + if (dropwork->eflags & MFE_UNDERWATER) dropwork->momz = (117 * dropwork->momz) / 200; + P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale); + dropwork->movecount = 2; dropwork->movedir = work->angle - ANGLE_90; + P_SetMobjState(dropwork, dropwork->info->deathstate); + dropwork->tics = -1; + if (type == MT_JAWZ_DUD) + { dropwork->z += 20*flip*dropwork->scale; + } else { dropwork->color = work->color; @@ -4835,39 +4842,33 @@ void K_DropHnextList(player_t *player) P_RemoveMobj(work); } + // we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic... + P_SetTarget(&player->mo->hnext, NULL); + + player->kartstuff[k_bananadrag] = 0; + + if (player->kartstuff[k_eggmanheld]) { - // we need this here too because this is done in afterthink - pointers are cleaned up at the START of each tic... - P_SetTarget(&player->mo->hnext, NULL); - player->kartstuff[k_bananadrag] = 0; - if (player->kartstuff[k_eggmanheld]) - player->kartstuff[k_eggmanheld] = 0; - else if (player->kartstuff[k_itemheld] - && (dropall || (--player->kartstuff[k_itemamount] <= 0))) - { - player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; - player->kartstuff[k_itemtype] = KITEM_NONE; - } + player->kartstuff[k_eggmanheld] = 0; + } + else if (player->kartstuff[k_itemheld] + && (dropall || (--player->kartstuff[k_itemamount] <= 0))) + { + player->kartstuff[k_itemamount] = player->kartstuff[k_itemheld] = 0; + player->kartstuff[k_itemtype] = KITEM_NONE; } } // For getting EXTRA hit! void K_DropItems(player_t *player) { - INT32 shieldhack = 0; + K_DropHnextList(player, true); - if (player->kartstuff[k_curshield]) - shieldhack = K_GetShieldFromItem(player->kartstuff[k_itemtype]); - - if (shieldhack) - player->kartstuff[k_itemtype] = KITEM_NONE; - - K_DropHnextList(player); - - if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount]) + if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount] > 0) { mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM); P_SetScale(drop, drop->scale>>4); - drop->destscale = (3*drop->destscale)/2;; + drop->destscale = (3*drop->destscale)/2; drop->angle = player->mo->angle + ANGLE_90; P_Thrust(drop, @@ -4877,13 +4878,7 @@ void K_DropItems(player_t *player) if (drop->eflags & MFE_UNDERWATER) drop->momz = (117 * drop->momz) / 200; - switch (shieldhack) - { - case KSHIELD_THUNDER: drop->threshold = KITEM_THUNDERSHIELD; break; - case KSHIELD_BUBBLE: drop->threshold = KITEM_BUBBLESHIELD; break; - case KSHIELD_FLAME: drop->threshold = KITEM_FLAMESHIELD; break; - default: drop->threshold = player->kartstuff[k_itemtype]; break; - } + drop->threshold = player->kartstuff[k_itemtype]; drop->movecount = player->kartstuff[k_itemamount]; drop->flags |= MF_NOCLIPTHING; diff --git a/src/k_kart.h b/src/k_kart.h index 8dc5604b8..4053e687c 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -56,7 +56,7 @@ void K_DoSneaker(player_t *player, INT32 type); void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound); void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source); void K_UpdateHnextList(player_t *player, boolean clean); -void K_DropHnextList(player_t *player); +void K_DropHnextList(player_t *player, boolean keepshields); void K_RepairOrbitChain(mobj_t *orbit); player_t *K_FindJawzTarget(mobj_t *actor, player_t *source); boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y); diff --git a/src/p_inter.c b/src/p_inter.c index 8cc307571..1451e4b6d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -542,7 +542,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->kartstuff[k_bubbleblowup] > 0) { - K_DropHnextList(player); + K_DropHnextList(player, false); special->extravalue1 = 2; // WAIT... special->extravalue2 = 52; // Slightly over the respawn timer length return; From 8b5bd645ca5d8ef9269aa6ccf4375337bd0c1672 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 9 Apr 2020 22:57:05 -0400 Subject: [PATCH 10/20] See if cleaning the pointer here fixes shrink/eggbox syncbombs --- src/k_kart.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 4cddcee1d..865ee11cb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4700,6 +4700,13 @@ void K_UpdateHnextList(player_t *player, boolean clean) P_RemoveMobj(work); } + + if (player->mo->hnext == NULL || P_MobjWasRemoved(player->mo->hnext)) + { + // Like below, try to clean up the pointer if it's NULL. + // Maybe this was a cause of the shrink/eggbox fails? + P_SetTarget(&player->mo->hnext, NULL); + } } // For getting hit! From 371cc18bf68dc194a2f74b18f4c26e9a9165962f Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 12 Apr 2020 21:04:07 -0400 Subject: [PATCH 11/20] Update ALL finish line distances & positions, separately, before player thinkers happen, ensuring it's never inaccurate --- src/k_kart.c | 9 ++------- src/k_kart.h | 1 + src/p_tick.c | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 7ad459ad1..dab36aaf9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6287,10 +6287,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) void K_KartPlayerAfterThink(player_t *player) { - // Moved to afterthink, as at this point the players have had their distances to the finish line updated - // and this will correctly account for all players - K_KartUpdatePosition(player); - if (player->kartstuff[k_curshield] || player->kartstuff[k_invincibilitytimer] || (player->kartstuff[k_growshrinktimer] != 0 && player->kartstuff[k_growshrinktimer] % 5 == 4)) // 4 instead of 0 because this is afterthink! @@ -6607,7 +6603,7 @@ static boolean K_PlayerCloserToNextWaypoints(waypoint_t *const waypoint, player_ } /*-------------------------------------------------- - static void K_UpdateDistanceFromFinishLine(player_t *const player) + void K_UpdateDistanceFromFinishLine(player_t *const player) Updates the distance a player has to the finish line. @@ -6617,7 +6613,7 @@ static boolean K_PlayerCloserToNextWaypoints(waypoint_t *const waypoint, player_ Return:- None --------------------------------------------------*/ -static void K_UpdateDistanceFromFinishLine(player_t *const player) +void K_UpdateDistanceFromFinishLine(player_t *const player) { if ((player != NULL) && (player->mo != NULL)) { @@ -7167,7 +7163,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) boolean HOLDING_ITEM = (player->kartstuff[k_itemheld] || player->kartstuff[k_eggmanheld]); boolean NO_HYUDORO = (player->kartstuff[k_stolentimer] == 0 && player->kartstuff[k_stealingtimer] == 0); - K_UpdateDistanceFromFinishLine(player); player->pflags &= ~PF_HITFINISHLINE; if (!player->exiting) diff --git a/src/k_kart.h b/src/k_kart.h index 8dc5604b8..8f47b9780 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -59,6 +59,7 @@ void K_UpdateHnextList(player_t *player, boolean clean); void K_DropHnextList(player_t *player); void K_RepairOrbitChain(mobj_t *orbit); player_t *K_FindJawzTarget(mobj_t *actor, player_t *source); +void K_UpdateDistanceFromFinishLine(player_t *const player); boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y); INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue); INT32 K_GetKartDriftSparkValue(player_t *player); diff --git a/src/p_tick.c b/src/p_tick.c index d7359b307..43ca98416 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -616,6 +616,17 @@ void P_Ticker(boolean run) G_ReadDemoTiccmd(&players[i].cmd, i); } + // First loop: Ensure all players' distance to the finish line are all accurate + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) + K_UpdateDistanceFromFinishLine(&players[i]); + + // Second loop: Ensure all player positions reflect everyone's distances + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) + K_KartUpdatePosition(&players[i]); + + // OK! Now that we got all of that sorted, players can think! for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerThink(&players[i]); @@ -778,6 +789,17 @@ void P_PreTicker(INT32 frames) { P_MapStart(); + // First loop: Ensure all players' distance to the finish line are all accurate + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) + K_UpdateDistanceFromFinishLine(&players[i]); + + // Second loop: Ensure all player positions reflect everyone's distances + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) + K_KartUpdatePosition(&players[i]); + + // OK! Now that we got all of that sorted, players can think! for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) { From da953c9dae05fae848e2e61e4f81b993852bea94 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 12 Apr 2020 23:51:00 -0400 Subject: [PATCH 12/20] No more modulo bullshit in VERSION VERSION is the first number, SUBVERSION is the second number, and the third number burns in hell; we really don't need that precision --- src/d_clisrv.c | 12 ++++++------ src/doomdef.h | 2 +- src/mserv.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 084a6fd81..3347091a3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1880,7 +1880,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) { char version[8] = ""; #if VERSION > 0 || SUBVERSION > 0 - snprintf(version, sizeof (version), "%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION); + snprintf(version, sizeof (version), "%d.%d", VERSION, SUBVERSION); #else strcpy(version, GetRevisionString()); #endif @@ -2355,8 +2355,8 @@ static void CL_ConnectToServer(boolean viams) gametypestr = Gametype_Names[num]; if (gametypestr) CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr); - CONS_Printf(M_GetText("Version: %d.%d.%u\n"), serverlist[i].info.version/100, - serverlist[i].info.version%100, serverlist[i].info.subversion); + CONS_Printf(M_GetText("Version: %d.%d\n"), + serverlist[i].info.version, serverlist[i].info.subversion); } SL_ClearServerList(servernode); #endif @@ -3296,8 +3296,8 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum); // called one time at init void D_ClientServerInit(void) { - DEBFILE(va("- - -== SRB2Kart v%d.%.2d.%d "VERSIONSTRING" debugfile ==- - -\n", - VERSION/100, VERSION%100, SUBVERSION)); + DEBFILE(va("- - -== SRB2Kart v%d.%d "VERSIONSTRING" debugfile ==- - -\n", + VERSION, SUBVERSION)); #ifndef NONET COM_AddCommand("getplayernum", Command_GetPlayerNum); @@ -3822,7 +3822,7 @@ static void HandleConnect(SINT8 node) SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server")); else if (netbuffer->u.clientcfg.version != VERSION || netbuffer->u.clientcfg.subversion != SUBVERSION) - SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION)); + SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d)"), VERSION, SUBVERSION)); else if (!cv_allownewplayer.value && node) SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment")); else if (D_NumPlayers() >= maxplayers) diff --git a/src/doomdef.h b/src/doomdef.h index ef7a2f8cb..2a67ce0e2 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,7 +150,7 @@ extern char logfilename[1024]; // most interface strings are ignored in development mode. // we use comprevision and compbranch instead. #else -#define VERSION 200 // Game version +#define VERSION 2 // Game version #define SUBVERSION 0 // more precise version number #define VERSIONSTRING "v2.0" #define VERSIONSTRINGW L"v2.0" diff --git a/src/mserv.c b/src/mserv.c index c7344b16a..12469928d 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -751,7 +751,7 @@ static INT32 AddToMasterServer(boolean firstadd) strcpy(info->name, cv_servername.string); M_Memcpy(&info->room, & room, sizeof (INT32)); #if VERSION > 0 || SUBVERSION > 0 - sprintf(info->version, "%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION); + sprintf(info->version, "%d.%d", VERSION, SUBVERSION); #else // Trunk build, send revision info strcpy(info->version, GetRevisionString()); #endif @@ -789,7 +789,7 @@ static INT32 RemoveFromMasterSever(void) strcpy(info->ip, ""); strcpy(info->port, int2str(current_port)); strcpy(info->name, registered_server.name); - sprintf(info->version, "%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION); + sprintf(info->version, "%d.%d", VERSION, SUBVERSION); msg.type = REMOVE_SERVER_MSG; msg.length = (UINT32)sizeof (msg_server_t); From ab40ede95508b7dc55c87facb001a92e67ce6653 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Apr 2020 18:45:23 -0700 Subject: [PATCH 13/20] Line special 507, scroll tagged lines' front and back textures by front and back texture offsets --- src/p_spec.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 425d1c779..2d80dce5c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7205,9 +7205,15 @@ static void P_SpawnScrollers(void) { fixed_t dx = l->dx >> SCROLL_SHIFT; // direction and speed of scrolling fixed_t dy = l->dy >> SCROLL_SHIFT; + + fixed_t bx = 0;/* backside variants */ + fixed_t by = 0; + INT32 control = -1, accel = 0; // no control sector or acceleration INT32 special = l->special; + INT32 s; + // These types are same as the ones they get set to except that the // first side's sector's heights cause scrolling when they change, and // this linedef controls the direction and speed of the scrolling. The @@ -7236,10 +7242,21 @@ static void P_SpawnScrollers(void) control = (INT32)(sides[*l->sidenum].sector - sectors); } + if (special == 507) // front and back scrollers + { + s = l->sidenum[0]; + + dx = -(sides[s].textureoffset); + dy = sides[s].rowoffset; + + s = l->sidenum[1]; + + bx = -(sides[s].textureoffset); + by = sides[s].rowoffset; + } + switch (special) { - register INT32 s; - case 513: // scroll effect ceiling case 533: // scroll and carry objects on ceiling for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) @@ -7292,6 +7309,17 @@ static void P_SpawnScrollers(void) CONS_Debug(DBG_GAMELOGIC, "Line special 506 (line #%s) missing 2nd side!\n", sizeu1(i)); break; + case 507: // scroll front and backside of tagged lines + for (s = -1; (s = P_FindLineFromLineTag(l, s)) >= 0 ;) + { + if (s != (INT32)i) + { + Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0); + Add_Scroller(sc_side, bx, by, control, lines[s].sidenum[1], accel, 0); + } + } + break; + case 500: // scroll first side Add_Scroller(sc_side, FRACUNIT, 0, -1, lines[i].sidenum[0], accel, 0); break; From 190fc271216627510ddec597a72fcd0ac1a8cdbb Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Apr 2020 18:48:23 -0700 Subject: [PATCH 14/20] Check that a back side exists --- src/p_spec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 2d80dce5c..ee3e4851f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7251,8 +7251,11 @@ static void P_SpawnScrollers(void) s = l->sidenum[1]; - bx = -(sides[s].textureoffset); - by = sides[s].rowoffset; + if (s != 0xffff) + { + bx = -(sides[s].textureoffset); + by = sides[s].rowoffset; + } } switch (special) @@ -7315,7 +7318,8 @@ static void P_SpawnScrollers(void) if (s != (INT32)i) { Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0); - Add_Scroller(sc_side, bx, by, control, lines[s].sidenum[1], accel, 0); + if (lines[s].sidenum[1] != 0xffff) + Add_Scroller(sc_side, bx, by, control, lines[s].sidenum[1], accel, 0); } } break; From e941749f4c96026912b3945d376187c1b26f2f4e Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Wed, 15 Apr 2020 22:45:03 -0400 Subject: [PATCH 15/20] Move all of the item destroy sector code to one place --- src/p_mobj.c | 73 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2a12dcc7a..2838e9388 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6153,7 +6153,7 @@ boolean P_IsKartItem(INT32 type) type == MT_JAWZ || type == MT_JAWZ_DUD || type == MT_JAWZ_SHIELD || type == MT_SSMINE || type == MT_SSMINE_SHIELD || type == MT_SINK || type == MT_SINK_SHIELD || - type == MT_SPB) + type == MT_SPB || type == MT_BALLHOG || type == MT_BUBBLESHIELDTRAP) return true; else return false; @@ -7175,6 +7175,41 @@ void P_MobjThinker(mobj_t *mobj) return; } #endif + + // Destroy items sector special + if (mobj->type == MT_BANANA || mobj->type == MT_EGGMANITEM + || mobj->type == MT_ORBINAUT || mobj->type == MT_BALLHOG + || mobj->type == MT_JAWZ || mobj->type == MT_JAWZ_DUD + || mobj->type == MT_SSMINE || mobj->type == MT_BUBBLESHIELDTRAP) + { + if (mobj->health > 0 && P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) + { + if (mobj->type == MT_SSMINE + || mobj->type == MT_BUBBLESHIELDTRAP + || mobj->type == MT_BALLHOG) + { + S_StartSound(mobj, mobj->info->deathsound); + P_KillMobj(mobj, NULL, NULL); + } + else + { + // This Item Damage + if (mobj->eflags & MFE_VERTICALFLIP) + mobj->z -= mobj->height; + else + mobj->z += mobj->height; + + S_StartSound(mobj, mobj->info->deathsound); + P_KillMobj(mobj, NULL, NULL); + + P_SetObjectMomZ(mobj, 8*FRACUNIT, false); + P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy) + ANGLE_90, 16*FRACUNIT); + } + + return; + } + } + // if it's pushable, or if it would be pushable other than temporary disablement, use the // separate thinker if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse)) @@ -7939,12 +7974,6 @@ void P_MobjThinker(mobj_t *mobj) { boolean grounded = P_IsObjectOnGround(mobj); - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->flags2 & MF2_AMBUSH) { if (grounded && (mobj->flags & MF_NOCLIPTHING)) @@ -8015,12 +8044,6 @@ void P_MobjThinker(mobj_t *mobj) { mobj_t *ghost = P_SpawnGhostMobj(mobj); - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) { ghost->color = mobj->target->player->skincolor; @@ -8045,12 +8068,6 @@ void P_MobjThinker(mobj_t *mobj) { boolean grounded = P_IsObjectOnGround(mobj); - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->flags2 & MF2_AMBUSH) { if (grounded && (mobj->flags & MF_NOCLIPTHING)) @@ -8124,12 +8141,6 @@ void P_MobjThinker(mobj_t *mobj) case MT_BANANA: mobj->friction = ORIG_FRICTION/4; - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->momx || mobj->momy) { mobj_t *ghost = P_SpawnGhostMobj(mobj); @@ -8159,12 +8170,6 @@ void P_MobjThinker(mobj_t *mobj) mobj_t *ghost = P_SpawnGhostMobj(mobj); ghost->fuse = 3; - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) { ghost->color = mobj->target->player->skincolor; @@ -8197,12 +8202,6 @@ void P_MobjThinker(mobj_t *mobj) mobj->threshold--; break; case MT_SSMINE: - if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true)) - { - P_RemoveMobj(mobj); - return; - } - if (mobj->target && mobj->target->player) mobj->color = mobj->target->player->skincolor; else From 263c31f5df8f4a47c233d7fa4687f1917b4688a5 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 21 Apr 2020 02:38:08 +0800 Subject: [PATCH 16/20] Improve camera tilt --- src/p_user.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 16038fade..3a5300f42 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7411,7 +7411,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (mo->standingslope) { - pitch = (angle_t)FixedMul(P_ReturnThrustX(mo, player->frameangle - mo->standingslope->xydirection, FRACUNIT), (fixed_t)mo->standingslope->zangle); + pitch = (angle_t)FixedMul(P_ReturnThrustX(mo, thiscam->angle - mo->standingslope->xydirection, FRACUNIT), (fixed_t)mo->standingslope->zangle); if (mo->eflags & MFE_VERTICALFLIP) { if (pitch >= ANGLE_180) @@ -7476,9 +7476,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall pviewheight = FixedMul(32<scale); if (mo->eflags & MFE_VERTICALFLIP) - z = mo->z + mo->height - pviewheight - camheight + distz; + { + distz = min(-height, distz); + z = mo->z + mo->height - pviewheight + distz; + } else - z = mo->z + pviewheight + camheight + distz; + { + distz = max(height, distz); + z = mo->z + pviewheight + distz; + } #ifndef NOCLIPCAM // Disable all z-clipping for noclip cam // move camera down to move under lower ceilings @@ -7724,13 +7730,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - P_GetPlayerHeight(player)); if (thiscam->pitch < ANGLE_180 && thiscam->pitch > angle) - angle = thiscam->pitch; + angle += (thiscam->pitch - angle)/2; } else { angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + P_GetPlayerHeight(player)); if (thiscam->pitch >= ANGLE_180 && thiscam->pitch < angle) - angle = thiscam->pitch; + angle -= (angle - thiscam->pitch)/2; } if (player->playerstate != PST_DEAD && !((player->pflags & PF_NIGHTSMODE) && player->exiting)) From 6905cfb0643df798cd53649ef40b49153378ced8 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 21 Apr 2020 03:30:45 +0800 Subject: [PATCH 17/20] Revert camtilt splitscreen hacks --- src/p_user.c | 4 ++-- src/r_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 3a5300f42..46b0a4f26 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7434,8 +7434,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else distxy = dist; distz = -FixedMul(dist, FINESINE((pitch>>ANGLETOFINESHIFT) & FINEMASK)); - if (r_splitscreen == 1) // 2 player is weird, this helps keep players on screen - distz = 3*distz/5; + //if (r_splitscreen == 1) // 2 player is weird, this helps keep players on screen + //distz = 3*distz/5; x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); diff --git a/src/r_main.c b/src/r_main.c index 5afda93f7..10ba4d6a8 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -841,7 +841,7 @@ static void R_SetupFreelook(void) // clip it in the case we are looking a hardware 90 degrees full aiming // (lmps, network and use F12...) G_SoftwareClipAimingPitch((INT32 *)&aimingangle); - dy = AIMINGTODY(aimingangle) * viewheight/BASEVIDHEIGHT; + dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH; yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)]; } centery = (viewheight/2) + dy; From c92634c71e4bba4c00301c909292175c2050b23a Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 21 Apr 2020 05:24:48 +0800 Subject: [PATCH 18/20] Make lookback instantaneous --- src/p_user.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 46b0a4f26..fe7082990 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7157,13 +7157,14 @@ void P_ResetCamera(player_t *player, camera_t *thiscam) boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled) { - static UINT8 lookbackdelay[4] = {0,0,0,0}; + static boolean lookbackactive[MAXSPLITSCREENPLAYERS]; + static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS]; UINT8 num; angle_t angle = 0, focusangle = 0, focusaiming = 0, pitch = 0; fixed_t x, y, z, dist, distxy, distz, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; fixed_t pan, xpan, ypan; INT32 camrotate; - boolean camstill, lookback; + boolean camstill, lookback, lookbackdown; UINT8 timeover; mobj_t *mo; fixed_t f1, f2; @@ -7343,15 +7344,19 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camstill = true; else if (lookback || lookbackdelay[num]) // SRB2kart - Camera flipper { +#define MAXLOOKBACKDELAY 2 camspeed = FRACUNIT; if (lookback) { camrotate += 180; - lookbackdelay[num] = 2; + lookbackdelay[num] = MAXLOOKBACKDELAY; } else lookbackdelay[num]--; } + lookbackdown = (lookbackdelay[num] == MAXLOOKBACKDELAY) != lookbackactive[num]; + lookbackactive[num] = (lookbackdelay[num] == MAXLOOKBACKDELAY); +#undef MAXLOOKBACKDELAY if (mo->eflags & MFE_VERTICALFLIP) camheight += thiscam->height; @@ -7434,8 +7439,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else distxy = dist; distz = -FixedMul(dist, FINESINE((pitch>>ANGLETOFINESHIFT) & FINEMASK)); - //if (r_splitscreen == 1) // 2 player is weird, this helps keep players on screen - //distz = 3*distz/5; x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy); @@ -7779,6 +7782,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall thiscam->aiming = ANGLE_22h; } + if (lookbackdown) + P_MoveChaseCamera(player, thiscam, false); + return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); } From dd126494b3b7bfc74bca904c2a9ec16743f13de6 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 22 Apr 2020 22:59:57 +0800 Subject: [PATCH 19/20] [Everyone disliked that.] (revert camera zoom) --- src/p_user.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index fe7082990..5358df1fe 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7161,7 +7161,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS]; UINT8 num; angle_t angle = 0, focusangle = 0, focusaiming = 0, pitch = 0; - fixed_t x, y, z, dist, distxy, distz, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; + fixed_t x, y, z, dist, distxy, distz, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; fixed_t pan, xpan, ypan; INT32 camrotate; boolean camstill, lookback, lookbackdown; @@ -7399,8 +7399,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall thiscam->angle = angle; } - height = camheight; - // sets ideal cam pos dist = camdist; @@ -7409,10 +7407,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist += abs(thiscam->momz)/4; if (player->karthud[khud_boostcam]) - { dist -= FixedMul(11*dist/16, player->karthud[khud_boostcam]); - height -= FixedMul(height, player->karthud[khud_boostcam]); - } if (mo->standingslope) { @@ -7480,12 +7475,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (mo->eflags & MFE_VERTICALFLIP) { - distz = min(-height, distz); + distz = min(-camheight, distz); z = mo->z + mo->height - pviewheight + distz; } else { - distz = max(height, distz); + distz = max(camheight, distz); z = mo->z + pviewheight + distz; } From 4040698e2403fd7bb912d959491ce447a06d6b33 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 22 Apr 2020 23:24:13 +0800 Subject: [PATCH 20/20] Add new files to src/CMakeLists.txt --- src/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f97c173c..4447614d3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,7 @@ set(SRB2_CORE_SOURCES filesrch.c g_game.c g_input.c + g_splitscreen.c hu_stuff.c i_tcp.c info.c @@ -156,7 +157,13 @@ set(SRB2_CORE_GAME_SOURCES p_telept.c p_tick.c p_user.c + k_battle.c + k_bheap.c + k_collide.c k_kart.c + k_pathfind.c + k_pwrlv.c + k_waypoint.c p_local.h p_maputl.h @@ -168,7 +175,13 @@ set(SRB2_CORE_GAME_SOURCES p_slopes.h p_spec.h p_tick.h + k_battle.h + k_bheap.h + k_collide.h k_kart.h + k_pathfind.h + k_pwrlv.h + k_waypoint.h ) if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))