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

Added some console commands. #213

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

Conversation

AdamPlenty
Copy link

@AdamPlenty AdamPlenty commented Aug 31, 2020

These are commands for, amongst other things, creating things, placing slabs, testing stuff such as sound, and manipulating things such as creature health and the creature pool.

Also added an optional 4th parameter to creature.create specifying the number of creatures to generate.
For giving multiple traps or doors at once.
gameadd.classic_bugs_flags is a word, not a dword.
Including one to restart the level (thanks to Ed).
Unlike the cheat menu, this lets you place non-standard terrain.
Useful for comparing what ADiKtEd does to what the game does.
@AdamPlenty AdamPlenty marked this pull request as ready for review January 5, 2021 02:56
Copy link
Owner

@Loobinex Loobinex left a comment

Choose a reason for hiding this comment

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

I think there are many, many useful commands here. I'm assuming though that this can no longer be merged into the new master without handling several conflicts.

Also, for further testing and future use, could you document it like this here:
https://github.com/dkfans/keeperfx/wiki/Console-commands

src/console_cmd.c Outdated Show resolved Hide resolved
src/config_campaigns.h Show resolved Hide resolved
src/config_rules.h Show resolved Hide resolved
if (load_game(slot_num))
{
player = get_player(plyr_idx);
set_flag_byte(&game.operation_flags,GOF_Paused,false); // unpause, because games are saved whilst puased
Copy link
Owner

Choose a reason for hiding this comment

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

typo: paused

}
else {
JUSTLOG("No campaign specified. Default campaign loaded for selected level (%d).", start_params.selected_level_number);
ERRORLOG("Unable to load campaign associated with the specified level CMD Line parameter, default loaded.");
Copy link
Owner

Choose a reason for hiding this comment

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

Is this really an error? Won't this happen if you simply use -level without specifying the campaign?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure. I think I had some help doing the restart level feature.

@@ -4513,9 +4535,18 @@ void wait_at_frontend(void)
if ((game.operation_flags & GOF_SingleLevel) != 0)
{
faststartup_network_game();
if (restart_level)
Copy link
Owner

Choose a reason for hiding this comment

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

This is looking really weird. Could you explain?

Copy link
Author

Choose a reason for hiding this comment

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

What's weird about it?

Copy link
Owner

Choose a reason for hiding this comment

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

if (restart_level) {
        restart_level = false;
        }

Do both of these need to be restart_level? Why would you even need the if statement in this case, you could just set restart_level to false if not. I'm thinking you want one to reference a function and the other to a variable, and if that's the case, you want to have them be different names.

Copy link
Author

Choose a reason for hiding this comment

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

One of the if (restart_level)s is in another if statement and before a return statement (though I suppose I could move this to before that if statement).

Which one should reference a function? restart_level is a boolean variable.

src/packets.c Show resolved Hide resolved
@@ -255,7 +255,8 @@ TbBool slab_kind_is_animated(SlabKind slbkind)
{
if (slab_kind_is_door(slbkind))
return true;
if ((slbkind == SlbT_GUARDPOST) || (slbkind == SlbT_BRIDGE) || (slbkind == SlbT_GEMS))
// if ((slbkind == SlbT_GUARDPOST) || (slbkind == SlbT_BRIDGE) || (slbkind == SlbT_GEMS))
if (slbkind >= 50)
Copy link
Owner

Choose a reason for hiding this comment

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

Are we really sure all slabs over 50 are animated?
And even if we are, it would still be better to refer to the enum value of 50, so that if slabs are added in between the function keeps working as expected.

Copy link
Author

Choose a reason for hiding this comment

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

It seems to me that all slabs over 50 are animated.

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