Skip to content

Commit 54ee811

Browse files
authored
Merge branch 'stable' into bugfix/static-init-fix
2 parents e9ce4b0 + c7a80e0 commit 54ee811

14 files changed

+236
-40
lines changed

client/src/cl_level.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,19 @@ void G_DoLoadLevel (int position)
545545
// [ML] 5/11/06 - remove sky2 remenants
546546
// [SL] 2012-03-19 - Add sky2 back
547547
sky1texture = R_TextureNumForName (level.skypic.c_str());
548+
sky1scrolldelta = level.sky1ScrollDelta;
549+
sky1columnoffset = 0;
550+
sky2columnoffset = 0;
548551
if (!level.skypic2.empty())
549-
sky2texture = R_TextureNumForName (level.skypic2.c_str());
552+
{
553+
sky2texture = R_TextureNumForName(level.skypic2.c_str());
554+
sky2scrolldelta = level.sky2ScrollDelta;
555+
}
550556
else
557+
{
551558
sky2texture = 0;
559+
sky2scrolldelta = 0;
560+
}
552561

553562
// [RH] Set up details about sky rendering
554563
R_InitSkyMap ();

client/src/m_menu.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1504,14 +1504,14 @@ static void M_PlayerSetupDrawer()
15041504
R_BuildPlayerTranslation(0, player_color);
15051505
V_ColorMap = translationref_t(translationtables, 0);
15061506

1507+
// Draw box surrounding fire and player:
1508+
screen->DrawPatchClean(W_CachePatch("M_PBOX"), 320 - 88 - 32 + 36,
1509+
PSetupDef.y + LINEHEIGHT * 3 + 22);
1510+
15071511
screen->DrawTranslatedPatchClean (W_CachePatch (sprframe->lump[0]),
15081512
320 - 52 - 32, PSetupDef.y + LINEHEIGHT*3 + 46);
15091513
}
15101514

1511-
// Draw box surrounding fire and player:
1512-
screen->DrawPatchClean (W_CachePatch ("M_PBOX"),
1513-
320 - 88 - 32 + 36, PSetupDef.y + LINEHEIGHT*3 + 22);
1514-
15151515
// Draw team setting
15161516
{
15171517
const team_t team = D_TeamByName(cl_team.cstring());

client/src/r_sky.cpp

+123-11
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ fixed_t skyheight;
5656
fixed_t skyiscale;
5757

5858
int sky1shift, sky2shift;
59-
fixed_t sky1pos=0, sky1speed=0;
60-
fixed_t sky2pos=0, sky2speed=0;
59+
fixed_t sky1scrolldelta, sky2scrolldelta;
60+
fixed_t sky1columnoffset, sky2columnoffset;
6161

6262
// The xtoviewangleangle[] table maps a screen pixel
6363
// to the lowest viewangle that maps back to x ranges
@@ -73,6 +73,7 @@ char SKYFLATNAME[8] = "F_SKY1";
7373

7474

7575
static tallpost_t* skyposts[MAXWIDTH];
76+
static byte compositeskybuffer[MAXWIDTH][512]; // holds doublesky composite sky to blit to the screen
7677

7778

7879
//
@@ -198,33 +199,58 @@ inline void SkyColumnBlaster()
198199
R_BlastSkyColumn(colfunc);
199200
}
200201

202+
inline bool R_PostDataIsTransparent(byte* data)
203+
{
204+
if (*data == '\0')
205+
{
206+
return true;
207+
}
208+
return false;
209+
}
210+
211+
212+
201213
//
202214
// R_RenderSkyRange
203215
//
204216
// [RH] Can handle parallax skies. Note that the front sky is *not* masked in
205217
// in the normal convention for patches, but uses color 0 as a transparent
206218
// color.
207219
// [ML] 5/11/06 - Removed sky2
220+
// [BC] 7/5/24 - Brought back for real this time
208221
//
209222
void R_RenderSkyRange(visplane_t* pl)
210223
{
211224
if (pl->minx > pl->maxx)
212225
return;
213226

214227
int columnmethod = 2;
215-
int skytex;
228+
int frontskytex, backskytex;
216229
fixed_t front_offset = 0;
230+
fixed_t back_offset = 0;
217231
angle_t skyflip = 0;
218232

219-
if (pl->picnum == skyflatnum)
233+
if (pl->picnum == skyflatnum )
220234
{
221235
// use sky1
222-
skytex = sky1texture;
236+
frontskytex = texturetranslation[sky1texture];
237+
if (level.flags & LEVEL_DOUBLESKY)
238+
{
239+
backskytex = texturetranslation[sky2texture];
240+
}
241+
else
242+
{
243+
backskytex = -1;
244+
}
245+
front_offset = sky1columnoffset;
246+
back_offset = sky2columnoffset;
223247
}
224248
else if (pl->picnum == int(PL_SKYFLAT))
225249
{
226250
// use sky2
227-
skytex = sky2texture;
251+
frontskytex = texturetranslation[sky2texture];
252+
backskytex = -1;
253+
front_offset = sky2columnoffset;
228254
}
229255
else
230256
{
@@ -236,7 +262,8 @@ void R_RenderSkyRange(visplane_t* pl)
236262
const side_t* side = *line->sidenum + sides;
237263

238264
// Texture comes from upper texture of reference sidedef
239-
skytex = texturetranslation[side->toptexture];
265+
frontskytex = texturetranslation[side->toptexture];
266+
backskytex = -1;
240267

241268
// Horizontal offset is turned into an angle offset,
242269
// to allow sky rotation as well as careful positioning.
@@ -261,7 +288,8 @@ void R_RenderSkyRange(visplane_t* pl)
261288

262289
dcol.iscale = skyiscale >> skystretch;
263290
dcol.texturemid = skytexturemid;
264-
dcol.textureheight = textureheight[skytex];
291+
dcol.textureheight = textureheight[frontskytex]; // both skies are forced to be the same height anyway
292+
dcol.texturefrac = dcol.texturemid + (dcol.yl - centery) * dcol.iscale;
265293
skyplane = pl;
266294

267295
// set up the appropriate colormap for the sky
@@ -284,13 +312,97 @@ void R_RenderSkyRange(visplane_t* pl)
284312
// column in this range.
285313
for (int x = pl->minx; x <= pl->maxx; x++)
286314
{
287-
int colnum = ((((viewangle + xtoviewangle[x]) ^ skyflip) >> sky1shift) + front_offset) >> FRACBITS;
288-
skyposts[x] = R_GetTextureColumn(skytex, colnum);
315+
int sky1colnum = ((((viewangle + xtoviewangle[x]) ^ skyflip) >> sky1shift) + front_offset) >> FRACBITS;
316+
tallpost_t* skypost = R_GetTextureColumn(frontskytex, sky1colnum);
317+
if (backskytex == -1)
318+
{
319+
skyposts[x] = skypost;
320+
}
321+
else
322+
{
323+
// create composite of both skies
324+
int sky2colnum = ((((viewangle + xtoviewangle[x]) ^ skyflip) >> sky2shift) + back_offset) >> FRACBITS;
325+
tallpost_t* skypost2 = R_GetTextureColumn(backskytex, sky2colnum);
326+
327+
int count = MIN<int> (512, MIN (textureheight[backskytex], textureheight[frontskytex]) >> FRACBITS);
328+
int destpostlen = 0;
329+
330+
BYTE* composite = compositeskybuffer[x];
331+
tallpost_t* destpost = (tallpost_t*)composite;
332+
333+
tallpost_t* orig = destpost; // need a pointer to the og element to return!
334+
335+
// here's the skinny...
336+
337+
// we need to grab sky1 as long as it has a valid topdelta and length
338+
// in a lot of cases there's gaps in length and topdelta because of transparency
339+
// its up to us to find these gaps and put in sky2 when needed
340+
341+
// but when we grab from sky1, we ALSO have to check every byte if it's index 0.
342+
// if it is, we need to grab the same byte from sky2 instead.
343+
// this allows non-converted sky patches, like those in hexen.wad or tlsxctf1.wad
344+
// to work
345+
346+
// the finished tallpost should be the same length as count, and 0 topdelta, with a endpost after.
347+
348+
destpost->topdelta = 0;
349+
350+
while (destpostlen < count)
351+
{
352+
int remaining = count - destpostlen; // pixels remaining to be replenished
353+
354+
if (skypost->topdelta == destpostlen)
355+
{
356+
// valid first sky, grab its data and advance the pixel
357+
memcpy(destpost->data() + destpostlen, skypost->data(), skypost->length);
358+
// before advancing, check the data we just inserted, and input sky2 if its index 0
359+
for (int i = 0; i < skypost->length; i++)
360+
{
361+
if (R_PostDataIsTransparent(destpost->data() + destpostlen + i))
362+
{
363+
// use sky2 for this pixel
364+
365+
memcpy(destpost->data() + destpostlen + i,
366+
skypost2->data() + destpostlen + i, 1);
367+
}
368+
}
369+
destpostlen += skypost->length;
370+
}
371+
else
372+
{
373+
// sky1 top delta is less than current pixel, lets get sky2 up to the pixel
374+
int cursky1delta = abs((skypost->end() ? remaining : skypost->topdelta) - destpostlen);
375+
int sky2len = cursky1delta > remaining ? remaining : cursky1delta;
376+
memcpy(destpost->data() + destpostlen, skypost2->data() + destpostlen,
377+
sky2len);
378+
destpostlen += sky2len;
379+
}
380+
381+
if (!skypost->next()->end() && destpostlen >= skypost->topdelta + skypost->length)
382+
{
383+
skypost = skypost->next();
384+
}
385+
386+
if (!skypost2->next()->end() && destpostlen >= skypost2->topdelta + skypost2->length)
387+
{
388+
skypost2 = skypost2->next();
389+
}
390+
391+
destpost->length = destpostlen;
392+
}
393+
394+
// finish the post up.
395+
destpost = destpost->next();
396+
destpost->length = 0;
397+
destpost->writeend();
398+
399+
skyposts[x] = orig;
400+
}
289401
}
290402

291403
R_RenderColumnRange(pl->minx, pl->maxx, (int*)pl->top, (int*)pl->bottom,
292404
skyposts, SkyColumnBlaster, false, columnmethod);
293-
405+
294406
R_ResetDrawFuncs();
295407
}
296408

common/d_main.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ static const char* steam_install_subdirs[] =
174174
"steamapps\\common\\ultimate doom\\base",
175175
"steamapps\\common\\DOOM 3 BFG Edition\\base\\wads",
176176
"steamapps\\common\\master levels of doom\\master\\wads", //Let Odamex find the Master Levels pwads too
177+
"steamapps\\common\\ultimate doom\\base\\doom2", //2024 Steam re-release additions here and below
178+
"steamapps\\common\\ultimate doom\\base\\master\\wads",
179+
"steamapps\\common\\ultimate doom\\base\\plutonia",
180+
"steamapps\\common\\ultimate doom\\base\\tnt",
181+
"steamapps\\common\\ultimate doom\\rerelease",
182+
177183
};
178184

179185

common/g_level.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ void G_InitLevelLocals()
885885
{
886886
::level.skypic2 =::level.skypic.c_str();
887887
}
888+
::level.sky1ScrollDelta = info.sky1ScrollDelta;
889+
::level.sky2ScrollDelta = info.sky2ScrollDelta;
888890

889891
if (::level.flags & LEVEL_JUMP_YES)
890892
{

common/g_level.h

+16-7
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ struct level_pwad_info_t
173173
std::string intertextsecret;
174174
OLumpName interbackdrop;
175175
OLumpName intermusic;
176+
177+
fixed_t sky1ScrollDelta;
178+
fixed_t sky2ScrollDelta;
176179

177180
std::vector<bossaction_t> bossactions;
178181

@@ -185,7 +188,8 @@ struct level_pwad_info_t
185188
partime(0), skypic(""), music(""), flags(0), cluster(0), snapshot(NULL),
186189
defered(NULL), fadetable("COLORMAP"), skypic2(""), gravity(0.0f),
187190
aircontrol(0.0f), exitpic(""), enterpic(""), endpic(""), intertext(""),
188-
intertextsecret(""), interbackdrop(""), intermusic(""), bossactions(), label(),
191+
intertextsecret(""), interbackdrop(""), intermusic(""),
192+
sky1ScrollDelta(0), sky2ScrollDelta(0), bossactions(), label(),
189193
clearlabel(false), author()
190194
{
191195
ArrayInit(fadeto_color, 0);
@@ -197,12 +201,12 @@ struct level_pwad_info_t
197201
level_pwad_info_t(const level_info_t& other)
198202
: mapname(other.mapname), levelnum(other.levelnum), level_name(other.level_name),
199203
pname(other.pname), nextmap(other.nextmap),
200-
secretmap(other.secretmap), partime(other.partime), skypic(other.skypic),
201-
music(other.music), flags(other.flags), cluster(other.cluster),
202-
snapshot(other.snapshot), defered(other.defered), fadetable("COLORMAP"),
203-
skypic2(""), gravity(0.0f), aircontrol(0.0f), exitpic(""), enterpic(""),
204-
endpic(""), intertext(""), intertextsecret(""), interbackdrop(""), intermusic(""),
205-
bossactions(), label(), clearlabel(false), author()
204+
secretmap(other.secretmap), partime(other.partime), skypic(other.skypic),
205+
music(other.music), flags(other.flags), cluster(other.cluster),
206+
snapshot(other.snapshot), defered(other.defered), fadetable("COLORMAP"),
207+
skypic2(""), gravity(0.0f), aircontrol(0.0f), exitpic(""), enterpic(""),
208+
endpic(""), intertext(""), intertextsecret(""), interbackdrop(""), intermusic(""),
209+
bossactions(), label(), clearlabel(false), author(), sky1ScrollDelta(0), sky2ScrollDelta(0)
206210
{
207211
ArrayInit(fadeto_color, 0);
208212
ArrayInit(outsidefog_color, 0);
@@ -242,6 +246,8 @@ struct level_pwad_info_t
242246
intertextsecret = other.intertextsecret;
243247
interbackdrop = other.interbackdrop;
244248
intermusic = other.intermusic;
249+
sky1ScrollDelta = other.sky1ScrollDelta;
250+
sky2ScrollDelta = other.sky2ScrollDelta;
245251
bossactions.clear();
246252
std::copy(other.bossactions.begin(), other.bossactions.end(),
247253
bossactions.begin());
@@ -290,6 +296,9 @@ struct level_locals_t
290296
OLumpName skypic;
291297
OLumpName skypic2;
292298

299+
fixed_t sky1ScrollDelta;
300+
fixed_t sky2ScrollDelta;
301+
293302
int total_secrets;
294303
int found_secrets;
295304

common/g_mapinfo.cpp

+19-8
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,18 @@ void MIType_Sky(OScanner& os, bool newStyleMapInfo, void* data, unsigned int fla
565565
{
566566
ParseMapInfoHelper<OLumpName>(os, newStyleMapInfo);
567567

568-
*static_cast<OLumpName*>(data) = os.getToken();
568+
level_pwad_info_t& info = *static_cast<level_pwad_info_t*>(data);
569+
570+
std::string pic = os.getToken();
571+
572+
if (flags == 1)
573+
{
574+
info.skypic = pic;
575+
}
576+
else
577+
{
578+
info.skypic2 = pic;
579+
}
569580

570581
os.scan();
571582
// Scroll speed
@@ -575,14 +586,14 @@ void MIType_Sky(OScanner& os, bool newStyleMapInfo, void* data, unsigned int fla
575586
}
576587
if (IsRealNum(os.getToken().c_str()))
577588
{
578-
/*if (HexenHack)
589+
if (flags == 1)
579590
{
580-
*((fixed_t *)(info + handler->data2)) = sc_Number << 8;
591+
info.sky1ScrollDelta = FLOAT2FIXED(os.getTokenFloat());
581592
}
582-
else
593+
else
583594
{
584-
*((fixed_t *)(info + handler->data2)) = (fixed_t)(sc_Float * 65536.0f);
585-
}*/
595+
info.sky2ScrollDelta = FLOAT2FIXED(os.getTokenFloat());
596+
}
586597
}
587598
else
588599
{
@@ -1082,8 +1093,8 @@ struct MapInfoDataSetter<level_pwad_info_t>
10821093
ENTRY3("secretnext", &MIType_MapName, &ref.secretmap)
10831094
ENTRY3("secret", &MIType_MapName, &ref.secretmap)
10841095
ENTRY3("cluster", &MIType_Cluster, &ref.cluster)
1085-
ENTRY3("sky1", &MIType_Sky, &ref.skypic)
1086-
ENTRY3("sky2", &MIType_Sky, &ref.skypic2)
1096+
ENTRY4("sky1", &MIType_Sky, &ref, 1)
1097+
ENTRY4("sky2", &MIType_Sky, &ref, 2)
10871098
ENTRY3("fade", &MIType_Color, &ref.fadeto_color)
10881099
ENTRY3("outsidefog", &MIType_Color, &ref.outsidefog_color)
10891100
ENTRY3("titlepatch", &MIType_LumpName, &ref.pname)

common/p_map.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ BOOL PIT_CheckLine (line_t *ld)
411411
{
412412
if ((ld->flags &
413413
(ML_BLOCKING | ML_BLOCKEVERYTHING)) || // explicitly blocking everything
414-
(!tmthing->player && (ld->flags & ML_BLOCKMONSTERS)) || // block monsters only
415-
(!tmthing->player && (ld->flags & ML_BLOCKLANDMONSTERS) &&
414+
(!tmthing->player && tmthing->type != MT_AVATAR && (ld->flags & ML_BLOCKMONSTERS)) || // block monsters only
415+
(!tmthing->player && tmthing->type != MT_AVATAR && (ld->flags & ML_BLOCKLANDMONSTERS) &&
416416
!(tmthing->flags & MF_FLOAT)) || // [Blair] Block land monsters.
417417
(tmthing->player &&
418418
(ld->flags & ML_BLOCKPLAYERS))) // [Blair] Block players only

common/p_mobj.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ void P_ZMovement(AActor *mo)
17751775
return;
17761776
}
17771777

1778-
if (mo->player)
1778+
if (mo->player && !P_IsVoodooDoll(mo))
17791779
P_PlayerSmoothStepUp(mo);
17801780

17811781
// ZDoom applies gravity earlier in the function than vanilla

0 commit comments

Comments
 (0)