NSRenderableEntity: Use the new addlight for RFX_Q2PULSE. Needs engine version bump.

This commit is contained in:
Marco Cawthorne 2022-06-27 08:31:41 -07:00
parent d50ec089f3
commit e7339b124e
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
4 changed files with 138 additions and 62 deletions

View File

@ -32,7 +32,7 @@ BUILD_IQMTOOL=1
BUILD_IMGTOOL=1
# Specify which engine revision to build, these are considered 'stable'; 0 = latest
BUILD_ENGINEREVISION=6262
BUILD_ENGINEREVISION=6278
# Whether or not to run 'git pull' or 'svn up' before building a component
BUILD_UPDATE=1

View File

@ -63,6 +63,7 @@ class NSRenderableEntity:NSEntity
virtual void(void) EvaluateEntity;
virtual float(entity, float) SendEntity;
#else
virtual void(void) RenderDebugSkeleton;
virtual void(float,float) ReceiveEntity;
virtual float(void) predraw;
#endif

View File

@ -495,14 +495,6 @@ NSRenderableEntity::RenderFXPass(void)
effects = 0;
break;
case RFX_Q2PULSE:
drawflags = 6;
abslight = ((sin(time * autocvar(rfx_q2pulse_speed, 4)) + (M_PI/2)) * autocvar(rfx_q2pulse_intensity, 128));
forceshader = 0;
fatness = 0;
colormod = [1,1,1];
alpha = 1.0f;
effects = 0;
break;
default:
break;
}
@ -623,6 +615,29 @@ NSRenderableEntity::ReceiveEntity(float flNew, float flChanged)
setorigin(this, origin);
}
void
NSRenderableEntity::RenderDebugSkeleton(void)
{
if (autocvar(r_showSkeleton, 0))
for (int i = 1; i < 64; i++) {
vector v1 = gettaginfo(this, i);
if (v1 == this.origin) {
continue;
}
makevectors(input_angles);
R_BeginPolygon("textures/dev/model_bone", 0, 0);
R_PolygonVertex(v1 + v_right * 1 - v_up * 1, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(v1 - v_right * 1 - v_up * 1, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(v1 - v_right * 1 + v_up * 1, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(v1 + v_right * 1 + v_up * 1, [1,0], [1,1,1],1.0f);
R_EndPolygon();
alpha = 0.25f;
}
}
/*
============
NSEntity::predraw
@ -643,23 +658,7 @@ NSRenderableEntity::predraw(void)
RenderFXPass();
#endif
if (autocvar(r_showSkeleton, 0))
for (int i = 1; i < 64; i++) {
vector v1 = gettaginfo(this, i);
if (v1 == this.origin) {
continue;
}
makevectors(input_angles);
R_BeginPolygon("textures/dev/model_bone", 0, 0);
R_PolygonVertex(v1 + v_right * 1 - v_up * 1, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(v1 - v_right * 1 - v_up * 1, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(v1 - v_right * 1 + v_up * 1, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(v1 + v_right * 1 + v_up * 1, [1,0], [1,1,1],1.0f);
R_EndPolygon();
alpha = 0.25f;
}
RenderDebugSkeleton();
if (serverkeyfloat(SERVERKEY_PAUSESTATE) != 1)
frame1time += frametime;
@ -667,8 +666,16 @@ NSRenderableEntity::predraw(void)
processmodelevents(modelindex, frame, m_flBaseTime,
frame1time, ClientGame_ModelEvent);
if (alpha > 0.0)
addentity(this);
if (alpha > 0.0) {
/* TODO: Move this somewhere more sane */
if (m_iRenderFX == RFX_Q2PULSE) {
float dim = ((sin(time * autocvar(rfx_q2pulse_speed, 4)) + (M_PI/2)) * autocvar(rfx_q2pulse_intensity, 1.0));
dim += 1.0f;
addentity_lighting(this, [0,0,0], [dim, dim, dim], [0,0,0], 0, 0);
} else {
addentity(this);
}
}
return (PREDRAW_NEXT);
}

View File

@ -1,5 +1,5 @@
/*
This file was generated by FTE Quake 6147M, dated Jan 4 2022.
This file was generated by FTE Quake 6278M, dated Jun 27 2022.
This file can be regenerated by issuing the following command:
pr_dumpplatform
(Use the -help arg for a list of available args)
@ -87,6 +87,7 @@ pr_dumpplatform
#define DP_QC_GETSURFACE
#define DP_QC_GETSURFACEPOINTATTRIBUTE
#define DP_QC_GETTAGINFO
#define DP_QC_I18N /* Specifies that the engine uses $MODULE.dat.$LANG.po files that translates the dotranslate_* globals on load - these are usually created via the _("foo") qcc intrinsic. */
#define DP_QC_MINMAXBOUND
#define DP_QC_MULTIPLETEMPSTRINGS /* Superseded by DP_QC_UNLIMITEDTEMPSTRINGS. Functions that return a temporary string will not overwrite/destroy previous temporary strings until at least 16 strings are returned (or control returns to the engine). */
#define DP_QC_RANDOMVEC
@ -137,6 +138,7 @@ pr_dumpplatform
#define DP_SV_PRINT /* Says that the print builtin can be used from nqssqc (as well as just csqc), bypassing the developer cvar issues. */
#define DP_SV_ROTATINGBMODEL /* Engines that support this support avelocity on MOVETYPE_PUSH entities, pushing entities out of the way as needed. */
#define DP_SV_SETCOLOR
#define DP_SV_SHUTDOWN
#define DP_SV_SPAWNFUNC_PREFIX
#define DP_SV_WRITEPICTURE
#define DP_SV_WRITEUNTERMINATEDSTRING
@ -730,7 +732,7 @@ void(string cmdtext) GameCommand;
string(string uri, string method, string postdata, __in string requestheaders, __inout string responseheaders) Cef_GeneratePage; /* Provides an entrypoint to generate pages for the CEF plugin from within QC. Headers are
-separated key/value pairs (use tokenizebyseparator). */
#ifdef SSQC
string(string uri, string method, string postdata, __in string requestheaders, __inout string responseheaders) HTTP_GeneratePage; /* Provides an entrypoint to generate pages for pages requested over http (sv_port_tcp+net_enable_http). Headers are
string(string uri, string method, string postdata, __in string requestheaders, __inout string responseheaders) HTTP_GeneratePage; /* Provides an entrypoint to generate pages for pages requested over http (sv_port_tcp+net_enable_http). Headers are
-separated key/value pairs (use tokenizebyseparator). Return __NULL__ to let the engine handle it, an empty string for a 404, and any other text for a regular 200 response. */
#endif
#if defined(CSQC) || defined(SSQC)
@ -999,11 +1001,7 @@ const float SOUNDFLAG_ABSVOLUME = 16; /* The sample's volume is not scaled by th
#endif
#if defined(CSQC) || defined(SSQC)
const float SOUNDFLAG_FORCELOOP = 2; /* The sound will restart once it reaches the end of the sample. */
#endif
#ifdef CSQC
const float SOUNDFLAG_NOSPACIALISE = 4; /* The different audio channels are played at the same volume regardless of which way the player is facing, without needing to use 0 attenuation. */
#endif
#if defined(CSQC) || defined(SSQC)
const float SOUNDFLAG_NOREVERB = 32; /* Disables the use of underwater/reverb effects on this sound effect. */
const float SOUNDFLAG_FOLLOW = 64; /* The sound's origin will updated to follow the emitting entity. */
const float SOUNDFLAG_NOREPLACE = 128; /* Sounds started with this flag will be ignored when there's already a sound playing on that same ent-channel. */
@ -1425,11 +1423,9 @@ const float CLIENTTYPE_NOTACLIENT = 3; /* This entity is not even a player slot.
const float FILE_READ = 0; /* The file may be read via fgets to read a single line at a time. */
const float FILE_APPEND = 1; /* Like FILE_WRITE, but writing starts at the end of the file. */
const float FILE_WRITE = 2; /* fputs will be used to write to the file. */
#if defined(CSQC) || defined(SSQC)
const float FILE_READNL = 4; /* Like FILE_READ, except newlines are not special. fgets reads the entire file into a tempstring. */
const float FILE_MMAP_READ = 5; /* The file will be loaded into memory. fgets returns a pointer to the first byte (and will always return the same value for this file). Cast this to your datatype. */
const float FILE_MMAP_RW = 6; /* Like FILE_MMAP_READ, except any changes to the data will be written back to disk once the file is closed. */
#endif
#ifdef CSQC
const float MASK_ENGINE = 1; /* Valid as an argument for addentities. If specified, all non-csqc entities will be added to the scene. */
const float MASK_VIEWMODEL = 2; /* Valid as an argument for addentities. If specified, the regular engine viewmodel will be added to the scene. */
@ -1959,21 +1955,24 @@ string(string str) precache_file2 = #77;
#endif
#ifdef SSQC
void(entity player) setspawnparms = #78;
DEP float() finaleFinished_qex = #0:finaleFinished_qex; /*
float() ex_finaleFinished = #0:ex_finaleFinished; /*
Behaviour is undocumented. */
DEP void(entity client, string sample) localsound_qex = #0:localsound_qex; /*
void(entity client, string sample) ex_localsound = #0:ex_localsound; /*
Behaviour is undocumented. */
void(entity ent, string text, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5) centerprint_qex = #0:centerprint_qex; /*
void(entity ent, string text, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5) ex_centerprint = #0:ex_centerprint; /*
Remaster: Sends the strings to the client, which will order according to {#}. Also substitutes localised strings for $NAME strings. */
void(string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6) bprint_qex = #0:bprint_qex; /*
void(string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6) ex_bprint = #0:ex_bprint; /*
Remaster: Sends the strings to all clients, which will order them according to {#}. Also substitutes localised strings for $NAME strings. */
void(entity client, string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5) sprint_qex = #0:sprint_qex; /*
void(entity client, string s, optional string s0, optional string s1, optional string s2, optional string s3, optional string s4, optional string s5) ex_sprint = #0:ex_sprint; /*
Remaster: Sends the strings to the client, which will order according to {#}. Also substitutes localised strings for $NAME strings. */
float(entity playerEnt) ex_CheckPlayerEXFlags = #0:ex_CheckPlayerEXFlags; /*
Behaviour is undocumented. */
void(entity killer, entity killee) logfrag = #79; /* Part of QW_ENGINE*/
#endif
#if defined(CSQC) || defined(SSQC)
@ -2119,17 +2118,13 @@ void(string cvar, float val) cvar_setf = #176;
void(string soundname, optional float channel, optional float volume) localsound = #177; /*
Plays a sound... locally... probably best not to call this from ssqc. Also disables reverb. */
#endif
#ifdef SSQC
float(string soundname, float queryonly) getsoundindex = #0:getsoundindex; /*
Provides a way to query if a sound is already precached or not. The return value can also be checked for <=255 to see if it'll work over any network protocol. The sound index can also be used for writebyte hacks, but this is discouraged - use SOUNDFLAG_UNICAST instead. */
#endif
#if defined(CSQC) || defined(SSQC)
float(string modelname, optional float queryonly) getmodelindex = #200; /*
Acts as an alternative to precache_model(foo);setmodel(bar, foo); return bar.modelindex;
If queryonly is set and the model was not previously precached, the builtin will return 0 without needlessly precaching the model. */
float(string soundname, optional float queryonly) getsoundindex = #0:getsoundindex; /*
Provides a way to query if a sound is already precached or not. The return value can also be checked for <=255 to see if it'll work over any network protocol. The sound index can also be used for writebyte hacks, but this is discouraged - use SOUNDFLAG_UNICAST instead. */
__variant(float prnum, string funcname, ...) externcall = #201; /* Part of FTE_MULTIPROGS
Directly call a function in a different/same progs by its name.
prnum=0 is the 'default' or 'main' progs.
@ -2318,6 +2313,51 @@ float(float serveridx, float queryidx, float row, float column) sqlreadfloat = #
int(float serveridx, float queryidx, float row, float column, __variant *ptr, int maxsize) sqlreadblob = #0:sqlreadblob;
string(float serveridx, __variant *ptr, int maxsize) sqlescapeblob = #0:sqlescapeblob;
#endif
typedef struct json_s *json_t;
accessor jsonnode : json_t;
jsonnode(string) json_parse = #0:json_parse; /*
Parses the given JSON string. */
void(jsonnode) json_free = #0:json_free; /*
Frees a json tree and all of its children. Must only be called on the root node. */
enum json_type_e : int
{
JSON_TYPE_STRING,
JSON_TYPE_NUMBER,
JSON_TYPE_OBJECT,
JSON_TYPE_ARRAY,
JSON_TYPE_TRUE,
JSON_TYPE_FALSE,
JSON_TYPE_NULL
};
json_type_e(jsonnode node) json_get_value_type = #0:json_get_value_type; /*
Get type of a JSON value. */
int(jsonnode node) json_get_integer = #0:json_get_integer; /*
Get an integer from a json node. */
float(jsonnode node) json_get_float = #0:json_get_float; /*
Get a float from a json node. */
string(jsonnode node) json_get_string = #0:json_get_string; /*
Get a string from a value. Returns a null string if its not a string type. */
jsonnode(jsonnode node, string) json_find_object_child = #0:json_find_object_child; /*
Find a child of a json object by name. Returns NULL if the handle couldn't be found. */
int(jsonnode node) json_get_length = #0:json_get_length; /*
Get the length of a json array or object. Returns 0 if its not an array. */
jsonnode(jsonnode node, int childindex) json_get_child_at_index = #0:json_get_child_at_index; /*
Get the nth child of a json array or object. Returns NULL if the index is out of range. */
string(jsonnode node) json_get_name = #0:json_get_name; /*
Gets the object's name (useful if you're using json_get_child_at_index to walk an object's children for whatever reason). */
string(string javascript) js_run_script = #0:js_run_script; /*
Runs the provided javascript snippet. This builtin functions only in emscripten builds, returning a null string on other systems (or if the script evaluates to null). */
#if defined(CSQC) || defined(SSQC)
int(string) stoi = #259; /* Part of FTE_QC_INTCONV
Converts the given string into a true integer. Base 8, 10, or 16 is determined based upon the format of the string. */
@ -2511,7 +2551,10 @@ void(float buf, int fl) WriteInt = #0:WriteInt; /*
Writes all 4 bytes of a 32bit integer without truncating to a float first before converting back to an int (unlike WriteLong does, but otherwise equivelent). */
void(float buf, __int64 fl) WriteInt64 = #0:WriteInt64; /*
Writes all 8 bytes of a 64bit integer. */
Writes all 8 bytes of a 64bit integer. This uses variable-length coding and will send only a single byte for any value between -64 and 63. */
void(float buf, __uint64 fl) WriteUInt64 = #0:WriteUInt64; /*
Writes all 8 bytes of a 64bit unsigned integer. Values between 0-127 will be sent in a single byte. */
#endif
#if defined(CSQC) || defined(SSQC)
@ -2602,6 +2645,9 @@ void(float mask) addentities = #301; /*
void(entity ent) addentity = #302; /*
Copies the entity fields into a new rentity for later rendering via addscene. */
void(entity ent, vector lightdir, vector lightavg, vector lightrange, int reserved1=0,void*reserved2=0) addentity_lighting = #0:addentity_lighting; /*
Copies the entity fields into a new rentity for later rendering via addscene, but with explicit lighting info. */
#endif
#ifdef CSQC
void(entity ent) removeentity = #0:removeentity; /*
@ -2680,7 +2726,7 @@ string(string name, optional float flags) precache_pic = #317; /*
void(string imagename, int width, int height, void *pixeldata, optional int datasize, optional int format) r_uploadimage = #0:r_uploadimage; /* Part of FTE_CSQC_RAWIMAGES
Updates a texture with the specified rgba data (uploading it to the gpu). Will be created if needed. If datasize is specified then the image is decoded (eg .ktx or .dds data) instead of being raw R8G8B8A data. You'll typically want shaderforname to also generate a shader to use the texture. */
int*(string filename, __out int width, __out int height) r_readimage = #0:r_readimage; /* Part of FTE_CSQC_RAWIMAGES
int*(string filename, __out int width, __out int height, __out int format) r_readimage = #0:r_readimage; /* Part of FTE_CSQC_RAWIMAGES
Reads and decodes an image from disk, providing raw R8G8B8A8 pixel data. Should not be used for dds or ktx etc formats. Returns __NULL__ if the image could not be read for any reason. Use memfree to free the data once you're done with it. */
#endif
@ -2761,11 +2807,14 @@ __variant(float playernum, float statnum, float stattype) getplayerstat = #0:get
void(entity e, float mdlindex) setmodelindex = #333; /*
Sets a model by precache index instead of by name. Otherwise identical to setmodel. */
string(float mdlindex) modelnameforindex = #334; /*
Retrieves the name of the model based upon a precache index. This can be used to reduce csqc network traffic by enabling model matching. */
#endif
#if defined(CSQC) || defined(SSQC)
string(float mdlindex) modelnameforindex = #334; /*
Retrieves the name of the model based upon a precache index. This can be used to reduce csqc network traffic by enabling model matching (with getmodelindex). */
string(float sndindex) soundnameforindex = #0:soundnameforindex; /*
Retrieves the name of the sound based upon a precache index. This can be used to reduce csqc network traffic by enabling sound matching (with getsoundindex). */
float(string effectname) particleeffectnum = #335; /* Part of DP_ENT_TRAILEFFECTNUM, FTE_SV_POINTPARTICLES
Precaches the named particle effect. If your effect name is of the form 'foo.bar' then particles/foo.cfg will be loaded by the client if foo.bar was not already defined.
Different engines will have different particle systems, this specifies the QC API only. */
@ -2924,7 +2973,7 @@ void(string cmdname) registercommand = #352; /*
Console commands that are later used will invoke CSQC_ConsoleCommand/m_consolecommand/ConsoleCmd according to module. */
float(entity ent) wasfreed = #353; /*
Quickly check to see if the entity is currently free. This function is only valid during the two-second non-reuse window, after that it may give bad results. Try one second to make it more robust. */
Quickly check to see if the entity is currently free. This function is only valid during the half-second non-reuse window, after that it may give bad results. Try one second to make it more robust. */
#if defined(CSQC) || defined(SSQC)
string(string key) serverkey = #354; /*
@ -2994,7 +3043,10 @@ int() readint = #0:readint; /*
Reads a 32bit int without any conversions to float, otherwise interchangable with readlong. */
__int64() readint64 = #0:readint64; /*
Reads a 64bit int. Paired with WriteInt64. */
Reads a 64bit signed int. Paired with WriteInt64. */
__uint64() readuint64 = #0:readuint64; /*
Reads a 64bit unsigned int. Paired with WriteUInt64. */
float() readentitynum = #368; /*
Reads the serverside index of an entity, paired with WriteEntity. There may be nothing else known about the entity yet, so the result typically needs to be saved as-is and re-looked up each frame. This can be done via getentity(NUM, GE_*) for non-csqc ents, or findentity(world,entnum,NUM) - both of which can fail due to latency. */
@ -3051,7 +3103,7 @@ void(float devid, float left, float right, float duration) gp_rumbletriggers = #
void(float devid, vector color) gp_setledcolor = #0:gp_setledcolor; /*
Updates the game-pad LED color. */
void(float devid, const void *data, int size) gp_settriggerfx = #0:gp_settriggerfx; /*
void(float devid, /*const*/ void *data, int size) gp_settriggerfx = #0:gp_settriggerfx; /*
Sends a specific effect packet to the controller. On the PlayStation 5's DualSense that can adjust the tension on the analog triggers. */
#endif
@ -3396,6 +3448,8 @@ DEP string(float keynum) keynumtostring_omgwtf = #520;
__deprecated("Does not support modifiers") string(string command, optional float bindmap) findkeysforcommand = #521; /*
Returns a list of keycodes that perform the given console command in a format that can only be parsed via tokenize (NOT tokenize_console). This only and always returns two values - if only one key is actually bound, -1 will be returned. The bindmap argument is listed for compatibility with dp-specific defs, but is ignored in FTE. */
#endif
#if defined(CSQC) || defined(MENU)
string(string command, optional float bindmap) findkeysforcommandex = #0:findkeysforcommandex; /*
Returns a list of key bindings in keyname format instead of keynums. Use tokenize to parse. This list may contain modifiers. May return large numbers of keys. */
@ -3424,7 +3478,8 @@ float(entity e, float channel, string newsample, float volume, float attenuation
float(entity e, float channel) getsoundtime = #533; /*
Returns the current playback time of the sample on the given entity's channel. Beware CHAN_AUTO (in csqc, channels are not limited by network protocol). */
float(entity e, float channel) getchannellevel = #0:getchannellevel; /* */
float(entity e, float channel) getchannellevel = #0:getchannellevel; /*
Reports how load the sound's sample is at its current offset. */
#endif
#if defined(CSQC) || defined(MENU)
@ -3520,7 +3575,9 @@ string() getextresponse = #624; /* Part of FTE_CSQC_SERVERBROWSER*/
#endif
string(string dnsname, optional float defport) netaddress_resolve = #625;
#if defined(CSQC) || defined(MENU)
string(float n, float prop) getgamedirinfo = #626;
string(float n, float prop) getgamedirinfo = #626; /*
Queries properties about an indexed gamedir (or -1 for the current gamedir). Returns null strings when out of bounds. Use the GDDI_* constants for the prop arg. */
string(int n, int prop) getpackagemanagerinfo = #0:getpackagemanagerinfo; /*
Queries information about a package from the engine's package manager subsystem. Actions can be taken via the pkg console command. */
@ -3687,6 +3744,8 @@ const float K_SCROLLLOCK = 156;
const float K_SEMICOLON = 59;
const float K_PLUS = 43;
const float K_MINUS = 45;
const float K_APOSTROPHE = 39;
const float K_QUOTES = 34;
const float K_TILDE = 126;
const float K_BACKQUOTE = 96;
const float K_BACKSLASH = 92;
@ -3759,6 +3818,17 @@ accessor filestream : float
inline set string = {fputs(this,value);};
};
#endif
accessor jsonnode : json_t
{
inline get json_type_e type = json_get_value_type;
inline get string s = json_get_string;
inline get float f = json_get_float;
inline get __int i = json_get_integer;
inline get __int length = json_get_length;
inline get jsonnode a[__int key] = json_get_child_at_index;
inline get jsonnode[string key] = json_find_object_child;
inline get string name = json_get_name;
};
#undef DEP_CSQC
#undef FTEDEP
#undef DEP
@ -3766,8 +3836,6 @@ accessor filestream : float
typedef enum
{
true = 1,
false = 0,
TRUE = 1,
FALSE = 0
false,
true
} bool;