mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-03-13 22:23:04 +00:00
Fixes resulting from code analysis
This commit is contained in:
parent
181e463cbf
commit
51430fec77
8 changed files with 602 additions and 1718 deletions
|
@ -300,6 +300,10 @@ static void Cmd_Give_f( gentity_t *ent ) {
|
|||
for ( i = bg_numGiveItems - 1; i > -1; i-- ) {
|
||||
item = &bg_giveItem[i];
|
||||
|
||||
if(item == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Q_stricmp( arg, item->consoleName ) ) {
|
||||
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
|
||||
|
||||
if(item == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( item->giveType ) {
|
||||
case TYPE_ALL:
|
||||
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
|
||||
|
||||
//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
|
||||
if ( !OtherPlayer || !OtherPlayer->inuse || !OtherPlayer->client )
|
||||
{
|
||||
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
|
||||
//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
|
||||
|
@ -2220,6 +2229,10 @@ static void Cmd_ForceKill_f( gentity_t *ent ) {
|
|||
}
|
||||
} // 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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if ( strlen(mainBuffer) + strlen(entBuffer) > sizeof( mainBuffer ) ) {
|
||||
if ( strlen(mainBuffer) + strlen(entBuffer) >= sizeof( mainBuffer ) ) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
@ -5262,7 +5275,7 @@ static void Cmd_MapsList_f( gentity_t *ent )
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( strlen(mapList) + len + 20 > sizeof( mapList ) )
|
||||
if ( strlen(mapList) + len + 20 >= sizeof( mapList ) )
|
||||
break;
|
||||
|
||||
Q_strcat( mapList, sizeof( mapList ), filePtr );
|
||||
|
@ -5741,15 +5754,15 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
|
|||
trap_Argv(5, arg8, sizeof(arg8));
|
||||
|
||||
#ifndef SQL
|
||||
if ( !IsAdmin( ent ) ) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ") );
|
||||
return;
|
||||
}
|
||||
if ( !IsAdmin( ent ) ) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ") );
|
||||
return;
|
||||
}
|
||||
#else
|
||||
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\" ") );
|
||||
return;
|
||||
}
|
||||
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\" ") );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -5787,7 +5800,7 @@ static void Cmd_selfdestruct_f(gentity_t *ent) {
|
|||
else
|
||||
G_CallSpawn(destructEnt);
|
||||
return;
|
||||
|
||||
|
||||
} else if (!Q_stricmp(arg, "remaining")) {
|
||||
//Is there sth running alrerady?
|
||||
destructEnt = G_Find(NULL, FOFS(classname), "target_selfdestruct");
|
||||
|
@ -6009,7 +6022,7 @@ static void Cmd_reloadtorpedos_f(gentity_t *ent) {
|
|||
G_PrintfClient(ent, "^1ERROR: amount must not be less than -2, aborting call.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!G_Find(NULL, FOFS(classname), "fx_torpedo")){
|
||||
trap_SendServerCommand( ent-g_entities, "print \"^4This map does not support the fx_torpedo system.\n\"" );
|
||||
return;
|
||||
|
|
|
@ -1113,7 +1113,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
|
|||
|
||||
if ( client )
|
||||
{
|
||||
if ( client->noclip ) {
|
||||
if ( client == NULL || client->noclip ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2621,6 +2621,7 @@ void G_RunThink (gentity_t *ent) {
|
|||
ent->nextthink = 0;
|
||||
if (!ent->think) {
|
||||
G_Error ( "NULL ent->think");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G_LUA
|
||||
|
|
|
@ -607,10 +607,12 @@ void Svcmd_EntityList_f (void) {
|
|||
gentity_t *check;
|
||||
char arg[MAX_QPATH*4];
|
||||
int length = 0;
|
||||
qboolean args = qfalse;
|
||||
|
||||
if(trap_Argc() > 1) {
|
||||
trap_Argv(1, arg, sizeof(arg));
|
||||
length = strlen(arg);
|
||||
args = qtrue;
|
||||
}
|
||||
|
||||
check = g_entities+1;
|
||||
|
@ -618,7 +620,7 @@ void Svcmd_EntityList_f (void) {
|
|||
if ( !check->inuse ) {
|
||||
continue;
|
||||
}
|
||||
if(!arg[0]) {
|
||||
if(args == qfalse) {
|
||||
if ( check->classname && Q_stricmpn(check->classname, "noclass", 7) && Q_stricmpn(check->classname, "bodyque", 7) ) {
|
||||
G_Printf("%3i:", e);
|
||||
switch ( check->s.eType ) {
|
||||
|
|
|
@ -480,12 +480,12 @@ The activator will be instantly teleported away.
|
|||
|
||||
-----SPAWNFLAGS-----
|
||||
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.
|
||||
|
||||
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
|
||||
account only when the VISUAL_FX flag is on
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
@ -634,7 +634,7 @@ none
|
|||
|
||||
-----KEYS-----
|
||||
"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-----
|
||||
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:
|
||||
/locedit start <type>
|
||||
This will open the file.
|
||||
For type set 1 if you'd like to restrict a location so only admins can autorise transportation there.
|
||||
Else set 0.
|
||||
This will open the file.
|
||||
For type set 1 if you'd like to restrict a location so only admins can autorise transportation there.
|
||||
Else set 0.
|
||||
|
||||
For Type = 0: /locedit add "<location-name>"
|
||||
For Type = 1: /locedit add <protected> "<location-name>"
|
||||
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.
|
||||
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 "".
|
||||
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.
|
||||
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 "".
|
||||
|
||||
/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
|
||||
this will close the file.
|
||||
this will close the file.
|
||||
*/
|
||||
void SP_target_location( gentity_t *self ){
|
||||
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-----
|
||||
"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')
|
||||
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)
|
||||
"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)
|
||||
|
@ -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.
|
||||
(this is from enterprise-e-v2 and uses the outdated SetKeyValue-Command. Use Set<key> instead)
|
||||
|
||||
game.Print("--Deck 1 ...");
|
||||
game.Print("---redirecting usables ...");
|
||||
ent = entity.FindBModel(90);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(86);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(87);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(167);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(88);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(89);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
game.Print("---renaming doors ...");
|
||||
ent = entity.FindBModel(7);
|
||||
ent:SetKeyValue("targetname", "tld1doors");
|
||||
ent = entity.FindBModel(8);
|
||||
ent:SetKeyValue("targetname", "tld1doors");
|
||||
game.Print("---Adding turbolift ...");
|
||||
ent = entity.Spawn();
|
||||
ent.SetupTrigger(ent, 144, 100, 98);
|
||||
ent:SetKeyValue("classname", "target_turbolift");
|
||||
ent:SetKeyValue("targetname", "tld1");
|
||||
ent:SetKeyValue("target", "tld1doors");
|
||||
ent:SetKeyValue("health", "1");
|
||||
ent:SetKeyValue("wait", 3000);
|
||||
entity.CallSpawn(ent);
|
||||
mover.SetPosition(ent, -2976, 8028, 887);
|
||||
mover.SetAngles(ent, 0, 270, 0);
|
||||
game.Print("--Deck 1 ...");
|
||||
game.Print("---redirecting usables ...");
|
||||
ent = entity.FindBModel(90);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(86);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(87);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(167);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(88);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
ent = entity.FindBModel(89);
|
||||
ent:SetKeyValue("target", "tld1");
|
||||
ent:SetKeyValue("luaUse", "turbosound");
|
||||
game.Print("---renaming doors ...");
|
||||
ent = entity.FindBModel(7);
|
||||
ent:SetKeyValue("targetname", "tld1doors");
|
||||
ent = entity.FindBModel(8);
|
||||
ent:SetKeyValue("targetname", "tld1doors");
|
||||
game.Print("---Adding turbolift ...");
|
||||
ent = entity.Spawn();
|
||||
ent.SetupTrigger(ent, 144, 100, 98);
|
||||
ent:SetKeyValue("classname", "target_turbolift");
|
||||
ent:SetKeyValue("targetname", "tld1");
|
||||
ent:SetKeyValue("target", "tld1doors");
|
||||
ent:SetKeyValue("health", "1");
|
||||
ent:SetKeyValue("wait", 3000);
|
||||
entity.CallSpawn(ent);
|
||||
mover.SetPosition(ent, -2976, 8028, 887);
|
||||
mover.SetAngles(ent, 0, 270, 0);
|
||||
|
||||
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 serverInfo[MAX_TOKEN_CHARS];
|
||||
|
||||
if(self == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
//cache the moving sounds
|
||||
G_SpawnString( "soundLoop", "sound/movers/plats/turbomove.wav", &loopSound );
|
||||
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) {
|
||||
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.\""));
|
||||
G_AddEvent(ent, EV_GLOBAL_SOUND, G_SoundIndex("sound/voice/selfdestruct/abort.mp3"));
|
||||
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
|
||||
|
@ -2702,55 +2706,55 @@ void target_selfdestruct_think(gentity_t *ent) {
|
|||
int entlist[MAX_GENTITIES];
|
||||
int n = 0, num;
|
||||
|
||||
//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");
|
||||
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->use(healthEnt, NULL, NULL);
|
||||
}else{
|
||||
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
|
||||
if(!Q_stricmp(safezone->targetname, ent->bluename))
|
||||
safezone->n00bCount = 0;
|
||||
}
|
||||
safezone = NULL;
|
||||
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
|
||||
// go through all safe zones and tag all safe players
|
||||
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);
|
||||
for(n = 0; n < num; n++) {
|
||||
if(entlist[n] < g_maxclients.integer && g_entities[entlist[n]].client) {
|
||||
while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){
|
||||
if(client->s.number == entlist[n])
|
||||
client->client->nokilli = 1;
|
||||
trap_SendServerCommand( -1, va("print \"SETTING: %i = %i\n\" ", client->s.number, client->client->nokilli) );
|
||||
}
|
||||
//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");
|
||||
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->use(healthEnt, NULL, NULL);
|
||||
}else{
|
||||
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
|
||||
if(!Q_stricmp(safezone->targetname, ent->bluename))
|
||||
safezone->n00bCount = 0;
|
||||
}
|
||||
safezone = NULL;
|
||||
while ((safezone = G_Find( safezone, FOFS( classname ), "target_zone" )) != NULL ){
|
||||
// go through all safe zones and tag all safe players
|
||||
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);
|
||||
for(n = 0; n < num; n++) {
|
||||
if(entlist[n] < g_maxclients.integer && g_entities[entlist[n]].client) {
|
||||
while((client = G_Find( client, FOFS( classname ), "player" ))!= NULL){
|
||||
if(client->s.number == entlist[n])
|
||||
client->client->nokilli = 1;
|
||||
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);
|
||||
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
|
||||
G_FreeEntity(ent);
|
||||
return;
|
||||
|
||||
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);
|
||||
trap_SendServerCommand(-1, va("selfdestructupdate %i", -1));
|
||||
G_FreeEntity(ent);
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
"count" - specifies this zone's type:
|
||||
|
||||
0 - none, will free entity
|
||||
1 - safezone for target_selfdestruct and target_shiphealth
|
||||
2 - display zone for target_shiphealth (HUD overlay)
|
||||
0 - none, will free entity
|
||||
1 - safezone for target_selfdestruct and target_shiphealth
|
||||
2 - display zone for target_shiphealth (HUD overlay)
|
||||
|
||||
-----USAGE-----
|
||||
As safezone:
|
||||
|
@ -2885,7 +2889,7 @@ void SP_target_zone(gentity_t *ent) {
|
|||
ent->count = 1;
|
||||
ent->classname = G_NewString("target_zone");
|
||||
}
|
||||
|
||||
|
||||
if(ent->count == 0) {
|
||||
DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_zone without specified class by it's count-value at %s, removing entity.\n", vtos(ent->s.origin)););
|
||||
G_FreeEntity(ent);
|
||||
|
@ -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
|
||||
{
|
||||
{
|
||||
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...
|
||||
}
|
||||
{
|
||||
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...
|
||||
}
|
||||
}
|
||||
|
||||
textures/msd/akira //this will be the image you will use for texturing
|
||||
{
|
||||
surfaceparm nolightmap
|
||||
surfaceparm nomarks
|
||||
{
|
||||
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
|
||||
blendfunc gl_one gl_one_minus_src_color
|
||||
rgbGen identity
|
||||
tcMod scale 3 3
|
||||
tcGen environment
|
||||
}
|
||||
surfaceparm nolightmap
|
||||
surfaceparm nomarks
|
||||
{
|
||||
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
|
||||
blendfunc gl_one gl_one_minus_src_color
|
||||
rgbGen identity
|
||||
tcMod scale 3 3
|
||||
tcGen environment
|
||||
}
|
||||
}
|
||||
|
||||
For distribution put both files (including their relative paths) in a *.pk3 file.
|
||||
|
@ -3086,10 +3090,10 @@ void target_shiphealth_use(gentity_t *ent, gentity_t *other, gentity_t *activato
|
|||
} else { //shields are off, guess where the blow goes...
|
||||
NHS = (ent->count - ent->damage);
|
||||
}
|
||||
ent->count = NHS;
|
||||
ent->damage = 0;
|
||||
ent->count = NHS;
|
||||
ent->damage = 0;
|
||||
}
|
||||
|
||||
|
||||
//enough math, let's trigger things
|
||||
|
||||
//go to red alert if we are not, this will also activate the shields
|
||||
|
|
|
@ -364,7 +364,7 @@ void Use_target_push( gentity_t *self, gentity_t *other, gentity_t *activator )
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
/* 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"
|
||||
|
||||
/*vmCvar_t rpg_medicsrevive; //RPG-X: RedTechie - To let bg_pmovto work
|
||||
|
@ -29,7 +29,7 @@ COM_SkipPath
|
|||
char *COM_SkipPath (char *pathname)
|
||||
{
|
||||
char *last;
|
||||
|
||||
|
||||
last = pathname;
|
||||
while (*pathname)
|
||||
{
|
||||
|
@ -62,10 +62,10 @@ void COM_DefaultExtension (char *path, int maxSize, const char *extension ) {
|
|||
char oldPath[MAX_QPATH];
|
||||
char *src;
|
||||
|
||||
/*
|
||||
* if path doesn't have a .EXT, append extension
|
||||
* (extension should include the .)
|
||||
*/
|
||||
/*
|
||||
* if path doesn't have a .EXT, append extension
|
||||
* (extension should include the .)
|
||||
*/
|
||||
src = path + strlen(path) - 1;
|
||||
|
||||
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
|
||||
* mess up when qcommon is included in multiple places
|
||||
*/
|
||||
*can't just use function pointers, or dll linkage can
|
||||
* mess up when qcommon is included in multiple places
|
||||
*/
|
||||
static short (*_BigShort) (short l);
|
||||
static short (*_LittleShort) (short l);
|
||||
static int (*_BigLong) (int l);
|
||||
|
@ -101,8 +101,8 @@ static float (*_LittleFloat) (float l);
|
|||
|
||||
#ifdef _M_IX86
|
||||
/*
|
||||
* optimised version for intel stuff...
|
||||
*/
|
||||
* optimised version for intel stuff...
|
||||
*/
|
||||
short BigShort(short l){return _BigShort(l);}
|
||||
int BigLong (int l) {return _BigLong(l);}
|
||||
float BigFloat (float l) {return _BigFloat(l);}
|
||||
|
@ -111,8 +111,8 @@ float BigFloat (float l) {return _BigFloat(l);}
|
|||
#define LittleFloat(l) l
|
||||
#else
|
||||
/*
|
||||
* standard smart byte-swap stuff....
|
||||
*/
|
||||
* standard smart byte-swap stuff....
|
||||
*/
|
||||
short BigShort(short l){return _BigShort(l);}
|
||||
short LittleShort(short l) {return _LittleShort(l);}
|
||||
int BigLong (int l) {return _BigLong(l);}
|
||||
|
@ -162,8 +162,8 @@ float FloatSwap (float f)
|
|||
float f;
|
||||
byte b[4];
|
||||
} dat1, dat2;
|
||||
|
||||
|
||||
|
||||
|
||||
dat1.f = f;
|
||||
dat2.b[0] = dat1.b[3];
|
||||
dat2.b[1] = dat1.b[2];
|
||||
|
@ -186,7 +186,7 @@ void Swap_Init (void)
|
|||
{
|
||||
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)
|
||||
{
|
||||
_BigShort = ShortSwap;
|
||||
|
@ -360,7 +360,7 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
|
||||
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;
|
||||
}
|
||||
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
|
||||
|
||||
============================================================================
|
||||
*/
|
||||
|
@ -742,7 +742,7 @@ char* Q_strtok(char* str, const char *tok, int size) {
|
|||
char *ptr;
|
||||
char *result;
|
||||
int i, l;
|
||||
|
||||
|
||||
if(str == NULL || tok == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ char* Q_strtok(char* str, const char *tok, int size) {
|
|||
/*
|
||||
=============
|
||||
Q_strncpyz
|
||||
|
||||
|
||||
Safe strncpy that ensures a trailing zero
|
||||
=============
|
||||
*/
|
||||
|
@ -790,21 +790,21 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) {
|
|||
}
|
||||
|
||||
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 c1, c2;
|
||||
|
||||
|
||||
/* bk001129 - moved in 1.17 fix not in id codebase */
|
||||
if ( s1 == NULL ) {
|
||||
if ( s2 == NULL )
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if ( s2==NULL )
|
||||
return 1;
|
||||
if ( s1 == NULL ) {
|
||||
if ( s2 == NULL )
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if ( s2==NULL )
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
|
@ -815,7 +815,7 @@ int Q_stricmpn (const char *s1, const char *s2, int n) {
|
|||
if (!n--) {
|
||||
return 0; /* strings are equal until end point */
|
||||
}
|
||||
|
||||
|
||||
if (c1 != c2) {
|
||||
if (c1 >= 'a' && c1 <= 'z') {
|
||||
c1 -= ('a' - 'A');
|
||||
|
@ -828,13 +828,13 @@ int Q_stricmpn (const char *s1, const char *s2, int n) {
|
|||
}
|
||||
}
|
||||
} while (c1);
|
||||
|
||||
|
||||
return 0; /* strings are equal */
|
||||
}
|
||||
|
||||
int Q_strncmp (const char *s1, const char *s2, int n) {
|
||||
int c1, c2;
|
||||
|
||||
|
||||
do {
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
|
@ -842,12 +842,12 @@ int Q_strncmp (const char *s1, const char *s2, int n) {
|
|||
if (!n--) {
|
||||
return 0; /* strings are equal until end point */
|
||||
}
|
||||
|
||||
|
||||
if (c1 != c2) {
|
||||
return c1 < c2 ? -1 : 1;
|
||||
}
|
||||
} while (c1);
|
||||
|
||||
|
||||
return 0; /* strings are equal */
|
||||
}
|
||||
|
||||
|
@ -857,25 +857,25 @@ int Q_stricmp (const char *s1, const char *s2) {
|
|||
|
||||
|
||||
char *Q_strlwr( char *s1 ) {
|
||||
char *s;
|
||||
char *s;
|
||||
|
||||
s = s1;
|
||||
s = s1;
|
||||
while ( *s ) {
|
||||
*s = tolower(*s);
|
||||
s++;
|
||||
}
|
||||
return s1;
|
||||
return s1;
|
||||
}
|
||||
|
||||
char *Q_strupr( char *s1 ) {
|
||||
char *s;
|
||||
char *s;
|
||||
|
||||
s = s1;
|
||||
s = s1;
|
||||
while ( *s ) {
|
||||
*s = toupper(*s);
|
||||
s++;
|
||||
}
|
||||
return s1;
|
||||
return s1;
|
||||
}
|
||||
|
||||
/* never goes past bounds or leaves without a terminating 0 */
|
||||
|
@ -918,6 +918,10 @@ char *Q_CleanStr( char *string ) {
|
|||
char* s;
|
||||
int c;
|
||||
|
||||
if(string == NULL) {
|
||||
return string;
|
||||
}
|
||||
|
||||
s = string;
|
||||
d = string;
|
||||
while ((c = *s) != 0 ) {
|
||||
|
@ -992,7 +996,7 @@ char * QDECL va( char *format, ... ) {
|
|||
/*
|
||||
=====================================================================
|
||||
|
||||
INFO STRINGS
|
||||
INFO STRINGS
|
||||
|
||||
=====================================================================
|
||||
*/
|
||||
|
@ -1009,10 +1013,10 @@ FIXME: overflow check?
|
|||
char *Info_ValueForKey( const char *s, const char *key ) {
|
||||
char pkey[BIG_INFO_KEY];
|
||||
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;
|
||||
char *o;
|
||||
|
||||
|
||||
if ( !s || !key ) {
|
||||
return "";
|
||||
}
|
||||
|
@ -1346,7 +1350,7 @@ int GetIDForString ( stringID_table_t *table, const char *string )
|
|||
int index = 0;
|
||||
|
||||
while ( ( table[index].name != NULL ) &&
|
||||
( table[index].name[0] != 0 ) )
|
||||
( table[index].name[0] != 0 ) )
|
||||
{
|
||||
if ( !Q_stricmp( table[index].name, string ) )
|
||||
return table[index].id;
|
||||
|
@ -1368,7 +1372,7 @@ const char *GetStringForID( stringID_table_t *table, int id )
|
|||
int index = 0;
|
||||
|
||||
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 )
|
||||
return table[index].name;
|
||||
|
|
Loading…
Reference in a new issue