Fix lifts

This commit is contained in:
Ryan Dwyer
2022-11-17 17:55:27 +10:00
parent c0276247fa
commit 6ef917d5d1
4 changed files with 13 additions and 6 deletions
+7 -5
View File
@@ -4563,7 +4563,9 @@ s32 glassCalculateOpacity(struct coord *pos, f32 xludist, f32 opadist, f32 arg3)
return opacity;
}
struct prop *g_Lifts[MAX_LIFTS] = {NULL};
struct prop *g_Lifts[MAX_LIFTS];
s32 g_NumLifts;
u8 g_LiftnumToIndex[MAX_LIFTS];
struct hovtype g_HovTypes[] = {
#if PAL
@@ -4673,9 +4675,9 @@ void func0f070ca0(struct defaultobj *obj, struct geotilef *tile, u32 flags, stru
void liftActivate(struct prop *prop, u8 liftnum)
{
if (liftnum > 0 && liftnum <= MAX_LIFTS) {
g_Lifts[liftnum - 1] = prop;
}
g_Lifts[g_NumLifts] = prop;
g_LiftnumToIndex[liftnum] = g_NumLifts;
g_NumLifts++;
}
struct prop *liftFindByPad(s16 padnum)
@@ -4684,7 +4686,7 @@ struct prop *liftFindByPad(s16 padnum)
return NULL;
}
return g_Lifts[g_Pads[padnum].liftnum - 1];
return g_Lifts[g_LiftnumToIndex[g_Pads[padnum].liftnum]];
}
f32 liftGetY(struct liftobj *lift)
+1 -1
View File
@@ -59,7 +59,7 @@ void propsTick(void)
shieldhitsTick();
chraTickBg();
for (i = 0; g_Lifts[i] != NULL; i++) {
for (i = 0; i < g_NumLifts; i++) {
liftTick(g_Lifts[i]);
}
+3
View File
@@ -181,8 +181,11 @@ void propsReset(void)
for (i = 0; i < ARRAYCOUNT(g_Lifts); i++) {
g_Lifts[i] = NULL;
g_LiftnumToIndex[i] = 0;
}
g_NumLifts = 0;
g_MaxWeaponSlots = 50;
g_MaxAmmoCrates = 20;
g_MaxDebrisSlots = 15;
+2
View File
@@ -272,6 +272,8 @@ extern struct autogunobj *g_ThrownLaptops;
extern struct beam *g_ThrownLaptopBeams;
extern s32 g_MaxThrownLaptops;
extern struct prop *g_Lifts[MAX_LIFTS];
extern s32 g_NumLifts;
extern u8 g_LiftnumToIndex[MAX_LIFTS];
extern u32 g_TvCmdlist00[];
extern u32 var8006aaa0[];
extern u32 var8006aae4[];