Nuked console
This commit is contained in:
@@ -59,31 +59,10 @@ void inputUpdate(void) {
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(cur->actionType) {
|
||||
case INPUT_BUTTON_ACTION_TYPE_NULL: {
|
||||
break;
|
||||
}
|
||||
|
||||
case INPUT_BUTTON_ACTION_TYPE_COMMAND: {
|
||||
if(cur->lastVal == 0.0f && cur->command[0] != '\0') {
|
||||
consoleExec(cur->command);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case INPUT_BUTTON_ACTION_TYPE_ACTION: {
|
||||
INPUT.actions[cur->action].currentValue = mathMax(
|
||||
cur->curVal, INPUT.actions[cur->action].currentValue
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
assertUnreachable("Unknown input button action type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INPUT.actions[cur->action].currentValue = mathMax(
|
||||
cur->curVal, INPUT.actions[cur->action].currentValue
|
||||
);
|
||||
|
||||
cur++;
|
||||
} while(cur->name);
|
||||
@@ -122,10 +101,11 @@ float_t inputAxis(const inputaction_t neg, const inputaction_t pos) {
|
||||
return inputGetCurrentValue(pos) - inputGetCurrentValue(neg);
|
||||
}
|
||||
|
||||
void inputBind(const inputbutton_t button, const char_t *action) {
|
||||
assertNotNull(action, "Input action is null");
|
||||
assertStrLenMin(action, 1, "Input action is empty");
|
||||
assertStrLenMax(action, CONSOLE_LINE_MAX - 1, "Input action is too long");
|
||||
void inputBind(const inputbutton_t button, const inputaction_t act) {
|
||||
assertTrue(
|
||||
act < INPUT_ACTION_COUNT,
|
||||
"Invalid input action"
|
||||
);
|
||||
|
||||
// Get the button data for this button.
|
||||
inputbuttondata_t *data = INPUT_BUTTON_DATA;
|
||||
@@ -137,19 +117,6 @@ void inputBind(const inputbutton_t button, const char_t *action) {
|
||||
} while(data->name != NULL);
|
||||
assertNotNull(data->name, "Input button not found");
|
||||
|
||||
// Try find input action first.
|
||||
for(inputaction_t act = 0; act < INPUT_ACTION_COUNT; act++) {
|
||||
if(stringCompareInsensitive(INPUT_ACTION_NAMES[act], action) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Action found.
|
||||
data->actionType = INPUT_BUTTON_ACTION_TYPE_ACTION;
|
||||
data->action = act;
|
||||
return;
|
||||
}
|
||||
|
||||
// No action found, treat as command.
|
||||
data->actionType = INPUT_BUTTON_ACTION_TYPE_COMMAND;
|
||||
stringCopy(data->command, action, CONSOLE_LINE_MAX);
|
||||
// Bind the action.
|
||||
data->action = act;
|
||||
}
|
||||
Reference in New Issue
Block a user