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

Mapvote GSC helpers #215

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

Mapvote GSC helpers #215

wants to merge 3 commits into from

Conversation

Rackover
Copy link
Contributor

What does this PR do?
Adds various GSC functions very useful to make a map voting menu, among other things

How does this PR change IW4x's behaviour?
Adds scripting functions

Anything else we should know?
Not sure if LocalizeText isn't already a thing, I think it isn't, pretty sure it isn't, but maybe someone will correct me on this

Did you check all the boxes?

  • [ X] Focus on a single fix or feature; remove any unrelated formatting or code changes
  • [X ] Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • [X ] Follow our coding conventions
  • [X ] Minimize the number of commits

@wroyca wroyca force-pushed the louve/feature-gsc-helpers branch from 9cd6d51 to 6d6b027 Compare January 25, 2025 00:26
@Rackover
Copy link
Contributor Author

Wait I think the function I call by raw address should probably be registered in Game.hpp instead or functions.hpp maybe
UI_GetGameTypeName or something 0x4EB0B0

This code/feature comes from my fork, where I have much less of a standard for cleanliness so, I did not realize this

{
if (Game::Scr_GetNumParam() != 2)
{
Game::Scr_Error("GetMapArenaInfo: Needs az map name and a field name!");
Copy link
Collaborator

Choose a reason for hiding this comment

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

"az" - typo?

Comment on lines +362 to +366
const char* str = Game::Scr_GetString(0);

const auto result = Game::UI_SafeTranslateString(str);

Game::Scr_AddString(result);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if Scr_GetString fails to retrieve a string? Can it fail to begin with, or is it safe to assume that it will always succeed?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a duplicate of https://github.com/iw4x/iw4x-client/blob/develop/src/Components/Modules/GSC/String.cpp#L148

istring can cast and localize strings that are preached by gsc. check that you are not accidentally making a dupe (code may be different but could be functionally the same)

@wroyca wroyca marked this pull request as draft January 26, 2025 17:32
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