Inside3D!
     

Definitively identifying BSP bmodels

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Thu Nov 12, 2009 11:39 pm    Post subject: Definitively identifying BSP bmodels Reply with quote

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.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Fri Nov 13, 2009 12:09 am    Post subject: Reply with quote

like Q2's inline bmodel code ? not totally sure how it works hmm
Back to top
View user's profile Send private message
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Fri Nov 13, 2009 1:02 am    Post subject: Reply with quote

hmm, i don't have the code in front of me right now, but isn't the worldmodel always model 0?
Back to top
View user's profile Send private message
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Fri Nov 13, 2009 1:07 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Fri Nov 13, 2009 1:08 am    Post subject: Reply with quote

Weren't BSP models like ammo boxes and other similar stuff supposed to have an empty entity list lump, after all Question

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.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Nov 13, 2009 1:29 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Labman



Joined: 05 Nov 2004
Posts: 51
Location: Brisbane, Australia

PostPosted: Fri Nov 13, 2009 2:45 am    Post subject: Reply with quote

In QMB I made ammo/health boxes flash like they did in unreal, it seems to be based off having the model->firstmodelsurface equal to 0.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Fri Nov 13, 2009 4:51 am    Post subject: Reply with quote

for mei defined everything BUT the worldmodel AS a brushmodel. this way i only have to segregate the world and define the rest. Yet i have abandoned bsp ammo healthboxes long ago for mdl versions that carry correct lighting/shadows etc Razz
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Fri Nov 13, 2009 5:04 pm    Post subject: Reply with quote

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.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group