Commit graph

4174 commits

Author SHA1 Message Date
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 b390ce2da0 Use cached canvas in gr_string 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 05905ced06 Pass font to gr_get_string_wrap 2017-02-11 21:42:44 +00:00
Kp 46be18e7f9 Pass canvas to get_centered_x 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
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 0d5d2e77a8 Pass canvas to g3_check_and_draw_poly 2017-02-11 21:42:42 +00:00
Kp 48bf96fe6a Pass canvas to g3_draw_bitmap 2017-02-11 21:42:42 +00:00
Kp e2ed41a90e Pass canvas to render_face 2017-02-11 21:42:42 +00:00
Kp 761c926604 Pass canvas to g3_draw_tmap_2 2017-02-11 21:42:41 +00:00
Kp f279bb8497 Pass canvas to _g3_draw_tmap_2 2017-02-11 21:42:41 +00:00
Kp ac7eac1269 Factor out _g3_draw_tmap_2 lighting checks 2017-02-11 21:42:41 +00:00
Kp f8c2c4958e Pass canvas to draw_outline 2017-02-11 21:42:41 +00:00
Kp c732c35916 Pass canvas to g3_draw_poly 2017-02-11 21:42:41 +00:00
Kp 66ee668e48 Pass canvas to _g3_draw_poly 2017-02-11 21:42:41 +00:00
Kp 85da2c0013 Pass canvas to g3_draw_polygon_model 2017-02-11 21:42:40 +00:00
Kp 0c0026ef1b Pass canvas to g3 interpreters 2017-02-11 21:42:40 +00:00
Kp b7bbe21e4d Add const to interpreter model_bitmaps 2017-02-11 21:42:40 +00:00
Kp 59b57bd7dc Pass canvas to g3_check_and_draw_tmap 2017-02-11 21:42:40 +00:00
Kp cd8f408269 Pass canvas to draw_object_tmap_rod 2017-02-11 21:42:40 +00:00
Kp 394d9e1b80 Pass canvas to g3_draw_rod_tmap 2017-02-11 21:42:40 +00:00
Kp 6a2f3c1321 Pass canvas to g3_draw_tmap 2017-02-11 21:42:39 +00:00
Kp 4791a40007 Pass canvas to _g3_draw_tmap 2017-02-11 21:42:39 +00:00
Kp 5a86bcaeb6 Cache canvas in draw_copyright 2017-02-11 21:42:38 +00:00
Kp 6f81d13c41 Pass canvas to gr_set_curfont 2017-02-11 21:42:38 +00:00
Kp 7ce7ef0ccc Pass canvas to redraw_messagestream 2017-02-11 21:42:38 +00:00
Kp a67e32d9bd Pass canvas to flash_cursor 2017-02-11 21:42:38 +00:00
Kp f88cfd9901 Cache canvas in newmenu_mouse MBTN_LEFT 2017-02-11 21:42:38 +00:00
Kp df538f1e01 Cache canvas in scores_handler EVENT_WINDOW_DRAW 2017-02-11 21:42:37 +00:00