Debugging an entity during runtime

Sometimes it's desirable to check the status of certain entities during gamesplay without having to start a debugger session. For this, the key shortcut [Shift-F11] was implemented.

Press [Shift-F11]. The game freezes and a cursor appears on the screen. Click onto an arbitrary entity. The watched pointer will be set to that entity, causing it's status display to appear on the screen. Pressing [Shift-F11] a second time will resume gameplay, but the status display is permanently updated with the status of the last clicked entity. If you want to get rid of the status display, click an empty position while in frozen mode.

Example:

The [Shift-F11] debugging feature uses the watched pointer and was implemented through a few lines of C-Script 'hardwired' in the engine:
function _tog_dbg()
{
  if(key_shift)
  {
    freeze_mode = (freeze_mode == 0); // toggle freeze mode
    while(freeze_mode)
    {
      mouse_mode = 2;
      mouse_pointer = 2;
      mouse_pos.x = mouse_cursor.x; // move the mouse pointer
      mouse_pos.y = mouse_cursor.y;
      if(mouse_left)
      {
        watched = mouse_ent;   // set entity to debug
      }
      wait(1);
    }
  }
} 

See also:

watched, breakpoint, breakpoint_on, debug_external, debug_mode