2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/shock/shkdmprp.cpp,v 1.2 1998/06/30 12:09:47 TOML Exp $
9 // Death model name property
35 static ILabelProperty
* pDeathModelNameProp
= NULL
;
37 ////////////////////////////////////////////////////////////
38 // DEATH MODEL NAME PROPERTY CREATION
41 #define DEATHMODELNAMEPROP_IMPL kPropertyImplSparse
43 static sPropertyConstraint deathmodelnameprop_const
[] =
45 { kPropertyNullConstraint
, NULL
}
48 static sPropertyDesc deathmodelnameprop_desc
=
50 PROP_DEATHMODELNAME_NAME
,
52 deathmodelnameprop_const
,
54 { "Shape", "Death Model Name" },
58 // called when the name is modified
59 static void LGAPI ModelNameListener(sPropertyListenMsg* msg, PropListenerData data)
61 if (msg->property != modelnameprop->GetID())
64 // don't do this work here, it is done in NumProp::Notify
65 if (msg->type & kListenPropLoad)
68 if (msg->type & (kListenPropModify|kListenPropSet))
71 if (OBJ_IS_CONCRETE(msg->obj) || ObjGetModelNumber(msg->obj,&dummy))
72 ObjLoadModel(msg->obj);
73 else // load all descendents
75 AutoAppIPtr_(TraitManager,TraitMan);
76 IObjectQuery* query = TraitMan->Query(msg->obj,kTraitQueryAllDescendents);
77 for (; !query->Done(); query->Next())
79 ObjID obj = query->Object();
80 if (OBJ_IS_CONCRETE(obj))
81 ObjLoadModel(msg->obj);
89 eDamageResult LGAPI
DeathModelDamageListener(const sDamageMsg
* pMsg
, tDamageCallbackData data
)
93 if (ObjGetDeathModelName(pMsg
->victim
, (char*)&name
))
94 ObjSetModelName(pMsg
->victim
, (char*)&name
);
95 return kDamageNoOpinion
;
99 void DeathModelNamePropInit(void)
101 pDeathModelNameProp
= CreateLabelProperty(&deathmodelnameprop_desc
, DEATHMODELNAMEPROP_IMPL
);
102 AutoAppIPtr_(DamageModel
, pDamageModel
);
103 pDamageModel
->Listen(kDamageMsgSlay
, &DeathModelDamageListener
, NULL
);
106 // get and set functions
107 BOOL
ObjGetDeathModelName(ObjID obj
, char *name
)
109 Assert_(pDeathModelNameProp
);
111 BOOL retval
= pDeathModelNameProp
->Get(obj
, (Label
**)&temp
);
112 if (retval
) // hope name long enough!
117 void ObjSetDeathModelName(ObjID obj
, char *name
)
119 Assert_(pDeathModelNameProp
);
120 pDeathModelNameProp
->Set(obj
, (Label
*)name
);