summaryrefslogtreecommitdiff
path: root/src/fpsgame/game.h
diff options
context:
space:
mode:
authorxolatile2025-07-17 23:28:55 +0200
committerxolatile2025-07-17 23:28:55 +0200
commitc79dda69d6e603500a5681430172b5152041af0a (patch)
treec1669442318e77a9ae76009edd5eefcaa69064ce /src/fpsgame/game.h
parent5b88d873f42b1cad5c5fd03888cfe45b82da06d6 (diff)
downloadxolatile-badassbug-c79dda69d6e603500a5681430172b5152041af0a.tar.xz
xolatile-badassbug-c79dda69d6e603500a5681430172b5152041af0a.tar.zst
Big changed mentioned in IRC channel...
Diffstat (limited to 'src/fpsgame/game.h')
-rw-r--r--src/fpsgame/game.h180
1 files changed, 15 insertions, 165 deletions
diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h
index 9c4cb16..db1d394 100644
--- a/src/fpsgame/game.h
+++ b/src/fpsgame/game.h
@@ -36,38 +36,12 @@ enum // static entity types
I_QUAD,
TELEPORT, // attr1 = idx, attr2 = model, attr3 = tag
TELEDEST, // attr1 = angle, attr2 = idx
- MONSTER, // attr1 = angle, attr2 = monstertype
- CARROT, // attr1 = tag, attr2 = type
JUMPPAD, // attr1 = zpush, attr2 = ypush, attr3 = xpush
- BASE,
- RESPAWNPOINT,
- BOX, // attr1 = angle, attr2 = idx, attr3 = weight
- BARREL, // attr1 = angle, attr2 = idx, attr3 = weight, attr4 = health
- PLATFORM, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed
- ELEVATOR, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed
- FLAG, // attr1 = angle, attr2 = team
MAXENTTYPES
};
-enum
-{
- TRIGGER_RESET = 0,
- TRIGGERING,
- TRIGGERED,
- TRIGGER_RESETTING,
- TRIGGER_DISAPPEARED
-};
-
-struct fpsentity : extentity
-{
- int triggerstate, lasttrigger;
-
- fpsentity() : triggerstate(TRIGGER_RESET), lasttrigger(0) {}
-};
-
-enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, GUN_FIREBALL, GUN_ICEBALL, GUN_SLIMEBALL, GUN_BITE, GUN_BARREL, NUMGUNS };
+enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, NUMGUNS };
enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off
-enum { M_NONE = 0, M_SEARCH, M_HOME, M_ATTACKING, M_PAIN, M_SLEEP, M_AIMING }; // monster states
enum
{
@@ -76,20 +50,10 @@ enum
M_NOAMMO = 1<<2,
M_INSTA = 1<<3,
M_EFFICIENCY = 1<<4,
- M_TACTICS = 1<<5,
- M_CAPTURE = 1<<6,
- M_REGEN = 1<<7,
- M_CTF = 1<<8,
- M_PROTECT = 1<<9,
- M_HOLD = 1<<10,
M_EDIT = 1<<12,
M_DEMO = 1<<13,
M_LOCAL = 1<<14,
- M_LOBBY = 1<<15,
- M_DMSP = 1<<16,
- M_CLASSICSP = 1<<17,
- M_SLOWMO = 1<<18,
- M_COLLECT = 1<<19
+ M_LOBBY = 1<<15
};
static struct gamemodeinfo
@@ -99,8 +63,6 @@ static struct gamemodeinfo
const char *info;
} gamemodes[] =
{
- { "SP", M_LOCAL | M_CLASSICSP, NULL },
- { "DMSP", M_LOCAL | M_DMSP, NULL },
{ "demo", M_DEMO | M_LOCAL, NULL},
{ "ffa", M_LOBBY, "Free For All: Collect items for ammo. Frag everyone to score points." },
{ "coop edit", M_EDIT, "Cooperative Editing: Edit maps with multiple players simultaneously." },
@@ -109,25 +71,9 @@ static struct gamemodeinfo
{ "insta team", M_NOITEMS | M_INSTA | M_TEAM, "Instagib Team: You spawn with full rifle ammo and die instantly from one shot. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
{ "efficiency", M_NOITEMS | M_EFFICIENCY, "Efficiency: You spawn with all weapons and armour. There are no items. Frag everyone to score points." },
{ "effic team", M_NOITEMS | M_EFFICIENCY | M_TEAM, "Efficiency Team: You spawn with all weapons and armour. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
- { "tactics", M_NOITEMS | M_TACTICS, "Tactics: You spawn with two random weapons and armour. There are no items. Frag everyone to score points." },
- { "tac team", M_NOITEMS | M_TACTICS | M_TEAM, "Tactics Team: You spawn with two random weapons and armour. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
- { "capture", M_NOAMMO | M_TACTICS | M_CAPTURE | M_TEAM, "Capture: Capture neutral bases or steal \fs\f3enemy bases\fr by standing next to them. \fs\f1Your team\fr scores points for every 10 seconds it holds a base. You spawn with two random weapons and armour. Collect extra ammo that spawns at \fs\f1your bases\fr. There are no ammo items." },
- { "regen capture", M_NOITEMS | M_CAPTURE | M_REGEN | M_TEAM, "Regen Capture: Capture neutral bases or steal \fs\f3enemy bases\fr by standing next to them. \fs\f1Your team\fr scores points for every 10 seconds it holds a base. Regenerate health and ammo by standing next to \fs\f1your bases\fr. There are no items." },
- { "ctf", M_CTF | M_TEAM, "Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. Collect items for ammo." },
- { "insta ctf", M_NOITEMS | M_INSTA | M_CTF | M_TEAM, "Instagib Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "protect", M_CTF | M_PROTECT | M_TEAM, "Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. Collect items for ammo." },
- { "insta protect", M_NOITEMS | M_INSTA | M_CTF | M_PROTECT | M_TEAM, "Instagib Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "hold", M_CTF | M_HOLD | M_TEAM, "Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. Collect items for ammo." },
- { "insta hold", M_NOITEMS | M_INSTA | M_CTF | M_HOLD | M_TEAM, "Instagib Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "effic ctf", M_NOITEMS | M_EFFICIENCY | M_CTF | M_TEAM, "Efficiency Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. You spawn with all weapons and armour. There are no items." },
- { "effic protect", M_NOITEMS | M_EFFICIENCY | M_CTF | M_PROTECT | M_TEAM, "Efficiency Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. You spawn with all weapons and armour. There are no items." },
- { "effic hold", M_NOITEMS | M_EFFICIENCY | M_CTF | M_HOLD | M_TEAM, "Efficiency Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. You spawn with all weapons and armour. There are no items." },
- { "collect", M_COLLECT | M_TEAM, "Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. Collect items for ammo." },
- { "insta collect", M_NOITEMS | M_INSTA | M_COLLECT | M_TEAM, "Instagib Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "effic collect", M_NOITEMS | M_EFFICIENCY | M_COLLECT | M_TEAM, "Efficiency Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. You spawn with all weapons and armour. There are no items." }
};
-#define STARTGAMEMODE (-3)
+#define STARTGAMEMODE (-1)
#define NUMGAMEMODES ((int)(sizeof(gamemodes)/sizeof(gamemodes[0])))
#define m_valid(mode) ((mode) >= STARTGAMEMODE && (mode) < STARTGAMEMODE + NUMGAMEMODES)
@@ -139,16 +85,7 @@ static struct gamemodeinfo
#define m_noitems (m_check(gamemode, M_NOITEMS))
#define m_noammo (m_check(gamemode, M_NOAMMO|M_NOITEMS))
#define m_insta (m_check(gamemode, M_INSTA))
-#define m_tactics (m_check(gamemode, M_TACTICS))
#define m_efficiency (m_check(gamemode, M_EFFICIENCY))
-#define m_capture (m_check(gamemode, M_CAPTURE))
-#define m_capture_only (m_checkonly(gamemode, M_CAPTURE, M_REGEN))
-#define m_regencapture (m_checkall(gamemode, M_CAPTURE | M_REGEN))
-#define m_ctf (m_check(gamemode, M_CTF))
-#define m_ctf_only (m_checkonly(gamemode, M_CTF, M_PROTECT | M_HOLD))
-#define m_protect (m_checkall(gamemode, M_CTF | M_PROTECT))
-#define m_hold (m_checkall(gamemode, M_CTF | M_HOLD))
-#define m_collect (m_check(gamemode, M_COLLECT))
#define m_teammode (m_check(gamemode, M_TEAM))
#define isteam(a,b) (m_teammode && strcmp(a, b)==0)
@@ -159,10 +96,6 @@ static struct gamemodeinfo
#define m_botmode (m_checknot(gamemode, M_DEMO|M_LOCAL))
#define m_mp(mode) (m_checknot(mode, M_LOCAL))
-#define m_sp (m_check(gamemode, M_DMSP | M_CLASSICSP))
-#define m_dmsp (m_check(gamemode, M_DMSP))
-#define m_classicsp (m_check(gamemode, M_CLASSICSP))
-
enum { MM_AUTH = -1, MM_OPEN = 0, MM_VETO, MM_LOCKED, MM_PRIVATE, MM_PASSWORD, MM_START = MM_AUTH };
static const char * const mastermodenames[] = { "auth", "open", "veto", "locked", "private", "password" };
@@ -178,6 +111,7 @@ enum
S_PAIN1, S_PAIN2, S_PAIN3, S_PAIN4, S_PAIN5, S_PAIN6,
S_DIE1, S_DIE2,
S_FLAUNCH, S_FEXPLODE,
+ S_SPLASH1, S_SPLASH2,
S_JUMPPAD, S_PISTOL,
S_V_FIGHT,
@@ -207,11 +141,9 @@ enum
N_TIMEUP, N_FORCEINTERMISSION,
N_SERVMSG, N_ITEMLIST, N_RESUME,
N_EDITMODE, N_EDITENT, N_EDITF, N_EDITT, N_EDITM, N_FLIP, N_COPY, N_PASTE, N_ROTATE, N_REPLACE, N_DELCUBE, N_REMIP, N_EDITVSLOT, N_UNDO, N_REDO, N_NEWMAP, N_GETMAP, N_SENDMAP, N_CLIPBOARD, N_EDITVAR,
- N_MASTERMODE, N_KICK, N_CLEARBANS, N_CURRENTMASTER, N_SPECTATOR, N_SETMASTER, N_SETTEAM,
- N_BASES, N_BASEINFO, N_BASESCORE, N_REPAMMO, N_BASEREGEN, N_ANNOUNCE,
+ N_MASTERMODE, N_KICK, N_CLEARBANS, N_CURRENTMASTER, N_SPECTATOR, N_SETMASTER, N_SETTEAM, N_ANNOUNCE,
N_LISTDEMOS, N_SENDDEMOLIST, N_GETDEMO, N_SENDDEMO,
N_DEMOPLAYBACK, N_RECORDDEMO, N_STOPDEMO, N_CLEARDEMOS,
- N_TAKEFLAG, N_RETURNFLAG, N_RESETFLAG, N_INVISFLAG, N_TRYDROPFLAG, N_DROPFLAG, N_SCOREFLAG, N_INITFLAGS,
N_SAYTEAM,
N_CLIENT,
N_AUTHTRY, N_AUTHKICK, N_AUTHCHAL, N_AUTHANS, N_REQAUTH,
@@ -237,11 +169,9 @@ static const int msgsizes[] = // size inclusive message token, 0 f
N_TIMEUP, 2, N_FORCEINTERMISSION, 1,
N_SERVMSG, 0, N_ITEMLIST, 0, N_RESUME, 0,
N_EDITMODE, 2, N_EDITENT, 11, N_EDITF, 16, N_EDITT, 16, N_EDITM, 16, N_FLIP, 14, N_COPY, 14, N_PASTE, 14, N_ROTATE, 15, N_REPLACE, 17, N_DELCUBE, 14, N_REMIP, 1, N_EDITVSLOT, 16, N_UNDO, 0, N_REDO, 0, N_NEWMAP, 2, N_GETMAP, 1, N_SENDMAP, 0, N_EDITVAR, 0,
- N_MASTERMODE, 2, N_KICK, 0, N_CLEARBANS, 1, N_CURRENTMASTER, 0, N_SPECTATOR, 3, N_SETMASTER, 0, N_SETTEAM, 0,
- N_BASES, 0, N_BASEINFO, 0, N_BASESCORE, 0, N_REPAMMO, 1, N_BASEREGEN, 6, N_ANNOUNCE, 2,
+ N_MASTERMODE, 2, N_KICK, 0, N_CLEARBANS, 1, N_CURRENTMASTER, 0, N_SPECTATOR, 3, N_SETMASTER, 0, N_SETTEAM, 0, N_ANNOUNCE, 2,
N_LISTDEMOS, 1, N_SENDDEMOLIST, 0, N_GETDEMO, 3, N_SENDDEMO, 0,
N_DEMOPLAYBACK, 3, N_RECORDDEMO, 2, N_STOPDEMO, 1, N_CLEARDEMOS, 2,
- N_TAKEFLAG, 3, N_RETURNFLAG, 4, N_RESETFLAG, 6, N_INVISFLAG, 3, N_TRYDROPFLAG, 1, N_DROPFLAG, 7, N_SCOREFLAG, 10, N_INITFLAGS, 0,
N_SAYTEAM, 0,
N_CLIENT, 0,
N_AUTHTRY, 0, N_AUTHKICK, 0, N_AUTHCHAL, 0, N_AUTHANS, 0, N_REQAUTH, 0,
@@ -290,10 +220,6 @@ enum
HICON_QUAD,
- HICON_RED_FLAG,
- HICON_BLUE_FLAG,
- HICON_NEUTRAL_FLAG,
-
HICON_TOKEN,
HICON_X = 20,
@@ -319,25 +245,21 @@ static struct itemstat { int add, max, sound; const char *name; int icon, info;
{20000, 30000, S_ITEMPUP, "Q", HICON_QUAD, -1},
};
-#define MAXRAYS 20
+#define MAXRAYS 12
#define EXP_SELFDAMDIV 2
#define EXP_SELFPUSH 2.5f
#define EXP_DISTSCALE 1.5f
static const struct guninfo { int sound, attackdelay, damage, spread, projspeed, kickamount, range, rays, hitpush, exprad, ttl; const char *name, *file; short part; } guns[NUMGUNS] =
{
- { S_PUNCH1, 250, 50, 0, 0, 0, 14, 1, 80, 0, 0, "fist", "fist", 0 },
- { S_SG, 1400, 10, 400, 0, 20, 1024, 20, 80, 0, 0, "shotgun", "shotg", 0 },
- { S_CG, 100, 30, 100, 0, 7, 1024, 1, 80, 0, 0, "chaingun", "chaing", 0 },
- { S_RLFIRE, 800, 120, 0, 320, 10, 1024, 1, 160, 40, 0, "rocketlauncher", "rocket", 0 },
- { S_RIFLE, 1500, 100, 0, 0, 30, 2048, 1, 80, 0, 0, "rifle", "rifle", 0 },
- { S_FLAUNCH, 600, 90, 0, 200, 10, 1024, 1, 250, 45, 1500, "grenadelauncher", "gl", 0 },
- { S_PISTOL, 500, 35, 50, 0, 7, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 },
- { S_FLAUNCH, 200, 20, 0, 200, 1, 1024, 1, 80, 40, 0, "fireball", NULL, PART_FIREBALL1 },
- { S_ICEBALL, 200, 40, 0, 120, 1, 1024, 1, 80, 40, 0, "iceball", NULL, PART_FIREBALL2 },
- { S_SLIMEBALL, 200, 30, 0, 640, 1, 1024, 1, 80, 40, 0, "slimeball", NULL, PART_FIREBALL3 },
- { S_PIGR1, 250, 50, 0, 0, 1, 12, 1, 80, 0, 0, "bite", NULL, 0 },
- { -1, 0, 120, 0, 0, 0, 0, 1, 80, 40, 0, "barrel", NULL, 0 }
+ // delay| dmg| spr| spd| kck| rng| ray| pus| exp|
+ { S_PUNCH1, 100, 30, 0, 0, 0, 30, 1, 80, 0, 0, "fist", "fist", 0 },
+ { S_SG, 1000, 20, 280, 0, 20, 1024, MAXRAYS, 80, 0, 0, "shotgun", "shotg", 0 },
+ { S_CG, 100, 20, 70, 0, 10, 1024, 1, 80, 0, 0, "chaingun", "chaing", 0 },
+ { S_RLFIRE, 800, 120, 0, 270, 10, 1024, 1, 160, 40, 0, "rocketlauncher", "rocket", 0 },
+ { S_RIFLE, 1200, 120, 0, 0, 30, 2048, 1, 80, 0, 0, "rifle", "rifle", 0 },
+ { S_FLAUNCH, 600, 90, 0, 300, 20, 1024, 1, 250, 45, 1500, "grenadelauncher", "gl", 0 },
+ { S_PISTOL, 400, 60, 160, 0, 10, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 },
};
#include "ai.h"
@@ -439,30 +361,6 @@ struct fpsstate
gunselect = GUN_RIFLE;
ammo[GUN_RIFLE] = 100;
}
- else if(m_regencapture)
- {
- extern int regenbluearmour;
- if(regenbluearmour)
- {
- armourtype = A_BLUE;
- armour = 25;
- }
- gunselect = GUN_PISTOL;
- ammo[GUN_PISTOL] = 40;
- ammo[GUN_GL] = 1;
- }
- else if(m_tactics)
- {
- armourtype = A_GREEN;
- armour = 100;
- ammo[GUN_PISTOL] = 40;
- int spawngun1 = rnd(5)+1, spawngun2;
- gunselect = spawngun1;
- baseammo(spawngun1, m_noitems ? 2 : 1);
- do spawngun2 = rnd(5)+1; while(spawngun1==spawngun2);
- baseammo(spawngun2, m_noitems ? 2 : 1);
- if(m_noitems) ammo[GUN_GL] += 1;
- }
else if(m_efficiency)
{
armourtype = A_GREEN;
@@ -471,23 +369,6 @@ struct fpsstate
gunselect = GUN_CG;
ammo[GUN_CG] /= 2;
}
- else if(m_ctf || m_collect)
- {
- armourtype = A_BLUE;
- armour = 50;
- ammo[GUN_PISTOL] = 40;
- ammo[GUN_GL] = 1;
- }
- else if(m_sp)
- {
- if(m_dmsp)
- {
- armourtype = A_BLUE;
- armour = 25;
- }
- ammo[GUN_PISTOL] = 80;
- ammo[GUN_GL] = 1;
- }
else
{
armourtype = A_BLUE;
@@ -635,8 +516,6 @@ namespace entities
extern void preloadentities();
extern void renderentities();
- extern void resettriggers();
- extern void checktriggers();
extern void checkitems(fpsent *d);
extern void checkquad(int time, fpsent *d);
extern void resetspawns();
@@ -736,7 +615,6 @@ namespace game
extern bool addmsg(int type, const char *fmt = NULL, ...);
extern void switchname(const char *name);
extern void switchteam(const char *name);
- extern void switchplayermodel(int playermodel);
extern void sendmapinfo();
extern void stopdemo();
extern void changemap(const char *name, int mode);
@@ -744,32 +622,6 @@ namespace game
extern void c2sinfo(bool force = false);
extern void sendposition(fpsent *d, bool reliable = false);
- // monster
- struct monster;
- extern vector<monster *> monsters;
-
- extern void clearmonsters();
- extern void preloadmonsters();
- extern void stackmonster(monster *d, physent *o);
- extern void updatemonsters(int curtime);
- extern void rendermonsters();
- extern void suicidemonster(monster *m);
- extern void hitmonster(int damage, monster *m, fpsent *at, const vec &vel, int gun);
- extern void monsterkilled();
- extern void endsp(bool allkilled);
- extern void spsummary(int accuracy);
-
- // movable
- struct movable;
- extern vector<movable *> movables;
-
- extern void clearmovables();
- extern void stackmovable(movable *d, physent *o);
- extern void updatemovables(int curtime);
- extern void rendermovables();
- extern void suicidemovable(movable *m);
- extern void hitmovable(int damage, movable *m, fpsent *at, const vec &vel, int gun);
-
// weapon
extern int getweapon(const char *name);
extern void shoot(fpsent *d, const vec &targ);
@@ -818,9 +670,7 @@ namespace game
extern void saveragdoll(fpsent *d);
extern void clearragdolls();
extern void moveragdolls();
- extern void changedplayermodel();
extern const playermodelinfo &getplayermodelinfo(fpsent *d);
- extern int chooserandomplayermodel(int seed);
extern void swayhudgun(int curtime);
extern vec hudgunorigin(int gun, const vec &from, const vec &to, fpsent *d);
}