codemp/game/g_ICARUScb.c File Reference

#include "q_shared.h"
#include "bg_public.h"
#include "b_local.h"
#include "../icarus/Q3_Interface.h"
#include "../icarus/Q3_Registers.h"
#include "g_nav.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"
#include "../icarus/interpreter.h"

Go to the source code of this file.

Enumerations

enum  {
  TK_EOF = -1, TK_UNDEFINED, TK_COMMENT, TK_EOL,
  TK_CHAR, TK_STRING, TK_INT, TK_INTEGER = TK_INT,
  TK_FLOAT, TK_IDENTIFIER, TK_USERDEF
}

Functions

qboolean BG_SabersOff (playerState_t *ps)
void Q3_TaskIDClear (int *taskID)
void G_DebugPrint (int level, const char *format,...)
int Q3_PlaySound (int taskID, int entID, const char *name, const char *channel)
void Q3_Play (int taskID, int entID, const char *type, const char *name)
void anglerCallback (gentity_t *ent)
void MatchTeam (gentity_t *teamLeader, int moverState, int time)
void Blocked_Mover (gentity_t *ent, gentity_t *other)
void moverCallback (gentity_t *ent)
void moveAndRotateCallback (gentity_t *ent)
void Q3_Lerp2Start (int entID, int taskID, float duration)
void Q3_Lerp2End (int entID, int taskID, float duration)
void InitMoverTrData (gentity_t *ent)
void Q3_Lerp2Pos (int taskID, int entID, vec3_t origin, vec3_t angles, float duration)
void Q3_Lerp2Angles (int taskID, int entID, vec3_t angles, float duration)
int Q3_GetTag (int entID, const char *name, int lookup, vec3_t info)
void Q3_Use (int entID, const char *target)
void Q3_Kill (int entID, const char *name)
void Q3_RemoveEnt (gentity_t *victim)
void Q3_Remove (int entID, const char *name)
int Q3_GetFloat (int entID, int type, const char *name, float *value)
int Q3_GetVector (int entID, int type, const char *name, vec3_t value)
int Q3_GetString (int entID, int type, const char *name, char **value)
qboolean SpotWouldTelefrag2 (gentity_t *mover, vec3_t dest)
void MoveOwner (gentity_t *self)
void Q3_Lerp2Origin (int taskID, int entID, vec3_t origin, float duration)
void Q3_SetLoopSound (int entID, const char *name)
void Q3_SetICARUSFreeze (int entID, const char *name, qboolean freeze)
void Q3_SetViewEntity (int entID, const char *name)
void ChangeWeapon (gentity_t *ent, int newWeapon)
void Q3_SetParm (int entID, int parmNum, const char *parmValue)
void SolidifyOwner (gentity_t *self)
void UnLockDoors (gentity_t *const ent)
void LockDoors (gentity_t *const ent)
qboolean Q3_Set (int taskID, int entID, const char *type_name, const char *data)

Variables

stringID_table_t WPTable []
stringID_table_t BSTable []
stringID_table_t animTable [MAX_ANIMATIONS+1]
stringID_table_t setTable []
char cinematicSkipScript [1024]
qboolean player_locked = qfalse
vec4_t textcolor_caption
vec4_t textcolor_center
vec4_t textcolor_scroll


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
TK_EOF 
TK_UNDEFINED 
TK_COMMENT 
TK_EOL 
TK_CHAR 
TK_STRING 
TK_INT 
TK_INTEGER 
TK_FLOAT 
TK_IDENTIFIER 
TK_USERDEF 

Definition at line 31 of file g_ICARUScb.c.

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 };


Function Documentation

void anglerCallback gentity_t ent  ) 
 

Definition at line 569 of file g_ICARUScb.c.

References anglerCallback(), entityState_s::apos, entityShared_t::currentAngles, gentity_t, level, gentity_s::r, gentity_s::reached, gentity_s::s, gentity_s::think, TID_ANGLE_FACE, level_locals_t::time, TR_STATIONARY, trap_ICARUS_TaskIDComplete(), trap_LinkEntity(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trTime, trajectory_t::trType, VectorClear, VectorCopy, and VectorMA.

Referenced by anglerCallback(), moveAndRotateCallback(), and Q3_Lerp2Angles().

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 }

qboolean BG_SabersOff playerState_t ps  ) 
 

Definition at line 201 of file bg_pmove.c.

00202 {
00203         if ( !ps->saberHolstered )
00204         {
00205                 return qfalse;
00206         }
00207         if ( ps->fd.saberAnimLevelBase == SS_DUAL
00208                 || ps->fd.saberAnimLevelBase == SS_STAFF )
00209         {
00210                 if ( ps->saberHolstered < 2 )
00211                 {
00212                         return qfalse;
00213                 }
00214         }
00215         return qtrue;
00216 }

void Blocked_Mover gentity_t ent,
gentity_t other
 

Definition at line 635 of file g_ICARUScb.c.

References gentity_s::client, entityShared_t::contents, CONTENTS_CORPSE, gentity_s::damage, ET_ITEM, entityState_s::eType, G_Damage(), G_FreeEntity(), gentity_t, gentity_s::health, gentity_s::message, MOD_CRUSH, NULL, entityState_s::number, gentity_s::r, and gentity_s::s.

Referenced by moverCallback(), Q3_Lerp2End(), Q3_Lerp2Origin(), Q3_Lerp2Pos(), and Q3_Lerp2Start().

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 }

void ChangeWeapon gentity_t ent,
int  newWeapon
 

void G_DebugPrint int  level,
const char *  format,
... 
 

Definition at line 275 of file g_ICARUScb.c.

References Com_Printf(), g_developer, g_entities, vmCvar_t::integer, level, MAX_GENTITIES, S_COLOR_BLUE, S_COLOR_GREEN, S_COLOR_RED, S_COLOR_YELLOW, sscanf(), va_end, va_list, va_start, vsprintf(), WL_DEBUG, WL_ERROR, WL_VERBOSE, and WL_WARNING.

Referenced by G_ActivateBehavior(), NPC_Begin(), Q3_GetFloat(), Q3_GetString(), Q3_GetVector(), Q3_Kill(), Q3_Lerp2Angles(), Q3_Lerp2End(), Q3_Lerp2Origin(), Q3_Lerp2Pos(), Q3_Lerp2Start(), Q3_Remove(), Q3_RemoveEnt(), Q3_Set(), Q3_SetICARUSFreeze(), Q3_SetLoopSound(), Q3_SetParm(), Q3_SetViewEntity(), Q3_Use(), and target_counter_use().

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 }

void InitMoverTrData gentity_t ent  ) 
 

Definition at line 903 of file g_mover.c.

References gentity_t, entityState_s::pos, gentity_s::pos1, gentity_s::pos2, gentity_s::s, gentity_s::speed, TR_STATIONARY, trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trType, vec3_t, VectorCopy, VectorScale, and VectorSubtract.

Referenced by InitMover(), Q3_Lerp2Origin(), and Q3_Lerp2Pos().

00904 {
00905         vec3_t          move;
00906         float           distance;
00907 
00908         ent->s.pos.trType = TR_STATIONARY;
00909         VectorCopy( ent->pos1, ent->s.pos.trBase );
00910 
00911         // calculate time to reach second position from speed
00912         VectorSubtract( ent->pos2, ent->pos1, move );
00913         distance = VectorLength( move );
00914         if ( ! ent->speed ) 
00915         {
00916                 ent->speed = 100;
00917         }
00918         VectorScale( move, ent->speed, ent->s.pos.trDelta );
00919         ent->s.pos.trDuration = distance * 1000 / ent->speed;
00920         if ( ent->s.pos.trDuration <= 0 ) 
00921         {
00922                 ent->s.pos.trDuration = 1;
00923         }
00924 }

void LockDoors gentity_t *const  ent  ) 
 

Definition at line 836 of file g_mover.c.

References entityState_s::frame, gentity_t, MOVER_LOCKED, gentity_s::s, gentity_s::spawnflags, and gentity_s::teamchain.

Referenced by Q3_Set().

00837 {
00838         //noise?
00839         //go through and lock the door and all the slaves
00840         gentity_t       *slave = ent;
00841         do 
00842         {
00843                 slave->spawnflags |= MOVER_LOCKED;
00844                 slave->s.frame = 0;//first stage of anim
00845                 slave = slave->teamchain;
00846         } while  ( slave );
00847 }

void MatchTeam gentity_t teamLeader,
int  moverState,
int  time
 

Definition at line 590 of file g_mover.c.

References gentity_t, moverState_t, SetMoverState(), and gentity_s::teamchain.

00590                                                                   {
00591         gentity_t               *slave;
00592 
00593         for ( slave = teamLeader ; slave ; slave = slave->teamchain ) {
00594                 SetMoverState( slave, (moverState_t) moverState, time );
00595         }
00596 }

void moveAndRotateCallback gentity_t ent  ) 
 

Definition at line 667 of file g_ICARUScb.c.

References anglerCallback(), gentity_t, and moverCallback().

Referenced by Q3_Lerp2Pos().

00668 {
00669         //stop turning
00670         anglerCallback( ent );
00671         //stop moving
00672         moverCallback( ent );
00673 }

void MoveOwner gentity_t self  ) 
 

Definition at line 1865 of file g_ICARUScb.c.

References entityShared_t::currentOrigin, FRAMETIME, g_entities, G_FreeEntity(), G_SetOrigin(), gentity_t, gentity_s::inuse, level, MoveOwner(), gentity_s::nextthink, entityShared_t::ownerNum, gentity_s::r, SpotWouldTelefrag2(), gentity_s::think, TID_MOVE_NAV, level_locals_t::time, and trap_ICARUS_TaskIDComplete().

Referenced by MoveOwner().

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 }

void moverCallback gentity_t ent  ) 
 

Definition at line 603 of file g_ICARUScb.c.

References gentity_s::blocked, Blocked_Mover(), BMS_END, G_PlayDoorSound(), gentity_t, level, entityState_s::loopIsSoundset, entityState_s::loopSound, MatchTeam(), MOVER_1TO2, MOVER_2TO1, MOVER_POS1, MOVER_POS2, gentity_s::moverState, qfalse, gentity_s::s, TID_MOVE_NAV, level_locals_t::time, and trap_ICARUS_TaskIDComplete().

Referenced by moveAndRotateCallback(), Q3_Lerp2End(), Q3_Lerp2Origin(), Q3_Lerp2Pos(), and Q3_Lerp2Start().

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 }

int Q3_GetFloat int  entID,
int  type,
const char *  name,
float *  value
 

Definition at line 1189 of file g_ICARUScb.c.

References atof(), gentity_s::classname, gentity_s::client, entityShared_t::contents, gentity_s::count, entityShared_t::currentOrigin, EF_NODRAW, entityState_s::eFlags, FL_GODMODE, FL_NO_KNOCKBACK, FL_NOTARGET, gentity_s::flags, G_DebugPrint(), g_entities, g_gravity, gentity_t, GetIDForString(), gentity_s::health, playerState_s::legsTimer, entityShared_t::mins, name, NULL, entityState_s::origin, parms_t::parm, gentity_s::parms, gclient_s::ps, gentity_s::r, gentity_s::s, SET_AGGRESSION, SET_AIM, SET_ALT_FIRE, SET_ANIM_HOLDTIME_BOTH, SET_ANIM_HOLDTIME_LOWER, SET_ANIM_HOLDTIME_UPPER, SET_ANIMFRAME, SET_ARMOR, SET_CAMERA_GROUP_Z_OFS, SET_CHASE_ENEMIES, SET_COUNT, SET_CROUCHED, SET_DELAYSCRIPTTIME, SET_DISABLE_SHADER_ANIM, SET_DISMEMBERABLE, SET_DONTFIRE, SET_DONTSHOOT, SET_DPITCH, SET_DYAW, SET_EARSHOT, SET_ENDFRAME, SET_FACE_MOVE_DIR, SET_FACEAUX, SET_FACEBLINK, SET_FACEBLINKFROWN, SET_FACEEYESCLOSED, SET_FACEEYESOPENED, SET_FACEFROWN, SET_FACENORMAL, SET_FOLLOWDIST, SET_FORCE_INVINCIBLE, SET_FORCED_MARCH, SET_FORWARDMOVE, SET_FRICTION, SET_GRAVITY, SET_GREET_ALLIES, SET_HEALTH, SET_HFOV, SET_IGNOREALERTS, SET_IGNOREENEMIES, SET_IGNOREPAIN, SET_INTERFACE, SET_INVINCIBLE, SET_INVISIBLE, SET_LOCK_PLAYER_WEAPONS, SET_LOCKED_ENEMY, SET_LOOK_FOR_ENEMIES, SET_LOOP_ANIM, SET_MISSIONSTATUSACTIVE, SET_MISSIONSTATUSTIME, SET_MORELIGHT, SET_NO_ACROBATICS, SET_NO_ALERT_TALK, SET_NO_COMBAT_TALK, SET_NO_FALLTODEATH, SET_NO_FORCE, SET_NO_IMPACT_DAMAGE, SET_NO_KNOCKBACK, SET_NO_RESPONSE, SET_NOAVOID, SET_NOTARGET, SET_PARM1, SET_PARM10, SET_PARM11, SET_PARM12, SET_PARM13, SET_PARM14, SET_PARM15, SET_PARM16, SET_PARM2, SET_PARM3, SET_PARM4, SET_PARM5, SET_PARM6, SET_PARM7, SET_PARM8, SET_PARM9, SET_PLAYER_LOCKED, SET_PLAYER_USABLE, SET_RIGHTMOVE, SET_RUNNING, SET_RUNSPEED, SET_SHADER_ANIM, SET_SHIELDS, SET_SHOOTDIST, SET_SHOT_SPACING, SET_SKILL, SET_SOLID, SET_STARTFRAME, SET_TIMESCALE, SET_TREASONED, SET_UNDYING, SET_USE_CP_NEAREST, SET_USE_SUBTITLES, SET_VAMPIRE, SET_VFOV, SET_VIDEO_FADE_IN, SET_VIDEO_FADE_OUT, SET_VIGILANCE, SET_VISRANGE, SET_WAIT, SET_WALKING, SET_WALKSPEED, SET_WIDTH, SET_XVELOCITY, SET_YAWSPEED, SET_YVELOCITY, SET_Z_OFFSET, SET_ZVELOCITY, setTable, STAT_ARMOR, playerState_s::stats, SVF_PLAYER_USABLE, entityShared_t::svFlags, gentity_s::targetname, playerState_s::torsoTimer, trap_ICARUS_GetFloatVariable(), trap_ICARUS_VariableDeclared(), vmCvar_t::value, playerState_s::velocity, gentity_s::wait, WL_ERROR, and WL_WARNING.

Referenced by vmMain().

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 }

int Q3_GetString int  entID,
int  type,
const char *  name,
char **  value
 

Definition at line 1642 of file g_ICARUScb.c.

References gentity_s::behaviorSet, BSET_ANGER, BSET_ATTACK, BSET_AWAKE, BSET_BLOCKED, BSET_DEATH, BSET_DELAYED, BSET_FFDEATH, BSET_FFIRE, BSET_FLEE, BSET_LOSTENEMY, BSET_PAIN, BSET_SPAWN, BSET_USE, BSET_VICTORY, gentity_s::fullName, G_DebugPrint(), g_entities, gentity_t, GetIDForString(), name, parms_t::parm, gentity_s::parms, SET_ANGERSCRIPT, SET_ANIM_BOTH, SET_ATTACKSCRIPT, SET_AWAKESCRIPT, SET_BLOCKEDSCRIPT, SET_CAMERA_GROUP, SET_CAMERA_GROUP_TAG, SET_CAPTIONTEXTCOLOR, SET_CAPTURE, SET_CENTERTEXTCOLOR, SET_COPY_ORIGIN, SET_DEATHSCRIPT, SET_DEFEND_TARGET, SET_DELAYEDSCRIPT, SET_ENEMY, SET_FFDEATHSCRIPT, SET_FFIRESCRIPT, SET_FLEESCRIPT, SET_FULLNAME, SET_ITEM, SET_LCARSTEXT, SET_LEADER, SET_LOADGAME, SET_LOCATION, SET_LOCKYAW, SET_LOOK_TARGET, SET_LOSTENEMYSCRIPT, SET_MUSIC_STATE, SET_NAVGOAL, SET_PAINSCRIPT, SET_PAINTARGET, SET_PARM1, SET_PARM10, SET_PARM11, SET_PARM12, SET_PARM13, SET_PARM14, SET_PARM15, SET_PARM16, SET_PARM2, SET_PARM3, SET_PARM4, SET_PARM5, SET_PARM6, SET_PARM7, SET_PARM8, SET_PARM9, SET_REMOVE_TARGET, SET_SCROLLTEXT, SET_SCROLLTEXTCOLOR, SET_SPAWNSCRIPT, SET_TARGET, SET_TARGET2, SET_TARGETNAME, SET_USESCRIPT, SET_VICTORYSCRIPT, SET_VIDEO_PLAY, SET_VIEWENTITY, SET_VIEWTARGET, SET_WATCHTARGET, SET_WEAPON, setTable, gentity_s::target, gentity_s::targetname, trap_ICARUS_GetStringVariable(), trap_ICARUS_VariableDeclared(), and WL_WARNING.

Referenced by vmMain().

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