codemp/game/g_ICARUScb.c

Go to the documentation of this file.
00001 //====================================================================================
00002 //
00003 //rww - ICARUS callback file, all that can be handled within vm's is handled in here.
00004 //
00005 //====================================================================================
00006 
00007 #include "q_shared.h"
00008 #include "bg_public.h"
00009 #include "b_local.h"
00010 #include "../icarus/Q3_Interface.h"
00011 #include "../icarus/Q3_Registers.h"
00012 #include "g_nav.h"
00013 
00014 #include "../namespace_begin.h"
00015 qboolean BG_SabersOff( playerState_t *ps );
00016 extern stringID_table_t WPTable[];
00017 extern stringID_table_t BSTable[];
00018 #include "../namespace_end.h"
00019 
00020 
00021 //This is a hack I guess. It's because we can't include the file this enum is in
00022 //unless we're using cpp. But we need it for the interpreter stuff.
00023 //In any case, DO NOT modify this enum.
00024 
00025 // Hack++
00026 // This code is compiled as C++ on Xbox. We could try and rig something above
00027 // so that we only get the C version of the includes (no full Icarus) in that
00028 // scenario, but I think we'll just try to leave this out instead.
00029 #ifndef _XBOX
00030 #ifndef __linux__
00031 enum
00032 {
00033         TK_EOF = -1,
00034         TK_UNDEFINED,
00035         TK_COMMENT,
00036         TK_EOL,
00037         TK_CHAR,
00038         TK_STRING,
00039         TK_INT,
00040         TK_INTEGER = TK_INT,
00041         TK_FLOAT,
00042         TK_IDENTIFIER,
00043         TK_USERDEF,
00044 };
00045 #endif
00046 #endif
00047 
00048 #include "../icarus/interpreter.h"
00049 
00050 extern stringID_table_t animTable [MAX_ANIMATIONS+1];
00051 
00052 stringID_table_t setTable[] =
00053 {
00054         ENUM2STRING(SET_SPAWNSCRIPT),//0
00055         ENUM2STRING(SET_USESCRIPT),
00056         ENUM2STRING(SET_AWAKESCRIPT),
00057         ENUM2STRING(SET_ANGERSCRIPT),
00058         ENUM2STRING(SET_ATTACKSCRIPT),
00059         ENUM2STRING(SET_VICTORYSCRIPT),
00060         ENUM2STRING(SET_PAINSCRIPT),
00061         ENUM2STRING(SET_FLEESCRIPT),
00062         ENUM2STRING(SET_DEATHSCRIPT),
00063         ENUM2STRING(SET_DELAYEDSCRIPT),
00064         ENUM2STRING(SET_BLOCKEDSCRIPT),
00065         ENUM2STRING(SET_FFIRESCRIPT),
00066         ENUM2STRING(SET_FFDEATHSCRIPT),
00067         ENUM2STRING(SET_MINDTRICKSCRIPT),
00068         ENUM2STRING(SET_NO_MINDTRICK),
00069         ENUM2STRING(SET_ORIGIN),
00070         ENUM2STRING(SET_TELEPORT_DEST),
00071         ENUM2STRING(SET_ANGLES),
00072         ENUM2STRING(SET_XVELOCITY),
00073         ENUM2STRING(SET_YVELOCITY),
00074         ENUM2STRING(SET_ZVELOCITY),
00075         ENUM2STRING(SET_Z_OFFSET),
00076         ENUM2STRING(SET_ENEMY),
00077         ENUM2STRING(SET_LEADER),
00078         ENUM2STRING(SET_NAVGOAL),
00079         ENUM2STRING(SET_ANIM_UPPER),
00080         ENUM2STRING(SET_ANIM_LOWER),
00081         ENUM2STRING(SET_ANIM_BOTH),
00082         ENUM2STRING(SET_ANIM_HOLDTIME_LOWER),
00083         ENUM2STRING(SET_ANIM_HOLDTIME_UPPER),
00084         ENUM2STRING(SET_ANIM_HOLDTIME_BOTH),
00085         ENUM2STRING(SET_PLAYER_TEAM),
00086         ENUM2STRING(SET_ENEMY_TEAM),
00087         ENUM2STRING(SET_BEHAVIOR_STATE),
00088         ENUM2STRING(SET_BEHAVIOR_STATE),
00089         ENUM2STRING(SET_HEALTH),
00090         ENUM2STRING(SET_ARMOR),
00091         ENUM2STRING(SET_DEFAULT_BSTATE),
00092         ENUM2STRING(SET_CAPTURE),
00093         ENUM2STRING(SET_DPITCH),
00094         ENUM2STRING(SET_DYAW),
00095         ENUM2STRING(SET_EVENT),
00096         ENUM2STRING(SET_TEMP_BSTATE),
00097         ENUM2STRING(SET_COPY_ORIGIN),
00098         ENUM2STRING(SET_VIEWTARGET),
00099         ENUM2STRING(SET_WEAPON),
00100         ENUM2STRING(SET_ITEM),
00101         ENUM2STRING(SET_WALKSPEED),
00102         ENUM2STRING(SET_RUNSPEED),
00103         ENUM2STRING(SET_YAWSPEED),
00104         ENUM2STRING(SET_AGGRESSION),
00105         ENUM2STRING(SET_AIM),
00106         ENUM2STRING(SET_FRICTION),
00107         ENUM2STRING(SET_GRAVITY),
00108         ENUM2STRING(SET_IGNOREPAIN),
00109         ENUM2STRING(SET_IGNOREENEMIES),
00110         ENUM2STRING(SET_IGNOREALERTS),
00111         ENUM2STRING(SET_DONTSHOOT),
00112         ENUM2STRING(SET_DONTFIRE),
00113         ENUM2STRING(SET_LOCKED_ENEMY),
00114         ENUM2STRING(SET_NOTARGET),
00115         ENUM2STRING(SET_LEAN),
00116         ENUM2STRING(SET_CROUCHED),
00117         ENUM2STRING(SET_WALKING),
00118         ENUM2STRING(SET_RUNNING),
00119         ENUM2STRING(SET_CHASE_ENEMIES),
00120         ENUM2STRING(SET_LOOK_FOR_ENEMIES),
00121         ENUM2STRING(SET_FACE_MOVE_DIR),
00122         ENUM2STRING(SET_ALT_FIRE),
00123         ENUM2STRING(SET_DONT_FLEE),
00124         ENUM2STRING(SET_FORCED_MARCH),
00125         ENUM2STRING(SET_NO_RESPONSE),
00126         ENUM2STRING(SET_NO_COMBAT_TALK),
00127         ENUM2STRING(SET_NO_ALERT_TALK),
00128         ENUM2STRING(SET_UNDYING),
00129         ENUM2STRING(SET_TREASONED),
00130         ENUM2STRING(SET_DISABLE_SHADER_ANIM),
00131         ENUM2STRING(SET_SHADER_ANIM),
00132         ENUM2STRING(SET_INVINCIBLE),
00133         ENUM2STRING(SET_NOAVOID),
00134         ENUM2STRING(SET_SHOOTDIST),
00135         ENUM2STRING(SET_TARGETNAME),
00136         ENUM2STRING(SET_TARGET),
00137         ENUM2STRING(SET_TARGET2),
00138         ENUM2STRING(SET_LOCATION),
00139         ENUM2STRING(SET_PAINTARGET),
00140         ENUM2STRING(SET_TIMESCALE),
00141         ENUM2STRING(SET_VISRANGE),
00142         ENUM2STRING(SET_EARSHOT),
00143         ENUM2STRING(SET_VIGILANCE),
00144         ENUM2STRING(SET_HFOV),
00145         ENUM2STRING(SET_VFOV),
00146         ENUM2STRING(SET_DELAYSCRIPTTIME),
00147         ENUM2STRING(SET_FORWARDMOVE),
00148         ENUM2STRING(SET_RIGHTMOVE),
00149         ENUM2STRING(SET_LOCKYAW),
00150         ENUM2STRING(SET_SOLID),
00151         ENUM2STRING(SET_CAMERA_GROUP),
00152         ENUM2STRING(SET_CAMERA_GROUP_Z_OFS),
00153         ENUM2STRING(SET_CAMERA_GROUP_TAG),
00154         ENUM2STRING(SET_LOOK_TARGET),
00155         ENUM2STRING(SET_ADDRHANDBOLT_MODEL),
00156         ENUM2STRING(SET_REMOVERHANDBOLT_MODEL),
00157         ENUM2STRING(SET_ADDLHANDBOLT_MODEL),
00158         ENUM2STRING(SET_REMOVELHANDBOLT_MODEL),
00159         ENUM2STRING(SET_FACEAUX),
00160         ENUM2STRING(SET_FACEBLINK),
00161         ENUM2STRING(SET_FACEBLINKFROWN),
00162         ENUM2STRING(SET_FACEFROWN),
00163         ENUM2STRING(SET_FACENORMAL),
00164         ENUM2STRING(SET_FACEEYESCLOSED),
00165         ENUM2STRING(SET_FACEEYESOPENED),
00166         ENUM2STRING(SET_SCROLLTEXT),
00167         ENUM2STRING(SET_LCARSTEXT),
00168         ENUM2STRING(SET_SCROLLTEXTCOLOR),
00169         ENUM2STRING(SET_CAPTIONTEXTCOLOR),
00170         ENUM2STRING(SET_CENTERTEXTCOLOR),
00171         ENUM2STRING(SET_PLAYER_USABLE),
00172         ENUM2STRING(SET_STARTFRAME),
00173         ENUM2STRING(SET_ENDFRAME),
00174         ENUM2STRING(SET_ANIMFRAME),
00175         ENUM2STRING(SET_LOOP_ANIM),
00176         ENUM2STRING(SET_INTERFACE),
00177         ENUM2STRING(SET_SHIELDS),
00178         ENUM2STRING(SET_NO_KNOCKBACK),
00179         ENUM2STRING(SET_INVISIBLE),
00180         ENUM2STRING(SET_VAMPIRE),
00181         ENUM2STRING(SET_FORCE_INVINCIBLE),
00182         ENUM2STRING(SET_GREET_ALLIES),
00183         ENUM2STRING(SET_PLAYER_LOCKED),
00184         ENUM2STRING(SET_LOCK_PLAYER_WEAPONS),
00185         ENUM2STRING(SET_NO_IMPACT_DAMAGE),
00186         ENUM2STRING(SET_PARM1),
00187         ENUM2STRING(SET_PARM2),
00188         ENUM2STRING(SET_PARM3),
00189         ENUM2STRING(SET_PARM4),
00190         ENUM2STRING(SET_PARM5),
00191         ENUM2STRING(SET_PARM6),
00192         ENUM2STRING(SET_PARM7),
00193         ENUM2STRING(SET_PARM8),
00194         ENUM2STRING(SET_PARM9),
00195         ENUM2STRING(SET_PARM10),
00196         ENUM2STRING(SET_PARM11),
00197         ENUM2STRING(SET_PARM12),
00198         ENUM2STRING(SET_PARM13),
00199         ENUM2STRING(SET_PARM14),
00200         ENUM2STRING(SET_PARM15),
00201         ENUM2STRING(SET_PARM16),
00202         ENUM2STRING(SET_DEFEND_TARGET),
00203         ENUM2STRING(SET_WAIT),
00204         ENUM2STRING(SET_COUNT),
00205         ENUM2STRING(SET_SHOT_SPACING),
00206         ENUM2STRING(SET_VIDEO_PLAY),
00207         ENUM2STRING(SET_VIDEO_FADE_IN),
00208         ENUM2STRING(SET_VIDEO_FADE_OUT),
00209         ENUM2STRING(SET_REMOVE_TARGET),
00210         ENUM2STRING(SET_LOADGAME),
00211         ENUM2STRING(SET_MENU_SCREEN),
00212         ENUM2STRING(SET_OBJECTIVE_SHOW),
00213         ENUM2STRING(SET_OBJECTIVE_HIDE),
00214         ENUM2STRING(SET_OBJECTIVE_SUCCEEDED),
00215         ENUM2STRING(SET_OBJECTIVE_FAILED),
00216         ENUM2STRING(SET_MISSIONFAILED),
00217         ENUM2STRING(SET_TACTICAL_SHOW),
00218         ENUM2STRING(SET_TACTICAL_HIDE),
00219         ENUM2STRING(SET_FOLLOWDIST),
00220         ENUM2STRING(SET_SCALE),
00221         ENUM2STRING(SET_OBJECTIVE_CLEARALL),
00222         ENUM2STRING(SET_MISSIONSTATUSTEXT),
00223         ENUM2STRING(SET_WIDTH),
00224         ENUM2STRING(SET_CLOSINGCREDITS),
00225         ENUM2STRING(SET_SKILL),
00226         ENUM2STRING(SET_MISSIONSTATUSTIME),
00227         ENUM2STRING(SET_FULLNAME),
00228         ENUM2STRING(SET_FORCE_HEAL_LEVEL),
00229         ENUM2STRING(SET_FORCE_JUMP_LEVEL),
00230         ENUM2STRING(SET_FORCE_SPEED_LEVEL),
00231         ENUM2STRING(SET_FORCE_PUSH_LEVEL),
00232         ENUM2STRING(SET_FORCE_PULL_LEVEL),
00233         ENUM2STRING(SET_FORCE_MINDTRICK_LEVEL),
00234         ENUM2STRING(SET_FORCE_GRIP_LEVEL),
00235         ENUM2STRING(SET_FORCE_LIGHTNING_LEVEL),
00236         ENUM2STRING(SET_SABER_THROW),
00237         ENUM2STRING(SET_SABER_DEFENSE),
00238         ENUM2STRING(SET_SABER_OFFENSE),
00239         ENUM2STRING(SET_VIEWENTITY),
00240         ENUM2STRING(SET_WATCHTARGET),
00241         ENUM2STRING(SET_SABERACTIVE),
00242         ENUM2STRING(SET_ADJUST_AREA_PORTALS),
00243         ENUM2STRING(SET_DMG_BY_HEAVY_WEAP_ONLY),
00244         ENUM2STRING(SET_SHIELDED),
00245         ENUM2STRING(SET_NO_GROUPS),
00246         ENUM2STRING(SET_FIRE_WEAPON),
00247         ENUM2STRING(SET_INACTIVE),
00248         ENUM2STRING(SET_FUNC_USABLE_VISIBLE),
00249         ENUM2STRING(SET_MISSION_STATUS_SCREEN),
00250         ENUM2STRING(SET_END_SCREENDISSOLVE),
00251         ENUM2STRING(SET_LOOPSOUND),
00252         ENUM2STRING(SET_ICARUS_FREEZE),
00253         ENUM2STRING(SET_ICARUS_UNFREEZE),
00254         ENUM2STRING(SET_USE_CP_NEAREST),
00255         ENUM2STRING(SET_MORELIGHT),
00256         ENUM2STRING(SET_CINEMATIC_SKIPSCRIPT),
00257         ENUM2STRING(SET_NO_FORCE),
00258         ENUM2STRING(SET_NO_FALLTODEATH),
00259         ENUM2STRING(SET_DISMEMBERABLE),
00260         ENUM2STRING(SET_NO_ACROBATICS),
00261         ENUM2STRING(SET_MUSIC_STATE),
00262         ENUM2STRING(SET_USE_SUBTITLES),
00263         ENUM2STRING(SET_CLEAN_DAMAGING_ENTS),
00264         ENUM2STRING(SET_HUD),
00265 
00266 //FIXME: add BOTH_ attributes here too
00267         "",     SET_,
00268 };
00269 
00270 void Q3_TaskIDClear( int *taskID )
00271 {
00272         *taskID = -1;
00273 }
00274 
00275 void G_DebugPrint( int level, const char *format, ... )
00276 {
00277         va_list         argptr;
00278         char            text[1024];
00279 
00280         //Don't print messages they don't want to see
00281         //if ( g_ICARUSDebug->integer < level )
00282         if (g_developer.integer != 2)
00283                 return;
00284 
00285         va_start (argptr, format);
00286         vsprintf (text, format, argptr);
00287         va_end (argptr);
00288 
00289         //Add the color formatting
00290         switch ( level )
00291         {
00292                 case WL_ERROR:
00293                         Com_Printf ( S_COLOR_RED"ERROR: %s", text );
00294                         break;
00295                 
00296                 case WL_WARNING:
00297                         Com_Printf ( S_COLOR_YELLOW"WARNING: %s", text );
00298                         break;
00299                 
00300                 case WL_DEBUG:
00301                         {
00302                                 int             entNum;
00303                                 char    *buffer;
00304 
00305                                 sscanf( text, "%d", &entNum );
00306 
00307                                 //if ( ( ICARUS_entFilter >= 0 ) && ( ICARUS_entFilter != entNum ) )
00308                                 //      return;
00309 
00310                                 buffer = (char *) text;
00311                                 buffer += 5;
00312 
00313                                 if ( ( entNum < 0 ) || ( entNum > MAX_GENTITIES ) )
00314                                         entNum = 0;
00315 
00316                                 Com_Printf ( S_COLOR_BLUE"DEBUG: %s(%d): %s\n", g_entities[entNum].script_targetname, entNum, buffer );
00317                                 break;
00318                         }
00319                 default:
00320                 case WL_VERBOSE:
00321                         Com_Printf ( S_COLOR_GREEN"INFO: %s", text );
00322                         break;
00323         }
00324 }
00325 
00326 /*
00327 -------------------------
00328 Q3_GetAnimLower
00329 -------------------------
00330 */
00331 static char *Q3_GetAnimLower( gentity_t *ent )
00332 {
00333         int anim = 0;
00334 
00335         if ( ent->client == NULL )
00336         {
00337                 G_DebugPrint( WL_WARNING, "Q3_GetAnimLower: attempted to read animation state off non-client!\n" );
00338                 return NULL;
00339         }
00340 
00341         anim = ent->client->ps.legsAnim;
00342 
00343         return (char *)animTable[anim].name;
00344 }
00345 
00346 /*
00347 -------------------------
00348 Q3_GetAnimUpper
00349 -------------------------
00350 */
00351 static char *Q3_GetAnimUpper( gentity_t *ent )
00352 {
00353         int anim = 0;
00354 
00355         if ( ent->client == NULL )
00356         {
00357                 G_DebugPrint( WL_WARNING, "Q3_GetAnimUpper: attempted to read animation state off non-client!\n" );
00358                 return NULL;
00359         }
00360 
00361         anim = ent->client->ps.torsoAnim;
00362 
00363         return (char *)animTable[anim].name;
00364 }
00365 
00366 /*
00367 -------------------------
00368 Q3_GetAnimBoth
00369 -------------------------
00370 */
00371 static char *Q3_GetAnimBoth( gentity_t *ent )
00372 {
00373         char    *lowerName, *upperName;
00374 
00375         lowerName = Q3_GetAnimLower( ent );
00376         upperName = Q3_GetAnimUpper( ent );
00377 
00378         if ( !lowerName || !lowerName[0] )
00379         {
00380                 G_DebugPrint( WL_WARNING, "Q3_GetAnimBoth: NULL legs animation string found!\n" );
00381                 return NULL;
00382         }
00383 
00384         if ( !upperName || !upperName[0] )
00385         {
00386                 G_DebugPrint( WL_WARNING, "Q3_GetAnimBoth: NULL torso animation string found!\n" );
00387                 return NULL;
00388         }
00389 
00390         if ( Q_stricmp( lowerName, upperName ) )
00391         {
00392 #ifdef _DEBUG   // sigh, cut down on tester reports that aren't important
00393                 G_DebugPrint( WL_WARNING, "Q3_GetAnimBoth: legs and torso animations did not match : returning legs\n" );
00394 #endif
00395         }
00396 
00397         return lowerName;
00398 }
00399 
00400 int Q3_PlaySound( int taskID, int entID, const char *name, const char *channel )
00401 {
00402         gentity_t               *ent = &g_entities[entID];
00403         char                    finalName[MAX_QPATH];
00404         soundChannel_t  voice_chan = CHAN_VOICE; // set a default so the compiler doesn't bitch
00405         qboolean                type_voice = qfalse;
00406         int                             soundHandle;
00407         qboolean                bBroadcast;
00408 
00409         Q_strncpyz( finalName, name, MAX_QPATH );
00410         Q_strupr(finalName);
00411         //G_AddSexToMunroString( finalName, qtrue );
00412 
00413         COM_StripExtension( (const char *)finalName, finalName );
00414 
00415         soundHandle = G_SoundIndex( (char *) finalName );
00416         bBroadcast = qfalse;
00417 
00418         if ( ( Q_stricmp( channel, "CHAN_ANNOUNCER" ) == 0 ) || (ent->classname && Q_stricmp("target_scriptrunner", ent->classname ) == 0) ) {
00419                 bBroadcast = qtrue;
00420         }
00421 
00422 
00423         // moved here from further down so I can easily check channel-type without code dup...
00424         //
00425         if ( Q_stricmp( channel, "CHAN_VOICE" ) == 0 )
00426         {
00427                 voice_chan = CHAN_VOICE;
00428                 type_voice = qtrue;
00429         }
00430         else if ( Q_stricmp( channel, "CHAN_VOICE_ATTEN" ) == 0 )
00431         {
00432                 voice_chan = CHAN_AUTO;//CHAN_VOICE_ATTEN;
00433                 type_voice = qtrue;
00434         }
00435         else if ( Q_stricmp( channel, "CHAN_VOICE_GLOBAL" ) == 0 ) // this should broadcast to everyone, put only casue animation on G_SoundOnEnt...
00436         {
00437                 voice_chan = CHAN_AUTO;//CHAN_VOICE_GLOBAL;
00438                 type_voice = qtrue;
00439                 bBroadcast = qtrue;
00440         }
00441 
00442         // if we're in-camera, check for skipping cinematic and ifso, no subtitle print (since screen is not being
00443         //      updated anyway during skipping). This stops leftover subtitles being left onscreen after unskipping.
00444         //
00445         /*
00446         if (!in_camera ||
00447                 (!g_skippingcin || !g_skippingcin->integer)
00448                 )       // paranoia towards project end <g>
00449         {
00450                 // Text on
00451                 // certain NPC's we always want to use subtitles regardless of subtitle setting
00452                 if (g_subtitles->integer == 1 || (ent->NPC && (ent->NPC->scriptFlags & SCF_USE_SUBTITLES) ) ) // Show all text
00453                 {
00454                         if ( in_camera) // Cinematic
00455                         {                                       
00456                                 trap_SendServerCommand( -1, va("ct \"%s\" %i", finalName, soundHandle) );
00457                         }
00458                         else //if (precacheWav[i].speaker==SP_NONE)     //  lower screen text
00459                         {
00460                                 sharedEntity_t          *ent2 = SV_GentityNum(0);
00461                                 // the numbers in here were either the original ones Bob entered (350), or one arrived at from checking the distance Chell stands at in stasis2 by the computer core that was submitted as a bug report...
00462                                 //
00463                                 if (bBroadcast || (DistanceSquared(ent->currentOrigin, ent2->currentOrigin) < ((voice_chan == CHAN_VOICE_ATTEN)?(350 * 350):(1200 * 1200)) ) )
00464                                 {
00465                                         trap_SendServerCommand( -1, va("ct \"%s\" %i", finalName, soundHandle) );
00466                                 }
00467                         }
00468                 }
00469                 // Cinematic only
00470                 else if (g_subtitles->integer == 2) // Show only talking head text and CINEMATIC
00471                 {
00472                         if ( in_camera) // Cinematic text
00473                         {                                                       
00474                                 trap_SendServerCommand( -1, va("ct \"%s\" %i", finalName, soundHandle));
00475                         }
00476                 }
00477 
00478         }
00479         */
00480 
00481         if ( type_voice )
00482         {
00483                 char buf[128];
00484                 float tFVal = 0;
00485 
00486                 trap_Cvar_VariableStringBuffer("timescale", buf, sizeof(buf));
00487 
00488                 tFVal = atof(buf);
00489 
00490 
00491                 if ( tFVal > 1.0f )
00492                 {//Skip the damn sound!
00493                         return qtrue;
00494                 }
00495                 else
00496                 {
00497                         //This the voice channel
00498                         G_Sound( ent, voice_chan, G_SoundIndex((char *) finalName) );
00499                 }
00500                 //Remember we're waiting for this
00501                 trap_ICARUS_TaskIDSet( ent, TID_CHAN_VOICE, taskID );
00502 
00503                 return qfalse;
00504         }
00505 
00506         if ( bBroadcast )
00507         {//Broadcast the sound
00508                 gentity_t       *te;
00509 
00510                 te = G_TempEntity( ent->r.currentOrigin, EV_GLOBAL_SOUND );
00511                 te->s.eventParm = soundHandle;
00512                 te->r.svFlags |= SVF_BROADCAST;
00513         }
00514         else
00515         {
00516                 G_Sound( ent, CHAN_AUTO, soundHandle );
00517         }
00518 
00519         return qtrue;
00520 }
00521 
00522 /*
00523 -------------------------
00524 Q3_Play
00525 -------------------------
00526 */
00527 void Q3_Play( int taskID, int entID, const char *type, const char *name )
00528 {
00529         gentity_t *ent = &g_entities[entID];
00530 
00531         if ( !Q_stricmp( type, "PLAY_ROFF" ) )
00532         {
00533                 // Try to load the requested ROFF
00534                 ent->roffid = trap_ROFF_Cache((char*)name);
00535                 if ( ent->roffid )
00536                 {
00537                         ent->roffname = G_NewString( name );
00538 
00539                         // Start the roff from the beginning
00540                         //ent->roff_ctr = 0;
00541 
00542                         //Save this off for later
00543                         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
00544 
00545                         // Let the ROFF playing start.
00546                         //ent->next_roff_time = level.time;
00547 
00548                         //rww - Maybe use pos1 and pos2? I don't think we need to care if these values are sent across the net.
00549                         // These need to be initialised up front...
00550                         //VectorCopy( ent->r.currentOrigin, ent->pos1 );
00551                         //VectorCopy( ent->r.currentAngles, ent->pos2 );
00552                         VectorCopy( ent->r.currentOrigin, ent->s.origin2 );
00553                         VectorCopy( ent->r.currentAngles, ent->s.angles2 );
00554                         
00555                         trap_LinkEntity( ent );
00556 
00557                         trap_ROFF_Play(ent->s.number, ent->roffid, qtrue);
00558                 }
00559         }
00560 }
00561 
00562 /*
00563 =============
00564 anglerCallback
00565 
00566 Utility function
00567 =============
00568 */
00569 void anglerCallback( gentity_t *ent )
00570 {
00571         //Complete the task
00572         trap_ICARUS_TaskIDComplete( ent, TID_ANGLE_FACE );
00573 
00574         //Set the currentAngles, clear all movement
00575         VectorMA( ent->s.apos.trBase, (ent->s.apos.trDuration*0.001f), ent->s.apos.trDelta, ent->r.currentAngles );
00576         VectorCopy( ent->r.currentAngles, ent->s.apos.trBase );
00577         VectorClear( ent->s.apos.trDelta );
00578         ent->s.apos.trDuration = 1;
00579         ent->s.apos.trType = TR_STATIONARY;
00580         ent->s.apos.trTime = level.time;
00581 
00582         //Stop thinking
00583         ent->reached = 0;
00584         if ( ent->think == anglerCallback )
00585         {
00586                 ent->think = 0;
00587         }
00588 
00589         //link
00590         trap_LinkEntity( ent );
00591 }
00592 
00593 void MatchTeam( gentity_t *teamLeader, int moverState, int time );
00594 void Blocked_Mover( gentity_t *ent, gentity_t *other );
00595 
00596 /*
00597 =============
00598 moverCallback
00599 
00600 Utility function
00601 =============
00602 */
00603 void moverCallback( gentity_t *ent )
00604 {       //complete the task
00605         trap_ICARUS_TaskIDComplete( ent, TID_MOVE_NAV );
00606         
00607         // play sound
00608         ent->s.loopSound = 0;//stop looping sound
00609         ent->s.loopIsSoundset = qfalse;
00610         G_PlayDoorSound( ent, BMS_END );//play end sound
00611 
00612         if ( ent->moverState == MOVER_1TO2 ) 
00613         {//reached open
00614                 // reached pos2
00615                 MatchTeam( ent, MOVER_POS2, level.time );
00616                 //SetMoverState( ent, MOVER_POS2, level.time );
00617         } 
00618         else if ( ent->moverState == MOVER_2TO1 ) 
00619         {//reached closed
00620                 MatchTeam( ent, MOVER_POS1, level.time );
00621                 //SetMoverState( ent, MOVER_POS1, level.time );
00622         }
00623 
00624         if ( ent->blocked == Blocked_Mover )
00625         {
00626                 ent->blocked = 0;
00627         }
00628 
00629 //      if ( !Q_stricmp( "misc_model_breakable", ent->classname ) && ent->physicsBounce )
00630 //      {//a gravity-affected model
00631 //              misc_model_breakable_gravity_init( ent, qfalse );
00632 //      }
00633 }
00634 
00635 void Blocked_Mover( gentity_t *ent, gentity_t *other )
00636 {
00637         // remove anything other than a client -- no longer the case
00638 
00639         // don't remove security keys or goodie keys
00640         if ( (other->s.eType == ET_ITEM) )
00641         {
00642                 // should we be doing anything special if a key blocks it... move it somehow..?
00643         }
00644         // if your not a client, or your a dead client remove yourself...
00645         else if ( other->s.number && (!other->client || (other->client && other->health <= 0 && other->r.contents == CONTENTS_CORPSE && !other->message)) )
00646         {
00647                 //if ( !other->taskManager || !other->taskManager->IsRunning() )
00648                 {
00649                         // if an item or weapon can we do a little explosion..?
00650                         G_FreeEntity( other );
00651                         return;
00652                 }
00653         }
00654 
00655         if ( ent->damage ) {
00656                 G_Damage( other, ent, ent, NULL, NULL, ent->damage, 0, MOD_CRUSH );
00657         }
00658 }
00659 
00660 /*
00661 =============
00662 moveAndRotateCallback
00663 
00664 Utility function
00665 =============
00666 */
00667 void moveAndRotateCallback( gentity_t *ent )
00668 {
00669         //stop turning
00670         anglerCallback( ent );
00671         //stop moving
00672         moverCallback( ent );
00673 }
00674 
00675 /*
00676 =============
00677 Q3_Lerp2Start
00678 
00679 Lerps the origin of an entity to its starting position
00680 =============
00681 */
00682 void Q3_Lerp2Start( int entID, int taskID, float duration )
00683 {
00684         gentity_t       *ent = &g_entities[entID];
00685 
00686         if(!ent)
00687         {       
00688                 G_DebugPrint( WL_WARNING, "Q3_Lerp2Start: invalid entID %d\n", entID);
00689                 return;
00690         }
00691         
00692         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
00693         {
00694                 G_DebugPrint( WL_ERROR, "Q3_Lerp2Start: ent %d is NOT a mover!\n", entID);
00695                 return;
00696         }
00697 
00698         if ( ent->s.eType != ET_MOVER )
00699         {
00700                 ent->s.eType = ET_MOVER;
00701         }
00702 
00703         //FIXME: set up correctly!!!
00704         ent->moverState = MOVER_2TO1;
00705         ent->s.eType = ET_MOVER;
00706         ent->reached = moverCallback;           //Callsback the the completion of the move
00707         if ( ent->damage )
00708         {
00709                 ent->blocked = Blocked_Mover;
00710         }
00711 
00712         ent->s.pos.trDuration = duration * 10;  //In seconds
00713         ent->s.pos.trTime = level.time;
00714         
00715         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
00716         // starting sound
00717         G_PlayDoorLoopSound( ent );
00718         G_PlayDoorSound( ent, BMS_START );      //??
00719 
00720         trap_LinkEntity( ent );
00721 }
00722 
00723 /*
00724 =============
00725 Q3_Lerp2End
00726 
00727 Lerps the origin of an entity to its ending position
00728 =============
00729 */
00730 void Q3_Lerp2End( int entID, int taskID, float duration )
00731 {
00732         gentity_t       *ent = &g_entities[entID];
00733 
00734         if(!ent)
00735         {
00736                 G_DebugPrint( WL_WARNING, "Q3_Lerp2End: invalid entID %d\n", entID);
00737                 return;
00738         }
00739         
00740         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
00741         {
00742                 G_DebugPrint( WL_ERROR, "Q3_Lerp2End: ent %d is NOT a mover!\n", entID);
00743                 return;
00744         }
00745 
00746         if ( ent->s.eType != ET_MOVER )
00747         {
00748                 ent->s.eType = ET_MOVER;
00749         }
00750 
00751         //FIXME: set up correctly!!!
00752         ent->moverState = MOVER_1TO2;
00753         ent->s.eType = ET_MOVER;
00754         ent->reached = moverCallback;           //Callsback the the completion of the move
00755         if ( ent->damage )
00756         {
00757                 ent->blocked = Blocked_Mover;
00758         }
00759 
00760         ent->s.pos.trDuration = duration * 10;  //In seconds
00761         ent->s.time = level.time;
00762         
00763         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
00764         // starting sound
00765         G_PlayDoorLoopSound( ent );
00766         G_PlayDoorSound( ent, BMS_START );      //??
00767 
00768         trap_LinkEntity( ent );
00769 }
00770 
00771 void InitMoverTrData( gentity_t *ent );
00772 
00773 /*
00774 =============
00775 Q3_Lerp2Pos
00776 
00777 Lerps the origin and angles of an entity to the destination values
00778 
00779 =============
00780 */
00781 void Q3_Lerp2Pos( int taskID, int entID, vec3_t origin, vec3_t angles, float duration )
00782 {
00783         gentity_t       *ent = &g_entities[entID];
00784         vec3_t          ang;
00785         int                     i;
00786         moverState_t moverState;
00787 
00788         if(!ent)
00789         {
00790                 G_DebugPrint( WL_WARNING, "Q3_Lerp2Pos: invalid entID %d\n", entID);
00791                 return;
00792         }
00793         
00794         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
00795         {
00796                 G_DebugPrint( WL_ERROR, "Q3_Lerp2Pos: ent %d is NOT a mover!\n", entID);
00797                 return;
00798         }
00799 
00800         if ( ent->s.eType != ET_MOVER )
00801         {
00802                 ent->s.eType = ET_MOVER;
00803         }
00804 
00805         //Don't allow a zero duration
00806         if ( duration == 0 )
00807                 duration = 1;
00808 
00809         //
00810         // Movement
00811 
00812         moverState = ent->moverState;
00813 
00814         if ( moverState == MOVER_POS1 || moverState == MOVER_2TO1 )
00815         {
00816                 VectorCopy( ent->r.currentOrigin, ent->pos1 );
00817                 VectorCopy( origin, ent->pos2 );
00818 
00819                 moverState = MOVER_1TO2;
00820         }
00821         else
00822         {
00823                 VectorCopy( ent->r.currentOrigin, ent->pos2 );
00824                 VectorCopy( origin, ent->pos1 );
00825 
00826                 moverState = MOVER_2TO1;
00827         }
00828 
00829         InitMoverTrData( ent );
00830 
00831         ent->s.pos.trDuration = duration;
00832 
00833         // start it going
00834         MatchTeam( ent, moverState, level.time );
00835         //SetMoverState( ent, moverState, level.time );
00836 
00837         //Only do the angles if specified
00838         if ( angles != NULL )
00839         {
00840                 //
00841                 // Rotation
00842 
00843                 for ( i = 0; i < 3; i++ )
00844                 {
00845                         ang[i] = AngleDelta( angles[i], ent->r.currentAngles[i] );
00846                         ent->s.apos.trDelta[i] = ( ang[i] / ( duration * 0.001f ) );
00847                 }
00848 
00849                 VectorCopy( ent->r.currentAngles, ent->s.apos.trBase );
00850 
00851                 if ( ent->alt_fire )
00852                 {
00853                         ent->s.apos.trType = TR_LINEAR_STOP;
00854                 }
00855                 else
00856                 {
00857                         ent->s.apos.trType = TR_NONLINEAR_STOP;
00858                 }
00859                 ent->s.apos.trDuration = duration;
00860 
00861                 ent->s.apos.trTime = level.time;
00862 
00863                 ent->reached = moveAndRotateCallback;
00864                 trap_ICARUS_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
00865         }
00866         else
00867         {
00868                 //Setup the last bits of information
00869                 ent->reached = moverCallback;
00870         }
00871 
00872         if ( ent->damage )
00873         {
00874                 ent->blocked = Blocked_Mover;
00875         }
00876 
00877         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
00878         // starting sound
00879         G_PlayDoorLoopSound( ent );
00880         G_PlayDoorSound( ent, BMS_START );      //??
00881 
00882         trap_LinkEntity( ent );
00883 }
00884 
00885 /*
00886 =============
00887 Q3_LerpAngles
00888 
00889 Lerps the angles to the destination value
00890 =============
00891 */
00892 void Q3_Lerp2Angles( int taskID, int entID, vec3_t angles, float duration )
00893 {
00894         gentity_t       *ent = &g_entities[entID];
00895         vec3_t          ang;
00896         int                     i;
00897 
00898         if(!ent)
00899         {
00900                 G_DebugPrint( WL_WARNING, "Q3_Lerp2Angles: invalid entID %d\n", entID);
00901                 return;
00902         }
00903         
00904         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
00905         {
00906                 G_DebugPrint( WL_ERROR, "Q3_Lerp2Angles: ent %d is NOT a mover!\n", entID);
00907                 return;
00908         }
00909 
00910         //If we want an instant move, don't send 0...
00911         ent->s.apos.trDuration = (duration>0) ? duration : 1;
00912 
00913         for ( i = 0; i < 3; i++ )
00914         {
00915                 ang [i] = AngleSubtract( angles[i], ent->r.currentAngles[i]);
00916                 ent->s.apos.trDelta[i] = ( ang[i] / ( ent->s.apos.trDuration * 0.001f ) );
00917         }
00918 
00919         VectorCopy( ent->r.currentAngles, ent->s.apos.trBase );
00920 
00921         if ( ent->alt_fire )
00922         {
00923                 ent->s.apos.trType = TR_LINEAR_STOP;
00924         }
00925         else
00926         {
00927                 ent->s.apos.trType = TR_NONLINEAR_STOP;
00928         }
00929 
00930         ent->s.apos.trTime = level.time;
00931         
00932         trap_ICARUS_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
00933 
00934         //ent->e_ReachedFunc = reachedF_NULL;
00935         ent->think = anglerCallback;
00936         ent->nextthink = level.time + duration;
00937 
00938         trap_LinkEntity( ent );
00939 }
00940 
00941 /*
00942 =============
00943 Q3_GetTag
00944 
00945 Gets the value of a tag by the give name
00946 =============
00947 */
00948 int     Q3_GetTag( int entID, const char *name, int lookup, vec3_t info )
00949 {
00950         gentity_t       *ent = &g_entities[entID];
00951 
00952         if (!ent->inuse)
00953         {
00954                 assert(0);
00955                 return 0;
00956         }
00957 
00958         switch ( lookup )
00959         {
00960         case TYPE_ORIGIN:
00961                 return TAG_GetOrigin( ent->ownername, name, info );
00962                 break;
00963 
00964         case TYPE_ANGLES:
00965                 return TAG_GetAngles( ent->ownername, name, info );
00966                 break;  
00967         }
00968 
00969         return 0;
00970 }
00971 
00972 //-----------------------------------------------
00973 
00974 /*
00975 ============
00976 Q3_Use
00977 
00978 Uses an entity
00979 ============
00980 */
00981 void Q3_Use( int entID, const char *target )
00982 {
00983         gentity_t       *ent  = &g_entities[entID];
00984         
00985         if ( !ent )
00986         {
00987                 G_DebugPrint( WL_WARNING, "Q3_Use: invalid entID %d\n", entID);
00988                 return;
00989         }
00990 
00991         if( !target || !target[0] )
00992         {
00993                 G_DebugPrint( WL_WARNING, "Q3_Use: string is NULL!\n" );
00994                 return;
00995         }
00996 
00997         G_UseTargets2(ent, ent, target);
00998 }
00999 
01000 /*
01001 ============
01002 Q3_Kill
01003   Description   : 
01004   Return type   : void 
01005   Argument              :  int entID
01006   Argument              : const char *name
01007 ============
01008 */
01009 void Q3_Kill( int entID, const char *name )
01010 {
01011         gentity_t       *ent = &g_entities[entID];
01012         gentity_t       *victim = NULL;
01013         int                     o_health;
01014 
01015         if( !Q_stricmp( name, "self") )
01016         {
01017                 victim = ent;
01018         }
01019         else if( !Q_stricmp( name, "enemy" ) )
01020         {
01021                 victim = ent->enemy;
01022         }
01023         else
01024         {
01025                 victim = G_Find (NULL, FOFS(targetname), (char *) name );
01026         }
01027 
01028         if ( !victim )
01029         {
01030                 G_DebugPrint( WL_WARNING, "Q3_Kill: can't find %s\n", name);
01031                 return;
01032         }
01033 
01034         //rww - I guess this would only apply to NPCs anyway. I'm not going to bother.
01035         //if ( victim == ent )
01036         //{//don't ICARUS_FreeEnt me, I'm in the middle of a script!  (FIXME: shouldn't ICARUS handle this internally?)
01037         //      victim->svFlags |= SVF_KILLED_SELF;
01038         //}
01039 
01040         o_health = victim->health;
01041         victim->health = 0;
01042         if ( victim->client )
01043         {
01044                 victim->flags |= FL_NO_KNOCKBACK;
01045         }
01046         //G_SetEnemy(victim, ent);
01047         if( victim->die != NULL )       // check can be omitted
01048         {
01049                 //GEntity_DieFunc( victim, NULL, NULL, o_health, MOD_UNKNOWN );
01050                 victim->die(victim, victim, victim, o_health, MOD_UNKNOWN);
01051         }
01052 }
01053 
01054 /*
01055 ============
01056 Q3_RemoveEnt
01057   Description   : 
01058   Return type   : void 
01059   Argument              : sharedEntity_t *victim
01060 ============
01061 */
01062 void Q3_RemoveEnt( gentity_t *victim )
01063 {
01064         if( victim->client )
01065         {
01066                 if ( victim->s.eType != ET_NPC )
01067                 {
01068                         G_DebugPrint( WL_WARNING, "Q3_RemoveEnt: You can't remove clients in MP!\n" );
01069                         assert(0); //can't remove clients in MP
01070                 }
01071                 else
01072                 {//remove the NPC
01073                         if ( victim->client->NPC_class == CLASS_VEHICLE )
01074                         {//eject everyone out of a vehicle that's about to remove itself
01075                                 Vehicle_t *pVeh = victim->m_pVehicle;
01076                                 if ( pVeh && pVeh->m_pVehicleInfo )
01077                                 {
01078                                         pVeh->m_pVehicleInfo->EjectAll( pVeh );
01079                                 }
01080                         }
01081                         victim->think = G_FreeEntity;
01082                         victim->nextthink = level.time + 100;
01083                 }
01084                 /*
01085                 //ClientDisconnect(ent);
01086                 victim->s.eFlags |= EF_NODRAW;
01087                 victim->s.eType = ET_INVISIBLE;
01088                 victim->contents = 0;
01089                 victim->health = 0;
01090                 victim->targetname = NULL;
01091 
01092                 if ( victim->NPC && victim->NPC->tempGoal != NULL )
01093                 {
01094                         G_FreeEntity( victim->NPC->tempGoal );
01095                         victim->NPC->tempGoal = NULL;
01096                 }
01097                 if ( victim->client->ps.saberEntityNum != ENTITYNUM_NONE && victim->client->ps.saberEntityNum > 0 )
01098                 {
01099                         if ( g_entities[victim->client->ps.saberEntityNum].inuse )
01100                         {
01101                                 G_FreeEntity( &g_entities[victim->client->ps.saberEntityNum] );
01102                         }
01103                         victim->client->ps.saberEntityNum = ENTITYNUM_NONE;
01104                 }
01105                 //Disappear in half a second
01106                 victim->e_ThinkFunc = thinkF_G_FreeEntity;
01107                 victim->nextthink = level.time + 500;
01108                 return;
01109                 */
01110         }
01111         else
01112         {
01113                 victim->think = G_FreeEntity;
01114                 victim->nextthink = level.time + 100;
01115         }
01116 }
01117 
01118 
01119 /*
01120 ============
01121 Q3_Remove
01122   Description   : 
01123   Return type   : void 
01124   Argument              :  int entID
01125   Argument              : const char *name
01126 ============
01127 */
01128 void Q3_Remove( int entID, const char *name )
01129 {
01130         gentity_t *ent = &g_entities[entID];
01131         gentity_t       *victim = NULL;
01132 
01133         if( !Q_stricmp( "self", name ) )
01134         {
01135                 victim = ent;
01136                 if ( !victim )
01137                 {
01138                         G_DebugPrint( WL_WARNING, "Q3_Remove: can't find %s\n", name );
01139                         return;
01140                 }
01141                 Q3_RemoveEnt( victim );
01142         }
01143         else if( !Q_stricmp( "enemy", name ) )
01144         {
01145                 victim = ent->enemy;
01146                 if ( !victim )
01147                 {
01148                         G_DebugPrint( WL_WARNING, "Q3_Remove: can't find %s\n", name );
01149                         return;
01150                 }
01151                 Q3_RemoveEnt( victim );
01152         }
01153         else
01154         {
01155                 victim = G_Find( NULL, FOFS(targetname), (char *) name );
01156                 if ( !victim )
01157                 {
01158                         G_DebugPrint( WL_WARNING, "Q3_Remove: can't find %s\n", name );
01159                         return;
01160                 }
01161 
01162                 while ( victim )
01163                 {
01164                         Q3_RemoveEnt( victim );
01165                         victim = G_Find( victim, FOFS(targetname), (char *) name );
01166                 }
01167         }
01168 }
01169 
01170 /*
01171 =================================================
01172 
01173   Get / Set Functions
01174 
01175 =================================================
01176 */
01177 
01178 /*
01179 ============
01180 Q3_GetFloat
01181   Description   : 
01182   Return type   : int 
01183   Argument              :  int entID
01184   Argument              : int type
01185   Argument              : const char *name
01186   Argument              : float *value
01187 ============
01188 */
01189 int Q3_GetFloat( int entID, int type, const char *name, float *value )
01190 {
01191         gentity_t       *ent = &g_entities[entID];
01192         int toGet = 0;
01193 
01194         if ( !ent )
01195         {
01196                 return 0;
01197         }
01198 
01199         toGet = GetIDForString( setTable, name );       //FIXME: May want to make a "getTable" as well
01200         //FIXME: I'm getting really sick of these huge switch statements!
01201 
01202         //NOTENOTE: return true if the value was correctly obtained
01203         switch ( toGet )
01204         {
01205         case SET_PARM1:
01206         case SET_PARM2:
01207         case SET_PARM3:
01208         case SET_PARM4:
01209         case SET_PARM5:
01210         case SET_PARM6:
01211         case SET_PARM7:
01212         case SET_PARM8:
01213         case SET_PARM9:
01214         case SET_PARM10:
01215         case SET_PARM11:
01216         case SET_PARM12:
01217         case SET_PARM13:
01218         case SET_PARM14:
01219         case SET_PARM15:
01220         case SET_PARM16:
01221                 if (ent->parms == NULL)
01222                 {
01223                         G_DebugPrint( WL_ERROR, "GET_PARM: %s %s did not have any parms set!\n", ent->classname, ent->targetname );
01224                         return 0;       // would prefer qfalse, but I'm fitting in with what's here <sigh>
01225                 }
01226                 *value = atof( ent->parms->parm[toGet - SET_PARM1] );
01227                 break;
01228         
01229         case SET_COUNT:
01230                 *value = ent->count;
01231                 break;
01232 
01233         case SET_HEALTH:
01234                 *value = ent->health;
01235                 break;
01236 
01237         case SET_SKILL:
01238                 return 0;
01239                 break;
01240 
01241         case SET_XVELOCITY://## %f="0.0" # Velocity along X axis
01242                 if ( ent->client == NULL )
01243                 {
01244                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_XVELOCITY, %s not a client\n", ent->targetname );
01245                         return 0;
01246                 }
01247                 *value = ent->client->ps.velocity[0];
01248                 break;
01249 
01250         case SET_YVELOCITY://## %f="0.0" # Velocity along Y axis
01251                 if ( ent->client == NULL )
01252                 {
01253                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_YVELOCITY, %s not a client\n", ent->targetname );
01254                         return 0;
01255                 }
01256                 *value = ent->client->ps.velocity[1];
01257                 break;
01258 
01259         case SET_ZVELOCITY://## %f="0.0" # Velocity along Z axis
01260                 if ( ent->client == NULL )
01261                 {
01262                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_ZVELOCITY, %s not a client\n", ent->targetname );
01263                         return 0;
01264                 }
01265                 *value = ent->client->ps.velocity[2];
01266                 break;
01267 
01268         case SET_Z_OFFSET:
01269                 *value = ent->r.currentOrigin[2] - ent->s.origin[2];
01270                 break;
01271 
01272         case SET_DPITCH://## %f="0.0" # Pitch for NPC to turn to
01273                 return 0;
01274                 break;
01275 
01276         case SET_DYAW://## %f="0.0" # Yaw for NPC to turn to
01277                 return 0;
01278                 break;
01279 
01280         case SET_WIDTH://## %f="0.0" # Width of NPC bounding box
01281                 *value = ent->r.mins[0];
01282                 break;
01283         case SET_TIMESCALE://## %f="0.0" # Speed-up slow down game (0 - 1.0)
01284                 return 0;
01285                 break;
01286         case SET_CAMERA_GROUP_Z_OFS://## %s="NULL" # all ents with this cameraGroup will be focused on
01287                 return 0;
01288                 break;
01289 
01290         case SET_VISRANGE://## %f="0.0" # How far away NPC can see
01291                 return 0;
01292                 break;
01293 
01294         case SET_EARSHOT://## %f="0.0" # How far an NPC can hear
01295                 return 0;
01296                 break;
01297 
01298         case SET_VIGILANCE://## %f="0.0" # How often to look for enemies (0 - 1.0)
01299                 return 0;
01300                 break;
01301 
01302         case SET_GRAVITY://## %f="0.0" # Change this ent's gravity - 800 default
01303                 *value = g_gravity.value;
01304                 break;
01305 
01306         case SET_FACEEYESCLOSED:
01307         case SET_FACEEYESOPENED:
01308         case SET_FACEAUX:               //## %f="0.0" # Set face to Aux expression for number of seconds
01309         case SET_FACEBLINK:             //## %f="0.0" # Set face to Blink expression for number of seconds
01310         case SET_FACEBLINKFROWN:        //## %f="0.0" # Set face to Blinkfrown expression for number of seconds
01311         case SET_FACEFROWN:             //## %f="0.0" # Set face to Frown expression for number of seconds
01312         case SET_FACENORMAL:            //## %f="0.0" # Set face to Normal expression for number of seconds
01313                 G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_FACE___ not implemented\n" );
01314                 return 0;
01315                 break;
01316         case SET_WAIT:          //## %f="0.0" # Change an entity's wait field
01317                 *value = ent->wait;
01318                 break;
01319         case SET_FOLLOWDIST:            //## %f="0.0" # How far away to stay from leader in BS_FOLLOW_LEADER
01320                 return 0;
01321                 break;
01322         //# #sep ints
01323         case SET_ANIM_HOLDTIME_LOWER://## %d="0" # Hold lower anim for number of milliseconds
01324                 if ( ent->client == NULL )
01325                 {
01326                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_ANIM_HOLDTIME_LOWER, %s not a client\n", ent->targetname );
01327                         return 0;
01328                 }
01329                 *value = ent->client->ps.legsTimer;
01330                 break;
01331         case SET_ANIM_HOLDTIME_UPPER://## %d="0" # Hold upper anim for number of milliseconds
01332                 if ( ent->client == NULL )
01333                 {
01334                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_ANIM_HOLDTIME_UPPER, %s not a client\n", ent->targetname );
01335                         return 0;
01336                 }
01337                 *value = ent->client->ps.torsoTimer;
01338                 break;
01339         case SET_ANIM_HOLDTIME_BOTH://## %d="0" # Hold lower and upper anims for number of milliseconds
01340                 G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_ANIM_HOLDTIME_BOTH not implemented\n" );
01341                 return 0;
01342                 break;
01343         case SET_ARMOR://## %d="0" # Change armor
01344                 if ( ent->client == NULL )
01345                 {
01346                         G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_ARMOR, %s not a client\n", ent->targetname );
01347                         return 0;
01348                 }
01349                 *value = ent->client->ps.stats[STAT_ARMOR];
01350                 break;
01351         case SET_WALKSPEED://## %d="0" # Change walkSpeed
01352                 return 0;
01353                 break;
01354         case SET_RUNSPEED://## %d="0" # Change runSpeed
01355                 return 0;
01356                 break;
01357         case SET_YAWSPEED://## %d="0" # Change yawSpeed
01358                 return 0;
01359                 break;
01360         case SET_AGGRESSION://## %d="0" # Change aggression 1-5
01361                 return 0;
01362                 break;
01363         case SET_AIM://## %d="0" # Change aim 1-5
01364                 return 0;
01365                 break;
01366         case SET_FRICTION://## %d="0" # Change ent's friction - 6 default
01367                 return 0;
01368                 break;
01369         case SET_SHOOTDIST://## %d="0" # How far the ent can shoot - 0 uses weapon
01370                 return 0;
01371                 break;
01372         case SET_HFOV://## %d="0" # Horizontal field of view
01373                 return 0;
01374                 break;
01375         case SET_VFOV://## %d="0" # Vertical field of view
01376                 return 0;
01377                 break;
01378         case SET_DELAYSCRIPTTIME://## %d="0" # How many seconds to wait before running delayscript
01379                 return 0;
01380                 break;
01381         case SET_FORWARDMOVE://## %d="0" # NPC move forward -127(back) to 127
01382                 return 0;
01383                 break;
01384         case SET_RIGHTMOVE://## %d="0" # NPC move right -127(left) to 127
01385                 return 0;
01386                 break;
01387         case SET_STARTFRAME:    //## %d="0" # frame to start animation sequence on
01388                 return 0;
01389                 break;
01390         case SET_ENDFRAME:      //## %d="0" # frame to end animation sequence on
01391                 return 0;
01392                 break;
01393         case SET_ANIMFRAME:     //## %d="0" # of current frame
01394                 return 0;
01395                 break;
01396 
01397         case SET_SHOT_SPACING://## %d="1000" # Time between shots for an NPC - reset to defaults when changes weapon
01398                 return 0;
01399                 break;
01400         case SET_MISSIONSTATUSTIME://## %d="0" # Amount of time until Mission Status should be shown after death
01401                 return 0;
01402                 break;
01403         //# #sep booleans
01404         case SET_IGNOREPAIN://## %t="BOOL_TYPES" # Do not react to pain
01405                 return 0;
01406                 break;
01407         case SET_IGNOREENEMIES://## %t="BOOL_TYPES" # Do not acquire enemies
01408                 return 0;
01409                 break;
01410         case SET_IGNOREALERTS://## Do not get enemy set by allies in area(ambush)
01411                 return 0;
01412                 break;
01413         case SET_DONTSHOOT://## %t="BOOL_TYPES" # Others won't shoot you
01414                 return 0;
01415                 break;
01416         case SET_NOTARGET://## %t="BOOL_TYPES" # Others won't pick you as enemy
01417                 *value = (ent->flags&FL_NOTARGET);
01418                 break;
01419         case SET_DONTFIRE://## %t="BOOL_TYPES" # Don't fire your weapon
01420                 return 0;
01421                 break;
01422 
01423         case SET_LOCKED_ENEMY://## %t="BOOL_TYPES" # Keep current enemy until dead
01424                 return 0;
01425                 break;
01426         case SET_CROUCHED://## %t="BOOL_TYPES" # Force NPC to crouch
01427                 return 0;
01428                 break;
01429         case SET_WALKING://## %t="BOOL_TYPES" # Force NPC to move at walkSpeed
01430                 return 0;
01431                 break;
01432         case SET_RUNNING://## %t="BOOL_TYPES" # Force NPC to move at runSpeed
01433                 return 0;
01434                 break;
01435         case SET_CHASE_ENEMIES://## %t="BOOL_TYPES" # NPC will chase after enemies
01436                 return 0;
01437                 break;
01438         case SET_LOOK_FOR_ENEMIES://## %t="BOOL_TYPES" # NPC will be on the lookout for enemies
01439                 return 0;
01440                 break;
01441         case SET_FACE_MOVE_DIR://## %t="BOOL_TYPES" # NPC will face in the direction it's moving
01442                 return 0;
01443                 break;
01444         case SET_FORCED_MARCH://## %t="BOOL_TYPES" # Force NPC to move at runSpeed
01445                 return 0;
01446                 break;
01447         case SET_UNDYING://## %t="BOOL_TYPES" # Can take damage down to 1 but not die
01448                 return 0;
01449                 break;
01450         case SET_NOAVOID://## %t="BOOL_TYPES" # Will not avoid other NPCs or architecture
01451                 return 0;
01452                 break;
01453 
01454         case SET_SOLID://## %t="BOOL_TYPES" # Make yourself notsolid or solid
01455                 *value = ent->r.contents;
01456                 break;
01457         case SET_PLAYER_USABLE://## %t="BOOL_TYPES" # Can be activateby the player's "use" button
01458                 *value = (ent->r.svFlags&SVF_PLAYER_USABLE);
01459                 break;
01460         case SET_LOOP_ANIM://## %t="BOOL_TYPES" # For non-NPCs: loop your animation sequence
01461                 return 0;
01462                 break;
01463         case SET_INTERFACE://## %t="BOOL_TYPES" # Player interface on/off
01464                 G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_INTERFACE not implemented\n" );
01465                 return 0;
01466                 break;
01467         case SET_SHIELDS://## %t="BOOL_TYPES" # NPC has no shields (Borg do not adapt)
01468                 return 0;
01469                 break;
01470         case SET_INVISIBLE://## %t="BOOL_TYPES" # Makes an NPC not solid and not visible
01471                 *value = (ent->s.eFlags&EF_NODRAW);
01472                 break;
01473         case SET_VAMPIRE://## %t="BOOL_TYPES" # Makes an NPC not solid and not visible
01474                 return 0;
01475                 break;
01476         case SET_FORCE_INVINCIBLE://## %t="BOOL_TYPES" # Makes an NPC not solid and not visible
01477                 return 0;
01478                 break;
01479         case SET_GREET_ALLIES://## %t="BOOL_TYPES" # Makes an NPC greet teammates
01480                 return 0;
01481                 break;
01482         case SET_VIDEO_FADE_IN://## %t="BOOL_TYPES" # Makes video playback fade in
01483                 G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_VIDEO_FADE_IN not implemented\n" );
01484                 return 0;
01485                 break;
01486         case SET_VIDEO_FADE_OUT://## %t="BOOL_TYPES" # Makes video playback fade out
01487                 G_DebugPrint( WL_WARNING, "Q3_GetFloat: SET_VIDEO_FADE_OUT not implemented\n" );
01488                 return 0;
01489                 break;
01490         case SET_PLAYER_LOCKED://## %t="BOOL_TYPES" # Makes it so player cannot move
01491                 return 0;
01492                 break;
01493         case SET_LOCK_PLAYER_WEAPONS://## %t="BOOL_TYPES" # Makes it so player cannot switch weapons
01494                 return 0;
01495                 break;
01496         case SET_NO_IMPACT_DAMAGE://## %t="BOOL_TYPES" # Makes it so player cannot switch weapons
01497                 return 0;
01498                 break;
01499         case SET_NO_KNOCKBACK://## %t="BOOL_TYPES" # Stops this ent from taking knockback from weapons
01500                 *value = (ent->flags&FL_NO_KNOCKBACK);
01501                 break;
01502         case SET_ALT_FIRE://## %t="BOOL_TYPES" # Force NPC to use altfire when shooting
01503                 return 0;
01504                 break;
01505         case SET_NO_RESPONSE://## %t="BOOL_TYPES" # NPCs will do generic responses when this is on (usescripts override generic responses as well)
01506                 return 0;
01507                 break;
01508         case SET_INVINCIBLE://## %t="BOOL_TYPES" # Completely unkillable
01509                 *value = (ent->flags&FL_GODMODE);
01510                 break;
01511         case SET_MISSIONSTATUSACTIVE:   //# Turns on Mission Status Screen
01512                 return 0;
01513                 break;
01514         case SET_NO_COMBAT_TALK://## %t="BOOL_TYPES" # NPCs will not do their combat talking noises when this is on
01515                 return 0;
01516                 break;
01517         case SET_NO_ALERT_TALK://## %t="BOOL_TYPES" # NPCs will not do their combat talking noises when this is on
01518                 return 0;
01519                 break;
01520         case SET_USE_CP_NEAREST://## %t="BOOL_TYPES" # NPCs will use their closest combat points, not try and find ones next to the player, or flank player
01521                 return 0;
01522                 break;
01523         case SET_DISMEMBERABLE://## %t="BOOL_TYPES" # NPC will not be affected by force powers
01524                 return 0;
01525                 break;
01526         case SET_NO_FORCE:
01527                 return 0;
01528                 break;
01529         case SET_NO_ACROBATICS:
01530                 return 0;
01531                 break;
01532         case SET_USE_SUBTITLES:
01533                 return 0;
01534                 break;
01535         case SET_NO_FALLTODEATH://## %t="BOOL_TYPES" # NPC will not be affected by force powers
01536                 return 0;
01537                 break;
01538         case SET_MORELIGHT://## %t="BOOL_TYPES" # NPCs will use their closest combat points, not try and find ones next to the player, or flank player
01539                 return 0;
01540                 break;
01541         case SET_TREASONED://## %t="BOOL_TYPES" # Player has turned on his own- scripts will stop: NPCs will turn on him and level changes load the brig
01542                 return 0;
01543                 break;
01544         case SET_DISABLE_SHADER_ANIM:   //## %t="BOOL_TYPES" # Shaders won't animate
01545                 return 0;
01546                 break;
01547         case SET_SHADER_ANIM:   //## %t="BOOL_TYPES" # Shader will be under frame control
01548                 return 0;
01549                 break;
01550 
01551         default:
01552                 if ( trap_ICARUS_VariableDeclared( name ) != VTYPE_FLOAT )
01553                         return 0;
01554 
01555                 return trap_ICARUS_GetFloatVariable( name, value );
01556         }
01557 
01558         return 1;
01559 }
01560 
01561 
01562 /*
01563 ============
01564 Q3_GetVector
01565   Description   : 
01566   Return type   : int 
01567   Argument              :  int entID
01568   Argument              : int type
01569   Argument              : const char *name
01570   Argument              : vec3_t value
01571 ============
01572 */
01573 int Q3_GetVector( int entID, int type, const char *name, vec3_t value )
01574 {
01575         gentity_t       *ent = &g_entities[entID];
01576         int toGet = 0;
01577         if ( !ent )
01578         {
01579                 return 0;
01580         }
01581 
01582         toGet = GetIDForString( setTable, name );       //FIXME: May want to make a "getTable" as well
01583         //FIXME: I'm getting really sick of these huge switch statements!
01584 
01585         //NOTENOTE: return true if the value was correctly obtained
01586         switch ( toGet )
01587         {
01588         case SET_PARM1:
01589         case SET_PARM2:
01590         case SET_PARM3:
01591         case SET_PARM4:
01592         case SET_PARM5:
01593         case SET_PARM6:
01594         case SET_PARM7:
01595         case SET_PARM8:
01596         case SET_PARM9:
01597         case SET_PARM10:
01598         case SET_PARM11:
01599         case SET_PARM12:
01600         case SET_PARM13:
01601         case SET_PARM14:
01602         case SET_PARM15:
01603         case SET_PARM16:
01604                 sscanf( ent->parms->parm[toGet - SET_PARM1], "%f %f %f", &value[0], &value[1], &value[2] );
01605                 break;
01606 
01607         case SET_ORIGIN:
01608                 VectorCopy(ent->r.currentOrigin, value);
01609                 break;
01610 
01611         case SET_ANGLES:
01612                 VectorCopy(ent->r.currentAngles, value);
01613                 break;
01614         
01615         case SET_TELEPORT_DEST://## %v="0.0 0.0 0.0" # Set origin here as soon as the area is clear
01616                 G_DebugPrint( WL_WARNING, "Q3_GetVector: SET_TELEPORT_DEST not implemented\n" );
01617                 return 0;
01618                 break;
01619 
01620         default:
01621 
01622                 if ( trap_ICARUS_VariableDeclared( name ) != VTYPE_VECTOR )
01623                         return 0;
01624 
01625                 return trap_ICARUS_GetVectorVariable( name, value );
01626         }
01627 
01628         return 1;
01629 }
01630 
01631 /*
01632 ============
01633 Q3_GetString
01634   Description   : 
01635   Return type   : int 
01636   Argument              :  int entID
01637   Argument              : int type
01638   Argument              : const char *name
01639   Argument              : char **value
01640 ============
01641 */
01642 int Q3_GetString( int entID, int type, const char *name, char **value )
01643 {
01644         gentity_t       *ent = &g_entities[entID];
01645         int toGet = 0;
01646         if ( !ent )
01647         {
01648                 return 0;
01649         }
01650 
01651         toGet = GetIDForString( setTable, name );       //FIXME: May want to make a "getTable" as well
01652 
01653         switch ( toGet )
01654         {
01655         case SET_ANIM_BOTH:
01656                 *value = (char *) Q3_GetAnimBoth( ent );
01657 
01658                 if ( !value || !value[0] )
01659                         return 0;
01660 
01661                 break;
01662 
01663         case SET_PARM1:
01664         case SET_PARM2:
01665         case SET_PARM3:
01666         case SET_PARM4:
01667         case SET_PARM5:
01668         case SET_PARM6:
01669         case SET_PARM7:
01670         case SET_PARM8:
01671         case SET_PARM9:
01672         case SET_PARM10:
01673         case SET_PARM11:
01674         case SET_PARM12:
01675         case SET_PARM13:
01676         case SET_PARM14:
01677         case SET_PARM15:
01678         case SET_PARM16:
01679                 if ( ent->parms )
01680                 {
01681                         *value = (char *) ent->parms->parm[toGet - SET_PARM1];
01682                 }
01683                 else
01684                 {
01685                         G_DebugPrint( WL_WARNING, "Q3_GetString: invalid ent %s has no parms!\n", ent->targetname );
01686                         return 0;
01687                 }
01688                 break;
01689 
01690         case SET_TARGET:
01691                 *value = (char *) ent->target;
01692                 break;
01693 
01694         case SET_LOCATION:
01695                 return 0;
01696                 break;
01697 
01698         //# #sep Scripts and other file paths
01699         case SET_SPAWNSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when spawned //0 - do not change these, these are equal to BSET_SPAWN, etc
01700                 *value = ent->behaviorSet[BSET_SPAWN];
01701                 break;
01702         case SET_USESCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when used
01703                 *value = ent->behaviorSet[BSET_USE];
01704                 break;
01705         case SET_AWAKESCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when startled
01706                 *value = ent->behaviorSet[BSET_AWAKE];
01707                 break;
01708         case SET_ANGERSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script run when find an enemy for the first time
01709                 *value = ent->behaviorSet[BSET_ANGER];
01710                 break;
01711         case SET_ATTACKSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when you shoot
01712                 *value = ent->behaviorSet[BSET_ATTACK];
01713                 break;
01714         case SET_VICTORYSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when killed someone
01715                 *value = ent->behaviorSet[BSET_VICTORY];
01716                 break;
01717         case SET_LOSTENEMYSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when you can't find your enemy
01718                 *value = ent->behaviorSet[BSET_LOSTENEMY];
01719                 break;
01720         case SET_PAINSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when hit
01721                 *value = ent->behaviorSet[BSET_PAIN];
01722                 break;
01723         case SET_FLEESCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when hit and low health
01724                 *value = ent->behaviorSet[BSET_FLEE];
01725                 break;
01726         case SET_DEATHSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when killed
01727                 *value = ent->behaviorSet[BSET_DEATH];
01728                 break;
01729         case SET_DELAYEDSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run after a delay
01730                 *value = ent->behaviorSet[BSET_DELAYED];
01731                 break;
01732         case SET_BLOCKEDSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when blocked by teammate
01733                 *value = ent->behaviorSet[BSET_BLOCKED];
01734                 break;
01735         case SET_FFIRESCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when player has shot own team repeatedly
01736                 *value = ent->behaviorSet[BSET_FFIRE];
01737                 break;
01738         case SET_FFDEATHSCRIPT://## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when player kills a teammate
01739                 *value = ent->behaviorSet[BSET_FFDEATH];
01740                 break;
01741 
01742         //# #sep Standard strings
01743         case SET_ENEMY://## %s="NULL" # Set enemy by targetname
01744                 return 0;
01745                 break;
01746         case SET_LEADER://## %s="NULL" # Set for BS_FOLLOW_LEADER
01747                 return 0;
01748                 break;
01749         case SET_CAPTURE://## %s="NULL" # Set captureGoal by targetname
01750                 return 0;
01751                 break;
01752 
01753         case SET_TARGETNAME://## %s="NULL" # Set/change your targetname
01754                 *value = ent->targetname;
01755                 break;
01756         case SET_PAINTARGET://## %s="NULL" # Set/change what to use when hit
01757                 return 0;
01758                 break;
01759         case SET_CAMERA_GROUP://## %s="NULL" # all ents with this cameraGroup will be focused on
01760                 return 0;
01761                 break;
01762         case SET_CAMERA_GROUP_TAG://## %s="NULL" # all ents with this cameraGroup will be focused on
01763                 return 0;
01764                 break;
01765         case SET_LOOK_TARGET://## %s="NULL" # object for NPC to look at
01766                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_LOOK_TARGET, NOT SUPPORTED IN MULTIPLAYER\n" );
01767                 break;
01768         case SET_TARGET2://## %s="NULL" # Set/change your target2: on NPC's: this fires when they're knocked out by the red hypo
01769                 return 0;
01770                 break;
01771 
01772         case SET_REMOVE_TARGET://## %s="NULL" # Target that is fired when someone completes the BS_REMOVE behaviorState
01773                 return 0;
01774                 break;
01775         case SET_WEAPON:
01776                 return 0;
01777                 break;
01778 
01779         case SET_ITEM:
01780                 return 0;
01781                 break;
01782         case SET_MUSIC_STATE:
01783                 return 0;
01784                 break;
01785         //The below cannot be gotten
01786         case SET_NAVGOAL://## %s="NULL" # *Move to this navgoal then continue script
01787                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_NAVGOAL not implemented\n" );
01788                 return 0;
01789                 break;
01790         case SET_VIEWTARGET://## %s="NULL" # Set angles toward ent by targetname
01791                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_VIEWTARGET not implemented\n" );
01792                 return 0;
01793                 break;
01794         case SET_WATCHTARGET://## %s="NULL" # Set angles toward ent by targetname
01795                 return 0;
01796                 break;
01797         case SET_VIEWENTITY:
01798                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_VIEWENTITY not implemented\n" );
01799                 return 0;
01800                 break;
01801         case SET_CAPTIONTEXTCOLOR:      //## %s=""  # Color of text RED:WHITE:BLUE: YELLOW
01802                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_CAPTIONTEXTCOLOR not implemented\n" );
01803                 return 0;
01804                 break;
01805         case SET_CENTERTEXTCOLOR:       //## %s=""  # Color of text RED:WHITE:BLUE: YELLOW
01806                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_CENTERTEXTCOLOR not implemented\n" );
01807                 return 0;
01808                 break;
01809         case SET_SCROLLTEXTCOLOR:       //## %s=""  # Color of text RED:WHITE:BLUE: YELLOW
01810                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_SCROLLTEXTCOLOR not implemented\n" );
01811                 return 0;
01812                 break;
01813         case SET_COPY_ORIGIN://## %s="targetname"  # Copy the origin of the ent with targetname to your origin
01814                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_COPY_ORIGIN not implemented\n" );
01815                 return 0;
01816                 break;
01817         case SET_DEFEND_TARGET://## %s="targetname"  # This NPC will attack the target NPC's enemies
01818                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_COPY_ORIGIN not implemented\n" );
01819                 return 0;
01820                 break;
01821         case SET_VIDEO_PLAY://## %s="filename" !!"W:\game\base\video\!!#*.roq" # Play a Video (inGame)
01822                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_VIDEO_PLAY not implemented\n" );
01823                 return 0;
01824                 break;
01825         case SET_LOADGAME://## %s="exitholodeck" # Load the savegame that was auto-saved when you started the holodeck
01826                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_LOADGAME not implemented\n" );
01827                 return 0;
01828                 break;
01829         case SET_LOCKYAW://## %s="off"  # Lock legs to a certain yaw angle (or "off" or "auto" uses current)
01830                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_LOCKYAW not implemented\n" );
01831                 return 0;
01832                 break;
01833         case SET_SCROLLTEXT:    //## %s="" # key of text string to print
01834                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_SCROLLTEXT not implemented\n" );
01835                 return 0;
01836                 break;
01837         case SET_LCARSTEXT:     //## %s="" # key of text string to print in LCARS frame
01838                 G_DebugPrint( WL_WARNING, "Q3_GetString: SET_LCARSTEXT not implemented\n" );
01839                 return 0;
01840                 break;
01841 
01842         case SET_FULLNAME://## %s="NULL" # Set/change your targetname
01843                 *value = ent->fullName;
01844                 break;
01845         default:
01846 
01847                 if ( trap_ICARUS_VariableDeclared( name ) != VTYPE_STRING )
01848                         return 0;
01849 
01850                 return trap_ICARUS_GetStringVariable( name, (const char *) *value );
01851         }
01852 
01853         return 1;
01854 }
01855 
01856 /*
01857 ============
01858 MoveOwner
01859   Description   : 
01860   Return type   : void 
01861   Argument              : sharedEntity_t *self
01862 ============
01863 */
01864 qboolean SpotWouldTelefrag2( gentity_t *mover, vec3_t dest );
01865 void MoveOwner( gentity_t *self )
01866 {
01867         gentity_t *owner = &g_entities[self->r.ownerNum];
01868 
01869         self->nextthink = level.time + FRAMETIME;
01870         self->think = G_FreeEntity;
01871 
01872         if ( !owner || !owner->inuse )
01873         {
01874                 return;
01875         }
01876 
01877         if ( SpotWouldTelefrag2( owner, self->r.currentOrigin ) )
01878         {
01879                 self->think = MoveOwner;
01880         }
01881         else
01882         {
01883                 G_SetOrigin( owner, self->r.currentOrigin );
01884                 trap_ICARUS_TaskIDComplete( owner, TID_MOVE_NAV );
01885         }
01886 }
01887 
01888 /*
01889 =============
01890 Q3_SetTeleportDest
01891 
01892 Copies passed origin to ent running script once there is nothing there blocking the spot
01893 =============
01894 */
01895 static qboolean Q3_SetTeleportDest( int entID, vec3_t org )
01896 {
01897         gentity_t       *teleEnt = &g_entities[entID];
01898 
01899         if ( teleEnt )
01900         {
01901                 if ( SpotWouldTelefrag2( teleEnt, org ) )
01902                 {
01903                         gentity_t *teleporter = G_Spawn();
01904 
01905                         G_SetOrigin( teleporter, org );
01906                         teleporter->r.ownerNum = teleEnt->s.number;
01907 
01908                         teleporter->think = MoveOwner;
01909                         teleporter->nextthink = level.time + FRAMETIME;
01910                         
01911                         return qfalse;
01912                 }
01913                 else
01914                 {
01915                         G_SetOrigin( teleEnt, org );
01916                 }
01917         }
01918 
01919         return qtrue;
01920 }
01921 
01922 /*
01923 =============
01924 Q3_SetOrigin
01925 
01926 Sets the origin of an entity directly
01927 =============
01928 */
01929 static void Q3_SetOrigin( int entID, vec3_t origin )
01930 {
01931         gentity_t       *ent = &g_entities[entID];
01932 
01933         if ( !ent )
01934         {
01935                 G_DebugPrint( WL_WARNING, "Q3_SetOrigin: bad ent %d\n", entID);
01936                 return;
01937         }
01938 
01939         trap_UnlinkEntity (ent);
01940 
01941         if(ent->client)
01942         {
01943                 VectorCopy(origin, ent->client->ps.origin);
01944                 VectorCopy(origin, ent->r.currentOrigin);
01945                 ent->client->ps.origin[2] += 1;
01946 
01947                 VectorClear (ent->client->ps.velocity);
01948                 ent->client->ps.pm_time = 160;          // hold time
01949                 ent->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
01950                 
01951                 ent->client->ps.eFlags ^= EF_TELEPORT_BIT;
01952 
01953 //              G_KillBox (ent);
01954         }
01955         else
01956         {
01957                 G_SetOrigin( ent, origin );
01958         }
01959 
01960         trap_LinkEntity( ent );
01961 }
01962 
01963 /*
01964 =============
01965 Q3_SetCopyOrigin
01966 
01967 Copies origin of found ent into ent running script
01968 =============`
01969 */
01970 static void Q3_SetCopyOrigin( int entID, const char *name )
01971 {
01972         gentity_t       *found = G_Find( NULL, FOFS(targetname), (char *) name);
01973 
01974         if(found)
01975         {
01976                 Q3_SetOrigin( entID, found->r.currentOrigin );
01977                 SetClientViewAngle( &g_entities[entID], found->s.angles );
01978         }
01979         else
01980         {
01981                 G_DebugPrint( WL_WARNING, "Q3_SetCopyOrigin: ent %s not found!\n", name);
01982         }
01983 }
01984 
01985 /*
01986 =============
01987 Q3_SetVelocity
01988 
01989 Set the velocity of an entity directly
01990 =============
01991 */
01992 static void Q3_SetVelocity( int entID, int axis, float speed )
01993 {
01994         gentity_t       *found = &g_entities[entID];
01995         //FIXME: Not supported
01996         if(!found)
01997         {
01998                 G_DebugPrint( WL_WARNING, "Q3_SetVelocity invalid entID %d\n", entID);
01999                 return;
02000         }
02001 
02002         if(!found->client)
02003         {
02004                 G_DebugPrint( WL_WARNING, "Q3_SetVelocity: not a client %d\n", entID);
02005                 return;
02006         }
02007 
02008         //FIXME: add or set?
02009         found->client->ps.velocity[axis] += speed;
02010 
02011         found->client->ps.pm_time = 500;
02012         found->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
02013 }
02014 
02015 /*
02016 =============
02017 Q3_SetAngles
02018 
02019 Sets the angles of an entity directly
02020 =============
02021 */
02022 static void Q3_SetAngles( int entID, vec3_t angles )
02023 {
02024         gentity_t       *ent = &g_entities[entID];
02025 
02026 
02027         if ( !ent )
02028         {
02029                 G_DebugPrint( WL_WARNING, "Q3_SetAngles: bad ent %d\n", entID);
02030                 return;
02031         }
02032 
02033         if (ent->client)
02034         {
02035                 SetClientViewAngle( ent, angles );
02036         }
02037         else
02038         {
02039                 VectorCopy( angles, ent->s.angles );
02040         }
02041         trap_LinkEntity( ent );
02042 }
02043 
02044 /*
02045 =============
02046 Q3_Lerp2Origin
02047 
02048 Lerps the origin to the destination value
02049 =============
02050 */
02051 void Q3_Lerp2Origin( int taskID, int entID, vec3_t origin, float duration )
02052 {
02053         gentity_t       *ent = &g_entities[entID];
02054         moverState_t moverState;
02055 
02056         if(!ent)
02057         {
02058                 G_DebugPrint( WL_WARNING, "Q3_Lerp2Origin: invalid entID %d\n", entID);
02059                 return;
02060         }
02061         
02062         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
02063         {
02064                 G_DebugPrint( WL_ERROR, "Q3_Lerp2Origin: ent %d is NOT a mover!\n", entID);
02065                 return;
02066         }
02067 
02068         if ( ent->s.eType != ET_MOVER )
02069         {
02070                 ent->s.eType = ET_MOVER;
02071         }
02072 
02073         moverState = ent->moverState;
02074 
02075         if ( moverState == MOVER_POS1 || moverState == MOVER_2TO1 )
02076         {
02077                 VectorCopy( ent->r.currentOrigin, ent->pos1 );
02078                 VectorCopy( origin, ent->pos2 );
02079 
02080                 moverState = MOVER_1TO2;
02081         }
02082         else if ( moverState == MOVER_POS2 || moverState == MOVER_1TO2 )
02083         {
02084                 VectorCopy( ent->r.currentOrigin, ent->pos2 );
02085                 VectorCopy( origin, ent->pos1 );
02086 
02087                 moverState = MOVER_2TO1;
02088         }
02089 
02090         InitMoverTrData( ent ); //FIXME: This will probably break normal things that are being moved...
02091 
02092         ent->s.pos.trDuration = duration;
02093 
02094         // start it going
02095         MatchTeam( ent, moverState, level.time );
02096         //SetMoverState( ent, moverState, level.time );
02097 
02098         ent->reached = moverCallback;
02099         if ( ent->damage )
02100         {
02101                 ent->blocked = Blocked_Mover;
02102         }
02103         if ( taskID != -1 )
02104         {
02105                 trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
02106         }
02107         // starting sound
02108         G_PlayDoorLoopSound( ent );//start looping sound
02109         G_PlayDoorSound( ent, BMS_START );      //play start sound
02110 
02111         trap_LinkEntity( ent );
02112 }
02113 
02114 static void Q3_SetOriginOffset( int entID, int axis, float offset )
02115 {       
02116         gentity_t       *ent = &g_entities[entID];
02117         vec3_t origin;
02118         float duration;
02119 
02120         if(!ent)
02121         {
02122                 G_DebugPrint( WL_WARNING, "Q3_SetOriginOffset: invalid entID %d\n", entID);
02123                 return;
02124         }
02125         
02126         if ( ent->client || Q_stricmp(ent->classname, "target_scriptrunner") == 0 )
02127         {
02128                 G_DebugPrint( WL_ERROR, "Q3_SetOriginOffset: ent %d is NOT a mover!\n", entID);
02129                 return;
02130         }
02131 
02132         VectorCopy( ent->s.origin, origin );
02133         origin[axis] += offset;
02134         duration = 0;
02135         if ( ent->speed )
02136         {
02137                 duration = fabs(offset)/fabs(ent->speed)*1000.0f;
02138         }
02139         Q3_Lerp2Origin( -1, entID, origin, duration );
02140 }
02141 
02142 /*
02143 =============
02144 Q3_SetEnemy
02145 
02146 Sets the enemy of an entity
02147 =============
02148 */
02149 static void Q3_SetEnemy( int entID, const char *name )
02150 {
02151         gentity_t       *ent  = &g_entities[entID];
02152 
02153         if ( !ent )
02154         {
02155                 G_DebugPrint( WL_WARNING, "Q3_SetEnemy: invalid entID %d\n", entID);
02156                 return;
02157         }
02158 
02159         if( !Q_stricmp("NONE", name) || !Q_stricmp("NULL", name))
02160         {
02161                 if(ent->NPC)
02162                 {
02163                         G_ClearEnemy(ent);
02164                 }
02165                 else
02166                 {
02167                         ent->enemy = NULL;
02168                 }
02169         }
02170         else
02171         {
02172                 gentity_t       *enemy = G_Find( NULL, FOFS(targetname), (char *) name);
02173 
02174                 if(enemy == NULL)
02175                 {
02176                         G_DebugPrint( WL_ERROR, "Q3_SetEnemy: no such enemy: '%s'\n", name );
02177                         return;
02178                 }
02179                 /*else if(enemy->health <= 0)
02180                 {
02181                         //G_DebugPrint( WL_ERROR, "Q3_SetEnemy: ERROR - desired enemy has health %d\n", enemy->health );
02182                         return;
02183                 }*/
02184                 else
02185                 {
02186                         if(ent->NPC)
02187                         {
02188                                 G_SetEnemy( ent, enemy );
02189                                 ent->cantHitEnemyCounter = 0;
02190                         }
02191                         else
02192                         {
02193                                 G_SetEnemy(ent, enemy);
02194                         }
02195                 }
02196         }
02197 }
02198 
02199 
02200 /*
02201 =============
02202 Q3_SetLeader
02203 
02204 Sets the leader of an NPC
02205 =============
02206 */
02207 static void Q3_SetLeader( int entID, const char *name )
02208 {
02209         gentity_t       *ent  = &g_entities[entID];
02210 
02211         if ( !ent )
02212         {
02213                 G_DebugPrint( WL_WARNING, "Q3_SetLeader: invalid entID %d\n", entID);
02214                 return;
02215         }
02216 
02217         if ( !ent->client )
02218         {
02219                 G_DebugPrint( WL_ERROR, "Q3_SetLeader: ent %d is NOT a player or NPC!\n", entID);
02220                 return;
02221         }
02222 
02223         if( !Q_stricmp("NONE", name) || !Q_stricmp("NULL", name))
02224         {
02225                 ent->client->leader = NULL;
02226         }
02227         else
02228         {
02229                 gentity_t       *leader = G_Find( NULL, FOFS(targetname), (char *) name);
02230 
02231                 if(leader == NULL)
02232                 {
02233                         //G_DebugPrint( WL_ERROR,"Q3_SetEnemy: unable to locate enemy: '%s'\n", name );
02234                         return;
02235                 }
02236                 else if(leader->health <= 0)
02237                 {
02238                         //G_DebugPrint( WL_ERROR,"Q3_SetEnemy: ERROR - desired enemy has health %d\n", enemy->health );
02239                         return;
02240                 }
02241                 else
02242                 {
02243                         ent->client->leader = leader;
02244                 }
02245         }
02246 }
02247 
02248 /*
02249 =============
02250 Q3_SetNavGoal
02251 
02252 Sets the navigational goal of an entity
02253 =============
02254 */
02255 static qboolean Q3_SetNavGoal( int entID, const char *name )
02256 {
02257         gentity_t       *ent  = &g_entities[ entID ];
02258         vec3_t          goalPos;
02259 
02260         if ( !ent->health )
02261         {
02262                 G_DebugPrint( WL_ERROR, "Q3_SetNavGoal: tried to set a navgoal (\"%s\") on a corpse! \"%s\"\n", name, ent->script_targetname );
02263                 return qfalse;
02264         }
02265         if ( !ent->NPC )
02266         {
02267                 G_DebugPrint( WL_ERROR, "Q3_SetNavGoal: tried to set a navgoal (\"%s\") on a non-NPC: \"%s\"\n", name, ent->script_targetname );
02268                 return qfalse;
02269         }
02270         if ( !ent->NPC->tempGoal )
02271         {
02272                 G_DebugPrint( WL_ERROR, "Q3_SetNavGoal: tried to set a navgoal (\"%s\") on a dead NPC: \"%s\"\n", name, ent->script_targetname );
02273                 return qfalse;
02274         }
02275         if ( !ent->NPC->tempGoal->inuse )
02276         {
02277                 G_DebugPrint( WL_ERROR, "Q3_SetNavGoal: NPC's (\"%s\") navgoal is freed: \"%s\"\n", name, ent->script_targetname );
02278                 return qfalse;
02279         }
02280         if( Q_stricmp( "null", name) == 0
02281                 || Q_stricmp( "NULL", name) == 0 )
02282         {
02283                 ent->NPC->goalEntity = NULL;
02284                 trap_ICARUS_TaskIDComplete( ent, TID_MOVE_NAV );
02285                 return qfalse;
02286         }
02287         else
02288         {
02289                 //Get the position of the goal
02290                 if ( TAG_GetOrigin2( NULL, name, goalPos ) == qfalse )
02291                 {
02292                         gentity_t       *targ = G_Find(NULL, FOFS(targetname), (char*)name);
02293                         if ( !targ )
02294                         {
02295                                 G_DebugPrint( WL_ERROR, "Q3_SetNavGoal: can't find NAVGOAL \"%s\"\n", name );
02296                                 return qfalse;
02297                         }
02298                         else
02299                         {
02300                                 ent->NPC->goalEntity = targ;
02301                                 ent->NPC->goalRadius = sqrt(ent->r.maxs[0]+ent->r.maxs[0]) + sqrt(targ->r.maxs[0]+targ->r.maxs[0]);
02302                                 ent->NPC->aiFlags &= ~NPCAI_TOUCHED_GOAL;
02303                         }
02304                 }
02305                 else
02306                 {
02307                         int     goalRadius = TAG_GetRadius( NULL, name );
02308                         NPC_SetMoveGoal( ent, goalPos, goalRadius, qtrue, -1, NULL );
02309                         //We know we want to clear the lastWaypoint here
02310                         ent->NPC->goalEntity->lastWaypoint = WAYPOINT_NONE;
02311                         ent->NPC->aiFlags &= ~NPCAI_TOUCHED_GOAL;
02312         #ifdef _DEBUG
02313                         //this is *only* for debugging navigation
02314                         ent->NPC->tempGoal->target = G_NewString( name );
02315         #endif// _DEBUG
02316                 return qtrue;
02317                 }
02318         }
02319         return qfalse;
02320 }
02321 /*
02322 ============
02323 SetLowerAnim
02324   Description   : 
02325   Return type   : static void 
02326   Argument              :  int entID
02327   Argument              : int animID
02328 ============
02329 */
02330 static void SetLowerAnim( int entID, int animID)
02331 {
02332         gentity_t       *ent  = &g_entities[entID];
02333 
02334         if ( !ent )
02335         {
02336                 G_DebugPrint( WL_WARNING, "SetLowerAnim: invalid entID %d\n", entID);
02337                 return;
02338         }
02339 
02340         if ( !ent->client )
02341         {
02342                 G_DebugPrint( WL_ERROR, "SetLowerAnim: ent %d is NOT a player or NPC!\n", entID);
02343                 return;
02344         }
02345 
02346         G_SetAnim(ent,NULL,SETANIM_LEGS,animID,SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD|SETANIM_FLAG_OVERRIDE,0);
02347 }
02348 
02349 /*
02350 ============
02351 SetUpperAnim 
02352   Description   : 
02353   Return type   : static void 
02354   Argument              :  int entID
02355   Argument              : int animID
02356 ============
02357 */
02358 static void SetUpperAnim ( int entID, int animID)
02359 {
02360         gentity_t       *ent  = &g_entities[entID];
02361 
02362         if ( !ent )
02363         {
02364                 G_DebugPrint( WL_WARNING, "SetUpperAnim: invalid entID %d\n", entID);
02365                 return;
02366         }
02367 
02368         if ( !ent->client )
02369         {
02370                 G_DebugPrint( WL_ERROR, "SetLowerAnim: ent %d is NOT a player or NPC!\n", entID);
02371                 return;
02372         }
02373 
02374         G_SetAnim(ent,NULL,SETANIM_TORSO,animID,SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD|SETANIM_FLAG_OVERRIDE,0);
02375 }
02376 
02377 /*
02378 =============
02379 Q3_SetAnimUpper
02380 
02381 Sets the upper animation of an entity
02382 =============
02383 */
02384 static qboolean Q3_SetAnimUpper( int entID, const char *anim_name )
02385 {
02386         int                     animID = 0;
02387 
02388         animID = GetIDForString( animTable, anim_name );
02389 
02390         if( animID == -1 )
02391         {
02392                 G_DebugPrint( WL_WARNING, "Q3_SetAnimUpper: unknown animation sequence '%s'\n", anim_name );
02393                 return qfalse;
02394         }
02395 
02396         /*
02397         if ( !PM_HasAnimation( SV_GentityNum(entID), animID ) )
02398         {
02399                 return qfalse;
02400         }
02401         */
02402 
02403         SetUpperAnim( entID, animID );
02404         return qtrue;
02405 }
02406 
02407 /*
02408 =============
02409 Q3_SetAnimLower
02410 
02411 Sets the lower animation of an entity
02412 =============
02413 */
02414 static qboolean Q3_SetAnimLower( int entID, const char *anim_name )
02415 {
02416         int                     animID = 0;
02417 
02418         //FIXME: Setting duck anim does not actually duck!
02419 
02420         animID = GetIDForString( animTable, anim_name );
02421 
02422         if( animID == -1 )
02423         {
02424                 G_DebugPrint( WL_WARNING, "Q3_SetAnimLower: unknown animation sequence '%s'\n", anim_name );
02425                 return qfalse;
02426         }
02427         
02428         /*
02429         if ( !PM_HasAnimation( SV_GentityNum(entID), animID ) )
02430         {
02431                 return qfalse;
02432         }
02433         */
02434 
02435         SetLowerAnim( entID, animID );
02436         return qtrue;
02437 }
02438 
02439 /*
02440 ============
02441 Q3_SetAnimHoldTime
02442   Description   : 
02443   Return type   : static void 
02444   Argument              :  int entID
02445   Argument              : int int_data
02446   Argument              : qboolean lower
02447 ============
02448 */
02449 static void Q3_SetAnimHoldTime( int entID, int int_data, qboolean lower )
02450 {
02451         G_DebugPrint( WL_WARNING, "Q3_SetAnimHoldTime is not currently supported in MP\n");
02452         /*
02453         gentity_t       *ent  = &g_entities[entID];
02454 
02455         if ( !ent )
02456         {
02457                 G_DebugPrint( WL_WARNING, "Q3_SetAnimHoldTime: invalid entID %d\n", entID);
02458                 return;
02459         }
02460 
02461         if ( !ent->client )
02462         {
02463                 G_DebugPrint( WL_ERROR, "Q3_SetAnimHoldTime: ent %d is NOT a player or NPC!\n", entID);
02464                 return;
02465         }
02466         
02467         if(lower)
02468         {
02469                 PM_SetLegsAnimTimer( ent, &ent->client->ps.legsAnimTimer, int_data );
02470         }
02471         else
02472         {
02473                 PM_SetTorsoAnimTimer( ent, &ent->client->ps.torsoAnimTimer, int_data );
02474         }
02475         */
02476 }
02477 
02478 /*
02479 ============
02480 Q3_SetHealth
02481   Description   : 
02482   Return type   : static void 
02483   Argument              :  int entID
02484   Argument              : int data
02485 ============
02486 */
02487 static void Q3_SetHealth( int entID, int data )
02488 {
02489         gentity_t       *ent  = &g_entities[entID];
02490 
02491         if ( !ent )
02492         {
02493                 G_DebugPrint( WL_WARNING, "Q3_SetHealth: invalid entID %d\n", entID);
02494                 return;
02495         }
02496         
02497         if ( data < 0 )
02498         {
02499                 data = 0;
02500         }
02501 
02502         ent->health = data;
02503 
02504         if(!ent->client)
02505         {
02506                 return;
02507         }
02508 
02509         ent->client->ps.stats[STAT_HEALTH] = data;
02510 
02511         if ( ent->client->ps.stats[STAT_HEALTH] > ent->client->ps.stats[STAT_MAX_HEALTH] )
02512         {
02513                 ent->health = ent->client->ps.stats[STAT_HEALTH] = ent->client->ps.stats[STAT_MAX_HEALTH];
02514         }
02515         if ( data == 0 )
02516         {
02517                 ent->health = 1;
02518                 if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR )
02519                 { //this would be silly
02520                         return;
02521                 }
02522 
02523                 ent->flags &= ~FL_GODMODE;
02524                 ent->client->ps.stats[STAT_HEALTH] = ent->health = -999;
02525                 player_die (ent, ent, ent, 100000, MOD_FALLING);
02526         }
02527 }
02528 
02529 
02530 /*
02531 ============
02532 Q3_SetArmor
02533   Description   : 
02534   Return type   : static void 
02535   Argument              :  int entID
02536   Argument              : int data
02537 ============
02538 */
02539 static void Q3_SetArmor( int entID, int data )
02540 {
02541         gentity_t       *ent  = &g_entities[entID];
02542 
02543         if ( !ent )
02544         {
02545                 G_DebugPrint( WL_WARNING, "Q3_SetArmor: invalid entID %d\n", entID);
02546                 return;
02547         }
02548         
02549         if(!ent->client)
02550         {
02551                 return;
02552         }
02553 
02554         ent->client->ps.stats[STAT_ARMOR] = data;
02555         if ( ent->client->ps.stats[STAT_ARMOR] > ent->client->ps.stats[STAT_MAX_HEALTH] )
02556         {
02557                 ent->client->ps.stats[STAT_ARMOR] = ent->client->ps.stats[STAT_MAX_HEALTH];
02558         }
02559 }
02560 
02561 
02562 /*
02563 ============
02564 Q3_SetBState
02565   Description   : 
02566   Return type   : static qboolean 
02567   Argument              :  int entID
02568   Argument              : const char *bs_name
02569 FIXME: this should be a general NPC wrapper function 
02570         that is called ANY time a bState is changed...
02571 ============
02572 */
02573 static qboolean Q3_SetBState( int entID, const char *bs_name )
02574 {
02575         gentity_t       *ent  = &g_entities[entID];
02576         bState_t        bSID;
02577 
02578         if ( !ent )
02579         {
02580                 G_DebugPrint( WL_WARNING, "Q3_SetBState: invalid entID %d\n", entID);
02581                 return qtrue;
02582         }
02583         
02584         if ( !ent->NPC )
02585         {
02586                 G_DebugPrint( WL_ERROR, "Q3_SetBState: '%s' is not an NPC\n", ent->targetname );
02587                 return qtrue;//ok to complete
02588         }
02589 
02590         bSID = (bState_t)(GetIDForString( BSTable, bs_name ));
02591         if ( bSID > -1 )
02592         {
02593                 if ( bSID == BS_SEARCH || bSID == BS_WANDER )
02594                 {
02595                         //FIXME: Reimplement
02596                         
02597                         if( ent->waypoint != WAYPOINT_NONE )
02598                         {
02599                                 NPC_BSSearchStart( ent->waypoint, bSID );
02600                         }
02601                         else
02602                         {
02603                                 ent->waypoint = NAV_FindClosestWaypointForEnt( ent, WAYPOINT_NONE );
02604 
02605                                 if( ent->waypoint != WAYPOINT_NONE )
02606                                 {
02607                                         NPC_BSSearchStart( ent->waypoint, bSID );
02608                                 }
02609                                 /*else if( ent->lastWaypoint >=0 && ent->lastWaypoint < num_waypoints )
02610                                 {
02611                                         NPC_BSSearchStart( ent->lastWaypoint, bSID );
02612                                 }
02613                                 else if( ent->lastValidWaypoint >=0 && ent->lastValidWaypoint < num_waypoints )
02614                                 {
02615                                         NPC_BSSearchStart( ent->lastValidWaypoint, bSID );
02616                                 }*/
02617                                 else
02618                                 {
02619                                         G_DebugPrint( WL_ERROR, "Q3_SetBState: '%s' is not in a valid waypoint to search from!\n", ent->targetname );
02620                                         return qtrue;
02621                                 }
02622                         }
02623                 }
02624                 
02625 
02626                 ent->NPC->tempBehavior = BS_DEFAULT;//need to clear any temp behaviour
02627                 if ( ent->NPC->behaviorState == BS_NOCLIP && bSID != BS_NOCLIP )
02628                 {//need to rise up out of the floor after noclipping
02629                         ent->r.currentOrigin[2] += 0.125;
02630                         G_SetOrigin( ent, ent->r.currentOrigin );
02631                 }
02632                 ent->NPC->behaviorState = bSID;
02633                 if ( bSID == BS_DEFAULT )
02634                 {
02635                         ent->NPC->defaultBehavior = bSID;
02636                 }
02637         }
02638 
02639         ent->NPC->aiFlags &= ~NPCAI_TOUCHED_GOAL;
02640 
02641 //      if ( bSID == BS_FLY )
02642 //      {//FIXME: need a set bState wrapper
02643 //              ent->client->moveType = MT_FLYSWIM;
02644 //      }
02645 //      else
02646         {
02647                 //FIXME: these are presumptions!
02648                 //Q3_SetGravity( entID, g_gravity->value );
02649                 //ent->client->moveType = MT_RUNJUMP;
02650         }
02651 
02652         if ( bSID == BS_NOCLIP )
02653         {
02654                 ent->client->noclip = qtrue;
02655         }
02656         else
02657         {
02658                 ent->client->noclip = qfalse;
02659         }
02660 
02661 /*
02662         if ( bSID == BS_FACE || bSID == BS_POINT_AND_SHOOT || bSID == BS_FACE_ENEMY )
02663         {
02664                 ent->NPC->aimTime = level.time + 5 * 1000;//try for 5 seconds
02665                 return qfalse;//need to wait for task complete message
02666         }
02667 */
02668 
02669 //      if ( bSID == BS_SNIPER || bSID == BS_ADVANCE_FIGHT )
02670         if ( bSID == BS_ADVANCE_FIGHT )
02671         {
02672                 return qfalse;//need to wait for task complete message
02673         }
02674 
02675 /*
02676         if ( bSID == BS_SHOOT || bSID == BS_POINT_AND_SHOOT )
02677         {//Let them shoot right NOW
02678                 ent->NPC->shotTime = ent->attackDebounceTime = level.time;
02679         }
02680 */
02681         if ( bSID == BS_JUMP )
02682         {
02683                 ent->NPC->jumpState = JS_FACING;
02684         }
02685 
02686         return qtrue;//ok to complete
02687 }
02688 
02689 
02690 /*
02691 ============
02692 Q3_SetTempBState
02693   Description   : 
02694   Return type   : static qboolean 
02695   Argument              :  int entID
02696   Argument              : const char *bs_name
02697 ============
02698 */
02699 static qboolean Q3_SetTempBState( int entID, const char *bs_name )
02700 {
02701         gentity_t       *ent  = &g_entities[entID];
02702         bState_t        bSID;
02703 
02704         if ( !ent )
02705         {
02706                 G_DebugPrint( WL_WARNING, "Q3_SetTempBState: invalid entID %d\n", entID);
02707                 return qtrue;
02708         }
02709         
02710         if ( !ent->NPC )
02711         {
02712                 G_DebugPrint( WL_ERROR, "Q3_SetTempBState: '%s' is not an NPC\n", ent->targetname );
02713                 return qtrue;//ok to complete
02714         }
02715 
02716         bSID = (bState_t)(GetIDForString( BSTable, bs_name ));
02717         if ( bSID > -1 )
02718         {
02719                 ent->NPC->tempBehavior = bSID;
02720         }
02721 
02722 /*
02723         if ( bSID == BS_FACE || bSID == BS_POINT_AND_SHOOT || bSID == BS_FACE_ENEMY )
02724         {
02725                 ent->NPC->aimTime = level.time + 5 * 1000;//try for 5 seconds
02726                 return qfalse;//need to wait for task complete message
02727         }
02728 */
02729 
02730 /*
02731         if ( bSID == BS_SHOOT || bSID == BS_POINT_AND_SHOOT )
02732         {//Let them shoot right NOW
02733                 ent->NPC->shotTime = ent->attackDebounceTime = level.time;
02734         }
02735 */
02736         return qtrue;//ok to complete
02737 }
02738 
02739 
02740 /*
02741 ============
02742 Q3_SetDefaultBState
02743   Description   : 
02744   Return type   : static void 
02745   Argument              :  int entID
02746   Argument              : const char *bs_name
02747 ============
02748 */
02749 static void Q3_SetDefaultBState( int entID, const char *bs_name )
02750 {
02751         gentity_t       *ent  = &g_entities[entID];
02752         bState_t        bSID;
02753 
02754         if ( !ent )
02755         {
02756                 G_DebugPrint( WL_WARNING, "Q3_SetDefaultBState: invalid entID %d\n", entID);
02757                 return;
02758         }
02759         
02760         if ( !ent->NPC )
02761         {
02762                 G_DebugPrint( WL_ERROR, "Q3_SetDefaultBState: '%s' is not an NPC\n", ent->targetname );
02763                 return;
02764         }
02765 
02766         bSID = (bState_t)(GetIDForString( BSTable, bs_name ));
02767         if ( bSID > -1 )
02768         {
02769                 ent->NPC->defaultBehavior = bSID;
02770         }
02771 }
02772 
02773 
02774 /*
02775 ============
02776 Q3_SetDPitch
02777   Description   : 
02778   Return type   : static void 
02779   Argument              :  int entID
02780   Argument              : float data
02781 ============
02782 */
02783 static void Q3_SetDPitch( int entID, float data )
02784 {
02785         G_DebugPrint( WL_WARNING, "Q3_SetDPitch: NOT SUPPORTED IN MP\n");
02786         return;
02787 }
02788 
02789 
02790 /*
02791 ============
02792 Q3_SetDYaw
02793   Description   : 
02794   Return type   : static void 
02795   Argument              :  int entID
02796   Argument              : float data
02797 ============
02798 */
02799 static void Q3_SetDYaw( int entID, float data )
02800 {
02801         G_DebugPrint( WL_WARNING, "Q3_SetDYaw: NOT SUPPORTED IN MP\n");
02802         return;
02803 }
02804 
02805 
02806 /*
02807 ============
02808 Q3_SetShootDist
02809   Description   : 
02810   Return type   : static void 
02811   Argument              :  int entID
02812   Argument              : float data
02813 ============
02814 */
02815 static void Q3_SetShootDist( int entID, float data )
02816 {
02817         G_DebugPrint( WL_WARNING, "Q3_SetShootDist: NOT SUPPORTED IN MP\n");
02818         return;
02819 }
02820 
02821 
02822 /*
02823 ============
02824 Q3_SetVisrange
02825   Description   : 
02826   Return type   : static void 
02827   Argument              :  int entID
02828   Argument              : float data
02829 ============
02830 */
02831 static void Q3_SetVisrange( int entID, float data )
02832 {
02833         G_DebugPrint( WL_WARNING, "Q3_SetVisrange: NOT SUPPORTED IN MP\n");
02834         return;
02835 }
02836 
02837 
02838 /*
02839 ============
02840 Q3_SetEarshot
02841   Description   : 
02842   Return type   : static void 
02843   Argument              :  int entID
02844   Argument              : float data
02845 ============
02846 */
02847 static void Q3_SetEarshot( int entID, float data )
02848 {
02849         G_DebugPrint( WL_WARNING, "Q3_SetEarshot: NOT SUPPORTED IN MP\n");
02850         return;
02851 }
02852 
02853 
02854 /*
02855 ============
02856 Q3_SetVigilance
02857   Description   : 
02858   Return type   : static void 
02859   Argument              :  int entID
02860   Argument              : float data
02861 ============
02862 */
02863 static void Q3_SetVigilance( int entID, float data )
02864 {
02865         G_DebugPrint( WL_WARNING, "Q3_SetVigilance: NOT SUPPORTED IN MP\n");
02866         return;
02867 }
02868 
02869 
02870 /*
02871 ============
02872 Q3_SetVFOV
02873   Description   : 
02874   Return type   : static void 
02875   Argument              :  int entID
02876   Argument              : int data
02877 ============
02878 */
02879 static void Q3_SetVFOV( int entID, int data )
02880 {
02881         G_DebugPrint( WL_WARNING, "Q3_SetVFOV: NOT SUPPORTED IN MP\n");
02882         return;
02883 }
02884 
02885 
02886 /*
02887 ============
02888 Q3_SetHFOV
02889   Description   : 
02890   Return type   : static void 
02891   Argument              :  int entID
02892   Argument              : int data
02893 ============
02894 */
02895 static void Q3_SetHFOV( int entID, int data )
02896 {
02897         G_DebugPrint( WL_WARNING, "Q3_SetHFOV: NOT SUPPORTED IN MP\n");
02898         return;
02899 }
02900 
02901 
02902 /*
02903 ============
02904 Q3_SetWidth
02905   Description   : 
02906   Return type   : static void 
02907   Argument              :  int entID
02908   Argument              : float data
02909 ============
02910 */
02911 static void Q3_SetWidth( int entID, int data )
02912 {
02913         G_DebugPrint( WL_WARNING, "Q3_SetWidth: NOT SUPPORTED IN MP\n");
02914         return;
02915 }
02916 
02917 /*
02918 ============
02919 Q3_SetTimeScale
02920   Description   : 
02921   Return type   : static void 
02922   Argument              :  int entID
02923   Argument              : const char *data
02924 ============
02925 */
02926 static void Q3_SetTimeScale( int entID, const char *data )
02927 {
02928         trap_Cvar_Set("timescale", data);
02929 }
02930 
02931 
02932 /*
02933 ============
02934 Q3_SetInvisible
02935   Description   : 
02936   Return type   : static void 
02937   Argument              :  int entID
02938   Argument              : qboolean invisible
02939 ============
02940 */
02941 static void Q3_SetInvisible( int entID, qboolean invisible )
02942 {
02943         gentity_t       *self  = &g_entities[entID];
02944 
02945         if ( !self )
02946         {
02947                 G_DebugPrint( WL_WARNING, "Q3_SetInvisible: invalid entID %d\n", entID);
02948                 return;
02949         }
02950         
02951         if ( invisible )
02952         {
02953                 self->s.eFlags |= EF_NODRAW;
02954                 if ( self->client )
02955                 {
02956                         self->client->ps.eFlags |= EF_NODRAW;
02957                 }
02958                 self->r.contents = 0;
02959         }
02960         else
02961         {
02962                 self->s.eFlags &= ~EF_NODRAW;
02963                 if ( self->client )
02964                 {
02965                         self->client->ps.eFlags &= ~EF_NODRAW;
02966                 }
02967         }
02968 }
02969 
02970 /*
02971 ============
02972 Q3_SetVampire
02973   Description   : 
02974   Return type   : static void 
02975   Argument              :  int entID
02976   Argument              : qboolean vampire
02977 ============
02978 */
02979 static void Q3_SetVampire( int entID, qboolean vampire )
02980 {
02981         G_DebugPrint( WL_WARNING, "Q3_SetVampire: NOT SUPPORTED IN MP\n");
02982         return;
02983 }
02984 /*
02985 ============
02986 Q3_SetGreetAllies
02987   Description   : 
02988   Return type   : static void 
02989   Argument              :  int entID
02990   Argument              : qboolean greet
02991 ============
02992 */
02993 static void Q3_SetGreetAllies( int entID, qboolean greet )
02994 {
02995         G_DebugPrint( WL_WARNING, "Q3_SetGreetAllies: NOT SUPPORTED IN MP\n");
02996         return;
02997 }
02998 
02999 
03000 /*
03001 ============
03002 Q3_SetViewTarget 
03003   Description   : 
03004   Return type   : static void 
03005   Argument              : int entID
03006   Argument              : const char *name
03007 ============
03008 */
03009 static void Q3_SetViewTarget (int entID, const char *name)
03010 {
03011         G_DebugPrint( WL_WARNING, "Q3_SetViewTarget: NOT SUPPORTED IN MP\n");
03012         return;
03013 }
03014 
03015 
03016 /*
03017 ============
03018 Q3_SetWatchTarget 
03019   Description   : 
03020   Return type   : static void 
03021   Argument              : int entID
03022   Argument              : const char *name
03023 ============
03024 */
03025 static void Q3_SetWatchTarget (int entID, const char *name)
03026 {
03027         G_DebugPrint( WL_WARNING, "Q3_SetWatchTarget: NOT SUPPORTED IN MP\n");
03028         return;
03029 }
03030 
03031 void Q3_SetLoopSound(int entID, const char *name)
03032 {
03033         sfxHandle_t     index;
03034         gentity_t       *self  = &g_entities[entID];
03035 
03036         if ( Q_stricmp( "NULL", name ) == 0 || Q_stricmp( "NONE", name )==0)
03037         {
03038                 self->s.loopSound = 0;
03039                 self->s.loopIsSoundset = qfalse;
03040                 return;
03041         }
03042 
03043         index = G_SoundIndex( (char*)name );
03044 
03045         if (index)
03046         {
03047                 self->s.loopSound = index;
03048                 self->s.loopIsSoundset = qfalse;
03049         }
03050         else
03051         {
03052                 G_DebugPrint( WL_WARNING, "Q3_SetLoopSound: can't find sound file: '%s'\n", name );
03053         }
03054 }
03055 
03056 void Q3_SetICARUSFreeze( int entID, const char *name, qboolean freeze )
03057 {
03058         gentity_t       *self  = G_Find( NULL, FOFS(targetname), name );
03059         if ( !self )
03060         {//hmm, targetname failed, try script_targetname?
03061                 self = G_Find( NULL, FOFS(script_targetname), name );
03062         }
03063 
03064         if ( !self )
03065         {
03066                 G_DebugPrint( WL_WARNING, "Q3_SetICARUSFreeze: invalid ent %s\n", name);
03067                 return;
03068         }
03069         
03070         if ( freeze )
03071         {
03072                 self->r.svFlags |= SVF_ICARUS_FREEZE;
03073         }
03074         else
03075         {
03076                 self->r.svFlags &= ~SVF_ICARUS_FREEZE;
03077         }
03078 }
03079 
03080 /*
03081 ============
03082 Q3_SetViewEntity
03083   Description   : 
03084   Return type   : static void 
03085   Argument              : int entID
03086   Argument              : const char *name
03087 ============
03088 */
03089 void Q3_SetViewEntity(int entID, const char *name)
03090 {
03091         G_DebugPrint( WL_WARNING, "Q3_SetViewEntity currently unsupported in MP, ask if you need it.\n");
03092 }
03093 
03094 /*
03095 ============
03096 Q3_SetWeapon 
03097   Description   : 
03098   Return type   : static void 
03099   Argument              : int entID
03100   Argument              : const char *wp_name
03101 ============
03102 */
03103 extern void ChangeWeapon( gentity_t *ent, int newWeapon );
03104 static void Q3_SetWeapon (int entID, const char *wp_name)
03105 {
03106         gentity_t       *ent  = &g_entities[entID];
03107         int             wp = GetIDForString( WPTable, wp_name );
03108 
03109         ent->client->ps.stats[STAT_WEAPONS] = (1<<wp);
03110         ChangeWeapon( ent, wp );
03111 }
03112 
03113 /*
03114 ============
03115 Q3_SetItem 
03116   Description   : 
03117   Return type   : static void 
03118   Argument              : int entID
03119   Argument              : const char *wp_name
03120 ============
03121 */
03122 static void Q3_SetItem (int entID, const char *item_name)
03123 { //rww - unused in mp
03124         G_DebugPrint( WL_WARNING, "Q3_SetItem: NOT SUPPORTED IN MP\n");
03125         return;
03126 }
03127 
03128 
03129 
03130 /*
03131 ============
03132 Q3_SetWalkSpeed 
03133   Description   : 
03134   Return type   : static void 
03135   Argument              : int entID
03136   Argument              : int int_data
03137 ============
03138 */
03139 static void Q3_SetWalkSpeed (int entID, int int_data)
03140 {
03141         gentity_t       *self  = &g_entities[entID];
03142 
03143         if ( !self )
03144         {
03145                 G_DebugPrint( WL_WARNING, "Q3_SetWalkSpeed: invalid entID %d\n", entID);
03146                 return;
03147         }
03148         
03149         if ( !self->NPC )
03150         {
03151                 G_DebugPrint( WL_ERROR, "Q3_SetWalkSpeed: '%s' is not an NPC!\n", self->targetname );
03152                 return;
03153         }
03154 
03155         if(int_data == 0)
03156         {
03157                 self->NPC->stats.walkSpeed = self->client->ps.speed = 1;
03158         }
03159 
03160         self->NPC->stats.walkSpeed = self->client->ps.speed = int_data;
03161 }
03162 
03163 
03164 /*
03165 ============
03166 Q3_SetRunSpeed 
03167   Description   : 
03168   Return type   : static void 
03169   Argument              : int entID
03170   Argument              : int int_data
03171 ============
03172 */
03173 static void Q3_SetRunSpeed (int entID, int int_data)
03174 {
03175         gentity_t       *self  = &g_entities[entID];
03176 
03177         if ( !self )
03178         {
03179                 G_DebugPrint( WL_WARNING, "Q3_SetRunSpeed: invalid entID %d\n", entID);
03180                 return;
03181         }
03182         
03183         if ( !self->NPC )
03184         {
03185                 G_DebugPrint( WL_ERROR, "Q3_SetRunSpeed: '%s' is not an NPC!\n", self->targetname );
03186                 return;
03187         }
03188 
03189         if(int_data == 0)
03190         {
03191                 self->NPC->stats.runSpeed = self->client->ps.speed = 1;
03192         }
03193 
03194         self->NPC->stats.runSpeed = self->client->ps.speed = int_data;
03195 }
03196 
03197 
03198 /*
03199 ============
03200 Q3_SetYawSpeed 
03201   Description   : 
03202   Return type   : static void 
03203   Argument              : int entID
03204   Argument              : float float_data
03205 ============
03206 */
03207 static void Q3_SetYawSpeed (int entID, float float_data)
03208 {
03209         G_DebugPrint( WL_WARNING, "Q3_SetYawSpeed: NOT SUPPORTED IN MP\n");
03210         return;
03211 }
03212 
03213 
03214 /*
03215 ============
03216 Q3_SetAggression
03217   Description   : 
03218   Return type   : static void 
03219   Argument              : int entID
03220   Argument              : int int_data
03221 ============
03222 */
03223 static void Q3_SetAggression(int entID, int int_data)
03224 {
03225         G_DebugPrint( WL_WARNING, "Q3_SetAggression: NOT SUPPORTED IN MP\n");
03226         return;
03227 }
03228 
03229 
03230 /*
03231 ============
03232 Q3_SetAim
03233   Description   : 
03234   Return type   : static void 
03235   Argument              : int entID
03236   Argument              : int int_data
03237 ============
03238 */
03239 static void Q3_SetAim(int entID, int int_data)
03240 {
03241         G_DebugPrint( WL_WARNING, "Q3_SetAim: NOT SUPPORTED IN MP\n");
03242         return;
03243 }
03244 
03245 
03246 /*
03247 ============
03248 Q3_SetFriction
03249   Description   : 
03250   Return type   : static void 
03251   Argument              : int entID
03252   Argument              : int int_data
03253 ============
03254 */
03255 static void Q3_SetFriction(int entID, int int_data)
03256 {
03257         gentity_t       *self  = &g_entities[entID];
03258 
03259         if ( !self )
03260         {
03261                 G_DebugPrint( WL_WARNING, "Q3_SetFriction: invalid entID %d\n", entID);
03262                 return;
03263         }
03264         
03265         if ( !self->client )
03266         {
03267                 G_DebugPrint( WL_ERROR, "Q3_SetFriction: '%s' is not an NPC/player!\n", self->targetname );
03268                 return;
03269         }
03270 
03271         G_DebugPrint( WL_WARNING, "Q3_SetFriction currently unsupported in MP\n");
03272 //      self->client->ps.friction = int_data;
03273 }
03274 
03275 
03276 /*
03277 ============
03278 Q3_SetGravity
03279   Description   : 
03280   Return type   : static void 
03281   Argument              : int entID
03282   Argument              : float float_data
03283 ============
03284 */
03285 static void Q3_SetGravity(int entID, float float_data)
03286 {
03287         gentity_t       *self  = &g_entities[entID];
03288 
03289         if ( !self )
03290         {
03291                 G_DebugPrint( WL_WARNING, "Q3_SetGravity: invalid entID %d\n", entID);
03292                 return;
03293         }
03294         
03295         if ( !self->client )
03296         {
03297                 G_DebugPrint( WL_ERROR, "Q3_SetGravity: '%s' is not an NPC/player!\n", self->targetname );
03298                 return;
03299         }
03300 
03301         //FIXME: what if we want to return them to normal global gravity?
03302         if ( self->NPC )
03303         {
03304                 self->NPC->aiFlags |= NPCAI_CUSTOM_GRAVITY;
03305         }
03306         self->client->ps.gravity = float_data;
03307 }
03308 
03309 
03310 /*
03311 ============
03312 Q3_SetWait
03313   Description   : 
03314   Return type   : static void 
03315   Argument              : int entID
03316   Argument              : float float_data
03317 ============
03318 */
03319 static void Q3_SetWait(int entID, float float_data)
03320 {
03321         gentity_t       *self  = &g_entities[entID];
03322 
03323         if ( !self )
03324         {
03325                 G_DebugPrint( WL_WARNING, "Q3_SetWait: invalid entID %d\n", entID);
03326                 return;
03327         }
03328         
03329         self->wait = float_data;
03330 }
03331 
03332 
03333 static void Q3_SetShotSpacing(int entID, int int_data)
03334 {
03335         G_DebugPrint( WL_WARNING, "Q3_SetShotSpacing: NOT SUPPORTED IN MP\n");
03336         return;
03337 }
03338 
03339 /*
03340 ============
03341 Q3_SetFollowDist
03342   Description   : 
03343   Return type   : static void 
03344   Argument              : int entID
03345   Argument              : float float_data
03346 ============
03347 */
03348 static void Q3_SetFollowDist(int entID, float float_data)
03349 {
03350         G_DebugPrint( WL_WARNING, "Q3_SetFollowDist: NOT SUPPORTED IN MP\n");
03351         return;
03352 }
03353 
03354 
03355 /*
03356 ============
03357 Q3_SetScale
03358   Description   : 
03359   Return type   : static void 
03360   Argument              : int entID
03361   Argument              : float float_data
03362 ============
03363 */
03364 static void Q3_SetScale(int entID, float float_data)
03365 {
03366         gentity_t       *self  = &g_entities[entID];
03367 
03368         if ( !self )
03369         {
03370                 G_DebugPrint( WL_WARNING, "Q3_SetScale: invalid entID %d\n", entID);
03371                 return;
03372         }
03373         
03374         if (self->client)
03375         {
03376                 self->client->ps.iModelScale = float_data*100.0f;
03377         }
03378         else
03379         {
03380                 self->s.iModelScale = float_data*100.0f;
03381         }
03382 }
03383 
03384 /*
03385 ============
03386 Q3_GameSideCheckStringCounterIncrement
03387   Description   : 
03388   Return type   : static float 
03389   Argument              : const char *string
03390 ============
03391 */
03392 static float Q3_GameSideCheckStringCounterIncrement( const char *string )
03393 {
03394         char    *numString;
03395         float   val = 0.0f;
03396 
03397         if ( string[0] == '+' )
03398         {//We want to increment whatever the value is by whatever follows the +
03399                 if ( string[1] )
03400                 {
03401                         numString = (char *)&string[1];
03402                         val = atof( numString );
03403                 }
03404         }
03405         else if ( string[0] == '-' )
03406         {//we want to decrement
03407                 if ( string[1] )
03408                 {
03409                         numString = (char *)&string[1];
03410                         val = atof( numString ) * -1;
03411                 }
03412         }
03413 
03414         return val;
03415 }
03416 
03417 /*
03418 ============
03419 Q3_SetCount
03420   Description   : 
03421   Return type   : static void 
03422   Argument              : int entID
03423   Argument              : const char *data
03424 ============
03425 */
03426 static void Q3_SetCount(int entID, const char *data)
03427 {
03428         gentity_t       *self  = &g_entities[entID];
03429         float           val = 0.0f;
03430 
03431         //FIXME: use FOFS() stuff here to make a generic entity field setting?
03432         if ( !self )
03433         {
03434                 G_DebugPrint( WL_WARNING, "Q3_SetCount: invalid entID %d\n", entID);
03435                 return;
03436         }
03437         
03438         if ( (val = Q3_GameSideCheckStringCounterIncrement( data )) )
03439         {
03440                 self->count += (int)(val);
03441         }
03442         else
03443         {
03444                 self->count = atoi((char *) data);
03445         }
03446 }
03447 
03448 
03449 /*
03450 ============
03451 Q3_SetTargetName 
03452   Description   : 
03453   Return type   : static void 
03454   Argument              : int entID
03455   Argument              : const char *targetname
03456 ============
03457 */
03458 static void Q3_SetTargetName (int entID, const char *targetname)
03459 {
03460         gentity_t       *self  = &g_entities[entID];
03461 
03462         if ( !self )
03463         {
03464                 G_DebugPrint( WL_WARNING, "Q3_SetTargetName: invalid entID %d\n", entID);
03465                 return;
03466         }
03467 
03468         if(!Q_stricmp("NULL", ((char *)targetname)))
03469         {
03470                 self->targetname = NULL;
03471         }
03472         else
03473         {
03474                 self->targetname = G_NewString( targetname );
03475         }
03476 }
03477 
03478 
03479 /*
03480 ============
03481 Q3_SetTarget 
03482   Description   : 
03483   Return type   : static void 
03484   Argument              : int entID
03485   Argument              : const char *target
03486 ============
03487 */
03488 static void Q3_SetTarget (int entID, const char *target)
03489 {
03490         gentity_t       *self  = &g_entities[entID];
03491 
03492         if ( !self )
03493         {
03494                 G_DebugPrint( WL_WARNING, "Q3_SetTarget: invalid entID %d\n", entID);
03495                 return;
03496         }
03497 
03498         if(!Q_stricmp("NULL", ((char *)target)))
03499         {
03500                 self->target = NULL;
03501         }
03502         else
03503         {
03504                 self->target = G_NewString( target );
03505         }
03506 }
03507 
03508 /*
03509 ============
03510 Q3_SetTarget2
03511   Description   : 
03512   Return type   : static void 
03513   Argument              : int entID
03514   Argument              : const char *target
03515 ============
03516 */
03517 static void Q3_SetTarget2 (int entID, const char *target2)
03518 {
03519         G_DebugPrint( WL_WARNING, "Q3_SetTarget2 does not exist in MP\n");
03520         /*
03521         sharedEntity_t  *self  = SV_GentityNum(entID);
03522 
03523         if ( !self )
03524         {
03525                 G_DebugPrint( WL_WARNING, "Q3_SetTarget2: invalid entID %d\n", entID);
03526                 return;
03527         }
03528 
03529         if(!Q_stricmp("NULL", ((char *)target2)))
03530         {
03531                 self->target2 = NULL;
03532         }
03533         else
03534         {
03535                 self->target2 = G_NewString( target2 );
03536         }
03537         */
03538 }
03539 /*
03540 ============
03541 Q3_SetRemoveTarget 
03542   Description   : 
03543   Return type   : static void 
03544   Argument              : int entID
03545   Argument              : const char *target
03546 ============
03547 */
03548 static void Q3_SetRemoveTarget (int entID, const char *target)
03549 {
03550         G_DebugPrint( WL_WARNING, "Q3_SetRemoveTarget: NOT SUPPORTED IN MP\n");
03551         return;
03552 }
03553 
03554 
03555 /*
03556 ============
03557 Q3_SetPainTarget 
03558   Description   : 
03559   Return type   : void 
03560   Argument              : int entID
03561   Argument              : const char *targetname
03562 ============
03563 */
03564 static void Q3_SetPainTarget (int entID, const char *targetname)
03565 {
03566         G_DebugPrint( WL_WARNING, "Q3_SetPainTarget: NOT SUPPORTED IN MP\n");
03567         /*
03568         sharedEntity_t  *self  = SV_GentityNum(entID);
03569 
03570         if ( !self )
03571         {
03572                 G_DebugPrint( WL_WARNING, "Q3_SetPainTarget: invalid entID %d\n", entID);
03573                 return;
03574         }
03575 
03576         if(Q_stricmp("NULL", ((char *)targetname)) == 0)
03577         {
03578                 self->paintarget = NULL;
03579         }
03580         else
03581         {
03582                 self->paintarget = G_NewString((char *)targetname);
03583         }
03584         */
03585 }
03586 
03587 /*
03588 ============
03589 Q3_SetFullName 
03590   Description   : 
03591   Return type   : static void 
03592   Argument              : int entID
03593   Argument              : const char *fullName
03594 ============
03595 */
03596 static void Q3_SetFullName (int entID, const char *fullName)
03597 {
03598         gentity_t       *self  = &g_entities[entID];
03599 
03600         if ( !self )
03601         {
03602                 G_DebugPrint( WL_WARNING, "Q3_SetFullName: invalid entID %d\n", entID);
03603                 return;
03604         }
03605 
03606         if(!Q_stricmp("NULL", ((char *)fullName)))
03607         {
03608                 self->fullName = NULL;
03609         }
03610         else
03611         {
03612                 self->fullName = G_NewString( fullName );
03613         }
03614 }
03615 
03616 static void Q3_SetMusicState( const char *dms )
03617 {
03618         G_DebugPrint( WL_WARNING, "Q3_SetMusicState: NOT SUPPORTED IN MP\n");
03619         return;
03620 }
03621 
03622 static void Q3_SetForcePowerLevel ( int entID, int forcePower, int forceLevel )
03623 {
03624         G_DebugPrint( WL_WARNING, "Q3_SetForcePowerLevel: NOT SUPPORTED IN MP\n");
03625         return;
03626 }
03627 /*
03628 ============
03629 Q3_SetParm
03630   Description   : 
03631   Return type   : void 
03632   Argument              : int entID
03633   Argument              : int parmNum
03634   Argument              : const char *parmValue
03635 ============
03636 */
03637 void Q3_SetParm (int entID, int parmNum, const char *parmValue)
03638 {
03639         gentity_t       *ent = &g_entities[entID];
03640         float           val;
03641 
03642         if ( !ent )
03643         {
03644                 G_DebugPrint( WL_WARNING, "Q3_SetParm: invalid entID %d\n", entID);
03645                 return;
03646         }
03647 
03648         if ( parmNum < 0 || parmNum >= MAX_PARMS )
03649         {
03650                 G_DebugPrint( WL_WARNING, "SET_PARM: parmNum %d out of range!\n", parmNum );
03651                 return;
03652         }
03653 
03654         if( !ent->parms )
03655         {
03656                 ent->parms = (parms_t *)G_Alloc( sizeof(parms_t) );
03657                 memset( ent->parms, 0, sizeof(parms_t) );
03658         }
03659 
03660         if ( (val = Q3_GameSideCheckStringCounterIncrement( parmValue )) )
03661         {
03662                 val += atof( ent->parms->parm[parmNum] );
03663                 Com_sprintf( ent->parms->parm[parmNum], sizeof(ent->parms->parm), "%f", val );
03664         }
03665         else
03666         {//Just copy the string
03667                 //copy only 16 characters
03668                 strncpy( ent->parms->parm[parmNum], parmValue, sizeof(ent->parms->parm[0]) );
03669                 //set the last charcter to null in case we had to truncate their passed string
03670                 if ( ent->parms->parm[parmNum][sizeof(ent->parms->parm[0]) - 1] != 0 )
03671                 {//Tried to set a string that is too long
03672                         ent->parms->parm[parmNum][sizeof(ent->parms->parm[0]) - 1] = 0;
03673                         G_DebugPrint( WL_WARNING, "SET_PARM: parm%d string too long, truncated to '%s'!\n", parmNum, ent->parms->parm[parmNum] );
03674                 }
03675         }
03676 }
03677 
03678 
03679 
03680 /*
03681 =============
03682 Q3_SetCaptureGoal
03683 
03684 Sets the capture spot goal of an entity
03685 =============
03686 */
03687 static void Q3_SetCaptureGoal( int entID, const char *name )
03688 {
03689         G_DebugPrint( WL_WARNING, "Q3_SetCaptureGoal: NOT SUPPORTED IN MP\n");
03690         return;
03691 }
03692 
03693 /*
03694 =============
03695 Q3_SetEvent
03696 
03697 ?
03698 =============
03699 */
03700 static void Q3_SetEvent( int entID, const char *event_name )
03701 { //rwwFIXMEFIXME: Use in MP?
03702         G_DebugPrint( WL_WARNING, "Q3_SetEvent: NOT SUPPORTED IN MP (may be in future, ask if needed)\n");
03703         return;
03704 }
03705 
03706 /*
03707 ============
03708 Q3_SetIgnorePain
03709 
03710 ?
03711 ============
03712 */
03713 static void Q3_SetIgnorePain( int entID, qboolean data)
03714 {
03715         G_DebugPrint( WL_WARNING, "Q3_SetIgnorePain: NOT SUPPORTED IN MP\n");
03716         return;
03717 }
03718 
03719 /*
03720 ============
03721 Q3_SetIgnoreEnemies
03722 
03723 ?
03724 ============
03725 */
03726 static void Q3_SetIgnoreEnemies( int entID, qboolean data)
03727 {
03728         G_DebugPrint( WL_WARNING, "Q3_SetIgnoreEnemies: NOT SUPPORTED IN MP\n");
03729         return;
03730 }
03731 
03732 /*
03733 ============
03734 Q3_SetIgnoreAlerts
03735 
03736 ?
03737 ============
03738 */
03739 static void Q3_SetIgnoreAlerts( int entID, qboolean data)
03740 {
03741         G_DebugPrint( WL_WARNING, "Q3_SetIgnoreAlerts: NOT SUPPORTED IN MP\n");
03742         return;
03743 }
03744 
03745 
03746 /*
03747 ============
03748 Q3_SetNoTarget
03749 
03750 ?
03751 ============
03752 */
03753 static void Q3_SetNoTarget( int entID, qboolean data)
03754 {
03755         gentity_t       *ent  = &g_entities[entID];
03756 
03757         if ( !ent )
03758         {
03759                 G_DebugPrint( WL_WARNING, "Q3_SetNoTarget: invalid entID %d\n", entID);
03760                 return;
03761         }
03762 
03763         if(data)
03764                 ent->flags |= FL_NOTARGET;
03765         else
03766                 ent->flags &= ~FL_NOTARGET;
03767 }
03768 
03769 /*
03770 ============
03771 Q3_SetDontShoot
03772 
03773 ?
03774 ============
03775 */
03776 static void Q3_SetDontShoot( int entID, qboolean add)
03777 {
03778         G_DebugPrint( WL_WARNING, "Q3_SetDontShoot: NOT SUPPORTED IN MP\n");
03779         return;
03780 }
03781 
03782 /*
03783 ============
03784 Q3_SetDontFire
03785 
03786 ?
03787 ============
03788 */
03789 static void Q3_SetDontFire( int entID, qboolean add)
03790 {
03791         G_DebugPrint( WL_WARNING, "Q3_SetDontFire: NOT SUPPORTED IN MP\n");
03792         return;
03793 }
03794 
03795 /*
03796 ============
03797 Q3_SetFireWeapon
03798 
03799 ?
03800 ============
03801 */
03802 static void Q3_SetFireWeapon(int entID, qboolean add)
03803 {
03804         G_DebugPrint( WL_WARNING, "Q3_SetFireWeapon: NOT SUPPORTED IN MP\n");
03805         return;
03806 }
03807 
03808 
03809 /*
03810 ============
03811 Q3_SetInactive
03812 
03813 ?
03814 ============
03815 */
03816 static void Q3_SetInactive(int entID, qboolean add)
03817 {
03818         gentity_t       *ent  = &g_entities[entID];
03819 
03820         if ( !ent )
03821         {
03822                 G_DebugPrint( WL_WARNING, "Q3_SetInactive: invalid entID %d\n", entID);
03823                 return;
03824         }
03825         
03826         if(add)
03827         {
03828                 ent->flags |= FL_INACTIVE;
03829         }
03830         else
03831         {
03832                 ent->flags &= ~FL_INACTIVE;
03833         }
03834 }
03835 
03836 /*
03837 ============
03838 Q3_SetFuncUsableVisible
03839 
03840 ?
03841 ============
03842 */
03843 static void Q3_SetFuncUsableVisible(int entID, qboolean visible )
03844 {
03845         gentity_t       *ent  = &g_entities[entID];
03846 
03847         if ( !ent )
03848         {
03849                 G_DebugPrint( WL_WARNING, "Q3_SetFuncUsableVisible: invalid entID %d\n", entID);
03850                 return;
03851         }
03852         
03853         // Yeah, I know that this doesn't even do half of what the func_usable use code does, but if I've got two things on top of each other...and only
03854         //      one is visible at a time....and neither can ever be used......and finally, the shader on it has the shader_anim stuff going on....It doesn't seem
03855         //      like I can easily use the other version without nasty side effects.
03856         if( visible )
03857         {
03858                 ent->r.svFlags &= ~SVF_NOCLIENT;
03859                 ent->s.eFlags &= ~EF_NODRAW;
03860         }
03861         else
03862         {
03863                 ent->r.svFlags |= SVF_NOCLIENT;
03864                 ent->s.eFlags |= EF_NODRAW;
03865         }
03866 }
03867 
03868 /*
03869 ============
03870 Q3_SetLockedEnemy
03871 
03872 ?
03873 ============
03874 */
03875 static void Q3_SetLockedEnemy ( int entID, qboolean locked)
03876 {
03877         G_DebugPrint( WL_WARNING, "Q3_SetLockedEnemy: NOT SUPPORTED IN MP\n");
03878         return;
03879 }
03880 
03881 char cinematicSkipScript[1024];
03882 
03883 /*
03884 ============
03885 Q3_SetCinematicSkipScript
03886 
03887 ============
03888 */
03889 static void Q3_SetCinematicSkipScript( char *scriptname )
03890 {
03891         G_DebugPrint( WL_WARNING, "Q3_SetCinematicSkipScript: NOT SUPPORTED IN MP\n");
03892         return;
03893 }
03894 
03895 /*
03896 ============
03897 Q3_SetNoMindTrick
03898 
03899 ?
03900 ============
03901 */
03902 static void Q3_SetNoMindTrick( int entID, qboolean add)
03903 {
03904         G_DebugPrint( WL_WARNING, "Q3_SetNoMindTrick: NOT SUPPORTED IN MP\n");
03905         return;
03906 }
03907 
03908 /*
03909 ============
03910 Q3_SetCrouched
03911 
03912 ?
03913 ============
03914 */
03915 static void Q3_SetCrouched( int entID, qboolean add)
03916 {
03917         G_DebugPrint( WL_WARNING, "Q3_SetCrouched: NOT SUPPORTED IN MP\n");
03918         return;
03919 }
03920 
03921 /*
03922 ============
03923 Q3_SetWalking
03924 
03925 ?
03926 ============
03927 */
03928 static void Q3_SetWalking( int entID, qboolean add)
03929 {
03930         gentity_t       *ent  = &g_entities[entID];
03931 
03932         if ( !ent )
03933         {
03934                 G_DebugPrint( WL_WARNING, "Q3_SetWalking: invalid entID %d\n", entID);
03935                 return;
03936         }
03937 
03938         if ( !ent->NPC )
03939         {
03940                 G_DebugPrint( WL_ERROR, "Q3_SetWalking: '%s' is not an NPC!\n", ent->targetname );
03941                 return;
03942         }
03943 
03944         if(add)
03945         {
03946                 ent->NPC->scriptFlags |= SCF_WALKING;
03947         }
03948         else
03949         {
03950                 ent->NPC->scriptFlags &= ~SCF_WALKING;
03951         }
03952         return;
03953 }
03954 
03955 /*
03956 ============
03957 Q3_SetRunning
03958 
03959 ?
03960 ============
03961 */
03962 static void Q3_SetRunning( int entID, qboolean add)
03963 {
03964         G_DebugPrint( WL_WARNING, "Q3_SetRunning: NOT SUPPORTED IN MP\n");
03965         return;
03966 }
03967 
03968 /*
03969 ============
03970 Q3_SetForcedMarch
03971 
03972 ?
03973 ============
03974 */
03975 static void Q3_SetForcedMarch( int entID, qboolean add)
03976 {
03977         G_DebugPrint( WL_WARNING, "Q3_SetForcedMarch: NOT SUPPORTED IN MP\n");
03978         return;
03979 }
03980 /*
03981 ============
03982 Q3_SetChaseEnemies
03983 
03984 indicates whether the npc should chase after an enemy 
03985 ============
03986 */
03987 static void Q3_SetChaseEnemies( int entID, qboolean add)
03988 {
03989         G_DebugPrint( WL_WARNING, "Q3_SetChaseEnemies: NOT SUPPORTED IN MP\n");
03990         return;
03991 }
03992 
03993 /*
03994 ============
03995 Q3_SetLookForEnemies
03996 
03997 if set npc will be on the look out for potential enemies
03998 if not set, npc will ignore enemies
03999 ============
04000 */
04001 static void Q3_SetLookForEnemies( int entID, qboolean add)
04002 {
04003         G_DebugPrint( WL_WARNING, "Q3_SetLookForEnemies: NOT SUPPORTED IN MP\n");
04004         return;
04005 }
04006 
04007 /*
04008 ============
04009 Q3_SetFaceMoveDir
04010 
04011 ============
04012 */
04013 static void Q3_SetFaceMoveDir( int entID, qboolean add)
04014 {
04015         G_DebugPrint( WL_WARNING, "Q3_SetFaceMoveDir: NOT SUPPORTED IN MP\n");
04016         return;
04017 }
04018 
04019 /*
04020 ============
04021 Q3_SetAltFire
04022 
04023 ?
04024 ============
04025 */
04026 static void Q3_SetAltFire( int entID, qboolean add)
04027 {
04028         G_DebugPrint( WL_WARNING, "Q3_SetAltFire: NOT SUPPORTED IN MP\n");
04029         return;
04030 }
04031 
04032 /*
04033 ============
04034 Q3_SetDontFlee
04035 
04036 ?
04037 ============
04038 */
04039 static void Q3_SetDontFlee( int entID, qboolean add)
04040 {
04041         G_DebugPrint( WL_WARNING, "Q3_SetDontFlee: NOT SUPPORTED IN MP\n");
04042         return;
04043 }
04044 
04045 /*
04046 ============
04047 Q3_SetNoResponse
04048 
04049 ?
04050 ============
04051 */
04052 static void Q3_SetNoResponse( int entID, qboolean add)
04053 {
04054         G_DebugPrint( WL_WARNING, "Q3_SetNoResponse: NOT SUPPORTED IN MP\n");
04055         return;
04056 }
04057 
04058 /*
04059 ============
04060 Q3_SetCombatTalk
04061 
04062 ?
04063 ============
04064 */
04065 static void Q3_SetCombatTalk( int entID, qboolean add)
04066 {
04067         G_DebugPrint( WL_WARNING, "Q3_SetCombatTalk: NOT SUPPORTED IN MP\n");
04068         return;
04069 }
04070 
04071 /*
04072 ============
04073 Q3_SetAlertTalk
04074 
04075 ?
04076 ============
04077 */
04078 static void Q3_SetAlertTalk( int entID, qboolean add)
04079 {
04080         G_DebugPrint( WL_WARNING, "Q3_SetAlertTalk: NOT SUPPORTED IN MP\n");
04081         return;
04082 }
04083 
04084 /*
04085 ============
04086 Q3_SetUseCpNearest
04087 
04088 ?
04089 ============
04090 */
04091 static void Q3_SetUseCpNearest( int entID, qboolean add)
04092 {
04093         G_DebugPrint( WL_WARNING, "Q3_SetUseCpNearest: NOT SUPPORTED IN MP\n");
04094         return;
04095 }
04096 
04097 /*
04098 ============
04099 Q3_SetNoForce
04100 
04101 ?
04102 ============
04103 */
04104 static void Q3_SetNoForce( int entID, qboolean add)
04105 {
04106         G_DebugPrint( WL_WARNING, "Q3_SetNoForce: NOT SUPPORTED IN MP\n");
04107         return;
04108 }
04109 
04110 /*
04111 ============
04112 Q3_SetNoAcrobatics
04113 
04114 ?
04115 ============
04116 */
04117 static void Q3_SetNoAcrobatics( int entID, qboolean add)
04118 {
04119         G_DebugPrint( WL_WARNING, "Q3_SetNoAcrobatics: NOT SUPPORTED IN MP\n");
04120         return;
04121 }
04122 
04123 /*
04124 ============
04125 Q3_SetUseSubtitles
04126 
04127 ?
04128 ============
04129 */
04130 static void Q3_SetUseSubtitles( int entID, qboolean add)
04131 {
04132         G_DebugPrint( WL_WARNING, "Q3_SetUseSubtitles: NOT SUPPORTED IN MP\n");
04133         return;
04134 }
04135 
04136 /*
04137 ============
04138 Q3_SetNoFallToDeath
04139 
04140 ?
04141 ============
04142 */
04143 static void Q3_SetNoFallToDeath( int entID, qboolean add)
04144 {
04145         G_DebugPrint( WL_WARNING, "Q3_SetNoFallToDeath: NOT SUPPORTED IN MP\n");
04146         return;
04147 }
04148 
04149 /*
04150 ============
04151 Q3_SetDismemberable
04152 
04153 ?
04154 ============
04155 */
04156 static void Q3_SetDismemberable( int entID, qboolean dismemberable)
04157 {
04158         G_DebugPrint( WL_WARNING, "Q3_SetDismemberable: NOT SUPPORTED IN MP\n");
04159         return;
04160 }
04161 
04162 
04163 /*
04164 ============
04165 Q3_SetMoreLight
04166 
04167 ?
04168 ============
04169 */
04170 static void Q3_SetMoreLight( int entID, qboolean add )
04171 {
04172         G_DebugPrint( WL_WARNING, "Q3_SetMoreLight: NOT SUPPORTED IN MP\n");
04173         return;
04174 }
04175 
04176 /*
04177 ============
04178 Q3_SetUndying
04179 
04180 ?
04181 ============
04182 */
04183 static void Q3_SetUndying( int entID, qboolean undying)
04184 {
04185         G_DebugPrint( WL_WARNING, "Q3_SetUndying: NOT SUPPORTED IN MP\n");
04186         return;
04187 }
04188 
04189 /*
04190 ============
04191 Q3_SetInvincible
04192 
04193 ?
04194 ============
04195 */
04196 static void Q3_SetInvincible( int entID, qboolean invincible)
04197 {
04198         G_DebugPrint( WL_WARNING, "Q3_SetInvicible: NOT SUPPORTED IN MP\n");
04199         return;
04200 }
04201 /*
04202 ============
04203 Q3_SetForceInvincible
04204   Description   : 
04205   Return type   : static void 
04206   Argument              :  int entID
04207   Argument              : qboolean forceInv
04208 ============
04209 */
04210 static void Q3_SetForceInvincible( int entID, qboolean forceInv )
04211 {
04212         G_DebugPrint( WL_WARNING, "Q3_SetForceInvicible: NOT SUPPORTED IN MP\n");
04213         return;
04214 }
04215 
04216 /*
04217 ============
04218 Q3_SetNoAvoid
04219 
04220 ?
04221 ============
04222 */
04223 static void Q3_SetNoAvoid( int entID, qboolean noAvoid)
04224 {
04225         gentity_t       *ent  = &g_entities[entID];
04226 
04227         if ( !ent )
04228         {
04229                 G_DebugPrint( WL_WARNING, "Q3_SetNoAvoid: invalid entID %d\n", entID);
04230                 return;
04231         }
04232 
04233         if ( !ent->NPC )
04234         {
04235                 G_DebugPrint( WL_ERROR, "Q3_SetNoAvoid: '%s' is not an NPC!\n", ent->targetname );
04236                 return;
04237         }
04238 
04239         if(noAvoid)
04240         {
04241                 ent->NPC->aiFlags |= NPCAI_NO_COLL_AVOID;
04242         }
04243         else
04244         {
04245                 ent->NPC->aiFlags &= ~NPCAI_NO_COLL_AVOID;
04246         }
04247 }
04248 
04249 /*
04250 ============
04251 SolidifyOwner
04252   Description   : 
04253   Return type   : void 
04254   Argument              : sharedEntity_t *self
04255 ============
04256 */
04257 void SolidifyOwner( gentity_t *self )
04258 {
04259         int oldContents;
04260         gentity_t *owner = &g_entities[self->r.ownerNum];
04261 
04262         self->nextthink = level.time + FRAMETIME;
04263         self->think = G_FreeEntity;
04264 
04265         if ( !owner || !owner->inuse )
04266         {
04267                 return;
04268         }
04269 
04270         oldContents = owner->r.contents;
04271         owner->r.contents = CONTENTS_BODY;
04272         if ( SpotWouldTelefrag2( owner, owner->r.currentOrigin ) )
04273         {
04274                 owner->r.contents = oldContents;
04275                 self->think = SolidifyOwner;
04276         }
04277         else
04278         {
04279                 trap_ICARUS_TaskIDComplete( owner, TID_RESIZE );
04280         }
04281 }
04282 
04283 
04284 /*
04285 ============
04286 Q3_SetSolid
04287 
04288 ?
04289 ============
04290 */
04291 static qboolean Q3_SetSolid( int entID, qboolean solid)
04292 {
04293         gentity_t       *ent  = &g_entities[entID];
04294         
04295         if ( !ent || !ent->inuse )
04296         {
04297                 G_DebugPrint( WL_WARNING, "Q3_SetSolid: invalid entID %d\n", entID);
04298                 return qtrue;
04299         }
04300 
04301         if ( solid )
04302         {//FIXME: Presumption
04303                 int oldContents = ent->r.contents;
04304                 ent->r.contents = CONTENTS_BODY;
04305                 if ( SpotWouldTelefrag2( ent, ent->r.currentOrigin ) )
04306                 {
04307                         gentity_t *solidifier = G_Spawn();
04308 
04309                         solidifier->r.ownerNum = ent->s.number;
04310 
04311                         solidifier->think = SolidifyOwner;
04312                         solidifier->nextthink = level.time + FRAMETIME;
04313                         
04314                         ent->r.contents = oldContents;
04315                         return qfalse;
04316                 }
04317                 ent->clipmask |= CONTENTS_BODY;
04318         }
04319         else
04320         {//FIXME: Presumption
04321                 if ( ent->s.eFlags & EF_NODRAW )
04322                 {//We're invisible too, so set contents to none
04323                         ent->r.contents = 0;
04324                 }
04325                 else
04326                 {
04327                         ent->r.contents = CONTENTS_CORPSE;
04328                 }
04329         }
04330         return qtrue;
04331 }
04332 
04333 /*
04334 ============
04335 Q3_SetForwardMove
04336 
04337 ?
04338 ============
04339 */
04340 static void Q3_SetForwardMove( int entID, int fmoveVal)
04341 {
04342         gentity_t       *ent  = &g_entities[entID];
04343 
04344         if ( !ent )
04345         {
04346                 G_DebugPrint( WL_WARNING, "Q3_SetForwardMove: invalid entID %d\n", entID);
04347                 return;
04348         }
04349 
04350         if ( !ent->client )
04351         {
04352                 G_DebugPrint( WL_ERROR, "Q3_SetForwardMove: '%s' is not an NPC/player!\n", ent->targetname );
04353                 return;
04354         }
04355 
04356         G_DebugPrint( WL_WARNING, "Q3_SetForwardMove: NOT SUPPORTED IN MP\n");
04357         //ent->client->forced_forwardmove = fmoveVal;
04358 }
04359 
04360 /*
04361 ============
04362 Q3_SetRightMove
04363 
04364 ?
04365 ============
04366 */
04367 static void Q3_SetRightMove( int entID, int rmoveVal)
04368 {
04369         gentity_t       *ent  = &g_entities[entID];
04370 
04371         if ( !ent )
04372         {
04373                 G_DebugPrint( WL_WARNING, "Q3_SetRightMove: invalid entID %d\n", entID);
04374                 return;
04375         }
04376 
04377         if ( !ent->client )
04378         {
04379                 G_DebugPrint( WL_ERROR, "Q3_SetRightMove: '%s' is not an NPC/player!\n", ent->targetname );
04380                 return;
04381         }
04382 
04383         G_DebugPrint( WL_WARNING, "Q3_SetRightMove: NOT SUPPORTED IN MP\n");
04384         //ent->client->forced_rightmove = rmoveVal;
04385 }
04386 
04387 /*
04388 ============
04389 Q3_SetLockAngle
04390 
04391 ?
04392 ============
04393 */
04394 static void Q3_SetLockAngle( int entID, const char *lockAngle)
04395 {
04396         gentity_t       *ent  = &g_entities[entID];
04397 
04398         if ( !ent )
04399         {
04400                 G_DebugPrint( WL_WARNING, "Q3_SetLockAngle: invalid entID %d\n", entID);
04401                 return;
04402         }
04403 
04404         if ( !ent->client )
04405         {
04406                 G_DebugPrint( WL_ERROR, "Q3_SetLockAngle: '%s' is not an NPC/player!\n", ent->targetname );
04407                 return;
04408         }
04409 
04410         G_DebugPrint( WL_WARNING, "Q3_SetLockAngle is not currently available. Ask if you really need it.\n");
04411         /*
04412         if(Q_stricmp("off", lockAngle) == 0)
04413         {//free it
04414                 ent->client->renderInfo.renderFlags &= ~RF_LOCKEDANGLE;
04415         }
04416         else
04417         {
04418                 ent->client->renderInfo.renderFlags |= RF_LOCKEDANGLE;
04419 
04420                 
04421                 if(Q_stricmp("auto", lockAngle) == 0)
04422                 {//use current yaw
04423                         ent->client->renderInfo.lockYaw = ent->client->ps.viewangles[YAW];
04424                 }
04425                 else
04426                 {//specified yaw
04427                         ent->client->renderInfo.lockYaw = atof((char *)lockAngle);
04428                 }
04429         }
04430         */
04431 }
04432 
04433 
04434 /*
04435 ============
04436 Q3_CameraGroup
04437 
04438 ?
04439 ============
04440 */
04441 static void Q3_CameraGroup( int entID, char *camG)
04442 {
04443         G_DebugPrint( WL_WARNING, "Q3_CameraGroup: NOT SUPPORTED IN MP\n");
04444         return;
04445 }
04446 
04447 /*
04448 ============
04449 Q3_CameraGroupZOfs
04450 
04451 ?
04452 ============
04453 */
04454 static void Q3_CameraGroupZOfs( float camGZOfs )
04455 {
04456         G_DebugPrint( WL_WARNING, "Q3_CameraGroupZOfs: NOT SUPPORTED IN MP\n");
04457         return;
04458 }
04459 /*
04460 ============
04461 Q3_CameraGroup
04462 
04463 ?
04464 ============
04465 */
04466 static void Q3_CameraGroupTag( char *camGTag )
04467 {
04468         G_DebugPrint( WL_WARNING, "Q3_CameraGroupTag: NOT SUPPORTED IN MP\n");
04469         return;
04470 }
04471 
04472 /*
04473 ============
04474 Q3_RemoveRHandModel
04475 ============
04476 */
04477 static void Q3_RemoveRHandModel( int entID, char *addModel)
04478 {
04479         G_DebugPrint( WL_WARNING, "Q3_RemoveRHandModel: NOT SUPPORTED IN MP\n");
04480 }
04481 
04482 /*
04483 ============
04484 Q3_AddRHandModel
04485 ============
04486 */
04487 static void Q3_AddRHandModel( int entID, char *addModel)
04488 {
04489         G_DebugPrint( WL_WARNING, "Q3_AddRHandModel: NOT SUPPORTED IN MP\n");
04490 }
04491 
04492 /*
04493 ============
04494 Q3_AddLHandModel
04495 ============
04496 */
04497 static void Q3_AddLHandModel( int entID, char *addModel)
04498 {
04499         G_DebugPrint( WL_WARNING, "Q3_AddLHandModel: NOT SUPPORTED IN MP\n");
04500 }
04501 
04502 /*
04503 ============
04504 Q3_RemoveLHandModel
04505 ============
04506 */
04507 static void Q3_RemoveLHandModel( int entID, char *addModel)
04508 {
04509         G_DebugPrint( WL_WARNING, "Q3_RemoveLHandModel: NOT SUPPORTED IN MP\n");
04510 }
04511 
04512 /*
04513 ============
04514 Q3_LookTarget
04515 
04516 ?
04517 ============
04518 */
04519 static void Q3_LookTarget( int entID, char *targetName)
04520 {
04521         G_DebugPrint( WL_WARNING, "Q3_LookTarget: NOT SUPPORTED IN MP\n");
04522         return;
04523 }
04524 
04525 /*
04526 ============
04527 Q3_Face
04528 
04529 ?
04530 ============
04531 */
04532 static void Q3_Face( int entID,int expression, float holdtime)
04533 {
04534         G_DebugPrint( WL_WARNING, "Q3_Face: NOT SUPPORTED IN MP\n");
04535 }
04536 
04537 /*
04538 ============
04539 Q3_SetLocation
04540   Description   : 
04541   Return type   : qboolean 
04542   Argument              :  int entID
04543   Argument              : const char *location
04544 ============
04545 */
04546 static qboolean Q3_SetLocation( int entID, const char *location )
04547 {
04548         G_DebugPrint( WL_WARNING, "Q3_SetLocation: NOT SUPPORTED IN MP\n");
04549         return qtrue;
04550 }
04551 
04552 /*
04553 ============
04554 Q3_SetPlayerLocked
04555   Description   : 
04556   Return type   : void 
04557   Argument              :  int entID
04558   Argument              : qboolean locked
04559 ============
04560 */
04561 qboolean        player_locked = qfalse;
04562 static void Q3_SetPlayerLocked( int entID, qboolean locked )
04563 {
04564         G_DebugPrint( WL_WARNING, "Q3_SetPlayerLocked: NOT SUPPORTED IN MP\n");
04565 }
04566 
04567 /*
04568 ============
04569 Q3_SetLockPlayerWeapons
04570   Description   : 
04571   Return type   : void 
04572   Argument              :  int entID
04573   Argument              : qboolean locked
04574 ============
04575 */
04576 static void Q3_SetLockPlayerWeapons( int entID, qboolean locked )
04577 {
04578         G_DebugPrint( WL_WARNING, "Q3_SetLockPlayerWeapons: NOT SUPPORTED IN MP\n");
04579 }
04580 
04581 
04582 /*
04583 ============
04584 Q3_SetNoImpactDamage
04585   Description   : 
04586   Return type   : void 
04587   Argument              :  int entID
04588   Argument              : qboolean locked
04589 ============
04590 */
04591 static void Q3_SetNoImpactDamage( int entID, qboolean noImp )
04592 {
04593         G_DebugPrint( WL_WARNING, "Q3_SetNoImpactDamage: NOT SUPPORTED IN MP\n");
04594 }
04595 
04596 /*
04597 ============
04598 Q3_SetBehaviorSet
04599 
04600 ?
04601 ============
04602 */
04603 static qboolean Q3_SetBehaviorSet( int entID, int toSet, const char *scriptname)
04604 {
04605         gentity_t       *ent  = &g_entities[entID];
04606         bSet_t          bSet = BSET_INVALID;
04607 
04608         if ( !ent )
04609         {
04610                 G_DebugPrint( WL_WARNING, "Q3_SetBehaviorSet: invalid entID %d\n", entID);
04611                 return qfalse;
04612         }
04613 
04614         switch(toSet)
04615         {
04616         case SET_SPAWNSCRIPT:
04617                 bSet = BSET_SPAWN;
04618                 break;
04619         case SET_USESCRIPT:
04620                 bSet = BSET_USE;
04621                 break;
04622         case SET_AWAKESCRIPT:
04623                 bSet = BSET_AWAKE;
04624                 break;
04625         case SET_ANGERSCRIPT:
04626                 bSet = BSET_ANGER;
04627                 break;
04628         case SET_ATTACKSCRIPT:
04629                 bSet = BSET_ATTACK;
04630                 break;
04631         case SET_VICTORYSCRIPT:
04632                 bSet = BSET_VICTORY;
04633                 break;
04634         case SET_LOSTENEMYSCRIPT:
04635                 bSet = BSET_LOSTENEMY;
04636                 break;
04637         case SET_PAINSCRIPT:
04638                 bSet = BSET_PAIN;
04639                 break;
04640         case SET_FLEESCRIPT:
04641                 bSet = BSET_FLEE;
04642                 break;
04643         case SET_DEATHSCRIPT:
04644                 bSet = BSET_DEATH;
04645                 break;
04646         case SET_DELAYEDSCRIPT:
04647                 bSet = BSET_DELAYED;
04648                 break;
04649         case SET_BLOCKEDSCRIPT:
04650                 bSet = BSET_BLOCKED;
04651                 break;
04652         case SET_FFIRESCRIPT:
04653                 bSet = BSET_FFIRE;
04654                 break;
04655         case SET_FFDEATHSCRIPT:
04656                 bSet = BSET_FFDEATH;
04657                 break;
04658         case SET_MINDTRICKSCRIPT:
04659                 bSet = BSET_MINDTRICK;
04660                 break;
04661         }
04662 
04663         if(bSet < BSET_SPAWN || bSet >= NUM_BSETS)
04664         {
04665                 return qfalse;
04666         }
04667 
04668         if(!Q_stricmp("NULL", scriptname))
04669         {
04670                 if ( ent->behaviorSet[bSet] != NULL )
04671                 {
04672 //                      gi.TagFree( ent->behaviorSet[bSet] );
04673                 }
04674 
04675                 ent->behaviorSet[bSet] = NULL;
04676                 //memset( &ent->behaviorSet[bSet], 0, sizeof(ent->behaviorSet[bSet]) );
04677         }
04678         else
04679         {
04680                 if ( scriptname )
04681                 {
04682                         if ( ent->behaviorSet[bSet] != NULL )
04683                         {
04684 //                              gi.TagFree( ent->behaviorSet[bSet] );
04685                         }
04686                         
04687                         ent->behaviorSet[bSet] = G_NewString( (char *) scriptname );    //FIXME: This really isn't good...
04688                 }
04689 
04690                 //ent->behaviorSet[bSet] = scriptname;
04691                 //strncpy( (char *) &ent->behaviorSet[bSet], scriptname, MAX_BSET_LENGTH );
04692         }
04693         return qtrue;
04694 }
04695 
04696 /*
04697 ============
04698 Q3_SetDelayScriptTime
04699 
04700 ?
04701 ============
04702 */
04703 static void Q3_SetDelayScriptTime(int entID, int delayTime)
04704 {
04705         G_DebugPrint( WL_WARNING, "Q3_SetDelayScriptTime: NOT SUPPORTED IN MP\n");
04706 }
04707 
04708         
04709 
04710 
04711 /*
04712 ============
04713 Q3_SetPlayerUsable
04714   Description   : 
04715   Return type   : void 
04716   Argument              :  int entID
04717   Argument              : qboolean usable
04718 ============
04719 */
04720 static void Q3_SetPlayerUsable( int entID, qboolean usable )
04721 {
04722         gentity_t       *ent  = &g_entities[entID];
04723 
04724         if ( !ent )
04725         {
04726                 G_DebugPrint( WL_WARNING, "Q3_SetPlayerUsable: invalid entID %d\n", entID);
04727                 return;
04728         }
04729 
04730         if(usable)
04731         {
04732                 ent->r.svFlags |= SVF_PLAYER_USABLE;
04733         }
04734         else
04735         {
04736                 ent->r.svFlags &= ~SVF_PLAYER_USABLE;
04737         }
04738 }
04739 
04740 /*
04741 ============
04742 Q3_SetDisableShaderAnims
04743   Description   : 
04744   Return type   : static void 
04745   Argument              :  int entID
04746   Argument              : int disabled
04747 ============
04748 */
04749 static void Q3_SetDisableShaderAnims( int entID, int disabled )
04750 {
04751         G_DebugPrint( WL_WARNING, "Q3_SetDisableShaderAnims: NOT SUPPORTED IN MP\n");
04752         return;
04753 }
04754 
04755 /*
04756 ============
04757 Q3_SetShaderAnim
04758   Description   : 
04759   Return type   : static void 
04760   Argument              :  int entID
04761   Argument              : int disabled
04762 ============
04763 */
04764 static void Q3_SetShaderAnim( int entID, int disabled )
04765 {
04766         G_DebugPrint( WL_WARNING, "Q3_SetShaderAnim: NOT SUPPORTED IN MP\n");
04767         return;
04768 }
04769 
04770 /*
04771 ============
04772 Q3_SetStartFrame
04773   Description   : 
04774   Return type   : static void 
04775   Argument              :  int entID
04776   Argument              : int startFrame
04777 ============
04778 */
04779 static void Q3_SetStartFrame( int entID, int startFrame )
04780 {
04781         G_DebugPrint( WL_WARNING, "Q3_SetStartFrame: NOT SUPPORTED IN MP\n");
04782 }
04783 
04784 
04785 /*
04786 ============
04787 Q3_SetEndFrame
04788   Description   : 
04789   Return type   : static void 
04790   Argument              :  int entID
04791   Argument              : int endFrame
04792 ============
04793 */
04794 static void Q3_SetEndFrame( int entID, int endFrame )
04795 {
04796         G_DebugPrint( WL_WARNING, "Q3_SetEndFrame: NOT SUPPORTED IN MP\n");
04797 }
04798 
04799 /*
04800 ============
04801 Q3_SetAnimFrame
04802   Description   : 
04803   Return type   : static void 
04804   Argument              :  int entID
04805   Argument              : int startFrame
04806 ============
04807 */
04808 static void Q3_SetAnimFrame( int entID, int animFrame )
04809 {
04810         G_DebugPrint( WL_WARNING, "Q3_SetAnimFrame: NOT SUPPORTED IN MP\n");
04811 }
04812 
04813 /*
04814 ============
04815 Q3_SetLoopAnim
04816   Description   : 
04817   Return type   : void 
04818   Argument              :  int entID
04819   Argument              : qboolean loopAnim
04820 ============
04821 */
04822 static void Q3_SetLoopAnim( int entID, qboolean loopAnim )
04823 {
04824         G_DebugPrint( WL_WARNING, "Q3_SetLoopAnim: NOT SUPPORTED IN MP\n");
04825 }
04826 
04827 
04828 /*
04829 ============
04830 Q3_SetShields
04831   Description   : 
04832   Return type   : void 
04833   Argument              :  int entID
04834   Argument              : qboolean shields
04835 ============
04836 */
04837 static void Q3_SetShields( int entID, qboolean shields )
04838 {
04839         G_DebugPrint( WL_WARNING, "Q3_SetShields: NOT SUPPORTED IN MP\n");
04840         return;
04841 }
04842 
04843 /*
04844 ============
04845 Q3_SetSaberActive
04846   Description   : 
04847   Return type   : void 
04848   Argument              :  int entID
04849   Argument              : qboolean shields
04850 ============
04851 */
04852 static void Q3_SetSaberActive( int entID, qboolean active )
04853 {
04854         gentity_t *ent = &g_entities[entID];
04855 
04856         if (!ent || !ent->inuse)
04857         {
04858                 return;
04859         }
04860 
04861         if (!ent->client)
04862         {
04863                 G_DebugPrint( WL_WARNING, "Q3_SetSaberActive: %d is not a client\n", entID);
04864         }
04865 
04866         //fixme: Take into account player being in state where saber won't toggle? For now we simply won't care.
04867         if (!ent->client->ps.saberHolstered && active)
04868         {
04869                 Cmd_ToggleSaber_f(ent);
04870         }
04871         else if (BG_SabersOff( &ent->client->ps ) && !active)
04872         {
04873                 Cmd_ToggleSaber_f(ent);
04874         }
04875 }
04876 
04877 /*
04878 ============
04879 Q3_SetNoKnockback
04880   Description   : 
04881   Return type   : void 
04882   Argument              :  int entID
04883   Argument              : qboolean noKnockback
04884 ============
04885 */
04886 static void Q3_SetNoKnockback( int entID, qboolean noKnockback )
04887 {
04888         gentity_t       *ent  = &g_entities[entID];
04889 
04890         if ( !ent )
04891         {
04892                 G_DebugPrint( WL_WARNING, "Q3_SetNoKnockback: invalid entID %d\n", entID);
04893                 return;
04894         }
04895 
04896         if ( noKnockback )
04897         {
04898                 ent->flags |= FL_NO_KNOCKBACK;
04899         }
04900         else
04901         {
04902                 ent->flags &= ~FL_NO_KNOCKBACK;
04903         }
04904 }
04905 
04906 /*
04907 ============
04908 Q3_SetCleanDamagingEnts
04909   Description   : 
04910   Return type   : void 
04911 ============
04912 */
04913 static void Q3_SetCleanDamagingEnts( void )
04914 {
04915         G_DebugPrint( WL_WARNING, "Q3_SetCleanDamagingEnts: NOT SUPPORTED IN MP\n");
04916         return;
04917 }
04918 
04919 vec4_t textcolor_caption;
04920 vec4_t textcolor_center;
04921 vec4_t textcolor_scroll;
04922 
04923 /*
04924 -------------------------
04925 SetTextColor
04926 -------------------------
04927 */
04928 static void SetTextColor ( vec4_t textcolor,const char *color)
04929 {
04930         G_DebugPrint( WL_WARNING, "SetTextColor: NOT SUPPORTED IN MP\n");
04931         return;
04932 }
04933 
04934 /*
04935 =============
04936 Q3_SetCaptionTextColor
04937 
04938 Change color text prints in
04939 =============
04940 */
04941 static void Q3_SetCaptionTextColor ( const char *color)
04942 {
04943         SetTextColor(textcolor_caption,color);
04944 }
04945 
04946 /*
04947 =============
04948 Q3_SetCenterTextColor
04949 
04950 Change color text prints in
04951 =============
04952 */
04953 static void Q3_SetCenterTextColor ( const char *color)
04954 {
04955         SetTextColor(textcolor_center,color);
04956 }
04957 
04958 /*
04959 =============
04960 Q3_SetScrollTextColor
04961 
04962 Change color text prints in
04963 =============
04964 */
04965 static void Q3_SetScrollTextColor ( const char *color)
04966 {
04967         SetTextColor(textcolor_scroll,color);
04968 }
04969 
04970 /*
04971 =============
04972 Q3_ScrollText
04973 
04974 Prints a message in the center of the screen
04975 =============
04976 */
04977 static void Q3_ScrollText ( const char *id)
04978 {
04979         G_DebugPrint( WL_WARNING, "Q3_ScrollText: NOT SUPPORTED IN MP\n");
04980         //trap_SendServerCommand( -1, va("st \"%s\"", id));
04981 
04982         return;
04983 }
04984 
04985 /*
04986 =============
04987 Q3_LCARSText
04988 
04989 Prints a message in the center of the screen giving it an LCARS frame around it
04990 =============
04991 */
04992 static void Q3_LCARSText ( const char *id)
04993 {
04994         G_DebugPrint( WL_WARNING, "Q3_ScrollText: NOT SUPPORTED IN MP\n");
04995         //trap_SendServerCommand( -1, va("lt \"%s\"", id));
04996 
04997         return;
04998 }
04999 
05000 void UnLockDoors(gentity_t *const ent);
05001 void LockDoors(gentity_t *const ent);
05002 
05003 //returns qtrue if it got to the end, otherwise qfalse.
05004 qboolean Q3_Set( int taskID, int entID, const char *type_name, const char *data )
05005 {
05006         gentity_t       *ent = &g_entities[entID];
05007         float           float_data;
05008         int                     int_data, toSet;
05009         vec3_t          vector_data;
05010 
05011         //Set this for callbacks
05012         toSet = GetIDForString( setTable, type_name );
05013 
05014         //TODO: Throw in a showscript command that will list each command and what they're doing...
05015         //              maybe as simple as printing that line of the script to the console preceeded by the person's name?
05016         //              showscript can take any number of targetnames or "all"?  Groupname?
05017         switch ( toSet )
05018         {
05019         case SET_ORIGIN:
05020                 sscanf( data, "%f %f %f", &vector_data[0], &vector_data[1], &vector_data[2] );
05021                 G_SetOrigin( ent, vector_data );
05022                 if ( Q_strncmp( "NPC_", ent->classname, 4 ) == 0 )
05023                 {//hack for moving spawners
05024                         VectorCopy( vector_data, ent->s.origin);
05025                 }
05026                 break;
05027 
05028         case SET_TELEPORT_DEST:
05029                 sscanf( data, "%f %f %f", &vector_data[0], &vector_data[1], &vector_data[2] );
05030                 if ( !Q3_SetTeleportDest( entID, vector_data ) )
05031                 {
05032                         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
05033                         return qfalse;
05034                 }
05035                 break;
05036 
05037         case SET_COPY_ORIGIN:
05038                 Q3_SetCopyOrigin( entID, (char *) data );
05039                 break;
05040 
05041         case SET_ANGLES:
05042                 //Q3_SetAngles( entID, *(vec3_t *) data);
05043                 sscanf( data, "%f %f %f", &vector_data[0], &vector_data[1], &vector_data[2] );
05044                 Q3_SetAngles( entID, vector_data);
05045                 break;
05046 
05047         case SET_XVELOCITY:
05048                 float_data = atof((char *) data);
05049                 Q3_SetVelocity( entID, 0, float_data);
05050                 break;
05051         
05052         case SET_YVELOCITY:
05053                 float_data = atof((char *) data);
05054                 Q3_SetVelocity( entID, 1, float_data);
05055                 break;
05056 
05057         case SET_ZVELOCITY:
05058                 float_data = atof((char *) data);
05059                 Q3_SetVelocity( entID, 2, float_data);
05060                 break;
05061 
05062         case SET_Z_OFFSET:
05063                 float_data = atof((char *) data);
05064                 Q3_SetOriginOffset( entID, 2, float_data);
05065                 break;
05066 
05067         case SET_ENEMY:
05068                 Q3_SetEnemy( entID, (char *) data );
05069                 break;
05070 
05071         case SET_LEADER:
05072                 Q3_SetLeader( entID, (char *) data );
05073                 break;
05074 
05075         case SET_NAVGOAL:
05076                 if ( Q3_SetNavGoal( entID, (char *) data ) )
05077                 {
05078                         trap_ICARUS_TaskIDSet( ent, TID_MOVE_NAV, taskID );
05079                         return qfalse;  //Don't call it back
05080                 }
05081                 break;
05082 
05083         case SET_ANIM_UPPER:
05084                 if ( Q3_SetAnimUpper( entID, (char *) data ) )
05085                 {
05086                         Q3_TaskIDClear( &ent->taskID[TID_ANIM_BOTH] );//We only want to wait for the top
05087                         trap_ICARUS_TaskIDSet( ent, TID_ANIM_UPPER, taskID );
05088                         return qfalse;  //Don't call it back
05089                 }
05090                 break;
05091 
05092         case SET_ANIM_LOWER:
05093                 if ( Q3_SetAnimLower( entID, (char *) data ) )
05094                 {
05095                         Q3_TaskIDClear( &ent->taskID[TID_ANIM_BOTH] );//We only want to wait for the bottom
05096                         trap_ICARUS_TaskIDSet( ent, TID_ANIM_LOWER, taskID );
05097                         return qfalse;  //Don't call it back
05098                 }
05099                 break;
05100 
05101         case SET_ANIM_BOTH:
05102                 {
05103                         int     both = 0;
05104                         if ( Q3_SetAnimUpper( entID, (char *) data ) )
05105                         {
05106                                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_UPPER, taskID );
05107                                 both++;
05108                         }
05109                         else
05110                         {
05111                                 G_DebugPrint( WL_ERROR, "Q3_SetAnimUpper: %s does not have anim %s!\n", ent->targetname, (char *)data );
05112                         }
05113                         if ( Q3_SetAnimLower( entID, (char *) data ) )
05114                         {
05115                                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_LOWER, taskID );
05116                                 both++;
05117                         }
05118                         else
05119                         {
05120                                 G_DebugPrint( WL_ERROR, "Q3_SetAnimLower: %s does not have anim %s!\n", ent->targetname, (char *)data );
05121                         }
05122                         if ( both >= 2 )
05123                         {
05124                                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_BOTH, taskID );
05125                         }
05126                         if ( both )
05127                         {
05128                                 return qfalse;  //Don't call it back
05129                         }
05130                 }
05131                 break;
05132         
05133         case SET_ANIM_HOLDTIME_LOWER:
05134                 int_data = atoi((char *) data);
05135                 Q3_SetAnimHoldTime( entID, int_data, qtrue );
05136                 Q3_TaskIDClear( &ent->taskID[TID_ANIM_BOTH] );//We only want to wait for the bottom
05137                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_LOWER, taskID );
05138                 return qfalse;  //Don't call it back
05139                 break;
05140 
05141         case SET_ANIM_HOLDTIME_UPPER:
05142                 int_data = atoi((char *) data);
05143                 Q3_SetAnimHoldTime( entID, int_data, qfalse );
05144                 Q3_TaskIDClear( &ent->taskID[TID_ANIM_BOTH] );//We only want to wait for the top
05145                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_UPPER, taskID );
05146                 return qfalse;  //Don't call it back
05147                 break;
05148 
05149         case SET_ANIM_HOLDTIME_BOTH:
05150                 int_data = atoi((char *) data);
05151                 Q3_SetAnimHoldTime( entID, int_data, qfalse );
05152                 Q3_SetAnimHoldTime( entID, int_data, qtrue );
05153                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_BOTH, taskID );
05154                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_UPPER, taskID );
05155                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_LOWER, taskID );
05156                 return qfalse;  //Don't call it back
05157                 break;
05158 
05159         case SET_PLAYER_TEAM:
05160                 G_DebugPrint( WL_WARNING, "Q3_SetPlayerTeam: Not in MP ATM, let a programmer (ideally Rich) know if you need it\n");
05161                 break;
05162 
05163         case SET_ENEMY_TEAM:
05164                 G_DebugPrint( WL_WARNING, "Q3_SetEnemyTeam: NOT SUPPORTED IN MP\n");
05165                 break;
05166 
05167         case SET_HEALTH:
05168                 int_data = atoi((char *) data);
05169                 Q3_SetHealth( entID, int_data );
05170                 break;
05171 
05172         case SET_ARMOR:
05173                 int_data = atoi((char *) data);
05174                 Q3_SetArmor( entID, int_data );
05175                 break;
05176 
05177         case SET_BEHAVIOR_STATE:
05178                 if( !Q3_SetBState( entID, (char *) data ) )
05179                 {
05180                         trap_ICARUS_TaskIDSet( ent, TID_BSTATE, taskID );
05181                         return qfalse;//don't complete
05182                 }
05183                 break;
05184 
05185         case SET_DEFAULT_BSTATE:
05186                 Q3_SetDefaultBState( entID, (char *) data );
05187                 break;
05188 
05189         case SET_TEMP_BSTATE:
05190                 if( !Q3_SetTempBState( entID, (char *) data ) )
05191                 {
05192                         trap_ICARUS_TaskIDSet( ent, TID_BSTATE, taskID );
05193                         return qfalse;//don't complete
05194                 }
05195                 break;
05196 
05197         case SET_CAPTURE:
05198                 Q3_SetCaptureGoal( entID, (char *) data );
05199                 break;
05200 
05201         case SET_DPITCH://FIXME: make these set tempBehavior to BS_FACE and await completion?  Or set lockedDesiredPitch/Yaw and aimTime?
05202                 float_data = atof((char *) data);
05203                 Q3_SetDPitch( entID, float_data );
05204                 trap_ICARUS_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
05205                 return qfalse;
05206                 break;
05207 
05208         case SET_DYAW:
05209                 float_data = atof((char *) data);
05210                 Q3_SetDYaw( entID, float_data );
05211                 trap_ICARUS_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
05212                 return qfalse;
05213                 break;
05214 
05215         case SET_EVENT:
05216                 Q3_SetEvent( entID, (char *) data );
05217                 break;
05218 
05219         case SET_VIEWTARGET:
05220                 Q3_SetViewTarget( entID, (char *) data );
05221                 trap_ICARUS_TaskIDSet( ent, TID_ANGLE_FACE, taskID );
05222                 return qfalse;
05223                 break;
05224 
05225         case SET_WATCHTARGET:
05226                 Q3_SetWatchTarget( entID, (char *) data );
05227                 break;
05228 
05229         case SET_VIEWENTITY:
05230                 Q3_SetViewEntity( entID, (char *) data );
05231                 break;
05232 
05233         case SET_LOOPSOUND:
05234                 Q3_SetLoopSound( entID, (char *) data );
05235                 break;
05236 
05237         case SET_ICARUS_FREEZE:
05238         case SET_ICARUS_UNFREEZE:
05239                 Q3_SetICARUSFreeze( entID, (char *) data, (qboolean)(toSet==SET_ICARUS_FREEZE) );
05240                 break;
05241 
05242         case SET_WEAPON:
05243                 Q3_SetWeapon ( entID, (char *) data);
05244                 break;
05245 
05246         case SET_ITEM:
05247                 Q3_SetItem ( entID, (char *) data);
05248                 break;
05249 
05250         case SET_WALKSPEED:
05251                 int_data = atoi((char *) data);
05252                 Q3_SetWalkSpeed ( entID, int_data);
05253                 break;
05254 
05255         case SET_RUNSPEED:
05256                 int_data = atoi((char *) data);
05257                 Q3_SetRunSpeed ( entID, int_data);
05258                 break;
05259 
05260         case SET_WIDTH:
05261                 int_data = atoi((char *) data);
05262                 Q3_SetWidth( entID, int_data );
05263                 return qfalse;
05264                 break;
05265 
05266         case SET_YAWSPEED:
05267                 float_data = atof((char *) data);
05268                 Q3_SetYawSpeed ( entID, float_data);
05269                 break;
05270 
05271         case SET_AGGRESSION:
05272                 int_data = atoi((char *) data);
05273                 Q3_SetAggression ( entID, int_data);
05274                 break;
05275 
05276         case SET_AIM:
05277                 int_data = atoi((char *) data);
05278                 Q3_SetAim ( entID, int_data);
05279                 break;
05280 
05281         case SET_FRICTION:
05282                 int_data = atoi((char *) data);
05283                 Q3_SetFriction ( entID, int_data);
05284                 break;
05285 
05286         case SET_GRAVITY:
05287                 float_data = atof((char *) data);
05288                 Q3_SetGravity ( entID, float_data);
05289                 break;
05290 
05291         case SET_WAIT:
05292                 float_data = atof((char *) data);
05293                 Q3_SetWait( entID, float_data);
05294                 break;
05295 
05296         case SET_FOLLOWDIST:
05297                 float_data = atof((char *) data);
05298                 Q3_SetFollowDist( entID, float_data);
05299                 break;
05300 
05301         case SET_SCALE:
05302                 float_data = atof((char *) data);
05303                 Q3_SetScale( entID, float_data);
05304                 break;
05305 
05306         case SET_COUNT:
05307                 Q3_SetCount( entID, (char *) data);
05308                 break;
05309 
05310         case SET_SHOT_SPACING:
05311                 int_data = atoi((char *) data);
05312                 Q3_SetShotSpacing( entID, int_data );
05313                 break;
05314 
05315         case SET_IGNOREPAIN:
05316                 if(!Q_stricmp("true", ((char *)data)))
05317                         Q3_SetIgnorePain( entID, qtrue);
05318                 else if(!Q_stricmp("false", ((char *)data)))
05319                         Q3_SetIgnorePain( entID, qfalse);
05320                 break;
05321 
05322         case SET_IGNOREENEMIES:
05323                 if(!Q_stricmp("true", ((char *)data)))
05324                         Q3_SetIgnoreEnemies( entID, qtrue);
05325                 else if(!Q_stricmp("false", ((char *)data)))
05326                         Q3_SetIgnoreEnemies( entID, qfalse);
05327                 break;
05328 
05329         case SET_IGNOREALERTS:
05330                 if(!Q_stricmp("true", ((char *)data)))
05331                         Q3_SetIgnoreAlerts( entID, qtrue);
05332                 else if(!Q_stricmp("false", ((char *)data)))
05333                         Q3_SetIgnoreAlerts( entID, qfalse);
05334                 break;
05335                 
05336         case SET_DONTSHOOT:
05337                 if(!Q_stricmp("true", ((char *)data)))
05338                         Q3_SetDontShoot( entID, qtrue);
05339                 else if(!Q_stricmp("false", ((char *)data)))
05340                         Q3_SetDontShoot( entID, qfalse);
05341                 break;
05342         
05343         case SET_DONTFIRE:
05344                 if(!Q_stricmp("true", ((char *)data)))
05345                         Q3_SetDontFire( entID, qtrue);
05346                 else if(!Q_stricmp("false", ((char *)data)))
05347                         Q3_SetDontFire( entID, qfalse);
05348                 break;
05349 
05350         case SET_LOCKED_ENEMY:
05351                 if(!Q_stricmp("true", ((char *)data)))
05352                         Q3_SetLockedEnemy( entID, qtrue);
05353                 else if(!Q_stricmp("false", ((char *)data)))
05354                         Q3_SetLockedEnemy( entID, qfalse);
05355                 break;
05356 
05357         case SET_NOTARGET:
05358                 if(!Q_stricmp("true", ((char *)data)))
05359                         Q3_SetNoTarget( entID, qtrue);
05360                 else if(!Q_stricmp("false", ((char *)data)))
05361                         Q3_SetNoTarget( entID, qfalse);
05362                 break;
05363 
05364         case SET_LEAN:
05365                 G_DebugPrint( WL_WARNING, "SET_LEAN NOT SUPPORTED IN MP\n" );
05366                 break;
05367 
05368         case SET_SHOOTDIST:
05369                 float_data = atof((char *) data);
05370                 Q3_SetShootDist( entID, float_data );
05371                 break;
05372 
05373         case SET_TIMESCALE:
05374                 Q3_SetTimeScale( entID, (char *) data );
05375                 break;
05376 
05377         case SET_VISRANGE:
05378                 float_data = atof((char *) data);
05379                 Q3_SetVisrange( entID, float_data );
05380                 break;
05381         
05382         case SET_EARSHOT:
05383                 float_data = atof((char *) data);
05384                 Q3_SetEarshot( entID, float_data );
05385                 break;
05386         
05387         case SET_VIGILANCE:
05388                 float_data = atof((char *) data);
05389                 Q3_SetVigilance( entID, float_data );
05390                 break;
05391         
05392         case SET_VFOV:
05393                 int_data = atoi((char *) data);
05394                 Q3_SetVFOV( entID, int_data );
05395                 break;
05396 
05397         case SET_HFOV:
05398                 int_data = atoi((char *) data);
05399                 Q3_SetHFOV( entID, int_data );
05400                 break;
05401 
05402         case SET_TARGETNAME:
05403                 Q3_SetTargetName( entID, (char *) data );
05404                 break;
05405 
05406         case SET_TARGET:
05407                 Q3_SetTarget( entID, (char *) data );
05408                 break;
05409 
05410         case SET_TARGET2:
05411                 Q3_SetTarget2( entID, (char *) data );
05412                 break;
05413         
05414         case SET_LOCATION:
05415                 if ( !Q3_SetLocation( entID, (char *) data ) )
05416                 {
05417                         trap_ICARUS_TaskIDSet( ent, TID_LOCATION, taskID );
05418                         return qfalse;
05419                 }
05420                 break;
05421 
05422         case SET_PAINTARGET:
05423                 Q3_SetPainTarget( entID, (char *) data );
05424                 break;
05425 
05426         case SET_DEFEND_TARGET:
05427                 G_DebugPrint( WL_WARNING, "Q3_SetDefendTarget unimplemented\n", entID );
05428                 //Q3_SetEnemy( entID, (char *) data);
05429                 break;
05430 
05431         case SET_PARM1:
05432         case SET_PARM2:
05433         case SET_PARM3:
05434         case SET_PARM4:
05435         case SET_PARM5:
05436         case SET_PARM6:
05437         case SET_PARM7:
05438         case SET_PARM8:
05439         case SET_PARM9:
05440         case SET_PARM10:
05441         case SET_PARM11:
05442         case SET_PARM12:
05443         case SET_PARM13:
05444         case SET_PARM14:
05445         case SET_PARM15:
05446         case SET_PARM16:
05447                 Q3_SetParm( entID, (toSet-SET_PARM1), (char *) data );
05448                 break;
05449 
05450         case SET_SPAWNSCRIPT:
05451         case SET_USESCRIPT:
05452         case SET_AWAKESCRIPT:
05453         case SET_ANGERSCRIPT:
05454         case SET_ATTACKSCRIPT:
05455         case SET_VICTORYSCRIPT:
05456         case SET_PAINSCRIPT:
05457         case SET_FLEESCRIPT:
05458         case SET_DEATHSCRIPT:
05459         case SET_DELAYEDSCRIPT:
05460         case SET_BLOCKEDSCRIPT:
05461         case SET_FFIRESCRIPT:
05462         case SET_FFDEATHSCRIPT:
05463         case SET_MINDTRICKSCRIPT:
05464                 if( !Q3_SetBehaviorSet(entID, toSet, (char *) data) )
05465                         G_DebugPrint( WL_ERROR, "Q3_SetBehaviorSet: Invalid bSet %s\n", type_name );
05466                 break;
05467 
05468         case SET_NO_MINDTRICK:
05469                 if(!Q_stricmp("true", ((char *)data)))
05470                         Q3_SetNoMindTrick( entID, qtrue);
05471                 else
05472                         Q3_SetNoMindTrick( entID, qfalse);
05473                 break;
05474 
05475         case SET_CINEMATIC_SKIPSCRIPT :
05476                 Q3_SetCinematicSkipScript((char *) data);
05477                 break;
05478 
05479 
05480         case SET_DELAYSCRIPTTIME:
05481                 int_data = atoi((char *) data);
05482                 Q3_SetDelayScriptTime( entID, int_data );
05483                 break;
05484 
05485         case SET_CROUCHED:
05486                 if(!Q_stricmp("true", ((char *)data)))
05487                         Q3_SetCrouched( entID, qtrue);
05488                 else
05489                         Q3_SetCrouched( entID, qfalse);
05490                 break;
05491 
05492         case SET_WALKING:
05493                 if(!Q_stricmp("true", ((char *)data)))
05494                         Q3_SetWalking( entID, qtrue);   
05495                 else
05496                         Q3_SetWalking( entID, qfalse);  
05497                 break;
05498 
05499         case SET_RUNNING:
05500                 if(!Q_stricmp("true", ((char *)data)))
05501                         Q3_SetRunning( entID, qtrue);   
05502                 else
05503                         Q3_SetRunning( entID, qfalse);  
05504                 break;
05505 
05506         case SET_CHASE_ENEMIES:
05507                 if(!Q_stricmp("true", ((char *)data)))
05508                         Q3_SetChaseEnemies( entID, qtrue);      
05509                 else
05510                         Q3_SetChaseEnemies( entID, qfalse);     
05511                 break;
05512 
05513         case SET_LOOK_FOR_ENEMIES:
05514                 if(!Q_stricmp("true", ((char *)data)))
05515                         Q3_SetLookForEnemies( entID, qtrue);    
05516                 else
05517                         Q3_SetLookForEnemies( entID, qfalse);   
05518                 break;
05519 
05520         case SET_FACE_MOVE_DIR:
05521                 if(!Q_stricmp("true", ((char *)data)))
05522                         Q3_SetFaceMoveDir( entID, qtrue);       
05523                 else
05524                         Q3_SetFaceMoveDir( entID, qfalse);      
05525                 break;
05526 
05527         case SET_ALT_FIRE:
05528                 if(!Q_stricmp("true", ((char *)data)))
05529                         Q3_SetAltFire( entID, qtrue);   
05530                 else
05531                         Q3_SetAltFire( entID, qfalse);  
05532                 break;
05533 
05534         case SET_DONT_FLEE:
05535                 if(!Q_stricmp("true", ((char *)data)))
05536                         Q3_SetDontFlee( entID, qtrue);  
05537                 else
05538                         Q3_SetDontFlee( entID, qfalse); 
05539                 break;
05540 
05541         case SET_FORCED_MARCH:
05542                 if(!Q_stricmp("true", ((char *)data)))
05543                         Q3_SetForcedMarch( entID, qtrue);       
05544                 else
05545                         Q3_SetForcedMarch( entID, qfalse);      
05546                 break;
05547 
05548         case SET_NO_RESPONSE:
05549                 if(!Q_stricmp("true", ((char *)data)))
05550                         Q3_SetNoResponse( entID, qtrue);        
05551                 else
05552                         Q3_SetNoResponse( entID, qfalse);       
05553                 break;
05554 
05555         case SET_NO_COMBAT_TALK:
05556                 if(!Q_stricmp("true", ((char *)data)))
05557                         Q3_SetCombatTalk( entID, qtrue);        
05558                 else
05559                         Q3_SetCombatTalk( entID, qfalse);       
05560                 break;
05561 
05562         case SET_NO_ALERT_TALK:
05563                 if(!Q_stricmp("true", ((char *)data)))
05564                         Q3_SetAlertTalk( entID, qtrue); 
05565                 else
05566                         Q3_SetAlertTalk( entID, qfalse);        
05567                 break;
05568 
05569         case SET_USE_CP_NEAREST:
05570                 if(!Q_stricmp("true", ((char *)data)))
05571                         Q3_SetUseCpNearest( entID, qtrue);      
05572                 else
05573                         Q3_SetUseCpNearest( entID, qfalse);     
05574                 break;
05575 
05576         case SET_NO_FORCE:
05577                 if(!Q_stricmp("true", ((char *)data)))
05578                         Q3_SetNoForce( entID, qtrue);   
05579                 else
05580                         Q3_SetNoForce( entID, qfalse);  
05581                 break;
05582 
05583         case SET_NO_ACROBATICS:
05584                 if(!Q_stricmp("true", ((char *)data)))
05585                         Q3_SetNoAcrobatics( entID, qtrue);      
05586                 else
05587                         Q3_SetNoAcrobatics( entID, qfalse);     
05588                 break;
05589 
05590         case SET_USE_SUBTITLES:
05591                 if(!Q_stricmp("true", ((char *)data)))
05592                         Q3_SetUseSubtitles( entID, qtrue);      
05593                 else
05594                         Q3_SetUseSubtitles( entID, qfalse);     
05595                 break;
05596 
05597         case SET_NO_FALLTODEATH:
05598                 if(!Q_stricmp("true", ((char *)data)))
05599                         Q3_SetNoFallToDeath( entID, qtrue);     
05600                 else
05601                         Q3_SetNoFallToDeath( entID, qfalse);    
05602                 break;
05603 
05604         case SET_DISMEMBERABLE:
05605                 if(!Q_stricmp("true", ((char *)data)))
05606                         Q3_SetDismemberable( entID, qtrue);     
05607                 else
05608                         Q3_SetDismemberable( entID, qfalse);    
05609                 break;
05610 
05611         case SET_MORELIGHT:
05612                 if(!Q_stricmp("true", ((char *)data)))
05613                         Q3_SetMoreLight( entID, qtrue); 
05614                 else
05615                         Q3_SetMoreLight( entID, qfalse);        
05616                 break;
05617 
05618 
05619         case SET_TREASONED:
05620                 G_DebugPrint( WL_VERBOSE, "SET_TREASONED is disabled, do not use\n" );
05621                 /*
05622                 G_TeamRetaliation( NULL, SV_GentityNum(0), qfalse );
05623                 ffireLevel = FFIRE_LEVEL_RETALIATION;
05624                 */
05625                 break;
05626 
05627         case SET_UNDYING:
05628                 if(!Q_stricmp("true", ((char *)data)))
05629                         Q3_SetUndying( entID, qtrue);   
05630                 else
05631                         Q3_SetUndying( entID, qfalse);  
05632                 break;
05633 
05634         case SET_INVINCIBLE:
05635                 if(!Q_stricmp("true", ((char *)data)))
05636                         Q3_SetInvincible( entID, qtrue);        
05637                 else
05638                         Q3_SetInvincible( entID, qfalse);       
05639                 break;
05640 
05641         case SET_NOAVOID:
05642                 if(!Q_stricmp("true", ((char *)data)))
05643                         Q3_SetNoAvoid( entID, qtrue);   
05644                 else
05645                         Q3_SetNoAvoid( entID, qfalse);  
05646                 break;
05647 
05648         case SET_SOLID:
05649                 if(!Q_stricmp("true", ((char *)data)))
05650                 {
05651                         if ( !Q3_SetSolid( entID, qtrue) )
05652                         {
05653                                 trap_ICARUS_TaskIDSet( ent, TID_RESIZE, taskID );
05654                                 return qfalse;
05655                         }
05656                 }
05657                 else
05658                 {
05659                         Q3_SetSolid( entID, qfalse);
05660                 }
05661                 break;
05662 
05663         case SET_INVISIBLE:
05664                 if( !Q_stricmp("true", ((char *)data)) )
05665                         Q3_SetInvisible( entID, qtrue );
05666                 else
05667                         Q3_SetInvisible( entID, qfalse );
05668                 break;
05669 
05670         case SET_VAMPIRE:
05671                 if( !Q_stricmp("true", ((char *)data)) )
05672                         Q3_SetVampire( entID, qtrue );
05673                 else
05674                         Q3_SetVampire( entID, qfalse );
05675                 break;
05676 
05677         case SET_FORCE_INVINCIBLE:
05678                 if( !Q_stricmp("true", ((char *)data)) )
05679                         Q3_SetForceInvincible( entID, qtrue );
05680                 else
05681                         Q3_SetForceInvincible( entID, qfalse );
05682                 break;
05683 
05684         case SET_GREET_ALLIES:
05685                 if( !Q_stricmp("true", ((char *)data)) )
05686                         Q3_SetGreetAllies( entID, qtrue );
05687                 else
05688                         Q3_SetGreetAllies( entID, qfalse );
05689                 break;
05690 
05691         case SET_PLAYER_LOCKED:
05692                 if( !Q_stricmp("true", ((char *)data)) )
05693                         Q3_SetPlayerLocked( entID, qtrue );
05694                 else
05695                         Q3_SetPlayerLocked( entID, qfalse );
05696                 break;
05697                 
05698         case SET_LOCK_PLAYER_WEAPONS:
05699                 if( !Q_stricmp("true", ((char *)data)) )
05700                         Q3_SetLockPlayerWeapons( entID, qtrue );
05701                 else
05702                         Q3_SetLockPlayerWeapons( entID, qfalse );
05703                 break;
05704 
05705         case SET_NO_IMPACT_DAMAGE:
05706                 if( !Q_stricmp("true", ((char *)data)) )
05707                         Q3_SetNoImpactDamage( entID, qtrue );
05708                 else
05709                         Q3_SetNoImpactDamage( entID, qfalse );
05710                 break;
05711 
05712         case SET_FORWARDMOVE:
05713                 int_data = atoi((char *) data);
05714                 Q3_SetForwardMove( entID, int_data);    
05715                 break;
05716 
05717         case SET_RIGHTMOVE:
05718                 int_data = atoi((char *) data);
05719                 Q3_SetRightMove( entID, int_data);      
05720                 break;
05721 
05722         case SET_LOCKYAW:
05723                 Q3_SetLockAngle( entID, data);  
05724                 break;
05725         
05726         case SET_CAMERA_GROUP:
05727                 Q3_CameraGroup(entID, (char *)data);
05728                 break;
05729         case SET_CAMERA_GROUP_Z_OFS:
05730                 float_data = atof((char *) data);
05731                 Q3_CameraGroupZOfs( float_data );
05732                 break;
05733         case SET_CAMERA_GROUP_TAG:
05734                 Q3_CameraGroupTag( (char *)data );
05735                 break;
05736 
05737         //FIXME: put these into camera commands
05738         case SET_LOOK_TARGET:
05739                 Q3_LookTarget(entID, (char *)data);
05740                 break;
05741 
05742         case SET_ADDRHANDBOLT_MODEL:
05743                 Q3_AddRHandModel(entID, (char *)data);
05744                 break;
05745 
05746         case SET_REMOVERHANDBOLT_MODEL:
05747                 Q3_RemoveRHandModel(entID, (char *)data);
05748                 break;
05749 
05750         case SET_ADDLHANDBOLT_MODEL:
05751                 Q3_AddLHandModel(entID, (char *)data);
05752                 break;
05753 
05754         case SET_REMOVELHANDBOLT_MODEL:
05755                 Q3_RemoveLHandModel(entID, (char *)data);
05756                 break;
05757 
05758         case SET_FACEEYESCLOSED:
05759         case SET_FACEEYESOPENED:
05760         case SET_FACEAUX:
05761         case SET_FACEBLINK:
05762         case SET_FACEBLINKFROWN:
05763         case SET_FACEFROWN:
05764         case SET_FACENORMAL:
05765                 float_data = atof((char *) data);
05766                 Q3_Face(entID, toSet, float_data);
05767                 break;
05768 
05769         case SET_SCROLLTEXT:
05770                 Q3_ScrollText( (char *)data );  
05771                 break;
05772 
05773         case SET_LCARSTEXT:
05774                 Q3_LCARSText( (char *)data );   
05775                 break;
05776 
05777         case SET_CAPTIONTEXTCOLOR:
05778                 Q3_SetCaptionTextColor ( (char *)data );        
05779                 break;
05780         case SET_CENTERTEXTCOLOR:
05781                 Q3_SetCenterTextColor ( (char *)data ); 
05782                 break;
05783         case SET_SCROLLTEXTCOLOR:
05784                 Q3_SetScrollTextColor ( (char *)data ); 
05785                 break;
05786 
05787         case SET_PLAYER_USABLE:
05788                 if(!Q_stricmp("true", ((char *)data)))
05789                 {
05790                         Q3_SetPlayerUsable(entID, qtrue);
05791                 }
05792                 else
05793                 {
05794                         Q3_SetPlayerUsable(entID, qfalse);
05795                 }
05796                 break;
05797 
05798         case SET_STARTFRAME:
05799                 int_data = atoi((char *) data);
05800                 Q3_SetStartFrame(entID, int_data);
05801                 break;
05802         
05803         case SET_ENDFRAME:
05804                 int_data = atoi((char *) data);
05805                 Q3_SetEndFrame(entID, int_data);
05806 
05807                 trap_ICARUS_TaskIDSet( ent, TID_ANIM_BOTH, taskID );
05808                 return qfalse;
05809                 break;
05810 
05811         case SET_ANIMFRAME:
05812                 int_data = atoi((char *) data);
05813                 Q3_SetAnimFrame(entID, int_data);
05814                 return qfalse;
05815                 break;
05816                 
05817         case SET_LOOP_ANIM:
05818                 if(!Q_stricmp("true", ((char *)data)))
05819                 {
05820                         Q3_SetLoopAnim(entID, qtrue);
05821                 }
05822                 else
05823                 {
05824                         Q3_SetLoopAnim(entID, qfalse);
05825                 }
05826                 break;
05827 
05828         case SET_INTERFACE:
05829                 G_DebugPrint( WL_WARNING, "Q3_SetInterface: NOT SUPPORTED IN MP\n");
05830 
05831                 break;
05832 
05833         case SET_SHIELDS:
05834                 if(!Q_stricmp("true", ((char *)data)))
05835                 {
05836                         Q3_SetShields(entID, qtrue);
05837                 }
05838                 else
05839                 {
05840                         Q3_SetShields(entID, qfalse);
05841                 }
05842                 break;
05843         
05844         case SET_SABERACTIVE:
05845                 if(!Q_stricmp("true", ((char *)data)))
05846                 {
05847                         Q3_SetSaberActive( entID, qtrue );
05848                 }
05849                 else
05850                 {
05851                         Q3_SetSaberActive( entID, qfalse );
05852                 }
05853                 break;
05854 
05855         case SET_ADJUST_AREA_PORTALS:
05856                 G_DebugPrint( WL_WARNING, "Q3_SetAdjustAreaPortals: NOT SUPPORTED IN MP\n");
05857                 break;
05858         
05859         case SET_DMG_BY_HEAVY_WEAP_ONLY:
05860                 G_DebugPrint( WL_WARNING, "Q3_SetDmgByHeavyWeapOnly: NOT SUPPORTED IN MP\n");
05861                 break;
05862 
05863         case SET_SHIELDED:
05864                 G_DebugPrint( WL_WARNING, "Q3_SetShielded: NOT SUPPORTED IN MP\n");
05865                 break;
05866 
05867         case SET_NO_GROUPS:
05868                 G_DebugPrint( WL_WARNING, "Q3_SetNoGroups: NOT SUPPORTED IN MP\n");
05869                 break;
05870 
05871         case SET_FIRE_WEAPON:
05872                 if(!Q_stricmp("true", ((char *)data)))
05873                 {
05874                         Q3_SetFireWeapon( entID, qtrue);
05875                 }
05876                 else if(!Q_stricmp("false", ((char *)data)))
05877                 {
05878                         Q3_SetFireWeapon( entID, qfalse);
05879                 }
05880                 break;
05881 
05882         case SET_INACTIVE:
05883                 if(!Q_stricmp("true", ((char *)data)))
05884                 {
05885                         Q3_SetInactive( entID, qtrue);
05886                 }
05887                 else if(!Q_stricmp("false", ((char *)data)))
05888                 {
05889                         Q3_SetInactive( entID, qfalse);
05890                 }
05891                 else if(!Q_stricmp("unlocked", ((char *)data)))
05892                 {
05893                         UnLockDoors(&g_entities[entID]);
05894                 }
05895                 else if(!Q_stricmp("locked", ((char *)data)))
05896                 {
05897                         LockDoors(&g_entities[entID]);
05898                 }
05899                 break;
05900         case SET_END_SCREENDISSOLVE:
05901                 G_DebugPrint( WL_WARNING, "SET_END_SCREENDISSOLVE: NOT SUPPORTED IN MP\n");
05902                 break;
05903 
05904         case SET_MISSION_STATUS_SCREEN:
05905                 //Cvar_Set("cg_missionstatusscreen", "1");
05906                 G_DebugPrint( WL_WARNING, "SET_MISSION_STATUS_SCREEN: NOT SUPPORTED IN MP\n");
05907                 break;
05908 
05909         case SET_FUNC_USABLE_VISIBLE:
05910                 if(!Q_stricmp("true", ((char *)data)))
05911                 {
05912                         Q3_SetFuncUsableVisible( entID, qtrue);
05913                 }
05914                 else if(!Q_stricmp("false", ((char *)data)))
05915                 {
05916                         Q3_SetFuncUsableVisible( entID, qfalse);
05917                 }
05918                 break;
05919 
05920         case SET_NO_KNOCKBACK:
05921                 if(!Q_stricmp("true", ((char *)data)))
05922                 {
05923                         Q3_SetNoKnockback(entID, qtrue);
05924                 }
05925                 else
05926                 {
05927                         Q3_SetNoKnockback(entID, qfalse);
05928                 }
05929                 break;
05930 
05931         case SET_VIDEO_PLAY:
05932                 // don't do this check now, James doesn't want a scripted cinematic to also skip any Video cinematics as well,
05933                 //      the "timescale" and "skippingCinematic" cvars will be set back to normal in the Video code, so doing a
05934                 //      skip will now only skip one section of a multiple-part story (eg VOY1 bridge sequence)
05935                 //
05936 //              if ( g_timescale->value <= 1.0f )
05937                 {
05938                         G_DebugPrint( WL_WARNING, "SET_VIDEO_PLAY: NOT SUPPORTED IN MP\n");
05939                         //SV_SendConsoleCommand( va("inGameCinematic %s\n", (char *)data) );
05940                 }
05941                 break;
05942 
05943         case SET_VIDEO_FADE_IN:
05944                 G_DebugPrint( WL_WARNING, "SET_VIDEO_FADE_IN: NOT SUPPORTED IN MP\n");
05945                 break;
05946 
05947         case SET_VIDEO_FADE_OUT:
05948                 G_DebugPrint( WL_WARNING, "SET_VIDEO_FADE_OUT: NOT SUPPORTED IN MP\n");
05949                 break;
05950         case SET_REMOVE_TARGET:
05951                 Q3_SetRemoveTarget( entID, (const char *) data );
05952                 break;
05953 
05954         case SET_LOADGAME:
05955                 //gi.SendConsoleCommand( va("load %s\n", (const char *) data ) );
05956                 G_DebugPrint( WL_WARNING, "SET_LOADGAME: NOT SUPPORTED IN MP\n");
05957                 break;
05958 
05959         case SET_MENU_SCREEN:
05960                 //UI_SetActiveMenu( (const char *) data );
05961                 break;
05962 
05963         case SET_OBJECTIVE_SHOW:
05964                 G_DebugPrint( WL_WARNING, "SET_OBJECTIVE_SHOW: NOT SUPPORTED IN MP\n");
05965                 break;
05966         case SET_OBJECTIVE_HIDE:
05967                 G_DebugPrint( WL_WARNING, "SET_OBJECTIVE_HIDE: NOT SUPPORTED IN MP\n");
05968                 break;
05969         case SET_OBJECTIVE_SUCCEEDED:
05970                 G_DebugPrint( WL_WARNING, "SET_OBJECTIVE_SUCCEEDED: NOT SUPPORTED IN MP\n");
05971                 break;
05972         case SET_OBJECTIVE_FAILED:
05973                 G_DebugPrint( WL_WARNING, "SET_OBJECTIVE_FAILED: NOT SUPPORTED IN MP\n");
05974                 break;
05975 
05976         case SET_OBJECTIVE_CLEARALL:
05977                 G_DebugPrint( WL_WARNING, "SET_OBJECTIVE_CLEARALL: NOT SUPPORTED IN MP\n");
05978                 break;
05979 
05980         case SET_MISSIONFAILED:
05981                 G_DebugPrint( WL_WARNING, "SET_MISSIONFAILED: NOT SUPPORTED IN MP\n");
05982                 break;
05983 
05984         case SET_MISSIONSTATUSTEXT:
05985                 G_DebugPrint( WL_WARNING, "SET_MISSIONSTATUSTEXT: NOT SUPPORTED IN MP\n");
05986                 break;
05987                 
05988         case SET_MISSIONSTATUSTIME:
05989                 G_DebugPrint( WL_WARNING, "SET_MISSIONSTATUSTIME: NOT SUPPORTED IN MP\n");
05990                 break;
05991 
05992         case SET_CLOSINGCREDITS:
05993                 G_DebugPrint( WL_WARNING, "SET_CLOSINGCREDITS: NOT SUPPORTED IN MP\n");
05994                 break;
05995 
05996         case SET_SKILL:
05997 //              //can never be set
05998                 break;
05999 
06000         case SET_FULLNAME:
06001                 Q3_SetFullName( entID, (char *) data );
06002                 break;
06003 
06004         case SET_DISABLE_SHADER_ANIM:
06005                 if(!Q_stricmp("true", ((char *)data)))
06006                 {
06007                         Q3_SetDisableShaderAnims( entID, qtrue);
06008                 }
06009                 else
06010                 {
06011                         Q3_SetDisableShaderAnims( entID, qfalse);
06012                 }
06013                 break;
06014 
06015         case SET_SHADER_ANIM:
06016                 if(!Q_stricmp("true", ((char *)data)))
06017                 {
06018                         Q3_SetShaderAnim( entID, qtrue);
06019                 }
06020                 else
06021                 {
06022                         Q3_SetShaderAnim( entID, qfalse);
06023                 }
06024                 break;
06025 
06026         case SET_MUSIC_STATE:
06027                 Q3_SetMusicState( (char *) data );
06028                 break;
06029 
06030         case SET_CLEAN_DAMAGING_ENTS:
06031                 Q3_SetCleanDamagingEnts();
06032                 break;
06033 
06034         case SET_HUD:
06035                 G_DebugPrint( WL_WARNING, "SET_HUD: NOT SUPPORTED IN MP\n");
06036                 break;
06037 
06038         case SET_FORCE_HEAL_LEVEL:
06039         case SET_FORCE_JUMP_LEVEL:
06040         case SET_FORCE_SPEED_LEVEL:
06041         case SET_FORCE_PUSH_LEVEL:
06042         case SET_FORCE_PULL_LEVEL:
06043         case SET_FORCE_MINDTRICK_LEVEL:
06044         case SET_FORCE_GRIP_LEVEL:
06045         case SET_FORCE_LIGHTNING_LEVEL:
06046         case SET_SABER_THROW:
06047         case SET_SABER_DEFENSE:
06048         case SET_SABER_OFFENSE:
06049                 int_data = atoi((char *) data);
06050                 Q3_SetForcePowerLevel( entID, (toSet-SET_FORCE_HEAL_LEVEL), int_data );
06051                 break;
06052         
06053         default:
06054                 //G_DebugPrint( WL_ERROR, "Q3_Set: '%s' is not a valid set field\n", type_name );
06055                 trap_ICARUS_SetVar( taskID, entID, type_name, data );
06056                 break;
06057         }
06058 
06059         return qtrue;
06060 }