From: TimePath Date: Mon, 21 Sep 2015 10:41:02 +0000 (+1000) Subject: Group effects in a folder X-Git-Tag: xonotic-v0.8.2~1922^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e96921cf1aaf000518f93645539e2c3baa60f528;p=xonotic%2Fxonotic-data.pk3dir.git Group effects in a folder --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 7e36cabec..70e2c99fe 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -8,7 +8,7 @@ #include "../common/animdecide.qh" #include "../common/csqcmodel_settings.qh" -#include "../common/effects.qh" +#include "../common/effects/effects.qh" #include "../common/teams.qh" #include "../common/triggers/trigger/viewloc.qh" diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index ec0328116..21c1a79b6 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -7,7 +7,7 @@ #include "../common/constants.qh" #include "../common/deathtypes.qh" -#include "../common/effects.qh" +#include "../common/effects/effects.qh" #include "../common/movetypes/movetypes.qh" #include "../common/util.qh" diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 17a3fce1c..798b7c7dd 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -28,7 +28,7 @@ #include "../common/buffs.qh" #include "../common/deathtypes.qh" -#include "../common/effects.qh" +#include "../common/effects/effects.qh" #include "../common/mapinfo.qh" #include "../common/monsters/all.qh" #include "../common/nades.qh" diff --git a/qcsrc/client/progs.inc b/qcsrc/client/progs.inc index b46a371de..b985e36f6 100644 --- a/qcsrc/client/progs.inc +++ b/qcsrc/client/progs.inc @@ -37,7 +37,7 @@ #include "../common/animdecide.qc" #include "../common/buffs.qc" -#include "../common/effects.qc" +#include "../common/effects/effects.qc" #include "../common/mapinfo.qc" #include "../common/movetypes/include.qc" #include "../common/nades.qc" diff --git a/qcsrc/common/effects.inc b/qcsrc/common/effects.inc deleted file mode 100644 index 8cd4d4995..000000000 --- a/qcsrc/common/effects.inc +++ /dev/null @@ -1,189 +0,0 @@ -// Global list of effects, networked to CSQC by ID to save bandwidth and to use client particle numbers (allows mismatching effectinfos to some degree) -// Not too concerned about the order of this list, just keep the weapon effects together! - -// EFFECT(istrail, EFFECT_NAME, "effectinfo_string") -EFFECT(0, EXPLOSION_SMALL, "explosion_small") -EFFECT(0, EXPLOSION_MEDIUM, "explosion_medium") -EFFECT(0, EXPLOSION_BIG, "explosion_big") - -EFFECT(0, SMOKE_SMALL, "smoke_small") -EFFECT(0, SMOKE_LARGE, "smoke_large") - - - -EFFECT(0, BLASTER_IMPACT, "laser_impact") -EFFECT(0, BLASTER_MUZZLEFLASH, "laser_muzzleflash") - -EFFECT(0, SHOTGUN_IMPACT, "shotgun_impact") -EFFECT(0, SHOTGUN_MUZZLEFLASH, "shotgun_muzzleflash") - -EFFECT(0, ARC_BEAM, "arc_beam") -EFFECT(0, ARC_BEAM_HEAL, "arc_beam_heal") -EFFECT(0, ARC_BEAM_HEAL_IMPACT, "arc_beam_healimpact") -EFFECT(0, ARC_BEAM_HEAL_IMPACT2, "healray_impact") -EFFECT(0, ARC_LIGHTNING, "arc_lightning") -EFFECT(0, ARC_LIGHTNING2, "electro_lightning") - -EFFECT(0, MACHINEGUN_IMPACT, "machinegun_impact") -EFFECT(0, MACHINEGUN_MUZZLEFLASH, "uzi_muzzleflash") - -EFFECT(0, GRENADE_EXPLODE, "grenade_explode") -EFFECT(0, GRENADE_MUZZLEFLASH, "grenadelauncher_muzzleflash") - -EFFECT(0, ELECTRO_BALLEXPLODE, "electro_ballexplode") -EFFECT(0, ELECTRO_COMBO, "electro_combo") -EFFECT(0, ELECTRO_IMPACT, "electro_impact") -EFFECT(0, ELECTRO_MUZZLEFLASH, "electro_muzzleflash") - -EFFECT(0, CRYLINK_IMPACT, "crylink_impactbig") -EFFECT(0, CRYLINK_IMPACT2, "crylink_impact") -EFFECT(0, CRYLINK_JOINEXPLODE, "crylink_joinexplode") -EFFECT(0, CRYLINK_MUZZLEFLASH, "crylink_muzzleflash") - -EFFECT(0, VORTEX_BEAM, "nex_beam") -EFFECT(0, VORTEX_BEAM_OLD, "TE_TEI_G3") -EFFECT(0, VORTEX_IMPACT, "nex_impact") -EFFECT(0, VORTEX_MUZZLEFLASH, "nex_muzzleflash") - -EFFECT(1, VAPORIZER_RED, "TE_TEI_G3RED") -EFFECT(1, VAPORIZER_RED_HIT, "TE_TEI_G3RED_HIT") -EFFECT(1, VAPORIZER_BLUE, "TE_TEI_G3BLUE") -EFFECT(1, VAPORIZER_BLUE_HIT, "TE_TEI_G3BLUE_HIT") -EFFECT(1, VAPORIZER_YELLOW, "TE_TEI_G3YELLOW") -EFFECT(1, VAPORIZER_YELLOW_HIT, "TE_TEI_G3YELLOW_HIT") -EFFECT(1, VAPORIZER_PINK, "TE_TEI_G3PINK") -EFFECT(1, VAPORIZER_PINK_HIT, "TE_TEI_G3PINK_HIT") -EFFECT(1, VAPORIZER_NEUTRAL, "TE_TEI_G3") -EFFECT(1, VAPORIZER_NEUTRAL_HIT, "TE_TEI_G3_HIT") - -EFFECT(0, RIFLE_IMPACT, "machinegun_impact") -EFFECT(0, RIFLE_MUZZLEFLASH, "rifle_muzzleflash") -EFFECT(1, RIFLE, "tr_rifle") -EFFECT(1, RIFLE_WEAK, "tr_rifle_weak") - -EFFECT(0, HAGAR_BOUNCE, "hagar_bounce") -EFFECT(0, HAGAR_EXPLODE, "hagar_explode") -EFFECT(0, HAGAR_MUZZLEFLASH, "hagar_muzzleflash") -EFFECT(1, HAGAR_ROCKET, "tr_hagar") - -EFFECT(0, ROCKET_EXPLODE, "rocket_explode") -EFFECT(0, ROCKET_GUIDE, "rocket_guide") -EFFECT(0, ROCKET_MUZZLEFLASH, "rocketlauncher_muzzleflash") - -EFFECT(0, HOOK_EXPLODE, "hookbomb_explode") -EFFECT(0, HOOK_IMPACT, "grapple_impact") -EFFECT(0, HOOK_MUZZLEFLASH, "grapple_muzzleflash") - -EFFECT(0, SEEKER_MUZZLEFLASH, "seeker_muzzleflash") - -EFFECT(0, FLAK_BOUNCE, "flak_bounce") - -EFFECT(1, FIREBALL, "fireball") -EFFECT(0, FIREBALL_BFGDAMAGE, "fireball_bfgdamage") -EFFECT(0, FIREBALL_EXPLODE, "fireball_explode") -EFFECT(0, FIREBALL_LASER, "fireball_laser") -EFFECT(0, FIREBALL_MUZZLEFLASH, "fireball_muzzleflash") -EFFECT(0, FIREBALL_PRE_MUZZLEFLASH, "fireball_preattack_muzzleflash") - - - -EFFECT(0, RAPTOR_CANNON_IMPACT, "raptor_cannon_impact") -EFFECT(0, RAPTOR_BOMB_IMPACT, "raptor_bomb_impact") -EFFECT(0, RAPTOR_BOMB_SPREAD, "raptor_bomb_spread") -EFFECT(0, RAPTOR_MUZZLEFLASH, "raptor_cannon_muzzleflash") - -EFFECT(0, RACER_BOOSTER, "wakizashi_booster_smoke") -EFFECT(0, RACER_IMPACT, "wakizashi_gun_impact") -EFFECT(0, RACER_MUZZLEFLASH, "wakizashi_gun_muzzleflash") -EFFECT(0, RACER_ROCKETLAUNCH, "wakizashi_rocket_launch") -EFFECT(0, RACER_ROCKET_EXPLODE, "wakizashi_rocket_launch") -EFFECT(1, RACER_ROCKET_TRAIL, "wakizashi_rocket_thrust") - -EFFECT(0, SPIDERBOT_ROCKETLAUNCH, "spiderbot_rocket_launch") -EFFECT(1, SPIDERBOT_ROCKET_TRAIL, "spiderbot_rocket_thrust") -EFFECT(0, SPIDERBOT_ROCKET_EXPLODE, "spiderbot_rocket_explode") -EFFECT(0, SPIDERBOT_MINIGUN_IMPACT, "spiderbot_minigun_impact") -EFFECT(0, SPIDERBOT_MINIGUN_MUZZLEFLASH, "spiderbot_minigun_muzzleflash") - -EFFECT(0, BUMBLEBEE_HEAL_MUZZLEFLASH, "healray_muzzleflash") -EFFECT(0, BUMBLEBEE_HEAL_IMPACT, "healray_impact") - -EFFECT(0, BIGPLASMA_IMPACT, "bigplasma_impact") -EFFECT(0, BIGPLASMA_MUZZLEFLASH, "bigplasma_muzzleflash") - -EFFECT(0, TELEPORT, "teleport") - -EFFECT(0, SPAWNPOINT_RED, "spawn_point_red") -EFFECT(0, SPAWN_RED, "spawn_event_red") -EFFECT(0, SPAWNPOINT_BLUE, "spawn_point_blue") -EFFECT(0, SPAWN_BLUE, "spawn_event_blue") -EFFECT(0, SPAWNPOINT_YELLOW, "spawn_point_yellow") -EFFECT(0, SPAWN_YELLOW, "spawn_event_yellow") -EFFECT(0, SPAWNPOINT_PINK, "spawn_point_pink") -EFFECT(0, SPAWN_PINK, "spawn_event_pink") -EFFECT(0, SPAWNPOINT_NEUTRAL, "spawn_point_neutral") -EFFECT(0, SPAWN_NEUTRAL, "spawn_event_neutral") - -EFFECT(0, NADE_RED_EXPLODE, "nade_red_explode") -EFFECT(0, NADE_BLUE_EXPLODE, "nade_blue_explode") -EFFECT(0, NADE_YELLOW_EXPLODE, "nade_yellow_explode") -EFFECT(0, NADE_PINK_EXPLODE, "nade_pink_explode") -EFFECT(0, NADE_NEUTRAL_EXPLODE, "nade_neutral_explode") - -EFFECT(0, ICEORGLASS, "iceorglass") -EFFECT(0, ICEFIELD, "icefield") -EFFECT(0, FIREFIELD, "firefield") -EFFECT(0, HEALING, "healing_fx") -EFFECT(1, LASER_BEAM_FAST, "nex242_misc_laser_beam_fast") -EFFECT(0, RESPAWN_GHOST, "respawn_ghost") - -EFFECT(0, FLAG_RED_TOUCH, "redflag_touch") -EFFECT(0, FLAG_BLUE_TOUCH, "blueflag_touch") -EFFECT(0, FLAG_YELLOW_TOUCH, "yellowflag_touch") -EFFECT(0, FLAG_PINK_TOUCH, "pinkflag_touch") -EFFECT(0, FLAG_NEUTRAL_TOUCH, "neutralflag_touch") -EFFECT(1, RED_PASS, "red_pass") -EFFECT(1, BLUE_PASS, "blue_pass") -EFFECT(1, YELLOW_PASS, "yellow_pass") -EFFECT(1, PINK_PASS, "pink_pass") -EFFECT(1, NEUTRAL_PASS, "neutral_pass") -EFFECT(0, RED_CAP, "red_cap") -EFFECT(0, BLUE_CAP, "blue_cap") -EFFECT(0, YELLOW_CAP, "yellow_cap") -EFFECT(0, PINK_CAP, "pink_cap") - -EFFECT(0, ITEM_PICKUP, "item_pickup") -EFFECT(0, ITEM_RESPAWN, "item_respawn") - -EFFECT(0, ONS_GENERATOR_DAMAGED, "torch_small") -EFFECT(0, ONS_GENERATOR_GIB, "onslaught_generator_gib_explode") -EFFECT(0, ONS_GENERATOR_EXPLODE, "onslaught_generator_smallexplosion") -EFFECT(0, ONS_GENERATOR_EXPLODE2, "onslaught_generator_finalexplosion") - - - -EFFECT(0, LASER_DEADLY, "laser_deadly") -EFFECT(1, FLAC_TRAIL, "TR_SEEKER") -EFFECT(1, SEEKER_TRAIL, "TR_SEEKER") -EFFECT(1, FIREMINE, "firemine") -EFFECT(0, BALL_SPARKS, "kaball_sparks") -EFFECT(0, ELECTRIC_SPARKS, "electricity_sparks") -EFFECT(0, SPARKS, "sparks") -EFFECT(0, RAGE, "rage") -EFFECT(0, SMOKING, "smoking") -EFFECT(0, SMOKE_RING, "smoke_ring") -EFFECT(0, JUMPPAD, "jumppad_activate") -EFFECT(1, BULLET, "tr_bullet") -EFFECT(0, EF_FLAME, "EF_FLAME") -EFFECT(0, EF_STARDUST, "EF_STARDUST") -EFFECT(0, TE_EXPLOSION, "TE_EXPLOSION") -EFFECT(1, TR_NEXUIZPLASMA, "TR_NEXUIZPLASMA") -EFFECT(1, TR_CRYLINKPLASMA, "TR_CRYLINKPLASMA") -EFFECT(1, TR_ROCKET, "TR_ROCKET") -EFFECT(1, TR_GRENADE, "TR_GRENADE") -EFFECT(1, TR_BLOOD, "TR_BLOOD") -EFFECT(1, TR_WIZSPIKE, "TR_WIZSPIKE") -EFFECT(1, TR_SLIGHTBLOOD, "TR_SLIGHTBLOOD") -EFFECT(1, TR_KNIGHTSPIKE, "TR_KNIGHTSPIKE") -EFFECT(1, TR_VORESPIKE, "TR_VORESPIKE") -EFFECT(0, TE_SPARK, "TE_SPARK") diff --git a/qcsrc/common/effects.qc b/qcsrc/common/effects.qc deleted file mode 100644 index 242145f0b..000000000 --- a/qcsrc/common/effects.qc +++ /dev/null @@ -1,97 +0,0 @@ -#ifdef CSQC -void Read_Effect(bool is_new) -{ -#if EFFECTS_COUNT >= 255 - int net_name = ReadShort(); -#else - int net_name = ReadByte(); -#endif - - entity eff = effects_ent[net_name]; - - vector v, vel = '0 0 0'; - int eff_cnt = 1; - bool eff_trail = eff.eent_eff_trail; - v_x = ReadCoord(); - v_y = ReadCoord(); - v_z = ReadCoord(); - - bool use_vel = ReadByte(); - if(use_vel) - { - vel_x = ReadCoord(); - vel_y = ReadCoord(); - vel_z = ReadCoord(); - } - - if(!eff_trail) - eff_cnt = ReadByte(); - - if(is_new) - { - if(eff_trail) - WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel); - else - pointparticles(particleeffectnum(eff), v, vel, eff_cnt); - } -} -#endif - -#ifdef SVQC -bool Net_Write_Effect(entity client, int sf) -{SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT); -#if EFFECTS_COUNT >= 255 - WriteShort(MSG_ENTITY, self.m_id); -#else - WriteByte(MSG_ENTITY, self.m_id); -#endif - WriteCoord(MSG_ENTITY, self.eent_net_location_x); - WriteCoord(MSG_ENTITY, self.eent_net_location_y); - WriteCoord(MSG_ENTITY, self.eent_net_location_z); - - // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set - if(self.eent_net_velocity) - { - WriteByte(MSG_ENTITY, true); - WriteCoord(MSG_ENTITY, self.eent_net_velocity_x); - WriteCoord(MSG_ENTITY, self.eent_net_velocity_y); - WriteCoord(MSG_ENTITY, self.eent_net_velocity_z); - } - else { WriteByte(MSG_ENTITY, false); } - - if(!self.eent_eff_trail) { WriteByte(MSG_ENTITY, self.eent_net_count); } - return true; -} - -void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt) -{ - if(!eff) { return; } - if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count! - entity net_eff = spawn(); - net_eff.owner = eff; - net_eff.classname = "net_effect"; - //net_eff.eent_broadcast = broadcast; - net_eff.m_id = eff.m_id; - net_eff.eent_net_velocity = eff_vel; - net_eff.eent_net_location = eff_loc; - net_eff.eent_net_count = eff_cnt; - net_eff.eent_eff_trail = eff.eent_eff_trail; - - net_eff.think = SUB_Remove; - net_eff.nextthink = time + 0.2; // don't need to keep this long - - Net_LinkEntity(net_eff, false, 0, Net_Write_Effect); -} - -void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt) -{ - // problem with this is, we might not have all the available effects for it - FOREACH(effects_ent, it.eent_eff_name == eff_name, LAMBDA( - Send_Effect(it, eff_loc, eff_vel, eff_cnt); - return; - )); - // revert to engine handling - pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt); -} -#endif diff --git a/qcsrc/common/effects.qh b/qcsrc/common/effects.qh deleted file mode 100644 index a1102e96a..000000000 --- a/qcsrc/common/effects.qh +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef P_EFFECTS_H -#define P_EFFECTS_H - -#ifdef CSQC -void Read_Effect(bool is_new); -#elif defined(SVQC) -void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt); -void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt); -#endif - -#define particleeffectnum(e) _particleeffectnum(e.eent_eff_name) - -void RegisterEffects(); -const int MAX_EFFECTS = 512; -entity effects_ent[MAX_EFFECTS], effects_ent_first, effects_ent_last; -int EFFECT_COUNT; - -#define EFFECT(istrail, name, realname) \ - REGISTER(RegisterEffects, EFFECT, effects_ent, EFFECT_COUNT, name, m_id, Create_Effect_Entity(realname, istrail)); -REGISTER_REGISTRY(RegisterEffects) - -.int m_id; -.string eent_eff_name; -.int eent_eff_trail; - -.vector eent_net_location; -.vector eent_net_velocity; -.int eent_net_count; - -entity Create_Effect_Entity(string eff_name, bool eff_trail) -{ - entity this = new(effect_entity); - this.eent_eff_name = eff_name; - this.eent_eff_trail = eff_trail; - return this; -} - -void RegisterEffects_First() -{ - #ifdef SVQC - #define dedi (server_is_dedicated ? "a dedicated " : "") - #else - #define dedi "" - #endif - - LOG_TRACEF("Beginning effect initialization on %s%s program...\n", dedi, PROGNAME); - #undef dedi -} - -void RegisterEffects_Done() -{ - LOG_TRACE("Effects initialization successful!\n"); -} - -// NOW we actually activate the declarations -ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First) -EFFECT(0, Null, string_null) -#include "effects.inc" -ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done) - -#endif diff --git a/qcsrc/common/effects/effects.inc b/qcsrc/common/effects/effects.inc new file mode 100644 index 000000000..cbd3a44ab --- /dev/null +++ b/qcsrc/common/effects/effects.inc @@ -0,0 +1,189 @@ +// Global list of effects, networked to CSQC by ID to save bandwidth and to use client particle numbers (allows mismatching effectinfos to some degree) +// Not too concerned about the order of this list, just keep the weapon effects together! + +// EFFECT(istrail, EFFECT_NAME, "effectinfo_string") +EFFECT(0, EXPLOSION_SMALL, "explosion_small") +EFFECT(0, EXPLOSION_MEDIUM, "explosion_medium") +EFFECT(0, EXPLOSION_BIG, "explosion_big") + +EFFECT(0, SMOKE_SMALL, "smoke_small") +EFFECT(0, SMOKE_LARGE, "smoke_large") + + + +EFFECT(0, BLASTER_IMPACT, "laser_impact") +EFFECT(0, BLASTER_MUZZLEFLASH, "laser_muzzleflash") + +EFFECT(0, SHOTGUN_IMPACT, "shotgun_impact") +EFFECT(0, SHOTGUN_MUZZLEFLASH, "shotgun_muzzleflash") + +EFFECT(0, ARC_BEAM, "arc_beam") +EFFECT(0, ARC_BEAM_HEAL, "arc_beam_heal") +EFFECT(0, ARC_BEAM_HEAL_IMPACT, "arc_beam_healimpact") +EFFECT(0, ARC_BEAM_HEAL_IMPACT2, "healray_impact") +EFFECT(0, ARC_LIGHTNING, "arc_lightning") +EFFECT(0, ARC_LIGHTNING2, "electro_lightning") + +EFFECT(0, MACHINEGUN_IMPACT, "machinegun_impact") +EFFECT(0, MACHINEGUN_MUZZLEFLASH, "uzi_muzzleflash") + +EFFECT(0, GRENADE_EXPLODE, "grenade_explode") +EFFECT(0, GRENADE_MUZZLEFLASH, "grenadelauncher_muzzleflash") + +EFFECT(0, ELECTRO_BALLEXPLODE, "electro_ballexplode") +EFFECT(0, ELECTRO_COMBO, "electro_combo") +EFFECT(0, ELECTRO_IMPACT, "electro_impact") +EFFECT(0, ELECTRO_MUZZLEFLASH, "electro_muzzleflash") + +EFFECT(0, CRYLINK_IMPACT, "crylink_impactbig") +EFFECT(0, CRYLINK_IMPACT2, "crylink_impact") +EFFECT(0, CRYLINK_JOINEXPLODE, "crylink_joinexplode") +EFFECT(0, CRYLINK_MUZZLEFLASH, "crylink_muzzleflash") + +EFFECT(0, VORTEX_BEAM, "nex_beam") +EFFECT(0, VORTEX_BEAM_OLD, "TE_TEI_G3") +EFFECT(0, VORTEX_IMPACT, "nex_impact") +EFFECT(0, VORTEX_MUZZLEFLASH, "nex_muzzleflash") + +EFFECT(1, VAPORIZER_RED, "TE_TEI_G3RED") +EFFECT(1, VAPORIZER_RED_HIT, "TE_TEI_G3RED_HIT") +EFFECT(1, VAPORIZER_BLUE, "TE_TEI_G3BLUE") +EFFECT(1, VAPORIZER_BLUE_HIT, "TE_TEI_G3BLUE_HIT") +EFFECT(1, VAPORIZER_YELLOW, "TE_TEI_G3YELLOW") +EFFECT(1, VAPORIZER_YELLOW_HIT, "TE_TEI_G3YELLOW_HIT") +EFFECT(1, VAPORIZER_PINK, "TE_TEI_G3PINK") +EFFECT(1, VAPORIZER_PINK_HIT, "TE_TEI_G3PINK_HIT") +EFFECT(1, VAPORIZER_NEUTRAL, "TE_TEI_G3") +EFFECT(1, VAPORIZER_NEUTRAL_HIT, "TE_TEI_G3_HIT") + +EFFECT(0, RIFLE_IMPACT, "machinegun_impact") +EFFECT(0, RIFLE_MUZZLEFLASH, "rifle_muzzleflash") +EFFECT(1, RIFLE, "tr_rifle") +EFFECT(1, RIFLE_WEAK, "tr_rifle_weak") + +EFFECT(0, HAGAR_BOUNCE, "hagar_bounce") +EFFECT(0, HAGAR_EXPLODE, "hagar_explode") +EFFECT(0, HAGAR_MUZZLEFLASH, "hagar_muzzleflash") +EFFECT(1, HAGAR_ROCKET, "tr_hagar") + +EFFECT(0, ROCKET_EXPLODE, "rocket_explode") +EFFECT(0, ROCKET_GUIDE, "rocket_guide") +EFFECT(0, ROCKET_MUZZLEFLASH, "rocketlauncher_muzzleflash") + +EFFECT(0, HOOK_EXPLODE, "hookbomb_explode") +EFFECT(0, HOOK_IMPACT, "grapple_impact") +EFFECT(0, HOOK_MUZZLEFLASH, "grapple_muzzleflash") + +EFFECT(0, SEEKER_MUZZLEFLASH, "seeker_muzzleflash") + +EFFECT(0, FLAK_BOUNCE, "flak_bounce") + +EFFECT(1, FIREBALL, "fireball") +EFFECT(0, FIREBALL_BFGDAMAGE, "fireball_bfgdamage") +EFFECT(0, FIREBALL_EXPLODE, "fireball_explode") +EFFECT(0, FIREBALL_LASER, "fireball_laser") +EFFECT(0, FIREBALL_MUZZLEFLASH, "fireball_muzzleflash") +EFFECT(0, FIREBALL_PRE_MUZZLEFLASH, "fireball_preattack_muzzleflash") + + + +EFFECT(0, RAPTOR_CANNON_IMPACT, "raptor_cannon_impact") +EFFECT(0, RAPTOR_BOMB_IMPACT, "raptor_bomb_impact") +EFFECT(0, RAPTOR_BOMB_SPREAD, "raptor_bomb_spread") +EFFECT(0, RAPTOR_MUZZLEFLASH, "raptor_cannon_muzzleflash") + +EFFECT(0, RACER_BOOSTER, "wakizashi_booster_smoke") +EFFECT(0, RACER_IMPACT, "wakizashi_gun_impact") +EFFECT(0, RACER_MUZZLEFLASH, "wakizashi_gun_muzzleflash") +EFFECT(0, RACER_ROCKETLAUNCH, "wakizashi_rocket_launch") +EFFECT(0, RACER_ROCKET_EXPLODE, "wakizashi_rocket_launch") +EFFECT(1, RACER_ROCKET_TRAIL, "wakizashi_rocket_thrust") + +EFFECT(0, SPIDERBOT_ROCKETLAUNCH, "spiderbot_rocket_launch") +EFFECT(1, SPIDERBOT_ROCKET_TRAIL, "spiderbot_rocket_thrust") +EFFECT(0, SPIDERBOT_ROCKET_EXPLODE, "spiderbot_rocket_explode") +EFFECT(0, SPIDERBOT_MINIGUN_IMPACT, "spiderbot_minigun_impact") +EFFECT(0, SPIDERBOT_MINIGUN_MUZZLEFLASH, "spiderbot_minigun_muzzleflash") + +EFFECT(0, BUMBLEBEE_HEAL_MUZZLEFLASH, "healray_muzzleflash") +EFFECT(0, BUMBLEBEE_HEAL_IMPACT, "healray_impact") + +EFFECT(0, BIGPLASMA_IMPACT, "bigplasma_impact") +EFFECT(0, BIGPLASMA_MUZZLEFLASH, "bigplasma_muzzleflash") + +EFFECT(0, TELEPORT, "teleport") + +EFFECT(0, SPAWNPOINT_RED, "spawn_point_red") +EFFECT(0, SPAWN_RED, "spawn_event_red") +EFFECT(0, SPAWNPOINT_BLUE, "spawn_point_blue") +EFFECT(0, SPAWN_BLUE, "spawn_event_blue") +EFFECT(0, SPAWNPOINT_YELLOW, "spawn_point_yellow") +EFFECT(0, SPAWN_YELLOW, "spawn_event_yellow") +EFFECT(0, SPAWNPOINT_PINK, "spawn_point_pink") +EFFECT(0, SPAWN_PINK, "spawn_event_pink") +EFFECT(0, SPAWNPOINT_NEUTRAL, "spawn_point_neutral") +EFFECT(0, SPAWN_NEUTRAL, "spawn_event_neutral") + +EFFECT(0, NADE_RED_EXPLODE, "nade_red_explode") +EFFECT(0, NADE_BLUE_EXPLODE, "nade_blue_explode") +EFFECT(0, NADE_YELLOW_EXPLODE, "nade_yellow_explode") +EFFECT(0, NADE_PINK_EXPLODE, "nade_pink_explode") +EFFECT(0, NADE_NEUTRAL_EXPLODE, "nade_neutral_explode") + +EFFECT(0, ICEORGLASS, "iceorglass") +EFFECT(0, ICEFIELD, "icefield") +EFFECT(0, FIREFIELD, "firefield") +EFFECT(0, HEALING, "healing_fx") +EFFECT(1, LASER_BEAM_FAST, "nex242_misc_laser_beam_fast") +EFFECT(0, RESPAWN_GHOST, "respawn_ghost") + +EFFECT(0, FLAG_RED_TOUCH, "redflag_touch") +EFFECT(0, FLAG_BLUE_TOUCH, "blueflag_touch") +EFFECT(0, FLAG_YELLOW_TOUCH, "yellowflag_touch") +EFFECT(0, FLAG_PINK_TOUCH, "pinkflag_touch") +EFFECT(0, FLAG_NEUTRAL_TOUCH, "neutralflag_touch") +EFFECT(1, RED_PASS, "red_pass") +EFFECT(1, BLUE_PASS, "blue_pass") +EFFECT(1, YELLOW_PASS, "yellow_pass") +EFFECT(1, PINK_PASS, "pink_pass") +EFFECT(1, NEUTRAL_PASS, "neutral_pass") +EFFECT(0, RED_CAP, "red_cap") +EFFECT(0, BLUE_CAP, "blue_cap") +EFFECT(0, YELLOW_CAP, "yellow_cap") +EFFECT(0, PINK_CAP, "pink_cap") + +EFFECT(0, ITEM_PICKUP, "item_pickup") +EFFECT(0, ITEM_RESPAWN, "item_respawn") + +EFFECT(0, ONS_GENERATOR_DAMAGED, "torch_small") +EFFECT(0, ONS_GENERATOR_GIB, "onslaught_generator_gib_explode") +EFFECT(0, ONS_GENERATOR_EXPLODE, "onslaught_generator_smallexplosion") +EFFECT(0, ONS_GENERATOR_EXPLODE2, "onslaught_generator_finalexplosion") + + + +EFFECT(0, LASER_DEADLY, "laser_deadly") +EFFECT(1, FLAC_TRAIL, "TR_SEEKER") +EFFECT(1, SEEKER_TRAIL, "TR_SEEKER") +EFFECT(1, FIREMINE, "firemine") +EFFECT(0, BALL_SPARKS, "kaball_sparks") +EFFECT(0, ELECTRIC_SPARKS, "electricity_sparks") +EFFECT(0, SPARKS, "sparks") +EFFECT(0, RAGE, "rage") +EFFECT(0, SMOKING, "smoking") +EFFECT(0, SMOKE_RING, "smoke_ring") +EFFECT(0, JUMPPAD, "jumppad_activate") +EFFECT(1, BULLET, "tr_bullet") +EFFECT(0, EF_FLAME, "EF_FLAME") +EFFECT(0, EF_STARDUST, "EF_STARDUST") +EFFECT(0, TE_EXPLOSION, "TE_EXPLOSION") +EFFECT(1, TR_NEXUIZPLASMA, "TR_NEXUIZPLASMA") +EFFECT(1, TR_CRYLINKPLASMA, "TR_CRYLINKPLASMA") +EFFECT(1, TR_ROCKET, "TR_ROCKET") +EFFECT(1, TR_GRENADE, "TR_GRENADE") +EFFECT(1, TR_BLOOD, "TR_BLOOD") +EFFECT(1, TR_WIZSPIKE, "TR_WIZSPIKE") +EFFECT(1, TR_SLIGHTBLOOD, "TR_SLIGHTBLOOD") +EFFECT(1, TR_KNIGHTSPIKE, "TR_KNIGHTSPIKE") +EFFECT(1, TR_VORESPIKE, "TR_VORESPIKE") +EFFECT(0, TE_SPARK, "TE_SPARK") diff --git a/qcsrc/common/effects/effects.qc b/qcsrc/common/effects/effects.qc new file mode 100644 index 000000000..5ea8a95b1 --- /dev/null +++ b/qcsrc/common/effects/effects.qc @@ -0,0 +1,91 @@ +#ifdef CSQC +void Read_Effect(bool is_new) +{ + int net_name = (EFFECT_COUNT >= 255) ? ReadShort() : ReadByte(); + + entity eff = effects_ent[net_name]; + + vector v, vel = '0 0 0'; + int eff_cnt = 1; + bool eff_trail = eff.eent_eff_trail; + v_x = ReadCoord(); + v_y = ReadCoord(); + v_z = ReadCoord(); + + bool use_vel = ReadByte(); + if(use_vel) + { + vel_x = ReadCoord(); + vel_y = ReadCoord(); + vel_z = ReadCoord(); + } + + if(!eff_trail) + eff_cnt = ReadByte(); + + if(is_new) + { + if(eff_trail) + WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel); + else + pointparticles(particleeffectnum(eff), v, vel, eff_cnt); + } +} +#endif + +#ifdef SVQC +bool Net_Write_Effect(entity client, int sf) +{SELFPARAM(); + WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT); + (EFFECT_COUNT >= 255) + ? WriteShort(MSG_ENTITY, self.m_id) + : WriteByte(MSG_ENTITY, self.m_id); + WriteCoord(MSG_ENTITY, self.eent_net_location_x); + WriteCoord(MSG_ENTITY, self.eent_net_location_y); + WriteCoord(MSG_ENTITY, self.eent_net_location_z); + + // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set + if(self.eent_net_velocity) + { + WriteByte(MSG_ENTITY, true); + WriteCoord(MSG_ENTITY, self.eent_net_velocity_x); + WriteCoord(MSG_ENTITY, self.eent_net_velocity_y); + WriteCoord(MSG_ENTITY, self.eent_net_velocity_z); + } + else { WriteByte(MSG_ENTITY, false); } + + if(!self.eent_eff_trail) { WriteByte(MSG_ENTITY, self.eent_net_count); } + return true; +} + +void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt) +{ + if(!eff) { return; } + if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count! + entity net_eff = spawn(); + net_eff.owner = eff; + net_eff.classname = "net_effect"; + //net_eff.eent_broadcast = broadcast; + net_eff.m_id = eff.m_id; + net_eff.eent_net_velocity = eff_vel; + net_eff.eent_net_location = eff_loc; + net_eff.eent_net_count = eff_cnt; + net_eff.eent_eff_trail = eff.eent_eff_trail; + + net_eff.think = SUB_Remove; + net_eff.nextthink = time + 0.2; // don't need to keep this long + + Net_LinkEntity(net_eff, false, 0, Net_Write_Effect); +} + +void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt) +{ + // problem with this is, we might not have all the available effects for it + FOREACH(effects_ent, it.eent_eff_name == eff_name, LAMBDA( + Send_Effect(it, eff_loc, eff_vel, eff_cnt); + return; + )); + // revert to engine handling + pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt); +} +#endif diff --git a/qcsrc/common/effects/effects.qh b/qcsrc/common/effects/effects.qh new file mode 100644 index 000000000..a1102e96a --- /dev/null +++ b/qcsrc/common/effects/effects.qh @@ -0,0 +1,61 @@ +#ifndef P_EFFECTS_H +#define P_EFFECTS_H + +#ifdef CSQC +void Read_Effect(bool is_new); +#elif defined(SVQC) +void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt); +void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt); +#endif + +#define particleeffectnum(e) _particleeffectnum(e.eent_eff_name) + +void RegisterEffects(); +const int MAX_EFFECTS = 512; +entity effects_ent[MAX_EFFECTS], effects_ent_first, effects_ent_last; +int EFFECT_COUNT; + +#define EFFECT(istrail, name, realname) \ + REGISTER(RegisterEffects, EFFECT, effects_ent, EFFECT_COUNT, name, m_id, Create_Effect_Entity(realname, istrail)); +REGISTER_REGISTRY(RegisterEffects) + +.int m_id; +.string eent_eff_name; +.int eent_eff_trail; + +.vector eent_net_location; +.vector eent_net_velocity; +.int eent_net_count; + +entity Create_Effect_Entity(string eff_name, bool eff_trail) +{ + entity this = new(effect_entity); + this.eent_eff_name = eff_name; + this.eent_eff_trail = eff_trail; + return this; +} + +void RegisterEffects_First() +{ + #ifdef SVQC + #define dedi (server_is_dedicated ? "a dedicated " : "") + #else + #define dedi "" + #endif + + LOG_TRACEF("Beginning effect initialization on %s%s program...\n", dedi, PROGNAME); + #undef dedi +} + +void RegisterEffects_Done() +{ + LOG_TRACE("Effects initialization successful!\n"); +} + +// NOW we actually activate the declarations +ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First) +EFFECT(0, Null, string_null) +#include "effects.inc" +ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done) + +#endif diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index ea9f18fd2..33e0bab15 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,5 +1,5 @@ #include "sv_vehicles.qh" -#include "../effects.qh" +#include "../effects/effects.qh" #if 0 bool vehicle_send(entity to, int sf) diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 40dbfecb3..846c647a0 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -23,7 +23,7 @@ REGISTER_VEHICLE_SIMPLE( #ifdef IMPLEMENTATION #ifdef SVQC -#include "../../effects.qh" +#include "../../effects/effects.qh" #include "../../triggers/trigger/impulse.qh" bool autocvar_g_vehicle_racer; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 2b72368fa..a87b304bc 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -11,7 +11,7 @@ #include "../common/constants.qh" #include "../common/deathtypes.qh" -#include "../common/effects.qh" +#include "../common/effects/effects.qh" #include "../common/util.qh" #include "../common/monsters/all.qh" diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index b15e847c5..81f5c71f4 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -22,7 +22,7 @@ #include "../common/buffs.qh" #include "../common/constants.qh" #include "../common/deathtypes.qh" -#include "../common/effects.qh" +#include "../common/effects/effects.qh" #include "../common/mapinfo.qh" #include "../common/monsters/all.qh" #include "../common/monsters/sv_monsters.qh" diff --git a/qcsrc/server/progs.inc b/qcsrc/server/progs.inc index b387ed35c..069c96459 100644 --- a/qcsrc/server/progs.inc +++ b/qcsrc/server/progs.inc @@ -83,7 +83,7 @@ #include "../common/buffs.qc" #include "../common/campaign_file.qc" #include "../common/campaign_setup.qc" -#include "../common/effects.qc" +#include "../common/effects/effects.qc" #include "../common/mapinfo.qc" #include "../common/monsters/spawn.qc" #include "../common/monsters/sv_monsters.qc"