29 #include "../../idlib/precompiled.h"
32 #include "../Game_local.h"
53 const idEventDef EV_Thread_RandomInt(
"randomInt",
"d",
'd' );
76 const idEventDef EV_Thread_ArcSine(
"asin",
"f",
'f' );
77 const idEventDef EV_Thread_ArcCosine(
"acos",
"f",
'f' );
86 const idEventDef EV_Thread_VecToOrthoBasisAngles(
"VecToOrthoBasisAngles",
"v",
'v' );
87 const idEventDef EV_Thread_RotateVector(
"rotateVector",
"vv",
'v');
142 EVENT( EV_Thread_RandomInt, idThread::Event_RandomInt )
165 EVENT( EV_Thread_ArcSine, idThread::Event_GetArcSine )
175 EVENT( EV_Thread_VecToOrthoBasisAngles, idThread::Event_VecToOrthoBasisAngles )
176 EVENT( EV_Thread_RotateVector,
idThread::Event_RotateVector )
228 return currentThread;
251 gameLocal.
Error(
"idThread::BeginMultiFrameEvent called without a current thread" );
263 gameLocal.
Error(
"idThread::EndMultiFrameEvent called without a current thread" );
357 for( i = 0; i <
n; i++ ) {
464 for( i = 0; i <
n; i++ ) {
483 " Created: %d (%d ms ago)\n"
493 "Paused since %d (%d ms)\n"
523 for( i = 0; i <
n; i++ ) {
544 for( i = n - 1; i >= 0; i-- ) {
631 ptr = strchr( name,
'*' );
635 len = strlen( name );
640 for( i = 0; i <
num; i++ ) {
813 va_start( argptr, fmt );
829 va_start( argptr, fmt );
1008 Warning(
"Thread %d not running", num );
1097 void idThread::Event_RandomInt(
int range )
const {
1134 if ( name[ 0 ] ==
'*' ) {
1135 entnum = atoi( &name[ 1 ] );
1137 Error(
"Entity number in string out of range." );
1326 void idThread::Event_GetArcSine(
float a ) {
1335 void idThread::Event_GetArcCosine(
float a ) {
1405 void idThread::Event_VecToOrthoBasisAngles(
idVec3 &vec ) {
1410 idMat3 axis( left, up, vec );
1412 ang = axis.ToAngles();
1417 void idThread::Event_RotateVector(
idVec3 &vec,
idVec3 &ang ) {
1420 idMat3 axis = tempAng.ToMat3();
1438 Error(
"Entity not found" );
1441 if ( ( signal < 0 ) || ( signal >=
NUM_SIGNALS ) ) {
1442 Error(
"Signal out of range" );
1447 Error(
"Function '%s' not found", func );
1460 Error(
"Entity not found" );
1463 if ( ( signal < 0 ) || ( signal >=
NUM_SIGNALS ) ) {
1464 Error(
"Signal out of range" );
1477 Error(
"Entity not found" );
1481 if ( !ent->
IsType( idCamera::Type ) ) {
1482 Error(
"Entity is not a camera" );
1613 fadeColor.
Set( color[ 0 ], color[ 1 ], color[ 2 ], 0.0
f );
1629 fadeColor.
Set( color[ 0 ], color[ 1 ], color[ 2 ], 1.0
f );
1645 fadeColor.
Set( color[ 0 ], color[ 1 ], color[ 2 ], alpha );
1657 Error(
"shader parm index (%d) out of range", parmnum );
1687 Error(
"%s", text );
1698 len = strlen(
string );
1715 len = strlen(
string );
1738 len = strlen(
string );
1760 len = strlen(
string );
1785 len = strlen(
string );
1786 if ( start > len ) {
1790 if ( start + num > len ) {
1806 result = atof(
string );
static bool BeginMultiFrameEvent(idEntity *ent, const idEventDef *event)
void Event_StrRight(const char *string, int num)
void Event_GetEntity(const char *name)
idPlayer * GetLocalPlayer() const
bool TracePoint(trace_t &results, const idVec3 &start, const idVec3 &end, int contentMask, const idEntity *passEntity)
float GetFloat(const char *key, const char *defaultString="0") const
void Event_GetTraceBody(void)
void Event_Say(const char *text)
GLsizei const GLfloat * value
void WriteString(const char *string)
const idEventDef EV_Thread_Spawn("spawn","s", 'e')
assert(prefInfo.fullscreenBtn)
void Event_TracePoint(const idVec3 &start, const idVec3 &end, int contents_mask, idEntity *passEntity)
virtual const idSoundShader * FindSound(const char *name, bool makeDefault=true)=0
void ClearSignalThread(signalNum_t signalnum, idThread *thread)
#define CLIPMODEL_ID_TO_JOINT_HANDLE(id)
const idEventDef EV_Thread_SpawnFloat("SpawnFloat","sf", 'f')
idCVarSystem * cvarSystem
const idEventDef EV_SetShaderParm("setShaderParm","df")
bool IsActiveAF(void) const
const idEventDef EV_Thread_Trace("trace","vvvvde", 'f')
const int MAX_GLOBAL_SHADER_PARMS
void Event_CopySpawnArgs(idEntity *ent)
const idEventDef EV_Thread_GetCvar("getcvar","s", 's')
void CallFunction(const function_t *func, bool clearStack)
void WriteObject(const idClass *obj)
virtual void DebugArrow(const idVec4 &color, const idVec3 &start, const idVec3 &end, int size, const int lifetime=0)=0
void Event_WaitForThread(int num)
const idEventDef EV_Thread_IsMultiplayer("isMultiplayer", NULL, 'f')
const idEventDef EV_Thread_FadeIn("fadeIn","vf")
const idEventDef EV_Thread_DebugCircle("debugCircle","vvvfdf")
void Printf(const char *fmt,...) const id_attribute((format(printf
const idEventDef EV_Thread_CopySpawnArgs("copySpawnArgs","e")
const idEventDef EV_Thread_InfluenceActive("influenceActive", NULL, 'd')
void DelayedStart(int delay)
void ReturnString(const char *string)
idThread * waitingForThread
const idEventDef EV_Thread_TracePoint("tracePoint","vvde", 'f')
static void EndMultiFrameEvent(idEntity *ent, const idEventDef *event)
void Event_GetCvar(const char *name) const
void Event_SetPersistantArg(const char *key, const char *value)
void Event_SetThreadName(const char *name)
void ReadDict(idDict *dict)
const idEventDef EV_Activate("activate","e")
void Event_DebugCircle(const idVec3 &color, const idVec3 &origin, const idVec3 &dir, const float radius, const int numSteps, const float lifetime)
idThread * WaitingOnThread(void)
const idEventDef EV_Thread_GetTicsPerSecond("getTicsPerSecond", NULL, 'f')
GLenum GLenum GLenum GLenum GLenum scale
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
void Event_StrToFloat(const char *string)
static int CurrentThreadNum(void)
bool IsType(const idTypeInfo &c) const
idCVar g_debugScript("g_debugScript","0", CVAR_GAME|CVAR_BOOL,"")
int GetInfluenceLevel(void)
const char * GetThreadName(void)
idAFBody * GetBody(const char *bodyName) const
virtual void PlayShaderDirectly(const char *name, int channel=-1)=0
idEntity * FindEntity(const char *name) const
void Event_AngToForward(idAngles &ang)
bool ProcessEvent(const idEventDef *ev)
void Event_GetTraceJoint(void)
bool RespondsTo(const idEventDef &ev) const
void Save(idSaveGame *savefile) const
const idEventDef EV_Thread_GetTraceFraction("getTraceFraction", NULL, 'f')
void EndMultiFrameEvent(idEntity *ent, const idEventDef *event)
void Event_SetCamera(idEntity *ent)
void RadiusDamage(const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignoreDamage, idEntity *ignorePush, const char *damageDefName, float dmgPower=1.0f)
void Event_GetSine(float angle)
void Event_InfluenceActive(void)
const idEventDef EV_Thread_StrSkip("strSkip","sd", 's')
const idEventDef EV_Thread_DebugArrow("debugArrow","vvvdf")
void Event_GetSquareRoot(float theSquare)
const idEventDef EV_Thread_GetEntity("getEntity","s", 'e')
void ReadBool(bool &value)
void Event_IsMultiplayer(void)
void Event_TerminateThread(int num)
const idEventDef EV_Thread_ClearPersistantArgs("clearPersistantArgs")
const idEventDef EV_Thread_SetSpawnArg("setSpawnArg","ss")
static float Sqrt(float x)
const idEventDef EV_Thread_SquareRoot("sqrt","f", 'f')
void Event_FadeIn(idVec3 &color, float time)
virtual void SetCVarString(const char *name, const char *value, int flags=0)=0
int CurrentLine(void) const
void Event_SpawnString(const char *key, const char *defaultvalue)
const idEventDef EV_Thread_GetTraceBody("getTraceBody", NULL, 's')
static void ReturnVector(idVec3 const &vec)
void Event_DebugArrow(const idVec3 &color, const idVec3 &start, const idVec3 &end, const int size, const float lifetime)
const idEventDef EV_Thread_GetFrameTime("getFrameTime", NULL, 'f')
void Event_FirstPerson(void)
const idEventDef EV_Thread_VecLength("vecLength","v", 'f')
GLclampf GLclampf GLclampf alpha
void Event_WaitFor(idEntity *ent)
void Set(const char *key, const char *value)
idVec3 Cross(const idVec3 &a) const
const char * Name(void) const
int Cmpn(const char *text, int n) const
void OrthogonalBasis(idVec3 &left, idVec3 &up) const
const idEventDef EV_Thread_Normalize("vecNormalize","v", 'v')
void Event_SetSpawnArg(const char *key, const char *value)
bool MultiFrameEventInProgress(void) const
void Event_StrLeft(const char *string, int num)
void Event_DebugLine(const idVec3 &color, const idVec3 &start, const idVec3 &end, const float lifetime)
void SetThreadName(const char *name)
void Copy(const idDict &other)
idSoundWorld * gameSoundWorld
void Event_VecCrossProduct(idVec3 &vec1, idVec3 &vec2)
void Event_GetTraceEntity(void)
#define EVENT(event, function)
static void KillThread(const char *name)
const idEventDef EV_Thread_Print("print","s")
static float ASin(float a)
void Event_WaitFrame(void)
void WriteBool(const bool value)
void Event_StartMusic(const char *name)
const idEventDef EV_Thread_RadiusDamage("radiusDamage","vEEEsf")
const idEventDef EV_Thread_GetTraceEntity("getTraceEntity", NULL, 'e')
const idEventDef EV_Thread_Cosine("cos","f", 'f')
const idEventDef EV_Thread_StrLeft("strLeft","sd", 's')
int GetReturnedInteger(void)
const idEventDef EV_Thread_WaitFor("waitFor","e")
void Event_DrawText(const char *text, const idVec3 &origin, float scale, const idVec3 &color, const int align, const float lifetime)
const idEventDef EV_Thread_AngToForward("angToForward","v", 'v')
const idEventDef EV_Thread_SpawnString("SpawnString","ss", 's')
GLsizei GLsizei GLcharARB * source
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
const idEventDef EV_Thread_GetTraceEndPos("getTraceEndPos", NULL, 'v')
bool BeginMultiFrameEvent(idEntity *ent, const idEventDef *event)
void void Warning(const char *fmt,...) const id_attribute((format(printf
class idPlayerView playerView
const idEventDef EV_Thread_Execute("<execute>", NULL)
void Event_IsClient(void)
const idEventDef EV_Thread_IsClient("isClient", NULL, 'f')
virtual void DebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifetime=0, const bool depthTest=false)=0
idAngles ToAngles(void) const
const char * GetString(const char *key, const char *defaultString="") const
const idEventDef EV_Thread_TerminateThread("terminate","d")
bool SpawnEntityDef(const idDict &args, idEntity **ent=NULL, bool setDefaults=true)
idVec3 ToForward(void) const
const idEventDef EV_Thread_OnSignal("onSignal","des")
void Event_Assert(float value)
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
const idEventDef EV_Thread_Pause("pause", NULL)
void Event_ClearPersistantArgs(void)
static void ListThreads_f(const idCmdArgs &args)
const idEventDef EV_Thread_StrMid("strMid","sdd", 's')
const idEventDef EV_Thread_GetPersistantVector("getPersistantVector","s", 'v')
static float Sin(float a)
void Event_SetShaderParm(int parmnum, float value)
idPhysics_AF * GetAFPhysics(void)
static idThread * GetThread(int num)
void Event_VecNormalize(idVec3 &vec)
virtual const char * GetCVarString(const char *name) const =0
const idEventDef EV_Thread_Error("error","s")
void ThreadCall(idInterpreter *source, const function_t *func, int args)
void Error(const char *fmt,...) const id_attribute((format(printf
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
void Event_Trigger(idEntity *ent)
const idEventDef EV_Thread_FadeTo("fadeTo","vff")
void Event_GetTraceNormal(void)
const idEventDef EV_Thread_AngToUp("angToUp","v", 'v')
const idEventDef EV_Thread_FadeOut("fadeOut","vf")
void CancelEvents(const idEventDef *ev)
void Restore(idRestoreGame *savefile)
void Event_AngToRight(idAngles &ang)
const idEventDef EV_Thread_DrawText("drawText","svfvdf")
static void ReturnFloat(float value)
const idEventDef EV_Thread_GetTraceNormal("getTraceNormal", NULL, 'v')
void Event_FadeOut(idVec3 &color, float time)
idDict persistentLevelInfo
void Event_CacheSoundShader(const char *soundName)
const idEventDef EV_Thread_GetTraceJoint("getTraceJoint", NULL, 's')
virtual idAnimator * GetAnimator(void)
const idEventDef EV_Thread_Assert("assert","f")
virtual void DrawText(const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align=1, const int lifetime=0, bool depthTest=false)=0
static void ObjectMoveDone(int threadnum, idEntity *obj)
void ReturnFloat(float value)
const idEventDef EV_Thread_Sine("sin","f", 'f')
GLubyte GLubyte GLubyte a
const idEventDef EV_Thread_SetCvar("setcvar","ss")
void Event_FadeTo(idVec3 &color, float alpha, float time)
void Event_KillThread(const char *name)
void Save(idSaveGame *savefile) const
void ReturnEntity(idEntity *ent)
const idEventDef EV_Thread_Wait("wait","f")
void Event_GetFrameTime(void)
void WriteInt(const int value)
void Event_Spawn(const char *classname)
idDeclManager * declManager
void Event_SetCvar(const char *name, const char *value) const
void Event_Random(float range) const
void Event_Wait(float time)
void Event_VecToAngles(idVec3 &vec)
idEntity * entities[MAX_GENTITIES]
void WriteDict(const idDict *dict)
const idEventDef EV_Thread_WaitForThread("waitForThread","d")
const idEventDef EV_Thread_ClearSignal("clearSignalThread","de")
void Event_RadiusDamage(const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignore, const char *damageDefName, float dmgPower)
void SetSignal(signalNum_t signalnum, idThread *thread, const function_t *function)
const idEventDef EV_Thread_SetThreadName("threadname","s")
void Event_OnSignal(int signal, idEntity *ent, const char *func)
int BodyForClipModelId(int id) const
int Append(const type &obj)
void Fade(idVec4 color, int time)
float globalShaderParms[MAX_GLOBAL_SHADER_PARMS]
bool TraceBounds(trace_t &results, const idVec3 &start, const idVec3 &end, const idBounds &bounds, int contentMask, const idEntity *passEntity)
static void ReturnString(const char *text)
void Event_ClearSignalThread(int signal, idEntity *ent)
void SetCamera(idCamera *cam)
void Event_VecDotProduct(idVec3 &vec1, idVec3 &vec2)
static void Restart(void)
void ThreadCallback(idThread *thread)
const idEventDef EV_Thread_GetPersistantFloat("getPersistantFloat","s", 'f')
const idEventDef EV_Thread_DebugBounds("debugBounds","vvvf")
const idEventDef EV_Thread_KillThread("killthread","s")
idMat3 ToMat3(void) const
void Event_StrSkip(const char *string, int num)
void Event_Warning(const char *text)
void EnterObjectFunction(idEntity *self, const function_t *func, bool clearStack)
static idList< idThread * > threadList
const idEventDef EV_Thread_SetPersistantArg("setPersistantArg","ss")
const idEventDef EV_Thread_Trigger("trigger","e")
void EnterFunction(const function_t *func, bool clearStack)
void Signal(signalNum_t signalnum)
void Event_GetCosine(float angle)
const idEventDef EV_Thread_PrintLn("println","s")
void Event_AngToUp(idAngles &ang)
void void void DisplayInfo(void) const
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
const idEventDef EV_Thread_FirstPerson("firstPerson", NULL)
void Event_GetTraceEndPos(void)
virtual void DebugCircle(const idVec4 &color, const idVec3 &origin, const idVec3 &dir, const float radius, const int numSteps, const int lifetime=0, const bool depthTest=false)=0
void ReturnVector(idVec3 const &vec)
int vsprintf(idStr &string, const char *fmt, va_list argptr)
static void ReturnEntity(idEntity *ent)
const char * c_str(void) const
void Error(const char *fmt,...) const id_attribute((format(printf
static idThread * currentThread
const idEventDef EV_Thread_GetTime("getTime", NULL, 'f')
const char * GetJointName(jointHandle_t handle) const
void Event_Trace(const idVec3 &start, const idVec3 &end, const idVec3 &mins, const idVec3 &maxs, int contents_mask, idEntity *passEntity)
const idEventDef EV_Thread_DebugLine("debugLine","vvvf")
void SetThread(idThread *pThread)
const idEventDef EV_Remove("<immediateremove>", NULL)
void Event_StrLen(const char *string)
const idEventDef EV_Thread_VecDotProduct("DotProduct","vv", 'f')
function_t * FindFunction(const char *name) const
const char * CurrentFile(void) const
void Event_SpawnVector(const char *key, idVec3 &defaultvalue)
const idEventDef EV_Thread_SetCallback("<script_setcallback>", NULL)
virtual void DebugBounds(const idVec4 &color, const idBounds &bounds, const idVec3 &org=vec3_origin, const int lifetime=0)=0
void Event_GetTraceFraction(void)
void Event_DebugBounds(const idVec3 &color, const idVec3 &mins, const idVec3 &maxs, const float lifetime)
void Event_GetPersistantString(const char *key)
const idEventDef EV_Thread_GetPersistantString("getPersistantString","s", 's')
idRenderWorld * gameRenderWorld
const idEventDef EV_Thread_SetCamera("setCamera","e")
const idEventDef EV_Thread_VecToAngles("VecToAngles","v", 'v')
const idEventDef EV_Thread_AngToRight("angToRight","v", 'v')
char * va(const char *fmt,...)
static float ACos(float a)
void Event_Error(const char *text)
const idEventDef EV_Thread_StrLen("strLength","s", 'd')
const idEventDef EV_Thread_StrRight("strRight","sd", 's')
const idEventDef EV_Thread_VecCrossProduct("CrossProduct","vv", 'v')
bool PostEventMS(const idEventDef *ev, int time)
const idEventDef EV_Thread_SpawnVector("SpawnVector","sv", 'v')
void Event_Print(const char *text)
void Event_StrMid(const char *string, int start, int num)
void Restore(idRestoreGame *savefile)
void ToVectors(idVec3 *forward, idVec3 *right=NULL, idVec3 *up=NULL) const
void Event_GetTicsPerSecond(void)
const idEventDef EV_CacheSoundShader("cacheSoundShader","s")
void Event_SpawnFloat(const char *key, float defaultvalue)
bool IsWaitingFor(idEntity *obj)
const idEventDef EV_Thread_Warning("warning","s")
void Set(const float x, const float y, const float z, const float w)
const idEventDef EV_Thread_StrToFloat("strToFloat","s", 'f')
void ReadString(idStr &string)
idInterpreter interpreter
void Event_VecLength(idVec3 &vec)
const idEventDef EV_Thread_WaitFrame("waitFrame")
static void ReturnInt(int value)
void Event_GetPersistantVector(const char *key)
bool Remove(const type &obj)
void Event_PrintLn(const char *text)
const idEventDef EV_Thread_StartMusic("music","s")
void ReadObject(idClass *&obj)
const idStr & GetName(void) const
void Event_GetPersistantFloat(const char *key)
void void Warning(const char *fmt,...) const id_attribute((format(printf
const idEventDef EV_Thread_Random("random","f", 'f')
const idEventDef EV_Thread_Say("say","s")
static float Cos(float a)