Skip to content

Commit

Permalink
Merge pull request #203 from SmileyAG/com_model_updated
Browse files Browse the repository at this point in the history
Added undocumented function for enginefuncs_t and matched com_model.h with hardware and software engine versions
  • Loading branch information
tmp64 committed Dec 29, 2023
2 parents 85e9822 + e5cdb8a commit 0783ff7
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 6 deletions.
84 changes: 84 additions & 0 deletions src/common/com_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand All @@ -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
};
Expand All @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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
{
Expand Down
18 changes: 12 additions & 6 deletions src/engine/eiface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
#include "custom.h"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0783ff7

Please sign in to comment.