Definitively identifying BSP bmodels
Moderator: InsideQC Admins
9 posts
• Page 1 of 1
Definitively identifying BSP bmodels
I'm wondering if anyone has any ideas for definitively identifying at load time (in Mod_LoadBrushModel) if a brush model is an ammo box/etc or if it is the world?
I've considered and rejected looking for an info_player_* entity as there is actually nothing in the engine or in QC that specifies that these entities absolutely HAVE to be called such. Been also setting breakpoints in a debug build and looking for anything different, but don't see it. Anything else that should be good to work with? Remember that it's in Mod_LoadBrushModel so the only info that's available is what that function knows about, and it needs to be on the client.
I've considered and rejected looking for an info_player_* entity as there is actually nothing in the engine or in QC that specifies that these entities absolutely HAVE to be called such. Been also setting breakpoints in a debug build and looking for anything different, but don't see it. Anything else that should be good to work with? Remember that it's in Mod_LoadBrushModel so the only info that's available is what that function knows about, and it needs to be on the client.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
oh wait, i see the issue, you're inside the load function so a lot of the state isn't available to you.
You could add a global variable or add some flag to the model or a parameter to the load function to indicate if it's a worldmodel.
Based on the model itself, i'd say you could do some heuristic based on filesize, number of surfaces, etc, which would probably fail for any simple 6-brush box room people make for testing purposes.
That route feels kind of hacky anyway, you probably want to set a flag in the part of the code that knows for sure, so that the load function can just check that flag.
You could add a global variable or add some flag to the model or a parameter to the load function to indicate if it's a worldmodel.
Based on the model itself, i'd say you could do some heuristic based on filesize, number of surfaces, etc, which would probably fail for any simple 6-brush box room people make for testing purposes.
That route feels kind of hacky anyway, you probably want to set a flag in the part of the code that knows for sure, so that the load function can just check that flag.
- metlslime
- Posts: 316
- Joined: Tue Feb 05, 2008 11:03 pm
Weren't BSP models like ammo boxes and other similar stuff supposed to have an empty entity list lump, after all
EDIT: You could also look for the first BSP model in the precache list, I think it's safe to assume that's the world model.
EDIT: You could also look for the first BSP model in the precache list, I think it's safe to assume that's the world model.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
define 'the world'...
originally, external bsp objects were going to be used for doors/plats/etc, and should thus be equivelent to inline models. No pvs required, but you potentially need everything else, including lightmaps, however awkward they are.
Even pickups have full collision/hulls/etc.
cl.worldmodel. if its NULL, then either the server is loading, or the current model is world.
Supposedly.
if sv.active is true, then any bsp loading is on behalf of the server, and the server's sv.worldmodel could be used instead. its horrible, I know.
FTE uses this, but only for texture replacements.
reckless, q2 only supports a single bsp file at any one time. inlines are not the issue here.
originally, external bsp objects were going to be used for doors/plats/etc, and should thus be equivelent to inline models. No pvs required, but you potentially need everything else, including lightmaps, however awkward they are.
Even pickups have full collision/hulls/etc.
cl.worldmodel. if its NULL, then either the server is loading, or the current model is world.
Supposedly.
if sv.active is true, then any bsp loading is on behalf of the server, and the server's sv.worldmodel could be used instead. its horrible, I know.
FTE uses this, but only for texture replacements.
reckless, q2 only supports a single bsp file at any one time. inlines are not the issue here.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
I'm thinking that a flag is probably the only real viable approach. Say call it "worldloaded" or something, init it to false on declaration, set to false in Host_ClearMemory (the only function that can be utterly relied on to be called prior to a map load irrespective of circumstances - including if the previous map load crashed) and set to true in Mod_LoadBrushModel.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest