2007-06-21 22:00:00 +02:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2007 <20>
|
|
|
|
|
// engine.h - engine.dll main header
|
|
|
|
|
//=======================================================================
|
|
|
|
|
#ifndef ENGINE_H
|
|
|
|
|
#define ENGINE_H
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <direct.h>
|
2007-11-14 22:00:00 +01:00
|
|
|
|
#include <windows.h>
|
2007-06-21 22:00:00 +02:00
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#include "basetypes.h"
|
2007-11-25 22:00:00 +01:00
|
|
|
|
#include "net_msg.h"
|
|
|
|
|
#include "screen.h"
|
|
|
|
|
#include "keycodes.h"
|
|
|
|
|
#include "collision.h"
|
2007-06-21 22:00:00 +02:00
|
|
|
|
|
2007-11-30 22:00:00 +01:00
|
|
|
|
extern stdlib_api_t com;
|
2007-11-24 22:00:00 +01:00
|
|
|
|
extern physic_exp_t *pe;
|
2007-06-29 22:00:00 +02:00
|
|
|
|
extern byte *zonepool;
|
2007-06-21 22:00:00 +02:00
|
|
|
|
|
2007-09-03 22:00:00 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
HOST_INIT, // initalize operations
|
|
|
|
|
HOST_FRAME, // host running
|
|
|
|
|
HOST_SHUTDOWN, // shutdown operations
|
|
|
|
|
HOST_ERROR, // host stopped by error
|
|
|
|
|
HOST_SLEEP, // sleeped by different reason, e.g. minimize window
|
2007-11-05 22:00:00 +01:00
|
|
|
|
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse
|
2007-09-03 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
} host_state;
|
|
|
|
|
|
2007-09-10 22:00:00 +02:00
|
|
|
|
typedef struct host_redirect_s
|
|
|
|
|
{
|
|
|
|
|
int target;
|
|
|
|
|
char *buffer;
|
|
|
|
|
int buffersize;
|
|
|
|
|
void (*flush)(int target, char *buffer);
|
|
|
|
|
|
|
|
|
|
} host_redirect_t;
|
|
|
|
|
|
2007-09-03 22:00:00 +02:00
|
|
|
|
typedef struct host_parm_s
|
|
|
|
|
{
|
|
|
|
|
host_state state; // global host state
|
2007-11-11 22:00:00 +01:00
|
|
|
|
uint type; // running at
|
2007-11-17 22:00:00 +01:00
|
|
|
|
host_redirect_t rd; // remote console
|
|
|
|
|
jmp_buf abortframe; // abort current frame
|
|
|
|
|
|
2007-11-21 22:00:00 +01:00
|
|
|
|
char finalmsg[MAX_STRING];// server shutdown final message
|
|
|
|
|
|
2007-11-17 22:00:00 +01:00
|
|
|
|
dword framecount; // global framecount
|
|
|
|
|
double realtime; // host realtime
|
|
|
|
|
float frametime; // frametime (default 0.1)
|
|
|
|
|
uint sv_timer; // SV_Input msg time
|
|
|
|
|
uint cl_timer; // CL_Input msg time
|
|
|
|
|
|
|
|
|
|
HWND hWnd; // main window
|
2007-09-03 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
bool debug; // show all warnings mode
|
|
|
|
|
int developer; // show all developer's message
|
|
|
|
|
|
|
|
|
|
bool paused; // freeze server
|
2007-11-05 22:00:00 +01:00
|
|
|
|
bool stuffcmdsrun; // sturtup script
|
2007-09-03 22:00:00 +02:00
|
|
|
|
|
2007-09-10 22:00:00 +02:00
|
|
|
|
|
2007-09-03 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
uint maxclients; // host max clients
|
|
|
|
|
|
2007-09-10 22:00:00 +02:00
|
|
|
|
} host_parm_t;
|
2007-09-06 22:00:00 +02:00
|
|
|
|
|
2007-06-21 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
===========================================
|
|
|
|
|
memory manager
|
|
|
|
|
===========================================
|
|
|
|
|
*/
|
2007-11-11 22:00:00 +01:00
|
|
|
|
// z_malloc-free
|
2007-06-21 22:00:00 +02:00
|
|
|
|
#define Z_Malloc(size) Mem_Alloc(zonepool, size)
|
|
|
|
|
#define Z_Free(data) Mem_Free(data)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
===========================================
|
|
|
|
|
Host Interface
|
|
|
|
|
===========================================
|
|
|
|
|
*/
|
2007-09-10 22:00:00 +02:00
|
|
|
|
extern host_parm_t host;
|
2007-11-17 22:00:00 +01:00
|
|
|
|
long _stdcall Host_WndProc( HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam);
|
2007-11-11 22:00:00 +01:00
|
|
|
|
void Host_Init ( uint funcname, int argc, char **argv );
|
2007-06-21 22:00:00 +02:00
|
|
|
|
void Host_Main ( void );
|
|
|
|
|
void Host_Free ( void );
|
2007-11-14 22:00:00 +01:00
|
|
|
|
void Host_SetServerState( int state );
|
|
|
|
|
int Host_ServerState( void );
|
2007-09-10 22:00:00 +02:00
|
|
|
|
void Host_AbortCurrentFrame( void );
|
|
|
|
|
|
2007-11-14 22:00:00 +01:00
|
|
|
|
// message functions
|
|
|
|
|
void Host_Print(const char *txt);
|
|
|
|
|
void Host_Error( const char *error, ... );
|
2007-09-10 22:00:00 +02:00
|
|
|
|
|
2007-11-21 22:00:00 +01:00
|
|
|
|
// host dlls managment
|
|
|
|
|
void Host_FreeRender( void );
|
|
|
|
|
|
2007-09-10 22:00:00 +02:00
|
|
|
|
// host cmds
|
|
|
|
|
void Host_Error_f( void );
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
===========================================
|
|
|
|
|
System utilites
|
|
|
|
|
===========================================
|
|
|
|
|
*/
|
|
|
|
|
void Sys_Error( const char *msg, ... );
|
2007-11-11 22:00:00 +01:00
|
|
|
|
void Sys_SendKeyEvents( void );
|
2007-06-21 22:00:00 +02:00
|
|
|
|
|
2007-11-17 22:00:00 +01:00
|
|
|
|
// mouse support
|
2007-11-18 22:00:00 +01:00
|
|
|
|
void M_Activate( void );
|
|
|
|
|
void M_Event( int mstate );
|
2007-11-17 22:00:00 +01:00
|
|
|
|
#define WM_MOUSEWHEEL (WM_MOUSELAST + 1) // message that will be supported by the OS
|
2007-09-16 22:00:00 +02:00
|
|
|
|
extern int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
|
|
|
|
|
|
|
|
|
// vm_exec.c
|
|
|
|
|
void PRVM_Init (void);
|
|
|
|
|
|
2007-11-14 22:00:00 +01:00
|
|
|
|
// cvars
|
|
|
|
|
extern cvar_t *dedicated;
|
|
|
|
|
extern cvar_t *host_serverstate;
|
|
|
|
|
extern cvar_t *host_frametime;
|
2007-11-29 22:00:00 +01:00
|
|
|
|
extern cvar_t *cm_paused;
|
2007-11-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==============================================================
|
|
|
|
|
|
|
|
|
|
CLIENT / SERVER SYSTEMS
|
|
|
|
|
|
|
|
|
|
==============================================================
|
|
|
|
|
*/
|
|
|
|
|
void CL_Init (void);
|
|
|
|
|
void CL_Drop (void);
|
|
|
|
|
void CL_Shutdown (void);
|
|
|
|
|
void CL_Frame (float time);
|
|
|
|
|
|
2007-11-21 22:00:00 +01:00
|
|
|
|
void SV_Init( void );
|
|
|
|
|
void SV_Shutdown( bool reconnect );
|
|
|
|
|
void SV_Frame( float time );
|
2008-01-12 22:00:00 +01:00
|
|
|
|
void SV_Transform( sv_edict_t *ed, matrix4x3 transform );
|
2007-11-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==============================================================
|
|
|
|
|
|
2007-11-25 22:00:00 +01:00
|
|
|
|
MISC UTILS
|
2007-11-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
==============================================================
|
|
|
|
|
*/
|
|
|
|
|
char *Info_ValueForKey( char *s, char *key );
|
|
|
|
|
void Info_RemoveKey( char *s, char *key );
|
|
|
|
|
void Info_SetValueForKey( char *s, char *key, char *value );
|
|
|
|
|
bool Info_Validate( char *s );
|
|
|
|
|
void Info_Print( char *s );
|
2007-11-25 22:00:00 +01:00
|
|
|
|
void Cmd_ForwardToServer( void ); // client callback
|
|
|
|
|
char *Cvar_Userinfo( void );
|
|
|
|
|
char *Cvar_Serverinfo( void );
|
|
|
|
|
void Cmd_WriteVariables( file_t *f );
|
|
|
|
|
bool Cmd_GetMapList (const char *s, char *completedname, int length );
|
|
|
|
|
bool Cmd_GetDemoList(const char *s, char *completedname, int length );
|
|
|
|
|
bool Cmd_GetMovieList(const char *s, char *completedname, int length);
|
2007-11-14 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// get rid of this
|
2007-11-25 22:00:00 +01:00
|
|
|
|
float frand(void); // 0 to 1
|
|
|
|
|
float crand(void); // -1 to 1
|
2007-11-14 22:00:00 +01:00
|
|
|
|
|
2007-06-21 22:00:00 +02:00
|
|
|
|
#endif//ENGINE_H
|