mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
Merge pull request #300 from Bobbar/port_crosshair_alpha
Crosshair Alpha Proof of Concept
This commit is contained in:
9 files changed
+259
No files matched your search
@@ -1178,6 +1178,9 @@ bool menuIsItemFocusable(struct menuitem *item, struct menudialog *dialog, s32 a
|
||||
case MENUITEMTYPE_METER:
|
||||
case MENUITEMTYPE_MARQUEE:
|
||||
case MENUITEMTYPE_CONTROLLER:
|
||||
#ifndef PLATFORM_N64
|
||||
case MENUITEMTYPE_COLORBOX:
|
||||
#endif
|
||||
return false;
|
||||
case MENUITEMTYPE_10:
|
||||
case MENUITEMTYPE_14:
|
||||
|
||||
@@ -2109,6 +2109,36 @@ Gfx *menuitemMeterRender(Gfx *gdl, struct menurendercontext *context)
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
|
||||
// Draws a colored box which fills the background of the menu item.
|
||||
Gfx* menuitemColorBoxRender(Gfx *gdl, struct menurendercontext *context)
|
||||
{
|
||||
u32 width = context->width;
|
||||
u32 height = context->height;
|
||||
u32 colour1;
|
||||
s32 x1;
|
||||
s32 x2;
|
||||
|
||||
x1 = context->x;
|
||||
x2 = x1 + width;
|
||||
|
||||
union handlerdata data;
|
||||
if (context->item->handlervoid) {
|
||||
context->item->handlervoid(MENUOP_GETCOLOUR, context->item, &data);
|
||||
}
|
||||
|
||||
colour1 = data.label.colour1;
|
||||
|
||||
gdl = textSetPrimColour(gdl, colour1);
|
||||
gDPFillRectangleScaled(gdl++, x1, context->y, x2, context->y + height);
|
||||
gdl = text0f153838(gdl);
|
||||
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Gfx *menuitemSelectableRender(Gfx *gdl, struct menurendercontext *context)
|
||||
{
|
||||
u32 leftcolour;
|
||||
@@ -4349,6 +4379,11 @@ Gfx *menuitemRender(Gfx *gdl, struct menurendercontext *context)
|
||||
case MENUITEMTYPE_CAROUSEL: return menuitemCarouselRender(gdl, context);
|
||||
case MENUITEMTYPE_MODEL: return menuitemModelRender(gdl, context);
|
||||
case MENUITEMTYPE_CONTROLLER: return menuitemControllerRender(gdl, context);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
case MENUITEMTYPE_COLORBOX: return menuitemColorBoxRender(gdl, context);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return gdl;
|
||||
|
||||
@@ -122,6 +122,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
|
||||
.crosshairsway = 1.f, \
|
||||
.crouchmode = CROUCHMODE_TOGGLE_ANALOG, \
|
||||
.extcontrols = true, \
|
||||
.crosshaircolour = 0x00ff0028, \
|
||||
}
|
||||
|
||||
struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
|
||||
|
||||
@@ -459,7 +459,11 @@ Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colou
|
||||
s32 viewright = viewleft + viewwidth - 1;
|
||||
s32 viewbottom = viewtop + viewheight - 1;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gdl = textSetPrimColour(gdl, PLAYER_EXTCFG().crosshaircolour);
|
||||
#else
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
x = sightGetAdjustedX(x);
|
||||
@@ -619,7 +623,11 @@ Gfx *sightDrawDelayedAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u3
|
||||
boxx = xpos;
|
||||
boxy = ypos;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gdl = textSetPrimColour(gdl, PLAYER_EXTCFG().crosshaircolour);
|
||||
#else
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
#endif
|
||||
|
||||
// Fill a 3x3 box at the live crosshair
|
||||
gDPHudRectangle(gdl++, x - 1, y - 1, x + 1, y - 1);
|
||||
@@ -677,7 +685,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
|
||||
// SIGHTTRACKTYPE_NONE is used for unarmed, but this appears to be
|
||||
// unreachable. The aimer is never drawn when unarmed.
|
||||
if (sighton) {
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
colour = PLAYER_EXTCFG().crosshaircolour;
|
||||
#else
|
||||
colour = 0x00ff0028;
|
||||
#endif
|
||||
|
||||
radius = 8;
|
||||
cornergap = 5;
|
||||
gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
|
||||
@@ -687,7 +701,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
|
||||
// For most guns, render the aimer if holding R
|
||||
if (sighton) {
|
||||
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
colour = PLAYER_EXTCFG().crosshaircolour;
|
||||
#else
|
||||
colour = 0x00ff0028;
|
||||
#endif
|
||||
|
||||
radius = 8;
|
||||
cornergap = 5;
|
||||
} else {
|
||||
@@ -716,7 +736,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
|
||||
s32 texty;
|
||||
|
||||
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
colour = PLAYER_EXTCFG().crosshaircolour;
|
||||
#else
|
||||
colour = 0x00ff0028;
|
||||
#endif
|
||||
|
||||
radius = 8;
|
||||
cornergap = 5;
|
||||
} else {
|
||||
@@ -761,7 +787,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
|
||||
|
||||
if (sighton) {
|
||||
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
colour = PLAYER_EXTCFG().crosshaircolour;
|
||||
#else
|
||||
colour = 0x00ff0028;
|
||||
#endif
|
||||
|
||||
radius = 8;
|
||||
cornergap = 5;
|
||||
} else {
|
||||
@@ -832,7 +864,13 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
|
||||
|
||||
if (sighton) {
|
||||
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
colour = PLAYER_EXTCFG().crosshaircolour;
|
||||
#else
|
||||
colour = 0x00ff0028;
|
||||
#endif
|
||||
|
||||
radius = 8;
|
||||
cornergap = 5;
|
||||
} else {
|
||||
@@ -1252,7 +1290,12 @@ Gfx *sightDrawZoom(Gfx *gdl, bool sighton)
|
||||
|
||||
if (showzoomrange) {
|
||||
gdl = text0f153628(gdl);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gdl = textSetPrimColour(gdl, PLAYER_EXTCFG().crosshaircolour);
|
||||
#else
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
#endif
|
||||
|
||||
if (frac < 0.2f) {
|
||||
cornerwidth *= 0.2f;
|
||||
@@ -1436,7 +1479,12 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton)
|
||||
gSPTri4(gdl++, 0, 4, 5, 5, 3, 6, 7, 6, 1, 4, 7, 2);
|
||||
|
||||
gdl = func0f0d49c8(gdl);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gdl = textSetPrimColour(gdl, PLAYER_EXTCFG().crosshaircolour);
|
||||
#else
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
#endif
|
||||
|
||||
// Draw border over inner points
|
||||
gDPHudRectangle(gdl++, x - 4, y - 4, x - 4, y + 4); // left
|
||||
@@ -1464,7 +1512,11 @@ Gfx *sightDrawTarget(Gfx *gdl)
|
||||
mainOverrideVariable("sout", &var80070f9c);
|
||||
mainOverrideVariable("sin", &var80070fa0);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gdl = textSetPrimColour(gdl, PLAYER_EXTCFG().crosshaircolour);
|
||||
#else
|
||||
gdl = textSetPrimColour(gdl, 0x00ff0028);
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
|
||||
|
||||
@@ -1692,6 +1692,10 @@
|
||||
#define MENUITEMTYPE_CONTROLLER 0x19
|
||||
#define MENUITEMTYPE_END 0x1a
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
#define MENUITEMTYPE_COLORBOX 0x1b
|
||||
#endif
|
||||
|
||||
#define MENUMODELFLAG_HASSCALE 0x01
|
||||
#define MENUMODELFLAG_HASPOSITION 0x02
|
||||
#define MENUMODELFLAG_HASROTATION 0x04
|
||||
|
||||
@@ -32,6 +32,10 @@ Gfx *menuitemLabelRender(Gfx *gdl, struct menurendercontext *context);
|
||||
|
||||
Gfx *menuitemMeterRender(Gfx *gdl, struct menurendercontext *context);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
Gfx *menuitemColorBoxRender(Gfx *gdl, struct menurendercontext *context);
|
||||
#endif
|
||||
|
||||
Gfx *menuitemSelectableRender(Gfx *gdl, struct menurendercontext *context);
|
||||
bool menuitemSelectableTick(struct menuitem *item, struct menuinputs *inputs, u32 tickflags);
|
||||
|
||||
|
||||
@@ -6139,6 +6139,7 @@ struct extplayerconfig {
|
||||
f32 radialmenuspeed;
|
||||
f32 crosshairsway;
|
||||
s32 extcontrols;
|
||||
u32 crosshaircolour;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user