fteqw/engine/common/particles.h

256 lines
6.8 KiB
C
Raw Permalink Normal View History

#ifndef _PARTICLES_H_
#define _PARTICLES_H_
extern int
pt_gunshot,
ptdp_gunshotquad,
pt_spike,
ptdp_spikequad,
pt_superspike,
ptdp_superspikequad,
pt_wizspike,
pt_knightspike,
pt_explosion,
ptdp_explosionquad,
pt_tarexplosion,
pt_teleportsplash,
pt_lavasplash,
ptdp_smallflash,
ptdp_flamejet,
ptdp_flame,
ptdp_blood,
ptdp_spark,
ptdp_plasmaburn,
ptdp_tei_g3,
ptdp_tei_smoke,
ptdp_tei_bigexplosion,
ptdp_tei_plasmahit,
ptdp_stardust,
rt_rocket,
rt_grenade,
rt_blood,
rt_wizspike,
rt_slightblood,
rt_knightspike,
rt_vorespike,
rtdp_nexuizplasma,
rtdp_glowtrail,
ptqw_blood,
ptqw_lightningblood,
rtqw_railtrail, //common to zquake/fuhquake/fte
ptfte_bullet,
ptfte_superbullet;
#ifdef Q2CLIENT
/*WARNING: must match cl_tent.c*/
typedef enum
{
/*MUST start with standard q2 te effects*/
Q2TE_GUNSHOT = 0, //0
Q2TE_BLOOD,
Q2TE_BLASTER,
Q2TE_RAILTRAIL,
Q2TE_SHOTGUN,
Q2TE_EXPLOSION1,
Q2TE_EXPLOSION2,
Q2TE_ROCKET_EXPLOSION,
Q2TE_GRENADE_EXPLOSION,
Q2TE_SPARKS,
Q2TE_SPLASH, //10
Q2TE_BUBBLETRAIL,
Q2TE_SCREEN_SPARKS,
Q2TE_SHIELD_SPARKS,
Q2TE_BULLET_SPARKS,
Q2TE_LASER_SPARKS,
Q2TE_PARASITE_ATTACK,
Q2TE_ROCKET_EXPLOSION_WATER,
Q2TE_GRENADE_EXPLOSION_WATER,
Q2TE_MEDIC_CABLE_ATTACK,
Q2TE_BFG_EXPLOSION, //20
Q2TE_BFG_BIGEXPLOSION,
Q2TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!!
Q2TE_BFG_LASER,
Q2TE_GRAPPLE_CABLE,
Q2TE_WELDING_SPARKS,
Q2TE_GREENBLOOD,
Q2TE_BLUEHYPERBLASTER,
Q2TE_PLASMA_EXPLOSION,
Q2TE_TUNNEL_SPARKS,
//ROGUE
Q2TE_BLASTER2, //30
Q2TE_RAILTRAIL2,
Q2TE_FLAME,
Q2TE_LIGHTNING,
Q2TE_DEBUGTRAIL,
Q2TE_PLAIN_EXPLOSION,
Q2TE_FLASHLIGHT,
Q2TE_FORCEWALL,
Q2TE_HEATBEAM,
Q2TE_MONSTER_HEATBEAM,
Q2TE_STEAM, //40
Q2TE_BUBBLETRAIL2,
Q2TE_MOREBLOOD,
Q2TE_HEATBEAM_SPARKS,
Q2TE_HEATBEAM_STEAM,
Q2TE_CHAINFIST_SMOKE,
Q2TE_ELECTRIC_SPARKS,
Q2TE_TRACKER_EXPLOSION,
Q2TE_TELEPORT_EFFECT,
Q2TE_DBALL_GOAL,
Q2TE_WIDOWBEAMOUT, //50
Q2TE_NUKEBLAST,
Q2TE_WIDOWSPLASH,
Q2TE_EXPLOSION1_BIG,
Q2TE_EXPLOSION1_NP,
Q2TE_FLECHETTE,
//ROGUE
//CODERED
CRTE_LEADERBLASTER, //56
CRTE_BLASTER_MUZZLEFLASH,
CRTE_BLUE_MUZZLEFLASH,
CRTE_SMART_MUZZLEFLASH,
CRTE_LEADERFIELD, //60
CRTE_DEATHFIELD,
CRTE_BLASTERBEAM,
CRTE_STAIN,
CRTE_FIRE,
CRTE_CABLEGUT,
CRTE_SMOKE,
//CODERED
#define Q2TE_MAX CRTE_SMOKE
/*splashes are somewhat special, but are dynamically indexed*/
Q2SPLASH_UNKNOWN, //0
Q2SPLASH_SPARKS, //1
Q2SPLASH_BLUE_WATER, //2
Q2SPLASH_BROWN_WATER, //3
Q2SPLASH_SLIME, //4
Q2SPLASH_LAVA, //5
Q2SPLASH_BLOOD, //6
#define Q2SPLASH_MAX Q2SPLASH_BLOOD
/*free form*/
/*WARNING: must match cl_tent.c*/
Q2RT_BLASTERTRAIL,
Q2RT_BLASTERTRAIL2,
Q2RT_GIB,
Q2RT_GREENGIB,
Q2RT_ROCKET,
Q2RT_GRENADE,
Q2RT_TRAP,
Q2RT_FLAG1,
Q2RT_FLAG2,
Q2RT_TAGTRAIL,
Q2RT_TRACKER,
Q2RT_IONRIPPER,
Q2RT_PLASMA,
Q2PT_BFGPARTICLES,
Q2PT_FLIES,
Q2PT_TRAP,
Q2PT_TRACKERSHELL,
Q2PT_RESPAWN,
Q2PT_PLAYER_TELEPORT,
Q2PT_FOOTSTEP,
Q2PT_MAX
} q2particleeffects_t;
extern int pt_q2[];
#endif
typedef quint32_t trailkey_t;
#define trailkey_null 0
#define PARTICLE_Z_CLIP 8.0
typedef enum {
BM_BLEND/*SRC_ALPHA ONE_MINUS_SRC_ALPHA*/,
BM_BLENDCOLOUR/*SRC_COLOR ONE_MINUS_SRC_COLOR*/,
BM_ADDA/*SRC_ALPHA ONE*/,
BM_ADDC/*GL_SRC_COLOR GL_ONE*/,
BM_SUBTRACT/*SRC_ALPHA ONE_MINUS_SRC_COLOR*/,
BM_INVMODA/*ZERO ONE_MINUS_SRC_ALPHA*/,
BM_INVMODC/*ZERO ONE_MINUS_SRC_COLOR*/,
BM_PREMUL/*ONE ONE_MINUS_SRC_ALPHA*/,
BM_RTSMOKE /*special shader generation that causes these particles to be lit up by nearby rtlights, instead of just being fullbright junk*/
} blendmode_t;
#define frandom() (rand()*(1.0f/(float)RAND_MAX))
#define crandom() (rand()*(2.0f/(float)RAND_MAX)-1.0f)
#define hrandom() (rand()*(1.0f/(float)RAND_MAX)-0.5f)
#define P_INVALID -1
#define P_RunParticleEffectType(a,b,c,d) P_RunParticleEffectState(a,b,c,d,NULL)
// used for callback
extern cvar_t r_particlesdesc;
extern cvar_t r_particlesystem;
struct model_s;
struct msurface_s;
void P_InitParticleSystem(void);
void P_ShutdownParticleSystem(void);
void P_Shutdown(void);
void P_LoadedModel(struct model_s *mod); /*checks a model's various effects*/
void P_DefaultTrail (unsigned int entityeffects, unsigned int modelflags, int *trailid, int *trailpalidx);
void P_EmitEffect (vec3_t pos, vec3_t orientation[3], unsigned int modeleflags, int type, trailkey_t *tsk);//this is just a wrapper
Reworked client support for DPP5+. less code now, its much more graceful. added waterfog command. waterfog overrides regular fog only when the view is in water. fixed 64bit printf format specifiers. should work better on winxp64. fixed some spec angle weirdness. fixed viewsize 99.99 weirdness with ezhud. fixed extra offset on the console (exhibited in 64bit builds, but not limited to). fixed .avi playback, can now actually display frames again. reimplemented line sparks. fixed r_editlights_save flipping the light's pitch. fixed issue with oggs failing to load. fixed condump to cope with unicode properly. made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision. fixed nq server to not stall weirdly on map changes. fixed qwprogs svc_cdtrack not bugging out with nq clients on the server. fixed restart command to load the last map run by the server, instead of start.bsp (when idle) optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now. fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised). fixed a couple of bugs from font change. also now supports utf-8 in a few more places. r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little). fixed so corona-only lights won't generate shadowmaps and waste lots of time. removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet. fixed nested calls with variant-vectors. this fixes csaddon's light editor. fixed qcc hc calling conventions using redundant stores. disabled keywords can still be used by using __keyword instead. fixed ftegccgui grep feature. fixed motionless-dog qcc bug. tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings. fixed qw svc_intermission + dpp5+ clients bug. fixed annoying spam about disconnecting in hexen2. rewrote status command a little to cope with ipv6 addresses more gracefully fixed significant stall when hibernating/debugging a server with a player sitting on it. fixed truelightning. fixed rocketlight overriding pflags. fixed torches vanishing on vid_restart. fixed issue with decal scaling. fixed findentityfield builtin. fixed fteqcc issue with ptr+1 fixed use of arrays inside class functions. fixed/implemented fteqcc emulation of pointer opcodes. added __inout keyword to fteqcc, so that it doesn't feel so horrendous. fixed sizeof(*foo) fixed *struct = struct; fixed recursive structs. fixed fteqcc warning report. fixed sdl2 controller support, hopefully. attempted to implement xinput, including per-player audio playback. slightly fixed relaxed attitude to mouse focus when running fullscreen. fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors. implemented bindmaps (for csqc). fixed crashing bug with eprint builtin. implemented subset of music_playlist_* functionality. significant changes to music playback. fixed some more dpcsqc compat. fixed binds menu. now displays and accepts modifiers. fixed issues with huge lightmaps. fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests. implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh. implemented sv_saveentfile command. fixed resume after breaking inside a stepped-over function. fixed erroneous footer after debugging. (I wonder just how many things I broke with these fixes) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 11:56:18 +01:00
int P_FindParticleType(const char *efname);
#ifdef PSET_SCRIPT
void PScript_ClearSurfaceParticles(struct model_s *mod);
#endif
#define P_RunParticleEffectTypeString pe->RunParticleEffectTypeString
#define P_ParticleTrail pe->ParticleTrail
#define P_RunParticleEffectState pe->RunParticleEffectState
#define P_RunParticleWeather pe->RunParticleWeather
#define P_RunParticleCube pe->RunParticleCube
#define P_RunParticleEffect pe->RunParticleEffect
#define P_RunParticleEffect2 pe->RunParticleEffect2
#define P_RunParticleEffect3 pe->RunParticleEffect3
#define P_RunParticleEffect4 pe->RunParticleEffect4
added qccgui icon (courtesy of shpuld) isolated transfers a little. added preliminary support for r1q2 and q2pro protocols (no zlib). fixed some missing q2 hud configstrings. fixed models attached to particles not appearing the first time around. fixed halos appearing on {foo fullbright textures. fix particle crash bug from missing particlecubes. implement r_converteffectinfo (instead of r_importeffectinfo with r_exportalleffects) for convenience. also now more complete and more accurate. loadfont no longer auto-allocates slot 0. fix issues with r_dynamic -1 don't restart audio on vid_reload (only reload it). this fixes audio issues with capturedemo with gamedir changes. fix possible crash from loading sounds during an audio reload/restart. now listens on both ports 27500 and 26000 when running quake, by default. sv_port or -port args will override. work around surfedge corruption in some instance of the slide4 map that dimman found. attempt to nudge players to travel at at least 200qu when travelling vertically through portals. this should help alieviate gravity-induced stuttering issues. fix nested function types used in conjunction with op_state. now assumes static within the parent. optimise array indexes slightly. fix issue with ptr[float].foo fix some qcc bugs to do with implicit type conversions fix a portal / angle protocol extension issue, so legacy clients can use portals, they just can't see the other side (nor predict them). fix q2 victory.pcx issue at the end of the game. use abort/sigabort instead of sigsegv on linux sys_errors. this should help get people to report stuff better. reformat the nq server advertising to be more helpful. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4996 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-12-28 17:41:39 +00:00
#define P_RunParticleEffectPalette pe->RunParticleEffectPalette
#define P_ParticleTrailIndex pe->ParticleTrailIndex
#define P_InitParticles pe->InitParticles
#define P_DelinkTrailstate pe->DelinkTrailstate
#define P_ClearParticles pe->ClearParticles
#define P_DrawParticles pe->DrawParticles
typedef struct {
char *name1;
char *name2;
rewrote ban code, merging bans+nonbans+cuffs+mute+cripple+deaf+lagged+vip. added timeouts. new penalties have no dedicated command. use the addip command for it. maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
2014-03-30 09:55:06 +01:00
int (*FindParticleType) (const char *name);
qboolean (*ParticleQuery) (int type, int body, char *outstr, int outstrlen);
int (*RunParticleEffectTypeString) (vec3_t org, vec3_t dir, float count, char *name);
int (*ParticleTrail) (vec3_t startpos, vec3_t end, int type, float timeinterval, int dlkey, vec3_t dlaxis[3], trailkey_t *tk);
int (*RunParticleEffectState) (vec3_t org, vec3_t dir, float count, int typenum, trailkey_t *tk);
void (*RunParticleWeather) (vec3_t minb, vec3_t maxb, vec3_t dir, float count, int colour, char *efname);
void (*RunParticleCube) (int typenum, vec3_t minb, vec3_t maxb, vec3_t dir_min, vec3_t dir_max, float count, int colour, qboolean gravity, float jitter); //typenum may be P_INVALID
void (*RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count);
void (*RunParticleEffect2) (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count);
void (*RunParticleEffect3) (vec3_t org, vec3_t box, int color, int effect, int count);
void (*RunParticleEffect4) (vec3_t org, float radius, int color, int effect, int count);
added qccgui icon (courtesy of shpuld) isolated transfers a little. added preliminary support for r1q2 and q2pro protocols (no zlib). fixed some missing q2 hud configstrings. fixed models attached to particles not appearing the first time around. fixed halos appearing on {foo fullbright textures. fix particle crash bug from missing particlecubes. implement r_converteffectinfo (instead of r_importeffectinfo with r_exportalleffects) for convenience. also now more complete and more accurate. loadfont no longer auto-allocates slot 0. fix issues with r_dynamic -1 don't restart audio on vid_reload (only reload it). this fixes audio issues with capturedemo with gamedir changes. fix possible crash from loading sounds during an audio reload/restart. now listens on both ports 27500 and 26000 when running quake, by default. sv_port or -port args will override. work around surfedge corruption in some instance of the slide4 map that dimman found. attempt to nudge players to travel at at least 200qu when travelling vertically through portals. this should help alieviate gravity-induced stuttering issues. fix nested function types used in conjunction with op_state. now assumes static within the parent. optimise array indexes slightly. fix issue with ptr[float].foo fix some qcc bugs to do with implicit type conversions fix a portal / angle protocol extension issue, so legacy clients can use portals, they just can't see the other side (nor predict them). fix q2 victory.pcx issue at the end of the game. use abort/sigabort instead of sigsegv on linux sys_errors. this should help get people to report stuff better. reformat the nq server advertising to be more helpful. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4996 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-12-28 17:41:39 +00:00
void (*RunParticleEffectPalette) (const char *nameprefix, vec3_t org, vec3_t dir, int color, int count);
void (*ParticleTrailIndex) (vec3_t start, vec3_t end, int type, float timeinterval, int color, int crnd, trailkey_t *tk); //P_INVALID is fine for the type here, you'll get a default trail.
qboolean (*InitParticles) (void);
void (*ShutdownParticles) (void);
void (*DelinkTrailstate) (trailkey_t *tk);
void (*ClearParticles) (void);
void (*DrawParticles) (void);
} particleengine_t;
extern particleengine_t *pe;
#endif