- Fixed //$Sprite bug in DECORATE actor parser

- Fixed some property inheritance in DECORATE actors
This commit is contained in:
codeimp 2009-04-18 23:22:36 +00:00
parent 43a3560b68
commit 4a60a4fa03
4 changed files with 88 additions and 11 deletions

View file

@ -348,6 +348,11 @@ namespace CodeImp.DoomBuilder.ZDoom
this.radius = baseactor.radius;
this.games = new List<string>(baseactor.games);
this.states = new Dictionary<string, StateStructure>(baseactor.states);
this.sprite = baseactor.sprite;
this.category = baseactor.category;
this.radiusfound = baseactor.radiusfound;
this.heightfound = baseactor.heightfound;
//this.tag = baseactor.tag; // do we want to inherit this?
}
// This returns the status of a flag
@ -380,7 +385,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// This finds the best suitable sprite to use
public string FindSuitableSprite()
{
string sprite = "";
string result = "";
// Sprite forced?
if(!string.IsNullOrEmpty(sprite))
@ -394,46 +399,46 @@ namespace CodeImp.DoomBuilder.ZDoom
{
StateStructure s = states["idle"];
if(!string.IsNullOrEmpty(s.FirstSprite))
sprite = s.FirstSprite;
result = s.FirstSprite;
}
// Try the see state
if(string.IsNullOrEmpty(sprite) && states.ContainsKey("see"))
if(string.IsNullOrEmpty(result) && states.ContainsKey("see"))
{
StateStructure s = states["see"];
if(!string.IsNullOrEmpty(s.FirstSprite))
sprite = s.FirstSprite;
result = s.FirstSprite;
}
// Try the inactive state
if(string.IsNullOrEmpty(sprite) && states.ContainsKey("inactive"))
if(string.IsNullOrEmpty(result) && states.ContainsKey("inactive"))
{
StateStructure s = states["inactive"];
if(!string.IsNullOrEmpty(s.FirstSprite))
sprite = s.FirstSprite;
result = s.FirstSprite;
}
// Still no sprite found? then just pick the first we can find
if(string.IsNullOrEmpty(sprite))
if(string.IsNullOrEmpty(result))
{
foreach(StateStructure s in states.Values)
{
if(!string.IsNullOrEmpty(s.FirstSprite))
{
sprite = s.FirstSprite;
result = s.FirstSprite;
break;
}
}
}
if(!string.IsNullOrEmpty(sprite))
if(!string.IsNullOrEmpty(result))
{
// The sprite name is not actually complete, we still have to append
// the direction characters to it. Find an existing sprite with direction.
foreach(string postfix in SPRITE_POSTFIXES)
{
if(General.Map.Data.GetSpriteExists(sprite + postfix))
return sprite + postfix;
if(General.Map.Data.GetSpriteExists(result + postfix))
return result + postfix;
}
}
}

View file

@ -0,0 +1,33 @@
actor SanyaChainsaw : Weapon 6205
{
//$Category BDIS2_Armory
//$Sprite CSAWA0
Game Doom
SpawnID 32
Weapon.Kickback 0
Weapon.SelectionOrder 2200
Weapon.UpSound "weapons/sawup"
Weapon.ReadySound "weapons/sawidle"
Inventory.PickupMessage "A chainsaw!"
Obituary "%o was mowed over by %k's chainsaw."
+WEAPON.MELEEWEAPON
States
{
Ready:
SAWG AB 4 A_WeaponReady
loop
Deselect:
SAWG A 1 A_Lower
loop
Select:
SAWG A 1 A_Raise
loop
Fire:
SAWG CD 4 A_Saw
SAWG D 0 A_ReFire
goto Ready
Spawn:
CSAW A -1
stop
}
}

View file

@ -0,0 +1,39 @@
type = "Doom Builder Map Settings Configuration";
gameconfig = "ZDoom_DoomHexen.cfg";
strictpatches = 0;
maps
{
MAP01
{
resources
{
resource0
{
type = 1;
location = "F:\\Projects\\Doom Builder\\Tests\\Decorate";
option1 = 0;
option2 = 0;
}
}
grid
{
background = "";
backsource = 0;
backoffsetx = 0;
backoffsety = 0;
backscalex = 100;
backscaley = 100;
gridsize = 32;
}
}
}

Binary file not shown.