JediBantha Posted December 28, 2015 Posted December 28, 2015 I'm trying to figure out what affects the color of LightAmp's night vision, so I can make Force Sight more similar to DF2's variant of the latter. Between this and Force Destruction, I had to get away from it for a bit. //----------- // Light Amp //-------------------------------- else if ( cg.zoomMode == 3 ) { CG_RegisterItemVisuals( ITM_LA_GOGGLES_PICKUP ); if ( power ) { cgi_R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( 34, 29, 580, 410, cgs.media.laGogglesStatic ); CG_DrawPic( 570, 140, 12, 160, cgs.media.laGogglesSideBit ); float light = (128-cent->gent->lightLevel) * 0.5f; if ( light < -81 ) // saber can really jack up local light levels....?magic number?? { light = -81; } float pos1 = 220 + light; float pos2 = 220 + cos( cg.time * 0.0004f + light * 0.05f ) * 40 + sin( cg.time * 0.0013f + 1 ) * 20 + sin( cg.time * 0.0021f ) * 5; // Flickery color color1[0] = 0.7f + crandom() * 0.2f; color1[1] = 0.8f + crandom() * 0.2f; color1[2] = 0.7f + crandom() * 0.2f; color1[3] = 1.0f; cgi_R_SetColor( color1 ); CG_DrawPic( 565, pos1, 22, 8, cgs.media.laGogglesBracket ); CG_DrawPic( 558, pos2, 14, 5, cgs.media.laGogglesArrow ); } // Black out the area behind the battery display cgi_R_SetColor( colorTable[CT_DKGREY]); CG_DrawPic( 236, 357, 164, 16, cgs.media.whiteShader ); if ( power ) { // Power bar color1[0] = 1.0f * ( charge < 0.2f ? !!(cg.time & 256) : 1 ); color1[1] = charge * color1[0]; color1[2] = 0.0f; color1[3] = 0.4f; cgi_R_SetColor( color1 ); CG_DrawPic( 247.0f, 362.5f, charge * 143.0f, 6, cgs.media.whiteShader ); // pulsing dot bit color1[0] = sin( cg.time * 0.01f ) * 0.5f + 0.5f; color1[0] = color1[0] * color1[0]; color1[1] = color1[0]; color1[2] = color1[0]; color1[3] = 1.0f; cgi_R_SetColor( color1 ); CG_DrawPic( 65, 94, 16, 16, cgs.media.binocularCircle ); } CG_DrawPic( 0, 0, 640, 480, cgs.media.laGogglesMask ); }
JediBantha Posted December 29, 2015 Author Posted December 29, 2015 I *think* I found the night vision portion of the goggles here: SP Vanilla Renderer void RE_LAGoggles( void ) { tr.refdef.rdflags |= (RDF_doLAGoggles|RDF_doFullbright); tr.refdef.doLAGoggles = qtrue; fog_t *fog = &tr.world->fogs[tr.world->numfogs]; fog->parms.color[0] = 0.75; fog->parms.color[1] = 0.42f + random() * 0.025f; fog->parms.color[2] = 0.07f; fog->parms.depthForOpaque = 10000; fog->colorInt = ColorBytes4(fog->parms.color[0], fog->parms.color[1], fog->parms.color[2], 1.0f); fog->tcScale = 2.0f / ( fog->parms.depthForOpaque * (1.0f + cos( tr.refdef.floatTime) * 0.1f)); }
eezstreet Posted January 4, 2016 Posted January 4, 2016 You need to call the traps that are responsible: trap->RE_LAGoggles and trap->RE_GetLightLevel. See how those get used in the JK2 code.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now