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

1264 GTD OPD Map Loading #207

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

UTengine
Copy link
Contributor

1264 GTD and OPD Map loading.

  1. Speaks for itself, or refer to posted image.
  2. Copy objects directory from 1264 myko client, and zones directory.
  3. Make sure DTEX is copied, and there's 1-2 new river files in misc\river which will be needed and probably misc\sky\ moradon.n3sky.
  4. Use the zones.tbl from the zip I posted here and replace the data\zones.tbl.
  5. Loading into the game will trigger a ASSERT warning that Moradon.birds can't be found which can be ignored.

1264 Patch.zip
💔Thank you!

image
This is currently a draft request so please review.

Copy link
Member

@stevewgr stevewgr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @UTengine, thanks for the PR.
I'd rather we don't just enforce map headers 12xx. We can make it load all formats by doing simple checks. Reason why, because tools rely on this implementation too, plus it would be nice having the ability to switch between map assets regardless of their versions.
We can try reading the map files header assuming they're 12xx and if the data doesn't make sense, jump back to the beginning of the file and try reading as 10xx.
This is far from complete. Also ideally we store the file version somewhere in CN3BaseFileAccess, so that we can then do this once to save CPU cycles.

@UTengine
Copy link
Contributor Author

That's what I did with the previous commits months ago, those were never merged too >.>

int TempVersion, TempIntStringLength;
ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version
ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length
CHAR * TempGTDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things to point out here:

  1. Not sure why we're using Windows' CHAR here instead of just char
  2. If this is to be allocated on the heap, it might as well just use std::string like everything else (or well, that aren't the silly std::vector<char> implementations). As it is, it's just leaking memory.
  3. The naming here is a bit strange. Why TempVersion etc as opposed to MapVersion or some such, specifically: why are we referring to them as temporary vars?
    On this note, the version is being thrown away here -- when it in fact needs to be used by CN3Pond, which leads me to my next point:
  4. This is incomplete -- CN3Pond will fail to read its portion of the file correctly, as it is the only other thing updated in this version. Specifically for versions 2+ (which 1.264 does support), which is why it needs to use the version from here.

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.

3 participants