port: add mouse controls to eyespy and slayer

This commit is contained in:
fgsfds committed 2023-08-18 14:47:08 +02:00
1 parent bc4c08fe2f
commit a49bfd00a4
5 files changed
+45 -5

No files matched your search

+21
View File
@@ -24,6 +24,9 @@
#include "lib/collision.h"
#include "data.h"
#include "types.h"
#ifndef PLATFORM_N64
#include "input.h"
#endif
u8 g_EyespyPickup = false;
u8 g_EyespyHit = EYESPYHIT_NONE;
@@ -898,6 +901,24 @@ void eyespyProcessInput(bool allowbuttons)
}
#endif
#ifndef PLATFORM_N64
if (g_Vars.currentplayernum == 0) {
f32 mdx, mdy;
inputMouseGetScaledDelta(&mdx, &mdy);
if (mdx || mdy) {
mdx *= g_Vars.lvupdate60freal;
mdy *= g_Vars.lvupdate60freal;
g_Vars.currentplayer->eyespy->theta += mdx * 1.5f;
// hold aim to move up and down, release to look up and down
if (aimpressed) {
ascendspeed -= mdy;
} else {
g_Vars.currentplayer->eyespy->verta -= mdy * 1.5f;
}
}
}
#endif
// Update theta
g_Vars.currentplayer->eyespy->theta += c1stickx * 0.0625f * g_Vars.lvupdate60freal;
+1 -1
View File
@@ -697,7 +697,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
movedata.analogwalk = movedata.c1stickysafe;
#ifndef PLATFORM_N64
if (inputMouseIsLocked() && g_Vars.currentplayernum == 0 && (allowc1x || allowc1y)) {
if (g_Vars.currentplayernum == 0 && (allowc1x || allowc1y)) {
inputMouseGetScaledDelta(&movedata.freelookdx, &movedata.freelookdy);
}
#endif
+12
View File
@@ -72,6 +72,7 @@
#include "types.h"
#ifndef PLATFORM_N64
#include "video.h"
#include "input.h"
#endif
s32 g_DefaultWeapons[2];
@@ -3540,6 +3541,17 @@ void playerTick(bool arg0)
sp178 = sticky * LVUPDATE60FREAL() * 0.00025f;
sp174 = -stickx * LVUPDATE60FREAL() * 0.00025f;
#ifndef PLATFORM_N64
if (g_Vars.currentplayernum == 0) {
f32 mdx, mdy;
inputMouseGetScaledDelta(&mdx, &mdy);
if (mdx || mdy) {
sp178 += mdy * LVUPDATE60FREAL() * 0.0025f;
sp174 -= mdx * LVUPDATE60FREAL() * 0.0025f;
}
}
#endif
f20 = sqrtf(sp2ac.f[0] * sp2ac.f[0] + sp2ac.f[2] * sp2ac.f[2]);
sp2ac.x /= f20;