Fixed all compilation errors

This commit is contained in:
L 2023-05-08 00:02:31 +02:00
parent 26944dcf4a
commit 5a87b21efc
18 changed files with 69 additions and 3019 deletions

View file

@ -216,11 +216,11 @@ if (WITH_CLIENT)
INSTALL(TARGETS cgame DESTINATION "${TARGET_BASE_GAME}")
### Executable
file(GLOB_RECURSE SOURCES_CLIENT "code/client/*.c" "code/client/*.cpp")
file(GLOB_RECURSE SOURCES_CLIENT "code/client/*.c" "code/client/*.cpp" "code/qcommon/puff.c")
file(GLOB_RECURSE SOURCES_UILIB "code/uilib/*.c" "code/uilib/*.cpp")
file(GLOB_RECURSE SOURCES_LIBS "code/sdl/*.c")
file(GLOB_RECURSE SOURCES_RENDERER "code/renderercommon/*.c" "code/renderergl2/*.c" "code/renderergl2/*.cpp")
set(SOURCES_CLIENT_APP ${SOURCES_APP} ${SOURCES_SERVER} ${SOURCES_CLIENT} ${SOURCES_UILIB} ${SOURCES_LIBS})
file(GLOB_RECURSE SOURCES_RENDERER "code/renderercommon/*.c" "code/renderergl2/*.c" "code/renderergl2/*.cpp" "code/jpeg-8c/*.c")
set(SOURCES_CLIENT_APP ${SOURCES_APP} ${SOURCES_SERVER} ${SOURCES_CLIENT} ${SOURCES_UILIB} ${SOURCES_LIBS} ${SOURCES_RENDERER})
add_executable(openmohaa ${SOURCES_CLIENT_APP} ${SOURCES_PLATFORM_SPECIFIC})
target_compile_definitions(openmohaa PRIVATE NO_SCRIPTENGINE APP_MODULE TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
@ -241,7 +241,17 @@ if (WITH_CLIENT)
IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/code/libs/win32/SDL2.lib"
)
target_link_libraries(openmohaa PRIVATE sdl2)
add_library(sdl2main SHARED IMPORTED)
set_target_properties(sdl2main PROPERTIES
IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/code/libs/win32/SDL2main.lib"
)
add_library(glew32 SHARED IMPORTED)
set_target_properties(glew32 PROPERTIES
IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/code/libs/win32/glew32.lib"
)
target_link_libraries(openmohaa PRIVATE sdl2 sdl2main glew32 opengl32)
endif()
target_link_libraries(openmohaa PRIVATE wsock32 ws2_32)

View file

@ -352,31 +352,6 @@ rescan:
Com_Error( ERR_SERVERDISCONNECT, "Server disconnected\n" );
}
if ( !strcmp( cmd, "bcs0" ) ) {
Com_sprintf( bigConfigString, BIG_INFO_STRING, "cs %s \"%s", Cmd_Argv(1), Cmd_Argv(2) );
return qfalse;
}
if ( !strcmp( cmd, "bcs1" ) ) {
s = Cmd_Argv(2);
if( strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING ) {
Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );
}
strcat( bigConfigString, s );
return qfalse;
}
if ( !strcmp( cmd, "bcs2" ) ) {
s = Cmd_Argv(2);
if( strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING ) {
Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );
}
strcat( bigConfigString, s );
strcat( bigConfigString, "\"" );
s = bigConfigString;
goto rescan;
}
if ( !strcmp( cmd, "cs" ) ) {
CL_ConfigstringModified();
// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
@ -384,33 +359,6 @@ rescan:
return qtrue;
}
if ( !strcmp( cmd, "map_restart" ) ) {
// clear notify lines and outgoing commands before passing
// the restart to the cgame
Con_ClearNotify();
Com_Memset( cl.cmds, 0, sizeof( cl.cmds ) );
return qtrue;
}
// the clientLevelShot command is used during development
// to generate 128*128 screenshots from the intermission
// point of levels for the menu system to use
// we pass it along to the cgame to make apropriate adjustments,
// but we also clear the console and notify lines here
if ( !strcmp( cmd, "clientLevelShot" ) ) {
// don't do it if we aren't running the server locally,
// otherwise malicious remote servers could overwrite
// the existing thumbnails
if ( !com_sv_running->integer ) {
return qfalse;
}
// close the console
Con_Close();
// take a special screenshot next frame
Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot\n" );
return qtrue;
}
// we may want to put a "connect to other server" command here
// cgame can now act on the command
@ -829,9 +777,6 @@ void CL_InitCGame( void ) {
t1 = Sys_Milliseconds();
// put away the console
Con_Close();
// find the current mapname
info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ];
mapname = Info_ValueForKey( info, "mapname" );
@ -870,9 +815,6 @@ void CL_InitCGame( void ) {
t2 = Sys_Milliseconds();
// clear anything that got printed
Con_ClearNotify();
Com_Printf( "CL_InitCGame: %5.2f seconds\n", ( t2 - t1 ) / 1000.0 );
}

View file

@ -133,7 +133,7 @@ static cin_cache cinTable[MAX_VIDEO_HANDLES];
static int currentHandle = -1;
static int CL_handle = -1;
extern int s_soundtime; // sample PAIRS
extern "C" int s_soundtime; // sample PAIRS
void CIN_CloseAllVideos(void) {
@ -1467,8 +1467,6 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
if (cinTable[currentHandle].alterGameState) {
cls.state = CA_CINEMATIC;
}
Con_Close();
if (!cinTable[currentHandle].silent) {
s_rawend[0] = s_soundtime;

View file

@ -578,154 +578,6 @@ void Field_CharEvent( field_t *edit, int ch ) {
}
}
/*
=============================================================================
CONSOLE LINE EDITING
==============================================================================
*/
/*
====================
Console_Key
Handles history and console scrollback
====================
*/
void Console_Key (int key) {
// ctrl-L clears screen
if ( key == 'l' && keys[K_CTRL].down ) {
Cbuf_AddText ("clear\n");
return;
}
// enter finishes the line
if ( key == K_ENTER || key == K_KP_ENTER ) {
// if not in the game explicitly prepend a slash if needed
if ( cls.state != CA_ACTIVE && g_consoleField.buffer[0] != '\\'
&& g_consoleField.buffer[0] != '/' ) {
char temp[MAX_EDIT_LINE-1];
Q_strncpyz( temp, g_consoleField.buffer, sizeof( temp ) );
Com_sprintf( g_consoleField.buffer, sizeof( g_consoleField.buffer ), "\\%s", temp );
g_consoleField.cursor++;
}
Com_Printf ( "]%s\n", g_consoleField.buffer );
// leading slash is an explicit command
if ( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' ) {
Cbuf_AddText( g_consoleField.buffer+1 ); // valid command
Cbuf_AddText ("\n");
} else {
// other text will be chat messages
if ( !g_consoleField.buffer[0] ) {
return; // empty lines just scroll the console without adding to history
} else {
Cbuf_AddText ("cmd say ");
Cbuf_AddText( g_consoleField.buffer );
Cbuf_AddText ("\n");
}
}
// copy line to history buffer
historyEditLines[nextHistoryLine % COMMAND_HISTORY] = g_consoleField;
nextHistoryLine++;
historyLine = nextHistoryLine;
Field_Clear( &g_consoleField );
g_consoleField.widthInChars = g_console_field_width;
CL_SaveConsoleHistory( );
if ( cls.state == CA_DISCONNECTED ) {
SCR_UpdateScreen (); // force an update, because the command
} // may take some time
return;
}
// command completion
if (key == K_TAB) {
Field_AutoComplete(&g_consoleField);
return;
}
// command history (ctrl-p ctrl-n for unix style)
if ( (key == K_MWHEELUP && keys[K_SHIFT].down) || ( key == K_UPARROW ) || ( key == K_KP_UPARROW ) ||
( ( tolower(key) == 'p' ) && keys[K_CTRL].down ) ) {
if ( nextHistoryLine - historyLine < COMMAND_HISTORY
&& historyLine > 0 ) {
historyLine--;
}
g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
return;
}
if ( (key == K_MWHEELDOWN && keys[K_SHIFT].down) || ( key == K_DOWNARROW ) || ( key == K_KP_DOWNARROW ) ||
( ( tolower(key) == 'n' ) && keys[K_CTRL].down ) ) {
historyLine++;
if (historyLine >= nextHistoryLine) {
historyLine = nextHistoryLine;
Field_Clear( &g_consoleField );
g_consoleField.widthInChars = g_console_field_width;
return;
}
g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
return;
}
// console scrolling
if ( key == K_PGUP ) {
Con_PageUp();
return;
}
if ( key == K_PGDN) {
Con_PageDown();
return;
}
if ( key == K_MWHEELUP) { //----(SA) added some mousewheel functionality to the console
Con_PageUp();
if(keys[K_CTRL].down) { // hold <ctrl> to accelerate scrolling
Con_PageUp();
Con_PageUp();
}
return;
}
if ( key == K_MWHEELDOWN) { //----(SA) added some mousewheel functionality to the console
Con_PageDown();
if(keys[K_CTRL].down) { // hold <ctrl> to accelerate scrolling
Con_PageDown();
Con_PageDown();
}
return;
}
// ctrl-home = top of console
if ( key == K_HOME && keys[K_CTRL].down ) {
Con_Top();
return;
}
// ctrl-end = bottom of console
if ( key == K_END && keys[K_CTRL].down ) {
Con_Bottom();
return;
}
// pass to the normal editline routine
Field_KeyDownEvent( &g_consoleField, key );
}
//============================================================================
/*
================
Message_Key

View file

@ -98,6 +98,17 @@ cvar_t *cl_r_fullscreen;
cvar_t *cl_consoleKeys;
cvar_t* j_pitch;
cvar_t* j_yaw;
cvar_t* j_forward;
cvar_t* j_side;
cvar_t* j_up;
cvar_t* j_pitch_axis;
cvar_t* j_yaw_axis;
cvar_t* j_forward_axis;
cvar_t* j_side_axis;
cvar_t* j_up_axis;
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@ -677,7 +688,7 @@ void CL_PlayDemo_f( void ) {
}
Q_strncpyz( clc.demoName, Cmd_Argv(1), sizeof( clc.demoName ) );
Con_Close();
UI_CloseConsole();
cls.state = CA_CONNECTED;
clc.demoplaying = qtrue;
@ -801,7 +812,7 @@ void CL_MapLoading( qboolean flush, const char *pszMapName ) {
return;
}
Con_Close();
UI_ClearState();
Key_SetCatcher( 0 );
// if we are already connected to the local host, stay connected
@ -1207,7 +1218,7 @@ void CL_Connect( const char *server ) {
SV_Frame( 0 );
CL_Disconnect( qtrue );
Con_Close();
UI_CloseConsole();
/* MrE: 2000-09-13: now called in CL_DownloadsComplete
CL_FlushMemory( );
@ -2348,7 +2359,6 @@ void CL_Frame ( int msec ) {
cls.realtime += cls.frametime;
SCR_UpdateScreen();
S_Update();
Con_RunConsole();
cls.framecount++;
return;
}
@ -2463,8 +2473,6 @@ void CL_Frame ( int msec ) {
// advance local effects for next frame
SCR_RunCinematic();
Con_RunConsole();
cls.framecount++;
}
@ -2530,27 +2538,6 @@ void CL_ShutdownRef( void ) {
#endif
}
/*
============
CL_InitRenderer
============
*/
void CL_InitRenderer( void ) {
// this sets up the renderer and calls R_Init
re.BeginRegistration( &cls.glconfig );
// load character sets
cls.charSetShader = re.RegisterShader( "gfx/2d/bigchars" );
cls.whiteShader = re.RegisterShader( "*white" );
// cls.consoleShader = re.RegisterShader( "console" );
re.RegisterFont("courier-16", 0, &cls.consoleFont);
g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
g_consoleField.widthInChars = g_console_field_width;
// IneQuation
g_console_charWidth = re.Text_Width(&cls.consoleFont, "=", 0, qfalse);
g_console_charHeight = re.Text_Height(&cls.consoleFont, "|", 0, qfalse);
}
/*
============================
CL_StartHunkUsers
@ -3045,8 +3032,6 @@ void CL_Init( void ) {
start = Sys_Milliseconds();
Con_Init ();
CL_ClearState ();
S_StopAllSounds( qtrue );

View file

@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// cl_parse.c -- parse a message received from the server
#include "client.h"
#include "cl_ui.h"
char *svc_strings[256] = {
"svc_bad",
@ -458,7 +459,7 @@ void CL_ParseGamestate( msg_t *msg ) {
int cmd;
char *s;
Con_Close();
UI_CloseConsole();
clc.connectPacketCount = 0;

View file

@ -3823,7 +3823,6 @@ CL_BeginRegistration
void CL_BeginRegistration( void )
{
// init console stuff
CL_InitRenderer();
re.BeginRegistration( &cls.glconfig );
uWinMan.CleanupShadersFromList();
}

View file

@ -46,7 +46,7 @@ extern bind_t client_bind;
const char *CvarGetForUI( const char *name, const char *defval );
void UI_ClearState( void );
void CL_BeginRegistration( void );
void CL_EndRegistration( void );
void CL_EndRegistration(void);
//
// menu
@ -107,6 +107,7 @@ void UI_CloseDMConsole( void );
void UI_ToggleDMConsole( int iMode );
void UI_OpenDeveloperConsole( void );
void UI_CloseDeveloperConsole( void );
void UI_PrintConsole(const char* msg);
//
// callbacks

View file

@ -574,7 +574,6 @@ void Con_PageUp( void );
void Con_PageDown( void );
void Con_Top( void );
void Con_Bottom( void );
void Con_Close( void );
void CL_LoadConsoleHistory( void );
void CL_SaveConsoleHistory( void );

View file

@ -26,6 +26,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/qcommon.h"
#include "snd_public.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define PAINTBUFFER_SIZE 4096 // this is in samples
#define SND_CHUNK_SIZE 1024 // samples
@ -269,3 +276,7 @@ qboolean S_AL_Init( soundInterface_t *si );
#ifdef idppc_altivec
void S_PaintChannelFrom16_altivec( portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE], int snd_vol, channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset );
#endif
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <tiki.h>
qboolean CL_FinishedIntro(void);
void UI_PrintConsole(const char* msg);
extern "C" {
cvar_t *sv_scriptfiles;
@ -115,7 +118,7 @@ qboolean com_fullyInitialized;
char com_errorMessage[MAXPRINTMSG];
void Com_WriteConfig_f( void );
void CIN_CloseAllVideos( void );
void CIN_CloseAllVideos(void);
//============================================================================
@ -180,7 +183,9 @@ void QDECL Com_Printf( const char *fmt, ... ) {
}
#ifndef DEDICATED
CL_ConsolePrint( msg );
if (com_dedicated && !com_dedicated->integer) {
UI_PrintConsole(msg);
}
#endif
// echo to dedicated console and early console
@ -1581,8 +1586,6 @@ int Com_ModifyMsec( int msec ) {
return msec;
}
qboolean CL_FinishedIntro( void );
/*
=================
Com_Frame
@ -1644,10 +1647,12 @@ void Com_Frame( void ) {
msec = com_frameTime - lastTime;
} while ( msec < minMsec );
#ifndef DEDICATED
if( com_dedicated->integer || CL_FinishedIntro() )
{
Cbuf_Execute( 0 );
}
#endif
lastTime = com_frameTime;

View file

@ -1031,8 +1031,6 @@ void CL_JoystickEvent( int axis, int value, int time );
void CL_PacketEvent( netadr_t from, msg_t *msg );
void CL_ConsolePrint( char *text );
void CL_MapLoading( qboolean flush, const char *pszMapName );
// do a screen update before starting to load a map
// when the server is going to load a new map, the entire hunk
@ -1053,9 +1051,6 @@ void CL_ShutdownAll( void );
void CL_FlushMemory( void );
// dump all memory on an error
// console stuff
void CL_InitRenderer( void );
void CL_StartHunkUsers( void );
// start all the client stuff using the hunk

View file

@ -335,4 +335,10 @@ extern int qglesMajorVersion, qglesMinorVersion;
#define QGL_VERSION_ATLEAST( major, minor ) ( qglMajorVersion > major || ( qglMajorVersion == major && qglMinorVersion >= minor ) )
#define QGLES_VERSION_ATLEAST( major, minor ) ( qglesMajorVersion > major || ( qglesMajorVersion == major && qglesMinorVersion >= minor ) )
#define qglCopyTexImage2D glCopyTexImage2D
#define qglColor4fv glColor4fv
#define qglLineStipple glLineStipple
#define qglVertex2i glVertex2i
#define qglReadBuffer glReadBuffer
#endif

View file

@ -28,6 +28,7 @@ glRefConfig_t glRefConfig;
qboolean textureFilterAnisotropic = qfalse;
int maxAnisotropy = 0;
float displayAspect = 0.0f;
qboolean haveClampToEdge = qfalse;
glstate_t glState;
@ -1639,8 +1640,13 @@ void RE_Shutdown( qboolean destroyWindow ) {
if ( destroyWindow ) {
GLimp_Shutdown();
Com_Memset( &glConfig, 0, sizeof( glConfig ) );
Com_Memset( &glState, 0, sizeof( glState ) );
Com_Memset(&glConfig, 0, sizeof(glConfig));
textureFilterAnisotropic = qfalse;
maxAnisotropy = 0;
displayAspect = 0.0f;
haveClampToEdge = qfalse;
Com_Memset(&glState, 0, sizeof(glState));
}
tr.registered = qfalse;

View file

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// tr_models.c -- model loading and caching
#include "tr_local.h"
#include "../renderercommon/qgl.h"
#include <vector.h>
#define LL(x) x=LittleLong(x)

View file

@ -264,7 +264,7 @@ void Sys_InitPIDFile( const char *gamedir ) {
char message[1024];
char modName[MAX_OSPATH];
FS_GetModDescription( gamedir, modName, sizeof ( modName ) );
//FS_GetModDescription( gamedir, modName, sizeof ( modName ) );
Q_CleanStr( modName );
Com_sprintf( message, sizeof (message), "The last time %s ran, "

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "q_shared.h"
#include "qcommon.h"
#include "../skeletor/skeletor.h"
#include "tiki_commands.h"
/*
===============