ncItem: add SetItemModel, SetPickupSound, GetPickupSound, GetItemName, ItemForID methods
ncPlayer: add SelectInventoryItem, LocalSound methods ncFX: add CastScreenFlash method ncEntity: add CalculateLightLevel
This commit is contained in:
parent
f3fb7c6614
commit
f6a3243eb7
37 changed files with 229 additions and 203 deletions
|
@ -1,3 +1,8 @@
|
|||
void Class_Rules(void)
|
||||
{
|
||||
spawnfunc_H2Rules();
|
||||
}
|
||||
|
||||
void Precaches(void)
|
||||
{
|
||||
INIT_ITEM(H2Torch)
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2BlastRadius:ncItem {
|
|||
void H2BlastRadius(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2BlastRadius::H2BlastRadius( void ) {
|
|||
}
|
||||
|
||||
void H2BlastRadius::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_blast.mdl" );
|
||||
SetInventoryID( 10 );
|
||||
}
|
||||
|
||||
void H2BlastRadius::Spawn( void ) {
|
||||
SetModel( "models/a_blast.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_blast.mdl" );
|
||||
}
|
||||
|
||||
void H2BlastRadius::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2CubeOfForce:ncItem {
|
|||
void H2CubeOfForce(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2CubeOfForce::H2CubeOfForce( void ) {
|
|||
}
|
||||
|
||||
void H2CubeOfForce::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_cube.mdl" );
|
||||
SetInventoryID( 13 );
|
||||
}
|
||||
|
||||
void H2CubeOfForce::Spawn( void ) {
|
||||
SetModel( "models/a_cube.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_cube.mdl" );
|
||||
}
|
||||
|
||||
void H2CubeOfForce::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Flight:ncItem {
|
|||
void H2Flight(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Flight::H2Flight( void ) {
|
|||
}
|
||||
|
||||
void H2Flight::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/ringft.mdl" );
|
||||
SetInventoryID( 12 );
|
||||
}
|
||||
|
||||
void H2Flight::Spawn( void ) {
|
||||
SetModel( "models/ringft.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/ringft.mdl" );
|
||||
}
|
||||
|
||||
void H2Flight::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Glyph:ncItem {
|
|||
void H2Glyph(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Glyph::H2Glyph( void ) {
|
|||
}
|
||||
|
||||
void H2Glyph::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_glyph.mdl" );
|
||||
SetInventoryID( 8 );
|
||||
}
|
||||
|
||||
void H2Glyph::Spawn( void ) {
|
||||
SetModel( "models/a_glyph.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_glyph.mdl" );
|
||||
}
|
||||
|
||||
void H2Glyph::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Haste:ncItem {
|
|||
void H2Haste(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Haste::H2Haste( void ) {
|
|||
}
|
||||
|
||||
void H2Haste::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_haste.mdl" );
|
||||
SetInventoryID( 9 );
|
||||
}
|
||||
|
||||
void H2Haste::Spawn( void ) {
|
||||
SetModel( "models/a_haste.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_haste.mdl" );
|
||||
}
|
||||
|
||||
void H2Haste::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2HealthBoost:ncItem {
|
|||
void H2HealthBoost(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2HealthBoost::H2HealthBoost( void ) {
|
|||
}
|
||||
|
||||
void H2HealthBoost::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_invinc.mdl" );
|
||||
SetInventoryID( 1 );
|
||||
}
|
||||
|
||||
void H2HealthBoost::Spawn( void ) {
|
||||
SetModel( "models/a_invinc.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_invinc.mdl" );
|
||||
}
|
||||
|
||||
void H2HealthBoost::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Invincibility:ncItem {
|
|||
void H2Invincibility(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Invincibility::H2Invincibility( void ) {
|
|||
}
|
||||
|
||||
void H2Invincibility::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_invinc.mdl" );
|
||||
SetInventoryID( 14 );
|
||||
}
|
||||
|
||||
void H2Invincibility::Spawn( void ) {
|
||||
SetModel( "models/a_invinc.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_invinc.mdl" );
|
||||
}
|
||||
|
||||
void H2Invincibility::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Invisibility:ncItem {
|
|||
void H2Invisibility(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Invisibility::H2Invisibility( void ) {
|
|||
}
|
||||
|
||||
void H2Invisibility::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_invis.mdl" );
|
||||
SetInventoryID( 7 );
|
||||
}
|
||||
|
||||
void H2Invisibility::Spawn( void ) {
|
||||
SetModel( "models/a_invis.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_invis.mdl" );
|
||||
}
|
||||
|
||||
void H2Invisibility::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2ManaBoost:ncItem {
|
|||
void H2ManaBoost(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2ManaBoost::H2ManaBoost( void ) {
|
|||
}
|
||||
|
||||
void H2ManaBoost::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_mboost.mdl" );
|
||||
SetInventoryID( 3 );
|
||||
}
|
||||
|
||||
void H2ManaBoost::Spawn( void ) {
|
||||
SetModel( "models/a_mboost.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_mboost.mdl" );
|
||||
}
|
||||
|
||||
void H2ManaBoost::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Polymorph:ncItem {
|
|||
void H2Polymorph(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Polymorph::H2Polymorph( void ) {
|
|||
}
|
||||
|
||||
void H2Polymorph::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_poly.mdl" );
|
||||
SetInventoryID( 11 );
|
||||
}
|
||||
|
||||
void H2Polymorph::Spawn( void ) {
|
||||
SetModel( "models/a_poly.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_poly.mdl" );
|
||||
}
|
||||
|
||||
void H2Polymorph::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Summon:ncItem {
|
|||
void H2Summon(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Summon::H2Summon( void ) {
|
|||
}
|
||||
|
||||
void H2Summon::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_summon.mdl" );
|
||||
SetInventoryID( 6 );
|
||||
}
|
||||
|
||||
void H2Summon::Spawn( void ) {
|
||||
SetModel( "models/a_summon.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_summon.mdl" );
|
||||
}
|
||||
|
||||
void H2Summon::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2SuperHBoost:ncItem {
|
|||
void H2SuperHBoost(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2SuperHBoost::H2SuperHBoost( void ) {
|
|||
}
|
||||
|
||||
void H2SuperHBoost::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_shbost.mdl" );
|
||||
SetInventoryID( 2 );
|
||||
}
|
||||
|
||||
void H2SuperHBoost::Spawn( void ) {
|
||||
SetModel( "models/a_shbost.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_shbost.mdl" );
|
||||
}
|
||||
|
||||
void H2SuperHBoost::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Teleport:ncItem {
|
|||
void H2Teleport(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Teleport::H2Teleport( void ) {
|
|||
}
|
||||
|
||||
void H2Teleport::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_telprt.mdl" );
|
||||
SetInventoryID( 4 );
|
||||
}
|
||||
|
||||
void H2Teleport::Spawn( void ) {
|
||||
SetModel( "models/a_telprt.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_telprt.mdl" );
|
||||
}
|
||||
|
||||
void H2Teleport::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2TomeOfPower:ncItem {
|
|||
void H2TomeOfPower(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2TomeOfPower::H2TomeOfPower( void ) {
|
|||
}
|
||||
|
||||
void H2TomeOfPower::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_tome.mdl" );
|
||||
SetInventoryID( 5 );
|
||||
}
|
||||
|
||||
void H2TomeOfPower::Spawn( void ) {
|
||||
SetModel( "models/a_tome.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_tome.mdl" );
|
||||
}
|
||||
|
||||
void H2TomeOfPower::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -2,7 +2,6 @@ class H2Torch:ncItem {
|
|||
void H2Torch(void);
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
};
|
||||
|
@ -11,13 +10,8 @@ void H2Torch::H2Torch( void ) {
|
|||
}
|
||||
|
||||
void H2Torch::Precache( void ) {
|
||||
ncEngine::Precache_Model( "models/a_torch.mdl" );
|
||||
SetInventoryID( 0 );
|
||||
}
|
||||
|
||||
void H2Torch::Spawn( void ) {
|
||||
SetModel( "models/a_torch.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "models/a_torch.mdl" );
|
||||
}
|
||||
|
||||
void H2Torch::OnInventoryUse( ncEntity carrier ) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
../../src/include.src
|
||||
|
||||
entities/obj_tree2.qc
|
||||
entities/test_effects.qc
|
||||
|
||||
items/blastradius.qc
|
||||
items/cubeofforce.qc
|
||||
|
@ -23,5 +22,6 @@ items/teleport.qc
|
|||
items/tomeofpower.qc
|
||||
items/torch.qc
|
||||
|
||||
rules.qc
|
||||
init.qc
|
||||
#endlist
|
|
@ -3,7 +3,6 @@ class Q1Quad:ncItem {
|
|||
void Q1Quad( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void OnPickup( ncEntity );
|
||||
};
|
||||
|
@ -13,15 +12,10 @@ void Q1Quad::Q1Quad( void ) {
|
|||
}
|
||||
|
||||
void Q1Quad::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/quad.mdl" );
|
||||
SetItemModel("progs/quaddama.mdl");
|
||||
SetInventoryID( 0 );
|
||||
}
|
||||
|
||||
void Q1Quad::Spawn( void ) {
|
||||
//SetModel( "progs/g_axe.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
}
|
||||
|
||||
void Q1Quad::OnPickup( ncEntity carrier ) {
|
||||
carrier.SPrint(PRINT_LOW, carrier.netname );
|
||||
carrier.SPrint(PRINT_LOW, " picked up the quad!\n");
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1Axe:ncItem {
|
|||
void Q1Axe( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -19,11 +18,6 @@ void Q1Axe::Precache( void ) {
|
|||
SetWeaponID( WEAPON_AXE );
|
||||
}
|
||||
|
||||
void Q1Axe::Spawn( void ) {
|
||||
//SetModel( "progs/g_axe.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
}
|
||||
|
||||
void Q1Axe::Draw( ncEntity carrier ) {
|
||||
carrier.hud.SetWeaponModel("progs/v_axe.mdl");
|
||||
carrier.hud.SetWeaponFrame(0);
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1GrenadeLauncher:ncItem {
|
|||
void Q1GrenadeLauncher( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -15,14 +14,9 @@ void Q1GrenadeLauncher::Q1GrenadeLauncher( void ) {
|
|||
}
|
||||
|
||||
void Q1GrenadeLauncher::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_rock.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_rock.mdl" );
|
||||
SetWeaponID( WEAPON_ROCKET_LAUNCHER );
|
||||
}
|
||||
|
||||
void Q1GrenadeLauncher::Spawn( void ) {
|
||||
SetModel( "progs/g_rock.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetWeaponID( WEAPON_GRENADE_LAUNCHER );
|
||||
SetItemModel( "progs/g_rock.mdl" );
|
||||
}
|
||||
|
||||
void Q1GrenadeLauncher::Draw( ncEntity carrier ) {
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1Lightning:ncItem {
|
|||
void Q1Lightning( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -15,14 +14,9 @@ void Q1Lightning::Q1Lightning( void ) {
|
|||
}
|
||||
|
||||
void Q1Lightning::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_light.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_light.mdl" );
|
||||
SetWeaponID( WEAPON_LIGHTNING );
|
||||
}
|
||||
|
||||
void Q1Lightning::Spawn( void ) {
|
||||
SetModel( "progs/g_light.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "progs/g_light.mdl" );
|
||||
}
|
||||
|
||||
void Q1Lightning::Draw( ncEntity carrier ) {
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1Nailgun:ncItem {
|
|||
void Q1Nailgun( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -15,14 +14,9 @@ void Q1Nailgun::Q1Nailgun( void ) {
|
|||
}
|
||||
|
||||
void Q1Nailgun::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_nail.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_nail.mdl" );
|
||||
SetWeaponID( WEAPON_NAILGUN );
|
||||
}
|
||||
|
||||
void Q1Nailgun::Spawn( void ) {
|
||||
SetModel( "progs/g_nail.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "progs/g_nail.mdl" );
|
||||
}
|
||||
|
||||
void Q1Nailgun::Draw( ncEntity carrier ) {
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1RocketLauncher:ncItem {
|
|||
void Q1RocketLauncher( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -15,14 +14,9 @@ void Q1RocketLauncher::Q1RocketLauncher( void ) {
|
|||
}
|
||||
|
||||
void Q1RocketLauncher::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_rock2.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_rock2.mdl" );
|
||||
SetWeaponID( WEAPON_ROCKET_LAUNCHER );
|
||||
}
|
||||
|
||||
void Q1RocketLauncher::Spawn( void ) {
|
||||
SetModel( "progs/g_rock2.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "progs/g_rock2.mdl" );
|
||||
}
|
||||
|
||||
void Q1RocketLauncher::Draw( ncEntity carrier ) {
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1Shotgun:ncItem {
|
|||
void Q1Shotgun( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -19,10 +18,6 @@ void Q1Shotgun::Precache( void ) {
|
|||
SetWeaponID( WEAPON_SHOTGUN );
|
||||
}
|
||||
|
||||
void Q1Shotgun::Spawn( void ) {
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
}
|
||||
|
||||
void Q1Shotgun::Draw( ncEntity carrier ) {
|
||||
carrier.hud.SetWeaponModel("progs/v_shot.mdl");
|
||||
carrier.hud.SetWeaponFrame(0);
|
||||
|
|
|
@ -3,7 +3,6 @@ class Q1SuperNailgun:ncItem {
|
|||
void Q1SuperNailgun( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
|
@ -15,14 +14,9 @@ void Q1SuperNailgun::Q1SuperNailgun( void ) {
|
|||
}
|
||||
|
||||
void Q1SuperNailgun::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_nail2.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_nail2.mdl" );
|
||||
SetWeaponID( WEAPON_SUPER_NAILGUN );
|
||||
}
|
||||
|
||||
void Q1SuperNailgun::Spawn( void ) {
|
||||
SetModel( "progs/g_nail2.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetItemModel( "progs/g_nail2.mdl" );
|
||||
}
|
||||
|
||||
void Q1SuperNailgun::Draw( ncEntity carrier ) {
|
||||
|
|
|
@ -3,11 +3,9 @@ class Q1SuperShotgun:ncItem {
|
|||
void Q1SuperShotgun( void );
|
||||
|
||||
virtual void Precache( void );
|
||||
virtual void Spawn( void );
|
||||
|
||||
virtual void Draw( ncEntity );
|
||||
virtual void PrimaryAttack( ncEntity );
|
||||
virtual void OnPickup( ncEntity );
|
||||
};
|
||||
|
||||
void Q1SuperShotgun::Q1SuperShotgun( void ) {
|
||||
|
@ -15,15 +13,9 @@ void Q1SuperShotgun::Q1SuperShotgun( void ) {
|
|||
}
|
||||
|
||||
void Q1SuperShotgun::Precache( void ) {
|
||||
ncEngine::Precache_Model( "progs/g_shot.mdl" );
|
||||
ncEngine::Precache_Model( "progs/v_shot2.mdl" );
|
||||
SetWeaponID( WEAPON_SUPER_SHOTGUN );
|
||||
}
|
||||
|
||||
void Q1SuperShotgun::Spawn( void ) {
|
||||
SetModel( "progs/g_shot.mdl" );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetSize( VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
SetItemModel( "progs/g_shot.mdl" );
|
||||
}
|
||||
|
||||
void Q1SuperShotgun::Draw( ncEntity carrier ) {
|
||||
|
@ -37,9 +29,4 @@ void Q1SuperShotgun::PrimaryAttack( ncEntity carrier ) {
|
|||
carrier.SetNextPrimaryAttack( 0.5f );
|
||||
}
|
||||
|
||||
void Q1SuperShotgun::OnPickup( ncEntity carrier ) {
|
||||
carrier.SPrint( PRINT_LOW, carrier.netname );
|
||||
carrier.SPrint( PRINT_LOW, " picked up a super shotgun!\n" );
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_supershotgun, Q1SuperShotgun )
|
|
@ -1,9 +1,31 @@
|
|||
class idLight:ncEntity {
|
||||
void idLight( void );
|
||||
class ncLight:ncEntity {
|
||||
void ncLight( void );
|
||||
|
||||
nonvirtual float LightLevelForEntity( ncEntity );
|
||||
};
|
||||
|
||||
void idLight::idLight( void ) {
|
||||
void ncLight::ncLight( void ) {
|
||||
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(light, idLight)
|
||||
#ifndef TARGET_HEXEN2
|
||||
.float light_level;
|
||||
#endif
|
||||
|
||||
float ncLight::LightLevelForEntity( ncEntity target ) {
|
||||
float maxDistance = 150; /* Q1/H2 = linear falloff */
|
||||
float currDistance = ncMath::VLen(GetOrigin() - target.GetOrigin());
|
||||
|
||||
if (currDistance > maxDistance)
|
||||
return 0.0f;
|
||||
|
||||
ncEngine::TraceLine(GetOrigin(), target.GetOrigin(), FALSE, this);
|
||||
|
||||
if ( ( trace_ent == target ) || ( trace_fraction == 1.0f ) ) {
|
||||
return maxDistance - currDistance;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(light, ncLight)
|
|
@ -115,6 +115,8 @@ void PlayerPreThink( void ) {
|
|||
if (self.health <= 0)
|
||||
return;
|
||||
|
||||
pl.CalculateLightLevel();
|
||||
|
||||
#if 0
|
||||
if (pl.GetDeadFlag() >= DEAD_DYING) {
|
||||
pl.DeadThink();
|
||||
|
@ -146,7 +148,7 @@ void PlayerPreThink( void ) {
|
|||
// camAngle[2] = ncMath::Sin(time) * 45.0f;
|
||||
float progress = pl.inCamera.GetCameraTime() / pl.inCamera.GetCameraLength();
|
||||
|
||||
#if CAM_DEBUG
|
||||
#if 0
|
||||
pl.hud.SetExperience(progress * 999999);
|
||||
progress *= 100;
|
||||
pl.hud.SetHealth(progress);
|
||||
|
@ -212,7 +214,7 @@ void PlayerPostThink( void ) {
|
|||
pl.SPrint(PRINT_LOW, " toggles crouch\n");
|
||||
break;
|
||||
case 23: /* inventory use */
|
||||
pl.UseInventoryItem( pl.GetInventoryItem() );
|
||||
pl.UseInventoryItem( pl.GetInventoryItem() - 1 );
|
||||
break;
|
||||
case 25: /* inventory next */
|
||||
pl.NextInventoryItem();
|
||||
|
@ -221,7 +223,7 @@ void PlayerPostThink( void ) {
|
|||
pl.PreviousInventoryItem();
|
||||
break;
|
||||
case 44: /* inventory drop */
|
||||
pl.DropInventoryItem( pl.GetInventoryItem() );
|
||||
pl.DropInventoryItem( pl.GetInventoryItem() - 1 );
|
||||
break;
|
||||
case 100:
|
||||
case 101:
|
||||
|
|
|
@ -9,6 +9,7 @@ void ncEntity::ncEntity( void ) {
|
|||
|
||||
if (g_world_initialized == false) {
|
||||
Precache();
|
||||
_InternalPostPrecache();
|
||||
}
|
||||
_InternalPreSpawn();
|
||||
Spawn();
|
||||
|
@ -24,6 +25,9 @@ void ncEntity::_InternalPreSpawn( void ) {
|
|||
void ncEntity::_InternalPostSpawn( void ) {
|
||||
}
|
||||
|
||||
void ncEntity::_InternalPostPrecache( void ) {
|
||||
}
|
||||
|
||||
void ncEntity::Spawn( void ) {
|
||||
}
|
||||
|
||||
|
@ -745,4 +749,25 @@ void ncEntity::PrimaryAttack( ncEntity carrier ) {
|
|||
void ncEntity::SetNextPrimaryAttack(float attackDelay)
|
||||
{
|
||||
next_primary_attack = time + attackDelay;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* wannabe thief */
|
||||
void ncEntity::CalculateLightLevel( void )
|
||||
{
|
||||
#ifndef TARGET_HEXEN2
|
||||
float lightValue = 0.0f;
|
||||
|
||||
for ( ncEntity a = ( ncEntity) world; ( a = ( ncEntity )find( a, ::classname, "ncLight" ) ); ) {
|
||||
ncLight targetLight = (ncLight)a;
|
||||
lightValue += targetLight.LightLevelForEntity(this);
|
||||
}
|
||||
|
||||
if (lightValue > 255.0) {
|
||||
lightValue = 255.0f;
|
||||
}
|
||||
|
||||
light_level = lightValue;
|
||||
#endif
|
||||
}
|
|
@ -272,7 +272,7 @@ public:
|
|||
nonvirtual float CheckBottom( void );
|
||||
nonvirtual vector Aim( float speed );
|
||||
nonvirtual void MakeStatic( void );
|
||||
nonvirtual void CenterPrint( string s );
|
||||
nonvirtual void CenterPrint( string );
|
||||
nonvirtual bool DropToFloor( void );
|
||||
nonvirtual void Remove( void );
|
||||
nonvirtual float WalkMove( float yaw, float dist );
|
||||
|
@ -297,9 +297,13 @@ public:
|
|||
virtual void PrimaryAttack( ncEntity );
|
||||
nonvirtual void SetNextPrimaryAttack( float );
|
||||
|
||||
/** Recalculate the light level of the entity, run automatically on players during PreThink. */
|
||||
nonvirtual void CalculateLightLevel( void );
|
||||
|
||||
private:
|
||||
virtual void _InternalPreSpawn( void );
|
||||
virtual void _InternalPostSpawn( void );
|
||||
virtual void _InternalPostPrecache( void );
|
||||
};
|
||||
|
||||
var bool g_world_initialized;
|
||||
|
|
|
@ -8,6 +8,11 @@ void ncFX::LightStyle( float style, string value ) {
|
|||
lightstyle( style, value );
|
||||
}
|
||||
|
||||
void ncFX:: CastScreenFlash( ncPlayer targetPlayer ) {
|
||||
targetPlayer.StuffCmd( "bf\n" );
|
||||
}
|
||||
|
||||
|
||||
void ncFX::CastDamageScreen( ncPlayer targetPlayer, float armorValue, float bloodValue, vector damageOrigin ) {
|
||||
|
||||
ncNet::WriteByte( FX_MSGTYPE, SVC_DAMAGE );
|
||||
|
|
|
@ -12,6 +12,8 @@ class ncFX
|
|||
nonvirtual void Particle( vector o, vector d, float color, float count );
|
||||
nonvirtual void LightStyle( float style, string value );
|
||||
|
||||
/** causes the target player's screen to flash. */
|
||||
nonvirtual void CastScreenFlash( ncPlayer );
|
||||
/** Causes the target player to receive a damage screen. */
|
||||
nonvirtual void CastDamageScreen( ncPlayer, float, float, vector );
|
||||
/** Causes the target entity to cast a muzzleflash. */
|
||||
|
|
|
@ -2,8 +2,26 @@
|
|||
.float item;
|
||||
|
||||
void ncItem::ncItem(void) {
|
||||
SetSize( VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
SetTouchCallback(ItemTouched);
|
||||
nc_pckupsnd = "weapons/pkup.wav";
|
||||
}
|
||||
|
||||
void ncItem::Spawn( void ) {
|
||||
SetModel( nc_model );
|
||||
SetSolid( SOLID_TRIGGER );
|
||||
SetSize( VEC_HULL_MIN, VEC_HULL_MAX );
|
||||
}
|
||||
|
||||
void ncItem::SetItemModel( string modelPath ) {
|
||||
nc_model = modelPath;
|
||||
}
|
||||
|
||||
void ncItem::SetPickupSound( string soundPath ) {
|
||||
nc_pckupsnd = soundPath;
|
||||
}
|
||||
|
||||
string ncItem::GetPickupSound( void ) {
|
||||
return nc_pckupsnd;
|
||||
}
|
||||
|
||||
void ncItem::SetWeaponID(float a) {
|
||||
|
@ -22,6 +40,19 @@ float ncItem::GetInventoryID(void) {
|
|||
return nc_itemid;
|
||||
}
|
||||
|
||||
string ncItem::GetItemName(void) {
|
||||
if (nc_name) {
|
||||
return nc_name;
|
||||
} else {
|
||||
string fallbackName;
|
||||
if (nc_wepnid > 0)
|
||||
fallbackName = ncEngine::FloatToString( nc_wepnid - 1 );
|
||||
else
|
||||
fallbackName = ncEngine::FloatToString( nc_itemid - 1 );
|
||||
return fallbackName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ncItem::ItemTouched( ncEntity toucher ) {
|
||||
ncPlayer playerToucher;
|
||||
|
@ -111,6 +142,21 @@ void ncItem::Release(ncEntity carrier) {
|
|||
}
|
||||
|
||||
void ncItem::OnPickup(ncEntity carrier) {
|
||||
carrier.SPrint( PRINT_LOW, carrier.netname );
|
||||
|
||||
if ( nc_wepnid > 0 ) {
|
||||
carrier.SPrint( PRINT_LOW, " picked up weapon " );
|
||||
} else {
|
||||
carrier.SPrint( PRINT_LOW, " picked up item " );
|
||||
}
|
||||
|
||||
carrier.SPrint( PRINT_LOW, GetItemName() );
|
||||
carrier.SPrint( PRINT_LOW, "!\n" );
|
||||
|
||||
ncFX::CastScreenFlash( carrier );
|
||||
|
||||
if (nc_pckupsnd)
|
||||
Sound( CHAN_ITEM, nc_pckupsnd, 1.0f, ATTN_NORM );
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,4 +165,23 @@ void ncItem::OnInventoryUse( ncEntity carrier ) {
|
|||
carrier.SPrint(PRINT_LOW, " uses item ");
|
||||
carrier.SPrint(PRINT_LOW, ncEngine::FloatToString( inventory ) );
|
||||
carrier.SPrint(PRINT_LOW, " which is unimplemented\n" );
|
||||
}
|
||||
|
||||
ncItem ncItem::ItemForID( float itemNum ) {
|
||||
ncEntity e;
|
||||
while ( ( e = ncEngine::NextEnt( e ) ) ) {
|
||||
if (e.nc_itemid == (itemNum + 1)) {
|
||||
return (ncItem)e;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
void ncItem::_InternalPostPrecache( void ) {
|
||||
if (nc_pckupsnd)
|
||||
ncEngine::Precache_Sound( nc_pckupsnd );
|
||||
if (nc_model)
|
||||
ncEngine::Precache_Model( nc_model );
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
class ncItem:ncEntity {
|
||||
public:
|
||||
void ncItem(void);
|
||||
|
||||
/* Sets the id of an Item. */
|
||||
|
@ -10,8 +11,16 @@ class ncItem:ncEntity {
|
|||
/** Returns the id of an Item. */
|
||||
nonvirtual float GetInventoryID(void);
|
||||
|
||||
nonvirtual void SetItemModel(string);
|
||||
nonvirtual void SetPickupSound(string);
|
||||
nonvirtual string GetPickupSound(void);
|
||||
|
||||
nonvirtual void ItemTouched( ncEntity );
|
||||
|
||||
nonvirtual string GetItemName( void );
|
||||
|
||||
virtual void Spawn( void );
|
||||
|
||||
/** Overridable: Called when we switch to this weapon */
|
||||
virtual void Draw(ncEntity);
|
||||
/** Overridable: On +attack execution. */
|
||||
|
@ -24,7 +33,15 @@ class ncItem:ncEntity {
|
|||
virtual void Release(ncEntity);
|
||||
virtual void OnPickup(ncEntity);
|
||||
virtual void OnInventoryUse( ncEntity );
|
||||
|
||||
nonvirtual ncItem ItemForID( float );
|
||||
|
||||
private:
|
||||
virtual void _InternalPostPrecache( void );
|
||||
};
|
||||
|
||||
.float nc_itemid;
|
||||
.float nc_wepnid;
|
||||
.float nc_wepnid;
|
||||
.string nc_model;
|
||||
.string nc_name;
|
||||
.string nc_pckupsnd;
|
|
@ -103,6 +103,12 @@ void ncPlayer::StuffCmd( string s ) {
|
|||
stuffcmd( this, s );
|
||||
}
|
||||
|
||||
void ncPlayer::LocalSound( string s ) {
|
||||
stuffcmd( this, "play " );
|
||||
stuffcmd( this, s );
|
||||
stuffcmd( this, "\n" );
|
||||
}
|
||||
|
||||
.float item;
|
||||
bool ncPlayer::AddItem( float itemToAdd ) {
|
||||
ncItem theItem;
|
||||
|
@ -174,13 +180,13 @@ bool ncPlayer::ImpulseCommand( float impulseValue ) {
|
|||
|
||||
void ncPlayer::JumpPressed( void ) {
|
||||
SetVelocity(GetVelocity() + [0, 0, 250]);
|
||||
SPrint(PRINT_HIGH, netname );
|
||||
SPrint(PRINT_HIGH, " pressed jump\n" );
|
||||
//SPrint(PRINT_HIGH, netname );
|
||||
//SPrint(PRINT_HIGH, " pressed jump\n" );
|
||||
}
|
||||
|
||||
void ncPlayer::JumpReleased( void ) {
|
||||
SPrint(PRINT_HIGH, netname );
|
||||
SPrint(PRINT_HIGH, " released jump\n" );
|
||||
//SPrint(PRINT_HIGH, netname );
|
||||
//SPrint(PRINT_HIGH, " released jump\n" );
|
||||
}
|
||||
|
||||
float ncPlayer::GetInventoryItem( void ) {
|
||||
|
@ -196,9 +202,12 @@ bool ncPlayer::DropInventoryItem( float itemNum ) {
|
|||
}
|
||||
|
||||
bool ncPlayer::UseInventoryItem( float itemNum ) {
|
||||
|
||||
ncItem theItem;
|
||||
ncEntity e;
|
||||
|
||||
/* engine handles playing the sound in HeXen II */
|
||||
#ifndef TARGET_HEXEN2
|
||||
LocalSound( "misc/invuse.wav" );
|
||||
#endif
|
||||
|
||||
/* check if we have it */
|
||||
if (GetInventoryItemCount( itemNum ) <= 0 ) {
|
||||
|
@ -212,12 +221,7 @@ bool ncPlayer::UseInventoryItem( float itemNum ) {
|
|||
//SPrint(PRINT_LOW, "\n" );
|
||||
|
||||
/* figure out which class we belong to in the world */
|
||||
while ( ( e = ncEngine::NextEnt( e ) ) ) {
|
||||
if (e.nc_itemid == (itemNum + 1)) {
|
||||
theItem = (ncItem)e;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
theItem = ncItem::ItemForID( itemNum );
|
||||
|
||||
if (!theItem) {
|
||||
//ncEngine::Error("Weapon of id ");
|
||||
|
@ -331,6 +335,11 @@ void ncPlayer::NextInventoryItem( void ) {
|
|||
float firstSlot = -1;
|
||||
float nextSlot = -1;
|
||||
|
||||
/* engine handles playing the sound in HeXen II */
|
||||
#ifndef TARGET_HEXEN2
|
||||
LocalSound( "misc/invmove.wav" );
|
||||
#endif
|
||||
|
||||
for ( float f = 0; f < 15; f++ ) {
|
||||
float count = GetInventoryItemCount( f );
|
||||
|
||||
|
@ -352,23 +361,28 @@ void ncPlayer::NextInventoryItem( void ) {
|
|||
if (nextSlot == -1) {
|
||||
/* do we have a first valid one? */
|
||||
if (firstSlot != -1) {
|
||||
inventory = firstSlot;
|
||||
SelectInventoryItem( firstSlot );
|
||||
return;
|
||||
}
|
||||
|
||||
/* else... we just set it to 0, like Hexen 2 does (torch) */
|
||||
inventory = 0;
|
||||
SelectInventoryItem( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
/* we're all good */
|
||||
inventory = nextSlot;
|
||||
SelectInventoryItem( nextSlot );
|
||||
}
|
||||
|
||||
void ncPlayer::PreviousInventoryItem( void ) {
|
||||
float firstSlot = -1;
|
||||
float nextSlot = -1;
|
||||
|
||||
/* engine handles playing the sound in HeXen II */
|
||||
#ifndef TARGET_HEXEN2
|
||||
LocalSound( "misc/invmove.wav" );
|
||||
#endif
|
||||
|
||||
for ( float f = 14; f >= 0; f-- ) {
|
||||
float count = GetInventoryItemCount( f );
|
||||
|
||||
|
@ -388,15 +402,28 @@ void ncPlayer::PreviousInventoryItem( void ) {
|
|||
if (nextSlot == -1) {
|
||||
/* do we have a first valid one? */
|
||||
if (firstSlot != -1) {
|
||||
inventory = firstSlot;
|
||||
SelectInventoryItem( firstSlot );
|
||||
return;
|
||||
}
|
||||
|
||||
/* else... we just set it to 0, like Hexen 2 does (torch) */
|
||||
inventory = 0;
|
||||
SelectInventoryItem( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
/* we're all good */
|
||||
inventory = nextSlot;
|
||||
SelectInventoryItem( nextSlot );
|
||||
}
|
||||
|
||||
void centerprint2(entity client, string s1, string s2) = #73;
|
||||
|
||||
void ncPlayer::SelectInventoryItem( float itemNum )
|
||||
{
|
||||
if (GetInventoryItemCount( itemNum ) <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ncItem theItem = ncItem::ItemForID( itemNum );
|
||||
centerprint2( this, "Selected: ", theItem.GetItemName() );
|
||||
inventory = itemNum;
|
||||
}
|
|
@ -16,6 +16,7 @@ class ncPlayer:ncEntity {
|
|||
nonvirtual string GetInfoKey( string key );
|
||||
nonvirtual void LogFrag( ncEntity victim );
|
||||
nonvirtual void StuffCmd( string s );
|
||||
nonvirtual void LocalSound( string s );
|
||||
|
||||
virtual bool AddItem( float );
|
||||
virtual bool SwitchToItem( float );
|
||||
|
@ -30,4 +31,5 @@ class ncPlayer:ncEntity {
|
|||
nonvirtual void NextInventoryItem( void );
|
||||
nonvirtual void PreviousInventoryItem( void );
|
||||
nonvirtual bool GetInventoryItemCount( float );
|
||||
nonvirtual void SelectInventoryItem( float );
|
||||
};
|
|
@ -15,4 +15,4 @@ ncRules g_gameRules;
|
|||
|
||||
#define INIT_INVENTORY(wid, cname) { ##cname w_##cname = spawn(##cname); w_##cname.nc_itemid = wid + 1; w_##cname.Precache(); }
|
||||
|
||||
#define INIT_ITEM(cname) { ##cname w_##cname = spawn(##cname); w_##cname.Precache(); }
|
||||
#define INIT_ITEM(cname) { ##cname w_##cname = spawn(##cname); }
|
Loading…
Reference in a new issue