Commit graph

9394 commits

Author SHA1 Message Date
Kp 2e6b5e8467 Add special case to make past releases not die on Dead_controlcen_object_num
All releases to date have a bug where they treat
Dead_controlcen_object_num as an int, not an object number.  Storing
object_none (0xffff) into the save file causes affected releases to
crash when treating object_none as a valid object number.

Current code correctly treats object_none as a non-object and works
correctly without this hack.  The hack is only required to get past
releases to survive destroying the reactor after loading a saved game
written by current code.

Fixes: 9125ae32cd ("Make objnum unsigned")
2017-01-21 19:05:43 +00:00
Kp 6da2b446f5 Use range_for in editor/group.cpp 2017-01-21 19:05:42 +00:00
Chris Taylor f2f6af5bf1 Always set hide_segment in init_ai_object
Fixes bug where in the editor, you insert a robot with normal behaviour then play the level - it fails the check on the hide_segment index in init_ai_objects(). This is because hide_segment was written as the poisoned value of 0xfdfd if the behaviour of the robot is AIB_NORMAL - because hide_segment wasn't initialised. Therefore, always setting hide_segment to suppress this exception (it's an inexpensive operation seldom called).
2017-01-21 13:47:27 +08:00
Kp fd2c8df74e Raise MAX_WALLS to 255
Raise D2 MAX_WALLS to 255, since Walls[254] is not special.  Synchronize
D1 MAX_WALLS to D2 MAX_WALLS to fix D1 Level of the World BRDECON.

Requested-by: Ryusei117 <http://www.dxx-rebirth.com/frm/index.php/topic,1760.msg22509.html#msg22509>
2017-01-18 03:06:02 +00:00
Kp 0ac4eb52b2 Merge pull #308 into master
Merge kreatordxx's fixes for flags on guest players.
2017-01-17 02:49:54 +00:00
Kp cc885f17a3 Use init_ai_object for dropped robots
zicodxx reported a problem where poison=overwrite builds caused robots
dropped by other robots not to spawn.  I diagnosed it as a problem
caused by not setting `dying_start_time` and proposed using
`init_ai_object` to set this (and other) fields.  Kreatordxx posted pull
request #311 to implement this for dropped robots.  However, his pull
had the unfortunate side effect of zeroing the dropped robot's velocity.
This change is based on his pull, but with the `init_ai_object` call
moved higher so that the velocity is (unnecessarily) zeroed by
`init_ai_object`, then initialized to `new_velocity` by `drop_powerup`
(as it always was).

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/293>
Patch-inspired-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/311>
2017-01-17 02:38:21 +00:00
Chris Taylor b1b5de4297 Additional safeguard for bug #306
This is where a client in a multiplayer game hitting a wall fails an assert. Initialise obj->mtype.phys_info.flags in multi_reset_player_object() instead of adding flags. (Tested and still works OK without specifying PF_THRUST.)
2017-01-16 15:39:10 +08:00
zico b644ab575c Raised MAX_DELTA_LIGHTS to 32000. 2017-01-15 14:12:03 +01:00
zico 5acbb949de Raised MAX_NUM_FUELCENS and MAX_ROBOT_CENTERS to 128. 2017-01-15 13:43:02 +01:00
Chris Taylor e76c8cf264 Fix bug #306 where a client in a multiplayer game hitting a wall fails an assert
Initialise ConsoleObject->mtype.phys_info.flags in reset_player_object() instead of adding flags. The only place this was initialised properly was when reading the player object from disk.
2017-01-15 18:11:54 +08:00
kreatordxx 5dec6d3975 Merge pull request #307 from dxx-rebirth/multi_gauge_pic
Fix debugger break at draw_weapon_info_sub when multi player dumped
2017-01-15 16:58:58 +08:00
Kp 092d947830 Optimize change_light search
Use std::equal_range to find the upper and lower bounds in a single
binary search, rather than relying on a linear search to find the first
sought element.
2017-01-15 00:03:14 +00:00
Kp 3594e7093f Switch last_hitobj to use array<objnum_t> instead of bitset
This reduces the number of objects that can be tracked concurrently, but
allows MAX_OBJECTS to rise without causing `laser_info` to grow.
2017-01-15 00:03:13 +00:00
Kp 6d3fb34268 Abstract out last_hitobj management 2017-01-15 00:03:13 +00:00
Kp 1b81013a9b Pass active palette to ogl_loadtexture 2017-01-15 00:03:13 +00:00
Kp d908b22fdc Move weapon_id_type to namespace dsx 2017-01-15 00:03:13 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
Kp 96cc5a40b8 Remove dead preprocessor guards
Some bitblt code had guards of the form:

	#if A
	xxx
	#if !A
	yyy
	#endif
	zzz
	#endif

If A is true, !A is false, so the inner block can never be included.
Delete it.
2017-01-15 00:03:12 +00:00
Kp f4fffeea49 Make more render state const when possible
Make Render_zoom const in builds where there are no statements that can
change it.

Use vcseg, not vseg, for some segment accesses.
2017-01-15 00:03:12 +00:00
Chris Taylor 8c51aa0b1e Fix debugger break at draw_weapon_info_sub when multi player dumped (bug #303)
Also happened when a client to a multiplayer game dropped out due to some network error. Delay call of multi_leave_game() until responding to EVENT_WINDOW_CLOSE, so the game isn't in an unstable state between handling the network event and the game closing.
2017-01-14 17:49:43 +08:00
Chris Taylor 479f5ed584 Fix 'format specifies type 'unsigned short' but the argument has type 'unsigned char'' warning
Replace %hu with %hhu for capped in call to con_printf in powerup_cap_state::cap_secondary_ammo.
2017-01-13 12:32:46 +08:00
Chris Taylor 6ecccd3491 Fix 'equality comparison with extraneous parentheses' warning
Remove offending parentheses around call to multi_i_am_master() in net_udp_leave_game().
2017-01-13 12:30:57 +08:00
Chris Taylor bde055a6a1 Fix 'declaration shadows a field of 'dcx::ogl_sync'' warning
Replace fence with fence_func in implementation of ogl_sync::sync_deleter::operator().
2017-01-13 12:30:09 +08:00
Kp 5201218e20 Fix D1 build
Commit 4cc801f changed `object_move_one` to return `window_event_result`
instead of `void` and added a default return value at the bottom.
However, it added the value inside a `#if D2` block, so the D1 build now
fails with:

    similar/main/object.cpp: In function 'dcx::window_event_result d1x::object_move_one(d1x::vobjptridx_t)':
    similar/main/object.cpp:1627:7: error: variable 'result' set but not used [-Werror=unused-but-set-variable]
    similar/main/object.cpp:1866:1: error: control reaches end of non-void function [-Werror=return-type]

Move the return statement out of the conditional block to fix both these
errors.

Fixes: 4cc801f42f ("Remove calls to window_close(Game_wind) when game finished or over")
2017-01-13 03:19:19 +00:00
kreatordxx 0acddd0a35 Merge pull request #299 from dxx-rebirth/no_game_wind_close2
Remove remaining calls to window_close(Game_wind)
2017-01-11 19:21:41 +08:00
Kp 51710ba9db Default to -fno-omit-frame-pointer for Windows
Popular Windows tools for stack unwinding lack support for the DWARF
debug format.  Unwinding the stack without DWARF is unreliable without
frame pointers.  Default frame pointers to enabled for Windows so that
these tools work despite their lack of DWARF support.
2017-01-11 03:03:19 +00:00
Chris Taylor 0c5a000328 Remove call to window_close(Game_wind) when a network event tells us to end the game
In multi_do_frame(), replace call to window_close(Game_wind) with returning window_event_result::close whenever multi_quit_game is true. Only using this return value where multi_do_frame() is directly called by GameProcessFrame(). multi_quit_game will only be set back to 0 when a new multi game is started.

Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-10 14:10:39 +08:00
Chris Taylor a418f8caec Remove call to window_close(Game_wind) when multiplayer level syncing fails
Replace call to window_close(Game_wind) with returning window_event_result::close to game_handler. Applies to when there is a failure in net_udp_level_sync(). Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-10 13:02:59 +08:00
Chris Taylor 2ecc4c4a07 Remove call to window_close(Game_wind) when stopping demo playback
Replace call to window_close(Game_wind) with returning window_event_result::close to game_handler. Applies to whenever newdemo_stop_playback() is called. Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-09 19:09:34 +08:00
kreatordxx d10896f116 Merge pull request #297 from dxx-rebirth/newdemo_no_space
Fix crash when ran out of disk space when writing demo
2017-01-09 10:05:25 +08:00
kreatordxx f590ec45c6 Merge pull request #298 from dxx-rebirth/no_game_wind_close
Remove calls to window_close(Game_wind)
2017-01-09 09:32:24 +08:00
Chris Taylor 6e2c3c61b1 Format LevelError text better for the case of an exit that is both regular and secret 2017-01-09 09:30:53 +08:00
Chris Taylor 0daf28e787 Small efficiency improvement for a return value in do_endlevel_frame() 2017-01-09 09:26:32 +08:00
Chris Taylor 06968db4bc Fix crash when ran out of disk space when writing demo
Check for nd_record_v_no_space in _newdemo_write.
2017-01-09 09:15:51 +08:00
Kp d2dc321528 Fix sconf.log version output 2017-01-08 22:32:01 +00:00
Kp 0d5d7a01ad Fold PHYSFS_write calls for Automap_visited 2017-01-08 22:32:01 +00:00
Kp 7b08144aee Poison unused exploding walls 2017-01-08 22:32:00 +00:00
Kp d289fec43b Update hitobj_list in multi_object_rw_to_object 2017-01-08 22:32:00 +00:00
Kp 94716dfab5 Scrub OBJ_NONE objects from multiplayer peers 2017-01-08 22:32:00 +00:00
Kp 7fafc22cca Poison multiplayer object_rw without making it unreadable
`struct object_rw` is poisoned prior to initializing and sending it.
However, some fields are legitimately unininitialized (other than their
memset or poison value) at send time.  Add and use a poison variant that
can clear those fields, without marking them unreadable.
2017-01-08 22:32:00 +00:00
Kp 5da784dbed Pass canvas to gr_{,u}string 2017-01-08 22:32:00 +00:00
Kp 1ef6b9d5bc Pass font to gr_get_string_size 2017-01-08 22:31:59 +00:00
Kp 0480ba8030 Pass canvas to gr_string(int,int,const char*,int,int) 2017-01-08 22:31:59 +00:00
Kp 6e8c3b3357 Pass canvas to gr_internal_string_clipped{,_m} 2017-01-08 22:31:59 +00:00
Kp c291873041 Pass canvas to gr_internal_string_clipped_template 2017-01-08 22:31:59 +00:00
Kp 9dbcbc51ce Pass canvas to gr_ustring_mono 2017-01-08 22:31:59 +00:00
Kp 83e86707aa Pass canvas to gr_internal_string0{,m} 2017-01-08 22:31:59 +00:00
Kp f0ee7af1aa Pass canvas to gr_internal_string0_template 2017-01-08 22:31:58 +00:00
Kp f58b66173f Pass canvas to gr_internal_color_string 2017-01-08 22:31:58 +00:00
Kp 8d1bd87b33 Pass canvas to ogl_internal_string 2017-01-08 22:31:58 +00:00