NOLF 2 source code

Lithtech Jupiter engine

Post Reply
Old Salt
Member
Member
Posts: 7
Joined: Sun May 15, 2005 4:16 pm

NOLF 2 source code

Post by Old Salt » Wed Jan 10, 2007 1:35 am

I am trying to decipher this section of code in Game/Shared/ModelButeMgr.cpp:


// ----------------------------------------------------------------------- //
//
// ROUTINE: CModelButeMgr::CanModelBeCarried
//
// PURPOSE: Flags if the body associated with this model can be carried.
//
// ----------------------------------------------------------------------- //

LTBOOL CModelButeMgr::CanModelBeCarried(ModelId eModelId)
{
_ASSERT(eModelId >= 0 && eModelId < m_cModels);
if(eModelId >= 0 && eModelId < m_cModels)
{
return m_aModels[eModelId].m_bCanBeCarried;
}

return LTFALSE;
}

// -----------------------------------------------------------------
I understand the ROUTINE & PURPOSE. I'm trying to locate where it says the CanModelBeCarried attribute is located. Thanks for any help!

User avatar
Alexa
Member
Member
Posts: 26
Joined: Fri Apr 07, 2006 4:04 am
Location: Stuttgart, Germany

Post by Alexa » Wed Jan 10, 2007 7:58 pm

Oi. May I assume you want to do some scripting, thus you need to know how to set this parameter using the tools/DEdit/butes file!?

Ye apparently "know" C++? I'll go a bit into the details anyway:

You see that the class' Method "CanModelBeCarried" has the parameter "eModelId" of type "ModelId". The final boolean value that indicates if the model can be carried is read from the object "m_aModels", the field "m_bCanBeCarried" and "RETURN"ed (for the model number "eModelId" of course). So far so trivial. Now:

m_aModels is a protected member variable of the class CModelButeMgr, of type CModel, which is defined within the class (and contains of course the boolean member variable "m_bCanBeCarried").

At some point we're bound to fill this variable with a value. If you look at the beginning of the file "ModelButeMgr.cpp" you'll find

#define MODELBMGR_MODEL_CANBECARRIED "CanBeCarried".

Searching this file for other occurences of "MODELBMGR_MODEL_CANBECARRIED" leads e.g. to:

m_aModels[iModel].m_bCanBeCarried = (LTBOOL)m_buteMgr.GetBool(s_aTagName, MODELBMGR_MODEL_CANBECARRIED, MODELBMGR_MODEL_DEFAULT_CANBECARRIED);

So we get this value returned from the "m_buteMgr"'s function "GetBool" using some fancy parameters AND our String "CanBeCarried". The class "CModelButeMgr" is derived from "CGameButeMgr" (see the command in the header file:
"class CModelButeMgr : public CGameButeMgr").

The class "CGameButeMgr" finally has the member "m_buteMgr" of type CButeMgr (see "GameButeMgr.h"), which, looking at the file and the includes just HAS to come from "ButeMgr.h". CButeMgr, so I reckon, is used to parse the bute (.txt) files. In short (unless I err here since I've been very sloppy, sorry to all the programmers):

A bute file, which has to be read at some point, should contain the string "CanBeCarried" and additionally the value, alternatively the tool you're using for editing should let you edit this attribute (very likely with that name).

Take e.g. the file GAME\ATTRIBUTES\MODELBUTES.TXT. You'll find
[Model7]

Name = "SSLeut"

**** lotta blahblah here ****

AIName = "SSoldierLT"
CanBeCarried = FALSE
Animation = "Attributes\\AnimationsSuperSoldier.txt"
Now we know why we couldn't carry the Supersoldier.

Does that help? Better tell us what you're up to!
People who are rather more than six feet tall and nearly as broad across the shoulders often have uneventful journeys. People jump out at them from behind rocks then say things like, "Oh. Sorry. I thought you were someone else."

Old Salt
Member
Member
Posts: 7
Joined: Sun May 15, 2005 4:16 pm

Post by Old Salt » Sun Jan 14, 2007 7:34 pm

Thanks Alexa. I'm trying to create a "CanBeCarried" Mod for Co-op
teammates.

Post Reply
jedwabna poszewka 50x60