2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
7 // Death model name property
33 static ILabelProperty
* pDeathModelNameProp
= NULL
;
35 ////////////////////////////////////////////////////////////
36 // DEATH MODEL NAME PROPERTY CREATION
39 #define DEATHMODELNAMEPROP_IMPL kPropertyImplSparse
41 static sPropertyConstraint deathmodelnameprop_const
[] =
43 { kPropertyNullConstraint
, NULL
}
46 static sPropertyDesc deathmodelnameprop_desc
=
48 PROP_DEATHMODELNAME_NAME
,
50 deathmodelnameprop_const
,
52 { "Shape", "Death Model Name" },
56 // called when the name is modified
57 static void LGAPI ModelNameListener(sPropertyListenMsg* msg, PropListenerData data)
59 if (msg->property != modelnameprop->GetID())
62 // don't do this work here, it is done in NumProp::Notify
63 if (msg->type & kListenPropLoad)
66 if (msg->type & (kListenPropModify|kListenPropSet))
69 if (OBJ_IS_CONCRETE(msg->obj) || ObjGetModelNumber(msg->obj,&dummy))
70 ObjLoadModel(msg->obj);
71 else // load all descendents
73 AutoAppIPtr_(TraitManager,TraitMan);
74 IObjectQuery* query = TraitMan->Query(msg->obj,kTraitQueryAllDescendents);
75 for (; !query->Done(); query->Next())
77 ObjID obj = query->Object();
78 if (OBJ_IS_CONCRETE(obj))
79 ObjLoadModel(msg->obj);
87 eDamageResult LGAPI
DeathModelDamageListener(const sDamageMsg
* pMsg
, tDamageCallbackData data
)
91 if (ObjGetDeathModelName(pMsg
->victim
, (char*)&name
))
92 ObjSetModelName(pMsg
->victim
, (char*)&name
);
93 return kDamageNoOpinion
;
97 void DeathModelNamePropInit(void)
99 pDeathModelNameProp
= CreateLabelProperty(&deathmodelnameprop_desc
, DEATHMODELNAMEPROP_IMPL
);
100 AutoAppIPtr_(DamageModel
, pDamageModel
);
101 pDamageModel
->Listen(kDamageMsgSlay
, &DeathModelDamageListener
, NULL
);
104 // get and set functions
105 BOOL
ObjGetDeathModelName(ObjID obj
, char *name
)
107 Assert_(pDeathModelNameProp
);
109 BOOL retval
= pDeathModelNameProp
->Get(obj
, (Label
**)&temp
);
110 if (retval
) // hope name long enough!
115 void ObjSetDeathModelName(ObjID obj
, char *name
)
117 Assert_(pDeathModelNameProp
);
118 pDeathModelNameProp
->Set(obj
, (Label
*)name
);