Renamed cgf_sfx_glass, more cleanup

This commit is contained in:
Dino 2023-08-31 22:15:52 -04:00
parent d82009bb81
commit 4242d41213
5 changed files with 177 additions and 51 deletions

112
actionlite/a_team.h Normal file
View file

@ -0,0 +1,112 @@
#include "g_local.h"
#define NOTEAM 0
#define TEAM1 1
#define TEAM2 2
#define TEAM3 3
#define MAX_TEAMS 3
#define TEAM_TOP (MAX_TEAMS+1)
#define WINNER_NONE NOTEAM
#define WINNER_TIE TEAM_TOP
// Pre- and post-trace code for our teamplay anti-stick stuff. If there are
// still "transparent" (SOLID_TRIGGER) players, they need to be set to
// SOLID_BBOX before a trace is performed, then changed back again
// afterwards. PRETRACE() and POSTTRACE() should be called before and after
// traces in all places where combat is taking place (ie "transparent" players
// should be detected), ie shots being traced etc.
// FB 6/1/99: Now crouching players will have their bounding box adjusted here
// too, for better shot areas. (there has to be a better way to do this?)
#define PRETRACE() \
if (transparent_list && (((int)teamplay->value && !lights_camera_action) || jump->value)) \
TransparentListSet(SOLID_BBOX)
#define POSTTRACE() \
if (transparent_list && (((int)teamplay->value && !lights_camera_action) || jump->value)) \
TransparentListSet(SOLID_TRIGGER)
edict_t *SelectTeamplaySpawnPoint (edict_t *);
bool FallingDamageAmnesty (edict_t * targ);
char * TeamName (int team);
void UpdateJoinMenu( void );
void OpenJoinMenu (edict_t *);
void OpenWeaponMenu (edict_t *);
void OpenItemMenu (edict_t * ent);
void OpenItemKitMenu (edict_t * ent);
void JoinTeam (edict_t * ent, int desired_team, int skip_menuclose);
edict_t *FindOverlap (edict_t * ent, edict_t * last_overlap);
int CheckTeamRules (void);
void A_Scoreboard (edict_t * ent);
void Team_f (edict_t * ent);
void AssignSkin (edict_t * ent, const char *s, bool nickChanged);
void TallyEndOfLevelTeamScores (void);
void SetupTeamSpawnPoints ();
int CheckTeamSpawnPoints ();
void GetSpawnPoints ();
void CleanBodies (); // from p_client.c, removes all current dead bodies from map
void LeaveTeam (edict_t *);
int newrand (int top);
void InitTransparentList ();
void AddToTransparentList (edict_t *);
void RemoveFromTransparentList (edict_t *);
bool OnTransparentList( const edict_t *ent );
void PrintTransparentList ();
void CenterPrintAll (const char *msg);
int TeamHasPlayers( int team );
//TNG:Freud - new spawning system
void NS_GetSpawnPoints ();
bool NS_SelectFarTeamplaySpawnPoint (int team, bool teams_assigned[]);
void NS_SetupTeamSpawnPoints ();
int OtherTeam(int teamNum);
typedef struct spawn_distances_s
{
float distance;
edict_t *s;
}
spawn_distances_t;
typedef struct transparent_list_s
{
edict_t *ent;
struct transparent_list_s *next;
}
transparent_list_t;
extern bool team_game_going;
extern bool team_round_going;
extern int lights_camera_action;
extern int holding_on_tie_check;
extern int team_round_countdown;
extern int timewarning;
extern int fragwarning;
extern transparent_list_t *transparent_list;
extern trace_t trace_t_temp;
extern int current_round_length; // For RoundTimeLeft
extern int day_cycle_at;
extern int teamCount;
extern int in_warmup;
extern bool teams_changed;
typedef struct menu_list_weapon
{
int num;
char sound[40];
char name[40];
}
menu_list_weapon;
typedef struct menu_list_item
{
int num;
char sound[40];
char name[40];
}
menu_list_item;

View file

@ -87,7 +87,7 @@ void LaserSightThink(edict_t * self)
viewheight -= 8;
VectorSet(offset, 24, 8, viewheight);
P_ProjectSource(self->owner->client, self->owner->s.origin, offset, forward, right, start);
P_ProjectSource(self, self->owner->s.origin, offset, forward, right, start);
VectorMA(start, 8192, forward, end);
PRETRACE();
@ -105,7 +105,7 @@ void LaserSightThink(edict_t * self)
self->s.modelindex = (tr.surface && (tr.surface->flags & SURF_SKY)) ? level.model_null : level.model_lsight;
gi.linkentity(self);
self->nextthink = level.framenum + 1;
self->nextthink = level.time + 1_ms;
}
void Cmd_New_Reload_f(edict_t * ent)
@ -120,7 +120,7 @@ void Cmd_New_Reload_f(edict_t * ent)
void Cmd_Reload_f(edict_t * ent)
{
//+BD - If the player is dead, don't bother
if (!IS_ALIVE(ent) || !ent->client->weapon)
if (!IS_ALIVE(ent) || !ent->client->pers.weapon)
return;
if (ent->client->weaponstate == WEAPON_BANDAGING ||
@ -139,68 +139,68 @@ void Cmd_Reload_f(edict_t * ent)
//First, grab the current magazine max count...
//Set the weaponstate...
switch(ent->client->weapon->typeNum) {
case M3_NUM:
switch(ent->client->pers.weapon->id) {
case IT_WEAPON_M3:
if (ent->client->shot_rds >= ent->client->shot_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->inventory[ent->client->pers.weapon->ammo] <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
// already in the process of reloading!
if (ent->client->weaponstate == WEAPON_RELOADING &&
(ent->client->shot_rds < (ent->client->shot_max - 1)) &&
!(ent->client->fast_reload) &&
((ent->client->inventory[ent->client->ammo_index] - 1) > 0)) {
((ent->client->pers.weapon->ammo - 1) > 0)) {
// don't let them start fast reloading until far enough into the firing sequence
// this gives them a chance to break off from reloading to fire the weapon - zucc
if (ent->client->ps.gunframe >= 48) {
ent->client->fast_reload = 1;
(ent->client->inventory[ent->client->ammo_index])--;
(ent->client->pers.weapon->ammo)--;
} else {
ent->client->reload_attempts++;
}
}
break;
case HC_NUM:
case IT_WEAPON_HANDCANNON:
if (ent->client->cannon_rds >= ent->client->cannon_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->inventory[ent->client->pers.weapon->ammo] <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
if(hc_single->value)
{
if(ent->client->pers.hc_mode || ent->client->cannon_rds == 1)
{ if(ent->client->inventory[ent->client->ammo_index] < 1)
{ if(ent->client->pers.weapon->ammo < 1)
return;
}
else if(ent->client->inventory[ent->client->ammo_index] < 2)
else if(ent->client->pers.weapon->ammo < 2)
return;
}
else if (ent->client->inventory[ent->client->ammo_index] < 2)
else if (ent->client->pers.weapon->ammo < 2)
return;
break;
case SNIPER_NUM:
case IT_WEAPON_SNIPER:
if (ent->client->sniper_rds >= ent->client->sniper_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->inventory[ent->client->pers.weapon->ammo] <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
// already in the process of reloading!
if (ent->client->weaponstate == WEAPON_RELOADING
&& (ent->client->sniper_rds < (ent->client->sniper_max - 1))
&& !(ent->client->fast_reload)
&& ((ent->client->inventory[ent->client->ammo_index] - 1) > 0)) {
&& ((ent->client->pers.weapon->ammo - 1) > 0)) {
// don't let them start fast reloading until far enough into the firing sequence
// this gives them a chance to break off from reloading to fire the weapon - zucc
if (ent->client->ps.gunframe >= 72) {
ent->client->fast_reload = 1;
(ent->client->inventory[ent->client->ammo_index])--;
(ent->client->inventory[ent->client->pers.weapon->ammo])--;
} else {
ent->client->reload_attempts++;
}
@ -209,16 +209,16 @@ void Cmd_Reload_f(edict_t * ent)
if (ent->client->weapon)
ent->client->ps.gunindex = gi.modelindex(ent->client->weapon->view_model);
break;
case DUAL_NUM:
case IT_WEAPON_DUALMK23:
if (ent->client->dual_rds == ent->client->dual_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->pers.weapon->ammo <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
//TempFile change to pistol, then reload
if (ent->client->inventory[ent->client->ammo_index] == 1) {
if (ent->client->pers.weapon->ammo == 1) {
gitem_t *it;
it = GET_ITEM(MK23_NUM);
@ -228,27 +228,27 @@ void Cmd_Reload_f(edict_t * ent)
}
break;
case MP5_NUM:
case IT_WEAPON_MP5:
if (ent->client->mp5_rds == ent->client->mp5_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->pers.weapon->ammo <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
break;
case M4_NUM:
case IT_WEAPON_M4:
if (ent->client->m4_rds == ent->client->m4_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->pers.weapon->ammo <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
break;
case MK23_NUM:
case IT_WEAPON_MK23:
if (ent->client->mk23_rds == ent->client->mk23_max)
return;
if(ent->client->inventory[ent->client->ammo_index] <= 0) {
gi.cprintf(ent, PRINT_HIGH, "Out of ammo\n");
if(ent->client->pers.weapon->ammo <= 0) {
gi.LocClient_Print(ent, PRINT_HIGH, "Out of ammo\n");
return;
}
break;
@ -449,9 +449,6 @@ void Cmd_Give_f(edict_t *ent)
if (give_all || Q_strcasecmp(name, "ammo") == 0)
{
if (give_all)
SpawnAndGiveItem(ent, IT_ITEM_PACK);
for (i = 0; i < IT_TOTAL; i++)
{
it = itemlist + i;
@ -467,18 +464,13 @@ void Cmd_Give_f(edict_t *ent)
if (give_all || Q_strcasecmp(name, "armor") == 0)
{
ent->client->pers.inventory[IT_ARMOR_JACKET] = 0;
ent->client->pers.inventory[IT_ARMOR_COMBAT] = 0;
ent->client->pers.inventory[IT_ARMOR_BODY] = GetItemByIndex(IT_ARMOR_BODY)->armor_info->max_count;
return;
if (!give_all)
return;
}
if (give_all)
{
SpawnAndGiveItem(ent, IT_ITEM_POWER_SHIELD);
if (!give_all)
return;
}

View file

@ -7,7 +7,7 @@
#include "bg_local.h"
// the "gameversion" client command will print this plus compile date
constexpr const char *GAMEVERSION = "baseq2";
constexpr const char *GAMEVERSION = "action";
//==================================================================
@ -1935,6 +1935,14 @@ extern cvar_t *allow_hoarding;
extern cvar_t *item_respawn;
extern cvar_t *weapon_respawn;
extern cvar_t *ammo_respawn;
extern cvar_t *hc_single;
extern cvar_t *use_punch;
extern cvar_t *radio_max;
extern cvar_t *radio_time;
extern cvar_t *radio_ban;
extern cvar_t *radio_repeat;
//SLIC2
extern cvar_t *radio_repeat_time;
void LaserSightThink (edict_t * self);
void SP_LaserSight (edict_t * self, gitem_t * item);

View file

@ -151,14 +151,21 @@ cvar_t *ai_movement_disabled;
// Action Add
//======================================================================
cvar_t *allitem;
cvar_t *allweapon;
cvar_t *unique_items;
cvar_t *unique_weapons;
cvar_t *allow_hoarding;
cvar_t *item_respawn;
cvar_t *weapon_respawn;
cvar_t *ammo_respawn;
cvar_t *allitem;
cvar_t *allweapon;
cvar_t *unique_items;
cvar_t *unique_weapons;
cvar_t *allow_hoarding;
cvar_t *item_respawn;
cvar_t *weapon_respawn;
cvar_t *ammo_respawn;
cvar_t *hc_single;
cvar_t *use_punch;
cvar_t *radio_max;
cvar_t *radio_time;
cvar_t *radio_ban;
cvar_t *radio_repeat;
cvar_t *radio_repeat_time;
//======================================================================
// Action Add End
@ -392,6 +399,13 @@ void InitGame()
item_respawn = gi.cvar("item_respawn", "59", CVAR_NOFLAGS);
weapon_respawn = gi.cvar("weapon_respawn", "74", CVAR_NOFLAGS);
ammo_respawn = gi.cvar("ammo_respawn", "30", CVAR_NOFLAGS);
hc_single = gi.cvar("hc_single", "0", CVAR_NOFLAGS);
use_punch = gi.cvar("use_punch", "1", CVAR_NOFLAGS);
radio_max = gi.cvar("radio_max", "3", CVAR_NOFLAGS);
radio_time = gi.cvar("radio_time", "2", CVAR_NOFLAGS);
radio_ban = gi.cvar("radio_ban", "15", CVAR_NOFLAGS);
radio_repeat = gi.cvar("radio_repeat", "2", CVAR_NOFLAGS);
radio_repeat_time = gi.cvar("radio_repeat_time", "1", CVAR_NOFLAGS);
//======================================================================
// Action Add