mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
Share same Mod_DecompressVis
This commit is contained in:
parent
ad771fdd99
commit
f9a77d2d66
17 changed files with 99 additions and 152 deletions
|
@ -454,6 +454,7 @@ set(GL1-Source
|
|||
${REF_SRC_DIR}/files/pcx.c
|
||||
${REF_SRC_DIR}/files/stb.c
|
||||
${REF_SRC_DIR}/files/wal.c
|
||||
${REF_SRC_DIR}/files/pvs.c
|
||||
${COMMON_SRC_DIR}/shared/shared.c
|
||||
${COMMON_SRC_DIR}/md4.c
|
||||
)
|
||||
|
@ -490,6 +491,7 @@ set(GL3-Source
|
|||
${REF_SRC_DIR}/files/pcx.c
|
||||
${REF_SRC_DIR}/files/stb.c
|
||||
${REF_SRC_DIR}/files/wal.c
|
||||
${REF_SRC_DIR}/files/pvs.c
|
||||
${COMMON_SRC_DIR}/shared/shared.c
|
||||
${COMMON_SRC_DIR}/md4.c
|
||||
)
|
||||
|
@ -531,6 +533,7 @@ set(SOFT-Source
|
|||
${REF_SRC_DIR}/files/pcx.c
|
||||
${REF_SRC_DIR}/files/stb.c
|
||||
${REF_SRC_DIR}/files/wal.c
|
||||
${REF_SRC_DIR}/files/pvs.c
|
||||
${COMMON_SRC_DIR}/shared/shared.c
|
||||
${COMMON_SRC_DIR}/md4.c
|
||||
)
|
||||
|
|
3
Makefile
3
Makefile
|
@ -920,6 +920,7 @@ REFGL1_OBJS_ := \
|
|||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
src/client/refresh/files/pvs.o \
|
||||
src/common/shared/shared.o \
|
||||
src/common/md4.o
|
||||
|
||||
|
@ -952,6 +953,7 @@ REFGL3_OBJS_ := \
|
|||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
src/client/refresh/files/pvs.o \
|
||||
src/common/shared/shared.o \
|
||||
src/common/md4.o
|
||||
|
||||
|
@ -986,6 +988,7 @@ REFSOFT_OBJS_ := \
|
|||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
src/client/refresh/files/pvs.o \
|
||||
src/common/shared/shared.o \
|
||||
src/common/md4.o
|
||||
|
||||
|
|
76
src/client/refresh/files/pvs.c
Normal file
76
src/client/refresh/files/pvs.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* The PVS Decompress
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include "../ref_shared.h"
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
Mod_DecompressVis
|
||||
===================
|
||||
*/
|
||||
byte *
|
||||
Mod_DecompressVis(byte *in, int row)
|
||||
{
|
||||
static byte decompressed[MAX_MAP_LEAFS / 8];
|
||||
int c;
|
||||
byte *out;
|
||||
|
||||
out = decompressed;
|
||||
|
||||
if (!in)
|
||||
{
|
||||
/* no vis info, so make all visible */
|
||||
while (row)
|
||||
{
|
||||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (*in)
|
||||
{
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
|
||||
while (c)
|
||||
{
|
||||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
}
|
||||
while (out - decompressed < row);
|
||||
|
||||
return decompressed;
|
||||
}
|
|
@ -84,51 +84,6 @@ Mod_PointInLeaf(vec3_t p, model_t *model)
|
|||
return NULL; /* never reached */
|
||||
}
|
||||
|
||||
byte *
|
||||
Mod_DecompressVis(byte *in, model_t *model)
|
||||
{
|
||||
static byte decompressed[MAX_MAP_LEAFS / 8];
|
||||
int c;
|
||||
byte *out;
|
||||
int row;
|
||||
|
||||
row = (model->vis->numclusters + 7) >> 3;
|
||||
out = decompressed;
|
||||
|
||||
if (!in)
|
||||
{
|
||||
/* no vis info, so make all visible */
|
||||
while (row)
|
||||
{
|
||||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (*in)
|
||||
{
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
|
||||
while (c)
|
||||
{
|
||||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
}
|
||||
while (out - decompressed < row);
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
byte *
|
||||
Mod_ClusterPVS(int cluster, model_t *model)
|
||||
{
|
||||
|
@ -139,7 +94,7 @@ Mod_ClusterPVS(int cluster, model_t *model)
|
|||
|
||||
return Mod_DecompressVis((byte *)model->vis +
|
||||
model->vis->bitofs[cluster][DVIS_PVS],
|
||||
model);
|
||||
(model->vis->numclusters + 7) >> 3);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -76,51 +76,6 @@ GL3_Mod_PointInLeaf(vec3_t p, gl3model_t *model)
|
|||
return NULL; /* never reached */
|
||||
}
|
||||
|
||||
static byte *
|
||||
Mod_DecompressVis(byte *in, gl3model_t *model)
|
||||
{
|
||||
static byte decompressed[MAX_MAP_LEAFS / 8];
|
||||
int c;
|
||||
byte *out;
|
||||
int row;
|
||||
|
||||
row = (model->vis->numclusters + 7) >> 3;
|
||||
out = decompressed;
|
||||
|
||||
if (!in)
|
||||
{
|
||||
/* no vis info, so make all visible */
|
||||
while (row)
|
||||
{
|
||||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (*in)
|
||||
{
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
|
||||
while (c)
|
||||
{
|
||||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
}
|
||||
while (out - decompressed < row);
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
byte*
|
||||
GL3_Mod_ClusterPVS(int cluster, gl3model_t *model)
|
||||
{
|
||||
|
@ -131,7 +86,7 @@ GL3_Mod_ClusterPVS(int cluster, gl3model_t *model)
|
|||
|
||||
return Mod_DecompressVis((byte *)model->vis +
|
||||
model->vis->bitofs[cluster][DVIS_PVS],
|
||||
model);
|
||||
(model->vis->numclusters + 7) >> 3);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -67,4 +67,5 @@ extern qboolean LoadSTB(const char *origname, const char* type, byte **pic, int
|
|||
|
||||
extern void GetWalInfo(char *name, int *width, int *height);
|
||||
|
||||
extern byte* Mod_DecompressVis(byte *in, int row);
|
||||
#endif /* SRC_CLIENT_REFRESH_REF_SHARED_H_ */
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_aclip.c: clip routines for drawing Alias models directly to the screen
|
||||
// sw_aclip.c: clip routines for drawing Alias models directly to the screen
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_alias.c: routines for setting up to draw alias models
|
||||
// sw_alias.c: routines for setting up to draw alias models
|
||||
|
||||
/*
|
||||
** use a real variable to control lerping
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_bsp.c
|
||||
// sw_bsp.c
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_edge.c
|
||||
// sw_edge.c
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include "header/local.h"
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_light.c
|
||||
// sw_light.c
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
// r_main.c
|
||||
// sw_main.c
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef SDL2
|
||||
|
@ -150,7 +150,7 @@ static cvar_t *r_lockpvs;
|
|||
|
||||
#define STRINGER(x) "x"
|
||||
|
||||
// r_vars.c
|
||||
// sw_vars.c
|
||||
|
||||
// all global and static refresh variables are collected in a contiguous block
|
||||
// to avoid cache conflicts.
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_misc.c
|
||||
// sw_misc.c
|
||||
#ifdef SDL2
|
||||
#include <SDL2/SDL.h>
|
||||
#else // SDL1.2
|
||||
|
|
|
@ -209,53 +209,6 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
Mod_DecompressVis
|
||||
===================
|
||||
*/
|
||||
static byte *
|
||||
Mod_DecompressVis (byte *in, model_t *model)
|
||||
{
|
||||
static byte decompressed[MAX_MAP_LEAFS/8];
|
||||
int c;
|
||||
byte *out;
|
||||
int row;
|
||||
|
||||
row = (model->vis->numclusters+7)>>3;
|
||||
out = decompressed;
|
||||
|
||||
if (!in)
|
||||
{
|
||||
// no vis info, so make all visible
|
||||
while (row)
|
||||
{
|
||||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (*in)
|
||||
{
|
||||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
while (c)
|
||||
{
|
||||
*out++ = 0;
|
||||
c--;
|
||||
}
|
||||
} while (out - decompressed < row);
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Mod_ClusterPVS
|
||||
|
@ -265,8 +218,9 @@ byte *Mod_ClusterPVS (int cluster, model_t *model)
|
|||
{
|
||||
if (cluster == -1 || !model->vis)
|
||||
return mod_novis;
|
||||
return Mod_DecompressVis ( (byte *)model->vis + model->vis->bitofs[cluster][DVIS_PVS],
|
||||
model);
|
||||
return Mod_DecompressVis ( (byte *)model->vis +
|
||||
model->vis->bitofs[cluster][DVIS_PVS],
|
||||
(model->vis->numclusters+7)>>3);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_rast.c
|
||||
// sw_rast.c
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_sprite.c
|
||||
// sw_sprite.c
|
||||
#include "header/local.h"
|
||||
|
||||
extern polydesc_t r_polydesc;
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_surf.c: surface-related refresh code
|
||||
// sw_surf.c: surface-related refresh code
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue