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

Heretic: Map Marker #1287

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft

Conversation

Noseey
Copy link

@Noseey Noseey commented Mar 23, 2025

Related Issue:
#1285

Changes Summary

  • Brought back map markers.
  • Enabled automap crosshair when followplayer is off.
  • Introduced extsaveg for Heretic.

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.


fclose(SaveGameFP);
Copy link
Author

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.

Copy link
Owner

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?

Copy link
Author

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");
    }
}

Copy link
Owner

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?

Copy link
Author

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.

markpoints[i].x = (int64_t)*p++;
markpoints[i].y = (int64_t)*p++;
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

Missing newline at EOF.

Copy link
Author

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!

Copy link
Owner

@fabiangreffrath fabiangreffrath left a 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.

@Noseey
Copy link
Author

Noseey commented Mar 24, 2025

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. 😉

Copy link
Owner

@fabiangreffrath fabiangreffrath left a 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!

@Noseey
Copy link
Author

Noseey commented Mar 26, 2025

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.
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