Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into port-debugger

This commit is contained in:
fgsfds committed 2024-02-12 16:38:09 +01:00
commit 11fd86002b
45 files changed
+805 -110

No files matched your search

+9 -21
View File
@@ -90,19 +90,8 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item,
switch (operation) {
case MENUOP_GETOPTIONCOUNT:
if (g_AmMenus[g_AmIndex].prevallbots) {
// All bots: num bot opponents + all human players
s32 count = 0;
s32 i;
struct chrdata *playerchr = g_Vars.currentplayer->prop->chr;
for (i = PLAYERCOUNT(); i < g_MpNumChrs; i++) {
if (g_MpAllChrPtrs[i]->team != playerchr->team) {
count++;
}
}
count += PLAYERCOUNT();
data->list.value = count;
// All bots
data->list.value = g_MpNumChrs;
} else {
// Single bot: All except the bot itself
data->list.value = g_MpNumChrs - 1;
@@ -125,9 +114,7 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item,
chrindex++;
if (g_AmMenus[g_AmIndex].prevallbots) {
if (playerchr == g_MpAllChrPtrs[chrindex] || playerchr->team != g_MpAllChrPtrs[chrindex]->team) {
numremaining--;
}
numremaining--;
} else {
if (botchr != g_MpAllChrPtrs[chrindex]) {
numremaining--;
@@ -139,7 +126,9 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item,
g_AmMenus[g_AmIndex].prevallbots = false;
for (i = 0; i < g_Vars.currentplayer->numaibuddies; i++) {
botApplyAttack(g_MpAllChrPtrs[g_Vars.currentplayer->aibuddynums[i]], g_MpAllChrPtrs[chrindex]->prop);
if (g_Vars.currentplayer->aibuddynums[i] != chrindex) {
botApplyAttack(g_MpAllChrPtrs[g_Vars.currentplayer->aibuddynums[i]], g_MpAllChrPtrs[chrindex]->prop);
}
}
} else {
botApplyAttack(botchr, g_MpAllChrPtrs[chrindex]->prop);
@@ -167,9 +156,7 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item,
chrindex++;
if (g_AmMenus[g_AmIndex].prevallbots) {
if (playerchr == g_MpAllChrPtrs[chrindex] || playerchr->team != g_MpAllChrPtrs[chrindex]->team) {
numremaining--;
}
numremaining--;
} else {
if (botchr != g_MpAllChrPtrs[chrindex]) {
numremaining--;
@@ -1275,7 +1262,8 @@ Gfx *amRender(Gfx *gdl)
#endif
#ifndef PLATFORM_N64
if (PLAYERCOUNT() == 1) {
const s32 playercount = PLAYERCOUNT();
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
+6
View File
@@ -1098,7 +1098,13 @@ void eyespyProcessInput(bool allowbuttons)
if (g_Vars.currentplayer->eyespy->bobactive || ABS(g_Vars.currentplayer->eyespy->vel.y) < 0.1f) {
g_Vars.currentplayer->eyespy->bobactive = true;
g_Vars.currentplayer->eyespy->bobtimer += g_Vars.lvupdate60;
#ifdef PLATFORM_N64
g_Vars.currentplayer->eyespy->vel.y += 0.025f * g_Vars.currentplayer->eyespy->bobdir;
#else
// HACK: how do I scale this properly?
const f32 scale = (g_Vars.lvupdate60freal <= 1.1f) ? 0.0055f : 0.0125f;
g_Vars.currentplayer->eyespy->vel.y += scale * g_Vars.lvupdate60freal * g_Vars.currentplayer->eyespy->bobdir;
#endif
if (g_Vars.currentplayer->eyespy->bobtimer > TICKS(120)) {
g_Vars.currentplayer->eyespy->bobtimer = 0;
+17 -3
View File
@@ -190,6 +190,10 @@ char var800700bc[][10] = {
{ 'x','x','x' }, // "xxx"
};
#ifndef PLATFORM_N64
s32 g_BgunGeMuzzleFlashes = false;
#endif
#if !MATCHING || VERSION >= VERSION_NTSC_1_0
void bgunRumble(s32 handnum, s32 weaponnum)
{
@@ -1911,7 +1915,17 @@ void bgun0f09a6f8(struct handweaponinfo *info, s32 handnum, struct hand *hand, s
if (func->flags & FUNCFLAG_NOMUZZLEFLASH) {
hand->flashon = false;
} else {
#ifdef PLATFORM_N64
hand->flashon = true;
#else
if (g_BgunGeMuzzleFlashes) {
if (func->type == INVENTORYFUNCTYPE_SHOOT_SINGLE || (hand->shotstotake & 1)) {
hand->flashon = true;
}
} else {
hand->flashon = true;
}
#endif
}
bgunStartSlide(handnum);
@@ -12783,7 +12797,7 @@ Gfx *bgunDrawHud(Gfx *gdl)
gdl = text0f153628(gdl);
#ifndef PLATFORM_N64
if (playercount < 2) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR);
}
#endif
@@ -13037,7 +13051,7 @@ Gfx *bgunDrawHud(Gfx *gdl)
}
#ifndef PLATFORM_N64
if (playercount < 2) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL);
}
#endif
@@ -13077,7 +13091,7 @@ Gfx *bgunDrawHud(Gfx *gdl)
}
#ifndef PLATFORM_N64
if (playercount < 2) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR);
}
#endif
+16 -2
View File
@@ -289,6 +289,14 @@ Gfx *bviewDrawMotionBlur(Gfx *gdl, u32 colour, u32 alpha)
if (!videoFramebuffersSupported()) {
return gdl;
}
// capture fb at the end of this frame
g_BlurFbCapTimer = 0;
// don't render first blur frame as we haven't captured the fb yet
if (g_BlurFbDirty) {
return gdl;
}
#endif
mainOverrideVariable("sfxxx", &sfxxx);
@@ -312,7 +320,6 @@ Gfx *bviewDrawMotionBlur(Gfx *gdl, u32 colour, u32 alpha)
viewleft << 2, viewtop << 2, viewleft, viewtop,
(viewleft + viewwidth) << 2, (viewtop + viewheight) << 2, viewleft + viewwidth, viewtop + viewheight,
0, videoGetNativeWidth(), videoGetNativeHeight());
g_BlurFbCapTimer = 0;
#endif
return gdl;
@@ -521,6 +528,14 @@ Gfx *bviewDrawZoomBlur(Gfx *gdl, u32 colour, s32 alpha, f32 arg3, f32 arg4)
if (!videoFramebuffersSupported()) {
return gdl;
}
// capture fb at the end of this frame
g_BlurFbCapTimer = 0;
// don't render first blur frame as we haven't captured the fb yet
if (g_BlurFbDirty) {
return gdl;
}
#endif
strcpy(var800a41c0, "stretchBlurGfx");
@@ -550,7 +565,6 @@ Gfx *bviewDrawZoomBlur(Gfx *gdl, u32 colour, s32 alpha, f32 arg3, f32 arg4)
left << 2, top << 2, viewleft, viewtop,
right << 2, bottom << 2, viewleft + viewwidth, viewtop + viewheight,
0, videoGetNativeWidth(), videoGetNativeHeight());
g_BlurFbCapTimer = 0;
#endif
return gdl;
+11
View File
@@ -260,6 +260,17 @@ void botSpawn(struct chrdata *chr, u8 respawning)
chr->aibot->moveratex = 0;
chr->aibot->moveratey = 0;
func0f02e9a0(chr, 0);
#ifndef PLATFORM_N64
if ((g_MpSetup.options & MPOPTION_SPAWNWITHWEAPON)
&& g_MpSetup.weapons[0] != MPWEAPON_NONE
&& g_MpSetup.weapons[0] != MPWEAPON_DISABLED) {
struct mpweapon *mpweapon = &g_MpWeapons[g_MpSetup.weapons[0]];
botinvGiveSingleWeapon(chr, mpweapon->weaponnum);
botactGiveAmmoByType(aibot, mpweapon->priammotype - 1, mpweapon->priammoqty / 2);
botinvSwitchToWeapon(chr, mpweapon->weaponnum, FUNC_PRIMARY);
}
#endif
}
}
+10
View File
@@ -2592,6 +2592,16 @@ MenuItemHandlerResult filemgrChooseAgentListMenuHandler(s32 operation, struct me
}
}
}
#ifndef PLATFORM_N64
if (g_FileAutoSelect >= 0 && g_FileLists[0] && g_FileLists[0]->numfiles > 0) {
const u32 tmp = data->list.value;
data->list.value = g_FileAutoSelect;
g_FileAutoSelect = -1;
filemgrChooseAgentListMenuHandler(MENUOP_SET, item, data);
data->list.value = tmp;
}
#endif
break;
case MENUOP_GETOPTIONCOUNT:
data->list.value = g_FileLists[0]->numfiles + 1;
+2
View File
@@ -398,9 +398,11 @@ u16 weaponGetFileNum(s32 weaponnum)
}
if (weapon) {
#ifdef PLATFORM_N64
if (PLAYERCOUNT() >= 2) {
return weapon->lo_model;
}
#endif
return weapon->hi_model;
}
+4 -3
View File
@@ -190,7 +190,7 @@ Gfx *hudmsgRenderMissionTimer(Gfx *gdl, u32 alpha)
y = timery;
#ifndef PLATFORM_N64
if (PLAYERCOUNT() < 2) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL);
}
#endif
@@ -282,7 +282,7 @@ Gfx *hudmsgRenderZoomRange(Gfx *gdl, u32 alpha)
y2 = y + textheight;
#ifndef PLATFORM_N64
if (playercount == 1) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
@@ -1450,7 +1450,8 @@ Gfx *hudmsgsRender(Gfx *gdl)
}
#ifndef PLATFORM_N64
if (playercount < 2 && msg->state >= HUDMSGSTATE_FADINGIN) {
const bool doaspectfix = (playercount < 2) || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL);
if (doaspectfix && msg->state >= HUDMSGSTATE_FADINGIN) {
if (msg->alignh == HUDMSGALIGN_SCREENLEFT || msg->alignh == HUDMSGALIGN_LEFT) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL);
} else if (msg->alignh == HUDMSGALIGN_RIGHT) {
+3
View File
@@ -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:
+35
View File
@@ -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;
+8
View File
@@ -122,6 +122,9 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
.crosshairsway = 1.f, \
.crouchmode = CROUCHMODE_TOGGLE_ANALOG, \
.extcontrols = true, \
.crosshaircolour = 0x00ff0028, \
.crosshairsize = 2, \
.crosshairhealth = CROSSHAIR_HEALTH_OFF, \
}
struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = {
@@ -2717,6 +2720,11 @@ struct mptrack g_MpTracks[] = {
/*0x27*/ { MUSIC_SKEDARRUINS, 120, L_MISC_163, SOLOSTAGEINDEX_SKEDARRUINS }, // "Skedar Ruins"
/*0x28*/ { MUSIC_SKEDARRUINS_X, 120, L_MISC_164, SOLOSTAGEINDEX_SKEDARRUINS }, // "Skedar Ruins X"
/*0x29*/ { MUSIC_CREDITS, 120, L_MISC_165, SOLOSTAGEINDEX_SKEDARRUINS }, // "End Credits"
#if VERSION < VERSION_PAL_BETA
/*0x2a*/ { MUSIC_SKEDARRUINS_KING,120, L_MISC_261, SOLOSTAGEINDEX_SKEDARRUINS }, // "Skedar Warrior" (Skedar Leader)
#else
/*0x2a*/ { MUSIC_SKEDARRUINS_KING,120, L_MISC_041, SOLOSTAGEINDEX_SKEDARRUINS }, // "E R R O R" (can't find a good approximation for Skedar Leader)
#endif
};
bool mpIsTrackUnlocked(s32 tracknum)
@@ -60,6 +60,16 @@ struct menuitem g_CtcOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_CHECKBOX,
0,
+10
View File
@@ -55,6 +55,16 @@ struct menuitem g_MpCombatOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_SEPARATOR,
0,
@@ -58,6 +58,16 @@ struct menuitem g_HtmOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_CHECKBOX,
0,
@@ -58,6 +58,16 @@ struct menuitem g_HtbOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_CHECKBOX,
0,
@@ -417,7 +427,8 @@ Gfx *htbRenderHud(Gfx *gdl)
#endif
#ifndef PLATFORM_N64
if (PLAYERCOUNT() == 1) {
const s32 playercount = PLAYERCOUNT();
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
+12 -1
View File
@@ -79,6 +79,16 @@ struct menuitem g_KohOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_CHECKBOX,
0,
@@ -583,7 +593,8 @@ Gfx *kohRenderHud(Gfx *gdl)
}
#ifndef PLATFORM_N64
if (PLAYERCOUNT() == 1) {
const s32 playercount = PLAYERCOUNT();
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
+12 -1
View File
@@ -56,6 +56,16 @@ struct menuitem g_PacOptionsMenuItems[] = {
MPOPTION_NOAUTOAIM,
menuhandlerMpCheckboxOption,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Spawn With Weapon",
MPOPTION_SPAWNWITHWEAPON,
menuhandlerMpCheckboxOption,
},
#endif
{
MENUITEMTYPE_CHECKBOX,
0,
@@ -312,7 +322,8 @@ Gfx *pacRenderHud(Gfx *gdl)
sprintf(text, "%d:%02d", mins, secs);
#ifndef PLATFORM_N64
if (PLAYERCOUNT() == 1) {
const s32 playercount = PLAYERCOUNT();
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
+15 -2
View File
@@ -1100,8 +1100,21 @@ void playerSpawn(void)
g_Vars.currentplayer->prop->chr->blurnumtimesdied = 0;
}
} else {
bgunEquipWeapon2(HAND_LEFT, g_DefaultWeapons[HAND_LEFT]);
bgunEquipWeapon2(HAND_RIGHT, g_DefaultWeapons[HAND_RIGHT]);
#ifndef PLATFORM_N64
if ((g_MpSetup.options & MPOPTION_SPAWNWITHWEAPON)
&& g_MpSetup.weapons[0] != MPWEAPON_NONE
&& g_MpSetup.weapons[0] != MPWEAPON_DISABLED) {
struct mpweapon *mpweapon = &g_MpWeapons[g_MpSetup.weapons[0]];
invGiveSingleWeapon(mpweapon->weaponnum);
bgunEquipWeapon2(HAND_LEFT, WEAPON_NONE);
bgunEquipWeapon2(HAND_RIGHT, mpweapon->weaponnum);
bgunSetAmmoQuantity(mpweapon->priammotype, mpweapon->priammoqty / 2);
} else
#endif
{
bgunEquipWeapon2(HAND_LEFT, g_DefaultWeapons[HAND_LEFT]);
bgunEquipWeapon2(HAND_RIGHT, g_DefaultWeapons[HAND_RIGHT]);
}
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.currentplayer->model00d4 == NULL
+1 -1
View File
@@ -20997,7 +20997,7 @@ Gfx *countdownTimerRender(Gfx *gdl)
ms = (s32)floorf(value60 * 1.6666666269302f) - mins * 6000 - secs * 100;
#ifndef PLATFORM_N64
if (playercount == 1) {
if (playercount < 2 || (playercount == 2 && optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL)) {
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
}
#endif
+5
View File
@@ -312,6 +312,11 @@ Gfx *radarRender(Gfx *gdl)
} else if (optionsGetScreenSplit() != SCREENSPLIT_VERTICAL && playernum == 1) {
g_RadarY -= 8;
}
#ifndef PLATFORM_N64
if (optionsGetScreenSplit() == SCREENSPLIT_HORIZONTAL) {
gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR);
}
#endif
} else if (playercount >= 3) {
if (playernum >= 2) {
g_RadarY -= 8;
+83 -20
View File
@@ -23,9 +23,58 @@
#include <math.h>
#include "video.h"
#define SIGHT_COLOUR ((PLAYER_EXTCFG().crosshairhealth >= CROSSHAIR_HEALTH_ON_GREEN) ? sightGetCrosshairHealthColor(g_Vars.currentplayer->bondhealth, g_Vars.currentplayer->prop->chr->cshield * 0.125f) : PLAYER_EXTCFG().crosshaircolour)
#define SIGHT_SCALE PLAYER_EXTCFG().crosshairsize
static u32 sightGetCrosshairHealthColor(float health, float shield)
{
const float ratio = MAX(0.0f, MIN(health + shield, 2.0f));
int red = 0;
int green = 0;
int blue = 0;
if (ratio < 0.2f) {
// Red (critical health level)
red = 255;
green = 0;
blue = 0;
} else if (ratio < 0.6f) {
// Red-yellow
red = 255;
green = 255 * ((ratio - 0.2f) / 0.4f);
blue = 0;
} else if (ratio < 1.0f) {
if (PLAYER_EXTCFG().crosshairhealth == CROSSHAIR_HEALTH_ON_GREEN) {
// Yellow-green
red = 255 * ((ratio - 0.6f) / 0.4f);
green = 255;
blue = 0;
} else {
// Yellow-white
red = 255;
green = 255;
blue = 255 * ((ratio - 0.6f) / 0.4f);
}
} else {
if (PLAYER_EXTCFG().crosshairhealth == CROSSHAIR_HEALTH_ON_GREEN) {
// Green-cyan (overheal via shield)
red = 0;
green = 255;
blue = 255 * (ratio - 1.0f);
} else {
// White-green (overheal via shield)
red = 255 * (2.0f - ratio);
green = 255;
blue = 255 * (2.0f - ratio);
}
}
return (red << 24) + (green << 16) + (blue << 8) + (PLAYER_EXTCFG().crosshaircolour & 0xff);
}
static inline f32 sightGetScaleX(void)
{
return (videoGetAspect() / (4.f / 3.f));
return (videoGetAspect() / SCREEN_ASPECT);
}
static inline s32 sightGetAdjustedX(const f32 x)
@@ -36,6 +85,8 @@ static inline s32 sightGetAdjustedX(const f32 x)
#else
#define SIGHT_COLOUR 0x00ff0028
#define SIGHT_SCALE 2
#define sightGetScaleX() 1.f
#define sightGetAdjustedX(x) (x)
@@ -459,7 +510,7 @@ Gfx *sightDrawAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colou
s32 viewright = viewleft + viewwidth - 1;
s32 viewbottom = viewtop + viewheight - 1;
gdl = textSetPrimColour(gdl, 0x00ff0028);
gdl = textSetPrimColour(gdl, SIGHT_COLOUR);
#ifndef PLATFORM_N64
x = sightGetAdjustedX(x);
@@ -619,7 +670,7 @@ Gfx *sightDrawDelayedAimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u3
boxx = xpos;
boxy = ypos;
gdl = textSetPrimColour(gdl, 0x00ff0028);
gdl = textSetPrimColour(gdl, SIGHT_COLOUR);
// Fill a 3x3 box at the live crosshair
gDPHudRectangle(gdl++, x - 1, y - 1, x + 1, y - 1);
@@ -677,7 +728,7 @@ 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) {
colour = 0x00ff0028;
colour = SIGHT_COLOUR;
radius = 8;
cornergap = 5;
gdl = sightDrawAimer(gdl, x, y, radius, cornergap, colour);
@@ -687,7 +738,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
// For most guns, render the aimer if holding R
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
colour = 0x00ff0028;
colour = SIGHT_COLOUR;
radius = 8;
cornergap = 5;
} else {
@@ -716,7 +767,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
s32 texty;
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
colour = 0x00ff0028;
colour = SIGHT_COLOUR;
radius = 8;
cornergap = 5;
} else {
@@ -761,7 +812,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
colour = 0x00ff0028;
colour = SIGHT_COLOUR;
radius = 8;
cornergap = 5;
} else {
@@ -832,7 +883,7 @@ Gfx *sightDrawDefault(Gfx *gdl, bool sighton)
if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop == NULL) {
colour = 0x00ff0028;
colour = SIGHT_COLOUR;
radius = 8;
cornergap = 5;
} else {
@@ -1252,7 +1303,7 @@ Gfx *sightDrawZoom(Gfx *gdl, bool sighton)
if (showzoomrange) {
gdl = text0f153628(gdl);
gdl = textSetPrimColour(gdl, 0x00ff0028);
gdl = textSetPrimColour(gdl, SIGHT_COLOUR);
if (frac < 0.2f) {
cornerwidth *= 0.2f;
@@ -1436,7 +1487,7 @@ Gfx *sightDrawMaian(Gfx *gdl, bool sighton)
gSPTri4(gdl++, 0, 4, 5, 5, 3, 6, 7, 6, 1, 4, 7, 2);
gdl = func0f0d49c8(gdl);
gdl = textSetPrimColour(gdl, 0x00ff0028);
gdl = textSetPrimColour(gdl, SIGHT_COLOUR);
// Draw border over inner points
gDPHudRectangle(gdl++, x - 4, y - 4, x - 4, y + 4); // left
@@ -1464,20 +1515,25 @@ Gfx *sightDrawTarget(Gfx *gdl)
mainOverrideVariable("sout", &var80070f9c);
mainOverrideVariable("sin", &var80070fa0);
gdl = textSetPrimColour(gdl, 0x00ff0028);
gdl = textSetPrimColour(gdl, SIGHT_COLOUR);
#ifndef PLATFORM_N64
gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
if (SIGHT_SCALE == 0) {
// Draw single rectangle to preserve intended opacity
gDPHudRectangle(gdl++, x, y, x, y);
} else
#endif
gDPHudRectangle(gdl++, x + 2, y + 0, x + 6, y + 0);
gDPHudRectangle(gdl++, x + 2, y + 0, x + 4, y + 0);
gDPHudRectangle(gdl++, x - 6, y + 0, x - 2, y + 0);
gDPHudRectangle(gdl++, x - 4, y + 0, x - 2, y + 0);
gDPHudRectangle(gdl++, x + 0, y + 2, x + 0, y + 6);
gDPHudRectangle(gdl++, x + 0, y + 2, x + 0, y + 4);
gDPHudRectangle(gdl++, x + 0, y - 6, x + 0, y - 2);
gDPHudRectangle(gdl++, x + 0, y - 4, x + 0, y - 2);
{
gDPHudRectangle(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x + 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x + 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x - 3 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x - 2 * SIGHT_SCALE, y + 0 * SIGHT_SCALE, x - 1 * SIGHT_SCALE, y + 0 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 3 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y + 1 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y + 2 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y - 3 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE);
gDPHudRectangle(gdl++, x + 0 * SIGHT_SCALE, y - 2 * SIGHT_SCALE, x + 0 * SIGHT_SCALE, y - 1 * SIGHT_SCALE);
}
#ifndef PLATFORM_N64
gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT);
@@ -1526,6 +1582,13 @@ Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight)
sight = SIGHT_DEFAULT;
}
#ifndef PLATFORM_N64
if (g_Vars.currentplayer->bondhealth <= 0.0f) {
// Hide crosshair during death animation
sight = SIGHT_NONE;
}
#endif
sightTick(sighton);
switch (sight) {
+3
View File
@@ -139,6 +139,9 @@ void texReset(void)
// get backend texture settings
g_TexFilter2D = videoGetTextureFilter2D() ? G_TF_BILERP : G_TF_POINT;
// notify blur code that the blur framebuffer is probably full of garbage
g_BlurFbDirty = true;
#endif
g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE);
+2
View File
@@ -372,6 +372,8 @@ Gfx *titleRenderLegal(Gfx *gdl)
elem->textptr = VERSION_HASH " (" VERSION_TARGET ")";
} else if (elem->textid == L_OPTIONS_083) {
elem->textptr = VERSION_ROMID;
} else if (elem->textid == L_OPTIONS_082) {
elem->textptr = "Perfect Dark (" VERSION_BRANCH ")";
}
#endif
break;
+9
View File
@@ -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
@@ -2885,6 +2889,7 @@
#define MPOPTION_HTM_SHOWONRADAR 0x00040000
#define MPOPTION_PAC_HIGHLIGHTTARGET 0x00080000
#define MPOPTION_PAC_SHOWONRADAR 0x00100000
#define MPOPTION_SPAWNWITHWEAPON 0x00200000
#define MPPAUSEMODE_UNPAUSED 0
#define MPPAUSEMODE_PAUSED 1
@@ -4714,6 +4719,10 @@ enum weaponnum {
#define CROUCHMODE_TOGGLE 2 // press the crouch buttons to toggle stance
#define CROUCHMODE_TOGGLE_ANALOG (CROUCHMODE_ANALOG | CROUCHMODE_TOGGLE)
#define CROSSHAIR_HEALTH_OFF 0
#define CROSSHAIR_HEALTH_ON_GREEN 1
#define CROSSHAIR_HEALTH_ON_WHITE 2
#endif
#endif
+3
View File
@@ -545,8 +545,11 @@ extern u32 g_HudAlignModeR;
extern s32 g_PrevFrameFb;
extern s32 g_BlurFb;
extern s32 g_BlurFbCapTimer;
extern bool g_BlurFbDirty;
extern s32 g_TickRateDiv;
extern s32 g_MusicDisableMpDeath;
extern s32 g_BgunGeMuzzleFlashes;
extern s32 g_FileAutoSelect;
#define PLAYER_EXTCFG() g_PlayerExtCfg[g_Vars.currentplayerstats->mpindex & 3]
#define PLAYER_DEFAULT_FOV (PLAYER_EXTCFG().fovy)
+4
View File
@@ -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);
+3
View File
@@ -6139,6 +6139,9 @@ struct extplayerconfig {
f32 radialmenuspeed;
f32 crosshairsway;
s32 extcontrols;
u32 crosshaircolour;
u32 crosshairsize;
s32 crosshairhealth;
};
#endif