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

Allow editor switch entities #3236

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

Conversation

Bamcane
Copy link

@Bamcane Bamcane commented Mar 1, 2024

Why

Many mods have their own entities.In the past, if we needed to switch the entities, we need use the mod's entities.png to take the vanilla entities.png. Also, it spent more time to switch entities.
This PR solve that problem, be different from DDNet, mapper put their entities images in %APPDATA%/editor, and they need to press this button to open a file dialog
Screenshot
Then they could choose entities files
Screenshot
The Vanilla entities file is a link of data/editor/entities.png

Copy link
Contributor

@jtbx jtbx left a comment

Choose a reason for hiding this comment

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

Looks good for the most part, just a few nitpicks.

The commit message is a bit unclear, it should be reworded to "Allow switching the editor's entities". Make your changes and run git commit --amend.

if(!pEditor->Graphics()->LoadPNG(&ImgInfo, pFileName, StorageType))
return;

if((ImgInfo.m_Width % 16) || (ImgInfo.m_Height % 16))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove these brackets

Suggested change
if((ImgInfo.m_Width % 16) || (ImgInfo.m_Height % 16))
if(ImgInfo.m_Width % 16 || ImgInfo.m_Height % 16)

@@ -726,6 +728,8 @@ bool CEditor::PopupEvent(void *pContext, CUIRect View)
pEditor->UI()->DoLabel(&Label, "The map currently contains unsaved data; you may want to save it before you create a new map.\nContinue anyway?", 10.0f, TEXTALIGN_LEFT, Label.w-10.0f);
else if(pEditor->m_PopupEventType == POPEVENT_SAVE)
pEditor->UI()->DoLabel(&Label, "This file already exists.\nDo you want to overwrite it?", 10.0f, TEXTALIGN_LEFT);
else if(pEditor->m_PopupEventType == POPEVENT_ENTITIES)
pEditor->UI()->DoLabel(&Label, "The width or height of the entities texture is not divisible by 16", 10.0f, TEXTALIGN_LEFT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pEditor->UI()->DoLabel(&Label, "The width or height of the entities texture is not divisible by 16", 10.0f, TEXTALIGN_LEFT);
pEditor->UI()->DoLabel(&Label, "The dimensions of the entities image are not divisible by 16", 10.0f, TEXTALIGN_LEFT);

@@ -1282,6 +1287,14 @@ bool CEditor::PopupMenuFile(void *pContext, CUIRect View)
return true;
}

View.HSplitTop(10.0f, &Slot, &View);
View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_EntitiesButton, "Load Entities", 0, &Slot, 0, "Load a image as the editor game entities"))
Copy link
Contributor

Choose a reason for hiding this comment

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

"Load entities" looks much more natural

Suggested change
if(pEditor->DoButton_MenuItem(&s_EntitiesButton, "Load Entities", 0, &Slot, 0, "Load a image as the editor game entities"))
if(pEditor->DoButton_MenuItem(&s_EntitiesButton, "Load entities", 0, &Slot, 0, "Load an image as the editor's game entities"))

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.

None yet

2 participants