Fixed waterwarp crashing... for now (workaround for higher resolutions)

This commit is contained in:
Marco Vicari 2016-02-20 18:58:54 +01:00
parent 911190a5bb
commit b0873c7499
16 changed files with 63 additions and 1056 deletions

View file

@ -1,319 +0,0 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// quakeasm.h: general asm header file
//
//
// The precompiler definition "__i386__" comes from the DJGPP package and
// states that the code is compiled for an Intel x386 compatible machine.
// Windows compilers (definition "_WIN32") do not provide this DJGPP definition,
// but provide something similar called "_M_IX86". So when using a Windows
// compiler "__i386__" can be created when "_WIN32" and "_M_IX86" are defined.
//
// If you do not want to use assembler code, then set the definition "id386" to
// zero (0) in QUAKEASM.H for asm sources and in QUAKEDEF.H for C sources
//
#if defined(_WIN32) && !defined(WINDED)
#if defined(_M_IX86)
#define __i386__ 1
#endif
#endif
#ifdef __i386__ //precompiler directive of DJGPP
#define id386 1
#define id386poly 0
#define id386rgb 0
#define colhack 0
#else
#define id386 0
#define id386rgb 0
#define colhack 0
#endif
// !!! must be kept the same as in d_iface.h !!!
#define TRANSPARENT_COLOR 255
#ifndef NeXT
#ifndef GLQUAKE
.extern C(d_zistepu)
.extern C(d_pzbuffer)
.extern C(d_zistepv)
.extern C(d_zrowbytes)
.extern C(d_ziorigin)
.extern C(r_turb_s)
.extern C(r_turb_t)
.extern C(r_turb_pdest)
.extern C(r_turb_spancount)
.extern C(r_turb_turb)
.extern C(r_turb_pbase)
.extern C(r_turb_sstep)
.extern C(r_turb_tstep)
.extern C(r_bmodelactive)
.extern C(d_sdivzstepu)
.extern C(d_tdivzstepu)
.extern C(d_sdivzstepv)
.extern C(d_tdivzstepv)
.extern C(d_sdivzorigin)
.extern C(d_tdivzorigin)
.extern C(sadjust)
.extern C(tadjust)
.extern C(bbextents)
.extern C(bbextentt)
.extern C(cacheblock)
.extern C(d_viewbuffer)
.extern C(cachewidth)
.extern C(d_pzbuffer)
.extern C(d_zrowbytes)
.extern C(d_zwidth)
.extern C(d_scantable)
.extern C(r_lightptr)
.extern C(r_numvblocks)
.extern C(prowdestbase)
.extern C(pbasesource)
.extern C(r_lightwidth)
.extern C(lightright)
.extern C(lightrightstep)
.extern C(lightdeltastep)
.extern C(lightdelta)
.extern C(lightright)
.extern C(lightdelta)
.extern C(sourcetstep)
.extern C(surfrowbytes)
.extern C(lightrightstep)
.extern C(lightdeltastep)
.extern C(r_sourcemax)
.extern C(r_stepback)
.extern C(colormap)
.extern C(blocksize)
.extern C(sourcesstep)
.extern C(lightleft)
.extern C(blockdivshift)
.extern C(blockdivmask)
.extern C(lightleftstep)
.extern C(r_origin)
.extern C(r_ppn)
.extern C(r_pup)
.extern C(r_pright)
.extern C(ycenter)
.extern C(xcenter)
.extern C(d_vrectbottom_particle)
.extern C(d_vrectright_particle)
.extern C(d_vrecty)
.extern C(d_vrectx)
.extern C(d_pix_shift)
.extern C(d_pix_min)
.extern C(d_pix_max)
.extern C(d_y_aspect_shift)
.extern C(screenwidth)
.extern C(r_leftclipped)
.extern C(r_leftenter)
.extern C(r_rightclipped)
.extern C(r_rightenter)
.extern C(modelorg)
.extern C(xscale)
.extern C(r_refdef)
.extern C(yscale)
.extern C(r_leftexit)
.extern C(r_rightexit)
.extern C(r_lastvertvalid)
.extern C(cacheoffset)
.extern C(newedges)
.extern C(removeedges)
.extern C(r_pedge)
.extern C(r_framecount)
.extern C(r_u1)
.extern C(r_emitted)
.extern C(edge_p)
.extern C(surface_p)
.extern C(surfaces)
.extern C(r_lzi1)
.extern C(r_v1)
.extern C(r_ceilv1)
.extern C(r_nearzi)
.extern C(r_nearzionly)
.extern C(edge_aftertail)
.extern C(edge_tail)
.extern C(current_iv)
.extern C(edge_head_u_shift20)
.extern C(span_p)
.extern C(edge_head)
.extern C(fv)
.extern C(edge_tail_u_shift20)
.extern C(r_apverts)
.extern C(r_anumverts)
.extern C(aliastransform)
.extern C(r_avertexnormals)
.extern C(r_plightvec)
.extern C(r_ambientlight)
.extern C(r_shadelight)
.extern C(aliasxcenter)
.extern C(aliasycenter)
.extern C(a_sstepxfrac)
.extern C(r_affinetridesc)
.extern C(acolormap)
.extern C(d_pcolormap)
.extern C(r_affinetridesc)
.extern C(d_sfrac)
.extern C(d_ptex)
.extern C(d_pedgespanpackage)
.extern C(d_tfrac)
.extern C(d_light)
.extern C(d_zi)
.extern C(d_pdest)
.extern C(d_pz)
.extern C(d_aspancount)
.extern C(erroradjustup)
.extern C(errorterm)
.extern C(d_xdenom)
.extern C(r_p0)
.extern C(r_p1)
.extern C(r_p2)
.extern C(a_tstepxfrac)
.extern C(r_sstepx)
.extern C(r_tstepx)
.extern C(a_ststepxwhole)
.extern C(zspantable)
.extern C(skintable)
.extern C(r_zistepx)
.extern C(erroradjustdown)
.extern C(d_countextrastep)
.extern C(ubasestep)
.extern C(a_ststepxwhole)
.extern C(a_tstepxfrac)
.extern C(r_lstepx)
.extern C(a_spans)
.extern C(erroradjustdown)
.extern C(d_pdestextrastep)
.extern C(d_pzextrastep)
.extern C(d_sfracextrastep)
.extern C(d_ptexextrastep)
.extern C(d_countextrastep)
.extern C(d_tfracextrastep)
.extern C(d_lightextrastep)
.extern C(d_ziextrastep)
.extern C(d_pdestbasestep)
.extern C(d_pzbasestep)
.extern C(d_sfracbasestep)
.extern C(d_ptexbasestep)
.extern C(ubasestep)
.extern C(d_tfracbasestep)
.extern C(d_lightbasestep)
.extern C(d_zibasestep)
.extern C(zspantable)
.extern C(r_lstepy)
.extern C(r_sstepy)
.extern C(r_tstepy)
.extern C(r_zistepy)
.extern C(D_PolysetSetEdgeTable)
.extern C(D_RasterizeAliasPolySmooth)
.extern float_point5
.extern Float2ToThe31nd
.extern izistep
.extern izi
.extern FloatMinus2ToThe31nd
.extern float_1
.extern float_particle_z_clip
.extern float_minus_1
.extern float_0
.extern fp_16
.extern fp_64k
.extern fp_1m
.extern fp_1m_minus_1
.extern fp_8
.extern entryvec_table
.extern advancetable
.extern sstep
.extern tstep
.extern pspantemp
.extern counttemp
.extern jumptemp
.extern reciprocal_table
.extern DP_Count
.extern DP_u
.extern DP_v
.extern DP_32768
.extern DP_Color
.extern DP_Pix
.extern DP_EntryTable
.extern pbase
.extern s
.extern t
.extern sfracf
.extern tfracf
.extern snext
.extern tnext
.extern spancountminus1
.extern zi16stepu
.extern sdivz16stepu
.extern tdivz16stepu
.extern zi8stepu
.extern sdivz8stepu
.extern tdivz8stepu
.extern reciprocal_table_16
.extern entryvec_table_16
.extern ceil_cw
.extern single_cw
.extern fp_64kx64k
.extern pz
.extern spr8entryvec_table
.extern C(host_colormap_buffer) // leilei
.extern C(r_lightwidther) // leilei
.extern C(host_fogmap) // leilei
.extern C(palmap2)
.extern C(d_8to24table)
.extern C(r_lightptr_r)
.extern C(r_lightptr_g)
.extern C(r_lightptr_b)
#ifdef colhack
.extern C(host_colormap_red) // leilei
.extern C(host_colormap_green) // leilei
.extern C(host_colormap_blue) // leilei
.extern C(surfrowbytesred) // leilei
.extern C(surfrowbytesgreen) // leilei
.extern C(surfrowbytesblue) // leilei
.extern C(prowdestbasered)
.extern C(prowdestbasegreen)
.extern C(prowdestbaseblue)
.extern C(pbasesourcered)
.extern C(pbasesourcegreen)
.extern C(pbasesourceblue)
#endif
#endif
.extern C(snd_scaletable)
.extern C(paintbuffer)
.extern C(snd_linear_count)
.extern C(snd_p)
.extern C(snd_vol)
.extern C(snd_out)
.extern C(vright)
.extern C(vup)
.extern C(vpn)
.extern C(BOPS_Error)
#endif

View file

@ -1,152 +0,0 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//
// asm_draw.h
//
// Include file for asm drawing routines.
//
//
// !!! note that this file must match the corresponding C structures at all
// times !!!
//
// !!! if this is changed, it must be changed in r_local.h too !!!
#define NEAR_CLIP 0.01
// !!! if this is changed, it must be changed in r_local.h too !!!
#define CYCLE 128
// espan_t structure
// !!! if this is changed, it must be changed in r_shared.h too !!!
#define espan_t_u 0
#define espan_t_v 4
#define espan_t_count 8
#define espan_t_pnext 12
#define espan_t_size 16
// sspan_t structure
// !!! if this is changed, it must be changed in d_local.h too !!!
#define sspan_t_u 0
#define sspan_t_v 4
#define sspan_t_count 8
#define sspan_t_size 12
// spanpackage_t structure
// !!! if this is changed, it must be changed in d_polyset.c too !!!
#define spanpackage_t_pdest 0
#define spanpackage_t_pz 4
#define spanpackage_t_count 8
#define spanpackage_t_ptex 12
#define spanpackage_t_sfrac 16
#define spanpackage_t_tfrac 20
#define spanpackage_t_light 24
#define spanpackage_t_zi 28
#define spanpackage_t_size 32
// edge_t structure
// !!! if this is changed, it must be changed in r_shared.h too !!!
#define et_u 0
#define et_u_step 4
#define et_prev 8
#define et_next 12
#define et_surfs 16
#define et_nextremove 20
#define et_nearzi 24
#define et_owner 28
#define et_size 32
// surf_t structure
// !!! if this is changed, it must be changed in r_shared.h too !!!
#define SURF_T_SHIFT 6
#define st_next 0
#define st_prev 4
#define st_spans 8
#define st_key 12
#define st_last_u 16
#define st_spanstate 20
#define st_flags 24
#define st_data 28
#define st_entity 32
#define st_nearzi 36
#define st_insubmodel 40
#define st_d_ziorigin 44
#define st_d_zistepu 48
#define st_d_zistepv 52
#define st_pad 56
#define st_size 64
// clipplane_t structure
// !!! if this is changed, it must be changed in r_local.h too !!!
#define cp_normal 0
#define cp_dist 12
#define cp_next 16
#define cp_leftedge 20
#define cp_rightedge 21
#define cp_reserved 22
#define cp_size 24
// medge_t structure
// !!! if this is changed, it must be changed in model.h too !!!
#define me_v 0
#define me_cachededgeoffset 4
#define me_size 8
// mvertex_t structure
// !!! if this is changed, it must be changed in model.h too !!!
#define mv_position 0
#define mv_size 12
// refdef_t structure
// !!! if this is changed, it must be changed in render.h too !!!
#define rd_vrect 0
#define rd_aliasvrect 20
#define rd_vrectright 40
#define rd_vrectbottom 44
#define rd_aliasvrectright 48
#define rd_aliasvrectbottom 52
#define rd_vrectrightedge 56
#define rd_fvrectx 60
#define rd_fvrecty 64
#define rd_fvrectx_adj 68
#define rd_fvrecty_adj 72
#define rd_vrect_x_adj_shift20 76
#define rd_vrectright_adj_shift20 80
#define rd_fvrectright_adj 84
#define rd_fvrectbottom_adj 88
#define rd_fvrectright 92
#define rd_fvrectbottom 96
#define rd_horizontalFieldOfView 100
#define rd_xOrigin 104
#define rd_yOrigin 108
#define rd_vieworg 112
#define rd_viewangles 124
#define rd_ambientlight 136
#define rd_size 140
.extern C(r_framelerp)
.extern C(r_oldapverts)
// mtriangle_t structure
// !!! if this is changed, it must be changed in model.h too !!!
#define mtri_facesfront 0
#define mtri_vertindex 4
#define mtri_size 16 // !!! if this changes, array indexing in !!!
// !!! d_polysa.s must be changed to match !!!
#define mtri_shift 4

View file

@ -1,99 +0,0 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __ASM_I386__
#define __ASM_I386__
#ifdef ELF
#define C(label) label
#else
#define C(label) _##label
#endif
//
// !!! note that this file must match the corresponding C structures at all
// times !!!
//
// plane_t structure
// !!! if this is changed, it must be changed in model.h too !!!
// !!! if the size of this is changed, the array lookup in SV_HullPointContents
// must be changed too !!!
#define pl_normal 0
#define pl_dist 12
#define pl_type 16
#define pl_signbits 17
#define pl_pad 18
#define pl_size 20
// hull_t structure
// !!! if this is changed, it must be changed in model.h too !!!
#define hu_clipnodes 0
#define hu_planes 4
#define hu_firstclipnode 8
#define hu_lastclipnode 12
#define hu_clip_mins 16
#define hu_clip_maxs 28
#define hu_size 40
// dnode_t structure
// !!! if this is changed, it must be changed in bspfile.h too !!!
#define nd_planenum 0
#define nd_children 4
#define nd_mins 8
#define nd_maxs 20
#define nd_firstface 32
#define nd_numfaces 36
#define nd_size 40
// sfxcache_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define sfxc_length 0
#define sfxc_loopstart 4
#define sfxc_speed 8
#define sfxc_width 12
#define sfxc_stereo 16
#define sfxc_data 20
#define sfxc_flags 24
// channel_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define ch_sfx 0
#define ch_leftvol 4
#define ch_rightvol 8
#define ch_end 12
#define ch_pos 16
#define ch_looping 20
#define ch_entnum 24
#define ch_entchannel 28
#define ch_origin 32
#define ch_dist_mult 44
#define ch_master_vol 48
#define ch_size 52
#define ch_step 56
// portable_samplepair_t structure
// !!! if this is changed, it much be changed in sound.h too !!!
#define psp_left 0
#define psp_right 4
#define psp_size 8
#endif

View file

@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mathlib.h" // I make djgpp upset for some reason
#endif
#include "matrixlib.h"
#include "version.h"
#define ITSFIX
@ -238,7 +237,6 @@ int dpprotocol;
#include "sys.h"
#include "zone.h"
#include "mathlib.h"
#include "matrixlib.h"
typedef struct
{

View file

@ -1,176 +0,0 @@
/*
from Darkplaces
*/
#ifndef MATRIXLIB_H
#define MATRIXLIB_H
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
//#define MATRIX4x4_OPENGLORIENTATION
typedef struct matrix4x4_s
{
float m[4][4];
}
matrix4x4_t;
extern const matrix4x4_t identitymatrix;
// functions for manipulating 4x4 matrices
// copy a matrix4x4
void Matrix4x4_Copy (matrix4x4_t *out, const matrix4x4_t *in);
// copy only the rotation portion of a matrix4x4
void Matrix4x4_CopyRotateOnly (matrix4x4_t *out, const matrix4x4_t *in);
// copy only the translate portion of a matrix4x4
void Matrix4x4_CopyTranslateOnly (matrix4x4_t *out, const matrix4x4_t *in);
// multiply two matrix4x4 together, combining their transformations
// (warning: order matters - Concat(a, b, c) != Concat(a, c, b))
void Matrix4x4_Concat (matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2);
// swaps the rows and columns of the matrix
// (is this useful for anything?)
void Matrix4x4_Transpose (matrix4x4_t *out, const matrix4x4_t *in1);
// creates a matrix that does the opposite of the matrix provided
// this is a full matrix inverter, it should be able to invert any matrix that
// is possible to invert
// (non-uniform scaling, rotation, shearing, and translation, possibly others)
// warning: this function is SLOW
int Matrix4x4_Invert_Full (matrix4x4_t *out, const matrix4x4_t *in1);
// creates a matrix that does the opposite of the matrix provided
// only supports translate, rotate, scale (not scale3) matrices
void Matrix4x4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1);
// blends between two matrices, used primarily for animation interpolation
// (note: it is recommended to follow this with Matrix4x4_Normalize, a method
// known as nlerp rotation, often better for animation purposes than slerp)
void Matrix4x4_Interpolate (matrix4x4_t *out, matrix4x4_t *in1, matrix4x4_t *in2, double frac);
// zeros all matrix components, used with Matrix4x4_Accumulate
void Matrix4x4_Clear (matrix4x4_t *out);
// adds a weighted contribution from the supplied matrix, used to blend 3 or
// more matrices with weighting, it is recommended that Matrix4x4_Normalize be
// called afterward (a method known as nlerp rotation, often better for
// animation purposes than slerp)
void Matrix4x4_Accumulate (matrix4x4_t *out, matrix4x4_t *in, double weight);
// creates a matrix that does the same rotation and translation as the matrix
// provided, but no uniform scaling, does not support scale3 matrices
void Matrix4x4_Normalize (matrix4x4_t *out, matrix4x4_t *in1);
// creates a matrix with vectors normalized individually (use after
// Matrix4x4_Accumulate)
void Matrix4x4_Normalize3 (matrix4x4_t *out, matrix4x4_t *in1);
// modifies a matrix to have all vectors and origin reflected across the plane
// to the opposite side (at least if axisscale is -2)
void Matrix4x4_Reflect (matrix4x4_t *out, double normalx, double normaly, double normalz, double dist, double axisscale);
// creates an identity matrix
// (a matrix which does nothing)
void Matrix4x4_CreateIdentity (matrix4x4_t *out);
// creates a translate matrix
// (moves vectors)
void Matrix4x4_CreateTranslate (matrix4x4_t *out, double x, double y, double z);
// creates a rotate matrix
// (rotates vectors)
void Matrix4x4_CreateRotate (matrix4x4_t *out, double angle, double x, double y, double z);
// creates a scaling matrix
// (expands or contracts vectors)
// (warning: do not apply this kind of matrix to direction vectors)
void Matrix4x4_CreateScale (matrix4x4_t *out, double x);
// creates a squishing matrix
// (expands or contracts vectors differently in different axis)
// (warning: this is not reversed by Invert_Simple)
// (warning: do not apply this kind of matrix to direction vectors)
void Matrix4x4_CreateScale3 (matrix4x4_t *out, double x, double y, double z);
// creates a matrix for a quake entity
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale);
// converts a matrix4x4 to a set of 3D vectors for the 3 axial directions, and the translate
void Matrix4x4_ToVectors(const matrix4x4_t *in, float vx[3], float vy[3], float vz[3], float t[3]);
// creates a matrix4x4 from a set of 3D vectors for axial directions, and translate
void Matrix4x4_FromVectors(matrix4x4_t *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
// converts a matrix4x4 to a double[16] array in the OpenGL orientation
void Matrix4x4_ToArrayDoubleGL(const matrix4x4_t *in, double out[16]);
// creates a matrix4x4 from a double[16] array in the OpenGL orientation
void Matrix4x4_FromArrayDoubleGL(matrix4x4_t *out, const double in[16]);
// converts a matrix4x4 to a double[16] array in the Direct3D orientation
void Matrix4x4_ToArrayDoubleD3D(const matrix4x4_t *in, double out[16]);
// creates a matrix4x4 from a double[16] array in the Direct3D orientation
void Matrix4x4_FromArrayDoubleD3D(matrix4x4_t *out, const double in[16]);
// converts a matrix4x4 to a float[16] array in the OpenGL orientation
void Matrix4x4_ToArrayFloatGL(const matrix4x4_t *in, float out[16]);
// creates a matrix4x4 from a float[16] array in the OpenGL orientation
void Matrix4x4_FromArrayFloatGL(matrix4x4_t *out, const float in[16]);
// converts a matrix4x4 to a float[16] array in the Direct3D orientation
void Matrix4x4_ToArrayFloatD3D(const matrix4x4_t *in, float out[16]);
// creates a matrix4x4 from a float[16] array in the Direct3D orientation
void Matrix4x4_FromArrayFloatD3D(matrix4x4_t *out, const float in[16]);
// converts a matrix4x4 to a float[12] array in the OpenGL orientation
void Matrix4x4_ToArray12FloatGL(const matrix4x4_t *in, float out[12]);
// creates a matrix4x4 from a float[12] array in the OpenGL orientation
void Matrix4x4_FromArray12FloatGL(matrix4x4_t *out, const float in[12]);
// converts a matrix4x4 to a float[12] array in the Direct3D orientation
void Matrix4x4_ToArray12FloatD3D(const matrix4x4_t *in, float out[12]);
// creates a matrix4x4 from a float[12] array in the Direct3D orientation
void Matrix4x4_FromArray12FloatD3D(matrix4x4_t *out, const float in[12]);
// creates a matrix4x4 from an origin and quaternion (used mostly with skeletal model formats such as PSK)
void Matrix4x4_FromOriginQuat(matrix4x4_t *m, double ox, double oy, double oz, double x, double y, double z, double w);
// creates an origin and quaternion from a matrix4x4_t, quat[3] is always positive
void Matrix4x4_ToOrigin3Quat4Float(const matrix4x4_t *m, float *origin, float *quat);
// creates a matrix4x4 from an origin and canonical unit-length quaternion (used mostly with skeletal model formats such as MD5)
void Matrix4x4_FromDoom3Joint(matrix4x4_t *m, double ox, double oy, double oz, double x, double y, double z);
// creates a matrix4x4_t from an origin and canonical unit-length quaternion in short[6] normalized format
void Matrix4x4_FromBonePose6s(matrix4x4_t *m, float originscale, const short *pose6s);
// creates a short[6] representation from normalized matrix4x4_t
void Matrix4x4_ToBonePose6s(const matrix4x4_t *m, float origininvscale, short *pose6s);
// blends two matrices together, at a given percentage (blend controls percentage of in2)
void Matrix4x4_Blend (matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2, double blend);
// transforms a 3D vector through a matrix4x4
void Matrix4x4_Transform (const matrix4x4_t *in, const float v[3], float out[3]);
// transforms a 4D vector through a matrix4x4
// (warning: if you don't know why you would need this, you don't need it)
// (warning: the 4th component of the vector should be 1.0)
void Matrix4x4_Transform4 (const matrix4x4_t *in, const float v[4], float out[4]);
// reverse transforms a 3D vector through a matrix4x4, at least for *simple*
// cases (rotation and translation *ONLY*), this attempts to undo the results
// of Transform
//void Matrix4x4_SimpleUntransform (const matrix4x4_t *in, const float v[3], float out[3]);
// transforms a direction vector through the rotation part of a matrix
void Matrix4x4_Transform3x3 (const matrix4x4_t *in, const float v[3], float out[3]);
// transforms a positive distance plane (A*x+B*y+C*z-D=0) through a rotation or translation matrix
void Matrix4x4_TransformPositivePlane (const matrix4x4_t *in, float x, float y, float z, float d, float *o);
// transforms a standard plane (A*x+B*y+C*z+D=0) through a rotation or translation matrix
void Matrix4x4_TransformStandardPlane (const matrix4x4_t *in, float x, float y, float z, float d, float *o);
// ease of use functions
// immediately applies a Translate to the matrix
void Matrix4x4_ConcatTranslate (matrix4x4_t *out, double x, double y, double z);
// immediately applies a Rotate to the matrix
void Matrix4x4_ConcatRotate (matrix4x4_t *out, double angle, double x, double y, double z);
// immediately applies a Scale to the matrix
void Matrix4x4_ConcatScale (matrix4x4_t *out, double x);
// immediately applies a Scale3 to the matrix
void Matrix4x4_ConcatScale3 (matrix4x4_t *out, double x, double y, double z);
// extracts origin vector (translate) from matrix
void Matrix4x4_OriginFromMatrix (const matrix4x4_t *in, float *out);
// extracts scaling factor from matrix (only works for uniform scaling)
double Matrix4x4_ScaleFromMatrix (const matrix4x4_t *in);
// replaces origin vector (translate) in matrix
void Matrix4x4_SetOrigin (matrix4x4_t *out, double x, double y, double z);
// moves origin vector (translate) in matrix by a simple translate
void Matrix4x4_AdjustOrigin (matrix4x4_t *out, double x, double y, double z);
// scales vectors of a matrix in place and allows you to scale origin as well
void Matrix4x4_Scale (matrix4x4_t *out, double rotatescale, double originscale);
// ensures each element of the 3x3 rotation matrix is facing in the + direction
void Matrix4x4_Abs (matrix4x4_t *out);
#endif

View file

@ -38,9 +38,6 @@ typedef struct efrag_s
// hi, makaqu
byte r_foundwater, r_drawwater; // mk transwater
#include "matrixlib.h"
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{

View file

@ -121,23 +121,36 @@ void D_SetupFrame (void)
int i;
if (r_docrap == 1)
{
d_viewbuffer = r_lowbuffer;
else if (r_docrap > 1)
d_viewbuffer = r_warpbuffer;
else if (r_dowarp)
d_viewbuffer = r_warpbuffer;
else
d_viewbuffer = (void *)(byte *)vid.buffer;
if (r_docrap == 1)
screenwidth = LOW_WIDTH;
}
else if (r_docrap > 1)
{
d_viewbuffer = r_warpbuffer;
screenwidth = WARP_WIDTH;
else if (r_dowarp)
screenwidth = WARP_WIDTH;
}
/* else if (r_dowarp)
{
if (r_docrap == 1)
{
d_viewbuffer = r_lowbuffer;
screenwidth = LOW_WIDTH;
}
else
{
d_viewbuffer = r_warpbuffer;
screenwidth = WARP_WIDTH;
}
}*/
else
{
d_viewbuffer = (void *)(byte *)vid.buffer;
screenwidth = vid.rowbytes;
}
d_roverwrapped = false;
d_initial_rover = sc_rover;

View file

@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "globaldef.h"
#include "d_local.h"
#if !id386
/*
==============
D_DrawParticle
@ -183,7 +181,6 @@ void D_DrawParticle (particle_t *pparticle)
}
}
#endif // !id386
extern cvar_t *temp2;
// leilei - stupid experimental hack to draw our flare as a particle to check for visibility.

View file

@ -278,8 +278,6 @@ void D_LowResScreen (void)
}
}
}
#if !id386
/*
=============
D_DrawTurbulent8Span
@ -299,8 +297,6 @@ void D_DrawTurbulent8Span (void)
} while (--r_turb_spancount > 0);
}
#endif // !id386
int ferg;
void D_DrawTurbulent8Span_Fog (void)
{
@ -685,9 +681,6 @@ void Turbulent8 (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL);
}
#if !id386
/*
=============
D_DrawSpans8
@ -828,8 +821,6 @@ void D_DrawSpans8 (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL);
}
#endif
/*
=============
D_DrawSpans
@ -2510,10 +2501,6 @@ void D_DrawSpans8_C_Bilinear (espan_t *pspan)
}
#if !id386
/*
=============
D_DrawZSpans
@ -2575,6 +2562,3 @@ void D_DrawZSpans (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL);
}
#endif

View file

@ -1237,13 +1237,6 @@ void D_SpriteCalculateGradients (void)
if (scaalx > 665)
scel = scaalx -= 665; // leilei - flare hack
// if (reflectpass)
// scely *= 4; // leilei - try to make the water flares long
// Manoel Kasimier - QC Scale - begin
p_saxis[0] /= scel;
p_saxis[1] /= scel;
p_saxis[2] /= scel;
@ -1333,9 +1326,6 @@ void D_DrawSprite (int isthisaparticle)
isfading = 1;
else
isfading = 0;
}

View file

@ -18,9 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_vars.c: global refresh variables
#if !id386
#include "globaldef.h"
// all global and static refresh variables are collected in a contiguous block
@ -47,12 +44,6 @@ short *d_pzbuffer;
unsigned int d_zrowbytes;
unsigned int d_zwidth;
#endif // !id386
// leilei
#ifdef WATERREFLECTIONS
pixel_t *d_reflectbuffer;
#endif
#ifdef EXPREND
pixel_t *d_shadowbuffer;
#endif
#endif

View file

@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "globaldef.h"
#include "r_local.h"
#include "matrixlib.h"
//define PASSAGES
oldrefdef_t r_oldrefdef;
@ -549,11 +548,10 @@ void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
float res_scale;
r_viewchanged = true;
#ifndef linux
lineadj *= (vid.conheight / vid.vconheight); // leilei - PLEASE FIX ME HERE!
#else
R_SetVrect (pvrect, &r_refdef.vrect, lineadj);
#endif
//#ifndef linux
lineadj *= (vid.conheight / vid.vconheight);
// R_SetVrect (pvrect, &r_refdef.vrect, lineadj);
//#endif
r_refdef.horizontalFieldOfView = 2.0 * tan (r_refdef.fov_x/360*M_PI);
@ -667,33 +665,6 @@ void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
else
r_fov_greater_than_90 = true;
// TODO: collect 386-specific code in one place
#if id386
if (lowworld){
Sys_MakeCodeWriteable ((long)R_Surf8FastStart, (long)R_Surf8FastEnd - (long)R_Surf8FastStart);
R_Surf8FastPatch ();
colormap = vid.colormap;
}
#if id386rgb
else if (coloredlights)
{
Sys_MakeCodeWriteable ((long)R_Surf8RGBASMStart, (long)R_Surf8RGBASMEnd - (long)R_Surf8RGBASMStart);
R_Surf8PatchRGB ();
colormap = vid.colormap;
}
#endif
else
{
Sys_MakeCodeWriteable ((long)R_Surf8Start, (long)R_Surf8End - (long)R_Surf8Start);
R_Surf8Patch ();
colormap = vid.colormap;
}
#endif // id386
D_ViewChanged ();
}
@ -1714,8 +1685,6 @@ void R_RenderView_ (void)
r_warpbuffer = warpbuffer;
r_lowbuffer = lowbuffer;
if (r_timegraph->value || r_speeds->value || r_dspeeds->value)
@ -1823,7 +1792,7 @@ void R_RenderView_ (void)
// now, render out lens flares afterward (sort hack)
// Screen Resolution Reduction
if (r_dowarp)
if (r_dowarp && r_docrap != 0) //FIXME: Make it work on highres again
D_WarpScreen ();
else
{
@ -1842,8 +1811,6 @@ void R_RenderView_ (void)
if (r_alphashift->value)
D_AlphaShift ();
if (r_timegraph->value)
R_TimeGraph ();
@ -1862,7 +1829,7 @@ void R_RenderView_ (void)
if (r_reportedgeout->value && r_outofedges)
Con_Printf ("Short roughly %d edges\n", r_outofedges * 2 / 3);
// back to high floating-point precision
// back to high floating-point precision
Sys_HighFPPrecision ();
}
extern int lightingavailable;

View file

@ -552,52 +552,8 @@ void R_SetupFrame (void)
vid.aspect * (h / w) * ((float)vid.width / (float)vid.height));
}
}
else
if (r_dowarp)
{
if ((vid.width <= vid.maxwarpwidth) &&
(vid.height <= vid.maxwarpheight))
{
vrect.x = 0;
vrect.y = 0;
vrect.width = vid.width / dtail;
vrect.height = vid.height;
R_ViewChanged (&vrect, 0, vid.aspect);
}
else
{
w = vid.width / dtail;
h = vid.height;
if (w > vid.maxwarpwidth)
{
h *= (float)vid.maxwarpwidth / w;
w = vid.maxwarpwidth;
}
if (h > vid.maxwarpheight)
{
h = vid.maxwarpheight;
w *= (float)vid.maxwarpheight / h;
}
vrect.x = 0;
vrect.y = 0;
vrect.width = (int)w / dtail;
vrect.height = (int)h;
R_ViewChanged (&vrect,
(h/(float)vid.height),
vid.aspect * (h / w) * ((float)vid.width / (float)vid.height));
}
}
else
{
vrect.x = 0;
vrect.y = 0;
vrect.width = vid.width;

View file

@ -21,13 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "globaldef.h"
#include "r_local.h"
//#define MAX_PARTICLES 8192 // default max # of particles at one
// time
#define MAX_PARTICLES 16384 // default max # of particles at one
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
#define MAX_PARTICLES 16384 // default max # of particles at one
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
// on the command line
#define ZEROPROPERTIES (p->scale = 1; p->scaley = p->scale; p->blend = 0; p->alpha = 1; p->frame = 0; p->alphavel = 0;p->scalexvel = 0;p->scaleyvel = 0;p->anglevel[0] = 0;p->anglevel[1] = 0;p->anglevel[2] = 0;);
@ -1249,13 +1244,6 @@ void R_RunWarticleEffect (vec3_t org, vec3_t dir, int color, int count)
}
// --------------------
// Used by TE_TEI_SMOKE
// --------------------
@ -1853,7 +1841,7 @@ void R_Rain (vec3_t min, vec3_t max, int drops)
p = free_particles;
free_particles = p->next;
p->next = active_particles;
// p->owner = NULL;
active_particles = p;
p->frame = 0;
VectorSubtract(max, min, difference);
@ -1862,10 +1850,12 @@ void R_Rain (vec3_t min, vec3_t max, int drops)
p->alpha = 0.4f;
p->polor = 8;
if (particleset == 2)
p->trail = 0;
else
p->trail = 6;
p->trail = 0;
else
p->trail = 6;
p->type = pt_drip;
p->scale = 0.01f;
p->scaley = 2;
@ -1883,7 +1873,6 @@ void R_Rain (vec3_t min, vec3_t max, int drops)
p->vel[1] = 0;
p->vel[2] = -400 - (rand() & 600);
}
}
@ -1892,19 +1881,20 @@ void R_Snow (vec3_t min, vec3_t max, int drops)
int i;
vec3_t difference;
particle_t *p;
for (i=0 ; i<drops ; i++)
{
if (!free_particles)
break;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
// p->owner = NULL;
active_particles = p;
p->frame = 0;
VectorSubtract(max, min, difference);
p->die = cl.time + 10;
p->alpha = 0.4f;
p->polor = 14;
@ -1913,15 +1903,15 @@ void R_Snow (vec3_t min, vec3_t max, int drops)
p->blend = 1;
p->type = pt_snow;
if (particleset == 2){
p->scale = 0.05f;
p->scaley = 0.05f;
p->scalexvel = 0;
p->scaleyvel = 0;
p->frame = 3;
p->blend = 1;
}
if (particleset == 2)
{
p->scale = 0.05f;
p->scaley = 0.05f;
p->scalexvel = 0;
p->scaleyvel = 0;
p->frame = 3;
p->blend = 1;
}
p->org[0] = difference[0] * (rand () & 2047) * 0.00048828125 + min[0]; // Tomaz - Speed
p->org[1] = difference[1] * (rand () & 2047) * 0.00048828125 + min[1]; // Tomaz - Speed
@ -1931,7 +1921,6 @@ void R_Snow (vec3_t min, vec3_t max, int drops)
p->vel[1] = 0;
p->vel[2] = -40;
}
}
/*

View file

@ -466,29 +466,6 @@ void R_DrawSprite (void)
R_SetupAndDrawSprite ();
}
extern float lensreflection;
void R_SetupAndDrawSprite2 (int pass)
{
@ -1062,18 +1039,6 @@ void R_DrawSprite2 ()
R_SetupAndDrawSprite2 (pass);
}
mspriteframe_t *R_GetSpriteframe3 (msprite_t *psprite)
{
mspritegroup_t *pspritegroup;
@ -1131,122 +1096,32 @@ void R_DrawSprite3 (void)
psprite = currentflare->model->cache.data;
r_spritedesc.pspriteframe = R_GetSpriteframe3 (psprite);
// LEIDTIED
sprite_width = r_spritedesc.pspriteframe->width;
sprite_height = r_spritedesc.pspriteframe->height;
lensreflection = currentflare->lensreflection;
lensreflection = 1;
// sprite_width *= lensreflection;
// sprite_height *= lensreflection;
{
// generate the sprite's axes, completely parallel to the viewplane. There
// are no problem situations, because the sprite is always in the same
// position relative to the viewer
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vup[i] = vup[i];
r_spritedesc.vright[i] = vright[i];
r_spritedesc.vpn[i] = vpn[i];
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vup[i] = vup[i];
r_spritedesc.vright[i] = vright[i];
r_spritedesc.vpn[i] = vpn[i];
}
}
/* else if (currentflare->sprtype == SPR_VP_PARALLEL_UPRIGHT)
{
// generate the sprite's axes, with vup straight up in worldspace, and
// r_spritedesc.vright parallel to the viewplane.
// This will not work if the view direction is very close to straight up or
// down, because the cross product will be between two nearly parallel
// vectors and starts to approach an undefined state, so we don't draw if
// the two vectors are less than 1 degree apart
dot = vpn[2]; // same as DotProduct (vpn, r_spritedesc.vup) because
// r_spritedesc.vup is 0, 0, 1
if ((dot > 0.999848) || (dot < -0.999848)) // cos(1 degree) = 0.999848
return;
r_spritedesc.vup[0] = 0;
r_spritedesc.vup[1] = 0;
r_spritedesc.vup[2] = 1;
r_spritedesc.vright[0] = vpn[1];
// CrossProduct (r_spritedesc.vup, vpn,
r_spritedesc.vright[1] = -vpn[0]; // r_spritedesc.vright)
r_spritedesc.vright[2] = 0;
VectorNormalize (r_spritedesc.vright);
r_spritedesc.vpn[0] = -r_spritedesc.vright[1];
r_spritedesc.vpn[1] = r_spritedesc.vright[0];
r_spritedesc.vpn[2] = 0;
// CrossProduct (r_spritedesc.vright, r_spritedesc.vup,
//r_spritedesc.vpn);
}
else if (currentflare->sprtype == SPR_ORIENTED)
{
// generate the sprite's axes, according to the sprite's world orientation
AngleVectors (currentflare->angles, r_spritedesc.vpn,
r_spritedesc.vright, r_spritedesc.vup);
}
else if (currentflare->sprtype == SPR_VP_PARALLEL_ORIENTED)
{
// generate the sprite's axes, parallel to the viewplane, but rotated in
// that plane around the center according to the sprite particle's roll
// angle. So vpn stays the same, but vright and vup rotate
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vpn[i] = vpn[i];
r_spritedesc.vright[i] = vright[i] * cr + vup[i] * sr;
r_spritedesc.vup[i] = vright[i] * -sr + vup[i] * cr;
}
}
else if (currentflare->sprtype == 5)
{
// like above but try to occlude check some how
// angle. So vpn stays the same, but vright and vup rotate
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vpn[i] = vpn[i];
r_spritedesc.vright[i] = vright[i] * cr + vup[i] * sr;
r_spritedesc.vup[i] = vright[i] * -sr + vup[i] * cr;
}
}
else
{
// like above but try to occlude check some how
// angle. So vpn stays the same, but vright and vup rotate
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
angle = currentflare->angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vpn[i] = vpn[i];
r_spritedesc.vright[i] = vright[i] * cr + vup[i] * sr;
r_spritedesc.vup[i] = vright[i] * -sr + vup[i] * cr;
}
// Sys_Error ("R_DrawSprite: Bad sprite type %d", psprite->type);
}
*/
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vpn[i] = vpn[i];
for (i=0 ; i<3 ; i++)
r_spritedesc.vpn[i] = vpn[i];
}
if(currentflare->sprtype == 5 || currentflare->sprtype == SPR_VP_PARALLEL_UPRIGHT)flared = 1; else flared = 0;
if(currentflare->sprtype == 5 || currentflare->sprtype == SPR_VP_PARALLEL_UPRIGHT)
flared = 1;
else
flared = 0;
R_RotateSprite3 (psprite->beamlength);
R_SetupAndDrawSprite3 ();
}

View file

@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "globaldef.h"
#if !id386
// all global and static refresh variables are collected in a contiguous block
// to avoid cache conflicts.
@ -35,5 +33,3 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int r_bmodelactive;
#endif // !id386