Skip to content

Commit

Permalink
cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysparks committed Jun 15, 2018
1 parent 8120e5f commit 3d4ceac
Show file tree
Hide file tree
Showing 6 changed files with 458 additions and 580 deletions.
26 changes: 0 additions & 26 deletions src/seventh/client/weapon/ClientFlameThrower.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.game.weapons.Weapon.WeaponState;
import seventh.shared.TimeStep;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientFlameThrower extends ClientWeapon {

private final long weaponTime = 1300;
private long timer;

/**
* @param ownerId
Expand All @@ -34,27 +29,6 @@ public ClientFlameThrower(ClientPlayerEntity owner) {
this.endFireKick = 0.0f;
this.beginFireKick = 0f;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#update(leola.live.TimeStep)
*/
@Override
public void update(TimeStep timeStep) {
super.update(timeStep);

if(getState() == WeaponState.READY) {
timer = -1;
}

timer -= timeStep.getDeltaTime();

if(getState() == WeaponState.FIRING) {
if(timer<=0) {
timer = weaponTime;
//Sounds.startPlaySound(fireSound, channelId);
}
}
}

@Override
public boolean emitBulletCasing() {
Expand Down
92 changes: 44 additions & 48 deletions src/seventh/client/weapon/ClientMP44.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
/*
* The Seventh
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientMP44 extends ClientWeapon {

/**
* @param owner
*/
public ClientMP44(ClientPlayerEntity owner) {
super(owner);

this.weaponIcon = Art.mp44Icon;
this.weaponImage = Art.mp44Image;
this.muzzleFlash = Art.newMP44MuzzleFlash();
this.weaponWeight = WeaponConstants.MP44_WEIGHT;

this.weaponKickTime = 100;
this.endFireKick = 0f;
this.beginFireKick = 6.2f;
}

// @Override
// protected boolean onFire() {
// return false;
// }
/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isAutomatic()
*/
@Override
public boolean isAutomatic() {
return true;
}

public boolean isBurstFire() {
return false;
}
}
/*
* The Seventh
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientMP44 extends ClientWeapon {

/**
* @param owner
*/
public ClientMP44(ClientPlayerEntity owner) {
super(owner);

this.weaponIcon = Art.mp44Icon;
this.weaponImage = Art.mp44Image;
this.muzzleFlash = Art.newMP44MuzzleFlash();
this.weaponWeight = WeaponConstants.MP44_WEIGHT;

this.weaponKickTime = 100;
this.endFireKick = 0f;
this.beginFireKick = 6.2f;
}

/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isAutomatic()
*/
@Override
public boolean isAutomatic() {
return true;
}

public boolean isBurstFire() {
return false;
}
}
122 changes: 48 additions & 74 deletions src/seventh/client/weapon/ClientRisker.java
Original file line number Diff line number Diff line change
@@ -1,74 +1,48 @@
/*
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.game.weapons.Weapon.WeaponState;
import seventh.shared.TimeStep;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientRisker extends ClientWeapon {

private final long weaponTime = 1300;
private long timer;

/**
* @param ownerId
*/
public ClientRisker(ClientPlayerEntity owner) {
super(owner);

this.weaponIcon = Art.riskerIcon;
// this.weaponImage = Art.sniperRifleImage;
this.weaponImage = Art.riskerImage;
this.muzzleFlash = Art.newRiskerMuzzleFlash();
this.weaponWeight = WeaponConstants.RISKER_WEIGHT;

this.weaponKickTime = 280;
this.endFireKick = 10.7f;
this.beginFireKick = 0f;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#update(leola.live.TimeStep)
*/
@Override
public void update(TimeStep timeStep) {
super.update(timeStep);

if(getState() == WeaponState.READY) {
timer = -1;
}

timer -= timeStep.getDeltaTime();

if(getState() == WeaponState.FIRING) {
if(timer<=0) {
timer = weaponTime;
//Sounds.startPlaySound(fireSound, channelId);
}
}
}

/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isBurstFire()
*/
@Override
public boolean isBurstFire() {
return true;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#onFire()
*/
@Override
protected boolean onFire() {
return true;
}
}
/*
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientRisker extends ClientWeapon {

/**
* @param ownerId
*/
public ClientRisker(ClientPlayerEntity owner) {
super(owner);

this.weaponIcon = Art.riskerIcon;
// this.weaponImage = Art.sniperRifleImage;
this.weaponImage = Art.riskerImage;
this.muzzleFlash = Art.newRiskerMuzzleFlash();
this.weaponWeight = WeaponConstants.RISKER_WEIGHT;

this.weaponKickTime = 280;
this.endFireKick = 10.7f;
this.beginFireKick = 0f;
}

/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isBurstFire()
*/
@Override
public boolean isBurstFire() {
return true;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#onFire()
*/
@Override
protected boolean onFire() {
return true;
}
}
118 changes: 46 additions & 72 deletions src/seventh/client/weapon/ClientShotgun.java
Original file line number Diff line number Diff line change
@@ -1,72 +1,46 @@
/*
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.game.weapons.Weapon.WeaponState;
import seventh.shared.TimeStep;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientShotgun extends ClientWeapon {

private final long weaponTime = 1300;
private long timer;

/**
* @param ownerId
*/
public ClientShotgun(ClientPlayerEntity owner) {
super(owner);
this.weaponIcon = Art.shotgunIcon;
this.weaponImage = Art.shotgunImage;
this.muzzleFlash = Art.newShotgunMuzzleFlash();
this.weaponWeight = WeaponConstants.SHOTGUN_WEIGHT;

this.weaponKickTime = 66;
this.endFireKick = 18.7f;
this.beginFireKick = 0f;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#update(leola.live.TimeStep)
*/
@Override
public void update(TimeStep timeStep) {
super.update(timeStep);

if(getState() == WeaponState.READY) {
timer = -1;
}

timer -= timeStep.getDeltaTime();

if(getState() == WeaponState.FIRING) {
if(timer<=0) {
timer = weaponTime;
// Sounds.startPlaySound(fireSound, channelId, this.);
}
}
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#onFire()
*/
@Override
protected boolean onFire() {
return true;
}

/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isPumpAction()
*/
@Override
public boolean isPumpAction() {
return true;
}
}
/*
* see license.txt
*/
package seventh.client.weapon;

import seventh.client.entities.ClientPlayerEntity;
import seventh.client.gfx.Art;
import seventh.shared.WeaponConstants;

/**
* @author Tony
*
*/
public class ClientShotgun extends ClientWeapon {

/**
* @param ownerId
*/
public ClientShotgun(ClientPlayerEntity owner) {
super(owner);
this.weaponIcon = Art.shotgunIcon;
this.weaponImage = Art.shotgunImage;
this.muzzleFlash = Art.newShotgunMuzzleFlash();
this.weaponWeight = WeaponConstants.SHOTGUN_WEIGHT;

this.weaponKickTime = 66;
this.endFireKick = 18.7f;
this.beginFireKick = 0f;
}

/* (non-Javadoc)
* @see palisma.client.weapon.ClientWeapon#onFire()
*/
@Override
protected boolean onFire() {
return true;
}

/* (non-Javadoc)
* @see seventh.client.weapon.ClientWeapon#isPumpAction()
*/
@Override
public boolean isPumpAction() {
return true;
}
}
Loading

0 comments on commit 3d4ceac

Please sign in to comment.