ref: 637632627d9eac3035ac0d9f07f252ab4a10ae71
parent: 762a13333eba9d50e5b186e7047f77d541d34d1a
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Thu Mar 26 20:24:04 EDT 2015
merge edict_t definitions, really include everything from everywhere remove useless dat.h and fns.h. edict_t shit done blindly!
--- a/README
+++ b/README
@@ -1,5 +1,24 @@
qk2 - (9) quake 2
=================
+ - game data is stored in $home/lib/quake2/
+ - 386 and amd64 only
+
+
+horrors
+-------
+ - fault read when warping screen underwater
+ - rendering glitches on screen borders
+ - rendering glitches underwater
+ - #pragma pack on set globally
+ - edict_t definitions merged without much looking
+ - q_sh9: stupid posixish glob stuff
+ - portme: net_udp, cd_9
+ - garbled stdout: Sys_ConsoleOutput
+ - race between mproc and IN_Commands
+ - cinematic palette is fucked up if you resize during playback
+ - sound only works thanks to shitty workarounds
+ - bad/unsafe rename() implementation
+ - ctf is untouched, so are rogue, xatrix
legal
--- a/client/cl_cin.c
+++ b/client/cl_cin.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
typedef struct
{
--- a/client/cl_ents.c
+++ b/client/cl_ents.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
extern struct model_s *cl_mod_powerscreen;
--- a/client/cl_fx.c
+++ b/client/cl_fx.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
void CL_LogoutEffect (vec3_t org, int type);
void CL_ItemRespawnParticles (vec3_t org);
--- a/client/cl_input.c
+++ b/client/cl_input.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
cvar_t *cl_nodelta;
--- a/client/cl_inv.c
+++ b/client/cl_inv.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
================
--- a/client/cl_main.c
+++ b/client/cl_main.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
cvar_t *freelook;
--- a/client/cl_newfx.c
+++ b/client/cl_newfx.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
extern cparticle_t *active_particles, *free_particles;
extern cparticle_t particles[MAX_PARTICLES];
--- a/client/cl_parse.c
+++ b/client/cl_parse.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
char *svc_strings[256] =
{
--- a/client/cl_pred.c
+++ b/client/cl_pred.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
--- a/client/cl_scrn.c
+++ b/client/cl_scrn.c
@@ -35,8 +35,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
float scr_con_current; // aproaches scr_conlines at scr_conspeed
float scr_conlines; // 0.0 to 1.0 lines of console to display
--- a/client/cl_tent.c
+++ b/client/cl_tent.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
typedef enum
{
--- a/client/cl_view.c
+++ b/client/cl_view.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
//=============
//
--- a/client/client.h
+++ b/client/client.h
@@ -24,7 +24,6 @@
#pragma pack off
//=============================================================================
-
typedef struct
{
qboolean valid; // cleared if delta parsing was invalid
@@ -156,7 +155,6 @@
} client_state_t;
extern client_state_t cl;
-
/*
==================================================================
@@ -569,4 +567,4 @@
unsigned long *x86_TimerGetHistogram( void );
#endif
-#pragma pack off
+#pragma pack on
--- a/client/console.c
+++ b/client/console.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
console_t con;
--- a/client/keys.c
+++ b/client/keys.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
--- a/client/menu.c
+++ b/client/menu.c
@@ -21,8 +21,7 @@
#include <libc.h>
#include <stdio.h>
#include <ctype.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
static int m_main_cursor;
--- a/client/qmenu.c
+++ b/client/qmenu.c
@@ -22,8 +22,7 @@
#include <libc.h>
#include <stdio.h>
#include <ctype.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
void Action_DoEnter( menuaction_s *a );
void Action_Draw( menuaction_s *a );
--- a/client/snd_dma.c
+++ b/client/snd_dma.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
void S_Play(void);
void S_SoundList(void);
--- a/client/snd_mem.c
+++ b/client/snd_mem.c
@@ -21,8 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
int cache_full_cycle;
--- a/client/snd_mix.c
+++ b/client/snd_mix.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define PAINTBUFFER_SIZE 2048
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
--- a/dat.h
+++ /dev/null
@@ -1,30 +1,0 @@
-/* FIXME: separate fns + merge some */
-/* common */
-#include "../q_shared.h"
-/* game dll */
-#include "../game/game.h"
-/* ctf dll */
-/*
-#include "../ctf/game.h"
-#include "../ctf/p_menu.h"
-#include "../ctf/g_ctf.h"
-*/
-/* more common */
-#include "../qcommon/qcommon.h"
-#include "../qcommon/qfiles.h"
-/* client */
-#include "../client/cdaudio.h"
-#include "../client/ref.h"
-#include "../client/vid.h"
-#include "../client/screen.h"
-#include "../client/snd_loc.h"
-#include "../client/sound.h"
-#include "../client/input.h"
-#include "../client/keys.h"
-#include "../client/console.h"
-#include "../client/client.h"
-#include "../client/qmenu.h"
-/* refresh */
-#include "../ref/r_local.h"
-/* server */
-#include "../server/server.h"
--- a/game/g_ai.c
+++ b/game/g_ai.c
@@ -17,13 +17,10 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define GAME_INCLUDE
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
qboolean FindTarget (edict_t *self);
extern cvar_t *maxclients;
--- a/game/g_chase.c
+++ b/game/g_chase.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
void UpdateChaseCam(edict_t *ent)
{
--- a/game/g_cmds.c
+++ b/game/g_cmds.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_player.h"
--- a/game/g_combat.c
+++ b/game/g_combat.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*
============
--- a/game/g_func.c
+++ b/game/g_func.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*
=========================================================
--- a/game/g_items.c
+++ b/game/g_items.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
qboolean Pickup_Weapon (edict_t *ent, edict_t *other);
--- a/game/g_local.h
+++ b/game/g_local.h
@@ -26,16 +26,6 @@
// the "gameversion" client command will print this plus compile date
#define GAMEVERSION "baseq2"
-// protocol bytes that can be directly added to messages
-#define svc_muzzleflash 1
-#define svc_muzzleflash2 2
-#define svc_temp_entity 3
-#define svc_layout 4
-#define svc_inventory 5
-#define svc_stufftext 11
-
-//==================================================================
-
// view pitching times
#define DAMAGE_TIME 0.5
#define FALL_TIME 0.3
@@ -542,7 +532,7 @@
extern cvar_t *sv_maplist;
-#define world (&g_edicts[0])
+#define WORLD (&g_edicts[0])
// item spawnflags
#define ITEM_TRIGGER_SPAWN 0x00000001
--- a/game/g_main.c
+++ b/game/g_main.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
game_locals_t game;
level_locals_t level;
--- a/game/g_misc.c
+++ b/game/g_misc.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*QUAKED func_group (0 0 0) ?
--- a/game/g_monster.c
+++ b/game/g_monster.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
//
@@ -240,7 +238,7 @@
dmg = 2 + 2 * floor(level.time - ent->air_finished);
if (dmg > 15)
dmg = 15;
- T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
+ T_Damage (ent, WORLD, WORLD, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
ent->pain_debounce_time = level.time + 1;
}
}
@@ -258,7 +256,7 @@
dmg = 2 + 2 * floor(level.time - ent->air_finished);
if (dmg > 15)
dmg = 15;
- T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
+ T_Damage (ent, WORLD, WORLD, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
ent->pain_debounce_time = level.time + 1;
}
}
@@ -280,7 +278,7 @@
if (ent->damage_debounce_time < level.time)
{
ent->damage_debounce_time = level.time + 0.2;
- T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 10*ent->waterlevel, 0, 0, MOD_LAVA);
+ T_Damage (ent, WORLD, WORLD, vec3_origin, ent->s.origin, vec3_origin, 10*ent->waterlevel, 0, 0, MOD_LAVA);
}
}
if ((ent->watertype & CONTENTS_SLIME) && !(ent->flags & FL_IMMUNE_SLIME))
@@ -288,7 +286,7 @@
if (ent->damage_debounce_time < level.time)
{
ent->damage_debounce_time = level.time + 1;
- T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 4*ent->waterlevel, 0, 0, MOD_SLIME);
+ T_Damage (ent, WORLD, WORLD, vec3_origin, ent->s.origin, vec3_origin, 4*ent->waterlevel, 0, 0, MOD_SLIME);
}
}
--- a/game/g_phys.c
+++ b/game/g_phys.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*
--- a/game/g_save.c
+++ b/game/g_save.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#define Function(f) {#f, f}
--- a/game/g_spawn.c
+++ b/game/g_spawn.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
typedef struct
{
--- a/game/g_svcmds.c
+++ b/game/g_svcmds.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
void Svcmd_Test_f (void)
--- a/game/g_target.c
+++ b/game/g_target.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8)
Fire an origin based temp entity event to the clients.
@@ -285,7 +283,7 @@
}
// if noexit, do a ton of damage to other
- if (deathmatch->value && !( (int)dmflags->value & DF_ALLOW_EXIT) && other != world)
+ if (deathmatch->value && !( (int)dmflags->value & DF_ALLOW_EXIT) && other != WORLD)
{
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 10 * other->max_health, 1000, 0, MOD_EXIT);
return;
--- a/game/g_trigger.c
+++ b/game/g_trigger.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
void InitTrigger (edict_t *self)
--- a/game/g_turret.c
+++ b/game/g_turret.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
void AnglesNormalize(vec3_t vec)
--- a/game/g_utils.c
+++ b/game/g_utils.c
@@ -22,9 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
--- a/game/g_weapon.c
+++ b/game/g_weapon.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*
--- a/game/game.h
+++ b/game/game.h
@@ -52,47 +52,6 @@
typedef struct gclient_t gclient_t;
-#ifndef GAME_INCLUDE
-
-struct gclient_t
-{
- 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_t
-{
- entity_state_t s;
- gclient_t *client;
- qboolean inuse;
- int linkcount;
-
- // FIXME: move these fields to a server private sv_entity_t
- 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;
-
- // the game dll can add anything it wants after
- // this point in the structure
-};
-
-#endif // GAME_INCLUDE
-
//===============================================================
//
--- a/game/m_actor.c
+++ b/game/m_actor.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_actor.h"
#define MAX_ACTOR_NAMES 8
--- a/game/m_berserk.c
+++ b/game/m_berserk.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_berserk.h"
--- a/game/m_boss2.c
+++ b/game/m_boss2.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_boss2.h"
void BossExplode (edict_t *self);
--- a/game/m_boss3.c
+++ b/game/m_boss3.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_boss32.h"
void Use_Boss3 (edict_t *ent, edict_t */*other*/, edict_t */*activator*/)
--- a/game/m_boss31.c
+++ b/game/m_boss31.c
@@ -22,9 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_boss31.h"
extern SP_monster_makron (edict_t *self);
--- a/game/m_boss32.c
+++ b/game/m_boss32.c
@@ -22,9 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_boss32.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_brain.c
+++ b/game/m_brain.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_brain.h"
--- a/game/m_chick.c
+++ b/game/m_chick.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_chick.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_flash.c
+++ b/game/m_flash.c
@@ -21,8 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
// this file is included in both the game dll and quake2,
// the game needs it to source shot locations, the client
--- a/game/m_flipper.c
+++ b/game/m_flipper.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_flipper.h"
--- a/game/m_float.c
+++ b/game/m_float.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_float.h"
--- a/game/m_flyer.c
+++ b/game/m_flyer.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_flyer.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_gladiator.c
+++ b/game/m_gladiator.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_gladiator.h"
--- a/game/m_gunner.c
+++ b/game/m_gunner.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_gunner.h"
--- a/game/m_hover.c
+++ b/game/m_hover.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_hover.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_infantry.c
+++ b/game/m_infantry.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_infantry.h"
void InfantryMachineGun (edict_t *self);
--- a/game/m_insane.c
+++ b/game/m_insane.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_insane.h"
--- a/game/m_medic.c
+++ b/game/m_medic.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_medic.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_move.c
+++ b/game/m_move.c
@@ -22,9 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#define STEPSIZE 18
--- a/game/m_mutant.c
+++ b/game/m_mutant.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_mutant.h"
--- a/game/m_parasite.c
+++ b/game/m_parasite.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_parasite.h"
--- a/game/m_soldier.c
+++ b/game/m_soldier.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_soldier.h"
--- a/game/m_supertank.c
+++ b/game/m_supertank.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_supertank.h"
qboolean visible (edict_t *self, edict_t *other);
--- a/game/m_tank.c
+++ b/game/m_tank.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_tank.h"
--- a/game/p_client.c
+++ b/game/p_client.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_player.h"
void ClientUserinfoChanged (edict_t *ent, char *userinfo);
@@ -470,11 +468,11 @@
{
vec3_t dir;
- if (attacker && attacker != world && attacker != self)
+ if (attacker && attacker != WORLD && attacker != self)
{
VectorSubtract (attacker->s.origin, self->s.origin, dir);
}
- else if (inflictor && inflictor != world && inflictor != self)
+ else if (inflictor && inflictor != WORLD && inflictor != self)
{
VectorSubtract (inflictor->s.origin, self->s.origin, dir);
}
--- a/game/p_hud.c
+++ b/game/p_hud.c
@@ -21,11 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
-
-
+#include "../q_shared.h"
/*
======================================================================
--- a/game/p_trail.c
+++ b/game/p_trail.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
/*
--- a/game/p_view.c
+++ b/game/p_view.c
@@ -21,13 +21,10 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_player.h"
-
static edict_t *current_player;
static gclient_t *current_client;
@@ -565,7 +562,7 @@
VectorSet (dir, 0, 0, 1);
if (!deathmatch->value || !((int)dmflags->value & DF_NO_FALLING) )
- T_Damage (ent, world, world, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING);
+ T_Damage (ent, WORLD, WORLD, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING);
}
else
{
@@ -697,7 +694,7 @@
current_player->pain_debounce_time = level.time;
- T_Damage (current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, current_player->dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
+ T_Damage (current_player, WORLD, WORLD, vec3_origin, current_player->s.origin, vec3_origin, current_player->dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
}
}
}
@@ -726,9 +723,9 @@
}
if (envirosuit) // take 1/3 damage with envirosuit
- T_Damage (current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 1*waterlevel, 0, 0, MOD_LAVA);
+ T_Damage (current_player, WORLD, WORLD, vec3_origin, current_player->s.origin, vec3_origin, 1*waterlevel, 0, 0, MOD_LAVA);
else
- T_Damage (current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 3*waterlevel, 0, 0, MOD_LAVA);
+ T_Damage (current_player, WORLD, WORLD, vec3_origin, current_player->s.origin, vec3_origin, 3*waterlevel, 0, 0, MOD_LAVA);
}
if (current_player->watertype & CONTENTS_SLIME)
@@ -735,7 +732,7 @@
{
if (!envirosuit)
{ // no damage from slime with envirosuit
- T_Damage (current_player, world, world, vec3_origin, current_player->s.origin, vec3_origin, 1*waterlevel, 0, 0, MOD_SLIME);
+ T_Damage (current_player, WORLD, WORLD, vec3_origin, current_player->s.origin, vec3_origin, 1*waterlevel, 0, 0, MOD_SLIME);
}
}
}
--- a/game/p_weapon.c
+++ b/game/p_weapon.c
@@ -21,9 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
-#include "g_local.h"
+#include "../q_shared.h"
#include "m_player.h"
--- a/game/q_shared.c
+++ b/game/q_shared.c
@@ -21,8 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define DEG2RAD( a ) ( a * M_PI ) / 180.0F
--- a/mkfile
+++ b/mkfile
@@ -282,8 +282,6 @@
HFILES=\
anorms.h\
- dat.h\
- fns.h\
q_shared.h\
$CLHFILES\
$SVHFILES\
@@ -292,12 +290,10 @@
$RFHFILES\
$GMHFILES\
-CLEANFILES=$OFILES
+# FIXME
+CLEANFILES=$OFILES */*.acid
</sys/src/cmd/mkone
-
-# FIXME
-CFLAGS=-FVw
%.$O: %.c
$CC -o $target $CFLAGS $stem.c
--- a/plan9/cd_9.c
+++ b/plan9/cd_9.c
@@ -1,8 +1,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
qboolean cdValid = false;
qboolean playing = false;
--- a/plan9/in_9.c
+++ b/plan9/in_9.c
@@ -5,8 +5,7 @@
#include <thread.h>
#include <mouse.h>
#include <keyboard.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
cvar_t *in_mouse;
cvar_t *in_joystick;
--- a/plan9/net_udp.c
+++ b/plan9/net_udp.c
@@ -4,8 +4,7 @@
#include <ctype.h>
#include <bio.h>
#include <ndb.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/* FIXME: only loopback works, the rest is complete bullshit */
--- a/plan9/q_sh9.c
+++ b/plan9/q_sh9.c
@@ -1,8 +1,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
byte *membase;
int maxhunksize;
--- a/plan9/rw_9.c
+++ b/plan9/rw_9.c
@@ -3,8 +3,7 @@
#include <draw.h>
#include <stdio.h>
#include <ctype.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
qboolean rwon;
uchar *framebuf;
--- a/plan9/snd_9.c
+++ b/plan9/snd_9.c
@@ -2,8 +2,7 @@
#include <libc.h>
#include <stdio.h>
#include <thread.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
int sndon;
--- a/plan9/sys_9.c
+++ b/plan9/sys_9.c
@@ -3,8 +3,7 @@
#include <stdio.h>
#include <ctype.h>
#include <thread.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
mainstacksize = 512*1024; /* FIXME */
--- a/plan9/vid_menu.c
+++ b/plan9/vid_menu.c
@@ -1,8 +1,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
extern cvar_t *vid_fullscreen;
extern cvar_t *vid_gamma;
--- a/plan9/vid_so.c
+++ b/plan9/vid_so.c
@@ -1,8 +1,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
refexport_t GetRefAPI(refimport_t);
--- a/q_shared.h
+++ b/q_shared.h
@@ -1152,3 +1152,31 @@
extern int vidref_val;
// PGM
// ==================
+
+/* FIXME: figure out how to do this cleanly without kilometric headers */
+
+/* game dll */
+#include "../game/game.h" /* baseq2 */
+#include "../game/g_local.h"
+//#include "../ctf/game.h" /* ctf */
+//#include "../ctf/p_menu.h"
+//#include "../ctf/g_ctf.h"
+/* common */
+#include "../qcommon/qcommon.h"
+#include "../qcommon/qfiles.h"
+/* client */
+#include "../client/cdaudio.h"
+#include "../client/ref.h"
+#include "../client/vid.h"
+#include "../client/screen.h"
+#include "../client/snd_loc.h"
+#include "../client/sound.h"
+#include "../client/input.h"
+#include "../client/keys.h"
+#include "../client/console.h"
+#include "../client/client.h"
+#include "../client/qmenu.h"
+/* refresh */
+#include "../ref/r_local.h"
+/* server */
+#include "../server/server.h"
--- a/qcommon/cmd.c
+++ b/qcommon/cmd.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
void Cmd_ForwardToServer (void);
--- a/qcommon/cmodel.c
+++ b/qcommon/cmodel.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
typedef struct
{
--- a/qcommon/common.c
+++ b/qcommon/common.c
@@ -21,8 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define MAXPRINTMSG 4096
--- a/qcommon/crc.c
+++ b/qcommon/crc.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
// this is a 16 bit, non-reflected CRC using the polynomial 0x1021
// and the initial and final xor values shown below... in other words, the
--- a/qcommon/cvar.c
+++ b/qcommon/cvar.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
cvar_t *cvar_vars;
--- a/qcommon/files.c
+++ b/qcommon/files.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
// define this to dissalow any data but the demo pak file
//#define NO_ADDONS
--- a/qcommon/md4.c
+++ b/qcommon/md4.c
@@ -3,8 +3,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
--- a/qcommon/net_chan.c
+++ b/qcommon/net_chan.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
--- a/qcommon/pmove.c
+++ b/qcommon/pmove.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define STEPSIZE 18
--- a/qcommon/qcommon.h
+++ b/qcommon/qcommon.h
@@ -195,7 +195,7 @@
//==================
//
-// server to client
+// server to client: protocol bytes that can be directly added to messages
//
enum svc_ops_e
{
--- a/qcommon/qfiles.h
+++ b/qcommon/qfiles.h
@@ -296,13 +296,11 @@
// without walking the bsp tree
} dmodel_t;
-
typedef struct
{
float point[3];
} dvertex_t;
-
// 0-2 are axial planes
#define PLANE_X 0
#define PLANE_Y 1
@@ -322,7 +320,6 @@
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
} dplane_t;
-
// contents flags are seperate bits
// a given brush can contribute multiple content bits
// multiple brushes can be in a single leaf
@@ -377,8 +374,6 @@
#define SURF_NODRAW 0x80 // don't bother referencing the texture
*/
-
-
typedef struct
{
int planenum;
@@ -389,7 +384,6 @@
unsigned short numfaces; // counting both sides
} dnode_t;
-
typedef struct texinfo_s
{
float vecs[2][4]; // [s/t][xyz offset]
@@ -398,7 +392,6 @@
char texture[32]; // texture name (textures/*.wal)
int nexttexinfo; // for animations, -1 = end of chain
} texinfo_t;
-
// note that edge 0 is never used, because negative edge nums are used for
// counterclockwise use of the edge in a face
--- a/ref/r_aclip.c
+++ b/ref/r_aclip.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
static finalvert_t fv[2][8];
--- a/ref/r_alias.c
+++ b/ref/r_alias.c
@@ -25,8 +25,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the
// need for inner-loop light clamping
--- a/ref/r_bsp.c
+++ b/ref/r_bsp.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
//
// current entity info
--- a/ref/r_draw.c
+++ b/ref/r_draw.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
image_t *draw_chars; // 8*8 graphic characters
--- a/ref/r_edge.c
+++ b/ref/r_edge.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
void R_SurfacePatch (void)
{
--- a/ref/r_image.c
+++ b/ref/r_image.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define MAX_RIMAGES 1024
--- a/ref/r_light.c
+++ b/ref/r_light.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
int r_dlightframecount;
--- a/ref/r_local.h
+++ b/ref/r_local.h
@@ -1039,4 +1039,3 @@
void SWimp_Shutdown( void );
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );
void SWimp_AppActivate( qboolean active );
-
--- a/ref/r_main.c
+++ b/ref/r_main.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
viddef_t vid;
refimport_t ri;
--- a/ref/r_misc.c
+++ b/ref/r_misc.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define NUM_MIPS 4
--- a/ref/r_model.c
+++ b/ref/r_model.c
@@ -25,8 +25,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
model_t *loadmodel;
char loadname[32]; // for hunk tags
--- a/ref/r_part.c
+++ b/ref/r_part.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
vec3_t r_pright, r_pup, r_ppn;
--- a/ref/r_poly.c
+++ b/ref/r_poly.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define AFFINE_SPANLET_SIZE 16
#define AFFINE_SPANLET_SIZE_BITS 4
--- a/ref/r_polyse.c
+++ b/ref/r_polyse.c
@@ -23,8 +23,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
int rand1k[] = {
#include "rand1k.h"
--- a/ref/r_rast.c
+++ b/ref/r_rast.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
#define MAXLEFTCLIPEDGES 100
--- a/ref/r_scan.c
+++ b/ref/r_scan.c
@@ -21,8 +21,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
unsigned char *r_turb_pbase, *r_turb_pdest;
fixed16_t r_turb_s, r_turb_t, r_turb_sstep, r_turb_tstep;
--- a/ref/r_sprite.c
+++ b/ref/r_sprite.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
extern polydesc_t r_polydesc;
--- a/ref/r_surf.c
+++ b/ref/r_surf.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
drawsurf_t r_drawsurf;
--- a/server/sv_ccmds.c
+++ b/server/sv_ccmds.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
===============================================================================
--- a/server/sv_ents.c
+++ b/server/sv_ents.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
=============================================================================
--- a/server/sv_game.c
+++ b/server/sv_game.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
game_export_t *ge;
--- a/server/sv_init.c
+++ b/server/sv_init.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
server_static_t svs; // persistant server info
server_t sv; // local server
--- a/server/sv_main.c
+++ b/server/sv_main.c
@@ -20,8 +20,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
netadr_t master_adr[MAX_MASTERS]; // address of group servers
--- a/server/sv_send.c
+++ b/server/sv_send.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
=============================================================================
--- a/server/sv_user.c
+++ b/server/sv_user.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
edict_t *sv_player;
--- a/server/sv_world.c
+++ b/server/sv_world.c
@@ -22,8 +22,7 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
-#include "../dat.h"
-#include "../fns.h"
+#include "../q_shared.h"
/*
===============================================================================