mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-12 13:42:21 +00:00
* Removed old turd makefile from game/ctf
* Removed ctf/game.h as it's in the dir above it * merged difference of ctf/game.h into game.h (they were all comments)
This commit is contained in:
parent
89ea530ad9
commit
c85e0a0450
3 changed files with 7 additions and 410 deletions
|
@ -1,159 +0,0 @@
|
|||
#
|
||||
# Quake2 gamei386.so Makefile for Linux 2.0
|
||||
#
|
||||
# Jan '98 by Zoid <zoid@idsoftware.com>
|
||||
#
|
||||
# ELF only
|
||||
#
|
||||
# Probably requires GNU make
|
||||
#
|
||||
# This builds the gamei386.so for Linux based on the q2source_12_11.zip
|
||||
# release.
|
||||
# Put his Makefile in the game subdirectory you get when you unzip
|
||||
# q2source_12_11.zip.
|
||||
#
|
||||
# There are two compiler errors you'll get, the following fixes
|
||||
# are necessary:
|
||||
#
|
||||
# In g_local.h (around line 828), you must change the
|
||||
# typedef struct g_client_s { ... } gclient_t;
|
||||
# to just:
|
||||
# struct g_client_s { ... };
|
||||
# The typedef is already defined elsewhere (seems to compile fine under
|
||||
# MSCV++ for Win32 for some reason).
|
||||
#
|
||||
# m_player.h has a Ctrl-Z at the end (damn DOS editors). Remove it or
|
||||
# gcc complains.
|
||||
#
|
||||
# Note that the source in q2source_12_11.zip is for version 3.05. To
|
||||
# get it to run with Linux 3.10, change the following in game.h:
|
||||
# #define GAME_API_VERSION 1
|
||||
# change it to:
|
||||
# #define GAME_API_VERSION 2
|
||||
|
||||
ARCH=i386
|
||||
CC=gcc
|
||||
BASE_CFLAGS=-Dstricmp=strcasecmp
|
||||
|
||||
#use these cflags to optimize it
|
||||
CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \
|
||||
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
|
||||
-malign-jumps=2 -malign-functions=2
|
||||
#use these when debugging
|
||||
#CFLAGS=$(BASE_CFLAGS) -g
|
||||
|
||||
OBJDIR=linux
|
||||
|
||||
LDFLAGS=-ldl -lm
|
||||
SHLIBEXT=so
|
||||
SHLIBCFLAGS=-fPIC
|
||||
SHLIBLDFLAGS=-shared
|
||||
|
||||
DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||
|
||||
#############################################################################
|
||||
# SETUP AND BUILD
|
||||
# GAME
|
||||
#############################################################################
|
||||
|
||||
GAME_OBJS = \
|
||||
$(OBJDIR)/g_ai.o $(OBJDIR)/p_client.o $(OBJDIR)/g_svcmds.o $(OBJDIR)/g_cmds.o \
|
||||
$(OBJDIR)/g_combat.o $(OBJDIR)/g_func.o $(OBJDIR)/g_items.o \
|
||||
$(OBJDIR)/g_main.o $(OBJDIR)/g_misc.o $(OBJDIR)/g_monster.o $(OBJDIR)/g_phys.o \
|
||||
$(OBJDIR)/g_save.o $(OBJDIR)/g_spawn.o \
|
||||
$(OBJDIR)/g_target.o $(OBJDIR)/g_trigger.o $(OBJDIR)/g_utils.o $(OBJDIR)/g_weapon.o \
|
||||
$(OBJDIR)/m_move.o \
|
||||
$(OBJDIR)/p_hud.o $(OBJDIR)/p_trail.o $(OBJDIR)/p_view.o $(OBJDIR)/p_weapon.o \
|
||||
$(OBJDIR)/q_shared.o $(OBJDIR)/g_ctf.o $(OBJDIR)/p_menu.o $(OBJDIR)/g_chase.o
|
||||
|
||||
game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
|
||||
|
||||
$(OBJDIR)/g_ai.o : g_ai.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_client.o : p_client.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_svcmds.o : g_svcmds.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_cmds.o : g_cmds.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_combat.o : g_combat.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_func.o : g_func.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_items.o : g_items.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_main.o : g_main.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_misc.o : g_misc.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_monster.o : g_monster.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_phys.o : g_phys.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_save.o : g_save.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_spawn.o : g_spawn.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_target.o : g_target.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_trigger.o : g_trigger.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_utils.o : g_utils.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_weapon.o : g_weapon.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/m_move.o : m_move.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_hud.o : p_hud.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_trail.o : p_trail.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_view.o : p_view.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_weapon.o : p_weapon.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/q_shared.o : q_shared.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_ctf.o : g_ctf.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/p_menu.o : p_menu.c
|
||||
$(DO_CC)
|
||||
|
||||
$(OBJDIR)/g_chase.o : g_chase.c
|
||||
$(DO_CC)
|
||||
|
||||
#############################################################################
|
||||
# MISC
|
||||
#############################################################################
|
||||
|
||||
clean:
|
||||
-rm -f $(GAME_OBJS)
|
||||
|
||||
depend:
|
||||
gcc -MM $(GAME_OBJS:.o=.c)
|
||||
|
251
game/ctf/game.h
251
game/ctf/game.h
|
@ -1,251 +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.
|
||||
|
||||
*/
|
||||
#include "gcc_attr.h"
|
||||
|
||||
// game.h -- game dll information visible to server
|
||||
|
||||
#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
|
||||
//ZOID
|
||||
#define SVF_PROJECTILE 0x00000008 // entity is simple projectile, used for network optimization
|
||||
// if an entity is projectile, the model index/x/y/z/pitch/yaw are sent, encoded into
|
||||
// seven (or eight) bytes. This is to speed up projectiles. Currently, only the
|
||||
// hyperblaster makes use of this. use for items that are moving with a constant
|
||||
// velocity that don't change direction or model
|
||||
//ZOID
|
||||
|
||||
// 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;
|
||||
|
||||
// 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
|
||||
|
||||
//===============================================================
|
||||
|
||||
//
|
||||
// functions provided by the main engine
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
// special messages
|
||||
#if 0
|
||||
void (*bprintf) (int printlevel, char *fmt, ...) __attribute__((format(printf,2,3)));
|
||||
void (*dprintf) (char *fmt, ...) __attribute__((format(printf,1,2)));
|
||||
void (*cprintf) (edict_t *ent, int printlevel, char *fmt, ...) __attribute__((format(printf,3,4)));
|
||||
void (*centerprintf) (edict_t *ent, char *fmt, ...) __attribute__((format(printf,2,3)));
|
||||
#else
|
||||
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, ...);
|
||||
#endif
|
||||
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);
|
||||
|
||||
// config strings hold all the index strings, the lightstyles,
|
||||
// and misc data like the sky definition and cdtrack.
|
||||
// All of the current configstrings are sent to clients when
|
||||
// they connect, and changes are sent to all connected clients.
|
||||
void (*configstring) (int num, char *string);
|
||||
|
||||
//void (*error) (char *fmt, ...) __attribute__((noreturn, format(printf,1,2)));
|
||||
void (*error) (char *fmt, ...) __attribute__((noreturn));
|
||||
|
||||
// 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);
|
||||
|
||||
// an entity will never be sent to a client or used for collision
|
||||
// if it is not passed to linkentity. If the size, position, or
|
||||
// solidity changes, it must be relinked.
|
||||
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
|
||||
|
||||
// add commands to the server console as if they were typed in
|
||||
// for map changing, etc
|
||||
void (*AddCommandString) (char *text);
|
||||
|
||||
void (*DebugGraph) (float value, int color);
|
||||
} game_import_t;
|
||||
|
||||
//
|
||||
// functions exported by the game subsystem
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
int apiversion;
|
||||
|
||||
// the init function will only be called when a game starts,
|
||||
// not each time a level is loaded. Persistant data for clients
|
||||
// and the server can be allocated in init
|
||||
void (*Init) (void);
|
||||
void (*Shutdown) (void);
|
||||
|
||||
// each new level entered will cause a call to SpawnEntities
|
||||
void (*SpawnEntities) (char *mapname, char *entstring, char *spawnpoint);
|
||||
|
||||
// Read/Write Game is for storing persistant cross level information
|
||||
// about the world state and the clients.
|
||||
// WriteGame is called every time a level is exited.
|
||||
// ReadGame is called on a loadgame.
|
||||
void (*WriteGame) (char *filename, qboolean autosave);
|
||||
void (*ReadGame) (char *filename);
|
||||
|
||||
// ReadLevel is called after the default map information has been
|
||||
// loaded with SpawnEntities
|
||||
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);
|
||||
|
||||
// ServerCommand will be called when an "sv <command>" command is issued on the
|
||||
// server console.
|
||||
// The game can issue gi.argc() / gi.argv() commands to get the rest
|
||||
// of the parameters
|
||||
void (*ServerCommand) (void);
|
||||
|
||||
//
|
||||
// global variables shared between game and server
|
||||
//
|
||||
|
||||
// The edict array is allocated in the game dll so it
|
||||
// can vary in size from one game to another.
|
||||
//
|
||||
// The size will be fixed when ge->Init() is called
|
||||
struct edict_s *edicts;
|
||||
int edict_size;
|
||||
int num_edicts; // current number, <= max_edicts
|
||||
int max_edicts;
|
||||
} game_export_t;
|
||||
|
||||
game_export_t *GetGameApi (game_import_t *import);
|
|
@ -34,6 +34,13 @@
|
|||
#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
|
||||
/* ZOID
|
||||
#define SVF_PROJECTILE 0x00000008 // entity is a simple projectile, used for network optimisation
|
||||
if an entity is projectile, the model index/x/y/z/pitch/yaw are sent, encoded into
|
||||
seven (or eight) bytes. This is to speed up projectiles. Currently, only the
|
||||
hyperblaster makes use of this. use for items that are moving with a constant
|
||||
velocity that don't change direction or model
|
||||
ZOID */
|
||||
|
||||
// edict->solid values
|
||||
|
||||
|
|
Loading…
Reference in a new issue