Merge branch 'Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2025-01-22 15:47:41 +01:00
commit 114eab952b
5 files changed
+76 -97

No files matched your search

+1 -1
View File
@@ -1189,7 +1189,7 @@ static void G_DoLoadLevel(boolean resetplayer)
// Saturn Music Feature stuffs
S_ResetKeepAndSpecialMus();
S_CheckMap();
S_KeepMusic();
// Make sure objectplace is OFF when you first start the level!
OP_ResetObjectplace();
+53 -34
View File
@@ -2872,7 +2872,7 @@ static void HWR_Subsector(size_t num)
{
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || !(rover->flags & FF_RENDERALL))
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
continue;
if (sub->validcount == validcount)
@@ -3925,7 +3925,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
}
// Sprite drawer for precipitation
static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
{
FBITFIELD blend = 0;
FOutVector wallVerts[4];
@@ -3934,10 +3934,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
INT32 shader = SHADER_NONE;
if (!spr->mobj)
return;
if (!spr->mobj->subsector)
if (!spr->mobj || !spr->mobj->subsector)
return;
// cache sprite graphics
@@ -4336,6 +4333,24 @@ static void HWR_DrawSprites(void)
{
UINT32 i;
for (i = 0; i < gl_visspritecount; i++)
{
gl_vissprite_t *spr = gl_vsprorder[i];
if (spr->precip)
{
HWR_DrawPrecipitationSprite(spr);
continue;
}
HWR_DrawSprite(spr);
}
}
static void HWR_DrawModels(void)
{
UINT32 i;
for (i = 0; i < gl_visspritecount; i++)
{
gl_vissprite_t *spr = gl_vsprorder[i];
@@ -4361,14 +4376,14 @@ static void HWR_DrawSprites(void)
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
if (!cv_glmdls.value || ((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
HWR_DrawSprite(spr);
else
HWR_DrawMD2(spr);
}
else
{
if (!cv_glmdls.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
if (md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
HWR_DrawSprite(spr);
else
HWR_DrawMD2(spr);
@@ -4428,7 +4443,7 @@ static void HWR_AddSprites(sector_t *sec)
static void HWR_AddPrecipitationSprites(void)
{
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th;
precipmobj_t *th, *next;
fixed_t drawdist;
@@ -4460,6 +4475,9 @@ static void HWR_AddPrecipitationSprites(void)
{
for (th = precipblocklinks[(by * bmapwidth) + bx]; th; th = th->bnext)
{
// Store this beforehand because HWR_ProjectPrecipitationSprite may free th (see P_PrecipThinker)
next = th->bnext;
if (th->precipflags & PCF_INVISIBLE)
continue;
@@ -4531,30 +4549,27 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
return;
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
// transform the origin point
tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(interp.y);
// rotation around vertical axis
tz = ((tr_x - gl_viewx) * gl_viewcos) + ((tr_y - gl_viewy) * gl_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE && !papersprite && (!cv_glmdls.value || md2_models[thing->sprite].notfound == true)) // Yellow: Only MD2's dont disappear
return;
const boolean mirrored = thing->mirrored;
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
this_scale = FIXED_TO_FLOAT(interp.scale);
spritexscale = FIXED_TO_FLOAT(interp.spritexscale);
spriteyscale = FIXED_TO_FLOAT(interp.spriteyscale);
// transform the origin point
tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
// rotation around vertical axis
tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE && !papersprite && (!cv_glmdls.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear
return;
// The above can stay as it works for cutting sprites that are too close
tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(interp.y);
// decide which patch to use for sprite relative to player
#ifdef RANGECHECK
if ((unsigned)thing->sprite >= numsprites)
@@ -4877,40 +4892,41 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
}
this_scale = FIXED_TO_FLOAT(interp.scale);
// transform the origin point
tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(interp.y);
// rotation around vertical axis
tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
tz = ((tr_x - gl_viewx) * gl_viewcos) + ((tr_y - gl_viewy) * gl_viewsin);
// thing is behind view plane?
if (tz < ZCLIP_PLANE)
return;
tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(interp.y);
// decide which patch to use for sprite relative to player
if ((unsigned)thing->sprite >= numsprites)
{
#ifdef RANGECHECK
I_Error("HWR_ProjectPrecipitationSprite: invalid sprite number %i ",
thing->sprite);
#else
return;
#endif
}
sprdef = &sprites[thing->sprite];
if ((size_t)(thing->frame&FF_FRAMEMASK) >= sprdef->numframes)
{
#ifdef RANGECHECK
I_Error("HWR_ProjectPrecipitationSprite: invalid sprite frame %i : %i for %s",
thing->sprite, thing->frame, sprnames[thing->sprite]);
#else
return;
#endif
}
this_scale = FIXED_TO_FLOAT(interp.scale);
sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK];
@@ -5388,7 +5404,10 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime);
HWR_DrawSprites();
if (!cv_glmdls.value)
HWR_DrawSprites();
else
HWR_DrawModels();
PS_STOP_TIMING(ps_hw_spritedrawtime);
ps_numdrawnodes.value.i = 0;
+1 -1
View File
@@ -885,7 +885,7 @@ static void R_Subsector(size_t num)
{
for (rover = frontsector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || !(rover->flags & FF_RENDERALL))
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
continue;
sector_t *controlSec = &sectors[rover->secnum];
+20 -60
View File
@@ -118,8 +118,8 @@ consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, N
consvar_t cv_skipintromusic = {"skipintromusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_ignoremusicchanges = {"ignoremusicchanges", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
boolean keepmusic = false;
static void S_CheckEventMus(const char *newmus);
boolean keepmusic = false; // keep the current music on map restart
boolean skipintromus = false; // skip the intro fanfare
#ifdef HAVE_OPENMPT
openmpt_module *openmpt_mhandle = NULL;
@@ -1741,8 +1741,6 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
strncpy(newmusic, mmusic, 6);
S_CheckEventMus(newmusic);
if (LUA_HookMusicChange(music_name, &hook_param))
return;
@@ -1931,29 +1929,6 @@ boolean S_FadeOutStopMusic(UINT32 ms)
/// Init & Others
/// ------------------------
/*static boolean S_KeepMusic(void)
{
//if (!cv_keepmusic.value)
//return false;
// should i compare songs or maps?
static char oldmusname[7] = "";
if (strcmp(music_name, mapmusname) != 0)
return false;
if (strcmp(oldmusname, mapmusname) == 0)
return true;
strncpy(oldmusname, mapmusname, 7);
oldmusname[6] = '\0';
return false;
}*/
static boolean skipmusic = false;
boolean skipintromus = false;
static const char *musicexception_list[] = {
"vote", "voteea", "voteeb", "racent", "krwin",
"krok", "krlose", "krfail", "kbwin", "kbok",
@@ -1967,43 +1942,30 @@ void S_ResetKeepAndSpecialMus(void)
keepmusic = skipintromus = false;
}
//checks for any kind of event music like intermission, vote etc.
//always runs when musicchange gets invoked
static void S_CheckEventMus(const char *newmus)
{
skipmusic = false;
if (!cv_keepmusic.value)
return;
for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++)
if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced
{
skipmusic = true;
break;
}
//CONS_Printf("music_name = %s\n", music_name);
//CONS_Printf("newmus = %s\n", newmus);
//CONS_Printf("skipmusic = %d\n", skipmusic);
}
//this one compares map and encoremode instead of the music itself
//makes tunes work and stuff
void S_CheckMap(void)
// determine if we should keep the music on a map restart
void S_KeepMusic(void)
{
static INT16 oldmap = 0;
static boolean oldencore = false;
if (!cv_keepmusic.value)
if (!cv_keepmusic.value || gamestate != GS_LEVEL || music_name[0] == 0)
{
keepmusic = false;
return;
}
else if (oldmap == gamemap && oldencore == encoremode)
{
keepmusic = true;
keepmusic = (!skipmusic && (gamestate == GS_LEVEL) && (music_name[0] != 0) && (oldmap == gamemap) && (oldencore == encoremode));
//CONS_Printf("keepmusic = %s\n", keepmusic);
// check if the current music is smth we dont want to keep (vote music, etc)
for (size_t i = 0; i < sizeof(musicexception_list)/sizeof(musicexception_list[0]); i++)
{
if (stricmp(music_name, musicexception_list[i]) == 0)
{
keepmusic = false;
break;
}
}
}
oldencore = encoremode;
oldmap = gamemap;
@@ -2016,8 +1978,6 @@ void S_CheckMap(void)
//
void S_InitMapMusic(void)
{
skipintromus = false;
if (mapmusflags & MUSIC_RELOADRESET)
{
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
@@ -2038,7 +1998,7 @@ void S_InitMapMusic(void)
{
char *maptitle = G_BuildMapTitle(gamemap);
// for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird..
skipintromus = gamestate == GS_LEVEL && (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle!
skipintromus = (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle!
if (maptitle)
Z_Free(maptitle);
}
@@ -2053,7 +2013,7 @@ void S_InitMapMusic(void)
void S_StartMapMusic(void)
{
//no need to constantly run this after race has started
// no need to constantly run this after race has started
if (leveltime > MUSICSTARTTIME)
return;
+1 -1
View File
@@ -114,7 +114,7 @@ void S_ResetKeepAndSpecialMus(void);
void S_InitMapMusic(void);
void S_StartMapMusic(void);
void S_CheckMap(void);
void S_KeepMusic(void);
// Stops music and restarts it from same position. Used for instant applying changes to amiga filters.
void S_RestartMusic(void);