codemp/game/g_ICARUScb.h File Reference

Go to the source code of this file.

Functions

int Q3_PlaySound (int taskID, int entID, const char *name, const char *channel)
qboolean Q3_Set (int taskID, int entID, const char *type_name, const char *data)
void Q3_Lerp2Pos (int taskID, int entID, vec3_t origin, vec3_t angles, float duration)
void Q3_Lerp2Origin (int taskID, int entID, vec3_t origin, 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_Lerp2Start (int entID, int taskID, float duration)
void Q3_Lerp2End (int entID, int taskID, float duration)
void Q3_Use (int entID, const char *target)
void Q3_Kill (int entID, const char *name)
void Q3_Remove (int entID, const char *name)
void Q3_Play (int taskID, int entID, const char *type, 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)


Function Documentation

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

int Q3_GetTag int  entID,
const char *  name,
int  lookup,
vec3_t  info
 

Definition at line 948 of file g_ICARUScb.c.

References g_entities, gentity_t, gentity_s::inuse, name, gentity_s::ownername, TAG_GetAngles(), TAG_GetOrigin(), TYPE_ANGLES, TYPE_ORIGIN, and vec3_t.

Referenced by vmMain().

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 }

int Q3_GetVector int  entID,
int  type,
const char *  name,
vec3_t  value
 

Definition at line 1573 of file g_ICARUScb.c.

References entityShared_t::currentAngles, entityShared_t::currentOrigin, G_DebugPrint(), g_entities, gentity_t, GetIDForString(), name, parms_t::parm, gentity_s::parms, gentity_s::r, SET_ANGLES, SET_ORIGIN, 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_TELEPORT_DEST, setTable, sscanf(), trap_ICARUS_GetVectorVariable(), trap_ICARUS_VariableDeclared(), vec3_t, VectorCopy, and WL_WARNING.

Referenced by vmMain().

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 }

void Q3_Kill int  entID,
const char *  name
 

Definition at line 1009 of file g_ICARUScb.c.

References gentity_s::client, gentity_s::die, gentity_s::enemy, FL_NO_KNOCKBACK, gentity_s::flags, FOFS, G_DebugPrint(), g_entities, G_Find(), gentity_t, gentity_s::health, MOD_UNKNOWN, name, NULL, Q_stricmp(), and WL_WARNING.

Referenced by vmMain().

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 }

void Q3_Lerp2Angles int  taskID,
int  entID,
vec3_t  angles,
float  duration
 

Definition at line 892 of file g_ICARUScb.c.

References gentity_s::alt_fire, anglerCallback(), AngleSubtract(), entityState_s::apos, gentity_s::classname, gentity_s::client, entityShared_t::currentAngles, G_DebugPrint(), g_entities, gentity_t, level, gentity_s::nextthink, Q_stricmp(), gentity_s::r, gentity_s::s, gentity_s::think, TID_ANGLE_FACE, level_locals_t::time, TR_LINEAR_STOP, TR_NONLINEAR_STOP, trap_ICARUS_TaskIDSet(), trap_LinkEntity(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trTime, trajectory_t::trType, vec3_t, VectorCopy, WL_ERROR, and WL_WARNING.

Referenced by vmMain().

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 }

void Q3_Lerp2End int  entID,
int  taskID,
float  duration
 

Definition at line 730 of file g_ICARUScb.c.

References gentity_s::blocked, Blocked_Mover(), BMS_START, gentity_s::classname, gentity_s::client, gentity_s::damage, ET_MOVER, entityState_s::eType, G_DebugPrint(), g_entities, G_PlayDoorLoopSound(), G_PlayDoorSound(), gentity_t, level, MOVER_1TO2, moverCallback(), gentity_s::moverState, entityState_s::pos, Q_stricmp(), gentity_s::reached, gentity_s::s, TID_MOVE_NAV, level_locals_t::time, entityState_s::time, trap_ICARUS_TaskIDSet(), trap_LinkEntity(), trajectory_t::trDuration, WL_ERROR, and WL_WARNING.

Referenced by vmMain().

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 }

void Q3_Lerp2Origin int  taskID,
int  entID,
vec3_t  origin,
float  duration
 

Definition at line 2051 of file g_ICARUScb.c.

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