Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Tue May 21, 2013 8:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Declarations Manager
PostPosted: Sun Oct 17, 2004 8:43 pm 
Offline
has joined the game

Joined: Tue Sep 07, 2004 10:59 am
Posts: 39
I tried playing with the declarations manager, which handles the parsing of pdas, skins, particles etc. I want to add my own new declaration type, but I've no idea how I can access anything from the idDecl interface, without resorting to the predefined schemes, which wouldn't work with the new stuff I'm trying... Any insights on this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 18, 2004 2:27 am 
Offline
is connecting to Doom3world.org

Joined: Mon Oct 18, 2004 1:50 am
Posts: 2
I don't know what you're trying to do, but this should get you started.

First you need to add your new type to the declType_t enum, which is in declmanager.h.
Next in Game_Local.cpp, idGameLocal::Init - Add your new type to the manager via the RegisterDeclType function. Finally you will need to inherit a class from idDecl or one of its sub classes and write your own which is passed using idDeclAllocator<NewDeclClass>.

To actually parse the declaration into your new idDecl class override the idDecl::Parse function. For a great example of how this is done see the idDeclModelDef class in Anim_Blend.cpp. They use an idLexer class to parse the string into tokens and act on each as needed. From there you should be able to do just about anything you want with the parsed text.

-VoiD


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 18, 2004 6:35 am 
Offline
has joined the game

Joined: Tue Sep 07, 2004 10:59 am
Posts: 39
This looks great, thank you!

I thought I might get a raw parsing tree or something, just by adding my type to the manager. But using the lexer seems easy enough...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group