From 73d6a6f0e5416515f09c7d9ee8d79efa4b01cf22 Mon Sep 17 00:00:00 2001 From: andreferreira Date: Sun, 6 Dec 2009 02:06:14 -0200 Subject: [PATCH] Tirando codigo comentado e outros lixos --- controlewii.cpp | 110 ++++---------------------------------------------------- 1 file changed, 6 insertions(+), 104 deletions(-) diff --git a/controlewii.cpp b/controlewii.cpp index 20fa468..8ce3ff6 100644 --- a/controlewii.cpp +++ b/controlewii.cpp @@ -78,11 +78,6 @@ void ControleWii::handleEvent(SDL_Event &e) { sources++; } if (sources > 0) { - /*y = y / sources; - double angle = (y / 738.0) * PI; - y = jogador.getY() + jogador.pescoco().y - jogador.game->camera.y - 100 * cos(angle); - x = jogador.getX() + jogador.pescoco().x - jogador.game->camera.x + 100 * sin(angle); - jogador.setAim(x,y);*/ x = x / sources; y = y / sources; x = jogador.game->config->screen["width"] - (x / 1024.0) * jogador.game->config->screen["width"]; @@ -92,7 +87,6 @@ void ControleWii::handleEvent(SDL_Event &e) { } break; case CWIID_MESG_BTN: { - //printf("Button Report: %.4X\n", mesg->btn_mesg.buttons); buttonsWii = mesg->btn_mesg.buttons; if (mesg->btn_mesg.buttons & 4) { //R atira jogador.fire(); @@ -102,17 +96,8 @@ void ControleWii::handleEvent(SDL_Event &e) { case CWIID_MESG_NUNCHUK: { int newX = mesg->nunchuk_mesg.stick[CWIID_X] - 120; int newY = mesg->nunchuk_mesg.stick[CWIID_Y] - 131; - /* - printf("Nunchuk Report: btns=%.2X stick=(%d,%d) acc.x=%d acc.y=%d " - "acc.z=%d\n", mesg->nunchuk_mesg.buttons, - newX, - newY, - mesg->nunchuk_mesg.acc[CWIID_X], - mesg->nunchuk_mesg.acc[CWIID_Y], - mesg->nunchuk_mesg.acc[CWIID_Z]);*/ - if (stickX != 0xffff) { //para calibrar - //jogador.addSpeed(-3.0*stickX/128,0); + if (stickX != 0xffff) { jogador.setSpeed(3.0*newX/128,jogador.getSpeedY()); } stickX = newX; @@ -186,8 +171,7 @@ void ControleWii::handleEvent(SDL_Event &e) { : ((bf) | (b)) cwiid_err_t err; -void err(cwiid_wiimote_t *wiimote, const char *s, va_list ap) -{ +void err(cwiid_wiimote_t *wiimote, const char *s, va_list ap) { if (wiimote) printf("%d:", cwiid_get_id(wiimote)); else printf("-1:"); vprintf(s, ap); @@ -195,15 +179,11 @@ void err(cwiid_wiimote_t *wiimote, const char *s, va_list ap) } void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, - union cwiid_mesg mesg[], struct timespec *timestamp) -{ + union cwiid_mesg mesg[], struct timespec *timestamp) { int i, j; int valid_source; - - - for (i=0; i < mesg_count; i++) - { + for (i=0; i < mesg_count; i++) { SDL_Event event; SDL_UserEvent userevent; userevent.type = SDL_USEREVENT; @@ -217,92 +197,16 @@ void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, userevent.data2 = m; event.user = userevent; SDL_PushEvent(&event); - /*switch (mesg[i].type) { - case CWIID_MESG_STATUS: - printf("Status Report: battery=%d extension=", - mesg[i].status_mesg.battery); - switch (mesg[i].status_mesg.ext_type) { - case CWIID_EXT_NONE: - printf("none"); - break; - case CWIID_EXT_NUNCHUK: - printf("Nunchuk"); - break; - case CWIID_EXT_CLASSIC: - printf("Classic Controller"); - break; - default: - printf("Unknown Extension"); - break; - } - printf("\n"); - break; - case CWIID_MESG_BTN: - printf("Button Report: %.4X\n", mesg[i].btn_mesg.buttons); - break; - case CWIID_MESG_ACC: - printf("Acc Report: x=%d, y=%d, z=%d\n", - mesg[i].acc_mesg.acc[CWIID_X], - mesg[i].acc_mesg.acc[CWIID_Y], - mesg[i].acc_mesg.acc[CWIID_Z]); - break; - case CWIID_MESG_IR: - printf("IR Report: "); - valid_source = 0; - for (j = 0; j < CWIID_IR_SRC_COUNT; j++) { - if (mesg[i].ir_mesg.src[j].valid) { - valid_source = 1; - printf("(%d,%d) ", mesg[i].ir_mesg.src[j].pos[CWIID_X], - mesg[i].ir_mesg.src[j].pos[CWIID_Y]); - } - } - if (!valid_source) { - printf("no sources detected"); - } - printf("\n"); - break; - case CWIID_MESG_NUNCHUK: { - printf("Nunchuk Report: btns=%.2X stick=(%d,%d) acc.x=%d acc.y=%d " - "acc.z=%d\n", mesg[i].nunchuk_mesg.buttons, - mesg[i].nunchuk_mesg.stick[CWIID_X], - mesg[i].nunchuk_mesg.stick[CWIID_Y], - mesg[i].nunchuk_mesg.acc[CWIID_X], - mesg[i].nunchuk_mesg.acc[CWIID_Y], - mesg[i].nunchuk_mesg.acc[CWIID_Z]); - break; - } - case CWIID_MESG_CLASSIC: - printf("Classic Report: btns=%.4X l_stick=(%d,%d) r_stick=(%d,%d) " - "l=%d r=%d\n", mesg[i].classic_mesg.buttons, - mesg[i].classic_mesg.l_stick[CWIID_X], - mesg[i].classic_mesg.l_stick[CWIID_Y], - mesg[i].classic_mesg.r_stick[CWIID_X], - mesg[i].classic_mesg.r_stick[CWIID_Y], - mesg[i].classic_mesg.l, mesg[i].classic_mesg.r); - break; - case CWIID_MESG_ERROR: - if (cwiid_close(wiimote)) { - fprintf(stderr, "Error on wiimote disconnect\n"); - exit(-1); - } - exit(0); - break; - default: - printf("Unknown Report"); - break; - }*/ } } -void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state) -{ +void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state) { if (cwiid_set_led(wiimote, led_state)) { fprintf(stderr, "Error setting LEDs \n"); } } -void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode) -{ +void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode) { if (cwiid_set_rpt_mode(wiimote, rpt_mode)) { fprintf(stderr, "Error setting report mode\n"); } @@ -330,10 +234,8 @@ bool ControleWii::ControleWii::initializeWiimote() { } toggle_bit(rpt_mode, CWIID_RPT_BTN); //abilita status report de botoes - //set_rpt_mode(wiimote, rpt_mode); toggle_bit(rpt_mode, CWIID_RPT_NUNCHUK); //abilita status report de nunchuck - //set_rpt_mode(wiimote, rpt_mode); toggle_bit(led_state, CWIID_LED4_ON); //liga quarto LED para indentificar ligaƧao com o NOSSO jogo e nao o wii set_led_state(wiimote, led_state); -- 2.11.4.GIT