mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Added Gez's actor replacement per skill submission.
SVN r1681 (trunk)
This commit is contained in:
parent
590eb5cb76
commit
5a80938b11
5 changed files with 103 additions and 9 deletions
|
@ -1,4 +1,7 @@
|
||||||
June 25, 2009
|
June 26, 2009 (Changes by Graf Zahl)
|
||||||
|
- Added Gez's actor replacement per skill submission.
|
||||||
|
|
||||||
|
June 25, 2009
|
||||||
- Joystick axes can be configured in the menu again. TODO: Config saving
|
- Joystick axes can be configured in the menu again. TODO: Config saving
|
||||||
and loading, XInput, allow axes to be used as buttons (for the Xbox
|
and loading, XInput, allow axes to be used as buttons (for the Xbox
|
||||||
controller's trigger buttons), allow the joystick to move through the
|
controller's trigger buttons), allow the joystick to move through the
|
||||||
|
|
|
@ -533,6 +533,8 @@ int G_SkillProperty(ESkillProperty prop);
|
||||||
|
|
||||||
typedef TMap<FName, FString> SkillMenuNames;
|
typedef TMap<FName, FString> SkillMenuNames;
|
||||||
|
|
||||||
|
typedef TMap<FName, FName> SkillActorReplacement;
|
||||||
|
|
||||||
struct FSkillInfo
|
struct FSkillInfo
|
||||||
{
|
{
|
||||||
FName Name;
|
FName Name;
|
||||||
|
@ -554,6 +556,8 @@ struct FSkillInfo
|
||||||
FString MustConfirmText;
|
FString MustConfirmText;
|
||||||
char Shortcut;
|
char Shortcut;
|
||||||
FString TextColor;
|
FString TextColor;
|
||||||
|
SkillActorReplacement Replace;
|
||||||
|
SkillActorReplacement Replaced;
|
||||||
|
|
||||||
FSkillInfo() {}
|
FSkillInfo() {}
|
||||||
FSkillInfo(const FSkillInfo &other)
|
FSkillInfo(const FSkillInfo &other)
|
||||||
|
@ -562,6 +566,11 @@ struct FSkillInfo
|
||||||
}
|
}
|
||||||
FSkillInfo &operator=(const FSkillInfo &other);
|
FSkillInfo &operator=(const FSkillInfo &other);
|
||||||
int GetTextColor() const;
|
int GetTextColor() const;
|
||||||
|
|
||||||
|
void SetReplacement(FName a, FName b);
|
||||||
|
FName GetReplacement(FName a);
|
||||||
|
void SetReplacedBy(FName b, FName a);
|
||||||
|
FName GetReplacedBy(FName b);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TArray<FSkillInfo> AllSkills;
|
extern TArray<FSkillInfo> AllSkills;
|
||||||
|
|
|
@ -70,6 +70,8 @@ void FMapInfoParser::ParseSkill ()
|
||||||
skill.MustConfirm = false;
|
skill.MustConfirm = false;
|
||||||
skill.Shortcut = 0;
|
skill.Shortcut = 0;
|
||||||
skill.TextColor = "";
|
skill.TextColor = "";
|
||||||
|
skill.Replace.Clear();
|
||||||
|
skill.Replaced.Clear();
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
skill.Name = sc.String;
|
skill.Name = sc.String;
|
||||||
|
@ -159,6 +161,17 @@ void FMapInfoParser::ParseSkill ()
|
||||||
sc.MustGetNumber ();
|
sc.MustGetNumber ();
|
||||||
skill.ACSReturn = sc.Number;
|
skill.ACSReturn = sc.Number;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("ReplaceActor"))
|
||||||
|
{
|
||||||
|
ParseAssign();
|
||||||
|
sc.MustGetString();
|
||||||
|
FName replaced = sc.String;
|
||||||
|
ParseComma();
|
||||||
|
sc.MustGetString();
|
||||||
|
FName replacer = sc.String;
|
||||||
|
skill.SetReplacement(replaced, replacer);
|
||||||
|
skill.SetReplacedBy(replacer, replaced);
|
||||||
|
}
|
||||||
else if (sc.Compare("Name"))
|
else if (sc.Compare("Name"))
|
||||||
{
|
{
|
||||||
ParseAssign();
|
ParseAssign();
|
||||||
|
@ -338,6 +351,8 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
|
||||||
MustConfirmText = other.MustConfirmText;
|
MustConfirmText = other.MustConfirmText;
|
||||||
Shortcut = other.Shortcut;
|
Shortcut = other.Shortcut;
|
||||||
TextColor = other.TextColor;
|
TextColor = other.TextColor;
|
||||||
|
Replace = other.Replace;
|
||||||
|
Replaced = other.Replaced;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,3 +378,48 @@ int FSkillInfo::GetTextColor() const
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FSkillInfo::SetReplacement
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FSkillInfo::SetReplacement(FName a, FName b)
|
||||||
|
{
|
||||||
|
Replace[a] = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FSkillInfo::GetReplacement
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
FName FSkillInfo::GetReplacement(FName a)
|
||||||
|
{
|
||||||
|
if (Replace.CheckKey(a)) return Replace[a];
|
||||||
|
else return NAME_None;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FSkillInfo::SetReplaced
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FSkillInfo::SetReplacedBy(FName b, FName a)
|
||||||
|
{
|
||||||
|
Replaced[b] = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FSkillInfo::GetReplaced
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
FName FSkillInfo::GetReplacedBy(FName b)
|
||||||
|
{
|
||||||
|
if (Replaced.CheckKey(b)) return Replaced[b];
|
||||||
|
else return NAME_None;
|
||||||
|
}
|
||||||
|
|
34
src/info.cpp
34
src/info.cpp
|
@ -48,9 +48,13 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
|
||||||
extern void LoadActors ();
|
extern void LoadActors ();
|
||||||
|
|
||||||
|
extern TArray<FSkillInfo> AllSkills;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -164,9 +168,10 @@ void FActorInfo::RegisterIDs ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FActorInfo *FActorInfo::GetReplacement ()
|
FActorInfo *FActorInfo::GetReplacement (bool lookskill)
|
||||||
{
|
{
|
||||||
if (Replacement == NULL)
|
FName skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName);
|
||||||
|
if (Replacement == NULL && (!lookskill || skillrepname == NAME_None))
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +179,18 @@ FActorInfo *FActorInfo::GetReplacement ()
|
||||||
// potential infinite recursion.
|
// potential infinite recursion.
|
||||||
FActorInfo *savedrep = Replacement;
|
FActorInfo *savedrep = Replacement;
|
||||||
Replacement = NULL;
|
Replacement = NULL;
|
||||||
FActorInfo *rep = savedrep->GetReplacement ();
|
FActorInfo *rep = savedrep;
|
||||||
|
// Handle skill-based replacement here. It has precedence on DECORATE replacement
|
||||||
|
// in that the skill replacement is applied first, followed by DECORATE replacement
|
||||||
|
// on the actor indicated by the skill replacement.
|
||||||
|
if (lookskill && skillrepname != NAME_None && PClass::FindClass(skillrepname) != NULL)
|
||||||
|
{
|
||||||
|
rep = PClass::FindClass(skillrepname)->ActorInfo;
|
||||||
|
}
|
||||||
|
// Now handle DECORATE replacement chain
|
||||||
|
// Skill replacements are not recursive, contrarily to DECORATE replacements
|
||||||
|
rep = rep->GetReplacement(false);
|
||||||
|
// Reset the temporarily NULLed field
|
||||||
Replacement = savedrep;
|
Replacement = savedrep;
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
@ -184,9 +200,10 @@ FActorInfo *FActorInfo::GetReplacement ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FActorInfo *FActorInfo::GetReplacee ()
|
FActorInfo *FActorInfo::GetReplacee (bool lookskill)
|
||||||
{
|
{
|
||||||
if (Replacee == NULL)
|
FName skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName);
|
||||||
|
if (Replacee == NULL && (!lookskill || skillrepname == NAME_None))
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +211,12 @@ FActorInfo *FActorInfo::GetReplacee ()
|
||||||
// potential infinite recursion.
|
// potential infinite recursion.
|
||||||
FActorInfo *savedrep = Replacee;
|
FActorInfo *savedrep = Replacee;
|
||||||
Replacee = NULL;
|
Replacee = NULL;
|
||||||
FActorInfo *rep = savedrep->GetReplacee ();
|
FActorInfo *rep = savedrep;
|
||||||
|
if (lookskill && skillrepname != NAME_None && PClass::FindClass(skillrepname) != NULL)
|
||||||
|
{
|
||||||
|
rep = PClass::FindClass(skillrepname)->ActorInfo;
|
||||||
|
}
|
||||||
|
rep = rep->GetReplacee (false);
|
||||||
Replacee = savedrep;
|
Replacee = savedrep;
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,8 @@ struct FActorInfo
|
||||||
return FindState(1, &name);
|
return FindState(1, &name);
|
||||||
}
|
}
|
||||||
|
|
||||||
FActorInfo *GetReplacement ();
|
FActorInfo *GetReplacement (bool lookskill=true);
|
||||||
FActorInfo *GetReplacee ();
|
FActorInfo *GetReplacee (bool lookskill=true);
|
||||||
|
|
||||||
PClass *Class;
|
PClass *Class;
|
||||||
FState *OwnedStates;
|
FState *OwnedStates;
|
||||||
|
|
Loading…
Reference in a new issue