From 3312be003b9ddb5b0b1c8ba81d5f3c595fc57de7 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 13:40:15 +0200 Subject: [PATCH] Make consumable items show when and where they should, and prepare them for actual usage --- data/defaultVT.cfg | 1 + data/qcsrc/server/constants.qh | 2 ++ data/qcsrc/server/t_items.qc | 21 ++++++++++++++++++++- data/qcsrc/server/vore.qc | 9 +++------ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index b23a2d44..87b80328 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1627,6 +1627,7 @@ set g_vore_regurgitatecolor_color_digest "0.3 0.15 0" "the color players will ha set g_vore_regurgitatecolor_fade 0.01 "how quickly the regurgitation color washes off players once they leave the stomach, does not apply to dead bodies" set g_vore_regurgitatecolor_particles 0.75 "players who are dirty from regurgitation generate particles this often, based on the amount of goo they have on them" set g_vore_neighborprey_distance 4 "Distance by which prey inside the same stomach are positioned away from each other. 0 disables seeing neighboring prey" +set g_vore_neighborprey_distance_item 4 "Distance by which items inside the same stomach are positioned away from each other. 0 disables seeing neighboring items" set g_vore_swallowmodel_range 100 "Distance by which the swallow model oscillates based on swallow progress" seta cl_healthsize_fov 0.2 "offset field of view by this amount based on size, to further induce the effect of being large or small" diff --git a/data/qcsrc/server/constants.qh b/data/qcsrc/server/constants.qh index 69aae0c3..9481d46a 100644 --- a/data/qcsrc/server/constants.qh +++ b/data/qcsrc/server/constants.qh @@ -132,6 +132,8 @@ vector PL_CROUCH_MIN = '-16 -16 -24'; vector PL_CROUCH_MAX = '16 16 25'; vector PL_PREY_VIEW_OFS = '0 0 25'; +vector CONSUMABLE_VIEW_OFS = '0 0 15'; + // Sajt - added these, just as constants. Not sure how you want them actually put in the game, but I just // did this so at least they worked //float GAME_FULLBRIGHT_PLAYERS = 64; /// makes the players model fullbright diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index cf8d5604..80116ce8 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -219,18 +219,37 @@ void Item_ScheduleInitialRespawn(entity e) Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e)); } +float Item_Consumable_Customizeentityforclient() +{ + if(cvar("g_vore_neighborprey_distance_item") && self.predator == other.predator && !(other.cvar_chase_active || other.classname == "observer")) + { + self.alpha = default_player_alpha; // allow seeing neighboring items + self.effects |= EF_NODEPTHTEST; // don't hide behind the stomach's own EF_NODEPTHTEST + } + else + self.alpha = -1; // hide item + return TRUE; +} + void Item_Consumable_Spawn(entity e, entity pl) { entity item; item = spawn(); item.owner = e; item.classname = "consumable"; - setmodel(item, e.model); item.movetype = MOVETYPE_FOLLOW; item.solid = SOLID_NOT; + setmodel(item, e.model); + item.health = e.health; + item.max_health = e.max_health; item.predator = pl; item.aiment = pl; + item.view_ofs_x = CONSUMABLE_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance_item"); + item.view_ofs_y = CONSUMABLE_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance_item"); + item.view_ofs_z = CONSUMABLE_VIEW_OFS_z; + + item.customizeentityforclient = Item_Consumable_Customizeentityforclient; } float Item_GiveTo(entity item, entity player) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 1688588e..8a2ddf5e 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -121,7 +121,6 @@ void Vore_SetPreyPositions(entity pred) // pred is the predator and head is the prey local entity head; - local vector origin_apply; // In order to allow prey to see each other in the stomach, we must position each occupant differently, // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach. @@ -129,12 +128,10 @@ void Vore_SetPreyPositions(entity pred) { if(head.predator == pred) { - origin_apply_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance"); - origin_apply_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance"); - origin_apply_z = PL_PREY_VIEW_OFS_z; - // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset - head.view_ofs = origin_apply; + head.view_ofs_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance"); + head.view_ofs_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance"); + head.view_ofs_z = PL_PREY_VIEW_OFS_z; } } } -- 2.39.2