COmmit what we have so far. CTF is still broken
This commit is contained in:
parent
26f00aaf53
commit
293e360333
56
Makefile
56
Makefile
|
@ -162,7 +162,7 @@ build/ctf/%.o: %.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
|
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
|
||||||
|
|
||||||
release/ctf/game.so : CFLAGS += -fPIC
|
release/ctf/game.so : CFLAGS += -fPIC -DCTF
|
||||||
release/ctf/game.so : LDFLAGS += -shared
|
release/ctf/game.so : LDFLAGS += -shared
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
@ -274,32 +274,32 @@ COMMON_OBJS_ := \
|
||||||
|
|
||||||
# Used by the ctf game
|
# Used by the ctf game
|
||||||
CTF_OBJS_ = \
|
CTF_OBJS_ = \
|
||||||
src/game/ctf/g_ai.o \
|
src/game/baseq2/g_ai.o \
|
||||||
src/game/ctf/g_chase.o \
|
src/game/baseq2/g_chase.o \
|
||||||
src/game/ctf/g_cmds.o \
|
src/game/baseq2/g_cmds.o \
|
||||||
src/game/ctf/g_combat.o \
|
src/game/baseq2/g_combat.o \
|
||||||
src/game/ctf/g_ctf.o \
|
src/game/baseq2/g_ctf.o \
|
||||||
src/game/ctf/g_func.o \
|
src/game/baseq2/g_func.o \
|
||||||
src/game/ctf/g_items.o \
|
src/game/baseq2/g_items.o \
|
||||||
src/game/ctf/g_main.o \
|
src/game/baseq2/g_main.o \
|
||||||
src/game/ctf/g_misc.o \
|
src/game/baseq2/g_misc.o \
|
||||||
src/game/ctf/g_monster.o \
|
src/game/baseq2/g_monster.o \
|
||||||
src/game/ctf/g_phys.o \
|
src/game/baseq2/g_phys.o \
|
||||||
src/game/ctf/g_save.o \
|
src/game/baseq2/g_spawn.o \
|
||||||
src/game/ctf/g_spawn.o \
|
src/game/baseq2/g_svcmds.o \
|
||||||
src/game/ctf/g_svcmds.o \
|
src/game/baseq2/g_target.o \
|
||||||
src/game/ctf/g_target.o \
|
src/game/baseq2/g_trigger.o \
|
||||||
src/game/ctf/g_trigger.o \
|
src/game/baseq2/g_utils.o \
|
||||||
src/game/ctf/g_utils.o \
|
src/game/baseq2/g_weapon.o \
|
||||||
src/game/ctf/g_weapon.o \
|
src/game/baseq2/m_move.o \
|
||||||
src/game/ctf/m_move.o \
|
src/game/baseq2/p_client.o \
|
||||||
src/game/ctf/p_client.o \
|
src/game/baseq2/p_hud.o \
|
||||||
src/game/ctf/p_hud.o \
|
src/game/baseq2/p_menu.o \
|
||||||
src/game/ctf/p_menu.o \
|
src/game/baseq2/p_trail.o \
|
||||||
src/game/ctf/p_trail.o \
|
src/game/baseq2/p_view.o \
|
||||||
src/game/ctf/p_view.o \
|
src/game/baseq2/p_weapon.o \
|
||||||
src/game/ctf/p_weapon.o \
|
src/game/baseq2/q_shared.o \
|
||||||
src/game/ctf/q_shared.o
|
src/game/baseq2/savegame/savegame.o
|
||||||
|
|
||||||
# Used by the client and the server
|
# Used by the client and the server
|
||||||
GAME_ABI_OBJS_ := \
|
GAME_ABI_OBJS_ := \
|
||||||
|
@ -472,7 +472,7 @@ release/ref_gl.so : $(OPENGL_OBJS) $(OPENGL_GAME_ABI_OBJS) \
|
||||||
@$(CC) $(LDFLAGS) -o $@ $(OPENGL_OBJS) $(OPENGL_GAME_ABI_OBJS) \
|
@$(CC) $(LDFLAGS) -o $@ $(OPENGL_OBJS) $(OPENGL_GAME_ABI_OBJS) \
|
||||||
$(UNIX_OPENGL_OBJS) $(SDL_OPENGL_OBJS)
|
$(UNIX_OPENGL_OBJS) $(SDL_OPENGL_OBJS)
|
||||||
|
|
||||||
# release/bsaeq2/game.so
|
# release/baseq2/game.so
|
||||||
release/baseq2/game.so : $(BASEQ2_OBJS)
|
release/baseq2/game.so : $(BASEQ2_OBJS)
|
||||||
@echo '===> LD $@'
|
@echo '===> LD $@'
|
||||||
@$(CC) $(LDFLAGS) -o $@ $(BASEQ2_OBJS)
|
@$(CC) $(LDFLAGS) -o $@ $(BASEQ2_OBJS)
|
||||||
|
|
|
@ -1111,14 +1111,60 @@ Cmd_Wave_f(edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean
|
||||||
|
CheckFlood(edict_t *ent)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
gclient_t *cl;
|
||||||
|
|
||||||
|
if (!ent)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flood_msgs->value)
|
||||||
|
{
|
||||||
|
cl = ent->client;
|
||||||
|
|
||||||
|
if (level.time < cl->flood_locktill)
|
||||||
|
{
|
||||||
|
gi.cprintf(ent, PRINT_HIGH, "You can't talk for %d more seconds\n",
|
||||||
|
(int)(cl->flood_locktill - level.time));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = cl->flood_whenhead - flood_msgs->value + 1;
|
||||||
|
|
||||||
|
if (i < 0)
|
||||||
|
{
|
||||||
|
i = (sizeof(cl->flood_when) / sizeof(cl->flood_when[0])) + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cl->flood_when[i] &&
|
||||||
|
(level.time - cl->flood_when[i] < flood_persecond->value))
|
||||||
|
{
|
||||||
|
cl->flood_locktill = level.time + flood_waitdelay->value;
|
||||||
|
gi.cprintf(ent, PRINT_CHAT,
|
||||||
|
"Flood protection: You can't talk for %d seconds.\n",
|
||||||
|
(int)flood_waitdelay->value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl->flood_whenhead = (cl->flood_whenhead + 1) %
|
||||||
|
(sizeof(cl->flood_when) / sizeof(cl->flood_when[0]));
|
||||||
|
cl->flood_when[cl->flood_whenhead] = level.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
||||||
{
|
{
|
||||||
int i, j;
|
int j;
|
||||||
edict_t *other;
|
edict_t *other;
|
||||||
char *p;
|
char *p;
|
||||||
char text[2048];
|
char text[2048];
|
||||||
gclient_t *cl;
|
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
|
@ -1171,37 +1217,9 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
||||||
|
|
||||||
strcat(text, "\n");
|
strcat(text, "\n");
|
||||||
|
|
||||||
if (flood_msgs->value)
|
if (CheckFlood(ent))
|
||||||
{
|
{
|
||||||
cl = ent->client;
|
return;
|
||||||
|
|
||||||
if (level.time < cl->flood_locktill)
|
|
||||||
{
|
|
||||||
gi.cprintf(ent, PRINT_HIGH, "You can't talk for %d more seconds\n",
|
|
||||||
(int)(cl->flood_locktill - level.time));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = cl->flood_whenhead - flood_msgs->value + 1;
|
|
||||||
|
|
||||||
if (i < 0)
|
|
||||||
{
|
|
||||||
i = (sizeof(cl->flood_when) / sizeof(cl->flood_when[0])) + i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cl->flood_when[i] &&
|
|
||||||
(level.time - cl->flood_when[i] < flood_persecond->value))
|
|
||||||
{
|
|
||||||
cl->flood_locktill = level.time + flood_waitdelay->value;
|
|
||||||
gi.cprintf(ent, PRINT_CHAT,
|
|
||||||
"Flood protection: You can't talk for %d seconds.\n",
|
|
||||||
(int)flood_waitdelay->value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cl->flood_whenhead = (cl->flood_whenhead + 1) %
|
|
||||||
(sizeof(cl->flood_when) / sizeof(cl->flood_when[0]));
|
|
||||||
cl->flood_when[cl->flood_whenhead] = level.time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dedicated->value)
|
if (dedicated->value)
|
||||||
|
@ -1308,11 +1326,19 @@ ClientCommand(edict_t *ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CTF
|
||||||
|
if ((Q_stricmp(cmd, "say_team") == 0) || (Q_stricmp(cmd, "steam") == 0))
|
||||||
|
{
|
||||||
|
CTFSay_Team(ent, gi.args());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (Q_stricmp(cmd, "say_team") == 0)
|
if (Q_stricmp(cmd, "say_team") == 0)
|
||||||
{
|
{
|
||||||
Cmd_Say_f(ent, true, false);
|
Cmd_Say_f(ent, true, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Q_stricmp(cmd, "score") == 0)
|
if (Q_stricmp(cmd, "score") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -523,6 +523,7 @@ CheckTeamDamage (edict_t *targ, edict_t *attacker)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -309,6 +309,10 @@ typedef struct
|
||||||
char mapname[MAX_QPATH]; /* the server name (base1, etc) */
|
char mapname[MAX_QPATH]; /* the server name (base1, etc) */
|
||||||
char nextmap[MAX_QPATH]; /* go here when fraglimit is hit */
|
char nextmap[MAX_QPATH]; /* go here when fraglimit is hit */
|
||||||
|
|
||||||
|
#ifdef CTF
|
||||||
|
char forcemap[MAX_QPATH]; /* go here */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* intermission state */
|
/* intermission state */
|
||||||
float intermissiontime; /* time the intermission was started */
|
float intermissiontime; /* time the intermission was started */
|
||||||
char *changemap;
|
char *changemap;
|
||||||
|
@ -490,6 +494,9 @@ extern int snd_fry;
|
||||||
#define MOD_TRIGGER_HURT 31
|
#define MOD_TRIGGER_HURT 31
|
||||||
#define MOD_HIT 32
|
#define MOD_HIT 32
|
||||||
#define MOD_TARGET_BLASTER 33
|
#define MOD_TARGET_BLASTER 33
|
||||||
|
#ifdef CTF
|
||||||
|
#define MOD_GRAPPLE 34
|
||||||
|
#endif
|
||||||
#define MOD_FRIENDLY_FIRE 0x8000000
|
#define MOD_FRIENDLY_FIRE 0x8000000
|
||||||
|
|
||||||
extern int meansOfDeath;
|
extern int meansOfDeath;
|
||||||
|
@ -592,6 +599,9 @@ extern field_t fields[];
|
||||||
extern gitem_t itemlist[];
|
extern gitem_t itemlist[];
|
||||||
|
|
||||||
/* g_cmds.c */
|
/* g_cmds.c */
|
||||||
|
#ifdef CTF
|
||||||
|
qboolean CheckFlood(edict_t *ent);
|
||||||
|
#endif
|
||||||
void Cmd_Help_f(edict_t *ent);
|
void Cmd_Help_f(edict_t *ent);
|
||||||
void Cmd_Score_f(edict_t *ent);
|
void Cmd_Score_f(edict_t *ent);
|
||||||
|
|
||||||
|
@ -643,6 +653,9 @@ void vectoangles(vec3_t vec, vec3_t angles);
|
||||||
/* g_combat.c */
|
/* g_combat.c */
|
||||||
qboolean OnSameTeam(edict_t *ent1, edict_t *ent2);
|
qboolean OnSameTeam(edict_t *ent1, edict_t *ent2);
|
||||||
qboolean CanDamage(edict_t *targ, edict_t *inflictor);
|
qboolean CanDamage(edict_t *targ, edict_t *inflictor);
|
||||||
|
#ifdef CTF
|
||||||
|
qboolean CheckTeamDamage (edict_t *targ, edict_t *attacker);
|
||||||
|
#endif
|
||||||
void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker,
|
void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker,
|
||||||
vec3_t dir, vec3_t point, vec3_t normal, int damage,
|
vec3_t dir, vec3_t point, vec3_t normal, int damage,
|
||||||
int knockback, int dflags, int mod);
|
int knockback, int dflags, int mod);
|
||||||
|
@ -752,6 +765,9 @@ void InitClientPersistant(gclient_t *client);
|
||||||
void InitClientResp(gclient_t *client);
|
void InitClientResp(gclient_t *client);
|
||||||
void InitBodyQue(void);
|
void InitBodyQue(void);
|
||||||
void ClientBeginServerFrame(edict_t *ent);
|
void ClientBeginServerFrame(edict_t *ent);
|
||||||
|
#ifdef CTF
|
||||||
|
void ClientUserinfoChanged (edict_t *ent, char *userinfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* g_player.c */
|
/* g_player.c */
|
||||||
void player_pain(edict_t *self, edict_t *other, float kick, int damage);
|
void player_pain(edict_t *self, edict_t *other, float kick, int damage);
|
||||||
|
@ -775,6 +791,13 @@ void DeathmatchScoreboardMessage(edict_t *client, edict_t *killer);
|
||||||
|
|
||||||
/* g_pweapon.c */
|
/* g_pweapon.c */
|
||||||
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
||||||
|
#ifdef CTF
|
||||||
|
void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance,
|
||||||
|
vec3_t forward, vec3_t right, vec3_t result);
|
||||||
|
void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST,
|
||||||
|
int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST,
|
||||||
|
int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* m_move.c */
|
/* m_move.c */
|
||||||
qboolean M_CheckBottom(edict_t *ent);
|
qboolean M_CheckBottom(edict_t *ent);
|
||||||
|
@ -788,6 +811,9 @@ void G_RunEntity(edict_t *ent);
|
||||||
/* g_main.c */
|
/* g_main.c */
|
||||||
void SaveClientData(void);
|
void SaveClientData(void);
|
||||||
void FetchClientEntData(edict_t *ent);
|
void FetchClientEntData(edict_t *ent);
|
||||||
|
#ifdef CTF
|
||||||
|
void EndDMLevel (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* g_chase.c */
|
/* g_chase.c */
|
||||||
void UpdateChaseCam(edict_t *ent);
|
void UpdateChaseCam(edict_t *ent);
|
||||||
|
@ -966,8 +992,6 @@ struct gclient_s
|
||||||
float ctf_regentime; /* regen tech */
|
float ctf_regentime; /* regen tech */
|
||||||
float ctf_techsndtime;
|
float ctf_techsndtime;
|
||||||
float ctf_lasttechmsg;
|
float ctf_lasttechmsg;
|
||||||
edict_t *chase_target;
|
|
||||||
qboolean update_chase;
|
|
||||||
float menutime; /* time to update menu */
|
float menutime; /* time to update menu */
|
||||||
qboolean menudirty;
|
qboolean menudirty;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -207,7 +207,9 @@ spawn_t spawns[] = {
|
||||||
{"target_crosslevel_target", SP_target_crosslevel_target},
|
{"target_crosslevel_target", SP_target_crosslevel_target},
|
||||||
{"target_laser", SP_target_laser},
|
{"target_laser", SP_target_laser},
|
||||||
{"target_help", SP_target_help},
|
{"target_help", SP_target_help},
|
||||||
|
#ifndef CTF
|
||||||
{"target_actor", SP_target_actor},
|
{"target_actor", SP_target_actor},
|
||||||
|
#endif
|
||||||
{"target_lightramp", SP_target_lightramp},
|
{"target_lightramp", SP_target_lightramp},
|
||||||
{"target_earthquake", SP_target_earthquake},
|
{"target_earthquake", SP_target_earthquake},
|
||||||
{"target_character", SP_target_character},
|
{"target_character", SP_target_character},
|
||||||
|
@ -232,11 +234,15 @@ spawn_t spawns[] = {
|
||||||
{"misc_ctf_small_banner", SP_misc_ctf_small_banner},
|
{"misc_ctf_small_banner", SP_misc_ctf_small_banner},
|
||||||
#endif
|
#endif
|
||||||
{"misc_satellite_dish", SP_misc_satellite_dish},
|
{"misc_satellite_dish", SP_misc_satellite_dish},
|
||||||
|
#ifndef CTF
|
||||||
{"misc_actor", SP_misc_actor},
|
{"misc_actor", SP_misc_actor},
|
||||||
|
#endif
|
||||||
{"misc_gib_arm", SP_misc_gib_arm},
|
{"misc_gib_arm", SP_misc_gib_arm},
|
||||||
{"misc_gib_leg", SP_misc_gib_leg},
|
{"misc_gib_leg", SP_misc_gib_leg},
|
||||||
{"misc_gib_head", SP_misc_gib_head},
|
{"misc_gib_head", SP_misc_gib_head},
|
||||||
|
#ifndef CTF
|
||||||
{"misc_insane", SP_misc_insane},
|
{"misc_insane", SP_misc_insane},
|
||||||
|
#endif
|
||||||
{"misc_deadsoldier", SP_misc_deadsoldier},
|
{"misc_deadsoldier", SP_misc_deadsoldier},
|
||||||
{"misc_viper", SP_misc_viper},
|
{"misc_viper", SP_misc_viper},
|
||||||
{"misc_viper_bomb", SP_misc_viper_bomb},
|
{"misc_viper_bomb", SP_misc_viper_bomb},
|
||||||
|
|
|
@ -602,7 +602,9 @@ extern void berserk_fidget ( edict_t * self ) ;
|
||||||
extern void berserk_stand ( edict_t * self ) ;
|
extern void berserk_stand ( edict_t * self ) ;
|
||||||
extern void berserk_search ( edict_t * self ) ;
|
extern void berserk_search ( edict_t * self ) ;
|
||||||
extern void berserk_sight ( edict_t * self , edict_t * other ) ;
|
extern void berserk_sight ( edict_t * self , edict_t * other ) ;
|
||||||
|
#ifndef CTF
|
||||||
extern void SP_target_actor ( edict_t * self ) ;
|
extern void SP_target_actor ( edict_t * self ) ;
|
||||||
|
#endif
|
||||||
extern void target_actor_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
|
extern void target_actor_touch ( edict_t * self , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
|
||||||
extern void SP_misc_actor ( edict_t * self ) ;
|
extern void SP_misc_actor ( edict_t * self ) ;
|
||||||
extern void actor_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
|
extern void actor_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* =======================================================================
|
* =======================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef CTF
|
||||||
|
|
||||||
{"ReadLevel", (byte *)ReadLevel},
|
{"ReadLevel", (byte *)ReadLevel},
|
||||||
{"ReadLevelLocals", (byte *)ReadLevelLocals},
|
{"ReadLevelLocals", (byte *)ReadLevelLocals},
|
||||||
{"ReadEdict", (byte *)ReadEdict},
|
{"ReadEdict", (byte *)ReadEdict},
|
||||||
|
@ -1053,4 +1055,8 @@
|
||||||
{"ai_stand", (byte *)ai_stand},
|
{"ai_stand", (byte *)ai_stand},
|
||||||
{"ai_move", (byte *)ai_move},
|
{"ai_move", (byte *)ai_move},
|
||||||
{"AI_SetSightClient", (byte *)AI_SetSightClient},
|
{"AI_SetSightClient", (byte *)AI_SetSightClient},
|
||||||
|
|
||||||
|
#endif /* CTF */
|
||||||
|
|
||||||
{0, 0}
|
{0, 0}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* =======================================================================
|
* =======================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef CTF
|
||||||
|
|
||||||
{"tank_move_death", &tank_move_death},
|
{"tank_move_death", &tank_move_death},
|
||||||
{"tank_move_attack_chain", &tank_move_attack_chain},
|
{"tank_move_attack_chain", &tank_move_attack_chain},
|
||||||
{"tank_move_attack_post_rocket", &tank_move_attack_post_rocket},
|
{"tank_move_attack_post_rocket", &tank_move_attack_post_rocket},
|
||||||
|
@ -311,4 +313,7 @@
|
||||||
{"actor_move_run", &actor_move_run},
|
{"actor_move_run", &actor_move_run},
|
||||||
{"actor_move_walk", &actor_move_walk},
|
{"actor_move_walk", &actor_move_walk},
|
||||||
{"actor_move_stand", &actor_move_stand},
|
{"actor_move_stand", &actor_move_stand},
|
||||||
|
|
||||||
|
#endif /* CTF */
|
||||||
|
|
||||||
{0, 0}
|
{0, 0}
|
||||||
|
|
1070
src/game/ctf/g_ai.c
1070
src/game/ctf/g_ai.c
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,26 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
*
|
||||||
This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
|
void
|
||||||
void UpdateChaseCam(edict_t *ent)
|
UpdateChaseCam(edict_t *ent)
|
||||||
{
|
{
|
||||||
vec3_t o, ownerv, goal;
|
vec3_t o, ownerv, goal;
|
||||||
edict_t *targ;
|
edict_t *targ;
|
||||||
|
@ -30,8 +30,9 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
vec3_t oldgoal;
|
vec3_t oldgoal;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
|
|
||||||
// is our chase target gone?
|
/* is our chase target gone? */
|
||||||
if (!ent->client->chase_target->inuse) {
|
if (!ent->client->chase_target->inuse)
|
||||||
|
{
|
||||||
ent->client->chase_target = NULL;
|
ent->client->chase_target = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -44,18 +45,26 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
ownerv[2] += targ->viewheight;
|
ownerv[2] += targ->viewheight;
|
||||||
|
|
||||||
VectorCopy(targ->client->v_angle, angles);
|
VectorCopy(targ->client->v_angle, angles);
|
||||||
|
|
||||||
if (angles[PITCH] > 56)
|
if (angles[PITCH] > 56)
|
||||||
|
{
|
||||||
angles[PITCH] = 56;
|
angles[PITCH] = 56;
|
||||||
AngleVectors (angles, forward, right, NULL);
|
}
|
||||||
|
|
||||||
|
AngleVectors(angles, forward, right, NULL);
|
||||||
VectorNormalize(forward);
|
VectorNormalize(forward);
|
||||||
VectorMA(ownerv, -30, forward, o);
|
VectorMA(ownerv, -30, forward, o);
|
||||||
|
|
||||||
if (o[2] < targ->s.origin[2] + 20)
|
if (o[2] < targ->s.origin[2] + 20)
|
||||||
|
{
|
||||||
o[2] = targ->s.origin[2] + 20;
|
o[2] = targ->s.origin[2] + 20;
|
||||||
|
}
|
||||||
|
|
||||||
// jump animation lifts
|
/* jump animation lifts */
|
||||||
if (!targ->groundentity)
|
if (!targ->groundentity)
|
||||||
|
{
|
||||||
o[2] += 16;
|
o[2] += 16;
|
||||||
|
}
|
||||||
|
|
||||||
trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
trace = gi.trace(ownerv, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
||||||
|
|
||||||
|
@ -63,11 +72,13 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
|
|
||||||
VectorMA(goal, 2, forward, goal);
|
VectorMA(goal, 2, forward, goal);
|
||||||
|
|
||||||
// pad for floors and ceilings
|
/* pad for floors and ceilings */
|
||||||
VectorCopy(goal, o);
|
VectorCopy(goal, o);
|
||||||
o[2] += 6;
|
o[2] += 6;
|
||||||
trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
||||||
if (trace.fraction < 1) {
|
|
||||||
|
if (trace.fraction < 1)
|
||||||
|
{
|
||||||
VectorCopy(trace.endpos, goal);
|
VectorCopy(trace.endpos, goal);
|
||||||
goal[2] -= 6;
|
goal[2] -= 6;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +86,9 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
VectorCopy(goal, o);
|
VectorCopy(goal, o);
|
||||||
o[2] -= 6;
|
o[2] -= 6;
|
||||||
trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
trace = gi.trace(goal, vec3_origin, vec3_origin, o, targ, MASK_SOLID);
|
||||||
if (trace.fraction < 1) {
|
|
||||||
|
if (trace.fraction < 1)
|
||||||
|
{
|
||||||
VectorCopy(trace.endpos, goal);
|
VectorCopy(trace.endpos, goal);
|
||||||
goal[2] += 6;
|
goal[2] += 6;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +96,12 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
ent->client->ps.pmove.pm_type = PM_FREEZE;
|
ent->client->ps.pmove.pm_type = PM_FREEZE;
|
||||||
|
|
||||||
VectorCopy(goal, ent->s.origin);
|
VectorCopy(goal, ent->s.origin);
|
||||||
for (i=0 ; i<3 ; i++)
|
|
||||||
ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]);
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
ent->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(
|
||||||
|
targ->client->v_angle[i] - ent->client->resp.cmd_angles[i]);
|
||||||
|
}
|
||||||
|
|
||||||
VectorCopy(targ->client->v_angle, ent->client->ps.viewangles);
|
VectorCopy(targ->client->v_angle, ent->client->ps.viewangles);
|
||||||
VectorCopy(targ->client->v_angle, ent->client->v_angle);
|
VectorCopy(targ->client->v_angle, ent->client->v_angle);
|
||||||
|
@ -94,63 +111,95 @@ void UpdateChaseCam(edict_t *ent)
|
||||||
gi.linkentity(ent);
|
gi.linkentity(ent);
|
||||||
|
|
||||||
if ((!ent->client->showscores && !ent->client->menu &&
|
if ((!ent->client->showscores && !ent->client->menu &&
|
||||||
!ent->client->showinventory && !ent->client->showhelp &&
|
!ent->client->showinventory && !ent->client->showhelp &&
|
||||||
!(level.framenum & 31)) || ent->client->update_chase) {
|
!(level.framenum & 31)) || ent->client->update_chase)
|
||||||
|
{
|
||||||
char s[1024];
|
char s[1024];
|
||||||
|
|
||||||
ent->client->update_chase = false;
|
ent->client->update_chase = false;
|
||||||
sprintf(s, "xv 0 yb -68 string2 \"Chasing %s\"",
|
sprintf(s, "xv 0 yb -68 string2 \"Chasing %s\"",
|
||||||
targ->client->pers.netname);
|
targ->client->pers.netname);
|
||||||
gi.WriteByte (svc_layout);
|
gi.WriteByte(svc_layout);
|
||||||
gi.WriteString (s);
|
gi.WriteString(s);
|
||||||
gi.unicast(ent, false);
|
gi.unicast(ent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChaseNext(edict_t *ent)
|
void
|
||||||
|
ChaseNext(edict_t *ent)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
if (!ent->client->chase_target)
|
if (!ent->client->chase_target)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
i = ent->client->chase_target - g_edicts;
|
i = ent->client->chase_target - g_edicts;
|
||||||
do {
|
|
||||||
|
do
|
||||||
|
{
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i > maxclients->value)
|
if (i > maxclients->value)
|
||||||
|
{
|
||||||
i = 1;
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
e = g_edicts + i;
|
e = g_edicts + i;
|
||||||
|
|
||||||
if (!e->inuse)
|
if (!e->inuse)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (e->solid != SOLID_NOT)
|
if (e->solid != SOLID_NOT)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
} while (e != ent->client->chase_target);
|
}
|
||||||
|
}
|
||||||
|
while (e != ent->client->chase_target);
|
||||||
|
|
||||||
ent->client->chase_target = e;
|
ent->client->chase_target = e;
|
||||||
ent->client->update_chase = true;
|
ent->client->update_chase = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChasePrev(edict_t *ent)
|
void
|
||||||
|
ChasePrev(edict_t *ent)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
if (!ent->client->chase_target)
|
if (!ent->client->chase_target)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
i = ent->client->chase_target - g_edicts;
|
i = ent->client->chase_target - g_edicts;
|
||||||
do {
|
|
||||||
|
do
|
||||||
|
{
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
|
{
|
||||||
i = maxclients->value;
|
i = maxclients->value;
|
||||||
|
}
|
||||||
|
|
||||||
e = g_edicts + i;
|
e = g_edicts + i;
|
||||||
|
|
||||||
if (!e->inuse)
|
if (!e->inuse)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (e->solid != SOLID_NOT)
|
if (e->solid != SOLID_NOT)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
} while (e != ent->client->chase_target);
|
}
|
||||||
|
}
|
||||||
|
while (e != ent->client->chase_target);
|
||||||
|
|
||||||
ent->client->chase_target = e;
|
ent->client->chase_target = e;
|
||||||
ent->client->update_chase = true;
|
ent->client->update_chase = true;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue