Removed warnings by explicitly casting to u8 for controllers

This commit is contained in:
Charles Rozhon 2014-08-14 14:44:10 -05:00
parent 64697abe48
commit a8c31d134b
5 changed files with 23 additions and 23 deletions

View File

@ -103,17 +103,17 @@ void GCPad::GetInput(GCPadStatus* const pad)
// sticks // sticks
m_main_stick->GetState(&x, &y); m_main_stick->GetState(&x, &y);
pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (x * GCPadStatus::MAIN_STICK_RADIUS); pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (u8)(x * GCPadStatus::MAIN_STICK_RADIUS);
pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (y * GCPadStatus::MAIN_STICK_RADIUS); pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (u8)(y * GCPadStatus::MAIN_STICK_RADIUS);
m_c_stick->GetState(&x, &y); m_c_stick->GetState(&x, &y);
pad->substickX = GCPadStatus::C_STICK_CENTER_X + (x * GCPadStatus::C_STICK_RADIUS); pad->substickX = GCPadStatus::C_STICK_CENTER_X + (u8)(x * GCPadStatus::C_STICK_RADIUS);
pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (y * GCPadStatus::C_STICK_RADIUS); pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (u8)(y * GCPadStatus::C_STICK_RADIUS);
// triggers // triggers
m_triggers->GetState(&pad->button, trigger_bitmasks, triggers); m_triggers->GetState(&pad->button, trigger_bitmasks, triggers);
pad->triggerLeft = triggers[0] * 0xFF; pad->triggerLeft = (u8)(triggers[0] * 0xFF);
pad->triggerRight = triggers[1] * 0xFF; pad->triggerRight = (u8)(triggers[1] * 0xFF);
} }
void GCPad::SetMotor(const u8 on) void GCPad::SetMotor(const u8 on)

View File

@ -92,8 +92,8 @@ void Classic::GetState(u8* const data)
double x, y; double x, y;
m_left_stick->GetState(&x, &y); m_left_stick->GetState(&x, &y);
ccdata->lx = Classic::LEFT_STICK_CENTER_X + (x * Classic::LEFT_STICK_RADIUS); ccdata->lx = Classic::LEFT_STICK_CENTER_X + (u8)(x * Classic::LEFT_STICK_RADIUS);
ccdata->ly = Classic::LEFT_STICK_CENTER_Y + (y * Classic::LEFT_STICK_RADIUS); ccdata->ly = Classic::LEFT_STICK_CENTER_Y + (u8)(y * Classic::LEFT_STICK_RADIUS);
} }
// right stick // right stick
@ -102,8 +102,8 @@ void Classic::GetState(u8* const data)
u8 x_, y_; u8 x_, y_;
m_right_stick->GetState(&x, &y); m_right_stick->GetState(&x, &y);
x_ = Classic::RIGHT_STICK_CENTER_X + (x * Classic::RIGHT_STICK_RADIUS); x_ = Classic::RIGHT_STICK_CENTER_X + (u8)(x * Classic::RIGHT_STICK_RADIUS);
y_ = Classic::RIGHT_STICK_CENTER_Y + (y * Classic::RIGHT_STICK_RADIUS); y_ = Classic::RIGHT_STICK_CENTER_Y + (u8)(y * Classic::RIGHT_STICK_RADIUS);
ccdata->rx1 = x_; ccdata->rx1 = x_;
ccdata->rx2 = x_ >> 1; ccdata->rx2 = x_ >> 1;
@ -117,8 +117,8 @@ void Classic::GetState(u8* const data)
u8 lt, rt; u8 lt, rt;
m_triggers->GetState(&ccdata->bt, classic_trigger_bitmasks, trigs); m_triggers->GetState(&ccdata->bt, classic_trigger_bitmasks, trigs);
lt = trigs[0] * Classic::LEFT_TRIGGER_RANGE; lt = (u8)(trigs[0] * Classic::LEFT_TRIGGER_RANGE);
rt = trigs[1] * Classic::RIGHT_TRIGGER_RANGE; rt = (u8)(trigs[1] * Classic::RIGHT_TRIGGER_RANGE);
ccdata->lt1 = lt; ccdata->lt1 = lt;
ccdata->lt2 = lt >> 3; ccdata->lt2 = lt >> 3;

View File

@ -63,8 +63,8 @@ void Drums::GetState(u8* const data)
double x, y; double x, y;
m_stick->GetState(&x, &y); m_stick->GetState(&x, &y);
ddata->sx = (x * 0x1F) + 0x20; ddata->sx = (u8)(x * 0x1F) + 0x20;
ddata->sy = (y * 0x1F) + 0x20; ddata->sy = (u8)(y * 0x1F) + 0x20;
} }
// TODO: softness maybe // TODO: softness maybe

View File

@ -76,8 +76,8 @@ void Guitar::GetState(u8* const data)
double x, y; double x, y;
m_stick->GetState(&x, &y); m_stick->GetState(&x, &y);
gdata->sx = (x * 0x1F) + 0x20; gdata->sx = (u8)(x * 0x1F) + 0x20;
gdata->sy = (y * 0x1F) + 0x20; gdata->sy = (u8)(y * 0x1F) + 0x20;
} }
// TODO: touch bar, probably not // TODO: touch bar, probably not
@ -86,7 +86,7 @@ void Guitar::GetState(u8* const data)
// whammy bar // whammy bar
double whammy; double whammy;
m_whammy->GetState(&whammy); m_whammy->GetState(&whammy);
gdata->whammy = whammy * 0x1F; gdata->whammy = (u8)(whammy * 0x1F);
// buttons // buttons
m_buttons->GetState(&gdata->bt, guitar_button_bitmasks); m_buttons->GetState(&gdata->bt, guitar_button_bitmasks);

View File

@ -65,8 +65,8 @@ void Turntable::GetState(u8* const data)
double x, y; double x, y;
m_stick->GetState(&x, &y); m_stick->GetState(&x, &y);
ttdata->sx = (x * 0x1F) + 0x20; ttdata->sx = (u8)(x * 0x1F) + 0x20;
ttdata->sy = (y * 0x1F) + 0x20; ttdata->sy = (u8)(y * 0x1F) + 0x20;
} }
// left table // left table
@ -75,7 +75,7 @@ void Turntable::GetState(u8* const data)
s8 tt_; s8 tt_;
m_left_table->GetState(&tt); m_left_table->GetState(&tt);
tt_ = tt * 0x1F; tt_ = (s8)(tt * 0x1F);
ttdata->ltable1 = tt_; ttdata->ltable1 = tt_;
ttdata->ltable2 = tt_ >> 5; ttdata->ltable2 = tt_ >> 5;
@ -87,7 +87,7 @@ void Turntable::GetState(u8* const data)
s8 tt_; s8 tt_;
m_right_table->GetState(&tt); m_right_table->GetState(&tt);
tt_ = tt * 0x1F; tt_ = (s8)(tt * 0x1F);
ttdata->rtable1 = tt_; ttdata->rtable1 = tt_;
ttdata->rtable2 = tt_ >> 1; ttdata->rtable2 = tt_ >> 1;
@ -101,7 +101,7 @@ void Turntable::GetState(u8* const data)
u8 dial_; u8 dial_;
m_effect_dial->GetState(&dial); m_effect_dial->GetState(&dial);
dial_ = dial * 0x0F; dial_ = (u8)(dial * 0x0F);
ttdata->dial1 = dial_; ttdata->dial1 = dial_;
ttdata->dial2 = dial_ >> 3; ttdata->dial2 = dial_ >> 3;
@ -112,7 +112,7 @@ void Turntable::GetState(u8* const data)
double cfs; double cfs;
m_crossfade->GetState(&cfs); m_crossfade->GetState(&cfs);
ttdata->slider = (cfs * 0x07) + 0x08; ttdata->slider = (u8)(cfs * 0x07) + 0x08;
} }
// buttons // buttons