forked from Ports/perfect_dark
Merge pull request #108 from rafccq/port
enable using mouse on the radial menu
This commit is contained in:
3 files changed
+34
No files matched your search
@@ -8,6 +8,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "constants.h"
|
||||||
|
|
||||||
#define MAX_BINDS 4
|
#define MAX_BINDS 4
|
||||||
#define TRIG_THRESHOLD (30 * 256)
|
#define TRIG_THRESHOLD (30 * 256)
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#include "lib/str.h"
|
#include "lib/str.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
#include "input.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void amTick(void)
|
void amTick(void)
|
||||||
{
|
{
|
||||||
@@ -45,6 +48,7 @@ void amTick(void)
|
|||||||
s8 gotonextscreen = false;
|
s8 gotonextscreen = false;
|
||||||
s8 cstickx = joyGetStickXOnSample(j, contpadnum);
|
s8 cstickx = joyGetStickXOnSample(j, contpadnum);
|
||||||
s8 csticky = joyGetStickYOnSample(j, contpadnum);
|
s8 csticky = joyGetStickYOnSample(j, contpadnum);
|
||||||
|
|
||||||
s8 absstickx;
|
s8 absstickx;
|
||||||
s8 abssticky;
|
s8 abssticky;
|
||||||
u16 buttonsstate = joyGetButtonsOnSample(j, contpadnum, 0xffff);
|
u16 buttonsstate = joyGetButtonsOnSample(j, contpadnum, 0xffff);
|
||||||
@@ -63,6 +67,24 @@ void amTick(void)
|
|||||||
|
|
||||||
g_AmMenus[g_AmIndex].allbots = false;
|
g_AmMenus[g_AmIndex].allbots = false;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
if (j == 0 && g_Vars.currentplayernum == 0 && inputMouseIsLocked()) {
|
||||||
|
f32 mdx, mdy;
|
||||||
|
struct activemenu *am = &g_AmMenus[g_AmIndex];
|
||||||
|
inputMouseGetScaledDelta(&mdx, &mdy);
|
||||||
|
if (mdx || mdy) {
|
||||||
|
am->mousex += mdx * 4.f;
|
||||||
|
am->mousey += mdy * 4.f;
|
||||||
|
am->mousex = (am->mousex > 127.f) ? 127.f : (am->mousex < -128.f) ? -128.f : am->mousex;
|
||||||
|
am->mousey = (am->mousey > 127.f) ? 127.f : (am->mousey < -128.f) ? -128.f : am->mousey;
|
||||||
|
}
|
||||||
|
const s32 newstickx = (s32)cstickx + (s32)am->mousex;
|
||||||
|
const s32 newsticky = (s32)csticky - (s32)am->mousey;
|
||||||
|
cstickx = (newstickx < -128) ? -128 : (newstickx > 127) ? 127 : newstickx;
|
||||||
|
csticky = (newsticky < -128) ? -128 : (newsticky > 127) ? 127 : newsticky;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
|
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
|
||||||
buttonsstate = buttonsstate & D_JPAD;
|
buttonsstate = buttonsstate & D_JPAD;
|
||||||
cstickx = 0;
|
cstickx = 0;
|
||||||
@@ -337,6 +359,12 @@ void amTick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
else {
|
||||||
|
g_AmMenus[g_AmIndex].mousex = 0.f;
|
||||||
|
g_AmMenus[g_AmIndex].mousey = 0.f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_Vars.currentplayer->activemenumode != AMMODE_EDIT) {
|
if (g_Vars.currentplayer->activemenumode != AMMODE_EDIT) {
|
||||||
s16 dist;
|
s16 dist;
|
||||||
|
|||||||
@@ -4303,6 +4303,11 @@ struct activemenu {
|
|||||||
/*0x32*/ u8 allbots; // when player holds R on the bot command screen
|
/*0x32*/ u8 allbots; // when player holds R on the bot command screen
|
||||||
/*0x33*/ u8 prevallbots; // used when opening "Pick Target" menu for attack command
|
/*0x33*/ u8 prevallbots; // used when opening "Pick Target" menu for attack command
|
||||||
/*0x34*/ s8 origscreennum; // original screen number before using allbots
|
/*0x34*/ s8 origscreennum; // original screen number before using allbots
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
/* */ f32 mousex;
|
||||||
|
/* */ f32 mousey;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct briefing {
|
struct briefing {
|
||||||
|
|||||||
Reference in new issue
Block a user