Initial Prey Game integration support.

This commit is contained in:
Justin Marshall
2026-05-05 15:01:01 -07:00
parent a6c6f1ed26
commit 8d5f678b25
552 changed files with 265551 additions and 209 deletions
+68
View File
@@ -228,6 +228,73 @@ typedef struct {
int clearSolid, surfaceFlags, contents;
} infoParm_t;
#ifdef PREY
static infoParm_t infoParms[] = {
// game relevant attributes
{"solid", 0, 0, CONTENTS_SOLID }, // may need to override a clearSolid
{"opaque", 0, 0, CONTENTS_OPAQUE }, // blocks visibility / opaque contents
{"water", 1, 0, CONTENTS_WATER }, // used for water
{"playerclip", 0, 0, CONTENTS_PLAYERCLIP }, // solid to players
{"monsterclip", 0, 0, CONTENTS_MONSTERCLIP }, // solid to monsters
{"moveableclip", 0, 0, CONTENTS_MOVEABLECLIP }, // solid to moveable entities
{"ikclip", 0, 0, CONTENTS_IKCLIP }, // solid to IK
{"blood", 0, 0, CONTENTS_BLOOD }, // used to detect blood decals
{"body", 0, 0, CONTENTS_BODY }, // body contents
{"projectile", 0, 0, CONTENTS_PROJECTILE }, // projectile collision
{"corpse", 0, 0, CONTENTS_CORPSE }, // corpse collision
{"rendermodel", 0, 0, CONTENTS_RENDERMODEL }, // render model collision contents
{"trigger", 0, 0, CONTENTS_TRIGGER }, // used for triggers
{"aassolid", 0, 0, CONTENTS_AAS_SOLID }, // Doom 3-style name
{"aas_solid", 0, 0, CONTENTS_AAS_SOLID }, // HumanHead cm_contentsNameByIndex name
{"aasobstacle", 0, 0, CONTENTS_AAS_OBSTACLE }, // Doom 3-style name
{"aas_obstacle", 0, 0, CONTENTS_AAS_OBSTACLE }, // HumanHead cm_contentsNameByIndex name
{"flashlight_trigger", 0, 0, CONTENTS_FLASHLIGHT_TRIGGER }, // used for triggers that are activated by the flashlight
// HUMANHEAD pdm: added contents
{"forcefield", 0, 0, CONTENTS_FORCEFIELD }, // forcefield collision/content
{"spiritbridge", 0, 0, CONTENTS_SPIRITBRIDGE }, // spirit bridge collision/content
{"areaportal", 1, 0, CONTENTS_AREAPORTAL }, // divides areas
{"nocsg", 1, 0, CONTENTS_NOCSG }, // don't cut brushes in editor
{"qer_nocarve", 1, 0, CONTENTS_NOCSG }, // Doom 3 editor alias for nocsg
{"block_radiusdamage", 0, 0, CONTENTS_BLOCK_RADIUSDAMAGE }, // blocks radius damage
{"shootable", 0, 0, CONTENTS_SHOOTABLE }, // shootable contents
{"deathvolume", 0, 0, CONTENTS_DEATHVOLUME }, // death volume contents
{"vehicleclip", 0, 0, CONTENTS_VEHICLECLIP }, // solid to vehicles
{"owner_to_owner", 0, 0, CONTENTS_OWNER_TO_OWNER }, // owner-to-owner collision/content filtering
{"game_portal", 0, 0, CONTENTS_GAME_PORTAL }, // game portal contents
{"shootablebyarrow", 0, 0, CONTENTS_SHOOTABLEBYARROW }, // shootable by arrow/projectile type
{"hunterclip", 0, 0, CONTENTS_HUNTERCLIP }, // hunter-specific clipping
{"nonsolid", 1, 0, 0 }, // clears the solid flag
{"nullNormal", 0, SURF_NULLNORMAL, 0 }, // renderbump will draw as 0x80 0x80 0x80
// surface behavior attributes
{"discrete", 1, SURF_DISCRETE, 0 }, // do not merge/clip automatically
{"noFragment", 0, SURF_NOFRAGMENT, 0 },
{"slick", 0, SURF_SLICK, 0 },
{"collision", 0, SURF_COLLISION, 0 },
{"noimpact", 0, SURF_NOIMPACT, 0 }, // don't make impact explosions or marks
{"nodamage", 0, SURF_NODAMAGE, 0 }, // no falling damage when hitting
{"ladder", 0, SURF_LADDER, 0 }, // climbable
{"nosteps", 0, SURF_NOSTEPS, 0 }, // no footsteps
// material types for particle, sound, footstep feedback
{"metal", 0, SURFTYPE_METAL, 0 }, // metal
{"stone", 0, SURFTYPE_STONE, 0 }, // stone
{"flesh", 0, SURFTYPE_FLESH, 0 }, // flesh
{"wood", 0, SURFTYPE_WOOD, 0 }, // wood
{"cardboard", 0, SURFTYPE_CARDBOARD, 0 }, // cardboard
{"liquid", 0, SURFTYPE_LIQUID, 0 }, // liquid
{"glass", 0, SURFTYPE_GLASS, 0 }, // glass
{"tile", 0, SURFTYPE_TILE, 0 }, // tile
{"wallwalk", 0, SURFTYPE_WALLWALK, 0 }, // wallwalk surface
{"altmetal", 0, SURFTYPE_ALTMETAL, 0 }, // alternate metal
{"forcefield", 0, SURFTYPE_FORCEFIELD, 0 }, // forcefield material
{"pipe", 0, SURFTYPE_PIPE, 0 }, // pipe
{"spirit", 0, SURFTYPE_SPIRIT, 0 }, // spirit material
{"chaff", 0, SURFTYPE_CHAFF, 0 }, // chaff material
};
#else
static infoParm_t infoParms[] = {
// game relevant attributes
{"solid", 0, 0, CONTENTS_SOLID }, // may need to override a clearSolid
@@ -280,6 +347,7 @@ static infoParm_t infoParms[] = {
{"surftype14", 0, SURFTYPE_14, 0 },
{"surftype15", 0, SURFTYPE_15, 0 },
};
#endif
static const int numInfoParms = sizeof(infoParms) / sizeof (infoParms[0]);
+46 -2
View File
@@ -265,7 +265,8 @@ typedef enum {
MF_FORCESHADOWS = BIT(3),
MF_NOSELFSHADOW = BIT(4),
MF_NOPORTALFOG = BIT(5), // this fog volume won't ever consider a portal fogged out
MF_EDITOR_VISIBLE = BIT(6) // in use (visible) per editor
MF_EDITOR_VISIBLE = BIT(6), // in use (visible) per editor
MF_SKIPCLIP = BIT(9)
} materialFlags_t;
// contents flags, NOTE: make sure to keep the defines in doom_defs.script up to date with these!
@@ -287,9 +288,31 @@ typedef enum {
CONTENTS_AAS_OBSTACLE = BIT(14), // used to compile an obstacle into AAS that can be enabled/disabled
CONTENTS_FLASHLIGHT_TRIGGER = BIT(15), // used for triggers that are activated by the flashlight
#ifdef PREY
// HUMANHEAD CJR: Content flags. Note that for simplicity of merging, id's areaportal and nocsg flags were left as is
CONTENTS_FORCEFIELD = BIT(16), // forcefield matter, only passable in spirit mode
CONTENTS_SPIRITBRIDGE = BIT(17), // cjr - Collidable only by spiritwalking players
// END HUMANHEAD
// contents used by utils
CONTENTS_AREAPORTAL = BIT(18), // portal separating renderer areas
CONTENTS_NOCSG = BIT(19), // don't cut this brush with CSG operations in the editor
// HUMANHEAD CJR: Content flags. Note that for simplicity of merging, id's areaportal and nocsg flags were left as is
CONTENTS_BLOCK_RADIUSDAMAGE = BIT(20), // aob - used by objects like forcefields and chaff
CONTENTS_SHOOTABLE = BIT(21), // pdm - bullets collide with but not player or monsters
CONTENTS_DEATHVOLUME = BIT(22), // AOB: used by death zones so the player can do a simple contents check
CONTENTS_VEHICLECLIP = BIT(23), // PDM: used to clip off vehicle movement
CONTENTS_OWNER_TO_OWNER = BIT(24), // bjk: used to disable owner to owner rejection for collision
CONTENTS_GAME_PORTAL = BIT(25), // cjr: used for clipping against game portals (glow portals, etc)
CONTENTS_SHOOTABLEBYARROW = BIT(26), // pdm: solid to spirit arrows specifically as opposed to other projectiles
CONTENTS_HUNTERCLIP = BIT(27), // pdm: solid to hunters, but not hunters in vehicles
// HUMANHEAD END
#else
// contents used by utils
CONTENTS_AREAPORTAL = BIT(20), // portal separating renderer areas
CONTENTS_NOCSG = BIT(21), // don't cut this brush with CSG operations in the editor
#endif
CONTENTS_REMOVE_UTIL = ~(CONTENTS_AREAPORTAL|CONTENTS_NOCSG)
} contentsFlags_t;
@@ -297,7 +320,27 @@ typedef enum {
// surface types
const int NUM_SURFACE_BITS = 4;
const int MAX_SURFACE_TYPES = 1 << NUM_SURFACE_BITS;
#ifdef PREY
typedef enum {
SURFTYPE_NONE, // default type
SURFTYPE_METAL,
SURFTYPE_STONE,
SURFTYPE_FLESH,
SURFTYPE_WOOD,
SURFTYPE_CARDBOARD,
SURFTYPE_LIQUID,
SURFTYPE_GLASS,
SURFTYPE_TILE,
SURFTYPE_WALLWALK,
SURFTYPE_ALTMETAL,
SURFTYPE_FORCEFIELD,
SURFTYPE_PIPE,
SURFTYPE_SPIRIT,
SURFTYPE_CHAFF,
NUM_SURFACE_TYPES
// NOTE: Bits all used, no more matter types
} surfTypes_t;
#else
typedef enum {
SURFTYPE_NONE, // default type
SURFTYPE_METAL,
@@ -316,6 +359,7 @@ typedef enum {
SURFTYPE_14,
SURFTYPE_15
} surfTypes_t;
#endif
// surface flags
typedef enum {
+2
View File
@@ -308,6 +308,8 @@ public:
// Returns number of the joint nearest to the given triangle.
virtual int NearestJoint( int surfaceNum, int a, int c, int b ) const = 0;
virtual void IntersectBounds(const idBounds& bounds, float displacement) = 0;
// Writing to and reading from a demo file.
virtual void ReadFromDemoFile( class idDemoFile *f ) = 0;
virtual void WriteToDemoFile( class idDemoFile *f ) = 0;
+2 -1
View File
@@ -84,6 +84,7 @@ public:
virtual void ReadFromDemoFile( class idDemoFile *f );
virtual void WriteToDemoFile( class idDemoFile *f );
virtual float DepthHack() const;
virtual void IntersectBounds(const idBounds& bounds, float displacement) {} // this is empty intentionally
void MakeDefaultModel();
@@ -239,7 +240,7 @@ public:
virtual idBounds Bounds( const struct renderEntity_s *ent ) const;
virtual void Reset();
void IntersectBounds( const idBounds &bounds, float displacement );
virtual void IntersectBounds( const idBounds &bounds, float displacement );
private:
modelSurface_t GenerateSurface( float lerp );
+9 -1
View File
@@ -220,7 +220,15 @@ public:
virtual void DrawSmallStringExt( int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material ) = 0;
virtual void DrawBigChar( int x, int y, int ch, const idMaterial *material ) = 0;
virtual void DrawBigStringExt( int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material ) = 0;
#ifdef PREY
virtual void SetEntireSceneMaterial(idMaterial* material) {} // HUMANHEAD CJR
virtual bool IsScopeView() { return false; }// HUMANHEAD CJR
virtual void SetScopeView(bool view) {}; // HUMANHEAD CJR
virtual bool IsShuttleView() { return false; }// HUMANHEAD pdm
virtual void SetShuttleView(bool view) {};// HUMANHEAD pdm
virtual bool SupportsFragmentPrograms(void) { return true; }; // HUMANHEAD CJR
virtual int VideoCardNumber(void) { return 0; } // HUMANHEAD CJR
#endif
// dump all 2D drawing so far this frame to the demo file
virtual void WriteDemoPics() = 0;
+1
View File
@@ -1027,6 +1027,7 @@ guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 st
pt.x = ( cursor * axis[0] ) / ( axisLen[0] * axisLen[0] );
pt.y = ( cursor * axis[1] ) / ( axisLen[1] * axisLen[1] );
pt.guiId = shader->GetEntityGui();
pt.frac = local.fraction;
return pt;
}
+67 -1
View File
@@ -29,6 +29,8 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __RENDERWORLD_H__
#define __RENDERWORLD_H__
class hhDeclBeam;
/*
===============================================================================
@@ -70,6 +72,40 @@ const int SHADERPARM_SPRITE_HEIGHT = 9;
const int SHADERPARM_PARTICLE_STOPTIME = 8; // don't spawn any more particles after this time
#ifdef PREY
const int SHADERPARM_MISC = 6; // aob
const int SHADERPARM_ANY_DEFORM = 9; // Model deformation
const int SHADERPARM_ANY_DEFORM_PARM1 = 10; // Model deformation parameter1
const int SHADERPARM_ANY_DEFORM_PARM2 = 11; // Model deformation parameter2
const int SHADERPARM_DISTANCE = 12; // CJR -- distance shader parm index
// Always add to the end of the list so the old numbers don't change
enum {
DEFORMTYPE_NONE = 0,
DEFORMTYPE_SCALE,
DEFORMTYPE_VERTEXCOLOR,
DEFORMTYPE_SPHERE,
DEFORMTYPE_RIPPLE,
DEFORMTYPE_PLANTSWAYX,
DEFORMTYPE_PLANTSWAYY,
DEFORMTYPE_FLATTEN,
DEFORMTYPE_VIBRATE,
DEFORMTYPE_SQUISH,
DEFORMTYPE_TURBULENT, // 10
DEFORMTYPE_RAYS,
DEFORMTYPE_ALPHAGLOW,
DEFORMTYPE_FATTEN,
DEFORMTYPE_RIPPLECENTER,
DEFORMTYPE_MELT,
DEFORMTYPE_POD,
DEFORMTYPE_DEATHEFFECT,
DEFORMTYPE_WINDBLAST,
DEFORMTYPE_PINCHPOINT,
DEFORMTYPE_PORTAL
//NOTE: Any added here should also be added to prey_defs.script
};
#endif
// guis
const int MAX_RENDERENTITY_GUI = 3;
@@ -77,6 +113,13 @@ const int MAX_RENDERENTITY_GUI = 3;
typedef bool(*deferredEntityCallback_t)( renderEntity_s *, const renderView_s * );
#ifdef PREY
#define MAX_BEAM_NODES 32
typedef struct hhBeamNodes_s {
idVec3 nodes[MAX_BEAM_NODES];
} hhBeamNodes_t;
#endif
typedef struct renderEntity_s {
idRenderModel * hModel; // this can only be null if callback is set
@@ -137,6 +180,16 @@ typedef struct renderEntity_s {
float modelDepthHack; // squash depth range so particle effects don't clip into walls
#ifdef PREY
const hhDeclBeam* declBeam; // HUMANHEAD beam information
hhBeamNodes_t* beamNodes; // HUMANHEAD beam node array (sized to the number of beams in the system)
bool onlyVisibleInSpirit; // HUMANHEAD: visible only in spiritwalking/deathwalking
bool onlyInvisibleInSpirit; // HUMANHEAD: invisible only in spiritwalking/deathwalking
bool lowSkippable; // HUMANHEAD bjk: skippable in low quality
float eyeDistance; // HUMANHEAD pdm: precalculated distance to eye
#endif
// options to override surface shader flags (replace with material parameters?)
bool noSelfShadow; // cast shadows onto other objects,but not self
bool noShadow; // no shadow at all
@@ -148,7 +201,11 @@ typedef struct renderEntity_s {
bool weaponDepthHack; // squash depth range so view weapons don't poke into walls
// this automatically implies noShadow
int forceUpdate; // force an update (NOTE: not a bool to keep this struct a multiple of 4 bytes)
#ifdef PREY
bool forceUpdate; // force an update (NOTE: not a bool to keep this struct a multiple of 4 bytes)
#else
int forceUpdate; // force an update (NOTE: not a bool to keep this struct a multiple of 4 bytes)
#endif
int timeGroup;
int xrayIndex;
} renderEntity_t;
@@ -172,6 +229,9 @@ typedef struct renderLight_s {
// updates
bool noShadows; // (should we replace this with material parameters on the shader?)
bool noSpecular; // (should we replace this with material parameters on the shader?)
#ifdef PREY
bool lowSkippable;
#endif
bool pointLight; // otherwise a projection light (should probably invert the sense of this, because points are way more common)
bool parallel; // lightCenter gives the direction to the light at infinity
@@ -218,6 +278,11 @@ typedef struct renderView_s {
bool cramZNear; // for cinematics, we want to set ZNear much lower
bool forceUpdate; // for an update
#ifdef PREY
bool viewSpiritEntities; // HUMANHEAD cjr: this renderView can see all onlyVisibleInSpirit entities
// tmj: this renderView cannot see onlyInvisibleInSpirit entities
#endif
// time in milliseconds for shader effects and other time dependent rendering issues
int time;
float shaderParms[MAX_GLOBAL_SHADER_PARMS]; // can be used in any way by shader
@@ -238,6 +303,7 @@ typedef struct {
typedef struct {
float x, y; // 0.0 to 1.0 range if trace hit a gui, otherwise -1
int guiId; // id of gui ( 0, 1, or 2 ) that the trace happened against
float frac;
} guiPoint_t;
+4
View File
@@ -662,7 +662,11 @@ void idRenderWorldLocal::ReadRenderEntity() {
session->readDemo->ReadBool( ent.noShadow );
session->readDemo->ReadBool( ent.noDynamicInteractions );
session->readDemo->ReadBool( ent.weaponDepthHack );
#ifndef PREY
session->readDemo->ReadInt( ent.forceUpdate );
#else
session->readDemo->ReadBool(ent.forceUpdate);
#endif
ent.callback = NULL;
if ( ent.customShader ) {
ent.customShader = declManager->FindMaterial( session->readDemo->ReadHashString() );