From d710ec1b39219cc218e6e215f806cd0ab78e454b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 18 Jan 2024 00:08:28 -0300 Subject: [PATCH] Add 'SUPERNAME' command --- src/p_dialogscript.c | 16 ++++++++++++++-- src/p_dialogscript.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/p_dialogscript.c b/src/p_dialogscript.c index 460ef2886..1e4fa227c 100644 --- a/src/p_dialogscript.c +++ b/src/p_dialogscript.c @@ -249,6 +249,10 @@ void P_ParseDialogScriptCommand(char **input, writebuffer_t *bufptr, int tokeniz { WRITE_OP(TP_OP_CHARNAME); } + else if (IS_COMMAND("SUPERNAME")) + { + WRITE_OP(TP_OP_SUPERNAME); + } else if (IS_COMMAND("PLAYERNAME")) { WRITE_OP(TP_OP_PLAYERNAME); @@ -440,6 +444,7 @@ const UINT8 *P_DialogRunOpcode(const UINT8 *code, dialog_t *dialog, textwriter_t } break; case TP_OP_CHARNAME: + case TP_OP_SUPERNAME: case TP_OP_PLAYERNAME: // Ignore break; @@ -460,13 +465,19 @@ boolean P_DialogPreprocessOpcode(dialog_t *dialog, UINT8 **cptr, writebuffer_t * switch (*code) { case TP_OP_CHARNAME: { - char charname[256]; + char charname[SKINNAMESIZE+1]; strlcpy(charname, skins[player->skin]->realname, sizeof(charname)); M_BufferMemWrite(buf, (UINT8 *)charname, strlen(charname)); break; } + case TP_OP_SUPERNAME: { + char supername[SKINNAMESIZE+7]; + strlcpy(supername, skins[player->skin]->supername, sizeof(supername)); + M_BufferMemWrite(buf, (UINT8 *)supername, strlen(supername)); + break; + } case TP_OP_PLAYERNAME: { - char playername[256]; + char playername[MAXPLAYERNAME+1]; if (netgame) strlcpy(playername, player_names[player-players], sizeof(playername)); else @@ -502,6 +513,7 @@ int P_DialogSkipOpcode(const UINT8 *code) case TP_OP_NEXTPAGE: case TP_OP_WAIT: case TP_OP_CHARNAME: + case TP_OP_SUPERNAME: case TP_OP_PLAYERNAME: // Nothing else to read break; diff --git a/src/p_dialogscript.h b/src/p_dialogscript.h index 17ada227a..975a306a3 100644 --- a/src/p_dialogscript.h +++ b/src/p_dialogscript.h @@ -31,6 +31,7 @@ enum TP_OP_ICON, TP_OP_CHARNAME, + TP_OP_SUPERNAME, TP_OP_PLAYERNAME, TP_OP_CONTROL = 0xFF