mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- Update for skill replacement.
SVN r1682 (trunk)
This commit is contained in:
parent
5a80938b11
commit
7ccca5733f
1 changed files with 23 additions and 9 deletions
32
src/info.cpp
32
src/info.cpp
|
@ -171,6 +171,17 @@ void FActorInfo::RegisterIDs ()
|
||||||
FActorInfo *FActorInfo::GetReplacement (bool lookskill)
|
FActorInfo *FActorInfo::GetReplacement (bool lookskill)
|
||||||
{
|
{
|
||||||
FName skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName);
|
FName skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName);
|
||||||
|
if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL)
|
||||||
|
{
|
||||||
|
Printf("Warning: incorrect actor name in definition of skill %s: \n\
|
||||||
|
class %s is replaced by inexistent class %s\n\
|
||||||
|
Skill replacement will be ignored for this actor.\n",
|
||||||
|
AllSkills[gameskill].Name.GetChars(),
|
||||||
|
this->Class->TypeName.GetChars(), skillrepname.GetChars());
|
||||||
|
AllSkills[gameskill].SetReplacement(this->Class->TypeName, NAME_None);
|
||||||
|
AllSkills[gameskill].SetReplacedBy(skillrepname, NAME_None);
|
||||||
|
lookskill = false; skillrepname = NAME_None;
|
||||||
|
}
|
||||||
if (Replacement == NULL && (!lookskill || skillrepname == NAME_None))
|
if (Replacement == NULL && (!lookskill || skillrepname == NAME_None))
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
|
@ -183,7 +194,7 @@ FActorInfo *FActorInfo::GetReplacement (bool lookskill)
|
||||||
// Handle skill-based replacement here. It has precedence on DECORATE replacement
|
// Handle skill-based replacement here. It has precedence on DECORATE replacement
|
||||||
// in that the skill replacement is applied first, followed by DECORATE replacement
|
// in that the skill replacement is applied first, followed by DECORATE replacement
|
||||||
// on the actor indicated by the skill replacement.
|
// on the actor indicated by the skill replacement.
|
||||||
if (lookskill && skillrepname != NAME_None && PClass::FindClass(skillrepname) != NULL)
|
if (lookskill && (skillrepname != NAME_None))
|
||||||
{
|
{
|
||||||
rep = PClass::FindClass(skillrepname)->ActorInfo;
|
rep = PClass::FindClass(skillrepname)->ActorInfo;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +213,16 @@ FActorInfo *FActorInfo::GetReplacement (bool lookskill)
|
||||||
|
|
||||||
FActorInfo *FActorInfo::GetReplacee (bool lookskill)
|
FActorInfo *FActorInfo::GetReplacee (bool lookskill)
|
||||||
{
|
{
|
||||||
FName skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName);
|
FName skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName); if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL) {
|
||||||
|
Printf("Warning: incorrect actor name in definition of skill %s: \
|
||||||
|
inexistent class %s is replaced by class %s\n\
|
||||||
|
Skill replacement will be ignored for this actor.\n",
|
||||||
|
AllSkills[gameskill].Name.GetChars(),
|
||||||
|
skillrepname.GetChars(), this->Class->TypeName.GetChars());
|
||||||
|
AllSkills[gameskill].SetReplacedBy(this->Class->TypeName, NAME_None);
|
||||||
|
AllSkills[gameskill].SetReplacement(skillrepname, NAME_None);
|
||||||
|
lookskill = false;
|
||||||
|
}
|
||||||
if (Replacee == NULL && (!lookskill || skillrepname == NAME_None))
|
if (Replacee == NULL && (!lookskill || skillrepname == NAME_None))
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
|
@ -211,13 +231,7 @@ FActorInfo *FActorInfo::GetReplacee (bool lookskill)
|
||||||
// potential infinite recursion.
|
// potential infinite recursion.
|
||||||
FActorInfo *savedrep = Replacee;
|
FActorInfo *savedrep = Replacee;
|
||||||
Replacee = NULL;
|
Replacee = NULL;
|
||||||
FActorInfo *rep = savedrep;
|
FActorInfo *rep = savedrep; if (lookskill && (skillrepname != NAME_None) && (PClass::FindClass(skillrepname) != NULL)) { rep = PClass::FindClass(skillrepname)->ActorInfo; } rep = rep->GetReplacee (false); Replacee = savedrep;
|
||||||
if (lookskill && skillrepname != NAME_None && PClass::FindClass(skillrepname) != NULL)
|
|
||||||
{
|
|
||||||
rep = PClass::FindClass(skillrepname)->ActorInfo;
|
|
||||||
}
|
|
||||||
rep = rep->GetReplacee (false);
|
|
||||||
Replacee = savedrep;
|
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue