From 6a33c2eec13d4981338ffc53e713bcfbef29de57 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 28 Jun 2013 14:07:46 +0000 Subject: [PATCH] CON: New command 'screensound', unconditionally playing a session-wide sound. git-svn-id: https://svn.eduke32.com/eduke32@3912 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 3 +++ polymer/eduke32/source/gamedef.h | 1 + polymer/eduke32/source/gameexec.c | 4 ++++ polymer/eduke32/source/lunatic/control.lua | 6 ++++++ polymer/eduke32/source/lunatic/lunacon.lua | 2 ++ 5 files changed, 16 insertions(+) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index d55e0d145..5c27d5871 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -94,6 +94,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_ACTIVATE, 20130522 }, { CON_SCREENTEXT, 20130529 }, { CON_DYNAMICSOUNDREMAP, 20130530 }, + { CON_SCREENSOUND, 20130628 }, }; #endif @@ -591,6 +592,7 @@ const char *keyw[] = "qstrdim", // 369 "screentext", // 370 "dynamicsoundremap", // 371 + "screensound", // 372 "" }; #endif @@ -4101,6 +4103,7 @@ static int32_t C_ParseCommand(int32_t loop) case CON_SOUNDVAR: case CON_GLOBALSOUNDVAR: case CON_STOPSOUNDVAR: + case CON_SCREENSOUND: case CON_SOUNDONCEVAR: case CON_ANGOFFVAR: case CON_CHECKAVAILWEAPON: diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index d3788986a..b09b4a340 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -945,6 +945,7 @@ enum ScriptKeywords_t CON_QSTRDIM, // 369 CON_SCREENTEXT, // 370 CON_DYNAMICSOUNDREMAP, // 371 + CON_SCREENSOUND, // 372 CON_END }; #endif diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 1533559de..e3037c8a3 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2592,6 +2592,7 @@ nullquote: case CON_STOPSOUNDVAR: case CON_SOUNDONCEVAR: case CON_GLOBALSOUNDVAR: + case CON_SCREENSOUND: insptr++; { int32_t j=Gv_GetVarX(*insptr++); @@ -2618,6 +2619,9 @@ nullquote: case CON_SOUNDVAR: A_PlaySound((int16_t)j,vm.g_i); continue; + case CON_SCREENSOUND: + A_PlaySound(j, -1); + continue; } } continue; diff --git a/polymer/eduke32/source/lunatic/control.lua b/polymer/eduke32/source/lunatic/control.lua index 9a0c85626..b60e34b31 100644 --- a/polymer/eduke32/source/lunatic/control.lua +++ b/polymer/eduke32/source/lunatic/control.lua @@ -1667,6 +1667,12 @@ function _globalsound(pli, sndidx) end end +-- This one unconditionally plays a session-wide sound. +function _screensound(sndidx) + check_sound_idx(sndidx) + CF.A_PlaySound(sndidx, -1) +end + -- This is a macro for EDuke32 (game.h) local function S_StopSound(sndidx) ffiC.S_StopEnvSound(sndidx, -1) diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 2d92cfb15..1857b6410 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -2171,6 +2171,8 @@ local Cinner = { / "_con._stopactorsound(%1,%2)", stopallsounds = cmd() / "_con._stopallsounds()", + screensound = cmd(R) + / "_con._screensound(%1)", mikesnd = cmd() / format("_con._soundonce(_aci,%s)", SPS".yvel"), setactorsoundpitch = cmd(R,R,R)