From d9cb8508487a6026077c718f4fcca47e5e41a777 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 14 Jan 2024 20:49:20 +0100 Subject: [PATCH 1/4] Merge pull request #333 from AXDOOMER/port Always use high detail weapon models --- src/game/game_0b0fd0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game/game_0b0fd0.c b/src/game/game_0b0fd0.c index 8c7953ccf..719959461 100644 --- a/src/game/game_0b0fd0.c +++ b/src/game/game_0b0fd0.c @@ -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; } From cf5588478b0c65a394731537cfe7d4ddf30f7156 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 14 Jan 2024 21:11:58 +0100 Subject: [PATCH 2/4] Merge pull request #332 from Calinou/add-crosshair-size-option Add a crosshair size option --- port/src/main.c | 1 + port/src/optionsmenu.c | 22 ++++++++++++++++++++++ src/game/mplayer/mplayer.c | 1 + src/game/sight.c | 23 +++++++++++++++-------- src/include/types.h | 1 + 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/port/src/main.c b/port/src/main.c index 006353cf7..10150f7ae 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -175,5 +175,6 @@ PD_CONSTRUCTOR static void gameConfigInit(void) configRegisterInt(strFmt("Game.Player%d.CrouchMode", i), &g_PlayerExtCfg[j].crouchmode, 0, CROUCHMODE_TOGGLE_ANALOG); configRegisterInt(strFmt("Game.Player%d.ExtendedControls", i), &g_PlayerExtCfg[j].extcontrols, 0, 1); configRegisterUInt(strFmt("Game.Player%d.CrosshairColour", i), &g_PlayerExtCfg[j].crosshaircolour, 0, 0xFFFFFFFF); + configRegisterUInt(strFmt("Game.Player%d.CrosshairSize", i), &g_PlayerExtCfg[j].crosshairsize, 0, 4); } } diff --git a/port/src/optionsmenu.c b/port/src/optionsmenu.c index 53da2571f..dd999bee4 100644 --- a/port/src/optionsmenu.c +++ b/port/src/optionsmenu.c @@ -1026,6 +1026,20 @@ static MenuItemHandlerResult menuhandlerCrosshairColorPreview(s32 operation, str return 0; } +static MenuItemHandlerResult menuhandlerCrosshairSize(s32 operation, struct menuitem *item, union handlerdata *data) +{ + switch (operation) { + case MENUOP_GETSLIDER: + data->slider.value = g_PlayerExtCfg[g_ExtMenuPlayer].crosshairsize; + break; + case MENUOP_SET: + g_PlayerExtCfg[g_ExtMenuPlayer].crosshairsize = data->slider.value; + break; + } + + return 0; +} + struct menuitem g_ExtendedGameCrosshairColourMenuItems[] = { { MENUITEMTYPE_SLIDER, @@ -1128,6 +1142,14 @@ struct menuitem g_ExtendedGameMenuItems[] = { 20, menuhandlerCrosshairSway, }, + { + MENUITEMTYPE_SLIDER, + 0, + MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_SLIDER_WIDE, + (uintptr_t)"Crosshair Size", + 4, + menuhandlerCrosshairSize, + }, { MENUITEMTYPE_SELECTABLE, 0, diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index efb63bfc0..7246a418b 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -123,6 +123,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = { .crouchmode = CROUCHMODE_TOGGLE_ANALOG, \ .extcontrols = true, \ .crosshaircolour = 0x00ff0028, \ + .crosshairsize = 2, \ } struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = { diff --git a/src/game/sight.c b/src/game/sight.c index 8e7ed749b..fa2155d4d 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -1473,14 +1473,21 @@ Gfx *sightDrawTarget(Gfx *gdl) gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); #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); +#define SIGHT_SCALE PLAYER_EXTCFG().crosshairsize + + if (SIGHT_SCALE == 0) { + // Draw single rectangle to preserve intended opacity + gDPHudRectangle(gdl++, x, y, x, y); + } else { + 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); diff --git a/src/include/types.h b/src/include/types.h index 81b71ca6d..2a0491896 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6140,6 +6140,7 @@ struct extplayerconfig { f32 crosshairsway; s32 extcontrols; u32 crosshaircolour; + u32 crosshairsize; }; #endif From 81313f0c4e73510198819db922caee4460d58947 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 14 Jan 2024 21:13:31 +0100 Subject: [PATCH 3/4] port: ifdef around sight scale changes --- src/game/sight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/sight.c b/src/game/sight.c index fa2155d4d..fb5f255ae 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -24,6 +24,7 @@ #include "video.h" #define SIGHT_COLOUR PLAYER_EXTCFG().crosshaircolour +#define SIGHT_SCALE PLAYER_EXTCFG().crosshairsize static inline f32 sightGetScaleX(void) { @@ -39,6 +40,7 @@ static inline s32 sightGetAdjustedX(const f32 x) #else #define SIGHT_COLOUR 0x00ff0028 +#define SIGHT_SCALE 2 #define sightGetScaleX() 1.f #define sightGetAdjustedX(x) (x) @@ -1471,14 +1473,12 @@ Gfx *sightDrawTarget(Gfx *gdl) #ifndef PLATFORM_N64 gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_CENTER_EXT); -#endif - -#define SIGHT_SCALE PLAYER_EXTCFG().crosshairsize - if (SIGHT_SCALE == 0) { // Draw single rectangle to preserve intended opacity gDPHudRectangle(gdl++, x, y, x, y); - } else { + } else +#endif + { 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); From e53f26f3ebf2ae34b685104237224dc4f8bac0fa Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 15 Jan 2024 09:45:56 +0100 Subject: [PATCH 4/4] port: fix #347 patch submitted by Ryan Dwyer The patch allows all humans/bots to be selected regardless of team. It also adds a check to make sure a bot is not given a command to attack itself. --- src/game/activemenu.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index bba991a14..bc984de99 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -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--;