Jump to content

A way to set multiple random loading screens?


Recommended Posts

Hey there! I know that theres a way to set multiple random loading screens (unknownmap) since I've seen this done before in ForceMod III and a few other modpacks here and there. I'd like to figure out how to achieve such a thing with my own content but not quite sure how to approach it since I'm still new to this. Also I can't find any available source code that uses this so I can't see how it was done.

 

For example, I found this under ui_main but not sure how to set it for multiple random images:

/*
=================
Menu_Cache
=================
*/
void Menu_Cache( void )
{
    uis.cursor = ui.R_RegisterShaderNoMip( "menu/new/crosshairb" );
    uis.whiteShader = ui.R_RegisterShader( "white" );
    uis.menuBackShader = ui.R_RegisterShaderNoMip( "menu/art/unknownmap" );
}

And this under cg_info:

{
    levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );
 #ifndef FINAL_BUILD
    if (!levelshot && !strncmp(s, "work/",5) )
    {
        levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s+5 ) );
    }
 #endif
    if (!levelshot) {
        levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap" );
    }
}

I've seen other strings of code that can randomize sound effects, NPC spawning, and other things... but for menu related things I'm not too sure. I'd appreciate any ideas or tips!  :3

Link to comment

I don't know much about coding, but it'd seem you just need to add more "or" conditions to this part of the code. Would love to see how that works since it seems like it could be a basic thing to learn. 

    if (!levelshot) {
        levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap" );
    }
Link to comment

Ah okay!  Well I tried this code in cg_info and sadly it did not work:

    {
        levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );
    #ifndef FINAL_BUILD
        if (!levelshot && !strncmp(s, "work/",5) )
        {
            levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s+5 ) );
        }
    #endif
        if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap" );
        }
        else if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap0" );
        }
        else if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap1" );
        }
        else if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap2" );
        }
        else if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap3" );
        }
        else if (!levelshot) {
            levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap4" );
        }
    }

I'm sure theres something more that needs to be done or something different, and perhaps more than just one file that needs to be edited.

Link to comment
  • 2 weeks later...

Hey there! I know that theres a way to set multiple random loading screens (unknownmap) since I've seen this done before in ForceMod III and a few other modpacks here and there. I'd like to figure out how to achieve such a thing with my own content but not quite sure how to approach it since I'm still new to this. Also I can't find any available source code that uses this so I can't see how it was done.

 

For example, I found this under ui_main but not sure how to set it for multiple random images:

/*
=================
Menu_Cache
=================
*/
void Menu_Cache( void )
{
    uis.cursor = ui.R_RegisterShaderNoMip( "menu/new/crosshairb" );
    uis.whiteShader = ui.R_RegisterShader( "white" );
    uis.menuBackShader = ui.R_RegisterShaderNoMip( "menu/art/unknownmap" );
}

And this under cg_info:

{
    levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );
 #ifndef FINAL_BUILD
    if (!levelshot && !strncmp(s, "work/",5) )
    {
        levelshot = cgi_R_RegisterShaderNoMip( va( "levelshots/%s", s+5 ) );
    }
 #endif
    if (!levelshot) {
        levelshot = cgi_R_RegisterShaderNoMip( "menu/art/unknownmap" );
    }
}

I've seen other strings of code that can randomize sound effects, NPC spawning, and other things... but for menu related things I'm not too sure. I'd appreciate any ideas or tips!  :3

 

Try this.

void CG_DrawInformation( void )
{
	int		y;
	// draw the dialog background
	const char	*info	= CG_ConfigString( CS_SERVERINFO );
	const char	*s		= Info_ValueForKey( info, "mapname" );

	qhandle_t	levelshot;
	qhandle_t	levelshot2;

	extern SavedGameJustLoaded_e g_eSavedGameJustLoaded;	// hack! (hey, it's the last week of coding, ok?
	
	levelshot = cgi_R_RegisterShaderNoMip(va("levelshots/%s", s));
	levelshot2 = cgi_R_RegisterShaderNoMip(va("levelshots/%s2", s));

	if (!levelshot)
	{
		levelshot = cgi_R_RegisterShaderNoMip("menu/art/unknownmap");
	}
	if (!levelshot2)
	{
		levelshot2 = cgi_R_RegisterShaderNoMip("menu/art/unknownmap_mp");
	}

	if ( g_eSavedGameJustLoaded != eFULL
		&& !strcmp(s,"yavin1"))//special case for first map!
	{
		char	text[1024] = { 0 };

		CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot);

		cgi_SP_GetStringTextString("SP_INGAME_ALONGTIME", text, sizeof(text));

		int w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.0f);
		cgi_R_Font_DrawString((320) - (w / 2), 140, text, colorTable[CT_ICON_BLUE], cgs.media.qhFontMedium, -1, 1.0f);
	}
	else if (cg.loadLCARSStage >= 4)
	{
		CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot2);
	}
	else
	{
		CG_DrawLoadingScreen(levelshot, s);
		cgi_UI_MenuPaintAll();
	}

	CG_LoadBar();

	// draw info string information

	y = 20;
	// map-specific message (long map name)
	s = CG_ConfigString( CS_MESSAGE );

	if ( s[0] )
	{
		if (s[0] == '@')
		{
			char text[1024]={0};
			cgi_SP_GetStringTextString( s+1, text, sizeof(text) );
			cgi_R_Font_DrawString( 15, y, va("\"%s\"",text),colorTable[CT_WHITE],cgs.media.qhFontMedium, -1, 1.0f );
		}
		else
		{
			cgi_R_Font_DrawString( 15, y, va("\"%s\"",s),colorTable[CT_WHITE],cgs.media.qhFontMedium, -1, 1.0f );
		}
		y += 20;
	}
}
Link to comment

 

Try this.

void CG_DrawInformation( void )
{
	int		y;
	// draw the dialog background
	const char	*info	= CG_ConfigString( CS_SERVERINFO );
	const char	*s		= Info_ValueForKey( info, "mapname" );

	qhandle_t	levelshot;
	qhandle_t	levelshot2;

	extern SavedGameJustLoaded_e g_eSavedGameJustLoaded;	// hack! (hey, it's the last week of coding, ok?
	
	levelshot = cgi_R_RegisterShaderNoMip(va("levelshots/%s", s));
	levelshot2 = cgi_R_RegisterShaderNoMip(va("levelshots/%s2", s));

	if (!levelshot)
	{
		levelshot = cgi_R_RegisterShaderNoMip("menu/art/unknownmap");
	}
	if (!levelshot2)
	{
		levelshot2 = cgi_R_RegisterShaderNoMip("menu/art/unknownmap_mp");
	}

	if ( g_eSavedGameJustLoaded != eFULL
		&& !strcmp(s,"yavin1"))//special case for first map!
	{
		char	text[1024] = { 0 };

		CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot);

		cgi_SP_GetStringTextString("SP_INGAME_ALONGTIME", text, sizeof(text));

		int w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.0f);
		cgi_R_Font_DrawString((320) - (w / 2), 140, text, colorTable[CT_ICON_BLUE], cgs.media.qhFontMedium, -1, 1.0f);
	}
	else if (cg.loadLCARSStage >= 4)
	{
		CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot2);
	}
	else
	{
		CG_DrawLoadingScreen(levelshot, s);
		cgi_UI_MenuPaintAll();
	}

	CG_LoadBar();

	// draw info string information

	y = 20;
	// map-specific message (long map name)
	s = CG_ConfigString( CS_MESSAGE );

	if ( s[0] )
	{
		if (s[0] == '@')
		{
			char text[1024]={0};
			cgi_SP_GetStringTextString( s+1, text, sizeof(text) );
			cgi_R_Font_DrawString( 15, y, va("\"%s\"",text),colorTable[CT_WHITE],cgs.media.qhFontMedium, -1, 1.0f );
		}
		else
		{
			cgi_R_Font_DrawString( 15, y, va("\"%s\"",s),colorTable[CT_WHITE],cgs.media.qhFontMedium, -1, 1.0f );
		}
		y += 20;
	}
}

 

WHAT THE F*CK IS HAPPENING TO MY COMPUTER???

Link to comment

FINALLY!  I got it to work! The issue was that it was ui_main.cpp that I was supposed to be editing, not cg_info at all!

For specifically the loading screens to be random, I had to change this:

/*
=================
Menu_Cache
=================
*/
void Menu_Cache( void )
{
    uis.cursor         = ui.R_RegisterShaderNoMip( "menu/new/crosshairb" );
    uis.whiteShader    = ui.R_RegisterShader( "white" );
    uis.menuBackShader = ui.R_RegisterShaderNoMip( "menu/art/unknownmap" );
}

To this:

/*
=================
Menu_Cache
=================
*/
void Menu_Cache( void )
{
    uis.cursor         = ui.R_RegisterShaderNoMip( "menu/new/crosshairb" );
    uis.whiteShader    = ui.R_RegisterShader( "white" );
    uis.menuBackShader = ui.R_RegisterShaderNoMip(va("menu/art/jasp/load%d", Q_irand(0, 20)));
}

@JaceSolarisVIII @Exmirai @Noodle  Thanks for the help, regardless!  :3  Plus now this can be used by others who are interested!  (directory names and number of images may vary, of course)

Link to comment

Do you mean splash screens? You can get more than one to load by using this shader:

 

levelshots/mod
{
    
    {
        map $lightmap
    }
    {
        map textures/mod/your.jpg
        blendFunc GL_DST_COLOR GL_ZERO
    }
    {
        map textures/mod/your_title.jpg
        blendFunc GL_ONE GL_ONE
        animMap 0.5 textures/mod/your1.jpg textures/mod/your2.jpg textures/mod/your3.jpg ... png .. tga etc.
    }
Link to comment

 

Do you mean splash screens? You can get more than one to load by using this shader:

 

levelshots/mod
{
    
    {
        map $lightmap
    }
    {
        map textures/mod/your.jpg
        blendFunc GL_DST_COLOR GL_ZERO
    }
    {
        map textures/mod/your_title.jpg
        blendFunc GL_ONE GL_ONE
        animMap 0.5 textures/mod/your1.jpg textures/mod/your2.jpg textures/mod/your3.jpg ... png .. tga etc.
    }

 

 

Oh I see! I'll try this as well and see what happens.

Link to comment

@RAILBACK Okay I got the time to look into this and...... I have no idea what to put as directories lol. Did you mean something like this?

levelshots/mod
{
    {
        map $lightmap
    }
    {
        map menu/art/jasp/load.jpg
        blendFunc GL_DST_COLOR GL_ZERO
    }
    {
        map menu/art/jasp/load.jpg
        blendFunc GL_ONE GL_ONE
        animMap 0.5 menu/art/jasp/load00.jpg menu/art/jasp/load01.jpg menu/art/jasp/load02.jpg menu/art/jasp/load03.jpg menu/art/jasp/load04.jpg menu/art/jasp/load05.jpg
    }
}

Cause it didn't do anything.

Link to comment
  • 2 weeks later...

Do you mean splash screens? You can get more than one to load by using this shader:

 

levelshots/mod

{

    

    {

        map $lightmap

    }

    {

        map textures/mod/your.jpg

        blendFunc GL_DST_COLOR GL_ZERO

    }

    {

        map textures/mod/your_title.jpg

        blendFunc GL_ONE GL_ONE

        animMap 0.5 textures/mod/your1.jpg textures/mod/your2.jpg textures/mod/your3.jpg ... png .. tga etc.

    }

I was thinking the same. Probably would be simpler to do it with shaders then coding the thing.

All of my Elite Force and Jedi Academy maps have this feature, altough I notice that not all images are shown when the map is being loaded (delay).

What happens if people don't use this 'feature' and stick with only one levelshot ??

Signature.jpg

Link to comment

@RAILBACK Okay I got the time to look into this and...... I have no idea what to put as directories lol. Did you mean something like this?

levelshots/mod
{
    {
        map $lightmap
    }
    {
        map menu/art/jasp/load.jpg
        blendFunc GL_DST_COLOR GL_ZERO
    }
    {
        map menu/art/jasp/load.jpg
        blendFunc GL_ONE GL_ONE
        animMap 0.5 menu/art/jasp/load00.jpg menu/art/jasp/load01.jpg menu/art/jasp/load02.jpg menu/art/jasp/load03.jpg menu/art/jasp/load04.jpg menu/art/jasp/load05.jpg
    }
}

Cause it didn't do anything.

map_menu isnt a default quake directory, thats why.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...