@@ -52,6 +52,11 @@ static constexpr TypeMap_t TypeMap[] =
52
52
{ ivVecLine, " vecline" , STRING },
53
53
{ ivPointEntityClass, " pointentityclass" , STRING },
54
54
{ ivNodeDest, " node_dest" , INTEGER },
55
+ // dimhotepus: CS:GO backport.
56
+ { ivBoolean, " boolean" , STRING },
57
+ // dimhotepus: TF2 backport.
58
+ { ivScript, " script" , STRING },
59
+ { ivScriptList, " scriptlist" , STRING },
55
60
{ ivInstanceFile, " instance_file" , STRING },
56
61
{ ivAngleNegativePitch, " angle_negative_pitch" , STRING },
57
62
{ ivInstanceVariable, " instance_variable" , STRING },
@@ -231,7 +236,8 @@ BOOL GDinputvariable::InitFromTokens(TokenReader& tr)
231
236
return FALSE ;
232
237
}
233
238
234
- // check for "reportable" marker
239
+ // check for "reportable" marker.
240
+ // NOTE: This has been deprecated in favor of the "report" keyword below.
235
241
trtoken_t ttype = tr.NextToken (szToken);
236
242
if (ttype == OPERATOR)
237
243
{
@@ -286,6 +292,21 @@ BOOL GDinputvariable::InitFromTokens(TokenReader& tr)
286
292
ttype = tr.PeekTokenType (szToken);
287
293
}
288
294
295
+ //
296
+ // Check for the "report" specifier.
297
+ //
298
+ // dimhotepus: TF2 backport.
299
+ if ((ttype == IDENT) && IsToken (szToken, " report" ))
300
+ {
301
+ (void )tr.NextToken (szToken);
302
+ m_bReportable = true ;
303
+
304
+ //
305
+ // Look ahead at the next token.
306
+ //
307
+ ttype = tr.PeekTokenType (szToken);
308
+ }
309
+
289
310
//
290
311
// Check for the ':' indicating a long name.
291
312
//
@@ -420,6 +441,44 @@ BOOL GDinputvariable::InitFromTokens(TokenReader& tr)
420
441
GDError (tr, " no %s specified" , m_eType == ivFlags ? " flags" : " choices" );
421
442
return (FALSE );
422
443
}
444
+
445
+ // dimhotepus: TF2 backport.
446
+ // For boolean values, we construct it as if it were a choices dialog
447
+ if ( m_eType == ivBoolean )
448
+ {
449
+ m_eType = ivChoices;
450
+
451
+ GDIVITEM ivi;
452
+ BitwiseClear ( ivi );
453
+
454
+ // Yes
455
+ V_strcpy_safe ( ivi.szValue , " 1" );
456
+ V_strcpy_safe ( ivi.szCaption , " Yes" );
457
+ m_Items.AddToTail (ivi);
458
+
459
+ // No
460
+ V_strcpy_safe ( ivi.szValue , " 0" );
461
+ V_strcpy_safe ( ivi.szCaption , " No" );
462
+ m_Items.AddToTail (ivi);
463
+
464
+ // Clean up string usages!
465
+ if ( stricmp ( m_szDefault, " no" ) == 0 )
466
+ {
467
+ V_strcpy_safe ( m_szDefault, " 0" );
468
+ }
469
+ else if ( stricmp ( m_szDefault, " yes" ) == 0 )
470
+ {
471
+ V_strcpy_safe ( m_szDefault, " 1" );
472
+ }
473
+
474
+ // Sanity check it!
475
+ if ( strcmp ( m_szDefault, " 0" ) && strcmp ( m_szDefault, " 1" ) )
476
+ {
477
+ GDError (tr, " boolean type specified with nonsensical default value: %s" , m_szDefault );
478
+ return (FALSE );
479
+ }
480
+ }
481
+
423
482
return (TRUE );
424
483
}
425
484
0 commit comments