disable xlu surface hits with a global to avoid initialization errors with struct flag

This commit is contained in:
joshuarwood committed 2025-11-07 18:38:27 -06:00
1 parent 550f1d3182
commit f5cbfe6692
3 files changed
+11 -7

No files matched your search

+11 -1
View File
@@ -135,6 +135,9 @@ s32 g_BgMostAttemptedDrawSlots = 0;
s32 g_BgNumRoomLoadCandidates = 0;
u16 g_BgFrameCount = 0xfffe;
s32 g_BgNumPortalCameraCacheItems = 0;
#ifndef PLATFORM_N64
bool g_BgHitXluDisabled = false;
#endif
void bgUnpausePropsInRoom(u32 roomnum, bool tintedglassonly)
{
@@ -4591,7 +4594,7 @@ bool bgTestHitInRoom(struct coord *frompos, struct coord *topos, s32 roomnum, st
for (i = 0; i < numbatches; batch++, i++) {
#ifndef PLATFORM_N64
if (hitthing->ignore_xlu && batch->type == VTXBATCHTYPE_XLU)
if (g_BgHitXluDisabled && batch->type == VTXBATCHTYPE_XLU)
continue;
#endif
j = bg0f1612e4(&batch->bbmin, &batch->bbmax, &from, &dist, &sp94, &hitthing->pos);
@@ -6421,6 +6424,10 @@ void bgCalculateGlaresForVisibleRooms(void)
g_NumRoomsWithGlares = 0;
// disable line-of-sight hits for transparent background
// surfaces before testing for light obstructions
g_BgHitXluDisabled = true;
if (!g_Vars.mplayerisrunning) {
for (i = 1; i < g_Vars.roomcount; i++) {
if (g_Rooms[i].flags & ROOMFLAG_ONSCREEN) {
@@ -6431,6 +6438,9 @@ void bgCalculateGlaresForVisibleRooms(void)
}
}
}
// re-enable background hits for transparent surfaces
g_BgHitXluDisabled = false;
}
#endif
-3
View File
@@ -993,9 +993,6 @@ bool shotTestLos(struct coord *gunpos2d, struct coord *gundir2d, struct coord *g
RoomNum *roomsptr;
struct prop *prop;
// ignore transparent surfaces
hitthing.ignore_xlu = 1;
shotdata.gunpos3d.x = gunpos3d->x;
shotdata.gunpos3d.y = gunpos3d->y;
shotdata.gunpos3d.z = gunpos3d->z;
-3
View File
@@ -5750,9 +5750,6 @@ struct hitthing {
s16 unk28;
s16 texturenum;
s16 unk2c;
#ifndef PLATFORM_N64
s16 ignore_xlu;
#endif
};
struct hit {