forked from Mirrors/openclonk
Collectible as a property
parent
0898288a87
commit
427a2f2346
|
@ -163,6 +163,7 @@ inline unsigned int C4Set<C4String *>::Hash<C4String *>(C4String * e)
|
|||
enum C4PropertyName {
|
||||
P_Prototype,
|
||||
P_Name,
|
||||
P_Collectible,
|
||||
P_LAST };
|
||||
|
||||
// There is only one Stringtable in Game.ScriptEngine
|
||||
|
|
|
@ -612,7 +612,7 @@ void C4Command::Exit()
|
|||
if (cObj->Contained->GetEntranceArea(ex,ey,ewdt,ehgt))
|
||||
{ cObj->Exit(ex+ewdt/2,ey+ehgt+cObj->Shape.GetY()-1); Finish(TRUE); return; }
|
||||
// Exit jump out of collection area
|
||||
if (cObj->Def->Carryable)
|
||||
if (cObj->GetPropertyInt(P_Collectible))
|
||||
if (cObj->Contained->Def->Collection.Wdt)
|
||||
{
|
||||
cObj->Exit(cObj->Contained->GetX(),cObj->Contained->GetY()+cObj->Contained->Def->Collection.y-1);
|
||||
|
|
|
@ -804,11 +804,13 @@ BOOL C4Def::Load(C4Group &hGroup,
|
|||
|
||||
#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// Temporary flag
|
||||
if (dwLoadWhat & C4D_Load_Temporary) Temporary=TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
// Temporary flag
|
||||
if (dwLoadWhat & C4D_Load_Temporary) Temporary=TRUE;
|
||||
|
||||
if (Carryable) SetProperty(Strings.P[P_Collectible], C4VTrue);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL C4Def::LoadActMap(C4Group &hGroup)
|
||||
{
|
||||
|
|
|
@ -618,7 +618,7 @@ void C4Object::SetOCF()
|
|||
if (Def->Grab && !(Category & C4D_StaticBack))
|
||||
OCF|=OCF_Grab;
|
||||
// OCF_Carryable: Can be picked up
|
||||
if (Def->Carryable)
|
||||
if (GetPropertyInt(P_Collectible))
|
||||
OCF|=OCF_Carryable;
|
||||
// OCF_OnFire: Is burning
|
||||
if (OnFire)
|
||||
|
@ -748,11 +748,14 @@ void C4Object::UpdateOCF()
|
|||
else
|
||||
InMat = GBackMat(GetX(), GetY());
|
||||
// Keep the bits that only have to be updated with SetOCF (def, category, con, alive, onfire)
|
||||
OCF=OCF & (OCF_Normal | OCF_Carryable | OCF_Exclusive | OCF_Edible | OCF_Grab | OCF_FullCon
|
||||
OCF=OCF & (OCF_Normal | OCF_Exclusive | OCF_Edible | OCF_Grab | OCF_FullCon
|
||||
/*| OCF_Chop - now updated regularly, see below */
|
||||
| OCF_Rotate | OCF_OnFire | OCF_Inflammable | OCF_Living | OCF_Alive
|
||||
| OCF_LineConstruct | OCF_Prey | OCF_CrewMember | OCF_AttractLightning
|
||||
| OCF_PowerConsumer);
|
||||
// OCF_Carryable: Can be picked up
|
||||
if (GetPropertyInt(P_Collectible))
|
||||
OCF|=OCF_Carryable;
|
||||
// OCF_Construct: Can be built outside
|
||||
if (Def->Constructable && (Con<FullCon)
|
||||
&& (r==0) && !OnFire)
|
||||
|
|
|
@ -79,6 +79,7 @@ C4StringTable::C4StringTable()
|
|||
{
|
||||
P[P_Prototype] = RegString("Prototype");
|
||||
P[P_Name] = RegString("Name");
|
||||
P[P_Collectible] = RegString("Collectible");
|
||||
for (unsigned int i = 0; i < P_LAST; ++i) P[i]->IncRef();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue