don't need qfdefs any more since the servers now do its job themselves

This commit is contained in:
Bill Currie 2004-01-21 20:55:03 +00:00
parent 8f0c6dffed
commit 7446967f97
21 changed files with 2 additions and 1240 deletions

View file

@ -217,8 +217,6 @@ Group: Amusements/Games
This package contains several tools for use with QuakeForge:
* pak, a pakfile management tool.
* zpak, a script for compressing pakfiles.
* qfdefs, a tool for fixing up progs data files so they can be used with
QuakeForge-based servers.
* qfprogs, a "nm" tool for examining progs data files.
* qfwavinfo, a tool to assist in converting "looped" WAV files to Ogg
Vorbis.
@ -419,7 +417,6 @@ rm -rf $RPM_BUILD_ROOT
%files utils
%attr(-,root,root) %{_prefix}/bin/pak
%attr(-,root,root) %{_prefix}/bin/zpak
%attr(-,root,root) %{_prefix}/bin/qfdefs
%attr(-,root,root) %{_prefix}/bin/qfprogs
%attr(-,root,root) %{_prefix}/bin/qfwavinfo
%attr(-,root,root) %{_prefix}/man/man1/pak.1.gz

View file

@ -1621,7 +1621,7 @@ QF_WITH_TARGETS(
QF_WITH_TARGETS(
tools,
[ --with-tools=<list> compile qf tools:],
[bsp2img,carne,pak,qfbsp,qfcc,qfdefs,qflight,qfmodelgen,qfprogs,qfvis,qwaq,wad,wav],dummy
[bsp2img,carne,pak,qfbsp,qfcc,qflight,qfmodelgen,qfprogs,qfvis,qwaq,wad,wav],dummy
)
unset CL_TARGETS
@ -1801,9 +1801,6 @@ fi
if test "x$ENABLE_tools_qfcc" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qfcc"
fi
if test "x$ENABLE_tools_qfdefs" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qfdefs"
fi
if test "x$ENABLE_tools_qflight" = xyes; then
TOOLS_TARGETS="$TOOLS_TARGETS qflight"
fi
@ -1831,7 +1828,6 @@ AM_CONDITIONAL(BUILD_CARNE, test "$ENABLE_tools_carne" = "yes")
AM_CONDITIONAL(BUILD_PAK, test "$ENABLE_tools_pak" = "yes")
AM_CONDITIONAL(BUILD_QFBSP, test "$ENABLE_tools_qfbsp" = "yes")
AM_CONDITIONAL(BUILD_QFCC, test "$ENABLE_tools_qfcc" = "yes")
AM_CONDITIONAL(BUILD_QFDEFS, test "$ENABLE_tools_qfdefs" = "yes")
AM_CONDITIONAL(BUILD_QFLIGHT, test "$ENABLE_tools_qflight" = "yes")
AM_CONDITIONAL(BUILD_QFMODELGEN, test "$ENABLE_tools_qfmodelgen" = "yes")
AM_CONDITIONAL(BUILD_QFPROGS, test "$ENABLE_tools_qfprogs" = "yes")
@ -2116,11 +2112,6 @@ QF_DEPS(WAV,
[$(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)],
)
QF_DEPS(QFDEFS,
[-I$(top_srcdir)/tools/qfdefs/include],
[$(top_builddir)/libs/gamecode/engine/libQFgamecode.la $(top_builddir)/libs/util/libQFutil.la],
[$(WIN32_LIBS)],
)
AC_DEFINE_UNQUOTED(PATH_SEPARATOR, '/', [Define this to your operating system's path separator character])
AC_DEFINE_UNQUOTED(CPP_NAME, "$CPP_NAME", [Define this to the command line for the C preprocessor])
@ -2205,9 +2196,6 @@ AC_OUTPUT(
tools/qfcc/doc/man/Makefile
tools/qfcc/include/Makefile
tools/qfcc/source/Makefile
tools/qfdefs/Makefile
tools/qfdefs/include/Makefile
tools/qfdefs/source/Makefile
tools/qflight/Makefile
tools/qflight/include/Makefile
tools/qflight/source/Makefile

2
debian/control vendored
View file

@ -182,8 +182,6 @@ Description: QuakeForge utility programs
.
* pak, a pakfile management tool.
* zpak, a script for compressing pakfiles.
* qfdefs, a tool for fixing up progs data files so they can be used with
QuakeForge-based servers.
* qfprogs, a "nm" tool for examining progs data files.
* qfwavinfo, a tool to assist in converting "looped" WAV files to Ogg
Vorbis.

3
debian/rules vendored
View file

@ -221,18 +221,15 @@ install: build
# quakeforge-utils
install -D -m755 $(tmp)/usr/games/pak $(tmp)/usr/bin/pak
install -D -m755 $(tmp)/usr/games/zpak $(tmp)/usr/bin/zpak
install -D -m755 $(tmp)/usr/games/qfdefs $(tmp)/usr/bin/qfdefs
install -D -m755 $(tmp)/usr/games/qfprogs $(tmp)/usr/bin/qfprogs
install -D -m755 $(tmp)/usr/games/qfwavinfo $(tmp)/usr/bin/qfwavinfo
rm -f $(tmp)/usr/games/pak \
$(tmp)/usr/games/zpak \
$(tmp)/usr/games/qfdefs \
$(tmp)/usr/games/qfprogs \
$(tmp)/usr/games/qfwavinfo
dh_movefiles -p$(utils) --sourcedir=$(tmp) \
usr/bin/pak \
usr/bin/zpak \
usr/bin/qfdefs \
usr/bin/qfprogs \
usr/bin/qfwavinfo \
usr/share/man/man1/pak.1

View file

@ -1,2 +1,2 @@
SUBDIRS=bsp2img carne pak qfbsp qfcc qfdefs qflight qfmodelgen qfprogs qfvis qwaq wad wav
SUBDIRS=bsp2img carne pak qfbsp qfcc qflight qfmodelgen qfprogs qfvis qwaq wad wav
bin_SCRIPTS=zpak

View file

@ -1,12 +0,0 @@
.vimrc
ChangeLog
Makefile
Makefile.in
aclocal.m4
confdefs.h
configure
config.log
config.cache
config.status
qfdefs.lsm
autom4te.cache

View file

@ -1,50 +0,0 @@
# Makefile.am
#
# Automake-using build system for QuakeForge
#
# Copyright (C) 2000 Jeff Teunissen <deek@quakeforge.net>
#
# This Makefile 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:
#
# Free Software Foundation, Inc.
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
# $Id$
#
AUTOMAKE_OPTIONS= foreign
SUBDIRS= include source
EXTRA_DIST=qfdefs.lsm.in
dist-zip: distdir
-chmod -R a+r $(distdir)
ZIP="-r9q" zip $(distdir).zip $(NOCONV_DIST)
ZIP="-r9ql" zip $(distdir).zip $(distdir) -x $(NOCONV_DIST)
-rm -rf $(distdir)
dist-bz2: distdir
-chmod -R a+r $(distdir)
BZIP2="-9" $(TAR) Ichof $(distdir).tar.bz2 $(distdir)
-rm -rf $(distdir)
dist-all-local: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
BZIP2="-9" $(TAR) Ichof $(distdir).tar.bz2 $(distdir)
ZIP="-r9q" zip $(distdir).zip $(NOCONV_DIST)
ZIP="-r9ql" zip $(distdir).zip $(distdir) -x $(NOCONV_DIST)
-rm -rf $(distdir)

View file

@ -1,2 +0,0 @@
#!/bin/sh
aclocal && autoheader && automake --add-missing && autoconf

View file

@ -1,120 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
AC_INIT(source/qfdefs.c)
AC_REVISION($Revision$) dnl
AM_CONFIG_HEADER(include/config.h)
AC_CANONICAL_SYSTEM
dnl Every other copy of the package version number gets its value from here
AM_INIT_AUTOMAKE(qfdefs, 0.1.0)
AC_SUBST(VERSION)
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
AC_LANG_C
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CPP
AC_PROG_YACC
AM_PROG_LEX
dnl We want warnings, lots of warnings...
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall -Werror"
# CFLAGS="$CFLAGS -Wall -pedantic"
fi
dnl Checks for libraries.
AC_CHECK_LIB(z, gztell,,
)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h strings.h sys/types.h sys/wait.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_ARG_ENABLE(profile,
[ --enable-profile compile with profiling (for development)],
profile=$enable_profile
)
if test "x$profile" = xyes; then
BUILD_TYPE="$BUILD_TYPE Profile"
if test "x$GCC" = xyes; then
CFLAGS="`echo $CFLAGS | sed -e 's/-fomit-frame-pointer//g'` -pg"
LDFLAGS="$LDFLAGS -pg"
else
CFLAGS="$CFLAGS -p"
fi
fi
dnl Checks for library functions.
AC_MSG_CHECKING(for timeGetTime in -lwinmm)
save_LIBS="$LIBS"
LIBS="$LIBS -lwinmm"
AC_TRY_COMPILE(
[#include <windows.h>],
[timeGetTime ();],
AC_MSG_RESULT(yes),
LIBS="$save_LIBS"
AC_MSG_RESULT(no)
)
AC_ARG_WITH(qf,
[ --with-qf=DIR location of QF libs and headers (prefix)],
if test "x$withval" != xyes ; then
LDFLAGS="$LDFLAGS -L${withval}/lib"
CFLAGS="$CFLAGS -I${withval}/include"
fi
,
HAVE_QF=auto
)
AC_MSG_CHECKING(for QF/qtypes.h)
AC_TRY_COMPILE(
[#include "QF/qtypes.h"],
[qboolean foo = false;
foo = true;],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
HAVE_QF=no
)
if test "x$HAVE_QF" != xno; then
AC_CHECK_LIB(QFutil, Hash_NewTable,
:, HAVE_QF=no,
[]
)
fi
if test "x$HAVE_QF" != xno; then
AC_CHECK_LIB(QFgamecode, PR_Opcode,
:, HAVE_QF=no,
[-lQFutil]
)
fi
QFDEFS_LIBS="-lQFgamecode -lQFutil"
QFDEFS_DEPS=""
QFDEFS_INCS=""
if test "x$HAVE_QF" = xno; then
echo '***'
echo '*** You seem to not have the QuakeForge libs & headers installed'
echo '***'
exit 1
fi
AC_SUBST(QFDEFS_LIBS)
AC_SUBST(QFDEFS_DEPS)
AC_SUBST(QFDEFS_INCS)
AC_OUTPUT(
include/Makefile
source/Makefile
Makefile
qfdefs.lsm
)

View file

@ -1,8 +0,0 @@
.vimrc
Makefile.in
Makefile
config.h.in
config.h
stamp-h.in
stamp-h
stamp-h1

View file

@ -1,2 +0,0 @@
AUTOMAKE_OPTIONS= foreign
EXTRA_DIST= def.h progdefs.nq progdefs.qw

View file

@ -1,30 +0,0 @@
#ifndef __def_h
#define __def_h
#include <QF/pr_comp.h>
typedef struct {
etype_t type;
unsigned short offset;
const char *name;
} def_t;
extern def_t nq_global_defs[];
extern def_t nq_field_defs[];
extern unsigned int nq_crc;
extern def_t qw_global_defs[];
extern def_t qw_field_defs[];
extern unsigned int qw_crc;
void Init_Defs (def_t *gtab, def_t *ftab);
def_t *Find_Global_Def_name (const char *name);
def_t *Find_Global_Def_offs (int offs);
def_t *Find_Field_Def_name (const char *name);
def_t *Find_Field_Def_offs (int offs);
struct progs_s;
void fix_missing_globals (struct progs_s *pr, def_t *globals);
void fix_missing_fields (struct progs_s *pr, def_t *fields);
#endif//__def_h

View file

@ -1,143 +0,0 @@
/* file generated by qcc, do not modify */
typedef struct
{ int pad[28];
int self;
int other;
int world;
float time;
float frametime;
float force_retouch;
string_t mapname;
float deathmatch;
float coop;
float teamplay;
float serverflags;
float total_secrets;
float total_monsters;
float found_secrets;
float killed_monsters;
float parm1;
float parm2;
float parm3;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
int trace_ent;
float trace_inopen;
float trace_inwater;
int msg_entity;
func_t main;
func_t StartFrame;
func_t PlayerPreThink;
func_t PlayerPostThink;
func_t ClientKill;
func_t ClientConnect;
func_t PutClientInServer;
func_t ClientDisconnect;
func_t SetNewParms;
func_t SetChangeParms;
} globalvars_t;
typedef struct
{
float modelindex;
vec3_t absmin;
vec3_t absmax;
float ltime;
float movetype;
float solid;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t angles;
vec3_t avelocity;
vec3_t punchangle;
string_t classname;
string_t model;
float frame;
float skin;
float effects;
vec3_t mins;
vec3_t maxs;
vec3_t size;
func_t touch;
func_t use;
func_t think;
func_t blocked;
float nextthink;
int groundentity;
float health;
float frags;
float weapon;
string_t weaponmodel;
float weaponframe;
float currentammo;
float ammo_shells;
float ammo_nails;
float ammo_rockets;
float ammo_cells;
float items;
float takedamage;
int chain;
float deadflag;
vec3_t view_ofs;
float button0;
float button1;
float button2;
float impulse;
float fixangle;
vec3_t v_angle;
float idealpitch;
string_t netname;
int enemy;
float flags;
float colormap;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
int aiment;
int goalentity;
float spawnflags;
string_t target;
string_t targetname;
float dmg_take;
float dmg_save;
int dmg_inflictor;
int owner;
vec3_t movedir;
string_t message;
float sounds;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
} entvars_t;
#define PROGHEADER_CRC 5927

View file

@ -1,167 +0,0 @@
/*
progdefs.h
(description)
Copyright (C) 1996-1997 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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
/* file generated by qcc, do not modify */
typedef struct
{ int pad[28];
int self;
int other;
int world;
float time;
float frametime;
int newmis;
float force_retouch;
string_t mapname;
float serverflags;
float total_secrets;
float total_monsters;
float found_secrets;
float killed_monsters;
float parm1;
float parm2;
float parm3;
float parm4;
float parm5;
float parm6;
float parm7;
float parm8;
float parm9;
float parm10;
float parm11;
float parm12;
float parm13;
float parm14;
float parm15;
float parm16;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
int trace_ent;
float trace_inopen;
float trace_inwater;
int msg_entity;
func_t main;
func_t StartFrame;
func_t PlayerPreThink;
func_t PlayerPostThink;
func_t ClientKill;
func_t ClientConnect;
func_t PutClientInServer;
func_t ClientDisconnect;
func_t SetNewParms;
func_t SetChangeParms;
} globalvars_t;
typedef struct
{
float modelindex;
vec3_t absmin;
vec3_t absmax;
float ltime;
float lastruntime;
float movetype;
float solid;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t angles;
vec3_t avelocity;
string_t classname;
string_t model;
float frame;
float skin;
float effects;
vec3_t mins;
vec3_t maxs;
vec3_t size;
func_t touch;
func_t use;
func_t think;
func_t blocked;
float nextthink;
int groundentity;
float health;
float frags;
float weapon;
string_t weaponmodel;
float weaponframe;
float currentammo;
float ammo_shells;
float ammo_nails;
float ammo_rockets;
float ammo_cells;
float items;
float takedamage;
int chain;
float deadflag;
vec3_t view_ofs;
float button0;
float button1;
float button2;
float impulse;
float fixangle;
vec3_t v_angle;
string_t netname;
int enemy;
float flags;
float colormap;
float team;
float max_health;
float teleport_time;
float armortype;
float armorvalue;
float waterlevel;
float watertype;
float ideal_yaw;
float yaw_speed;
int aiment;
int goalentity;
float spawnflags;
string_t target;
string_t targetname;
float dmg_take;
float dmg_save;
int dmg_inflictor;
int owner;
vec3_t movedir;
string_t message;
float sounds;
string_t noise;
string_t noise1;
string_t noise2;
string_t noise3;
} entvars_t;
#define PROGHEADER_CRC 54730

View file

@ -1,19 +0,0 @@
Begin3
Title: qfcc
Version: @VERSION@
Entered-date: @ISODATE@
Description: The QuakeForge Code Compiler
@configure_input@
qfcc is a compiler for the GameC (formerly QuakeC) language.
It is intended to replace the original QuakeC compiler.
Keywords: Quake, QuakeC, QuakeForge, GameC, compiler
Author: quakeforge-devel@lists.quakeforge.net (The QuakeForge Project)
Maintained-by: quakeforge-devel@lists.quakeforge.net (The QuakeForge Project)
Primary-site: http://www.quakeforge.net/
31k qfcc-@VERSION@.tar.gz
500 qfcc.lsm
Alternate-site:
Original-site:
Platforms:
Copying-policy: GNU copyleft
End

View file

@ -1,9 +0,0 @@
.deps
.libs
.vimrc
Makefile.in
Makefile
gendefs
defs_nq.c
defs_qw.c
qfdefs

View file

@ -1,34 +0,0 @@
AUTOMAKE_OPTIONS= foreign
QFDEFS_LIBS=@QFDEFS_LIBS@
QFDEFS_DEPS=@QFDEFS_DEPS@
QFDEFS_INCS=@QFDEFS_INCS@
INCLUDES= -I$(top_srcdir)/include $(QFDEFS_INCS)
GENDEFS=./gendefs
if BUILD_QFDEFS
qfdefs=qfdefs
gendefs=gendefs
else
qfdefs=
gendefs=
endif
bin_PROGRAMS= $(qfdefs)
noinst_PROGRAMS= $(gendefs)
EXTRA_PROGRAMS= qfdefs gendefs
qfdefs_SOURCES= defs.c defs_nq.c defs_qw.c fix_globals.c qfdefs.c
qfdefs_LDADD= $(QFDEFS_LIBS)
qfdefs_DEPENDENCIES=$(QFDEFS_DEPS)
gendefs_SOURCES= gendefs.c
defs_nq.c: $(srcdir)/../include/progdefs.nq gendefs
$(GENDEFS) nq $(srcdir)/../include/progdefs.nq defs_nq.c
defs_qw.c: $(srcdir)/../include/progdefs.qw gendefs
$(GENDEFS) qw $(srcdir)/../include/progdefs.qw defs_qw.c
CLEANFILES= defs_nq.c defs_qw.c

View file

@ -1,133 +0,0 @@
/*
#FILENAME#
#DESCRIPTION#
Copyright (C) 2001 #AUTHOR#
Author: #AUTHOR#
Date: #DATE#
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <QF/hash.h>
#include "def.h"
static hashtab_t *global_defs_by_name;
static hashtab_t *global_defs_by_offs;
static hashtab_t *field_defs_by_name;
static hashtab_t *field_defs_by_offs;
static const char *
get_key_name (void *d, void *unused)
{
return ((def_t*)d)->name;
}
static const char *
get_key_offs (void *_d, void *unused)
{
def_t *d = (def_t*)_d;
static char rep[4];
rep[0] = (d->offset & 0x7f) + 1;
rep[1] = ((d->offset >> 7) & 0x7f) + 1;
rep[2] = ((d->offset >> 14) & 0x7f) + 1;
return rep;
}
void
Init_Defs (def_t *gtab, def_t *ftab)
{
if (global_defs_by_name)
Hash_FlushTable (global_defs_by_name);
else
global_defs_by_name = Hash_NewTable (1021, get_key_name, 0, 0);
if (global_defs_by_offs)
Hash_FlushTable (global_defs_by_offs);
else
global_defs_by_offs = Hash_NewTable (1021, get_key_offs, 0, 0);
while (gtab->name) {
Hash_Add (global_defs_by_name, gtab);
Hash_Add (global_defs_by_offs, gtab);
gtab++;
}
if (field_defs_by_name)
Hash_FlushTable (field_defs_by_name);
else
field_defs_by_name = Hash_NewTable (1021, get_key_name, 0, 0);
if (field_defs_by_offs)
Hash_FlushTable (field_defs_by_offs);
else
field_defs_by_offs = Hash_NewTable (1021, get_key_offs, 0, 0);
while (ftab->name) {
Hash_Add (field_defs_by_name, ftab);
Hash_Add (field_defs_by_offs, ftab);
ftab++;
}
}
def_t *
Find_Global_Def_name (const char *name)
{
return Hash_Find (global_defs_by_name, name);
}
def_t *
Find_Global_Def_offs (int offs)
{
def_t d;
char rep[4];
d.offset = offs;
strcpy (rep, get_key_offs (&d, 0));
return Hash_Find (global_defs_by_offs, rep);
}
def_t *
Find_Field_Def_name (const char *name)
{
return Hash_Find (field_defs_by_name, name);
}
def_t *
Find_Field_Def_offs (int offs)
{
def_t d;
char rep[4];
d.offset = offs;
strcpy (rep, get_key_offs (&d, 0));
return Hash_Find (field_defs_by_offs, rep);
}

View file

@ -1,125 +0,0 @@
/*
#FILENAME#
#DESCRIPTION#
Copyright (C) 2001 #AUTHOR#
Author: #AUTHOR#
Date: #DATE#
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <QF/progs.h>
#include <QF/sys.h>
#include "def.h"
static void
update_offsets (dprograms_t *pr, unsigned int mark, int count)
{
if (pr->ofs_statements > mark)
pr->ofs_statements += count;
if (pr->ofs_globaldefs > mark)
pr->ofs_globaldefs += count;
if (pr->ofs_fielddefs > mark)
pr->ofs_fielddefs += count;
if (pr->ofs_functions > mark)
pr->ofs_functions += count;
if (pr->ofs_strings > mark)
pr->ofs_strings += count;
if (pr->ofs_globals > mark)
pr->ofs_globals += count;
}
void
fix_missing_globals (progs_t *pr, def_t *globals)
{
int defs_count = 0;
int strings_size = 0;
int i;
def_t *def;
ddef_t **new_defs, *d, **n;
char *new_strings;
dprograms_t *progs;
int offs;
for (def = globals; def->name; def ++) {
if (!PR_FindGlobal (pr, def->name)) {
defs_count++;
}
}
n = new_defs = calloc (defs_count, sizeof (def_t **));
for (def = globals; def->name; def ++) {
d = ED_GlobalAtOfs (pr, def->offset);
if (d) {
if (d->type != (def->type)) {
fprintf (stderr,
"global def %s at %d has mismatched type (%s, %s)\n",
def->name, def->offset,
pr_type_name[def->type & ~DEF_SAVEGLOBAL],
pr_type_name[d->type & ~DEF_SAVEGLOBAL]);
exit (1);
}
if (strcmp (def->name, PR_GetString (pr, d->s_name)) == 0)
continue; // this one is ok
d->s_name = strings_size;
*n++ = d;
strings_size += strlen (def->name) + 1;
} else {
fprintf (stderr, "no pre-existing def for %s at %d",
def->name, def->offset);
exit (1);
}
}
new_strings = calloc (strings_size, 1);
for (i = 0; i < defs_count; i++) {
def = Find_Global_Def_offs (new_defs[i]->ofs);
strcpy (new_strings + new_defs[i]->s_name, def->name);
new_defs[i]->s_name += pr->pr_stringsize;
}
progs = malloc (pr->progs_size + strings_size);
SYS_CHECKMEM (progs);
memcpy (progs, pr->progs, pr->progs_size);
offs = progs->ofs_strings + progs->numstrings;
memmove ((char*)progs + offs + strings_size, (char*)progs + offs,
pr->progs_size - offs);
memcpy ((char*)progs + offs, new_strings, strings_size);
progs->numstrings += strings_size;
pr->progs_size += strings_size;
update_offsets (progs, progs->ofs_strings, strings_size);
pr->progs = progs;
}

View file

@ -1,158 +0,0 @@
/*
#FILENAME#
#DESCRIPTION#
Copyright (C) 2001 #AUTHOR#
Author: #AUTHOR#
Date: #DATE#
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int offset;
static void
output_def (FILE *out, const char *line)
{
const char *type, *type_e;
const char *name, *name_e;
for (type = line; *type && isspace (*type); type++)
;
for (type_e = type; *type_e && !isspace (*type_e); type_e++)
;
for (name = type_e; *name && isspace (*name); name++)
;
for (name_e = name; *name_e && !isspace (*name_e) && *name_e != ';'; name_e++)
;
if (strncmp ("int", type, type_e - type) == 0) {
fprintf (out, "\t{ev_entity | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n",
offset, (int) (name_e - name), name);
offset += 1;
} else if (strncmp ("float", type, type_e - type) == 0) {
fprintf (out, "\t{ev_float | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n",
offset, (int) (name_e - name), name);
offset += 1;
} else if (strncmp ("string_t", type, type_e - type) == 0) {
fprintf (out, "\t{ev_string | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n",
offset, (int) (name_e - name), name);
offset += 1;
} else if (strncmp ("vec3_t", type, type_e - type) == 0) {
fprintf (out, "\t{ev_vector | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n",
offset, (int) (name_e - name), name);
offset += 3;
} else if (strncmp ("func_t", type, type_e - type) == 0) {
fprintf (out, "\t{ev_func,\t%d,\t\"%.*s\"},\n",
offset, (int) (name_e - name), name);
offset += 1;
} else {
fprintf (stderr, "unknown type %.*s\n", (int) (type_e - type), type);
exit (1);
}
}
int
main (int argc, char **argv)
{
FILE *in, *out;
char buf[256];
int state = 0;
if (argc != 4) {
fprintf (stderr, "usage: gendefs prefix infile outfile\n");
return 1;
}
if (!(in = fopen (argv[2], "rt"))) {
perror (argv[2]);
return 1;
}
if (!(out = fopen (argv[3], "wt"))) {
perror (argv[3]);
return 1;
}
fputs ("#include \"def.h\"\n\n", out);
fprintf (out, "static const char rcsid[] =\n\t\"%s\";\n", rcsid);
fprintf (out, "static const void *__rcsid_hack (void)\n");
fprintf (out, "{ __rcsid_hack (); return rcsid; }\n");
while (fgets (buf, sizeof (buf), in)) {
switch (state) {
case 0:
if (buf[0] == '{')
state++;
break;
case 1:
fprintf (out, "def_t %s_global_defs[] = {\n", argv[1]);
offset = 28;
state++;
case 2:
if (buf[0] == '}') {
fputs ("\t{ev_void,\t0,\t0},\n", out);
fputs ("};\n", out);
state++;
break;
}
output_def (out, buf);
break;
case 3:
if (buf[0] == '{')
state++;
break;
case 4:
fputs ("\n", out);
fprintf (out, "def_t %s_field_defs[] = {\n", argv[1]);
offset = 0;
state++;
case 5:
if (buf[0] == '}') {
state++;
break;
}
output_def (out, buf);
break;
case 6:
fputs ("\t{ev_void,\t0,\t0},\n", out);
fputs ("};\n", out);
state++;
break;
case 7:
if (strncmp ("#define", buf, 7) == 0) {
int crc;
sscanf (buf, "#define PROGHEADER_CRC %d", &crc);
fprintf (out, "\nunsigned int %s_crc = %d;\n",
argv[1], crc);
}
break;
}
}
return 0;
}

View file

@ -1,206 +0,0 @@
/*
#FILENAME#
#DESCRIPTION#
Copyright (C) 2001 #AUTHOR#
Author: #AUTHOR#
Date: #DATE#
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((unused)) const char rcsid[] =
"$Id$";
#include <stdio.h>
#include <stdlib.h>
#include <QF/cmd.h>
#include <QF/cvar.h>
#include "QF/progs.h"
#include <QF/quakeio.h>
#include <QF/sys.h>
#include <QF/va.h>
#include <QF/zone.h>
#include "def.h"
static edict_t *edicts;
static int num_edicts;
static int reserved_edicts = 1;
static progs_t pr;
static void *membase;
static int memsize = 1024*1024;
static QFile *
open_file (const char *path, int *len)
{
QFile *file = Qopen (path, "rbz");
if (!file) {
perror (path);
return 0;
}
*len = Qfilesize (file);
return file;
}
static void *
load_file (progs_t *pr, const char *name)
{
QFile *file;
int size;
void *sym;
file = open_file (name, &size);
if (!file) {
file = open_file (va ("%s.gz", name), &size);
if (!file) {
return 0;
}
}
sym = malloc (size);
Qread (file, sym, size);
return sym;
}
static void *
allocate_progs_mem (progs_t *pr, int size)
{
return malloc (size);
}
static void
free_progs_mem (progs_t *pr, void *mem)
{
free (mem);
}
static void
init_qf (void)
{
Cvar_Init_Hash ();
Cmd_Init_Hash ();
Cvar_Init ();
Sys_Init_Cvars ();
Cmd_Init ();
membase = malloc (memsize);
Memory_Init (membase, memsize);
PR_Init_Cvars ();
PR_Init ();
pr.edicts = &edicts;
pr.num_edicts = &num_edicts;
pr.reserved_edicts = &reserved_edicts;
pr.load_file = load_file;
pr.allocate_progs_mem = allocate_progs_mem;
pr.free_progs_mem = free_progs_mem;
}
static int
load_progs (const char *name)
{
QFile *file;
int size;
file = open_file (name, &size);
if (!file) {
perror (name);
return 0;
}
pr.progs_name = name;
PR_LoadProgsFile (&pr, file, size, 1, 0);
Qclose (file);
PR_LoadStrings (&pr);
return 1;
}
int
main (int argc, char **argv)
{
def_t *globals, *fields, *def;
if (argc < 2) {
fprintf (stderr, "usage: qfdefs <progs> ...\n");
return 1;
}
init_qf ();
while (--argc) {
int fix = 0;
if (!load_progs (*++argv)) {
fprintf (stderr, "failed to load %s\n", *argv);
return 1;
}
if (pr.progs->version < 0x100)
printf ("%s: version %d\n", pr.progs_name, pr.progs->version);
else
printf ("%s: version %x.%03x.%03x\n", pr.progs_name,
(pr.progs->version >> 24) & 0xff,
(pr.progs->version >> 12) & 0xfff,
pr.progs->version & 0xfff);
if (pr.progs->crc == nq_crc) {
printf ("%s: netquake crc\n", pr.progs_name);
Init_Defs (nq_global_defs, nq_field_defs);
globals = nq_global_defs;
fields = nq_field_defs;
} else if (pr.progs->crc == qw_crc) {
printf ("%s: quakeworld crc\n", pr.progs_name);
Init_Defs (qw_global_defs, qw_field_defs);
globals = qw_global_defs;
fields = qw_field_defs;
} else {
printf ("%s: unknown crc %d\n", pr.progs_name, pr.progs->crc);
continue;
}
for (def = globals; def->name; def++)
if (!PR_FindGlobal (&pr, def->name))
break;
if (!def->name)
printf ("%s: all system globals accounted for\n", pr.progs_name);
else {
printf ("%s: some system globals missing\n", pr.progs_name);
fix_missing_globals (&pr, globals);
fix++;
}
for (def = fields; def->name; def++)
if (!ED_FindField (&pr, def->name))
break;
if (!def->name)
printf ("%s: all system fields accounted for\n", pr.progs_name);
else {
printf ("%s: some system fields missing\n", pr.progs_name);
}
if (fix) {
//XXX FIXME endian fixups
FILE *f = fopen (va ("%s.new", pr.progs_name), "wb");
fwrite (pr.progs, pr.progs_size, 1, f);
fclose (f);
}
}
return 0;
}