port: add scanline effects for NV and IR goggles and slayer

This commit is contained in:
fgsfds committed 2023-09-17 23:53:12 +02:00
1 parent c3f572f016
commit 31bb7c62ad
4 files changed
+69 -29

No files matched your search

+69 -1
View File
@@ -363,6 +363,7 @@ Gfx *bviewDrawSlayerRocketInterlace(Gfx *gdl, u32 colour, u32 alpha)
gdl = bviewPrepareStaticRgba16(gdl, colour, alpha);
#ifdef PLATFORM_N64
for (y = viewtop; y < viewtop + viewheight; y++) {
s32 offsety = y - offset;
@@ -378,6 +379,26 @@ Gfx *bviewDrawSlayerRocketInterlace(Gfx *gdl, u32 colour, u32 alpha)
angle += increment;
}
#else
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPSetExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
for (y = viewtop; y < viewtop + viewheight; y++) {
s32 offsety = y - offset;
if (offsety % 8 == 0 || y == viewtop) {
if (offsety % 16 < 8) {
gDPSetPrimColor(gdl++, 0, 0, 0xff, 0xff, 0x00, 0xff);
} else {
gDPSetPrimColor(gdl++, 0, 0, 0xff, 0xff, 0xbf, 0xff);
}
}
gDPFillRectangle(gdl++, viewleft, y, viewleft + viewwidth, y + 1);
}
gSPClearExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
#endif
return gdl;
}
@@ -429,7 +450,6 @@ Gfx *bviewDrawFilmInterlace(Gfx *gdl, u32 colour, u32 alpha)
}
#else
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
gSPSetExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
for (y = viewtop; y < viewtop + viewheight; y++) {
@@ -2026,6 +2046,7 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
var8007f878++;
#ifdef PLATFORM_N64
for (y = viewtop; y < viewbottom; y++) {
u8 green;
@@ -2040,6 +2061,27 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
gdl = bviewCopyPixels(gdl, fb, y, 5, y, 1, viewleft, viewwidth);
}
#else
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPSetExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
for (y = viewtop; y < viewbottom; y++) {
u8 green;
if (((var8007f878 & 1) != (y & 1)) != 0) {
u8 tmp = random() % 12;
green = 0xff - tmp;
} else {
green = 0x94;
}
gDPSetPrimColorViaWord(gdl++, 0, 0, (green << 16) + 0xff);
gDPFillRectangle(gdl++, viewleft, y, viewleft + viewwidth, y + 1);
}
gSPClearExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
#endif
return gdl;
}
@@ -2189,6 +2231,11 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
sqinnerradius = innerradius * innerradius;
#ifndef PLATFORM_N64
gDPSetCombineMode(gdl++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPSetExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
#endif
for (i = scantop; i < scanbottom; i++) {
#if VERSION >= VERSION_NTSC_1_0
if (i & 1) {
@@ -2210,7 +2257,11 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
red = 255;
}
#ifdef PLATFORM_N64
gDPSetEnvColorViaWord(gdl++, (red << 24) + 0xff);
#else
gDPSetPrimColorViaWord(gdl++, 0, 0, (red << 24) + 0xff);
#endif
a0 = viewcentrey - i;
@@ -2222,6 +2273,7 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
s32 semicircleright = viewcentrex + semicirclewidth;
s32 rightsidewidth = viewwidth - semicircleright;
#ifdef PLATFORM_N64
// Left and right of semicircle
gdl = bviewCopyPixels(gdl, fb, i, 5, i, 1.0f, viewleft, viewcentrex);
gdl = bviewCopyPixels(gdl, fb, i, 5, i, 1.0f, semicircleright, rightsidewidth);
@@ -2232,6 +2284,18 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
} else {
gdl = bviewCopyPixels(gdl, fb, i, 5, i, 1.0f, viewleft, viewwidth);
}
#else
// Left and right of semicircle
gDPFillRectangle(gdl++, viewleft, i, viewcentrex, i + 1);
gDPFillRectangle(gdl++, semicircleright, i, semicircleright + rightsidewidth, i + 1);
// The semicircle itself has a static colour
gDPSetPrimColorViaWord(gdl++, 0, 0, 0xee0000ff);
gDPFillRectangle(gdl++, viewcentrex, i, viewcentrex + semicirclewidth, i + 1);
} else {
gDPFillRectangle(gdl++, viewleft, i, viewleft + viewwidth, i + 1);
}
#endif
#if VERSION >= VERSION_NTSC_1_0
if (g_IrScanlines[g_Vars.currentplayernum][i] > fadeincrement) {
@@ -2244,6 +2308,10 @@ Gfx *bviewDrawIrLens(Gfx *gdl)
#endif
}
#ifndef PLATFORM_N64
gSPClearExtraGeometryModeEXT(gdl++, G_MODULATE_EXT);
#endif
#ifdef AVOID_UB
if (g_Menus[mpindex].curdialog == NULL) {
gdl = bviewDrawMotionBlur(gdl, 0xff000000, 0x40);
-3
View File
@@ -1185,9 +1185,6 @@ Gfx *lvRender(Gfx *gdl)
}
gdl = viRenderViewportEdges(gdl);
#ifndef PLATFORM_N64
gdl = playerSetVisionMode(gdl);
#endif
gdl = skyRender(gdl);
bgTick();
lightsTick();
-22
View File
@@ -4517,28 +4517,6 @@ Gfx *playerRenderShield(Gfx *gdl)
return gdl;
}
#ifndef PLATFORM_N64
Gfx *playerSetVisionMode(Gfx *gdl)
{
u32 grayscale = G_OFF;
if (!g_InCutscene && g_Vars.currentplayer && !g_Vars.currentplayer->isdead &&
(!g_Vars.currentplayer->eyespy || (g_Vars.currentplayer->eyespy && !g_Vars.currentplayer->eyespy->active))) {
if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_NIGHTVISION) {
grayscale = G_ON;
gDPSetGrayscaleColorEXT(gdl++, 0x00, 0xFF, 0x00, 0xFF);
} else if ((g_Vars.currentplayer->devicesactive & ~g_Vars.currentplayer->devicesinhibit) & DEVICE_IRSCANNER) {
grayscale = G_ON;
gDPSetGrayscaleColorEXT(gdl++, 0xFF, 0x00, 0x00, 0xFF);
}
}
gDPGrayscaleEXT(gdl++, grayscale);
return gdl;
}
#endif
Gfx *playerRenderHud(Gfx *gdl)
{
if (g_Vars.currentplayer->cameramode == CAMERAMODE_THIRDPERSON) {
-3
View File
@@ -106,8 +106,5 @@ void playerSetCamPropertiesWithRoom(struct coord *pos, struct coord *up, struct
void playerSetCamPropertiesWithoutRoom(struct coord *pos, struct coord *up, struct coord *look, s32 room);
void playerSetCamProperties(struct coord *pos, struct coord *up, struct coord *look, s32 room);
void playerClearMemCamRoom(void);
#ifndef PLATFORM_N64
Gfx *playerSetVisionMode(Gfx *gdl);
#endif
#endif