soft: move RE_SetSky to warp file

Same structure as other renders have
This commit is contained in:
Denis Pauk 2023-11-18 17:51:52 +02:00
parent 36c7528cc5
commit 38f2442d84
4 changed files with 72 additions and 42 deletions

View File

@ -1156,6 +1156,7 @@ REFSOFT_OBJS_ := \
src/client/refresh/soft/sw_scan.o \ src/client/refresh/soft/sw_scan.o \
src/client/refresh/soft/sw_sprite.o \ src/client/refresh/soft/sw_sprite.o \
src/client/refresh/soft/sw_surf.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/light.o \
src/client/refresh/files/surf.o \ src/client/refresh/files/surf.o \
src/client/refresh/files/models.o \ src/client/refresh/files/models.o \

View File

@ -17,10 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA. * 02111-1307, USA.
* *
* =======================================================================
*
* Local header for the refresher.
*
* =======================================================================
*/ */
#ifndef __R_LOCAL__ #ifndef REF_LOCAL_H
#define __R_LOCAL__ #define REF_LOCAL_H
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -311,6 +316,7 @@ extern affinetridesc_t r_affinetridesc;
void D_WarpScreen(void); void D_WarpScreen(void);
void R_PolysetUpdateTables(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_validation;
extern cvar_t *r_retexturing; extern cvar_t *r_retexturing;
extern cvar_t *r_scale8bittextures; extern cvar_t *r_scale8bittextures;
extern cvar_t *r_palettedtexture;
extern cvar_t *r_fullbright; extern cvar_t *r_fullbright;
extern cvar_t *r_lefthand; extern cvar_t *r_lefthand;

View File

@ -55,8 +55,6 @@ refimport_t ri;
byte d_8to24table[256 * 4]; byte d_8to24table[256 * 4];
vec3_t skyaxis;
refdef_t r_newrefdef; refdef_t r_newrefdef;
model_t *r_worldmodel; model_t *r_worldmodel;
@ -174,7 +172,7 @@ static cvar_t *vid_fullscreen;
static cvar_t *vid_gamma; static cvar_t *vid_gamma;
static cvar_t *r_lockpvs; static cvar_t *r_lockpvs;
static cvar_t *r_palettedtexture; cvar_t *r_palettedtexture;
cvar_t *r_cull; cvar_t *r_cull;
// sw_vars.c // 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 RE_RegisterSkin

View File

@ -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;
}
}