From 15fa5a8f12baca22f3254286e16ae626948ea403 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Tue, 8 Nov 2022 19:49:53 -0800 Subject: [PATCH] Update codebase to be in line with upstream Nuclide. Add scripts/decals.txt and other shenanigans. --- src/client/hud.qc | 4 +- src/server/client.qc | 1 - src/server/monster_gargantua.qc | 1 + src/server/monster_headcrab.qc | 1 + src/server/monster_human_grunt.qc | 1 + src/server/monster_sitting_scientist.qc | 1 + src/server/monster_tentacle.qc | 1 + src/shared/fx_explosion.qc | 3 +- src/shared/input.qc | 9 + src/shared/player.qc | 6 +- src/shared/w_crossbow.qc | 5 +- src/shared/w_glock.qc | 8 +- src/shared/w_mp5.qc | 4 +- src/shared/w_python.qc | 2 +- src/shared/w_rpg.qc | 4 +- src/shared/w_shotgun.qc | 8 +- zpak001.pk3dir/particles/impact_default.cfg | 58 ++++++ zpak001.pk3dir/scripts/decals.txt | 31 ++++ zpak001.pk3dir/scripts/surfaceproperties.txt | 175 +++++++++++++++++++ 19 files changed, 300 insertions(+), 23 deletions(-) mode change 100755 => 100644 src/shared/fx_explosion.qc create mode 100644 zpak001.pk3dir/particles/impact_default.cfg create mode 100644 zpak001.pk3dir/scripts/decals.txt create mode 100644 zpak001.pk3dir/scripts/surfaceproperties.txt diff --git a/src/client/hud.qc b/src/client/hud.qc index 3fc813c..f8dfc75 100644 --- a/src/client/hud.qc +++ b/src/client/hud.qc @@ -472,8 +472,8 @@ HUD_DrawSpectator(void) NSClientSpectator spec = (NSClientSpectator)pSeat->m_ePlayer; drawfont = Font_GetID(FONT_20); - vector vecPos; - string strText; + vector vecPos = [0.0f, 0.0f, 0.0f]; + string strText = __NULL__; float palpha = 1.0f; if (spec.spec_mode == SPECMODE_FREE) { diff --git a/src/server/client.qc b/src/server/client.qc index 6311c9b..543a71c 100644 --- a/src/server/client.qc +++ b/src/server/client.qc @@ -18,7 +18,6 @@ void Game_RunClientCommand(void) { - Footsteps_Update(); player pl = (player)self; pl.Physics_Run(); } diff --git a/src/server/monster_gargantua.qc b/src/server/monster_gargantua.qc index 27af2fe..9355137 100644 --- a/src/server/monster_gargantua.qc +++ b/src/server/monster_gargantua.qc @@ -54,6 +54,7 @@ class monster_gargantua:NSMonster void(void) monster_gargantua; + virtual void(void) Spawned; virtual void(void) Death; virtual void(void) Pain; virtual void(void) IdleNoise; diff --git a/src/server/monster_headcrab.qc b/src/server/monster_headcrab.qc index 7b1f26e..2aa63bd 100644 --- a/src/server/monster_headcrab.qc +++ b/src/server/monster_headcrab.qc @@ -53,6 +53,7 @@ class monster_headcrab:NSMonster void(void) monster_headcrab; + virtual void(void) Spawned; virtual void(void) Pain; virtual void(void) Death; virtual void(void) IdleNoise; diff --git a/src/server/monster_human_grunt.qc b/src/server/monster_human_grunt.qc index 9c97c75..3e6bf50 100644 --- a/src/server/monster_human_grunt.qc +++ b/src/server/monster_human_grunt.qc @@ -119,6 +119,7 @@ class monster_human_grunt:NSTalkMonster virtual void(void) Scream; virtual void(void) IdleChat; virtual void(void) Respawn; + virtual void(void) Spawned; virtual void(void) Pain; virtual void(void) Death; diff --git a/src/server/monster_sitting_scientist.qc b/src/server/monster_sitting_scientist.qc index f605794..37445bd 100644 --- a/src/server/monster_sitting_scientist.qc +++ b/src/server/monster_sitting_scientist.qc @@ -39,6 +39,7 @@ class monster_sitting_scientist:NSTalkMonster void(void) monster_sitting_scientist; virtual void(void) Respawn; + virtual void(void) Spawned; virtual void(void) Death; virtual void(void) Gib; virtual void(string, string) SpawnKey; diff --git a/src/server/monster_tentacle.qc b/src/server/monster_tentacle.qc index c39945f..b160d4a 100644 --- a/src/server/monster_tentacle.qc +++ b/src/server/monster_tentacle.qc @@ -88,6 +88,7 @@ class monster_tentacle:NSMonster virtual void(void) IdleNoise; virtual void(void) Respawn; + virtual void(void) Spawned; }; void diff --git a/src/shared/fx_explosion.qc b/src/shared/fx_explosion.qc old mode 100755 new mode 100644 index 78c8940..a925d64 --- a/src/shared/fx_explosion.qc +++ b/src/shared/fx_explosion.qc @@ -74,7 +74,8 @@ FX_Explosion(vector vecPos) dlight.drawmask = MASK_ENGINE; dlight.alpha = 2.0f; - Decals_Place(vecPos, sprintf("{scorch%d", floor(random(1,4)))); + DecalGroups_Place("ExplosionScorch", vecPos); + vecPos[2] += 48; env_sprite eExplosion = spawn(env_sprite); makevectors(view_angles); diff --git a/src/shared/input.qc b/src/shared/input.qc index 027f0bd..6f379c4 100644 --- a/src/shared/input.qc +++ b/src/shared/input.qc @@ -70,6 +70,15 @@ Game_Input(player pl) pl.impulse = 0; #endif + NSVehicle veh = (NSVehicle)pl.vehicle; + bool canfire = true; + if (veh) + if (veh.PreventPlayerFire() == true) + canfire = false; + + if (canfire == false) + return; + if (input_buttons & INPUT_BUTTON0) Weapons_Primary(pl); else if (input_buttons & INPUT_BUTTON4) diff --git a/src/shared/player.qc b/src/shared/player.qc index 4f13a01..a7ab6a1 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -69,9 +69,9 @@ class player:NSClientPlayer virtual void(void) Physics_Jump; #ifdef CLIENT - virtual void(void) draw; - virtual float() predraw; - virtual void(void) postdraw; + ////virtual void(void) draw; + //virtual float() predraw; + //virtual void(void) postdraw; virtual void(float,float) ReceiveEntity; virtual void(void) PredictPreFrame; virtual void(void) PredictPostFrame; diff --git a/src/shared/w_crossbow.qc b/src/shared/w_crossbow.qc index b9e3f42..ebc283e 100644 --- a/src/shared/w_crossbow.qc +++ b/src/shared/w_crossbow.qc @@ -277,6 +277,8 @@ w_crossbow_secondary(player pl) void w_crossbow_reload(player pl) { + NSTimer reload = __NULL__; + if (pl.w_attack_next > 0.0) { return; } @@ -297,8 +299,7 @@ w_crossbow_reload(player pl) Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5); } - pl.think = w_crossbow_reload_done; - pl.nextthink = time + 4.4f; + reload.TemporaryTimer(pl, w_crossbow_reload_done, 4.4f, false); Sound_Play(pl, CHAN_ITEM, "weapon_crossbow.reload"); #endif diff --git a/src/shared/w_glock.qc b/src/shared/w_glock.qc index 56b16c7..eec5825 100644 --- a/src/shared/w_glock.qc +++ b/src/shared/w_glock.qc @@ -184,7 +184,7 @@ w_glock_primary(player pl) View_SetMuzzleflash(MUZZLE_SMALL); View_AddEvent(w_glock_ejectshell, 0.0f); #else - TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01,0.01], WEAPON_GLOCK); + TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01,0.01], WEAPON_GLOCK, "Impact.BigShot"); Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire"); #endif @@ -228,7 +228,7 @@ w_glock_secondary(player pl) View_SetMuzzleflash(MUZZLE_SMALL); View_AddEvent(w_glock_ejectshell, 0.0f); #else - TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK); + TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK, "Impact.BigShot"); Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire"); #endif @@ -297,10 +297,8 @@ w_glock_release(player pl) if (w_glock_isempty(pl)) return; - - if (pl.w_idle_next > 0.0) { + if (pl.w_idle_next > 0.0) return; - } r = floor(pseudorandom() * 3.0f); switch (r) { diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index 7703f0a..b587f7b 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -201,9 +201,9 @@ w_mp5_primary(player pl) #else /* singleplayer is more accurate */ if (cvar("sv_playerslots") == 1) { - TraceAttack_FireBullets(1, Weapons_GetCameraPos(pl), Skill_GetValue("plr_9mmAR_bullet", 5), [0.025,0.025], WEAPON_MP5); + TraceAttack_FireBulletsWithDecal(1, Weapons_GetCameraPos(pl), Skill_GetValue("plr_9mmAR_bullet", 5), [0.025,0.025], WEAPON_MP5, "Impact.BigShot"); } else { - TraceAttack_FireBullets(1, Weapons_GetCameraPos(pl), Skill_GetValue("plr_9mmAR_bullet", 5), [0.05,0.05], WEAPON_MP5); + TraceAttack_FireBulletsWithDecal(1, Weapons_GetCameraPos(pl), Skill_GetValue("plr_9mmAR_bullet", 5), [0.05,0.05], WEAPON_MP5, "Impact.BigShot"); } Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.shoot"); diff --git a/src/shared/w_python.qc b/src/shared/w_python.qc index cd2d6a2..e1a33a2 100644 --- a/src/shared/w_python.qc +++ b/src/shared/w_python.qc @@ -148,7 +148,7 @@ w_python_primary(player pl) #ifdef CLIENT View_SetMuzzleflash(MUZZLE_SMALL); #else - TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_357_bullet", 40), [0.008, 0.008], WEAPON_PYTHON); + TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_357_bullet", 40), [0.008, 0.008], WEAPON_PYTHON, "Impact.BigShot"); Sound_Play(pl, CHAN_WEAPON, "weapon_357.shoot"); #endif diff --git a/src/shared/w_rpg.qc b/src/shared/w_rpg.qc index 71f160a..558bd52 100644 --- a/src/shared/w_rpg.qc +++ b/src/shared/w_rpg.qc @@ -148,7 +148,7 @@ void w_rpg_primary(player pl) rocket.solid = SOLID_BBOX; //bolt.flags |= FL_LAGGEDMOVE; rocket.gravity = 0.5f; - rocket.velocity = (v_forward * 250); + rocket.velocity = (pl.WaterLevel() >= WATERLEVEL_SUBMERGED) ? (v_forward * 100): (v_forward * 250); rocket.angles = vectoangles(rocket.velocity); rocket.avelocity[2] = 10; rocket.touch = Rocket_Touch; @@ -286,7 +286,7 @@ void w_rpg_hud(player pl) /* crosshair/laser */ if (pl.ammo_rpg_state == 1) { float lerp; - vector jitter; + vector jitter = [0.0f, 0.0f, 0.0f]; Weapons_MakeVectors(pl); vector src = pl.origin + pl.view_ofs; traceline(src, src + (v_forward * 256), FALSE, pl); diff --git a/src/shared/w_shotgun.qc b/src/shared/w_shotgun.qc index c3789ec..138c404 100644 --- a/src/shared/w_shotgun.qc +++ b/src/shared/w_shotgun.qc @@ -212,9 +212,9 @@ w_shotgun_primary(player pl) #ifdef SERVER /* Singleplayer is more accurate */ if (serverkeyfloat("sv_playerslots") == 1) { - TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.08716], WEAPON_SHOTGUN); + TraceAttack_FireBulletsWithDecal(6, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.08716], WEAPON_SHOTGUN, "Impact.BigShot"); } else { - TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.04362], WEAPON_SHOTGUN); + TraceAttack_FireBulletsWithDecal(4, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.04362], WEAPON_SHOTGUN, "Impact.BigShot"); } Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.single"); #else @@ -286,9 +286,9 @@ w_shotgun_secondary(player pl) #ifdef SERVER /* Singleplayer is more accurate */ if (serverkeyfloat("sv_playerslots") == 1) { - TraceAttack_FireBullets(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN); + TraceAttack_FireBulletsWithDecal(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN, "Impact.BigShot"); } else { - TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN); + TraceAttack_FireBulletsWithDecal(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN, "Impact.BigShot"); } Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.double"); #else diff --git a/zpak001.pk3dir/particles/impact_default.cfg b/zpak001.pk3dir/particles/impact_default.cfg new file mode 100644 index 0000000..789dac8 --- /dev/null +++ b/zpak001.pk3dir/particles/impact_default.cfg @@ -0,0 +1,58 @@ +// black bits +r_part main +{ + type ball + texture ball + tcoords 1 65 31 95 256 8 32 + scale 4 + count 18 + scalefactor 1 + alpha 1 + die 0.8 + rgb 25 25 25 + spawnmode ball + spawnorg 1 + spawnvel 100 + veladd 100 + friction 0.3 + gravity 800 +} + +// smoke +r_part +main +{ + texture ball + tcoords 1 65 31 95 256 8 32 + count 3 + scale 25 + scalefactor 1 + die 1 + alpha 0.5 + rgb 25 25 25 + blend add + spawnmode ball + spawnorg 2 + spawnvel 20 + veladd 20 +} + +// spark +r_part +main +{ + type texturedspark + texture ball + tcoords 1 65 31 95 256 8 32 + scale 1 + count 8 + scalefactor 1 + alpha 0.5 + die 0.8 + rgb 255 115 0 + blend add + spawnmode ball + spawnorg 1 + spawnvel 100 + veladd 100 + friction 0.5 + gravity 800 +} \ No newline at end of file diff --git a/zpak001.pk3dir/scripts/decals.txt b/zpak001.pk3dir/scripts/decals.txt new file mode 100644 index 0000000..46c513c --- /dev/null +++ b/zpak001.pk3dir/scripts/decals.txt @@ -0,0 +1,31 @@ +Impact.Shot +{ + "{shot1" "1" + "{shot2" "1" + "{shot3" "1" + "{shot3" "1" + "{shot3" "1" +} + +Impact.BigShot +{ + "{bigshot1" "1" + "{bigshot2" "1" + "{bigshot3" "1" + "{bigshot4" "1" + "{bigshot5" "1" +} + +Impact.Break +{ + "{break1" "1" + "{break1" "1" + "{break1" "1" +} + +ExplosionScorch +{ + "{scorch1" "1" + "{scorch2" "1" + "{scorch3" "1" +} \ No newline at end of file diff --git a/zpak001.pk3dir/scripts/surfaceproperties.txt b/zpak001.pk3dir/scripts/surfaceproperties.txt new file mode 100644 index 0000000..6ac9e7c --- /dev/null +++ b/zpak001.pk3dir/scripts/surfaceproperties.txt @@ -0,0 +1,175 @@ +default +{ + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.default" + stepleft "step_default.left" + stepright "step_default.right" +} + +gs_material_glass +{ + gamematerial Y + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.glass" + stepleft "step_glass.left" + stepright "step_glass.right" +} + +gs_material_wood +{ + gamematerial W + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.wood" + stepleft "step_wood.left" + stepright "step_wood.right" +} + +gs_material_metal +{ + gamematerial M + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.metal" + stepleft "step_metal.left" + stepright "step_metal.right" +} + +gs_material_flesh +{ + gamematerial F + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.flesh" + stepleft "step_flesh.left" + stepright "step_flesh.right" +} + +gs_material_cinderblock +{ + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.concrete" + stepleft "step_default.left" + stepright "step_default.right" +} + +gs_material_tile +{ + gamematerial T + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.tile" + stepleft "step_tile.left" + stepright "step_tile.right" +} + +gs_material_computer +{ + gamematerial P + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.computer" + stepleft "step_computer.left" + stepright "step_computer.right" +} + +gs_material_unbreakableglass +{ + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.glass" + stepleft "step_glass.left" + stepright "step_glass.right" +} + +gs_material_rock +{ + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.rock" + stepleft "step_default.left" + stepright "step_default.right" +} + +gs_material_flesh +{ + gamematerial F + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.flesh" + stepleft "step_flesh.left" + stepright "step_flesh.right" +} + +gs_material_concrete +{ + gamematerial C + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.concrete" + stepleft "step_concrete.left" + stepright "step_concrete.right" +} + +gs_material_dirt +{ + gamematerial D + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.dirt" + stepleft "step_dirt.left" + stepright "step_dirt.right" +} + +gs_material_grate +{ + gamematerial G + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.grate" + stepleft "step_grate.left" + stepright "step_grate.right" +} + +gs_material_alien +{ + gamematerial H + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.alien" + stepleft "step_alien.left" + stepright "step_alien.right" +} + +gs_material_snow +{ + gamematerial K + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.snow" + stepleft "step_snow.left" + stepright "step_snow.right" +} + +gs_material_sand +{ + gamematerial N + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.sand" + stepleft "step_sand.left" + stepright "step_sand.right" +} + +gs_material_foliage +{ + gamematerial O + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.foliage" + stepleft "step_foliage.left" + stepright "step_foliage.right" +} + +gs_material_slosh +{ + gamematerial S + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.slosh" + stepleft "step_slosh.left" + stepright "step_slosh.right" +} + +gs_material_vent +{ + gamematerial V + part_bulletimpact "impact_default.main" + bulletimpact "sfx_impact.snow" + stepleft "step_vent.left" + stepright "step_vent.right" +} \ No newline at end of file