mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
Merge branch 'wip-rua_scene'
rua_scene is still in progress, but I felt it time to merge the work that has been done as it is an improvement on what was there.
This commit is contained in:
commit
849558903d
360 changed files with 8589 additions and 22883 deletions
|
@ -95,8 +95,8 @@ if test "x$HAVE_X" = xyes; then
|
|||
QF_NEED(iqm, [vulkan])
|
||||
QF_NEED(sprite, [vulkan])
|
||||
fi
|
||||
QF_NEED(vid_render, [sw sw32 gl glsl])
|
||||
QF_NEED(render, [sw sw32 gl glsl])
|
||||
QF_NEED(vid_render, [sw gl glsl])
|
||||
QF_NEED(render, [sw gl glsl])
|
||||
QF_NEED(models, [sw gl glsl])
|
||||
QF_NEED(alias, [sw gl glsl])
|
||||
QF_NEED(brush, [sw gl glsl])
|
||||
|
@ -120,8 +120,8 @@ if test "x$HAVE_SDL" = xyes; then
|
|||
NQ_DESKTOP_DATA="$NQ_DESKTOP_DATA desktop/quakeforge-nq-sdl.desktop"
|
||||
CL_TARGETS="$CL_TARGETS SDL"
|
||||
VID_TARGETS="$VID_TARGETS libs/video/targets/libQFsdl.la"
|
||||
QF_NEED(vid_render, [sw sw32 gl glsl])
|
||||
QF_NEED(render, [sw sw32 gl glsl])
|
||||
QF_NEED(vid_render, [sw gl glsl])
|
||||
QF_NEED(render, [sw gl glsl])
|
||||
QF_NEED(models, [sw gl glsl])
|
||||
QF_NEED(alias, [sw gl glsl])
|
||||
QF_NEED(brush, [sw gl glsl])
|
||||
|
@ -175,7 +175,7 @@ if test "x$mingw" = xyes; then
|
|||
QF_NEED(iqm, [vulkan])
|
||||
QF_NEED(sprite, [vulkan])
|
||||
fi
|
||||
QF_NEED(vid_render, [sw sw32 gl glsl])
|
||||
QF_NEED(vid_render, [sw gl glsl])
|
||||
QF_NEED(models, [sw gl glsl])
|
||||
QF_NEED(alias, [sw gl glsl])
|
||||
QF_NEED(brush, [sw gl glsl])
|
||||
|
@ -356,8 +356,8 @@ QF_SUBST(progs_gz)
|
|||
QF_PROCESS_NEED_LIST(top, [libs hw nq qtv qw tools ruamoko])
|
||||
|
||||
QF_PROCESS_NEED_LIBS(swrend, [asm])
|
||||
QF_PROCESS_NEED_LIBS(render, [gl glsl sw sw32 vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_LIST(vid_render, [gl glsl sw sw32 vulkan])
|
||||
QF_PROCESS_NEED_LIBS(render, [gl glsl sw vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_LIST(vid_render, [gl glsl sw vulkan])
|
||||
QF_PROCESS_NEED_LIBS(models, [gl glsl sw vulkan], [libs/models])
|
||||
QF_PROCESS_NEED_LIBS(alias, [gl glsl sw vulkan], [libs/models/alias])
|
||||
QF_PROCESS_NEED_LIBS(brush, [gl glsl sw vulkan], [libs/models/brush])
|
||||
|
@ -407,7 +407,7 @@ if test "x$static_plugins" = xauto; then
|
|||
fi
|
||||
fi
|
||||
if test "x$static_plugins" = xyes; then
|
||||
QF_PROCESS_NEED_STATIC_PLUGINS(vid_render, [sw sw32 glsl gl vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_STATIC_PLUGINS(vid_render, [sw glsl gl vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_STATIC_PLUGINS(console, [server], [libs/console], [server])
|
||||
QF_PROCESS_NEED_STATIC_PLUGINS(console, [client], [libs/console], [client])
|
||||
|
||||
|
@ -422,7 +422,7 @@ if test "x$static_plugins" = xyes; then
|
|||
CDTYPE="$CDTYPE (static)"
|
||||
fi
|
||||
else
|
||||
QF_PROCESS_NEED_PLUGINS(vid_render, [sw sw32 glsl gl vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_PLUGINS(vid_render, [sw glsl gl vulkan], [libs/video/renderer])
|
||||
QF_PROCESS_NEED_PLUGINS(console, [server], [libs/console], [server])
|
||||
QF_PROCESS_NEED_PLUGINS(console, [client], [libs/console], [client])
|
||||
QF_PROCESS_NEED_PLUGINS(snd_output, [sdl mme sgi sun win dx oss jack alsa], [libs/audio/targets])
|
||||
|
|
|
@ -76,6 +76,21 @@ else
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(Werror,
|
||||
AS_HELP_STRING([--disable-Werror], [do not treat warnings as errors]))
|
||||
dnl We want warnings, lots of warnings...
|
||||
dnl The help text should be INVERTED before release!
|
||||
dnl when in git, this test defaults to ENABLED.
|
||||
dnl In a release, this test defaults to DISABLED.
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test "x$enable_Werror" $cvs_def_enabled; then
|
||||
CFLAGS="$CFLAGS -Wall -Werror -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
|
||||
else
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fno-common"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(optimize,
|
||||
AS_HELP_STRING([--disable-optimize],
|
||||
[compile without optimizations (for development)]),
|
||||
|
@ -121,13 +136,14 @@ if test "x$optimize" = xyes -a "x$leave_cflags_alone" != "xyes"; then
|
|||
BUILD_TYPE="$BUILD_TYPE Optimize"
|
||||
if test "x$GCC" = xyes; then
|
||||
saved_cflags="$CFLAGS"
|
||||
CFLAGS=""
|
||||
dnl CFLAGS=""
|
||||
QF_CC_OPTION(-frename-registers)
|
||||
QF_CC_OPTION(-fexpensive-optimizations)
|
||||
dnl if test "$CC_MAJ" -ge 4; then
|
||||
dnl QF_CC_OPTION(-finline-limit=32000 -Winline)
|
||||
dnl fi
|
||||
dnl heavy="-O2 $CFLAGS -ffast-math -fno-unsafe-math-optimizations -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
|
||||
heavy="-O2 $CFLAGS -fno-fast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
|
||||
dnl heavy="-O2 $CFLAGS -ffast-math -fno-unsafe-math-optimizations -funroll-loops -fomit-frame-pointer"
|
||||
heavy="-O2 $CFLAGS -fno-fast-math -funroll-loops -fomit-frame-pointer "
|
||||
CFLAGS="$saved_cflags"
|
||||
light="-O2"
|
||||
AC_ARG_ENABLE(strict-aliasing,
|
||||
|
@ -280,21 +296,6 @@ if test "x$GCC" != xyes; then
|
|||
esac
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(Werror,
|
||||
AS_HELP_STRING([--disable-Werror], [do not treat warnings as errors]))
|
||||
dnl We want warnings, lots of warnings...
|
||||
dnl The help text should be INVERTED before release!
|
||||
dnl when in git, this test defaults to ENABLED.
|
||||
dnl In a release, this test defaults to DISABLED.
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test "x$enable_Werror" $cvs_def_enabled; then
|
||||
CFLAGS="$CFLAGS -Wall -Werror -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
|
||||
else
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fno-common"
|
||||
fi
|
||||
|
||||
AS="$CC"
|
||||
if test "x$SYSTYPE" = "xWIN32"; then
|
||||
ASFLAGS="\$(DEFS) \$(CFLAGS) \$(CPPFLAGS) \$(DEFAULT_INCLUDES) \$(INCLUDES) -D_WIN32"
|
||||
|
|
|
@ -19,7 +19,7 @@ AC_CHECK_FUNCS(
|
|||
|
||||
AC_FUNC_VA_COPY
|
||||
AC_FUNC__VA_COPY
|
||||
AH_VERBATIM([DEFINE_VA_COPY],
|
||||
AH_VERBATIM([HAVE__VA_COPY_],
|
||||
[#ifndef HAVE_VA_COPY
|
||||
# ifdef HAVE__VA_COPY
|
||||
# define va_copy(d,s) __va_copy ((d), (s))
|
||||
|
|
|
@ -64,12 +64,12 @@ EXTRA_DIST += \
|
|||
include/r_internal.h \
|
||||
include/r_local.h \
|
||||
include/r_scrap.h \
|
||||
include/r_screen.h \
|
||||
include/r_shared.h \
|
||||
include/regex.h \
|
||||
include/rua_internal.h \
|
||||
include/sbar.h \
|
||||
include/skin_stencil.h \
|
||||
include/scn_internal.h \
|
||||
include/snd_internal.h \
|
||||
include/sv_console.h \
|
||||
include/varrays.h \
|
||||
|
@ -81,14 +81,17 @@ EXTRA_DIST += \
|
|||
include/vregset.h \
|
||||
include/winquake.h \
|
||||
include/world.h \
|
||||
include/client/chase.h \
|
||||
include/client/effects.h \
|
||||
include/client/entities.h \
|
||||
include/client/hud.h \
|
||||
include/client/input.h \
|
||||
include/client/temp_entities.h \
|
||||
include/client/locs.h \
|
||||
include/client/particles.h \
|
||||
include/client/state.h \
|
||||
include/client/temp_entities.h \
|
||||
include/client/view.h \
|
||||
include/client/world.h \
|
||||
include/evdev/hotplug.h \
|
||||
include/evdev/inputlib.h \
|
||||
include/qw/bothdefs.h \
|
||||
|
|
|
@ -830,4 +830,43 @@
|
|||
# define GL_OPERAND1_ALPHA 0x8599
|
||||
# define GL_OPERAND2_ALPHA 0x859A
|
||||
|
||||
/* framebuffer */
|
||||
#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2 0x8CE2
|
||||
#define GL_COLOR_ATTACHMENT3 0x8CE3
|
||||
#define GL_COLOR_ATTACHMENT4 0x8CE4
|
||||
#define GL_COLOR_ATTACHMENT5 0x8CE5
|
||||
#define GL_COLOR_ATTACHMENT6 0x8CE6
|
||||
#define GL_COLOR_ATTACHMENT7 0x8CE7
|
||||
#define GL_COLOR_ATTACHMENT8 0x8CE8
|
||||
#define GL_COLOR_ATTACHMENT9 0x8CE9
|
||||
#define GL_COLOR_ATTACHMENT10 0x8CEA
|
||||
#define GL_COLOR_ATTACHMENT11 0x8CEB
|
||||
#define GL_COLOR_ATTACHMENT12 0x8CEC
|
||||
#define GL_COLOR_ATTACHMENT13 0x8CED
|
||||
#define GL_COLOR_ATTACHMENT14 0x8CEE
|
||||
#define GL_COLOR_ATTACHMENT15 0x8CEF
|
||||
#define GL_COLOR_ATTACHMENT16 0x8CF0
|
||||
#define GL_COLOR_ATTACHMENT17 0x8CF1
|
||||
#define GL_COLOR_ATTACHMENT18 0x8CF2
|
||||
#define GL_COLOR_ATTACHMENT19 0x8CF3
|
||||
#define GL_COLOR_ATTACHMENT20 0x8CF4
|
||||
#define GL_COLOR_ATTACHMENT21 0x8CF5
|
||||
#define GL_COLOR_ATTACHMENT22 0x8CF6
|
||||
#define GL_COLOR_ATTACHMENT23 0x8CF7
|
||||
#define GL_COLOR_ATTACHMENT24 0x8CF8
|
||||
#define GL_COLOR_ATTACHMENT25 0x8CF9
|
||||
#define GL_COLOR_ATTACHMENT26 0x8CFA
|
||||
#define GL_COLOR_ATTACHMENT27 0x8CFB
|
||||
#define GL_COLOR_ATTACHMENT28 0x8CFC
|
||||
#define GL_COLOR_ATTACHMENT29 0x8CFD
|
||||
#define GL_COLOR_ATTACHMENT30 0x8CFE
|
||||
#define GL_COLOR_ATTACHMENT31 0x8CFF
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
|
||||
|
||||
#endif // __gl_defines_h
|
||||
|
|
44
include/QF/GL/qf_alias.h
Normal file
44
include/QF/GL/qf_alias.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
qf_alias.h
|
||||
|
||||
GL specific alias model stuff
|
||||
|
||||
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2012/1/1
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GL_qf_alias_h
|
||||
#define __QF_GL_qf_alias_h
|
||||
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
typedef struct aliasvrt_s {
|
||||
GLshort st[2];
|
||||
GLshort normal[3];
|
||||
GLushort vertex[3];
|
||||
} aliasvrt_t;
|
||||
|
||||
struct entity_s;
|
||||
void gl_R_DrawAliasModel (struct entity_s *ent);
|
||||
|
||||
#endif//__QF_GL_qf_alias_h
|
|
@ -28,8 +28,35 @@
|
|||
#ifndef __gl_draw_h
|
||||
#define __gl_draw_h
|
||||
|
||||
struct qpic_s;
|
||||
|
||||
void gl_Draw_Init (void);
|
||||
void gl_Draw_Shutdown (void);
|
||||
void gl_Draw_Character (int x, int y, unsigned ch);
|
||||
void gl_Draw_String (int x, int y, const char *str);
|
||||
void gl_Draw_nString (int x, int y, const char *str, int count);
|
||||
void gl_Draw_AltString (int x, int y, const char *str);
|
||||
void gl_Draw_ConsoleBackground (int lines, byte alpha);
|
||||
void gl_Draw_Crosshair (void);
|
||||
void gl_Draw_CrosshairAt (int ch, int x, int y);
|
||||
void gl_Draw_TileClear (int x, int y, int w, int h);
|
||||
void gl_Draw_Fill (int x, int y, int w, int h, int c);
|
||||
void gl_Draw_TextBox (int x, int y, int width, int lines, byte alpha);
|
||||
void gl_Draw_FadeScreen (void);
|
||||
void gl_Draw_BlendScreen (quat_t color);
|
||||
struct qpic_s *gl_Draw_CachePic (const char *path, qboolean alpha);
|
||||
void gl_Draw_UncachePic (const char *path);
|
||||
struct qpic_s *gl_Draw_MakePic (int width, int height, const byte *data);
|
||||
void gl_Draw_DestroyPic (struct qpic_s *pic);
|
||||
struct qpic_s *gl_Draw_PicFromWad (const char *name);
|
||||
void gl_Draw_Pic (int x, int y, struct qpic_s *pic);
|
||||
void gl_Draw_Picf (float x, float y, struct qpic_s *pic);
|
||||
void gl_Draw_SubPic(int x, int y, struct qpic_s *pic,
|
||||
int srcx, int srcy, int width, int height);
|
||||
|
||||
void GL_Set2D (void);
|
||||
void GL_Set2DScaled (void);
|
||||
void GL_End2D (void);
|
||||
void GL_DrawReset (void);
|
||||
void GL_FlushText (void);
|
||||
|
||||
|
|
37
include/QF/GL/qf_fisheye.h
Normal file
37
include/QF/GL/qf_fisheye.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
qf_fisheye.h
|
||||
|
||||
GL screen fisheye
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2022/3/25
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GL_qf_fisheye_h
|
||||
#define __QF_GL_qf_fisheye_h
|
||||
|
||||
void gl_InitFisheye (void);
|
||||
struct framebuffer_s;
|
||||
void gl_FisheyeScreen (struct framebuffer_s *fb);
|
||||
|
||||
#endif//__QF_GL_qf_fisheye_h
|
|
@ -418,6 +418,19 @@ QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
|||
// ATI Extensions
|
||||
QFGL_WANT (void, glPNTrianglesiATI, (GLint x, GLint y))
|
||||
|
||||
// frame buffers
|
||||
QFGL_DONT_NEED (GLboolean, glIsFramebuffer, (GLuint framebuffer))
|
||||
QFGL_NEED (void, glBindFramebuffer, (GLenum target, GLuint framebuffer))
|
||||
QFGL_DONT_NEED (void, glDeleteFramebuffers, (GLsizei n, const GLuint *framebuffers))
|
||||
QFGL_NEED (void, glGenFramebuffers, (GLsizei n, GLuint *framebuffers))
|
||||
QFGL_DONT_NEED (GLenum, glCheckFramebufferStatus, (GLenum target))
|
||||
QFGL_DONT_NEED (void, glFramebufferTexture1D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level))
|
||||
QFGL_NEED (void, glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level))
|
||||
QFGL_DONT_NEED (void, glFramebufferTexture3D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))
|
||||
QFGL_DONT_NEED (void, glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer))
|
||||
QFGL_DONT_NEED (void, glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint *params))
|
||||
|
||||
|
||||
#ifdef UNDEF_QFGL_DONT_NEED
|
||||
#undef QFGL_DONT_NEED
|
||||
#endif
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef struct glsliqm_s {
|
|||
iqmvertexarray *color;
|
||||
} gliqm_t;
|
||||
|
||||
void gl_R_DrawIQMModel (entity_t *ent);
|
||||
struct entity_s;
|
||||
void gl_R_DrawIQMModel (struct entity_s *ent);
|
||||
|
||||
#endif//__QF_GL_qf_iqm_h
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#ifndef __QF_GL_lightmap_h
|
||||
#define __QF_GL_lightmap_h
|
||||
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
// LordHavoc: since lightmaps are now allocated only as needed, allow a ridiculous number :)
|
||||
#define MAX_LIGHTMAPS 1024
|
||||
#define BLOCK_WIDTH 64
|
||||
|
@ -40,16 +42,15 @@ typedef struct glRect_s {
|
|||
extern int lm_src_blend, lm_dest_blend;
|
||||
extern model_t *gl_currentmodel;
|
||||
|
||||
extern int gl_lightmap_textures;
|
||||
extern GLuint gl_lightmap_textures[MAX_LIGHTMAPS];
|
||||
extern qboolean gl_lightmap_modified[MAX_LIGHTMAPS];
|
||||
extern instsurf_t *gl_lightmap_polys[MAX_LIGHTMAPS];
|
||||
extern glRect_t gl_lightmap_rectchange[MAX_LIGHTMAPS];
|
||||
|
||||
void GL_BuildSurfaceDisplayList (msurface_t *fa);
|
||||
void gl_lightmap_init (void);
|
||||
void GL_BuildLightmaps (struct model_s **models, int num_models);
|
||||
void R_BlendLightmaps (void);
|
||||
void R_CalcLightmaps (void);
|
||||
void gl_R_BlendLightmaps (void);
|
||||
void gl_R_CalcLightmaps (void);
|
||||
struct transform_s;
|
||||
extern void (*gl_R_BuildLightMap) (const struct transform_s *transform,
|
||||
mod_brush_t *brush, msurface_t *surf);
|
||||
|
|
46
include/QF/GL/qf_particles.h
Normal file
46
include/QF/GL/qf_particles.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
qf_particles.h
|
||||
|
||||
GL specific particles stuff
|
||||
|
||||
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2012/1/15
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GL_qf_particles_h
|
||||
#define __QF_GL_qf_particles_h
|
||||
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
typedef struct {
|
||||
float texcoord[2];
|
||||
float vertex[3];
|
||||
byte color[4];
|
||||
} partvert_t;
|
||||
|
||||
struct psystem_s;
|
||||
void gl_R_DrawParticles (struct psystem_s *pssystem);
|
||||
void gl_R_Particles_Init_Cvars (void);
|
||||
void gl_R_InitParticles (void);
|
||||
|
||||
#endif//__QF_GL_qf_particles_h
|
|
@ -29,6 +29,7 @@
|
|||
#define __QF_GL_rlight_h
|
||||
|
||||
extern float gl_bubble_sintable[], gl_bubble_costable[];
|
||||
void R_RenderDlights (void);
|
||||
void gl_R_RenderDlights (void);
|
||||
void gl_R_InitBubble (void);
|
||||
|
||||
#endif // __QF_GL_rlight_h
|
||||
|
|
|
@ -29,18 +29,29 @@
|
|||
#define __QF_GL_rmain_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/cvar.h"
|
||||
|
||||
extern qboolean gl_envmap;
|
||||
struct cvar_s;
|
||||
struct entity_s;
|
||||
|
||||
extern int c_brush_polys, c_alias_polys;
|
||||
extern float r_world_matrix[16];
|
||||
|
||||
extern float gl_modelalpha;
|
||||
//extern vec3_t shadecolor;
|
||||
|
||||
extern void gl_multitexture_f (cvar_t *var);
|
||||
extern void gl_multitexture_f (struct cvar_s *var);
|
||||
|
||||
void glrmain_init (void);
|
||||
void R_RotateForEntity (struct entity_s *e);
|
||||
void gl_R_RotateForEntity (struct entity_s *e);
|
||||
|
||||
struct model_s;
|
||||
struct entqueue_s;
|
||||
void gl_R_NewMap (struct model_s *worldmodel, struct model_s **models,
|
||||
int num_models);
|
||||
void gl_R_RenderView (void);
|
||||
void gl_R_RenderEntities (struct entqueue_s *queue);
|
||||
void gl_R_ClearState (void);
|
||||
void gl_R_ViewChanged (void);
|
||||
void gl_R_LineGraph (int x, int y, int *h_vals, int count, int height);
|
||||
void gl_R_InitGraphTextures (void);
|
||||
|
||||
#endif // __QF_GL_rmain_h
|
||||
|
|
|
@ -36,18 +36,27 @@ typedef struct gltex_s {
|
|||
struct instsurf_s **tex_chain_tail;
|
||||
} gltex_t;
|
||||
|
||||
extern int gl_mirrortexturenum; // quake texturenum, not gltexturenum
|
||||
|
||||
struct model_s;
|
||||
struct entity_s;
|
||||
struct msurface_s;
|
||||
struct mod_brush_s;
|
||||
|
||||
void gl_lightmap_init (void);
|
||||
void GL_BuildLightmaps (struct model_s **models, int num_models);
|
||||
void GL_BuildSurfaceDisplayList (struct mod_brush_s *brush,
|
||||
struct msurface_s *fa);
|
||||
|
||||
void R_DrawBrushModel (struct entity_s *e);
|
||||
void R_DrawWorld (void);
|
||||
void gl_R_DrawBrushModel (struct entity_s *e);
|
||||
void gl_R_DrawWorld (void);
|
||||
void gl_R_DrawWaterSurfaces (void);
|
||||
|
||||
void GL_EmitWaterPolys (struct msurface_s *fa);
|
||||
void gl_R_LoadSkys (const char *sky);
|
||||
|
||||
struct texture_s;
|
||||
void gl_R_AddTexture (struct texture_s *tx);
|
||||
void gl_R_ClearTextures (void);
|
||||
void gl_R_InitSurfaceChains (struct mod_brush_s *brush);
|
||||
|
||||
struct framebuffer_s;
|
||||
void gl_WarpScreen (struct framebuffer_s *fb);
|
||||
|
||||
#endif // __QF_GL_rsurf_h
|
||||
|
|
|
@ -30,13 +30,20 @@
|
|||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
#define SKY_TEX 2000 // Quake 2 environment sky
|
||||
|
||||
extern qboolean gl_skyloaded;
|
||||
extern vec5_t gl_skyvec[6][4];
|
||||
extern GLuint gl_solidskytexture;
|
||||
extern GLuint gl_alphaskytexture;
|
||||
|
||||
void R_DrawSky (void);
|
||||
void R_DrawSkyChain (const instsurf_t *s);
|
||||
struct texture_s;
|
||||
|
||||
void gl_R_InitSky (struct texture_s *mt);
|
||||
void gl_R_DrawSky (void);
|
||||
void gl_R_DrawSkyChain (const instsurf_t *s);
|
||||
void gl_R_LoadSkys (const char *skyname);
|
||||
|
||||
#endif // __QF_GL_sky_h
|
||||
|
|
37
include/QF/GL/qf_sprite.h
Normal file
37
include/QF/GL/qf_sprite.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
qf_sprite.h
|
||||
|
||||
GL specific sprite model stuff
|
||||
|
||||
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2021/7/22
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GL_qf_sprite_h
|
||||
#define __QF_GL_qf_sprite_h
|
||||
|
||||
struct entity_s;
|
||||
void gl_R_InitSprites (void);
|
||||
extern void (*gl_R_DrawSpriteModel) (struct entity_s *ent);
|
||||
|
||||
#endif//__QF_GL_qf_sprite_h
|
|
@ -29,6 +29,7 @@
|
|||
#define __gl_textures_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
#define MAX_GLTEXTURES 2048
|
||||
|
||||
|
@ -39,7 +40,7 @@ extern int gl_filter_min;
|
|||
extern int gl_filter_max;
|
||||
extern qboolean gl_Anisotropy;
|
||||
extern float gl_aniso;
|
||||
extern int gl_part_tex;
|
||||
extern GLuint gl_part_tex;
|
||||
|
||||
void GL_Upload8 (const byte *data, int width, int height, qboolean mipmap, qboolean alpha);
|
||||
void GL_Upload8_EXT (const byte *data, int width, int height, qboolean mipmap, qboolean alpha);
|
||||
|
|
|
@ -44,7 +44,6 @@ extern qboolean gl_mtex_fullbright;
|
|||
extern GLenum gl_mtex_enum;
|
||||
extern qboolean gl_combine_capable;
|
||||
extern float gl_rgb_scale;
|
||||
extern int gl_texture_number;
|
||||
|
||||
extern qboolean gl_feature_mach64;
|
||||
extern float gldepthmin, gldepthmax;
|
||||
|
|
|
@ -68,8 +68,10 @@ struct model_s;
|
|||
void glsl_R_ClearElements (void);
|
||||
void glsl_R_DrawWorld (void);
|
||||
void glsl_R_DrawSky (void);
|
||||
void glsl_R_DrawWaterSurfaces (void);
|
||||
void glsl_R_RegisterTextures (struct model_s **models, int num_models);
|
||||
void glsl_R_BuildDisplayLists (struct model_s **models, int num_models);
|
||||
void glsl_R_InitBsp (void);
|
||||
void glsl_R_LoadSkys (const char *sky);
|
||||
|
||||
#endif//__QF_GLSL_qf_bsp_h
|
||||
|
|
|
@ -25,8 +25,34 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifndef __gl_draw_h
|
||||
#define __gl_draw_h
|
||||
#ifndef __QF_GLSL_qf_draw_h
|
||||
#define __QF_GLSL_qf_draw_h
|
||||
|
||||
struct qpic_s;
|
||||
|
||||
void glsl_Draw_Init (void);
|
||||
void glsl_Draw_Shutdown (void);
|
||||
void glsl_Draw_Character (int x, int y, unsigned ch);
|
||||
void glsl_Draw_String (int x, int y, const char *str);
|
||||
void glsl_Draw_nString (int x, int y, const char *str, int count);
|
||||
void glsl_Draw_AltString (int x, int y, const char *str);
|
||||
void glsl_Draw_ConsoleBackground (int lines, byte alpha);
|
||||
void glsl_Draw_Crosshair (void);
|
||||
void glsl_Draw_CrosshairAt (int ch, int x, int y);
|
||||
void glsl_Draw_TileClear (int x, int y, int w, int h);
|
||||
void glsl_Draw_Fill (int x, int y, int w, int h, int c);
|
||||
void glsl_Draw_TextBox (int x, int y, int width, int lines, byte alpha);
|
||||
void glsl_Draw_FadeScreen (void);
|
||||
void glsl_Draw_BlendScreen (quat_t color);
|
||||
struct qpic_s *glsl_Draw_CachePic (const char *path, qboolean alpha);
|
||||
void glsl_Draw_UncachePic (const char *path);
|
||||
struct qpic_s *glsl_Draw_MakePic (int width, int height, const byte *data);
|
||||
void glsl_Draw_DestroyPic (struct qpic_s *pic);
|
||||
struct qpic_s *glsl_Draw_PicFromWad (const char *name);
|
||||
void glsl_Draw_Pic (int x, int y, struct qpic_s *pic);
|
||||
void glsl_Draw_Picf (float x, float y, struct qpic_s *pic);
|
||||
void glsl_Draw_SubPic(int x, int y, struct qpic_s *pic,
|
||||
int srcx, int srcy, int width, int height);
|
||||
|
||||
void GLSL_Set2D (void);
|
||||
void GLSL_Set2DScaled (void);
|
||||
|
@ -34,4 +60,4 @@ void GLSL_End2D (void);
|
|||
void GLSL_DrawReset (void);
|
||||
void GLSL_FlushText (void);
|
||||
|
||||
#endif//__gl_draw_h
|
||||
#endif//__QF_GLSL_qf_draw_h
|
||||
|
|
37
include/QF/GLSL/qf_fisheye.h
Normal file
37
include/QF/GLSL/qf_fisheye.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
qf_fisheye.h
|
||||
|
||||
GLSL screen fisheye
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2022/3/25
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GLSL_qf_fisheye_h
|
||||
#define __QF_GLSL_qf_fisheye_h
|
||||
|
||||
void glsl_InitFisheye (void);
|
||||
struct framebuffer_s;
|
||||
void glsl_FisheyeScreen (struct framebuffer_s *fb);
|
||||
|
||||
#endif//__QF_GLSL_qf_fisheye_h
|
|
@ -57,6 +57,8 @@ QFGL_NEED (void, glDepthMask, (GLboolean flag))
|
|||
QFGL_NEED (void, glDepthRangef, (GLclampf zNear, GLclampf zFar))
|
||||
QFGL_NEED (void, glDetachShader, (GLuint program, GLuint shader))
|
||||
QFGL_NEED (void, glDisable, (GLenum cap))
|
||||
QFGL_NEED (void, glCreateVertexArrays, (GLsizei n, GLuint *arrays))
|
||||
QFGL_NEED (void, glBindVertexArray, (GLuint array))
|
||||
QFGL_NEED (void, glDisableVertexAttribArray, (GLuint index))
|
||||
QFGL_NEED (void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
|
||||
QFGL_NEED (void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices))
|
||||
|
|
40
include/QF/GLSL/qf_main.h
Normal file
40
include/QF/GLSL/qf_main.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
qf_main.h
|
||||
|
||||
glsl main stuff from the renderer.
|
||||
|
||||
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __QF_GLSL_qf_main_h
|
||||
#define __QF_GLSL_qf_main_h
|
||||
|
||||
struct entqueue_s;
|
||||
|
||||
void glsl_R_NewMap (model_t *worldmodel, model_t **models, int num_models);
|
||||
void glsl_R_RenderEntities (struct entqueue_s *queue);
|
||||
void glsl_R_RenderView (void);
|
||||
void glsl_R_ClearState (void);
|
||||
void glsl_R_ViewChanged (void);
|
||||
void glsl_R_LineGraph (int x, int y, int *h_vals, int count, int height);
|
||||
|
||||
#endif//__QF_GLSL_qf_main_h
|
|
@ -27,8 +27,8 @@
|
|||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GLSL_qf_bsp_h
|
||||
#define __QF_GLSL_qf_bsp_h
|
||||
#ifndef __QF_GLSL_qf_particles_h
|
||||
#define __QF_GLSL_qf_particles_h
|
||||
|
||||
#include "QF/GLSL/types.h"
|
||||
|
||||
|
@ -38,4 +38,9 @@ typedef struct {
|
|||
byte color[4];
|
||||
} partvert_t;
|
||||
|
||||
#endif//__QF_GLSL_qf_bsp_h
|
||||
struct psystem_s;
|
||||
void glsl_R_DrawParticles (struct psystem_s *psystem);
|
||||
void glsl_R_Particles_Init_Cvars (void);
|
||||
void glsl_R_InitParticles (void);
|
||||
|
||||
#endif//__QF_GLSL_qf_particles_h
|
||||
|
|
|
@ -32,5 +32,8 @@
|
|||
|
||||
struct entity_s;
|
||||
void glsl_R_DrawSprite (struct entity_s *ent);
|
||||
void glsl_R_SpriteBegin (void);
|
||||
void glsl_R_SpriteEnd (void);
|
||||
void glsl_R_InitSprites (void);
|
||||
|
||||
#endif//__QF_GLSL_qf_sprite_h
|
||||
|
|
37
include/QF/GLSL/qf_warp.h
Normal file
37
include/QF/GLSL/qf_warp.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
qf_warp.h
|
||||
|
||||
GLSL screen warp
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2022/3/24
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __QF_GLSL_qf_warp_h
|
||||
#define __QF_GLSL_qf_warp_h
|
||||
|
||||
void glsl_InitWarp (void);
|
||||
struct framebuffer_s;
|
||||
void glsl_WarpScreen (struct framebuffer_s *fb);
|
||||
|
||||
#endif//__QF_GLSL_qf_warp_h
|
|
@ -80,15 +80,18 @@ include_qf_gl = \
|
|||
include/QF/GL/defines.h \
|
||||
include/QF/GL/extensions.h \
|
||||
include/QF/GL/funcs.h \
|
||||
include/QF/GL/qf_alias.h \
|
||||
include/QF/GL/qf_draw.h \
|
||||
include/QF/GL/qf_explosions.h \
|
||||
include/QF/GL/qf_fisheye.h \
|
||||
include/QF/GL/qf_funcs_list.h \
|
||||
include/QF/GL/qf_iqm.h \
|
||||
include/QF/GL/qf_lightmap.h \
|
||||
include/QF/GL/qf_particles.h \
|
||||
include/QF/GL/qf_rlight.h \
|
||||
include/QF/GL/qf_rmain.h \
|
||||
include/QF/GL/qf_rsurf.h \
|
||||
include/QF/GL/qf_sky.h \
|
||||
include/QF/GL/qf_sprite.h \
|
||||
include/QF/GL/qf_textures.h \
|
||||
include/QF/GL/qf_vid.h \
|
||||
include/QF/GL/types.h
|
||||
|
@ -99,13 +102,16 @@ include_qf_glsl = \
|
|||
include/QF/GLSL/qf_alias.h \
|
||||
include/QF/GLSL/qf_bsp.h \
|
||||
include/QF/GLSL/qf_draw.h \
|
||||
include/QF/GLSL/qf_fisheye.h \
|
||||
include/QF/GLSL/qf_funcs_list.h \
|
||||
include/QF/GLSL/qf_iqm.h \
|
||||
include/QF/GLSL/qf_lightmap.h \
|
||||
include/QF/GLSL/qf_main.h \
|
||||
include/QF/GLSL/qf_particles.h \
|
||||
include/QF/GLSL/qf_sprite.h \
|
||||
include/QF/GLSL/qf_textures.h \
|
||||
include/QF/GLSL/qf_vid.h \
|
||||
include/QF/GLSL/qf_warp.h \
|
||||
include/QF/GLSL/types.h
|
||||
|
||||
include_qf_input = \
|
||||
|
@ -140,6 +146,7 @@ include_qf_progs = \
|
|||
include/QF/progs/pr_type_names.h
|
||||
|
||||
include_qf_scene = \
|
||||
include/QF/scene/camera.h \
|
||||
include/QF/scene/entity.h \
|
||||
include/QF/scene/hierarchy.h \
|
||||
include/QF/scene/transform.h \
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
void QFV_Orthographic (mat4f_t proj, float xmin, float xmax,
|
||||
float ymin, float ymax, float znear, float zfar);
|
||||
void QFV_PerspectiveTan (mat4f_t proj, float fov, float aspect);
|
||||
void QFV_PerspectiveCos (mat4f_t proj, float fov, float aspect);
|
||||
void QFV_Perspective (mat4f_t proj, float fov, float aspect);
|
||||
// fov_x and fov_y are tan(fov/2) for x and y respectively
|
||||
void QFV_PerspectiveTan (mat4f_t proj, float fov_x, float fov_y);
|
||||
void QFV_PerspectiveCos (mat4f_t proj, float fov);
|
||||
|
||||
#endif//__QF_Vulkan_projection_h
|
||||
|
|
|
@ -133,10 +133,6 @@ typedef struct bspctx_s {
|
|||
struct qfv_tex_s *default_skybox;
|
||||
struct qfv_tex_s *skybox_tex;
|
||||
VkDescriptorSet skybox_descriptor;
|
||||
vec4f_t sky_rotation[2];
|
||||
vec4f_t sky_velocity;
|
||||
vec4f_t sky_fix;
|
||||
double sky_time;
|
||||
|
||||
quat_t default_color;
|
||||
quat_t last_color;
|
||||
|
|
|
@ -38,11 +38,12 @@ struct vulkan_ctx_s;
|
|||
struct model_s;
|
||||
struct mod_brush_s;
|
||||
struct msurface_s;
|
||||
struct transform_s;
|
||||
|
||||
void Vulkan_lightmap_init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_BuildLightmaps (struct model_s **models, int num_models, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_CalcLightmaps (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_BuildLightMap (struct mod_brush_s *brush, struct msurface_s *surf, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_BuildLightMap (const struct transform_s *transform, struct mod_brush_s *brush, struct msurface_s *surf, struct vulkan_ctx_s *ctx);
|
||||
VkImageView Vulkan_LightmapImageView (struct vulkan_ctx_s *ctx) __attribute__((pure));
|
||||
void Vulkan_FlushLightmaps (struct vulkan_ctx_s *ctx);
|
||||
|
||||
|
|
|
@ -30,9 +30,12 @@
|
|||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_renderframe_s;
|
||||
struct entqueue_s;
|
||||
|
||||
void Vulkan_NewMap (model_t *worldmodel, struct model_s **models,
|
||||
int num_models, struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_RenderView (struct qfv_renderframe_s *rFrame);
|
||||
void Vulkan_RenderEntities (struct entqueue_s *queue,
|
||||
struct qfv_renderframe_s *rFrame);
|
||||
|
||||
#endif//__QF_Vulkan_qf_main_h
|
||||
|
|
|
@ -68,15 +68,20 @@ typedef struct matrixctx_s {
|
|||
struct qfv_stagebuf_s *stage;
|
||||
VkDescriptorPool pool;
|
||||
VkDescriptorSetLayout setLayout;
|
||||
|
||||
vec4f_t sky_rotation[2];
|
||||
vec4f_t sky_velocity;
|
||||
vec4f_t sky_fix;
|
||||
double sky_time;
|
||||
} matrixctx_t;
|
||||
|
||||
struct vulkan_ctx_s;
|
||||
struct qfv_renderframe_s;
|
||||
|
||||
void Vulkan_CalcProjectionMatrices (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_CalcViewMatrix (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_SetViewMatrix (struct vulkan_ctx_s *ctx, mat4f_t view);
|
||||
void Vulkan_SetSkyMatrix (struct vulkan_ctx_s *ctx, mat4f_t sky);
|
||||
void Vulkan_SetSkyMatrix (struct vulkan_ctx_s *ctx, mat4f_t sky);
|
||||
|
||||
void Vulkan_Matrix_Init (struct vulkan_ctx_s *ctx);
|
||||
void Vulkan_Matrix_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
|
|
@ -15,10 +15,10 @@ size_t QFV_ScrapSize (scrap_t *scrap) __attribute__((pure));
|
|||
void QFV_ScrapClear (scrap_t *scrap);
|
||||
void QFV_DestroyScrap (scrap_t *scrap);
|
||||
VkImageView QFV_ScrapImageView (scrap_t *scrap) __attribute__((pure));
|
||||
subpic_t *QFV_ScrapSubpic (scrap_t *scrap, int width, int height);
|
||||
void QFV_SubpicDelete (subpic_t *subpic);
|
||||
struct subpic_s *QFV_ScrapSubpic (scrap_t *scrap, int width, int height);
|
||||
void QFV_SubpicDelete (struct subpic_s *subpic);
|
||||
|
||||
void *QFV_SubpicBatch (subpic_t *subpic, struct qfv_stagebuf_s *stage);
|
||||
void *QFV_SubpicBatch (struct subpic_s *subpic, struct qfv_stagebuf_s *stage);
|
||||
|
||||
void QFV_ScrapFlush (scrap_t *scrap);
|
||||
|
||||
|
|
|
@ -179,21 +179,21 @@
|
|||
*/
|
||||
#define DARRAY_RESIZE(array, newSize) \
|
||||
do { \
|
||||
__auto_type ar = (array); \
|
||||
__auto_type ar_r = (array); \
|
||||
size_t ns = (newSize); \
|
||||
if (__builtin_expect (ns > ar->maxSize, 0)) { \
|
||||
if (__builtin_expect (!ar->grow, 0)) { \
|
||||
if (__builtin_expect (ns > ar_r->maxSize, 0)) { \
|
||||
if (__builtin_expect (!ar_r->grow, 0)) { \
|
||||
Sys_Error ("Attempt to grow fixed-size darray: %s:%d", \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
ar->maxSize = ar->grow * ((ns + ar->grow - 1) / ar->grow); \
|
||||
ar->a = realloc (ar->a, ar->maxSize * sizeof (*ar->a)); \
|
||||
if (__builtin_expect (!ar->a, 0)) { \
|
||||
ar_r->maxSize = ar_r->grow * ((ns + ar_r->grow - 1) / ar_r->grow);\
|
||||
ar_r->a = realloc (ar_r->a, ar_r->maxSize * sizeof (*ar_r->a)); \
|
||||
if (__builtin_expect (!ar_r->a, 0)) { \
|
||||
Sys_Error ("failed to realloc darray: %s:%d", \
|
||||
__FILE__, __LINE__); \
|
||||
} \
|
||||
} \
|
||||
ar->size = ns; \
|
||||
ar_r->size = ns; \
|
||||
} while (0)
|
||||
|
||||
/** Append a value to the end of the array.
|
||||
|
@ -250,17 +250,17 @@
|
|||
*/
|
||||
#define DARRAY_OPEN_AT(array, index, space) \
|
||||
({ \
|
||||
__auto_type ar = (array); \
|
||||
__auto_type ar_o = (array); \
|
||||
size_t po = (index); \
|
||||
size_t sp = (space); \
|
||||
if (__builtin_expect (po > ar->size, 0)) { \
|
||||
if (__builtin_expect (po > ar_o->size, 0)) { \
|
||||
Sys_Error ("Attempt to insert elements outside darray: " \
|
||||
"%s:%d", __FILE__, __LINE__); \
|
||||
} \
|
||||
DARRAY_RESIZE (ar, ar->size + sp); \
|
||||
memmove (&ar->a[po + sp], &ar->a[po], \
|
||||
(ar->size - po - sp) * sizeof (*ar->a)); \
|
||||
&ar->a[po]; \
|
||||
DARRAY_RESIZE (ar_o, ar_o->size + sp); \
|
||||
memmove (&ar_o->a[po + sp], &ar_o->a[po], \
|
||||
(ar_o->size - po - sp) * sizeof (*ar_o->a)); \
|
||||
&ar_o->a[po]; \
|
||||
})
|
||||
|
||||
/** Insert a value into the array at the specified index.
|
||||
|
@ -314,18 +314,18 @@
|
|||
*/
|
||||
#define DARRAY_CLOSE_AT(array, index, count) \
|
||||
({ \
|
||||
__auto_type ar = (array); \
|
||||
__auto_type ar_c = (array); \
|
||||
size_t po = (index); \
|
||||
size_t co = (count); \
|
||||
if (__builtin_expect (po + co > ar->size \
|
||||
|| po >= ar->size, 0)) { \
|
||||
if (__builtin_expect (po + co > ar_c->size \
|
||||
|| po >= ar_c->size, 0)) { \
|
||||
Sys_Error ("Attempt to remove elements outside darray: " \
|
||||
"%s:%d", __FILE__, __LINE__); \
|
||||
} \
|
||||
__auto_type ob = ar->a[po]; \
|
||||
memmove (&ar->a[po], &ar->a[po + co], \
|
||||
(ar->size - po - co) * sizeof (ob)); \
|
||||
ar->size -= co; \
|
||||
__auto_type ob = ar_c->a[po]; \
|
||||
memmove (&ar_c->a[po], &ar_c->a[po + co], \
|
||||
(ar_c->size - po - co) * sizeof (ob)); \
|
||||
ar_c->size -= co; \
|
||||
ob; \
|
||||
})
|
||||
|
||||
|
|
|
@ -46,7 +46,14 @@ typedef struct tex_s {
|
|||
int width;
|
||||
int height;
|
||||
QFFormat format;
|
||||
int loaded; // 0 if size info only, otherwise data loaded
|
||||
union {
|
||||
struct {
|
||||
int loaded:1; // 0 if size info only, otherwise data loaded
|
||||
int flipped:1; // 1 if first pixel is bottom instead of top
|
||||
int bgr:1; // 1 if image is bgr (for tex_rgb)
|
||||
};
|
||||
int flagbits; // for eazy zeroing
|
||||
};
|
||||
const byte *palette; // 0 = 32 bit, otherwise 8
|
||||
byte *data;
|
||||
} tex_t;
|
||||
|
|
|
@ -50,13 +50,9 @@
|
|||
# define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
extern int nanmask;
|
||||
|
||||
#define EQUAL_EPSILON 0.001
|
||||
#define RINT(x) (floor ((x) + 0.5))
|
||||
|
||||
#define IS_NAN(x) (((*(int *) (char *) &x) & nanmask) == nanmask)
|
||||
|
||||
#define Blend(a,b,blend) ((1 - (blend)) * (a) + (blend) * (b))
|
||||
|
||||
#include "QF/math/vector.h"
|
||||
|
@ -141,7 +137,7 @@ void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right,
|
|||
void AngleQuat (const vec3_t angles, quat_t q);
|
||||
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up);
|
||||
int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs,
|
||||
struct plane_s *plane) __attribute__((pure));
|
||||
const plane_t *plane) __attribute__((pure));
|
||||
float anglemod (float a) __attribute__((const));
|
||||
|
||||
void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
|
||||
|
@ -175,9 +171,8 @@ void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
|
|||
VectorNegate ((sp)->normal, (dp)->normal); \
|
||||
} while (0)
|
||||
|
||||
extern plane_t * const frustum;
|
||||
GNU89INLINE inline qboolean R_CullBox (const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
||||
GNU89INLINE inline qboolean R_CullSphere (const vec3_t origin, const float radius);
|
||||
GNU89INLINE inline qboolean R_CullBox (const plane_t *frustum, const vec3_t mins, const vec3_t maxs) __attribute__((pure));
|
||||
GNU89INLINE inline qboolean R_CullSphere (const plane_t *frustum, const vec3_t origin, const float radius);
|
||||
|
||||
#ifndef IMPLEMENT_R_Cull
|
||||
GNU89INLINE inline
|
||||
|
@ -185,7 +180,7 @@ GNU89INLINE inline
|
|||
VISIBLE
|
||||
#endif
|
||||
qboolean
|
||||
R_CullBox (const vec3_t mins, const vec3_t maxs)
|
||||
R_CullBox (const plane_t *frustum, const vec3_t mins, const vec3_t maxs)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -203,7 +198,7 @@ GNU89INLINE inline
|
|||
VISIBLE
|
||||
#endif
|
||||
qboolean
|
||||
R_CullSphere (const vec3_t origin, const float radius)
|
||||
R_CullSphere (const plane_t *frustum, const vec3_t origin, const float radius)
|
||||
{
|
||||
int i;
|
||||
float r;
|
||||
|
|
|
@ -373,7 +373,14 @@ typedef struct {
|
|||
|
||||
// Whole model ================================================================
|
||||
|
||||
typedef enum {mod_brush, mod_sprite, mod_alias, mod_iqm} modtype_t;
|
||||
typedef enum {
|
||||
mod_brush,
|
||||
mod_sprite,
|
||||
mod_alias,
|
||||
mod_iqm,
|
||||
|
||||
mod_num_types
|
||||
} modtype_t;
|
||||
|
||||
#define EF_ROCKET 1 // leave a trail
|
||||
#define EF_GRENADE 2 // leave a trail
|
||||
|
|
|
@ -29,15 +29,17 @@
|
|||
|
||||
#include <QF/plugin.h>
|
||||
#include <QF/qtypes.h>
|
||||
#include <QF/simd/types.h>
|
||||
|
||||
struct sfx_s;
|
||||
struct transform_s;
|
||||
|
||||
typedef struct snd_render_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*ambient_off) (void);
|
||||
void (*ambient_on) (void);
|
||||
void (*static_sound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
|
||||
void (*start_sound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
|
||||
void (*static_sound) (struct sfx_s *sfx, vec4f_t origin, float vol, float attenuation);
|
||||
void (*start_sound) (int entnum, int entchannel, struct sfx_s *sfx, const vec4f_t, float vol, float attenuation);
|
||||
void (*local_sound) (const char *s);
|
||||
void (*stop_sound) (int entnum, int entchannel);
|
||||
|
||||
|
@ -47,8 +49,7 @@ typedef struct snd_render_funcs_s {
|
|||
struct sfx_s *(*precache_sound) (const char *sample);
|
||||
struct sfx_s *(*load_sound) (const char *name);
|
||||
|
||||
void (*update) (const vec3_t origin, const vec3_t v_forward,
|
||||
const vec3_t v_right, const vec3_t v_up,
|
||||
void (*update) (struct transform_s *ear,
|
||||
const byte *ambient_sound_levels);
|
||||
void (*stop_all_sounds) (void);
|
||||
void (*extra_update) (void);
|
||||
|
|
|
@ -39,6 +39,9 @@ struct skin_s;
|
|||
|
||||
struct mod_alias_ctx_s;
|
||||
struct mod_sprite_ctx_s;
|
||||
struct entqueue_s;
|
||||
struct framebuffer_s;
|
||||
struct vrect_s;
|
||||
|
||||
/*
|
||||
All video plugins must export these functions
|
||||
|
@ -73,6 +76,9 @@ typedef struct vid_model_funcs_s {
|
|||
void (*Skin_InitTranslations) (void);
|
||||
} vid_model_funcs_t;
|
||||
|
||||
struct tex_s;
|
||||
typedef void (*capfunc_t) (struct tex_s *screencap, void *data);
|
||||
|
||||
typedef struct vid_render_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*Draw_Character) (int x, int y, unsigned ch);
|
||||
|
@ -96,35 +102,31 @@ typedef struct vid_render_funcs_s {
|
|||
void (*Draw_Picf) (float x, float y, qpic_t *pic);
|
||||
void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
|
||||
|
||||
void (*SCR_SetFOV) (float fov);
|
||||
void (*SCR_DrawRam) (void);
|
||||
void (*SCR_DrawTurtle) (void);
|
||||
void (*SCR_DrawPause) (void);
|
||||
struct tex_s *(*SCR_CaptureBGR) (void);
|
||||
struct tex_s *(*SCR_ScreenShot) (unsigned width, unsigned height);
|
||||
void (*SCR_DrawStringToSnap) (const char *s, struct tex_s *tex,
|
||||
int x, int y);
|
||||
|
||||
void (*Fog_Update) (float density, float red, float green, float blue,
|
||||
float time);
|
||||
void (*Fog_ParseWorldspawn) (struct plitem_s *worldspawn);
|
||||
|
||||
struct psystem_s *(*ParticleSystem) (void);
|
||||
void (*R_Init) (void);
|
||||
void (*R_RenderFrame) (SCR_Func *scr_funcs);
|
||||
void (*R_ClearState) (void);
|
||||
void (*R_LoadSkys) (const char *);
|
||||
void (*R_NewMap) (model_t *worldmodel, model_t **models, int num_models);
|
||||
void (*R_AddEfrags) (mod_brush_t *brush, entity_t *ent);
|
||||
void (*R_RemoveEfrags) (entity_t *ent);
|
||||
void (*R_LineGraph) (int x, int y, int *h_vals, int count, int height);
|
||||
dlight_t *(*R_AllocDlight) (int key);
|
||||
entity_t *(*R_AllocEntity) (void);
|
||||
void (*R_MaxDlightsCheck) (struct cvar_s *var);
|
||||
void (*R_DecayLights) (double frametime);
|
||||
|
||||
void (*R_ViewChanged) (void);
|
||||
void (*SCR_ScreenShot_f) (void);
|
||||
void (*begin_frame) (void);
|
||||
void (*render_view) (void);
|
||||
void (*draw_entities) (struct entqueue_s *queue);
|
||||
void (*draw_particles) (struct psystem_s *psystem);
|
||||
void (*draw_transparent) (void);
|
||||
void (*post_process) (struct framebuffer_s *src);
|
||||
void (*set_2d) (int scaled);
|
||||
void (*end_frame) (void);
|
||||
|
||||
struct framebuffer_s *(*create_cube_map) (int side);
|
||||
struct framebuffer_s *(*create_frame_buffer) (int width, int height);
|
||||
void (*bind_framebuffer) (struct framebuffer_s *framebuffer);
|
||||
void (*set_viewport) (const struct vrect_s *view);
|
||||
// x and y are tan(f/2) for fov_x and fov_y
|
||||
void (*set_fov) (float x, float y);
|
||||
|
||||
void (*capture_screen) (capfunc_t callback, void *data);
|
||||
|
||||
vid_model_funcs_t *model_funcs;
|
||||
} vid_render_funcs_t;
|
||||
|
@ -145,15 +147,9 @@ typedef struct vid_render_data_s {
|
|||
qboolean paused;
|
||||
int lineadj;
|
||||
struct entity_s *view_model;
|
||||
struct entity_s *player_entity;
|
||||
float gravity;
|
||||
double frametime;
|
||||
double realtime;
|
||||
lightstyle_t *lightstyle;
|
||||
vec_t *origin;
|
||||
vec_t *vpn;
|
||||
vec_t *vright;
|
||||
vec_t *vup;
|
||||
} vid_render_data_t;
|
||||
|
||||
#endif // __QF_plugin_vid_render_h
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include "QF/quakefs.h"
|
||||
|
||||
struct tex_s *LoadPNG (QFile *infile, int load);
|
||||
void WritePNG (const char *fileName, const byte *data, int width, int height);
|
||||
void WritePNGqfs (const char *fileName, const byte *data,
|
||||
int width, int height);
|
||||
int WritePNG (QFile *outfile, const struct tex_s *tex);
|
||||
|
||||
#endif//__QF_png_h
|
||||
|
|
|
@ -73,8 +73,8 @@
|
|||
|
||||
#define PQUEUE_IS_FULL(queue) \
|
||||
({ \
|
||||
__auto_type q = (queue); \
|
||||
q->size == q->maxSize; \
|
||||
__auto_type q_f = (queue); \
|
||||
q_f->size == q_f->maxSize; \
|
||||
})
|
||||
|
||||
#define PQUEUE_PEEK(queue) ((queue)->a[0])
|
||||
|
|
|
@ -290,17 +290,20 @@ int QFS_Remove (const char *path);
|
|||
/** Find available filename.
|
||||
|
||||
The filename will be of the form \c prefixXXXX.ext where \c XXXX
|
||||
is a zero padded number from 0 to 9999.
|
||||
is a zero padded number from 0 to 9999. Should there already be 10000
|
||||
files of such a pattern, then extra digits will be added.
|
||||
|
||||
\param filename This will be set to the available filename.
|
||||
\param prefix The part of the filename preceeding the numers.
|
||||
\param ext The extension to add to the filename.
|
||||
\return 1 for success, 0 for failure.
|
||||
\return NULL for failure (with an error message in \a filename)
|
||||
or a quakeio file handle.
|
||||
|
||||
\note \a prefix is relative to \c qfc_userpath.
|
||||
\note \a prefix is relative to \c qfc_userpath, as is the generated
|
||||
filename.
|
||||
*/
|
||||
int QFS_NextFilename (struct dstring_s *filename, const char *prefix,
|
||||
const char *ext);
|
||||
QFile *QFS_NextFile (struct dstring_s *filename, const char *prefix,
|
||||
const char *ext);
|
||||
|
||||
/** Extract the non-extension part of the file name from the path.
|
||||
|
||||
|
|
|
@ -35,25 +35,6 @@
|
|||
#include "QF/simd/types.h"
|
||||
#include "QF/ui/vrect.h"
|
||||
|
||||
typedef enum {
|
||||
pt_static,
|
||||
pt_grav,
|
||||
pt_slowgrav,
|
||||
pt_fire,
|
||||
pt_explode,
|
||||
pt_explode2,
|
||||
pt_blob,
|
||||
pt_blob2,
|
||||
pt_smoke,
|
||||
pt_smokecloud,
|
||||
pt_bloodcloud,
|
||||
pt_fadespark,
|
||||
pt_fadespark2,
|
||||
pt_fallfade,
|
||||
pt_fallfadespark,
|
||||
pt_flame
|
||||
} ptype_t;
|
||||
|
||||
typedef enum {
|
||||
part_tex_dot,
|
||||
part_tex_spark,
|
||||
|
@ -91,6 +72,7 @@ typedef struct partparm_s {
|
|||
} partparm_t;
|
||||
|
||||
typedef struct psystem_s {
|
||||
vec4f_t gravity;
|
||||
uint32_t maxparticles;
|
||||
uint32_t numparticles;
|
||||
particle_t *particles;
|
||||
|
@ -138,106 +120,79 @@ typedef struct
|
|||
|
||||
//===============
|
||||
|
||||
typedef struct animation_s {
|
||||
int frame;
|
||||
float syncbase; // randomize time base for local animations
|
||||
float frame_start_time;
|
||||
float frame_interval;
|
||||
int pose1;
|
||||
int pose2;
|
||||
float blend;
|
||||
int nolerp; // don't lerp this frame (pose data invalid)
|
||||
} animation_t;
|
||||
typedef union refframe_s {
|
||||
mat4f_t mat;
|
||||
struct {
|
||||
vec4f_t right;
|
||||
vec4f_t forward;
|
||||
vec4f_t up;
|
||||
vec4f_t position;
|
||||
};
|
||||
} refframe_t;
|
||||
|
||||
typedef struct visibility_s {
|
||||
struct entity_s *entity; // owning entity
|
||||
struct efrag_s *efrag; // linked list of efrags
|
||||
struct mnode_s *topnode; // bmodels, first world node that
|
||||
// splits bmodel, or NULL if not split
|
||||
// applies to other models, too
|
||||
int visframe; // last frame this entity was
|
||||
// found in an active leaf
|
||||
int trivial_accept; // view clipping (frustum and depth)
|
||||
} visibility_t;
|
||||
|
||||
typedef struct renderer_s {
|
||||
struct model_s *model; // NULL = no model
|
||||
struct skin_s *skin;
|
||||
float colormod[4]; // color tint and alpha for model
|
||||
int skinnum; // for Alias models
|
||||
int fullbright;
|
||||
float min_light;
|
||||
mat4_t full_transform;
|
||||
} renderer_t;
|
||||
|
||||
typedef struct entity_s {
|
||||
struct entity_s *next;
|
||||
|
||||
struct transform_s *transform;
|
||||
animation_t animation;
|
||||
visibility_t visibility;
|
||||
renderer_t renderer;
|
||||
int active;
|
||||
//XXX FIXME XXX should not be here
|
||||
vec4f_t old_origin;
|
||||
} entity_t;
|
||||
/** Generic frame buffer object.
|
||||
*
|
||||
* For attaching scene cameras to render targets.
|
||||
*/
|
||||
typedef struct framebuffer_s {
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
void *buffer; ///< renderer-specific frame buffer data
|
||||
} framebuffer_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||
typedef struct {
|
||||
vrect_t vrect; // subwindow in video for refresh
|
||||
// FIXME: not need vrect next field here?
|
||||
vrect_t aliasvrect; // scaled Alias version
|
||||
int vrectright, vrectbottom; // right & bottom screen coords
|
||||
int aliasvrectright, aliasvrectbottom; // scaled Alias versions
|
||||
float vrectrightedge; // rightmost right edge we care about,
|
||||
// for use in edge list
|
||||
float fvrectx, fvrecty; // for floating-point compares
|
||||
float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
|
||||
int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
|
||||
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
|
||||
float fvrectright_adj, fvrectbottom_adj;
|
||||
int aliasvrectleft, aliasvrecttop; // scaled Alias versions
|
||||
int aliasvrectright, aliasvrectbottom; // scaled Alias versions
|
||||
int vrectright, vrectbottom; // right & bottom screen coords
|
||||
int vrectx_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
|
||||
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
|
||||
float fvrectx, fvrecty; // for floating-point compares
|
||||
// right and bottom edges, for clamping
|
||||
float fvrectright; // rightmost edge, for Alias clamping
|
||||
float fvrectbottom; // bottommost edge, for Alias clamping
|
||||
float horizontalFieldOfView; // at Z = 1.0, this many X is visible
|
||||
// 2.0 = 90 degrees
|
||||
float xOrigin; // should probably always be 0.5
|
||||
float yOrigin; // between be around 0.3 to 0.5
|
||||
// end of asm refs
|
||||
|
||||
//FIXME was vec3_t, need to deal with asm (maybe? is it worth it?)
|
||||
vec4f_t viewposition;
|
||||
vec4f_t viewrotation;
|
||||
//FIXME move all of below elsewhere
|
||||
vrect_t vrect; // subwindow in video for refresh
|
||||
|
||||
refframe_t frame;
|
||||
plane_t frustum[4];
|
||||
mat4f_t camera;
|
||||
mat4f_t camera_inverse;
|
||||
|
||||
int ambientlight;
|
||||
int drawflat;
|
||||
|
||||
float fov_x, fov_y;
|
||||
struct model_s *worldmodel;
|
||||
struct mleaf_s *viewleaf;
|
||||
} refdef_t;
|
||||
|
||||
// color shifts =============================================================
|
||||
|
||||
typedef struct {
|
||||
int destcolor[3];
|
||||
int percent; // 0-255
|
||||
double time;
|
||||
int initialpct;
|
||||
} cshift_t;
|
||||
|
||||
#define CSHIFT_CONTENTS 0
|
||||
#define CSHIFT_DAMAGE 1
|
||||
#define CSHIFT_BONUS 2
|
||||
#define CSHIFT_POWERUP 3
|
||||
#define NUM_CSHIFTS 4
|
||||
|
||||
// REFRESH ====================================================================
|
||||
|
||||
extern struct texture_s *r_notexture_mip;
|
||||
|
||||
extern entity_t r_worldentity;
|
||||
|
||||
void R_Init (void);
|
||||
struct vid_internal_s;
|
||||
void R_LoadModule (struct vid_internal_s *vid_internal);
|
||||
struct progs_s;
|
||||
void R_Progs_Init (struct progs_s *pr);
|
||||
|
||||
dlight_t *R_AllocDlight (int key);
|
||||
void R_MaxDlightsCheck (struct cvar_s *var);
|
||||
void R_DecayLights (double frametime);
|
||||
void Fog_Update (float density, float red, float green, float blue,
|
||||
float time);
|
||||
struct plitem_s;
|
||||
void Fog_ParseWorldspawn (struct plitem_s *worldspawn);
|
||||
|
||||
void Fog_GetColor (quat_t fogcolor);
|
||||
float Fog_GetDensity (void) __attribute__((pure));
|
||||
void Fog_SetupFrame (void);
|
||||
void Fog_StartAdditive (void);
|
||||
void Fog_StopAdditive (void);
|
||||
void Fog_Init (void);
|
||||
|
||||
#endif//__QF_render_h
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
unsigned tail; \
|
||||
}
|
||||
|
||||
#define RB_buffer_size(ring_buffer) \
|
||||
({ __auto_type rb = (ring_buffer); \
|
||||
sizeof (rb->buffer) / sizeof (rb->buffer[0]); \
|
||||
#define RB_buffer_size(ring_buffer) \
|
||||
({ __auto_type rb_s = (ring_buffer); \
|
||||
sizeof (rb_s->buffer) / sizeof (rb_s->buffer[0]); \
|
||||
})
|
||||
|
||||
/** Return the amount of space available for writing in the ring buffer.
|
||||
|
|
58
include/QF/scene/camera.h
Normal file
58
include/QF/scene/camera.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
camera.h
|
||||
|
||||
Scene camera data
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2022/02/18
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __QF_scene_camera_h
|
||||
#define __QF_scene_camera_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/simd/mat4f.h"
|
||||
|
||||
/** \defgroup scene_camera Camera data
|
||||
\ingroup scene
|
||||
*/
|
||||
///@{
|
||||
|
||||
typedef struct camera_s {
|
||||
struct scene_s *scene; ///< owning scene
|
||||
struct framebuffer_s *framebuffer;
|
||||
int32_t id; ///< id in scene
|
||||
int32_t transform;
|
||||
float field_of_view;
|
||||
float aspect;
|
||||
float near_clip;
|
||||
float far_clip;
|
||||
} camera_t;
|
||||
|
||||
void Camera_GetViewMatrix (const camera_t *camera, mat4f_t mat);
|
||||
void Camera_GetProjectionMatrix (const camera_t *camera, mat4f_t mat);
|
||||
|
||||
///@}
|
||||
|
||||
#endif//__QF_scene_camera_h
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/set.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
#include "QF/simd/mat4f.h"
|
||||
|
||||
|
@ -44,7 +45,83 @@
|
|||
#include "QF/scene/hierarchy.h"
|
||||
#include "QF/scene/transform.h"
|
||||
|
||||
#include "QF/render.h" //FIXME move entity_t here
|
||||
typedef struct animation_s {
|
||||
int frame;
|
||||
float syncbase; // randomize time base for local animations
|
||||
float frame_start_time;
|
||||
float frame_interval;
|
||||
int pose1;
|
||||
int pose2;
|
||||
float blend;
|
||||
int nolerp; // don't lerp this frame (pose data invalid)
|
||||
} animation_t;
|
||||
|
||||
typedef struct visibility_s {
|
||||
struct entity_s *entity; // owning entity
|
||||
struct efrag_s *efrag; // linked list of efrags
|
||||
struct mnode_s *topnode; // bmodels, first world node that
|
||||
// splits bmodel, or NULL if not split
|
||||
// applies to other models, too
|
||||
// found in an active leaf
|
||||
int trivial_accept; // view clipping (frustum and depth)
|
||||
} visibility_t;
|
||||
|
||||
typedef struct renderer_s {
|
||||
struct model_s *model; // NULL = no model
|
||||
struct skin_s *skin;
|
||||
float colormod[4]; // color tint and alpha for model
|
||||
int skinnum; // for Alias models
|
||||
int fullbright;
|
||||
float min_light;
|
||||
mat4_t full_transform;
|
||||
} renderer_t;
|
||||
|
||||
typedef struct entity_s {
|
||||
struct entity_s *next;
|
||||
struct transform_s *transform;
|
||||
int id; ///< scene id
|
||||
animation_t animation;
|
||||
visibility_t visibility;
|
||||
renderer_t renderer;
|
||||
int active;
|
||||
//XXX FIXME XXX should not be here
|
||||
vec4f_t old_origin;
|
||||
} entity_t;
|
||||
|
||||
typedef struct entqueue_s {
|
||||
set_t *queued_ents;
|
||||
entityset_t *ent_queues;
|
||||
int num_queues;
|
||||
} entqueue_t;
|
||||
|
||||
#define ENTINLINE GNU89INLINE inline
|
||||
|
||||
entqueue_t *EntQueue_New (int num_queues);
|
||||
void EntQueue_Delete (entqueue_t *queue);
|
||||
ENTINLINE void EntQueue_AddEntity (entqueue_t *queue, entity_t *ent,
|
||||
int queue_num);
|
||||
void EntQueue_Clear (entqueue_t *queue);
|
||||
|
||||
#undef ENTINLINE
|
||||
#ifndef IMPLEMENT_ENTITY_Funcs
|
||||
#define ENTINLINE GNU89INLINE inline
|
||||
#else
|
||||
#define ENTINLINE VISIBLE
|
||||
#endif
|
||||
|
||||
ENTINLINE
|
||||
void
|
||||
EntQueue_AddEntity (entqueue_t *queue, entity_t *ent, int queue_num)
|
||||
{
|
||||
if (!set_is_member (queue->queued_ents, ent->id)) {
|
||||
// entity ids are negative (ones-complement)
|
||||
set_add (queue->queued_ents, -ent->id);//FIXME use ~
|
||||
DARRAY_APPEND (&queue->ent_queues[queue_num], ent);
|
||||
}
|
||||
}
|
||||
struct mod_brush_s;
|
||||
void R_AddEfrags (struct mod_brush_s *, entity_t *ent);
|
||||
void R_RemoveEfrags (entity_t *ent);
|
||||
|
||||
///@}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
#define null_transform (~0u)
|
||||
|
||||
typedef struct hierarchy_s {
|
||||
struct hierarchy_s *next;
|
||||
struct hierarchy_s **prev;
|
||||
struct scene_s *scene;
|
||||
xformset_t transform;
|
||||
entityset_t entity;
|
||||
uint32set_t childCount;
|
||||
|
@ -63,7 +66,7 @@ typedef struct hierarchy_s {
|
|||
vec4fset_t worldScale;
|
||||
} hierarchy_t;
|
||||
|
||||
hierarchy_t *Hierarchy_New (size_t grow, int createRoot);
|
||||
hierarchy_t *Hierarchy_New (struct scene_s *scene, int createRoot);
|
||||
hierarchy_t *Hierarchy_Copy (hierarchy_t *src);
|
||||
void Hierarchy_Delete (hierarchy_t *hierarchy);
|
||||
|
||||
|
|
|
@ -40,21 +40,17 @@
|
|||
*/
|
||||
///@{
|
||||
|
||||
typedef struct hierarchyset_s DARRAY_TYPE (struct hierarchy_s *)
|
||||
hierarchyset_t;
|
||||
typedef struct visibilityset_s DARRAY_TYPE (struct visibility_s *)
|
||||
visibilityset_t;
|
||||
|
||||
typedef struct scene_s {
|
||||
struct scene_resources_s *const resources;
|
||||
hierarchyset_t roots;
|
||||
xformset_t transforms;
|
||||
entityset_t entities;
|
||||
visibilityset_t visibility;
|
||||
struct hierarchy_s *hierarchies;
|
||||
} scene_t;
|
||||
|
||||
scene_t *Scene_NewScene (void);
|
||||
void Scene_DeleteScene (scene_t *scene);
|
||||
struct entity_s *Scene_CreateEntity (scene_t *scene);
|
||||
struct entity_s *Scene_GetEntity (scene_t *scene, int id) __attribute__((pure));
|
||||
struct transform_s *Scene_GetTransform (scene_t *scene, int id) __attribute__((pure));
|
||||
void Scene_DestroyEntity (scene_t *scene, struct entity_s *entity);
|
||||
void Scene_FreeAllEntities (scene_t *scene);
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/scene/hierarchy.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
#include "QF/simd/mat4f.h"
|
||||
|
||||
|
@ -42,48 +43,235 @@
|
|||
///@{
|
||||
|
||||
typedef struct transform_s {
|
||||
struct hierarchy_s *hierarchy;
|
||||
uint32_t index;
|
||||
hierarchy_t *hierarchy;
|
||||
struct scene_s *scene; ///< owning scene
|
||||
uint32_t index; ///< index in hierarchy
|
||||
int32_t id; ///< scene id
|
||||
} transform_t;
|
||||
|
||||
transform_t *Transform_New (transform_t *parent);
|
||||
#define XFORMINLINE GNU89INLINE inline __attribute__((pure))
|
||||
|
||||
transform_t *Transform_New (struct scene_s *scene, transform_t *parent);
|
||||
/* Deletes all child transforms, and transform names */
|
||||
void Transform_Delete (transform_t *transform);
|
||||
transform_t *Transform_NewNamed (transform_t *parent, const char *name);
|
||||
uint32_t Transform_ChildCount (const transform_t *transform) __attribute__((pure));
|
||||
transform_t *Transform_GetChild (const transform_t *transform,
|
||||
uint32_t childIndex) __attribute__((pure));
|
||||
transform_t *Transform_NewNamed (struct scene_s *scene, transform_t *parent,
|
||||
const char *name);
|
||||
XFORMINLINE uint32_t Transform_ChildCount (const transform_t *transform);
|
||||
XFORMINLINE transform_t *Transform_GetChild (const transform_t *transform,
|
||||
uint32_t childIndex);
|
||||
void Transform_SetParent (transform_t *transform, transform_t *parent);
|
||||
transform_t *Transform_GetParent (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE transform_t *Transform_GetParent (const transform_t *transform);
|
||||
void Transform_SetName (transform_t *transform, const char *name);
|
||||
const char *Transform_GetName (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE const char *Transform_GetName (const transform_t *transform);
|
||||
void Transform_SetTag (transform_t *transform, uint32_t tag);
|
||||
uint32_t Transform_GetTag (const transform_t *transform) __attribute__((pure));
|
||||
void Transform_GetLocalMatrix (const transform_t *transform, mat4f_t mat);
|
||||
void Transform_GetLocalInverse (const transform_t *transform, mat4f_t mat);
|
||||
void Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat);
|
||||
XFORMINLINE uint32_t Transform_GetTag (const transform_t *transform);
|
||||
GNU89INLINE inline void Transform_GetLocalMatrix (const transform_t *transform, mat4f_t mat);
|
||||
GNU89INLINE inline void Transform_GetLocalInverse (const transform_t *transform, mat4f_t mat);
|
||||
GNU89INLINE inline void Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat);
|
||||
// XXX the pointer may be invalidated by hierarchy updates
|
||||
const vec4f_t *Transform_GetWorldMatrixPtr (const transform_t *transform) __attribute__((pure));
|
||||
void Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat);
|
||||
vec4f_t Transform_GetLocalPosition (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE const vec4f_t *Transform_GetWorldMatrixPtr (const transform_t *transform);
|
||||
GNU89INLINE inline void Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat);
|
||||
XFORMINLINE vec4f_t Transform_GetLocalPosition (const transform_t *transform);
|
||||
void Transform_SetLocalPosition (transform_t *transform, vec4f_t position);
|
||||
vec4f_t Transform_GetLocalRotation (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_GetLocalRotation (const transform_t *transform);
|
||||
void Transform_SetLocalRotation (transform_t *transform, vec4f_t rotation);
|
||||
vec4f_t Transform_GetLocalScale (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_GetLocalScale (const transform_t *transform);
|
||||
void Transform_SetLocalScale (transform_t *transform, vec4f_t scale);
|
||||
vec4f_t Transform_GetWorldPosition (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_GetWorldPosition (const transform_t *transform);
|
||||
void Transform_SetWorldPosition (transform_t *transform, vec4f_t position);
|
||||
vec4f_t Transform_GetWorldRotation (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_GetWorldRotation (const transform_t *transform);
|
||||
void Transform_SetWorldRotation (transform_t *transform, vec4f_t rotation);
|
||||
vec4f_t Transform_GetWorldScale (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_GetWorldScale (const transform_t *transform);
|
||||
void Transform_SetLocalTransform (transform_t *transform, vec4f_t scale,
|
||||
vec4f_t rotation, vec4f_t position);
|
||||
// NOTE: these use X: right, Y: forward, Z:up
|
||||
// NOTE: these use X: forward, -Y: right, Z:up
|
||||
// aslo, not guaranteed to be normalized or even orthogonal
|
||||
vec4f_t Transform_Forward (const transform_t *transform) __attribute__((pure));
|
||||
vec4f_t Transform_Right (const transform_t *transform) __attribute__((pure));
|
||||
vec4f_t Transform_Up (const transform_t *transform) __attribute__((pure));
|
||||
XFORMINLINE vec4f_t Transform_Forward (const transform_t *transform);
|
||||
XFORMINLINE vec4f_t Transform_Right (const transform_t *transform);
|
||||
XFORMINLINE vec4f_t Transform_Up (const transform_t *transform);
|
||||
// no SetWorldScale because after rotations, non uniform scale becomes shear
|
||||
|
||||
#undef XFORMINLINE
|
||||
#ifndef IMPLEMENT_TRANSFORM_Funcs
|
||||
#define XFORMINLINE GNU89INLINE inline
|
||||
#else
|
||||
#define XFORMINLINE VISIBLE
|
||||
#endif
|
||||
|
||||
XFORMINLINE
|
||||
uint32_t
|
||||
Transform_ChildCount (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->childCount.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
transform_t *
|
||||
Transform_GetChild (const transform_t *transform, uint32_t childIndex)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
if (childIndex >= h->childCount.a[transform->index]) {
|
||||
return 0;
|
||||
}
|
||||
return h->transform.a[h->childIndex.a[transform->index] + childIndex];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
transform_t *
|
||||
Transform_GetParent (const transform_t *transform)
|
||||
{
|
||||
if (transform->index == 0) {
|
||||
return 0;
|
||||
}
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->transform.a[h->parentIndex.a[transform->index]];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
const char *
|
||||
Transform_GetName (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->name.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
uint32_t
|
||||
Transform_GetTag (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->tag.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
void
|
||||
Transform_GetLocalMatrix (const transform_t *transform, mat4f_t mat)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
vec4f_t *src = h->localMatrix.a[transform->index];
|
||||
mat[0] = src[0];
|
||||
mat[1] = src[1];
|
||||
mat[2] = src[2];
|
||||
mat[3] = src[3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
void
|
||||
Transform_GetLocalInverse (const transform_t *transform, mat4f_t mat)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
vec4f_t *src = h->localInverse.a[transform->index];
|
||||
mat[0] = src[0];
|
||||
mat[1] = src[1];
|
||||
mat[2] = src[2];
|
||||
mat[3] = src[3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
void
|
||||
Transform_GetWorldMatrix (const transform_t *transform, mat4f_t mat)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
vec4f_t *src = h->worldMatrix.a[transform->index];
|
||||
mat[0] = src[0];
|
||||
mat[1] = src[1];
|
||||
mat[2] = src[2];
|
||||
mat[3] = src[3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
const vec4f_t *
|
||||
Transform_GetWorldMatrixPtr (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldMatrix.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
void
|
||||
Transform_GetWorldInverse (const transform_t *transform, mat4f_t mat)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
vec4f_t *src = h->worldInverse.a[transform->index];
|
||||
mat[0] = src[0];
|
||||
mat[1] = src[1];
|
||||
mat[2] = src[2];
|
||||
mat[3] = src[3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetLocalPosition (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->localMatrix.a[transform->index][3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetLocalRotation (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->localRotation.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetLocalScale (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->localScale.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetWorldPosition (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldMatrix.a[transform->index][3];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetWorldRotation (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldRotation.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_GetWorldScale (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldScale.a[transform->index];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_Forward (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldMatrix.a[transform->index][0];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_Right (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return -h->worldMatrix.a[transform->index][1];
|
||||
}
|
||||
|
||||
XFORMINLINE
|
||||
vec4f_t
|
||||
Transform_Up (const transform_t *transform)
|
||||
{
|
||||
hierarchy_t *h = transform->hierarchy;
|
||||
return h->worldMatrix.a[transform->index][2];
|
||||
}
|
||||
|
||||
///@}
|
||||
|
||||
#endif//__QF_scene_transform_h
|
||||
|
|
|
@ -29,44 +29,30 @@
|
|||
#ifndef __QF_screen_h
|
||||
#define __QF_screen_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
struct transform_s;
|
||||
struct tex_s;
|
||||
|
||||
void SCR_Init_Cvars (void);
|
||||
void SCR_Init (void);
|
||||
|
||||
void SCR_DrawRam (void);
|
||||
void SCR_DrawTurtle (void);
|
||||
void SCR_DrawPause (void);
|
||||
|
||||
typedef void (*SCR_Func)(void);
|
||||
// scr_funcs is a null terminated array
|
||||
void SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs);
|
||||
void SCR_UpdateScreen (struct transform_s *camera, double realtime,
|
||||
SCR_Func *scr_funcs);
|
||||
void SCR_SetFOV (float fov);
|
||||
// control whether the 3d viewport is user-controlled or always fullscreen
|
||||
void SCR_SetFullscreen (qboolean fullscreen);
|
||||
void SCR_SetBottomMargin (int lines);
|
||||
|
||||
void SCR_SizeUp (void);
|
||||
void SCR_SizeDown (void);
|
||||
void SCR_BringDownConsole (void);
|
||||
void SCR_CalcRefdef (void);
|
||||
|
||||
void SCR_BeginLoadingPlaque (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
extern struct cvar_s *hud_fps, *hud_time, *r_timegraph, *r_zgraph;
|
||||
extern int scr_copytop;
|
||||
extern qboolean scr_skipupdate;
|
||||
|
||||
struct view_s;
|
||||
|
||||
int MipColor (int r, int g, int b);
|
||||
int SCR_ModalMessage (const char *text);
|
||||
|
||||
extern float scr_con_current;
|
||||
|
||||
extern int sb_lines;
|
||||
|
||||
extern qboolean scr_disabled_for_loading;
|
||||
extern qboolean scr_skipupdate;
|
||||
extern qboolean hudswap;
|
||||
|
||||
extern struct cvar_s *scr_fov;
|
||||
extern struct cvar_s *scr_viewsize;
|
||||
|
||||
// only the refresh window will be updated unless these variables are flagged
|
||||
|
||||
extern struct qpic_s *scr_ram;
|
||||
extern struct qpic_s *scr_turtle;
|
||||
|
||||
extern struct cvar_s *hud_fps, *hud_time;
|
||||
void R_TimeGraph (struct view_s *view);
|
||||
void R_ZGraph (struct view_s *view);
|
||||
|
||||
#endif//__QF_screen_h
|
||||
|
|
|
@ -159,9 +159,9 @@ mat4fquat (mat4f_t m, vec4f_t q)
|
|||
vec4f_t zq = q[2] * q;
|
||||
vec4f_t wq = q[3] * q;
|
||||
|
||||
static const vec4i_t shuff103 = { 1, 0, 3, 2 };
|
||||
static const vec4i_t shuff230 = { 2, 3, 0, 1 };
|
||||
static const vec4i_t shuff321 = { 3, 2, 1, 0 };
|
||||
#define shuff103(v) (vec4f_t) {v[1], v[0], v[3], v[2]}
|
||||
#define shuff230(v) (vec4f_t) {v[2], v[3], v[0], v[1]}
|
||||
#define shuff321(v) (vec4f_t) {v[3], v[2], v[1], v[0]}
|
||||
#define p (0)
|
||||
#define m (1u << 31)
|
||||
static const vec4i_t mpm = { m, p, m, 0 };
|
||||
|
@ -172,24 +172,24 @@ mat4fquat (mat4f_t m, vec4f_t q)
|
|||
#undef m
|
||||
{
|
||||
vec4f_t a = xq;
|
||||
vec4f_t b = _mm_xor_ps (__builtin_shuffle (yq, shuff103), (__m128) mpm);
|
||||
vec4f_t c = _mm_xor_ps (__builtin_shuffle (zq, shuff230), (__m128) pmm);
|
||||
vec4f_t d = _mm_xor_ps (__builtin_shuffle (wq, shuff321), (__m128) mmp);
|
||||
vec4f_t b = _mm_xor_ps (shuff103 (yq), (__m128) mpm);
|
||||
vec4f_t c = _mm_xor_ps (shuff230 (zq), (__m128) pmm);
|
||||
vec4f_t d = _mm_xor_ps (shuff321 (wq), (__m128) mmp);
|
||||
|
||||
m[0] = _mm_and_ps (a + b - c - d, (__m128) mask);
|
||||
}
|
||||
{
|
||||
vec4f_t a = _mm_xor_ps (__builtin_shuffle (xq, shuff103), (__m128) mpm);
|
||||
vec4f_t a = _mm_xor_ps (shuff103 (xq), (__m128) mpm);
|
||||
vec4f_t b = yq;
|
||||
vec4f_t c = _mm_xor_ps (__builtin_shuffle (zq, shuff321), (__m128) mmp);
|
||||
vec4f_t d = _mm_xor_ps (__builtin_shuffle (wq, shuff230), (__m128) pmm);
|
||||
vec4f_t c = _mm_xor_ps (shuff321 (zq), (__m128) mmp);
|
||||
vec4f_t d = _mm_xor_ps (shuff230 (wq), (__m128) pmm);
|
||||
m[1] = _mm_and_ps (b + c - a - d, (__m128) mask);
|
||||
}
|
||||
{
|
||||
vec4f_t a = _mm_xor_ps (__builtin_shuffle (xq, shuff230), (__m128) pmm);
|
||||
vec4f_t b = _mm_xor_ps (__builtin_shuffle (yq, shuff321), (__m128) mmp);
|
||||
vec4f_t a = _mm_xor_ps (shuff230 (xq), (__m128) pmm);
|
||||
vec4f_t b = _mm_xor_ps (shuff321 (yq), (__m128) mmp);
|
||||
vec4f_t c = zq;
|
||||
vec4f_t d = _mm_xor_ps (__builtin_shuffle (wq, shuff103), (__m128) mpm);
|
||||
vec4f_t d = _mm_xor_ps (shuff103 (wq), (__m128) mpm);
|
||||
m[2] = _mm_and_ps (a - b + c - d, (__m128) mask);
|
||||
}
|
||||
m[3] = (vec4f_t) { 0, 0, 0, 1 };
|
||||
|
|
|
@ -184,11 +184,9 @@ VISIBLE
|
|||
vec4d_t
|
||||
crossd (vec4d_t a, vec4d_t b)
|
||||
{
|
||||
static const vec4l_t A = {1, 2, 0, 3};
|
||||
vec4d_t c = a * __builtin_shuffle (b, A);
|
||||
vec4d_t d = __builtin_shuffle (a, A) * b;
|
||||
c = c - d;
|
||||
return __builtin_shuffle(c, A);
|
||||
vec4d_t c = a * (vec4d_t) {b[1], b[2], b[0], b[3]}
|
||||
- b * (vec4d_t) {a[1], a[2], a[0], a[3]};
|
||||
return (vec4d_t) {c[1], c[2], c[0], c[3]};
|
||||
}
|
||||
|
||||
#ifndef IMPLEMENT_VEC4D_Funcs
|
||||
|
@ -205,8 +203,7 @@ dotd (vec4d_t a, vec4d_t b)
|
|||
#else
|
||||
c = _mm256_hadd_pd (c, c);
|
||||
#endif
|
||||
static const vec4l_t A = {2, 3, 0, 1};
|
||||
c += __builtin_shuffle(c, A);
|
||||
c += (vec4d_t) {c[2], c[3], c[0], c[1]};
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,9 +197,9 @@ VISIBLE
|
|||
vec4f_t
|
||||
crossf (vec4f_t a, vec4f_t b)
|
||||
{
|
||||
static const vec4i_t A = {1, 2, 0, 3};
|
||||
vec4f_t c = a * __builtin_shuffle (b, A) - __builtin_shuffle (a, A) * b;
|
||||
return __builtin_shuffle(c, A);
|
||||
vec4f_t c = a * (vec4f_t) {b[1], b[2], b[0], b[3]}
|
||||
- b * (vec4f_t) {a[1], a[2], a[0], a[3]};
|
||||
return (vec4f_t) {c[1], c[2], c[0], c[3]};
|
||||
}
|
||||
|
||||
#ifndef IMPLEMENT_VEC4F_Funcs
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
*/
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
struct transform_s;
|
||||
|
||||
/**
|
||||
\ingroup sound
|
||||
|
@ -106,7 +109,7 @@ void S_Shutdown (void);
|
|||
\param vol absolute volume of the sound
|
||||
\param attenuation rate of volume dropoff vs distance
|
||||
*/
|
||||
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin,
|
||||
float vol, float attenuation);
|
||||
|
||||
/** Create a sound generated by the world.
|
||||
|
@ -115,8 +118,7 @@ void S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
|||
\param vol absolute volume of the sound
|
||||
\param attenuation rate of volume dropoff vs distance
|
||||
*/
|
||||
void S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
|
||||
float attenuation);
|
||||
void S_StaticSound (sfx_t *sfx, vec4f_t origin, float vol, float attenuation);
|
||||
/** Stop an entity's sound.
|
||||
\param entnum index of entity the sound is associated with.
|
||||
\param entchannel channel to silence
|
||||
|
@ -129,16 +131,15 @@ void S_StopAllSounds(void);
|
|||
|
||||
/** Update the sound engine with the client's position and orientation and
|
||||
render some sound.
|
||||
\param origin 3d coords of the client
|
||||
\param ear Transform for the position and orientation of the stereo
|
||||
sound pickup.
|
||||
\param v_forward 3d vector of the client's facing direction
|
||||
\param v_right 3d vector of the client's rightward direction
|
||||
\param v_up 3d vector of the client's upward direction
|
||||
\param ambient_sound_level NUM_AMBIENTS bytes indicating current ambient
|
||||
sound levels
|
||||
*/
|
||||
void S_Update (const vec3_t origin, const vec3_t v_forward,
|
||||
const vec3_t v_right, const vec3_t v_up,
|
||||
const byte *ambient_sound_level);
|
||||
void S_Update (struct transform_s *ear, const byte *ambient_sound_level);
|
||||
|
||||
/** Render some more sound without updating the client's position/orientation.
|
||||
*/
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
struct dstring_s;
|
||||
|
||||
extern struct cvar_s *sys_nostdout;
|
||||
extern struct cvar_s *sys_extrasleep;
|
||||
extern struct cvar_s *sys_dead_sleep;
|
||||
|
@ -166,6 +168,37 @@ int Sys_CreatePath (const char *path);
|
|||
*/
|
||||
char *Sys_ExpandSquiggle (const char *path);
|
||||
|
||||
/** Open a newly created file with a guaranteed unique name.
|
||||
|
||||
Uniqueness is guaranteed by adding a numeric sequence between the \a
|
||||
prefix and \a suffix, with a minium of \a mindigits numeric characters
|
||||
(with any required leading 0s to expand the number to \a mindigits).
|
||||
|
||||
The created file has read and write permissions as modified by the OS,
|
||||
and the handle can be bothe written and read.
|
||||
|
||||
\param name dstring into which the name will be generated. Any
|
||||
existing contents will be lost. If an error occurs,
|
||||
\a name will be set to the error string.
|
||||
\param prefix This includes the path to the file and any file name
|
||||
prefix. The numeric sequence will be appended directly
|
||||
to the prefix with no directory separator.
|
||||
\param suffix Optional tail to be appended after the numeric sequence,
|
||||
usually the file extension. A dot is not added
|
||||
automatically, it is up to the caller to supply one. NULL
|
||||
and an empty string are equivalent.
|
||||
\param mindigits The minimum number of digits to include in the
|
||||
generated file name. The sequence number will be padded
|
||||
with 0s in order to meet this menimum. Overflow will
|
||||
simply produce longer numeric sequence sub-strings.
|
||||
\return File handle to the newly created file, or a negative
|
||||
value if an error occured (the negative error code).
|
||||
Suitable for use with read, write, fdopen, Qdopen, etc.
|
||||
\note It is the caller's responsibility to close the file.
|
||||
*/
|
||||
int Sys_UniqueFile (struct dstring_s *name, const char *prefix,
|
||||
const char *suffix, int mindigits);
|
||||
|
||||
///@}
|
||||
|
||||
#endif//__QF_sys_h
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
typedef struct {
|
||||
qboolean initialized;
|
||||
qboolean is8bit;
|
||||
void *buffer; // invisible buffer
|
||||
short *zbuffer;
|
||||
void *surfcache;
|
||||
byte *gammatable; // 256
|
||||
const byte *basepal; // 256 * 3
|
||||
byte *palette; // 256 * 3
|
||||
|
@ -48,13 +45,10 @@ typedef struct {
|
|||
unsigned short *colormap16; // 256 * VID_GRADES size
|
||||
unsigned int *colormap32; // 256 * VID_GRADES size
|
||||
int fullbright; // index of first fullbright color
|
||||
int rowbytes; // may be > width if displayed in a window
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
int numpages;
|
||||
qboolean recalc_refdef; // if true, recalc vid-based stuff
|
||||
qboolean cshift_changed;
|
||||
quat_t cshift_color;
|
||||
struct view_s *conview;
|
||||
struct vid_internal_s *vid_internal;
|
||||
|
||||
|
|
|
@ -118,32 +118,23 @@
|
|||
|
||||
// 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_viewposition 112
|
||||
#define rd_viewrotation 128
|
||||
#define rd_ambientlight 144
|
||||
#defin rd_fov_x 148
|
||||
#defin rd_fov_y 152
|
||||
#define rd_size 156 // sizeof (refdef_t)
|
||||
#define rd_fvrectx_adj 0
|
||||
#define rd_fvrecty_adj 4
|
||||
#define rd_fvrectright_adj 8
|
||||
#define rd_fvrectbottom_adj 12
|
||||
#define rd_aliasvrectleft 16
|
||||
#define rd_aliasvrecttop 20
|
||||
#define rd_aliasvrectright 24
|
||||
#define rd_aliasvrectbottom 28
|
||||
#define rd_vrectright 32
|
||||
#define rd_vrectbottom 36
|
||||
#define rd_vrectx_adj_shift20 40
|
||||
#define rd_vrectright_adj_shift20 44
|
||||
#define rd_fvrectx 48
|
||||
#define rd_fvrecty 52
|
||||
#define rd_fvrectright 56
|
||||
#define rd_fvrectbottom 60
|
||||
#define rd_size 64 // sizeof (refdef_t) FIXME make true
|
||||
|
||||
// mtriangle_t structure
|
||||
// !!! if this is changed, it must be changed in model.h too !!!
|
||||
|
|
49
include/client/chase.h
Normal file
49
include/client/chase.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
chase.h
|
||||
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __client_chase_h
|
||||
#define __client_chase_h
|
||||
|
||||
#include "QF/math/vector.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
|
||||
typedef struct chasestate_s {
|
||||
struct model_s *worldmodel;
|
||||
struct viewstate_s *viewstate;
|
||||
vec4f_t camera_origin;
|
||||
vec4f_t player_origin;
|
||||
vec3_t camera_angles;
|
||||
vec3_t player_angles;
|
||||
} chasestate_t;
|
||||
|
||||
extern struct cvar_s *chase_active;
|
||||
|
||||
void Chase_Init_Cvars (void);
|
||||
void Chase_Reset (void);
|
||||
void Chase_Update (chasestate_t *cs);
|
||||
|
||||
#endif // __client_chase_h
|
|
@ -31,9 +31,16 @@
|
|||
#ifndef __client_entities_h
|
||||
#define __client_entities_h
|
||||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
typedef struct entitystateset_s DARRAY_TYPE (struct entity_state_s)
|
||||
entitystateset_t;
|
||||
extern entitystateset_t cl_static_entities;
|
||||
|
||||
// entity_state_t is the information conveyed from the server
|
||||
// in an update message
|
||||
typedef struct entity_state_s {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
chase.h
|
||||
hud.h
|
||||
|
||||
@description@
|
||||
Heads-up display
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -24,14 +25,11 @@
|
|||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifndef __client_hud_h_
|
||||
#define __client_hud_h_
|
||||
|
||||
#ifndef __chase_h
|
||||
#define __chase_h
|
||||
extern struct cvar_s *hud_sbar;
|
||||
extern struct cvar_s *hud_scoreboard_gravity;
|
||||
extern struct cvar_s *hud_swap;
|
||||
|
||||
extern struct cvar_s *chase_active;
|
||||
|
||||
void Chase_Init_Cvars (void);
|
||||
void Chase_Reset (void);
|
||||
void Chase_Update (void);
|
||||
|
||||
#endif // __chase_h
|
||||
#endif // __client_hud_h_
|
|
@ -27,8 +27,56 @@
|
|||
#ifndef __client_input_h_
|
||||
#define __client_input_h_
|
||||
|
||||
void CL_Legacy_Init (void);
|
||||
#include "QF/simd/vec4f.h"
|
||||
|
||||
#include "QF/input.h"
|
||||
|
||||
struct cbuf_s;
|
||||
|
||||
extern struct cvar_s *cl_upspeed;
|
||||
extern struct cvar_s *cl_forwardspeed;
|
||||
extern struct cvar_s *cl_backspeed;
|
||||
extern struct cvar_s *cl_sidespeed;
|
||||
|
||||
extern struct cvar_s *cl_movespeedkey;
|
||||
|
||||
extern struct cvar_s *cl_yawspeed;
|
||||
extern struct cvar_s *cl_pitchspeed;
|
||||
|
||||
extern struct cvar_s *cl_anglespeedkey;
|
||||
|
||||
extern struct cvar_s *m_pitch;
|
||||
extern struct cvar_s *m_yaw;
|
||||
extern struct cvar_s *m_forward;
|
||||
extern struct cvar_s *m_side;
|
||||
|
||||
#define FORWARD 0
|
||||
#define SIDE 1
|
||||
#define UP 2
|
||||
|
||||
typedef struct movestate_s {
|
||||
vec4f_t move;
|
||||
vec4f_t angles;
|
||||
} movestate_t;
|
||||
|
||||
#define freelook (in_mlook.state & 1 || in_freelook->int_val)
|
||||
|
||||
struct viewstate_s;
|
||||
|
||||
void CL_OnFocusChange (void (*func) (int game));
|
||||
void CL_Input_BuildMove (float frametime, movestate_t *state,
|
||||
struct viewstate_s *vs);
|
||||
void CL_Input_Init (struct cbuf_s *cbuf);
|
||||
void CL_Input_Init_Cvars (void);
|
||||
void CL_Input_Activate (int in_game);
|
||||
|
||||
extern in_axis_t in_move_forward, in_move_side, in_move_up;
|
||||
extern in_axis_t in_move_pitch, in_move_yaw, in_move_roll;
|
||||
extern in_axis_t in_cam_forward, in_cam_side, in_cam_up;
|
||||
extern in_button_t in_left, in_right, in_forward, in_back;
|
||||
extern in_button_t in_lookup, in_lookdown, in_moveleft, in_moveright;
|
||||
extern in_button_t in_use, in_jump, in_attack;
|
||||
extern in_button_t in_up, in_down;
|
||||
extern in_button_t in_strafe, in_klook, in_speed, in_mlook;
|
||||
|
||||
#endif // __client_input_h_
|
||||
|
|
|
@ -47,6 +47,6 @@ int locs_nearest (vec4f_t loc) __attribute__((pure));
|
|||
void locs_reset (void);
|
||||
void locs_save (const char *filename, qboolean gz);
|
||||
void map_to_loc (const char *mapname, char *filename);
|
||||
void locs_draw (vec4f_t simorg);
|
||||
void locs_draw (double time, vec4f_t simorg);
|
||||
|
||||
#endif//__QF_locs_h
|
||||
|
|
|
@ -29,6 +29,25 @@
|
|||
|
||||
#include "QF/render.h"
|
||||
|
||||
typedef enum {
|
||||
pt_static,
|
||||
pt_grav,
|
||||
pt_slowgrav,
|
||||
pt_fire,
|
||||
pt_explode,
|
||||
pt_explode2,
|
||||
pt_blob,
|
||||
pt_blob2,
|
||||
pt_smoke,
|
||||
pt_smokecloud,
|
||||
pt_bloodcloud,
|
||||
pt_fadespark,
|
||||
pt_fadespark2,
|
||||
pt_fallfade,
|
||||
pt_fallfadespark,
|
||||
pt_flame
|
||||
} ptype_t;
|
||||
|
||||
typedef struct cl_particle_funcs_s {
|
||||
void (*RocketTrail) (vec4f_t start, vec4f_t end);
|
||||
void (*GrenadeTrail) (vec4f_t start, vec4f_t end);
|
||||
|
@ -70,6 +89,7 @@ extern float cl_frametime;
|
|||
extern float cl_realtime;
|
||||
|
||||
void CL_Particles_Init (void);
|
||||
void CL_ParticlesGravity (float gravity);
|
||||
|
||||
struct model_s;
|
||||
void CL_LoadPointFile (const struct model_s *model);
|
||||
|
|
|
@ -96,7 +96,6 @@ typedef enum TE_qwEffect {
|
|||
//FIXME find a better way to get this info from the parser
|
||||
typedef struct TEntContext_s {
|
||||
vec4f_t simorg;
|
||||
struct model_s *worldModel;
|
||||
int playerEntity;
|
||||
} TEntContext_t;
|
||||
|
||||
|
|
|
@ -26,39 +26,86 @@
|
|||
*/
|
||||
// view.h
|
||||
|
||||
#ifndef __client_view_h_
|
||||
#define __client_view_h_
|
||||
#ifndef __client_view_h
|
||||
#define __client_view_h
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
typedef struct {
|
||||
int destcolor[3];
|
||||
int percent; // 0-255
|
||||
double time;
|
||||
int initialpct;
|
||||
} cshift_t;
|
||||
|
||||
#define CSHIFT_CONTENTS 0
|
||||
#define CSHIFT_DAMAGE 1
|
||||
#define CSHIFT_BONUS 2
|
||||
#define CSHIFT_POWERUP 3
|
||||
#define NUM_CSHIFTS 4
|
||||
|
||||
#define INFO_CSHIFT_BONUS (1 << 0)
|
||||
#define INFO_CSHIFT_CONTENTS (1 << 1)
|
||||
#define INFO_CSHIFT_DAMAGE (1 << 2)
|
||||
#define INFO_CSHIFT_POWERUP (1 << 3)
|
||||
|
||||
typedef struct viewstate_s {
|
||||
vec4f_t player_origin;
|
||||
vec3_t player_angles;
|
||||
int chase;
|
||||
vec4f_t movecmd;
|
||||
vec4f_t velocity;
|
||||
vec4f_t origin;
|
||||
vec3_t angles;
|
||||
vec4f_t punchangle;
|
||||
float frametime;
|
||||
struct transform_s *camera_transform;
|
||||
double time;
|
||||
float height;
|
||||
int weaponframe;
|
||||
int onground; // -1 when in air
|
||||
int active:1;
|
||||
int drift_enabled:1;
|
||||
int voffs_enabled:1;
|
||||
int bob_enabled:1;
|
||||
int intermission:1;
|
||||
int decay_punchangle:1;
|
||||
int force_cshifts; // bitfield of server enforced cshifts
|
||||
uint32_t flags;
|
||||
float frametime;
|
||||
vec4f_t punchangle;
|
||||
|
||||
int powerup_index;
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
quat_t cshift_color;
|
||||
|
||||
// pitch drifting vars
|
||||
float idealpitch;
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
|
||||
struct model_s *weapon_model;
|
||||
struct entity_s *weapon_entity;
|
||||
struct entity_s *player_entity;
|
||||
|
||||
struct chasestate_s *chasestate;
|
||||
} viewstate_t;
|
||||
|
||||
#define VF_DEAD 1
|
||||
#define VF_GIB 2
|
||||
|
||||
void V_Init (void);
|
||||
struct msg_s;
|
||||
|
||||
void V_Init (viewstate_t *vs);
|
||||
void V_Init_Cvars (void);
|
||||
void V_RenderView (void);
|
||||
void V_RenderView (viewstate_t *vs);
|
||||
float V_CalcRoll (const vec3_t angles, vec4f_t velocity);
|
||||
void V_StartPitchDrift (void);
|
||||
void V_StopPitchDrift (void);
|
||||
void V_StartPitchDrift (viewstate_t *vs);
|
||||
void V_StopPitchDrift (viewstate_t *vs);
|
||||
void V_SetContentsColor (viewstate_t *vs, int contents);
|
||||
void V_ParseDamage (struct msg_s *net_message, viewstate_t *vs);
|
||||
void V_PrepBlend (viewstate_t *vs);
|
||||
|
||||
void V_SetContentsColor (int contents);
|
||||
extern qboolean noclip_anglehack;
|
||||
|
||||
#endif // __client_view_h_
|
||||
#endif // __client_view_h
|
||||
|
|
70
include/client/world.h
Normal file
70
include/client/world.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
world.h
|
||||
|
||||
Client world scene management
|
||||
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2022/3/4
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __client_world_h
|
||||
#define __client_world_h
|
||||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
typedef struct modelset_s DARRAY_TYPE (struct model_s *) modelset_t;
|
||||
|
||||
typedef struct worldscene_s {
|
||||
struct scene_s *scene;
|
||||
struct plitem_s *edicts;
|
||||
struct plitem_s *worldspawn;
|
||||
struct model_s *worldmodel;
|
||||
modelset_t models;
|
||||
} worldscene_t;
|
||||
|
||||
extern worldscene_t cl_world;
|
||||
|
||||
struct msg_s;
|
||||
struct entity_state_s;
|
||||
|
||||
void CL_World_Init (void);
|
||||
|
||||
// PROTOCOL_FITZQUAKE -- flags for entity baseline messages
|
||||
#define B_LARGEMODEL (1<<0) // modelindex is short instead of byte
|
||||
#define B_LARGEFRAME (1<<1) // frame is short instead of byte
|
||||
#define B_ALPHA (1<<2) // 1 byte, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT
|
||||
void CL_ParseBaseline (struct msg_s *msg, struct entity_state_s *baseline,
|
||||
int version);
|
||||
/*
|
||||
Static entities are non-interactive world objects like torches
|
||||
*/
|
||||
void CL_ParseStatic (struct msg_s *msg, int version);
|
||||
void CL_MapCfg (const char *mapname);
|
||||
void CL_World_NewMap (const char *mapname, const char *skyname);
|
||||
|
||||
#endif//__client_world_h
|
|
@ -83,8 +83,7 @@ struct gl_ctx_s *X11_GL_Context (void);
|
|||
void X11_GL_Init_Cvars (void);
|
||||
|
||||
struct sw_ctx_s *X11_SW_Context (void);
|
||||
struct sw_ctx_s *X11_SW32_Context (void);
|
||||
void X11_SW_Init_Cvars (void); // sw and sw32 cvars shared
|
||||
void X11_SW_Init_Cvars (void);
|
||||
|
||||
struct vulkan_ctx_s *X11_Vulkan_Context (void);
|
||||
void X11_Vulkan_Init_Cvars (void);
|
||||
|
|
|
@ -101,7 +101,7 @@ typedef struct
|
|||
// if the driver wants to duplicate element [0] at
|
||||
// element [nump] to avoid dealing with wrapping
|
||||
mspriteframe_t *pspriteframe;
|
||||
vec3_t vup, vright, vpn; // in worldspace
|
||||
vec3_t vup, vright, vfwd; // in worldspace
|
||||
float nearzi;
|
||||
} spritedesc_t;
|
||||
|
||||
|
@ -140,28 +140,26 @@ extern int d_con_indirect; // if 0, Quake will draw console directly
|
|||
// draw console via D_DrawRect. Must be
|
||||
// defined by driver
|
||||
|
||||
extern vec3_t r_pright, r_pup, r_ppn;
|
||||
extern vec3_t r_pright, r_pup, r_ppn, r_porigin;
|
||||
|
||||
|
||||
void D_Aff8Patch (void *pcolormap);
|
||||
void D_Aff8Patch (const byte *pcolormap);
|
||||
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height);
|
||||
void D_DisableBackBufferAccess (void);
|
||||
void D_EndDirectRect (int x, int y, int width, int height);
|
||||
void D_PolysetDraw (void);
|
||||
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
|
||||
void D_PolysetSetEdgeTable (void);
|
||||
void D_DrawParticle (particle_t *pparticle);
|
||||
void D_DrawPoly (void);
|
||||
void D_DrawSprite (void);
|
||||
void D_DrawSprite (const vec3_t relvieworg);
|
||||
void D_DrawSurfaces (void);
|
||||
void D_DrawZPoint (void);
|
||||
void D_EnableBackBufferAccess (void);
|
||||
void D_Init (void);
|
||||
void D_Init_Cvars (void);
|
||||
void D_ViewChanged (void);
|
||||
void D_SetupFrame (void);
|
||||
void D_TurnZOn (void);
|
||||
void D_WarpScreen (void);
|
||||
void D_WarpScreen (framebuffer_t *src);
|
||||
|
||||
void D_FillRect (vrect_t *vrect, int color);
|
||||
void D_DrawRect (void);
|
||||
|
@ -182,7 +180,7 @@ extern byte *r_skysource;
|
|||
// !!! must be kept the same as in quakeasm.h !!!
|
||||
#define TRANSPARENT_COLOR 0xFF
|
||||
|
||||
extern void *acolormap; // FIXME: should go away
|
||||
extern const byte *acolormap; // FIXME: should go away
|
||||
|
||||
//=======================================================================//
|
||||
|
||||
|
@ -202,8 +200,8 @@ typedef struct
|
|||
} drawsurf_t;
|
||||
|
||||
extern drawsurf_t r_drawsurf;
|
||||
|
||||
void R_DrawSurface (void);
|
||||
struct transform_s;
|
||||
void R_DrawSurface (struct transform_s *transform);
|
||||
void R_GenTile (msurface_t *psurf, void *pdest);
|
||||
|
||||
// !!! if this is changed, it must be changed in d_iface.h too !!!
|
||||
|
@ -228,6 +226,4 @@ extern float r_skytime;
|
|||
|
||||
extern int c_surf;
|
||||
|
||||
extern byte *r_warpbuffer;
|
||||
|
||||
#endif // _D_IFACE_H
|
||||
|
|
|
@ -75,6 +75,8 @@ extern float d_sdivzstepu, d_tdivzstepu, d_zistepu;
|
|||
extern float d_sdivzstepv, d_tdivzstepv, d_zistepv;
|
||||
extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin;
|
||||
|
||||
extern float d_skyoffs;
|
||||
|
||||
extern fixed16_t sadjust, tadjust;
|
||||
extern fixed16_t bbextents, bbextentt;
|
||||
|
||||
|
@ -91,7 +93,9 @@ void D_DrawSkyScans (struct espan_s *pspan);
|
|||
|
||||
void R_ShowSubDiv (void);
|
||||
extern void (*prealspandrawer)(void);
|
||||
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
|
||||
struct entity_s;
|
||||
surfcache_t *D_CacheSurface (struct entity_s *ent,
|
||||
msurface_t *surface, int miplevel);
|
||||
|
||||
int D_MipLevelForScale (float scale) __attribute__((pure));
|
||||
|
||||
|
@ -100,8 +104,13 @@ void D_PolysetAff8Start (void);
|
|||
void D_PolysetAff8End (void);
|
||||
#endif
|
||||
|
||||
extern short *d_pzbuffer;
|
||||
extern int d_zrowbytes, d_zwidth;
|
||||
extern byte *d_viewbuffer;
|
||||
extern int d_rowbytes;
|
||||
extern unsigned d_height;
|
||||
|
||||
extern short *d_zbuffer;
|
||||
extern int d_zrowbytes;
|
||||
extern unsigned d_zwidth;
|
||||
|
||||
extern int *d_pscantable;
|
||||
extern int d_scantable[];
|
||||
|
@ -110,8 +119,6 @@ extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
|
|||
|
||||
extern int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
|
||||
|
||||
extern byte *d_viewbuffer;
|
||||
|
||||
extern short *zspantable[];
|
||||
|
||||
extern int d_minmip;
|
||||
|
|
|
@ -120,6 +120,6 @@ void glsl_Skin_InitTranslations (void);
|
|||
void gl_Skin_SetupSkin (skin_t *skin, int cmap);
|
||||
void gl_Skin_ProcessTranslation (int cmap, const byte *translation);
|
||||
void gl_Skin_InitTranslations (void);
|
||||
int gl_Skin_Init_Textures (int base);
|
||||
void gl_Skin_Init_Textures (void);
|
||||
void gl_Skin_SetPlayerSkin (int width, int height, const byte *data);
|
||||
#endif// __mod_internal_h
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define TRANSPARENT_COLOR 255
|
||||
|
||||
.extern C(d_zistepu)
|
||||
.extern C(d_pzbuffer)
|
||||
.extern C(d_zbuffer)
|
||||
.extern C(d_zistepv)
|
||||
.extern C(d_zrowbytes)
|
||||
.extern C(d_ziorigin)
|
||||
|
@ -58,8 +58,6 @@
|
|||
.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)
|
||||
|
@ -71,24 +69,20 @@
|
|||
.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(r_colormap)
|
||||
.extern C(blocksize)
|
||||
.extern C(sourcesstep)
|
||||
.extern C(lightleft)
|
||||
.extern C(blockdivshift)
|
||||
.extern C(lightleftstep)
|
||||
.extern C(r_origin)
|
||||
.extern C(r_ppn)
|
||||
.extern C(r_pup)
|
||||
.extern C(r_pright)
|
||||
.extern C(r_porigin)
|
||||
.extern C(ycenter)
|
||||
.extern C(xcenter)
|
||||
.extern C(d_vrectbottom_particle)
|
||||
|
@ -99,7 +93,7 @@
|
|||
.extern C(d_pix_min)
|
||||
.extern C(d_pix_max)
|
||||
.extern C(d_y_aspect_shift)
|
||||
.extern C(screenwidth)
|
||||
.extern C(d_rowbytes)
|
||||
.extern C(r_leftclipped)
|
||||
.extern C(r_leftenter)
|
||||
.extern C(r_rightclipped)
|
||||
|
@ -138,7 +132,7 @@
|
|||
.extern C(r_anumverts)
|
||||
.extern C(aliastransform)
|
||||
.extern C(r_avertexnormals)
|
||||
.extern C(r_plightvec)
|
||||
.extern C(r_lightvec)
|
||||
.extern C(r_ambientlight)
|
||||
.extern C(r_shadelight)
|
||||
.extern C(aliasxcenter)
|
||||
|
@ -147,7 +141,6 @@
|
|||
.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)
|
||||
|
@ -173,16 +166,12 @@
|
|||
.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)
|
||||
|
@ -190,11 +179,9 @@
|
|||
.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)
|
||||
|
@ -255,7 +242,7 @@
|
|||
|
||||
.extern C(vright)
|
||||
.extern C(vup)
|
||||
.extern C(vpn)
|
||||
.extern C(vfwd)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,12 +48,10 @@ extern struct cvar_s *gl_vector_light;
|
|||
extern struct cvar_s *r_aliasstats;
|
||||
extern struct cvar_s *r_aliastransadj;
|
||||
extern struct cvar_s *r_aliastransbase;
|
||||
extern struct cvar_s *r_ambient;
|
||||
extern struct cvar_s *r_clearcolor;
|
||||
extern struct cvar_s *r_dlight_lightmap;
|
||||
extern struct cvar_s *r_drawentities;
|
||||
extern struct cvar_s *r_drawexplosions;
|
||||
extern struct cvar_s *r_drawflat;
|
||||
extern struct cvar_s *r_drawviewmodel;
|
||||
extern struct cvar_s *r_dspeeds;
|
||||
extern struct cvar_s *r_dynamic;
|
||||
|
|
|
@ -53,7 +53,6 @@ void R_InitBubble (void);
|
|||
|
||||
void R_InitParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_DrawParticles (void);
|
||||
struct cvar_s;
|
||||
void R_MaxParticlesCheck (struct cvar_s *r_particles,
|
||||
struct cvar_s *r_particles_max);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_local.h"
|
||||
#include "r_screen.h"
|
||||
#include "r_shared.h"
|
||||
|
||||
extern viddef_t vid; // global video state
|
||||
|
@ -15,7 +14,6 @@ extern vid_render_data_t vid_render_data;
|
|||
extern vid_render_funcs_t gl_vid_render_funcs;
|
||||
extern vid_render_funcs_t glsl_vid_render_funcs;
|
||||
extern vid_render_funcs_t sw_vid_render_funcs;
|
||||
extern vid_render_funcs_t sw32_vid_render_funcs;
|
||||
extern vid_render_funcs_t vulkan_vid_render_funcs;
|
||||
extern vid_render_funcs_t *vid_render_funcs;
|
||||
|
||||
|
@ -27,24 +25,10 @@ extern int r_viewsize;
|
|||
|
||||
void R_LineGraph (int x, int y, int *h_vals, int count, int height);
|
||||
|
||||
void Fog_Update (float density, float red, float green, float blue,
|
||||
float time);
|
||||
struct plitem_s;
|
||||
void Fog_ParseWorldspawn (struct plitem_s *worldspawn);
|
||||
|
||||
void Fog_GetColor (quat_t fogcolor);
|
||||
float Fog_GetDensity (void) __attribute__((pure));
|
||||
void Fog_SetupFrame (void);
|
||||
void Fog_EnableGFog (void);
|
||||
void Fog_DisableGFog (void);
|
||||
void Fog_StartAdditive (void);
|
||||
void Fog_StopAdditive (void);
|
||||
void Fog_Init (void);
|
||||
|
||||
void gl_R_Init (void);
|
||||
void glsl_R_Init (void);
|
||||
void sw_R_Init (void);
|
||||
void sw32_R_Init (void);
|
||||
void R_RenderFrame (SCR_Func *scr_funcs);
|
||||
void R_Init_Cvars (void);
|
||||
void R_InitEfrags (void);
|
||||
|
@ -59,12 +43,8 @@ extern struct psystem_s r_psystem;
|
|||
struct psystem_s *gl_ParticleSystem (void);
|
||||
struct psystem_s *glsl_ParticleSystem (void);
|
||||
struct psystem_s *sw_ParticleSystem (void);
|
||||
struct psystem_s *sw32_ParticleSystem (void);
|
||||
void R_RunParticles (float dT);
|
||||
|
||||
void R_AddEfrags (mod_brush_t *, entity_t *ent);
|
||||
void R_RemoveEfrags (entity_t *ent);
|
||||
|
||||
void R_NewMap (model_t *worldmodel, model_t **models, int num_models);
|
||||
|
||||
// LordHavoc: relative bmodel lighting
|
||||
|
@ -72,37 +52,47 @@ void R_PushDlights (const vec3_t entorigin);
|
|||
void R_DrawWaterSurfaces (void);
|
||||
|
||||
void *D_SurfaceCacheAddress (void) __attribute__((pure));
|
||||
int D_SurfaceCacheForRes (void *data, int width, int height);
|
||||
int D_SurfaceCacheForRes (int width, int height);
|
||||
void D_FlushCaches (void *data);
|
||||
void D_DeleteSurfaceCache (void);
|
||||
void D_InitCaches (void *data, void *buffer, int size);
|
||||
void D_InitCaches (void *buffer, int size);
|
||||
void R_SetVrect (const vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
|
||||
|
||||
void R_LoadSkys (const char *);
|
||||
|
||||
void R_ClearEfrags (void);
|
||||
void R_ClearEnts (void);
|
||||
void R_EnqueueEntity (struct entity_s *ent);
|
||||
entity_t *R_AllocEntity (void);
|
||||
void R_FreeAllEntities (void);
|
||||
|
||||
void R_FindNearLights (const vec3_t pos, int count, dlight_t **lights);
|
||||
void R_FindNearLights (vec4f_t pos, int count, dlight_t **lights);
|
||||
dlight_t *R_AllocDlight (int key);
|
||||
void R_DecayLights (double frametime);
|
||||
void R_ClearDlights (void);
|
||||
|
||||
int R_InitGraphTextures (int base);
|
||||
|
||||
void R_DrawAliasModel (entity_t *e);
|
||||
struct entity_s;
|
||||
struct animation_s;
|
||||
void R_DrawAliasModel (struct entity_s *e);
|
||||
|
||||
void R_MarkLeaves (void);
|
||||
|
||||
void GL_SetPalette (void *data, const byte *palette);
|
||||
void GLSL_SetPalette (void *data, const byte *palette);
|
||||
|
||||
int R_BillboardFrame (entity_t *ent, int orientation, const vec3_t cameravec,
|
||||
vec3_t bbup, vec3_t bbright, vec3_t bbpn);
|
||||
int R_BillboardFrame (struct entity_s *ent, int orientation,
|
||||
vec4f_t cameravec,
|
||||
vec4f_t *bbup, vec4f_t *bbright, vec4f_t *bbfwd);
|
||||
mspriteframe_t *R_GetSpriteFrame (const msprite_t *sprite,
|
||||
const animation_t *animation);
|
||||
const struct animation_s *animation);
|
||||
|
||||
// These correspond to the standard box sides for OpenGL cube maps but with
|
||||
// TOP and BOTTOM swapped due to lelt/right handed systems (quake/gl are right,
|
||||
// cube maps are left)
|
||||
#define BOX_FRONT 4
|
||||
#define BOX_RIGHT 0
|
||||
#define BOX_BEHIND 5
|
||||
#define BOX_LEFT 1
|
||||
#define BOX_TOP 3
|
||||
#define BOX_BOTTOM 2
|
||||
void R_RenderFisheye (framebuffer_t *cube);
|
||||
|
||||
#endif//__r_internal_h
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
// viewmodel lighting =======================================================
|
||||
|
||||
typedef struct {
|
||||
int ambientlight;
|
||||
int shadelight;
|
||||
float *plightvec;
|
||||
int ambientlight;
|
||||
int shadelight;
|
||||
vec3_t lightvec;
|
||||
} alight_t;
|
||||
|
||||
// clipped bmodel edges =====================================================
|
||||
|
@ -112,13 +112,14 @@ extern clipplane_t view_clipplanes[4];
|
|||
//=============================================================================
|
||||
|
||||
void R_RenderWorld (void);
|
||||
struct entqueue_s;
|
||||
void R_DrawEntitiesOnList (struct entqueue_s *queue);
|
||||
|
||||
//=============================================================================
|
||||
|
||||
extern plane_t screenedge[4];
|
||||
|
||||
extern vec3_t r_origin;
|
||||
extern vec3_t r_entorigin;
|
||||
extern vec4f_t r_entorigin;
|
||||
|
||||
extern int r_visframecount;
|
||||
|
||||
|
@ -140,40 +141,44 @@ extern vec3_t r_worldmodelorg;
|
|||
extern mat4f_t glsl_projection;
|
||||
extern mat4f_t glsl_view;
|
||||
|
||||
void R_SetFrustum (void);
|
||||
union refframe_s;
|
||||
void R_SetFrustum (plane_t *frustum, const union refframe_s *frame,
|
||||
float fov_x, float fov_y);
|
||||
|
||||
struct entity_s;
|
||||
|
||||
void R_SpriteBegin (void);
|
||||
void R_SpriteEnd (void);
|
||||
void R_DrawSprite (void);
|
||||
void R_RenderFace (msurface_t *fa, int clipflags);
|
||||
void R_RenderPoly (msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformPlane (plane_t *p, float *normal, float *dist);
|
||||
void R_DrawSprite (struct entity_s *ent);
|
||||
void R_RenderFace (struct entity_s *ent, msurface_t *fa, int clipflags);
|
||||
void R_RenderPoly (struct entity_s *ent, msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace (struct entity_s *ent, bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformFrustum (void);
|
||||
void R_SetSkyFrame (void);
|
||||
void R_DrawSurfaceBlock (void);
|
||||
texture_t *R_TextureAnimation (const entity_t *entity, msurface_t *surf) __attribute__((pure));
|
||||
texture_t *R_TextureAnimation (const struct entity_s *entity, msurface_t *surf) __attribute__((pure));
|
||||
|
||||
void R_GenSkyTile (void *pdest);
|
||||
void R_SurfPatch (void);
|
||||
void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags);
|
||||
void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel);
|
||||
void R_DrawSubmodelPolygons (struct entity_s *ent, model_t *pmodel, int clipflags, struct mnode_s *topnode);
|
||||
void R_DrawSolidClippedSubmodelPolygons (struct entity_s *ent, model_t *pmodel, struct mnode_s *topnode);
|
||||
|
||||
void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel);
|
||||
surf_t *R_GetSurf (void);
|
||||
void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av);
|
||||
void R_AliasDrawModel (alight_t *plighting);
|
||||
void R_IQMDrawModel (alight_t *plighting);
|
||||
maliasskindesc_t *R_AliasGetSkindesc (animation_t *animation, int skinnum, aliashdr_t *hdr);
|
||||
maliasframedesc_t *R_AliasGetFramedesc (animation_t *animation, aliashdr_t *hdr);
|
||||
float R_AliasGetLerpedFrames (animation_t *animation, aliashdr_t *hdr);
|
||||
float R_IQMGetLerpedFrames (entity_t *ent, iqm_t *hdr);
|
||||
void R_AliasDrawModel (struct entity_s *ent, alight_t *plighting);
|
||||
void R_IQMDrawModel (struct entity_s *ent, alight_t *plighting);
|
||||
struct animation_s;
|
||||
maliasskindesc_t *R_AliasGetSkindesc (struct animation_s *animation, int skinnum, aliashdr_t *hdr);
|
||||
maliasframedesc_t *R_AliasGetFramedesc (struct animation_s *animation, aliashdr_t *hdr);
|
||||
float R_AliasGetLerpedFrames (struct animation_s *animation, aliashdr_t *hdr);
|
||||
float R_IQMGetLerpedFrames (struct entity_s *ent, iqm_t *hdr);
|
||||
iqmframe_t *R_IQMBlendFrames (const iqm_t *iqm, int frame1, int frame2,
|
||||
float blend, int extra);
|
||||
iqmframe_t *R_IQMBlendPalette (const iqm_t *iqm, int frame1, int frame2,
|
||||
float blend, int extra,
|
||||
iqmblend_t *blend_palette, int palette_size);
|
||||
float R_EntityBlend (animation_t *animation, int pose, float interval);
|
||||
float R_EntityBlend (struct animation_s *animation, int pose, float interval);
|
||||
void R_BeginEdgeFrame (void);
|
||||
void R_ScanEdges (void);
|
||||
void D_DrawSurfaces (void);
|
||||
|
@ -185,12 +190,15 @@ struct vulkan_ctx_s;
|
|||
void R_ClearTextures (void);
|
||||
void R_InitSurfaceChains (mod_brush_t *brush);
|
||||
|
||||
extern const byte *r_colormap;
|
||||
void R_SetColormap (const byte *cmap);
|
||||
extern void R_Surf8Start (void);
|
||||
extern void R_Surf8End (void);
|
||||
extern void R_EdgeCodeStart (void);
|
||||
extern void R_EdgeCodeEnd (void);
|
||||
|
||||
extern void R_RotateBmodel (void);
|
||||
struct transform_s;
|
||||
extern void R_RotateBmodel (struct transform_s *transform);
|
||||
|
||||
extern int c_faceclip;
|
||||
extern int r_polycount;
|
||||
|
@ -224,7 +232,7 @@ typedef struct btofpoly_s {
|
|||
extern int numbtofpolys;
|
||||
|
||||
void R_InitTurb (void);
|
||||
void R_ZDrawSubmodelPolys (model_t *clmodel);
|
||||
void R_ZDrawSubmodelPolys (struct entity_s *ent, model_t *clmodel);
|
||||
|
||||
// Alias models ===========================================
|
||||
|
||||
|
@ -236,10 +244,10 @@ extern float leftclip, topclip, rightclip, bottomclip;
|
|||
extern int r_acliptype;
|
||||
extern finalvert_t *pfinalverts;
|
||||
extern auxvert_t *pauxverts;
|
||||
extern float ziscale, sw32_ziscale;
|
||||
extern float ziscale;
|
||||
extern float aliastransform[3][4];
|
||||
|
||||
qboolean R_AliasCheckBBox (void);
|
||||
qboolean R_AliasCheckBBox (struct entity_s *ent);
|
||||
|
||||
// turbulence stuff =======================================
|
||||
|
||||
|
@ -249,7 +257,8 @@ qboolean R_AliasCheckBBox (void);
|
|||
|
||||
// particle stuff =========================================
|
||||
|
||||
void R_DrawParticles (void);
|
||||
struct psystem_s;
|
||||
void R_DrawParticles (struct psystem_s *psystem);
|
||||
void R_InitParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_ReadPointFile_f (void);
|
||||
|
@ -266,8 +275,6 @@ extern edge_t *r_edges, *edge_p, *edge_max;
|
|||
extern edge_t *newedges[MAXHEIGHT];
|
||||
extern edge_t *removeedges[MAXHEIGHT];
|
||||
|
||||
extern int screenwidth;
|
||||
|
||||
extern int r_bmodelactive;
|
||||
extern vrect_t *pconupdate;
|
||||
|
||||
|
@ -282,29 +289,25 @@ extern int r_maxvalidedgeoffset;
|
|||
|
||||
void R_AliasClipTriangle (mtriangle_t *ptri);
|
||||
|
||||
extern float r_time1;
|
||||
extern double r_time1;
|
||||
extern int r_frustum_indexes[4*6];
|
||||
extern int r_maxsurfsseen, r_maxedgesseen;
|
||||
extern qboolean r_dowarpold, r_viewchanged;
|
||||
|
||||
extern mleaf_t *r_viewleaf;
|
||||
|
||||
extern int r_clipflags;
|
||||
extern int r_dlightframecount;
|
||||
|
||||
extern struct entity_s *r_ent_queue;
|
||||
extern struct entqueue_s *r_ent_queue;
|
||||
struct dlight_s;
|
||||
|
||||
extern vec3_t lightspot;
|
||||
|
||||
void R_StoreEfrags (const efrag_t *ppefrag);
|
||||
void R_TimeRefresh_f (void);
|
||||
void R_TimeGraph (void);
|
||||
void R_ZGraph (void);
|
||||
void R_PrintAliasStats (void);
|
||||
void R_PrintTimes (void);
|
||||
void R_AnimateLight (void);
|
||||
int R_LightPoint (mod_brush_t *brush, const vec3_t p);
|
||||
int R_LightPoint (mod_brush_t *brush, vec4f_t p);
|
||||
void R_SetupFrame (void);
|
||||
void R_cshift_f (void);
|
||||
void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1);
|
||||
|
@ -330,7 +333,6 @@ void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1,
|
|||
finalvert_t *out);
|
||||
void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out);
|
||||
|
||||
void R_AliasSetUpTransform (int trivial_accept);
|
||||
void R_AliasTransformVector (vec3_t in, vec3_t out);
|
||||
void R_AliasTransformFinalVert (finalvert_t *fv, trivertx_t *pverts,
|
||||
stvert_t *pstverts);
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
r_screen.h
|
||||
|
||||
shared screen declarations
|
||||
|
||||
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2002/12/11
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __r_screen_h
|
||||
#define __r_screen_h
|
||||
|
||||
#include "QF/screen.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
void SCR_DrawRam (void);
|
||||
void SCR_DrawFPS (void);
|
||||
void SCR_DrawTime (void);
|
||||
void SCR_DrawTurtle (void);
|
||||
void SCR_DrawPause (void);
|
||||
struct tex_s *SCR_CaptureBGR (void);
|
||||
struct tex_s *SCR_ScreenShot (unsigned width, unsigned height);
|
||||
void SCR_DrawStringToSnap (const char *s, struct tex_s *tex, int x, int y);
|
||||
|
||||
|
||||
extern int scr_copytop;
|
||||
|
||||
extern float scr_con_current;
|
||||
extern float scr_conlines; // lines of console to display
|
||||
|
||||
extern int oldscreensize;
|
||||
extern int oldsbar;
|
||||
|
||||
extern qboolean scr_initialized; // ready to draw
|
||||
|
||||
extern struct qpic_s *scr_ram;
|
||||
extern struct qpic_s *scr_net;
|
||||
extern struct qpic_s *scr_turtle;
|
||||
|
||||
extern int clearconsole;
|
||||
extern int clearnotify;
|
||||
|
||||
extern vrect_t *pconupdate;
|
||||
|
||||
extern qboolean scr_skipupdate;
|
||||
|
||||
void SCR_SetFOV (float fov);
|
||||
void SCR_SetUpToDrawConsole (void);
|
||||
void SCR_ScreenShot_f (void);
|
||||
|
||||
#endif//__r_screen_h
|
|
@ -54,7 +54,6 @@ extern void R_DrawLine (polyvert_t *polyvert0, polyvert_t *polyvert1);
|
|||
|
||||
extern int cachewidth;
|
||||
extern byte *cacheblock;
|
||||
extern int screenwidth;
|
||||
extern int r_init;
|
||||
|
||||
extern float pixelAspect;
|
||||
|
@ -70,9 +69,9 @@ extern byte color_white[4];
|
|||
extern byte color_black[4];
|
||||
|
||||
extern vec3_t vup, base_vup;
|
||||
extern vec3_t vpn, base_vpn;
|
||||
extern vec3_t vfwd, base_vfwd;
|
||||
extern vec3_t vright, base_vright;
|
||||
extern struct entity_s *currententity;
|
||||
extern float r_viewmatrix[3][4];
|
||||
|
||||
#define NUMSTACKEDGES 2400 //2000
|
||||
#define MINEDGES NUMSTACKEDGES
|
||||
|
@ -105,7 +104,7 @@ typedef struct surf_s {
|
|||
qboolean insubmodel;
|
||||
float d_ziorigin, d_zistepu, d_zistepv;
|
||||
|
||||
int pad[2]; // to 64 bytes
|
||||
int pad[2]; // to 64 bytes (FIXME not for 64-bit)
|
||||
} surf_t;
|
||||
|
||||
extern surf_t *surfaces, *surface_p, *surf_max;
|
||||
|
@ -137,9 +136,6 @@ extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
|
|||
extern int r_skymade;
|
||||
extern void R_MakeSky (void);
|
||||
|
||||
extern int gl_solidskytexture;
|
||||
extern int gl_alphaskytexture;
|
||||
|
||||
// flags in finalvert_t.flags
|
||||
#define ALIAS_LEFT_CLIP 0x0001
|
||||
#define ALIAS_TOP_CLIP 0x0002
|
||||
|
|
|
@ -62,5 +62,6 @@ struct plitem_s *Plist_GetItem (struct progs_s *pr, int handle);
|
|||
|
||||
void RUA_Input_Init (struct progs_s *pr, int secure);
|
||||
void RUA_Mersenne_Init (struct progs_s *pr, int secure);
|
||||
void RUA_Scene_Init (struct progs_s *pr, int secure);
|
||||
|
||||
#endif//__rua_internal_h
|
||||
|
|
16
include/scn_internal.h
Normal file
16
include/scn_internal.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef __scn_internal_h
|
||||
#define __scn_internal_h
|
||||
|
||||
#include "QF/progs.h"
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/hierarchy.h"
|
||||
#include "QF/scene/scene.h"
|
||||
#include "QF/scene/transform.h"
|
||||
|
||||
typedef struct scene_resources_s {
|
||||
PR_RESMAP (entity_t) entities;
|
||||
PR_RESMAP (hierarchy_t) hierarchies;
|
||||
PR_RESMAP (transform_t) transforms;
|
||||
} scene_resources_t;
|
||||
|
||||
#endif//__scn_internal_h
|
|
@ -44,6 +44,7 @@
|
|||
#include "QF/sound.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
struct transform_s;
|
||||
typedef struct portable_samplepair_s portable_samplepair_t;
|
||||
typedef struct snd_s snd_t;
|
||||
typedef struct wavinfo_s wavinfo_t;
|
||||
|
@ -363,8 +364,7 @@ void SND_AmbientOn (snd_t *snd);
|
|||
\param ambient_sound_level Pointer to 4 bytes indicating the levels at
|
||||
which to play the ambient sounds.
|
||||
*/
|
||||
void SND_SetListener (snd_t *snd, const vec3_t origin, const vec3_t v_forward,
|
||||
const vec3_t v_right, const vec3_t v_up,
|
||||
void SND_SetListener (snd_t *snd, struct transform_s *ear,
|
||||
const byte *ambient_sound_level);
|
||||
|
||||
/** Stop all sounds from playing.
|
||||
|
@ -392,7 +392,7 @@ void SND_Channels_Init (snd_t *snd);
|
|||
\param attenuation rate of volume dropoff vs distance
|
||||
*/
|
||||
void SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx,
|
||||
const vec3_t origin, float fvol, float attenuation);
|
||||
vec4f_t origin, float fvol, float attenuation);
|
||||
|
||||
/** Create a sound generated by the world.
|
||||
\param snd sound system state
|
||||
|
@ -401,7 +401,7 @@ void SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx,
|
|||
\param vol absolute volume of the sound
|
||||
\param attenuation rate of volume dropoff vs distance
|
||||
*/
|
||||
void SND_StaticSound (snd_t *snd, sfx_t *sfx, const vec3_t origin, float vol,
|
||||
void SND_StaticSound (snd_t *snd, sfx_t *sfx, vec4f_t origin, float vol,
|
||||
float attenuation);
|
||||
/** Stop an entity's sound.
|
||||
\param snd sound system state
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __vid_gl_h
|
||||
#define __vid_gl_h
|
||||
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
// GL_context is a pointer to opaque data
|
||||
typedef struct GL_context *GL_context;
|
||||
|
||||
|
@ -8,13 +10,34 @@ typedef struct gl_ctx_s {
|
|||
GL_context context;
|
||||
void (*load_gl) (void);
|
||||
void (*choose_visual) (struct gl_ctx_s *ctx);
|
||||
void (*create_context) (struct gl_ctx_s *ctx);
|
||||
void (*create_context) (struct gl_ctx_s *ctx, int core);
|
||||
void (*init_gl) (void);
|
||||
void *(*get_proc_address) (const char *name, qboolean crit);
|
||||
void (*end_rendering) (void);
|
||||
|
||||
mat4f_t projection;
|
||||
|
||||
int begun;
|
||||
double start_time;
|
||||
int brush_polys;
|
||||
int alias_polys;
|
||||
} gl_ctx_t;
|
||||
|
||||
typedef struct gl_framebuffer_s {
|
||||
unsigned handle;
|
||||
unsigned color;
|
||||
unsigned depth;
|
||||
} gl_framebuffer_t;
|
||||
|
||||
extern gl_ctx_t *gl_ctx;
|
||||
extern gl_ctx_t *glsl_ctx;
|
||||
|
||||
void gl_Fog_SetupFrame (void);
|
||||
void gl_Fog_EnableGFog (void);
|
||||
void gl_Fog_DisableGFog (void);
|
||||
void gl_Fog_StartAdditive (void);
|
||||
void gl_Fog_StopAdditive (void);
|
||||
|
||||
void gl_errors (const char *msg);
|
||||
|
||||
#endif//__vid_gl_h
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
#include "QF/plugin/vid_render.h"
|
||||
|
||||
typedef struct vid_internal_s {
|
||||
int (*surf_cache_size) (void *data, int width, int height);
|
||||
void (*flush_caches) (void *data);
|
||||
void (*init_caches) (void *data, void *cache, int size);
|
||||
void (*init_buffers) (void *data);
|
||||
void (*set_palette) (void *data, const byte *palette);
|
||||
void (*set_colormap) (void *data, const byte *colormap);
|
||||
|
||||
void (*choose_visual) (void *data);
|
||||
void (*create_context) (void *data);
|
||||
|
@ -18,7 +17,6 @@ typedef struct vid_internal_s {
|
|||
|
||||
struct gl_ctx_s *(*gl_context) (void);
|
||||
struct sw_ctx_s *(*sw_context) (void);
|
||||
struct sw_ctx_s *(*sw32_context) (void);
|
||||
struct vulkan_ctx_s *(*vulkan_context) (void);
|
||||
} vid_internal_t;
|
||||
|
||||
|
@ -26,17 +24,12 @@ extern struct cvar_s *vid_fullscreen;
|
|||
extern struct cvar_s *vid_system_gamma;
|
||||
extern struct cvar_s *vid_gamma;
|
||||
|
||||
extern unsigned short sw32_8to16table[256];
|
||||
|
||||
void VID_GetWindowSize (int def_w, int def_h);
|
||||
|
||||
void VID_InitGamma (const byte *);
|
||||
qboolean VID_SetGamma (double);
|
||||
void VID_UpdateGamma (struct cvar_s *);
|
||||
|
||||
void VID_LockBuffer (void);
|
||||
void VID_UnlockBuffer (void);
|
||||
void VID_InitBuffers (void);
|
||||
void VID_MakeColormaps (void);
|
||||
|
||||
#endif//__vid_internal_h
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
#ifndef __vid_sw_h
|
||||
#define __vid_sw_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
struct vrect_s;
|
||||
typedef struct sw_ctx_s {
|
||||
int pixbytes;
|
||||
void (*choose_visual) (struct sw_ctx_s *ctx);
|
||||
void (*create_context) (struct sw_ctx_s *ctx);
|
||||
void (*set_palette) (struct sw_ctx_s *ctx, const byte *palette);
|
||||
void (*update) (struct sw_ctx_s *ctx, struct vrect_s *rects);
|
||||
void (*choose_visual) (struct sw_ctx_s *ctx);
|
||||
void (*create_context) (struct sw_ctx_s *ctx);
|
||||
void (*set_palette) (struct sw_ctx_s *ctx, const byte *palette);
|
||||
void (*update) (struct sw_ctx_s *ctx, struct vrect_s *rects);
|
||||
struct framebuffer_s *framebuffer;
|
||||
} sw_ctx_t;
|
||||
|
||||
typedef struct sw_framebuffer_s {
|
||||
byte *color;
|
||||
short *depth;
|
||||
int rowbytes;
|
||||
} sw_framebuffer_t;
|
||||
|
||||
extern sw_ctx_t *sw_ctx;
|
||||
extern sw_ctx_t *sw32_ctx;
|
||||
|
||||
#endif//__vid_sw_h
|
||||
|
|
|
@ -79,6 +79,9 @@ typedef struct vulkan_ctx_s {
|
|||
|
||||
struct qfv_capture_s *capture;
|
||||
void (*capture_callback) (const byte *data, int width, int height);
|
||||
// make a queue?
|
||||
void *capture_complete;// really capfunc_t
|
||||
void *capture_complete_data;
|
||||
|
||||
struct qfv_tex_s *default_black;
|
||||
struct qfv_tex_s *default_white;
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "QF/scene/transform.h"
|
||||
|
||||
#include "snd_internal.h"
|
||||
|
||||
static channel_t *free_channels;
|
||||
|
@ -64,10 +66,10 @@ static sfx_t *ambient_sfx[NUM_AMBIENTS];
|
|||
|
||||
static vec_t sound_nominal_clip_dist = 1000.0;
|
||||
|
||||
static vec3_t listener_origin;
|
||||
static vec3_t listener_forward;
|
||||
static vec3_t listener_right;
|
||||
static vec3_t listener_up;
|
||||
static vec4f_t listener_origin;
|
||||
static vec4f_t listener_forward;
|
||||
static vec4f_t listener_right;
|
||||
static vec4f_t listener_up;
|
||||
|
||||
static cvar_t *snd_phasesep;
|
||||
static cvar_t *snd_volumesep;
|
||||
|
@ -539,17 +541,22 @@ s_combine_channel (channel_t *combine, channel_t *ch)
|
|||
}
|
||||
|
||||
void
|
||||
SND_SetListener (snd_t *snd, const vec3_t origin, const vec3_t forward,
|
||||
const vec3_t right, const vec3_t up,
|
||||
const byte *ambient_sound_level)
|
||||
SND_SetListener (snd_t *snd, transform_t *ear, const byte *ambient_sound_level)
|
||||
{
|
||||
int i, j;
|
||||
channel_t *combine, *ch;
|
||||
|
||||
VectorCopy (origin, listener_origin);
|
||||
VectorCopy (forward, listener_forward);
|
||||
VectorCopy (right, listener_right);
|
||||
VectorCopy (up, listener_up);
|
||||
if (ear) {
|
||||
listener_origin = Transform_GetWorldPosition (ear);
|
||||
listener_forward = Transform_Forward (ear);
|
||||
listener_right = Transform_Right (ear);
|
||||
listener_up = Transform_Up (ear);
|
||||
} else {
|
||||
listener_origin = (vec4f_t) {0, 0, 0, 1};
|
||||
listener_forward = (vec4f_t) {1, 0, 0, 0};
|
||||
listener_right = (vec4f_t) {0, -1, 0, 0};
|
||||
listener_up = (vec4f_t) {0, 0, 1, 0};
|
||||
}
|
||||
|
||||
// update general area ambient sound sources
|
||||
s_updateAmbientSounds (snd, ambient_sound_level);
|
||||
|
@ -607,7 +614,7 @@ snd_check_channels (snd_t *snd, channel_t *target_chan, const channel_t *check,
|
|||
|
||||
void
|
||||
SND_StartSound (snd_t *snd, int entnum, int entchannel, sfx_t *sfx,
|
||||
const vec3_t origin, float fvol, float attenuation)
|
||||
vec4f_t origin, float fvol, float attenuation)
|
||||
{
|
||||
int vol;
|
||||
int looped;
|
||||
|
@ -681,7 +688,7 @@ SND_StopSound (snd_t *snd, int entnum, int entchannel)
|
|||
}
|
||||
|
||||
void
|
||||
SND_StaticSound (snd_t *snd, sfx_t *sfx, const vec3_t origin, float vol,
|
||||
SND_StaticSound (snd_t *snd, sfx_t *sfx, vec4f_t origin, float vol,
|
||||
float attenuation)
|
||||
{
|
||||
channel_t *ss;
|
||||
|
@ -733,5 +740,5 @@ SND_LocalSound (snd_t *snd, const char *sound)
|
|||
}
|
||||
if (snd_render_data.viewentity)
|
||||
viewent = *snd_render_data.viewentity;
|
||||
SND_StartSound (snd, viewent, -1, sfx, vec3_origin, 1, 1);
|
||||
SND_StartSound (snd, viewent, -1, sfx, (vec4f_t) {0, 0, 0, 1}, 1, 1);
|
||||
}
|
||||
|
|
|
@ -211,8 +211,7 @@ s_update_ (void)
|
|||
Called once each time through the main loop
|
||||
*/
|
||||
static void
|
||||
s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||
const vec3_t up, const byte *ambient_sound_level)
|
||||
s_update (struct transform_s *ear, const byte *ambient_sound_level)
|
||||
{
|
||||
if (!sound_started || (snd_blocked > 0))
|
||||
return;
|
||||
|
@ -221,7 +220,7 @@ s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
|||
snd_output_funcs->on_update (&snd);
|
||||
}
|
||||
|
||||
SND_SetListener (&snd, origin, forward, right, up, ambient_sound_level);
|
||||
SND_SetListener (&snd, ear, ambient_sound_level);
|
||||
|
||||
if (snd_output_data->model == som_push) {
|
||||
// mix some sound
|
||||
|
@ -393,7 +392,7 @@ s_ambient_on (void)
|
|||
}
|
||||
|
||||
static void
|
||||
s_static_sound (sfx_t *sfx, const vec3_t origin, float vol,
|
||||
s_static_sound (sfx_t *sfx, vec4f_t origin, float vol,
|
||||
float attenuation)
|
||||
{
|
||||
if (!sound_started)
|
||||
|
@ -402,7 +401,7 @@ s_static_sound (sfx_t *sfx, const vec3_t origin, float vol,
|
|||
}
|
||||
|
||||
static void
|
||||
s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||
s_start_sound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin,
|
||||
float vol, float attenuation)
|
||||
{
|
||||
if (!sound_started)
|
||||
|
|
|
@ -135,14 +135,14 @@ S_AmbientOn (void)
|
|||
}
|
||||
|
||||
VISIBLE void
|
||||
S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, float attenuation)
|
||||
S_StaticSound (sfx_t *sfx, vec4f_t origin, float vol, float attenuation)
|
||||
{
|
||||
if (snd_render_funcs)
|
||||
snd_render_funcs->static_sound (sfx, origin, vol, attenuation);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||
S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec4f_t origin,
|
||||
float vol, float attenuation)
|
||||
{
|
||||
if (snd_render_funcs)
|
||||
|
@ -166,12 +166,10 @@ S_PrecacheSound (const char *sample)
|
|||
}
|
||||
|
||||
VISIBLE void
|
||||
S_Update (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right,
|
||||
const vec3_t v_up, const byte *ambient_sound_level)
|
||||
S_Update (struct transform_s *ear, const byte *ambient_sound_level)
|
||||
{
|
||||
if (snd_render_funcs)
|
||||
snd_render_funcs->update (origin, v_forward, v_right, v_up,
|
||||
ambient_sound_level);
|
||||
snd_render_funcs->update (ear, ambient_sound_level);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
|
|
|
@ -4,6 +4,7 @@ EXTRA_PROGRAMS += libs/audio/test/testsound
|
|||
|
||||
testaudio_libs= \
|
||||
libs/audio/libQFsound.la \
|
||||
libs/scene/libQFscene.la \
|
||||
libs/ruamoko/libQFruamoko.la \
|
||||
libs/util/libQFutil.la
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ main (int argc, const char *argv[])
|
|||
while (1) {
|
||||
Cbuf_Execute_Stack (testsound_cbuf);
|
||||
|
||||
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin, 0);
|
||||
S_Update (0, 0);
|
||||
usleep(20 * 1000);
|
||||
}
|
||||
Sys_Quit ();
|
||||
|
|
|
@ -3,11 +3,15 @@ noinst_LTLIBRARIES += libs/client/libQFclient.la
|
|||
libs_client_libQFclient_la_LDFLAGS= @STATIC@
|
||||
libs_client_libQFclient_la_LIBADD= libs/gamecode/libQFgamecode.la libs/util/libQFutil.la
|
||||
libs_client_libQFclient_la_SOURCES= \
|
||||
libs/client/cl_chase.c \
|
||||
libs/client/cl_effects.c \
|
||||
libs/client/cl_entities.c \
|
||||
libs/client/cl_input.c \
|
||||
libs/client/cl_particles.c \
|
||||
libs/client/cl_temp_entities.c \
|
||||
libs/client/cl_view.c \
|
||||
libs/client/cl_world.c \
|
||||
libs/client/hud.c \
|
||||
libs/client/locs.c \
|
||||
libs/client/old_keys.c
|
||||
|
||||
|
|
291
libs/client/cl_chase.c
Normal file
291
libs/client/cl_chase.c
Normal file
|
@ -0,0 +1,291 @@
|
|||
/*
|
||||
cl_chase.c
|
||||
|
||||
chase camera support
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h"
|
||||
#include "QF/scene/transform.h"
|
||||
|
||||
#include "world.h"
|
||||
|
||||
#include "client/chase.h"
|
||||
#include "client/input.h"
|
||||
#include "client/view.h"
|
||||
|
||||
|
||||
cvar_t *chase_back;
|
||||
cvar_t *chase_up;
|
||||
cvar_t *chase_right;
|
||||
cvar_t *chase_active;
|
||||
|
||||
|
||||
void
|
||||
Chase_Init_Cvars (void)
|
||||
{
|
||||
chase_back = Cvar_Get ("chase_back", "100", CVAR_NONE, NULL, "None");
|
||||
chase_up = Cvar_Get ("chase_up", "16", CVAR_NONE, NULL, "None");
|
||||
chase_right = Cvar_Get ("chase_right", "0", CVAR_NONE, NULL, "None");
|
||||
chase_active = Cvar_Get ("chase_active", "0", CVAR_NONE, NULL, "None");
|
||||
}
|
||||
|
||||
void
|
||||
Chase_Reset (void)
|
||||
{
|
||||
// for respawning and teleporting
|
||||
// start position 12 units behind head
|
||||
}
|
||||
|
||||
static inline vec4f_t
|
||||
TraceLine (chasestate_t *cs, vec4f_t start, vec4f_t end)
|
||||
{
|
||||
trace_t trace;
|
||||
|
||||
memset (&trace, 0, sizeof (trace));
|
||||
trace.fraction = 1;
|
||||
MOD_TraceLine (cs->worldmodel->brush.hulls, 0, (vec_t*)&start, (vec_t*)&end, &trace);//FIXME
|
||||
|
||||
return (vec4f_t) {trace.endpos[0], trace.endpos[1], trace.endpos[2], 1};
|
||||
}
|
||||
|
||||
static void
|
||||
check_for_walls (chasestate_t *cs, vec4f_t forward)
|
||||
{
|
||||
// check for walls between player and camera
|
||||
cs->camera_origin += 8 * forward;
|
||||
vec4f_t stop = TraceLine (cs, cs->player_origin, cs->camera_origin);
|
||||
if (magnitude3f (stop)[0] != 0) {
|
||||
cs->camera_origin = stop - forward;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
limit_distance (chasestate_t *cs)
|
||||
{
|
||||
// don't let camera get too far from player
|
||||
|
||||
vec4f_t dir = cs->camera_origin - cs->player_origin;
|
||||
vec4f_t forward = normalf (dir);
|
||||
|
||||
if (magnitudef (dir)[0] > chase_back->value) {
|
||||
cs->camera_origin = cs->player_origin + forward * chase_back->value;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_camera (chasestate_t *cs, viewstate_t *vs)
|
||||
{
|
||||
vec4f_t rotation;
|
||||
AngleQuat (cs->camera_angles, (vec_t*)&rotation);//FIXME
|
||||
Transform_SetWorldRotation (vs->camera_transform, rotation);
|
||||
Transform_SetWorldPosition (vs->camera_transform, cs->camera_origin);
|
||||
}
|
||||
|
||||
static void
|
||||
cam_controls (chasestate_t *cs, viewstate_t *vs)
|
||||
{
|
||||
// FIXME this doesn't actually control the camera, but rather makes the
|
||||
// player face the direction of motion. It probably should not access
|
||||
// movement input buttons and axes directly.
|
||||
// get basic movement from keyboard
|
||||
vec4f_t move = { };
|
||||
vec4f_t forward = { };
|
||||
vec4f_t right = { };
|
||||
vec4f_t up = { };
|
||||
vec4f_t dir = { };
|
||||
|
||||
if (in_strafe.state & 1) {
|
||||
move[SIDE] += cl_sidespeed->value * IN_ButtonState (&in_right);
|
||||
move[SIDE] -= cl_sidespeed->value * IN_ButtonState (&in_left);
|
||||
}
|
||||
move[SIDE] += cl_sidespeed->value * IN_ButtonState (&in_moveright);
|
||||
move[SIDE] -= cl_sidespeed->value * IN_ButtonState (&in_moveleft);
|
||||
|
||||
if (!(in_klook.state & 1)) {
|
||||
move[FORWARD] += cl_forwardspeed->value
|
||||
* IN_ButtonState (&in_forward);
|
||||
move[FORWARD] -= cl_backspeed->value * IN_ButtonState (&in_back);
|
||||
}
|
||||
if (in_speed.state & 1) {
|
||||
move *= cl_movespeedkey->value;
|
||||
}
|
||||
|
||||
// mouse and joystick controllers add to movement
|
||||
VectorSet (0, vs->player_angles[1] - cs->camera_angles[1], 0, dir);
|
||||
AngleVectors ((vec_t*)&dir, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up); //FIXME
|
||||
forward *= IN_UpdateAxis (&in_cam_forward) * m_forward->value;
|
||||
right *= IN_UpdateAxis (&in_cam_side) * m_side->value;
|
||||
dir = forward + right;
|
||||
move[FORWARD] += dir[0];
|
||||
move[SIDE] -= dir[1];
|
||||
|
||||
VectorSet (0, cs->camera_angles[1], 0, dir);
|
||||
AngleVectors ((vec_t*)&dir, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up); //FIXME
|
||||
|
||||
dir = forward * move[FORWARD] + right * move[SIDE];
|
||||
|
||||
if (dir[1] || dir[0]) {
|
||||
vs->player_angles[YAW] = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
}
|
||||
|
||||
//vs->player_angles[PITCH] = 0;
|
||||
VectorCopy (vs->player_angles, cs->player_angles);
|
||||
}
|
||||
|
||||
static void
|
||||
update_cam_frame (chasestate_t *cs, viewstate_t *vs)
|
||||
{
|
||||
vec3_t d;
|
||||
VectorSubtract (vs->player_angles, cs->player_angles, d);
|
||||
VectorAdd (cs->camera_angles, d, cs->camera_angles);
|
||||
// remember the new angle to calculate the difference next frame
|
||||
VectorCopy (vs->player_angles, cs->player_angles);
|
||||
}
|
||||
|
||||
static void
|
||||
chase_mode_1 (chasestate_t *cs)
|
||||
{
|
||||
// regular camera, faces same direction as player
|
||||
viewstate_t *vs = cs->viewstate;
|
||||
vec4f_t forward = {}, up = {}, right = {}, stop = {};
|
||||
|
||||
AngleVectors (vs->player_angles, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up);//FIXME
|
||||
VectorCopy (vs->player_angles, cs->camera_angles);
|
||||
|
||||
// calc exact destination
|
||||
cs->camera_origin = vs->player_origin
|
||||
- forward * chase_back->value - right * chase_right->value;
|
||||
// chase_up is world up
|
||||
cs->camera_origin[2] += chase_up->value;
|
||||
|
||||
// check for walls between player and camera
|
||||
stop = TraceLine (cs, vs->player_origin, cs->camera_origin);
|
||||
if (magnitude3f (stop)[0] != 0) {
|
||||
cs->camera_origin = stop + forward * 8;
|
||||
}
|
||||
|
||||
set_camera (cs, vs);
|
||||
}
|
||||
|
||||
static void
|
||||
chase_mode_2 (chasestate_t *cs)
|
||||
{
|
||||
viewstate_t *vs = cs->viewstate;
|
||||
vec4f_t forward = {}, up = {}, right = {}, dir = {};
|
||||
|
||||
// lazy camera, look toward player entity
|
||||
|
||||
update_cam_frame (cs, vs);
|
||||
|
||||
cs->camera_angles[PITCH] = bound (-60, cs->camera_angles[PITCH], 60);
|
||||
|
||||
// move camera, it's not enough to just change the angles because
|
||||
// the angles are automatically changed to look toward the player
|
||||
AngleVectors (cs->camera_angles, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up);//FIXME
|
||||
cs->camera_origin = cs->player_origin - chase_back->value * forward;
|
||||
|
||||
cs->player_origin = vs->player_origin;
|
||||
|
||||
// don't let camera get too low
|
||||
if (cs->camera_origin[2] < cs->player_origin[2] + chase_up->value) {
|
||||
cs->camera_origin[2] = cs->player_origin[2] + chase_up->value;
|
||||
}
|
||||
|
||||
limit_distance (cs);
|
||||
check_for_walls (cs, forward);
|
||||
|
||||
dir = vs->player_origin - cs->camera_origin;
|
||||
|
||||
if (dir[1] == 0 && dir[0] == 0) {
|
||||
// look straight up or down
|
||||
cs->camera_angles[YAW] = vs->player_angles[YAW];
|
||||
if (dir[2] > 0)
|
||||
cs->camera_angles[PITCH] = 90;
|
||||
else
|
||||
cs->camera_angles[PITCH] = -90;
|
||||
} else {
|
||||
float pitch, yaw, fwd;
|
||||
yaw = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
cs->camera_angles[YAW] = yaw;
|
||||
|
||||
fwd = sqrt (dir[0] * dir[0] + dir[1] * dir[1]);
|
||||
pitch = -(atan2 (dir[2], fwd) * 180 / M_PI);
|
||||
cs->camera_angles[PITCH] = pitch;
|
||||
}
|
||||
set_camera (cs, vs);
|
||||
cam_controls (cs, vs);
|
||||
}
|
||||
|
||||
static void
|
||||
chase_mode_3 (chasestate_t *cs)
|
||||
{
|
||||
viewstate_t *vs = cs->viewstate;
|
||||
vec4f_t forward = {}, up = {}, right = {};
|
||||
|
||||
// lazy camera, look toward player entity
|
||||
update_cam_frame (cs, vs);
|
||||
|
||||
// move camera, it's not enough to just change the angles because
|
||||
// the angles are automatically changed to look toward the player
|
||||
|
||||
cs->player_origin = vs->player_origin;
|
||||
AngleVectors (cs->camera_angles, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up);//FIXME
|
||||
cs->camera_origin = cs->player_origin - chase_back->value * forward;
|
||||
limit_distance (cs);
|
||||
check_for_walls (cs, forward);
|
||||
set_camera (cs, vs);
|
||||
cam_controls (cs, vs);
|
||||
}
|
||||
|
||||
void
|
||||
Chase_Update (chasestate_t *cs)
|
||||
{
|
||||
switch (chase_active->int_val) {
|
||||
case 1:
|
||||
chase_mode_1 (cs);
|
||||
return;
|
||||
case 2:
|
||||
chase_mode_2 (cs);
|
||||
return;
|
||||
case 3:
|
||||
chase_mode_3 (cs);
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@ CL_NewDlight (int key, vec4f_t org, int effects, byte glow_size,
|
|||
return;
|
||||
}
|
||||
|
||||
dl = r_funcs->R_AllocDlight (key);
|
||||
dl = R_AllocDlight (key);
|
||||
if (!dl)
|
||||
return;
|
||||
VectorCopy (org, dl->origin);
|
||||
|
@ -124,7 +124,7 @@ CL_ModelEffects (entity_t *ent, int num, int glow_color, double time)
|
|||
|
||||
// add automatic particle trails
|
||||
if (model->flags & EF_ROCKET) {
|
||||
dl = r_funcs->R_AllocDlight (num);
|
||||
dl = R_AllocDlight (num);
|
||||
if (dl) {
|
||||
VectorCopy (ent_origin, dl->origin);
|
||||
dl->radius = 200.0;
|
||||
|
@ -154,7 +154,7 @@ void
|
|||
CL_MuzzleFlash (vec4f_t position, vec4f_t fv, float zoffset, int num,
|
||||
double time)
|
||||
{
|
||||
dlight_t *dl = r_funcs->R_AllocDlight (num);
|
||||
dlight_t *dl = R_AllocDlight (num);
|
||||
if (dl) {
|
||||
position += 18 * fv;
|
||||
VectorCopy (position, dl->origin);
|
||||
|
|
|
@ -31,11 +31,18 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/render.h" //FIXME for entity_t
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h" //FIXME
|
||||
|
||||
#include "client/entities.h"
|
||||
#include "client/temp_entities.h"
|
||||
|
||||
entitystateset_t cl_static_entities = DARRAY_STATIC_INIT (32);
|
||||
|
||||
/* QW has a max of 512 entities and wants 64 frames of data per entity, plus
|
||||
the baseline data (512 * (64 + 1) = 33280), but NQ has a max of 32000
|
||||
|
@ -363,7 +370,7 @@ CL_TransformEntity (entity_t *ent, float scale, const vec3_t angles,
|
|||
// to everything else?
|
||||
ang[PITCH] = -ang[PITCH];
|
||||
}
|
||||
AngleQuat (ang, &rotation[0]);//FIXME
|
||||
AngleQuat (ang, (vec_t*)&rotation);//FIXME
|
||||
}
|
||||
Transform_SetLocalTransform (ent->transform, scalevec, rotation, position);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
cl_legacy.c
|
||||
cl_input.c
|
||||
|
||||
Client legacy commands
|
||||
Client input commands
|
||||
|
||||
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
||||
|
||||
|
@ -39,15 +39,247 @@
|
|||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/plist.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "QF/input/event.h"
|
||||
|
||||
#include "old_keys.h"
|
||||
|
||||
#include "client/chase.h"
|
||||
#include "client/input.h"
|
||||
#include "client/view.h"
|
||||
|
||||
int cl_game_context;
|
||||
int cl_demo_context;
|
||||
static int cl_event_id;
|
||||
|
||||
static struct LISTENER_SET_TYPE(int) cl_on_focus_change
|
||||
= LISTENER_SET_STATIC_INIT(4);
|
||||
|
||||
in_axis_t in_move_forward = {
|
||||
.mode = ina_set,
|
||||
.name = "move.forward",
|
||||
.description = "Move forward (negative) or backward (positive)",
|
||||
};
|
||||
in_axis_t in_move_side = {
|
||||
.mode = ina_set,
|
||||
.name = "move.side",
|
||||
.description = "Move right (positive) or left (negative)",
|
||||
};
|
||||
in_axis_t in_move_up = {
|
||||
.mode = ina_set,
|
||||
.name = "move.up",
|
||||
.description = "Move up (positive) or down (negative)",
|
||||
};
|
||||
|
||||
in_axis_t in_cam_forward = {
|
||||
.mode = ina_set,
|
||||
.name = "cam.forward",
|
||||
.description = "Move camera forward (negative) or backward (positive)",
|
||||
};
|
||||
in_axis_t in_cam_side = {
|
||||
.mode = ina_set,
|
||||
.name = "cam.side",
|
||||
.description = "Move camera right (positive) or left (negative)",
|
||||
};
|
||||
in_axis_t in_cam_up = {
|
||||
.mode = ina_set,
|
||||
.name = "cam.up",
|
||||
.description = "Move camera up (positive) or down (negative)",
|
||||
};
|
||||
|
||||
in_axis_t in_move_pitch = {
|
||||
.mode = ina_set,
|
||||
.name = "move.pitch",
|
||||
.description = "Pitch axis",
|
||||
};
|
||||
in_axis_t in_move_yaw = {
|
||||
.mode = ina_set,
|
||||
.name = "move.yaw",
|
||||
.description = "Yaw axis",
|
||||
};
|
||||
in_axis_t in_move_roll = {
|
||||
.mode = ina_set,
|
||||
.name = "move.roll",
|
||||
.description = "Roll axis",
|
||||
};
|
||||
|
||||
in_button_t in_left = {
|
||||
.name = "left",
|
||||
.description = "When active the player is turning left"
|
||||
};
|
||||
in_button_t in_right = {
|
||||
.name = "right",
|
||||
.description = "When active the player is turning right"
|
||||
};
|
||||
in_button_t in_forward = {
|
||||
.name = "forward",
|
||||
.description = "When active the player is moving forward"
|
||||
};
|
||||
in_button_t in_back = {
|
||||
.name = "back",
|
||||
.description = "When active the player is moving backwards"
|
||||
};
|
||||
in_button_t in_lookup = {
|
||||
.name = "lookup",
|
||||
.description = "When active the player's view is looking up"
|
||||
};
|
||||
in_button_t in_lookdown = {
|
||||
.name = "lookdown",
|
||||
.description = "When active the player's view is looking down"
|
||||
};
|
||||
in_button_t in_moveleft = {
|
||||
.name = "moveleft",
|
||||
.description = "When active the player is strafing left"
|
||||
};
|
||||
in_button_t in_moveright = {
|
||||
.name = "moveright",
|
||||
.description = "When active the player is strafing right"
|
||||
};
|
||||
in_button_t in_use = {
|
||||
.name = "use",
|
||||
.description = "Left over command for opening doors and triggering"
|
||||
" switches"
|
||||
};
|
||||
in_button_t in_jump = {
|
||||
.name = "jump",
|
||||
.description = "When active the player is jumping"
|
||||
};
|
||||
in_button_t in_attack = {
|
||||
.name = "attack",
|
||||
.description = "When active player is firing/using current weapon"
|
||||
};
|
||||
in_button_t in_up = {
|
||||
.name = "moveup",
|
||||
.description = "When active the player is swimming up in a liquid"
|
||||
};
|
||||
in_button_t in_down = {
|
||||
.name = "movedown",
|
||||
.description = "When active the player is swimming down in a liquid"
|
||||
};
|
||||
in_button_t in_strafe = {
|
||||
.name = "strafe",
|
||||
.description = "When active, +left and +right function like +moveleft and"
|
||||
" +moveright"
|
||||
};
|
||||
in_button_t in_klook = {
|
||||
.name = "klook",
|
||||
.description = "When active, +forward and +back perform +lookup and"
|
||||
" +lookdown"
|
||||
};
|
||||
in_button_t in_speed = {
|
||||
.name = "speed",
|
||||
.description = "When active the player is running"
|
||||
};
|
||||
in_button_t in_mlook = {
|
||||
.name = "mlook",
|
||||
.description = "When active moving the mouse or joystick forwards "
|
||||
"and backwards performs +lookup and "
|
||||
"+lookdown"
|
||||
};
|
||||
|
||||
static in_axis_t *cl_in_axes[] = {
|
||||
&in_move_forward,
|
||||
&in_move_side,
|
||||
&in_move_up,
|
||||
&in_move_pitch,
|
||||
&in_move_yaw,
|
||||
&in_move_roll,
|
||||
0,
|
||||
};
|
||||
|
||||
static in_button_t *cl_in_buttons[] = {
|
||||
&in_left,
|
||||
&in_right,
|
||||
&in_forward,
|
||||
&in_back,
|
||||
&in_lookup,
|
||||
&in_lookdown,
|
||||
&in_moveleft,
|
||||
&in_moveright,
|
||||
&in_use,
|
||||
&in_jump,
|
||||
&in_attack,
|
||||
&in_up,
|
||||
&in_down,
|
||||
&in_strafe,
|
||||
&in_klook,
|
||||
&in_speed,
|
||||
&in_mlook,
|
||||
0
|
||||
};
|
||||
|
||||
cvar_t *cl_anglespeedkey;
|
||||
cvar_t *cl_backspeed;
|
||||
cvar_t *cl_forwardspeed;
|
||||
cvar_t *cl_movespeedkey;
|
||||
cvar_t *cl_pitchspeed;
|
||||
cvar_t *cl_sidespeed;
|
||||
cvar_t *cl_upspeed;
|
||||
cvar_t *cl_yawspeed;
|
||||
|
||||
cvar_t *lookspring;
|
||||
cvar_t *m_pitch;
|
||||
cvar_t *m_yaw;
|
||||
cvar_t *m_forward;
|
||||
cvar_t *m_side;
|
||||
|
||||
static void
|
||||
CL_AdjustAngles (float frametime, movestate_t *ms, viewstate_t *vs)
|
||||
{
|
||||
float down, up;
|
||||
float pitchspeed, yawspeed;
|
||||
vec4f_t delta = {};
|
||||
|
||||
pitchspeed = cl_pitchspeed->value;
|
||||
yawspeed = cl_yawspeed->value;
|
||||
|
||||
if (in_speed.state & inb_down) {
|
||||
pitchspeed *= cl_anglespeedkey->value;
|
||||
yawspeed *= cl_anglespeedkey->value;
|
||||
}
|
||||
|
||||
pitchspeed *= frametime;
|
||||
yawspeed *= frametime;
|
||||
|
||||
if (!(in_strafe.state & inb_down)) {
|
||||
delta[YAW] -= yawspeed * IN_ButtonState (&in_right);
|
||||
delta[YAW] += yawspeed * IN_ButtonState (&in_left);
|
||||
}
|
||||
if (in_klook.state & inb_down) {
|
||||
V_StopPitchDrift (vs);
|
||||
delta[PITCH] -= pitchspeed * IN_ButtonState (&in_forward);
|
||||
delta[PITCH] += pitchspeed * IN_ButtonState (&in_back);
|
||||
}
|
||||
|
||||
up = IN_ButtonState (&in_lookup);
|
||||
down = IN_ButtonState (&in_lookdown);
|
||||
|
||||
delta[PITCH] -= pitchspeed * up;
|
||||
delta[PITCH] += pitchspeed * down;
|
||||
|
||||
delta[PITCH] -= IN_UpdateAxis (&in_move_pitch) * m_pitch->value;
|
||||
delta[YAW] -= IN_UpdateAxis (&in_move_yaw) * m_yaw->value;
|
||||
delta[ROLL] -= IN_UpdateAxis (&in_move_roll) * m_pitch->value;
|
||||
|
||||
ms->angles += delta;
|
||||
|
||||
if (delta[PITCH]) {
|
||||
V_StopPitchDrift (vs);
|
||||
ms->angles[PITCH] = bound (-70, ms->angles[PITCH], 80);
|
||||
}
|
||||
if (delta[ROLL]) {
|
||||
ms->angles[ROLL] = bound (-50, ms->angles[ROLL], 50);
|
||||
}
|
||||
if (delta[YAW]) {
|
||||
ms->angles[YAW] = anglemod (ms->angles[YAW]);
|
||||
}
|
||||
}
|
||||
|
||||
static const char default_input_config[] = {
|
||||
#include "libs/client/default_input.plc"
|
||||
|
@ -114,7 +346,7 @@ cl_unbind_f (void)
|
|||
Cmd_ExecuteString (cmd_buf->str, src_command);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
CL_Legacy_Init (void)
|
||||
{
|
||||
OK_Init ();
|
||||
|
@ -123,3 +355,163 @@ CL_Legacy_Init (void)
|
|||
// FIXME hashlinks
|
||||
IN_LoadConfig (PL_GetPropertyList (default_input_config, 0));
|
||||
}
|
||||
|
||||
void
|
||||
CL_Input_BuildMove (float frametime, movestate_t *state, viewstate_t *vs)
|
||||
{
|
||||
if (IN_ButtonReleased (&in_mlook) && !freelook && lookspring->int_val) {
|
||||
V_StartPitchDrift (vs);
|
||||
}
|
||||
|
||||
CL_AdjustAngles (frametime, state, vs);
|
||||
|
||||
vec4f_t move = {};
|
||||
|
||||
if (in_strafe.state & inb_down) {
|
||||
move[SIDE] += cl_sidespeed->value * IN_ButtonState (&in_right);
|
||||
move[SIDE] -= cl_sidespeed->value * IN_ButtonState (&in_left);
|
||||
}
|
||||
|
||||
move[SIDE] += cl_sidespeed->value * IN_ButtonState (&in_moveright);
|
||||
move[SIDE] -= cl_sidespeed->value * IN_ButtonState (&in_moveleft);
|
||||
|
||||
move[UP] += cl_upspeed->value * IN_ButtonState (&in_up);
|
||||
move[UP] -= cl_upspeed->value * IN_ButtonState (&in_down);
|
||||
|
||||
if (!(in_klook.state & inb_down)) {
|
||||
move[FORWARD] += cl_forwardspeed->value * IN_ButtonState (&in_forward);
|
||||
move[FORWARD] -= cl_backspeed->value * IN_ButtonState (&in_back);
|
||||
}
|
||||
|
||||
// adjust for speed key
|
||||
if (in_speed.state & inb_down) {
|
||||
move *= cl_movespeedkey->value;
|
||||
}
|
||||
|
||||
move[FORWARD] -= IN_UpdateAxis (&in_move_forward) * m_forward->value;
|
||||
move[SIDE] += IN_UpdateAxis (&in_move_side) * m_side->value;
|
||||
move[UP] -= IN_UpdateAxis (&in_move_up);
|
||||
|
||||
if (freelook)
|
||||
V_StopPitchDrift (vs);
|
||||
|
||||
if (vs->chase
|
||||
&& (chase_active->int_val == 2 || chase_active->int_val == 3)) {
|
||||
/* adjust for chase camera angles
|
||||
* makes the player move relative to the chase camera frame rather
|
||||
* than the player's frame
|
||||
*/
|
||||
chasestate_t *cs = vs->chasestate;
|
||||
vec3_t forward, right, up, f, r;
|
||||
vec3_t dir = {0, 0, 0};
|
||||
dir[1] = cs->camera_angles[1] - vs->player_angles[1];
|
||||
AngleVectors (dir, forward, right, up);
|
||||
VectorScale (forward, move[FORWARD], f);
|
||||
VectorScale (right, move[SIDE], r);
|
||||
move[FORWARD] = f[0] + r[0];
|
||||
move[SIDE] = -f[1] - r[1];
|
||||
}
|
||||
state->move = move;
|
||||
}
|
||||
|
||||
static void
|
||||
cl_on_focus_change_redirect (void *_func, const int *game)
|
||||
{
|
||||
void (*func) (int game) = _func;
|
||||
func (*game);
|
||||
}
|
||||
|
||||
void
|
||||
CL_OnFocusChange (void (*func) (int game))
|
||||
{
|
||||
LISTENER_ADD (&cl_on_focus_change, cl_on_focus_change_redirect, func);
|
||||
}
|
||||
|
||||
static int
|
||||
cl_focus_event (const IE_event_t *ie_event)
|
||||
{
|
||||
int game = ie_event->type == ie_gain_focus;
|
||||
LISTENER_INVOKE (&cl_on_focus_change, &game);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
cl_key_event (const IE_event_t *ie_event)
|
||||
{
|
||||
if (ie_event->key.code == QFK_ESCAPE) {
|
||||
Con_SetState (con_menu);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
cl_event_handler (const IE_event_t *ie_event, void *unused)
|
||||
{
|
||||
static int (*handlers[ie_event_count]) (const IE_event_t *ie_event) = {
|
||||
[ie_key] = cl_key_event,
|
||||
[ie_gain_focus] = cl_focus_event,
|
||||
[ie_lose_focus] = cl_focus_event,
|
||||
};
|
||||
if ((unsigned) ie_event->type >= ie_event_count
|
||||
|| !handlers[ie_event->type]) {
|
||||
return IN_Binding_HandleEvent (ie_event);
|
||||
}
|
||||
return handlers[ie_event->type] (ie_event);
|
||||
}
|
||||
|
||||
void
|
||||
CL_Input_Init (cbuf_t *cbuf)
|
||||
{
|
||||
cl_event_id = IE_Add_Handler (cl_event_handler, 0);
|
||||
|
||||
for (int i = 0; cl_in_axes[i]; i++) {
|
||||
IN_RegisterAxis (cl_in_axes[i]);
|
||||
}
|
||||
for (int i = 0; cl_in_buttons[i]; i++) {
|
||||
IN_RegisterButton (cl_in_buttons[i]);
|
||||
}
|
||||
cl_game_context = IMT_CreateContext ("key_game");
|
||||
IMT_SetContextCbuf (cl_game_context, cbuf);
|
||||
cl_demo_context = IMT_CreateContext ("key_demo");
|
||||
IMT_SetContextCbuf (cl_demo_context, cbuf);
|
||||
CL_Legacy_Init ();
|
||||
}
|
||||
|
||||
void
|
||||
CL_Input_Init_Cvars (void)
|
||||
{
|
||||
lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL, "Snap view "
|
||||
"to center when moving and no mlook/klook");
|
||||
m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse pitch (up/down) multipier");
|
||||
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse yaw (left/right) multipiler");
|
||||
m_forward = Cvar_Get ("m_forward", "1", CVAR_ARCHIVE, NULL,
|
||||
"mouse forward/back speed");
|
||||
m_side = Cvar_Get ("m_side", "0.8", CVAR_ARCHIVE, NULL,
|
||||
"mouse strafe speed");
|
||||
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL,
|
||||
"turn `run' speed multiplier");
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"backward speed");
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"forward speed");
|
||||
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
||||
"move `run' speed multiplier");
|
||||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
||||
"look up/down speed");
|
||||
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL,
|
||||
"strafe speed");
|
||||
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
|
||||
"swim/fly up/down speed");
|
||||
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
|
||||
"turning speed");
|
||||
}
|
||||
|
||||
void
|
||||
CL_Input_Activate (int in_game)
|
||||
{
|
||||
IMT_SetContext (!in_game ? cl_demo_context : cl_game_context);
|
||||
IE_Set_Focus (cl_event_id);
|
||||
}
|
||||
|
|
|
@ -249,15 +249,19 @@ CL_LoadPointFile (const model_t *model)
|
|||
vec4f_t zero = {};
|
||||
for (;;) {
|
||||
char buf[64];
|
||||
vec4f_t org = { 0, 0, 0, 1 };
|
||||
union {
|
||||
vec4f_t org;
|
||||
vec3_t org3;
|
||||
} o = { .org = { 0, 0, 0, 1 }};
|
||||
|
||||
Qgets (f, buf, sizeof (buf));
|
||||
int r = sscanf (buf, "%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
int r = sscanf (buf, "%f %f %f\n",
|
||||
&o.org3[0], &o.org3[1], &o.org3[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
c++;
|
||||
|
||||
if (!particle_new (pt_static, part_tex_dot, org, 1.5, zero,
|
||||
if (!particle_new (pt_static, part_tex_dot, o.org, 1.5, zero,
|
||||
99999, (-c) & 15, 1.0, 0.0)) {
|
||||
Sys_MaskPrintf (SYS_dev, "Not enough free particles\n");
|
||||
break;
|
||||
|
@ -1279,3 +1283,9 @@ CL_Particles_Init (void)
|
|||
"Sets particle style. 0 for Id, 1 for QF.");
|
||||
CL_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
void
|
||||
CL_ParticlesGravity (float gravity)
|
||||
{
|
||||
cl_psystem->gravity = (vec4f_t) { 0, 0, -gravity, 0 };
|
||||
}
|
||||
|
|
|
@ -46,15 +46,17 @@
|
|||
|
||||
#include "QF/plugin/vid_render.h" //FIXME
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
|
||||
#include "client/effects.h"
|
||||
#include "client/entities.h"
|
||||
#include "client/particles.h"
|
||||
#include "client/temp_entities.h"
|
||||
#include "client/world.h"
|
||||
|
||||
typedef struct tent_s {
|
||||
struct tent_s *next;
|
||||
entity_t ent;
|
||||
entity_t *ent;
|
||||
} tent_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -146,12 +148,12 @@ CL_TEnts_Init (void)
|
|||
void
|
||||
CL_Init_Entity (entity_t *ent)
|
||||
{
|
||||
if (ent->transform) {
|
||||
Transform_Delete (ent->transform);
|
||||
}
|
||||
memset (ent, 0, sizeof (*ent));
|
||||
memset (&ent->animation, 0, sizeof (ent->animation));
|
||||
memset (&ent->visibility, 0, sizeof (ent->visibility));
|
||||
memset (&ent->renderer, 0, sizeof (ent->renderer));
|
||||
ent->active = 1;
|
||||
ent->old_origin = (vec4f_t) {};
|
||||
|
||||
ent->transform = Transform_New (0);
|
||||
ent->renderer.skin = 0;
|
||||
QuatSet (1.0, 1.0, 1.0, 1.0, ent->renderer.colormod);
|
||||
ent->animation.pose1 = ent->animation.pose2 = -1;
|
||||
|
@ -161,9 +163,9 @@ static tent_t *
|
|||
new_temp_entity (void)
|
||||
{
|
||||
tent_t *tent = PR_RESNEW_NC (temp_entities);
|
||||
tent->ent.transform = 0;
|
||||
tent->ent = Scene_CreateEntity (cl_world.scene);
|
||||
tent->next = 0;
|
||||
CL_Init_Entity (&tent->ent);
|
||||
CL_Init_Entity (tent->ent);
|
||||
return tent;
|
||||
}
|
||||
|
||||
|
@ -173,7 +175,7 @@ free_temp_entities (tent_t *tents)
|
|||
tent_t **t = &tents;
|
||||
|
||||
while (*t) {
|
||||
Transform_Delete ((*t)->ent.transform);//FIXME reuse?
|
||||
Scene_DestroyEntity (cl_world.scene, (*t)->ent);//FIXME reuse?
|
||||
t = &(*t)->next;
|
||||
}
|
||||
*t = temp_entities._free;
|
||||
|
@ -211,8 +213,8 @@ beam_clear (beam_t *b)
|
|||
tent_t *t;
|
||||
|
||||
for (t = b->tents; t; t = t->next) {
|
||||
r_funcs->R_RemoveEfrags (&t->ent);
|
||||
t->ent.visibility.efrag = 0;
|
||||
R_RemoveEfrags (t->ent);
|
||||
t->ent->visibility.efrag = 0;
|
||||
}
|
||||
free_temp_entities (b->tents);
|
||||
b->tents = 0;
|
||||
|
@ -259,17 +261,17 @@ beam_setup (beam_t *b, qboolean transform, double time, TEntContext_t *ctx)
|
|||
|
||||
vec4f_t position = org + d * dist;
|
||||
d += 1.0;
|
||||
tent->ent.renderer.model = b->model;
|
||||
tent->ent->renderer.model = b->model;
|
||||
if (transform) {
|
||||
seed = seed * BEAM_SEED_PRIME;
|
||||
Transform_SetLocalTransform (tent->ent.transform, scale,
|
||||
Transform_SetLocalTransform (tent->ent->transform, scale,
|
||||
qmulf (rotation,
|
||||
beam_rolls[seed % 360]),
|
||||
position);
|
||||
} else {
|
||||
Transform_SetLocalPosition (tent->ent.transform, position);
|
||||
Transform_SetLocalPosition (tent->ent->transform, position);
|
||||
}
|
||||
r_funcs->R_AddEfrags (&ctx->worldModel->brush, &tent->ent);
|
||||
R_AddEfrags (&cl_world.worldmodel->brush, tent->ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,8 +285,8 @@ CL_ParseBeam (qmsg_t *net_message, model_t *m, double time, TEntContext_t *ctx)
|
|||
|
||||
ent = MSG_ReadShort (net_message);
|
||||
|
||||
MSG_ReadCoordV (net_message, &start[0]);//FIXME
|
||||
MSG_ReadCoordV (net_message, &end[0]);//FIXME
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&start);//FIXME
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&end);//FIXME
|
||||
start[3] = end[3] = 1;//FIXME
|
||||
|
||||
to = 0;
|
||||
|
@ -338,17 +340,17 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
break;
|
||||
case TE_Blood:
|
||||
count = MSG_ReadByte (net_message) * 20;
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->BloodPuffEffect (position, count);
|
||||
break;
|
||||
case TE_Explosion:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
|
||||
// particles
|
||||
clp_funcs->ParticleExplosion (position);
|
||||
|
||||
// light
|
||||
dl = r_funcs->R_AllocDlight (0);
|
||||
dl = R_AllocDlight (0);
|
||||
if (dl) {
|
||||
VectorCopy (position, dl->origin);
|
||||
dl->radius = 350;
|
||||
|
@ -359,7 +361,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
}
|
||||
|
||||
// sound
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1);
|
||||
|
||||
// sprite
|
||||
to = new_tent_object ();
|
||||
|
@ -373,17 +375,17 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
if (!cl_spr_explod->cache.data) {
|
||||
cl_spr_explod = Mod_ForName ("progs/s_explod.spr", true);
|
||||
}
|
||||
ex->tent->ent.renderer.model = cl_spr_explod;
|
||||
Transform_SetLocalPosition (ex->tent->ent.transform,//FIXME
|
||||
ex->tent->ent->renderer.model = cl_spr_explod;
|
||||
Transform_SetLocalPosition (ex->tent->ent->transform,//FIXME
|
||||
(vec4f_t) {VectorExpand (position), 1});
|
||||
break;
|
||||
case TE_Explosion2:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
colorStart = MSG_ReadByte (net_message);
|
||||
colorLength = MSG_ReadByte (net_message);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1);
|
||||
clp_funcs->ParticleExplosion2 (position, colorStart, colorLength);
|
||||
dl = r_funcs->R_AllocDlight (0);
|
||||
dl = R_AllocDlight (0);
|
||||
if (!dl)
|
||||
break;
|
||||
VectorCopy (position, dl->origin);
|
||||
|
@ -396,12 +398,12 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
dl->color[3] = 0.7;
|
||||
break;
|
||||
case TE_Explosion3:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
MSG_ReadCoordV (net_message, color); // OUCH!
|
||||
color[3] = 0.7;
|
||||
clp_funcs->ParticleExplosion (position);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1);
|
||||
dl = r_funcs->R_AllocDlight (0);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1);
|
||||
dl = R_AllocDlight (0);
|
||||
if (dl) {
|
||||
VectorCopy (position, dl->origin);
|
||||
dl->radius = 350;
|
||||
|
@ -411,21 +413,21 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
}
|
||||
break;
|
||||
case TE_Gunshot1:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->GunshotEffect (position, 20);
|
||||
break;
|
||||
case TE_Gunshot2:
|
||||
count = MSG_ReadByte (net_message) * 20;
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->GunshotEffect (position, count);
|
||||
break;
|
||||
case TE_KnightSpike:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->KnightSpikeEffect (position);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, position, 1, 1);
|
||||
break;
|
||||
case TE_LavaSplash:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->LavaSplash (position);
|
||||
break;
|
||||
case TE_Lightning1:
|
||||
|
@ -442,10 +444,10 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
CL_ParseBeam (net_message, Mod_ForName (name, true), time, ctx);
|
||||
break;
|
||||
case TE_LightningBlood:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
|
||||
// light
|
||||
dl = r_funcs->R_AllocDlight (0);
|
||||
dl = R_AllocDlight (0);
|
||||
if (dl) {
|
||||
VectorCopy (position, dl->origin);
|
||||
dl->radius = 150;
|
||||
|
@ -457,7 +459,7 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
clp_funcs->LightningBloodEffect (position);
|
||||
break;
|
||||
case TE_Spike:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->SpikeEffect (position);
|
||||
{
|
||||
int i;
|
||||
|
@ -469,11 +471,11 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
} else {
|
||||
sound = cl_sfx_tink1;
|
||||
}
|
||||
S_StartSound (-1, 0, sound, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, sound, position, 1, 1);
|
||||
}
|
||||
break;
|
||||
case TE_SuperSpike:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->SuperSpikeEffect (position);
|
||||
{
|
||||
int i;
|
||||
|
@ -485,23 +487,23 @@ parse_tent (qmsg_t *net_message, double time, TEntContext_t *ctx,
|
|||
} else {
|
||||
sound = cl_sfx_tink1;
|
||||
}
|
||||
S_StartSound (-1, 0, sound, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, sound, position, 1, 1);
|
||||
}
|
||||
break;
|
||||
case TE_TarExplosion:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->BlobExplosion (position);
|
||||
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, position, 1, 1);
|
||||
break;
|
||||
case TE_Teleport:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->TeleportSplash (position);
|
||||
break;
|
||||
case TE_WizSpike:
|
||||
MSG_ReadCoordV (net_message, &position[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&position);//FIXME
|
||||
clp_funcs->WizSpikeEffect (position);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, &position[0], 1, 1);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, position, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +599,7 @@ CL_UpdateBeams (double time, TEntContext_t *ctx)
|
|||
// add new entities for the lightning
|
||||
for (t = b->tents; t; t = t->next) {
|
||||
seed = seed * BEAM_SEED_PRIME;
|
||||
Transform_SetLocalRotation (t->ent.transform,
|
||||
Transform_SetLocalRotation (t->ent->transform,
|
||||
qmulf (b->rotation,
|
||||
beam_rolls[seed % 360]));
|
||||
}
|
||||
|
@ -614,11 +616,11 @@ CL_UpdateExplosions (double time, TEntContext_t *ctx)
|
|||
|
||||
for (to = &cl_explosions; *to; ) {
|
||||
ex = &(*to)->to.ex;
|
||||
ent = &ex->tent->ent;
|
||||
ent = ex->tent->ent;
|
||||
f = 10 * (time - ex->start);
|
||||
if (f >= ent->renderer.model->numframes) {
|
||||
tent_obj_t *_to;
|
||||
r_funcs->R_RemoveEfrags (ent);
|
||||
R_RemoveEfrags (ent);
|
||||
ent->visibility.efrag = 0;
|
||||
free_temp_entities (ex->tent);
|
||||
_to = *to;
|
||||
|
@ -630,7 +632,7 @@ CL_UpdateExplosions (double time, TEntContext_t *ctx)
|
|||
|
||||
ent->animation.frame = f;
|
||||
if (!ent->visibility.efrag) {
|
||||
r_funcs->R_AddEfrags (&ctx->worldModel->brush, ent);
|
||||
R_AddEfrags (&cl_world.worldmodel->brush, ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +655,7 @@ CL_ParseParticleEffect (qmsg_t *net_message)
|
|||
int i, count, color;
|
||||
vec4f_t org = {0, 0, 0, 1}, dir = {};
|
||||
|
||||
MSG_ReadCoordV (net_message, &org[0]);
|
||||
MSG_ReadCoordV (net_message, (vec_t*)&org);//FIXME
|
||||
for (i = 0; i < 3; i++)
|
||||
dir[i] = ((signed char) MSG_ReadByte (net_message)) * (15.0 / 16.0);
|
||||
count = MSG_ReadByte (net_message);
|
||||
|
@ -671,8 +673,8 @@ CL_ClearProjectiles (void)
|
|||
tent_t *tent;
|
||||
|
||||
for (tent = cl_projectiles; tent; tent = tent->next) {
|
||||
r_funcs->R_RemoveEfrags (&tent->ent);
|
||||
tent->ent.visibility.efrag = 0;
|
||||
R_RemoveEfrags (tent->ent);
|
||||
tent->ent->visibility.efrag = 0;
|
||||
}
|
||||
free_temp_entities (cl_projectiles);
|
||||
cl_projectiles = 0;
|
||||
|
@ -708,7 +710,7 @@ CL_ParseProjectiles (qmsg_t *net_message, qboolean nail2, TEntContext_t *ctx)
|
|||
*tail = tent;
|
||||
tail = &tent->next;
|
||||
|
||||
pr = &tent->ent;
|
||||
pr = tent->ent;
|
||||
pr->renderer.model = cl_spike;
|
||||
pr->renderer.skin = 0;
|
||||
position[0] = ((bits[0] + ((bits[1] & 15) << 8)) << 1) - 4096;
|
||||
|
@ -717,9 +719,9 @@ CL_ParseProjectiles (qmsg_t *net_message, qboolean nail2, TEntContext_t *ctx)
|
|||
angles[0] = (bits[4] >> 4) * (360.0 / 16.0);
|
||||
angles[1] = bits[5] * (360.0 / 256.0);
|
||||
angles[2] = 0;
|
||||
CL_TransformEntity (&tent->ent, 1, angles, position);
|
||||
CL_TransformEntity (tent->ent, 1, angles, position);
|
||||
|
||||
r_funcs->R_AddEfrags (&ctx->worldModel->brush, &tent->ent);
|
||||
R_AddEfrags (&cl_world.worldmodel->brush, tent->ent);
|
||||
}
|
||||
|
||||
*tail = cl_projectiles;
|
||||
|
|
|
@ -33,18 +33,19 @@
|
|||
#include "QF/msg.h"
|
||||
#include "QF/screen.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h"
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/transform.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "qw/bothdefs.h"
|
||||
|
||||
#include "qw/include/chase.h"
|
||||
#include "qw/include/cl_cam.h"
|
||||
#include "qw/include/cl_ents.h"
|
||||
#include "qw/include/cl_main.h"
|
||||
#include "qw/include/client.h"
|
||||
#include "qw/include/host.h"
|
||||
#include "client/chase.h"
|
||||
#include "client/entities.h"
|
||||
#include "client/hud.h"
|
||||
#include "client/input.h"
|
||||
#include "client/view.h"
|
||||
#include "client/world.h"
|
||||
|
||||
/*
|
||||
The view is allowed to move slightly from it's true position for bobbing,
|
||||
|
@ -71,6 +72,11 @@ cvar_t *v_kicktime;
|
|||
cvar_t *v_kickroll;
|
||||
cvar_t *v_kickpitch;
|
||||
|
||||
cvar_t *cl_cshift_bonus;
|
||||
cvar_t *cl_cshift_contents;
|
||||
cvar_t *cl_cshift_damage;
|
||||
cvar_t *cl_cshift_powerup;
|
||||
|
||||
cvar_t *v_iyaw_cycle;
|
||||
cvar_t *v_iroll_cycle;
|
||||
cvar_t *v_ipitch_cycle;
|
||||
|
@ -86,11 +92,37 @@ vec4f_t v_idle_yaw;
|
|||
vec4f_t v_idle_roll;
|
||||
vec4f_t v_idle_pitch;
|
||||
|
||||
cshift_t cshift_empty = { {130, 80, 50}, 0};
|
||||
cshift_t cshift_water = { {130, 80, 50}, 128};
|
||||
cshift_t cshift_slime = { {0, 25, 5}, 150};
|
||||
cshift_t cshift_lava = { {255, 80, 0}, 150};
|
||||
cshift_t cshift_bonus = { {215, 186, 60}, 50};
|
||||
static cshift_t cshift_empty = { {130, 80, 50}, 0};
|
||||
static cshift_t cshift_water = { {130, 80, 50}, 128};
|
||||
static cshift_t cshift_slime = { { 0, 25, 5}, 150};
|
||||
static cshift_t cshift_lava = { {255, 80, 0}, 150};
|
||||
static cshift_t cshift_bonus = { {215, 186, 60}, 50};
|
||||
|
||||
static cshift_t armor_blood[] = {
|
||||
{ {255, 0, 0} }, // blood
|
||||
{ {220, 50, 50} }, // armor + blood
|
||||
{ {200, 100, 100} }, // armor > blood need two for logic
|
||||
{ {200, 100, 100} }, // armor > blood need two for logic
|
||||
};
|
||||
|
||||
static cshift_t powerup[] = {
|
||||
{ { 0, 0, 0}, 0},
|
||||
{ {100, 100, 100}, 100}, // IT_INVISIBILITY
|
||||
{ {255, 255, 0}, 30}, // IT_INVULNERABILITY
|
||||
{ {255, 255, 0}, 30}, // IT_INVULNERABILITY
|
||||
{ { 0, 255, 0}, 20}, // IT_SUIT
|
||||
{ { 0, 255, 0}, 20}, // IT_SUIT
|
||||
{ { 0, 255, 0}, 20}, // IT_SUIT
|
||||
{ { 0, 255, 0}, 20}, // IT_SUIT
|
||||
{ { 0, 0, 255}, 30}, // IT_QUAD
|
||||
{ { 0, 0, 255}, 30}, // IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
{ {255, 0, 255}, 30}, // IT_INVULNERABILITY | IT_QUAD
|
||||
};
|
||||
|
||||
#define sqr(x) ((x) * (x))
|
||||
|
||||
|
@ -116,20 +148,20 @@ V_CalcRoll (const vec3_t angles, vec4f_t velocity)
|
|||
}
|
||||
|
||||
static float
|
||||
V_CalcBob (void)
|
||||
V_CalcBob (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t velocity = cl.viewstate.velocity;
|
||||
vec4f_t velocity = vs->velocity;
|
||||
float cycle;
|
||||
static double bobtime;
|
||||
static float bob;
|
||||
|
||||
if (cl.spectator)
|
||||
if (!vs->bob_enabled)
|
||||
return 0;
|
||||
|
||||
if (cl.viewstate.onground == -1)
|
||||
if (vs->onground == -1)
|
||||
return bob; // just use old value
|
||||
|
||||
bobtime += cl.viewstate.frametime;
|
||||
bobtime += vs->frametime;
|
||||
cycle = bobtime - (int) (bobtime / cl_bobcycle->value) *
|
||||
cl_bobcycle->value;
|
||||
cycle /= cl_bobcycle->value;
|
||||
|
@ -151,31 +183,37 @@ V_CalcBob (void)
|
|||
}
|
||||
|
||||
void
|
||||
V_StartPitchDrift (void)
|
||||
V_StartPitchDrift (viewstate_t *vs)
|
||||
{
|
||||
if (cl.laststop == cl.time) {
|
||||
if (vs->laststop == vs->time) {
|
||||
return; // something else is keeping it from drifting
|
||||
}
|
||||
|
||||
if (cl.nodrift || !cl.pitchvel) {
|
||||
cl.pitchvel = v_centerspeed->value;
|
||||
cl.nodrift = false;
|
||||
cl.driftmove = 0;
|
||||
if (vs->nodrift || !vs->pitchvel) {
|
||||
vs->pitchvel = v_centerspeed->value;
|
||||
vs->nodrift = false;
|
||||
vs->driftmove = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
V_StopPitchDrift (void)
|
||||
static void
|
||||
V_StartPitchDrift_f (void *data)
|
||||
{
|
||||
cl.laststop = cl.time;
|
||||
cl.nodrift = true;
|
||||
cl.pitchvel = 0;
|
||||
V_StartPitchDrift (data);
|
||||
}
|
||||
|
||||
void
|
||||
V_StopPitchDrift (viewstate_t *vs)
|
||||
{
|
||||
vs->laststop = vs->time;
|
||||
vs->nodrift = true;
|
||||
vs->pitchvel = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
V_DriftPitch
|
||||
|
||||
Moves the client pitch angle towards cl.idealpitch sent by the server.
|
||||
Moves the client pitch angle towards vs->idealpitch sent by the server.
|
||||
|
||||
If the user is adjusting pitch manually, either with lookup/lookdown,
|
||||
mlook and mouse, or klook and keyboard, pitch drifting is constantly
|
||||
|
@ -185,64 +223,64 @@ V_StopPitchDrift (void)
|
|||
and lookspring is non 0, or when
|
||||
*/
|
||||
static void
|
||||
V_DriftPitch (void)
|
||||
V_DriftPitch (viewstate_t *vs)
|
||||
{
|
||||
float delta, move;
|
||||
float forwardmove = cl.viewstate.movecmd[0];
|
||||
float forwardmove = vs->movecmd[0];
|
||||
|
||||
if (noclip_anglehack || cl.viewstate.onground == -1 || cls.demoplayback) {
|
||||
cl.driftmove = 0;
|
||||
cl.pitchvel = 0;
|
||||
if (noclip_anglehack || vs->onground == -1 || !vs->drift_enabled) {
|
||||
vs->driftmove = 0;
|
||||
vs->pitchvel = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// don't count small mouse motion
|
||||
if (cl.nodrift) {
|
||||
if (vs->nodrift) {
|
||||
if (fabs (forwardmove) < cl_forwardspeed->value)
|
||||
cl.driftmove = 0;
|
||||
vs->driftmove = 0;
|
||||
else
|
||||
cl.driftmove += cl.viewstate.frametime;
|
||||
vs->driftmove += vs->frametime;
|
||||
|
||||
if (cl.driftmove > v_centermove->value) {
|
||||
V_StartPitchDrift ();
|
||||
if (vs->driftmove > v_centermove->value) {
|
||||
V_StartPitchDrift (vs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
delta = cl.idealpitch - cl.viewstate.angles[PITCH];
|
||||
delta = vs->idealpitch - vs->player_angles[PITCH];
|
||||
|
||||
if (!delta) {
|
||||
cl.pitchvel = 0;
|
||||
vs->pitchvel = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
move = cl.viewstate.frametime * cl.pitchvel;
|
||||
cl.pitchvel += cl.viewstate.frametime * v_centerspeed->value;
|
||||
move = vs->frametime * vs->pitchvel;
|
||||
vs->pitchvel += vs->frametime * v_centerspeed->value;
|
||||
|
||||
if (delta > 0) {
|
||||
if (move > delta) {
|
||||
cl.pitchvel = 0;
|
||||
vs->pitchvel = 0;
|
||||
move = delta;
|
||||
}
|
||||
cl.viewstate.angles[PITCH] += move;
|
||||
vs->player_angles[PITCH] += move;
|
||||
} else if (delta < 0) {
|
||||
if (move > -delta) {
|
||||
cl.pitchvel = 0;
|
||||
vs->pitchvel = 0;
|
||||
move = -delta;
|
||||
}
|
||||
cl.viewstate.angles[PITCH] -= move;
|
||||
vs->player_angles[PITCH] -= move;
|
||||
}
|
||||
}
|
||||
|
||||
/* PALETTE FLASHES */
|
||||
|
||||
void
|
||||
V_ParseDamage (void)
|
||||
V_ParseDamage (qmsg_t *net_message, viewstate_t *vs)
|
||||
{
|
||||
float count, side;
|
||||
int armor, blood;
|
||||
vec4f_t origin = cl.viewstate.origin;
|
||||
vec_t *angles = cl.viewstate.angles;
|
||||
vec4f_t origin = vs->player_origin;
|
||||
vec_t *angles = vs->player_angles;
|
||||
vec3_t from, forward, right, up;
|
||||
|
||||
armor = MSG_ReadByte (net_message);
|
||||
|
@ -253,31 +291,15 @@ V_ParseDamage (void)
|
|||
if (count < 10)
|
||||
count = 10;
|
||||
|
||||
cl.faceanimtime = cl.time + 0.2; // but sbar face into pain frame
|
||||
|
||||
if (cl_cshift_damage->int_val
|
||||
|| (cl.sv_cshifts & INFO_CSHIFT_DAMAGE)) {
|
||||
cshift_t *cshift = &cl.cshifts[CSHIFT_DAMAGE];
|
||||
|
||||
cshift->percent += 3 * count;
|
||||
cshift->percent =
|
||||
bound (0, cshift->percent, 150);
|
||||
|
||||
if (armor > blood) {
|
||||
cshift->destcolor[0] = 200;
|
||||
cshift->destcolor[1] = 100;
|
||||
cshift->destcolor[2] = 100;
|
||||
} else if (armor) {
|
||||
cshift->destcolor[0] = 220;
|
||||
cshift->destcolor[1] = 50;
|
||||
cshift->destcolor[2] = 50;
|
||||
} else {
|
||||
cshift->destcolor[0] = 255;
|
||||
cshift->destcolor[1] = 0;
|
||||
cshift->destcolor[2] = 0;
|
||||
}
|
||||
|| (vs->force_cshifts & INFO_CSHIFT_DAMAGE)) {
|
||||
cshift_t *cshift = &vs->cshifts[CSHIFT_DAMAGE];
|
||||
int percent = cshift->percent;
|
||||
*cshift = armor_blood[(2 * (armor > blood)) + (armor > 0)];
|
||||
cshift->percent = percent + 3 * count;
|
||||
cshift->percent = bound (0, cshift->percent, 150);
|
||||
cshift->initialpct = cshift->percent;
|
||||
cshift->time = cl.time;
|
||||
cshift->time = vs->time;
|
||||
}
|
||||
|
||||
// calculate view angle kicks
|
||||
|
@ -310,15 +332,16 @@ V_cshift_f (void)
|
|||
When you run over an item, the server sends this command
|
||||
*/
|
||||
static void
|
||||
V_BonusFlash_f (void)
|
||||
V_BonusFlash_f (void *data)
|
||||
{
|
||||
viewstate_t *vs = data;
|
||||
if (!cl_cshift_bonus->int_val
|
||||
&& !(cl.sv_cshifts & INFO_CSHIFT_BONUS))
|
||||
&& !(vs->force_cshifts & INFO_CSHIFT_BONUS))
|
||||
return;
|
||||
|
||||
cl.cshifts[CSHIFT_BONUS] = cshift_bonus;
|
||||
cl.cshifts[CSHIFT_BONUS].initialpct = cl.cshifts[CSHIFT_BONUS].percent;
|
||||
cl.cshifts[CSHIFT_BONUS].time = cl.time;
|
||||
vs->cshifts[CSHIFT_BONUS] = cshift_bonus;
|
||||
vs->cshifts[CSHIFT_BONUS].initialpct = vs->cshifts[CSHIFT_BONUS].percent;
|
||||
vs->cshifts[CSHIFT_BONUS].time = vs->time;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -327,69 +350,34 @@ V_BonusFlash_f (void)
|
|||
Underwater, lava, etc each has a color shift
|
||||
*/
|
||||
void
|
||||
V_SetContentsColor (int contents)
|
||||
V_SetContentsColor (viewstate_t *vs, int contents)
|
||||
{
|
||||
if (!cl_cshift_contents->int_val
|
||||
&& !(cl.sv_cshifts & INFO_CSHIFT_CONTENTS)) {
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||
&& !(vs->force_cshifts & INFO_CSHIFT_CONTENTS)) {
|
||||
vs->cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (contents) {
|
||||
case CONTENTS_EMPTY:
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||
vs->cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||
break;
|
||||
case CONTENTS_LAVA:
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_lava;
|
||||
vs->cshifts[CSHIFT_CONTENTS] = cshift_lava;
|
||||
break;
|
||||
case CONTENTS_SOLID:
|
||||
case CONTENTS_SLIME:
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_slime;
|
||||
vs->cshifts[CSHIFT_CONTENTS] = cshift_slime;
|
||||
break;
|
||||
default:
|
||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_water;
|
||||
vs->cshifts[CSHIFT_CONTENTS] = cshift_water;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
V_CalcPowerupCshift (void)
|
||||
V_CalcPowerupCshift (viewstate_t *vs)
|
||||
{
|
||||
if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD
|
||||
|| IT_INVULNERABILITY))
|
||||
{
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY &&
|
||||
cl.stats[STAT_ITEMS] & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.stats[STAT_ITEMS] & IT_QUAD) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 30;
|
||||
} else if (cl.stats[STAT_ITEMS] & IT_SUIT) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 20;
|
||||
} else if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) {
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 100;
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 100;
|
||||
} else {
|
||||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
vs->cshifts[CSHIFT_POWERUP] = powerup[vs->powerup_index];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -399,22 +387,22 @@ V_CalcPowerupCshift (void)
|
|||
a bit, but otherwise this is his code. --KB
|
||||
*/
|
||||
static void
|
||||
V_CalcBlend (void)
|
||||
V_CalcBlend (viewstate_t *vs)
|
||||
{
|
||||
float a2, a3;
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
a2 = cl.cshifts[i].percent / 255.0;
|
||||
a2 = vs->cshifts[i].percent / 255.0;
|
||||
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min (a2, 1.0);
|
||||
r += (cl.cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (cl.cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (cl.cshifts[i].destcolor[2] - b) * a2;
|
||||
r += (vs->cshifts[i].destcolor[0] - r) * a2;
|
||||
g += (vs->cshifts[i].destcolor[1] - g) * a2;
|
||||
b += (vs->cshifts[i].destcolor[2] - b) * a2;
|
||||
|
||||
a3 = (1.0 - a) * (1.0 - a2);
|
||||
a = 1.0 - a3;
|
||||
|
@ -428,19 +416,19 @@ V_CalcBlend (void)
|
|||
b *= a2;
|
||||
}
|
||||
|
||||
r_data->vid->cshift_color[0] = min (r, 255.0) / 255.0;
|
||||
r_data->vid->cshift_color[1] = min (g, 255.0) / 255.0;
|
||||
r_data->vid->cshift_color[2] = min (b, 255.0) / 255.0;
|
||||
r_data->vid->cshift_color[3] = bound (0.0, a, 1.0);
|
||||
vs->cshift_color[0] = min (r, 255.0) / 255.0;
|
||||
vs->cshift_color[1] = min (g, 255.0) / 255.0;
|
||||
vs->cshift_color[2] = min (b, 255.0) / 255.0;
|
||||
vs->cshift_color[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
static void
|
||||
V_DropCShift (cshift_t *cs, float droprate)
|
||||
V_DropCShift (cshift_t *cs, double time, float droprate)
|
||||
{
|
||||
if (cs->time < 0) {
|
||||
cs->percent = 0;
|
||||
} else {
|
||||
cs->percent = cs->initialpct - (cl.time - cs->time) * droprate;
|
||||
cs->percent = cs->initialpct - (time - cs->time) * droprate;
|
||||
if (cs->percent <= 0) {
|
||||
cs->percent = 0;
|
||||
cs->time = -1;
|
||||
|
@ -449,56 +437,56 @@ V_DropCShift (cshift_t *cs, float droprate)
|
|||
}
|
||||
|
||||
void
|
||||
V_PrepBlend (void)
|
||||
V_PrepBlend (viewstate_t *vs)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (cl_cshift_powerup->int_val
|
||||
|| (cl.sv_cshifts & INFO_CSHIFT_POWERUP))
|
||||
V_CalcPowerupCshift ();
|
||||
|| (vs->force_cshifts & INFO_CSHIFT_POWERUP))
|
||||
V_CalcPowerupCshift (vs);
|
||||
|
||||
r_data->vid->cshift_changed = false;
|
||||
qboolean cshift_changed = false;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent) {
|
||||
r_data->vid->cshift_changed = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
if (vs->cshifts[i].percent != vs->prev_cshifts[i].percent) {
|
||||
cshift_changed = true;
|
||||
vs->prev_cshifts[i].percent = vs->cshifts[i].percent;
|
||||
}
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
if (vs->cshifts[i].destcolor[j] != vs->prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
r_data->vid->cshift_changed = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
cshift_changed = true;
|
||||
vs->prev_cshifts[i].destcolor[j] = vs->cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
V_DropCShift (&cl.cshifts[CSHIFT_DAMAGE], 150);
|
||||
V_DropCShift (&vs->cshifts[CSHIFT_DAMAGE], vs->time, 150);
|
||||
// drop the bonus value
|
||||
V_DropCShift (&cl.cshifts[CSHIFT_BONUS], 100);
|
||||
V_DropCShift (&vs->cshifts[CSHIFT_BONUS], vs->time, 100);
|
||||
|
||||
if (!r_data->vid->cshift_changed && !r_data->vid->recalc_refdef)
|
||||
if (!cshift_changed)
|
||||
return;
|
||||
|
||||
V_CalcBlend ();
|
||||
V_CalcBlend (vs);
|
||||
}
|
||||
|
||||
/* VIEW RENDERING */
|
||||
|
||||
static void
|
||||
CalcGunAngle (void)
|
||||
CalcGunAngle (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t rotation = r_data->refdef->viewrotation;
|
||||
vec4f_t rotation = Transform_GetWorldRotation (vs->camera_transform);
|
||||
//FIXME make child of camera
|
||||
Transform_SetWorldRotation (cl.viewent.transform, rotation);
|
||||
Transform_SetWorldRotation (vs->weapon_entity->transform, rotation);
|
||||
}
|
||||
|
||||
static void
|
||||
V_BoundOffsets (void)
|
||||
V_BoundOffsets (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t offset = r_data->refdef->viewposition
|
||||
- cl.viewstate.origin;
|
||||
vec4f_t offset = Transform_GetWorldPosition (vs->camera_transform);
|
||||
offset -= vs->player_origin;
|
||||
|
||||
// absolutely bound refresh reletive to entity clipping hull
|
||||
// so the view can never be inside a solid wall
|
||||
|
@ -506,17 +494,18 @@ V_BoundOffsets (void)
|
|||
offset[0] = bound (-14, offset[0], 14);
|
||||
offset[1] = bound (-14, offset[1], 14);
|
||||
offset[2] = bound (-22, offset[2], 30);
|
||||
r_data->refdef->viewposition = cl.viewstate.origin + offset;
|
||||
Transform_SetWorldPosition (vs->camera_transform,
|
||||
vs->player_origin + offset);
|
||||
}
|
||||
|
||||
static vec4f_t
|
||||
idle_quat (vec4f_t axis, cvar_t *cycle, cvar_t *level)
|
||||
idle_quat (vec4f_t axis, cvar_t *cycle, cvar_t *level, double time)
|
||||
{
|
||||
vec4f_t identity = { 0, 0, 0, 1 };
|
||||
if (!level || !cycle) {
|
||||
return identity;
|
||||
}
|
||||
float scale = sin (cl.time * cycle->value);
|
||||
float scale = sin (time * cycle->value);
|
||||
float ang = scale * level->value * v_idlescale->value;
|
||||
float c = cos (ang * M_PI / 360);
|
||||
float s = sin (ang * M_PI / 360);
|
||||
|
@ -529,23 +518,24 @@ idle_quat (vec4f_t axis, cvar_t *cycle, cvar_t *level)
|
|||
Idle swaying
|
||||
*/
|
||||
static void
|
||||
V_AddIdle (void)
|
||||
V_AddIdle (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t roll = idle_quat ((vec4f_t) { 1, 0, 0, 0},
|
||||
v_iroll_cycle, v_iroll_level);
|
||||
v_iroll_cycle, v_iroll_level, vs->time);
|
||||
vec4f_t pitch = idle_quat ((vec4f_t) { 0, 1, 0, 0},
|
||||
v_ipitch_cycle, v_ipitch_level);
|
||||
v_ipitch_cycle, v_ipitch_level, vs->time);
|
||||
vec4f_t yaw = idle_quat ((vec4f_t) { 0, 0, 1, 0},
|
||||
v_iyaw_cycle, v_iyaw_level);
|
||||
v_iyaw_cycle, v_iyaw_level, vs->time);
|
||||
vec4f_t rot = normalf (qmulf (yaw, qmulf (pitch, roll)));
|
||||
|
||||
// rotate the view
|
||||
r_data->refdef->viewrotation = qmulf (rot, r_data->refdef->viewrotation);
|
||||
vec4f_t rotation = Transform_GetWorldRotation (vs->camera_transform);
|
||||
Transform_SetWorldRotation (vs->camera_transform, qmulf (rot, rotation));
|
||||
|
||||
// counter-rotate the weapon
|
||||
rot = qmulf (qconjf (rot),
|
||||
Transform_GetWorldRotation (cl.viewent.transform));
|
||||
Transform_SetWorldRotation (cl.viewent.transform, rot);
|
||||
Transform_GetWorldRotation (vs->weapon_entity->transform));
|
||||
Transform_SetWorldRotation (vs->weapon_entity->transform, rot);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -554,10 +544,10 @@ V_AddIdle (void)
|
|||
Roll is induced by movement and damage
|
||||
*/
|
||||
static void
|
||||
V_CalcViewRoll (void)
|
||||
V_CalcViewRoll (viewstate_t *vs)
|
||||
{
|
||||
vec_t *angles = cl.viewstate.angles;
|
||||
vec4f_t velocity = cl.viewstate.velocity;
|
||||
vec_t *angles = vs->player_angles;
|
||||
vec4f_t velocity = vs->velocity;
|
||||
vec3_t ang = { };
|
||||
|
||||
ang[ROLL] = V_CalcRoll (angles, velocity);
|
||||
|
@ -565,164 +555,164 @@ V_CalcViewRoll (void)
|
|||
if (v_dmg_time > 0) {
|
||||
ang[ROLL] += v_dmg_time / v_kicktime->value * v_dmg_roll;
|
||||
ang[PITCH] += v_dmg_time / v_kicktime->value * v_dmg_pitch;
|
||||
v_dmg_time -= cl.viewstate.frametime;
|
||||
v_dmg_time -= vs->frametime;
|
||||
}
|
||||
|
||||
if (cl.viewstate.flags & VF_DEAD) { // VF_GIB will also set VF_DEAD
|
||||
if (vs->flags & VF_DEAD) { // VF_GIB will also set VF_DEAD
|
||||
ang[ROLL] = 80; // dead view angle
|
||||
}
|
||||
|
||||
vec4f_t rot;
|
||||
AngleQuat (ang, &rot[0]);//FIXME
|
||||
r_data->refdef->viewrotation = qmulf (r_data->refdef->viewrotation, rot);
|
||||
AngleQuat (ang, (vec_t*)&rot);//FIXME
|
||||
vec4f_t rotation = Transform_GetWorldRotation (vs->camera_transform);
|
||||
Transform_SetWorldRotation (vs->camera_transform, qmulf (rotation, rot));
|
||||
}
|
||||
|
||||
static void
|
||||
V_CalcIntermissionRefdef (void)
|
||||
V_CalcIntermissionRefdef (viewstate_t *vs)
|
||||
{
|
||||
entity_t *ent = &cl_entities[cl.viewentity];
|
||||
// vs->player_entity is the player model (visible when out of body)
|
||||
entity_t *ent = vs->player_entity;
|
||||
entity_t *view;
|
||||
float old;
|
||||
vec4f_t origin = Transform_GetWorldPosition (ent->transform);
|
||||
vec4f_t rotation = Transform_GetWorldRotation (ent->transform);
|
||||
|
||||
// view is the weapon model (visible only from inside body)
|
||||
view = &cl.viewent;
|
||||
view = vs->weapon_entity;
|
||||
|
||||
r_data->refdef->viewposition = origin;
|
||||
r_data->refdef->viewrotation = rotation;
|
||||
view->renderer.model = NULL;
|
||||
Transform_SetWorldPosition (vs->camera_transform, origin);
|
||||
Transform_SetWorldRotation (vs->camera_transform, rotation);
|
||||
view->renderer.model = NULL;
|
||||
|
||||
// always idle in intermission
|
||||
old = v_idlescale->value;
|
||||
Cvar_SetValue (v_idlescale, 1);
|
||||
V_AddIdle ();
|
||||
V_AddIdle (vs);
|
||||
Cvar_SetValue (v_idlescale, old);
|
||||
}
|
||||
|
||||
static void
|
||||
V_CalcRefdef (void)
|
||||
V_CalcRefdef (viewstate_t *vs)
|
||||
{
|
||||
// view is the weapon model (visible only from inside body)
|
||||
entity_t *view = &cl.viewent;
|
||||
entity_t *view = vs->weapon_entity;
|
||||
float bob;
|
||||
static float oldz = 0;
|
||||
vec4f_t forward = {}, right = {}, up = {};
|
||||
vec4f_t origin = cl.viewstate.origin;
|
||||
vec_t *viewangles = cl.viewstate.angles;
|
||||
vec4f_t origin = vs->player_origin;
|
||||
vec_t *viewangles = vs->player_angles;
|
||||
|
||||
V_DriftPitch ();
|
||||
V_DriftPitch (vs);
|
||||
|
||||
bob = V_CalcBob ();
|
||||
bob = V_CalcBob (vs);
|
||||
|
||||
// refresh position
|
||||
r_data->refdef->viewposition = origin;
|
||||
r_data->refdef->viewposition[2] += cl.viewheight + bob;
|
||||
origin[2] += vs->height + bob;
|
||||
|
||||
// never let it sit exactly on a node line, because a water plane can
|
||||
// disappear when viewed with the eye exactly on it.
|
||||
// server protocol specifies to only 1/8 pixel, so add 1/16 in each axis
|
||||
r_data->refdef->viewposition += (vec4f_t) { 1.0/16, 1.0/16, 1.0/16, 0};
|
||||
origin += (vec4f_t) { 1.0/16, 1.0/16, 1.0/16, 0};
|
||||
|
||||
AngleQuat (cl.viewstate.angles, &r_data->refdef->viewrotation[0]);//FIXME
|
||||
V_CalcViewRoll ();
|
||||
V_AddIdle ();
|
||||
vec4f_t rotation;
|
||||
AngleQuat (vs->player_angles, (vec_t*)&rotation);//FIXME
|
||||
Transform_SetWorldRotation (vs->camera_transform, rotation);
|
||||
V_CalcViewRoll (vs);
|
||||
V_AddIdle (vs);
|
||||
|
||||
// offsets
|
||||
//FIXME semi-duplicates AngleQuat (also, vec3_t vs vec4f_t)
|
||||
AngleVectors (viewangles, &forward[0], &right[0], &up[0]);
|
||||
AngleVectors (viewangles, (vec_t*)&forward, (vec_t*)&right, (vec_t*)&up);//FIXME
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
// FIXME check for dead
|
||||
if (cl.maxclients == 1) {
|
||||
r_data->refdef->viewposition += scr_ofsx->value * forward
|
||||
if (vs->voffs_enabled) {
|
||||
origin += scr_ofsx->value * forward
|
||||
+ scr_ofsy->value * right
|
||||
+ scr_ofsz->value * up;
|
||||
}
|
||||
|
||||
V_BoundOffsets ();
|
||||
V_BoundOffsets (vs);
|
||||
|
||||
// set up gun position
|
||||
CalcGunAngle ();
|
||||
vec4f_t gun_origin = vs->player_origin;
|
||||
CalcGunAngle (vs);
|
||||
|
||||
origin += (vec4f_t) { 0, 0, cl.viewheight, 0 };
|
||||
origin += forward * bob * 0.4f + (vec4f_t) { 0, 0, bob, 0 };
|
||||
gun_origin += (vec4f_t) { 0, 0, vs->height, 0 };
|
||||
gun_origin += forward * bob * 0.4f + (vec4f_t) { 0, 0, bob, 0 };
|
||||
|
||||
// fudge position around to keep amount of weapon visible
|
||||
// roughly equal with different FOV
|
||||
if (hud_sbar->int_val == 0 && r_data->scr_viewsize->int_val >= 100) {
|
||||
;
|
||||
} else if (r_data->scr_viewsize->int_val == 110) {
|
||||
origin += (vec4f_t) { 0, 0, 1, 0};
|
||||
gun_origin += (vec4f_t) { 0, 0, 1, 0};
|
||||
} else if (r_data->scr_viewsize->int_val == 100) {
|
||||
origin += (vec4f_t) { 0, 0, 2, 0};
|
||||
gun_origin += (vec4f_t) { 0, 0, 2, 0};
|
||||
} else if (r_data->scr_viewsize->int_val == 90) {
|
||||
origin += (vec4f_t) { 0, 0, 1, 0};
|
||||
gun_origin += (vec4f_t) { 0, 0, 1, 0};
|
||||
} else if (r_data->scr_viewsize->int_val == 80) {
|
||||
origin += (vec4f_t) { 0, 0, 0.5, 0};
|
||||
gun_origin += (vec4f_t) { 0, 0, 0.5, 0};
|
||||
}
|
||||
|
||||
model_t *model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
||||
if (cl.viewstate.flags & (VF_GIB | VF_DEAD)) {
|
||||
model_t *model = vs->weapon_model;
|
||||
if (vs->flags & (VF_GIB | VF_DEAD)) {
|
||||
model = NULL;
|
||||
}
|
||||
if (view->renderer.model != model) {
|
||||
view->animation.pose2 = -1;
|
||||
}
|
||||
view->renderer.model = model;
|
||||
view->animation.frame = cl.viewstate.weaponframe;
|
||||
view->animation.frame = vs->weaponframe;
|
||||
view->renderer.skin = 0;
|
||||
|
||||
// set up the refresh position
|
||||
r_data->refdef->viewrotation = qmulf (cl.viewstate.punchangle,
|
||||
r_data->refdef->viewrotation);
|
||||
Transform_SetWorldRotation (vs->camera_transform,
|
||||
qmulf (vs->punchangle, rotation));
|
||||
|
||||
// smooth out stair step ups
|
||||
if ((cl.viewstate.onground != -1) && (origin[2] - oldz > 0)) {
|
||||
if ((vs->onground != -1) && (gun_origin[2] - oldz > 0)) {
|
||||
float steptime;
|
||||
|
||||
steptime = cl.viewstate.frametime;
|
||||
steptime = vs->frametime;
|
||||
|
||||
oldz += steptime * 80;
|
||||
if (oldz > origin[2])
|
||||
oldz = origin[2];
|
||||
if (origin[2] - oldz > 12)
|
||||
oldz = origin[2] - 12;
|
||||
r_data->refdef->viewposition[2] += oldz - origin[2];
|
||||
origin[2] += oldz - origin[2];
|
||||
if (oldz > gun_origin[2])
|
||||
oldz = gun_origin[2];
|
||||
if (gun_origin[2] - oldz > 12)
|
||||
oldz = gun_origin[2] - 12;
|
||||
origin[2] += oldz - gun_origin[2];
|
||||
gun_origin[2] += oldz - gun_origin[2];
|
||||
} else {
|
||||
oldz = origin[2];
|
||||
oldz = gun_origin[2];
|
||||
}
|
||||
Transform_SetWorldPosition (vs->camera_transform, origin);
|
||||
{
|
||||
// FIXME sort out the alias model specific negation
|
||||
vec3_t ang = {-viewangles[0], viewangles[1], viewangles[2]};
|
||||
CL_TransformEntity (view, 1, ang, origin);
|
||||
}
|
||||
|
||||
if (cl.chase && chase_active->int_val) {
|
||||
Chase_Update ();
|
||||
CL_TransformEntity (view, 1, ang, gun_origin);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DropPunchAngle (void)
|
||||
DropPunchAngle (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t punch = cl.viewstate.punchangle;
|
||||
vec4f_t punch = vs->punchangle;
|
||||
float ps = magnitude3f (punch)[0];
|
||||
if (ps < 1e-3) {
|
||||
// < 0.2 degree rotation, not worth worrying about
|
||||
//ensure the quaternion is normalized
|
||||
cl.viewstate.punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
vs->punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
return;
|
||||
}
|
||||
float pc = punch[3];
|
||||
float ds = 0.0871557427 * cl.viewstate.frametime;
|
||||
float pc = punch[3];
|
||||
float ds = 0.0871557427 * vs->frametime;
|
||||
float dc = sqrt (1 - ds * ds);
|
||||
float s = ps * dc - pc * ds;
|
||||
float c = pc * dc + ps * ds;
|
||||
if (s <= 0 || c >= 1) {
|
||||
cl.viewstate.punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
vs->punchangle = (vec4f_t) { 0, 0, 0, 1 };
|
||||
} else {
|
||||
punch *= s / ps;
|
||||
punch[3] = c;
|
||||
|
@ -736,44 +726,44 @@ DropPunchAngle (void)
|
|||
the entity origin, so any view position inside that will be valid
|
||||
*/
|
||||
void
|
||||
V_RenderView (void)
|
||||
V_RenderView (viewstate_t *vs)
|
||||
{
|
||||
if (cls.state != ca_active) {
|
||||
r_data->refdef->viewposition = (vec4f_t) { 0, 0, 0, 1 };
|
||||
r_data->refdef->viewrotation = (vec4f_t) { 0, 0, 0, 1 };
|
||||
if (!vs->active) {
|
||||
vec4f_t base = { 0, 0, 0, 1 };
|
||||
Transform_SetWorldPosition (vs->camera_transform, base);
|
||||
Transform_SetWorldRotation (vs->camera_transform, base);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl.viewstate.flags & VF_GIB) {
|
||||
cl.viewheight = 8; // gib view height
|
||||
} else if (cl.viewstate.flags & VF_DEAD) {
|
||||
cl.viewheight = -16; // corpse view height
|
||||
} else {
|
||||
cl.viewheight = DEFAULT_VIEWHEIGHT; // view height
|
||||
if (cl.stdver)
|
||||
cl.viewheight = cl.stats[STAT_VIEWHEIGHT];
|
||||
if (vs->decay_punchangle) {
|
||||
DropPunchAngle (vs);
|
||||
}
|
||||
|
||||
DropPunchAngle ();
|
||||
if (cl.intermission) { // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
if (vs->intermission) { // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef (vs);
|
||||
} else {
|
||||
V_CalcRefdef ();
|
||||
if (vs->chase && chase_active->int_val) {
|
||||
Chase_Update (vs->chasestate);
|
||||
} else {
|
||||
V_CalcRefdef (vs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
V_Init (void)
|
||||
V_Init (viewstate_t *viewstate)
|
||||
{
|
||||
Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you "
|
||||
"pick up an item");
|
||||
Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's "
|
||||
Cmd_AddDataCommand ("bf", V_BonusFlash_f, viewstate,
|
||||
"Background flash, used when you pick up an item");
|
||||
Cmd_AddDataCommand ("centerview", V_StartPitchDrift_f, viewstate,
|
||||
"Centers the player's "
|
||||
"view ahead after +lookup or +lookdown\n"
|
||||
"Will not work while mlook is active or freelook is 1.");
|
||||
Cmd_AddCommand ("v_cshift", V_cshift_f, "This adjusts all of the colors "
|
||||
"currently being displayed.\n"
|
||||
"Used when you are underwater, hit, have the Ring of "
|
||||
"Shadows, or Quad Damage. (v_cshift r g b intensity)");
|
||||
|
||||
viewstate->camera_transform = Transform_New (cl_world.scene, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -827,4 +817,13 @@ V_Init_Cvars (void)
|
|||
"How much you lean when hit");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
|
||||
"How much you look up when hit");
|
||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
|
||||
"Show bonus flash on item pickup");
|
||||
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE,
|
||||
NULL, "Shift view colors for contents "
|
||||
"(water, slime, etc)");
|
||||
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL,
|
||||
"Shift view colors on damage");
|
||||
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL,
|
||||
"Shift view colors for powerups");
|
||||
}
|
223
libs/client/cl_world.c
Normal file
223
libs/client/cl_world.c
Normal file
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
cl_entities.c
|
||||
|
||||
Client side entity management
|
||||
|
||||
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2012/6/28
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/idparse.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/plist.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h" //FIXME
|
||||
|
||||
#include "client/entities.h"
|
||||
#include "client/temp_entities.h"
|
||||
#include "client/world.h"
|
||||
|
||||
worldscene_t cl_world = {
|
||||
.models = DARRAY_STATIC_INIT (32),
|
||||
};
|
||||
|
||||
void
|
||||
CL_World_Init (void)
|
||||
{
|
||||
cl_world.scene = Scene_NewScene ();
|
||||
}
|
||||
|
||||
void
|
||||
CL_ParseBaseline (qmsg_t *msg, entity_state_t *baseline, int version)
|
||||
{
|
||||
int bits = 0;
|
||||
|
||||
if (version == 2)
|
||||
bits = MSG_ReadByte (msg);
|
||||
|
||||
if (bits & B_LARGEMODEL)
|
||||
baseline->modelindex = MSG_ReadShort (msg);
|
||||
else
|
||||
baseline->modelindex = MSG_ReadByte (msg);
|
||||
|
||||
if (bits & B_LARGEFRAME)
|
||||
baseline->frame = MSG_ReadShort (msg);
|
||||
else
|
||||
baseline->frame = MSG_ReadByte (msg);
|
||||
|
||||
baseline->colormap = MSG_ReadByte (msg);
|
||||
baseline->skinnum = MSG_ReadByte (msg);
|
||||
|
||||
MSG_ReadCoordAngleV (msg, (vec_t*)&baseline->origin, baseline->angles);//FIXME
|
||||
baseline->origin[3] = 1;//FIXME
|
||||
|
||||
if (bits & B_ALPHA)
|
||||
baseline->alpha = MSG_ReadByte (msg);
|
||||
else
|
||||
baseline->alpha = 255;//FIXME alpha
|
||||
baseline->scale = 16;
|
||||
baseline->glow_size = 0;
|
||||
baseline->glow_color = 254;
|
||||
baseline->colormod = 255;
|
||||
}
|
||||
|
||||
void
|
||||
CL_ParseStatic (qmsg_t *msg, int version)
|
||||
{
|
||||
entity_t *ent;
|
||||
entity_state_t es;
|
||||
|
||||
ent = Scene_CreateEntity (cl_world.scene);
|
||||
CL_Init_Entity (ent);
|
||||
|
||||
CL_ParseBaseline (msg, &es, version);
|
||||
DARRAY_APPEND (&cl_static_entities, es);
|
||||
|
||||
// copy it to the current state
|
||||
ent->renderer.model = cl_world.models.a[es.modelindex];
|
||||
ent->animation.frame = es.frame;
|
||||
ent->renderer.skinnum = es.skinnum;
|
||||
|
||||
CL_TransformEntity (ent, es.scale / 16.0, es.angles, es.origin);
|
||||
|
||||
R_AddEfrags (&cl_world.worldmodel->brush, ent);
|
||||
}
|
||||
|
||||
static void
|
||||
map_cfg (const char *mapname, int all)
|
||||
{
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
cbuf_t *cbuf = Cbuf_New (&id_interp);
|
||||
QFile *f;
|
||||
|
||||
QFS_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
f = QFS_FOpenFile (name);
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (cbuf, name, 1);
|
||||
} else {
|
||||
Cmd_Exec_File (cbuf, "maps_default.cfg", 1);
|
||||
}
|
||||
if (all) {
|
||||
Cbuf_Execute_Stack (cbuf);
|
||||
} else {
|
||||
Cbuf_Execute_Sets (cbuf);
|
||||
}
|
||||
free (name);
|
||||
Cbuf_Delete (cbuf);
|
||||
}
|
||||
|
||||
void
|
||||
CL_MapCfg (const char *mapname)
|
||||
{
|
||||
map_cfg (mapname, 0);
|
||||
}
|
||||
|
||||
static plitem_t *
|
||||
map_ent (const char *mapname)
|
||||
{
|
||||
static progs_t edpr;
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
char *buf;
|
||||
plitem_t *edicts = 0;
|
||||
QFile *ent_file;
|
||||
|
||||
QFS_StripExtension (mapname, name);
|
||||
strcat (name, ".ent");
|
||||
ent_file = QFS_VOpenFile (name, 0, cl_world.models.a[1]->vpath);
|
||||
if ((buf = (char *) QFS_LoadFile (ent_file, 0))) {
|
||||
edicts = ED_Parse (&edpr, buf);
|
||||
free (buf);
|
||||
} else {
|
||||
edicts = ED_Parse (&edpr, cl_world.models.a[1]->brush.entities);
|
||||
}
|
||||
free (name);
|
||||
return edicts;
|
||||
}
|
||||
|
||||
static void
|
||||
CL_LoadSky (const char *name)
|
||||
{
|
||||
plitem_t *worldspawn = cl_world.worldspawn;
|
||||
plitem_t *item;
|
||||
static const char *sky_keys[] = {
|
||||
"sky", // Q2/DarkPlaces
|
||||
"skyname", // old QF
|
||||
"qlsky", // QuakeLives
|
||||
0
|
||||
};
|
||||
|
||||
if (!name) {
|
||||
if (!worldspawn) {
|
||||
r_funcs->R_LoadSkys (0);
|
||||
return;
|
||||
}
|
||||
for (const char **key = sky_keys; *key; key++) {
|
||||
if ((item = PL_ObjectForKey (cl_world.worldspawn, *key))) {
|
||||
name = PL_String (item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
r_funcs->R_LoadSkys (name);
|
||||
}
|
||||
|
||||
void
|
||||
CL_World_NewMap (const char *mapname, const char *skyname)
|
||||
{
|
||||
cl_static_entities.size = 0;
|
||||
r_funcs->R_NewMap (cl_world.worldmodel,
|
||||
cl_world.models.a, cl_world.models.size);
|
||||
if (cl_world.models.a[1] && cl_world.models.a[1]->brush.entities) {
|
||||
if (cl_world.edicts) {
|
||||
PL_Free (cl_world.edicts);
|
||||
}
|
||||
cl_world.edicts = map_ent (mapname);
|
||||
if (cl_world.edicts) {
|
||||
cl_world.worldspawn = PL_ObjectAtIndex (cl_world.edicts, 0);
|
||||
CL_LoadSky (skyname);
|
||||
Fog_ParseWorldspawn (cl_world.worldspawn);
|
||||
}
|
||||
}
|
||||
map_cfg (mapname, 1);
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
chase.h
|
||||
hud.c
|
||||
|
||||
@description@
|
||||
Heads-up display bar
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -24,14 +25,12 @@
|
|||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef __chase_h
|
||||
#define __chase_h
|
||||
#include "QF/cvar.h"
|
||||
|
||||
extern struct cvar_s *chase_active;
|
||||
|
||||
void Chase_Init_Cvars (void);
|
||||
void Chase_Reset (void);
|
||||
void Chase_Update (void);
|
||||
|
||||
#endif // __chase_h
|
||||
cvar_t *hud_sbar;
|
||||
cvar_t *hud_scoreboard_gravity;
|
||||
cvar_t *hud_swap;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue