Commit graph

51 commits

Author SHA1 Message Date
Kp ad7057be87 Add hack for case mismatch in Vertigo robot movies
PhysFS 3 is case-sensitive for movie filename lookup.  The consequence
of this was first reported in [1].  In [2], @icculus stated this was a
bug in PhysFS 3 that would be fixed in PhysFS 3.0.2.  However, [3] and
[4] assert that the fix was never included.  The existence of [5] seems
to support this.  The original problem was reported in 2019.  As of
2022, user @AlumiuN, running PhysFS 3.0.2, is affected.  Therefore, this
commit adds code to detect the relevant robot movies and adjust the case
in the Rebirth code.

[1]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379
[2]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-389400528
[3]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-462083489
[4]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-477790175
[5]: https://github.com/dxx-rebirth/dxx-rebirth/issues/644
2022-09-24 17:47:52 +00:00
Kp eb7cedc35d Expand macro Current_mission_longname 2021-11-01 03:37:19 +00:00
Kp e69b7bd730 Expand macro Briefing_text_filename 2021-11-01 03:37:19 +00:00
Kp bcc8118dd5 Expand macro Ending_text_filename 2021-11-01 03:37:19 +00:00
Kp 3d878ce04d Expand macro Last_level 2021-11-01 03:37:19 +00:00
Kp e36c4a17ab Expand macro Last_secret_level 2021-11-01 03:37:19 +00:00
Kp 692c09bb7e Expand macro N_secret_levels 2021-11-01 03:37:19 +00:00
Kp 013ef0ded7 Expand macro Secret_level_table 2021-11-01 03:37:19 +00:00
Kp d10406c107 Expand macro Level_names 2021-11-01 03:37:19 +00:00
Kp 72cdb9b0cc Expand macro Secret_level_names 2021-11-01 03:37:19 +00:00
Kp c64d97307c Pass level counts to allocate_levels
Avoid reading them from a global.
2021-11-01 03:37:19 +00:00
Kp d0d7545ec1 Unload robot movies on exit 2021-06-28 03:37:49 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp b9a27094eb Pass menu_title through listbox functions 2020-12-26 21:17:29 +00:00
Kp 1a2cfa35ba Fix saving/loading games for missions in subdirectories
The historical savegame format cannot support finding a mission in a
subdirectory.  Add a backwards-incompatible modification to store the
full path in the savegame, and store it in a way that old versions will
fail gracefully.[1]  When loading demos, or legacy savegames, search for
the mission in all available directories.  Demos are still written with
an unqualified path because the demo loading code would crash if given
an oversized path.  Mission names sent over the network as part of
multiplayer use the guess logic now, so that guests do not need to have
the mission in the same path as the host.

[1] Versions affected by issue #486 may fail ungracefully.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/491>
2020-01-18 21:57:39 +00:00
Kp 3e2d47f879 Track mission type correctly when loading mission list
- In D2X, do not accept Descent2-specific directives from Descent 1
  `.msn` files.
- Set the descent_version field correctly in the `mle`.  Previously,
  `.msn` was set to descent1 and all `.mn2` were set to descent2,
  regardless of whether the `.mn2` used `name`, `xname`, `zname`, or
  `!name`.
- Avoid rewinding the file and rereading the same line while checking
  the possible name types.
- Avoid recomputing end-of-string when it is already known.
- Avoid re-reading the mission file's version when the mission is
  chosen.  Instead, use the version that was recorded when the mission
  was loaded into the mission list.  This also fixes a bug where Descent
  1 `.msn` files would be classified as descent_version_type::descent2
  since both use `name =`, but that string has a different meaning
  depending on whether the file is `.msn` or `.mn2`.
2020-01-18 21:57:39 +00:00
Kp 3d09f4544b Remove macro Current_mission_filename 2020-01-18 21:57:39 +00:00
Kp 99356e0cdb Use enum for include/exclude anarchy mode 2020-01-18 21:57:39 +00:00
Kp d97afc2ad5 Retain directory structure in New Game dialog
User jcotton42 suggested copying a D2X-XL feature: preserving the
directory structure of the user's missions area when showing a New Game
dialog.  This was substantially more trouble than it should have been,
but the result is good.

Previously, the dialog presented all missions at any depth below the
starting point, and sorted them as if they were all in the root
directory.

Now:
- Empty directories are hidden entirely.  There is nothing for the user
  to do in them, so there is no point showing them.
- A directory with exactly one entry has that entry promoted into the
  parent, since there is no ambiguity about what the user would want.
  If the parent in turn has only that one promoted element when the scan
  of the parent finishes, then the element can be promoted up again.
  This continues until the root is reached or until a level has more
  than one entry.  For this purpose, both missions and directories count
  as entries.
- Directory entries are decorated to inform the user how many
  immediate subdirectories are present, how many missions are present
  immediately in the directory, and how many missions total are present,
  counting all subdirectories.  If there are zero immediate
  subdirectories, then the directory count is not shown.  For this
  purpose, directories that were hidden due to a lack of missions are
  not counted.
- Sub-dialog boxes for inner directories use a title that reminds the
  user of the path so far, and recaps the directory/mission statistics.
- On entry to the New Game dialog, if the last played mission is in a
  sub-dialog, appropriate sub-dialogs are opened so that the last played
  mission can be pre-selected.

Currently, there is no in-game override to return to the prior rollup
rules.

Requested-by: jcotton42 <https://github.com/dxx-rebirth/dxx-rebirth/issues/392>
2018-07-03 05:59:40 +00:00
Kp db80a88ad2 Improve error message on failure to load mission 2018-07-03 05:59:39 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp e42d1c540e Move single-file defines out of mission.h 2017-08-11 23:43:52 +00:00
Chris Taylor 48e9061960 Make the listbox handlers return a window_event_result
Make the listbox handlers and all sub-handlers (when_selected callbacks) return a window_event_result. Makes code more readable and removes one use of window_close, making it easier to inform event system if a window closes in future.
2016-10-27 15:22:41 +08:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR 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 -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp b449986ea8 Use make_unique to reset editor's Current_mission 2016-08-06 19:55:25 +00:00
Kp a230d24226 Allow trailing comments after num_levels and num_secrets 2016-07-30 21:56:31 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp 608cfdbf07 Combine Mission::enhanced with Mission::descent_version 2016-01-09 16:38:09 +00:00
Kp 309426e024 Use enum class for descent_version 2015-10-18 21:01:18 +00:00
Kp d971cf7702 Wrap game-specific types in game-specific preprocessor guards
These types are not used in common code, and in some cases would provoke
a -Wodr warning if they were used.
2015-09-26 21:17:12 +00:00
Kp 7840885473 Fix clang -Wparentheses-equality warnings 2015-03-22 18:49:21 +00:00
Kp d443e28147 Reuse mle_path as Mission_path 2015-01-15 04:30:03 +00:00
Kp 03370ed3e5 Use ntstring for Netgame.mission_name 2014-12-22 04:35:48 +00:00
Kp c1dc352a16 Pack Mission 2014-12-18 04:12:39 +00:00
Kp fea751bc62 Use std::string for mission path 2014-08-24 17:45:30 +00:00
Kp d945a95d47 Use std::default_delete<Mission> for Mission_ptr 2014-08-16 04:22:01 +00:00
Kp af912ea84d Use unique_ptr for level_names 2014-07-25 02:54:31 +00:00
Kp d1eaa1819c Use unique_ptr for secret_level_names 2014-07-25 02:54:31 +00:00
Kp 3bf30f9cf7 Use unique_ptr for secret_level_table 2014-07-25 02:54:31 +00:00
Kp 79708e14f4 Use unique_ptr for alternate_ham_file 2014-07-25 01:48:36 +00:00
Kp 6826e966a7 Use unique_ptr for Current_mission 2014-07-22 23:48:23 +00:00
zico ad7cb106bc Changed custom D1X license to GPLv3 2014-06-01 19:55:23 +02:00
Kp 073f00974a Eliminate uses of the typedef struct X { ... } X; pattern
C++ does not require this pattern.

import re, fileinput
to = re.compile(r'^typedef struct ([a-z_A-Z]+)\s*{')
tc = re.compile(r'^}(.*?)\s*([a-z_A-Z]+);$')
osn = None
for line in fileinput.input(inplace=True):
	m = to.match(line)
	if m:
		osn = m.group(1)
		print 'struct %s\n{' % osn
		continue
	if osn:
		m = tc.match(line)
		if m:
			csn = m.group(2)
			if osn == csn:
				print '}%s;' % m.group(1)
				osn = None
				continue
			else:
				osn = None
	print line,
2013-12-28 22:48:07 +00:00
Kp 9de54cfa74 Switch to C++ linkage
import fileinput
guard = 0
cxxguard = '#ifdef __cplusplus\n'
for line in fileinput.input(inplace=True):
	if line == cxxguard:
		guard = 1
		continue
	if guard:
		if line == 'extern "C" {\n':
			guard = 2
			continue
		if line == '}\n':
			guard = 0
			continue
		if guard == 2:
			assert(line == '#endif\n')
			guard = 0
			print cxxguard,
			continue
	print line,
2013-12-06 03:35:32 +00:00
Kp 3693743d41 Move similar/main/mission.c -> similar/main/mission.cpp 2013-10-20 22:49:12 +00:00
Kp 14d7c8cef4 Match MAX_SECRET_LEVELS_PER_MISSION type to N_secret_levels 2013-10-19 17:03:11 +00:00
Kp 4db024f953 Move similar/main/gamesave.c -> similar/main/gamesave.cpp 2013-10-05 21:35:58 +00:00
Kp a1ba420031 Mark various parameters and variables as const 2013-07-20 23:12:24 +00:00
Kp a842e15d94 Merge branch d2x-rebirth into unification/master
Conflicts:
	SConstruct
	common/include/editor/ehostage.h
	common/main/cntrlcen.h
	common/main/laser.h
	common/main/mission.h
	common/main/net_udp.h
	common/main/object.h
	main/vers_id.h
	similar/editor/kfuncs.c
	similar/main/inferno.c
	similar/main/lighting.c
	similar/main/multibot.c
	similar/main/newmenu.c
	similar/main/physics.c
2013-04-21 04:52:22 +00:00