Tuesday 1 October 2013

Element / Modifier for Apoplexy


Element / Modifier for Apoplexy

For parse the XML file from Apoplexy (PrinceOfPersia Level Editor) i must create a new Enum,
i havent found the possibility to make a nested enum, my solution is make a pattern mask,
Like this:


// enum standard
 public enum TileType
        {
            space = 0,
            floor = 1,
            spikes = 2,
            posts = 3,
            gate = 4,
            dpressplate = 5, //;down
            pressplate = 6, 
....

//first 4 byte are element type the rest is the modifier, _x tells the result 

   public enum Tile
        {
            space_1   = 0x00000000,
            space_2   = 0x00000001,
            space_3   = 0x00000002,
            space_4   = 0x00000003,
            space_5   = 0x000000FF, 

            floor_6   = 0x00010000,
            floor_7   = 0x00010001,
            floor_8   = 0x00010002,
            floor_9   = 0x00010003,
            floor_10  = 0x000100FF,

            spike_11  = 0x00020000,
            spike_12  = 0x00020001,
            spike_13  = 0x00020002,
            spike_14  = 0x00020003,
            spike_15  = 0x00020004,
            spike_16  = 0x00020005,
            spike_17  = 0x00020006,
            spike_18  = 0x00020007,
            spike_19  = 0x00020008,
            spike_20  = 0x00020009,

            posts_21  = 0x00030000,
.....