mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
game: Add ctf to default build
This commit is contained in:
parent
bea1d13588
commit
17f223eada
37 changed files with 522 additions and 4088 deletions
96
Makefile
96
Makefile
|
@ -377,12 +377,12 @@ endif
|
|||
# ----------
|
||||
|
||||
# Phony targets
|
||||
.PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk ref_gl4 rogue
|
||||
.PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk ref_gl4 rogue ctf
|
||||
|
||||
# ----------
|
||||
|
||||
# Builds everything
|
||||
all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk ref_gl4 rogue
|
||||
all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft ref_vk ref_gl4 rogue ctf
|
||||
|
||||
# ----------
|
||||
|
||||
|
@ -1561,3 +1561,95 @@ release/rogue/game.so : $(ROGUE_OBJS)
|
|||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# The ctf game
|
||||
ifeq ($(YQ2_OSTYPE), Windows)
|
||||
ctf:
|
||||
@echo "===> Building ctf/game.dll"
|
||||
${Q}mkdir -p release/ctf
|
||||
$(MAKE) release/ctf/game.dll
|
||||
else ifeq ($(YQ2_OSTYPE), Darwin)
|
||||
ctf:
|
||||
@echo "===> Building ctf/game.dylib"
|
||||
${Q}mkdir -p release/ctf
|
||||
$(MAKE) release/ctf/game.dylib
|
||||
else
|
||||
ctf:
|
||||
@echo "===> Building ctf/game.so"
|
||||
${Q}mkdir -p release/ctf
|
||||
$(MAKE) release/ctf/game.so
|
||||
|
||||
release/ctf/game.so : CFLAGS += -fPIC -Wno-unused-result
|
||||
release/ctf/game.so : LDFLAGS += -shared
|
||||
|
||||
endif
|
||||
|
||||
build/ctf/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
# ----------
|
||||
|
||||
CTF_OBJS_ = \
|
||||
src/common/shared/flash.o \
|
||||
src/common/shared/rand.o \
|
||||
src/common/shared/shared.o \
|
||||
src/ctf/g_ai.o \
|
||||
src/ctf/g_chase.o \
|
||||
src/ctf/g_cmds.o \
|
||||
src/ctf/g_combat.o \
|
||||
src/ctf/g_ctf.o \
|
||||
src/ctf/g_func.o \
|
||||
src/ctf/g_items.o \
|
||||
src/ctf/g_main.o \
|
||||
src/ctf/g_misc.o \
|
||||
src/ctf/g_monster.o \
|
||||
src/ctf/g_phys.o \
|
||||
src/ctf/g_save.o \
|
||||
src/ctf/g_spawn.o \
|
||||
src/ctf/g_svcmds.o \
|
||||
src/ctf/g_target.o \
|
||||
src/ctf/g_trigger.o \
|
||||
src/ctf/g_utils.o \
|
||||
src/ctf/g_weapon.o \
|
||||
src/ctf/menu/menu.o \
|
||||
src/ctf/monster/move.o \
|
||||
src/ctf/player/client.o \
|
||||
src/ctf/player/hud.o \
|
||||
src/ctf/player/trail.o \
|
||||
src/ctf/player/view.o \
|
||||
src/ctf/player/weapon.o
|
||||
|
||||
# ----------
|
||||
|
||||
# Rewrite paths to our object directory
|
||||
CTF_OBJS = $(patsubst %,build/ctf/%,$(CTF_OBJS_))
|
||||
|
||||
# ----------
|
||||
|
||||
# Generate header dependencies
|
||||
CTF_DEPS= $(CTF_OBJS:.o=.d)
|
||||
|
||||
# ----------
|
||||
|
||||
# Suck header dependencies in
|
||||
-include $(CTF_DEPS)
|
||||
|
||||
# ----------
|
||||
|
||||
ifeq ($(YQ2_OSTYPE), Windows)
|
||||
release/ctf/game.dll : $(CTF_OBJS)
|
||||
@echo "===> LD $@"
|
||||
${Q}$(CC) $(LDFLAGS) $(CTF_OBJS) $(LDLIBS) -o $@
|
||||
else ifeq ($(YQ2_OSTYPE), Darwin)
|
||||
release/ctf/game.dylib : $(CTF_OBJS)
|
||||
@echo "===> LD $@"
|
||||
${Q}$(CC) $(LDFLAGS) $(CTF_OBJS) $(LDLIBS) -o $@
|
||||
else
|
||||
release/ctf/game.so : $(CTF_OBJS)
|
||||
@echo "===> LD $@"
|
||||
${Q}$(CC) $(LDFLAGS) $(CTF_OBJS) $(LDLIBS) -o $@
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* CTF specific stuff.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifndef CTF_CTF_H
|
||||
#define CTF_CTF_H
|
||||
|
||||
#define CTF_VERSION 1.52
|
||||
#define CTF_VSTRING2(x) # x
|
||||
#define CTF_VSTRING(x) CTF_VSTRING2(x)
|
||||
#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
|
||||
|
||||
#define STAT_CTF_TEAM1_PIC 17
|
||||
#define STAT_CTF_TEAM1_CAPS 18
|
||||
#define STAT_CTF_TEAM2_PIC 19
|
||||
#define STAT_CTF_TEAM2_CAPS 20
|
||||
#define STAT_CTF_FLAG_PIC 21
|
||||
#define STAT_CTF_JOINED_TEAM1_PIC 22
|
||||
#define STAT_CTF_JOINED_TEAM2_PIC 23
|
||||
#define STAT_CTF_TEAM1_HEADER 24
|
||||
#define STAT_CTF_TEAM2_HEADER 25
|
||||
#define STAT_CTF_TECH 26
|
||||
#define STAT_CTF_ID_VIEW 27
|
||||
#define STAT_CTF_MATCH 28
|
||||
#define STAT_CTF_ID_VIEW_COLOR 29
|
||||
#define STAT_CTF_TEAMINFO 30
|
||||
|
||||
#define CONFIG_CTF_MATCH (CS_AIRACCEL - 1)
|
||||
#define CONFIG_CTF_TEAMINFO (CS_AIRACCEL - 2)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CTF_NOTEAM,
|
||||
CTF_TEAM1,
|
||||
CTF_TEAM2
|
||||
} ctfteam_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CTF_GRAPPLE_STATE_FLY,
|
||||
CTF_GRAPPLE_STATE_PULL,
|
||||
CTF_GRAPPLE_STATE_HANG
|
||||
} ctfgrapplestate_t;
|
||||
|
||||
typedef struct ghost_s
|
||||
{
|
||||
char netname[16];
|
||||
int number;
|
||||
|
||||
/* stats */
|
||||
int deaths;
|
||||
int kills;
|
||||
int caps;
|
||||
int basedef;
|
||||
int carrierdef;
|
||||
|
||||
int code; /* ghost code */
|
||||
int team; /* team */
|
||||
int score; /* frags at time of disconnect */
|
||||
edict_t *ent;
|
||||
} ghost_t;
|
||||
|
||||
extern cvar_t *ctf;
|
||||
|
||||
#define CTF_TEAM1_SKIN "ctf_r"
|
||||
#define CTF_TEAM2_SKIN "ctf_b"
|
||||
|
||||
#define DF_CTF_FORCEJOIN 131072
|
||||
#define DF_ARMOR_PROTECT 262144
|
||||
#define DF_CTF_NO_TECH 524288
|
||||
|
||||
#define CTF_CAPTURE_BONUS 15 /* what you get for capture */
|
||||
#define CTF_TEAM_BONUS 10 /* what your team gets for capture */
|
||||
#define CTF_RECOVERY_BONUS 1 /* what you get for recovery */
|
||||
#define CTF_FLAG_BONUS 0 /* what you get for picking up enemy flag */
|
||||
#define CTF_FRAG_CARRIER_BONUS 2 /* what you get for fragging enemy flag carrier */
|
||||
#define CTF_FLAG_RETURN_TIME 40 /* seconds until auto return */
|
||||
|
||||
#define CTF_CARRIER_DANGER_PROTECT_BONUS 2 /* bonus for fraggin someone who has recently hurt your flag carrier */
|
||||
#define CTF_CARRIER_PROTECT_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag carrier */
|
||||
#define CTF_FLAG_DEFENSE_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag */
|
||||
#define CTF_RETURN_FLAG_ASSIST_BONUS 1 /* awarded for returning a flag that causes a capture to happen almost immediately */
|
||||
#define CTF_FRAG_CARRIER_ASSIST_BONUS 2 /* award for fragging a flag carrier if a capture happens almost immediately */
|
||||
|
||||
#define CTF_TARGET_PROTECT_RADIUS 400 /* the radius around an object being defended where a target will be worth extra frags */
|
||||
#define CTF_ATTACKER_PROTECT_RADIUS 400 /* the radius around an object being defended where an attacker will get extra frags when making kills */
|
||||
|
||||
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8
|
||||
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10
|
||||
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10
|
||||
|
||||
#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 /* number of seconds before dropped flag auto-returns */
|
||||
|
||||
#define CTF_TECH_TIMEOUT 60 /* seconds before techs spawn again */
|
||||
|
||||
#define CTF_GRAPPLE_SPEED 650 /* speed of grapple in flight */
|
||||
#define CTF_GRAPPLE_PULL_SPEED 650 /* speed player is pulled at */
|
||||
|
||||
void CTFInit(void);
|
||||
void CTFSpawn(void);
|
||||
void CTFPrecache(void);
|
||||
|
||||
void SP_info_player_team1(edict_t *self);
|
||||
void SP_info_player_team2(edict_t *self);
|
||||
|
||||
char *CTFTeamName(int team);
|
||||
char *CTFOtherTeamName(int team);
|
||||
void CTFAssignSkin(edict_t *ent, char *s);
|
||||
void CTFAssignTeam(gclient_t *who);
|
||||
edict_t *SelectCTFSpawnPoint(edict_t *ent);
|
||||
qboolean CTFPickup_Flag(edict_t *ent, edict_t *other);
|
||||
void CTFDrop_Flag(edict_t *ent, gitem_t *item);
|
||||
void CTFEffects(edict_t *player);
|
||||
void CTFCalcScores(void);
|
||||
void SetCTFStats(edict_t *ent);
|
||||
void CTFDeadDropFlag(edict_t *self);
|
||||
void CTFScoreboardMessage(edict_t *ent, edict_t *killer);
|
||||
void CTFTeam_f(edict_t *ent);
|
||||
void CTFID_f(edict_t *ent);
|
||||
void CTFSay_Team(edict_t *who, char *msg);
|
||||
void CTFFlagSetup(edict_t *ent);
|
||||
void CTFResetFlag(int ctf_team);
|
||||
void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
|
||||
void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
|
||||
|
||||
/* GRAPPLE */
|
||||
void CTFWeapon_Grapple(edict_t *ent);
|
||||
void CTFPlayerResetGrapple(edict_t *ent);
|
||||
void CTFGrapplePull(edict_t *self);
|
||||
void CTFResetGrapple(edict_t *self);
|
||||
|
||||
/* TECH */
|
||||
gitem_t *CTFWhat_Tech(edict_t *ent);
|
||||
qboolean CTFPickup_Tech(edict_t *ent, edict_t *other);
|
||||
void CTFDrop_Tech(edict_t *ent, gitem_t *item);
|
||||
void CTFDeadDropTech(edict_t *ent);
|
||||
void CTFSetupTechSpawn(void);
|
||||
int CTFApplyResistance(edict_t *ent, int dmg);
|
||||
int CTFApplyStrength(edict_t *ent, int dmg);
|
||||
qboolean CTFApplyStrengthSound(edict_t *ent);
|
||||
qboolean CTFApplyHaste(edict_t *ent);
|
||||
void CTFApplyHasteSound(edict_t *ent);
|
||||
void CTFApplyRegeneration(edict_t *ent);
|
||||
qboolean CTFHasRegeneration(edict_t *ent);
|
||||
void CTFRespawnTech(edict_t *ent);
|
||||
void CTFResetTech(void);
|
||||
|
||||
void CTFOpenJoinMenu(edict_t *ent);
|
||||
qboolean CTFStartClient(edict_t *ent);
|
||||
void CTFVoteYes(edict_t *ent);
|
||||
void CTFVoteNo(edict_t *ent);
|
||||
void CTFReady(edict_t *ent);
|
||||
void CTFNotReady(edict_t *ent);
|
||||
qboolean CTFNextMap(void);
|
||||
qboolean CTFMatchSetup(void);
|
||||
qboolean CTFMatchOn(void);
|
||||
void CTFGhost(edict_t *ent);
|
||||
void CTFAdmin(edict_t *ent);
|
||||
qboolean CTFInMatch(void);
|
||||
void CTFStats(edict_t *ent);
|
||||
void CTFWarp(edict_t *ent);
|
||||
void CTFBoot(edict_t *ent);
|
||||
void CTFPlayerList(edict_t *ent);
|
||||
|
||||
qboolean CTFCheckRules(void);
|
||||
|
||||
void SP_misc_ctf_banner(edict_t *ent);
|
||||
void SP_misc_ctf_small_banner(edict_t *ent);
|
||||
|
||||
extern char *ctf_statusbar;
|
||||
|
||||
void UpdateChaseCam(edict_t *ent);
|
||||
void ChaseNext(edict_t *ent);
|
||||
void ChasePrev(edict_t *ent);
|
||||
|
||||
void CTFObserver(edict_t *ent);
|
||||
|
||||
void SP_trigger_teleport(edict_t *ent);
|
||||
void SP_info_teleport_destination(edict_t *ent);
|
||||
|
||||
void CTFSetPowerUpEffect(edict_t *ent, int def);
|
||||
|
||||
#endif /* CTF_CTF_H */
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* Here are the client, server and game are tied together.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* THIS FILE IS _VERY_ FRAGILE AND THERE'S NOTHING IN IT THAT CAN OR
|
||||
* MUST BE CHANGED. IT'S MOST LIKELY A VERY GOOD IDEA TO CLOSE THE
|
||||
* EDITOR NOW AND NEVER LOOK BACK. OTHERWISE YOU MAY SCREW UP EVERYTHING!
|
||||
*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
#ifndef CTF_GAME_H
|
||||
#define CTF_GAME_H
|
||||
|
||||
#define GAME_API_VERSION 3
|
||||
|
||||
/* edict->svflags */
|
||||
#define SVF_NOCLIENT 0x00000001 /* don't send entity to clients, even if it has effects */
|
||||
#define SVF_DEADMONSTER 0x00000002 /* treat as CONTENTS_DEADMONSTER for collision */
|
||||
#define SVF_MONSTER 0x00000004 /* treat as CONTENTS_MONSTER for collision */
|
||||
#define SVF_PROJECTILE 0x00000008 /* entity is simple projectile, used for network optimization */
|
||||
|
||||
/* edict->solid values */
|
||||
typedef enum
|
||||
{
|
||||
SOLID_NOT, /* no interaction with other objects */
|
||||
SOLID_TRIGGER, /* only touch when inside, after moving */
|
||||
SOLID_BBOX, /* touch on edge */
|
||||
SOLID_BSP /* bsp clip, touch on edge */
|
||||
} solid_t;
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
/* link_t is only used for entity area links now */
|
||||
typedef struct link_s
|
||||
{
|
||||
struct link_s *prev, *next;
|
||||
} link_t;
|
||||
|
||||
#define MAX_ENT_CLUSTERS 16
|
||||
|
||||
typedef struct edict_s edict_t;
|
||||
typedef struct gclient_s gclient_t;
|
||||
|
||||
#ifndef GAME_INCLUDE
|
||||
|
||||
struct gclient_s
|
||||
{
|
||||
player_state_t ps; /* communicated by server to clients */
|
||||
int ping;
|
||||
/* the game dll can add anything it wants after */
|
||||
/* this point in the structure */
|
||||
};
|
||||
|
||||
struct edict_s
|
||||
{
|
||||
entity_state_t s;
|
||||
struct gclient_s *client;
|
||||
qboolean inuse;
|
||||
int linkcount;
|
||||
|
||||
link_t area; /* linked to a division node or leaf */
|
||||
|
||||
int num_clusters; /* if -1, use headnode instead */
|
||||
int clusternums[MAX_ENT_CLUSTERS];
|
||||
int headnode; /* unused if num_clusters != -1 */
|
||||
int areanum, areanum2;
|
||||
|
||||
/* ================================ */
|
||||
|
||||
int svflags; /* SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc */
|
||||
vec3_t mins, maxs;
|
||||
vec3_t absmin, absmax, size;
|
||||
solid_t solid;
|
||||
int clipmask;
|
||||
edict_t *owner;
|
||||
};
|
||||
|
||||
#endif /* GAME_INCLUDE */
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
/* functions provided by the main engine */
|
||||
typedef struct
|
||||
{
|
||||
/* special messages */
|
||||
void (*bprintf)(int printlevel, char *fmt, ...);
|
||||
void (*dprintf)(char *fmt, ...);
|
||||
void (*cprintf)(edict_t *ent, int printlevel, char *fmt, ...);
|
||||
void (*centerprintf)(edict_t *ent, char *fmt, ...);
|
||||
void (*sound)(edict_t *ent, int channel, int soundindex, float volume,
|
||||
float attenuation, float timeofs);
|
||||
void (*positioned_sound)(vec3_t origin, edict_t *ent, int channel,
|
||||
int soundinedex, float volume, float attenuation, float timeofs);
|
||||
|
||||
void (*configstring)(int num, char *string);
|
||||
|
||||
void (*error)(char *fmt, ...);
|
||||
|
||||
/* the *index functions create configstrings and some internal server state */
|
||||
int (*modelindex)(char *name);
|
||||
int (*soundindex)(char *name);
|
||||
int (*imageindex)(char *name);
|
||||
|
||||
void (*setmodel)(edict_t *ent, char *name);
|
||||
|
||||
/* collision detection */
|
||||
trace_t (*trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
|
||||
edict_t *passent, int contentmask);
|
||||
int (*pointcontents)(vec3_t point);
|
||||
qboolean (*inPVS)(vec3_t p1, vec3_t p2);
|
||||
qboolean (*inPHS)(vec3_t p1, vec3_t p2);
|
||||
void (*SetAreaPortalState)(int portalnum, qboolean open);
|
||||
qboolean (*AreasConnected)(int area1, int area2);
|
||||
|
||||
void (*linkentity)(edict_t *ent);
|
||||
void (*unlinkentity)(edict_t *ent); /* call before removing an interactive edict */
|
||||
int (*BoxEdicts)(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount,
|
||||
int areatype);
|
||||
void (*Pmove)(pmove_t *pmove); /* player movement code common with client prediction */
|
||||
|
||||
/* network messaging */
|
||||
void (*multicast)(vec3_t origin, multicast_t to);
|
||||
void (*unicast)(edict_t *ent, qboolean reliable);
|
||||
void (*WriteChar)(int c);
|
||||
void (*WriteByte)(int c);
|
||||
void (*WriteShort)(int c);
|
||||
void (*WriteLong)(int c);
|
||||
void (*WriteFloat)(float f);
|
||||
void (*WriteString)(char *s);
|
||||
void (*WritePosition)(vec3_t pos); /* some fractional bits */
|
||||
void (*WriteDir)(vec3_t pos); /* single byte encoded, very coarse */
|
||||
void (*WriteAngle)(float f);
|
||||
|
||||
/* managed memory allocation */
|
||||
void *(*TagMalloc)(int size, int tag);
|
||||
void (*TagFree)(void *block);
|
||||
void (*FreeTags)(int tag);
|
||||
|
||||
/* console variable interaction */
|
||||
cvar_t *(*cvar)(char *var_name, char *value, int flags);
|
||||
cvar_t *(*cvar_set)(char *var_name, char *value);
|
||||
cvar_t *(*cvar_forceset)(char *var_name, char *value);
|
||||
|
||||
/* ClientCommand and ServerCommand parameter access */
|
||||
int (*argc)(void);
|
||||
char *(*argv)(int n);
|
||||
char *(*args)(void); /* concatenation of all argv >= 1 */
|
||||
|
||||
void (*AddCommandString)(char *text);
|
||||
void (*DebugGraph)(float value, int color);
|
||||
} game_import_t;
|
||||
|
||||
/* functions exported by the game subsystem */
|
||||
typedef struct
|
||||
{
|
||||
int apiversion;
|
||||
|
||||
void (*Init)(void);
|
||||
void (*Shutdown)(void);
|
||||
|
||||
/* each new level entered will cause a call to SpawnEntities */
|
||||
void (*SpawnEntities)(char *mapname, char *entstring, char *spawnpoint);
|
||||
|
||||
void (*WriteGame)(char *filename, qboolean autosave);
|
||||
void (*ReadGame)(char *filename);
|
||||
void (*WriteLevel)(char *filename);
|
||||
void (*ReadLevel)(char *filename);
|
||||
|
||||
qboolean (*ClientConnect)(edict_t *ent, char *userinfo);
|
||||
void (*ClientBegin)(edict_t *ent);
|
||||
void (*ClientUserinfoChanged)(edict_t *ent, char *userinfo);
|
||||
void (*ClientDisconnect)(edict_t *ent);
|
||||
void (*ClientCommand)(edict_t *ent);
|
||||
void (*ClientThink)(edict_t *ent, usercmd_t *cmd);
|
||||
|
||||
void (*RunFrame)(void);
|
||||
void (*ServerCommand)(void);
|
||||
|
||||
/* global variables shared between game and server */
|
||||
struct edict_s *edicts;
|
||||
int edict_size;
|
||||
int num_edicts; /* current number, <= max_edicts */
|
||||
int max_edicts;
|
||||
} game_export_t;
|
||||
|
||||
#endif /* CTF_GAME_H */
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* Header for the CTF ingame menu.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#ifndef CTF_MENU_H
|
||||
#define CTF_MENU_H
|
||||
|
||||
enum
|
||||
{
|
||||
PMENU_ALIGN_LEFT,
|
||||
PMENU_ALIGN_CENTER,
|
||||
PMENU_ALIGN_RIGHT
|
||||
};
|
||||
|
||||
typedef struct pmenuhnd_s
|
||||
{
|
||||
struct pmenu_s *entries;
|
||||
int cur;
|
||||
int num;
|
||||
void *arg;
|
||||
} pmenuhnd_t;
|
||||
|
||||
typedef void (*SelectFunc_t)(edict_t *ent, pmenuhnd_t *hnd);
|
||||
|
||||
typedef struct pmenu_s
|
||||
{
|
||||
char *text;
|
||||
int align;
|
||||
SelectFunc_t SelectFunc;
|
||||
} pmenu_t;
|
||||
|
||||
pmenuhnd_t *PMenu_Open(edict_t *ent,
|
||||
pmenu_t *entries,
|
||||
int cur,
|
||||
int num,
|
||||
void *arg);
|
||||
void PMenu_Close(edict_t *ent);
|
||||
void PMenu_UpdateEntry(pmenu_t *entry,
|
||||
const char *text,
|
||||
int align,
|
||||
SelectFunc_t SelectFunc);
|
||||
void PMenu_Do_Update(edict_t *ent);
|
||||
void PMenu_Update(edict_t *ent);
|
||||
void PMenu_Next(edict_t *ent);
|
||||
void PMenu_Prev(edict_t *ent);
|
||||
void PMenu_Select(edict_t *ent);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,8 @@
|
|||
#include "header/local.h"
|
||||
#include "monster/player.h"
|
||||
|
||||
gitem_t *CTFWhat_Tech(edict_t *ent);
|
||||
|
||||
static char *
|
||||
ClientTeam(edict_t *ent, char* value)
|
||||
{
|
||||
|
@ -229,7 +231,7 @@ Cmd_Give_f(edict_t *ent)
|
|||
if (gi.argc() == 3)
|
||||
{
|
||||
ent->health = atoi(gi.argv(2));
|
||||
ent->health = ent->health < 1 ? 1 : ent->health;
|
||||
ent->health = ent->health < 1 ? 1 : ent->health;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -896,7 +898,7 @@ Cmd_Players_f(edict_t *ent)
|
|||
game.clients[index[i]].pers.netname);
|
||||
|
||||
if (strlen(small) + strlen(large) > sizeof(large) - 100)
|
||||
{
|
||||
{
|
||||
/* can't print all of them in one packet */
|
||||
strcat(large, "...\n");
|
||||
break;
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* Copyright (c) ZeniMax Media Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,6 +41,9 @@ edict_t *g_edicts;
|
|||
|
||||
cvar_t *deathmatch;
|
||||
cvar_t *coop;
|
||||
cvar_t *coop_baseq2; /* treat spawnflags according to baseq2 rules */
|
||||
cvar_t *coop_pickup_weapons;
|
||||
cvar_t *coop_elevator_delay;
|
||||
cvar_t *dmflags;
|
||||
cvar_t *skill;
|
||||
cvar_t *fraglimit;
|
||||
|
@ -47,10 +51,17 @@ cvar_t *timelimit;
|
|||
cvar_t *capturelimit;
|
||||
cvar_t *instantweap;
|
||||
cvar_t *password;
|
||||
cvar_t *spectator_password;
|
||||
cvar_t *needpass;
|
||||
cvar_t *maxclients;
|
||||
cvar_t *maxspectators;
|
||||
cvar_t *maxentities;
|
||||
cvar_t *g_select_empty;
|
||||
cvar_t *dedicated;
|
||||
cvar_t *g_footsteps;
|
||||
cvar_t *g_monsterfootsteps;
|
||||
cvar_t *g_fix_triggered;
|
||||
cvar_t *g_commanderbody_nogod;
|
||||
|
||||
cvar_t *filterban;
|
||||
|
||||
|
@ -76,22 +87,21 @@ cvar_t *flood_persecond;
|
|||
cvar_t *flood_waitdelay;
|
||||
|
||||
cvar_t *sv_maplist;
|
||||
cvar_t *sv_stopspeed;
|
||||
|
||||
cvar_t *gib_on;
|
||||
cvar_t *g_showlogic;
|
||||
cvar_t *gamerules;
|
||||
cvar_t *huntercam;
|
||||
cvar_t *strong_mines;
|
||||
cvar_t *randomrespawn;
|
||||
|
||||
cvar_t *g_disruptor;
|
||||
|
||||
cvar_t *aimfix;
|
||||
cvar_t *g_machinegun_norecoil;
|
||||
cvar_t *g_swap_speed;
|
||||
|
||||
void SpawnEntities(char *mapname, char *entities, char *spawnpoint);
|
||||
void ClientThink(edict_t *ent, usercmd_t *cmd);
|
||||
qboolean ClientConnect(edict_t *ent, char *userinfo);
|
||||
void ClientUserinfoChanged(edict_t *ent, char *userinfo);
|
||||
void ClientDisconnect(edict_t *ent);
|
||||
void ClientBegin(edict_t *ent);
|
||||
void ClientCommand(edict_t *ent);
|
||||
void RunEntity(edict_t *ent);
|
||||
void WriteGame(char *filename, qboolean autosave);
|
||||
void ReadGame(char *filename);
|
||||
void WriteLevel(char *filename);
|
||||
void ReadLevel(char *filename);
|
||||
void InitGame(void);
|
||||
void G_RunFrame(void);
|
||||
|
||||
/* =================================================================== */
|
||||
|
@ -106,10 +116,11 @@ ShutdownGame(void)
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns a pointer to the structure with
|
||||
* all entry points and global variables
|
||||
* Returns a pointer to the structure
|
||||
* with all entry points and global
|
||||
* variables
|
||||
*/
|
||||
game_export_t *
|
||||
Q2_DLL_EXPORTED game_export_t *
|
||||
GetGameAPI(game_import_t *import)
|
||||
{
|
||||
gi = *import;
|
||||
|
@ -137,30 +148,37 @@ GetGameAPI(game_import_t *import)
|
|||
|
||||
globals.edict_size = sizeof(edict_t);
|
||||
|
||||
/* Initalize the PRNG */
|
||||
randk_seed();
|
||||
|
||||
return &globals;
|
||||
}
|
||||
|
||||
/*
|
||||
* this is only here so the functions
|
||||
* in shared source files can link
|
||||
*/
|
||||
void
|
||||
Sys_Error(char *error, ...)
|
||||
Sys_Error(const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
|
||||
va_start(argptr, error);
|
||||
vsprintf(text, error, argptr);
|
||||
vsnprintf(text, sizeof(text), error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
gi.error(ERR_FATAL, "%s", text);
|
||||
gi.error("%s", text);
|
||||
}
|
||||
|
||||
void
|
||||
Com_Printf(char *msg, ...)
|
||||
Com_Printf(const char *msg, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
|
||||
va_start(argptr, msg);
|
||||
vsprintf(text, msg, argptr);
|
||||
vsnprintf(text, sizeof(text), msg, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
gi.dprintf("%s", text);
|
||||
|
@ -175,7 +193,7 @@ ClientEndServerFrames(void)
|
|||
edict_t *ent;
|
||||
|
||||
/* calc the player views now that all
|
||||
pushing and damage has been added */
|
||||
pushing and damage has been added */
|
||||
for (i = 0; i < maxclients->value; i++)
|
||||
{
|
||||
ent = g_edicts + 1 + i;
|
||||
|
@ -197,6 +215,11 @@ CreateTargetChangeLevel(char *map)
|
|||
{
|
||||
edict_t *ent;
|
||||
|
||||
if (!map)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ent = G_Spawn();
|
||||
ent->classname = "target_changelevel";
|
||||
Com_sprintf(level.nextmap, sizeof(level.nextmap), "%s", map);
|
||||
|
@ -276,14 +299,15 @@ EndDMLevel(void)
|
|||
{
|
||||
BeginIntermission(CreateTargetChangeLevel(level.nextmap));
|
||||
}
|
||||
else /* search for a changelevel */
|
||||
else /* search for a changelevel */
|
||||
{
|
||||
ent = G_Find(NULL, FOFS(classname), "target_changelevel");
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
/* the map designer didn't include a changelevel,
|
||||
so create a fake ent that goes back to the same level */
|
||||
so create a fake ent that goes back to the same
|
||||
level */
|
||||
BeginIntermission(CreateTargetChangeLevel(level.mapname));
|
||||
return;
|
||||
}
|
||||
|
@ -292,6 +316,34 @@ EndDMLevel(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CheckNeedPass(void)
|
||||
{
|
||||
int need;
|
||||
|
||||
/* if password or spectator_password has
|
||||
changed, update needpass as needed */
|
||||
if (password->modified || spectator_password->modified)
|
||||
{
|
||||
password->modified = spectator_password->modified = false;
|
||||
|
||||
need = 0;
|
||||
|
||||
if (*password->string && Q_stricmp(password->string, "none"))
|
||||
{
|
||||
need |= 1;
|
||||
}
|
||||
|
||||
if (*spectator_password->string &&
|
||||
Q_stricmp(spectator_password->string, "none"))
|
||||
{
|
||||
need |= 2;
|
||||
}
|
||||
|
||||
gi.cvar_set("needpass", va("%d", need));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CheckDMRules(void)
|
||||
{
|
||||
|
@ -367,9 +419,10 @@ ExitLevel(void)
|
|||
|
||||
Com_sprintf(command, sizeof(command), "gamemap \"%s\"\n", level.changemap);
|
||||
gi.AddCommandString(command);
|
||||
ClientEndServerFrames();
|
||||
|
||||
level.changemap = NULL;
|
||||
level.exitintermission = 0;
|
||||
level.intermissiontime = 0;
|
||||
ClientEndServerFrames();
|
||||
|
||||
/* clear some things before going to next level */
|
||||
for (i = 0; i < maxclients->value; i++)
|
||||
|
@ -387,8 +440,8 @@ ExitLevel(void)
|
|||
}
|
||||
}
|
||||
|
||||
gibsthisframe = 0;
|
||||
debristhisframe = 0;
|
||||
gibsthisframe = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -410,15 +463,15 @@ G_RunFrame(void)
|
|||
AI_SetSightClient();
|
||||
|
||||
/* exit intermissions */
|
||||
|
||||
if (level.exitintermission)
|
||||
{
|
||||
ExitLevel();
|
||||
return;
|
||||
}
|
||||
|
||||
/* treat each object in turn even
|
||||
the world gets a chance to think */
|
||||
/* treat each object in turn
|
||||
even the world gets a chance
|
||||
to think */
|
||||
ent = &g_edicts[0];
|
||||
|
||||
for (i = 0; i < globals.num_edicts; i++, ent++)
|
||||
|
@ -457,7 +510,9 @@ G_RunFrame(void)
|
|||
/* see if it is time to end a deathmatch */
|
||||
CheckDMRules();
|
||||
|
||||
/* see if needpass needs updated */
|
||||
CheckNeedPass();
|
||||
|
||||
/* build the playerstate_t structures for all players */
|
||||
ClientEndServerFrames();
|
||||
}
|
||||
|
|
@ -20,11 +20,11 @@
|
|||
* =======================================================================
|
||||
*
|
||||
* The savegame system. Unused by the CTF game but nevertheless called
|
||||
* during game initialization. Therefor no new savegame code ist
|
||||
* during game initialization. Therefor no new savegame code ist
|
||||
* imported.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
@ -425,7 +425,7 @@ ReadField(FILE *f, field_t *field, byte *base)
|
|||
/* ========================================================= */
|
||||
|
||||
/*
|
||||
* All pointer variables (except function
|
||||
* All pointer variables (except function
|
||||
* pointers) must be handled specially.
|
||||
*/
|
||||
void
|
||||
|
@ -481,7 +481,7 @@ ReadClient(FILE *f, gclient_t *client)
|
|||
* last save position.
|
||||
*/
|
||||
void
|
||||
WriteGame(char *filename, qboolean autosave)
|
||||
WriteGame(const char *filename, qboolean autosave)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
|
@ -516,7 +516,7 @@ WriteGame(char *filename, qboolean autosave)
|
|||
}
|
||||
|
||||
void
|
||||
ReadGame(char *filename)
|
||||
ReadGame(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
|
@ -556,7 +556,7 @@ ReadGame(char *filename)
|
|||
/* ========================================================== */
|
||||
|
||||
/*
|
||||
* All pointer variables (except function
|
||||
* All pointer variables (except function
|
||||
* pointers) must be handled specially.
|
||||
*/
|
||||
void
|
||||
|
@ -648,7 +648,7 @@ ReadLevelLocals(FILE *f)
|
|||
}
|
||||
|
||||
void
|
||||
WriteLevel(char *filename)
|
||||
WriteLevel(const char *filename)
|
||||
{
|
||||
int i;
|
||||
edict_t *ent;
|
||||
|
@ -706,7 +706,7 @@ WriteLevel(char *filename)
|
|||
* No clients are connected yet.
|
||||
*/
|
||||
void
|
||||
ReadLevel(char *filename)
|
||||
ReadLevel(const char *filename)
|
||||
{
|
||||
int entnum;
|
||||
FILE *f;
|
|
@ -270,7 +270,7 @@ ED_CallSpawn(edict_t *ent)
|
|||
}
|
||||
|
||||
if (!strcmp(item->classname, ent->classname))
|
||||
{
|
||||
{
|
||||
/* found it */
|
||||
SpawnItem(ent, item);
|
||||
return;
|
||||
|
@ -281,7 +281,7 @@ ED_CallSpawn(edict_t *ent)
|
|||
for (s = spawns; s->name; s++)
|
||||
{
|
||||
if (!strcmp(s->name, ent->classname))
|
||||
{
|
||||
{
|
||||
/* found it */
|
||||
s->spawn(ent);
|
||||
return;
|
||||
|
@ -342,7 +342,7 @@ ED_ParseField(char *key, char *value, edict_t *ent)
|
|||
for (f = fields; f->name; f++)
|
||||
{
|
||||
if (!Q_stricmp(f->name, key))
|
||||
{
|
||||
{
|
||||
/* found it */
|
||||
if (f->flags & FFL_SPAWNTEMP)
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ G_FindTeams(void)
|
|||
* parsing textual entity definitions out of an ent file.
|
||||
*/
|
||||
void
|
||||
SpawnEntities(char *mapname, char *entities, char *spawnpoint)
|
||||
SpawnEntities(const char *mapname, char *entities, const char *spawnpoint)
|
||||
{
|
||||
edict_t *ent;
|
||||
int inhibit;
|
||||
|
@ -609,7 +609,7 @@ SpawnEntities(char *mapname, char *entities, char *spawnpoint)
|
|||
ent->spawnflags &= ~SPAWNFLAG_NOT_HARD;
|
||||
}
|
||||
|
||||
/* remove things (except the world) from
|
||||
/* remove things (except the world) from
|
||||
different skill levels or deathmatch */
|
||||
if (ent != g_edicts)
|
||||
{
|
|
@ -22,7 +22,7 @@
|
|||
* Weapon support functions.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
@ -56,7 +56,7 @@ check_dodge(edict_t *self, vec3_t start, vec3_t dir, int speed)
|
|||
{
|
||||
VectorSubtract(tr.endpos, start, v);
|
||||
eta = (VectorLength(v) - tr.ent->maxs[0]) / speed;
|
||||
tr.ent->monsterinfo.dodge(tr.ent, self, eta);
|
||||
tr.ent->monsterinfo.dodge(tr.ent, self, eta, &tr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,13 +84,13 @@ fire_hit(edict_t *self, vec3_t aim, int damage, int kick)
|
|||
|
||||
if ((aim[1] > self->mins[0]) && (aim[1] < self->maxs[0]))
|
||||
{
|
||||
/* the hit is straight on so back the
|
||||
/* the hit is straight on so back the
|
||||
range up to the edge of their bbox */
|
||||
range -= self->enemy->maxs[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this is a side hit so adjust the "right"
|
||||
/* this is a side hit so adjust the "right"
|
||||
value out to the edge of their bbox */
|
||||
if (aim[1] < 0)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ fire_hit(edict_t *self, vec3_t aim, int damage, int kick)
|
|||
}
|
||||
|
||||
/*
|
||||
* This is an internal support routine
|
||||
* This is an internal support routine
|
||||
* used for bullet/pellet based weapons.
|
||||
*/
|
||||
static void
|
||||
|
@ -279,7 +279,7 @@ fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage,
|
|||
}
|
||||
}
|
||||
|
||||
/* if went through water, determine where
|
||||
/* if went through water, determine where
|
||||
the end and make a bubble trail */
|
||||
if (water)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ fire_lead(edict_t *self, vec3_t start, vec3_t aimdir, int damage,
|
|||
}
|
||||
|
||||
/*
|
||||
* Fires a single round. Used for machinegun and
|
||||
* Fires a single round. Used for machinegun and
|
||||
* chaingun. Would be fine for pistols, rifles, etc....
|
||||
*/
|
||||
void
|
||||
|
@ -322,7 +322,7 @@ fire_bullet(edict_t *self, vec3_t start, vec3_t aimdir, int damage,
|
|||
}
|
||||
|
||||
/*
|
||||
* Shoots shotgun pellets. Used by
|
||||
* Shoots shotgun pellets. Used by
|
||||
* shotgun and super shotgun.
|
||||
*/
|
||||
void
|
||||
|
@ -339,7 +339,7 @@ fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage,
|
|||
}
|
||||
|
||||
/*
|
||||
* Fires a single blaster bolt. Used
|
||||
* Fires a single blaster bolt. Used
|
||||
* by the blaster and hyper blaster.
|
||||
*/
|
||||
void
|
22
src/ctf/header/game.h
Normal file
22
src/ctf/header/game.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* Copyright (c) ZeniMax Media Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "../../game/header/game.h"
|
22
src/ctf/header/local.h
Normal file
22
src/ctf/header/local.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* Copyright (c) ZeniMax Media Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "../../game/header/local.h"
|
|
@ -48,6 +48,8 @@ cvar_t *dmflags;
|
|||
cvar_t *skill;
|
||||
cvar_t *fraglimit;
|
||||
cvar_t *timelimit;
|
||||
cvar_t *capturelimit;
|
||||
cvar_t *instantweap;
|
||||
cvar_t *password;
|
||||
cvar_t *spectator_password;
|
||||
cvar_t *needpass;
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#define FALL_TIME 0.3
|
||||
|
||||
/* these are set with checkboxes on each entity in the map editor */
|
||||
|
||||
/* edict->spawnflags */
|
||||
#define SPAWNFLAG_NOT_EASY 0x00000100
|
||||
#define SPAWNFLAG_NOT_MEDIUM 0x00000200
|
||||
#define SPAWNFLAG_NOT_HARD 0x00000400
|
||||
|
@ -89,6 +91,7 @@
|
|||
#define TAG_LEVEL 766 /* clear when loading a new level */
|
||||
|
||||
#define MELEE_DISTANCE 80
|
||||
|
||||
#define BODY_QUEUE_SIZE 8
|
||||
|
||||
typedef enum
|
||||
|
@ -252,6 +255,7 @@ typedef struct
|
|||
#define IT_MELEE 0x00000040
|
||||
#define IT_NOT_GIVEABLE 0x00000080 /* item can not be given */
|
||||
#define IT_INSTANT_USE 0x000000100 /* item is insta-used on pickup if dmflag is set */
|
||||
#define IT_TECH 0x000000200 /* CTF */
|
||||
|
||||
/* gitem_t->weapmodel for weapons indicates model index */
|
||||
#define WEAP_BLASTER 1
|
||||
|
@ -272,6 +276,7 @@ typedef struct
|
|||
#define WEAP_PLASMA 16
|
||||
#define WEAP_PROXLAUNCH 17
|
||||
#define WEAP_CHAINFIST 18
|
||||
#define WEAP_GRAPPLE 19
|
||||
|
||||
typedef struct gitem_s
|
||||
{
|
||||
|
@ -342,6 +347,7 @@ typedef struct
|
|||
char level_name[MAX_QPATH]; /* the descriptive name (Outer Base, etc) */
|
||||
char mapname[MAX_QPATH]; /* the server name (base1, etc) */
|
||||
char nextmap[MAX_QPATH]; /* go here when fraglimit is hit */
|
||||
char forcemap[MAX_QPATH]; /* go here */
|
||||
|
||||
/* intermission state */
|
||||
float intermissiontime; /* time the intermission was started */
|
||||
|
@ -569,6 +575,7 @@ extern int gibsthisframe;
|
|||
#define MOD_BLASTOFF 37
|
||||
#define MOD_GEKK 38
|
||||
#define MOD_TRAP 39
|
||||
#define MOD_GRAPPLE 40
|
||||
#define MOD_FRIENDLY_FIRE 0x8000000
|
||||
#define MOD_CHAINFIST 40
|
||||
#define MOD_DISINTEGRATOR 41
|
||||
|
@ -615,6 +622,8 @@ extern cvar_t *dmflags;
|
|||
extern cvar_t *skill;
|
||||
extern cvar_t *fraglimit;
|
||||
extern cvar_t *timelimit;
|
||||
extern cvar_t *capturelimit;
|
||||
extern cvar_t *instantweap;
|
||||
extern cvar_t *password;
|
||||
extern cvar_t *spectator_password;
|
||||
extern cvar_t *needpass;
|
||||
|
@ -724,8 +733,10 @@ qboolean ClientConnect(edict_t *ent, char *userinfo);
|
|||
void ClientThink(edict_t *ent, usercmd_t *cmd);
|
||||
|
||||
/* g_cmds.c */
|
||||
qboolean CheckFlood(edict_t *ent);
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
void ClientCommand(edict_t *ent);
|
||||
void Cmd_Score_f(edict_t *ent);
|
||||
|
||||
/* g_items.c */
|
||||
void PrecacheItem(gitem_t *it);
|
||||
|
@ -787,6 +798,7 @@ void ED_CallSpawn(edict_t *ent);
|
|||
/* g_combat.c */
|
||||
qboolean OnSameTeam(edict_t *ent1, edict_t *ent2);
|
||||
qboolean CanDamage(edict_t *targ, edict_t *inflictor);
|
||||
qboolean CheckTeamDamage(edict_t *targ, 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,
|
||||
int knockback, int dflags, int mod);
|
||||
|
@ -936,6 +948,7 @@ void InitClientPersistant(gclient_t *client);
|
|||
void InitClientResp(gclient_t *client);
|
||||
void InitBodyQue(void);
|
||||
void ClientBeginServerFrame(edict_t *ent);
|
||||
void ClientUserinfoChanged(edict_t *ent, char *userinfo);
|
||||
|
||||
/* g_player.c */
|
||||
void player_pain(edict_t *self, edict_t *other, float kick, int damage);
|
||||
|
@ -961,6 +974,11 @@ void InventoryMessage(edict_t *client);
|
|||
|
||||
/* g_pweapon.c */
|
||||
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
||||
void P_ProjectSource(edict_t *ent, 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));
|
||||
|
||||
/* m_move.c */
|
||||
qboolean M_CheckBottom(edict_t *ent);
|
||||
|
@ -974,6 +992,7 @@ void G_RunEntity(edict_t *ent);
|
|||
/* g_main.c */
|
||||
void SaveClientData(void);
|
||||
void FetchClientEntData(edict_t *ent);
|
||||
void EndDMLevel(void);
|
||||
|
||||
/* g_chase.c */
|
||||
void UpdateChaseCam(edict_t *ent);
|
||||
|
@ -1136,11 +1155,35 @@ typedef struct
|
|||
client_persistant_t coop_respawn; /* what to set client->pers to on a respawn */
|
||||
int enterframe; /* level.framenum the client entered the game */
|
||||
int score; /* frags, etc */
|
||||
int ctf_team; /* CTF team */
|
||||
int ctf_state;
|
||||
float ctf_lasthurtcarrier;
|
||||
float ctf_lastreturnedflag;
|
||||
float ctf_flagsince;
|
||||
float ctf_lastfraggedcarrier;
|
||||
qboolean id_state;
|
||||
float lastidtime;
|
||||
qboolean voted; /* for elections */
|
||||
qboolean ready;
|
||||
qboolean admin;
|
||||
struct ghost_s *ghost; /* for ghost codes */
|
||||
vec3_t cmd_angles; /* angles sent over in the last command */
|
||||
|
||||
int game_helpchanged;
|
||||
int helpchanged;
|
||||
qboolean spectator; /* client is a spectator */
|
||||
} client_respawn_t;
|
||||
|
||||
/*
|
||||
* CTF menu
|
||||
*/
|
||||
typedef struct pmenuhnd_s
|
||||
{
|
||||
struct pmenu_s *entries;
|
||||
int cur;
|
||||
int num;
|
||||
void *arg;
|
||||
} pmenuhnd_t;
|
||||
|
||||
/* this structure is cleared on each
|
||||
PutClientInServer(), except for 'client->pers' */
|
||||
struct gclient_s
|
||||
|
@ -1155,6 +1198,8 @@ struct gclient_s
|
|||
pmove_state_t old_pmove; /* for detecting out-of-pmove changes */
|
||||
|
||||
qboolean showscores; /* set layout stat */
|
||||
qboolean inmenu; /* in menu */
|
||||
pmenuhnd_t *menu; /* current menu */
|
||||
qboolean showinventory; /* set layout stat */
|
||||
qboolean showhelp;
|
||||
qboolean showhelpicon;
|
||||
|
@ -1230,6 +1275,15 @@ struct gclient_s
|
|||
edict_t *chase_target; /* player we are chasing */
|
||||
qboolean update_chase; /* need to update chase info? */
|
||||
|
||||
void *ctf_grapple; /* entity of grapple */
|
||||
int ctf_grapplestate; /* true if pulling */
|
||||
float ctf_grapplereleasetime; /* time of grapple release */
|
||||
float ctf_regentime; /* regen tech */
|
||||
float ctf_techsndtime;
|
||||
float ctf_lasttechmsg;
|
||||
float menutime; /* time to update menu */
|
||||
qboolean menudirty;
|
||||
|
||||
float double_framenum;
|
||||
float ir_framenum;
|
||||
float nuke_framenum;
|
||||
|
@ -1376,6 +1430,7 @@ struct edict_s
|
|||
|
||||
/* move this to clientinfo? */
|
||||
int light_level;
|
||||
|
||||
int style; /* also used as areaportal number */
|
||||
|
||||
gitem_t *item; /* for bonus items */
|
||||
|
@ -1444,6 +1499,220 @@ int DBall_ChangeDamage(edict_t *targ, edict_t *attacker, int damage, int mod);
|
|||
void DBall_PostInitSetup(void);
|
||||
int DBall_CheckDMRules(void);
|
||||
|
||||
/*
|
||||
* CTF Menu
|
||||
*/
|
||||
enum
|
||||
{
|
||||
PMENU_ALIGN_LEFT,
|
||||
PMENU_ALIGN_CENTER,
|
||||
PMENU_ALIGN_RIGHT
|
||||
};
|
||||
|
||||
typedef void (*SelectFunc_t)(edict_t *ent, pmenuhnd_t *hnd);
|
||||
|
||||
typedef struct pmenu_s
|
||||
{
|
||||
char *text;
|
||||
int align;
|
||||
SelectFunc_t SelectFunc;
|
||||
} pmenu_t;
|
||||
|
||||
pmenuhnd_t *PMenu_Open(edict_t *ent,
|
||||
pmenu_t *entries,
|
||||
int cur,
|
||||
int num,
|
||||
void *arg);
|
||||
void PMenu_Close(edict_t *ent);
|
||||
void PMenu_UpdateEntry(pmenu_t *entry,
|
||||
const char *text,
|
||||
int align,
|
||||
SelectFunc_t SelectFunc);
|
||||
void PMenu_Do_Update(edict_t *ent);
|
||||
void PMenu_Update(edict_t *ent);
|
||||
void PMenu_Next(edict_t *ent);
|
||||
void PMenu_Prev(edict_t *ent);
|
||||
void PMenu_Select(edict_t *ent);
|
||||
|
||||
/*
|
||||
* CTF specific stuff.
|
||||
*/
|
||||
|
||||
#define CTF_VERSION 1.52
|
||||
#define CTF_VSTRING2(x) # x
|
||||
#define CTF_VSTRING(x) CTF_VSTRING2(x)
|
||||
#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
|
||||
|
||||
#define STAT_CTF_TEAM1_PIC 17
|
||||
#define STAT_CTF_TEAM1_CAPS 18
|
||||
#define STAT_CTF_TEAM2_PIC 19
|
||||
#define STAT_CTF_TEAM2_CAPS 20
|
||||
#define STAT_CTF_FLAG_PIC 21
|
||||
#define STAT_CTF_JOINED_TEAM1_PIC 22
|
||||
#define STAT_CTF_JOINED_TEAM2_PIC 23
|
||||
#define STAT_CTF_TEAM1_HEADER 24
|
||||
#define STAT_CTF_TEAM2_HEADER 25
|
||||
#define STAT_CTF_TECH 26
|
||||
#define STAT_CTF_ID_VIEW 27
|
||||
#define STAT_CTF_MATCH 28
|
||||
#define STAT_CTF_ID_VIEW_COLOR 29
|
||||
#define STAT_CTF_TEAMINFO 30
|
||||
|
||||
#define CONFIG_CTF_MATCH (CS_AIRACCEL - 1)
|
||||
#define CONFIG_CTF_TEAMINFO (CS_AIRACCEL - 2)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CTF_NOTEAM,
|
||||
CTF_TEAM1,
|
||||
CTF_TEAM2
|
||||
} ctfteam_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CTF_GRAPPLE_STATE_FLY,
|
||||
CTF_GRAPPLE_STATE_PULL,
|
||||
CTF_GRAPPLE_STATE_HANG
|
||||
} ctfgrapplestate_t;
|
||||
|
||||
typedef struct ghost_s
|
||||
{
|
||||
char netname[16];
|
||||
int number;
|
||||
|
||||
/* stats */
|
||||
int deaths;
|
||||
int kills;
|
||||
int caps;
|
||||
int basedef;
|
||||
int carrierdef;
|
||||
|
||||
int code; /* ghost code */
|
||||
int team; /* team */
|
||||
int score; /* frags at time of disconnect */
|
||||
edict_t *ent;
|
||||
} ghost_t;
|
||||
|
||||
extern cvar_t *ctf;
|
||||
|
||||
#define CTF_TEAM1_SKIN "ctf_r"
|
||||
#define CTF_TEAM2_SKIN "ctf_b"
|
||||
|
||||
#define DF_CTF_FORCEJOIN 131072
|
||||
#define DF_ARMOR_PROTECT 262144
|
||||
#define DF_CTF_NO_TECH 524288
|
||||
|
||||
#define CTF_CAPTURE_BONUS 15 /* what you get for capture */
|
||||
#define CTF_TEAM_BONUS 10 /* what your team gets for capture */
|
||||
#define CTF_RECOVERY_BONUS 1 /* what you get for recovery */
|
||||
#define CTF_FLAG_BONUS 0 /* what you get for picking up enemy flag */
|
||||
#define CTF_FRAG_CARRIER_BONUS 2 /* what you get for fragging enemy flag carrier */
|
||||
#define CTF_FLAG_RETURN_TIME 40 /* seconds until auto return */
|
||||
|
||||
#define CTF_CARRIER_DANGER_PROTECT_BONUS 2 /* bonus for fraggin someone who has recently hurt your flag carrier */
|
||||
#define CTF_CARRIER_PROTECT_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag carrier */
|
||||
#define CTF_FLAG_DEFENSE_BONUS 1 /* bonus for fraggin someone while either you or your target are near your flag */
|
||||
#define CTF_RETURN_FLAG_ASSIST_BONUS 1 /* awarded for returning a flag that causes a capture to happen almost immediately */
|
||||
#define CTF_FRAG_CARRIER_ASSIST_BONUS 2 /* award for fragging a flag carrier if a capture happens almost immediately */
|
||||
|
||||
#define CTF_TARGET_PROTECT_RADIUS 400 /* the radius around an object being defended where a target will be worth extra frags */
|
||||
#define CTF_ATTACKER_PROTECT_RADIUS 400 /* the radius around an object being defended where an attacker will get extra frags when making kills */
|
||||
|
||||
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8
|
||||
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10
|
||||
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10
|
||||
|
||||
#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 /* number of seconds before dropped flag auto-returns */
|
||||
|
||||
#define CTF_TECH_TIMEOUT 60 /* seconds before techs spawn again */
|
||||
|
||||
#define CTF_GRAPPLE_SPEED 650 /* speed of grapple in flight */
|
||||
#define CTF_GRAPPLE_PULL_SPEED 650 /* speed player is pulled at */
|
||||
|
||||
void CTFInit(void);
|
||||
void CTFSpawn(void);
|
||||
void CTFPrecache(void);
|
||||
|
||||
void SP_info_player_team1(edict_t *self);
|
||||
void SP_info_player_team2(edict_t *self);
|
||||
|
||||
char *CTFTeamName(int team);
|
||||
char *CTFOtherTeamName(int team);
|
||||
void CTFAssignSkin(edict_t *ent, char *s);
|
||||
void CTFAssignTeam(gclient_t *who);
|
||||
edict_t *SelectCTFSpawnPoint(edict_t *ent);
|
||||
qboolean CTFPickup_Flag(edict_t *ent, edict_t *other);
|
||||
void CTFDrop_Flag(edict_t *ent, gitem_t *item);
|
||||
void CTFEffects(edict_t *player);
|
||||
void CTFCalcScores(void);
|
||||
void SetCTFStats(edict_t *ent);
|
||||
void CTFDeadDropFlag(edict_t *self);
|
||||
void CTFScoreboardMessage(edict_t *ent, edict_t *killer);
|
||||
void CTFTeam_f(edict_t *ent);
|
||||
void CTFID_f(edict_t *ent);
|
||||
void CTFSay_Team(edict_t *who, char *msg);
|
||||
void CTFFlagSetup(edict_t *ent);
|
||||
void CTFResetFlag(int ctf_team);
|
||||
void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
|
||||
void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
|
||||
|
||||
/* GRAPPLE */
|
||||
void CTFWeapon_Grapple(edict_t *ent);
|
||||
void CTFPlayerResetGrapple(edict_t *ent);
|
||||
void CTFGrapplePull(edict_t *self);
|
||||
void CTFResetGrapple(edict_t *self);
|
||||
|
||||
/* TECH */
|
||||
gitem_t *CTFWhat_Tech(edict_t *ent);
|
||||
qboolean CTFPickup_Tech(edict_t *ent, edict_t *other);
|
||||
void CTFDrop_Tech(edict_t *ent, gitem_t *item);
|
||||
void CTFDeadDropTech(edict_t *ent);
|
||||
void CTFSetupTechSpawn(void);
|
||||
int CTFApplyResistance(edict_t *ent, int dmg);
|
||||
int CTFApplyStrength(edict_t *ent, int dmg);
|
||||
qboolean CTFApplyStrengthSound(edict_t *ent);
|
||||
qboolean CTFApplyHaste(edict_t *ent);
|
||||
void CTFApplyHasteSound(edict_t *ent);
|
||||
void CTFApplyRegeneration(edict_t *ent);
|
||||
qboolean CTFHasRegeneration(edict_t *ent);
|
||||
void CTFRespawnTech(edict_t *ent);
|
||||
void CTFResetTech(void);
|
||||
|
||||
void CTFOpenJoinMenu(edict_t *ent);
|
||||
qboolean CTFStartClient(edict_t *ent);
|
||||
void CTFVoteYes(edict_t *ent);
|
||||
void CTFVoteNo(edict_t *ent);
|
||||
void CTFReady(edict_t *ent);
|
||||
void CTFNotReady(edict_t *ent);
|
||||
qboolean CTFNextMap(void);
|
||||
qboolean CTFMatchSetup(void);
|
||||
qboolean CTFMatchOn(void);
|
||||
void CTFGhost(edict_t *ent);
|
||||
void CTFAdmin(edict_t *ent);
|
||||
qboolean CTFInMatch(void);
|
||||
void CTFStats(edict_t *ent);
|
||||
void CTFWarp(edict_t *ent);
|
||||
void CTFBoot(edict_t *ent);
|
||||
void CTFPlayerList(edict_t *ent);
|
||||
|
||||
qboolean CTFCheckRules(void);
|
||||
|
||||
void SP_misc_ctf_banner(edict_t *ent);
|
||||
void SP_misc_ctf_small_banner(edict_t *ent);
|
||||
|
||||
extern char *ctf_statusbar;
|
||||
|
||||
void UpdateChaseCam(edict_t *ent);
|
||||
void ChaseNext(edict_t *ent);
|
||||
void ChasePrev(edict_t *ent);
|
||||
|
||||
void CTFObserver(edict_t *ent);
|
||||
|
||||
void SP_trigger_teleport(edict_t *ent);
|
||||
void SP_info_teleport_destination(edict_t *ent);
|
||||
|
||||
void CTFSetPowerUpEffect(edict_t *ent, int def);
|
||||
|
||||
/*
|
||||
* Uncomment for check that exported functions declarations are same as in
|
||||
* implementation. (-Wmissing-prototypes )
|
||||
|
|
Loading…
Reference in a new issue