mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
Fix for FS#29
Fix for FS#29 - Server Change on ui_transporter seems broken
This commit is contained in:
parent
6ee97b6843
commit
fd6e6fca30
7 changed files with 62 additions and 55 deletions
|
@ -1531,7 +1531,6 @@ static void G_SendHoloData(int clientNum) {
|
|||
holoTent->nextthink = level.time + 2500;
|
||||
}
|
||||
|
||||
extern srvChangeData_t srvChangeData;
|
||||
extern mapChangeData_t mapChangeData;
|
||||
|
||||
//! Think function for temporal entity that transmits the server change data and map change data for transporter UI
|
||||
|
@ -1541,16 +1540,16 @@ void transTent_think(gentity_t *ent) {
|
|||
|
||||
memset(temp, 0, sizeof(temp));
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
if(!srvChangeData.name[i][0]) break;
|
||||
for(i = 0; i < level.srvChangeData.count; i++) {
|
||||
if(!temp[0])
|
||||
Com_sprintf(temp, sizeof(temp), "d%i\\%s\\", i, srvChangeData.name[i]);
|
||||
Com_sprintf(temp, sizeof(temp), "ui_trdata d%i\\%s\\", i, level.srvChangeData.name[i]);
|
||||
else
|
||||
Com_sprintf(temp, sizeof(temp), "%sd%i\\%s\\", temp, i, srvChangeData.name[i]);
|
||||
Com_sprintf(temp, sizeof(temp), "%sd%i\\%s\\", temp, i, level.srvChangeData.name[i]);
|
||||
}
|
||||
|
||||
trap_SendServerCommand(ent-g_entities, va("ui_trdata \"%s\"", temp));
|
||||
trap_SendServerCommand(ent->target_ent-g_entities, temp);
|
||||
|
||||
#if 0
|
||||
memset(temp, 0, sizeof(temp));
|
||||
|
||||
for(i = 0; i < 16; i++) {
|
||||
|
@ -1561,7 +1560,8 @@ void transTent_think(gentity_t *ent) {
|
|||
Com_sprintf(temp, sizeof(temp), "%sa%i\\%s\\", temp, i, mapChangeData.name[i]);
|
||||
}
|
||||
|
||||
trap_SendServerCommand(ent-g_entities, va("ui_trdata \"%s\"", temp));
|
||||
trap_SendServerCommand(ent->target_ent-g_entities, va("ui_trdata \"%s\"", temp));
|
||||
#endif
|
||||
|
||||
G_FreeEntity(ent);
|
||||
}
|
||||
|
@ -1747,7 +1747,7 @@ void G_Client_Begin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qb
|
|||
|
||||
// send srv change data to ui
|
||||
if(!isBot && first) {
|
||||
if(srvChangeData.ip[0][0])
|
||||
if(level.srvChangeData.count > 0)
|
||||
G_SendTransData(clientNum);
|
||||
}
|
||||
|
||||
|
|
|
@ -612,6 +612,24 @@ struct gclient_s {
|
|||
#define MAX_SPAWN_VARS 64
|
||||
#define MAX_SPAWN_VARS_CHARS 2048
|
||||
|
||||
/** \typedef srvChangeData_t
|
||||
* Pointer to \link srvChangeData_s \endlink
|
||||
*
|
||||
* \author Ubergames - GSIO01
|
||||
*/
|
||||
typedef struct srvChangeData_s srvChangeData_t;
|
||||
|
||||
/** \struct srvChangeData_s
|
||||
* Contains data needed by traporter UI and transportet entities for serverchage transports.
|
||||
*
|
||||
* \author Ubergames - GSIO01
|
||||
*/
|
||||
struct srvChangeData_s {
|
||||
char name[6][MAX_QPATH]; //!< name of the locations
|
||||
char ip[6][MAX_QPATH]; //!< IPs of the servers to connect to
|
||||
int count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Contains important informations about the current leve and information needed for game logic.
|
||||
*/
|
||||
|
@ -701,6 +719,9 @@ typedef struct {
|
|||
list_p locations;
|
||||
list_p timedMessages;
|
||||
|
||||
// other stuff
|
||||
srvChangeData_t srvChangeData;
|
||||
|
||||
// override rpg_calcLiftTravelDuration
|
||||
int overrideCalcLiftTravelDuration;
|
||||
} level_locals_t;
|
||||
|
@ -2047,24 +2068,6 @@ struct holoData_s {
|
|||
int numProgs; //!< number of programs <= 5
|
||||
};
|
||||
|
||||
/** \typedef srvChangeData_t
|
||||
* Pointer to \link srvChangeData_s \endlink
|
||||
*
|
||||
* \author Ubergames - GSIO01
|
||||
*/
|
||||
typedef struct srvChangeData_s srvChangeData_t;
|
||||
|
||||
/** \struct srvChangeData_s
|
||||
* Contains data needed by traporter UI and transportet entities for serverchage transports.
|
||||
*
|
||||
* \author Ubergames - GSIO01
|
||||
*/
|
||||
struct srvChangeData_s {
|
||||
char name[6][MAX_QPATH]; //!< name of the locations
|
||||
char ip[6][MAX_QPATH]; //!< IPs of the servers to connect to
|
||||
};
|
||||
|
||||
|
||||
typedef struct mapChangeData_s mapChangeData_t;
|
||||
struct mapChangeData_s {
|
||||
char name[16][MAX_QPATH];
|
||||
|
|
|
@ -1110,14 +1110,13 @@ static void G_LoadHolodeckFile(void) {
|
|||
free(buffer);
|
||||
}
|
||||
|
||||
srvChangeData_t srvChangeData;
|
||||
|
||||
static void G_LoadServerChangeFile(void) {
|
||||
char fileRoute[MAX_QPATH];
|
||||
fileHandle_t f;
|
||||
char *buffer;
|
||||
char* buffer;
|
||||
int file_len;
|
||||
char *txtPtr, *token;
|
||||
char* txtPtr;
|
||||
char* token;
|
||||
int cnt = 0;
|
||||
int i = 0;
|
||||
|
||||
|
@ -1147,7 +1146,9 @@ static void G_LoadServerChangeFile(void) {
|
|||
buffer[file_len] = '\0';
|
||||
trap_FS_FCloseFile(f);
|
||||
|
||||
memset(&srvChangeData, 0, sizeof(srvChangeData));
|
||||
memset(&level.srvChangeData, 0, sizeof(&level.srvChangeData));
|
||||
|
||||
G_Printf("Loading ServerChangeConfig '%s'.\n", fileRoute);
|
||||
|
||||
COM_BeginParseSession();
|
||||
txtPtr = buffer;
|
||||
|
@ -1183,9 +1184,9 @@ static void G_LoadServerChangeFile(void) {
|
|||
if(cnt > 12) break;
|
||||
|
||||
if(cnt % 2 == 0)
|
||||
Q_strncpyz(srvChangeData.ip[i], token, sizeof(srvChangeData.ip[i]));
|
||||
Q_strncpyz(level.srvChangeData.ip[i], token, sizeof(level.srvChangeData.ip[i]));
|
||||
else
|
||||
Q_strncpyz(srvChangeData.name[i], token, sizeof(srvChangeData.name[i]));
|
||||
Q_strncpyz(level.srvChangeData.name[i], token, sizeof(level.srvChangeData.name[i]));
|
||||
|
||||
cnt++;
|
||||
if(cnt % 2 == 0)
|
||||
|
@ -1198,6 +1199,7 @@ static void G_LoadServerChangeFile(void) {
|
|||
}
|
||||
}
|
||||
|
||||
level.srvChangeData.count = i;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1240,7 @@ static void G_LoadMapChangeFile(void) {
|
|||
buffer[file_len] = '\0';
|
||||
trap_FS_FCloseFile(f);
|
||||
|
||||
memset(&srvChangeData, 0, sizeof(srvChangeData));
|
||||
memset(&mapChangeData, 0, sizeof(mapChangeData));
|
||||
|
||||
COM_BeginParseSession();
|
||||
txtPtr = buffer;
|
||||
|
|
|
@ -2494,8 +2494,6 @@ Can be toggled by an usable if the usable has NO_ACTIVATOR spawnflag.
|
|||
-----KEYS-----
|
||||
"serverNum" - server to connect to (rpg_server<serverNum> cvar)
|
||||
*/
|
||||
extern srvChangeData_t srvChangeData;
|
||||
|
||||
void target_serverchange_think(gentity_t *ent) {
|
||||
if(!ent->touched || !ent->touched->client) return;
|
||||
trap_SendServerCommand(ent->touched->client->ps.clientNum, va("cg_connect \"%s\"\n", ent->targetname2));
|
||||
|
@ -2519,7 +2517,7 @@ void target_serverchange_use(gentity_t *ent, gentity_t *other, gentity_t *activa
|
|||
TransDat[ent->client->ps.clientNum].beamTime = level.time + 8000;
|
||||
activator->client->ps.powerups[PW_BEAM_OUT] = level.time + 8000;
|
||||
ent->touched = activator;
|
||||
ent->targetname2 = srvChangeData.ip[ent->count];
|
||||
ent->targetname2 = level.srvChangeData.ip[ent->count];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -951,8 +951,6 @@ void trigger_transporter_serverchange(gentity_t *ent) {
|
|||
G_FreeEntity(ent);
|
||||
}
|
||||
|
||||
extern srvChangeData_t srvChangeData;
|
||||
|
||||
/**
|
||||
* \brief Touch function of trigger_transporter.
|
||||
*
|
||||
|
@ -991,7 +989,7 @@ void trigger_transporter_touch(gentity_t *ent, gentity_t *other, trace_t *trace)
|
|||
}
|
||||
else {
|
||||
|
||||
srv = srvChangeData.ip[ent->health];
|
||||
srv = level.srvChangeData.ip[ent->health];
|
||||
|
||||
tent = G_Spawn();
|
||||
tent->think = trigger_transporter_serverchange;
|
||||
|
|
|
@ -1324,7 +1324,7 @@ qboolean UI_ConsoleCommand( void ) {
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if ( Q_stricmp( cmd, "ui_trdata" ) == 0 ) {;
|
||||
if ( Q_stricmp( cmd, "ui_trdata" ) == 0 ) {
|
||||
TransDataReceived(UI_Argv(1));
|
||||
return qtrue;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ char *delayList[20] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
|
|||
"11", "12", "13", "14", "15", "20", "30", "60", 0 };
|
||||
|
||||
char srvList[6][MAX_QPATH];
|
||||
int srvCount;
|
||||
|
||||
typedef struct //static
|
||||
{
|
||||
|
@ -53,10 +54,12 @@ TransDataReceived
|
|||
void TransDataReceived(const char *data) {
|
||||
char *temp;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
temp = Info_ValueForKey(data, va("d%i", i));
|
||||
if(!temp[0]) break;
|
||||
Q_strncpyz(srvList[i], temp, sizeof(srvList[i]));
|
||||
srvCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,22 +109,24 @@ static void M_Transporter_Event (void* ptr, int notification)
|
|||
break;
|
||||
case ID_ENGAGE2: // Active only if a deck has been chosen
|
||||
if ( notification == QM_ACTIVATED ) {
|
||||
if(s_transporter.delButton.curvalue <= 16)
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue , s_transporter.delButton.curvalue));
|
||||
else {
|
||||
switch(s_transporter.delButton.curvalue) {
|
||||
case 17:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 20));
|
||||
break;
|
||||
case 18:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 30));
|
||||
break;
|
||||
case 19:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 60));
|
||||
break;
|
||||
if(srvCount > 0) {
|
||||
if(s_transporter.delButton.curvalue <= 16)
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue , s_transporter.delButton.curvalue));
|
||||
else {
|
||||
switch(s_transporter.delButton.curvalue) {
|
||||
case 17:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 20));
|
||||
break;
|
||||
case 18:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 30));
|
||||
break;
|
||||
case 19:
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 60));
|
||||
break;
|
||||
}
|
||||
}
|
||||
UI_ForceMenuOff();
|
||||
}
|
||||
UI_ForceMenuOff();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -261,6 +266,7 @@ TransporterMenu_Draw
|
|||
static void TransporterMenu_Draw(void)
|
||||
{
|
||||
// Draw graphics particular to Main Menu
|
||||
|
||||
M_TransporterMenu_Graphics();
|
||||
|
||||
Menu_Draw( &s_transporter.menu );
|
||||
|
|
Loading…
Reference in a new issue