-
Notifications
You must be signed in to change notification settings - Fork 76
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
base: port
Are you sure you want to change the base?
Conversation
@@ -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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
To be honest, I think 10 is more than sufficient. :P |
You haven't met my kid 😀 |
I still feel like there should be a limiter option for this lol. |
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.