Author Topic: reload: glitch or feature?  (Read 5706 times)

SLAVE|Mietz

  • Posts: 672
  • Turrets: +2/-0
    • http://blasted.tremulous.info
reload: glitch or feature?
« on: April 08, 2006, 12:12:54 pm »
I noticed that if you hit reload while your weapon has full ammo, the full cardridge will be discarded completely.

I don't know, is this a bug or a feature? (to bring in more reality)

Maybe it would be possible to deactivate the reloading function when the ammo-cardridge is full.

Snarboo

  • Posts: 10
  • Turrets: +0/-0
reload: glitch or feature?
« Reply #1 on: April 08, 2006, 05:54:52 pm »
I've wondered about this myself. Considering how Trem handles magazines (eg any left over rounds in a magazine are simply discarded), I think it might be intentional.

Howitzer

  • Posts: 269
  • Turrets: +0/-1
reload: glitch or feature?
« Reply #2 on: April 09, 2006, 01:20:18 am »
It's intentional i think.
I've seen in in Battlefield 1942 aswell and i think it's fairly logical since we're dealing with cartridges here, not individual bullets.

And disabling reloading when you have half a clip left isn't a good idea.
I like to have a full cartridge to shoot when going into combat.

R1CH

  • Posts: 79
  • Turrets: +3/-1
    • http://www.r1ch.net/
reload: glitch or feature?
« Reply #3 on: April 09, 2006, 06:23:37 am »
This is "fixed" on AKKA as I didn't really see the point, an accidental keypress shouldn't throw away an entire clip of ammo. Whether it is a bug or feature though I cannot say.

Timbo

  • Administrator
  • Posts: 447
  • Turrets: +155/-161
reload: glitch or feature?
« Reply #4 on: April 09, 2006, 11:57:28 am »
Feature.

Catalyc

  • Posts: 214
  • Turrets: +2/-0
reload: glitch or feature?
« Reply #5 on: April 09, 2006, 01:07:43 pm »
Newbie trap!  :roll:
ttp://tremmapping.pbwiki.com/

SLAVE|Mietz

  • Posts: 672
  • Turrets: +2/-0
    • http://blasted.tremulous.info
reload: glitch or feature?
« Reply #6 on: April 09, 2006, 02:56:44 pm »
Quote from: "Howitzer"
It's intentional i think.
I've seen in in Battlefield 1942 aswell and i think it's fairly logical since we're dealing with cartridges here, not individual bullets.

And disabling reloading when you have half a clip left isn't a good idea.
I like to have a full cartridge to shoot when going into combat.


Now I didn't say that the half cartridge should be blocked, only the full cartridge.

Howitzer

  • Posts: 269
  • Turrets: +0/-1
reload: glitch or feature?
« Reply #7 on: April 09, 2006, 03:19:59 pm »
Sorry, i read half-full :P

next_ghost

  • Posts: 892
  • Turrets: +3/-6
reload: glitch or feature?
« Reply #8 on: May 08, 2006, 03:18:44 pm »
Well, here's a patch for game/bg_pmove.c that blocks full-ammo reloads. Works against both 1.1.0 and CVS.

Code: [Select]
--- /usr/src/tremulous-1.1.0-src/src/game/bg_pmove.c 2006-01-12 18:05:09.000000000 +0100
+++ bg_pmove.c 2006-05-08 14:50:08.000000000 +0200
@@ -2674,7 +2674,7 @@
 static void PM_Weapon( void )
 {
   int           addTime = 200; //default addTime - should never be used
-  int           ammo, clips, maxClips;
+  int           ammo, maxammo, clips, maxClips;
   qboolean      attack1 = qfalse;
   qboolean      attack2 = qfalse;
   qboolean      attack3 = qfalse;
@@ -2810,14 +2810,22 @@
   {
     pm->ps->pm_flags &= ~PMF_WEAPON_RELOAD;
 
-    pm->ps->weaponstate = WEAPON_RELOADING;
+    BG_FindAmmoForWeapon( pm->ps->weapon, &maxammo, NULL );
+    if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) &&
+        BG_InventoryContainsUpgrade( UP_BATTPACK, pm->ps->stats ) )
+      maxammo = (int)( (float)maxammo * BATTPACK_MODIFIER );
 
-    //drop the weapon
-    PM_StartTorsoAnim( TORSO_DROP );
+    // don't reload full clips
+    if(ammo < maxammo) {
+      pm->ps->weaponstate = WEAPON_RELOADING;
 
-    addTime = BG_FindReloadTimeForWeapon( pm->ps->weapon );
+      //drop the weapon
+      PM_StartTorsoAnim( TORSO_DROP );
 
-    pm->ps->weaponTime += addTime;
+      addTime = BG_FindReloadTimeForWeapon( pm->ps->weapon );
+
+      pm->ps->weaponTime += addTime;
+    }
     return;
   }
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.

Paradox

  • Posts: 2612
  • Turrets: +253/-250
    • Paradox Designs
reload: glitch or feature?
« Reply #9 on: May 08, 2006, 07:40:14 pm »
Every FPS i have ever played uses this feature. :-?

∧OMG ENTROPY∧

next_ghost

  • Posts: 892
  • Turrets: +3/-6
reload: glitch or feature?
« Reply #10 on: June 07, 2006, 11:08:50 am »
A little question for the devs. Do you think that this is a good idea:
Code: [Select]
bg_pmove.c lines 2780-2786:
static void PM_Weapon( void ) {
...
  // check for out of ammo
  if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) )
  {
    PM_AddEvent( EV_NOAMMO );
    pm->ps->weaponTime += 200;
    return;
  }

... lines 2712-2738

  // check for weapon change
  // can't change if weapon is firing, but can change
  // again if lowering or raising
  if( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING )
  {
    //TA: must press use to switch weapons
    if( pm->cmd.buttons & BUTTON_USE_HOLDABLE )
    {
      if( !( pm->ps->pm_flags & PMF_USE_ITEM_HELD ) )
      {
        if( pm->cmd.weapon <= 32 )
        {
          //if trying to select a weapon, select it
          if( pm->ps->weapon != pm->cmd.weapon )
            PM_BeginWeaponChange( pm->cmd.weapon );
        }
        else if( pm->cmd.weapon > 32 )
        {
          //if trying to toggle an upgrade, toggle it
          if( BG_InventoryContainsUpgrade( pm->cmd.weapon - 32, pm->ps->stats ) ) //sanity check
          {
            if( BG_UpgradeIsActive( pm->cmd.weapon - 32, pm->ps->stats ) )
              BG_DeactivateUpgrade( pm->cmd.weapon - 32, pm->ps->stats );
            else
              BG_ActivateUpgrade( pm->cmd.weapon - 32, pm->ps->stats );
          }
        }
        pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
      }
    }
...
}


This little piece of code (lines 2780 thru 2786) does nothing for weapons except grenade (the only weapon with EV_NOAMMO handler). It simply repeatedly blocks weapon actions for 200ms. That also means it blocks item toggle button because items can be toggled in PM_Weapon() only if pm->ps->weaponTime <= 0 and WEAPON_FIRING flag is not set (lines 2712 thru 2738). It also seems the WEAPON_FIRING flag is never cleared because PM_Weapon() exits before it checks for attacks.

Edit: https://bugzilla.icculus.org/show_bug.cgi?id=2737
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.