Пример #1
0
def parse_boom_action(index):
    action = Action()
    
    # Floors.
    if index >= 0x6000 and index < 0x8000:
        action.type = Action.TYPE_FLOOR
        index -= 0x6000
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_floor(index, action)
                    
    # Ceilings.
    elif index >= 0x4000 and index < 0x6000:
        action.type = Action.TYPE_CEILING
        index -= 0x4000
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_ceiling(index, action)
        
    # Doors.
    elif index >= 0x3c00 and index < 0x4000:
        action.type = Action.TYPE_DOOR
        index -= 0x3c00
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_door(index, action)
        
    # Locked doors.
    elif index >= 0x3800 and index < 0x3c00:
        action.type = Action.TYPE_DOOR_LOCKED
        index -= 0x3800
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_locked_door(index, action)
        
    # Lifts.
    elif index >= 0x3400 and index < 0x3800:
        action.type = Action.TYPE_LIFT
        index -= 0x3400
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_lift(index, action)
        
    # Stairs.
    elif index >= 0x3000 and index < 0x3400:
        action.type = Action.TYPE_STAIRS
        index -= 0x3000
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_stairs(index, action)

    # Crushers.
    elif index >= 0x2f80 and index < 0x3000:
        action.type = Action.TYPE_CRUSHER
        index -= 0x2f80
        action.activation, action.flags = get_boom_activation(index)
        parse_boom_crusher(index, action)
        
    else:
        return None

    return action
Пример #2
0
 def add(self, index, keywords):
     action = Action()
     action.index = index
     action.flag = Action.FLAG_PLAYER | Action.FLAG_PROJECTILE
     
     for keyword in keywords.split(','):
         if keyword in type_mapping:
             action.type = type_mapping[keyword]
         elif keyword in activate_mapping:
             action.activation = activate_mapping[keyword]
         elif keyword in movement_mapping:
             action.direction = movement_mapping[keyword]
         elif keyword in door_mapping:
             action.door_type = door_mapping[keyword]
         elif keyword in key_flags_mapping:
             action.key_flags |= key_flags_mapping[keyword]
         elif keyword in target_mapping:
             action.target = target_mapping[keyword]
         elif keyword in change_flags_mapping:
             action.change_flags |= change_flags_mapping[keyword]
         elif keyword in model_mapping:
             action.model = model_mapping[keyword]
         elif keyword in teleport_mapping:
             action.teleport_type = teleport_mapping[keyword]
         elif keyword in flags_mapping:
             action.flags |= flags_mapping[keyword]
         elif keyword in speed_mapping:
             action.speed = speed_mapping[keyword]
         elif keyword in wait_mapping:
             action.wait_time = wait_mapping[keyword]
         elif keyword in distance_mapping:
             action.move_amount = distance_mapping[keyword]
         elif keyword in light_mapping:
             action.light_change = light_mapping[keyword]
         else:
             print 'Unknown action keyword "{}".'.format(keyword)
     
     self.actions[index] = action