From EDukeWiki
Jump to navigation Jump to search


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

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