From 4f18f6d3cf2bf06d23aad8cc1d78b5046a4def51 Mon Sep 17 00:00:00 2001 From: lachablock Date: Thu, 18 Mar 2021 14:48:15 +1100 Subject: [PATCH 01/18] Remove PF_SPINNING upon use of any jump ability, so that directionchar works properly --- src/p_user.c | 351 ++++++++++++++++++++++++++------------------------- 1 file changed, 177 insertions(+), 174 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 02592053d..261272313 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5012,7 +5012,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) static void P_DoTwinSpin(player_t *player) { - player->pflags &= ~PF_NOJUMPDAMAGE; + player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING); player->pflags |= P_GetJumpFlags(player) | PF_THOKKED; S_StartSound(player->mo, sfx_s3k42); player->mo->frame = 0; @@ -5286,194 +5286,197 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) else if (player->pflags & PF_JUMPED) { if (!LUAh_AbilitySpecial(player)) - switch (player->charability) { - case CA_THOK: - case CA_HOMINGTHOK: - case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original - // Now it's Sonic's abilities turn! - // THOK! - if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) - { - // Catapult the player - fixed_t actionspd = player->actionspd; - - if (player->charflags & SF_DASHMODE) - actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); - - if (player->mo->eflags & MFE_UNDERWATER) - actionspd >>= 1; - - if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) + switch (player->charability) + { + case CA_THOK: + case CA_HOMINGTHOK: + case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original + // Now it's Sonic's abilities turn! + // THOK! + if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) { - player->pflags &= ~PF_JUMPED; - P_DoJump(player, false); - } + // Catapult the player + fixed_t actionspd = player->actionspd; - P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); + if (player->charflags & SF_DASHMODE) + actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); - if (maptol & TOL_2D) - { - player->mo->momx /= 2; - player->mo->momy /= 2; - } - if (player->charability == CA_HOMINGTHOK) - { - player->mo->momx /= 2; - player->mo->momy /= 2; - } + if (player->mo->eflags & MFE_UNDERWATER) + actionspd >>= 1; - if (player->charability == CA_HOMINGTHOK) - { - P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok)); - if (lockonthok) + if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) { - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y); - player->homing = 3*TICRATE; - } - else - { - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); player->pflags &= ~PF_JUMPED; - player->mo->height = P_GetPlayerHeight(player); + P_DoJump(player, false); } - player->pflags &= ~PF_NOJUMPDAMAGE; - } - player->drawangle = player->mo->angle; + P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); - if (player->mo->info->attacksound && !player->spectator) - S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound - - P_SpawnThokMobj(player); - - player->pflags &= ~(PF_SPINNING|PF_STARTDASH); - player->pflags |= PF_THOKKED; - - // Change localangle to match for simple controls? (P.S. chalupa) - // disabled because it seemed to disorient people and Z-targeting exists now - /*if (!demoplayback) - { - if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright))) - P_SetPlayerAngle(player, player->mo->angle);; - else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright))) - P_SetPlayerAngle(player, player->mo->angle); - }*/ - } - break; - - case CA_FLY: - case CA_SWIM: - // If currently in the air from a jump, and you pressed the - // button again and have the ability to fly, do so! - if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) - ; // Can't do anything if you're a fish out of water! - else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) - { - P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation - - player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer - - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING|PF_STARTDASH); - if (player->bot == 1) - player->pflags |= PF_THOKKED; - else - player->pflags |= (PF_THOKKED|PF_CANCARRY); - } - break; - case CA_GLIDEANDCLIMB: - // Now Knuckles-type abilities are checked. - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale); - fixed_t playerspeed = player->speed; - - if (player->mo->eflags & MFE_UNDERWATER) - { - glidespeed >>= 1; - playerspeed = 2*playerspeed/3; - if (!(player->powers[pw_super] || player->powers[pw_sneakers])) + if (maptol & TOL_2D) { - player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx; - player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy; + player->mo->momx /= 2; + player->mo->momy /= 2; } + if (player->charability == CA_HOMINGTHOK) + { + player->mo->momx /= 2; + player->mo->momy /= 2; + } + + if (player->charability == CA_HOMINGTHOK) + { + P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok)); + if (lockonthok) + { + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y); + player->homing = 3*TICRATE; + } + else + { + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + player->pflags &= ~PF_JUMPED; + player->mo->height = P_GetPlayerHeight(player); + } + player->pflags &= ~PF_NOJUMPDAMAGE; + } + + player->drawangle = player->mo->angle; + + if (player->mo->info->attacksound && !player->spectator) + S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound + + P_SpawnThokMobj(player); + + player->pflags &= ~(PF_STARTDASH); + player->pflags |= PF_THOKKED; + + // Change localangle to match for simple controls? (P.S. chalupa) + // disabled because it seemed to disorient people and Z-targeting exists now + /*if (!demoplayback) + { + if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright))) + P_SetPlayerAngle(player, player->mo->angle);; + else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright))) + P_SetPlayerAngle(player, player->mo->angle); + }*/ } + break; - player->pflags |= PF_GLIDING|PF_THOKKED; - player->glidetime = 0; + case CA_FLY: + case CA_SWIM: + // If currently in the air from a jump, and you pressed the + // button again and have the ability to fly, do so! + if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) + ; // Can't do anything if you're a fish out of water! + else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) + { + P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation - P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); - if (playerspeed < glidespeed) - P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed); - player->pflags &= ~(PF_SPINNING|PF_STARTDASH); - } - break; - case CA_DOUBLEJUMP: // Double-Jump - if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS)))) - { - player->pflags |= PF_THOKKED; - player->pflags &= ~PF_JUMPED; - P_DoJump(player, true); - player->secondjump++; - } - break; - case CA_FLOAT: // Float - case CA_SLOWFALL: // Slow descent hover - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD) - P_SetPlayerMobjState(player->mo, S_PLAY_DASH); - else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); - else - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); - player->pflags |= PF_THOKKED; - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING); - player->secondjump = 1; - } - break; - case CA_TELEKINESIS: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - P_Telekinesis(player, - FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) - FixedMul(384*FRACUNIT, player->mo->scale)); - } - break; - case CA_FALLSWITCH: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - player->mo->momz = -player->mo->momz; - P_SpawnThokMobj(player); - player->pflags |= PF_THOKKED; - } - break; - case CA_AIRDRILL: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; - player->pflags |= PF_THOKKED; - S_StartSound(player->mo, sfx_spndsh); - } - break; - case CA_BOUNCE: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE); - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); - player->pflags |= PF_THOKKED|PF_BOUNCING; - player->mo->momx >>= 1; - player->mo->momy >>= 1; - player->mo->momz >>= 1; - } - break; - case CA_TWINSPIN: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - P_DoTwinSpin(player); - break; - default: - break; + player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer + + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_STARTDASH); + if (player->bot == 1) + player->pflags |= PF_THOKKED; + else + player->pflags |= (PF_THOKKED|PF_CANCARRY); + } + break; + case CA_GLIDEANDCLIMB: + // Now Knuckles-type abilities are checked. + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale); + fixed_t playerspeed = player->speed; + + if (player->mo->eflags & MFE_UNDERWATER) + { + glidespeed >>= 1; + playerspeed = 2*playerspeed/3; + if (!(player->powers[pw_super] || player->powers[pw_sneakers])) + { + player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx; + player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy; + } + } + + player->pflags |= PF_GLIDING|PF_THOKKED; + player->glidetime = 0; + + P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); + if (playerspeed < glidespeed) + P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed); + player->pflags &= ~(PF_STARTDASH); + } + break; + case CA_DOUBLEJUMP: // Double-Jump + if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS)))) + { + player->pflags |= PF_THOKKED; + player->pflags &= ~PF_JUMPED; + P_DoJump(player, true); + player->secondjump++; + } + break; + case CA_FLOAT: // Float + case CA_SLOWFALL: // Slow descent hover + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD) + P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); + else + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); + player->pflags |= PF_THOKKED; + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); + player->secondjump = 1; + } + break; + case CA_TELEKINESIS: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + P_Telekinesis(player, + FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) + FixedMul(384*FRACUNIT, player->mo->scale)); + } + break; + case CA_FALLSWITCH: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + player->mo->momz = -player->mo->momz; + P_SpawnThokMobj(player); + player->pflags |= PF_THOKKED; + } + break; + case CA_AIRDRILL: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; + player->pflags |= PF_THOKKED; + S_StartSound(player->mo, sfx_spndsh); + } + break; + case CA_BOUNCE: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE); + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); + player->pflags |= PF_THOKKED|PF_BOUNCING; + player->mo->momx >>= 1; + player->mo->momy >>= 1; + player->mo->momz >>= 1; + } + break; + case CA_TWINSPIN: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + P_DoTwinSpin(player); + break; + default: + break; + } + player->pflags &= ~PF_SPINNING; } } else if (player->pflags & PF_THOKKED) From 04c021777487956cdd29ea9d6d9a91b1ba65d24d Mon Sep 17 00:00:00 2001 From: lachablock Date: Tue, 23 Mar 2021 14:50:05 +1100 Subject: [PATCH 02/18] Revert "Remove PF_SPINNING upon use of any jump ability, so that directionchar works properly" This reverts commit 4f18f6d3cf2bf06d23aad8cc1d78b5046a4def51. --- src/p_user.c | 363 +++++++++++++++++++++++++-------------------------- 1 file changed, 180 insertions(+), 183 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 261272313..02592053d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5012,7 +5012,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) static void P_DoTwinSpin(player_t *player) { - player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING); + player->pflags &= ~PF_NOJUMPDAMAGE; player->pflags |= P_GetJumpFlags(player) | PF_THOKKED; S_StartSound(player->mo, sfx_s3k42); player->mo->frame = 0; @@ -5286,197 +5286,194 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) else if (player->pflags & PF_JUMPED) { if (!LUAh_AbilitySpecial(player)) + switch (player->charability) { - switch (player->charability) - { - case CA_THOK: - case CA_HOMINGTHOK: - case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original - // Now it's Sonic's abilities turn! - // THOK! - if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) + case CA_THOK: + case CA_HOMINGTHOK: + case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original + // Now it's Sonic's abilities turn! + // THOK! + if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) + { + // Catapult the player + fixed_t actionspd = player->actionspd; + + if (player->charflags & SF_DASHMODE) + actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); + + if (player->mo->eflags & MFE_UNDERWATER) + actionspd >>= 1; + + if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) { - // Catapult the player - fixed_t actionspd = player->actionspd; - - if (player->charflags & SF_DASHMODE) - actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); - - if (player->mo->eflags & MFE_UNDERWATER) - actionspd >>= 1; - - if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED)) - { - player->pflags &= ~PF_JUMPED; - P_DoJump(player, false); - } - - P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); - - if (maptol & TOL_2D) - { - player->mo->momx /= 2; - player->mo->momy /= 2; - } - if (player->charability == CA_HOMINGTHOK) - { - player->mo->momx /= 2; - player->mo->momy /= 2; - } - - if (player->charability == CA_HOMINGTHOK) - { - P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok)); - if (lockonthok) - { - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y); - player->homing = 3*TICRATE; - } - else - { - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); - player->pflags &= ~PF_JUMPED; - player->mo->height = P_GetPlayerHeight(player); - } - player->pflags &= ~PF_NOJUMPDAMAGE; - } - - player->drawangle = player->mo->angle; - - if (player->mo->info->attacksound && !player->spectator) - S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound - - P_SpawnThokMobj(player); - - player->pflags &= ~(PF_STARTDASH); - player->pflags |= PF_THOKKED; - - // Change localangle to match for simple controls? (P.S. chalupa) - // disabled because it seemed to disorient people and Z-targeting exists now - /*if (!demoplayback) - { - if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright))) - P_SetPlayerAngle(player, player->mo->angle);; - else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright))) - P_SetPlayerAngle(player, player->mo->angle); - }*/ - } - break; - - case CA_FLY: - case CA_SWIM: - // If currently in the air from a jump, and you pressed the - // button again and have the ability to fly, do so! - if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) - ; // Can't do anything if you're a fish out of water! - else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) - { - P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation - - player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer - - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_STARTDASH); - if (player->bot == 1) - player->pflags |= PF_THOKKED; - else - player->pflags |= (PF_THOKKED|PF_CANCARRY); - } - break; - case CA_GLIDEANDCLIMB: - // Now Knuckles-type abilities are checked. - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale); - fixed_t playerspeed = player->speed; - - if (player->mo->eflags & MFE_UNDERWATER) - { - glidespeed >>= 1; - playerspeed = 2*playerspeed/3; - if (!(player->powers[pw_super] || player->powers[pw_sneakers])) - { - player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx; - player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy; - } - } - - player->pflags |= PF_GLIDING|PF_THOKKED; - player->glidetime = 0; - - P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); - if (playerspeed < glidespeed) - P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed); - player->pflags &= ~(PF_STARTDASH); - } - break; - case CA_DOUBLEJUMP: // Double-Jump - if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS)))) - { - player->pflags |= PF_THOKKED; player->pflags &= ~PF_JUMPED; - P_DoJump(player, true); - player->secondjump++; + P_DoJump(player, false); } - break; - case CA_FLOAT: // Float - case CA_SLOWFALL: // Slow descent hover - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + + P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale)); + + if (maptol & TOL_2D) { - if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD) - P_SetPlayerMobjState(player->mo, S_PLAY_DASH); - else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); + player->mo->momx /= 2; + player->mo->momy /= 2; + } + if (player->charability == CA_HOMINGTHOK) + { + player->mo->momx /= 2; + player->mo->momy /= 2; + } + + if (player->charability == CA_HOMINGTHOK) + { + P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok)); + if (lockonthok) + { + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y); + player->homing = 3*TICRATE; + } else - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); + { + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + player->pflags &= ~PF_JUMPED; + player->mo->height = P_GetPlayerHeight(player); + } + player->pflags &= ~PF_NOJUMPDAMAGE; + } + + player->drawangle = player->mo->angle; + + if (player->mo->info->attacksound && !player->spectator) + S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound + + P_SpawnThokMobj(player); + + player->pflags &= ~(PF_SPINNING|PF_STARTDASH); + player->pflags |= PF_THOKKED; + + // Change localangle to match for simple controls? (P.S. chalupa) + // disabled because it seemed to disorient people and Z-targeting exists now + /*if (!demoplayback) + { + if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright))) + P_SetPlayerAngle(player, player->mo->angle);; + else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright))) + P_SetPlayerAngle(player, player->mo->angle); + }*/ + } + break; + + case CA_FLY: + case CA_SWIM: + // If currently in the air from a jump, and you pressed the + // button again and have the ability to fly, do so! + if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER)) + ; // Can't do anything if you're a fish out of water! + else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly])) + { + P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation + + player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer + + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING|PF_STARTDASH); + if (player->bot == 1) player->pflags |= PF_THOKKED; - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); - player->secondjump = 1; - } - break; - case CA_TELEKINESIS: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + else + player->pflags |= (PF_THOKKED|PF_CANCARRY); + } + break; + case CA_GLIDEANDCLIMB: + // Now Knuckles-type abilities are checked. + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale); + fixed_t playerspeed = player->speed; + + if (player->mo->eflags & MFE_UNDERWATER) { - P_Telekinesis(player, - FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) - FixedMul(384*FRACUNIT, player->mo->scale)); + glidespeed >>= 1; + playerspeed = 2*playerspeed/3; + if (!(player->powers[pw_super] || player->powers[pw_sneakers])) + { + player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx; + player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy; + } } - break; - case CA_FALLSWITCH: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - player->mo->momz = -player->mo->momz; - P_SpawnThokMobj(player); - player->pflags |= PF_THOKKED; - } - break; - case CA_AIRDRILL: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; - player->pflags |= PF_THOKKED; - S_StartSound(player->mo, sfx_spndsh); - } - break; - case CA_BOUNCE: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - { - P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE); - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); - player->pflags |= PF_THOKKED|PF_BOUNCING; - player->mo->momx >>= 1; - player->mo->momy >>= 1; - player->mo->momz >>= 1; - } - break; - case CA_TWINSPIN: - if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) - P_DoTwinSpin(player); - break; - default: - break; - } - player->pflags &= ~PF_SPINNING; + + player->pflags |= PF_GLIDING|PF_THOKKED; + player->glidetime = 0; + + P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); + if (playerspeed < glidespeed) + P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed); + player->pflags &= ~(PF_SPINNING|PF_STARTDASH); + } + break; + case CA_DOUBLEJUMP: // Double-Jump + if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS)))) + { + player->pflags |= PF_THOKKED; + player->pflags &= ~PF_JUMPED; + P_DoJump(player, true); + player->secondjump++; + } + break; + case CA_FLOAT: // Float + case CA_SLOWFALL: // Slow descent hover + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD) + P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); + else + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); + player->pflags |= PF_THOKKED; + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING); + player->secondjump = 1; + } + break; + case CA_TELEKINESIS: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + P_Telekinesis(player, + FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) + FixedMul(384*FRACUNIT, player->mo->scale)); + } + break; + case CA_FALLSWITCH: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + player->mo->momz = -player->mo->momz; + P_SpawnThokMobj(player); + player->pflags |= PF_THOKKED; + } + break; + case CA_AIRDRILL: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; + player->pflags |= PF_THOKKED; + S_StartSound(player->mo, sfx_spndsh); + } + break; + case CA_BOUNCE: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + { + P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE); + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); + player->pflags |= PF_THOKKED|PF_BOUNCING; + player->mo->momx >>= 1; + player->mo->momy >>= 1; + player->mo->momz >>= 1; + } + break; + case CA_TWINSPIN: + if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) + P_DoTwinSpin(player); + break; + default: + break; } } else if (player->pflags & PF_THOKKED) From 5ed5984cc549b3889e7b5bc5307c36577062c526 Mon Sep 17 00:00:00 2001 From: lachablock Date: Tue, 23 Mar 2021 15:03:12 +1100 Subject: [PATCH 03/18] Make more player abilities and all shieldabilities remove PF_SPINNING on use --- src/p_user.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 02592053d..5e4829564 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5012,7 +5012,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) static void P_DoTwinSpin(player_t *player) { - player->pflags &= ~PF_NOJUMPDAMAGE; + player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING); player->pflags |= P_GetJumpFlags(player) | PF_THOKKED; S_StartSound(player->mo, sfx_s3k42); player->mo->frame = 0; @@ -5059,6 +5059,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) { player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->pflags &= ~PF_SPINNING; player->mo->momx = player->mo->momy = player->mo->momz = 0; S_StartSound(player->mo, sfx_ngskid); } @@ -5074,11 +5075,13 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock // Armageddon pow case SH_ARMAGEDDON: player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->pflags &= ~PF_SPINNING; P_BlackOw(player); break; // Attraction blast case SH_ATTRACT: player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->pflags &= ~PF_SPINNING; player->homing = 2; P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonshield)); if (lockonshield) @@ -5098,6 +5101,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock { boolean elem = ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL); player->pflags |= PF_THOKKED|PF_SHIELDABILITY; + player->pflags &= ~PF_SPINNING; if (elem) { player->mo->momx = player->mo->momy = 0; @@ -5120,7 +5124,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock player->pflags |= PF_THOKKED|PF_SHIELDABILITY; P_Thrust(player->mo, player->mo->angle, FixedMul(30*FRACUNIT - FixedSqrt(FixedDiv(player->speed, player->mo->scale)), player->mo->scale)); player->drawangle = player->mo->angle; - player->pflags &= ~PF_NOJUMPDAMAGE; + player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING); P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); S_StartSound(player->mo, sfx_s3k43); default: @@ -5413,7 +5417,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS)))) { player->pflags |= PF_THOKKED; - player->pflags &= ~PF_JUMPED; + player->pflags &= ~(PF_JUMPED|PF_SPINNING); P_DoJump(player, true); player->secondjump++; } @@ -5439,6 +5443,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) P_Telekinesis(player, FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player) FixedMul(384*FRACUNIT, player->mo->scale)); + player->pflags &= ~PF_SPINNING; } break; case CA_FALLSWITCH: @@ -5447,6 +5452,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->mo->momz = -player->mo->momz; P_SpawnThokMobj(player); player->pflags |= PF_THOKKED; + player->pflags &= ~PF_SPINNING; } break; case CA_AIRDRILL: @@ -5454,6 +5460,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) { player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3; player->pflags |= PF_THOKKED; + player->pflags &= ~PF_SPINNING; S_StartSound(player->mo, sfx_spndsh); } break; @@ -5461,7 +5468,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) { P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE); - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING); player->pflags |= PF_THOKKED|PF_BOUNCING; player->mo->momx >>= 1; player->mo->momy >>= 1; From 691b17a88e468174549573e89228e45490ab328b Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 25 Apr 2021 23:28:35 -0500 Subject: [PATCH 04/18] Dynamically allocate space for a state's action field It was previously restricted arbitrarily to 32 cells (31 usable characters) due to someone else's laziness --- src/deh_soc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 5b12ea1b0..df1ebc275 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2776,13 +2776,13 @@ void readframe(MYFILE *f, INT32 num) { size_t z; boolean found = false; - char actiontocompare[32]; + size_t actionlen = strlen(word2) + 1; + char *actiontocompare = calloc(actionlen, 1); - memset(actiontocompare, 0x00, sizeof(actiontocompare)); - strlcpy(actiontocompare, word2, sizeof (actiontocompare)); + strcpy(actiontocompare, word2); strupr(actiontocompare); - for (z = 0; z < 32; z++) + for (z = 0; z < actionlen; z++) { if (actiontocompare[z] == '\n' || actiontocompare[z] == '\r') { @@ -2815,6 +2815,8 @@ void readframe(MYFILE *f, INT32 num) if (!found) deh_warning("Unknown action %s", actiontocompare); + + free(actiontocompare); } else deh_warning("Frame %d: unknown word '%s'", num, word1); From 7e3a6bd44c471303082ce0bfcc4e008ee1961a11 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 31 Oct 2020 09:08:48 -0500 Subject: [PATCH 05/18] Increase Connect via IP textbox width and have shorten and truncate the text as necessary --- src/m_menu.c | 60 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index db2aa09c6..452a31c71 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11605,7 +11605,10 @@ static void M_StartServerMenu(INT32 choice) // CONNECT VIA IP // ============== -static char setupm_ip[28]; +#define CONNIP_LEN 128 +static char setupm_ip[CONNIP_LEN]; + +#define DOTS "... " // Draw the funky Connect IP menu. Tails 11-19-2002 // So much work for such a little thing! @@ -11613,6 +11616,11 @@ static void M_DrawMPMainMenu(void) { INT32 x = currentMenu->x; INT32 y = currentMenu->y; + const INT32 boxwidth = /*16*8 + 6*/ (BASEVIDWIDTH - 2*(x+5)); + const INT32 maxstrwidth = boxwidth - 5; + char drawnstr[CONNIP_LEN]; + char *drawnstrptr = malloc(sizeof(setupm_ip)); + boolean drawthin, shorten = false; // use generic drawer for cursor, items and title M_DrawGenericMenu(); @@ -11628,17 +11636,53 @@ static void M_DrawMPMainMenu(void) y += 22; - V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 159); + V_DrawFill(x+5, y+4+5, boxwidth, 8+6, 159); + + strcpy(drawnstrptr, setupm_ip); + drawthin = V_StringWidth(drawnstrptr, V_ALLOWLOWERCASE) + V_StringWidth("_", V_ALLOWLOWERCASE) > maxstrwidth; // draw name string - V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, setupm_ip); + if (drawthin) + { + INT32 dotswidth = V_ThinStringWidth(DOTS, V_ALLOWLOWERCASE); + //UINT32 color = 0; + while (V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE) + V_ThinStringWidth("_", V_ALLOWLOWERCASE) >= maxstrwidth) + { + shorten = true; + drawnstrptr++; + } + + if (shorten) + { + INT32 initiallen = V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE); + INT32 cutofflen = 0; + while ((cutofflen = initiallen - V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE)) < dotswidth) + drawnstrptr++; + + V_DrawThinString(x+8,y+13, V_ALLOWLOWERCASE|V_GRAYMAP, DOTS); + x += V_ThinStringWidth(DOTS, V_ALLOWLOWERCASE); + } + + V_DrawThinString(x+8,y+13, V_ALLOWLOWERCASE, drawnstrptr); + } + else + { + V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, drawnstrptr); + } // draw text cursor for name if (itemOn == 2 //0 - && skullAnimCounter < 4) //blink cursor - V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false); + && skullAnimCounter < 4) //blink cursor + { + if (drawthin) + V_DrawCharacter(x+8+V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE),y+12,'_',false); + else + V_DrawCharacter(x+8+V_StringWidth(drawnstrptr, V_ALLOWLOWERCASE),y+12,'_',false); + } } +#undef DOTS + // Tails 11-19-2002 static void M_ConnectIP(INT32 choice) { @@ -11719,7 +11763,7 @@ static void M_HandleConnectIP(INT32 choice) const char *paste = I_ClipboardPaste(); if (paste != NULL) { - strncat(setupm_ip, paste, 28-1 - l); // Concat the ip field with clipboard + strncat(setupm_ip, paste, CONNIP_LEN-1 - l); // Concat the ip field with clipboard if (strlen(paste) != 0) // Don't play sound if nothing was pasted S_StartSound(NULL,sfx_menu1); // Tails } @@ -11753,7 +11797,7 @@ static void M_HandleConnectIP(INT32 choice) const char *paste = I_ClipboardPaste(); if (paste != NULL) { - strncat(setupm_ip, paste, 28-1 - l); // Concat the ip field with clipboard + strncat(setupm_ip, paste, CONNIP_LEN-1 - l); // Concat the ip field with clipboard if (strlen(paste) != 0) // Don't play sound if nothing was pasted S_StartSound(NULL,sfx_menu1); // Tails } @@ -11770,7 +11814,7 @@ static void M_HandleConnectIP(INT32 choice) } } - if (l >= 28-1) + if (l >= CONNIP_LEN-1) break; // Rudimentary number and period enforcing - also allows letters so hostnames can be used instead From f0bee67d6e097fea8d07e16b85bf459948de06cf Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 20 Feb 2021 17:01:45 -0600 Subject: [PATCH 06/18] Remove unused static-alloc `drawnstr`, rename `drawnstrptr` to `drawnstr`. --- src/m_menu.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 452a31c71..6db0f4c78 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11618,8 +11618,7 @@ static void M_DrawMPMainMenu(void) INT32 y = currentMenu->y; const INT32 boxwidth = /*16*8 + 6*/ (BASEVIDWIDTH - 2*(x+5)); const INT32 maxstrwidth = boxwidth - 5; - char drawnstr[CONNIP_LEN]; - char *drawnstrptr = malloc(sizeof(setupm_ip)); + char *drawnstr = malloc(sizeof(setupm_ip)); boolean drawthin, shorten = false; // use generic drawer for cursor, items and title @@ -11638,36 +11637,36 @@ static void M_DrawMPMainMenu(void) V_DrawFill(x+5, y+4+5, boxwidth, 8+6, 159); - strcpy(drawnstrptr, setupm_ip); - drawthin = V_StringWidth(drawnstrptr, V_ALLOWLOWERCASE) + V_StringWidth("_", V_ALLOWLOWERCASE) > maxstrwidth; + strcpy(drawnstr, setupm_ip); + drawthin = V_StringWidth(drawnstr, V_ALLOWLOWERCASE) + V_StringWidth("_", V_ALLOWLOWERCASE) > maxstrwidth; // draw name string if (drawthin) { INT32 dotswidth = V_ThinStringWidth(DOTS, V_ALLOWLOWERCASE); //UINT32 color = 0; - while (V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE) + V_ThinStringWidth("_", V_ALLOWLOWERCASE) >= maxstrwidth) + while (V_ThinStringWidth(drawnstr, V_ALLOWLOWERCASE) + V_ThinStringWidth("_", V_ALLOWLOWERCASE) >= maxstrwidth) { shorten = true; - drawnstrptr++; + drawnstr++; } if (shorten) { - INT32 initiallen = V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE); + INT32 initiallen = V_ThinStringWidth(drawnstr, V_ALLOWLOWERCASE); INT32 cutofflen = 0; - while ((cutofflen = initiallen - V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE)) < dotswidth) - drawnstrptr++; + while ((cutofflen = initiallen - V_ThinStringWidth(drawnstr, V_ALLOWLOWERCASE)) < dotswidth) + drawnstr++; V_DrawThinString(x+8,y+13, V_ALLOWLOWERCASE|V_GRAYMAP, DOTS); x += V_ThinStringWidth(DOTS, V_ALLOWLOWERCASE); } - V_DrawThinString(x+8,y+13, V_ALLOWLOWERCASE, drawnstrptr); + V_DrawThinString(x+8,y+13, V_ALLOWLOWERCASE, drawnstr); } else { - V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, drawnstrptr); + V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, drawnstr); } // draw text cursor for name @@ -11675,9 +11674,9 @@ static void M_DrawMPMainMenu(void) && skullAnimCounter < 4) //blink cursor { if (drawthin) - V_DrawCharacter(x+8+V_ThinStringWidth(drawnstrptr, V_ALLOWLOWERCASE),y+12,'_',false); + V_DrawCharacter(x+8+V_ThinStringWidth(drawnstr, V_ALLOWLOWERCASE),y+12,'_',false); else - V_DrawCharacter(x+8+V_StringWidth(drawnstrptr, V_ALLOWLOWERCASE),y+12,'_',false); + V_DrawCharacter(x+8+V_StringWidth(drawnstr, V_ALLOWLOWERCASE),y+12,'_',false); } } From 1639676e8da2db5c20cfc0f9465739600e40384a Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Fri, 3 Sep 2021 09:14:04 -0500 Subject: [PATCH 07/18] Actually free the drawnstr pointer after we're done using it. It probably was like this originally because past Golden was confused about why free was throwing errors :P --- src/m_menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 6db0f4c78..ac5269c3e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11619,6 +11619,7 @@ static void M_DrawMPMainMenu(void) const INT32 boxwidth = /*16*8 + 6*/ (BASEVIDWIDTH - 2*(x+5)); const INT32 maxstrwidth = boxwidth - 5; char *drawnstr = malloc(sizeof(setupm_ip)); + char *drawnstr_orig = drawnstr; boolean drawthin, shorten = false; // use generic drawer for cursor, items and title @@ -11678,6 +11679,8 @@ static void M_DrawMPMainMenu(void) else V_DrawCharacter(x+8+V_StringWidth(drawnstr, V_ALLOWLOWERCASE),y+12,'_',false); } + + free(drawnstr_orig); } #undef DOTS From 98aafc6056ad0ef89731ebbc18591684a8460ec3 Mon Sep 17 00:00:00 2001 From: SteelT Date: Thu, 3 Feb 2022 18:44:46 -0500 Subject: [PATCH 08/18] Don't force bit depth to 8-bit when setting default video mode --- src/screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index 770f1c802..af044ffe1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -390,7 +390,6 @@ void SCR_SetDefaultMode(void) // remember the default screen size CV_SetValue(&cv_scr_width, vid.width); CV_SetValue(&cv_scr_height, vid.height); - CV_SetValue(&cv_scr_depth, vid.bpp*8); } // Change fullscreen on/off according to cv_fullscreen From 003ee55ccdb2398cc55a45fad3ad4e69edfd18f7 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 12 Dec 2022 16:17:20 -0600 Subject: [PATCH 09/18] http-mserv: add SRB2-specific user agent string --- src/http-mserv.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/http-mserv.c b/src/http-mserv.c index b0ef37fa1..7b418c99a 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -65,6 +65,8 @@ static I_mutex hms_api_mutex; static char *hms_server_token; +static char hms_useragent[512]; + struct HMS_buffer { CURL *curl; @@ -81,6 +83,27 @@ Contact_error (void) ); } +static void +get_user_agent(char *buf, size_t len) +{ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L + if (sprintf_s(buf, len, "%s/%s (%s; %s; %i; %i) SRB2BASE/%i", SRB2APPLICATION, VERSIONSTRING, compbranch, comprevision, MODID, MODVERSION, CODEBASE) < 1) + I_Error("http-mserv: get_user_agent failed"); +#else + if (sprintf(buf, "%s/%s (%s; %s; %i; %i) SRB2BASE/%i", SRB2APPLICATION, VERSIONSTRING, compbranch, comprevision, MODID, MODVERSION, CODEBASE) < 0) + I_Error("http-mserv: get_user_agent failed"); +#endif +} + +static void +init_user_agent_once(void) +{ + if (hms_useragent[0] != '\0') + return; + + get_user_agent(hms_useragent, 512); +} + static size_t HMS_on_read (char *s, size_t _1, size_t n, void *userdata) { @@ -156,6 +179,8 @@ HMS_connect (const char *format, ...) I_lock_mutex(&hms_api_mutex); #endif + init_user_agent_once(); + seek = strlen(hms_api) + 1;/* + '/' */ va_start (ap, format); @@ -202,6 +227,8 @@ HMS_connect (const char *format, ...) curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read); curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer); + curl_easy_setopt(curl, CURLOPT_USERAGENT, hms_useragent); + curl_free(quack_token); free(url); From c1b85b212d73fd75da52d60e89233665b67b1bbe Mon Sep 17 00:00:00 2001 From: Lamibe <986-Lamibe@users.noreply.git.do.srb2.org> Date: Mon, 19 Dec 2022 10:38:17 +0100 Subject: [PATCH 10/18] Increased maxsend to 200MB --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 57c3e5924..3091f3344 100755 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3469,7 +3469,7 @@ consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NE consvar_t cv_blamecfail = CVAR_INIT ("blamecfail", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); // max file size to send to a player (in kilobytes) -static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {204800, "MAX"}, {0, NULL}}; consvar_t cv_maxsend = CVAR_INIT ("maxsend", "4096", CV_SAVE|CV_NETVAR, maxsend_cons_t, NULL); consvar_t cv_noticedownload = CVAR_INIT ("noticedownload", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); From 98d544b459b1a618ef2d913a35ff8ab8a584c7c2 Mon Sep 17 00:00:00 2001 From: MIDIManNoah <59802822+MIDIManNoah@users.noreply.github.com> Date: Fri, 23 Dec 2022 22:19:09 -0500 Subject: [PATCH 11/18] Make some fixes for Metal Sonic's boss fight --- src/info.c | 8 ++++---- src/p_mobj.c | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/info.c b/src/info.c index c4c197027..174eb5cc4 100644 --- a/src/info.c +++ b/src/info.c @@ -1758,14 +1758,14 @@ state_t states[NUMSTATES] = // Metal Sonic {SPR_PLAY, SPR2_STND, -1, {NULL}, 0, 0, S_METALSONIC_RACE}, // S_METALSONIC_RACE - {SPR_METL, 4, -1, {NULL}, 0, 0, S_NULL}, // S_METALSONIC_FLOAT + {SPR_METL, 4, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_FLOAT {SPR_METL, 16|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_METALSONIC_STUN}, // S_METALSONIC_VECTOR {SPR_METL, 15, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_STUN {SPR_METL, 17, 20, {NULL}, 0, 0, S_METALSONIC_GATHER},// S_METALSONIC_RAISE - {SPR_METL, 18, -1, {NULL}, 0, 0, S_NULL}, // S_METALSONIC_GATHER + {SPR_METL, 18, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_GATHER {SPR_METL, 6|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 1, 2, S_METALSONIC_BOUNCE},// S_METALSONIC_DASH - {SPR_METL, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 1, 2, S_NULL}, // S_METALSONIC_BOUNCE - {SPR_METL, 14, -1, {NULL}, 0, 0, S_NULL}, // S_METALSONIC_BADBOUNCE + {SPR_METL, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 1, 2, S_METALSONIC_FLOAT}, // S_METALSONIC_BOUNCE + {SPR_METL, 14, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_BADBOUNCE {SPR_METL, 17, -1, {NULL}, 0, 0, S_METALSONIC_GATHER},// S_METALSONIC_SHOOT {SPR_METL, 15, 40, {A_Pain}, 0, 0, S_METALSONIC_FLOAT}, // S_METALSONIC_PAIN {SPR_METL, 17, 2, {A_Fall}, 0, 0, S_METALSONIC_DEATH2},// S_METALSONIC_DEATH1 diff --git a/src/p_mobj.c b/src/p_mobj.c index 49c438b3f..e1657c12f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5664,6 +5664,8 @@ static void P_Boss9Thinker(mobj_t *mobj) { mobj_t *missile = P_SpawnMissile(spawner, mobj, MT_MSGATHER); missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy)); + if (missile->fuse <= 0) // Prevents a division by zero when calculating missile->scalespeed + missile->fuse = 1; if (missile->fuse > mobj->fuse) P_RemoveMobj(missile); From 58e5473c9efd2d521f768217918efd1328228e87 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 27 Dec 2022 20:26:08 +0100 Subject: [PATCH 12/18] Fix integer overflow with diagonal node splits Fixes random invisible walls and possibly more errors --- src/r_main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index cd5e255ed..3763092fc 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -266,13 +266,13 @@ INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node) if (!node->dy) return y <= node->y ? node->dx < 0 : node->dx > 0; - x -= node->x; - y -= node->y; + fixed_t dx = (x >> 1) - (node->x >> 1); + fixed_t dy = (y >> 1) - (node->y >> 1); // Try to quickly decide by looking at sign bits. - if ((node->dy ^ node->dx ^ x ^ y) < 0) - return (node->dy ^ x) < 0; // (left is negative) - return FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x); + if ((node->dy ^ node->dx ^ dx ^ dy) < 0) + return (node->dy ^ dx) < 0; // (left is negative) + return FixedMul(dy, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, dx); } // killough 5/2/98: reformatted @@ -289,13 +289,13 @@ INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line) if (!ldy) return y <= ly ? ldx < 0 : ldx > 0; - x -= lx; - y -= ly; + fixed_t dx = (x >> 1) - (lx >> 1); + fixed_t dy = (y >> 1) - (ly >> 1); // Try to quickly decide by looking at sign bits. - if ((ldy ^ ldx ^ x ^ y) < 0) - return (ldy ^ x) < 0; // (left is negative) - return FixedMul(y, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, x); + if ((ldy ^ ldx ^ dx ^ dy) < 0) + return (ldy ^ dx) < 0; // (left is negative) + return FixedMul(dy, ldx>>FRACBITS) >= FixedMul(ldy>>FRACBITS, dx); } // From c8e579618a4de098a4540a6769adcdf1c91d2346 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 27 Dec 2022 20:29:15 +0100 Subject: [PATCH 13/18] Fix maps with more than 65535 segs not working correctly This renders the "quadrant hack" and ZenNode largely useless --- src/p_setup.c | 2 +- src/r_defs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index cd9185484..5309705f6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3009,7 +3009,7 @@ static inline void P_LoadSubsectors(UINT8 *data) for (i = 0; i < numsubsectors; i++, ss++, ms++) { ss->numlines = SHORT(ms->numsegs); - ss->firstline = SHORT(ms->firstseg); + ss->firstline = (UINT16)SHORT(ms->firstseg); P_InitializeSubsector(ss); } } diff --git a/src/r_defs.h b/src/r_defs.h index dbede806e..3746643c6 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -587,7 +587,7 @@ typedef struct subsector_s { sector_t *sector; INT16 numlines; - UINT16 firstline; + UINT32 firstline; struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects size_t validcount; } subsector_t; From d03ef0a4417381d6f404336da67056b5b542223e Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 27 Dec 2022 20:31:55 +0100 Subject: [PATCH 14/18] Fix HOMs in large rooms Credits go to Lactozilla --- src/r_bsp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index bf238a435..c9c169a51 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -399,8 +399,8 @@ static void R_AddLine(seg_t *line) return; // big room fix - angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y); - angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y); + angle1 = R_PointToAngle64(line->v1->x, line->v1->y); + angle2 = R_PointToAngle64(line->v2->x, line->v2->y); curline = line; // Clip to view edges. @@ -620,8 +620,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord) check = checkcoord[boxpos]; // big room fix - angle1 = R_PointToAngleEx(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle; - angle2 = R_PointToAngleEx(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle; + angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle; + angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle; if ((signed)angle1 < (signed)angle2) { From 0a0da81007de48797e09ff302dc8009ab6997b73 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Dec 2022 07:52:19 +0100 Subject: [PATCH 15/18] Fix typo --- src/p_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index cd9185484..eedda1b08 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4910,9 +4910,9 @@ static void P_ConvertBinaryLinedefTypes(void) case 331: // Player skin - continuous case 332: // Player skin - each time case 333: // Player skin - once - if (lines[i].special == 303) + if (lines[i].special == 333) lines[i].args[0] = TMT_ONCE; - else if (lines[i].special == 302) + else if (lines[i].special == 332) lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; else lines[i].args[0] = TMT_CONTINUOUS; From 636e6d8c14877e283ef17c55800384b8e17c8143 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 31 Dec 2022 19:35:07 -0500 Subject: [PATCH 16/18] MSVC project file works again! Supports Visual Studio 2022. Also fixed issues with the d_netcmd.c file/folder adding logic. --- .../projects/visualc10/libpng.vcxproj | 22 +- libs/zlib/projects/visualc10/zlib.vcxproj | 22 +- srb2-vc9.sln | 89 - src/blua/lua.h | 4 + src/blua/luaconf.h | 12 +- src/byteptr.h | 36 +- src/command.c | 4 + src/d_netcmd.c | 120 +- src/deh_soc.c | 8 +- src/doomtype.h | 10 - src/hardware/hw_main.c | 4 +- src/hardware/r_opengl/r_opengl-vc10.vcxproj | 18 +- src/hardware/r_opengl/r_opengl.c | 10 +- src/hardware/s_openal/s_openal-vc10.vcxproj | 18 +- src/p_mobj.c | 2 +- src/r_main.c | 2 +- src/r_picformats.c | 2 +- src/r_things.c | 8 +- src/sdl/Srb2SDL-vc10.vcxproj | 56 +- src/sdl/Srb2SDL-vc10.vcxproj.filters | 43 +- src/sdl/Srb2SDL-vc9.vcproj | 6021 ----------------- src/sdl/Srb2SDL.dsp | 1049 --- src/sdl/Srb2SDL.dsw | 74 - src/strcasestr.c | 10 + 24 files changed, 265 insertions(+), 7379 deletions(-) delete mode 100644 srb2-vc9.sln delete mode 100644 src/sdl/Srb2SDL-vc9.vcproj delete mode 100644 src/sdl/Srb2SDL.dsp delete mode 100644 src/sdl/Srb2SDL.dsw diff --git a/libs/libpng-src/projects/visualc10/libpng.vcxproj b/libs/libpng-src/projects/visualc10/libpng.vcxproj index eaa3d4ffb..351b4317d 100644 --- a/libs/libpng-src/projects/visualc10/libpng.vcxproj +++ b/libs/libpng-src/projects/visualc10/libpng.vcxproj @@ -37,51 +37,51 @@ {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} libpng - 10.0.16299.0 + 10.0 StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true @@ -278,7 +278,7 @@ Disabled ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true + false EnableFastChecks MultiThreadedDebugDLL $(ProjectDir)$(Platform)\$(Configuration)\ @@ -288,7 +288,7 @@ true EditAndContinue CompileAsC - false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/libs/zlib/projects/visualc10/zlib.vcxproj b/libs/zlib/projects/visualc10/zlib.vcxproj index de7b2aaab..5c00ea4a9 100644 --- a/libs/zlib/projects/visualc10/zlib.vcxproj +++ b/libs/zlib/projects/visualc10/zlib.vcxproj @@ -37,51 +37,51 @@ {73A5729C-7323-41D4-AB48-8A03C9F81603} zlib - 10.0.16299.0 + 10.0 StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true StaticLibrary false - v140 + v143 true StaticLibrary false - v141 + v143 StaticLibrary false - v140 + v143 StaticLibrary false - v141 + v143 true @@ -144,7 +144,7 @@ Disabled WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true + false Default MultiThreadedDebugDLL $(ProjectDir)$(Platform)\$(Configuration)\ @@ -154,7 +154,7 @@ true EditAndContinue CompileAsC - false + true _DEBUG;%(PreprocessorDefinitions) diff --git a/srb2-vc9.sln b/srb2-vc9.sln deleted file mode 100644 index bbfcf0e77..000000000 --- a/srb2-vc9.sln +++ /dev/null @@ -1,89 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2win", "src\win32\Srb2win-vc9.vcproj", "{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}" - ProjectSection(ProjectDependencies) = postProject - {73A5729C-7323-41D4-AB48-8A03C9F81603} = {73A5729C-7323-41D4-AB48-8A03C9F81603} - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} = {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libs\libpng-src\projects\visualc9\libpng.vcproj", "{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}" - ProjectSection(ProjectDependencies) = postProject - {73A5729C-7323-41D4-AB48-8A03C9F81603} = {73A5729C-7323-41D4-AB48-8A03C9F81603} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r_opengl", "src\hardware\r_opengl\r_opengl-vc9.vcproj", "{51137D5C-4E81-4955-AACF-EA3092006051}" - ProjectSection(ProjectDependencies) = postProject - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} = {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "libs\zlib\projects\visualc9\zlib.vcproj", "{73A5729C-7323-41D4-AB48-8A03C9F81603}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "s_openal", "src\hardware\s_openal\s_openal-vc9.vcproj", "{E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}" - ProjectSection(ProjectDependencies) = postProject - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} = {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2SDL", "src\sdl\Srb2SDL-vc9.vcproj", "{61BA7D3C-F77D-4D31-B718-1177FE482CF2}" - ProjectSection(ProjectDependencies) = postProject - {73A5729C-7323-41D4-AB48-8A03C9F81603} = {73A5729C-7323-41D4-AB48-8A03C9F81603} - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} = {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|Win32.Build.0 = Debug|Win32 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|x64.ActiveCfg = Debug|x64 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|x64.Build.0 = Debug|x64 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|Win32.ActiveCfg = Release|Win32 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|Win32.Build.0 = Release|Win32 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|x64.ActiveCfg = Release|x64 - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|x64.Build.0 = Release|x64 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|Win32.ActiveCfg = Debug|Win32 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|Win32.Build.0 = Debug|Win32 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|x64.ActiveCfg = Debug|x64 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|x64.Build.0 = Debug|x64 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|Win32.ActiveCfg = Release|Win32 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|Win32.Build.0 = Release|Win32 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|x64.ActiveCfg = Release|x64 - {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|x64.Build.0 = Release|x64 - {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|Win32.ActiveCfg = Debug|Win32 - {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|Win32.Build.0 = Debug|Win32 - {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|x64.ActiveCfg = Debug|x64 - {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|x64.Build.0 = Debug|x64 - {51137D5C-4E81-4955-AACF-EA3092006051}.Release|Win32.ActiveCfg = Release|Win32 - {51137D5C-4E81-4955-AACF-EA3092006051}.Release|Win32.Build.0 = Release|Win32 - {51137D5C-4E81-4955-AACF-EA3092006051}.Release|x64.ActiveCfg = Release|x64 - {51137D5C-4E81-4955-AACF-EA3092006051}.Release|x64.Build.0 = Release|x64 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|Win32.ActiveCfg = Debug|Win32 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|Win32.Build.0 = Debug|Win32 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|x64.ActiveCfg = Debug|x64 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|x64.Build.0 = Debug|x64 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|Win32.ActiveCfg = Release|Win32 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|Win32.Build.0 = Release|Win32 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|x64.ActiveCfg = Release|x64 - {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|x64.Build.0 = Release|x64 - {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|Win32.ActiveCfg = Debug|Win32 - {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|x64.ActiveCfg = Debug|x64 - {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|Win32.ActiveCfg = Release|Win32 - {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|x64.ActiveCfg = Release|x64 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|Win32.ActiveCfg = Debug|Win32 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|Win32.Build.0 = Debug|Win32 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|x64.ActiveCfg = Debug|x64 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|x64.Build.0 = Debug|x64 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|Win32.ActiveCfg = Release|Win32 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|Win32.Build.0 = Release|Win32 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|x64.ActiveCfg = Release|x64 - {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/blua/lua.h b/src/blua/lua.h index 4e26c2a79..50e520690 100644 --- a/src/blua/lua.h +++ b/src/blua/lua.h @@ -12,6 +12,10 @@ #include #include +#ifdef _MSC_VER +#include +#endif + #include "luaconf.h" diff --git a/src/blua/luaconf.h b/src/blua/luaconf.h index 9e2948f41..223a85703 100644 --- a/src/blua/luaconf.h +++ b/src/blua/luaconf.h @@ -11,9 +11,7 @@ #include #include -#ifdef _MSC_VER -#define INT32 __int32 -#else +#ifndef _MSC_VER #include #define INT32 int32_t #endif @@ -147,7 +145,7 @@ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ** machines, ptrdiff_t gives a good choice between int or long.) */ -#define LUA_INTEGER INT32 +#define LUA_INTEGER int32_t /* @@ -509,13 +507,13 @@ */ //#define LUA_NUMBER_DOUBLE -#define LUA_NUMBER INT32 +#define LUA_NUMBER int32_t /* @@ LUAI_UACNUMBER is the result of an 'usual argument conversion' @* over a number. */ -#define LUAI_UACNUMBER INT32 +#define LUAI_UACNUMBER int32_t /* @@ -778,6 +776,4 @@ union luai_Cast { double l_d; long l_l; }; ** without modifying the main part of the file. */ - - #endif diff --git a/src/byteptr.h b/src/byteptr.h index 33c2c8a4b..3aa2aa508 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -150,7 +150,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) #undef DEALIGNED -#define WRITESTRINGN(p, s, n) ({ \ +#define WRITESTRINGN(p, s, n) { \ size_t tmp_i; \ \ for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \ @@ -158,70 +158,70 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) \ if (tmp_i < n) \ WRITECHAR(p, '\0'); \ -}) +} -#define WRITESTRINGL(p, s, n) ({ \ +#define WRITESTRINGL(p, s, n) { \ size_t tmp_i; \ \ for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \ WRITECHAR(p, s[tmp_i]); \ \ WRITECHAR(p, '\0'); \ -}) +} -#define WRITESTRING(p, s) ({ \ +#define WRITESTRING(p, s) { \ size_t tmp_i; \ \ for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \ WRITECHAR(p, s[tmp_i]); \ \ WRITECHAR(p, '\0'); \ -}) +} -#define WRITEMEM(p, s, n) ({ \ +#define WRITEMEM(p, s, n) { \ memcpy(p, s, n); \ p += n; \ -}) +} #define SKIPSTRING(p) while (READCHAR(p) != '\0') -#define SKIPSTRINGN(p, n) ({ \ +#define SKIPSTRINGN(p, n) { \ size_t tmp_i = 0; \ \ while (tmp_i < n && READCHAR(p) != '\0') \ tmp_i++; \ -}) +} #define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n) -#define READSTRINGN(p, s, n) ({ \ +#define READSTRINGN(p, s, n) { \ size_t tmp_i = 0; \ \ while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \ tmp_i++; \ \ s[tmp_i] = '\0'; \ -}) +} -#define READSTRINGL(p, s, n) ({ \ +#define READSTRINGL(p, s, n) { \ size_t tmp_i = 0; \ \ while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \ tmp_i++; \ \ s[tmp_i] = '\0'; \ -}) +} -#define READSTRING(p, s) ({ \ +#define READSTRING(p, s) { \ size_t tmp_i = 0; \ \ while ((s[tmp_i] = READCHAR(p)) != '\0') \ tmp_i++; \ \ s[tmp_i] = '\0'; \ -}) +} -#define READMEM(p, s, n) ({ \ +#define READMEM(p, s, n) { \ memcpy(s, p, n); \ p += n; \ -}) +} diff --git a/src/command.c b/src/command.c index 9be081fb7..201cceeee 100644 --- a/src/command.c +++ b/src/command.c @@ -1724,9 +1724,13 @@ void CV_SaveVars(UINT8 **p, boolean in_demo) if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar)) { if (in_demo) + { WRITESTRING(*p, cvar->name); + } else + { WRITEUINT16(*p, cvar->netid); + } WRITESTRING(*p, cvar->string); WRITEUINT8(*p, false); ++count; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 5f02bc2de..07dba1777 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -50,6 +50,7 @@ #include "m_anigif.h" #include "md5.h" #include "m_perfstats.h" +#include "hardware/u_list.h" // TODO: this should be a standard utility class #ifdef NETGAME_DEVMODE #define CV_RESTRICT CV_NETVAR @@ -3312,6 +3313,69 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) G_SetGameModified(true); } +// C++ would make this SO much simpler! +typedef struct addedfile_s +{ + struct addedfile_s *next; + struct addedfile_s *prev; + char *value; +} addedfile_t; + +static boolean AddedFileContains(addedfile_t *list, const char *value) +{ + addedfile_t *node; + for (node = list; node; node = node->next) + { + if (!strcmp(value, node->value)) + return true; + } + + return false; +} + +static void AddedFilesAdd(addedfile_t **list, const char *value) +{ + addedfile_t *item = Z_Calloc(sizeof(addedfile_t), PU_STATIC, NULL); + item->value = Z_StrDup(value); + ListAdd(item, (listitem_t**)list); +} + +static void AddedFilesRemove(void *pItem, addedfile_t **itemHead) +{ + addedfile_t *item = (addedfile_t *)pItem; + + if (item == *itemHead) // Start of list + { + *itemHead = item->next; + + if (*itemHead) + (*itemHead)->prev = NULL; + } + else if (item->next == NULL) // end of list + { + item->prev->next = NULL; + } + else // Somewhere in between + { + item->prev->next = item->next; + item->next->prev = item->prev; + } + + Z_Free(item->value); + Z_Free(item); +} + +static void AddedFilesClearList(addedfile_t **itemHead) +{ + addedfile_t *item; + addedfile_t *next; + for (item = *itemHead; item; item = next) + { + next = item->next; + AddedFilesRemove(item, itemHead); + } +} + /** Adds a pwad at runtime. * Searches for sounds, maps, music, new images. */ @@ -3320,8 +3384,7 @@ static void Command_Addfile(void) size_t argc = COM_Argc(); // amount of arguments total size_t curarg; // current argument index - const char *addedfiles[argc]; // list of filenames already processed - size_t numfilesadded = 0; // the amount of filenames processed + addedfile_t *addedfiles = NULL; // list of filenames already processed if (argc < 2) { @@ -3336,25 +3399,14 @@ static void Command_Addfile(void) char buf[256]; char *buf_p = buf; INT32 i; - size_t ii; int musiconly; // W_VerifyNMUSlumps isn't boolean boolean fileadded = false; fn = COM_Argv(curarg); // For the amount of filenames previously processed... - for (ii = 0; ii < numfilesadded; ii++) - { - // If this is one of them, don't try to add it. - if (!strcmp(fn, addedfiles[ii])) - { - fileadded = true; - break; - } - } - - // If we've added this one, skip to the next one. - if (fileadded) + fileadded = AddedFileContains(addedfiles, fn); + if (fileadded) // If this is one of them, don't try to add it. { CONS_Alert(CONS_WARNING, M_GetText("Already processed %s, skipping\n"), fn); continue; @@ -3363,13 +3415,16 @@ static void Command_Addfile(void) // Disallow non-printing characters and semicolons. for (i = 0; fn[i] != '\0'; i++) if (!isprint(fn[i]) || fn[i] == ';') + { + AddedFilesClearList(&addedfiles); return; + } musiconly = W_VerifyNMUSlumps(fn, false); if (musiconly == -1) { - addedfiles[numfilesadded++] = fn; + AddedFilesAdd(&addedfiles, fn); continue; } @@ -3388,7 +3443,7 @@ static void Command_Addfile(void) if (!(netgame || multiplayer) || musiconly) { P_AddWadFile(fn); - addedfiles[numfilesadded++] = fn; + AddedFilesAdd(&addedfiles, fn); continue; } @@ -3403,6 +3458,7 @@ static void Command_Addfile(void) if (numwadfiles >= MAX_WADFILES) { CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn); + AddedFilesClearList(&addedfiles); return; } @@ -3442,13 +3498,15 @@ static void Command_Addfile(void) WRITEMEM(buf_p, md5sum, 16); } - addedfiles[numfilesadded++] = fn; + AddedFilesAdd(&addedfiles, fn); if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf); else SendNetXCmd(XD_ADDFILE, buf, buf_p - buf); } + + AddedFilesClearList(&addedfiles); } static void Command_Addfolder(void) @@ -3456,8 +3514,7 @@ static void Command_Addfolder(void) size_t argc = COM_Argc(); // amount of arguments total size_t curarg; // current argument index - const char *addedfolders[argc]; // list of filenames already processed - size_t numfoldersadded = 0; // the amount of filenames processed + addedfile_t *addedfolders = NULL; // list of filenames already processed if (argc < 2) { @@ -3473,24 +3530,13 @@ static void Command_Addfolder(void) char buf[256]; char *buf_p = buf; INT32 i, stat; - size_t ii; boolean folderadded = false; fn = COM_Argv(curarg); // For the amount of filenames previously processed... - for (ii = 0; ii < numfoldersadded; ii++) - { - // If this is one of them, don't try to add it. - if (!strcmp(fn, addedfolders[ii])) - { - folderadded = true; - break; - } - } - - // If we've added this one, skip to the next one. - if (folderadded) + folderadded = AddedFileContains(addedfolders, fn); + if (folderadded) // If we've added this one, skip to the next one. { CONS_Alert(CONS_WARNING, M_GetText("Already processed %s, skipping\n"), fn); continue; @@ -3499,13 +3545,16 @@ static void Command_Addfolder(void) // Disallow non-printing characters and semicolons. for (i = 0; fn[i] != '\0'; i++) if (!isprint(fn[i]) || fn[i] == ';') + { + AddedFilesClearList(&addedfolders); return; + } // Add file on your client directly if you aren't in a netgame. if (!(netgame || multiplayer)) { P_AddFolder(fn); - addedfolders[numfoldersadded++] = fn; + AddedFilesAdd(&addedfolders, fn); continue; } @@ -3527,6 +3576,7 @@ static void Command_Addfolder(void) if (numwadfiles >= MAX_WADFILES) { CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn); + AddedFilesClearList(&addedfolders); return; } @@ -3572,7 +3622,7 @@ static void Command_Addfolder(void) Z_Free(fullpath); - addedfolders[numfoldersadded++] = fn; + AddedFilesAdd(&addedfolders, fn); WRITESTRINGN(buf_p,p,240); diff --git a/src/deh_soc.c b/src/deh_soc.c index b3c3c4e0c..cbc7940f7 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -693,7 +693,8 @@ void readskincolor(MYFILE *f, INT32 num) if (fastcmp(word, "NAME")) { size_t namesize = sizeof(skincolors[num].name); - char truncword[namesize]; + char *truncword = malloc(namesize); // Follow C standard - SSNTails + UINT16 dupecheck; deh_strlcpy(truncword, word2, namesize, va("Skincolor %d: name", num)); // truncate here to check for dupes @@ -701,7 +702,7 @@ void readskincolor(MYFILE *f, INT32 num) if (truncword[0] != '\0' && (!stricmp(truncword, skincolors[SKINCOLOR_NONE].name) || (dupecheck && dupecheck != num))) { size_t lastchar = strlen(truncword); - char oldword[lastchar+1]; + char *oldword = malloc(lastchar + 1); // Follow C standard - SSNTails char dupenum = '1'; strlcpy(oldword, truncword, lastchar+1); @@ -726,9 +727,12 @@ void readskincolor(MYFILE *f, INT32 num) } deh_warning("Skincolor %d: name %s is a duplicate of another skincolor's name - renamed to %s", num, oldword, truncword); + free(oldword); } strlcpy(skincolors[num].name, truncword, namesize); // already truncated + + free(truncword); } else if (fastcmp(word, "RAMP")) { diff --git a/src/doomtype.h b/src/doomtype.h index b8f602c64..456f56380 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -31,18 +31,8 @@ #include #endif -#define UINT8 unsigned __int8 #define SINT8 signed __int8 -#define UINT16 unsigned __int16 -#define INT16 __int16 - -#define INT32 __int32 -#define UINT32 unsigned __int32 - -#define INT64 __int64 -#define UINT64 unsigned __int64 - typedef long ssize_t; /* Older Visual C++ headers don't have the Win64-compatible typedefs... */ diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 3cb7275a0..3a6baab71 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5232,7 +5232,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if (caster && !P_MobjWasRemoved(caster)) { - interpmobjstate_t casterinterp = {}; + interpmobjstate_t casterinterp = { 0 }; fixed_t groundz; fixed_t floordiff; @@ -5340,7 +5340,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) { - interpmobjstate_t tracer_interp = {}; + interpmobjstate_t tracer_interp = { 0 }; if (! R_ThingVisible(thing->tracer)) return; diff --git a/src/hardware/r_opengl/r_opengl-vc10.vcxproj b/src/hardware/r_opengl/r_opengl-vc10.vcxproj index d1f856e96..c93e47d50 100644 --- a/src/hardware/r_opengl/r_opengl-vc10.vcxproj +++ b/src/hardware/r_opengl/r_opengl-vc10.vcxproj @@ -38,51 +38,51 @@ r_opengl {51137D5C-4E81-4955-AACF-EA3092006051} r_opengl - 10.0.16299.0 + 10.0 DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 true DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 true DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 true DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 true diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 9d1630abb..0b51fa05c 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1130,7 +1130,7 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect) const GLfloat zNear = NEAR_CLIPPING_PLANE; const GLfloat zFar = FAR_CLIPPING_PLANE; const GLfloat radians = (GLfloat)(fovy / 2.0f * M_PIl / 180.0f); - const GLfloat sine = sin(radians); + const GLfloat sine = (GLfloat)sin(radians); const GLfloat deltaZ = zFar - zNear; GLfloat cotangent; @@ -2042,9 +2042,9 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF if (Surface != NULL) { - UNIFORM_1(shader->uniforms[gluniform_lighting], Surface->LightInfo.light_level, pglUniform1f); - UNIFORM_1(shader->uniforms[gluniform_fade_start], Surface->LightInfo.fade_start, pglUniform1f); - UNIFORM_1(shader->uniforms[gluniform_fade_end], Surface->LightInfo.fade_end, pglUniform1f); + UNIFORM_1(shader->uniforms[gluniform_lighting], (GLfloat)Surface->LightInfo.light_level, pglUniform1f); + UNIFORM_1(shader->uniforms[gluniform_fade_start], (GLfloat)Surface->LightInfo.fade_start, pglUniform1f); + UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f); } UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f); @@ -3038,7 +3038,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) if (special_splitscreen) { - used_fov = atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI; + used_fov = (float)(atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI); GLPerspective(used_fov, 2*ASPECT_RATIO); } else diff --git a/src/hardware/s_openal/s_openal-vc10.vcxproj b/src/hardware/s_openal/s_openal-vc10.vcxproj index 5039cd006..1480cd3d0 100644 --- a/src/hardware/s_openal/s_openal-vc10.vcxproj +++ b/src/hardware/s_openal/s_openal-vc10.vcxproj @@ -38,52 +38,52 @@ s_openal {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE} s_openal - 10.0.16299.0 + 10.0 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v141 + v143 DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v141 + v143 DynamicLibrary false - v140 + v143 DynamicLibrary false - v141 + v143 diff --git a/src/p_mobj.c b/src/p_mobj.c index e1657c12f..38d6e7a7e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13508,7 +13508,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi static void P_SpawnSingularItemRow(mapthing_t *mthing, mobjtype_t itemtype, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) { mobjtype_t itemtypes[1] = { itemtype }; - return P_SpawnItemRow(mthing, itemtypes, 1, numitems, horizontalspacing, verticalspacing, fixedangle, bonustime); + P_SpawnItemRow(mthing, itemtypes, 1, numitems, horizontalspacing, verticalspacing, fixedangle, bonustime); } static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numitemtypes, INT32 numitems, fixed_t size, boolean bonustime) diff --git a/src/r_main.c b/src/r_main.c index 3763092fc..187925408 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -620,7 +620,7 @@ static struct { 0, 0, - {}, {}, + {0}, {0}, false }; diff --git a/src/r_picformats.c b/src/r_picformats.c index 6aa4659b9..5a7aebcf7 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -447,7 +447,7 @@ void *Picture_FlatConvert( for (y = 0; y < inheight; y++) for (x = 0; x < inwidth; x++) { - void *input; + void *input = NULL; size_t offs = ((y * inwidth) + x); // Read pixel diff --git a/src/r_things.c b/src/r_things.c index fed873fd6..461761977 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1785,7 +1785,11 @@ static void R_ProjectSprite(mobj_t *thing) range++; // fencepost problem - scalestep = ((yscale2 - yscale)/range) ?: 1; + // Compatibility with MSVC - SSNTails + scalestep = ((yscale2 - yscale) / range); + if (!scalestep) + scalestep = 1; + xscale = FixedDiv(range<target; - interpmobjstate_t casterinterp = {}; + interpmobjstate_t casterinterp = { 0 }; // MSVC compatibility - SSNTails if (R_UsingFrameInterpolation() && !paused) { diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index d79dde766..c20265ed1 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -39,46 +39,46 @@ {61BA7D3C-F77D-4D31-B718-1177FE482CF2} Win32Proj Srb2SDL - 10.0.16299.0 + 10.0 Srb2Win - v140 + v143 true - v141 + v143 true true - v140 + v143 false true - v141 + v143 false true true - v140 + v143 true - v141 + v143 true true - v140 + v143 false true - v141 + v143 false true true @@ -134,6 +134,9 @@ <_ProjectFileVersion>10.0.30319.1 false + + $(ProjectName)_Debug + ProgramDatabase @@ -154,6 +157,26 @@ setupapi.lib;winmm.lib;imm32.lib;version.lib;ole32.lib;advapi32.lib;shell32.lib;gdi32.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies) + + + Default + false + 4244;4267;4146 + true + false + stdcpp17 + + + + + stdcpp17 + + + + + 4244;4267;4146;4003 + + {72b01aca-7a1a-4f7b-acef-2607299cf052} @@ -246,11 +269,13 @@ + + @@ -264,6 +289,7 @@ + @@ -272,6 +298,7 @@ + @@ -286,6 +313,7 @@ + @@ -403,11 +431,13 @@ true + + @@ -429,6 +459,7 @@ + @@ -438,6 +469,7 @@ + @@ -464,6 +496,7 @@ true + @@ -478,7 +511,6 @@ - @@ -507,7 +539,7 @@ true - + @@ -524,4 +556,4 @@ - + \ No newline at end of file diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index 4d2532ca4..eb37ce9da 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -144,7 +144,6 @@ D_Doom - D_Doom @@ -511,6 +510,21 @@ R_Rend + + LUA + + + I_Interface + + + R_Rend + + + P_Play + + + M_Misc + @@ -625,7 +639,6 @@ D_Doom - D_Doom @@ -821,9 +834,6 @@ M_Misc - - M_Misc - O_Other @@ -965,9 +975,6 @@ SDLApp - - SDLApp - SDLApp @@ -1023,10 +1030,28 @@ R_Rend + + LUA + + + SDLApp + + + I_Interface + + + R_Rend + + + P_Play + + + M_Misc + SDLApp - + \ No newline at end of file diff --git a/src/sdl/Srb2SDL-vc9.vcproj b/src/sdl/Srb2SDL-vc9.vcproj deleted file mode 100644 index 95f035267..000000000 --- a/src/sdl/Srb2SDL-vc9.vcproj +++ /dev/null @@ -1,6021 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/sdl/Srb2SDL.dsp b/src/sdl/Srb2SDL.dsp deleted file mode 100644 index 9f6dd7b33..000000000 --- a/src/sdl/Srb2SDL.dsp +++ /dev/null @@ -1,1049 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Srb2SDL" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=Srb2SDL - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Srb2SDL.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Srb2SDL.mak" CFG="Srb2SDL - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Srb2SDL - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Srb2SDL - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Srb2SDL - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\bin\VC\Release\SDL" -# PROP Intermediate_Dir "..\..\objs\VC\Release\SDL" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -# SUBTRACT RSC /x -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o"..\..\objs\SDL\Release\SRB2.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /pdb:"C:\srb2demo2\srb2sdl.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdl.exe" -# SUBTRACT LINK32 /profile /pdb:none /incremental:yes - -!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\bin\VC\Debug\SDL" -# PROP Intermediate_Dir "..\..\objs\VC\Debug\SDL" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -# SUBTRACT RSC /x -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o"..\..\objs\SDL\Debug\SRB2.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:console /pdb:"C:\srb2demo2\srb2sdldebug.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdldebug.exe" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "Srb2SDL - Win32 Release" -# Name "Srb2SDL - Win32 Debug" -# Begin Group "SDLapp" - -# PROP Default_Filter "" -# Begin Group "filter" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\filter\filters.c -# End Source File -# Begin Source File - -SOURCE=.\filter\filters.h -# End Source File -# Begin Source File - -SOURCE=.\filter\hq2x.c -# End Source File -# Begin Source File - -SOURCE=.\filter\hq2x.h -# End Source File -# Begin Source File - -SOURCE=.\filter\interp.h -# End Source File -# Begin Source File - -SOURCE=.\filter\lq2x.c -# End Source File -# Begin Source File - -SOURCE=.\filter\lq2x.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\dosstr.c -# End Source File -# Begin Source File - -SOURCE=.\endtxt.c -# End Source File -# Begin Source File - -SOURCE=.\endtxt.h -# End Source File -# Begin Source File - -SOURCE=..\filesrch.c -# End Source File -# Begin Source File - -SOURCE=..\filesrch.h -# End Source File -# Begin Source File - -SOURCE=.\hwsym_sdl.c -# End Source File -# Begin Source File - -SOURCE=.\hwsym_sdl.h -# End Source File -# Begin Source File - -SOURCE=.\i_cdmus.c -# End Source File -# Begin Source File - -SOURCE=.\i_main.c -# End Source File -# Begin Source File - -SOURCE=.\i_net.c -# End Source File -# Begin Source File - -SOURCE=.\i_sound.c -# End Source File -# Begin Source File - -SOURCE=.\i_system.c -# End Source File -# Begin Source File - -SOURCE=.\i_video.c -# End Source File -# Begin Source File - -SOURCE=.\IMG_xpm.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\ogl_sdl.c -# End Source File -# Begin Source File - -SOURCE=.\ogl_sdl.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\r_opengl\r_opengl.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\r_opengl\r_opengl.h -# End Source File -# Begin Source File - -SOURCE=.\SDL_icon.xpm -# End Source File -# Begin Source File - -SOURCE=.\SDL_main\SDL_win32_main.c - -!IF "$(CFG)" == "Srb2SDL - Win32 Release" - -!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\sdlmain.h -# End Source File -# Begin Source File - -SOURCE=..\win32\Srb2win.rc -# End Source File -# Begin Source File - -SOURCE=..\win32\win_dbg.c -# End Source File -# Begin Source File - -SOURCE=..\win32\win_dbg.h -# End Source File -# Begin Source File - -SOURCE=..\win32\win_main.h -# End Source File -# End Group -# Begin Group "A_Asm" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\p5prof.h -# End Source File -# Begin Source File - -SOURCE=..\tmap.nas - -!IF "$(CFG)" == "Srb2SDL - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\SDL -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\SDL -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_mmx.nas - -!IF "$(CFG)" == "Srb2SDL - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\SDL -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... - -IntDir=.\..\..\objs\VC\Debug\SDL -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_vc.nas - -!IF "$(CFG)" == "Srb2SDL - Win32 Release" - -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\SDL -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2SDL - Win32 Debug" - -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\SDL -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "D_Doom" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\comptime.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.h -# End Source File -# Begin Source File - -SOURCE=..\d_event.h -# End Source File -# Begin Source File - -SOURCE=..\d_main.c -# End Source File -# Begin Source File - -SOURCE=..\d_main.h -# End Source File -# Begin Source File - -SOURCE=..\d_net.c -# End Source File -# Begin Source File - -SOURCE=..\d_net.h -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.c -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.h -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.c -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.h -# End Source File -# Begin Source File - -SOURCE=..\d_player.h -# End Source File -# Begin Source File - -SOURCE=..\d_think.h -# End Source File -# Begin Source File - -SOURCE=..\d_ticcmd.h -# End Source File -# Begin Source File - -SOURCE=..\dehacked.c -# End Source File -# Begin Source File - -SOURCE=..\dehacked.h -# End Source File -# Begin Source File - -SOURCE=..\doomdata.h -# End Source File -# Begin Source File - -SOURCE=..\doomdef.h -# End Source File -# Begin Source File - -SOURCE=..\doomstat.h -# End Source File -# Begin Source File - -SOURCE=..\doomtype.h -# End Source File -# Begin Source File - -SOURCE=..\z_zone.c -# End Source File -# Begin Source File - -SOURCE=..\z_zone.h -# End Source File -# End Group -# Begin Group "F_Frame" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\f_finale.c -# End Source File -# Begin Source File - -SOURCE=..\f_finale.h -# End Source File -# Begin Source File - -SOURCE=..\f_wipe.c -# End Source File -# End Group -# Begin Group "G_Game" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\g_game.c -# End Source File -# Begin Source File - -SOURCE=..\g_game.h -# End Source File -# Begin Source File - -SOURCE=..\g_input.c -# End Source File -# Begin Source File - -SOURCE=..\g_input.h -# End Source File -# Begin Source File - -SOURCE=..\g_state.h -# End Source File -# End Group -# Begin Group "H_Hud" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\am_map.c -# End Source File -# Begin Source File - -SOURCE=..\am_map.h -# End Source File -# Begin Source File - -SOURCE=..\command.c -# End Source File -# Begin Source File - -SOURCE=..\command.h -# End Source File -# Begin Source File - -SOURCE=..\console.c -# End Source File -# Begin Source File - -SOURCE=..\console.h -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\y_inter.c -# End Source File -# Begin Source File - -SOURCE=..\y_inter.h -# End Source File -# End Group -# Begin Group "Hw_Hardware" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\hardware\hw3dsdrv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_cache.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_data.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_defs.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_dll.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_draw.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_drv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_glob.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hws_data.h -# End Source File -# End Group -# Begin Group "I_Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\byteptr.h -# End Source File -# Begin Source File - -SOURCE=..\i_joy.h -# End Source File -# Begin Source File - -SOURCE=..\i_net.h -# End Source File -# Begin Source File - -SOURCE=..\i_sound.h -# End Source File -# Begin Source File - -SOURCE=..\i_system.h -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.c -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.h -# End Source File -# Begin Source File - -SOURCE=..\i_video.h -# End Source File -# Begin Source File - -SOURCE=..\keys.h -# End Source File -# Begin Source File - -SOURCE=..\mserv.c -# End Source File -# Begin Source File - -SOURCE=..\mserv.h -# End Source File -# End Group -# Begin Group "M_Misc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\m_argv.c -# End Source File -# Begin Source File - -SOURCE=..\m_argv.h -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.c -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.h -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.c -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.h -# End Source File -# Begin Source File - -SOURCE=..\m_dllist.h -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.c -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.h -# End Source File -# Begin Source File - -SOURCE=..\m_menu.c -# End Source File -# Begin Source File - -SOURCE=..\m_menu.h -# End Source File -# Begin Source File - -SOURCE=..\m_misc.c -# End Source File -# Begin Source File - -SOURCE=..\m_misc.h -# End Source File -# Begin Source File - -SOURCE=..\m_queue.c -# End Source File -# Begin Source File - -SOURCE=..\m_queue.h -# End Source File -# Begin Source File - -SOURCE=..\m_random.c -# End Source File -# Begin Source File - -SOURCE=..\m_random.h -# End Source File -# Begin Source File - -SOURCE=..\m_swap.h -# End Source File -# Begin Source File - -SOURCE=..\string.c -# End Source File -# End Group -# Begin Group "P_Play" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\info.c -# End Source File -# Begin Source File - -SOURCE=..\info.h -# End Source File -# Begin Source File - -SOURCE=..\p_ceilng.c -# End Source File -# Begin Source File - -SOURCE=..\p_enemy.c -# End Source File -# Begin Source File - -SOURCE=..\p_fab.c -# End Source File -# Begin Source File - -SOURCE=..\p_floor.c -# End Source File -# Begin Source File - -SOURCE=..\p_inter.c -# End Source File -# Begin Source File - -SOURCE=..\p_lights.c -# End Source File -# Begin Source File - -SOURCE=..\p_local.h -# End Source File -# Begin Source File - -SOURCE=..\p_map.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.h -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_pspr.h -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.c -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.h -# End Source File -# Begin Source File - -SOURCE=..\p_setup.c -# End Source File -# Begin Source File - -SOURCE=..\p_setup.h -# End Source File -# Begin Source File - -SOURCE=..\p_sight.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.h -# End Source File -# Begin Source File - -SOURCE=..\p_telept.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.h -# End Source File -# Begin Source File - -SOURCE=..\p_user.c -# End Source File -# Begin Source File - -SOURCE=..\tables.c -# End Source File -# Begin Source File - -SOURCE=..\tables.h -# End Source File -# End Group -# Begin Group "R_Rend" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\r_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\r_bsp.h -# End Source File -# Begin Source File - -SOURCE=..\r_data.c -# End Source File -# Begin Source File - -SOURCE=..\r_data.h -# End Source File -# Begin Source File - -SOURCE=..\r_defs.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw.c -# End Source File -# Begin Source File - -SOURCE=..\r_draw.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw16.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_draw8.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_local.h -# End Source File -# Begin Source File - -SOURCE=..\r_main.c -# End Source File -# Begin Source File - -SOURCE=..\r_main.h -# End Source File -# Begin Source File - -SOURCE=..\r_plane.c -# End Source File -# Begin Source File - -SOURCE=..\r_plane.h -# End Source File -# Begin Source File - -SOURCE=..\r_segs.c -# End Source File -# Begin Source File - -SOURCE=..\r_segs.h -# End Source File -# Begin Source File - -SOURCE=..\r_sky.c -# End Source File -# Begin Source File - -SOURCE=..\r_sky.h -# End Source File -# Begin Source File - -SOURCE=..\r_splats.c -# End Source File -# Begin Source File - -SOURCE=..\r_splats.h -# End Source File -# Begin Source File - -SOURCE=..\r_state.h -# End Source File -# Begin Source File - -SOURCE=..\r_things.c -# End Source File -# Begin Source File - -SOURCE=..\r_things.h -# End Source File -# Begin Source File - -SOURCE=..\screen.c -# End Source File -# Begin Source File - -SOURCE=..\screen.h -# End Source File -# Begin Source File - -SOURCE=..\v_video.c -# End Source File -# Begin Source File - -SOURCE=..\v_video.h -# End Source File -# End Group -# Begin Group "S_Sounds" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\s_sound.c -# End Source File -# Begin Source File - -SOURCE=..\s_sound.h -# End Source File -# Begin Source File - -SOURCE=..\sounds.c -# End Source File -# Begin Source File - -SOURCE=..\sounds.h -# End Source File -# End Group -# Begin Group "W_Wad" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\lzf.c -# End Source File -# Begin Source File - -SOURCE=..\lzf.h -# End Source File -# Begin Source File - -SOURCE=..\md5.c -# End Source File -# Begin Source File - -SOURCE=..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\w_wad.c -# End Source File -# Begin Source File - -SOURCE=..\w_wad.h -# End Source File -# End Group -# Begin Group "Docs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\doc\copying -# End Source File -# Begin Source File - -SOURCE=..\..\doc\faq.txt -# End Source File -# Begin Source File - -SOURCE=..\..\readme.txt -# End Source File -# Begin Source File - -SOURCE=..\..\doc\source.txt -# End Source File -# End Group -# Begin Source File - -SOURCE=..\win32\Srb2win.ico -# End Source File -# End Target -# End Project diff --git a/src/sdl/Srb2SDL.dsw b/src/sdl/Srb2SDL.dsw deleted file mode 100644 index 4f8f7bdce..000000000 --- a/src/sdl/Srb2SDL.dsw +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Srb2SDL"=.\Srb2SDL.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libpng - End Project Dependency - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "libpng"="..\..\libs\libpng-src\projects\visualc6\libpng.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "s_openal"=..\hardware\s_openal\s_openal.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/strcasestr.c b/src/strcasestr.c index 6a686d6dc..6affde364 100644 --- a/src/strcasestr.c +++ b/src/strcasestr.c @@ -22,6 +22,16 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef _MSC_VER +#include +#include +#include + +#ifndef strncasecmp +#define strncasecmp _strnicmp +#endif + +#endif static inline int trycmp (char **pp, char *cp, From eeff182abbea12e8abdc7dda5354a66c72e3bdda Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 3 Jan 2023 14:09:12 -0600 Subject: [PATCH 17/18] Reverse axis event mapping in G_RemapGamepadEvent Was erroneously mapping events inside the deadzone as key down and vice versa. --- src/g_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 465db0316..6b0da7e41 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -543,9 +543,9 @@ INT32 G_RemapGamepadEvent(event_t *event, INT32 *type) const INT16 value = G_GetGamepadAxisValue(event->which, event->key); if (value < -jdeadzone || value > jdeadzone) - *type = ev_keyup; - else *type = ev_keydown; + else + *type = ev_keyup; if (value < -jdeadzone) return KEY_INV_AXES + event->key; From c270cca55f6e13731c91d872a75c58ff01eda769 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 3 Jan 2023 14:39:15 -0600 Subject: [PATCH 18/18] Always swallow pad axis events when menu is active This prevents axis events from trickling out of the menu and taking effect in G_Responder when they aren't hitting the digital deadzone needed to be mapped into internal menu key events. --- src/m_menu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 51d13df98..1d5bd65f3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3224,6 +3224,7 @@ boolean M_Responder(event_t *ev) static INT32 pjoyx = 0, pjoyy = 0; static INT32 pmousex = 0, pmousey = 0; static INT32 lastx = 0, lasty = 0; + boolean shouldswallowevent = false; void (*routine)(INT32 choice); // for some casting problem if (dedicated || (demoplayback && titledemo) @@ -3239,11 +3240,18 @@ boolean M_Responder(event_t *ev) boolean useEventHandler = false; + if (menuactive && ev->type == ev_gamepad_axis && ev->which == 0) + { + // ALWAYS swallow gamepad axis events, to prevent trickling down to game input + // this applies even if the axis event does not get remapped + shouldswallowevent = true; + } + if (noFurtherInput) { // Ignore input after enter/escape/other buttons // (but still allow shift keyup so caps doesn't get stuck) - return false; + return shouldswallowevent; } else if (menuactive) { @@ -3368,7 +3376,7 @@ boolean M_Responder(event_t *ev) } if (!useEventHandler && ch == -1) - return false; + return shouldswallowevent; else if (ch == gamecontrol[GC_SYSTEMMENU][0] || ch == gamecontrol[GC_SYSTEMMENU][1]) // allow remappable ESC key ch = KEY_ESCAPE; @@ -3601,7 +3609,7 @@ boolean M_Responder(event_t *ev) //currentMenu->lastOn = itemOn; //if (currentMenu->prevMenu) // M_SetupNextMenu(currentMenu->prevMenu); - return false; + return shouldswallowevent; default: CON_Responder(ev);