diff --git a/cgame/cg_consolecmds.c b/cgame/cg_consolecmds.c index 6e302ce..4b56d9f 100644 --- a/cgame/cg_consolecmds.c +++ b/cgame/cg_consolecmds.c @@ -915,5 +915,8 @@ void CG_InitConsoleCommands( void ) { trap_AddCommand("selfdestruct"); trap_AddCommand("shipdamage"); trap_AddCommand("shiphealth"); + + /* precacheFile */ + trap_AddCommand("generatePrecacheFile"); } diff --git a/cgame/cg_main.c b/cgame/cg_main.c index 1ec7d3d..b361d93 100644 --- a/cgame/cg_main.c +++ b/cgame/cg_main.c @@ -20,8 +20,6 @@ qboolean CG_LoadUsablesStrings( void ); extern void FX_InitSinTable(void); -//extern lensReflec_s lensReflec[10]; - int cg_liftEnts[MAX_CLIENTS]; int cg_numAnims; int cg_numSndAnims; @@ -49,7 +47,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a case CG_CONSOLE_COMMAND: return CG_ConsoleCommand(); case CG_DRAW_ACTIVE_FRAME: - CG_DrawActiveFrame( arg0, arg1, arg2 ); + CG_DrawActiveFrame( arg0, (stereoFrame_t)arg1, (qboolean)arg2 ); return 0; case CG_CROSSHAIR_PLAYER: return CG_CrosshairPlayer(); @@ -118,7 +116,6 @@ vmCvar_t cg_zoomFov; vmCvar_t cg_thirdPerson; vmCvar_t cg_thirdPersonRange; vmCvar_t cg_thirdPersonAngle; -//RPG-X: TiM - Cool JKA CVARs vmCvar_t cg_thirdPersonVertOffset; vmCvar_t cg_thirdPersonHorzOffset; vmCvar_t cg_thirdPersonAlpha; @@ -199,15 +196,6 @@ vmCvar_t cg_debugLua; vmCvar_t cg_logLua; #endif - -//RPG-X | Phenix | 05/02/2006 -//Ban System (and it's backup cvars) -//vmCvar_t cg_playerID; -//vmCvar_t s_mhz; //Part A + 562 -//vmCvar_t cg_fow; //Part B + 333 -//vmCvar_t cl_avgPacket; //Part C + 99 -//vmCvar_t cg_rewardsSize;//Part D + 120 - typedef struct { vmCvar_t *vmCvar; char *cvarName; @@ -217,15 +205,12 @@ typedef struct { static cvarTable_t cvarTable[] = { { &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging - //{ &s_mhz, "s_mhz", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, //RPG-X | Phenix | 05/02/2006 { &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE }, { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_zoomFov, "cg_zoomfov", "22.5", CVAR_ARCHIVE }, { &cg_fov, "cg_fov", "80", CVAR_ARCHIVE }, - //{ &cg_fow, "cg_fow", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, //RPG-X | Phenix | 05/02/2006 { &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE }, { &cg_stereoSeparation, "cg_stereoSeparation", "0.4", CVAR_ARCHIVE }, - //{ &s_mhz, "s_mhz", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, //RPG-X | Phenix | 05/02/2006 { &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE }, { &cg_gibs, "cg_gibs", "0", CVAR_ARCHIVE }, //no gibs in trek { &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE }, @@ -239,7 +224,6 @@ static cvarTable_t cvarTable[] = { { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE }, { &cg_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE }, { &cg_drawRewards, "cg_drawRewards", "1", CVAR_ARCHIVE }, - //{ &cg_rewardsSize, "cg_rewardsSize", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, //RPG-X | Phenix | 05/02/2006 { &cg_crosshairSize, "cg_crosshairSize", "24", CVAR_ARCHIVE }, { &cg_crosshairHealth, "cg_crosshairHealth", "1", CVAR_ARCHIVE }, { &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE }, @@ -299,10 +283,8 @@ static cvarTable_t cvarTable[] = { { &cg_buildScript, "com_buildScript", "0", 0 }, // force loading of all possible data amd error on failures { &cg_paused, "cl_paused", "0", CVAR_ROM }, - //{ &cl_avgPacket, "cl_avgPacket", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART }, //RPG-X | Phenix | 05/02/2006 { &cg_synchronousClients, "g_synchronousClients", "0", 0 }, // communicated by systeminfo { &ui_playerClass, "ui_playerClass", "noclass", CVAR_ARCHIVE /*| CVAR_ROM | CVAR_USERINFO*/ }, - //{ &ui_playerclass, "ui_playerclass", "0", 0 }, // player class { &ui_playerRank, "ui_playerRank", "crewman", CVAR_ARCHIVE /*| CVAR_ROM | CVAR_USERINFO*/ }, { &cg_disablekillmsgs, "cg_disablekillmsgs", "0", CVAR_ARCHIVE }, @@ -337,12 +319,6 @@ static cvarTable_t cvarTable[] = { //RPG-X | GSIO01 | 11/05/2009 { &rpg_forceFieldSet, "rpg_forceFieldSet", "1", CVAR_ARCHIVE | CVAR_LATCH }, - //{ &cg_chatBGColor, "cg_chatBGColor", "", CVAR_ARCHIVE } - - //{ &cg_defaultModel, "cg_defaultModel", DEFAULT_PLAYER, CVAR_ARCHIVE }, - - //{ &cg_playerID, "cg_playerID", "0", CVAR_ARCHIVE | CVAR_ROM | CVAR_NORESTART } - // grp cvars { &grp_berp, "grp_berp", "0", CVAR_ARCHIVE | CVAR_LATCH }, @@ -354,7 +330,66 @@ static cvarTable_t cvarTable[] = { }; -static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); +#define CVAR_TABLE_SIZE sizeof( cvarTable ) / sizeof( cvarTable[0] ) + +/* +======================= +CG_PrecacheRemapShaders +======================= +*/ +void CG_PrecacheRemapShaders(void) { + char filepath[MAX_QPATH]; + fileHandle_t f; + int len; + char* data; + char* ptr; + char* token; + qhandle_t shader; + + COM_StripExtension(cgs.mapname, filepath); + Com_sprintf(filepath, MAX_QPATH, "%s.precache", filepath); + + len = trap_FS_FOpenFile(filepath, &f, FS_READ); + + if(!f) { + CG_Printf("No precache file ...\n"); + return; + } + + data = (char *)malloc(sizeof(char)*(len+1)); + if(!data) { + trap_FS_FCloseFile(f); + CG_Printf(S_COLOR_RED "Error - could not allocate %d byte of memory.\n", sizeof(char)*(len+1)); + return; + } + + trap_FS_Read(data, len, f); + trap_FS_FCloseFile(f); + + //CG_Printf("Precaching texture files ..."); + CG_Printf("Precaching texture files ..."); + COM_BeginParseSession(); + + ptr = data; + token = COM_Parse(&ptr); + while(token != NULL) { + if(!token[0]) break; + if(!strcmp(token, "END")) break; + + CG_Printf("\t%s ... ", token); + + shader = trap_R_RegisterShader(token); + if(!shader) { + CG_Printf(S_COLOR_RED "FAIL\n"); + } else { + CG_Printf("OK\n"); + } + + token = COM_Parse(&ptr); + } + + free(data); +} /* ================= @@ -366,14 +401,14 @@ void CG_RegisterCvars( void ) { cvarTable_t *cv; char var[MAX_TOKEN_CHARS]; - for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) { + for ( i = 0, cv = cvarTable ; i < CVAR_TABLE_SIZE ; i++, cv++ ) { trap_Cvar_Register( cv->vmCvar, cv->cvarName, cv->defaultString, cv->cvarFlags ); } // see if we are also running the server on this machine trap_Cvar_VariableStringBuffer( "sv_running", var, sizeof( var ) ); - cgs.localServer = atoi( var ); + cgs.localServer = (qboolean)atoi( var ); } @@ -386,7 +421,7 @@ void CG_UpdateCvars( void ) { int i; cvarTable_t *cv; - for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) + for ( i = 0, cv = cvarTable ; i < CVAR_TABLE_SIZE ; i++, cv++ ) { trap_Cvar_Update( cv->vmCvar ); } @@ -447,42 +482,6 @@ void QDECL CG_Printf( const char *msg, ... ) { } } - //CVAR background - /*if ( cg_chatBGColor.string[0] ) - { - char *bgColor; - char *rimColor; - int rgb[3]; - int i; - - Q_strlwr( cg_chatBGColor.string ); - - bgColor = cg_chatBGColor.string; - - if ( *bgColor == '#' ) - { - bgColor[7]='\0'; - bgColor++; - - for ( i=0; i < 3; i++ ) - { - if ( *bgColor >= 'a' && *bgColor <='f' ) - rgb[i] = 16 * ( 10 + (int)(*bgColor - 'a')); - else - rgb[i] = 16 * atoi(bgColor[0]); - - bgColor++; - - if ( *bgColor >= 'a' && *bgColor <='f' ) - rgb[i] += ( 10 + (int)(*bgColor - 'a')); - else - rgb[i] += atoi(bgColor[0]); - } - - - } - }*/ - trap_Print( text ); } @@ -613,51 +612,34 @@ static void CG_RegisterSounds( void ) cgs.media.count1Sound = trap_S_RegisterSound( "sound/voice/computer/misc/one.wav" ); cgs.media.countFightSound = trap_S_RegisterSound( "sound/voice/computer/misc/fight.wav" ); cgs.media.countPrepareSound = trap_S_RegisterSound( "sound/voice/computer/misc/prepare.wav" ); - cgs.media.interfaceSnd1 = trap_S_RegisterSound( "sound/interface/button4.wav" ); - cgs.media.useNothingSound = trap_S_RegisterSound( "sound/items/use_nothing.wav" ); - cgs.media.teleInSound = trap_S_RegisterSound( "sound/world/transin.wav" ); cgs.media.transportSound = trap_S_RegisterSound( "sound/world/transporter.wav" ); cgs.media.respawnSound = trap_S_RegisterSound( "sound/items/respawn1.wav" ); - cgs.media.talkSound = trap_S_RegisterSound( "sound/interface/communicator.wav" ); - - //cgs.media.landSound = trap_S_RegisterSound( "sound/player/land1.wav"); - //RPG-X | GSIO01 | 20/05/2009: cgs.media.landSound[LANDSOUND_NORMAL] = trap_S_RegisterSound("sound/player/land1.wav"); cgs.media.landSound[LANDSOUND_GRASS] = trap_S_RegisterSound("sound/player/footsteps/grass_jump.wav"); cgs.media.landSound[LANDSOUND_GRAVEL] = trap_S_RegisterSound("sound/player/footsteps/gravel_jump.wav"); cgs.media.landSound[LANDSOUND_SNOW] = trap_S_RegisterSound("sound/player/footsteps/snow_jump.wav"); cgs.media.landSound[LANDSOUND_WOOD] = trap_S_RegisterSound("sound/player/footsteps/wood_jump.wav"); - cgs.media.splatSound = trap_S_RegisterSound( "sound/weapons/bodyfall.wav"); - cgs.media.watrInSound = trap_S_RegisterSound( "sound/player/watr_in.wav"); cgs.media.watrOutSound = trap_S_RegisterSound( "sound/player/watr_out.wav"); cgs.media.watrUnSound = trap_S_RegisterSound( "sound/player/watr_un.wav"); - cgs.media.jumpPadSound = trap_S_RegisterSound ("sound/items/damage3.wav" ); - cgs.media.disintegrateSound = trap_S_RegisterSound( "sound/weapons/prifle/disint.wav" ); cgs.media.disintegrate2Sound = trap_S_RegisterSound( "sound/weapons/prifle/disint2.wav" ); cgs.media.playerExplodeSound = trap_S_RegisterSound( "sound/weapons/explosions/fireball.wav" ); - cgs.media.phaserEmptySound = trap_S_RegisterSound("sound/weapons/phaser/phaserempty.wav"); - - //RPG-X: RedTechie - Load sound for shake cmd cgs.media.ShakeSound = trap_S_RegisterSound("sound/shake.wav"); - cgs.media.tedTextSound = trap_S_RegisterSound( "sound/interface/tedtext.wav" ); - //RPG-X | Phenix | 13/02/2005 for (i=0 ; ips.persistant[PERS_SCORE] == cl2->ps.persistant[PERS_SCORE]) secondPlaceTied=1; - + winningTeam = level.clients[0].ps.persistant[PERS_RANK]+1; if ( winningTeam != TEAM_BLUE && winningTeam != TEAM_RED ) {//tie or not a team game winningTeam = 0; } - // In team game, we want to represent the highest scored client from the WINNING team. - for (i = 0; i < level.maxclients; i++) - { - ent = &g_entities[i]; - if (ent && ent->client && - (ent->client->sess.sessionTeam != TEAM_SPECTATOR) && - CalculateTeamMVPByRank(ent)) - { - // found the winning team's MVP - mvpNum = i; - break; - } - } if (mvpNum < 0) {//ah, crap no MVP, pick the first player on the winning team for (i = 0; i < level.maxclients; i++ ) @@ -137,10 +124,6 @@ void UpdateTournamentInfo( void ) { strcpy(msg2, msg); Com_sprintf( msg, sizeof(msg), "%s 0", msg2); } - else - { - CalculateAwards(player, msg); - } // now supply... // @@ -276,8 +259,8 @@ static void CelebrateStart( gentity_t *player ) player->nextthink = level.time + TIMER_GESTURE; player->think = CelebrateStop;*/ -// We don't want the taunt sound effect because it interfears with the computer voice giving awards -// FIXME: just get timing right? + // We don't want the taunt sound effect because it interfears with the computer voice giving awards + // FIXME: just get timing right? //FIXME: why does this get lost now? BG_AddPredictableEventToPlayerstate( EV_TAUNT, 0, &player->client->ps ); } @@ -386,8 +369,6 @@ SpawnModelsOnVictoryPads void SpawnModelsOnVictoryPads( void ) { gentity_t *player; gentity_t *podium; - int i = 0; - gentity_t *ent = &g_entities[0]; podium1 = NULL; podium2 = NULL; @@ -396,27 +377,9 @@ void SpawnModelsOnVictoryPads( void ) { podium = SpawnPodium(); - // SPAWN PLAYER ON TOP MOST PODIUM - if (g_gametype.integer > GT_SINGLE_PLAYER) - { - // In team game, we want to represent the highest scored client from the WINNING team. - for (i = 0; i < level.maxclients; i++) - { - ent = &g_entities[i]; - if (ent->client && CalculateTeamMVPByRank(ent)) - { - // found the winning team's MVP - break; - } - } - player = SpawnModelOnVictoryPad( podium, offsetFirst, ent, - level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); - } - else - { - player = SpawnModelOnVictoryPad( podium, offsetFirst, &g_entities[level.sortedClients[0]], - level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); - } + player = SpawnModelOnVictoryPad( podium, offsetFirst, &g_entities[level.sortedClients[0]], + level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); + if ( player ) { player->nextthink = level.time + 2000; player->think = CelebrateStart; @@ -429,7 +392,7 @@ void SpawnModelsOnVictoryPads( void ) { { if ( level.numNonSpectatorClients > 1 ) { player = SpawnModelOnVictoryPad( podium, offsetSecond, &g_entities[level.sortedClients[1]], - level.clients[ level.sortedClients[1] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); + level.clients[ level.sortedClients[1] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG ); if ( player ) { podium2 = player; } diff --git a/game/g_cmds.c b/game/g_cmds.c index f73390a..54c0131 100644 --- a/game/g_cmds.c +++ b/game/g_cmds.c @@ -53,13 +53,14 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) { } else { ping = cl->ps.ping < 999 ? cl->ps.ping : 999; } + // TODO ajust me some things here might not be needed anymore Com_sprintf (entry, sizeof(entry), " %i %i %i %i %i %i %i %i %i %i %i", level.sortedClients[i], cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000, scoreFlags, g_entities[level.sortedClients[i]].s.powerups, - GetWorstEnemyForClient(level.sortedClients[i]), - GetMaxDeathsForClient(level.sortedClients[i]), - GetFavoriteWeaponForClient(level.sortedClients[i]), + 0, + 0, + 0, cl->ps.persistant[PERS_KILLED], ((g_entities[cl->ps.clientNum].r.svFlags&SVF_ELIMINATED)!=0) ); j = strlen(entry); @@ -721,7 +722,7 @@ qboolean SetTeam( gentity_t *ent, char *s ) { if ( !Q_stricmp( s, "spectator" ) || !Q_stricmp( s, "s" ) ) { team = TEAM_SPECTATOR; specState = SPECTATOR_FREE; - client->noclip = 1; + client->noclip = (qboolean)1; } else if ( g_gametype.integer >= GT_TEAM ) { // if running a team game, assign player to one of the teams specState = SPECTATOR_NOT; @@ -4087,14 +4088,14 @@ static void Cmd_BeamToPlayer_f( gentity_t *ent ) { int startPoint; int totalCount; int offsetRA[8][2] = { { 1, 0 }, //offsets for each beam test location - { 1, -1 }, - { 0, -1 }, - { -1, -1 }, - { -1, 0 }, - { -1, 1 }, - { 0, 1 }, - { 1, 1 } - }; + { 1, -1 }, + { 0, -1 }, + { -1, -1 }, + { -1, 0 }, + { -1, 1 }, + { 0, 1 }, + { 1, 1 } + }; int viewAngleHeading[8] = { 180, 135, 90, 45, 0, -45, -90, -135 }; qboolean everyone = qfalse; @@ -5780,7 +5781,7 @@ Harry Young | 25/07/2012 */ static void Cmd_selfdestruct_f(gentity_t *ent) { gentity_t *destructEnt, *safezone=NULL; - char arg[16], arg2[16], arg3[16], arg4[16], arg5[16], arg6[16], arg7[16], arg8[16]; + char arg[16], arg2[16], arg6[16], arg7[16], arg8[16]; double ETAmin, ETAsec; if(!ent || !ent->client) return; @@ -5788,12 +5789,9 @@ static void Cmd_selfdestruct_f(gentity_t *ent) { //Trapping all potential args here. trap_Argv(1, arg, sizeof(arg)); trap_Argv(2, arg2, sizeof(arg2)); - trap_Argv(3, arg3, sizeof(arg3)); - trap_Argv(4, arg4, sizeof(arg4)); - trap_Argv(5, arg5, sizeof(arg5)); - trap_Argv(6, arg6, sizeof(arg6)); - trap_Argv(7, arg7, sizeof(arg7)); - trap_Argv(8, arg8, sizeof(arg8)); + trap_Argv(3, arg6, sizeof(arg6)); + trap_Argv(4, arg7, sizeof(arg7)); + trap_Argv(5, arg8, sizeof(arg8)); //There is one subcommand that is clear for general use: selfdestruct remaining //If we're going for this skip admincheck @@ -5830,9 +5828,6 @@ static void Cmd_selfdestruct_f(gentity_t *ent) { destructEnt = G_Spawn(); destructEnt->classname = "target_selfdestruct"; destructEnt->wait = atoi(arg2); - destructEnt->count = atoi(arg3); - destructEnt->n00bCount = atoi(arg4); - destructEnt->health = atoi(arg5); destructEnt->flags = atoi(arg6); destructEnt->bluename = G_NewString(arg7); destructEnt->target = G_NewString(arg8); @@ -5840,26 +5835,20 @@ static void Cmd_selfdestruct_f(gentity_t *ent) { destructEnt->spawnflags = 1; //tells ent to free once aborted. //we need to check a few things here to make sure the entity works properly. Else we free it. - if ( destructEnt->wait > 0 || destructEnt->count > 0 || destructEnt->n00bCount > 0 || destructEnt->health > 0 ){ - G_CallSpawn(destructEnt); //Spawn-Function will also manage init, so we need to call that. - } else { //sth's wrong so lets tell them what is. - G_PrintfClient(ent, "^1ERROR: The following arguments are missing:"); - if ( destructEnt->wait == 0 ) - G_PrintfClient(ent, "^1-duration must not be 0."); - if ( destructEnt->count == 0 ) - G_PrintfClient(ent, "^1-intervall must not be 0."); - if ( destructEnt->n00bCount == 0 ) - G_PrintfClient(ent, "^1-intervall-60 must not be 0."); - if ( destructEnt->health == 0 ) - G_PrintfClient(ent, "^1-intervall-10 must not be 0."); + if ( destructEnt->wait <= 0 ){ + G_PrintfClient(ent, "^1ERROR: duration must not be 0. Removing entity."); + while((safezone = G_Find(safezone, FOFS(classname), "target_safezone")) != NULL){ if(!destructEnt->bluename && safezone->spawnflags & 2){ - G_PrintfClient(ent, "^1-safezone must be given for maps consisting of multiple ships/stations (like rpg_runabout). For a list of safezonesuse the safezonelist command."); + G_PrintfClient(ent, "^1ERROR: safezone must be given for maps consisting of multiple ships/stations (like rpg_runabout). For a list of safezonesuse the safezonelist command. Removing entity."); + destructEnt->wait = 0; //we'll use this next to free the ent break; } } - G_PrintfClient(ent, "^1Removing entity."); - G_FreeEntity(destructEnt); + if(destructEnt->wait <= 0) + G_FreeEntity(destructEnt); + else + G_CallSpawn(destructEnt); return; } } else if (!Q_stricmp(arg, "remaining")) { @@ -5870,6 +5859,9 @@ static void Cmd_selfdestruct_f(gentity_t *ent) { return; } + if(destructEnt->flags == 1) + return; //we simply don't need this while there is a visible countdown. + //we need the remaining time in minutes and seconds from that entity. Just ask them off and have the command do the math. ETAsec = floor(modf((( floor(destructEnt->damage / 1000) - floor(level.time / 1000) ) / 60), &ETAmin)*60); //break it apart, put off the minutes and return the floored secs if (!Q_stricmp(arg2, "global")) //a relevant OP has requestet a global announcement so let's give it @@ -5885,22 +5877,18 @@ static void Cmd_selfdestruct_f(gentity_t *ent) { } destructEnt->use(destructEnt, NULL, NULL); // Use-Function will simply manage the abort } else { + //maybe hook up a setup UI here later. G_PrintfClient(ent, "^1ERROR: Invalid or no command-Argument. Arguments are start, remaining and abort"); - G_PrintfClient(ent, "^3Usage: selfdestruct start duration intervall intervall-60 intervall-10 audio [safezone] [target]"); + G_PrintfClient(ent, "^3Usage: selfdestruct start duration audio [safezone] [target]"); G_PrintfClient(ent, "duration: total countdown-duration in seconds. Must not be 0."); - G_PrintfClient(ent, "intervall: intervall of audio warnings up to T-60 seconds in seconds. Must not be 0."); - G_PrintfClient(ent, "intervall-60: intervall of audio warnings within T-60 seconds in seconds. Must not be 0."); - G_PrintfClient(ent, "intervall-10: intervall of audio warnings within T-10 seconds in seconds. Must not be 0."); G_PrintfClient(ent, "audio: set this 0 if you do want a muted countdown, else set this 1."); G_PrintfClient(ent, "safezone: safezone to toggle unsafe at T-50ms. Only for maps with multiple ships (like rpg_runabout). Set NULL to skip."); G_PrintfClient(ent, "target: Optional Argument for Effects to fire once the countdown hist 0. The entity will automatically shake everyones screen and kill all clienst outside an active target_safezone."); G_PrintfClient(ent, "^2Hint: Make sure your duration and intervalls are synced up. There is a failsave for the countdown to hit it's mark however there is nothing to make sure that you don't get your warnings at unexpected times..."); - G_PrintfClient(ent, "^2Try this for example: selfdestruct start 131 10 10 1 1"); - G_PrintfClient(ent, "\nFor a fluid countdown (each sec displayed) try extremeselfdestruct"); G_PrintfClient(ent, "\n^3Usage: selfdestruct remaining"); G_PrintfClient(ent, "This will give out the remaining countdown-time to you only even if the count is muted. It is free to use for any client."); G_PrintfClient(ent, "\n^3Usage: selfdestruct remaining global"); - G_PrintfClient(ent, "This will give out the remaining countdown-time to all clients even if the count is muted."); + G_PrintfClient(ent, "This will give out the remaining countdown-time to all clients even if the count is muted. Calling this is restricted to admins"); G_PrintfClient(ent, "\n^3Usage: selfdestruct abort"); G_PrintfClient(ent, "This will abort any self destruct running"); return; @@ -6055,7 +6043,6 @@ GSIO01 | 12/05/2009 */ static void Cmd_admin_centerprint_f(gentity_t *ent) { char *arg; - gentity_t *destructEnt; if ( trap_Argc () < 1 ) { return; @@ -6079,12 +6066,6 @@ static void Cmd_admin_centerprint_f(gentity_t *ent) { return; // not fully in game yet } - destructEnt = G_Find(NULL, FOFS(classname), "target_selfdestruct"); - if( destructEnt || destructEnt->spawnflags & 2){ //if we have a selfdestruct that occupies the Center disallow - trap_SendServerCommand( ent-g_entities, va("print \"ERROR: You can not centerprint while a selfdestruct occupies that slot.\n\" ") ); - return; - } - arg = ConcatArgs( 1 ); if ( !arg[0] ) { //if user added no args (ie wanted the parameters) @@ -7083,17 +7064,17 @@ static void Cmd_UiTransporterLoc_f(gentity_t *ent) { if(locTarget) { if(locTarget->sound1to2) { - #ifndef SQL +#ifndef SQL if ( !IsAdmin( ent ) ) { G_PrintfClient(ent, "Destination is a restricted location.\n"); return; } - #else +#else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_BEAM) ) { G_PrintfClient(ent, "Destination is a restricted location.\n"); return; } - #endif +#endif } trTrigger->target_ent = locTarget; trTrigger->count = 0; @@ -7365,6 +7346,123 @@ void Cmd_CamtestEnd_f(gentity_t *ent) { } // END CCAM +typedef struct rShader_s { + char *s; +} rShader_s; +void addShaderToList(list_p list, char *shader) { + rShader_s* s = (rShader_s *)malloc(sizeof(rShader_s)); + rShader_s* t; + list_iter_p i; + + if(s == NULL) return; + if(shader[0] == 0) return; + if(list == NULL) return; + + s->s = strdup(shader); + if(s->s == NULL) { + free(s); + return; + } + + i = list_iterator(list, FRONT); + if(i == NULL) { + free(s->s); + free(s); + return; + } + + for(t = (rShader_s *)list_next(i); t != NULL; t = (rShader_s *)list_next(i)) { + if(!strcmp(shader, t->s)) { + return; + } + } + + list_add(list, s, sizeof(rShader_s)); +} + +extern target_alert_Shaders_s alertShaders; +void Cmd_GeneratePrecacheFile(gentity_t *ent) { + int i; + char info[MAX_INFO_STRING]; + char file[MAX_QPATH]; + list_p shaders; + list_iter_p iter; + qboolean first = qtrue; + fileHandle_t f; + rShader_s* s; + + trap_GetServerinfo(info, MAX_INFO_STRING); + Com_sprintf(file, MAX_QPATH, "maps/%s.precache", Info_ValueForKey(info, "mapname")); + trap_FS_FOpenFile(file, &f, FS_APPEND); + if(!f) { + G_Printf(S_COLOR_RED "[Error] - Could not create/open 'maps/%s.precache'\n", file); + return; + } + + shaders = create_list(); + if(!shaders) { + G_Printf(S_COLOR_RED "[Error] - Could not create shader list.\n"); + trap_FS_FCloseFile(f); + return; + } + + G_Printf("Generating precache file '%s' ...\n", file); + + for(i = 0; i < alertShaders.numShaders; i++) { + addShaderToList(shaders, alertShaders.blueShaders[i]); + addShaderToList(shaders, alertShaders.greenShaders[i]); + addShaderToList(shaders, alertShaders.redShaders[i]); + addShaderToList(shaders, alertShaders.yellowShaders[i]); + } + + for(i = 0; i < MAX_GENTITIES; i++) { + if(!g_entities[i].inuse) continue; + + if(g_entities[i].classname != NULL && !strcmp(g_entities[i].classname, "target_turbolift")) { + if(g_entities[i].falsename != NULL && g_entities[i].falsename[0] != 0) { + addShaderToList(shaders, g_entities[i].falsename); + } + if(g_entities[i].truename != NULL && g_entities[i].truename[0] != 0) { + addShaderToList(shaders, g_entities[i].truename); + } + continue; + } + + if(g_entities[i].targetShaderNewName != NULL && g_entities[i].targetShaderNewName[0] != 0) { + addShaderToList(shaders, g_entities[i].targetShaderNewName); + } + } + + iter = list_iterator(shaders, FRONT); + if(iter == NULL) { + trap_FS_FCloseFile(f); + destroy_list(shaders); + return; + } + + for(s = (rShader_s *)list_next(iter); s != NULL; s = (rShader_s *)list_next(iter)) { + G_Printf("\t%s\n", s->s); + if(first) { + trap_FS_Write("\"", 1, f); + trap_FS_Write(s->s, strlen(s->s), f); + trap_FS_Write("\"", 1, f); + first = qfalse; + } else { + trap_FS_Write("\n\"", 2, f); + trap_FS_Write(s->s, strlen(s->s), f); + trap_FS_Write("\"", 1, f); + } + } + trap_FS_Write("\n\"END\"", 6, f); + + G_Printf("Done.\n"); + + if(shaders != NULL) { + destroy_list(shaders); + } + trap_FS_FCloseFile(f); +} + /* ================= G_Client_Command @@ -7625,6 +7723,9 @@ void G_Client_Command( int clientNum ) else if (Q_stricmp(cmd, "camtestend") == 0) Cmd_CamtestEnd_f(ent); // END CCAM + else if (Q_stricmp (cmd, "generatePrecacheFile") == 0) { + Cmd_GeneratePrecacheFile(ent); + } else if (Q_strncmp (cmd, "\n", 1) == 0 || Q_strncmp (cmd, " ", 1) == 0 || Q_strncmp (cmd, "\0", 1) == 0) // sorry (void)(0); else diff --git a/game/g_fx.c b/game/g_fx.c index eb062de..87cb878 100644 --- a/game/g_fx.c +++ b/game/g_fx.c @@ -884,13 +884,14 @@ void SP_fx_electrical_explosion( gentity_t *ent ) trap_LinkEntity( ent ); } -/*QUAKED fx_phaser (0 0 1) (-8 -8 -8) (8 8 8) NO_SOUND DISRUPTOR +/*QUAKED fx_phaser (0 0 1) (-8 -8 -8) (8 8 8) NO_SOUND DISRUPTOR LOCKED -----DESCRIPTION----- A phaser effect for use as a ship's weapon. -----SPAWNFLAGS----- 1: NO_SOUND - will not play it's sound 2: DISRUPTOR - will display a green disruptor beam +4: LOCKED - will be locked at spawn -----KEYS----- "target" - endpoint @@ -903,8 +904,9 @@ A phaser effect for use as a ship's weapon. #define PHASER_FX_UNLINKED 999 void phaser_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { - if(ent->count == PHASER_FX_UNLINKED) - return; + if(ent->count == PHASER_FX_UNLINKED) return; + if(ent->flags & FL_LOCKED) return; + if(ent->spawnflags & 2) { G_AddEvent(ent, EV_FX_DISRUPTOR, 0); @@ -919,11 +921,13 @@ void phaser_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { void phaser_link(gentity_t *ent) { gentity_t *target = NULL; target = G_Find(target, FOFS(targetname), ent->target); + if(!target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Enity-Error] Could not find target %s for fx_phaser at %s!\n", ent->target, vtos(ent->r.currentOrigin));); G_FreeEntity(ent); return; } + VectorCopy(target->s.origin, ent->s.origin2); SnapVector(ent->s.origin2); ent->use = phaser_use; @@ -936,23 +940,34 @@ void SP_fx_phaser(gentity_t *ent) { char *sound; int impact; ent->count = PHASER_FX_UNLINKED; + if(!ent->target) { DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] fx_phaser at %s without target!\n", vtos(ent->r.currentOrigin));); return; } + G_SpawnFloat("scale", "20", &scale); ent->s.angles[0] = scale; G_SpawnFloat("delay", "1", &scale); ent->s.angles[1] = scale * 1000; G_SpawnString("customSnd", "sound/pos_b/phaser.wav", &sound); - if(!(ent->spawnflags & 1)) + + if(!(ent->spawnflags & 1)) { ent->s.time = G_SoundIndex(sound); - else + } else { ent->s.time = G_SoundIndex("NULL"); - if(ent->wait) + } + + if(ent->wait) { ent->s.time2 = ent->wait * 1000; - else + } else { ent->s.time2 = 3000; + } + + if(ent->spawnflags & 4) { + ent->flags |= FL_LOCKED; + } + G_SpawnInt("impact", "0", & impact); ent->s.angles[2] = impact; ent->think = phaser_link; @@ -960,13 +975,14 @@ void SP_fx_phaser(gentity_t *ent) { trap_LinkEntity(ent); } -/*QUAKED fx_torpedo (0 0 1) (-8 -8 -8) (8 8 8) QUANTUM NO_SOUND +/*QUAKED fx_torpedo (0 0 1) (-8 -8 -8) (8 8 8) QUANTUM NO_SOUND LOCKED -----DESCRIPTION----- A torpedo effect for use as a ship's weapon. -----SPAWNFLAGS----- 1: QUANTUM - set this flag if you whant an quantum fx instead of an photon fx 2: NO_SOUND - Will not play it's sound +4: LOCKED - will be locked at spawn -----KEYS----- "target" - used for the calculation of the direction @@ -984,6 +1000,8 @@ void fx_torpedo_think(gentity_t *ent) { } void fx_torpedo_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { + if(ent->flags & FL_LOCKED) return; + if(ent->count > 0) { ent->count--; trap_SendServerCommand(activator-g_entities, va("print \"Torpedos: %i of %i left.\n\"", ent->count, ent->damage)); @@ -993,6 +1011,7 @@ void fx_torpedo_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { G_AddEvent(ent, EV_GENERAL_SOUND, ent->n00bCount); return; } + G_AddEvent(ent, EV_FX_TORPEDO, ent->spawnflags); ent->use = 0; ent->think = fx_torpedo_think; @@ -1024,6 +1043,10 @@ void fx_torpedo_link(gentity_t *ent) { ent->damage = ent->count; } + if(ent->spawnflags & 4) { + ent->flags |= FL_LOCKED; + } + ent->s.angles2[0] = ent->speed ? ent->speed : 2.5; ent->use = fx_torpedo_use; diff --git a/game/g_local.h b/game/g_local.h index 93aa9eb..438df73 100644 --- a/game/g_local.h +++ b/game/g_local.h @@ -697,6 +697,9 @@ typedef struct { list_p selfdestructSafeZones; list_p locations; list_p timedMessages; + + // override rpg_calcLiftTravelDuration + int overrideCalcLiftTravelDuration; } level_locals_t; @@ -1250,14 +1253,6 @@ void QDECL G_LogExit( const char *string ); */ void QDECL G_ClearClientLog(int client); -void CalculateAwards(gentity_t *ent, char *msg); -qboolean CalculateTeamMVPByRank(gentity_t *ent); -int GetMaxDeathsForClient(int nClient); -int GetMaxKillsForClient(int nClient); -int GetFavoriteTargetForClient(int nClient); -int GetWorstEnemyForClient(int nClient); -int GetFavoriteWeaponForClient(int nClient); - /*----------------------------------------------------------------------------------------*/ //TiM - Delayed Transport Beam @@ -2107,4 +2102,13 @@ struct timedMessage_s { char* message; } timedMessage_s; +/* alert shaders */ +typedef struct { + char *greenShaders[10]; + char *redShaders[10]; + char *yellowShaders[10]; + char *blueShaders[10]; + int numShaders; +} target_alert_Shaders_s; + #endif //_G_LOCAL_H_ diff --git a/game/g_log.c b/game/g_log.c index b077286..c89c8ab 100644 --- a/game/g_log.c +++ b/game/g_log.c @@ -912,721 +912,6 @@ void G_LogWeaponOutput(void) #endif //LOGGING_WEAPONS } -// did this player earn the sharpshooter award? -qboolean CalculateSharpshooter(gentity_t *ent, int *frags) -{ -#ifdef LOGGING_WEAPONS - int i = 0, nBestPlayer = -1, nKills = 0, nMostKills = 0, - playTime = (level.time - ent->client->pers.enterTime)/60000; - gentity_t *player = NULL; - - // if this guy didn't get one kill per minute, reject him right now - if ( ((float)(G_WeaponLogKills[ent-g_entities][MOD_CRIFLE_ALT]))/((float)(playTime)) < 1.0 ) - { - return qfalse; - } - - for (i = 0; i < g_maxclients.integer; i++) - { - nKills = 0; - player = g_entities + i; - if (!player->inuse) - continue; - nKills = G_WeaponLogKills[i][MOD_CRIFLE_ALT]; - if (nKills > nMostKills) - { - nMostKills = nKills; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - *frags = nMostKills; - return qtrue; - } -#endif // LOGGING_WEAPONS - return qfalse; -} - -// did this player earn the untouchable award? -qboolean CalculateUntouchable(gentity_t *ent) -{ -#ifdef LOGGING_WEAPONS - int playTime; - playTime = (level.time - ent->client->pers.enterTime)/60000; - - //------------------------------------------------------ MUST HAVE ACHIEVED 2 KILLS PER MINUTE - if ( ((float)ent->client->pers.teamState.frags)/((float)(playTime)) < 2.0 || playTime==0) - return qfalse; - //------------------------------------------------------ MUST HAVE ACHIEVED 2 KILLS PER MINUTE - - - // if this guy was never killed... Award Away!!! - if (ent->client->ps.persistant[PERS_KILLED]==0) - return qtrue; - -#endif // LOGGING_WEAPONS - return qfalse; -} - -// did this player earn the logistics award? -qboolean CalculateLogistics(gentity_t *ent, int *stuffUsed) -{ -#ifdef LOGGING_WEAPONS - int i = 0, j = 0, nBestPlayer = -1, nStuffUsed = 0, nMostStuffUsed = 0, - nDifferent = 0, nMostDifferent = 0; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nStuffUsed = 0; - nDifferent = 0; - player = g_entities + i; - if (!player->inuse) - continue; - for (j = HI_NONE+1; j < HI_NUM_HOLDABLE; j++) - { - if (G_WeaponLogPowerups[i][j]) - { - nDifferent++; - } - nStuffUsed += G_WeaponLogPowerups[i][j]; - } - for (j = PW_NONE+1; j < PW_NUM_POWERUPS; j++) - { - if (G_WeaponLogItems[i][j]) - { - nDifferent++; - } - nStuffUsed += G_WeaponLogItems[i][j]; - } - if ( (nDifferent >= 4) && (nDifferent >= nMostDifferent) ) - { - if (nStuffUsed > nMostStuffUsed) - { - nMostDifferent = nDifferent; - nMostStuffUsed = nStuffUsed; - nBestPlayer = i; - } - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - *stuffUsed = nMostDifferent; - return qtrue; - } -#endif // LOGGING_WEAPONS - return qfalse; -} - - - - -// did this player earn the tactician award? -qboolean CalculateTactician(gentity_t *ent, int *kills) -{ -#ifdef LOGGING_WEAPONS - int i = 0, nBestPlayer = -1, nKills = 0, nMostKills = 0; - int person = 0, weapon = 0; - gentity_t *player = NULL; - int wasPickedUpBySomeone[WP_NUM_WEAPONS]; - int killsWithWeapon[WP_NUM_WEAPONS]; - int playTime = (level.time - ent->client->pers.enterTime)/60000; - - //------------------------------------------------------ MUST HAVE ACHIEVED 2 KILLS PER MINUTE - if (playTime<0.3) - return qfalse; - - if ( ((float)ent->client->pers.teamState.frags)/((float)(playTime)) < 2.0 ) - return qfalse; - //------------------------------------------------------ MUST HAVE ACHIEVED 2 KILLS PER MINUTE - - - - - //------------------------------------------------------ FOR EVERY WEAPON, ADD UP TOTAL PICKUPS - for (weapon = 0; weapon0) - wasPickedUpBySomeone[weapon]++; - } - } - //------------------------------------------------------ FOR EVERY WEAPON, ADD UP TOTAL PICKUPS - - - - - //------------------------------------------------------ FOR EVERY PERSON, CHECK FOR CANDIDATE - for (person=0; personinuse) continue; - - nKills = 0; // This Persons's Kills - for (weapon=0; weapon0) ) - { - weapon++; - if(weapon>=WP_NUM_WEAPONS) { - break; - } - nKills+=killsWithWeapon[weapon]; // Update the number of kills - } - // - // At this point we have either successfully gone through every weapon on the map and saw it had - // been used, or we found one that WAS on the map and was NOT used - // - // so we look to see if the weapon==Max (i.e. we used every one) and then we check to see - // if we got the most kills out of anyone else who did this. - // - if (weapon>=WP_NUM_WEAPONS && nKills>nMostKills) - { - // WE ARE A TACTICION CANDIDATE - nMostKills = nKills; - nBestPlayer = person; - } - } - //------------------------------------------------------ FOR EVERY PERSON, CHECK FOR CANDIDATE - - //Now, if we are the best player, return true and the number of kills we got - if (nBestPlayer == ent->s.number) - { - *kills = nMostKills; - return qtrue; - } -#endif // LOGGING_WEAPONS - return qfalse; -} - - - - -// did this player earn the demolitionist award? -qboolean CalculateDemolitionist(gentity_t *ent, int *kills) -{ -#ifdef LOGGING_WEAPONS - int i = 0, nBestPlayer = -1, nKills = 0, nMostKills = 0, - playTime = (level.time - ent->client->pers.enterTime)/60000; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nKills = 0; - player = g_entities + i; - if (!player->inuse) - continue; - - nKills = G_WeaponLogKills[i][MOD_GRENADE]; - nKills += G_WeaponLogKills[i][MOD_GRENADE_SPLASH]; - nKills += G_WeaponLogKills[i][MOD_GRENADE_ALT_SPLASH]; - nKills += G_WeaponLogKills[i][MOD_QUANTUM]; - nKills += G_WeaponLogKills[i][MOD_QUANTUM_SPLASH]; - nKills += G_WeaponLogKills[i][MOD_QUANTUM_ALT]; - nKills += G_WeaponLogKills[i][MOD_QUANTUM_ALT_SPLASH]; - nKills += G_WeaponLogKills[i][MOD_DETPACK]; - - // if this guy didn't get two explosive kills per minute, reject him right now - if ( ((float)nKills)/((float)(playTime)) < 2.0 ) - { - continue; - } - - if (nKills > nMostKills) - { - nMostKills = nKills; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - *kills = nMostKills; - return qtrue; - } -#endif // LOGGING_WEAPONS - return qfalse; -} - -int CalculateStreak(gentity_t *ent) -{ - /* TODO: remove me */ - return 0; -} - -qboolean CalculateTeamMVP(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->ps.persistant[PERS_SCORE]; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamMVPByRank(gentity_t *ent) -{ - playerState_t *ps = &ent->client->ps; - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ps->persistant[PERS_RANK]+1; - qboolean bTied = (qboolean)(team == 3); - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse) - continue; - if (!bTied) - { - if (ps->persistant[PERS_TEAM] != team) - { - continue; - } - } - nScore = ps->persistant[PERS_SCORE]; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamDefender(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->pers.teamState.basedefense; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamWarrior(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->pers.teamState.frags; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamCarrier(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->pers.teamState.captures; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamInterceptor(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->pers.teamState.flagrecovery; - nScore += player->client->pers.teamState.fragcarrier; - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -qboolean CalculateTeamRedShirt(gentity_t *ent) -{ - int i = 0, nBestPlayer = -1, nScore = 0, nHighestScore = 0, - team = ent->client->ps.persistant[PERS_TEAM]; - gentity_t *player = NULL; - - for (i = 0; i < g_maxclients.integer; i++) - { - nScore = 0; - player = g_entities + i; - if (!player->inuse || (player->client->ps.persistant[PERS_TEAM] != team)) - continue; - nScore = player->client->ps.persistant[PERS_KILLED]; - nScore -= player->client->pers.teamState.suicides; // suicides don't count, you big cheater. - if (nScore > nHighestScore) - { - nHighestScore = nScore; - nBestPlayer = i; - } - } - if (-1 == nBestPlayer) - { - return qfalse; - } - if (nBestPlayer == ent->s.number) - { - return qtrue; - } - return qfalse; -} - -int CalculateTeamAward(gentity_t *ent) -{ - int teamAwards = 0; - - if (CalculateTeamMVP(ent)) - { - teamAwards |= (1<inuse) - continue; - - return qtrue; - } - return qfalse; -} - -void CalculateAwards(gentity_t *ent, char *msg) -{ -#ifdef LOGGING_WEAPONS - char buf1[AWARDS_MSG_LENGTH], buf2[AWARDS_MSG_LENGTH]; - int awardFlags = 0, stuffUsed = 0, kills = 0, streak = 0, teamAwards = 0; - - memset(buf1, 0, AWARDS_MSG_LENGTH); - memset(buf2, 0, AWARDS_MSG_LENGTH); - if (CalculateSharpshooter(ent, &kills)) - { - awardFlags |= (1<= GT_TEAM) - { - teamAwards = CalculateTeamAward(ent); - if (teamAwards) - { - awardFlags |= (1<= MAX_CLIENTS)) - { - return 0; - } - for (i = 0; i < MAX_CLIENTS; i++) - { - if (G_WeaponLogFrags[i][nClient] > nMostDeaths) - { - nMostDeaths = G_WeaponLogFrags[i][nClient]; - } - } - return nMostDeaths; -} - -int GetMaxKillsForClient(int nClient) -{ - int i = 0, nMostKills = 0; - - if ((nClient < 0) || (nClient >= MAX_CLIENTS)) - { - return 0; - } - for (i = 0; i < MAX_CLIENTS; i++) - { - if (G_WeaponLogFrags[nClient][i] > nMostKills) - { - nMostKills = G_WeaponLogFrags[nClient][i]; - } - } - return nMostKills; -} - -int GetFavoriteTargetForClient(int nClient) -{ - int i = 0, nMostKills = 0, nFavoriteTarget = -1; - - if ((nClient < 0) || (nClient >= MAX_CLIENTS)) - { - return 0; - } - for (i = 0; i < MAX_CLIENTS; i++) - { - if (G_WeaponLogFrags[nClient][i] > nMostKills) - { - nMostKills = G_WeaponLogFrags[nClient][i]; - nFavoriteTarget = i; - } - } - return nFavoriteTarget; -} - -int GetWorstEnemyForClient(int nClient) -{ - int i = 0, nMostDeaths = 0, nWorstEnemy = -1; - - if ((nClient < 0) || (nClient >= MAX_CLIENTS)) - { - return 0; - } - for (i = 0; i < MAX_CLIENTS; i++) - { - // If there is a tie for most deaths, we want to choose anybody else - // over the client... I.E. Most deaths should not tie with yourself and - // have yourself show up... - - if ( G_WeaponLogFrags[i][nClient] > nMostDeaths || - (G_WeaponLogFrags[i][nClient]== nMostDeaths && i!=nClient && nMostDeaths!=0) ) - { - nMostDeaths = G_WeaponLogFrags[i][nClient]; - nWorstEnemy = i; - } - } - return nWorstEnemy; -} - -int GetFavoriteWeaponForClient(int nClient) -{ - int i = 0, nMostKills = 0, fav=0, weapon=WP_5; - int killsWithWeapon[WP_NUM_WEAPONS]; - - - // First thing we need to do is cycle through all the MOD types and convert - // number of kills to a single weapon. - //---------------------------------------------------------------- - for (weapon=0; weaponnMostKills) - { - nMostKills = killsWithWeapon[weapon]; - fav = weapon; - } - } - return fav; -} - // kef -- if a client leaves the game, clear out all counters he may have set void QDECL G_ClearClientLog(int client) { diff --git a/game/g_main.c b/game/g_main.c index 5260bac..b08996f 100644 --- a/game/g_main.c +++ b/game/g_main.c @@ -459,7 +459,7 @@ static cvarTable_t gameCvarTable[] = { { &rpg_forceFieldColor, "rpg_forceFieldColor", "0", CVAR_ARCHIVE, 0, qfalse }, { &rpg_allowRemodulation, "rpg_allowRemodulation", "1", CVAR_ARCHIVE, 0, qfalse }, { &rpg_forceFieldFreq, "rpg_forceFieldFreq", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_calcLiftTravelDuration, "rpg_calcLiftTravelDuration", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_calcLiftTravelDuration, "rpg_calcLiftTravelDuration", "1", CVAR_ARCHIVE, 0, qfalse }, { &rpg_liftDurationModifier, "rpg_liftDurationModifier" , "0.5", CVAR_ARCHIVE, 0, qfalse }, { &rpg_altTricorderDelay, "rpg_altTricorderDelay", "1000", CVAR_ARCHIVE, 0, qfalse }, { &rpg_borgMoveThroughFields, "rpg_borgMoveThroughFields", "0", CVAR_ARCHIVE, 0, qfalse }, @@ -605,25 +605,36 @@ void QDECL G_Error( const char *fmt, ... ) { } stringID_table_t WeaponTable[] = { - { ENUM2STRING(WP_2) }, { ENUM2STRING(WP_3) }, { ENUM2STRING(WP_4) }, - { ENUM2STRING(WP_5) }, { ENUM2STRING(WP_6) }, { ENUM2STRING(WP_7) }, - { ENUM2STRING(WP_8) }, { ENUM2STRING(WP_9) }, { ENUM2STRING(WP_10) }, - { ENUM2STRING(WP_11) }, { ENUM2STRING(WP_12) }, { ENUM2STRING(WP_13) }, - { ENUM2STRING(WP_14) }, { ENUM2STRING(WP_15) }, + + { "WP_TRICORDER", WP_2 }, + { "WP_PADD", WP_3 }, + { "WP_COFFEE", WP_4 }, + { "WP_PHASER", WP_5 }, + { "WP_COMPRESSION_RIFLE", WP_6 }, + { "WP_TR116", WP_7 }, + { "WP_GRENADE_LAUNCHER", WP_8 }, + { "WP_QUANTUM_BURST", WP_9 }, + { "WP_DISRUPTOR", WP_10 }, + { "WP_MEDKIT", WP_11 }, + { "WP_VOYAGER_HYPO", WP_12 }, + { "WP_DERMAL_REGEN", WP_13 }, + { "WP_TOOLKIT", WP_14 }, + { "WP_HYPERSPANNER", WP_15 }, + { NULL, -1 } }; @@ -963,17 +974,16 @@ static void G_LoadTimedMessages(void) { } msg->message = strdup(token); - G_Printf("------------------------------------------------>'%s'\n", token); list_add(level.timedMessages, msg, sizeof(timedMessage_s)); } else { + if(token[0] == '}') { + break; + } + G_Printf("G_LoadTimedMessages - invalid token '%s'\n", token); SkipRestOfLine(&textPtr); continue; } - - if(token[0] == '}') { - break; - } } trap_FS_FCloseFile(f); @@ -1734,6 +1744,8 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { G_Printf ("gamename: %s\n", GAMEVERSION); G_Printf ("gamedate: %s\n", __DATE__); + level.overrideCalcLiftTravelDuration = 0; + init_tonextint(qtrue); srand( randomSeed ); diff --git a/game/g_target.c b/game/g_target.c index fba2f80..8e5a9d4 100644 --- a/game/g_target.c +++ b/game/g_target.c @@ -1133,7 +1133,7 @@ static void target_turbolift_endMove ( gentity_t *ent ) } // check for shader remaps - if(rpg_calcLiftTravelDuration.integer) { + if(rpg_calcLiftTravelDuration.integer || level.overrideCalcLiftTravelDuration) { if((ent->truename && otherLift->truename) || (ent->falsename && otherLift->falsename)) { f = level.time * 0.001; AddRemap(ent->targetShaderName, ent->targetShaderName, f); @@ -1403,7 +1403,7 @@ static void target_turbolift_startMove ( gentity_t *ent ) } // check for shader remaps - if(rpg_calcLiftTravelDuration.integer) { + if(rpg_calcLiftTravelDuration.integer || level.overrideCalcLiftTravelDuration) { if(time2 < 0 && ent->truename && otherLift->truename) { f = level.time * 0.001; AddRemap(ent->targetShaderName, ent->truename, f); @@ -1540,7 +1540,7 @@ static void target_turbolift_use( gentity_t *self, gentity_t *other, gentity_t * return; } - trap_SendServerCommand( activator-g_entities, "lift" ); + trap_SendServerCommand( activator-g_entities, va("lift %d", self->health) ); } extern void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName); @@ -1578,6 +1578,7 @@ For the angles, the entity's angle must be aimed at the main set of doors to the "targetShaderName" - lights off shader "falsename" - lights up "truename" - lights down +"override" - if set to 1 overrides rpg_calcLiftTravelDuration -----LUA----- Retrofit: @@ -1676,6 +1677,11 @@ void SP_target_turbolift ( gentity_t *self ) G_SpawnFloat( "wait", "3000", &self->wait ); G_SpawnInt( "waitEnd", "1000", &self->sound1to2 ); + G_SpawnInt("override", "0", &i); + if(i) { + level.overrideCalcLiftTravelDuration = i; + } + if(!self->tmpEntity) trap_SetBrushModel( self, self->model ); self->r.contents = CONTENTS_TRIGGER; // replaces the -1 from trap_SetBrushModel @@ -1852,15 +1858,8 @@ shader remapping: You can remap multiple shaders by separating them with \n. Example: "greenshader" "textures/alert/green1\ntextures/alert/green2" */ -typedef struct { - char *greenShaders[10]; - char *redShaders[10]; - char *yellowShaders[10]; - char *blueShaders[10]; - int numShaders; -} target_alert_Shaders_s; -static target_alert_Shaders_s alertShaders; +target_alert_Shaders_s alertShaders; void target_alert_remapShaders(int target_condition) { float f = 0; diff --git a/ui/ui_sql.c b/ui/ui_sql.c new file mode 100644 index 0000000..95195e3 --- /dev/null +++ b/ui/ui_sql.c @@ -0,0 +1,120 @@ +/********************************************************************** + UI_sql.C + + User interface trigger from within game +**********************************************************************/ + +#include "ui_local.h" + +typedef struct { + menuframework_s menu; + + char *username; + char *password; +} sql_t; + +sql_t s_sql; + +#define ID_QUIT 10 +#define ID_LOGIN 11 + +/* +================= +M_sql_Event +================= +*/ +static void M_sql_Event(void *ptr, int notification) { + int id; + + id = ((menucommon_s*)ptr)->id; + + switch (id) + { + case ID_QUIT: + if(notification == QM_ACTIVATED) { + UI_PopMenu(); + } + break; + case ID_LOGIN: + if(notification == QM_ACTIVATED) { + // do login + } + break; + default: + break; + } +} + +/* +================= +sqlMenu_Key +================= +*/ +sfxHandle_t sqlMenu_Key (int key) +{ + return ( Menu_DefaultKey( &s_sql.menu, key ) ); +} + +extern qhandle_t leftRound; +extern qhandle_t corner_ul_24_60; +extern qhandle_t corner_ll_12_60; + + +/* +================= +M_sqlMenu_Graphics +================= +*/ +static void M_sqlMenu_Graphics (void) +{ + // TODO +} + +/* +=============== +UI_sqlMenu_Cache +=============== +*/ +void UI_sqlMenu_Cache (void) +{ + leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga"); + corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga"); + corner_ll_12_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_12_60.tga"); +} + +/* +=============== +msdMenu_Init +=============== +*/ +void sqlMenu_Init(void) +{ + /*s_sql.menu.nitems = 0; + s_sql.menu.draw = sqlMenu_Draw; + s_sql.menu.key = sqlMenu_Key; + s_sql.menu.wrapAround = qtrue; + s_sql.menu.descX = MENU_DESC_X; + s_sql.menu.descY = MENU_DESC_Y; + s_sql.menu.titleX = MENU_TITLE_X; + s_sql.menu.titleY = MENU_TITLE_Y; + + s_sql.quitmenu.generic.type = MTYPE_BITMAP; + s_sql.quitmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_sql.quitmenu.generic.x = 490; + s_sql.quitmenu.generic.y = 380; + s_sql.quitmenu.generic.name = GRAPHIC_BUTTONLEFT; + s_sql.quitmenu.generic.id = ID_QUIT; + s_sql.quitmenu.generic.callback = M_sql_Event; + s_sql.quitmenu.width = MENU_BUTTON_MED_WIDTH-20; + s_sql.quitmenu.height = PROP_BIG_HEIGHT; + s_sql.quitmenu.color = CT_DKPURPLE1; + s_sql.quitmenu.color2 = CT_LTPURPLE1; + s_sql.quitmenu.textX = MENU_BUTTON_TEXT_X; + s_sql.quitmenu.textY = 12; + s_sql.quitmenu.textEnum = MBT_RETURNMENU; + s_sql.quitmenu.textcolor = CT_BLACK; + s_sql.quitmenu.textcolor2 = CT_WHITE; + s_sql.quitmenu.textStyle = UI_TINYFONT; + + Menu_AddItem( &s_sql.menu, &s_sql.quitmenu );*/ +}