Fixes resulting from code analysis

This commit is contained in:
Walter Julius Hennecke 2013-08-28 19:46:05 +02:00
parent 181e463cbf
commit 51430fec77
8 changed files with 602 additions and 1718 deletions

View File

@ -300,6 +300,10 @@ static void Cmd_Give_f( gentity_t *ent ) {
for ( i = bg_numGiveItems - 1; i > -1; i-- ) { for ( i = bg_numGiveItems - 1; i > -1; i-- ) {
item = &bg_giveItem[i]; item = &bg_giveItem[i];
if(item == NULL) {
continue;
}
if ( !Q_stricmp( arg, item->consoleName ) ) { if ( !Q_stricmp( arg, item->consoleName ) ) {
break; break;
} }
@ -317,6 +321,10 @@ static void Cmd_Give_f( gentity_t *ent ) {
//Fuck this. Why does ioEF crash if you don't break a case statement with code in it? :S //Fuck this. Why does ioEF crash if you don't break a case statement with code in it? :S
if(item == NULL) {
return;
}
switch ( item->giveType ) { switch ( item->giveType ) {
case TYPE_ALL: case TYPE_ALL:
targEnt->health = ps->stats[STAT_MAX_HEALTH]; targEnt->health = ps->stats[STAT_MAX_HEALTH];
@ -1566,17 +1574,18 @@ static void Cmd_SayArea( gentity_t *ent, char* text)
OtherPlayer = &g_entities[i]; //Point OtherPlayer to next player OtherPlayer = &g_entities[i]; //Point OtherPlayer to next player
//Send message to admins warning about command being used.
//TiM - since double spamming is annoying, ensure that the target admin wants this alert
if ( !OtherPlayer->client->noAdminChat )
G_SayTo( ent, OtherPlayer, SAY_ADMIN, COLOR_CYAN, va("%s ^7said to area: ", pers->netname ), text ); //^2%s
//Check is OtherPlayer is valid //Check is OtherPlayer is valid
if ( !OtherPlayer || !OtherPlayer->inuse || !OtherPlayer->client ) if ( !OtherPlayer || !OtherPlayer->inuse || !OtherPlayer->client )
{ {
continue; continue;
} }
//Send message to admins warning about command being used.
//TiM - since double spamming is annoying, ensure that the target admin wants this alert
if ( !OtherPlayer->client->noAdminChat )
G_SayTo( ent, OtherPlayer, SAY_ADMIN, COLOR_CYAN, va("%s ^7said to area: ", pers->netname ), text ); //^2%s
//TiM - I have a better solution. the trap_inPVS function lets u see if two points are within the same Vis cluster //TiM - I have a better solution. the trap_inPVS function lets u see if two points are within the same Vis cluster
//in the BSP tree. That should mean as long as they're in the same room, regardless if they can see each other or not, //in the BSP tree. That should mean as long as they're in the same room, regardless if they can see each other or not,
//they'll get the message //they'll get the message
@ -2220,6 +2229,10 @@ static void Cmd_ForceKill_f( gentity_t *ent ) {
} }
} // end iterations } // end iterations
if(target == NULL) {
return;
}
Com_sprintf (send, sizeof(send), "%s ^7forced %s^7's death", ent->client->pers.netname, target->client->pers.netname); Com_sprintf (send, sizeof(send), "%s ^7forced %s^7's death", ent->client->pers.netname, target->client->pers.netname);
for (j = 0; j < MAX_CLIENTS - 1; j++) { for (j = 0; j < MAX_CLIENTS - 1; j++) {
@ -3725,7 +3738,7 @@ static void Cmd_EntList_f ( gentity_t *ent ) {
Com_sprintf( entBuffer, sizeof( entBuffer ), "ClassName: '%s', ID: %i\n", mapEnt->classname, i); Com_sprintf( entBuffer, sizeof( entBuffer ), "ClassName: '%s', ID: %i\n", mapEnt->classname, i);
} }
if ( strlen(mainBuffer) + strlen(entBuffer) > sizeof( mainBuffer ) ) { if ( strlen(mainBuffer) + strlen(entBuffer) >= sizeof( mainBuffer ) ) {
break; break;
} }
else { else {
@ -5262,7 +5275,7 @@ static void Cmd_MapsList_f( gentity_t *ent )
continue; continue;
} }
if ( strlen(mapList) + len + 20 > sizeof( mapList ) ) if ( strlen(mapList) + len + 20 >= sizeof( mapList ) )
break; break;
Q_strcat( mapList, sizeof( mapList ), filePtr ); Q_strcat( mapList, sizeof( mapList ), filePtr );
@ -5741,15 +5754,15 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
trap_Argv(5, arg8, sizeof(arg8)); trap_Argv(5, arg8, sizeof(arg8));
#ifndef SQL #ifndef SQL
if ( !IsAdmin( ent ) ) { if ( !IsAdmin( ent ) ) {
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ") ); trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ") );
return; return;
} }
#else #else
if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_SMS ) ) { if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_SMS ) ) {
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as a user with the appropiate rights.\n\" ") ); trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as a user with the appropiate rights.\n\" ") );
return; return;
} }
#endif #endif

View File

@ -1113,7 +1113,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if ( client ) if ( client )
{ {
if ( client->noclip ) { if ( client == NULL || client->noclip ) {
return; return;
} }
} }

View File

@ -2621,6 +2621,7 @@ void G_RunThink (gentity_t *ent) {
ent->nextthink = 0; ent->nextthink = 0;
if (!ent->think) { if (!ent->think) {
G_Error ( "NULL ent->think"); G_Error ( "NULL ent->think");
return;
} }
#ifdef G_LUA #ifdef G_LUA

View File

@ -607,10 +607,12 @@ void Svcmd_EntityList_f (void) {
gentity_t *check; gentity_t *check;
char arg[MAX_QPATH*4]; char arg[MAX_QPATH*4];
int length = 0; int length = 0;
qboolean args = qfalse;
if(trap_Argc() > 1) { if(trap_Argc() > 1) {
trap_Argv(1, arg, sizeof(arg)); trap_Argv(1, arg, sizeof(arg));
length = strlen(arg); length = strlen(arg);
args = qtrue;
} }
check = g_entities+1; check = g_entities+1;
@ -618,7 +620,7 @@ void Svcmd_EntityList_f (void) {
if ( !check->inuse ) { if ( !check->inuse ) {
continue; continue;
} }
if(!arg[0]) { if(args == qfalse) {
if ( check->classname && Q_stricmpn(check->classname, "noclass", 7) && Q_stricmpn(check->classname, "bodyque", 7) ) { if ( check->classname && Q_stricmpn(check->classname, "noclass", 7) && Q_stricmpn(check->classname, "bodyque", 7) ) {
G_Printf("%3i:", e); G_Printf("%3i:", e);
switch ( check->s.eType ) { switch ( check->s.eType ) {

View File

@ -480,11 +480,11 @@ The activator will be instantly teleported away.
-----SPAWNFLAGS----- -----SPAWNFLAGS-----
1: VISUAL_FX - Instead of instant teleportation with no FX, entity will play the Star Trek style 1: VISUAL_FX - Instead of instant teleportation with no FX, entity will play the Star Trek style
transporter effect and teleport over the course of an 8 second cycle. transporter effect and teleport over the course of an 8 second cycle.
NB-If using the transporter VISUAL_FX, place the target entity so it's right on top of NB-If using the transporter VISUAL_FX, place the target entity so it's right on top of
the surface you want the player to appear on. It's been hardcoded to take this offset into the surface you want the player to appear on. It's been hardcoded to take this offset into
account only when the VISUAL_FX flag is on account only when the VISUAL_FX flag is on
2: SUSPENDED - Unless this is checked, the player will materialise on top of the first solid surface underneath the entity 2: SUSPENDED - Unless this is checked, the player will materialise on top of the first solid surface underneath the entity
4: DEACTIVATED - Teleporter will be deactiavted at spawn 4: DEACTIVATED - Teleporter will be deactiavted at spawn
@ -634,7 +634,7 @@ none
-----KEYS----- -----KEYS-----
"message" - location name to display. Can be colorized using '^X' where X is one of the following numbers "message" - location name to display. Can be colorized using '^X' where X is one of the following numbers
0:white 1:red 2:green 3:yellow 4:blue 5:cyan 6:magenta 7:white 0:white 1:red 2:green 3:yellow 4:blue 5:cyan 6:magenta 7:white
-----LocEdit----- -----LocEdit-----
target_locations can also be spawned by a <mapname>.locations-file. target_locations can also be spawned by a <mapname>.locations-file.
@ -642,22 +642,22 @@ While creating this was hard work for many years, a new command makes it quite e
There are a few basic commands: There are a few basic commands:
/locedit start <type> /locedit start <type>
This will open the file. This will open the file.
For type set 1 if you'd like to restrict a location so only admins can autorise transportation there. For type set 1 if you'd like to restrict a location so only admins can autorise transportation there.
Else set 0. Else set 0.
For Type = 0: /locedit add "<location-name>" For Type = 0: /locedit add "<location-name>"
For Type = 1: /locedit add <protected> "<location-name>" For Type = 1: /locedit add <protected> "<location-name>"
this will add a new location to the list. this will add a new location to the list.
It will grab your current position as well as your yaw-angle (around the Z-Axis) and dump them to the file with the parameters. It will grab your current position as well as your yaw-angle (around the Z-Axis) and dump them to the file with the parameters.
If you set protected 1 only admins can authorise transportation there. If you set protected 1 only admins can authorise transportation there.
location-name can be colorized as stated above. You need to put it in "". location-name can be colorized as stated above. You need to put it in "".
/locedit nl /locedit nl
this will simply add an empty line. If you have to manually edit the file at a later date this will help you get oriented. this will simply add an empty line. If you have to manually edit the file at a later date this will help you get oriented.
/locedit stop /locedit stop
this will close the file. this will close the file.
*/ */
void SP_target_location( gentity_t *self ){ void SP_target_location( gentity_t *self ){
self->think = target_location_linkup; self->think = target_location_linkup;
@ -1566,7 +1566,7 @@ For the angles, the entity's angle must be aimed at the main set of doors to the
-----KEYS----- -----KEYS-----
"deck" - which deck number this is (You can have multiple lifts of the same deck. Entity fails spawn if not specified) "deck" - which deck number this is (You can have multiple lifts of the same deck. Entity fails spawn if not specified)
"deckName" - name of the main features on this deck (Appears in the deck menu, defaults to 'Unknown') "deckName" - name of the main features on this deck (Appears in the deck menu, defaults to 'Unknown')
use either this or a <mapname>.turbolift-file to store the strings, not both simultainously use either this or a <mapname>.turbolift-file to store the strings, not both simultainously
"wait" - number of seconds to wait until teleporting the players (1000 = 1 second, default 3000) "wait" - number of seconds to wait until teleporting the players (1000 = 1 second, default 3000)
"soundLoop" - looping sound that plays in the wait period (Defaults to EF SP's sound. '*' for none) "soundLoop" - looping sound that plays in the wait period (Defaults to EF SP's sound. '*' for none)
"soundEnd" - sound that plays as the wait period ends. (Defaults to EF SP's sound. '*' for none) "soundEnd" - sound that plays as the wait period ends. (Defaults to EF SP's sound. '*' for none)
@ -1588,42 +1588,42 @@ Turbolifts are a good thing to retrofit, however they have 2 requirements:
If those are fuffilled you can use the following code at level init to set up the turbolift. If those are fuffilled you can use the following code at level init to set up the turbolift.
(this is from enterprise-e-v2 and uses the outdated SetKeyValue-Command. Use Set<key> instead) (this is from enterprise-e-v2 and uses the outdated SetKeyValue-Command. Use Set<key> instead)
game.Print("--Deck 1 ..."); game.Print("--Deck 1 ...");
game.Print("---redirecting usables ..."); game.Print("---redirecting usables ...");
ent = entity.FindBModel(90); ent = entity.FindBModel(90);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
ent = entity.FindBModel(86); ent = entity.FindBModel(86);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
ent = entity.FindBModel(87); ent = entity.FindBModel(87);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
ent = entity.FindBModel(167); ent = entity.FindBModel(167);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
ent = entity.FindBModel(88); ent = entity.FindBModel(88);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
ent = entity.FindBModel(89); ent = entity.FindBModel(89);
ent:SetKeyValue("target", "tld1"); ent:SetKeyValue("target", "tld1");
ent:SetKeyValue("luaUse", "turbosound"); ent:SetKeyValue("luaUse", "turbosound");
game.Print("---renaming doors ..."); game.Print("---renaming doors ...");
ent = entity.FindBModel(7); ent = entity.FindBModel(7);
ent:SetKeyValue("targetname", "tld1doors"); ent:SetKeyValue("targetname", "tld1doors");
ent = entity.FindBModel(8); ent = entity.FindBModel(8);
ent:SetKeyValue("targetname", "tld1doors"); ent:SetKeyValue("targetname", "tld1doors");
game.Print("---Adding turbolift ..."); game.Print("---Adding turbolift ...");
ent = entity.Spawn(); ent = entity.Spawn();
ent.SetupTrigger(ent, 144, 100, 98); ent.SetupTrigger(ent, 144, 100, 98);
ent:SetKeyValue("classname", "target_turbolift"); ent:SetKeyValue("classname", "target_turbolift");
ent:SetKeyValue("targetname", "tld1"); ent:SetKeyValue("targetname", "tld1");
ent:SetKeyValue("target", "tld1doors"); ent:SetKeyValue("target", "tld1doors");
ent:SetKeyValue("health", "1"); ent:SetKeyValue("health", "1");
ent:SetKeyValue("wait", 3000); ent:SetKeyValue("wait", 3000);
entity.CallSpawn(ent); entity.CallSpawn(ent);
mover.SetPosition(ent, -2976, 8028, 887); mover.SetPosition(ent, -2976, 8028, 887);
mover.SetAngles(ent, 0, 270, 0); mover.SetAngles(ent, 0, 270, 0);
Turbolift descriptions have to be added in via <mapname>.turbolift-file. Turbolift descriptions have to be added in via <mapname>.turbolift-file.
@ -1644,6 +1644,10 @@ void SP_target_turbolift ( gentity_t *self )
char mapRoute[MAX_QPATH]; char mapRoute[MAX_QPATH];
char serverInfo[MAX_TOKEN_CHARS]; char serverInfo[MAX_TOKEN_CHARS];
if(self == NULL) {
return;
}
//cache the moving sounds //cache the moving sounds
G_SpawnString( "soundLoop", "sound/movers/plats/turbomove.wav", &loopSound ); G_SpawnString( "soundLoop", "sound/movers/plats/turbomove.wav", &loopSound );
G_SpawnString( "soundEnd", "sound/movers/plats/turbostop.wav", &endSound ); G_SpawnString( "soundEnd", "sound/movers/plats/turbostop.wav", &endSound );
@ -2685,7 +2689,7 @@ void target_selfdestruct_end(gentity_t *ent) {
void target_selfdestruct_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { void target_selfdestruct_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
if( ent->damage - level.time > 50 ){//I'm still sceptical about a few things here, so I'll leave this in place if( ent->damage - level.time > 50 ){//I'm still sceptical about a few things here, so I'll leave this in place
//with the use-function we're going to init aborts in a fairly simple manner: Fire warning notes... //with the use-function we're going to init aborts in a fairly simple manner: Fire warning notes...
trap_SendServerCommand( -1, va("servermsg \"Self Destruct sequence aborted.\"")); trap_SendServerCommand( -1, va("servermsg \"Self Destruct sequence aborted.\""));
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3")); G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3"));
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1)); trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
@ -2702,55 +2706,55 @@ void target_selfdestruct_think(gentity_t *ent) {
int entlist[MAX_GENTITIES]; int entlist[MAX_GENTITIES];
int n = 0, num; int n = 0, num;
//I've reconsidered. Selfdestruct will fire it's death mode no matter what. Targets are for FX-Stuff. //I've reconsidered. Selfdestruct will fire it's death mode no matter what. Targets are for FX-Stuff.
healthEnt = G_Find(NULL, FOFS(classname), "target_shiphealth"); healthEnt = G_Find(NULL, FOFS(classname), "target_shiphealth");
if(healthEnt && G_Find(healthEnt, FOFS(classname), "target_shiphealth") == NULL ){ if(healthEnt && G_Find(healthEnt, FOFS(classname), "target_shiphealth") == NULL ){
healthEnt->damage = healthEnt->health + healthEnt->splashRadius; //let's use the healthent killfunc if we have just one. makes a lot of stuff easier. healthEnt->damage = healthEnt->health + healthEnt->splashRadius; //let's use the healthent killfunc if we have just one. makes a lot of stuff easier.
healthEnt->use(healthEnt, NULL, NULL); healthEnt->use(healthEnt, NULL, NULL);
}else{ }else{
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){ while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
if(!Q_stricmp(safezone->targetname, ent->bluename)) if(!Q_stricmp(safezone->targetname, ent->bluename))
safezone->n00bCount = 0; safezone->n00bCount = 0;
} }
safezone = NULL; safezone = NULL;
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){ while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
// go through all safe zones and tag all safe players // go through all safe zones and tag all safe players
if(safezone->count == 1 && safezone->n00bCount == 1 && Q_stricmp(safezone->targetname, ent->bluename)) { if(safezone->count == 1 && safezone->n00bCount == 1 && Q_stricmp(safezone->targetname, ent->bluename)) {
num = trap_EntitiesInBox(safezone->r.mins, safezone->r.maxs, entlist, MAX_GENTITIES); num = trap_EntitiesInBox(safezone->r.mins, safezone->r.maxs, entlist, MAX_GENTITIES);
for(n = 0; n < num; n++) { for(n = 0; n < num; n++) {
if(entlist[n] < g_maxclients.integer && g_entities[entlist[n]].client) { if(entlist[n] < g_maxclients.integer && g_entities[entlist[n]].client) {
while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){ while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){
if(client->s.number == entlist[n]) if(client->s.number == entlist[n])
client->client->nokilli = 1; client->client->nokilli = 1;
trap_SendServerCommand( -1, va("print \"SETTING: %i = %i\n\" ", client->s.number, client->client->nokilli) ); trap_SendServerCommand( -1, va("print \"SETTING: %i = %i\n\" ", client->s.number, client->client->nokilli) );
}
} }
} }
} }
} }
client = NULL;
//Loop trough all clients on the server.
while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){
if (client->client->nokilli != 1)
G_Damage (client, ent, ent, 0, 0, 999999, 0, MOD_TRIGGER_HURT); //maybe a new message ala "[Charname] did not abandon ship."
}
//we may go this way once more so clear clients back.
client = NULL;
while((client = G_Find( client, FOFS( classname ), "player" ))){
client->client->nokilli = 0;
}
//let's hear it
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/weapons/explosions/explode2.wav"));
//let's be shakey for a sec... I hope lol ^^
trap_SetConfigstring( CS_CAMERA_SHAKE, va( "%i %i", 9999, ( 1000 + ( level.time - level.startTime ) ) ) );
} }
if(ent->target)
G_UseTargets(ent, ent); client = NULL;
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
G_FreeEntity(ent); //Loop trough all clients on the server.
return; while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){
if (client->client->nokilli != 1)
G_Damage (client, ent, ent, 0, 0, 999999, 0, MOD_TRIGGER_HURT); //maybe a new message ala "[Charname] did not abandon ship."
}
//we may go this way once more so clear clients back.
client = NULL;
while((client = G_Find( client, FOFS( classname ), "player" ))){
client->client->nokilli = 0;
}
//let's hear it
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/weapons/explosions/explode2.wav"));
//let's be shakey for a sec... I hope lol ^^
trap_SetConfigstring( CS_CAMERA_SHAKE, va( "%i %i", 9999, ( 1000 + ( level.time - level.startTime ) ) ) );
}
if(ent->target)
G_UseTargets(ent, ent);
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
G_FreeEntity(ent);
return;
} }
void SP_target_selfdestruct(gentity_t *ent) { void SP_target_selfdestruct(gentity_t *ent) {
@ -2849,9 +2853,9 @@ Note: Spawnflags will only work with the system they are attached to
"targetname" - used to link with, some types require this for toggling "targetname" - used to link with, some types require this for toggling
"count" - specifies this zone's type: "count" - specifies this zone's type:
0 - none, will free entity 0 - none, will free entity
1 - safezone for target_selfdestruct and target_shiphealth 1 - safezone for target_selfdestruct and target_shiphealth
2 - display zone for target_shiphealth (HUD overlay) 2 - display zone for target_shiphealth (HUD overlay)
-----USAGE----- -----USAGE-----
As safezone: As safezone:
@ -2988,26 +2992,26 @@ In that file add the following short script:
gfx/msd/akira //this will be the path to the image for the UI gfx/msd/akira //this will be the path to the image for the UI
{ {
{ {
map textures/msd/akira.jpg //this will be the image you will use map textures/msd/akira.jpg //this will be the image you will use
blendFunc add //this will remove the black background. I might find a better solution... blendFunc add //this will remove the black background. I might find a better solution...
} }
} }
textures/msd/akira //this will be the image you will use for texturing textures/msd/akira //this will be the image you will use for texturing
{ {
surfaceparm nolightmap surfaceparm nolightmap
surfaceparm nomarks surfaceparm nomarks
{ {
map textures/msd/akira.jpg //this will be the image you will use map textures/msd/akira.jpg //this will be the image you will use
} }
{ {
map textures/engineering/glass1.tga //this segment creates the glass effect to make it look like a display map textures/engineering/glass1.tga //this segment creates the glass effect to make it look like a display
blendfunc gl_one gl_one_minus_src_color blendfunc gl_one gl_one_minus_src_color
rgbGen identity rgbGen identity
tcMod scale 3 3 tcMod scale 3 3
tcGen environment tcGen environment
} }
} }
For distribution put both files (including their relative paths) in a *.pk3 file. For distribution put both files (including their relative paths) in a *.pk3 file.
@ -3086,8 +3090,8 @@ void target_shiphealth_use(gentity_t *ent, gentity_t *other, gentity_t *activato
} else { //shields are off, guess where the blow goes... } else { //shields are off, guess where the blow goes...
NHS = (ent->count - ent->damage); NHS = (ent->count - ent->damage);
} }
ent->count = NHS; ent->count = NHS;
ent->damage = 0; ent->damage = 0;
} }
//enough math, let's trigger things //enough math, let's trigger things

View File

@ -364,7 +364,7 @@ void Use_target_push( gentity_t *self, gentity_t *other, gentity_t *activator )
} }
/* RPG-X: J2J noclip use */ /* RPG-X: J2J noclip use */
if ( activator->client->ps.pm_type != PM_NORMAL || activator->client->ps.pm_type != PM_NOCLIP) { if ( (activator->client->ps.pm_type != PM_NORMAL) || (activator->client->ps.pm_type != PM_NOCLIP)) {
return; return;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* Copyright (C) 1999-2000 Id Software, Inc. /* Copyright (C) 1999-2000 Id Software, Inc.
* *
* q_shared.c -- stateless support routines that are included in each code dll * q_shared.c -- stateless support routines that are included in each code dll
*/ */
#include "q_shared.h" #include "q_shared.h"
/*vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work /*vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work
@ -62,10 +62,10 @@ void COM_DefaultExtension (char *path, int maxSize, const char *extension ) {
char oldPath[MAX_QPATH]; char oldPath[MAX_QPATH];
char *src; char *src;
/* /*
* if path doesn't have a .EXT, append extension * if path doesn't have a .EXT, append extension
* (extension should include the .) * (extension should include the .)
*/ */
src = path + strlen(path) - 1; src = path + strlen(path) - 1;
while (*src != '/' && src != path) { while (*src != '/' && src != path) {
@ -82,15 +82,15 @@ void COM_DefaultExtension (char *path, int maxSize, const char *extension ) {
/* /*
============================================================================ ============================================================================
BYTE ORDER FUNCTIONS BYTE ORDER FUNCTIONS
============================================================================ ============================================================================
*/ */
/* /*
*can't just use function pointers, or dll linkage can *can't just use function pointers, or dll linkage can
* mess up when qcommon is included in multiple places * mess up when qcommon is included in multiple places
*/ */
static short (*_BigShort) (short l); static short (*_BigShort) (short l);
static short (*_LittleShort) (short l); static short (*_LittleShort) (short l);
static int (*_BigLong) (int l); static int (*_BigLong) (int l);
@ -101,8 +101,8 @@ static float (*_LittleFloat) (float l);
#ifdef _M_IX86 #ifdef _M_IX86
/* /*
* optimised version for intel stuff... * optimised version for intel stuff...
*/ */
short BigShort(short l){return _BigShort(l);} short BigShort(short l){return _BigShort(l);}
int BigLong (int l) {return _BigLong(l);} int BigLong (int l) {return _BigLong(l);}
float BigFloat (float l) {return _BigFloat(l);} float BigFloat (float l) {return _BigFloat(l);}
@ -111,8 +111,8 @@ float BigFloat (float l) {return _BigFloat(l);}
#define LittleFloat(l) l #define LittleFloat(l) l
#else #else
/* /*
* standard smart byte-swap stuff.... * standard smart byte-swap stuff....
*/ */
short BigShort(short l){return _BigShort(l);} short BigShort(short l){return _BigShort(l);}
short LittleShort(short l) {return _LittleShort(l);} short LittleShort(short l) {return _LittleShort(l);}
int BigLong (int l) {return _BigLong(l);} int BigLong (int l) {return _BigLong(l);}
@ -186,7 +186,7 @@ void Swap_Init (void)
{ {
byte swaptest[2] = {1,0}; byte swaptest[2] = {1,0};
/* set the byte swapping variables in a portable manner */ /* set the byte swapping variables in a portable manner */
if ( *(short *)swaptest == 1) if ( *(short *)swaptest == 1)
{ {
_BigShort = ShortSwap; _BigShort = ShortSwap;
@ -360,7 +360,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
if (len == MAX_TOKEN_CHARS) if (len == MAX_TOKEN_CHARS)
{ {
/* Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS); */ /* Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS); */
len = 0; len = 0;
} }
com_token[len] = 0; com_token[len] = 0;
@ -685,7 +685,7 @@ void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m) {
/* /*
============================================================================ ============================================================================
LIBRARY REPLACEMENT FUNCTIONS LIBRARY REPLACEMENT FUNCTIONS
============================================================================ ============================================================================
*/ */
@ -790,21 +790,21 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) {
} }
strncpy( dest, src, destsize-1 ); strncpy( dest, src, destsize-1 );
dest[destsize-1] = 0; dest[destsize-1] = 0;
} }
int Q_stricmpn (const char *s1, const char *s2, int n) { int Q_stricmpn (const char *s1, const char *s2, int n) {
int c1, c2; int c1, c2;
/* bk001129 - moved in 1.17 fix not in id codebase */ /* bk001129 - moved in 1.17 fix not in id codebase */
if ( s1 == NULL ) { if ( s1 == NULL ) {
if ( s2 == NULL ) if ( s2 == NULL )
return 0; return 0;
else else
return -1; return -1;
} }
else if ( s2==NULL ) else if ( s2==NULL )
return 1; return 1;
@ -857,25 +857,25 @@ int Q_stricmp (const char *s1, const char *s2) {
char *Q_strlwr( char *s1 ) { char *Q_strlwr( char *s1 ) {
char *s; char *s;
s = s1; s = s1;
while ( *s ) { while ( *s ) {
*s = tolower(*s); *s = tolower(*s);
s++; s++;
} }
return s1; return s1;
} }
char *Q_strupr( char *s1 ) { char *Q_strupr( char *s1 ) {
char *s; char *s;
s = s1; s = s1;
while ( *s ) { while ( *s ) {
*s = toupper(*s); *s = toupper(*s);
s++; s++;
} }
return s1; return s1;
} }
/* never goes past bounds or leaves without a terminating 0 */ /* never goes past bounds or leaves without a terminating 0 */
@ -918,6 +918,10 @@ char *Q_CleanStr( char *string ) {
char* s; char* s;
int c; int c;
if(string == NULL) {
return string;
}
s = string; s = string;
d = string; d = string;
while ((c = *s) != 0 ) { while ((c = *s) != 0 ) {
@ -992,7 +996,7 @@ char * QDECL va( char *format, ... ) {
/* /*
===================================================================== =====================================================================
INFO STRINGS INFO STRINGS
===================================================================== =====================================================================
*/ */
@ -1009,7 +1013,7 @@ FIXME: overflow check?
char *Info_ValueForKey( const char *s, const char *key ) { char *Info_ValueForKey( const char *s, const char *key ) {
char pkey[BIG_INFO_KEY]; char pkey[BIG_INFO_KEY];
static char value[2][BIG_INFO_VALUE]; /* use two buffers so compares static char value[2][BIG_INFO_VALUE]; /* use two buffers so compares
work without stomping on each other */ work without stomping on each other */
static int valueindex = 0; static int valueindex = 0;
char *o; char *o;
@ -1346,7 +1350,7 @@ int GetIDForString ( stringID_table_t *table, const char *string )
int index = 0; int index = 0;
while ( ( table[index].name != NULL ) && while ( ( table[index].name != NULL ) &&
( table[index].name[0] != 0 ) ) ( table[index].name[0] != 0 ) )
{ {
if ( !Q_stricmp( table[index].name, string ) ) if ( !Q_stricmp( table[index].name, string ) )
return table[index].id; return table[index].id;
@ -1368,7 +1372,7 @@ const char *GetStringForID( stringID_table_t *table, int id )
int index = 0; int index = 0;
while ( ( table[index].name != NULL ) && while ( ( table[index].name != NULL ) &&
( table[index].name[0] != 0 )/*VALIDSTRING( table[index].name )*/ )/* RPG-X: RedTechie - Compile errors Fixed */ ( table[index].name[0] != 0 )/*VALIDSTRING( table[index].name )*/ )/* RPG-X: RedTechie - Compile errors Fixed */
{ {
if ( table[index].id == id ) if ( table[index].id == id )
return table[index].name; return table[index].name;