Collectible as a property

stable-5.2
Günther Brammer 2009-04-11 16:38:31 +02:00
parent 0898288a87
commit 427a2f2346
5 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -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)
{

View File

@ -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)

View File

@ -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();
}