MCPcopy Create free account
hub / github.com/JACoders/OpenJK / UI_TalkingHead

Function UI_TalkingHead

code/ui/ui_shared.cpp:7020–7104  ·  view source on GitHub ↗

from snd_dma.cpp

Source from the content-addressed store, hash-verified

7018
7019extern int s_entityWavVol[MAX_GENTITIES]; //from snd_dma.cpp
7020void UI_TalkingHead(itemDef_t *item)
7021{
7022// static int facial_blink = DC->realTime + Q_flrand(4000.0, 8000.0);
7023 static int facial_timer = DC->realTime + Q_flrand(10000.0, 30000.0);
7024// static animNumber_t facial_anim = FACE_ALERT;
7025 int anim = -1;
7026
7027 //are we blinking?
7028/* if (facial_blink < 0)
7029 { // yes, check if we are we done blinking ?
7030 if (-(facial_blink) < DC->realTime)
7031 { // yes, so reset blink timer
7032 facial_blink = DC->realTime + Q_flrand(4000.0, 8000.0);
7033 CG_G2SetHeadBlink( cent, qfalse ); //stop the blink
7034 }
7035 }
7036 else // no we aren't blinking
7037 {
7038 if (facial_blink < DC->realTime)// but should we start ?
7039 {
7040 CG_G2SetHeadBlink( cent, qtrue );
7041 if (facial_blink == 1)
7042 {//requested to stay shut by SET_FACEEYESCLOSED
7043 facial_blink = -(DC->realTime + 99999999.0f);// set blink timer
7044 }
7045 else
7046 {
7047 facial_blink = -(DC->realTime + 300.0f);// set blink timer
7048 }
7049 }
7050 }
7051*/
7052
7053 if (s_entityWavVol[0] > 0) // if we aren't talking, then it will be 0, -1 for talking but paused
7054 {
7055 anim = FACE_TALK1 + s_entityWavVol[0]-1;
7056 if( anim > FACE_TALK4 )
7057 {
7058 anim = FACE_TALK4;
7059 }
7060 // reset timers so we don't start right away after talking
7061 facial_timer = DC->realTime + Q_flrand(2000.0, 7000.0);
7062 }
7063 else if (s_entityWavVol[0] == -1)
7064 {// talking, but silent
7065 anim = FACE_TALK0;
7066 // reset timers so we don't start right away after talking
7067 facial_timer = DC->realTime + Q_flrand(2000.0, 7000.0);
7068 }
7069/* else if (s_entityWavVol[0] == 0) //don't anim if in a slient part of speech
7070 {//not talking
7071 if (facial_timer < 0) // are animating ?
7072 { //yes
7073 if (-(facial_timer) < DC->realTime)// are we done animating ?
7074 { // yes, reset timer
7075 facial_timer = DC->realTime + Q_flrand(10000.0, 30000.0);
7076 }
7077 else

Callers 1

Item_Model_PaintFunction · 0.85

Calls 1

Q_flrandFunction · 0.85

Tested by

no test coverage detected