Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id_ca: Use filenames from EPISODE.CKx #64

Merged
merged 3 commits into from
Sep 28, 2024
Merged

id_ca: Use filenames from EPISODE.CKx #64

merged 3 commits into from
Sep 28, 2024

Conversation

sulix
Copy link
Owner

@sulix sulix commented Sep 22, 2024

@NY00123 Would something like this work as a replacement for #63? (Obviously there are a few tidy-ups, support for a few other files which would be required, but if the concept's sound, we can just change ca_mapFile et al.)

Instead of hardcoding the filenames for the various files needed by ID_CA (i.e., audio, graphics, and level files), load them from variables in EPISODE.CKx.

This gets rid of some AdjustExtension() calls, as well as making it easier for mods to use the different filenames produced by different tools (e.g. EDITMAPS, MAPTEMP, etc).

Note that this doesn't do anything fancy with the episode detection or anything yet, nor does it cover other files, outside ID_CA.

@NY00123
Copy link
Collaborator

NY00123 commented Sep 22, 2024

That looks good in idea. The removal of AdjustExtensions() calls is an advantage that I can see, indeed. As probably expected, Omnispeak as present in this revision will refuse to start without the added EPISODE.CKx definitions, but with them, it seems to load the data.

Question is in what manners may this have a part in case you decide to go for another way of loading mods, like selecting a directory or loading from a PK3 file.

A few notes about code changes that I've seen:

  • Is the modified call to MM_FreePtr correct?
  • Same with the removal of the string "AUDIOHED.EXT" that lacks a replacement?

@sulix sulix force-pushed the cafiles branch 2 times, most recently from 390fe80 to 2a1f60b Compare September 26, 2024 14:26
Instead of hardcoding the filenames for the various files needed by
ID_CA (i.e., audio, graphics, and level files), load them from variables
in EPISODE.CKx.

This gets rid of some AdjustExtension() calls, as well as making it
easier for mods to use the different filenames produced by different
tools (e.g. EDITMAPS, MAPTEMP, etc).

Note that this doesn't do anything fancy with the episode detection or
anything yet, nor does it cover other files, outside ID_CA.
The Quit() function is used to terminate the game on a fatal error, and
accepts a single string as its message (the normal end screen is
displayed if the message is NULL). However, we often would like to
provide extra diagnostic information in these circumstances, such as the
filename we couldn't load, or similar. This is particularly important as
more data moves to being loaded or defined at runtime, so can't be baked
into static strings.

The new QuitF() function behaves exactly like Quit(), but the message is
now a printf-style format string, and additional arguments can be
passed in afterwards.

For example:
QuitF("Couldn't load file %s!", filename)
@sulix sulix merged commit 86e391e into master Sep 28, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants