Commit graph

195 commits

Author SHA1 Message Date
Kp 9f460e89a5 Skip exploding walls during demo playback
Demo playback manages the exploding walls explicitly.  Running the
normal exploding wall logic alongside the forced playback corrupts level
state.

Reported-by: _madness <https://forum.dxx-rebirth.com/showthread.php?tid=1095>
Fixes: 36ada21c0c ("Fold exploding walls into regular walls")
2018-12-01 01:58:37 +00:00
Kp f6352e7957 Pass correct object to check_effect_blowup
`check_effect_blowup` should receive the `laser_info` of the weapon that
caused the blast.  Previously, it was given the `laser_info` of the
parent of that weapon.  The parent was not of type `OBJ_WEAPON`, so
passing its `laser_info` is meaningless.

Fixes: 9bd1ba7c47
2018-11-01 02:41:30 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00
Kp ea5020a773 Fix gcc-4.9 build of similar/main/wall.cpp
gcc-4.9 shipped without support for std::is_trivially_move_assignable.
This is only needed in a sanity check, so preprocess it out when using a
gcc below gcc-5.

Reported-by: joolswills <https://github.com/dxx-rebirth/dxx-rebirth/issues/411>
Fixes: 57334255ac ("Simplify stuck object cleanup")
2018-10-20 17:25:59 +00:00
Kp c56223ced4 Eliminate more uses of valptridx::operator-> 2018-09-19 02:13:29 +00:00
Kp a8d5f83770 Remove reset_walls
Nothing should access the unassigned walls, so there is no need to clear
them.
2018-08-12 21:08:07 +00:00
Kp 36ada21c0c Fold exploding walls into regular walls 2018-08-12 21:08:07 +00:00
Kp dc4fcf8a35 Flip sense of is_door_free 2018-08-12 21:08:07 +00:00
Kp 8257232ecc Pass wclip & to wall_set_tmap_num 2018-08-12 21:08:07 +00:00
Kp b316afc30f Clear exploding walls during init 2018-08-12 21:08:07 +00:00
Kp 8bbdeedeb2 Consolidate stuck object state
Move it to a structure.  Make all the modifiers methods.  Change all
callers of those methods to pass the structure.  This makes the stuck
object handling free of direct access to global game data.
2018-08-04 17:52:57 +00:00
Kp 57334255ac Simplify stuck object cleanup 2018-08-04 17:52:57 +00:00
Kp 0fd7e0e4ce Pass context arrays to WALL_IS_DOORWAY 2018-06-24 05:06:15 +00:00
Kp 0c3e99f14c Split side uses based on shared vs unique 2018-06-24 05:06:15 +00:00
Kp 1d6ff380f7 Jump thread wall_is_doorway 2018-06-20 04:16:06 +00:00
Kp 1c1d92b399 Move valptridx factory iterator out to be generally available 2018-06-06 04:53:45 +00:00
Kp 9b028f26f2 Make eclip_num unsigned 2018-03-31 21:53:01 +00:00
Kp a3871cfefd Tighten eclip::dest_bm_num handling
Instead of testing for -1, test for any out-of-range value.
2018-03-31 21:53:01 +00:00
Kp e8645b2062 Pass vertex factory to compute_center_point_on_side 2018-03-12 03:43:47 +00:00
Kp 8ae4ef9eb5 Fix traps due to invalid level data
`Descent 2: Counterstrike` level 9 specifies a control center trigger on
a side with no wall.  This is not valid.  In normal play, wall_toggle
silently ignored this, and newdemo_pop_ctrlcen_triggers had undefined
behavior.  Add a warning in wall_toggle to report levels like this.  Add
handling in newdemo_pop_ctrlcen_triggers to detect and suppress this
bogus data.

`Descent 2: Counterstrike` level 11 specifies a control center trigger
on a side with no child segment.  This is not valid, so
newdemo_pop_ctrlcen_triggers again had undefined behavior.  Add handling
to detect and suppress this bogus data.

Reported-by: Descender1032 <https://forum.dxx-rebirth.com/showthread.php?tid=992>
2017-11-25 01:56:51 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp aa56477742 Propagate objects_in arguments 2017-08-13 20:38:31 +00:00
Kp b4899aafac Pass vcvertptr to get_seg_masks 2017-08-11 23:43:54 +00:00
Kp 73d92bb509 Make wclip::num_frames uint16_t 2017-06-17 23:05:16 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp baa187801b Add special case to make past releases not die on various segnums
All releases to date have a bug where they treat certain segment number
fields as an int, not a segment number.  Storing segment_none (0xffff)
into the save file causes affected releases to crash in various places
because it fails to recognize that this is segment_none.

Current code correctly treats segment_none as a non-segment and works
correctly without this hack.  The hack is only required to get past
releases to work correctly after loading a saved game written by current
code.
2017-01-21 19:05:43 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
Kp 4a01fab66d Fix failure to remove expired walls
std::remove_if can be called on an iterator that returns a proxy object,
but the results of that call are not generally useful.  When remove_if
attempts to move-assign over removed elements, it instead assigns over
the temporary proxy object.  If the proxy object has typical move
semantics, move-assigning over it has no effect on the underlying
container.

Revert to using partial_range on the underlying container.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/283>
Fixes: 1f434f98ad ("Use valptridx for ActiveDoors")
2016-12-11 23:47:40 +00:00
Kp 1f434f98ad Use valptridx for ActiveDoors 2016-12-10 17:51:08 +00:00
Kp 329ff67718 Raise D1 MAX_DOORS to match D2 2016-11-26 22:51:49 +00:00
Kp 66d946f5f7 Use std::find_if in wall_close_door to search ActiveDoors 2016-11-26 22:51:48 +00:00
Kp ecdefd93ad Use std::find_if in wall_open_door to search ActiveDoors 2016-11-26 22:51:48 +00:00
Kp 46ffb9d3f8 Use remove_if to remove obsolete open doors 2016-11-26 22:51:48 +00:00
Kp ac5ccf0c08 Pass active_door &to wall_close_door_num 2016-11-26 22:51:48 +00:00
Kp 1acee2d4f4 Remove unused wall_close_door 2016-11-26 22:51:48 +00:00
Kp 5c62f63606 Factor out active_door removal 2016-11-26 22:51:47 +00:00
Kp be706e190e Move wall_close_door_num copy loop up
There are two callers for wall_close_door_num.  The editor calls it in a
loop for all doors, so copying each active_door is wasteful since none
will survive the end of the loop.  Move the copy loop into the caller
that removes elements selectively.

This makes no attempt to fix the bugs associated with changing
Num_open_doors while iterating with Num_open_doors as an upper bound.
2016-11-26 22:51:47 +00:00
Kp 64ac7028e6 Pass active_door &to do_door_{open,close} 2016-11-26 22:51:47 +00:00
Kp 8bd9ec6360 Use range_for in do_door_close 2016-11-26 22:51:47 +00:00
Kp cb1410dd95 Use valptridx for CloakingWalls 2016-11-19 17:24:54 +00:00
Kp a9d82352b8 Use find_if to search CloakingWalls in start_wall_decloak 2016-11-19 17:24:54 +00:00
Kp 1cebed13e3 Use find_if to search CloakingWalls in start_wall_cloak 2016-11-19 17:24:54 +00:00
Kp ea837408d6 Use remove_if to remove obsolete cloaked walls 2016-11-19 17:24:54 +00:00
Kp fd39a752dd Factor out cloaking wall utility loops 2016-11-12 18:10:10 +00:00
Kp 38fb4c9c9e Pass cloaking_wall &to do_{,de}cloaking_wall_frame 2016-11-12 18:10:10 +00:00
Kp e8f9f22635 Factor out do_{,de}cloaking_wall_frame common head/tail 2016-11-12 18:10:10 +00:00
Kp b4b0de8801 Cache uvl pointers in do_decloaking_wall_frame 2016-11-12 18:10:10 +00:00
Kp c4a20b019e Simplify test for cloak_value change 2016-11-12 18:10:09 +00:00
Kp be08b119e6 Prepare do_cloaking_wall_frame for future work
Move the wall reference member into a structure, so that future work can
initialize front/back data in a cleaner way.
2016-11-12 18:10:09 +00:00
Kp c54948f916 Eliminate some wback tests in cloaking wall code 2016-11-12 18:10:09 +00:00
Kp f208a8490f Move do_cloaking_wall_frame demo test up 2016-11-12 18:10:09 +00:00
Kp aae5279bfd Initialize Stuck_objects for D1 2016-10-15 00:53:22 +00:00
Kp 038a6e3261 Pass player powerup_flags to wall_hit_process 2016-10-02 00:34:46 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp e446965511 Remove unnecessary wall number check in kill_stuck_objects
Callers are expected to filter out invalid numbers.  Even if they do
not, the only use of the number is to match entries in Stuck_objects.
An invalid match could cause a call to vobjptr() with an invalid index,
but that would be diagnosed by the valptridx checking, so no invalid
memory access will occur.
2016-07-21 01:43:22 +00:00
Kp 278c10dec0 Move flush_fcd_cache calls up from kill_stuck_objects
Many callers of kill_stuck_objects call it twice, once for each of two
walls.  Move the flush_fcd_cache up to occur only once, rather than once
per wall.
2016-07-21 01:43:21 +00:00
Kp 82e6ab130b Remove kill_stuck_objects() in wall_illusion_off
Objects cannot become stuck in illusionary walls, so there is nothing to
kill.
2016-07-21 01:43:21 +00:00
Kp 24f59cc9d0 Add stub flush_fcd_cache for D1 2016-07-21 01:43:21 +00:00
Kp b1bdf4aa53 Unify D1/D2 remove_obsolete_stuck_objects
After fixing the bogus lifeleft assignment, the D2 version is equivalent
to a more thorough version of the D1 version.  Delete the D1 version and
use the D2 version for both games.
2016-07-21 01:43:21 +00:00
Kp 7d926f0741 Remove bogus remove_obsolete_stuck_objects lifeleft change
This assignment looks bogus.  If the signature saved when the object
became stuck is different from the signature of the object currently
using that slot, then remove_obsolete_stuck_objects kills the object
using that slot.  Signatures are defined to change when the object slot
is freed and reused.  Therefore, this statement kills the new object
that took the slot of the obsolete object.  This new object may be
important, such as a spawned robot or a weapon.
2016-07-21 01:43:21 +00:00
Kp f29630bd4a Propagate MAX_STUCK_OBJECTS 2016-07-21 01:43:21 +00:00
Kp a98e97505e Fix -Wshadow warnings in do_door_close 2016-05-21 17:24:50 +00:00
Kp 30230a8137 Pass object &to blast_nearby_glass 2016-04-23 17:59:47 +00:00
Kp a18a483114 Pass object &to bng_process_segment 2016-04-23 17:59:47 +00:00
Kp 5dae1e9080 Use range_for for kill_stuck_objects 2016-04-05 01:10:18 +00:00
Kp cc18ad2b68 Fix some -Wshadow warnings 2016-02-12 04:02:28 +00:00
Kp 553b313099 Use vwallptr 2016-02-12 04:02:28 +00:00
Kp 08248331a9 Unify do_door_close 2016-02-06 22:12:55 +00:00
Kp 0101f98905 Use wallnum_t in more places 2016-02-06 22:12:54 +00:00
Kp bb5d1bb7e5 Use valptridx array type for Walls 2016-02-06 22:12:54 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
Kp 4770d3a35e Factor out wall_illusion_* common logic 2016-01-09 16:38:10 +00:00
Kp 5ba5910e7a Use symbolic side_none for testing find_connect_side result 2016-01-03 20:21:35 +00:00
Kp d479819931 Use absolute_sibling to reduce global references for ptridx 2015-12-22 04:18:51 +00:00
Kp db9fb0ed42 Move more symbols into namespace dcx/dsx 2015-12-22 04:18:50 +00:00
Kp 1adf34403e Compile out unused wclip_write
Unused since 547193c591 ("Compile out unused bm_write_all") disabled caller bm_write_all.
2015-12-04 03:36:31 +00:00
Kp 708dc0a7e1 Use vobjptr/vcobjptr for more Objects[] access 2015-12-03 03:26:49 +00:00
Kp b683b4cc68 Scope weapon type 2015-12-03 03:26:49 +00:00
Kp dad504cfef Fix some -Wshadow warnings 2015-11-26 02:56:54 +00:00
Kp 6b353cb9ac Move player powerup_flags to object.ctype.player_info 2015-11-07 21:55:59 +00:00
Kp 070444157e Use type safe player flags 2015-10-30 02:52:55 +00:00
Kp 2ac6c0e72b Factor out red/gold/blue key messages 2015-10-24 03:13:11 +00:00
Kp 1c84b7ab9c Use enum class for wall_hit_process_t 2015-10-24 03:13:11 +00:00
Kp be62f446f1 Use range_for for clear_stuck_objects 2015-09-15 02:48:03 +00:00
Kp 3b2d6f42ab Use range_for for add_stuck_object 2015-07-21 02:57:27 +00:00
Kp 644c80e632 Pass vsegptr to add_stuck_object 2015-07-21 02:57:27 +00:00
Kp cf678a23ac Pass vcsegptridx/vcsegptr to find_point_seg 2015-07-18 21:01:55 +00:00
Kp fa8dcc9113 Explicitly delete basic_ptridx(pointer_type); require array
Require the array argument for basic_ptridx, which is supplied
automatically when the factory is used.
2015-07-13 01:09:37 +00:00
Kp e16f6bd267 Use valptr for wall.cpp 2015-07-12 01:04:21 +00:00
Kp c10e580453 Optimize check_poke
Callers care only for zero vs. non-zero.  Return (sidemask & (1 <<
side)) to skip the test and reload to constant 1.
2015-07-12 01:04:17 +00:00
Kp 8e5bf66b5f Optimize is_door_free
Skip finding the connecting side if the first side is blocked.
2015-07-12 01:04:17 +00:00
Kp f7c6462631 Pass vcobjptr_t to check_poke 2015-07-12 01:04:17 +00:00
Kp 1b6999ff4d Switch get_seg_masks from vcsegptridx_t to vcsegptr_t
The index component is not needed.
2015-07-12 01:04:17 +00:00
Kp c72a3a9b11 Make Stuck_objects static 2015-06-13 22:42:21 +00:00
Kp b6a9b2a853 Pass vsegptridx to wall_toggle 2015-05-28 03:08:40 +00:00
Kp c0eb67a9f1 Use vsegptr in network messages 2015-05-28 03:08:39 +00:00
Kp adbefd39c4 Minimize unnecessary fields passed to check_effect_blowup 2015-04-19 04:18:52 +00:00
Kp b0ec49f8e5 Remove unused file+line from get_seg_masks 2015-04-02 02:36:56 +00:00
Kp aa75a398d9 Move Wall_names to dumpmine.cpp 2015-04-02 02:36:56 +00:00