mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-03 09:22:45 +00:00
Merge branch 'master' into glew
Conflicts: neo/renderer/OpenGL/glext.h neo/renderer/RenderSystem_init.cpp
This commit is contained in:
commit
7690fb4b8e
97 changed files with 4267 additions and 668 deletions
|
@ -60,7 +60,7 @@ void DL_InitNetworking( DoomInterface *pdi );
|
|||
extern int PLAYERCOUNT;
|
||||
extern bool globalNetworking;
|
||||
extern bool debugOutput;
|
||||
extern BOOL globalLicenseFullGame;
|
||||
extern bool globalLicenseFullGame;
|
||||
extern int globalRichPresenceState; // values from spa.h X_CONTEXT_PRESENCE
|
||||
extern int globalNeedUpsell;
|
||||
// PS3
|
||||
|
|
|
@ -27,16 +27,17 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
// We are referring to sprite numbers.
|
||||
#include "info.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "d_items.h"
|
||||
#endif
|
||||
#include "d_items.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
// We are referring to sprite numbers.
|
||||
#include "info.h"
|
||||
|
||||
|
||||
//
|
||||
// PSPRITE ACTIONS for waepons.
|
||||
|
|
|
@ -414,7 +414,7 @@ void D_DoAdvanceDemo (void)
|
|||
::g->pagetic = 8 * TICRATE;
|
||||
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = "INTERPIC";
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
|
||||
if ( ::g->gamemode == commercial )
|
||||
S_StartMusic(mus_dm2ttl);
|
||||
|
@ -428,7 +428,7 @@ void D_DoAdvanceDemo (void)
|
|||
case 2:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = "INTERPIC";
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
break;
|
||||
case 3:
|
||||
G_DeferedPlayDemo ("demo2");
|
||||
|
@ -436,7 +436,7 @@ void D_DoAdvanceDemo (void)
|
|||
case 4:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = "INTERPIC";
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
break;
|
||||
case 5:
|
||||
G_DeferedPlayDemo ("demo3");
|
||||
|
@ -445,7 +445,7 @@ void D_DoAdvanceDemo (void)
|
|||
case 6:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = "INTERPIC";
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
break;
|
||||
case 7:
|
||||
G_DeferedPlayDemo ("demo4");
|
||||
|
|
|
@ -74,7 +74,7 @@ extern bool globalNetworking;
|
|||
//
|
||||
int NetbufferSize (void)
|
||||
{
|
||||
int size = (int)&(((doomdata_t *)0)->cmds[::g->netbuffer->numtics]);
|
||||
int size = (intptr_t)&(((doomdata_t *)0)->cmds[::g->netbuffer->numtics]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ unsigned NetbufferChecksum (void)
|
|||
c = 0x1234567;
|
||||
|
||||
if ( globalNetworking ) {
|
||||
l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4;
|
||||
l = (NetbufferSize () - (intptr_t)&(((doomdata_t *)0)->retransmitfrom))/4;
|
||||
for (i=0 ; i<l ; i++)
|
||||
c += ((unsigned *)&::g->netbuffer->retransmitfrom)[i] * (i+1);
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define BFGCELLS 40
|
||||
// p_pspr.defs end //
|
||||
// p_saveg.defs begin //
|
||||
#define PADSAVEP() ::g->save_p += (4 - ((int) ::g->save_p & 3)) & 3
|
||||
#define PADSAVEP() ::g->save_p += (4 - ((intptr_t) ::g->save_p & 3)) & 3
|
||||
// p_saveg.defs end //
|
||||
// p_setup.defs begin //
|
||||
#define MAX_DEATHMATCH_STARTS 10
|
||||
|
|
|
@ -27,14 +27,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "doomdef.h"
|
||||
#endif
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
// Location for any defines turned variables.
|
||||
|
||||
// None.
|
||||
|
|
|
@ -337,6 +337,9 @@ typedef enum
|
|||
//#include "sounds.h"
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
|
@ -41,7 +41,7 @@ extern void I_SetTime( int );
|
|||
bool waitingForWipe;
|
||||
|
||||
static const int dargc = 7;
|
||||
static char* dargv[4][7] =
|
||||
static const char* dargv[4][7] =
|
||||
{
|
||||
{ "doomlauncher", "-net", "0", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" },
|
||||
{ "doomlauncher", "-net", "1", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" },
|
||||
|
@ -106,7 +106,7 @@ void DoomInterface::Startup( int playerscount, bool multiplayer )
|
|||
printf( "\n" );
|
||||
DoomLib::InitGame(mpArgc[i], mpArgVPtr[i] );
|
||||
} else {
|
||||
DoomLib::InitGame(localdargc, dargv[i] );
|
||||
DoomLib::InitGame(localdargc, (char **)dargv[i] );
|
||||
}
|
||||
|
||||
if( DoomLib::skipToLoad ) {
|
||||
|
|
|
@ -141,9 +141,9 @@ namespace DoomLib
|
|||
|
||||
Globals *globaldata[4];
|
||||
|
||||
RecvFunc Recv;
|
||||
SendFunc Send;
|
||||
SendRemoteFunc SendRemote;
|
||||
//RecvFunc Recv;
|
||||
//SendFunc Send;
|
||||
//SendRemoteFunc SendRemote;
|
||||
|
||||
|
||||
bool Active = true;
|
||||
|
@ -419,12 +419,14 @@ void DoomLib::SetPlayer( int id )
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void DoomLib::SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote )
|
||||
{
|
||||
Recv = rf;
|
||||
Send = sf;
|
||||
SendRemote = sendRemote;
|
||||
}
|
||||
#endif
|
||||
|
||||
int DoomLib::GetPlayer()
|
||||
{
|
||||
|
@ -496,7 +498,7 @@ int DoomLib::PlayerIndexToRemoteNode( int index ) {
|
|||
return indexMap[::g->consoleplayer][index];
|
||||
}
|
||||
|
||||
void I_Error (char *error, ...);
|
||||
void I_Error (const char *error, ...);
|
||||
extern bool useTech5Packets;
|
||||
|
||||
void DoomLib::PollNetwork() {
|
||||
|
@ -544,7 +546,7 @@ void DoomLib::SendNetwork() {
|
|||
if ( !globalNetworking ) {
|
||||
return;
|
||||
}
|
||||
DoomLib::SendRemote();
|
||||
//DoomLib::SendRemote();
|
||||
}
|
||||
|
||||
void DoomLib::RunSound() {
|
||||
|
|
|
@ -93,9 +93,9 @@ struct ExpansionData {
|
|||
|
||||
namespace DoomLib
|
||||
{
|
||||
typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
||||
typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
||||
typedef int ( *SendRemoteFunc)();
|
||||
//typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
||||
//typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
||||
//typedef int ( *SendRemoteFunc)();
|
||||
|
||||
void InitGlobals( void *ptr = NULL );
|
||||
void InitGame( int argc, char ** argv );
|
||||
|
@ -108,7 +108,7 @@ namespace DoomLib
|
|||
void Draw();
|
||||
void Shutdown();
|
||||
|
||||
void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||
|
||||
void SetPlayer( int id );
|
||||
int GetPlayer();
|
||||
|
@ -126,9 +126,9 @@ namespace DoomLib
|
|||
|
||||
void RunSound();
|
||||
|
||||
extern RecvFunc Recv;
|
||||
extern SendFunc Send;
|
||||
extern SendRemoteFunc SendRemote;
|
||||
//extern RecvFunc Recv;
|
||||
//extern SendFunc Send;
|
||||
//extern SendRemoteFunc SendRemote;
|
||||
|
||||
extern void* (*Z_Malloc)( int size, int tag, void* user );
|
||||
extern void (*Z_FreeTag)(int lowtag );
|
||||
|
|
|
@ -27,14 +27,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dstrings.h"
|
||||
#endif
|
||||
#include "dstrings.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
const char* endmsg[NUM_QUITMESSAGES+1]=
|
||||
|
|
|
@ -592,9 +592,9 @@ qboolean F_CastResponder (event_t* ev)
|
|||
}
|
||||
|
||||
|
||||
void F_CastPrint (char* text)
|
||||
void F_CastPrint (const char* text)
|
||||
{
|
||||
char* ch;
|
||||
const char* ch;
|
||||
int c;
|
||||
int cx;
|
||||
int w;
|
||||
|
|
|
@ -1421,7 +1421,7 @@ qboolean G_DoLoadGame ()
|
|||
loadingGame = false;
|
||||
waitingForWipe = false;
|
||||
|
||||
return FALSE; // bad version
|
||||
return false; // bad version
|
||||
}
|
||||
|
||||
::g->save_p += VERSIONSIZE;
|
||||
|
@ -1463,7 +1463,7 @@ qboolean G_DoLoadGame ()
|
|||
|
||||
Z_Free(g->savebuffer);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1844,9 +1844,9 @@ void G_BeginRecording (void)
|
|||
//
|
||||
// G_PlayDemo
|
||||
//
|
||||
void G_DeferedPlayDemo (char* name)
|
||||
void G_DeferedPlayDemo (const char* name)
|
||||
{
|
||||
::g->defdemoname = name;
|
||||
::g->defdemoname = (char *)name;
|
||||
::g->gameaction = ga_playdemo;
|
||||
}
|
||||
|
||||
|
@ -1946,14 +1946,14 @@ void G_DoPlayDemo (void)
|
|||
//
|
||||
// G_TimeDemo
|
||||
//
|
||||
void G_TimeDemo (char* name)
|
||||
void G_TimeDemo (const char* name)
|
||||
{
|
||||
::g->nodrawers = M_CheckParm ("-nodraw");
|
||||
::g->noblit = M_CheckParm ("-noblit");
|
||||
::g->timingdemo = true;
|
||||
::g->singletics = true;
|
||||
|
||||
::g->defdemoname = name;
|
||||
::g->defdemoname = (char *)name;
|
||||
::g->gameaction = ga_playdemo;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ void G_InitNew ( skill_t skill, int episode, int map );
|
|||
// but a warp test can start elsewhere
|
||||
void G_DeferedInitNew (skill_t skill, int episode, int map);
|
||||
|
||||
void G_DeferedPlayDemo (char* demo);
|
||||
void G_DeferedPlayDemo (const char* demo);
|
||||
|
||||
// Can be called by the startup code or M_Responder,
|
||||
// calls P_SetupLevel or W_EnterWorld.
|
||||
|
@ -63,7 +63,7 @@ void G_RecordDemo (char* name);
|
|||
void G_BeginRecording (void);
|
||||
|
||||
void G_PlayDemo (char* name);
|
||||
void G_TimeDemo (char* name);
|
||||
void G_TimeDemo (const char* name);
|
||||
qboolean G_CheckDemoStatus (void);
|
||||
|
||||
void G_ExitLevel (void);
|
||||
|
|
|
@ -84,11 +84,11 @@ void M_SetupNextMenu(menu_t *menudef);
|
|||
void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
|
||||
void M_DrawEmptyCell(menu_t *menu,int item);
|
||||
void M_DrawSelCell(menu_t *menu,int item);
|
||||
void M_WriteText(int x, int y, char *string);
|
||||
int M_StringWidth(char *string);
|
||||
int M_StringHeight(char *string);
|
||||
void M_WriteText(int x, int y, const char *string);
|
||||
int M_StringWidth(const char *string);
|
||||
int M_StringHeight(const char *string);
|
||||
void M_StartControlPanel(void);
|
||||
void M_StartMessage(char *string,messageRoutine_t routine,qboolean input);
|
||||
void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
|
||||
void M_StopMessage(void);
|
||||
void M_ClearMenus (void);
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ int DOOMPORT = 1002; // DHM - Nerve :: On original XBox, ports 1000 - 1255 saved
|
|||
|
||||
|
||||
unsigned long GetServerIP() {
|
||||
return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr;
|
||||
//return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void (*netget) (void);
|
||||
|
@ -96,16 +97,17 @@ void (*netsend) (void);
|
|||
//
|
||||
int UDPsocket (void)
|
||||
{
|
||||
int s;
|
||||
//int s;
|
||||
|
||||
// allocate a socket
|
||||
s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if ( !IsValidSocket( s ) ) {
|
||||
int err = GetLastSocketError();
|
||||
I_Error( "can't create socket, error %d", err );
|
||||
}
|
||||
//s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
//if ( !IsValidSocket( s ) ) {
|
||||
// int err = GetLastSocketError();
|
||||
// I_Error( "can't create socket, error %d", err );
|
||||
//}
|
||||
|
||||
return s;
|
||||
//return s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -264,15 +266,15 @@ void I_ShutdownNetwork( void ) {
|
|||
|
||||
void I_NetCmd (void)
|
||||
{
|
||||
if (::g->doomcom.command == CMD_SEND)
|
||||
{
|
||||
netsend ();
|
||||
}
|
||||
else if (::g->doomcom.command == CMD_GET)
|
||||
{
|
||||
netget ();
|
||||
}
|
||||
else
|
||||
I_Error ("Bad net cmd: %i\n",::g->doomcom.command);
|
||||
//if (::g->doomcom.command == CMD_SEND)
|
||||
//{
|
||||
// netsend ();
|
||||
//}
|
||||
//else if (::g->doomcom.command == CMD_GET)
|
||||
//{
|
||||
// netget ();
|
||||
//}
|
||||
//else
|
||||
// I_Error ("Bad net cmd: %i\n",::g->doomcom.command);
|
||||
}
|
||||
|
||||
|
|
954
doomclassic/doom/i_sound_openal.cpp
Normal file
954
doomclassic/doom/i_sound_openal.cpp
Normal file
|
@ -0,0 +1,954 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Felix Rueegg
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// System interface for sound.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
// Timer stuff. Experimental.
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include "z_zone.h"
|
||||
#include "i_system.h"
|
||||
#include "i_sound.h"
|
||||
#include "m_argv.h"
|
||||
#include "m_misc.h"
|
||||
#include "w_wad.h"
|
||||
#include "d_main.h"
|
||||
#include "doomdef.h"
|
||||
#include "../timidity/timidity.h"
|
||||
#include "../timidity/controls.h"
|
||||
|
||||
#include "sound/snd_local.h"
|
||||
|
||||
#pragma warning ( disable : 4244 )
|
||||
|
||||
#define SFX_RATE 11050
|
||||
#define SFX_SAMPLETYPE AL_FORMAT_MONO8
|
||||
|
||||
#define MIDI_CHANNELS 2
|
||||
#define MIDI_RATE 22050
|
||||
#define MIDI_SAMPLETYPE AL_FORMAT_STEREO8
|
||||
#define MIDI_FORMAT AUDIO_U8
|
||||
#define MIDI_FORMAT_BYTES 1
|
||||
|
||||
ALuint alMusicSourceVoice;
|
||||
ALuint alMusicBuffer;
|
||||
|
||||
MidiSong* doomMusic;
|
||||
byte* musicBuffer;
|
||||
int totalBufferSize;
|
||||
|
||||
bool waitingForMusic;
|
||||
bool musicReady;
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} vec3_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t OrientTop;
|
||||
vec3_t OrientFront;
|
||||
vec3_t Position;
|
||||
} doomListener_t;
|
||||
|
||||
typedef struct tagActiveSound_t {
|
||||
ALuint alSourceVoice;
|
||||
int id;
|
||||
int valid;
|
||||
int start;
|
||||
int player;
|
||||
bool localSound;
|
||||
mobj_t *originator;
|
||||
} activeSound_t;
|
||||
|
||||
// cheap little struct to hold a sound
|
||||
typedef struct {
|
||||
int vol;
|
||||
int player;
|
||||
int pitch;
|
||||
int priority;
|
||||
mobj_t *originator;
|
||||
mobj_t *listener;
|
||||
} soundEvent_t;
|
||||
|
||||
// array of all the possible sounds
|
||||
// in split screen we only process the loudest sound of each type per frame
|
||||
soundEvent_t soundEvents[128];
|
||||
extern int PLAYERCOUNT;
|
||||
|
||||
// Source voice settings for all sound effects
|
||||
const ALfloat SFX_MAX_DISTANCE = 1200.f;
|
||||
const ALfloat SFX_REFERENCE_DISTANCE = 100.f;
|
||||
const ALfloat SFX_ROLLOFF_FACTOR = 0.2f;
|
||||
|
||||
// Real volumes
|
||||
const float GLOBAL_VOLUME_MULTIPLIER = 0.5f;
|
||||
|
||||
float x_SoundVolume = GLOBAL_VOLUME_MULTIPLIER;
|
||||
float x_MusicVolume = GLOBAL_VOLUME_MULTIPLIER;
|
||||
|
||||
// The actual lengths of all sound effects.
|
||||
static int lengths[NUMSFX];
|
||||
ALuint alBuffers[NUMSFX];
|
||||
activeSound_t activeSounds[NUM_SOUNDBUFFERS] = {0};
|
||||
|
||||
int S_initialized = 0;
|
||||
bool Music_initialized = false;
|
||||
static bool soundHardwareInitialized = false;
|
||||
static int numOutputChannels = 0;
|
||||
|
||||
doomListener_t doom_Listener;
|
||||
|
||||
void I_InitSoundChannel( int channel, int numOutputChannels_ );
|
||||
|
||||
/*
|
||||
======================
|
||||
getsfx
|
||||
======================
|
||||
*/
|
||||
// This function loads the sound data from the WAD lump,
|
||||
// for single sound.
|
||||
//
|
||||
void* getsfx ( const char* sfxname, int* len )
|
||||
{
|
||||
unsigned char* sfx;
|
||||
unsigned char* sfxmem;
|
||||
int size;
|
||||
char name[20];
|
||||
int sfxlump;
|
||||
//float scale = 1.0f;
|
||||
|
||||
// Get the sound data from the WAD
|
||||
sprintf( name, "ds%s", sfxname );
|
||||
|
||||
// Scale down the plasma gun, it clips
|
||||
//if ( strcmp( sfxname, "plasma" ) == 0 ) {
|
||||
// scale = 0.75f;
|
||||
//}
|
||||
//if ( strcmp( sfxname, "itemup" ) == 0 ) {
|
||||
// scale = 1.333f;
|
||||
//}
|
||||
|
||||
// If sound requested is not found in current WAD, use pistol as default
|
||||
if ( W_CheckNumForName( name ) == -1 )
|
||||
sfxlump = W_GetNumForName( "dspistol" );
|
||||
else
|
||||
sfxlump = W_GetNumForName( name );
|
||||
|
||||
// Sound lump headers are 8 bytes.
|
||||
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
||||
|
||||
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||
const unsigned char * sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
// Allocate from zone memory.
|
||||
//sfxmem = (float*)DoomLib::Z_Malloc( size*(sizeof(float)), PU_SOUND_SHARED, 0 );
|
||||
sfxmem = (unsigned char*)malloc( size * sizeof(unsigned char) );
|
||||
|
||||
// Now copy, and convert to Xbox360 native float samples, do initial volume ramp, and scale
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
sfxmem[i] = sfxSampleStart[i];// * scale;
|
||||
}
|
||||
|
||||
// Remove the cached lump.
|
||||
Z_Free( sfx );
|
||||
|
||||
// Set length.
|
||||
*len = size;
|
||||
|
||||
// Return allocated padded data.
|
||||
return (void *) (sfxmem);
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_SetChannels
|
||||
======================
|
||||
*/
|
||||
void I_SetChannels()
|
||||
{
|
||||
// Original Doom set up lookup tables here
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_SetSfxVolume
|
||||
======================
|
||||
*/
|
||||
void I_SetSfxVolume( int volume )
|
||||
{
|
||||
x_SoundVolume = ((float)volume / 15.f) * GLOBAL_VOLUME_MULTIPLIER;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_GetSfxLumpNum
|
||||
======================
|
||||
*/
|
||||
//
|
||||
// Retrieve the raw data lump index
|
||||
// for a given SFX name.
|
||||
//
|
||||
int I_GetSfxLumpNum( sfxinfo_t* sfx )
|
||||
{
|
||||
char namebuf[9];
|
||||
sprintf( namebuf, "ds%s", sfx->name );
|
||||
return W_GetNumForName( namebuf );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_StartSound2
|
||||
======================
|
||||
*/
|
||||
// Starting a sound means adding it
|
||||
// to the current list of active sounds
|
||||
// in the internal channels.
|
||||
// As the SFX info struct contains
|
||||
// e.g. a pointer to the raw data,
|
||||
// it is ignored.
|
||||
// As our sound handling does not handle
|
||||
// priority, it is ignored.
|
||||
// Pitching (that is, increased speed of playback) is set
|
||||
//
|
||||
int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin, int pitch, int priority )
|
||||
{
|
||||
if ( !soundHardwareInitialized || id == 0 ) {
|
||||
return id;
|
||||
}
|
||||
|
||||
int i;
|
||||
activeSound_t* sound = 0;
|
||||
int oldest = 0, oldestnum = -1;
|
||||
|
||||
// these id's should not overlap
|
||||
if ( id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit || id == sfx_stnmov ) {
|
||||
// Loop all channels, check.
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( sound->valid && ( sound->id == id && sound->player == player ) ) {
|
||||
I_StopSound( sound->id, player );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find a valid channel, or one that has finished playing
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( !sound->valid )
|
||||
break;
|
||||
|
||||
if ( !oldest || oldest > sound->start ) {
|
||||
oldestnum = i;
|
||||
oldest = sound->start;
|
||||
}
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_STOPPED ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// none found, so use the oldest one
|
||||
if ( i == NUM_SOUNDBUFFERS ) {
|
||||
i = oldestnum;
|
||||
sound = &activeSounds[i];
|
||||
}
|
||||
|
||||
alSourceStop( sound->alSourceVoice );
|
||||
|
||||
// Attach the source voice to the correct buffer
|
||||
if ( sound->id != id ) {
|
||||
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
||||
alSourcei( sound->alSourceVoice, AL_BUFFER, alBuffers[id] );
|
||||
}
|
||||
|
||||
// Set the source voice volume
|
||||
alSourcef( sound->alSourceVoice, AL_GAIN, x_SoundVolume );
|
||||
|
||||
// Set the source voice pitch
|
||||
alSourcef( sound->alSourceVoice, AL_PITCH, 1 + ((float)pitch-128.f)/95.f );
|
||||
|
||||
// Set the source voice position
|
||||
ALfloat x = 0.f;
|
||||
ALfloat y = 0.f;
|
||||
ALfloat z = 0.f;
|
||||
if ( origin ) {
|
||||
if ( origin == listener_origin ) {
|
||||
sound->localSound = true;
|
||||
} else {
|
||||
sound->localSound = false;
|
||||
x = (ALfloat)(origin->x >> FRACBITS);
|
||||
z = (ALfloat)(origin->y >> FRACBITS);
|
||||
}
|
||||
} else {
|
||||
sound->localSound = true;
|
||||
}
|
||||
if ( sound->localSound ) {
|
||||
x = doom_Listener.Position.x;
|
||||
z = doom_Listener.Position.z;
|
||||
}
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
||||
|
||||
alSourcePlay( sound->alSourceVoice );
|
||||
|
||||
// Set id, and start time
|
||||
sound->id = id;
|
||||
sound->start = ::g->gametic;
|
||||
sound->valid = 1;
|
||||
sound->player = player;
|
||||
sound->originator = origin;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_ProcessSoundEvents
|
||||
======================
|
||||
*/
|
||||
void I_ProcessSoundEvents( void )
|
||||
{
|
||||
for( int i = 0; i < 128; i++ ) {
|
||||
if( soundEvents[i].pitch ) {
|
||||
I_StartSound2( i, soundEvents[i].player, soundEvents[i].originator, soundEvents[i].listener,
|
||||
soundEvents[i].pitch, soundEvents[i].priority );
|
||||
}
|
||||
}
|
||||
memset( soundEvents, 0, sizeof( soundEvents ) );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_StartSound
|
||||
======================
|
||||
*/
|
||||
int I_StartSound ( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority )
|
||||
{
|
||||
// only allow player 0s sounds in intermission and finale screens
|
||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if we're only one player or we're trying to play the chainsaw sound, do it normal
|
||||
// otherwise only allow one sound of each type per frame
|
||||
if( PLAYERCOUNT == 1 || id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit ) {
|
||||
return I_StartSound2( id, ::g->consoleplayer, origin, listener_origin, pitch, priority );
|
||||
} else {
|
||||
if( soundEvents[ id ].vol < vol ) {
|
||||
soundEvents[ id ].player = DoomLib::GetPlayer();
|
||||
soundEvents[ id ].pitch = pitch;
|
||||
soundEvents[ id ].priority = priority;
|
||||
soundEvents[ id ].vol = vol;
|
||||
soundEvents[ id ].originator = origin;
|
||||
soundEvents[ id ].listener = listener_origin;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_StopSound
|
||||
======================
|
||||
*/
|
||||
void I_StopSound ( int handle, int player )
|
||||
{
|
||||
// You need the handle returned by StartSound.
|
||||
// Would be looping all channels,
|
||||
// tracking down the handle,
|
||||
// and setting the channel to zero.
|
||||
int i;
|
||||
activeSound_t* sound = 0;
|
||||
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
sound = &activeSounds[i];
|
||||
if ( !sound->valid || sound->id != handle || (player >= 0 && sound->player != player) )
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( i == NUM_SOUNDBUFFERS )
|
||||
return;
|
||||
|
||||
// Stop the sound
|
||||
alSourceStop( sound->alSourceVoice );
|
||||
|
||||
sound->valid = 0;
|
||||
sound->player = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_SoundIsPlaying
|
||||
======================
|
||||
*/
|
||||
int I_SoundIsPlaying( int handle )
|
||||
{
|
||||
if ( !soundHardwareInitialized ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
activeSound_t* sound;
|
||||
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
sound = &activeSounds[i];
|
||||
if ( !sound->valid || sound->id != handle )
|
||||
continue;
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_PLAYING ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_UpdateSound
|
||||
======================
|
||||
*/
|
||||
// Update listener position and go through all the
|
||||
// channels and update sound positions.
|
||||
void I_UpdateSound( void )
|
||||
{
|
||||
if ( !soundHardwareInitialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update listener orientation and position
|
||||
mobj_t *playerObj = ::g->players[0].mo;
|
||||
if ( playerObj ) {
|
||||
angle_t pAngle = playerObj->angle;
|
||||
fixed_t fx, fz;
|
||||
|
||||
pAngle >>= ANGLETOFINESHIFT;
|
||||
|
||||
fx = finecosine[pAngle];
|
||||
fz = finesine[pAngle];
|
||||
|
||||
doom_Listener.OrientFront.x = (float)(fx) / 65535.f;
|
||||
doom_Listener.OrientFront.y = 0.f;
|
||||
doom_Listener.OrientFront.z = (float)(fz) / 65535.f;
|
||||
doom_Listener.Position.x = (float)(playerObj->x >> FRACBITS);
|
||||
doom_Listener.Position.y = 0.f;
|
||||
doom_Listener.Position.z = (float)(playerObj->y >> FRACBITS);
|
||||
} else {
|
||||
doom_Listener.OrientFront.x = 0.f;
|
||||
doom_Listener.OrientFront.y = 0.f;
|
||||
doom_Listener.OrientFront.z = 1.f;
|
||||
|
||||
doom_Listener.Position.x = 0.f;
|
||||
doom_Listener.Position.y = 0.f;
|
||||
doom_Listener.Position.z = 0.f;
|
||||
}
|
||||
|
||||
ALfloat listenerOrientation[] = { doom_Listener.OrientFront.x, doom_Listener.OrientFront.y,
|
||||
doom_Listener.OrientFront.z, doom_Listener.OrientTop.x, doom_Listener.OrientTop.y,
|
||||
doom_Listener.OrientTop.z };
|
||||
alListenerfv( AL_ORIENTATION, listenerOrientation );
|
||||
alListener3f( AL_POSITION, doom_Listener.Position.x, doom_Listener.Position.y, doom_Listener.Position.z );
|
||||
|
||||
// Update playing source voice positions
|
||||
int i;
|
||||
activeSound_t* sound;
|
||||
for ( i=0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( !sound->valid ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_PLAYING ) {
|
||||
if ( sound->localSound ) {
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, doom_Listener.Position.x,
|
||||
doom_Listener.Position.y, doom_Listener.Position.z );
|
||||
} else {
|
||||
ALfloat x = (ALfloat)(sound->originator->x >> FRACBITS);
|
||||
ALfloat y = 0.f;
|
||||
ALfloat z = (ALfloat)(sound->originator->y >> FRACBITS);
|
||||
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_UpdateSoundParams
|
||||
======================
|
||||
*/
|
||||
void I_UpdateSoundParams( int handle, int vol, int sep, int pitch )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_ShutdownSound
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownSound( void )
|
||||
{
|
||||
int done = 0;
|
||||
int i;
|
||||
|
||||
if ( S_initialized ) {
|
||||
// Stop all sounds
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
|
||||
if ( !sound ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
I_StopSound( sound->id, 0 );
|
||||
}
|
||||
|
||||
// Free allocated sound memory
|
||||
for ( i = 1; i < NUMSFX; i++ ) {
|
||||
if ( S_sfx[i].data && !(S_sfx[i].link) ) {
|
||||
free( S_sfx[i].data );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
I_StopSong( 0 );
|
||||
|
||||
S_initialized = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_InitSoundHardware
|
||||
|
||||
Called from the tech4x initialization code. Sets up Doom classic's
|
||||
sound channels.
|
||||
======================
|
||||
*/
|
||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask )
|
||||
{
|
||||
::numOutputChannels = numOutputChannels_;
|
||||
|
||||
// Initialize source voices
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
I_InitSoundChannel( i, numOutputChannels );
|
||||
}
|
||||
|
||||
// Create OpenAL buffers for all sounds
|
||||
for ( int i = 1; i < NUMSFX; i++ ) {
|
||||
alGenBuffers( (ALuint)1, &alBuffers[i] );
|
||||
}
|
||||
|
||||
I_InitMusic();
|
||||
|
||||
soundHardwareInitialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_ShutdownSoundHardware
|
||||
|
||||
Called from the tech4x shutdown code. Tears down Doom classic's
|
||||
sound channels.
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownSoundHardware()
|
||||
{
|
||||
soundHardwareInitialized = false;
|
||||
|
||||
I_ShutdownMusic();
|
||||
|
||||
// Delete all source voices
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
|
||||
if ( !sound ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( sound->alSourceVoice ) {
|
||||
alSourceStop( sound->alSourceVoice );
|
||||
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
||||
alDeleteSources( 1, &sound->alSourceVoice );
|
||||
}
|
||||
}
|
||||
|
||||
// Delete OpenAL buffers for all sounds
|
||||
for ( int i = 0; i < NUMSFX; i++ ) {
|
||||
alDeleteBuffers( 1, &alBuffers[i] );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_InitSoundChannel
|
||||
======================
|
||||
*/
|
||||
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
||||
{
|
||||
activeSound_t *soundchannel = &activeSounds[ channel ];
|
||||
|
||||
alGenSources( (ALuint)1, &soundchannel->alSourceVoice );
|
||||
|
||||
alSource3f( soundchannel->alSourceVoice, AL_VELOCITY, 0.f, 0.f, 0.f );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_LOOPING, AL_FALSE );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_MAX_DISTANCE, SFX_MAX_DISTANCE );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_REFERENCE_DISTANCE, SFX_REFERENCE_DISTANCE );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_ROLLOFF_FACTOR, SFX_ROLLOFF_FACTOR );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_InitSound
|
||||
======================
|
||||
*/
|
||||
void I_InitSound()
|
||||
{
|
||||
if ( S_initialized == 0 ) {
|
||||
// Set up listener parameters
|
||||
doom_Listener.OrientFront.x = 0.f;
|
||||
doom_Listener.OrientFront.y = 0.f;
|
||||
doom_Listener.OrientFront.z = 1.f;
|
||||
|
||||
doom_Listener.OrientTop.x = 0.f;
|
||||
doom_Listener.OrientTop.y = -1.f;
|
||||
doom_Listener.OrientTop.z = 0.f;
|
||||
|
||||
doom_Listener.Position.x = 0.f;
|
||||
doom_Listener.Position.y = 0.f;
|
||||
doom_Listener.Position.z = 0.f;
|
||||
|
||||
for ( int i = 1; i < NUMSFX; i++ ) {
|
||||
// Alias? Example is the chaingun sound linked to pistol.
|
||||
if ( !S_sfx[i].link ) {
|
||||
// Load data from WAD file.
|
||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||
} else {
|
||||
// Previously loaded already?
|
||||
S_sfx[i].data = S_sfx[i].link->data;
|
||||
lengths[i] = lengths[ (S_sfx[i].link-S_sfx) / sizeof(sfxinfo_t) ];
|
||||
}
|
||||
if ( S_sfx[i].data ) {
|
||||
alBufferData( alBuffers[i], SFX_SAMPLETYPE, (byte*)S_sfx[i].data, lengths[i], SFX_RATE );
|
||||
}
|
||||
}
|
||||
|
||||
S_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_SubmitSound
|
||||
======================
|
||||
*/
|
||||
void I_SubmitSound( void )
|
||||
{
|
||||
// Only do this for player 0, it will still handle positioning
|
||||
// for other players, but it can't be outside the game
|
||||
// frame like the soundEvents are.
|
||||
if ( DoomLib::GetPlayer() == 0 ) {
|
||||
// Do 3D positioning of sounds
|
||||
I_UpdateSound();
|
||||
|
||||
// Change music if required
|
||||
I_UpdateMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================================================
|
||||
// =========================================================
|
||||
// Background Music
|
||||
// =========================================================
|
||||
// =========================================================
|
||||
|
||||
/*
|
||||
======================
|
||||
I_SetMusicVolume
|
||||
======================
|
||||
*/
|
||||
void I_SetMusicVolume( int volume )
|
||||
{
|
||||
x_MusicVolume = (float)volume / 15.f;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_InitMusic
|
||||
======================
|
||||
*/
|
||||
void I_InitMusic( void )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
// Initialize Timidity
|
||||
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
||||
|
||||
musicBuffer = NULL;
|
||||
totalBufferSize = 0;
|
||||
waitingForMusic = false;
|
||||
musicReady = false;
|
||||
|
||||
alGenSources( (ALuint)1, &alMusicSourceVoice );
|
||||
|
||||
alSourcef( alMusicSourceVoice, AL_PITCH, 1.f );
|
||||
alSourcef( alMusicSourceVoice, AL_LOOPING, AL_TRUE );
|
||||
|
||||
alGenBuffers( (ALuint)1, &alMusicBuffer );
|
||||
|
||||
Music_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_ShutdownMusic
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownMusic( void )
|
||||
{
|
||||
if ( Music_initialized ) {
|
||||
if ( alMusicSourceVoice ) {
|
||||
I_StopSong( 0 );
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||
alDeleteSources( 1, &alMusicSourceVoice );
|
||||
}
|
||||
|
||||
if ( alMusicBuffer ) {
|
||||
alDeleteBuffers( 1, &alMusicBuffer );
|
||||
}
|
||||
|
||||
if ( musicBuffer ) {
|
||||
free( musicBuffer );
|
||||
musicBuffer = NULL;
|
||||
}
|
||||
|
||||
Timidity_Shutdown();
|
||||
}
|
||||
|
||||
totalBufferSize = 0;
|
||||
waitingForMusic = false;
|
||||
musicReady = false;
|
||||
|
||||
Music_initialized = false;
|
||||
}
|
||||
|
||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
||||
|
||||
namespace {
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_LoadSong
|
||||
======================
|
||||
*/
|
||||
void I_LoadSong( const char * songname )
|
||||
{
|
||||
idStr lumpName = "d_";
|
||||
lumpName += static_cast< const char * >( songname );
|
||||
|
||||
unsigned char * musFile = static_cast< unsigned char * >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
||||
|
||||
int length = 0;
|
||||
Mus2Midi( musFile, midiConversionBuffer, &length );
|
||||
|
||||
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
||||
|
||||
if ( doomMusic ) {
|
||||
musicBuffer = (byte *)malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
||||
Timidity_Start( doomMusic );
|
||||
|
||||
int rc = RC_NO_RETURN_VALUE;
|
||||
int num_bytes = 0;
|
||||
int offset = 0;
|
||||
|
||||
do {
|
||||
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
||||
offset += num_bytes;
|
||||
} while ( rc != RC_TUNE_END );
|
||||
|
||||
Timidity_Stop();
|
||||
Timidity_FreeSong( doomMusic );
|
||||
}
|
||||
|
||||
musicReady = true;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_PlaySong
|
||||
======================
|
||||
*/
|
||||
void I_PlaySong( const char *songname, int looping )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
I_StopSong( 0 );
|
||||
|
||||
// Clear old state
|
||||
if ( musicBuffer ) {
|
||||
free( musicBuffer );
|
||||
musicBuffer = 0;
|
||||
}
|
||||
|
||||
musicReady = false;
|
||||
I_LoadSong( songname );
|
||||
waitingForMusic = true;
|
||||
|
||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
||||
::g->mus_looping = looping;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_UpdateMusic
|
||||
======================
|
||||
*/
|
||||
void I_UpdateMusic( void )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( alMusicSourceVoice ) {
|
||||
// Set the volume
|
||||
alSourcef( alMusicSourceVoice, AL_GAIN, x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
||||
}
|
||||
|
||||
if ( waitingForMusic ) {
|
||||
if ( musicReady && alMusicSourceVoice ) {
|
||||
if ( musicBuffer ) {
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||
alBufferData( alMusicBuffer, MIDI_SAMPLETYPE, musicBuffer, totalBufferSize, MIDI_RATE );
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, alMusicBuffer );
|
||||
alSourcePlay( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
waitingForMusic = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_PauseSong
|
||||
======================
|
||||
*/
|
||||
void I_PauseSong ( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
return;
|
||||
}
|
||||
|
||||
alSourcePause( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_ResumeSong
|
||||
======================
|
||||
*/
|
||||
void I_ResumeSong ( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
return;
|
||||
}
|
||||
|
||||
alSourcePlay( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_StopSong
|
||||
======================
|
||||
*/
|
||||
void I_StopSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
return;
|
||||
}
|
||||
|
||||
alSourceStop( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_UnRegisterSong
|
||||
======================
|
||||
*/
|
||||
void I_UnRegisterSong( int handle )
|
||||
{
|
||||
// does nothing
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
I_RegisterSong
|
||||
======================
|
||||
*/
|
||||
int I_RegisterSong( void* data, int length )
|
||||
{
|
||||
// does nothing
|
||||
return 0;
|
||||
}
|
|
@ -30,9 +30,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// DG: this is a stub implementing the classic doom sound interface so we don't need XAudio to compile
|
||||
// (that doesn't work with MinGW and is only available on Windows)
|
||||
|
||||
// DG: only build this for MSVC. ugly hack, I can't get cmake to delete this file from the list..
|
||||
#ifndef _MSC_VER
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "i_sound.h"
|
||||
#include "w_wad.h"
|
||||
|
@ -64,6 +61,7 @@ int I_GetSfxLumpNum (sfxinfo_t* sfxinfo )
|
|||
return W_GetNumForName(namebuf);
|
||||
}
|
||||
|
||||
void I_ProcessSoundEvents( void ){}
|
||||
|
||||
// Starts a sound in a particular sound channel.
|
||||
int I_StartSound( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority )
|
||||
|
@ -117,5 +115,3 @@ void I_UnRegisterSong(int handle){}
|
|||
|
||||
// Update Music (XMP), check for notifications
|
||||
void I_UpdateMusic(void){}
|
||||
|
||||
#endif // _MSC_VER not defined ; DG end
|
||||
|
|
|
@ -26,9 +26,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
// DG: only build this for MSVC. ugly hack, I can't get cmake to delete this file from the list..
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
|
@ -161,7 +158,7 @@ getsfx
|
|||
// This function loads the sound data from the WAD lump,
|
||||
// for single sound.
|
||||
//
|
||||
void* getsfx ( char* sfxname, int* len )
|
||||
void* getsfx ( const char* sfxname, int* len )
|
||||
{
|
||||
unsigned char* sfx;
|
||||
unsigned char* sfxmem;
|
||||
|
@ -1107,6 +1104,3 @@ int I_RegisterSong(void* data, int length)
|
|||
// does nothing
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
// DG end
|
||||
|
|
|
@ -126,7 +126,7 @@ void I_EndRead(void)
|
|||
// I_Error
|
||||
//
|
||||
extern bool debugOutput;
|
||||
void I_Printf(char* msg, ...)
|
||||
void I_Printf(const char* msg, ...)
|
||||
{
|
||||
char pmsg[1024];
|
||||
va_list argptr;
|
||||
|
@ -143,7 +143,7 @@ void I_Printf(char* msg, ...)
|
|||
}
|
||||
|
||||
|
||||
void I_PrintfE(char* msg, ...)
|
||||
void I_PrintfE(const char* msg, ...)
|
||||
{
|
||||
char pmsg[1024];
|
||||
va_list argptr;
|
||||
|
@ -160,7 +160,7 @@ void I_PrintfE(char* msg, ...)
|
|||
}
|
||||
}
|
||||
|
||||
void I_Error(char *error, ...)
|
||||
void I_Error(const char *error, ...)
|
||||
{
|
||||
const int ERROR_MSG_SIZE = 1024;
|
||||
char error_msg[ERROR_MSG_SIZE];
|
||||
|
|
|
@ -79,9 +79,9 @@ ticcmd_t* I_BaseTiccmd (void);
|
|||
void I_Quit (void);
|
||||
|
||||
|
||||
void I_Error (char *error, ...);
|
||||
void I_Printf(char *error, ...);
|
||||
void I_PrintfE(char *error, ...);
|
||||
void I_Error (const char *error, ...);
|
||||
void I_Printf(const char *error, ...);
|
||||
void I_PrintfE(const char *error, ...);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,19 +27,21 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
// Data.
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "info.h"
|
||||
#endif
|
||||
#include "info.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
// Data.
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "p_mobj.h"
|
||||
|
||||
|
||||
// RB: sprnames must be NULL-terminated
|
||||
const char * const sprnames[NUMSPRITES + 1] = {
|
||||
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
|
||||
|
|
|
@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// in the program's command line arguments.
|
||||
// Returns the argument number (1 to argc-1)
|
||||
// or 0 if not present
|
||||
int M_CheckParm (char *check)
|
||||
int M_CheckParm (const char *check)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ extern char** myargv;
|
|||
|
||||
// Returns the position of the given parameter
|
||||
// in the arg list (0 if not found).
|
||||
int M_CheckParm (char* check);
|
||||
int M_CheckParm (const char* check);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,19 +27,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "globaldata.h"
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "i_system.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_fixed.h"
|
||||
#endif
|
||||
#include "m_fixed.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "i_system.h"
|
||||
|
||||
|
||||
// Fixme. __USE_C_FIXED__ or something.
|
||||
|
|
|
@ -183,11 +183,11 @@ void M_SetupNextMenu(menu_t *menudef);
|
|||
void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
|
||||
void M_DrawEmptyCell(menu_t *menu,int item);
|
||||
void M_DrawSelCell(menu_t *menu,int item);
|
||||
void M_WriteText(int x, int y, char *string);
|
||||
int M_StringWidth(char *string);
|
||||
int M_StringHeight(char *string);
|
||||
void M_WriteText(int x, int y, const char *string);
|
||||
int M_StringWidth(const char *string);
|
||||
int M_StringHeight(const char *string);
|
||||
void M_StartControlPanel(void);
|
||||
void M_StartMessage(char *string,messageRoutine_t routine,qboolean input);
|
||||
void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
|
||||
void M_StopMessage(void);
|
||||
void M_ClearMenus (void);
|
||||
|
||||
|
@ -1051,13 +1051,13 @@ M_DrawSelCell
|
|||
|
||||
void
|
||||
M_StartMessage
|
||||
( char* string,
|
||||
( const char* string,
|
||||
messageRoutine_t routine,
|
||||
qboolean input )
|
||||
{
|
||||
::g->messageLastMenuActive = ::g->menuactive;
|
||||
::g->messageToPrint = 1;
|
||||
::g->messageString = string;
|
||||
::g->messageString = (char *)string;
|
||||
::g->messageRoutine = (messageRoutine_t)routine;
|
||||
::g->messageNeedsInput = input;
|
||||
::g->menuactive = true;
|
||||
|
@ -1077,7 +1077,7 @@ void M_StopMessage(void)
|
|||
//
|
||||
// Find string width from ::g->hu_font chars
|
||||
//
|
||||
int M_StringWidth(char* string)
|
||||
int M_StringWidth(const char* string)
|
||||
{
|
||||
unsigned int i;
|
||||
int w = 0;
|
||||
|
@ -1100,7 +1100,7 @@ int M_StringWidth(char* string)
|
|||
//
|
||||
// Find string height from ::g->hu_font chars
|
||||
//
|
||||
int M_StringHeight(char* string)
|
||||
int M_StringHeight(const char* string)
|
||||
{
|
||||
unsigned int i;
|
||||
int h;
|
||||
|
@ -1122,10 +1122,10 @@ void
|
|||
M_WriteText
|
||||
( int x,
|
||||
int y,
|
||||
char* string)
|
||||
const char* string)
|
||||
{
|
||||
int w;
|
||||
char* ch;
|
||||
const char* ch;
|
||||
int c;
|
||||
int cx;
|
||||
int cy;
|
||||
|
|
|
@ -105,7 +105,7 @@ M_DrawText
|
|||
//
|
||||
// M_WriteFile
|
||||
//
|
||||
boolean M_WriteFile ( char const* name, void* source, int length ) {
|
||||
bool M_WriteFile ( char const* name, void* source, int length ) {
|
||||
|
||||
idFile * handle = NULL;
|
||||
int count;
|
||||
|
@ -157,7 +157,7 @@ int M_ReadFile ( char const* name, byte** buffer ) {
|
|||
//
|
||||
// Write a save game to the specified device using the specified game name.
|
||||
//
|
||||
static qboolean SaveGame( void* source, DWORD length )
|
||||
static qboolean SaveGame( void* source, int length )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
// MISC
|
||||
//
|
||||
boolean
|
||||
bool
|
||||
M_WriteFile
|
||||
( char const* name,
|
||||
void* source,
|
||||
|
|
|
@ -104,7 +104,7 @@ void P_UnArchivePlayers (void)
|
|||
if (::g->players[i]. psprites[j].state)
|
||||
{
|
||||
::g->players[i]. psprites[j].state
|
||||
= &::g->states[ (int)::g->players[i].psprites[j].state ];
|
||||
= &::g->states[ (intptr_t)::g->players[i].psprites[j].state ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -622,14 +622,14 @@ void P_UnArchiveThinkers (void)
|
|||
mobj = (mobj_t*)DoomLib::Z_Malloc(sizeof(*mobj), PU_LEVEL, NULL);
|
||||
memcpy (mobj, ::g->save_p, sizeof(*mobj));
|
||||
::g->save_p += sizeof(*mobj);
|
||||
mobj->state = &::g->states[(int)mobj->state];
|
||||
mobj->state = &::g->states[(intptr_t)mobj->state];
|
||||
|
||||
mobj->target = NULL;
|
||||
mobj->tracer = NULL;
|
||||
|
||||
if (mobj->player)
|
||||
{
|
||||
mobj->player = &::g->players[(int)mobj->player-1];
|
||||
mobj->player = &::g->players[(intptr_t)mobj->player-1];
|
||||
mobj->player->mo = mobj;
|
||||
}
|
||||
|
||||
|
@ -693,7 +693,7 @@ void P_UnArchiveThinkers (void)
|
|||
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, NULL);
|
||||
memcpy (ceiling, ::g->save_p, sizeof(*ceiling));
|
||||
::g->save_p += sizeof(*ceiling);
|
||||
ceiling->sector = &::g->sectors[(int)ceiling->sector];
|
||||
ceiling->sector = &::g->sectors[(intptr_t)ceiling->sector];
|
||||
ceiling->sector->specialdata = ceiling;
|
||||
|
||||
if (ceiling->thinker.function.acp1)
|
||||
|
@ -708,7 +708,7 @@ void P_UnArchiveThinkers (void)
|
|||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, NULL);
|
||||
memcpy (door, ::g->save_p, sizeof(*door));
|
||||
::g->save_p += sizeof(*door);
|
||||
door->sector = &::g->sectors[(int)door->sector];
|
||||
door->sector = &::g->sectors[(intptr_t)door->sector];
|
||||
door->sector->specialdata = door;
|
||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
||||
P_AddThinker (&door->thinker);
|
||||
|
@ -719,7 +719,7 @@ void P_UnArchiveThinkers (void)
|
|||
floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
|
||||
memcpy (floor, ::g->save_p, sizeof(*floor));
|
||||
::g->save_p += sizeof(*floor);
|
||||
floor->sector = &::g->sectors[(int)floor->sector];
|
||||
floor->sector = &::g->sectors[(intptr_t)floor->sector];
|
||||
floor->sector->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
|
||||
P_AddThinker (&floor->thinker);
|
||||
|
@ -730,7 +730,7 @@ void P_UnArchiveThinkers (void)
|
|||
plat = (plat_t*)DoomLib::Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
|
||||
memcpy (plat, ::g->save_p, sizeof(*plat));
|
||||
::g->save_p += sizeof(*plat);
|
||||
plat->sector = &::g->sectors[(int)plat->sector];
|
||||
plat->sector = &::g->sectors[(intptr_t)plat->sector];
|
||||
plat->sector->specialdata = plat;
|
||||
|
||||
if (plat->thinker.function.acp1)
|
||||
|
@ -745,7 +745,7 @@ void P_UnArchiveThinkers (void)
|
|||
fire = (fireflicker_t*)DoomLib::Z_Malloc (sizeof(*fire), PU_LEVEL, NULL);
|
||||
memcpy (fire, ::g->save_p, sizeof(*fire));
|
||||
::g->save_p += sizeof(*fire);
|
||||
fire->sector = &::g->sectors[(int)fire->sector];
|
||||
fire->sector = &::g->sectors[(intptr_t)fire->sector];
|
||||
fire->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||
P_AddThinker (&fire->thinker);
|
||||
break;
|
||||
|
@ -755,7 +755,7 @@ void P_UnArchiveThinkers (void)
|
|||
flash = (lightflash_t*)DoomLib::Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
|
||||
memcpy (flash, ::g->save_p, sizeof(*flash));
|
||||
::g->save_p += sizeof(*flash);
|
||||
flash->sector = &::g->sectors[(int)flash->sector];
|
||||
flash->sector = &::g->sectors[(intptr_t)flash->sector];
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightFlash;
|
||||
P_AddThinker (&flash->thinker);
|
||||
break;
|
||||
|
@ -765,7 +765,7 @@ void P_UnArchiveThinkers (void)
|
|||
strobe = (strobe_t*)DoomLib::Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
|
||||
memcpy (strobe, ::g->save_p, sizeof(*strobe));
|
||||
::g->save_p += sizeof(*strobe);
|
||||
strobe->sector = &::g->sectors[(int)strobe->sector];
|
||||
strobe->sector = &::g->sectors[(intptr_t)strobe->sector];
|
||||
strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
||||
P_AddThinker (&strobe->thinker);
|
||||
break;
|
||||
|
@ -775,7 +775,7 @@ void P_UnArchiveThinkers (void)
|
|||
glow = (glow_t*)DoomLib::Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
|
||||
memcpy (glow, ::g->save_p, sizeof(*glow));
|
||||
::g->save_p += sizeof(*glow);
|
||||
glow->sector = &::g->sectors[(int)glow->sector];
|
||||
glow->sector = &::g->sectors[(intptr_t)glow->sector];
|
||||
glow->thinker.function.acp1 = (actionf_p1)T_Glow;
|
||||
P_AddThinker (&glow->thinker);
|
||||
break;
|
||||
|
@ -949,7 +949,7 @@ void P_UnArchiveSpecials (void)
|
|||
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, NULL);
|
||||
memcpy (ceiling, ::g->save_p, sizeof(*ceiling));
|
||||
::g->save_p += sizeof(*ceiling);
|
||||
ceiling->sector = &::g->sectors[(int)ceiling->sector];
|
||||
ceiling->sector = &::g->sectors[(intptr_t)ceiling->sector];
|
||||
ceiling->sector->specialdata = ceiling;
|
||||
|
||||
if (ceiling->thinker.function.acp1)
|
||||
|
@ -964,7 +964,7 @@ void P_UnArchiveSpecials (void)
|
|||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, NULL);
|
||||
memcpy (door, ::g->save_p, sizeof(*door));
|
||||
::g->save_p += sizeof(*door);
|
||||
door->sector = &::g->sectors[(int)door->sector];
|
||||
door->sector = &::g->sectors[(intptr_t)door->sector];
|
||||
door->sector->specialdata = door;
|
||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
||||
P_AddThinker (&door->thinker);
|
||||
|
@ -975,7 +975,7 @@ void P_UnArchiveSpecials (void)
|
|||
floor = (floormove_t*)DoomLib::Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
|
||||
memcpy (floor, ::g->save_p, sizeof(*floor));
|
||||
::g->save_p += sizeof(*floor);
|
||||
floor->sector = &::g->sectors[(int)floor->sector];
|
||||
floor->sector = &::g->sectors[(intptr_t)floor->sector];
|
||||
floor->sector->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor;
|
||||
P_AddThinker (&floor->thinker);
|
||||
|
@ -986,7 +986,7 @@ void P_UnArchiveSpecials (void)
|
|||
plat = (plat_t*)DoomLib::Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
|
||||
memcpy (plat, ::g->save_p, sizeof(*plat));
|
||||
::g->save_p += sizeof(*plat);
|
||||
plat->sector = &::g->sectors[(int)plat->sector];
|
||||
plat->sector = &::g->sectors[(intptr_t)plat->sector];
|
||||
plat->sector->specialdata = plat;
|
||||
|
||||
if (plat->thinker.function.acp1)
|
||||
|
@ -1001,7 +1001,7 @@ void P_UnArchiveSpecials (void)
|
|||
flash = (lightflash_t*)DoomLib::Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
|
||||
memcpy (flash, ::g->save_p, sizeof(*flash));
|
||||
::g->save_p += sizeof(*flash);
|
||||
flash->sector = &::g->sectors[(int)flash->sector];
|
||||
flash->sector = &::g->sectors[(intptr_t)flash->sector];
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightFlash;
|
||||
P_AddThinker (&flash->thinker);
|
||||
break;
|
||||
|
@ -1011,7 +1011,7 @@ void P_UnArchiveSpecials (void)
|
|||
strobe = (strobe_t*)DoomLib::Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
|
||||
memcpy (strobe, ::g->save_p, sizeof(*strobe));
|
||||
::g->save_p += sizeof(*strobe);
|
||||
strobe->sector = &::g->sectors[(int)strobe->sector];
|
||||
strobe->sector = &::g->sectors[(intptr_t)strobe->sector];
|
||||
strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
||||
P_AddThinker (&strobe->thinker);
|
||||
break;
|
||||
|
@ -1021,7 +1021,7 @@ void P_UnArchiveSpecials (void)
|
|||
glow = (glow_t*)DoomLib::Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
|
||||
memcpy (glow, ::g->save_p, sizeof(*glow));
|
||||
::g->save_p += sizeof(*glow);
|
||||
glow->sector = &::g->sectors[(int)glow->sector];
|
||||
glow->sector = &::g->sectors[(intptr_t)glow->sector];
|
||||
glow->thinker.function.acp1 = (actionf_p1)T_Glow;
|
||||
P_AddThinker (&glow->thinker);
|
||||
break;
|
||||
|
|
|
@ -559,7 +559,7 @@ void P_GroupLines (void)
|
|||
}
|
||||
|
||||
// build line tables for each sector
|
||||
linebuffer = (line_t**)Z_Malloc (total*4, PU_LEVEL, 0);
|
||||
linebuffer = (line_t**)Z_Malloc (total*sizeof(line_t*), PU_LEVEL, 0);
|
||||
sector = ::g->sectors;
|
||||
for (i=0 ; i < ::g->numsectors ; i++, sector++)
|
||||
{
|
||||
|
|
|
@ -414,12 +414,12 @@ void R_InitTextures (void)
|
|||
|
||||
::g->s_numtextures = numtextures1 + numtextures2;
|
||||
|
||||
::g->s_textures = (texture_t**)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnlump = (short**)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnofs = (unsigned short**)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_textures = (texture_t**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(texture_t*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnlump = (short**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(short*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnofs = (unsigned short**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(unsigned short*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturewidthmask = (int*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_textureheight = (fixed_t*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecomposite = (byte**)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecomposite = (byte**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(byte*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecompositesize = (int*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
|
||||
totalwidth = 0;
|
||||
|
@ -575,7 +575,7 @@ void R_InitColormaps (void)
|
|||
lump = W_GetNumForName("COLORMAP");
|
||||
length = W_LumpLength (lump) + 255;
|
||||
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (length, PU_STATIC, 0);
|
||||
::g->colormaps = (byte *)( ((int)::g->colormaps + 255)&~0xff);
|
||||
::g->colormaps = (byte *)( ((intptr_t)::g->colormaps + 255)&~0xff);
|
||||
W_ReadLump (lump,::g->colormaps);
|
||||
}
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ void R_InitTranslationTables (void)
|
|||
int i;
|
||||
|
||||
::g->translationtables = (byte*)DoomLib::Z_Malloc (256*3+255, PU_STATIC, 0);
|
||||
::g->translationtables = (byte *)(( (int)::g->translationtables + 255 )& ~255);
|
||||
::g->translationtables = (byte *)(( (intptr_t)::g->translationtables + 255 )& ~255);
|
||||
|
||||
// translate just the 16 green colors
|
||||
for (i=0 ; i<256 ; i++)
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct sfxinfo_struct sfxinfo_t;
|
|||
struct sfxinfo_struct
|
||||
{
|
||||
// up to 6-character name
|
||||
char* name;
|
||||
const char* name;
|
||||
|
||||
// Sfx singularity (only one at a time)
|
||||
int singularity;
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef struct
|
|||
// f_finale.structs begin //
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
mobjtype_t type;
|
||||
} castinfo_t;
|
||||
// f_finale.structs end //
|
||||
|
@ -212,7 +212,7 @@ typedef enum
|
|||
// m_misc.structs begin //
|
||||
struct default_t
|
||||
{
|
||||
char* name;
|
||||
const char* name;
|
||||
union {
|
||||
int * location;
|
||||
const char * * charLocation;
|
||||
|
@ -232,13 +232,13 @@ struct default_t
|
|||
untranslated( 0 ) {
|
||||
}
|
||||
|
||||
default_t( char * name_, int * location_, int defaultvalue_ ) :
|
||||
default_t( const char * name_, int * location_, int defaultvalue_ ) :
|
||||
name( name_ ),
|
||||
location( location_ ),
|
||||
defaultvalue( defaultvalue_ ) {
|
||||
}
|
||||
|
||||
default_t( char * name_, const char * * charLocation_, const char * charDefault_ ) :
|
||||
default_t( const char * name_, const char * * charLocation_, const char * charDefault_ ) :
|
||||
name( name_ ),
|
||||
charLocation( charLocation_ ),
|
||||
charDefault( charDefault_ ) {
|
||||
|
@ -348,7 +348,10 @@ typedef struct
|
|||
int masked;
|
||||
short width;
|
||||
short height;
|
||||
void **columndirectory; // OBSOLETE
|
||||
|
||||
// FR: Replaced obsolete void **columndirectory with int
|
||||
// for 64-bit compatibility
|
||||
int columndirectory; // OBSOLETE
|
||||
short patchcount;
|
||||
mappatch_t patches[1];
|
||||
} maptexture_t;
|
||||
|
|
|
@ -303,7 +303,7 @@ InputEvent joyEvents[18];
|
|||
// i_net_xbox.vars begin //
|
||||
int sendsocket;
|
||||
int insocket;
|
||||
struct sockaddr_in sendaddress[MAXNETNODES];
|
||||
//struct sockaddr_in sendaddress[MAXNETNODES];
|
||||
// i_net_xbox.vars end //
|
||||
// i_system.vars begin //
|
||||
int mb_used ;
|
||||
|
|
|
@ -27,6 +27,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "Precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "w_wad.h"
|
||||
#endif
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
|
@ -44,12 +50,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "idlib/precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "w_wad.h"
|
||||
#endif
|
||||
#include "w_wad.h"
|
||||
|
||||
|
||||
|
||||
//
|
||||
// GLOBALS
|
||||
|
|
|
@ -438,7 +438,7 @@ Z_ChangeTag2
|
|||
if (block->id != ZONEID)
|
||||
I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
|
||||
|
||||
if (tag >= PU_PURGELEVEL && (unsigned)block->user < 0x100)
|
||||
if (tag >= PU_PURGELEVEL && (uintptr_t)block->user < 0x100)
|
||||
I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
|
||||
|
||||
block->tag = tag;
|
||||
|
|
|
@ -174,7 +174,7 @@ file(GLOB FRAMEWORK_SOURCES framework/*.cpp)
|
|||
file(GLOB FRAMEWORK_ASYNC_INCLUDES framework/async/*.h)
|
||||
file(GLOB FRAMEWORK_ASYNC_SOURCES framework/async/*.cpp)
|
||||
|
||||
file(GLOB_RECURSE RENDERER_INCLUDES renderer/*.h)
|
||||
file(GLOB RENDERER_INCLUDES renderer/*.h)
|
||||
# renderer/AutoRender.h
|
||||
# renderer/AutoRenderBink.h
|
||||
# renderer/BinaryImage.h
|
||||
|
@ -214,7 +214,7 @@ file(GLOB_RECURSE RENDERER_INCLUDES renderer/*.h)
|
|||
# renderer/VertexCache.h)
|
||||
|
||||
|
||||
file(GLOB_RECURSE RENDERER_SOURCES renderer/*.cpp)
|
||||
file(GLOB RENDERER_SOURCES renderer/*.cpp)
|
||||
# renderer/AutoRender.cpp
|
||||
# renderer/Cinematic.cpp
|
||||
# renderer/Framebuffer.cpp
|
||||
|
@ -275,7 +275,21 @@ file(GLOB_RECURSE RENDERER_SOURCES renderer/*.cpp)
|
|||
# renderer/tr_trace.cpp
|
||||
# renderer/tr_trisurf.cpp
|
||||
# renderer/tr_turboshadow.cpp)
|
||||
|
||||
|
||||
file(GLOB RENDERER_COLOR_INCLUDES renderer/Color/*.h)
|
||||
file(GLOB RENDERER_COLOR_SOURCES renderer/Color/*.cpp)
|
||||
file(GLOB RENDERER_DXT_INCLUDES renderer/DXT/*.h)
|
||||
file(GLOB RENDERER_DXT_SOURCES renderer/DXT/*.cpp)
|
||||
file(GLOB RENDERER_JOBS_INCLUDES renderer/jobs/*.h)
|
||||
file(GLOB RENDERER_JOBS_SOURCES renderer/jobs/*.cpp)
|
||||
file(GLOB RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES renderer/jobs/dynamicshadowvolume/*.h)
|
||||
file(GLOB RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES renderer/jobs/dynamicshadowvolume/*.cpp)
|
||||
file(GLOB RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES renderer/jobs/prelightshadowvolume/*.h)
|
||||
file(GLOB RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES renderer/jobs/prelightshadowvolume/*.cpp)
|
||||
file(GLOB RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES renderer/jobs/staticshadowvolume/*.h)
|
||||
file(GLOB RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES renderer/jobs/staticshadowvolume/*.cpp)
|
||||
file(GLOB RENDERER_OPENGL_INCLUDES renderer/OpenGL/*.h)
|
||||
file(GLOB RENDERER_OPENGL_SOURCES renderer/OpenGL/*.cpp)
|
||||
|
||||
file(GLOB IRRXML_INCLUDES libs/irrxml/src/*.h)
|
||||
file(GLOB IRRXML_SOURCES libs/irrxml/src/*.cpp)
|
||||
|
@ -695,15 +709,17 @@ file(GLOB EDITOR_SCRIPT_SOURCES tools/script/*.cpp)
|
|||
|
||||
file(GLOB EDITOR_SOUND_INCLUDES tools/sound/*.h)
|
||||
file(GLOB EDITOR_SOUND_SOURCES tools/sound/*.cpp)
|
||||
|
||||
|
||||
file(GLOB DOOMCLASSIC_INCLUDES ../doomclassic/doom/*.h)
|
||||
file(GLOB DOOMCLASSIC_SOURCES ../doomclassic/doom/*.cpp)
|
||||
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_net_ps3.cpp)
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_net_xbox.cpp)
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_video_ps3.cpp)
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ../doomclassic/doom/i_video_xbox.cpp)
|
||||
set(DOOMCLASSIC_STUBAUDIO_SOURCES ../doomclassic/doom/i_sound_stub.cpp)
|
||||
set(DOOMCLASSIC_OPENAL_SOURCES ../doomclassic/doom/i_sound_openal.cpp)
|
||||
set(DOOMCLASSIC_XAUDIO2_SOURCES ../doomclassic/doom/i_sound_win32.cpp)
|
||||
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_stub.cpp)
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_openal.cpp)
|
||||
list(REMOVE_ITEM DOOMCLASSIC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_win32.cpp)
|
||||
|
||||
file(GLOB TIMIDITY_INCLUDES libs/timidity/*.h)
|
||||
file(GLOB TIMIDITY_SOURCES libs/timidity/*.cpp)
|
||||
|
@ -823,6 +839,27 @@ source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_SOURCES})
|
|||
source_group("renderer" FILES ${RENDERER_INCLUDES})
|
||||
source_group("renderer" FILES ${RENDERER_SOURCES})
|
||||
|
||||
source_group("renderer\\Color" FILES ${RENDERER_COLOR_INCLUDES})
|
||||
source_group("renderer\\Color" FILES ${RENDERER_COLOR_SOURCES})
|
||||
|
||||
source_group("renderer\\DXT" FILES ${RENDERER_DXT_INCLUDES})
|
||||
source_group("renderer\\DXT" FILES ${RENDERER_DXT_SOURCES})
|
||||
|
||||
source_group("renderer\\jobs" FILES ${RENDERER_JOBS_INCLUDES})
|
||||
source_group("renderer\\jobs" FILES ${RENDERER_JOBS_SOURCES})
|
||||
|
||||
source_group("renderer\\jobs\\dynamicshadowvolume" FILES ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES})
|
||||
source_group("renderer\\jobs\\dynamicshadowvolume" FILES ${RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES})
|
||||
|
||||
source_group("renderer\\jobs\\prelightshadowvolume" FILES ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES})
|
||||
source_group("renderer\\jobs\\prelightshadowvolume" FILES ${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES})
|
||||
|
||||
source_group("renderer\\jobs\\staticshadowvolume" FILES ${RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES})
|
||||
source_group("renderer\\jobs\\staticshadowvolume" FILES ${RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES})
|
||||
|
||||
source_group("renderer\\OpenGL" FILES ${RENDERER_OPENGL_INCLUDES})
|
||||
source_group("renderer\\OpenGL" FILES ${RENDERER_OPENGL_SOURCES})
|
||||
|
||||
source_group("libs\\irrxml" FILES ${IRRXML_INCLUDES})
|
||||
source_group("libs\\irrxml" FILES ${IRRXML_SOURCES})
|
||||
|
||||
|
@ -870,6 +907,10 @@ source_group("sys" FILES ${SYS_SOURCES})
|
|||
source_group("doomclassic" FILES ${DOOMCLASSIC_INCLUDES})
|
||||
source_group("doomclassic" FILES ${DOOMCLASSIC_SOURCES})
|
||||
|
||||
source_group("doomclassic" FILES ${DOOMCLASSIC_STUBAUDIO_SOURCES})
|
||||
source_group("doomclassic" FILES ${DOOMCLASSIC_OPENAL_SOURCES})
|
||||
source_group("doomclassic" FILES ${DOOMCLASSIC_XAUDIO2_SOURCES})
|
||||
|
||||
source_group("libs\\timidity" FILES ${TIMIDITY_INCLUDES})
|
||||
source_group("libs\\timidity" FILES ${TIMIDITY_SOURCES})
|
||||
|
||||
|
@ -974,6 +1015,13 @@ set(RBDOOM3_INCLUDES
|
|||
${FRAMEWORK_INCLUDES}
|
||||
${FRAMEWORK_ASYNC_INCLUDES}
|
||||
${RENDERER_INCLUDES}
|
||||
${RENDERER_COLOR_INCLUDES}
|
||||
${RENDERER_DXT_INCLUDES}
|
||||
${RENDERER_JOBS_INCLUDES}
|
||||
${RENDERER_JOBS_DYNAMICSHADOWVOLUME_INCLUDES}
|
||||
${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_INCLUDES}
|
||||
${RENDERER_JOBS_STATICSHADOWVOLUME_INCLUDES}
|
||||
${RENDERER_OPENGL_INCLUDES}
|
||||
#${IRRXML_INCLUDES}
|
||||
${JPEG_INCLUDES}
|
||||
#${PNG_INCLUDES}
|
||||
|
@ -986,6 +1034,8 @@ set(RBDOOM3_INCLUDES
|
|||
${UI_INCLUDES}
|
||||
${SWF_INCLUDES}
|
||||
${COMMON_INCLUDES}
|
||||
${DOOMCLASSIC_INCLUDES}
|
||||
${TIMIDITY_INCLUDES}
|
||||
|
||||
#${COMPILER_INCLUDES}
|
||||
#${COMPILER_AAS_INCLUDES} ${COMPILER_AAS_SOURCES}
|
||||
|
@ -1000,6 +1050,13 @@ set(RBDOOM3_SOURCES
|
|||
${FRAMEWORK_SOURCES}
|
||||
${FRAMEWORK_ASYNC_SOURCES}
|
||||
${RENDERER_SOURCES}
|
||||
${RENDERER_COLOR_SOURCES}
|
||||
${RENDERER_DXT_SOURCES}
|
||||
${RENDERER_JOBS_SOURCES}
|
||||
${RENDERER_JOBS_DYNAMICSHADOWVOLUME_SOURCES}
|
||||
${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES}
|
||||
${RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES}
|
||||
${RENDERER_OPENGL_SOURCES}
|
||||
#${IRRXML_SOURCES}
|
||||
${JPEG_SOURCES}
|
||||
#${PNG_SOURCES}
|
||||
|
@ -1012,6 +1069,8 @@ set(RBDOOM3_SOURCES
|
|||
${UI_SOURCES}
|
||||
${SWF_SOURCES}
|
||||
${COMMON_SOURCES}
|
||||
${DOOMCLASSIC_SOURCES}
|
||||
${TIMIDITY_SOURCES}
|
||||
|
||||
#${COMPILER_AAS_SOURCES}
|
||||
#${COMPILER_DMAP_SOURCES}
|
||||
|
@ -1019,6 +1078,8 @@ set(RBDOOM3_SOURCES
|
|||
#${COMPILER_ROQVQ_SOURCES}
|
||||
)
|
||||
|
||||
add_definitions(-DUSE_DOOMCLASSIC)
|
||||
|
||||
add_definitions(-D__DOOM__
|
||||
-DGLEW_STATIC
|
||||
#-DBUILD_FREETYPE
|
||||
|
@ -1093,7 +1154,9 @@ if(MSVC)
|
|||
endif()
|
||||
|
||||
list(APPEND RBDOOM3_INCLUDES ${OPENAL_INCLUDES})
|
||||
list(APPEND RBDOOM3_SOURCES ${OPENAL_SOURCES})
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${OPENAL_SOURCES}
|
||||
${DOOMCLASSIC_OPENAL_SOURCES})
|
||||
|
||||
set(OpenAL_LIBRARIES
|
||||
OpenAL32)
|
||||
|
@ -1105,17 +1168,10 @@ if(MSVC)
|
|||
install(FILES libs/openal-soft/lib/win32/OpenAL32.pdb DESTINATION .)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DUSE_DOOMCLASSIC)
|
||||
|
||||
list(APPEND RBDOOM3_INCLUDES
|
||||
${XAUDIO2_INCLUDES}
|
||||
${DOOMCLASSIC_INCLUDES}
|
||||
${TIMIDITY_INCLUDES})
|
||||
|
||||
list(APPEND RBDOOM3_INCLUDES ${XAUDIO2_INCLUDES})
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${XAUDIO2_SOURCES}
|
||||
${DOOMCLASSIC_SOURCES}
|
||||
${TIMIDITY_SOURCES})
|
||||
${DOOMCLASSIC_XAUDIO2_SOURCES})
|
||||
endif()
|
||||
|
||||
if(USE_MFC_TOOLS)
|
||||
|
@ -1147,7 +1203,7 @@ if(MSVC)
|
|||
${EDITOR_SOUND_INCLUDES} ${EDITOR_SOUND_SOURCES})
|
||||
endif()
|
||||
|
||||
list(APPEND RBDOOM3_INLCUDES
|
||||
list(APPEND RBDOOM3_INCLUDES
|
||||
${SYS_INCLUDES}
|
||||
${WIN32_INCLUDES})
|
||||
|
||||
|
@ -1168,8 +1224,6 @@ if(MSVC)
|
|||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/jobs/staticshadowvolume/StaticShadowVolume.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/jobs/ShadowShared.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/RenderLog.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_stub.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_win32.cpp)
|
||||
|
||||
foreach( src_file ${RBDOOM3_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "/Yuprecompiled.h for ${src_file}")
|
||||
|
@ -1226,12 +1280,9 @@ else()
|
|||
${SYS_INCLUDES} ${SYS_SOURCES})
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DUSE_DOOMCLASSIC)
|
||||
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${DOOMCLASSIC_INCLUDES} ${DOOMCLASSIC_SOURCES}
|
||||
${TIMIDITY_INCLUDES} ${TIMIDITY_SOURCES}
|
||||
${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES})
|
||||
${WIN32_INCLUDES} ${WIN32_SOURCES} ${WIN32_RESOURCES}
|
||||
${DOOMCLASSIC_STUBAUDIO_SOURCES})
|
||||
|
||||
#list(REMOVE_ITEM WIN32_SOURCES sys/win32/win_cpu.cpp)
|
||||
list(APPEND WIN32_SOURCES sys/sdl/sdl_cpu.cpp)
|
||||
|
@ -1267,10 +1318,14 @@ else()
|
|||
#endif()
|
||||
|
||||
list(APPEND RBDOOM3_INCLUDES ${OPENAL_INCLUDES})
|
||||
list(APPEND RBDOOM3_SOURCES ${OPENAL_SOURCES})
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${OPENAL_SOURCES}
|
||||
${DOOMCLASSIC_OPENAL_SOURCES})
|
||||
else()
|
||||
list(APPEND RBDOOM3_INCLUDES ${STUBAUDIO_INCLUDES})
|
||||
list(APPEND RBDOOM3_SOURCES ${STUBAUDIO_SOURCES})
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${STUBAUDIO_SOURCES}
|
||||
${DOOMCLASSIC_STUBAUDIO_SOURCES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@ -1288,7 +1343,6 @@ else()
|
|||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/jobs/staticshadowvolume/StaticShadowVolume.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/jobs/ShadowShared.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/RenderLog.cpp)
|
||||
# list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../doomclassic/doom/i_sound_stub.cpp)
|
||||
|
||||
foreach( src_file ${RBDOOM3_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
astyle.exe -v --options=astyle-options.ini --exclude="libs" --recursive *.h
|
||||
astyle.exe -v --options=astyle-options.ini --exclude="libs" --exclude="idlib/math/Simd.cpp" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
|
||||
astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --recursive *.h
|
||||
astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
|
||||
|
||||
pause
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
./astyle.exe -v --options=astyle-options.ini --exclude="libs" --recursive *.h
|
||||
./astyle.exe -v --options=astyle-options.ini --exclude="libs" --exclude="idlib/math/Simd.cpp" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
|
||||
./astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --recursive *.h
|
||||
./astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
|
||||
|
||||
#pause
|
6
neo/cmake-vs2012-32bit-openal.bat
Normal file
6
neo/cmake-vs2012-32bit-openal.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
cd ..
|
||||
del /s /q build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 11" -DCMAKE_INSTALL_PREFIX=../bin/win8-32 -DOPENAL=ON ../neo
|
||||
pause
|
|
@ -511,11 +511,15 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
|
|||
if( armorPulse > 0.0f && armorPulse < 1.0f )
|
||||
{
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f - armorPulse );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, armorMaterial );
|
||||
}
|
||||
|
||||
|
||||
// tunnel vision
|
||||
/*
|
||||
RB: disabled tunnel vision because the renderer converts colors set by SetColor4 to bytes which are clamped to [0,255]
|
||||
so materials that want to access float values greater than 1 with parm0 - parm3 are always broken
|
||||
|
||||
float health = 0.0f;
|
||||
if( g_testHealthVision.GetFloat() != 0.0f )
|
||||
{
|
||||
|
@ -538,13 +542,15 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
|
|||
if( alpha < 1.0f )
|
||||
{
|
||||
renderSystem->SetColor4( ( player->health <= 0.0f ) ? MS2SEC( gameLocal.slow.time ) : lastDamageTime, 1.0f, 1.0f, ( player->health <= 0.0f ) ? 0.0f : alpha );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, tunnelMaterial );
|
||||
}
|
||||
RB end
|
||||
*/
|
||||
|
||||
if( bfgVision )
|
||||
{
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -561,7 +567,7 @@ void idPlayerView::SingleView( const renderView_t* view, idMenuHandler_HUD* hudM
|
|||
else
|
||||
{
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, mtr );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, mtr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +662,7 @@ void idPlayerView::ScreenFade()
|
|||
if( fadeColor[ 3 ] != 0.0f )
|
||||
{
|
||||
renderSystem->SetColor4( fadeColor[ 0 ], fadeColor[ 1 ], fadeColor[ 2 ], fadeColor[ 3 ] );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, declManager->FindMaterial( "_white" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1076,11 +1082,11 @@ void FullscreenFX_Helltime::AccumPass( const renderView_t* view )
|
|||
if( clearAccumBuffer )
|
||||
{
|
||||
clearAccumBuffer = false;
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterials[level] );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterials[level] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1101,7 @@ void FullscreenFX_Helltime::HighQuality()
|
|||
float t1 = 0.0f;
|
||||
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1201,11 +1207,11 @@ void FullscreenFX_Multiplayer::AccumPass( const renderView_t* view )
|
|||
if( clearAccumBuffer )
|
||||
{
|
||||
clearAccumBuffer = false;
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, initMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, initMaterial );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, captureMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, captureMaterial );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1220,7 +1226,7 @@ void FullscreenFX_Multiplayer::HighQuality()
|
|||
float t1 = 0.0f;
|
||||
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, t0, 1.0f, t1, drawMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, t0, 1.0f, t1, drawMaterial );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1357,8 +1363,8 @@ void FullscreenFX_Warp::HighQuality()
|
|||
interp = 0.7 * ( 1 - interp ) + 0.3 * ( interp );
|
||||
|
||||
// draw the warps
|
||||
center.x = 320;
|
||||
center.y = 240;
|
||||
center.x = renderSystem->GetVirtualWidth() / 2.0f;
|
||||
center.y = renderSystem->GetVirtualHeight() / 2.0f;
|
||||
radius = 200;
|
||||
|
||||
for( float i = 0; i < 360; i += STEP )
|
||||
|
@ -1375,18 +1381,18 @@ void FullscreenFX_Warp::HighQuality()
|
|||
|
||||
p.outer1.x = center.x + x1 * radius;
|
||||
p.outer1.y = center.y + y1 * radius;
|
||||
p.outer1.z = p.outer1.x / ( float )SCREEN_WIDTH;
|
||||
p.outer1.w = 1 - ( p.outer1.y / ( float )SCREEN_HEIGHT );
|
||||
p.outer1.z = p.outer1.x / ( float )renderSystem->GetVirtualWidth();
|
||||
p.outer1.w = 1 - ( p.outer1.y / ( float )renderSystem->GetVirtualHeight() );
|
||||
|
||||
p.outer2.x = center.x + x2 * radius;
|
||||
p.outer2.y = center.y + y2 * radius;
|
||||
p.outer2.z = p.outer2.x / ( float )SCREEN_WIDTH;
|
||||
p.outer2.w = 1 - ( p.outer2.y / ( float )SCREEN_HEIGHT );
|
||||
p.outer2.z = p.outer2.x / ( float )renderSystem->GetVirtualWidth();
|
||||
p.outer2.w = 1 - ( p.outer2.y / ( float )renderSystem->GetVirtualHeight() );
|
||||
|
||||
p.center.x = center.x;
|
||||
p.center.y = center.y;
|
||||
p.center.z = p.center.x / ( float )SCREEN_WIDTH;
|
||||
p.center.w = 1 - ( p.center.y / ( float )SCREEN_HEIGHT );
|
||||
p.center.z = p.center.x / ( float )renderSystem->GetVirtualWidth();
|
||||
p.center.w = 1 - ( p.center.y / ( float )renderSystem->GetVirtualHeight() );
|
||||
|
||||
// draw it
|
||||
DrawWarp( p, interp );
|
||||
|
@ -1436,7 +1442,7 @@ void FullscreenFX_EnviroSuit::HighQuality()
|
|||
float t0 = 1.0f;
|
||||
float s1 = 1.0f;
|
||||
float t1 = 0.0f;
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1527,7 +1533,7 @@ void FullscreenFX_DoubleVision::HighQuality()
|
|||
|
||||
|
||||
renderSystem->SetColor4( color.x, color.y, color.z, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
|
||||
|
||||
renderSystem->SetColor4( color.x, color.y, color.z, 0.5f );
|
||||
s0 = 0.0f;
|
||||
|
@ -1535,7 +1541,7 @@ void FullscreenFX_DoubleVision::HighQuality()
|
|||
s1 = ( 1.0 - shift );
|
||||
t1 = 0.0f;
|
||||
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, material );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1594,7 +1600,7 @@ void FullscreenFX_InfluenceVision::HighQuality()
|
|||
if( player->GetInfluenceMaterial() )
|
||||
{
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, pct );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0.0f, 0.0f, 1.0f, 1.0f, player->GetInfluenceMaterial() );
|
||||
}
|
||||
else if( player->GetInfluenceEntity() == NULL )
|
||||
{
|
||||
|
@ -1712,7 +1718,7 @@ void FullscreenFX_Bloom::HighQuality()
|
|||
float yScale = 1.0f;
|
||||
|
||||
renderSystem->SetColor4( alpha, alpha, alpha, 1 );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s1, t2 * yScale, s2, t1 * yScale, drawMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s1, t2 * yScale, s2, t1 * yScale, drawMaterial );
|
||||
|
||||
shift += currentIntensity;
|
||||
}
|
||||
|
@ -1881,7 +1887,7 @@ void FullscreenFXManager::Blendback( float alpha )
|
|||
float t0 = 1.0f;
|
||||
float s1 = 1.0f;
|
||||
float t1 = 0.0f;
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, blendBackMaterial );
|
||||
renderSystem->DrawStretchPic( 0.0f, 0.0f, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), s0, t0, s1, t1, blendBackMaterial );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -747,11 +747,6 @@ void idWeapon::Clear()
|
|||
WEAPON_RAISEWEAPON.Unlink();
|
||||
WEAPON_LOWERWEAPON.Unlink();
|
||||
|
||||
if( muzzleFlashHandle != -1 )
|
||||
{
|
||||
gameRenderWorld->FreeLightDef( muzzleFlashHandle );
|
||||
muzzleFlashHandle = -1;
|
||||
}
|
||||
if( muzzleFlashHandle != -1 )
|
||||
{
|
||||
gameRenderWorld->FreeLightDef( muzzleFlashHandle );
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -64,6 +65,18 @@ void idMenuScreen_Shell_Credits::SetupCreditList()
|
|||
|
||||
|
||||
creditList.Clear();
|
||||
creditList.Append( creditInfo_t( 3, "RBDOOM 3 BFG EDITION" ) );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t( 1, "Lead Programmer" ) );
|
||||
creditList.Append( creditInfo_t( 0, "Robert Beckebans - Major part of the Linux port" ) );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t( 1, "Additional Programming" ) );
|
||||
creditList.Append( creditInfo_t( 0, "Daniel Gibson - Tons of code cleanups, netcode++" ) );
|
||||
creditList.Append( creditInfo_t( 0, "Jonathan Young - Bugfixes, misc improvements" ) );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t( 0, "For more see the GitHub stats ;)" ) );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t( 3, "DOOM 3 BFG EDITION" ) );
|
||||
creditList.Append( creditInfo_t() );
|
||||
creditList.Append( creditInfo_t( 2, "DEVELOPMENT TEAM" ) );
|
||||
|
|
|
@ -858,22 +858,22 @@ void idCommonLocal::RenderSplash()
|
|||
const float sysAspect = sysWidth / sysHeight;
|
||||
const float splashAspect = 16.0f / 9.0f;
|
||||
const float adjustment = sysAspect / splashAspect;
|
||||
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f;
|
||||
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f;
|
||||
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f;
|
||||
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f;
|
||||
if( barHeight > 0.0f )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
if( barWidth > 0.0f )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
renderSystem->SetColor4( 1, 1, 1, 1 );
|
||||
renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, splashScreen );
|
||||
renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, splashScreen );
|
||||
|
||||
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
renderSystem->RenderCommandBuffers( cmd );
|
||||
|
@ -890,8 +890,8 @@ void idCommonLocal::RenderBink( const char* path )
|
|||
const float sysHeight = renderSystem->GetHeight();
|
||||
const float sysAspect = sysWidth / sysHeight;
|
||||
const float movieAspect = ( 16.0f / 9.0f );
|
||||
const float imageWidth = SCREEN_WIDTH * movieAspect / sysAspect;
|
||||
const float chop = 0.5f * ( SCREEN_WIDTH - imageWidth );
|
||||
const float imageWidth = renderSystem->GetVirtualWidth() * movieAspect / sysAspect;
|
||||
const float chop = 0.5f * ( renderSystem->GetVirtualWidth() - imageWidth );
|
||||
|
||||
idStr materialText;
|
||||
materialText.Format( "{ translucent { videoMap %s } }", path );
|
||||
|
@ -902,7 +902,7 @@ void idCommonLocal::RenderBink( const char* path )
|
|||
|
||||
while( Sys_Milliseconds() <= material->GetCinematicStartTime() + material->CinematicLength() )
|
||||
{
|
||||
renderSystem->DrawStretchPic( chop, 0, imageWidth, SCREEN_HEIGHT, 0, 0, 1, 1, material );
|
||||
renderSystem->DrawStretchPic( chop, 0, imageWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, material );
|
||||
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu );
|
||||
renderSystem->RenderCommandBuffers( cmd );
|
||||
Sys_GenerateEvents();
|
||||
|
|
|
@ -1050,13 +1050,13 @@ HandleCommonErrors
|
|||
*/
|
||||
bool HandleCommonErrors( const idSaveLoadParms& parms )
|
||||
{
|
||||
common->Dialog().ShowSaveIndicator( false );
|
||||
|
||||
if( parms.GetError() == SAVEGAME_E_NONE )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
common->Dialog().ShowSaveIndicator( false );
|
||||
|
||||
if( parms.GetError() & SAVEGAME_E_CORRUPTED )
|
||||
{
|
||||
// This one might need to be handled by the game
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
virtual bool ProcessEvent( const sysEvent_t* event, bool forceAccept );
|
||||
virtual bool Active();
|
||||
virtual void ClearNotifyLines();
|
||||
virtual void Open();
|
||||
virtual void Close();
|
||||
virtual void Print( const char* text );
|
||||
virtual void Draw( bool forceFullScreen );
|
||||
|
@ -70,6 +71,8 @@ public:
|
|||
void Clear();
|
||||
|
||||
private:
|
||||
void Resize();
|
||||
|
||||
void KeyDownEvent( int key );
|
||||
|
||||
void Linefeed();
|
||||
|
@ -138,6 +141,9 @@ private:
|
|||
idList< overlayText_t > overlayText;
|
||||
idList< idDebugGraph*> debugGraphs;
|
||||
|
||||
int lastVirtualScreenWidth;
|
||||
int lastVirtualScreenHeight;
|
||||
|
||||
static idCVar con_speed;
|
||||
static idCVar con_notifyTime;
|
||||
static idCVar con_noPrint;
|
||||
|
@ -356,9 +362,9 @@ void idConsoleLocal::Init()
|
|||
keyCatching = false;
|
||||
|
||||
LOCALSAFE_LEFT = 32;
|
||||
LOCALSAFE_RIGHT = 608;
|
||||
LOCALSAFE_RIGHT = SCREEN_WIDTH - LOCALSAFE_LEFT;
|
||||
LOCALSAFE_TOP = 24;
|
||||
LOCALSAFE_BOTTOM = 456;
|
||||
LOCALSAFE_BOTTOM = SCREEN_HEIGHT - LOCALSAFE_TOP;
|
||||
LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT;
|
||||
LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP;
|
||||
|
||||
|
@ -419,6 +425,22 @@ void idConsoleLocal::ClearNotifyLines()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idConsoleLocal::Open
|
||||
================
|
||||
*/
|
||||
void idConsoleLocal::Open()
|
||||
{
|
||||
if( keyCatching )
|
||||
return; // already open
|
||||
|
||||
consoleField.ClearAutoComplete();
|
||||
consoleField.Clear();
|
||||
keyCatching = true;
|
||||
SetDisplayFraction( 0.5f );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idConsoleLocal::Close
|
||||
|
@ -514,6 +536,24 @@ void idConsoleLocal::Dump( const char* fileName )
|
|||
fileSystem->CloseFile( f );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idConsoleLocal::Resize
|
||||
==============
|
||||
*/
|
||||
void idConsoleLocal::Resize()
|
||||
{
|
||||
if( renderSystem->GetVirtualWidth() == lastVirtualScreenWidth && renderSystem->GetVirtualHeight() == lastVirtualScreenHeight )
|
||||
return;
|
||||
|
||||
lastVirtualScreenWidth = renderSystem->GetVirtualWidth();
|
||||
lastVirtualScreenHeight = renderSystem->GetVirtualHeight();
|
||||
LOCALSAFE_RIGHT = renderSystem->GetVirtualWidth() - LOCALSAFE_LEFT;
|
||||
LOCALSAFE_BOTTOM = renderSystem->GetVirtualHeight() - LOCALSAFE_TOP;
|
||||
LOCALSAFE_WIDTH = LOCALSAFE_RIGHT - LOCALSAFE_LEFT;
|
||||
LOCALSAFE_HEIGHT = LOCALSAFE_BOTTOM - LOCALSAFE_TOP;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idConsoleLocal::PageUp
|
||||
|
@ -1036,7 +1076,7 @@ void idConsoleLocal::DrawInput()
|
|||
|
||||
renderSystem->DrawSmallChar( LOCALSAFE_LEFT + 1 * SMALLCHAR_WIDTH, y, ']' );
|
||||
|
||||
consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, true );
|
||||
consoleField.Draw( LOCALSAFE_LEFT + 2 * SMALLCHAR_WIDTH, y, renderSystem->GetVirtualWidth() - 3 * SMALLCHAR_WIDTH, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1119,29 +1159,29 @@ void idConsoleLocal::DrawSolidConsole( float frac )
|
|||
int lines;
|
||||
int currentColor;
|
||||
|
||||
lines = idMath::Ftoi( SCREEN_HEIGHT * frac );
|
||||
lines = idMath::Ftoi( renderSystem->GetVirtualHeight() * frac );
|
||||
if( lines <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( lines > SCREEN_HEIGHT )
|
||||
if( lines > renderSystem->GetVirtualHeight() )
|
||||
{
|
||||
lines = SCREEN_HEIGHT;
|
||||
lines = renderSystem->GetVirtualHeight();
|
||||
}
|
||||
|
||||
// draw the background
|
||||
y = frac * SCREEN_HEIGHT - 2;
|
||||
y = frac * renderSystem->GetVirtualHeight() - 2;
|
||||
if( y < 1.0f )
|
||||
{
|
||||
y = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, SCREEN_WIDTH, y );
|
||||
renderSystem->DrawFilled( idVec4( 0.0f, 0.0f, 0.0f, 0.75f ), 0, 0, renderSystem->GetVirtualWidth(), y );
|
||||
}
|
||||
|
||||
renderSystem->DrawFilled( colorCyan, 0, y, SCREEN_WIDTH, 2 );
|
||||
renderSystem->DrawFilled( colorCyan, 0, y, renderSystem->GetVirtualWidth(), 2 );
|
||||
|
||||
// draw the version number
|
||||
|
||||
|
@ -1233,6 +1273,8 @@ ForceFullScreen is used by the editor
|
|||
*/
|
||||
void idConsoleLocal::Draw( bool forceFullScreen )
|
||||
{
|
||||
Resize();
|
||||
|
||||
if( forceFullScreen )
|
||||
{
|
||||
// if we are forced full screen because of a disconnect,
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
// clear the timers on any recent prints that are displayed in the notify lines
|
||||
virtual void ClearNotifyLines() = 0;
|
||||
|
||||
// force console open
|
||||
virtual void Open() = 0;
|
||||
|
||||
// some console commands, like timeDemo, will force the console closed before they start
|
||||
virtual void Close() = 0;
|
||||
|
||||
|
|
|
@ -307,9 +307,7 @@ idCVar idFileSystemLocal::fs_game_base( "fs_game_base", "", CVAR_SYSTEM | CVAR_
|
|||
|
||||
idCVar fs_basepath( "fs_basepath", "", CVAR_SYSTEM | CVAR_INIT, "" );
|
||||
idCVar fs_savepath( "fs_savepath", "", CVAR_SYSTEM | CVAR_INIT, "" );
|
||||
// RB: defaulted fs_resourceLoadPriority to 0 for better modding
|
||||
idCVar fs_resourceLoadPriority( "fs_resourceLoadPriority", "0", CVAR_SYSTEM , "if 1, open requests will be honored from resource files first; if 0, the resource files are checked after normal search paths" );
|
||||
// RB end
|
||||
idCVar fs_resourceLoadPriority( "fs_resourceLoadPriority", "1", CVAR_SYSTEM , "if 1, open requests will be honored from resource files first; if 0, the resource files are checked after normal search paths" );
|
||||
idCVar fs_enableBackgroundCaching( "fs_enableBackgroundCaching", "1", CVAR_SYSTEM , "if 1 allow the 360 to precache game files in the background" );
|
||||
|
||||
idFileSystemLocal fileSystemLocal;
|
||||
|
@ -2990,36 +2988,6 @@ void idFileSystemLocal::SetupGameDirectories( const char* gameName )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const char* cachedStartupFiles[] =
|
||||
{
|
||||
"game:\\base\\video\\loadvideo.bik"
|
||||
};
|
||||
const int numStartupFiles = sizeof( cachedStartupFiles ) / sizeof( cachedStartupFiles[ 0 ] );
|
||||
|
||||
const char* cachedNormalFiles[] =
|
||||
{
|
||||
"game:\\base\\_sound_xenon_en.resources", // these will fail silently on the files that are not on disc
|
||||
"game:\\base\\_sound_xenon_fr.resources",
|
||||
"game:\\base\\_sound_xenon_jp.resources",
|
||||
"game:\\base\\_sound_xenon_sp.resources",
|
||||
"game:\\base\\_sound_xenon_it.resources",
|
||||
"game:\\base\\_sound_xenon_gr.resources",
|
||||
"game:\\base\\_sound_xenon.resources",
|
||||
"game:\\base\\_common.resources",
|
||||
"game:\\base\\_ordered.resources",
|
||||
"game:\\base\\video\\mars_rotation.bik" // cache this to save the consumer from hearing SEEK.. SEEK... SEEK.. SEEK SEEEK while at the main menu
|
||||
};
|
||||
const int numNormalFiles = sizeof( cachedNormalFiles ) / sizeof( cachedNormalFiles[ 0 ] );
|
||||
|
||||
const char* dontCacheFiles[] =
|
||||
{
|
||||
"game:\\base\\maps\\*.*", // these will fail silently on the files that are not on disc
|
||||
"game:\\base\\video\\*.*",
|
||||
"game:\\base\\sound\\*.*",
|
||||
};
|
||||
const int numDontCacheFiles = sizeof( dontCacheFiles ) / sizeof( dontCacheFiles[ 0 ] );
|
||||
|
||||
/*
|
||||
================
|
||||
idFileSystemLocal::InitPrecache
|
||||
|
|
|
@ -233,7 +233,7 @@ void idCommonLocal::DrawWipeModel()
|
|||
|
||||
float fade = ( float )( currentTime - wipeStartTime ) / ( wipeStopTime - wipeStartTime );
|
||||
renderSystem->SetColor4( 1, 1, 1, fade );
|
||||
renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, wipeMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, wipeMaterial );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -262,22 +262,22 @@ void idCommonLocal::Draw()
|
|||
const float sysAspect = sysWidth / sysHeight;
|
||||
const float doomAspect = 4.0f / 3.0f;
|
||||
const float adjustment = sysAspect / doomAspect;
|
||||
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )SCREEN_HEIGHT * 0.25f;
|
||||
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )SCREEN_WIDTH * 0.25f;
|
||||
const float barHeight = ( adjustment >= 1.0f ) ? 0.0f : ( 1.0f - adjustment ) * ( float )renderSystem->GetVirtualHeight() * 0.25f;
|
||||
const float barWidth = ( adjustment <= 1.0f ) ? 0.0f : ( adjustment - 1.0f ) * ( float )renderSystem->GetVirtualWidth() * 0.25f;
|
||||
if( barHeight > 0.0f )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, SCREEN_HEIGHT - barHeight, SCREEN_WIDTH, barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, renderSystem->GetVirtualHeight() - barHeight, renderSystem->GetVirtualWidth(), barHeight, 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
if( barWidth > 0.0f )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( SCREEN_WIDTH - barWidth, 0, barWidth, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( renderSystem->GetVirtualWidth() - barWidth, 0, barWidth, renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
renderSystem->SetColor4( 1, 1, 1, 1 );
|
||||
renderSystem->DrawStretchPic( barWidth, barHeight, SCREEN_WIDTH - barWidth * 2.0f, SCREEN_HEIGHT - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial );
|
||||
renderSystem->DrawStretchPic( barWidth, barHeight, renderSystem->GetVirtualWidth() - barWidth * 2.0f, renderSystem->GetVirtualHeight() - barHeight * 2.0f, 0, 0, 1, 1, doomClassicMaterial );
|
||||
}
|
||||
#endif
|
||||
// RB end
|
||||
|
@ -287,7 +287,7 @@ void idCommonLocal::Draw()
|
|||
if( !gameDraw )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
game->Shell_Render();
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void idCommonLocal::Draw()
|
|||
if( !gameDraw )
|
||||
{
|
||||
renderSystem->SetColor( colorBlack );
|
||||
renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
|
||||
// save off the 2D drawing from the game
|
||||
|
@ -326,7 +326,7 @@ void idCommonLocal::Draw()
|
|||
else
|
||||
{
|
||||
renderSystem->SetColor4( 0, 0, 0, 1 );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 1, 1, whiteMaterial );
|
||||
renderSystem->DrawStretchPic( 0, 0, renderSystem->GetVirtualWidth(), renderSystem->GetVirtualHeight(), 0, 0, 1, 1, whiteMaterial );
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -853,7 +853,24 @@ void idCommonLocal::Frame()
|
|||
}
|
||||
catch( idException& )
|
||||
{
|
||||
return; // an ERP_DROP was thrown
|
||||
// an ERP_DROP was thrown
|
||||
#if defined(USE_DOOMCLASSIC)
|
||||
if( currentGame == DOOM_CLASSIC || currentGame == DOOM2_CLASSIC )
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// kill loading gui
|
||||
delete loadGUI;
|
||||
loadGUI = NULL;
|
||||
|
||||
// drop back to main menu
|
||||
LeaveGame();
|
||||
|
||||
// force the console open to show error messages
|
||||
console->Open();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,85 @@
|
|||
|
||||
add_definitions(-D__IDLIB__ -D__DOOM_DLL__)
|
||||
|
||||
file(GLOB_RECURSE ID_INCLUDES *.h)
|
||||
file(GLOB_RECURSE ID_SOURCES *.cpp)
|
||||
file(GLOB ID__INCLUDES *.h)
|
||||
file(GLOB ID__SOURCES *.cpp)
|
||||
file(GLOB ID_BV_INCLUDES bv/*.h)
|
||||
file(GLOB ID_BV_SOURCES bv/*.cpp)
|
||||
file(GLOB ID_CONTAINERS_INCLUDES containers/*.h)
|
||||
file(GLOB ID_CONTAINERS_SOURCES containers/*.cpp)
|
||||
file(GLOB ID_GEOMETRY_INCLUDES geometry/*.h)
|
||||
file(GLOB ID_GEOMETRY_SOURCES geometry/*.cpp)
|
||||
file(GLOB ID_HASHING_INCLUDES hashing/*.h)
|
||||
file(GLOB ID_HASHING_SOURCES hashing/*.cpp)
|
||||
file(GLOB ID_MATH_INCLUDES math/*.h)
|
||||
file(GLOB ID_MATH_SOURCES math/*.cpp)
|
||||
file(GLOB ID_SYS_INCLUDES sys/*.h)
|
||||
file(GLOB ID_SYS_SOURCES sys/*.cpp)
|
||||
|
||||
if(MSVC)
|
||||
list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sys/posix/posix_thread.cpp)
|
||||
file(GLOB ID_SYS_WIN32_INCLUDES sys/win32/*.h)
|
||||
file(GLOB ID_SYS_WIN32_SOURCES sys/win32/*.cpp)
|
||||
else()
|
||||
list(REMOVE_ITEM ID_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sys/win32/win_thread.cpp)
|
||||
file(GLOB ID_SYS_POSIX_INCLUDES sys/posix/*.h)
|
||||
file(GLOB ID_SYS_POSIX_SOURCES sys/posix/*.cpp)
|
||||
endif()
|
||||
|
||||
set(ID_INCLUDES_ALL
|
||||
${ID__INCLUDES}
|
||||
${ID_BV_INCLUDES}
|
||||
${ID_CONTAINERS_INCLUDES}
|
||||
${ID_GEOMETRY_INCLUDES}
|
||||
${ID_HASHING_INCLUDES}
|
||||
${ID_MATH_INCLUDES}
|
||||
${ID_SYS_INCLUDES}
|
||||
)
|
||||
|
||||
set(ID_SOURCES_ALL
|
||||
${ID__SOURCES}
|
||||
${ID_BV_SOURCES}
|
||||
${ID_CONTAINERS_SOURCES}
|
||||
${ID_GEOMETRY_SOURCES}
|
||||
${ID_HASHING_SOURCES}
|
||||
${ID_MATH_SOURCES}
|
||||
${ID_SYS_SOURCES}
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND ID_INCLUDES_ALL ${ID_SYS_WIN32_INCLUDES})
|
||||
list(APPEND ID_SOURCES_ALL ${ID_SYS_WIN32_SOURCES})
|
||||
else()
|
||||
list(APPEND ID_INCLUDES_ALL ${ID_SYS_POSIX_INCLUDES})
|
||||
list(APPEND ID_SOURCES_ALL ${ID_SYS_POSIX_SOURCES})
|
||||
endif()
|
||||
|
||||
source_group("" FILES ${ID__INCLUDES})
|
||||
source_group("" FILES ${ID__SOURCES})
|
||||
source_group("bv" FILES ${ID_BV_INCLUDES})
|
||||
source_group("bv" FILES ${ID_BV_SOURCES})
|
||||
source_group("containers" FILES ${ID_CONTAINERS_INCLUDES})
|
||||
source_group("containers" FILES ${ID_CONTAINERS_SOURCES})
|
||||
source_group("geometry" FILES ${ID_GEOMETRY_INCLUDES})
|
||||
source_group("geometry" FILES ${ID_GEOMETRY_SOURCES})
|
||||
source_group("hashing" FILES ${ID_HASHING_INCLUDES})
|
||||
source_group("hashing" FILES ${ID_HASHING_SOURCES})
|
||||
source_group("math" FILES ${ID_MATH_INCLUDES})
|
||||
source_group("math" FILES ${ID_MATH_SOURCES})
|
||||
source_group("sys" FILES ${ID_SYS_INCLUDES})
|
||||
source_group("sys" FILES ${ID_SYS_SOURCES})
|
||||
|
||||
if(MSVC)
|
||||
source_group("sys\\win32" FILES ${ID_SYS_WIN32_INCLUDES})
|
||||
source_group("sys\\win32" FILES ${ID_SYS_WIN32_SOURCES})
|
||||
else()
|
||||
source_group("sys\\posix" FILES ${ID_SYS_POSIX_INCLUDES})
|
||||
source_group("sys\\posix" FILES ${ID_SYS_POSIX_SOURCES})
|
||||
endif()
|
||||
|
||||
#if(STANDALONE)
|
||||
# add_definitions(-DSTANDALONE)
|
||||
#endif()
|
||||
|
||||
set(ID_PRECOMPILED_SOURCES ${ID_SOURCES})
|
||||
set(ID_PRECOMPILED_SOURCES ${ID_SOURCES_ALL})
|
||||
list(REMOVE_ITEM ID_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/geometry/RenderMatrix.cpp)
|
||||
list(REMOVE_ITEM ID_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/SoftwareCache.cpp)
|
||||
|
||||
|
@ -36,7 +101,7 @@ if(MSVC)
|
|||
COMPILE_FLAGS "/Ycprecompiled.h"
|
||||
)
|
||||
|
||||
add_library(idlib ${ID_SOURCES} ${ID_INCLUDES})
|
||||
add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL})
|
||||
else()
|
||||
foreach( src_file ${ID_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
|
@ -68,7 +133,7 @@ else()
|
|||
COMMENT "Creating idlib/precompiled.h.gch for idlib"
|
||||
)
|
||||
|
||||
add_library(idlib ${ID_SOURCES} ${ID_INCLUDES})
|
||||
add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL})
|
||||
add_dependencies(idlib precomp_header_idlib)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -113,11 +114,20 @@ ID_INLINE halfFloat_t F32toF16( float a )
|
|||
|
||||
class idDrawVert
|
||||
{
|
||||
friend class idSwap;
|
||||
friend class idShadowVertSkinned;
|
||||
friend class idRenderModelStatic;
|
||||
|
||||
friend void TransformVertsAndTangents( idDrawVert* targetVerts, const int numVerts, const idDrawVert* baseVerts, const idJointMat* joints );
|
||||
|
||||
public:
|
||||
idVec3 xyz; // 12 bytes
|
||||
private:
|
||||
// RB: don't let the old tools code mess with these values
|
||||
halfFloat_t st[2]; // 4 bytes
|
||||
byte normal[4]; // 4 bytes
|
||||
byte tangent[4]; // 4 bytes -- [3] is texture polarity sign
|
||||
public:
|
||||
byte color[4]; // 4 bytes
|
||||
byte color2[4]; // 4 bytes -- weights for skinning
|
||||
|
||||
|
@ -187,9 +197,14 @@ public:
|
|||
#define DRAWVERT_COLOR_OFFSET (6*4)
|
||||
#define DRAWVERT_COLOR2_OFFSET (7*4)
|
||||
|
||||
// RB begin
|
||||
assert_sizeof( idDrawVert, DRAWVERT_SIZE );
|
||||
#if 0
|
||||
assert_offsetof( idDrawVert, xyz, DRAWVERT_XYZ_OFFSET );
|
||||
assert_offsetof( idDrawVert, normal, DRAWVERT_NORMAL_OFFSET );
|
||||
assert_offsetof( idDrawVert, tangent, DRAWVERT_TANGENT_OFFSET );
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -202,6 +217,7 @@ ID_INLINE void VertexFloatToByte( const float& x, const float& y, const float& z
|
|||
{
|
||||
assert_4_byte_aligned( bval ); // for __stvebx
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
const __m128 vector_float_one = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
const __m128 vector_float_half = { 0.5f, 0.5f, 0.5f, 0.5f };
|
||||
|
@ -218,6 +234,13 @@ ID_INLINE void VertexFloatToByte( const float& x, const float& y, const float& z
|
|||
bval[1] = ( byte )_mm_extract_epi16( xyz16, 1 );
|
||||
bval[2] = ( byte )_mm_extract_epi16( xyz16, 2 );
|
||||
|
||||
#else
|
||||
|
||||
bval[0] = VERTEX_FLOAT_TO_BYTE( x );
|
||||
bval[1] = VERTEX_FLOAT_TO_BYTE( y );
|
||||
bval[2] = VERTEX_FLOAT_TO_BYTE( z );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -655,6 +678,7 @@ ID_INLINE void WriteDrawVerts16( idDrawVert* destVerts, const idDrawVert* localV
|
|||
assert_16_byte_aligned( destVerts );
|
||||
assert_16_byte_aligned( localVerts );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
for( int i = 0; i < numVerts; i++ )
|
||||
{
|
||||
|
@ -664,6 +688,11 @@ ID_INLINE void WriteDrawVerts16( idDrawVert* destVerts, const idDrawVert* localV
|
|||
_mm_stream_si128( ( __m128i* )( ( byte* )( destVerts + i ) + 16 ), v1 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
memcpy( destVerts, localVerts, numVerts * sizeof( idDrawVert ) );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define __DRAWVERT_INTRINSICS_H__
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
static const __m128i vector_int_f32_sign_mask = _mm_set1_epi32( 1U << IEEE_FLT_SIGN_BIT );
|
||||
static const __m128i vector_int_f32_exponent_mask = _mm_set1_epi32( ( ( 1U << IEEE_FLT_EXPONENT_BITS ) - 1 ) << IEEE_FLT_MANTISSA_BITS );
|
||||
static const __m128i vector_int_f32_mantissa_mask = _mm_set1_epi32( ( 1U << IEEE_FLT_MANTISSA_BITS ) - 1 );
|
||||
|
@ -50,13 +51,14 @@ static const __m128 vector_float_last_one = { 0.0f, 0.0f, 0.0f, 1.0
|
|||
static const __m128 vector_float_1_over_255 = { 1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f, 1.0f / 255.0f };
|
||||
static const __m128 vector_float_1_over_4 = { 1.0f / 4.0f, 1.0f / 4.0f, 1.0f / 4.0f, 1.0f / 4.0f };
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
====================
|
||||
FastF32toF16
|
||||
====================
|
||||
*/
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
ID_INLINE_EXTERN __m128i FastF32toF16( __m128i f32_bits )
|
||||
{
|
||||
__m128i f16_sign = _mm_srli_epi32( _mm_and_si128( f32_bits, vector_int_f32_sign_mask ), f32_to_f16_sign_shift );
|
||||
|
@ -77,6 +79,7 @@ ID_INLINE_EXTERN __m128i FastF32toF16( __m128i f32_bits )
|
|||
|
||||
return _mm_packs_epi32( flt16, flt16 );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ID_INLINE_EXTERN halfFloat_t Scalar_FastF32toF16( float f32 )
|
||||
|
@ -117,7 +120,7 @@ ID_INLINE_EXTERN halfFloat_t Scalar_FastF32toF16( float f32 )
|
|||
LoadSkinnedDrawVertPosition
|
||||
====================
|
||||
*/
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
ID_INLINE_EXTERN __m128 LoadSkinnedDrawVertPosition( const idDrawVert& base, const idJointMat* joints )
|
||||
{
|
||||
const idJointMat& j0 = joints[base.color[0]];
|
||||
|
@ -178,7 +181,7 @@ ID_INLINE_EXTERN __m128 LoadSkinnedDrawVertPosition( const idDrawVert& base, con
|
|||
|
||||
return r0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ID_INLINE_EXTERN idVec3 Scalar_LoadSkinnedDrawVertPosition( const idDrawVert& vert, const idJointMat* joints )
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,8 +44,11 @@ const float LCP_DELTA_FORCE_EPSILON = 1e-9f;
|
|||
|
||||
#define IGNORE_UNSATISFIABLE_VARIABLES
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
#define LCP_SIMD
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(LCP_SIMD)
|
||||
ALIGN16( const __m128 SIMD_SP_zero ) = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
ALIGN16( const __m128 SIMD_SP_one ) = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
ALIGN16( const __m128 SIMD_SP_two ) = { 2.0f, 2.0f, 2.0f, 2.0f };
|
||||
|
@ -70,7 +73,7 @@ ALIGN16( const unsigned int SIMD_DW_one[4] ) = { 1, 1, 1, 1 };
|
|||
ALIGN16( const unsigned int SIMD_DW_four[4] ) = { 4, 4, 4, 4 };
|
||||
ALIGN16( const unsigned int SIMD_DW_index[4] ) = { 0, 1, 2, 3 };
|
||||
ALIGN16( const int SIMD_DW_not3[4] ) = { ~3, ~3, ~3, ~3 };
|
||||
|
||||
#endif // #if defined(LCP_SIMD)
|
||||
/*
|
||||
========================
|
||||
Multiply_SIMD
|
||||
|
@ -91,6 +94,7 @@ static void Multiply_SIMD( float* dst, const float* src0, const float* src1, con
|
|||
dst[i] = src0[i] * src1[i];
|
||||
}
|
||||
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
for( ; i + 4 <= count; i += 4 )
|
||||
{
|
||||
|
@ -104,6 +108,21 @@ static void Multiply_SIMD( float* dst, const float* src0, const float* src1, con
|
|||
_mm_store_ps( dst + i, s0 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
for( ; i + 4 <= count; i += 4 )
|
||||
{
|
||||
assert_16_byte_aligned( &dst[i] );
|
||||
assert_16_byte_aligned( &src0[i] );
|
||||
assert_16_byte_aligned( &src1[i] );
|
||||
|
||||
dst[i + 0] = src0[i + 0] * src1[i + 0];
|
||||
dst[i + 1] = src0[i + 1] * src1[i + 1];
|
||||
dst[i + 2] = src0[i + 2] * src1[i + 2];
|
||||
dst[i + 3] = src0[i + 3] * src1[i + 3];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for( ; i < count; i++ )
|
||||
{
|
||||
|
@ -124,6 +143,7 @@ static void MultiplyAdd_SIMD( float* dst, const float constant, const float* src
|
|||
{
|
||||
int i = 0;
|
||||
|
||||
|
||||
// RB: changed unsigned int to uintptr_t
|
||||
for( ; ( ( uintptr_t )dst & 0xF ) != 0 && i < count; i++ )
|
||||
// RB end
|
||||
|
@ -131,6 +151,7 @@ static void MultiplyAdd_SIMD( float* dst, const float constant, const float* src
|
|||
dst[i] += constant * src[i];
|
||||
}
|
||||
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
__m128 c = _mm_load1_ps( & constant );
|
||||
for( ; i + 4 <= count; i += 4 )
|
||||
|
@ -144,6 +165,20 @@ static void MultiplyAdd_SIMD( float* dst, const float constant, const float* src
|
|||
_mm_store_ps( dst + i, s );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
for( ; i + 4 <= count; i += 4 )
|
||||
{
|
||||
assert_16_byte_aligned( &src[i] );
|
||||
assert_16_byte_aligned( &dst[i] );
|
||||
|
||||
dst[i + 0] += constant * src[i + 0];
|
||||
dst[i + 1] += constant * src[i + 1];
|
||||
dst[i + 2] += constant * src[i + 2];
|
||||
dst[i + 3] += constant * src[i + 3];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for( ; i < count; i++ )
|
||||
{
|
||||
|
@ -163,7 +198,7 @@ static float DotProduct_SIMD( const float* src0, const float* src1, const int co
|
|||
assert_16_byte_aligned( src0 );
|
||||
assert_16_byte_aligned( src1 );
|
||||
|
||||
#ifndef _lint
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
__m128 sum = ( __m128& ) SIMD_SP_zero;
|
||||
int i = 0;
|
||||
|
@ -185,31 +220,49 @@ static float DotProduct_SIMD( const float* src0, const float* src1, const int co
|
|||
|
||||
#else
|
||||
|
||||
// RB: the old loop caused completely broken rigid body physics and NaN errors
|
||||
#if 1
|
||||
float s0 = 0.0f;
|
||||
float s1 = 0.0f;
|
||||
float s2 = 0.0f;
|
||||
float s3 = 0.0f;
|
||||
|
||||
int i = 0;
|
||||
for( ; i < count - 3; i += 4 )
|
||||
for( ; i + 4 <= count; i += 4 )
|
||||
{
|
||||
s0 += src0[i + 4] * src1[i + 4];
|
||||
s1 += src0[i + 5] * src1[i + 5];
|
||||
s2 += src0[i + 6] * src1[i + 6];
|
||||
s3 += src0[i + 7] * src1[i + 7];
|
||||
s0 += src0[i + 0] * src1[i + 0];
|
||||
s1 += src0[i + 1] * src1[i + 1];
|
||||
s2 += src0[i + 2] * src1[i + 2];
|
||||
s3 += src0[i + 3] * src1[i + 3];
|
||||
}
|
||||
|
||||
switch( count - i )
|
||||
{
|
||||
NODEFAULT;
|
||||
|
||||
case 4:
|
||||
s3 += src0[i + 3] * src1[i + 3];
|
||||
case 3:
|
||||
s0 += src0[i + 2] * src1[i + 2];
|
||||
s2 += src0[i + 2] * src1[i + 2];
|
||||
case 2:
|
||||
s1 += src0[i + 1] * src1[i + 1];
|
||||
case 1:
|
||||
s2 += src0[i + 0] * src1[i + 0];
|
||||
s0 += src0[i + 0] * src1[i + 0];
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
return s0 + s1 + s2 + s3;
|
||||
#else
|
||||
|
||||
float s = 0;
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
s += src0[i] * src1[i];
|
||||
}
|
||||
|
||||
return s;
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -328,7 +381,7 @@ static void LowerTriangularSolve_SIMD( const idMatX& L, float* x, const float* b
|
|||
|
||||
int i = skip;
|
||||
|
||||
#ifndef _lint
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
// work up to a multiple of 4 rows
|
||||
for( ; ( i & 3 ) != 0 && i < n; i++ )
|
||||
|
@ -601,7 +654,7 @@ static void LowerTriangularSolveTranspose_SIMD( const idMatX& L, float* x, const
|
|||
const float* lptr = L.ToFloatPtr() + m * nc + m - 4;
|
||||
float* xptr = x + m;
|
||||
|
||||
#ifndef _lint
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
// process 4 rows at a time
|
||||
for( int i = m; i >= 4; i -= 4 )
|
||||
|
@ -982,7 +1035,7 @@ static bool LDLT_Factor_SIMD( idMatX& mat, idVecX& invDiag, const int n )
|
|||
mptr[j * nc + 3] = ( mptr[j * nc + 3] - v[0] * mptr[j * nc + 0] - v[1] * mptr[j * nc + 1] - v[2] * mptr[j * nc + 2] ) * d;
|
||||
}
|
||||
|
||||
#ifndef _lint
|
||||
#if defined(LCP_SIMD)
|
||||
|
||||
__m128 vzero = _mm_setzero_ps();
|
||||
for( int i = 4; i < n; i += 4 )
|
||||
|
@ -1360,7 +1413,7 @@ static void GetMaxStep_SIMD( const float* f, const float* a, const float* delta_
|
|||
int d, float dir, float& maxStep, int& limit, int& limitSide )
|
||||
{
|
||||
|
||||
|
||||
#if defined(LCP_SIMD)
|
||||
__m128 vMaxStep;
|
||||
__m128i vLimit;
|
||||
__m128i vLimitSide;
|
||||
|
@ -1484,6 +1537,67 @@ static void GetMaxStep_SIMD( const float* f, const float* a, const float* delta_
|
|||
_mm_store_ss( & maxStep, vMaxStep );
|
||||
limit = _mm_cvtsi128_si32( vLimit );
|
||||
limitSide = _mm_cvtsi128_si32( vLimitSide );
|
||||
|
||||
#else
|
||||
|
||||
// default to a full step for the current variable
|
||||
{
|
||||
float negAccel = -a[d];
|
||||
float deltaAccel = delta_a[d];
|
||||
int m0 = ( fabs( deltaAccel ) > LCP_DELTA_ACCEL_EPSILON );
|
||||
float step = negAccel / ( m0 ? deltaAccel : 1.0f );
|
||||
maxStep = m0 ? step : 0.0f;
|
||||
limit = d;
|
||||
limitSide = 0;
|
||||
}
|
||||
|
||||
// test the current variable
|
||||
{
|
||||
float deltaForce = dir;
|
||||
float forceLimit = ( deltaForce < 0.0f ) ? lo[d] : hi[d];
|
||||
float step = ( forceLimit - f[d] ) / deltaForce;
|
||||
int setSide = ( deltaForce < 0.0f ) ? -1 : 1;
|
||||
int m0 = ( fabs( deltaForce ) > LCP_DELTA_FORCE_EPSILON );
|
||||
int m1 = ( fabs( forceLimit ) != idMath::INFINITY );
|
||||
int m2 = ( step < maxStep );
|
||||
int m3 = ( m0 & m1 & m2 );
|
||||
maxStep = m3 ? step : maxStep;
|
||||
limit = m3 ? d : limit;
|
||||
limitSide = m3 ? setSide : limitSide;
|
||||
}
|
||||
|
||||
// test the clamped bounded variables
|
||||
for( int i = numUnbounded; i < numClamped; i++ )
|
||||
{
|
||||
float deltaForce = delta_f[i];
|
||||
float forceLimit = ( deltaForce < 0.0f ) ? lo[i] : hi[i];
|
||||
int m0 = ( fabs( deltaForce ) > LCP_DELTA_FORCE_EPSILON );
|
||||
float step = ( forceLimit - f[i] ) / ( m0 ? deltaForce : 1.0f );
|
||||
int setSide = ( deltaForce < 0.0f ) ? -1 : 1;
|
||||
int m1 = ( fabs( forceLimit ) != idMath::INFINITY );
|
||||
int m2 = ( step < maxStep );
|
||||
int m3 = ( m0 & m1 & m2 );
|
||||
maxStep = m3 ? step : maxStep;
|
||||
limit = m3 ? i : limit;
|
||||
limitSide = m3 ? setSide : limitSide;
|
||||
}
|
||||
|
||||
// test the not clamped bounded variables
|
||||
for( int i = numClamped; i < d; i++ )
|
||||
{
|
||||
float negAccel = -a[i];
|
||||
float deltaAccel = delta_a[i];
|
||||
int m0 = ( side[i] * deltaAccel > LCP_DELTA_ACCEL_EPSILON );
|
||||
float step = negAccel / ( m0 ? deltaAccel : 1.0f );
|
||||
int m1 = ( lo[i] < -LCP_BOUND_EPSILON || hi[i] > LCP_BOUND_EPSILON );
|
||||
int m2 = ( step < maxStep );
|
||||
int m3 = ( m0 & m1 & m2 );
|
||||
maxStep = m3 ? step : maxStep;
|
||||
limit = m3 ? i : limit;
|
||||
limitSide = m3 ? 0 : limitSide;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -201,6 +201,7 @@ void idMatX::CopyLowerToUpperTriangle()
|
|||
assert( ( GetNumColumns() & 3 ) == 0 );
|
||||
assert( GetNumColumns() >= GetNumRows() );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
const int n = GetNumColumns();
|
||||
const int m = GetNumRows();
|
||||
|
@ -341,6 +342,22 @@ void idMatX::CopyLowerToUpperTriangle()
|
|||
_mm_store_ps( basePtr + n0, r0 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const int n = GetNumColumns();
|
||||
const int m = GetNumRows();
|
||||
for( int i = 0; i < m; i++ )
|
||||
{
|
||||
const float* __restrict ptr = ToFloatPtr() + ( i + 1 ) * n + i;
|
||||
float* __restrict dstPtr = ToFloatPtr() + i * n;
|
||||
for( int j = i + 1; j < m; j++ )
|
||||
{
|
||||
dstPtr[j] = ptr[0];
|
||||
ptr += n;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
for( int i = 0; i < numRows; i++ )
|
||||
|
|
|
@ -46,7 +46,10 @@ NOTE: due to the temporary memory pool idMatX cannot be used by multiple threads
|
|||
#define MATX_CLEAREND() int s = numRows * numColumns; while( s < ( ( s + 3 ) & ~3 ) ) { mat[s++] = 0.0f; }
|
||||
#define MATX_ALLOCA( n ) ( (float *) _alloca16( MATX_QUAD( n ) ) )
|
||||
#define MATX_ALLOCA_CACHE_LINES( n ) ( (float *) _alloca128( ( ( n ) * sizeof( float ) + CACHE_LINE_SIZE - 1 ) & ~ ( CACHE_LINE_SIZE - 1 ) ) )
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
#define MATX_SIMD
|
||||
#endif
|
||||
|
||||
class idMatX
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ const float idMath::INFINITY = 1e30f;
|
|||
const float idMath::FLT_EPSILON = 1.192092896e-07f;
|
||||
const float idMath::FLT_SMALLEST_NON_DENORMAL = * reinterpret_cast< const float* >( & SMALLEST_NON_DENORMAL ); // 1.1754944e-038f
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
const __m128 idMath::SIMD_SP_zero = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
const __m128 idMath::SIMD_SP_255 = { 255.0f, 255.0f, 255.0f, 255.0f };
|
||||
const __m128 idMath::SIMD_SP_min_char = { -128.0f, -128.0f, -128.0f, -128.0f };
|
||||
|
@ -61,6 +62,7 @@ const __m128 idMath::SIMD_SP_smallestNonDenorm = { FLT_SMALLEST_NON_DENORMAL, FL
|
|||
const __m128 idMath::SIMD_SP_tiny = { 1e-4f, 1e-4f, 1e-4f, 1e-4f };
|
||||
const __m128 idMath::SIMD_SP_rsqrt_c0 = { 3.0f, 3.0f, 3.0f, 3.0f };
|
||||
const __m128 idMath::SIMD_SP_rsqrt_c1 = { -0.5f, -0.5f, -0.5f, -0.5f };
|
||||
#endif
|
||||
|
||||
bool idMath::initialized = false;
|
||||
dword idMath::iSqrt[SQRT_TABLE_SIZE]; // inverse square root lookup table
|
||||
|
|
|
@ -469,6 +469,7 @@ public:
|
|||
static const float FLT_EPSILON; // smallest positive number such that 1.0+FLT_EPSILON != 1.0
|
||||
static const float FLT_SMALLEST_NON_DENORMAL; // smallest non-denormal 32-bit floating point value
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
static const __m128 SIMD_SP_zero;
|
||||
static const __m128 SIMD_SP_255;
|
||||
static const __m128 SIMD_SP_min_char;
|
||||
|
@ -479,6 +480,7 @@ public:
|
|||
static const __m128 SIMD_SP_tiny;
|
||||
static const __m128 SIMD_SP_rsqrt_c0;
|
||||
static const __m128 SIMD_SP_rsqrt_c1;
|
||||
#endif
|
||||
|
||||
private:
|
||||
enum
|
||||
|
@ -526,9 +528,7 @@ idMath::InvSqrt16
|
|||
*/
|
||||
ID_INLINE float idMath::InvSqrt16( float x )
|
||||
{
|
||||
|
||||
return ( x > FLT_SMALLEST_NON_DENORMAL ) ? sqrtf( 1.0f / x ) : INFINITY;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1321,8 +1321,21 @@ ID_INLINE int idMath::Ftoi( float f )
|
|||
// If a converted result is larger than the maximum signed doubleword integer,
|
||||
// the floating-point invalid exception is raised, and if this exception is masked,
|
||||
// the indefinite integer value (80000000H) is returned.
|
||||
#if defined(USE_INTRINSICS)
|
||||
__m128 x = _mm_load_ss( &f );
|
||||
return _mm_cvttss_si32( x );
|
||||
#elif 0 // round chop (C/C++ standard)
|
||||
int i, s, e, m, shift;
|
||||
i = *reinterpret_cast<int*>( &f );
|
||||
s = i >> IEEE_FLT_SIGN_BIT;
|
||||
e = ( ( i >> IEEE_FLT_MANTISSA_BITS ) & ( ( 1 << IEEE_FLT_EXPONENT_BITS ) - 1 ) ) - IEEE_FLT_EXPONENT_BIAS;
|
||||
m = ( i & ( ( 1 << IEEE_FLT_MANTISSA_BITS ) - 1 ) ) | ( 1 << IEEE_FLT_MANTISSA_BITS );
|
||||
shift = e - IEEE_FLT_MANTISSA_BITS;
|
||||
return ( ( ( ( m >> -shift ) | ( m << shift ) ) & ~( e >> INT32_SIGN_BIT ) ) ^ s ) - s;
|
||||
#else
|
||||
// If a converted result is larger than the maximum signed doubleword integer the result is undefined.
|
||||
return C_FLOAT_TO_INT( f );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1332,10 +1345,24 @@ idMath::Ftoi8
|
|||
*/
|
||||
ID_INLINE char idMath::Ftoi8( float f )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
__m128 x = _mm_load_ss( &f );
|
||||
x = _mm_max_ss( x, SIMD_SP_min_char );
|
||||
x = _mm_min_ss( x, SIMD_SP_max_char );
|
||||
return static_cast<char>( _mm_cvttss_si32( x ) );
|
||||
#else
|
||||
// The converted result is clamped to the range [-128,127].
|
||||
int i = C_FLOAT_TO_INT( f );
|
||||
if( i < -128 )
|
||||
{
|
||||
return -128;
|
||||
}
|
||||
else if( i > 127 )
|
||||
{
|
||||
return 127;
|
||||
}
|
||||
return static_cast<char>( i );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1345,10 +1372,24 @@ idMath::Ftoi16
|
|||
*/
|
||||
ID_INLINE short idMath::Ftoi16( float f )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
__m128 x = _mm_load_ss( &f );
|
||||
x = _mm_max_ss( x, SIMD_SP_min_short );
|
||||
x = _mm_min_ss( x, SIMD_SP_max_short );
|
||||
return static_cast<short>( _mm_cvttss_si32( x ) );
|
||||
#else
|
||||
// The converted result is clamped to the range [-32768,32767].
|
||||
int i = C_FLOAT_TO_INT( f );
|
||||
if( i < -32768 )
|
||||
{
|
||||
return -32768;
|
||||
}
|
||||
else if( i > 32767 )
|
||||
{
|
||||
return 32767;
|
||||
}
|
||||
return static_cast<short>( i );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1382,10 +1423,25 @@ ID_INLINE byte idMath::Ftob( float f )
|
|||
{
|
||||
// If a converted result is negative the value (0) is returned and if the
|
||||
// converted result is larger than the maximum byte the value (255) is returned.
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
__m128 x = _mm_load_ss( &f );
|
||||
x = _mm_max_ss( x, SIMD_SP_zero );
|
||||
x = _mm_min_ss( x, SIMD_SP_255 );
|
||||
return static_cast<byte>( _mm_cvttss_si32( x ) );
|
||||
#else
|
||||
// The converted result is clamped to the range [0,255].
|
||||
int i = C_FLOAT_TO_INT( f );
|
||||
if( i < 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if( i > 255 )
|
||||
{
|
||||
return 255;
|
||||
}
|
||||
return static_cast<byte>( i );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,6 +38,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// E
|
||||
//===============================================================
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
|
@ -973,3 +974,5 @@ void VPCALL idSIMD_SSE::UntransformJoints( idJointMat* jointMats, const int* par
|
|||
}
|
||||
}
|
||||
|
||||
#endif // #if defined(USE_INTRINSICS)
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -37,6 +38,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
class idSIMD_SSE : public idSIMD_Generic
|
||||
{
|
||||
public:
|
||||
|
@ -50,4 +53,6 @@ public:
|
|||
virtual void VPCALL UntransformJoints( idJointMat* jointMats, const int* parents, const int firstJoint, const int lastJoint );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !__MATH_SIMD_SSE_H__ */
|
||||
|
|
|
@ -45,7 +45,10 @@ NOTE: due to the temporary memory pool idVecX cannot be used by multiple threads
|
|||
#define VECX_QUAD( x ) ( ( ( ( x ) + 3 ) & ~3 ) * sizeof( float ) )
|
||||
#define VECX_CLEAREND() int s = size; while( s < ( ( s + 3) & ~3 ) ) { p[s++] = 0.0f; }
|
||||
#define VECX_ALLOCA( n ) ( (float *) _alloca16( VECX_QUAD( n ) ) )
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
#define VECX_SIMD
|
||||
#endif
|
||||
|
||||
class idVecX
|
||||
{
|
||||
|
|
|
@ -516,6 +516,11 @@ ID_INLINE idVec3 operator*( const float a, const idVec3 b )
|
|||
return idVec3( b.x * a, b.y * a, b.z * a );
|
||||
}
|
||||
|
||||
ID_INLINE idVec3 operator/( const float a, const idVec3 b )
|
||||
{
|
||||
return idVec3( a / b.x, a / b.y, a / b.z );
|
||||
}
|
||||
|
||||
ID_INLINE idVec3 idVec3::operator+( const idVec3& a ) const
|
||||
{
|
||||
return idVec3( x + a.x, y + a.y, z + a.z );
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../../precompiled.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <pthread_ng.h> // for pthread_set_name_np
|
||||
#include <pthread_np.h> // for pthread_set_name_np
|
||||
#endif
|
||||
|
||||
// DG: Note: On Linux you need at least (e)glibc 2.12 to be able to set the threadname
|
||||
|
@ -63,18 +63,15 @@ static int Sys_SetThreadName( pthread_t handle, const char* name )
|
|||
ret = pthread_setname_np( handle, name );
|
||||
if( ret != 0 )
|
||||
idLib::common->Printf( "Setting threadname \"%s\" failed, reason: %s (%i)\n", name, strerror( errno ), errno );
|
||||
// pthread_getname_np(pthread_t, char*, size_t)
|
||||
#elif defined(__FreeBSD__)
|
||||
// according to http://www.freebsd.org/cgi/man.cgi?query=pthread_set_name_np&sektion=3
|
||||
// the interface is void pthread_set_name_np(pthread_t tid, const char *name);
|
||||
pthread_set_name_np( handle, name ); // doesn't return anything
|
||||
// seems like there is no get_name equivalent
|
||||
#endif
|
||||
/* TODO: OSX:
|
||||
// according to http://stackoverflow.com/a/7989973
|
||||
// this needs to be called in the thread to be named!
|
||||
ret = pthread_setname_np(name);
|
||||
// int pthread_getname_np(pthread_t, char*, size_t);
|
||||
|
||||
// so we'd have to wrap the xthread_t function in Sys_CreateThread and set the name in the wrapping function...
|
||||
*/
|
||||
|
@ -82,7 +79,24 @@ static int Sys_SetThreadName( pthread_t handle, const char* name )
|
|||
return ret;
|
||||
}
|
||||
|
||||
// TODO: Sys_GetThreadName() ?
|
||||
static int Sys_GetThreadName( pthread_t handle, char* namebuf, size_t buflen )
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef __linux__
|
||||
ret = pthread_getname_np( handle, namebuf, buflen );
|
||||
if( ret != 0 )
|
||||
idLib::common->Printf( "Getting threadname failed, reason: %s (%i)\n", strerror( errno ), errno );
|
||||
#elif defined(__FreeBSD__)
|
||||
// seems like there is no pthread_getname_np equivalent on FreeBSD
|
||||
idStr::snPrintf( namebuf, buflen, "Can't read threadname on this platform!" );
|
||||
#endif
|
||||
/* TODO: OSX:
|
||||
// int pthread_getname_np(pthread_t, char*, size_t);
|
||||
*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // DEBUG_THREADS
|
||||
|
||||
|
||||
|
@ -228,7 +242,7 @@ void Sys_DestroyThread( uintptr_t threadHandle )
|
|||
name[0] = '\0';
|
||||
|
||||
#if defined(DEBUG_THREADS)
|
||||
pthread_getname_np( threadHandle, name, sizeof( name ) );
|
||||
Sys_GetThreadName( ( pthread_t )threadHandle, name, sizeof( name ) );
|
||||
#endif
|
||||
|
||||
#if 0 //!defined(__ANDROID__)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -28,8 +29,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef __SYS_INTRIINSICS_H__
|
||||
#define __SYS_INTRIINSICS_H__
|
||||
|
||||
#include <emmintrin.h>
|
||||
#define USE_INTRINSICS
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
/*
|
||||
================================================================================================
|
||||
|
||||
|
@ -91,6 +95,7 @@ ID_INLINE_EXTERN float __frndz( float x )
|
|||
================================================================================================
|
||||
*/
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
// The code below assumes that a cache line is 64 bytes.
|
||||
// We specify the cache line size as 128 here to make the code consistent with the consoles.
|
||||
#define CACHE_LINE_SIZE 128
|
||||
|
@ -122,6 +127,26 @@ ID_FORCE_INLINE void FlushCacheLine( const void* ptr, int offset )
|
|||
_mm_clflush( bytePtr + 64 );
|
||||
}
|
||||
|
||||
/*
|
||||
================================================
|
||||
#endif
|
||||
Other
|
||||
================================================
|
||||
*/
|
||||
#else
|
||||
|
||||
#define CACHE_LINE_SIZE 128
|
||||
|
||||
ID_INLINE void Prefetch( const void* ptr, int offset ) {}
|
||||
ID_INLINE void ZeroCacheLine( void* ptr, int offset )
|
||||
{
|
||||
byte* bytePtr = ( byte* )( ( ( ( uintptr_t )( ptr ) ) + ( offset ) ) & ~( CACHE_LINE_SIZE - 1 ) );
|
||||
memset( bytePtr, 0, CACHE_LINE_SIZE );
|
||||
}
|
||||
ID_INLINE void FlushCacheLine( const void* ptr, int offset ) {}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================================================
|
||||
Block Clear Macros
|
||||
|
@ -168,6 +193,8 @@ ID_INLINE_EXTERN int CACHE_LINE_CLEAR_OVERFLOW_COUNT( int size )
|
|||
================================================================================================
|
||||
*/
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
/*
|
||||
================================================
|
||||
PC Windows
|
||||
|
@ -194,6 +221,7 @@ ID_INLINE_EXTERN int CACHE_LINE_CLEAR_OVERFLOW_COUNT( int size )
|
|||
#endif
|
||||
// DG end
|
||||
|
||||
|
||||
// make the intrinsics "type unsafe"
|
||||
typedef union DECLSPEC_INTRINTYPE _CRT_ALIGN( 16 ) __m128c
|
||||
{
|
||||
|
@ -275,4 +303,6 @@ ID_FORCE_INLINE_EXTERN __m128 _mm_div16_ps( __m128 x, __m128 y )
|
|||
// load idBounds::GetMaxs()
|
||||
#define _mm_loadu_bounds_1( bounds ) _mm_perm_ps( _mm_loadh_pi( _mm_load_ss( & bounds[1].x ), (__m64 *) & bounds[1].y ), _MM_SHUFFLE( 1, 3, 2, 0 ) )
|
||||
|
||||
#endif // #if defined(USE_INTRINSICS)
|
||||
|
||||
#endif // !__SYS_INTRIINSICS_H__
|
||||
|
|
|
@ -23,7 +23,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
#define __WIN32__
|
||||
#endif
|
||||
|
||||
#ifndef LITTLE_ENDIAN
|
||||
#define LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ song if we're less than a second into this one. */
|
|||
#define VERB_DEBUG_SILLY 4
|
||||
|
||||
typedef struct {
|
||||
char *id_name, id_character;
|
||||
const char *id_name, id_character;
|
||||
int verbosity, trace_playing, opened;
|
||||
|
||||
int (*open)(int using_stdin, int using_stdout);
|
||||
void (*pass_playing_list)(int number_of_files, char *list_of_files[]);
|
||||
void (*close)(void);
|
||||
int (*read)(int *valp);
|
||||
int (*cmsg)(int type, int verbosity_level, char *fmt, ...);
|
||||
int (*cmsg)(int type, int verbosity_level, const char *fmt, ...);
|
||||
|
||||
void (*refresh)(void);
|
||||
void (*reset)(void);
|
||||
|
|
|
@ -194,10 +194,10 @@ static Instrument *load_instrument(char *name, int percussion,
|
|||
idFile * fp;
|
||||
uint8_t tmp[1024];
|
||||
int i,j,noluck=0;
|
||||
char *path;
|
||||
const char *path;
|
||||
char filename[1024];
|
||||
#ifdef PATCH_EXT_LIST
|
||||
static char *patch_ext[] = PATCH_EXT_LIST;
|
||||
static const char *patch_ext[] = PATCH_EXT_LIST;
|
||||
#endif
|
||||
|
||||
if (!name) return 0;
|
||||
|
|
|
@ -113,7 +113,7 @@ static int32_t getvl(void)
|
|||
|
||||
/* Print a string from the file, followed by a newline. Any non-ASCII
|
||||
or unprintable characters will be converted to periods. */
|
||||
static int dumpstring( int32_t len, char *label)
|
||||
static int dumpstring( int32_t len, const char *label)
|
||||
{
|
||||
signed char *s=(signed char *)safe_malloc(len+1);
|
||||
if (len != (int32_t)read_local(s, 1, len))
|
||||
|
@ -171,7 +171,7 @@ static MidiEventList *read_midi_event(void)
|
|||
len=getvl();
|
||||
if (type>0 && type<16)
|
||||
{
|
||||
static char *label[]={
|
||||
static const char *label[]={
|
||||
"Text event: ", "Text: ", "Copyright: ", "Track name: ",
|
||||
"Instrument: ", "Lyric: ", "Marker: ", "Cue point: "};
|
||||
dumpstring(len, label[(type>7) ? 0 : type]);
|
||||
|
|
|
@ -51,7 +51,7 @@ static void ctl_reset(void);
|
|||
static int ctl_open(int using_stdin, int using_stdout);
|
||||
static void ctl_close(void);
|
||||
static int ctl_read(int *valp);
|
||||
static int cmsg(int type, int verbosity_level, char *fmt, ...);
|
||||
static int cmsg(int type, int verbosity_level, const char *fmt, ...);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define safeOutputDebug(x) printf( "%s", x )
|
||||
|
@ -92,7 +92,7 @@ static int ctl_read(int *valp)
|
|||
}
|
||||
extern void SendDebugMsg(const char*);
|
||||
extern bool debugOutput;
|
||||
static int cmsg(int type, int verbosity_level, char *fmt, ...)
|
||||
static int cmsg(int type, int verbosity_level, const char *fmt, ...)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
va_list ap;
|
||||
|
|
|
@ -54,9 +54,9 @@ extern void Real_Tim_Free( void *pt );
|
|||
|
||||
typedef struct {
|
||||
int rate, encoding;
|
||||
char *id_name;
|
||||
const char *id_name;
|
||||
FILE* fp;
|
||||
char *file_name;
|
||||
const char *file_name;
|
||||
|
||||
int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */
|
||||
void (*close_output)(void);
|
||||
|
|
|
@ -466,7 +466,7 @@ bool idBinaryImage::LoadFromGeneratedFile( idFile* bFile, ID_TIME_T sourceFileTi
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if( fileData.sourceFileTime != sourceFileTime && !fileSystem->InProductionMode() )
|
||||
if( fileData.sourceFileTime != sourceFileTime && sourceFileTime != 0 && com_productionMode.GetInteger() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ void UnbindBufferObjects()
|
|||
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
|
||||
}
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
void CopyBuffer( byte* dst, const byte* src, int numBytes )
|
||||
{
|
||||
|
@ -121,6 +122,16 @@ void CopyBuffer( byte* dst, const byte* src, int numBytes )
|
|||
_mm_sfence();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void CopyBuffer( byte* dst, const byte* src, int numBytes )
|
||||
{
|
||||
assert_16_byte_aligned( dst );
|
||||
assert_16_byte_aligned( src );
|
||||
memcpy( dst, src, numBytes );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -305,7 +306,11 @@ idDxtEncoder::CompressImageDXT1Fast
|
|||
*/
|
||||
ID_INLINE void idDxtEncoder::CompressImageDXT1Fast( const byte* inBuf, byte* outBuf, int width, int height )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
CompressImageDXT1Fast_SSE2( inBuf, outBuf, width, height );
|
||||
#else
|
||||
CompressImageDXT1Fast_Generic( inBuf, outBuf, width, height );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -315,7 +320,11 @@ idDxtEncoder::CompressImageDXT1AlphaFast
|
|||
*/
|
||||
ID_INLINE void idDxtEncoder::CompressImageDXT1AlphaFast( const byte* inBuf, byte* outBuf, int width, int height )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
CompressImageDXT1AlphaFast_SSE2( inBuf, outBuf, width, height );
|
||||
#else
|
||||
CompressImageDXT1AlphaFast_Generic( inBuf, outBuf, width, height );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -325,7 +334,11 @@ idDxtEncoder::CompressImageDXT5Fast
|
|||
*/
|
||||
ID_INLINE void idDxtEncoder::CompressImageDXT5Fast( const byte* inBuf, byte* outBuf, int width, int height )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
CompressImageDXT5Fast_SSE2( inBuf, outBuf, width, height );
|
||||
#else
|
||||
CompressImageDXT5Fast_Generic( inBuf, outBuf, width, height );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -345,7 +358,11 @@ idDxtEncoder::CompressYCoCgDXT5Fast
|
|||
*/
|
||||
ID_INLINE void idDxtEncoder::CompressYCoCgDXT5Fast( const byte* inBuf, byte* outBuf, int width, int height )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
CompressYCoCgDXT5Fast_SSE2( inBuf, outBuf, width, height );
|
||||
#else
|
||||
CompressYCoCgDXT5Fast_Generic( inBuf, outBuf, width, height );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -365,7 +382,11 @@ idDxtEncoder::CompressNormalMapDXT5Fast
|
|||
*/
|
||||
ID_INLINE void idDxtEncoder::CompressNormalMapDXT5Fast( const byte* inBuf, byte* outBuf, int width, int height )
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
CompressNormalMapDXT5Fast_SSE2( inBuf, outBuf, width, height );
|
||||
#else
|
||||
CompressNormalMapDXT5Fast_Generic( inBuf, outBuf, width, height );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -34,6 +34,7 @@ Contains the DxtEncoder implementation for SSE2.
|
|||
#include "DXTCodec_local.h"
|
||||
#include "DXTCodec.h"
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
//#define TEST_COMPRESSION
|
||||
#ifdef TEST_COMPRESSION
|
||||
|
@ -1627,3 +1628,4 @@ void idDxtEncoder::CompressNormalMapDXT5Fast_SSE2( const byte* inBuf, byte* outB
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // #if defined(USE_INTRINSICS)
|
|
@ -74,7 +74,7 @@ R_MatrixMultiply
|
|||
*/
|
||||
void R_MatrixMultiply( const float a[16], const float b[16], float out[16] )
|
||||
{
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
__m128 a0 = _mm_loadu_ps( a + 0 * 4 );
|
||||
__m128 a1 = _mm_loadu_ps( a + 1 * 4 );
|
||||
__m128 a2 = _mm_loadu_ps( a + 2 * 4 );
|
||||
|
@ -110,6 +110,41 @@ void R_MatrixMultiply( const float a[16], const float b[16], float out[16] )
|
|||
_mm_storeu_ps( out + 2 * 4, t2 );
|
||||
_mm_storeu_ps( out + 3 * 4, t3 );
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
for ( int i = 0; i < 4; i++ ) {
|
||||
for ( int j = 0; j < 4; j++ ) {
|
||||
out[ i * 4 + j ] =
|
||||
a[ i * 4 + 0 ] * b[ 0 * 4 + j ] +
|
||||
a[ i * 4 + 1 ] * b[ 1 * 4 + j ] +
|
||||
a[ i * 4 + 2 ] * b[ 2 * 4 + j ] +
|
||||
a[ i * 4 + 3 ] * b[ 3 * 4 + j ];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
out[0 * 4 + 0] = a[0 * 4 + 0] * b[0 * 4 + 0] + a[0 * 4 + 1] * b[1 * 4 + 0] + a[0 * 4 + 2] * b[2 * 4 + 0] + a[0 * 4 + 3] * b[3 * 4 + 0];
|
||||
out[0 * 4 + 1] = a[0 * 4 + 0] * b[0 * 4 + 1] + a[0 * 4 + 1] * b[1 * 4 + 1] + a[0 * 4 + 2] * b[2 * 4 + 1] + a[0 * 4 + 3] * b[3 * 4 + 1];
|
||||
out[0 * 4 + 2] = a[0 * 4 + 0] * b[0 * 4 + 2] + a[0 * 4 + 1] * b[1 * 4 + 2] + a[0 * 4 + 2] * b[2 * 4 + 2] + a[0 * 4 + 3] * b[3 * 4 + 2];
|
||||
out[0 * 4 + 3] = a[0 * 4 + 0] * b[0 * 4 + 3] + a[0 * 4 + 1] * b[1 * 4 + 3] + a[0 * 4 + 2] * b[2 * 4 + 3] + a[0 * 4 + 3] * b[3 * 4 + 3];
|
||||
|
||||
out[1 * 4 + 0] = a[1 * 4 + 0] * b[0 * 4 + 0] + a[1 * 4 + 1] * b[1 * 4 + 0] + a[1 * 4 + 2] * b[2 * 4 + 0] + a[1 * 4 + 3] * b[3 * 4 + 0];
|
||||
out[1 * 4 + 1] = a[1 * 4 + 0] * b[0 * 4 + 1] + a[1 * 4 + 1] * b[1 * 4 + 1] + a[1 * 4 + 2] * b[2 * 4 + 1] + a[1 * 4 + 3] * b[3 * 4 + 1];
|
||||
out[1 * 4 + 2] = a[1 * 4 + 0] * b[0 * 4 + 2] + a[1 * 4 + 1] * b[1 * 4 + 2] + a[1 * 4 + 2] * b[2 * 4 + 2] + a[1 * 4 + 3] * b[3 * 4 + 2];
|
||||
out[1 * 4 + 3] = a[1 * 4 + 0] * b[0 * 4 + 3] + a[1 * 4 + 1] * b[1 * 4 + 3] + a[1 * 4 + 2] * b[2 * 4 + 3] + a[1 * 4 + 3] * b[3 * 4 + 3];
|
||||
|
||||
out[2 * 4 + 0] = a[2 * 4 + 0] * b[0 * 4 + 0] + a[2 * 4 + 1] * b[1 * 4 + 0] + a[2 * 4 + 2] * b[2 * 4 + 0] + a[2 * 4 + 3] * b[3 * 4 + 0];
|
||||
out[2 * 4 + 1] = a[2 * 4 + 0] * b[0 * 4 + 1] + a[2 * 4 + 1] * b[1 * 4 + 1] + a[2 * 4 + 2] * b[2 * 4 + 1] + a[2 * 4 + 3] * b[3 * 4 + 1];
|
||||
out[2 * 4 + 2] = a[2 * 4 + 0] * b[0 * 4 + 2] + a[2 * 4 + 1] * b[1 * 4 + 2] + a[2 * 4 + 2] * b[2 * 4 + 2] + a[2 * 4 + 3] * b[3 * 4 + 2];
|
||||
out[2 * 4 + 3] = a[2 * 4 + 0] * b[0 * 4 + 3] + a[2 * 4 + 1] * b[1 * 4 + 3] + a[2 * 4 + 2] * b[2 * 4 + 3] + a[2 * 4 + 3] * b[3 * 4 + 3];
|
||||
|
||||
out[3 * 4 + 0] = a[3 * 4 + 0] * b[0 * 4 + 0] + a[3 * 4 + 1] * b[1 * 4 + 0] + a[3 * 4 + 2] * b[2 * 4 + 0] + a[3 * 4 + 3] * b[3 * 4 + 0];
|
||||
out[3 * 4 + 1] = a[3 * 4 + 0] * b[0 * 4 + 1] + a[3 * 4 + 1] * b[1 * 4 + 1] + a[3 * 4 + 2] * b[2 * 4 + 1] + a[3 * 4 + 3] * b[3 * 4 + 1];
|
||||
out[3 * 4 + 2] = a[3 * 4 + 0] * b[0 * 4 + 2] + a[3 * 4 + 1] * b[1 * 4 + 2] + a[3 * 4 + 2] * b[2 * 4 + 2] + a[3 * 4 + 3] * b[3 * 4 + 2];
|
||||
out[3 * 4 + 3] = a[3 * 4 + 0] * b[0 * 4 + 3] + a[3 * 4 + 1] * b[1 * 4 + 3] + a[3 * 4 + 2] * b[2 * 4 + 3] + a[3 * 4 + 3] * b[3 * 4 + 3];
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -266,13 +266,13 @@ void idGuiModel::EmitFullScreen()
|
|||
viewDef->scissor.x2 = viewDef->viewport.x2 - viewDef->viewport.x1;
|
||||
viewDef->scissor.y2 = viewDef->viewport.y2 - viewDef->viewport.y1;
|
||||
|
||||
viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / SCREEN_WIDTH;
|
||||
viewDef->projectionMatrix[0 * 4 + 0] = 2.0f / renderSystem->GetVirtualWidth();
|
||||
viewDef->projectionMatrix[0 * 4 + 1] = 0.0f;
|
||||
viewDef->projectionMatrix[0 * 4 + 2] = 0.0f;
|
||||
viewDef->projectionMatrix[0 * 4 + 3] = 0.0f;
|
||||
|
||||
viewDef->projectionMatrix[1 * 4 + 0] = 0.0f;
|
||||
viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / SCREEN_HEIGHT;
|
||||
viewDef->projectionMatrix[1 * 4 + 1] = -2.0f / renderSystem->GetVirtualHeight();
|
||||
viewDef->projectionMatrix[1 * 4 + 2] = 0.0f;
|
||||
viewDef->projectionMatrix[1 * 4 + 3] = 0.0f;
|
||||
|
||||
|
|
|
@ -302,10 +302,10 @@ static void R_DecalPointCullStatic( byte* cullBits, const idPlane* planes, const
|
|||
assert_16_byte_aligned( cullBits );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_zero = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
const __m128 vector_float_zero = _mm_setzero_ps();
|
||||
const __m128i vector_int_mask0 = _mm_set1_epi32( 1 << 0 );
|
||||
const __m128i vector_int_mask1 = _mm_set1_epi32( 1 << 1 );
|
||||
const __m128i vector_int_mask2 = _mm_set1_epi32( 1 << 2 );
|
||||
|
@ -406,6 +406,39 @@ static void R_DecalPointCullStatic( byte* cullBits, const idPlane* planes, const
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3& v = vertsODS[i].xyz;
|
||||
|
||||
const float d0 = planes[0].Distance( v );
|
||||
const float d1 = planes[1].Distance( v );
|
||||
const float d2 = planes[2].Distance( v );
|
||||
const float d3 = planes[3].Distance( v );
|
||||
const float d4 = planes[4].Distance( v );
|
||||
const float d5 = planes[5].Distance( v );
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITNOTSET( d0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITNOTSET( d1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITNOTSET( d2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITNOTSET( d3 ) << 3;
|
||||
bits |= IEEE_FLT_SIGNBITNOTSET( d4 ) << 4;
|
||||
bits |= IEEE_FLT_SIGNBITNOTSET( d5 ) << 5;
|
||||
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -637,6 +670,7 @@ static void R_CopyDecalSurface( idDrawVert* verts, int numVerts, triIndex_t* ind
|
|||
assert( ( ( decal->numIndexes * sizeof( triIndex_t ) ) & 15 ) == 0 );
|
||||
assert_16_byte_aligned( fadeColor );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
const __m128i vector_int_num_verts = _mm_shuffle_epi32( _mm_cvtsi32_si128( numVerts ), 0 );
|
||||
const __m128i vector_short_num_verts = _mm_packs_epi32( vector_int_num_verts, vector_int_num_verts );
|
||||
|
@ -678,6 +712,28 @@ static void R_CopyDecalSurface( idDrawVert* verts, int numVerts, triIndex_t* ind
|
|||
|
||||
_mm_sfence();
|
||||
|
||||
#else
|
||||
|
||||
// copy vertices and apply depth/time based fading
|
||||
for( int i = 0; i < decal->numVerts; i++ )
|
||||
{
|
||||
// NOTE: bad out-of-order write-combined write, SIMD code does the right thing
|
||||
verts[numVerts + i] = decal->verts[i];
|
||||
for( int j = 0; j < 4; j++ )
|
||||
{
|
||||
verts[numVerts + i].color[j] = idMath::Ftob( fadeColor[j] * decal->vertDepthFade[i] );
|
||||
}
|
||||
}
|
||||
|
||||
// copy indices
|
||||
assert( ( decal->numIndexes & 1 ) == 0 );
|
||||
for( int i = 0; i < decal->numIndexes; i += 2 )
|
||||
{
|
||||
assert( decal->indexes[i + 0] < decal->numVerts && decal->indexes[i + 1] < decal->numVerts );
|
||||
WriteIndexPair( &indexes[numIndexes + i], numVerts + decal->indexes[i + 0], numVerts + decal->indexes[i + 1] );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -378,9 +378,14 @@ idRenderModel* idRenderModelManagerLocal::GetModel( const char* _modelName, bool
|
|||
{
|
||||
model->InitFromFile( canonical );
|
||||
|
||||
idFileLocal outputFile( fileSystem->OpenFileWrite( generatedFileName, "fs_basepath" ) );
|
||||
idLib::Printf( "Writing %s\n", generatedFileName.c_str() );
|
||||
model->WriteBinaryModel( outputFile );
|
||||
// RB: default models shouldn't be cached as binary models
|
||||
if( !model->IsDefaultModel() )
|
||||
{
|
||||
idFileLocal outputFile( fileSystem->OpenFileWrite( generatedFileName, "fs_basepath" ) );
|
||||
idLib::Printf( "Writing %s\n", generatedFileName.c_str() );
|
||||
model->WriteBinaryModel( outputFile );
|
||||
}
|
||||
// RB end
|
||||
} /* else {
|
||||
idLib::Printf( "loaded binary model %s from file %s\n", model->Name(), generatedFileName.c_str() );
|
||||
} */
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -111,7 +112,7 @@ static void R_OverlayPointCullStatic( byte* cullBits, halfFloat_t* texCoordS, ha
|
|||
assert_16_byte_aligned( texCoordT );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_zero = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
@ -187,6 +188,41 @@ static void R_OverlayPointCullStatic( byte* cullBits, halfFloat_t* texCoordS, ha
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3& v = vertsODS[i].xyz;
|
||||
|
||||
const float d0 = planes[0].Distance( v );
|
||||
const float d1 = planes[1].Distance( v );
|
||||
const float d2 = 1.0f - d0;
|
||||
const float d3 = 1.0f - d1;
|
||||
|
||||
halfFloat_t s = Scalar_FastF32toF16( d0 );
|
||||
halfFloat_t t = Scalar_FastF32toF16( d1 );
|
||||
|
||||
texCoordS[i] = s;
|
||||
texCoordT[i] = t;
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITSET( d0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d3 ) << 3;
|
||||
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -201,7 +237,7 @@ static void R_OverlayPointCullSkinned( byte* cullBits, halfFloat_t* texCoordS, h
|
|||
assert_16_byte_aligned( texCoordT );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_zero = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
@ -277,6 +313,41 @@ static void R_OverlayPointCullSkinned( byte* cullBits, halfFloat_t* texCoordS, h
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3 transformed = Scalar_LoadSkinnedDrawVertPosition( vertsODS[i], joints );
|
||||
|
||||
const float d0 = planes[0].Distance( transformed );
|
||||
const float d1 = planes[1].Distance( transformed );
|
||||
const float d2 = 1.0f - d0;
|
||||
const float d3 = 1.0f - d1;
|
||||
|
||||
halfFloat_t s = Scalar_FastF32toF16( d0 );
|
||||
halfFloat_t t = Scalar_FastF32toF16( d1 );
|
||||
|
||||
texCoordS[i] = s;
|
||||
texCoordT[i] = t;
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITSET( d0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITSET( d3 ) << 3;
|
||||
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -486,6 +557,7 @@ static void R_CopyOverlaySurface( idDrawVert* verts, int numVerts, triIndex_t* i
|
|||
assert( ( ( overlay->numVerts * sizeof( idDrawVert ) ) & 15 ) == 0 );
|
||||
assert( ( ( overlay->numIndexes * sizeof( triIndex_t ) ) & 15 ) == 0 );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
const __m128i vector_int_clear_last = _mm_set_epi32( 0, -1, -1, -1 );
|
||||
const __m128i vector_int_num_verts = _mm_shuffle_epi32( _mm_cvtsi32_si128( numVerts ), 0 );
|
||||
|
@ -524,6 +596,30 @@ static void R_CopyOverlaySurface( idDrawVert* verts, int numVerts, triIndex_t* i
|
|||
|
||||
_mm_sfence();
|
||||
|
||||
#else
|
||||
|
||||
// copy vertices
|
||||
for( int i = 0; i < overlay->numVerts; i++ )
|
||||
{
|
||||
const overlayVertex_t& overlayVert = overlay->verts[i];
|
||||
|
||||
// NOTE: bad out-of-order write-combined write, SIMD code does the right thing
|
||||
verts[numVerts + i] = sourceVerts[overlayVert.vertexNum];
|
||||
|
||||
// RB begin
|
||||
verts[numVerts + i].SetTexCoordS( overlayVert.st[0] );
|
||||
verts[numVerts + i].SetTexCoordT( overlayVert.st[1] );
|
||||
// RB end
|
||||
}
|
||||
|
||||
// copy indexes
|
||||
for( int i = 0; i < overlay->numIndexes; i += 2 )
|
||||
{
|
||||
assert( overlay->indexes[i + 0] < overlay->numVerts && overlay->indexes[i + 1] < overlay->numVerts );
|
||||
WriteIndexPair( &indexes[numIndexes + i], numVerts + overlay->indexes[i + 0], numVerts + overlay->indexes[i + 1] );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -32,10 +32,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "tr_local.h"
|
||||
#include "Model_local.h"
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
static const __m128 vector_float_posInfinity = { idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY };
|
||||
static const __m128 vector_float_negInfinity = { -idMath::INFINITY, -idMath::INFINITY, -idMath::INFINITY, -idMath::INFINITY };
|
||||
|
||||
#endif
|
||||
|
||||
static const char* MD5_SnapshotName = "_MD5_Snapshot_";
|
||||
|
||||
|
@ -561,6 +561,7 @@ idMD5Mesh::CalculateBounds
|
|||
*/
|
||||
void idMD5Mesh::CalculateBounds( const idJointMat* entJoints, idBounds& bounds ) const
|
||||
{
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
__m128 minX = vector_float_posInfinity;
|
||||
__m128 minY = vector_float_posInfinity;
|
||||
|
@ -595,6 +596,17 @@ void idMD5Mesh::CalculateBounds( const idJointMat* entJoints, idBounds& bounds )
|
|||
_mm_store_ss( bounds.ToFloatPtr() + 4, _mm_splat_ps( maxY, 3 ) );
|
||||
_mm_store_ss( bounds.ToFloatPtr() + 5, _mm_splat_ps( maxZ, 3 ) );
|
||||
|
||||
#else
|
||||
|
||||
bounds.Clear();
|
||||
for( int i = 0; i < numMeshJoints; i++ )
|
||||
{
|
||||
const idJointMat& joint = entJoints[meshJoints[i]];
|
||||
bounds.AddPoint( joint.GetTranslation() );
|
||||
}
|
||||
bounds.ExpandSelf( maxJointVertDist );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1220,6 +1232,7 @@ static void TransformJoints( idJointMat* __restrict outJoints, const int numJoin
|
|||
assert_16_byte_aligned( inFloats1 );
|
||||
assert_16_byte_aligned( inFloats2 );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
const __m128 mask_keep_last = __m128c( _mm_set_epi32( 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000 ) );
|
||||
|
||||
|
@ -1296,6 +1309,14 @@ static void TransformJoints( idJointMat* __restrict outJoints, const int numJoin
|
|||
_mm_store_ps( outFloats + 1 * 12 + 8, ri1 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
for( int i = 0; i < numJoints; i++ )
|
||||
{
|
||||
idJointMat::Multiply( outJoints[i], inJoints1[i], inJoints2[i] );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -167,12 +167,7 @@ const int BIGCHAR_HEIGHT = 16;
|
|||
const int SCREEN_WIDTH = 640;
|
||||
const int SCREEN_HEIGHT = 480;
|
||||
|
||||
const int TITLESAFE_LEFT = 32;
|
||||
const int TITLESAFE_RIGHT = 608;
|
||||
const int TITLESAFE_TOP = 24;
|
||||
const int TITLESAFE_BOTTOM = 456;
|
||||
const int TITLESAFE_WIDTH = TITLESAFE_RIGHT - TITLESAFE_LEFT;
|
||||
const int TITLESAFE_HEIGHT = TITLESAFE_BOTTOM - TITLESAFE_TOP;
|
||||
extern idCVar r_useVirtualScreenResolution;
|
||||
|
||||
class idRenderWorld;
|
||||
|
||||
|
@ -201,6 +196,8 @@ public:
|
|||
virtual bool IsFullScreen() const = 0;
|
||||
virtual int GetWidth() const = 0;
|
||||
virtual int GetHeight() const = 0;
|
||||
virtual int GetVirtualWidth() const = 0;
|
||||
virtual int GetVirtualHeight() const = 0;
|
||||
|
||||
// return w/h of a single pixel. This will be 1.0 for normal cases.
|
||||
// A side-by-side stereo 3D frame will have a pixel aspect of 0.5.
|
||||
|
|
|
@ -206,6 +206,7 @@ idCVar stereoRender_enable( "stereoRender_enable", "0", CVAR_INTEGER | CVAR_ARCH
|
|||
idCVar stereoRender_swapEyes( "stereoRender_swapEyes", "0", CVAR_BOOL | CVAR_ARCHIVE, "reverse eye adjustments" );
|
||||
idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_ARCHIVE, "subtract from opposite eye to reduce ghosting" );
|
||||
|
||||
idCVar r_useVirtualScreenResolution( "r_useVirtualScreenResolution", "1", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "do 2D rendering at 640x480 and stretch to the current resolution" );
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -249,20 +250,21 @@ DebugCallback
|
|||
For ARB_debug_output
|
||||
========================
|
||||
*/
|
||||
// RB: added const to userParam
|
||||
static void CALLBACK DebugCallback( unsigned int source, unsigned int type,
|
||||
unsigned int id, unsigned int severity, int length, const char* message, void* userParam )
|
||||
unsigned int id, unsigned int severity, int length, const char* message, const void* userParam )
|
||||
{
|
||||
// it probably isn't safe to do an idLib::Printf at this point
|
||||
|
||||
// RB begin
|
||||
// RB: printf should be thread safe on Linux
|
||||
#if defined(_WIN32)
|
||||
OutputDebugString( message );
|
||||
OutputDebugString( "\n" );
|
||||
#else
|
||||
printf( "%s\n", message );
|
||||
#endif
|
||||
// RB end
|
||||
}
|
||||
// RB end
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -555,7 +557,7 @@ void R_SetNewMode( const bool fullInit )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( r_vidMode.GetInteger() > modeList.Num() )
|
||||
if( r_vidMode.GetInteger() >= modeList.Num() )
|
||||
{
|
||||
idLib::Printf( "r_vidMode reset from %i to 0.\n", r_vidMode.GetInteger() );
|
||||
r_vidMode.SetInteger( 0 );
|
||||
|
@ -2521,6 +2523,34 @@ int idRenderSystemLocal::GetHeight() const
|
|||
return glConfig.nativeScreenHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idRenderSystemLocal::GetVirtualWidth
|
||||
========================
|
||||
*/
|
||||
int idRenderSystemLocal::GetVirtualWidth() const
|
||||
{
|
||||
if( r_useVirtualScreenResolution.GetBool() )
|
||||
{
|
||||
return SCREEN_WIDTH;
|
||||
}
|
||||
return glConfig.nativeScreenWidth;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idRenderSystemLocal::GetVirtualHeight
|
||||
========================
|
||||
*/
|
||||
int idRenderSystemLocal::GetVirtualHeight() const
|
||||
{
|
||||
if( r_useVirtualScreenResolution.GetBool() )
|
||||
{
|
||||
return SCREEN_HEIGHT;
|
||||
}
|
||||
return glConfig.nativeScreenHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idRenderSystemLocal::GetStereo3DMode
|
||||
|
|
|
@ -92,7 +92,7 @@ static void R_ShadowVolumeCullBits( byte* cullBits, byte& totalOr, const float r
|
|||
assert_16_byte_aligned( cullBits );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idShadowVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_radius = _mm_splat_ps( _mm_load_ss( &radius ), 0 );
|
||||
|
@ -215,6 +215,56 @@ static void R_ShadowVolumeCullBits( byte* cullBits, byte& totalOr, const float r
|
|||
|
||||
totalOr = ( byte ) _mm_cvtsi128_si32( vecTotalOrByte );
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idShadowVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
byte tOr = 0;
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3& v = vertsODS[i].xyzw.ToVec3();
|
||||
|
||||
const float d0 = planes[0].Distance( v );
|
||||
const float d1 = planes[1].Distance( v );
|
||||
const float d2 = planes[2].Distance( v );
|
||||
const float d3 = planes[3].Distance( v );
|
||||
|
||||
const float t0 = d0 + radius;
|
||||
const float t1 = d1 + radius;
|
||||
const float t2 = d2 + radius;
|
||||
const float t3 = d3 + radius;
|
||||
|
||||
const float s0 = d0 - radius;
|
||||
const float s1 = d1 - radius;
|
||||
const float s2 = d2 - radius;
|
||||
const float s3 = d3 - radius;
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITSET( t0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t3 ) << 3;
|
||||
|
||||
bits |= IEEE_FLT_SIGNBITSET( s0 ) << 4;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s1 ) << 5;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s2 ) << 6;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s3 ) << 7;
|
||||
|
||||
bits ^= 0x0F; // flip lower four bits
|
||||
|
||||
tOr |= bits;
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
totalOr = tOr;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,14 +31,16 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "../../../idlib/sys/sys_intrinsics.h"
|
||||
#include "../../../idlib/geometry/DrawVert_intrinsics.h"
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
static const __m128i vector_int_neg_one = _mm_set_epi32( -1, -1, -1, -1 );
|
||||
#endif
|
||||
|
||||
/*
|
||||
=====================
|
||||
TriangleFacing_SSE2
|
||||
=====================
|
||||
*/
|
||||
#if defined(USE_INTRINSICS)
|
||||
static ID_FORCE_INLINE __m128i TriangleFacing_SSE2( const __m128& vert0X, const __m128& vert0Y, const __m128& vert0Z,
|
||||
const __m128& vert1X, const __m128& vert1Y, const __m128& vert1Z,
|
||||
const __m128& vert2X, const __m128& vert2Y, const __m128& vert2Z,
|
||||
|
@ -60,6 +62,7 @@ static ID_FORCE_INLINE __m128i TriangleFacing_SSE2( const __m128& vert0X, const
|
|||
const __m128 delta = _mm_nmsub_ps( lightOriginX, normalX, _mm_nmsub_ps( lightOriginY, normalY, _mm_nmsub_ps( lightOriginZ, normalZ, normalW ) ) );
|
||||
return _mm_castps_si128( _mm_cmplt_ps( delta, _mm_setzero_ps() ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=====================
|
||||
|
@ -68,6 +71,7 @@ TriangleCulled
|
|||
The clip space of the 'lightProject' is assumed to be in the range [0, 1].
|
||||
=====================
|
||||
*/
|
||||
#if defined(USE_INTRINSICS)
|
||||
static ID_FORCE_INLINE __m128i TriangleCulled_SSE2( const __m128& vert0X, const __m128& vert0Y, const __m128& vert0Z,
|
||||
const __m128& vert1X, const __m128& vert1Y, const __m128& vert1Z,
|
||||
const __m128& vert2X, const __m128& vert2Y, const __m128& vert2Z,
|
||||
|
@ -128,6 +132,92 @@ static ID_FORCE_INLINE __m128i TriangleCulled_SSE2( const __m128& vert0X, const
|
|||
return _mm_castps_si128( _mm_cmpeq_ps( b0, zero ) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
=====================
|
||||
TriangleFacing
|
||||
|
||||
Returns 255 if the triangle is facing the light origin, otherwise returns 0.
|
||||
=====================
|
||||
*/
|
||||
static byte TriangleFacing_Generic( const idVec3& v1, const idVec3& v2, const idVec3& v3, const idVec3& lightOrigin )
|
||||
{
|
||||
const float sx = v2.x - v1.x;
|
||||
const float sy = v2.y - v1.y;
|
||||
const float sz = v2.z - v1.z;
|
||||
|
||||
const float tx = v3.x - v1.x;
|
||||
const float ty = v3.y - v1.y;
|
||||
const float tz = v3.z - v1.z;
|
||||
|
||||
const float normalX = ty * sz - tz * sy;
|
||||
const float normalY = tz * sx - tx * sz;
|
||||
const float normalZ = tx * sy - ty * sx;
|
||||
const float normalW = normalX * v1.x + normalY * v1.y + normalZ * v1.z;
|
||||
|
||||
const float d = lightOrigin.x * normalX + lightOrigin.y * normalY + lightOrigin.z * normalZ - normalW;
|
||||
return ( d > 0.0f ) ? 255 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
TriangleCulled
|
||||
|
||||
Returns 255 if the triangle is culled to the light projection matrix, otherwise returns 0.
|
||||
The clip space of the 'lightProject' is assumed to be in the range [0, 1].
|
||||
=====================
|
||||
*/
|
||||
static byte TriangleCulled_Generic( const idVec3& v1, const idVec3& v2, const idVec3& v3, const idRenderMatrix& lightProject )
|
||||
{
|
||||
// transform the triangle
|
||||
idVec4 c[3];
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
c[0][i] = v1[0] * lightProject[i][0] + v1[1] * lightProject[i][1] + v1[2] * lightProject[i][2] + lightProject[i][3];
|
||||
c[1][i] = v2[0] * lightProject[i][0] + v2[1] * lightProject[i][1] + v2[2] * lightProject[i][2] + lightProject[i][3];
|
||||
c[2][i] = v3[0] * lightProject[i][0] + v3[1] * lightProject[i][1] + v3[2] * lightProject[i][2] + lightProject[i][3];
|
||||
}
|
||||
|
||||
// calculate the culled bits
|
||||
int bits = 0;
|
||||
for( int i = 0; i < 3; i++ )
|
||||
{
|
||||
const float minW = 0.0f;
|
||||
const float maxW = c[i][3];
|
||||
|
||||
if( c[i][0] > minW )
|
||||
{
|
||||
bits |= ( 1 << 0 );
|
||||
}
|
||||
if( c[i][0] < maxW )
|
||||
{
|
||||
bits |= ( 1 << 1 );
|
||||
}
|
||||
if( c[i][1] > minW )
|
||||
{
|
||||
bits |= ( 1 << 2 );
|
||||
}
|
||||
if( c[i][1] < maxW )
|
||||
{
|
||||
bits |= ( 1 << 3 );
|
||||
}
|
||||
if( c[i][2] > minW )
|
||||
{
|
||||
bits |= ( 1 << 4 );
|
||||
}
|
||||
if( c[i][2] < maxW )
|
||||
{
|
||||
bits |= ( 1 << 5 );
|
||||
}
|
||||
}
|
||||
|
||||
// if any bits weren't set, the triangle is completely off one side of the frustum
|
||||
return ( bits != 63 ) ? 255 : 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
|
@ -159,6 +249,7 @@ static int CalculateTriangleFacingCulledStatic( byte* __restrict facing, byte* _
|
|||
const idVec3 lineDir = lineDelta * lineLengthRcp;
|
||||
const float lineLength = lineLengthSqr * lineLengthRcp;
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
idODSStreamedIndexedArray< idDrawVert, triIndex_t, 32, SBT_QUAD, 4* 3 > indexedVertsODS( verts, numVerts, indexes, numIndexes );
|
||||
|
||||
|
@ -271,6 +362,61 @@ static int CalculateTriangleFacingCulledStatic( byte* __restrict facing, byte* _
|
|||
|
||||
return _mm_cvtsi128_si32( numFrontFacing );
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedIndexedArray< idDrawVert, triIndex_t, 32, SBT_QUAD, 1 > indexedVertsODS( verts, numVerts, indexes, numIndexes );
|
||||
|
||||
const byte cullShadowTrianglesToLightMask = cullShadowTrianglesToLight ? 255 : 0;
|
||||
|
||||
int numFrontFacing = 0;
|
||||
|
||||
for( int i = 0, j = 0; i < numIndexes; )
|
||||
{
|
||||
|
||||
const int batchStart = i;
|
||||
const int batchEnd = indexedVertsODS.FetchNextBatch();
|
||||
const int indexStart = j;
|
||||
|
||||
for( ; i <= batchEnd - 3; i += 3, j++ )
|
||||
{
|
||||
const idVec3& v1 = indexedVertsODS[i + 0].xyz;
|
||||
const idVec3& v2 = indexedVertsODS[i + 1].xyz;
|
||||
const idVec3& v3 = indexedVertsODS[i + 2].xyz;
|
||||
|
||||
const byte triangleCulled = TriangleCulled_Generic( v1, v2, v3, lightProject );
|
||||
|
||||
byte triangleFacing = TriangleFacing_Generic( v1, v2, v3, lightOrigin );
|
||||
|
||||
// optionally make triangles that are outside the light frustum facing so they do not contribute to the shadow volume
|
||||
triangleFacing |= ( triangleCulled & cullShadowTrianglesToLightMask );
|
||||
|
||||
culled[j] = triangleCulled;
|
||||
facing[j] = triangleFacing;
|
||||
|
||||
// count the number of facing triangles
|
||||
numFrontFacing += ( triangleFacing & 1 );
|
||||
}
|
||||
|
||||
if( insideShadowVolume != NULL )
|
||||
{
|
||||
for( int k = batchStart, n = indexStart; k <= batchEnd - 3; k += 3, n++ )
|
||||
{
|
||||
if( !facing[n] )
|
||||
{
|
||||
if( R_LineIntersectsTriangleExpandedWithSphere( lineStart, lineEnd, lineDir, lineLength, radius, indexedVertsODS[k + 2].xyz, indexedVertsODS[k + 1].xyz, indexedVertsODS[k + 0].xyz ) )
|
||||
{
|
||||
*insideShadowVolume = true;
|
||||
insideShadowVolume = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numFrontFacing;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -303,6 +449,7 @@ static int CalculateTriangleFacingCulledSkinned( byte* __restrict facing, byte*
|
|||
const idVec3 lineDir = lineDelta * lineLengthRcp;
|
||||
const float lineLength = lineLengthSqr * lineLengthRcp;
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
|
||||
idODSStreamedArray< idDrawVert, 32, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
|
@ -448,6 +595,82 @@ static int CalculateTriangleFacingCulledSkinned( byte* __restrict facing, byte*
|
|||
|
||||
return _mm_cvtsi128_si32( numFrontFacing );
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 32, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
tempVerts[i].ToVec3() = Scalar_LoadSkinnedDrawVertPosition( vertsODS[i], joints );
|
||||
tempVerts[i].w = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
idODSStreamedArray< triIndex_t, 256, SBT_QUAD, 1 > indexesODS( indexes, numIndexes );
|
||||
|
||||
const byte cullShadowTrianglesToLightMask = cullShadowTrianglesToLight ? 255 : 0;
|
||||
|
||||
int numFrontFacing = 0;
|
||||
|
||||
for( int i = 0, j = 0; i < numIndexes; )
|
||||
{
|
||||
|
||||
const int batchStart = i;
|
||||
const int batchEnd = indexesODS.FetchNextBatch();
|
||||
const int indexStart = j;
|
||||
|
||||
for( ; i <= batchEnd - 3; i += 3, j++ )
|
||||
{
|
||||
const int i0 = indexesODS[i + 0];
|
||||
const int i1 = indexesODS[i + 1];
|
||||
const int i2 = indexesODS[i + 2];
|
||||
|
||||
const idVec3& v1 = tempVerts[i0].ToVec3();
|
||||
const idVec3& v2 = tempVerts[i1].ToVec3();
|
||||
const idVec3& v3 = tempVerts[i2].ToVec3();
|
||||
|
||||
const byte triangleCulled = TriangleCulled_Generic( v1, v2, v3, lightProject );
|
||||
|
||||
byte triangleFacing = TriangleFacing_Generic( v1, v2, v3, lightOrigin );
|
||||
|
||||
// optionally make triangles that are outside the light frustum facing so they do not contribute to the shadow volume
|
||||
triangleFacing |= ( triangleCulled & cullShadowTrianglesToLightMask );
|
||||
|
||||
culled[j] = triangleCulled;
|
||||
facing[j] = triangleFacing;
|
||||
|
||||
// count the number of facing triangles
|
||||
numFrontFacing += ( triangleFacing & 1 );
|
||||
}
|
||||
|
||||
if( insideShadowVolume != NULL )
|
||||
{
|
||||
for( int k = batchStart, n = indexStart; k <= batchEnd - 3; k += 3, n++ )
|
||||
{
|
||||
if( !facing[n] )
|
||||
{
|
||||
const int i0 = indexesODS[k + 0];
|
||||
const int i1 = indexesODS[k + 1];
|
||||
const int i2 = indexesODS[k + 2];
|
||||
if( R_LineIntersectsTriangleExpandedWithSphere( lineStart, lineEnd, lineDir, lineLength, radius, tempVerts[i2].ToVec3(), tempVerts[i1].ToVec3(), tempVerts[i0].ToVec3() ) )
|
||||
{
|
||||
*insideShadowVolume = true;
|
||||
insideShadowVolume = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numFrontFacing;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -461,6 +684,7 @@ static void StreamOut( void* dst, const void* src, int numBytes )
|
|||
assert_16_byte_aligned( dst );
|
||||
assert_16_byte_aligned( src );
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
int i = 0;
|
||||
for( ; i + 128 <= numBytes; i += 128 )
|
||||
{
|
||||
|
@ -486,6 +710,9 @@ static void StreamOut( void* dst, const void* src, int numBytes )
|
|||
__m128i d = _mm_load_si128( ( __m128i* )( ( byte* )src + i ) );
|
||||
_mm_stream_si128( ( __m128i* )( ( byte* )dst + i ), d );
|
||||
}
|
||||
#else
|
||||
memcpy( dst, src, numBytes );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -706,7 +933,9 @@ static void R_CreateShadowVolumeTriangles( triIndex_t* __restrict shadowIndices,
|
|||
|
||||
numShadowIndexesTotal = numShadowIndices;
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
_mm_sfence();
|
||||
#endif
|
||||
|
||||
#else // NOTE: this code will not work on the SPU because it tries to write directly to the destination
|
||||
|
||||
|
@ -893,7 +1122,9 @@ void R_CreateLightTriangles( triIndex_t* __restrict lightIndices, triIndex_t* __
|
|||
|
||||
numLightIndicesTotal = numLightIndices;
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
_mm_sfence();
|
||||
#endif
|
||||
|
||||
#else // NOTE: this code will not work on the SPU because it tries to write directly to the destination
|
||||
|
||||
|
|
|
@ -729,6 +729,8 @@ public:
|
|||
virtual void EnableStereoScopicRendering( const stereo3DMode_t mode ) const;
|
||||
virtual int GetWidth() const;
|
||||
virtual int GetHeight() const;
|
||||
virtual int GetVirtualWidth() const;
|
||||
virtual int GetVirtualHeight() const;
|
||||
virtual float GetPixelAspect() const;
|
||||
virtual float GetPhysicalScreenWidthInCentimeters() const;
|
||||
virtual idRenderWorld* AllocRenderWorld();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -44,7 +45,7 @@ static void R_TracePointCullStatic( byte* cullBits, byte& totalOr, const float r
|
|||
assert_16_byte_aligned( cullBits );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_radius = _mm_splat_ps( _mm_load_ss( &radius ), 0 );
|
||||
|
@ -167,6 +168,56 @@ static void R_TracePointCullStatic( byte* cullBits, byte& totalOr, const float r
|
|||
|
||||
totalOr = ( byte ) _mm_cvtsi128_si32( vecTotalOrByte );
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
byte tOr = 0;
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3& v = vertsODS[i].xyz;
|
||||
|
||||
const float d0 = planes[0].Distance( v );
|
||||
const float d1 = planes[1].Distance( v );
|
||||
const float d2 = planes[2].Distance( v );
|
||||
const float d3 = planes[3].Distance( v );
|
||||
|
||||
const float t0 = d0 + radius;
|
||||
const float t1 = d1 + radius;
|
||||
const float t2 = d2 + radius;
|
||||
const float t3 = d3 + radius;
|
||||
|
||||
const float s0 = d0 - radius;
|
||||
const float s1 = d1 - radius;
|
||||
const float s2 = d2 - radius;
|
||||
const float s3 = d3 - radius;
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITSET( t0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t3 ) << 3;
|
||||
|
||||
bits |= IEEE_FLT_SIGNBITSET( s0 ) << 4;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s1 ) << 5;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s2 ) << 6;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s3 ) << 7;
|
||||
|
||||
bits ^= 0x0F; // flip lower four bits
|
||||
|
||||
tOr |= bits;
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
totalOr = tOr;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -179,7 +230,7 @@ static void R_TracePointCullSkinned( byte* cullBits, byte& totalOr, const float
|
|||
assert_16_byte_aligned( cullBits );
|
||||
assert_16_byte_aligned( verts );
|
||||
|
||||
|
||||
#if defined(USE_INTRINSICS)
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 4 > vertsODS( verts, numVerts );
|
||||
|
||||
const __m128 vector_float_radius = _mm_splat_ps( _mm_load_ss( &radius ), 0 );
|
||||
|
@ -302,6 +353,56 @@ static void R_TracePointCullSkinned( byte* cullBits, byte& totalOr, const float
|
|||
|
||||
totalOr = ( byte ) _mm_cvtsi128_si32( vecTotalOrByte );
|
||||
|
||||
#else
|
||||
|
||||
idODSStreamedArray< idDrawVert, 16, SBT_DOUBLE, 1 > vertsODS( verts, numVerts );
|
||||
|
||||
byte tOr = 0;
|
||||
for( int i = 0; i < numVerts; )
|
||||
{
|
||||
|
||||
const int nextNumVerts = vertsODS.FetchNextBatch() - 1;
|
||||
|
||||
for( ; i <= nextNumVerts; i++ )
|
||||
{
|
||||
const idVec3 v = Scalar_LoadSkinnedDrawVertPosition( vertsODS[i], joints );
|
||||
|
||||
const float d0 = planes[0].Distance( v );
|
||||
const float d1 = planes[1].Distance( v );
|
||||
const float d2 = planes[2].Distance( v );
|
||||
const float d3 = planes[3].Distance( v );
|
||||
|
||||
const float t0 = d0 + radius;
|
||||
const float t1 = d1 + radius;
|
||||
const float t2 = d2 + radius;
|
||||
const float t3 = d3 + radius;
|
||||
|
||||
const float s0 = d0 - radius;
|
||||
const float s1 = d1 - radius;
|
||||
const float s2 = d2 - radius;
|
||||
const float s3 = d3 - radius;
|
||||
|
||||
byte bits;
|
||||
bits = IEEE_FLT_SIGNBITSET( t0 ) << 0;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t1 ) << 1;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t2 ) << 2;
|
||||
bits |= IEEE_FLT_SIGNBITSET( t3 ) << 3;
|
||||
|
||||
bits |= IEEE_FLT_SIGNBITSET( s0 ) << 4;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s1 ) << 5;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s2 ) << 6;
|
||||
bits |= IEEE_FLT_SIGNBITSET( s3 ) << 7;
|
||||
|
||||
bits ^= 0x0F; // flip lower four bits
|
||||
|
||||
tOr |= bits;
|
||||
cullBits[i] = bits;
|
||||
}
|
||||
}
|
||||
|
||||
totalOr = tOr;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1722,10 +1722,12 @@ void R_TestDegenerateTextureSpace( srfTriangles_t* tri )
|
|||
const idDrawVert& b = tri->verts[tri->indexes[i + 1]];
|
||||
const idDrawVert& c = tri->verts[tri->indexes[i + 2]];
|
||||
|
||||
if( a.st == b.st || b.st == c.st || c.st == a.st )
|
||||
// RB: compare texcoords instead of pointers
|
||||
if( a.GetTexCoord() == b.GetTexCoord() || b.GetTexCoord() == c.GetTexCoord() || c.GetTexCoord() == a.GetTexCoord() )
|
||||
{
|
||||
c_degenerate++;
|
||||
}
|
||||
// RB end
|
||||
}
|
||||
|
||||
if( c_degenerate )
|
||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
#include "../snd_local.h"
|
||||
//#include "../../../doomclassic/doom/i_sound.h"
|
||||
#include "../../../doomclassic/doom/i_sound.h"
|
||||
|
||||
idCVar s_showLevelMeter( "s_showLevelMeter", "0", CVAR_BOOL | CVAR_ARCHIVE, "Show VU meter" );
|
||||
idCVar s_meterTopTime( "s_meterTopTime", "1000", CVAR_INTEGER | CVAR_ARCHIVE, "How long (in milliseconds) peaks are displayed on the VU meter" );
|
||||
|
@ -199,7 +199,7 @@ void idSoundHardware_OpenAL::Init()
|
|||
// ---------------------
|
||||
// Initialize the Doom classic sound system.
|
||||
// ---------------------
|
||||
//I_InitSoundHardware( outputChannels, channelMask );
|
||||
I_InitSoundHardware( voices.Max(), 0 );
|
||||
|
||||
// ---------------------
|
||||
// Create VU Meter Effect
|
||||
|
@ -278,6 +278,11 @@ void idSoundHardware_OpenAL::Shutdown()
|
|||
freeVoices.Clear();
|
||||
zombieVoices.Clear();
|
||||
|
||||
// ---------------------
|
||||
// Shutdown the Doom classic sound system.
|
||||
// ---------------------
|
||||
I_ShutdownSoundHardware();
|
||||
|
||||
alcMakeContextCurrent( NULL );
|
||||
|
||||
alcDestroyContext( openalContext );
|
||||
|
@ -286,12 +291,6 @@ void idSoundHardware_OpenAL::Shutdown()
|
|||
alcCloseDevice( openalDevice );
|
||||
openalDevice = NULL;
|
||||
|
||||
|
||||
// ---------------------
|
||||
// Shutdown the Doom classic sound system.
|
||||
// ---------------------
|
||||
//I_ShutdownSoundHardware();
|
||||
|
||||
/*
|
||||
if( vuMeterRMS != NULL )
|
||||
{
|
||||
|
|
|
@ -56,6 +56,13 @@ public:
|
|||
alSourcef( openalSource, AL_GAIN, ( gain ) < ( 1.0f ) ? ( gain ) : ( 1.0f ) );
|
||||
}
|
||||
|
||||
void SetPitch( float p )
|
||||
{
|
||||
idSoundVoice_Base::SetPitch( p );
|
||||
|
||||
alSourcef( openalSource, AL_PITCH, p );
|
||||
}
|
||||
|
||||
void Create( const idSoundSample* leadinSample, const idSoundSample* loopingSample );
|
||||
|
||||
// Start playing at a particular point in the buffer. Does an Update() too
|
||||
|
|
|
@ -54,16 +54,18 @@ public:
|
|||
{
|
||||
gain = g;
|
||||
}
|
||||
|
||||
virtual void SetPitch( float p )
|
||||
{
|
||||
pitch = p;
|
||||
}
|
||||
// RB end
|
||||
|
||||
void SetCenterChannel( float c )
|
||||
{
|
||||
centerChannel = c;
|
||||
}
|
||||
void SetPitch( float p )
|
||||
{
|
||||
pitch = p;
|
||||
}
|
||||
|
||||
void SetInnerRadius( float r )
|
||||
{
|
||||
innerRadius = r;
|
||||
|
|
|
@ -389,6 +389,9 @@ private:
|
|||
bool LoadSWF( const char* fullpath );
|
||||
bool LoadBinary( const char* bfilename, ID_TIME_T sourceTime );
|
||||
void WriteBinary( const char* bfilename );
|
||||
void FileAttributes( idSWFBitStream& bitstream );
|
||||
void Metadata( idSWFBitStream& bitstream );
|
||||
void SetBackgroundColor( idSWFBitStream& bitstream );
|
||||
|
||||
//----------------------------------
|
||||
// SWF_Shapes.cpp
|
||||
|
|
|
@ -152,7 +152,7 @@ bool idSWF::LoadBinary( const char* bfilename, ID_TIME_T sourceTime )
|
|||
f->ReadBig( magic );
|
||||
f->ReadBig( btimestamp );
|
||||
|
||||
if( magic != BSWF_MAGIC || ( !fileSystem->InProductionMode() && sourceTime != btimestamp ) )
|
||||
if( magic != BSWF_MAGIC || ( com_productionMode.GetInteger() == 0 && sourceTime != FILE_NOT_FOUND_TIMESTAMP && sourceTime != btimestamp ) )
|
||||
{
|
||||
delete f;
|
||||
return false;
|
||||
|
@ -526,3 +526,34 @@ void idSWF::WriteBinary( const char* bfilename )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
idSWF::FileAttributes
|
||||
Extra data that won't fit in a SWF header
|
||||
===================
|
||||
*/
|
||||
void idSWF::FileAttributes( idSWFBitStream& bitstream )
|
||||
{
|
||||
bitstream.Seek( 5 ); // 5 booleans
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
idSWF::Metadata
|
||||
===================
|
||||
*/
|
||||
void idSWF::Metadata( idSWFBitStream& bitstream )
|
||||
{
|
||||
bitstream.ReadString(); // XML string
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
idSWF::SetBackgroundColor
|
||||
===================
|
||||
*/
|
||||
void idSWF::SetBackgroundColor( idSWFBitStream& bitstream )
|
||||
{
|
||||
bitstream.Seek( 4 ); // int
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ void idSWF::Render( idRenderSystem* gui, int time, bool isSplitscreen )
|
|||
|
||||
renderBorder = renderState.matrix.tx / scale;
|
||||
|
||||
scaleToVirtual.Set( ( float )SCREEN_WIDTH / sysWidth, ( float )SCREEN_HEIGHT / sysHeight );
|
||||
scaleToVirtual.Set( ( float )renderSystem->GetVirtualWidth() / sysWidth, ( float )renderSystem->GetVirtualHeight() / sysHeight );
|
||||
|
||||
RenderSprite( gui, mainspriteInstance, renderState, time, isSplitscreen );
|
||||
|
||||
|
|
|
@ -105,6 +105,9 @@ void idSWFSprite::Load( idSWFBitStream& bitstream, bool parseDictionary )
|
|||
switch( tag )
|
||||
{
|
||||
#define HANDLE_SWF_TAG( x ) case Tag_##x: swf->x( tagStream ); break;
|
||||
HANDLE_SWF_TAG( FileAttributes );
|
||||
HANDLE_SWF_TAG( Metadata );
|
||||
HANDLE_SWF_TAG( SetBackgroundColor );
|
||||
HANDLE_SWF_TAG( JPEGTables );
|
||||
HANDLE_SWF_TAG( DefineBits );
|
||||
HANDLE_SWF_TAG( DefineBitsJPEG2 );
|
||||
|
|
|
@ -887,7 +887,13 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
if( key == 0 )
|
||||
{
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
// SDL2 has no ev.key.keysym.unicode anymore.. but the scancode should work well enough for console
|
||||
if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open?
|
||||
common->Warning( "unmapped SDL key %d scancode %d", ev.key.keysym.sym, ev.key.keysym.scancode );
|
||||
|
||||
return res_none;
|
||||
#else
|
||||
unsigned char uc = ev.key.keysym.unicode & 0xff;
|
||||
// check if its an unmapped console key
|
||||
if( uc == Sys_GetConsoleKey( false ) || uc == Sys_GetConsoleKey( true ) )
|
||||
|
@ -901,6 +907,7 @@ sysEvent_t Sys_GetEvent()
|
|||
common->Warning( "unmapped SDL key %d (0x%x) scancode %d", ev.key.keysym.sym, ev.key.keysym.unicode, ev.key.keysym.scancode );
|
||||
return res_none;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue