2022-07-07 16:10:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2022-12-29 00:48:57 +00:00
|
|
|
/** @brief Definition of a text channel.
|
|
|
|
|
|
|
|
A text channel is a special type of text string that is commonly
|
|
|
|
defined within the titles.txt file of a game. Common use cases are
|
|
|
|
chapter titles and message with a special type of fade in/out rendering effect
|
|
|
|
on them.*/
|
2022-03-31 03:17:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2022-12-29 00:48:57 +00:00
|
|
|
string m_strMessage; /**< the message contents. */
|
|
|
|
float m_flPosX; /**< Normalized starting position on the X-axis. -1 is center. */
|
|
|
|
float m_flPosY; /**< Normalized starting position on the X-axis. -1 is center. */
|
|
|
|
int m_iEffect; /**< Effect to use when rendering the text. */
|
|
|
|
vector m_vecColor1; /**< Primary text color. */
|
|
|
|
vector m_vecColor2; /**< Secondary text color for use with effects. */
|
|
|
|
float m_flFadeIn; /**< Time in seconds it takes for the text to fade in. */
|
|
|
|
float m_flFadeOut; /**< Time in seconds it takes for the text to fade out. */
|
|
|
|
float m_flHoldTime; /**< Time in seconds on which we'll hold onto the text. */
|
|
|
|
float m_flFXTime; /**< Time in seconds that it takes for the effect to finish. */
|
|
|
|
float m_flTime; /**< The time that's passed on the active channel. */
|
2024-06-22 07:24:13 +00:00
|
|
|
} hudText_t;
|
2022-12-29 00:48:57 +00:00
|
|
|
|
|
|
|
/** Global pool of text channels. */
|
2024-06-22 07:24:13 +00:00
|
|
|
hudText_t g_textchannels[6];
|
2022-12-29 00:48:57 +00:00
|
|
|
|
2023-03-28 23:36:21 +00:00
|
|
|
#define TEXTQUEUE_MAX 6
|
|
|
|
|
|
|
|
/** this is reserved for channel 0 */
|
2024-06-22 07:24:13 +00:00
|
|
|
hudText_t g_textqueue[TEXTQUEUE_MAX];
|
2023-03-28 23:36:21 +00:00
|
|
|
|
|
|
|
int g_textqueue_next;
|
|
|
|
int g_textqueue_count;
|
|
|
|
|
2024-06-22 07:24:13 +00:00
|
|
|
/** @defgroup text Text Overlay
|
|
|
|
@brief Displays text messages on screen with different effects.
|
|
|
|
@ingroup client
|
|
|
|
|
|
|
|
@{
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-12-29 00:48:57 +00:00
|
|
|
/** Used by Nuclide to draw all active text channels to the screen. */
|
|
|
|
void GameText_Draw(void);
|
|
|
|
|
|
|
|
/** @brief Places a message within a specified channel.
|
|
|
|
|
|
|
|
We look up a message within our titles.txt file and copy its parameters
|
|
|
|
and string contents into a text channel.
|
|
|
|
|
|
|
|
We have 6 channels in total.
|
|
|
|
|
|
|
|
@param strMessage is the message we'll look up.
|
|
|
|
@param iChannel is the channel it will be stored in. */
|
|
|
|
void GameMessage_Setup(string strMessage, int iChannel);
|
|
|
|
|
|
|
|
/** Used by Nuclide to parse a message delivered by the game_text entity.
|
|
|
|
|
|
|
|
@sa game_text */
|
|
|
|
void GameText_Parse(void);
|
|
|
|
|
|
|
|
/** Used by Nuclide to parse a message delivered by the env_message entity.
|
|
|
|
|
|
|
|
@sa env_message */
|
2024-06-22 07:24:13 +00:00
|
|
|
void GameMessage_Parse(void);
|
|
|
|
|
|
|
|
/** @} */ // end of client
|