cleanup g_svcmds.c, g_syscalls.c, g_target.c

This commit is contained in:
Walter Julius Hennecke 2012-11-12 22:02:07 +01:00
parent e2039624a1
commit 24a1b7c062
3 changed files with 25 additions and 128 deletions

View file

@ -34,10 +34,6 @@ If 0, then only addresses matching the list will be allowed. This lets you easi
==============================================================================
*/
// extern vmCvar_t g_banIPs;
// extern vmCvar_t g_filterBan;
typedef struct ipFilter_s
{
unsigned mask;
@ -163,11 +159,11 @@ qboolean G_FilterPacket (char *from)
{
if ( (in & ipFilters[i].mask) == ipFilters[i].compare)
{
return g_filterBan.integer != 0;
return (qboolean)(g_filterBan.integer != 0);
}
}
return g_filterBan.integer == 0;
return (qboolean)(g_filterBan.integer == 0);
}
/*
@ -325,9 +321,6 @@ static void AddID( idFilter_t *id )
numIDFilters++;
}
//idFilters[i].playerID = id->playerID;
//idFilters[i].playerName = id->playerName;
//idFilters[i].banReason = id->banReason;
memcpy( &idFilters[i], id, sizeof( idFilter_t ) );
}
@ -431,7 +424,6 @@ void Svcmd_BanUser_f( void )
//Get player name and clean it of color tags
Q_strncpyz( id.playerName, Q_CleanStr(Info_ValueForKey( userInfo, "name" )), sizeof( id.playerName ) );
//( Info_ValueForKey( userInfo, "name" ), id.playerName, sizeof( id.playerName ) );
//get ban reason
trap_Argv( 2, id.banReason, sizeof( id.banReason ) );
@ -445,8 +437,6 @@ void Svcmd_BanUser_f( void )
UpdateIDBans();
//G_Printf( S_COLOR_RED "%s\n", ip );
//Scooter's filter list
if( Q_stricmp( ip, "localhost" ) //localhost
&& Q_strncmp( ip, "10.", 3 ) //class A
@ -622,7 +612,6 @@ void Svcmd_EntityList_f (void) {
gentity_t *check;
char arg[MAX_QPATH*4];
int length = 0;
//int numArgs;
if(trap_Argc() > 1) {
trap_Argv(1, arg, sizeof(arg));
@ -809,15 +798,9 @@ ConsoleCommand
*/
qboolean ConsoleCommand( void ) { //void
char cmd[MAX_TOKEN_CHARS];
//gentity_t *ent;
trap_Argv( 0, cmd, sizeof( cmd ) );
/*if ( Q_stricmp (cmd, "kick2") == 0 ) {
Svcmd_Kick2_f();
return qtrue;
}*/
#ifdef G_LUA
if(Q_stricmp(cmd, "lua_status") == 0)
{

View file

@ -11,13 +11,6 @@ void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
syscall = syscallptr;
}
/*static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
syscall = syscallptr;
}*/
int PASSFLOAT( float x ) {
float floatTemp;
floatTemp = x;
@ -231,7 +224,7 @@ int trap_BotLibLoadMap(const char *mapname) {
return syscall( BOTLIB_LOAD_MAP, mapname );
}
int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue) {
int trap_BotLibUpdateEntity(int ent, void *bue) {
return syscall( BOTLIB_UPDATENTITY, ent, bue );
}
@ -251,7 +244,7 @@ void trap_BotUserCommand(int clientNum, usercmd_t *ucmd) {
syscall( BOTLIB_USER_COMMAND, clientNum, ucmd );
}
void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info) {
void trap_AAS_EntityInfo(int entnum, void *info) {
syscall( BOTLIB_AAS_ENTITY_INFO, entnum, info );
}
@ -313,7 +306,7 @@ int trap_AAS_Swimming(vec3_t origin) {
return syscall( BOTLIB_AAS_SWIMMING, origin );
}
int trap_AAS_PredictClientMovement(void /* struct aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize) {
int trap_AAS_PredictClientMovement(void *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize) {
return syscall( BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT, move, entnum, origin, presencetype, onground, velocity, cmdmove, cmdframes, maxframes, PASSFLOAT(frametime), stopevent, stopareanum, visualize );
}
@ -425,7 +418,7 @@ void trap_EA_EndRegular(int client, float thinktime) {
syscall( BOTLIB_EA_END_REGULAR, client, PASSFLOAT(thinktime) );
}
void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input) {
void trap_EA_GetInput(int client, float thinktime, void *input) {
syscall( BOTLIB_EA_GET_INPUT, client, PASSFLOAT(thinktime), input );
}
@ -481,7 +474,7 @@ void trap_BotRemoveConsoleMessage(int chatstate, int handle) {
syscall( BOTLIB_AI_REMOVE_CONSOLE_MESSAGE, chatstate, handle );
}
int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm) {
int trap_BotNextConsoleMessage(int chatstate, void *cm) {
return syscall( BOTLIB_AI_NEXT_CONSOLE_MESSAGE, chatstate, cm );
}
@ -517,11 +510,11 @@ int trap_StringContains(char *str1, char *str2, int casesensitive) {
return syscall( BOTLIB_AI_STRING_CONTAINS, str1, str2, casesensitive );
}
int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context) {
int trap_BotFindMatch(char *str, void *match, unsigned long int context) {
return syscall( BOTLIB_AI_FIND_MATCH, str, match, context );
}
void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size) {
void trap_BotMatchVariable(void *match, int variable, char *buf, int size) {
syscall( BOTLIB_AI_MATCH_VARIABLE, match, variable, buf, size );
}
@ -557,7 +550,7 @@ void trap_BotRemoveFromAvoidGoals(int goalstate, int number) {
syscall( BOTLIB_AI_REMOVE_FROM_AVOID_GOALS, goalstate, number);
}
void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
void trap_BotPushGoal(int goalstate, void *goal) {
syscall( BOTLIB_AI_PUSH_GOAL, goalstate, goal );
}
@ -581,11 +574,11 @@ void trap_BotGoalName(int number, char *name, int size) {
syscall( BOTLIB_AI_GOAL_NAME, number, name, size );
}
int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
int trap_BotGetTopGoal(int goalstate, void *goal) {
return syscall( BOTLIB_AI_GET_TOP_GOAL, goalstate, goal );
}
int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
int trap_BotGetSecondGoal(int goalstate, void *goal) {
return syscall( BOTLIB_AI_GET_SECOND_GOAL, goalstate, goal );
}
@ -593,27 +586,27 @@ int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int trav
return syscall( BOTLIB_AI_CHOOSE_LTG_ITEM, goalstate, origin, inventory, travelflags, botRoamsOnly );
}
int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime, qboolean botRoamsOnly) {
int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void *ltg, float maxtime, qboolean botRoamsOnly) {
return syscall( BOTLIB_AI_CHOOSE_NBG_ITEM, goalstate, origin, inventory, travelflags, ltg, PASSFLOAT(maxtime), botRoamsOnly );
}
int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal) {
int trap_BotTouchingGoal(vec3_t origin, void *goal) {
return syscall( BOTLIB_AI_TOUCHING_GOAL, origin, goal );
}
int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal) {
int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void *goal) {
return syscall( BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE, viewer, eye, viewangles, goal );
}
int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal) {
int trap_BotGetLevelItemGoal(int index, char *classname, void *goal) {
return syscall( BOTLIB_AI_GET_LEVEL_ITEM_GOAL, index, classname, goal );
}
int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal) {
int trap_BotGetNextCampSpotGoal(int num, void *goal) {
return syscall( BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL, num, goal );
}
int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal) {
int trap_BotGetMapLocationGoal(char *name, void *goal) {
return syscall( BOTLIB_AI_GET_MAP_LOCATION_GOAL, name, goal );
}
@ -663,7 +656,7 @@ void trap_BotResetMoveState(int movestate) {
syscall( BOTLIB_AI_RESET_MOVE_STATE, movestate );
}
void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags) {
void trap_BotMoveToGoal(void *result, int movestate, void *goal, int travelflags) {
syscall( BOTLIB_AI_MOVE_TO_GOAL, result, movestate, goal, travelflags );
}
@ -683,11 +676,11 @@ int trap_BotReachabilityArea(vec3_t origin, int testground) {
return syscall( BOTLIB_AI_REACHABILITY_AREA, origin, testground );
}
int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target) {
int trap_BotMovementViewTarget(int movestate, void *goal, int travelflags, float lookahead, vec3_t target) {
return syscall( BOTLIB_AI_MOVEMENT_VIEW_TARGET, movestate, goal, travelflags, PASSFLOAT(lookahead), target );
}
int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target) {
int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void *goal, int travelflags, vec3_t target) {
return syscall( BOTLIB_AI_PREDICT_VISIBLE_POSITION, origin, areanum, goal, travelflags, target );
}
@ -699,7 +692,7 @@ void trap_BotFreeMoveState(int handle) {
syscall( BOTLIB_AI_FREE_MOVE_STATE, handle );
}
void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove) {
void trap_BotInitMoveState(int handle, void *initmove) {
syscall( BOTLIB_AI_INIT_MOVE_STATE, handle, initmove );
}
@ -707,7 +700,7 @@ int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory, qboolean mele
return syscall( BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON, weaponstate, inventory, meleeRange );
}
void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo) {
void trap_BotGetWeaponInfo(int weaponstate, int weapon, void *weaponinfo) {
syscall( BOTLIB_AI_GET_WEAPON_INFO, weaponstate, weapon, weaponinfo );
}

View file

@ -34,8 +34,6 @@ void Use_Target_Give( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
continue;
}
}
//Com_Printf( S_COLOR_RED "Final flags: %u\n", (unsigned int)(ent->s.time) );
}
//FIXME: Make the text parsed on load time. saves on resources!!
void SP_target_give( gentity_t *ent )
@ -52,8 +50,6 @@ void SP_target_give( gentity_t *ent )
textPtr = items;
//Com_Printf( S_COLOR_RED "Using the Give! Message is %s\n", textPtr );
COM_BeginParseSession();
while ( 1 )
@ -62,8 +58,6 @@ void SP_target_give( gentity_t *ent )
if ( !token[0] )
break;
//Com_Printf( S_COLOR_RED "Token: %s\n", token );
if ( !Q_stricmpn( token, "|", 1 ) )
continue;
@ -82,8 +76,6 @@ void SP_target_give( gentity_t *ent )
if ( rpg_mapGiveFlags.integer > 0 )
ent->s.time &= rpg_mapGiveFlags.integer;
//Com_Printf( S_COLOR_RED "Final flags: %u\n", (ent->s.time) );
ent->use = Use_Target_Give;
// don't need to send this to clients
@ -103,12 +95,6 @@ void Use_target_remove_powerups( gentity_t *ent, gentity_t *other, gentity_t *ac
return;
}
/*if ( activator->client->ps.powerups[PW_REDFLAG] ) {
Team_ReturnFlag(TEAM_RED);
} else if ( activator->client->ps.powerups[PW_BORG_ADAPT] ) {
Team_ReturnFlag(TEAM_BLUE);
}*/
memset( activator->client->ps.powerups, 0, sizeof( activator->client->ps.powerups ) );
}
@ -457,7 +443,7 @@ void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activa
VectorCopy( tr.endpos, destPoint );
//offset the player's bounding box.
destPoint[2] -= activator->r.mins[2]; //other->r.mins[2];
destPoint[2] -= activator->r.mins[2];
//add 1 to ensure non-direct collision
destPoint[2] += 1;
@ -624,8 +610,6 @@ void SP_target_location( gentity_t *self ){
self->think = target_location_linkup;
self->nextthink = level.time + 200; // Let them all spawn first
//G_Printf( S_COLOR_RED "Location loaded! %s\n", self->message );
G_SetOrigin( self, self->s.origin );
}
@ -859,9 +843,6 @@ When fired every clients monitor will shake as if in an explition //TiM: expliti
void target_shake_use (gentity_t *self, gentity_t *other, gentity_t *activator)
{
//trap_SendConsoleCommand( EXEC_APPEND, va("shake %f %2f HRkq1yF22o06Zng9FZXH5sle\n", self->intensity, self->wait) ); //Start Shaking
//Com_Printf( "Intensity: %f, Duration %i ", self->intensity, ( (int)(level.time - level.startTime) + (int)( self->wait*1000 ) ) ) ;
trap_SetConfigstring( CS_CAMERA_SHAKE, va( "%f %i", self->distance/*was self->intensity*/, ( (int)(level.time - level.startTime) + (int)( self->wait*1000 ) ) ) );
}
@ -961,7 +942,6 @@ static void target_turbolift_endMove ( gentity_t *ent )
{
gentity_t* lights=NULL;
gentity_t* otherLift=NULL;
//gentity_t* tent=NULL;
float f = 0;
otherLift = &g_entities[ent->count];
@ -1347,9 +1327,6 @@ static void target_turbolift_startMove ( gentity_t *ent )
}
if(rpg_calcLiftTravelDuration.integer) {
/*time = ent->health - otherLift->health;
if(time < 0)
time *= -1;*/
ent->s.eventParm = time2;
time *= rpg_liftDurationModifier.value;
time *= 1000;
@ -1473,7 +1450,6 @@ static void target_turbolift_use( gentity_t *self, gentity_t *other, gentity_t *
return;
}
//trap_SendServerCommand( activator-g_entities, va( "lift %i", (int)(self-g_entities) ) );
trap_SendServerCommand( activator-g_entities, "lift" );
}
@ -1533,7 +1509,6 @@ void SP_target_turbolift ( gentity_t *self )
self->s.loopSound = G_SoundIndex( loopSound ); //looping sound
self->s.otherEntityNum2 = G_SoundIndex( endSound ); //End Phase sound
/*self->soundLocked = G_SoundIndex( idleSound );*/
self->n00bCount = G_SoundIndex( idleSound );
self->sound2to1 = G_SoundIndex( startSound );
self->soundPos1 = G_SoundIndex( deactSound );
@ -1802,10 +1777,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
@ -1815,10 +1786,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
@ -1828,10 +1795,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
@ -1868,10 +1831,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
@ -1881,10 +1840,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
@ -1894,10 +1849,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
@ -1934,10 +1885,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
@ -1947,10 +1894,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
@ -1960,10 +1903,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->bluesound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->targetname2;
G_UseTargets(ent, ent);
break;
@ -2000,10 +1939,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->greensound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->truetarget;
G_UseTargets(ent, ent);
break;
@ -2013,10 +1948,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->yellowsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->falsetarget;
G_UseTargets(ent, ent);
break;
@ -2026,10 +1957,6 @@ void target_alert_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
G_UseTargets(ent, ent);
ent->health = !ent->health;
}
/*if(!ent->spawnflags) {
ent->target = ent->redsound;
G_UseTargets(ent, ent);
}*/
ent->target = ent->paintarget;
G_UseTargets(ent, ent);
break;
@ -2153,10 +2080,8 @@ void target_alert_parseShaders(gentity_t *ent) {
}
void SP_target_alert(gentity_t *ent) {
//int errorNum = 0;
//qboolean error = qfalse;
char *temp;
//char *origin = vtos(ent->s.origin);
G_SpawnString("greenname", "", &temp);
ent->swapname = G_NewString(temp);
G_SpawnString("yellowname", "", &temp);
@ -2255,8 +2180,6 @@ void target_warp_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
ent->target = ent->yellowsound;
G_UseTargets(ent, activator);
}
/*ent->target = ent->bluename;
G_UseTargets(ent, ent);*/
for(i = 0; i < MAX_GENTITIES; i++) {
if(!&g_entities[i]) continue;
if(Q_stricmp(g_entities[i].classname, "func_train") && !Q_stricmp(g_entities[i].swapname, ent->bluename)) {
@ -2293,8 +2216,6 @@ void target_warp_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
} else {
target->clipmask = CONTENTS_BODY;
trap_SetBrushModel( target, target->model );
//VectorCopy( ent->s.origin, ent->s.pos.trBase );
//VectorCopy( ent->s.origin, ent->r.currentOrigin );
target->r.svFlags &= ~SVF_NOCLIENT;
target->s.eFlags &= ~EF_NODRAW;
target->clipmask = 0;