Subversion Repositories eduke32

Rev

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

Rev 4658 Rev 4693
Line 35... Line 35...
35
    LOGI("PortableKeyEvent %d %d %d",state,code,unicode);
35
    LOGI("PortableKeyEvent %d %d %d",state,code,unicode);
36
36
37
    SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, code);
37
    SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, code);
38
    SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
38
    SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
39
39
40
    if (code == 42)
40
    // if (code == 42)
41
        unicode = 42;
41
    //    unicode = 42;
42
42
43
    if (state)
43
    if (state)
44
    {
44
    {
45
        //if (unicode < 128)
45
        //if (unicode < 128)
46
        {
46
        {
Line 171... Line 171...
171
    //droidinput.right_double_action = -1;
171
    //droidinput.right_double_action = -1;
172
172
173
    main(argc, argv);
173
    main(argc, argv);
174
}
174
}
175
175
-
 
176
int consoleShown = 0;
-
 
177
void AndroidSetConsoleShown(int onf)
-
 
178
{
-
 
179
    consoleShown = onf;
-
 
180
}
176
181
177
extern int animation_playing;
182
extern int animation_playing;
178
-
 
-
 
183
extern int inExtraScreens; //In game.c
179
int32_t PortableRead(portableread_t r)
184
int32_t PortableRead(portableread_t r)
180
{
185
{
181
    switch (r)
186
    switch (r)
182
    {
187
    {
183
    case READ_SCREEN_MODE:
188
    case READ_SCREEN_MODE:
184
189
185
        if (animation_playing)
190
        if (animation_playing)
186
            return TOUCH_SCREEN_BLANK_TAP;
191
            return TOUCH_SCREEN_BLANK_TAP;
-
 
192
        else if (inExtraScreens)
-
 
193
            return TOUCH_SCREEN_BLANK_TAP;
-
 
194
        else if (consoleShown)
-
 
195
            return TOUCH_SCREEN_CONSOLE;
187
        else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU)
196
        else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU)
188
        {
197
        {
189
            //Then check if Yes/No menu
198
            //Then check if Yes/No menu
190
            if ((g_currentMenu == MENU_QUITTOTITLE) ||
199
            if ((g_currentMenu == MENU_QUITTOTITLE) ||
191
                    (g_currentMenu == MENU_RESETPLAYER ) ||
200
                    (g_currentMenu == MENU_RESETPLAYER ) ||
192
                    (g_currentMenu == MENU_RESETPLAYER2 ) ||
201
                    ((g_currentMenu == MENU_LOADVERIFY )) ||
193
                    ((g_currentMenu >= MENU_LOADVERIFY ) && (g_currentMenu <= MENU_LOADVERIFY10 )) ||
-
 
194
                    (g_currentMenu == MENU_NEWVERIFY ) ||
202
                    (g_currentMenu == MENU_NEWVERIFY ) ||
195
                    ((g_currentMenu >= MENU_SAVEVERIFY ) &&  (g_currentMenu <= MENU_SAVEVERIFY10 )) ||
203
                    ((g_currentMenu == MENU_SAVEVERIFY )) ||
196
                    (g_currentMenu == MENU_QUIT ) ||
204
                    (g_currentMenu == MENU_QUIT ) ||
197
                    (g_currentMenu == MENU_QUIT2) ||
-
 
198
                    (g_currentMenu == MENU_QUITTOTITLE )
205
                    (g_currentMenu == MENU_QUITTOTITLE )
199
            )
206
            )
200
                return TOUCH_SCREEN_YES_NO;
207
                return TOUCH_SCREEN_YES_NO;
201
            else
208
            else
202
                return TOUCH_SCREEN_MENU;
209
                return TOUCH_SCREEN_MENU;
203
        }
210
        }
-
 
211
        else if (ud.overhead_on == 2)
-
 
212
            return TOUCH_SCREEN_AUTOMAP;
204
        else if ((g_player[myconnectindex].ps->gm & MODE_GAME))
213
        else if ((g_player[myconnectindex].ps->gm & MODE_GAME))
-
 
214
            if (PortableRead(READ_IS_DEAD))
-
 
215
                return TOUCH_SCREEN_BLANK_TAP;
-
 
216
            else
205
            return TOUCH_SCREEN_GAME;
217
                return TOUCH_SCREEN_GAME;
206
        else
218
        else
207
            return TOUCH_SCREEN_BLANK_TAP;
219
            return TOUCH_SCREEN_BLANK_TAP;
208
220
209
    case READ_WEAPONS:
221
    case READ_WEAPONS:
Line 216... Line 228...
216
        return getrendermode();
228
        return getrendermode();
217
    case READ_LASTWEAPON:
229
    case READ_LASTWEAPON:
218
        return droidinput.lastWeapon;
230
        return droidinput.lastWeapon;
219
    case READ_PAUSED:
231
    case READ_PAUSED:
220
        return ud.pause_on != 0;
232
        return ud.pause_on != 0;
-
 
233
    case READ_IS_DEAD:
-
 
234
        return g_player[myconnectindex].ps->dead_flag;
221
    default:
235
    default:
222
        return 0;
236
        return 0;
223
    }
237
    }
224
}
238
}
225
239
-
 
240
static float map_zoom,map_dx,map_dy = 0;
-
 
241
-
 
242
void PortableAutomapControl(float zoom,float dx,float dy)
-
 
243
{
-
 
244
    map_zoom += zoom;
-
 
245
    map_dx += dx;
-
 
246
    map_dy += dy;
-
 
247
}
-
 
248
226
///This stuff is called from the game/engine
249
///This stuff is called from the game/engine
227
250
-
 
251
extern void  CONTROL_Android_ScrollMap(int32_t *angle,int32_t *x, int32_t *y, uint16_t *zoom )
-
 
252
{
-
 
253
-
 
254
    *x += ((int)(map_dx * -30000)*sintable[(512+2048-*angle)&2047])>>14;
-
 
255
    *y += ((int)(map_dy * -30000)*sintable[(512+1024-512-*angle)&2047])>>14;
-
 
256
-
 
257
    *zoom += map_zoom * 2000;
-
 
258
    //*angle = 0;
-
 
259
    map_dx = map_dy = map_zoom = 0;
-
 
260
}
-
 
261
228
void CONTROL_Android_SetLastWeapon(int w)
262
void CONTROL_Android_SetLastWeapon(int w)
229
{
263
{
230
    LOGI("setLastWeapon %d",w);
264
    LOGI("setLastWeapon %d",w);
231
    droidinput.lastWeapon = w;
265
    droidinput.lastWeapon = w;
232
}
266
}
Line 241... Line 275...
241
void CONTROL_Android_PollDevices(ControlInfo *info)
275
void CONTROL_Android_PollDevices(ControlInfo *info)
242
{
276
{
243
    //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
277
    //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
244
    //LOGI("CONTROL_Android_PollDevices %f %f",droidinput.pitch,droidinput.yaw);
278
    //LOGI("CONTROL_Android_PollDevices %f %f",droidinput.pitch,droidinput.yaw);
245
279
246
    info->dz     = (int32_t)Blrintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR);
280
    info->dz     = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR);
247
    info->dx     = (int32_t)Blrintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR);
281
    info->dx     = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR);
248
    info->dpitch = (int32_t)Blrintf(droidinput.pitch * ANDROIDPITCHFACTOR +
282
    info->dpitch = (int32_t)nearbyint(droidinput.pitch * ANDROIDPITCHFACTOR +
249
            droidinput.pitch_joystick * ANDROIDPITCHFACTORJOYSTICK);
283
            droidinput.pitch_joystick * ANDROIDPITCHFACTORJOYSTICK);
250
    info->dyaw   = (int32_t)Blrintf(-droidinput.yaw * ANDROIDYAWFACTOR -
284
    info->dyaw   = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR -
251
            droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK);
285
            droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK);
252
286
253
    /*
287
    /*
254
    if (clearCtrl == 0)
288
    if (clearCtrl == 0)
255
        clearCtrl = 1;
289
        clearCtrl = 1;