ioquake3 resync to revision 2210 from 2143.

This commit is contained in:
zturtleman 2011-12-10 00:15:42 +00:00
parent 7ff6e7c4e7
commit 66b3140d34
58 changed files with 1192 additions and 814 deletions

File diff suppressed because it is too large Load diff

View file

@ -83,9 +83,17 @@ Makefile.local:
BUILD_SERVER - build the 'ioq3ded' server binary
BUILD_CLIENT - build the 'ioquake3' client binary
BUILD_CLIENT_SMP - build the 'ioquake3-smp' client binary
BUILD_BASEGAME - build the 'baseq3' binaries
BUILD_MISSIONPACK - build the 'missionpack' binaries
BUILD_GAME_SO - build the game shared libraries
BUILD_GAME_QVM - build the game qvms
BUILD_STANDALONE - build binaries suited for stand-alone games
SERVERBIN - rename 'ioq3ded' server binary
CLIENTBIN - rename 'ioquake3' client binary
BASEGAME - rename 'baseq3'
BASEGAME_CFLAGS - custom CFLAGS for basegame
MISSIONPACK - rename 'missionpack'
MISSIONPACK_CFLAGS - custom CFLAGS for missionpack (default '-DMISSIONPACK')
USE_OPENAL - use OpenAL where available
USE_OPENAL_DLOPEN - link with OpenAL at runtime
USE_CURL - use libcurl for http/ftp download support
@ -237,8 +245,9 @@ New cvars
red-cyan glasses: 1
red-blue: 2
red-green: 3
green-magenta: 4
To swap the colors for left and right eye
just add 3 to the value for the wanted
just add 4 to the value for the wanted
color combination. For red-blue and
red-green you probably want to enable
r_greyscale
@ -701,6 +710,7 @@ Maintainers
Tim Angus <tim@ngus.net>
Tony J. White <tjw@tjw.org>
Zachary J. Slater <zachary@ioquake.org>
Zack Middleton <zturtleman@gmail.com>
Significant contributions from
Ryan C. Gordon <icculus@icculus.org>

View file

@ -25,11 +25,11 @@ IFNDEF idx64
.model flat, c
ENDIF
; .data
.data
; ifndef idx64
; fpucw WORD 0F7Fh
; endif
ifndef idx64
fpucw WORD 0F7Fh
endif
.code
@ -51,22 +51,19 @@ ELSE
; qftol using FPU
qftolx87m macro src
; not necessary, fpucw is set with _controlfp at startup
; sub esp, 2
; fnstcw word ptr [esp]
; fldcw fpucw
sub esp, 2
fnstcw word ptr [esp]
fldcw fpucw
fld dword ptr src
fistp dword ptr src
; fldcw [esp]
fldcw [esp]
mov eax, src
; add esp, 2
add esp, 2
ret
endm
qftolx87 PROC
; need this line when storing FPU control word on stack
; qftolx87m [esp + 6]
qftolx87m [esp + 4]
qftolx87m [esp + 6]
qftolx87 ENDP
qvmftolx87 PROC

View file

@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "qasm-inline.h"
static const unsigned short fpucw = 0x0C7F;
/*
* GNU inline asm ftol conversion functions using SSE or FPU
*/
@ -59,14 +61,18 @@ int qvmftolsse(void)
long qftolx87(float f)
{
long retval;
unsigned short oldcw;
__asm__ volatile
(
"fnstcw %2\n"
"fldcw %3\n"
"flds %1\n"
"fistpl %1\n"
"fldcw %2\n"
"mov %1, %0\n"
: "=r" (retval)
: "m" (f)
: "m" (f), "m" (oldcw), "m" (fpucw)
);
return retval;
@ -75,13 +81,18 @@ long qftolx87(float f)
int qvmftolx87(void)
{
int retval;
unsigned short oldcw;
__asm__ volatile
(
"fnstcw %1\n"
"fldcw %2\n"
"flds (" EDI ", " EBX ", 4)\n"
"fistpl (" EDI ", " EBX ", 4)\n"
"fldcw %1\n"
"mov (" EDI ", " EBX ", 4), %0\n"
: "=r" (retval)
: "m" (oldcw), "m" (fpucw)
);
return retval;

View file

@ -45,41 +45,31 @@ IFDEF idx64
qsnapvectorsse PROC
sub rsp, 8
stmxcsr [rsp] ; save SSE control word
ldmxcsr ssecw ; set to round nearest
push rdi
mov rdi, rcx ; maskmovdqu uses rdi as implicit memory operand
movaps xmm1, ssemask ; initialize the mask register for maskmovdqu
movups xmm0, [rdi] ; here is stored our vector. Read 4 values in one go
movaps xmm1, ssemask ; initialize the mask register
movups xmm0, [rcx] ; here is stored our vector. Read 4 values in one go
movaps xmm2, xmm0 ; keep a copy of the original data
andps xmm0, xmm1 ; set the fourth value to zero in xmm0
andnps xmm1, xmm2 ; copy fourth value to xmm1 and set rest to zero
cvtps2dq xmm0, xmm0 ; convert 4 single fp to int
cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp
maskmovdqu xmm0, xmm1 ; write 3 values back to memory
pop rdi
ldmxcsr [rsp] ; restore sse control word to old value
add rsp, 8
orps xmm0, xmm1 ; combine all 4 values again
movups [rcx], xmm0 ; write 3 rounded and 1 unchanged values back to memory
ret
qsnapvectorsse ENDP
ELSE
qsnapvectorsse PROC
sub esp, 8
stmxcsr [esp] ; save SSE control word
ldmxcsr ssecw ; set to round nearest
push edi
mov edi, dword ptr 16[esp] ; maskmovdqu uses edi as implicit memory operand
movaps xmm1, ssemask ; initialize the mask register for maskmovdqu
movups xmm0, [edi] ; here is stored our vector. Read 4 values in one go
mov eax, dword ptr 4[esp] ; store address of vector in eax
movaps xmm1, ssemask ; initialize the mask register for maskmovdqu
movups xmm0, [eax] ; here is stored our vector. Read 4 values in one go
movaps xmm2, xmm0 ; keep a copy of the original data
andps xmm0, xmm1 ; set the fourth value to zero in xmm0
andnps xmm1, xmm2 ; copy fourth value to xmm1 and set rest to zero
cvtps2dq xmm0, xmm0 ; convert 4 single fp to int
cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp
maskmovdqu xmm0, xmm1 ; write 3 values back to memory
pop edi
ldmxcsr [esp] ; restore sse control word to old value
add esp, 8
orps xmm0, xmm1 ; combine all 4 values again
movups [eax], xmm0 ; write 3 rounded and 1 unchanged values back to memory
ret
qsnapvectorsse ENDP
@ -92,14 +82,10 @@ ELSE
qsnapvectorx87 PROC
mov eax, dword ptr 4[esp]
sub esp, 2
fnstcw word ptr [esp]
fldcw fpucw
qroundx87 [eax]
qroundx87 4[eax]
qroundx87 8[eax]
fldcw [esp]
add esp, 2
ret
qsnapvectorx87 ENDP
ENDIF

View file

@ -33,55 +33,41 @@ static unsigned char ssemask[16] __attribute__((aligned(16))) =
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00"
};
static const unsigned int ssecw __attribute__((aligned(16))) = 0x00001F80;
static const unsigned short fpucw = 0x037F;
void qsnapvectorsse(vec3_t vec)
{
uint32_t oldcw __attribute__((aligned(16)));
__asm__ volatile
(
"stmxcsr %3\n"
"ldmxcsr %1\n"
"movaps (%0), %%xmm1\n"
"movups (%2), %%xmm0\n"
"movups (%1), %%xmm0\n"
"movaps %%xmm0, %%xmm2\n"
"andps %%xmm1, %%xmm0\n"
"andnps %%xmm2, %%xmm1\n"
"cvtps2dq %%xmm0, %%xmm0\n"
"cvtdq2ps %%xmm0, %%xmm0\n"
// vec MUST reside in register rdi as maskmovdqu uses
// it as an implicit operand. The "D" constraint makes
// sure of that.
"maskmovdqu %%xmm1, %%xmm0\n"
"ldmxcsr %3\n"
"orps %%xmm1, %%xmm0\n"
"movups %%xmm0, (%1)\n"
:
: "r" (ssemask), "m" (ssecw), "D" (vec), "m" (oldcw)
: "memory", "%xmm0", "%xmm1"
: "r" (ssemask), "r" (vec)
: "memory", "%xmm0", "%xmm1", "%xmm2"
);
}
#define QROUNDX87(src) \
"flds " src "\n" \
"fistp " src "\n" \
"fild " src "\n" \
"fstp " src "\n"
"fistps " src "\n" \
"filds " src "\n" \
"fstps " src "\n"
void qsnapvectorx87(vec3_t vec)
{
__asm__ volatile
(
"sub $2, " ESP "\n"
"fnstcw (" ESP ")\n"
"fldcw %0\n"
QROUNDX87("(%1)")
QROUNDX87("4(%1)")
QROUNDX87("8(%1)")
"fldcw (" ESP ")\n"
"add $2, " ESP "\n"
QROUNDX87("(%0)")
QROUNDX87("4(%0)")
QROUNDX87("8(%0)")
:
: "m" (fpucw), "r" (vec)
: "r" (vec)
: "memory"
);
}

View file

@ -1173,7 +1173,7 @@ bot_matchpiece_t *BotLoadMatchPieces(source_t *source, char *endtoken)
{
if (token.type == TT_NUMBER && (token.subtype & TT_INTEGER))
{
if (token.intvalue < 0 || token.intvalue >= MAX_MATCHVARIABLES)
if (token.intvalue >= MAX_MATCHVARIABLES)
{
SourceError(source, "can't have more than %d match variables\n", MAX_MATCHVARIABLES);
FreeSource(source);

View file

@ -1703,7 +1703,7 @@ qboolean ValidBloodPool (vec3_t start)
CG_Trace (&trace, this_pos, NULL, NULL, end_pos, -1, CONTENTS_SOLID);
if (trace.entityNum < (MAX_ENTITIES - 1)) // may only land on world
if (trace.entityNum < ENTITYNUM_WORLD) // may only land on world
return qfalse;
if (!(!trace.startsolid && trace.fraction < 1))

View file

@ -526,9 +526,7 @@ static int CG_CalcFov( void ) {
}
} else {
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
if ( f > 1.0 ) {
fov_x = fov_x;
} else {
if ( f <= 1.0 ) {
fov_x = zoomFov + f * ( fov_x - zoomFov );
}
}
@ -578,6 +576,10 @@ static void CG_DamageBlendBlob( void ) {
int maxTime;
refEntity_t ent;
if (!cg_blood.integer) {
return;
}
if ( !cg.damageValue ) {
return;
}

View file

@ -25,7 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../botlib/botlib.h"
#ifdef USE_MUMBLE
#include "libmumblelink.h"
#endif
extern botlib_export_t *botlib_export;
@ -732,13 +734,14 @@ void CL_InitCGame( void ) {
Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname );
// load the dll or bytecode
if ( cl_connectedToPureServer != 0 ) {
interpret = Cvar_VariableValue("vm_cgame");
if(cl_connectedToPureServer)
{
// if sv_pure is set we only allow qvms to be loaded
interpret = VMI_COMPILED;
}
else {
interpret = Cvar_VariableValue( "vm_cgame" );
if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE)
interpret = VMI_COMPILED;
}
cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret );
if ( !cgvm ) {
Com_Error( ERR_DROP, "VM_Create on cgame failed" );

View file

@ -1293,7 +1293,7 @@ static void RoQShutdown( void ) {
/*
==================
SCR_StopCinematic
CIN_StopCinematic
==================
*/
e_status CIN_StopCinematic(int handle) {
@ -1320,7 +1320,7 @@ e_status CIN_StopCinematic(int handle) {
/*
==================
SCR_RunCinematic
CIN_RunCinematic
Fetch and decompress the pending frame
==================
@ -1398,8 +1398,7 @@ e_status CIN_RunCinematic (int handle)
/*
==================
CL_PlayCinematic
CIN_PlayCinematic
==================
*/
int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBits ) {
@ -1421,7 +1420,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
}
}
Com_DPrintf("SCR_PlayCinematic( %s )\n", arg);
Com_DPrintf("CIN_PlayCinematic( %s )\n", arg);
Com_Memset(&cin, 0, sizeof(cinematics_t) );
currentHandle = CIN_HandleForVideo();
@ -1564,8 +1563,7 @@ void CIN_ResampleCinematic(int handle, int *buf2) {
/*
==================
SCR_DrawCinematic
CIN_DrawCinematic
==================
*/
void CIN_DrawCinematic (int handle) {

View file

@ -22,11 +22,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef USE_CURL
#include "client.h"
cvar_t *cl_cURLLib;
#ifdef USE_CURL_DLOPEN
#include "../sys/sys_loadlib.h"
cvar_t *cl_cURLLib;
char* (*qcurl_version)(void);
CURL* (*qcurl_easy_init)(void);
@ -243,7 +244,7 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
"%s for writing", clc.downloadTempName);
return;
}
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
if(com_developer->integer)
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);

View file

@ -24,28 +24,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef __QCURL_H__
#define __QCURL_H__
extern cvar_t *cl_cURLLib;
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
#ifdef WIN32
#define DEFAULT_CURL_LIB "libcurl-3.dll"
#elif defined(MACOS_X)
#define DEFAULT_CURL_LIB "libcurl.dylib"
#else
#define DEFAULT_CURL_LIB "libcurl.so.4"
#define ALTERNATE_CURL_LIB "libcurl.so.3"
#endif
#ifdef USE_LOCAL_HEADERS
#include "../libcurl/curl/curl.h"
#else
#include <curl/curl.h>
#endif
#ifdef USE_CURL_DLOPEN
#ifdef WIN32
#define DEFAULT_CURL_LIB "libcurl-4.dll"
#define ALTERNATE_CURL_LIB "libcurl-3.dll"
#elif defined(MACOS_X)
#define DEFAULT_CURL_LIB "libcurl.dylib"
#else
#define DEFAULT_CURL_LIB "libcurl.so.4"
#define ALTERNATE_CURL_LIB "libcurl.so.3"
#endif
extern cvar_t *cl_cURLLib;
extern char* (*qcurl_version)(void);
extern CURL* (*qcurl_easy_init)(void);

View file

@ -267,11 +267,6 @@ void IN_Button14Up(void) {IN_KeyUp(&in_buttons[14]);}
void IN_Button15Down(void) {IN_KeyDown(&in_buttons[15]);}
void IN_Button15Up(void) {IN_KeyUp(&in_buttons[15]);}
void IN_ButtonDown (void) {
IN_KeyDown(&in_buttons[1]);}
void IN_ButtonUp (void) {
IN_KeyUp(&in_buttons[1]);}
void IN_CenterView (void) {
cl.viewangles[PITCH] = -SHORT2ANGLE(cl.snap.ps.delta_angles[PITCH]);
}

View file

@ -55,7 +55,9 @@ cvar_t *cl_nodelta;
cvar_t *cl_debugMove;
cvar_t *cl_noprint;
#ifdef UPDATE_SERVER_NAME
cvar_t *cl_motd;
#endif
cvar_t *rcon_client_password;
cvar_t *rconAddress;
@ -1522,6 +1524,7 @@ CL_RequestMotd
===================
*/
void CL_RequestMotd( void ) {
#ifdef UPDATE_SERVER_NAME
char info[MAX_INFO_STRING];
if ( !cl_motd->integer ) {
@ -1547,6 +1550,7 @@ void CL_RequestMotd( void ) {
Info_SetValueForKey( info, "version", com_version->string );
NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd \"%s\"\n", info );
#endif
}
/*
@ -2408,6 +2412,7 @@ CL_MotdPacket
===================
*/
void CL_MotdPacket( netadr_t from ) {
#ifdef UPDATE_SERVER_NAME
char *challenge;
char *info;
@ -2428,6 +2433,7 @@ void CL_MotdPacket( netadr_t from ) {
Q_strncpyz( cls.updateInfoString, info, sizeof( cls.updateInfoString ) );
Cvar_Set( "cl_motdString", challenge );
#endif
}
/*
@ -3439,7 +3445,9 @@ void CL_Init( void ) {
// register our variables
//
cl_noprint = Cvar_Get( "cl_noprint", "0", 0 );
#ifdef UPDATE_SERVER_NAME
cl_motd = Cvar_Get ("cl_motd", "1", 0);
#endif
cl_timeout = Cvar_Get ("cl_timeout", "200", 0);
@ -3483,7 +3491,7 @@ void CL_Init( void ) {
cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE);
#ifdef USE_CURL
#ifdef USE_CURL_DLOPEN
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE);
#endif
@ -3755,13 +3763,22 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
char *infoString;
int prot;
char *gamename;
qboolean gameMismatch;
infoString = MSG_ReadString( msg );
// if this isn't the correct gamename, ignore it
gamename = Info_ValueForKey( infoString, "gamename" );
if (gamename && *gamename && strcmp(gamename, com_gamename->string))
#ifdef LEGACY_PROTOCOL
// gamename is optional for legacy protocol
if (com_legacyprotocol->integer && !*gamename)
gameMismatch = qfalse;
else
#endif
gameMismatch = !*gamename || strcmp(gamename, com_gamename->string) != 0;
if (gameMismatch)
{
Com_DPrintf( "Game mismatch in info packet: %s\n", infoString );
return;

View file

@ -538,12 +538,14 @@ void CL_ParseGamestate( msg_t *msg ) {
CL_StopRecord_f();
// reinitialize the filesystem if the game directory has changed
if(FS_ConditionalRestart(clc.checksumFeed, qfalse) && !cls.oldGameSet)
if(!cls.oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED))
{
cls.oldGameSet = qtrue;
Q_strncpyz(cls.oldGame, oldGame, sizeof(cls.oldGame));
}
FS_ConditionalRestart(clc.checksumFeed, qfalse);
// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
// cgame
CL_InitDownloads();

View file

@ -316,7 +316,7 @@ static int SCR_Strlen( const char *str ) {
** SCR_GetBigStringWidth
*/
int SCR_GetBigStringWidth( const char *str ) {
return SCR_Strlen( str ) * 16;
return SCR_Strlen( str ) * BIGCHAR_WIDTH;
}

View file

@ -765,7 +765,7 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
return 0;
case UI_CMD_EXECUTETEXT:
if(args[1] == 0
if(args[1] == EXEC_NOW
&& (!strncmp(VMA(2), "snd_restart", 11)
|| !strncmp(VMA(2), "vid_restart", 11)
|| !strncmp(VMA(2), "quit", 5)))
@ -1098,13 +1098,14 @@ void CL_InitUI( void ) {
vmInterpret_t interpret;
// load the dll or bytecode
if ( cl_connectedToPureServer != 0 ) {
interpret = Cvar_VariableValue("vm_ui");
if(cl_connectedToPureServer)
{
// if sv_pure is set we only allow qvms to be loaded
interpret = VMI_COMPILED;
}
else {
interpret = Cvar_VariableValue( "vm_ui" );
if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE)
interpret = VMI_COMPILED;
}
uivm = VM_Create( "ui", CL_UISystemCalls, interpret );
if ( !uivm ) {
Com_Error( ERR_FATAL, "VM_Create on UI failed" );
@ -1118,6 +1119,10 @@ void CL_InitUI( void ) {
VM_Call( uivm, UI_INIT, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE));
}
else if (v != UI_API_VERSION) {
// Free uivm now, so UI_SHUTDOWN doesn't get called later.
VM_Free( uivm );
uivm = NULL;
Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION );
cls.uiStarted = qfalse;
}

View file

@ -489,14 +489,6 @@ typedef struct {
qboolean wasPressed; // set when down, not cleared when up
} kbutton_t;
extern kbutton_t in_mlook, in_klook;
extern kbutton_t in_strafe;
extern kbutton_t in_speed;
#ifdef USE_VOIP
extern kbutton_t in_voiprecord;
#endif
void CL_InitInput(void);
void CL_ShutdownInput(void);
void CL_SendCmd (void);

View file

@ -115,7 +115,7 @@ int mumble_link(const char* name)
close(shmfd);
#endif
memset(lm, 0, sizeof(LinkedMem));
mbstowcs(lm->name, name, sizeof(lm->name));
mbstowcs(lm->name, name, sizeof(lm->name) / sizeof(wchar_t));
return 0;
}

View file

@ -77,7 +77,6 @@ int s_numSfx = 0;
static sfx_t *sfxHash[LOOP_HASH];
cvar_t *s_testsound;
cvar_t *s_khz;
cvar_t *s_show;
cvar_t *s_mixahead;
cvar_t *s_mixPreStep;
@ -1494,7 +1493,6 @@ qboolean S_Base_Init( soundInterface_t *si ) {
return qfalse;
}
s_khz = Cvar_Get ("s_khz", "22", CVAR_ARCHIVE);
s_mixahead = Cvar_Get ("s_mixahead", "0.2", CVAR_ARCHIVE);
s_mixPreStep = Cvar_Get ("s_mixPreStep", "0.05", CVAR_ARCHIVE);
s_show = Cvar_Get ("s_show", "0", CVAR_CHEAT);

View file

@ -1180,7 +1180,7 @@ static void G_VoiceTo( gentity_t *ent, gentity_t *other, int mode, const char *i
// no chatting to players in tournements
// STONELANCE - removed gametype
/*
if ( (g_gametype.integer == GT_TOURNAMENT )) {
if ( g_gametype.integer == GT_TOURNAMENT ) {
return;
}
*/

View file

@ -484,11 +484,11 @@ qboolean ConsoleCommand( void ) {
if (g_dedicated.integer) {
if (Q_stricmp (cmd, "say") == 0) {
trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(1) ) );
trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(1) ) );
return qtrue;
}
// everything else will also be printed as a say command
trap_SendServerCommand( -1, va("print \"server: %s\"", ConcatArgs(0) ) );
trap_SendServerCommand( -1, va("print \"server: %s\n\"", ConcatArgs(0) ) );
return qtrue;
}

View file

@ -398,8 +398,6 @@ void SP_trigger_hurt( gentity_t *self ) {
self->damage = 5;
}
self->r.contents = CONTENTS_TRIGGER;
self->use = hurt_use;
// link in to the world if starting active

View file

@ -38,6 +38,8 @@ SOUND OPTIONS MENU
#define ART_FRAMER "menu/art/frame1_r"
#define ART_BACK0 "menu/art/back_0"
#define ART_BACK1 "menu/art/back_1"
#define ART_ACCEPT0 "menu/art/accept_0"
#define ART_ACCEPT1 "menu/art/accept_1"
*/
// END
@ -48,12 +50,22 @@ SOUND OPTIONS MENU
#define ID_EFFECTSVOLUME 14
#define ID_MUSICVOLUME 15
#define ID_QUALITY 16
//#define ID_A3D 17
#define ID_BACK 18
#define ID_SOUNDSYSTEM 17
//#define ID_A3D 18
#define ID_BACK 19
#define ID_APPLY 20
#define DEFAULT_SDL_SND_SPEED 22050
static const char *quality_items[] = {
"Low", "High", 0
"Low", "Medium", "High", NULL
};
#define UISND_SDL 0
#define UISND_OPENAL 1
static const char *soundSystem_items[] = {
"SDL", "OpenAL", NULL
};
typedef struct {
@ -74,13 +86,21 @@ typedef struct {
menuslider_s sfxvolume;
menuslider_s musicvolume;
menulist_s soundSystem;
menulist_s quality;
// menuradiobutton_s a3d;
// STONELANCE
// menubitmap_s back;
// menubitmap_s apply;
menutext_s back;
menutext_s apply;
// END
float sfxvolume_original;
float musicvolume_original;
int soundSystem_original;
int quality_original;
} soundOptionsInfo_t;
static soundOptionsInfo_t soundOptionsInfo;
@ -114,27 +134,6 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) {
UI_PopMenu();
UI_NetworkOptionsMenu();
break;
case ID_EFFECTSVOLUME:
trap_Cvar_SetValue( "s_volume", soundOptionsInfo.sfxvolume.curvalue / 10 );
break;
case ID_MUSICVOLUME:
trap_Cvar_SetValue( "s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10 );
break;
case ID_QUALITY:
if( soundOptionsInfo.quality.curvalue ) {
trap_Cvar_SetValue( "s_khz", 22 );
trap_Cvar_SetValue( "s_compression", 0 );
}
else {
trap_Cvar_SetValue( "s_khz", 11 );
trap_Cvar_SetValue( "s_compression", 1 );
}
UI_ForceMenuOff();
trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" );
break;
/*
case ID_A3D:
if( soundOptionsInfo.a3d.curvalue ) {
@ -149,9 +148,98 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) {
case ID_BACK:
UI_PopMenu();
break;
case ID_APPLY:
trap_Cvar_SetValue( "s_volume", soundOptionsInfo.sfxvolume.curvalue / 10 );
soundOptionsInfo.sfxvolume_original = soundOptionsInfo.sfxvolume.curvalue;
trap_Cvar_SetValue( "s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10 );
soundOptionsInfo.musicvolume_original = soundOptionsInfo.musicvolume.curvalue;
// Check if something changed that requires the sound system to be restarted.
if (soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue
|| soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue)
{
int speed;
switch ( soundOptionsInfo.quality.curvalue )
{
default:
case 0:
speed = 11025;
break;
case 1:
speed = 22050;
break;
case 2:
speed = 44100;
break;
}
if (speed == DEFAULT_SDL_SND_SPEED)
speed = 0;
trap_Cvar_SetValue( "s_sdlSpeed", speed );
soundOptionsInfo.quality_original = soundOptionsInfo.quality.curvalue;
trap_Cvar_SetValue( "s_useOpenAL", (soundOptionsInfo.soundSystem.curvalue == UISND_OPENAL) );
soundOptionsInfo.soundSystem_original = soundOptionsInfo.soundSystem.curvalue;
UI_ForceMenuOff();
trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" );
}
break;
}
}
/*
=================
SoundOptions_UpdateMenuItems
=================
*/
static void SoundOptions_UpdateMenuItems( void )
{
if ( soundOptionsInfo.soundSystem.curvalue == UISND_SDL )
{
soundOptionsInfo.quality.generic.flags &= ~QMF_GRAYED;
}
else
{
soundOptionsInfo.quality.generic.flags |= QMF_GRAYED;
}
soundOptionsInfo.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
if ( soundOptionsInfo.sfxvolume_original != soundOptionsInfo.sfxvolume.curvalue )
{
soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( soundOptionsInfo.musicvolume_original != soundOptionsInfo.musicvolume.curvalue )
{
soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue )
{
soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue )
{
soundOptionsInfo.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
}
/*
================
SoundOptions_MenuDraw
================
*/
void SoundOptions_MenuDraw (void)
{
//APSFIX - rework this
SoundOptions_UpdateMenuItems();
Menu_Draw( &soundOptionsInfo.menu );
}
/*
===============
@ -160,12 +248,14 @@ UI_SoundOptionsMenu_Init
*/
static void UI_SoundOptionsMenu_Init( void ) {
int y;
int speed;
memset( &soundOptionsInfo, 0, sizeof(soundOptionsInfo) );
UI_SoundOptionsMenu_Cache();
soundOptionsInfo.menu.wrapAround = qtrue;
soundOptionsInfo.menu.fullscreen = qtrue;
soundOptionsInfo.menu.draw = SoundOptions_MenuDraw;
soundOptionsInfo.banner.generic.type = MTYPE_BTEXT;
soundOptionsInfo.banner.generic.flags = QMF_CENTER_JUSTIFY;
@ -247,7 +337,7 @@ static void UI_SoundOptionsMenu_Init( void ) {
soundOptionsInfo.network.color = text_color_normal;
// END
y = 240 - 1.5 * (BIGCHAR_HEIGHT + 2);
y = 240 - 2 * (BIGCHAR_HEIGHT + 2);
soundOptionsInfo.sfxvolume.generic.type = MTYPE_SLIDER;
soundOptionsInfo.sfxvolume.generic.name = "Effects Volume:";
soundOptionsInfo.sfxvolume.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
@ -269,15 +359,26 @@ static void UI_SoundOptionsMenu_Init( void ) {
soundOptionsInfo.musicvolume.minvalue = 0;
soundOptionsInfo.musicvolume.maxvalue = 10;
y += BIGCHAR_HEIGHT+2;
soundOptionsInfo.soundSystem.generic.type = MTYPE_SPINCONTROL;
soundOptionsInfo.soundSystem.generic.name = "Sound System:";
soundOptionsInfo.soundSystem.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
soundOptionsInfo.soundSystem.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.soundSystem.generic.id = ID_SOUNDSYSTEM;
soundOptionsInfo.soundSystem.generic.x = 400;
soundOptionsInfo.soundSystem.generic.y = y;
soundOptionsInfo.soundSystem.itemnames = soundSystem_items;
y += BIGCHAR_HEIGHT+2;
soundOptionsInfo.quality.generic.type = MTYPE_SPINCONTROL;
soundOptionsInfo.quality.generic.name = "Sound Quality:";
soundOptionsInfo.quality.generic.name = "SDL Sound Quality:";
soundOptionsInfo.quality.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
soundOptionsInfo.quality.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.quality.generic.id = ID_QUALITY;
soundOptionsInfo.quality.generic.x = 400;
soundOptionsInfo.quality.generic.y = y;
soundOptionsInfo.quality.itemnames = quality_items;
/*
y += BIGCHAR_HEIGHT+2;
soundOptionsInfo.a3d.generic.type = MTYPE_RADIOBUTTON;
@ -300,6 +401,17 @@ static void UI_SoundOptionsMenu_Init( void ) {
soundOptionsInfo.back.width = 128;
soundOptionsInfo.back.height = 64;
soundOptionsInfo.back.focuspic = ART_BACK1;
soundOptionsInfo.apply.generic.type = MTYPE_BITMAP;
soundOptionsInfo.apply.generic.name = ART_ACCEPT0;
soundOptionsInfo.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE;
soundOptionsInfo.apply.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.apply.generic.id = ID_APPLY;
soundOptionsInfo.apply.generic.x = 640;
soundOptionsInfo.apply.generic.y = 480-64;
soundOptionsInfo.apply.width = 128;
soundOptionsInfo.apply.height = 64;
soundOptionsInfo.apply.focuspic = ART_ACCEPT1;
*/
soundOptionsInfo.back.generic.type = MTYPE_PTEXT;
soundOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
@ -312,6 +424,16 @@ static void UI_SoundOptionsMenu_Init( void ) {
soundOptionsInfo.back.style = UI_LEFT | UI_SMALLFONT;
// END
soundOptionsInfo.apply.generic.type = MTYPE_PTEXT;
soundOptionsInfo.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE;
soundOptionsInfo.apply.generic.x = 620;
soundOptionsInfo.apply.generic.y = 480 - 50;
soundOptionsInfo.apply.generic.id = ID_APPLY;
soundOptionsInfo.apply.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.apply.string = "APPLY";
soundOptionsInfo.apply.color = text_color_normal;
soundOptionsInfo.apply.style = UI_RIGHT | UI_SMALLFONT;
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.banner );
// STONELANCE
/*
@ -325,13 +447,34 @@ static void UI_SoundOptionsMenu_Init( void ) {
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.network );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.sfxvolume );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.musicvolume );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.soundSystem );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.quality );
// Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.a3d );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.back );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.apply );
soundOptionsInfo.sfxvolume.curvalue = soundOptionsInfo.sfxvolume_original = trap_Cvar_VariableValue( "s_volume" ) * 10;
soundOptionsInfo.musicvolume.curvalue = soundOptionsInfo.musicvolume_original = trap_Cvar_VariableValue( "s_musicvolume" ) * 10;
if (trap_Cvar_VariableValue( "s_useOpenAL" ))
soundOptionsInfo.soundSystem_original = UISND_OPENAL;
else
soundOptionsInfo.soundSystem_original = UISND_SDL;
soundOptionsInfo.soundSystem.curvalue = soundOptionsInfo.soundSystem_original;
speed = trap_Cvar_VariableValue( "s_sdlSpeed" );
if (!speed) // Check for default
speed = DEFAULT_SDL_SND_SPEED;
if (speed <= 11025)
soundOptionsInfo.quality_original = 0;
else if (speed <= 22050)
soundOptionsInfo.quality_original = 1;
else // 44100
soundOptionsInfo.quality_original = 2;
soundOptionsInfo.quality.curvalue = soundOptionsInfo.quality_original;
soundOptionsInfo.sfxvolume.curvalue = trap_Cvar_VariableValue( "s_volume" ) * 10;
soundOptionsInfo.musicvolume.curvalue = trap_Cvar_VariableValue( "s_musicvolume" ) * 10;
soundOptionsInfo.quality.curvalue = !trap_Cvar_VariableValue( "s_compression" );
// soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" );
}
@ -348,6 +491,8 @@ void UI_SoundOptionsMenu_Cache( void ) {
trap_R_RegisterShaderNoMip( ART_FRAMER );
trap_R_RegisterShaderNoMip( ART_BACK0 );
trap_R_RegisterShaderNoMip( ART_BACK1 );
trap_R_RegisterShaderNoMip( ART_ACCEPT0 );
trap_R_RegisterShaderNoMip( ART_ACCEPT1 );
*/
// END
}

View file

@ -338,7 +338,6 @@ typedef struct {
menulist_s lighting;
menulist_s allow_extensions;
menulist_s texturebits;
menulist_s colordepth;
menulist_s geometry;
menulist_s filter;
menutext_s driverinfo;
@ -357,7 +356,6 @@ typedef struct
qboolean fullscreen;
int tq;
int lighting;
int colordepth;
int texturebits;
int geometry;
int filter;
@ -371,22 +369,22 @@ static graphicsoptions_t s_graphicsoptions;
static InitialVideoOptions_s s_ivo_templates[] =
{
{
6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue
6, qtrue, 3, 0, 2, 2, 1, 0, qtrue
},
{
4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue // JDC: this was tq 3
4, qtrue, 2, 0, 2, 1, 1, 0, qtrue // JDC: this was tq 3
},
{
3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
3, qtrue, 2, 0, 0, 1, 0, 0, qtrue
},
{
2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
2, qtrue, 1, 0, 0, 0, 0, 0, qtrue
},
{
2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
2, qtrue, 1, 1, 0, 0, 0, 0, qtrue
},
{
3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
3, qtrue, 1, 0, 0, 1, 0, 0, qtrue
}
};
@ -540,7 +538,6 @@ GraphicsOptions_GetInitialVideo
*/
static void GraphicsOptions_GetInitialVideo( void )
{
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
s_ivo.driver = s_graphicsoptions.driver.curvalue;
s_ivo.mode = s_graphicsoptions.mode.curvalue;
s_ivo.fullscreen = s_graphicsoptions.fs.curvalue;
@ -592,8 +589,6 @@ static void GraphicsOptions_CheckConfig( void )
for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ )
{
if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
continue;
if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
continue;
if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue )
@ -629,23 +624,12 @@ static void GraphicsOptions_UpdateMenuItems( void )
{
s_graphicsoptions.fs.curvalue = 1;
s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
s_graphicsoptions.colordepth.curvalue = 1;
}
else
{
s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
}
if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
{
s_graphicsoptions.colordepth.curvalue = 0;
s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
}
else
{
s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
}
if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
{
if ( s_graphicsoptions.texturebits.curvalue == 0 )
@ -676,10 +660,6 @@ static void GraphicsOptions_UpdateMenuItems( void )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
@ -825,7 +805,6 @@ static void GraphicsOptions_Event( void* ptr, int event ) {
resToRatio[ s_graphicsoptions.mode.curvalue ];
s_graphicsoptions.tq.curvalue = ivo->tq;
s_graphicsoptions.lighting.curvalue = ivo->lighting;
s_graphicsoptions.colordepth.curvalue = ivo->colordepth;
s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
s_graphicsoptions.geometry.curvalue = ivo->geometry;
s_graphicsoptions.filter.curvalue = ivo->filter;
@ -977,29 +956,6 @@ static void GraphicsOptions_SetMenuItems( void )
{
s_graphicsoptions.geometry.curvalue = 2;
}
switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
{
default:
case 0:
s_graphicsoptions.colordepth.curvalue = 0;
break;
case 16:
s_graphicsoptions.colordepth.curvalue = 1;
break;
case 32:
s_graphicsoptions.colordepth.curvalue = 2;
break;
}
if ( s_graphicsoptions.fs.curvalue == 0 )
{
s_graphicsoptions.colordepth.curvalue = 0;
}
if ( s_graphicsoptions.driver.curvalue == 1 )
{
s_graphicsoptions.colordepth.curvalue = 1;
}
}
/*
@ -1042,14 +998,6 @@ void GraphicsOptions_MenuInit( void )
NULL
};
static const char *colordepth_names[] =
{
"Default",
"16 bit",
"32 bit",
NULL
};
static const char *filter_names[] =
{
"Bilinear",
@ -1213,15 +1161,6 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.mode.generic.id = ID_MODE;
y += BIGCHAR_HEIGHT+2;
// references "r_colorbits"
s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.colordepth.generic.name = "Color Depth:";
s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_graphicsoptions.colordepth.generic.x = 400;
s_graphicsoptions.colordepth.generic.y = y;
s_graphicsoptions.colordepth.itemnames = colordepth_names;
y += BIGCHAR_HEIGHT+2;
// references/modifies "r_fullscreen"
s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.fs.generic.name = "Fullscreen:";
@ -1353,7 +1292,6 @@ void GraphicsOptions_MenuInit( void )
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.ratio );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );

View file

@ -967,12 +967,16 @@ void *Z_TagMalloc( int size, int tag ) {
do {
if (rover == start) {
// scaned all the way around the list
#ifdef ZONE_DEBUG
Z_LogHeap();
#endif
// scaned all the way around the list
Com_Error( ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone",
Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone: %s, line: %d (%s)",
size, zone == smallzone ? "small" : "main", file, line, label);
#else
Com_Error(ERR_FATAL, "Z_Malloc: failed on allocation of %i bytes from the %s zone",
size, zone == smallzone ? "small" : "main");
#endif
return NULL;
}
if (rover->tag) {
@ -1725,8 +1729,11 @@ void *Hunk_Alloc( int size, ha_pref preference ) {
#ifdef HUNK_DEBUG
Hunk_Log();
Hunk_SmallLog();
Com_Error(ERR_DROP, "Hunk_Alloc failed on %i: %s, line: %d (%s)", size, file, line, label);
#else
Com_Error(ERR_DROP, "Hunk_Alloc failed on %i", size);
#endif
Com_Error( ERR_DROP, "Hunk_Alloc failed on %i", size );
}
if ( hunk_permanent == &hunk_low ) {
@ -1870,46 +1877,6 @@ void Hunk_ClearTempMemory( void ) {
}
}
/*
=================
Hunk_Trash
=================
*/
void Hunk_Trash( void ) {
int length, i, rnd;
char *buf, value;
return;
if ( s_hunkData == NULL )
return;
#ifdef _DEBUG
Com_Error(ERR_DROP, "hunk trashed");
return;
#endif
Cvar_Set("com_jp", "1");
Hunk_SwapBanks();
if ( hunk_permanent == &hunk_low ) {
buf = (void *)(s_hunkData + hunk_permanent->permanent);
} else {
buf = (void *)(s_hunkData + s_hunkTotal - hunk_permanent->permanent );
}
length = hunk_permanent->permanent;
if (length > 0x7FFFF) {
//randomly trash data within buf
rnd = random() * (length - 0x7FFFF);
value = 31;
for (i = 0; i < 0x7FFFF; i++) {
value *= 109;
buf[rnd+i] ^= value;
}
}
}
/*
===================================================================
@ -2330,7 +2297,7 @@ A way to force a bus error for development reasons
=================
*/
static void Com_Crash_f( void ) {
* ( int * ) 0 = 0x12345678;
* ( volatile int * ) 0 = 0x12345678;
}
/*

View file

@ -168,10 +168,15 @@ int Cvar_Flags(const char *var_name)
{
cvar_t *var;
if(! (var = Cvar_FindVar(var_name)) )
if(!(var = Cvar_FindVar(var_name)))
return CVAR_NONEXISTENT;
else
return var->flags;
{
if(var->modified)
return var->flags | CVAR_MODIFIED;
else
return var->flags;
}
}
/*

View file

@ -1120,7 +1120,7 @@ Returns filesize and an open FILE pointer.
*/
extern qboolean com_fullyInitialized;
long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_t *file, qboolean uniqueFILE)
long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_t *file, qboolean uniqueFILE, qboolean unpure)
{
long hash;
pack_t *pak;
@ -1229,7 +1229,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(search->pack->hashTable[hash])
{
// disregard if it doesn't match one of the allowed pure pak files
if(!FS_PakIsPure(search->pack))
if(!unpure && !FS_PakIsPure(search->pack))
{
*file = 0;
return -1;
@ -1320,12 +1320,12 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
// this test can make the search fail although the file is in the directory
// I had the problem on https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=8
// turned out I used FS_FileExists instead
if(fs_numServerPaks)
if(!unpure && fs_numServerPaks)
{
if(!FS_IsExt(filename, ".cfg", len) && // for config files
!FS_IsExt(filename, ".menu", len) && // menu files
!FS_IsExt(filename, ".game", len) && // menu files
!FS_IsExt(filename, ".cfg", len) && // for journal files
!FS_IsExt(filename, ".dat", len) && // for journal files
!FS_IsDemoExt(filename, len)) // demos
{
*file = 0;
@ -1380,7 +1380,7 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF
for(search = fs_searchpaths; search; search = search->next)
{
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE);
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse);
if(file == NULL)
{
@ -1437,7 +1437,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
if(enableDll)
Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name);
Com_sprintf(qvmName, sizeof(dllName), "vm/%s.qvm", name);
Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name);
lastSearch = *startSearch;
if(*startSearch == NULL)
@ -1464,7 +1464,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
}
}
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse) > 0)
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0)
{
*startSearch = search;
return VMI_COMPILED;
@ -1486,7 +1486,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
}
}
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse) > 0)
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0)
{
*startSearch = search;
@ -1791,7 +1791,7 @@ a null buffer will just return the file length without loading
If searchPath is non-NULL search only in that specific search path
============
*/
long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer)
long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void **buffer)
{
fileHandle_t h;
searchpath_t *search;
@ -1864,7 +1864,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer)
else
{
// look for it in a specific search path only
len = FS_FOpenFileReadDir(qpath, search, &h, qfalse);
len = FS_FOpenFileReadDir(qpath, search, &h, qfalse, unpure);
}
if ( h == 0 ) {
@ -1923,7 +1923,7 @@ a null buffer will just return the file length without loading
*/
long FS_ReadFile(const char *qpath, void **buffer)
{
return FS_ReadFileDir(qpath, NULL, buffer);
return FS_ReadFileDir(qpath, NULL, qfalse, buffer);
}
/*
@ -2748,7 +2748,7 @@ void FS_Path_f( void ) {
}
}
} else {
Com_Printf ("%s/%s\n", s->dir->path, s->dir->gamedir );
Com_Printf ("%s%c%s\n", s->dir->path, PATH_SEP, s->dir->gamedir );
}
}
@ -2790,7 +2790,7 @@ qboolean FS_Which(const char *filename, void *searchPath)
{
searchpath_t *search = searchPath;
if(FS_FOpenFileReadDir(filename, search, NULL, qfalse) > 0)
if(FS_FOpenFileReadDir(filename, search, NULL, qfalse, qfalse) > 0)
{
if(search->pack)
{
@ -4049,13 +4049,13 @@ void FS_Restart( int checksumFeed ) {
/*
=================
FS_ConditionalRestart
restart if necessary
Restart if necessary
Return qtrue if restarting due to game directory changed, qfalse otherwise
=================
*/
qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
{
int retval;
if(fs_gamedirvar->modified)
{
if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) &&
@ -4066,13 +4066,8 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
return qtrue;
}
else
{
fs_gamedirvar->modified = qfalse;
retval = qtrue;
}
}
else
retval = qfalse;
if(checksumFeed != fs_checksumFeed)
FS_Restart(checksumFeed);

View file

@ -1190,7 +1190,7 @@ netField_t playerStateFields[] =
{ PSF(grapplePoint[0]), 0 },
{ PSF(grapplePoint[1]), 0 },
{ PSF(grapplePoint[2]), 0 },
{ PSF(jumppad_ent), 10 },
{ PSF(jumppad_ent), GENTITYNUM_BITS },
{ PSF(loopSound), 16 }
};

View file

@ -520,20 +520,12 @@ NET_GetPacket
Receive one packet
==================
*/
#ifdef _DEBUG
int recvfromCount;
#endif
qboolean NET_GetPacket(netadr_t *net_from, msg_t *net_message, fd_set *fdr)
{
int ret;
struct sockaddr_storage from;
socklen_t fromlen;
int err;
#ifdef _DEBUG
recvfromCount++; // performance check
#endif
if(ip_socket != INVALID_SOCKET && FD_ISSET(ip_socket, fdr))
{
@ -1709,6 +1701,7 @@ void NET_Sleep(int msec)
NET_Restart_f
====================
*/
void NET_Restart_f( void ) {
NET_Config( networkingEnabled );
void NET_Restart_f(void)
{
NET_Config(qtrue);
}

View file

@ -179,7 +179,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define OS_STRING "kFreeBSD"
#endif
#ifdef __clang__
#define ID_INLINE static inline
#else
#define ID_INLINE inline
#endif
#define PATH_SEP '/'
#if defined __i386__

View file

@ -896,11 +896,12 @@ int Q_isalpha( int c )
qboolean Q_isanumber( const char *s )
{
char *p;
double UNUSED_VAR d;
if( *s == '\0' )
return qfalse;
strtod( s, &p );
d = strtod( s, &p );
return *p == '\0';
}

View file

@ -98,6 +98,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#endif
#ifdef __GNUC__
#define UNUSED_VAR __attribute__((unused))
#else
#define UNUSED_VAR
#endif
#if (defined _MSC_VER)
#define Q_EXPORT __declspec(dllexport)
#elif (defined __SUNPRO_C)
@ -320,7 +326,7 @@ typedef enum {
#define UI_INVERSE 0x00002000
#define UI_PULSE 0x00004000
#if defined(_DEBUG) && !defined(BSPC)
#if !defined(NDEBUG) && !defined(BSPC)
#define HUNK_DEBUG
#endif
@ -977,7 +983,9 @@ default values.
#define CVAR_SERVER_CREATED 0x0800 // cvar was created by a server the client connected to.
#define CVAR_VM_CREATED 0x1000 // cvar was created exclusively in one of the VMs.
#define CVAR_PROTECTED 0x2000 // prevent modifying this var from VMs or the server
#define CVAR_NONEXISTENT 0xFFFFFFFF // Cvar doesn't exist.
// These flags are only returned by the Cvar_Flags() function
#define CVAR_MODIFIED 0x40000000 // Cvar was modified
#define CVAR_NONEXISTENT 0x80000000 // Cvar doesn't exist.
// nothing outside the Cvar_*() functions should modify these fields!
typedef struct cvar_s cvar_t;

View file

@ -260,7 +260,9 @@ PROTOCOL
// NOTE: that stuff only works with two digits protocols
extern int demo_protocols[];
#define UPDATE_SERVER_NAME "dl.q3rally.com"
#if !defined UPDATE_SERVER_NAME && !defined STANDALONE
#define UPDATE_SERVER_NAME "update.quake3arena.com"
#endif
// override on command line, config files etc.
#ifndef MASTER_SERVER_NAME
#define MASTER_SERVER_NAME "master.q3rally.com"
@ -361,7 +363,7 @@ void VM_Free( vm_t *vm );
void VM_Clear(void);
void VM_Forced_Unload_Start(void);
void VM_Forced_Unload_Done(void);
vm_t *VM_Restart( vm_t *vm );
vm_t *VM_Restart(vm_t *vm, qboolean unpure);
intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... );
@ -661,7 +663,7 @@ int FS_Read( void *buffer, int len, fileHandle_t f );
void FS_FCloseFile( fileHandle_t f );
// note: you can't just fclose from another DLL, due to MS libc issues
long FS_ReadFileDir(const char *qpath, void *searchPath, void **buffer);
long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void **buffer);
long FS_ReadFile(const char *qpath, void **buffer);
// returns the length of the file
// a null buffer will just return the file length without loading
@ -919,7 +921,7 @@ temp file loading
*/
#if defined(_DEBUG) && !defined(BSPC)
#if !defined(NDEBUG) && !defined(BSPC)
#define ZONE_DEBUG
#endif
@ -949,7 +951,6 @@ void *Hunk_AllocateTempMemory( int size );
void Hunk_FreeTempMemory( void *buf );
int Hunk_MemoryRemaining( void );
void Hunk_Log( void);
void Hunk_Trash( void );
void Com_TouchMemory( void );

View file

@ -1250,7 +1250,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
return UNZ_PARAMERROR;
if ((pfile_in_zip_read_info->read_buffer == NULL))
if (pfile_in_zip_read_info->read_buffer == NULL)
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;

View file

@ -363,7 +363,8 @@ VM_LoadQVM
Load a .qvm file
=================
*/
vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc, qboolean unpure)
{
int dataLength;
int i;
char filename[MAX_QPATH];
@ -376,7 +377,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name );
Com_Printf( "Loading vm file %s...\n", filename );
FS_ReadFileDir(filename, vm->searchPath, &header.v);
FS_ReadFileDir(filename, vm->searchPath, unpure, &header.v);
if ( !header.h ) {
Com_Printf( "Failed.\n" );
@ -447,13 +448,26 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
}
dataLength = 1 << i;
if( alloc ) {
if(alloc)
{
// allocate zero filled space for initialized and uninitialized data
vm->dataBase = Hunk_Alloc( dataLength, h_high );
vm->dataBase = Hunk_Alloc(dataLength, h_high);
vm->dataMask = dataLength - 1;
} else {
// clear the data
Com_Memset( vm->dataBase, 0, dataLength );
}
else
{
// clear the data, but make sure we're not clearing more than allocated
if(vm->dataMask + 1 != dataLength)
{
VM_Free(vm);
FS_FreeFile(header.v);
Com_Printf(S_COLOR_YELLOW "Warning: Data region size of %s not matching after "
"VM_Restart()\n", filename);
return NULL;
}
Com_Memset(vm->dataBase, 0, dataLength);
}
// copy the intialized data
@ -465,18 +479,36 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
*(int *)(vm->dataBase + i) = LittleLong( *(int *)(vm->dataBase + i ) );
}
if( header.h->vmMagic == VM_MAGIC_VER2 ) {
vm->numJumpTableTargets = header.h->jtrgLength >> 2;
Com_Printf( "Loading %d jump table targets\n", vm->numJumpTableTargets );
if(header.h->vmMagic == VM_MAGIC_VER2)
{
int previousNumJumpTableTargets = vm->numJumpTableTargets;
if( alloc ) {
vm->jumpTableTargets = Hunk_Alloc( header.h->jtrgLength, h_high );
} else {
Com_Memset( vm->jumpTableTargets, 0, header.h->jtrgLength );
header.h->jtrgLength &= ~0x03;
vm->numJumpTableTargets = header.h->jtrgLength >> 2;
Com_Printf("Loading %d jump table targets\n", vm->numJumpTableTargets);
if(alloc)
{
vm->jumpTableTargets = Hunk_Alloc(header.h->jtrgLength, h_high);
}
else
{
if(vm->numJumpTableTargets != previousNumJumpTableTargets)
{
VM_Free(vm);
FS_FreeFile(header.v);
Com_Printf(S_COLOR_YELLOW "Warning: Jump table size of %s not matching after "
"VM_Restart()\n", filename);
return NULL;
}
Com_Memset(vm->jumpTableTargets, 0, header.h->jtrgLength);
}
Com_Memcpy( vm->jumpTableTargets, (byte *)header.h + header.h->dataOffset +
header.h->dataLength + header.h->litLength, header.h->jtrgLength );
Com_Memcpy(vm->jumpTableTargets, (byte *) header.h + header.h->dataOffset +
header.h->dataLength + header.h->litLength, header.h->jtrgLength);
// byte swap the longs
for ( i = 0 ; i < header.h->jtrgLength ; i += 4 ) {
@ -493,9 +525,13 @@ VM_Restart
Reload the data, but leave everything else in place
This allows a server to do a map_restart without changing memory allocation
We need to make sure that servers can access unpure QVMs (not contained in any pak)
even if the client is pure, so take "unpure" as argument.
=================
*/
vm_t *VM_Restart( vm_t *vm ) {
vm_t *VM_Restart(vm_t *vm, qboolean unpure)
{
vmHeader_t *header;
// DLL's can't be restarted in place
@ -513,15 +549,16 @@ vm_t *VM_Restart( vm_t *vm ) {
}
// load the image
Com_Printf( "VM_Restart()\n" );
Com_Printf("VM_Restart()\n");
if( !( header = VM_LoadQVM( vm, qfalse ) ) ) {
Com_Error( ERR_DROP, "VM_Restart failed" );
if(!(header = VM_LoadQVM(vm, qfalse, unpure)))
{
Com_Error(ERR_DROP, "VM_Restart failed");
return NULL;
}
// free the original file
FS_FreeFile( header );
FS_FreeFile(header);
return vm;
}
@ -592,7 +629,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
else if(retval == VMI_COMPILED)
{
vm->searchPath = startSearch;
if((header = VM_LoadQVM(vm, qtrue)))
if((header = VM_LoadQVM(vm, qtrue, qfalse)))
break;
// VM_Free overwrites the name on failed load
@ -765,14 +802,14 @@ locals from sp
==============
*/
intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... )
{
vm_t *oldVM;
intptr_t r;
int i;
if ( !vm ) {
Com_Error( ERR_FATAL, "VM_Call with NULL vm" );
}
if(!vm || !vm->name[0])
Com_Error(ERR_FATAL, "VM_Call with NULL vm");
oldVM = currentVM;
currentVM = vm;

View file

@ -24,21 +24,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vm_local.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include <windows.h>
#else
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/mman.h> // for PROT_ stuff
#ifndef _WIN32
#include <sys/mman.h> // for PROT_ stuff
#endif
/* need this on NX enabled systems (i386 with PAE kernel or
* noexec32=on x86_64) */
#if defined(__linux__) || defined(__FreeBSD__)
#define VM_X86_MMAP
/* need this on NX enabled systems (i386 with PAE kernel or
* noexec32=on x86_64) */
#define VM_X86_MMAP
// workaround for systems that use the old MAP_ANON macro
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
#endif
static void VM_Destroy_Compiled(vm_t* self);
@ -442,7 +443,7 @@ static void DoSyscall(void)
int *data;
#if idx64
int index;
intptr_t args[11];
intptr_t args[16];
#endif
data = (int *) (savedVM->dataBase + programStack + 4);

View file

@ -86,8 +86,8 @@ static intptr_t CROSSCALL callAsmCall(intptr_t callProgramStack, int64_t callSys
{
vm_t *savedVM;
intptr_t ret = 0x77;
intptr_t args[11];
// int iargs[11];
intptr_t args[16];
// int iargs[16];
int i;
// Dfprintf(stderr, "callAsmCall(%ld, %ld)\n", callProgramStack, callSyscallNum);
@ -100,7 +100,7 @@ static intptr_t CROSSCALL callAsmCall(intptr_t callProgramStack, int64_t callSys
args[0] = callSyscallNum;
// iargs[0] = callSyscallNum;
for(i = 0; i < 10; ++i)
for(i = 0; i < ARRAY_LEN(args)-1; ++i)
{
// iargs[i+1] = *(int *)((byte *)currentVM->dataBase + callProgramStack + 8 + 4*i);
args[i+1] = *(int *)((byte *)currentVM->dataBase + callProgramStack + 8 + 4*i);

View file

@ -272,11 +272,11 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) {
shader_t *shader;
dshader_t *dsh;
shaderNum = LittleLong( shaderNum );
if ( shaderNum < 0 || shaderNum >= s_worldData.numShaders ) {
ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", shaderNum );
int _shaderNum = LittleLong( shaderNum );
if ( _shaderNum < 0 || _shaderNum >= s_worldData.numShaders ) {
ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", _shaderNum );
}
dsh = &s_worldData.shaders[ shaderNum ];
dsh = &s_worldData.shaders[ _shaderNum ];
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
lightmapNum = LIGHTMAP_BY_VERTEX;

View file

@ -297,7 +297,8 @@ void RE_StretchPic ( float x, float y, float w, float h,
#define MODE_RED_CYAN 1
#define MODE_RED_BLUE 2
#define MODE_RED_GREEN 3
#define MODE_MAX MODE_RED_GREEN
#define MODE_GREEN_MAGENTA 4
#define MODE_MAX MODE_GREEN_MAGENTA
void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode)
{
@ -313,16 +314,26 @@ void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode)
colormode -= MODE_MAX;
}
if(stereoFrame == STEREO_LEFT)
rgba[1] = rgba[2] = GL_FALSE;
else if(stereoFrame == STEREO_RIGHT)
if(colormode == MODE_GREEN_MAGENTA)
{
rgba[0] = GL_FALSE;
if(colormode == MODE_RED_BLUE)
if(stereoFrame == STEREO_LEFT)
rgba[0] = rgba[2] = GL_FALSE;
else if(stereoFrame == STEREO_RIGHT)
rgba[1] = GL_FALSE;
else if(colormode == MODE_RED_GREEN)
rgba[2] = GL_FALSE;
}
else
{
if(stereoFrame == STEREO_LEFT)
rgba[1] = rgba[2] = GL_FALSE;
else if(stereoFrame == STEREO_RIGHT)
{
rgba[0] = GL_FALSE;
if(colormode == MODE_RED_BLUE)
rgba[1] = GL_FALSE;
else if(colormode == MODE_RED_GREEN)
rgba[2] = GL_FALSE;
}
}
}

View file

@ -836,7 +836,7 @@ the bits are allocated as follows:
*/
#define QSORT_FOGNUM_SHIFT 2
#define QSORT_ENTITYNUM_SHIFT 7
#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+GENTITYNUM_BITS)
#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS)
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
#error "Need to update sorting, too many bits."
#endif

View file

@ -1127,7 +1127,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader,
int *fogNum, int *dlightMap ) {
*fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31;
*shader = tr.sortedShaders[ ( sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1) ];
*entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & (MAX_GENTITIES-1);
*entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & MAX_ENTITIES;
*dlightMap = sort & 3;
}

View file

@ -92,30 +92,26 @@ static void JointToMatrix( vec4_t rot, vec3_t scale, vec3_t trans,
mat[10] = scale[2] * (1.0f - (xx + yy));
mat[11] = trans[2];
}
static void JointToMatrixInverse( vec4_t rot, vec3_t scale, vec3_t trans,
float *mat ) {
float xx = 2.0f * rot[0] * rot[0];
float yy = 2.0f * rot[1] * rot[1];
float zz = 2.0f * rot[2] * rot[2];
float xy = 2.0f * rot[0] * rot[1];
float xz = 2.0f * rot[0] * rot[2];
float yz = 2.0f * rot[1] * rot[2];
float wx = 2.0f * rot[3] * rot[0];
float wy = 2.0f * rot[3] * rot[1];
float wz = 2.0f * rot[3] * rot[2];
static void Matrix34Invert( float *inMat, float *outMat )
{
vec3_t trans;
float invSqrLen, *v;
mat[ 0] = scale[0] * (1.0f - (yy + zz));
mat[ 1] = scale[0] * (xy + wz);
mat[ 2] = scale[2] * (xz - wy);
mat[ 3] = -DotProduct((mat + 0), trans);
mat[ 4] = scale[0] * (xy - wz);
mat[ 5] = scale[1] * (1.0f - (xx + zz));
mat[ 6] = scale[2] * (yz + wx);
mat[ 7] = -DotProduct((mat + 4), trans);
mat[ 8] = scale[0] * (xz + wy);
mat[ 9] = scale[1] * (yz - wx);
mat[10] = scale[2] * (1.0f - (xx + yy));
mat[11] = -DotProduct((mat + 8), trans);
outMat[ 0] = inMat[ 0]; outMat[ 1] = inMat[ 4]; outMat[ 2] = inMat[ 8];
outMat[ 4] = inMat[ 1]; outMat[ 5] = inMat[ 5]; outMat[ 6] = inMat[ 9];
outMat[ 8] = inMat[ 2]; outMat[ 9] = inMat[ 6]; outMat[10] = inMat[10];
v = outMat + 0; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v);
v = outMat + 4; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v);
v = outMat + 8; invSqrLen = 1.0f / DotProduct(v, v); VectorScale(v, invSqrLen, v);
trans[0] = inMat[ 3];
trans[1] = inMat[ 7];
trans[2] = inMat[11];
outMat[ 3] = -DotProduct(outMat + 0, trans);
outMat[ 7] = -DotProduct(outMat + 4, trans);
outMat[11] = -DotProduct(outMat + 8, trans);
}
/*
@ -288,9 +284,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
LL( triangle->vertex[1] );
LL( triangle->vertex[2] );
if( triangle->vertex[0] < 0 || triangle->vertex[0] > header->num_vertexes ||
triangle->vertex[1] < 0 || triangle->vertex[1] > header->num_vertexes ||
triangle->vertex[2] < 0 || triangle->vertex[2] > header->num_vertexes ) {
if( triangle->vertex[0] > header->num_vertexes ||
triangle->vertex[1] > header->num_vertexes ||
triangle->vertex[2] > header->num_vertexes ) {
return qfalse;
}
}
@ -327,9 +323,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
mesh->first_vertex + mesh->num_vertexes > header->num_vertexes ||
mesh->first_triangle >= header->num_triangles ||
mesh->first_triangle + mesh->num_triangles > header->num_triangles ||
mesh->name < 0 ||
mesh->name >= header->num_text ||
mesh->material < 0 ||
mesh->material >= header->num_text ) {
return qfalse;
}
@ -358,7 +352,6 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
if( joint->parent < -1 ||
joint->parent >= (int)header->num_joints ||
joint->name < 0 ||
joint->name >= (int)header->num_text ) {
return qfalse;
}
@ -473,36 +466,25 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
mat = jointMats;
joint = (iqmJoint_t *)((byte *)header + header->ofs_joints);
for( i = 0; i < header->num_joints; i++, joint++ ) {
float tmpMat[12];
float baseFrame[12], invBaseFrame[12];
JointToMatrix( joint->rotate, joint->scale, joint->translate,
tmpMat );
JointToMatrix( joint->rotate, joint->scale, joint->translate, baseFrame );
Matrix34Invert( baseFrame, invBaseFrame );
if( joint->parent >= 0 ) {
// premultiply with parent-matrix
Matrix34Multiply( jointMats + 2 * 12 * joint->parent,
tmpMat, mat);
} else {
Com_Memcpy( mat, tmpMat, sizeof(tmpMat) );
if ( joint->parent >= 0 )
{
Matrix34Multiply( jointMats + 2 * 12 * joint->parent, baseFrame, mat );
mat += 12;
Matrix34Multiply( invBaseFrame, jointMats + 2 * 12 * joint->parent + 12, mat );
mat += 12;
}
mat += 12;
// compute the inverse matrix by combining the
// inverse scale, rotation and translation
JointToMatrixInverse( joint->rotate, joint->scale,
joint->translate, tmpMat );
if( joint->parent >= 0 ) {
// premultiply with inverse parent-matrix
Matrix34Multiply( tmpMat,
jointMats + 2 * 12 * joint->parent + 12,
mat);
} else {
Com_Memcpy( mat, tmpMat, sizeof(tmpMat) );
else
{
Com_Memcpy( mat, baseFrame, sizeof(baseFrame) );
mat += 12;
Com_Memcpy( mat, invBaseFrame, sizeof(invBaseFrame) );
mat += 12;
}
mat += 12;
}
// calculate pose matrices

View file

@ -209,6 +209,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
return;
}
if ( r_numentities >= MAX_ENTITIES ) {
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_ENTITIES\n");
return;
}
if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) {
@ -219,7 +220,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
}
return;
}
if ( ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) {
if ( (int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) {
ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType );
}

View file

@ -25,7 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
#define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
#define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1)
// renderfx flags
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)

View file

@ -535,13 +535,12 @@ static void IN_DeactivateMouse( void )
static int joy_keys[16] = {
K_LEFTARROW, K_RIGHTARROW,
K_UPARROW, K_DOWNARROW,
K_JOY16, K_JOY17,
K_JOY18, K_JOY19,
K_JOY20, K_JOY21,
K_JOY22, K_JOY23,
K_JOY24, K_JOY25,
K_JOY26, K_JOY27
K_JOY17, K_JOY18,
K_JOY19, K_JOY20,
K_JOY21, K_JOY22,
K_JOY23, K_JOY24,
K_JOY25, K_JOY26,
K_JOY27, K_JOY28
};
// translate hat events into keypresses

View file

@ -60,6 +60,7 @@ void SV_GetChallenge(netadr_t from)
challenge_t *challenge;
qboolean wasfound = qfalse;
char *gameName;
qboolean gameMismatch;
// ignore if we are in single player
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) {
@ -67,15 +68,21 @@ void SV_GetChallenge(netadr_t from)
}
gameName = Cmd_Argv(2);
if(gameName && *gameName)
#ifdef LEGACY_PROTOCOL
// gamename is optional for legacy protocol
if (com_legacyprotocol->integer && !*gameName)
gameMismatch = qfalse;
else
#endif
gameMismatch = !*gameName || strcmp(gameName, com_gamename->string) != 0;
// reject client if the gamename string sent by the client doesn't match ours
if (gameMismatch)
{
// reject client if the heartbeat string sent by the client doesn't match ours
if(strcmp(gameName, com_gamename->string))
{
NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n",
com_gamename->string);
return;
}
NET_OutOfBandPrint(NS_SERVER, from, "print\nGame mismatch: This is a %s server\n",
com_gamename->string);
return;
}
oldest = 0;

View file

@ -901,7 +901,7 @@ void SV_RestartGameProgs( void ) {
VM_Call( gvm, GAME_SHUTDOWN, qtrue );
// do a restart instead of a free
gvm = VM_Restart( gvm );
gvm = VM_Restart(gvm, qtrue);
if ( !gvm ) {
Com_Error( ERR_FATAL, "VM_Restart on game failed" );
}

View file

@ -672,12 +672,12 @@ int SV_PointContents( const vec3_t p, int passEntityNum ) {
hit = SV_GentityNum( touch[i] );
// might intersect, so do an exact clip
clipHandle = SV_ClipHandleForEntity( hit );
angles = hit->s.angles;
angles = hit->r.currentAngles;
if ( !hit->r.bmodel ) {
angles = vec3_origin; // boxes don't rotate
}
c2 = CM_TransformedPointContents (p, clipHandle, hit->s.origin, angles);
c2 = CM_TransformedPointContents (p, clipHandle, hit->r.currentOrigin, angles);
contents |= c2;
}

View file

@ -88,13 +88,14 @@ send "\b \b"
static void CON_Back( void )
{
char key;
size_t UNUSED_VAR size;
key = '\b';
write(STDOUT_FILENO, &key, 1);
size = write(STDOUT_FILENO, &key, 1);
key = ' ';
write(STDOUT_FILENO, &key, 1);
size = write(STDOUT_FILENO, &key, 1);
key = '\b';
write(STDOUT_FILENO, &key, 1);
size = write(STDOUT_FILENO, &key, 1);
}
/*
@ -145,12 +146,13 @@ static void CON_Show( void )
ttycon_hide--;
if (ttycon_hide == 0)
{
write(STDOUT_FILENO, "]", 1);
size_t UNUSED_VAR size;
size = write(STDOUT_FILENO, "]", 1);
if (TTY_con.cursor)
{
for (i=0; i<TTY_con.cursor; i++)
{
write(STDOUT_FILENO, TTY_con.buffer+i, 1);
size = write(STDOUT_FILENO, TTY_con.buffer+i, 1);
}
}
}
@ -327,6 +329,7 @@ char *CON_Input( void )
int avail;
char key;
field_t *history;
size_t UNUSED_VAR size;
if(ttycon_on)
{
@ -356,8 +359,8 @@ char *CON_Input( void )
Q_strncpyz(text, TTY_con.buffer, sizeof(text));
Field_Clear(&TTY_con);
key = '\n';
write(STDOUT_FILENO, &key, 1);
write(STDOUT_FILENO, "]", 1);
size = write(STDOUT_FILENO, &key, 1);
size = write(STDOUT_FILENO, "]", 1);
return text;
}
if (key == '\t')
@ -421,7 +424,7 @@ char *CON_Input( void )
TTY_con.buffer[TTY_con.cursor] = key;
TTY_con.cursor++;
// print the current line (this is differential)
write(STDOUT_FILENO, &key, 1);
size = write(STDOUT_FILENO, &key, 1);
}
return NULL;

View file

@ -326,13 +326,14 @@ char *CON_Input( void )
}
}
CON_Show();
if( newlinepos < 0)
if( newlinepos < 0) {
CON_Show();
return NULL;
}
if( !qconsole_linelen )
{
CON_Show();
Com_Printf( "\n" );
return NULL;
}
@ -341,6 +342,7 @@ char *CON_Input( void )
Com_Printf( "%s\n", qconsole_line );
qconsole_linelen = 0;
CON_Show();
return qconsole_line;
}

View file

@ -549,10 +549,12 @@ void Sys_SigHandler( int signal )
else
{
signalcaught = qtrue;
VM_Forced_Unload_Start();
#ifndef DEDICATED
CL_Shutdown(va("Received signal %d", signal), qtrue, qtrue);
#endif
SV_Shutdown(va("Received signal %d", signal) );
VM_Forced_Unload_Done();
}
if( signal == SIGTERM || signal == SIGINT )

View file

@ -810,8 +810,8 @@ void Sys_GLimpInit( void )
void Sys_SetFloatEnv(void)
{
// rounding towards 0
fesetround(FE_TOWARDZERO);
// rounding toward nearest
fesetround(FE_TONEAREST);
}
/*

View file

@ -59,14 +59,14 @@ Set FPU control word to default value
#define _MCW_EM 0x0008001fU
#define _MCW_RC 0x00000300U
#define _MCW_PC 0x00030000U
#define _RC_CHOP 0x00000300U
#define _RC_NEAR 0x00000000U
#define _PC_53 0x00010000U
unsigned int _controlfp(unsigned int new, unsigned int mask);
#endif
#define FPUCWMASK1 (_MCW_RC | _MCW_EM)
#define FPUCW (_RC_CHOP | _MCW_EM | _PC_53)
#define FPUCW (_RC_NEAR | _MCW_EM | _PC_53)
#if idx64
#define FPUCWMASK (FPUCWMASK1)

130
engine/make-macosx.sh Executable file
View file

@ -0,0 +1,130 @@
#!/bin/sh
APPBUNDLE=ioquake3.app
BINARY=ioquake3.x86_64
DEDBIN=ioq3ded.x86_64
PKGINFO=APPLIOQ3
ICNS=misc/quake3.icns
DESTDIR=build/release-darwin-x86_64
BASEDIR=baseq3
MPACKDIR=missionpack
RENDERDIR=build/release-darwin-x86_64
BIN_OBJ="
build/release-darwin-x86_64/ioquake3.x86_64
"
BIN_DEDOBJ="
build/release-darwin-x86_64/ioq3ded.x86_64
"
BASE_OBJ="
build/release-darwin-x86_64/$BASEDIR/cgamex86_64.dylib
build/release-darwin-x86_64/$BASEDIR/uix86_64.dylib
build/release-darwin-x86_64/$BASEDIR/qagamex86_64.dylib
"
MPACK_OBJ="
build/release-darwin-x86_64/$MPACKDIR/cgamex86_64.dylib
build/release-darwin-x86_64/$MPACKDIR/uix86_64.dylib
build/release-darwin-x86_64/$MPACKDIR/qagamex86_64.dylib
"
RENDER_OBJ="
build/release-darwin-x86_64/renderer_opengl1_smp_x86_64.dylib
build/release-darwin-x86_64/renderer_opengl1_x86_64.dylib
"
cd `dirname $0`
if [ ! -f Makefile ]; then
echo "This script must be run from the ioquake3 build directory"
exit 1
fi
Q3_VERSION=`grep '^VERSION=' Makefile | sed -e 's/.*=\(.*\)/\1/'`
# We only care if we're >= 10.4, not if we're specifically Tiger.
# "8" is the Darwin major kernel version.
TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'`
# we want to use the oldest available SDK for max compatiblity
unset X86_SDK
unset X86_CFLAGS
unset X86_LDFLAGS
if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
X86_SDK=/Developer/SDKs/MacOSX10.5.sdk
X86_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
X86_LDFLAGS=" -mmacosx-version-min=10.5"
fi
echo "Building X86 Client/Dedicated Server against \"$X86_SDK\""
sleep 3
if [ ! -d $DESTDIR ]; then
mkdir -p $DESTDIR
fi
# For parallel make on multicore boxes...
NCPU=`sysctl -n hw.ncpu`
# intel client and server
if [ -d build/release-darwin-x86_64 ]; then
rm -r build/release-darwin-x86_64
fi
(ARCH=x86_64 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1;
echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR || exit 1;
fi
if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR ]; then
mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR || exit 1;
fi
if [ ! -d $DESTDIR/$APPBUNDLE/Contents/Resources ]; then
mkdir -p $DESTDIR/$APPBUNDLE/Contents/Resources
fi
cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/ioquake3.icns || exit 1;
echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo
echo "
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist
PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>$BINARY</string>
<key>CFBundleGetInfoString</key>
<string>ioquake3 $Q3_VERSION</string>
<key>CFBundleIconFile</key>
<string>ioquake3.icns</string>
<key>CFBundleIdentifier</key>
<string>org.ioquake.ioquake3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ioquake3</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$Q3_VERSION</string>
<key>CFBundleSignature</key>
<string>$PKGINFO</string>
<key>CFBundleVersion</key>
<string>$Q3_VERSION</string>
<key>NSExtensions</key>
<dict/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
" > $DESTDIR/$APPBUNDLE/Contents/Info.plist
lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$BINARY $BIN_OBJ
lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$DEDBIN $BIN_DEDOBJ
cp $RENDER_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/
cp $BASE_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR/
cp $MPACK_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR/
cp code/libs/macosx/*.dylib $DESTDIR/$APPBUNDLE/Contents/MacOS/

View file

@ -1,16 +1,76 @@
VERSION=1.0_SVN
ifndef VERSION
VERSION=v0.0.0.3
endif
ifndef RELEASE
RELEASE=0
endif
ifndef ARCH
ARCH=x86
endif
ifndef INSTALLDIR
INSTALLDIR=.
endif
ifndef USE_RENDERER_DLOPEN
USE_RENDERER_DLOPEN=1
endif
ifndef USE_OPENAL_DLOPEN
USE_OPENAL_DLOPEN=1
endif
ifndef USE_CURL_DLOPEN
USE_CURL_DLOPEN=0
endif
ifndef USE_INTERNAL_SPEEX
USE_INTERNAL_SPEEX=1
endif
ifndef USE_INTERNAL_ZLIB
USE_INTERNAL_ZLIB=1
endif
ifndef USE_INTERNAL_JPEG
USE_INTERNAL_JPEG=1
endif
ifeq ($(ARCH),x64)
SDLDLL=SDL64.dll
else
SDLDLL=SDL.dll
endif
DEFINES=
ifeq ($(USE_RENDERER_DLOPEN),1)
DEFINES+= -DUSE_RENDERER_DLOPEN
endif
ifeq ($(USE_OPENAL_DLOPEN),1)
DEFINES+= -DUSE_OPENAL_DLOPEN
endif
ifeq ($(USE_CURL_DLOPEN),1)
DEFINES+= -DUSE_CURL_DLOPEN
endif
ifeq ($(USE_INTERNAL_SPEEX),1)
DEFINES+= -DUSE_INTERNAL_SPEEX
endif
ifeq ($(USE_INTERNAL_ZLIB),1)
DEFINES+= -DUSE_INTERNAL_ZLIB
endif
ifeq ($(USE_INTERNAL_JPEG),1)
DEFINES+= -DUSE_INTERNAL_JPEG
endif
all: q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe
q3rally.nsi: q3rally.nsi.in
sed 's/XXXVERSIONXXX/$(VERSION)/;s/XXXRELEASEXXX/$(RELEASE)/;s/x86/$(ARCH)/g' < $< > $@
q3rally.$(ARCH).nsi: q3rally.nsi.in
sed 's/XXXVERSIONXXX/$(VERSION)/;s/XXXRELEASEXXX/$(RELEASE)/;s/x86/$(ARCH)/g;s/SDL.dll/$(SDLDLL)/' < $< > $@
q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe: q3rally.nsi
makensis q3rally.nsi
q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe: q3rally.$(ARCH).nsi
makensis $(DEFINES) q3rally.$(ARCH).nsi
clean:
rm -rf *.exe q3rally.nsi
rm -rf *.exe q3rally.$(ARCH).nsi
install:
mkdir -p $(INSTALLDIR)
mv q3rally-$(VERSION)-$(RELEASE).$(ARCH).exe $(INSTALLDIR)
.PHONY: all clean

View file

@ -5,7 +5,7 @@
; This file is used to automatically build the installers in the
; openSUSE build service, don't break this!
;
; you have to copy SDL.dll, OpenAL32.dll, libcurl-4.dll, and zlib1.dll here manually
; you have to copy SDL.dll and OpenAL32.dll here manually
!define VERSION "XXXVERSIONXXX"
!define RELEASE "XXXRELEASEXXX"
@ -37,7 +37,7 @@
Name "${GAMENAME} ${VERSION}"
; The file to write
OutFile "${GAME_FSNAME}-${VERSION}-${RELEASE}.exe"
OutFile "${GAME_FSNAME}-${VERSION}-${RELEASE}.x86.exe"
; The default installation directory
; set by Multiuser.nsh
@ -91,11 +91,23 @@ Section "${GAMENAME} ${VERSION}-${RELEASE} (required)"
; Set output path to the installation directory.
SetOutPath $INSTDIR
!ifndef USE_INTERNAL_SPEEX
File "libspeex.dll"
!endif
!ifndef USE_INTERNAL_ZLIB
File "zlib1.dll"
!endif
!ifndef USE_INTERNAL_JPEG
File "jpeg8c.dll"
!endif
; Put file there
File "../../build/release-mingw32-x86/${SERVER}"
File "../../build/release-mingw32-x86/${CLIENT}"
!ifdef USE_RENDERER_DLOPEN
File "../../build/release-mingw32-x86/renderer_opengl1_x86.dll"
!endif
File "../../COPYING.txt"
File "/oname=README.txt" "../../README"
@ -138,14 +150,7 @@ Section "SDL.dll"
SectionEnd
Section "libcurl"
SetOutPath $INSTDIR
File "libcurl-4.dll"
SectionEnd
!ifdef USE_OPENAL_DLOPEN
Section "OpenAL-Soft library"
SetOutPath $INSTDIR
@ -153,6 +158,17 @@ Section "OpenAL-Soft library"
File "OpenAL32.dll"
SectionEnd
!endif
!ifdef USE_CURL_DLOPEN
Section "libcurl"
SetOutPath $INSTDIR
File "libcurl-4.dll"
SectionEnd
!endif
;--------------------------------
@ -175,13 +191,23 @@ Section "Uninstall"
Delete $INSTDIR\COPYING.txt
Delete $INSTDIR\README.txt
!ifndef USE_INTERNAL_SPEEX
Delete $INSTDIR\libspeex.dll
!endif
!ifndef USE_INTERNAL_ZLIB
Delete $INSTDIR\zlib1.dll
!endif
!ifndef USE_INTERNAL_JPEG
Delete $INSTDIR\jpeg8c.dll
!endif
Delete $INSTDIR\SDL.dll
Delete $INSTDIR\libcurl-4.dll
!ifdef USE_OPENAL_DLOPEN
Delete $INSTDIR\OpenAL32.dll
!endif
!ifdef USE_CURL_DLOPEN
Delete $INSTDIR\libcurl-4.dll
!endif
Delete $INSTDIR\uninstall.exe