Commit graph

879 commits

Author SHA1 Message Date
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
Kp 1cdd4ac2ce Pass object & to [gs]et_*_id 2015-09-15 02:48:04 +00:00
Kp d3ca71c8d0 Inline get_num_reactor_models 2015-08-26 03:15:10 +00:00
Kp e5683593ef Expand ZERO_VECTOR inline 2015-08-13 03:15:53 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp bc7c469ab2 Use array<> for more globals 2015-08-12 03:11:46 +00:00
Kp c80d12319a Use unqualified begin/end
Most call sites use unqualified begin/end and rely on using declarations
to pick an appropriate implementation.  Fix the sites that explicitly
requested std::begin/std::end.
2015-08-03 03:11:25 +00:00
Kp 9a5654e002 Move similar/editor/autosave.cpp -> common/editor/autosave.cpp 2015-07-25 23:10:47 +00:00
Kp cf678a23ac Pass vcsegptridx/vcsegptr to find_point_seg 2015-07-18 21:01:55 +00:00
Kp a5476c5605 Use array<> for segsize_common propagated 2015-07-18 21:01:55 +00:00
Kp 8c2ba970d3 Use vsegptr for eobject.cpp 2015-07-18 21:01:55 +00:00
Kp 1db87a6e61 Return objnum_t from get_next_object 2015-07-14 02:42:11 +00:00
Kp fa8dcc9113 Explicitly delete basic_ptridx(pointer_type); require array
Require the array argument for basic_ptridx, which is supplied
automatically when the factory is used.
2015-07-13 01:09:37 +00:00
Kp fa805558f2 Use std::swap for ExchangeMarkandCurseg 2015-07-13 01:09:37 +00:00
Kp 1adb56f16b Make draw_mine_all static 2015-07-13 01:09:36 +00:00
Kp f4ab295af8 Pass vsegptridx from propagate_textures_common 2015-07-12 01:04:22 +00:00
Kp 827e7a4b99 Pass vsegptridx to ktmap pts_aux 2015-07-12 01:04:22 +00:00
Kp 2c326df217 Use valptr for kgame.cpp 2015-07-12 01:04:18 +00:00
Kp 04fc19c941 Use valptr for group.cpp 2015-07-12 01:04:18 +00:00
Kp 4f99478814 Use valptr for elight.cpp 2015-07-12 01:04:18 +00:00
Kp f7c89300e4 Use valptr for curves.cpp 2015-07-12 01:04:18 +00:00
Kp fdd2356eac Use segptridx for Cursegp, Markedsegp 2015-07-12 01:04:18 +00:00
Kp 1b6999ff4d Switch get_seg_masks from vcsegptridx_t to vcsegptr_t
The index component is not needed.
2015-07-12 01:04:17 +00:00
Kp 968cdbecf4 Add non-aborting UserError for user-caused fatal errors 2015-06-16 03:15:40 +00:00
Kp caf40e279e Enable tail-call from close_wall_window 2015-06-13 22:42:19 +00:00
Kp 7b7bfe14a5 Enable tail-call to redraw_current_object 2015-06-13 22:42:19 +00:00
Kp c1455cfea9 Use template for object page functions 2015-06-13 22:42:19 +00:00
Kp 420c2adee1 Simplify editor lighting 2015-06-13 22:42:19 +00:00
Kp fe3dae1508 Use valptr for texpage highest_valid 2015-06-13 22:42:19 +00:00
Kp b07704ef45 Use valptr for seguvs highest_valid 2015-06-13 22:42:19 +00:00
Kp 2154f8e442 Use valptr for segment highest_valid 2015-06-13 22:42:19 +00:00
Kp 438a1a4bee Use valptr for medwall highest_valid 2015-06-13 22:42:18 +00:00
Kp c3ba75cd22 Use valptr for meddraw highest_valid 2015-06-13 22:42:18 +00:00
Kp adcd8d7fa7 Use valptr for ksegsize highest_valid 2015-06-13 22:42:17 +00:00
Kp fc46612114 Use valptr for kbuild highest_valid 2015-06-13 22:42:17 +00:00
Kp 41b71fd214 Use valptr for group highest_valid 2015-06-13 22:42:17 +00:00
Kp 32f256311d Use valptr for eobject highest_valid 2015-06-13 22:42:16 +00:00
Kp 742971711f Use valptr for elight highest_valid 2015-06-13 22:42:16 +00:00
Kp 9125ae32cd Make objnum unsigned 2015-06-13 22:42:15 +00:00
Kp 53a7798d80 Simplify fix_sincos calls 2015-06-02 03:03:31 +00:00
Kp ea2c2df250 Update open-coded tests for segment_none 2015-05-28 03:08:39 +00:00
Kp 8e49c191ce Remove unused copy_side_except_vertex_ids 2015-05-17 20:37:59 +00:00
Kp f5b02ce6a0 Remove write-only ai_static D1 follow_path_start_seg 2015-05-09 17:39:01 +00:00
Kp 7dae02fbb4 Remove write-only ai_static D1 follow_path_end_seg 2015-05-09 17:39:00 +00:00
Kp 36ce989db6 Refactor get_next_segment 2015-05-09 17:38:58 +00:00
Kp f7eaf36ad3 Fix rotate_uv_point with -Wmissing-field-initializers
gcc-5 -Wmissing-field-initializers allows initialization by empty
braces, causing SConf not to pass -Wno-missing-field-initializers.
Change rotate_uv_point to return an explicitly 0 light to fix the
resulting warning.
2015-04-30 03:32:27 +00:00
Kp e883d7c872 Use enum class for AIB constants 2015-04-26 20:15:51 +00:00
Kp fd6ac87c25 Fix trigger_none checks 2015-04-26 20:15:50 +00:00
Kp 6e9638531a Mark get_previous_segment static 2015-04-22 02:44:31 +00:00
Kp 150e2d2686 Convert local arrays to array<> 2015-04-19 04:18:49 +00:00
Kp 7fd4ccb004 Simplify info_display_object_placement cache override 2015-04-19 04:18:49 +00:00
Kp 5ae5033fed Use enum for AIB constants 2015-04-02 02:36:57 +00:00
Kp 6b6eaef226 Include polyobj.h from robot.h
Swap the inclusion order since all robots are polyobjects, but not all
polyobjects are robots.
2015-04-02 02:36:57 +00:00
Kp b0ec49f8e5 Remove unused file+line from get_seg_masks 2015-04-02 02:36:56 +00:00
Kp 4e6d9b9901 Make xlate_previous const 2015-04-02 02:36:56 +00:00
Kp 1469e2e34c Simplify print_clock 2015-04-02 02:36:56 +00:00
Kp 36e1612ecb Make undo_status array<const char *> 2015-04-02 02:36:56 +00:00
Kp efcf7ce6cf Remove unnecessary strcpy in info.cpp 2015-04-02 02:36:55 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 4871b17c8f Pass array<> to remap_side_uvs 2015-02-27 03:30:33 +00:00
Kp c3b09da175 Simplify assign_light_to_side 2015-02-27 03:30:33 +00:00
Kp 291fc95fb1 Refactor and optimize assign_uvs_to_side
Use ?: to pick Stretch_scale_* value.
Mark bogosity as unlikely.
Cache vector subtraction.
Defer constructing rotation matrix.
Move uvl assignment into reusable lambda.

This also fixes clang build.  btb reports that clang chokes on:
	extern T t;
	extern const T ct;
	[]() {
		if (a)
			return ct;
		return t;
	}
with
    error: return type 'vms_matrix' must match previous return type 'const vms_matrix' when lambda expression has unspecified explicit return type

Compiler failure report: d38dd0aeef (commitcomment-9909178)
2015-02-27 03:30:33 +00:00
Kp f900d4a5ee Remove RAIIdmem::operator pointer
Mac OS X defines uint_fast32_t to unsigned int, causing ambiguous
overloads between RAIIdmem::operator[](std::size_t) and
RAIIdmem::operator[](int).  Adding a disambiguating overload for OS X
breaks Windows.  Remove operator pointer and operator[].  Rely on the
inherited operator[] for indexing.  Require users to call ->get() to
convert to a simple pointer.

First btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/34
Second btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/43
2015-02-17 03:52:59 +00:00
Kp 8a64ea3b0e Use array<> for Vertex_active 2015-02-14 22:48:28 +00:00
Kp 315f1ce815 Use array<> for Side_to_verts 2015-02-14 22:48:27 +00:00
Kp 078d9513e0 Pass end-of-list for ignore_obj_list 2015-02-05 03:03:51 +00:00
Kp 673a711461 Remove vm_angles_2_matrix return value 2015-02-05 03:03:51 +00:00
Kp 7a4a6ed1d4 Return uvl from compute_uv_side_center 2015-02-05 03:03:50 +00:00
Kp 1dafd71427 Return uvl from rotate_uv_point
Returned l is now 0 instead of undefined.
2015-02-05 03:03:50 +00:00
Kp 799ebb61a0 Use range_for in texture.cpp 2015-02-05 03:03:50 +00:00
Kp c21536ebb3 Return array<> from create_2d_rotation_matrix 2015-02-05 03:03:50 +00:00
Kp 8f5e6df9a5 Use array<> for Side_to_verts 2015-02-05 03:03:50 +00:00
Kp 99a4a0ed62 Capture range_for by-value temporaries as const
Modifying a by-value temporary does not affect the underlying container,
so modifying it is almost always a bug.  Require use of a by-reference
capture when modification is desired.

sed -i -e 's/range_for\s*(\s*\(const\s\+\)\?auto\s\+\([[:alpha:]_]\)/range_for (const auto \2/g'
2015-02-05 03:03:49 +00:00
Kp d38dd0aeef Simplify assign_uvs_to_side error paths 2015-02-03 00:37:07 +00:00
Kp cd1d3f52fb Remove string copying in info_display_segsize 2015-01-29 04:27:35 +00:00
Kp 71ec47b32e Refactor ui_pad_activate 2015-01-29 04:27:35 +00:00
Kp c8b5fe5552 Pass find_vector_intersection arg by & 2015-01-20 02:46:42 +00:00
Kp 84e3a03451 Remove unused parameters 2015-01-18 01:58:33 +00:00
Kp f7815810e8 Use RAIIPHYSFS_File to manage PHYSFS_File
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp fccb6814f8 Pass gr_create_sub_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp c731558a94 Pass gr_init_sub_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp c2b7990550 Pass window_get_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp 6ccf6ae96b Use range_for in segment.cpp 2015-01-12 00:26:02 +00:00
Kp ff493fcfce Inline vm_vec_make 2015-01-12 00:26:02 +00:00
Kp fbac119095 Propagate use of objptridx_t 2014-12-23 04:20:27 +00:00
Kp 702ea40ade Move segment declarations to fwdsegment.h 2014-12-22 04:35:49 +00:00
Kp 2d8f8b5d4a Reduce inclusion of wall.h 2014-12-22 04:35:49 +00:00
Kp 3864bff448 Write current_tmap_list carefully 2014-12-20 04:36:11 +00:00
Kp b68a403e41 Use partial_range to load textures 2014-12-20 04:36:11 +00:00
Kp 0bf2a6eb80 Return unique_ptr from ui_add_gadget_button 2014-12-20 04:36:10 +00:00
Kp 3b4fbd0bd5 Return unique_ptr from ui_add_gadget_radio 2014-12-20 04:36:10 +00:00
Kp b16e8ecbec Return unique_ptr from ui_add_gadget_checkbox 2014-12-20 04:36:09 +00:00
Kp 413a316154 Return unique_ptr from ui_add_gadget_inputbox 2014-12-20 04:36:09 +00:00
Kp 89b1ff8795 Return unique_ptr from ui_add_gadget_userbox 2014-12-20 04:36:09 +00:00
Kp 8d487b4883 Return unique_ptr from ui_add_gadget_icon 2014-12-20 04:36:09 +00:00
Kp bcfd6a77f0 Use unique_ptr for object_dialog 2014-12-20 04:36:09 +00:00
Kp cf5e5620aa Deduce input box text length 2014-12-20 04:36:09 +00:00
Kp 6735a94f3b Use unique_ptr for wall_dialog 2014-12-20 04:36:09 +00:00
Kp 63ee79d988 Use unique_ptr for robot_dialog 2014-12-20 04:36:08 +00:00
Kp 7e4e8f3501 Use unique_ptr for centers_dialog 2014-12-20 04:36:08 +00:00
Kp f0c8482b8b Use unique_ptr for trigger_dialog 2014-12-20 04:36:08 +00:00
Kp 9ffd958d3d Create window_rendered_data locally 2014-12-18 04:12:38 +00:00
Kp 601290e674 Return vertex_array_list_t from create_all_vertex_lists 2014-12-14 05:23:00 +00:00
Kp adbff232c5 Split seg/obj vars of find_seg_side_face 2014-12-13 17:47:01 +00:00
Kp 7c98dea8be Pass render_frame arg by & 2014-12-13 04:11:21 +00:00
Kp 78cdb70959 Use partial_range on Triggers 2014-12-08 04:19:26 +00:00
Kp 355df375a0 Pass gr_bitmap arg as & 2014-12-02 03:35:01 +00:00
Kp d79287e368 Use partial_range for delete_curve 2014-11-30 22:09:23 +00:00
Kp 9aa539c062 Return texmerge_get_cached_bitmap result by & 2014-11-30 22:09:19 +00:00
Kp b4acc5b858 Pass gr_ubitmap arg by & 2014-11-30 22:09:19 +00:00
Kp 968f7ddc97 Pass gr_gpixel arg by & 2014-11-30 22:09:18 +00:00
Kp 5aaf847c41 Fix various -Wnarrowing errors 2014-11-26 03:39:21 +00:00
Kp f206b3b127 Reduce inclusion of object.h 2014-11-23 04:36:58 +00:00
Kp 2c349136cc Avoid slicing into segnum_t local 2014-11-20 03:00:36 +00:00
Kp e56fe128e0 Remove DosShell 2014-11-19 04:19:43 +00:00
Kp c72ec87296 Redirect g3_end_frame->ogl_end_frame 2014-11-16 19:14:51 +00:00
Kp 855b249555 Make g3s_point const only in OGL 2014-11-16 19:14:51 +00:00
Kp c2d308807c Make various g3s_point * const 2014-11-15 03:10:06 +00:00
Kp baa39fe8f7 Add g3_rotate_point that returns result 2014-11-13 03:41:29 +00:00
Kp 207dceba33 Pass g3_draw_sphere arg by & 2014-11-13 03:22:49 +00:00
Kp aba13a0bd0 Pass g3_draw_line arg by & 2014-11-13 03:19:52 +00:00
Kp 1bb1c0ad33 Fix build break for objptr->objptridx conversions 2014-11-11 04:12:10 +00:00
Kp df6b4bd783 Add vm_vec_rotate that returns result 2014-11-04 01:31:22 +00:00
Kp 3a24b20e15 Add vm_vector_2_matrix that returns result 2014-11-04 01:27:55 +00:00
Kp 9026e225db Add vm_vec_ang_2_matrix that returns result 2014-11-04 01:27:46 +00:00
Kp 141a7602d0 Add vm_angles_2_matrix that returns result 2014-11-04 01:24:08 +00:00
Kp fd9a9a5166 Pass rotate_segment_new arg by & 2014-11-04 01:23:01 +00:00
Kp c97f1136fa Pass AttachSegmentNewAng arg by & 2014-11-04 01:20:07 +00:00
Kp 553ab8d56c Pass med_move_group arg by & 2014-11-04 01:14:36 +00:00
Kp f321621d77 Pass med_copy_group arg by & 2014-11-04 01:13:52 +00:00
Kp 5d1df2484e Add med_create_group_rotation_matrix that returns result 2014-11-04 01:13:08 +00:00
Kp fddb15310b Pass med_create_group_rotation_matrix arg by & 2014-11-04 01:10:52 +00:00
Kp fb4de8e2a8 Pass med_attach_segment_rotated vms_matrix by & 2014-11-02 03:45:01 +00:00
Kp f5717c7db7 Pass med_rotate_segment vms_matrix by & 2014-11-02 03:44:31 +00:00
Kp 40eb2e6b01 Add vm_vec_scale_add that returns result 2014-11-02 03:43:57 +00:00
Kp b32f5e5df3 Add vm_vec_copy_scale that returns result 2014-11-02 03:43:47 +00:00
Kp 697bdcf078 Add vm_vec_normal that returns result 2014-11-01 03:17:48 +00:00
Kp 0202a4b054 Pass scale_vert vector by & 2014-11-01 03:14:14 +00:00
Kp 7e3c7a413a Pass obj_create_copy vector by const & 2014-11-01 03:06:04 +00:00
Kp 6d61198130 Pass compute_segment_center vector by & 2014-10-30 03:32:51 +00:00
Kp 8a89eff0bb Pass compute_center_point_on_side vector by & 2014-10-30 03:32:27 +00:00
Kp 7b402cf613 Pass vnear vector by & 2014-10-30 03:19:11 +00:00
Kp a09fcd7753 Add vm_vec_add that returns result 2014-10-30 03:11:06 +00:00
Kp 5bb9c88979 Add vm_vec_sub that returns result 2014-10-29 03:24:31 +00:00
Kp 53aa70cecb Use vsegptridx_t 2014-10-28 03:08:51 +00:00
Kp af318b9eb2 Pass PHYSFSX_writeVector vector by const & 2014-10-26 22:08:58 +00:00
Kp f0d4c50fcc Pass create_curve arg by & 2014-10-26 22:08:58 +00:00
Kp ae6502f86b Pass set_matrix_based_on_side arg by & 2014-10-26 22:01:18 +00:00
Kp fc5b50c433 Pass med_create_new_segment arg by & 2014-10-26 22:01:13 +00:00
Kp 09835590f3 Pass g3_set_view_matrix arg by & 2014-10-26 22:01:00 +00:00
Kp 68309dfef0 Pass extract_*_vector_from_segment arg by & 2014-10-26 21:37:06 +00:00
Kp 258d6b4a04 Pass place_object vms_vector arg by & 2014-10-26 21:36:10 +00:00
Kp 2a5265493e Pass obj_create position vms_vector by & 2014-10-26 21:35:16 +00:00
Kp a79bb365f9 Pass get_seg_masks arg by & 2014-10-26 21:28:38 +00:00
Kp 359fcb3ce7 Remove unused set_chase_matrix 2014-10-25 16:40:00 +00:00
Kp a32547af16 Pass position-related vms_vector arg by & 2014-10-22 02:46:03 +00:00
Kp 019b572c0e Remove #define Segment2s Segments 2014-10-21 03:15:12 +00:00
Kp 4c4eff5a6d Fix Win32 build breaks caused by wrong sized std::size_t 2014-10-19 21:04:16 +00:00
Kp e7e23eb92e Make unused_window_userdata_t const 2014-10-16 02:30:29 +00:00
Kp 7f648c0f5f Wrap segment iteration idiom 2014-10-12 23:10:05 +00:00
Kp fb641b3250 Wrap object iteration idiom 2014-10-12 23:05:46 +00:00
Kp d72fcfeef1 Remove unnecessary UI_GADGET* casts 2014-10-04 22:36:13 +00:00
Kp a8f853aa7a Pass d_event arg by const& 2014-10-04 22:36:13 +00:00
Kp 93b2129a71 Combine EVENT_UI_DIALOG_DRAW blocks 2014-10-04 17:53:03 +00:00
Kp 2a63700d95 Use magic type for wall magic constants 2014-10-04 17:31:13 +00:00
Kp 6971dfbf4a Use symbolic *_none constants for -1 2014-10-04 17:31:13 +00:00
Kp 02fd23f6af Pass player_is_visible_from_object arg by const & 2014-10-02 03:02:37 +00:00
Kp 649704a37c Pass med_create_segment arg as & 2014-10-02 03:02:37 +00:00
Kp 51470e5b4a Pass sort_seg_list arg as & 2014-10-02 03:02:37 +00:00
Kp ca3a4524a2 Pass med_extract_*_vector_from_segment_side arg as & 2014-10-02 03:02:37 +00:00
Kp bee7a203d8 Pass med_rotate_group arg as const & 2014-10-02 03:02:37 +00:00
Kp c705265ccc Pass move_object_to_vector arg as const & 2014-10-02 03:02:37 +00:00
Kp ad562e14a4 Remove unused curve_dir 2014-10-02 03:02:36 +00:00
Kp 07be2e3951 Pass curve_dist p0 by & 2014-10-02 03:02:36 +00:00
Kp 8aa9f071e6 Pass med_point_2_vec v by & 2014-10-02 03:02:36 +00:00
Kp d0dd976fdb Pass g3_point_2_vec v by & 2014-10-02 03:02:36 +00:00
Kp 68211d20d3 Pass g3_rotate_point arg by & 2014-10-02 03:02:35 +00:00
Kp b2ab0e48da Pass g3_check_normal_facing arg by & 2014-10-02 03:02:35 +00:00
Kp 6b93309ae5 Pass vm_vec_make arg by & 2014-10-02 03:02:35 +00:00
Kp ff37e54087 Change Vertices to array<vertex> 2014-10-02 03:02:34 +00:00
Kp 3743882fa4 Use vm_matrix_x_matrix 2 arg form where viable 2014-10-01 02:28:42 +00:00
Kp 83ccb15459 Pass vm_matrix_x_matrix arg by & 2014-10-01 02:28:42 +00:00
Kp 5af79382a5 Pass vm_vec_rotate arg by & 2014-10-01 02:28:42 +00:00
Kp 99f681c8ea Pass vm_vector_2_matrix arg by & 2014-10-01 02:28:42 +00:00
Kp e6cb533007 Pass vm_vec_ang_2_matrix arg by & 2014-10-01 02:28:42 +00:00
Kp d238b4a562 Pass vm_angles_2_matrix arg by & 2014-10-01 02:28:42 +00:00
Kp feb7d028e4 Pass vm_vec_delta_ang arg by & 2014-10-01 02:28:42 +00:00
Kp f509b49dc3 Pass vm_vec_normal arg by & 2014-10-01 02:28:42 +00:00
Kp b5f443f21e Pass vm_vec_normalized_dir arg by & 2014-10-01 02:28:41 +00:00
Kp 1fff2db9a8 Pass vm_vec_dist_quick arg by & 2014-10-01 02:28:41 +00:00
Kp ac39749382 Pass vm_vec_dist arg by & 2014-10-01 02:28:41 +00:00
Kp 4104bf4f11 Pass vm_vec_scale_add arguments by & 2014-09-28 21:43:14 +00:00
Kp b5949cc4a0 Pass vm_vec_copy_scale arguments by & 2014-09-28 21:43:14 +00:00
Kp d6c06e40e7 Pass vm_vec_sub2 arguments by & 2014-09-28 21:43:00 +00:00
Kp 0b2636d535 Pass vm_vec_add2 arguments by & 2014-09-28 21:43:00 +00:00
Kp ba0b91554c Remove vm_vec_dotprod -> vm_vec_dot redirect 2014-09-28 21:41:59 +00:00
Kp 00b59c3058 Pass vm_vec_dot arguments by & 2014-09-28 21:11:48 +00:00
Kp 321bbe37d8 Pass vm_vec_sub arguments by & 2014-09-28 21:11:45 +00:00
Kp 2107b52764 Pass vm_vec_add arguments by & 2014-09-28 21:11:40 +00:00
Kp 74925e9b45 Pass vm_vec_scale dest by & 2014-09-28 21:11:05 +00:00
Kp 69968349cb Pass vm_transpose_matrix m by & 2014-09-28 21:11:04 +00:00