RegisterObjectPos() public method

public RegisterObjectPos ( FSO.SimAntics.VMEntity obj ) : void
obj FSO.SimAntics.VMEntity
return void
        public override void PositionChange(VMContext context, bool noEntryPoint)
        {
            if (GhostImage)
            {
                return;
            }

            var room = context.GetObjectRoom(this);

            SetRoom(room);

            if (HandObject != null)
            {
                context.UnregisterObjectPos(HandObject);
                HandObject.Position = Position;
                HandObject.PositionChange(context, noEntryPoint);
            }

            context.RegisterObjectPos(this);
            if (Container != null)
            {
                return;
            }
            if (Position == LotTilePos.OUT_OF_WORLD)
            {
                return;
            }

            base.PositionChange(context, noEntryPoint);
        }
示例#2
0
        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);
        }
示例#3
0
        public override void PositionChange(VMContext context, bool noEntryPoint)
        {
            if (GhostImage)
            {
                return;
            }

            var room = context.GetObjectRoom(this);

            SetRoom(room);
            for (int i = 0; i < Contained.Length; i++)
            {
                if (Contained[i] != null)
                {
                    context.UnregisterObjectPos(Contained[i]);
                    Contained[i].Position = Position;
                    Contained[i].PositionChange(context, noEntryPoint); //recursive
                }
            }

            context.RegisterObjectPos(this);

            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 sprs = new SPR[6];
                    for (int i = 0; i < 6; i++)
                    {
                        sprs[i] = Object.Resource.Get <SPR>((ushort)(id + i));
                        if (sprs[i] != null)
                        {
                            sprs[i].WallStyle = true;
                        }
                    }
                    var style = new WallStyle()
                    {
                        WallsUpFar      = sprs[0],
                        WallsUpMedium   = sprs[1],
                        WallsUpNear     = sprs[2],
                        WallsDownFar    = sprs[3],
                        WallsDownMedium = sprs[4],
                        WallsDownNear   = sprs[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);
                }
            }
            var exclusive = GetValue(VMStackObjectVariable.ExclusivePlacementFlags);

            SetWallUse(arch, true, ((exclusive & 2) > 0));
            if (GetValue(VMStackObjectVariable.Category) == 8)
            {
                context.Architecture.SetObjectSupported(Position.TileX, Position.TileY, Position.Level, true);
            }

            if (EntryPoints[8].ActionFunction != 0)
            {
                UpdateDynamicMultitile(context);
            }

            base.PositionChange(context, noEntryPoint);
        }
示例#4
0
        public override void PositionChange(VMContext context, bool noEntryPoint)
        {
            if (GhostImage) return;
            if (Container != null) return;
            if (Position == LotTilePos.OUT_OF_WORLD) return;

            context.RegisterObjectPos(this);

            base.PositionChange(context, noEntryPoint);
        }