Subversion Repositories eduke32

Rev

Rev 4439 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4439 Rev 4440
Line 68... Line 68...
68
68
69
    //BUTTONCLEAR(action);
69
    //BUTTONCLEAR(action);
70
    droidinput.functionHeld  &= ~((uint64_t) 1<<((uint64_t) (action)));
70
    droidinput.functionHeld  &= ~((uint64_t) 1<<((uint64_t) (action)));
71
}
71
}
72
72
-
 
73
#ifdef GP_LIC
-
 
74
#define GP_LIC_INC 4
-
 
75
#include "s-setup/gp_lic_include.h"
-
 
76
#endif
-
 
77
73
void PortableAction(int state, int action)
78
void PortableAction(int state, int action)
74
{
79
{
75
    LOGI("PortableAction action = %d, state = %d", action, state);
80
    LOGI("PortableAction action = %d, state = %d", action, state);
76
81
77
    if (action >= MENU_UP && action <= MENU_BACK)
82
    if (action >= MENU_UP && action <= MENU_BACK)
Line 87... Line 92...
87
    else
92
    else
88
    {
93
    {
89
        if (PortableRead(READ_MENU)) //If in the menu, dont do any game actions
94
        if (PortableRead(READ_MENU)) //If in the menu, dont do any game actions
90
            return;
95
            return;
91
96
-
 
97
#ifdef GP_LIC
-
 
98
#define GP_LIC_INC 5
-
 
99
#include "s-setup/gp_lic_include.h"
-
 
100
#endif
-
 
101
92
        //Special toggle for crouch, NOT when using jetpack or in water
102
        //Special toggle for crouch, NOT when using jetpack or in water
93
        if (!g_player[myconnectindex].ps->jetpack_on &&
103
        if (!g_player[myconnectindex].ps->jetpack_on &&
94
                g_player[myconnectindex].ps->on_ground &&
104
                g_player[myconnectindex].ps->on_ground &&
95
                (sector[g_player[myconnectindex].ps->cursectnum].lotag != ST_2_UNDERWATER))
105
                (sector[g_player[myconnectindex].ps->cursectnum].lotag != ST_2_UNDERWATER))
96
        {
106
        {
Line 107... Line 117...
107
        }
117
        }
108
118
109
        //Check if jumping while crouched
119
        //Check if jumping while crouched
110
        if (action == gamefunc_Jump)
120
        if (action == gamefunc_Jump)
111
        {
121
        {
112
            crouchToggleState = 0;
122
            droidinput.crouchToggleState = 0;
113
            changeActionState(0, gamefunc_Crouch);
123
            changeActionState(0, gamefunc_Crouch);
114
        }
124
        }
115
125
116
        changeActionState(state, action);
126
        changeActionState(state, action);
117
127
-
 
128
        if (state == 2)
-
 
129
            PortableAction(0,action);
-
 
130
118
        LOGI("PortableAction state = 0x%016llX", CONTROL_ButtonState);
131
        // LOGI("PortableAction state = 0x%016llX", CONTROL_ButtonState);
119
    }
132
    }
120
}
133
}
121
134
-
 
135
//Need these NAN check as not cumulative.
122
void PortableMove(float fwd, float strafe)
136
void PortableMove(float fwd, float strafe)
123
{
137
{
-
 
138
    if (!isnan(fwd))
124
    droidinput.forwardmove = fclamp2(fwd    + droidinput.forwardmove, -1.f, 1.f);
139
        droidinput.forwardmove = fclamp2(fwd, -1.f, 1.f);
-
 
140
-
 
141
    if (!isnan(strafe))
125
    droidinput.sidemove    = fclamp2(strafe + droidinput.sidemove,    -1.f, 1.f);
142
        droidinput.sidemove    = fclamp2(strafe,    -1.f, 1.f);
126
}
143
}
127
144
128
void PortableLook(double yaw, double pitch)
145
void PortableLook(double yaw, double pitch)
129
{
146
{
130
    //LOGI("PortableLookPitch %d %f",mode, pitch);
147
    // LOGI("PortableLookPitch %f %f",yaw, pitch);
131
    droidinput.pitch += pitch;
148
    droidinput.pitch += pitch;
132
    droidinput.yaw   += yaw;
149
    droidinput.yaw   += yaw;
133
}
150
}
134
151
-
 
152
void PortableLookJoystick(double yaw, double pitch)
-
 
153
{
-
 
154
    if (!isnan(pitch))
-
 
155
        droidinput.pitch_joystick = pitch;
-
 
156
-
 
157
    if (!isnan(yaw))
-
 
158
        droidinput.yaw_joystick   = yaw;
-
 
159
}
-
 
160
135
void PortableCommand(const char * cmd)
161
void PortableCommand(const char * cmd)
136
{
162
{
137
    OSD_Dispatch(cmd);
163
    OSD_Dispatch(cmd);
138
}
164
}
139
165
Line 183... Line 209...
183
}
209
}
184
210
185
void CONTROL_Android_PollDevices(ControlInfo *info)
211
void CONTROL_Android_PollDevices(ControlInfo *info)
186
{
212
{
187
    //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
213
    //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
-
 
214
    //LOGI("CONTROL_Android_PollDevices %f %f",droidinput.pitch,droidinput.yaw);
188
215
189
    info->dz     = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR);
216
    info->dz     = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR);
190
    info->dx     = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR);
217
    info->dx     = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR);
191
    info->dpitch = (int32_t)nearbyint(droidinput.pitch * ANDROIDPITCHFACTOR);
218
    info->dpitch = (int32_t)nearbyint(droidinput.pitch * ANDROIDPITCHFACTOR +
-
 
219
            droidinput.pitch_joystick * ANDROIDPITCHFACTORJOYSTICK);
192
    info->dyaw   = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR);
220
    info->dyaw   = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR -
-
 
221
            droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK);
193
222
194
    droidinput.forwardmove = droidinput.sidemove = 0.f;
223
    //droidinput.forwardmove = droidinput.sidemove = 0.f;
195
    droidinput.pitch = droidinput.yaw = 0.f;
224
    droidinput.pitch = droidinput.yaw = 0.f;
196
225
197
    CONTROL_ButtonState = 0;
226
    CONTROL_ButtonState = 0;
198
    CONTROL_ButtonState |= droidinput.functionSticky;
227
    CONTROL_ButtonState |= droidinput.functionSticky;
199
    CONTROL_ButtonState |= droidinput.functionHeld;
228
    CONTROL_ButtonState |= droidinput.functionHeld;