diff --git a/Source/ZDoom/ActorStructure.cs b/Source/ZDoom/ActorStructure.cs index aa67b8ab..c50ac8c4 100644 --- a/Source/ZDoom/ActorStructure.cs +++ b/Source/ZDoom/ActorStructure.cs @@ -348,6 +348,11 @@ namespace CodeImp.DoomBuilder.ZDoom this.radius = baseactor.radius; this.games = new List(baseactor.games); this.states = new Dictionary(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; } } } diff --git a/Tests/Decorate/DECORATE.txt b/Tests/Decorate/DECORATE.txt new file mode 100644 index 00000000..033562ec --- /dev/null +++ b/Tests/Decorate/DECORATE.txt @@ -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 + } +} diff --git a/Tests/Decorate/decoratetest.dbs b/Tests/Decorate/decoratetest.dbs new file mode 100644 index 00000000..188d5a4d --- /dev/null +++ b/Tests/Decorate/decoratetest.dbs @@ -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; + } + + } + +} + diff --git a/Tests/Decorate/decoratetest.wad b/Tests/Decorate/decoratetest.wad new file mode 100644 index 00000000..3ed76228 Binary files /dev/null and b/Tests/Decorate/decoratetest.wad differ