summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-04-01 12:39:45 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-04-01 12:39:45 +0200
commitaba8353eb00f9fbb4f921d8d970f62c76c9733e6 (patch)
tree09d4db8f0d85b4ea52de6fcf4b33c0a08161b678 /src/game
parentba024b8bf1b76d996b086ee5bd5bc3f7d6e92d72 (diff)
Corona CPs and fixups
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_corona.c37
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c3
3 files changed, 36 insertions, 6 deletions
diff --git a/src/game/g_corona.c b/src/game/g_corona.c
index f2434ee..47481ec 100644
--- a/src/game/g_corona.c
+++ b/src/game/g_corona.c
@@ -6,7 +6,7 @@ This file is part of shitposting, inappropriate entertainment and bad taste.
#include "g_local.h"
-int reference = 1585720800; // April 1, 2020 8:00:00 (local time)
+int reference = 1585749600; // April 1, 2020 16:00:00 (local time)
static const char *headlines[ ] =
{
@@ -58,9 +58,9 @@ static const char *quotes[] =
"We are fully prepared to deal with this crisis.",
"Our health care is fully prepared for the situation.",
"Our country is in the midst of a great national trial, unlike any we have ever faced before.",
- "We’re at war with a deadly virus.",
+ "We're at war with a deadly virus.",
"Following the guidelines for the next 30 days is a matter of life and death",
- "This is going to be one of the roughest 2 or 3 weeks we’ve ever had in our country.",
+ "This is going to be one of the roughest 2 or 3 weeks we've ever had in our country.",
"We’re going to lose thousands of people.",
};
int numQuotes = sizeof( quotes ) / sizeof( const char* );
@@ -83,7 +83,7 @@ void G_CoronaNewsfeed( void )
const char *name;
float rate, pop, cases;
- if( level.time < lastShitpost + 5000 )
+ if( level.time < lastShitpost + 20000 )
{
return;
}
@@ -98,10 +98,10 @@ void G_CoronaNewsfeed( void )
name = countries[ cindex ];
// Roll the stats (this is actually deterministic)
- t0 = LCG( cindex ) % 5400 + 3600;
+ t0 = LCG( cindex ) % 5400 + 3600 + g_coronaShitpostDelta.integer;
rate = LCG_float( cindex );
pop = 500000.0f * exp(12.0f * LCG_float( cindex + 911 ) );
- cases = exp( rate * ( time - t0 ) / 30.0f );
+ cases = exp( rate * ( time - t0 ) / 10.0f );
p = rand( ) % numPeople;
q = rand( ) % numQuotes;
@@ -151,3 +151,28 @@ void G_CoronaNewsfeed( void )
lastShitpost = level.time;
}
+
+static const char *warnings[ ] = {
+ "Wash your hands and don't touch your face.",
+ "Don't panic. Stay inside.",
+ "Avoid contact with other aliens and humans.",
+ "There's no need to worry.",
+ "You do not recognize the bodies in the water.",
+ "Don't pay attention to the [REDACTED]."
+};
+static int numWarnings = sizeof( warnings ) / sizeof( const char* );
+
+void G_CoronaWarnings( void )
+{
+ static int lastShitpost = 0;
+ const char *warning;
+
+ if( level.time < lastShitpost + 60000 )
+ {
+ return;
+ }
+
+ warning = warnings[ rand( ) % numWarnings ];
+ trap_SendServerCommand( -1, va( "cp \"%s\"", warning ) );
+ lastShitpost = level.time;
+}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 3d96e5f..61d8e12 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1316,6 +1316,7 @@ connectionRecord_t *G_FindConnectionForCode( int code );
// g_corona.c
//
void G_CoronaNewsfeed( void );
+void G_CoronaWarnings( void );
//some maxs
#define MAX_FILEPATH 144
@@ -1528,6 +1529,7 @@ extern vmCvar_t g_practise;
extern vmCvar_t g_covidInfectionFactor;
extern vmCvar_t g_covidSeverityFactor;
extern vmCvar_t g_covidDebug;
+extern vmCvar_t g_coronaShitpostDelta;
void trap_Printf( const char *fmt );
void trap_Error( const char *fmt );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 7c19403..85fc0a0 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -251,6 +251,7 @@ vmCvar_t g_tyrantNerf;
vmCvar_t g_covidInfectionFactor;
vmCvar_t g_covidSeverityFactor;
vmCvar_t g_covidDebug;
+vmCvar_t g_coronaShitpostDelta;
static cvarTable_t gameCvarTable[ ] =
{
@@ -482,6 +483,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_covidInfectionFactor, "g_covidInfectionFactor", "1", CVAR_ARCHIVE, 0, qtrue },
{ &g_covidSeverityFactor, "g_covidSeverityFactor", "1", CVAR_ARCHIVE, 0, qtrue },
{ &g_covidDebug, "g_covidDebug", "0", CVAR_ARCHIVE, 0, qtrue },
+ { &g_coronaShitpostDelta, "g_coronaShitpostDelta", "0", CVAR_ARCHIVE, 0, qfalse },
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );
@@ -3044,5 +3046,6 @@ void G_RunFrame( int levelTime )
}
G_CoronaNewsfeed( );
+ G_CoronaWarnings( );
}