mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
Fix "mpindex=4" UB cases for various view gadgets
This commit is contained in:
1 parent
889ae950fe
commit
43a91b2b4b
1 file changed
+18
@@ -1952,6 +1952,9 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
|
||||
s32 viewbottom = viewtop + viewheight;
|
||||
s32 brightness;
|
||||
s32 y;
|
||||
#ifdef AVOID_UB
|
||||
u32 mpindex = g_Vars.currentplayerstats->mpindex % MAX_PLAYERS;
|
||||
#endif
|
||||
|
||||
var8007f840++;
|
||||
|
||||
@@ -1973,9 +1976,15 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
|
||||
skySetOverexposure(brightness, brightness, brightness);
|
||||
}
|
||||
|
||||
#ifdef AVOID_UB
|
||||
if (g_Menus[mpindex].curdialog == NULL) {
|
||||
gdl = bviewDrawMotionBlur(gdl, 0x00ff0000, 0x60);
|
||||
}
|
||||
#else
|
||||
if (g_Menus[g_Vars.currentplayerstats->mpindex].curdialog == NULL) {
|
||||
gdl = bviewDrawMotionBlur(gdl, 0x00ff0000, 0x60);
|
||||
}
|
||||
#endif
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
|
||||
@@ -2034,6 +2043,9 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
|
||||
s32 viewcentrey;
|
||||
f32 viewheightf;
|
||||
s32 a0;
|
||||
#ifdef AVOID_UB
|
||||
u32 mpindex = g_Vars.currentplayerstats->mpindex % MAX_PLAYERS;
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
static s32 fsscanline = 0;
|
||||
@@ -2198,9 +2210,15 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AVOID_UB
|
||||
if (g_Menus[mpindex].curdialog == NULL) {
|
||||
gdl = bviewDrawMotionBlur(gdl, 0xff000000, 0x40);
|
||||
}
|
||||
#else
|
||||
if (g_Menus[g_Vars.currentplayerstats->mpindex].curdialog == NULL) {
|
||||
gdl = bviewDrawMotionBlur(gdl, 0xff000000, 0x40);
|
||||
}
|
||||
#endif
|
||||
|
||||
return gdl;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user