Commit graph

1330 commits

Author SHA1 Message Date
Kp fb53bc9257 Pass canvas to player_dead_message 2017-02-11 21:42:46 +00:00
Kp 05905ced06 Pass font to gr_get_string_wrap 2017-02-11 21:42:44 +00:00
Kp d8638c6c89 Pass canvas to UP_ARROW_MARKER, DOWN_ARROW_MARKER 2017-02-11 21:42:43 +00:00
Kp 6b8f08142f Pass canvas to LINE_SPACING
Macro LINE_SPACING previously used global grd_curcanv implicitly.
Change it to take a canvas argument.  Change all callers to pass
grd_curcanv, so that usage is explicit.
2017-02-11 21:42:42 +00:00
Kp 03c43b1d7f Expand GWIDTH
As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GWIDTH so
that uses of grd_curcanv can be changed individually.
2017-02-11 21:42:42 +00:00
Kp cd8f408269 Pass canvas to draw_object_tmap_rod 2017-02-11 21:42:40 +00:00
Kp 227eb98c3e Pass player_info to do_cockpit_window_view 2017-02-11 21:42:31 +00:00
Kp 1a3d89aecf Use vsegptridx in editor group functions 2017-02-11 21:42:31 +00:00
Kp 7df99350dd Pass player to do_laser_firing_player 2017-02-08 23:34:41 +00:00
Kp 82d10b910c Pass player_info to allowed_to_fire_laser 2017-02-08 23:34:41 +00:00
Kp 98c9374a12 Simplify powerup_grab_cheat_all path
Movement handling has an ugly hack that tries to grab powerups near the
console player, but it reuses general collision handling and fails to
check whether the player is alive.

Add a liveness check.  Place the check so that it happens once, before
the objects are scanned, rather than being needlessly repeated for every
object.

Refactor the collision code to let the movement hack skip the parts it
does not need.

Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/302#issuecomment-275816259>
2017-02-04 23:10:29 +00:00
Kp 59bad96d5f Add back homing weapons cheat for D2
Kreator proposed restoring the Descent 2 cheat that grants homing
capability to all weapons.  This commit implements that proposition,
with some changes to the implementation details.

Based-on-patch-by: Chris Taylor <chris@icculus.org>
Requested-by: Chris Taylor <https://github.com/dxx-rebirth/dxx-rebirth/pull/318>
2017-01-29 21:02:48 +00:00
Chris Taylor 2f4db4a048 Player keeps any keys collected on a secret level even if they die on the secret level 2017-01-29 07:54:43 +08:00
Kp fc12995d89 Add options for reduced-size valptridx error reporting 2017-01-28 18:12:20 +00:00
Chris Taylor 30b5ef7c73 Create robot_create function and use it 4x
Contains 2 calls - to obj_create and init_ai_object. For safety reasons and tidiness compared to using obj_create directly. The call to init_ai_object in recreate_thief was already redundant.
2017-01-22 17:56:50 +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
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
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 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 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 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 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
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
Chris Taylor 4cc801f42f Remove calls to window_close(Game_wind) when game finished or over
Replace calls to window_close(Game_wind) with returning window_event_result::close to game handler. Applies to when DoEndGame() is called, DoGameOver() is called, aborting in the kmatrix screen (multiplayer game) during AdvanceLevel() and playing one demo frame causes playback to stop in GameProcessFrame(). Closing a window within its handler is problematic - it can result in an unstable state.
2017-01-08 21:08:50 +08:00
Kp fe04c3fef6 Initialize obsolete fields
Valgrind warns when writing uninitialized data to a file.  The Descent
savegame format requires writing certain fields that are no longer used.
Set those fields to 0 to prevent leaking stack data into the file.
2017-01-01 23:19:21 +00:00
Kp 879070f814 Fix uninitialized value usage during init_player_stats_new_ship
init_player_stats_new_ship used select_primary_weapon and
select_secondary_weapon to assign the player's weapons.  However, those
functions read the current weapon and jumped according to its value.  A
new ship has no defined value for current weapons, so the jump triggered
an uninitialized value warning from Valgrind.

Add new functions set_primary_weapon, set_secondary_weapon that work
like the previous select_* functions, but always take the path used
for weapons not equal, without checking.  This prevents the warnings
from Valgrind, as well as a theoretical risk of initializing the ship
improperly.
2016-12-25 00:33:25 +00:00
Kp fa1f8488f0 Use uint8_t for sidenum 2016-12-24 22:44:08 +00:00
Kp 47eae7176d Split valptridx declarations
The declaration of valptridx_specialized_types needed to be found by
Argument Dependent Lookup, but this was inconvenient for some types.
Split the declaration of valptridx_specialized_types out from the
definition of valptridx global subtype.
2016-12-24 18:12:17 +00:00
Kp 012238ba14 Fold segnum.h into fwd-segment.h 2016-12-24 18:12:17 +00:00
Kp 29b9c255fa Remove unnecessary FuelCenter operator- 2016-12-22 05:21:16 +00:00
Kp 10aa2e5106 Move some kconfig symbols into namespace dsx 2016-12-22 05:21:16 +00:00
Kp bb6b548540 Remove unused listbox_get_window 2016-12-22 05:21:16 +00:00
Kp 17a50272f0 Pass player_info to more gauges functions 2016-12-11 01:56:43 +00:00
Kp 6fbcef75b1 Pass player object to draw_hud 2016-12-10 17:51:10 +00:00
Kp 442af298cb Pass player_info to allowed_to_fire_missile 2016-12-10 17:51:10 +00:00
Kp 7e6c9fb172 Pass player_info to allowed_to_fire_flare 2016-12-10 17:51:10 +00:00
Kp fe0c97ebb9 Move Player_eggs_dropped to player_info 2016-12-10 17:51:09 +00:00
Kp c7634a1923 Move Auto_fire_fusion_cannon_time to player_info 2016-12-10 17:51:09 +00:00
Kp 51b06f6cdc Move Fusion_charge to player_info
This eliminates some ugly hacks regarding remotely generated fusion
shots.
2016-12-10 17:51:09 +00:00
Kp 117e205ff0 Fold spreadfire calls to Laser_player_fire_spread 2016-12-10 17:51:09 +00:00
Kp 4cec1910e2 Propagate scores_maybe_add_player argument 2016-12-10 17:51:08 +00:00
Kp 1f434f98ad Use valptridx for ActiveDoors 2016-12-10 17:51:08 +00:00
Kp 65b05638cc Switch MAX_REACTORS from #define to constexpr 2016-12-10 17:51:08 +00:00