Merge branch 'next' of https://git.do.srb2.org/STJr/SRB2 into ogl-palette-rendering

This commit is contained in:
SteelT 2024-02-19 16:04:47 -05:00
commit 91980907b9
10 changed files with 54 additions and 30 deletions

View file

@ -120,7 +120,7 @@ static void CONS_backcolor_Change(void);
#ifdef macintosh #ifdef macintosh
#define CON_BUFFERSIZE 4096 // my compiler can't handle local vars >32k #define CON_BUFFERSIZE 4096 // my compiler can't handle local vars >32k
#else #else
#define CON_BUFFERSIZE 16384 #define CON_BUFFERSIZE 32768
#endif #endif
static char con_buffer[CON_BUFFERSIZE]; static char con_buffer[CON_BUFFERSIZE];

View file

@ -121,7 +121,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
memcpy(dest, &texelu16, sizeof(UINT16)); memcpy(dest, &texelu16, sizeof(UINT16));
break; break;
case 3: case 3:
colortemp = V_GetColor(texel); colortemp = palette[texel];
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
@ -131,7 +131,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
case 4: case 4:
colortemp = V_GetColor(texel); colortemp = palette[texel];
colortemp.s.alpha = alpha; colortemp.s.alpha = alpha;
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
{ {
@ -225,7 +225,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
memcpy(dest, &texelu16, sizeof(UINT16)); memcpy(dest, &texelu16, sizeof(UINT16));
break; break;
case 3: case 3:
colortemp = V_GetColor(texel); colortemp = palette[texel];
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
@ -235,7 +235,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
case 4: case 4:
colortemp = V_GetColor(texel); colortemp = palette[texel];
colortemp.s.alpha = alpha; colortemp.s.alpha = alpha;
if ((originPatch != NULL) && (originPatch->style != AST_COPY)) if ((originPatch != NULL) && (originPatch->style != AST_COPY))
{ {
@ -830,18 +830,13 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum)
void HWR_GetLevelFlat(levelflat_t *levelflat) void HWR_GetLevelFlat(levelflat_t *levelflat)
{ {
if (levelflat->type == LEVELFLAT_NONE) if (levelflat->type == LEVELFLAT_NONE || levelflat->texture_id < 0)
{ {
HWR_SetCurrentTexture(NULL); HWR_SetCurrentTexture(NULL);
return; return;
} }
INT32 texturenum = texturetranslation[levelflat->texture_id]; INT32 texturenum = texturetranslation[levelflat->texture_id];
if (texturenum <= 0)
{
HWR_SetCurrentTexture(NULL);
return;
}
GLMapTexture_t *grtex = &gl_flats[texturenum]; GLMapTexture_t *grtex = &gl_flats[texturenum];
GLMipmap_t *grMipmap = &grtex->mipmap; GLMipmap_t *grMipmap = &grtex->mipmap;

View file

@ -620,7 +620,7 @@ static void Command_CSay_f(void)
DoSayCommand(0, 1, HU_CSAY); DoSayCommand(0, 1, HU_CSAY);
} }
static tic_t spam_tokens[MAXPLAYERS]; static tic_t spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent.
static tic_t spam_tics[MAXPLAYERS]; static tic_t spam_tics[MAXPLAYERS];
/** Receives a message, processing an ::XD_SAY command. /** Receives a message, processing an ::XD_SAY command.

View file

@ -1098,15 +1098,23 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
fixed_t fheight = P_GetSectorFloorZAt(sec, mt->x << FRACBITS, mt->y << FRACBITS); fixed_t fheight = P_GetSectorFloorZAt(sec, mt->x << FRACBITS, mt->y << FRACBITS);
mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS); mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
} }
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value; mt->options = (UINT16)cv_opflags.value;
mt->scale = player->mo->scale; mt->scale = player->mo->scale;
mt->spritexscale = player->mo->spritexscale; mt->spritexscale = player->mo->spritexscale;
mt->spriteyscale = player->mo->spriteyscale; mt->spriteyscale = player->mo->spriteyscale;
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args)); memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs)); memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
mt->pitch = mt->roll = 0; mt->pitch = mt->roll = 0;
// Ignore offsets
if (mt->type == MT_EMBLEM)
mt->args[1] = 1;
else
mt->args[0] = 1;
return mt; return mt;
} }

View file

@ -394,7 +394,7 @@ consvar_t cv_ps_descriptor = CVAR_INIT ("ps_descriptor", "Average", 0, ps_descri
consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_freedemocamera = CVAR_INIT("freedemocamera", "Off", CV_SAVE, CV_OnOff, NULL);
// NOTE: this should be in hw_main.c, but we can't put it there as it breaks dedicated build // NOTE: this should be in hw_main.c, but we can't put it there as it breaks dedicated build
consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowclientshaders", "On", CV_NETVAR, CV_OnOff, NULL); consvar_t cv_glallowshaders = CVAR_INIT ("gr_allowcustomshaders", "On", CV_NETVAR, CV_OnOff, NULL);
char timedemo_name[256]; char timedemo_name[256];
boolean timedemo_csv; boolean timedemo_csv;
@ -4663,15 +4663,28 @@ static void Command_Cheats_f(void)
CV_ResetCheatNetVars(); CV_ResetCheatNetVars();
return; return;
} }
else if (COM_CheckParm("on"))
{
if (!(server || (IsPlayerAdmin(consoleplayer))))
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
else
G_SetUsedCheats(false);
return;
}
if (usedCheats)
CONS_Printf(M_GetText("Cheats are enabled, the game cannot be saved.\n"));
else
CONS_Printf(M_GetText("Cheats are disabled, the game can be saved.\n"));
if (CV_CheatsEnabled()) if (CV_CheatsEnabled())
{ {
CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed -- Cheats are enabled.\n")); CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed.\n"));
if (server || (IsPlayerAdmin(consoleplayer))) if (server || (IsPlayerAdmin(consoleplayer)))
CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.\n")); CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.\n"));
} }
else else
CONS_Printf(M_GetText("No CHEAT-marked variables are changed -- Cheats are disabled.\n")); CONS_Printf(M_GetText("No CHEAT-marked variables are changed.\n"));
} }
#ifdef _DEBUG #ifdef _DEBUG

View file

@ -298,8 +298,14 @@ init_upnpc_once(struct upnpdata *upnpuserdata)
}; };
struct UPNPDev * devlist = NULL; struct UPNPDev * devlist = NULL;
int upnp_error = -2; int upnp_error = -2;
int scope_id = 0;
int status_code = 0;
memset(&urls, 0, sizeof(struct UPNPUrls));
memset(&data, 0, sizeof(struct IGDdatas));
CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n")); CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n"));
devlist = upnpDiscover(2000, NULL, NULL, 0, false, &upnp_error); devlist = upnpDiscoverDevices(deviceTypes, 500, NULL, NULL, 0, false, 2, &upnp_error, 0);
if (devlist) if (devlist)
{ {
struct UPNPDev *dev = devlist; struct UPNPDev *dev = devlist;
@ -319,15 +325,13 @@ init_upnpc_once(struct upnpdata *upnpuserdata)
UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
CONS_Printf(M_GetText("Local LAN IP address: %s\n"), lanaddr); CONS_Printf(M_GetText("Local LAN IP address: %s\n"), lanaddr);
descXML = miniwget(dev->descURL, &descXMLsize); descXML = miniwget(dev->descURL, &descXMLsize, scope_id, &status_code);
if (descXML) if (descXML)
{ {
parserootdesc(descXML, descXMLsize, &data); parserootdesc(descXML, descXMLsize, &data);
free(descXML); free(descXML);
descXML = NULL; descXML = NULL;
memset(&urls, 0, sizeof(struct UPNPUrls)); GetUPNPUrls(&urls, &data, dev->descURL, status_code);
memset(&data, 0, sizeof(struct IGDdatas));
GetUPNPUrls(&urls, &data, dev->descURL);
I_AddExitFunc(I_ShutdownUPnP); I_AddExitFunc(I_ShutdownUPnP);
} }
freeUPNPDevlist(devlist); freeUPNPDevlist(devlist);

View file

@ -2329,9 +2329,9 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
if (mo->player && mo->player->pflags & PF_GODMODE) if (mo->player && mo->player->pflags & PF_GODMODE)
return false; return false;
if (((mo->z <= mo->subsector->sector->floorheight if (((mo->z <= mo->floorz
&& ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR)) && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR))
|| (mo->z + mo->height >= mo->subsector->sector->ceilingheight || (mo->z + mo->height >= mo->ceilingz
&& ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_CEILING))) && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_CEILING)))
&& (mo->subsector->sector->damagetype == SD_DEATHPITTILT && (mo->subsector->sector->damagetype == SD_DEATHPITTILT
|| mo->subsector->sector->damagetype == SD_DEATHPITNOTILT)) || mo->subsector->sector->damagetype == SD_DEATHPITNOTILT))
@ -10869,9 +10869,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
))) )))
mobj->flags2 |= MF2_DONTRESPAWN; mobj->flags2 |= MF2_DONTRESPAWN;
if (!(mobj->flags & MF_NOTHINK))
P_AddThinker(THINK_MOBJ, &mobj->thinker);
if (type == MT_PLAYER) if (type == MT_PLAYER)
{ {
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj. // when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
@ -10881,6 +10878,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
va_end(args); va_end(args);
} }
if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN))
P_AddThinker(THINK_MOBJ, &mobj->thinker);
// increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj // increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj
mobj->thinker.references++; mobj->thinker.references++;

View file

@ -585,17 +585,17 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
// Look for a flat // Look for a flat
int texturenum = R_CheckFlatNumForName(levelflat->name); int texturenum = R_CheckFlatNumForName(levelflat->name);
if (texturenum <= 0) if (texturenum < 0)
{ {
// If we can't find a flat, try looking for a texture! // If we can't find a flat, try looking for a texture!
texturenum = R_CheckTextureNumForName(levelflat->name); texturenum = R_CheckTextureNumForName(levelflat->name);
if (texturenum <= 0) if (texturenum < 0)
{ {
// Use "not found" texture // Use "not found" texture
texturenum = R_CheckTextureNumForName("REDWALL"); texturenum = R_CheckTextureNumForName("REDWALL");
// Give up? // Give up?
if (texturenum <= 0) if (texturenum < 0)
{ {
levelflat->type = LEVELFLAT_NONE; levelflat->type = LEVELFLAT_NONE;
texturenum = -1; texturenum = -1;

View file

@ -441,7 +441,7 @@ static void R_DrawRepeatMaskedColumn(column_t *col, unsigned lengthcol)
{ {
while (sprtopscreen < sprbotscreen) { while (sprtopscreen < sprbotscreen) {
R_DrawMaskedColumn(col, lengthcol); R_DrawMaskedColumn(col, lengthcol);
if ((INT64)sprtopscreen + dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow
sprtopscreen = INT32_MAX; sprtopscreen = INT32_MAX;
else else
sprtopscreen += dc_texheight*spryscale; sprtopscreen += dc_texheight*spryscale;

View file

@ -193,6 +193,8 @@ static void R_DrawBlendColumnInCache(column_t *column, UINT8 *cache, texpatch_t
{ {
for (; dest < cache + position + count; source++, dest++, is_opaque++) for (; dest < cache + position + count; source++, dest++, is_opaque++)
{ {
if (originPatch->alpha <= ASTTextureBlendingThreshold[1] && !(*is_opaque))
continue;
*dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha);
*is_opaque = true; *is_opaque = true;
} }
@ -237,6 +239,8 @@ static void R_DrawBlendFlippedColumnInCache(column_t *column, UINT8 *cache, texp
{ {
for (; dest < cache + position + count; --source, dest++, is_opaque++) for (; dest < cache + position + count; --source, dest++, is_opaque++)
{ {
if (originPatch->alpha <= ASTTextureBlendingThreshold[1] && !(*is_opaque))
continue;
*dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha); *dest = ASTBlendPaletteIndexes(*dest, *source, originPatch->style, originPatch->alpha);
*is_opaque = true; *is_opaque = true;
} }