Commit graph

879 commits

Author SHA1 Message Date
Kp 706a704c6d Move unique_side to unique_segment 2018-12-13 02:31:38 +00:00
Kp 5a64ee5132 Add experimental support for larger cooperative games
- Raise the player limit to 8.
- Remove the logic that forces player counts up/down when switching
  between cooperative and deathmatch game modes.
- Add heuristics to add start positions for the extra players, since
  standard maps will not have the required number of starts.
2018-12-03 04:25:11 +00:00
Kp 3b168b38fd Make Viewer const object *
Viewing should not change anything.
2018-09-25 03:44:09 +00:00
Kp 406be26de4 Pass d_level_shared_segment_state to validate_segment_all 2018-09-19 02:13:30 +00:00
Kp f7ad4d9b1a Pass segments to find_point_seg 2018-09-19 02:13:30 +00:00
Kp 1527785efd Pass vertex factory to validate_segment_side 2018-09-19 02:13:29 +00:00
Kp d71938e1a7 Pass vertex factory to create_walls_on_side 2018-09-19 02:13:29 +00:00
Kp bd58d5f825 Pass vertex factory to extract_*_vector_from_segment 2018-09-19 02:13:29 +00:00
Kp 01512015a8 Move Num_segments to new d_level_shared_segment_state 2018-09-19 02:13:29 +00:00
Kp c56223ced4 Eliminate more uses of valptridx::operator-> 2018-09-19 02:13:29 +00:00
Kp c4cb930f8e Pass ObjectState to obj_delete 2018-09-09 01:00:39 +00:00
Kp ec1cf005b6 Enable -Wformat-truncation
Add macro cf_assert ("control flow" assert) to hint to gcc that certain
conditions are impossible.  Use it to avoid generating range checks for
situations that never happen.  If the event did happen, the only
consequence would be truncated UI text, rather than a correctness
problem.
2018-08-26 18:10:36 +00:00
Kp bba8a327a0 Remove use of -Wno-implicit-fallthrough 2018-08-24 02:58:21 +00:00
Kp 36ada21c0c Fold exploding walls into regular walls 2018-08-12 21:08:07 +00:00
Kp 30a83eec41 Eliminate some uses of valptridx::operator-> 2018-06-24 05:06:15 +00:00
Kp 0fd7e0e4ce Pass context arrays to WALL_IS_DOORWAY 2018-06-24 05:06:15 +00:00
Kp 3408e3a0cd Switch to shared_segment arguments where possible 2018-06-24 05:06:15 +00:00
Kp 20caecfa0e Eliminate most uses of segment * 2018-06-24 05:06:15 +00:00
Kp fb68e7f9ec Eliminate use of side * 2018-06-24 05:06:15 +00:00
Kp 0c3e99f14c Split side uses based on shared vs unique 2018-06-24 05:06:15 +00:00
Kp 98e6b36145 Pass shared_segment for some segment I/O 2018-06-24 05:06:15 +00:00
Kp 2de3a1dd06 Pass unique_segment to objects_in 2018-06-24 05:06:14 +00:00
Kp 6d0d68d188 Split some segment uses based on shared vs unique
Leave `sides` in `shared_segment` to minimize churn.  Parts of it must
move to `unique_segment` before this project finishes.
2018-06-24 05:06:14 +00:00
Kp e3d42913a4 Remove always-disabled editor/segment.cpp code
Various functions are preprocessor-excluded by `BOTTOM_STUFF`, which has
been 0 since btb added it in a196e6d554
(October 2001).  It seems unlikely that anyone will miss it.
2018-06-20 04:16:06 +00:00
Kp f51b7b6b20 Enforce separation of font X/Y scaling 2018-06-08 04:04:05 +00:00
Kp d355ef4030 Pass font to various drawing functions 2018-05-19 23:21:42 +00:00
Kp 08446f0ab6 Pass font to gr_string,gr_printf 2018-05-19 23:21:42 +00:00
Kp 926a7f2a92 Remove useless const qualifier on meddraw static_cast
gcc-8 warns that static_cast<const T>(var) is useless.  Remove the const
qualifier.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/388>
2018-05-05 22:33:56 +00:00
Kp e8645b2062 Pass vertex factory to compute_center_point_on_side 2018-03-12 03:43:47 +00:00
Kp 53a1d5f9ce Pass vertex factory to compute_segment_center 2018-03-12 03:43:47 +00:00
Kp ad8fd0f871 Pass valptridx factories to obj_relink 2018-03-12 03:43:46 +00:00
Kp b63633db51 Move num_objects into d_level_object_state 2018-03-12 03:43:46 +00:00
Kp 2b058c7150 Treat OpenBSD as Linux for msgbox handling
Requested-by: thfrwn <https://github.com/dxx-rebirth/dxx-rebirth/pull/359>
2017-12-24 00:28:35 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp 09963e8b5a Remove write-only Seg_scale 2017-11-05 20:49:09 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp 6043168d51 Move various SDL-only texture mapping functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various texture mapping
functions.  Move these to be built only for the SDL build.
2017-11-01 02:01:21 +00:00
Kp 5d4d3347e6 Remove unused found_poly 2017-11-01 02:01:20 +00:00
Kp 8d80300e0a Remove obsolete D1 hostage editor code
This code was part of a feature abandoned before retail.  It cannot be
usefully used in campaigns.  Remove it to reduce code size and simplify
later changes.
2017-10-14 17:10:31 +00:00
Kp 96bc6f2047 Use enumerate for medrobot AI mode boxes 2017-10-14 17:10:31 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp 2665869c24 Mark editor groups broken
Editor groups write `struct segment` to a file in raw form, but had no
code to enforce that this raw form remained stable over time.  Various
changes to `struct segment` have repeatedly changed its internal
structure.  Each change created an incompatible dialect of the editor
group file, and all the dialects share the same version number.

According to
```
git log -p -L'/struct segment {/,/};/:common/main/segment.h' HEAD --not 0.58.1-d1x 0.58.1-d2x --
```
`struct segment` changed layout in:

* d1c6b89f17 ("Move dsx::segment -> dcx::segment")	[D1 only]
* 596ecbb38d ("Rename segment::value to segment::station_idx")	[D1 only]
* 6f10a67c09 ("Move segment::sides to end")
* c53b734abb ("Compute slide segments early")	[D2 only]
* 40e90fea22 ("Move Light_subtracted[] to Segments[].light_subtracted")
* a65d774c83 ("Improve packing of struct segment")
* c70c6c98b3 ("Remove obsolete segment::degenerated flag")

Mark editor groups as broken to avoid making the mess worse.  If anyone
cares about group support, it needs to be rewritten not to depend on the
internal layout of `struct segment`.
2017-09-30 18:00:15 +00:00
Kp 4cfd5f3324 Pass canvas to menubar_init 2017-09-26 04:15:50 +00:00
Kp b5b5cbd4d7 Pass canvas to meddraw draw_listed_segments 2017-08-26 19:47:51 +00:00
Kp 9e917e4c7d Pass canvas to meddraw draw_segment 2017-08-26 19:47:51 +00:00
Kp d81e7862f0 Pass canvas to meddraw draw_line 2017-08-26 19:47:51 +00:00
Kp aa56477742 Propagate objects_in arguments 2017-08-13 20:38:31 +00:00
Kp b4899aafac Pass vcvertptr to get_seg_masks 2017-08-11 23:43:54 +00:00
Kp 5eec2a5ce5 Use valptridx for Vertices 2017-08-11 23:43:54 +00:00
Kp 596ecbb38d Rename segment::value to segment::station_idx
`value` is generic and unclear.  It is always meant to be used as an
index into the Station array, so rename it `station_idx` to show this.

Define and consistently use `station_none` to represent that no station
is assigned.
2017-07-08 18:17:49 +00:00
Kp 73d92bb509 Make wclip::num_frames uint16_t 2017-06-17 23:05:16 +00:00
Kp ab98ba6677 Indent medlisp_update_screen test to silence -Wmisleading-indentation
This commit makes only whitespace changes.
2017-06-10 03:31:04 +00:00
Kp c25041fb41 Use array<> for editor Views 2017-06-10 03:31:04 +00:00
Kp 7b16571cb2 Rename countarray method count -> size 2017-06-10 03:31:03 +00:00
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp b0cb681ae7 Add gcc-7 /*-fallthrough*/ comments for obvious cases
For switch cases where existing comments or code flow logic obviously
intended to fall through, add a gcc-7 /*-fallthrough*/ comment to
silence warnings about this.  Some cases which are less obvious are not
converted, so the code does not yet compile clean with
-Wimplicit-fallthrough.

Reported-by: parkerlreed <https://github.com/dxx-rebirth/dxx-rebirth/issues/338>
2017-06-07 02:44:54 +00:00
Kp af55ba08cc Pass grs_canvas &to draw_object_picture 2017-04-30 16:25:16 +00:00
Kp 1a1e669bc6 Pass vms_angvec &to draw_model_picture 2017-04-30 16:25:16 +00:00
Kp 719de35484 Pass grs_bitmap to gr_pixel 2017-03-11 19:56:23 +00:00
Kp c725a6cb88 Pass canvas to gr_init_font 2017-03-11 19:56:22 +00:00
Kp 8542940b24 Pass canvas to render_frame 2017-03-10 01:22:27 +00:00
Kp 81cc81a6de Remove dead call to gr_set_curfont in init_editor 2017-03-10 01:22:27 +00:00
Kp 4d21fb8860 Pass canvas to init_editor_screen 2017-03-10 01:22:27 +00:00
Kp 1b8e6f5059 Cache canvas in print_status_bar 2017-03-10 01:22:27 +00:00
Kp e6878e883c Cache canvas in info_display_all 2017-03-10 01:22:26 +00:00
Kp 4a7a6663d5 Pass canvas to info_display_default 2017-03-10 01:22:26 +00:00
Kp c708d30ca4 Pass canvas to info_display_segsize 2017-03-10 01:22:26 +00:00
Kp 8708f53177 Pass canvas to info_display_object_placement 2017-03-10 01:22:26 +00:00
Kp b0f23ed7b1 Pass canvas to clear_pad_display 2017-03-10 01:22:26 +00:00
Kp 634079cfce Cache canvas in eswitch.cpp 2017-03-10 01:22:26 +00:00
Kp c786e34ec7 Factor out scale_free_verts calls in med_scale_segment_new 2017-03-10 01:22:24 +00: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
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
Kp 1a7659897a Pass canvas to draw_model_picture 2017-02-19 19:33:44 +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 0d5d2e77a8 Pass canvas to g3_check_and_draw_poly 2017-02-11 21:42:42 +00:00
Kp 6f81d13c41 Pass canvas to gr_set_curfont 2017-02-11 21:42:38 +00:00
Kp 590a025a89 Pass canvas to g3_start_frame 2017-02-11 21:42:34 +00:00
Kp 80e7ade6a1 Pass canvas to g3_draw_sphere 2017-02-11 21:42:33 +00:00
Kp 513e7ceceb Pass canvas to g3_draw_line 2017-02-11 21:42:33 +00:00
Kp ae33aaafc1 Pass canvas to gr_set_fontcolor 2017-02-11 21:42:32 +00:00
Kp d1657ba269 Make canvas an explicit argument to gr_uprintf
Previously, a macro implied *grd_curcanv as the canvas.  Pass the canvas
explicitly so that callers can choose the canvas to use.
2017-02-11 21:42:32 +00:00
Kp 3fb0367423 Use range_for in duplicate_group 2017-02-11 21:42:31 +00:00
Kp 1a3d89aecf Use vsegptridx in editor group functions 2017-02-11 21:42:31 +00:00
Chris Taylor e9b0ca9a83 Don't decrement trigger in remove_trigger_num if it's trigger_none
Fixes a crash when loading a level with redundant triggers and editor enabled, e.g. Passion of Death.
2017-01-30 11:08:58 +08: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 6da2b446f5 Use range_for in editor/group.cpp 2017-01-21 19:05:42 +00: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 5da784dbed Pass canvas to gr_{,u}string 2017-01-08 22:32:00 +00: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 b7c41a0d98 Remove calls to window_close(Game_wind) within close_editor
These are redundant. Will remove all cases of window_close(Game_wind) - it's safer for the handler to return window_event_result::close.
2017-01-08 21:03:41 +08:00
Kp 22e364e030 Pass canvas to gr_clear_canvas 2017-01-01 00:45:45 +00:00
Kp 0905aefa0a Pass canvas to gr_rect 2017-01-01 00:45:45 +00:00
Kp c3c4ab8e3e Pass canvas to gr_box 2017-01-01 00:45:44 +00:00
Kp 08d0aa9b59 Pass canvas to gr_bitmap 2016-12-29 03:27:13 +00:00
Kp 6ab3b18657 Pass canvas to gr_ubitmap 2016-12-29 03:27:12 +00:00
Kp 1fa5aef9ac Pass canvas to gr_line 2016-12-29 03:27:10 +00:00
Kp ef06aa089a Pass canvas to gr_pixel 2016-12-29 03:27:09 +00:00
Kp b3809266a3 Use enumerate in more loops 2016-12-11 01:56:44 +00:00
Kp 1f434f98ad Use valptridx for ActiveDoors 2016-12-10 17:51:08 +00:00
Kp f8cc32a4af Merge pull #272 into master 2016-11-26 22:51:49 +00:00
Kp ac5ccf0c08 Pass active_door &to wall_close_door_num 2016-11-26 22:51:48 +00:00
Chris Taylor bf6eb99d7a When switching to the editor in a game, use a proper saved game
This preserves virtually all game information, including active fire. The saved game 'gamesave.sge' can also be loaded with File->Restore Game State. The level can still be saved as usual (but it warns the user if there's an unsaved game state). This functionality may be useful for testing (or cheating! ;) )
2016-11-21 15:22:11 +08:00
Chris Taylor 2995cb628c Never set Current_level_num to 0
This will be required when proper game state editing is implemented. Also remove hacks that check Current_level_num == 0.
2016-11-21 15:22:11 +08:00
Chris Taylor a06316f11e Fix crash when pressing Meta key (or Command key for Macs) in editor 2016-11-15 17:20:35 +08:00
Chris Taylor cc3f35649f Change all occurrences of "Couldn't" to "Could not" for consistency ("Could not" is more common and wins).
Not touching TXT_COULDNT because it's stored separately in hog file.
2016-11-13 13:27:18 +08:00
Chris Taylor 9183bba508 Change pads local var in init_editor to static to save on space for 64 bit systems 2016-11-13 13:09:31 +08:00
Chris Taylor 7dd21e7564 Use wallptridx in wall_dialog_handler, removing need for separate index variable 'wd' 2016-11-13 13:04:00 +08:00
Chris Taylor 5f19a3cba9 Remove redundant checks and initialisations recently added for editor 2016-11-13 12:44:53 +08:00
Chris Taylor 6757d89238 Fix crash in editor when trying to unlink a door that isn't linked 2016-11-12 17:30:36 +08:00
Chris Taylor eeb3303b95 Fix crash in editor when trying to link wall with no Markedsegp 2016-11-12 17:28:26 +08:00
Chris Taylor 95fcee9474 Fix crash when removing a wall in the editor
Only update wall_num if != wall_none.
2016-11-12 17:19:38 +08:00
Chris Taylor 4568bbae11 Don't crash when building segment bridge in editor the wrong way
Check if there is Markedsegp and replacing an Assert with a LevelError.
2016-11-12 16:41:54 +08:00
Chris Taylor ac52a30214 Fix spurious exploding wall and crash when playing a level loaded with the editor
When File->'Play in 320x200' is chosen, use StartNewGame(Current_level_num). For now use create_new_mission and Current_level_num = 1 every time. Also remove the now redundant hacks GM_EDITOR and editor_reset_stuff_on_level.
2016-11-12 15:38:38 +08:00
Chris Taylor ac438f4cc2 Allow the user to carry on as usual if any of the editor files are missing (i.e. before editor was loaded).
If a game was playing, continue playing. If it was in the main menu, return to the main menu. (If all files are put in place the editor can load again.)
2016-11-11 16:09:57 +08:00
Chris Taylor b8b19baa92 Make sure wall dialog and hostage dialog close properly
When responding to EVENT_WINDOW_CLOSE, set MainWindow to nullptr - fixing multiple issues with these dialogs including the inability to re-open them and a crash on exiting the editor.
2016-11-11 16:09:57 +08:00
Chris Taylor 396f1e47f0 Do Wall Dialog now works with no wall selected 2016-11-11 16:09:57 +08:00
Chris Taylor d41146bcbd Set default object index for object dialog
This prevents the Object Editor from crashing when no object is selected (Cur_object_index == object_none).
2016-11-11 16:09:57 +08:00
Chris Taylor 143ed30fee Merging in unification/master, resolving conflict in similar/main/kmatrix.cpp 2016-11-06 14:20:18 +08:00
Kp 5a69c09ec2 Move fuelcen_activate special assignment up
One caller uses fuelcen_activate when segp->special != station_type.
Every other caller passes the type that was already on the segment.
Move the assignment into the one caller that needs it, then remove the
argument.
2016-10-29 23:16:17 +00:00
Chris Taylor bd3078b672 Make wall_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on. Also remove the 'likely' branch prediction macro from close_wall_window because close_wall_window will only be called outside of the wall dialog's handler (to open a different dialog or close the editor).
2016-10-27 18:07:57 +08:00
Chris Taylor fd3e60be54 Make object_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:52:50 +08:00
Chris Taylor acc595ba16 Make robot_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:51:00 +08:00
Chris Taylor 5322ce4a0f Make editor_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:48:23 +08:00
Chris Taylor dc7a288539 Make trigger_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:34:41 +08:00
Chris Taylor 06632e73e8 Make centers_dialog_handler return window_event_result::close instead of closing itself
This ensures the event system will know what's going on.
2016-10-27 17:15:31 +08:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Kp c1d9c40931 Convert various valptridx accesses to use factory functions 2016-10-15 00:53:18 +00:00
Kp c2e6f06b86 Use std::move to compact walls 2016-10-15 00:53:17 +00:00
Kp 6515308a59 Simplify loop iteration in copy_group_walls 2016-10-15 00:53:17 +00:00
Kp a80ed36f0a Use range_for/vsegptr for wall_restore_all 2016-10-15 00:53:16 +00:00
Chris Taylor bc1c9ebd97 Merge branch 'unification/master' into allow_dialog_subclass
Conflicts:
	common/arch/sdl/window.cpp - Remove unused EVENT_WINDOW_CLOSED and w_callback local var
	common/ui/dialog.cpp - Remove unused EVENT_WINDOW_CLOSED
2016-10-10 14:40:11 +08:00
Kp 1d09ca32ad Remove spurious 'u' after DXX_PRI_size_type uses 2016-10-08 18:02:34 +00:00
Chris Taylor db665d8c33 Allow dcx::UI_DIALOG struct to be subclassed - step 2
Allow dcx::UI_DIALOG struct to be subclassed step 2. Make all the UI_DIALOG handlers return a window_event_result like everyone else.
2016-10-04 15:58:20 +08:00
Chris Taylor 60ac1eaad3 Replace delete dcx::window kludge with a better solution
Replace delete dcx::window kludge with a better solution: instead of requiring every handler to delete the window, add a window_event_result::deleted, which gets returned if the window was deleted by the handler, so window_close knows not to attempt to delete it again.
2016-10-04 14:05:44 +08:00
kreatordxx b87fcad332 Merge pull request #230 from dxx-rebirth/allow_window_subclasses_2
Allow window subclasses
2016-10-03 10:36:26 +08:00
Chris Taylor 87617e8ac9 Allow dcx::window struct to be subclassed - step 3
Allow dcx::window struct to be subclassed step 3. This step adds the window destructor and both requires and implements the window to be deleted by the event handler/client in all cases.
2016-10-02 17:49:19 +08:00
Kp f3865db4cb Use implicit range of vtrgptr 2016-10-02 00:34:39 +00:00
Chris Taylor dd1a6cc7b9 Save more unique_ptr's to UI_GADGET_BUTTON's
Save unique_ptr's to UI_GADGET_BUTTON's in similar/editor/med.cpp and similar/editor/medwall.cpp. Fixes compile errors and resolves a crash when attempting to access both dialogs' gadgets (input event processing is the first attempt).
2016-09-27 15:11:50 +08:00
Kp 69eec0d71f Save some editor gadget pointers 2016-09-24 18:06:11 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
Kp 1ca872c555 Switch seguvs.cpp to static_cast 2016-09-04 00:02:53 +00:00
Kp d9a0afdcba Remove unnecessary long cast in dist_2d 2016-09-04 00:02:52 +00:00
Kp 5cdd3c60a2 Switch med_save_situation to static_cast 2016-09-04 00:02:51 +00:00
Kp 7f264f779b Check segment index values in compress_segments 2016-09-03 17:30:18 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 7bb3a5605b Remove useless cast in similar/editor/info.cpp 2016-08-20 22:28:43 +00:00
Kp bbdecad649 Add helper macro to handle printf .* conversion for 32/64
Field width conversion `.*` always takes an `int`.

On Win32, casting `long` to `int` triggers a `-Wuseless-cast` warning.
Omitting the cast works correctly.

On Linux/amd64, casting `long` to `int` works correctly.
Omitting the cast triggers a `-Wformat` warning.

Add a macro that conditionally expands to `static_cast<int>` or to ``,
as necessary for the target platform.
2016-08-19 03:41:41 +00:00
Kp d554b01e45 Remove useless casts in similar/editor/meddraw.cpp 2016-08-19 03:41:41 +00:00
Kp c854c25d44 Fix wall_remove_side bogus use of IS_CHILD on wallnum
IS_CHILD is for segments, not walls.
2016-07-21 01:43:20 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp 68dd57021c Remove useless cast in mine.cpp 2016-07-15 03:43:03 +00:00
Kp 1bd32fedb5 Remove unused STRING_LENGTH 2016-07-09 17:58:35 +00:00
Kp e8d5992797 Remove unused CENTER_STRING_LENGTH 2016-07-09 17:58:35 +00:00
Kp 3779bc25a0 Define Robot_names only if EDITOR 2016-07-09 17:58:34 +00:00
Kp fee76e6ced Define Powerup_names only if EDITOR 2016-07-09 17:58:34 +00:00
Kp 262094237f Rewrite simple numeric casts from C style to static_cast<>
s/(\(int\|float\|fix\))\s*(/static_cast<\1>(/g
2016-07-06 01:54:24 +00:00
Kp 89ddc1b911 Add parentheses around casts of simple array subscripts
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.

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(\5\6\7\8)\9/g
2016-06-25 23:21:36 +00:00
Kp 65f68877aa 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-16 03:56:44 +00:00
Kp 0cb099c5e4 Add parentheses around casts of simple function calls
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.

Exclude float|double from the second substitution.  Including it
rewrites medmisc.cpp in an incorrect way, and excluding it does not
exclude any valid rewrites.

s/(\(int\|signed\|float\|double\|long\|short\|unsigned\))\s*\(\w\+\s*(\s*\w\+\s*)\)/(\1)(\2)/
s/(\((\(int\|signed\|long\|short\|unsigned\))(\w\+\s*(\s*\w\+\s*))\))/\1/g
2016-06-16 03:56:44 +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 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 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
Kp f98c47047a Fix -Wshadow warnings in med_rotate_group 2016-05-22 17:49:31 +00:00
Kp 523b7f036b Fix -Wshadow warnings in med_create_segment 2016-05-22 17:49:30 +00:00
Kp 439da0e74a Fix -Wshadow warnings in set_vertex_counts 2016-05-21 17:24:51 +00:00
Kp 191da8a243 Fix -Wshadow warnings in med_delete_segment 2016-05-21 17:24:51 +00:00
Kp 96708457fc Fix -Wshadow warnings in med_save_group 2016-05-21 17:24:51 +00:00
Kp 9fd62715c1 Fix -Wshadow warnings in med_load_group 2016-05-21 17:24:51 +00:00
Kp 4572b313b9 Fix -Wshadow warnings in draw_segment 2016-05-21 17:24:51 +00:00
Kp 1a99ddae17 Fix -Wshadow warnings in check_segment 2016-05-21 17:24:51 +00:00
Kp 0ea22e1b9e Fix -Wshadow warnings in assign_uvs_to_side 2016-05-21 17:24:51 +00:00
Kp e600528b83 Fix -Wshadow warnings in centers_dialog_handler 2016-05-21 17:24:51 +00:00
Kp 730d61a738 Pass object &to init_ai_object 2016-04-23 17:59:47 +00:00
Kp 6d8a0bd249 Refactor ObjectMove* editor functions
Use a template to combine common code.
2016-04-17 00:58:45 +00:00
Kp 5b3a36e6b8 Remove valptridx operator-(P *, A &) 2016-04-06 03:34:13 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp b8f39b024a Move DoMenu into dsx 2016-03-19 19:08:10 +00:00
Kp 06ed8865b7 Use ={} for init_all_vertices Vertex_active 2016-03-05 17:26:24 +00:00
Kp f4e1ebb576 Remove unnecessary gr_setcolor calls 2016-02-12 04:02:28 +00:00
Kp 972654c140 Pass color to draw_listed_segments 2016-02-12 04:02:28 +00:00
Kp 9d2659ab26 Pass color to draw_wall_side 2016-02-12 04:02:28 +00:00
Kp 12bd8bce35 Pass color to draw_trigger_side 2016-02-12 04:02:28 +00:00
Kp cc8bed5b95 Pass color to draw_side_edge 2016-02-12 04:02:28 +00:00
Kp 7694fff456 Pass color to draw_seg_side 2016-02-12 04:02:28 +00:00
Kp fd834f0924 Pass color to draw_segment 2016-02-12 04:02:28 +00:00
Kp 68cf7939a2 Pass color to draw_line 2016-02-12 04:02:28 +00:00
Kp d08bfc3170 Pass color to g3_draw_sphere 2016-02-12 04:02:28 +00:00
Kp 1b4b6673ee Pass color to g3_draw_poly 2016-02-12 04:02:28 +00:00
Kp 8c24eaa721 Pass color to g3_draw_line 2016-02-12 04:02:28 +00:00
Kp 36bd39babe Pass color to gr_line 2016-02-12 04:02:28 +00:00
Kp edd2acc86b Pass color to gr_box 2016-02-12 04:02:28 +00:00
Kp 23047b1165 Pass color to gr_rect 2016-02-12 04:02:28 +00:00
Kp f235d6b12b Pass color to gr_pixel 2016-02-12 04:02:28 +00:00
Kp 553b313099 Use vwallptr 2016-02-12 04:02:28 +00:00
Kp 2fd6a425b0 Remove highest_valid 2016-02-12 04:02:28 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 31716bbf42 Factor out draw_special_segments color lookup 2016-02-11 03:25:52 +00:00
Kp 0101f98905 Use wallnum_t in more places 2016-02-06 22:12:54 +00:00
Kp bb5d1bb7e5 Use valptridx array type for Walls 2016-02-06 22:12:54 +00:00
Kp 72d2844070 Use enum for trigger flags 2016-02-06 22:12:54 +00:00
Kp 74dfa29d31 Convert most Trigger references to valptridx 2016-02-06 22:12:54 +00:00
Kp 4f0cbcffa9 Use valptridx array type for Triggers 2016-02-06 22:12:53 +00:00
Kp e3033d939e Simplify wall_restore_all flags update 2016-01-26 03:45:08 +00:00
Kp 3d13e66f6a Use C++ array in more places 2016-01-26 03:45:08 +00:00
Kp 38bc1fb28f Use range_for for medwall CountedWalls 2016-01-26 03:45:08 +00:00
Kp 8cbc672080 Factor out draw_special_wall BM_XRGB 2016-01-26 03:45:07 +00:00
Kp 994f2edc4d Factor out draw_special_wall color choice 2016-01-26 03:45:07 +00:00
Kp c07c7e204f Remove sprintf from editor/mine.cpp 2016-01-09 16:38:17 +00:00
Kp c140f8aae4 Remove sprintf from editor/medwall.cpp 2016-01-09 16:38:17 +00:00
Kp 858c3e26e0 Remove sprintf from editor/medrobot.cpp 2016-01-09 16:38:17 +00:00
Kp 4e863716d9 Remove sprintf from editor/med.cpp 2016-01-09 16:38:16 +00:00
Kp 8ea6e67d1c Remove sprintf from editor/kmine.cpp 2016-01-09 16:38:16 +00:00
Kp 8602245c5e Remove sprintf from editor/kgame.cpp 2016-01-09 16:38:16 +00:00
Kp 78830627da Remove sprintf from editor/group.cpp 2016-01-09 16:38:16 +00:00
Kp 28649da083 Remove stub support for demo editor 2016-01-09 16:38:16 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
Kp a3ae630829 Remove default argument for basic_ptridx(index) 2016-01-09 16:38:14 +00:00
Kp d6359d0eb7 Use template for object rotation functions 2016-01-09 16:38:13 +00:00
Kp a32d9f01a1 Remove return value truncation in find_object_seg 2016-01-09 16:38:13 +00:00
Kp 98f5afa9f8 Remove default argument for basic_ptr(pointer,array &) 2016-01-09 16:38:13 +00:00
Kp 8a30fc656b Factor out editor special segment drawing 2016-01-09 16:38:12 +00:00
Kp 96898bab0a Block direct changes to Highest_segment_index
Route updates through helper functions.
2016-01-09 16:38:12 +00:00
Kp 2ef83ad002 Remove redundant segptr computation 2016-01-03 20:21:35 +00:00
Kp 34df375032 Cache remove_trigger wall_num 2016-01-03 20:21:35 +00:00
Kp e8c34be843 Use v*ptr* factories with highest_valid 2015-12-22 04:18:51 +00:00
Kp d479819931 Use absolute_sibling to reduce global references for ptridx 2015-12-22 04:18:51 +00:00
Kp db9fb0ed42 Move more symbols into namespace dcx/dsx 2015-12-22 04:18:50 +00:00
Kp a9b82e3f7f Make vlighting static 2015-12-04 03:36:31 +00:00
Kp ed55763603 Remove unused symbols 2015-12-04 03:36:31 +00:00
Kp 708dc0a7e1 Use vobjptr/vcobjptr for more Objects[] access 2015-12-03 03:26:49 +00:00
Kp db77622f0e Move array_size into valptridx_specialized_types 2015-11-26 02:56:55 +00:00
Kp 82d0c2ed96 Make some implicit uses of ptridx construction explicit 2015-11-19 03:23:34 +00:00
Kp 3ea0470aa7 Fix eobject to use an in-array object 2015-10-30 02:52:54 +00:00
Kp c1f8497b33 Simplify editor group print 2015-10-30 02:52:54 +00:00
Kp 8b61b9f0db Remove unused symbols 2015-10-24 03:13:11 +00:00
Kp 48af374924 Reduce direct use of Segments[] 2015-10-21 02:45:43 +00:00
Kp af2d8f7deb Factor out create_vert*_lists switch 2015-10-18 21:01:20 +00:00
Kp 1f63bfeee5 Reduce lifetime of returned get_seg_masks result 2015-10-18 21:01:19 +00:00
Kp faf698703e Make rotate_list result anonymous 2015-10-18 21:01:18 +00:00
Kp ffd6c113ae Move fwdwall.h -> fwd-wall.h for consistency 2015-10-09 02:46:10 +00:00
Kp 78de0ac119 Add fwd-event.h with forward declarations of event.h 2015-10-09 02:46:10 +00:00
Kp bca143d87d Only include ogl_init.h in OpenGL builds 2015-10-09 02:46:10 +00:00
Kp 7034b68357 Manage world time automatically where possible
For all cases where world time nests, use automatic management.  Some
sites disable time in one function and enable it elsewhere.  These are
untouched.
2015-10-09 02:46:09 +00:00
Kp 50f672ba34 Reuse computed string length 2015-09-29 02:41:22 +00:00
Kp d9cef82f81 Allow nullptr for gr_get_string_size 2015-09-29 02:41:22 +00:00