Exemple #1
0
 /// <summary>
 /// Reads a OBJf chunk from a stream.
 /// </summary>
 /// <param name="iff">An Iff instance.</param>
 /// <param name="stream">A Stream object holding a OBJf chunk.</param>
 public override void Read(Iff iff, Stream stream)
 {
     using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.ReadUInt32(); //pad
         Version = io.ReadUInt32();
         string magic = io.ReadCString(4);
         functions = new OBJfFunctionEntry[io.ReadUInt32()];
         for (int i=0; i<functions.Length; i++) {
             var result = new OBJfFunctionEntry();
             result.ConditionFunction = io.ReadUInt16();
             result.ActionFunction = io.ReadUInt16();
             functions[i] = result;
         }
     }
 }
Exemple #2
0
 public override void Read(Iff iff, Stream stream)
 {
     using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
     {
         io.ReadUInt32(); //pad
         Version = io.ReadUInt32();
         string magic = io.ReadCString(4);
         functions = new OBJfFunctionEntry[io.ReadUInt32()];
         for (int i = 0; i < functions.Length; i++)
         {
             var result = new OBJfFunctionEntry();
             result.ConditionFunction = io.ReadUInt16();
             result.ActionFunction    = io.ReadUInt16();
             functions[i]             = result;
         }
     }
 }
        public OBJfFunctionEntry[] GenerateFunctionTable(OBJD obj)
        {
            OBJfFunctionEntry[] result = new OBJfFunctionEntry[33];

            result[0].ActionFunction = obj.BHAV_Init;
            result[1].ActionFunction = obj.BHAV_MainID;
            result[2].ActionFunction = obj.BHAV_Load;
            result[3].ActionFunction = obj.BHAV_Cleanup;
            result[4].ActionFunction = obj.BHAV_QueueSkipped;
            result[5].ActionFunction = obj.BHAV_AllowIntersectionID;
            result[6].ActionFunction = obj.BHAV_WallAdjacencyChanged;
            result[7].ActionFunction = obj.BHAV_RoomChange;
            result[8].ActionFunction = obj.BHAV_DynamicMultiTileUpdate;
            result[9].ActionFunction = obj.BHAV_Place;
            result[10].ActionFunction = obj.BHAV_PickupID;
            result[11].ActionFunction = obj.BHAV_UserPlace;
            result[12].ActionFunction = obj.BHAV_UserPickup;
            result[13].ActionFunction = obj.BHAV_LevelInfo;
            result[14].ActionFunction = obj.BHAV_ServingSurface;
            result[15].ActionFunction = obj.BHAV_Portal; //portal
            result[16].ActionFunction = obj.BHAV_GardeningID;
            result[17].ActionFunction = obj.BHAV_WashHandsID;
            result[18].ActionFunction = obj.BHAV_PrepareFoodID;
            result[19].ActionFunction = obj.BHAV_CookFoodID;
            result[20].ActionFunction = obj.BHAV_PlaceSurfaceID;
            result[21].ActionFunction = obj.BHAV_DisposeID;
            result[22].ActionFunction = obj.BHAV_EatID;
            result[23].ActionFunction = 0; //pickup from slot
            result[24].ActionFunction = obj.BHAV_WashDishID;
            result[25].ActionFunction = obj.BHAV_EatSurfaceID;
            result[26].ActionFunction = obj.BHAV_SitID;
            result[27].ActionFunction = obj.BHAV_StandID;
            result[28].ActionFunction = obj.BHAV_Clean;
            result[29].ActionFunction = 0; //repair
            result[30].ActionFunction = 0; //client house join
            result[31].ActionFunction = 0; //prepare for sale
            result[32].ActionFunction = 0; //house unload

            return result;
        }