Less repetition in oneliners.
This commit is contained in:
parent
afccfcb5ff
commit
aa2e786f48
3 changed files with 58 additions and 24 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r271 \cu(Sun 7 Aug 20:19:27 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r271 \cu(2022-08-07 20:19:27)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r272 \cu(Sun 7 Aug 22:47:32 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r272 \cu(2022-08-07 22:47:32)\c-";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ extend Class SWWMHandler
|
|||
{
|
||||
transient String oneliner, onelinersnd, onelinertype;
|
||||
transient int onelinertic, onelinerspan, onelinerlevel;
|
||||
transient Array<LastLine> lastlines;
|
||||
|
||||
static int AddOneliner( String type, int level, int delay = 5 )
|
||||
{
|
||||
|
|
@ -22,6 +21,12 @@ extend Class SWWMHandler
|
|||
String voicetype = CVar.FindCVar('swwm_voicetype').GetString();
|
||||
// suppress non-rage comments when ragekit is active, only screaming allowed
|
||||
if ( players[consoleplayer].mo.FindInventory("RagekitPower") && (type != "ragekit") ) return 0;
|
||||
// suppress beep-boop lines if voice channel already in use
|
||||
if ( (type == "buttonpush")
|
||||
&& players[consoleplayer].mo.IsActorPlayingSound(CHAN_DEMOVOICE)
|
||||
&& !players[consoleplayer].mo.IsActorPlayingSound(CHAN_DEMOVOICE,"voice/default/buttonpush1")
|
||||
&& !players[consoleplayer].mo.IsActorPlayingSound(CHAN_DEMOVOICE,"voice/default/buttonpush2")
|
||||
&& !players[consoleplayer].mo.IsActorPlayingSound(CHAN_DEMOVOICE,"voice/default/buttonpush3") ) return 0;
|
||||
// check first if it's a multiple option line type
|
||||
String testme = String.Format("SWWM_SUBS_%s_N%s",voicetype.MakeUpper(),type.MakeUpper());
|
||||
String locme = StringTable.Localize(testme,false);
|
||||
|
|
@ -46,30 +51,50 @@ extend Class SWWMHandler
|
|||
}
|
||||
int countem = locme.ToInt();
|
||||
if ( countem == 0 ) return 0; // voicepack doesn't have this
|
||||
// check last line so we don't repeat
|
||||
int last = 0, ent;
|
||||
for ( int i=0; i<hnd.lastlines.Size(); i++ )
|
||||
{
|
||||
if ( hnd.lastlines[i].type != type ) continue;
|
||||
last = hnd.lastlines[i].lineno;
|
||||
ent = i;
|
||||
break;
|
||||
}
|
||||
int whichline;
|
||||
if ( countem == 1 ) whichline = 1;
|
||||
else if ( last > 0 )
|
||||
{
|
||||
whichline = Random[DemoLines](1,countem-1);
|
||||
if ( whichline >= last ) whichline++;
|
||||
hnd.lastlines[ent].lineno = whichline;
|
||||
}
|
||||
if ( countem == 1 ) whichline = 1; // ez
|
||||
else
|
||||
{
|
||||
whichline = Random[DemoLines](1,countem);
|
||||
let lst = new("LastLine");
|
||||
lst.type = type;
|
||||
lst.lineno = whichline;
|
||||
hnd.lastlines.Push(lst);
|
||||
bool addme = true;
|
||||
int idx = -1;
|
||||
for ( int i=0; i<hnd.gdat.lastlines.Size(); i++ )
|
||||
{
|
||||
if ( hnd.gdat.lastlines[i].type != type ) continue;
|
||||
addme = false;
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
if ( !addme )
|
||||
{
|
||||
// check last lines so we don't repeat
|
||||
Array<int> candidates;
|
||||
for ( int i=1; i<=countem; i++ )
|
||||
{
|
||||
if ( hnd.gdat.lastlines[idx].lines.Find(i) < hnd.gdat.lastlines[idx].lines.Size() )
|
||||
continue;
|
||||
candidates.Push(i);
|
||||
}
|
||||
if ( candidates.Size() > 0 )
|
||||
{
|
||||
whichline = candidates[Random[DemoLines](0,candidates.Size()-1)];
|
||||
hnd.gdat.lastlines[idx].lines.Push(whichline);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear history and go directly to the "easy" option
|
||||
hnd.gdat.lastlines[idx].lines.Clear();
|
||||
addme = true;
|
||||
}
|
||||
}
|
||||
if ( addme )
|
||||
{
|
||||
// ez
|
||||
whichline = Random[DemoLines](1,countem);
|
||||
let lst = new("OnelinerHistory");
|
||||
lst.type = type;
|
||||
lst.lines.Push(whichline);
|
||||
hnd.gdat.lastlines.Push(lst);
|
||||
}
|
||||
}
|
||||
hnd.oneliner = String.Format("$SWWM_SUBS_%s_%s%d",voicetype.MakeUpper(),type.MakeUpper(),whichline);
|
||||
hnd.onelinersnd = String.Format("voice/%s/%s%d",voicetype,type,whichline);
|
||||
|
|
|
|||
|
|
@ -299,11 +299,20 @@ Class SWWMCorpseCleaner : Thinker
|
|||
}
|
||||
}
|
||||
|
||||
Class OnelinerHistory
|
||||
{
|
||||
String type;
|
||||
Array<int> lines;
|
||||
}
|
||||
|
||||
Class SWWMGlobals : SWWMStaticThinker
|
||||
{
|
||||
// set so these messages only happen once
|
||||
bool ccstartonce, cclilithonce;
|
||||
|
||||
// for oneliners
|
||||
Array<OnelinerHistory> lastlines;
|
||||
|
||||
static play SWWMGlobals Get()
|
||||
{
|
||||
let ti = ThinkerIterator.Create("SWWMGlobals",STAT_STATIC);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue