Permalink
Browse files

Improved default spawnicon generation angles

  • Loading branch information...
1 parent d49ac8c commit e3a8366a1f14416ff46948263e58797de143ba76 @robotboy655 robotboy655 committed Jun 29, 2016
@@ -47,7 +47,7 @@ function PANEL:Init()
end
- local materials = self.Scenes.RootNode:AddFolder( "Scenes", "scenes/", true );
+ local materials = self.Scenes.RootNode:AddFolder( "Scenes", "scenes/", true );
materials:SetIcon( "icon16/photos.png" )
*/
@@ -142,12 +142,8 @@ function PANEL:Init()
self:SetVisible( true )
- print( tr.Entity )
-
if ( !IsValid( tr.Entity ) ) then return end
-
-
self:SetFromEntity( tr.Entity )
end )
@@ -184,12 +180,12 @@ function PANEL:SetDefaultLighting()
self.ModelPanel:SetAmbientLight( Color( 255 * 0.3, 255 * 0.3, 255 * 0.3 ) )
- self.ModelPanel:SetDirectionalLight( 0, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
- self.ModelPanel:SetDirectionalLight( 1, Color( 255 * 1.3, 255 * 1.3, 255 * 1.3 ) )
- self.ModelPanel:SetDirectionalLight( 2, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
- self.ModelPanel:SetDirectionalLight( 3, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
- self.ModelPanel:SetDirectionalLight( 4, Color( 255 * 2.3, 255 * 2.3, 255 * 2.3 ) )
- self.ModelPanel:SetDirectionalLight( 5, Color( 255 * 0.1, 255 * 0.1, 255 * 0.1 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_FRONT, Color( 255 * 1.3, 255 * 1.3, 255 * 1.3 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_BACK, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_RIGHT, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_LEFT, Color( 255 * 0.2, 255 * 0.2, 255 * 0.2 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_TOP, Color( 255 * 2.3, 255 * 2.3, 255 * 2.3 ) )
+ self.ModelPanel:SetDirectionalLight( BOX_BOTTOM, Color( 255 * 0.1, 255 * 0.1, 255 * 0.1 ) )
end
@@ -240,7 +236,7 @@ function PANEL:RightLayout()
self.ModelPanel:SetCamPos( campos )
self.ModelPanel:SetFOV( 45 )
- self.ModelPanel:SetLookAng( (campos * -1):Angle() )
+ self.ModelPanel:SetLookAng( ( campos * -1 ):Angle() )
end
@@ -279,11 +275,8 @@ end
function PANEL:RenderIcon()
- local ent = self.ModelPanel:GetEntity()
-
local tab = {}
- tab.ent = ent
-
+ tab.ent = self.ModelPanel:GetEntity()
tab.cam_pos = self.ModelPanel:GetCamPos()
tab.cam_ang = self.ModelPanel:GetLookAng()
tab.cam_fov = self.ModelPanel:GetFOV()
@@ -1,29 +1,24 @@
local g_Progress = nil
-
-
-
hook.Add( "SpawniconGenerated", "SpawniconGenerated", function( lastmodel, imagename, modelsleft )
if ( !IsValid( g_Progress ) ) then
-
+
g_Progress = vgui.Create( "DPanel" )
g_Progress:SetSize( 64+10, 64+10+20 )
g_Progress:SetBackgroundColor( Color( 0, 0, 0, 100 ) )
g_Progress:SetDrawOnTop( true )
g_Progress:DockPadding( 5, 0, 5, 5 )
g_Progress.Think = function()
-
+
if ( SysTime() - g_Progress.LastTouch < 3 ) then return end
-
+
g_Progress:Remove()
g_Progress.LastTouch = SysTime()
-
+
end
-
-
local label = g_Progress:Add( "DLabel" )
label:Dock( BOTTOM )
label:SetText( "remaining" )
@@ -32,32 +27,31 @@ hook.Add( "SpawniconGenerated", "SpawniconGenerated", function( lastmodel, image
label:SetContentAlignment( 5 )
label:SetHeight( 14 )
label:SetFont( "DefaultSmall" )
-
+
g_Progress.Label = g_Progress:Add( "DLabel" )
g_Progress.Label:Dock( BOTTOM )
g_Progress.Label:SetTextColor( Color( 255, 255, 255, 255 ) )
g_Progress.Label:SetExpensiveShadow( 1, Color( 0, 0, 0, 200 ) )
g_Progress.Label:SetContentAlignment( 5 )
g_Progress.Label:SetFont( "DermaDefaultBold" )
g_Progress.Label:SetHeight( 14 )
-
+
g_Progress.icon = vgui.Create( "DImage", g_Progress )
g_Progress.icon:SetSize( 64, 64 )
g_Progress.icon:Dock( TOP )
-
+
end
-
+
g_Progress.LastTouch = SysTime()
-
+
imagename = imagename:Replace( "materials\\", "" )
imagename = imagename:Replace( "materials/", "" )
-
+
g_Progress.icon:SetImage( imagename )
-
+
g_Progress:AlignRight( 10 )
g_Progress:AlignBottom( 10 )
-
+
g_Progress.Label:SetText( modelsleft )
end )
-
@@ -1,7 +1,8 @@
+
--[[---------------------------------------------------------
- Get the real frame time, instead of the
- host_timescale linked frametime. This is for things
- like GUI effects. NOT FOR REAL IN GAME STUFF(!!!)
+ Get the real frame time, instead of the
+ host_timescale linked frametime. This is for things
+ like GUI effects. NOT FOR REAL IN GAME STUFF(!!!)
-----------------------------------------------------------]]
local FrameTime = 0
local LastQuery = 0
@@ -15,30 +16,30 @@ local function RealFrameTimeThink()
end
-hook.Add( "Think", "RealFrameTime", RealFrameTimeThink ) -- Think is called after ever frame on the client.
+hook.Add( "Think", "RealFrameTime", RealFrameTimeThink ) -- Think is called after every frame on the client.
local function RenderSpawnIcon_Prop( model, pos, middle, size )
if ( size < 900 ) then
- size = size * (1 - ( size / 900 ))
+ size = size * ( 1 - ( size / 900 ) )
else
- size = size * (1 - ( size / 4096 ))
+ size = size * ( 1 - ( size / 4096 ) )
end
-
+
size = math.Clamp( size, 5, 1000 )
- local ViewAngle = Angle( 25, 40, 0 )
+ local ViewAngle = Angle( 25, 220, 0 )
local ViewPos = pos + ViewAngle:Forward() * size * -15
local view = {}
-
+
view.fov = 4 + size * 0.04
- view.origin = ViewPos + middle
+ view.origin = ViewPos + middle
view.znear = 1
view.zfar = ViewPos:Distance( pos ) + size * 2
view.angles = ViewAngle
return view
-
+
end
local function RenderSpawnIcon_Ragdoll( model, pos, middle, size )
@@ -48,15 +49,15 @@ local function RenderSpawnIcon_Ragdoll( model, pos, middle, size )
local ViewAngle = at.Ang + Angle( -10, 160, 0 )
local ViewPos = at.Pos + ViewAngle:Forward() * -60 + ViewAngle:Up() * -2
local view = {}
-
+
view.fov = 10
- view.origin = ViewPos
+ view.origin = ViewPos
view.znear = 0.1
view.zfar = 100
view.angles = ViewAngle
return view
-
+
end
--
@@ -69,90 +70,92 @@ local function RenderSpawnIcon_Ragdoll_Head( model, pos, middle, size )
local ViewAngle = at.Ang + Angle( -10, 160, 0 )
local ViewPos = at.Pos + ViewAngle:Forward() * -67 + ViewAngle:Up() * -7 + ViewAngle:Right() * 1.5
local view = {}
-
+
view.fov = 10
- view.origin = ViewPos
+ view.origin = ViewPos
view.znear = 0.1
view.zfar = 100
view.angles = ViewAngle
return view
-
+
end
local function RenderSpawnIcon_DOD( model, pos, middle, size )
- local ViewAngle = Angle( 15, -40, 0 )
- local ViewPos = pos + ViewAngle:Forward() * -100 + ViewAngle:Up() * 20
+ local ViewAngle = Angle( 0, 160, 0 )
+ local ViewPos = pos + ViewAngle:Forward() * -67 + ViewAngle:Up() * 30 + ViewAngle:Right() * 2.5
local view = {}
-
- view.fov = 20
- view.origin = ViewPos + middle
+
+ view.fov = 10
+ view.origin = ViewPos + middle
view.znear = 1
view.zfar = ViewPos:Distance( pos ) + size * 2
view.angles = ViewAngle
return view
-
+
end
local function RenderSpawnIcon_CS( model, pos, middle, size )
- local ViewAngle = Angle( 15, -40, 0 )
- local ViewPos = pos + ViewAngle:Forward() * -50 + ViewAngle:Up() * 30 + ViewAngle:Right() * 2
+ local ViewAngle = Angle( 0, 160, 0 )
+ local ViewPos = pos + ViewAngle:Forward() * -70 + ViewAngle:Up() * 32.4 + ViewAngle:Right() * 1.5
local view = {}
-
- view.fov = 20
- view.origin = ViewPos + middle
+
+ view.fov = 10
+ view.origin = ViewPos + middle
view.znear = 1
view.zfar = ViewPos:Distance( pos ) + size * 2
view.angles = ViewAngle
return view
-
+
end
local function RenderSpawnIcon_Special( model, pos, middle, size, x, y, z )
- local ViewAngle = Angle( 15, -40, 0 )
+ local ViewAngle = Angle( 15, 140, 0 )
local ViewPos = pos + ViewAngle:Forward() * x + ViewAngle:Up() * y + ViewAngle:Right() * z
local view = {}
-
+
view.fov = 20
- view.origin = ViewPos + middle
+ view.origin = ViewPos + middle
view.znear = 1
view.zfar = ViewPos:Distance( pos ) + size * 2
view.angles = ViewAngle
return view
-
+
end
SpawniconGenFunctions = {}
function PositionSpawnIcon( model, pos )
local mn, mx = model:GetRenderBounds()
- local middle = (mn + mx) * 0.5
+ local middle = ( mn + mx ) * 0.5
local size = 0
- size = math.max( size, math.abs(mn.x) + math.abs(mx.x) );
- size = math.max( size, math.abs(mn.y) + math.abs(mx.y) );
- size = math.max( size, math.abs(mn.z) + math.abs(mx.z) );
-
+ size = math.max( size, math.abs( mn.x ) + math.abs( mx.x ) )
+ size = math.max( size, math.abs( mn.y ) + math.abs( mx.y ) )
+ size = math.max( size, math.abs( mn.z ) + math.abs( mx.z ) )
+
model:SetPos( pos )
- model:SetAngles( Angle( 0, 180, 0 ) )
-
+ model:SetAngles( Angle( 0, 0, 0 ) )
+
local ModelName = model:GetModel()
ModelName = string.Replace( ModelName, "--", "/" )
ModelName = string.Replace( ModelName, "\\", "/" )
-
+ ModelName = string.Replace( ModelName, "//", "/" )
+ ModelName = string.Replace( ModelName, "\\\\", "/" )
+
local fnc = SpawniconGenFunctions[ ModelName ]
if ( fnc ) then return fnc( model, pos, middle, size ) end
-
+
if ( model:LookupAttachment( "eyes" ) > 0 ) then
return RenderSpawnIcon_Ragdoll( model, pos, middle, size )
end
-
+
if ( model:LookupAttachment( "head" ) > 0 ) then
return RenderSpawnIcon_Ragdoll_Head( model, pos, middle, size )
end
@@ -186,35 +189,28 @@ SpawniconGenFunctions[ "models/player/t_arctic.mdl" ] = RenderSpawnIcon_CS
SpawniconGenFunctions[ "models/player/t_guerilla.mdl" ] = RenderSpawnIcon_CS
-- L4D Models
-SpawniconGenFunctions[ "models/infected/witch.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -40, 25, 2 ) end
-SpawniconGenFunctions[ "models/infected/smoker.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -60, 33, 5 ) end
+SpawniconGenFunctions[ "models/infected/witch.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -40, 25, 0 ) end
+SpawniconGenFunctions[ "models/infected/smoker.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -60, 33, 10 ) end
SpawniconGenFunctions[ "models/infected/hunter.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 26, 2 ) end
SpawniconGenFunctions[ "models/infected/hulk.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -70, 30, 11 ) end
-SpawniconGenFunctions[ "models/infected/boomer.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 27, 4 ) end
+SpawniconGenFunctions[ "models/infected/boomer.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 27, 0 ) end
-
-SpawniconGenFunctions[ "models/infected/common_female01.mdl" ] =
-function ( model, pos, middle, size )
+SpawniconGenFunctions[ "models/infected/common_female01.mdl" ] = function ( model, pos, middle, size )
local at = model:GetAttachment( model:LookupAttachment( "forward" ) )
- local ViewAngle = at.Ang + Angle( 180, 180, 0 ) + Angle( 0, -45, -45 )
- local ViewPos = at.Pos + ViewAngle:Forward() * -90 + ViewAngle:Up() * -4 + ViewAngle:Right() * 1.5
+ local ViewAngle = at.Ang + Angle( 180, 180, 0 ) + Angle( 10, -85, -85 )
+ local ViewPos = at.Pos + ViewAngle:Forward() * -76 + ViewAngle:Up() * -1.5 + ViewAngle:Right() * 0
return { fov = 10, origin = ViewPos, znear = 0.1, zfar = 200, angles = ViewAngle }
-
+
end
SpawniconGenFunctions[ "models/infected/common_female_nurse01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ]
SpawniconGenFunctions[ "models/infected/common_female_rural01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ]
-SpawniconGenFunctions[ "models/infected/common_male01.mdl" ] =
-function ( model, pos, middle, size )
-
- local at = model:GetAttachment( model:LookupAttachment( "forward" ) )
- local ViewAngle = at.Ang + Angle( 0, 155, 0 ) + Angle( 0, 0, 0 )
- local ViewPos = at.Pos + ViewAngle:Forward() * -90 + ViewAngle:Up() * -4 + ViewAngle:Right() * 1.5
- return { fov = 10, origin = ViewPos, znear = 0.1, zfar = 200, angles = ViewAngle }
-
-end
+SpawniconGenFunctions[ "models/infected/common_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ]
+SpawniconGenFunctions[ "models/infected/common_test.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ]
+SpawniconGenFunctions[ "models/infected/common_morph_test.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ] // Bad start animation
+SpawniconGenFunctions[ "models/infected/common_male_fallen_survivor.mdl" ] = SpawniconGenFunctions[ "models/infected/common_female01.mdl" ] // Bad start animation
SpawniconGenFunctions[ "models/infected/common_male_baggagehandler_01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
SpawniconGenFunctions[ "models/infected/common_male_pilot.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
@@ -223,7 +219,7 @@ SpawniconGenFunctions[ "models/infected/common_male_suit.mdl" ] = SpawniconGenFu
SpawniconGenFunctions[ "models/infected/common_military_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
SpawniconGenFunctions[ "models/infected/common_police_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
SpawniconGenFunctions[ "models/infected/common_patient_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
-SpawniconGenFunctions[ "models/infected/common_surgeon_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
+SpawniconGenFunctions[ "models/infected/common_surgeon_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ] // Bad start animation
SpawniconGenFunctions[ "models/infected/common_tsaagent_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
SpawniconGenFunctions[ "models/infected/common_worker_male01.mdl" ] = SpawniconGenFunctions[ "models/infected/common_male01.mdl" ]
@@ -236,8 +232,8 @@ SpawniconGenFunctions[ "models/zombies/zombie4/zombie4.mdl" ] = function( a, b,
SpawniconGenFunctions[ "models/zombies/zombie5/zombie5.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -100, 17, 10 ) end
-- L4D2
-SpawniconGenFunctions[ "models/infected/boomette.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 28, 3 ) end
+SpawniconGenFunctions[ "models/infected/boomette.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 28, 0 ) end
SpawniconGenFunctions[ "models/infected/charger.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -70, 14, 20 ) end
-SpawniconGenFunctions[ "models/infected/jockey.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, -5, 18 ) end
-SpawniconGenFunctions[ "models/infected/spitter.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -1, 0, -70 ) end
-
+SpawniconGenFunctions[ "models/infected/jockey.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -50, 0, 7 ) end
+SpawniconGenFunctions[ "models/infected/spitter.mdl" ] = function( a, b, c, d ) return RenderSpawnIcon_Special( a, b, c, d, -1, 0, -70 ) end // as good as deleted
+SpawniconGenFunctions[ "models/infected/hulk_dlc3.mdl" ] = SpawniconGenFunctions[ "models/infected/hulk.mdl" ]

0 comments on commit e3a8366

Please sign in to comment.