Anyone know how to fade to black in Q3. I have added a Teleport function that jumps the player from the current map to another map or another server. My game is more of an RPG so moving between worlds is essential.
But, there is a 1-2 second delay before the map load kicks in where the user has a bright white screen. I'd like to drop/fade to black or better yet show the next levelshot before initiating the transfer.
This easy to do with the UI, but I need to make this happen inside /game/g_misc.c
Here the code at the moment:
void TeleportPlayer
( gentity_t *player, vec3_t origin, vec3_t angles ) {
// new mod warp
if(mapFlag == 0)
{
// fade out goes here
trap_SendConsoleCommand( EXEC_NOW, "map m2" );
mapFlag = 1;
}
else
{
// fade out goes here
trap_SendConsoleCommand( EXEC_NOW, "map m1" );
mapFlag = 0;
}
}
Thanks.
Fade to Black
-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
Re: Fade to Black
Difficult if not impossible. As soon as you execute the 'map' command, Q3A unloads both the server and client QVM|DLL, loading the UI instead. You could work around this by modifying the engine itself, of course.rbottoms wrote:This easy to do with the UI, but I need to make this happen inside /game/g_misc.c
-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
You'll need to synchronize the client and the server, because it'd be bad if the client was still fading out the current map while the server had already switched to the next. Easy enough. In your trigger_teleport_player_touch() function do:rbottoms wrote:-- a sever command that tells the client fade to black
Code: Select all
const char *mapname;
/* ... set mapname ... */
trap_SendServerCommand( -1, va( "fadeout %s", mapname ) );
Code: Select all
if ( !strcmp( cmd, "fadeout" ) ) {
CG_Fadeout(); // you'll have to define this yourself
trap_SendClientCommand( va( "warpMap %s", CG_Argv(1) ) );
return;
}
Code: Select all
else if (Q_stricmp (cmd, "warpMap") == 0)
Cmd_WarpMap_f(ent);
Code: Select all
void Cmd_WarpMap_f( gentity_t *ent ) {
char mapname[MAX_TOKEN_CHARS];
trap_Argv( 1, mapname, sizeof( mapname ) );
trap_SendConsoleCommaned( EXEC_APPEND, va( "map %s\n", mapname ) );
}
Probably easiest if you add a new trap that does the fading out inside the engine.rbottoms wrote:-- the fade to black code executed by the client
>You'll need to synchronize the client and the >server
Ahh, you've made me see that what I am doing is the opposite of my intent.
What I am doing is switching the map the server is using.
What I intended was for the client to switch the map it is connected.
So it looks like for my purposes I have to always have more than one server running, each on a different port, then issue a "connect 192.168.1.100:29760" "connect 192.168.1.101:29770", etc.. for each different map(server) I want to warp to.
No wonder I've had such a hard time getting this answered.
So the missing piece is still the same.
Fade the client to black. I don't need to do that in the engine because the server isn't changing it's map, the client is just changing the server it's connected to.
Wonderful things these forums.
edit:
That's not working so well. From the console in the game issuing the "connect ip:port" works just fine.
If I do it from g_misc.c like so: trap_Cmd_ExecuteText( EXEC_NOW, va( "connect 127.0.0.1:29770")); I go into some type of infinite loop.
Suggetions?
Ahh, you've made me see that what I am doing is the opposite of my intent.
What I am doing is switching the map the server is using.
What I intended was for the client to switch the map it is connected.
So it looks like for my purposes I have to always have more than one server running, each on a different port, then issue a "connect 192.168.1.100:29760" "connect 192.168.1.101:29770", etc.. for each different map(server) I want to warp to.
No wonder I've had such a hard time getting this answered.
So the missing piece is still the same.
Fade the client to black. I don't need to do that in the engine because the server isn't changing it's map, the client is just changing the server it's connected to.
Wonderful things these forums.
edit:
That's not working so well. From the console in the game issuing the "connect ip:port" works just fine.
If I do it from g_misc.c like so: trap_Cmd_ExecuteText( EXEC_NOW, va( "connect 127.0.0.1:29770")); I go into some type of infinite loop.
Suggetions?
I can pay few dollars to get this finihsed. I shipped the demo off minus the fade in/out code but I really, really need it for version 0.02.
This combined with the fill dropdown box reqeust elsethread is the next bit of coding I need to advance the ball.
I am great believer in doing things for the community good, but people also need to make a living.
Besides, this is GPL so everyone will get to use it eventually.
This combined with the fill dropdown box reqeust elsethread is the next bit of coding I need to advance the ball.
I am great believer in doing things for the community good, but people also need to make a living.
Besides, this is GPL so everyone will get to use it eventually.