Entities can react on certain events, like colliding with something, being shot at, or being clicked with the mouse. There is a simple mechanism for handling such events, consisting of an individual enable flag and a common event function.
To make an entity sensitive for a certain kind of event, the corresponding ENABLE_... flag of the emask parameter is set. If any enabled event happens, a user-defined function that was assigned before to the entities' event function pointer is started. This function determines what to do with the event. At the beginning of the function, the predefined variable event_type can be checked to find out which kind of event triggered the function. Depending on that, the event function then can let the entity react on the event by giving way, firing back, exploding or the like.