Commit graph

2210 commits

Author SHA1 Message Date
Kp 0dfd462c64 Change fvi_query to pass LevelUniqueObjectState if checking objects
Remove the definition of FQ_CHECK_OBJS and all uses of it.  Add a new
fvi_query member d_level_unique_object_state *LevelUniqueObjectState.
If object checking is enabled, pass &LevelUniqueObjectState in that
member.  If object checking is disabled, pass nullptr in that member.

Change fvi_sub to use this member to decide whether to perform object
checking.
2022-07-09 13:39:29 +00:00
Kp 4bc901b0a9 fvi_sub: validate object once at start of FQ_CHECK_OBJS
If FQ_CHECK_OBJS is used, a valid object is required.  Copy the
icobjptridx_t from fvi_query into a local vcobjptridx_t to force a
validation, then use that validated copy for later work.
2022-07-09 13:39:29 +00:00
Kp 4ab619b7c2 Restructure use of fvi_query
- Make all members constant, and pass an anonymous temporary fvi_query
  to find_vector_intersection.
- Change `p0`/`p1` to `const vms_vector &`, since the positions are
  mandatory.  Callers can no longer pass `nullptr` or an uninitialized
  value here.
- Change `thisobjnum` to `icobjptridx_t`.  Calls to fvi_sub built an
  objptridx at need, so moving it to the caller allows it to be
  constructed once per find_vector_intersection call.
- Move `flags` and `rad` out of fvi_query, since calls to fvi_sub may
  use other values than the ones in fvi_query.  This prepares for
  passing fvi_query to fvi_sub.
2022-07-09 13:39:29 +00:00
Kp 8ba1390947 Pass state to explode_object 2022-07-09 13:39:29 +00:00
Kp e25b476de7 Use enum for segnum_t
Add checked conversions for sites which load from external integers.
2022-07-02 18:10:45 +00:00
Kp fca59adb53 Split out creating OBJ_WEAPON objects 2022-07-02 18:10:45 +00:00
Kp e2509fc840 Move d_robot_info_array out of d_level_shared_robot_info_state
Embedding it in d_level_shared_robot_info_state is reasonable from a
relational perspective, but interferes with referencing
d_robot_info_array when only a forward declaration of
d_level_shared_robot_info_state is available.
2022-07-02 18:10:45 +00:00
Kp e45ff2da5e Use named enum types for netflag and netgrant 2022-07-02 18:10:45 +00:00
Kp a1bdd81d41 Exclude unused code from D2 non-editor build
gamedata_read_tbl is only called if (D1 || (D2 && EDITOR)).  Exclude
defining it for (D2 && !EDITOR).  From there, also exclude defining or
reading the alias list, which is only written by a function
called by gamedata_read_tbl.

Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/642>
2022-06-11 15:00:02 +00:00
Kp 346906ae9f Simplify UPID_QUIT_JOINING
The host only needs to check the source address.  Remove the check on
the callsign, and shrink the message accordingly.
2022-06-05 17:44:53 +00:00
Kp 9816475706 Pass Object array to object_goto_next_viewer 2022-06-05 17:44:53 +00:00
Kp c5de47b51e Add const qualifiers to some net_udp functions 2022-06-05 17:44:53 +00:00
Kp 3d7cb4abc7 Remove force_dump_ai_objects_all
It rotted because it is only ever used when PARALLAX is defined.  No one
has reported it broken, so remove it.
2022-06-05 17:44:53 +00:00
Kp e180375f97 Pass GameBitmaps to draw_object_blob 2022-06-05 17:44:52 +00:00
Kp cc2f3caa7e Split piggy.h -> fwd-piggy.h 2022-06-05 17:44:52 +00:00
Kp 6228b07b45 Fix check_header_includes=1 build of fvi.h 2022-06-05 17:44:52 +00:00
Kp 6e2ed26659 Pass object to init_player_object 2022-06-05 17:44:52 +00:00
Kp 9f207daf95 Pass player object to reset_player_object 2022-06-05 17:44:52 +00:00
Kp 11a0aae9ee Pass GameBitmaps to piggy_bitmap_page_in 2022-06-05 17:44:52 +00:00
Kp 33152640bc Remove fvi_info::hit_type
Its value is always readily available as the return value of
find_vector_intersection, so remove the structure member and rely on the
returned value.
2022-06-05 17:44:52 +00:00
Kp be7388a369 Enable repaircenter in D1
The code exists in D2, and the segment special is reserved for both
games.  Include the repaircenter code in D1, also.
2022-06-05 17:44:52 +00:00
Kp 6bd6a47612 Rework compress_segments to use segment iterators
This removes direct math on segnum_t, which will simplify later use of
`enum class segnum_t`.
2022-06-05 17:44:52 +00:00
Kp 86a32dd0ff Change enum sidenum_t to enum class sidenum_t 2022-06-05 17:44:52 +00:00
Kp a8e7f6ad59 Use enum class for find_vector_intersection result 2022-05-24 02:32:58 +00:00
Kp cf51ac4ee0 Fix BUG on show-path cheat
Players are not robots, but the show-path cheat tried to pretend they
are, and triggered a BUG warning[1] when looking up robot information
from the player object.  Fix this by passing in the robot_info when the
caller is providing a robot, and a named `nullptr` value (as
`create_path_unused_robot_info`) when the caller is providing a
non-robot object.

[1] As below, but repeated many times
```
similar/main/ai.cpp:1905: BUG: object 0x555555858550 has type 4, expected 2
similar/main/ai.cpp:1974: BUG: object 0x555555858550 has type 4, expected 2
```
2022-05-21 19:51:18 +00:00
Kp 8c5eff2ba0 Remove unused return value of callsign_t::copy 2022-05-10 01:58:55 +00:00
Kp 7b7145f20a Simplify zeroing callsign on copy-in
Zero the entire array, then overwrite the leading portion with the
received data.  This permits the compiler to do a fixed number of large
stores, instead of a variable number of small stores.
2022-05-10 01:58:55 +00:00
Kp bdff6f7a00 Remove unused return value of attempt_to_steal_item 2022-05-05 02:59:11 +00:00
Kp 504b38759c Use enum class for weapon_sound_flag
Pass the silent/audible flag as an enum:uint8_t to avoid type confusion
issues.
2022-04-24 20:42:01 +00:00
Kp a610a7b32d Pass bare object & to thief stealing routines
Use `object &` instead of `vmobjptr_t`.  This should generate equivalent
code, but produce smaller debug information and may require less
inlining by the compiler.
2022-04-24 20:42:01 +00:00
Kp 1c2e1c6946 Tighten type info for d_strdup
The allocated block is part of the dmem subsystem, so return a type that
reflects that.
2022-04-24 20:42:01 +00:00
Kp 8f8989e049 Propagate do_laser_firing nfires as 1
Every caller passes `1`, so remove the parameter and always use `1`.
For backward compatibility with the previous network protocol, continue
to send a `1` in the network message.
2022-04-17 22:27:19 +00:00
Kp f79baf722c Move static obj_* functions into anonymous namespace 2022-04-17 22:27:19 +00:00
Kp 2a6c513ffd Fix LTO ODR build failure in wall.h
The conditional definition of a D2X flag causes a technical ODR
violation.  It is legal, though not useful, to define this flag in D1X
and in common code.  Remove the preprocessor guard so that D2X and
common code use the same definition for the enum.
2022-04-17 22:27:19 +00:00
Kp d0c32b8cf2 Pass LevelUniqueWallSubsystemState to wall_init 2022-04-17 22:27:19 +00:00
Kp 211dcede72 Inline trigger_init
It is used in only one place.  Move it inline.
2022-04-17 22:27:19 +00:00
Kp bbd49251cf Simplify susegment constructor overloads
Use a single constructor that accepts anything convertible to both of
the required types, rather than special constructors for:
- Accepting a qualified_segment
- Accepting a variant of susegment with compatible const qualifiers
- Accepting a type T that converts to qualified_segment

This reduces the number of constructors to consider, which improves
error messages when an invalid input is used.
2022-04-17 22:27:19 +00:00
Kp 06a0de1c90 Remove write-only legacy trigger field time
v29_trigger and v30_trigger define a field `time`.  v29_trigger never
initializes it.  v30_trigger initializes it from the uninitialized
v29_trigger in legacy mode, and from a file field otherwise.  No program
logic ever reads this member, so remove it.
2022-04-16 19:38:02 +00:00
Kp 21aae1a352 Tighten symbol visibility for xrange
Switch to using protected inheritance, and expose the two base fields
that are needed outside the class.
2022-03-05 17:23:51 +00:00
Kp dc59b0b2cb Split out xrange init_begin ascending/descending paths
AlumiuN reports that mingw32-w64-gcc-8.1.0 incorrectly reports
`ascending` as unused-but-set.  This is clearly not true.  Reorder the
code to avoid saving `ascending`, and instead use the result of
`detail::get_xrange_ascending` directly.  This also improves the error
message in the DXX_ALWAYS_ERROR_FUNCTION path.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/626>
2022-03-05 17:23:51 +00:00
Kp 9e58992296 Flatten constant_xrange hierarchy 2022-02-27 14:23:53 +00:00
Kp 6863dd3581 Reduce lifetime of joy_axis
It is only needed for the duration of kconfig_end_loop.  Move it from
the global Controls to local scope.
2022-02-27 14:23:53 +00:00
Kp 197a9cbd98 Move joystick interpretation to happen after the event loop
If two or more events are delivered in the same loop, the previous
implementation would count joystick motion multiple times.  Fix this by
moving the joystick interpretation to occur once, after all the events
have been processed.
2022-02-27 14:23:53 +00:00
Kp 9464bdf2e4 Use enumerated_array for indexing player input controls 2022-02-27 14:23:53 +00:00
Kp 68268e9a1f Use sidenum_t in more places 2022-02-19 14:52:17 +00:00
Kp 2fe9a16613 Use dedicated type for mask of segment side numbers 2022-02-19 14:52:17 +00:00
Kp 8c037b7c26 Split player start generation
Move some of the logic to a separate function to enable use of `return`
instead of a `break` from a composite loop.
2022-02-19 14:52:17 +00:00
Kp b1278b8e39 Flatten type hierarchy for enumerated_iterator
Pass adjust_iterator_dereference_type directly, instead of passing
iterator_dereference_type and letting enumerated_iterator compute
adjust_iterator_dereference_type.
2022-02-19 14:52:17 +00:00
Kp 72064c62e7 Add unit tests for enumerate 2022-02-13 19:13:38 +00:00
Kp 17d1c3fb13 Pass range index_type through zip_iterator 2022-02-13 19:13:38 +00:00
Kp f2832e6248 Simplify _sockaddr IPv4/IPv6 logic
- Use std::integral_constant instead of a static function that returns
  the value
- Remove unused protocol_family
- Replace the enum with a typedef for the one type that the enum was
  used to define
2022-02-12 18:57:12 +00:00
Kp 8be306efa7 Use enum class for cockpit_mode_t 2022-02-12 18:57:12 +00:00
Kp 6b8a0a74c6 Fix some check_header_includes=1 failures 2022-02-12 18:57:12 +00:00
Kp 2be1a8ca85 Split game.h to fwd-game.h 2022-02-12 18:57:12 +00:00
Kp 8d9989024e Split inferno.h to fwd-inferno.h 2022-02-12 18:57:12 +00:00
Kp 504cbcc012 Split powerup.h to fwd-powerup.h 2022-02-12 18:57:12 +00:00
Kp da49df78f7 Split drop_powerup to return either an object id or a success code
If exactly one object will always be needed, use an overload that
returns the object id.  Otherwise, use an overload that only returns
whether at least one object was created.  This simplifies callers that
always request exactly one object.
2022-02-06 16:12:31 +00:00
Kp 04f0507942 Fix memory corruption if spit_powerup fails to drop a weapon
If spit_powerup fails, it returns object_none.  object_none is not a
valid index for use by map_objnum_local_to_remote.
2022-02-06 16:12:31 +00:00
Kp d5e520bc7b Fix failure to send robot creation message if one creation fails
If at least two robots would be dropped, and a drop failed, then
object_create_robot_egg would report failure to the caller.  Callers
that check the return code treat any failure as total failure, but that
is not guaranteed to be true.  If the game successfully dropped one
robot and failed when dropping a second, then the caller would receive a
status of failure.

Fix this by returning a status of whether at least one object was
created.
2022-02-06 16:12:31 +00:00
Kp 4a85b55865 Factor out drop_player_eggs creation of vulcan/gauss weapons 2022-02-06 16:12:31 +00:00
Kp 1ad3377a83 Pass context to start_boss_death_sequence 2022-02-05 13:30:56 +00:00
Kp 29d6072f60 Pass context to drop_stolen_items 2022-02-05 13:30:56 +00:00
Kp 60c5fc5dc4 Pass object& to multi_drop_robot_powerups 2022-02-05 13:30:56 +00:00
Kp 6cc788e1cd Pass object_base& to object_create_robot_egg 2022-02-05 13:30:56 +00:00
Kp f55aed4b9b Pass object& to ai_door_is_openable 2022-02-05 13:30:56 +00:00
Kp 2440a271da Improve vulcan/gauss pickup rules
- Change D1X to use D2X rules regarding Vulcan cannon pickup.  The D1X
  rules were confusing at best, and seem outright wrong in some ways.
  - When a Vulcan cannon was picked up, it was treated as containing not
    less than VULCAN_WEAPON_AMMO_AMOUNT rounds, regardless of what it
    actually contained.  D2X respected the actual contained count, even
    when running in D1X emulation mode.
  - In D1X single player, if the Vulcan cannon was not picked up, then
    it could be treated as Vulcan ammo.  If at least 1 unit of
    ammunition was added to the player, the entire powerup would be
    consumed, regardless of how much ammunition remained.
  - In D2X single player, if the Vulcan cannon was not picked up, then
    ammunition would be taken from it, but the powerup would only be
    consumed if all its ammunition was taken.
  - In D1X multiplayer, a player who already had a Vulcan cannon could
    not get anything from touching a new cannon, and the cannon would
    not be changed.
  - In D2X multiplayer, a player who already had a Vulcan cannon could
    take ammunition from the cannon, but the cannon could not be drained
    below VULCAN_AMMO_AMOUNT.  If the cannon had VULCAN_AMMO_AMOUNT or
    less, then the player could not take ammunition.  If the cannon had
    more, the player could drain it to that level.
  - Replace all that with a simplified version of the D2X rules:
    - If the player does not have the cannon, the cannon is picked up
      and removed from the mine.  The player takes as much of its
      ammunition as possible.  If the cannon was well stocked, and the
      player was nearly full, some ammunition will be lost.  This is
      unfortunate, but the game has always had this rule, and changing
      it would require dropping one or more Vulcan Ammo packs to
      represent the untaken ammunition.
    - If the player already had that cannon, then the player takes as
      much ammunition as the cannon has, while not exceeding the
      ammunition cap.  Other players, if any, are updated about how much
      ammunition remains in the cannon.  The cannon remains in the mine.
- Backport to D1X the network message for updating the contained
  ammunition in a vulcan cannon.  zico added the basic feature in
  7684ce92, but only applied it to D2X.  With the change to let D1X
  multiplayer take ammunition from the cannon, D1X now needs the same
  feature.
- Remove the special case to delete an empty cannon.  Instead, let the
  cannon remain in the mine without ammunition.  This allows a player in
  single player mode to leave behind a backup cannon, which could be
  useful if the player is killed and wishes to rearm before returning to
  the death site.  Similarly, under the new rule that players in
  multiplayer can drain the cannon down to 0 ammunition, this removal
  allows the cannon to remain behind for someone else to take, rather
  than allowing it to be deleted by a player who already had an instance
  of it.
2022-02-05 13:30:56 +00:00
Kp 636e1b6d5e Use enumerated_array for unique_side::uvls 2022-01-15 20:39:10 +00:00
Kp 075495aa8b Use enumerated_array for d_level_unique_automap_state::Automap_visited 2022-01-15 20:39:10 +00:00
Kp a7c9a04c20 Use enumerated_array for shared_segment::children 2022-01-15 20:39:10 +00:00
Kp dc2e86760e Use enumerated_array for Side_opposite 2022-01-15 20:39:10 +00:00
Kp 4a6a4c4646 Use enumerated_array for unique_segment::sides 2022-01-15 20:39:10 +00:00
Kp 1c57e1032d Use enumerated_array for shared_segment::sides 2022-01-15 20:39:10 +00:00
Kp 2659400a97 Use sidenum_t for trigger::side 2022-01-15 20:39:10 +00:00
Kp 2d890131fb Disable packing on old trigger structures
It is not necessary, and causes problems when trying to take a reference
to a member.
2022-01-09 15:25:42 +00:00
Kp f47a2c9f0d Convert Side_to_verts to enumerated_array<..., sidenum_t> 2022-01-09 15:25:42 +00:00
Kp fbe3bbd0fa Use enum sidenum_t in more places 2022-01-09 15:25:42 +00:00
Kp fedb48613c Move object_rw to namespace dsx
It depends on types in dsx.
2022-01-09 15:25:42 +00:00
Kp 78d4a36bb4 Explicitly require support for C++11 constructor inheritance
Parts of the code already used the C++11 syntax, so compilers without it
were already unsupported.  Expand the remaining uses to the standard
syntax.
2022-01-09 15:25:42 +00:00
Kp 0f53ce0f06 Factor out get_xrange_direction
clang chokes on use of a `constexpr bool` that is initialized separately
from its definition.  gcc allows this.  Move the value computation into
a constexpr helper function, so that the variable can be defined and
initialized in the same statement.
2022-01-09 15:25:42 +00:00
Kp 6cdc181218 Use enum class for segment_relative_vertnum 2022-01-09 15:25:42 +00:00
Kp 932419ff17 Combine Two_sides_to_edge, Edge_between_sides
These track the same data, but were static and defined separately.
Delete Edge_between_sides and redirect uses to Two_sides_to_edge.
2022-01-09 15:25:42 +00:00
Kp b8a8a61ff8 Simplify multiplayer powerup creation
Instead of creating the powerup from a player, then overwriting the
location and velocity of the powerup, and fixing up its segment, create
the powerup directly where it should be, with the intended velocity.
2022-01-09 15:25:42 +00:00
Kp 94cfeede5c Validate control center trigger sides on load 2022-01-09 15:25:42 +00:00
Kp 078a9affa0 Make MAX_SIDES_PER_SEGMENT an iterable range
Iterating over it returns each side number in turn.  This allows
converting many loops of the form:

```
	for (int i = 0; i < MAX_SIDES_PER_SEGMENT; ++i)
```

to the compact form:

```
	for (const auto i : MAX_SIDES_PER_SEGMENT)
```

The compact form brings the usual benefit of range-based for: delegating
iteration to the compiler prevents the loop body from skipping a step,
and makes clear in the code that this is the case.
2022-01-09 15:25:42 +00:00
Kp 3004dd16e5 Convert some bare integers to sidenum_t 2022-01-09 15:25:42 +00:00
Kp d6b4106d36 Tighten index handling for Ai_transition_table
Avoid undefined accesses when a robot has an invalid awareness type.
2022-01-08 17:48:09 +00:00
Kp 648bbac0b1 Convert ai_local::achieved_state to ai_static_state 2022-01-08 17:48:09 +00:00
Kp d1ac265c2c Convert ai_local::goal_state to ai_static_state 2022-01-08 17:48:09 +00:00
Kp 37f3c10dd4 Convert ai_static::CURRENT_STATE to ai_static_state 2022-01-08 17:48:09 +00:00
Kp c3937f391f Convert ai_static::GOAL_STATE to enum 2022-01-08 17:48:09 +00:00
Kp 9fdf6005df Convert ai_static::GOALSIDE to sidenum_t 2022-01-08 17:48:09 +00:00
Kp c6d98df9fb Move CURRENT_GUN out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp 5128b84122 Move CURRENT_STATE out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp 39e9673f54 Move GOAL_STATE out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp c10855939b Move PATH_DIR out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp 1f00d716de Move SUBMODE/SUB_FLAGS out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp db90f0df62 Move GOALSIDE out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp ae44e0226e Move CLOAKED out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp db7b528177 Move SKIP_AI_COUNT out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp 197ed13d42 Move REMOTE_OWNER out of ai_static::flags 2022-01-08 17:48:09 +00:00
Kp 7015e3e93c Move REMOTE_SLOT_NUM out of ai_static::flags
Some flags merit a type other than int8_t.  Begin moving flags out to
distinct variables with their own type.

Add static_assert checks that the ABI relevant structures do not change.
2022-01-08 17:48:09 +00:00
Kp b4341e69a5 Remove unnecessary definitions of get_static_size
These exist only to be declared, and never called.
2022-01-07 04:26:22 +00:00
Kp 941190ff32 Explicitly default d_fname copy constructor
clang warns that an implicit copy constructor is deprecated in the
presence of an explicitly defaulted copy-assignment operator.

Add an explicitly defaulted default constructor too, since the
explicitly defaulted copy constructor suppresses generation of an
implicit default constructor, and the default constructor is needed.
2022-01-07 04:26:22 +00:00
Kp 223c59c5d4 Inline out object_number_array
Its main purpose is to pre-initialize the underlying std::array.  This
can be done without a separate type.
2022-01-07 04:26:22 +00:00
Kp f84783b95d Use enum class for dlindexnum_t 2022-01-07 04:26:22 +00:00
Kp 2fbddf7a5a Use enum class for tmapinfo_flags 2021-11-01 03:37:20 +00:00
Kp 795b0e9111 Use enum class for station_number 2021-11-01 03:37:20 +00:00
Kp 3e02f99bcd Use enum class for materialization_center_number 2021-11-01 03:37:20 +00:00
Kp eea806bcc9 Pass underlying index_type through zip()
If std::common_type<range::index_type>... finds a common index_type
among all the zipped ranges, pass that common type through as
zip<...>::index_type.  Otherwise, set zip<...>::index_type to void.

This allows enumerate(zip(...))) to report a better index_type.
2021-11-01 03:37:20 +00:00
Kp 29b619db99 Pass random generator to pick_random_point_in_seg 2021-11-01 03:37:20 +00:00
Kp 3da988708e Change Side_opposite value_type to sidenum_t 2021-11-01 03:37:20 +00:00
Kp 6467929025 Consolidate Side_to_verts and Side_to_verts_int
They have been the same variable since
a8c3a7f10b ("Alias Side_to_verts to
Side_to_verts_int").
2021-11-01 03:37:20 +00:00
Kp 9fc7a14777 Fix LTO build of Descent 2
enum game_mode_flags must be visible in common code, which does not
define DXX_BUILD_DESCENT_II.  To avoid One Definition Rule errors,
game_mode_flags must have the same definition in all files.
Fortunately, the DXX_BUILD_DESCENT_II definition is a superset of the
common definition, so the preprocessor guards can be replaced with
advisory comments.

Fixes: 2b718da343 ("Use enum class for Game_mode, Newdemo_game_mode")
2021-11-01 03:37:20 +00:00
Kp 3862edfb6c Use enum class for segment_special 2021-11-01 03:37:19 +00:00
Kp 12a0f8e8e0 Use enum class for wall_state 2021-11-01 03:37:19 +00:00
Kp 76e2f2c6d9 Use enum class for wall_flags 2021-11-01 03:37:19 +00:00
Kp f64ed06a9d Use enum class for wall flag constants 2021-11-01 03:37:19 +00:00
Kp a6f2db2502 Use enum class for player ranking 2021-11-01 03:37:19 +00:00
Kp 8ddfbd17e0 Use enum class for show_kill_list_mode 2021-11-01 03:37:19 +00:00
Kp d22632ac48 Use enum class for msgsend_state 2021-11-01 03:37:19 +00:00
Kp 7cb34fda0c Use enum class for network_game_type 2021-11-01 03:37:19 +00:00
Kp eb7cedc35d Expand macro Current_mission_longname 2021-11-01 03:37:19 +00:00
Kp e69b7bd730 Expand macro Briefing_text_filename 2021-11-01 03:37:19 +00:00
Kp bcc8118dd5 Expand macro Ending_text_filename 2021-11-01 03:37:19 +00:00
Kp 3d878ce04d Expand macro Last_level 2021-11-01 03:37:19 +00:00
Kp e36c4a17ab Expand macro Last_secret_level 2021-11-01 03:37:19 +00:00
Kp 692c09bb7e Expand macro N_secret_levels 2021-11-01 03:37:19 +00:00
Kp 013ef0ded7 Expand macro Secret_level_table 2021-11-01 03:37:19 +00:00
Kp d10406c107 Expand macro Level_names 2021-11-01 03:37:19 +00:00
Kp 72cdb9b0cc Expand macro Secret_level_names 2021-11-01 03:37:19 +00:00
Kp c64d97307c Pass level counts to allocate_levels
Avoid reading them from a global.
2021-11-01 03:37:19 +00:00
Kp 0c34a48418 Move Last_level_path_created to LevelUniqueObjectState.Level_path_created
Change it from the level number on which the path was created to a
true/false flag.  The previous logic only tested whether the number was
equal to the current level number.

This also fixes a bug where the action was not available on the first
secret level, since that level is `-1`, and the value was set to `-1` to
indicate that it should be enabled.
2021-11-01 03:37:19 +00:00
Kp 0fcaa76fd1 Move Next_level_num to local scope
It does not need to be a global.  For each function that uses it, it is
assigned earlier in that same function.
2021-11-01 03:37:19 +00:00
Kp 1a44112907 Remove objnum_local_to_remote wrapper
Always use the form that returns both fields.
2021-11-01 03:37:19 +00:00
Kp 1a08ecc8c6 Remove window subfunction types
These were type safety mechanisms, which are obsolete now that all
window handlers are implemented through virtual function dispatch.
2021-10-13 02:37:51 +00:00
Kp 192988b004 Use enum class for weapon_info::persistent 2021-09-19 10:53:48 +00:00
Kp 21c530a3e2 Use enumerated_array for difficulty-level-specific arrays 2021-09-19 10:53:48 +00:00
Kp 7fc8c736b3 Pass Powerup_info to multi_prep_level_objects, filter_objects_from_level 2021-09-19 10:53:48 +00:00
Kp 4e75f8a933 Pass canvas to scores_view_menu 2021-09-19 10:53:48 +00:00
Kp 855697bf5d Make font scaling constructors explicit 2021-09-19 10:53:48 +00:00
Kp e618851449 Pass canvas to savegame_chooser_newmenu 2021-09-19 10:53:48 +00:00
Kp 07c52f14f9 Save parent canvas in listbox_layout 2021-09-12 16:20:52 +00:00
Kp 8d67bcddb0 Record parent canvas in newmenu
Use it to avoid resetting to the screen canvas when preparing the
layout.
2021-09-12 16:20:52 +00:00
Kp bb29e6fca8 Propagate canvas through more layers 2021-09-12 16:20:52 +00:00
Kp e7aa9855e0 Compute menu border widths from screen canvas instead of screen
In practice, this should be the same result.  However, this allows the
flexibility to use a canvas other than the screen.
2021-09-12 16:20:52 +00:00
Kp 21241471c6 Return string width/height from gr_get_string_size
Use structured bindings to capture the values on return, so that they
can be declared as `const` if they are immutable after initial
computation.
2021-09-12 16:20:52 +00:00
Kp 2fef4cddec Pass canvas to do_cockpit_window_view 2021-09-12 16:20:52 +00:00
Kp bd6612a86b Pass canvas to render_gauges 2021-09-12 16:20:52 +00:00
Kp 4b60205b2f Propagate up show_boxed_message RenderFlag
It is always constant.  Explicitly propagate its effects into callers,
then remove the argument.
2021-09-12 16:20:52 +00:00
Kp df6777c632 Expand game_init_render_buffers inline
It is a single function, to add 2 arguments.  Using a wrapper obfuscates
the logic.
2021-09-12 16:20:52 +00:00