From c7d0d7b1c25614230f9790d6768cc900a7f75b6e Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 01:36:53 -0300 Subject: [PATCH 01/23] Flats as walls textures support, WIP, doesn't support animations yet --- src/doomdef.h | 4 ++ src/p_spec.c | 2 +- src/r_data.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++-- src/r_data.h | 12 ++++ 4 files changed, 166 insertions(+), 5 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 676c86e0d..1f28f7a80 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -620,8 +620,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// SRB2CB itself ported this from PrBoom+ #define NEWCLIP +/// PNG support #ifndef HAVE_PNG #define NO_PNG_LUMPS #endif +/// Render flats on walls +#define WALLFLATS + #endif // __DOOMDEF__ diff --git a/src/p_spec.c b/src/p_spec.c index 7fcdfd1e3..9ab50d947 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -464,7 +464,7 @@ static inline void P_FindAnimatedFlat(INT32 animnum) for (i = 0; i < numlevelflats; i++, foundflats++) { // is that levelflat from the flat anim sequence ? - if ((anims[animnum].istexture) && (foundflats->u.texture.num != 0 && foundflats->u.texture.num != -1) + if ((anims[animnum].istexture) && (foundflats->type == LEVELFLAT_TEXTURE) && ((UINT16)foundflats->u.texture.num >= startflatnum && (UINT16)foundflats->u.texture.num <= endflatnum)) { foundflats->u.texture.basenum = startflatnum; diff --git a/src/r_data.c b/src/r_data.c index fa5e5c43b..ac98aae77 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -456,6 +456,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture_t *texture; texpatch_t *patch; patch_t *realpatch; + UINT8 *pdata; int x, x1, x2, i, width, height; size_t blocksize; column_t *patchcol; @@ -483,14 +484,17 @@ static UINT8 *R_GenerateTexture(size_t texnum) wadnum = patch->wad; lumpnum = patch->lump; lumplength = W_LumpLengthPwad(wadnum, lumpnum); - realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); // can't use W_CachePatchNumPwad because OpenGL + pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); + realpatch = (patch_t *)pdata; #ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) - { - realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false); goto multipatch; - } +#endif + +#ifdef WALLFLATS + if (texture->type == TEXTURETYPE_FLAT) + goto multipatch; #endif // Check the patch for holes. @@ -582,6 +586,11 @@ static UINT8 *R_GenerateTexture(size_t texnum) #ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false); + else +#endif +#ifdef WALLFLATS + if (texture->type == TEXTURETYPE_FLAT) + realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false); #endif x1 = patch->originx; @@ -773,6 +782,39 @@ void R_LoadTextures(void) { numtextures += (UINT32)(texend - texstart); } + +#ifdef WALLFLATS + // Count flats + if (wadfiles[w]->type == RET_PK3) + { + texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0); + texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart); + } + else + { + texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0); + texend = W_CheckNumForNamePwad("F_END", (UINT16)w, 0); + } + + if (texstart == INT16_MAX || texend == INT16_MAX) + continue; + + texstart++; // Do not count the first marker + + // PK3s have subfolders, so we can't just make a simple sum + if (wadfiles[w]->type == RET_PK3) + { + for (j = texstart; j < texend; j++) + { + if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it + numtextures++; + } + } + else // Add all the textures between F_START and F_END + { + numtextures += (UINT32)(texend - texstart); + } +#endif } // If no textures found by this point, bomb out @@ -866,6 +908,8 @@ void R_LoadTextures(void) texture->width = SHORT(patchlump->width); texture->height = SHORT(patchlump->height); } + + texture->type = TEXTURETYPE_SINGLEPATCH; texture->patchcount = 1; texture->holes = false; texture->flip = 0; @@ -884,6 +928,106 @@ void R_LoadTextures(void) textureheight[i] = texture->height << FRACBITS; i++; } + +#ifdef WALLFLATS + // Yes + if (wadfiles[w]->type == RET_PK3) + { + texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0); + texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart); + } + else + { + texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0); + texend = W_CheckNumForNamePwad("F_END", (UINT16)w, 0); + } + + if (texstart == INT16_MAX || texend == INT16_MAX) + continue; + + texstart++; // Do not count the first marker + + // Work through each lump between the markers in the WAD. + for (j = 0; j < (texend - texstart); j++) + { + UINT8 *flatlump; + UINT16 wadnum = (UINT16)w; + lumpnum_t lumpnum = texstart + j; + size_t lumplength; + size_t flatsize = 0; + + if (wadfiles[w]->type == RET_PK3) + { + if (W_IsLumpFolder(wadnum, lumpnum)) // Check if lump is a folder + continue; // If it is then SKIP IT + } + + flatlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); + lumplength = W_LumpLengthPwad(wadnum, lumpnum); + + switch (lumplength) + { + case 4194304: // 2048x2048 lump + flatsize = 2048; + break; + case 1048576: // 1024x1024 lump + flatsize = 1024; + break; + case 262144:// 512x512 lump + flatsize = 512; + break; + case 65536: // 256x256 lump + flatsize = 256; + break; + case 16384: // 128x128 lump + flatsize = 128; + break; + case 1024: // 32x32 lump + flatsize = 32; + break; + default: // 64x64 lump + flatsize = 64; + break; + } + + //CONS_Printf("\n\"%s\" is a flat, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),flatsize,flatsize); + texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); + + // Set texture properties. + M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); + +#ifndef NO_PNG_LUMPS + if (R_IsLumpPNG((UINT8 *)flatlump, lumplength)) + { + INT16 width, height; + R_PNGDimensions((UINT8 *)flatlump, &width, &height, lumplength); + texture->width = width; + texture->height = height; + } + else +#endif + texture->width = texture->height = flatsize; + + texture->type = TEXTURETYPE_FLAT; + texture->patchcount = 1; + texture->holes = false; + texture->flip = 0; + + // Allocate information for the texture's patches. + patch = &texture->patches[0]; + + patch->originx = patch->originy = 0; + patch->wad = (UINT16)w; + patch->lump = texstart + j; + patch->flip = 0; + + Z_Unlock(flatlump); + + texturewidth[i] = texture->width; + textureheight[i] = texture->height << FRACBITS; + i++; + } +#endif } } @@ -1195,6 +1339,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture) M_Memcpy(resultTexture->name, newTextureName, 8); resultTexture->width = newTextureWidth; resultTexture->height = newTextureHeight; + resultTexture->type = TEXTURETYPE_COMPOSITE; } Z_Free(texturesToken); texturesToken = M_GetToken(NULL); diff --git a/src/r_data.h b/src/r_data.h index e71d45766..1d58a7815 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -45,6 +45,17 @@ typedef struct enum patchalphastyle style; } texpatch_t; +// texture type +enum +{ + TEXTURETYPE_UNKNOWN, + TEXTURETYPE_SINGLEPATCH, + TEXTURETYPE_COMPOSITE, +#ifdef WALLFLATS + TEXTURETYPE_FLAT, +#endif +}; + // A maptexturedef_t describes a rectangular texture, // which is composed of one or more mappatch_t structures // that arrange graphic patches. @@ -52,6 +63,7 @@ typedef struct { // Keep name for switch changing, etc. char name[8]; + UINT8 type; // TEXTURETYPE_ INT16 width, height; boolean holes; UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both From 5e55a04f5f39bc3417bfde0303515b54b6dee26e Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 01:50:47 -0300 Subject: [PATCH 02/23] minor tweaks --- src/r_data.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_data.c b/src/r_data.c index ac98aae77..e962d390c 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -456,6 +456,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture_t *texture; texpatch_t *patch; patch_t *realpatch; + boolean dealloc = false; UINT8 *pdata; int x, x1, x2, i, width, height; size_t blocksize; @@ -583,6 +584,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) lumpnum = patch->lump; lumplength = W_LumpLengthPwad(wadnum, lumpnum); realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); + dealloc = true; + #ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false); @@ -591,7 +594,9 @@ static UINT8 *R_GenerateTexture(size_t texnum) #ifdef WALLFLATS if (texture->type == TEXTURETYPE_FLAT) realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false); + else #endif + dealloc = false; x1 = patch->originx; width = SHORT(realpatch->width); @@ -628,6 +633,9 @@ static UINT8 *R_GenerateTexture(size_t texnum) colofs[x] = LONG((x * texture->height) + (texture->width*4)); ColumnDrawerPointer(patchcol, block + LONG(colofs[x]), patch, texture->height, height); } + + if (dealloc) + Z_Free(realpatch); } done: From 3f1681e0b3e0bb5536da875a558554c52923dea8 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 02:09:10 -0300 Subject: [PATCH 03/23] fix uninitialized pdata* --- src/r_data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/r_data.c b/src/r_data.c index e962d390c..d271e28f3 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -583,7 +583,8 @@ static UINT8 *R_GenerateTexture(size_t texnum) wadnum = patch->wad; lumpnum = patch->lump; lumplength = W_LumpLengthPwad(wadnum, lumpnum); - realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); + pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); + realpatch = (patch_t *)pdata; dealloc = true; #ifndef NO_PNG_LUMPS From 3e7be585ca35a625bb426bef270f8bfcb1bc859c Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 12:22:18 -0300 Subject: [PATCH 04/23] WORK!! --- src/r_data.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index d271e28f3..38c711b7b 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -752,7 +752,6 @@ void R_LoadTextures(void) for (w = 0, numtextures = 0; w < numwadfiles; w++) { // Count the textures from TEXTURES lumps - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); while (texturesLumpPos != INT16_MAX) { @@ -761,7 +760,6 @@ void R_LoadTextures(void) } // Count single-patch textures - if (wadfiles[w]->type == RET_PK3) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); @@ -774,7 +772,11 @@ void R_LoadTextures(void) } if (texstart == INT16_MAX || texend == INT16_MAX) +#ifdef WALLFLATS + goto countflats; +#else continue; +#endif texstart++; // Do not count the first marker @@ -793,6 +795,7 @@ void R_LoadTextures(void) } #ifdef WALLFLATS +countflats: // Count flats if (wadfiles[w]->type == RET_PK3) { @@ -802,7 +805,7 @@ void R_LoadTextures(void) else { texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0); - texend = W_CheckNumForNamePwad("F_END", (UINT16)w, 0); + texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart); } if (texstart == INT16_MAX || texend == INT16_MAX) @@ -873,7 +876,11 @@ void R_LoadTextures(void) } if (texstart == INT16_MAX || texend == INT16_MAX) +#ifdef WALLFLATS + goto checkflats; +#else continue; +#endif texstart++; // Do not count the first marker @@ -939,6 +946,7 @@ void R_LoadTextures(void) } #ifdef WALLFLATS +checkflats: // Yes if (wadfiles[w]->type == RET_PK3) { @@ -948,7 +956,7 @@ void R_LoadTextures(void) else { texstart = W_CheckNumForNamePwad("F_START", (UINT16)w, 0); - texend = W_CheckNumForNamePwad("F_END", (UINT16)w, 0); + texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart); } if (texstart == INT16_MAX || texend == INT16_MAX) From 78a0048ee4f1555d2a43abbcd5d5a43404deda27 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 13:23:38 -0300 Subject: [PATCH 05/23] Support animations --- src/p_spec.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 9ab50d947..7248d3ffb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -138,6 +138,13 @@ static size_t maxanims; static animdef_t *animdefs = NULL; +// Increase the size of animdefs to make room for a new animation definition +static void GrowAnimDefs(void) +{ + maxanims++; + animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL); +} + // A prototype; here instead of p_spec.h, so they're "private" void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum); void P_ParseAnimationDefintion(SINT8 istexture); @@ -347,8 +354,7 @@ void P_ParseAnimationDefintion(SINT8 istexture) if (i == maxanims) { // Increase the size to make room for the new animation definition - maxanims++; - animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL); + GrowAnimDefs(); strncpy(animdefs[i].startname, animdefsToken, 9); } @@ -434,8 +440,17 @@ void P_ParseAnimationDefintion(SINT8 istexture) } animdefs[i].speed = animSpeed; Z_Free(animdefsToken); -} +#ifdef WALLFLATS + // hehe... uhh..... + if (!istexture) + { + GrowAnimDefs(); + M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t)); + animdefs[maxanims-1].istexture = 1; + } +#endif +} /** Checks for flats in levelflats that are part of a flat animation sequence * and sets them up for animation. From a9e3e0c00e8ad52b9d5cf98101a12a604a860062 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 13:28:56 -0300 Subject: [PATCH 06/23] Support OpenGL --- src/hardware/hw_cache.c | 28 ++++++++++++++++++++-------- src/r_data.c | 6 ++++-- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 0b47bc880..3b923d516 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -642,6 +642,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) texture_t *texture; texpatch_t *patch; patch_t *realpatch; + UINT8 *pdata; INT32 i; boolean skyspecial = false; //poor hack for Legacy large skies.. @@ -690,19 +691,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { -#ifndef NO_PNG_LUMPS + boolean dealloc = true; size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump); -#endif - realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + pdata = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); + realpatch = (patch_t *)pdata; + #ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false); + else #endif - HWR_DrawTexturePatchInCache(&grtex->mipmap, - blockwidth, blockheight, - texture, patch, - realpatch); - Z_Unlock(realpatch); +#ifdef WALLFLATS + if (texture->type == TEXTURETYPE_FLAT) + realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false); + else +#endif + { + (void)lumplength; + dealloc = false; + } + + HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch); + + if (dealloc) + Z_Unlock(realpatch); } //Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :( if (format2bpp[grtex->mipmap.grInfo.format]==4) diff --git a/src/r_data.c b/src/r_data.c index 38c711b7b..2674319e7 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -456,7 +456,6 @@ static UINT8 *R_GenerateTexture(size_t texnum) texture_t *texture; texpatch_t *patch; patch_t *realpatch; - boolean dealloc = false; UINT8 *pdata; int x, x1, x2, i, width, height; size_t blocksize; @@ -574,6 +573,7 @@ static UINT8 *R_GenerateTexture(size_t texnum) // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { + boolean dealloc = true; static void (*ColumnDrawerPointer)(column_t *, UINT8 *, texpatch_t *, INT32, INT32); // Column drawing function pointer. if (patch->style != AST_COPY) ColumnDrawerPointer = (patch->flip & 2) ? R_DrawBlendFlippedColumnInCache : R_DrawBlendColumnInCache; @@ -585,7 +585,6 @@ static UINT8 *R_GenerateTexture(size_t texnum) lumplength = W_LumpLengthPwad(wadnum, lumpnum); pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); realpatch = (patch_t *)pdata; - dealloc = true; #ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) @@ -597,7 +596,10 @@ static UINT8 *R_GenerateTexture(size_t texnum) realpatch = R_FlatToPatch(pdata, texture->width, texture->height, 0, 0, NULL, false); else #endif + { + (void)lumplength; dealloc = false; + } x1 = patch->originx; width = SHORT(realpatch->width); From 61164ea3109883492b3fa608e8329a255635f033 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 14:09:20 -0300 Subject: [PATCH 07/23] Trying to make sense of chroma keying --- src/hardware/hw_cache.c | 40 ++++++++++++++++------------------------ src/hardware/hw_defs.h | 2 +- src/hardware/hw_glob.h | 1 - 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 3b923d516..edb8a51a0 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -32,10 +32,6 @@ #include "../r_draw.h" #include "../p_setup.h" -//Hurdler: 25/04/2000: used for new colormap code in hardware mode -//static UINT8 *gr_colormap = NULL; // by default it must be NULL ! (because colormap tables are not initialized) -boolean firetranslucent = false; - // Values set after a call to HWR_ResizeBlock() static INT32 blocksize, blockwidth, blockheight; @@ -121,18 +117,16 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm texel = source[yfrac>>FRACBITS]; - if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel)) - alpha = 0x80; + //Hurdler: 25/04/2000: now support colormap in hardware mode + if (mipmap->colormap) + texel = mipmap->colormap[texel]; + + // transparent pixel + if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX) + alpha = 0x00; else alpha = 0xff; - //Hurdler: not perfect, but better than holes - if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) - texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX; - //Hurdler: 25/04/2000: now support colormap in hardware mode - else if (mipmap->colormap) - texel = mipmap->colormap[texel]; - // hope compiler will get this switch out of the loops (dreams...) // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) // Alam: SRB2 uses Mingw, HUGS @@ -235,18 +229,16 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block, texel = source[yfrac>>FRACBITS]; - if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel)) - alpha = 0x80; + //Hurdler: 25/04/2000: now support colormap in hardware mode + if (mipmap->colormap) + texel = mipmap->colormap[texel]; + + // transparent pixel + if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX) + alpha = 0x00; else alpha = 0xff; - //Hurdler: not perfect, but better than holes - if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) - texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX; - //Hurdler: 25/04/2000: now support colormap in hardware mode - else if (mipmap->colormap) - texel = mipmap->colormap[texel]; - // hope compiler will get this switch out of the loops (dreams...) // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) // Alam: SRB2 uses Mingw, HUGS @@ -612,7 +604,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap) { UINT8 *block; INT32 bpp, i; - UINT16 bu16 = ((0x00 <<8) | HWR_CHROMAKEY_EQUIVALENTCOLORINDEX); + UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX); bpp = format2bpp[grMipmap->grInfo.format]; block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data)); @@ -675,7 +667,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) INT32 j; RGBA_t col; - col = V_GetColor(HWR_CHROMAKEY_EQUIVALENTCOLORINDEX); + col = V_GetColor(HWR_PATCHES_CHROMAKEY_COLORINDEX); for (j = 0; j < blockheight; j++) { for (i = 0; i < blockwidth; i++) diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 5dcead77c..b8d420f68 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -42,7 +42,7 @@ typedef unsigned char FBOOLEAN; // byte value for paletted graphics, which represent the transparent color #define HWR_PATCHES_CHROMAKEY_COLORINDEX 255 -#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130 +//#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130 // the chroma key color shows on border sprites, set it to black #define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen() diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 72365013d..16bd97092 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -123,6 +123,5 @@ extern consvar_t cv_grrounddown; // on/off extern INT32 patchformat; extern INT32 textureformat; -extern boolean firetranslucent; #endif //_HW_GLOB_ From 243cbc02ec54502f91f09485dd4c751d09abcbfb Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 17:53:05 -0300 Subject: [PATCH 08/23] Big Miss Steak --- src/r_plane.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/r_plane.c b/src/r_plane.c index 53b58c274..89a76aed2 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -1007,6 +1007,8 @@ void R_DrawSinglePlane(visplane_t *pl) R_CheckFlatLength(W_LumpLength(levelflat->u.flat.lumpnum)); // Raw flats always have dimensions that are powers-of-two numbers. ds_powersoftwo = true; + if (spanfunc == basespanfunc) + spanfunc = mmxspanfunc; break; default: switch (type) From 615547ddd17a6f3bcb777e6202073cd730210821 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 9 Nov 2019 19:32:06 -0300 Subject: [PATCH 09/23] Fix animated flats yet again --- src/p_spec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 7248d3ffb..58fe5ef60 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -491,7 +491,8 @@ static inline void P_FindAnimatedFlat(INT32 animnum) atoi(sizeu1(i)), foundflats->name, foundflats->animseq, foundflats->numpics,foundflats->speed); } - else if (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum) + else if ((!anims[animnum].istexture) && (foundflats->type == LEVELFLAT_FLAT) + && (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum)) { foundflats->u.flat.baselumpnum = startflatnum; foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum; @@ -5596,7 +5597,7 @@ void P_UpdateSpecials(void) if (foundflats->speed) // it is an animated flat { // update the levelflat texture number - if (foundflats->type == LEVELFLAT_TEXTURE) + if ((foundflats->type == LEVELFLAT_TEXTURE) && (foundflats->u.texture.basenum != -1)) foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics); // update the levelflat lump number else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR)) From 0d41a55071eae9a9daf9ebf3a8f52f7a540a45f9 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 13:04:51 -0500 Subject: [PATCH 10/23] Deployer fixes for 2.2.0 --- CMakeLists.txt | 2 +- appveyor.yml | 14 +++++++------- assets/CMakeLists.txt | 10 +++++++--- deployer/travis/deployer_defaults.sh | 16 ++++++++-------- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96e32a06d..dd9703914 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # Version change is fine. project(SRB2 - VERSION 2.1.25 + VERSION 2.2.0 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index d58976fd5..748babb88 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.25.{branch}-{build} +version: 2.2.0.{branch}-{build} os: MinGW environment: @@ -29,15 +29,15 @@ environment: ############################## DPL_ENABLED: 0 DPL_TAG_ENABLED: 0 - DPL_INSTALLER_NAME: SRB2-v2123 + DPL_INSTALLER_NAME: SRB2-v220 # Asset handling is barebones vs. Travis Deployer. We operate on 7z only. # Include the README files and the OpenGL batch in the main and patch archives. # The x86/x64 archives contain the DLL binaries. - ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z - ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-patch-assets.7z - ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x86-assets.7z - ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x64-assets.7z - ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z + ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z + ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-patch-assets.7z + ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x86-assets.7z + ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-x64-assets.7z + ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z # This is overridden to 1 for release tag builds ASSET_FILES_OPTIONAL_GET: 0 # For patches, also include the X86/X64 DLLs. diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 881153682..0636c1e59 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -12,18 +12,22 @@ ENDFUNCTION(PREPEND) set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" CACHE STRING "Path to directory that contains all asset files for the installer.") +#################### +# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list! +#################### + set(SRB2_ASSET_HASHED "srb2.pk3;\ player.dta;\ -zones.pk3;\ -patch.pk3" +zones.pk3" CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" ) set(SRB2_ASSET_DOCS "README.txt;\ LICENSE.txt;\ -LICENSE-3RD-PARTY.txt" +LICENSE-3RD-PARTY.txt;\ +README-SDL.txt" CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!" ) diff --git a/deployer/travis/deployer_defaults.sh b/deployer/travis/deployer_defaults.sh index bccb7409a..343fbd967 100644 --- a/deployer/travis/deployer_defaults.sh +++ b/deployer/travis/deployer_defaults.sh @@ -27,10 +27,10 @@ : ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only. # Asset File Parameters -: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z} -: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z} -: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta} -: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt} +: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z} +: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z} +: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta patch.pk3} +: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt README-SDL.txt} : ${ASSET_FILES_OPTIONAL_GET:=0} # FTP Parameters @@ -51,7 +51,7 @@ # Package Parameters : ${PACKAGE_NAME:=srb2} -: ${PACKAGE_VERSION:=2.1.23} +: ${PACKAGE_VERSION:=2.2.0} : ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic) : ${PACKAGE_REVISION} # Defaults to UTC timestamp : ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2} @@ -62,12 +62,12 @@ : ${PACKAGE_GROUP_NAME_EMAIL:=Sonic Team Junior } : ${PACKAGE_WEBSITE:=} -: ${PACKAGE_ASSET_MINVERSION:=2.1.21} # Number this the version BEFORE the actual required version, because we do a > check -: ${PACKAGE_ASSET_MAXVERSION:=2.1.24} # Number this the version AFTER the actual required version, because we do a < check +: ${PACKAGE_ASSET_MINVERSION:=2.1.26} # Number this the version BEFORE the actual required version, because we do a > check +: ${PACKAGE_ASSET_MAXVERSION:=2.2.1} # Number this the version AFTER the actual required version, because we do a < check : ${PROGRAM_NAME:=Sonic Robo Blast 2} : ${PROGRAM_VENDOR:=Sonic Team Junior} -: ${PROGRAM_VERSION:=2.1.23} +: ${PROGRAM_VERSION:=2.2.0} : ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.} : ${PROGRAM_FILENAME:=srb2} diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 9297833e2..ab3157c44 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.25; + CURRENT_PROJECT_VERSION = 2.2.0; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.25; + CURRENT_PROJECT_VERSION = 2.2.0; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( From 2a9a2c0f021b964f2955ec75f3526f638ae1e69d Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 14:30:51 -0500 Subject: [PATCH 11/23] Travis yflip error --- src/hardware/r_opengl/r_opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 25bcf153b..22b8675a0 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1520,7 +1520,7 @@ static void gld_BuildSky(int row_count, int col_count) vertex_p = &vbo->data[0]; vbo->loopcount = 0; - for (yflip = 0; yflip < 2; yflip++) + for (yflip = 0; (UINT8)yflip < 2; yflip++) { vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_FAN; vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0]; From 9fa09c984243d3f31b18d0becf8b0aa22f18dba0 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 15:08:53 -0500 Subject: [PATCH 12/23] Travis Linux Deployer fixes --- .travis.yml | 84 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2ed43000..4579a4228 100644 --- a/.travis.yml +++ b/.travis.yml @@ -459,61 +459,46 @@ matrix: - os: linux addons: apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: xenial + dist: bionic if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" env: - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=bionic + - _DPL_JOB_NAME=eoan - _DPL_DPUT_TARGET=1 - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=bionic - - PACKAGE_SUBVERSION=~18.04bionic + - PACKAGE_DISTRO=eoan + - PACKAGE_SUBVERSION=~19.10eoan #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: trusty - if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") - AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) - AND env(DPL_TERMINATE_MAIN) != "1" - env: - - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=trusty - - _DPL_DPUT_TARGET=1 - - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=trusty - - PACKAGE_SUBVERSION=~14.04trusty - #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - - os: linux - addons: - apt: - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - gcc-4.8 - compiler: gcc-4.8 - dist: xenial + dist: bionic if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" @@ -528,34 +513,42 @@ matrix: - os: linux addons: apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: xenial + dist: bionic if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" env: - _DPL_JOB_ENABLED=1 - - _DPL_JOB_NAME=cosmic + - _DPL_JOB_NAME=bionic - _DPL_DPUT_TARGET=1 - _DPL_PACKAGE_SOURCE=1 - - PACKAGE_DISTRO=cosmic - - PACKAGE_SUBVERSION=~18.10cosmic + - PACKAGE_DISTRO=bionic + - PACKAGE_SUBVERSION=~18.04bionic #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.8 compiler: gcc-4.8 @@ -571,6 +564,33 @@ matrix: - PACKAGE_DISTRO=xenial - PACKAGE_SUBVERSION=~16.04xenial #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - libopenmpt-dev + - p7zip-full + - gcc-4.8 + compiler: gcc-4.8 + dist: trusty + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=trusty + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=trusty + - PACKAGE_SUBVERSION=~14.04trusty + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 allow_failures: - compiler: clang-3.5 - compiler: clang-3.6 From 1f8c6574fbfb631d90bb3a7c8c2f9356af9a4dee Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 15:31:31 -0500 Subject: [PATCH 13/23] Debian packaging fixes, libopenmpt --- debian-template/control | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian-template/control b/debian-template/control index e1348d704..a1f49da89 100644 --- a/debian-template/control +++ b/debian-template/control @@ -10,6 +10,7 @@ Build-Depends: debhelper (>= 7.0.50~), libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7), zlib1g-dev, libgme-dev, + libopenmpt-dev, libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386] @@ -24,6 +25,7 @@ Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, libsdl2-mixer-2.0-0, zlib1g, libgme0, + libopenmpt, libpng | libpng16-16 | libpng12-0 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog From 58650397e225ebef2ef49205129fdd0e1dd6a8a6 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 15:58:59 -0500 Subject: [PATCH 14/23] Travis Deployer: Use xenial instead of bionic for building installers Bionic breaks package signing because importing the private key is unsuccessful. Works in xenial. The buildbot distro doesn't matter because we're just sending source packages to Launchpad which builds on the target distro. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4579a4228..9d91b77df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -471,7 +471,7 @@ matrix: - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: bionic + dist: xenial if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" @@ -498,7 +498,7 @@ matrix: - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: bionic + dist: xenial if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" @@ -525,7 +525,7 @@ matrix: - p7zip-full - gcc-4.8 compiler: gcc-4.8 - dist: bionic + dist: xenial if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" From bca33bdb0e824e0ac7a6bbfa5ceb2d6c6805e593 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 16:26:28 -0500 Subject: [PATCH 15/23] Remove patch.pk3 from Deployer ASSET_FILES_HASHED --- deployer/travis/deployer_defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployer/travis/deployer_defaults.sh b/deployer/travis/deployer_defaults.sh index 343fbd967..fe7ba6993 100644 --- a/deployer/travis/deployer_defaults.sh +++ b/deployer/travis/deployer_defaults.sh @@ -29,7 +29,7 @@ # Asset File Parameters : ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-assets.7z} : ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/SRB2-v220-optional-assets.7z} -: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta patch.pk3} +: ${ASSET_FILES_HASHED:=srb2.pk3 zones.pk3 player.dta} # POST v2.2 NOTE: Don't forget to add patch.pk3! : ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt README-SDL.txt} : ${ASSET_FILES_OPTIONAL_GET:=0} From 65ca45c14700d12895c90126fd54e8e8ceaed626 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 7 Dec 2019 20:32:04 -0500 Subject: [PATCH 16/23] Debian libopenmpt0 name fix --- debian-template/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian-template/control b/debian-template/control index a1f49da89..74d11ae90 100644 --- a/debian-template/control +++ b/debian-template/control @@ -25,7 +25,7 @@ Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, libsdl2-mixer-2.0-0, zlib1g, libgme0, - libopenmpt, + libopenmpt | libopenmpt0, libpng | libpng16-16 | libpng12-0 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog From e01eb1904488672ee5dd4b73d9590471128a1b29 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 11 Dec 2019 22:11:00 -0300 Subject: [PATCH 17/23] Sad! --- src/r_data.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/r_data.c b/src/r_data.c index e8da4e4d3..a0655e611 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -438,7 +438,6 @@ static UINT8 *R_GenerateTexture(size_t texnum) texpatch_t *patch; patch_t *realpatch; UINT8 *pdata; - boolean dealloc = false; int x, x1, x2, i, width, height; size_t blocksize; column_t *patchcol; From b17bf5d836d21652dfc83072b032e277598e8e87 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 15 Dec 2019 14:37:30 +0000 Subject: [PATCH 18/23] Use Scaled Radial Deadzones, instead of Axial deadzones. Additionally fixes some weird padscale 0 stuff that was flipped. This does have gameplay implications in both NiGHTS and regular gameplay. Notably you won't feel like you're locked into up/down left/right when you want to turn, but this can make running perfectly straight a little bit more tricky. --- src/g_game.c | 210 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 142 insertions(+), 68 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2a12dd298..0105b88c6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -275,6 +275,12 @@ static UINT8 *metalbuffer = NULL; static UINT8 *metal_p; static UINT16 metalversion; +typedef struct joystickvector2_s +{ + INT32 xaxis; + INT32 yaxis; +} joystickvector2_t; + // extra data stuff (events registered this frame while recording) static struct { UINT8 flags; // EZT flags @@ -882,12 +888,6 @@ static INT32 JoyAxis(axis_input_e axissel) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) retaxis = +JOYAXISRANGE; - if (!Joystick.bGamepadStyle && axissel < AXISDEAD) - { - const INT32 jdeadzone = JOYAXISRANGE/4; - if (-jdeadzone < retaxis && retaxis < jdeadzone) - return 0; - } if (flp) retaxis = -retaxis; //flip it around return retaxis; } @@ -955,16 +955,74 @@ static INT32 Joy2Axis(axis_input_e axissel) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) retaxis = +JOYAXISRANGE; - if (!Joystick2.bGamepadStyle && axissel < AXISDEAD) - { - const INT32 jdeadzone = JOYAXISRANGE/4; - if (-jdeadzone < retaxis && retaxis < jdeadzone) - return 0; - } if (flp) retaxis = -retaxis; //flip it around return retaxis; } +// Take a magnitude of two axes, and adjust it to take out the deadzone +// Will return a value between 0 and JOYAXISRANGE +static INT32 G_BasicDeadZoneCalculation(INT32 magnitude) +{ + // TODO: console variable for deadzone setting + const INT32 jdeadzone = JOYAXISRANGE/4; + INT32 deadzoneAppliedValue = 0; + + if (jdeadzone > 0) + { + if (magnitude > jdeadzone) + { + INT32 adjustedMagnitude = abs(magnitude); + adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE); + + adjustedMagnitude -= jdeadzone; + + deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone); + } + } + + return deadzoneAppliedValue; +} + +// Get the actual sensible radial value for a joystick axis when accounting for a deadzone +static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvector) +{ + INT32 gamepadStyle = Joystick.bGamepadStyle; + + if (splitnum == 1) + { + gamepadStyle = Joystick2.bGamepadStyle; + } + + // When gamepadstyle is "true" the values are just -1, 0, or 1. This is done in the interface code. + if (!gamepadStyle) + { + // Get the total magnitude of the 2 axes + INT32 magnitude = (joystickvector->xaxis * joystickvector->xaxis) + (joystickvector->yaxis * joystickvector->yaxis); + INT32 normalisedxaxis; + INT32 normalisedyaxis; + INT32 normalisedMagnitude; + double dMagnitude = sqrt((double)magnitude); + magnitude = (INT32)dMagnitude; + + // Get the normalised xy values from the magnitude + normalisedxaxis = (joystickvector->xaxis * magnitude) / JOYAXISRANGE; + normalisedyaxis = (joystickvector->yaxis * magnitude) / JOYAXISRANGE; + + // Apply the deadzone to the magnitude to give a correct value between 0 and JOYAXISRANGE + normalisedMagnitude = G_BasicDeadZoneCalculation(magnitude); + + // Apply the deadzone to the xy axes + joystickvector->xaxis = (normalisedxaxis * normalisedMagnitude) / JOYAXISRANGE; + joystickvector->yaxis = (normalisedyaxis * normalisedMagnitude) / JOYAXISRANGE; + + // Cap the values so they don't go above the correct maximum + joystickvector->xaxis = min(joystickvector->xaxis, JOYAXISRANGE); + joystickvector->xaxis = max(joystickvector->xaxis, -JOYAXISRANGE); + joystickvector->yaxis = min(joystickvector->yaxis, JOYAXISRANGE); + joystickvector->yaxis = max(joystickvector->yaxis, -JOYAXISRANGE); + } +} + // // G_BuildTiccmd @@ -985,12 +1043,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) { boolean forcestrafe = false; boolean forcefullinput = false; - INT32 tspeed, forward, side, axis, altaxis, i; + INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i; const INT32 speed = 1; // these ones used for multiple conditions boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; player_t *player = &players[consoleplayer]; camera_t *thiscam = &camera; + joystickvector2_t movejoystickvector, lookjoystickvector; static INT32 turnheld; // for accelerative turning static boolean keyboard_look; // true if lookup/down using keyboard @@ -1030,11 +1089,16 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) localaiming = 0; joyaiming = thisjoyaiming; - axis = JoyAxis(AXISTURN); - if (gamepadjoystickmove && axis != 0) + turnaxis = JoyAxis(AXISTURN); + lookaxis = JoyAxis(AXISLOOK); + lookjoystickvector.xaxis = turnaxis; + lookjoystickvector.yaxis = lookaxis; + G_HandleAxisDeadZone(0, &lookjoystickvector); + + if (gamepadjoystickmove && lookjoystickvector.xaxis != 0) { - turnright = turnright || (axis > 0); - turnleft = turnleft || (axis < 0); + turnright = turnright || (lookjoystickvector.xaxis > 0); + turnleft = turnleft || (lookjoystickvector.xaxis < 0); } forward = side = 0; @@ -1074,10 +1138,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (turnleft) side -= sidemove[speed]; - if (analogjoystickmove && axis != 0) + if (analogjoystickmove && lookjoystickvector.xaxis != 0) { // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - side += ((axis * sidemove[1]) >> 10); + side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10); } } else if (cv_analog.value) // Analog @@ -1094,41 +1158,44 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) else if (turnleft) cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]); - if (analogjoystickmove && axis != 0) + if (analogjoystickmove && lookjoystickvector.xaxis != 0) { // JOYAXISRANGE should be 1023 (divide by 1024) - cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG! + cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG! } } - axis = JoyAxis(AXISSTRAFE); - if (gamepadjoystickmove && axis != 0) + strafeaxis = JoyAxis(AXISSTRAFE); + moveaxis = JoyAxis(AXISMOVE); + movejoystickvector.xaxis = strafeaxis; + movejoystickvector.yaxis = moveaxis; + G_HandleAxisDeadZone(0, &movejoystickvector); + + if (gamepadjoystickmove && movejoystickvector.xaxis != 0) { - if (axis < 0) + if (movejoystickvector.xaxis > 0) side += sidemove[speed]; - else if (axis > 0) + else if (movejoystickvector.xaxis < 0) side -= sidemove[speed]; } - else if (analogjoystickmove && axis != 0) + else if (analogjoystickmove && movejoystickvector.xaxis != 0) { // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - side += ((axis * sidemove[1]) >> 10); + side += ((movejoystickvector.xaxis * sidemove[1]) >> 10); } // forward with key or button - axis = JoyAxis(AXISMOVE); - altaxis = JoyAxis(AXISLOOK); - if (movefkey || (gamepadjoystickmove && axis < 0) + if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0) || ((player->powers[pw_carry] == CR_NIGHTSMODE) - && (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0)))) + && (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0)))) forward = forwardmove[speed]; - if (movebkey || (gamepadjoystickmove && axis > 0) + if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0) || ((player->powers[pw_carry] == CR_NIGHTSMODE) - && (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) + && (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0)))) forward -= forwardmove[speed]; - if (analogjoystickmove && axis != 0) - forward -= ((axis * forwardmove[1]) >> 10); // ANALOG! + if (analogjoystickmove && movejoystickvector.yaxis != 0) + forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG! // some people strafe left & right with mouse buttons // those people are weird @@ -1211,9 +1278,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) localaiming += (mlooky<<19)*player_invert*screen_invert; } - axis = JoyAxis(AXISLOOK); - if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis.value != 0) - localaiming += (axis<<16) * screen_invert; + if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis.value != 0) + localaiming += (lookjoystickvector.yaxis<<16) * screen_invert; // spring back if not using keyboard neither mouselookin' if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming) @@ -1221,12 +1287,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { - if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0)) { localaiming += KB_LOOKSPEED * screen_invert; keyboard_look = true; } - else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) + else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0)) { localaiming -= KB_LOOKSPEED * screen_invert; keyboard_look = true; @@ -1316,12 +1382,13 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) { boolean forcestrafe = false; boolean forcefullinput = false; - INT32 tspeed, forward, side, axis, altaxis, i; + INT32 tspeed, forward, side, axis, strafeaxis, moveaxis, turnaxis, lookaxis, i; const INT32 speed = 1; // these ones used for multiple conditions boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; player_t *player = &players[secondarydisplayplayer]; camera_t *thiscam = (player->bot == 2 ? &camera : &camera2); + joystickvector2_t movejoystickvector, lookjoystickvector; static INT32 turnheld; // for accelerative turning static boolean keyboard_look; // true if lookup/down using keyboard @@ -1359,11 +1426,16 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) localaiming2 = 0; joyaiming = thisjoyaiming; - axis = Joy2Axis(AXISTURN); - if (gamepadjoystickmove && axis != 0) + turnaxis = Joy2Axis(AXISTURN); + lookaxis = Joy2Axis(AXISLOOK); + lookjoystickvector.xaxis = turnaxis; + lookjoystickvector.yaxis = lookaxis; + G_HandleAxisDeadZone(1, &lookjoystickvector); + + if (gamepadjoystickmove && lookjoystickvector.xaxis != 0) { - turnright = turnright || (axis > 0); - turnleft = turnleft || (axis < 0); + turnright = turnright || (lookjoystickvector.xaxis > 0); + turnleft = turnleft || (lookjoystickvector.xaxis < 0); } forward = side = 0; @@ -1404,10 +1476,10 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (turnleft) side -= sidemove[speed]; - if (analogjoystickmove && axis != 0) + if (analogjoystickmove && lookjoystickvector.xaxis != 0) { // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - side += ((axis * sidemove[1]) >> 10); + side += ((lookjoystickvector.xaxis * sidemove[1]) >> 10); } } else if (cv_analog2.value) // Analog @@ -1424,41 +1496,44 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) else if (turnleft) cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]); - if (analogjoystickmove && axis != 0) + if (analogjoystickmove && lookjoystickvector.xaxis != 0) { // JOYAXISRANGE should be 1023 (divide by 1024) - cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG! + cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG! } } - axis = Joy2Axis(AXISSTRAFE); - if (gamepadjoystickmove && axis != 0) + strafeaxis = Joy2Axis(AXISSTRAFE); + moveaxis = Joy2Axis(AXISMOVE); + movejoystickvector.xaxis = strafeaxis; + movejoystickvector.yaxis = moveaxis; + G_HandleAxisDeadZone(1, &movejoystickvector); + + if (gamepadjoystickmove && movejoystickvector.xaxis != 0) { - if (axis < 0) + if (movejoystickvector.xaxis > 0) side += sidemove[speed]; - else if (axis > 0) + else if (movejoystickvector.xaxis < 0) side -= sidemove[speed]; } - else if (analogjoystickmove && axis != 0) + else if (analogjoystickmove && movejoystickvector.xaxis != 0) { // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - side += ((axis * sidemove[1]) >> 10); + side += ((movejoystickvector.xaxis * sidemove[1]) >> 10); } // forward with key or button - axis = Joy2Axis(AXISMOVE); - altaxis = Joy2Axis(AXISLOOK); - if (movefkey || (gamepadjoystickmove && axis < 0) + if (movefkey || (gamepadjoystickmove && movejoystickvector.yaxis < 0) || ((player->powers[pw_carry] == CR_NIGHTSMODE) - && (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0)))) + && (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0)))) forward = forwardmove[speed]; - if (movebkey || (gamepadjoystickmove && axis > 0) + if (movebkey || (gamepadjoystickmove && movejoystickvector.yaxis > 0) || ((player->powers[pw_carry] == CR_NIGHTSMODE) - && (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) + && (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0)))) forward -= forwardmove[speed]; - if (analogjoystickmove && axis != 0) - forward -= ((axis * forwardmove[1]) >> 10); // ANALOG! + if (analogjoystickmove && movejoystickvector.yaxis != 0) + forward -= ((movejoystickvector.yaxis * forwardmove[1]) >> 10); // ANALOG! // some people strafe left & right with mouse buttons // those people are (still) weird @@ -1538,9 +1613,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) localaiming2 += (mlook2y<<19)*player_invert*screen_invert; } - axis = Joy2Axis(AXISLOOK); - if (analogjoystickmove && joyaiming && axis != 0 && cv_lookaxis2.value != 0) - localaiming2 += (axis<<16) * screen_invert; + if (analogjoystickmove && joyaiming && lookjoystickvector.yaxis != 0 && cv_lookaxis2.value != 0) + localaiming2 += (lookjoystickvector.yaxis<<16) * screen_invert; // spring back if not using keyboard neither mouselookin' if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming) @@ -1548,12 +1622,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { - if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && lookjoystickvector.yaxis > 0)) { localaiming2 += KB_LOOKSPEED * screen_invert; keyboard_look = true; } - else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) + else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && lookjoystickvector.yaxis < 0)) { localaiming2 -= KB_LOOKSPEED * screen_invert; keyboard_look = true; From 76d59330f7ad201d50efb055846cccea7b4d51d5 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 15 Dec 2019 15:36:13 +0000 Subject: [PATCH 19/23] Port the deadzone cvar stuff from kart. Add menu items for deadzone. --- src/d_netcmd.c | 4 ++++ src/g_game.c | 27 ++++++++++++++++----------- src/g_game.h | 1 + src/m_menu.c | 6 +++++- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e80d07b76..f622966c5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -823,6 +823,10 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_autobrake); CV_RegisterVar(&cv_autobrake2); + // Ported from kart + CV_RegisterVar(&cv_deadzone); + CV_RegisterVar(&cv_deadzone2); + // s_sound.c CV_RegisterVar(&cv_soundvolume); CV_RegisterVar(&cv_closedcaptioning); diff --git a/src/g_game.c b/src/g_game.c index 0105b88c6..d2d27528c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -400,6 +400,11 @@ consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, di consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t deadzone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; +consvar_t cv_deadzone = {"deadzone", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_deadzone2 = {"deadzone2", "0.25", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + + typedef enum { AXISNONE = 0, @@ -407,7 +412,6 @@ typedef enum AXISMOVE, AXISLOOK, AXISSTRAFE, - AXISDEAD, //Axises that don't want deadzones AXISJUMP, AXISSPIN, AXISFIRE, @@ -961,10 +965,9 @@ static INT32 Joy2Axis(axis_input_e axissel) // Take a magnitude of two axes, and adjust it to take out the deadzone // Will return a value between 0 and JOYAXISRANGE -static INT32 G_BasicDeadZoneCalculation(INT32 magnitude) +static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone) { - // TODO: console variable for deadzone setting - const INT32 jdeadzone = JOYAXISRANGE/4; + const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT; INT32 deadzoneAppliedValue = 0; if (jdeadzone > 0) @@ -987,10 +990,12 @@ static INT32 G_BasicDeadZoneCalculation(INT32 magnitude) static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvector) { INT32 gamepadStyle = Joystick.bGamepadStyle; + fixed_t deadZone = cv_deadzone.value; if (splitnum == 1) { gamepadStyle = Joystick2.bGamepadStyle; + deadZone = cv_deadzone2.value; } // When gamepadstyle is "true" the values are just -1, 0, or 1. This is done in the interface code. @@ -998,22 +1003,22 @@ static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvect { // Get the total magnitude of the 2 axes INT32 magnitude = (joystickvector->xaxis * joystickvector->xaxis) + (joystickvector->yaxis * joystickvector->yaxis); - INT32 normalisedxaxis; - INT32 normalisedyaxis; + INT32 normalisedXAxis; + INT32 normalisedYAxis; INT32 normalisedMagnitude; double dMagnitude = sqrt((double)magnitude); magnitude = (INT32)dMagnitude; // Get the normalised xy values from the magnitude - normalisedxaxis = (joystickvector->xaxis * magnitude) / JOYAXISRANGE; - normalisedyaxis = (joystickvector->yaxis * magnitude) / JOYAXISRANGE; + normalisedXAxis = (joystickvector->xaxis * magnitude) / JOYAXISRANGE; + normalisedYAxis = (joystickvector->yaxis * magnitude) / JOYAXISRANGE; // Apply the deadzone to the magnitude to give a correct value between 0 and JOYAXISRANGE - normalisedMagnitude = G_BasicDeadZoneCalculation(magnitude); + normalisedMagnitude = G_BasicDeadZoneCalculation(magnitude, deadZone); // Apply the deadzone to the xy axes - joystickvector->xaxis = (normalisedxaxis * normalisedMagnitude) / JOYAXISRANGE; - joystickvector->yaxis = (normalisedyaxis * normalisedMagnitude) / JOYAXISRANGE; + joystickvector->xaxis = (normalisedXAxis * normalisedMagnitude) / JOYAXISRANGE; + joystickvector->yaxis = (normalisedYAxis * normalisedMagnitude) / JOYAXISRANGE; // Cap the values so they don't go above the correct maximum joystickvector->xaxis = min(joystickvector->xaxis, JOYAXISRANGE); diff --git a/src/g_game.h b/src/g_game.h index e7f4a4677..c19faebe4 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -72,6 +72,7 @@ extern consvar_t cv_useranalog, cv_useranalog2; extern consvar_t cv_analog, cv_analog2; extern consvar_t cv_directionchar, cv_directionchar2; extern consvar_t cv_autobrake, cv_autobrake2; +extern consvar_t cv_deadzone, cv_deadzone2; extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis; extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2; extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest; diff --git a/src/m_menu.c b/src/m_menu.c index e367041e0..cbcc3bdb6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1119,6 +1119,8 @@ static menuitem_t OP_Joystick1Menu[] = {IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120}, {IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130}, + {IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, + NULL, "Deadzone", &cv_deadzone, 140 }, }; static menuitem_t OP_Joystick2Menu[] = @@ -1135,6 +1137,8 @@ static menuitem_t OP_Joystick2Menu[] = {IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120}, {IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130}, + {IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, + NULL, "Deadzone", &cv_deadzone2, 140 }, }; static menuitem_t OP_JoystickSetMenu[1+MAX_JOYSTICKS]; @@ -3025,7 +3029,7 @@ boolean M_Responder(event_t *ev) } else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = JOYAXISRANGE/4; + const INT32 jdeadzone = (JOYAXISRANGE * cv_deadzone.value) / FRACUNIT; if (ev->data3 != INT32_MAX) { if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) From f584b61c93a97e1a9852f306acba673ced21e03a Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 18 Dec 2019 15:34:55 -0800 Subject: [PATCH 20/23] Use a random port when connecting --- src/d_clisrv.c | 2 +- src/d_net.h | 2 ++ src/i_tcp.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7b6c35eb6..6520a1aa1 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -70,7 +70,7 @@ boolean server = true; // true or false but !server == client #define client (!server) boolean nodownload = false; -static boolean serverrunning = false; +boolean serverrunning = false; INT32 serverplayer = 0; char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) diff --git a/src/d_net.h b/src/d_net.h index 8fd6c67b2..c6fe4a27f 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -40,6 +40,8 @@ extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if a extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game +extern boolean serverrunning; + INT32 Net_GetFreeAcks(boolean urgent); void Net_AckTicker(void); diff --git a/src/i_tcp.c b/src/i_tcp.c index 2dd9f0591..bd35a292a 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -887,6 +887,7 @@ static boolean UDP_Socket(void) #ifdef HAVE_IPV6 const INT32 b_ipv6 = M_CheckParm("-ipv6"); #endif + const char *serv; for (s = 0; s < mysocketses; s++) @@ -902,11 +903,16 @@ static boolean UDP_Socket(void) hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; + if (serverrunning) + serv = port_name; + else + serv = NULL;/* any port */ + if (M_CheckParm("-bindaddr")) { while (M_IsNextParm()) { - gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai); + gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai); if (gaie == 0) { runp = ai; @@ -927,7 +933,7 @@ static boolean UDP_Socket(void) } else { - gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai); + gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai); if (gaie == 0) { runp = ai; @@ -960,7 +966,7 @@ static boolean UDP_Socket(void) { while (M_IsNextParm()) { - gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai); + gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai); if (gaie == 0) { runp = ai; @@ -981,7 +987,7 @@ static boolean UDP_Socket(void) } else { - gaie = I_getaddrinfo("::", port_name, &hints, &ai); + gaie = I_getaddrinfo("::", serv, &hints, &ai); if (gaie == 0) { runp = ai; From 4e321012894b2aa87e312597f19be26b30545a8b Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 18 Dec 2019 15:43:29 -0800 Subject: [PATCH 21/23] Use a pointer for port_name Using strcpy is stupid because we don't know how long the argument would be. There's no need for a buffer anyway. --- src/i_tcp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index bd35a292a..8ead73c3a 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -209,7 +209,7 @@ static size_t numbans = 0; static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1? static boolean init_tcp_driver = false; -static char port_name[8] = DEFAULTPORT; +static const char *port_name = DEFAULTPORT; #ifndef NONET @@ -1431,10 +1431,11 @@ boolean I_InitTcpNetwork(void) // Combined -udpport and -clientport into -port // As it was really redundant having two seperate parms that does the same thing { - if (M_IsNextParm()) - strcpy(port_name, M_GetNextParm()); - else - strcpy(port_name, "0"); + /* + If it's NULL, that's okay! Because then + we'll get a random port from getaddrinfo. + */ + port_name = M_GetNextParm(); } // parse network game options, From 843d9b9f0a345330d97c579e94f208eb2b65c156 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 18 Dec 2019 15:47:47 -0800 Subject: [PATCH 22/23] -clientport (it's back!) and -serverport, which is an alias to -port If you ever need to, you can change the client port number. --- src/i_tcp.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 8ead73c3a..502eb6732 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -209,7 +209,8 @@ static size_t numbans = 0; static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1? static boolean init_tcp_driver = false; -static const char *port_name = DEFAULTPORT; +static const char *serverport_name = DEFAULTPORT; +static const char *clientport_name;/* any port */ #ifndef NONET @@ -904,9 +905,9 @@ static boolean UDP_Socket(void) hints.ai_protocol = IPPROTO_UDP; if (serverrunning) - serv = port_name; + serv = serverport_name; else - serv = NULL;/* any port */ + serv = clientport_name; if (M_CheckParm("-bindaddr")) { @@ -948,8 +949,8 @@ static boolean UDP_Socket(void) #ifdef HAVE_MINIUPNPC if (UPNP_support) { - I_UPnP_rem(port_name, "UDP"); - I_UPnP_add(NULL, port_name, "UDP"); + I_UPnP_rem(serverport_name, "UDP"); + I_UPnP_add(NULL, serverport_name, "UDP"); } #endif } @@ -1427,16 +1428,19 @@ boolean I_InitTcpNetwork(void) if (!I_InitTcpDriver()) return false; - if (M_CheckParm("-port")) + if (M_CheckParm("-port") || M_CheckParm("-serverport")) // Combined -udpport and -clientport into -port // As it was really redundant having two seperate parms that does the same thing + /* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */ { /* If it's NULL, that's okay! Because then we'll get a random port from getaddrinfo. */ - port_name = M_GetNextParm(); + serverport_name = M_GetNextParm(); } + if (M_CheckParm("-clientport")) + clientport_name = M_GetNextParm(); // parse network game options, if (M_CheckParm("-server") || dedicated) From 1771c7c8ce163fe52e960bbccfb94eea9d48326b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 19 Dec 2019 10:25:54 -0500 Subject: [PATCH 23/23] Revert "Travis yflip error" This reverts commit 2a9a2c0f021b964f2955ec75f3526f638ae1e69d. --- src/hardware/r_opengl/r_opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 0887a0fb5..129bf5678 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1519,7 +1519,7 @@ static void gld_BuildSky(int row_count, int col_count) vertex_p = &vbo->data[0]; vbo->loopcount = 0; - for (yflip = 0; (UINT8)yflip < 2; yflip++) + for (yflip = 0; yflip < 2; yflip++) { vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_FAN; vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0];