Introduce g_LasersightsActive

This commit is contained in:
Ryan Dwyer 2022-11-13 15:44:14 +10:00
parent 4a5c4c736b
commit 45df96a546
5 changed files with 11 additions and 2 deletions

View File

@ -7601,7 +7601,7 @@ void bgunRender(Gfx **gdlptr)
gdl = vi0000b0e8(gdl, 60, f2);
}
if (PLAYERCOUNT() == 1) {
if (g_LasersightsActive && PLAYERCOUNT() == 1) {
gdl = lasersightRenderBeam(gdl);
}

View File

@ -25,6 +25,7 @@ struct boltbeam g_BoltBeams[8];
struct lasersight g_LaserSights[4];
s32 g_BeamsActive;
s32 g_LasersightsActive;
void beamCreate(struct beam *beam, s32 weaponnum, struct coord *from, struct coord *to)
{
@ -1391,6 +1392,7 @@ void lasersightSetBeam(s32 id, s32 arg1, struct coord *near, struct coord *far)
}
g_LaserSights[i].id = id;
g_LasersightsActive++;
}
g_LaserSights[i].unk04 = *near;
@ -1422,5 +1424,6 @@ void lasersightFree(s32 arg0)
if (lasersightExists(arg0, &i)) {
g_LaserSights[i].id = -1;
g_LasersightsActive--;
}
}

View File

@ -30,4 +30,6 @@ void lasersightsReset(void)
for (i = 0; i < 4; i++) {
g_LaserSights[i].id = -1;
}
g_LasersightsActive = 0;
}

View File

@ -4176,7 +4176,10 @@ Gfx *playerRenderHud(Gfx *gdl)
bgunTickGameplay2();
gdl = boltbeamsRender(gdl);
bgunRender(&gdl);
gdl = lasersightRenderDot(gdl);
if (g_LasersightsActive) {
gdl = lasersightRenderDot(gdl);
}
if (g_Vars.currentplayer->visionmode != VISIONMODE_XRAY) {
gdl = bgRenderArtifacts(gdl);

View File

@ -289,6 +289,7 @@ extern struct bossfile g_BossFile;
extern struct chrdata *g_MpBotChrPtrs[MAX_BOTS];
extern bool g_AmActive;
extern s32 g_BeamsActive;
extern s32 g_LasersightsActive;
extern bool g_StarsActive;
extern u8 g_HudmsgsActive;
extern struct roommtx *g_RoomMtxes;