banimod / etpro / ettv forums Forum Index banimod / etpro / ettv forums
Bani's Discussion Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

session stuff

 
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding
View previous topic :: View next topic  
Author Message
ensiform



Joined: 30 Sep 2005
Posts: 3

PostPosted: Wed Jan 11, 2006 2:14 pm    Post subject: session stuff Reply with quote

hey bani would it be possible to go into more detail on how to make this work?

http://www.quakesrc.org/forums/viewtopic.php?p=47407#47407

if done this:

g_local.h :

Code:
clientSession_t      *g_sess;


g_session.c:

Code:
/*
==================
G_WriteSessionData

==================
*/
void G_WriteSessionData( void ) {
   int      i;

   trap_Cvar_Set( "session", va2("%i", g_gametype.integer) );

   /*for ( i = 0 ; i < level.maxclients ; i++ ) {
      if ( level.clients[i].pers.connected == CON_CONNECTED ) {
         G_WriteClientSessionData( &level.clients[i] );
      }
   }*/
   for( i=0; i < g_maxclients.integer; i++ ) {
      g_sess[i] = level.clients[i].sess;
   }
}

void G_InitSess( gclient_t *client ) {
   char      gsessptr[MAX_STRING_CHARS];

   // bani - allocate client persistent session data
   trap_Cvar_VariableStringBuffer( "gsess", gsessptr, sizeof( gsessptr ) );
   if( !Q_stricmp( gsessptr, "" ) ) {
      g_sess = malloc( g_maxclients.integer * sizeof( clientSession_t ) );
      trap_Cvar_Set( "gsess", va2( "%p", g_sess ) );
      memset( g_sess, 0, g_maxclients.integer * sizeof( clientSession_t ) );
   } else {
      sscanf( gsessptr, "%p", &g_sess );
   }
}

void G_ReadSess( gclient_t *client ) {
   client->sess = g_sess[client->ps.clientNum];
}


then i called read, write, init appropriately in the spots in g_client.c

seems okay afaik on first load but when i go to restart or something crashes, i havent attempted to debug yet for 1 cause i dont even think im actually doing it right but i dunno.

gsess atm = 02441E18
Back to top
View user's profile Send private message
ensiform



Joined: 30 Sep 2005
Posts: 3

PostPosted: Wed Jan 11, 2006 7:34 pm    Post subject: Reply with quote

im trying this in Jedi Academy btw.
Back to top
View user's profile Send private message
ensiform



Joined: 30 Sep 2005
Posts: 3

PostPosted: Thu Jan 12, 2006 4:52 pm    Post subject: Reply with quote

got it working took a bit of hacking i just need to get IPstring in session to stay even over gametype change, ill report back when i have it all working.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group