watched
For debugging purposes, an entity can be permanently observed by setting
this predefined pointer to the entity. The entity parameters
are then printed as text into the predefined string watch_str, and can be displayed
in a TEXT on screen.
Type:
ENTITY*
Remarks:
Important parameters of the watched entity are permanently visible in
the following lines on the screen:
- Type, handle number, name
-
Position, angle, scale, PRV color values
-
Ambient, albedo, alpha, rgb, frame, next_frame, skin
-
Flags
-
Functions currently run by this entity
- Event function, material
-
Ground below the entity, surface number, texture name, and object
touched by the collision detection.
While single stepping through a function, the entity parameters are displayed
below the debugger display. For switching off the parameter display, set the watched
pointer to NULL.
Example:
The [Shift-F11]
entity debugger uses the watched
pointer, was implemented this way in the default.c script:
TEXT* def_dtxt = {
pos_x = 2; pos_y = 2; layer = 999;
string = watch_str;
flags = SHOW;
}
function _def_debug()
{
...
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:
Debugging, debug_external,
debug_mode
► latest
version online