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 users to set up more than one Laptop Gun sentry #446

Draft
wants to merge 1 commit into
base: port
Choose a base branch
from

Conversation

blaiz
Copy link

@blaiz blaiz commented May 20, 2024

Here's a draft PR to allows users to set up up to 1000 sentry guns instead of just one. This can be fun in multiplayer, where you can have a level covered with sentries everywhere.

This is a draft PR just to gauge interest. If this is something we'd want, this would likely need to be a setting somewhere, or potentially a cheat. I'm not sure how that would work since the game allocates memory for a certain number of sentries, so I don't know how to make that dynamic yet but I can spend a bit of time and figure that out if there's interest.

As it currently is, this game works well most of the time but the game does crash sometimes.

Screenshot 2023-11-20 002111

Screenshot 2023-11-24 185652

@@ -134,6 +134,7 @@ s32 g_LastPadEffectIndex = -1;
struct autogunobj *g_ThrownLaptops = NULL;
struct beam *g_ThrownLaptopBeams = NULL;
s32 g_MaxThrownLaptops = 0;
s32 g_MaxThrownLaptopsPerPlayer = 1000;
Copy link
Author

Choose a reason for hiding this comment

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

Each user can now set up up to 1000 sentry guns

@@ -18471,7 +18472,12 @@ struct autogunobj *laptopDeploy(s32 modelnum, struct gset *gset, struct chrdata
if (index >= 0 && index < g_MaxThrownLaptops) {
setupLoadModeldef(modelnum);
modeldef = g_ModelStates[modelnum].modeldef;
laptop = &g_ThrownLaptops[index];
s32 laptopIndex = index * g_MaxThrownLaptopsPerPlayer;
Copy link
Author

Choose a reason for hiding this comment

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

This is when the user sets up a new sentry. All sentries are stored in one big array, so now that each player can have multiple, let's multiply the player index with the number of sentries per player to find the start of the searching space. Then let's iterate over the space allocated for that user until we find a free space to store that new sentry gun in memory.

@FrostKnight
Copy link

To be honest, I think 10 is more than sufficient. :P

@blaiz
Copy link
Author

blaiz commented Oct 2, 2024

You haven't met my kid 😀
Unfortunately I think this change makes the game crash randomly every once in a while.

@FrostKnight
Copy link

You haven't met my kid 😀 Unfortunately I think this change makes the game crash randomly every once in a while.

I still feel like there should be a limiter option for this lol.

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.

2 participants