mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2025-01-18 23:21:44 +00:00
- More solaris patches from Vincent Cojot's first patches to
icculus. (icculus patchset #65) - Also including some bugfixes by a mythical 'eliasm' from the same patchset.
This commit is contained in:
parent
0b0e9986ef
commit
b796032faa
9 changed files with 223 additions and 81 deletions
|
@ -1152,8 +1152,11 @@ void Z_Free (void *ptr)
|
||||||
|
|
||||||
z = ((zhead_t *)ptr) - 1;
|
z = ((zhead_t *)ptr) - 1;
|
||||||
|
|
||||||
if (z->magic != Z_MAGIC)
|
if (z->magic != Z_MAGIC) {
|
||||||
|
printf("free: %p failed\n", ptr);
|
||||||
|
abort();
|
||||||
Com_Error (ERR_FATAL, "Z_Free: bad magic");
|
Com_Error (ERR_FATAL, "Z_Free: bad magic");
|
||||||
|
}
|
||||||
|
|
||||||
z->prev->next = z->next;
|
z->prev->next = z->next;
|
||||||
z->next->prev = z->prev;
|
z->next->prev = z->prev;
|
||||||
|
|
|
@ -27,23 +27,23 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL_GLEXT
|
#ifdef HAVE_OPENGL_GLEXT
|
||||||
#include <GL/glext.h>
|
# include <GL/glext.h>
|
||||||
#endif // HAVE_OPENGL_GLEXT
|
#else /* HAVE_OPENGL_GLEXT */
|
||||||
|
# include <GL/glu.h>
|
||||||
|
# ifndef GL_COLOR_INDEX8_EXT
|
||||||
|
# define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
|
||||||
|
# endif
|
||||||
|
#endif /* HAVE_OPENGL_GLEXT */
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char *strlwr (char *s);
|
char *strlwr (char *s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __sun__
|
|
||||||
# ifndef GL_COLOR_INDEX8_EXT
|
|
||||||
# define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ref.h"
|
#include "ref.h"
|
||||||
|
|
||||||
#include "qgl.h"
|
#include "qgl.h"
|
||||||
|
|
||||||
#define REF_VERSION "GL 0.01"
|
#define REF_VERSION "GL 0.01"
|
||||||
|
|
98
src/main.c
98
src/main.c
|
@ -61,12 +61,39 @@
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "rw.h"
|
#include "rw.h"
|
||||||
|
|
||||||
|
#ifdef SOL8_XIL_WORKAROUND
|
||||||
|
#include <xil/xil.h>
|
||||||
|
typedef struct {
|
||||||
|
qboolean restart_sound;
|
||||||
|
int s_rate;
|
||||||
|
int s_width;
|
||||||
|
int s_channels;
|
||||||
|
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
byte * pic;
|
||||||
|
byte * pic_pending;
|
||||||
|
|
||||||
|
/* order 1 huffman stuff */
|
||||||
|
int * hnodes1; /* [256][256][2] */
|
||||||
|
int numhnodes1[256];
|
||||||
|
int h_used[512];
|
||||||
|
int h_count[512];
|
||||||
|
} cinematics_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
cvar_t *nostdout;
|
cvar_t *nostdout;
|
||||||
|
|
||||||
unsigned sys_frame_time;
|
unsigned sys_frame_time;
|
||||||
|
|
||||||
uid_t saved_euid;
|
uid_t saved_euid;
|
||||||
qboolean stdin_active = true;
|
qboolean stdin_active = true;
|
||||||
|
char display_name[1024];
|
||||||
|
/* FIXME: replace with configure test for hrtime_t */
|
||||||
|
#ifdef __sun__
|
||||||
|
hrtime_t base_hrtime;
|
||||||
|
#endif
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// General routines
|
// General routines
|
||||||
|
@ -126,7 +153,7 @@ void Sys_Error (char *error, ...)
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char string[1024];
|
char string[1024];
|
||||||
|
|
||||||
// change stdin to non blocking
|
/* change stdin to non blocking */
|
||||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||||
|
|
||||||
CL_Shutdown ();
|
CL_Shutdown ();
|
||||||
|
@ -285,9 +312,42 @@ void Sys_SendKeyEvents (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
#ifdef SOL8_XIL_WORKAROUND
|
||||||
|
XilSystemState xil_state;
|
||||||
|
#endif
|
||||||
|
|
||||||
int main (int argc, char **argv) {
|
int main (int argc, char **argv) {
|
||||||
int time, oldtime, newtime;
|
int time, oldtime, newtime;
|
||||||
|
sigset_t sigs;
|
||||||
|
|
||||||
|
#ifdef SOL8_XIL_WORKAROUND
|
||||||
|
{
|
||||||
|
extern cinematics_t cin;
|
||||||
|
|
||||||
|
if ((xil_state = xil_open()) == NULL) {
|
||||||
|
fprintf(stderr, "Can't open XIL\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
memset(&cin, 0, sizeof(cin));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* save the contents of the DISPLAY environment variable.
|
||||||
|
* if we don't, it gets overwritten after reloading
|
||||||
|
* the renderer libraries (solaris) */
|
||||||
|
{
|
||||||
|
char * tmp_name = getenv("DISPLAY");
|
||||||
|
if (tmp_name == NULL) {
|
||||||
|
display_name[0] = '\0';
|
||||||
|
} else {
|
||||||
|
strncpy(display_name, tmp_name, sizeof(display_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* block the SIGPOLL signal so that only the audio thread gets it */
|
||||||
|
sigemptyset(&sigs);
|
||||||
|
sigaddset(&sigs, SIGPOLL);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &sigs, NULL);
|
||||||
|
|
||||||
/* go back to real user for config loads */
|
/* go back to real user for config loads */
|
||||||
saved_euid = geteuid();
|
saved_euid = geteuid();
|
||||||
|
@ -449,3 +509,39 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
size_t verify_fread(void * ptr, size_t size, size_t nitems, FILE * fp) {
|
||||||
|
size_t ret;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
clearerr(fp);
|
||||||
|
ret = fread(ptr, size, nitems, fp);
|
||||||
|
err = errno;
|
||||||
|
if (ret != nitems) {
|
||||||
|
printf("verify_fread(...,%d,%d,...): return value: %d\n", size, nitems, ret);
|
||||||
|
if (ret == 0 && ferror(fp)) {
|
||||||
|
printf(" error: %s\n", strerror(err));
|
||||||
|
printf(" fileno=%d\n", fileno(fp));
|
||||||
|
}
|
||||||
|
/* sleep(5); */
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t verify_fwrite(void * ptr, size_t size, size_t nitems, FILE * fp) {
|
||||||
|
size_t ret;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
clearerr(fp);
|
||||||
|
ret = fwrite(ptr, size, nitems, fp);
|
||||||
|
err = errno;
|
||||||
|
if (ret != nitems) {
|
||||||
|
printf("verify_fwrite(...,%d,%d,...) = %d\n", size, nitems, ret);
|
||||||
|
if (ret == 0 && ferror(fp)) {
|
||||||
|
printf(" error: %s\n", strerror(err));
|
||||||
|
printf(" fileno=%d\n", fileno(fp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* sleep(5); */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
45
src/menu.c
45
src/menu.c
|
@ -1,22 +1,24 @@
|
||||||
/*
|
/* $Id$
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (c) 2002 The Quakeforge Project.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -3477,7 +3479,7 @@ static qboolean PlayerConfig_ScanDirectories( void )
|
||||||
char findname[1024];
|
char findname[1024];
|
||||||
char scratch[1024];
|
char scratch[1024];
|
||||||
int ndirs = 0, npms = 0;
|
int ndirs = 0, npms = 0;
|
||||||
char **dirnames;
|
char **dirnames = NULL;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -3491,6 +3493,11 @@ static qboolean PlayerConfig_ScanDirectories( void )
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
path = FS_NextPath( path );
|
path = FS_NextPath( path );
|
||||||
|
/* If FS_NextPath returns NULL we get a segv on the next line on solaris.
|
||||||
|
* Other platforms work probably because path becomes the null string
|
||||||
|
* or something */
|
||||||
|
if (path == NULL)
|
||||||
|
break;
|
||||||
Com_sprintf( findname, sizeof(findname), "%s/players/*.*", path );
|
Com_sprintf( findname, sizeof(findname), "%s/players/*.*", path );
|
||||||
|
|
||||||
if ( ( dirnames = FS_ListFiles( findname, &ndirs, SFF_SUBDIR, 0 ) ) != 0 )
|
if ( ( dirnames = FS_ListFiles( findname, &ndirs, SFF_SUBDIR, 0 ) ) != 0 )
|
||||||
|
|
24
src/q_sh.c
24
src/q_sh.c
|
@ -51,12 +51,15 @@ void *Hunk_Begin (int maxsize)
|
||||||
maxhunksize = maxsize + sizeof(int);
|
maxhunksize = maxsize + sizeof(int);
|
||||||
curhunksize = 0;
|
curhunksize = 0;
|
||||||
/* merged in from q_sh*.c -- jaq */
|
/* merged in from q_sh*.c -- jaq */
|
||||||
|
/* FIXME: clean all this up into configure tests for mmap, MAP_ANONYMOUS and malloc */
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||||
#elif defined(__FreeBSD__) || defined(__bsd__) || defined(__NetBSD__)
|
#elif defined(__FreeBSD__) || defined(__bsd__) || defined(__NetBSD__)
|
||||||
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
|
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
|
||||||
#elif defined(__sun__) || defined(__sgi)
|
#elif defined(__sun__) || defined(__sgi)
|
||||||
membase = malloc(maxhunksize);
|
membase = malloc(maxhunksize);
|
||||||
|
/* the following line is for debugging purposes */
|
||||||
|
memset(membase, 0, maxhunksize);
|
||||||
#endif
|
#endif
|
||||||
if (membase == NULL || membase == (byte *)-1)
|
if (membase == NULL || membase == (byte *)-1)
|
||||||
Sys_Error("unable to virtual allocate %d bytes", maxsize);
|
Sys_Error("unable to virtual allocate %d bytes", maxsize);
|
||||||
|
@ -170,6 +173,18 @@ Sys_Milliseconds
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int curtime;
|
int curtime;
|
||||||
|
/* FIXME: replace with a configure test for gethrtime() */
|
||||||
|
#ifdef __sun__
|
||||||
|
extern hrtime_t base_hrtime
|
||||||
|
|
||||||
|
int Sys_Milliseconds(void) {
|
||||||
|
hrtime_t curr_hrtime;
|
||||||
|
|
||||||
|
curr_hrtime = gethrtime();
|
||||||
|
curtime = (curr_hrtime - base_hrtime) / 1000000LL;
|
||||||
|
return curtime;
|
||||||
|
}
|
||||||
|
#else
|
||||||
int Sys_Milliseconds (void)
|
int Sys_Milliseconds (void)
|
||||||
{
|
{
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
|
@ -188,6 +203,7 @@ int Sys_Milliseconds (void)
|
||||||
|
|
||||||
return curtime;
|
return curtime;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Sys_Mkdir (char *path)
|
void Sys_Mkdir (char *path)
|
||||||
{
|
{
|
||||||
|
@ -214,8 +230,10 @@ static DIR *fdir;
|
||||||
static qboolean CompareAttributes(char *path, char *name,
|
static qboolean CompareAttributes(char *path, char *name,
|
||||||
unsigned musthave, unsigned canthave )
|
unsigned musthave, unsigned canthave )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char fn[MAX_OSPATH];
|
char fn[MAX_OSPATH];
|
||||||
|
#endif
|
||||||
|
|
||||||
// . and .. never match
|
// . and .. never match
|
||||||
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
|
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
|
||||||
|
@ -223,10 +241,9 @@ static qboolean CompareAttributes(char *path, char *name,
|
||||||
|
|
||||||
/* FIXME: what's the point of the return? -- jaq */
|
/* FIXME: what's the point of the return? -- jaq */
|
||||||
#if 1
|
#if 1
|
||||||
sprintf(fn, "%s/%s", path, name);
|
|
||||||
#else
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#else
|
||||||
|
sprintf(fn, "%s/%s", path, name);
|
||||||
|
|
||||||
if (stat(fn, &st) == -1)
|
if (stat(fn, &st) == -1)
|
||||||
return false; // shouldn't happen
|
return false; // shouldn't happen
|
||||||
|
@ -238,6 +255,7 @@ static qboolean CompareAttributes(char *path, char *name,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave)
|
char *Sys_FindFirst (char *path, unsigned musthave, unsigned canhave)
|
||||||
|
|
|
@ -1209,3 +1209,7 @@ typedef struct
|
||||||
extern int vidref_val;
|
extern int vidref_val;
|
||||||
// PGM
|
// PGM
|
||||||
// ==================
|
// ==================
|
||||||
|
|
||||||
|
/* error save versions of fread and fwrite */
|
||||||
|
size_t verify_fread(void *, size_t, size_t, FILE *);
|
||||||
|
size_t verify_fwrite(void *, size_t, size_t, FILE *);
|
||||||
|
|
51
src/qgl.h
51
src/qgl.h
|
@ -29,9 +29,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL_GLEXT
|
#ifdef HAVE_OPENGL_GLEXT
|
||||||
#include <GL/glext.h>
|
# include <GL/glext.h>
|
||||||
#endif // HAVE_OPENGL_GLEXT
|
#endif /* HAVE_OPENGL_GLEXT */
|
||||||
|
|
||||||
qboolean QGL_Init( const char *dllname );
|
qboolean QGL_Init( const char *dllname );
|
||||||
void QGL_Shutdown( void );
|
void QGL_Shutdown( void );
|
||||||
|
@ -462,34 +463,32 @@ extern void (*qgl3DfxSetPaletteEXT)(GLuint *);
|
||||||
#define GL_TEXTURE0_SGIS 0x835E
|
#define GL_TEXTURE0_SGIS 0x835E
|
||||||
#define GL_TEXTURE1_SGIS 0x835F
|
#define GL_TEXTURE1_SGIS 0x835F
|
||||||
|
|
||||||
|
#ifndef HAVE_OPENGL_GLEXT
|
||||||
|
/* these are in glext.h */
|
||||||
|
/* extension constants */
|
||||||
|
# define GL_POINT_SIZE_MIN_EXT 0x8126
|
||||||
|
# define GL_POINT_SIZE_MAX_EXT 0x8127
|
||||||
|
# define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
|
||||||
|
# define GL_DISTANCE_ATTENUATION_EXT 0x8129
|
||||||
|
|
||||||
#ifndef HAVE_OPENGL_GLEXT // FIXME: these are in glext.h, delete after testing
|
# ifdef __sgi
|
||||||
// extension constants
|
# define GL_SHARED_TEXTURE_PALETTE_EXT GL_TEXTURE_COLOR_TABLE_SGI
|
||||||
#define GL_POINT_SIZE_MIN_EXT 0x8126
|
# else
|
||||||
#define GL_POINT_SIZE_MAX_EXT 0x8127
|
# define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
|
||||||
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
|
# endif
|
||||||
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
|
|
||||||
|
|
||||||
#ifdef __sgi
|
# ifdef GL_DISTANCE_ATTENUATION_ARB
|
||||||
#define GL_SHARED_TEXTURE_PALETTE_EXT GL_TEXTURE_COLOR_TABLE_SGI
|
# define GL_DISTANCE_ATTENUATION_EXT GL_DISTANCE_ATTENUATION_ARB
|
||||||
#else
|
# endif /* GL_DISTANCE_ATTENUATION_ARB */
|
||||||
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __sun__
|
# ifndef GL_TEXTURE0_ARB
|
||||||
#ifdef GL_DISTANCE_ATTENUATION_ARB
|
# define GL_TEXTURE0_ARB 0x84C0
|
||||||
#define GL_DISTANCE_ATTENUATION_EXT GL_DISTANCE_ATTENUATION_ARB
|
# endif
|
||||||
#endif // GL_DISTANCE_ATTENUATION_ARB
|
# ifndef GL_TEXTURE1_ARB
|
||||||
#endif // __sun__
|
# define GL_TEXTURE1_ARB 0x84C1
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifndef GL_TEXTURE0_ARB
|
#endif /* HAVE_OPENGL_GLEXT */
|
||||||
#define GL_TEXTURE0_ARB 0x84C0
|
|
||||||
#endif
|
|
||||||
#ifndef GL_TEXTURE1_ARB
|
|
||||||
#define GL_TEXTURE1_ARB 0x84C1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // HAVE_OPENGL_GLEXT, end of glext.h defines
|
|
||||||
|
|
||||||
extern int QGL_TEXTURE0, QGL_TEXTURE1;
|
extern int QGL_TEXTURE0, QGL_TEXTURE1;
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,28 @@
|
||||||
/*
|
/* $Id$
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
*
|
||||||
|
* model loading and caching
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (c) 2002 The Quakeforge Project.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
/* models are the only shared resource between a client and server running
|
||||||
modify it under the terms of the GNU General Public License
|
* on the same machine. */
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
// models.c -- model loading and caching
|
|
||||||
|
|
||||||
// models are the only shared resource between a client and server running
|
|
||||||
// on the same machine.
|
|
||||||
|
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
|
|
||||||
|
@ -386,6 +388,9 @@ void Mod_LoadVertexes (lump_t *l)
|
||||||
count = l->filelen / sizeof(*in);
|
count = l->filelen / sizeof(*in);
|
||||||
out = Hunk_Alloc ( (count+8)*sizeof(*out)); // extra for skybox
|
out = Hunk_Alloc ( (count+8)*sizeof(*out)); // extra for skybox
|
||||||
|
|
||||||
|
/* stop the games dumping core when changing levels */
|
||||||
|
memset(out, 0, (count + 6) * sizeof(*out));
|
||||||
|
|
||||||
loadmodel->vertexes = out;
|
loadmodel->vertexes = out;
|
||||||
loadmodel->numvertexes = count;
|
loadmodel->numvertexes = count;
|
||||||
|
|
||||||
|
@ -508,6 +513,9 @@ void Mod_LoadTexinfo (lump_t *l)
|
||||||
next = LittleLong (in->nexttexinfo);
|
next = LittleLong (in->nexttexinfo);
|
||||||
if (next > 0)
|
if (next > 0)
|
||||||
out->next = loadmodel->texinfo + next;
|
out->next = loadmodel->texinfo + next;
|
||||||
|
else
|
||||||
|
/* stop game dumping core when loading a new level */
|
||||||
|
out->next = NULL;
|
||||||
|
|
||||||
Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture);
|
Com_sprintf (name, sizeof(name), "textures/%s.wal", in->texture);
|
||||||
out->image = R_FindImage (name, it_wall);
|
out->image = R_FindImage (name, it_wall);
|
||||||
|
|
|
@ -905,8 +905,15 @@ void S_AddLoopSounds (void)
|
||||||
ch->rightvol = right_total;
|
ch->rightvol = right_total;
|
||||||
ch->autosound = true; // remove next frame
|
ch->autosound = true; // remove next frame
|
||||||
ch->sfx = sfx;
|
ch->sfx = sfx;
|
||||||
|
/* sometimes, the sc->length argument can become 0, and in that
|
||||||
|
* case we get a SIGFPE in the next modulo. The workaround checks
|
||||||
|
* for this situation and sets the pos and end to zero if true */
|
||||||
|
if (sc->length == 0) {
|
||||||
|
ch->pos = ch->end = 0;
|
||||||
|
} else {
|
||||||
ch->pos = paintedtime % sc->length;
|
ch->pos = paintedtime % sc->length;
|
||||||
ch->end = paintedtime + sc->length - ch->pos;
|
ch->end = paintedtime + sc->length - ch->pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue