forked from Ports/perfect_dark
added Crosshair Edge Boundary Box
This commit is contained in:
1 parent
618a1f3386
commit
01b78105ff
5 files changed
+44
-17
No files matched your search
+17
-17
@@ -1412,31 +1412,31 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
// Handle turning and looking up/down via mouselook when aiming
|
||||
if (g_Vars.currentplayer->insightaimmode && allowmcross && bgunGetWeaponNum(HAND_RIGHT) != WEAPON_HORIZONSCANNER) {
|
||||
if (g_Vars.currentplayer->swivelpos[0] > 0.9f) {
|
||||
movedata.aimturnrightspeed = (g_Vars.currentplayer->swivelpos[0] - 0.9f) / 0.1f;
|
||||
movedata.aimturnleftspeed = 0.f;
|
||||
} else if (g_Vars.currentplayer->swivelpos[0] < -0.9f) {
|
||||
movedata.aimturnleftspeed = (g_Vars.currentplayer->swivelpos[0] - -0.9f) / -0.1f;
|
||||
movedata.aimturnrightspeed = 0.f;
|
||||
// Handle turning and looking (x/y) via mouselook when aiming
|
||||
bool allowcross = allowmcross;
|
||||
if (g_Vars.currentplayer->insightaimmode && allowcross && bgunGetWeaponNum(HAND_RIGHT) != WEAPON_HORIZONSCANNER) {
|
||||
float edge_boundary = PLAYER_EXTCFG().crosshairedgeboundary;
|
||||
if (g_Vars.currentplayer->swivelpos[0] > edge_boundary) {
|
||||
movedata.aimturnrightspeed += (g_Vars.currentplayer->swivelpos[0] - edge_boundary) / (1.0f - edge_boundary);
|
||||
} else if (g_Vars.currentplayer->swivelpos[0] < -edge_boundary) {
|
||||
movedata.aimturnleftspeed += (g_Vars.currentplayer->swivelpos[0] + edge_boundary) / -(1.0f - edge_boundary);
|
||||
}
|
||||
f32 vertaup = 0.f, vertadown = 0.f;
|
||||
if (g_Vars.currentplayer->swivelpos[1] > 0.9f) {
|
||||
vertaup = (g_Vars.currentplayer->swivelpos[1] - 0.9f) / 0.1f;
|
||||
} else if (g_Vars.currentplayer->swivelpos[1] < -0.9f) {
|
||||
vertadown = (g_Vars.currentplayer->swivelpos[1] - -0.9f) / -0.1f;
|
||||
if (g_Vars.currentplayer->swivelpos[1] > edge_boundary) {
|
||||
vertaup = (g_Vars.currentplayer->swivelpos[1] - edge_boundary) / (1.0f - edge_boundary);
|
||||
} else if (g_Vars.currentplayer->swivelpos[1] < -edge_boundary) {
|
||||
vertadown = (g_Vars.currentplayer->swivelpos[1] + edge_boundary) / -(1.0f - edge_boundary);
|
||||
}
|
||||
// Uninvert pitch if needed
|
||||
if (movedata.invertpitch) {
|
||||
movedata.speedvertaup = vertadown;
|
||||
movedata.speedvertadown = vertaup;
|
||||
movedata.speedvertaup += vertadown;
|
||||
movedata.speedvertadown += vertaup;
|
||||
} else {
|
||||
movedata.speedvertaup = vertaup;
|
||||
movedata.speedvertadown = vertadown;
|
||||
movedata.speedvertaup += vertaup;
|
||||
movedata.speedvertadown += vertadown;
|
||||
}
|
||||
} else {
|
||||
// Reset mouse aim position when not mouse aiming
|
||||
// Reset mouse/gyro aim position when not aiming
|
||||
g_Vars.currentplayer->swivelpos[0] = 0.f;
|
||||
g_Vars.currentplayer->swivelpos[1] = 0.f;
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = {
|
||||
.extcontrols = true, \
|
||||
.crosshaircolour = 0x00ff0028, \
|
||||
.crosshairsize = 2, \
|
||||
.crosshairedgeboundary = 0.7f, \
|
||||
.crosshairhealth = CROSSHAIR_HEALTH_OFF, \
|
||||
.usereloads = false, \
|
||||
}
|
||||
|
||||
@@ -6158,6 +6158,7 @@ struct extplayerconfig {
|
||||
s32 extcontrols;
|
||||
u32 crosshaircolour;
|
||||
u32 crosshairsize;
|
||||
f32 crosshairedgeboundary;
|
||||
s32 crosshairhealth;
|
||||
s32 usereloads;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user