Skip to content

Instantly share code, notes, and snippets.

@Tsuey
Created September 19, 2021 15:52
Show Gist options
  • Save Tsuey/09a9cfed2b45b518bd8307c10f8896e8 to your computer and use it in GitHub Desktop.
Save Tsuey/09a9cfed2b45b518bd8307c10f8896e8 to your computer and use it in GitHub Desktop.
Explanation in: \zz_hex_editing\__DEVELOPMENT\_VMF_UPDATES\__MAPS
STEPS FOR "REMOVING" DARK CARNIVAL 5 ROOF W/O RECOMPILING
=========================================================
"map c2m5_concert versus"
"mat_wireframe 2"
Yes, luckily the bleachers render through
the roof, but it may be one-way only; may
be necessary for Propper replacement roof
to be placed lower, so it's within the
lower visleaf -- so Survivors are able to
see SI attacking from above
Making the roof brush and its clip non-solid:
Open "BSPSource Entities Disabled with Debug Mode"
VMF in Hammer -- this special decompile
allows "Map -> Show Selected Brush Number"
to be used to retrieve the Brush ID that
corresponds to its array in the *.LMP file
The roof in this case is conveniently 1
single clip with Brush ID "22"
The RED clip above it is Brush ID "293"
In HHD Hex Editor Neo:
+ Open "18_LUMP_BRUSHES.lmp"
+ For Brush ID "22" (roof)
Change ORIGINAL flag:
CONTENTS_SOLID (1)
To MODIFIED flag (flat 0
so it overall does nothing):
0
+ For Brush ID "293" (clip)
Change ORIGINAL flag:
CONTENTS_PLAYERCLIP | CONTENTS_MONSTERCLIP | CONTENTS_DETAIL | CONTENTS_EMPTY (134414336)
To MODIFIED flag:
CONTENTS_PLAYERCLIP | CONTENTS_DETAIL | CONTENTS_EMPTY (134283264)
Now, the clip above the roof only blocks
Survivors (changed from RED to PINK).
The goal going forward is that Brush ID "22" (roof)
is still visible -- we need to modify all textures
on that brush to become invisible (clear)
"disable_static_prop_loading 1"
"ent_fire beam_spotlight kill"
"mat_surfaceid 2"
Open "BSPSource 1.3.18 Split faces only"
VMF in Hammer -- this special decompile
replicates what's rendered in-game, it's
sort of like a "half-decompile"
Use "mat_surfaceid 2" to document all
the Face ID's related to above brush,
hand-transcribing them carefully while
double-checking count against the VMF
to be sure we get ALL of them... disabling
all prop_statics is just so the lighting
truss etc. don't visually get in the way
Roof bottom (Top-left to bottom-right):
2301
2313
2299
2614
2300
2298
2613
2434
2433
2764
2461
2482
2763
2539
2537
2538
2536
2765
3166
3165
3384
Roof top (Bottom-left to top-right):
2314
2302
2616
2437
2462
2484
2766
2541
3167
3386
Roof sides (left to right):
2545
2304
2316
2317
2305
2436
2460
2540
3164
3163
3365
Finding "TOOLS/TOOLSNODRAW":
FACT:
TOOLS/TOOLSNODRAW is only used
by the compiler. We can't change
brushes that are already compiled
into NODRAW, because the compiler
deletes the face entirely -- and
we aren't recompiling.
However, we can override the
useless "TOOLS/TOOLSNODRAW" texture
inside the BSP with same-length
"EFFECTS/CLEARDRAW" (both 17 chars)
to make it 100% transparent.
Open "43_LUMP_TEXDATA_STRING_DATA.lmp":
Find the offset where this plaintext
(null terminated) lump starts with
the "T" in "TOOLS/TOOLSNODRAW"
It is offset "184"
Subtract 20 from that to get "164",
to skip the LMP's 20-byte header
Open "44_LUMP_TEXDATA_STRING_TABLE.lmp":
Find that offset of "164" and
note down its index ID of "7"
Open "c2m5_concert_l_0 -- 02_LUMP_TEXDATA.lmp":
In HDD Hex Editor Neo, click to
"Expand All" entire structure
"nameStringTableID" is what we're
looking at, there exists "texData"
0-124 so there's 125 total to check
"nameStringTableID" of "7" (found
earlier) is "texData" index ID "7"
Both being "7" is no concidence,
it should always be this way, but
it's important to recurse through
all the lumps as it's designed
Open "c2m5_concert_l_0 -- 06_LUMP_TEXINFO.lmp":
"Expand All" here as well -- there
exists 0-1086 total "texInfo" in here;
earlier, we know which "texData" is
pointing to "TOOLS/TOOLSNODRAW", but
the objective here is to find which
"texInfo" points to that, and there's
a LOT more to account for all the
various U/V settings you can apply
to each texture within Hammer -- there
is one "texInfo" for EVERY variation
the mapper choosed while making the map
VBSP, at compile time, deletes excess
"texInfo" that point to "TOOLSNODRAW",
because the U/V's do not need to be
preserved since the result (of deleting
the face) is always the same -- this
means that "texData" of "7" will only
exist once (while other textures that
actually render have multiple "texInfo")
Result: "texInfo[20]" (aka index/ID "20")
has the "texData" of "7"
We've found "TOOLS/TOOLSNODRAW", and we now know
that eventually we'll want to replace all the
previously-discovered Face ID's with "texInfo" of "20",
disregarding whatever they were previously because
we want the roof gone completely so we can re-make it
Replace "TOOLS/TOOLSNODRAW" with "EFFECTS/CLEARDRAW":
Open "43_LUMP_TEXDATA_STRING_DATA.lmp"
Now we return to offset "184"
Select 17 characters "TOOLS/TOOLSNODRAW"
Replace with exactly "EFFECTS/CLEARDRAW"
Now, instead of wasting space in LUMP 43 with a
texture that only the compiler ever needed, it's
now occupied by something that will actually force
an existing face to be transparent !!
Change the 42 Face ID's from whatever they used to
be (don't care, it'll vary depending on how the
roof was textured and specially U/V'd) to the new
"texInfo" of "20" to "CLEARDRAW" them:
Open "58_LUMP_FACES_HDR.lmp"
Find each of the 42 Face ID's one by one
Change them all to "texInfo" of "20"
This is the results of each set:
Roof bottom (Top-left to bottom-right):
All of these were "texInfo" "39"
(exact same texture and U/V's)
"surfaceprop" surface is "metalvent"
texture "METAL/METALHULL009B"
Roof top (Bottom-left to top-right):
All of these were "texInfo" "7",
"surfaceprop" of "rubber" with
texture "BUILDINGS/ROOF07"
Roof sides (left to right):
All were "texInfo" 36/37/38,
"surfaceprop" surface is "metal"
texture "DE_NUKE/NUKE_METALTRIMS_01"
CONCLUSION:
All that's left is Propper.
While the visleaves are extremely well behaved in
this case (and that's 100% dumb luck), the example
video does show some culling. It is not worth the
time or the risk to patch these visleaves, given
the alternatives that exist.
The final Propper model must carefully take all
the ugly culling spots into account so SI Players
cannot (reasonably) PVS them, but can still have new
vantage points for attacking Survivors. It's also
worth experimenting that the replacement roof could
be lower, so that it intersects with the lower
visleaf which would force everything below to render
at all times -- but that's a last resort.
Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment