-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
||
/** | ||
* Attempt to call a lift from the given door. | ||
|
@@ -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 commentThe 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. |
||
|
||
do { | ||
laptop = &g_ThrownLaptops[laptopIndex]; | ||
laptopIndex++; | ||
} while (laptop->base.prop); | ||
|
||
if (laptop->base.prop) { | ||
#if VERSION >= VERSION_NTSC_1_0 | ||
|
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