diff --git a/README.md b/README.md index 36659251d..64012b510 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [SRB2Kart](https://srb2.org/mods/) is a kart racing mod based on the 3D Sonic the Hedgehog fangame [Sonic Robo Blast 2](https://srb2.org/), based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/). ## Saturn Features -- Player rotation on Slopes, funny squish when landing, Sprite scaling and all that +- Player rotation on slopes, funny squish when landing, Sprite scaling and all that - Kart Hud offsets are user changable -- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, much better performance +- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, for much better performance with many Lua scripts - Lua shows tracebacks whenever an error occurs - The Lua perfstat page now has multiple pages and is more organized (ps_thinkframe_page X) - "addfilelocal" Command, for those who want to use their custom hud in netgames (Same as addfile but completely client sided) @@ -15,16 +15,16 @@ - Lua hooks for Intermission - Timeout for waiting to join a full server is configurable now - Higher/configurable addon download speed -- Visual Portals from haya´s HEP Client -- Everything that galaxy has +- Visual Portals from Haya´s HEP Client +- Everything that Galaxy has -Techical Stuff: +## Technical Stuff: - ZFigthing Textures in Opengl mode have been fixed in engine (well almost all of it) - Fof´s intersecting with slopes have less issues and now render correctly in Opengl -- Midtextures on slopes in Opengl arent broken anymore, all those weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone. +- Midtextures on slopes in Opengl are fixed, all those weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone - Multiple other fixes/optimizations like 3D floor clipping in software mode -- Zone memory allocations have been rewritten +- Zone memory allocations have been rewritten, speeds up some map loading, and may improve performance on busy maps - The annoying depraction messages for "P_TeleportMove" and "P_AproxDistance" have been silenced ## Bugs diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 775034fa8..ebd126b46 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3888,7 +3888,7 @@ consvar_t cv_noticedownload = {"noticedownload", "Off", CV_SAVE, CV_OnOff, NULL, // Speed of file downloading (in packets per tic) static CV_PossibleValue_t downloadspeed_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; -consvar_t cv_downloadspeed = {"downloadspeed", "MAX", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}}; consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/doomtype.h b/src/doomtype.h index f4f32edc8..27278f0cf 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -164,9 +164,13 @@ char *strcasestr(const char *in, const char *what); #define HAVE_DOSSTR_FUNCS #endif -// glibc 2.38: added strlcpy and strlcat to _DEFAULT_SOURCE -#if defined (__APPLE__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) -#define HAVE_STRLCPY +#if defined (__APPLE__) + #define SRB2_HAVE_STRLCPY +#elif defined (__GLIBC_PREREQ) + // glibc 2.38: added strlcpy and strlcat to _DEFAULT_SOURCE + #if __GLIBC_PREREQ(2, 38) + #define SRB2_HAVE_STRLCPY + #endif #endif #ifndef HAVE_DOSSTR_FUNCS @@ -176,7 +180,7 @@ int strlwr(char *n); // from dosstr.c #include // for size_t -#ifndef HAVE_STRLCPY +#ifndef SRB2_HAVE_STRLCPY size_t strlcat(char *dst, const char *src, size_t siz); size_t strlcpy(char *dst, const char *src, size_t siz); #endif diff --git a/src/g_game.c b/src/g_game.c index 69fd74cf0..9e0325e01 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -537,8 +537,8 @@ consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_c static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}}; consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t stretchfactor_t[] = {{FRACUNIT/5, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; -consvar_t cv_gravstretch = {"gravstretch", "1", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; +consvar_t cv_gravstretch = {"gravstretch", "0", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -556,9 +556,9 @@ consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resetspecialmusic = {"resetspecialmusic", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resume = {"resume", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fading = {"fading", "On", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resetspecialmusic = {"resetspecialmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resume = {"resume", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_fading = {"fading", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; #if MAXPLAYERS > 16 #error "please update player_name table using the new value for MAXPLAYERS" diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 3663f3f68..1950a10da 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -80,4 +80,14 @@ extern consvar_t cv_grrounddown; // on/off extern INT32 patchformat; extern INT32 textureformat; +// -------- +// hw_main.c // originally hw_drawnodes.c from HWPortal branch +// -------- +void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); +void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap); +void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, + INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap); + +void HWR_RenderDrawNodes(void); + #endif //_HW_GLOB_ \ No newline at end of file diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0221aa4d4..9145a6ba9 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -94,6 +94,10 @@ consvar_t cv_grportals = {"gr_portals", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, consvar_t cv_nostencil = {"nostencil", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_portalline = {"portalline", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_portalonly = {"portalonly", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +CV_PossibleValue_t secbright_cons_t[] = {{0, "MIN"}, {255, "MAX"}, {0, NULL}}; +consvar_t cv_secbright = {"secbright", "0", CV_SAVE, secbright_cons_t, + NULL, 0, NULL, NULL, 0, 0, NULL}; + // values for the far clipping plane static float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f}; // values for bsp culling @@ -197,8 +201,6 @@ static fixed_t dup_viewx, dup_viewy, dup_viewz; static angle_t gr_aimingangle; static float gr_viewludsin, gr_viewludcos; -static INT32 drawcount = 0; - // // PORTALS // @@ -441,7 +443,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col } // Clamp the light level, since it can sometimes go out of the 0-255 range from animations - light_level = min(max(light_level, 0), 255); + light_level = min(max(light_level, cv_secbright.value), 255); Surface->PolyColor.rgba = poly_color.rgba; Surface->TintColor.rgba = tint_color.rgba; @@ -1131,7 +1133,7 @@ void HWR_DrawSkyWallList() // Draw walls into the depth buffer so that anything behind is culled properly void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf) { - HWD.pfnSetTexture(NULL); + //HWD.pfnSetTexture(NULL); // no texture wallVerts[3].t = wallVerts[2].t = 0; wallVerts[0].t = wallVerts[1].t = 0; @@ -2448,8 +2450,6 @@ void HWR_AddLine(seg_t *line) // do an extra culling check when rendering portals // check if any line vertex is on the viewable side of the portal target line // if not, the line can be culled. - // TODO this didnt help so maybe this should be removed - // disabled for now, probably coming back to this if bsp bounding box stuff isnt enough if (portalclipline)// portalclipline should be NULL when we are not rendering portal contents { vertex_t closest_point; @@ -3404,6 +3404,7 @@ boolean HWR_PortalCheckBBox(fixed_t *bspcoord) vertex_t closest_point; if (!portalclipline) return true; + // we are looking for a bounding box corner that is on the viewable side of the portal exit. // being exactly on the portal exit line is not enough to pass the test. // P_PointOnLineSide could behave differently from this expectation on this case, @@ -4457,15 +4458,11 @@ typedef struct FSurfaceInfo Surf; INT32 texnum; FBITFIELD blend; - INT32 drawcount; boolean fogwall; INT32 lightlevel; extracolormap_t *wallcolormap; // Doing the lighting in HWR_RenderWall now for correct fog after sorting } wallinfo_t; -static wallinfo_t *wallinfo = NULL; -static size_t numwalls = 0; // a list of transparent walls to be drawn - typedef struct { extrasubsector_t *xsub; @@ -4478,12 +4475,8 @@ typedef struct FBITFIELD blend; boolean fogplane; extracolormap_t *planecolormap; - INT32 drawcount; } planeinfo_t; -static size_t numplanes = 0; // a list of transparent floors to be drawn -static planeinfo_t *planeinfo = NULL; - typedef struct { polyobj_t *polysector; @@ -4495,198 +4488,164 @@ typedef struct sector_t *FOFSector; FBITFIELD blend; extracolormap_t *planecolormap; - INT32 drawcount; } polyplaneinfo_t; -static size_t numpolyplanes = 0; // a list of transparent poyobject floors to be drawn -static polyplaneinfo_t *polyplaneinfo = NULL; - -typedef struct gr_drawnode_s +typedef enum { - planeinfo_t *plane; - polyplaneinfo_t *polyplane; - wallinfo_t *wall; - gr_vissprite_t *sprite; + DRAWNODE_PLANE, + DRAWNODE_POLYOBJECT_PLANE, + DRAWNODE_WALL +} gr_drawnode_type_t; + +typedef struct +{ + gr_drawnode_type_t type; + union { + planeinfo_t plane; + polyplaneinfo_t polyplane; + wallinfo_t wall; + } u; } gr_drawnode_t; -#define MAX_TRANSPARENTWALL 256 -#define MAX_TRANSPARENTFLOOR 512 +// initial size of drawnode array +#define DRAWNODES_INIT_SIZE 64 +gr_drawnode_t *drawnodes = NULL; +INT32 numdrawnodes = 0; +INT32 alloceddrawnodes = 0; -// This will likely turn into a copy of HWR_Add3DWater and replace it. -void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) +static void *HWR_CreateDrawNode(gr_drawnode_type_t type) { - static size_t allocedplanes = 0; + gr_drawnode_t *drawnode; - // Force realloc if buffer has been freed - if (!planeinfo) - allocedplanes = 0; - - if (allocedplanes < numplanes + 1) + if (!drawnodes) { - allocedplanes += MAX_TRANSPARENTFLOOR; - Z_Realloc(planeinfo, allocedplanes * sizeof (*planeinfo), PU_LEVEL, &planeinfo); + alloceddrawnodes = DRAWNODES_INIT_SIZE; + drawnodes = Z_Malloc(alloceddrawnodes * sizeof(gr_drawnode_t), PU_LEVEL, &drawnodes); + } + else if (numdrawnodes >= alloceddrawnodes) + { + alloceddrawnodes *= 2; + Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gr_drawnode_t), PU_LEVEL, &drawnodes); } - planeinfo[numplanes].isceiling = isceiling; - planeinfo[numplanes].fixedheight = fixedheight; - planeinfo[numplanes].lightlevel = lightlevel; - planeinfo[numplanes].lumpnum = lumpnum; - planeinfo[numplanes].xsub = xsub; - planeinfo[numplanes].alpha = alpha; - planeinfo[numplanes].FOFSector = FOFSector; - planeinfo[numplanes].blend = blend; - planeinfo[numplanes].fogplane = fogplane; - planeinfo[numplanes].planecolormap = planecolormap; - planeinfo[numplanes].drawcount = drawcount++; - numplanes++; + drawnode = &drawnodes[numdrawnodes++]; + drawnode->type = type; + + // not sure if returning different pointers to a union is necessary + switch (type) + { + case DRAWNODE_PLANE: + return &drawnode->u.plane; + case DRAWNODE_POLYOBJECT_PLANE: + return &drawnode->u.polyplane; + case DRAWNODE_WALL: + return &drawnode->u.wall; + } + return NULL; +} + +void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) +{ + wallinfo_t *wallinfo = HWR_CreateDrawNode(DRAWNODE_WALL); + + M_Memcpy(wallinfo->wallVerts, wallVerts, sizeof (wallinfo->wallVerts)); + M_Memcpy(&wallinfo->Surf, pSurf, sizeof (FSurfaceInfo)); + wallinfo->texnum = texnum; + wallinfo->blend = blend; + wallinfo->fogwall = fogwall; + wallinfo->lightlevel = lightlevel; + wallinfo->wallcolormap = wallcolormap; +} + +void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap) +{ + planeinfo_t *planeinfo = HWR_CreateDrawNode(DRAWNODE_PLANE); + + planeinfo->isceiling = isceiling; + planeinfo->fixedheight = fixedheight; + planeinfo->lightlevel = lightlevel; + planeinfo->lumpnum = lumpnum; + planeinfo->xsub = xsub; + planeinfo->alpha = alpha; + planeinfo->FOFSector = FOFSector; + planeinfo->blend = blend; + planeinfo->fogplane = fogplane; + planeinfo->planecolormap = planecolormap; } // Adding this for now until I can create extrasubsector info for polyobjects // When that happens it'll just be done through HWR_AddTransparentFloor and HWR_RenderPlane void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap) { - static size_t allocedpolyplanes = 0; + polyplaneinfo_t *polyplaneinfo = HWR_CreateDrawNode(DRAWNODE_POLYOBJECT_PLANE); - // Force realloc if buffer has been freed - if (!polyplaneinfo) - allocedpolyplanes = 0; - - if (allocedpolyplanes < numpolyplanes + 1) - { - allocedpolyplanes += MAX_TRANSPARENTFLOOR; - Z_Realloc(polyplaneinfo, allocedpolyplanes * sizeof (*polyplaneinfo), PU_LEVEL, &polyplaneinfo); - } - - polyplaneinfo[numpolyplanes].isceiling = isceiling; - polyplaneinfo[numpolyplanes].fixedheight = fixedheight; - polyplaneinfo[numpolyplanes].lightlevel = lightlevel; - polyplaneinfo[numpolyplanes].lumpnum = lumpnum; - polyplaneinfo[numpolyplanes].polysector = polysector; - polyplaneinfo[numpolyplanes].alpha = alpha; - polyplaneinfo[numpolyplanes].FOFSector = FOFSector; - polyplaneinfo[numpolyplanes].blend = blend; - polyplaneinfo[numpolyplanes].planecolormap = planecolormap; - polyplaneinfo[numpolyplanes].drawcount = drawcount++; - numpolyplanes++; -} - -// putting sortindex and sortnode here so the comparator function can see them -gr_drawnode_t *sortnode; -size_t *sortindex; - -static int CompareDrawNodes(const void *p1, const void *p2) -{ - size_t n1 = *(const size_t*)p1; - size_t n2 = *(const size_t*)p2; - INT32 v1 = 0; - INT32 v2 = 0; - INT32 diff; - if (sortnode[n1].plane) - v1 = sortnode[n1].plane->drawcount; - else if (sortnode[n1].polyplane) - v1 = sortnode[n1].polyplane->drawcount; - else if (sortnode[n1].wall) - v1 = sortnode[n1].wall->drawcount; - else I_Error("n1 unknown"); - - if (sortnode[n2].plane) - v2 = sortnode[n2].plane->drawcount; - else if (sortnode[n2].polyplane) - v2 = sortnode[n2].polyplane->drawcount; - else if (sortnode[n2].wall) - v2 = sortnode[n2].wall->drawcount; - else I_Error("n2 unknown"); - - diff = v2 - v1; - if (diff == 0) I_Error("diff is zero"); - return diff; + polyplaneinfo->isceiling = isceiling; + polyplaneinfo->fixedheight = fixedheight; + polyplaneinfo->lightlevel = lightlevel; + polyplaneinfo->lumpnum = lumpnum; + polyplaneinfo->polysector = polysector; + polyplaneinfo->alpha = alpha; + polyplaneinfo->FOFSector = FOFSector; + polyplaneinfo->blend = blend; + polyplaneinfo->planecolormap = planecolormap; } static int CompareDrawNodePlanes(const void *p1, const void *p2) { - size_t n1 = *(const size_t*)p1; - size_t n2 = *(const size_t*)p2; - if (!sortnode[n1].plane) I_Error("Uh.. This isn't a plane! (n1)"); - if (!sortnode[n2].plane) I_Error("Uh.. This isn't a plane! (n2)"); - return ABS(sortnode[n2].plane->fixedheight - viewz) - ABS(sortnode[n1].plane->fixedheight - viewz); + INT32 n1 = *(const INT32*)p1; + INT32 n2 = *(const INT32*)p2; + + return ABS(drawnodes[n2].u.plane.fixedheight - viewz) - ABS(drawnodes[n1].u.plane.fixedheight - viewz); } +// // HWR_RenderDrawNodes -// Creates, sorts and renders a list of drawnodes for the current frame. +// Sorts and renders the list of drawnodes for the scene being rendered. void HWR_RenderDrawNodes(void) { - UINT32 i = 0, p = 0; - size_t run_start = 0; + INT32 i = 0, run_start = 0; - // Dump EVERYTHING into a huge drawnode list. Then we'll sort it! - // Could this be optimized into _AddTransparentWall/_AddTransparentPlane? - // Hell yes! But sort algorithm must be modified to use a linked list. - sortnode = Z_Calloc((sizeof(planeinfo_t)*numplanes) - + (sizeof(polyplaneinfo_t)*numpolyplanes) - + (sizeof(wallinfo_t)*numwalls) - ,PU_STATIC, NULL); - // todo: - // However, in reality we shouldn't be re-copying and shifting all this information - // that is already lying around. This should all be in some sort of linked list or lists. - sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL); + // Array for storing the rendering order. + // A list of indices into the drawnodes array. + INT32 *sortindex; + + if (!numdrawnodes) + return; + + ps_numdrawnodes.value.i = numdrawnodes; PS_START_TIMING(ps_hw_nodesorttime); - for (i = 0; i < numplanes; i++, p++) - { - sortnode[p].plane = &planeinfo[i]; - sortindex[p] = p; - } + sortindex = Z_Malloc(sizeof(INT32) * numdrawnodes, PU_STATIC, NULL); - for (i = 0; i < numpolyplanes; i++, p++) - { - sortnode[p].polyplane = &polyplaneinfo[i]; - sortindex[p] = p; - } + // Reversed order + for (i = 0; i < numdrawnodes; i++) + sortindex[i] = numdrawnodes - i - 1; - for (i = 0; i < numwalls; i++, p++) - { - sortnode[p].wall = &wallinfo[i]; - sortindex[p] = p; - } - - ps_numdrawnodes.value.i = p; - - // p is the number of stuff to sort - - // Add the 3D floors, thicksides, and masked textures... - // Instead of going through drawsegs, we need to iterate - // through the lists of masked textures and - // translucent ffloors being drawn. - - // im not sure if this sort on the next line is needed. - // it sorts the list based on the value of the 'drawcount' member of the drawnodes. - // im thinking the list might already be in that order, but i havent bothered to check yet. - // anyway doing this sort does not hurt and does not take much time. - // the while loop after this sort is important however! - qsort(sortindex, p, sizeof(size_t), CompareDrawNodes); - - // try solving floor order here. for each consecutive run of floors in the list, sort that run. - while (run_start < p-1)// p-1 because a 1 plane run at the end of the list does not count + // The order is correct apart from planes in the same subsector. + // So scan the list and sort out these cases. + // For each consecutive run of planes in the list, sort that run based on + // plane height and view height. + while (run_start < numdrawnodes-1) // numdrawnodes-1 because a 1 plane run at the end of the list does not count { // locate run start - if (sortnode[sortindex[run_start]].plane) + if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE) { // found it, now look for run end - size_t run_end;// (inclusive) - for (i = run_start+1; i < p; i++)// size_t and UINT32 being used mixed here... shouldnt break anything though.. + INT32 run_end; // (inclusive) + + for (i = run_start+1; i < numdrawnodes; i++) { - if (!sortnode[sortindex[i]].plane) break; + if (drawnodes[sortindex[i]].type != DRAWNODE_PLANE) break; } run_end = i-1; - if (run_end > run_start)// if there are multiple consecutive planes, not just one + if (run_end > run_start) // if there are multiple consecutive planes, not just one { // consecutive run of planes found, now sort it - // not sure how long these runs can be in reality... - qsort(sortindex + run_start, run_end - run_start + 1, sizeof(size_t), CompareDrawNodePlanes); + qsort(sortindex + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes); } - run_start = run_end + 1;// continue looking for runs coming right after this one + run_start = run_end + 1; // continue looking for runs coming right after this one } else { @@ -4701,50 +4660,54 @@ void HWR_RenderDrawNodes(void) // Okay! Let's draw it all! Woo! HWD.pfnSetTransform(&atransform); - HWD.pfnSetShader(0); - for (i = 0; i < p; i++) + for (i = 0; i < numdrawnodes; i++) { - if (sortnode[sortindex[i]].plane) + gr_drawnode_t *drawnode = &drawnodes[sortindex[i]]; + + if (drawnode->type == DRAWNODE_PLANE) { - // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. + planeinfo_t *plane = &drawnode->u.plane; + + // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. gr_frontsector = NULL; - if (!(sortnode[sortindex[i]].plane->blend & PF_NoTexture)) - HWR_GetFlat(sortnode[sortindex[i]].plane->lumpnum, R_NoEncore(sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->isceiling)); - HWR_RenderPlane(sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->isceiling, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel, - sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, /*sortnode[sortindex[i]].plane->fogplane,*/ sortnode[sortindex[i]].plane->planecolormap, NULL); + if (!(plane->blend & PF_NoTexture)) + HWR_GetFlat(plane->lumpnum, R_NoEncore(plane->FOFSector, plane->isceiling)); + HWR_RenderPlane(plane->xsub, plane->isceiling, plane->fixedheight, plane->blend, plane->lightlevel, + plane->lumpnum, plane->FOFSector, plane->alpha, plane->planecolormap, NULL); } - else if (sortnode[sortindex[i]].polyplane) + else if (drawnode->type == DRAWNODE_POLYOBJECT_PLANE) { - // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. + polyplaneinfo_t *polyplane = &drawnode->u.polyplane; + + // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. gr_frontsector = NULL; - if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture)) - HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum, R_NoEncore(sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->isceiling)); - HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->isceiling, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel, - sortnode[sortindex[i]].polyplane->lumpnum, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap); + if (!(polyplane->blend & PF_NoTexture)) + HWR_GetFlat(polyplane->lumpnum, R_NoEncore(polyplane->FOFSector, polyplane->isceiling)); + HWR_RenderPolyObjectPlane(polyplane->polysector, polyplane->isceiling, polyplane->fixedheight, polyplane->blend, polyplane->lightlevel, + polyplane->lumpnum, polyplane->FOFSector, polyplane->alpha, polyplane->planecolormap); } - else if (sortnode[sortindex[i]].wall) + else if (drawnode->type == DRAWNODE_WALL) { - if (!(sortnode[sortindex[i]].wall->blend & PF_NoTexture)) - HWR_GetTexture(sortnode[sortindex[i]].wall->texnum); - HWR_RenderWall(sortnode[sortindex[i]].wall->wallVerts, &sortnode[sortindex[i]].wall->Surf, sortnode[sortindex[i]].wall->blend, sortnode[sortindex[i]].wall->fogwall, - sortnode[sortindex[i]].wall->lightlevel, sortnode[sortindex[i]].wall->wallcolormap); + wallinfo_t *wall = &drawnode->u.wall; + + if (!(wall->blend & PF_NoTexture)) + HWR_GetTexture(wall->texnum); + HWR_RenderWall(wall->wallVerts, &wall->Surf, wall->blend, wall->fogwall, + wall->lightlevel, wall->wallcolormap); } } - + PS_STOP_TIMING(ps_hw_nodedrawtime); - numwalls = 0; - numplanes = 0; - numpolyplanes = 0; + numdrawnodes = 0; - // No mem leaks, please. - Z_Free(sortnode); Z_Free(sortindex); } + // -------------------------------------------------------------------------- // Draw all vissprites // -------------------------------------------------------------------------- @@ -4936,7 +4899,9 @@ void HWR_ProjectSprite(mobj_t *thing) float gz, gzt; spritedef_t *sprdef; spriteframe_t *sprframe; +#ifdef ROTSPRITE spriteinfo_t *sprinfo; +#endif size_t lumpoff; unsigned rot; UINT8 flip; @@ -5025,6 +4990,9 @@ void HWR_ProjectSprite(mobj_t *thing) thing->sprite = states[S_UNKNOWN].sprite; thing->frame = states[S_UNKNOWN].frame; sprdef = &sprites[thing->sprite]; +#ifdef ROTSPRITE + sprinfo = &spriteinfo[thing->sprite]; +#endif rot = thing->frame&FF_FRAMEMASK; thing->state->sprite = thing->sprite; thing->state->frame = thing->frame; @@ -5566,19 +5534,7 @@ void HWR_ClearClipper(void) void HWR_PortalClipping(portal_t *portal) { angle_t angle1, angle2; -/* - fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t - seg_t *seg = portal->seg; - - v1x = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv1)->x); - v1y = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv1)->y); - v2x = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv2)->x); - v2y = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv2)->y); - - angle1 = R_PointToAngleEx(viewx, viewy, v1x, v1y); - angle2 = R_PointToAngleEx(viewx, viewy, v2x, v2y); -*/ line_t *line = &lines[portal->clipline]; angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y); @@ -5627,7 +5583,7 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * gl_drawing_stencil = true; HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, stencil_level); HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, HWD_PORTAL_STENCIL_SEGS); - gr_portal = GRPORTAL_STENCIL;// currently grportal_stencil and grportal_depth are not used, but it needs to be something else than "inside" or "search" + gr_portal = GRPORTAL_STENCIL; gr_frontsector = portal->seg->frontsector; validcount++; HWR_AddLine(portal->seg); @@ -5701,7 +5657,7 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * HWR_PortalFrame(rootportal);// for portalclipsector, it could have gone null from search HWR_PortalClipping(rootportal); } - drawcount = 0; + //drawcount = 0; validcount++; if (cv_grbatching.value) HWD.pfnStartBatching(); @@ -5742,8 +5698,7 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * gr_collect_skywalls = false; HWR_SortVisSprites(); HWR_DrawSprites(); - if (numplanes || numpolyplanes || numwalls) // Render translucent surfaces after everything, should be correct since portals are done depth first - HWR_RenderDrawNodes(); + HWR_RenderDrawNodes(); } // free memory from portal list allocated by calls to Add2Lines portal_temp = portallist.base; @@ -5876,7 +5831,7 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox) HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value); HWD.pfnSetShader(0); - drawcount = 0; + //drawcount = 0; validcount++; portalclipline = NULL; @@ -5926,8 +5881,7 @@ void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, play ps_numdrawnodes.value.i = 0; ps_hw_nodesorttime.value.p = 0; ps_hw_nodedrawtime.value.p = 0; - if (numplanes || numpolyplanes || numwalls) // Render FOFs and translucent walls after everything - HWR_RenderDrawNodes(); + HWR_RenderDrawNodes(); } // ========================================================================== @@ -5946,7 +5900,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) ClearColor.green = 0.0f; ClearColor.blue = 0.0f; ClearColor.alpha = 1.0f; - HWD.pfnClearBuffer(true, false, false, &ClearColor); } @@ -5995,6 +5948,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_nostencil); CV_RegisterVar(&cv_portalline); CV_RegisterVar(&cv_portalonly); + CV_RegisterVar(&cv_secbright); } // -------------------------------------------------------------------------- @@ -6048,31 +6002,6 @@ void HWR_Shutdown(void) HWD.pfnFlushScreenTextures(); } -void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) -{ - static size_t allocedwalls = 0; - - // Force realloc if buffer has been freed - if (!wallinfo) - allocedwalls = 0; - - if (allocedwalls < numwalls + 1) - { - allocedwalls += MAX_TRANSPARENTWALL; - Z_Realloc(wallinfo, allocedwalls * sizeof (*wallinfo), PU_LEVEL, &wallinfo); - } - - M_Memcpy(wallinfo[numwalls].wallVerts, wallVerts, sizeof (wallinfo[numwalls].wallVerts)); - M_Memcpy(&wallinfo[numwalls].Surf, pSurf, sizeof (FSurfaceInfo)); - wallinfo[numwalls].texnum = texnum; - wallinfo[numwalls].blend = blend; - wallinfo[numwalls].drawcount = drawcount++; - wallinfo[numwalls].fogwall = fogwall; - wallinfo[numwalls].lightlevel = lightlevel; - wallinfo[numwalls].wallcolormap = wallcolormap; - numwalls++; -} - void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap) { FBITFIELD blendmode = blend; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index ef461a094..0ee107048 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -177,6 +177,7 @@ extern consvar_t cv_grrenderdistance; extern consvar_t cv_grusecustomshaders; extern consvar_t cv_grportals; extern consvar_t cv_nostencil; +extern consvar_t cv_secbright; extern CV_PossibleValue_t granisotropicmode_cons_t[]; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 04fe8783e..fab81c3da 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1405,7 +1405,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) // Sryder: Fog // multiplies input colour by input alpha, and destination colour by input colour, then adds them pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); - pglAlphaFunc(GL_NOTEQUAL, 0.0f); + pglAlphaFunc(GL_ALWAYS, 0.0f); // Don't discard zero alpha fragments break; default : // must be 0, otherwise it's an error // No blending diff --git a/src/k_kart.c b/src/k_kart.c index 115eabea0..1f62f7c72 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3037,12 +3037,24 @@ static void K_StretchPlayerGravity(player_t *p) } } +static INT32 K_FindPlayerNum(player_t *plyr) +{ + INT32 i; + for(i = 0; i < 4; i++) + { + if (plyr == &players[displayplayers[i]]) + return i; + } + return 0; // technically defaulting to player 1 but fuck it +} + static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useReserves) { angle_t lookAngle = 0; angle_t zangle = 0; angle_t xydirection = 0; angle_t an; + INT32 pNum = K_FindPlayerNum(p); I_Assert(p != NULL); I_Assert(p->mo != NULL); @@ -3054,7 +3066,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes I_Assert(p->mo->reservexydir != NULL); } - lookAngle = R_PointToAngle(p->mo->x, p->mo->y); + lookAngle = R_PointToAngle2(camera[pNum].x, camera[pNum].y, p->mo->x, p->mo->y); if (!R_PointToDist(p->mo->x, p->mo->y)) @@ -3084,11 +3096,14 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes return FixedMul(zangle, FINESINE(an>>ANGLETOFINESHIFT)); } -static void K_RollPlayerBySlopes(player_t *p, boolean usedistance) { +static void K_RollPlayerBySlopes(player_t *p, boolean usedistance) +{ I_Assert(p->mo->subsector != NULL); I_Assert(p->mo->subsector->sector != NULL); - fixed_t p_dist = R_PointToDist(p->mo->x,p->mo->y); + INT32 pNum = K_FindPlayerNum(p); + + fixed_t p_dist = R_PointToDist2(p->mo->x, p->mo->y, camera[pNum].x, camera[pNum].y); fixed_t mos = mapobjectscale; fixed_t rolldist = cv_sloperolldist.value*mos; diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index d5843ff37..dc965851f 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -394,29 +394,18 @@ static int lib_cvRegisterVar(lua_State *L) cvar->PossibleValue = cvpv; } else FIELDERROR("PossibleValue", va("%s or CV_PossibleValue_t expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1))) + } else if (i == 5 || (k && fasticmp(k, "func"))) { + if (!lua_isfunction(L, 4)) + TYPEERROR("func", LUA_TFUNCTION) + lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange"); + I_Assert(lua_istable(L, 5)); + lua_pushvalue(L, 4); + lua_setfield(L, 5, cvar->name); + lua_pop(L, 1); + cvar->func = Lua_OnChange; } lua_pop(L, 1); } - - if (cvar->flags & CV_CALL) { - lua_rawgeti(L, 1, 5); // Push function, if it stored at field 5 - - if (lua_isnil(L, -1)) { // If it is nil, try to get at field "func" - lua_pop(L, 1); - lua_getfield(L, 1, "func"); - } - - if (!lua_isfunction(L, -1)) - TYPEERROR("func", LUA_TFUNCTION) - - lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange"); // Push table - I_Assert(lua_istable(L, -1)); - lua_pushvalue(L, -2); // Push func - lua_setfield(L, -2, cvar->name); // Pop func, add it to table - lua_pop(L, 2); // Pop table and func - cvar->func = Lua_OnChange; - } - #undef FIELDERROR #undef TYPEERROR diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 263a9c5cd..91f094b81 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -139,7 +139,7 @@ static const udata_field_t player_fields[] = { FIELD(player_t, awayviewmobj, udatalib_getter_mobj, player_awayviewmobj_setter), FIELD(player_t, awayviewtics, udatalib_getter_int32, player_awayviewtics_setter), FIELD(player_t, awayviewaiming, udatalib_getter_angle, udatalib_setter_angle), - FIELD(player_t, spectator, udatalib_getter_boolean, udatalib_setter_boolean), + FIELD(player_t, spectator, udatalib_getter_boolean, udatalib_setter_boolean_nocheck), // ffs FIELD(player_t, bot, udatalib_getter_uint8, player_bot_noset), FIELD(player_t, jointime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, spectatorreentry, udatalib_getter_tic, udatalib_setter_tic), diff --git a/src/lua_udatalib.c b/src/lua_udatalib.c index dd573f2f5..239e56e13 100644 --- a/src/lua_udatalib.c +++ b/src/lua_udatalib.c @@ -82,6 +82,10 @@ UDATALIB_SIMPLE_SETTER(const char*, luaL_checkstring) int udatalib_setter_boolean(lua_State *L) UDATALIB_SIMPLE_SETTER(boolean, luaL_checkboolean) +// ffs +int udatalib_setter_boolean_nocheck(lua_State *L) +UDATALIB_SIMPLE_SETTER(boolean, lua_toboolean) + int udatalib_setter_spritenum(lua_State *L) UDATALIB_SIMPLE_SETTER(spritenum_t, (spritenum_t)luaL_checkinteger) diff --git a/src/lua_udatalib.h b/src/lua_udatalib.h index 1b73113eb..30fb0d3a9 100644 --- a/src/lua_udatalib.h +++ b/src/lua_udatalib.h @@ -62,6 +62,7 @@ int udatalib_setter_uint64(lua_State *L); int udatalib_setter_int64(lua_State *L); int udatalib_setter_string(lua_State *L); int udatalib_setter_boolean(lua_State *L); +int udatalib_setter_boolean_nocheck(lua_State *L); int udatalib_setter_spritenum(lua_State *L); int udatalib_setter_mobj(lua_State *L); int udatalib_setter_playerstate(lua_State *L); diff --git a/src/m_menu.c b/src/m_menu.c index e70ab967f..33e3decbd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1689,9 +1689,10 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Addon Download Speed", &cv_downloadspeed, 55}, {IT_STRING | IT_CVAR, NULL, "Less Flicker effects", &cv_lessflicker, 70}, {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 80}, - - {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 100}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 115}, + {IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 90}, + + {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 110}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 125}, //{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 130}, }; diff --git a/src/p_mobj.c b/src/p_mobj.c index 8d923b30f..f29a63f43 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10016,9 +10016,7 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster) } // Sprite rendering - mobj->realxscale = mobj->realyscale = mobj->scale; - mobj->spritexscale = mobj->realxscale; - mobj->spriteyscale = mobj->realyscale; + mobj->spritexscale = mobj->spriteyscale = mobj->scale; mobj->spritexoffset = mobj->spriteyoffset = 0; // set subsector and/or block links diff --git a/src/p_user.c b/src/p_user.c index cb4403433..700671ef6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1692,6 +1692,8 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->tics = -1; ghost->frame &= ~FF_TRANSMASK; ghost->frame |= tr_trans50<sloperoll = mobj->sloperoll; + ghost->fuse = ghost->info->damage; ghost->skin = mobj->skin; diff --git a/src/s_sound.c b/src/s_sound.c index f00d704bf..8627903d5 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -138,10 +138,10 @@ consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", C #ifdef HAVE_OPENMPT openmpt_module *openmpt_mhandle = NULL; static CV_PossibleValue_t interpolationfilter_cons_t[] = {{0, "Default"}, {1, "None"}, {2, "Linear"}, {4, "Cubic"}, {8, "Windowed sinc"}, {0, NULL}}; -consvar_t cv_modfilter = {"modfilter", "0", CV_SAVE|CV_CALL, interpolationfilter_cons_t, ModFilter_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_modfilter = {"modfilter", "4", CV_SAVE|CV_CALL, interpolationfilter_cons_t, ModFilter_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t amigafilter_cons_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}}; -consvar_t cv_amigafilter = {"amigafilter", "0", CV_SAVE|CV_CALL, amigafilter_cons_t, AmigaFilter_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_amigafilter = {"amigafilter", "1", CV_SAVE|CV_CALL, amigafilter_cons_t, AmigaFilter_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif #define S_MAX_VOLUME 127 diff --git a/src/string.c b/src/string.c index 34c5e71aa..c919ec804 100644 --- a/src/string.c +++ b/src/string.c @@ -16,7 +16,7 @@ #include #include "doomdef.h" -#ifndef HAVE_STRLCPY +#ifndef SRB2_HAVE_STRLCPY // Like the OpenBSD version, but it doesn't check for src not being a valid // C string.