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

Add custom item system (nnextcitem.cpp, nnextcitem.h) #893

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

NoOneBlood
Copy link
Collaborator

Replace IniFile class (inifile.cpp, inifile.h)

@tmyqlfpir
Copy link
Collaborator

Please replace the tab in the makefile with spaces, thanks!

@Hendricks266 Hendricks266 self-requested a review January 22, 2025 08:17
@NoOneBlood
Copy link
Collaborator Author

Any other notes or i can merge it?

Copy link
Collaborator

@Hendricks266 Hendricks266 left a comment

Choose a reason for hiding this comment

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

Can you tell me a little bit about the changes to the INI parser? Did you change or expand the grammar and syntax of the file, beyond the addition of new fields?

Comment on lines +2472 to +2479
if (VanillaMode())
{
if (gUserItemsInitialized)
{
userItemsUninit();
gUserItemsInitialized = 0;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused. If this functionality is entirely new, why would VanillaMode do anything at all here?

Comment on lines +93 to +99
inline char PutKeyString(const char* section, const char* hiWord, const char* loWord = NULL) { return (KeyAdd(section, hiWord, loWord) >= 0); }
inline char GetKeyBool(const char *section, const char *key, int nRetn) { return (GetKeyInt(section, key, nRetn) != 0); }
inline int GetKeyHex(const char *section, const char *key, int nRetn) { return GetKeyInt(section, key, nRetn); }
inline char KeyExists(const char* section, const char* key) { return (KeyFind(section, key) >= 0); }
inline char SectionExists(const char* name) { return (SectionFind(name) >= 0); }
inline char FindSection(const char* name) { return (SectionFind(name) >= 0); }
inline void RemoveSection(const char* name) { SectionRemove(name); }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix the formatting here

Comment on lines +35 to +49
void strTrim(char* str, char side = 0x03)
{
head.next = &head;
int l = strlen(str);
int c;

if (side & 0x01)
{
c = 0;
while(str[c] && isspace(str[c])) c++;
if (c)
memcpy(str, &str[c], l - c + 1), l-=c;
}


if (side & 0x02)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these magic constants for side be INI_SKIPCM, INI_SKIPZR, etc?

Comment on lines +89 to +96
kItemGroupItem = 0,
kItemGroupWeapon,
kItemGroupAmmo,
kItemGroupArmor,
kItemGroupHealth,
kItemGroupPowerup,
kItemGroupKey,
kItemGroupMax,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you fix the indentation of the enums in this file?

struct ITEM
{
char *name, *message;
uint8_t group, type;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formatting

static char SetupActionLimits(ITEM::ACTION* pAct, char extLimits);
static char SetupAction(const char* str, int nOperator, int nAction);
static char SetupFlags(const char* str);
static char SetupRespawn(const char* str);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formatting

static char showLog;
//-------------------------------------------------------------------------------
static int Setup(IniFile* pFile);
static void ClearItem(ITEM* pItem);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formatting

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