mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-03-20 01:21:28 +00:00
Cleanup g_items.c, g_log.c, g_lua.c
This commit is contained in:
parent
5719413ea4
commit
a4344295b9
3 changed files with 8 additions and 256 deletions
|
@ -156,15 +156,6 @@ void Padd_Add( gentity_t *key, gentity_t *who, char *txt )
|
|||
Q_strncpyz( empty->owner, who->client->pers.netname, sizeof( empty->owner ) );
|
||||
|
||||
++paddDataNum;
|
||||
|
||||
|
||||
//Inform admins
|
||||
//for ( i = 0; i < level.maxclients; ++i ) {
|
||||
// gentity_t *player = &g_entities[i];
|
||||
// if ( !player->client->noAdminChat && IsAdmin( player ) && player != who ) {
|
||||
// trap_SendServerCommand( player-g_entities, va("print \"%s" S_COLOR_CYAN" (padd drop) " S_COLOR_WHITE "%s\n\"", who->client->pers.netname, txt ) );
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -391,42 +382,6 @@ int Pickup_Ammo (gentity_t *ent, gentity_t *other)
|
|||
int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
||||
char *msg;
|
||||
|
||||
// Marcin - ammo is constant
|
||||
/*
|
||||
if ( ent->count < 0 ) {
|
||||
quantity = 0; // None for you, sir!
|
||||
} else {
|
||||
if ( ent->count ) {
|
||||
quantity = ent->count;
|
||||
} else {
|
||||
quantity = ent->item->quantity;
|
||||
}
|
||||
|
||||
// dropped items and teamplay weapons always have full ammo
|
||||
if ( ! (ent->flags & FL_DROPPED_ITEM) && g_gametype.integer != GT_TEAM ) {
|
||||
// respawning rules
|
||||
|
||||
// New method: If the player has less than half the minimum, give them the minimum, else add 1/2 the min.
|
||||
|
||||
// drop the quantity if the already have over the minimum
|
||||
if ( other->client->ps.ammo[ ent->item->giTag ] < quantity*0.5 ) {
|
||||
quantity = quantity - other->client->ps.ammo[ ent->item->giTag ];
|
||||
} else {
|
||||
quantity = quantity*0.5; // only add half the value.
|
||||
}
|
||||
|
||||
// Old method: If the player has less than the minimum, give them the minimum, else just add 1.
|
||||
/\*
|
||||
// drop the quantity if the already have over the minimum
|
||||
if ( other->client->ps.ammo[ ent->item->giTag ] < quantity ) {
|
||||
quantity = quantity - other->client->ps.ammo[ ent->item->giTag ];
|
||||
} else {
|
||||
quantity = 1; // only add a single shot
|
||||
}
|
||||
*\/
|
||||
}
|
||||
}
|
||||
*/
|
||||
// add the weapon
|
||||
other->client->ps.stats[STAT_WEAPONS] |= ( 1 << ent->item->giTag );
|
||||
Add_Ammo( other, ent->item->giTag, 1 );
|
||||
|
@ -573,13 +528,6 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
other->client->pressedUse = qtrue;
|
||||
}
|
||||
|
||||
// If ghosted, then end the ghost-ness in favor of the pickup.
|
||||
//RPG-X: RedTechie - Keep ghost all the time
|
||||
/*if (other->client->ps.powerups[PW_GHOST] >= level.time)
|
||||
{
|
||||
other->client->ps.powerups[PW_GHOST] = 0; // Unghost the player. This
|
||||
}*/
|
||||
|
||||
// the same pickup rules are used for client side and server side
|
||||
if ( !BG_CanItemBeGrabbed( &ent->s, &other->client->ps, Max_Weapon(other->client->ps.weapon) )
|
||||
&& IsAdmin( other ) == qfalse )
|
||||
|
@ -751,7 +699,6 @@ gentity_t *LaunchItem( gitem_t *item, gentity_t *who, vec3_t origin, vec3_t velo
|
|||
// cdr
|
||||
|
||||
if ( item->giTag == WP_3 ) {
|
||||
//Q_strncpyz(item->paddMsg, txt, sizeof(item->paddMsg));
|
||||
Padd_Add(dropped, who, txt);
|
||||
}
|
||||
|
||||
|
@ -767,15 +714,6 @@ gentity_t *LaunchItem( gitem_t *item, gentity_t *who, vec3_t origin, vec3_t velo
|
|||
// make the sound call for a dropped flag
|
||||
te = G_TempEntity( dropped->s.pos.trBase, EV_TEAM_SOUND );
|
||||
te->s.eventParm = DROPPED_FLAG_SOUND;
|
||||
/*if (dropped->item->giTag == PW_REDFLAG)
|
||||
{
|
||||
te->s.otherEntityNum = TEAM_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
te->s.otherEntityNum = TEAM_BLUE;
|
||||
}*/
|
||||
|
||||
te->r.svFlags |= SVF_BROADCAST;
|
||||
|
||||
} else { // auto-remove after 30 seconds
|
||||
|
@ -901,12 +839,6 @@ void FinishSpawningItem( gentity_t *ent ) {
|
|||
|
||||
|
||||
Com_Printf("print \"giType %i!\n\"", ent->item->giType);
|
||||
//Commeted out because if statement causes sharing vialation
|
||||
/*if ( ent->item->giType == IT_TEAM )
|
||||
{
|
||||
VectorSet( ent->r.mins, -23, -23, 0 );
|
||||
VectorSet( ent->r.maxs, 23, 23, 47 );
|
||||
}*/
|
||||
|
||||
if ( ent->spawnflags & 1 ) {
|
||||
// suspended
|
||||
|
@ -939,26 +871,6 @@ void FinishSpawningItem( gentity_t *ent ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// powerups don't spawn in for a while
|
||||
|
||||
//Commeted out because if statement causes sharing vialation
|
||||
/* if ( ent->item->giType == IT_POWERUP ) {
|
||||
float respawn;
|
||||
|
||||
#ifdef _DEBUG
|
||||
respawn = 1; // This makes powerups spawn immediately in debug.
|
||||
#else // _DEBUG
|
||||
respawn = 45 + crandom() * 15;
|
||||
#endif // _DEBUG
|
||||
|
||||
ent->s.eFlags |= EF_NODRAW;
|
||||
ent->r.contents = 0;
|
||||
ent->nextthink = level.time + respawn * 1000;
|
||||
ent->think = RespawnItem;
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
trap_LinkEntity (ent);
|
||||
}
|
||||
|
||||
|
@ -987,7 +899,7 @@ qboolean FinishSpawningDetpack( gentity_t *ent, int itemIndex )
|
|||
|
||||
ent->classname = bg_itemlist[itemIndex].classname;
|
||||
ent->r.contents = CONTENTS_CORPSE;//CONTENTS_TRIGGER;
|
||||
ent->takedamage = 1;
|
||||
ent->takedamage = qtrue;
|
||||
ent->health = 5;
|
||||
ent->touch = 0;
|
||||
ent->die = detpack_shot;
|
||||
|
@ -1034,14 +946,7 @@ qboolean FinishSpawningDecoy( gentity_t *ent, int itemIndex )
|
|||
trace_t tr;
|
||||
vec3_t dest;
|
||||
|
||||
// OLD RADIUS SETTINGS
|
||||
// VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS );
|
||||
// VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS );
|
||||
// ent->s.eType = ET_USEABLE;
|
||||
// ent->s.modelindex = bg_itemlist[itemIndex].giTag; // this'll be used in CG_Useable()
|
||||
|
||||
ent->classname = bg_itemlist[itemIndex].classname;
|
||||
// ent->r.contents = CONTENTS_CORPSE;
|
||||
ent->touch = 0; // null touch function pointer
|
||||
// useing an item causes it to respawn
|
||||
ent->use = Use_Item;
|
||||
|
@ -1115,11 +1020,7 @@ void ClearRegisteredItems( void ) {
|
|||
RegisterItem( BG_FindItemForWeapon( WP_6 ) ); //this is for the podium at the end, make sure we have the model
|
||||
|
||||
RegisterItem( BG_FindItemForWeapon( WP_1 ) );
|
||||
// RegisterItem( BG_FindItemForWeapon( WP_4 ) );
|
||||
RegisterItem( BG_FindItemForWeapon( WP_10 ) );
|
||||
// RegisterItem( BG_FindItemForWeapon( WP_8 ) );
|
||||
// RegisterItem( BG_FindItemForWeapon( WP_7 ) );
|
||||
// RegisterItem( BG_FindItemForWeapon( WP_9 ) );
|
||||
RegisterItem( BG_FindItemForWeapon( WP_13 ) );
|
||||
RegisterItem( BG_FindItemForWeapon( WP_12 ) );
|
||||
RegisterItem( BG_FindItemForWeapon( WP_14 ) );
|
||||
|
@ -1229,7 +1130,6 @@ void G_SpawnItem (gentity_t *ent, gitem_t *item) {
|
|||
{
|
||||
return;
|
||||
}
|
||||
//item = G_CheckReplaceItem( ent, item );
|
||||
|
||||
G_SpawnFloat( "random", "0", &ent->random );
|
||||
G_SpawnFloat( "wait", "0", &ent->wait );
|
||||
|
|
|
@ -912,78 +912,6 @@ void G_LogWeaponOutput(void)
|
|||
#endif //LOGGING_WEAPONS
|
||||
}
|
||||
|
||||
//
|
||||
// kef -- synchronized with ui_local.h
|
||||
//
|
||||
/*
|
||||
typedef enum {
|
||||
AWARD_EFFICIENCY, // Accuracy
|
||||
AWARD_SHARPSHOOTER, // Most compression rifle frags
|
||||
AWARD_UNTOUCHABLE, // Perfect (no deaths)
|
||||
AWARD_LOGISTICS, // Most pickups
|
||||
AWARD_TACTICIAN, // Kills with all weapons
|
||||
AWARD_DEMOLITIONIST, // Most explosive damage kills
|
||||
AWARD_STREAK, // Ace/Expert/Master/Champion
|
||||
AWARD_TEAM, // MVP/Defender/Warrior/Carrier/Interceptor/Bravery
|
||||
AWARD_SECTION31, // All-around god
|
||||
AWARD_MAX
|
||||
} awardType_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TEAM_NONE, // ha ha! you suck!
|
||||
TEAM_MVP, // most overall points
|
||||
TEAM_DEFENDER, // killed the most baddies near your flag
|
||||
TEAM_WARRIOR, // most frags
|
||||
TEAM_CARRIER, // infected the most people with plague
|
||||
TEAM_INTERCEPTOR, // returned your own flag the most
|
||||
TEAM_BRAVERY, // Red Shirt Award (tm). you died more than anybody.
|
||||
TEAM_MAX
|
||||
} teamAward_e;
|
||||
*/
|
||||
|
||||
// did this player earn the efficiency award?
|
||||
/*qboolean CalculateEfficiency(gentity_t *ent, int *efficiency)
|
||||
{
|
||||
#ifdef LOGGING_WEAPONS
|
||||
float fAccuracyRatio = 0, fBestRatio = 0;
|
||||
int i = 0, nShotsFired = 0, nShotsHit = 0, nBestPlayer = -1, tempEff = 0;
|
||||
gentity_t *player = NULL;
|
||||
|
||||
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
player = g_entities + i;
|
||||
if (!player->inuse)
|
||||
continue;
|
||||
nShotsFired = player->client->ps.persistant[PERS_ACCURACY_SHOTS];
|
||||
nShotsHit = player->client->ps.persistant[PERS_ACCURACY_HITS];
|
||||
fAccuracyRatio = ( ((float)nShotsHit)/((float)nShotsFired) );
|
||||
if (fAccuracyRatio > fBestRatio)
|
||||
{
|
||||
fBestRatio = fAccuracyRatio;
|
||||
nBestPlayer = i;
|
||||
}
|
||||
}
|
||||
if (-1 == nBestPlayer)
|
||||
{
|
||||
// huh?
|
||||
return qfalse;
|
||||
}
|
||||
if (nBestPlayer == ent->s.number)
|
||||
{
|
||||
tempEff = (int)(100*fBestRatio);
|
||||
if (tempEff > 50)
|
||||
{
|
||||
*efficiency = tempEff;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
#endif // LOGGING_WEAPONS
|
||||
return qfalse;
|
||||
}*/
|
||||
|
||||
// did this player earn the sharpshooter award?
|
||||
qboolean CalculateSharpshooter(gentity_t *ent, int *frags)
|
||||
{
|
||||
|
@ -1247,22 +1175,7 @@ qboolean CalculateDemolitionist(gentity_t *ent, int *kills)
|
|||
|
||||
int CalculateStreak(gentity_t *ent)
|
||||
{
|
||||
/*if (ent->client->ps.persistant[PERS_STREAK_COUNT] >= STREAK_CHAMPION)
|
||||
{
|
||||
return STREAK_CHAMPION;
|
||||
}
|
||||
if (ent->client->ps.persistant[PERS_STREAK_COUNT] >= STREAK_MASTER)
|
||||
{
|
||||
return STREAK_MASTER;
|
||||
}
|
||||
if (ent->client->ps.persistant[PERS_STREAK_COUNT] >= STREAK_EXPERT)
|
||||
{
|
||||
return STREAK_EXPERT;
|
||||
}
|
||||
if (ent->client->ps.persistant[PERS_STREAK_COUNT] >= STREAK_ACE)
|
||||
{
|
||||
return STREAK_ACE;
|
||||
}*/
|
||||
/* TODO: remove me */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1301,7 +1214,7 @@ qboolean CalculateTeamMVPByRank(gentity_t *ent)
|
|||
playerState_t *ps = &ent->client->ps;
|
||||
int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0,
|
||||
team = ps->persistant[PERS_RANK]+1;
|
||||
qboolean bTied = (team == 3);
|
||||
qboolean bTied = (qboolean)(team == 3);
|
||||
gentity_t *player = NULL;
|
||||
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
|
@ -1341,12 +1254,6 @@ qboolean CalculateTeamDefender(gentity_t *ent)
|
|||
team = ent->client->ps.persistant[PERS_TEAM];
|
||||
gentity_t *player = NULL;
|
||||
|
||||
/*
|
||||
if (CalculateTeamMVP(ent))
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
nScore = 0;
|
||||
|
@ -1377,12 +1284,6 @@ qboolean CalculateTeamWarrior(gentity_t *ent)
|
|||
team = ent->client->ps.persistant[PERS_TEAM];
|
||||
gentity_t *player = NULL;
|
||||
|
||||
/*
|
||||
if (CalculateTeamMVP(ent) || CalculateTeamDefender(ent))
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
nScore = 0;
|
||||
|
@ -1413,12 +1314,6 @@ qboolean CalculateTeamCarrier(gentity_t *ent)
|
|||
team = ent->client->ps.persistant[PERS_TEAM];
|
||||
gentity_t *player = NULL;
|
||||
|
||||
/*
|
||||
if (CalculateTeamMVP(ent) || CalculateTeamDefender(ent) || CalculateTeamWarrior(ent))
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
nScore = 0;
|
||||
|
@ -1449,13 +1344,6 @@ qboolean CalculateTeamInterceptor(gentity_t *ent)
|
|||
team = ent->client->ps.persistant[PERS_TEAM];
|
||||
gentity_t *player = NULL;
|
||||
|
||||
/*
|
||||
if (CalculateTeamMVP(ent) || CalculateTeamDefender(ent) || CalculateTeamWarrior(ent) ||
|
||||
CalculateTeamCarrier(ent))
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
nScore = 0;
|
||||
|
@ -1487,13 +1375,6 @@ qboolean CalculateTeamRedShirt(gentity_t *ent)
|
|||
team = ent->client->ps.persistant[PERS_TEAM];
|
||||
gentity_t *player = NULL;
|
||||
|
||||
/*
|
||||
if (CalculateTeamMVP(ent) || CalculateTeamDefender(ent) || CalculateTeamWarrior(ent) ||
|
||||
CalculateTeamCarrier(ent) || CalculateTeamInterceptor(ent))
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
{
|
||||
nScore = 0;
|
||||
|
@ -1555,7 +1436,7 @@ int CalculateTeamAward(gentity_t *ent)
|
|||
|
||||
qboolean CalculateSection31Award(gentity_t *ent)
|
||||
{
|
||||
int i = 0; //, frags = 0, efficiency = 0;
|
||||
int i = 0;
|
||||
gentity_t *player = NULL;
|
||||
|
||||
for (i = 0; i < g_maxclients.integer; i++)
|
||||
|
@ -1563,21 +1444,7 @@ qboolean CalculateSection31Award(gentity_t *ent)
|
|||
player = g_entities + i;
|
||||
if (!player->inuse)
|
||||
continue;
|
||||
//
|
||||
// kef -- heh.
|
||||
//
|
||||
// if (strcmp("JaxxonPhred", ent->client->pers.netname))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
/*CalculateEfficiency(ent, &efficiency);
|
||||
if (!CalculateSharpshooter(ent, &frags) ||
|
||||
!CalculateUntouchable(ent) ||
|
||||
(CalculateStreak(ent) < STREAK_CHAMPION) ||
|
||||
(efficiency < 75))
|
||||
{
|
||||
continue;
|
||||
}*/
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -1587,15 +1454,10 @@ void CalculateAwards(gentity_t *ent, char *msg)
|
|||
{
|
||||
#ifdef LOGGING_WEAPONS
|
||||
char buf1[AWARDS_MSG_LENGTH], buf2[AWARDS_MSG_LENGTH];
|
||||
int awardFlags = 0, /*efficiency = 0,*/ stuffUsed = 0, kills = 0, streak = 0, teamAwards = 0;
|
||||
int awardFlags = 0, stuffUsed = 0, kills = 0, streak = 0, teamAwards = 0;
|
||||
|
||||
memset(buf1, 0, AWARDS_MSG_LENGTH);
|
||||
memset(buf2, 0, AWARDS_MSG_LENGTH);
|
||||
/*if (CalculateEfficiency(ent, &efficiency))
|
||||
{
|
||||
awardFlags |= (1<<AWARD_EFFICIENCY);
|
||||
Com_sprintf(buf1, AWARDS_MSG_LENGTH, " %d", efficiency);
|
||||
}*/
|
||||
if (CalculateSharpshooter(ent, &kills))
|
||||
{
|
||||
awardFlags |= (1<<AWARD_SHARPSHOOTER);
|
||||
|
@ -1649,7 +1511,6 @@ void CalculateAwards(gentity_t *ent, char *msg)
|
|||
strcpy(buf2, buf1);
|
||||
Com_sprintf(buf1, AWARDS_MSG_LENGTH, "%s %d", buf2, 0);
|
||||
}
|
||||
//strcpy(buf2, msg);
|
||||
Q_strncpyz(buf2, msg, sizeof(buf2));
|
||||
Com_sprintf( msg, AWARDS_MSG_LENGTH, "%s %d%s", buf2, awardFlags, buf1);
|
||||
#endif // LOGGING_WEAPONS
|
||||
|
|
|
@ -64,14 +64,6 @@ qboolean LoadLuaFile(char *path, int num_vm)
|
|||
trap_FS_FCloseFile(f);
|
||||
return qfalse;
|
||||
}
|
||||
/* GSIO01: testing unlimited length for Lua files */
|
||||
/*else if(flen > MAX_FSIZE)
|
||||
{
|
||||
LUA_LOG("Lua: ignoring file %s (too big)\n", path);
|
||||
G_Printf(S_COLOR_YELLOW "Lua: ignoring file %s (too big)\n", path);
|
||||
trap_FS_FCloseFile(f);
|
||||
return qfalse;
|
||||
}*/
|
||||
else
|
||||
{
|
||||
code = (char *)malloc(flen + 1);
|
||||
|
@ -107,13 +99,12 @@ qboolean LoadLuaFile(char *path, int num_vm)
|
|||
return qtrue;
|
||||
}
|
||||
}
|
||||
//return qfalse;
|
||||
}
|
||||
|
||||
qboolean G_LuaInit()
|
||||
{
|
||||
int i, /*len,*/ num_vm = 0;
|
||||
char buff[128]; //, *crt;
|
||||
int i, num_vm = 0;
|
||||
char buff[128];
|
||||
|
||||
int numdirs;
|
||||
int numFiles;
|
||||
|
|
Loading…
Reference in a new issue