1
0
Fork 0
forked from len0rd/rockbox

sdl: Remove platform-specific code

Also nuke the Makefiles of Duke Nukem 3D (pun intended).

Change-Id: If2707cf079bfb9299347f9c5f980780134b6ecda
This commit is contained in:
Vencislav Atanasov 2019-07-28 23:31:50 +03:00
parent e19857e712
commit 183e45e8d0
No known key found for this signature in database
GPG key ID: 4B991E20465BE1F1
49 changed files with 53 additions and 2191 deletions

View file

@ -884,16 +884,10 @@ void CL_ParseServerMessage (void)
if (cl.paused)
{
CDAudio_Pause ();
#ifdef _WIN32
VID_HandlePause (true);
#endif
}
else
{
CDAudio_Resume ();
#ifdef _WIN32
VID_HandlePause (false);
#endif
}
}
break;

View file

@ -1508,14 +1508,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file)
strcpy (cachepath, netpath);
else
{
#if defined(_WIN32)
if ((strlen(netpath) < 2) || (netpath[1] != ':'))
sprintf (cachepath,"%s%s", com_cachedir, netpath);
else
sprintf (cachepath,"%s%s", com_cachedir, netpath+2);
#else
sprintf (cachepath,"%s/%s", com_cachedir, netpath);
#endif
cachetime = Sys_FileTime (cachepath);

View file

@ -896,32 +896,22 @@ void Host_Init (quakeparms_t *parms)
if (!host_colormap)
Sys_Error ("Couldn't load gfx/colormap.lmp");
#ifndef _WIN32 // on non win32, mouse comes before video for security reasons
IN_Init ();
#endif
VID_Init (host_basepal);
Draw_Init ();
SCR_Init ();
R_Init ();
#ifndef _WIN32
// on Win32, sound initialization has to come before video initialization, so we
// can put up a popup if the sound hardware is in use
S_Init ();
#else
#ifdef GLQUAKE
// FIXME: doesn't use the new one-window approach yet
S_Init ();
#endif
#endif // _WIN32
CDAudio_Init ();
Sbar_Init ();
CL_Init ();
#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
IN_Init ();
#endif
}
Cbuf_InsertText ("exec quake.rc\n");

View file

@ -85,10 +85,6 @@ void PerpendicularVector( vec3_t dst, const vec3_t src )
VectorNormalizeNoRet( dst );
}
#ifdef _WIN32
#pragma optimize( "", off )
#endif
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees )
{
@ -145,10 +141,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
}
}
#ifdef _WIN32
#pragma optimize( "", on )
#endif
/*-----------------------------------------------------------------*/

View file

@ -19,10 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#ifdef _WIN32
#include "winquake.h"
#endif
void (*vid_menudrawfn)(void);
void (*vid_menukeyfn)(int key);
@ -913,11 +909,7 @@ void M_Net_Draw (void)
}
else
{
#ifdef _WIN32
p = NULL;
#else
p = Draw_CachePic ("gfx/dim_modm.lmp");
#endif
}
if (p)
@ -931,11 +923,7 @@ void M_Net_Draw (void)
}
else
{
#ifdef _WIN32
p = NULL;
#else
p = Draw_CachePic ("gfx/dim_drct.lmp");
#endif
}
if (p)
@ -1036,12 +1024,7 @@ again:
//=============================================================================
/* OPTIONS MENU */
#ifdef _WIN32
#define OPTIONS_ITEMS 14
#else
#define OPTIONS_ITEMS 13
#endif
#define SLIDER_RANGE 10
int options_cursor;
@ -1051,13 +1034,6 @@ void M_Menu_Options_f (void)
key_dest = key_menu;
m_state = m_options;
m_entersound = true;
#ifdef _WIN32
if ((options_cursor == 13) && (modestate != MS_WINDOWED))
{
options_cursor = 0;
}
#endif
}
@ -1092,11 +1068,7 @@ void M_AdjustSliders (int dir)
Cvar_SetValue ("sensitivity", sensitivity.value);
break;
case 6: // music volume
#ifdef _WIN32
bgmvolume.value += dir * 1.0;
#else
bgmvolume.value += dir * 0.1;
#endif
if (bgmvolume.value < 0)
bgmvolume.value = 0;
if (bgmvolume.value > 1)
@ -1136,12 +1108,6 @@ void M_AdjustSliders (int dir)
case 11: // lookstrafe
Cvar_SetValue ("lookstrafe", !lookstrafe.value);
break;
#ifdef _WIN32
case 13: // _windowed_mouse
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
break;
#endif
}
}
@ -1223,14 +1189,6 @@ void M_Options_Draw (void)
if (vid_menudrawfn)
M_Print (16, 128, " Video Options");
#ifdef _WIN32
if (modestate == MS_WINDOWED)
{
M_Print (16, 136, " Use Mouse");
M_DrawCheckbox (220, 136, _windowed_mouse.value);
}
#endif
// cursor
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
}
@ -1297,16 +1255,6 @@ void M_Options_Key (int k)
else
options_cursor = 0;
}
#ifdef _WIN32
if ((options_cursor == 13) && (modestate != MS_WINDOWED))
{
if (k == K_UPARROW)
options_cursor = 12;
else
options_cursor = 0;
}
#endif
}
//=============================================================================
@ -1582,7 +1530,6 @@ int msgNumber;
int m_quit_prevstate;
qboolean wasInMenus;
#ifndef _WIN32
char *quitMessage [] =
{
/* .........1.........2.... */
@ -1626,7 +1573,6 @@ char *quitMessage [] =
" for you next time! ",
" "
};
#endif
void M_Menu_Quit_f (void)
{
@ -1684,36 +1630,11 @@ void M_Quit_Draw (void)
m_state = m_quit;
}
#ifdef _WIN32
M_DrawTextBox (0, 0, 38, 23);
M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n");
M_PrintWhite (16, 28, "Programming Art \n");
M_Print (16, 36, " John Carmack Adrian Carmack\n");
M_Print (16, 44, " Michael Abrash Kevin Cloud\n");
M_Print (16, 52, " John Cash Paul Steed\n");
M_Print (16, 60, " Dave 'Zoid' Kirsch\n");
M_PrintWhite (16, 68, "Design Biz\n");
M_Print (16, 76, " John Romero Jay Wilbur\n");
M_Print (16, 84, " Sandy Petersen Mike Wilson\n");
M_Print (16, 92, " American McGee Donna Jackson\n");
M_Print (16, 100, " Tim Willits Todd Hollenshead\n");
M_PrintWhite (16, 108, "Support Projects\n");
M_Print (16, 116, " Barrett Alexander Shawn Green\n");
M_PrintWhite (16, 124, "Sound Effects\n");
M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n");
M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n");
M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n");
M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n");
M_PrintWhite (16, 164, "registered trademark licensed to\n");
M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n");
M_PrintWhite (16, 180, "reserved. Press y to exit\n");
#else
M_DrawTextBox (56, 76, 24, 4);
M_Print (64, 84, quitMessage[msgNumber*4+0]);
M_Print (64, 92, quitMessage[msgNumber*4+1]);
M_Print (64, 100, quitMessage[msgNumber*4+2]);
M_Print (64, 108, quitMessage[msgNumber*4+3]);
#endif
}
//=============================================================================

View file

@ -238,7 +238,7 @@ typedef struct
extern int hostCacheCount;
extern hostcache_t hostcache[HOSTCACHESIZE];
#if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__)
#if !defined (__linux__) && !defined (__sun__)
#ifndef htonl
extern unsigned long htonl (unsigned long hostlong);
#endif

View file

@ -23,9 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BAN_TEST
#ifdef BAN_TEST
#if defined(_WIN32)
#include <windows.h>
#elif defined (NeXT)
#if defined (NeXT)
#include <sys/socket.h>
#include <arpa/inet.h>
#else

View file

@ -23,14 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define GLQUAKE 1
#if defined(_WIN32) && !defined(WINDED)
#if defined(_M_IX86)
#define __i386__ 1
#endif
#endif
#if defined(__i386__) && defined(USE_ASM)
#define id386 1
#else

View file

@ -43,22 +43,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GAMENAME "id1"
#endif
#if defined(_WIN32) && !defined(WINDED)
#if defined(_M_IX86)
#define __i386__ 1
#endif
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
#else
#define VID_LockBuffer()
#define VID_UnlockBuffer()
#endif
#if defined(__i386__) && defined(USE_ASM)
#define id386 1
#else

View file

@ -21,10 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#ifdef _WIN32
#include "winquake.h"
#endif
void S_Play(void);
void S_PlayVol(void);
void S_SoundList(void);
@ -148,9 +144,7 @@ void S_Startup (void)
if (!rc)
{
#ifndef _WIN32
Con_Printf("S_Startup: SNDDMA_Init failed.\n");
#endif
sound_started = 0;
return;
}
@ -561,11 +555,7 @@ void S_ClearBuffer (void)
{
int clear;
#ifdef _WIN32
if (!sound_started || !shm || (!shm->buffer && !pDSBuf))
#else
if (!sound_started || !shm || !shm->buffer)
#endif
return;
if (shm->samplebits == 8)
@ -573,43 +563,7 @@ void S_ClearBuffer (void)
else
clear = 0;
#ifdef _WIN32
if (pDSBuf)
{
DWORD dwSize;
DWORD *pData;
int reps;
HRESULT hresult;
reps = 0;
while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pData, &dwSize, NULL, NULL, 0)) != DS_OK)
{
if (hresult != DSERR_BUFFERLOST)
{
Con_Printf ("S_ClearBuffer: DS::Lock Sound Buffer Failed\n");
S_Shutdown ();
return;
}
if (++reps > 10000)
{
Con_Printf ("S_ClearBuffer: DS: couldn't restore buffer\n");
S_Shutdown ();
return;
}
}
Q_memset(pData, clear, shm->samples * shm->samplebits/8);
pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0);
}
else
#endif
{
Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8);
}
Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8);
}
@ -844,11 +798,6 @@ void GetSoundtime(void)
void S_ExtraUpdate (void)
{
#ifdef _WIN32
IN_Accumulate ();
#endif
if (snd_noextraupdate.value)
return; // don't pollute timings
S_Update_();
@ -880,25 +829,6 @@ void S_Update_(void)
if (endtime - soundtime > samps)
endtime = soundtime + samps;
#ifdef _WIN32
// if the buffer was lost or stopped, restore it and/or restart it
{
DWORD dwStatus;
if (pDSBuf)
{
if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK)
Con_Printf ("Couldn't get sound buffer status\n");
if (dwStatus & DSBSTATUS_BUFFERLOST)
pDSBuf->lpVtbl->Restore (pDSBuf);
if (!(dwStatus & DSBSTATUS_PLAYING))
pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);
}
}
#endif
S_PaintChannels (endtime);
SNDDMA_Submit ();

View file

@ -79,7 +79,3 @@ void VID_Update (vrect_t *rects);
int VID_SetMode (int modenum, unsigned char *palette);
// sets the mode; only used by the Quake engine for resetting to mode 0 (the
// base mode) on memory allocation failures
void VID_HandlePause (qboolean pause);
// called only on Win32, when pause happens, so the mouse can be released

View file

@ -1,115 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// winquake.h: Win32-specific Quake header file
#pragma warning( disable : 4229 ) // mgraph gets this
#include <windows.h>
#define WM_MOUSEWHEEL 0x020A
#ifndef SERVERONLY
#include <ddraw.h>
#include <dsound.h>
#ifndef GLQUAKE
#include <mgraph.h>
#endif
#endif
extern HINSTANCE global_hInstance;
extern int global_nCmdShow;
#ifndef SERVERONLY
extern LPDIRECTDRAW lpDD;
extern qboolean DDActive;
extern LPDIRECTDRAWSURFACE lpPrimary;
extern LPDIRECTDRAWSURFACE lpFrontBuffer;
extern LPDIRECTDRAWSURFACE lpBackBuffer;
extern LPDIRECTDRAWPALETTE lpDDPal;
extern LPDIRECTSOUND pDS;
extern LPDIRECTSOUNDBUFFER pDSBuf;
extern DWORD gSndBufSize;
//#define SNDBUFSIZE 65536
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
#endif
typedef int modestate_t;
enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT};
extern modestate_t modestate;
extern HWND mainwindow;
extern qboolean ActiveApp, Minimized;
extern qboolean WinNT;
int VID_ForceUnlockedAndReturnState (void);
void VID_ForceLockState (int lk);
void IN_ShowMouse (void);
void IN_DeactivateMouse (void);
void IN_HideMouse (void);
void IN_ActivateMouse (void);
void IN_RestoreOriginalMouseState (void);
void IN_SetQuakeMouseState (void);
void IN_MouseEvent (int mstate);
extern qboolean winsock_lib_initialized;
extern cvar_t _windowed_mouse;
extern int window_center_x, window_center_y;
extern RECT window_rect;
extern qboolean mouseinitialized;
extern HWND hwnd_dialog;
extern HANDLE hinput, houtput;
void IN_UpdateClipCursor (void);
void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify);
void S_BlockSound (void);
void S_UnblockSound (void);
void VID_SetDefaultMode (void);
int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
int (PASCAL FAR *pWSACleanup)(void);
int (PASCAL FAR *pWSAGetLastError)(void);
SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol);
int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname,
const char FAR * optval, int optlen);
int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags,
struct sockaddr FAR *from, int FAR * fromlen);
int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags,
const struct sockaddr FAR *to, int tolen);
int (PASCAL FAR *pclosesocket)(SOCKET s);
int (PASCAL FAR *pgethostname)(char FAR * name, int namelen);
struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name);
struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr,
int len, int type);
int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name,
int FAR * namelen);