forked from Ports/perfect_dark
Merge remote-tracking branch 'fgs/port' into port-x64
This commit is contained in:
commit
b44dbb16b5
22 files changed
+449
-246
No files matched your search
+1
-12
@@ -10941,7 +10941,6 @@ void bgunRender(Gfx **gdlptr)
|
||||
struct modelrenderdata renderdata = {NULL, true, 3}; // 10c
|
||||
struct player *player;
|
||||
s32 i;
|
||||
const u32 wnorm = mtx00016dcc(0, 300);
|
||||
|
||||
static bool renderhand = true; // var800702dc
|
||||
|
||||
@@ -11007,7 +11006,7 @@ void bgunRender(Gfx **gdlptr)
|
||||
gSPLookAt(gdl++, camGetLookAt());
|
||||
}
|
||||
|
||||
gSPPerspNormalize(gdl++, wnorm);
|
||||
gSPPerspNormalize(gdl++, mtx00016dcc(0, 300));
|
||||
|
||||
// There is support for guns having a TV screen on them
|
||||
// but no guns have this model part so it's not used.
|
||||
@@ -11182,17 +11181,7 @@ void bgunRender(Gfx **gdlptr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
// put the casings into the same Z range as the gun
|
||||
gSPPerspNormalize(gdl++, wnorm);
|
||||
#endif
|
||||
|
||||
casingsRender(&gdl);
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
gSPPerspNormalize(gdl++, viGetPerspScale());
|
||||
#endif
|
||||
|
||||
zbufSwap();
|
||||
|
||||
gdl = zbufConfigureRdp(gdl);
|
||||
|
||||
+17
-3
@@ -2274,7 +2274,21 @@ Gfx *menuRenderModel(Gfx *gdl, struct menumodel *menumodel, s32 modeltype)
|
||||
gdl = func0f0d49c8(gdl);
|
||||
gSPMatrix(gdl++, osVirtualToPhysical(camGetPerspectiveMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
} else {
|
||||
f32 aspect = (f32) (g_MenuScissorX2 - g_MenuScissorX1) / (f32) (g_MenuScissorY2 - g_MenuScissorY1);
|
||||
#ifdef PLATFORM_N64
|
||||
s32 x1 = g_MenuScissorX1;
|
||||
s32 x2 = g_MenuScissorX2;
|
||||
#else
|
||||
s32 halfScreenWidth = SCREEN_WIDTH_LO >> 1;
|
||||
f32 scale = SCREEN_ASPECT / videoGetAspect();
|
||||
f32 width = (g_MenuScissorX2 - g_MenuScissorX1) * scale;
|
||||
f32 center = (g_MenuScissorX1 + g_MenuScissorX2) * 0.5f;
|
||||
center = ((center - halfScreenWidth) * scale) + halfScreenWidth;
|
||||
|
||||
s32 x1 = (s32)(center - width * 0.5f);
|
||||
s32 x2 = (s32)(center + width * 0.5f);
|
||||
#endif
|
||||
|
||||
f32 aspect = (f32) (x2 - x1) / (f32) (g_MenuScissorY2 - g_MenuScissorY1);
|
||||
|
||||
static u32 znear = 10;
|
||||
static u32 zfar = 300;
|
||||
@@ -2284,8 +2298,8 @@ Gfx *menuRenderModel(Gfx *gdl, struct menumodel *menumodel, s32 modeltype)
|
||||
|
||||
gdl = func0f0d49c8(gdl);
|
||||
|
||||
viSetViewPosition(g_MenuScissorX1 * g_ScaleX, g_MenuScissorY1);
|
||||
viSetFovAspectAndSize(g_Vars.currentplayer->fovy, aspect, (g_MenuScissorX2 - g_MenuScissorX1) * g_ScaleX, g_MenuScissorY2 - g_MenuScissorY1);
|
||||
viSetViewPosition(x1 * g_ScaleX, g_MenuScissorY1);
|
||||
viSetFovAspectAndSize(g_Vars.currentplayer->fovy, aspect, (x2 - x1) * g_ScaleX, g_MenuScissorY2 - g_MenuScissorY1);
|
||||
|
||||
gdl = vi0000af00(gdl, var800a2048[g_MpPlayerNum]);
|
||||
gdl = vi0000aca4(gdl, znear, zfar);
|
||||
|
||||
+8
-2
@@ -2607,11 +2607,17 @@ Gfx *menuitemCarouselRender(Gfx *gdl, struct menurendercontext *context)
|
||||
colour = colourBlend(colourBlend(colour, 0x000000ff, 127), colour1, weight);
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
s16 chevronOffset = 0;
|
||||
#else
|
||||
s16 chevronOffset = 3;
|
||||
#endif
|
||||
|
||||
// Left arrow
|
||||
gdl = menugfxDrawCarouselChevron(gdl, context->x, context->y + context->height / 2, 8, 1, -1, colour);
|
||||
gdl = menugfxDrawCarouselChevron(gdl, context->x + chevronOffset, context->y + context->height / 2, 8, 1, -1, colour);
|
||||
|
||||
// Right arrow
|
||||
gdl = menugfxDrawCarouselChevron(gdl, context->x + context->width, context->y + context->height / 2, 8, 3, -1, colour);
|
||||
gdl = menugfxDrawCarouselChevron(gdl, context->x + context->width - chevronOffset, context->y + context->height / 2, 8, 3, -1, colour);
|
||||
|
||||
// This part of the function is unused because param2 is always zero.
|
||||
// Setting it to 0x7b causes a crash.
|
||||
|
||||
@@ -85,6 +85,14 @@ struct menuitem g_CtcOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
|
||||
@@ -80,6 +80,14 @@ struct menuitem g_MpCombatOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_SEPARATOR,
|
||||
|
||||
@@ -83,6 +83,14 @@ struct menuitem g_HtmOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
|
||||
@@ -83,6 +83,14 @@ struct menuitem g_HtbOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
|
||||
@@ -104,6 +104,14 @@ struct menuitem g_KohOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
|
||||
@@ -81,6 +81,14 @@ struct menuitem g_PacOptionsMenuItems[] = {
|
||||
MPOPTION_FRIENDLYFIRE,
|
||||
menuhandlerMpDisplayTeam,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
0,
|
||||
MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"No Player on Radar",
|
||||
MPOPTION_NOPLAYERONRADAR,
|
||||
menuhandlerMpCheckboxOption,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
MENUITEMTYPE_CHECKBOX,
|
||||
|
||||
@@ -1100,6 +1100,15 @@ void playerSpawn(void)
|
||||
}
|
||||
} else {
|
||||
#ifndef PLATFORM_N64
|
||||
if (cheatIsActive(CHEAT_CLOAKINGDEVICE)) {
|
||||
invGiveSingleWeapon(WEAPON_CLOAKINGDEVICE);
|
||||
#if VERSION >= VERSION_PAL_FINAL
|
||||
bgunSetAmmoQuantity(AMMOTYPE_CLOAK, TICKS(7200));
|
||||
#else
|
||||
bgunSetAmmoQuantity(AMMOTYPE_CLOAK, 7200);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cheatIsActive(CHEAT_PERFECTDARKNESS)) {
|
||||
invGiveSingleWeapon(WEAPON_NIGHTVISION);
|
||||
}
|
||||
|
||||
@@ -336,6 +336,9 @@ Gfx *radarRender(Gfx *gdl)
|
||||
gdl = func0f153134(gdl);
|
||||
|
||||
// Draw dots for human players
|
||||
#ifndef PLATFORM_N64
|
||||
if (!(g_MpSetup.options & MPOPTION_NOPLAYERONRADAR)) {
|
||||
#endif
|
||||
for (i = 0; i < playercount; i++) {
|
||||
if (i != playernum) {
|
||||
if (g_Vars.players[i]->isdead == false
|
||||
@@ -356,6 +359,9 @@ Gfx *radarRender(Gfx *gdl)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef PLATFORM_N64
|
||||
}
|
||||
#endif
|
||||
|
||||
// Draw dots for coop AI buddies
|
||||
if (!g_Vars.normmplayerisrunning && g_MissionConfig.iscoop) {
|
||||
@@ -377,7 +383,11 @@ Gfx *radarRender(Gfx *gdl)
|
||||
}
|
||||
|
||||
// Draw dots for MP simulants
|
||||
#ifdef PLATFORM_N64
|
||||
if (g_Vars.normmplayerisrunning) {
|
||||
#else
|
||||
if (g_Vars.normmplayerisrunning && !(g_MpSetup.options & MPOPTION_NOPLAYERONRADAR)) {
|
||||
#endif
|
||||
for (i = 0; i < g_BotCount; i++) {
|
||||
if (!chrIsDead(g_MpBotChrPtrs[i])
|
||||
&& (g_MpBotChrPtrs[i]->hidden & CHRHFLAG_CLOAKED) == 0
|
||||
|
||||
@@ -2818,6 +2818,9 @@ void dtTick(void)
|
||||
g_DtData.completed = true;
|
||||
g_DtData.timeleft = 1;
|
||||
g_DtData.finished = true;
|
||||
#ifndef PLATFORM_N64
|
||||
filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0);
|
||||
#endif
|
||||
}
|
||||
} else if (g_DtData.finished) {
|
||||
if (g_DtData.timeleft <= 0) {
|
||||
@@ -3105,6 +3108,9 @@ void htTick(void)
|
||||
g_HtData.completed = true;
|
||||
g_HtData.timeleft = 1;
|
||||
g_HtData.finished = true;
|
||||
#ifndef PLATFORM_N64
|
||||
filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0);
|
||||
#endif
|
||||
}
|
||||
} else if (g_HtData.finished) {
|
||||
if (g_HtData.timeleft <= 0) {
|
||||
|
||||
+93
-13
@@ -1535,19 +1535,7 @@ MenuDialogHandlerResult ciCharacterProfileMenuDialog(s32 operation, struct menud
|
||||
f32 y;
|
||||
f32 scale;
|
||||
|
||||
switch (operation) {
|
||||
case MENUOP_OPEN:
|
||||
if (bodynum == BODY_DRCAROLL) {
|
||||
scale = 0.7f;
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoom = -1;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoom = 30;
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoomtimer60 = TICKS(120);
|
||||
g_Menus[g_MpPlayerNum].menumodel.removingpiece = false;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
if (g_ViRes != VIRES_HI) {
|
||||
x = -117;
|
||||
@@ -1574,6 +1562,50 @@ MenuDialogHandlerResult ciCharacterProfileMenuDialog(s32 operation, struct menud
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
x = -100;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (operation) {
|
||||
case MENUOP_OPEN:
|
||||
if (bodynum == BODY_DRCAROLL) {
|
||||
scale = 0.7f;
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoom = -1;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoom = 30;
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
g_Menus[g_MpPlayerNum].menumodel.zoomtimer60 = TICKS(120);
|
||||
g_Menus[g_MpPlayerNum].menumodel.removingpiece = false;
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
if (g_ViRes != VIRES_HI) {
|
||||
x = -117;
|
||||
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
x = -87;
|
||||
}
|
||||
} else {
|
||||
x = -177;
|
||||
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
x = -127;
|
||||
}
|
||||
}
|
||||
#elif VERSION == VERSION_PAL_BETA
|
||||
x = -117;
|
||||
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
x = -87;
|
||||
}
|
||||
#else
|
||||
x = -130;
|
||||
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
x = -100;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
y = -15;
|
||||
@@ -1603,6 +1635,11 @@ MenuDialogHandlerResult ciCharacterProfileMenuDialog(s32 operation, struct menud
|
||||
case MENUOP_CLOSE:
|
||||
break;
|
||||
case MENUOP_TICK:
|
||||
#ifndef PLATFORM_N64
|
||||
x = (float)x * ((f32)SCREEN_WIDTH_LO / (f32)SCREEN_HEIGHT_LO) / videoGetAspect();
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = x;
|
||||
#endif
|
||||
|
||||
if (bodynum == BODY_DRCAROLL) {
|
||||
static struct modelpartvisibility vis[] = {
|
||||
{ MODELPART_DRCAROLL_0001, false },
|
||||
@@ -1888,6 +1925,7 @@ MenuDialogHandlerResult dtTrainingDetailsMenuDialog(s32 operation, struct menudi
|
||||
g_Menus[g_MpPlayerNum].training.weaponnum = weaponnum;
|
||||
func0f105948(weaponnum);
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
if (g_ViRes == VIRES_HI) {
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
@@ -1922,6 +1960,7 @@ MenuDialogHandlerResult dtTrainingDetailsMenuDialog(s32 operation, struct menudi
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 90;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 90;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_Menus[g_MpPlayerNum].menumodel.newscale /= 2.5f;
|
||||
@@ -1930,6 +1969,47 @@ MenuDialogHandlerResult dtTrainingDetailsMenuDialog(s32 operation, struct menudi
|
||||
case MENUOP_CLOSE:
|
||||
break;
|
||||
case MENUOP_TICK:
|
||||
#ifndef PLATFORM_N64
|
||||
#if VERSION == VERSION_PAL_FINAL
|
||||
if (g_ViRes == VIRES_HI) {
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 84;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 84;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 104;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 104;
|
||||
}
|
||||
} else {
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 64;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 64;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 84;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 84;
|
||||
}
|
||||
}
|
||||
#elif VERSION == VERSION_PAL_BETA
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 64;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 64;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 84;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 84;
|
||||
}
|
||||
#else
|
||||
if (optionsGetScreenRatio() == SCREENRATIO_16_9) {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 70;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 70;
|
||||
} else {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx = 90;
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = 90;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Menus[g_MpPlayerNum].menumodel.newposx *= ((f32)SCREEN_WIDTH_LO / (f32)SCREEN_HEIGHT_LO) / videoGetAspect();
|
||||
g_Menus[g_MpPlayerNum].menumodel.curposx = g_Menus[g_MpPlayerNum].menumodel.newposx;
|
||||
#endif
|
||||
|
||||
if (g_Menus[g_MpPlayerNum].curdialog && g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) {
|
||||
if (dtGetWeaponByDeviceIndex(dtGetIndexBySlot(g_DtSlot)) == WEAPON_DISGUISE41) {
|
||||
g_Menus[g_MpPlayerNum].menumodel.newanimnum = ANIM_006A;
|
||||
|
||||
+2
-1
@@ -126,7 +126,6 @@ Gfx *zbufConfigureRdp(Gfx *gdl)
|
||||
Gfx *zbufClear(Gfx *gdl)
|
||||
{
|
||||
#ifdef PLATFORM_N64
|
||||
// no reason to do a Z clear on PC, we already do it at frame start
|
||||
s32 left;
|
||||
s32 right;
|
||||
|
||||
@@ -150,6 +149,8 @@ Gfx *zbufClear(Gfx *gdl)
|
||||
|
||||
gDPFillRectangle(gdl++, left, 0, right, playerGetFbHeight() - 1);
|
||||
gDPPipeSync(gdl++);
|
||||
#else
|
||||
gDPClearDepthEXT(gdl++);
|
||||
#endif
|
||||
|
||||
return gdl;
|
||||
|
||||
@@ -2896,6 +2896,7 @@
|
||||
#define MPOPTION_AUTORANDOMWEAPON_START 0x00800000
|
||||
#define MPOPTION_AUTORANDOMWEAPON_END 0x01000000
|
||||
#define MPOPTION_FRIENDLYFIRE 0x02000000
|
||||
#define MPOPTION_NOPLAYERONRADAR 0x04000000
|
||||
|
||||
#define MPPAUSEMODE_UNPAUSED 0
|
||||
#define MPPAUSEMODE_PAUSED 1
|
||||
|
||||
@@ -195,6 +195,7 @@
|
||||
#define G_COPYFB_EXT 0x41
|
||||
#define G_IMAGERECT_EXT 0x42
|
||||
#define G_RDPFLUSH_EXT 0x43
|
||||
#define G_CLEAR_DEPTH_EXT 0x44
|
||||
|
||||
/* G_EXTRAGEOMETRYMODE flags */
|
||||
|
||||
@@ -300,6 +301,8 @@
|
||||
|
||||
#define gDPFlushEXT(pkt) gDPNoParam(pkt, G_RDPFLUSH_EXT)
|
||||
|
||||
#define gDPClearDepthEXT(pkt) gDPNoParam(pkt, G_CLEAR_DEPTH_EXT)
|
||||
|
||||
#undef gDPFillRectangleScaled
|
||||
#define gDPFillRectangleScaled(pkt, x1, y1, x2, y2) gDPFillRectangleEXT(pkt, (x1) * g_ScaleX, y1, (x2) * g_ScaleX, y2)
|
||||
|
||||
|
||||
Reference in new issue
Block a user