Rev 4529 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4529 | Rev 4693 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | 55 | ||
56 | static int curRenderer; |
56 | static int curRenderer; |
57 | 57 | ||
58 | float gameControlsAlpha = 0.5; |
58 | float gameControlsAlpha = 0.5; |
59 | 59 | ||
60 | bool invertLook = false; |
60 | static bool invertLook = false; |
61 | bool precisionShoot = false; |
61 | static bool precisionShoot = false; |
62 | bool showSticks = true; |
62 | static bool showSticks = true; |
63 | bool hideTouchControls = true; |
63 | static bool hideTouchControls = true; |
64 | char toggleCrouch = true; |
64 | char toggleCrouch = true; |
- | 65 | static bool selectLastWeap = true; |
|
- | 66 | ||
- | 67 | static bool shooting = false; |
|
- | 68 | ||
- | 69 | static int weaponWheelVisible = false; |
|
65 | 70 | ||
66 | bool shooting = false; |
- | |
67 | 71 | ||
68 | static int controlsCreated = 0; |
72 | static int controlsCreated = 0; |
69 | touchcontrols::TouchControlsContainer controlsContainer; |
73 | touchcontrols::TouchControlsContainer controlsContainer; |
70 | 74 | ||
71 | touchcontrols::TouchControls *tcBlankTap=0; |
75 | touchcontrols::TouchControls *tcBlankTap=0; |
72 | touchcontrols::TouchControls *tcYesNo=0; |
76 | touchcontrols::TouchControls *tcYesNo=0; |
73 | touchcontrols::TouchControls *tcMenuMain=0; |
77 | touchcontrols::TouchControls *tcMenuMain=0; |
74 | touchcontrols::TouchControls *tcGameMain=0; |
78 | touchcontrols::TouchControls *tcGameMain=0; |
75 | touchcontrols::TouchControls *tcGameWeapons=0; |
79 | touchcontrols::TouchControls *tcGameWeapons=0; |
76 | touchcontrols::TouchControls *tcInventory=0; |
80 | //touchcontrols::TouchControls *tcInventory=0;
|
77 | touchcontrols::TouchControls *tcAutomap=0; |
81 | touchcontrols::TouchControls *tcAutomap=0; |
78 | 82 | ||
79 | 83 | ||
80 | touchcontrols::TouchJoy *touchJoyLeft; |
84 | touchcontrols::TouchJoy *touchJoyLeft; |
81 | touchcontrols::TouchJoy *touchJoyRight; |
- | |
82 | touchcontrols::WheelSelect *weaponWheel; |
85 | touchcontrols::WheelSelect *weaponWheel; |
83 | 86 | ||
84 | extern JNIEnv* env_; |
87 | extern JNIEnv* env_; |
85 | JavaVM* jvm_; |
88 | JavaVM* jvm_; |
86 | 89 | ||
Line 170... | Line 173... | ||
170 | checkPauseMethod = env_->GetStaticMethodID(NativeLibClass, "swapBuffers", "()V"); |
173 | checkPauseMethod = env_->GetStaticMethodID(NativeLibClass, "swapBuffers", "()V"); |
171 | }
|
174 | }
|
172 | env_->CallStaticVoidMethod(NativeLibClass, checkPauseMethod); |
175 | env_->CallStaticVoidMethod(NativeLibClass, checkPauseMethod); |
173 | }
|
176 | }
|
174 | 177 | ||
- | 178 | //This is a bit of a hack, if the weapon wheel was selected, then an inv chosen instead, we need to cancel the weapon selection
|
|
- | 179 | //NOT needed actually, weapon wheel disabled before is get finger up anyway
|
|
- | 180 | //static bool invWasSelected = false;
|
|
- | 181 | ||
- | 182 | void showWeaponsInventory(bool show) |
|
- | 183 | {
|
|
- | 184 | if (show) |
|
- | 185 | {
|
|
- | 186 | for (int n=0; n<10; n++) |
|
- | 187 | {
|
|
- | 188 | weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1); |
|
- | 189 | }
|
|
- | 190 | ||
- | 191 | //Show inventory buttons
|
|
- | 192 | tcGameWeapons->setAllButtonsEnable(true); |
|
- | 193 | ||
- | 194 | tcGameWeapons->fade(touchcontrols::FADE_IN, 5); //fade in |
|
- | 195 | weaponWheelVisible = true; |
|
- | 196 | }
|
|
- | 197 | else //hide |
|
- | 198 | {
|
|
- | 199 | tcGameWeapons->setAllButtonsEnable(false); |
|
- | 200 | weaponWheel->setTapMode(false); |
|
- | 201 | weaponWheelVisible = false; |
|
- | 202 | }
|
|
- | 203 | }
|
|
- | 204 | ||
175 | void gameButton(int state, int code) |
205 | void gameButton(int state, int code) |
176 | {
|
206 | {
|
177 | switch (code) |
207 | switch (code) |
178 | {
|
208 | {
|
179 | case gamefunc_Fire: |
209 | case gamefunc_Fire: |
Line 192... | Line 222... | ||
192 | if (state == 1) |
222 | if (state == 1) |
193 | showCustomCommands(); |
223 | showCustomCommands(); |
194 | break; |
224 | break; |
195 | 225 | ||
196 | case KEY_SHOW_INVEN: |
226 | case KEY_SHOW_INVEN: |
197 | if (state != 1) |
227 | if (state) |
198 | break; |
- | |
199 | - | ||
200 | if (!tcInventory->isEnabled()) |
- | |
201 | {
|
228 | {
|
202 | tcInventory->setEnabled(true); |
229 | if (!weaponWheelVisible) |
203 | tcInventory->fade(touchcontrols::FADE_IN, 5); |
230 | {
|
204 | //disable weapon wheel so it does not show, enabled again after inventory cleared
|
231 | weaponWheel->setTapMode(true); |
205 | tcGameWeapons->setEnabled(false); |
232 | showWeaponsInventory(true); |
206 | }
|
233 | }
|
207 | else
|
234 | else
|
208 | {
|
- | |
209 | tcInventory->setEnabled(false); |
- | |
210 | tcGameWeapons->setEnabled(true); |
235 | showWeaponsInventory(false); |
211 | }
|
236 | }
|
212 | - | ||
213 | break; |
237 | break; |
214 | 238 | ||
215 | case KEY_QUICK_SAVE: |
239 | case KEY_QUICK_SAVE: |
216 | LOGI("QUICK SAVE"); |
240 | LOGI("QUICK SAVE"); |
217 | PortableKeyEvent(state, SDL_SCANCODE_F6, 0); |
241 | PortableKeyEvent(state, SDL_SCANCODE_F6, 0); |
Line 236... | Line 260... | ||
236 | void inventoryButton(int state,int code) |
260 | void inventoryButton(int state,int code) |
237 | {
|
261 | {
|
238 | PortableAction(state,code); |
262 | PortableAction(state,code); |
239 | if (state == 0) |
263 | if (state == 0) |
240 | {
|
264 | {
|
241 | tcGameWeapons->setEnabled(true); |
265 | //Inventory chosen, hide them and wheel
|
242 | tcInventory->setEnabled(false); |
266 | showWeaponsInventory(false); |
243 | }
|
267 | }
|
244 | }
|
268 | }
|
245 | 269 | ||
246 | void menuButton(int state,int code) |
270 | void menuButton(int state,int code) |
247 | {
|
271 | {
|
248 | PortableKeyEvent(state, code,code); |
272 | PortableKeyEvent(state, code,code); |
249 | }
|
273 | }
|
250 | 274 | ||
251 | static int weaponWheelVisible = false; |
- | |
252 | - | ||
253 | void weaponWheelSelected(int enabled) |
275 | void blankTapButton(int state,int code) |
254 | {
|
276 | {
|
255 | if (!enabled) |
277 | if (PortableRead(READ_IS_DEAD)) //if the player is dead we need to send a 'open' button |
256 | {
|
278 | {
|
257 | //tcGameWeapons->fade(touchcontrols::FADE_OUT, 5);
|
- | |
258 | weaponWheelVisible = false; |
- | |
259 | }
|
- | |
260 | else
|
279 | if (state) |
261 | {
|
280 | {
|
- | 281 | PortableAction(1, gamefunc_Open); |
|
262 | for (int n=0; n<10; n++) |
282 | PortableAction(0, gamefunc_Open); |
- | 283 | }
|
|
- | 284 | }
|
|
- | 285 | else //everything else send a return key |
|
263 | {
|
286 | {
|
264 | weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1); |
287 | PortableKeyEvent(state, SDL_SCANCODE_RETURN,0); |
265 | }
|
288 | }
|
266 | 289 | ||
267 | tcGameWeapons->fade(touchcontrols::FADE_IN, 5); //fade in |
- | |
268 | weaponWheelVisible = true; |
- | |
269 | }
|
290 | }
|
270 | 291 | ||
- | 292 | void weaponWheelSelected(int enabled) |
|
- | 293 | {
|
|
271 | if (enabled) |
294 | if (enabled) |
272 | {
|
295 | {
|
273 | tcInventory->setEnabled(true); |
296 | showWeaponsInventory(true); |
274 | tcInventory->fade(touchcontrols::FADE_IN, 5); |
- | |
275 | //disable weapon wheel so it does not show, enabled again after inventory cleared
|
- | |
276 | // tcGameWeapons->setEnabled(false);
|
- | |
277 | }
|
297 | }
|
278 | else
|
298 | else
|
279 | {
|
299 | {
|
280 | tcInventory->setEnabled(false); |
300 | showWeaponsInventory(false); |
281 | // tcGameWeapons->setEnabled(true);
|
- | |
282 | }
|
301 | }
|
283 | - | ||
284 | }
|
302 | }
|
285 | 303 | ||
286 | void weaponWheelChosen(int segment) |
304 | void weaponWheelChosen(int segment) |
287 | {
|
305 | {
|
288 | LOGI("weaponWheel %d",segment); |
- | |
289 | 306 | ||
- | 307 | //LOGI("weaponWheel %d",segment);
|
|
290 | if (segment == -1) //Nothing was selected |
308 | if (segment == -1) //Nothing was selected |
291 | {
|
309 | {
|
- | 310 | if (selectLastWeap) |
|
- | 311 | {
|
|
292 | int32_t lw = PortableRead(READ_LASTWEAPON); |
312 | int32_t lw = PortableRead(READ_LASTWEAPON); |
293 | 313 | ||
294 | if (lw != -1) |
314 | if (lw != -1) |
295 | PortableAction(2, gamefunc_Weapon_1 + lw); |
315 | PortableAction(2, gamefunc_Weapon_1 + lw); |
296 | - | ||
297 | return; |
- | |
298 | }
|
316 | }
|
- | 317 | }
|
|
- | 318 | else
|
|
299 | 319 | {
|
|
300 | PortableAction(2, gamefunc_Weapon_1 + segment); |
320 | PortableAction(2, gamefunc_Weapon_1 + segment); |
301 | }
|
321 | }
|
- | 322 | }
|
|
302 | 323 | ||
303 | void left_double_tap(int state) |
324 | void left_double_tap(int state) |
304 | {
|
325 | {
|
305 | LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action); |
326 | //LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
|
306 | if (droidinput.left_double_action != -1) |
327 | if (droidinput.left_double_action != -1) |
307 | PortableAction(state, droidinput.left_double_action); |
328 | PortableAction(state, droidinput.left_double_action); |
308 | }
|
329 | }
|
309 | 330 | ||
310 | void right_double_tap(int state) |
331 | void right_double_tap(int state) |
Line 315... | Line 336... | ||
315 | }
|
336 | }
|
316 | 337 | ||
317 | void mouseMove(int action, float x, float y, float dx, float dy) |
338 | void mouseMove(int action, float x, float y, float dx, float dy) |
318 | {
|
339 | {
|
319 | //LOGI(" mouse dx = %f, dy = %f",dx,dy);
|
340 | //LOGI(" mouse dx = %f, dy = %f",dx,dy);
|
320 | - | ||
321 | if (weaponWheelVisible) |
341 | if (weaponWheelVisible) |
322 | return; |
342 | return; |
323 | 343 | ||
324 | double scale = (shooting && precisionShoot) ? PRECISIONSHOOTFACTOR : 1.f; |
344 | double scale = (shooting && precisionShoot) ? PRECISIONSHOOTFACTOR : 1.f; |
325 | 345 | ||
326 | PortableLook(dx * droidinput.yaw_sens * scale, |
346 | PortableLook(dx * droidinput.yaw_sens * scale, |
327 | -dy * droidinput.pitch_sens * scale * (invertLook ? -1.f : 1.f)); |
347 | -dy * droidinput.pitch_sens * scale * (invertLook ? -1.f : 1.f)); |
328 | }
|
348 | }
|
329 | 349 | ||
- | 350 | void automap_multitouch_mouse_move(int action,float x, float y,float dx, float dy) |
|
- | 351 | {
|
|
- | 352 | ||
- | 353 | if (action == MULTITOUCHMOUSE_MOVE) |
|
- | 354 | {
|
|
- | 355 | PortableAutomapControl(0,dx,dy); |
|
- | 356 | }
|
|
- | 357 | else if (action == MULTITOUCHMOUSE_ZOOM) |
|
- | 358 | {
|
|
- | 359 | PortableAutomapControl(x,0,0); |
|
- | 360 | }
|
|
- | 361 | }
|
|
- | 362 | ||
330 | void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) |
363 | void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) |
331 | {
|
364 | {
|
332 | //LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
|
365 | //LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
|
333 | - | ||
334 | joy_x *=10; |
366 | joy_x *=10; |
335 | float strafe = joy_x*joy_x; |
367 | float strafe = joy_x*joy_x; |
336 | //float strafe = joy_x;
|
368 | //float strafe = joy_x;
|
337 | if (joy_x < 0) |
369 | if (joy_x < 0) |
338 | strafe *= -1; |
370 | strafe *= -1; |
Line 340... | Line 372... | ||
340 | PortableMove(joy_y * 15 * droidinput.forward_sens, -strafe * droidinput.strafe_sens); |
372 | PortableMove(joy_y * 15 * droidinput.forward_sens, -strafe * droidinput.strafe_sens); |
341 | }
|
373 | }
|
342 | 374 | ||
343 | void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) |
375 | void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) |
344 | {
|
376 | {
|
345 | //LOGI(" mouse x = %f",mouse_x);
|
- | |
346 | - | ||
347 | mouseMove(0, joy_x, joy_y, mouse_x, mouse_y); |
377 | mouseMove(0, joy_x, joy_y, mouse_x, mouse_y); |
348 | }
|
378 | }
|
349 | 379 | ||
350 | void setHideSticks(bool v) |
380 | void setHideSticks(bool v) |
351 | {
|
381 | {
|
352 | if (touchJoyLeft) touchJoyLeft->setHideGraphics(v); |
382 | if (touchJoyLeft) touchJoyLeft->setHideGraphics(v); |
353 | if (touchJoyRight) touchJoyRight->setHideGraphics(v); |
- | |
354 | }
|
383 | }
|
355 | 384 | ||
356 | void touchSettingsButton(int state) |
385 | void touchSettingsButton(int state) |
357 | {
|
386 | {
|
358 | /*
|
387 | /*
|
Line 383... | Line 412... | ||
383 | controlsContainer.openGL_end.connect( sigc::ptr_fun(&openGLEnd)); |
412 | controlsContainer.openGL_end.connect( sigc::ptr_fun(&openGLEnd)); |
384 | controlsContainer.signal_settings.connect( sigc::ptr_fun(&touchSettingsButton)); |
413 | controlsContainer.signal_settings.connect( sigc::ptr_fun(&touchSettingsButton)); |
385 | 414 | ||
386 | tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false); |
415 | tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false); |
387 | tcYesNo = new touchcontrols::TouchControls("yes_no", false, false); |
416 | tcYesNo = new touchcontrols::TouchControls("yes_no", false, false); |
388 | tcMenuMain = new touchcontrols::TouchControls("menu", false, true,1,false); |
417 | tcMenuMain = new touchcontrols::TouchControls("menu", false, false); |
389 | tcGameMain = new touchcontrols::TouchControls("game", false,true,1,true); |
418 | tcGameMain = new touchcontrols::TouchControls("game", false,true,1,true); |
390 | tcGameWeapons = new touchcontrols::TouchControls("weapons", false,true,1,false); |
419 | tcGameWeapons = new touchcontrols::TouchControls("weapons", false,true,1,false); |
391 | tcAutomap = new touchcontrols::TouchControls("automap", false,true,1,false); |
420 | tcAutomap = new touchcontrols::TouchControls("automap", false,false); |
392 | tcInventory = new touchcontrols::TouchControls("inventory", false,true,1,false); |
421 | // tcInventory = new touchcontrols::TouchControls("inventory", false,true,1,false);
|
393 | 422 | ||
394 | ///////////////////////// BLANK TAP SCREEN //////////////////////
|
423 | ///////////////////////// BLANK TAP SCREEN //////////////////////
|
395 | 424 | ||
396 | //One button on whole screen with no graphic, send a return key
|
425 | //One button on whole screen with no graphic, send a return key
|
397 | tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0,0,26,16), "", SDL_SCANCODE_RETURN)); |
426 | tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0,0,26,16), std::string("test"), SDL_SCANCODE_RETURN)); |
398 | tcBlankTap->signal_button.connect( sigc::ptr_fun(&menuButton) ); //Just reuse the menuButton function |
427 | tcBlankTap->signal_button.connect( sigc::ptr_fun(&blankTapButton) ); //Just reuse the menuButton function |
399 | 428 | ||
400 | 429 | ||
401 | 430 | ||
402 | ///////////////////////// YES NO SCREEN /////////////////////
|
431 | ///////////////////////// YES NO SCREEN /////////////////////
|
403 | 432 | ||
404 | tcYesNo->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(8,10,11,13), "enter", SDL_SCANCODE_RETURN)); |
433 | tcYesNo->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(8,10,11,13), "yes", SDL_SCANCODE_RETURN)); |
405 | tcYesNo->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(14,10,17,13), "esc", SDL_SCANCODE_ESCAPE)); |
434 | tcYesNo->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(14,10,17,13), "no", SDL_SCANCODE_ESCAPE)); |
406 | tcYesNo->signal_button.connect( sigc::ptr_fun(&menuButton) ); //Just reuse the menuButton function |
435 | tcYesNo->signal_button.connect( sigc::ptr_fun(&menuButton) ); //Just reuse the menuButton function |
407 | 436 | ||
408 | 437 | ||
409 | 438 | ||
410 | ///////////////////////// MAIN MENU SCREEN /////////////////////
|
439 | ///////////////////////// MAIN MENU SCREEN /////////////////////
|
411 | 440 | ||
412 | //Menu
|
441 | //Menu
|
- | 442 | /* 3x3
|
|
413 | tcMenuMain->addControl(new touchcontrols::Button("down_arrow", touchcontrols::RectF(20,13,23,16), "arrow_down", SDL_SCANCODE_DOWN, true)); //Repeating buttons |
443 | tcMenuMain->addControl(new touchcontrols::Button("down_arrow", touchcontrols::RectF(20,13,23,16), "arrow_down", SDL_SCANCODE_DOWN, true)); //Repeating buttons
|
414 | tcMenuMain->addControl(new touchcontrols::Button("up_arrow", touchcontrols::RectF(20,10,23,13), "arrow_up", SDL_SCANCODE_UP, true)); |
444 | tcMenuMain->addControl(new touchcontrols::Button("up_arrow", touchcontrols::RectF(20,10,23,13), "arrow_up", SDL_SCANCODE_UP, true));
|
415 | tcMenuMain->addControl(new touchcontrols::Button("left_arrow", touchcontrols::RectF(17,13,20,16), "arrow_left", SDL_SCANCODE_LEFT, true)); |
445 | tcMenuMain->addControl(new touchcontrols::Button("left_arrow", touchcontrols::RectF(17,13,20,16), "arrow_left", SDL_SCANCODE_LEFT, true));
|
416 | tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(23,13,26,16), "arrow_right", SDL_SCANCODE_RIGHT, true)); |
446 | tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(23,13,26,16), "arrow_right", SDL_SCANCODE_RIGHT, true));
|
417 | tcMenuMain->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(0,13,3,16), "enter", SDL_SCANCODE_RETURN)); |
447 | tcMenuMain->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(0,13,3,16), "enter", SDL_SCANCODE_RETURN));
|
418 | tcMenuMain->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(0,10,3,13), "esc", SDL_SCANCODE_ESCAPE)); |
448 | tcMenuMain->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(0,10,3,13), "esc", SDL_SCANCODE_ESCAPE));
|
- | 449 | */
|
|
- | 450 | ||
- | 451 | tcMenuMain->addControl(new touchcontrols::Button("down_arrow", touchcontrols::RectF(22,14,24,16), "arrow_down", SDL_SCANCODE_DOWN, true)); //Repeating buttons |
|
- | 452 | tcMenuMain->addControl(new touchcontrols::Button("up_arrow", touchcontrols::RectF(22,12,24,14), "arrow_up", SDL_SCANCODE_UP, true)); |
|
- | 453 | tcMenuMain->addControl(new touchcontrols::Button("left_arrow", touchcontrols::RectF(20,14,22,16), "arrow_left", SDL_SCANCODE_LEFT, true)); |
|
- | 454 | tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(24,14,26,16), "arrow_right", SDL_SCANCODE_RIGHT, true)); |
|
- | 455 | tcMenuMain->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(0,14,2,16), "enter", SDL_SCANCODE_RETURN)); |
|
- | 456 | tcMenuMain->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(0,12,2,14), "esc", SDL_SCANCODE_ESCAPE)); |
|
- | 457 | ||
419 | 458 | ||
420 | 459 | ||
421 | tcMenuMain->signal_button.connect( sigc::ptr_fun(&menuButton) ); |
460 | tcMenuMain->signal_button.connect( sigc::ptr_fun(&menuButton) ); |
422 | tcMenuMain->setAlpha(1); |
461 | tcMenuMain->setAlpha(1); |
423 | 462 | ||
424 | ///////////////////////// AUTO MAP SCREEN ///////////////////////
|
- | |
425 | - | ||
426 | /* FIXME: definitely hook this up
|
- | |
427 | //Automap
|
- | |
428 | tcAutomap->addControl(new touchcontrols::Button("down_arrow",touchcontrols::RectF(2,14,4,16),"arrow_down",PORT_ACT_MAP_DOWN));
|
- | |
429 | tcAutomap->addControl(new touchcontrols::Button("up_arrow",touchcontrols::RectF(2,10,4,12),"arrow_up",PORT_ACT_MAP_UP));
|
- | |
430 | tcAutomap->addControl(new touchcontrols::Button("left_arrow",touchcontrols::RectF(0,12,2,14),"arrow_left",PORT_ACT_MAP_LEFT));
|
- | |
431 | tcAutomap->addControl(new touchcontrols::Button("right_arrow",touchcontrols::RectF(4,12,6,14),"arrow_right",PORT_ACT_MAP_RIGHT));
|
- | |
432 | tcAutomap->addControl(new touchcontrols::Button("zoom_in",touchcontrols::RectF(4,10,6,12),"zoom_in",PORT_ACT_MAP_ZOOM_IN));
|
- | |
433 | tcAutomap->addControl(new touchcontrols::Button("zoom_out",touchcontrols::RectF(4,14,6,16),"zoom_out",PORT_ACT_MAP_ZOOM_OUT));
|
- | |
434 | 463 | ||
435 | tcAutomap->signal_button.connect( sigc::ptr_fun(&automapButton) );
|
- | |
436 | tcAutomap->setAlpha(0.5);
|
- | |
437 | */
|
- | |
438 | 464 | ||
439 | //////////////////////////// GAME SCREEN /////////////////////
|
465 | //////////////////////////// GAME SCREEN /////////////////////
|
440 | tcGameMain->setAlpha(gameControlsAlpha); |
466 | tcGameMain->setAlpha(gameControlsAlpha); |
441 | controlsContainer.editButtonAlpha = gameControlsAlpha; |
467 | controlsContainer.editButtonAlpha = gameControlsAlpha; |
442 | tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(23,3,26,6), "use", gamefunc_Open)); |
468 | tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(23,3,26,6), "use", gamefunc_Open)); |
443 | tcGameMain->addControl(new touchcontrols::Button("attack", touchcontrols::RectF(20,7,23,10), "fire2", gamefunc_Fire)); |
469 | tcGameMain->addControl(new touchcontrols::Button("attack", touchcontrols::RectF(20,7,23,10), "fire2", gamefunc_Fire)); |
444 | tcGameMain->addControl(new touchcontrols::Button("jump", touchcontrols::RectF(23,6,26,9), "jump", gamefunc_Jump)); |
470 | tcGameMain->addControl(new touchcontrols::Button("jump", touchcontrols::RectF(23,6,26,9), "jump", gamefunc_Jump)); |
445 | tcGameMain->addControl(new touchcontrols::Button("crouch", touchcontrols::RectF(24,12,26,14), "crouch", gamefunc_Crouch)); |
471 | tcGameMain->addControl(new touchcontrols::Button("crouch", touchcontrols::RectF(24,12,26,14), "crouch", gamefunc_Crouch)); |
446 | tcGameMain->addControl(new touchcontrols::Button("kick", touchcontrols::RectF(20,4,23,7), "boot", gamefunc_Quick_Kick,false,true)); |
472 | tcGameMain->addControl(new touchcontrols::Button("kick","Mighty Foot", touchcontrols::RectF(20,4,23,7), "boot", gamefunc_Quick_Kick,false,true)); |
447 | 473 | ||
448 | tcGameMain->addControl(new touchcontrols::Button("quick_save", touchcontrols::RectF(24,0,26,2), "save", KEY_QUICK_SAVE,false,true)); |
474 | tcGameMain->addControl(new touchcontrols::Button("quick_save","Quick Save", touchcontrols::RectF(22,0,24,2), "save", KEY_QUICK_SAVE,false,true)); |
449 | tcGameMain->addControl(new touchcontrols::Button("quick_load", touchcontrols::RectF(20,0,22,2), "load", KEY_QUICK_LOAD,false,true)); |
475 | tcGameMain->addControl(new touchcontrols::Button("quick_load","Quick Load", touchcontrols::RectF(20,0,22,2), "load", KEY_QUICK_LOAD,false,true)); |
450 | tcGameMain->addControl(new touchcontrols::Button("map", touchcontrols::RectF(4,0,6,2), "map", gamefunc_Map, false,true)); |
476 | touchcontrols::Button *map_button = new touchcontrols::Button("map","Autotmap", touchcontrols::RectF(6,0,8,2), "map", gamefunc_Map, false,true); |
- | 477 | tcGameMain->addControl(map_button); |
|
451 | tcGameMain->addControl(new touchcontrols::Button("keyboard", touchcontrols::RectF(8,0,10,2), "keyboard", KEY_SHOW_KBRD, false,true)); |
478 | tcGameMain->addControl(new touchcontrols::Button("keyboard","Show Console", touchcontrols::RectF(8,0,10,2), "keyboard", KEY_SHOW_KBRD, false,true)); |
452 | 479 | ||
453 | tcGameMain->addControl(new touchcontrols::Button("show_inventory",touchcontrols::RectF(2,0,4,2), "inv", KEY_SHOW_INVEN)); |
480 | tcGameMain->addControl(new touchcontrols::Button("show_inventory","Show Inventory",touchcontrols::RectF(24,0,26,2), "inv", KEY_SHOW_INVEN)); |
454 | 481 | ||
455 | tcGameMain->addControl(new touchcontrols::Button("next_weapon", touchcontrols::RectF(0,3,3,5), "next_weap",gamefunc_Next_Weapon,false,true)); |
482 | tcGameMain->addControl(new touchcontrols::Button("next_weapon","Next Weapon", touchcontrols::RectF(0,3,3,5), "next_weap",gamefunc_Next_Weapon,false,true)); |
456 | tcGameMain->addControl(new touchcontrols::Button("prev_weapon", touchcontrols::RectF(0,5,3,7), "prev_weap",gamefunc_Previous_Weapon,false,true)); |
483 | tcGameMain->addControl(new touchcontrols::Button("prev_weapon","Previous Weapon", touchcontrols::RectF(0,5,3,7), "prev_weap",gamefunc_Previous_Weapon,false,true)); |
457 | /*
|
484 | /*
|
458 | //quick actions binds
|
485 | //quick actions binds
|
459 | tcGameMain->addControl(new touchcontrols::Button("quick_key_1",touchcontrols::RectF(4,3,6,5),"quick_key_1",KEY_QUICK_KEY1,false,true));
|
486 | tcGameMain->addControl(new touchcontrols::Button("quick_key_1",touchcontrols::RectF(4,3,6,5),"quick_key_1",KEY_QUICK_KEY1,false,true));
|
460 | tcGameMain->addControl(new touchcontrols::Button("quick_key_2",touchcontrols::RectF(6,3,8,5),"quick_key_2",KEY_QUICK_KEY2,false,true));
|
487 | tcGameMain->addControl(new touchcontrols::Button("quick_key_2",touchcontrols::RectF(6,3,8,5),"quick_key_2",KEY_QUICK_KEY2,false,true));
|
461 | tcGameMain->addControl(new touchcontrols::Button("quick_key_3",touchcontrols::RectF(8,3,10,5),"quick_key_3",KEY_QUICK_KEY3,false,true));
|
488 | tcGameMain->addControl(new touchcontrols::Button("quick_key_3",touchcontrols::RectF(8,3,10,5),"quick_key_3",KEY_QUICK_KEY3,false,true));
|
Line 465... | Line 492... | ||
465 | touchJoyLeft = new touchcontrols::TouchJoy("stick",touchcontrols::RectF(0,7,8,16),"strafe_arrow"); |
492 | touchJoyLeft = new touchcontrols::TouchJoy("stick",touchcontrols::RectF(0,7,8,16),"strafe_arrow"); |
466 | tcGameMain->addControl(touchJoyLeft); |
493 | tcGameMain->addControl(touchJoyLeft); |
467 | touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick) ); |
494 | touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick) ); |
468 | touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap) ); |
495 | touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap) ); |
469 | 496 | ||
470 | //Right stick
|
497 | //Right stick (not used)
|
471 | touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,7,26,16),"look_arrow"); |
498 | //touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,7,26,16),"look_arrow");
|
472 | tcGameMain->addControl(touchJoyRight); |
499 | //tcGameMain->addControl(touchJoyRight);
|
473 | touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) ); |
500 | //touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) );
|
474 | touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) ); |
501 | //touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) );
|
475 | touchJoyRight->setEnabled(false); |
502 | //touchJoyRight->setEnabled(false);
|
476 | - | ||
477 | 503 | ||
478 | 504 | ||
479 | //Mouse look for whole screen
|
505 | //Mouse look for whole screen
|
480 | touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse",touchcontrols::RectF(3,0,26,16),""); |
506 | touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse",touchcontrols::RectF(3,0,26,16),""); |
481 | mouse->signal_action.connect(sigc::ptr_fun(&mouseMove)); |
507 | mouse->signal_action.connect(sigc::ptr_fun(&mouseMove)); |
Line 485... | Line 511... | ||
485 | tcGameMain->addControl(mouse); |
511 | tcGameMain->addControl(mouse); |
486 | 512 | ||
487 | tcGameMain->signal_button.connect( sigc::ptr_fun(&gameButton) ); |
513 | tcGameMain->signal_button.connect( sigc::ptr_fun(&gameButton) ); |
488 | tcGameMain->signal_settingsButton.connect( sigc::ptr_fun(&gameSettingsButton) ); |
514 | tcGameMain->signal_settingsButton.connect( sigc::ptr_fun(&gameSettingsButton) ); |
489 | 515 | ||
- | 516 | ///////////////////////// AUTO MAP SCREEN ///////////////////////
|
|
- | 517 | ||
- | 518 | ||
- | 519 | //Automap
|
|
- | 520 | touchcontrols::MultitouchMouse *multimouse = new touchcontrols::MultitouchMouse("gamemouse",touchcontrols::RectF(0,0,26,16),""); |
|
- | 521 | multimouse->setHideGraphics(true); |
|
- | 522 | tcAutomap->addControl(multimouse); |
|
- | 523 | multimouse->signal_action.connect(sigc::ptr_fun(&automap_multitouch_mouse_move) ); |
|
- | 524 | tcAutomap->addControl(map_button); |
|
- | 525 | tcAutomap->signal_button.connect( sigc::ptr_fun(&gameButton) ); |
|
- | 526 | tcAutomap->setAlpha(0.5); |
|
- | 527 | ||
- | 528 | ||
- | 529 | ||
- | 530 | ||
- | 531 | ||
- | 532 | //Now inventory in the weapons control group!
|
|
- | 533 | tcGameWeapons->addControl(new touchcontrols::Button("jetpack", touchcontrols::RectF(0,3,2,5),"jetpack",gamefunc_Jetpack,false,false,true)); |
|
- | 534 | tcGameWeapons->addControl(new touchcontrols::Button("medkit", touchcontrols::RectF(0,5,2,7),"medkit",gamefunc_MedKit,false,false,true)); |
|
- | 535 | tcGameWeapons->addControl(new touchcontrols::Button("nightv", touchcontrols::RectF(0,7,2,9),"nightvision",gamefunc_NightVision,false,false,true)); |
|
- | 536 | tcGameWeapons->addControl(new touchcontrols::Button("holoduke",touchcontrols::RectF(0,9,2,11),"holoduke",gamefunc_Holo_Duke,false,false,true)); |
|
- | 537 | tcGameWeapons->addControl(new touchcontrols::Button("steroids",touchcontrols::RectF(0,11,2,13),"steroids",gamefunc_Steroids,false,false,true)); |
|
- | 538 | //Inventory are the only buttons so safe to do this
|
|
- | 539 | tcGameWeapons->signal_button.connect( sigc::ptr_fun(&inventoryButton) ); |
|
- | 540 | ||
490 | 541 | ||
491 | //Weapons
|
542 | //Weapons
|
492 | weaponWheel = new touchcontrols::WheelSelect("weapon_wheel",touchcontrols::RectF(7,2,19,14),"weapon_wheel_orange_blank",10); |
543 | weaponWheel = new touchcontrols::WheelSelect("weapon_wheel",touchcontrols::RectF(7,2,19,14),"weapon_wheel_orange_blank",10); |
493 | weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen) ); |
544 | weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen) ); |
494 | weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected)); |
545 | weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected)); |
495 | tcGameWeapons->addControl(weaponWheel); |
546 | tcGameWeapons->addControl(weaponWheel); |
496 | tcGameWeapons->setAlpha(0.9); |
547 | tcGameWeapons->setAlpha(0.9); |
497 | 548 | ||
- | 549 | /*
|
|
498 | tcInventory->addControl(new touchcontrols::Button("jetpack", touchcontrols::RectF(0,3,2,5),"jetpack",gamefunc_Jetpack)); |
550 | tcInventory->addControl(new touchcontrols::Button("jetpack", touchcontrols::RectF(0,3,2,5),"jetpack",gamefunc_Jetpack));
|
499 | tcInventory->addControl(new touchcontrols::Button("medkit", touchcontrols::RectF(0,5,2,7),"medkit",gamefunc_MedKit)); |
551 | tcInventory->addControl(new touchcontrols::Button("medkit", touchcontrols::RectF(0,5,2,7),"medkit",gamefunc_MedKit));
|
500 | tcInventory->addControl(new touchcontrols::Button("nightv", touchcontrols::RectF(0,7,2,9),"nightvision",gamefunc_NightVision)); |
552 | tcInventory->addControl(new touchcontrols::Button("nightv", touchcontrols::RectF(0,7,2,9),"nightvision",gamefunc_NightVision));
|
501 | tcInventory->addControl(new touchcontrols::Button("holoduke",touchcontrols::RectF(0,9,2,11),"holoduke",gamefunc_Holo_Duke)); |
553 | tcInventory->addControl(new touchcontrols::Button("holoduke",touchcontrols::RectF(0,9,2,11),"holoduke",gamefunc_Holo_Duke));
|
502 | tcInventory->addControl(new touchcontrols::Button("steroids",touchcontrols::RectF(0,11,2,13),"steroids",gamefunc_Steroids)); |
554 | tcInventory->addControl(new touchcontrols::Button("steroids",touchcontrols::RectF(0,11,2,13),"steroids",gamefunc_Steroids));
|
503 | tcInventory->setAlpha(1); |
555 | tcInventory->setAlpha(1);
|
504 | 556 | ||
505 | tcInventory->signal_button.connect( sigc::ptr_fun(&inventoryButton)); |
557 | tcInventory->signal_button.connect( sigc::ptr_fun(&inventoryButton));
|
- | 558 | */
|
|
- | 559 | ||
506 | 560 | ||
507 | /////////////////////////////////////////////////////////////
|
561 | /////////////////////////////////////////////////////////////
|
508 | 562 | ||
509 | 563 | ||
510 | controlsContainer.addControlGroup(tcMenuMain); |
564 | controlsContainer.addControlGroup(tcMenuMain); |
511 | controlsContainer.addControlGroup(tcGameMain); |
565 | controlsContainer.addControlGroup(tcGameMain); |
512 | controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick |
566 | // controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick
|
513 | controlsContainer.addControlGroup(tcGameWeapons); |
567 | controlsContainer.addControlGroup(tcGameWeapons); |
514 | //controlsContainer.addControlGroup(tcAutomap);
|
568 | controlsContainer.addControlGroup(tcAutomap); |
515 | controlsContainer.addControlGroup(tcYesNo); |
569 | controlsContainer.addControlGroup(tcYesNo); |
516 | controlsContainer.addControlGroup(tcBlankTap); |
570 | controlsContainer.addControlGroup(tcBlankTap); |
517 | controlsCreated = 1; |
571 | controlsCreated = 1; |
518 | 572 | ||
519 | tcGameMain->setAlpha(gameControlsAlpha); |
573 | tcGameMain->setAlpha(gameControlsAlpha); |
Line 523... | Line 577... | ||
523 | 577 | ||
524 | 578 | ||
525 | tcGameMain->setXMLFile((std::string)graphics_path + "/game.xml"); |
579 | tcGameMain->setXMLFile((std::string)graphics_path + "/game.xml"); |
526 | tcGameWeapons->setXMLFile((std::string)graphics_path + "/weapons.xml"); |
580 | tcGameWeapons->setXMLFile((std::string)graphics_path + "/weapons.xml"); |
527 | tcAutomap->setXMLFile((std::string)graphics_path + "/automap.xml"); |
581 | tcAutomap->setXMLFile((std::string)graphics_path + "/automap.xml"); |
528 | tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml"); |
582 | // tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
|
529 | 583 | ||
- | 584 | setControlsContainer(&controlsContainer); |
|
530 | }
|
585 | }
|
531 | else
|
586 | else
|
532 | LOGI("NOT creating controls"); |
587 | LOGI("NOT creating controls"); |
533 | 588 | ||
534 | //controlsContainer.initGL();
|
589 | //controlsContainer.initGL();
|
Line 563... | Line 618... | ||
563 | case TOUCH_SCREEN_GAME: |
618 | case TOUCH_SCREEN_GAME: |
564 | tcGameMain->resetOutput(); |
619 | tcGameMain->resetOutput(); |
565 | 620 | ||
566 | tcGameMain->fade(touchcontrols::FADE_OUT,DEFAULT_FADE_FRAMES); |
621 | tcGameMain->fade(touchcontrols::FADE_OUT,DEFAULT_FADE_FRAMES); |
567 | tcGameWeapons->setEnabled(false); |
622 | tcGameWeapons->setEnabled(false); |
568 | tcInventory->setEnabled(false); |
- | |
- | 623 | ||
569 | break; |
624 | break; |
570 | case TOUCH_SCREEN_AUTOMAP: |
625 | case TOUCH_SCREEN_AUTOMAP: |
- | 626 | tcAutomap->resetOutput(); |
|
- | 627 | tcAutomap->fade(touchcontrols::FADE_OUT,DEFAULT_FADE_FRAMES); |
|
571 | break; |
628 | break; |
572 | case TOUCH_SCREEN_CONSOLE: |
629 | case TOUCH_SCREEN_CONSOLE: |
573 | break; |
630 | break; |
574 | }
|
631 | }
|
575 | 632 | ||
Line 586... | Line 643... | ||
586 | tcYesNo->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
643 | tcYesNo->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
587 | break; |
644 | break; |
588 | case TOUCH_SCREEN_MENU: |
645 | case TOUCH_SCREEN_MENU: |
589 | tcMenuMain->setEnabled(true); |
646 | tcMenuMain->setEnabled(true); |
590 | tcMenuMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
647 | tcMenuMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
- | 648 | ||
- | 649 | //This is a bit of a hack, we need to enable the inventory buttons so they can be edited, they will not be seen anyway
|
|
- | 650 | showWeaponsInventory(true); |
|
591 | break; |
651 | break; |
592 | case TOUCH_SCREEN_GAME: |
652 | case TOUCH_SCREEN_GAME: |
593 | tcGameMain->setEnabled(true); |
653 | tcGameMain->setEnabled(true); |
594 | tcGameMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
654 | tcGameMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
595 | tcGameWeapons->setEnabled(true); |
655 | tcGameWeapons->setEnabled(true); |
596 | tcInventory->setEnabled(false); |
656 | showWeaponsInventory(false); |
597 | break; |
657 | break; |
598 | case TOUCH_SCREEN_AUTOMAP: |
658 | case TOUCH_SCREEN_AUTOMAP: |
- | 659 | tcAutomap->setEnabled(true); |
|
- | 660 | tcAutomap->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES); |
|
- | 661 | ||
599 | break; |
662 | break; |
600 | case TOUCH_SCREEN_CONSOLE: |
663 | case TOUCH_SCREEN_CONSOLE: |
601 | break; |
664 | break; |
602 | }
|
665 | }
|
603 | 666 | ||
Line 610... | Line 673... | ||
610 | #ifdef GP_LIC
|
673 | #ifdef GP_LIC
|
611 | #define GP_LIC_INC 1
|
674 | #define GP_LIC_INC 1
|
612 | #include "s-setup/gp_lic_include.h"
|
675 | #include "s-setup/gp_lic_include.h"
|
613 | #endif
|
676 | #endif
|
614 | 677 | ||
615 | extern int clearCtrl; |
- | |
616 | void frameControls() |
678 | void frameControls() |
617 | {
|
679 | {
|
618 | static int loadedGLImages = 0; |
680 | static int loadedGLImages = 0; |
619 | 681 | ||
620 | //LOGI("frameControls");
|
682 | LOGI("frameControls"); |
621 | clearCtrl ++; |
- | |
- | 683 | ||
622 | 684 | ||
623 | //We need to do this here now because duke loads a new gl context
|
685 | //We need to do this here now because duke loads a new gl context
|
624 | if (!loadedGLImages) |
686 | if (!loadedGLImages) |
625 | {
|
687 | {
|
626 | touchJoyRight->setEnabled(false); |
- | |
627 | - | ||
628 | controlsContainer.initGL(); |
688 | controlsContainer.initGL(); |
629 | loadedGLImages = 1; |
689 | loadedGLImages = 1; |
630 | }
|
690 | }
|
631 | 691 | ||
632 | //LOGI("frameControls");
|
692 | //LOGI("frameControls");
|
633 | curRenderer = (PortableRead(READ_RENDERER) != REND_CLASSIC); |
693 | curRenderer = (PortableRead(READ_RENDERER) != REND_CLASSIC); |
634 | 694 | ||
635 | updateTouchScreenMode((touchscreemode_t)PortableRead(READ_SCREEN_MODE)); |
695 | updateTouchScreenMode((touchscreemode_t)PortableRead(READ_SCREEN_MODE)); |
636 | 696 | ||
637 | /*
|
- | |
638 | int inMenuNew = PortableRead(READ_MENU);
|
- | |
639 | if (inMenuLast != inMenuNew)
|
- | |
640 | {
|
- | |
641 | inMenuLast = inMenuNew;
|
- | |
642 | if (!inMenuNew)
|
- | |
643 | {
|
- | |
644 | tcGameMain->setEnabled(true);
|
- | |
645 | tcGameWeapons->setEnabled(true);
|
- | |
646 | tcGameWeapons->fade(1,DEFAULT_FADE_FRAMES);
|
- | |
647 | tcMenuMain->setEnabled(false);
|
- | |
648 | }
|
- | |
649 | else
|
- | |
650 | {
|
- | |
651 | tcGameMain->setEnabled(false);
|
- | |
652 | tcGameWeapons->setEnabled(false);
|
- | |
653 | tcMenuMain->setEnabled(true);
|
- | |
654 | }
|
- | |
655 | }
|
- | |
656 | - | ||
657 | int inAutomapNew = PortableRead(READ_AUTOMAP) && !inMenuLast; //Dont show if menu comes up
|
- | |
658 | if (inAutomapLast != inAutomapNew)
|
- | |
659 | {
|
- | |
660 | inAutomapLast = inAutomapNew;
|
- | |
661 | if (inAutomapNew)
|
- | |
662 | {
|
- | |
663 | tcAutomap->animateIn(5);
|
- | |
664 | }
|
- | |
665 | else
|
- | |
666 | {
|
- | |
667 | tcAutomap->animateOut(5);
|
- | |
668 | }
|
- | |
669 | }
|
- | |
670 | */
|
- | |
671 | 697 | ||
672 | setHideSticks(!showSticks); |
698 | setHideSticks(!showSticks); |
673 | controlsContainer.draw(); |
699 | controlsContainer.draw(); |
674 | 700 | ||
675 | #ifdef GP_LIC
|
701 | #ifdef GP_LIC
|
Line 693... | Line 719... | ||
693 | tcMenuMain->setAlpha(gameControlsAlpha); |
719 | tcMenuMain->setAlpha(gameControlsAlpha); |
694 | // tcInventory->setAlpha(gameControlsAlpha);
|
720 | // tcInventory->setAlpha(gameControlsAlpha);
|
695 | }
|
721 | }
|
696 | 722 | ||
697 | // TODO: defined names for these values
|
723 | // TODO: defined names for these values
|
- | 724 | selectLastWeap = other & 0x1 ? true : false; |
|
698 | toggleCrouch = other & 0x2 ? true : false; |
725 | toggleCrouch = other & 0x2 ? true : false; |
699 | invertLook = other & 0x4 ? true : false; |
726 | invertLook = other & 0x4 ? true : false; |
700 | precisionShoot = other & 0x8 ? true : false; |
727 | precisionShoot = other & 0x8 ? true : false; |
701 | showSticks = other & 0x1000 ? true : false; |
728 | showSticks = other & 0x1000 ? true : false; |
702 | 729 | ||
703 | hideTouchControls = other & 0x80000000 ? true : false; |
730 | hideTouchControls = other & 0x80000000 ? true : false; |
704 | 731 | ||
705 | switch ((other>>4) & 0xF) |
732 | int doubletap_options[6] = {0,gamefunc_Fire,gamefunc_Jump,gamefunc_Quick_Kick,gamefunc_MedKit,gamefunc_Jetpack}; |
706 | {
|
733 | |
707 | case 1: |
- | |
708 | droidinput.left_double_action = gamefunc_Fire; |
734 | droidinput.left_double_action = doubletap_options[((other>>4) & 0xF)]; |
709 | break; |
- | |
710 | case 2: |
- | |
711 | droidinput.left_double_action = gamefunc_Jump; |
735 | droidinput.right_double_action = doubletap_options[((other>>8) & 0xF)]; |
712 | break; |
- | |
713 | default: |
- | |
714 | droidinput.left_double_action = -1; |
- | |
715 | }
|
- | |
716 | 736 | ||
717 | switch ((other>>8) & 0xF) |
- | |
718 | {
|
- | |
719 | case 1: |
- | |
720 | droidinput.right_double_action = gamefunc_Fire; |
- | |
721 | break; |
- | |
722 | case 2: |
- | |
723 | droidinput.right_double_action = gamefunc_Jump; |
- | |
724 | break; |
- | |
725 | default: |
- | |
726 | droidinput.right_double_action = -1; |
- | |
727 | }
|
- | |
728 | 737 | ||
729 | droidinput.strafe_sens = strafe; |
738 | droidinput.strafe_sens = strafe; |
730 | droidinput.forward_sens = fwd; |
739 | droidinput.forward_sens = fwd; |
731 | droidinput.pitch_sens = pitch; |
740 | droidinput.pitch_sens = pitch; |
732 | droidinput.yaw_sens = yaw; |
741 | droidinput.yaw_sens = yaw; |
733 | 742 | ||
734 | LOGI("setTouchSettings alpha = %f, left_double_action = %d",alpha,droidinput.left_double_action); |
743 | LOGI("setTouchSettings alpha = %f, left_double_action = %d",alpha,droidinput.left_double_action); |
735 | }
|
744 | }
|
736 | 745 | ||
737 | #define EXPORT_ME __attribute__ ((visibility("default")))
|
746 | #define EXPORT_ME __NDK_FPABI__ __attribute__ ((visibility("default")))
|
738 | 747 | ||
739 | JNIEnv* env_; |
748 | JNIEnv* env_; |
740 | 749 | ||
741 | int argc=1; |
750 | int argc=1; |
742 | const char * argv[32]; |
751 | const char * argv[32]; |
Line 746... | Line 755... | ||
746 | static const char * getGamePath() |
755 | static const char * getGamePath() |
747 | {
|
756 | {
|
748 | return doom_path.c_str(); |
757 | return doom_path.c_str(); |
749 | }
|
758 | }
|
750 | 759 | ||
- | 760 | ||
751 | jint EXPORT_ME |
761 | jint EXPORT_ME |
752 | Java_com_beloko_duke_engine_NativeLib_init( JNIEnv* env, |
762 | Java_com_beloko_duke_engine_NativeLib_init( JNIEnv* env, |
753 | jobject thiz,jstring graphics_dir,jint audio_rate,jint audio_buffer_size,jobjectArray argsArray,jint renderer,jstring doom_path_ )
|
763 | jobject thiz,jstring graphics_dir,jint audio_rate,jint audio_buffer_size,jobjectArray argsArray,jint renderer,jstring doom_path_ )
|
754 | {
|
764 | {
|
755 | env_ = env; |
765 | env_ = env; |