Commit graph

51 commits

Author SHA1 Message Date
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp c3003fbb22 Fix vulcan ammo display
Do not abuse `f2i` to shift an unsigned quantity.  `f2i` is defined to
work on `fix`, which is `int`.
2016-02-20 17:28:11 +00:00
Kp dd877f52c2 Remove unused weapon defines 2016-01-09 16:38:15 +00:00
Kp b683b4cc68 Scope weapon type 2015-12-03 03:26:49 +00:00
Kp bb41075adb Add preprocessor guards around types that vary by game 2015-11-26 02:56:55 +00:00
Kp 533f1cb3bb Qualify references to primary weapons 2015-10-18 21:01:18 +00:00
Kp 7da64d3782 Add new autoselect-while-firing mode: "when firing stops"
Mako88 reports that some users want not to autoselect while firing, but
do not notice when a new weapon is added to the HUD, and end up never
activating a preferred weapon.  Add a new autoselect mode that remembers
what would be selected and switches to it once the player ceases firing.

Changes since Mako88's proposed version:
- Use `enum class` for autoselection mode and a radio button to
  represent the decision of Immediate/Never/Delayed.
- Handle delayed autoselect for vulcan ammo.
- Set Delayed_primary == Primary_weapon to indicate no change is needed,
  rather than Delayed_primary==-1.  This lets some paths use
  Delayed_primary without checking for a magic value.
- Likewise Delayed_secondary / Secondary_weapon.
- Update Delayed_primary/Delayed_secondary when changing active
  primary/secondary weapon, so that a player who changes weapons while
  firing will automatically clear any deferred change.

Requested-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/97>
Based-on-patch-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/pull/147>
2015-10-18 18:11:57 +00:00
Kp dd0f5cb83f Move fwdvalptridx.h -> fwd-valptridx.h for consistency 2015-10-09 02:46:11 +00:00
Kp 70c4cc87ab Use forward-declaration header for weapon.h 2015-07-25 23:10:45 +00:00
Kp 06b453d617 Enable D1 weapon drops 2015-07-02 02:37:55 +00:00
Kp 2f00efdcc6 Fix gcc-4.6 weapon build
gcc-4.6 chokes on `static constexpr type value{};`, but accepts
`static constexpr auto value = type{};`

Fixes: 9d213b5282 ("Wrap player_has_weapon return type")
2015-05-22 03:33:20 +00:00
Kp 0d564814f5 Convert Primary_weapon to primary_weapon_index_t 2015-04-26 20:15:57 +00:00
Kp 8d849b2b39 Wrap laser level in class
Move enum laser_level_t to weapon.h for the new class.
2015-04-26 20:15:56 +00:00
Kp cca163fc30 Split select_weapon 2015-04-26 20:15:52 +00:00
Kp f789e29b41 Simplify check_to_use_primary 2015-04-26 20:15:52 +00:00
Kp 610f603ebf Pass weapon_name to select_weapon 2015-04-26 20:15:52 +00:00
Kp 10b9206a9b Split do_weapon_select 2015-04-26 20:15:51 +00:00
Kp 4d046c5336 Split auto_select_weapon 2015-04-26 20:15:51 +00:00
Kp b88c232f9f Use powerup_type_t for *_weapon_to_powerup 2015-04-19 04:18:53 +00:00
Kp d7066c3eb9 Remove constant arguments to pick_up_ammo 2015-04-19 04:18:53 +00:00
Kp 9d213b5282 Wrap player_has_weapon return type 2015-04-19 04:18:50 +00:00
Kp a9c81c5614 Move Weapon_is_energy to collide.cpp 2015-04-02 02:36:57 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 5212daa4ad Fix seismic duration sync 2015-02-14 22:48:29 +00:00
Kp d4117871a1 Use range_for for intro movies 2015-01-29 04:27:36 +00:00
Kp bca8889695 Simplify Primary_ammo_max 2015-01-17 18:31:42 +00:00
Kp 53aa70cecb Use vsegptridx_t 2014-10-28 03:08:51 +00:00
Kp 78ad2adabf Write weapon_info carefully 2014-09-27 22:46:25 +00:00
Kp 382afad2b8 Refactor weapon_info_read_n
Fix potential for initializing .children to wrong value with old data
files.  Currently, this cannot be hit because no caller uses the right
combination of arguments to cause it.

Rely on partial_range to report invalid custom files.
2014-09-27 21:21:58 +00:00
Kp 93bb883563 Use array<> for weapon_info fields 2014-09-27 17:15:17 +00:00
Kp 703f60ac3f Fix -Wtype-limits warnings 2014-09-21 21:41:55 +00:00
Kp b95759aecc Propagate use of objptridx 2014-08-23 23:53:56 +00:00
Kp 125d9257be Use special type names for segment/object numbers 2014-08-13 02:57:12 +00:00
zico ad7cb106bc Changed custom D1X license to GPLv3 2014-06-01 19:55:23 +02:00
Kp 094dfbf3d4 Reduce header inclusions 2013-12-31 03:22:03 +00:00
Kp 073f00974a Eliminate uses of the typedef struct X { ... } X; pattern
C++ does not require this pattern.

import re, fileinput
to = re.compile(r'^typedef struct ([a-z_A-Z]+)\s*{')
tc = re.compile(r'^}(.*?)\s*([a-z_A-Z]+);$')
osn = None
for line in fileinput.input(inplace=True):
	m = to.match(line)
	if m:
		osn = m.group(1)
		print 'struct %s\n{' % osn
		continue
	if osn:
		m = tc.match(line)
		if m:
			csn = m.group(2)
			if osn == csn:
				print '}%s;' % m.group(1)
				osn = None
				continue
			else:
				osn = None
	print line,
2013-12-28 22:48:07 +00:00
Kp 9de54cfa74 Switch to C++ linkage
import fileinput
guard = 0
cxxguard = '#ifdef __cplusplus\n'
for line in fileinput.input(inplace=True):
	if line == cxxguard:
		guard = 1
		continue
	if guard:
		if line == 'extern "C" {\n':
			guard = 2
			continue
		if line == '}\n':
			guard = 0
			continue
		if guard == 2:
			assert(line == '#endif\n')
			guard = 0
			print cxxguard,
			continue
	print line,
2013-12-06 03:35:32 +00:00
Kp 18aea17f9e Move */main/fireball.c -> similar/main/fireball.c 2013-12-02 00:21:31 +00:00
Kp 6e6b480082 Use enum for weapon types 2013-11-02 04:26:51 +00:00
Kp 6fc8d110f3 Only give secondaries that exist 2013-11-02 04:25:33 +00:00
Kp 58958e091b Only give primaries that exist 2013-11-02 04:24:14 +00:00
Kp d656bd4115 Move similar/main/game.c -> similar/main/game.cpp 2013-10-05 21:35:58 +00:00
Kp b4107e6526 Remove duplicate declarations 2013-10-03 03:11:52 +00:00
Kp c58c4e4d06 Move declarations to headers 2013-10-03 03:11:52 +00:00
Kp 1b4169b0d0 Move */main/powerup.c -> similar/main/powerup.c 2013-10-02 02:51:25 +00:00
Kp 9e3fb796e1 Use helper for comparing to proximity bomb index 2013-09-21 23:19:38 +00:00
Kp 6e1d9f1f0c Add helper to test for weapons that use vulcan ammo 2013-09-20 23:12:51 +00:00
zico a527348681 Added MULTI_FIRE_BOMB as alteration of MULTI_FIRE to keep bombs mapped in a Multiplayer match for later Host authority and to make their chaff ability work correctly. Additionally added MULTI_FIRE_TRACK to only send Network_laser_track if > -1. On the way I made laser.c a bit more similar between D1X and D2X 2013-08-09 17:21:03 +02:00
Kp 4187648621 Remove redundant/obsolete declarations 2013-07-21 21:55:00 +00:00
Kp e41fa25905 Make weapon.h usable in common source files 2013-07-21 18:15:20 +00:00