-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Fully Possessed scripts folder to be compatible with popular …
…hi def mod. If the hidef mod is installed in the normal base directory, no changes will need to be made to the scripts folder for Fully Possessed to work.
- Loading branch information
Showing
5 changed files
with
524 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
228 changes: 228 additions & 0 deletions
228
vr_assets/Fully Possessed/script/weapon_chaingun.script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
/*********************************************************************** | ||
|
||
weapon_chaingun.script | ||
|
||
***********************************************************************/ | ||
|
||
#define CHAINGUN_FIRE_SKIPFRAMES 7 // 6 shots per second | ||
#define CHAINGUN_LOWAMMO 10 | ||
#define CHAINGUN_NUMPROJECTILES 1 | ||
#define CHAINGUN_BARREL_SPEED ( 60 * ( GAME_FPS / CHAINGUN_FIRE_SKIPFRAMES ) ) | ||
#define CHAINGUN_BARREL_ACCEL_TIME 0.4 | ||
#define CHAINGUN_BARREL_DECCEL_TIME 1.0 | ||
#define CHAINGUN_BARREL_ACCEL ( CHAINGUN_BARREL_SPEED / CHAINGUN_BARREL_ACCEL_TIME ) | ||
#define CHAINGUN_BARREL_DECCEL ( CHAINGUN_BARREL_SPEED / CHAINGUN_BARREL_DECCEL_TIME ) | ||
|
||
// blend times | ||
#define CHAINGUN_IDLE_TO_LOWER 4 | ||
#define CHAINGUN_IDLE_TO_FIRE 0 | ||
#define CHAINGUN_IDLE_TO_RELOAD 4 | ||
#define CHAINGUN_RAISE_TO_IDLE 0 | ||
#define CHAINGUN_WINDDOWN_TO_IDLE 0 | ||
#define CHAINGUN_RELOAD_TO_IDLE 0 | ||
|
||
object weapon_chaingun : weapon_base { | ||
entity world_model; | ||
float world_barrel_joint; | ||
float barrel_joint; | ||
float barrel_angle; | ||
float current_rate; | ||
float start_rate; | ||
float end_rate; | ||
float spin_start; | ||
float spin_end; | ||
float spread; | ||
|
||
void init(); | ||
|
||
void UpdateBarrel(); | ||
void SpinUp(); | ||
void SpinDown(); | ||
|
||
void Lower(); | ||
void Raise(); | ||
void Idle(); | ||
void Fire(); | ||
void Reload(); | ||
void ExitCinematic(); | ||
}; | ||
|
||
void weapon_chaingun::init() { | ||
world_model = getWorldModel(); | ||
world_barrel_joint = world_model.getJointHandle( "toob" ); | ||
barrel_joint = getJointHandle( "spinner" ); | ||
barrel_angle = 0; | ||
current_rate = 0; | ||
start_rate = 0; | ||
end_rate = 0; | ||
spin_start = 0; | ||
spin_end = 0; | ||
spread = getFloatKey( "spread" ); | ||
|
||
weaponState( "Raise", 0 ); | ||
} | ||
|
||
void weapon_chaingun::destroy() { | ||
stopSound( SND_CHANNEL_BODY3, false ); | ||
} | ||
|
||
void weapon_chaingun::UpdateBarrel() { | ||
float currentTime; | ||
float t; | ||
vector ang; | ||
|
||
currentTime = sys.getTime(); | ||
if ( currentTime < spin_end ) { | ||
t = ( currentTime - spin_start ) / ( spin_end - spin_start ); | ||
current_rate = start_rate + t * ( end_rate - start_rate ); | ||
} else { | ||
current_rate = end_rate; | ||
} | ||
|
||
if ( current_rate ) { | ||
barrel_angle = barrel_angle + current_rate * GAME_FRAMETIME; | ||
|
||
ang_x = 0; | ||
ang_y = 0; | ||
ang_z = barrel_angle; | ||
setJointAngle( barrel_joint, JOINTMOD_LOCAL, ang ); | ||
|
||
ang_y = barrel_angle; | ||
ang_z = 0; | ||
world_model.setJointAngle( world_barrel_joint, JOINTMOD_LOCAL, ang ); | ||
} | ||
} | ||
|
||
void weapon_chaingun::SpinUp() { | ||
start_rate = current_rate; | ||
end_rate = CHAINGUN_BARREL_SPEED; | ||
spin_start = sys.getTime(); | ||
spin_end = spin_start + ( end_rate - current_rate ) / CHAINGUN_BARREL_ACCEL; | ||
startSound( "snd_windup", SND_CHANNEL_BODY3, false ); | ||
} | ||
|
||
void weapon_chaingun::SpinDown() { | ||
start_rate = current_rate; | ||
end_rate = 0; | ||
spin_start = sys.getTime(); | ||
spin_end = spin_start + ( current_rate - end_rate ) / CHAINGUN_BARREL_DECCEL; | ||
startSound( "snd_winddown", SND_CHANNEL_BODY3, false ); | ||
} | ||
|
||
void weapon_chaingun::Raise() { | ||
weaponRising(); | ||
playAnim( ANIMCHANNEL_ALL, "raise" ); | ||
waitUntil( animDone( ANIMCHANNEL_ALL, CHAINGUN_RAISE_TO_IDLE ) ); | ||
playCycle( ANIMCHANNEL_ALL, "idle" ); | ||
weaponState( "Idle", CHAINGUN_RAISE_TO_IDLE ); | ||
} | ||
|
||
void weapon_chaingun::Lower() { | ||
weaponLowering(); | ||
playAnim( ANIMCHANNEL_ALL, "putaway" ); | ||
|
||
while( !animDone( ANIMCHANNEL_ALL, 0 ) ) { | ||
UpdateBarrel(); | ||
waitFrame(); | ||
} | ||
|
||
weaponHolstered(); | ||
waitUntil( WEAPON_RAISEWEAPON ); | ||
weaponState( "Raise", 0 ); | ||
} | ||
|
||
void weapon_chaingun::Idle() { | ||
float ammoClip; | ||
float avail; | ||
float clip_size; | ||
|
||
clip_size = clipSize(); | ||
|
||
if ( !ammoInClip() ) { | ||
weaponOutOfAmmo(); | ||
} else { | ||
weaponReady(); | ||
} | ||
|
||
while( 1 ) { | ||
if ( WEAPON_LOWERWEAPON ) { | ||
weaponState( "Lower", CHAINGUN_IDLE_TO_LOWER ); | ||
} | ||
ammoClip = ammoInClip(); | ||
if ( WEAPON_ATTACK ) { | ||
if ( ammoClip > 0 ) { | ||
weaponState( "Fire", CHAINGUN_IDLE_TO_FIRE ); | ||
} else if ( ammoAvailable() > 0 ) { | ||
if ( autoReload() ) { | ||
netReload(); | ||
weaponState( "Reload", CHAINGUN_IDLE_TO_RELOAD ); | ||
} | ||
} | ||
} | ||
if ( WEAPON_RELOAD && ( ammoAvailable() > ammoClip ) && ( ammoClip < clip_size ) ) { | ||
netReload(); | ||
weaponState( "Reload", CHAINGUN_IDLE_TO_RELOAD ); | ||
} | ||
if ( WEAPON_NETRELOAD ) { | ||
WEAPON_NETRELOAD = false; | ||
weaponState( "Reload", CHAINGUN_IDLE_TO_RELOAD ); | ||
} | ||
UpdateBarrel(); | ||
waitFrame(); | ||
} | ||
} | ||
|
||
void weapon_chaingun::Fire() { | ||
float ammoClip; | ||
float currentTime; | ||
float skip; | ||
SpinUp(); | ||
ammoClip = ammoInClip(); | ||
while( ( current_rate < end_rate ) && WEAPON_ATTACK && !WEAPON_RELOAD && ( ammoClip > 0 ) ) { | ||
UpdateBarrel(); | ||
waitFrame(); | ||
ammoClip = ammoInClip(); | ||
} | ||
|
||
startSound( "snd_spin", SND_CHANNEL_BODY3, false ); | ||
ammoClip = ammoInClip(); | ||
while( WEAPON_ATTACK && !WEAPON_RELOAD && ( ammoClip > 0 ) ) { | ||
launchProjectiles( CHAINGUN_NUMPROJECTILES, spread, 0, 1.0, 1.0 ); | ||
startSound( "snd_fire", SND_CHANNEL_WEAPON, false ); | ||
ammoClip = ammoInClip(); | ||
if ( ammoClip == CHAINGUN_LOWAMMO ) { | ||
startSound( "snd_lowammo", SND_CHANNEL_ITEM, false ); | ||
} | ||
|
||
// skip frames | ||
for( skip = 0; skip < CHAINGUN_FIRE_SKIPFRAMES; skip++ ) { | ||
UpdateBarrel(); | ||
waitFrame(); | ||
} | ||
} | ||
|
||
SpinDown(); | ||
weaponState( "Idle", CHAINGUN_WINDDOWN_TO_IDLE ); | ||
} | ||
|
||
void weapon_chaingun::Reload() { | ||
weaponReloading(); | ||
playAnim( ANIMCHANNEL_ALL, "reload" ); | ||
while( !animDone( ANIMCHANNEL_ALL, CHAINGUN_RELOAD_TO_IDLE ) ) { | ||
UpdateBarrel(); | ||
waitFrame(); | ||
} | ||
addToClip( clipSize() ); | ||
playCycle( ANIMCHANNEL_ALL, "idle" ); | ||
weaponState( "Idle", CHAINGUN_RELOAD_TO_IDLE ); | ||
} | ||
|
||
void weapon_chaingun::ExitCinematic() { | ||
current_rate = 0; | ||
start_rate = 0; | ||
end_rate = 0; | ||
spin_start = 0; | ||
spin_end = 0; | ||
|
||
weaponState( "Idle", 0 ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/*********************************************************************** | ||
|
||
weapon_fists.script | ||
|
||
***********************************************************************/ | ||
|
||
// blend times | ||
#define FISTS_IDLE_TO_LOWER 4 | ||
#define FISTS_IDLE_TO_PUNCH 0 | ||
#define FISTS_RAISE_TO_IDLE 4 | ||
#define FISTS_PUNCH_TO_IDLE 1 | ||
|
||
object weapon_fists : weapon_base { | ||
float side; | ||
|
||
void init(); | ||
|
||
void Lower(); | ||
void Raise(); | ||
void Idle(); | ||
void Punch(); | ||
void ExitCinematic(); | ||
string GetFireAnim(); | ||
}; | ||
|
||
void weapon_fists::init() { | ||
weaponState( "Raise", 0 ); | ||
} | ||
|
||
void weapon_fists::Raise() { | ||
weaponRising(); | ||
playAnim( ANIMCHANNEL_ALL, "raise" ); | ||
waitUntil( animDone( ANIMCHANNEL_ALL, FISTS_RAISE_TO_IDLE ) ); | ||
weaponState( "Idle", FISTS_RAISE_TO_IDLE ); | ||
} | ||
|
||
void weapon_fists::Lower() { | ||
weaponLowering(); | ||
playAnim( ANIMCHANNEL_ALL, "putaway" ); | ||
waitUntil( animDone( ANIMCHANNEL_ALL, 0 ) ); | ||
weaponHolstered(); | ||
waitUntil( WEAPON_RAISEWEAPON ); | ||
weaponState( "Raise", 0 ); | ||
} | ||
|
||
void weapon_fists::Idle() { | ||
weaponReady(); | ||
playCycle( ANIMCHANNEL_ALL, "idle" ); | ||
while( 1 ) { | ||
if ( WEAPON_LOWERWEAPON ) { | ||
weaponState( "Lower", FISTS_IDLE_TO_LOWER ); | ||
} | ||
if ( WEAPON_ATTACK ) { | ||
weaponState( "Punch", FISTS_IDLE_TO_PUNCH ); | ||
} | ||
waitFrame(); | ||
} | ||
} | ||
|
||
void weapon_fists::Punch() { | ||
playAnim( ANIMCHANNEL_ALL, GetFireAnim() ); | ||
sys.wait( 0.1 ); | ||
melee(); | ||
waitUntil( animDone( ANIMCHANNEL_ALL, FISTS_PUNCH_TO_IDLE ) ); | ||
side = !side; | ||
weaponState( "Idle", FISTS_PUNCH_TO_IDLE ); | ||
} | ||
|
||
void weapon_fists::ExitCinematic() { | ||
weaponState( "Idle", 0 ); | ||
} | ||
|
||
string weapon_fists::GetFireAnim() { | ||
if ( side ) { | ||
return "punch_left"; | ||
} else { | ||
return "punch_right"; | ||
} | ||
} |
Oops, something went wrong.