-
Notifications
You must be signed in to change notification settings - Fork 131
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
Heretic: Map Marker #1287
base: master
Are you sure you want to change the base?
Heretic: Map Marker #1287
Conversation
.. no saving considered yet.
.. since they are too clunky
.. and fix some whitespaces
.. copied over from Crispy-Doom, color changed to white.
src/heretic/g_game.c
Outdated
|
||
fclose(SaveGameFP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I have seen, there was no fclose called after loading a game, so I added it. If requested, I can also make this a separate PR later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, this was an oversight, better fix it ASAP. Is this already in Chocolate Heretic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and yes, this seems to have been forgotten upstream in Chocolate Heretic. It only checks the save game terminator and then the function ends, while before an fopen took place as ready-only when calling SV_OpenRead.
Chocolate Heretic g_game.c:
void G_DoLoadGame(void)
{
int i;
int a, b, c;
char savestr[SAVESTRINGSIZE];
char vcheck[VERSIONSIZE], readversion[VERSIONSIZE];
gameaction = ga_nothing;
SV_OpenRead(savename);
free(savename);
savename = NULL;
// Skip the description field
SV_Read(savestr, SAVESTRINGSIZE);
memset(vcheck, 0, sizeof(vcheck));
DEH_snprintf(vcheck, VERSIONSIZE, "version %i", HERETIC_VERSION);
SV_Read(readversion, VERSIONSIZE);
if (strncmp(readversion, vcheck, VERSIONSIZE) != 0)
{ // Bad version
return;
}
gameskill = SV_ReadByte();
gameepisode = SV_ReadByte();
gamemap = SV_ReadByte();
for (i = 0; i < MAXPLAYERS; i++)
{
playeringame[i] = SV_ReadByte();
}
// Load a base level
G_InitNew(gameskill, gameepisode, gamemap);
// Create leveltime
a = SV_ReadByte();
b = SV_ReadByte();
c = SV_ReadByte();
leveltime = (a << 16) + (b << 8) + c;
// De-archive all the modifications
P_UnArchivePlayers();
P_UnArchiveWorld();
P_UnArchiveThinkers();
P_UnArchiveSpecials();
if (SV_ReadByte() != SAVE_GAME_TERMINATOR)
{ // Missing savegame termination marker
I_Error("Bad savegame");
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do me a favour and fix this in Chocolate Doom first, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have removed it here and will create a PR for Chocolate Doom.
src/heretic/am_map.c
Outdated
markpoints[i].x = (int64_t)*p++; | ||
markpoints[i].y = (int64_t)*p++; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at EOF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newline has been added!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this, it's looking pretty good already!
Two general remarks:
- Please do not introduce dead code, as in: do not introduce new code just to have it commented out.
- The chances to mix up savegames between an ExMy and MAPxy level scheme, or between IWAD and PWAD levels, are negligible in Heretic. Thus, I don't think we will never need the first pass ext-savegame parsing at all. I'd be fine if you just remove all of this from the Heretic implementation.
I now removed it from the P_ReadExtendedSaveGameData but left it in place for the P_ReadKeyValuePairs and extsavegdata_t, so it can be easily brought back if we get some killer vanilla PWADs for Heretic some day. 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, looks good. Thank you!
I will do some final checks during the weekend and then set it to RfR. |
.. to avoid crash when drawing crosshair after new game / load and applying hires toggle.
Related Issue:
#1285
Changes Summary
Note: I opened it as Draft for now, since I still want to do some more testing but want to allow for a first review.