Skip to content

Commit 43b267b

Browse files
committed
Minor tweaks
1 parent ddd3d51 commit 43b267b

File tree

4 files changed

+109
-78
lines changed

4 files changed

+109
-78
lines changed

src/p_mobj.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,14 +1263,16 @@ mobj_t *P_SpawnMapThing(mapthing_t *mthing, const bool spawnmonsters)
12631263
return NULL;
12641264
}
12651265

1266-
if (type == LostSoul && !spawnmonsters)
1266+
// don't spawn any monsters if -nomonsters
1267+
if (!spawnmonsters
1268+
&& (mobjinfo[i].flags & MF_SHOOTABLE)
1269+
&& type != Barrel
1270+
&& (type != OfficeLampBreakable || !legacyofrust)
1271+
&& (type != Cacodemon || !hacx))
12671272
return NULL;
1268-
else if (mobjinfo[i].flags & MF_COUNTKILL)
1269-
{
1270-
// don't spawn any monsters if -nomonsters
1271-
if (!spawnmonsters)
1272-
return NULL;
12731273

1274+
if (mobjinfo[i].flags & MF_COUNTKILL)
1275+
{
12741276
// killough 07/20/98: exclude friends
12751277
if (!((mobjinfo[i].flags ^ MF_COUNTKILL) & (MF_FRIEND | MF_COUNTKILL)))
12761278
totalkills++;

src/r_bsp.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ void R_ClearClipSegs(void)
115115
// a line, including closure and texture tiling.
116116
static void R_RecalcLineFlags(line_t *line)
117117
{
118+
bool twosided = line->flags & ML_TWOSIDED;
118119
int c;
119120

120121
line->r_validcount = gametime;
121122

122-
if (!(line->flags & ML_TWOSIDED)
123+
if (!twosided
123124
|| backsector->interpceilingheight <= frontsector->interpfloorheight
124125
|| backsector->interpfloorheight >= frontsector->interpceilingheight
125126
|| (backsector->interpceilingheight <= backsector->interpfloorheight
@@ -130,34 +131,31 @@ static void R_RecalcLineFlags(line_t *line)
130131
&& (backsector->ceilingpic != skyflatnum
131132
|| frontsector->ceilingpic != skyflatnum)))
132133
line->r_flags = RF_CLOSED;
133-
else
134+
else if (backsector->interpceilingheight != frontsector->interpceilingheight
135+
|| backsector->interpfloorheight != frontsector->interpfloorheight
136+
|| curline->sidedef->midtexture
137+
|| backsector->floorxoffset != frontsector->floorxoffset
138+
|| backsector->flooryoffset != frontsector->flooryoffset
139+
|| backsector->ceilingxoffset != frontsector->ceilingxoffset
140+
|| backsector->ceilingyoffset != frontsector->ceilingyoffset
141+
|| (backsector->floorlightsec && frontsector->floorlightsec
142+
&& backsector->floorlightsec->id != frontsector->floorlightsec->id)
143+
|| (backsector->ceilinglightsec && frontsector->ceilinglightsec
144+
&& backsector->ceilinglightsec->id != frontsector->ceilinglightsec->id)
145+
|| backsector->floorpic != frontsector->floorpic
146+
|| backsector->ceilingpic != frontsector->ceilingpic
147+
|| backsector->lightlevel != frontsector->lightlevel)
134148
{
135-
if (backsector->interpceilingheight != frontsector->interpceilingheight
136-
|| backsector->interpfloorheight != frontsector->interpfloorheight
137-
|| curline->sidedef->midtexture
138-
|| backsector->floorxoffset != frontsector->floorxoffset
139-
|| backsector->flooryoffset != frontsector->flooryoffset
140-
|| backsector->ceilingxoffset != frontsector->ceilingxoffset
141-
|| backsector->ceilingyoffset != frontsector->ceilingyoffset
142-
|| (backsector->floorlightsec && frontsector->floorlightsec
143-
&& backsector->floorlightsec->id != frontsector->floorlightsec->id)
144-
|| (backsector->ceilinglightsec && frontsector->ceilinglightsec
145-
&& backsector->ceilinglightsec->id != frontsector->ceilinglightsec->id)
146-
|| backsector->floorpic != frontsector->floorpic
147-
|| backsector->ceilingpic != frontsector->ceilingpic
148-
|| backsector->lightlevel != frontsector->lightlevel)
149-
{
150-
line->r_flags = RF_NONE;
151-
return;
152-
}
153-
else
154-
line->r_flags = RF_IGNORE;
149+
line->r_flags = RF_NONE;
150+
return;
155151
}
152+
else
153+
line->r_flags = RF_IGNORE;
156154

157155
if (curline->sidedef->rowoffset)
158156
return;
159157

160-
if (line->flags & ML_TWOSIDED)
158+
if (twosided)
161159
{
162160
// Does top texture need tiling
163161
if ((c = frontsector->interpceilingheight - backsector->interpceilingheight) > 0

src/r_defs.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,56 @@ enum
754754
Zombieman = 3004,
755755
Cacodemon = 3005,
756756
LostSoul = 3006,
757+
Ghoul = 3007,
758+
Banshee = 3008,
759+
Mindweaver = 3009,
760+
Shocktrooper = 3010,
761+
Vassago = 3011,
762+
Tyrant = 3012,
763+
TyrantBoss1 = 3013,
764+
TyrantBoss2 = 3014,
765+
StalagmiteGray = 3100,
766+
LargeCorpsePile = 3101,
767+
HumanBBQ1 = 3102,
768+
HumanBBQ2 = 3103,
769+
HangingVictimBothLegs = 3104,
770+
HangingVictimBothLegsBlocking = 3105,
771+
HangingVictimCrucified = 3106,
772+
HangingVictimCrucifiedBlocking = 3107,
773+
HangingVictimArmsBound = 3108,
774+
HangingVictimArmsBoundBlocking = 3109,
775+
HangingBaronOfHell = 3110,
776+
HangingBaronOfHellBlocking = 3111,
777+
HangingVictimChained = 3112,
778+
HangingVictimChainedBlocking = 3113,
779+
HangingTorsoChained = 3114,
780+
HangingTorsoChainedBlocking = 3115,
781+
SkullPoleTrio = 3116,
782+
SkullGibs = 3117,
783+
BushShort = 3118,
784+
BushShortBurned1 = 3119,
785+
BushShortBurned2 = 3120,
786+
BushTall = 3121,
787+
BushTallBurned1 = 3122,
788+
BushTallBurned2 = 3123,
789+
CaveRockColumn = 3124,
790+
CaveStalagmiteLarge = 3125,
791+
CaveStalagmiteMedium = 3126,
792+
CaveStalagmiteSmall = 3127,
793+
CaveStalactiteLarge = 3128,
794+
CaveStalactiteLargeBlocking = 3129,
795+
CaveStalactiteMedium = 3130,
796+
CaveStalactiteMediumBlocking = 3131,
797+
CaveStalactiteSmall = 3132,
798+
CaveStalactiteSmallBlocking = 3133,
799+
OfficeChair = 3134,
800+
OfficeLampBreakable = 3135,
801+
CeilingLamp = 3137,
802+
CandelabraShort = 3138,
803+
AmbientKlaxon = 3139,
804+
AmbientPortalOpen = 3140,
805+
AmbientPortalLoop = 3141,
806+
AmbientPortalClose = 3142,
757807
Player5Start = 4001,
758808
Player6Start = 4002,
759809
Player7Start = 4003,

src/r_patch.c

Lines changed: 30 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,14 @@ static short STEP2;
5858

5959
static bool IsSolidAtSpot(const column_t *column, const int spot)
6060
{
61-
if (!column)
62-
return false;
63-
64-
while (column->topdelta != 0xFF)
65-
{
66-
if (spot < column->topdelta)
67-
return false;
68-
69-
if (spot <= column->topdelta + column->length)
70-
return true;
71-
72-
column = (const column_t *)((const byte *)column + 3 + column->length + 1);
73-
}
61+
if (column)
62+
while (column->topdelta != 0xFF)
63+
if (spot < column->topdelta)
64+
return false;
65+
else if (spot <= column->topdelta + column->length)
66+
return true;
67+
else
68+
column = (const column_t *)((const byte *)column + 3 + column->length + 1);
7469

7570
return false;
7671
}
@@ -125,7 +120,7 @@ static void CreatePatch(int patchnum)
125120
int postsdatasize;
126121
int datasize;
127122
int *numpostsincolumn;
128-
int numpoststotal;
123+
int numpoststotal = 0;
129124
const unsigned char *oldcolumnpixeldata;
130125

131126
if (!CheckIfPatch(patchnum))
@@ -150,8 +145,6 @@ static void CreatePatch(int patchnum)
150145
pixeldatasize = ((patch->width * patch->height + 4) & ~3);
151146
columnsdatasize = patch->width * sizeof(rcolumn_t);
152147

153-
numpoststotal = 0;
154-
155148
for (int x = 0; x < patch->width; x++)
156149
{
157150
oldcolumn = (const column_t *)((const byte *)oldpatch + LONG(oldpatch->columnoffset[x]));
@@ -232,33 +225,26 @@ static void CreatePatch(int patchnum)
232225
const rcolumn_t *column = R_GetPatchColumnClamped(patch, x);
233226
const rcolumn_t *prevcolumn = R_GetPatchColumnClamped(patch, x - 1);
234227

228+
// force the first pixel (which is a hole), to use
229+
// the color from the next solid spot in the column
235230
if (column->pixels[0] == 0xFF)
236-
{
237-
// force the first pixel (which is a hole), to use
238-
// the color from the next solid spot in the column
239231
for (int y = 0; y < patch->height; y++)
240232
if (column->pixels[y] != 0xFF)
241233
{
242234
column->pixels[0] = column->pixels[y];
243235
break;
244236
}
245-
}
246237

247238
// copy from above or to the left
248239
for (int y = 1; y < patch->height; y++)
249-
{
250-
if (IsSolidAtSpot(oldcolumn, y))
251-
continue;
252-
253-
if (column->pixels[y] != 0xFF)
254-
continue;
255-
256-
// this pixel is a hole
257-
if (x && prevcolumn->pixels[y - 1] != 0xFF)
258-
column->pixels[y] = prevcolumn->pixels[y]; // copy the color from the left
259-
else
260-
column->pixels[y] = column->pixels[y - 1]; // copy the color from above
261-
}
240+
if (!IsSolidAtSpot(oldcolumn, y) && column->pixels[y] == 0xFF)
241+
{
242+
// this pixel is a hole
243+
if (x && prevcolumn->pixels[y - 1] != 0xFF)
244+
column->pixels[y] = prevcolumn->pixels[y]; // copy the color from the left
245+
else
246+
column->pixels[y] = column->pixels[y - 1]; // copy the color from above
247+
}
262248
}
263249

264250
W_ReleaseLumpNum(patchnum);
@@ -312,7 +298,7 @@ static void CreateTextureCompositePatch(const int id)
312298
int columnsdatasize;
313299
int postsdatasize;
314300
int datasize;
315-
int numpoststotal;
301+
int numpoststotal = 0;
316302
const unsigned char *oldcolumnpixeldata;
317303
count_t *countsincolumn;
318304

@@ -328,7 +314,6 @@ static void CreateTextureCompositePatch(const int id)
328314

329315
// count the number of posts in each column
330316
countsincolumn = (count_t *)calloc(compositepatch->width, sizeof(count_t));
331-
numpoststotal = 0;
332317

333318
for (int i = 0; i < texture->patchcount; i++)
334319
{
@@ -520,30 +505,26 @@ static void CreateTextureCompositePatch(const int id)
520505
const rcolumn_t *column = R_GetPatchColumnClamped(compositepatch, x);
521506
const rcolumn_t *prevcolumn = R_GetPatchColumnClamped(compositepatch, x - 1);
522507

508+
// force the first pixel (which is a hole), to use
509+
// the color from the next solid spot in the column
523510
if (column->pixels[0] == 0xFF)
524-
{
525-
// force the first pixel (which is a hole), to use
526-
// the color from the next solid spot in the column
527511
for (int y = 0; y < compositepatch->height; y++)
528512
if (column->pixels[y] != 0xFF)
529513
{
530514
column->pixels[0] = column->pixels[y];
531515
break;
532516
}
533-
}
534517

535518
// copy from above or to the left
536519
for (int y = 1; y < compositepatch->height; y++)
537-
{
538-
if (column->pixels[y] != 0xFF)
539-
continue;
540-
541-
// this pixel is a hole
542-
if (x && prevcolumn->pixels[y - 1] != 0xFF)
543-
column->pixels[y] = prevcolumn->pixels[y]; // copy the color from the left
544-
else
545-
column->pixels[y] = column->pixels[y - 1]; // copy the color from above
546-
}
520+
if (column->pixels[y] == 0xFF)
521+
{
522+
// this pixel is a hole
523+
if (x && prevcolumn->pixels[y - 1] != 0xFF)
524+
column->pixels[y] = prevcolumn->pixels[y]; // copy the color from the left
525+
else
526+
column->pixels[y] = column->pixels[y - 1]; // copy the color from above
527+
}
547528
}
548529

549530
free(countsincolumn);

0 commit comments

Comments
 (0)