Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: server dll compatibility #1

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions engine/eiface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
* without written permission from Valve LLC.
*
****/

// 2023-08: v1.0.0.5/b738 compatibility

#ifndef EIFACE_H
#define EIFACE_H

#ifdef HLDEMO_BUILD
#define INTERFACE_VERSION 001
#else // !HLDEMO_BUILD, i.e., regular version of HL
#define INTERFACE_VERSION 138
#endif // !HLDEMO_BUILD
#define INTERFACE_VERSION 129

#include "custom.h"

#include "cvardef.h"
//
// Defines entity interface between engine and DLLs.
Expand Down Expand Up @@ -129,7 +127,7 @@ typedef struct enginefuncs_s
void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn);
void (*pfnServerCommand) (char* str);
void (*pfnServerExecute) (void);
//void (*pfnServerExecute) (void); UNIMPLEMENTED FOR BUILD 738
void (*pfnClientCommand) (edict_t* pEdict, char* szFmt, ...);
void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count);
void (*pfnLightStyle) (int style, char* val);
Expand All @@ -145,7 +143,7 @@ typedef struct enginefuncs_s
void (*pfnWriteCoord) (float flValue);
void (*pfnWriteString) (const char *sz);
void (*pfnWriteEntity) (int iValue);
void (*pfnCVarRegister) (cvar_t *pCvar);
//void (*pfnCVarRegister) (cvar_t *pCvar); UNIMPLEMENTED FOR BUILD 738
float (*pfnCVarGetFloat) (const char *szVarName);
const char* (*pfnCVarGetString) (const char *szVarName);
void (*pfnCVarSetFloat) (const char *szVarName, float flValue);
Expand All @@ -170,7 +168,7 @@ typedef struct enginefuncs_s
unsigned long (*pfnFunctionFromName) ( const char *pName );
const char *(*pfnNameForFunction) ( unsigned long function );
void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint) ( const char *szMsg );
//void (*pfnServerPrint) ( const char *szMsg ); UNIMPLEMENTED FOR BUILD 738
const char *(*pfnCmd_Args) ( void ); // these 3 added
const char *(*pfnCmd_Argv) ( int argc ); // so game DLL can easily
int (*pfnCmd_Argc) ( void ); // access client 'cmd' strings
Expand Down Expand Up @@ -198,13 +196,15 @@ typedef struct enginefuncs_s
char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue) (char *infobuffer, char *key);
void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value);
void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value);
//void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value); UNIMPLEMENTED FOR BUILD 738
int (*pfnIsMapValid) (char *filename);
void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric) (char* s);
int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
int (*pfnIsDedicatedServer) (void);// is this a dedicated server?
//UNIMPLEMENTED FOR BUILD 738
//void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
//int (*pfnPrecacheGeneric) (char* s);
//int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
//void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
//int (*pfnIsDedicatedServer) (void);// is this a dedicated server?
//UNIMPLEMENTED FOR BUILD 738
} enginefuncs_t;
// be sure to bump INTERFACE_VERSION if you add a new function

Expand Down Expand Up @@ -319,7 +319,7 @@ typedef struct

typedef struct
{
void (*pfnGameInit) ( void ); // Initialize the game (one-time call from Host_Init() )
//void (*pfnGameInit) ( void ); // Initialize the game (one-time call from Host_Init() )
int (*pfnSpawn) ( edict_t *pent );
void (*pfnThink) ( edict_t *pent );
void (*pfnUse) ( edict_t *pentUsed, edict_t *pentOther );
Expand Down
9 changes: 6 additions & 3 deletions engine/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ typedef struct edict_s
short leafnums[MAX_ENT_LEAFS];

entity_state_t baseline;

//2023-08: TODO: entity_state_t is 4 byte short compared to build 893 (OldSourceCode)

float freetime; // sv.time when the object was freed

void* pvPrivateData; // Alloced and freed by engine, used by DLLs
void* pvPrivateData; // Alloced and freed by engine, used by DLLs
//2023-08: TODO: pvPrivateData is supposed to be at offset 0xd4 due to the 4 bytes of baseline, but it will crash the game
//while leaving it unchanged will affect reading of classname in entvars_t at DispatchKeyValue

entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
Expand Down Expand Up @@ -142,4 +145,4 @@ void ED_PrintEdicts (void);
void ED_PrintNum (int ent);


#endif // PROGS_H
#endif // PROGS_H