From 5c7287c689c3d157ddab390745609d71c34e9d0c Mon Sep 17 00:00:00 2001 From: SmileyAG Date: Mon, 25 Dec 2023 16:01:13 +0400 Subject: [PATCH 1/2] Added pfnPEntityOfEntIndexAllEntities for enginefuncs_t --- src/engine/eiface.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/engine/eiface.h b/src/engine/eiface.h index 1a5ec37c..c23f4bf4 100644 --- a/src/engine/eiface.h +++ b/src/engine/eiface.h @@ -17,11 +17,7 @@ #include "archtypes.h" // DAL -#ifdef HLDEMO_BUILD -#define INTERFACE_VERSION 001 -#else // !HLDEMO_BUILD, i.e., regular version of HL #define INTERFACE_VERSION 140 -#endif // !HLDEMO_BUILD #include #include "custom.h" @@ -732,7 +728,7 @@ typedef struct enginefuncs_s * @param iEntIndex Entity index. * @return If the given index is not valid, returns null. * Otherwise, if the entity at the given index is not in use, returns null. - * Otherwise, if the entity at the given index is not a player and does not have a CBaseEntity instance, returns null. + * Otherwise, if the entity at the given index is equal or more than svs.maxclients and does not have a CBaseEntity instance, returns null. * Otherwise, returns the entity. */ edict_t *(*pfnPEntityOfEntIndex)(int iEntIndex); @@ -1422,9 +1418,19 @@ typedef struct enginefuncs_s * @return Key index in the command line buffer, or 0 if it wasn't found. */ int (*pfnCheckParm)(const char *pchCmdLineToken, char **ppnext); + + /** + * Gets the edict at the given entity index. + * @param iEntIndex Entity index. + * @return If the given index is not valid, returns null. + * Otherwise, if the entity at the given index is not in use, returns null. + * Otherwise, if the entity at the given index is more than svs.maxclients and does not have a CBaseEntity instance, returns null. + * Otherwise, returns the entity. + */ + edict_t *(*pfnPEntityOfEntIndexAllEntities)(int iEntIndex); } enginefuncs_t; -// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 +// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 140 // Passed to pfnKeyValue typedef struct KeyValueData_s From e5cdb8a722f986dbe91f49bf2abdcf18891117fe Mon Sep 17 00:00:00 2001 From: SmileyAG Date: Mon, 25 Dec 2023 17:28:08 +0400 Subject: [PATCH 2/2] Matched structs in com_model.h with hardware and software engine versions --- src/common/com_model.h | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/common/com_model.h b/src/common/com_model.h index 07fd2c5c..93806a6d 100644 --- a/src/common/com_model.h +++ b/src/common/com_model.h @@ -91,12 +91,23 @@ typedef struct texture_s { char name[16]; unsigned width, height; + +#ifndef SOFTWARE_BUILD + int gl_texturenum; // gl texture binding + struct msurface_s *texturechain; // for sort-by-texture world drawing +#endif + int anim_total; // total tenths in sequence ( 0 = no) int anim_min, anim_max; // time for this frame min <=time< max struct texture_s *anim_next; // in the animation sequence struct texture_s *alternate_anims; // bmodels in frame 1 use these unsigned offsets[MIPLEVELS]; // four mip maps stored + +#ifdef SOFTWARE_BUILD unsigned paloffset; +#else + byte *pPal; +#endif } texture_t; typedef struct @@ -115,7 +126,11 @@ typedef struct mnode_s int contents; // 0, to differentiate from leafs int visframe; // node needs to be traversed if current +#ifdef SOFTWARE_BUILD short minmaxs[6]; // for bounding box culling +#else + float minmaxs[6]; // for bounding box culling +#endif struct mnode_s *parent; @@ -135,11 +150,20 @@ struct decal_s { decal_t *pnext; // linked list for each surface msurface_t *psurface; // Surface id for persistence / unlinking + +#ifdef SOFTWARE_BUILD short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats) short dy; short texture; // Decal texture byte scale; // Pixel scale byte flags; // Decal flags +#else + float dx; + float dy; + float scale; // Pixel scale + short texture; // Decal texture + short flags; // Decal flags +#endif short entityIndex; // Entity this is attached to }; @@ -150,7 +174,11 @@ typedef struct mleaf_s int contents; // wil be a negative contents number int visframe; // node needs to be traversed if current +#ifdef SOFTWARE_BUILD short minmaxs[6]; // for bounding box culling +#else + float minmaxs[6]; // for bounding box culling +#endif struct mnode_s *parent; @@ -164,6 +192,26 @@ typedef struct mleaf_s byte ambient_sound_level[NUM_AMBIENTS]; } mleaf_t; +#define VERTEXSIZE 7 + +typedef struct glpoly_s +{ + struct glpoly_s *next; + struct glpoly_s *chain; + int numverts; + int flags; + float verts[4][VERTEXSIZE]; +} glpoly_t; + +typedef struct mdisplaylist_s // Half-Life 25th Anniversary Update +{ + unsigned gl_displaylist; + int rendermode; + float scrolloffset; + int renderDetailTexture; +} mdisplaylist_t; + +#ifdef SOFTWARE_BUILD struct msurface_s { int visframe; // should be drawn when node is crossed @@ -194,6 +242,42 @@ struct msurface_s decal_t *pdecals; }; +#else +struct msurface_s +{ + int visframe; // should be drawn when node is + + mplane_t *plane; // pointer to shared plane + int flags; // see SURF_ #defines + + int firstedge; // look up in model->surfedges[], negative numbers + int numedges; // are backwards edges + + short texturemins[2]; // smallest s/t position on the surface. + short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces + + int light_s, light_t; // gl lightmap coordinates + + glpoly_t *polys; // multiple if warped + struct msurface_s *texturechain; + + mtexinfo_t *texinfo; + + int dlightframe; // last frame the surface was checked by an animated light + int dlightbits; // dynamically generated. Indicates if the surface illumination + // is modified by an animated light. + + int lightmaptexturenum; + unsigned char styles[MAXLIGHTMAPS]; + int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap + qboolean cached_dlight; // true if dynamic light in cache + + color24 *samples; // note: this is the actual lightmap data for this surface + decal_t *pdecals; + + //mdisplaylist_t displaylist; // Half-Life 25th Anniversary Update +}; +#endif typedef struct {