Commit graph

2611 commits

Author SHA1 Message Date
zico 320b5aa8f0 Fixed regression from bbda32f78d8f227785fe294b5a9786724611d370: Due to GR_FADE_LEVELS being unsigned if statements in draw_player_ship() broke regarding the cloak fade levels. Fixed by some casts. 2016-06-13 14:43:04 +02:00
zico 64f77636a7 When using rapidfire cheat in Descent 1, only grant weapons if cheat toggles on. Also give Rapidfire HUD msg like in Descent II to make clear the state of the cheat. Additional formatting love for lighting debug key to calm GCC's warnings. 2016-06-13 13:24:38 +02:00
Kp 1b12a3f7ef Add parentheses around target of more complicated casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of some C casts.

This pass attempts to process expressions that involve parenthesized or
bracketed subexpressions, but only if those subexpressions do not
themselves contain parenthesized or bracketed subexpressions.

	(int) f(1);	// changed
	(int) f(g());	// not changed

perl -p -i -e 's/(\(\s*((?:un)?signed|int|char|short|long|float|double|s?size_t|(?:u?int[[:digit:]]+_t))\s*\**\s*\)\s*)([&+-]?)([[:alnum:]_.]+\s*->\s*)*([[:alnum:]_.]+)((?:\s*(?:\[[^][]*\])*|(?:\([^()]*\))*))(\s*([;+>*\/^%,|&<>])|$|(\s*-\s*[^>]))/\1\(\3\4\5\6\)\7/g'
2016-06-12 03:45:37 +00:00
Kp 6fc1730770 Convert piggy cast to reinterpret_cast 2016-06-12 03:45:37 +00:00
Kp bc30ccd216 Rewrite cast of (sbyte) to standard type int8_t
s/(sbyte)\s*\(\w\)/(int8_t) \1/g
2016-06-12 03:45:37 +00:00
Kp 478a48ddc1 Fix vulcan ammo object tests
Object numbers are unsigned short, not signed short.  If anyone ever
raises the object limit high enough, testing for negative values would
blacklist valid objects.

Remove unnecessary test for objnum!=object_none.  If it were none,
constructing `obj` would have failed.
2016-06-12 03:45:37 +00:00
Kp 5b437592b0 Simplify test for vulcan|gauss 2016-06-12 03:45:36 +00:00
zico 84f254e2f2 Another addendum to 3366658a5bd2b30a82949b8b301e97b324ce539d: Don't make ngii static anymore (forgot to change this). 2016-06-06 17:29:21 +02:00
zico 7684ce92e4 Added packet to notify clients about a changed vulcan ammo count in a weapon powerup in case player collects ammo but leaves the gun itself. 2016-06-06 17:26:59 +02:00
zico 416ea963c8 When building D2X, before dropping Vulcan ammo check for presence of Gauss cannon, too. 2016-06-06 15:43:38 +02:00
Kp 9283c2f0c3 Improve Error reporting on texmerge consistency failure 2016-06-05 18:45:21 +00:00
Kp 3918db41ff Factor out common texture merge code 2016-06-05 18:45:20 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\*\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp ebebda5f17 Fix piggy casts when sizeof(size_t) is not sizeof(void*) 2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp badf0f4f90 Rewrite cast of (uint*) to standard type uint32_t
s/(\s*uint\s*\*\s*)/(uint32_t *)/g
2016-06-05 01:04:25 +00:00
Kp aeebffccc0 Rewrite cast of (ushort*) to standard type uint16_t
s/(\s*ushort\s*\*\s*)/(uint16_t *)/g
2016-06-05 01:04:25 +00:00
Kp b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00
zico 660d18c312 Check for GM_MULTI together with Netgame.InvulAppear in init_player_stats_new_ship(). Otherwise going into Singleplayer after starting a Multiplayer match with this option set can translate this effect into Singleplayer. 2016-05-30 15:00:07 +02:00
zico e335cdacb3 Reverted 81d7db279b and rather removed the terminator byte from string length in nm_set_item_input(). This also fixes possible 9 character length for pilot callsigns. Had to fix up COOL_SAYING_LEN as it was not considering the termintor but considering the original D2 source, this was a mess to begin with (def = 50, text string = 60, input field len = 45). Made score saying 50 characters as this seems to be the maximum witdth without overlapping. 2016-05-30 14:54:51 +02:00
zico 1856e73ca6 Addition to 3366658a5bd2b30a82949b8b301e97b324ce539d: Changed show_netgame_info and pass netgame as reference and const; removed struct and extern; declared ngii inside show_netgame_info(). 2016-05-30 13:49:06 +02:00
zico a8ed0aaa9c Added breaks in event.cpp to prevent unwanted events if -nomouse and/or -nojoystick is given; Added automap_apply_input() to prevent multiple inputs per frame causing multiple movement applications. 2016-05-30 13:17:42 +02:00
Kp f073e9e377 Fold nm_messagebox call in net_udp_do_join_game 2016-05-28 17:31:27 +00:00
Kp 82a8f6ebb0 Pass bm_mode to gr_init_bitmap 2016-05-28 17:31:27 +00:00
Kp dcc56e6b39 Propagate bm_mode::linear into iff_read_bitmap 2016-05-28 17:31:27 +00:00
Kp c00f918a8e Propagate bm_mode::linear into bald_guy_load 2016-05-28 17:31:26 +00:00
Kp 3fb16c1d7a Propagate bm_mode::linear into pcx_read_bitmap 2016-05-28 17:31:26 +00:00
Kp 398596c468 Use enum for bitmap mode 2016-05-28 17:31:26 +00:00
Kp 7d468491a1 Fix -Wshadow warnings in mission.cpp 2016-05-22 17:49:32 +00:00
Kp e3eceb2c6e Fix -Wshadow warnings in load_mission 2016-05-22 17:49:31 +00:00
Kp 9f76e9e97a Fix -Wshadow warnings in init_boss_segments 2016-05-22 17:49:31 +00:00
Kp 688b376a90 Fix -Wshadow warnings in write_wall_text 2016-05-22 17:49:30 +00:00
Kp 0cae71b8a6 Fix -Wshadow warnings in draw_model 2016-05-22 17:49:30 +00:00
Kp 994225c188 Use array<> for dumpmine arrays 2016-05-22 17:49:30 +00:00
Kp f0dcd47b5c Fold determine_used_textures_level call to load_level 2016-05-22 17:49:30 +00:00
Kp 9d0c6f59a5 Remove always-zero piggy_page_flushed
Descent for DOS supported paging content on demand.  Rebirth has no
support for paging content out, but retained piggy_page_flushed
to track whether anything had been paged out.  Commit 3c20c24 ("Disable
piggy_bitmap_page_out_all") removed the last site that could set
piggy_bitmap_page_out_all to a non-zero value.  All remaining code
either tests it for non-zero or sets it to zero.

Remove the statements that set it to zero.
Remove assertions that the value is zero.
Remove conditional blocks that execute only when it is non-zero.
2016-05-22 17:49:30 +00:00
Kp 7e3ea961c1 Pass object_base &to draw_player 2016-05-21 17:24:51 +00:00
Kp c61a3d5e0f Fix -Wshadow warnings in do_ai_frame 2016-05-21 17:24:51 +00:00
Kp dbae87a0a1 Fix -Wshadow warnings in load_game_data 2016-05-21 17:24:51 +00:00
Kp eca671b2f8 Fix -Wshadow warnings in show_netplayerinfo 2016-05-21 17:24:51 +00:00
Kp f87819b359 Fix -Wshadow warnings in newdemo_strip_frames 2016-05-21 17:24:51 +00:00
Kp f2f7cb7e96 Fix -Wshadow warnings in newdemo_playback_one_frame 2016-05-21 17:24:51 +00:00
Kp 4a04d26c17 Fix -Wshadow warnings in newdemo_goto_end 2016-05-21 17:24:51 +00:00
Kp 9c4448f78c Fix -Wshadow warnings in RAIIsocket::closesocket 2016-05-21 17:24:51 +00:00
Kp 6de7046226 Fix -Wshadow warnings in net_udp_setup_game 2016-05-21 17:24:51 +00:00
Kp 6ce7cd4ec5 Fix -Wshadow warnings in draw_player 2016-05-21 17:24:51 +00:00
Kp ebc9d55b90 Fix -Wshadow warnings in draw_automap 2016-05-21 17:24:51 +00:00
Kp 97f38bf01d Fix -Wshadow warnings in draw_all_edges 2016-05-21 17:24:51 +00:00
Kp c7940d12f9 Fix -Wshadow warnings in load_exit_models 2016-05-21 17:24:51 +00:00