EVENT DISPLAYROOMS: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
EVENT_DISPLAYROOMS is a [[EDuke32_event_list|Game Event]]. | EVENT_DISPLAYROOMS is a [[EDuke32_event_list|Game Event]]. | ||
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: | 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 | camerax, cameray, cameraz, cameraang, camerahoriz, and camerasect |
Revision as of 10:08, 3 May 2009
EVENT_DISPLAYROOMS is a Game Event.
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).
onevent EVENT_DISPLAYROOMS 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 } endevent