Add support for writing uhexen2's v7 progs files.

Try to fix issues with newer gcc not merging common symbols any more.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5720 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-07-01 05:32:21 +00:00
parent dc81386ee6
commit 0bda1b5c38
28 changed files with 296 additions and 84 deletions

View file

@ -174,6 +174,8 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
ELSE() ELSE()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
ENDIF() ENDIF()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--warn-common")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-truncation=1")
ENDIF() ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")

View file

@ -1468,6 +1468,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
endif endif
CL_CFLAGS=-DMULTITHREAD -DDYNAMIC_SDL $(HAVE_EGL) $(HAVE_WAYLAND) -DX11QUAKE CL_CFLAGS=-DMULTITHREAD -DDYNAMIC_SDL $(HAVE_EGL) $(HAVE_WAYLAND) -DX11QUAKE
BASELDFLAGS+=-Wl,--warn-common
QCC_DIR=linqcc$(BITS) QCC_DIR=linqcc$(BITS)
@ -1477,7 +1478,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD -fPIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD -fPIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
NPFTEB_DIR=npfte_linux$(BITS) NPFTEB_DIR=npfte_linux$(BITS)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_pulse.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS) GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS)
GLCL_EXE_NAME=../$(EXE_NAME)-glcl$(BITS) GLCL_EXE_NAME=../$(EXE_NAME)-glcl$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS)
@ -1485,7 +1486,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
GLB_DIR=gl_linux$(BITS) GLB_DIR=gl_linux$(BITS)
GLCL_DIR=glcl_linux$(BITS) GLCL_DIR=glcl_linux$(BITS)
VKCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o VKCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_pulse.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
VK_EXE_NAME=../$(EXE_NAME)-vk$(BITS) VK_EXE_NAME=../$(EXE_NAME)-vk$(BITS)
VKCL_EXE_NAME=../$(EXE_NAME)-vkcl$(BITS) VKCL_EXE_NAME=../$(EXE_NAME)-vkcl$(BITS)
VK_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) VK_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS)
@ -1493,7 +1494,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
VKB_DIR=vk_linux$(BITS) VKB_DIR=vk_linux$(BITS)
VKCL_DIR=vkcl_linux$(BITS) VKCL_DIR=vkcl_linux$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_linux.o snd_sdl.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_linux.o snd_sdl.o snd_pulse.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o
M_EXE_NAME=../$(EXE_NAME)$(BITS) M_EXE_NAME=../$(EXE_NAME)$(BITS)
MCL_EXE_NAME=../$(EXE_NAME)-cl$(BITS) MCL_EXE_NAME=../$(EXE_NAME)-cl$(BITS)
M_LDFLAGS=$(GL_LDFLAGS) M_LDFLAGS=$(GL_LDFLAGS)

View file

@ -292,13 +292,8 @@ static struct
// qbyte fingerprint[5*4]; //sha1 hash of accepted dtls certs // qbyte fingerprint[5*4]; //sha1 hash of accepted dtls certs
} connectinfo; } connectinfo;
quakeparms_t host_parms;
qboolean host_initialized; // true if into command execution
qboolean nomaster; qboolean nomaster;
double host_frametime;
double realtime; // without any filtering or bounding
double oldrealtime; // last frame run double oldrealtime; // last frame run
int host_framecount; int host_framecount;

View file

@ -310,7 +310,7 @@ void PM_ValidateAuthenticity(package_t *p)
int r; int r;
char authority[MAX_QPATH], *sig; char authority[MAX_QPATH], *sig;
#if 1 #if 1//ndef _DEBUG
#pragma message("Temporary code.") #pragma message("Temporary code.")
//this is temporary code and should be removed once everything else has been fixed. //this is temporary code and should be removed once everything else has been fixed.
//ignore the signature (flag as accepted) for any packages with all mirrors on our own update site. //ignore the signature (flag as accepted) for any packages with all mirrors on our own update site.

View file

@ -1530,7 +1530,12 @@ void QCBUILTIN PF_isserver (pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
#ifdef CLIENTONLY #ifdef CLIENTONLY
G_FLOAT(OFS_RETURN) = false; G_FLOAT(OFS_RETURN) = false;
#else #else
G_FLOAT(OFS_RETURN) = sv.state != ss_dead; if (sv.state == ss_dead)
G_FLOAT(OFS_RETURN) = false;
else if (sv.allocated_client_slots == 1)
G_FLOAT(OFS_RETURN) = 0.5;
else
G_FLOAT(OFS_RETURN) = true;
#endif #endif
} }
void QCBUILTIN PF_isdemo (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) void QCBUILTIN PF_isdemo (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)

View file

@ -21,6 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#ifdef __GNUC__
#define fte_weakstruct __attribute__((weak))
#else
//msvc's uninitialised symbols are always weak, so this is fine.
#define fte_weakstruct
#endif
#ifdef CSQC_DAT #ifdef CSQC_DAT
//for sounds following csqc ents //for sounds following csqc ents
#include "pr_common.h" #include "pr_common.h"
@ -561,13 +568,17 @@ static qboolean S_Speex_Init(void)
#ifdef AVAIL_OPENAL #ifdef AVAIL_OPENAL
extern snd_capture_driver_t OPENAL_Capture; extern snd_capture_driver_t OPENAL_Capture;
#endif #endif
snd_capture_driver_t DSOUND_Capture; #ifdef _WIN32
snd_capture_driver_t OSS_Capture; snd_capture_driver_t fte_weakstruct DSOUND_Capture;
snd_capture_driver_t SDL_Capture; #endif
snd_capture_driver_t fte_weakstruct OSS_Capture;
snd_capture_driver_t fte_weakstruct SDL_Capture;
snd_capture_driver_t *capturedrivers[] = snd_capture_driver_t *capturedrivers[] =
{ {
#ifdef _WIN32
&DSOUND_Capture, &DSOUND_Capture,
#endif
&SDL_Capture, &SDL_Capture,
&OSS_Capture, &OSS_Capture,
#ifdef AVAIL_OPENAL #ifdef AVAIL_OPENAL
@ -1822,12 +1833,12 @@ extern sounddriver_t XAUDIO2_Output;
#ifdef AVAIL_DSOUND #ifdef AVAIL_DSOUND
extern sounddriver_t DSOUND_Output; extern sounddriver_t DSOUND_Output;
#endif #endif
sounddriver_t SDL_Output; sounddriver_t fte_weakstruct SDL_Output;
#ifdef __linux__ #ifdef __linux__
sounddriver_t ALSA_Output; extern sounddriver_t ALSA_Output;
sounddriver_t Pulse_Output; extern sounddriver_t Pulse_Output;
#endif #endif
sounddriver_t OSS_Output; sounddriver_t fte_weakstruct OSS_Output;
#ifdef AVAIL_OPENAL #ifdef AVAIL_OPENAL
extern sounddriver_t OPENAL_Output; extern sounddriver_t OPENAL_Output;
#endif #endif
@ -1839,19 +1850,19 @@ extern sounddriver_t WaveOut_Output;
#endif #endif
#ifdef MACOSX #ifdef MACOSX
sounddriver_t MacOS_AudioOutput; //prefered on mac sounddriver_t fte_weakstruct MacOS_AudioOutput; //prefered on mac
#endif #endif
#ifdef ANDROID #ifdef ANDROID
sounddriver_t OSL_Output; //general audio library, but android has all kinds of quirks. sounddriver_t fte_weakstruct OSL_Output; //general audio library, but android has all kinds of quirks.
sounddriver_t Droid_AudioOutput; sounddriver_t fte_weakstruct Droid_AudioOutput;
#endif #endif
#if defined(__MORPHOS__) #if defined(__MORPHOS__)
sounddriver_t AHI_AudioOutput; //prefered on morphos sounddriver_t fte_weakstruct AHI_AudioOutput; //prefered on morphos
#endif #endif
#ifdef NACL #ifdef NACL
extern sounddriver_t PPAPI_AudioOutput; //nacl extern sounddriver_t PPAPI_AudioOutput; //nacl
#endif #endif
sounddriver_t SNDIO_AudioOutput; //bsd sounddriver_t fte_weakstruct SNDIO_AudioOutput; //bsd
//in order of preference //in order of preference
static sounddriver_t *outputdrivers[] = static sounddriver_t *outputdrivers[] =

View file

@ -69,7 +69,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int noconinput = 0; static int noconinput = 0;
static int nostdout = 0; static int nostdout = 0;
int isPlugin; extern int isPlugin;
int sys_parentleft; int sys_parentleft;
int sys_parenttop; int sys_parenttop;
int sys_parentwidth; int sys_parentwidth;

View file

@ -181,6 +181,7 @@ typedef struct galiasinfo_s
unsigned int mappedbones; unsigned int mappedbones;
unsigned int nummorphs; //extra data after the xyz/norm/stvect arrays unsigned int nummorphs; //extra data after the xyz/norm/stvect arrays
const float *(QDECL *AnimateMorphs)(const struct galiasinfo_s *surf, const framestate_t *framestate); const float *(QDECL *AnimateMorphs)(const struct galiasinfo_s *surf, const framestate_t *framestate);
int meshrootbone;
float *baseframeofs; /*non-heirachical*/ float *baseframeofs; /*non-heirachical*/
int numbones; int numbones;

View file

@ -50,7 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BZ_Malloc malloc #define BZ_Malloc malloc
#define BZ_Free free #define BZ_Free free
#define Z_Free BZ_Free #define Z_Free BZ_Free
vec3_t vec3_origin;
#define VectorCompare VectorComparestatic #define VectorCompare VectorComparestatic
static int VectorCompare (const vec3_t v1, const vec3_t v2) static int VectorCompare (const vec3_t v1, const vec3_t v2)
{ {

View file

@ -26,13 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <errno.h> #include <errno.h>
qboolean sys_nounload; qboolean sys_nounload;
#ifndef HAVE_CLIENT
double host_frametime; double host_frametime;
double realtime; // without any filtering or bounding double realtime; // without any filtering or bounding
qboolean host_initialized; // true if into command execution (compatability) qboolean host_initialized; // true if into command execution (compatability)
quakeparms_t host_parms; quakeparms_t host_parms;
int host_hunklevel;
#endif
//by adding 'extern' to one definition of a function in a translation unit, then the definition in that TU is NOT considered an inline definition. meaning non-inlined references in other TUs can link to it instead of their own if needed. //by adding 'extern' to one definition of a function in a translation unit, then the definition in that TU is NOT considered an inline definition. meaning non-inlined references in other TUs can link to it instead of their own if needed.

View file

@ -3424,9 +3424,9 @@ void QCBUILTIN PF_findradius_list (pubprogfuncs_t *prinst, struct globalvars_s *
{ {
world_t *w = prinst->parms->user; world_t *w = prinst->parms->user;
wedict_t *ent; wedict_t *ent;
float rad; pvec_t rad;
float *org; float *org;
vec3_t eorg; pvec3_t eorg;
int i, j; int i, j;
wedict_t **nearent; wedict_t **nearent;
vec3_t mins, maxs; vec3_t mins, maxs;

View file

@ -3104,7 +3104,7 @@ void DecompileDecompileFunctions(const char *origcopyright)
dfunction_t *d; dfunction_t *d;
pbool bogusname; pbool bogusname;
vfile_t *f = NULL; vfile_t *f = NULL;
char fname[512]; char fname[1024];
int lastglob = 1; int lastglob = 1;
int lastfileofs = 0; int lastfileofs = 0;
QCC_ddef_t *def; QCC_ddef_t *def;

View file

@ -691,6 +691,7 @@ func_t PDECL PR_FindFunc(pubprogfuncs_t *ppf, const char *funcname, progsnum_t p
return *(int *)&ps->globals[var16->ofs]; return *(int *)&ps->globals[var16->ofs];
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
var32 = ED_FindTypeGlobalFromProgs32(progfuncs, ps, funcname, ev_function); //we must make sure we actually have a function def - 'light' is defined as a field before it is defined as a function. var32 = ED_FindTypeGlobalFromProgs32(progfuncs, ps, funcname, ev_function); //we must make sure we actually have a function def - 'light' is defined as a field before it is defined as a function.
if (!var32) if (!var32)
return (f - ps->functions) | (pnum << 24); return (f - ps->functions) | (pnum << 24);
@ -738,6 +739,7 @@ static void PDECL QC_FindPrefixedGlobals(pubprogfuncs_t *ppf, int pnum, char *pr
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
for (i=1 ; i<pr_progstate[pnum].progs->numglobaldefs ; i++) for (i=1 ; i<pr_progstate[pnum].progs->numglobaldefs ; i++)
{ {
def32 = &pr_progstate[pnum].globaldefs32[i]; def32 = &pr_progstate[pnum].globaldefs32[i];
@ -788,6 +790,7 @@ eval_t *PDECL PR_FindGlobal(pubprogfuncs_t *ppf, const char *globname, progsnum_
return (eval_t *)&cp->globals[var16->ofs]; return (eval_t *)&cp->globals[var16->ofs];
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
if (!(var32 = ED_FindGlobalFromProgs32(progfuncs, cp, globname))) if (!(var32 = ED_FindGlobalFromProgs32(progfuncs, cp, globname)))
return NULL; return NULL;

View file

@ -586,6 +586,8 @@ typedef struct
#define PROG_EXTENDEDVERSION 7 #define PROG_EXTENDEDVERSION 7
#define PROG_SECONDARYVERSION16 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('P'<<0)|('R'<<8)|('O'<<16)|('G'<<24))) //something unlikly and still meaningful (to me) #define PROG_SECONDARYVERSION16 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('P'<<0)|('R'<<8)|('O'<<16)|('G'<<24))) //something unlikly and still meaningful (to me)
#define PROG_SECONDARYVERSION32 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('3'<<0)|('2'<<8)|('B'<<16)|(' '<<24))) //something unlikly and still meaningful (to me) #define PROG_SECONDARYVERSION32 ((('1'<<0)|('F'<<8)|('T'<<16)|('E'<<24))^(('3'<<0)|('2'<<8)|('B'<<16)|(' '<<24))) //something unlikly and still meaningful (to me)
#define PROG_SECONDARYUHEXEN2 ((('U'<<0)|('H'<<8)|('2'<<16)|('7'<<24))) //something unlikly and still meaningful (to me)
#define PROG_SECONDARYKKQWSV ((('K'<<0)|('K'<<8)|('Q'<<16)|('W'<<24))) //something unlikly and still meaningful (to me)
typedef struct typedef struct
{ {
int version; int version;

View file

@ -355,10 +355,12 @@ unsigned int ED_FindGlobalOfs (progfuncs_t *progfuncs, char *name)
return d16?d16->ofs:0; return d16?d16->ofs:0;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
d32 = ED_FindGlobal32(progfuncs, name); d32 = ED_FindGlobal32(progfuncs, name);
return d32?d32->ofs:0; return d32?d32->ofs:0;
} default:
externs->Sys_Error("ED_FindGlobalOfs - bad struct type"); externs->Sys_Error("ED_FindGlobalOfs - bad struct type");
}
return 0; return 0;
} }
@ -452,12 +454,14 @@ unsigned int *ED_FindGlobalOfsFromProgs (progfuncs_t *progfuncs, progstate_t *ps
return &pos; return &pos;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
def32 = ED_FindTypeGlobalFromProgs32(progfuncs, ps, name, type); def32 = ED_FindTypeGlobalFromProgs32(progfuncs, ps, name, type);
if (!def32) if (!def32)
return NULL; return NULL;
return &def32->ofs; return &def32->ofs;
} default:
externs->Sys_Error("ED_FindGlobalOfsFromProgs - bad struct type"); externs->Sys_Error("ED_FindGlobalOfsFromProgs - bad struct type");
}
return 0; return 0;
} }
@ -914,6 +918,7 @@ char *PR_GlobalString (progfuncs_t *progfuncs, int ofs, struct QCC_type_s **type
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
def32 = ED_GlobalAtOfs32(progfuncs, ofs); def32 = ED_GlobalAtOfs32(progfuncs, ofs);
break; break;
default: default:
@ -974,6 +979,7 @@ char *PR_GlobalStringNoContents (progfuncs_t *progfuncs, int ofs)
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
def32 = ED_GlobalAtOfs32(progfuncs, ofs); def32 = ED_GlobalAtOfs32(progfuncs, ofs);
if (def32) if (def32)
nameofs = def32->s_name; nameofs = def32->s_name;
@ -1591,6 +1597,7 @@ char *ED_WriteGlobals(progfuncs_t *progfuncs, char *buf, size_t *bufofs, size_t
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
for (i=0 ; i<pr_progs->numglobaldefs ; i++) for (i=0 ; i<pr_progs->numglobaldefs ; i++)
{ {
size_t nlen; size_t nlen;
@ -2162,6 +2169,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, void *ctx, void (PD
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
if (!(d32 = ED_FindGlobal32(progfuncs, qcc_token))) if (!(d32 = ED_FindGlobal32(progfuncs, qcc_token)))
{ {
externs->Printf("global value %s not found\n", qcc_token); externs->Printf("global value %s not found\n", qcc_token);
@ -2277,6 +2285,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, void *ctx, void (PD
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
if (!(d32 = ED_FindGlobal32(progfuncs, qcc_token))) if (!(d32 = ED_FindGlobal32(progfuncs, qcc_token)))
{ {
externs->Printf("global value %s not found\n", qcc_token); externs->Printf("global value %s not found\n", qcc_token);
@ -2722,8 +2731,21 @@ retry:
// externs->Printf("Opening 32bit fte progs file \"%s\"\n", filename); // externs->Printf("Opening 32bit fte progs file \"%s\"\n", filename);
current_progstate->structtype = PST_FTE32; current_progstate->structtype = PST_FTE32;
} }
else if (pr_progs->secondaryversion == PROG_SECONDARYUHEXEN2)
{
// externs->Printf("Opening uhexen2 progs file \"%s\"\n", filename);
current_progstate->structtype = PST_UHEXEN2;
pr_progs->version = PROG_VERSION; //not fte.
}
else if (pr_progs->secondaryversion == PROG_SECONDARYKKQWSV)
{
// externs->Printf("Opening KK7 progs file \"%s\"\n", filename);
current_progstate->structtype = PST_KKQWSV; //KK progs. Yuck. Disabling saving would be a VERY good idea.
pr_progs->version = PROG_VERSION; //not fte.
}
else else
{ {
externs->Printf ("%s has no v7 verification code, assuming kkqwsv format\n", filename);
// externs->Printf("Opening KK7 progs file \"%s\"\n", filename); // externs->Printf("Opening KK7 progs file \"%s\"\n", filename);
current_progstate->structtype = PST_KKQWSV; //KK progs. Yuck. Disabling saving would be a VERY good idea. current_progstate->structtype = PST_KKQWSV; //KK progs. Yuck. Disabling saving would be a VERY good idea.
pr_progs->version = PROG_VERSION; //not fte. pr_progs->version = PROG_VERSION; //not fte.
@ -2806,6 +2828,7 @@ retry:
len=sizeof(dstatement16_t)*pr_progs->numstatements; len=sizeof(dstatement16_t)*pr_progs->numstatements;
break; break;
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
len=sizeof(dstatement32_t)*pr_progs->numstatements; len=sizeof(dstatement32_t)*pr_progs->numstatements;
break; break;
default: default:
@ -2825,6 +2848,7 @@ retry:
len=sizeof(ddef16_t)*pr_progs->numglobaldefs; len=sizeof(ddef16_t)*pr_progs->numglobaldefs;
break; break;
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
len=sizeof(ddef32_t)*pr_progs->numglobaldefs; len=sizeof(ddef32_t)*pr_progs->numglobaldefs;
break; break;
default: default:
@ -2844,6 +2868,7 @@ retry:
len=sizeof(ddef16_t)*pr_progs->numglobaldefs; len=sizeof(ddef16_t)*pr_progs->numglobaldefs;
break; break;
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
len=sizeof(ddef32_t)*pr_progs->numglobaldefs; len=sizeof(ddef32_t)*pr_progs->numglobaldefs;
break; break;
default: default:
@ -2988,6 +3013,7 @@ retry:
case PST_KKQWSV: case PST_KKQWSV:
case PST_DEFAULT: case PST_DEFAULT:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
pr_cp_functions = PRHunkAlloc(progfuncs, sizeof(*pr_cp_functions)*pr_progs->numfunctions, "mfunctions"); pr_cp_functions = PRHunkAlloc(progfuncs, sizeof(*pr_cp_functions)*pr_progs->numfunctions, "mfunctions");
for (i=0,fnc2=pr_cp_functions; i<pr_progs->numfunctions; i++, fnc2++) for (i=0,fnc2=pr_cp_functions; i<pr_progs->numfunctions; i++, fnc2++)
{ {
@ -3166,6 +3192,49 @@ retry:
QC_RegisterFieldVar(&progfuncs->funcs, type, pr_fielddefs32[i].s_name+pr_strings-stringadjust, -1, pr_fielddefs32[i].ofs); QC_RegisterFieldVar(&progfuncs->funcs, type, pr_fielddefs32[i].s_name+pr_strings-stringadjust, -1, pr_fielddefs32[i].ofs);
} }
break; break;
case PST_UHEXEN2:
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
{
pr_globaldefs32[i].type = (unsigned int)PRLittleLong (pr_globaldefs32[i].type)>>16;
#ifndef NOENDIAN
pr_globaldefs32[i].ofs = PRLittleLong (pr_globaldefs32[i].ofs);
pr_globaldefs32[i].s_name = (string_t)PRLittleLong ((long)pr_globaldefs32[i].s_name);
#endif
pr_globaldefs32[i].s_name += stringadjust;
}
for (i=0 ; i<pr_progs->numfielddefs ; i++)
{
pr_fielddefs32[i].type = (unsigned int)PRLittleLong (pr_fielddefs32[i].type)>>16;
#ifndef NOENDIAN
pr_fielddefs32[i].ofs = PRLittleLong (pr_fielddefs32[i].ofs);
pr_fielddefs32[i].s_name = (string_t)PRLittleLong ((long)pr_fielddefs32[i].s_name);
#endif
if (reorg)
{
if (pr_types)
type = pr_types[pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL)].type;
else
type = pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL);
if (progfuncs->funcs.fieldadjust && !prinst.pr_typecurrent) //we need to make sure all fields appear in their original place.
QC_RegisterFieldVar(&progfuncs->funcs, type, pr_fielddefs32[i].s_name+pr_strings, 4*(pr_fielddefs32[i].ofs+progfuncs->funcs.fieldadjust), -1);
else if (type == ev_vector)
QC_RegisterFieldVar(&progfuncs->funcs, type, pr_fielddefs32[i].s_name+pr_strings, -1, pr_fielddefs32[i].ofs);
}
pr_fielddefs32[i].s_name += stringadjust;
}
if (reorg && !(progfuncs->funcs.fieldadjust && !prinst.pr_typecurrent))
for (i=0 ; i<pr_progs->numfielddefs ; i++)
{
if (pr_types)
type = pr_types[pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL)].type;
else
type = pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL);
if (type != ev_vector)
QC_RegisterFieldVar(&progfuncs->funcs, type, pr_fielddefs32[i].s_name+pr_strings-stringadjust, -1, pr_fielddefs32[i].ofs);
}
break;
default: default:
externs->Sys_Error("Bad struct type"); externs->Sys_Error("Bad struct type");
} }
@ -3209,6 +3278,19 @@ retry:
PR_CleanUpStatements16(progfuncs, st16, hexencalling); PR_CleanUpStatements16(progfuncs, st16, hexencalling);
break; break;
case PST_UHEXEN2:
hexencalling = true;
for (i=0 ; i<pr_progs->numstatements ; i++)
{
pr_statements32[i].op = (unsigned int)PRLittleLong(pr_statements32[i].op)>>16;
#ifndef NOENDIAN
pr_statements32[i].a = PRLittleLong(pr_statements32[i].a);
pr_statements32[i].b = PRLittleLong(pr_statements32[i].b);
pr_statements32[i].c = PRLittleLong(pr_statements32[i].c);
#endif
}
PR_CleanUpStatements32(progfuncs, pr_statements32, hexencalling);
break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
for (i=0 ; i<pr_progs->numstatements ; i++) for (i=0 ; i<pr_progs->numstatements ; i++)
@ -3319,6 +3401,7 @@ retry:
case PST_QTEST: //not likely to need this case PST_QTEST: //not likely to need this
case PST_KKQWSV: //fixme... case PST_KKQWSV: //fixme...
case PST_FTE32: //fingers crossed... case PST_FTE32: //fingers crossed...
case PST_UHEXEN2:
break; break;
} }
} }
@ -3375,6 +3458,7 @@ retry:
break; break;
case PST_QTEST: case PST_QTEST:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
for (i=0 ; i<pr_progs->numglobaldefs ; i++) for (i=0 ; i<pr_progs->numglobaldefs ; i++)
{ {
if (pr_types) if (pr_types)
@ -3485,6 +3569,7 @@ retry:
case PST_QTEST: case PST_QTEST:
case PST_KKQWSV: case PST_KKQWSV:
break; //cannot happen anyway. break; //cannot happen anyway.
case PST_UHEXEN2:
case PST_FTE32: case PST_FTE32:
if (pr_progs->version == PROG_EXTENDEDVERSION && pr_progs->numbodylessfuncs) if (pr_progs->version == PROG_EXTENDEDVERSION && pr_progs->numbodylessfuncs)
{ {

View file

@ -1197,6 +1197,7 @@ int PDECL PR_ToggleBreakpoint(pubprogfuncs_t *ppf, const char *filename, int lin
break; break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
op = ((dstatement32_t*)cp->statements + i)->op; op = ((dstatement32_t*)cp->statements + i)->op;
break; break;
default: default:
@ -1239,6 +1240,7 @@ int PDECL PR_ToggleBreakpoint(pubprogfuncs_t *ppf, const char *filename, int lin
break; break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
((dstatement32_t*)cp->statements + i)->op = op; ((dstatement32_t*)cp->statements + i)->op = op;
break; break;
default: default:
@ -1271,6 +1273,7 @@ int PDECL PR_ToggleBreakpoint(pubprogfuncs_t *ppf, const char *filename, int lin
break; break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
op = ((dstatement32_t*)cp->statements + i)->op; op = ((dstatement32_t*)cp->statements + i)->op;
break; break;
default: default:
@ -1312,6 +1315,7 @@ int PDECL PR_ToggleBreakpoint(pubprogfuncs_t *ppf, const char *filename, int lin
break; break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
((dstatement32_t*)cp->statements + i)->op = op; ((dstatement32_t*)cp->statements + i)->op = op;
break; break;
default: default:
@ -1381,6 +1385,7 @@ static const char *lastfile = NULL;
{ {
switch(pr_progstate[pn].structtype) switch(pr_progstate[pn].structtype)
{ {
case PST_UHEXEN2:
case PST_FTE32: case PST_FTE32:
case PST_KKQWSV: case PST_KKQWSV:
{ {
@ -1781,6 +1786,7 @@ static void PR_ExecuteCode (progfuncs_t *progfuncs, int s)
continue; continue;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
case PST_UHEXEN2:
s = PR_ExecuteCode32(progfuncs, s, &runaway); s = PR_ExecuteCode32(progfuncs, s, &runaway);
if (s == -1) if (s == -1)
return; return;

View file

@ -475,6 +475,7 @@ void PDECL QC_AddSharedFieldVar(pubprogfuncs_t *ppf, int num, char *stringtable)
return; return;
case PST_FTE32: case PST_FTE32:
case PST_QTEST: case PST_QTEST:
case PST_UHEXEN2:
{ {
ddef32_t *gd = pr_globaldefs32; ddef32_t *gd = pr_globaldefs32;
ddef32_t *fld = pr_fielddefs32; ddef32_t *fld = pr_fielddefs32;

View file

@ -327,6 +327,7 @@ typedef enum
PST_FTE32, //everything 32bit PST_FTE32, //everything 32bit
PST_KKQWSV, //32bit statements, 16bit globaldefs. NO SAVED GAMES. PST_KKQWSV, //32bit statements, 16bit globaldefs. NO SAVED GAMES.
PST_QTEST, //16bit statements, 32bit globaldefs(other differences converted on load) PST_QTEST, //16bit statements, 32bit globaldefs(other differences converted on load)
PST_UHEXEN2,//everything 32bit like fte's without a header, but with pre-padding rather than post-extended (little-endian) types.
} progstructtype_t; } progstructtype_t;
#ifndef COMPILER #ifndef COMPILER

View file

@ -84,7 +84,7 @@ extern int MAX_CONSTANTS;
#define MAXCONSTANTPARAMLENGTH 32 #define MAXCONSTANTPARAMLENGTH 32
#define MAXCONSTANTPARAMS 32 #define MAXCONSTANTPARAMS 32
typedef enum {QCF_STANDARD, QCF_HEXEN2, QCF_DARKPLACES, QCF_FTE, QCF_FTEDEBUG, QCF_FTEH2, QCF_KK7, QCF_QTEST} qcc_targetformat_t; typedef enum {QCF_STANDARD, QCF_HEXEN2, QCF_UHEXEN2, QCF_DARKPLACES, QCF_FTE, QCF_FTEDEBUG, QCF_FTEH2, QCF_KK7, QCF_QTEST} qcc_targetformat_t;
extern qcc_targetformat_t qcc_targetformat; extern qcc_targetformat_t qcc_targetformat;
void QCC_OPCodeSetTarget(qcc_targetformat_t targfmt); void QCC_OPCodeSetTarget(qcc_targetformat_t targfmt);

View file

@ -1179,6 +1179,7 @@ static pbool QCC_OPCodeValidForTarget(qcc_targetformat_t targfmt, QCC_opcode_t *
if (num < OP_MULSTORE_F) if (num < OP_MULSTORE_F)
return true; return true;
return false; return false;
case QCF_UHEXEN2:
case QCF_HEXEN2: case QCF_HEXEN2:
if (num >= OP_SWITCH_V && num <= OP_SWITCH_FNC) //these were assigned numbers but were never actually implemtented in standard h2. if (num >= OP_SWITCH_V && num <= OP_SWITCH_FNC) //these were assigned numbers but were never actually implemtented in standard h2.
return false; return false;
@ -6270,7 +6271,7 @@ static QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the f
if (QCC_OPCodeValid(&pr_opcodes[OP_RAND0])) if (QCC_OPCodeValid(&pr_opcodes[OP_RAND0]))
{ {
if(qcc_targetformat != QCF_HEXEN2) if(qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_UHEXEN2)
out = QCC_GetTemp(type_float); out = QCC_GetTemp(type_float);
else else
{ //hexen2 requires the output be def_ret { //hexen2 requires the output be def_ret
@ -6341,7 +6342,7 @@ static QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the f
if (QCC_OPCodeValid(&pr_opcodes[OP_RANDV0])) if (QCC_OPCodeValid(&pr_opcodes[OP_RANDV0]))
{ {
if(qcc_targetformat != QCF_HEXEN2) if(qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_UHEXEN2)
out = QCC_GetTemp(type_vector); out = QCC_GetTemp(type_vector);
else else
{ //hexen2 requires the output be def_ret { //hexen2 requires the output be def_ret
@ -11218,7 +11219,7 @@ void QCC_PR_ParseStatement (void)
QCC_PR_ParseWarning (WARN_FTE_SPECIFIC, "if !() is specific to fteqcc"); QCC_PR_ParseWarning (WARN_FTE_SPECIFIC, "if !() is specific to fteqcc");
negate = 2; negate = 2;
} }
else if (negate && qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_FTEH2) else if (negate && qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_UHEXEN2 && qcc_targetformat != QCF_FTEH2)
QCC_PR_ParseWarning (WARN_FTE_SPECIFIC, "if not() is specific to fteqcc or hexen2"); QCC_PR_ParseWarning (WARN_FTE_SPECIFIC, "if not() is specific to fteqcc or hexen2");
QCC_PR_Expect ("("); QCC_PR_Expect ("(");
@ -13941,7 +13942,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
KEYWORD(continue); KEYWORD(continue);
KEYWORD(state); KEYWORD(state);
KEYWORD(string); KEYWORD(string);
if (qcc_targetformat != QCF_HEXEN2) if (qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_UHEXEN2)
KEYWORD(float); //hmm... hexen2 requires this... KEYWORD(float); //hmm... hexen2 requires this...
KEYWORD(entity); KEYWORD(entity);
KEYWORD(vector); KEYWORD(vector);

View file

@ -1327,6 +1327,8 @@ static pbool QCC_PR_Precompiler(void)
QCC_COM_Parse(msg); QCC_COM_Parse(msg);
if (!QC_strcasecmp(qcc_token, "H2") || !QC_strcasecmp(qcc_token, "HEXEN2")) if (!QC_strcasecmp(qcc_token, "H2") || !QC_strcasecmp(qcc_token, "HEXEN2"))
newtype = QCF_HEXEN2; newtype = QCF_HEXEN2;
else if (!QC_strcasecmp(qcc_token, "UHEXEN2"))
newtype = QCF_UHEXEN2;
else if (!QC_strcasecmp(qcc_token, "KK7")) else if (!QC_strcasecmp(qcc_token, "KK7"))
newtype = QCF_KK7; newtype = QCF_KK7;
else if (!QC_strcasecmp(qcc_token, "DP") || !QC_strcasecmp(qcc_token, "DARKPLACES")) else if (!QC_strcasecmp(qcc_token, "DP") || !QC_strcasecmp(qcc_token, "DARKPLACES"))
@ -1351,9 +1353,9 @@ static pbool QCC_PR_Precompiler(void)
if (numstatements > 1) if (numstatements > 1)
{ {
if ((qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) && (newtype != QCF_HEXEN2 && newtype != QCF_FTEH2)) if ((qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_UHEXEN2 || qcc_targetformat == QCF_FTEH2) && (newtype != QCF_HEXEN2 && newtype != QCF_UHEXEN2 && newtype != QCF_FTEH2))
QCC_PR_ParseWarning(WARN_BADTARGET, "Cannot switch from hexen2 target \'%s\' after the first statement. Ignored.", msg); QCC_PR_ParseWarning(WARN_BADTARGET, "Cannot switch from hexen2 target \'%s\' after the first statement. Ignored.", msg);
if ((newtype == QCF_HEXEN2 || newtype == QCF_FTEH2) && (qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_FTEH2)) if ((newtype == QCF_HEXEN2 || newtype == QCF_UHEXEN2 || newtype == QCF_FTEH2) && (qcc_targetformat != QCF_HEXEN2 && qcc_targetformat != QCF_UHEXEN2 && qcc_targetformat != QCF_FTEH2))
QCC_PR_ParseWarning(WARN_BADTARGET, "Cannot switch to hexen2 target \'%s\' after the first statement. Ignored.", msg); QCC_PR_ParseWarning(WARN_BADTARGET, "Cannot switch to hexen2 target \'%s\' after the first statement. Ignored.", msg);
} }

View file

@ -36,7 +36,6 @@ vfile_t *qcc_vfiles;
extern QCC_def_t *sourcefilesdefs[]; extern QCC_def_t *sourcefilesdefs[];
extern int sourcefilesnumdefs; extern int sourcefilesnumdefs;
int qccpersisthunk = 1;
int Grep(const char *filename, const char *string) int Grep(const char *filename, const char *string)
{ {
int foundcount = 0; int foundcount = 0;
@ -507,6 +506,7 @@ int GUI_ParseCommandLine(const char *args, pbool keepsrcanddir)
int l, p; int l, p;
const char *next; const char *next;
int mode = 0; int mode = 0;
extern int qccpersisthunk;
if (!*args) if (!*args)
{ {
@ -848,6 +848,8 @@ int GUI_ParseCommandLine(const char *args, pbool keepsrcanddir)
parameters[paramlen-1] = '\0'; parameters[paramlen-1] = '\0';
else else
*parameters = '\0'; *parameters = '\0';
qccpersisthunk = (mode!=1);
return mode; return mode;
} }

View file

@ -409,6 +409,7 @@ struct {
{QCF_STANDARD, "quakec"}, {QCF_STANDARD, "quakec"},
{QCF_HEXEN2, "hexen2"}, {QCF_HEXEN2, "hexen2"},
{QCF_HEXEN2, "h2"}, {QCF_HEXEN2, "h2"},
{QCF_UHEXEN2, "uhexen2"},
{QCF_KK7, "kkqwsv"}, {QCF_KK7, "kkqwsv"},
{QCF_KK7, "kk7"}, {QCF_KK7, "kk7"},
{QCF_KK7, "bigprogs"}, {QCF_KK7, "bigprogs"},
@ -1442,10 +1443,18 @@ static pbool QCC_WriteData (int crc)
outputsttype = PST_FTE32; outputsttype = PST_FTE32;
} }
else if (numpr_globals > 65530) else if (numpr_globals > 65530)
{
if (qcc_targetformat == QCF_HEXEN2)
{
externs->Printf("Forcing target to uHexen2 due to numpr_globals\n");
outputsttype = PST_UHEXEN2;
}
else
{ {
externs->Printf("Forcing target to FTE32 due to numpr_globals\n"); externs->Printf("Forcing target to FTE32 due to numpr_globals\n");
outputsttype = PST_FTE32; outputsttype = PST_FTE32;
} }
}
else if (qcc_targetformat == QCF_FTEH2) else if (qcc_targetformat == QCF_FTEH2)
{ {
externs->Printf("Progs execution will require FTE\n"); externs->Printf("Progs execution will require FTE\n");
@ -1473,7 +1482,7 @@ static pbool QCC_WriteData (int crc)
if (qcc_targetformat == QCF_FTEDEBUG) if (qcc_targetformat == QCF_FTEDEBUG)
debugtarget = true; debugtarget = true;
if (outputsttype != PST_FTE32) if (outputsttype != PST_FTE32 && outputsttype != PST_UHEXEN2)
{ {
if (bigjumps) if (bigjumps)
{ {
@ -1513,10 +1522,20 @@ static pbool QCC_WriteData (int crc)
{ {
if (qcc_targetformat == QCF_DARKPLACES) if (qcc_targetformat == QCF_DARKPLACES)
externs->Printf("DarkPlaces or FTE will be required\n"); externs->Printf("DarkPlaces or FTE will be required\n");
else if (outputsttype == PST_UHEXEN2)
externs->Printf("FTE or uHexen2 will be required\n");
else else
externs->Printf("FTE's QCLib will be required\n"); externs->Printf("FTE's QCLib will be required\n");
} }
break; break;
case QCF_UHEXEN2:
debugtarget = false;
outputsttype = PST_UHEXEN2;
if (verbose)
externs->Printf("uHexen2 will be required\n");
if (numpr_globals < 65535)
externs->Printf("Warning: outputting 32 uHexen2 format when 16bit would suffice\n");
break;
case QCF_KK7: case QCF_KK7:
if (bodylessfuncs) if (bodylessfuncs)
externs->Printf("Warning: There are some functions without bodies.\n"); externs->Printf("Warning: There are some functions without bodies.\n");
@ -1565,6 +1584,7 @@ static pbool QCC_WriteData (int crc)
funcdatasize = numfunctions*sizeof(*funcs); funcdatasize = numfunctions*sizeof(*funcs);
} }
break; break;
case PST_UHEXEN2:
case PST_DEFAULT: case PST_DEFAULT:
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
@ -2017,7 +2037,7 @@ strofs = (strofs+3)&~3;
progs.ofs_statements = SafeSeek (h, 0, SEEK_CUR); progs.ofs_statements = SafeSeek (h, 0, SEEK_CUR);
progs.numstatements = numstatements; progs.numstatements = numstatements;
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_UHEXEN2 || qcc_targetformat == QCF_FTEH2)
{ {
for (i=0 ; i<numstatements ; i++) for (i=0 ; i<numstatements ; i++)
{ {
@ -2040,6 +2060,23 @@ strofs = (strofs+3)&~3;
switch(outputsttype) switch(outputsttype)
{ {
case PST_UHEXEN2:
{
QCC_dstatement32_t *statements32 = qccHunkAlloc(sizeof(*statements32) * numstatements);
for (i=0 ; i<numstatements ; i++)
{
statements32[i].op = PRLittleLong(statements[i].op<<16);
statements32[i].a = PRLittleLong((statements[i].a.sym?statements[i].a.sym->ofs:0) + statements[i].a.ofs);
statements32[i].b = PRLittleLong((statements[i].b.sym?statements[i].b.sym->ofs:0) + statements[i].b.ofs);
statements32[i].c = PRLittleLong((statements[i].c.sym?statements[i].c.sym->ofs:0) + statements[i].c.ofs);
if (verbose >= VERBOSE_DEBUGSTATEMENTS)
externs->Printf("code: %s:%i: @%i %s %i %i %i\n", QCC_FileForStatement(i), statements[i].linenum, i, pr_opcodes[statements[i].op].name, statements32[i].a, statements32[i].b, statements32[i].c);
}
SafeWrite (h, statements32, numstatements*sizeof(QCC_dstatement32_t));
}
break;
case PST_KKQWSV: case PST_KKQWSV:
case PST_FTE32: case PST_FTE32:
{ {
@ -2227,6 +2264,52 @@ strofs = (strofs+3)&~3;
fields[i].s_name = PRLittleLong (fields[i].s_name); fields[i].s_name = PRLittleLong (fields[i].s_name);
} }
if (progs.blockscompressed&4)
{
SafeWrite (h, &len, sizeof(int)); //save for later
len = QC_encode(progfuncs, numfielddefs*sizeof(QCC_ddef_t), 2, (char *)fields, h); //write
i = SafeSeek (h, 0, SEEK_CUR);
SafeSeek(h, progs.ofs_fielddefs, SEEK_SET);//seek back
len = PRLittleLong(len);
SafeWrite (h, &len, sizeof(int)); //write size.
SafeSeek(h, i, SEEK_SET);
}
else
SafeWrite (h, fields, numfielddefs*sizeof(QCC_ddef_t));
break;
case PST_UHEXEN2:
progs.ofs_globaldefs = SafeSeek (h, 0, SEEK_CUR);
progs.numglobaldefs = numglobaldefs;
for (i=0 ; i<numglobaldefs ; i++)
{
qcc_globals[i].type = PRLittleLong (qcc_globals[i].type<<16);
qcc_globals[i].ofs = PRLittleLong (qcc_globals[i].ofs);
qcc_globals[i].s_name = PRLittleLong (qcc_globals[i].s_name);
}
if (progs.blockscompressed&2)
{
SafeWrite (h, &len, sizeof(int)); //save for later
len = QC_encode(progfuncs, numglobaldefs*sizeof(QCC_ddef_t), 2, (char *)qcc_globals, h); //write
i = SafeSeek (h, 0, SEEK_CUR);
SafeSeek(h, progs.ofs_globaldefs, SEEK_SET);//seek back
len = PRLittleLong(len);
SafeWrite (h, &len, sizeof(int)); //write size.
SafeSeek(h, i, SEEK_SET);
}
else
SafeWrite (h, qcc_globals, numglobaldefs*sizeof(QCC_ddef_t));
progs.ofs_fielddefs = SafeSeek (h, 0, SEEK_CUR);
progs.numfielddefs = numfielddefs;
for (i=0 ; i<numfielddefs ; i++)
{
fields[i].type = PRLittleLong/*PRLittleShort*/ (fields[i].type<<16);
fields[i].ofs = PRLittleLong/*PRLittleShort*/ (fields[i].ofs);
fields[i].s_name = PRLittleLong (fields[i].s_name);
}
if (progs.blockscompressed&4) if (progs.blockscompressed&4)
{ {
SafeWrite (h, &len, sizeof(int)); //save for later SafeWrite (h, &len, sizeof(int)); //save for later
@ -2347,10 +2430,6 @@ strofs = (strofs+3)&~3;
progs.version = PROG_QTESTVERSION; progs.version = PROG_QTESTVERSION;
progs.ofsfiles = WriteSourceFiles(qcc_sourcefile, h, debugtarget, false); progs.ofsfiles = WriteSourceFiles(qcc_sourcefile, h, debugtarget, false);
break; break;
case QCF_KK7:
progs.version = PROG_KKQWSVVERSION;
progs.ofsfiles = WriteSourceFiles(qcc_sourcefile, h, debugtarget, false);
break;
default: default:
case QCF_STANDARD: case QCF_STANDARD:
case QCF_HEXEN2: //urgh case QCF_HEXEN2: //urgh
@ -2361,10 +2440,16 @@ strofs = (strofs+3)&~3;
case QCF_FTE: case QCF_FTE:
case QCF_FTEH2: case QCF_FTEH2:
case QCF_FTEDEBUG: case QCF_FTEDEBUG:
case QCF_UHEXEN2:
case QCF_KK7:
progs.version = PROG_EXTENDEDVERSION; progs.version = PROG_EXTENDEDVERSION;
if (outputsttype == PST_FTE32) if (outputsttype == PST_UHEXEN2)
progs.secondaryversion = PROG_SECONDARYVERSION32; progs.secondaryversion = PROG_SECONDARYUHEXEN2; //prepadded...
else if (outputsttype == QCF_KK7)
progs.secondaryversion = PROG_SECONDARYKKQWSV; //messed up
else if (outputsttype == PST_FTE32)
progs.secondaryversion = PROG_SECONDARYVERSION32; //post-extended.
else else
progs.secondaryversion = PROG_SECONDARYVERSION16; progs.secondaryversion = PROG_SECONDARYVERSION16;
@ -2487,7 +2572,11 @@ strofs = (strofs+3)&~3;
externs->Printf("Compile finished: %s (id format)\n", destfile); externs->Printf("Compile finished: %s (id format)\n", destfile);
break; break;
case QCF_HEXEN2: case QCF_HEXEN2:
case QCF_UHEXEN2:
if (progs.version == PROG_VERSION)
externs->Printf("Compile finished: %s (hexen2 format)\n", destfile); externs->Printf("Compile finished: %s (hexen2 format)\n", destfile);
else
externs->Printf("Compile finished: %s (uhexen2 format)\n", destfile);
break; break;
case QCF_DARKPLACES: case QCF_DARKPLACES:
externs->Printf("Compile finished: %s (patched-dp format)\n", destfile); externs->Printf("Compile finished: %s (patched-dp format)\n", destfile);
@ -3413,7 +3502,7 @@ static unsigned short QCC_PR_WriteProgdefs (char *filename)
// print global vars until the first field is defined // print global vars until the first field is defined
ADD_CRC("\n/* "); ADD_CRC("\n/* ");
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_UHEXEN2 || qcc_targetformat == QCF_FTEH2)
EAT_CRC("generated by hcc, do not modify"); EAT_CRC("generated by hcc, do not modify");
else else
EAT_CRC("file generated by qcc, do not modify"); EAT_CRC("file generated by qcc, do not modify");
@ -4521,7 +4610,7 @@ static void QCC_SetDefaultProperties (void)
qccwarningaction[WARN_IDENTICALPRECOMPILER] = WA_IGNORE; qccwarningaction[WARN_IDENTICALPRECOMPILER] = WA_IGNORE;
qccwarningaction[WARN_DENORMAL] = WA_ERROR; //DAZ provides a speedup on modern machines, so any engine compiled for sse2+ will have problems with denormals, so make their use look serious. qccwarningaction[WARN_DENORMAL] = WA_ERROR; //DAZ provides a speedup on modern machines, so any engine compiled for sse2+ will have problems with denormals, so make their use look serious.
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_UHEXEN2 || qcc_targetformat == QCF_FTEH2)
qccwarningaction[WARN_CASEINSENSITIVEFRAMEMACRO] = WA_IGNORE; //hexenc consides these fair game. qccwarningaction[WARN_CASEINSENSITIVEFRAMEMACRO] = WA_IGNORE; //hexenc consides these fair game.
if (QCC_CheckParm ("-Fqccx")) if (QCC_CheckParm ("-Fqccx"))
@ -4534,7 +4623,7 @@ static void QCC_SetDefaultProperties (void)
QCC_PR_CommandLinePrecompilerOptions(); QCC_PR_CommandLinePrecompilerOptions();
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) //force on the thinktime keyword if hexen2 progs. if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_UHEXEN2 || qcc_targetformat == QCF_FTEH2) //force on the thinktime keyword if hexen2 progs.
{ {
keyword_thinktime = true; //thinktime self : 0.1; keyword_thinktime = true; //thinktime self : 0.1;
keyword_until = true; //until(cond) {code}; or do{code}until(cond); keyword_until = true; //until(cond) {code}; or do{code}until(cond);

View file

@ -124,6 +124,7 @@ int main (int argc, const char **argv)
#else #else
pbool writelog = false; //other systems are sane. pbool writelog = false; //other systems are sane.
#endif #endif
int colours = 2; //auto
progexterns_t ext; progexterns_t ext;
progfuncs_t funcs; progfuncs_t funcs;
progfuncs = &funcs; progfuncs = &funcs;
@ -136,8 +137,27 @@ int main (int argc, const char **argv)
funcs.funcs.parms->Printf = logprintf; funcs.funcs.parms->Printf = logprintf;
funcs.funcs.parms->Sys_Error = Sys_Error; funcs.funcs.parms->Sys_Error = Sys_Error;
for (i = 0; i < argc; i++)
{
if (!argv[i])
continue;
if (!strcmp(argv[i], "-log"))
writelog = true;
else if (!strcmp(argv[i], "-nolog"))
writelog = false;
//arg consistency with ls
else if (!strcmp(argv[i], "--color=always") || !strcmp(argv[i], "--color"))
colours = 1;
else if (!strcmp(argv[i], "--color=never"))
colours = 0;
else if (!strcmp(argv[i], "--color=auto"))
colours = 2;
}
#if defined(__linux__) || defined(__unix__) #if defined(__linux__) || defined(__unix__)
if (isatty(STDOUT_FILENO)) if (colours == 2)
colours = isatty(STDOUT_FILENO);
if (colours)
{ //only use colours if its a tty, and not if we're redirected. { //only use colours if its a tty, and not if we're redirected.
col_none = "\e[0;m"; //reset to white col_none = "\e[0;m"; //reset to white
col_error = "\e[0;31m"; //red col_error = "\e[0;31m"; //red
@ -148,17 +168,10 @@ int main (int argc, const char **argv)
//col_ = "\e[0;36m"; //cyan //col_ = "\e[0;36m"; //cyan
col_location = "\e[0;1;37m"; //bright white col_location = "\e[0;1;37m"; //bright white
} }
#else
(void)colours;
#endif #endif
for (i = 0; i < argc; i++)
{
if (!argv[i])
continue;
if (!strcmp(argv[i], "-log"))
writelog = true;
else if (!strcmp(argv[i], "-nolog"))
writelog = false;
}
logfile = writelog?fopen("fteqcc.log", "wt"):false; logfile = writelog?fopen("fteqcc.log", "wt"):false;
if (logfile) if (logfile)

View file

@ -31,14 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define INVIS_CHAR2 (char)138 #define INVIS_CHAR2 (char)138
#define INVIS_CHAR3 (char)160 #define INVIS_CHAR3 (char)160
#ifndef HAVE_CLIENT
double host_frametime;
double realtime; // without any filtering or bounding
qboolean host_initialized; // true if into command execution (compatability)
quakeparms_t host_parms;
int host_hunklevel;
#endif
client_t *host_client; // current client client_t *host_client; // current client
void CvarPostfixKMG(cvar_t *v, char *oldval) void CvarPostfixKMG(cvar_t *v, char *oldval)

View file

@ -8,6 +8,10 @@ plugclientfuncs_t *clientfuncs;
plugfsfuncs_t *filefuncs; plugfsfuncs_t *filefuncs;
pluginputfuncs_t *inputfuncs; pluginputfuncs_t *inputfuncs;
struct ezcl_s cl;
struct ezcls_s cls;
struct ezvid_s vid;
int sb_lines; int sb_lines;
float scr_con_current; float scr_con_current;
int sb_showteamscores; int sb_showteamscores;

View file

@ -59,7 +59,7 @@ extern cvar_t *cl_multiview;
#define cl plugcl #define cl plugcl
#define player_info_t plugclientinfo_t #define player_info_t plugclientinfo_t
struct { extern struct ezcl_s{
int intermission; int intermission;
int teamplay; int teamplay;
int deathmatch; int deathmatch;
@ -79,7 +79,7 @@ struct {
int splitscreenview; int splitscreenview;
} cl; } cl;
struct { extern struct ezcls_s{
int state; int state;
float min_fps; float min_fps;
float fps; float fps;
@ -88,7 +88,7 @@ struct {
qbool mvdplayback; qbool mvdplayback;
int demoplayback; int demoplayback;
} cls; } cls;
struct { extern struct ezvid_s{
int width; int width;
int height; int height;
// float displayFrequency; // float displayFrequency;

View file

@ -2392,6 +2392,7 @@ static qboolean GLTF_ProcessMesh(gltf_t *gltf, json_t *meshid, int basebone, dou
GLTF_AccessorToDataF(gltf, surf->numverts, countof(surf->ofs_skel_norm[0]), &morph_norm[i], surf->ofs_skel_norm+offset); //if no normals, normals should be flat (fragment shader or unwelding the verts...) GLTF_AccessorToDataF(gltf, surf->numverts, countof(surf->ofs_skel_norm[0]), &morph_norm[i], surf->ofs_skel_norm+offset); //if no normals, normals should be flat (fragment shader or unwelding the verts...)
GLTF_AccessorToTangents(gltf, surf->ofs_skel_norm+offset, surf->numverts, &morph_tang[i], surf->ofs_skel_svect+offset, surf->ofs_skel_tvect+offset); GLTF_AccessorToTangents(gltf, surf->ofs_skel_norm+offset, surf->numverts, &morph_tang[i], surf->ofs_skel_svect+offset, surf->ofs_skel_tvect+offset);
} }
surf->meshrootbone = basebone; //needed for morph anims
surf->ofs_st_array = GLTF_AccessorToDataF(gltf, surf->numverts, countof(surf->ofs_st_array[0]), &tc_0, NULL); surf->ofs_st_array = GLTF_AccessorToDataF(gltf, surf->numverts, countof(surf->ofs_st_array[0]), &tc_0, NULL);
if (tc_1.data) if (tc_1.data)
@ -3053,13 +3054,12 @@ struct galiasanimation_gltf_s
struct gltf_animsampler rot,scale,trans,morph; struct gltf_animsampler rot,scale,trans,morph;
} bone[1]; } bone[1];
}; };
cvar_t temp1;
static const float *QDECL GLTF_AnimateMorphs(const galiasinfo_t *surf, const framestate_t *framestate) static const float *QDECL GLTF_AnimateMorphs(const galiasinfo_t *surf, const framestate_t *framestate)
{ {
static float morphs[MAX_MORPHWEIGHTS]; static float morphs[MAX_MORPHWEIGHTS];
float imorphs[MAX_MORPHWEIGHTS], *src; float imorphs[MAX_MORPHWEIGHTS], *src;
size_t influence, m; size_t influence, m;
int bone = temp1.ival; int bone = surf->meshrootbone;
const struct galiasanimation_gltf_s *a; const struct galiasanimation_gltf_s *a;
const struct framestateregion_s *fg = &framestate->g[FS_REG]; const struct framestateregion_s *fg = &framestate->g[FS_REG];
memset(morphs, 0, sizeof(morphs[0])*surf->nummorphs); memset(morphs, 0, sizeof(morphs[0])*surf->nummorphs);