Commit graph

694 commits

Author SHA1 Message Date
Kp 07a23cbaf2 Detect always-invalid valptridx indexes 2014-01-10 03:58:03 +00:00
Kp 0d49f5b55a Use objptridx_t for object_create_badass_explosion 2014-01-10 03:23:57 +00:00
Kp 58ed12ffce Use objptridx_t for create_morph_robot 2014-01-10 03:20:11 +00:00
Kp ab3806af83 Use objptridx_t for object_create_explosion 2014-01-10 03:20:11 +00:00
Kp f1a6757693 Use objptridx_t for obj_create 2014-01-10 03:20:11 +00:00
Kp 9843406588 Remove unused return value of explode_badass_weapon 2014-01-10 03:17:55 +00:00
Kp d6fab53199 Remove unused return value of object_create_muzzle_flash 2014-01-10 03:14:14 +00:00
Kp 61ad220d42 Remove unused who_killed_controlcen 2014-01-08 03:54:44 +00:00
Kp a748065fe5 Explicitly delete valptridx subtype default constructors 2014-01-06 04:17:57 +00:00
Kp 9a5d0f6f09 Use symbolic values for segment/object first/none 2014-01-06 04:17:55 +00:00
Kp 67741cf603 Remove unused multi_explode_robot_sub parameter killer 2014-01-04 22:04:34 +00:00
Kp 3ca0a6aca6 Remove unused return value of explode_badass_player 2014-01-04 18:03:10 +00:00
Kp 8218af34b5 Add special type to let obj_*link take either pointer or index 2014-01-03 04:04:04 +00:00
Kp 888f44336f Use segment array for render visited[] 2014-01-01 03:42:00 +00:00
Kp 40e90fea22 Move Light_subtracted[] to Segments[].light_subtracted 2014-01-01 03:33:27 +00:00
Kp 094dfbf3d4 Reduce header inclusions 2013-12-31 03:22:03 +00:00
Kp d7d052857a Use bitmask for hitobj_list
Reduces sizeof(laser_info) from 392 to 80.
2013-12-31 03:22:03 +00:00
Kp 549d7ea261 Use correct size for flickering_light mask 2013-12-31 00:11:05 +00:00
Kp cf7a3edee3 Move object::rtype up to improve packing 2013-12-29 04:54:22 +00:00
Kp 745633eabe Use vector to allow rendering unlimited robots 2013-12-29 04:54:08 +00:00
Kp 7cf6877e2a Rename D1 ai_local::wait_time to ::next_action_time to match D2 2013-12-29 04:33:30 +00:00
Kp cf5343db18 Move ai_local into ai_static
Eliminates a global and some pointer math.
2013-12-29 03:59:21 +00:00
Kp 64e2ab55a0 Combine control_center_triggers_read and _swap variant 2013-12-29 03:56:41 +00:00
Kp dd583e9c2b Add packed *_rw versions of object subfields 2013-12-29 00:32:58 +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 67ad7811bd Remove unused physics_info::brakes 2013-12-28 22:47:46 +00:00
Kp dfbe78c214 Remove useless 'unused' field in grs_bitmap
Saves a realignment to pointer boundary.
2013-12-28 22:38:02 +00:00
Kp 2d274dba8b Tighten SWAPINT 2013-12-28 22:37:00 +00:00
Kp cc9f7f669d Tighten definition of SWAPSHORT 2013-12-28 22:36:59 +00:00
Kp 38b2dbe639 Move object* -> objnum conversion into init_ai_object 2013-12-28 22:10:24 +00:00
Kp 79fe1d899c Simplify control_center_triggers_read_n 2013-12-28 22:04:47 +00:00
Kp 1694eed536 Match PHYSFSX_readSXE?? return types to the internal type 2013-12-28 22:03:50 +00:00
Kp aa16a01fec Mark control_center_triggers_write input as const 2013-12-25 23:51:28 +00:00
Kp 8c63ad4d09 Use dedicated type for Objects[] array 2013-12-25 23:49:04 +00:00
Kp 7fb4c6307f Add debug option -no-grab to prevent window grabbing 2013-12-22 20:56:55 +00:00
Kp 456c2d0bb0 Scrub control codes from stdout/file, but not HUD/console 2013-12-22 20:56:55 +00:00
Kp a7bd19a7ca Convert fvi to use countarray for segment list
Also fixes a bug where seglist could receive wrong elements when
fvi_sub recursive call returns a type other than HIT_NONE.  Bug caused
by badly named variables:

	int ii;
	for (ii=0;i < temp_n_segs && *n_segs < MAX_FVI_SEGS-1;)
		seglist[(*n_segs)++] = temp_seglist[ii++];

The wrong counter is used for first part of the conditional, so
uninitialized elements of temp_seglist could be read back if i
(==n_segs_visited) is smaller than temp_n_segs or elements could be
skipped if i is greater than temp_n_segs.
2013-12-22 20:56:53 +00:00
Kp 038bbad26a Rearrange headers to build under all test modes 2013-12-22 20:56:35 +00:00
Kp 58e740c0bd Remove unused declaration of Center_names 2013-12-22 20:56:35 +00:00
Kp c28d0c984c Combine nearby d1/d2 guard in powerup.h 2013-12-22 20:56:35 +00:00
Kp fe7c9fa444 Use countarray for HUD_messages 2013-12-22 20:56:33 +00:00
Kp 7894647bc9 Let PHYSFSX_puts receive optional string length 2013-12-22 20:13:22 +00:00
Kp 314950d0b2 Pass computed message length from Error to con_puts 2013-12-22 20:12:56 +00:00
Kp 84a0dcba27 Rename con_puts length template 2013-12-22 20:12:41 +00:00
Kp 44f1814b45 Store boss gate/teleport segments in countarray objects 2013-12-22 20:02:42 +00:00
Kp 6de986d39c Print file offset on read error 2013-12-22 20:02:26 +00:00
Kp 403d412000 Remove BEFORE/AFTER arguments to for_each_multiplayer_command 2013-12-22 20:02:22 +00:00
Kp f269ed7374 Make Been_visited a local bit array 2013-12-22 05:29:25 +00:00
Kp 99626b2f34 Clear visited segment array in constructor 2013-12-22 05:27:46 +00:00
Kp 9a7185f770 Store warning segments in countarray object 2013-12-22 05:27:16 +00:00
Kp a8e9f9f624 Store found segments in countarray object
Raise MAX_FOUND_SEGS to MAX_SEGMENTS to ease code reuse.
2013-12-22 01:54:15 +00:00
Kp c31c67c587 Store selected segments in countarray object 2013-12-22 01:54:15 +00:00
Kp 4fb6990b6c Make Stolen_items[] a C++ array 2013-12-22 01:53:26 +00:00
Kp 5b5c8a3c6a Remove write-only variable TmapList 2013-12-22 01:16:16 +00:00
Kp 0c30fa7cf3 Whitelist MAX flash missiles as valid laser type 2013-12-22 01:15:40 +00:00
Kp b1c5307eb1 Use array for palette_array_t 2013-12-22 00:37:36 +00:00
Kp e9f9cb676f Centralize palette utilities 2013-12-22 00:05:13 +00:00
Kp a3d66a3b37 Add typedef palette_array_t for palette data 2013-12-22 00:05:13 +00:00
Kp 11f7bc51ee Use unsigned count of frames in a vclip 2013-12-22 00:05:13 +00:00
Kp 1e8036bd24 Split compiler.h for PCH compatibility 2013-12-21 05:12:38 +00:00
Kp 5d801ce386 Add #error diagnostics to compiler.h 2013-12-21 01:54:38 +00:00
Kp c2f6e9f999 Remove obsolete setjmp/longjmp 2013-12-21 01:40:56 +00:00
Kp fbf1f8a658 Annotate mem_malloc/calloc/realloc as __attribute__((alloc_size)) 2013-12-20 03:33:32 +00:00
Kp 737fe73dd7 Annotate mem_malloc/mem_calloc as __attribute__((malloc)) 2013-12-20 03:24:39 +00:00
Kp e4b091dd38 Make ogl_pal a ubyte (*)[256*3] to improve checking 2013-12-20 03:19:40 +00:00
Kp 3bf16e57dc Remove PHYSFSX_gets, PHYSFSX_readString
They do not check for a buffer overflow.
2013-12-20 03:16:46 +00:00
Kp 86a88bedbd Use enum for CockpitMode
This makes the debugger output nicer.
2013-12-20 03:14:16 +00:00
Kp d2a2103cc2 Combine MULTI_PLAYER_EXPLODE and MULTI_PLAYER_DROP
Add a selector byte and use a common primary command code.
2013-12-20 03:11:23 +00:00
Kp 3ca5b4af47 Inline multi_send_quit 2013-12-20 03:11:06 +00:00
Kp c561c3d514 Move multi_send_data_direct type into template parameter
Optimizing compilers may now delete the size check.
2013-12-20 03:08:19 +00:00
Kp ad90c245b6 Improve interaction of Del+F with normal map usage
Refactor edge computation into helper.

Let Automap_visited always be exactly what the player mapped normally.
This allows reversing Del+F.
2013-12-20 03:06:59 +00:00
Kp f0bae2c8cd Add EVENT_WINDOW_CREATED to centralize window init/deinit logic 2013-12-20 02:51:24 +00:00
Kp 985972186f Use separate type for ai_static_rw in Descent, too 2013-12-19 15:11:41 +00:00
zico 35266309d0 Made version mismatch screen spill out some explanatory information about Multi protocol version 2013-12-19 14:03:00 +01:00
zico 5f005baa3b Added MULTI_EFFECT_BLOWUP to remotely blast switches connected to triggers, ensuring sync and preventing misguided (i.e. delayed) player fire accidentially make puzzles or game progress impossible 2013-12-19 13:48:33 +01:00
Kp d2c2dfe95c Make Segments[] a C++ array 2013-12-19 03:31:24 +00:00
Kp 03821fab0d Rely on libc strdup if DEBUG_MEMORY_ALLOCATIONS is unset
If !DEBUG_MEMORY_ALLOCATIONS, our strdup is not special.  Rely on the
compiler one, which might be.
2013-12-19 03:31:24 +00:00
Kp aba6c2dfee Pass glow_values as array<> to retain size information 2013-12-19 03:31:24 +00:00
Kp a40c19f770 Fix con_puts buffer overread
ASan reports a 2K read from a small string literal.

Also, fix silly double copy in con_add_buffer_line and delete too-short
memset in con_add_buffer_line.
2013-12-19 03:31:24 +00:00
Kp 779d1b95db Defer freeing window until after EVENT_WINDOW_CLOSED 2013-12-19 03:11:56 +00:00
Kp 0938e819e5 Advertise map-mode via overload of typing-mode
Tell other clients when map mode is active, for the same reason that
typing mode is advertised.
2013-12-18 04:51:46 +00:00
Kp 8c74708ad4 Improve layout of D2 powerup_info 2013-12-18 04:51:46 +00:00
Kp 9776827a33 Make Objects[] a C++ array 2013-12-18 04:51:46 +00:00
Kp 7caf9bbcd4 Unify WALL_IS_DOORWAY
Both games used the same meaning, but called values by different names.
2013-12-18 04:51:46 +00:00
Kp 2f18c5037d Store group lists as countarray objects 2013-12-18 03:48:52 +00:00
Kp e8de74b8bf Reject inappropriate printf usage 2013-12-17 04:03:35 +00:00
Kp be742f8848 Use powerup_basic_str instead of powerup_basic where possible 2013-12-17 04:03:34 +00:00
Kp 65657c6809 Use nm_messagebox_str instead of nm_messagebox where possible 2013-12-17 04:03:34 +00:00
Kp d15347f16f Use HUD_init_message_literal instead of HUD_init_message where possible 2013-12-17 04:03:34 +00:00
Kp 21de8bc8f6 Use buddy_message_str instead of buddy_message where possible 2013-12-17 04:03:34 +00:00
Kp 21cc89e2c8 Use ui_dputs_at instead of ui_dprintf_at where possible 2013-12-17 04:03:34 +00:00
Kp 7efeb3f29d Use PHYSFSX_puts instead of PHYSFSX_printf where possible 2013-12-17 04:03:34 +00:00
Kp c3c1695ba5 Use gr_ustring instead of gr_uprintf where possible 2013-12-17 04:03:34 +00:00
Kp 1bf3722670 Use gr_string instead of gr_printf where possible 2013-12-17 04:03:34 +00:00
Kp 3d79fe9b40 Use editor_status instead of editor_status_fmt where possible 2013-12-17 04:03:34 +00:00
Kp a99b07c98e Use Error_puts instead of Error where possible 2013-12-17 04:03:34 +00:00
Kp f82ba904bd Use Warning_puts instead of Warning where possible 2013-12-17 04:03:34 +00:00
Kp 335cabcc79 Use con_puts instead of con_printf where possible 2013-12-17 04:03:34 +00:00
Kp 38a5c03d5d Add type checking for newmenu_listbox 2013-12-17 03:58:17 +00:00
Kp be041a9cfc Add type checking for ui_create_dialog 2013-12-17 03:49:24 +00:00
Kp d1fa9ff7a6 Simplify setup for ui_messagebox_n 2013-12-15 21:54:59 +00:00
Kp 92e8cb7a31 Add type checking to newmenu subfunction userdata 2013-12-15 21:54:38 +00:00
Kp 3908215e73 Add type checking to nm_messagebox format string 2013-12-15 21:54:17 +00:00
Kp 5d306d06be Switch endlevel message dialog not to use nm_messagebox1 2013-12-15 19:00:59 +00:00
Kp 3fb0ffa19b Add typedef for newmenu subfunction 2013-12-15 18:57:54 +00:00
Kp cea46651fc Check type of window handler function 2013-12-15 18:51:26 +00:00
Kp f05b6f0008 Use on-stack bit array for tracking AI segment visits 2013-12-15 18:50:39 +00:00
Kp 7088720507 Use C++ array for Automap_visited 2013-12-15 18:46:42 +00:00
Kp 2ce15e5703 Remove unused extern object variables 2013-12-15 01:59:05 +00:00
Kp ddffec01c7 Use enum for multi_send_msgsend_state values 2013-12-15 01:52:13 +00:00
Kp 6779dc4991 Remove unused command MULTI_DROP_ORB 2013-12-15 01:45:19 +00:00
Kp 00a9ca2423 Remove unused MULTI_PLAY_BY_PLAY
The sending function has been disabled since Bazaar import.
2013-12-15 01:45:19 +00:00
zico ec516b5675 Disable powerup capping for cooperative game mode as it potentially deletes weapons carried over from another level 2013-12-14 02:53:45 +01:00
Kp cb4fd7c1b4 Compact known file extension storage 2013-12-13 03:58:01 +00:00
Kp 4dfceab50b Factor out file extension filtering 2013-12-13 03:51:14 +00:00
Kp 2bd302cddd Move Controls ubyte values into substructure 2013-12-13 03:47:57 +00:00
Kp 07877853ba Use static_assert where available 2013-12-13 03:44:02 +00:00
zico e195290fe4 Added quick load ability for savestates 2013-12-10 18:13:32 +01:00
zico dae83f9edc Set PPS limits from 5 to 40 2013-12-09 14:25:32 +01:00
zico 2e407fa5a8 Removed short packets and added segment number to quaternion structure 2013-12-09 14:00:23 +01:00
Kp 322c61ef01 Remove use of heap-based splitword 2013-12-08 21:43:53 +00:00
Kp b7fe431979 Use RAII for playsave strings 2013-12-08 21:02:10 +00:00
Kp 3b9b5ebfb0 Use RAII to manage function-local heap objects 2013-12-08 19:04:52 +00:00
Kp 38e92ddce0 Remove useless __pack__ on PlayerCfg 2013-12-08 00:15:13 +00:00
Kp 141ead1830 Move ramped controls into template structure 2013-12-07 21:13:37 +00:00
Kp 75c229c6bf Normalize con_printf newline usage 2013-12-07 21:13:37 +00:00
Kp 61d8fe7cc8 Remove unused return value of gr_*printf / gr_*string 2013-12-07 18:44:07 +00:00
Kp 60727dd7d5 Add missing va_end calls 2013-12-07 18:42:50 +00:00
Kp c3dd634cce Remove unused flag OF_HARMLESS 2013-12-07 18:41:35 +00:00
Kp 706b458699 Mark PHYSFSX_find* functions nonnull 2013-12-07 18:40:32 +00:00
Kp a2cec5d71f Switch PHYSFSX_fgets to auto-sized variant where possible 2013-12-07 18:39:19 +00:00
Kp 7f5410cc8b Use lengthof instead of sizeof(A)/sizeof(A[0])
The latter form can accept pointers, but the template lengthof cannot.
2013-12-07 18:38:10 +00:00
Kp babbe8e9e6 Move */arch/carbon -> common/arch/carbon 2013-12-06 03:58:10 +00:00
Kp 18bf9b94ea Move */arch/cocoa -> common/arch/cocoa 2013-12-06 03:57:18 +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 eb84a067fa Remove now unused fgets_unlimited 2013-12-06 03:28:59 +00:00
Kp 3620392f56 Remove unused nm_messagebox_fixedfont 2013-12-06 00:24:07 +00:00
Kp 91b57e52c3 Mark ui_messagebox button strings const 2013-12-06 00:24:07 +00:00
Kp 1d3395cad1 Improve strlen usage 2013-12-06 00:24:07 +00:00
zico 7b0bda3302 Merge branch 'unification/master' of github.com:dxx-rebirth/dxx-rebirth into unification/master 2013-12-05 13:39:53 +01:00
Drakona 04d84ae61d Pass shot orientation with each weapon packet 2013-12-05 13:11:49 +01:00
Kp be0e9f5162 Use d_strdup for ui_add_gadget_button 2013-12-05 00:10:35 +00:00
Kp accaef2ecb Remove unused REMOVE_EOL macro in keypad.cpp
It conflicts with pre-compiled headers.
2013-12-05 00:08:58 +00:00
Kp 18aea17f9e Move */main/fireball.c -> similar/main/fireball.c 2013-12-02 00:21:31 +00:00
Kp 2ac98f7269 Move */main/gamemine.c -> similar/main/gamemine.c 2013-12-01 23:55:29 +00:00
Kp 38832fd1af Restructure gamemine.c for merge 2013-12-01 23:52:27 +00:00
Kp 2d01f3a649 Optimize references to player ship 2013-12-01 22:53:25 +00:00
Kp 74ac85076f Store joystick button text in one allocation 2013-12-01 22:42:47 +00:00
Kp 5354d05fbf Store joystick axis text in one allocation 2013-12-01 22:42:47 +00:00
Kp 25c731cc2c Probe for usable array template 2013-12-01 22:42:47 +00:00