Jump to content
The Dark Mod Forums

Subtitles in intro


ajotatxe
 Share

Recommended Posts

this is the routine in snd_world.cpp that displays the drawSound position and distance name

 

 

/*
==================
idSoundWorldLocal::ForegroundUpdate
==================
*/
void idSoundWorldLocal::ForegroundUpdate( int current44kHzTime ) {
int j, k;
idSoundEmitterLocal *def;

if ( !soundSystemLocal.isInitialized ) {
return;
}

Sys_EnterCriticalSection();

// if we are recording an AVI demo, don't use hardware time
if ( fpa[0] ) {
current44kHzTime = lastAVI44kHz;
}

//
// check to see if each sound is visible or not
// speed up by checking maxdistance to origin
// although the sound may still need to play if it has
// just become occluded so it can ramp down to 0
//
for ( j = 1; j < emitters.Num(); j++ ) {
def = emitters[j];

if ( def->removeStatus >= REMOVE_STATUS_SAMPLEFINISHED ) {
continue;
}

// see if our last channel just finished
def->CheckForCompletion( current44kHzTime );

if ( !def->playing ) {
continue;
}

// update virtual origin / distance, etc
def->Spatialize( listenerPos, listenerArea, rw );

// per-sound debug options
if ( idSoundSystemLocal::s_drawSounds.GetInteger() && rw ) {
if ( def->distance < def->maxDistance || idSoundSystemLocal::s_drawSounds.GetInteger() > 1 ) {
idBounds ref;
ref.Clear();
ref.AddPoint( idVec3( -10, -10, -10 ) );
ref.AddPoint( idVec3( 10, 10, 10 ) );
float vis = (1.0f - (def->distance / def->maxDistance));

// draw a box
rw->DebugBounds( idVec4( vis, 0.25f, vis, vis ), ref, def->origin );

// draw an arrow to the audible position, possible a portal center
if ( def->origin != def->spatializedOrigin ) {
rw->DebugArrow( colorRed, def->origin, def->spatializedOrigin, 4 );
}

// draw the index
idVec3 textPos = def->origin;
textPos[2] -= 8;
rw->DrawText( va("%i", def->index), textPos, 0.1f, idVec4(1,0,0,1), listenerAxis );
textPos[2] += 8;

// run through all the channels
for ( k = 0; k < SOUND_MAX_CHANNELS ; k++ ) {
idSoundChannel *chan = &def->channels[k];

// see if we have a sound triggered on this channel
if ( !chan->triggerState ) {
continue;
}

char text[1024];
float min = chan->parms.minDistance;
float max = chan->parms.maxDistance;
const char *defaulted = chan->leadinSample->defaultSound ? "(DEFAULTED)" : "";
sprintf( text, "%s (%i/%i %i/%i)%s", chan->soundShader->GetName(), (int)def->distance,
(int)def->realDistance, (int)min, (int)max, defaulted );
rw->DrawText( text, textPos, 0.1f, idVec4(1,0,0,1), listenerAxis );
textPos[2] += 8;
}
}
}
}

Sys_LeaveCriticalSection();

//
// the sound meter
//
if ( idSoundSystemLocal::s_showLevelMeter.GetInteger() ) {
const idMaterial *gui = declManager->FindMaterial( "guis/assets/soundmeter/audiobg", false );
if ( gui ) {
const shaderStage_t *foo = gui->GetStage(0);
if ( !foo->texture.cinematic ) {
((shaderStage_t *)foo)->texture.cinematic = new idSndWindow;
}
}
}

//
// optionally dump out the generated sound
//
if ( fpa[0] ) {
AVIUpdate();
}
}

 

 

all that would be needed is a map.script access to

 

GetName

distance (distance through a visportal)

realDistance (distance if using noclip)

min (its in meters) sound min radius

max (its in meters) sound max radius

 

as you can already get player position with $player1.getWorldOrigin() or maybe with the entity name get entity name World Origin.

 

sprintf( text, "%s (%i/%i %i/%i)%s", chan->soundShader->GetName(), (int)def->distance,
(int)def->realDistance, (int)min, (int)max, defaulted );

 

without having to turn on the debugging s_drawSound cvar.

 

be along lines of measure distance between player and sound being played if its a vocal sound and within range say 10 meters (about 35 feet) write subtitle text to gui based on language of l18m, along the lines of if there aren't any polish vocal then you could write the polish text for what the vocal is.

Edited by stumpy
Link to comment
Share on other sites

In the doom 3 [cc] they seem to have overly complicated how it should work, as they seem to have used the #str_00000 system in adding there names to the credits gui but seem to have missed that they could use the same system for different languages, without having to add code for people to select their language.

Link to comment
Share on other sites

I'm sorry for asking a common question. I have just registered in the forum and couldn't see the search dialog so far.

 

Search diaglog is at the top right of the main page.

I have an eclectic YouTube channel making videos on a variety of games. Come and have look here:

https://www.youtube.com/c/NeonsStyleHD

 

Dark Mod Missions: Briarwood Manor - available here or in game

http://forums.thedarkmod.com/topic/18980-fan-mission-briarwood-manor-by-neonsstyle-first-mission-6082017-update-16/

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recent Status Updates

×
×
  • Create New...