forked from Ports/goldeneye-pc-port
Compare commits
2
Commits
0e767334f7
...
4bc46d3434
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bc46d3434 | ||
|
|
3cefb1d4e5 |
No files matched your search
+18
-1
@@ -507,6 +507,13 @@ static int controlScheme = 0; /* D513 Input.ControlScheme: 0
|
|||||||
* the live control (the game honours it in bondview2's stick-pitch path),
|
* the live control (the game honours it in bondview2's stick-pitch path),
|
||||||
* so it must stay user-settable there. */
|
* so it must stay user-settable there. */
|
||||||
int inputControlScheme(void) { return controlScheme; }
|
int inputControlScheme(void) { return controlScheme; }
|
||||||
|
|
||||||
|
/* Look ahead (Modern scheme): set when the right stick or mouse pitched the
|
||||||
|
* view, the equivalent of the N64's C-up/C-down while walking; the game thread
|
||||||
|
* consumes it once per tick (portLookAheadManualPitch). */
|
||||||
|
static SDL_atomic_t s_manualPitch;
|
||||||
|
static void noteManualPitch(void) { SDL_AtomicSet(&s_manualPitch, 1); }
|
||||||
|
int portLookAheadManualPitch(void) { return SDL_AtomicSet(&s_manualPitch, 0); }
|
||||||
/* D645: Original scheme -- F10 "Invert look" mirrors the game's own
|
/* D645: Original scheme -- F10 "Invert look" mirrors the game's own
|
||||||
* "Look up/down" (watchsettings.c keeps the two in sync both ways). */
|
* "Look up/down" (watchsettings.c keeps the two in sync both ways). */
|
||||||
static int padLookInvertY = 0; /* Input.PadLookInvertY: 1 = invert the look stick's Y (right stick in SOLITARE roles, left stick in HONEY roles -- #145) */
|
static int padLookInvertY = 0; /* Input.PadLookInvertY: 1 = invert the look stick's Y (right stick in SOLITARE roles, left stick in HONEY roles -- #145) */
|
||||||
@@ -1074,6 +1081,7 @@ struct aimSlotState {
|
|||||||
int gepdHeldPrev; /* aim held last tick -> adopt on entry */
|
int gepdHeldPrev; /* aim held last tick -> adopt on entry */
|
||||||
int aimHeldPrev; /* was s_aimHeldPrev */
|
int aimHeldPrev; /* was s_aimHeldPrev */
|
||||||
int centreClearTicks; /* was s_centreClearTicks */
|
int centreClearTicks; /* was s_centreClearTicks */
|
||||||
|
int mouseThisAim; /* mouse moved during this aim hold: keep its position while the stick is used too */
|
||||||
};
|
};
|
||||||
static struct aimSlotState s_aimSt[4];
|
static struct aimSlotState s_aimSt[4];
|
||||||
#define AIMS (s_aimSt[(s_slot > 0 && s_slot < 4) ? s_slot : 0])
|
#define AIMS (s_aimSt[(s_slot > 0 && s_slot < 4) ? s_slot : 0])
|
||||||
@@ -2516,6 +2524,7 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
|
|||||||
AIMS.centreClearTicks = 2; /* see D194 centre-spring note above */
|
AIMS.centreClearTicks = 2; /* see D194 centre-spring note above */
|
||||||
if (!aimHeld) {
|
if (!aimHeld) {
|
||||||
AIMS.centreClearTicks = 0;
|
AIMS.centreClearTicks = 0;
|
||||||
|
AIMS.mouseThisAim = 0;
|
||||||
/* GEPD adopts the game's current crosshair pos every non-aim
|
/* GEPD adopts the game's current crosshair pos every non-aim
|
||||||
* frame so re-entry starts where the game left it. */
|
* frame so re-entry starts where the game left it. */
|
||||||
AIMS.gepdHeldPrev = 0;
|
AIMS.gepdHeldPrev = 0;
|
||||||
@@ -2673,6 +2682,8 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
|
|||||||
double dyLook = edy * invert; /* >0 => look down */
|
double dyLook = edy * invert; /* >0 => look down */
|
||||||
if (!menuMode && (fabs(edx) > 0.01 || fabs(dyLook) > 0.01))
|
if (!menuMode && (fabs(edx) > 0.01 || fabs(dyLook) > 0.01))
|
||||||
s_aimDevMouse = 1; /* D337: mouse is the active aim device */
|
s_aimDevMouse = 1; /* D337: mouse is the active aim device */
|
||||||
|
if (!menuMode && fabs(dyLook) > 0.01)
|
||||||
|
noteManualPitch();
|
||||||
|
|
||||||
/* D194(b): gameplay-look-only dt normalization -- see the
|
/* D194(b): gameplay-look-only dt normalization -- see the
|
||||||
* MOUSE_DT_REF comment above. Computed unconditionally (so the
|
* MOUSE_DT_REF comment above. Computed unconditionally (so the
|
||||||
@@ -2839,6 +2850,8 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
|
|||||||
* driven by the port-supplied turn through the
|
* driven by the port-supplied turn through the
|
||||||
* sub_GAME_7F067FBC hook (see Input.PdMouseAim above). */
|
* sub_GAME_7F067FBC hook (see Input.PdMouseAim above). */
|
||||||
aimGepdAccumulate(edx, dyLook);
|
aimGepdAccumulate(edx, dyLook);
|
||||||
|
if (fabs(edx) > 0.01 || fabs(dyLook) > 0.01)
|
||||||
|
AIMS.mouseThisAim = 1;
|
||||||
/* Edge-scroll belongs to the aim position, not to the
|
/* Edge-scroll belongs to the aim position, not to the
|
||||||
* crosshair model -- without this the camera stops
|
* crosshair model -- without this the camera stops
|
||||||
* following the crosshair at the screen edge. */
|
* following the crosshair at the screen edge. */
|
||||||
@@ -3007,6 +3020,7 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
|
|||||||
rys = (int)lround(padSmSY[idx]);
|
rys = (int)lround(padSmSY[idx]);
|
||||||
}
|
}
|
||||||
if (padLookInvertY) rys = -rys;
|
if (padLookInvertY) rys = -rys;
|
||||||
|
if (rys) noteManualPitch();
|
||||||
if (idx == 0) { s_recPadDX = rxs; s_recPadDY = rys; s_recPadDirect = 0; }
|
if (idx == 0) { s_recPadDX = rxs; s_recPadDY = rys; s_recPadDirect = 0; }
|
||||||
if (aimModeGet() == AIMMODE_CENTRED && !(idx == 0 && s_replayActive) &&
|
if (aimModeGet() == AIMMODE_CENTRED && !(idx == 0 && s_replayActive) &&
|
||||||
padDirectCompute(rxs, rys)) {
|
padDirectCompute(rxs, rys)) {
|
||||||
@@ -3898,7 +3912,10 @@ int portMouseAimPdActive(void)
|
|||||||
{
|
{
|
||||||
/* D337: only while the mouse is the device driving aim -- otherwise the
|
/* D337: only while the mouse is the device driving aim -- otherwise the
|
||||||
* pad's stick turn (the N64 path, weapon damp) must reach the game. */
|
* pad's stick turn (the N64 path, weapon damp) must reach the game. */
|
||||||
return pdMouseAimEnabled() && mouseGrabbed && s_aimDevMouse;
|
/* The mouse stays the aim position for the whole hold once it moved (gyro
|
||||||
|
* sent as mouse); the stick then offsets it (gunfire.c) instead of taking
|
||||||
|
* over. */
|
||||||
|
return pdMouseAimEnabled() && mouseGrabbed && (s_aimDevMouse || s_aimSt[0].mouseThisAim);
|
||||||
}
|
}
|
||||||
|
|
||||||
int portMouseAimPdGetTurn(f32 *tx, f32 *ty)
|
int portMouseAimPdGetTurn(f32 *tx, f32 *ty)
|
||||||
|
|||||||
@@ -5939,6 +5939,52 @@ void bondviewProcessInput(s8 stick_x, s8 stick_y, u16 buttons, u16 oldbuttons)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PORT
|
||||||
|
/* Look ahead in the Modern scheme. The port runs the stick-look style
|
||||||
|
* (1.2/1.4: left stick walks through digital C-steps, right stick or
|
||||||
|
* mouse pitches the view), where the N64 turns look ahead off and its
|
||||||
|
* trigger (analog walk past 60) never fires anyway. Enable it there,
|
||||||
|
* let walking forward/back stand in for the analog walk, and make a
|
||||||
|
* manual pitch release the centring until the walk stops, like
|
||||||
|
* C-up/C-down while walking with the 1.1 analog stick. */
|
||||||
|
{
|
||||||
|
extern int inputControlScheme(void);
|
||||||
|
extern int portLookAheadManualPitch(void);
|
||||||
|
s32 manualpitch = portLookAheadManualPitch();
|
||||||
|
|
||||||
|
if (inputControlScheme() == 0)
|
||||||
|
{
|
||||||
|
const s32 type = cur_player_get_control_type();
|
||||||
|
|
||||||
|
/* Stick-look styles: the stick channel is the look, not a walk */
|
||||||
|
if ((type == CONTROLLER_CONFIG_SOLITARE) || (type == CONTROLLER_CONFIG_GOODNIGHT))
|
||||||
|
{
|
||||||
|
moveData.canLookAhead = !g_CurrentPlayer->insightaimmode;
|
||||||
|
moveData.disableLookAhead = 0;
|
||||||
|
|
||||||
|
/* The look stick in N64 aim mode reaches the game as natural pitch */
|
||||||
|
if (moveData.canNaturalPitch && (moveData.analogPitch != 0))
|
||||||
|
{
|
||||||
|
manualpitch = TRUE;
|
||||||
|
}
|
||||||
|
moveData.analogWalk = moveData.digitalStepForward ? 70 : (moveData.digitalStepBack ? -70 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* As the N64 does for C-up/C-down (speedVertaDown/Up below) */
|
||||||
|
if (manualpitch)
|
||||||
|
{
|
||||||
|
g_CurrentPlayer->docentreupdown = FALSE;
|
||||||
|
g_CurrentPlayer->automovecentre = FALSE;
|
||||||
|
|
||||||
|
if (moveData.canLookAhead && ((moveData.analogWalk > 60) || (moveData.analogWalk < -60)))
|
||||||
|
{
|
||||||
|
g_CurrentPlayer->movecentrerelease = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((g_CurrentPlayer->movecentrerelease) && (moveData.analogWalk < 40) && (moveData.analogWalk > -40))
|
if ((g_CurrentPlayer->movecentrerelease) && (moveData.analogWalk < 40) && (moveData.analogWalk > -40))
|
||||||
{
|
{
|
||||||
g_CurrentPlayer->movecentrerelease = FALSE;
|
g_CurrentPlayer->movecentrerelease = FALSE;
|
||||||
|
|||||||
+12
-2
@@ -5071,8 +5071,18 @@ void sub_GAME_7F067FBC(f32 turn_x, f32 turn_y)
|
|||||||
* functions. Identity when Input.PdMouseAim is off, and the N64 build
|
* functions. Identity when Input.PdMouseAim is off, and the N64 build
|
||||||
* never sees any of it. Behavioural hook, not the ABI exception:
|
* never sees any of it. Behavioural hook, not the ABI exception:
|
||||||
* Rule-2 sign-off given by the maintainer 2026-09-23. */
|
* Rule-2 sign-off given by the maintainer 2026-09-23. */
|
||||||
if (portMouseAimPdGetTurn(&turn_x, &turn_y)) {
|
{
|
||||||
guncrossdamp = 0.01f;
|
f32 mouse_x, mouse_y;
|
||||||
|
|
||||||
|
if (portMouseAimPdGetTurn(&mouse_x, &mouse_y)) {
|
||||||
|
/* The stick still offsets the crosshair from the mouse position, so
|
||||||
|
* gyro (sent as mouse) and right-stick aiming combine, as in PD */
|
||||||
|
turn_x += mouse_x;
|
||||||
|
turn_y += mouse_y;
|
||||||
|
turn_x = (turn_x < -1.0f) ? -1.0f : ((turn_x > 1.0f) ? 1.0f : turn_x);
|
||||||
|
turn_y = (turn_y < -1.0f) ? -1.0f : ((turn_y > 1.0f) ? 1.0f : turn_y);
|
||||||
|
guncrossdamp = 0.01f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user