Added in an invert possibility for joypad_set. Using a string instead of true/false/nil will let lua invert the player's input.

This commit is contained in:
fatratknight 2009-09-15 18:20:10 +00:00
parent 0bea4a45d8
commit feb135ce2e
2 changed files with 4 additions and 4 deletions

View File

@ -1,3 +1,4 @@
15-september-2009 - FatRatKnight - Finally got in that "invert" value for joypad.set. This value simply inverts the player input. Actually, any string will invert it, since we have not used strings for anything else in joypad.set.
15-september-2009 - FatRatKnight - Reworked how input is taken from lua, and generally everything related to joypad.set and what it affects. Now setting stuff to false will: Prevent user control for exactly one frame, and allow more than one false button as a time. Yeah, bug fixes. Hopefully runs a little faster now.
22-august-2009 - adelikat - Win32 - Map Hotkeys Dialog - Fixed but where "X" and Alt+F4 would not close dialog
22-august-2009 - adelikat - Win32 - Added a Save Config File menu item

View File

@ -709,7 +709,7 @@ static int joypad_read(lua_State *L) {
// frame advance. The table should have the right
// keys (no pun intended) set.
/*FatRatKnight: I changed some of the logic.
*/
Now with 4 options!*/
static int joypad_set(lua_State *L) {
// Which joypad we're tampering with
@ -733,10 +733,9 @@ static int joypad_set(lua_State *L) {
//Button is not nil, so find out if it is true/false
if (!lua_isnil(L,-1))
{
if (lua_toboolean(L,-1)) //True
if (lua_toboolean(L,-1)) //True or string
luajoypads2[which-1] |= 1 << i;
else //False
//if (lua_toboolean == 0 || 'string is "invert"'
if (lua_toboolean(L,-1) == 0 || lua_isstring(L,-1)) //False or string
luajoypads1[which-1] &= ~(1 << i);
}