The-New-Platinum-Team / PlatinumQuest-Dev

The main repository for the game PlatinumQuest after the formation of new development team.
MIT License
14 stars 8 forks source link

Level Templates #98

Closed TheGreatAutismo closed 1 year ago

TheGreatAutismo commented 1 year ago

Added barebones level templates for the 4 bundled games May add more decoration to each of them and/or just more level templates for certain gamemodes or something, but this is decent as it is.

thearst3rd commented 1 year ago

There are still a few references to MissionTemplate.mis, so removing it without changing those references will cause problems. Particularly I've found the following:

1) In platinum/core/editor/editorgui.cs on line 320, in the second half of the long if statement:

function EditorSaveMission() {
    if ($Server::MissionFile $= ($usermods @ "/data/multiplayer/hunt/custom/ExampleMission.mis") || $Server::MissionFile $= ($usermods @ "/data/missions/MissionTemplate.mis")) {
        EditorSaveMissionAs();
        return;
    }
    ...

Basically, if you're trying to save and you're using the template, it will do a save as instead which makes sense. This should be updated to use all four of the templates. My guess is it would be convenient to make a function isTemplateMission(%missionFile) which takes in a filename and returns true if it's one of the templates.

There is also an "ExampleMission.mis" for multiplayer maps. Should that be replaced with four multiplayer templates as well?

2) Also in platinum/core/editor/editorgui.cs, on line 434:

function EditorDoNewMission(%saveFirst) {
    if (%saveFirst)
        EditorSaveMission();

    %file = $Server::ServerType $= "MultiPlayer" ? "ExampleMission.mis" : "MissionTemplate.mis";
    %mission = findFirstFile("*/" @ %file);
    if (%mission $= "") {
        MessageBoxOk("Error", "Missing mission template \"" @ %file @ "\".");
        return;
    }
    ...

This will cause a problem since it will try to create a new mission through the level editor, since it is using the old template which doesn't exist anymore. There is an if statement right below which will catch it and display an appropriate error message, so at least it shouldn't be cryptic. _Actually when trying it, it works, since platinum/data/missions_pq/custom/MissionTemplate.mis exists and the findFirstFile found that file... That file should probably also be removed?_ Regardless, it should be addressed. We will probably need to create a new dialog which asks which template a user want to use when creating a new mission.

3) In platinum/core/editor/functions/createNewMission.cs on line 217:

function createEmptyMission(%name) {
    $Editor::Enabled = 1; // Because I don't know which var to use anymore D:

    exec($usermods @ "/data/missions/MissionTemplate.mis");
    MissionInfo.name = %name;

    return MissionGroup;
}

Again more issues when trying to create a mission - this one just straight up crashed my game when I tried creating a mission with the "Editor" -> "Create New" button from the PlayMissionGui. A new option should be added to the dialog that pops up, asking the user which template they want to use.

So a bit more work needs to be done before this PR is merged. Also, nitpick, but the Gold template image screenshots should probably be taken with no shaders/texture packs, to be consistent with the rest of the gold levels.

RandomityGuy commented 1 year ago

Is there anything else remaining in this?

thearst3rd commented 1 year ago

This PR should be targetted at the dev branch, and might need a cherry-pick if it was branched off of master to begin with. Also I thought that Connie looked at the PR and addressed some of the changes I asked for, but I don't see them reflected here so it might be in a different branch

TheGreatAutismo commented 1 year ago

I'll mess with this soon to correctly merge this into dev instead of master

thearst3rd commented 1 year ago

I created a new branch dev-yoshi-level-templates off of dev, and cherry-picked the three commits that were on this branch. That branch should be merged instead of this one.

thearst3rd commented 1 year ago

Closing in favor of #120 (also this PR was from your fork anyway and didn't have Connie's changes)