From 1c2ea1e96e3cf5c307c81588097d95ce09a2e0ae Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 5 Mar 2012 07:24:04 +0000 Subject: [PATCH] Add "echo" CON command which allows the user to print a quote only to the console and log file, for debugging or informational purposes. EVENT_INIT can finally be put to use! git-svn-id: https://svn.eduke32.com/eduke32@2419 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 3 +++ polymer/eduke32/source/gamedef.h | 3 ++- polymer/eduke32/source/gameexec.c | 23 ++++++++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 46b733f0e..31f6a8dd2 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -85,6 +85,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_CLIPMOVENOSLIDE, 20101009 }, { CON_INCLUDEDEFAULT, 20110615 }, { CON_SETACTORSOUNDPITCH, 20111102 }, + { CON_ECHO, 20120304 }, }; char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling @@ -565,6 +566,7 @@ const char *keyw[] = "clipmovenoslide", // 359 "includedefault", // 360 "setactorsoundpitch", // 361 + "echo", // 362 "" }; @@ -3645,6 +3647,7 @@ static int32_t C_ParseCommand(int32_t loop) case CON_SAVEGAMEVAR: case CON_READGAMEVAR: case CON_USERQUOTE: + case CON_ECHO: case CON_STARTTRACKVAR: case CON_CLEARMAPSTATE: case CON_ACTIVATECHEAT: diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index e8a097b37..6e5dbb401 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -951,7 +951,8 @@ enum ScriptKeywords_t CON_CALCHYPOTENUSE, // 358 CON_CLIPMOVENOSLIDE, // 359 CON_INCLUDEDEFAULT, // 360 - CON_SETACTORSOUNDPITCH, // 361 + CON_SETACTORSOUNDPITCH, // 361 + CON_ECHO, // 362 CON_END }; #endif diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index d8d398d08..4bf2dc23e 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1369,7 +1369,7 @@ skip_check: case CON_DEBUG: insptr++; - initprintf("%"PRIdPTR"\n",*insptr++); + initprintf("%" PRIdPTR "\n",*insptr++); continue; case CON_ENDOFGAME: @@ -4793,6 +4793,27 @@ nullquote: } continue; + case CON_ECHO: + insptr++; + { + int32_t i=Gv_GetVarX(*insptr++); + + if ((unsigned)i >= MAXQUOTES) + { + OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); + insptr++; + continue; + } + + if ((ScriptQuotes[i] == NULL)) + { + OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); + continue; + } + OSD_Printf("%s\n",ScriptQuotes[i]); + } + continue; + case CON_IFINOUTERSPACE: VM_CONDITIONAL(G_CheckForSpaceFloor(vm.g_sp->sectnum)); continue;