From EDukeWiki
Revision as of 22:42, 30 January 2022 by Doom64hunter (talk | contribs) (Added documentation for mirror case and RETURN value)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
EVENT_DISPLAYROOMS screenpeek (0 if mirror) player->i (first player if mirror) 1 value (0 for mirror)


This event is triggered every time the player view (automap excluded), and when a mirror's view is rendered. Sprites drawn to the screen via rotatesprite during this event are displayed behind the level architecture.

If the event is called by a mirror, the current player num is set to 0, and THISACTOR is set to the spritenum of the first player.

The RETURN value is only used by the player's view, not the mirror. Set RETURN to 1 to disable rendering of the player's view. Any values other than 0 or 1 are rejected.

This event can be used to move the game camera from its normal position at the player's head to a specified location. This is done by changing the value of several constantly updated gamevars which determine the camera's position. The gamevars are: camerax, cameray, cameraz, cameraang, camerahoriz, and camerasect.

The first three are the map coordinates of the camera, cameraang is the direction the camera is facing, camerahoriz is the up/down angle of the camera, and camerasect is its sector. Unless these variables are changed in this event, they will take the corresponding values of the player structure (e.g. camerahoriz defaults to the horiz member of the player structure).

One use for this event is to have it display from the point of view of a sprite other than the player. In the following example, assume that the gamevar camerasprite is global and is set to the sprite ID of a special sprite when the camera is being used, and otherwise has a value of -1. Also assume that the EXTRA member of the camera sprite is set to the desired horiz. What follows is the code appropriate for the event in that case (additional actor code for the camera sprite would also be required).

  ifvarn camerasprite -1
    getactor[camerasprite].x camerax
    getactor[camerasprite].y cameray
    getactor[camerasprite].z cameraz
    getactor[camerasprite].ang cameraang
    getactor[camerasprite].extra camerahoriz
    getactor[camerasprite].sectnum camerasect