Commit graph

3466 commits

Author SHA1 Message Date
Kp 7410ad343c Pass canvas to render_mine 2017-03-10 01:22:28 +00:00
Kp 8542940b24 Pass canvas to render_frame 2017-03-10 01:22:27 +00:00
Kp 7e1ba509ff Cache canvas in init_cockpit 2017-03-10 01:22:27 +00:00
Kp 393e96b8d8 Unify SDL/OGL save_screen_shot
This simplifies maintenance and reduces the potential for inconsistency.
It also cleans up one existing inconsistency.
2017-03-10 01:22:27 +00:00
Chris Taylor 38250ce76f Make sure D1 type bosses in D2 play looping sound on save game load
D1 bosses in D2 can teleport after 0.58.1.
2017-03-05 08:32:06 +08:00
Kp 2fae106945 Reindent FireLaser fusion handling to quell -Wmisleading-indentation
The code was correct as-is, but gcc-6 warns.  Reindent to eliminate the
warning.
2017-03-04 22:25:54 +00:00
Kp a8c3a7f10b Alias Side_to_verts to Side_to_verts_int 2017-03-04 22:25:54 +00:00
Kp f03fee7eca Fix ordering of boss weapon collision test
Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/332>
Fixes: 1f929796c3 ("Fix excess fusion reflection")
2017-03-04 22:25:54 +00:00
Kp 986c76e00f Merge branch select_missile into master 2017-03-02 02:45:31 +00:00
Chris Taylor 6670d8c203 Save secondary weapons flags for 0.58.1 compatibility
Set secondary weapon flags to appropriate values when saving game, so that if it's loaded with 0.58.1 or earlier the player can actually select all secondary weapons they have at least one of (while not causing side effects with demo data). Fixes issue referred to in comment https://github.com/dxx-rebirth/dxx-rebirth/issues/291#issuecomment-282528356
2017-03-01 14:15:38 +08:00
Kp cebd2fd36d Pass object &to boss_init_all_segments
The index is not needed.
2017-03-01 02:48:41 +00:00
Kp b5294784db Pass object &to init_boss_segments
init_boss_segments no longer needs to save and restore the boss position
and size.  Remove that, and switch the pointer to `const object &` to
enforce it.
2017-03-01 02:48:40 +00:00
Kp 482dcf0ba3 Avoid temporarily moving boss while probing layout
Expose sphere_intersects_wall and call it directly from
boss_fits_in_seg, so that boss_fits_in_seg does not need to modify the
position and segment of the boss during the test.
2017-03-01 02:48:40 +00:00
Chris Taylor c2ea427f79 Don't teleport to original segment if boss won't fit
Unless there are no other segments. Fixes issue #329.
2017-02-27 18:43:24 +08:00
Chris Taylor 19e4c07bb0 Bosses generated by a robot maker or even released by another robot will now teleport
Fixes issue #328.
2017-02-26 10:21:10 +08:00
Chris Taylor 32286ed4fc Play boss looping immediately on loading saved game
If boss has teleported before, even before a loaded state was saved, play the boss looping sound immediately when loading the saved game (if near the boss). Resolves issue #326.
2017-02-26 10:21:10 +08:00
Kp ba914fea81 Pass up various return values 2017-02-26 00:00:02 +00:00
Kp 673baa15e9 Clear FakingInvul when enabling real invulnerability 2017-02-26 00:00:01 +00:00
Kp 8a89313ec4 Move compute_segment_center body to dcx 2017-02-22 03:05:44 +00:00
Kp 892d450022 Move compute_center_point_on_side body to dcx 2017-02-22 03:05:43 +00:00
Kp df54e345fe Remove write-only fvi_hit_seg 2017-02-22 03:05:43 +00:00
Kp 08e4a6e620 Use stdint constants for some INT*_MAX
clang becomes confused trying to determine which vm_distance_squared
constructor to use for a literal input of 0x7fffffffffffffff, even
though the size of the input requires it to be `long` and only one
constructor can take a `long`.  Switch from an explicit
0x7fffffffffffffff to the symbolic constant INT64_MAX, which has the
same value, but a platform-appropriate suffix to force the compiler to
pick the right type.

For general clarity, switch some other instances of integer maximum
literals to symbolic constants of the same value.

This commit has no effect on the generated code (except for changes to
line numbers).

Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/324>
Fixes: 17208cca79 ("Disallow int for vm_distance_squared")
2017-02-22 03:05:43 +00:00
Chris Taylor 05b8cc4897 Exit GameProcessFrame() when game over
After getting game over, playing a demo would result in the 'Game Over' banner being shown. When loading a saved game, it would fail an assert when trying to obj_delete a NULL Dead_player_camera in dead_player_end().
2017-02-20 08:04:55 +08:00
Chris Taylor b17a9f8550 start_time() time when game over
After getting game over, the game would be stopped when playing a demo or loading a saved game. This is now fixed.
2017-02-20 08:04:55 +08:00
Kp dc090958d1 Reduce D1 spreadfire cost
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/322>
Analyzed-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/322#issuecomment-280896375>
Fixes: 10ff2b9ea2 ("Change Primary_weapon_to_weapon_info key to weapon_id_type")
2017-02-19 19:33:45 +00:00
Kp 6cd6189681 Never pass nullptr to ai_door_is_openable
When objp is nullptr, ai_door_is_openable assumes Buddy_objnum is a
valid object number, but this assumption is not guaranteed to be true.
When it is false, the game crashes.  This crash can be triggered by a
brain robot trying to make nearby robots snipe.

Fix the crash by passing the robot of interest.

Reported-by: Yarn <http://www.dxx-rebirth.com/frm/index.php/topic,2165.0.html>
2017-02-19 19:33:45 +00:00
Kp 859b399d20 Use mask for Secondary_last_was_super 2017-02-19 19:33:45 +00:00
Kp aeb452f715 Fold do_weapon_n_item_stuff toggle sound 2017-02-19 19:33:44 +00:00
Kp 7c658fd8cd Use mask for Primary_last_was_super 2017-02-19 19:33:44 +00:00
Kp 16dde117fd Reduce scope of state_restore_all_sub j 2017-02-19 19:33:44 +00:00
Kp a6cd87613c Pass polymodel &to free_model 2017-02-19 19:33:44 +00:00
Kp 1a7659897a Pass canvas to draw_model_picture 2017-02-19 19:33:44 +00:00
Kp b02e2e9a3a Use range_for in draw_polygon_model 2017-02-19 19:33:44 +00:00
Kp 39071d124d Pass canvas to draw_polygon_model 2017-02-19 19:33:43 +00:00
Kp 92d1637b5a Pass canvas to show_time 2017-02-19 19:33:43 +00:00
Kp 91a3e0f27a Pass canvas to sb_show_lives 2017-02-19 19:33:43 +00:00
Kp 8a6be6e17f Pass canvas to hud_show_lives 2017-02-19 19:33:43 +00:00
Kp 0aaf425dab Pass canvas to hud_show_shield 2017-02-19 19:33:43 +00:00
Kp 34895edc52 Pass canvas to hud_show_cloak_invuln 2017-02-19 19:33:43 +00:00
Kp 13e9a38c7b Pass canvas to hud_show_weapons 2017-02-19 19:33:42 +00:00
Kp 16718be160 Pass canvas to hud_show_secondary_weapons_mode 2017-02-19 19:33:42 +00:00
Kp ecf53f967d Pass canvas to hud_show_primary_weapons_mode 2017-02-19 19:33:42 +00:00
Kp bbfe38cecc Pass canvas to hud_printf_vulcan_ammo 2017-02-19 19:33:42 +00:00
Kp 4206c68f44 Pass canvas to hud_set_vulcan_ammo_fontcolor 2017-02-19 19:33:42 +00:00
Kp 3eb84e9dd2 Pass canvas to hud_set_secondary_weapon_fontcolor 2017-02-19 19:33:42 +00:00
Kp 499ac14241 Pass canvas to hud_set_primary_weapon_fontcolor 2017-02-19 19:33:41 +00:00
Kp d5a197e7f3 Pass canvas to draw_primary_ammo_info 2017-02-19 19:33:41 +00:00
Kp ddb5f1c6ce Pass canvas to draw_secondary_ammo_info 2017-02-19 19:33:41 +00:00
Kp e4848e09ef Pass canvas to draw_ammo_info 2017-02-19 19:33:41 +00:00
Kp 51488e446f Pass canvas to show_bomb_count 2017-02-19 19:33:41 +00:00
Kp b45de8592a Pass canvas to hud_show_homing_warning 2017-02-19 19:33:41 +00:00
Kp 0e1a670694 Pass canvas to sb_show_score_added 2017-02-19 19:33:41 +00:00
Kp 1ebfb6c6e5 Cache canvas in draw_keys_state 2017-02-19 19:33:40 +00:00
Kp 4b1c0f4198 Combine draw_keys_state subtypes 2017-02-19 19:33:40 +00:00
Kp 205b9ddae4 Pass multires_gauge_graphic to HUD_SCALE_X_AR, HUD_SCALE_Y_AR 2017-02-19 19:33:40 +00:00
Kp e3699252f7 Pass multires_gauge_graphic to HUD_SCALE_X, HUD_SCALE_Y 2017-02-19 19:33:40 +00:00
Kp c64152fe79 Pass multires_gauge_graphic to BASE_WIDTH, BASE_HEIGHT 2017-02-19 19:33:40 +00:00
Kp 463fe1f643 Pass canvas to sb_show_score 2017-02-19 19:33:40 +00:00
Kp 7c25caafa6 Pass canvas to hud_show_score_added 2017-02-19 19:33:39 +00:00
Kp 19318b7e74 Pass canvas to hud_show_timer_count 2017-02-19 19:33:39 +00:00
Kp 960ba8a9d2 Pass canvas to hud_show_score 2017-02-19 19:33:39 +00:00
Kp 530856f909 Pass canvas to hud_gauge_bitblt 2017-02-19 19:33:39 +00:00
Kp d0bc9c1703 Pass canvas to hud_bitblt 2017-02-19 19:33:39 +00:00
Kp d98a18583b Pass canvas to hud_bitblt_free 2017-02-19 19:33:39 +00:00
Kp 1e13617c3e Pass canvas to hud_show_afterburner 2017-02-19 19:33:39 +00:00
Kp 4947779952 Pass canvas to hud_show_energy 2017-02-19 19:33:38 +00:00
Kp fbd02b5fbe Factor out template functor of create_vertex_lists_by_predicate 2017-02-19 19:33:38 +00:00
Kp b918760b3f Move find_connect_side body to dcx 2017-02-19 19:33:38 +00:00
Kp b82d9d2b51 Move get_side_verts body to dcx 2017-02-19 19:33:38 +00:00
Kp 9821a77372 Simplify use of get_num_faces 2017-02-19 19:33:38 +00:00
Kp cdb193c053 Use unsigned for sides/verts in more places 2017-02-19 19:33:38 +00:00
Kp 0f00cf51b0 Make segment vertices unsigned 2017-02-19 19:33:37 +00:00
Kp 3e51705de6 Shorten get_verts_for_normal 2017-02-19 19:33:37 +00:00
Kp 0202765322 Simplify create_walls_on_side 2017-02-19 19:33:37 +00:00
Kp c0fc6aa419 Factor out side normal initialization 2017-02-19 19:33:37 +00:00
Kp b2ca2e35df Fold add_side_as_2_triangles temporaries 2017-02-19 19:33:37 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
zico b36c6f20c7 Made scrape_player_on_wall() based on a timer. Due to the player being pushed away from the lava/water surface in every frame in a random vector (wrong, too), player movement per frame was not enough to counter this on FPS rates > ~120 which made damage scaling per frame nonsensical in these situations. Instead, execute scrape results in intevals based on DESIGNATED_GAME_FRAMETIME (or per frame if FrameTime>DESIGNATED_GAME_FRAMETIME) which fixes the issues and generally works much better for the purpose of this function. 2017-02-13 11:00:21 +01:00
Kp 569d64e927 Propagate Hack_DblClick_MenuMode 2017-02-11 21:42:47 +00:00
Kp 3de4a0b3e0 Cache canvas in show_netplayerinfo 2017-02-11 21:42:46 +00:00
Kp b116939ace Cache canvas in con_draw 2017-02-11 21:42:46 +00:00
Kp aadf18e694 Cache canvas in draw_automap 2017-02-11 21:42:46 +00:00
Kp fb53bc9257 Pass canvas to player_dead_message 2017-02-11 21:42:46 +00:00
Kp 00492073d2 Pass canvas to render_countdown_gauge 2017-02-11 21:42:45 +00:00
Kp 2ee8e31f9f Pass canvas to draw_window_label 2017-02-11 21:42:45 +00:00
Kp 1327dd7de6 Pass canvas to show_framerate 2017-02-11 21:42:45 +00:00
Kp 6c83d56219 Pass canvas to game_draw_marker_message 2017-02-11 21:42:45 +00:00
Kp 5fcbc44c7f Pass canvas to game_draw_multi_message 2017-02-11 21:42:45 +00:00
Kp 5736804a23 Fold gr_set_curfont calls in credits_handler 2017-02-11 21:42:45 +00:00
Kp 5f855437ed Pass canvas to name_frame 2017-02-11 21:42:45 +00:00
Kp a23f33a34d Pass canvas to draw_player 2017-02-11 21:42:44 +00:00
Kp 9ad724f32f Pass canvas to DrawMarkers 2017-02-11 21:42:44 +00:00
Kp 24c4a030a1 Pass canvas to DrawMarkerNumber 2017-02-11 21:42:44 +00:00
Kp 0fd80b12df Prevent out-of-bounds read when sorting segment sides
GCC 6 `std::sort` sometimes compares an element to itself.  For a normal
implementation of comparison, this is useless, but not harmful.  The
render comparison predicate relies on accessing A[B[a][b]] when
comparing `a` and `b`.  Array `B` has `-1` in positions where `a == b`,
which causes an access to `A[-1]`, which is undefined behavior.  This
crashes when using _GLIBCXX_DEBUG:

    Error: attempt to subscript container with out-of-bounds index -1, but
    container only holds 8 elements.

    Objects involved in the operation:
	sequence "this" @ 0x0x335adf0 {
	  type = std::__debug::array<int, 8ul>::_Array_check_subscript<8ul>;
	}

Since this is undefined behavior, non-debug builds might also misbehave.
Current data layouts make it likely that the failure would not have
externally observable consequences.

Prevent the invalid access by short-circuiting the result if `a == b`.
2017-02-11 21:42:43 +00:00
Kp ceb510566f Avoid passing reference to null weapon_object
Rebirth built with `gcc -fsanitize=undefined` warns when binding a
reference to nullptr, even if that reference is never followed.  This
could be reproduced using a guided missile against the first PIG in
Descent 2: Counterstrike level 1.

This object pointer is used only to test for address equality, so
nullptr is safe here.  Switch to pass it as a pointer to prevent the
warning.
2017-02-11 21:42:43 +00:00
Kp 40f5ad42d1 Use PUT_INTEL_INT to handle alignment when updating bitmap size 2017-02-11 21:42:43 +00:00
Kp 17208cca79 Disallow int for vm_distance_squared 2017-02-11 21:42:43 +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 ed9fe62d85 Expand GHEIGHT
As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GHEIGHT so
that uses of grd_curcanv can be changed individually.
2017-02-11 21:42:42 +00:00