private _2DSprite GetWallSprite(Wall pattern, WallStyle style, int rotation, bool down, WorldState world) { var _Sprite = new _2DSprite() { RenderMode = _2DBatchRenderMode.WALL }; SPR sprite = null; SPR mask = null; switch (world.Zoom) { case WorldZoom.Far: sprite = pattern.Far; if (style != null) mask = (down) ? style.WallsDownFar : style.WallsUpFar; _Sprite.DestRect = DESTINATION_FAR[rotation]; _Sprite.Depth = WallZBuffers[rotation+8]; break; case WorldZoom.Medium: sprite = pattern.Medium; if (style != null) mask = (down) ? style.WallsDownMedium : style.WallsUpMedium; _Sprite.DestRect = DESTINATION_MED[rotation]; _Sprite.Depth = WallZBuffers[rotation+4]; break; case WorldZoom.Near: sprite = pattern.Near; if (style != null) mask = (down) ? style.WallsDownNear : style.WallsUpNear; _Sprite.DestRect = DESTINATION_NEAR[rotation]; _Sprite.Depth = WallZBuffers[rotation]; break; } if (sprite != null) { if (mask == null) mask = sprite; _Sprite.Pixel = world._2D.GetTexture(sprite.Frames[rotation]); _Sprite.Mask = world._2D.GetTexture(mask.Frames[rotation]); _Sprite.SrcRect = new Microsoft.Xna.Framework.Rectangle(0, 0, _Sprite.Pixel.Width, _Sprite.Pixel.Height); } return _Sprite; }
public override void PositionChange(VMContext context, bool noEntryPoint) { if (GhostImage) return; if (Container != null) return; if (Position == LotTilePos.OUT_OF_WORLD) return; var arch = context.Architecture; if (((VMEntityFlags2)ObjectData[(int)VMStackObjectVariable.FlagField2] & (VMEntityFlags2.ArchitectualWindow | VMEntityFlags2.ArchitectualDoor)) > 0) { //if wall or door, attempt to place style on wall if (Object.OBJ.WallStyle > 21 && Object.OBJ.WallStyle < 256) { //first thing's first, is the style between 22-255 inclusive? If it is, then the style is stored in the object. Need to load its sprites and change the id for the objd. var id = Object.OBJ.WallStyleSpriteID; var style = new WallStyle() { WallsUpFar = Object.Resource.Get<SPR>(id), WallsUpMedium = Object.Resource.Get<SPR>((ushort)(id + 1)), WallsUpNear = Object.Resource.Get<SPR>((ushort)(id + 2)), WallsDownFar = Object.Resource.Get<SPR>((ushort)(id + 3)), WallsDownMedium = Object.Resource.Get<SPR>((ushort)(id + 4)), WallsDownNear = Object.Resource.Get<SPR>((ushort)(id + 5)) }; Object.OBJ.WallStyle = FSO.Content.Content.Get().WorldWalls.AddDynamicWallStyle(style); } var placeFlags = (WallPlacementFlags)ObjectData[(int)VMStackObjectVariable.WallPlacementFlags]; var dir = DirectionToWallOff(Direction); if ((placeFlags & WallPlacementFlags.WallRequiredInFront) > 0) SetWallStyle((dir) % 4, arch, Object.OBJ.WallStyle); if ((placeFlags & WallPlacementFlags.WallRequiredOnRight) > 0) SetWallStyle((dir + 1) % 4, arch, Object.OBJ.WallStyle); if ((placeFlags & WallPlacementFlags.WallRequiredBehind) > 0) SetWallStyle((dir + 2) % 4, arch, Object.OBJ.WallStyle); if ((placeFlags & WallPlacementFlags.WallRequiredOnLeft) > 0) SetWallStyle((dir + 3) % 4, arch, Object.OBJ.WallStyle); } SetWallUse(arch, true); if (GetValue(VMStackObjectVariable.Category) == 8) context.Architecture.SetObjectSupported(Position.TileX, Position.TileY, Position.Level, true); context.RegisterObjectPos(this); base.PositionChange(context, noEntryPoint); }