Subversion Repositories eduke32

Rev

Rev 4989 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4989 Rev 5066
1
#include "function.h"
1
#include "function.h"
2
#include "compat.h"
2
#include "compat.h"
3
3
4
#ifdef __cplusplus
4
#ifdef __cplusplus
5
extern "C"
5
extern "C"
6
{
6
{
7
#endif
7
#endif
8
8
9
#define MENU_UP                  0x200
9
#define MENU_UP                  0x200
10
#define MENU_DOWN                0x201
10
#define MENU_DOWN                0x201
11
#define MENU_LEFT                0x202
11
#define MENU_LEFT                0x202
12
#define MENU_RIGHT               0x203
12
#define MENU_RIGHT               0x203
13
#define MENU_SELECT              0x204
13
#define MENU_SELECT              0x204
14
#define MENU_BACK                0x205
14
#define MENU_BACK                0x205
15
15
16
#define KEY_QUICK_CMD    0x1005
16
#define KEY_QUICK_CMD    0x1005
17
#define KEY_SHOW_KBRD    0x1008
17
#define KEY_SHOW_KBRD    0x1008
18
#define KEY_SHOW_INVEN    0x1009
18
#define KEY_SHOW_INVEN    0x1009
19
#define KEY_QUICK_SAVE    0x100A
19
#define KEY_QUICK_SAVE    0x100A
20
#define KEY_QUICK_LOAD    0x100B
20
#define KEY_QUICK_LOAD    0x100B
21
21
22
#define KEY_QUICK_KEY1    0x1011
22
#define KEY_QUICK_KEY1    0x1011
23
#define KEY_QUICK_KEY2    0x1012
23
#define KEY_QUICK_KEY2    0x1012
24
#define KEY_QUICK_KEY3    0x1013
24
#define KEY_QUICK_KEY3    0x1013
25
#define KEY_QUICK_KEY4    0x1014
25
#define KEY_QUICK_KEY4    0x1014
26
26
27
// #define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x))))
27
// #define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x))))
28
// #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x))))
28
// #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x))))
29
29
30
#define PRECISIONSHOOTFACTOR        0.3f
30
#define PRECISIONSHOOTFACTOR        0.3f
31
31
32
// where do these numbers come from?
32
// where do these numbers come from?
33
#define ANDROIDFORWARDMOVEFACTOR    5000
-
 
34
#define ANDROIDSIDEMOVEFACTOR       200
-
 
35
#define ANDROIDPITCHFACTOR          100000
33
#define ANDROIDMOVEFACTOR           6400
36
#define ANDROIDYAWFACTOR            160000
34
#define ANDROIDLOOKFACTOR          160000
37
35
38
#define ANDROIDPITCHFACTORJOYSTICK          2000
36
#define ANDROIDPITCHFACTORJOYSTICK          2000
39
#define ANDROIDYAWFACTORJOYSTICK            4000
37
#define ANDROIDYAWFACTORJOYSTICK            4000
40
38
41
39
42
#define MINCONTROLALPHA             0.25f
40
#define MINCONTROLALPHA             0.25f
43
41
44
typedef enum {
42
typedef enum {
45
    READ_SCREEN_MODE,
43
    READ_SCREEN_MODE,
46
    READ_WEAPONS,
44
    READ_WEAPONS,
47
    READ_AUTOMAP,
45
    READ_AUTOMAP,
48
    READ_MAPFOLLOWMODE,
46
    READ_MAPFOLLOWMODE,
49
    READ_RENDERER,
47
    READ_RENDERER,
50
    READ_LASTWEAPON,
48
    READ_LASTWEAPON,
51
    READ_PAUSED,
49
    READ_PAUSED,
52
    READ_IS_DEAD,
50
    READ_IS_DEAD,
53
    READ_INVENTORY,
51
    READ_INVENTORY,
54
    READ_SOMETHINGONPLAYER
52
    READ_SOMETHINGONPLAYER
55
} portableread_t;
53
} portableread_t;
56
54
57
55
58
typedef enum {
56
typedef enum {
59
    TOUCH_SCREEN_BLANK, //Nothing on screen (not used)
57
    TOUCH_SCREEN_BLANK, //Nothing on screen (not used)
60
    TOUCH_SCREEN_BLANK_TAP, //One button filling screen with no graphic, tap to send Enter key
58
    TOUCH_SCREEN_BLANK_TAP, //One button filling screen with no graphic, tap to send Enter key
61
    TOUCH_SCREEN_YES_NO, //Yes/No buttons on screen, sends Enter or Esc
59
    TOUCH_SCREEN_YES_NO, //Yes/No buttons on screen, sends Enter or Esc
62
    TOUCH_SCREEN_MENU, //Normal Menu arrows and Enter Esc keys
60
    TOUCH_SCREEN_MENU, //Normal Menu arrows and Enter Esc keys
63
    TOUCH_SCREEN_GAME, //Normal game screen
61
    TOUCH_SCREEN_GAME, //Normal game screen
64
    TOUCH_SCREEN_AUTOMAP, //When auto map is up (not used yet)
62
    TOUCH_SCREEN_AUTOMAP, //When auto map is up (not used yet)
65
    TOUCH_SCREEN_CONSOLE //When Console is up
63
    TOUCH_SCREEN_CONSOLE //When Console is up
66
} touchscreemode_t;
64
} touchscreemode_t;
67
65
68
66
69
typedef struct
67
typedef struct
70
{
68
{
71
    int32_t crouchToggleState;
69
    int32_t crouchToggleState;
72
    int32_t lastWeapon;
70
    int32_t lastWeapon;
73
    int32_t toggleCrouch;
71
    int32_t toggleCrouch;
74
    int32_t quickSelectWeapon;
72
    int32_t quickSelectWeapon;
75
73
76
    uint64_t functionSticky; //To let at least one tick
74
    uint64_t functionSticky; //To let at least one tick
77
    uint64_t functionHeld;
75
    uint64_t functionHeld;
78
76
79
    int32_t left_double_action;
77
    int32_t left_double_action;
80
    int32_t right_double_action;
78
    int32_t right_double_action;
81
79
82
    int32_t invertLook, hideStick;
80
    int32_t invertLook, hideStick;
83
81
84
    double pitch, yaw;
82
    double pitch, yaw;
85
    double pitch_joystick, yaw_joystick;
83
    double pitch_joystick, yaw_joystick;
86
    float forwardmove, sidemove;
84
    float forwardmove, sidemove;
87
85
88
    // set by configuration UI
86
    // set by configuration UI
89
    float strafe_sens, forward_sens;
87
    float strafe_sens, forward_sens;
90
    float pitch_sens, yaw_sens;
88
    float pitch_sens, yaw_sens;
91
89
92
    float gameControlsAlpha;
90
    float gameControlsAlpha;
93
} droidinput_t;
91
} droidinput_t;
94
92
95
typedef struct  
93
typedef struct  
96
{
94
{
97
    int32_t audio_sample_rate;
95
    int32_t audio_sample_rate;
98
    int32_t audio_buffer_size;
96
    int32_t audio_buffer_size;
99
    uint16_t screen_width, screen_height;
97
    uint16_t screen_width, screen_height;
100
} droidsysinfo_t;
98
} droidsysinfo_t;
101
99
102
extern droidinput_t droidinput;
100
extern droidinput_t droidinput;
103
extern droidsysinfo_t droidinfo;
101
extern droidsysinfo_t droidinfo;
104
102
105
103
106
int PortableKeyEvent(int state, int code, int unicode);
104
int PortableKeyEvent(int state, int code, int unicode);
107
int PortableRead(portableread_t r);
105
int PortableRead(portableread_t r);
108
106
109
void PortableAction(int state, int action);
107
void PortableAction(int state, int action);
110
108
111
void PortableMouseMenu(float x,float y);
109
void PortableMouseMenu(float x,float y);
112
void PortableMouseMenuButton(int state,int button);
110
void PortableMouseMenuButton(int state,int button);
113
111
114
void PortableMove(float fwd, float strafe);
112
void PortableMove(float fwd, float strafe);
115
void PortableLook(double yaw, double pitch);
113
void PortableLook(float yaw, float pitch);
116
void PortableLookJoystick(double yaw, double pitch);
114
void PortableLookJoystick(float yaw, float pitch);
117
void PortableCommand(const char * cmd);
115
void PortableCommand(const char * cmd);
118
116
119
void PortableAutomapControl(float zoom,float dx,float dy);
117
void PortableAutomapControl(float zoom,float dx,float dy);
120
118
121
void PortableInit(int argc, const char ** argv);
119
void PortableInit(int argc, const char ** argv);
122
120
123
void AndroidSetConsoleShown(int onf);
121
void AndroidSetConsoleShown(int onf);
124
122
125
123
126
#ifdef __cplusplus
124
#ifdef __cplusplus
127
}
125
}
128
#endif
126
#endif
129
 
127