From 52bf13367fe28cb171c7bdd391f6f1d3bdbf2346 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 16 Jun 2016 00:59:54 +0100 Subject: [PATCH 01/56] New rotation functionality. * NAMEcL refers to a frame which is seen for the entirety of an object's left side. * NAMEcR refers to a name which is seen for the entirety of an object's right side. * NAMEcLcR does both sides. * Having just a NAMEcL requires you to fill in the opposite side either with NAMEcn where n is 1 and 5 to 8 OR fill in with a NAMEcR * Switches down the centerline of the object instead of at the ANGLE_202h interval for normal sprites. * Characters were selected for 1) ease of use and 2) not getting in the way of adding support for zdoom's totally bananas 16-way sprite system at a later date if we so choose --- src/hardware/hw_main.c | 11 ++++++-- src/r_defs.h | 6 +++++ src/r_things.c | 57 ++++++++++++++++++++++++++++++++++-------- src/r_things.h | 9 +++++++ 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 35a01ffd..aba89bdc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5095,8 +5095,15 @@ static void HWR_ProjectSprite(mobj_t *thing) if (sprframe->rotate) { // choose a different rotation based on player view - ang = R_PointToAngle(thing->x, thing->y); // uses viewx,viewy - rot = (ang-thing->angle+ANGLE_202h)>>29; + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + + if ((ang < ANGLE_180) && (sprframe->rotate & 4)) // See from right + rot = 6; // F7 slot + else if ((ang >= ANGLE_180) && (sprframe->rotate & 2)) // See from left + rot = 2; // F3 slot + else // Normal behaviour + rot = (ang+ANGLE_202h)>>29; + //Fab: lumpid is the index for spritewidth,spriteoffset... tables lumpoff = sprframe->lumpid[rot]; flip = sprframe->flip & (1<= 64 || rotation > 8) + if (frame >= 64 || !(R_ValidSpriteAngle(rotation))) I_Error("R_InstallSpriteLump: Bad frame characters in lump %s", W_CheckNameForNum(lumppat)); if (maxframe ==(size_t)-1 || frame > maxframe) @@ -111,8 +111,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch // the lump should be used for all rotations if (sprtemp[frame].rotate == 0) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple rot = 0 lump\n", spritename, cn); - - if (sprtemp[frame].rotate == 1) + else // Let's complain for both 1-8 and L/R rotations. CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has rotations and a rot = 0 lump\n", spritename, cn); sprtemp[frame].rotate = 0; @@ -121,15 +120,46 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch sprtemp[frame].lumppat[r] = lumppat; sprtemp[frame].lumpid[r] = lumpid; } - sprtemp[frame].flip = flipped ? UINT8_MAX : 0; + sprtemp[frame].flip = flipped ? UINT8_MAX : 0; // 11111111 in binary + return; + } + + if (rotation == ROT_L || rotation == ROT_R) + { + UINT8 rightfactor = ((rotation == ROT_R) ? 4 : 0); + + // the lump should be used for half of all rotations + if (sprtemp[frame].rotate == 0) + CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has L/R rotations and a rot = 0 lump\n", spritename, cn); + else if (sprtemp[frame].rotate == 1) + CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); + // Let's not complain about multiple L/R rotations. It's not worth the effort. + + sprtemp[frame].rotate |= ((rotation == ROT_R) ? 4 : 2); + for (r = 0; r < 4; r++) + { + if ((r != 0) || (sprtemp[frame].lumppat[rotation] == LUMPERROR)) // Only set front/back angles if they don't exist + { + sprtemp[frame].lumppat[r + rightfactor] = lumppat; + sprtemp[frame].lumpid[r + rightfactor] = lumpid; + } + } + sprtemp[frame].flip |= (flipped ? (0x0F << rightfactor) : 0); // 00001111 or 11110000 in binary, depending on rotation being ROT_L or ROT_R return; } // the lump is only used for one rotation if (sprtemp[frame].rotate == 0) - CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has rotations and a rot = 0 lump\n", spritename, cn); + CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has 1-8 rotations and a rot = 0 lump\n", spritename, cn); + else if (sprtemp[frame].rotate != 1) + CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); - sprtemp[frame].rotate = 1; + if (rotation == 0 || rotation == 4) // Front or back... + sprtemp[frame].rotate = 1; // Prevent L and R changeover + else if (rotation > 3) // Right side + sprtemp[frame].rotate = (1 | (sprtemp[frame].rotate & 2)); // Continue allowing L frame changeover + else // if (rotation <= 3) // Left side + sprtemp[frame].rotate = (1 | (sprtemp[frame].rotate & 4)); // Continue allowing R frame changeover // make 0 based rotation--; @@ -195,7 +225,7 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, frame = R_Char2Frame(lumpinfo[l].name[4]); rotation = (UINT8)(lumpinfo[l].name[5] - '0'); - if (frame >= 64 || rotation > 8) // Give an actual NAME error -_-... + if (frame >= 64 || !(R_ValidSpriteAngle(rotation))) // Give an actual NAME error -_-... { CONS_Alert(CONS_WARNING, M_GetText("Bad sprite name: %s\n"), W_CheckNameForNumPwad(wadnum,l)); continue; @@ -287,7 +317,7 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, // only the first rotation is needed break; - case 1: + default: // must have all 8 frames for (rotation = 0; rotation < 8; rotation++) // we test the patch lump, or the id lump whatever @@ -1132,8 +1162,15 @@ static void R_ProjectSprite(mobj_t *thing) if (sprframe->rotate) { // choose a different rotation based on player view - ang = R_PointToAngle (thing->x, thing->y); - rot = (ang-thing->angle+ANGLE_202h)>>29; + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + + if ((ang < ANGLE_180) && (sprframe->rotate & 4)) // See from right + rot = 6; // F7 slot + else if ((ang >= ANGLE_180) && (sprframe->rotate & 2)) // See from left + rot = 2; // F3 slot + else // Normal behaviour + rot = (ang+ANGLE_202h)>>29; + //Fab: lumpid is the index for spritewidth,spriteoffset... tables lump = sprframe->lumpid[rot]; flip = sprframe->flip & (1< Date: Thu, 16 Jun 2016 01:20:35 +0100 Subject: [PATCH 02/56] Forgot to stage this, woops. Adds special casing to prevent the I_Error and makes the behaviour of the cL/cR more consistent in general such that it matches my description. --- src/r_things.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 4f1faae9..6e4f780b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -135,14 +135,14 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); // Let's not complain about multiple L/R rotations. It's not worth the effort. + if (sprtemp[frame].rotate == 0xff) + sprtemp[frame].rotate = 0; + sprtemp[frame].rotate |= ((rotation == ROT_R) ? 4 : 2); - for (r = 0; r < 4; r++) + for (r = 1; r < 4; r++) // Don't set for front/back frames { - if ((r != 0) || (sprtemp[frame].lumppat[rotation] == LUMPERROR)) // Only set front/back angles if they don't exist - { - sprtemp[frame].lumppat[r + rightfactor] = lumppat; - sprtemp[frame].lumpid[r + rightfactor] = lumpid; - } + sprtemp[frame].lumppat[r + rightfactor] = lumppat; + sprtemp[frame].lumpid[r + rightfactor] = lumpid; } sprtemp[frame].flip |= (flipped ? (0x0F << rightfactor) : 0); // 00001111 or 11110000 in binary, depending on rotation being ROT_L or ROT_R return; @@ -317,6 +317,14 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, // only the first rotation is needed break; + case 6: // (rotate & (2|4)) == (2|4) - both Left and Right rotations + case 7: + // we test to see whether the left and right slots are present + if ((sprtemp[frame].lumppat[2] == LUMPERROR) || (sprtemp[frame].lumppat[6] == LUMPERROR)) + I_Error("R_AddSingleSpriteDef: Sprite %s frame %c is missing rotations", + sprname, R_Frame2Char(frame)); + break; + default: // must have all 8 frames for (rotation = 0; rotation < 8; rotation++) From f08e996e761e169033cefca99bc64febfe3c1469 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 16 Jun 2016 01:37:48 +0100 Subject: [PATCH 03/56] MI corrections --- src/r_things.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 6e4f780b..650b454e 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -111,7 +111,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch // the lump should be used for all rotations if (sprtemp[frame].rotate == 0) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple rot = 0 lump\n", spritename, cn); - else // Let's complain for both 1-8 and L/R rotations. + else if (sprtemp[frame].rotate != 0xff) // Let's complain for both 1-8 and L/R rotations. CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has rotations and a rot = 0 lump\n", spritename, cn); sprtemp[frame].rotate = 0; @@ -154,6 +154,9 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch else if (sprtemp[frame].rotate != 1) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); + // make 0 based + rotation--; + if (rotation == 0 || rotation == 4) // Front or back... sprtemp[frame].rotate = 1; // Prevent L and R changeover else if (rotation > 3) // Right side @@ -161,9 +164,6 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch else // if (rotation <= 3) // Left side sprtemp[frame].rotate = (1 | (sprtemp[frame].rotate & 4)); // Continue allowing R frame changeover - // make 0 based - rotation--; - if (sprtemp[frame].lumppat[rotation] != LUMPERROR) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s: %c%c has two lumps mapped to it\n", spritename, cn, '1'+rotation); From 41b35a923f64961945c7a429ea67ecc5a3171b38 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 16 Jun 2016 14:20:03 +0100 Subject: [PATCH 04/56] Gave the new flag-based system for sprite angles actual flag names instead of relying on magic numbers. Also, I did a wee smidgen of reorganisation. --- src/hardware/hw_main.c | 20 +++++++-------- src/r_defs.h | 18 ++++++++----- src/r_things.c | 57 ++++++++++++++++++++++-------------------- 3 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index aba89bdc..5dfb2d12 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5092,14 +5092,21 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate) + if (sprframe->rotate == SRF_SINGLE) + { + // use single rotation for all views + rot = 0; //Fab: for vis->patch below + lumpoff = sprframe->lumpid[0]; //Fab: see note above + flip = sprframe->flip; // Will only be 0x00 or 0xFF + } + else { // choose a different rotation based on player view ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if ((ang < ANGLE_180) && (sprframe->rotate & 4)) // See from right + if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right rot = 6; // F7 slot - else if ((ang >= ANGLE_180) && (sprframe->rotate & 2)) // See from left + else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left rot = 2; // F3 slot else // Normal behaviour rot = (ang+ANGLE_202h)>>29; @@ -5108,13 +5115,6 @@ static void HWR_ProjectSprite(mobj_t *thing) lumpoff = sprframe->lumpid[rot]; flip = sprframe->flip & (1<patch below - lumpoff = sprframe->lumpid[0]; //Fab: see note above - flip = sprframe->flip; // Will only be 0x00 or 0xFF - } if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale); diff --git a/src/r_defs.h b/src/r_defs.h index 2ff2cacf..150c3fa5 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -729,11 +729,21 @@ typedef struct #pragma pack() #endif +typedef enum +{ + SRF_SINGLE = 0, // 0-angle for all rotations + SRF_3D = 1, // Angles 1-8 + SRF_LEFT = 2, // Left side has single patch + SRF_RIGHT = 4, // Right side has single patch + SRF_2D = 6, // SRF_LEFT|SRF_RIGHT + SRF_NONE = 0xff // Initial value +} spriterotateflags_t; // SRF's up! + // // Sprites are patches with a special naming convention so they can be // recognized by R_InitSprites. // The base name is NNNNFx or NNNNFxFx, with x indicating the rotation, -// x = 0, 1-7. +// x = 0, 1-8, L/R // The sprite and frame specified by a thing_t is range checked at run time. // A sprite is a patch_t that is assumed to represent a three dimensional // object and may have multiple rotations predrawn. @@ -745,13 +755,9 @@ typedef struct // typedef struct { - // If false use 0 for any position. - // If L is present, (rotate & 2) == 2. - // If R is present, (rotate & 4) == 4. - // Otherwise, use 1. // Note: as eight entries are available, we might as well insert the same // name eight times. - UINT8 rotate; + UINT8 rotate; // see spriterotateflags_t above // Lump to use for view angles 0-7. lumpnum_t lumppat[8]; // lump number 16 : 16 wad : lump diff --git a/src/r_things.c b/src/r_things.c index 650b454e..1ea932b9 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -109,12 +109,12 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch if (rotation == 0) { // the lump should be used for all rotations - if (sprtemp[frame].rotate == 0) + if (sprtemp[frame].rotate == SRF_SINGLE) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple rot = 0 lump\n", spritename, cn); - else if (sprtemp[frame].rotate != 0xff) // Let's complain for both 1-8 and L/R rotations. + else if (sprtemp[frame].rotate != SRF_NONE) // Let's complain for both 1-8 and L/R rotations. CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has rotations and a rot = 0 lump\n", spritename, cn); - sprtemp[frame].rotate = 0; + sprtemp[frame].rotate = SRF_SINGLE; for (r = 0; r < 8; r++) { sprtemp[frame].lumppat[r] = lumppat; @@ -129,16 +129,20 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch UINT8 rightfactor = ((rotation == ROT_R) ? 4 : 0); // the lump should be used for half of all rotations - if (sprtemp[frame].rotate == 0) + if (sprtemp[frame].rotate == SRF_SINGLE) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has L/R rotations and a rot = 0 lump\n", spritename, cn); - else if (sprtemp[frame].rotate == 1) + else if (sprtemp[frame].rotate == SRF_3D) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); // Let's not complain about multiple L/R rotations. It's not worth the effort. - if (sprtemp[frame].rotate == 0xff) - sprtemp[frame].rotate = 0; + if (sprtemp[frame].rotate == SRF_NONE) + sprtemp[frame].rotate = SRF_SINGLE; + + sprtemp[frame].rotate |= ((rotation == ROT_R) ? SRF_RIGHT : SRF_LEFT); + + if (sprtemp[frame].rotate == (SRF_3D|SRF_2D)) + sprtemp[frame].rotate = SRF_2D; // SRF_3D|SRF_2D being enabled at the same time doesn't HURT in the current sprite angle implementation, but it DOES mean more to check in some of the helper functions. Let's not allow this scenario to happen. - sprtemp[frame].rotate |= ((rotation == ROT_R) ? 4 : 2); for (r = 1; r < 4; r++) // Don't set for front/back frames { sprtemp[frame].lumppat[r + rightfactor] = lumppat; @@ -149,20 +153,20 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch } // the lump is only used for one rotation - if (sprtemp[frame].rotate == 0) + if (sprtemp[frame].rotate == SRF_SINGLE) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has 1-8 rotations and a rot = 0 lump\n", spritename, cn); - else if (sprtemp[frame].rotate != 1) + else if ((sprtemp[frame].rotate != SRF_3D) && (sprtemp[frame].rotate != SRF_NONE)) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn); // make 0 based rotation--; if (rotation == 0 || rotation == 4) // Front or back... - sprtemp[frame].rotate = 1; // Prevent L and R changeover + sprtemp[frame].rotate = SRF_3D; // Prevent L and R changeover else if (rotation > 3) // Right side - sprtemp[frame].rotate = (1 | (sprtemp[frame].rotate & 2)); // Continue allowing L frame changeover + sprtemp[frame].rotate = (SRF_3D | (sprtemp[frame].rotate & SRF_LEFT)); // Continue allowing L frame changeover else // if (rotation <= 3) // Left side - sprtemp[frame].rotate = (1 | (sprtemp[frame].rotate & 4)); // Continue allowing R frame changeover + sprtemp[frame].rotate = (SRF_3D | (sprtemp[frame].rotate & SRF_RIGHT)); // Continue allowing R frame changeover if (sprtemp[frame].lumppat[rotation] != LUMPERROR) CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s: %c%c has two lumps mapped to it\n", spritename, cn, '1'+rotation); @@ -308,17 +312,16 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, { switch (sprtemp[frame].rotate) { - case 0xff: + case SRF_NONE: // no rotations were found for that frame at all I_Error("R_AddSingleSpriteDef: No patches found for %s frame %c", sprname, R_Frame2Char(frame)); break; - case 0: + case SRF_SINGLE: // only the first rotation is needed break; - case 6: // (rotate & (2|4)) == (2|4) - both Left and Right rotations - case 7: + case SRF_2D: // both Left and Right rotations // we test to see whether the left and right slots are present if ((sprtemp[frame].lumppat[2] == LUMPERROR) || (sprtemp[frame].lumppat[6] == LUMPERROR)) I_Error("R_AddSingleSpriteDef: Sprite %s frame %c is missing rotations", @@ -1167,14 +1170,21 @@ static void R_ProjectSprite(mobj_t *thing) I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate) + if (sprframe->rotate == SRF_SINGLE) + { + // use single rotation for all views + rot = 0; //Fab: for vis->patch below + lump = sprframe->lumpid[0]; //Fab: see note above + flip = sprframe->flip; // Will only be 0x00 or 0xFF + } + else { // choose a different rotation based on player view ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if ((ang < ANGLE_180) && (sprframe->rotate & 4)) // See from right + if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right rot = 6; // F7 slot - else if ((ang >= ANGLE_180) && (sprframe->rotate & 2)) // See from left + else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left rot = 2; // F3 slot else // Normal behaviour rot = (ang+ANGLE_202h)>>29; @@ -1183,13 +1193,6 @@ static void R_ProjectSprite(mobj_t *thing) lump = sprframe->lumpid[rot]; flip = sprframe->flip & (1<patch below - lump = sprframe->lumpid[0]; //Fab: see note above - flip = sprframe->flip; // Will only be 0x00 or 0xFF - } I_Assert(lump < max_spritelumps); From 2a74ea07eeef1dcff6e8bd287756c6f8055d7bdb Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 22 Aug 2016 22:54:30 +0100 Subject: [PATCH 05/56] Chee wanted paper sprites' code, so here it is for the public to see. Note: Won't compile. Need to merge in the NAMEcLcR stuff first, let me do that. --- src/dehacked.c | 4 +- src/m_cheat.c | 2 +- src/p_enemy.c | 18 +++--- src/p_inter.c | 2 +- src/p_mobj.c | 30 ++++------ src/p_mobj.h | 5 +- src/p_pspr.h | 4 +- src/p_user.c | 8 +-- src/r_things.c | 158 +++++++++++++++++++++++++++++++++++++------------ src/r_things.h | 3 +- 10 files changed, 160 insertions(+), 74 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index f03dd73b..c31c2264 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6642,7 +6642,7 @@ static const char *const MOBJFLAG_LIST[] = { "SHOOTABLE", "NOSECTOR", "NOBLOCKMAP", - "AMBUSH", + "PAPERCOLLISION", "PUSHABLE", "BOSS", "SPAWNCEILING", @@ -6700,6 +6700,7 @@ static const char *const MOBJFLAG2_LIST[] = { "BOSSNOTRAP", // No Egg Trap after boss "BOSSFLEE", // Boss is fleeing! "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH NULL }; @@ -6992,6 +6993,7 @@ struct { // Frame settings {"FF_FRAMEMASK",FF_FRAMEMASK}, + {"FF_PAPERSPRITE",FF_PAPERSPRITE}, {"FF_ANIMATE",FF_ANIMATE}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, {"FF_TRANSMASK",FF_TRANSMASK}, diff --git a/src/m_cheat.c b/src/m_cheat.c index 89334596..f49930b2 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1054,7 +1054,7 @@ void OP_NightsObjectplace(player_t *player) if (!OP_HeightOkay(player, false)) return; - if (player->mo->target->flags & MF_AMBUSH) + if (player->mo->target->flags2 & MF2_AMBUSH) angle = (UINT16)player->anotherflyangle; else { diff --git a/src/p_enemy.c b/src/p_enemy.c index 025a2597..b98412bb 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2625,7 +2625,7 @@ for (i = cvar.value; i; --i) spawnchance[numchoices++] = type newbox = spawnchance[P_RandomKey(numchoices)]; item = mobjinfo[newbox].damage; - remains->flags &= ~MF_AMBUSH; + remains->flags2 &= ~MF2_AMBUSH; break; } default: @@ -3444,7 +3444,7 @@ void A_BubbleSpawn(mobj_t *actor) } actor->flags2 &= ~MF2_DONTDRAW; - if (!(actor->flags & MF_AMBUSH)) + if (!(actor->flags2 & MF2_AMBUSH)) { // Quick! Look through players! // Don't spawn bubbles unless a player is relatively close by (var2). @@ -3492,7 +3492,7 @@ void A_FanBubbleSpawn(mobj_t *actor) if (!(actor->eflags & MFE_UNDERWATER)) return; - if (!(actor->flags & MF_AMBUSH)) + if (!(actor->flags2 & MF2_AMBUSH)) { // Quick! Look through players! // Don't spawn bubbles unless a player is relatively close by (var2). @@ -4038,7 +4038,7 @@ void A_JetChase(mobj_t *actor) return; #endif - if (actor->flags & MF_AMBUSH) + if (actor->flags2 & MF2_AMBUSH) return; if (actor->z >= actor->waterbottom && actor->watertop > actor->floorz @@ -4931,7 +4931,7 @@ void A_SlingAppear(mobj_t *actor) if (firsttime) { // This is the outermost link in the chain - spawnee->flags |= MF_AMBUSH; + spawnee->flags2 |= MF2_AMBUSH; firsttime = false; } @@ -5916,7 +5916,7 @@ void A_Boss2Chase(mobj_t *actor) { actor->watertop = -actor->watertop; actor->extravalue1 = 18; - if (actor->flags & MF_AMBUSH) + if (actor->flags2 & MF2_AMBUSH) actor->extravalue1 -= (actor->info->spawnhealth - actor->health)*2; actor->extravalue2 = actor->extravalue1; } @@ -5942,7 +5942,7 @@ void A_Boss2Chase(mobj_t *actor) else { // Only speed up if you have the 'Deaf' flag. - if (actor->flags & MF_AMBUSH) + if (actor->flags2 & MF2_AMBUSH) speedvar = actor->health; else speedvar = actor->info->spawnhealth; @@ -6533,7 +6533,7 @@ void A_BuzzFly(mobj_t *actor) if (LUA_CallAction("A_BuzzFly", actor)) return; #endif - if (actor->flags & MF_AMBUSH) + if (actor->flags2 & MF2_AMBUSH) return; if (actor->reactiontime) @@ -6673,7 +6673,7 @@ void A_GuardChase(mobj_t *actor) return; // got a new target // chase towards player - if (--actor->movecount < 0 || !P_Move(actor, (actor->flags & MF_AMBUSH) ? actor->info->speed * 2 : actor->info->speed)) + if (--actor->movecount < 0 || !P_Move(actor, (actor->flags2 & MF2_AMBUSH) ? actor->info->speed * 2 : actor->info->speed)) { P_NewChaseDir(actor); actor->movecount += 5; // Increase tics before change in direction allowed. diff --git a/src/p_inter.c b/src/p_inter.c index cf5512a1..aa0fce5c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1327,7 +1327,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_SMALLMACECHAIN: case MT_BIGMACECHAIN: // Is this the last link in the chain? - if (toucher->momz > 0 || !(special->flags & MF_AMBUSH) + if (toucher->momz > 0 || !(special->flags2 & MF2_AMBUSH) || (player->pflags & PF_ITEMHANG) || (player->pflags & PF_MACESPIN)) return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 62dee0a6..eed2f3c0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2466,7 +2466,7 @@ static boolean P_ZMovement(mobj_t *mo) && abs(mom.y) < FixedMul(STOPSPEED, mo->scale) && abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale)) { - if (mo->flags & MF_AMBUSH) + if (mo->flags2 & MF2_AMBUSH) { // If deafed, give the tumbleweed another random kick if it runs out of steam. mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); @@ -6392,7 +6392,7 @@ void P_MobjThinker(mobj_t *mobj) flame->angle = mobj->angle; - if (mobj->flags & MF_AMBUSH) // Wave up and down instead of side-to-side + if (mobj->flags2 & MF2_AMBUSH) // Wave up and down instead of side-to-side flame->momz = mobj->fuse << (FRACBITS-2); else flame->angle += FixedAngle(mobj->fuse*FRACUNIT); @@ -6427,7 +6427,7 @@ void P_MobjThinker(mobj_t *mobj) strength -= ((20*FRACUNIT)/16)*mobj->movedir; // If deaf'd, the object spawns on the ceiling. - if (mobj->flags & MF_AMBUSH) + if (mobj->flags2 & MF2_AMBUSH) { mobj->z = mobj->ceilingz-mobj->height; flame->momz = -strength; @@ -7283,7 +7283,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_EGGMANBOX: // Eggman box case MT_GRAVITYBOX: // Gravity box case MT_QUESTIONBOX: - if ((mobj->flags & MF_AMBUSH || mobj->flags2 & MF2_STRONGBOX) && mobj->type != MT_QUESTIONBOX) + if ((mobj->flags2 & MF2_AMBUSH || mobj->flags2 & MF2_STRONGBOX) && mobj->type != MT_QUESTIONBOX) { mobjtype_t spawnchance[64]; INT32 numchoices = 0, i = 0; @@ -7311,11 +7311,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s i = P_RandomKey(numchoices); // Gotta love those random numbers! newmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, spawnchance[i]); - // If the monitor respawns randomly, transfer the flag. - if (mobj->flags & MF_AMBUSH) - newmobj->flags |= MF_AMBUSH; - - // Transfer flags2 (strongbox, objectflip) + // Transfer flags2 (strongbox, objectflip, ambush) newmobj->flags2 = mobj->flags2; } else @@ -9132,7 +9128,7 @@ ML_NOCLIMB : Direction not controllable if (firsttime) { // This is the outermost link in the chain - spawnee->flags |= MF_AMBUSH; + spawnee->flags2 |= MF2_AMBUSH; firsttime = false; } @@ -9204,7 +9200,7 @@ ML_NOCLIMB : Direction not controllable { // Inverted if uppermost bit is set if (mthing->angle & 16384) - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; if (mthing->angle > 0) mobj->radius = (mthing->angle & 16383)*FRACUNIT; @@ -9381,7 +9377,7 @@ ML_NOCLIMB : Direction not controllable mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum || mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum || mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum) - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; } else if (mthing->type != mobjinfo[MT_AXIS].doomednum && @@ -9389,7 +9385,7 @@ ML_NOCLIMB : Direction not controllable mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum && mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum && mthing->type != mobjinfo[MT_STARPOST].doomednum) - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; } if (mthing->options & MTF_OBJECTSPECIAL) @@ -9728,7 +9724,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) P_SetMobjState(mobj, mobj->info->seestate); mobj->angle = FixedAngle(mthing->angle*FRACUNIT); - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; mthing->mobj = mobj; } // All manners of rings and coins @@ -9802,7 +9798,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) } mobj->angle = FixedAngle(mthing->angle*FRACUNIT); - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; mthing->mobj = mobj; } // *** @@ -9858,7 +9854,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobj->angle = FixedAngle(mthing->angle*FRACUNIT); if (mthing->options & MTF_AMBUSH) - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; } } // Diagonal rings (handles both types) @@ -9916,7 +9912,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobj->angle = FixedAngle(mthing->angle*FRACUNIT); if (mthing->options & MTF_AMBUSH) - mobj->flags |= MF_AMBUSH; + mobj->flags2 |= MF2_AMBUSH; } } // Rings of items (all six of them) diff --git a/src/p_mobj.h b/src/p_mobj.h index 79cffae8..c8207c56 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -107,8 +107,8 @@ typedef enum MF_NOSECTOR = 1<<3, // Don't use the blocklinks (inert but displayable) MF_NOBLOCKMAP = 1<<4, - // Not to be activated by sound, deaf monster. - MF_AMBUSH = 1<<5, + // Thin, paper-like collision bound (for visual equivalent, see FF_PAPERSPRITE) + MF_PAPERCOLLISION = 1<<5, // You can push this object. It can activate switches and things by pushing it on top. MF_PUSHABLE = 1<<6, // Object is a boss. @@ -193,6 +193,7 @@ typedef enum MF2_BOSSNOTRAP = 1<<25, // No Egg Trap after boss MF2_BOSSFLEE = 1<<26, // Boss is fleeing! MF2_BOSSDEAD = 1<<27, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + MF2_AMBUSH = 1<<28, // Alternate behaviour typically set by MTF_AMBUSH // free: to and including 1<<31 } mobjflag2_t; diff --git a/src/p_pspr.h b/src/p_pspr.h index 2fb232e7..c0064bc3 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -36,7 +36,9 @@ #endif /// \brief Frame flags: only the frame number -#define FF_FRAMEMASK 0x3fff +#define FF_FRAMEMASK 0x1ff +/// \brief Frame flags: Thin, paper-like sprite (for collision equivalent, see MF_PAPERCOLLISION) +#define FF_PAPERSPRITE 0x800 /// \brief Frame flags: Simple stateless animation #define FF_ANIMATE 0x4000 /// \brief Frame flags: frame always appears full bright diff --git a/src/p_user.c b/src/p_user.c index 9cd6aa40..6bf8753b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -629,7 +629,7 @@ static void P_DeNightserizePlayer(player_t *player) if (!(mo2->type == MT_NIGHTSDRONE)) continue; - if (mo2->flags & MF_AMBUSH) + if (mo2->flags2 & MF2_AMBUSH) P_DamageMobj(player->mo, NULL, NULL, 10000); break; @@ -4931,7 +4931,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad boolean transfer1last = false; boolean transfer2last = false; vertex_t vertices[4]; - fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags & MF_AMBUSH ? -1 : 1); + fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags2 & MF2_AMBUSH ? -1 : 1); // Find next waypoint for (th = thinkercap.next; th != &thinkercap; th = th->next) @@ -5596,7 +5596,7 @@ static void P_NiGHTSMovement(player_t *player) // The 'ambush' flag says you should rotate // the other way around the axis. - if (player->mo->target->flags & MF_AMBUSH) + if (player->mo->target->flags2 & MF2_AMBUSH) backwardaxis = true; player->angle_pos = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); @@ -7931,7 +7931,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else if (player->mo->target) { - if (player->mo->target->flags & MF_AMBUSH) + if (player->mo->target->flags2 & MF2_AMBUSH) angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); else angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y); diff --git a/src/r_things.c b/src/r_things.c index 22551a02..84dff718 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -754,11 +754,18 @@ static void R_DrawVisSprite(vissprite_t *vis) if (overflow_test < 0) overflow_test = -overflow_test; if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // fixed point mult would overflow + if (vis->scalestep) // handles right edge too + { + overflow_test = (INT64)centeryfrac - (((INT64)vis->texturemid*(vis->scale + (vis->scalestep*(vis->x2 - vis->x1))))>>FRACBITS); + if (overflow_test < 0) overflow_test = -overflow_test; + if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto + } + colfunc = basecolfunc; // hack: this isn't resetting properly somewhere. dc_colormap = vis->colormap; if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" { - // translate green skin to another color + // translate certain pixels to white colfunc = transcolfunc; if (vis->mobj->type == MT_CYBRAKDEMON) dc_translation = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE); @@ -814,13 +821,10 @@ static void R_DrawVisSprite(vissprite_t *vis) if (!dc_colormap) dc_colormap = colormaps; - dc_iscale = FixedDiv(FRACUNIT, vis->scale); dc_texturemid = vis->texturemid; dc_texheight = 0; frac = vis->startfrac; - spryscale = vis->scale; - sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale); windowtop = windowbottom = sprbotscreen = INT32_MAX; if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES) @@ -832,28 +836,29 @@ static void R_DrawVisSprite(vissprite_t *vis) if (!vis->isScaled) { vis->scale = FixedMul(vis->scale, this_scale); - spryscale = vis->scale; - dc_iscale = FixedDiv(FRACUNIT, vis->scale); + vis->scalestep = FixedMul(vis->scalestep, this_scale); vis->xiscale = FixedDiv(vis->xiscale,this_scale); vis->isScaled = true; } dc_texturemid = FixedDiv(dc_texturemid,this_scale); + } - //Oh lordy, mercy me. Don't freak out if sprites go offscreen! - /*if (vis->xiscale > 0) - frac = FixedDiv(frac, this_scale); - else if (vis->x1 <= 0) - frac = (vis->x1 - vis->x2) * vis->xiscale;*/ + spryscale = vis->scale; + if (!(vis->scalestep)) + { sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale); - //dc_hires = 1; + dc_iscale = FixedDiv(FRACUNIT, vis->scale); } x1 = vis->x1; x2 = vis->x2; if (vis->x1 < 0) + { + spryscale += vis->scalestep*(-vis->x1); vis->x1 = 0; + } if (vis->x2 >= vid.width) vis->x2 = vid.width-1; @@ -869,10 +874,16 @@ static void R_DrawVisSprite(vissprite_t *vis) #else column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[frac>>FRACBITS])); #endif + if (vis->scalestep) + { + sprtopscreen = (centeryfrac - FixedMul(dc_texturemid, spryscale)); + dc_iscale = (0xffffffffu / (unsigned)spryscale); + } if (vis->vflip) R_DrawFlippedMaskedColumn(column, patch->height); else R_DrawMaskedColumn(column); + spryscale += vis->scalestep; } colfunc = basecolfunc; @@ -967,7 +978,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing) if (testheight <= sprite->gz) return; - cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->scale))>>FRACBITS); + cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->sortscale))>>FRACBITS); if (cutfrac < 0) continue; if (cutfrac > viewheight) @@ -1040,7 +1051,7 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t tr_x, tr_y; fixed_t gxt, gyt; fixed_t tx, tz; - fixed_t xscale, yscale; //added : 02-02-98 : aaargll..if I were a math-guy!!! + fixed_t xscale, yscale, sortscale; //added : 02-02-98 : aaargll..if I were a math-guy!!! INT32 x1, x2; @@ -1057,6 +1068,9 @@ static void R_ProjectSprite(mobj_t *thing) angle_t ang; fixed_t iscale; + fixed_t scalestep; // toast '16 + fixed_t offset, offset2; + boolean papersprite = (thing->frame & FF_PAPERSPRITE); //SoM: 3/17/2000 fixed_t gz, gzt; @@ -1064,6 +1078,8 @@ static void R_ProjectSprite(mobj_t *thing) INT32 light = 0; fixed_t this_scale = thing->scale; + fixed_t ang_scale = FRACUNIT; + // transform the origin point tr_x = thing->x - viewx; tr_y = thing->y - viewy; @@ -1074,7 +1090,7 @@ static void R_ProjectSprite(mobj_t *thing) tz = gxt-gyt; // thing is behind view plane? - if (tz < FixedMul(MINZ, this_scale)) + if (!(papersprite) && (tz < FixedMul(MINZ, this_scale))) // papersprite clipping is handled later return; gxt = -FixedMul(tr_x, viewsin); @@ -1087,7 +1103,7 @@ static void R_ProjectSprite(mobj_t *thing) // aspect ratio stuff xscale = FixedDiv(projection, tz); - yscale = FixedDiv(projectiony, tz); + sortscale = FixedDiv(projectiony, tz); // decide which patch to use for sprite relative to player #ifdef RANGECHECK @@ -1129,10 +1145,17 @@ static void R_ProjectSprite(mobj_t *thing) I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite); #endif + if (sprframe->rotate != SRF_SINGLE || papersprite) + { + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + if (papersprite) + ang_scale = abs(FINESINE(ang>>ANGLETOFINESHIFT)); + } + if (sprframe->rotate) { // choose a different rotation based on player view - ang = R_PointToAngle (thing->x, thing->y); + //ang = R_PointToAngle (thing->x, thing->y); rot = (ang-thing->angle+ANGLE_202h)>>29; //Fab: lumpid is the index for spritewidth,spriteoffset... tables lump = sprframe->lumpid[rot]; @@ -1153,22 +1176,77 @@ static void R_ProjectSprite(mobj_t *thing) // calculate edges of the shape if (flip) - tx -= FixedMul(spritecachedinfo[lump].width-spritecachedinfo[lump].offset, this_scale); + offset = spritecachedinfo[lump].offset - spritecachedinfo[lump].width; else - tx -= FixedMul(spritecachedinfo[lump].offset, this_scale); + offset = -spritecachedinfo[lump].offset; + offset = FixedMul(offset, this_scale); + tx += FixedMul(offset, ang_scale); x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS; // off the right side? if (x1 > viewwidth) return; - tx += FixedMul(spritecachedinfo[lump].width, this_scale); + offset2 = FixedMul(spritecachedinfo[lump].width, this_scale); + tx += FixedMul(offset2, ang_scale); x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1; // off the left side if (x2 < 0) return; + if (papersprite) + { + fixed_t yscale2, cosmul, sinmul, tz2; + INT32 range; + + if (ang >= ANGLE_180) + { + offset *= -1; + offset2 *= -1; + } + + cosmul = FINECOSINE(thing->angle>>ANGLETOFINESHIFT); + sinmul = FINESINE(thing->angle>>ANGLETOFINESHIFT); + + tr_x += FixedMul(offset, cosmul); + tr_y += FixedMul(offset, sinmul); + gxt = FixedMul(tr_x, viewcos); + gyt = -FixedMul(tr_y, viewsin); + tz = gxt-gyt; + yscale = FixedDiv(projectiony, tz); + if (yscale < 64) return; // Fix some funky visuals + + tr_x += FixedMul(offset2, cosmul); + tr_y += FixedMul(offset2, sinmul); + gxt = FixedMul(tr_x, viewcos); + gyt = -FixedMul(tr_y, viewsin); + tz2 = gxt-gyt; + yscale2 = FixedDiv(projectiony, tz2); + if (yscale2 < 64) return; // ditto + + if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier + return; + + if (x2 > x1) + range = (x2 - x1); + else + range = 1; + + scalestep = (yscale2 - yscale)/range; + + // The following two are alternate sorting methods which might be more applicable in some circumstances. TODO - maybe enable via MF2? + // sortscale = max(yscale, yscale2); + // sortscale = min(yscale, yscale2); + } + else + { + scalestep = 0; + yscale = sortscale; + } + + xscale = FixedMul(xscale, ang_scale); + // PORTAL SPRITE CLIPPING if (portalrender) { @@ -1250,6 +1328,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->heightsec = heightsec; //SoM: 3/17/2000 vis->mobjflags = thing->flags; vis->scale = yscale; //<sortscale = sortscale; vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; @@ -1259,6 +1338,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->pz = thing->z; vis->pzt = vis->pz + vis->thingheight; vis->texturemid = vis->gzt - viewz; + vis->scalestep = scalestep; vis->mobj = thing; // Easy access! Tails 06-07-2002 @@ -1276,8 +1356,8 @@ static void R_ProjectSprite(mobj_t *thing) vis->xscale = xscale; //SoM: 4/17/2000 vis->sector = thing->subsector->sector; - vis->szt = (INT16)((centeryfrac - FixedMul(vis->gzt - viewz, yscale))>>FRACBITS); - vis->sz = (INT16)((centeryfrac - FixedMul(vis->gz - viewz, yscale))>>FRACBITS); + vis->szt = (INT16)((centeryfrac - FixedMul(vis->gzt - viewz, sortscale))>>FRACBITS); + vis->sz = (INT16)((centeryfrac - FixedMul(vis->gz - viewz, sortscale))>>FRACBITS); vis->cut = SC_NONE; if (thing->subsector->sector->numlights) vis->extra_colormap = thing->subsector->sector->lightlist[light].extra_colormap; @@ -1298,7 +1378,10 @@ static void R_ProjectSprite(mobj_t *thing) } if (vis->x1 > x1) + { vis->startfrac += FixedDiv(vis->xiscale, this_scale)*(vis->x1-x1); + vis->scale += scalestep*(vis->x1 - x1); + } //Fab: lumppat is the lump number of the patch to use, this is different // than lumpid for sprites-in-pwad : the graphics are patched @@ -1457,7 +1540,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) // store information in a vissprite vis = R_NewVisSprite(); - vis->scale = yscale; //<scale = vis->sortscale = yscale; //<dispoffset = 0; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; @@ -1467,6 +1550,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis->pz = thing->z; vis->pzt = vis->pz + vis->thingheight; vis->texturemid = vis->gzt - viewz; + vis->scalestep = 0; vis->x1 = x1 < 0 ? 0 : x1; vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; @@ -1645,14 +1729,14 @@ void R_SortVisSprites(void) bestscale = bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { - if (ds->scale < bestscale) + if (ds->sortscale < bestscale) { - bestscale = ds->scale; + bestscale = ds->sortscale; bestdispoffset = ds->dispoffset; best = ds; } // order visprites of same scale by dispoffset, smallest first - else if (ds->scale == bestscale && ds->dispoffset < bestdispoffset) + else if (ds->sortscale == bestscale && ds->dispoffset < bestdispoffset) { bestdispoffset = ds->dispoffset; best = ds; @@ -1814,7 +1898,7 @@ static void R_CreateDrawNodes(void) for (i = x1; i <= x2; i++) { - if (r2->seg->frontscale[i] > rover->scale) + if (r2->seg->frontscale[i] > rover->sortscale) break; } if (i > x2) @@ -1833,10 +1917,10 @@ static void R_CreateDrawNodes(void) continue; scale = r2->thickseg->scale1 > r2->thickseg->scale2 ? r2->thickseg->scale1 : r2->thickseg->scale2; - if (scale <= rover->scale) + if (scale <= rover->sortscale) continue; scale = r2->thickseg->scale1 + (r2->thickseg->scalestep * (sintersect - r2->thickseg->x1)); - if (scale <= rover->scale) + if (scale <= rover->sortscale) continue; #ifdef ESLOPE @@ -1886,11 +1970,11 @@ static void R_CreateDrawNodes(void) continue; scale = r2->seg->scale1 > r2->seg->scale2 ? r2->seg->scale1 : r2->seg->scale2; - if (scale <= rover->scale) + if (scale <= rover->sortscale) continue; scale = r2->seg->scale1 + (r2->seg->scalestep * (sintersect - r2->seg->x1)); - if (rover->scale < scale) + if (rover->sortscale < scale) { entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; @@ -1906,8 +1990,8 @@ static void R_CreateDrawNodes(void) if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt) continue; - if (r2->sprite->scale > rover->scale - || (r2->sprite->scale == rover->scale && r2->sprite->dispoffset > rover->dispoffset)) + if (r2->sprite->sortscale > rover->sortscale + || (r2->sprite->sortscale == rover->sortscale && r2->sprite->dispoffset > rover->dispoffset)) { entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; @@ -2060,8 +2144,8 @@ void R_ClipSprites(void) scale = ds->scale2; } - if (scale < spr->scale || - (lowscale < spr->scale && + if (scale < spr->sortscale || + (lowscale < spr->sortscale && !R_PointOnSegSide (spr->gx, spr->gy, ds->curline))) { // masked mid texture? @@ -2112,7 +2196,7 @@ void R_ClipSprites(void) fixed_t mh, h; INT32 phs = viewplayer->mo->subsector->sector->heightsec; if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && - (h = centeryfrac - FixedMul(mh -= viewz, spr->scale)) >= 0 && + (h = centeryfrac - FixedMul(mh -= viewz, spr->sortscale)) >= 0 && (h >>= FRACBITS) < viewheight) { if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) @@ -2130,7 +2214,7 @@ void R_ClipSprites(void) } if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && - (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && + (h = centeryfrac - FixedMul(mh-viewz, spr->sortscale)) >= 0 && (h >>= FRACBITS) < viewheight) { if (phs != -1 && viewz >= sectors[phs].ceilingheight) diff --git a/src/r_things.h b/src/r_things.h index 483db7e9..9a4ba199 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -131,7 +131,8 @@ typedef struct vissprite_s fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors fixed_t startfrac; // horizontal position of x1 - fixed_t scale; + fixed_t scale, sortscale; // sortscale only differs from scale for flat sprites + fixed_t scalestep; // only for flat sprites, 0 otherwise fixed_t xiscale; // negative if flipped fixed_t texturemid; From e42885a23c971c4bc8e38b4a87c522fd424e55a3 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 22 Aug 2016 23:01:36 +0100 Subject: [PATCH 06/56] Forgot to do this. --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index a7f3fa41..0d85a463 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1203,7 +1203,7 @@ static void R_ProjectSprite(mobj_t *thing) else { // choose a different rotation based on player view - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + //ang = R_PointToAngle (thing->x, thing->y) - thing->angle; if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right rot = 6; // F7 slot From e8d65f0b5481643b77a35551cd24e8c0cb821759 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 22 Aug 2016 23:39:27 +0100 Subject: [PATCH 07/56] GCC 4.6 and lower fix --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 0d85a463..55866759 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1107,7 +1107,7 @@ static void R_ProjectSprite(mobj_t *thing) vissprite_t *vis; - angle_t ang; + angle_t ang = 0; // gcc 4.6 and lower fix fixed_t iscale; fixed_t scalestep; // toast '16 fixed_t offset, offset2; From 14ff3906e138aa459e73600e3be916b9d5b167b9 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 23 Aug 2016 00:45:26 +0100 Subject: [PATCH 08/56] Woops, forgot to port collision as well. --- src/p_map.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 1f2d903e..a95ed6b8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -469,6 +469,73 @@ static boolean PIT_CheckThing(mobj_t *thing) if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) return true; // didn't hit it + if (thing->flags & MF_PAPERCOLLISION) // CAUTION! Very easy to get stuck inside MF_SOLID objects. Giving the player MF_PAPERCOLLISION is a bad idea unless you know what you're doing. + { + fixed_t cosradius, sinradius; + vertex_t v1, v2; // fake vertexes + line_t junk; // fake linedef + cosradius = FixedMul(thing->radius, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)); + sinradius = FixedMul(thing->radius, FINESINE(thing->angle>>ANGLETOFINESHIFT)); + + v1.x = thing->x - cosradius; + v1.y = thing->y - sinradius; + v2.x = thing->x + cosradius; + v2.y = thing->y + sinradius; + + junk.v1 = &v1; + junk.v2 = &v2; + junk.dx = v2.x - v1.x; + junk.dy = v2.y - v1.y; + + if (tmthing->flags & MF_PAPERCOLLISION) // more strenuous checking to prevent clipping issues + { + INT32 check1, check2, check3, check4; + cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT)); + sinradius = FixedMul(tmthing->radius, FINESINE(tmthing->angle>>ANGLETOFINESHIFT)); + check1 = P_PointOnLineSide(tmx - cosradius, tmy - sinradius, &junk); + check2 = P_PointOnLineSide(tmx + cosradius, tmy + sinradius, &junk); + check3 = P_PointOnLineSide(tmx + tmthing->momx - cosradius, tmy + tmthing->momy - sinradius, &junk); + check4 = P_PointOnLineSide(tmx + tmthing->momx + cosradius, tmy + tmthing->momy + sinradius, &junk); + if ((check1 == check2) && (check2 == check3) && (check3 == check4)) + return true; // the line doesn't cross between collider's start or end + } + else + { + if ((P_PointOnLineSide(tmx - tmthing->radius, tmy - tmthing->radius, &junk) + == P_PointOnLineSide(tmx + tmthing->radius, tmy + tmthing->radius, &junk)) + && (P_PointOnLineSide(tmx + tmthing->radius, tmy - tmthing->radius, &junk) + == P_PointOnLineSide(tmx - tmthing->radius, tmy + tmthing->radius, &junk))) + return true; // the line doesn't cross between either pair of opposite corners + } + } + else if (tmthing->flags & MF_PAPERCOLLISION) + { + fixed_t cosradius, sinradius; + vertex_t v1, v2; // fake vertexes + line_t junk; // fake linedef + + cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT)); + sinradius = FixedMul(tmthing->radius, FINESINE(tmthing->angle>>ANGLETOFINESHIFT)); + + v1.x = tmx - cosradius; + v1.y = tmy - sinradius; + v2.x = tmx + cosradius; + v2.y = tmy + sinradius; + + junk.v1 = &v1; + junk.v2 = &v2; + junk.dx = v2.x - v1.x; + junk.dy = v2.y - v1.y; + + // no need to check whether thing has MF_PAPERCOLLISION, since checked above + + if ((P_PointOnLineSide(thing->x - thing->radius, thing->y - thing->radius, &junk) + == P_PointOnLineSide(thing->x + thing->radius, thing->y + thing->radius, &junk)) + && (P_PointOnLineSide(thing->x + thing->radius, thing->y - thing->radius, &junk) + == P_PointOnLineSide(thing->x - thing->radius, thing->y + thing->radius, &junk))) + return true; // the line doesn't cross between either pair of opposite corners + } + #ifdef HAVE_BLUA { UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type @@ -1123,6 +1190,17 @@ static boolean PIT_CheckLine(line_t *ld) if (P_BoxOnLineSide(tmbbox, ld) != -1) return true; +if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag. + { + fixed_t cosradius, sinradius; + cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT)); + sinradius = FixedMul(tmthing->radius, FINESINE(tmthing->angle>>ANGLETOFINESHIFT)); + if (P_PointOnLineSide(tmx - cosradius, tmy - sinradius, ld) + == P_PointOnLineSide(tmx + cosradius, tmy + sinradius, ld)) + return true; // the line doesn't cross between collider's start or end + + } + // A line has been hit // The moving thing's destination position will cross From a587231aa4f85dcade73fd5ccdb2dd8c5429c947 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 26 Aug 2016 22:00:53 +0100 Subject: [PATCH 09/56] Crash fix ported from internal. --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 55866759..8e41fb44 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -143,7 +143,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch if (sprtemp[frame].rotate == (SRF_3D|SRF_2D)) sprtemp[frame].rotate = SRF_2D; // SRF_3D|SRF_2D being enabled at the same time doesn't HURT in the current sprite angle implementation, but it DOES mean more to check in some of the helper functions. Let's not allow this scenario to happen. - for (r = 1; r < 4; r++) // Don't set for front/back frames + for (r = 0; r < 4; r++) // Thanks to R_PrecacheLevel, we can't leave sprtemp[*].lumppat[*] == LUMPERROR... so we load into the front/back angle too. { sprtemp[frame].lumppat[r + rightfactor] = lumppat; sprtemp[frame].lumpid[r + rightfactor] = lumpid; From 39d4f22660b6957e3e70a483bf7624edcbf90842 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:02:23 +0000 Subject: [PATCH 10/56] Flat sprites for OGL --- src/hardware/hw_glob.h | 1 + src/hardware/hw_main.c | 77 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 94eef1d3..5d1a81d4 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -78,6 +78,7 @@ typedef struct gr_vissprite_s //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing + float z1, z2; } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 70520af8..98ab6cab 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4223,6 +4223,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) GLPatch_t *gpatch; // sprite patch converted to hardware FSurfaceInfo Surf; const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES); + //const boolean papersprite = (spr->mobj && (spr->mobj->frame & FF_PAPERSPRITE)); if (spr->mobj) this_scale = FIXED_TO_FLOAT(spr->mobj->scale); if (hires) @@ -4266,7 +4267,28 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) // make a wall polygon (with 2 triangles), using the floor/ceiling heights, // and the 2d map coords of start/end vertices - wallVerts[0].z = wallVerts[1].z = wallVerts[2].z = wallVerts[3].z = spr->tz; + wallVerts[0].z = wallVerts[3].z = spr->z1; + wallVerts[2].z = wallVerts[1].z = spr->z2; + + // transform + wv = wallVerts; + + /*if (spr->mobj->frame & FF_PAPERSPRITE) + { + float mobjanglecos, mobjanglesin; + mobjanglesin = FIXED_TO_FLOAT(FINESINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); + mobjanglecos = FIXED_TO_FLOAT(FINECOSINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); + for (i = 0; i < 4; i++,wv++) + { + // x = (x * anglecos) + (z * anglesin) + // z = (x * anglesin) - (z * anglecos) + // instead of doing the z part we just add spr->tz afterwards because they are all the same + // value right now + tr_x = wv->x-spr->x2+(spr->x2-spr->x1)/2; + //wv->x = (tr_x * mobjanglecos) + (0) + (spr->x1+(spr->x2-spr->x1)/2); + wv->z = (tr_x * mobjanglesin) - (0) + (spr->tz); + } + }*/ // transform wv = wallVerts; @@ -5042,6 +5064,10 @@ static void HWR_ProjectSprite(mobj_t *thing) UINT8 flip; angle_t ang; INT32 heightsec, phs; + const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + float offset; + float ang_scale = 1.0f, ang_scalez = 0.0f; + float z1, z2; if (!thing) return; @@ -5056,7 +5082,7 @@ static void HWR_ProjectSprite(mobj_t *thing) tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); // thing is behind view plane? - if (tz < ZCLIP_PLANE && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear + if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear return; tx = (tr_x * gr_viewsin) - (tr_y * gr_viewcos); @@ -5094,6 +5120,16 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif + if (sprframe->rotate != SRF_SINGLE || papersprite) + { + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; + if (papersprite) + { + ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); + ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + } + } + if (sprframe->rotate == SRF_SINGLE) { // use single rotation for all views @@ -5104,8 +5140,6 @@ static void HWR_ProjectSprite(mobj_t *thing) else { // choose a different rotation based on player view - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if ((ang < ANGLE_180) && (sprframe->rotate & SRF_RIGHT)) // See from right rot = 6; // F7 slot else if ((ang >= ANGLE_180) && (sprframe->rotate & SRF_LEFT)) // See from left @@ -5123,9 +5157,20 @@ static void HWR_ProjectSprite(mobj_t *thing) // calculate edges of the shape if (flip) - tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale; else - tx -= FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; + + if (ang_scale < 0) + { + z1 = tz + offset * ang_scalez; + tx += offset * ang_scale; + } + else + { + z1 = tz - offset * ang_scalez; + tx -= offset * ang_scale; + } // project x x1 = gr_windowcenterx + (tx * gr_centerx / tz); @@ -5136,9 +5181,25 @@ static void HWR_ProjectSprite(mobj_t *thing) x1 = tx; - tx += FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; + offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; + if (ang_scale < 0) + { + z2 = z1 - offset * ang_scalez; + tx -= offset * ang_scale; + } + else + { + z2 = z1 + offset * ang_scalez; + tx += offset * ang_scale; + } + if (papersprite && max(z1, z1) < ZCLIP_PLANE) + return; + x2 = gr_windowcenterx + (tx * gr_centerx / tz); + + + if (thing->eflags & MFE_VERTICALFLIP) { gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale; @@ -5185,6 +5246,8 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; + vis->z1 = z1; + vis->z2 = z2; //Hurdler: 25/04/2000: now support colormap in hardware mode if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" From 4fb2a188465bc9ef5fc5450b55b3cdcc8b49215d Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:18:05 +0000 Subject: [PATCH 11/56] Fix a one character bug with clipping --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 98ab6cab..d0f67b87 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5192,7 +5192,7 @@ static void HWR_ProjectSprite(mobj_t *thing) z2 = z1 + offset * ang_scalez; tx += offset * ang_scale; } - if (papersprite && max(z1, z1) < ZCLIP_PLANE) + if (papersprite && max(z1, z2) < ZCLIP_PLANE) return; x2 = gr_windowcenterx + (tx * gr_centerx / tz); From 2e72539df24e16bc7e3d0007876c445a91dd1025 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 13 Dec 2016 21:22:40 +0000 Subject: [PATCH 12/56] Remove accidental leftovers Accidentally left a comment and stuff in there from previous attempts --- src/hardware/hw_main.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d0f67b87..d4255ba4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4273,26 +4273,6 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) // transform wv = wallVerts; - /*if (spr->mobj->frame & FF_PAPERSPRITE) - { - float mobjanglecos, mobjanglesin; - mobjanglesin = FIXED_TO_FLOAT(FINESINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); - mobjanglecos = FIXED_TO_FLOAT(FINECOSINE((spr->mobj->angle-dup_viewangle+ANGLE_90)>>ANGLETOFINESHIFT)); - for (i = 0; i < 4; i++,wv++) - { - // x = (x * anglecos) + (z * anglesin) - // z = (x * anglesin) - (z * anglecos) - // instead of doing the z part we just add spr->tz afterwards because they are all the same - // value right now - tr_x = wv->x-spr->x2+(spr->x2-spr->x1)/2; - //wv->x = (tr_x * mobjanglecos) + (0) + (spr->x1+(spr->x2-spr->x1)/2); - wv->z = (tr_x * mobjanglesin) - (0) + (spr->tz); - } - }*/ - - // transform - wv = wallVerts; - for (i = 0; i < 4; i++,wv++) { //look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -5197,9 +5177,6 @@ static void HWR_ProjectSprite(mobj_t *thing) x2 = gr_windowcenterx + (tx * gr_centerx / tz); - - - if (thing->eflags & MFE_VERTICALFLIP) { gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale; From d2d88a919b9aa29a16d11b125febe0c0de199a35 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 26 Jan 2017 12:47:47 +0000 Subject: [PATCH 13/56] * Allowing for changing skins on command line startup again. * Fixing an inconsistency with being able to change skin colours when you shouldn't be able to, much like the previous skin change issue that was fixed. --- src/d_netcmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f61c80cb..8f6c45b3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4102,7 +4102,8 @@ static void Skin_OnChange(void) if (!Playing()) return; // do whatever you want - if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player. + if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player. + && (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y { CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); return; @@ -4145,8 +4146,7 @@ static void Color_OnChange(void) if (!Playing()) return; // do whatever you want - if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player. - && (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CONTINUING)) + if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player. { CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name); return; From 659a62db887fb323fb5111330327e47b959a9e47 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 Feb 2017 18:47:20 +0000 Subject: [PATCH 14/56] Make sure rocks spawned by the rock spawners despawn when they're on the floor and not moving --- src/p_mobj.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index b9412ee7..5d4defb4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6648,6 +6648,17 @@ void P_MobjThinker(mobj_t *mobj) } else switch (mobj->type) { + case MT_FALLINGROCK: + // Despawn rocks here in case zmovement code can't do so (blame slopes) + if (!mobj->momx && !mobj->momy && !mobj->momz + && ((mobj->z <= mobj->floorz && !(mobj->eflags & MFE_VERTICALFLIP)) + || (mobj->z + mobj->height >= mobj->ceilingz && mobj->eflags & MFE_VERTICALFLIP))) + { + P_RemoveMobj(mobj); + return; + } + P_MobjCheckWater(mobj); + break; case MT_EMERALDSPAWN: if (mobj->threshold) { From 9a2b7b2091a462e4eeed1ad7f957738e628ff4b2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 Feb 2017 20:13:16 +0000 Subject: [PATCH 15/56] Better plan, use ?: for deciding between floorz/ceiling checks based on gravity --- src/p_mobj.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5d4defb4..fb864801 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6651,8 +6651,9 @@ void P_MobjThinker(mobj_t *mobj) case MT_FALLINGROCK: // Despawn rocks here in case zmovement code can't do so (blame slopes) if (!mobj->momx && !mobj->momy && !mobj->momz - && ((mobj->z <= mobj->floorz && !(mobj->eflags & MFE_VERTICALFLIP)) - || (mobj->z + mobj->height >= mobj->ceilingz && mobj->eflags & MFE_VERTICALFLIP))) + && ((mobj->eflags & MFE_VERTICALFLIP) ? + mobj->z + mobj->height >= mobj->ceilingz + : mobj->z <= mobj->floorz)) { P_RemoveMobj(mobj); return; From 8a421a05d9e9365d5bbfac54459794a497a2c4d5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 10 Feb 2017 20:31:58 +0000 Subject: [PATCH 16/56] admin bans with custom ban messages should now be recognised by the server properly --- 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 f47f6637..1b23ce95 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2696,7 +2696,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) // If a verified admin banned someone, the server needs to know about it. // If the playernum isn't zero (the server) then the server needs to record the ban. - if (server && playernum && msg == KICK_MSG_BANNED) + if (server && playernum && (msg == KICK_MSG_BANNED || msg == KICK_MSG_CUSTOM_BAN)) { if (I_Ban && !I_Ban(playernode[(INT32)pnum])) { From 84727f42058ee95126878fffe442b1a211df8ac5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 16 Feb 2017 21:55:17 +0000 Subject: [PATCH 17/56] Created W_OpenWadFile for opening WAD files with the path correction code. This is used by Command_Addfile in the MD5 calculation code, so that it can search subfolders properly and allow addfile in netgames to treat them the same way as in SP --- src/d_netcmd.c | 16 ++++----- src/w_wad.c | 88 +++++++++++++++++++++++++++----------------------- src/w_wad.h | 2 ++ 3 files changed, 56 insertions(+), 50 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f61c80cb..09f6795e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2967,6 +2967,7 @@ static void Command_Addfile(void) XBOXSTATIC char buf[256]; char *buf_p = buf; INT32 i; + int musiconly; // W_VerifyNMUSlumps isn't boolean if (COM_Argc() != 2) { @@ -2981,7 +2982,9 @@ static void Command_Addfile(void) if (!isprint(fn[i]) || fn[i] == ';') return; - if (!W_VerifyNMUSlumps(fn)) + musiconly = W_VerifyNMUSlumps(fn); + + if (!musiconly) { // ... But only so long as they contain nothing more then music and sprites. if (netgame && !(server || adminplayer == consoleplayer)) @@ -2993,7 +2996,7 @@ static void Command_Addfile(void) } // Add file on your client directly if it is trivial, or you aren't in a netgame. - if (!(netgame || multiplayer) || W_VerifyNMUSlumps(fn)) + if (!(netgame || multiplayer) || musiconly) { P_AddWadFile(fn, NULL); return; @@ -3013,9 +3016,7 @@ static void Command_Addfile(void) #else FILE *fhandle; - fhandle = fopen(fn, "rb"); - - if (fhandle) + if ((fhandle = W_OpenWadFile(&fn, true)) != NULL) { tic_t t = I_GetTime(); CONS_Debug(DBG_SETUP, "Making MD5 for %s\n",fn); @@ -3023,11 +3024,8 @@ static void Command_Addfile(void) CONS_Debug(DBG_SETUP, "MD5 calc for %s took %f second\n", fn, (float)(I_GetTime() - t)/TICRATE); fclose(fhandle); } - else - { - CONS_Printf(M_GetText("File %s not found.\n"), fn); + else // file not found return; - } #endif WRITEMEM(buf_p, md5sum, 16); } diff --git a/src/w_wad.c b/src/w_wad.c index e4cb9305..3a828559 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -133,6 +133,47 @@ void W_Shutdown(void) static char filenamebuf[MAX_WADPATH]; +// W_OpenWadFile +// Helper function for opening the WAD file. +// Returns the FILE * handle for the file, or NULL if not found or could not be opened +// If "useerrors" is true then print errors in the console, else just don't bother +// "filename" may be modified to have the correct path the actual file is located in, if necessary +FILE *W_OpenWadFile(const char **filename, boolean useerrors) +{ + FILE *handle; + + strncpy(filenamebuf, *filename, MAX_WADPATH); + filenamebuf[MAX_WADPATH - 1] = '\0'; + *filename = filenamebuf; + + // open wad file + if ((handle = fopen(*filename, "rb")) == NULL) + { + // If we failed to load the file with the path as specified by + // the user, strip the directories and search for the file. + nameonly(filenamebuf); + + // If findfile finds the file, the full path will be returned + // in filenamebuf == *filename. + if (findfile(filenamebuf, NULL, true)) + { + if ((handle = fopen(*filename, "rb")) == NULL) + { + if (useerrors) + CONS_Alert(CONS_ERROR, M_GetText("Can't open %s\n"), *filename); + return NULL; + } + } + else + { + if (useerrors) + CONS_Alert(CONS_ERROR, M_GetText("File %s not found.\n"), *filename); + return NULL; + } + } + return handle; +} + // search for all DEHACKED lump in all wads and load it static inline void W_LoadDehackedLumps(UINT16 wadnum) { @@ -234,7 +275,6 @@ static void W_InvalidateLumpnumCache(void) memset(lumpnumcache, 0, sizeof (lumpnumcache)); } - // Allocate a wadfile, setup the lumpinfo (directory) and // lumpcache, add the wadfile to the current active wadfiles // @@ -271,33 +311,9 @@ UINT16 W_LoadWadFile(const char *filename) return INT16_MAX; } - strncpy(filenamebuf, filename, MAX_WADPATH); - filenamebuf[MAX_WADPATH - 1] = '\0'; - filename = filenamebuf; - // open wad file - if ((handle = fopen(filename, "rb")) == NULL) - { - // If we failed to load the file with the path as specified by - // the user, strip the directories and search for the file. - nameonly(filenamebuf); - - // If findfile finds the file, the full path will be returned - // in filenamebuf == filename. - if (findfile(filenamebuf, NULL, true)) - { - if ((handle = fopen(filename, "rb")) == NULL) - { - CONS_Alert(CONS_ERROR, M_GetText("Can't open %s\n"), filename); - return INT16_MAX; - } - } - else - { - CONS_Alert(CONS_ERROR, M_GetText("File %s not found.\n"), filename); - return INT16_MAX; - } - } + if ((handle = W_OpenWadFile(&filename, true)) == NULL) + return INT16_MAX; // Check if wad files will overflow fileneededbuffer. Only the filename part // is send in the packet; cf. @@ -1115,21 +1131,11 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist, size_t i, j; int goodfile = false; - if (!checklist) I_Error("No checklist for %s\n", filename); - strlcpy(filenamebuf, filename, MAX_WADPATH); - filename = filenamebuf; + if (!checklist) + I_Error("No checklist for %s\n", filename); // open wad file - if ((handle = fopen(filename, "rb")) == NULL) - { - nameonly(filenamebuf); // leave full path here - if (findfile(filenamebuf, NULL, true)) - { - if ((handle = fopen(filename, "rb")) == NULL) - return -1; - } - else - return -1; - } + if ((handle = W_OpenWadFile(&filename, false)) == NULL) + return -1; // detect dehacked file with the "soc" extension if (stricmp(&filename[strlen(filename) - 4], ".soc") != 0 diff --git a/src/w_wad.h b/src/w_wad.h index b03e376b..f7ea64a5 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -82,6 +82,8 @@ extern wadfile_t *wadfiles[MAX_WADFILES]; void W_Shutdown(void); +// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened +FILE *W_OpenWadFile(const char **filename, boolean useerrors); // Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error UINT16 W_LoadWadFile(const char *filename); #ifdef DELFILE From 7424df8180e4f7e69a79200e244bea7c902eaf92 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 20 Feb 2017 19:58:29 +0000 Subject: [PATCH 18/56] Make sure I_Ban and Ban_Add are only used by the server Also make sure the server actually uses Ban_Add if an admin banned someone --- src/d_clisrv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1b23ce95..41c3ac34 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2531,7 +2531,7 @@ static void Command_Ban(void) return; else WRITEUINT8(p, pn); - if (I_Ban && !I_Ban(node)) + if (server && I_Ban && !I_Ban(node)) // only the server is allowed to do this right now { CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); WRITEUINT8(p, KICK_MSG_GO_AWAY); @@ -2539,7 +2539,8 @@ static void Command_Ban(void) } else { - Ban_Add(COM_Argv(2)); + if (server) // only the server is allowed to do this right now + Ban_Add(COM_Argv(2)); if (COM_Argc() == 2) { @@ -2699,9 +2700,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (server && playernum && (msg == KICK_MSG_BANNED || msg == KICK_MSG_CUSTOM_BAN)) { if (I_Ban && !I_Ban(playernode[(INT32)pnum])) - { CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); - } + else + Ban_Add(reason); } switch (msg) From 6efb15c6e8a9c48e2f0c739ecf166bf43558943a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 20 Feb 2017 21:36:05 +0000 Subject: [PATCH 19/56] Fix Ban_Add usage for NONET --- src/d_clisrv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 41c3ac34..939d53de 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2701,8 +2701,10 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) { if (I_Ban && !I_Ban(playernode[(INT32)pnum])) CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); +#ifndef NONET else Ban_Add(reason); +#endif } switch (msg) From b837d5b23d51b1674738106112e91dedbe9f6324 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 Mar 2017 14:25:46 +0000 Subject: [PATCH 20/56] Fix teamchange/teamchange2 to block changing FROM spectator rather than changing TO spectator This way they're consistent with Got_Teamchange, which is the cause of the "illegal team change" desyncs --- src/d_netcmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f61c80cb..2afadcc2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2116,7 +2116,7 @@ static void Command_Teamchange_f(void) return; } - if (!cv_allowteamchange.value && !NetPacket.packet.newteam) // allow swapping to spectator even in locked teams. + if (!cv_allowteamchange.value && NetPacket.packet.newteam) // allow swapping to spectator even in locked teams. { CONS_Alert(CONS_NOTICE, M_GetText("The server is not allowing team changes at the moment.\n")); return; @@ -2213,7 +2213,7 @@ static void Command_Teamchange2_f(void) return; } - if (!cv_allowteamchange.value && !NetPacket.packet.newteam) // allow swapping to spectator even in locked teams. + if (!cv_allowteamchange.value && NetPacket.packet.newteam) // allow swapping to spectator even in locked teams. { CONS_Alert(CONS_NOTICE, M_GetText("The server is not allowing team changes at the moment.\n")); return; From c43b41815fede02f64420aac4f65f11c98e170e5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 Mar 2017 14:28:52 +0000 Subject: [PATCH 21/56] Make "Enter Game" option use the big blue window notice if you cannot switch teams, instead of falling back on changeteam's own console notice --- src/m_menu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index d7b4d908..45b3d7e5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3849,6 +3849,7 @@ static void M_ChangeLevel(INT32 choice) static void M_ConfirmSpectate(INT32 choice) { (void)choice; + // We allow switching to spectator even if team changing is not allowed M_ClearMenus(true); COM_ImmedExecute("changeteam spectator"); } @@ -3856,6 +3857,11 @@ static void M_ConfirmSpectate(INT32 choice) static void M_ConfirmEnterGame(INT32 choice) { (void)choice; + if (!cv_allowteamchange.value) + { + M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\nPress a key.\n"), NULL, MM_NOTHING); + return; + } M_ClearMenus(true); COM_ImmedExecute("changeteam playing"); } From b0f4bbb44b0020810c88ec2130f47097662bf406 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 Mar 2017 19:37:21 +0000 Subject: [PATCH 22/56] Played TD's Stormy Streets enough to know precipitation sprites didn't get an overflow test of their own (various large invisible blocks used in the level cause rain to make splashes high above the main level, high enough to make ghostly rain splash sprite artifacts appear sometimes in nearby areas) --- src/r_things.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/r_things.c b/src/r_things.c index 927217c5..331febab 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -891,12 +891,18 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis) #endif fixed_t frac; patch_t *patch; + INT64 overflow_test; //Fab : R_InitSprites now sets a wad lump number patch = W_CacheLumpNum(vis->patch, PU_CACHE); if (!patch) return; + // Check for overflow + overflow_test = (INT64)centeryfrac - (((INT64)vis->texturemid*vis->scale)>>FRACBITS); + if (overflow_test < 0) overflow_test = -overflow_test; + if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // fixed point mult would overflow + if (vis->transmap) { colfunc = fuzzcolfunc; From 2823c7bffbbe4f17b5a291a41c285b2b756a46e8 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 17:23:56 -0400 Subject: [PATCH 23/56] build: fixup warnings from GCC 6.2.1 --- src/d_net.c | 2 ++ src/hardware/r_opengl/r_opengl.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/d_net.c b/src/d_net.c index fae1ea31..7f16c302 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -991,12 +991,14 @@ void Command_Droprate(void) packetdroprate = droprate; } +#ifndef NONET static boolean ShouldDropPacket(void) { return (packetdropquantity[netbuffer->packettype]) || (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100; } #endif +#endif // // HSendPacket diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 54dd9485..3a0bf705 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1836,7 +1836,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) } } -static inline void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color) +static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color) { INT32 val, count, pindex; GLfloat s, t; From b22417bcfab06739a4ed692cecc29652905baffe Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 17:26:37 -0400 Subject: [PATCH 24/56] appveyor: buildbot now using GCC 6.3, not 5.3 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 25b95d29..b0544a90 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ before_build: - upx -V - ccache -V - ccache -s -- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC53=1 CCACHE=1 +- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC63=1 CCACHE=1 build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean From e0b2a4a7791c846ec13927f0f680e36ebe058d21 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 17:45:18 -0400 Subject: [PATCH 25/56] build: add suport for GCC 6.3 --- src/Makefile.cfg | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 72404bec..d5cb112b 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,23 @@ # and other things # + +ifdef GCC63 +GCC62=1 +endif + +ifdef GCC62 +GCC61=1 +endif + +ifdef GCC61 +GCC54=1 +endif + +ifdef GCC54 +GCC53=1 +ENDIF + ifdef GCC53 GCC52=1 endif @@ -176,6 +193,9 @@ endif ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif +ifdef GCC62 + WFALGS+=-Wno-tautological-compare +endif WFLAGS+=$(OLDWFLAGS) From b01d5da60ffb20ee1efe4d82262129fd66707be4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 20:23:30 -0400 Subject: [PATCH 26/56] build: fixup GCC54 endif --- src/Makefile.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index d5cb112b..781076aa 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -22,7 +22,7 @@ endif ifdef GCC54 GCC53=1 -ENDIF +endif ifdef GCC53 GCC52=1 From 42ecca817d40f49404359ae402b359b42e98e1a9 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 20:43:35 -0400 Subject: [PATCH 27/56] build: disable tautological-compare and logical-op --- src/Makefile.cfg | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 781076aa..a891a755 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -193,8 +193,11 @@ endif ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif -ifdef GCC62 - WFALGS+=-Wno-tautological-compare +ifdef GCC54 + WFALGS+=-Wno-error=logical-op +endif +ifdef GCC61 + WFALGS+=-Wno-error=tautological-compare endif WFLAGS+=$(OLDWFLAGS) From 81fe46213d1b77cc296265a969f74cb26f5d9998 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 20:51:45 -0400 Subject: [PATCH 28/56] build: do not overwrite the -Wno-error switchs --- src/Makefile.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index a891a755..60d96575 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -187,6 +187,7 @@ endif ifdef ERRORMODE WFLAGS+=-Werror endif +WFLAGS+=$(OLDWFLAGS) ifdef GCC43 #WFLAGS+=-Wno-error=clobbered endif @@ -199,7 +200,6 @@ endif ifdef GCC61 WFALGS+=-Wno-error=tautological-compare endif -WFLAGS+=$(OLDWFLAGS) #indicate platform and what interface use with From 6bb7a636dc808bc4ca086ff448e7ef4ead510610 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 21:02:05 -0400 Subject: [PATCH 29/56] appveyor: output commands passed to GCCwq --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index b0544a90..269b7698 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,7 @@ before_build: build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean -- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k +- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k ECHO=1 after_build: - ccache -s From 9cac1e9e6226a26510b5b20c64f5bd353890fdac Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 21:09:06 -0400 Subject: [PATCH 30/56] build: fixup WFALGS/WFLAGS mistake --- src/Makefile.cfg | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 60d96575..e232c4a1 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -181,13 +181,17 @@ ifdef GCC45 WFLAGS+=-Wunsuffixed-float-constants endif endif + ifdef NOLDWARNING LDFLAGS+=-Wl,--as-needed endif + ifdef ERRORMODE WFLAGS+=-Werror endif + WFLAGS+=$(OLDWFLAGS) + ifdef GCC43 #WFLAGS+=-Wno-error=clobbered endif @@ -195,10 +199,10 @@ ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif ifdef GCC54 - WFALGS+=-Wno-error=logical-op + WFLAGS+=-Wno-error=logical-op endif ifdef GCC61 - WFALGS+=-Wno-error=tautological-compare + WFLAGS+=-Wno-error=tautological-compare endif From 4e8972cd24c291f22d5932415bcafe0d991294af Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 21:16:37 -0400 Subject: [PATCH 31/56] build: no warning or error about logical-ip or tautological-compare --- src/Makefile.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index e232c4a1..80d018c4 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -199,10 +199,10 @@ ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif ifdef GCC54 - WFLAGS+=-Wno-error=logical-op + WFLAGS+=-Wno-logical-op -Wno-error=logical-op endif ifdef GCC61 - WFLAGS+=-Wno-error=tautological-compare + WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare endif From 538eac7a471c61e13ffcbae81183de8e32c1d322 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 12 Mar 2017 21:17:07 -0400 Subject: [PATCH 32/56] appveyor: disable command output --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 269b7698..b0544a90 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,7 @@ before_build: build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean -- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k ECHO=1 +- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k after_build: - ccache -s From b29193aa98eaa2fe9abc8192162e731a0cac28e5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 23 Mar 2017 21:24:31 -0400 Subject: [PATCH 33/56] CircleCI: first try --- .circleci/config.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..8b954bc7 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,53 @@ +version: 2 +jobs: + build: + working_directory: /root/SRB2 + docker: + - image: debian:jessie + environment: + CC: ccache gcc -m32 + PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig + LIBGME_CFLAGS: -I/usr/include/ + LIBGME_LDFLAGS: -lgme + CCACHE_COMPRESS: true + steps: + - run: + name: Add i386 arch + command: dpkg --add-architecture i386 + #- restore_cache: + # keys: + # - v1-SRB2-APT + - run: + name: Update APT listing + command: apt-get -qq update + - run: + name: Install SDK + command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib ca-certificates + #- save_cache: + # key: v1-SRB2-APT + # paths: + # - /var/cache/apt/ + - checkout + #- restore_cache: + # keys: + # - v1-SRB2-{{ .Branch }} + - run: + name: Setup cache + command: mkdir -p /root/srb2_cache + #- run: + # name: Download SRB2 Resources + # command: wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O /root/srb2_cache/SRB2-v2115-assets-2.7z + - run: + name: Compile + command: make -C src LINUX=1 GCC49=1 WARNINGMODE=1 -k + - store_artifacts: + path: /root/SRB2/bin/Linux/Release/ + destination: bin + #- save_cache: + # key: v1-SRB2-{{ .Branch }} + # paths: + # - /root/.ccache + # - /root/srb2_cache + + + From 59d91e0793f61b7dbb93a4cb17db89a1b5892999 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 23 Mar 2017 23:13:31 -0400 Subject: [PATCH 34/56] build: r_bsp.c:213:23: warning: inlining failed in call to 'R_DoorClosed': call is unlikely and code size would grow [-Winline] --- src/r_bsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 2562cff6..44cb991a 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -210,7 +210,7 @@ void R_PortalClearClipSegs(INT32 start, INT32 end) // // It assumes that Doom has already ruled out a door being closed because // of front-back closure (e.g. front floor is taller than back ceiling). -static inline INT32 R_DoorClosed(void) +static INT32 R_DoorClosed(void) { return From c5d15ad5978ae3c99880789d92f4e1a06ac8f1f6 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 23 Mar 2017 23:15:01 -0400 Subject: [PATCH 35/56] CircleCI: force -Wno-unsuffixed-float-constants --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b954bc7..61c9ce50 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,7 @@ jobs: LIBGME_CFLAGS: -I/usr/include/ LIBGME_LDFLAGS: -lgme CCACHE_COMPRESS: true + WFLAGS: -Wno-unsuffixed-float-constants steps: - run: name: Add i386 arch From ade354c27d19fb7a561bc3538304a24c137cbabc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 23 Mar 2017 23:19:25 -0400 Subject: [PATCH 36/56] CircleCI: error on warnings --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61c9ce50..28846823 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,7 @@ jobs: # command: wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O /root/srb2_cache/SRB2-v2115-assets-2.7z - run: name: Compile - command: make -C src LINUX=1 GCC49=1 WARNINGMODE=1 -k + command: make -C src LINUX=1 GCC49=1 ERRORMODE=1 -k - store_artifacts: path: /root/SRB2/bin/Linux/Release/ destination: bin From aaaab40f6c35adfb284e4eff88520cdb944c2324 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 23 Mar 2017 23:42:28 -0400 Subject: [PATCH 37/56] CircleCI: cache APT and ccache --- .circleci/config.yml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 28846823..34b0faa7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,23 +15,26 @@ jobs: - run: name: Add i386 arch command: dpkg --add-architecture i386 - #- restore_cache: - # keys: - # - v1-SRB2-APT - run: name: Update APT listing command: apt-get -qq update + - run: + name: Support S3 upload + command: apt-get -qq -y install ca-certificates + - restore_cache: + keys: + - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib ca-certificates - #- save_cache: - # key: v1-SRB2-APT - # paths: - # - /var/cache/apt/ + command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib + - save_cache: + key: v1-SRB2-APT + paths: + - /var/cache/apt/archives - checkout - #- restore_cache: - # keys: - # - v1-SRB2-{{ .Branch }} + - restore_cache: + keys: + - v1-SRB2-{{ .Branch }} - run: name: Setup cache command: mkdir -p /root/srb2_cache @@ -44,11 +47,11 @@ jobs: - store_artifacts: path: /root/SRB2/bin/Linux/Release/ destination: bin - #- save_cache: - # key: v1-SRB2-{{ .Branch }} - # paths: - # - /root/.ccache - # - /root/srb2_cache + - save_cache: + key: v1-SRB2-{{ .Branch }} + paths: + - /root/.ccache + - /root/srb2_cache From c85c277a48dd6b1b98c3e89027e1a52587c8d2e3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 08:27:41 -0400 Subject: [PATCH 38/56] CircleCI: move GCC49 check to debian's env --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 34b0faa7..dff58840 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,10 +7,11 @@ jobs: environment: CC: ccache gcc -m32 PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig - LIBGME_CFLAGS: -I/usr/include/ + LIBGME_CFLAGS: -I/usr/include LIBGME_LDFLAGS: -lgme CCACHE_COMPRESS: true WFLAGS: -Wno-unsuffixed-float-constants + GCC49: true steps: - run: name: Add i386 arch @@ -43,7 +44,7 @@ jobs: # command: wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O /root/srb2_cache/SRB2-v2115-assets-2.7z - run: name: Compile - command: make -C src LINUX=1 GCC49=1 ERRORMODE=1 -k + command: make -C src LINUX=1 ERRORMODE=1 -k - store_artifacts: path: /root/SRB2/bin/Linux/Release/ destination: bin From 99b2c888212c3211e0bf0335e934f5228246ad9f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 08:28:31 -0400 Subject: [PATCH 39/56] README: add CircleCI's Status badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index eb06156b..d1607145 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2) [![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2) +[![CircleCI](https://circleci.com/gh/STJr/SRB2/tree/master.svg?style=svg)](https://circleci.com/gh/STJr/SRB2/tree/master) [Sonic Robo Blast 2](https://srb2.org/) is a 3D Sonic the Hedgehog fangame based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/). From ac75267ef2964c57b8956ecdbfffb96a1456c407 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 08:29:54 -0400 Subject: [PATCH 40/56] CircleCI: build on Ubuntu as well --- .circleci/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dff58840..6330d86c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,15 @@ jobs: CCACHE_COMPRESS: true WFLAGS: -Wno-unsuffixed-float-constants GCC49: true + - image: ubuntu:trusty + environment: + CC: ccache gcc -m32 + PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig + LIBGME_CFLAGS: -I/usr/include + LIBGME_LDFLAGS: -lgme + CCACHE_COMPRESS: true + WFLAGS: -Wno-unsuffixed-float-constants + GCC48: true steps: - run: name: Add i386 arch From 29c19b62ef16b9f8867f24bb1b306e8287a97a4c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 08:33:14 -0400 Subject: [PATCH 41/56] CircleCi: Ubuntu docker image is broken --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6330d86c..5efcaab4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,15 +12,15 @@ jobs: CCACHE_COMPRESS: true WFLAGS: -Wno-unsuffixed-float-constants GCC49: true - - image: ubuntu:trusty - environment: - CC: ccache gcc -m32 - PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig - LIBGME_CFLAGS: -I/usr/include - LIBGME_LDFLAGS: -lgme - CCACHE_COMPRESS: true - WFLAGS: -Wno-unsuffixed-float-constants - GCC48: true + #- image: ubuntu:trusty + # environment: + # CC: ccache gcc -m32 + # PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig + # LIBGME_CFLAGS: -I/usr/include + # LIBGME_LDFLAGS: -lgme + # CCACHE_COMPRESS: true + # WFLAGS: -Wno-unsuffixed-float-constants + # GCC48: true steps: - run: name: Add i386 arch From 03ecb0d1644e58fa306d56f6dc226cff979a3bdc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 09:10:18 -0400 Subject: [PATCH 42/56] CircleCI: add upx --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5efcaab4..18a95b8a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib + command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx - save_cache: key: v1-SRB2-APT paths: From 52a79754d344a419a8edb9aa719e8cda78258978 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 24 Mar 2017 09:12:00 -0400 Subject: [PATCH 43/56] CircleCI: keep build cache with checksum of depend.dep --- .circleci/config.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18a95b8a..b5c43d01 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,15 +42,12 @@ jobs: paths: - /var/cache/apt/archives - checkout + - run: + name: Clean build + command: make -C src LINUX=1 clean - restore_cache: keys: - - v1-SRB2-{{ .Branch }} - - run: - name: Setup cache - command: mkdir -p /root/srb2_cache - #- run: - # name: Download SRB2 Resources - # command: wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O /root/srb2_cache/SRB2-v2115-assets-2.7z + - v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }} - run: name: Compile command: make -C src LINUX=1 ERRORMODE=1 -k @@ -58,10 +55,9 @@ jobs: path: /root/SRB2/bin/Linux/Release/ destination: bin - save_cache: - key: v1-SRB2-{{ .Branch }} + key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }} paths: - /root/.ccache - - /root/srb2_cache From 48777e60ed8a13aaa397279b683979f9dd462a1f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 29 Mar 2017 21:27:44 +0100 Subject: [PATCH 44/56] check i not add, silly --- src/m_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_misc.c b/src/m_misc.c index cfe73d88..d88643ec 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -585,7 +585,7 @@ static const char *Newsnapshotfile(const char *pathname, const char *ext) i += add * result; - if (add < 0 || add > 9999) + if (i < 0 || i > 9999) return NULL; } From bf29b5c6d188dfe25e0d6c5b614b254d1502ca5b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 1 Apr 2017 20:16:48 +0100 Subject: [PATCH 45/56] Print warning message in console if line->next is NULL --- src/p_spec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 3d83561a..a699cbc2 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3039,7 +3039,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 443: // Calls a named Lua function #ifdef HAVE_BLUA - LUAh_LinedefExecute(line, mo, callsec); + if (line->text) + LUAh_LinedefExecute(line, mo, callsec); + else + CONS_Alert(CONS_WARNING, "Linedef %d is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", line-lines); #else CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!\n"); #endif From 4fa188cf01c6c9aceed293237d5532b6abe641d3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 1 Apr 2017 17:22:24 -0400 Subject: [PATCH 46/56] build: fix 64-bit builds --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index a699cbc2..48c0f58b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3042,7 +3042,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (line->text) LUAh_LinedefExecute(line, mo, callsec); else - CONS_Alert(CONS_WARNING, "Linedef %d is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", line-lines); + CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(line-lines)); #else CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!\n"); #endif From 5e4f960f3aa7ce9b095ad953a02720adbd800bb7 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 12 Apr 2017 15:34:13 -0700 Subject: [PATCH 47/56] fixed drawfill to be more consistent w/ other functions doesn't draw off of the sides, and doesn't ignore snapping or widths for reasons that don't make sense (for instance: the green bar in MI's test script showed *above* the blue one in non-green resolutions in 2.1.17) --- src/v_video.c | 103 +++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 1fb10fb5..eafd5c84 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -758,79 +758,80 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) { UINT8 *dest; const UINT8 *deststop; - INT32 u, v, dupx, dupy; + + if (rendermode == render_none) + return; #ifdef HWRENDER - if (rendermode != render_soft && rendermode != render_none) + if (rendermode != render_soft && !con_startup) { HWR_DrawFill(x, y, w, h, c); return; } #endif - dupx = vid.dupx; - dupy = vid.dupy; - - if (!screens[0]) - return; - - if (c & V_NOSCALESTART) - { - dest = screens[0] + y*vid.width + x; - deststop = screens[0] + vid.rowbytes * vid.height; - } - else + if (!(c & V_NOSCALESTART)) { + INT32 dupx = vid.dupx, dupy = vid.dupy; + if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT) { // Clear the entire screen, from dest to deststop. Yes, this really works. memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp); return; } - dest = screens[0] + y*dupy*vid.width + x*dupx; - deststop = screens[0] + vid.rowbytes * vid.height; + x *= dupx; + y *= dupy; + w *= dupx; + h *= dupy; - if (w == BASEVIDWIDTH) - w = vid.width; - else - w *= dupx; - if (h == BASEVIDHEIGHT) - h = vid.height; - else - h *= dupy; - - if (x && y && x + w < vid.width && y + h < vid.height) + // Center it if necessary + if (vid.width != BASEVIDWIDTH * dupx) { - // Center it if necessary - if (vid.width != BASEVIDWIDTH * dupx) - { - // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, - // so center this imaginary screen - if (c & V_SNAPTORIGHT) - dest += (vid.width - (BASEVIDWIDTH * dupx)); - else if (!(c & V_SNAPTOLEFT)) - dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2; - } - if (vid.height != BASEVIDHEIGHT * dupy) - { - // same thing here - if (c & V_SNAPTOBOTTOM) - dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width; - else if (!(c & V_SNAPTOTOP)) - dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2; - } + // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, + // so center this imaginary screen + if (c & V_SNAPTORIGHT) + x += (vid.width - (BASEVIDWIDTH * dupx)); + else if (!(c & V_SNAPTOLEFT)) + x += (vid.width - (BASEVIDWIDTH * dupx)) / 2; + } + if (vid.height != BASEVIDHEIGHT * dupy) + { + // same thing here + if (c & V_SNAPTOBOTTOM) + y += (vid.height - (BASEVIDHEIGHT * dupy)); + else if (!(c & V_SNAPTOTOP)) + y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2; } } + if (x >= vid.width || y >= vid.height) + return; // off the screen + if (x < 0) + { + w += x; + x = 0; + } + if (y < 0) + { + h += y; + y = 0; + } + + if (w <= 0 || h <= 0) + return; // zero width/height wouldn't draw anything + if (x + w > vid.width) + w = vid.width - x; + if (y + h > vid.height) + h = vid.height - y; + + dest = screens[0] + y*vid.width + x; + deststop = screens[0] + vid.rowbytes * vid.height; + c &= 255; - for (v = 0; v < h; v++, dest += vid.width) - for (u = 0; u < w; u++) - { - if (dest > deststop) - return; - dest[u] = (UINT8)c; - } + for (;(--h >= 0) && dest <= deststop; dest += vid.width) + memset(dest, (UINT8)(c&255), w * vid.bpp); } // From 7f7c7c58ab0f365d9923c1929ae5d1e3e8aced9d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Apr 2017 17:41:50 +0100 Subject: [PATCH 48/56] Use less-than, not less-than-or-equals, since deststop is off-screen --- src/v_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index eafd5c84..64bb3214 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -830,7 +830,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) c &= 255; - for (;(--h >= 0) && dest <= deststop; dest += vid.width) + for (;(--h >= 0) && dest < deststop; dest += vid.width) memset(dest, (UINT8)(c&255), w * vid.bpp); } From 19ca1698d8ac9cd1503d5d735ccdd22f155d2265 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 30 Apr 2017 20:33:36 +0100 Subject: [PATCH 49/56] Combine all /objs/*/.gitignore files into /objs/.gitignore, make sure depend.ped is also ignored --- objs/.gitignore | 8 ++++++++ objs/DC/SDL/Debug/.gitignore | 1 - objs/DC/SDL/Release/.gitignore | 1 - objs/Linux/SDL/Debug/.gitignore | 2 -- objs/Linux/SDL/Release/.gitignore | 2 -- objs/Linux64/SDL/Debug/.gitignore | 2 -- objs/Linux64/SDL/Release/.gitignore | 2 -- objs/Mingw/Debug/.gitignore | 3 --- objs/Mingw/Release/.gitignore | 3 --- objs/Mingw/SDL/Debug/.gitignore | 3 --- objs/Mingw/SDL/Release/.gitignore | 3 --- objs/Mingw64/Debug/.gitignore | 3 --- objs/Mingw64/Release/.gitignore | 3 --- objs/Mingw64/SDL/Debug/.gitignore | 3 --- objs/Mingw64/SDL/Release/.gitignore | 3 --- objs/PS3/SDL/Debug/.gitignore | 2 -- objs/PS3/SDL/Release/.gitignore | 2 -- objs/PSP/SDL/Release/.gitignore | 1 - objs/SDL/Release/.gitignore | 1 - objs/VC/.gitignore | 0 objs/VC9/.gitignore | 2 -- objs/Wii/SDL/Debug/.gitignore | 2 -- objs/Wii/SDL/Release/.gitignore | 2 -- objs/WinCE/SDL/Release/.gitignore | 1 - objs/djgppdos/Debug/.gitignore | 1 - objs/djgppdos/Release/.gitignore | 1 - objs/nds/Debug/.gitignore | 2 -- objs/nds/Release/.gitignore | 2 -- 28 files changed, 8 insertions(+), 53 deletions(-) create mode 100644 objs/.gitignore delete mode 100644 objs/DC/SDL/Debug/.gitignore delete mode 100644 objs/DC/SDL/Release/.gitignore delete mode 100644 objs/Linux/SDL/Debug/.gitignore delete mode 100644 objs/Linux/SDL/Release/.gitignore delete mode 100644 objs/Linux64/SDL/Debug/.gitignore delete mode 100644 objs/Linux64/SDL/Release/.gitignore delete mode 100644 objs/Mingw/Debug/.gitignore delete mode 100644 objs/Mingw/Release/.gitignore delete mode 100644 objs/Mingw/SDL/Debug/.gitignore delete mode 100644 objs/Mingw/SDL/Release/.gitignore delete mode 100644 objs/Mingw64/Debug/.gitignore delete mode 100644 objs/Mingw64/Release/.gitignore delete mode 100644 objs/Mingw64/SDL/Debug/.gitignore delete mode 100644 objs/Mingw64/SDL/Release/.gitignore delete mode 100644 objs/PS3/SDL/Debug/.gitignore delete mode 100644 objs/PS3/SDL/Release/.gitignore delete mode 100644 objs/PSP/SDL/Release/.gitignore delete mode 100644 objs/SDL/Release/.gitignore delete mode 100644 objs/VC/.gitignore delete mode 100644 objs/VC9/.gitignore delete mode 100644 objs/Wii/SDL/Debug/.gitignore delete mode 100644 objs/Wii/SDL/Release/.gitignore delete mode 100644 objs/WinCE/SDL/Release/.gitignore delete mode 100644 objs/djgppdos/Debug/.gitignore delete mode 100644 objs/djgppdos/Release/.gitignore delete mode 100644 objs/nds/Debug/.gitignore delete mode 100644 objs/nds/Release/.gitignore diff --git a/objs/.gitignore b/objs/.gitignore new file mode 100644 index 00000000..35ecd6de --- /dev/null +++ b/objs/.gitignore @@ -0,0 +1,8 @@ +#All folders +SRB2.res +depend.dep +depend.ped +*.o +#VC9 folder only +/VC9/Win32 +/VC9/x64 diff --git a/objs/DC/SDL/Debug/.gitignore b/objs/DC/SDL/Debug/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/DC/SDL/Debug/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/DC/SDL/Release/.gitignore b/objs/DC/SDL/Release/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/DC/SDL/Release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/Linux/SDL/Debug/.gitignore b/objs/Linux/SDL/Debug/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Linux/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/Linux/SDL/Release/.gitignore b/objs/Linux/SDL/Release/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Linux/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/Linux64/SDL/Debug/.gitignore b/objs/Linux64/SDL/Debug/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Linux64/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/Linux64/SDL/Release/.gitignore b/objs/Linux64/SDL/Release/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Linux64/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/Mingw/Debug/.gitignore b/objs/Mingw/Debug/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw/Release/.gitignore b/objs/Mingw/Release/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw/SDL/Debug/.gitignore b/objs/Mingw/SDL/Debug/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw/SDL/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw/SDL/Release/.gitignore b/objs/Mingw/SDL/Release/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw/SDL/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw64/Debug/.gitignore b/objs/Mingw64/Debug/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw64/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw64/Release/.gitignore b/objs/Mingw64/Release/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw64/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw64/SDL/Debug/.gitignore b/objs/Mingw64/SDL/Debug/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw64/SDL/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/Mingw64/SDL/Release/.gitignore b/objs/Mingw64/SDL/Release/.gitignore deleted file mode 100644 index da4b3e91..00000000 --- a/objs/Mingw64/SDL/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/SRB2.res -/depend.dep -/*.o diff --git a/objs/PS3/SDL/Debug/.gitignore b/objs/PS3/SDL/Debug/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/PS3/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/PS3/SDL/Release/.gitignore b/objs/PS3/SDL/Release/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/PS3/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/PSP/SDL/Release/.gitignore b/objs/PSP/SDL/Release/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/PSP/SDL/Release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/SDL/Release/.gitignore b/objs/SDL/Release/.gitignore deleted file mode 100644 index 4a262f94..00000000 --- a/objs/SDL/Release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.ped diff --git a/objs/VC/.gitignore b/objs/VC/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/objs/VC9/.gitignore b/objs/VC9/.gitignore deleted file mode 100644 index 205fe45d..00000000 --- a/objs/VC9/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Win32 -/x64 diff --git a/objs/Wii/SDL/Debug/.gitignore b/objs/Wii/SDL/Debug/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Wii/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/Wii/SDL/Release/.gitignore b/objs/Wii/SDL/Release/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/Wii/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/WinCE/SDL/Release/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/WinCE/SDL/Release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/djgppdos/Debug/.gitignore b/objs/djgppdos/Debug/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/djgppdos/Debug/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/djgppdos/Release/.gitignore b/objs/djgppdos/Release/.gitignore deleted file mode 100644 index 867fcb4e..00000000 --- a/objs/djgppdos/Release/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/depend.dep diff --git a/objs/nds/Debug/.gitignore b/objs/nds/Debug/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/nds/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o diff --git a/objs/nds/Release/.gitignore b/objs/nds/Release/.gitignore deleted file mode 100644 index 8f6d0bdc..00000000 --- a/objs/nds/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/depend.dep -/*.o From d7a216e1927784112142a220ea812976c6b75136 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 30 Apr 2017 20:42:24 +0100 Subject: [PATCH 50/56] Ignore all *.exe files and *.mo files (such as en.mo) in all bin/Mingw folders --- bin/Mingw/Debug/.gitignore | 6 +++--- bin/Mingw/Release/.gitignore | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/Mingw/Debug/.gitignore b/bin/Mingw/Debug/.gitignore index e431dca5..834f313e 100644 --- a/bin/Mingw/Debug/.gitignore +++ b/bin/Mingw/Debug/.gitignore @@ -1,3 +1,3 @@ -/srb2sdl.exe -/srb2win.exe -/r_opengl.dll +*.exe +*.mo +r_opengl.dll diff --git a/bin/Mingw/Release/.gitignore b/bin/Mingw/Release/.gitignore index e431dca5..834f313e 100644 --- a/bin/Mingw/Release/.gitignore +++ b/bin/Mingw/Release/.gitignore @@ -1,3 +1,3 @@ -/srb2sdl.exe -/srb2win.exe -/r_opengl.dll +*.exe +*.mo +r_opengl.dll From 41130465b4e3f77aab4f88bbf1ee88b923eda2d6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 7 May 2017 22:21:17 +0100 Subject: [PATCH 51/56] Use NF instead of normal P_SetMobjState to prevent endless looping --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index a8a6bb6b..649c7883 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -1102,7 +1102,7 @@ void A_JetJawChomp(mobj_t *actor) if (!actor->target || !(actor->target->flags & MF_SHOOTABLE) || actor->target->health <= 0 || !P_CheckSight(actor, actor->target)) { - P_SetMobjState(actor, actor->info->spawnstate); + P_SetMobjStateNF(actor, actor->info->spawnstate); return; } From 1745966aa62876f2951914f0e034324898fd7f19 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 8 May 2017 15:54:17 +0100 Subject: [PATCH 52/56] Re-add all the folders present in objs before my .gitignore changes, by adding .gitignore files again to keep them from disappearing --- objs/DC/SDL/Debug/.gitignore | 2 ++ objs/DC/SDL/Release/.gitignore | 2 ++ objs/Linux/SDL/Debug/.gitignore | 2 ++ objs/Linux/SDL/Release/.gitignore | 2 ++ objs/Linux64/SDL/Debug/.gitignore | 2 ++ objs/Linux64/SDL/Release/.gitignore | 2 ++ objs/Mingw/Debug/.gitignore | 2 ++ objs/Mingw/Release/.gitignore | 2 ++ objs/Mingw/SDL/Debug/.gitignore | 2 ++ objs/Mingw/SDL/Release/.gitignore | 2 ++ objs/Mingw64/Debug/.gitignore | 2 ++ objs/Mingw64/Release/.gitignore | 2 ++ objs/Mingw64/SDL/Debug/.gitignore | 2 ++ objs/Mingw64/SDL/Release/.gitignore | 2 ++ objs/PS3/SDL/Debug/.gitignore | 2 ++ objs/PS3/SDL/Release/.gitignore | 2 ++ objs/PSP/SDL/Release/.gitignore | 2 ++ objs/SDL/Release/.gitignore | 2 ++ objs/VC/.gitignore | 2 ++ objs/VC9/.gitignore | 2 ++ objs/Wii/SDL/Debug/.gitignore | 2 ++ objs/Wii/SDL/Release/.gitignore | 2 ++ objs/WinCE/SDL/Release/.gitignore | 2 ++ objs/djgppdos/Debug/.gitignore | 2 ++ objs/djgppdos/Release/.gitignore | 2 ++ objs/nds/Debug/.gitignore | 2 ++ objs/nds/Release/.gitignore | 2 ++ 27 files changed, 54 insertions(+) create mode 100644 objs/DC/SDL/Debug/.gitignore create mode 100644 objs/DC/SDL/Release/.gitignore create mode 100644 objs/Linux/SDL/Debug/.gitignore create mode 100644 objs/Linux/SDL/Release/.gitignore create mode 100644 objs/Linux64/SDL/Debug/.gitignore create mode 100644 objs/Linux64/SDL/Release/.gitignore create mode 100644 objs/Mingw/Debug/.gitignore create mode 100644 objs/Mingw/Release/.gitignore create mode 100644 objs/Mingw/SDL/Debug/.gitignore create mode 100644 objs/Mingw/SDL/Release/.gitignore create mode 100644 objs/Mingw64/Debug/.gitignore create mode 100644 objs/Mingw64/Release/.gitignore create mode 100644 objs/Mingw64/SDL/Debug/.gitignore create mode 100644 objs/Mingw64/SDL/Release/.gitignore create mode 100644 objs/PS3/SDL/Debug/.gitignore create mode 100644 objs/PS3/SDL/Release/.gitignore create mode 100644 objs/PSP/SDL/Release/.gitignore create mode 100644 objs/SDL/Release/.gitignore create mode 100644 objs/VC/.gitignore create mode 100644 objs/VC9/.gitignore create mode 100644 objs/Wii/SDL/Debug/.gitignore create mode 100644 objs/Wii/SDL/Release/.gitignore create mode 100644 objs/WinCE/SDL/Release/.gitignore create mode 100644 objs/djgppdos/Debug/.gitignore create mode 100644 objs/djgppdos/Release/.gitignore create mode 100644 objs/nds/Debug/.gitignore create mode 100644 objs/nds/Release/.gitignore diff --git a/objs/DC/SDL/Debug/.gitignore b/objs/DC/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/DC/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/DC/SDL/Release/.gitignore b/objs/DC/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/DC/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux/SDL/Debug/.gitignore b/objs/Linux/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Linux/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux/SDL/Release/.gitignore b/objs/Linux/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Linux/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux64/SDL/Debug/.gitignore b/objs/Linux64/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Linux64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Linux64/SDL/Release/.gitignore b/objs/Linux64/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Linux64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/Debug/.gitignore b/objs/Mingw/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/Release/.gitignore b/objs/Mingw/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/SDL/Debug/.gitignore b/objs/Mingw/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw/SDL/Release/.gitignore b/objs/Mingw/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/Debug/.gitignore b/objs/Mingw64/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw64/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/Release/.gitignore b/objs/Mingw64/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw64/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/SDL/Debug/.gitignore b/objs/Mingw64/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Mingw64/SDL/Release/.gitignore b/objs/Mingw64/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Mingw64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Debug/.gitignore b/objs/PS3/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/PS3/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Release/.gitignore b/objs/PS3/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/PS3/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/PSP/SDL/Release/.gitignore b/objs/PSP/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/PSP/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/SDL/Release/.gitignore b/objs/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/VC/.gitignore b/objs/VC/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/VC/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/VC9/.gitignore b/objs/VC9/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/VC9/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Debug/.gitignore b/objs/Wii/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Wii/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Release/.gitignore b/objs/Wii/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/Wii/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/WinCE/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/WinCE/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/djgppdos/Debug/.gitignore b/objs/djgppdos/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/djgppdos/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/djgppdos/Release/.gitignore b/objs/djgppdos/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/djgppdos/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/nds/Debug/.gitignore b/objs/nds/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/nds/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/nds/Release/.gitignore b/objs/nds/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/nds/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing From 8582406dd2f27d7e9e7c810cca15993b09a41f36 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 9 May 2017 19:57:21 +0100 Subject: [PATCH 53/56] prevent invalid nodes from crashing Net_CloseConnection, print a warning and return instead --- src/d_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_net.c b/src/d_net.c index 7f16c302..98fe71ab 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -716,6 +716,12 @@ void Net_CloseConnection(INT32 node) if (!node) return; + if (node >= MAXNETNODES) // prevent invalid nodes from crashing the game + { + CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); + return; + } + nodes[node].flags |= NF_CLOSE; // try to Send ack back (two army problem) From 96c63bf95b66061d84e8b71ed1679a8180a3c477 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 9 May 2017 20:02:42 +0100 Subject: [PATCH 54/56] Whoops forgot this bit too --- src/d_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_net.c b/src/d_net.c index 98fe71ab..70cdc5f1 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -716,7 +716,7 @@ void Net_CloseConnection(INT32 node) if (!node) return; - if (node >= MAXNETNODES) // prevent invalid nodes from crashing the game + if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game { CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); return; From b8ffeeb59f4a7022b6ebbb8e2762deb21f5df6e2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 12 May 2017 16:06:27 +0100 Subject: [PATCH 55/56] Update version number to v2.1.18 Don't worry, I remembered to update MODVERSION as well this time :) --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- src/doomdef.h | 8 ++++---- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31597f39..23b768a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) project(SRB2 - VERSION 2.1.17 + VERSION 2.1.18 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index b0544a90..76e1261f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.17.{branch}-{build} +version: 2.1.18.{branch}-{build} os: MinGW environment: diff --git a/src/doomdef.h b/src/doomdef.h index 99e54c07..428972cc 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,9 +150,9 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 201 // Game version -#define SUBVERSION 17 // more precise version number -#define VERSIONSTRING "v2.1.17" -#define VERSIONSTRINGW L"v2.1.17" +#define SUBVERSION 18 // more precise version number +#define VERSIONSTRING "v2.1.18" +#define VERSIONSTRINGW L"v2.1.18" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -214,7 +214,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 22 +#define MODVERSION 23 // ========================================================================= diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 32ae88c0..fbf9bacb 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.17; + CURRENT_PROJECT_VERSION = 2.1.18; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.17; + CURRENT_PROJECT_VERSION = 2.1.18; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 13e78f31..98a760c7 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.17; + CURRENT_PROJECT_VERSION = 2.1.18; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.17; + CURRENT_PROJECT_VERSION = 2.1.18; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( From 8290ae9fd4c9d86bee6de503dd5158a34fc389c4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 13 May 2017 12:49:30 +0100 Subject: [PATCH 56/56] Fix paper sprites apparently "turning" around sometimes when you turn the camera, when they're supposed to be still (sawb.wad for instance) I cleaned up some of Sryder's changes a little too I guess --- src/hardware/hw_main.c | 47 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 386e997d..a40a2827 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5122,15 +5122,26 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate != SRF_SINGLE || papersprite) + if (papersprite) { - ang = R_PointToAngle (thing->x, thing->y) - thing->angle; - if (papersprite) + // Use the actual view angle, rather than the angle formed + // between the view point and the thing + // this makes sure paper sprites always appear at the right angle! + // Note: DO NOT do this in software mode version, it actually + // makes papersprites look WORSE there (I know, I've tried) + // Monster Iestyn - 13/05/17 + ang = dup_viewangle - thing->angle; + ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); + ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + + if (ang_scale < 0) { - ang_scale = FIXED_TO_FLOAT(FINESINE(ang>>ANGLETOFINESHIFT)); - ang_scalez = FIXED_TO_FLOAT(FINECOSINE(ang>>ANGLETOFINESHIFT)); + ang_scale = -ang_scale; + ang_scalez = -ang_scalez; } } + else if (sprframe->rotate != SRF_SINGLE) + ang = R_PointToAngle (thing->x, thing->y) - thing->angle; if (sprframe->rotate == SRF_SINGLE) { @@ -5163,16 +5174,8 @@ static void HWR_ProjectSprite(mobj_t *thing) else offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].offset) * this_scale; - if (ang_scale < 0) - { - z1 = tz + offset * ang_scalez; - tx += offset * ang_scale; - } - else - { - z1 = tz - offset * ang_scalez; - tx -= offset * ang_scale; - } + z1 = tz - (offset * ang_scalez); + tx -= offset * ang_scale; // project x x1 = gr_windowcenterx + (tx * gr_centerx / tz); @@ -5184,16 +5187,10 @@ static void HWR_ProjectSprite(mobj_t *thing) x1 = tx; offset = FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale; - if (ang_scale < 0) - { - z2 = z1 - offset * ang_scalez; - tx -= offset * ang_scale; - } - else - { - z2 = z1 + offset * ang_scalez; - tx += offset * ang_scale; - } + + z2 = z1 + (offset * ang_scalez); + tx += offset * ang_scale; + if (papersprite && max(z1, z2) < ZCLIP_PLANE) return;