diff --git a/quake2/Makefile b/quake2/Makefile index 40c3019..866941c 100644 --- a/quake2/Makefile +++ b/quake2/Makefile @@ -30,6 +30,7 @@ BUILD_AA=NO # build the ascii soft rend BUILD_QMAX=NO # build the fancier GL graphics BUILD_RETEXTURE=NO # build a version supporting retextured graphics BUILD_REDBLUE=NO # build a red-blue 3d glasses renderer... +BUILD_ASM=NO # use ASM STATICSDL=NO SDLDIR=/usr/local/lib @@ -129,6 +130,10 @@ else NET_UDP=net_udp endif +ifeq ($(strip $(BUILD_ASM)),YES) + BASE_CFLAGS+=-DUSE_ASM +endif + ifeq ($(strip $(BUILD_QMAX)),YES) BASE_CFLAGS+=-DQMAX endif @@ -1588,6 +1593,7 @@ REF_SOFT_OBJS += $(BUILDDIR)/ref_soft/jo endif ifeq ($(ARCH),i386) +ifeq ($(strip $(BUILD_ASM)),YES) REF_SOFT_OBJS += \ $(BUILDDIR)/ref_soft/r_aclipa.o \ $(BUILDDIR)/ref_soft/r_draw16.o \ @@ -1601,6 +1607,7 @@ REF_SOFT_OBJS += \ $(BUILDDIR)/ref_soft/r_varsa.o \ $(BUILDDIR)/ref_soft/sys_dosa.o endif +endif REF_SOFT_SVGA_OBJS = \ $(BUILDDIR)/ref_soft/rw_svgalib.o \ diff --git a/quake2/src/client/snd_mix.c b/quake2/src/client/snd_mix.c index 803b1c2..019af61 100644 --- a/quake2/src/client/snd_mix.c +++ b/quake2/src/client/snd_mix.c @@ -31,7 +31,7 @@ short *snd_out; void S_WriteLinearBlastStereo16 (void); #if !((defined __linux__ || defined __FreeBSD__) && defined __i386__) || defined C_ONLY -#if !id386 +#if !id386 || !defined USE_ASM void S_WriteLinearBlastStereo16 (void) { @@ -363,7 +363,7 @@ void S_InitScaletable (void) #if !((defined __linux__ || __FreeBSD__) && defined __i386__) || defined C_ONLY -#if !id386 +#if !id386 || !defined USE_ASM void S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int offset) { diff --git a/quake2/src/client/x86.c b/quake2/src/client/x86.c index 82cb807..9dd03d8 100644 --- a/quake2/src/client/x86.c +++ b/quake2/src/client/x86.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suit #include #include "client.h" -#if id386 +#if id386 && defined USE_ASM static unsigned long bias; static unsigned long *histogram; diff --git a/quake2/src/ctf/q_shared.c b/quake2/src/ctf/q_shared.c index a14bbcc..b1959a1 100644 --- a/quake2/src/ctf/q_shared.c +++ b/quake2/src/ctf/q_shared.c @@ -345,7 +345,7 @@ BoxOnPlaneSide Returns 1, 2, or 1 + 2 ================== */ -#if !id386 || defined __linux__ || defined __FreeBSD__ +#if !id386 || !defined USE_ASM || defined __linux__ || defined __FreeBSD__ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { float dist1, dist2; diff --git a/quake2/src/game/q_shared.c b/quake2/src/game/q_shared.c index 6e5ac79..5829443 100644 --- a/quake2/src/game/q_shared.c +++ b/quake2/src/game/q_shared.c @@ -345,7 +345,7 @@ BoxOnPlaneSide Returns 1, 2, or 1 + 2 ================== */ -#if !id386 || defined __linux__ || defined __FreeBSD__ || defined __sun__ +#if !id386 || !defined USE_ASM || defined __linux__ || defined __FreeBSD__ || defined __sun__ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { float dist1, dist2; diff --git a/quake2/src/irix/sys_irix.c b/quake2/src/irix/sys_irix.c index 2f2cefc..aefb7bc 100644 --- a/quake2/src/irix/sys_irix.c +++ b/quake2/src/irix/sys_irix.c @@ -97,7 +97,7 @@ void Sys_Quit (void) void Sys_Init(void) { -#if id386 +#if id386 && defined USE_ASM // Sys_SetFPCW(); #endif } diff --git a/quake2/src/linux/sys_linux.c b/quake2/src/linux/sys_linux.c index a595bc4..81daf10 100644 --- a/quake2/src/linux/sys_linux.c +++ b/quake2/src/linux/sys_linux.c @@ -92,7 +92,7 @@ void Sys_Quit (void) void Sys_Init(void) { -#if id386 +#if id386 && defined USE_ASM // Sys_SetFPCW(); #endif } diff --git a/quake2/src/ref_gl/gl_warp.c b/quake2/src/ref_gl/gl_warp.c index 3a35d77..6005997 100644 --- a/quake2/src/ref_gl/gl_warp.c +++ b/quake2/src/ref_gl/gl_warp.c @@ -231,7 +231,7 @@ void EmitWaterPolys (msurface_t *fa) os = v[3]; ot = v[4]; -#if !id386 +#if !id386 || !defined USE_ASM s = os + r_turbsin[(int)((ot*0.125+r_newrefdef.time) * TURBSCALE) & 255]; #else s = os + r_turbsin[Q_ftol( ((ot*0.125+rdt) * TURBSCALE) ) & 255]; @@ -239,7 +239,7 @@ #endif s += scroll; s *= (1.0/64); -#if !id386 +#if !id386 || !defined USE_ASM t = ot + r_turbsin[(int)((os*0.125+rdt) * TURBSCALE) & 255]; #else t = ot + r_turbsin[Q_ftol( ((os*0.125+rdt) * TURBSCALE) ) & 255]; diff --git a/quake2/src/ref_soft/r_aclip.c b/quake2/src/ref_soft/r_aclip.c index 3d42125..fb21cf5 100644 --- a/quake2/src/ref_soft/r_aclip.c +++ b/quake2/src/ref_soft/r_aclip.c @@ -60,7 +60,7 @@ void R_Alias_clip_z (finalvert_t *pfv0, } -#if !id386 +#if !id386 || !defined USE_ASM void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { diff --git a/quake2/src/ref_soft/r_alias.c b/quake2/src/ref_soft/r_alias.c index 4002063..1170bee 100644 --- a/quake2/src/ref_soft/r_alias.c +++ b/quake2/src/ref_soft/r_alias.c @@ -418,7 +418,7 @@ void R_AliasSetUpTransform (void) R_AliasTransformFinalVerts ================ */ -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ void R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv ) { float lightcos; diff --git a/quake2/src/ref_soft/r_edge.c b/quake2/src/ref_soft/r_edge.c index 389dc10..6f91921 100644 --- a/quake2/src/ref_soft/r_edge.c +++ b/quake2/src/ref_soft/r_edge.c @@ -140,7 +140,7 @@ void R_BeginEdgeFrame (void) } -#if !id386 +#if !id386 || !defined USE_ASM /* ============== @@ -186,7 +186,7 @@ addedge: #endif // !id386 -#if !id386 +#if !id386 || !defined USE_ASM /* ============== @@ -206,7 +206,7 @@ void R_RemoveEdges (edge_t *pedge) #endif // !id386 -#if !id386 +#if !id386 || !defined USE_ASM /* ============== @@ -429,7 +429,7 @@ void R_TrailingEdge (surf_t *surf, edge_ } -#if !id386 +#if !id386 || !defined USE_ASM /* ============== diff --git a/quake2/src/ref_soft/r_main.c b/quake2/src/ref_soft/r_main.c index 3d90dbc..b0456fd 100644 --- a/quake2/src/ref_soft/r_main.c +++ b/quake2/src/ref_soft/r_main.c @@ -143,7 +143,7 @@ cvar_t *sw_lockpvs; #define STRINGER(x) "x" -#if !id386 +#if !id386 || !defined USE_ASM // r_vars.c @@ -317,7 +317,7 @@ int R_Init( void *hInstance, void *wndPr r_refdef.yOrigin = YCENTERING; // TODO: collect 386-specific code in one place -#if id386 +#if id386 && defined USE_ASM Sys_MakeCodeWriteable ((long)R_EdgeCodeStart, (long)R_EdgeCodeEnd - (long)R_EdgeCodeStart); Sys_SetFPCW (); // get bit masks for FPCW (FIXME: is this id386?) diff --git a/quake2/src/ref_soft/r_misc.c b/quake2/src/ref_soft/r_misc.c index 0ef2fe1..a9b6b0c 100644 --- a/quake2/src/ref_soft/r_misc.c +++ b/quake2/src/ref_soft/r_misc.c @@ -49,7 +49,7 @@ D_Patch */ void D_Patch (void) { -#if id386 +#if id386 && defined USE_ASM extern void D_Aff8Patch( void ); static qboolean protectset8 = false; extern void D_PolysetAff8Start( void ); @@ -206,7 +206,7 @@ void R_TransformFrustum (void) } -#if !id386 +#if !id386 || !defined USE_ASM /* ================ TransformVector @@ -514,7 +514,7 @@ void R_SetupFrame (void) } -#if !id386 +#if !id386 || !defined USE_ASM /* ================ diff --git a/quake2/src/ref_soft/r_part.c b/quake2/src/ref_soft/r_part.c index 4dd1195..ed5bb1e 100644 --- a/quake2/src/ref_soft/r_part.c +++ b/quake2/src/ref_soft/r_part.c @@ -34,7 +34,7 @@ typedef struct static partparms_t partparms; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ static unsigned s_prefetch_address; @@ -598,7 +598,7 @@ void R_DrawParticles (void) particle_t *p; int i; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ extern unsigned long fpu_sp24_cw, fpu_chop_cw; #endif @@ -606,7 +606,7 @@ #endif VectorScale( vup, yscaleshrink, r_pup ); VectorCopy( vpn, r_ppn ); -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ __asm fldcw word ptr [fpu_sp24_cw] #endif @@ -623,7 +623,7 @@ #endif partparms.particle = p; partparms.color = p->color; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ if ( i < r_newrefdef.num_particles-1 ) s_prefetch_address = ( unsigned int ) ( p + 1 ); else @@ -633,7 +633,7 @@ #endif R_DrawParticle(); } -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ __asm fldcw word ptr [fpu_chop_cw] #endif diff --git a/quake2/src/ref_soft/r_polyse.c b/quake2/src/ref_soft/r_polyse.c index 713c2f0..ca7bf1d 100644 --- a/quake2/src/ref_soft/r_polyse.c +++ b/quake2/src/ref_soft/r_polyse.c @@ -411,7 +411,7 @@ void R_PolysetSetUpForLineScan(fixed8_t R_PolysetCalcGradients ================ */ -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && defined USE_ASM && !defined __linux__ && !defined __FreeBSD__ void R_PolysetCalcGradients( int skinwidth ) { static float xstepdenominv, ystepdenominv, t0, t1; @@ -716,7 +716,7 @@ void R_PolysetCalcGradients (int skinwid ystepdenominv); //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { a_sstepxfrac = r_sstepx << 16; @@ -1034,7 +1034,7 @@ void R_PolysetDrawSpansConstant8_66( spa } while (pspanpackage->count != -999999); } -#if !id386 +#if !id386 || !defined USE_ASM void R_PolysetDrawSpans8_Opaque (spanpackage_t *pspanpackage) { int lcount; @@ -1183,7 +1183,7 @@ void R_RasterizeAliasPolySmooth (void) d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> 16) + (plefttop[3] >> 16) * r_affinetridesc.skinwidth; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_sfrac = (plefttop[2] & 0xFFFF) << 16; @@ -1226,7 +1226,7 @@ #endif pleftbottom[0], pleftbottom[1]); //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_pzbasestep = (d_zwidth + ubasestep) << 1; @@ -1259,7 +1259,7 @@ #endif ((r_tstepy + r_tstepx * ubasestep) >> 16) * r_affinetridesc.skinwidth; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16; @@ -1280,7 +1280,7 @@ #endif ((r_tstepy + r_tstepx * d_countextrastep) >> 16) * r_affinetridesc.skinwidth; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) << 16; @@ -1297,7 +1297,7 @@ #endif d_lightextrastep = d_lightbasestep + working_lstepx; d_ziextrastep = d_zibasestep + r_zistepx; -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { R_PolysetScanLeftEdge (initialleftheight); @@ -1360,7 +1360,7 @@ #endif d_pdestextrastep = d_pdestbasestep + 1; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_pzbasestep = (d_zwidth + ubasestep) << 1; @@ -1385,7 +1385,7 @@ #endif ((r_tstepy + r_tstepx * ubasestep) >> 16) * r_affinetridesc.skinwidth; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16; @@ -1406,7 +1406,7 @@ #endif ((r_tstepy + r_tstepx * d_countextrastep) >> 16) * r_affinetridesc.skinwidth; //#if id386ALIAS -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { d_sfracextrastep = ((r_sstepy+r_sstepx*d_countextrastep) & 0xFFFF)<<16; @@ -1423,7 +1423,7 @@ #endif d_lightextrastep = d_lightbasestep + working_lstepx; d_ziextrastep = d_zibasestep + r_zistepx; -#if id386 +#if id386 && defined USE_ASM if ( d_pdrawspans == R_PolysetDrawSpans8_Opaque ) { R_PolysetScanLeftEdge (height); diff --git a/quake2/src/ref_soft/r_rast.c b/quake2/src/ref_soft/r_rast.c index ddcb5df..f086201 100644 --- a/quake2/src/ref_soft/r_rast.c +++ b/quake2/src/ref_soft/r_rast.c @@ -209,7 +209,7 @@ void R_EmitSkyBox (void) } -#if !id386 +#if !id386 || !defined USE_ASM /* ================ diff --git a/quake2/src/ref_soft/r_scan.c b/quake2/src/ref_soft/r_scan.c index af95576..6fc7027 100644 --- a/quake2/src/ref_soft/r_scan.c +++ b/quake2/src/ref_soft/r_scan.c @@ -92,7 +92,7 @@ void D_WarpScreen (void) } -#if !id386 +#if !id386 || !defined USE_ASM /* ============= @@ -387,7 +387,7 @@ void NonTurbulent8 (espan_t *pspan) //==================== -#if !id386 +#if !id386 || !defined USE_ASM /* ============= @@ -527,7 +527,7 @@ void D_DrawSpans16 (espan_t *pspan) #endif -#if !id386 +#if !id386 || !defined USE_ASM /* ============= diff --git a/quake2/src/ref_soft/r_surf.c b/quake2/src/ref_soft/r_surf.c index 0f309d8..13958a5 100644 --- a/quake2/src/ref_soft/r_surf.c +++ b/quake2/src/ref_soft/r_surf.c @@ -163,7 +163,7 @@ void R_DrawSurface (void) //============================================================================= -#if !id386 +#if !id386 || !defined USE_ASM /* ================ diff --git a/quake2/src/solaris/sys_solaris.c b/quake2/src/solaris/sys_solaris.c index 053578d..801d617 100644 --- a/quake2/src/solaris/sys_solaris.c +++ b/quake2/src/solaris/sys_solaris.c @@ -122,7 +122,7 @@ void Sys_Quit (void) void Sys_Init(void) { -#if id386 +#if id386 && defined USE_ASM // Sys_SetFPCW(); #endif } diff --git a/quake2/src/win32/rw_imp.c b/quake2/src/win32/rw_imp.c index fa2d8e7..900db76 100644 --- a/quake2/src/win32/rw_imp.c +++ b/quake2/src/win32/rw_imp.c @@ -433,7 +433,7 @@ void Sys_MakeCodeWriteable (unsigned lon ** RR = 11 = round to zero (truncate/towards 0) ** */ -#if !id386 +#if !id386 || !defined USE_ASM void Sys_SetFPCW (void) { }