srb2::Dialogue::NewText: use string parsing

This commit is contained in:
James R 2024-01-16 06:34:48 -08:00
parent cef3b6d841
commit ae04a9be27
2 changed files with 4 additions and 3 deletions

View file

@ -218,7 +218,7 @@ void Dialogue::SetSpeaker(std::string name, patch_t *patch, UINT8 *colormap, sfx
typewriter.voiceSfx = voice;
}
void Dialogue::NewText(std::string rawText)
void Dialogue::NewText(std::string_view rawText)
{
Init();
@ -226,7 +226,7 @@ void Dialogue::NewText(std::string rawText)
290 << FRACBITS,
FRACUNIT, FRACUNIT, FRACUNIT,
0, HU_FONT,
rawText.c_str()
srb2::Draw::TextElement().parse(rawText).string().c_str() // parse special characters
);
typewriter.NewText(newText);

View file

@ -15,6 +15,7 @@
#define __K_DIALOGUE_HPP__
#include <string>
#include <string_view>
#include "doomdef.h"
#include "doomtype.h"
@ -34,7 +35,7 @@ public:
void SetSpeaker(std::string skinName, int portraitID);
void SetSpeaker(std::string name, patch_t *patch, UINT8 *colormap, sfxenum_t voice);
void NewText(std::string newText);
void NewText(std::string_view newText);
bool Active(void);
bool TextDone(void);