diff --git a/Makefile b/Makefile index b8e45925..6ddbd995 100644 --- a/Makefile +++ b/Makefile @@ -1156,6 +1156,7 @@ REFSOFT_OBJS_ := \ src/client/refresh/soft/sw_scan.o \ src/client/refresh/soft/sw_sprite.o \ src/client/refresh/soft/sw_surf.o \ + src/client/refresh/soft/sw_warp.o \ src/client/refresh/files/light.o \ src/client/refresh/files/surf.o \ src/client/refresh/files/models.o \ diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index 664e2ab1..69c8e769 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -17,10 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * + * ======================================================================= + * + * Local header for the refresher. + * + * ======================================================================= */ -#ifndef __R_LOCAL__ -#define __R_LOCAL__ +#ifndef REF_LOCAL_H +#define REF_LOCAL_H #include #include @@ -311,6 +316,7 @@ extern affinetridesc_t r_affinetridesc; void D_WarpScreen(void); void R_PolysetUpdateTables(void); +void RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis); //=======================================================================// @@ -395,6 +401,7 @@ extern cvar_t *sw_gunzposition; extern cvar_t *r_validation; extern cvar_t *r_retexturing; extern cvar_t *r_scale8bittextures; +extern cvar_t *r_palettedtexture; extern cvar_t *r_fullbright; extern cvar_t *r_lefthand; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 35c153fd..6896feaf 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -55,8 +55,6 @@ refimport_t ri; byte d_8to24table[256 * 4]; -vec3_t skyaxis; - refdef_t r_newrefdef; model_t *r_worldmodel; @@ -174,7 +172,7 @@ static cvar_t *vid_fullscreen; static cvar_t *vid_gamma; static cvar_t *r_lockpvs; -static cvar_t *r_palettedtexture; +cvar_t *r_palettedtexture; cvar_t *r_cull; // sw_vars.c @@ -1730,43 +1728,6 @@ R_DrawBeam(const entity_t *e) //=================================================================== -/* -============ -RE_SetSky -============ -*/ -// 3dstudio environment map names -static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; -static const int r_skysideimage[6] = {5, 2, 4, 1, 0, 3}; -extern mtexinfo_t r_skytexinfo[6]; - -static void -RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) -{ - char skyname[MAX_QPATH]; - int i; - - Q_strlcpy (skyname, name, sizeof(skyname)); - VectorCopy (axis, skyaxis); - - for (i=0 ; i<6 ; i++) - { - image_t *image; - - image = (image_t *)GetSkyImage(skyname, suf[r_skysideimage[i]], - r_palettedtexture->value, (findimage_t)R_FindImage); - - if (!image) - { - R_Printf(PRINT_ALL, "%s: can't load %s:%s sky\n", - __func__, skyname, suf[r_skysideimage[i]]); - image = r_notexture_mip; - } - - r_skytexinfo[i].image = image; - } -} - /* =============== RE_RegisterSkin diff --git a/src/client/refresh/soft/sw_warp.c b/src/client/refresh/soft/sw_warp.c new file mode 100644 index 00000000..609723a3 --- /dev/null +++ b/src/client/refresh/soft/sw_warp.c @@ -0,0 +1,61 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * Warps. Used on water surfaces und for skybox rotation. + * + * ======================================================================= + */ + +#include "header/local.h" + +static vec3_t skyaxis; + +/* 3dstudio environment map names */ +static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; +static const int r_skysideimage[6] = {5, 2, 4, 1, 0, 3}; +extern mtexinfo_t r_skytexinfo[6]; + +void +RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) +{ + char skyname[MAX_QPATH]; + int i; + + Q_strlcpy(skyname, name, sizeof(skyname)); + VectorCopy(axis, skyaxis); + + for (i = 0; i < 6; i++) + { + image_t *image; + + image = (image_t *)GetSkyImage(skyname, suf[r_skysideimage[i]], + r_palettedtexture->value, (findimage_t)R_FindImage); + + if (!image) + { + R_Printf(PRINT_ALL, "%s: can't load %s:%s sky\n", + __func__, skyname, suf[r_skysideimage[i]]); + image = r_notexture_mip; + } + + r_skytexinfo[i].image = image; + } +}