Using g_utils.cpp from fakk

This commit is contained in:
smallmodel 2023-08-15 01:27:35 +02:00
parent 0eedc4e2f8
commit c4738966fe
No known key found for this signature in database
GPG key ID: A96F163ED4891440
52 changed files with 2635 additions and 2730 deletions

View file

@ -563,7 +563,7 @@ void ProjectileGenerator_Gun::SetFireDelay(Event *ev)
void ProjectileGenerator_Gun::SetMeansOfDeath(Event *ev)
{
m_iMeansOfDeath = MOD_NameToNum(ev->GetString(1));
m_iMeansOfDeath = MOD_string_to_int(ev->GetString(1));
}
void ProjectileGenerator_Gun::SetBulletThroughWood(Event *ev)

View file

@ -465,7 +465,7 @@ void Actor::State_Cover_Shoot
if (level.inttime > m_iStateTime + 10000)
{
gi.Cvar_Set("g_monitornum", va("%i", entnum));
gi.cvar_set("g_monitornum", va("%i", entnum));
assert(!"anim/shoot.scr took over 10 seconds");
Com_Error(ERR_DROP, "anim/shoot.scr took over 10 seconds, entnum = %i, targetname = %s", entnum, targetname.c_str());
}

View file

@ -984,11 +984,11 @@ void Archiver::ArchiveConfigString( int cs )
if( archivemode == ARCHIVE_READ )
{
ArchiveString( &s );
glbs.SetConfigstring( cs, s.c_str() );
glbs.setConfigstring( cs, s.c_str() );
}
else
{
s = glbs.GetConfigstring( cs );
s = glbs.getConfigstring( cs );
ArchiveString( &s );
}
#endif

View file

@ -502,9 +502,12 @@ movement on the server game.
MOD_BASH,
MOD_SHOTGUN,
//
// Team tactics
// Team assault
//
MOD_AAGUN,
//
// Team tactics
//
MOD_LANDMINE,
MOD_TOTAL_NUMBER,

View file

@ -115,7 +115,7 @@ void CameraMoveState::DoNodeEvents
ent = NULL;
do
{
ent = ( Entity * )G_FindTarget( ( SimpleEntity * )ent, node->triggertarget.c_str() );
ent = G_FindTarget( ent, node->triggertarget.c_str() );
if( !ent )
{
break;
@ -2630,36 +2630,36 @@ void CameraManager::UpdateUI
//
// set path name
//
gi.Cvar_Set( "cam_filename", pathName );
gi.cvar_set( "cam_filename", pathName );
if ( current )
{
gi.Cvar_Set( "cam_origin", va( "%.2f %.2f %.2f", current->origin[ 0 ], current->origin[ 1 ], current->origin[ 2 ] ) );
gi.Cvar_Set( "cam_angles_yaw", va( "%.1f", current->angles[ YAW ] ) );
gi.Cvar_Set( "cam_angles_pitch", va( "%.1f", current->angles[ PITCH ] ) );
gi.Cvar_Set( "cam_angles_roll", va( "%.1f", current->angles[ ROLL ] ) );
gi.Cvar_Set( "cam_thread", current->thread.c_str() );
gi.Cvar_Set( "cam_target", current->triggertarget.c_str() );
gi.Cvar_Set( "cam_watch", current->watchEnt.c_str() );
gi.cvar_set( "cam_origin", va( "%.2f %.2f %.2f", current->origin[ 0 ], current->origin[ 1 ], current->origin[ 2 ] ) );
gi.cvar_set( "cam_angles_yaw", va( "%.1f", current->angles[ YAW ] ) );
gi.cvar_set( "cam_angles_pitch", va( "%.1f", current->angles[ PITCH ] ) );
gi.cvar_set( "cam_angles_roll", va( "%.1f", current->angles[ ROLL ] ) );
gi.cvar_set( "cam_thread", current->thread.c_str() );
gi.cvar_set( "cam_target", current->triggertarget.c_str() );
gi.cvar_set( "cam_watch", current->watchEnt.c_str() );
temp = current->GetFov();
if ( temp )
{
gi.Cvar_Set( "cam_fov", va( "%.1f", temp ) );
gi.cvar_set( "cam_fov", va( "%.1f", temp ) );
}
else
{
gi.Cvar_Set( "cam_fov", "Default" );
gi.cvar_set( "cam_fov", "Default" );
}
temp = current->GetFadeTime();
if ( temp != -1 )
{
gi.Cvar_Set( "cam_fadetime", va( "%.2f", temp ) );
gi.cvar_set( "cam_fadetime", va( "%.2f", temp ) );
}
else
{
gi.Cvar_Set( "cam_fadetime", "Default" );
gi.cvar_set( "cam_fadetime", "Default" );
}
gi.Cvar_Set( "cam_speed", va( "%.1f", current->speed ) );
gi.cvar_set( "cam_speed", va( "%.1f", current->speed ) );
//
// set node num
@ -2671,7 +2671,7 @@ void CameraManager::UpdateUI
next = next->GetNext();
num++;
}
gi.Cvar_Set( "cam_nodenum", va( "%d", num ) );
gi.cvar_set( "cam_nodenum", va( "%d", num ) );
}
}

View file

@ -865,3 +865,36 @@ void G_DebugHighlightFacet
break;
}
}
void G_DebugString(Vector pos, float scale, float r, float g, float b, const char* pszText, ...)
{
debugstring_t* string;
va_list va;
char szTemp[32768];
if (!g_numdebugstrings) {
return;
}
if (*gi.numDebugStrings < g_numdebugstrings->integer) {
string = (debugstring_t*)&DebugStrings[*gi.numDebugStrings];
(*gi.numDebugStrings)++;
va_start(va, pszText);
vsprintf(szTemp, pszText, va);
va_end(va);
VectorCopy(pos, string->pos);
string->scale = scale;
string->color[0] = r;
string->color[1] = g;
string->color[2] = b;
string->color[3] = 1.0f;
strncpy(string->szText, szTemp, sizeof(string->szText));
string->szText[sizeof(string->szText) - 1] = 0;
}
else {
gi.DPrintf("G_DebugString: Exceeded g_numdebugstrings\n");
}
}

View file

@ -240,9 +240,9 @@ void DM_Team::TeamWin(void)
UpdateTeamStatus();
if (m_teamnumber == TEAM_ALLIES) {
gi.Cvar_Set("g_scoreboardpicover", "textures/hud/allieswin");
gi.cvar_set("g_scoreboardpicover", "textures/hud/allieswin");
} else if (m_teamnumber == TEAM_AXIS) {
gi.Cvar_Set("g_scoreboardpicover", "textures/hud/axiswin");
gi.cvar_set("g_scoreboardpicover", "textures/hud/axiswin");
}
}
@ -755,7 +755,7 @@ void DM_Manager::Reset(void)
m_players.ClearObjectList();
m_teams.ClearObjectList();
gi.Cvar_Set("g_scoreboardpicover", "");
gi.cvar_set("g_scoreboardpicover", "");
//
// Added in 2.0
@ -768,10 +768,10 @@ void DM_Manager::Reset(void)
if (g_gametype->integer == GT_TOW) {
// FIXME: unimplemented
//g_TOWObjectiveMan.Reset();
gi.Cvar_Set("g_TOW_winstate", "0");
gi.cvar_set("g_TOW_winstate", "0");
} else if (g_gametype->integer == GT_LIBERATION) {
gi.Cvar_Set("scoreboard_toggle1", "0");
gi.Cvar_Set("scoreboard_toggle2", "0");
gi.cvar_set("scoreboard_toggle1", "0");
gi.cvar_set("scoreboard_toggle2", "0");
}
}
@ -876,13 +876,13 @@ void DM_Manager::RebuildTeamConfigstrings(void)
for (int i = 1; i <= teamcount; i++) {
team = m_teams.ObjectAt(i);
gi.SetConfigstring(
gi.setConfigstring(
CS_GENERAL_STRINGS + i,
va("%d %s %d player(s)", team->m_teamnumber, team->m_teamname.c_str(), team->m_players.NumObjects())
);
}
gi.SetConfigstring(CS_TEAMS, va("%d", teamcount));
gi.setConfigstring(CS_TEAMS, va("%d", teamcount));
}
int DM_Manager::compareScores(const void *elem1, const void *elem2)
@ -1089,13 +1089,13 @@ void DM_Manager::InitGame(void)
m_team_allies.m_teamwins = g_tempalliesscore->integer;
m_team_allies.m_wins_in_a_row = g_tempallieswinsinrow->integer;
gi.Cvar_Set("g_tempaxisscore", "0");
gi.Cvar_Set("g_tempaxiswinsinrow", "0");
gi.Cvar_Set("g_tempalliesscore", "0");
gi.Cvar_Set("g_tempaxiswinsinrow", "0");
gi.cvar_set("g_tempaxisscore", "0");
gi.cvar_set("g_tempaxiswinsinrow", "0");
gi.cvar_set("g_tempalliesscore", "0");
gi.cvar_set("g_tempaxiswinsinrow", "0");
m_iTotalMapTime = gi.Cvar_Get("g_tempmaptime", "0", 0)->integer;
gi.Cvar_Set("g_tempmaptime", "0");
gi.cvar_set("g_tempmaptime", "0");
}
}
}
@ -1104,21 +1104,21 @@ bool DM_Manager::CheckEndMatch()
{
if (fraglimit) {
if (fraglimit->integer < 0) {
gi.Cvar_Set("fraglimit", "0");
gi.cvar_set("fraglimit", "0");
}
if (fraglimit->integer > 10000) {
gi.Cvar_Set("fraglimit", "10000");
gi.cvar_set("fraglimit", "10000");
}
fraglimit = gi.Cvar_Get("fraglimit", "0", CVAR_SERVERINFO);
}
if (timelimit) {
if (timelimit->integer < 0) {
gi.Cvar_Set("timelimit", "0");
gi.cvar_set("timelimit", "0");
}
// 180 minutes maximum
if (timelimit->integer > 10800) {
gi.Cvar_Set("timelimit", "10800");
gi.cvar_set("timelimit", "10800");
}
timelimit = gi.Cvar_Get("timelimit", "0", CVAR_SERVERINFO);
}
@ -1132,15 +1132,15 @@ bool DM_Manager::CheckEndMatch()
if (!level.m_bIgnoreClock && roundLimit > 0 && level.time >= m_iDefaultRoundLimit * 60 + m_fRoundTime) {
switch (m_csTeamClockSide) {
case STRING_AXIS:
gi.Cvar_Set("g_TOW_winstate", "1");
gi.cvar_set("g_TOW_winstate", "1");
TeamWin(TEAM_AXIS);
break;
case STRING_ALLIES:
gi.Cvar_Set("g_TOW_winstate", "2");
gi.cvar_set("g_TOW_winstate", "2");
TeamWin(TEAM_ALLIES);
break;
default:
gi.Cvar_Set("g_TOW_winstate", "3");
gi.cvar_set("g_TOW_winstate", "3");
TeamWin(TEAM_NONE);
}
@ -1148,13 +1148,13 @@ bool DM_Manager::CheckEndMatch()
}
if (m_team_allies.IsDead()) {
gi.Cvar_Set("g_TOW_winstate", "1");
gi.cvar_set("g_TOW_winstate", "1");
TeamWin(TEAM_AXIS);
return true;
}
if (m_team_axis.IsDead()) {
gi.Cvar_Set("g_TOW_winstate", "2");
gi.cvar_set("g_TOW_winstate", "2");
TeamWin(TEAM_ALLIES);
return true;
}
@ -1414,11 +1414,11 @@ void DM_Manager::EventFinishRoundTransition(Event *ev)
return;
}
gi.Cvar_Set("g_tempaxisscore", va("%d", m_team_axis.m_teamwins));
gi.Cvar_Set("g_tempaxiswinsinrow", va("%d", m_team_axis.m_wins_in_a_row));
gi.Cvar_Set("g_tempalliesscore", va("%d", m_team_allies.m_teamwins));
gi.Cvar_Set("g_tempallieswinsinrow", va("%d", m_team_allies.m_wins_in_a_row));
gi.Cvar_Set("g_tempmaptime", va("%d", m_iTotalMapTime + level.inttime));
gi.cvar_set("g_tempaxisscore", va("%d", m_team_axis.m_teamwins));
gi.cvar_set("g_tempaxiswinsinrow", va("%d", m_team_axis.m_wins_in_a_row));
gi.cvar_set("g_tempalliesscore", va("%d", m_team_allies.m_teamwins));
gi.cvar_set("g_tempallieswinsinrow", va("%d", m_team_allies.m_wins_in_a_row));
gi.cvar_set("g_tempmaptime", va("%d", m_iTotalMapTime + level.inttime));
for (i = 0, ent = g_entities; i < game.maxclients; ent++, i++) {
if (!ent->inuse || !ent->entity) {
@ -1523,7 +1523,7 @@ void DM_Manager::StartRound(void)
}
level.Unregister("roundstart");
gi.SetConfigstring(CS_WARMUP, va("%.0f", GetMatchStartTime()));
gi.setConfigstring(CS_WARMUP, va("%.0f", GetMatchStartTime()));
}
void DM_Manager::EndRound()

View file

@ -2299,7 +2299,7 @@ Vector Entity::getLocalVector(Vector vec)
void Entity::link(void)
{
gi.LinkEntity(edict);
gi.linkentity(edict);
absmin = edict->r.absmin;
absmax = edict->r.absmax;
centroid = (absmin + absmax) * 0.5;
@ -2654,7 +2654,7 @@ void Entity::DamageType(Event *ev)
if (damage == "all") {
damage_type = -1;
} else {
damage_type = MOD_NameToNum(damage);
damage_type = MOD_string_to_int(damage);
}
}
@ -3661,8 +3661,8 @@ void Entity::Sound(
if (g_subtitle->integer == 2 || max_dist * max_dist > DistanceSquared(org, p->edict->s.origin)) {
cvar_t *curSubtitle = gi.Cvar_Get("curSubtitle", "0", 0);
gi.Cvar_Set(va("subtitle%d", curSubtitle->integer), va("%s", ret->subtitle));
gi.Cvar_Set("curSubtitle", va("%d", curSubtitle->integer + 1));
gi.cvar_set(va("subtitle%d", curSubtitle->integer), va("%s", ret->subtitle));
gi.cvar_set("curSubtitle", va("%d", curSubtitle->integer + 1));
}
}
@ -4093,7 +4093,7 @@ void Entity::SetWaterType(void)
{
qboolean isinwater;
watertype = gi.PointContents(origin, 0);
watertype = gi.pointcontents(origin, 0);
isinwater = watertype & MASK_WATER;
if (isinwater) {
@ -4497,7 +4497,7 @@ void Entity::HurtEvent(Event *ev)
}
if (ev->NumArgs() > 1) {
means_of_death = MOD_NameToNum(ev->GetString(2));
means_of_death = MOD_string_to_int(ev->GetString(2));
} else {
means_of_death = MOD_CRUSH;
}
@ -5114,7 +5114,7 @@ qboolean Entity::CheckEventFlags(Event *event)
}
if (!thereisnomonkey->integer) {
gi.Cvar_Set("cheats", "0");
gi.cvar_set("cheats", "0");
}
if (!sv_cheats->integer) {
@ -5942,7 +5942,7 @@ void Entity::AddImmunity(Event *ev)
for (i = 1; i <= number_of_immunities; i++) {
immune_string = ev->GetString(i);
new_immunity = MOD_NameToNum(immune_string);
new_immunity = MOD_string_to_int(immune_string);
if (new_immunity != -1) {
immunities.AddUniqueObject(new_immunity);
@ -5962,7 +5962,7 @@ void Entity::RemoveImmunity(Event *ev)
for (i = 1; i <= number_of_immunities; i++) {
immune_string = ev->GetString(i);
old_immunity = MOD_NameToNum(immune_string);
old_immunity = MOD_string_to_int(immune_string);
if (old_immunity != -1 && immunities.ObjectInList(old_immunity)) {
immunities.RemoveObject(old_immunity);

View file

@ -758,7 +758,7 @@ inline int Entity::getMoveType(void)
inline void Entity::unlink(void)
{
gi.UnlinkEntity(edict);
gi.unlinkentity(edict);
}
inline void Entity::setContents(int type)

View file

@ -242,10 +242,10 @@ void ClientThink_real( gentity_t *ent ) {
}
if ( pmove_msec.integer < 8 ) {
gi.Cvar_Set("pmove_msec", "8");
gi.cvar_set("pmove_msec", "8");
}
else if (pmove_msec.integer > 33) {
gi.Cvar_Set("pmove_msec", "33");
gi.cvar_set("pmove_msec", "33");
}
if ( pmove_fixed.integer || client->pers.pmoveFixed ) {
@ -341,8 +341,8 @@ void ClientThink_real( gentity_t *ent ) {
else {
pm.tracemask = MASK_PLAYERSOLID;
}
pm.trace = gi.Trace;
pm.pointcontents = gi.PointContents;
pm.trace = gi.trace;
pm.pointcontents = gi.pointcontents;
pm.debugLevel = g_debugMove.integer;
pm.noFootsteps = ( dmflags->integer & DF_NO_FOOTSTEPS ) > 0;
@ -707,7 +707,7 @@ void ClientUse(gentity_t *ent) {
CalcMuzzlePoint(ent, forward, right, up, g_muzzle);
VectorMA(g_muzzle, 96.f, forward, right);
gi.Trace(&tr, g_muzzle, NULL, NULL, right, ent - g_entities, MASK_SOLID,0,false);
gi.trace(&tr, g_muzzle, NULL, NULL, right, ent - g_entities, MASK_SOLID,0,false);
if (tr.fraction == 1.f || tr.entityNum == ENTITYNUM_NONE || tr.entityNum == ENTITYNUM_WORLD) {
ent->lastUseEntity = tr.entityNum;
@ -763,8 +763,8 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
pm.ps = &client->ps;
pm.cmd = *ucmd;
pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; // spectators can fly through bodies
pm.trace = gi.Trace;
pm.pointcontents = gi.PointContents;
pm.trace = gi.trace;
pm.pointcontents = gi.pointcontents;
// perform a pmove
Pmove (&pm);
@ -875,7 +875,7 @@ void G_TouchTriggers( gentity_t *ent )
Event *ev;
// dead things don't activate triggers!
if( ( ent->client || ( ent->r.svFlags & SVF_BOT ) ) && ( ent->entity->health <= 0 ) )
if( ( ent->client || ( ent->r.svFlags & SVF_MONSTER ) ) && ( ent->entity->health <= 0 ) )
{
return;
}
@ -930,27 +930,3 @@ void G_ClientThink( gentity_t *ent, usercmd_t *cmd, usereyes_t *eyeinfo )
}
}
/*
=================
G_ClientEndServerFrames
=================
*/
void G_ClientEndServerFrames( void )
{
int i;
gentity_t *ent;
// calc the player views now that all pushing
// and damage has been added
for( i = 0; i < game.maxclients; i++ )
{
ent = g_entities + i;
if( !ent->inuse || !ent->client || !ent->entity )
{
continue;
}
ent->entity->EndFrame();
}
}

View file

@ -762,7 +762,7 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
Q_strncpyz(client->pers.dm_playergermanmodel, s, sizeof(client->pers.dm_playergermanmodel));
gi.SetConfigstring(CS_PLAYERS + clientnum, va("name\\%s", client->pers.netname));
gi.setConfigstring(CS_PLAYERS + clientnum, va("name\\%s", client->pers.netname));
if (ent->entity) {
float fov;
@ -990,7 +990,7 @@ void G_SetClientConfigString(gentity_t *ent)
string = va("name\\%s\\team\\0", ent->client->pers.netname);
}
gi.SetConfigstring(CS_PLAYERS + num, string);
gi.setConfigstring(CS_PLAYERS + num, string);
}
/*

View file

@ -143,21 +143,6 @@ typedef enum {
} clientState_t;
typedef enum {
WEAPON_MAIN,
WEAPON_OFFHAND,
WEAPON_ERROR
} weaponhand_t;
#define NUM_ACTIVE_WEAPONS WEAPON_ERROR
typedef enum {
FIRE_PRIMARY,
FIRE_SECONDARY,
MAX_FIREMODES,
FIRE_ERROR
} firemode_t;
//
// g_spawn.c
//
@ -200,7 +185,6 @@ void G_KillBox(gentity_t *ent);
qboolean M_CheckBottom(Entity *ent);
gentity_t *G_PickTarget(char *targetname);
void G_UseTargets(gentity_t *ent, gentity_t *activator);
Vector G_GetMovedir(float angle);
void G_SetMovedir(vec3_t angles, vec3_t movedir);
void G_InitGentity(gentity_t *e);
@ -214,95 +198,14 @@ Entity *G_NextEntity(Entity *ent);
void G_CalcBoundsOfMove(Vector& start, Vector& end, Vector& mins, Vector& maxs, Vector *minbounds, Vector *maxbounds);
void G_ShowTrace(trace_t *trace, gentity_t *passent, const char *reason);
bool G_SightTrace(
const Vector& start,
const Vector& mins,
const Vector& maxs,
const Vector& end,
Entity *passent,
Entity *passent2,
int contentmask,
qboolean cylindrical,
const char *reason
);
bool G_SightTrace(
const Vector& start,
const Vector& mins,
const Vector& maxs,
const Vector& end,
gentity_t *passent,
gentity_t *passent2,
int contentmask,
qboolean cylindrical,
const char *reason
);
void G_PMDrawTrace(
trace_t *results,
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int passEntityNum,
int contentMask,
qboolean cylinder,
qboolean traceDeep
);
trace_t G_Trace(
const Vector& start,
const Vector& mins,
const Vector& maxs,
const Vector& end,
const Entity *passent,
int contentmask,
qboolean cylindrical,
const char *reason,
qboolean tracedeep = qfalse
);
trace_t G_Trace(
vec3_t start,
vec3_t mins,
vec3_t maxs,
vec3_t end,
gentity_t *passent,
int contentmask,
qboolean cylindrical,
const char *reason,
qboolean tracedeep = qfalse
);
void G_TraceEntities(
Vector & start,
Vector & mins,
Vector & maxs,
Vector & end,
Container<Entity *> *victimlist,
int contentmask,
qboolean bIncludeTriggers = qfalse
);
float PlayersRangeFromSpot(Entity *ent);
Entity *findradius(Entity *startent, Vector org, float rad);
Entity *findclientsinradius(Entity *startent, Vector org, float rad);
Vector G_CalculateImpulse(const Vector& start, const Vector& end, float speed, float gravity);
void G_TouchTriggers(gentity_t *ent);
void G_TouchSolids(gentity_t *ent);
int MOD_NameToNum(const str &meansOfDeath);
const char *MOD_NumToName(int meansOfDeath);
qboolean MOD_matches(int incoming_damage, int damage_type);
void G_MissionFailed(void);
void G_FadeOut(float delaytime);
void G_FadeSound(float delaytime);
void G_PlayerDied(float delaytime);
void G_AutoFadeIn(void);
void G_ClearFade(void);
void G_StartCinematic(void);
void G_StopCinematic(void);
void G_CenterPrintToAllClients(const char *pszString);
void G_PrintToAllClients(const char *pszString, int iType = 1);
void G_PrintDeathMessage(
@ -326,15 +229,10 @@ char *CanonicalTikiName(const char *szInName);
float *tv(float x, float y, float z);
char *vtos(const vec3_t v);
float vectoyaw(const vec3_t vec);
void G_SetOrigin(gentity_t *ent, vec3_t origin);
void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
const char *BuildShaderStateConfig(void);
firemode_t WeaponModeNameToNum(str mode);
const char *WeaponHandNumToName(weaponhand_t hand);
weaponhand_t WeaponHandNameToNum(str side);
void G_DebugTargets(Entity *e, const str &from);
void G_DebugDamage(float damage, Entity *victim, Entity *attacker, Entity *inflictor);
void G_DebugString(Vector pos, float scale, float r, float g, float b, const char *pszText, ...);
@ -369,12 +267,8 @@ void G_HideScoresToAllClients(void);
// caching commands
//
void G_ProcessCacheInitCommands(dtiki_t *tiki);
void CacheResource(const char *stuff);
void G_SetTrajectory(gentity_t *ent, vec3_t org);
void G_SetConstantLight(
int *constantlight, float *red, float *green, float *blue, float *radius, int *lightstyle = NULL
);
//
// g_combat.c
@ -630,4 +524,6 @@ void BotTestAAS(vec3_t origin);
extern gentity_t *g_entities;
#define FOFS(x) ((size_t) & (((gentity_t *)0)->x))
#include "g_utils.h"
#endif /* g_local.h */

View file

@ -76,6 +76,8 @@ void ( *SV_Error )( int type, const char *fmt, ... );
void *( *SV_Malloc )( int size );
void ( *SV_Free )( void *ptr );
qboolean LevelArchiveValid(Archiver& arc);
void QDECL G_Printf( const char *fmt, ... ) {
va_list argptr;
char text[1024];
@ -141,7 +143,7 @@ void G_RemapTeamShaders( void ) {
Com_sprintf( string, sizeof(string), "team_icon/%s_blue", g_blueteam.string );
AddRemap("textures/ctf2/blueteam01", string, f);
AddRemap("textures/ctf2/blueteam02", string, f);
gi.SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
gi.setConfigstring(CS_SHADERSTATE, BuildShaderStateConfig());
#endif
}
@ -247,7 +249,7 @@ void G_InitGame( int levelTime, int randomSeed )
level.specialgame = sv_specialgame->integer ? true : false;
if( level.specialgame )
{
gi.Cvar_Set( "protocol", "9" );
gi.cvar_set( "protocol", "9" );
}
G_InitConsoleCommands();
@ -620,7 +622,7 @@ void G_RunFrame( int levelTime, int frameTime )
if( g_timeents->integer )
{
gi.Cvar_Set( "g_timeents", va( "%d", g_timeents->integer - 1 ) );
gi.cvar_set( "g_timeents", va( "%d", g_timeents->integer - 1 ) );
end = clock();
gi.DebugPrintf( "\n%i total: %d (%.1f)\n-----------------------\n",
@ -681,7 +683,7 @@ void G_RunFrame( int levelTime, int frameTime )
G_CheckExitRules();
G_CheckStartRules();
gi.SetConfigstring( CS_WARMUP, va( "%.0f", dmManager.GetMatchStartTime() ) );
gi.setConfigstring( CS_WARMUP, va( "%.0f", dmManager.GetMatchStartTime() ) );
if( g_gametype->integer ) {
level.CheckVote();
@ -744,6 +746,45 @@ void G_ClientDrawBoundingBoxes
}
}
// Used to tell the server about the edict pose, such as the player pose
// so that G_Trace with tracedeep will set the location
void G_UpdatePoseInternal(gentity_t *edict)
{
if (edict->s.number == ENTITYNUM_NONE || level.frame_skel_index != level.skel_index[edict->s.number]) {
gi.TIKI_SetPoseInternal(
edict->tiki,
edict->s.number,
edict->s.frameInfo,
edict->s.bone_tag,
edict->s.bone_quat,
edict->s.actionWeight
);
}
}
orientation_t G_TIKI_Orientation(gentity_t *edict, int num)
{
orientation_t orient;
G_UpdatePoseInternal(edict);
orient = gi.TIKI_OrientationInternal(edict->tiki, edict->s.number, num, edict->s.scale);
return orient;
}
SkelMat4 *G_TIKI_Transform(gentity_t *edict, int num)
{
G_UpdatePoseInternal(edict);
return (SkelMat4 *)gi.TIKI_TransformInternal(edict->tiki, edict->s.number, num);
}
qboolean G_TIKI_IsOnGround(gentity_t *edict, int num, float threshold)
{
G_UpdatePoseInternal(edict);
return gi.TIKI_IsOnGroundInternal(edict->tiki, edict->s.number, num, threshold);
}
void G_PrepFrame( void )
{
@ -793,13 +834,48 @@ void G_SetTime( int svsStartTime, int svsTime )
{
if( level.svsStartTime != svsTime )
{
gi.SetConfigstring( CS_LEVEL_START_TIME, va( "%i", svsTime ) );
gi.setConfigstring( CS_LEVEL_START_TIME, va( "%i", svsTime ) );
}
level.svsStartTime = svsStartTime;
level.setTime( svsTime );
}
/*
=================
G_LevelArchiveValid
=================
*/
qboolean G_LevelArchiveValid
(
const char *filename
)
{
try
{
qboolean ret;
Archiver arc;
if( !arc.Read( filename ) )
{
return qfalse;
}
ret = LevelArchiveValid( arc );
arc.Close();
return ret;
}
catch( const char *error )
{
G_ExitWithError( error );
return qfalse;
}
}
void G_SoundCallback( int entNum, soundChannel_t channelNumber, const char *name )
{
gentity_t *ent = &g_entities[ entNum ];
@ -818,6 +894,62 @@ void G_SoundCallback( int entNum, soundChannel_t channelNumber, const char *name
entity->PostEvent( ev, level.frametime );
}
qboolean G_Command_ProcessFile(const char *filename, qboolean quiet)
{
char *buffer;
const char *bufstart;
const char *token;
int numTokens = 0;
if (gi.FS_ReadFile(filename, (void **)&buffer, quiet) == -1) {
return qfalse;
}
if (!quiet) {
gi.DPrintf("G_Command_ProcessFile: %s\n", filename);
}
bufstart = buffer;
while (1) {
// grab each line as we go
token = COM_ParseExt(&buffer, qtrue);
if (!token[0]) {
break;
}
if (!Q_stricmp(token, "end") || !Q_stricmp(token, "server")) {
// skip the line
while (1) {
token = COM_ParseExt(&buffer, qfalse);
if (!token[0]) {
break;
}
}
continue;
}
// Create the event
Event ev(token);
// get the rest of the line
while (1) {
token = COM_ParseExt(&buffer, qfalse);
if (!token[0]) {
break;
}
ev.AddToken(token);
}
Director.ProcessEvent(ev);
}
gi.FS_FreeFile((void *)bufstart);
return qtrue;
}
qboolean G_AllowPaused( void )
{
#ifdef _DEBUG
@ -965,48 +1097,6 @@ void G_WritePersistant
}
}
/*
=================
LevelArchiveValid
=================
*/
qboolean LevelArchiveValid
(
Archiver &arc
)
{
int version;
int savegame_version;
// read the version number
arc.ArchiveInteger( &version );
arc.ArchiveInteger( &savegame_version );
if( version < GAME_API_VERSION )
{
gi.Printf( "Savegame from an older version (%d) of MOHAA.\n", version );
return qfalse;
}
else if( version > GAME_API_VERSION )
{
gi.Printf( "Savegame from version %d of MOHAA.\n", version );
return qfalse;
}
if( savegame_version < SAVEGAME_VERSION )
{
gi.Printf( "Savegame from an older version (%d) of MoHAA.\n", version );
return qfalse;
}
else if( savegame_version > SAVEGAME_VERSION )
{
gi.Printf( "Savegame from version %d of MoHAA.\n", version );
return qfalse;
}
return qtrue;
}
void G_Cleanup( qboolean samemap )
{
gi.Printf( "==== CleanupGame ====\n" );
@ -1035,7 +1125,7 @@ void ArchiveAliases
{
for( i = 0; i < MAX_MODELS; i++ )
{
name = gi.GetConfigstring( CS_MODELS + i );
name = gi.getConfigstring( CS_MODELS + i );
if( name && *name && *name != '*' )
{
const char *p = name;
@ -1116,6 +1206,46 @@ void ArchiveAliases
}
}
/*
=================
LevelArchiveValid
=================
*/
qboolean LevelArchiveValid
(
Archiver &arc
)
{
int version;
int savegame_version;
// read the version number
arc.ArchiveInteger( &version );
arc.ArchiveInteger( &savegame_version );
if( version < GAME_API_VERSION )
{
gi.Printf( "Savegame from an older version (%d) of MOHAA.\n", version );
return qfalse;
}
else if( version > GAME_API_VERSION )
{
gi.Printf( "Savegame from version %d of MOHAA.\n", version );
return qfalse;
}
if( savegame_version < SAVEGAME_VERSION )
{
gi.Printf( "Savegame from an older version (%d) of MoHAA.\n", version );
return qfalse;
}
else if( savegame_version > SAVEGAME_VERSION )
{
gi.Printf( "Savegame from version %d of MoHAA.\n", version );
return qfalse;
}
return qtrue;
}
/*
=================
@ -1143,7 +1273,7 @@ qboolean G_ArchiveLevel
COM_StripExtension( filename, szSaveName, sizeof( szSaveName ) );
pszSaveName = COM_SkipPath( szSaveName );
gi.Cvar_Set( "g_lastsave", pszSaveName );
gi.cvar_set( "g_lastsave", pszSaveName );
if( loading )
{
@ -1391,41 +1521,6 @@ qboolean G_ReadLevel
return status;
}
/*
=================
G_LevelArchiveValid
=================
*/
qboolean G_LevelArchiveValid
(
const char *filename
)
{
try
{
qboolean ret;
Archiver arc;
if( !arc.Read( filename ) )
{
return qfalse;
}
ret = LevelArchiveValid( arc );
arc.Close();
return ret;
}
catch( const char *error )
{
G_ExitWithError( error );
return qfalse;
}
}
/*
================
GetGameAPI
@ -1509,6 +1604,84 @@ game_export_t * GetGameAPI(game_import_t * import)
return &globals;
}
/*
=================
G_ClientEndServerFrames
=================
*/
void G_ClientEndServerFrames(void)
{
int i;
gentity_t* ent;
// calc the player views now that all pushing
// and damage has been added
for (i = 0; i < game.maxclients; i++)
{
ent = g_entities + i;
if (!ent->inuse || !ent->client || !ent->entity)
{
continue;
}
ent->entity->EndFrame();
}
}
void G_ClientDoBlends()
{
// FIXME: unimplemented
}
void FindIntermissionPoint()
{
// FIXME: unimplemented
}
void G_MoveClientToIntermission(Entity *ent)
{
G_DisplayScores(ent);
ent->flags |= FL_IMMOBILE;
}
void G_DisplayScores(Entity *ent)
{
ent->client->ps.pm_flags |= PMF_INTERMISSION;
}
void G_HideScores(Entity *ent)
{
ent->client->ps.pm_flags &= ~PMF_INTERMISSION;
}
void G_DisplayScoresToAllClients(void)
{
gentity_t *ent;
int i;
for (i = 0, ent = g_entities; i < game.maxclients; ent++, i++) {
if (!ent->inuse || !ent->entity) {
continue;
}
G_DisplayScores(ent->entity);
}
}
void G_HideScoresToAllClients(void)
{
gentity_t *ent;
int i;
for (i = 0, ent = g_entities; i < game.maxclients; ent++, i++) {
if (!ent->inuse || !ent->entity) {
continue;
}
G_HideScores(ent->entity);
}
}
#ifndef WIN32
#include <signal.h>

View file

@ -172,7 +172,7 @@ qboolean MM_SlideMove
VectorMA( mm->origin, time_left, mm->velocity, end );
// see if we can make it there
gi.Trace( &trace, mm->origin, mm->mins, mm->maxs, end, mm->entityNum, mm->tracemask, qtrue, qfalse );
gi.trace( &trace, mm->origin, mm->mins, mm->maxs, end, mm->entityNum, mm->tracemask, qtrue, qfalse );
if( trace.allsolid )
break;
@ -379,7 +379,7 @@ void MM_GroundTrace
point[ 1 ] = mm->origin[ 1 ];
point[ 2 ] = mm->origin[ 2 ] - 0.25f;
gi.Trace( &mml.groundTrace, mm->origin, mm->mins, mm->maxs, point, mm->entityNum, mm->tracemask, qtrue, qfalse );
gi.trace( &mml.groundTrace, mm->origin, mm->mins, mm->maxs, point, mm->entityNum, mm->tracemask, qtrue, qfalse );
MM_GroundTraceInternal();
}
@ -420,7 +420,7 @@ void MM_StepSlideMove
VectorCopy( start_o, down );
down[ 2 ] -= STEPSIZE;
gi.Trace( &trace, start_o, mm->mins, mm->maxs, down, mm->entityNum, mm->tracemask, qtrue, qfalse );
gi.trace( &trace, start_o, mm->mins, mm->maxs, down, mm->entityNum, mm->tracemask, qtrue, qfalse );
VectorSet( up, 0, 0, 1 );
// never step up when you still have up velocity
@ -460,7 +460,7 @@ void MM_StepSlideMove
down[ 2 ] -= STEPSIZE * 2;
// test the player position if they were a stepheight higher
gi.Trace( &trace, up, mm->mins, mm->maxs, up, mm->entityNum, mm->tracemask, qtrue, qfalse );
gi.trace( &trace, up, mm->mins, mm->maxs, up, mm->entityNum, mm->tracemask, qtrue, qfalse );
if( trace.entityNum > ENTITYNUM_NONE )
{
VectorCopy( nostep_o, mm->origin );
@ -607,7 +607,7 @@ void MmoveSingle
point[ 1 ] = mmove->origin[ 1 ];
point[ 2 ] = mmove->origin[ 2 ] - 18.0f;
gi.Trace( &trace, mm->origin, mm->mins, mm->maxs, point, mm->entityNum, mm->tracemask, qtrue, qfalse );
gi.trace( &trace, mm->origin, mm->mins, mm->maxs, point, mm->entityNum, mm->tracemask, qtrue, qfalse );
if( trace.fraction < 1.0f && !trace.allsolid )
{

View file

@ -1328,7 +1328,7 @@ void G_Physics_Toss
// check for water transition
wasinwater = ( ent->watertype & MASK_WATER );
ent->watertype = gi.PointContents( ent->origin, 0 );
ent->watertype = gi.pointcontents( ent->origin, 0 );
isinwater = ent->watertype & MASK_WATER;
if( isinwater )
@ -1418,7 +1418,7 @@ void G_CheckWater
Entity *ent
)
{
ent->watertype = gi.PointContents( ent->origin, 0 );
ent->watertype = gi.pointcontents( ent->origin, 0 );
if( ent->watertype & MASK_WATER )
{
ent->waterlevel = 1;

View file

@ -43,7 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define SVF_CLIENTMASK 0x00000002
#define SVF_BROADCAST 0x00000004 // send to all connected clients
#define SVF_BOT 0x00000008 // set if the entity is a bot
#define SVF_MONSTER 0x00000008 // set if the entity is a bot
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
#define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin
// for link position (missiles and movers)
@ -235,7 +235,7 @@ typedef struct gameImport_s
void * ( *Malloc )( size_t size );
void ( *Free )( void *ptr );
cvar_t * ( *Cvar_Get )( const char *varName, const char *varValue, int varFlags );
void ( *Cvar_Set )( const char *varName, const char *varValue );
void ( *cvar_set )( const char *varName, const char *varValue );
cvar_t *( *cvar_set2 )( const char *varName, const char *varValue, qboolean force );
cvar_t *( *NextCvar )( cvar_t *var );
int ( *Argc )( );
@ -281,24 +281,24 @@ typedef struct gameImport_s
void ( *SetBroadcastVisible )( const vec3_t pos, const vec3_t posB );
void ( *SetBroadcastHearable )(const vec3_t pos, const vec3_t posB );
void ( *SetBroadcastAll )( );
void ( *SetConfigstring )( int index, const char *val );
char *( *GetConfigstring )( int index );
void ( *setConfigstring )( int index, const char *val );
char *( *getConfigstring )( int index );
void ( *SetUserinfo )( int index, const char *val );
void ( *GetUserinfo )( int index, char *buffer, int bufferSize );
void ( *SetBrushModel )( gentity_t *ent, const char *name );
void ( *ModelBoundsFromName )(const char *name, vec3_t mins, vec3_t maxs );
qboolean ( *SightTraceEntity )( gentity_t *touch, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int contentMask, qboolean cylinder );
qboolean ( *SightTrace )( const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int passEntityNum2, int contentMask, qboolean cylinder );
void ( *Trace )( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask, qboolean cylinder, qboolean traceDeep );
void ( *trace )( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask, qboolean cylinder, qboolean traceDeep );
baseshader_t * ( *GetShader )( int shaderNum );
int ( *PointContents )( const vec3_t p, int passEntityNum );
int ( *pointcontents )( const vec3_t p, int passEntityNum );
int ( *PointBrushnum )(const vec3_t p, clipHandle_t model );
void ( *AdjustAreaPortalState )( gentity_t *ent, qboolean open );
int ( *AreaForPoint )( vec3_t pos );
qboolean ( *AreasConnected )( int area1, int area2);
qboolean ( *InPVS )( float *p1, float *p2 );
void ( *LinkEntity )( gentity_t *gEnt );
void ( *UnlinkEntity )( gentity_t *gEnt );
void ( *linkentity )( gentity_t *gEnt );
void ( *unlinkentity )( gentity_t *gEnt );
int ( *AreaEntities )( const vec3_t mins, const vec3_t maxs, int *list, int maxcount );
void ( *ClipToEntity )( trace_t *tr, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int entityNum, int contentMask );
qboolean (*HitEntity)(gentity_t* pEnt, gentity_t* pOther);

View file

@ -45,7 +45,7 @@ Called on game shutdown
*/
void G_WriteClientSessionData( gclient_t *client )
{
gi.Cvar_Set( va( "session%i", ( int )( client - game.clients ) ),
gi.cvar_set( va( "session%i", ( int )( client - game.clients ) ),
va( "%s %i %i", client->pers.dm_primary[ 0 ] ? client->pers.dm_primary : "-",
client->pers.teamnum,
client->pers.round_kills) );
@ -119,7 +119,7 @@ G_WriteSessionData
void G_WriteSessionData( void ) {
int i;
gi.Cvar_Set( "session", va( "%i", g_gametype->integer ) );
gi.cvar_set( "session", va( "%i", g_gametype->integer ) );
for ( i = 0 ; i < game.maxclients ; i++ )
{

View file

@ -1039,7 +1039,7 @@ qboolean G_CallSpawn( gentity_t *ent ) {
}
ent->s.frameInfo[0].weight = 1.f;
G_SetOrigin( ent, ent->s.origin );
gi.LinkEntity (ent);
gi.linkentity (ent);
return qtrue;
#endif
}
@ -1332,13 +1332,13 @@ void SP_worldspawn( void ) {
gi.SetConfigstring( CS_MOTD, g_motd.string ); // message of the day
G_SpawnString( "gravity", "800", &s );
gi.Cvar_Set( "g_gravity", s );
gi.cvar_set( "g_gravity", s );
G_SpawnString( "enableDust", "0", &s );
gi.Cvar_Set( "g_enableDust", s );
gi.cvar_set( "g_enableDust", s );
G_SpawnString( "enableBreath", "0", &s );
gi.Cvar_Set( "g_enableBreath", s );
gi.cvar_set( "g_enableBreath", s );
for( i = 0; i < level.numSpawnVars; i++ )
{
@ -1354,7 +1354,7 @@ void SP_worldspawn( void ) {
// see if we want a warmup time
gi.SetConfigstring( CS_WARMUP, "" );
if ( g_restarted.integer ) {
gi.Cvar_Set( "g_restarted", "0" );
gi.cvar_set( "g_restarted", "0" );
level.warmupTime = 0;
} else if ( g_doWarmup.integer ) { // Turn it on
level.warmupTime = -1;

File diff suppressed because it is too large Load diff

View file

@ -157,7 +157,7 @@ qboolean VM_SlideMove
VectorMA( vm->vs->origin, time_left, vm->vs->velocity, end );
// see if we can make it there
gi.Trace( &trace, vm->vs->origin, vm->mins, vm->maxs, end, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
gi.trace( &trace, vm->vs->origin, vm->mins, vm->maxs, end, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
if( trace.allsolid )
break;
@ -351,7 +351,7 @@ void VM_GroundTrace
point[ 1 ] = vm->vs->origin[ 1 ];
point[ 2 ] = vm->vs->origin[ 2 ] - 0.25f;
gi.Trace( &vm->vs->groundTrace, vm->vs->origin, vm->mins, vm->maxs, point, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
gi.trace( &vm->vs->groundTrace, vm->vs->origin, vm->mins, vm->maxs, point, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
VM_GroundTraceInternal();
}
@ -392,7 +392,7 @@ void VM_StepSlideMove
VectorCopy( start_o, down );
down[ 2 ] -= STEPSIZE;
gi.Trace( &trace, start_o, vm->mins, vm->maxs, down, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
gi.trace( &trace, start_o, vm->mins, vm->maxs, down, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
VectorSet( up, 0, 0, 1 );
// never step up when you still have up velocity
@ -432,7 +432,7 @@ void VM_StepSlideMove
down[ 2 ] -= STEPSIZE * 2;
// test the player position if they were a stepheight higher
gi.Trace( &trace, up, vm->mins, vm->maxs, up, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
gi.trace( &trace, up, vm->mins, vm->maxs, up, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
if( trace.entityNum > ENTITYNUM_NONE )
{
VectorCopy( nostep_o, vm->vs->origin );
@ -624,7 +624,7 @@ void VmoveSingle
point[ 1 ] = vm->vs->origin[ 1 ];
point[ 2 ] = vm->vs->origin[ 2 ] - 18.0f;
gi.Trace( &trace, vm->vs->origin, vm->mins, vm->maxs, point, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
gi.trace( &trace, vm->vs->origin, vm->mins, vm->maxs, point, vm->vs->entityNum, vm->tracemask, qtrue, qfalse );
if( trace.fraction < 1.0f && !trace.allsolid )
{

View file

@ -147,7 +147,7 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage ) {
passent = ent->s.number;
for (i = 0; i < 10; i++) {
gi.Trace (&tr, g_muzzle, NULL, NULL, end, passent, MASK_SHOT);
gi.trace (&tr, g_muzzle, NULL, NULL, end, passent, MASK_SHOT);
if ( tr.surfaceFlags & SURF_NOIMPACT ) {
return;
}
@ -225,7 +225,7 @@ qboolean ShotgunPellet( vec3_t start, vec3_t end, gentity_t *ent ) {
VectorCopy( start, tr_start );
VectorCopy( end, tr_end );
for (i = 0; i < 10; i++) {
gi.Trace (&tr, tr_start, NULL, NULL, tr_end, passent, MASK_SHOT);
gi.trace (&tr, tr_start, NULL, NULL, tr_end, passent, MASK_SHOT);
traceEnt = &g_entities[ tr.entityNum ];
// send bullet impact
@ -412,7 +412,7 @@ void weapon_railgun_fire (gentity_t *ent) {
hits = 0;
passent = ent->s.number;
do {
gi.Trace (&trace, g_muzzle, NULL, NULL, end, passent, MASK_SHOT );
gi.trace (&trace, g_muzzle, NULL, NULL, end, passent, MASK_SHOT );
if ( trace.entityNum >= ENTITYNUM_MAX_NORMAL ) {
break;
}
@ -574,7 +574,7 @@ void Weapon_LightningFire( gentity_t *ent ) {
for (i = 0; i < 10; i++) {
VectorMA( g_muzzle, LIGHTNING_RANGE, forward, end );
gi.Trace( &tr, g_muzzle, NULL, NULL, end, passent, MASK_SHOT );
gi.trace( &tr, g_muzzle, NULL, NULL, end, passent, MASK_SHOT );
#ifdef MISSIONPACK
// if not the first trace (the lightning bounced of an invulnerability sphere)

View file

@ -183,7 +183,7 @@ void G_ExitLevel
{
// The nextmap cvar was set (possibly by a vote - so go ahead and use it)
level.nextmap = sv_nextmap->string;
gi.Cvar_Set( "nextmap", "" );
gi.cvar_set( "nextmap", "" );
}
else // Use the next map in the maplist
{
@ -305,7 +305,7 @@ void G_UpdateMatchEndTime( void )
if( level.svsEndTime != endtime )
{
level.svsEndTime = endtime;
gi.SetConfigstring( CS_MATCHEND, va( "%i", endtime ) );
gi.setConfigstring( CS_MATCHEND, va( "%i", endtime ) );
}
}
@ -346,48 +346,6 @@ SimpleArchivedEntity *G_FindArchivedClass( SimpleArchivedEntity *ent, const char
return NULL;
}
Entity *G_FindClass( Entity *ent, const char *classname )
{
int entnum;
gentity_t *from;
if( ent )
{
entnum = ent->entnum;
}
else
{
entnum = -1;
}
for( from = &g_entities[ entnum + 1 ]; from < &g_entities[ globals.num_entities ]; from++ )
{
if( !from->inuse )
{
continue;
}
if( !Q_stricmp( from->entity->getClassID(), classname ) )
{
return from->entity;
}
}
return NULL;
}
Entity *G_GetEntity( int ent_num )
{
gentity_t * ent = &globals.gentities[ ent_num ];
if( ent_num < 0 || ent_num > globals.max_entities )
{
gi.DPrintf( "G_GetEntity: %d out of valid range.\n", ent_num );
return NULL;
}
return ent->entity;
}
Entity *G_GetEntityByClient( int clientNum )
{
gentity_t * ent = globals.gentities;
@ -510,40 +468,6 @@ Entity *G_FindRandomTarget( const char *name )
return (Entity *)found;
}
void G_TouchTriggers( Entity *ent )
{
int i;
int num;
int touch[ MAX_GENTITIES ];
gentity_t *hit;
Event *ev;
// dead things don't activate triggers!
if( ( ent->client || ( ent->edict->r.svFlags & SVF_BOT ) ) && ( ent->IsDead() ) )
{
return;
}
num = gi.AreaEntities( ent->absmin, ent->absmax, touch, MAX_GENTITIES );
// be careful, it is possible to have an entity in this
// list removed before we get to it (killtriggered)
for( i = 0; i < num; i++ )
{
hit = &g_entities[ touch[ i ] ];
if( !hit->inuse || ( hit->entity == ent ) || ( hit->solid != SOLID_TRIGGER ) )
{
continue;
}
assert( hit->entity );
ev = new Event( EV_Touch );
ev->AddEntity( ent );
hit->entity->ProcessEvent( ev );
}
}
Game::Game()
{
clients = NULL;

View file

@ -126,15 +126,6 @@ Entity *G_FindClass(
const char *classname
);
/* G_FindTarget
*
* Find an entity with the specified targetname.
*/
SimpleEntity *G_FindTarget(
SimpleEntity *ent,
const char *name
);
/* G_FindRandomSimpleTarget
*
* Find a random simple entity with the specified targetname.
@ -218,25 +209,5 @@ gentity_t * G_GetGEntity(
int id
);
/* G_StartCinematic
*
* Turns on cinematic.
*/
void G_StartCinematic( void );
/* G_StopCinematic
*
* Turns off cinematic.
*/
void G_StopCinematic( void );
/* G_TouchTriggers
*
* Makes the entity touch triggers
*/
void G_TouchTriggers(
Entity *entity
);
extern Game game;

View file

@ -349,7 +349,7 @@ void CVAR_Init(void)
sv_sprinton = gi.Cvar_Get("sv_sprinton", "1", 0);
if (!sv_sprinton->integer && sv_runspeed->integer == 287) {
gi.Cvar_Set("sv_runspeed", "250");
gi.cvar_set("sv_runspeed", "250");
}
sv_invulnerabletime = gi.Cvar_Get("sv_invulnerabletime", "3.0", CVAR_ARCHIVE | CVAR_SERVERINFO);
@ -415,7 +415,7 @@ void CVAR_Init(void)
g_gametypestring = gi.Cvar_Get("g_gametypestring", "Free-For-All", CVAR_SERVERINFO);
g_realismmode = gi.Cvar_Get("g_realismmode", "0", CVAR_USERINFO | CVAR_SERVERINFO | CVAR_LATCH);
if (!g_gametype->integer) {
gi.Cvar_Set("g_realismmode", "0");
gi.cvar_set("g_realismmode", "0");
}
g_teamdamage = gi.Cvar_Get("g_teamdamage", "0", 0);
@ -448,40 +448,40 @@ void CVAR_Init(void)
s_debugmusic = gi.Cvar_Get("s_debugmusic", "0", 0);
if (g_gametype->integer == GT_SINGLE_PLAYER) {
gi.Cvar_Set("deathmatch", "0");
gi.cvar_set("deathmatch", "0");
} else {
gi.Cvar_Set("deathmatch", "1");
gi.cvar_set("deathmatch", "1");
}
if (g_protocol >= PROTOCOL_MOHTA_MIN) {
if (gi.Cvar_Get("com_target_game", "", 0)->integer == target_game_e::TG_MOHTT) {
// Set the server type to mohaab
gi.Cvar_Set("g_servertype", va("%d", target_game_e::TG_MOHTT));
gi.cvar_set("g_servertype", va("%d", target_game_e::TG_MOHTT));
}
}
switch (g_gametype->integer) {
default:
case GT_FFA:
gi.Cvar_Set("g_gametypestring", "Free-For-All");
gi.cvar_set("g_gametypestring", "Free-For-All");
break;
case GT_TEAM:
gi.Cvar_Set("g_gametypestring", "Team-Match");
gi.cvar_set("g_gametypestring", "Team-Match");
break;
case GT_TEAM_ROUNDS:
gi.Cvar_Set("g_gametypestring", "Round-Based-Match");
gi.cvar_set("g_gametypestring", "Round-Based-Match");
break;
case GT_OBJECTIVE:
gi.Cvar_Set("g_gametypestring", "Objective-Match");
gi.cvar_set("g_gametypestring", "Objective-Match");
break;
case GT_TOW:
gi.Cvar_Set("g_gametypestring", "Tug-of-War");
gi.cvar_set("g_gametypestring", "Tug-of-War");
break;
case GT_LIBERATION:
gi.Cvar_Set("g_gametypestring", "Liberation");
gi.cvar_set("g_gametypestring", "Liberation");
break;
case GT_SINGLE_PLAYER:
gi.Cvar_Set("g_gametypestring", "Multiplayer");
gi.cvar_set("g_gametypestring", "Multiplayer");
break;
}
@ -563,12 +563,12 @@ void CVAR_Init(void)
gi.Cvar_Get("g_scoreboardpicover", "", CVAR_SERVERINFO);
if (g_gametype->integer > GT_TEAM) {
gi.Cvar_Set("g_tempaxisscore", "0");
gi.Cvar_Set("g_tempaxiswinsinrow", "0");
gi.Cvar_Set("g_tempalliesscore", "0");
gi.Cvar_Set("g_tempallieswinsinrow", "0");
gi.Cvar_Set("g_tempmaptime", "0");
gi.Cvar_Set("g_scoreboardpicover", "");
gi.cvar_set("g_tempaxisscore", "0");
gi.cvar_set("g_tempaxiswinsinrow", "0");
gi.cvar_set("g_tempalliesscore", "0");
gi.cvar_set("g_tempallieswinsinrow", "0");
gi.cvar_set("g_tempmaptime", "0");
gi.cvar_set("g_scoreboardpicover", "");
}
g_turret_convergetime = gi.Cvar_Get("g_turret_convergetime", "2", 0);

View file

@ -103,7 +103,7 @@ Vector GravPathManager::CalculateGravityPull(Entity &ent, Vector pos, qboolean *
return vec_zero;
}
entity_contents = gi.PointContents( ent.origin, 0 );
entity_contents = gi.pointcontents( ent.origin, 0 );
for( i = 1; i <= num; i++ )
{
@ -118,7 +118,7 @@ Vector GravPathManager::CalculateGravityPull(Entity &ent, Vector pos, qboolean *
continue;
// Check to see if the contents are the same
grav_contents = gi.PointContents( node->origin, 0 );
grav_contents = gi.pointcontents( node->origin, 0 );
// If grav node is in water, make sure ent is too.
if ( ( grav_contents & CONTENTS_WATER ) && !( entity_contents & CONTENTS_WATER ) )

View file

@ -874,7 +874,7 @@ void Level::CleanUp(qboolean samemap, qboolean resetConfigStrings)
ClearProjectileTargets();
// Reset the boss health cvar
gi.Cvar_Set("bosshealth", "0");
gi.cvar_set("bosshealth", "0");
Actor::ResetBodyQueue();
@ -913,19 +913,19 @@ void Level::CleanUp(qboolean samemap, qboolean resetConfigStrings)
}
if (resetConfigStrings) {
gi.SetConfigstring(CS_RAIN_DENSITY, "0");
gi.SetConfigstring(CS_RAIN_SPEED, "2048");
gi.SetConfigstring(CS_RAIN_SPEEDVARY, "512");
gi.SetConfigstring(CS_RAIN_SLANT, "50");
gi.SetConfigstring(CS_RAIN_LENGTH, "90");
gi.SetConfigstring(CS_RAIN_MINDIST, "512");
gi.SetConfigstring(CS_RAIN_WIDTH, "1");
gi.SetConfigstring(CS_RAIN_SHADER, "textures/rain");
gi.SetConfigstring(CS_RAIN_NUMSHADERS, "0");
gi.SetConfigstring(CS_CURRENT_OBJECTIVE, "");
gi.setConfigstring(CS_RAIN_DENSITY, "0");
gi.setConfigstring(CS_RAIN_SPEED, "2048");
gi.setConfigstring(CS_RAIN_SPEEDVARY, "512");
gi.setConfigstring(CS_RAIN_SLANT, "50");
gi.setConfigstring(CS_RAIN_LENGTH, "90");
gi.setConfigstring(CS_RAIN_MINDIST, "512");
gi.setConfigstring(CS_RAIN_WIDTH, "1");
gi.setConfigstring(CS_RAIN_SHADER, "textures/rain");
gi.setConfigstring(CS_RAIN_NUMSHADERS, "0");
gi.setConfigstring(CS_CURRENT_OBJECTIVE, "");
for (int i = CS_OBJECTIVES; i < CS_OBJECTIVES + MAX_OBJECTIVES; i++) {
gi.SetConfigstring(i, "");
gi.setConfigstring(i, "");
}
}
@ -1012,7 +1012,7 @@ void Level::setSkill(int value)
skill_level = floor((float)value);
skill_level = bound(skill_level, 0, 3);
gi.Cvar_Set("skill", va("%d", skill_level));
gi.cvar_set("skill", va("%d", skill_level));
}
void Level::setTime(int levelTime)
@ -1455,7 +1455,7 @@ void Level::FreeEdict(gentity_t *ed)
gclient_t *client;
// unlink from world
gi.UnlinkEntity(ed);
gi.unlinkentity(ed);
LL_Remove(ed, next, prev);
@ -1806,92 +1806,92 @@ void Level::DoEarthquakes(void)
void Level::EventRainDensitySet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_DENSITY, ev->GetString(1));
gi.setConfigstring(CS_RAIN_DENSITY, ev->GetString(1));
}
void Level::EventRainDensityGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_DENSITY));
ev->AddString(gi.getConfigstring(CS_RAIN_DENSITY));
}
void Level::EventRainSpeedSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_SPEED, ev->GetString(1));
gi.setConfigstring(CS_RAIN_SPEED, ev->GetString(1));
}
void Level::EventRainSpeedGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_SPEED));
ev->AddString(gi.getConfigstring(CS_RAIN_SPEED));
}
void Level::EventRainSpeedVarySet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_SPEEDVARY, ev->GetString(1));
gi.setConfigstring(CS_RAIN_SPEEDVARY, ev->GetString(1));
}
void Level::EventRainSpeedVaryGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_SPEEDVARY));
ev->AddString(gi.getConfigstring(CS_RAIN_SPEEDVARY));
}
void Level::EventRainSlantSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_SLANT, ev->GetString(1));
gi.setConfigstring(CS_RAIN_SLANT, ev->GetString(1));
}
void Level::EventRainSlantGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_SLANT));
ev->AddString(gi.getConfigstring(CS_RAIN_SLANT));
}
void Level::EventRainLengthSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_LENGTH, ev->GetString(1));
gi.setConfigstring(CS_RAIN_LENGTH, ev->GetString(1));
}
void Level::EventRainLengthGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_LENGTH));
ev->AddString(gi.getConfigstring(CS_RAIN_LENGTH));
}
void Level::EventRainMin_DistSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_MINDIST, ev->GetString(1));
gi.setConfigstring(CS_RAIN_MINDIST, ev->GetString(1));
}
void Level::EventRainMin_DistGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_MINDIST));
ev->AddString(gi.getConfigstring(CS_RAIN_MINDIST));
}
void Level::EventRainWidthSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_WIDTH, ev->GetString(1));
gi.setConfigstring(CS_RAIN_WIDTH, ev->GetString(1));
}
void Level::EventRainWidthGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_WIDTH));
ev->AddString(gi.getConfigstring(CS_RAIN_WIDTH));
}
void Level::EventRainShaderSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_SHADER, ev->GetString(1));
gi.setConfigstring(CS_RAIN_SHADER, ev->GetString(1));
}
void Level::EventRainShaderGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_SHADER));
ev->AddString(gi.getConfigstring(CS_RAIN_SHADER));
}
void Level::EventRainNumShadersSet(Event *ev)
{
gi.SetConfigstring(CS_RAIN_NUMSHADERS, ev->GetString(1));
gi.setConfigstring(CS_RAIN_NUMSHADERS, ev->GetString(1));
}
void Level::EventRainNumShadersGet(Event *ev)
{
ev->AddString(gi.GetConfigstring(CS_RAIN_NUMSHADERS));
ev->AddString(gi.getConfigstring(CS_RAIN_NUMSHADERS));
}
void Level::EventAddBadPlace(Event* ev)

View file

@ -125,8 +125,8 @@ void LODMaster::Spawn
ScriptError( "Must specify a model name" );
}
gi.Cvar_Set( "lod_tikiname", mdl );
gi.Cvar_Set( "lod_tool", "1" );
gi.cvar_set( "lod_tikiname", mdl );
gi.cvar_set( "lod_tool", "1" );
ent = g_entities->entity;

View file

@ -200,7 +200,7 @@ qboolean cMoveGrid::CheckStuck
{
for( z = 0; z < m_iZRes; z++ )
{
gi.Trace( &trace, v.vs->origin, v.mins, v.maxs, v.vs->origin, v.vs->entityNum, v.tracemask, false, false );
gi.trace( &trace, v.vs->origin, v.mins, v.maxs, v.vs->origin, v.vs->entityNum, v.tracemask, false, false );
if( trace.allsolid || trace.startsolid || trace.fraction == 0.0f )
{

View file

@ -1986,7 +1986,7 @@ void PathSearch::CreatePaths
for( i = 0, ent = g_entities; i < game.maxentities; i++, ent++ )
{
if( ent->entity && ent->entity->IsSubclassOfDoor() )
gi.UnlinkEntity( ent );
gi.unlinkentity( ent );
}
for( x = 0; x < PATHMAP_GRIDSIZE; x++ )

View file

@ -118,7 +118,7 @@ void InteractObject::Damaged(Event *ev)
void InteractObject::Killed(Event *ev)
{
SimpleEntity *ent;
Entity *ent;
Entity *attacker;
Vector dir;
const char *name;

View file

@ -3480,13 +3480,13 @@ void Player::SetMoveInfo(pmove_t *pm, usercmd_t *ucmd)
}
if (sv_drawtrace->integer <= 1) {
pm->trace = gi.Trace;
pm->trace = gi.trace;
} else {
pm->trace = &G_PMDrawTrace;
}
pm->tracemask = MASK_PLAYERSOLID;
pm->pointcontents = gi.PointContents;
pm->pointcontents = gi.pointcontents;
pm->ps->origin[0] = origin.x;
pm->ps->origin[1] = origin.y;
@ -4042,11 +4042,11 @@ void Player::ClientInactivityTimer(void)
}
if (g_inactivekick->integer && g_inactivekick->integer < 60) {
gi.Cvar_Set("g_inactiveKick", "60");
gi.cvar_set("g_inactiveKick", "60");
}
if (g_inactivespectate->integer && g_inactivespectate->integer < 20) {
gi.Cvar_Set("g_inactiveSpectate", "20");
gi.cvar_set("g_inactiveSpectate", "20");
}
if (num_team_kills >= g_teamkillkick->integer) {
@ -4319,11 +4319,11 @@ void Player::ClientThink(void)
}
} else {
if (level.intermissiontype == TRANS_MISSION_FAILED || IsDead()) {
gi.Cvar_Set("g_success", "0");
gi.Cvar_Set("g_failed", "1");
gi.cvar_set("g_success", "0");
gi.cvar_set("g_failed", "1");
} else {
gi.Cvar_Set("g_success", "1");
gi.Cvar_Set("g_failed", "0");
gi.cvar_set("g_success", "1");
gi.cvar_set("g_failed", "0");
}
// prevent getting medals from cheats
@ -4333,9 +4333,9 @@ void Player::ClientThink(void)
|| g_medalbt3->modificationCount > 1 || g_medalbt4->modificationCount > 1
|| g_medalbt5->modificationCount > 1 || g_eogmedal0->modificationCount > 1
|| g_eogmedal1->modificationCount > 1 || g_eogmedal2->modificationCount > 1) {
gi.Cvar_Set("g_gotmedal", "0");
gi.cvar_set("g_gotmedal", "0");
} else {
gi.Cvar_Set("g_gotmedal", "1");
gi.cvar_set("g_gotmedal", "1");
}
client->ps.pm_flags |= PMF_FROZEN;
@ -4503,7 +4503,7 @@ void Player::Think(void)
}
} else if (m_fWeapSelectTime < level.time) {
m_fWeapSelectTime = level.time + 1.0;
UserSelectWeapon(NULL);
UserSelectWeapon(false);
}
} else if (m_fWeapSelectTime < level.time) {
m_fWeapSelectTime = level.time + 1.0;
@ -5856,7 +5856,7 @@ void Player::CalcBlend(void)
// add for contents
vieworg = m_vViewPos;
contents = gi.PointContents(vieworg, 0);
contents = gi.pointcontents(vieworg, 0);
if (contents & CONTENTS_SOLID) {
// Outside of world
@ -7775,7 +7775,7 @@ void Player::ArchivePersistantData(Archiver& arc)
if (arc.Loading()) {
// set the cvar
gi.Cvar_Set("g_playermodel", model_name.c_str());
gi.cvar_set("g_playermodel", model_name.c_str());
model_name += ".tik";
setModel(model_name.c_str());
@ -8413,7 +8413,7 @@ void Player::EnsurePlayerHasAllowedWeapons()
}
}
gi.Cvar_Set("dmflags", va("%i", dmflags->integer & ~DF_WEAPON_NO_RIFLE));
gi.cvar_set("dmflags", va("%i", dmflags->integer & ~DF_WEAPON_NO_RIFLE));
Com_Printf("No valid weapons -- re-allowing the rifle\n");
strcpy(client->pers.dm_primary, "rifle");
}
@ -10505,11 +10505,11 @@ void Player::EventEnterIntermission(Event *ev)
G_DisplayScores(this);
if (level.intermissiontype == TRANS_MISSION_FAILED || IsDead()) {
gi.Cvar_Set("g_success", "0");
gi.Cvar_Set("g_failed", "1");
gi.cvar_set("g_success", "0");
gi.cvar_set("g_failed", "1");
} else {
gi.Cvar_Set("g_success", "1");
gi.Cvar_Set("g_failed", "0");
gi.cvar_set("g_success", "1");
gi.cvar_set("g_failed", "0");
}
} else {
G_HideScores(this);
@ -10900,7 +10900,7 @@ void Player::UserSelectWeapon(bool bWait)
&& dmflags->integer & DF_WEAPON_NO_SMG && dmflags->integer & DF_WEAPON_NO_MG
&& dmflags->integer & DF_WEAPON_NO_ROCKET && dmflags->integer & DF_WEAPON_NO_SHOTGUN
&& dmflags->integer & DF_WEAPON_NO_LANDMINE && !QueryLandminesAllowed()) {
gi.Cvar_Set("dmflags", va("%i", dmflags->integer & ~DF_WEAPON_NO_RIFLE));
gi.cvar_set("dmflags", va("%i", dmflags->integer & ~DF_WEAPON_NO_RIFLE));
Com_Printf("No valid weapons -- re-allowing the rifle\n");
strcpy(client->pers.dm_primary, "rifle");
}

View file

@ -552,7 +552,7 @@ public:
//====
// Added in 2.30
void EventForceLandmineMeasure(Event *ev);
void EventForceLandmineMeasure(Event *ev) override;
str GetCurrentDMWeaponType() const;
//====

View file

@ -1227,7 +1227,7 @@ qboolean Player::CondKnockDown(Conditional& condition)
qboolean Player::CondPainType(Conditional& condition)
{
if (pain_type == MOD_NameToNum(condition.getParm(1))) {
if (pain_type == MOD_string_to_int(condition.getParm(1))) {
return qtrue;
} else {
return qfalse;
@ -1588,7 +1588,7 @@ qboolean Player::CondCheckHeight(Conditional& condition)
qboolean Player::CondViewInWater(Conditional& condition)
{
return (gi.PointContents(m_vViewPos, 0) & MASK_WATER) != 0;
return (gi.pointcontents(m_vViewPos, 0) & MASK_WATER) != 0;
}
qboolean Player::CondDuckedViewInWater(Conditional& condition)
@ -1596,7 +1596,7 @@ qboolean Player::CondDuckedViewInWater(Conditional& condition)
Vector vPos = origin;
vPos[2] += 48.0f;
return (gi.PointContents(vPos, 0) & MASK_WATER) != 0;
return (gi.pointcontents(vPos, 0) & MASK_WATER) != 0;
}
qboolean Player::CondCheckMovementSpeed(Conditional& condition)

View file

@ -99,7 +99,7 @@ PortalSurface::PortalSurface
VectorClear( edict->r.mins );
VectorClear( edict->r.maxs );
gi.LinkEntity( edict );
gi.linkentity( edict );
edict->r.svFlags = SVF_PORTAL | SVF_SENDPVS;
edict->s.eType = ET_PORTAL;
@ -158,5 +158,5 @@ PortalCamera::PortalCamera
// No roll on the camera by default
edict->s.skinNum = 0;
gi.LinkEntity( edict );
gi.linkentity( edict );
}

View file

@ -1486,7 +1486,7 @@ void ScriptSlave::SetMeansOfDeath
)
{
dmg_means_of_death = MOD_NameToNum( ev->GetString( 1 ) );
dmg_means_of_death = MOD_string_to_int( ev->GetString( 1 ) );
}
void ScriptSlave::CreatePath

View file

@ -2903,7 +2903,7 @@ void ScriptThread::MapEvent(Event *ev)
void ScriptThread::SetCvarEvent(Event *ev)
{
gi.Cvar_Set(ev->GetString(1), ev->GetString(2));
gi.cvar_set(ev->GetString(1), ev->GetString(2));
}
void ScriptThread::EventDebugLine(Event *ev)
@ -4199,7 +4199,7 @@ void ScriptThread::AddObjective(int index, int status, str text, Vector location
char *sTmp;
flags = OBJ_FLAG_NONE;
sTmp = gi.GetConfigstring(CS_OBJECTIVES + index);
sTmp = gi.getConfigstring(CS_OBJECTIVES + index);
switch (status) {
case OBJ_STATUS_HIDDEN:
@ -4235,19 +4235,19 @@ void ScriptThread::AddObjective(int index, int status, str text, Vector location
Info_SetValueForKey(szSend, "text", text.c_str());
Info_SetValueForKey(szSend, "loc", va("%f %f %f", location[0], location[1], location[2]));
gi.SetConfigstring(CS_OBJECTIVES + index, szSend);
gi.setConfigstring(CS_OBJECTIVES + index, szSend);
}
void ScriptThread::SetCurrentObjective(int iObjective, int iTeam)
{
gi.SetConfigstring(CS_CURRENT_OBJECTIVE, va("%i", iObjective));
gi.setConfigstring(CS_CURRENT_OBJECTIVE, va("%i", iObjective));
if (iObjective == -1) {
level.m_vObjectiveLocation = vec_zero;
level.m_vAlliedObjectiveLocation = vec_zero;
level.m_vAxisObjectiveLocation = vec_zero;
} else {
const char *s = gi.GetConfigstring(CS_OBJECTIVES + iObjective);
const char *s = gi.getConfigstring(CS_OBJECTIVES + iObjective);
const char *loc = Info_ValueForKey(s, "loc");
Vector v;
@ -4297,14 +4297,14 @@ void ScriptThread::EventAddObjective(Event *ev)
}
if (ev->IsNilAt(3)) {
text = Info_ValueForKey(gi.GetConfigstring(index + CS_OBJECTIVES), "text");
text = Info_ValueForKey(gi.getConfigstring(index + CS_OBJECTIVES), "text");
} else {
text = ev->GetString(3);
}
if (ev->IsNilAt(4)) {
sscanf(
Info_ValueForKey(gi.GetConfigstring(index + CS_OBJECTIVES), "loc"),
Info_ValueForKey(gi.getConfigstring(index + CS_OBJECTIVES), "loc"),
"%f %f %f",
&location.x,
&location.y,
@ -4330,10 +4330,10 @@ void ScriptThread::EventSetScoreboardToggle(Event *ev)
team = ev->GetConstString(1);
switch (team) {
case STRING_AXIS:
gi.Cvar_Set("scoreboard_toggle2", va("%i", value));
gi.cvar_set("scoreboard_toggle2", va("%i", value));
break;
case STRING_ALLIES:
gi.Cvar_Set("scoreboard_toggle1", va("%i", value));
gi.cvar_set("scoreboard_toggle1", va("%i", value));
break;
default:
ScriptError("1st argument can only be \"axis\" or \"allies\"");
@ -5308,7 +5308,7 @@ void ScriptThread::FileOpen(Event *ev)
} else {
ev->AddInteger((int)(size_t)f);
sprintf(buf, "%i", scriptfiles->integer + 1);
gi.Cvar_Set("sv_scriptfiles", buf);
gi.cvar_set("sv_scriptfiles", buf);
return;
}
}
@ -5368,7 +5368,7 @@ void ScriptThread::FileClose(Event *ev)
if (ret == 0) {
ev->AddInteger(0);
sprintf(buf, "%i", scriptfiles->integer - 1);
gi.Cvar_Set("sv_scriptfiles", buf);
gi.cvar_set("sv_scriptfiles", buf);
return;
} else {
ev->AddInteger(ret);
@ -6777,9 +6777,9 @@ void ScriptThread::RegisterEvent(Event *ev)
scriptedEvents[evType].label.SetThread(ev->GetValue(2));
if (evType == SE_KEYPRESS) {
gi.Cvar_Set("sv_keypressevents", "1");
gi.cvar_set("sv_keypressevents", "1");
} else if (evType == SE_SERVERCOMMAND) {
gi.Cvar_Set("sv_servercmdevents", "1");
gi.cvar_set("sv_servercmdevents", "1");
}
ev->AddInteger(0);
@ -6816,9 +6816,9 @@ void ScriptThread::UnregisterEvent(Event *ev)
scriptedEvents[evType].label.Set("");
if (evType == SE_KEYPRESS) {
gi.Cvar_Set("sv_keypressevents", "0");
gi.cvar_set("sv_keypressevents", "0");
} else if (evType == SE_SERVERCOMMAND) {
gi.Cvar_Set("sv_servercmdevents", "0");
gi.cvar_set("sv_servercmdevents", "0");
}
ev->AddInteger(0);
@ -6948,7 +6948,7 @@ void ScriptThread::TraceDetails(Event *ev)
mask = ev->GetInteger(6);
}
gi.Trace(&trace, vecStart, vecMins, vecMaxs, vecEnd, pass_entity, mask, 0, 0);
gi.trace(&trace, vecStart, vecMins, vecMaxs, vecEnd, pass_entity, mask, 0, 0);
allSolidIndex.setStringValue("allSolid");
startSolidIndex.setStringValue("startSolid");

View file

@ -43,7 +43,7 @@ public:
void EventSetFadedelay(Event* ev);
void EventSetMaxAlpha(Event* ev);
void Think();
void Think() override;
private:
float nextRemoveTime;

View file

@ -280,14 +280,14 @@ void SoundManager::UpdateUI
{
if ( current )
{
gi.Cvar_Set( "snd_multifaceted", "" );
gi.Cvar_Set( "snd_currentfacet", "" );
gi.Cvar_Set( "snd_onetime", "0" );
gi.Cvar_Set( "snd_useangles", "0" );
gi.Cvar_Set( "snd_yaw", "0" );
gi.cvar_set( "snd_multifaceted", "" );
gi.cvar_set( "snd_currentfacet", "" );
gi.cvar_set( "snd_onetime", "0" );
gi.cvar_set( "snd_useangles", "0" );
gi.cvar_set( "snd_yaw", "0" );
gi.Cvar_Set( "snd_origin", va( "%.2f %.2f %.2f", current->origin[ 0 ], current->origin[ 1 ], current->origin[ 2 ] ) );
gi.Cvar_Set( "snd_targetname", current->targetname.c_str() );
gi.cvar_set( "snd_origin", va( "%.2f %.2f %.2f", current->origin[ 0 ], current->origin[ 1 ], current->origin[ 2 ] ) );
gi.cvar_set( "snd_targetname", current->targetname.c_str() );
if ( current->isSubclassOf( TriggerSpeaker ) )
{
TriggerSpeaker * speaker;
@ -295,38 +295,38 @@ void SoundManager::UpdateUI
speaker = ( TriggerSpeaker * )current;
if ( speaker->volume != DEFAULT_VOL )
{
gi.Cvar_Set( "snd_volume", va( "%.1f", speaker->volume ) );
gi.cvar_set( "snd_volume", va( "%.1f", speaker->volume ) );
}
else
{
gi.Cvar_Set( "snd_volume", "Default" );
gi.cvar_set( "snd_volume", "Default" );
}
if ( speaker->min_dist != DEFAULT_MIN_DIST )
{
gi.Cvar_Set( "snd_mindist", va( "%.1f", speaker->min_dist ) );
gi.cvar_set( "snd_mindist", va( "%.1f", speaker->min_dist ) );
}
else
{
gi.Cvar_Set( "snd_mindist", "Default" );
gi.cvar_set( "snd_mindist", "Default" );
}
// setup the sound
gi.Cvar_Set( "ui_pickedsound", speaker->Noise().c_str() );
gi.cvar_set( "ui_pickedsound", speaker->Noise().c_str() );
if ( current->isSubclassOf( RandomSpeaker ) )
{
RandomSpeaker * random;
random = ( RandomSpeaker * )current;
gi.Cvar_Set( "snd_mindelay", va( "%.1f", random->mindelay ) );
gi.Cvar_Set( "snd_maxdelay", va( "%.1f", random->maxdelay ) );
gi.Cvar_Set( "snd_channel", va( "%d", random->channel ) );
gi.Cvar_Set( "snd_chance", va( "%.1f", random->chance ) );
gi.Cvar_Set( "snd_type", "RandomSpeaker" );
gi.cvar_set( "snd_mindelay", va( "%.1f", random->mindelay ) );
gi.cvar_set( "snd_maxdelay", va( "%.1f", random->maxdelay ) );
gi.cvar_set( "snd_channel", va( "%d", random->channel ) );
gi.cvar_set( "snd_chance", va( "%.1f", random->chance ) );
gi.cvar_set( "snd_type", "RandomSpeaker" );
}
else
{
gi.Cvar_Set( "snd_type", "Speaker" );
gi.cvar_set( "snd_type", "Speaker" );
}
}
else if ( current->isSubclassOf( TriggerMusic ) || current->isSubclassOf( TriggerReverb ) )
@ -335,49 +335,49 @@ void SoundManager::UpdateUI
Trigger *trigger;
trigger = ( Trigger * )current;
gi.Cvar_Set( "snd_width", va( "%.0f", trigger->maxs[ 0 ] ) );
gi.Cvar_Set( "snd_length", va( "%.0f", trigger->maxs[ 1 ] ) );
gi.Cvar_Set( "snd_height", va( "%.0f", trigger->maxs[ 2 ] ) );
gi.cvar_set( "snd_width", va( "%.0f", trigger->maxs[ 0 ] ) );
gi.cvar_set( "snd_length", va( "%.0f", trigger->maxs[ 1 ] ) );
gi.cvar_set( "snd_height", va( "%.0f", trigger->maxs[ 2 ] ) );
if ( trigger->UsingTriggerDir() )
{
gi.Cvar_Set( "snd_useangles", "1" );
gi.cvar_set( "snd_useangles", "1" );
}
else
{
gi.Cvar_Set( "snd_useangles", "0" );
gi.cvar_set( "snd_useangles", "0" );
}
gi.Cvar_Set( "snd_yaw", va( "%.0f", trigger->angles[ 1 ] ) );
gi.cvar_set( "snd_yaw", va( "%.0f", trigger->angles[ 1 ] ) );
multiFaceted = trigger->GetMultiFaceted();
if ( multiFaceted )
{
if ( multiFaceted == 1 )
{
gi.Cvar_Set( "snd_multifaceted", "North/South" );
gi.cvar_set( "snd_multifaceted", "North/South" );
if ( currentFacet )
{
gi.Cvar_Set( "snd_currentfacet", "South" );
gi.cvar_set( "snd_currentfacet", "South" );
}
else
{
gi.Cvar_Set( "snd_currentfacet", "North" );
gi.cvar_set( "snd_currentfacet", "North" );
}
}
else
{
gi.Cvar_Set( "snd_multifaceted", "East/West" );
gi.cvar_set( "snd_multifaceted", "East/West" );
if ( currentFacet )
{
gi.Cvar_Set( "snd_currentfacet", "West" );
gi.cvar_set( "snd_currentfacet", "West" );
}
else
{
gi.Cvar_Set( "snd_currentfacet", "East" );
gi.cvar_set( "snd_currentfacet", "East" );
}
}
}
else
{
gi.Cvar_Set( "snd_multifaceted", "Not" );
gi.cvar_set( "snd_multifaceted", "Not" );
}
if ( current->isSubclassOf( TriggerMusic ) )
@ -386,25 +386,25 @@ void SoundManager::UpdateUI
music = ( TriggerMusic * )trigger;
gi.Cvar_Set( "snd_type", "MusicTrigger" );
gi.cvar_set( "snd_type", "MusicTrigger" );
if ( music->oneshot )
{
gi.Cvar_Set( "snd_onetime", "1" );
gi.cvar_set( "snd_onetime", "1" );
}
else
{
gi.Cvar_Set( "snd_onetime", "0" );
gi.cvar_set( "snd_onetime", "0" );
}
if ( !currentFacet )
{
gi.Cvar_Set( "snd_currentmood", Director.GetString(music->current).c_str() );
gi.Cvar_Set( "snd_fallbackmood", Director.GetString(music->fallback).c_str() );
gi.cvar_set( "snd_currentmood", Director.GetString(music->current).c_str() );
gi.cvar_set( "snd_fallbackmood", Director.GetString(music->fallback).c_str() );
}
else
{
gi.Cvar_Set( "snd_currentmood", Director.GetString(music->altcurrent).c_str() );
gi.Cvar_Set( "snd_fallbackmood", Director.GetString(music->altfallback).c_str() );
gi.cvar_set( "snd_currentmood", Director.GetString(music->altcurrent).c_str() );
gi.cvar_set( "snd_fallbackmood", Director.GetString(music->altfallback).c_str() );
}
}
else if ( current->isSubclassOf( TriggerReverb ) )
@ -413,39 +413,39 @@ void SoundManager::UpdateUI
reverb = ( TriggerReverb * )trigger;
gi.Cvar_Set( "snd_type", "ReverbTrigger" );
gi.cvar_set( "snd_type", "ReverbTrigger" );
if ( reverb->oneshot )
{
gi.Cvar_Set( "snd_onetime", "1" );
gi.cvar_set( "snd_onetime", "1" );
}
else
{
gi.Cvar_Set( "snd_onetime", "0" );
gi.cvar_set( "snd_onetime", "0" );
}
if ( !currentFacet )
{
gi.Cvar_Set( "snd_reverbtypedisplay", EAXMode_NumToName( reverb->reverbtype ) );
gi.Cvar_Set( "snd_reverbtype", va( "%d", reverb->reverbtype ) );
gi.Cvar_Set( "snd_reverblevel", va( "%.2f", reverb->reverblevel ) );
gi.cvar_set( "snd_reverbtypedisplay", EAXMode_NumToName( reverb->reverbtype ) );
gi.cvar_set( "snd_reverbtype", va( "%d", reverb->reverbtype ) );
gi.cvar_set( "snd_reverblevel", va( "%.2f", reverb->reverblevel ) );
}
else
{
gi.Cvar_Set( "snd_reverbtypedisplay", EAXMode_NumToName( reverb->altreverbtype ) );
gi.Cvar_Set( "snd_reverbtype", va( "%d", reverb->altreverbtype ) );
gi.Cvar_Set( "snd_reverblevel", va( "%.2f", reverb->altreverblevel ) );
gi.cvar_set( "snd_reverbtypedisplay", EAXMode_NumToName( reverb->altreverbtype ) );
gi.cvar_set( "snd_reverbtype", va( "%d", reverb->altreverbtype ) );
gi.cvar_set( "snd_reverblevel", va( "%.2f", reverb->altreverblevel ) );
}
}
}
if ( EventPending( EV_SoundManager_ShowingSounds ) )
{
gi.Cvar_Set( "snd_hiddenstate", "visible" );
gi.cvar_set( "snd_hiddenstate", "visible" );
}
else
{
gi.Cvar_Set( "snd_hiddenstate", "hidden" );
gi.cvar_set( "snd_hiddenstate", "hidden" );
}
gi.Cvar_Set( "snd_speakernum", va( "%d", soundList.IndexOfObject( current ) - 1 ) );
gi.cvar_set( "snd_speakernum", va( "%d", soundList.IndexOfObject( current ) - 1 ) );
}
}

View file

@ -582,7 +582,7 @@ void Trigger::ActivateTargets(Event *ev)
if (name && strcmp(name, "")) {
ent = NULL;
do {
ent = (Entity *)G_FindTarget((SimpleEntity *)ent, name);
ent = G_FindTarget(ent, name);
if (!ent) {
break;
}
@ -597,7 +597,7 @@ void Trigger::ActivateTargets(Event *ev)
if (name && strcmp(name, "")) {
ent = NULL;
do {
ent = (Entity *)G_FindTarget((SimpleEntity *)ent, name);
ent = G_FindTarget(ent, name);
if (!ent) {
break;
}
@ -1129,7 +1129,7 @@ Event EV_TriggerSave_SaveName(
void TriggerSave::SaveGame(Event *ev)
{
gi.SetConfigstring(CS_SAVENAME, m_sSaveName);
gi.setConfigstring(CS_SAVENAME, m_sSaveName);
gi.SendConsoleCommand("savegame");
}
@ -2043,7 +2043,7 @@ void TriggerDamageTargets::PassDamage(Event *ev)
if (name && strcmp(name, "")) {
ent = NULL;
do {
ent = (Entity *)G_FindTarget((SimpleEntity *)ent, name);
ent = G_FindTarget(ent, name);
if (!ent) {
break;
}
@ -2098,7 +2098,7 @@ void TriggerDamageTargets::DamageTargets(Event *ev)
if (name && strcmp(name, "")) {
ent = NULL;
do {
ent = (Entity *)G_FindTarget((SimpleEntity *)ent, name);
ent = G_FindTarget(ent, name);
if (!ent) {
break;
}

View file

@ -1274,19 +1274,19 @@ void Vehicle::CheckWater
point = origin;
point[ 2 ] += mins[ 2 ];
cont = gi.PointContents( point, 0 );
cont = gi.pointcontents( point, 0 );
if( cont & MASK_WATER )
{
watertype = cont;
waterlevel = 1;
point[ 2 ] = origin[ 2 ] + mins[ 2 ] + sample1;
cont = gi.PointContents( point, 0 );
cont = gi.pointcontents( point, 0 );
if( cont & MASK_WATER )
{
waterlevel = 2;
point[ 2 ] = origin[ 2 ] + mins[ 2 ] + sample2;
cont = gi.PointContents( point, 0 );
cont = gi.pointcontents( point, 0 );
if( cont & MASK_WATER )
{
waterlevel = 3;

View file

@ -607,7 +607,7 @@ void Viewthing::UpdateCvars
)
{
gi.Cvar_Set("viewmodelentity", va("%d", edict->s.number));
gi.cvar_set("viewmodelentity", va("%d", edict->s.number));
}
@ -628,7 +628,7 @@ void Viewthing::ThinkEvent
angles.AngleVectors(&forward, &left, &up);
realmove = left * accel[1] + up * accel[2] + forward * accel[0];
setOrigin(baseorigin + realmove);
gi.Cvar_Set("viewthingorigin", va("%0.2f,%0.2f,%0.2f", edict->s.origin[0], edict->s.origin[1], edict->s.origin[2]));
gi.cvar_set("viewthingorigin", va("%0.2f,%0.2f,%0.2f", edict->s.origin[0], edict->s.origin[1], edict->s.origin[2]));
}
PostEvent(EV_ViewThing_Think, FRAMETIME);
if ((animstate > 0) && (Viewmodel.current_viewthing == this))
@ -640,9 +640,9 @@ void Viewthing::ThinkEvent
lastframe = f;
time = f * AnimTime() / NumFrames();
gi.Printf("current frame %d time %.2f\n", f, time);
gi.Cvar_Set("viewmodeltime", va("%.2f", time));
gi.Cvar_Set("viewmodelframe", va("%d", f));
gi.Cvar_Set("viewmodelanim", AnimName());
gi.cvar_set("viewmodeltime", va("%.2f", time));
gi.cvar_set("viewmodelframe", va("%d", f));
gi.cvar_set("viewmodelanim", AnimName());
}
}
}
@ -669,22 +669,22 @@ void Viewthing::ToggleAnimateEvent
case 0:
SetFrame();
gi.Printf( "Animation stopped.\n" );
gi.Cvar_Set( "viewmodelanimmode", "Stopped" );
gi.cvar_set( "viewmodelanimmode", "Stopped" );
break;
case 1:
NewAnim( CurrentAnim() );
gi.Printf( "Animation no motion.\n" );
gi.Cvar_Set( "viewmodelanimmode", "No Motion" );
gi.cvar_set( "viewmodelanimmode", "No Motion" );
break;
case 2:
NewAnim( CurrentAnim(), EV_ViewThing_LastFrame );
gi.Printf( "Animation with motion and looping.\n" );
gi.Cvar_Set( "viewmodelanimmode", "Motion and Looping" );
gi.cvar_set( "viewmodelanimmode", "Motion and Looping" );
break;
case 3:
NewAnim( CurrentAnim(), EV_ViewThing_LastFrame );
gi.Printf( "Animation with motion no looping.\n" );
gi.Cvar_Set( "viewmodelanimmode", "Motion and No Looping" );
gi.cvar_set( "viewmodelanimmode", "Motion and No Looping" );
break;
}
UpdateCvars( qtrue );

View file

@ -4139,7 +4139,7 @@ void Weapon::SetMeansOfDeath(Event *ev)
{
assert((firemodeindex >= 0) && (firemodeindex < MAX_FIREMODES));
meansofdeath[firemodeindex] = (meansOfDeath_t)MOD_NameToNum(ev->GetString(1));
meansofdeath[firemodeindex] = (meansOfDeath_t)MOD_string_to_int(ev->GetString(1));
}
//======================

View file

@ -309,7 +309,7 @@ protected:
void SetCurrentFireAnim(Event *ev);
void SetSecondaryAmmoInHud(Event* ev);
//====
virtual void ShowInfo(float fDot, float fDist);
void ShowInfo(float fDot, float fDist) override;
public:
CLASS_PROTOTYPE(Weapon);

View file

@ -1284,7 +1284,7 @@ void Projectile::SetMeansOfDeath
)
{
meansofdeath = (meansOfDeath_t )MOD_NameToNum( ev->GetString( 1 ) );
meansofdeath = (meansOfDeath_t )MOD_string_to_int( ev->GetString( 1 ) );
}
void Projectile::DoDecal
@ -1352,7 +1352,7 @@ void Projectile::Touch
return;
}
if( level.impact_trace.surfaceFlags & CONTENTS_WATER || ( gi.PointContents( level.impact_trace.endpos, 0 ) & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) )
if( level.impact_trace.surfaceFlags & CONTENTS_WATER || ( gi.pointcontents( level.impact_trace.endpos, 0 ) & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) )
{
if( bouncesound_water.length() )
this->Sound( bouncesound_water, CHAN_BODY );
@ -3493,3 +3493,52 @@ void FlashPlayers
}
}
const char *G_LocationNumToDispString(int iLocation)
{
switch (iLocation) {
case -2:
case -1:
return "";
case 0:
return "head";
case 1:
return "helmet";
case 2:
return "neck";
case 3:
return "upper torso";
case 4:
return "middle torso";
case 5:
return "lower torso";
case 6:
return "pelvis";
case 7:
return "upper right arm";
case 8:
return "upper left arm";
case 9:
return "upper right leg";
case 10:
return "upper left leg";
case 11:
return "lower right arm";
case 12:
return "lower left arm";
case 13:
return "lower right leg";
case 14:
return "lower left leg";
case 15:
return "right hand";
case 16:
return "left hand";
case 17:
return "right foot";
case 18:
return "left foot";
default:
return "";
}
}

View file

@ -349,6 +349,7 @@ void RadiusDamage
bool hurtOwnerOnly = false
);
const char* G_LocationNumToDispString(int iLocation);
Entity* FindDefusableObject(const Vector& dir, Entity* owner, float maxdist);
void DefuseObject(const Vector& dir, Entity* owner, float maxdist);
qboolean CanPlaceLandmine(const Vector& origin, Entity* owner);

View file

@ -417,7 +417,7 @@ World::World()
ChangeSoundtrack( "" );
// set the default gravity
gi.Cvar_Set( "sv_gravity", "800" );
gi.cvar_set( "sv_gravity", "800" );
// set the default farplane parameters
farplane_distance = 0;
@ -453,9 +453,9 @@ World::World()
level.cinematic = spawnflags & WORLD_CINEMATIC;
if( level.cinematic )
gi.Cvar_Set( "sv_cinematic", "1" );
gi.cvar_set( "sv_cinematic", "1" );
else
gi.Cvar_Set( "sv_cinematic", "0" );
gi.cvar_set( "sv_cinematic", "0" );
level.nextmap = "";
level.level_name = level.mapname;
@ -481,17 +481,17 @@ void World::UpdateConfigStrings( void )
//
// make some data visible to connecting client
//
gi.SetConfigstring( CS_GAME_VERSION, GAME_VERSION );
gi.SetConfigstring( CS_LEVEL_START_TIME, va( "%i", level.svsStartTime ) );
gi.setConfigstring( CS_GAME_VERSION, GAME_VERSION );
gi.setConfigstring( CS_LEVEL_START_TIME, va( "%i", level.svsStartTime ) );
// make some data visible to the server
gi.SetConfigstring( CS_MESSAGE, level.level_name.c_str() );
gi.setConfigstring( CS_MESSAGE, level.level_name.c_str() );
};
void World::UpdateSky( void )
{
gi.SetSkyPortal( sky_portal );
gi.SetConfigstring( CS_SKYINFO, va( "%.4f %d", sky_alpha, sky_portal ) );
gi.setConfigstring( CS_SKYINFO, va( "%.4f %d", sky_alpha, sky_portal ) );
}
void World::SetSoundtrack( Event *ev )
@ -504,7 +504,7 @@ void World::SetSoundtrack( Event *ev )
void World::SetGravity( Event *ev )
{
gi.Cvar_Set( "sv_gravity", ev->GetString( 1 ) );
gi.cvar_set( "sv_gravity", ev->GetString( 1 ) );
}
void World::SetFarPlane( Event *ev )
@ -548,7 +548,7 @@ void World::SetMessage( Event *ev )
text = ev->GetString( 1 );
level.level_name = text;
gi.SetConfigstring( CS_MESSAGE, text );
gi.setConfigstring( CS_MESSAGE, text );
}
void World::SetWaterColor( Event *ev )
@ -608,7 +608,7 @@ void World::UpdateFog(void)
);
}
gi.SetConfigstring(CS_FOGINFO, fogInfoString);
gi.setConfigstring(CS_FOGINFO, fogInfoString);
}
CLASS_DECLARATION( Entity, World, "worldspawn" )

View file

@ -4655,32 +4655,3 @@ CLASS_DECLARATION( Class, Listener, NULL )
#endif
{ NULL, NULL }
};
qboolean IsNumeric( const char *str )
{
size_t len;
size_t i;
qboolean dot;
if( *str == '-' )
{
str++;
}
dot = qfalse;
len = strlen( str );
for( i = 0; i < len; i++ )
{
if( !isdigit( str[ i ] ) )
{
if( ( str[ i ] == '.' ) && !dot )
{
dot = qtrue;
continue;
}
return qfalse;
}
}
return qtrue;
}

View file

@ -77,6 +77,29 @@ static char eaxmodes[ eax_totalnumber ][ 16 ] =
"psychotic"
};
float vectoyaw(const vec3_t vec)
{
float yaw;
if (vec[YAW] == 0 && vec[PITCH] == 0) {
yaw = 0;
}
else {
//if (vec[PITCH]) {
yaw = (atan2(vec[YAW], vec[PITCH]) * 180 / M_PI);
//} else if (vec[YAW] > 0) {
// yaw = 90;
//} else {
// yaw = 270;
//}
if (yaw < 0) {
yaw += 360;
}
}
return yaw;
}
/*
=================
MusicMood_NameToNum

View file

@ -1240,6 +1240,7 @@ void Com_TruncateLongString( char *buffer, const char *s );
//=============================================
float vectoyaw(const vec3_t vec);
int MusicMood_NameToNum( const char * name );
const char * MusicMood_NumToName( int num );
int EAXMode_NameToNum( const char * name );

View file

@ -1503,23 +1503,23 @@ void SV_InitGameProgs( void ) {
import.SetBroadcastHearable = MSG_SetBroadcastHearable;
import.SetBroadcastAll = MSG_SetBroadcastAll;
import.LinkEntity = SV_LinkEntity;
import.UnlinkEntity = SV_UnlinkEntity;
import.linkentity = SV_LinkEntity;
import.unlinkentity = SV_UnlinkEntity;
import.AreaEntities = SV_AreaEntities;
import.SightTraceEntity = SV_SightTraceEntity;
import.SightTrace = SV_SightTrace;
import.Trace = SV_Trace;
import.trace = SV_Trace;
import.GetShader = SV_GetShaderPointer;
import.PointContents = SV_PointContents;
import.pointcontents = SV_PointContents;
import.PointBrushnum = CM_PointBrushNum;
import.SetBrushModel = SV_SetBrushModel;
import.ModelBoundsFromName = CM_ModelBoundsFromName;
import.ClipToEntity = SV_ClipToEntity;
import.HitEntity = SV_HitEntity;
import.SetConfigstring = SV_SetConfigstring;
import.GetConfigstring = SV_GetConfigstring;
import.setConfigstring = SV_SetConfigstring;
import.getConfigstring = SV_GetConfigstring;
import.GetUserinfo = SV_GetUserinfo;
import.SetUserinfo = SV_SetUserinfo;
@ -1527,7 +1527,7 @@ void SV_InitGameProgs( void ) {
import.Free = SV_Free;
import.Cvar_Get = Cvar_Get;
import.Cvar_Set = Cvar_Set;
import.cvar_set = Cvar_Set;
import.cvar_set2 = Cvar_Set2;
import.NextCvar = Cvar_Next;

View file

@ -614,7 +614,7 @@ void SV_CalcPings( void ) {
cl->ping = 999;
continue;
}
if ( cl->gentity->r.svFlags & SVF_BOT ) {
if ( cl->gentity->r.svFlags & SVF_MONSTER ) {
cl->ping = 0;
continue;
}

View file

@ -606,7 +606,7 @@ void SV_SendClientSnapshot( client_t *client ) {
// bots need to have their snapshots build, but
// the query them directly without needing to be sent
if ( client->gentity && client->gentity->r.svFlags & SVF_BOT ) {
if ( client->gentity && client->gentity->r.svFlags & SVF_MONSTER ) {
return;
}